Fossil SCM

merge trunk

jan.nijtmans 2017-07-13 10:24 openssl-1.1 merge
Commit 548fabe73caf8e5894d1f54dc7405905ef476cd2c04b258d2cbc6e9e34939e34
--- skins/xekri/css.txt
+++ skins/xekri/css.txt
@@ -376,11 +376,11 @@
376376
377377
/**************************************
378378
* File List : Age
379379
*/
380380
381
-.fileage tr:hover td {
381
+.fileage tr:hover {
382382
background-color: #225;
383383
}
384384
385385
386386
/**************************************
387387
--- skins/xekri/css.txt
+++ skins/xekri/css.txt
@@ -376,11 +376,11 @@
376
377 /**************************************
378 * File List : Age
379 */
380
381 .fileage tr:hover td {
382 background-color: #225;
383 }
384
385
386 /**************************************
387
--- skins/xekri/css.txt
+++ skins/xekri/css.txt
@@ -376,11 +376,11 @@
376
377 /**************************************
378 * File List : Age
379 */
380
381 .fileage tr:hover {
382 background-color: #225;
383 }
384
385
386 /**************************************
387
+6 -6
--- src/browse.c
+++ src/browse.c
@@ -1090,23 +1090,23 @@
10901090
style_header("File Ages");
10911091
zGlob = P("glob");
10921092
compute_fileage(rid,zGlob);
10931093
db_multi_exec("CREATE INDEX fileage_ix1 ON fileage(mid,pathname);");
10941094
1095
- @ <h2>Files in
1095
+ @ <h1>Files in
10961096
@ %z(href("%R/info/%!S",zUuid))[%S(zUuid)]</a>
10971097
if( zGlob && zGlob[0] ){
1098
- @ that match "%h(zGlob)" and
1098
+ @ that match "%h(zGlob)"
10991099
}
1100
- @ ordered by check-in time</h2>
1100
+ @ ordered by age</h1>
11011101
@
1102
- @ <p>Times are relative to the check-in time for
1103
- @ %z(href("%R/ci/%!S",zUuid))[%S(zUuid)]</a> which is
1102
+ @ <p>File ages are expressed relative to the
1103
+ @ %z(href("%R/ci/%!S",zUuid))[%S(zUuid)]</a> check-in time of
11041104
@ %z(href("%R/timeline?c=%t",zNow))%s(zNow)</a>.</p>
11051105
@
11061106
@ <div class='fileage'><table>
1107
- @ <tr><th>Time</th><th>Files</th><th>Check-in</th></tr>
1107
+ @ <tr><th>Age</th><th>Files</th><th>Check-in</th></tr>
11081108
db_prepare(&q1,
11091109
"SELECT event.mtime, event.objid, blob.uuid,\n"
11101110
" coalesce(event.ecomment,event.comment),\n"
11111111
" coalesce(event.euser,event.user),\n"
11121112
" coalesce((SELECT value FROM tagxref\n"
11131113
--- src/browse.c
+++ src/browse.c
@@ -1090,23 +1090,23 @@
1090 style_header("File Ages");
1091 zGlob = P("glob");
1092 compute_fileage(rid,zGlob);
1093 db_multi_exec("CREATE INDEX fileage_ix1 ON fileage(mid,pathname);");
1094
1095 @ <h2>Files in
1096 @ %z(href("%R/info/%!S",zUuid))[%S(zUuid)]</a>
1097 if( zGlob && zGlob[0] ){
1098 @ that match "%h(zGlob)" and
1099 }
1100 @ ordered by check-in time</h2>
1101 @
1102 @ <p>Times are relative to the check-in time for
1103 @ %z(href("%R/ci/%!S",zUuid))[%S(zUuid)]</a> which is
1104 @ %z(href("%R/timeline?c=%t",zNow))%s(zNow)</a>.</p>
1105 @
1106 @ <div class='fileage'><table>
1107 @ <tr><th>Time</th><th>Files</th><th>Check-in</th></tr>
1108 db_prepare(&q1,
1109 "SELECT event.mtime, event.objid, blob.uuid,\n"
1110 " coalesce(event.ecomment,event.comment),\n"
1111 " coalesce(event.euser,event.user),\n"
1112 " coalesce((SELECT value FROM tagxref\n"
1113
--- src/browse.c
+++ src/browse.c
@@ -1090,23 +1090,23 @@
1090 style_header("File Ages");
1091 zGlob = P("glob");
1092 compute_fileage(rid,zGlob);
1093 db_multi_exec("CREATE INDEX fileage_ix1 ON fileage(mid,pathname);");
1094
1095 @ <h1>Files in
1096 @ %z(href("%R/info/%!S",zUuid))[%S(zUuid)]</a>
1097 if( zGlob && zGlob[0] ){
1098 @ that match "%h(zGlob)"
1099 }
1100 @ ordered by age</h1>
1101 @
1102 @ <p>File ages are expressed relative to the
1103 @ %z(href("%R/ci/%!S",zUuid))[%S(zUuid)]</a> check-in time of
1104 @ %z(href("%R/timeline?c=%t",zNow))%s(zNow)</a>.</p>
1105 @
1106 @ <div class='fileage'><table>
1107 @ <tr><th>Age</th><th>Files</th><th>Check-in</th></tr>
1108 db_prepare(&q1,
1109 "SELECT event.mtime, event.objid, blob.uuid,\n"
1110 " coalesce(event.ecomment,event.comment),\n"
1111 " coalesce(event.euser,event.user),\n"
1112 " coalesce((SELECT value FROM tagxref\n"
1113
--- src/codecheck1.c
+++ src/codecheck1.c
@@ -510,14 +510,14 @@
510510
static int scan_file(const char *zName, const char *zContent){
511511
const char *z;
512512
int ln = 0;
513513
int szToken;
514514
int eToken;
515
- const char *zPrev;
516
- int ePrev;
517
- int szPrev;
518
- int lnPrev;
515
+ const char *zPrev = 0;
516
+ int ePrev = 0;
517
+ int szPrev = 0;
518
+ int lnPrev = 0;
519519
int nCurly = 0;
520520
int x;
521521
unsigned fmtFlags = 0;
522522
int nErr = 0;
523523
524524
--- src/codecheck1.c
+++ src/codecheck1.c
@@ -510,14 +510,14 @@
510 static int scan_file(const char *zName, const char *zContent){
511 const char *z;
512 int ln = 0;
513 int szToken;
514 int eToken;
515 const char *zPrev;
516 int ePrev;
517 int szPrev;
518 int lnPrev;
519 int nCurly = 0;
520 int x;
521 unsigned fmtFlags = 0;
522 int nErr = 0;
523
524
--- src/codecheck1.c
+++ src/codecheck1.c
@@ -510,14 +510,14 @@
510 static int scan_file(const char *zName, const char *zContent){
511 const char *z;
512 int ln = 0;
513 int szToken;
514 int eToken;
515 const char *zPrev = 0;
516 int ePrev = 0;
517 int szPrev = 0;
518 int lnPrev = 0;
519 int nCurly = 0;
520 int x;
521 unsigned fmtFlags = 0;
522 int nErr = 0;
523
524
--- src/dispatch.c
+++ src/dispatch.c
@@ -98,10 +98,11 @@
9898
while( lwr<=upr ){
9999
int c;
100100
mid = (upr+lwr)/2;
101101
c = strcmp(zName, aCommand[mid].zName);
102102
if( c==0 ){
103
+ if( (aCommand[mid].eCmdFlags & eType)==0 ) return 1;
103104
*ppCmd = &aCommand[mid];
104105
return 0; /* An exact match */
105106
}else if( c<0 ){
106107
upr = mid - 1;
107108
}else{
108109
--- src/dispatch.c
+++ src/dispatch.c
@@ -98,10 +98,11 @@
98 while( lwr<=upr ){
99 int c;
100 mid = (upr+lwr)/2;
101 c = strcmp(zName, aCommand[mid].zName);
102 if( c==0 ){
 
103 *ppCmd = &aCommand[mid];
104 return 0; /* An exact match */
105 }else if( c<0 ){
106 upr = mid - 1;
107 }else{
108
--- src/dispatch.c
+++ src/dispatch.c
@@ -98,10 +98,11 @@
98 while( lwr<=upr ){
99 int c;
100 mid = (upr+lwr)/2;
101 c = strcmp(zName, aCommand[mid].zName);
102 if( c==0 ){
103 if( (aCommand[mid].eCmdFlags & eType)==0 ) return 1;
104 *ppCmd = &aCommand[mid];
105 return 0; /* An exact match */
106 }else if( c<0 ){
107 upr = mid - 1;
108 }else{
109
+4 -2
--- src/doc.c
+++ src/doc.c
@@ -576,10 +576,11 @@
576576
void doc_page(void){
577577
const char *zName; /* Argument to the /doc page */
578578
const char *zOrigName = "?"; /* Original document name */
579579
const char *zMime; /* Document MIME type */
580580
char *zCheckin = "tip"; /* The check-in holding the document */
581
+ char *zPathSuffix = ""; /* Text to append to g.zPath */
581582
int vid = 0; /* Artifact of check-in */
582583
int rid = 0; /* Artifact of file */
583584
int i; /* Loop counter */
584585
Blob filebody; /* Content of the documentation file */
585586
Blob title; /* Document title */
@@ -619,13 +620,13 @@
619620
}else if( !isUV ){
620621
zName += i;
621622
}
622623
while( zName[0]=='/' ){ zName++; }
623624
if( isUV ){
624
- g.zPath = mprintf("%s/%s", g.zPath, zName);
625
+ zPathSuffix = fossil_strdup(zName);
625626
}else{
626
- g.zPath = mprintf("%s/%s/%s", g.zPath, zCheckin, zName);
627
+ zPathSuffix = mprintf("%s/%s", zCheckin, zName);
627628
}
628629
if( nMiss==0 ) zOrigName = zName;
629630
if( !file_is_simple_pathname(zName, 1) ){
630631
if( sqlite3_strglob("*/", zName)==0 ){
631632
assert( nMiss>=0 && nMiss<count(azSuffix) );
@@ -657,10 +658,11 @@
657658
}else{
658659
vid = name_to_typed_rid(zCheckin, "ci");
659660
rid = doc_load_content(vid, zName, &filebody);
660661
}
661662
}
663
+ g.zPath = mprintf("%s/%s", g.zPath, zPathSuffix);
662664
if( rid==0 ) goto doc_not_found;
663665
blob_to_utf8_no_bom(&filebody, 0);
664666
665667
/* The file is now contained in the filebody blob. Deliver the
666668
** file to the user
667669
--- src/doc.c
+++ src/doc.c
@@ -576,10 +576,11 @@
576 void doc_page(void){
577 const char *zName; /* Argument to the /doc page */
578 const char *zOrigName = "?"; /* Original document name */
579 const char *zMime; /* Document MIME type */
580 char *zCheckin = "tip"; /* The check-in holding the document */
 
581 int vid = 0; /* Artifact of check-in */
582 int rid = 0; /* Artifact of file */
583 int i; /* Loop counter */
584 Blob filebody; /* Content of the documentation file */
585 Blob title; /* Document title */
@@ -619,13 +620,13 @@
619 }else if( !isUV ){
620 zName += i;
621 }
622 while( zName[0]=='/' ){ zName++; }
623 if( isUV ){
624 g.zPath = mprintf("%s/%s", g.zPath, zName);
625 }else{
626 g.zPath = mprintf("%s/%s/%s", g.zPath, zCheckin, zName);
627 }
628 if( nMiss==0 ) zOrigName = zName;
629 if( !file_is_simple_pathname(zName, 1) ){
630 if( sqlite3_strglob("*/", zName)==0 ){
631 assert( nMiss>=0 && nMiss<count(azSuffix) );
@@ -657,10 +658,11 @@
657 }else{
658 vid = name_to_typed_rid(zCheckin, "ci");
659 rid = doc_load_content(vid, zName, &filebody);
660 }
661 }
 
662 if( rid==0 ) goto doc_not_found;
663 blob_to_utf8_no_bom(&filebody, 0);
664
665 /* The file is now contained in the filebody blob. Deliver the
666 ** file to the user
667
--- src/doc.c
+++ src/doc.c
@@ -576,10 +576,11 @@
576 void doc_page(void){
577 const char *zName; /* Argument to the /doc page */
578 const char *zOrigName = "?"; /* Original document name */
579 const char *zMime; /* Document MIME type */
580 char *zCheckin = "tip"; /* The check-in holding the document */
581 char *zPathSuffix = ""; /* Text to append to g.zPath */
582 int vid = 0; /* Artifact of check-in */
583 int rid = 0; /* Artifact of file */
584 int i; /* Loop counter */
585 Blob filebody; /* Content of the documentation file */
586 Blob title; /* Document title */
@@ -619,13 +620,13 @@
620 }else if( !isUV ){
621 zName += i;
622 }
623 while( zName[0]=='/' ){ zName++; }
624 if( isUV ){
625 zPathSuffix = fossil_strdup(zName);
626 }else{
627 zPathSuffix = mprintf("%s/%s", zCheckin, zName);
628 }
629 if( nMiss==0 ) zOrigName = zName;
630 if( !file_is_simple_pathname(zName, 1) ){
631 if( sqlite3_strglob("*/", zName)==0 ){
632 assert( nMiss>=0 && nMiss<count(azSuffix) );
@@ -657,10 +658,11 @@
658 }else{
659 vid = name_to_typed_rid(zCheckin, "ci");
660 rid = doc_load_content(vid, zName, &filebody);
661 }
662 }
663 g.zPath = mprintf("%s/%s", g.zPath, zPathSuffix);
664 if( rid==0 ) goto doc_not_found;
665 blob_to_utf8_no_bom(&filebody, 0);
666
667 /* The file is now contained in the filebody blob. Deliver the
668 ** file to the user
669
+3
--- src/foci.c
+++ src/foci.c
@@ -264,9 +264,12 @@
264264
0, /* xSync */
265265
0, /* xCommit */
266266
0, /* xRollback */
267267
0, /* xFindMethod */
268268
0, /* xRename */
269
+ 0, /* xSavepoint */
270
+ 0, /* xRelease */
271
+ 0 /* xRollbackTo */
269272
};
270273
sqlite3_create_module(db, "files_of_checkin", &foci_module, 0);
271274
return SQLITE_OK;
272275
}
273276
--- src/foci.c
+++ src/foci.c
@@ -264,9 +264,12 @@
264 0, /* xSync */
265 0, /* xCommit */
266 0, /* xRollback */
267 0, /* xFindMethod */
268 0, /* xRename */
 
 
 
269 };
270 sqlite3_create_module(db, "files_of_checkin", &foci_module, 0);
271 return SQLITE_OK;
272 }
273
--- src/foci.c
+++ src/foci.c
@@ -264,9 +264,12 @@
264 0, /* xSync */
265 0, /* xCommit */
266 0, /* xRollback */
267 0, /* xFindMethod */
268 0, /* xRename */
269 0, /* xSavepoint */
270 0, /* xRelease */
271 0 /* xRollbackTo */
272 };
273 sqlite3_create_module(db, "files_of_checkin", &foci_module, 0);
274 return SQLITE_OK;
275 }
276
+8 -2
--- src/info.c
+++ src/info.c
@@ -162,11 +162,12 @@
162162
*/
163163
static void showParentProject(void){
164164
const char *zParentCode;
165165
zParentCode = db_get("parent-project-code",0);
166166
if( zParentCode ){
167
- fossil_print("derived-from: %s %s\n", zParentCode, db_get("parent-project-name",""));
167
+ fossil_print("derived-from: %s %s\n", zParentCode,
168
+ db_get("parent-project-name",""));
168169
}
169170
}
170171
171172
172173
/*
@@ -178,17 +179,22 @@
178179
** If an argument is specified, provide information about the object
179180
** in the repository of the current tree that the argument refers
180181
** to. Or if the argument is the name of a repository, show
181182
** information about that repository.
182183
**
184
+** If the argument is a repository name, then the --verbose option shows
185
+** known the check-out locations for that repository and all URLs used
186
+** to access the repository. The --verbose is (currently) a no-op if
187
+** the argument is the name of a object within the repository.
188
+**
183189
** Use the "finfo" command to get information about a specific
184190
** file in a checkout.
185191
**
186192
** Options:
187193
**
188194
** -R|--repository FILE Extract info from repository FILE
189
-** -v|--verbose Show extra information
195
+** -v|--verbose Show extra information about repositories
190196
**
191197
** See also: annotate, artifact, finfo, timeline
192198
*/
193199
void info_cmd(void){
194200
i64 fsize;
195201
--- src/info.c
+++ src/info.c
@@ -162,11 +162,12 @@
162 */
163 static void showParentProject(void){
164 const char *zParentCode;
165 zParentCode = db_get("parent-project-code",0);
166 if( zParentCode ){
167 fossil_print("derived-from: %s %s\n", zParentCode, db_get("parent-project-name",""));
 
168 }
169 }
170
171
172 /*
@@ -178,17 +179,22 @@
178 ** If an argument is specified, provide information about the object
179 ** in the repository of the current tree that the argument refers
180 ** to. Or if the argument is the name of a repository, show
181 ** information about that repository.
182 **
 
 
 
 
 
183 ** Use the "finfo" command to get information about a specific
184 ** file in a checkout.
185 **
186 ** Options:
187 **
188 ** -R|--repository FILE Extract info from repository FILE
189 ** -v|--verbose Show extra information
190 **
191 ** See also: annotate, artifact, finfo, timeline
192 */
193 void info_cmd(void){
194 i64 fsize;
195
--- src/info.c
+++ src/info.c
@@ -162,11 +162,12 @@
162 */
163 static void showParentProject(void){
164 const char *zParentCode;
165 zParentCode = db_get("parent-project-code",0);
166 if( zParentCode ){
167 fossil_print("derived-from: %s %s\n", zParentCode,
168 db_get("parent-project-name",""));
169 }
170 }
171
172
173 /*
@@ -178,17 +179,22 @@
179 ** If an argument is specified, provide information about the object
180 ** in the repository of the current tree that the argument refers
181 ** to. Or if the argument is the name of a repository, show
182 ** information about that repository.
183 **
184 ** If the argument is a repository name, then the --verbose option shows
185 ** known the check-out locations for that repository and all URLs used
186 ** to access the repository. The --verbose is (currently) a no-op if
187 ** the argument is the name of a object within the repository.
188 **
189 ** Use the "finfo" command to get information about a specific
190 ** file in a checkout.
191 **
192 ** Options:
193 **
194 ** -R|--repository FILE Extract info from repository FILE
195 ** -v|--verbose Show extra information about repositories
196 **
197 ** See also: annotate, artifact, finfo, timeline
198 */
199 void info_cmd(void){
200 i64 fsize;
201
+1 -1
--- src/manifest.c
+++ src/manifest.c
@@ -804,11 +804,11 @@
804804
** If the user name is omitted, take that to be "anonymous".
805805
*/
806806
case 'U': {
807807
if( p->zUser!=0 ) SYNTAX("more than one U-card");
808808
p->zUser = next_token(&x, 0);
809
- if( p->zUser==0 ){
809
+ if( p->zUser==0 || p->zUser[0]==0 ){
810810
p->zUser = "anonymous";
811811
}else{
812812
defossilize(p->zUser);
813813
}
814814
break;
815815
--- src/manifest.c
+++ src/manifest.c
@@ -804,11 +804,11 @@
804 ** If the user name is omitted, take that to be "anonymous".
805 */
806 case 'U': {
807 if( p->zUser!=0 ) SYNTAX("more than one U-card");
808 p->zUser = next_token(&x, 0);
809 if( p->zUser==0 ){
810 p->zUser = "anonymous";
811 }else{
812 defossilize(p->zUser);
813 }
814 break;
815
--- src/manifest.c
+++ src/manifest.c
@@ -804,11 +804,11 @@
804 ** If the user name is omitted, take that to be "anonymous".
805 */
806 case 'U': {
807 if( p->zUser!=0 ) SYNTAX("more than one U-card");
808 p->zUser = next_token(&x, 0);
809 if( p->zUser==0 || p->zUser[0]==0 ){
810 p->zUser = "anonymous";
811 }else{
812 defossilize(p->zUser);
813 }
814 break;
815
+42 -17
--- src/markdown.md
+++ src/markdown.md
@@ -1,71 +1,96 @@
11
# Markdown Overview #
22
33
## Paragraphs ##
44
55
> Paragraphs are divided by blank lines.
6
+> End a line with two or more spaces to force a mid-paragraph line break.
67
78
## Headings ##
89
910
>
1011
# Top-level Heading Alternative Top Level Heading
11
- =============================
12
+ # Top-level Heading Variant # =============================
1213
>
1314
## Second-level Heading Alternative 2nd Level Heading
14
- -----------------------------
15
+ ## Second-level Heading Variant ## -----------------------------
1516
1617
## Links ##
1718
1819
> 1. **\[display text\]\(URL\)**
1920
> 2. **\[display text\]\(URL "Title"\)**
20
-> 3. **\<URL\>**
21
-> 4. **\[display text\]\[label\]**
21
+> 3. **\[display text\]\(URL 'Title'\)**
22
+> 4. **\<URL\>**
23
+> 5. **\[display text\]\[label\]**
24
+> 6. **\[display text\]\[\]**
25
+
26
+> **URL** may optionally be written **\<URL\>**. With link formats 5 and 6
27
+> ("reference links"), the URL is supplied elsewhere in the document, as shown
28
+> below. Link format 6 reuses the display text as the label. Labels are
29
+> case-insensitive. The title may be split onto the next line with optional
30
+> indenting.
2231
23
-> With link format 4 ("reference links") the label must be resolved by
24
-> including a line of the form **\[label\]:&nbsp;URL** or
25
-> **\[label\]:&nbsp;URL&nbsp;"Title"** somewhere else
26
-> in the document.
32
+> * **\[label\]:&nbsp;URL**
33
+> * **\[label\]:&nbsp;URL&nbsp;"Title"**
34
+> * **\[label\]:&nbsp;URL&nbsp;'Title'**
35
+> * **\[label\]:&nbsp;URL&nbsp;(Title)**
2736
2837
## Fonts ##
2938
3039
> * _\*italic\*_
3140
> * *\_italic\_*
3241
> * __\*\*bold\*\*__
3342
> * **\_\_bold\_\_**
34
-> * `` `code` ``
43
+> * ___\*\*\*italic+bold\*\*\*___
44
+> * ***\_\_\_italic+bold\_\_\_***
45
+> * \``code`\`
3546
36
-> Note that the \`...\` construct disables HTML markup, so one can write,
37
-> for example, **\``<html>`\`** to yield **`<html>`**.
47
+> The **\`code\`** construct disables HTML markup, so one can write, for
48
+> example, **\`\<html\>\`** to yield **`<html>`**.
3849
3950
## Lists ##
4051
4152
>
4253
* bullet item
4354
+ bullet item
4455
- bullet item
4556
1. numbered item
4657
58
+> A two-level list is created by placing additional whitespace before the
59
+> **\***/**+**/**-**/**1.** of the secondary items.
60
+
61
+>
62
+ * top-level item
63
+ * secondary item
64
+
4765
## Block Quotes ##
4866
49
-> Begin each line of a paragraph with ">" to block quote that paragraph.
67
+> Begin each line of a paragraph with **>** to block quote that paragraph.
5068
5169
> >
5270
> This paragraph is indented
5371
> >
5472
> > Double-indented paragraph
73
+
74
+> Begin each line with at least four spaces or one tab to produce a verbatim
75
+> code block.
5576
5677
## Miscellaneous ##
5778
58
-> * In-line images using **\!\[alt-text\]\(image-URL\)**
59
-> * Use HTML for complex formatting issues.
79
+> * In-line images are made using **\!\[alt-text\]\(image-URL\)**.
80
+> * Use HTML for complex formatting such as tables and forms.
6081
> * Escape special characters (ex: "\[", "\(", "\*")
6182
> using backslash (ex: "\\\[", "\\\(", "\\\*").
62
-> * See [daringfireball.net](http://daringfireball.net/projects/markdown/syntax)
63
-> for additional information.
83
+> * A line consisting of **---**, **\*\*\***, or **\_\_\_** is a horizontal
84
+> rule. Spaces and extra **-**/**\***/**_** are allowed.
85
+> * See [daringfireball.net][] for additional information.
86
+> * See this page's [Markdown source](/md_rules?txt=1) for more examples.
6487
6588
## Special Features For Fossil ##
6689
6790
> * In hyperlinks, if the URL begins with "/" then the root of the Fossil
6891
> repository is prepended. This allows for repository-relative hyperlinks.
69
-> * For documents that begin with top-level heading (ex: "# heading #"), the
92
+> * For documents that begin with a top-level heading (ex: "# heading #"), the
7093
> heading is omitted from the body of the document and becomes the document
7194
> title displayed at the top of the Fossil page.
95
+
96
+[daringfireball.net]: http://daringfireball.net/projects/markdown/syntax
7297
--- src/markdown.md
+++ src/markdown.md
@@ -1,71 +1,96 @@
1 # Markdown Overview #
2
3 ## Paragraphs ##
4
5 > Paragraphs are divided by blank lines.
 
6
7 ## Headings ##
8
9 >
10 # Top-level Heading Alternative Top Level Heading
11 =============================
12 >
13 ## Second-level Heading Alternative 2nd Level Heading
14 -----------------------------
15
16 ## Links ##
17
18 > 1. **\[display text\]\(URL\)**
19 > 2. **\[display text\]\(URL "Title"\)**
20 > 3. **\<URL\>**
21 > 4. **\[display text\]\[label\]**
 
 
 
 
 
 
 
 
22
23 > With link format 4 ("reference links") the label must be resolved by
24 > including a line of the form **\[label\]:&nbsp;URL** or
25 > **\[label\]:&nbsp;URL&nbsp;"Title"** somewhere else
26 > in the document.
27
28 ## Fonts ##
29
30 > * _\*italic\*_
31 > * *\_italic\_*
32 > * __\*\*bold\*\*__
33 > * **\_\_bold\_\_**
34 > * `` `code` ``
 
 
35
36 > Note that the \`...\` construct disables HTML markup, so one can write,
37 > for example, **\``<html>`\`** to yield **`<html>`**.
38
39 ## Lists ##
40
41 >
42 * bullet item
43 + bullet item
44 - bullet item
45 1. numbered item
46
 
 
 
 
 
 
 
47 ## Block Quotes ##
48
49 > Begin each line of a paragraph with ">" to block quote that paragraph.
50
51 > >
52 > This paragraph is indented
53 > >
54 > > Double-indented paragraph
 
 
 
55
56 ## Miscellaneous ##
57
58 > * In-line images using **\!\[alt-text\]\(image-URL\)**
59 > * Use HTML for complex formatting issues.
60 > * Escape special characters (ex: "\[", "\(", "\*")
61 > using backslash (ex: "\\\[", "\\\(", "\\\*").
62 > * See [daringfireball.net](http://daringfireball.net/projects/markdown/syntax)
63 > for additional information.
 
 
64
65 ## Special Features For Fossil ##
66
67 > * In hyperlinks, if the URL begins with "/" then the root of the Fossil
68 > repository is prepended. This allows for repository-relative hyperlinks.
69 > * For documents that begin with top-level heading (ex: "# heading #"), the
70 > heading is omitted from the body of the document and becomes the document
71 > title displayed at the top of the Fossil page.
 
 
72
--- src/markdown.md
+++ src/markdown.md
@@ -1,71 +1,96 @@
1 # Markdown Overview #
2
3 ## Paragraphs ##
4
5 > Paragraphs are divided by blank lines.
6 > End a line with two or more spaces to force a mid-paragraph line break.
7
8 ## Headings ##
9
10 >
11 # Top-level Heading Alternative Top Level Heading
12 # Top-level Heading Variant # =============================
13 >
14 ## Second-level Heading Alternative 2nd Level Heading
15 ## Second-level Heading Variant ## -----------------------------
16
17 ## Links ##
18
19 > 1. **\[display text\]\(URL\)**
20 > 2. **\[display text\]\(URL "Title"\)**
21 > 3. **\[display text\]\(URL 'Title'\)**
22 > 4. **\<URL\>**
23 > 5. **\[display text\]\[label\]**
24 > 6. **\[display text\]\[\]**
25
26 > **URL** may optionally be written **\<URL\>**. With link formats 5 and 6
27 > ("reference links"), the URL is supplied elsewhere in the document, as shown
28 > below. Link format 6 reuses the display text as the label. Labels are
29 > case-insensitive. The title may be split onto the next line with optional
30 > indenting.
31
32 > * **\[label\]:&nbsp;URL**
33 > * **\[label\]:&nbsp;URL&nbsp;"Title"**
34 > * **\[label\]:&nbsp;URL&nbsp;'Title'**
35 > * **\[label\]:&nbsp;URL&nbsp;(Title)**
36
37 ## Fonts ##
38
39 > * _\*italic\*_
40 > * *\_italic\_*
41 > * __\*\*bold\*\*__
42 > * **\_\_bold\_\_**
43 > * ___\*\*\*italic+bold\*\*\*___
44 > * ***\_\_\_italic+bold\_\_\_***
45 > * \``code`\`
46
47 > The **\`code\`** construct disables HTML markup, so one can write, for
48 > example, **\`\<html\>\`** to yield **`<html>`**.
49
50 ## Lists ##
51
52 >
53 * bullet item
54 + bullet item
55 - bullet item
56 1. numbered item
57
58 > A two-level list is created by placing additional whitespace before the
59 > **\***/**+**/**-**/**1.** of the secondary items.
60
61 >
62 * top-level item
63 * secondary item
64
65 ## Block Quotes ##
66
67 > Begin each line of a paragraph with **>** to block quote that paragraph.
68
69 > >
70 > This paragraph is indented
71 > >
72 > > Double-indented paragraph
73
74 > Begin each line with at least four spaces or one tab to produce a verbatim
75 > code block.
76
77 ## Miscellaneous ##
78
79 > * In-line images are made using **\!\[alt-text\]\(image-URL\)**.
80 > * Use HTML for complex formatting such as tables and forms.
81 > * Escape special characters (ex: "\[", "\(", "\*")
82 > using backslash (ex: "\\\[", "\\\(", "\\\*").
83 > * A line consisting of **---**, **\*\*\***, or **\_\_\_** is a horizontal
84 > rule. Spaces and extra **-**/**\***/**_** are allowed.
85 > * See [daringfireball.net][] for additional information.
86 > * See this page's [Markdown source](/md_rules?txt=1) for more examples.
87
88 ## Special Features For Fossil ##
89
90 > * In hyperlinks, if the URL begins with "/" then the root of the Fossil
91 > repository is prepended. This allows for repository-relative hyperlinks.
92 > * For documents that begin with a top-level heading (ex: "# heading #"), the
93 > heading is omitted from the body of the document and becomes the document
94 > title displayed at the top of the Fossil page.
95
96 [daringfireball.net]: http://daringfireball.net/projects/markdown/syntax
97
+4 -4
--- src/mkversion.c
+++ src/mkversion.c
@@ -12,11 +12,14 @@
1212
#include <stdlib.h>
1313
1414
int main(int argc, char *argv[]){
1515
FILE *m,*u,*v;
1616
char *z;
17
- int i, j, x, d;
17
+#if defined(__DMC__) /* e.g. 0x857 */
18
+ int i = 0;
19
+#endif
20
+ int j = 0, x = 0, d = 0;
1821
int vn[3];
1922
char b[1000];
2023
char vx[1000];
2124
memset(b,0,sizeof(b));
2225
memset(vx,0,sizeof(vx));
@@ -45,12 +48,10 @@
4548
}
4649
fclose(v);
4750
for(z=b; z[0] && z[0]!='\r' && z[0]!='\n'; z++){}
4851
*z = 0;
4952
printf("#define RELEASE_VERSION \"%s\"\n", b);
50
- x=0;
51
- i=j=0;
5253
z=b;
5354
vn[0] = vn[1] = vn[2] = 0;
5455
while(1){
5556
if( z[0]>='0' && z[0]<='9' ){
5657
x = x*10 + z[0] - '0';
@@ -63,11 +64,10 @@
6364
}
6465
for(z=vx; z[0]=='0'; z++){}
6566
printf("#define RELEASE_VERSION_NUMBER %d%02d%02d\n", vn[0], vn[1], vn[2]);
6667
memset(vx,0,sizeof(vx));
6768
strcpy(vx,b);
68
- d = 0;
6969
for(z=vx; z[0]; z++){
7070
if( z[0]=='-' ){
7171
z[0] = 0;
7272
break;
7373
}
7474
--- src/mkversion.c
+++ src/mkversion.c
@@ -12,11 +12,14 @@
12 #include <stdlib.h>
13
14 int main(int argc, char *argv[]){
15 FILE *m,*u,*v;
16 char *z;
17 int i, j, x, d;
 
 
 
18 int vn[3];
19 char b[1000];
20 char vx[1000];
21 memset(b,0,sizeof(b));
22 memset(vx,0,sizeof(vx));
@@ -45,12 +48,10 @@
45 }
46 fclose(v);
47 for(z=b; z[0] && z[0]!='\r' && z[0]!='\n'; z++){}
48 *z = 0;
49 printf("#define RELEASE_VERSION \"%s\"\n", b);
50 x=0;
51 i=j=0;
52 z=b;
53 vn[0] = vn[1] = vn[2] = 0;
54 while(1){
55 if( z[0]>='0' && z[0]<='9' ){
56 x = x*10 + z[0] - '0';
@@ -63,11 +64,10 @@
63 }
64 for(z=vx; z[0]=='0'; z++){}
65 printf("#define RELEASE_VERSION_NUMBER %d%02d%02d\n", vn[0], vn[1], vn[2]);
66 memset(vx,0,sizeof(vx));
67 strcpy(vx,b);
68 d = 0;
69 for(z=vx; z[0]; z++){
70 if( z[0]=='-' ){
71 z[0] = 0;
72 break;
73 }
74
--- src/mkversion.c
+++ src/mkversion.c
@@ -12,11 +12,14 @@
12 #include <stdlib.h>
13
14 int main(int argc, char *argv[]){
15 FILE *m,*u,*v;
16 char *z;
17 #if defined(__DMC__) /* e.g. 0x857 */
18 int i = 0;
19 #endif
20 int j = 0, x = 0, d = 0;
21 int vn[3];
22 char b[1000];
23 char vx[1000];
24 memset(b,0,sizeof(b));
25 memset(vx,0,sizeof(vx));
@@ -45,12 +48,10 @@
48 }
49 fclose(v);
50 for(z=b; z[0] && z[0]!='\r' && z[0]!='\n'; z++){}
51 *z = 0;
52 printf("#define RELEASE_VERSION \"%s\"\n", b);
 
 
53 z=b;
54 vn[0] = vn[1] = vn[2] = 0;
55 while(1){
56 if( z[0]>='0' && z[0]<='9' ){
57 x = x*10 + z[0] - '0';
@@ -63,11 +64,10 @@
64 }
65 for(z=vx; z[0]=='0'; z++){}
66 printf("#define RELEASE_VERSION_NUMBER %d%02d%02d\n", vn[0], vn[1], vn[2]);
67 memset(vx,0,sizeof(vx));
68 strcpy(vx,b);
 
69 for(z=vx; z[0]; z++){
70 if( z[0]=='-' ){
71 z[0] = 0;
72 break;
73 }
74
--- src/security_audit.c
+++ src/security_audit.c
@@ -44,11 +44,10 @@
4444
void secaudit0_page(void){
4545
const char *zAnonCap; /* Capabilities of user "anonymous" and "nobody" */
4646
const char *zPubPages; /* GLOB pattern for public pages */
4747
char *z;
4848
int n;
49
- double r;
5049
5150
login_check_credentials();
5251
if( !g.perm.Setup && !g.perm.Admin ){
5352
login_needed(0);
5453
return;
@@ -96,11 +95,11 @@
9695
@ <li> Tickets
9796
}
9897
if( zPubPages && zPubPages[0] ){
9998
Glob *pGlob = glob_create(zPubPages);
10099
int i;
101
- @ <li> URLs that matches any of these GLOB patterns:
100
+ @ <li> URLs that match any of these GLOB patterns:
102101
@ <ul>
103102
for(i=0; i<pGlob->nPattern; i++){
104103
@ <li> %h(pGlob->azPattern[i])
105104
}
106105
@ </ul>
107106
--- src/security_audit.c
+++ src/security_audit.c
@@ -44,11 +44,10 @@
44 void secaudit0_page(void){
45 const char *zAnonCap; /* Capabilities of user "anonymous" and "nobody" */
46 const char *zPubPages; /* GLOB pattern for public pages */
47 char *z;
48 int n;
49 double r;
50
51 login_check_credentials();
52 if( !g.perm.Setup && !g.perm.Admin ){
53 login_needed(0);
54 return;
@@ -96,11 +95,11 @@
96 @ <li> Tickets
97 }
98 if( zPubPages && zPubPages[0] ){
99 Glob *pGlob = glob_create(zPubPages);
100 int i;
101 @ <li> URLs that matches any of these GLOB patterns:
102 @ <ul>
103 for(i=0; i<pGlob->nPattern; i++){
104 @ <li> %h(pGlob->azPattern[i])
105 }
106 @ </ul>
107
--- src/security_audit.c
+++ src/security_audit.c
@@ -44,11 +44,10 @@
44 void secaudit0_page(void){
45 const char *zAnonCap; /* Capabilities of user "anonymous" and "nobody" */
46 const char *zPubPages; /* GLOB pattern for public pages */
47 char *z;
48 int n;
 
49
50 login_check_credentials();
51 if( !g.perm.Setup && !g.perm.Admin ){
52 login_needed(0);
53 return;
@@ -96,11 +95,11 @@
95 @ <li> Tickets
96 }
97 if( zPubPages && zPubPages[0] ){
98 Glob *pGlob = glob_create(zPubPages);
99 int i;
100 @ <li> URLs that match any of these GLOB patterns:
101 @ <ul>
102 for(i=0; i<pGlob->nPattern; i++){
103 @ <li> %h(pGlob->azPattern[i])
104 }
105 @ </ul>
106
+2 -2
--- src/setup.c
+++ src/setup.c
@@ -1252,11 +1252,11 @@
12521252
@ </blockquote>
12531253
@ <p>Hyperlinks for user "nobody" are normally enabled as soon as the page
12541254
@ finishes loading. But the first check-box below can be set to require mouse
12551255
@ movement before enabling the links. One can also set a delay prior to enabling
12561256
@ links by enter a positive number of milliseconds in the entry box above.</p>
1257
- @ (Properties: "auto-hyperlink", "auto-hyperlink-ishuman",
1257
+ @ (Properties: "auto-hyperlink", "auto-hyperlink-ishuman",
12581258
@ "auto-hyperlink-mouseover", and "auto-hyperlink-delay")</p>
12591259
12601260
@ <hr />
12611261
onoff_attribute("Require a CAPTCHA if not logged in",
12621262
"require-captcha", "reqcapt", 1, 0);
@@ -1789,11 +1789,11 @@
17891789
@ <b>Ad-Unit Notes:</b><ul>
17901790
@ <li>Leave both Ad-Units blank to disable all advertising.
17911791
@ <li>The "Banner Ad-Unit" is used for wide pages.
17921792
@ <li>The "Right-Column Ad-Unit" is used on pages with tall, narrow content.
17931793
@ <li>If the "Right-Column Ad-Unit" is blank, the "Banner Ad-Unit" is used on all pages.
1794
- @ <li>Properties: "adunit", "adunit-right", "adunit-omit-if-admin", and
1794
+ @ <li>Properties: "adunit", "adunit-right", "adunit-omit-if-admin", and
17951795
@ "adunit-omit-if-user".
17961796
@ <li>Suggested <a href="setup_skinedit?w=0">CSS</a> changes:
17971797
@ <blockquote><pre>
17981798
@ div.adunit_banner {
17991799
@ margin: auto;
18001800
--- src/setup.c
+++ src/setup.c
@@ -1252,11 +1252,11 @@
1252 @ </blockquote>
1253 @ <p>Hyperlinks for user "nobody" are normally enabled as soon as the page
1254 @ finishes loading. But the first check-box below can be set to require mouse
1255 @ movement before enabling the links. One can also set a delay prior to enabling
1256 @ links by enter a positive number of milliseconds in the entry box above.</p>
1257 @ (Properties: "auto-hyperlink", "auto-hyperlink-ishuman",
1258 @ "auto-hyperlink-mouseover", and "auto-hyperlink-delay")</p>
1259
1260 @ <hr />
1261 onoff_attribute("Require a CAPTCHA if not logged in",
1262 "require-captcha", "reqcapt", 1, 0);
@@ -1789,11 +1789,11 @@
1789 @ <b>Ad-Unit Notes:</b><ul>
1790 @ <li>Leave both Ad-Units blank to disable all advertising.
1791 @ <li>The "Banner Ad-Unit" is used for wide pages.
1792 @ <li>The "Right-Column Ad-Unit" is used on pages with tall, narrow content.
1793 @ <li>If the "Right-Column Ad-Unit" is blank, the "Banner Ad-Unit" is used on all pages.
1794 @ <li>Properties: "adunit", "adunit-right", "adunit-omit-if-admin", and
1795 @ "adunit-omit-if-user".
1796 @ <li>Suggested <a href="setup_skinedit?w=0">CSS</a> changes:
1797 @ <blockquote><pre>
1798 @ div.adunit_banner {
1799 @ margin: auto;
1800
--- src/setup.c
+++ src/setup.c
@@ -1252,11 +1252,11 @@
1252 @ </blockquote>
1253 @ <p>Hyperlinks for user "nobody" are normally enabled as soon as the page
1254 @ finishes loading. But the first check-box below can be set to require mouse
1255 @ movement before enabling the links. One can also set a delay prior to enabling
1256 @ links by enter a positive number of milliseconds in the entry box above.</p>
1257 @ (Properties: "auto-hyperlink", "auto-hyperlink-ishuman",
1258 @ "auto-hyperlink-mouseover", and "auto-hyperlink-delay")</p>
1259
1260 @ <hr />
1261 onoff_attribute("Require a CAPTCHA if not logged in",
1262 "require-captcha", "reqcapt", 1, 0);
@@ -1789,11 +1789,11 @@
1789 @ <b>Ad-Unit Notes:</b><ul>
1790 @ <li>Leave both Ad-Units blank to disable all advertising.
1791 @ <li>The "Banner Ad-Unit" is used for wide pages.
1792 @ <li>The "Right-Column Ad-Unit" is used on pages with tall, narrow content.
1793 @ <li>If the "Right-Column Ad-Unit" is blank, the "Banner Ad-Unit" is used on all pages.
1794 @ <li>Properties: "adunit", "adunit-right", "adunit-omit-if-admin", and
1795 @ "adunit-omit-if-user".
1796 @ <li>Suggested <a href="setup_skinedit?w=0">CSS</a> changes:
1797 @ <blockquote><pre>
1798 @ div.adunit_banner {
1799 @ margin: auto;
1800
+836 -88
--- src/shell.c
+++ src/shell.c
@@ -1,5 +1,23 @@
1
+/* DO NOT EDIT!
2
+** This file is automatically generated by the script in the canonical
3
+** SQLite source tree at tool/mkshellc.tcl. That script combines source
4
+** code from various constituent source files of SQLite into this single
5
+** "shell.c" file used to implement the SQLite command-line shell.
6
+**
7
+** Most of the code found below comes from the "src/shell.c.in" file in
8
+** the canonical SQLite source tree. That main file contains "INCLUDE"
9
+** lines that specify other files in the canonical source tree that are
10
+** inserted to getnerate this complete program source file.
11
+**
12
+** The code from multiple files is combined into this single "shell.c"
13
+** source file to help make the command-line program easier to compile.
14
+**
15
+** To modify this program, get a copy of the canonical SQLite source tree,
16
+** edit the src/shell.c.in" and/or some of the other files that are included
17
+** by "src/shell.c.in", then rerun the tool/mkshellc.tcl script.
18
+*/
119
/*
220
** 2001 September 15
321
**
422
** The author disclaims copyright to this source code. In place of
523
** a legal notice, here is a blessing:
@@ -764,11 +782,11 @@
764782
int i = 0;
765783
const char *zIn = (const char*)sqlite3_value_text(apVal[0]);
766784
const char *zSchema = (const char*)sqlite3_value_text(apVal[1]);
767785
assert( nVal==2 );
768786
if( zIn!=0 && strncmp(zIn, "CREATE ", 7)==0 ){
769
- for(i=0; i<sizeof(aPrefix)/sizeof(aPrefix[0]); i++){
787
+ for(i=0; i<(int)(sizeof(aPrefix)/sizeof(aPrefix[0])); i++){
770788
int n = strlen30(aPrefix[i]);
771789
if( strncmp(zIn+7, aPrefix[i], n)==0 && zIn[n+7]==' ' ){
772790
char cQuote = quoteChar(zSchema);
773791
char *z;
774792
if( cQuote ){
@@ -782,14 +800,57 @@
782800
}
783801
}
784802
sqlite3_result_value(pCtx, apVal[0]);
785803
}
786804
787
-/******************************************************************************
788
-** SHA3 hash implementation copied from ../ext/misc/shathree.c
805
+/*
806
+** The source code for several run-time loadable extensions is inserted
807
+** below by the ../tool/mkshellc.tcl script. Before processing that included
808
+** code, we need to override some macros to make the included program code
809
+** work here in the middle of this regular program.
789810
*/
811
+#define SQLITE_EXTENSION_INIT1
812
+#define SQLITE_EXTENSION_INIT2(X) (void)(X)
813
+
814
+/************************* Begin ../ext/misc/shathree.c ******************/
815
+/*
816
+** 2017-03-08
817
+**
818
+** The author disclaims copyright to this source code. In place of
819
+** a legal notice, here is a blessing:
820
+**
821
+** May you do good and not evil.
822
+** May you find forgiveness for yourself and forgive others.
823
+** May you share freely, never taking more than you give.
824
+**
825
+******************************************************************************
826
+**
827
+** This SQLite extension implements a functions that compute SHA1 hashes.
828
+** Two SQL functions are implemented:
829
+**
830
+** sha3(X,SIZE)
831
+** sha3_query(Y,SIZE)
832
+**
833
+** The sha3(X) function computes the SHA3 hash of the input X, or NULL if
834
+** X is NULL.
835
+**
836
+** The sha3_query(Y) function evalutes all queries in the SQL statements of Y
837
+** and returns a hash of their results.
838
+**
839
+** The SIZE argument is optional. If omitted, the SHA3-256 hash algorithm
840
+** is used. If SIZE is included it must be one of the integers 224, 256,
841
+** 384, or 512, to determine SHA3 hash variant that is computed.
842
+*/
843
+SQLITE_EXTENSION_INIT1
844
+#include <assert.h>
845
+#include <string.h>
846
+#include <stdarg.h>
790847
typedef sqlite3_uint64 u64;
848
+
849
+/******************************************************************************
850
+** The Hash Engine
851
+*/
791852
/*
792853
** Macros to determine whether the machine is big or little endian,
793854
** and whether or not that determination is run-time or compile-time.
794855
**
795856
** For best performance, an attempt is made to guess at the byte-order
@@ -823,14 +884,10 @@
823884
unsigned nRate; /* Bytes of input accepted per Keccak iteration */
824885
unsigned nLoaded; /* Input bytes loaded into u.x[] so far this cycle */
825886
unsigned ixMask; /* Insert next input into u.x[nLoaded^ixMask]. */
826887
};
827888
828
-/* Allow the following routine to use the B0 variable, which is also
829
-** a macro in the termios.h header file */
830
-#undef B0
831
-
832889
/*
833890
** A single step of the Keccak mixing function for a 1600-bit state
834891
*/
835892
static void KeccakF1600Step(SHA3Context *p){
836893
int i;
@@ -1237,16 +1294,18 @@
12371294
for(i=0; i<p->nRate; i++){
12381295
p->u.x[i+p->nRate] = p->u.x[i^p->ixMask];
12391296
}
12401297
return &p->u.x[p->nRate];
12411298
}
1299
+/* End of the hashing logic
1300
+*****************************************************************************/
12421301
12431302
/*
12441303
** Implementation of the sha3(X,SIZE) function.
12451304
**
12461305
** Return a BLOB which is the SIZE-bit SHA3 hash of X. The default
1247
-** size is 256. If X is a BLOB, it is hashed as is.
1306
+** size is 256. If X is a BLOB, it is hashed as is.
12481307
** For all other non-NULL types of input, X is converted into a UTF-8 string
12491308
** and the string is hashed without the trailing 0x00 terminator. The hash
12501309
** of a NULL value is NULL.
12511310
*/
12521311
static void sha3Func(
@@ -1373,14 +1432,10 @@
13731432
sqlite3_free(zMsg);
13741433
return;
13751434
}
13761435
nCol = sqlite3_column_count(pStmt);
13771436
z = sqlite3_sql(pStmt);
1378
- if( z==0 ){
1379
- sqlite3_finalize(pStmt);
1380
- continue;
1381
- }
13821437
n = (int)strlen(z);
13831438
hash_step_vformat(&cx,"S%d:",n);
13841439
SHA3Update(&cx,(unsigned char*)z,n);
13851440
13861441
/* Compute a hash over the result of the query */
@@ -1439,12 +1494,670 @@
14391494
}
14401495
sqlite3_finalize(pStmt);
14411496
}
14421497
sqlite3_result_blob(context, SHA3Final(&cx), iSize/8, SQLITE_TRANSIENT);
14431498
}
1444
-/* End of SHA3 hashing logic copy/pasted from ../ext/misc/shathree.c
1445
-********************************************************************************/
1499
+
1500
+
1501
+#ifdef _WIN32
1502
+__declspec(dllexport)
1503
+#endif
1504
+int sqlite3_shathree_init(
1505
+ sqlite3 *db,
1506
+ char **pzErrMsg,
1507
+ const sqlite3_api_routines *pApi
1508
+){
1509
+ int rc = SQLITE_OK;
1510
+ SQLITE_EXTENSION_INIT2(pApi);
1511
+ (void)pzErrMsg; /* Unused parameter */
1512
+ rc = sqlite3_create_function(db, "sha3", 1, SQLITE_UTF8, 0,
1513
+ sha3Func, 0, 0);
1514
+ if( rc==SQLITE_OK ){
1515
+ rc = sqlite3_create_function(db, "sha3", 2, SQLITE_UTF8, 0,
1516
+ sha3Func, 0, 0);
1517
+ }
1518
+ if( rc==SQLITE_OK ){
1519
+ rc = sqlite3_create_function(db, "sha3_query", 1, SQLITE_UTF8, 0,
1520
+ sha3QueryFunc, 0, 0);
1521
+ }
1522
+ if( rc==SQLITE_OK ){
1523
+ rc = sqlite3_create_function(db, "sha3_query", 2, SQLITE_UTF8, 0,
1524
+ sha3QueryFunc, 0, 0);
1525
+ }
1526
+ return rc;
1527
+}
1528
+
1529
+/************************* End ../ext/misc/shathree.c ********************/
1530
+/************************* Begin ../ext/misc/fileio.c ******************/
1531
+/*
1532
+** 2014-06-13
1533
+**
1534
+** The author disclaims copyright to this source code. In place of
1535
+** a legal notice, here is a blessing:
1536
+**
1537
+** May you do good and not evil.
1538
+** May you find forgiveness for yourself and forgive others.
1539
+** May you share freely, never taking more than you give.
1540
+**
1541
+******************************************************************************
1542
+**
1543
+** This SQLite extension implements SQL functions readfile() and
1544
+** writefile().
1545
+*/
1546
+SQLITE_EXTENSION_INIT1
1547
+#include <stdio.h>
1548
+
1549
+/*
1550
+** Implementation of the "readfile(X)" SQL function. The entire content
1551
+** of the file named X is read and returned as a BLOB. NULL is returned
1552
+** if the file does not exist or is unreadable.
1553
+*/
1554
+static void readfileFunc(
1555
+ sqlite3_context *context,
1556
+ int argc,
1557
+ sqlite3_value **argv
1558
+){
1559
+ const char *zName;
1560
+ FILE *in;
1561
+ long nIn;
1562
+ void *pBuf;
1563
+
1564
+ (void)(argc); /* Unused parameter */
1565
+ zName = (const char*)sqlite3_value_text(argv[0]);
1566
+ if( zName==0 ) return;
1567
+ in = fopen(zName, "rb");
1568
+ if( in==0 ) return;
1569
+ fseek(in, 0, SEEK_END);
1570
+ nIn = ftell(in);
1571
+ rewind(in);
1572
+ pBuf = sqlite3_malloc( nIn );
1573
+ if( pBuf && 1==fread(pBuf, nIn, 1, in) ){
1574
+ sqlite3_result_blob(context, pBuf, nIn, sqlite3_free);
1575
+ }else{
1576
+ sqlite3_free(pBuf);
1577
+ }
1578
+ fclose(in);
1579
+}
1580
+
1581
+/*
1582
+** Implementation of the "writefile(X,Y)" SQL function. The argument Y
1583
+** is written into file X. The number of bytes written is returned. Or
1584
+** NULL is returned if something goes wrong, such as being unable to open
1585
+** file X for writing.
1586
+*/
1587
+static void writefileFunc(
1588
+ sqlite3_context *context,
1589
+ int argc,
1590
+ sqlite3_value **argv
1591
+){
1592
+ FILE *out;
1593
+ const char *z;
1594
+ sqlite3_int64 rc;
1595
+ const char *zFile;
1596
+
1597
+ (void)(argc); /* Unused parameter */
1598
+ zFile = (const char*)sqlite3_value_text(argv[0]);
1599
+ if( zFile==0 ) return;
1600
+ out = fopen(zFile, "wb");
1601
+ if( out==0 ) return;
1602
+ z = (const char*)sqlite3_value_blob(argv[1]);
1603
+ if( z==0 ){
1604
+ rc = 0;
1605
+ }else{
1606
+ rc = fwrite(z, 1, sqlite3_value_bytes(argv[1]), out);
1607
+ }
1608
+ fclose(out);
1609
+ sqlite3_result_int64(context, rc);
1610
+}
1611
+
1612
+
1613
+#ifdef _WIN32
1614
+__declspec(dllexport)
1615
+#endif
1616
+int sqlite3_fileio_init(
1617
+ sqlite3 *db,
1618
+ char **pzErrMsg,
1619
+ const sqlite3_api_routines *pApi
1620
+){
1621
+ int rc = SQLITE_OK;
1622
+ SQLITE_EXTENSION_INIT2(pApi);
1623
+ (void)pzErrMsg; /* Unused parameter */
1624
+ rc = sqlite3_create_function(db, "readfile", 1, SQLITE_UTF8, 0,
1625
+ readfileFunc, 0, 0);
1626
+ if( rc==SQLITE_OK ){
1627
+ rc = sqlite3_create_function(db, "writefile", 2, SQLITE_UTF8, 0,
1628
+ writefileFunc, 0, 0);
1629
+ }
1630
+ return rc;
1631
+}
1632
+
1633
+/************************* End ../ext/misc/fileio.c ********************/
1634
+/************************* Begin ../ext/misc/completion.c ******************/
1635
+/*
1636
+** 2017-07-10
1637
+**
1638
+** The author disclaims copyright to this source code. In place of
1639
+** a legal notice, here is a blessing:
1640
+**
1641
+** May you do good and not evil.
1642
+** May you find forgiveness for yourself and forgive others.
1643
+** May you share freely, never taking more than you give.
1644
+**
1645
+*************************************************************************
1646
+**
1647
+** This file implements an eponymous virtual table that returns suggested
1648
+** completions for a partial SQL input.
1649
+**
1650
+** Suggested usage:
1651
+**
1652
+** SELECT DISTINCT candidate COLLATE nocase
1653
+** FROM completion($prefix,$wholeline)
1654
+** ORDER BY 1;
1655
+**
1656
+** The two query parameters are optional. $prefix is the text of the
1657
+** current word being typed and that is to be completed. $wholeline is
1658
+** the complete input line, used for context.
1659
+**
1660
+** The raw completion() table might return the same candidate multiple
1661
+** times, for example if the same column name is used to two or more
1662
+** tables. And the candidates are returned in an arbitrary order. Hence,
1663
+** the DISTINCT and ORDER BY are recommended.
1664
+**
1665
+** This virtual table operates at the speed of human typing, and so there
1666
+** is no attempt to make it fast. Even a slow implementation will be much
1667
+** faster than any human can type.
1668
+**
1669
+*/
1670
+SQLITE_EXTENSION_INIT1
1671
+#include <assert.h>
1672
+#include <string.h>
1673
+#include <ctype.h>
1674
+
1675
+#ifndef SQLITE_OMIT_VIRTUALTABLE
1676
+
1677
+/* completion_vtab is a subclass of sqlite3_vtab which will
1678
+** serve as the underlying representation of a completion virtual table
1679
+*/
1680
+typedef struct completion_vtab completion_vtab;
1681
+struct completion_vtab {
1682
+ sqlite3_vtab base; /* Base class - must be first */
1683
+ sqlite3 *db; /* Database connection for this completion vtab */
1684
+};
1685
+
1686
+/* completion_cursor is a subclass of sqlite3_vtab_cursor which will
1687
+** serve as the underlying representation of a cursor that scans
1688
+** over rows of the result
1689
+*/
1690
+typedef struct completion_cursor completion_cursor;
1691
+struct completion_cursor {
1692
+ sqlite3_vtab_cursor base; /* Base class - must be first */
1693
+ sqlite3 *db; /* Database connection for this cursor */
1694
+ int nPrefix, nLine; /* Number of bytes in zPrefix and zLine */
1695
+ char *zPrefix; /* The prefix for the word we want to complete */
1696
+ char *zLine; /* The whole that we want to complete */
1697
+ const char *zCurrentRow; /* Current output row */
1698
+ sqlite3_stmt *pStmt; /* Current statement */
1699
+ sqlite3_int64 iRowid; /* The rowid */
1700
+ int ePhase; /* Current phase */
1701
+ int j; /* inter-phase counter */
1702
+};
1703
+
1704
+/* Values for ePhase:
1705
+*/
1706
+#define COMPLETION_FIRST_PHASE 1
1707
+#define COMPLETION_KEYWORDS 1
1708
+#define COMPLETION_PRAGMAS 2
1709
+#define COMPLETION_FUNCTIONS 3
1710
+#define COMPLETION_COLLATIONS 4
1711
+#define COMPLETION_INDEXES 5
1712
+#define COMPLETION_TRIGGERS 6
1713
+#define COMPLETION_DATABASES 7
1714
+#define COMPLETION_TABLES 8
1715
+#define COMPLETION_COLUMNS 9
1716
+#define COMPLETION_MODULES 10
1717
+#define COMPLETION_EOF 11
1718
+
1719
+/*
1720
+** The completionConnect() method is invoked to create a new
1721
+** completion_vtab that describes the completion virtual table.
1722
+**
1723
+** Think of this routine as the constructor for completion_vtab objects.
1724
+**
1725
+** All this routine needs to do is:
1726
+**
1727
+** (1) Allocate the completion_vtab object and initialize all fields.
1728
+**
1729
+** (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
1730
+** result set of queries against completion will look like.
1731
+*/
1732
+static int completionConnect(
1733
+ sqlite3 *db,
1734
+ void *pAux,
1735
+ int argc, const char *const*argv,
1736
+ sqlite3_vtab **ppVtab,
1737
+ char **pzErr
1738
+){
1739
+ completion_vtab *pNew;
1740
+ int rc;
1741
+
1742
+ (void)(pAux); /* Unused parameter */
1743
+ (void)(argc); /* Unused parameter */
1744
+ (void)(argv); /* Unused parameter */
1745
+ (void)(pzErr); /* Unused parameter */
1746
+
1747
+/* Column numbers */
1748
+#define COMPLETION_COLUMN_CANDIDATE 0 /* Suggested completion of the input */
1749
+#define COMPLETION_COLUMN_PREFIX 1 /* Prefix of the word to be completed */
1750
+#define COMPLETION_COLUMN_WHOLELINE 2 /* Entire line seen so far */
1751
+#define COMPLETION_COLUMN_PHASE 3 /* ePhase - used for debugging only */
1752
+
1753
+ rc = sqlite3_declare_vtab(db,
1754
+ "CREATE TABLE x("
1755
+ " candidate TEXT,"
1756
+ " prefix TEXT HIDDEN,"
1757
+ " wholeline TEXT HIDDEN,"
1758
+ " phase INT HIDDEN" /* Used for debugging only */
1759
+ ")");
1760
+ if( rc==SQLITE_OK ){
1761
+ pNew = sqlite3_malloc( sizeof(*pNew) );
1762
+ *ppVtab = (sqlite3_vtab*)pNew;
1763
+ if( pNew==0 ) return SQLITE_NOMEM;
1764
+ memset(pNew, 0, sizeof(*pNew));
1765
+ pNew->db = db;
1766
+ }
1767
+ return rc;
1768
+}
1769
+
1770
+/*
1771
+** This method is the destructor for completion_cursor objects.
1772
+*/
1773
+static int completionDisconnect(sqlite3_vtab *pVtab){
1774
+ sqlite3_free(pVtab);
1775
+ return SQLITE_OK;
1776
+}
1777
+
1778
+/*
1779
+** Constructor for a new completion_cursor object.
1780
+*/
1781
+static int completionOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){
1782
+ completion_cursor *pCur;
1783
+ pCur = sqlite3_malloc( sizeof(*pCur) );
1784
+ if( pCur==0 ) return SQLITE_NOMEM;
1785
+ memset(pCur, 0, sizeof(*pCur));
1786
+ pCur->db = ((completion_vtab*)p)->db;
1787
+ *ppCursor = &pCur->base;
1788
+ return SQLITE_OK;
1789
+}
1790
+
1791
+/*
1792
+** Reset the completion_cursor.
1793
+*/
1794
+static void completionCursorReset(completion_cursor *pCur){
1795
+ sqlite3_free(pCur->zPrefix); pCur->zPrefix = 0; pCur->nPrefix = 0;
1796
+ sqlite3_free(pCur->zLine); pCur->zLine = 0; pCur->nLine = 0;
1797
+ sqlite3_finalize(pCur->pStmt); pCur->pStmt = 0;
1798
+ pCur->j = 0;
1799
+}
1800
+
1801
+/*
1802
+** Destructor for a completion_cursor.
1803
+*/
1804
+static int completionClose(sqlite3_vtab_cursor *cur){
1805
+ completionCursorReset((completion_cursor*)cur);
1806
+ sqlite3_free(cur);
1807
+ return SQLITE_OK;
1808
+}
1809
+
1810
+/*
1811
+** All SQL keywords understood by SQLite
1812
+*/
1813
+static const char *completionKwrds[] = {
1814
+ "ABORT", "ACTION", "ADD", "AFTER", "ALL", "ALTER", "ANALYZE", "AND", "AS",
1815
+ "ASC", "ATTACH", "AUTOINCREMENT", "BEFORE", "BEGIN", "BETWEEN", "BY",
1816
+ "CASCADE", "CASE", "CAST", "CHECK", "COLLATE", "COLUMN", "COMMIT",
1817
+ "CONFLICT", "CONSTRAINT", "CREATE", "CROSS", "CURRENT_DATE",
1818
+ "CURRENT_TIME", "CURRENT_TIMESTAMP", "DATABASE", "DEFAULT", "DEFERRABLE",
1819
+ "DEFERRED", "DELETE", "DESC", "DETACH", "DISTINCT", "DROP", "EACH",
1820
+ "ELSE", "END", "ESCAPE", "EXCEPT", "EXCLUSIVE", "EXISTS", "EXPLAIN",
1821
+ "FAIL", "FOR", "FOREIGN", "FROM", "FULL", "GLOB", "GROUP", "HAVING", "IF",
1822
+ "IGNORE", "IMMEDIATE", "IN", "INDEX", "INDEXED", "INITIALLY", "INNER",
1823
+ "INSERT", "INSTEAD", "INTERSECT", "INTO", "IS", "ISNULL", "JOIN", "KEY",
1824
+ "LEFT", "LIKE", "LIMIT", "MATCH", "NATURAL", "NO", "NOT", "NOTNULL",
1825
+ "NULL", "OF", "OFFSET", "ON", "OR", "ORDER", "OUTER", "PLAN", "PRAGMA",
1826
+ "PRIMARY", "QUERY", "RAISE", "RECURSIVE", "REFERENCES", "REGEXP",
1827
+ "REINDEX", "RELEASE", "RENAME", "REPLACE", "RESTRICT", "RIGHT",
1828
+ "ROLLBACK", "ROW", "SAVEPOINT", "SELECT", "SET", "TABLE", "TEMP",
1829
+ "TEMPORARY", "THEN", "TO", "TRANSACTION", "TRIGGER", "UNION", "UNIQUE",
1830
+ "UPDATE", "USING", "VACUUM", "VALUES", "VIEW", "VIRTUAL", "WHEN", "WHERE",
1831
+ "WITH", "WITHOUT",
1832
+};
1833
+#define completionKwCount \
1834
+ (int)(sizeof(completionKwrds)/sizeof(completionKwrds[0]))
1835
+
1836
+/*
1837
+** Advance a completion_cursor to its next row of output.
1838
+**
1839
+** The ->ePhase, ->j, and ->pStmt fields of the completion_cursor object
1840
+** record the current state of the scan. This routine sets ->zCurrentRow
1841
+** to the current row of output and then returns. If no more rows remain,
1842
+** then ->ePhase is set to COMPLETION_EOF which will signal the virtual
1843
+** table that has reached the end of its scan.
1844
+**
1845
+** The current implementation just lists potential identifiers and
1846
+** keywords and filters them by zPrefix. Future enhancements should
1847
+** take zLine into account to try to restrict the set of identifiers and
1848
+** keywords based on what would be legal at the current point of input.
1849
+*/
1850
+static int completionNext(sqlite3_vtab_cursor *cur){
1851
+ completion_cursor *pCur = (completion_cursor*)cur;
1852
+ int eNextPhase = 0; /* Next phase to try if current phase reaches end */
1853
+ int iCol = -1; /* If >=0, step pCur->pStmt and use the i-th column */
1854
+ pCur->iRowid++;
1855
+ while( pCur->ePhase!=COMPLETION_EOF ){
1856
+ switch( pCur->ePhase ){
1857
+ case COMPLETION_KEYWORDS: {
1858
+ if( pCur->j >= completionKwCount ){
1859
+ pCur->zCurrentRow = 0;
1860
+ pCur->ePhase = COMPLETION_DATABASES;
1861
+ }else{
1862
+ pCur->zCurrentRow = completionKwrds[pCur->j++];
1863
+ }
1864
+ iCol = -1;
1865
+ break;
1866
+ }
1867
+ case COMPLETION_DATABASES: {
1868
+ if( pCur->pStmt==0 ){
1869
+ sqlite3_prepare_v2(pCur->db, "PRAGMA database_list", -1,
1870
+ &pCur->pStmt, 0);
1871
+ }
1872
+ iCol = 1;
1873
+ eNextPhase = COMPLETION_TABLES;
1874
+ break;
1875
+ }
1876
+ case COMPLETION_TABLES: {
1877
+ if( pCur->pStmt==0 ){
1878
+ sqlite3_stmt *pS2;
1879
+ char *zSql = 0;
1880
+ const char *zSep = "";
1881
+ sqlite3_prepare_v2(pCur->db, "PRAGMA database_list", -1, &pS2, 0);
1882
+ while( sqlite3_step(pS2)==SQLITE_ROW ){
1883
+ const char *zDb = (const char*)sqlite3_column_text(pS2, 1);
1884
+ zSql = sqlite3_mprintf(
1885
+ "%z%s"
1886
+ "SELECT name FROM \"%w\".sqlite_master"
1887
+ " WHERE type='table'",
1888
+ zSql, zSep, zDb
1889
+ );
1890
+ if( zSql==0 ) return SQLITE_NOMEM;
1891
+ zSep = " UNION ";
1892
+ }
1893
+ sqlite3_finalize(pS2);
1894
+ sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);
1895
+ sqlite3_free(zSql);
1896
+ }
1897
+ iCol = 0;
1898
+ eNextPhase = COMPLETION_COLUMNS;
1899
+ break;
1900
+ }
1901
+ case COMPLETION_COLUMNS: {
1902
+ if( pCur->pStmt==0 ){
1903
+ sqlite3_stmt *pS2;
1904
+ char *zSql = 0;
1905
+ const char *zSep = "";
1906
+ sqlite3_prepare_v2(pCur->db, "PRAGMA database_list", -1, &pS2, 0);
1907
+ while( sqlite3_step(pS2)==SQLITE_ROW ){
1908
+ const char *zDb = (const char*)sqlite3_column_text(pS2, 1);
1909
+ zSql = sqlite3_mprintf(
1910
+ "%z%s"
1911
+ "SELECT pti.name FROM \"%w\".sqlite_master AS sm"
1912
+ " JOIN pragma_table_info(sm.name,%Q) AS pti"
1913
+ " WHERE sm.type='table'",
1914
+ zSql, zSep, zDb, zDb
1915
+ );
1916
+ if( zSql==0 ) return SQLITE_NOMEM;
1917
+ zSep = " UNION ";
1918
+ }
1919
+ sqlite3_finalize(pS2);
1920
+ sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);
1921
+ sqlite3_free(zSql);
1922
+ }
1923
+ iCol = 0;
1924
+ eNextPhase = COMPLETION_EOF;
1925
+ break;
1926
+ }
1927
+ }
1928
+ if( iCol<0 ){
1929
+ /* This case is when the phase presets zCurrentRow */
1930
+ if( pCur->zCurrentRow==0 ) continue;
1931
+ }else{
1932
+ if( sqlite3_step(pCur->pStmt)==SQLITE_ROW ){
1933
+ /* Extract the next row of content */
1934
+ pCur->zCurrentRow = (const char*)sqlite3_column_text(pCur->pStmt, iCol);
1935
+ }else{
1936
+ /* When all rows are finished, advance to the next phase */
1937
+ sqlite3_finalize(pCur->pStmt);
1938
+ pCur->pStmt = 0;
1939
+ pCur->ePhase = eNextPhase;
1940
+ continue;
1941
+ }
1942
+ }
1943
+ if( pCur->nPrefix==0 ) break;
1944
+ if( sqlite3_strnicmp(pCur->zPrefix, pCur->zCurrentRow, pCur->nPrefix)==0 ){
1945
+ break;
1946
+ }
1947
+ }
1948
+
1949
+ return SQLITE_OK;
1950
+}
1951
+
1952
+/*
1953
+** Return values of columns for the row at which the completion_cursor
1954
+** is currently pointing.
1955
+*/
1956
+static int completionColumn(
1957
+ sqlite3_vtab_cursor *cur, /* The cursor */
1958
+ sqlite3_context *ctx, /* First argument to sqlite3_result_...() */
1959
+ int i /* Which column to return */
1960
+){
1961
+ completion_cursor *pCur = (completion_cursor*)cur;
1962
+ switch( i ){
1963
+ case COMPLETION_COLUMN_CANDIDATE: {
1964
+ sqlite3_result_text(ctx, pCur->zCurrentRow, -1, SQLITE_TRANSIENT);
1965
+ break;
1966
+ }
1967
+ case COMPLETION_COLUMN_PREFIX: {
1968
+ sqlite3_result_text(ctx, pCur->zPrefix, -1, SQLITE_TRANSIENT);
1969
+ break;
1970
+ }
1971
+ case COMPLETION_COLUMN_WHOLELINE: {
1972
+ sqlite3_result_text(ctx, pCur->zLine, -1, SQLITE_TRANSIENT);
1973
+ break;
1974
+ }
1975
+ case COMPLETION_COLUMN_PHASE: {
1976
+ sqlite3_result_int(ctx, pCur->ePhase);
1977
+ break;
1978
+ }
1979
+ }
1980
+ return SQLITE_OK;
1981
+}
1982
+
1983
+/*
1984
+** Return the rowid for the current row. In this implementation, the
1985
+** rowid is the same as the output value.
1986
+*/
1987
+static int completionRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
1988
+ completion_cursor *pCur = (completion_cursor*)cur;
1989
+ *pRowid = pCur->iRowid;
1990
+ return SQLITE_OK;
1991
+}
1992
+
1993
+/*
1994
+** Return TRUE if the cursor has been moved off of the last
1995
+** row of output.
1996
+*/
1997
+static int completionEof(sqlite3_vtab_cursor *cur){
1998
+ completion_cursor *pCur = (completion_cursor*)cur;
1999
+ return pCur->ePhase >= COMPLETION_EOF;
2000
+}
2001
+
2002
+/*
2003
+** This method is called to "rewind" the completion_cursor object back
2004
+** to the first row of output. This method is always called at least
2005
+** once prior to any call to completionColumn() or completionRowid() or
2006
+** completionEof().
2007
+*/
2008
+static int completionFilter(
2009
+ sqlite3_vtab_cursor *pVtabCursor,
2010
+ int idxNum, const char *idxStr,
2011
+ int argc, sqlite3_value **argv
2012
+){
2013
+ completion_cursor *pCur = (completion_cursor *)pVtabCursor;
2014
+ int iArg = 0;
2015
+ (void)(idxStr); /* Unused parameter */
2016
+ (void)(argc); /* Unused parameter */
2017
+ completionCursorReset(pCur);
2018
+ if( idxNum & 1 ){
2019
+ pCur->nPrefix = sqlite3_value_bytes(argv[iArg]);
2020
+ if( pCur->nPrefix>0 ){
2021
+ pCur->zPrefix = sqlite3_mprintf("%s", sqlite3_value_text(argv[iArg]));
2022
+ if( pCur->zPrefix==0 ) return SQLITE_NOMEM;
2023
+ }
2024
+ iArg++;
2025
+ }
2026
+ if( idxNum & 2 ){
2027
+ pCur->nLine = sqlite3_value_bytes(argv[iArg]);
2028
+ if( pCur->nLine>0 ){
2029
+ pCur->zLine = sqlite3_mprintf("%s", sqlite3_value_text(argv[iArg]));
2030
+ if( pCur->zLine==0 ) return SQLITE_NOMEM;
2031
+ }
2032
+ iArg++;
2033
+ }
2034
+ if( pCur->zLine!=0 && pCur->zPrefix==0 ){
2035
+ int i = pCur->nLine;
2036
+ while( i>0 && (isalnum(pCur->zLine[i-1]) || pCur->zLine[i-1]=='_') ){
2037
+ i--;
2038
+ }
2039
+ pCur->nPrefix = pCur->nLine - i;
2040
+ if( pCur->nPrefix>0 ){
2041
+ pCur->zPrefix = sqlite3_mprintf("%.*s", pCur->nPrefix, pCur->zLine + i);
2042
+ if( pCur->zPrefix==0 ) return SQLITE_NOMEM;
2043
+ }
2044
+ }
2045
+ pCur->iRowid = 0;
2046
+ pCur->ePhase = COMPLETION_FIRST_PHASE;
2047
+ return completionNext(pVtabCursor);
2048
+}
2049
+
2050
+/*
2051
+** SQLite will invoke this method one or more times while planning a query
2052
+** that uses the completion virtual table. This routine needs to create
2053
+** a query plan for each invocation and compute an estimated cost for that
2054
+** plan.
2055
+**
2056
+** There are two hidden parameters that act as arguments to the table-valued
2057
+** function: "prefix" and "wholeline". Bit 0 of idxNum is set if "prefix"
2058
+** is available and bit 1 is set if "wholeline" is available.
2059
+*/
2060
+static int completionBestIndex(
2061
+ sqlite3_vtab *tab,
2062
+ sqlite3_index_info *pIdxInfo
2063
+){
2064
+ int i; /* Loop over constraints */
2065
+ int idxNum = 0; /* The query plan bitmask */
2066
+ int prefixIdx = -1; /* Index of the start= constraint, or -1 if none */
2067
+ int wholelineIdx = -1; /* Index of the stop= constraint, or -1 if none */
2068
+ int nArg = 0; /* Number of arguments that completeFilter() expects */
2069
+ const struct sqlite3_index_constraint *pConstraint;
2070
+
2071
+ (void)(tab); /* Unused parameter */
2072
+ pConstraint = pIdxInfo->aConstraint;
2073
+ for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
2074
+ if( pConstraint->usable==0 ) continue;
2075
+ if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
2076
+ switch( pConstraint->iColumn ){
2077
+ case COMPLETION_COLUMN_PREFIX:
2078
+ prefixIdx = i;
2079
+ idxNum |= 1;
2080
+ break;
2081
+ case COMPLETION_COLUMN_WHOLELINE:
2082
+ wholelineIdx = i;
2083
+ idxNum |= 2;
2084
+ break;
2085
+ }
2086
+ }
2087
+ if( prefixIdx>=0 ){
2088
+ pIdxInfo->aConstraintUsage[prefixIdx].argvIndex = ++nArg;
2089
+ pIdxInfo->aConstraintUsage[prefixIdx].omit = 1;
2090
+ }
2091
+ if( wholelineIdx>=0 ){
2092
+ pIdxInfo->aConstraintUsage[wholelineIdx].argvIndex = ++nArg;
2093
+ pIdxInfo->aConstraintUsage[wholelineIdx].omit = 1;
2094
+ }
2095
+ pIdxInfo->idxNum = idxNum;
2096
+ pIdxInfo->estimatedCost = (double)5000 - 1000*nArg;
2097
+ pIdxInfo->estimatedRows = 500 - 100*nArg;
2098
+ return SQLITE_OK;
2099
+}
2100
+
2101
+/*
2102
+** This following structure defines all the methods for the
2103
+** completion virtual table.
2104
+*/
2105
+static sqlite3_module completionModule = {
2106
+ 0, /* iVersion */
2107
+ 0, /* xCreate */
2108
+ completionConnect, /* xConnect */
2109
+ completionBestIndex, /* xBestIndex */
2110
+ completionDisconnect, /* xDisconnect */
2111
+ 0, /* xDestroy */
2112
+ completionOpen, /* xOpen - open a cursor */
2113
+ completionClose, /* xClose - close a cursor */
2114
+ completionFilter, /* xFilter - configure scan constraints */
2115
+ completionNext, /* xNext - advance a cursor */
2116
+ completionEof, /* xEof - check for end of scan */
2117
+ completionColumn, /* xColumn - read data */
2118
+ completionRowid, /* xRowid - read data */
2119
+ 0, /* xUpdate */
2120
+ 0, /* xBegin */
2121
+ 0, /* xSync */
2122
+ 0, /* xCommit */
2123
+ 0, /* xRollback */
2124
+ 0, /* xFindMethod */
2125
+ 0, /* xRename */
2126
+ 0, /* xSavepoint */
2127
+ 0, /* xRelease */
2128
+ 0 /* xRollbackTo */
2129
+};
2130
+
2131
+#endif /* SQLITE_OMIT_VIRTUALTABLE */
2132
+
2133
+int sqlite3CompletionVtabInit(sqlite3 *db){
2134
+ int rc = SQLITE_OK;
2135
+#ifndef SQLITE_OMIT_VIRTUALTABLE
2136
+ rc = sqlite3_create_module(db, "completion", &completionModule, 0);
2137
+#endif
2138
+ return rc;
2139
+}
2140
+
2141
+#ifdef _WIN32
2142
+__declspec(dllexport)
2143
+#endif
2144
+int sqlite3_completion_init(
2145
+ sqlite3 *db,
2146
+ char **pzErrMsg,
2147
+ const sqlite3_api_routines *pApi
2148
+){
2149
+ int rc = SQLITE_OK;
2150
+ SQLITE_EXTENSION_INIT2(pApi);
2151
+ (void)(pzErrMsg); /* Unused parameter */
2152
+#ifndef SQLITE_OMIT_VIRTUALTABLE
2153
+ rc = sqlite3CompletionVtabInit(db);
2154
+#endif
2155
+ return rc;
2156
+}
2157
+
2158
+/************************* End ../ext/misc/completion.c ********************/
14462159
14472160
#if defined(SQLITE_ENABLE_SESSION)
14482161
/*
14492162
** State information for a single open session
14502163
*/
@@ -1521,12 +2234,13 @@
15212234
#define SHFLG_Scratch 0x00000001 /* The --scratch option is used */
15222235
#define SHFLG_Pagecache 0x00000002 /* The --pagecache option is used */
15232236
#define SHFLG_Lookaside 0x00000004 /* Lookaside memory is used */
15242237
#define SHFLG_Backslash 0x00000008 /* The --backslash option is used */
15252238
#define SHFLG_PreserveRowid 0x00000010 /* .dump preserves rowid values */
1526
-#define SHFLG_CountChanges 0x00000020 /* .changes setting */
1527
-#define SHFLG_Echo 0x00000040 /* .echo or --echo setting */
2239
+#define SHFLG_Newlines 0x00000020 /* .dump --newline flag */
2240
+#define SHFLG_CountChanges 0x00000040 /* .changes setting */
2241
+#define SHFLG_Echo 0x00000080 /* .echo or --echo setting */
15282242
15292243
/*
15302244
** Macros for testing and setting shellFlgs
15312245
*/
15322246
#define ShellHasFlag(P,X) (((P)->shellFlgs & (X))!=0)
@@ -2193,11 +2907,15 @@
21932907
for(i=0; i<nArg; i++){
21942908
raw_printf(p->out, i>0 ? "," : " VALUES(");
21952909
if( (azArg[i]==0) || (aiType && aiType[i]==SQLITE_NULL) ){
21962910
utf8_printf(p->out,"NULL");
21972911
}else if( aiType && aiType[i]==SQLITE_TEXT ){
2198
- output_quoted_escaped_string(p->out, azArg[i]);
2912
+ if( ShellHasFlag(p, SHFLG_Newlines) ){
2913
+ output_quoted_string(p->out, azArg[i]);
2914
+ }else{
2915
+ output_quoted_escaped_string(p->out, azArg[i]);
2916
+ }
21992917
}else if( aiType && aiType[i]==SQLITE_INTEGER ){
22002918
utf8_printf(p->out,"%s", azArg[i]);
22012919
}else if( aiType && aiType[i]==SQLITE_FLOAT ){
22022920
char z[50];
22032921
double r = sqlite3_column_double(p->pStmt, i);
@@ -2207,10 +2925,12 @@
22072925
const void *pBlob = sqlite3_column_blob(p->pStmt, i);
22082926
int nBlob = sqlite3_column_bytes(p->pStmt, i);
22092927
output_hex_blob(p->out, pBlob, nBlob);
22102928
}else if( isNumber(azArg[i], 0) ){
22112929
utf8_printf(p->out,"%s", azArg[i]);
2930
+ }else if( ShellHasFlag(p, SHFLG_Newlines) ){
2931
+ output_quoted_string(p->out, azArg[i]);
22122932
}else{
22132933
output_quoted_escaped_string(p->out, azArg[i]);
22142934
}
22152935
}
22162936
raw_printf(p->out,");\n");
@@ -3325,11 +4045,13 @@
33254045
" If TABLE specified, only dump tables matching\n"
33264046
" LIKE pattern TABLE.\n"
33274047
".echo on|off Turn command echo on or off\n"
33284048
".eqp on|off|full Enable or disable automatic EXPLAIN QUERY PLAN\n"
33294049
".exit Exit this program\n"
3330
- ".explain ?on|off|auto? Turn EXPLAIN output mode on or off or to automatic\n"
4050
+/* Because explain mode comes on automatically now, the ".explain" mode
4051
+** is removed from the help screen. It is still supported for legacy, however */
4052
+/*".explain ?on|off|auto? Turn EXPLAIN output mode on or off or to automatic\n"*/
33314053
".fullschema ?--indent? Show schema and the content of sqlite_stat tables\n"
33324054
".headers on|off Turn display of headers on or off\n"
33334055
".help Show this message\n"
33344056
".import FILE TABLE Import data from FILE into TABLE\n"
33354057
#ifndef SQLITE_OMIT_TEST_CONTROL
@@ -3460,62 +4182,10 @@
34604182
pBuf[nIn] = 0;
34614183
if( pnByte ) *pnByte = nIn;
34624184
return pBuf;
34634185
}
34644186
3465
-/*
3466
-** Implementation of the "readfile(X)" SQL function. The entire content
3467
-** of the file named X is read and returned as a BLOB. NULL is returned
3468
-** if the file does not exist or is unreadable.
3469
-*/
3470
-static void readfileFunc(
3471
- sqlite3_context *context,
3472
- int argc,
3473
- sqlite3_value **argv
3474
-){
3475
- const char *zName;
3476
- void *pBuf;
3477
- int nBuf;
3478
-
3479
- UNUSED_PARAMETER(argc);
3480
- zName = (const char*)sqlite3_value_text(argv[0]);
3481
- if( zName==0 ) return;
3482
- pBuf = readFile(zName, &nBuf);
3483
- if( pBuf ) sqlite3_result_blob(context, pBuf, nBuf, sqlite3_free);
3484
-}
3485
-
3486
-/*
3487
-** Implementation of the "writefile(X,Y)" SQL function. The argument Y
3488
-** is written into file X. The number of bytes written is returned. Or
3489
-** NULL is returned if something goes wrong, such as being unable to open
3490
-** file X for writing.
3491
-*/
3492
-static void writefileFunc(
3493
- sqlite3_context *context,
3494
- int argc,
3495
- sqlite3_value **argv
3496
-){
3497
- FILE *out;
3498
- const char *z;
3499
- sqlite3_int64 rc;
3500
- const char *zFile;
3501
-
3502
- UNUSED_PARAMETER(argc);
3503
- zFile = (const char*)sqlite3_value_text(argv[0]);
3504
- if( zFile==0 ) return;
3505
- out = fopen(zFile, "wb");
3506
- if( out==0 ) return;
3507
- z = (const char*)sqlite3_value_blob(argv[1]);
3508
- if( z==0 ){
3509
- rc = 0;
3510
- }else{
3511
- rc = fwrite(z, 1, sqlite3_value_bytes(argv[1]), out);
3512
- }
3513
- fclose(out);
3514
- sqlite3_result_int64(context, rc);
3515
-}
3516
-
35174187
#if defined(SQLITE_ENABLE_SESSION)
35184188
/*
35194189
** Close a single OpenSession object and release all of its associated
35204190
** resources.
35214191
*/
@@ -3577,22 +4247,76 @@
35774247
exit(1);
35784248
}
35794249
#ifndef SQLITE_OMIT_LOAD_EXTENSION
35804250
sqlite3_enable_load_extension(p->db, 1);
35814251
#endif
3582
- sqlite3_create_function(p->db, "readfile", 1, SQLITE_UTF8, 0,
3583
- readfileFunc, 0, 0);
3584
- sqlite3_create_function(p->db, "writefile", 2, SQLITE_UTF8, 0,
3585
- writefileFunc, 0, 0);
3586
- sqlite3_create_function(p->db, "sha3", 1, SQLITE_UTF8, 0,
3587
- sha3Func, 0, 0);
3588
- sqlite3_create_function(p->db, "sha3", 2, SQLITE_UTF8, 0,
3589
- sha3Func, 0, 0);
3590
- sqlite3_create_function(p->db, "sha3_query", 1, SQLITE_UTF8, 0,
3591
- sha3QueryFunc, 0, 0);
3592
- sqlite3_create_function(p->db, "sha3_query", 2, SQLITE_UTF8, 0,
3593
- sha3QueryFunc, 0, 0);
4252
+ sqlite3_fileio_init(p->db, 0, 0);
4253
+ sqlite3_shathree_init(p->db, 0, 0);
4254
+ sqlite3_completion_init(p->db, 0, 0);
35944255
sqlite3_create_function(p->db, "shell_add_schema", 2, SQLITE_UTF8, 0,
35954256
shellAddSchemaName, 0, 0);
3596
-
35974257
}
35984258
}
4259
+
4260
+#if HAVE_READLINE || HAVE_EDITLINE
4261
+/*
4262
+** Readline completion callbacks
4263
+*/
4264
+static char *readline_completion_generator(const char *text, int state){
4265
+ static sqlite3_stmt *pStmt = 0;
4266
+ char *zRet;
4267
+ if( state==0 ){
4268
+ char *zSql;
4269
+ int rc;
4270
+ sqlite3_finalize(pStmt);
4271
+ zSql = sqlite3_mprintf("SELECT DISTINCT candidate COLLATE nocase"
4272
+ " FROM completion(%Q) ORDER BY 1", text);
4273
+ sqlite3_prepare_v2(globalDb, zSql, -1, &pStmt, 0);
4274
+ sqlite3_free(zSql);
4275
+ }
4276
+ if( sqlite3_step(pStmt)==SQLITE_ROW ){
4277
+ zRet = strdup(sqlite3_column_text(pStmt, 0));
4278
+ }else{
4279
+ sqlite3_finalize(pStmt);
4280
+ pStmt = 0;
4281
+ zRet = 0;
4282
+ }
4283
+ return zRet;
4284
+}
4285
+static char **readline_completion(const char *zText, int iStart, int iEnd){
4286
+ rl_attempted_completion_over = 1;
4287
+ return rl_completion_matches(zText, readline_completion_generator);
4288
+}
4289
+
4290
+#elif HAVE_LINENOISE
4291
+/*
4292
+** Linenoise completion callback
4293
+*/
4294
+static void linenoise_completion(const char *zLine, linenoiseCompletions *lc){
4295
+ int nLine = (int)strlen(zLine);
4296
+ int i, iStart;
4297
+ sqlite3_stmt *pStmt = 0;
4298
+ char *zSql;
4299
+ char zBuf[1000];
4300
+
4301
+ if( nLine>sizeof(zBuf)-30 ) return;
4302
+ if( zLine[0]=='.' ) return;
4303
+ for(i=nLine-1; i>=0 && (isalnum(zLine[i]) || zLine[i]=='_'); i--){}
4304
+ if( i==nLine-1 ) return;
4305
+ iStart = i+1;
4306
+ memcpy(zBuf, zLine, iStart);
4307
+ zSql = sqlite3_mprintf("SELECT DISTINCT candidate COLLATE nocase"
4308
+ " FROM completion(%Q,%Q) ORDER BY 1",
4309
+ &zLine[iStart], zLine);
4310
+ sqlite3_prepare_v2(globalDb, zSql, -1, &pStmt, 0);
4311
+ sqlite3_free(zSql);
4312
+ sqlite3_exec(globalDb, "PRAGMA page_count", 0, 0, 0); /* Load the schema */
4313
+ while( sqlite3_step(pStmt)==SQLITE_ROW ){
4314
+ const char *zCompletion = (const char*)sqlite3_column_text(pStmt, 0);
4315
+ int nCompletion = sqlite3_column_bytes(pStmt, 0);
4316
+ if( iStart+nCompletion < sizeof(zBuf)-1 ){
4317
+ memcpy(zBuf+iStart, zCompletion, nCompletion+1);
4318
+ linenoiseAddCompletion(lc, zBuf);
4319
+ }
4320
+ }
4321
+ sqlite3_finalize(pStmt);
4322
+}
@@ -3599,5 +4323,6 @@
4323
+#endif
35994324
36004325
/*
36014326
** Do C-language style dequoting.
36024327
**
36034328
** \a -> alarm
@@ -4926,11 +5651,11 @@
49265651
49275652
if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){
49285653
const char *zLike = 0;
49295654
int i;
49305655
int savedShowHeader = p->showHeader;
4931
- ShellClearFlag(p, SHFLG_PreserveRowid);
5656
+ ShellClearFlag(p, SHFLG_PreserveRowid|SHFLG_Newlines);
49325657
for(i=1; i<nArg; i++){
49335658
if( azArg[i][0]=='-' ){
49345659
const char *z = azArg[i]+1;
49355660
if( z[0]=='-' ) z++;
49365661
if( strcmp(z,"preserve-rowids")==0 ){
@@ -4941,17 +5666,21 @@
49415666
goto meta_command_exit;
49425667
#else
49435668
ShellSetFlag(p, SHFLG_PreserveRowid);
49445669
#endif
49455670
}else
5671
+ if( strcmp(z,"newlines")==0 ){
5672
+ ShellSetFlag(p, SHFLG_Newlines);
5673
+ }else
49465674
{
49475675
raw_printf(stderr, "Unknown option \"%s\" on \".dump\"\n", azArg[i]);
49485676
rc = 1;
49495677
goto meta_command_exit;
49505678
}
49515679
}else if( zLike ){
4952
- raw_printf(stderr, "Usage: .dump ?--preserve-rowids? ?LIKE-PATTERN?\n");
5680
+ raw_printf(stderr, "Usage: .dump ?--preserve-rowids? "
5681
+ "?--newlines? ?LIKE-PATTERN?\n");
49535682
rc = 1;
49545683
goto meta_command_exit;
49555684
}else{
49565685
zLike = azArg[i];
49575686
}
@@ -5033,10 +5762,12 @@
50335762
if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){
50345763
if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc);
50355764
rc = 2;
50365765
}else
50375766
5767
+ /* The ".explain" command is automatic now. It is largely pointless. It
5768
+ ** retained purely for backwards compatibility */
50385769
if( c=='e' && strncmp(azArg[0], "explain", n)==0 ){
50395770
int val = 1;
50405771
if( nArg>=2 ){
50415772
if( strcmp(azArg[1],"auto")==0 ){
50425773
val = 99;
@@ -5549,11 +6280,13 @@
55496280
p->mode = MODE_Quote;
55506281
}else if( c2=='a' && strncmp(azArg[1],"ascii",n2)==0 ){
55516282
p->mode = MODE_Ascii;
55526283
sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Unit);
55536284
sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Record);
5554
- }else {
6285
+ }else if( nArg==1 ){
6286
+ raw_printf(p->out, "current output mode: %s\n", modeDescr[p->mode]);
6287
+ }else{
55556288
raw_printf(stderr, "Error: mode should be one of: "
55566289
"ascii column csv html insert line list quote tabs tcl\n");
55576290
rc = 1;
55586291
}
55596292
p->cMode = p->mode;
@@ -5821,12 +6554,18 @@
58216554
rc = 1;
58226555
goto meta_command_exit;
58236556
}
58246557
if( zDiv ){
58256558
sqlite3_stmt *pStmt = 0;
5826
- sqlite3_prepare_v2(p->db, "SELECT name FROM pragma_database_list",
5827
- -1, &pStmt, 0);
6559
+ rc = sqlite3_prepare_v2(p->db, "SELECT name FROM pragma_database_list",
6560
+ -1, &pStmt, 0);
6561
+ if( rc ){
6562
+ utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
6563
+ sqlite3_finalize(pStmt);
6564
+ rc = 1;
6565
+ goto meta_command_exit;
6566
+ }
58286567
appendText(&sSelect, "SELECT sql FROM", 0);
58296568
iSchema = 0;
58306569
while( sqlite3_step(pStmt)==SQLITE_ROW ){
58316570
const char *zDb = (const char*)sqlite3_column_text(pStmt, 0);
58326571
char zScNum[30];
@@ -7179,10 +7918,11 @@
71797918
" -multiplex enable the multiplexor VFS\n"
71807919
#endif
71817920
" -newline SEP set output row separator. Default: '\\n'\n"
71827921
" -nullvalue TEXT set text string for NULL values. Default ''\n"
71837922
" -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n"
7923
+ " -quote set output mode to 'quote'\n"
71847924
" -scratch SIZE N use N slots of SZ bytes each for scratch memory\n"
71857925
" -separator SEP set output column separator. Default: '|'\n"
71867926
" -stats print memory stats before each finalize\n"
71877927
" -version show SQLite version\n"
71887928
" -vfs NAME use NAME as the default VFS\n"
@@ -7474,10 +8214,12 @@
74748214
i++;
74758215
}else if( strcmp(z,"-html")==0 ){
74768216
data.mode = MODE_Html;
74778217
}else if( strcmp(z,"-list")==0 ){
74788218
data.mode = MODE_List;
8219
+ }else if( strcmp(z,"-quote")==0 ){
8220
+ data.mode = MODE_Quote;
74798221
}else if( strcmp(z,"-line")==0 ){
74808222
data.mode = MODE_Line;
74818223
}else if( strcmp(z,"-column")==0 ){
74828224
data.mode = MODE_Column;
74838225
}else if( strcmp(z,"-csv")==0 ){
@@ -7625,10 +8367,15 @@
76258367
if( (zHistory = malloc(nHistory))!=0 ){
76268368
sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
76278369
}
76288370
}
76298371
if( zHistory ){ shell_read_history(zHistory); }
8372
+#if HAVE_READLINE || HAVE_EDITLINE
8373
+ rl_attempted_completion_function = readline_completion;
8374
+#elif HAVE_LINENOISE
8375
+ linenoiseSetCompletionCallback(linenoise_completion);
8376
+#endif
76308377
rc = process_input(&data, 0);
76318378
if( zHistory ){
76328379
shell_stifle_history(100);
76338380
shell_write_history(zHistory);
76348381
free(zHistory);
@@ -7648,5 +8395,6 @@
76488395
for(i=0; i<argc; i++) sqlite3_free(argv[i]);
76498396
sqlite3_free(argv);
76508397
#endif
76518398
return rc;
76528399
}
8400
+
76538401
--- src/shell.c
+++ src/shell.c
@@ -1,5 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1 /*
2 ** 2001 September 15
3 **
4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing:
@@ -764,11 +782,11 @@
764 int i = 0;
765 const char *zIn = (const char*)sqlite3_value_text(apVal[0]);
766 const char *zSchema = (const char*)sqlite3_value_text(apVal[1]);
767 assert( nVal==2 );
768 if( zIn!=0 && strncmp(zIn, "CREATE ", 7)==0 ){
769 for(i=0; i<sizeof(aPrefix)/sizeof(aPrefix[0]); i++){
770 int n = strlen30(aPrefix[i]);
771 if( strncmp(zIn+7, aPrefix[i], n)==0 && zIn[n+7]==' ' ){
772 char cQuote = quoteChar(zSchema);
773 char *z;
774 if( cQuote ){
@@ -782,14 +800,57 @@
782 }
783 }
784 sqlite3_result_value(pCtx, apVal[0]);
785 }
786
787 /******************************************************************************
788 ** SHA3 hash implementation copied from ../ext/misc/shathree.c
 
 
 
789 */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
790 typedef sqlite3_uint64 u64;
 
 
 
 
791 /*
792 ** Macros to determine whether the machine is big or little endian,
793 ** and whether or not that determination is run-time or compile-time.
794 **
795 ** For best performance, an attempt is made to guess at the byte-order
@@ -823,14 +884,10 @@
823 unsigned nRate; /* Bytes of input accepted per Keccak iteration */
824 unsigned nLoaded; /* Input bytes loaded into u.x[] so far this cycle */
825 unsigned ixMask; /* Insert next input into u.x[nLoaded^ixMask]. */
826 };
827
828 /* Allow the following routine to use the B0 variable, which is also
829 ** a macro in the termios.h header file */
830 #undef B0
831
832 /*
833 ** A single step of the Keccak mixing function for a 1600-bit state
834 */
835 static void KeccakF1600Step(SHA3Context *p){
836 int i;
@@ -1237,16 +1294,18 @@
1237 for(i=0; i<p->nRate; i++){
1238 p->u.x[i+p->nRate] = p->u.x[i^p->ixMask];
1239 }
1240 return &p->u.x[p->nRate];
1241 }
 
 
1242
1243 /*
1244 ** Implementation of the sha3(X,SIZE) function.
1245 **
1246 ** Return a BLOB which is the SIZE-bit SHA3 hash of X. The default
1247 ** size is 256. If X is a BLOB, it is hashed as is.
1248 ** For all other non-NULL types of input, X is converted into a UTF-8 string
1249 ** and the string is hashed without the trailing 0x00 terminator. The hash
1250 ** of a NULL value is NULL.
1251 */
1252 static void sha3Func(
@@ -1373,14 +1432,10 @@
1373 sqlite3_free(zMsg);
1374 return;
1375 }
1376 nCol = sqlite3_column_count(pStmt);
1377 z = sqlite3_sql(pStmt);
1378 if( z==0 ){
1379 sqlite3_finalize(pStmt);
1380 continue;
1381 }
1382 n = (int)strlen(z);
1383 hash_step_vformat(&cx,"S%d:",n);
1384 SHA3Update(&cx,(unsigned char*)z,n);
1385
1386 /* Compute a hash over the result of the query */
@@ -1439,12 +1494,670 @@
1439 }
1440 sqlite3_finalize(pStmt);
1441 }
1442 sqlite3_result_blob(context, SHA3Final(&cx), iSize/8, SQLITE_TRANSIENT);
1443 }
1444 /* End of SHA3 hashing logic copy/pasted from ../ext/misc/shathree.c
1445 ********************************************************************************/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1446
1447 #if defined(SQLITE_ENABLE_SESSION)
1448 /*
1449 ** State information for a single open session
1450 */
@@ -1521,12 +2234,13 @@
1521 #define SHFLG_Scratch 0x00000001 /* The --scratch option is used */
1522 #define SHFLG_Pagecache 0x00000002 /* The --pagecache option is used */
1523 #define SHFLG_Lookaside 0x00000004 /* Lookaside memory is used */
1524 #define SHFLG_Backslash 0x00000008 /* The --backslash option is used */
1525 #define SHFLG_PreserveRowid 0x00000010 /* .dump preserves rowid values */
1526 #define SHFLG_CountChanges 0x00000020 /* .changes setting */
1527 #define SHFLG_Echo 0x00000040 /* .echo or --echo setting */
 
1528
1529 /*
1530 ** Macros for testing and setting shellFlgs
1531 */
1532 #define ShellHasFlag(P,X) (((P)->shellFlgs & (X))!=0)
@@ -2193,11 +2907,15 @@
2193 for(i=0; i<nArg; i++){
2194 raw_printf(p->out, i>0 ? "," : " VALUES(");
2195 if( (azArg[i]==0) || (aiType && aiType[i]==SQLITE_NULL) ){
2196 utf8_printf(p->out,"NULL");
2197 }else if( aiType && aiType[i]==SQLITE_TEXT ){
2198 output_quoted_escaped_string(p->out, azArg[i]);
 
 
 
 
2199 }else if( aiType && aiType[i]==SQLITE_INTEGER ){
2200 utf8_printf(p->out,"%s", azArg[i]);
2201 }else if( aiType && aiType[i]==SQLITE_FLOAT ){
2202 char z[50];
2203 double r = sqlite3_column_double(p->pStmt, i);
@@ -2207,10 +2925,12 @@
2207 const void *pBlob = sqlite3_column_blob(p->pStmt, i);
2208 int nBlob = sqlite3_column_bytes(p->pStmt, i);
2209 output_hex_blob(p->out, pBlob, nBlob);
2210 }else if( isNumber(azArg[i], 0) ){
2211 utf8_printf(p->out,"%s", azArg[i]);
 
 
2212 }else{
2213 output_quoted_escaped_string(p->out, azArg[i]);
2214 }
2215 }
2216 raw_printf(p->out,");\n");
@@ -3325,11 +4045,13 @@
3325 " If TABLE specified, only dump tables matching\n"
3326 " LIKE pattern TABLE.\n"
3327 ".echo on|off Turn command echo on or off\n"
3328 ".eqp on|off|full Enable or disable automatic EXPLAIN QUERY PLAN\n"
3329 ".exit Exit this program\n"
3330 ".explain ?on|off|auto? Turn EXPLAIN output mode on or off or to automatic\n"
 
 
3331 ".fullschema ?--indent? Show schema and the content of sqlite_stat tables\n"
3332 ".headers on|off Turn display of headers on or off\n"
3333 ".help Show this message\n"
3334 ".import FILE TABLE Import data from FILE into TABLE\n"
3335 #ifndef SQLITE_OMIT_TEST_CONTROL
@@ -3460,62 +4182,10 @@
3460 pBuf[nIn] = 0;
3461 if( pnByte ) *pnByte = nIn;
3462 return pBuf;
3463 }
3464
3465 /*
3466 ** Implementation of the "readfile(X)" SQL function. The entire content
3467 ** of the file named X is read and returned as a BLOB. NULL is returned
3468 ** if the file does not exist or is unreadable.
3469 */
3470 static void readfileFunc(
3471 sqlite3_context *context,
3472 int argc,
3473 sqlite3_value **argv
3474 ){
3475 const char *zName;
3476 void *pBuf;
3477 int nBuf;
3478
3479 UNUSED_PARAMETER(argc);
3480 zName = (const char*)sqlite3_value_text(argv[0]);
3481 if( zName==0 ) return;
3482 pBuf = readFile(zName, &nBuf);
3483 if( pBuf ) sqlite3_result_blob(context, pBuf, nBuf, sqlite3_free);
3484 }
3485
3486 /*
3487 ** Implementation of the "writefile(X,Y)" SQL function. The argument Y
3488 ** is written into file X. The number of bytes written is returned. Or
3489 ** NULL is returned if something goes wrong, such as being unable to open
3490 ** file X for writing.
3491 */
3492 static void writefileFunc(
3493 sqlite3_context *context,
3494 int argc,
3495 sqlite3_value **argv
3496 ){
3497 FILE *out;
3498 const char *z;
3499 sqlite3_int64 rc;
3500 const char *zFile;
3501
3502 UNUSED_PARAMETER(argc);
3503 zFile = (const char*)sqlite3_value_text(argv[0]);
3504 if( zFile==0 ) return;
3505 out = fopen(zFile, "wb");
3506 if( out==0 ) return;
3507 z = (const char*)sqlite3_value_blob(argv[1]);
3508 if( z==0 ){
3509 rc = 0;
3510 }else{
3511 rc = fwrite(z, 1, sqlite3_value_bytes(argv[1]), out);
3512 }
3513 fclose(out);
3514 sqlite3_result_int64(context, rc);
3515 }
3516
3517 #if defined(SQLITE_ENABLE_SESSION)
3518 /*
3519 ** Close a single OpenSession object and release all of its associated
3520 ** resources.
3521 */
@@ -3577,22 +4247,76 @@
3577 exit(1);
3578 }
3579 #ifndef SQLITE_OMIT_LOAD_EXTENSION
3580 sqlite3_enable_load_extension(p->db, 1);
3581 #endif
3582 sqlite3_create_function(p->db, "readfile", 1, SQLITE_UTF8, 0,
3583 readfileFunc, 0, 0);
3584 sqlite3_create_function(p->db, "writefile", 2, SQLITE_UTF8, 0,
3585 writefileFunc, 0, 0);
3586 sqlite3_create_function(p->db, "sha3", 1, SQLITE_UTF8, 0,
3587 sha3Func, 0, 0);
3588 sqlite3_create_function(p->db, "sha3", 2, SQLITE_UTF8, 0,
3589 sha3Func, 0, 0);
3590 sqlite3_create_function(p->db, "sha3_query", 1, SQLITE_UTF8, 0,
3591 sha3QueryFunc, 0, 0);
3592 sqlite3_create_function(p->db, "sha3_query", 2, SQLITE_UTF8, 0,
3593 sha3QueryFunc, 0, 0);
3594 sqlite3_create_function(p->db, "shell_add_schema", 2, SQLITE_UTF8, 0,
3595 shellAddSchemaName, 0, 0);
3596
3597 }
3598 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
@@ -3599,5 +4323,6 @@
 
3599
3600 /*
3601 ** Do C-language style dequoting.
3602 **
3603 ** \a -> alarm
@@ -4926,11 +5651,11 @@
4926
4927 if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){
4928 const char *zLike = 0;
4929 int i;
4930 int savedShowHeader = p->showHeader;
4931 ShellClearFlag(p, SHFLG_PreserveRowid);
4932 for(i=1; i<nArg; i++){
4933 if( azArg[i][0]=='-' ){
4934 const char *z = azArg[i]+1;
4935 if( z[0]=='-' ) z++;
4936 if( strcmp(z,"preserve-rowids")==0 ){
@@ -4941,17 +5666,21 @@
4941 goto meta_command_exit;
4942 #else
4943 ShellSetFlag(p, SHFLG_PreserveRowid);
4944 #endif
4945 }else
 
 
 
4946 {
4947 raw_printf(stderr, "Unknown option \"%s\" on \".dump\"\n", azArg[i]);
4948 rc = 1;
4949 goto meta_command_exit;
4950 }
4951 }else if( zLike ){
4952 raw_printf(stderr, "Usage: .dump ?--preserve-rowids? ?LIKE-PATTERN?\n");
 
4953 rc = 1;
4954 goto meta_command_exit;
4955 }else{
4956 zLike = azArg[i];
4957 }
@@ -5033,10 +5762,12 @@
5033 if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){
5034 if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc);
5035 rc = 2;
5036 }else
5037
 
 
5038 if( c=='e' && strncmp(azArg[0], "explain", n)==0 ){
5039 int val = 1;
5040 if( nArg>=2 ){
5041 if( strcmp(azArg[1],"auto")==0 ){
5042 val = 99;
@@ -5549,11 +6280,13 @@
5549 p->mode = MODE_Quote;
5550 }else if( c2=='a' && strncmp(azArg[1],"ascii",n2)==0 ){
5551 p->mode = MODE_Ascii;
5552 sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Unit);
5553 sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Record);
5554 }else {
 
 
5555 raw_printf(stderr, "Error: mode should be one of: "
5556 "ascii column csv html insert line list quote tabs tcl\n");
5557 rc = 1;
5558 }
5559 p->cMode = p->mode;
@@ -5821,12 +6554,18 @@
5821 rc = 1;
5822 goto meta_command_exit;
5823 }
5824 if( zDiv ){
5825 sqlite3_stmt *pStmt = 0;
5826 sqlite3_prepare_v2(p->db, "SELECT name FROM pragma_database_list",
5827 -1, &pStmt, 0);
 
 
 
 
 
 
5828 appendText(&sSelect, "SELECT sql FROM", 0);
5829 iSchema = 0;
5830 while( sqlite3_step(pStmt)==SQLITE_ROW ){
5831 const char *zDb = (const char*)sqlite3_column_text(pStmt, 0);
5832 char zScNum[30];
@@ -7179,10 +7918,11 @@
7179 " -multiplex enable the multiplexor VFS\n"
7180 #endif
7181 " -newline SEP set output row separator. Default: '\\n'\n"
7182 " -nullvalue TEXT set text string for NULL values. Default ''\n"
7183 " -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n"
 
7184 " -scratch SIZE N use N slots of SZ bytes each for scratch memory\n"
7185 " -separator SEP set output column separator. Default: '|'\n"
7186 " -stats print memory stats before each finalize\n"
7187 " -version show SQLite version\n"
7188 " -vfs NAME use NAME as the default VFS\n"
@@ -7474,10 +8214,12 @@
7474 i++;
7475 }else if( strcmp(z,"-html")==0 ){
7476 data.mode = MODE_Html;
7477 }else if( strcmp(z,"-list")==0 ){
7478 data.mode = MODE_List;
 
 
7479 }else if( strcmp(z,"-line")==0 ){
7480 data.mode = MODE_Line;
7481 }else if( strcmp(z,"-column")==0 ){
7482 data.mode = MODE_Column;
7483 }else if( strcmp(z,"-csv")==0 ){
@@ -7625,10 +8367,15 @@
7625 if( (zHistory = malloc(nHistory))!=0 ){
7626 sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
7627 }
7628 }
7629 if( zHistory ){ shell_read_history(zHistory); }
 
 
 
 
 
7630 rc = process_input(&data, 0);
7631 if( zHistory ){
7632 shell_stifle_history(100);
7633 shell_write_history(zHistory);
7634 free(zHistory);
@@ -7648,5 +8395,6 @@
7648 for(i=0; i<argc; i++) sqlite3_free(argv[i]);
7649 sqlite3_free(argv);
7650 #endif
7651 return rc;
7652 }
 
7653
--- src/shell.c
+++ src/shell.c
@@ -1,5 +1,23 @@
1 /* DO NOT EDIT!
2 ** This file is automatically generated by the script in the canonical
3 ** SQLite source tree at tool/mkshellc.tcl. That script combines source
4 ** code from various constituent source files of SQLite into this single
5 ** "shell.c" file used to implement the SQLite command-line shell.
6 **
7 ** Most of the code found below comes from the "src/shell.c.in" file in
8 ** the canonical SQLite source tree. That main file contains "INCLUDE"
9 ** lines that specify other files in the canonical source tree that are
10 ** inserted to getnerate this complete program source file.
11 **
12 ** The code from multiple files is combined into this single "shell.c"
13 ** source file to help make the command-line program easier to compile.
14 **
15 ** To modify this program, get a copy of the canonical SQLite source tree,
16 ** edit the src/shell.c.in" and/or some of the other files that are included
17 ** by "src/shell.c.in", then rerun the tool/mkshellc.tcl script.
18 */
19 /*
20 ** 2001 September 15
21 **
22 ** The author disclaims copyright to this source code. In place of
23 ** a legal notice, here is a blessing:
@@ -764,11 +782,11 @@
782 int i = 0;
783 const char *zIn = (const char*)sqlite3_value_text(apVal[0]);
784 const char *zSchema = (const char*)sqlite3_value_text(apVal[1]);
785 assert( nVal==2 );
786 if( zIn!=0 && strncmp(zIn, "CREATE ", 7)==0 ){
787 for(i=0; i<(int)(sizeof(aPrefix)/sizeof(aPrefix[0])); i++){
788 int n = strlen30(aPrefix[i]);
789 if( strncmp(zIn+7, aPrefix[i], n)==0 && zIn[n+7]==' ' ){
790 char cQuote = quoteChar(zSchema);
791 char *z;
792 if( cQuote ){
@@ -782,14 +800,57 @@
800 }
801 }
802 sqlite3_result_value(pCtx, apVal[0]);
803 }
804
805 /*
806 ** The source code for several run-time loadable extensions is inserted
807 ** below by the ../tool/mkshellc.tcl script. Before processing that included
808 ** code, we need to override some macros to make the included program code
809 ** work here in the middle of this regular program.
810 */
811 #define SQLITE_EXTENSION_INIT1
812 #define SQLITE_EXTENSION_INIT2(X) (void)(X)
813
814 /************************* Begin ../ext/misc/shathree.c ******************/
815 /*
816 ** 2017-03-08
817 **
818 ** The author disclaims copyright to this source code. In place of
819 ** a legal notice, here is a blessing:
820 **
821 ** May you do good and not evil.
822 ** May you find forgiveness for yourself and forgive others.
823 ** May you share freely, never taking more than you give.
824 **
825 ******************************************************************************
826 **
827 ** This SQLite extension implements a functions that compute SHA1 hashes.
828 ** Two SQL functions are implemented:
829 **
830 ** sha3(X,SIZE)
831 ** sha3_query(Y,SIZE)
832 **
833 ** The sha3(X) function computes the SHA3 hash of the input X, or NULL if
834 ** X is NULL.
835 **
836 ** The sha3_query(Y) function evalutes all queries in the SQL statements of Y
837 ** and returns a hash of their results.
838 **
839 ** The SIZE argument is optional. If omitted, the SHA3-256 hash algorithm
840 ** is used. If SIZE is included it must be one of the integers 224, 256,
841 ** 384, or 512, to determine SHA3 hash variant that is computed.
842 */
843 SQLITE_EXTENSION_INIT1
844 #include <assert.h>
845 #include <string.h>
846 #include <stdarg.h>
847 typedef sqlite3_uint64 u64;
848
849 /******************************************************************************
850 ** The Hash Engine
851 */
852 /*
853 ** Macros to determine whether the machine is big or little endian,
854 ** and whether or not that determination is run-time or compile-time.
855 **
856 ** For best performance, an attempt is made to guess at the byte-order
@@ -823,14 +884,10 @@
884 unsigned nRate; /* Bytes of input accepted per Keccak iteration */
885 unsigned nLoaded; /* Input bytes loaded into u.x[] so far this cycle */
886 unsigned ixMask; /* Insert next input into u.x[nLoaded^ixMask]. */
887 };
888
 
 
 
 
889 /*
890 ** A single step of the Keccak mixing function for a 1600-bit state
891 */
892 static void KeccakF1600Step(SHA3Context *p){
893 int i;
@@ -1237,16 +1294,18 @@
1294 for(i=0; i<p->nRate; i++){
1295 p->u.x[i+p->nRate] = p->u.x[i^p->ixMask];
1296 }
1297 return &p->u.x[p->nRate];
1298 }
1299 /* End of the hashing logic
1300 *****************************************************************************/
1301
1302 /*
1303 ** Implementation of the sha3(X,SIZE) function.
1304 **
1305 ** Return a BLOB which is the SIZE-bit SHA3 hash of X. The default
1306 ** size is 256. If X is a BLOB, it is hashed as is.
1307 ** For all other non-NULL types of input, X is converted into a UTF-8 string
1308 ** and the string is hashed without the trailing 0x00 terminator. The hash
1309 ** of a NULL value is NULL.
1310 */
1311 static void sha3Func(
@@ -1373,14 +1432,10 @@
1432 sqlite3_free(zMsg);
1433 return;
1434 }
1435 nCol = sqlite3_column_count(pStmt);
1436 z = sqlite3_sql(pStmt);
 
 
 
 
1437 n = (int)strlen(z);
1438 hash_step_vformat(&cx,"S%d:",n);
1439 SHA3Update(&cx,(unsigned char*)z,n);
1440
1441 /* Compute a hash over the result of the query */
@@ -1439,12 +1494,670 @@
1494 }
1495 sqlite3_finalize(pStmt);
1496 }
1497 sqlite3_result_blob(context, SHA3Final(&cx), iSize/8, SQLITE_TRANSIENT);
1498 }
1499
1500
1501 #ifdef _WIN32
1502 __declspec(dllexport)
1503 #endif
1504 int sqlite3_shathree_init(
1505 sqlite3 *db,
1506 char **pzErrMsg,
1507 const sqlite3_api_routines *pApi
1508 ){
1509 int rc = SQLITE_OK;
1510 SQLITE_EXTENSION_INIT2(pApi);
1511 (void)pzErrMsg; /* Unused parameter */
1512 rc = sqlite3_create_function(db, "sha3", 1, SQLITE_UTF8, 0,
1513 sha3Func, 0, 0);
1514 if( rc==SQLITE_OK ){
1515 rc = sqlite3_create_function(db, "sha3", 2, SQLITE_UTF8, 0,
1516 sha3Func, 0, 0);
1517 }
1518 if( rc==SQLITE_OK ){
1519 rc = sqlite3_create_function(db, "sha3_query", 1, SQLITE_UTF8, 0,
1520 sha3QueryFunc, 0, 0);
1521 }
1522 if( rc==SQLITE_OK ){
1523 rc = sqlite3_create_function(db, "sha3_query", 2, SQLITE_UTF8, 0,
1524 sha3QueryFunc, 0, 0);
1525 }
1526 return rc;
1527 }
1528
1529 /************************* End ../ext/misc/shathree.c ********************/
1530 /************************* Begin ../ext/misc/fileio.c ******************/
1531 /*
1532 ** 2014-06-13
1533 **
1534 ** The author disclaims copyright to this source code. In place of
1535 ** a legal notice, here is a blessing:
1536 **
1537 ** May you do good and not evil.
1538 ** May you find forgiveness for yourself and forgive others.
1539 ** May you share freely, never taking more than you give.
1540 **
1541 ******************************************************************************
1542 **
1543 ** This SQLite extension implements SQL functions readfile() and
1544 ** writefile().
1545 */
1546 SQLITE_EXTENSION_INIT1
1547 #include <stdio.h>
1548
1549 /*
1550 ** Implementation of the "readfile(X)" SQL function. The entire content
1551 ** of the file named X is read and returned as a BLOB. NULL is returned
1552 ** if the file does not exist or is unreadable.
1553 */
1554 static void readfileFunc(
1555 sqlite3_context *context,
1556 int argc,
1557 sqlite3_value **argv
1558 ){
1559 const char *zName;
1560 FILE *in;
1561 long nIn;
1562 void *pBuf;
1563
1564 (void)(argc); /* Unused parameter */
1565 zName = (const char*)sqlite3_value_text(argv[0]);
1566 if( zName==0 ) return;
1567 in = fopen(zName, "rb");
1568 if( in==0 ) return;
1569 fseek(in, 0, SEEK_END);
1570 nIn = ftell(in);
1571 rewind(in);
1572 pBuf = sqlite3_malloc( nIn );
1573 if( pBuf && 1==fread(pBuf, nIn, 1, in) ){
1574 sqlite3_result_blob(context, pBuf, nIn, sqlite3_free);
1575 }else{
1576 sqlite3_free(pBuf);
1577 }
1578 fclose(in);
1579 }
1580
1581 /*
1582 ** Implementation of the "writefile(X,Y)" SQL function. The argument Y
1583 ** is written into file X. The number of bytes written is returned. Or
1584 ** NULL is returned if something goes wrong, such as being unable to open
1585 ** file X for writing.
1586 */
1587 static void writefileFunc(
1588 sqlite3_context *context,
1589 int argc,
1590 sqlite3_value **argv
1591 ){
1592 FILE *out;
1593 const char *z;
1594 sqlite3_int64 rc;
1595 const char *zFile;
1596
1597 (void)(argc); /* Unused parameter */
1598 zFile = (const char*)sqlite3_value_text(argv[0]);
1599 if( zFile==0 ) return;
1600 out = fopen(zFile, "wb");
1601 if( out==0 ) return;
1602 z = (const char*)sqlite3_value_blob(argv[1]);
1603 if( z==0 ){
1604 rc = 0;
1605 }else{
1606 rc = fwrite(z, 1, sqlite3_value_bytes(argv[1]), out);
1607 }
1608 fclose(out);
1609 sqlite3_result_int64(context, rc);
1610 }
1611
1612
1613 #ifdef _WIN32
1614 __declspec(dllexport)
1615 #endif
1616 int sqlite3_fileio_init(
1617 sqlite3 *db,
1618 char **pzErrMsg,
1619 const sqlite3_api_routines *pApi
1620 ){
1621 int rc = SQLITE_OK;
1622 SQLITE_EXTENSION_INIT2(pApi);
1623 (void)pzErrMsg; /* Unused parameter */
1624 rc = sqlite3_create_function(db, "readfile", 1, SQLITE_UTF8, 0,
1625 readfileFunc, 0, 0);
1626 if( rc==SQLITE_OK ){
1627 rc = sqlite3_create_function(db, "writefile", 2, SQLITE_UTF8, 0,
1628 writefileFunc, 0, 0);
1629 }
1630 return rc;
1631 }
1632
1633 /************************* End ../ext/misc/fileio.c ********************/
1634 /************************* Begin ../ext/misc/completion.c ******************/
1635 /*
1636 ** 2017-07-10
1637 **
1638 ** The author disclaims copyright to this source code. In place of
1639 ** a legal notice, here is a blessing:
1640 **
1641 ** May you do good and not evil.
1642 ** May you find forgiveness for yourself and forgive others.
1643 ** May you share freely, never taking more than you give.
1644 **
1645 *************************************************************************
1646 **
1647 ** This file implements an eponymous virtual table that returns suggested
1648 ** completions for a partial SQL input.
1649 **
1650 ** Suggested usage:
1651 **
1652 ** SELECT DISTINCT candidate COLLATE nocase
1653 ** FROM completion($prefix,$wholeline)
1654 ** ORDER BY 1;
1655 **
1656 ** The two query parameters are optional. $prefix is the text of the
1657 ** current word being typed and that is to be completed. $wholeline is
1658 ** the complete input line, used for context.
1659 **
1660 ** The raw completion() table might return the same candidate multiple
1661 ** times, for example if the same column name is used to two or more
1662 ** tables. And the candidates are returned in an arbitrary order. Hence,
1663 ** the DISTINCT and ORDER BY are recommended.
1664 **
1665 ** This virtual table operates at the speed of human typing, and so there
1666 ** is no attempt to make it fast. Even a slow implementation will be much
1667 ** faster than any human can type.
1668 **
1669 */
1670 SQLITE_EXTENSION_INIT1
1671 #include <assert.h>
1672 #include <string.h>
1673 #include <ctype.h>
1674
1675 #ifndef SQLITE_OMIT_VIRTUALTABLE
1676
1677 /* completion_vtab is a subclass of sqlite3_vtab which will
1678 ** serve as the underlying representation of a completion virtual table
1679 */
1680 typedef struct completion_vtab completion_vtab;
1681 struct completion_vtab {
1682 sqlite3_vtab base; /* Base class - must be first */
1683 sqlite3 *db; /* Database connection for this completion vtab */
1684 };
1685
1686 /* completion_cursor is a subclass of sqlite3_vtab_cursor which will
1687 ** serve as the underlying representation of a cursor that scans
1688 ** over rows of the result
1689 */
1690 typedef struct completion_cursor completion_cursor;
1691 struct completion_cursor {
1692 sqlite3_vtab_cursor base; /* Base class - must be first */
1693 sqlite3 *db; /* Database connection for this cursor */
1694 int nPrefix, nLine; /* Number of bytes in zPrefix and zLine */
1695 char *zPrefix; /* The prefix for the word we want to complete */
1696 char *zLine; /* The whole that we want to complete */
1697 const char *zCurrentRow; /* Current output row */
1698 sqlite3_stmt *pStmt; /* Current statement */
1699 sqlite3_int64 iRowid; /* The rowid */
1700 int ePhase; /* Current phase */
1701 int j; /* inter-phase counter */
1702 };
1703
1704 /* Values for ePhase:
1705 */
1706 #define COMPLETION_FIRST_PHASE 1
1707 #define COMPLETION_KEYWORDS 1
1708 #define COMPLETION_PRAGMAS 2
1709 #define COMPLETION_FUNCTIONS 3
1710 #define COMPLETION_COLLATIONS 4
1711 #define COMPLETION_INDEXES 5
1712 #define COMPLETION_TRIGGERS 6
1713 #define COMPLETION_DATABASES 7
1714 #define COMPLETION_TABLES 8
1715 #define COMPLETION_COLUMNS 9
1716 #define COMPLETION_MODULES 10
1717 #define COMPLETION_EOF 11
1718
1719 /*
1720 ** The completionConnect() method is invoked to create a new
1721 ** completion_vtab that describes the completion virtual table.
1722 **
1723 ** Think of this routine as the constructor for completion_vtab objects.
1724 **
1725 ** All this routine needs to do is:
1726 **
1727 ** (1) Allocate the completion_vtab object and initialize all fields.
1728 **
1729 ** (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
1730 ** result set of queries against completion will look like.
1731 */
1732 static int completionConnect(
1733 sqlite3 *db,
1734 void *pAux,
1735 int argc, const char *const*argv,
1736 sqlite3_vtab **ppVtab,
1737 char **pzErr
1738 ){
1739 completion_vtab *pNew;
1740 int rc;
1741
1742 (void)(pAux); /* Unused parameter */
1743 (void)(argc); /* Unused parameter */
1744 (void)(argv); /* Unused parameter */
1745 (void)(pzErr); /* Unused parameter */
1746
1747 /* Column numbers */
1748 #define COMPLETION_COLUMN_CANDIDATE 0 /* Suggested completion of the input */
1749 #define COMPLETION_COLUMN_PREFIX 1 /* Prefix of the word to be completed */
1750 #define COMPLETION_COLUMN_WHOLELINE 2 /* Entire line seen so far */
1751 #define COMPLETION_COLUMN_PHASE 3 /* ePhase - used for debugging only */
1752
1753 rc = sqlite3_declare_vtab(db,
1754 "CREATE TABLE x("
1755 " candidate TEXT,"
1756 " prefix TEXT HIDDEN,"
1757 " wholeline TEXT HIDDEN,"
1758 " phase INT HIDDEN" /* Used for debugging only */
1759 ")");
1760 if( rc==SQLITE_OK ){
1761 pNew = sqlite3_malloc( sizeof(*pNew) );
1762 *ppVtab = (sqlite3_vtab*)pNew;
1763 if( pNew==0 ) return SQLITE_NOMEM;
1764 memset(pNew, 0, sizeof(*pNew));
1765 pNew->db = db;
1766 }
1767 return rc;
1768 }
1769
1770 /*
1771 ** This method is the destructor for completion_cursor objects.
1772 */
1773 static int completionDisconnect(sqlite3_vtab *pVtab){
1774 sqlite3_free(pVtab);
1775 return SQLITE_OK;
1776 }
1777
1778 /*
1779 ** Constructor for a new completion_cursor object.
1780 */
1781 static int completionOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){
1782 completion_cursor *pCur;
1783 pCur = sqlite3_malloc( sizeof(*pCur) );
1784 if( pCur==0 ) return SQLITE_NOMEM;
1785 memset(pCur, 0, sizeof(*pCur));
1786 pCur->db = ((completion_vtab*)p)->db;
1787 *ppCursor = &pCur->base;
1788 return SQLITE_OK;
1789 }
1790
1791 /*
1792 ** Reset the completion_cursor.
1793 */
1794 static void completionCursorReset(completion_cursor *pCur){
1795 sqlite3_free(pCur->zPrefix); pCur->zPrefix = 0; pCur->nPrefix = 0;
1796 sqlite3_free(pCur->zLine); pCur->zLine = 0; pCur->nLine = 0;
1797 sqlite3_finalize(pCur->pStmt); pCur->pStmt = 0;
1798 pCur->j = 0;
1799 }
1800
1801 /*
1802 ** Destructor for a completion_cursor.
1803 */
1804 static int completionClose(sqlite3_vtab_cursor *cur){
1805 completionCursorReset((completion_cursor*)cur);
1806 sqlite3_free(cur);
1807 return SQLITE_OK;
1808 }
1809
1810 /*
1811 ** All SQL keywords understood by SQLite
1812 */
1813 static const char *completionKwrds[] = {
1814 "ABORT", "ACTION", "ADD", "AFTER", "ALL", "ALTER", "ANALYZE", "AND", "AS",
1815 "ASC", "ATTACH", "AUTOINCREMENT", "BEFORE", "BEGIN", "BETWEEN", "BY",
1816 "CASCADE", "CASE", "CAST", "CHECK", "COLLATE", "COLUMN", "COMMIT",
1817 "CONFLICT", "CONSTRAINT", "CREATE", "CROSS", "CURRENT_DATE",
1818 "CURRENT_TIME", "CURRENT_TIMESTAMP", "DATABASE", "DEFAULT", "DEFERRABLE",
1819 "DEFERRED", "DELETE", "DESC", "DETACH", "DISTINCT", "DROP", "EACH",
1820 "ELSE", "END", "ESCAPE", "EXCEPT", "EXCLUSIVE", "EXISTS", "EXPLAIN",
1821 "FAIL", "FOR", "FOREIGN", "FROM", "FULL", "GLOB", "GROUP", "HAVING", "IF",
1822 "IGNORE", "IMMEDIATE", "IN", "INDEX", "INDEXED", "INITIALLY", "INNER",
1823 "INSERT", "INSTEAD", "INTERSECT", "INTO", "IS", "ISNULL", "JOIN", "KEY",
1824 "LEFT", "LIKE", "LIMIT", "MATCH", "NATURAL", "NO", "NOT", "NOTNULL",
1825 "NULL", "OF", "OFFSET", "ON", "OR", "ORDER", "OUTER", "PLAN", "PRAGMA",
1826 "PRIMARY", "QUERY", "RAISE", "RECURSIVE", "REFERENCES", "REGEXP",
1827 "REINDEX", "RELEASE", "RENAME", "REPLACE", "RESTRICT", "RIGHT",
1828 "ROLLBACK", "ROW", "SAVEPOINT", "SELECT", "SET", "TABLE", "TEMP",
1829 "TEMPORARY", "THEN", "TO", "TRANSACTION", "TRIGGER", "UNION", "UNIQUE",
1830 "UPDATE", "USING", "VACUUM", "VALUES", "VIEW", "VIRTUAL", "WHEN", "WHERE",
1831 "WITH", "WITHOUT",
1832 };
1833 #define completionKwCount \
1834 (int)(sizeof(completionKwrds)/sizeof(completionKwrds[0]))
1835
1836 /*
1837 ** Advance a completion_cursor to its next row of output.
1838 **
1839 ** The ->ePhase, ->j, and ->pStmt fields of the completion_cursor object
1840 ** record the current state of the scan. This routine sets ->zCurrentRow
1841 ** to the current row of output and then returns. If no more rows remain,
1842 ** then ->ePhase is set to COMPLETION_EOF which will signal the virtual
1843 ** table that has reached the end of its scan.
1844 **
1845 ** The current implementation just lists potential identifiers and
1846 ** keywords and filters them by zPrefix. Future enhancements should
1847 ** take zLine into account to try to restrict the set of identifiers and
1848 ** keywords based on what would be legal at the current point of input.
1849 */
1850 static int completionNext(sqlite3_vtab_cursor *cur){
1851 completion_cursor *pCur = (completion_cursor*)cur;
1852 int eNextPhase = 0; /* Next phase to try if current phase reaches end */
1853 int iCol = -1; /* If >=0, step pCur->pStmt and use the i-th column */
1854 pCur->iRowid++;
1855 while( pCur->ePhase!=COMPLETION_EOF ){
1856 switch( pCur->ePhase ){
1857 case COMPLETION_KEYWORDS: {
1858 if( pCur->j >= completionKwCount ){
1859 pCur->zCurrentRow = 0;
1860 pCur->ePhase = COMPLETION_DATABASES;
1861 }else{
1862 pCur->zCurrentRow = completionKwrds[pCur->j++];
1863 }
1864 iCol = -1;
1865 break;
1866 }
1867 case COMPLETION_DATABASES: {
1868 if( pCur->pStmt==0 ){
1869 sqlite3_prepare_v2(pCur->db, "PRAGMA database_list", -1,
1870 &pCur->pStmt, 0);
1871 }
1872 iCol = 1;
1873 eNextPhase = COMPLETION_TABLES;
1874 break;
1875 }
1876 case COMPLETION_TABLES: {
1877 if( pCur->pStmt==0 ){
1878 sqlite3_stmt *pS2;
1879 char *zSql = 0;
1880 const char *zSep = "";
1881 sqlite3_prepare_v2(pCur->db, "PRAGMA database_list", -1, &pS2, 0);
1882 while( sqlite3_step(pS2)==SQLITE_ROW ){
1883 const char *zDb = (const char*)sqlite3_column_text(pS2, 1);
1884 zSql = sqlite3_mprintf(
1885 "%z%s"
1886 "SELECT name FROM \"%w\".sqlite_master"
1887 " WHERE type='table'",
1888 zSql, zSep, zDb
1889 );
1890 if( zSql==0 ) return SQLITE_NOMEM;
1891 zSep = " UNION ";
1892 }
1893 sqlite3_finalize(pS2);
1894 sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);
1895 sqlite3_free(zSql);
1896 }
1897 iCol = 0;
1898 eNextPhase = COMPLETION_COLUMNS;
1899 break;
1900 }
1901 case COMPLETION_COLUMNS: {
1902 if( pCur->pStmt==0 ){
1903 sqlite3_stmt *pS2;
1904 char *zSql = 0;
1905 const char *zSep = "";
1906 sqlite3_prepare_v2(pCur->db, "PRAGMA database_list", -1, &pS2, 0);
1907 while( sqlite3_step(pS2)==SQLITE_ROW ){
1908 const char *zDb = (const char*)sqlite3_column_text(pS2, 1);
1909 zSql = sqlite3_mprintf(
1910 "%z%s"
1911 "SELECT pti.name FROM \"%w\".sqlite_master AS sm"
1912 " JOIN pragma_table_info(sm.name,%Q) AS pti"
1913 " WHERE sm.type='table'",
1914 zSql, zSep, zDb, zDb
1915 );
1916 if( zSql==0 ) return SQLITE_NOMEM;
1917 zSep = " UNION ";
1918 }
1919 sqlite3_finalize(pS2);
1920 sqlite3_prepare_v2(pCur->db, zSql, -1, &pCur->pStmt, 0);
1921 sqlite3_free(zSql);
1922 }
1923 iCol = 0;
1924 eNextPhase = COMPLETION_EOF;
1925 break;
1926 }
1927 }
1928 if( iCol<0 ){
1929 /* This case is when the phase presets zCurrentRow */
1930 if( pCur->zCurrentRow==0 ) continue;
1931 }else{
1932 if( sqlite3_step(pCur->pStmt)==SQLITE_ROW ){
1933 /* Extract the next row of content */
1934 pCur->zCurrentRow = (const char*)sqlite3_column_text(pCur->pStmt, iCol);
1935 }else{
1936 /* When all rows are finished, advance to the next phase */
1937 sqlite3_finalize(pCur->pStmt);
1938 pCur->pStmt = 0;
1939 pCur->ePhase = eNextPhase;
1940 continue;
1941 }
1942 }
1943 if( pCur->nPrefix==0 ) break;
1944 if( sqlite3_strnicmp(pCur->zPrefix, pCur->zCurrentRow, pCur->nPrefix)==0 ){
1945 break;
1946 }
1947 }
1948
1949 return SQLITE_OK;
1950 }
1951
1952 /*
1953 ** Return values of columns for the row at which the completion_cursor
1954 ** is currently pointing.
1955 */
1956 static int completionColumn(
1957 sqlite3_vtab_cursor *cur, /* The cursor */
1958 sqlite3_context *ctx, /* First argument to sqlite3_result_...() */
1959 int i /* Which column to return */
1960 ){
1961 completion_cursor *pCur = (completion_cursor*)cur;
1962 switch( i ){
1963 case COMPLETION_COLUMN_CANDIDATE: {
1964 sqlite3_result_text(ctx, pCur->zCurrentRow, -1, SQLITE_TRANSIENT);
1965 break;
1966 }
1967 case COMPLETION_COLUMN_PREFIX: {
1968 sqlite3_result_text(ctx, pCur->zPrefix, -1, SQLITE_TRANSIENT);
1969 break;
1970 }
1971 case COMPLETION_COLUMN_WHOLELINE: {
1972 sqlite3_result_text(ctx, pCur->zLine, -1, SQLITE_TRANSIENT);
1973 break;
1974 }
1975 case COMPLETION_COLUMN_PHASE: {
1976 sqlite3_result_int(ctx, pCur->ePhase);
1977 break;
1978 }
1979 }
1980 return SQLITE_OK;
1981 }
1982
1983 /*
1984 ** Return the rowid for the current row. In this implementation, the
1985 ** rowid is the same as the output value.
1986 */
1987 static int completionRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
1988 completion_cursor *pCur = (completion_cursor*)cur;
1989 *pRowid = pCur->iRowid;
1990 return SQLITE_OK;
1991 }
1992
1993 /*
1994 ** Return TRUE if the cursor has been moved off of the last
1995 ** row of output.
1996 */
1997 static int completionEof(sqlite3_vtab_cursor *cur){
1998 completion_cursor *pCur = (completion_cursor*)cur;
1999 return pCur->ePhase >= COMPLETION_EOF;
2000 }
2001
2002 /*
2003 ** This method is called to "rewind" the completion_cursor object back
2004 ** to the first row of output. This method is always called at least
2005 ** once prior to any call to completionColumn() or completionRowid() or
2006 ** completionEof().
2007 */
2008 static int completionFilter(
2009 sqlite3_vtab_cursor *pVtabCursor,
2010 int idxNum, const char *idxStr,
2011 int argc, sqlite3_value **argv
2012 ){
2013 completion_cursor *pCur = (completion_cursor *)pVtabCursor;
2014 int iArg = 0;
2015 (void)(idxStr); /* Unused parameter */
2016 (void)(argc); /* Unused parameter */
2017 completionCursorReset(pCur);
2018 if( idxNum & 1 ){
2019 pCur->nPrefix = sqlite3_value_bytes(argv[iArg]);
2020 if( pCur->nPrefix>0 ){
2021 pCur->zPrefix = sqlite3_mprintf("%s", sqlite3_value_text(argv[iArg]));
2022 if( pCur->zPrefix==0 ) return SQLITE_NOMEM;
2023 }
2024 iArg++;
2025 }
2026 if( idxNum & 2 ){
2027 pCur->nLine = sqlite3_value_bytes(argv[iArg]);
2028 if( pCur->nLine>0 ){
2029 pCur->zLine = sqlite3_mprintf("%s", sqlite3_value_text(argv[iArg]));
2030 if( pCur->zLine==0 ) return SQLITE_NOMEM;
2031 }
2032 iArg++;
2033 }
2034 if( pCur->zLine!=0 && pCur->zPrefix==0 ){
2035 int i = pCur->nLine;
2036 while( i>0 && (isalnum(pCur->zLine[i-1]) || pCur->zLine[i-1]=='_') ){
2037 i--;
2038 }
2039 pCur->nPrefix = pCur->nLine - i;
2040 if( pCur->nPrefix>0 ){
2041 pCur->zPrefix = sqlite3_mprintf("%.*s", pCur->nPrefix, pCur->zLine + i);
2042 if( pCur->zPrefix==0 ) return SQLITE_NOMEM;
2043 }
2044 }
2045 pCur->iRowid = 0;
2046 pCur->ePhase = COMPLETION_FIRST_PHASE;
2047 return completionNext(pVtabCursor);
2048 }
2049
2050 /*
2051 ** SQLite will invoke this method one or more times while planning a query
2052 ** that uses the completion virtual table. This routine needs to create
2053 ** a query plan for each invocation and compute an estimated cost for that
2054 ** plan.
2055 **
2056 ** There are two hidden parameters that act as arguments to the table-valued
2057 ** function: "prefix" and "wholeline". Bit 0 of idxNum is set if "prefix"
2058 ** is available and bit 1 is set if "wholeline" is available.
2059 */
2060 static int completionBestIndex(
2061 sqlite3_vtab *tab,
2062 sqlite3_index_info *pIdxInfo
2063 ){
2064 int i; /* Loop over constraints */
2065 int idxNum = 0; /* The query plan bitmask */
2066 int prefixIdx = -1; /* Index of the start= constraint, or -1 if none */
2067 int wholelineIdx = -1; /* Index of the stop= constraint, or -1 if none */
2068 int nArg = 0; /* Number of arguments that completeFilter() expects */
2069 const struct sqlite3_index_constraint *pConstraint;
2070
2071 (void)(tab); /* Unused parameter */
2072 pConstraint = pIdxInfo->aConstraint;
2073 for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){
2074 if( pConstraint->usable==0 ) continue;
2075 if( pConstraint->op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue;
2076 switch( pConstraint->iColumn ){
2077 case COMPLETION_COLUMN_PREFIX:
2078 prefixIdx = i;
2079 idxNum |= 1;
2080 break;
2081 case COMPLETION_COLUMN_WHOLELINE:
2082 wholelineIdx = i;
2083 idxNum |= 2;
2084 break;
2085 }
2086 }
2087 if( prefixIdx>=0 ){
2088 pIdxInfo->aConstraintUsage[prefixIdx].argvIndex = ++nArg;
2089 pIdxInfo->aConstraintUsage[prefixIdx].omit = 1;
2090 }
2091 if( wholelineIdx>=0 ){
2092 pIdxInfo->aConstraintUsage[wholelineIdx].argvIndex = ++nArg;
2093 pIdxInfo->aConstraintUsage[wholelineIdx].omit = 1;
2094 }
2095 pIdxInfo->idxNum = idxNum;
2096 pIdxInfo->estimatedCost = (double)5000 - 1000*nArg;
2097 pIdxInfo->estimatedRows = 500 - 100*nArg;
2098 return SQLITE_OK;
2099 }
2100
2101 /*
2102 ** This following structure defines all the methods for the
2103 ** completion virtual table.
2104 */
2105 static sqlite3_module completionModule = {
2106 0, /* iVersion */
2107 0, /* xCreate */
2108 completionConnect, /* xConnect */
2109 completionBestIndex, /* xBestIndex */
2110 completionDisconnect, /* xDisconnect */
2111 0, /* xDestroy */
2112 completionOpen, /* xOpen - open a cursor */
2113 completionClose, /* xClose - close a cursor */
2114 completionFilter, /* xFilter - configure scan constraints */
2115 completionNext, /* xNext - advance a cursor */
2116 completionEof, /* xEof - check for end of scan */
2117 completionColumn, /* xColumn - read data */
2118 completionRowid, /* xRowid - read data */
2119 0, /* xUpdate */
2120 0, /* xBegin */
2121 0, /* xSync */
2122 0, /* xCommit */
2123 0, /* xRollback */
2124 0, /* xFindMethod */
2125 0, /* xRename */
2126 0, /* xSavepoint */
2127 0, /* xRelease */
2128 0 /* xRollbackTo */
2129 };
2130
2131 #endif /* SQLITE_OMIT_VIRTUALTABLE */
2132
2133 int sqlite3CompletionVtabInit(sqlite3 *db){
2134 int rc = SQLITE_OK;
2135 #ifndef SQLITE_OMIT_VIRTUALTABLE
2136 rc = sqlite3_create_module(db, "completion", &completionModule, 0);
2137 #endif
2138 return rc;
2139 }
2140
2141 #ifdef _WIN32
2142 __declspec(dllexport)
2143 #endif
2144 int sqlite3_completion_init(
2145 sqlite3 *db,
2146 char **pzErrMsg,
2147 const sqlite3_api_routines *pApi
2148 ){
2149 int rc = SQLITE_OK;
2150 SQLITE_EXTENSION_INIT2(pApi);
2151 (void)(pzErrMsg); /* Unused parameter */
2152 #ifndef SQLITE_OMIT_VIRTUALTABLE
2153 rc = sqlite3CompletionVtabInit(db);
2154 #endif
2155 return rc;
2156 }
2157
2158 /************************* End ../ext/misc/completion.c ********************/
2159
2160 #if defined(SQLITE_ENABLE_SESSION)
2161 /*
2162 ** State information for a single open session
2163 */
@@ -1521,12 +2234,13 @@
2234 #define SHFLG_Scratch 0x00000001 /* The --scratch option is used */
2235 #define SHFLG_Pagecache 0x00000002 /* The --pagecache option is used */
2236 #define SHFLG_Lookaside 0x00000004 /* Lookaside memory is used */
2237 #define SHFLG_Backslash 0x00000008 /* The --backslash option is used */
2238 #define SHFLG_PreserveRowid 0x00000010 /* .dump preserves rowid values */
2239 #define SHFLG_Newlines 0x00000020 /* .dump --newline flag */
2240 #define SHFLG_CountChanges 0x00000040 /* .changes setting */
2241 #define SHFLG_Echo 0x00000080 /* .echo or --echo setting */
2242
2243 /*
2244 ** Macros for testing and setting shellFlgs
2245 */
2246 #define ShellHasFlag(P,X) (((P)->shellFlgs & (X))!=0)
@@ -2193,11 +2907,15 @@
2907 for(i=0; i<nArg; i++){
2908 raw_printf(p->out, i>0 ? "," : " VALUES(");
2909 if( (azArg[i]==0) || (aiType && aiType[i]==SQLITE_NULL) ){
2910 utf8_printf(p->out,"NULL");
2911 }else if( aiType && aiType[i]==SQLITE_TEXT ){
2912 if( ShellHasFlag(p, SHFLG_Newlines) ){
2913 output_quoted_string(p->out, azArg[i]);
2914 }else{
2915 output_quoted_escaped_string(p->out, azArg[i]);
2916 }
2917 }else if( aiType && aiType[i]==SQLITE_INTEGER ){
2918 utf8_printf(p->out,"%s", azArg[i]);
2919 }else if( aiType && aiType[i]==SQLITE_FLOAT ){
2920 char z[50];
2921 double r = sqlite3_column_double(p->pStmt, i);
@@ -2207,10 +2925,12 @@
2925 const void *pBlob = sqlite3_column_blob(p->pStmt, i);
2926 int nBlob = sqlite3_column_bytes(p->pStmt, i);
2927 output_hex_blob(p->out, pBlob, nBlob);
2928 }else if( isNumber(azArg[i], 0) ){
2929 utf8_printf(p->out,"%s", azArg[i]);
2930 }else if( ShellHasFlag(p, SHFLG_Newlines) ){
2931 output_quoted_string(p->out, azArg[i]);
2932 }else{
2933 output_quoted_escaped_string(p->out, azArg[i]);
2934 }
2935 }
2936 raw_printf(p->out,");\n");
@@ -3325,11 +4045,13 @@
4045 " If TABLE specified, only dump tables matching\n"
4046 " LIKE pattern TABLE.\n"
4047 ".echo on|off Turn command echo on or off\n"
4048 ".eqp on|off|full Enable or disable automatic EXPLAIN QUERY PLAN\n"
4049 ".exit Exit this program\n"
4050 /* Because explain mode comes on automatically now, the ".explain" mode
4051 ** is removed from the help screen. It is still supported for legacy, however */
4052 /*".explain ?on|off|auto? Turn EXPLAIN output mode on or off or to automatic\n"*/
4053 ".fullschema ?--indent? Show schema and the content of sqlite_stat tables\n"
4054 ".headers on|off Turn display of headers on or off\n"
4055 ".help Show this message\n"
4056 ".import FILE TABLE Import data from FILE into TABLE\n"
4057 #ifndef SQLITE_OMIT_TEST_CONTROL
@@ -3460,62 +4182,10 @@
4182 pBuf[nIn] = 0;
4183 if( pnByte ) *pnByte = nIn;
4184 return pBuf;
4185 }
4186
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4187 #if defined(SQLITE_ENABLE_SESSION)
4188 /*
4189 ** Close a single OpenSession object and release all of its associated
4190 ** resources.
4191 */
@@ -3577,22 +4247,76 @@
4247 exit(1);
4248 }
4249 #ifndef SQLITE_OMIT_LOAD_EXTENSION
4250 sqlite3_enable_load_extension(p->db, 1);
4251 #endif
4252 sqlite3_fileio_init(p->db, 0, 0);
4253 sqlite3_shathree_init(p->db, 0, 0);
4254 sqlite3_completion_init(p->db, 0, 0);
 
 
 
 
 
 
 
 
 
4255 sqlite3_create_function(p->db, "shell_add_schema", 2, SQLITE_UTF8, 0,
4256 shellAddSchemaName, 0, 0);
 
4257 }
4258 }
4259
4260 #if HAVE_READLINE || HAVE_EDITLINE
4261 /*
4262 ** Readline completion callbacks
4263 */
4264 static char *readline_completion_generator(const char *text, int state){
4265 static sqlite3_stmt *pStmt = 0;
4266 char *zRet;
4267 if( state==0 ){
4268 char *zSql;
4269 int rc;
4270 sqlite3_finalize(pStmt);
4271 zSql = sqlite3_mprintf("SELECT DISTINCT candidate COLLATE nocase"
4272 " FROM completion(%Q) ORDER BY 1", text);
4273 sqlite3_prepare_v2(globalDb, zSql, -1, &pStmt, 0);
4274 sqlite3_free(zSql);
4275 }
4276 if( sqlite3_step(pStmt)==SQLITE_ROW ){
4277 zRet = strdup(sqlite3_column_text(pStmt, 0));
4278 }else{
4279 sqlite3_finalize(pStmt);
4280 pStmt = 0;
4281 zRet = 0;
4282 }
4283 return zRet;
4284 }
4285 static char **readline_completion(const char *zText, int iStart, int iEnd){
4286 rl_attempted_completion_over = 1;
4287 return rl_completion_matches(zText, readline_completion_generator);
4288 }
4289
4290 #elif HAVE_LINENOISE
4291 /*
4292 ** Linenoise completion callback
4293 */
4294 static void linenoise_completion(const char *zLine, linenoiseCompletions *lc){
4295 int nLine = (int)strlen(zLine);
4296 int i, iStart;
4297 sqlite3_stmt *pStmt = 0;
4298 char *zSql;
4299 char zBuf[1000];
4300
4301 if( nLine>sizeof(zBuf)-30 ) return;
4302 if( zLine[0]=='.' ) return;
4303 for(i=nLine-1; i>=0 && (isalnum(zLine[i]) || zLine[i]=='_'); i--){}
4304 if( i==nLine-1 ) return;
4305 iStart = i+1;
4306 memcpy(zBuf, zLine, iStart);
4307 zSql = sqlite3_mprintf("SELECT DISTINCT candidate COLLATE nocase"
4308 " FROM completion(%Q,%Q) ORDER BY 1",
4309 &zLine[iStart], zLine);
4310 sqlite3_prepare_v2(globalDb, zSql, -1, &pStmt, 0);
4311 sqlite3_free(zSql);
4312 sqlite3_exec(globalDb, "PRAGMA page_count", 0, 0, 0); /* Load the schema */
4313 while( sqlite3_step(pStmt)==SQLITE_ROW ){
4314 const char *zCompletion = (const char*)sqlite3_column_text(pStmt, 0);
4315 int nCompletion = sqlite3_column_bytes(pStmt, 0);
4316 if( iStart+nCompletion < sizeof(zBuf)-1 ){
4317 memcpy(zBuf+iStart, zCompletion, nCompletion+1);
4318 linenoiseAddCompletion(lc, zBuf);
4319 }
4320 }
4321 sqlite3_finalize(pStmt);
4322 }
@@ -3599,5 +4323,6 @@
4323 #endif
4324
4325 /*
4326 ** Do C-language style dequoting.
4327 **
4328 ** \a -> alarm
@@ -4926,11 +5651,11 @@
5651
5652 if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){
5653 const char *zLike = 0;
5654 int i;
5655 int savedShowHeader = p->showHeader;
5656 ShellClearFlag(p, SHFLG_PreserveRowid|SHFLG_Newlines);
5657 for(i=1; i<nArg; i++){
5658 if( azArg[i][0]=='-' ){
5659 const char *z = azArg[i]+1;
5660 if( z[0]=='-' ) z++;
5661 if( strcmp(z,"preserve-rowids")==0 ){
@@ -4941,17 +5666,21 @@
5666 goto meta_command_exit;
5667 #else
5668 ShellSetFlag(p, SHFLG_PreserveRowid);
5669 #endif
5670 }else
5671 if( strcmp(z,"newlines")==0 ){
5672 ShellSetFlag(p, SHFLG_Newlines);
5673 }else
5674 {
5675 raw_printf(stderr, "Unknown option \"%s\" on \".dump\"\n", azArg[i]);
5676 rc = 1;
5677 goto meta_command_exit;
5678 }
5679 }else if( zLike ){
5680 raw_printf(stderr, "Usage: .dump ?--preserve-rowids? "
5681 "?--newlines? ?LIKE-PATTERN?\n");
5682 rc = 1;
5683 goto meta_command_exit;
5684 }else{
5685 zLike = azArg[i];
5686 }
@@ -5033,10 +5762,12 @@
5762 if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){
5763 if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc);
5764 rc = 2;
5765 }else
5766
5767 /* The ".explain" command is automatic now. It is largely pointless. It
5768 ** retained purely for backwards compatibility */
5769 if( c=='e' && strncmp(azArg[0], "explain", n)==0 ){
5770 int val = 1;
5771 if( nArg>=2 ){
5772 if( strcmp(azArg[1],"auto")==0 ){
5773 val = 99;
@@ -5549,11 +6280,13 @@
6280 p->mode = MODE_Quote;
6281 }else if( c2=='a' && strncmp(azArg[1],"ascii",n2)==0 ){
6282 p->mode = MODE_Ascii;
6283 sqlite3_snprintf(sizeof(p->colSeparator), p->colSeparator, SEP_Unit);
6284 sqlite3_snprintf(sizeof(p->rowSeparator), p->rowSeparator, SEP_Record);
6285 }else if( nArg==1 ){
6286 raw_printf(p->out, "current output mode: %s\n", modeDescr[p->mode]);
6287 }else{
6288 raw_printf(stderr, "Error: mode should be one of: "
6289 "ascii column csv html insert line list quote tabs tcl\n");
6290 rc = 1;
6291 }
6292 p->cMode = p->mode;
@@ -5821,12 +6554,18 @@
6554 rc = 1;
6555 goto meta_command_exit;
6556 }
6557 if( zDiv ){
6558 sqlite3_stmt *pStmt = 0;
6559 rc = sqlite3_prepare_v2(p->db, "SELECT name FROM pragma_database_list",
6560 -1, &pStmt, 0);
6561 if( rc ){
6562 utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
6563 sqlite3_finalize(pStmt);
6564 rc = 1;
6565 goto meta_command_exit;
6566 }
6567 appendText(&sSelect, "SELECT sql FROM", 0);
6568 iSchema = 0;
6569 while( sqlite3_step(pStmt)==SQLITE_ROW ){
6570 const char *zDb = (const char*)sqlite3_column_text(pStmt, 0);
6571 char zScNum[30];
@@ -7179,10 +7918,11 @@
7918 " -multiplex enable the multiplexor VFS\n"
7919 #endif
7920 " -newline SEP set output row separator. Default: '\\n'\n"
7921 " -nullvalue TEXT set text string for NULL values. Default ''\n"
7922 " -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n"
7923 " -quote set output mode to 'quote'\n"
7924 " -scratch SIZE N use N slots of SZ bytes each for scratch memory\n"
7925 " -separator SEP set output column separator. Default: '|'\n"
7926 " -stats print memory stats before each finalize\n"
7927 " -version show SQLite version\n"
7928 " -vfs NAME use NAME as the default VFS\n"
@@ -7474,10 +8214,12 @@
8214 i++;
8215 }else if( strcmp(z,"-html")==0 ){
8216 data.mode = MODE_Html;
8217 }else if( strcmp(z,"-list")==0 ){
8218 data.mode = MODE_List;
8219 }else if( strcmp(z,"-quote")==0 ){
8220 data.mode = MODE_Quote;
8221 }else if( strcmp(z,"-line")==0 ){
8222 data.mode = MODE_Line;
8223 }else if( strcmp(z,"-column")==0 ){
8224 data.mode = MODE_Column;
8225 }else if( strcmp(z,"-csv")==0 ){
@@ -7625,10 +8367,15 @@
8367 if( (zHistory = malloc(nHistory))!=0 ){
8368 sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
8369 }
8370 }
8371 if( zHistory ){ shell_read_history(zHistory); }
8372 #if HAVE_READLINE || HAVE_EDITLINE
8373 rl_attempted_completion_function = readline_completion;
8374 #elif HAVE_LINENOISE
8375 linenoiseSetCompletionCallback(linenoise_completion);
8376 #endif
8377 rc = process_input(&data, 0);
8378 if( zHistory ){
8379 shell_stifle_history(100);
8380 shell_write_history(zHistory);
8381 free(zHistory);
@@ -7648,5 +8395,6 @@
8395 for(i=0; i<argc; i++) sqlite3_free(argv[i]);
8396 sqlite3_free(argv);
8397 #endif
8398 return rc;
8399 }
8400
8401
+1692 -1328
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1150,11 +1150,11 @@
11501150
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
11511151
** [sqlite_version()] and [sqlite_source_id()].
11521152
*/
11531153
#define SQLITE_VERSION "3.20.0"
11541154
#define SQLITE_VERSION_NUMBER 3020000
1155
-#define SQLITE_SOURCE_ID "2017-06-29 17:27:04 284707a7b3514a55cce24292e45632b7033d6edcff5b27deac5118b27c7b2954"
1155
+#define SQLITE_SOURCE_ID "2017-07-12 18:05:54 604c11d1a39f09e47b6fcee0f8b1c1054f9dbbc7b2c1cf93312aeaa4b7095018"
11561156
11571157
/*
11581158
** CAPI3REF: Run-Time Library Version Numbers
11591159
** KEYWORDS: sqlite3_version sqlite3_sourceid
11601160
**
@@ -1444,11 +1444,11 @@
14441444
**
14451445
** See also: [extended result code definitions]
14461446
*/
14471447
#define SQLITE_OK 0 /* Successful result */
14481448
/* beginning-of-error-codes */
1449
-#define SQLITE_ERROR 1 /* SQL error or missing database */
1449
+#define SQLITE_ERROR 1 /* Generic error */
14501450
#define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */
14511451
#define SQLITE_PERM 3 /* Access permission denied */
14521452
#define SQLITE_ABORT 4 /* Callback routine requested an abort */
14531453
#define SQLITE_BUSY 5 /* The database file is locked */
14541454
#define SQLITE_LOCKED 6 /* A table in the database is locked */
@@ -1459,19 +1459,19 @@
14591459
#define SQLITE_CORRUPT 11 /* The database disk image is malformed */
14601460
#define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */
14611461
#define SQLITE_FULL 13 /* Insertion failed because database is full */
14621462
#define SQLITE_CANTOPEN 14 /* Unable to open the database file */
14631463
#define SQLITE_PROTOCOL 15 /* Database lock protocol error */
1464
-#define SQLITE_EMPTY 16 /* Database is empty */
1464
+#define SQLITE_EMPTY 16 /* Not used */
14651465
#define SQLITE_SCHEMA 17 /* The database schema changed */
14661466
#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
14671467
#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
14681468
#define SQLITE_MISMATCH 20 /* Data type mismatch */
14691469
#define SQLITE_MISUSE 21 /* Library used incorrectly */
14701470
#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
14711471
#define SQLITE_AUTH 23 /* Authorization denied */
1472
-#define SQLITE_FORMAT 24 /* Auxiliary database format error */
1472
+#define SQLITE_FORMAT 24 /* Not used */
14731473
#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */
14741474
#define SQLITE_NOTADB 26 /* File opened that is not a database file */
14751475
#define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */
14761476
#define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */
14771477
#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */
@@ -5294,10 +5294,32 @@
52945294
52955295
/*
52965296
** CAPI3REF: Result Values From A Query
52975297
** KEYWORDS: {column access functions}
52985298
** METHOD: sqlite3_stmt
5299
+**
5300
+** <b>Summary:</b>
5301
+** <blockquote><table border=0 cellpadding=0 cellspacing=0>
5302
+** <tr><td><b>sqlite3_column_blob</b><td>&rarr;<td>BLOB result
5303
+** <tr><td><b>sqlite3_column_double</b><td>&rarr;<td>REAL result
5304
+** <tr><td><b>sqlite3_column_int</b><td>&rarr;<td>32-bit INTEGER result
5305
+** <tr><td><b>sqlite3_column_int64</b><td>&rarr;<td>64-bit INTEGER result
5306
+** <tr><td><b>sqlite3_column_text</b><td>&rarr;<td>UTF-8 TEXT result
5307
+** <tr><td><b>sqlite3_column_text16</b><td>&rarr;<td>UTF-16 TEXT result
5308
+** <tr><td><b>sqlite3_column_value</b><td>&rarr;<td>The result as an
5309
+** [sqlite3_value|unprotected sqlite3_value] object.
5310
+** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
5311
+** <tr><td><b>sqlite3_column_bytes</b><td>&rarr;<td>Size of a BLOB
5312
+** or a UTF-8 TEXT result in bytes
5313
+** <tr><td><b>sqlite3_column_bytes16&nbsp;&nbsp;</b>
5314
+** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
5315
+** TEXT in bytes
5316
+** <tr><td><b>sqlite3_column_type</b><td>&rarr;<td>Default
5317
+** datatype of the result
5318
+** </table></blockquote>
5319
+**
5320
+** <b>Details:</b>
52995321
**
53005322
** ^These routines return information about a single column of the current
53015323
** result row of a query. ^In every case the first argument is a pointer
53025324
** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
53035325
** that was returned from [sqlite3_prepare_v3()] or one of its variants)
@@ -5316,19 +5338,32 @@
53165338
** something other than [SQLITE_ROW], the results are undefined.
53175339
** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()]
53185340
** are called from a different thread while any of these routines
53195341
** are pending, then the results are undefined.
53205342
**
5343
+** The first six interfaces (_blob, _double, _int, _int64, _text, and _text16)
5344
+** each return the value of a result column in a specific data format. If
5345
+** the result column is not initially in the requested format (for example,
5346
+** if the query returns an integer but the sqlite3_column_text() interface
5347
+** is used to extract the value) then an automatic type conversion is performed.
5348
+**
53215349
** ^The sqlite3_column_type() routine returns the
53225350
** [SQLITE_INTEGER | datatype code] for the initial data type
53235351
** of the result column. ^The returned value is one of [SQLITE_INTEGER],
5324
-** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. The value
5325
-** returned by sqlite3_column_type() is only meaningful if no type
5326
-** conversions have occurred as described below. After a type conversion,
5327
-** the value returned by sqlite3_column_type() is undefined. Future
5352
+** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].
5353
+** The return value of sqlite3_column_type() can be used to decide which
5354
+** of the first six interface should be used to extract the column value.
5355
+** The value returned by sqlite3_column_type() is only meaningful if no
5356
+** automatic type conversions have occurred for the value in question.
5357
+** After a type conversion, the result of calling sqlite3_column_type()
5358
+** is undefined, though harmless. Future
53285359
** versions of SQLite may change the behavior of sqlite3_column_type()
53295360
** following a type conversion.
5361
+**
5362
+** If the result is a BLOB or a TEXT string, then the sqlite3_column_bytes()
5363
+** or sqlite3_column_bytes16() interfaces can be used to determine the size
5364
+** of that BLOB or string.
53305365
**
53315366
** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
53325367
** routine returns the number of bytes in that BLOB or string.
53335368
** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts
53345369
** the string to UTF-8 and then returns the number of bytes.
@@ -5362,13 +5397,17 @@
53625397
** [sqlite3_bind_value()] and [sqlite3_result_value()].
53635398
** If the [unprotected sqlite3_value] object returned by
53645399
** [sqlite3_column_value()] is used in any other way, including calls
53655400
** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
53665401
** or [sqlite3_value_bytes()], the behavior is not threadsafe.
5402
+** Hence, the sqlite3_column_value() interface
5403
+** is normally only useful within the implementation of
5404
+** [application-defined SQL functions] or [virtual tables], not within
5405
+** top-level application code.
53675406
**
5368
-** These routines attempt to convert the value where appropriate. ^For
5369
-** example, if the internal representation is FLOAT and a text result
5407
+** The these routines may attempt to convert the datatype of the result.
5408
+** ^For example, if the internal representation is FLOAT and a text result
53705409
** is requested, [sqlite3_snprintf()] is used internally to perform the
53715410
** conversion automatically. ^(The following table details the conversions
53725411
** that are applied:
53735412
**
53745413
** <blockquote>
@@ -5436,11 +5475,11 @@
54365475
** with calls to sqlite3_column_bytes().
54375476
**
54385477
** ^The pointers returned are valid until a type conversion occurs as
54395478
** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
54405479
** [sqlite3_finalize()] is called. ^The memory space used to hold strings
5441
-** and BLOBs is freed automatically. Do <em>not</em> pass the pointers returned
5480
+** and BLOBs is freed automatically. Do not pass the pointers returned
54425481
** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
54435482
** [sqlite3_free()].
54445483
**
54455484
** ^(If a memory allocation error occurs during the evaluation of any
54465485
** of these routines, a default value is returned. The default value
@@ -5447,19 +5486,19 @@
54475486
** is either the integer 0, the floating point number 0.0, or a NULL
54485487
** pointer. Subsequent calls to [sqlite3_errcode()] will return
54495488
** [SQLITE_NOMEM].)^
54505489
*/
54515490
SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
5452
-SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
5453
-SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
54545491
SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
54555492
SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
54565493
SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
54575494
SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
54585495
SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
5459
-SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
54605496
SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
5497
+SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
5498
+SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
5499
+SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
54615500
54625501
/*
54635502
** CAPI3REF: Destroy A Prepared Statement Object
54645503
** DESTRUCTOR: sqlite3_stmt
54655504
**
@@ -5689,25 +5728,43 @@
56895728
56905729
/*
56915730
** CAPI3REF: Obtaining SQL Values
56925731
** METHOD: sqlite3_value
56935732
**
5694
-** The C-language implementation of SQL functions and aggregates uses
5695
-** this set of interface routines to access the parameter values on
5696
-** the function or aggregate.
5733
+** <b>Summary:</b>
5734
+** <blockquote><table border=0 cellpadding=0 cellspacing=0>
5735
+** <tr><td><b>sqlite3_value_blob</b><td>&rarr;<td>BLOB value
5736
+** <tr><td><b>sqlite3_value_double</b><td>&rarr;<td>REAL value
5737
+** <tr><td><b>sqlite3_value_int</b><td>&rarr;<td>32-bit INTEGER value
5738
+** <tr><td><b>sqlite3_value_int64</b><td>&rarr;<td>64-bit INTEGER value
5739
+** <tr><td><b>sqlite3_value_text</b><td>&rarr;<td>UTF-8 TEXT value
5740
+** <tr><td><b>sqlite3_value_text16</b><td>&rarr;<td>UTF-16 TEXT value in
5741
+** the native byteorder
5742
+** <tr><td><b>sqlite3_value_text16be</b><td>&rarr;<td>UTF-16be TEXT value
5743
+** <tr><td><b>sqlite3_value_text16le</b><td>&rarr;<td>UTF-16le TEXT value
5744
+** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
5745
+** <tr><td><b>sqlite3_value_bytes</b><td>&rarr;<td>Size of a BLOB
5746
+** or a UTF-8 TEXT in bytes
5747
+** <tr><td><b>sqlite3_value_bytes16&nbsp;&nbsp;</b>
5748
+** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
5749
+** TEXT in bytes
5750
+** <tr><td><b>sqlite3_value_type</b><td>&rarr;<td>Default
5751
+** datatype of the value
5752
+** <tr><td><b>sqlite3_value_numeric_type&nbsp;&nbsp;</b>
5753
+** <td>&rarr;&nbsp;&nbsp;<td>Best numeric datatype of the value
5754
+** </table></blockquote>
56975755
**
5698
-** The xFunc (for scalar functions) or xStep (for aggregates) parameters
5699
-** to [sqlite3_create_function()] and [sqlite3_create_function16()]
5700
-** define callbacks that implement the SQL functions and aggregates.
5701
-** The 3rd parameter to these callbacks is an array of pointers to
5702
-** [protected sqlite3_value] objects. There is one [sqlite3_value] object for
5703
-** each parameter to the SQL function. These routines are used to
5704
-** extract values from the [sqlite3_value] objects.
5756
+** <b>Details:</b>
5757
+**
5758
+** This routine extract type, size, and content information from
5759
+** [protected sqlite3_value] objects. Protected sqlite3_value objects
5760
+** are used to pass parameter information into implementation of
5761
+** [application-defined SQL functions] and [virtual tables].
57055762
**
57065763
** These routines work only with [protected sqlite3_value] objects.
57075764
** Any attempt to use these routines on an [unprotected sqlite3_value]
5708
-** object results in undefined behavior.
5765
+** is not threadsafe.
57095766
**
57105767
** ^These routines work just like the corresponding [column access functions]
57115768
** except that these routines take a single [protected sqlite3_value] object
57125769
** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
57135770
**
@@ -5714,10 +5771,21 @@
57145771
** ^The sqlite3_value_text16() interface extracts a UTF-16 string
57155772
** in the native byte-order of the host machine. ^The
57165773
** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
57175774
** extract UTF-16 strings as big-endian and little-endian respectively.
57185775
**
5776
+** ^(The sqlite3_value_type(V) interface returns the
5777
+** [SQLITE_INTEGER | datatype code] for the initial datatype of the
5778
+** [sqlite3_value] object V. The returned value is one of [SQLITE_INTEGER],
5779
+** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].)^
5780
+** Other interfaces might change the datatype for an sqlite3_value object.
5781
+** For example, if the datatype is initially SQLITE_INTEGER and
5782
+** sqlite3_value_text(V) is called to extract a text value for that
5783
+** integer, then subsequent calls to sqlite3_value_type(V) might return
5784
+** SQLITE_TEXT. Whether or not a persistent internal datatype conversion
5785
+** occurs is undefined and may change from one release of SQLite to the next.
5786
+**
57195787
** ^(The sqlite3_value_numeric_type() interface attempts to apply
57205788
** numeric affinity to the value. This means that an attempt is
57215789
** made to convert the value to an integer or floating point. If
57225790
** such a conversion is possible without loss of information (in other
57235791
** words, if the value is a string that looks like a number)
@@ -5732,19 +5800,19 @@
57325800
**
57335801
** These routines must be called from the same thread as
57345802
** the SQL function that supplied the [sqlite3_value*] parameters.
57355803
*/
57365804
SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
5737
-SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
5738
-SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
57395805
SQLITE_API double sqlite3_value_double(sqlite3_value*);
57405806
SQLITE_API int sqlite3_value_int(sqlite3_value*);
57415807
SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
57425808
SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
57435809
SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
57445810
SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
57455811
SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
5812
+SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
5813
+SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
57465814
SQLITE_API int sqlite3_value_type(sqlite3_value*);
57475815
SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
57485816
57495817
/*
57505818
** CAPI3REF: Finding The Subtype Of SQL Values
@@ -15143,10 +15211,11 @@
1514315211
#define SQLITE_OrderByIdxJoin 0x0080 /* ORDER BY of joins via index */
1514415212
#define SQLITE_SubqCoroutine 0x0100 /* Evaluate subqueries as coroutines */
1514515213
#define SQLITE_Transitive 0x0200 /* Transitive constraints */
1514615214
#define SQLITE_OmitNoopJoin 0x0400 /* Omit unused tables in joins */
1514715215
#define SQLITE_Stat34 0x0800 /* Use STAT3 or STAT4 data */
15216
+#define SQLITE_CountOfView 0x1000 /* The count-of-view optimization */
1514815217
#define SQLITE_CursorHints 0x2000 /* Add OP_CursorHint opcodes */
1514915218
#define SQLITE_AllOpts 0xffff /* All optimizations */
1515015219
1515115220
/*
1515215221
** Macros for testing whether or not optimizations are enabled or disabled.
@@ -16005,11 +16074,11 @@
1600516074
/*
1600616075
** The following are the meanings of bits in the Expr.flags field.
1600716076
*/
1600816077
#define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */
1600916078
#define EP_Agg 0x000002 /* Contains one or more aggregate functions */
16010
-#define EP_Resolved 0x000004 /* IDs have been resolved to COLUMNs */
16079
+ /* 0x000004 // available for use */
1601116080
/* 0x000008 // available for use */
1601216081
#define EP_Distinct 0x000010 /* Aggregate function with DISTINCT keyword */
1601316082
#define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */
1601416083
#define EP_DblQuoted 0x000040 /* token.z was originally in "..." */
1601516084
#define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */
@@ -17437,12 +17506,11 @@
1743717506
#endif
1743817507
SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3*,int);
1743917508
SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse*, int);
1744017509
SQLITE_PRIVATE void sqlite3CodeVerifyNamedSchema(Parse*, const char *zDb);
1744117510
SQLITE_PRIVATE void sqlite3BeginTransaction(Parse*, int);
17442
-SQLITE_PRIVATE void sqlite3CommitTransaction(Parse*);
17443
-SQLITE_PRIVATE void sqlite3RollbackTransaction(Parse*);
17511
+SQLITE_PRIVATE void sqlite3EndTransaction(Parse*,int);
1744417512
SQLITE_PRIVATE void sqlite3Savepoint(Parse*, int, Token*);
1744517513
SQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *);
1744617514
SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3*);
1744717515
SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*);
1744817516
SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*);
@@ -17559,11 +17627,13 @@
1755917627
SQLITE_PRIVATE int sqlite3FixExprList(DbFixer*, ExprList*);
1756017628
SQLITE_PRIVATE int sqlite3FixTriggerStep(DbFixer*, TriggerStep*);
1756117629
SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8);
1756217630
SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*);
1756317631
SQLITE_PRIVATE int sqlite3Atoi(const char*);
17632
+#ifndef SQLITE_OMIT_UTF16
1756417633
SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar);
17634
+#endif
1756517635
SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);
1756617636
SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**);
1756717637
SQLITE_PRIVATE LogEst sqlite3LogEst(u64);
1756817638
SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst,LogEst);
1756917639
#ifndef SQLITE_OMIT_VIRTUALTABLE
@@ -17648,11 +17718,13 @@
1764817718
SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
1764917719
void(*)(void*));
1765017720
SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value*);
1765117721
SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*);
1765217722
SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *);
17723
+#ifndef SQLITE_OMIT_UTF16
1765317724
SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8);
17725
+#endif
1765417726
SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
1765517727
SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
1765617728
#ifndef SQLITE_AMALGAMATION
1765717729
SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[];
1765817730
SQLITE_PRIVATE const char sqlite3StrBINARY[];
@@ -18012,11 +18084,13 @@
1801218084
SQLITE_PRIVATE int sqlite3ExprIsVector(Expr *pExpr);
1801318085
SQLITE_PRIVATE Expr *sqlite3VectorFieldSubexpr(Expr*, int);
1801418086
SQLITE_PRIVATE Expr *sqlite3ExprForVectorField(Parse*,Expr*,int);
1801518087
SQLITE_PRIVATE void sqlite3VectorErrorMsg(Parse*, Expr*);
1801618088
18089
+#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
1801718090
SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt);
18091
+#endif
1801818092
1801918093
#endif /* SQLITEINT_H */
1802018094
1802118095
/************** End of sqliteInt.h *******************************************/
1802218096
/************** Begin file global.c ******************************************/
@@ -18873,16 +18947,18 @@
1887318947
SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *, int);
1887418948
#else
1887518949
# define sqlite3VdbeCheckFk(p,i) 0
1887618950
#endif
1887718951
18878
-SQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem*, u8);
1887918952
#ifdef SQLITE_DEBUG
1888018953
SQLITE_PRIVATE void sqlite3VdbePrintSql(Vdbe*);
1888118954
SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf);
1888218955
#endif
18883
-SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem);
18956
+#ifndef SQLITE_OMIT_UTF16
18957
+SQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem*, u8);
18958
+SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem);
18959
+#endif
1888418960
1888518961
#ifndef SQLITE_OMIT_INCRBLOB
1888618962
SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *);
1888718963
#define ExpandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0)
1888818964
#else
@@ -26962,21 +27038,21 @@
2696227038
}
2696327039
break;
2696427040
}
2696527041
#ifndef SQLITE_OMIT_SUBQUERY
2696627042
case TK_EXISTS: {
26967
- sqlite3TreeViewLine(pView, "EXISTS-expr");
27043
+ sqlite3TreeViewLine(pView, "EXISTS-expr flags=0x%x", pExpr->flags);
2696827044
sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
2696927045
break;
2697027046
}
2697127047
case TK_SELECT: {
26972
- sqlite3TreeViewLine(pView, "SELECT-expr");
27048
+ sqlite3TreeViewLine(pView, "SELECT-expr flags=0x%x", pExpr->flags);
2697327049
sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
2697427050
break;
2697527051
}
2697627052
case TK_IN: {
26977
- sqlite3TreeViewLine(pView, "IN");
27053
+ sqlite3TreeViewLine(pView, "IN flags=0x%x", pExpr->flags);
2697827054
sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
2697927055
if( ExprHasProperty(pExpr, EP_xIsSelect) ){
2698027056
sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
2698127057
}else{
2698227058
sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0);
@@ -27860,11 +27936,13 @@
2786027936
fprintf(stderr, "OUTPUT: %s\n", zBuf);
2786127937
}
2786227938
#endif
2786327939
return SQLITE_OK;
2786427940
}
27941
+#endif /* SQLITE_OMIT_UTF16 */
2786527942
27943
+#ifndef SQLITE_OMIT_UTF16
2786627944
/*
2786727945
** This routine checks for a byte-order mark at the beginning of the
2786827946
** UTF-16 string stored in *pMem. If one is present, it is removed and
2786927947
** the encoding of the Mem adjusted. This routine does not do any
2787027948
** byte-swapping, it just sets Mem.enc appropriately.
@@ -29771,21 +29849,23 @@
2977129849
}
2977229850
return 1;
2977329851
}
2977429852
2977529853
/* This function (for internal use only) locates an element in an
29776
-** hash table that matches the given key. The hash for this key is
29777
-** also computed and returned in the *pH parameter.
29854
+** hash table that matches the given key. If no element is found,
29855
+** a pointer to a static null element with HashElem.data==0 is returned.
29856
+** If pH is not NULL, then the hash for this key is written to *pH.
2977829857
*/
2977929858
static HashElem *findElementWithHash(
2978029859
const Hash *pH, /* The pH to be searched */
2978129860
const char *pKey, /* The key we are searching for */
2978229861
unsigned int *pHash /* Write the hash value here */
2978329862
){
2978429863
HashElem *elem; /* Used to loop thru the element list */
2978529864
int count; /* Number of elements left to test */
2978629865
unsigned int h; /* The computed hash */
29866
+ static HashElem nullElement = { 0, 0, 0, 0 };
2978729867
2978829868
if( pH->ht ){ /*OPTIMIZATION-IF-TRUE*/
2978929869
struct _ht *pEntry;
2979029870
h = strHash(pKey) % pH->htsize;
2979129871
pEntry = &pH->ht[h];
@@ -29794,19 +29874,19 @@
2979429874
}else{
2979529875
h = 0;
2979629876
elem = pH->first;
2979729877
count = pH->count;
2979829878
}
29799
- *pHash = h;
29879
+ if( pHash ) *pHash = h;
2980029880
while( count-- ){
2980129881
assert( elem!=0 );
2980229882
if( sqlite3StrICmp(elem->pKey,pKey)==0 ){
2980329883
return elem;
2980429884
}
2980529885
elem = elem->next;
2980629886
}
29807
- return 0;
29887
+ return &nullElement;
2980829888
}
2980929889
2981029890
/* Remove a single entry from the hash table given a pointer to that
2981129891
** element and a hash on the element's key.
2981229892
*/
@@ -29844,17 +29924,13 @@
2984429924
/* Attempt to locate an element of the hash table pH with a key
2984529925
** that matches pKey. Return the data for this element if it is
2984629926
** found, or NULL if there is no match.
2984729927
*/
2984829928
SQLITE_PRIVATE void *sqlite3HashFind(const Hash *pH, const char *pKey){
29849
- HashElem *elem; /* The element that matches key */
29850
- unsigned int h; /* A hash on key */
29851
-
2985229929
assert( pH!=0 );
2985329930
assert( pKey!=0 );
29854
- elem = findElementWithHash(pH, pKey, &h);
29855
- return elem ? elem->data : 0;
29931
+ return findElementWithHash(pH, pKey, 0)->data;
2985629932
}
2985729933
2985829934
/* Insert an element into the hash table pH. The key is pKey
2985929935
** and the data is "data".
2986029936
**
@@ -29875,11 +29951,11 @@
2987529951
HashElem *new_elem; /* New element added to the pH */
2987629952
2987729953
assert( pH!=0 );
2987829954
assert( pKey!=0 );
2987929955
elem = findElementWithHash(pH,pKey,&h);
29880
- if( elem ){
29956
+ if( elem->data ){
2988129957
void *old_data = elem->data;
2988229958
if( data==0 ){
2988329959
removeElementGivenHash(pH,elem,h);
2988429960
}else{
2988529961
elem->data = data;
@@ -58883,14 +58959,16 @@
5888358959
** Allowed values for BtShared.btsFlags
5888458960
*/
5888558961
#define BTS_READ_ONLY 0x0001 /* Underlying file is readonly */
5888658962
#define BTS_PAGESIZE_FIXED 0x0002 /* Page size can no longer be changed */
5888758963
#define BTS_SECURE_DELETE 0x0004 /* PRAGMA secure_delete is enabled */
58888
-#define BTS_INITIALLY_EMPTY 0x0008 /* Database was empty at trans start */
58889
-#define BTS_NO_WAL 0x0010 /* Do not open write-ahead-log files */
58890
-#define BTS_EXCLUSIVE 0x0020 /* pWriter has an exclusive lock */
58891
-#define BTS_PENDING 0x0040 /* Waiting for read-locks to clear */
58964
+#define BTS_OVERWRITE 0x0008 /* Overwrite deleted content with zeros */
58965
+#define BTS_FAST_SECURE 0x000c /* Combination of the previous two */
58966
+#define BTS_INITIALLY_EMPTY 0x0010 /* Database was empty at trans start */
58967
+#define BTS_NO_WAL 0x0020 /* Do not open write-ahead-log files */
58968
+#define BTS_EXCLUSIVE 0x0040 /* pWriter has an exclusive lock */
58969
+#define BTS_PENDING 0x0080 /* Waiting for read-locks to clear */
5889258970
5889358971
/*
5889458972
** An instance of the following structure is used to hold information
5889558973
** about a cell. The parseCellPtr() function fills in this structure
5889658974
** based on information extract from the raw disk page.
@@ -61072,11 +61150,11 @@
6107261150
assert( iSize>=4 ); /* Minimum cell size is 4 */
6107361151
assert( iStart<=iLast );
6107461152
6107561153
/* Overwrite deleted information with zeros when the secure_delete
6107661154
** option is enabled */
61077
- if( pPage->pBt->btsFlags & BTS_SECURE_DELETE ){
61155
+ if( pPage->pBt->btsFlags & BTS_FAST_SECURE ){
6107861156
memset(&data[iStart], 0, iSize);
6107961157
}
6108061158
6108161159
/* The list of freeblocks must be in ascending order. Find the
6108261160
** spot on the list where iStart should be inserted.
@@ -61363,11 +61441,11 @@
6136361441
assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno );
6136461442
assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage );
6136561443
assert( sqlite3PagerGetData(pPage->pDbPage) == data );
6136661444
assert( sqlite3PagerIswriteable(pPage->pDbPage) );
6136761445
assert( sqlite3_mutex_held(pBt->mutex) );
61368
- if( pBt->btsFlags & BTS_SECURE_DELETE ){
61446
+ if( pBt->btsFlags & BTS_FAST_SECURE ){
6136961447
memset(&data[hdr], 0, pBt->usableSize - hdr);
6137061448
}
6137161449
data[hdr] = (char)flags;
6137261450
first = hdr + ((flags&PTF_LEAF)==0 ? 12 : 8);
6137361451
memset(&data[hdr+1], 0, 4);
@@ -61786,12 +61864,14 @@
6178661864
p->pBt = pBt;
6178761865
6178861866
pBt->pCursor = 0;
6178961867
pBt->pPage1 = 0;
6179061868
if( sqlite3PagerIsreadonly(pBt->pPager) ) pBt->btsFlags |= BTS_READ_ONLY;
61791
-#ifdef SQLITE_SECURE_DELETE
61869
+#if defined(SQLITE_SECURE_DELETE)
6179261870
pBt->btsFlags |= BTS_SECURE_DELETE;
61871
+#elif defined(SQLITE_FAST_SECURE_DELETE)
61872
+ pBt->btsFlags |= BTS_OVERWRITE;
6179361873
#endif
6179461874
/* EVIDENCE-OF: R-51873-39618 The page size for a database file is
6179561875
** determined by the 2-byte integer located at an offset of 16 bytes from
6179661876
** the beginning of the database file. */
6179761877
pBt->pageSize = (zDbHeader[16]<<8) | (zDbHeader[17]<<16);
@@ -62235,23 +62315,38 @@
6223562315
sqlite3BtreeLeave(p);
6223662316
return n;
6223762317
}
6223862318
6223962319
/*
62240
-** Set the BTS_SECURE_DELETE flag if newFlag is 0 or 1. If newFlag is -1,
62241
-** then make no changes. Always return the value of the BTS_SECURE_DELETE
62242
-** setting after the change.
62320
+** Change the values for the BTS_SECURE_DELETE and BTS_OVERWRITE flags:
62321
+**
62322
+** newFlag==0 Both BTS_SECURE_DELETE and BTS_OVERWRITE are cleared
62323
+** newFlag==1 BTS_SECURE_DELETE set and BTS_OVERWRITE is cleared
62324
+** newFlag==2 BTS_SECURE_DELETE cleared and BTS_OVERWRITE is set
62325
+** newFlag==(-1) No changes
62326
+**
62327
+** This routine acts as a query if newFlag is less than zero
62328
+**
62329
+** With BTS_OVERWRITE set, deleted content is overwritten by zeros, but
62330
+** freelist leaf pages are not written back to the database. Thus in-page
62331
+** deleted content is cleared, but freelist deleted content is not.
62332
+**
62333
+** With BTS_SECURE_DELETE, operation is like BTS_OVERWRITE with the addition
62334
+** that freelist leaf pages are written back into the database, increasing
62335
+** the amount of disk I/O.
6224362336
*/
6224462337
SQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree *p, int newFlag){
6224562338
int b;
6224662339
if( p==0 ) return 0;
6224762340
sqlite3BtreeEnter(p);
62341
+ assert( BTS_OVERWRITE==BTS_SECURE_DELETE*2 );
62342
+ assert( BTS_FAST_SECURE==(BTS_OVERWRITE|BTS_SECURE_DELETE) );
6224862343
if( newFlag>=0 ){
62249
- p->pBt->btsFlags &= ~BTS_SECURE_DELETE;
62250
- if( newFlag ) p->pBt->btsFlags |= BTS_SECURE_DELETE;
62251
- }
62252
- b = (p->pBt->btsFlags & BTS_SECURE_DELETE)!=0;
62344
+ p->pBt->btsFlags &= ~BTS_FAST_SECURE;
62345
+ p->pBt->btsFlags |= BTS_SECURE_DELETE*newFlag;
62346
+ }
62347
+ b = (p->pBt->btsFlags & BTS_FAST_SECURE)/BTS_SECURE_DELETE;
6225362348
sqlite3BtreeLeave(p);
6225462349
return b;
6225562350
}
6225662351
6225762352
/*
@@ -64864,23 +64959,23 @@
6486464959
** for the common case of merely incrementing the cell counter BtCursor.aiIdx
6486564960
** to the next cell on the current page. The (slower) btreeNext() helper
6486664961
** routine is called when it is necessary to move to a different page or
6486764962
** to restore the cursor.
6486864963
**
64869
-** If bit 0x01 of the flags argument is 1, then the cursor corresponds to
64870
-** an SQL index and this routine could have been skipped if the SQL index
64871
-** had been a unique index. The flags argument is a hint to the implement.
64872
-** SQLite btree implementation does not use this hint, but COMDB2 does.
64964
+** If bit 0x01 of the F argument in sqlite3BtreeNext(C,F) is 1, then the
64965
+** cursor corresponds to an SQL index and this routine could have been
64966
+** skipped if the SQL index had been a unique index. The F argument
64967
+** is a hint to the implement. SQLite btree implementation does not use
64968
+** this hint, but COMDB2 does.
6487364969
*/
64874
-static SQLITE_NOINLINE int btreeNext(BtCursor *pCur, int flags){
64970
+static SQLITE_NOINLINE int btreeNext(BtCursor *pCur){
6487564971
int rc;
6487664972
int idx;
6487764973
MemPage *pPage;
6487864974
6487964975
assert( cursorOwnsBtShared(pCur) );
6488064976
assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
64881
- assert( flags==0 );
6488264977
if( pCur->eState!=CURSOR_VALID ){
6488364978
assert( (pCur->curFlags & BTCF_ValidOvfl)==0 );
6488464979
rc = restoreCursorPosition(pCur);
6488564980
if( rc!=SQLITE_OK ){
6488664981
return rc;
@@ -64923,11 +65018,11 @@
6492365018
}
6492465019
moveToParent(pCur);
6492565020
pPage = pCur->apPage[pCur->iPage];
6492665021
}while( pCur->ix>=pPage->nCell );
6492765022
if( pPage->intKey ){
64928
- return sqlite3BtreeNext(pCur, flags);
65023
+ return sqlite3BtreeNext(pCur, 0);
6492965024
}else{
6493065025
return SQLITE_OK;
6493165026
}
6493265027
}
6493365028
if( pPage->leaf ){
@@ -64936,20 +65031,21 @@
6493665031
return moveToLeftmost(pCur);
6493765032
}
6493865033
}
6493965034
SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor *pCur, int flags){
6494065035
MemPage *pPage;
65036
+ UNUSED_PARAMETER( flags ); /* Used in COMDB2 but not native SQLite */
6494165037
assert( cursorOwnsBtShared(pCur) );
6494265038
assert( flags==0 || flags==1 );
6494365039
assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
6494465040
pCur->info.nSize = 0;
6494565041
pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
64946
- if( pCur->eState!=CURSOR_VALID ) return btreeNext(pCur, 0);
65042
+ if( pCur->eState!=CURSOR_VALID ) return btreeNext(pCur);
6494765043
pPage = pCur->apPage[pCur->iPage];
6494865044
if( (++pCur->ix)>=pPage->nCell ){
6494965045
pCur->ix--;
64950
- return btreeNext(pCur, 0);
65046
+ return btreeNext(pCur);
6495165047
}
6495265048
if( pPage->leaf ){
6495365049
return SQLITE_OK;
6495465050
}else{
6495565051
return moveToLeftmost(pCur);
@@ -64968,22 +65064,21 @@
6496865064
** for the common case of merely decrementing the cell counter BtCursor.aiIdx
6496965065
** to the previous cell on the current page. The (slower) btreePrevious()
6497065066
** helper routine is called when it is necessary to move to a different page
6497165067
** or to restore the cursor.
6497265068
**
64973
-**
64974
-** If bit 0x01 of the flags argument is 1, then the cursor corresponds to
64975
-** an SQL index and this routine could have been skipped if the SQL index
64976
-** had been a unique index. The flags argument is a hint to the implement.
64977
-** SQLite btree implementation does not use this hint, but COMDB2 does.
65069
+** If bit 0x01 of the F argument to sqlite3BtreePrevious(C,F) is 1, then
65070
+** the cursor corresponds to an SQL index and this routine could have been
65071
+** skipped if the SQL index had been a unique index. The F argument is a
65072
+** hint to the implement. The native SQLite btree implementation does not
65073
+** use this hint, but COMDB2 does.
6497865074
*/
64979
-static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur, int flags){
65075
+static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur){
6498065076
int rc;
6498165077
MemPage *pPage;
6498265078
6498365079
assert( cursorOwnsBtShared(pCur) );
64984
- assert( flags==0 );
6498565080
assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
6498665081
assert( (pCur->curFlags & (BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey))==0 );
6498765082
assert( pCur->info.nSize==0 );
6498865083
if( pCur->eState!=CURSOR_VALID ){
6498965084
rc = restoreCursorPosition(pCur);
@@ -65023,11 +65118,11 @@
6502365118
assert( (pCur->curFlags & (BTCF_ValidOvfl))==0 );
6502465119
6502565120
pCur->ix--;
6502665121
pPage = pCur->apPage[pCur->iPage];
6502765122
if( pPage->intKey && !pPage->leaf ){
65028
- rc = sqlite3BtreePrevious(pCur, flags);
65123
+ rc = sqlite3BtreePrevious(pCur, 0);
6502965124
}else{
6503065125
rc = SQLITE_OK;
6503165126
}
6503265127
}
6503365128
return rc;
@@ -65034,17 +65129,18 @@
6503465129
}
6503565130
SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor *pCur, int flags){
6503665131
assert( cursorOwnsBtShared(pCur) );
6503765132
assert( flags==0 || flags==1 );
6503865133
assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
65134
+ UNUSED_PARAMETER( flags ); /* Used in COMDB2 but not native SQLite */
6503965135
pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey);
6504065136
pCur->info.nSize = 0;
6504165137
if( pCur->eState!=CURSOR_VALID
6504265138
|| pCur->ix==0
6504365139
|| pCur->apPage[pCur->iPage]->leaf==0
6504465140
){
65045
- return btreePrevious(pCur, 0);
65141
+ return btreePrevious(pCur);
6504665142
}
6504765143
pCur->ix--;
6504865144
return SQLITE_OK;
6504965145
}
6505065146
@@ -66642,11 +66738,11 @@
6664266738
** But not if we are in secure-delete mode. In secure-delete mode,
6664366739
** the dropCell() routine will overwrite the entire cell with zeroes.
6664466740
** In this case, temporarily copy the cell into the aOvflSpace[]
6664566741
** buffer. It will be copied out again as soon as the aSpace[] buffer
6664666742
** is allocated. */
66647
- if( pBt->btsFlags & BTS_SECURE_DELETE ){
66743
+ if( pBt->btsFlags & BTS_FAST_SECURE ){
6664866744
int iOff;
6664966745
6665066746
iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData);
6665166747
if( (iOff+szNew[i])>(int)pBt->usableSize ){
6665266748
rc = SQLITE_CORRUPT_BKPT;
@@ -72056,25 +72152,31 @@
7205672152
** constants. The registers begin with iDest and increase consecutively.
7205772153
** One register is initialized for each characgter in zTypes[]. For each
7205872154
** "s" character in zTypes[], the register is a string if the argument is
7205972155
** not NULL, or OP_Null if the value is a null pointer. For each "i" character
7206072156
** in zTypes[], the register is initialized to an integer.
72157
+**
72158
+** If the input string does not end with "X" then an OP_ResultRow instruction
72159
+** is generated for the values inserted.
7206172160
*/
7206272161
SQLITE_PRIVATE void sqlite3VdbeMultiLoad(Vdbe *p, int iDest, const char *zTypes, ...){
7206372162
va_list ap;
7206472163
int i;
7206572164
char c;
7206672165
va_start(ap, zTypes);
7206772166
for(i=0; (c = zTypes[i])!=0; i++){
7206872167
if( c=='s' ){
7206972168
const char *z = va_arg(ap, const char*);
72070
- sqlite3VdbeAddOp4(p, z==0 ? OP_Null : OP_String8, 0, iDest++, 0, z, 0);
72169
+ sqlite3VdbeAddOp4(p, z==0 ? OP_Null : OP_String8, 0, iDest+i, 0, z, 0);
72170
+ }else if( c=='i' ){
72171
+ sqlite3VdbeAddOp2(p, OP_Integer, va_arg(ap, int), iDest+i);
7207172172
}else{
72072
- assert( c=='i' );
72073
- sqlite3VdbeAddOp2(p, OP_Integer, va_arg(ap, int), iDest++);
72173
+ goto skip_op_resultrow;
7207472174
}
7207572175
}
72176
+ sqlite3VdbeAddOp2(p, OP_ResultRow, iDest, i);
72177
+skip_op_resultrow:
7207672178
va_end(ap);
7207772179
}
7207872180
7207972181
/*
7208072182
** Add an opcode that includes the p4 value as a pointer.
@@ -89667,19 +89769,21 @@
8966789769
static SQLITE_NOINLINE int walkExpr(Walker *pWalker, Expr *pExpr){
8966889770
int rc;
8966989771
testcase( ExprHasProperty(pExpr, EP_TokenOnly) );
8967089772
testcase( ExprHasProperty(pExpr, EP_Reduced) );
8967189773
rc = pWalker->xExprCallback(pWalker, pExpr);
89672
- if( rc || ExprHasProperty(pExpr,(EP_TokenOnly|EP_Leaf)) ){
89673
- return rc & WRC_Abort;
89674
- }
89675
- if( pExpr->pLeft && walkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;
89676
- if( pExpr->pRight && walkExpr(pWalker, pExpr->pRight) ) return WRC_Abort;
89677
- if( ExprHasProperty(pExpr, EP_xIsSelect) ){
89678
- if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort;
89679
- }else if( pExpr->x.pList ){
89680
- if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;
89774
+ if( rc ) return rc & WRC_Abort;
89775
+ if( !ExprHasProperty(pExpr,(EP_TokenOnly|EP_Leaf)) ){
89776
+ if( pExpr->pLeft && walkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;
89777
+ assert( pExpr->x.pList==0 || pExpr->pRight==0 );
89778
+ if( pExpr->pRight ){
89779
+ if( walkExpr(pWalker, pExpr->pRight) ) return WRC_Abort;
89780
+ }else if( ExprHasProperty(pExpr, EP_xIsSelect) ){
89781
+ if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort;
89782
+ }else if( pExpr->x.pList ){
89783
+ if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;
89784
+ }
8968189785
}
8968289786
return WRC_Continue;
8968389787
}
8968489788
SQLITE_PRIVATE int sqlite3WalkExpr(Walker *pWalker, Expr *pExpr){
8968589789
return pExpr ? walkExpr(pWalker,pExpr) : WRC_Continue;
@@ -89730,11 +89834,11 @@
8973089834
struct SrcList_item *pItem;
8973189835
8973289836
pSrc = p->pSrc;
8973389837
if( ALWAYS(pSrc) ){
8973489838
for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){
89735
- if( sqlite3WalkSelect(pWalker, pItem->pSelect) ){
89839
+ if( pItem->pSelect && sqlite3WalkSelect(pWalker, pItem->pSelect) ){
8973689840
return WRC_Abort;
8973789841
}
8973889842
if( pItem->fg.isTabFunc
8973989843
&& sqlite3WalkExprList(pWalker, pItem->u1.pFuncArg)
8974089844
){
@@ -89762,11 +89866,12 @@
8976289866
** If the Walker does not have an xSelectCallback() then this routine
8976389867
** is a no-op returning WRC_Continue.
8976489868
*/
8976589869
SQLITE_PRIVATE int sqlite3WalkSelect(Walker *pWalker, Select *p){
8976689870
int rc;
89767
- if( p==0 || pWalker->xSelectCallback==0 ) return WRC_Continue;
89871
+ if( p==0 ) return WRC_Continue;
89872
+ if( pWalker->xSelectCallback==0 ) return WRC_Continue;
8976889873
do{
8976989874
rc = pWalker->xSelectCallback(pWalker, p);
8977089875
if( rc ) return rc & WRC_Abort;
8977189876
if( sqlite3WalkSelectExpr(pWalker, p)
8977289877
|| sqlite3WalkSelectFrom(pWalker, p)
@@ -90261,10 +90366,11 @@
9026190366
sqlite3ExprDelete(db, pExpr->pLeft);
9026290367
pExpr->pLeft = 0;
9026390368
sqlite3ExprDelete(db, pExpr->pRight);
9026490369
pExpr->pRight = 0;
9026590370
pExpr->op = (isTrigger ? TK_TRIGGER : TK_COLUMN);
90371
+ ExprSetProperty(pExpr, EP_Leaf);
9026690372
lookupname_end:
9026790373
if( cnt==1 ){
9026890374
assert( pNC!=0 );
9026990375
if( !ExprHasProperty(pExpr, EP_Alias) ){
9027090376
sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
@@ -90299,11 +90405,10 @@
9029990405
p->iColumn = (ynVar)iCol;
9030090406
testcase( iCol==BMS );
9030190407
testcase( iCol==BMS-1 );
9030290408
pItem->colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol);
9030390409
}
90304
- ExprSetProperty(p, EP_Resolved);
9030590410
}
9030690411
return p;
9030790412
}
9030890413
9030990414
/*
@@ -90359,12 +90464,10 @@
9035990464
pNC = pWalker->u.pNC;
9036090465
assert( pNC!=0 );
9036190466
pParse = pNC->pParse;
9036290467
assert( pParse==pWalker->pParse );
9036390468
90364
- if( ExprHasProperty(pExpr, EP_Resolved) ) return WRC_Prune;
90365
- ExprSetProperty(pExpr, EP_Resolved);
9036690469
#ifndef NDEBUG
9036790470
if( pNC->pSrcList && pNC->pSrcList->nAlloc>0 ){
9036890471
SrcList *pSrcList = pNC->pSrcList;
9036990472
int i;
9037090473
for(i=0; i<pNC->pSrcList->nSrc; i++){
@@ -92067,11 +92170,11 @@
9206792170
memset(pNew, 0, sizeof(Expr));
9206892171
pNew->op = (u8)op;
9206992172
pNew->iAgg = -1;
9207092173
if( pToken ){
9207192174
if( nExtra==0 ){
92072
- pNew->flags |= EP_IntValue;
92175
+ pNew->flags |= EP_IntValue|EP_Leaf;
9207392176
pNew->u.iValue = iValue;
9207492177
}else{
9207592178
pNew->u.zToken = (char*)&pNew[1];
9207692179
assert( pToken->z!=0 || pToken->n==0 );
9207792180
if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
@@ -92348,12 +92451,13 @@
9234892451
#endif
9234992452
if( !ExprHasProperty(p, (EP_TokenOnly|EP_Leaf)) ){
9235092453
/* The Expr.x union is never used at the same time as Expr.pRight */
9235192454
assert( p->x.pList==0 || p->pRight==0 );
9235292455
if( p->pLeft && p->op!=TK_SELECT_COLUMN ) sqlite3ExprDeleteNN(db, p->pLeft);
92353
- sqlite3ExprDelete(db, p->pRight);
92354
- if( ExprHasProperty(p, EP_xIsSelect) ){
92456
+ if( p->pRight ){
92457
+ sqlite3ExprDeleteNN(db, p->pRight);
92458
+ }else if( ExprHasProperty(p, EP_xIsSelect) ){
9235592459
sqlite3SelectDelete(db, p->x.pSelect);
9235692460
}else{
9235792461
sqlite3ExprListDelete(db, p->x.pList);
9235892462
}
9235992463
}
@@ -103955,16 +104059,16 @@
103955104059
pItem = &pList->a[pList->nSrc-1];
103956104060
if( pDatabase && pDatabase->z==0 ){
103957104061
pDatabase = 0;
103958104062
}
103959104063
if( pDatabase ){
103960
- Token *pTemp = pDatabase;
103961
- pDatabase = pTable;
103962
- pTable = pTemp;
104064
+ pItem->zName = sqlite3NameFromToken(db, pDatabase);
104065
+ pItem->zDatabase = sqlite3NameFromToken(db, pTable);
104066
+ }else{
104067
+ pItem->zName = sqlite3NameFromToken(db, pTable);
104068
+ pItem->zDatabase = 0;
103963104069
}
103964
- pItem->zName = sqlite3NameFromToken(db, pTable);
103965
- pItem->zDatabase = sqlite3NameFromToken(db, pDatabase);
103966104070
return pList;
103967104071
}
103968104072
103969104073
/*
103970104074
** Assign VdbeCursor index numbers to all tables in a SrcList
@@ -104149,40 +104253,29 @@
104149104253
}
104150104254
sqlite3VdbeAddOp0(v, OP_AutoCommit);
104151104255
}
104152104256
104153104257
/*
104154
-** Generate VDBE code for a COMMIT statement.
104155
-*/
104156
-SQLITE_PRIVATE void sqlite3CommitTransaction(Parse *pParse){
104157
- Vdbe *v;
104158
-
104159
- assert( pParse!=0 );
104160
- assert( pParse->db!=0 );
104161
- if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "COMMIT", 0, 0) ){
104162
- return;
104163
- }
104164
- v = sqlite3GetVdbe(pParse);
104165
- if( v ){
104166
- sqlite3VdbeAddOp1(v, OP_AutoCommit, 1);
104167
- }
104168
-}
104169
-
104170
-/*
104171
-** Generate VDBE code for a ROLLBACK statement.
104172
-*/
104173
-SQLITE_PRIVATE void sqlite3RollbackTransaction(Parse *pParse){
104174
- Vdbe *v;
104175
-
104176
- assert( pParse!=0 );
104177
- assert( pParse->db!=0 );
104178
- if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "ROLLBACK", 0, 0) ){
104179
- return;
104180
- }
104181
- v = sqlite3GetVdbe(pParse);
104182
- if( v ){
104183
- sqlite3VdbeAddOp2(v, OP_AutoCommit, 1, 1);
104258
+** Generate VDBE code for a COMMIT or ROLLBACK statement.
104259
+** Code for ROLLBACK is generated if eType==TK_ROLLBACK. Otherwise
104260
+** code is generated for a COMMIT.
104261
+*/
104262
+SQLITE_PRIVATE void sqlite3EndTransaction(Parse *pParse, int eType){
104263
+ Vdbe *v;
104264
+ int isRollback;
104265
+
104266
+ assert( pParse!=0 );
104267
+ assert( pParse->db!=0 );
104268
+ assert( eType==TK_COMMIT || eType==TK_END || eType==TK_ROLLBACK );
104269
+ isRollback = eType==TK_ROLLBACK;
104270
+ if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION,
104271
+ isRollback ? "ROLLBACK" : "COMMIT", 0, 0) ){
104272
+ return;
104273
+ }
104274
+ v = sqlite3GetVdbe(pParse);
104275
+ if( v ){
104276
+ sqlite3VdbeAddOp2(v, OP_AutoCommit, 1, isRollback);
104184104277
}
104185104278
}
104186104279
104187104280
/*
104188104281
** This function is called by the parser when it parses a command to create,
@@ -104759,11 +104852,11 @@
104759104852
** request a definition of the collating sequence. If this doesn't work,
104760104853
** an equivalent collating sequence that uses a text encoding different
104761104854
** from the main database is substituted, if one is available.
104762104855
*/
104763104856
SQLITE_PRIVATE int sqlite3CheckCollSeq(Parse *pParse, CollSeq *pColl){
104764
- if( pColl ){
104857
+ if( pColl && pColl->xCmp==0 ){
104765104858
const char *zName = pColl->zName;
104766104859
sqlite3 *db = pParse->db;
104767104860
CollSeq *p = sqlite3GetCollSeq(pParse, ENC(db), pColl, zName);
104768104861
if( !p ){
104769104862
return SQLITE_ERROR;
@@ -104795,22 +104888,21 @@
104795104888
){
104796104889
CollSeq *pColl;
104797104890
pColl = sqlite3HashFind(&db->aCollSeq, zName);
104798104891
104799104892
if( 0==pColl && create ){
104800
- int nName = sqlite3Strlen30(zName);
104801
- pColl = sqlite3DbMallocZero(db, 3*sizeof(*pColl) + nName + 1);
104893
+ int nName = sqlite3Strlen30(zName) + 1;
104894
+ pColl = sqlite3DbMallocZero(db, 3*sizeof(*pColl) + nName);
104802104895
if( pColl ){
104803104896
CollSeq *pDel = 0;
104804104897
pColl[0].zName = (char*)&pColl[3];
104805104898
pColl[0].enc = SQLITE_UTF8;
104806104899
pColl[1].zName = (char*)&pColl[3];
104807104900
pColl[1].enc = SQLITE_UTF16LE;
104808104901
pColl[2].zName = (char*)&pColl[3];
104809104902
pColl[2].enc = SQLITE_UTF16BE;
104810104903
memcpy(pColl[0].zName, zName, nName);
104811
- pColl[0].zName[nName] = 0;
104812104904
pDel = sqlite3HashInsert(&db->aCollSeq, pColl[0].zName, pColl);
104813104905
104814104906
/* If a malloc() failure occurred in sqlite3HashInsert(), it will
104815104907
** return the pColl pointer to be deleted (because it wasn't added
104816104908
** to the hash table).
@@ -104946,11 +105038,12 @@
104946105038
int i;
104947105039
for(i=0; i<nDef; i++){
104948105040
FuncDef *pOther;
104949105041
const char *zName = aDef[i].zName;
104950105042
int nName = sqlite3Strlen30(zName);
104951
- int h = (sqlite3UpperToLower[(u8)zName[0]] + nName) % SQLITE_FUNC_HASH_SZ;
105043
+ int h = (zName[0] + nName) % SQLITE_FUNC_HASH_SZ;
105044
+ assert( zName[0]>='a' && zName[0]<='z' );
104952105045
pOther = functionSearch(h, zName);
104953105046
if( pOther ){
104954105047
assert( pOther!=&aDef[i] && pOther->pNext!=&aDef[i] );
104955105048
aDef[i].pNext = pOther->pNext;
104956105049
pOther->pNext = &aDef[i];
@@ -106109,20 +106202,20 @@
106109106202
static void typeofFunc(
106110106203
sqlite3_context *context,
106111106204
int NotUsed,
106112106205
sqlite3_value **argv
106113106206
){
106114
- const char *z = 0;
106207
+ static const char *azType[] = { "integer", "real", "text", "blob", "null" };
106208
+ int i = sqlite3_value_type(argv[0]) - 1;
106115106209
UNUSED_PARAMETER(NotUsed);
106116
- switch( sqlite3_value_type(argv[0]) ){
106117
- case SQLITE_INTEGER: z = "integer"; break;
106118
- case SQLITE_TEXT: z = "text"; break;
106119
- case SQLITE_FLOAT: z = "real"; break;
106120
- case SQLITE_BLOB: z = "blob"; break;
106121
- default: z = "null"; break;
106122
- }
106123
- sqlite3_result_text(context, z, -1, SQLITE_STATIC);
106210
+ assert( i>=0 && i<ArraySize(azType) );
106211
+ assert( SQLITE_INTEGER==1 );
106212
+ assert( SQLITE_FLOAT==2 );
106213
+ assert( SQLITE_TEXT==3 );
106214
+ assert( SQLITE_BLOB==4 );
106215
+ assert( SQLITE_NULL==5 );
106216
+ sqlite3_result_text(context, azType[i], -1, SQLITE_STATIC);
106124106217
}
106125106218
106126106219
106127106220
/*
106128106221
** Implementation of the length() function
@@ -112042,10 +112135,15 @@
112042112135
/* Version 3.14.0 and later */
112043112136
int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*);
112044112137
char *(*expanded_sql)(sqlite3_stmt*);
112045112138
/* Version 3.18.0 and later */
112046112139
void (*set_last_insert_rowid)(sqlite3*,sqlite3_int64);
112140
+ /* Version 3.20.0 and later */
112141
+ int (*prepare_v3)(sqlite3*,const char*,int,unsigned int,
112142
+ sqlite3_stmt**,const char**);
112143
+ int (*prepare16_v3)(sqlite3*,const void*,int,unsigned int,
112144
+ sqlite3_stmt**,const void**);
112047112145
};
112048112146
112049112147
/*
112050112148
** This is the function signature used for all extension entry points. It
112051112149
** is also defined in the file "loadext.c".
@@ -112302,10 +112400,13 @@
112302112400
/* Version 3.14.0 and later */
112303112401
#define sqlite3_trace_v2 sqlite3_api->trace_v2
112304112402
#define sqlite3_expanded_sql sqlite3_api->expanded_sql
112305112403
/* Version 3.18.0 and later */
112306112404
#define sqlite3_set_last_insert_rowid sqlite3_api->set_last_insert_rowid
112405
+/* Version 3.20.0 and later */
112406
+#define sqlite3_prepare_v3 sqlite3_api->prepare_v3
112407
+#define sqlite3_prepare16_v3 sqlite3_api->prepare16_v3
112307112408
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
112308112409
112309112410
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
112310112411
/* This case when the file really is being compiled as a loadable
112311112412
** extension */
@@ -112357,10 +112458,11 @@
112357112458
# define sqlite3_create_function16 0
112358112459
# define sqlite3_errmsg16 0
112359112460
# define sqlite3_open16 0
112360112461
# define sqlite3_prepare16 0
112361112462
# define sqlite3_prepare16_v2 0
112463
+# define sqlite3_prepare16_v3 0
112362112464
# define sqlite3_result_error16 0
112363112465
# define sqlite3_result_text16 0
112364112466
# define sqlite3_result_text16be 0
112365112467
# define sqlite3_result_text16le 0
112366112468
# define sqlite3_value_text16 0
@@ -112729,11 +112831,14 @@
112729112831
sqlite3_system_errno,
112730112832
/* Version 3.14.0 and later */
112731112833
sqlite3_trace_v2,
112732112834
sqlite3_expanded_sql,
112733112835
/* Version 3.18.0 and later */
112734
- sqlite3_set_last_insert_rowid
112836
+ sqlite3_set_last_insert_rowid,
112837
+ /* Version 3.20.0 and later */
112838
+ sqlite3_prepare_v3,
112839
+ sqlite3_prepare16_v3
112735112840
};
112736112841
112737112842
/*
112738112843
** Attempt to load an SQLite extension library contained in the file
112739112844
** zFile. The entry point is zProc. zProc may be 0 in which case a
@@ -113151,39 +113256,42 @@
113151113256
#define PragTyp_DATABASE_LIST 10
113152113257
#define PragTyp_DEFAULT_CACHE_SIZE 11
113153113258
#define PragTyp_ENCODING 12
113154113259
#define PragTyp_FOREIGN_KEY_CHECK 13
113155113260
#define PragTyp_FOREIGN_KEY_LIST 14
113156
-#define PragTyp_INCREMENTAL_VACUUM 15
113157
-#define PragTyp_INDEX_INFO 16
113158
-#define PragTyp_INDEX_LIST 17
113159
-#define PragTyp_INTEGRITY_CHECK 18
113160
-#define PragTyp_JOURNAL_MODE 19
113161
-#define PragTyp_JOURNAL_SIZE_LIMIT 20
113162
-#define PragTyp_LOCK_PROXY_FILE 21
113163
-#define PragTyp_LOCKING_MODE 22
113164
-#define PragTyp_PAGE_COUNT 23
113165
-#define PragTyp_MMAP_SIZE 24
113166
-#define PragTyp_OPTIMIZE 25
113167
-#define PragTyp_PAGE_SIZE 26
113168
-#define PragTyp_SECURE_DELETE 27
113169
-#define PragTyp_SHRINK_MEMORY 28
113170
-#define PragTyp_SOFT_HEAP_LIMIT 29
113171
-#define PragTyp_SYNCHRONOUS 30
113172
-#define PragTyp_TABLE_INFO 31
113173
-#define PragTyp_TEMP_STORE 32
113174
-#define PragTyp_TEMP_STORE_DIRECTORY 33
113175
-#define PragTyp_THREADS 34
113176
-#define PragTyp_WAL_AUTOCHECKPOINT 35
113177
-#define PragTyp_WAL_CHECKPOINT 36
113178
-#define PragTyp_ACTIVATE_EXTENSIONS 37
113179
-#define PragTyp_HEXKEY 38
113180
-#define PragTyp_KEY 39
113181
-#define PragTyp_REKEY 40
113182
-#define PragTyp_LOCK_STATUS 41
113183
-#define PragTyp_PARSER_TRACE 42
113184
-#define PragTyp_STATS 43
113261
+#define PragTyp_FUNCTION_LIST 15
113262
+#define PragTyp_INCREMENTAL_VACUUM 16
113263
+#define PragTyp_INDEX_INFO 17
113264
+#define PragTyp_INDEX_LIST 18
113265
+#define PragTyp_INTEGRITY_CHECK 19
113266
+#define PragTyp_JOURNAL_MODE 20
113267
+#define PragTyp_JOURNAL_SIZE_LIMIT 21
113268
+#define PragTyp_LOCK_PROXY_FILE 22
113269
+#define PragTyp_LOCKING_MODE 23
113270
+#define PragTyp_PAGE_COUNT 24
113271
+#define PragTyp_MMAP_SIZE 25
113272
+#define PragTyp_MODULE_LIST 26
113273
+#define PragTyp_OPTIMIZE 27
113274
+#define PragTyp_PAGE_SIZE 28
113275
+#define PragTyp_PRAGMA_LIST 29
113276
+#define PragTyp_SECURE_DELETE 30
113277
+#define PragTyp_SHRINK_MEMORY 31
113278
+#define PragTyp_SOFT_HEAP_LIMIT 32
113279
+#define PragTyp_SYNCHRONOUS 33
113280
+#define PragTyp_TABLE_INFO 34
113281
+#define PragTyp_TEMP_STORE 35
113282
+#define PragTyp_TEMP_STORE_DIRECTORY 36
113283
+#define PragTyp_THREADS 37
113284
+#define PragTyp_WAL_AUTOCHECKPOINT 38
113285
+#define PragTyp_WAL_CHECKPOINT 39
113286
+#define PragTyp_ACTIVATE_EXTENSIONS 40
113287
+#define PragTyp_HEXKEY 41
113288
+#define PragTyp_KEY 42
113289
+#define PragTyp_REKEY 43
113290
+#define PragTyp_LOCK_STATUS 44
113291
+#define PragTyp_PARSER_TRACE 45
113292
+#define PragTyp_STATS 46
113185113293
113186113294
/* Property flags associated with various pragma. */
113187113295
#define PragFlg_NeedSchema 0x01 /* Force schema load before running */
113188113296
#define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */
113189113297
#define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
@@ -113225,30 +113333,33 @@
113225113333
/* 24 */ "origin",
113226113334
/* 25 */ "partial",
113227113335
/* 26 */ "seq", /* Used by: database_list */
113228113336
/* 27 */ "name",
113229113337
/* 28 */ "file",
113230
- /* 29 */ "seq", /* Used by: collation_list */
113231
- /* 30 */ "name",
113232
- /* 31 */ "id", /* Used by: foreign_key_list */
113233
- /* 32 */ "seq",
113234
- /* 33 */ "table",
113235
- /* 34 */ "from",
113236
- /* 35 */ "to",
113237
- /* 36 */ "on_update",
113238
- /* 37 */ "on_delete",
113239
- /* 38 */ "match",
113240
- /* 39 */ "table", /* Used by: foreign_key_check */
113241
- /* 40 */ "rowid",
113242
- /* 41 */ "parent",
113243
- /* 42 */ "fkid",
113244
- /* 43 */ "busy", /* Used by: wal_checkpoint */
113245
- /* 44 */ "log",
113246
- /* 45 */ "checkpointed",
113247
- /* 46 */ "timeout", /* Used by: busy_timeout */
113248
- /* 47 */ "database", /* Used by: lock_status */
113249
- /* 48 */ "status",
113338
+ /* 29 */ "name", /* Used by: function_list */
113339
+ /* 30 */ "builtin",
113340
+ /* 31 */ "name", /* Used by: module_list pragma_list */
113341
+ /* 32 */ "seq", /* Used by: collation_list */
113342
+ /* 33 */ "name",
113343
+ /* 34 */ "id", /* Used by: foreign_key_list */
113344
+ /* 35 */ "seq",
113345
+ /* 36 */ "table",
113346
+ /* 37 */ "from",
113347
+ /* 38 */ "to",
113348
+ /* 39 */ "on_update",
113349
+ /* 40 */ "on_delete",
113350
+ /* 41 */ "match",
113351
+ /* 42 */ "table", /* Used by: foreign_key_check */
113352
+ /* 43 */ "rowid",
113353
+ /* 44 */ "parent",
113354
+ /* 45 */ "fkid",
113355
+ /* 46 */ "busy", /* Used by: wal_checkpoint */
113356
+ /* 47 */ "log",
113357
+ /* 48 */ "checkpointed",
113358
+ /* 49 */ "timeout", /* Used by: busy_timeout */
113359
+ /* 50 */ "database", /* Used by: lock_status */
113360
+ /* 51 */ "status",
113250113361
};
113251113362
113252113363
/* Definitions of all built-in pragmas */
113253113364
typedef struct PragmaName {
113254113365
const char *const zName; /* Name of pragma */
@@ -113290,11 +113401,11 @@
113290113401
#endif
113291113402
#endif
113292113403
{/* zName: */ "busy_timeout",
113293113404
/* ePragTyp: */ PragTyp_BUSY_TIMEOUT,
113294113405
/* ePragFlg: */ PragFlg_Result0,
113295
- /* ColNames: */ 46, 1,
113406
+ /* ColNames: */ 49, 1,
113296113407
/* iArg: */ 0 },
113297113408
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
113298113409
{/* zName: */ "cache_size",
113299113410
/* ePragTyp: */ PragTyp_CACHE_SIZE,
113300113411
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
@@ -113327,11 +113438,11 @@
113327113438
#endif
113328113439
#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
113329113440
{/* zName: */ "collation_list",
113330113441
/* ePragTyp: */ PragTyp_COLLATION_LIST,
113331113442
/* ePragFlg: */ PragFlg_Result0,
113332
- /* ColNames: */ 29, 2,
113443
+ /* ColNames: */ 32, 2,
113333113444
/* iArg: */ 0 },
113334113445
#endif
113335113446
#if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
113336113447
{/* zName: */ "compile_options",
113337113448
/* ePragTyp: */ PragTyp_COMPILE_OPTIONS,
@@ -113399,18 +113510,18 @@
113399113510
#endif
113400113511
#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
113401113512
{/* zName: */ "foreign_key_check",
113402113513
/* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK,
113403113514
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0,
113404
- /* ColNames: */ 39, 4,
113515
+ /* ColNames: */ 42, 4,
113405113516
/* iArg: */ 0 },
113406113517
#endif
113407113518
#if !defined(SQLITE_OMIT_FOREIGN_KEY)
113408113519
{/* zName: */ "foreign_key_list",
113409113520
/* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST,
113410113521
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
113411
- /* ColNames: */ 31, 8,
113522
+ /* ColNames: */ 34, 8,
113412113523
/* iArg: */ 0 },
113413113524
#endif
113414113525
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
113415113526
#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
113416113527
{/* zName: */ "foreign_keys",
@@ -113436,10 +113547,19 @@
113436113547
{/* zName: */ "fullfsync",
113437113548
/* ePragTyp: */ PragTyp_FLAG,
113438113549
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
113439113550
/* ColNames: */ 0, 0,
113440113551
/* iArg: */ SQLITE_FullFSync },
113552
+#endif
113553
+#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
113554
+#if defined(SQLITE_INTROSPECTION_PRAGMAS)
113555
+ {/* zName: */ "function_list",
113556
+ /* ePragTyp: */ PragTyp_FUNCTION_LIST,
113557
+ /* ePragFlg: */ PragFlg_Result0,
113558
+ /* ColNames: */ 29, 2,
113559
+ /* iArg: */ 0 },
113560
+#endif
113441113561
#endif
113442113562
#if defined(SQLITE_HAS_CODEC)
113443113563
{/* zName: */ "hexkey",
113444113564
/* ePragTyp: */ PragTyp_HEXKEY,
113445113565
/* ePragFlg: */ 0,
@@ -113526,11 +113646,11 @@
113526113646
#endif
113527113647
#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
113528113648
{/* zName: */ "lock_status",
113529113649
/* ePragTyp: */ PragTyp_LOCK_STATUS,
113530113650
/* ePragFlg: */ PragFlg_Result0,
113531
- /* ColNames: */ 47, 2,
113651
+ /* ColNames: */ 50, 2,
113532113652
/* iArg: */ 0 },
113533113653
#endif
113534113654
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
113535113655
{/* zName: */ "locking_mode",
113536113656
/* ePragTyp: */ PragTyp_LOCKING_MODE,
@@ -113545,10 +113665,21 @@
113545113665
{/* zName: */ "mmap_size",
113546113666
/* ePragTyp: */ PragTyp_MMAP_SIZE,
113547113667
/* ePragFlg: */ 0,
113548113668
/* ColNames: */ 0, 0,
113549113669
/* iArg: */ 0 },
113670
+#endif
113671
+#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
113672
+#if !defined(SQLITE_OMIT_VIRTUALTABLE)
113673
+#if defined(SQLITE_INTROSPECTION_PRAGMAS)
113674
+ {/* zName: */ "module_list",
113675
+ /* ePragTyp: */ PragTyp_MODULE_LIST,
113676
+ /* ePragFlg: */ PragFlg_Result0,
113677
+ /* ColNames: */ 31, 1,
113678
+ /* iArg: */ 0 },
113679
+#endif
113680
+#endif
113550113681
#endif
113551113682
{/* zName: */ "optimize",
113552113683
/* ePragTyp: */ PragTyp_OPTIMIZE,
113553113684
/* ePragFlg: */ PragFlg_Result1|PragFlg_NeedSchema,
113554113685
/* ColNames: */ 0, 0,
@@ -113569,10 +113700,17 @@
113569113700
{/* zName: */ "parser_trace",
113570113701
/* ePragTyp: */ PragTyp_PARSER_TRACE,
113571113702
/* ePragFlg: */ 0,
113572113703
/* ColNames: */ 0, 0,
113573113704
/* iArg: */ 0 },
113705
+#endif
113706
+#if defined(SQLITE_INTROSPECTION_PRAGMAS)
113707
+ {/* zName: */ "pragma_list",
113708
+ /* ePragTyp: */ PragTyp_PRAGMA_LIST,
113709
+ /* ePragFlg: */ PragFlg_Result0,
113710
+ /* ColNames: */ 31, 1,
113711
+ /* iArg: */ 0 },
113574113712
#endif
113575113713
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
113576113714
{/* zName: */ "query_only",
113577113715
/* ePragTyp: */ PragTyp_FLAG,
113578113716
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
@@ -113733,11 +113871,11 @@
113733113871
/* ColNames: */ 0, 0,
113734113872
/* iArg: */ 0 },
113735113873
{/* zName: */ "wal_checkpoint",
113736113874
/* ePragTyp: */ PragTyp_WAL_CHECKPOINT,
113737113875
/* ePragFlg: */ PragFlg_NeedSchema,
113738
- /* ColNames: */ 43, 3,
113876
+ /* ColNames: */ 46, 3,
113739113877
/* iArg: */ 0 },
113740113878
#endif
113741113879
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
113742113880
{/* zName: */ "writable_schema",
113743113881
/* ePragTyp: */ PragTyp_FLAG,
@@ -113744,11 +113882,11 @@
113744113882
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
113745113883
/* ColNames: */ 0, 0,
113746113884
/* iArg: */ SQLITE_WriteSchema },
113747113885
#endif
113748113886
};
113749
-/* Number of pragmas: 60 on by default, 74 total. */
113887
+/* Number of pragmas: 60 on by default, 77 total. */
113750113888
113751113889
/************** End of pragma.h **********************************************/
113752113890
/************** Continuing where we left off in pragma.c *********************/
113753113891
113754113892
/*
@@ -114234,22 +114372,26 @@
114234114372
break;
114235114373
}
114236114374
114237114375
/*
114238114376
** PRAGMA [schema.]secure_delete
114239
- ** PRAGMA [schema.]secure_delete=ON/OFF
114377
+ ** PRAGMA [schema.]secure_delete=ON/OFF/FAST
114240114378
**
114241114379
** The first form reports the current setting for the
114242114380
** secure_delete flag. The second form changes the secure_delete
114243
- ** flag setting and reports thenew value.
114381
+ ** flag setting and reports the new value.
114244114382
*/
114245114383
case PragTyp_SECURE_DELETE: {
114246114384
Btree *pBt = pDb->pBt;
114247114385
int b = -1;
114248114386
assert( pBt!=0 );
114249114387
if( zRight ){
114250
- b = sqlite3GetBoolean(zRight, 0);
114388
+ if( sqlite3_stricmp(zRight, "fast")==0 ){
114389
+ b = 2;
114390
+ }else{
114391
+ b = sqlite3GetBoolean(zRight, 0);
114392
+ }
114251114393
}
114252114394
if( pId2->n==0 && b>=0 ){
114253114395
int ii;
114254114396
for(ii=0; ii<db->nDb; ii++){
114255114397
sqlite3BtreeSecureDelete(db->aDb[ii].pBt, b);
@@ -114827,11 +114969,10 @@
114827114969
pCol->zName,
114828114970
sqlite3ColumnType(pCol,""),
114829114971
pCol->notNull ? 1 : 0,
114830114972
pCol->pDflt ? pCol->pDflt->u.zToken : 0,
114831114973
k);
114832
- sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 6);
114833114974
}
114834114975
}
114835114976
}
114836114977
break;
114837114978
@@ -114847,13 +114988,12 @@
114847114988
pTab->zName,
114848114989
0,
114849114990
pTab->szTabRow,
114850114991
pTab->nRowLogEst,
114851114992
pTab->tabFlags);
114852
- sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5);
114853114993
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
114854
- sqlite3VdbeMultiLoad(v, 2, "siii",
114994
+ sqlite3VdbeMultiLoad(v, 2, "siiiX",
114855114995
pIdx->zName,
114856114996
pIdx->szIdxRow,
114857114997
pIdx->aiRowLogEst[0],
114858114998
pIdx->hasStat1);
114859114999
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5);
@@ -114882,14 +115022,14 @@
114882115022
pTab = pIdx->pTable;
114883115023
sqlite3CodeVerifySchema(pParse, iDb);
114884115024
assert( pParse->nMem<=pPragma->nPragCName );
114885115025
for(i=0; i<mx; i++){
114886115026
i16 cnum = pIdx->aiColumn[i];
114887
- sqlite3VdbeMultiLoad(v, 1, "iis", i, cnum,
115027
+ sqlite3VdbeMultiLoad(v, 1, "iisX", i, cnum,
114888115028
cnum<0 ? 0 : pTab->aCol[cnum].zName);
114889115029
if( pPragma->iArg ){
114890
- sqlite3VdbeMultiLoad(v, 4, "isi",
115030
+ sqlite3VdbeMultiLoad(v, 4, "isiX",
114891115031
pIdx->aSortOrder[i],
114892115032
pIdx->azColl[i],
114893115033
i<pIdx->nKeyCol);
114894115034
}
114895115035
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, pParse->nMem);
@@ -114912,11 +115052,10 @@
114912115052
i,
114913115053
pIdx->zName,
114914115054
IsUniqueIndex(pIdx),
114915115055
azOrigin[pIdx->idxType],
114916115056
pIdx->pPartIdxWhere!=0);
114917
- sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5);
114918115057
}
114919115058
}
114920115059
}
114921115060
break;
114922115061
@@ -114928,11 +115067,10 @@
114928115067
assert( db->aDb[i].zDbSName!=0 );
114929115068
sqlite3VdbeMultiLoad(v, 1, "iss",
114930115069
i,
114931115070
db->aDb[i].zDbSName,
114932115071
sqlite3BtreeGetFilename(db->aDb[i].pBt));
114933
- sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3);
114934115072
}
114935115073
}
114936115074
break;
114937115075
114938115076
case PragTyp_COLLATION_LIST: {
@@ -114940,14 +115078,57 @@
114940115078
HashElem *p;
114941115079
pParse->nMem = 2;
114942115080
for(p=sqliteHashFirst(&db->aCollSeq); p; p=sqliteHashNext(p)){
114943115081
CollSeq *pColl = (CollSeq *)sqliteHashData(p);
114944115082
sqlite3VdbeMultiLoad(v, 1, "is", i++, pColl->zName);
115083
+ }
115084
+ }
115085
+ break;
115086
+
115087
+#ifdef SQLITE_INTROSPECTION_PRAGMAS
115088
+ case PragTyp_FUNCTION_LIST: {
115089
+ int i;
115090
+ HashElem *j;
115091
+ FuncDef *p;
115092
+ pParse->nMem = 2;
115093
+ for(i=0; i<SQLITE_FUNC_HASH_SZ; i++){
115094
+ for(p=sqlite3BuiltinFunctions.a[i]; p; p=p->u.pHash ){
115095
+ sqlite3VdbeMultiLoad(v, 1, "si", p->zName, 1);
115096
+ sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);
115097
+ }
115098
+ }
115099
+ for(j=sqliteHashFirst(&db->aFunc); j; j=sqliteHashNext(j)){
115100
+ p = (FuncDef*)sqliteHashData(j);
115101
+ sqlite3VdbeMultiLoad(v, 1, "si", p->zName, 0);
114945115102
sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);
114946115103
}
114947115104
}
114948115105
break;
115106
+
115107
+#ifndef SQLITE_OMIT_VIRTUALTABLE
115108
+ case PragTyp_MODULE_LIST: {
115109
+ HashElem *j;
115110
+ pParse->nMem = 1;
115111
+ for(j=sqliteHashFirst(&db->aModule); j; j=sqliteHashNext(j)){
115112
+ Module *pMod = (Module*)sqliteHashData(j);
115113
+ sqlite3VdbeMultiLoad(v, 1, "s", pMod->zName);
115114
+ sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
115115
+ }
115116
+ }
115117
+ break;
115118
+#endif /* SQLITE_OMIT_VIRTUALTABLE */
115119
+
115120
+ case PragTyp_PRAGMA_LIST: {
115121
+ int i;
115122
+ for(i=0; i<ArraySize(aPragmaName); i++){
115123
+ sqlite3VdbeMultiLoad(v, 1, "s", aPragmaName[i].zName);
115124
+ sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
115125
+ }
115126
+ }
115127
+ break;
115128
+#endif /* SQLITE_INTROSPECTION_PRAGMAS */
115129
+
114949115130
#endif /* SQLITE_OMIT_SCHEMA_PRAGMAS */
114950115131
114951115132
#ifndef SQLITE_OMIT_FOREIGN_KEY
114952115133
case PragTyp_FOREIGN_KEY_LIST: if( zRight ){
114953115134
FKey *pFK;
@@ -114969,11 +115150,10 @@
114969115150
pTab->aCol[pFK->aCol[j].iFrom].zName,
114970115151
pFK->aCol[j].zCol,
114971115152
actionName(pFK->aAction[1]), /* ON UPDATE */
114972115153
actionName(pFK->aAction[0]), /* ON DELETE */
114973115154
"NONE");
114974
- sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 8);
114975115155
}
114976115156
++i;
114977115157
pFK = pFK->pNextFrom;
114978115158
}
114979115159
}
@@ -115079,11 +115259,11 @@
115079115259
if( HasRowid(pTab) ){
115080115260
sqlite3VdbeAddOp2(v, OP_Rowid, 0, regResult+1);
115081115261
}else{
115082115262
sqlite3VdbeAddOp2(v, OP_Null, 0, regResult+1);
115083115263
}
115084
- sqlite3VdbeMultiLoad(v, regResult+2, "si", pFK->zTo, i-1);
115264
+ sqlite3VdbeMultiLoad(v, regResult+2, "siX", pFK->zTo, i-1);
115085115265
sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, 4);
115086115266
sqlite3VdbeResolveLabel(v, addrOk);
115087115267
sqlite3DbFree(db, aiCols);
115088115268
}
115089115269
sqlite3VdbeAddOp2(v, OP_Next, 0, addrTop+1); VdbeCoverage(v);
@@ -115781,11 +115961,10 @@
115781115961
}else if( sqlite3_file_control(db, i ? db->aDb[i].zDbSName : 0,
115782115962
SQLITE_FCNTL_LOCKSTATE, &j)==SQLITE_OK ){
115783115963
zState = azLockName[j];
115784115964
}
115785115965
sqlite3VdbeMultiLoad(v, 1, "ss", db->aDb[i].zDbSName, zState);
115786
- sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);
115787115966
}
115788115967
break;
115789115968
}
115790115969
#endif
115791115970
@@ -118621,24 +118800,50 @@
118621118800
return 0;
118622118801
}
118623118802
118624118803
118625118804
/*
118626
-** Generate code that will tell the VDBE the names of columns
118627
-** in the result set. This information is used to provide the
118628
-** azCol[] values in the callback.
118805
+** Compute the column names for a SELECT statement.
118806
+**
118807
+** The only guarantee that SQLite makes about column names is that if the
118808
+** column has an AS clause assigning it a name, that will be the name used.
118809
+** That is the only documented guarantee. However, countless applications
118810
+** developed over the years have made baseless assumptions about column names
118811
+** and will break if those assumptions changes. Hence, use extreme caution
118812
+** when modifying this routine to avoid breaking legacy.
118813
+**
118814
+** See Also: sqlite3ColumnsFromExprList()
118815
+**
118816
+** The PRAGMA short_column_names and PRAGMA full_column_names settings are
118817
+** deprecated. The default setting is short=ON, full=OFF. 99.9% of all
118818
+** applications should operate this way. Nevertheless, we need to support the
118819
+** other modes for legacy:
118820
+**
118821
+** short=OFF, full=OFF: Column name is the text of the expression has it
118822
+** originally appears in the SELECT statement. In
118823
+** other words, the zSpan of the result expression.
118824
+**
118825
+** short=ON, full=OFF: (This is the default setting). If the result
118826
+** refers directly to a table column, then the result
118827
+** column name is just the table column name: COLUMN.
118828
+** Otherwise use zSpan.
118829
+**
118830
+** full=ON, short=ANY: If the result refers directly to a table column,
118831
+** then the result column name with the table name
118832
+** prefix, ex: TABLE.COLUMN. Otherwise use zSpan.
118629118833
*/
118630118834
static void generateColumnNames(
118631118835
Parse *pParse, /* Parser context */
118632
- SrcList *pTabList, /* List of tables */
118836
+ SrcList *pTabList, /* The FROM clause of the SELECT */
118633118837
ExprList *pEList /* Expressions defining the result set */
118634118838
){
118635118839
Vdbe *v = pParse->pVdbe;
118636118840
int i;
118637118841
Table *pTab;
118638118842
sqlite3 *db = pParse->db;
118639
- int fullNames, shortNames;
118843
+ int fullName; /* TABLE.COLUMN if no AS clause and is a direct table ref */
118844
+ int srcName; /* COLUMN or TABLE.COLUMN if no AS clause and is direct */
118640118845
118641118846
#ifndef SQLITE_OMIT_EXPLAIN
118642118847
/* If this is an EXPLAIN, skip this step */
118643118848
if( pParse->explain ){
118644118849
return;
@@ -118647,21 +118852,23 @@
118647118852
118648118853
if( pParse->colNamesSet || db->mallocFailed ) return;
118649118854
assert( v!=0 );
118650118855
assert( pTabList!=0 );
118651118856
pParse->colNamesSet = 1;
118652
- fullNames = (db->flags & SQLITE_FullColNames)!=0;
118653
- shortNames = (db->flags & SQLITE_ShortColNames)!=0;
118857
+ fullName = (db->flags & SQLITE_FullColNames)!=0;
118858
+ srcName = (db->flags & SQLITE_ShortColNames)!=0 || fullName;
118654118859
sqlite3VdbeSetNumCols(v, pEList->nExpr);
118655118860
for(i=0; i<pEList->nExpr; i++){
118656
- Expr *p;
118657
- p = pEList->a[i].pExpr;
118658
- if( NEVER(p==0) ) continue;
118861
+ Expr *p = pEList->a[i].pExpr;
118862
+
118863
+ assert( p!=0 );
118659118864
if( pEList->a[i].zName ){
118865
+ /* An AS clause always takes first priority */
118660118866
char *zName = pEList->a[i].zName;
118661118867
sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_TRANSIENT);
118662
- }else if( (p->op==TK_COLUMN || p->op==TK_AGG_COLUMN)
118868
+ }else if( srcName
118869
+ && (p->op==TK_COLUMN || p->op==TK_AGG_COLUMN)
118663118870
&& (pTab = tableWithCursor(pTabList, p->iTable))!=0
118664118871
){
118665118872
char *zCol;
118666118873
int iCol = p->iColumn;
118667118874
if( iCol<0 ) iCol = pTab->iPKey;
@@ -118669,14 +118876,11 @@
118669118876
if( iCol<0 ){
118670118877
zCol = "rowid";
118671118878
}else{
118672118879
zCol = pTab->aCol[iCol].zName;
118673118880
}
118674
- if( !shortNames && !fullNames ){
118675
- sqlite3VdbeSetColName(v, i, COLNAME_NAME,
118676
- sqlite3DbStrDup(db, pEList->a[i].zSpan), SQLITE_DYNAMIC);
118677
- }else if( fullNames ){
118881
+ if( fullName ){
118678118882
char *zName = 0;
118679118883
zName = sqlite3MPrintf(db, "%s.%s", pTab->zName, zCol);
118680118884
sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_DYNAMIC);
118681118885
}else{
118682118886
sqlite3VdbeSetColName(v, i, COLNAME_NAME, zCol, SQLITE_TRANSIENT);
@@ -118700,10 +118904,19 @@
118700118904
** Only the column names are computed. Column.zType, Column.zColl,
118701118905
** and other fields of Column are zeroed.
118702118906
**
118703118907
** Return SQLITE_OK on success. If a memory allocation error occurs,
118704118908
** store NULL in *paCol and 0 in *pnCol and return SQLITE_NOMEM.
118909
+**
118910
+** The only guarantee that SQLite makes about column names is that if the
118911
+** column has an AS clause assigning it a name, that will be the name used.
118912
+** That is the only documented guarantee. However, countless applications
118913
+** developed over the years have made baseless assumptions about column names
118914
+** and will break if those assumptions changes. Hence, use extreme caution
118915
+** when modifying this routine to avoid breaking legacy.
118916
+**
118917
+** See Also: generateColumnNames()
118705118918
*/
118706118919
SQLITE_PRIVATE int sqlite3ColumnsFromExprList(
118707118920
Parse *pParse, /* Parsing context */
118708118921
ExprList *pEList, /* Expr list from which to derive column names */
118709118922
i16 *pnCol, /* Write the number of columns here */
@@ -118712,11 +118925,10 @@
118712118925
sqlite3 *db = pParse->db; /* Database connection */
118713118926
int i, j; /* Loop counters */
118714118927
u32 cnt; /* Index added to make the name unique */
118715118928
Column *aCol, *pCol; /* For looping over result columns */
118716118929
int nCol; /* Number of columns in the result set */
118717
- Expr *p; /* Expression for a single result column */
118718118930
char *zName; /* Column name */
118719118931
int nName; /* Size of name in zName[] */
118720118932
Hash ht; /* Hash table of column names */
118721118933
118722118934
sqlite3HashInit(&ht);
@@ -118733,24 +118945,22 @@
118733118945
*paCol = aCol;
118734118946
118735118947
for(i=0, pCol=aCol; i<nCol && !db->mallocFailed; i++, pCol++){
118736118948
/* Get an appropriate name for the column
118737118949
*/
118738
- p = sqlite3ExprSkipCollate(pEList->a[i].pExpr);
118739118950
if( (zName = pEList->a[i].zName)!=0 ){
118740118951
/* If the column contains an "AS <name>" phrase, use <name> as the name */
118741118952
}else{
118742
- Expr *pColExpr = p; /* The expression that is the result column name */
118743
- Table *pTab; /* Table associated with this expression */
118953
+ Expr *pColExpr = sqlite3ExprSkipCollate(pEList->a[i].pExpr);
118744118954
while( pColExpr->op==TK_DOT ){
118745118955
pColExpr = pColExpr->pRight;
118746118956
assert( pColExpr!=0 );
118747118957
}
118748118958
if( pColExpr->op==TK_COLUMN && pColExpr->pTab!=0 ){
118749118959
/* For columns use the column name name */
118750118960
int iCol = pColExpr->iColumn;
118751
- pTab = pColExpr->pTab;
118961
+ Table *pTab = pColExpr->pTab;
118752118962
if( iCol<0 ) iCol = pTab->iPKey;
118753118963
zName = iCol>=0 ? pTab->aCol[iCol].zName : "rowid";
118754118964
}else if( pColExpr->op==TK_ID ){
118755118965
assert( !ExprHasProperty(pColExpr, EP_IntValue) );
118756118966
zName = pColExpr->u.zToken;
@@ -118757,11 +118967,15 @@
118757118967
}else{
118758118968
/* Use the original text of the column expression as its name */
118759118969
zName = pEList->a[i].zSpan;
118760118970
}
118761118971
}
118762
- zName = sqlite3MPrintf(db, "%s", zName);
118972
+ if( zName ){
118973
+ zName = sqlite3DbStrDup(db, zName);
118974
+ }else{
118975
+ zName = sqlite3MPrintf(db,"column%d",i+1);
118976
+ }
118763118977
118764118978
/* Make sure the column name is unique. If the name is not unique,
118765118979
** append an integer to the name so that it becomes unique.
118766118980
*/
118767118981
cnt = 0;
@@ -122070,10 +122284,92 @@
122070122284
return pItem;
122071122285
}
122072122286
return 0;
122073122287
}
122074122288
122289
+#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
122290
+/*
122291
+** Attempt to transform a query of the form
122292
+**
122293
+** SELECT count(*) FROM (SELECT x FROM t1 UNION ALL SELECT y FROM t2)
122294
+**
122295
+** Into this:
122296
+**
122297
+** SELECT (SELECT count(*) FROM t1)+(SELECT count(*) FROM t2)
122298
+**
122299
+** The transformation only works if all of the following are true:
122300
+**
122301
+** * The subquery is a UNION ALL of two or more terms
122302
+** * There is no WHERE or GROUP BY or HAVING clauses on the subqueries
122303
+** * The outer query is a simple count(*)
122304
+**
122305
+** Return TRUE if the optimization is undertaken.
122306
+*/
122307
+static int countOfViewOptimization(Parse *pParse, Select *p){
122308
+ Select *pSub, *pPrior;
122309
+ Expr *pExpr;
122310
+ Expr *pCount;
122311
+ sqlite3 *db;
122312
+ if( (p->selFlags & SF_Aggregate)==0 ) return 0; /* This is an aggregate query */
122313
+ if( p->pEList->nExpr!=1 ) return 0; /* Single result column */
122314
+ pExpr = p->pEList->a[0].pExpr;
122315
+ if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */
122316
+ if( sqlite3_stricmp(pExpr->u.zToken,"count") ) return 0; /* Must be count() */
122317
+ if( pExpr->x.pList!=0 ) return 0; /* Must be count(*) */
122318
+ if( p->pSrc->nSrc!=1 ) return 0; /* One table in the FROM clause */
122319
+ pSub = p->pSrc->a[0].pSelect;
122320
+ if( pSub==0 ) return 0; /* The FROM is a subquery */
122321
+ if( pSub->pPrior==0 ) return 0; /* Must be a compound subquery */
122322
+ do{
122323
+ if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
122324
+ if( pSub->pWhere ) return 0; /* No WHERE clause */
122325
+ if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */
122326
+ pSub = pSub->pPrior; /* Repeat over compound terms */
122327
+ }while( pSub );
122328
+
122329
+ /* If we reach this point, that means it is OK to perform the transformation */
122330
+
122331
+ db = pParse->db;
122332
+ pCount = pExpr;
122333
+ pExpr = 0;
122334
+ pSub = p->pSrc->a[0].pSelect;
122335
+ p->pSrc->a[0].pSelect = 0;
122336
+ sqlite3SrcListDelete(db, p->pSrc);
122337
+ p->pSrc = sqlite3DbMallocZero(pParse->db, sizeof(*p->pSrc));
122338
+ while( pSub ){
122339
+ Expr *pTerm;
122340
+ pPrior = pSub->pPrior;
122341
+ pSub->pPrior = 0;
122342
+ pSub->pNext = 0;
122343
+ pSub->selFlags |= SF_Aggregate;
122344
+ pSub->selFlags &= ~SF_Compound;
122345
+ pSub->nSelectRow = 0;
122346
+ sqlite3ExprListDelete(db, pSub->pEList);
122347
+ pTerm = pPrior ? sqlite3ExprDup(db, pCount, 0) : pCount;
122348
+ pSub->pEList = sqlite3ExprListAppend(pParse, 0, pTerm);
122349
+ pTerm = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
122350
+ sqlite3PExprAddSelect(pParse, pTerm, pSub);
122351
+ if( pExpr==0 ){
122352
+ pExpr = pTerm;
122353
+ }else{
122354
+ pExpr = sqlite3PExpr(pParse, TK_PLUS, pTerm, pExpr);
122355
+ }
122356
+ pSub = pPrior;
122357
+ }
122358
+ p->pEList->a[0].pExpr = pExpr;
122359
+ p->selFlags &= ~SF_Aggregate;
122360
+
122361
+#if SELECTTRACE_ENABLED
122362
+ if( sqlite3SelectTrace & 0x400 ){
122363
+ SELECTTRACE(0x400,pParse,p,("After count-of-view optimization:\n"));
122364
+ sqlite3TreeViewSelect(0, p, 0);
122365
+ }
122366
+#endif
122367
+ return 1;
122368
+}
122369
+#endif /* SQLITE_COUNTOFVIEW_OPTIMIZATION */
122370
+
122075122371
/*
122076122372
** Generate code for the SELECT statement given in the p argument.
122077122373
**
122078122374
** The results are returned according to the SelectDest structure.
122079122375
** See comments in sqliteInt.h for further information.
@@ -122381,10 +122677,20 @@
122381122677
if( sqlite3SelectTrace & 0x400 ){
122382122678
SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n"));
122383122679
sqlite3TreeViewSelect(0, p, 0);
122384122680
}
122385122681
#endif
122682
+
122683
+#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
122684
+ if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView)
122685
+ && countOfViewOptimization(pParse, p)
122686
+ ){
122687
+ if( db->mallocFailed ) goto select_end;
122688
+ pEList = p->pEList;
122689
+ pTabList = p->pSrc;
122690
+ }
122691
+#endif
122386122692
122387122693
/* If the query is DISTINCT with an ORDER BY but is not an aggregate, and
122388122694
** if the select-list is the same as the ORDER BY list, then this query
122389122695
** can be rewritten as a GROUP BY. In other words, this:
122390122696
**
@@ -127095,10 +127401,11 @@
127095127401
#endif
127096127402
#define TERM_LIKEOPT 0x100 /* Virtual terms from the LIKE optimization */
127097127403
#define TERM_LIKECOND 0x200 /* Conditionally this LIKE operator term */
127098127404
#define TERM_LIKE 0x400 /* The original LIKE operator */
127099127405
#define TERM_IS 0x800 /* Term.pExpr is an IS operator */
127406
+#define TERM_VARSELECT 0x1000 /* Term.pExpr contains a correlated sub-query */
127100127407
127101127408
/*
127102127409
** An instance of the WhereScan object is used as an iterator for locating
127103127410
** terms in the WHERE clause that are useful to the query planner.
127104127411
*/
@@ -127184,10 +127491,11 @@
127184127491
** does not really matter. What is important is that sparse cursor
127185127492
** numbers all get mapped into bit numbers that begin with 0 and contain
127186127493
** no gaps.
127187127494
*/
127188127495
struct WhereMaskSet {
127496
+ int bVarSelect; /* Used by sqlite3WhereExprUsage() */
127189127497
int n; /* Number of assigned cursor values */
127190127498
int ix[BMS]; /* Cursor assigned to each bit */
127191127499
};
127192127500
127193127501
/*
@@ -128481,11 +128789,11 @@
128481128789
int addrHalt; /* addrBrk for the outermost loop */
128482128790
int addrCont; /* Jump here to continue with next cycle */
128483128791
int iRowidReg = 0; /* Rowid is stored in this register, if not zero */
128484128792
int iReleaseReg = 0; /* Temp register to free before returning */
128485128793
Index *pIdx = 0; /* Index used by loop (if any) */
128486
- int loopAgain; /* True if constraint generator loop should repeat */
128794
+ int iLoop; /* Iteration of constraint generator loop */
128487128795
128488128796
pParse = pWInfo->pParse;
128489128797
v = pParse->pVdbe;
128490128798
pWC = &pWInfo->sWC;
128491128799
db = pParse->db;
@@ -129376,17 +129684,24 @@
129376129684
#endif
129377129685
129378129686
/* Insert code to test every subexpression that can be completely
129379129687
** computed using the current set of tables.
129380129688
**
129381
- ** This loop may run either once (pIdx==0) or twice (pIdx!=0). If
129382
- ** it is run twice, then the first iteration codes those sub-expressions
129383
- ** that can be computed using columns from pIdx only (without seeking
129384
- ** the main table cursor).
129689
+ ** This loop may run between one and three times, depending on the
129690
+ ** constraints to be generated. The value of stack variable iLoop
129691
+ ** determines the constraints coded by each iteration, as follows:
129692
+ **
129693
+ ** iLoop==1: Code only expressions that are entirely covered by pIdx.
129694
+ ** iLoop==2: Code remaining expressions that do not contain correlated
129695
+ ** sub-queries.
129696
+ ** iLoop==3: Code all remaining expressions.
129697
+ **
129698
+ ** An effort is made to skip unnecessary iterations of the loop.
129385129699
*/
129700
+ iLoop = (pIdx ? 1 : 2);
129386129701
do{
129387
- loopAgain = 0;
129702
+ int iNext = 0; /* Next value for iLoop */
129388129703
for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
129389129704
Expr *pE;
129390129705
int skipLikeAddr = 0;
129391129706
testcase( pTerm->wtFlags & TERM_VIRTUAL );
129392129707
testcase( pTerm->wtFlags & TERM_CODED );
@@ -129400,14 +129715,20 @@
129400129715
pE = pTerm->pExpr;
129401129716
assert( pE!=0 );
129402129717
if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){
129403129718
continue;
129404129719
}
129405
- if( pIdx && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){
129406
- loopAgain = 1;
129720
+
129721
+ if( iLoop==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){
129722
+ iNext = 2;
129723
+ continue;
129724
+ }
129725
+ if( iLoop<3 && (pTerm->wtFlags & TERM_VARSELECT) ){
129726
+ if( iNext==0 ) iNext = 3;
129407129727
continue;
129408129728
}
129729
+
129409129730
if( pTerm->wtFlags & TERM_LIKECOND ){
129410129731
/* If the TERM_LIKECOND flag is set, that means that the range search
129411129732
** is sufficient to guarantee that the LIKE operator is true, so we
129412129733
** can skip the call to the like(A,B) function. But this only works
129413129734
** for strings. So do not skip the call to the function on the pass
@@ -129419,16 +129740,22 @@
129419129740
assert( x>0 );
129420129741
skipLikeAddr = sqlite3VdbeAddOp1(v, (x&1)?OP_IfNot:OP_If, (int)(x>>1));
129421129742
VdbeCoverage(v);
129422129743
#endif
129423129744
}
129745
+#ifdef WHERETRACE_ENABLED /* 0xffff */
129746
+ if( sqlite3WhereTrace ){
129747
+ VdbeNoopComment((v, "WhereTerm[%d] (%p) priority=%d",
129748
+ pWC->nTerm-j, pTerm, iLoop));
129749
+ }
129750
+#endif
129424129751
sqlite3ExprIfFalse(pParse, pE, addrCont, SQLITE_JUMPIFNULL);
129425129752
if( skipLikeAddr ) sqlite3VdbeJumpHere(v, skipLikeAddr);
129426129753
pTerm->wtFlags |= TERM_CODED;
129427129754
}
129428
- pIdx = 0;
129429
- }while( loopAgain );
129755
+ iLoop = iNext;
129756
+ }while( iLoop>0 );
129430129757
129431129758
/* Insert code to test for implied constraints based on transitivity
129432129759
** of the "==" operator.
129433129760
**
129434129761
** Example: If the WHERE clause contains "t1.a=t2.b" and "t2.b=123"
@@ -130438,11 +130765,13 @@
130438130765
}else if( op==TK_ISNULL ){
130439130766
pTerm->prereqRight = 0;
130440130767
}else{
130441130768
pTerm->prereqRight = sqlite3WhereExprUsage(pMaskSet, pExpr->pRight);
130442130769
}
130770
+ pMaskSet->bVarSelect = 0;
130443130771
prereqAll = sqlite3WhereExprUsage(pMaskSet, pExpr);
130772
+ if( pMaskSet->bVarSelect ) pTerm->wtFlags |= TERM_VARSELECT;
130444130773
if( ExprHasProperty(pExpr, EP_FromJoin) ){
130445130774
Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->iRightJoinTable);
130446130775
prereqAll |= x;
130447130776
extraRight = x-1; /* ON clause terms may not be used with an index
130448130777
** on left table of a LEFT JOIN. Ticket #3015 */
@@ -130869,13 +131198,16 @@
130869131198
if( p->op==TK_COLUMN ){
130870131199
return sqlite3WhereGetMask(pMaskSet, p->iTable);
130871131200
}
130872131201
mask = (p->op==TK_IF_NULL_ROW) ? sqlite3WhereGetMask(pMaskSet, p->iTable) : 0;
130873131202
assert( !ExprHasProperty(p, EP_TokenOnly) );
130874
- if( p->pRight ) mask |= sqlite3WhereExprUsage(pMaskSet, p->pRight);
130875131203
if( p->pLeft ) mask |= sqlite3WhereExprUsage(pMaskSet, p->pLeft);
130876
- if( ExprHasProperty(p, EP_xIsSelect) ){
131204
+ if( p->pRight ){
131205
+ mask |= sqlite3WhereExprUsage(pMaskSet, p->pRight);
131206
+ assert( p->x.pList==0 );
131207
+ }else if( ExprHasProperty(p, EP_xIsSelect) ){
131208
+ if( ExprHasProperty(p, EP_VarSelect) ) pMaskSet->bVarSelect = 1;
130877131209
mask |= exprSelectUsage(pMaskSet, p->x.pSelect);
130878131210
}else if( p->x.pList ){
130879131211
mask |= sqlite3WhereExprListUsage(pMaskSet, p->x.pList);
130880131212
}
130881131213
return mask;
@@ -135501,13 +135833,17 @@
135501135833
for(ii=0; ii<pTabList->nSrc; ii++){
135502135834
createMask(pMaskSet, pTabList->a[ii].iCursor);
135503135835
sqlite3WhereTabFuncArgs(pParse, &pTabList->a[ii], &pWInfo->sWC);
135504135836
}
135505135837
#ifdef SQLITE_DEBUG
135506
- for(ii=0; ii<pTabList->nSrc; ii++){
135507
- Bitmask m = sqlite3WhereGetMask(pMaskSet, pTabList->a[ii].iCursor);
135508
- assert( m==MASKBIT(ii) );
135838
+ {
135839
+ Bitmask mx = 0;
135840
+ for(ii=0; ii<pTabList->nSrc; ii++){
135841
+ Bitmask m = sqlite3WhereGetMask(pMaskSet, pTabList->a[ii].iCursor);
135842
+ assert( m>=mx );
135843
+ mx = m;
135844
+ }
135509135845
}
135510135846
#endif
135511135847
135512135848
/* Analyze all of the subexpressions. */
135513135849
sqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC);
@@ -136348,20 +136684,20 @@
136348136684
#define sqlite3ParserARG_SDECL Parse *pParse;
136349136685
#define sqlite3ParserARG_PDECL ,Parse *pParse
136350136686
#define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse
136351136687
#define sqlite3ParserARG_STORE yypParser->pParse = pParse
136352136688
#define YYFALLBACK 1
136353
-#define YYNSTATE 456
136354
-#define YYNRULE 331
136355
-#define YY_MAX_SHIFT 455
136356
-#define YY_MIN_SHIFTREDUCE 667
136357
-#define YY_MAX_SHIFTREDUCE 997
136358
-#define YY_MIN_REDUCE 998
136359
-#define YY_MAX_REDUCE 1328
136360
-#define YY_ERROR_ACTION 1329
136361
-#define YY_ACCEPT_ACTION 1330
136362
-#define YY_NO_ACTION 1331
136689
+#define YYNSTATE 455
136690
+#define YYNRULE 329
136691
+#define YY_MAX_SHIFT 454
136692
+#define YY_MIN_SHIFTREDUCE 664
136693
+#define YY_MAX_SHIFTREDUCE 992
136694
+#define YY_MIN_REDUCE 993
136695
+#define YY_MAX_REDUCE 1321
136696
+#define YY_ERROR_ACTION 1322
136697
+#define YY_ACCEPT_ACTION 1323
136698
+#define YY_NO_ACTION 1324
136363136699
/************* End control #defines *******************************************/
136364136700
136365136701
/* Define the yytestcase() macro to be a no-op if is not already defined
136366136702
** otherwise.
136367136703
**
@@ -136429,169 +136765,169 @@
136429136765
** yy_reduce_ofst[] For each state, the offset into yy_action for
136430136766
** shifting non-terminals after a reduce.
136431136767
** yy_default[] Default action for each state.
136432136768
**
136433136769
*********** Begin parsing tables **********************************************/
136434
-#define YY_ACTTAB_COUNT (1566)
136770
+#define YY_ACTTAB_COUNT (1565)
136435136771
static const YYACTIONTYPE yy_action[] = {
136436
- /* 0 */ 325, 411, 343, 751, 751, 203, 944, 354, 974, 98,
136772
+ /* 0 */ 324, 410, 342, 747, 747, 203, 939, 353, 969, 98,
136437136773
/* 10 */ 98, 98, 98, 91, 96, 96, 96, 96, 95, 95,
136438
- /* 20 */ 94, 94, 94, 93, 351, 1330, 155, 155, 2, 812,
136439
- /* 30 */ 976, 976, 98, 98, 98, 98, 20, 96, 96, 96,
136440
- /* 40 */ 96, 95, 95, 94, 94, 94, 93, 351, 92, 89,
136441
- /* 50 */ 178, 99, 100, 90, 852, 855, 844, 844, 97, 97,
136442
- /* 60 */ 98, 98, 98, 98, 351, 96, 96, 96, 96, 95,
136443
- /* 70 */ 95, 94, 94, 94, 93, 351, 325, 340, 974, 262,
136444
- /* 80 */ 365, 251, 212, 169, 287, 405, 282, 404, 199, 790,
136445
- /* 90 */ 242, 412, 21, 955, 379, 280, 93, 351, 791, 95,
136446
- /* 100 */ 95, 94, 94, 94, 93, 351, 976, 976, 96, 96,
136447
- /* 110 */ 96, 96, 95, 95, 94, 94, 94, 93, 351, 812,
136448
- /* 120 */ 329, 242, 412, 1242, 831, 1242, 132, 99, 100, 90,
136449
- /* 130 */ 852, 855, 844, 844, 97, 97, 98, 98, 98, 98,
136450
- /* 140 */ 450, 96, 96, 96, 96, 95, 95, 94, 94, 94,
136451
- /* 150 */ 93, 351, 325, 824, 349, 348, 120, 818, 120, 75,
136452
- /* 160 */ 52, 52, 955, 956, 957, 1090, 982, 146, 361, 262,
136453
- /* 170 */ 370, 261, 955, 980, 959, 981, 92, 89, 178, 371,
136454
- /* 180 */ 230, 371, 976, 976, 1147, 361, 360, 101, 823, 823,
136455
- /* 190 */ 825, 384, 24, 1293, 381, 428, 413, 369, 983, 380,
136456
- /* 200 */ 983, 1038, 325, 99, 100, 90, 852, 855, 844, 844,
136457
- /* 210 */ 97, 97, 98, 98, 98, 98, 373, 96, 96, 96,
136458
- /* 220 */ 96, 95, 95, 94, 94, 94, 93, 351, 955, 132,
136459
- /* 230 */ 895, 450, 976, 976, 895, 60, 94, 94, 94, 93,
136460
- /* 240 */ 351, 955, 956, 957, 959, 103, 361, 955, 385, 334,
136461
- /* 250 */ 701, 52, 52, 99, 100, 90, 852, 855, 844, 844,
136462
- /* 260 */ 97, 97, 98, 98, 98, 98, 1028, 96, 96, 96,
136463
- /* 270 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 455,
136464
- /* 280 */ 1000, 450, 227, 61, 157, 243, 344, 114, 1031, 1218,
136465
- /* 290 */ 147, 831, 955, 373, 1077, 955, 320, 955, 956, 957,
136466
- /* 300 */ 194, 10, 10, 402, 399, 398, 1218, 1220, 976, 976,
136467
- /* 310 */ 761, 171, 170, 157, 397, 337, 955, 956, 957, 701,
136468
- /* 320 */ 824, 310, 153, 955, 818, 321, 82, 23, 80, 99,
136469
- /* 330 */ 100, 90, 852, 855, 844, 844, 97, 97, 98, 98,
136470
- /* 340 */ 98, 98, 893, 96, 96, 96, 96, 95, 95, 94,
136471
- /* 350 */ 94, 94, 93, 351, 325, 823, 823, 825, 277, 231,
136472
- /* 360 */ 300, 955, 956, 957, 955, 956, 957, 1218, 194, 25,
136473
- /* 370 */ 450, 402, 399, 398, 955, 355, 300, 450, 955, 74,
136474
- /* 380 */ 450, 1, 397, 132, 976, 976, 955, 224, 224, 812,
136475
- /* 390 */ 10, 10, 955, 956, 957, 1297, 132, 52, 52, 415,
136476
- /* 400 */ 52, 52, 1069, 1069, 339, 99, 100, 90, 852, 855,
136477
- /* 410 */ 844, 844, 97, 97, 98, 98, 98, 98, 1120, 96,
136478
- /* 420 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351,
136479
- /* 430 */ 325, 1119, 428, 418, 705, 428, 427, 1267, 1267, 262,
136480
- /* 440 */ 370, 261, 955, 955, 956, 957, 756, 955, 956, 957,
136481
- /* 450 */ 450, 755, 450, 1064, 1043, 955, 956, 957, 443, 710,
136482
- /* 460 */ 976, 976, 1064, 394, 92, 89, 178, 447, 447, 447,
136483
- /* 470 */ 51, 51, 52, 52, 439, 777, 1030, 92, 89, 178,
136484
- /* 480 */ 172, 99, 100, 90, 852, 855, 844, 844, 97, 97,
136774
+ /* 20 */ 94, 94, 94, 93, 350, 1323, 155, 155, 2, 808,
136775
+ /* 30 */ 971, 971, 98, 98, 98, 98, 20, 96, 96, 96,
136776
+ /* 40 */ 96, 95, 95, 94, 94, 94, 93, 350, 92, 89,
136777
+ /* 50 */ 178, 99, 100, 90, 847, 850, 839, 839, 97, 97,
136778
+ /* 60 */ 98, 98, 98, 98, 350, 96, 96, 96, 96, 95,
136779
+ /* 70 */ 95, 94, 94, 94, 93, 350, 324, 339, 969, 262,
136780
+ /* 80 */ 364, 251, 212, 169, 287, 404, 282, 403, 199, 786,
136781
+ /* 90 */ 242, 411, 21, 950, 378, 280, 93, 350, 787, 95,
136782
+ /* 100 */ 95, 94, 94, 94, 93, 350, 971, 971, 96, 96,
136783
+ /* 110 */ 96, 96, 95, 95, 94, 94, 94, 93, 350, 808,
136784
+ /* 120 */ 328, 242, 411, 1235, 826, 1235, 132, 99, 100, 90,
136785
+ /* 130 */ 847, 850, 839, 839, 97, 97, 98, 98, 98, 98,
136786
+ /* 140 */ 449, 96, 96, 96, 96, 95, 95, 94, 94, 94,
136787
+ /* 150 */ 93, 350, 324, 819, 348, 347, 120, 818, 120, 75,
136788
+ /* 160 */ 52, 52, 950, 951, 952, 1084, 977, 146, 360, 262,
136789
+ /* 170 */ 369, 261, 950, 975, 954, 976, 92, 89, 178, 370,
136790
+ /* 180 */ 230, 370, 971, 971, 1141, 360, 359, 101, 818, 818,
136791
+ /* 190 */ 820, 383, 24, 1286, 380, 427, 412, 368, 978, 379,
136792
+ /* 200 */ 978, 1032, 324, 99, 100, 90, 847, 850, 839, 839,
136793
+ /* 210 */ 97, 97, 98, 98, 98, 98, 372, 96, 96, 96,
136794
+ /* 220 */ 96, 95, 95, 94, 94, 94, 93, 350, 950, 132,
136795
+ /* 230 */ 890, 449, 971, 971, 890, 60, 94, 94, 94, 93,
136796
+ /* 240 */ 350, 950, 951, 952, 954, 103, 360, 950, 384, 333,
136797
+ /* 250 */ 697, 52, 52, 99, 100, 90, 847, 850, 839, 839,
136798
+ /* 260 */ 97, 97, 98, 98, 98, 98, 1022, 96, 96, 96,
136799
+ /* 270 */ 96, 95, 95, 94, 94, 94, 93, 350, 324, 454,
136800
+ /* 280 */ 995, 449, 227, 61, 157, 243, 343, 114, 1025, 1211,
136801
+ /* 290 */ 147, 826, 950, 372, 1071, 950, 319, 950, 951, 952,
136802
+ /* 300 */ 194, 10, 10, 401, 398, 397, 1211, 1213, 971, 971,
136803
+ /* 310 */ 757, 171, 170, 157, 396, 336, 950, 951, 952, 697,
136804
+ /* 320 */ 819, 310, 153, 950, 818, 320, 82, 23, 80, 99,
136805
+ /* 330 */ 100, 90, 847, 850, 839, 839, 97, 97, 98, 98,
136806
+ /* 340 */ 98, 98, 888, 96, 96, 96, 96, 95, 95, 94,
136807
+ /* 350 */ 94, 94, 93, 350, 324, 818, 818, 820, 277, 231,
136808
+ /* 360 */ 300, 950, 951, 952, 950, 951, 952, 1211, 194, 25,
136809
+ /* 370 */ 449, 401, 398, 397, 950, 354, 300, 449, 950, 74,
136810
+ /* 380 */ 449, 1, 396, 132, 971, 971, 950, 224, 224, 808,
136811
+ /* 390 */ 10, 10, 950, 951, 952, 1290, 132, 52, 52, 414,
136812
+ /* 400 */ 52, 52, 1063, 1063, 338, 99, 100, 90, 847, 850,
136813
+ /* 410 */ 839, 839, 97, 97, 98, 98, 98, 98, 1114, 96,
136814
+ /* 420 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 350,
136815
+ /* 430 */ 324, 1113, 427, 417, 701, 427, 426, 1260, 1260, 262,
136816
+ /* 440 */ 369, 261, 950, 950, 951, 952, 752, 950, 951, 952,
136817
+ /* 450 */ 449, 751, 449, 1058, 1037, 950, 951, 952, 442, 706,
136818
+ /* 460 */ 971, 971, 1058, 393, 92, 89, 178, 446, 446, 446,
136819
+ /* 470 */ 51, 51, 52, 52, 438, 773, 1024, 92, 89, 178,
136820
+ /* 480 */ 172, 99, 100, 90, 847, 850, 839, 839, 97, 97,
136485136821
/* 490 */ 98, 98, 98, 98, 198, 96, 96, 96, 96, 95,
136486
- /* 500 */ 95, 94, 94, 94, 93, 351, 325, 428, 408, 914,
136487
- /* 510 */ 698, 955, 956, 957, 92, 89, 178, 224, 224, 157,
136488
- /* 520 */ 241, 221, 419, 299, 775, 915, 416, 375, 450, 415,
136489
- /* 530 */ 58, 324, 1067, 1067, 1249, 379, 976, 976, 379, 776,
136490
- /* 540 */ 449, 916, 363, 739, 296, 685, 9, 9, 52, 52,
136491
- /* 550 */ 234, 330, 234, 256, 417, 740, 280, 99, 100, 90,
136492
- /* 560 */ 852, 855, 844, 844, 97, 97, 98, 98, 98, 98,
136493
- /* 570 */ 450, 96, 96, 96, 96, 95, 95, 94, 94, 94,
136494
- /* 580 */ 93, 351, 325, 423, 72, 450, 832, 120, 368, 450,
136495
- /* 590 */ 10, 10, 5, 301, 203, 450, 177, 974, 253, 420,
136496
- /* 600 */ 255, 775, 200, 175, 233, 10, 10, 841, 841, 36,
136497
- /* 610 */ 36, 1296, 976, 976, 728, 37, 37, 349, 348, 425,
136498
- /* 620 */ 203, 260, 775, 974, 232, 935, 1323, 875, 338, 1323,
136499
- /* 630 */ 422, 853, 856, 99, 100, 90, 852, 855, 844, 844,
136822
+ /* 500 */ 95, 94, 94, 94, 93, 350, 324, 427, 407, 909,
136823
+ /* 510 */ 694, 950, 951, 952, 92, 89, 178, 224, 224, 157,
136824
+ /* 520 */ 241, 221, 418, 299, 771, 910, 415, 374, 449, 414,
136825
+ /* 530 */ 58, 323, 1061, 1061, 1242, 378, 971, 971, 378, 772,
136826
+ /* 540 */ 448, 911, 362, 735, 296, 681, 9, 9, 52, 52,
136827
+ /* 550 */ 234, 329, 234, 256, 416, 736, 280, 99, 100, 90,
136828
+ /* 560 */ 847, 850, 839, 839, 97, 97, 98, 98, 98, 98,
136829
+ /* 570 */ 449, 96, 96, 96, 96, 95, 95, 94, 94, 94,
136830
+ /* 580 */ 93, 350, 324, 422, 72, 449, 827, 120, 367, 449,
136831
+ /* 590 */ 10, 10, 5, 301, 203, 449, 177, 969, 253, 419,
136832
+ /* 600 */ 255, 771, 200, 175, 233, 10, 10, 836, 836, 36,
136833
+ /* 610 */ 36, 1289, 971, 971, 724, 37, 37, 348, 347, 424,
136834
+ /* 620 */ 203, 260, 771, 969, 232, 930, 1316, 870, 337, 1316,
136835
+ /* 630 */ 421, 848, 851, 99, 100, 90, 847, 850, 839, 839,
136500136836
/* 640 */ 97, 97, 98, 98, 98, 98, 268, 96, 96, 96,
136501
- /* 650 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 845,
136502
- /* 660 */ 450, 983, 817, 983, 1207, 450, 914, 974, 719, 350,
136503
- /* 670 */ 350, 350, 933, 177, 450, 935, 1324, 254, 198, 1324,
136504
- /* 680 */ 12, 12, 915, 403, 450, 27, 27, 250, 976, 976,
136505
- /* 690 */ 118, 720, 162, 974, 38, 38, 268, 176, 916, 775,
136506
- /* 700 */ 433, 1272, 944, 354, 39, 39, 317, 996, 325, 99,
136507
- /* 710 */ 100, 90, 852, 855, 844, 844, 97, 97, 98, 98,
136508
- /* 720 */ 98, 98, 933, 96, 96, 96, 96, 95, 95, 94,
136509
- /* 730 */ 94, 94, 93, 351, 450, 330, 450, 358, 976, 976,
136510
- /* 740 */ 1047, 317, 934, 341, 898, 898, 387, 672, 673, 674,
136511
- /* 750 */ 275, 1325, 318, 997, 40, 40, 41, 41, 268, 99,
136512
- /* 760 */ 100, 90, 852, 855, 844, 844, 97, 97, 98, 98,
136513
- /* 770 */ 98, 98, 450, 96, 96, 96, 96, 95, 95, 94,
136514
- /* 780 */ 94, 94, 93, 351, 325, 450, 356, 450, 997, 450,
136515
- /* 790 */ 1022, 331, 42, 42, 790, 270, 450, 273, 450, 228,
136516
- /* 800 */ 450, 298, 450, 791, 450, 28, 28, 29, 29, 31,
136517
- /* 810 */ 31, 450, 1147, 450, 976, 976, 43, 43, 44, 44,
136518
- /* 820 */ 45, 45, 11, 11, 46, 46, 892, 78, 892, 268,
136519
- /* 830 */ 268, 105, 105, 47, 47, 99, 100, 90, 852, 855,
136520
- /* 840 */ 844, 844, 97, 97, 98, 98, 98, 98, 450, 96,
136521
- /* 850 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351,
136522
- /* 860 */ 325, 450, 117, 450, 1079, 158, 450, 695, 48, 48,
136523
- /* 870 */ 229, 1248, 450, 1257, 450, 415, 450, 335, 450, 245,
136524
- /* 880 */ 450, 33, 33, 49, 49, 450, 50, 50, 246, 1147,
136525
- /* 890 */ 976, 976, 34, 34, 122, 122, 123, 123, 124, 124,
136837
+ /* 650 */ 96, 95, 95, 94, 94, 94, 93, 350, 324, 840,
136838
+ /* 660 */ 449, 978, 813, 978, 1200, 449, 909, 969, 715, 349,
136839
+ /* 670 */ 349, 349, 928, 177, 449, 930, 1317, 254, 198, 1317,
136840
+ /* 680 */ 12, 12, 910, 402, 449, 27, 27, 250, 971, 971,
136841
+ /* 690 */ 118, 716, 162, 969, 38, 38, 268, 176, 911, 771,
136842
+ /* 700 */ 432, 1265, 939, 353, 39, 39, 316, 991, 324, 99,
136843
+ /* 710 */ 100, 90, 847, 850, 839, 839, 97, 97, 98, 98,
136844
+ /* 720 */ 98, 98, 928, 96, 96, 96, 96, 95, 95, 94,
136845
+ /* 730 */ 94, 94, 93, 350, 449, 329, 449, 357, 971, 971,
136846
+ /* 740 */ 1041, 316, 929, 340, 893, 893, 386, 669, 670, 671,
136847
+ /* 750 */ 275, 1318, 317, 992, 40, 40, 41, 41, 268, 99,
136848
+ /* 760 */ 100, 90, 847, 850, 839, 839, 97, 97, 98, 98,
136849
+ /* 770 */ 98, 98, 449, 96, 96, 96, 96, 95, 95, 94,
136850
+ /* 780 */ 94, 94, 93, 350, 324, 449, 355, 449, 992, 449,
136851
+ /* 790 */ 1016, 330, 42, 42, 786, 270, 449, 273, 449, 228,
136852
+ /* 800 */ 449, 298, 449, 787, 449, 28, 28, 29, 29, 31,
136853
+ /* 810 */ 31, 449, 1141, 449, 971, 971, 43, 43, 44, 44,
136854
+ /* 820 */ 45, 45, 11, 11, 46, 46, 887, 78, 887, 268,
136855
+ /* 830 */ 268, 105, 105, 47, 47, 99, 100, 90, 847, 850,
136856
+ /* 840 */ 839, 839, 97, 97, 98, 98, 98, 98, 449, 96,
136857
+ /* 850 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 350,
136858
+ /* 860 */ 324, 449, 117, 449, 1073, 158, 449, 691, 48, 48,
136859
+ /* 870 */ 229, 1241, 449, 1250, 449, 414, 449, 334, 449, 245,
136860
+ /* 880 */ 449, 33, 33, 49, 49, 449, 50, 50, 246, 1141,
136861
+ /* 890 */ 971, 971, 34, 34, 122, 122, 123, 123, 124, 124,
136526136862
/* 900 */ 56, 56, 268, 81, 249, 35, 35, 197, 196, 195,
136527
- /* 910 */ 325, 99, 100, 90, 852, 855, 844, 844, 97, 97,
136528
- /* 920 */ 98, 98, 98, 98, 450, 96, 96, 96, 96, 95,
136529
- /* 930 */ 95, 94, 94, 94, 93, 351, 450, 695, 450, 1147,
136530
- /* 940 */ 976, 976, 973, 1214, 106, 106, 268, 1216, 268, 1273,
136531
- /* 950 */ 2, 891, 268, 891, 336, 1046, 53, 53, 107, 107,
136532
- /* 960 */ 325, 99, 100, 90, 852, 855, 844, 844, 97, 97,
136533
- /* 970 */ 98, 98, 98, 98, 450, 96, 96, 96, 96, 95,
136534
- /* 980 */ 95, 94, 94, 94, 93, 351, 450, 1076, 450, 1072,
136535
- /* 990 */ 976, 976, 1045, 267, 108, 108, 446, 331, 332, 133,
136536
- /* 1000 */ 223, 175, 301, 225, 386, 1262, 104, 104, 121, 121,
136537
- /* 1010 */ 325, 99, 88, 90, 852, 855, 844, 844, 97, 97,
136538
- /* 1020 */ 98, 98, 98, 98, 1147, 96, 96, 96, 96, 95,
136539
- /* 1030 */ 95, 94, 94, 94, 93, 351, 450, 347, 450, 167,
136540
- /* 1040 */ 976, 976, 930, 814, 372, 319, 202, 202, 374, 263,
136541
- /* 1050 */ 395, 202, 74, 208, 725, 726, 119, 119, 112, 112,
136542
- /* 1060 */ 325, 407, 100, 90, 852, 855, 844, 844, 97, 97,
136543
- /* 1070 */ 98, 98, 98, 98, 450, 96, 96, 96, 96, 95,
136544
- /* 1080 */ 95, 94, 94, 94, 93, 351, 450, 756, 450, 345,
136545
- /* 1090 */ 976, 976, 755, 278, 111, 111, 74, 718, 717, 708,
136546
- /* 1100 */ 286, 882, 753, 1286, 257, 77, 109, 109, 110, 110,
136547
- /* 1110 */ 1237, 285, 1140, 90, 852, 855, 844, 844, 97, 97,
136548
- /* 1120 */ 98, 98, 98, 98, 1240, 96, 96, 96, 96, 95,
136549
- /* 1130 */ 95, 94, 94, 94, 93, 351, 86, 445, 450, 3,
136550
- /* 1140 */ 1200, 450, 1075, 132, 352, 120, 1019, 86, 445, 784,
136551
- /* 1150 */ 3, 1097, 202, 377, 448, 352, 1236, 120, 55, 55,
136552
- /* 1160 */ 450, 57, 57, 827, 878, 448, 450, 208, 450, 708,
136553
- /* 1170 */ 450, 882, 237, 434, 436, 120, 440, 429, 362, 120,
136554
- /* 1180 */ 54, 54, 132, 450, 434, 831, 52, 52, 26, 26,
136555
- /* 1190 */ 30, 30, 382, 132, 409, 444, 831, 693, 264, 390,
136863
+ /* 910 */ 324, 99, 100, 90, 847, 850, 839, 839, 97, 97,
136864
+ /* 920 */ 98, 98, 98, 98, 449, 96, 96, 96, 96, 95,
136865
+ /* 930 */ 95, 94, 94, 94, 93, 350, 449, 691, 449, 1141,
136866
+ /* 940 */ 971, 971, 968, 1207, 106, 106, 268, 1209, 268, 1266,
136867
+ /* 950 */ 2, 886, 268, 886, 335, 1040, 53, 53, 107, 107,
136868
+ /* 960 */ 324, 99, 100, 90, 847, 850, 839, 839, 97, 97,
136869
+ /* 970 */ 98, 98, 98, 98, 449, 96, 96, 96, 96, 95,
136870
+ /* 980 */ 95, 94, 94, 94, 93, 350, 449, 1070, 449, 1066,
136871
+ /* 990 */ 971, 971, 1039, 267, 108, 108, 445, 330, 331, 133,
136872
+ /* 1000 */ 223, 175, 301, 225, 385, 1255, 104, 104, 121, 121,
136873
+ /* 1010 */ 324, 99, 88, 90, 847, 850, 839, 839, 97, 97,
136874
+ /* 1020 */ 98, 98, 98, 98, 1141, 96, 96, 96, 96, 95,
136875
+ /* 1030 */ 95, 94, 94, 94, 93, 350, 449, 346, 449, 167,
136876
+ /* 1040 */ 971, 971, 925, 810, 371, 318, 202, 202, 373, 263,
136877
+ /* 1050 */ 394, 202, 74, 208, 721, 722, 119, 119, 112, 112,
136878
+ /* 1060 */ 324, 406, 100, 90, 847, 850, 839, 839, 97, 97,
136879
+ /* 1070 */ 98, 98, 98, 98, 449, 96, 96, 96, 96, 95,
136880
+ /* 1080 */ 95, 94, 94, 94, 93, 350, 449, 752, 449, 344,
136881
+ /* 1090 */ 971, 971, 751, 278, 111, 111, 74, 714, 713, 704,
136882
+ /* 1100 */ 286, 877, 749, 1279, 257, 77, 109, 109, 110, 110,
136883
+ /* 1110 */ 1230, 285, 1134, 90, 847, 850, 839, 839, 97, 97,
136884
+ /* 1120 */ 98, 98, 98, 98, 1233, 96, 96, 96, 96, 95,
136885
+ /* 1130 */ 95, 94, 94, 94, 93, 350, 86, 444, 449, 3,
136886
+ /* 1140 */ 1193, 449, 1069, 132, 351, 120, 1013, 86, 444, 780,
136887
+ /* 1150 */ 3, 1091, 202, 376, 447, 351, 1229, 120, 55, 55,
136888
+ /* 1160 */ 449, 57, 57, 822, 873, 447, 449, 208, 449, 704,
136889
+ /* 1170 */ 449, 877, 237, 433, 435, 120, 439, 428, 361, 120,
136890
+ /* 1180 */ 54, 54, 132, 449, 433, 826, 52, 52, 26, 26,
136891
+ /* 1190 */ 30, 30, 381, 132, 408, 443, 826, 689, 264, 389,
136556136892
/* 1200 */ 116, 269, 272, 32, 32, 83, 84, 120, 274, 120,
136557
- /* 1210 */ 120, 276, 85, 352, 452, 451, 83, 84, 818, 1060,
136558
- /* 1220 */ 1044, 428, 430, 85, 352, 452, 451, 120, 120, 818,
136559
- /* 1230 */ 378, 218, 281, 827, 1113, 1146, 86, 445, 410, 3,
136560
- /* 1240 */ 1093, 1104, 431, 432, 352, 302, 303, 1153, 1027, 823,
136561
- /* 1250 */ 823, 825, 826, 19, 448, 1021, 1010, 1009, 1011, 1280,
136562
- /* 1260 */ 823, 823, 825, 826, 19, 289, 159, 291, 293, 7,
136563
- /* 1270 */ 316, 173, 259, 434, 1135, 364, 252, 1239, 376, 1043,
136564
- /* 1280 */ 295, 435, 168, 991, 400, 831, 284, 1211, 1210, 205,
136565
- /* 1290 */ 1283, 308, 1256, 86, 445, 988, 3, 1254, 333, 144,
136566
- /* 1300 */ 130, 352, 72, 135, 59, 83, 84, 760, 137, 366,
136567
- /* 1310 */ 1132, 448, 85, 352, 452, 451, 139, 226, 818, 140,
136568
- /* 1320 */ 156, 62, 315, 314, 313, 215, 311, 367, 393, 682,
136569
- /* 1330 */ 434, 185, 141, 1241, 142, 160, 148, 1142, 1205, 383,
136570
- /* 1340 */ 189, 67, 831, 180, 389, 248, 1225, 1105, 219, 823,
136571
- /* 1350 */ 823, 825, 826, 19, 247, 190, 266, 154, 391, 271,
136572
- /* 1360 */ 191, 192, 83, 84, 1012, 406, 1063, 182, 322, 85,
136573
- /* 1370 */ 352, 452, 451, 1062, 183, 818, 342, 132, 181, 710,
136574
- /* 1380 */ 1061, 421, 76, 445, 1035, 3, 323, 1034, 283, 1054,
136575
- /* 1390 */ 352, 1101, 1033, 1295, 1053, 71, 204, 6, 288, 290,
136576
- /* 1400 */ 448, 1102, 1100, 1099, 79, 292, 823, 823, 825, 826,
136577
- /* 1410 */ 19, 294, 297, 438, 346, 442, 102, 1191, 1083, 434,
136578
- /* 1420 */ 238, 426, 73, 305, 239, 304, 326, 240, 424, 306,
136579
- /* 1430 */ 307, 831, 213, 1018, 22, 950, 453, 214, 216, 217,
136580
- /* 1440 */ 454, 1007, 115, 1006, 1001, 125, 126, 235, 127, 668,
136581
- /* 1450 */ 327, 83, 84, 359, 353, 244, 166, 328, 85, 352,
136582
- /* 1460 */ 452, 451, 134, 179, 818, 357, 113, 890, 810, 888,
136583
- /* 1470 */ 136, 128, 138, 742, 258, 184, 904, 143, 145, 63,
136584
- /* 1480 */ 64, 65, 66, 129, 907, 903, 187, 186, 8, 13,
136585
- /* 1490 */ 188, 265, 896, 149, 202, 823, 823, 825, 826, 19,
136586
- /* 1500 */ 388, 985, 150, 161, 285, 684, 392, 396, 151, 721,
136587
- /* 1510 */ 193, 68, 14, 401, 279, 15, 69, 236, 830, 829,
136588
- /* 1520 */ 131, 858, 750, 70, 16, 414, 754, 4, 783, 220,
136589
- /* 1530 */ 222, 174, 152, 437, 778, 201, 17, 77, 74, 18,
136590
- /* 1540 */ 873, 859, 857, 913, 862, 912, 207, 206, 939, 163,
136591
- /* 1550 */ 210, 940, 209, 164, 441, 861, 165, 211, 828, 694,
136592
- /* 1560 */ 87, 312, 309, 945, 1288, 1287,
136893
+ /* 1210 */ 120, 276, 85, 351, 451, 450, 83, 84, 818, 1054,
136894
+ /* 1220 */ 1038, 427, 429, 85, 351, 451, 450, 120, 120, 818,
136895
+ /* 1230 */ 377, 218, 281, 822, 1107, 1140, 86, 444, 409, 3,
136896
+ /* 1240 */ 1087, 1098, 430, 431, 351, 302, 303, 1146, 1021, 818,
136897
+ /* 1250 */ 818, 820, 821, 19, 447, 1015, 1004, 1003, 1005, 1273,
136898
+ /* 1260 */ 818, 818, 820, 821, 19, 289, 159, 291, 293, 7,
136899
+ /* 1270 */ 315, 173, 259, 433, 1129, 363, 252, 1232, 375, 1037,
136900
+ /* 1280 */ 295, 434, 168, 986, 399, 826, 284, 1204, 1203, 205,
136901
+ /* 1290 */ 1276, 308, 1249, 86, 444, 983, 3, 1247, 332, 144,
136902
+ /* 1300 */ 130, 351, 72, 135, 59, 83, 84, 756, 137, 365,
136903
+ /* 1310 */ 1126, 447, 85, 351, 451, 450, 139, 226, 818, 140,
136904
+ /* 1320 */ 156, 62, 314, 314, 313, 215, 311, 366, 392, 678,
136905
+ /* 1330 */ 433, 185, 141, 1234, 142, 160, 148, 1136, 1198, 382,
136906
+ /* 1340 */ 189, 67, 826, 180, 388, 248, 1218, 1099, 219, 818,
136907
+ /* 1350 */ 818, 820, 821, 19, 247, 190, 266, 154, 390, 271,
136908
+ /* 1360 */ 191, 192, 83, 84, 1006, 405, 1057, 182, 321, 85,
136909
+ /* 1370 */ 351, 451, 450, 1056, 183, 818, 341, 132, 181, 706,
136910
+ /* 1380 */ 1055, 420, 76, 444, 1029, 3, 322, 1028, 283, 1048,
136911
+ /* 1390 */ 351, 1095, 1027, 1288, 1047, 71, 204, 6, 288, 290,
136912
+ /* 1400 */ 447, 1096, 1094, 1093, 79, 292, 818, 818, 820, 821,
136913
+ /* 1410 */ 19, 294, 297, 437, 345, 441, 102, 1184, 1077, 433,
136914
+ /* 1420 */ 238, 425, 73, 305, 239, 304, 325, 240, 423, 306,
136915
+ /* 1430 */ 307, 826, 213, 1012, 22, 945, 452, 214, 216, 217,
136916
+ /* 1440 */ 453, 1001, 115, 996, 125, 126, 235, 127, 665, 352,
136917
+ /* 1450 */ 326, 83, 84, 358, 166, 244, 179, 327, 85, 351,
136918
+ /* 1460 */ 451, 450, 134, 356, 818, 113, 885, 806, 883, 136,
136919
+ /* 1470 */ 128, 138, 738, 258, 184, 899, 143, 145, 63, 64,
136920
+ /* 1480 */ 65, 66, 129, 902, 187, 186, 898, 8, 13, 188,
136921
+ /* 1490 */ 265, 891, 149, 202, 980, 818, 818, 820, 821, 19,
136922
+ /* 1500 */ 150, 387, 161, 680, 285, 391, 151, 395, 400, 193,
136923
+ /* 1510 */ 68, 14, 236, 279, 15, 69, 717, 825, 131, 824,
136924
+ /* 1520 */ 853, 70, 746, 16, 413, 750, 4, 174, 220, 222,
136925
+ /* 1530 */ 152, 779, 857, 774, 201, 77, 74, 868, 17, 854,
136926
+ /* 1540 */ 852, 908, 18, 907, 207, 206, 934, 163, 436, 210,
136927
+ /* 1550 */ 935, 164, 209, 165, 440, 856, 823, 690, 87, 211,
136928
+ /* 1560 */ 309, 312, 1281, 940, 1280,
136593136929
};
136594136930
static const YYCODETYPE yy_lookahead[] = {
136595136931
/* 0 */ 19, 115, 19, 117, 118, 24, 1, 2, 27, 79,
136596136932
/* 10 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
136597136933
/* 20 */ 90, 91, 92, 93, 94, 144, 145, 146, 147, 58,
@@ -136734,26 +137070,26 @@
136734137070
/* 1390 */ 27, 216, 174, 174, 182, 107, 159, 22, 215, 215,
136735137071
/* 1400 */ 37, 216, 216, 216, 137, 215, 132, 133, 134, 135,
136736137072
/* 1410 */ 136, 215, 159, 177, 94, 177, 129, 224, 205, 56,
136737137073
/* 1420 */ 226, 126, 128, 203, 229, 204, 114, 229, 127, 202,
136738137074
/* 1430 */ 201, 68, 25, 162, 26, 13, 161, 153, 153, 6,
136739
- /* 1440 */ 151, 151, 178, 151, 151, 165, 165, 178, 165, 4,
136740
- /* 1450 */ 249, 88, 89, 141, 3, 142, 22, 249, 95, 96,
136741
- /* 1460 */ 97, 98, 246, 15, 101, 67, 16, 23, 120, 23,
136742
- /* 1470 */ 131, 111, 123, 20, 16, 125, 1, 123, 131, 78,
136743
- /* 1480 */ 78, 78, 78, 111, 96, 1, 122, 35, 5, 22,
136744
- /* 1490 */ 107, 140, 53, 53, 26, 132, 133, 134, 135, 136,
136745
- /* 1500 */ 43, 60, 107, 24, 112, 20, 19, 52, 22, 29,
136746
- /* 1510 */ 105, 22, 22, 52, 23, 22, 22, 52, 23, 23,
136747
- /* 1520 */ 39, 23, 116, 26, 22, 26, 23, 22, 96, 23,
136748
- /* 1530 */ 23, 122, 22, 24, 124, 35, 35, 26, 26, 35,
136749
- /* 1540 */ 23, 23, 23, 23, 11, 23, 22, 26, 23, 22,
136750
- /* 1550 */ 122, 23, 26, 22, 24, 23, 22, 122, 23, 23,
136751
- /* 1560 */ 22, 15, 23, 1, 122, 122,
137075
+ /* 1440 */ 151, 151, 178, 151, 165, 165, 178, 165, 4, 3,
137076
+ /* 1450 */ 249, 88, 89, 141, 22, 142, 15, 249, 95, 96,
137077
+ /* 1460 */ 97, 98, 246, 67, 101, 16, 23, 120, 23, 131,
137078
+ /* 1470 */ 111, 123, 20, 16, 125, 1, 123, 131, 78, 78,
137079
+ /* 1480 */ 78, 78, 111, 96, 122, 35, 1, 5, 22, 107,
137080
+ /* 1490 */ 140, 53, 53, 26, 60, 132, 133, 134, 135, 136,
137081
+ /* 1500 */ 107, 43, 24, 20, 112, 19, 22, 52, 52, 105,
137082
+ /* 1510 */ 22, 22, 52, 23, 22, 22, 29, 23, 39, 23,
137083
+ /* 1520 */ 23, 26, 116, 22, 26, 23, 22, 122, 23, 23,
137084
+ /* 1530 */ 22, 96, 11, 124, 35, 26, 26, 23, 35, 23,
137085
+ /* 1540 */ 23, 23, 35, 23, 22, 26, 23, 22, 24, 122,
137086
+ /* 1550 */ 23, 22, 26, 22, 24, 23, 23, 23, 22, 122,
137087
+ /* 1560 */ 23, 15, 122, 1, 122,
136752137088
};
136753
-#define YY_SHIFT_USE_DFLT (1566)
136754
-#define YY_SHIFT_COUNT (455)
137089
+#define YY_SHIFT_USE_DFLT (1565)
137090
+#define YY_SHIFT_COUNT (454)
136755137091
#define YY_SHIFT_MIN (-114)
136756137092
#define YY_SHIFT_MAX (1562)
136757137093
static const short yy_shift_ofst[] = {
136758137094
/* 0 */ 5, 1117, 1312, 1128, 1274, 1274, 1274, 1274, 61, -19,
136759137095
/* 10 */ 57, 57, 183, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
@@ -136765,15 +137101,15 @@
136765137101
/* 70 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
136766137102
/* 80 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
136767137103
/* 90 */ 1363, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
136768137104
/* 100 */ 1274, 1274, 1274, 1274, -70, -47, -47, -47, -47, -47,
136769137105
/* 110 */ 24, 11, 146, 296, 524, 444, 529, 529, 296, 3,
136770
- /* 120 */ 2, -30, 1566, 1566, 1566, -17, -17, -17, 145, 145,
137106
+ /* 120 */ 2, -30, 1565, 1565, 1565, -17, -17, -17, 145, 145,
136771137107
/* 130 */ 497, 497, 265, 603, 653, 296, 296, 296, 296, 296,
136772137108
/* 140 */ 296, 296, 296, 296, 296, 296, 296, 296, 296, 296,
136773137109
/* 150 */ 296, 296, 296, 296, 296, 701, 1078, 147, 147, 2,
136774
- /* 160 */ 164, 164, 164, 164, 164, 164, 1566, 1566, 1566, 223,
137110
+ /* 160 */ 164, 164, 164, 164, 164, 164, 1565, 1565, 1565, 223,
136775137111
/* 170 */ 56, 56, 268, 269, 220, 347, 351, 415, 359, 296,
136776137112
/* 180 */ 296, 296, 296, 296, 296, 296, 296, 296, 296, 296,
136777137113
/* 190 */ 296, 296, 296, 296, 296, 632, 632, 632, 296, 296,
136778137114
/* 200 */ 498, 296, 296, 296, 570, 296, 296, 654, 296, 296,
136779137115
/* 210 */ 296, 296, 296, 296, 296, 296, 296, 296, 636, 200,
@@ -136784,30 +137120,30 @@
136784137120
/* 260 */ 1277, 1230, 1230, 1172, 1167, 1310, 1204, 1299, 1167, 1167,
136785137121
/* 270 */ 1310, 1335, 1167, 1310, 1167, 1310, 1335, 1258, 1258, 1258,
136786137122
/* 280 */ 1329, 1335, 1258, 1273, 1258, 1329, 1258, 1258, 1256, 1288,
136787137123
/* 290 */ 1256, 1288, 1256, 1288, 1256, 1288, 1167, 1375, 1167, 1267,
136788137124
/* 300 */ 1335, 1320, 1320, 1335, 1287, 1295, 1294, 1301, 1172, 1407,
136789
- /* 310 */ 1408, 1422, 1422, 1433, 1433, 1433, 1433, 1566, 1566, 1566,
136790
- /* 320 */ 1566, 1566, 1566, 1566, 1566, 558, 537, 684, 719, 734,
136791
- /* 330 */ 799, 840, 1019, 14, 1020, 1021, 1025, 1026, 1027, 1070,
136792
- /* 340 */ 1072, 997, 1047, 999, 1079, 1126, 1074, 1141, 694, 819,
136793
- /* 350 */ 1174, 1136, 981, 1445, 1451, 1434, 1313, 1448, 1398, 1450,
136794
- /* 360 */ 1444, 1446, 1348, 1339, 1360, 1349, 1453, 1350, 1458, 1475,
136795
- /* 370 */ 1354, 1347, 1401, 1402, 1403, 1404, 1372, 1388, 1452, 1364,
136796
- /* 380 */ 1484, 1483, 1467, 1383, 1351, 1439, 1468, 1440, 1441, 1457,
136797
- /* 390 */ 1395, 1479, 1485, 1487, 1392, 1405, 1486, 1455, 1489, 1490,
136798
- /* 400 */ 1491, 1493, 1461, 1480, 1494, 1465, 1481, 1495, 1496, 1498,
136799
- /* 410 */ 1497, 1406, 1502, 1503, 1505, 1499, 1409, 1506, 1507, 1432,
136800
- /* 420 */ 1500, 1510, 1410, 1511, 1501, 1512, 1504, 1517, 1511, 1518,
136801
- /* 430 */ 1519, 1520, 1521, 1522, 1524, 1533, 1525, 1527, 1509, 1526,
136802
- /* 440 */ 1528, 1531, 1530, 1526, 1532, 1534, 1535, 1536, 1538, 1428,
136803
- /* 450 */ 1435, 1442, 1443, 1539, 1546, 1562,
137125
+ /* 310 */ 1408, 1422, 1422, 1433, 1433, 1433, 1565, 1565, 1565, 1565,
137126
+ /* 320 */ 1565, 1565, 1565, 1565, 558, 537, 684, 719, 734, 799,
137127
+ /* 330 */ 840, 1019, 14, 1020, 1021, 1025, 1026, 1027, 1070, 1072,
137128
+ /* 340 */ 997, 1047, 999, 1079, 1126, 1074, 1141, 694, 819, 1174,
137129
+ /* 350 */ 1136, 981, 1444, 1446, 1432, 1313, 1441, 1396, 1449, 1443,
137130
+ /* 360 */ 1445, 1347, 1338, 1359, 1348, 1452, 1349, 1457, 1474, 1353,
137131
+ /* 370 */ 1346, 1400, 1401, 1402, 1403, 1371, 1387, 1450, 1362, 1485,
137132
+ /* 380 */ 1482, 1466, 1382, 1350, 1438, 1467, 1439, 1434, 1458, 1393,
137133
+ /* 390 */ 1478, 1483, 1486, 1392, 1404, 1484, 1455, 1488, 1489, 1490,
137134
+ /* 400 */ 1492, 1456, 1487, 1493, 1460, 1479, 1494, 1496, 1497, 1495,
137135
+ /* 410 */ 1406, 1501, 1502, 1504, 1498, 1405, 1505, 1506, 1435, 1499,
137136
+ /* 420 */ 1508, 1409, 1509, 1503, 1510, 1507, 1514, 1509, 1516, 1517,
137137
+ /* 430 */ 1518, 1519, 1520, 1522, 1521, 1523, 1525, 1524, 1526, 1527,
137138
+ /* 440 */ 1529, 1530, 1526, 1532, 1531, 1533, 1534, 1536, 1427, 1437,
137139
+ /* 450 */ 1440, 1442, 1537, 1546, 1562,
136804137140
};
136805137141
#define YY_REDUCE_USE_DFLT (-174)
136806
-#define YY_REDUCE_COUNT (324)
137142
+#define YY_REDUCE_COUNT (323)
136807137143
#define YY_REDUCE_MIN (-173)
136808
-#define YY_REDUCE_MAX (1293)
137144
+#define YY_REDUCE_MAX (1292)
136809137145
static const short yy_reduce_ofst[] = {
136810137146
/* 0 */ -119, 1014, 131, 1031, -12, 225, 228, 300, -40, -45,
136811137147
/* 10 */ 243, 256, 293, 129, 218, 418, 79, 376, 433, 298,
136812137148
/* 20 */ 16, 137, 367, 323, -38, 391, -173, -173, -173, -173,
136813137149
/* 30 */ -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,
@@ -136836,60 +137172,60 @@
136836137172
/* 260 */ 1115, 1147, 1148, 1137, 1180, 1182, 1110, 1121, 1188, 1189,
136837137173
/* 270 */ 1197, 1181, 1200, 1202, 1205, 1203, 1191, 1192, 1199, 1206,
136838137174
/* 280 */ 1207, 1209, 1210, 1211, 1214, 1212, 1218, 1219, 1175, 1183,
136839137175
/* 290 */ 1185, 1184, 1186, 1190, 1187, 1196, 1237, 1193, 1253, 1194,
136840137176
/* 300 */ 1236, 1195, 1198, 1238, 1213, 1221, 1220, 1227, 1229, 1271,
136841
- /* 310 */ 1275, 1284, 1285, 1289, 1290, 1292, 1293, 1201, 1208, 1216,
136842
- /* 320 */ 1280, 1281, 1264, 1269, 1283,
137177
+ /* 310 */ 1275, 1284, 1285, 1289, 1290, 1292, 1201, 1208, 1216, 1279,
137178
+ /* 320 */ 1280, 1264, 1268, 1282,
136843137179
};
136844137180
static const YYACTIONTYPE yy_default[] = {
136845
- /* 0 */ 1277, 1267, 1267, 1267, 1200, 1200, 1200, 1200, 1267, 1094,
136846
- /* 10 */ 1123, 1123, 1251, 1329, 1329, 1329, 1329, 1329, 1329, 1199,
136847
- /* 20 */ 1329, 1329, 1329, 1329, 1267, 1098, 1129, 1329, 1329, 1329,
136848
- /* 30 */ 1329, 1201, 1202, 1329, 1329, 1329, 1250, 1252, 1139, 1138,
136849
- /* 40 */ 1137, 1136, 1233, 1110, 1134, 1127, 1131, 1201, 1195, 1196,
136850
- /* 50 */ 1194, 1198, 1202, 1329, 1130, 1165, 1179, 1164, 1329, 1329,
136851
- /* 60 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136852
- /* 70 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136853
- /* 80 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136854
- /* 90 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136855
- /* 100 */ 1329, 1329, 1329, 1329, 1173, 1178, 1185, 1177, 1174, 1167,
136856
- /* 110 */ 1166, 1168, 1169, 1329, 1017, 1065, 1329, 1329, 1329, 1170,
136857
- /* 120 */ 1329, 1171, 1182, 1181, 1180, 1258, 1285, 1284, 1329, 1329,
136858
- /* 130 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136859
- /* 140 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136860
- /* 150 */ 1329, 1329, 1329, 1329, 1329, 1277, 1267, 1023, 1023, 1329,
136861
- /* 160 */ 1267, 1267, 1267, 1267, 1267, 1267, 1263, 1098, 1089, 1329,
136862
- /* 170 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136863
- /* 180 */ 1255, 1253, 1329, 1215, 1329, 1329, 1329, 1329, 1329, 1329,
136864
- /* 190 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136865
- /* 200 */ 1329, 1329, 1329, 1329, 1094, 1329, 1329, 1329, 1329, 1329,
136866
- /* 210 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1279, 1329, 1228,
136867
- /* 220 */ 1094, 1094, 1094, 1096, 1078, 1088, 1002, 1133, 1112, 1112,
136868
- /* 230 */ 1318, 1133, 1318, 1040, 1299, 1037, 1123, 1112, 1197, 1123,
136869
- /* 240 */ 1123, 1095, 1088, 1329, 1321, 1103, 1103, 1320, 1320, 1103,
136870
- /* 250 */ 1144, 1068, 1133, 1074, 1074, 1074, 1074, 1103, 1014, 1133,
136871
- /* 260 */ 1144, 1068, 1068, 1133, 1103, 1014, 1232, 1315, 1103, 1103,
136872
- /* 270 */ 1014, 1208, 1103, 1014, 1103, 1014, 1208, 1066, 1066, 1066,
136873
- /* 280 */ 1055, 1208, 1066, 1040, 1066, 1055, 1066, 1066, 1116, 1111,
136874
- /* 290 */ 1116, 1111, 1116, 1111, 1116, 1111, 1103, 1203, 1103, 1329,
136875
- /* 300 */ 1208, 1212, 1212, 1208, 1128, 1117, 1126, 1124, 1133, 1020,
136876
- /* 310 */ 1058, 1282, 1282, 1278, 1278, 1278, 1278, 1326, 1326, 1263,
136877
- /* 320 */ 1294, 1294, 1042, 1042, 1294, 1329, 1329, 1329, 1329, 1329,
136878
- /* 330 */ 1329, 1289, 1329, 1217, 1329, 1329, 1329, 1329, 1329, 1329,
136879
- /* 340 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136880
- /* 350 */ 1329, 1329, 1150, 1329, 998, 1260, 1329, 1329, 1259, 1329,
136881
- /* 360 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136882
- /* 370 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1317,
136883
- /* 380 */ 1329, 1329, 1329, 1329, 1329, 1329, 1231, 1230, 1329, 1329,
136884
- /* 390 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136885
- /* 400 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136886
- /* 410 */ 1329, 1080, 1329, 1329, 1329, 1303, 1329, 1329, 1329, 1329,
136887
- /* 420 */ 1329, 1329, 1329, 1125, 1329, 1118, 1329, 1329, 1308, 1329,
136888
- /* 430 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1269,
136889
- /* 440 */ 1329, 1329, 1329, 1268, 1329, 1329, 1329, 1329, 1329, 1152,
136890
- /* 450 */ 1329, 1151, 1155, 1329, 1008, 1329,
137181
+ /* 0 */ 1270, 1260, 1260, 1260, 1193, 1193, 1193, 1193, 1260, 1088,
137182
+ /* 10 */ 1117, 1117, 1244, 1322, 1322, 1322, 1322, 1322, 1322, 1192,
137183
+ /* 20 */ 1322, 1322, 1322, 1322, 1260, 1092, 1123, 1322, 1322, 1322,
137184
+ /* 30 */ 1322, 1194, 1195, 1322, 1322, 1322, 1243, 1245, 1133, 1132,
137185
+ /* 40 */ 1131, 1130, 1226, 1104, 1128, 1121, 1125, 1194, 1188, 1189,
137186
+ /* 50 */ 1187, 1191, 1195, 1322, 1124, 1158, 1172, 1157, 1322, 1322,
137187
+ /* 60 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137188
+ /* 70 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137189
+ /* 80 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137190
+ /* 90 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137191
+ /* 100 */ 1322, 1322, 1322, 1322, 1166, 1171, 1178, 1170, 1167, 1160,
137192
+ /* 110 */ 1159, 1161, 1162, 1322, 1011, 1059, 1322, 1322, 1322, 1163,
137193
+ /* 120 */ 1322, 1164, 1175, 1174, 1173, 1251, 1278, 1277, 1322, 1322,
137194
+ /* 130 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137195
+ /* 140 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137196
+ /* 150 */ 1322, 1322, 1322, 1322, 1322, 1270, 1260, 1017, 1017, 1322,
137197
+ /* 160 */ 1260, 1260, 1260, 1260, 1260, 1260, 1256, 1092, 1083, 1322,
137198
+ /* 170 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137199
+ /* 180 */ 1248, 1246, 1322, 1208, 1322, 1322, 1322, 1322, 1322, 1322,
137200
+ /* 190 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137201
+ /* 200 */ 1322, 1322, 1322, 1322, 1088, 1322, 1322, 1322, 1322, 1322,
137202
+ /* 210 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1272, 1322, 1221,
137203
+ /* 220 */ 1088, 1088, 1088, 1090, 1072, 1082, 997, 1127, 1106, 1106,
137204
+ /* 230 */ 1311, 1127, 1311, 1034, 1292, 1031, 1117, 1106, 1190, 1117,
137205
+ /* 240 */ 1117, 1089, 1082, 1322, 1314, 1097, 1097, 1313, 1313, 1097,
137206
+ /* 250 */ 1138, 1062, 1127, 1068, 1068, 1068, 1068, 1097, 1008, 1127,
137207
+ /* 260 */ 1138, 1062, 1062, 1127, 1097, 1008, 1225, 1308, 1097, 1097,
137208
+ /* 270 */ 1008, 1201, 1097, 1008, 1097, 1008, 1201, 1060, 1060, 1060,
137209
+ /* 280 */ 1049, 1201, 1060, 1034, 1060, 1049, 1060, 1060, 1110, 1105,
137210
+ /* 290 */ 1110, 1105, 1110, 1105, 1110, 1105, 1097, 1196, 1097, 1322,
137211
+ /* 300 */ 1201, 1205, 1205, 1201, 1122, 1111, 1120, 1118, 1127, 1014,
137212
+ /* 310 */ 1052, 1275, 1275, 1271, 1271, 1271, 1319, 1319, 1256, 1287,
137213
+ /* 320 */ 1287, 1036, 1036, 1287, 1322, 1322, 1322, 1322, 1322, 1322,
137214
+ /* 330 */ 1282, 1322, 1210, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137215
+ /* 340 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137216
+ /* 350 */ 1322, 1143, 1322, 993, 1253, 1322, 1322, 1252, 1322, 1322,
137217
+ /* 360 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137218
+ /* 370 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1310, 1322,
137219
+ /* 380 */ 1322, 1322, 1322, 1322, 1322, 1224, 1223, 1322, 1322, 1322,
137220
+ /* 390 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137221
+ /* 400 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137222
+ /* 410 */ 1074, 1322, 1322, 1322, 1296, 1322, 1322, 1322, 1322, 1322,
137223
+ /* 420 */ 1322, 1322, 1119, 1322, 1112, 1322, 1322, 1301, 1322, 1322,
137224
+ /* 430 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1262, 1322,
137225
+ /* 440 */ 1322, 1322, 1261, 1322, 1322, 1322, 1322, 1322, 1145, 1322,
137226
+ /* 450 */ 1144, 1148, 1322, 1002, 1322,
136891137227
};
136892137228
/********** End of lemon-generated parsing tables *****************************/
136893137229
136894137230
/* The next table maps tokens (terminal symbols) into fallback tokens.
136895137231
** If a construct like the following:
@@ -137138,333 +137474,331 @@
137138137474
/* 3 */ "cmd ::= BEGIN transtype trans_opt",
137139137475
/* 4 */ "transtype ::=",
137140137476
/* 5 */ "transtype ::= DEFERRED",
137141137477
/* 6 */ "transtype ::= IMMEDIATE",
137142137478
/* 7 */ "transtype ::= EXCLUSIVE",
137143
- /* 8 */ "cmd ::= COMMIT trans_opt",
137144
- /* 9 */ "cmd ::= END trans_opt",
137145
- /* 10 */ "cmd ::= ROLLBACK trans_opt",
137146
- /* 11 */ "cmd ::= SAVEPOINT nm",
137147
- /* 12 */ "cmd ::= RELEASE savepoint_opt nm",
137148
- /* 13 */ "cmd ::= ROLLBACK trans_opt TO savepoint_opt nm",
137149
- /* 14 */ "create_table ::= createkw temp TABLE ifnotexists nm dbnm",
137150
- /* 15 */ "createkw ::= CREATE",
137151
- /* 16 */ "ifnotexists ::=",
137152
- /* 17 */ "ifnotexists ::= IF NOT EXISTS",
137153
- /* 18 */ "temp ::= TEMP",
137154
- /* 19 */ "temp ::=",
137155
- /* 20 */ "create_table_args ::= LP columnlist conslist_opt RP table_options",
137156
- /* 21 */ "create_table_args ::= AS select",
137157
- /* 22 */ "table_options ::=",
137158
- /* 23 */ "table_options ::= WITHOUT nm",
137159
- /* 24 */ "columnname ::= nm typetoken",
137160
- /* 25 */ "typetoken ::=",
137161
- /* 26 */ "typetoken ::= typename LP signed RP",
137162
- /* 27 */ "typetoken ::= typename LP signed COMMA signed RP",
137163
- /* 28 */ "typename ::= typename ID|STRING",
137164
- /* 29 */ "ccons ::= CONSTRAINT nm",
137165
- /* 30 */ "ccons ::= DEFAULT term",
137166
- /* 31 */ "ccons ::= DEFAULT LP expr RP",
137167
- /* 32 */ "ccons ::= DEFAULT PLUS term",
137168
- /* 33 */ "ccons ::= DEFAULT MINUS term",
137169
- /* 34 */ "ccons ::= DEFAULT ID|INDEXED",
137170
- /* 35 */ "ccons ::= NOT NULL onconf",
137171
- /* 36 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
137172
- /* 37 */ "ccons ::= UNIQUE onconf",
137173
- /* 38 */ "ccons ::= CHECK LP expr RP",
137174
- /* 39 */ "ccons ::= REFERENCES nm eidlist_opt refargs",
137175
- /* 40 */ "ccons ::= defer_subclause",
137176
- /* 41 */ "ccons ::= COLLATE ID|STRING",
137177
- /* 42 */ "autoinc ::=",
137178
- /* 43 */ "autoinc ::= AUTOINCR",
137179
- /* 44 */ "refargs ::=",
137180
- /* 45 */ "refargs ::= refargs refarg",
137181
- /* 46 */ "refarg ::= MATCH nm",
137182
- /* 47 */ "refarg ::= ON INSERT refact",
137183
- /* 48 */ "refarg ::= ON DELETE refact",
137184
- /* 49 */ "refarg ::= ON UPDATE refact",
137185
- /* 50 */ "refact ::= SET NULL",
137186
- /* 51 */ "refact ::= SET DEFAULT",
137187
- /* 52 */ "refact ::= CASCADE",
137188
- /* 53 */ "refact ::= RESTRICT",
137189
- /* 54 */ "refact ::= NO ACTION",
137190
- /* 55 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
137191
- /* 56 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
137192
- /* 57 */ "init_deferred_pred_opt ::=",
137193
- /* 58 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
137194
- /* 59 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
137195
- /* 60 */ "conslist_opt ::=",
137196
- /* 61 */ "tconscomma ::= COMMA",
137197
- /* 62 */ "tcons ::= CONSTRAINT nm",
137198
- /* 63 */ "tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf",
137199
- /* 64 */ "tcons ::= UNIQUE LP sortlist RP onconf",
137200
- /* 65 */ "tcons ::= CHECK LP expr RP onconf",
137201
- /* 66 */ "tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt",
137202
- /* 67 */ "defer_subclause_opt ::=",
137203
- /* 68 */ "onconf ::=",
137204
- /* 69 */ "onconf ::= ON CONFLICT resolvetype",
137205
- /* 70 */ "orconf ::=",
137206
- /* 71 */ "orconf ::= OR resolvetype",
137207
- /* 72 */ "resolvetype ::= IGNORE",
137208
- /* 73 */ "resolvetype ::= REPLACE",
137209
- /* 74 */ "cmd ::= DROP TABLE ifexists fullname",
137210
- /* 75 */ "ifexists ::= IF EXISTS",
137211
- /* 76 */ "ifexists ::=",
137212
- /* 77 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select",
137213
- /* 78 */ "cmd ::= DROP VIEW ifexists fullname",
137214
- /* 79 */ "cmd ::= select",
137215
- /* 80 */ "select ::= with selectnowith",
137216
- /* 81 */ "selectnowith ::= selectnowith multiselect_op oneselect",
137217
- /* 82 */ "multiselect_op ::= UNION",
137218
- /* 83 */ "multiselect_op ::= UNION ALL",
137219
- /* 84 */ "multiselect_op ::= EXCEPT|INTERSECT",
137220
- /* 85 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
137221
- /* 86 */ "values ::= VALUES LP nexprlist RP",
137222
- /* 87 */ "values ::= values COMMA LP exprlist RP",
137223
- /* 88 */ "distinct ::= DISTINCT",
137224
- /* 89 */ "distinct ::= ALL",
137225
- /* 90 */ "distinct ::=",
137226
- /* 91 */ "sclp ::=",
137227
- /* 92 */ "selcollist ::= sclp expr as",
137228
- /* 93 */ "selcollist ::= sclp STAR",
137229
- /* 94 */ "selcollist ::= sclp nm DOT STAR",
137230
- /* 95 */ "as ::= AS nm",
137231
- /* 96 */ "as ::=",
137232
- /* 97 */ "from ::=",
137233
- /* 98 */ "from ::= FROM seltablist",
137234
- /* 99 */ "stl_prefix ::= seltablist joinop",
137235
- /* 100 */ "stl_prefix ::=",
137236
- /* 101 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt",
137237
- /* 102 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt",
137238
- /* 103 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt",
137239
- /* 104 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
137240
- /* 105 */ "dbnm ::=",
137241
- /* 106 */ "dbnm ::= DOT nm",
137242
- /* 107 */ "fullname ::= nm dbnm",
137243
- /* 108 */ "joinop ::= COMMA|JOIN",
137244
- /* 109 */ "joinop ::= JOIN_KW JOIN",
137245
- /* 110 */ "joinop ::= JOIN_KW nm JOIN",
137246
- /* 111 */ "joinop ::= JOIN_KW nm nm JOIN",
137247
- /* 112 */ "on_opt ::= ON expr",
137248
- /* 113 */ "on_opt ::=",
137249
- /* 114 */ "indexed_opt ::=",
137250
- /* 115 */ "indexed_opt ::= INDEXED BY nm",
137251
- /* 116 */ "indexed_opt ::= NOT INDEXED",
137252
- /* 117 */ "using_opt ::= USING LP idlist RP",
137253
- /* 118 */ "using_opt ::=",
137254
- /* 119 */ "orderby_opt ::=",
137255
- /* 120 */ "orderby_opt ::= ORDER BY sortlist",
137256
- /* 121 */ "sortlist ::= sortlist COMMA expr sortorder",
137257
- /* 122 */ "sortlist ::= expr sortorder",
137258
- /* 123 */ "sortorder ::= ASC",
137259
- /* 124 */ "sortorder ::= DESC",
137260
- /* 125 */ "sortorder ::=",
137261
- /* 126 */ "groupby_opt ::=",
137262
- /* 127 */ "groupby_opt ::= GROUP BY nexprlist",
137263
- /* 128 */ "having_opt ::=",
137264
- /* 129 */ "having_opt ::= HAVING expr",
137265
- /* 130 */ "limit_opt ::=",
137266
- /* 131 */ "limit_opt ::= LIMIT expr",
137267
- /* 132 */ "limit_opt ::= LIMIT expr OFFSET expr",
137268
- /* 133 */ "limit_opt ::= LIMIT expr COMMA expr",
137269
- /* 134 */ "cmd ::= with DELETE FROM fullname indexed_opt where_opt",
137270
- /* 135 */ "where_opt ::=",
137271
- /* 136 */ "where_opt ::= WHERE expr",
137272
- /* 137 */ "cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt",
137273
- /* 138 */ "setlist ::= setlist COMMA nm EQ expr",
137274
- /* 139 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
137275
- /* 140 */ "setlist ::= nm EQ expr",
137276
- /* 141 */ "setlist ::= LP idlist RP EQ expr",
137277
- /* 142 */ "cmd ::= with insert_cmd INTO fullname idlist_opt select",
137278
- /* 143 */ "cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES",
137279
- /* 144 */ "insert_cmd ::= INSERT orconf",
137280
- /* 145 */ "insert_cmd ::= REPLACE",
137281
- /* 146 */ "idlist_opt ::=",
137282
- /* 147 */ "idlist_opt ::= LP idlist RP",
137283
- /* 148 */ "idlist ::= idlist COMMA nm",
137284
- /* 149 */ "idlist ::= nm",
137285
- /* 150 */ "expr ::= LP expr RP",
137286
- /* 151 */ "term ::= NULL",
137287
- /* 152 */ "expr ::= ID|INDEXED",
137288
- /* 153 */ "expr ::= JOIN_KW",
137289
- /* 154 */ "expr ::= nm DOT nm",
137290
- /* 155 */ "expr ::= nm DOT nm DOT nm",
137291
- /* 156 */ "term ::= FLOAT|BLOB",
137292
- /* 157 */ "term ::= STRING",
137293
- /* 158 */ "term ::= INTEGER",
137294
- /* 159 */ "expr ::= VARIABLE",
137295
- /* 160 */ "expr ::= expr COLLATE ID|STRING",
137296
- /* 161 */ "expr ::= CAST LP expr AS typetoken RP",
137297
- /* 162 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
137298
- /* 163 */ "expr ::= ID|INDEXED LP STAR RP",
137299
- /* 164 */ "term ::= CTIME_KW",
137300
- /* 165 */ "expr ::= LP nexprlist COMMA expr RP",
137301
- /* 166 */ "expr ::= expr AND expr",
137302
- /* 167 */ "expr ::= expr OR expr",
137303
- /* 168 */ "expr ::= expr LT|GT|GE|LE expr",
137304
- /* 169 */ "expr ::= expr EQ|NE expr",
137305
- /* 170 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
137306
- /* 171 */ "expr ::= expr PLUS|MINUS expr",
137307
- /* 172 */ "expr ::= expr STAR|SLASH|REM expr",
137308
- /* 173 */ "expr ::= expr CONCAT expr",
137309
- /* 174 */ "likeop ::= NOT LIKE_KW|MATCH",
137310
- /* 175 */ "expr ::= expr likeop expr",
137311
- /* 176 */ "expr ::= expr likeop expr ESCAPE expr",
137312
- /* 177 */ "expr ::= expr ISNULL|NOTNULL",
137313
- /* 178 */ "expr ::= expr NOT NULL",
137314
- /* 179 */ "expr ::= expr IS expr",
137315
- /* 180 */ "expr ::= expr IS NOT expr",
137316
- /* 181 */ "expr ::= NOT expr",
137317
- /* 182 */ "expr ::= BITNOT expr",
137318
- /* 183 */ "expr ::= MINUS expr",
137319
- /* 184 */ "expr ::= PLUS expr",
137320
- /* 185 */ "between_op ::= BETWEEN",
137321
- /* 186 */ "between_op ::= NOT BETWEEN",
137322
- /* 187 */ "expr ::= expr between_op expr AND expr",
137323
- /* 188 */ "in_op ::= IN",
137324
- /* 189 */ "in_op ::= NOT IN",
137325
- /* 190 */ "expr ::= expr in_op LP exprlist RP",
137326
- /* 191 */ "expr ::= LP select RP",
137327
- /* 192 */ "expr ::= expr in_op LP select RP",
137328
- /* 193 */ "expr ::= expr in_op nm dbnm paren_exprlist",
137329
- /* 194 */ "expr ::= EXISTS LP select RP",
137330
- /* 195 */ "expr ::= CASE case_operand case_exprlist case_else END",
137331
- /* 196 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
137332
- /* 197 */ "case_exprlist ::= WHEN expr THEN expr",
137333
- /* 198 */ "case_else ::= ELSE expr",
137334
- /* 199 */ "case_else ::=",
137335
- /* 200 */ "case_operand ::= expr",
137336
- /* 201 */ "case_operand ::=",
137337
- /* 202 */ "exprlist ::=",
137338
- /* 203 */ "nexprlist ::= nexprlist COMMA expr",
137339
- /* 204 */ "nexprlist ::= expr",
137340
- /* 205 */ "paren_exprlist ::=",
137341
- /* 206 */ "paren_exprlist ::= LP exprlist RP",
137342
- /* 207 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
137343
- /* 208 */ "uniqueflag ::= UNIQUE",
137344
- /* 209 */ "uniqueflag ::=",
137345
- /* 210 */ "eidlist_opt ::=",
137346
- /* 211 */ "eidlist_opt ::= LP eidlist RP",
137347
- /* 212 */ "eidlist ::= eidlist COMMA nm collate sortorder",
137348
- /* 213 */ "eidlist ::= nm collate sortorder",
137349
- /* 214 */ "collate ::=",
137350
- /* 215 */ "collate ::= COLLATE ID|STRING",
137351
- /* 216 */ "cmd ::= DROP INDEX ifexists fullname",
137352
- /* 217 */ "cmd ::= VACUUM",
137353
- /* 218 */ "cmd ::= VACUUM nm",
137354
- /* 219 */ "cmd ::= PRAGMA nm dbnm",
137355
- /* 220 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
137356
- /* 221 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
137357
- /* 222 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
137358
- /* 223 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
137359
- /* 224 */ "plus_num ::= PLUS INTEGER|FLOAT",
137360
- /* 225 */ "minus_num ::= MINUS INTEGER|FLOAT",
137361
- /* 226 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
137362
- /* 227 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
137363
- /* 228 */ "trigger_time ::= BEFORE|AFTER",
137364
- /* 229 */ "trigger_time ::= INSTEAD OF",
137365
- /* 230 */ "trigger_time ::=",
137366
- /* 231 */ "trigger_event ::= DELETE|INSERT",
137367
- /* 232 */ "trigger_event ::= UPDATE",
137368
- /* 233 */ "trigger_event ::= UPDATE OF idlist",
137369
- /* 234 */ "when_clause ::=",
137370
- /* 235 */ "when_clause ::= WHEN expr",
137371
- /* 236 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
137372
- /* 237 */ "trigger_cmd_list ::= trigger_cmd SEMI",
137373
- /* 238 */ "trnm ::= nm DOT nm",
137374
- /* 239 */ "tridxby ::= INDEXED BY nm",
137375
- /* 240 */ "tridxby ::= NOT INDEXED",
137376
- /* 241 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt",
137377
- /* 242 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select",
137378
- /* 243 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
137379
- /* 244 */ "trigger_cmd ::= select",
137380
- /* 245 */ "expr ::= RAISE LP IGNORE RP",
137381
- /* 246 */ "expr ::= RAISE LP raisetype COMMA nm RP",
137382
- /* 247 */ "raisetype ::= ROLLBACK",
137383
- /* 248 */ "raisetype ::= ABORT",
137384
- /* 249 */ "raisetype ::= FAIL",
137385
- /* 250 */ "cmd ::= DROP TRIGGER ifexists fullname",
137386
- /* 251 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
137387
- /* 252 */ "cmd ::= DETACH database_kw_opt expr",
137388
- /* 253 */ "key_opt ::=",
137389
- /* 254 */ "key_opt ::= KEY expr",
137390
- /* 255 */ "cmd ::= REINDEX",
137391
- /* 256 */ "cmd ::= REINDEX nm dbnm",
137392
- /* 257 */ "cmd ::= ANALYZE",
137393
- /* 258 */ "cmd ::= ANALYZE nm dbnm",
137394
- /* 259 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
137395
- /* 260 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
137396
- /* 261 */ "add_column_fullname ::= fullname",
137397
- /* 262 */ "cmd ::= create_vtab",
137398
- /* 263 */ "cmd ::= create_vtab LP vtabarglist RP",
137399
- /* 264 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
137400
- /* 265 */ "vtabarg ::=",
137401
- /* 266 */ "vtabargtoken ::= ANY",
137402
- /* 267 */ "vtabargtoken ::= lp anylist RP",
137403
- /* 268 */ "lp ::= LP",
137404
- /* 269 */ "with ::=",
137405
- /* 270 */ "with ::= WITH wqlist",
137406
- /* 271 */ "with ::= WITH RECURSIVE wqlist",
137407
- /* 272 */ "wqlist ::= nm eidlist_opt AS LP select RP",
137408
- /* 273 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
137409
- /* 274 */ "input ::= cmdlist",
137410
- /* 275 */ "cmdlist ::= cmdlist ecmd",
137411
- /* 276 */ "cmdlist ::= ecmd",
137412
- /* 277 */ "ecmd ::= SEMI",
137413
- /* 278 */ "ecmd ::= explain cmdx SEMI",
137414
- /* 279 */ "explain ::=",
137415
- /* 280 */ "trans_opt ::=",
137416
- /* 281 */ "trans_opt ::= TRANSACTION",
137417
- /* 282 */ "trans_opt ::= TRANSACTION nm",
137418
- /* 283 */ "savepoint_opt ::= SAVEPOINT",
137419
- /* 284 */ "savepoint_opt ::=",
137420
- /* 285 */ "cmd ::= create_table create_table_args",
137421
- /* 286 */ "columnlist ::= columnlist COMMA columnname carglist",
137422
- /* 287 */ "columnlist ::= columnname carglist",
137423
- /* 288 */ "nm ::= ID|INDEXED",
137424
- /* 289 */ "nm ::= STRING",
137425
- /* 290 */ "nm ::= JOIN_KW",
137426
- /* 291 */ "typetoken ::= typename",
137427
- /* 292 */ "typename ::= ID|STRING",
137428
- /* 293 */ "signed ::= plus_num",
137429
- /* 294 */ "signed ::= minus_num",
137430
- /* 295 */ "carglist ::= carglist ccons",
137431
- /* 296 */ "carglist ::=",
137432
- /* 297 */ "ccons ::= NULL onconf",
137433
- /* 298 */ "conslist_opt ::= COMMA conslist",
137434
- /* 299 */ "conslist ::= conslist tconscomma tcons",
137435
- /* 300 */ "conslist ::= tcons",
137436
- /* 301 */ "tconscomma ::=",
137437
- /* 302 */ "defer_subclause_opt ::= defer_subclause",
137438
- /* 303 */ "resolvetype ::= raisetype",
137439
- /* 304 */ "selectnowith ::= oneselect",
137440
- /* 305 */ "oneselect ::= values",
137441
- /* 306 */ "sclp ::= selcollist COMMA",
137442
- /* 307 */ "as ::= ID|STRING",
137443
- /* 308 */ "expr ::= term",
137444
- /* 309 */ "likeop ::= LIKE_KW|MATCH",
137445
- /* 310 */ "exprlist ::= nexprlist",
137446
- /* 311 */ "nmnum ::= plus_num",
137447
- /* 312 */ "nmnum ::= nm",
137448
- /* 313 */ "nmnum ::= ON",
137449
- /* 314 */ "nmnum ::= DELETE",
137450
- /* 315 */ "nmnum ::= DEFAULT",
137451
- /* 316 */ "plus_num ::= INTEGER|FLOAT",
137452
- /* 317 */ "foreach_clause ::=",
137453
- /* 318 */ "foreach_clause ::= FOR EACH ROW",
137454
- /* 319 */ "trnm ::= nm",
137455
- /* 320 */ "tridxby ::=",
137456
- /* 321 */ "database_kw_opt ::= DATABASE",
137457
- /* 322 */ "database_kw_opt ::=",
137458
- /* 323 */ "kwcolumn_opt ::=",
137459
- /* 324 */ "kwcolumn_opt ::= COLUMNKW",
137460
- /* 325 */ "vtabarglist ::= vtabarg",
137461
- /* 326 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
137462
- /* 327 */ "vtabarg ::= vtabarg vtabargtoken",
137463
- /* 328 */ "anylist ::=",
137464
- /* 329 */ "anylist ::= anylist LP anylist RP",
137465
- /* 330 */ "anylist ::= anylist ANY",
137479
+ /* 8 */ "cmd ::= COMMIT|END trans_opt",
137480
+ /* 9 */ "cmd ::= ROLLBACK trans_opt",
137481
+ /* 10 */ "cmd ::= SAVEPOINT nm",
137482
+ /* 11 */ "cmd ::= RELEASE savepoint_opt nm",
137483
+ /* 12 */ "cmd ::= ROLLBACK trans_opt TO savepoint_opt nm",
137484
+ /* 13 */ "create_table ::= createkw temp TABLE ifnotexists nm dbnm",
137485
+ /* 14 */ "createkw ::= CREATE",
137486
+ /* 15 */ "ifnotexists ::=",
137487
+ /* 16 */ "ifnotexists ::= IF NOT EXISTS",
137488
+ /* 17 */ "temp ::= TEMP",
137489
+ /* 18 */ "temp ::=",
137490
+ /* 19 */ "create_table_args ::= LP columnlist conslist_opt RP table_options",
137491
+ /* 20 */ "create_table_args ::= AS select",
137492
+ /* 21 */ "table_options ::=",
137493
+ /* 22 */ "table_options ::= WITHOUT nm",
137494
+ /* 23 */ "columnname ::= nm typetoken",
137495
+ /* 24 */ "typetoken ::=",
137496
+ /* 25 */ "typetoken ::= typename LP signed RP",
137497
+ /* 26 */ "typetoken ::= typename LP signed COMMA signed RP",
137498
+ /* 27 */ "typename ::= typename ID|STRING",
137499
+ /* 28 */ "ccons ::= CONSTRAINT nm",
137500
+ /* 29 */ "ccons ::= DEFAULT term",
137501
+ /* 30 */ "ccons ::= DEFAULT LP expr RP",
137502
+ /* 31 */ "ccons ::= DEFAULT PLUS term",
137503
+ /* 32 */ "ccons ::= DEFAULT MINUS term",
137504
+ /* 33 */ "ccons ::= DEFAULT ID|INDEXED",
137505
+ /* 34 */ "ccons ::= NOT NULL onconf",
137506
+ /* 35 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
137507
+ /* 36 */ "ccons ::= UNIQUE onconf",
137508
+ /* 37 */ "ccons ::= CHECK LP expr RP",
137509
+ /* 38 */ "ccons ::= REFERENCES nm eidlist_opt refargs",
137510
+ /* 39 */ "ccons ::= defer_subclause",
137511
+ /* 40 */ "ccons ::= COLLATE ID|STRING",
137512
+ /* 41 */ "autoinc ::=",
137513
+ /* 42 */ "autoinc ::= AUTOINCR",
137514
+ /* 43 */ "refargs ::=",
137515
+ /* 44 */ "refargs ::= refargs refarg",
137516
+ /* 45 */ "refarg ::= MATCH nm",
137517
+ /* 46 */ "refarg ::= ON INSERT refact",
137518
+ /* 47 */ "refarg ::= ON DELETE refact",
137519
+ /* 48 */ "refarg ::= ON UPDATE refact",
137520
+ /* 49 */ "refact ::= SET NULL",
137521
+ /* 50 */ "refact ::= SET DEFAULT",
137522
+ /* 51 */ "refact ::= CASCADE",
137523
+ /* 52 */ "refact ::= RESTRICT",
137524
+ /* 53 */ "refact ::= NO ACTION",
137525
+ /* 54 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
137526
+ /* 55 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
137527
+ /* 56 */ "init_deferred_pred_opt ::=",
137528
+ /* 57 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
137529
+ /* 58 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
137530
+ /* 59 */ "conslist_opt ::=",
137531
+ /* 60 */ "tconscomma ::= COMMA",
137532
+ /* 61 */ "tcons ::= CONSTRAINT nm",
137533
+ /* 62 */ "tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf",
137534
+ /* 63 */ "tcons ::= UNIQUE LP sortlist RP onconf",
137535
+ /* 64 */ "tcons ::= CHECK LP expr RP onconf",
137536
+ /* 65 */ "tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt",
137537
+ /* 66 */ "defer_subclause_opt ::=",
137538
+ /* 67 */ "onconf ::=",
137539
+ /* 68 */ "onconf ::= ON CONFLICT resolvetype",
137540
+ /* 69 */ "orconf ::=",
137541
+ /* 70 */ "orconf ::= OR resolvetype",
137542
+ /* 71 */ "resolvetype ::= IGNORE",
137543
+ /* 72 */ "resolvetype ::= REPLACE",
137544
+ /* 73 */ "cmd ::= DROP TABLE ifexists fullname",
137545
+ /* 74 */ "ifexists ::= IF EXISTS",
137546
+ /* 75 */ "ifexists ::=",
137547
+ /* 76 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select",
137548
+ /* 77 */ "cmd ::= DROP VIEW ifexists fullname",
137549
+ /* 78 */ "cmd ::= select",
137550
+ /* 79 */ "select ::= with selectnowith",
137551
+ /* 80 */ "selectnowith ::= selectnowith multiselect_op oneselect",
137552
+ /* 81 */ "multiselect_op ::= UNION",
137553
+ /* 82 */ "multiselect_op ::= UNION ALL",
137554
+ /* 83 */ "multiselect_op ::= EXCEPT|INTERSECT",
137555
+ /* 84 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
137556
+ /* 85 */ "values ::= VALUES LP nexprlist RP",
137557
+ /* 86 */ "values ::= values COMMA LP exprlist RP",
137558
+ /* 87 */ "distinct ::= DISTINCT",
137559
+ /* 88 */ "distinct ::= ALL",
137560
+ /* 89 */ "distinct ::=",
137561
+ /* 90 */ "sclp ::=",
137562
+ /* 91 */ "selcollist ::= sclp expr as",
137563
+ /* 92 */ "selcollist ::= sclp STAR",
137564
+ /* 93 */ "selcollist ::= sclp nm DOT STAR",
137565
+ /* 94 */ "as ::= AS nm",
137566
+ /* 95 */ "as ::=",
137567
+ /* 96 */ "from ::=",
137568
+ /* 97 */ "from ::= FROM seltablist",
137569
+ /* 98 */ "stl_prefix ::= seltablist joinop",
137570
+ /* 99 */ "stl_prefix ::=",
137571
+ /* 100 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt",
137572
+ /* 101 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt",
137573
+ /* 102 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt",
137574
+ /* 103 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
137575
+ /* 104 */ "dbnm ::=",
137576
+ /* 105 */ "dbnm ::= DOT nm",
137577
+ /* 106 */ "fullname ::= nm dbnm",
137578
+ /* 107 */ "joinop ::= COMMA|JOIN",
137579
+ /* 108 */ "joinop ::= JOIN_KW JOIN",
137580
+ /* 109 */ "joinop ::= JOIN_KW nm JOIN",
137581
+ /* 110 */ "joinop ::= JOIN_KW nm nm JOIN",
137582
+ /* 111 */ "on_opt ::= ON expr",
137583
+ /* 112 */ "on_opt ::=",
137584
+ /* 113 */ "indexed_opt ::=",
137585
+ /* 114 */ "indexed_opt ::= INDEXED BY nm",
137586
+ /* 115 */ "indexed_opt ::= NOT INDEXED",
137587
+ /* 116 */ "using_opt ::= USING LP idlist RP",
137588
+ /* 117 */ "using_opt ::=",
137589
+ /* 118 */ "orderby_opt ::=",
137590
+ /* 119 */ "orderby_opt ::= ORDER BY sortlist",
137591
+ /* 120 */ "sortlist ::= sortlist COMMA expr sortorder",
137592
+ /* 121 */ "sortlist ::= expr sortorder",
137593
+ /* 122 */ "sortorder ::= ASC",
137594
+ /* 123 */ "sortorder ::= DESC",
137595
+ /* 124 */ "sortorder ::=",
137596
+ /* 125 */ "groupby_opt ::=",
137597
+ /* 126 */ "groupby_opt ::= GROUP BY nexprlist",
137598
+ /* 127 */ "having_opt ::=",
137599
+ /* 128 */ "having_opt ::= HAVING expr",
137600
+ /* 129 */ "limit_opt ::=",
137601
+ /* 130 */ "limit_opt ::= LIMIT expr",
137602
+ /* 131 */ "limit_opt ::= LIMIT expr OFFSET expr",
137603
+ /* 132 */ "limit_opt ::= LIMIT expr COMMA expr",
137604
+ /* 133 */ "cmd ::= with DELETE FROM fullname indexed_opt where_opt",
137605
+ /* 134 */ "where_opt ::=",
137606
+ /* 135 */ "where_opt ::= WHERE expr",
137607
+ /* 136 */ "cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt",
137608
+ /* 137 */ "setlist ::= setlist COMMA nm EQ expr",
137609
+ /* 138 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
137610
+ /* 139 */ "setlist ::= nm EQ expr",
137611
+ /* 140 */ "setlist ::= LP idlist RP EQ expr",
137612
+ /* 141 */ "cmd ::= with insert_cmd INTO fullname idlist_opt select",
137613
+ /* 142 */ "cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES",
137614
+ /* 143 */ "insert_cmd ::= INSERT orconf",
137615
+ /* 144 */ "insert_cmd ::= REPLACE",
137616
+ /* 145 */ "idlist_opt ::=",
137617
+ /* 146 */ "idlist_opt ::= LP idlist RP",
137618
+ /* 147 */ "idlist ::= idlist COMMA nm",
137619
+ /* 148 */ "idlist ::= nm",
137620
+ /* 149 */ "expr ::= LP expr RP",
137621
+ /* 150 */ "expr ::= ID|INDEXED",
137622
+ /* 151 */ "expr ::= JOIN_KW",
137623
+ /* 152 */ "expr ::= nm DOT nm",
137624
+ /* 153 */ "expr ::= nm DOT nm DOT nm",
137625
+ /* 154 */ "term ::= NULL|FLOAT|BLOB",
137626
+ /* 155 */ "term ::= STRING",
137627
+ /* 156 */ "term ::= INTEGER",
137628
+ /* 157 */ "expr ::= VARIABLE",
137629
+ /* 158 */ "expr ::= expr COLLATE ID|STRING",
137630
+ /* 159 */ "expr ::= CAST LP expr AS typetoken RP",
137631
+ /* 160 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
137632
+ /* 161 */ "expr ::= ID|INDEXED LP STAR RP",
137633
+ /* 162 */ "term ::= CTIME_KW",
137634
+ /* 163 */ "expr ::= LP nexprlist COMMA expr RP",
137635
+ /* 164 */ "expr ::= expr AND expr",
137636
+ /* 165 */ "expr ::= expr OR expr",
137637
+ /* 166 */ "expr ::= expr LT|GT|GE|LE expr",
137638
+ /* 167 */ "expr ::= expr EQ|NE expr",
137639
+ /* 168 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
137640
+ /* 169 */ "expr ::= expr PLUS|MINUS expr",
137641
+ /* 170 */ "expr ::= expr STAR|SLASH|REM expr",
137642
+ /* 171 */ "expr ::= expr CONCAT expr",
137643
+ /* 172 */ "likeop ::= NOT LIKE_KW|MATCH",
137644
+ /* 173 */ "expr ::= expr likeop expr",
137645
+ /* 174 */ "expr ::= expr likeop expr ESCAPE expr",
137646
+ /* 175 */ "expr ::= expr ISNULL|NOTNULL",
137647
+ /* 176 */ "expr ::= expr NOT NULL",
137648
+ /* 177 */ "expr ::= expr IS expr",
137649
+ /* 178 */ "expr ::= expr IS NOT expr",
137650
+ /* 179 */ "expr ::= NOT expr",
137651
+ /* 180 */ "expr ::= BITNOT expr",
137652
+ /* 181 */ "expr ::= MINUS expr",
137653
+ /* 182 */ "expr ::= PLUS expr",
137654
+ /* 183 */ "between_op ::= BETWEEN",
137655
+ /* 184 */ "between_op ::= NOT BETWEEN",
137656
+ /* 185 */ "expr ::= expr between_op expr AND expr",
137657
+ /* 186 */ "in_op ::= IN",
137658
+ /* 187 */ "in_op ::= NOT IN",
137659
+ /* 188 */ "expr ::= expr in_op LP exprlist RP",
137660
+ /* 189 */ "expr ::= LP select RP",
137661
+ /* 190 */ "expr ::= expr in_op LP select RP",
137662
+ /* 191 */ "expr ::= expr in_op nm dbnm paren_exprlist",
137663
+ /* 192 */ "expr ::= EXISTS LP select RP",
137664
+ /* 193 */ "expr ::= CASE case_operand case_exprlist case_else END",
137665
+ /* 194 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
137666
+ /* 195 */ "case_exprlist ::= WHEN expr THEN expr",
137667
+ /* 196 */ "case_else ::= ELSE expr",
137668
+ /* 197 */ "case_else ::=",
137669
+ /* 198 */ "case_operand ::= expr",
137670
+ /* 199 */ "case_operand ::=",
137671
+ /* 200 */ "exprlist ::=",
137672
+ /* 201 */ "nexprlist ::= nexprlist COMMA expr",
137673
+ /* 202 */ "nexprlist ::= expr",
137674
+ /* 203 */ "paren_exprlist ::=",
137675
+ /* 204 */ "paren_exprlist ::= LP exprlist RP",
137676
+ /* 205 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
137677
+ /* 206 */ "uniqueflag ::= UNIQUE",
137678
+ /* 207 */ "uniqueflag ::=",
137679
+ /* 208 */ "eidlist_opt ::=",
137680
+ /* 209 */ "eidlist_opt ::= LP eidlist RP",
137681
+ /* 210 */ "eidlist ::= eidlist COMMA nm collate sortorder",
137682
+ /* 211 */ "eidlist ::= nm collate sortorder",
137683
+ /* 212 */ "collate ::=",
137684
+ /* 213 */ "collate ::= COLLATE ID|STRING",
137685
+ /* 214 */ "cmd ::= DROP INDEX ifexists fullname",
137686
+ /* 215 */ "cmd ::= VACUUM",
137687
+ /* 216 */ "cmd ::= VACUUM nm",
137688
+ /* 217 */ "cmd ::= PRAGMA nm dbnm",
137689
+ /* 218 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
137690
+ /* 219 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
137691
+ /* 220 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
137692
+ /* 221 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
137693
+ /* 222 */ "plus_num ::= PLUS INTEGER|FLOAT",
137694
+ /* 223 */ "minus_num ::= MINUS INTEGER|FLOAT",
137695
+ /* 224 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
137696
+ /* 225 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
137697
+ /* 226 */ "trigger_time ::= BEFORE|AFTER",
137698
+ /* 227 */ "trigger_time ::= INSTEAD OF",
137699
+ /* 228 */ "trigger_time ::=",
137700
+ /* 229 */ "trigger_event ::= DELETE|INSERT",
137701
+ /* 230 */ "trigger_event ::= UPDATE",
137702
+ /* 231 */ "trigger_event ::= UPDATE OF idlist",
137703
+ /* 232 */ "when_clause ::=",
137704
+ /* 233 */ "when_clause ::= WHEN expr",
137705
+ /* 234 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
137706
+ /* 235 */ "trigger_cmd_list ::= trigger_cmd SEMI",
137707
+ /* 236 */ "trnm ::= nm DOT nm",
137708
+ /* 237 */ "tridxby ::= INDEXED BY nm",
137709
+ /* 238 */ "tridxby ::= NOT INDEXED",
137710
+ /* 239 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt",
137711
+ /* 240 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select",
137712
+ /* 241 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
137713
+ /* 242 */ "trigger_cmd ::= select",
137714
+ /* 243 */ "expr ::= RAISE LP IGNORE RP",
137715
+ /* 244 */ "expr ::= RAISE LP raisetype COMMA nm RP",
137716
+ /* 245 */ "raisetype ::= ROLLBACK",
137717
+ /* 246 */ "raisetype ::= ABORT",
137718
+ /* 247 */ "raisetype ::= FAIL",
137719
+ /* 248 */ "cmd ::= DROP TRIGGER ifexists fullname",
137720
+ /* 249 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
137721
+ /* 250 */ "cmd ::= DETACH database_kw_opt expr",
137722
+ /* 251 */ "key_opt ::=",
137723
+ /* 252 */ "key_opt ::= KEY expr",
137724
+ /* 253 */ "cmd ::= REINDEX",
137725
+ /* 254 */ "cmd ::= REINDEX nm dbnm",
137726
+ /* 255 */ "cmd ::= ANALYZE",
137727
+ /* 256 */ "cmd ::= ANALYZE nm dbnm",
137728
+ /* 257 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
137729
+ /* 258 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
137730
+ /* 259 */ "add_column_fullname ::= fullname",
137731
+ /* 260 */ "cmd ::= create_vtab",
137732
+ /* 261 */ "cmd ::= create_vtab LP vtabarglist RP",
137733
+ /* 262 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
137734
+ /* 263 */ "vtabarg ::=",
137735
+ /* 264 */ "vtabargtoken ::= ANY",
137736
+ /* 265 */ "vtabargtoken ::= lp anylist RP",
137737
+ /* 266 */ "lp ::= LP",
137738
+ /* 267 */ "with ::=",
137739
+ /* 268 */ "with ::= WITH wqlist",
137740
+ /* 269 */ "with ::= WITH RECURSIVE wqlist",
137741
+ /* 270 */ "wqlist ::= nm eidlist_opt AS LP select RP",
137742
+ /* 271 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
137743
+ /* 272 */ "input ::= cmdlist",
137744
+ /* 273 */ "cmdlist ::= cmdlist ecmd",
137745
+ /* 274 */ "cmdlist ::= ecmd",
137746
+ /* 275 */ "ecmd ::= SEMI",
137747
+ /* 276 */ "ecmd ::= explain cmdx SEMI",
137748
+ /* 277 */ "explain ::=",
137749
+ /* 278 */ "trans_opt ::=",
137750
+ /* 279 */ "trans_opt ::= TRANSACTION",
137751
+ /* 280 */ "trans_opt ::= TRANSACTION nm",
137752
+ /* 281 */ "savepoint_opt ::= SAVEPOINT",
137753
+ /* 282 */ "savepoint_opt ::=",
137754
+ /* 283 */ "cmd ::= create_table create_table_args",
137755
+ /* 284 */ "columnlist ::= columnlist COMMA columnname carglist",
137756
+ /* 285 */ "columnlist ::= columnname carglist",
137757
+ /* 286 */ "nm ::= ID|INDEXED",
137758
+ /* 287 */ "nm ::= STRING",
137759
+ /* 288 */ "nm ::= JOIN_KW",
137760
+ /* 289 */ "typetoken ::= typename",
137761
+ /* 290 */ "typename ::= ID|STRING",
137762
+ /* 291 */ "signed ::= plus_num",
137763
+ /* 292 */ "signed ::= minus_num",
137764
+ /* 293 */ "carglist ::= carglist ccons",
137765
+ /* 294 */ "carglist ::=",
137766
+ /* 295 */ "ccons ::= NULL onconf",
137767
+ /* 296 */ "conslist_opt ::= COMMA conslist",
137768
+ /* 297 */ "conslist ::= conslist tconscomma tcons",
137769
+ /* 298 */ "conslist ::= tcons",
137770
+ /* 299 */ "tconscomma ::=",
137771
+ /* 300 */ "defer_subclause_opt ::= defer_subclause",
137772
+ /* 301 */ "resolvetype ::= raisetype",
137773
+ /* 302 */ "selectnowith ::= oneselect",
137774
+ /* 303 */ "oneselect ::= values",
137775
+ /* 304 */ "sclp ::= selcollist COMMA",
137776
+ /* 305 */ "as ::= ID|STRING",
137777
+ /* 306 */ "expr ::= term",
137778
+ /* 307 */ "likeop ::= LIKE_KW|MATCH",
137779
+ /* 308 */ "exprlist ::= nexprlist",
137780
+ /* 309 */ "nmnum ::= plus_num",
137781
+ /* 310 */ "nmnum ::= nm",
137782
+ /* 311 */ "nmnum ::= ON",
137783
+ /* 312 */ "nmnum ::= DELETE",
137784
+ /* 313 */ "nmnum ::= DEFAULT",
137785
+ /* 314 */ "plus_num ::= INTEGER|FLOAT",
137786
+ /* 315 */ "foreach_clause ::=",
137787
+ /* 316 */ "foreach_clause ::= FOR EACH ROW",
137788
+ /* 317 */ "trnm ::= nm",
137789
+ /* 318 */ "tridxby ::=",
137790
+ /* 319 */ "database_kw_opt ::= DATABASE",
137791
+ /* 320 */ "database_kw_opt ::=",
137792
+ /* 321 */ "kwcolumn_opt ::=",
137793
+ /* 322 */ "kwcolumn_opt ::= COLUMNKW",
137794
+ /* 323 */ "vtabarglist ::= vtabarg",
137795
+ /* 324 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
137796
+ /* 325 */ "vtabarg ::= vtabarg vtabargtoken",
137797
+ /* 326 */ "anylist ::=",
137798
+ /* 327 */ "anylist ::= anylist LP anylist RP",
137799
+ /* 328 */ "anylist ::= anylist ANY",
137466137800
};
137467137801
#endif /* NDEBUG */
137468137802
137469137803
137470137804
#if YYSTACKDEPTH<=0
@@ -137529,11 +137863,13 @@
137529137863
pParser->yyerrcnt = -1;
137530137864
#endif
137531137865
pParser->yytos = pParser->yystack;
137532137866
pParser->yystack[0].stateno = 0;
137533137867
pParser->yystack[0].major = 0;
137868
+#if YYSTACKDEPTH>0
137534137869
pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1];
137870
+#endif
137535137871
}
137536137872
137537137873
#ifndef sqlite3Parser_ENGINEALWAYSONSTACK
137538137874
/*
137539137875
** This function allocates a new parser.
@@ -137914,11 +138250,10 @@
137914138250
{ 150, -1 },
137915138251
{ 150, -1 },
137916138252
{ 149, -2 },
137917138253
{ 149, -2 },
137918138254
{ 149, -2 },
137919
- { 149, -2 },
137920138255
{ 149, -3 },
137921138256
{ 149, -5 },
137922138257
{ 154, -6 },
137923138258
{ 156, -1 },
137924138259
{ 158, 0 },
@@ -138054,11 +138389,10 @@
138054138389
{ 220, 0 },
138055138390
{ 220, -3 },
138056138391
{ 217, -3 },
138057138392
{ 217, -1 },
138058138393
{ 173, -3 },
138059
- { 172, -1 },
138060138394
{ 173, -1 },
138061138395
{ 173, -1 },
138062138396
{ 173, -3 },
138063138397
{ 173, -5 },
138064138398
{ 172, -1 },
@@ -138317,256 +138651,253 @@
138317138651
case 5: /* transtype ::= DEFERRED */
138318138652
case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
138319138653
case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
138320138654
{yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-X*/}
138321138655
break;
138322
- case 8: /* cmd ::= COMMIT trans_opt */
138323
- case 9: /* cmd ::= END trans_opt */ yytestcase(yyruleno==9);
138324
-{sqlite3CommitTransaction(pParse);}
138325
- break;
138326
- case 10: /* cmd ::= ROLLBACK trans_opt */
138327
-{sqlite3RollbackTransaction(pParse);}
138328
- break;
138329
- case 11: /* cmd ::= SAVEPOINT nm */
138656
+ case 8: /* cmd ::= COMMIT|END trans_opt */
138657
+ case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
138658
+{sqlite3EndTransaction(pParse,yymsp[-1].major);}
138659
+ break;
138660
+ case 10: /* cmd ::= SAVEPOINT nm */
138330138661
{
138331138662
sqlite3Savepoint(pParse, SAVEPOINT_BEGIN, &yymsp[0].minor.yy0);
138332138663
}
138333138664
break;
138334
- case 12: /* cmd ::= RELEASE savepoint_opt nm */
138665
+ case 11: /* cmd ::= RELEASE savepoint_opt nm */
138335138666
{
138336138667
sqlite3Savepoint(pParse, SAVEPOINT_RELEASE, &yymsp[0].minor.yy0);
138337138668
}
138338138669
break;
138339
- case 13: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
138670
+ case 12: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
138340138671
{
138341138672
sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
138342138673
}
138343138674
break;
138344
- case 14: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
138675
+ case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
138345138676
{
138346138677
sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy194,0,0,yymsp[-2].minor.yy194);
138347138678
}
138348138679
break;
138349
- case 15: /* createkw ::= CREATE */
138680
+ case 14: /* createkw ::= CREATE */
138350138681
{disableLookaside(pParse);}
138351138682
break;
138352
- case 16: /* ifnotexists ::= */
138353
- case 19: /* temp ::= */ yytestcase(yyruleno==19);
138354
- case 22: /* table_options ::= */ yytestcase(yyruleno==22);
138355
- case 42: /* autoinc ::= */ yytestcase(yyruleno==42);
138356
- case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);
138357
- case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);
138358
- case 76: /* ifexists ::= */ yytestcase(yyruleno==76);
138359
- case 90: /* distinct ::= */ yytestcase(yyruleno==90);
138360
- case 214: /* collate ::= */ yytestcase(yyruleno==214);
138683
+ case 15: /* ifnotexists ::= */
138684
+ case 18: /* temp ::= */ yytestcase(yyruleno==18);
138685
+ case 21: /* table_options ::= */ yytestcase(yyruleno==21);
138686
+ case 41: /* autoinc ::= */ yytestcase(yyruleno==41);
138687
+ case 56: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==56);
138688
+ case 66: /* defer_subclause_opt ::= */ yytestcase(yyruleno==66);
138689
+ case 75: /* ifexists ::= */ yytestcase(yyruleno==75);
138690
+ case 89: /* distinct ::= */ yytestcase(yyruleno==89);
138691
+ case 212: /* collate ::= */ yytestcase(yyruleno==212);
138361138692
{yymsp[1].minor.yy194 = 0;}
138362138693
break;
138363
- case 17: /* ifnotexists ::= IF NOT EXISTS */
138694
+ case 16: /* ifnotexists ::= IF NOT EXISTS */
138364138695
{yymsp[-2].minor.yy194 = 1;}
138365138696
break;
138366
- case 18: /* temp ::= TEMP */
138367
- case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43);
138697
+ case 17: /* temp ::= TEMP */
138698
+ case 42: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==42);
138368138699
{yymsp[0].minor.yy194 = 1;}
138369138700
break;
138370
- case 20: /* create_table_args ::= LP columnlist conslist_opt RP table_options */
138701
+ case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */
138371138702
{
138372138703
sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy194,0);
138373138704
}
138374138705
break;
138375
- case 21: /* create_table_args ::= AS select */
138706
+ case 20: /* create_table_args ::= AS select */
138376138707
{
138377138708
sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy243);
138378138709
sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy243);
138379138710
}
138380138711
break;
138381
- case 23: /* table_options ::= WITHOUT nm */
138712
+ case 22: /* table_options ::= WITHOUT nm */
138382138713
{
138383138714
if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
138384138715
yymsp[-1].minor.yy194 = TF_WithoutRowid | TF_NoVisibleRowid;
138385138716
}else{
138386138717
yymsp[-1].minor.yy194 = 0;
138387138718
sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
138388138719
}
138389138720
}
138390138721
break;
138391
- case 24: /* columnname ::= nm typetoken */
138722
+ case 23: /* columnname ::= nm typetoken */
138392138723
{sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
138393138724
break;
138394
- case 25: /* typetoken ::= */
138395
- case 60: /* conslist_opt ::= */ yytestcase(yyruleno==60);
138396
- case 96: /* as ::= */ yytestcase(yyruleno==96);
138725
+ case 24: /* typetoken ::= */
138726
+ case 59: /* conslist_opt ::= */ yytestcase(yyruleno==59);
138727
+ case 95: /* as ::= */ yytestcase(yyruleno==95);
138397138728
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;}
138398138729
break;
138399
- case 26: /* typetoken ::= typename LP signed RP */
138730
+ case 25: /* typetoken ::= typename LP signed RP */
138400138731
{
138401138732
yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);
138402138733
}
138403138734
break;
138404
- case 27: /* typetoken ::= typename LP signed COMMA signed RP */
138735
+ case 26: /* typetoken ::= typename LP signed COMMA signed RP */
138405138736
{
138406138737
yymsp[-5].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z);
138407138738
}
138408138739
break;
138409
- case 28: /* typename ::= typename ID|STRING */
138740
+ case 27: /* typename ::= typename ID|STRING */
138410138741
{yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
138411138742
break;
138412
- case 29: /* ccons ::= CONSTRAINT nm */
138413
- case 62: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==62);
138743
+ case 28: /* ccons ::= CONSTRAINT nm */
138744
+ case 61: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==61);
138414138745
{pParse->constraintName = yymsp[0].minor.yy0;}
138415138746
break;
138416
- case 30: /* ccons ::= DEFAULT term */
138417
- case 32: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==32);
138747
+ case 29: /* ccons ::= DEFAULT term */
138748
+ case 31: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==31);
138418138749
{sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy190);}
138419138750
break;
138420
- case 31: /* ccons ::= DEFAULT LP expr RP */
138751
+ case 30: /* ccons ::= DEFAULT LP expr RP */
138421138752
{sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy190);}
138422138753
break;
138423
- case 33: /* ccons ::= DEFAULT MINUS term */
138754
+ case 32: /* ccons ::= DEFAULT MINUS term */
138424138755
{
138425138756
ExprSpan v;
138426138757
v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy190.pExpr, 0);
138427138758
v.zStart = yymsp[-1].minor.yy0.z;
138428138759
v.zEnd = yymsp[0].minor.yy190.zEnd;
138429138760
sqlite3AddDefaultValue(pParse,&v);
138430138761
}
138431138762
break;
138432
- case 34: /* ccons ::= DEFAULT ID|INDEXED */
138763
+ case 33: /* ccons ::= DEFAULT ID|INDEXED */
138433138764
{
138434138765
ExprSpan v;
138435138766
spanExpr(&v, pParse, TK_STRING, yymsp[0].minor.yy0);
138436138767
sqlite3AddDefaultValue(pParse,&v);
138437138768
}
138438138769
break;
138439
- case 35: /* ccons ::= NOT NULL onconf */
138770
+ case 34: /* ccons ::= NOT NULL onconf */
138440138771
{sqlite3AddNotNull(pParse, yymsp[0].minor.yy194);}
138441138772
break;
138442
- case 36: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
138773
+ case 35: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
138443138774
{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy194,yymsp[0].minor.yy194,yymsp[-2].minor.yy194);}
138444138775
break;
138445
- case 37: /* ccons ::= UNIQUE onconf */
138776
+ case 36: /* ccons ::= UNIQUE onconf */
138446138777
{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy194,0,0,0,0,
138447138778
SQLITE_IDXTYPE_UNIQUE);}
138448138779
break;
138449
- case 38: /* ccons ::= CHECK LP expr RP */
138780
+ case 37: /* ccons ::= CHECK LP expr RP */
138450138781
{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy190.pExpr);}
138451138782
break;
138452
- case 39: /* ccons ::= REFERENCES nm eidlist_opt refargs */
138783
+ case 38: /* ccons ::= REFERENCES nm eidlist_opt refargs */
138453138784
{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy148,yymsp[0].minor.yy194);}
138454138785
break;
138455
- case 40: /* ccons ::= defer_subclause */
138786
+ case 39: /* ccons ::= defer_subclause */
138456138787
{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy194);}
138457138788
break;
138458
- case 41: /* ccons ::= COLLATE ID|STRING */
138789
+ case 40: /* ccons ::= COLLATE ID|STRING */
138459138790
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
138460138791
break;
138461
- case 44: /* refargs ::= */
138792
+ case 43: /* refargs ::= */
138462138793
{ yymsp[1].minor.yy194 = OE_None*0x0101; /* EV: R-19803-45884 */}
138463138794
break;
138464
- case 45: /* refargs ::= refargs refarg */
138795
+ case 44: /* refargs ::= refargs refarg */
138465138796
{ yymsp[-1].minor.yy194 = (yymsp[-1].minor.yy194 & ~yymsp[0].minor.yy497.mask) | yymsp[0].minor.yy497.value; }
138466138797
break;
138467
- case 46: /* refarg ::= MATCH nm */
138798
+ case 45: /* refarg ::= MATCH nm */
138468138799
{ yymsp[-1].minor.yy497.value = 0; yymsp[-1].minor.yy497.mask = 0x000000; }
138469138800
break;
138470
- case 47: /* refarg ::= ON INSERT refact */
138801
+ case 46: /* refarg ::= ON INSERT refact */
138471138802
{ yymsp[-2].minor.yy497.value = 0; yymsp[-2].minor.yy497.mask = 0x000000; }
138472138803
break;
138473
- case 48: /* refarg ::= ON DELETE refact */
138804
+ case 47: /* refarg ::= ON DELETE refact */
138474138805
{ yymsp[-2].minor.yy497.value = yymsp[0].minor.yy194; yymsp[-2].minor.yy497.mask = 0x0000ff; }
138475138806
break;
138476
- case 49: /* refarg ::= ON UPDATE refact */
138807
+ case 48: /* refarg ::= ON UPDATE refact */
138477138808
{ yymsp[-2].minor.yy497.value = yymsp[0].minor.yy194<<8; yymsp[-2].minor.yy497.mask = 0x00ff00; }
138478138809
break;
138479
- case 50: /* refact ::= SET NULL */
138810
+ case 49: /* refact ::= SET NULL */
138480138811
{ yymsp[-1].minor.yy194 = OE_SetNull; /* EV: R-33326-45252 */}
138481138812
break;
138482
- case 51: /* refact ::= SET DEFAULT */
138813
+ case 50: /* refact ::= SET DEFAULT */
138483138814
{ yymsp[-1].minor.yy194 = OE_SetDflt; /* EV: R-33326-45252 */}
138484138815
break;
138485
- case 52: /* refact ::= CASCADE */
138816
+ case 51: /* refact ::= CASCADE */
138486138817
{ yymsp[0].minor.yy194 = OE_Cascade; /* EV: R-33326-45252 */}
138487138818
break;
138488
- case 53: /* refact ::= RESTRICT */
138819
+ case 52: /* refact ::= RESTRICT */
138489138820
{ yymsp[0].minor.yy194 = OE_Restrict; /* EV: R-33326-45252 */}
138490138821
break;
138491
- case 54: /* refact ::= NO ACTION */
138822
+ case 53: /* refact ::= NO ACTION */
138492138823
{ yymsp[-1].minor.yy194 = OE_None; /* EV: R-33326-45252 */}
138493138824
break;
138494
- case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
138825
+ case 54: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
138495138826
{yymsp[-2].minor.yy194 = 0;}
138496138827
break;
138497
- case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
138498
- case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71);
138499
- case 144: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==144);
138828
+ case 55: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
138829
+ case 70: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==70);
138830
+ case 143: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==143);
138500138831
{yymsp[-1].minor.yy194 = yymsp[0].minor.yy194;}
138501138832
break;
138502
- case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
138503
- case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);
138504
- case 186: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==186);
138505
- case 189: /* in_op ::= NOT IN */ yytestcase(yyruleno==189);
138506
- case 215: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==215);
138833
+ case 57: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
138834
+ case 74: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==74);
138835
+ case 184: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==184);
138836
+ case 187: /* in_op ::= NOT IN */ yytestcase(yyruleno==187);
138837
+ case 213: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==213);
138507138838
{yymsp[-1].minor.yy194 = 1;}
138508138839
break;
138509
- case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
138840
+ case 58: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
138510138841
{yymsp[-1].minor.yy194 = 0;}
138511138842
break;
138512
- case 61: /* tconscomma ::= COMMA */
138843
+ case 60: /* tconscomma ::= COMMA */
138513138844
{pParse->constraintName.n = 0;}
138514138845
break;
138515
- case 63: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
138846
+ case 62: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
138516138847
{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy148,yymsp[0].minor.yy194,yymsp[-2].minor.yy194,0);}
138517138848
break;
138518
- case 64: /* tcons ::= UNIQUE LP sortlist RP onconf */
138849
+ case 63: /* tcons ::= UNIQUE LP sortlist RP onconf */
138519138850
{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy148,yymsp[0].minor.yy194,0,0,0,0,
138520138851
SQLITE_IDXTYPE_UNIQUE);}
138521138852
break;
138522
- case 65: /* tcons ::= CHECK LP expr RP onconf */
138853
+ case 64: /* tcons ::= CHECK LP expr RP onconf */
138523138854
{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy190.pExpr);}
138524138855
break;
138525
- case 66: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
138856
+ case 65: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
138526138857
{
138527138858
sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy148, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy148, yymsp[-1].minor.yy194);
138528138859
sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy194);
138529138860
}
138530138861
break;
138531
- case 68: /* onconf ::= */
138532
- case 70: /* orconf ::= */ yytestcase(yyruleno==70);
138862
+ case 67: /* onconf ::= */
138863
+ case 69: /* orconf ::= */ yytestcase(yyruleno==69);
138533138864
{yymsp[1].minor.yy194 = OE_Default;}
138534138865
break;
138535
- case 69: /* onconf ::= ON CONFLICT resolvetype */
138866
+ case 68: /* onconf ::= ON CONFLICT resolvetype */
138536138867
{yymsp[-2].minor.yy194 = yymsp[0].minor.yy194;}
138537138868
break;
138538
- case 72: /* resolvetype ::= IGNORE */
138869
+ case 71: /* resolvetype ::= IGNORE */
138539138870
{yymsp[0].minor.yy194 = OE_Ignore;}
138540138871
break;
138541
- case 73: /* resolvetype ::= REPLACE */
138542
- case 145: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==145);
138872
+ case 72: /* resolvetype ::= REPLACE */
138873
+ case 144: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==144);
138543138874
{yymsp[0].minor.yy194 = OE_Replace;}
138544138875
break;
138545
- case 74: /* cmd ::= DROP TABLE ifexists fullname */
138876
+ case 73: /* cmd ::= DROP TABLE ifexists fullname */
138546138877
{
138547138878
sqlite3DropTable(pParse, yymsp[0].minor.yy185, 0, yymsp[-1].minor.yy194);
138548138879
}
138549138880
break;
138550
- case 77: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
138881
+ case 76: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
138551138882
{
138552138883
sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy148, yymsp[0].minor.yy243, yymsp[-7].minor.yy194, yymsp[-5].minor.yy194);
138553138884
}
138554138885
break;
138555
- case 78: /* cmd ::= DROP VIEW ifexists fullname */
138886
+ case 77: /* cmd ::= DROP VIEW ifexists fullname */
138556138887
{
138557138888
sqlite3DropTable(pParse, yymsp[0].minor.yy185, 1, yymsp[-1].minor.yy194);
138558138889
}
138559138890
break;
138560
- case 79: /* cmd ::= select */
138891
+ case 78: /* cmd ::= select */
138561138892
{
138562138893
SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0};
138563138894
sqlite3Select(pParse, yymsp[0].minor.yy243, &dest);
138564138895
sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy243);
138565138896
}
138566138897
break;
138567
- case 80: /* select ::= with selectnowith */
138898
+ case 79: /* select ::= with selectnowith */
138568138899
{
138569138900
Select *p = yymsp[0].minor.yy243;
138570138901
if( p ){
138571138902
p->pWith = yymsp[-1].minor.yy285;
138572138903
parserDoubleLinkSelect(pParse, p);
@@ -138574,11 +138905,11 @@
138574138905
sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy285);
138575138906
}
138576138907
yymsp[-1].minor.yy243 = p; /*A-overwrites-W*/
138577138908
}
138578138909
break;
138579
- case 81: /* selectnowith ::= selectnowith multiselect_op oneselect */
138910
+ case 80: /* selectnowith ::= selectnowith multiselect_op oneselect */
138580138911
{
138581138912
Select *pRhs = yymsp[0].minor.yy243;
138582138913
Select *pLhs = yymsp[-2].minor.yy243;
138583138914
if( pRhs && pRhs->pPrior ){
138584138915
SrcList *pFrom;
@@ -138598,18 +138929,18 @@
138598138929
sqlite3SelectDelete(pParse->db, pLhs);
138599138930
}
138600138931
yymsp[-2].minor.yy243 = pRhs;
138601138932
}
138602138933
break;
138603
- case 82: /* multiselect_op ::= UNION */
138604
- case 84: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==84);
138934
+ case 81: /* multiselect_op ::= UNION */
138935
+ case 83: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==83);
138605138936
{yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-OP*/}
138606138937
break;
138607
- case 83: /* multiselect_op ::= UNION ALL */
138938
+ case 82: /* multiselect_op ::= UNION ALL */
138608138939
{yymsp[-1].minor.yy194 = TK_ALL;}
138609138940
break;
138610
- case 85: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
138941
+ case 84: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
138611138942
{
138612138943
#if SELECTTRACE_ENABLED
138613138944
Token s = yymsp[-8].minor.yy0; /*A-overwrites-S*/
138614138945
#endif
138615138946
yymsp[-8].minor.yy243 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy148,yymsp[-5].minor.yy185,yymsp[-4].minor.yy72,yymsp[-3].minor.yy148,yymsp[-2].minor.yy72,yymsp[-1].minor.yy148,yymsp[-7].minor.yy194,yymsp[0].minor.yy354.pLimit,yymsp[0].minor.yy354.pOffset);
@@ -138637,16 +138968,16 @@
138637138968
}
138638138969
}
138639138970
#endif /* SELECTRACE_ENABLED */
138640138971
}
138641138972
break;
138642
- case 86: /* values ::= VALUES LP nexprlist RP */
138973
+ case 85: /* values ::= VALUES LP nexprlist RP */
138643138974
{
138644138975
yymsp[-3].minor.yy243 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy148,0,0,0,0,0,SF_Values,0,0);
138645138976
}
138646138977
break;
138647
- case 87: /* values ::= values COMMA LP exprlist RP */
138978
+ case 86: /* values ::= values COMMA LP exprlist RP */
138648138979
{
138649138980
Select *pRight, *pLeft = yymsp[-4].minor.yy243;
138650138981
pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy148,0,0,0,0,0,SF_Values|SF_MultiValue,0,0);
138651138982
if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
138652138983
if( pRight ){
@@ -138656,86 +138987,86 @@
138656138987
}else{
138657138988
yymsp[-4].minor.yy243 = pLeft;
138658138989
}
138659138990
}
138660138991
break;
138661
- case 88: /* distinct ::= DISTINCT */
138992
+ case 87: /* distinct ::= DISTINCT */
138662138993
{yymsp[0].minor.yy194 = SF_Distinct;}
138663138994
break;
138664
- case 89: /* distinct ::= ALL */
138995
+ case 88: /* distinct ::= ALL */
138665138996
{yymsp[0].minor.yy194 = SF_All;}
138666138997
break;
138667
- case 91: /* sclp ::= */
138668
- case 119: /* orderby_opt ::= */ yytestcase(yyruleno==119);
138669
- case 126: /* groupby_opt ::= */ yytestcase(yyruleno==126);
138670
- case 202: /* exprlist ::= */ yytestcase(yyruleno==202);
138671
- case 205: /* paren_exprlist ::= */ yytestcase(yyruleno==205);
138672
- case 210: /* eidlist_opt ::= */ yytestcase(yyruleno==210);
138998
+ case 90: /* sclp ::= */
138999
+ case 118: /* orderby_opt ::= */ yytestcase(yyruleno==118);
139000
+ case 125: /* groupby_opt ::= */ yytestcase(yyruleno==125);
139001
+ case 200: /* exprlist ::= */ yytestcase(yyruleno==200);
139002
+ case 203: /* paren_exprlist ::= */ yytestcase(yyruleno==203);
139003
+ case 208: /* eidlist_opt ::= */ yytestcase(yyruleno==208);
138673139004
{yymsp[1].minor.yy148 = 0;}
138674139005
break;
138675
- case 92: /* selcollist ::= sclp expr as */
139006
+ case 91: /* selcollist ::= sclp expr as */
138676139007
{
138677139008
yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy148, yymsp[-1].minor.yy190.pExpr);
138678139009
if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-2].minor.yy148, &yymsp[0].minor.yy0, 1);
138679139010
sqlite3ExprListSetSpan(pParse,yymsp[-2].minor.yy148,&yymsp[-1].minor.yy190);
138680139011
}
138681139012
break;
138682
- case 93: /* selcollist ::= sclp STAR */
139013
+ case 92: /* selcollist ::= sclp STAR */
138683139014
{
138684139015
Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
138685139016
yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy148, p);
138686139017
}
138687139018
break;
138688
- case 94: /* selcollist ::= sclp nm DOT STAR */
139019
+ case 93: /* selcollist ::= sclp nm DOT STAR */
138689139020
{
138690139021
Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
138691139022
Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
138692139023
Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
138693139024
yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, pDot);
138694139025
}
138695139026
break;
138696
- case 95: /* as ::= AS nm */
138697
- case 106: /* dbnm ::= DOT nm */ yytestcase(yyruleno==106);
138698
- case 224: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==224);
138699
- case 225: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==225);
139027
+ case 94: /* as ::= AS nm */
139028
+ case 105: /* dbnm ::= DOT nm */ yytestcase(yyruleno==105);
139029
+ case 222: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==222);
139030
+ case 223: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==223);
138700139031
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
138701139032
break;
138702
- case 97: /* from ::= */
139033
+ case 96: /* from ::= */
138703139034
{yymsp[1].minor.yy185 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy185));}
138704139035
break;
138705
- case 98: /* from ::= FROM seltablist */
139036
+ case 97: /* from ::= FROM seltablist */
138706139037
{
138707139038
yymsp[-1].minor.yy185 = yymsp[0].minor.yy185;
138708139039
sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy185);
138709139040
}
138710139041
break;
138711
- case 99: /* stl_prefix ::= seltablist joinop */
139042
+ case 98: /* stl_prefix ::= seltablist joinop */
138712139043
{
138713139044
if( ALWAYS(yymsp[-1].minor.yy185 && yymsp[-1].minor.yy185->nSrc>0) ) yymsp[-1].minor.yy185->a[yymsp[-1].minor.yy185->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy194;
138714139045
}
138715139046
break;
138716
- case 100: /* stl_prefix ::= */
139047
+ case 99: /* stl_prefix ::= */
138717139048
{yymsp[1].minor.yy185 = 0;}
138718139049
break;
138719
- case 101: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
139050
+ case 100: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
138720139051
{
138721139052
yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
138722139053
sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy185, &yymsp[-2].minor.yy0);
138723139054
}
138724139055
break;
138725
- case 102: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
139056
+ case 101: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
138726139057
{
138727139058
yymsp[-8].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy185,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
138728139059
sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy185, yymsp[-4].minor.yy148);
138729139060
}
138730139061
break;
138731
- case 103: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
139062
+ case 102: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
138732139063
{
138733139064
yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy243,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
138734139065
}
138735139066
break;
138736
- case 104: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
139067
+ case 103: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
138737139068
{
138738139069
if( yymsp[-6].minor.yy185==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy72==0 && yymsp[0].minor.yy254==0 ){
138739139070
yymsp[-6].minor.yy185 = yymsp[-4].minor.yy185;
138740139071
}else if( yymsp[-4].minor.yy185->nSrc==1 ){
138741139072
yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
@@ -138755,191 +139086,189 @@
138755139086
pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy185,0,0,0,0,SF_NestedFrom,0,0);
138756139087
yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
138757139088
}
138758139089
}
138759139090
break;
138760
- case 105: /* dbnm ::= */
138761
- case 114: /* indexed_opt ::= */ yytestcase(yyruleno==114);
139091
+ case 104: /* dbnm ::= */
139092
+ case 113: /* indexed_opt ::= */ yytestcase(yyruleno==113);
138762139093
{yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
138763139094
break;
138764
- case 107: /* fullname ::= nm dbnm */
139095
+ case 106: /* fullname ::= nm dbnm */
138765139096
{yymsp[-1].minor.yy185 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
138766139097
break;
138767
- case 108: /* joinop ::= COMMA|JOIN */
139098
+ case 107: /* joinop ::= COMMA|JOIN */
138768139099
{ yymsp[0].minor.yy194 = JT_INNER; }
138769139100
break;
138770
- case 109: /* joinop ::= JOIN_KW JOIN */
139101
+ case 108: /* joinop ::= JOIN_KW JOIN */
138771139102
{yymsp[-1].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
138772139103
break;
138773
- case 110: /* joinop ::= JOIN_KW nm JOIN */
139104
+ case 109: /* joinop ::= JOIN_KW nm JOIN */
138774139105
{yymsp[-2].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
138775139106
break;
138776
- case 111: /* joinop ::= JOIN_KW nm nm JOIN */
139107
+ case 110: /* joinop ::= JOIN_KW nm nm JOIN */
138777139108
{yymsp[-3].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
138778139109
break;
138779
- case 112: /* on_opt ::= ON expr */
138780
- case 129: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==129);
138781
- case 136: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==136);
138782
- case 198: /* case_else ::= ELSE expr */ yytestcase(yyruleno==198);
139110
+ case 111: /* on_opt ::= ON expr */
139111
+ case 128: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==128);
139112
+ case 135: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==135);
139113
+ case 196: /* case_else ::= ELSE expr */ yytestcase(yyruleno==196);
138783139114
{yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr;}
138784139115
break;
138785
- case 113: /* on_opt ::= */
138786
- case 128: /* having_opt ::= */ yytestcase(yyruleno==128);
138787
- case 135: /* where_opt ::= */ yytestcase(yyruleno==135);
138788
- case 199: /* case_else ::= */ yytestcase(yyruleno==199);
138789
- case 201: /* case_operand ::= */ yytestcase(yyruleno==201);
139116
+ case 112: /* on_opt ::= */
139117
+ case 127: /* having_opt ::= */ yytestcase(yyruleno==127);
139118
+ case 134: /* where_opt ::= */ yytestcase(yyruleno==134);
139119
+ case 197: /* case_else ::= */ yytestcase(yyruleno==197);
139120
+ case 199: /* case_operand ::= */ yytestcase(yyruleno==199);
138790139121
{yymsp[1].minor.yy72 = 0;}
138791139122
break;
138792
- case 115: /* indexed_opt ::= INDEXED BY nm */
139123
+ case 114: /* indexed_opt ::= INDEXED BY nm */
138793139124
{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
138794139125
break;
138795
- case 116: /* indexed_opt ::= NOT INDEXED */
139126
+ case 115: /* indexed_opt ::= NOT INDEXED */
138796139127
{yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
138797139128
break;
138798
- case 117: /* using_opt ::= USING LP idlist RP */
139129
+ case 116: /* using_opt ::= USING LP idlist RP */
138799139130
{yymsp[-3].minor.yy254 = yymsp[-1].minor.yy254;}
138800139131
break;
138801
- case 118: /* using_opt ::= */
138802
- case 146: /* idlist_opt ::= */ yytestcase(yyruleno==146);
139132
+ case 117: /* using_opt ::= */
139133
+ case 145: /* idlist_opt ::= */ yytestcase(yyruleno==145);
138803139134
{yymsp[1].minor.yy254 = 0;}
138804139135
break;
138805
- case 120: /* orderby_opt ::= ORDER BY sortlist */
138806
- case 127: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==127);
139136
+ case 119: /* orderby_opt ::= ORDER BY sortlist */
139137
+ case 126: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==126);
138807139138
{yymsp[-2].minor.yy148 = yymsp[0].minor.yy148;}
138808139139
break;
138809
- case 121: /* sortlist ::= sortlist COMMA expr sortorder */
139140
+ case 120: /* sortlist ::= sortlist COMMA expr sortorder */
138810139141
{
138811139142
yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148,yymsp[-1].minor.yy190.pExpr);
138812139143
sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy148,yymsp[0].minor.yy194);
138813139144
}
138814139145
break;
138815
- case 122: /* sortlist ::= expr sortorder */
139146
+ case 121: /* sortlist ::= expr sortorder */
138816139147
{
138817139148
yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy190.pExpr); /*A-overwrites-Y*/
138818139149
sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy148,yymsp[0].minor.yy194);
138819139150
}
138820139151
break;
138821
- case 123: /* sortorder ::= ASC */
139152
+ case 122: /* sortorder ::= ASC */
138822139153
{yymsp[0].minor.yy194 = SQLITE_SO_ASC;}
138823139154
break;
138824
- case 124: /* sortorder ::= DESC */
139155
+ case 123: /* sortorder ::= DESC */
138825139156
{yymsp[0].minor.yy194 = SQLITE_SO_DESC;}
138826139157
break;
138827
- case 125: /* sortorder ::= */
139158
+ case 124: /* sortorder ::= */
138828139159
{yymsp[1].minor.yy194 = SQLITE_SO_UNDEFINED;}
138829139160
break;
138830
- case 130: /* limit_opt ::= */
139161
+ case 129: /* limit_opt ::= */
138831139162
{yymsp[1].minor.yy354.pLimit = 0; yymsp[1].minor.yy354.pOffset = 0;}
138832139163
break;
138833
- case 131: /* limit_opt ::= LIMIT expr */
139164
+ case 130: /* limit_opt ::= LIMIT expr */
138834139165
{yymsp[-1].minor.yy354.pLimit = yymsp[0].minor.yy190.pExpr; yymsp[-1].minor.yy354.pOffset = 0;}
138835139166
break;
138836
- case 132: /* limit_opt ::= LIMIT expr OFFSET expr */
139167
+ case 131: /* limit_opt ::= LIMIT expr OFFSET expr */
138837139168
{yymsp[-3].minor.yy354.pLimit = yymsp[-2].minor.yy190.pExpr; yymsp[-3].minor.yy354.pOffset = yymsp[0].minor.yy190.pExpr;}
138838139169
break;
138839
- case 133: /* limit_opt ::= LIMIT expr COMMA expr */
139170
+ case 132: /* limit_opt ::= LIMIT expr COMMA expr */
138840139171
{yymsp[-3].minor.yy354.pOffset = yymsp[-2].minor.yy190.pExpr; yymsp[-3].minor.yy354.pLimit = yymsp[0].minor.yy190.pExpr;}
138841139172
break;
138842
- case 134: /* cmd ::= with DELETE FROM fullname indexed_opt where_opt */
139173
+ case 133: /* cmd ::= with DELETE FROM fullname indexed_opt where_opt */
138843139174
{
138844139175
sqlite3WithPush(pParse, yymsp[-5].minor.yy285, 1);
138845139176
sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy185, &yymsp[-1].minor.yy0);
138846139177
sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy185,yymsp[0].minor.yy72);
138847139178
}
138848139179
break;
138849
- case 137: /* cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */
139180
+ case 136: /* cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */
138850139181
{
138851139182
sqlite3WithPush(pParse, yymsp[-7].minor.yy285, 1);
138852139183
sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy185, &yymsp[-3].minor.yy0);
138853139184
sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy148,"set list");
138854139185
sqlite3Update(pParse,yymsp[-4].minor.yy185,yymsp[-1].minor.yy148,yymsp[0].minor.yy72,yymsp[-5].minor.yy194);
138855139186
}
138856139187
break;
138857
- case 138: /* setlist ::= setlist COMMA nm EQ expr */
139188
+ case 137: /* setlist ::= setlist COMMA nm EQ expr */
138858139189
{
138859139190
yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr);
138860139191
sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, 1);
138861139192
}
138862139193
break;
138863
- case 139: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
139194
+ case 138: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
138864139195
{
138865139196
yymsp[-6].minor.yy148 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy148, yymsp[-3].minor.yy254, yymsp[0].minor.yy190.pExpr);
138866139197
}
138867139198
break;
138868
- case 140: /* setlist ::= nm EQ expr */
139199
+ case 139: /* setlist ::= nm EQ expr */
138869139200
{
138870139201
yylhsminor.yy148 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy190.pExpr);
138871139202
sqlite3ExprListSetName(pParse, yylhsminor.yy148, &yymsp[-2].minor.yy0, 1);
138872139203
}
138873139204
yymsp[-2].minor.yy148 = yylhsminor.yy148;
138874139205
break;
138875
- case 141: /* setlist ::= LP idlist RP EQ expr */
139206
+ case 140: /* setlist ::= LP idlist RP EQ expr */
138876139207
{
138877139208
yymsp[-4].minor.yy148 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy254, yymsp[0].minor.yy190.pExpr);
138878139209
}
138879139210
break;
138880
- case 142: /* cmd ::= with insert_cmd INTO fullname idlist_opt select */
139211
+ case 141: /* cmd ::= with insert_cmd INTO fullname idlist_opt select */
138881139212
{
138882139213
sqlite3WithPush(pParse, yymsp[-5].minor.yy285, 1);
138883139214
sqlite3Insert(pParse, yymsp[-2].minor.yy185, yymsp[0].minor.yy243, yymsp[-1].minor.yy254, yymsp[-4].minor.yy194);
138884139215
}
138885139216
break;
138886
- case 143: /* cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */
139217
+ case 142: /* cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */
138887139218
{
138888139219
sqlite3WithPush(pParse, yymsp[-6].minor.yy285, 1);
138889139220
sqlite3Insert(pParse, yymsp[-3].minor.yy185, 0, yymsp[-2].minor.yy254, yymsp[-5].minor.yy194);
138890139221
}
138891139222
break;
138892
- case 147: /* idlist_opt ::= LP idlist RP */
139223
+ case 146: /* idlist_opt ::= LP idlist RP */
138893139224
{yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;}
138894139225
break;
138895
- case 148: /* idlist ::= idlist COMMA nm */
139226
+ case 147: /* idlist ::= idlist COMMA nm */
138896139227
{yymsp[-2].minor.yy254 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
138897139228
break;
138898
- case 149: /* idlist ::= nm */
139229
+ case 148: /* idlist ::= nm */
138899139230
{yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
138900139231
break;
138901
- case 150: /* expr ::= LP expr RP */
139232
+ case 149: /* expr ::= LP expr RP */
138902139233
{spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ yymsp[-2].minor.yy190.pExpr = yymsp[-1].minor.yy190.pExpr;}
138903139234
break;
138904
- case 151: /* term ::= NULL */
138905
- case 156: /* term ::= FLOAT|BLOB */ yytestcase(yyruleno==156);
138906
- case 157: /* term ::= STRING */ yytestcase(yyruleno==157);
138907
-{spanExpr(&yymsp[0].minor.yy190,pParse,yymsp[0].major,yymsp[0].minor.yy0);/*A-overwrites-X*/}
138908
- break;
138909
- case 152: /* expr ::= ID|INDEXED */
138910
- case 153: /* expr ::= JOIN_KW */ yytestcase(yyruleno==153);
139235
+ case 150: /* expr ::= ID|INDEXED */
139236
+ case 151: /* expr ::= JOIN_KW */ yytestcase(yyruleno==151);
138911139237
{spanExpr(&yymsp[0].minor.yy190,pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
138912139238
break;
138913
- case 154: /* expr ::= nm DOT nm */
139239
+ case 152: /* expr ::= nm DOT nm */
138914139240
{
138915139241
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
138916139242
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
138917139243
spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
138918139244
yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
138919139245
}
138920139246
break;
138921
- case 155: /* expr ::= nm DOT nm DOT nm */
139247
+ case 153: /* expr ::= nm DOT nm DOT nm */
138922139248
{
138923139249
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
138924139250
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
138925139251
Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
138926139252
Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
138927139253
spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
138928139254
yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
138929139255
}
138930139256
break;
138931
- case 158: /* term ::= INTEGER */
139257
+ case 154: /* term ::= NULL|FLOAT|BLOB */
139258
+ case 155: /* term ::= STRING */ yytestcase(yyruleno==155);
139259
+{spanExpr(&yymsp[0].minor.yy190,pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
139260
+ break;
139261
+ case 156: /* term ::= INTEGER */
138932139262
{
138933139263
yylhsminor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
138934139264
yylhsminor.yy190.zStart = yymsp[0].minor.yy0.z;
138935139265
yylhsminor.yy190.zEnd = yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n;
138936
- if( yylhsminor.yy190.pExpr ) yylhsminor.yy190.pExpr->flags |= EP_Leaf|EP_Resolved;
138937139266
}
138938139267
yymsp[0].minor.yy190 = yylhsminor.yy190;
138939139268
break;
138940
- case 159: /* expr ::= VARIABLE */
139269
+ case 157: /* expr ::= VARIABLE */
138941139270
{
138942139271
if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
138943139272
u32 n = yymsp[0].minor.yy0.n;
138944139273
spanExpr(&yymsp[0].minor.yy190, pParse, TK_VARIABLE, yymsp[0].minor.yy0);
138945139274
sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy190.pExpr, n);
@@ -138958,24 +139287,24 @@
138958139287
if( yymsp[0].minor.yy190.pExpr ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy190.pExpr->iTable);
138959139288
}
138960139289
}
138961139290
}
138962139291
break;
138963
- case 160: /* expr ::= expr COLLATE ID|STRING */
139292
+ case 158: /* expr ::= expr COLLATE ID|STRING */
138964139293
{
138965139294
yymsp[-2].minor.yy190.pExpr = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy190.pExpr, &yymsp[0].minor.yy0, 1);
138966139295
yymsp[-2].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
138967139296
}
138968139297
break;
138969
- case 161: /* expr ::= CAST LP expr AS typetoken RP */
139298
+ case 159: /* expr ::= CAST LP expr AS typetoken RP */
138970139299
{
138971139300
spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
138972139301
yymsp[-5].minor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
138973139302
sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, 0);
138974139303
}
138975139304
break;
138976
- case 162: /* expr ::= ID|INDEXED LP distinct exprlist RP */
139305
+ case 160: /* expr ::= ID|INDEXED LP distinct exprlist RP */
138977139306
{
138978139307
if( yymsp[-1].minor.yy148 && yymsp[-1].minor.yy148->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
138979139308
sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
138980139309
}
138981139310
yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy148, &yymsp[-4].minor.yy0);
@@ -138984,25 +139313,25 @@
138984139313
yylhsminor.yy190.pExpr->flags |= EP_Distinct;
138985139314
}
138986139315
}
138987139316
yymsp[-4].minor.yy190 = yylhsminor.yy190;
138988139317
break;
138989
- case 163: /* expr ::= ID|INDEXED LP STAR RP */
139318
+ case 161: /* expr ::= ID|INDEXED LP STAR RP */
138990139319
{
138991139320
yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
138992139321
spanSet(&yylhsminor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
138993139322
}
138994139323
yymsp[-3].minor.yy190 = yylhsminor.yy190;
138995139324
break;
138996
- case 164: /* term ::= CTIME_KW */
139325
+ case 162: /* term ::= CTIME_KW */
138997139326
{
138998139327
yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0);
138999139328
spanSet(&yylhsminor.yy190, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
139000139329
}
139001139330
yymsp[0].minor.yy190 = yylhsminor.yy190;
139002139331
break;
139003
- case 165: /* expr ::= LP nexprlist COMMA expr RP */
139332
+ case 163: /* expr ::= LP nexprlist COMMA expr RP */
139004139333
{
139005139334
ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy148, yymsp[-1].minor.yy190.pExpr);
139006139335
yylhsminor.yy190.pExpr = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
139007139336
if( yylhsminor.yy190.pExpr ){
139008139337
yylhsminor.yy190.pExpr->x.pList = pList;
@@ -139011,24 +139340,24 @@
139011139340
sqlite3ExprListDelete(pParse->db, pList);
139012139341
}
139013139342
}
139014139343
yymsp[-4].minor.yy190 = yylhsminor.yy190;
139015139344
break;
139016
- case 166: /* expr ::= expr AND expr */
139017
- case 167: /* expr ::= expr OR expr */ yytestcase(yyruleno==167);
139018
- case 168: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==168);
139019
- case 169: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==169);
139020
- case 170: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==170);
139021
- case 171: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==171);
139022
- case 172: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==172);
139023
- case 173: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==173);
139345
+ case 164: /* expr ::= expr AND expr */
139346
+ case 165: /* expr ::= expr OR expr */ yytestcase(yyruleno==165);
139347
+ case 166: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==166);
139348
+ case 167: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==167);
139349
+ case 168: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==168);
139350
+ case 169: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==169);
139351
+ case 170: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==170);
139352
+ case 171: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==171);
139024139353
{spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);}
139025139354
break;
139026
- case 174: /* likeop ::= NOT LIKE_KW|MATCH */
139355
+ case 172: /* likeop ::= NOT LIKE_KW|MATCH */
139027139356
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
139028139357
break;
139029
- case 175: /* expr ::= expr likeop expr */
139358
+ case 173: /* expr ::= expr likeop expr */
139030139359
{
139031139360
ExprList *pList;
139032139361
int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
139033139362
yymsp[-1].minor.yy0.n &= 0x7fffffff;
139034139363
pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy190.pExpr);
@@ -139037,11 +139366,11 @@
139037139366
exprNot(pParse, bNot, &yymsp[-2].minor.yy190);
139038139367
yymsp[-2].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
139039139368
if( yymsp[-2].minor.yy190.pExpr ) yymsp[-2].minor.yy190.pExpr->flags |= EP_InfixFunc;
139040139369
}
139041139370
break;
139042
- case 176: /* expr ::= expr likeop expr ESCAPE expr */
139371
+ case 174: /* expr ::= expr likeop expr ESCAPE expr */
139043139372
{
139044139373
ExprList *pList;
139045139374
int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
139046139375
yymsp[-3].minor.yy0.n &= 0x7fffffff;
139047139376
pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
@@ -139051,43 +139380,43 @@
139051139380
exprNot(pParse, bNot, &yymsp[-4].minor.yy190);
139052139381
yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
139053139382
if( yymsp[-4].minor.yy190.pExpr ) yymsp[-4].minor.yy190.pExpr->flags |= EP_InfixFunc;
139054139383
}
139055139384
break;
139056
- case 177: /* expr ::= expr ISNULL|NOTNULL */
139385
+ case 175: /* expr ::= expr ISNULL|NOTNULL */
139057139386
{spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy190,&yymsp[0].minor.yy0);}
139058139387
break;
139059
- case 178: /* expr ::= expr NOT NULL */
139388
+ case 176: /* expr ::= expr NOT NULL */
139060139389
{spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy0);}
139061139390
break;
139062
- case 179: /* expr ::= expr IS expr */
139391
+ case 177: /* expr ::= expr IS expr */
139063139392
{
139064139393
spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);
139065139394
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-2].minor.yy190.pExpr, TK_ISNULL);
139066139395
}
139067139396
break;
139068
- case 180: /* expr ::= expr IS NOT expr */
139397
+ case 178: /* expr ::= expr IS NOT expr */
139069139398
{
139070139399
spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy190,&yymsp[0].minor.yy190);
139071139400
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, TK_NOTNULL);
139072139401
}
139073139402
break;
139074
- case 181: /* expr ::= NOT expr */
139075
- case 182: /* expr ::= BITNOT expr */ yytestcase(yyruleno==182);
139403
+ case 179: /* expr ::= NOT expr */
139404
+ case 180: /* expr ::= BITNOT expr */ yytestcase(yyruleno==180);
139076139405
{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,yymsp[-1].major,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
139077139406
break;
139078
- case 183: /* expr ::= MINUS expr */
139407
+ case 181: /* expr ::= MINUS expr */
139079139408
{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UMINUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
139080139409
break;
139081
- case 184: /* expr ::= PLUS expr */
139410
+ case 182: /* expr ::= PLUS expr */
139082139411
{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UPLUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
139083139412
break;
139084
- case 185: /* between_op ::= BETWEEN */
139085
- case 188: /* in_op ::= IN */ yytestcase(yyruleno==188);
139413
+ case 183: /* between_op ::= BETWEEN */
139414
+ case 186: /* in_op ::= IN */ yytestcase(yyruleno==186);
139086139415
{yymsp[0].minor.yy194 = 0;}
139087139416
break;
139088
- case 187: /* expr ::= expr between_op expr AND expr */
139417
+ case 185: /* expr ::= expr between_op expr AND expr */
139089139418
{
139090139419
ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
139091139420
pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr);
139092139421
yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy190.pExpr, 0);
139093139422
if( yymsp[-4].minor.yy190.pExpr ){
@@ -139097,11 +139426,11 @@
139097139426
}
139098139427
exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
139099139428
yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
139100139429
}
139101139430
break;
139102
- case 190: /* expr ::= expr in_op LP exprlist RP */
139431
+ case 188: /* expr ::= expr in_op LP exprlist RP */
139103139432
{
139104139433
if( yymsp[-1].minor.yy148==0 ){
139105139434
/* Expressions of the form
139106139435
**
139107139436
** expr1 IN ()
@@ -139150,26 +139479,26 @@
139150139479
exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
139151139480
}
139152139481
yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
139153139482
}
139154139483
break;
139155
- case 191: /* expr ::= LP select RP */
139484
+ case 189: /* expr ::= LP select RP */
139156139485
{
139157139486
spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
139158139487
yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
139159139488
sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy190.pExpr, yymsp[-1].minor.yy243);
139160139489
}
139161139490
break;
139162
- case 192: /* expr ::= expr in_op LP select RP */
139491
+ case 190: /* expr ::= expr in_op LP select RP */
139163139492
{
139164139493
yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0);
139165139494
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, yymsp[-1].minor.yy243);
139166139495
exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
139167139496
yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
139168139497
}
139169139498
break;
139170
- case 193: /* expr ::= expr in_op nm dbnm paren_exprlist */
139499
+ case 191: /* expr ::= expr in_op nm dbnm paren_exprlist */
139171139500
{
139172139501
SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
139173139502
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
139174139503
if( yymsp[0].minor.yy148 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy148);
139175139504
yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0);
@@ -139176,19 +139505,19 @@
139176139505
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, pSelect);
139177139506
exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
139178139507
yymsp[-4].minor.yy190.zEnd = yymsp[-1].minor.yy0.z ? &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n] : &yymsp[-2].minor.yy0.z[yymsp[-2].minor.yy0.n];
139179139508
}
139180139509
break;
139181
- case 194: /* expr ::= EXISTS LP select RP */
139510
+ case 192: /* expr ::= EXISTS LP select RP */
139182139511
{
139183139512
Expr *p;
139184139513
spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
139185139514
p = yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
139186139515
sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy243);
139187139516
}
139188139517
break;
139189
- case 195: /* expr ::= CASE case_operand case_exprlist case_else END */
139518
+ case 193: /* expr ::= CASE case_operand case_exprlist case_else END */
139190139519
{
139191139520
spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-C*/
139192139521
yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy72, 0);
139193139522
if( yymsp[-4].minor.yy190.pExpr ){
139194139523
yymsp[-4].minor.yy190.pExpr->x.pList = yymsp[-1].minor.yy72 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[-1].minor.yy72) : yymsp[-2].minor.yy148;
@@ -139197,332 +139526,332 @@
139197139526
sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy148);
139198139527
sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy72);
139199139528
}
139200139529
}
139201139530
break;
139202
- case 196: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
139531
+ case 194: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
139203139532
{
139204139533
yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[-2].minor.yy190.pExpr);
139205139534
yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr);
139206139535
}
139207139536
break;
139208
- case 197: /* case_exprlist ::= WHEN expr THEN expr */
139537
+ case 195: /* case_exprlist ::= WHEN expr THEN expr */
139209139538
{
139210139539
yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
139211139540
yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, yymsp[0].minor.yy190.pExpr);
139212139541
}
139213139542
break;
139214
- case 200: /* case_operand ::= expr */
139543
+ case 198: /* case_operand ::= expr */
139215139544
{yymsp[0].minor.yy72 = yymsp[0].minor.yy190.pExpr; /*A-overwrites-X*/}
139216139545
break;
139217
- case 203: /* nexprlist ::= nexprlist COMMA expr */
139546
+ case 201: /* nexprlist ::= nexprlist COMMA expr */
139218139547
{yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[0].minor.yy190.pExpr);}
139219139548
break;
139220
- case 204: /* nexprlist ::= expr */
139549
+ case 202: /* nexprlist ::= expr */
139221139550
{yymsp[0].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy190.pExpr); /*A-overwrites-Y*/}
139222139551
break;
139223
- case 206: /* paren_exprlist ::= LP exprlist RP */
139224
- case 211: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==211);
139552
+ case 204: /* paren_exprlist ::= LP exprlist RP */
139553
+ case 209: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==209);
139225139554
{yymsp[-2].minor.yy148 = yymsp[-1].minor.yy148;}
139226139555
break;
139227
- case 207: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
139556
+ case 205: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
139228139557
{
139229139558
sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
139230139559
sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy148, yymsp[-10].minor.yy194,
139231139560
&yymsp[-11].minor.yy0, yymsp[0].minor.yy72, SQLITE_SO_ASC, yymsp[-8].minor.yy194, SQLITE_IDXTYPE_APPDEF);
139232139561
}
139233139562
break;
139234
- case 208: /* uniqueflag ::= UNIQUE */
139235
- case 248: /* raisetype ::= ABORT */ yytestcase(yyruleno==248);
139563
+ case 206: /* uniqueflag ::= UNIQUE */
139564
+ case 246: /* raisetype ::= ABORT */ yytestcase(yyruleno==246);
139236139565
{yymsp[0].minor.yy194 = OE_Abort;}
139237139566
break;
139238
- case 209: /* uniqueflag ::= */
139567
+ case 207: /* uniqueflag ::= */
139239139568
{yymsp[1].minor.yy194 = OE_None;}
139240139569
break;
139241
- case 212: /* eidlist ::= eidlist COMMA nm collate sortorder */
139570
+ case 210: /* eidlist ::= eidlist COMMA nm collate sortorder */
139242139571
{
139243139572
yymsp[-4].minor.yy148 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194);
139244139573
}
139245139574
break;
139246
- case 213: /* eidlist ::= nm collate sortorder */
139575
+ case 211: /* eidlist ::= nm collate sortorder */
139247139576
{
139248139577
yymsp[-2].minor.yy148 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); /*A-overwrites-Y*/
139249139578
}
139250139579
break;
139251
- case 216: /* cmd ::= DROP INDEX ifexists fullname */
139580
+ case 214: /* cmd ::= DROP INDEX ifexists fullname */
139252139581
{sqlite3DropIndex(pParse, yymsp[0].minor.yy185, yymsp[-1].minor.yy194);}
139253139582
break;
139254
- case 217: /* cmd ::= VACUUM */
139583
+ case 215: /* cmd ::= VACUUM */
139255139584
{sqlite3Vacuum(pParse,0);}
139256139585
break;
139257
- case 218: /* cmd ::= VACUUM nm */
139586
+ case 216: /* cmd ::= VACUUM nm */
139258139587
{sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);}
139259139588
break;
139260
- case 219: /* cmd ::= PRAGMA nm dbnm */
139589
+ case 217: /* cmd ::= PRAGMA nm dbnm */
139261139590
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
139262139591
break;
139263
- case 220: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
139592
+ case 218: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
139264139593
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
139265139594
break;
139266
- case 221: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
139595
+ case 219: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
139267139596
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
139268139597
break;
139269
- case 222: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
139598
+ case 220: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
139270139599
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
139271139600
break;
139272
- case 223: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
139601
+ case 221: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
139273139602
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
139274139603
break;
139275
- case 226: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
139604
+ case 224: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
139276139605
{
139277139606
Token all;
139278139607
all.z = yymsp[-3].minor.yy0.z;
139279139608
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
139280139609
sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy145, &all);
139281139610
}
139282139611
break;
139283
- case 227: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
139612
+ case 225: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
139284139613
{
139285139614
sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy194, yymsp[-4].minor.yy332.a, yymsp[-4].minor.yy332.b, yymsp[-2].minor.yy185, yymsp[0].minor.yy72, yymsp[-10].minor.yy194, yymsp[-8].minor.yy194);
139286139615
yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
139287139616
}
139288139617
break;
139289
- case 228: /* trigger_time ::= BEFORE|AFTER */
139618
+ case 226: /* trigger_time ::= BEFORE|AFTER */
139290139619
{ yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-X*/ }
139291139620
break;
139292
- case 229: /* trigger_time ::= INSTEAD OF */
139621
+ case 227: /* trigger_time ::= INSTEAD OF */
139293139622
{ yymsp[-1].minor.yy194 = TK_INSTEAD;}
139294139623
break;
139295
- case 230: /* trigger_time ::= */
139624
+ case 228: /* trigger_time ::= */
139296139625
{ yymsp[1].minor.yy194 = TK_BEFORE; }
139297139626
break;
139298
- case 231: /* trigger_event ::= DELETE|INSERT */
139299
- case 232: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==232);
139627
+ case 229: /* trigger_event ::= DELETE|INSERT */
139628
+ case 230: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==230);
139300139629
{yymsp[0].minor.yy332.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy332.b = 0;}
139301139630
break;
139302
- case 233: /* trigger_event ::= UPDATE OF idlist */
139631
+ case 231: /* trigger_event ::= UPDATE OF idlist */
139303139632
{yymsp[-2].minor.yy332.a = TK_UPDATE; yymsp[-2].minor.yy332.b = yymsp[0].minor.yy254;}
139304139633
break;
139305
- case 234: /* when_clause ::= */
139306
- case 253: /* key_opt ::= */ yytestcase(yyruleno==253);
139634
+ case 232: /* when_clause ::= */
139635
+ case 251: /* key_opt ::= */ yytestcase(yyruleno==251);
139307139636
{ yymsp[1].minor.yy72 = 0; }
139308139637
break;
139309
- case 235: /* when_clause ::= WHEN expr */
139310
- case 254: /* key_opt ::= KEY expr */ yytestcase(yyruleno==254);
139638
+ case 233: /* when_clause ::= WHEN expr */
139639
+ case 252: /* key_opt ::= KEY expr */ yytestcase(yyruleno==252);
139311139640
{ yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr; }
139312139641
break;
139313
- case 236: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
139642
+ case 234: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
139314139643
{
139315139644
assert( yymsp[-2].minor.yy145!=0 );
139316139645
yymsp[-2].minor.yy145->pLast->pNext = yymsp[-1].minor.yy145;
139317139646
yymsp[-2].minor.yy145->pLast = yymsp[-1].minor.yy145;
139318139647
}
139319139648
break;
139320
- case 237: /* trigger_cmd_list ::= trigger_cmd SEMI */
139649
+ case 235: /* trigger_cmd_list ::= trigger_cmd SEMI */
139321139650
{
139322139651
assert( yymsp[-1].minor.yy145!=0 );
139323139652
yymsp[-1].minor.yy145->pLast = yymsp[-1].minor.yy145;
139324139653
}
139325139654
break;
139326
- case 238: /* trnm ::= nm DOT nm */
139655
+ case 236: /* trnm ::= nm DOT nm */
139327139656
{
139328139657
yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
139329139658
sqlite3ErrorMsg(pParse,
139330139659
"qualified table names are not allowed on INSERT, UPDATE, and DELETE "
139331139660
"statements within triggers");
139332139661
}
139333139662
break;
139334
- case 239: /* tridxby ::= INDEXED BY nm */
139663
+ case 237: /* tridxby ::= INDEXED BY nm */
139335139664
{
139336139665
sqlite3ErrorMsg(pParse,
139337139666
"the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
139338139667
"within triggers");
139339139668
}
139340139669
break;
139341
- case 240: /* tridxby ::= NOT INDEXED */
139670
+ case 238: /* tridxby ::= NOT INDEXED */
139342139671
{
139343139672
sqlite3ErrorMsg(pParse,
139344139673
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
139345139674
"within triggers");
139346139675
}
139347139676
break;
139348
- case 241: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
139677
+ case 239: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
139349139678
{yymsp[-6].minor.yy145 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy148, yymsp[0].minor.yy72, yymsp[-5].minor.yy194);}
139350139679
break;
139351
- case 242: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */
139680
+ case 240: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */
139352139681
{yymsp[-4].minor.yy145 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy254, yymsp[0].minor.yy243, yymsp[-4].minor.yy194);/*A-overwrites-R*/}
139353139682
break;
139354
- case 243: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
139683
+ case 241: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
139355139684
{yymsp[-4].minor.yy145 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy72);}
139356139685
break;
139357
- case 244: /* trigger_cmd ::= select */
139686
+ case 242: /* trigger_cmd ::= select */
139358139687
{yymsp[0].minor.yy145 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy243); /*A-overwrites-X*/}
139359139688
break;
139360
- case 245: /* expr ::= RAISE LP IGNORE RP */
139689
+ case 243: /* expr ::= RAISE LP IGNORE RP */
139361139690
{
139362139691
spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
139363139692
yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
139364139693
if( yymsp[-3].minor.yy190.pExpr ){
139365139694
yymsp[-3].minor.yy190.pExpr->affinity = OE_Ignore;
139366139695
}
139367139696
}
139368139697
break;
139369
- case 246: /* expr ::= RAISE LP raisetype COMMA nm RP */
139698
+ case 244: /* expr ::= RAISE LP raisetype COMMA nm RP */
139370139699
{
139371139700
spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
139372139701
yymsp[-5].minor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
139373139702
if( yymsp[-5].minor.yy190.pExpr ) {
139374139703
yymsp[-5].minor.yy190.pExpr->affinity = (char)yymsp[-3].minor.yy194;
139375139704
}
139376139705
}
139377139706
break;
139378
- case 247: /* raisetype ::= ROLLBACK */
139707
+ case 245: /* raisetype ::= ROLLBACK */
139379139708
{yymsp[0].minor.yy194 = OE_Rollback;}
139380139709
break;
139381
- case 249: /* raisetype ::= FAIL */
139710
+ case 247: /* raisetype ::= FAIL */
139382139711
{yymsp[0].minor.yy194 = OE_Fail;}
139383139712
break;
139384
- case 250: /* cmd ::= DROP TRIGGER ifexists fullname */
139713
+ case 248: /* cmd ::= DROP TRIGGER ifexists fullname */
139385139714
{
139386139715
sqlite3DropTrigger(pParse,yymsp[0].minor.yy185,yymsp[-1].minor.yy194);
139387139716
}
139388139717
break;
139389
- case 251: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
139718
+ case 249: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
139390139719
{
139391139720
sqlite3Attach(pParse, yymsp[-3].minor.yy190.pExpr, yymsp[-1].minor.yy190.pExpr, yymsp[0].minor.yy72);
139392139721
}
139393139722
break;
139394
- case 252: /* cmd ::= DETACH database_kw_opt expr */
139723
+ case 250: /* cmd ::= DETACH database_kw_opt expr */
139395139724
{
139396139725
sqlite3Detach(pParse, yymsp[0].minor.yy190.pExpr);
139397139726
}
139398139727
break;
139399
- case 255: /* cmd ::= REINDEX */
139728
+ case 253: /* cmd ::= REINDEX */
139400139729
{sqlite3Reindex(pParse, 0, 0);}
139401139730
break;
139402
- case 256: /* cmd ::= REINDEX nm dbnm */
139731
+ case 254: /* cmd ::= REINDEX nm dbnm */
139403139732
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
139404139733
break;
139405
- case 257: /* cmd ::= ANALYZE */
139734
+ case 255: /* cmd ::= ANALYZE */
139406139735
{sqlite3Analyze(pParse, 0, 0);}
139407139736
break;
139408
- case 258: /* cmd ::= ANALYZE nm dbnm */
139737
+ case 256: /* cmd ::= ANALYZE nm dbnm */
139409139738
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
139410139739
break;
139411
- case 259: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
139740
+ case 257: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
139412139741
{
139413139742
sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy185,&yymsp[0].minor.yy0);
139414139743
}
139415139744
break;
139416
- case 260: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
139745
+ case 258: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
139417139746
{
139418139747
yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
139419139748
sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
139420139749
}
139421139750
break;
139422
- case 261: /* add_column_fullname ::= fullname */
139751
+ case 259: /* add_column_fullname ::= fullname */
139423139752
{
139424139753
disableLookaside(pParse);
139425139754
sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy185);
139426139755
}
139427139756
break;
139428
- case 262: /* cmd ::= create_vtab */
139757
+ case 260: /* cmd ::= create_vtab */
139429139758
{sqlite3VtabFinishParse(pParse,0);}
139430139759
break;
139431
- case 263: /* cmd ::= create_vtab LP vtabarglist RP */
139760
+ case 261: /* cmd ::= create_vtab LP vtabarglist RP */
139432139761
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
139433139762
break;
139434
- case 264: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
139763
+ case 262: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
139435139764
{
139436139765
sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy194);
139437139766
}
139438139767
break;
139439
- case 265: /* vtabarg ::= */
139768
+ case 263: /* vtabarg ::= */
139440139769
{sqlite3VtabArgInit(pParse);}
139441139770
break;
139442
- case 266: /* vtabargtoken ::= ANY */
139443
- case 267: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==267);
139444
- case 268: /* lp ::= LP */ yytestcase(yyruleno==268);
139771
+ case 264: /* vtabargtoken ::= ANY */
139772
+ case 265: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==265);
139773
+ case 266: /* lp ::= LP */ yytestcase(yyruleno==266);
139445139774
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
139446139775
break;
139447
- case 269: /* with ::= */
139776
+ case 267: /* with ::= */
139448139777
{yymsp[1].minor.yy285 = 0;}
139449139778
break;
139450
- case 270: /* with ::= WITH wqlist */
139779
+ case 268: /* with ::= WITH wqlist */
139451139780
{ yymsp[-1].minor.yy285 = yymsp[0].minor.yy285; }
139452139781
break;
139453
- case 271: /* with ::= WITH RECURSIVE wqlist */
139782
+ case 269: /* with ::= WITH RECURSIVE wqlist */
139454139783
{ yymsp[-2].minor.yy285 = yymsp[0].minor.yy285; }
139455139784
break;
139456
- case 272: /* wqlist ::= nm eidlist_opt AS LP select RP */
139785
+ case 270: /* wqlist ::= nm eidlist_opt AS LP select RP */
139457139786
{
139458139787
yymsp[-5].minor.yy285 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); /*A-overwrites-X*/
139459139788
}
139460139789
break;
139461
- case 273: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
139790
+ case 271: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
139462139791
{
139463139792
yymsp[-7].minor.yy285 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy285, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243);
139464139793
}
139465139794
break;
139466139795
default:
139467
- /* (274) input ::= cmdlist */ yytestcase(yyruleno==274);
139468
- /* (275) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==275);
139469
- /* (276) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=276);
139470
- /* (277) ecmd ::= SEMI */ yytestcase(yyruleno==277);
139471
- /* (278) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==278);
139472
- /* (279) explain ::= */ yytestcase(yyruleno==279);
139473
- /* (280) trans_opt ::= */ yytestcase(yyruleno==280);
139474
- /* (281) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==281);
139475
- /* (282) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==282);
139476
- /* (283) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==283);
139477
- /* (284) savepoint_opt ::= */ yytestcase(yyruleno==284);
139478
- /* (285) cmd ::= create_table create_table_args */ yytestcase(yyruleno==285);
139479
- /* (286) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==286);
139480
- /* (287) columnlist ::= columnname carglist */ yytestcase(yyruleno==287);
139481
- /* (288) nm ::= ID|INDEXED */ yytestcase(yyruleno==288);
139482
- /* (289) nm ::= STRING */ yytestcase(yyruleno==289);
139483
- /* (290) nm ::= JOIN_KW */ yytestcase(yyruleno==290);
139484
- /* (291) typetoken ::= typename */ yytestcase(yyruleno==291);
139485
- /* (292) typename ::= ID|STRING */ yytestcase(yyruleno==292);
139486
- /* (293) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=293);
139487
- /* (294) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=294);
139488
- /* (295) carglist ::= carglist ccons */ yytestcase(yyruleno==295);
139489
- /* (296) carglist ::= */ yytestcase(yyruleno==296);
139490
- /* (297) ccons ::= NULL onconf */ yytestcase(yyruleno==297);
139491
- /* (298) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==298);
139492
- /* (299) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==299);
139493
- /* (300) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=300);
139494
- /* (301) tconscomma ::= */ yytestcase(yyruleno==301);
139495
- /* (302) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=302);
139496
- /* (303) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=303);
139497
- /* (304) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=304);
139498
- /* (305) oneselect ::= values */ yytestcase(yyruleno==305);
139499
- /* (306) sclp ::= selcollist COMMA */ yytestcase(yyruleno==306);
139500
- /* (307) as ::= ID|STRING */ yytestcase(yyruleno==307);
139501
- /* (308) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=308);
139502
- /* (309) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==309);
139503
- /* (310) exprlist ::= nexprlist */ yytestcase(yyruleno==310);
139504
- /* (311) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=311);
139505
- /* (312) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=312);
139506
- /* (313) nmnum ::= ON */ yytestcase(yyruleno==313);
139507
- /* (314) nmnum ::= DELETE */ yytestcase(yyruleno==314);
139508
- /* (315) nmnum ::= DEFAULT */ yytestcase(yyruleno==315);
139509
- /* (316) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==316);
139510
- /* (317) foreach_clause ::= */ yytestcase(yyruleno==317);
139511
- /* (318) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==318);
139512
- /* (319) trnm ::= nm */ yytestcase(yyruleno==319);
139513
- /* (320) tridxby ::= */ yytestcase(yyruleno==320);
139514
- /* (321) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==321);
139515
- /* (322) database_kw_opt ::= */ yytestcase(yyruleno==322);
139516
- /* (323) kwcolumn_opt ::= */ yytestcase(yyruleno==323);
139517
- /* (324) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==324);
139518
- /* (325) vtabarglist ::= vtabarg */ yytestcase(yyruleno==325);
139519
- /* (326) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==326);
139520
- /* (327) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==327);
139521
- /* (328) anylist ::= */ yytestcase(yyruleno==328);
139522
- /* (329) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==329);
139523
- /* (330) anylist ::= anylist ANY */ yytestcase(yyruleno==330);
139796
+ /* (272) input ::= cmdlist */ yytestcase(yyruleno==272);
139797
+ /* (273) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==273);
139798
+ /* (274) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=274);
139799
+ /* (275) ecmd ::= SEMI */ yytestcase(yyruleno==275);
139800
+ /* (276) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==276);
139801
+ /* (277) explain ::= */ yytestcase(yyruleno==277);
139802
+ /* (278) trans_opt ::= */ yytestcase(yyruleno==278);
139803
+ /* (279) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==279);
139804
+ /* (280) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==280);
139805
+ /* (281) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==281);
139806
+ /* (282) savepoint_opt ::= */ yytestcase(yyruleno==282);
139807
+ /* (283) cmd ::= create_table create_table_args */ yytestcase(yyruleno==283);
139808
+ /* (284) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==284);
139809
+ /* (285) columnlist ::= columnname carglist */ yytestcase(yyruleno==285);
139810
+ /* (286) nm ::= ID|INDEXED */ yytestcase(yyruleno==286);
139811
+ /* (287) nm ::= STRING */ yytestcase(yyruleno==287);
139812
+ /* (288) nm ::= JOIN_KW */ yytestcase(yyruleno==288);
139813
+ /* (289) typetoken ::= typename */ yytestcase(yyruleno==289);
139814
+ /* (290) typename ::= ID|STRING */ yytestcase(yyruleno==290);
139815
+ /* (291) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=291);
139816
+ /* (292) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=292);
139817
+ /* (293) carglist ::= carglist ccons */ yytestcase(yyruleno==293);
139818
+ /* (294) carglist ::= */ yytestcase(yyruleno==294);
139819
+ /* (295) ccons ::= NULL onconf */ yytestcase(yyruleno==295);
139820
+ /* (296) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==296);
139821
+ /* (297) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==297);
139822
+ /* (298) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=298);
139823
+ /* (299) tconscomma ::= */ yytestcase(yyruleno==299);
139824
+ /* (300) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=300);
139825
+ /* (301) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=301);
139826
+ /* (302) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=302);
139827
+ /* (303) oneselect ::= values */ yytestcase(yyruleno==303);
139828
+ /* (304) sclp ::= selcollist COMMA */ yytestcase(yyruleno==304);
139829
+ /* (305) as ::= ID|STRING */ yytestcase(yyruleno==305);
139830
+ /* (306) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=306);
139831
+ /* (307) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==307);
139832
+ /* (308) exprlist ::= nexprlist */ yytestcase(yyruleno==308);
139833
+ /* (309) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=309);
139834
+ /* (310) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=310);
139835
+ /* (311) nmnum ::= ON */ yytestcase(yyruleno==311);
139836
+ /* (312) nmnum ::= DELETE */ yytestcase(yyruleno==312);
139837
+ /* (313) nmnum ::= DEFAULT */ yytestcase(yyruleno==313);
139838
+ /* (314) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==314);
139839
+ /* (315) foreach_clause ::= */ yytestcase(yyruleno==315);
139840
+ /* (316) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==316);
139841
+ /* (317) trnm ::= nm */ yytestcase(yyruleno==317);
139842
+ /* (318) tridxby ::= */ yytestcase(yyruleno==318);
139843
+ /* (319) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==319);
139844
+ /* (320) database_kw_opt ::= */ yytestcase(yyruleno==320);
139845
+ /* (321) kwcolumn_opt ::= */ yytestcase(yyruleno==321);
139846
+ /* (322) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==322);
139847
+ /* (323) vtabarglist ::= vtabarg */ yytestcase(yyruleno==323);
139848
+ /* (324) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==324);
139849
+ /* (325) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==325);
139850
+ /* (326) anylist ::= */ yytestcase(yyruleno==326);
139851
+ /* (327) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==327);
139852
+ /* (328) anylist ::= anylist ANY */ yytestcase(yyruleno==328);
139524139853
break;
139525139854
/********** End reduce actions ************************************************/
139526139855
};
139527139856
assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
139528139857
yygoto = yyRuleInfo[yyruleno].lhs;
@@ -139948,138 +140277,149 @@
139948140277
** But by using this automatically generated code, the size of the code
139949140278
** is substantially reduced. This is important for embedded applications
139950140279
** on platforms with limited memory.
139951140280
*/
139952140281
/* Hash score: 182 */
139953
-static int keywordCode(const char *z, int n, int *pType){
139954
- /* zText[] encodes 834 bytes of keywords in 554 bytes */
139955
- /* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */
139956
- /* ABLEFTHENDEFERRABLELSEXCEPTRANSACTIONATURALTERAISEXCLUSIVE */
139957
- /* XISTSAVEPOINTERSECTRIGGEREFERENCESCONSTRAINTOFFSETEMPORARY */
139958
- /* UNIQUERYWITHOUTERELEASEATTACHAVINGROUPDATEBEGINNERECURSIVE */
139959
- /* BETWEENOTNULLIKECASCADELETECASECOLLATECREATECURRENT_DATEDETACH */
139960
- /* IMMEDIATEJOINSERTMATCHPLANALYZEPRAGMABORTVALUESVIRTUALIMITWHEN */
139961
- /* WHERENAMEAFTEREPLACEANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMIT */
139962
- /* CONFLICTCROSSCURRENT_TIMESTAMPRIMARYDEFERREDISTINCTDROPFAIL */
139963
- /* FROMFULLGLOBYIFISNULLORDERESTRICTRIGHTROLLBACKROWUNIONUSING */
139964
- /* VACUUMVIEWINITIALLY */
139965
- static const char zText[553] = {
139966
- 'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H',
139967
- 'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G',
139968
- 'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A',
139969
- 'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F',
139970
- 'E','R','R','A','B','L','E','L','S','E','X','C','E','P','T','R','A','N',
139971
- 'S','A','C','T','I','O','N','A','T','U','R','A','L','T','E','R','A','I',
139972
- 'S','E','X','C','L','U','S','I','V','E','X','I','S','T','S','A','V','E',
139973
- 'P','O','I','N','T','E','R','S','E','C','T','R','I','G','G','E','R','E',
139974
- 'F','E','R','E','N','C','E','S','C','O','N','S','T','R','A','I','N','T',
139975
- 'O','F','F','S','E','T','E','M','P','O','R','A','R','Y','U','N','I','Q',
139976
- 'U','E','R','Y','W','I','T','H','O','U','T','E','R','E','L','E','A','S',
139977
- 'E','A','T','T','A','C','H','A','V','I','N','G','R','O','U','P','D','A',
139978
- 'T','E','B','E','G','I','N','N','E','R','E','C','U','R','S','I','V','E',
139979
- 'B','E','T','W','E','E','N','O','T','N','U','L','L','I','K','E','C','A',
139980
- 'S','C','A','D','E','L','E','T','E','C','A','S','E','C','O','L','L','A',
139981
- 'T','E','C','R','E','A','T','E','C','U','R','R','E','N','T','_','D','A',
139982
- 'T','E','D','E','T','A','C','H','I','M','M','E','D','I','A','T','E','J',
139983
- 'O','I','N','S','E','R','T','M','A','T','C','H','P','L','A','N','A','L',
139984
- 'Y','Z','E','P','R','A','G','M','A','B','O','R','T','V','A','L','U','E',
139985
- 'S','V','I','R','T','U','A','L','I','M','I','T','W','H','E','N','W','H',
139986
- 'E','R','E','N','A','M','E','A','F','T','E','R','E','P','L','A','C','E',
139987
- 'A','N','D','E','F','A','U','L','T','A','U','T','O','I','N','C','R','E',
139988
- 'M','E','N','T','C','A','S','T','C','O','L','U','M','N','C','O','M','M',
139989
- 'I','T','C','O','N','F','L','I','C','T','C','R','O','S','S','C','U','R',
139990
- 'R','E','N','T','_','T','I','M','E','S','T','A','M','P','R','I','M','A',
139991
- 'R','Y','D','E','F','E','R','R','E','D','I','S','T','I','N','C','T','D',
139992
- 'R','O','P','F','A','I','L','F','R','O','M','F','U','L','L','G','L','O',
139993
- 'B','Y','I','F','I','S','N','U','L','L','O','R','D','E','R','E','S','T',
139994
- 'R','I','C','T','R','I','G','H','T','R','O','L','L','B','A','C','K','R',
139995
- 'O','W','U','N','I','O','N','U','S','I','N','G','V','A','C','U','U','M',
139996
- 'V','I','E','W','I','N','I','T','I','A','L','L','Y',
139997
- };
139998
- static const unsigned char aHash[127] = {
139999
- 76, 105, 117, 74, 0, 45, 0, 0, 82, 0, 77, 0, 0,
140000
- 42, 12, 78, 15, 0, 116, 85, 54, 112, 0, 19, 0, 0,
140001
- 121, 0, 119, 115, 0, 22, 93, 0, 9, 0, 0, 70, 71,
140002
- 0, 69, 6, 0, 48, 90, 102, 0, 118, 101, 0, 0, 44,
140003
- 0, 103, 24, 0, 17, 0, 122, 53, 23, 0, 5, 110, 25,
140004
- 96, 0, 0, 124, 106, 60, 123, 57, 28, 55, 0, 91, 0,
140005
- 100, 26, 0, 99, 0, 0, 0, 95, 92, 97, 88, 109, 14,
140006
- 39, 108, 0, 81, 0, 18, 89, 111, 32, 0, 120, 80, 113,
140007
- 62, 46, 84, 0, 0, 94, 40, 59, 114, 0, 36, 0, 0,
140008
- 29, 0, 86, 63, 64, 0, 20, 61, 0, 56,
140009
- };
140010
- static const unsigned char aNext[124] = {
140011
- 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
140012
- 0, 2, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0,
140013
- 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
140014
- 0, 0, 0, 0, 33, 0, 21, 0, 0, 0, 0, 0, 50,
140015
- 0, 43, 3, 47, 0, 0, 0, 0, 30, 0, 58, 0, 38,
140016
- 0, 0, 0, 1, 66, 0, 0, 67, 0, 41, 0, 0, 0,
140017
- 0, 0, 0, 49, 65, 0, 0, 0, 0, 31, 52, 16, 34,
140018
- 10, 0, 0, 0, 0, 0, 0, 0, 11, 72, 79, 0, 8,
140019
- 0, 104, 98, 0, 107, 0, 87, 0, 75, 51, 0, 27, 37,
140020
- 73, 83, 0, 35, 68, 0, 0,
140021
- };
140022
- static const unsigned char aLen[124] = {
140023
- 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
140024
- 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 6,
140025
- 11, 6, 2, 7, 5, 5, 9, 6, 9, 9, 7, 10, 10,
140026
- 4, 6, 2, 3, 9, 4, 2, 6, 5, 7, 4, 5, 7,
140027
- 6, 6, 5, 6, 5, 5, 9, 7, 7, 3, 2, 4, 4,
140028
- 7, 3, 6, 4, 7, 6, 12, 6, 9, 4, 6, 5, 4,
140029
- 7, 6, 5, 6, 7, 5, 4, 5, 6, 5, 7, 3, 7,
140030
- 13, 2, 2, 4, 6, 6, 8, 5, 17, 12, 7, 8, 8,
140031
- 2, 4, 4, 4, 4, 4, 2, 2, 6, 5, 8, 5, 8,
140032
- 3, 5, 5, 6, 4, 9, 3,
140033
- };
140034
- static const unsigned short int aOffset[124] = {
140035
- 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
140036
- 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
140037
- 86, 91, 95, 96, 101, 105, 109, 117, 122, 128, 136, 142, 152,
140038
- 159, 162, 162, 165, 167, 167, 171, 176, 179, 184, 184, 188, 192,
140039
- 199, 204, 209, 212, 218, 221, 225, 234, 240, 240, 240, 243, 246,
140040
- 250, 251, 255, 261, 265, 272, 278, 290, 296, 305, 307, 313, 318,
140041
- 320, 327, 332, 337, 343, 349, 354, 358, 361, 367, 371, 378, 380,
140042
- 387, 389, 391, 400, 404, 410, 416, 424, 429, 429, 445, 452, 459,
140043
- 460, 467, 471, 475, 479, 483, 486, 488, 490, 496, 500, 508, 513,
140044
- 521, 524, 529, 534, 540, 544, 549,
140045
- };
140046
- static const unsigned char aCode[124] = {
140047
- TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
140048
- TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
140049
- TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
140050
- TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
140051
- TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
140052
- TK_EXCEPT, TK_TRANSACTION,TK_ACTION, TK_ON, TK_JOIN_KW,
140053
- TK_ALTER, TK_RAISE, TK_EXCLUSIVE, TK_EXISTS, TK_SAVEPOINT,
140054
- TK_INTERSECT, TK_TRIGGER, TK_REFERENCES, TK_CONSTRAINT, TK_INTO,
140055
- TK_OFFSET, TK_OF, TK_SET, TK_TEMP, TK_TEMP,
140056
- TK_OR, TK_UNIQUE, TK_QUERY, TK_WITHOUT, TK_WITH,
140057
- TK_JOIN_KW, TK_RELEASE, TK_ATTACH, TK_HAVING, TK_GROUP,
140058
- TK_UPDATE, TK_BEGIN, TK_JOIN_KW, TK_RECURSIVE, TK_BETWEEN,
140059
- TK_NOTNULL, TK_NOT, TK_NO, TK_NULL, TK_LIKE_KW,
140060
- TK_CASCADE, TK_ASC, TK_DELETE, TK_CASE, TK_COLLATE,
140061
- TK_CREATE, TK_CTIME_KW, TK_DETACH, TK_IMMEDIATE, TK_JOIN,
140062
- TK_INSERT, TK_MATCH, TK_PLAN, TK_ANALYZE, TK_PRAGMA,
140063
- TK_ABORT, TK_VALUES, TK_VIRTUAL, TK_LIMIT, TK_WHEN,
140064
- TK_WHERE, TK_RENAME, TK_AFTER, TK_REPLACE, TK_AND,
140065
- TK_DEFAULT, TK_AUTOINCR, TK_TO, TK_IN, TK_CAST,
140066
- TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW,
140067
- TK_CTIME_KW, TK_PRIMARY, TK_DEFERRED, TK_DISTINCT, TK_IS,
140068
- TK_DROP, TK_FAIL, TK_FROM, TK_JOIN_KW, TK_LIKE_KW,
140069
- TK_BY, TK_IF, TK_ISNULL, TK_ORDER, TK_RESTRICT,
140070
- TK_JOIN_KW, TK_ROLLBACK, TK_ROW, TK_UNION, TK_USING,
140071
- TK_VACUUM, TK_VIEW, TK_INITIALLY, TK_ALL,
140072
- };
140282
+/* zKWText[] encodes 834 bytes of keyword text in 554 bytes */
140283
+/* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */
140284
+/* ABLEFTHENDEFERRABLELSEXCEPTRANSACTIONATURALTERAISEXCLUSIVE */
140285
+/* XISTSAVEPOINTERSECTRIGGEREFERENCESCONSTRAINTOFFSETEMPORARY */
140286
+/* UNIQUERYWITHOUTERELEASEATTACHAVINGROUPDATEBEGINNERECURSIVE */
140287
+/* BETWEENOTNULLIKECASCADELETECASECOLLATECREATECURRENT_DATEDETACH */
140288
+/* IMMEDIATEJOINSERTMATCHPLANALYZEPRAGMABORTVALUESVIRTUALIMITWHEN */
140289
+/* WHERENAMEAFTEREPLACEANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMIT */
140290
+/* CONFLICTCROSSCURRENT_TIMESTAMPRIMARYDEFERREDISTINCTDROPFAIL */
140291
+/* FROMFULLGLOBYIFISNULLORDERESTRICTRIGHTROLLBACKROWUNIONUSING */
140292
+/* VACUUMVIEWINITIALLY */
140293
+static const char zKWText[553] = {
140294
+ 'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H',
140295
+ 'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G',
140296
+ 'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A',
140297
+ 'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F',
140298
+ 'E','R','R','A','B','L','E','L','S','E','X','C','E','P','T','R','A','N',
140299
+ 'S','A','C','T','I','O','N','A','T','U','R','A','L','T','E','R','A','I',
140300
+ 'S','E','X','C','L','U','S','I','V','E','X','I','S','T','S','A','V','E',
140301
+ 'P','O','I','N','T','E','R','S','E','C','T','R','I','G','G','E','R','E',
140302
+ 'F','E','R','E','N','C','E','S','C','O','N','S','T','R','A','I','N','T',
140303
+ 'O','F','F','S','E','T','E','M','P','O','R','A','R','Y','U','N','I','Q',
140304
+ 'U','E','R','Y','W','I','T','H','O','U','T','E','R','E','L','E','A','S',
140305
+ 'E','A','T','T','A','C','H','A','V','I','N','G','R','O','U','P','D','A',
140306
+ 'T','E','B','E','G','I','N','N','E','R','E','C','U','R','S','I','V','E',
140307
+ 'B','E','T','W','E','E','N','O','T','N','U','L','L','I','K','E','C','A',
140308
+ 'S','C','A','D','E','L','E','T','E','C','A','S','E','C','O','L','L','A',
140309
+ 'T','E','C','R','E','A','T','E','C','U','R','R','E','N','T','_','D','A',
140310
+ 'T','E','D','E','T','A','C','H','I','M','M','E','D','I','A','T','E','J',
140311
+ 'O','I','N','S','E','R','T','M','A','T','C','H','P','L','A','N','A','L',
140312
+ 'Y','Z','E','P','R','A','G','M','A','B','O','R','T','V','A','L','U','E',
140313
+ 'S','V','I','R','T','U','A','L','I','M','I','T','W','H','E','N','W','H',
140314
+ 'E','R','E','N','A','M','E','A','F','T','E','R','E','P','L','A','C','E',
140315
+ 'A','N','D','E','F','A','U','L','T','A','U','T','O','I','N','C','R','E',
140316
+ 'M','E','N','T','C','A','S','T','C','O','L','U','M','N','C','O','M','M',
140317
+ 'I','T','C','O','N','F','L','I','C','T','C','R','O','S','S','C','U','R',
140318
+ 'R','E','N','T','_','T','I','M','E','S','T','A','M','P','R','I','M','A',
140319
+ 'R','Y','D','E','F','E','R','R','E','D','I','S','T','I','N','C','T','D',
140320
+ 'R','O','P','F','A','I','L','F','R','O','M','F','U','L','L','G','L','O',
140321
+ 'B','Y','I','F','I','S','N','U','L','L','O','R','D','E','R','E','S','T',
140322
+ 'R','I','C','T','R','I','G','H','T','R','O','L','L','B','A','C','K','R',
140323
+ 'O','W','U','N','I','O','N','U','S','I','N','G','V','A','C','U','U','M',
140324
+ 'V','I','E','W','I','N','I','T','I','A','L','L','Y',
140325
+};
140326
+/* aKWHash[i] is the hash value for the i-th keyword */
140327
+static const unsigned char aKWHash[127] = {
140328
+ 76, 105, 117, 74, 0, 45, 0, 0, 82, 0, 77, 0, 0,
140329
+ 42, 12, 78, 15, 0, 116, 85, 54, 112, 0, 19, 0, 0,
140330
+ 121, 0, 119, 115, 0, 22, 93, 0, 9, 0, 0, 70, 71,
140331
+ 0, 69, 6, 0, 48, 90, 102, 0, 118, 101, 0, 0, 44,
140332
+ 0, 103, 24, 0, 17, 0, 122, 53, 23, 0, 5, 110, 25,
140333
+ 96, 0, 0, 124, 106, 60, 123, 57, 28, 55, 0, 91, 0,
140334
+ 100, 26, 0, 99, 0, 0, 0, 95, 92, 97, 88, 109, 14,
140335
+ 39, 108, 0, 81, 0, 18, 89, 111, 32, 0, 120, 80, 113,
140336
+ 62, 46, 84, 0, 0, 94, 40, 59, 114, 0, 36, 0, 0,
140337
+ 29, 0, 86, 63, 64, 0, 20, 61, 0, 56,
140338
+};
140339
+/* aKWNext[] forms the hash collision chain. If aKWHash[i]==0
140340
+** then the i-th keyword has no more hash collisions. Otherwise,
140341
+** the next keyword with the same hash is aKWHash[i]-1. */
140342
+static const unsigned char aKWNext[124] = {
140343
+ 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
140344
+ 0, 2, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0,
140345
+ 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
140346
+ 0, 0, 0, 0, 33, 0, 21, 0, 0, 0, 0, 0, 50,
140347
+ 0, 43, 3, 47, 0, 0, 0, 0, 30, 0, 58, 0, 38,
140348
+ 0, 0, 0, 1, 66, 0, 0, 67, 0, 41, 0, 0, 0,
140349
+ 0, 0, 0, 49, 65, 0, 0, 0, 0, 31, 52, 16, 34,
140350
+ 10, 0, 0, 0, 0, 0, 0, 0, 11, 72, 79, 0, 8,
140351
+ 0, 104, 98, 0, 107, 0, 87, 0, 75, 51, 0, 27, 37,
140352
+ 73, 83, 0, 35, 68, 0, 0,
140353
+};
140354
+/* aKWLen[i] is the length (in bytes) of the i-th keyword */
140355
+static const unsigned char aKWLen[124] = {
140356
+ 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
140357
+ 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 6,
140358
+ 11, 6, 2, 7, 5, 5, 9, 6, 9, 9, 7, 10, 10,
140359
+ 4, 6, 2, 3, 9, 4, 2, 6, 5, 7, 4, 5, 7,
140360
+ 6, 6, 5, 6, 5, 5, 9, 7, 7, 3, 2, 4, 4,
140361
+ 7, 3, 6, 4, 7, 6, 12, 6, 9, 4, 6, 5, 4,
140362
+ 7, 6, 5, 6, 7, 5, 4, 5, 6, 5, 7, 3, 7,
140363
+ 13, 2, 2, 4, 6, 6, 8, 5, 17, 12, 7, 8, 8,
140364
+ 2, 4, 4, 4, 4, 4, 2, 2, 6, 5, 8, 5, 8,
140365
+ 3, 5, 5, 6, 4, 9, 3,
140366
+};
140367
+/* aKWOffset[i] is the index into zKWText[] of the start of
140368
+** the text for the i-th keyword. */
140369
+static const unsigned short int aKWOffset[124] = {
140370
+ 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
140371
+ 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
140372
+ 86, 91, 95, 96, 101, 105, 109, 117, 122, 128, 136, 142, 152,
140373
+ 159, 162, 162, 165, 167, 167, 171, 176, 179, 184, 184, 188, 192,
140374
+ 199, 204, 209, 212, 218, 221, 225, 234, 240, 240, 240, 243, 246,
140375
+ 250, 251, 255, 261, 265, 272, 278, 290, 296, 305, 307, 313, 318,
140376
+ 320, 327, 332, 337, 343, 349, 354, 358, 361, 367, 371, 378, 380,
140377
+ 387, 389, 391, 400, 404, 410, 416, 424, 429, 429, 445, 452, 459,
140378
+ 460, 467, 471, 475, 479, 483, 486, 488, 490, 496, 500, 508, 513,
140379
+ 521, 524, 529, 534, 540, 544, 549,
140380
+};
140381
+/* aKWCode[i] is the parser symbol code for the i-th keyword */
140382
+static const unsigned char aKWCode[124] = {
140383
+ TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
140384
+ TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
140385
+ TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
140386
+ TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
140387
+ TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
140388
+ TK_EXCEPT, TK_TRANSACTION,TK_ACTION, TK_ON, TK_JOIN_KW,
140389
+ TK_ALTER, TK_RAISE, TK_EXCLUSIVE, TK_EXISTS, TK_SAVEPOINT,
140390
+ TK_INTERSECT, TK_TRIGGER, TK_REFERENCES, TK_CONSTRAINT, TK_INTO,
140391
+ TK_OFFSET, TK_OF, TK_SET, TK_TEMP, TK_TEMP,
140392
+ TK_OR, TK_UNIQUE, TK_QUERY, TK_WITHOUT, TK_WITH,
140393
+ TK_JOIN_KW, TK_RELEASE, TK_ATTACH, TK_HAVING, TK_GROUP,
140394
+ TK_UPDATE, TK_BEGIN, TK_JOIN_KW, TK_RECURSIVE, TK_BETWEEN,
140395
+ TK_NOTNULL, TK_NOT, TK_NO, TK_NULL, TK_LIKE_KW,
140396
+ TK_CASCADE, TK_ASC, TK_DELETE, TK_CASE, TK_COLLATE,
140397
+ TK_CREATE, TK_CTIME_KW, TK_DETACH, TK_IMMEDIATE, TK_JOIN,
140398
+ TK_INSERT, TK_MATCH, TK_PLAN, TK_ANALYZE, TK_PRAGMA,
140399
+ TK_ABORT, TK_VALUES, TK_VIRTUAL, TK_LIMIT, TK_WHEN,
140400
+ TK_WHERE, TK_RENAME, TK_AFTER, TK_REPLACE, TK_AND,
140401
+ TK_DEFAULT, TK_AUTOINCR, TK_TO, TK_IN, TK_CAST,
140402
+ TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW,
140403
+ TK_CTIME_KW, TK_PRIMARY, TK_DEFERRED, TK_DISTINCT, TK_IS,
140404
+ TK_DROP, TK_FAIL, TK_FROM, TK_JOIN_KW, TK_LIKE_KW,
140405
+ TK_BY, TK_IF, TK_ISNULL, TK_ORDER, TK_RESTRICT,
140406
+ TK_JOIN_KW, TK_ROLLBACK, TK_ROW, TK_UNION, TK_USING,
140407
+ TK_VACUUM, TK_VIEW, TK_INITIALLY, TK_ALL,
140408
+};
140409
+/* Check to see if z[0..n-1] is a keyword. If it is, write the
140410
+** parser symbol code for that keyword into *pType. Always
140411
+** return the integer n (the length of the token). */
140412
+static int keywordCode(const char *z, int n, int *pType){
140073140413
int i, j;
140074140414
const char *zKW;
140075140415
if( n>=2 ){
140076140416
i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n) % 127;
140077
- for(i=((int)aHash[i])-1; i>=0; i=((int)aNext[i])-1){
140078
- if( aLen[i]!=n ) continue;
140417
+ for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){
140418
+ if( aKWLen[i]!=n ) continue;
140079140419
j = 0;
140080
- zKW = &zText[aOffset[i]];
140420
+ zKW = &zKWText[aKWOffset[i]];
140081140421
#ifdef SQLITE_ASCII
140082140422
while( j<n && (z[j]&~0x20)==zKW[j] ){ j++; }
140083140423
#endif
140084140424
#ifdef SQLITE_EBCDIC
140085140425
while( j<n && toupper(z[j])==zKW[j] ){ j++; }
@@ -140207,11 +140547,11 @@
140207140547
testcase( i==119 ); /* USING */
140208140548
testcase( i==120 ); /* VACUUM */
140209140549
testcase( i==121 ); /* VIEW */
140210140550
testcase( i==122 ); /* INITIALLY */
140211140551
testcase( i==123 ); /* ALL */
140212
- *pType = aCode[i];
140552
+ *pType = aKWCode[i];
140213140553
break;
140214140554
}
140215140555
}
140216140556
return n;
140217140557
}
@@ -142486,14 +142826,14 @@
142486142826
** argument.
142487142827
*/
142488142828
SQLITE_PRIVATE const char *sqlite3ErrStr(int rc){
142489142829
static const char* const aMsg[] = {
142490142830
/* SQLITE_OK */ "not an error",
142491
- /* SQLITE_ERROR */ "SQL logic error or missing database",
142831
+ /* SQLITE_ERROR */ "SQL logic error",
142492142832
/* SQLITE_INTERNAL */ 0,
142493142833
/* SQLITE_PERM */ "access permission denied",
142494
- /* SQLITE_ABORT */ "callback requested query abort",
142834
+ /* SQLITE_ABORT */ "query aborted",
142495142835
/* SQLITE_BUSY */ "database is locked",
142496142836
/* SQLITE_LOCKED */ "database table is locked",
142497142837
/* SQLITE_NOMEM */ "out of memory",
142498142838
/* SQLITE_READONLY */ "attempt to write a readonly database",
142499142839
/* SQLITE_INTERRUPT */ "interrupted",
@@ -142501,21 +142841,25 @@
142501142841
/* SQLITE_CORRUPT */ "database disk image is malformed",
142502142842
/* SQLITE_NOTFOUND */ "unknown operation",
142503142843
/* SQLITE_FULL */ "database or disk is full",
142504142844
/* SQLITE_CANTOPEN */ "unable to open database file",
142505142845
/* SQLITE_PROTOCOL */ "locking protocol",
142506
- /* SQLITE_EMPTY */ "table contains no data",
142846
+ /* SQLITE_EMPTY */ 0,
142507142847
/* SQLITE_SCHEMA */ "database schema has changed",
142508142848
/* SQLITE_TOOBIG */ "string or blob too big",
142509142849
/* SQLITE_CONSTRAINT */ "constraint failed",
142510142850
/* SQLITE_MISMATCH */ "datatype mismatch",
142511
- /* SQLITE_MISUSE */ "library routine called out of sequence",
142851
+ /* SQLITE_MISUSE */ "bad parameter or other API misuse",
142852
+#ifdef SQLITE_DISABLE_LFS
142512142853
/* SQLITE_NOLFS */ "large file support is disabled",
142854
+#else
142855
+ /* SQLITE_NOLFS */ 0,
142856
+#endif
142513142857
/* SQLITE_AUTH */ "authorization denied",
142514
- /* SQLITE_FORMAT */ "auxiliary database format error",
142515
- /* SQLITE_RANGE */ "bind or column index out of range",
142516
- /* SQLITE_NOTADB */ "file is encrypted or is not a database",
142858
+ /* SQLITE_FORMAT */ 0,
142859
+ /* SQLITE_RANGE */ "column index out of range",
142860
+ /* SQLITE_NOTADB */ "file is not a database",
142517142861
};
142518142862
const char *zErr = "unknown error";
142519142863
switch( rc ){
142520142864
case SQLITE_ABORT_ROLLBACK: {
142521142865
zErr = "abort due to ROLLBACK";
@@ -143351,16 +143695,13 @@
143351143695
SQLITE_API const void *sqlite3_errmsg16(sqlite3 *db){
143352143696
static const u16 outOfMem[] = {
143353143697
'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0
143354143698
};
143355143699
static const u16 misuse[] = {
143356
- 'l', 'i', 'b', 'r', 'a', 'r', 'y', ' ',
143357
- 'r', 'o', 'u', 't', 'i', 'n', 'e', ' ',
143358
- 'c', 'a', 'l', 'l', 'e', 'd', ' ',
143359
- 'o', 'u', 't', ' ',
143360
- 'o', 'f', ' ',
143361
- 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', 0
143700
+ 'b', 'a', 'd', ' ', 'p', 'a', 'r', 'a', 'm', 'e', 't', 'e', 'r', ' ',
143701
+ 'o', 'r', ' ', 'o', 't', 'h', 'e', 'r', ' ', 'A', 'P', 'I', ' ',
143702
+ 'm', 'i', 's', 'u', 's', 'e', 0
143362143703
};
143363143704
143364143705
const void *z;
143365143706
if( !db ){
143366143707
return (void *)outOfMem;
@@ -143891,30 +144232,10 @@
143891144232
#ifndef SQLITE_OMIT_AUTOINIT
143892144233
rc = sqlite3_initialize();
143893144234
if( rc ) return rc;
143894144235
#endif
143895144236
143896
- /* Only allow sensible combinations of bits in the flags argument.
143897
- ** Throw an error if any non-sense combination is used. If we
143898
- ** do not block illegal combinations here, it could trigger
143899
- ** assert() statements in deeper layers. Sensible combinations
143900
- ** are:
143901
- **
143902
- ** 1: SQLITE_OPEN_READONLY
143903
- ** 2: SQLITE_OPEN_READWRITE
143904
- ** 6: SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
143905
- */
143906
- assert( SQLITE_OPEN_READONLY == 0x01 );
143907
- assert( SQLITE_OPEN_READWRITE == 0x02 );
143908
- assert( SQLITE_OPEN_CREATE == 0x04 );
143909
- testcase( (1<<(flags&7))==0x02 ); /* READONLY */
143910
- testcase( (1<<(flags&7))==0x04 ); /* READWRITE */
143911
- testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */
143912
- if( ((1<<(flags&7)) & 0x46)==0 ){
143913
- return SQLITE_MISUSE_BKPT; /* IMP: R-65497-44594 */
143914
- }
143915
-
143916144237
if( sqlite3GlobalConfig.bCoreMutex==0 ){
143917144238
isThreadsafe = 0;
143918144239
}else if( flags & SQLITE_OPEN_NOMUTEX ){
143919144240
isThreadsafe = 0;
143920144241
}else if( flags & SQLITE_OPEN_FULLMUTEX ){
@@ -144032,13 +144353,34 @@
144032144353
** strings is BINARY.
144033144354
*/
144034144355
db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, sqlite3StrBINARY, 0);
144035144356
assert( db->pDfltColl!=0 );
144036144357
144037
- /* Parse the filename/URI argument. */
144358
+ /* Parse the filename/URI argument
144359
+ **
144360
+ ** Only allow sensible combinations of bits in the flags argument.
144361
+ ** Throw an error if any non-sense combination is used. If we
144362
+ ** do not block illegal combinations here, it could trigger
144363
+ ** assert() statements in deeper layers. Sensible combinations
144364
+ ** are:
144365
+ **
144366
+ ** 1: SQLITE_OPEN_READONLY
144367
+ ** 2: SQLITE_OPEN_READWRITE
144368
+ ** 6: SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
144369
+ */
144038144370
db->openFlags = flags;
144039
- rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
144371
+ assert( SQLITE_OPEN_READONLY == 0x01 );
144372
+ assert( SQLITE_OPEN_READWRITE == 0x02 );
144373
+ assert( SQLITE_OPEN_CREATE == 0x04 );
144374
+ testcase( (1<<(flags&7))==0x02 ); /* READONLY */
144375
+ testcase( (1<<(flags&7))==0x04 ); /* READWRITE */
144376
+ testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */
144377
+ if( ((1<<(flags&7)) & 0x46)==0 ){
144378
+ rc = SQLITE_MISUSE_BKPT; /* IMP: R-65497-44594 */
144379
+ }else{
144380
+ rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
144381
+ }
144040144382
if( rc!=SQLITE_OK ){
144041144383
if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
144042144384
sqlite3ErrorWithMsg(db, rc, zErrMsg ? "%s" : 0, zErrMsg);
144043144385
sqlite3_free(zErrMsg);
144044144386
goto opendb_out;
@@ -148199,23 +148541,32 @@
148199148541
}
148200148542
pCsr->bSeekStmt = 0;
148201148543
}
148202148544
sqlite3_finalize(pCsr->pStmt);
148203148545
}
148546
+
148547
+/*
148548
+** Free all resources currently held by the cursor passed as the only
148549
+** argument.
148550
+*/
148551
+static void fts3ClearCursor(Fts3Cursor *pCsr){
148552
+ fts3CursorFinalizeStmt(pCsr);
148553
+ sqlite3Fts3FreeDeferredTokens(pCsr);
148554
+ sqlite3_free(pCsr->aDoclist);
148555
+ sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);
148556
+ sqlite3Fts3ExprFree(pCsr->pExpr);
148557
+ memset(&(&pCsr->base)[1], 0, sizeof(Fts3Cursor)-sizeof(sqlite3_vtab_cursor));
148558
+}
148204148559
148205148560
/*
148206148561
** Close the cursor. For additional information see the documentation
148207148562
** on the xClose method of the virtual table interface.
148208148563
*/
148209148564
static int fts3CloseMethod(sqlite3_vtab_cursor *pCursor){
148210148565
Fts3Cursor *pCsr = (Fts3Cursor *)pCursor;
148211148566
assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );
148212
- fts3CursorFinalizeStmt(pCsr);
148213
- sqlite3Fts3ExprFree(pCsr->pExpr);
148214
- sqlite3Fts3FreeDeferredTokens(pCsr);
148215
- sqlite3_free(pCsr->aDoclist);
148216
- sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);
148567
+ fts3ClearCursor(pCsr);
148217148568
assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );
148218148569
sqlite3_free(pCsr);
148219148570
return SQLITE_OK;
148220148571
}
148221148572
@@ -149712,15 +150063,11 @@
149712150063
if( idxNum & FTS3_HAVE_DOCID_GE ) pDocidGe = apVal[iIdx++];
149713150064
if( idxNum & FTS3_HAVE_DOCID_LE ) pDocidLe = apVal[iIdx++];
149714150065
assert( iIdx==nVal );
149715150066
149716150067
/* In case the cursor has been used before, clear it now. */
149717
- fts3CursorFinalizeStmt(pCsr);
149718
- sqlite3_free(pCsr->aDoclist);
149719
- sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);
149720
- sqlite3Fts3ExprFree(pCsr->pExpr);
149721
- memset(&pCursor[1], 0, sizeof(Fts3Cursor)-sizeof(sqlite3_vtab_cursor));
150068
+ fts3ClearCursor(pCsr);
149722150069
149723150070
/* Set the lower and upper bounds on docids to return */
149724150071
pCsr->iMinDocid = fts3DocidRange(pDocidGe, SMALLEST_INT64);
149725150072
pCsr->iMaxDocid = fts3DocidRange(pDocidLe, LARGEST_INT64);
149726150073
@@ -149795,11 +150142,16 @@
149795150142
/*
149796150143
** This is the xEof method of the virtual table. SQLite calls this
149797150144
** routine to find out if it has reached the end of a result set.
149798150145
*/
149799150146
static int fts3EofMethod(sqlite3_vtab_cursor *pCursor){
149800
- return ((Fts3Cursor *)pCursor)->isEof;
150147
+ Fts3Cursor *pCsr = (Fts3Cursor*)pCursor;
150148
+ if( pCsr->isEof ){
150149
+ fts3ClearCursor(pCsr);
150150
+ pCsr->isEof = 1;
150151
+ }
150152
+ return pCsr->isEof;
149801150153
}
149802150154
149803150155
/*
149804150156
** This is the xRowid method. The SQLite core calls this routine to
149805150157
** retrieve the rowid for the current row of the result set. fts3
@@ -168168,10 +168520,14 @@
168168168520
pRtree->zDb, pRtree->zName
168169168521
);
168170168522
rc = getIntFromStmt(db, zSql, &pRtree->iNodeSize);
168171168523
if( rc!=SQLITE_OK ){
168172168524
*pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db));
168525
+ }else if( pRtree->iNodeSize<(512-64) ){
168526
+ rc = SQLITE_CORRUPT;
168527
+ *pzErr = sqlite3_mprintf("undersize RTree blobs in \"%q_node\"",
168528
+ pRtree->zName);
168173168529
}
168174168530
}
168175168531
168176168532
sqlite3_free(zSql);
168177168533
return rc;
@@ -175429,10 +175785,13 @@
175429175785
0, /* xSync */
175430175786
0, /* xCommit */
175431175787
0, /* xRollback */
175432175788
0, /* xFindMethod */
175433175789
0, /* xRename */
175790
+ 0, /* xSavepoint */
175791
+ 0, /* xRelease */
175792
+ 0, /* xRollbackTo */
175434175793
};
175435175794
return sqlite3_create_module(db, "dbstat", &dbstat_module, 0);
175436175795
}
175437175796
#elif defined(SQLITE_ENABLE_DBSTAT_VTAB)
175438175797
SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3 *db){ return SQLITE_OK; }
@@ -184399,11 +184758,13 @@
184399184758
pParser->fts5yyerrcnt = -1;
184400184759
#endif
184401184760
pParser->fts5yytos = pParser->fts5yystack;
184402184761
pParser->fts5yystack[0].stateno = 0;
184403184762
pParser->fts5yystack[0].major = 0;
184763
+#if fts5YYSTACKDEPTH>0
184404184764
pParser->fts5yystackEnd = &pParser->fts5yystack[fts5YYSTACKDEPTH-1];
184765
+#endif
184405184766
}
184406184767
184407184768
#ifndef sqlite3Fts5Parser_ENGINEALWAYSONSTACK
184408184769
/*
184409184770
** This function allocates a new parser.
@@ -199766,11 +200127,11 @@
199766200127
int nArg, /* Number of args */
199767200128
sqlite3_value **apUnused /* Function arguments */
199768200129
){
199769200130
assert( nArg==0 );
199770200131
UNUSED_PARAM2(nArg, apUnused);
199771
- sqlite3_result_text(pCtx, "fts5: 2017-06-29 17:27:04 284707a7b3514a55cce24292e45632b7033d6edcff5b27deac5118b27c7b2954", -1, SQLITE_TRANSIENT);
200132
+ sqlite3_result_text(pCtx, "fts5: 2017-07-12 18:05:54 604c11d1a39f09e47b6fcee0f8b1c1054f9dbbc7b2c1cf93312aeaa4b7095018", -1, SQLITE_TRANSIENT);
199772200133
}
199773200134
199774200135
static int fts5Init(sqlite3 *db){
199775200136
static const sqlite3_module fts5Mod = {
199776200137
/* iVersion */ 2,
@@ -203694,20 +204055,20 @@
203694204055
sqlite3_int64 iRowid; /* The rowid */
203695204056
};
203696204057
203697204058
/*
203698204059
** The stmtConnect() method is invoked to create a new
203699
-** stmt_vtab that describes the generate_stmt virtual table.
204060
+** stmt_vtab that describes the stmt virtual table.
203700204061
**
203701204062
** Think of this routine as the constructor for stmt_vtab objects.
203702204063
**
203703204064
** All this routine needs to do is:
203704204065
**
203705204066
** (1) Allocate the stmt_vtab object and initialize all fields.
203706204067
**
203707204068
** (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
203708
-** result set of queries against generate_stmt will look like.
204069
+** result set of queries against stmt will look like.
203709204070
*/
203710204071
static int stmtConnect(
203711204072
sqlite3 *db,
203712204073
void *pAux,
203713204074
int argc, const char *const*argv,
@@ -203871,11 +204232,11 @@
203871204232
return stmtNext(pVtabCursor);
203872204233
}
203873204234
203874204235
/*
203875204236
** SQLite will invoke this method one or more times while planning a query
203876
-** that uses the generate_stmt virtual table. This routine needs to create
204237
+** that uses the stmt virtual table. This routine needs to create
203877204238
** a query plan for each invocation and compute an estimated cost for that
203878204239
** plan.
203879204240
*/
203880204241
static int stmtBestIndex(
203881204242
sqlite3_vtab *tab,
@@ -203886,11 +204247,11 @@
203886204247
return SQLITE_OK;
203887204248
}
203888204249
203889204250
/*
203890204251
** This following structure defines all the methods for the
203891
-** generate_stmt virtual table.
204252
+** stmt virtual table.
203892204253
*/
203893204254
static sqlite3_module stmtModule = {
203894204255
0, /* iVersion */
203895204256
0, /* xCreate */
203896204257
stmtConnect, /* xConnect */
@@ -203909,10 +204270,13 @@
203909204270
0, /* xSync */
203910204271
0, /* xCommit */
203911204272
0, /* xRollback */
203912204273
0, /* xFindMethod */
203913204274
0, /* xRename */
204275
+ 0, /* xSavepoint */
204276
+ 0, /* xRelease */
204277
+ 0, /* xRollbackTo */
203914204278
};
203915204279
203916204280
#endif /* SQLITE_OMIT_VIRTUALTABLE */
203917204281
203918204282
SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3 *db){
203919204283
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1150,11 +1150,11 @@
1150 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1151 ** [sqlite_version()] and [sqlite_source_id()].
1152 */
1153 #define SQLITE_VERSION "3.20.0"
1154 #define SQLITE_VERSION_NUMBER 3020000
1155 #define SQLITE_SOURCE_ID "2017-06-29 17:27:04 284707a7b3514a55cce24292e45632b7033d6edcff5b27deac5118b27c7b2954"
1156
1157 /*
1158 ** CAPI3REF: Run-Time Library Version Numbers
1159 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1160 **
@@ -1444,11 +1444,11 @@
1444 **
1445 ** See also: [extended result code definitions]
1446 */
1447 #define SQLITE_OK 0 /* Successful result */
1448 /* beginning-of-error-codes */
1449 #define SQLITE_ERROR 1 /* SQL error or missing database */
1450 #define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */
1451 #define SQLITE_PERM 3 /* Access permission denied */
1452 #define SQLITE_ABORT 4 /* Callback routine requested an abort */
1453 #define SQLITE_BUSY 5 /* The database file is locked */
1454 #define SQLITE_LOCKED 6 /* A table in the database is locked */
@@ -1459,19 +1459,19 @@
1459 #define SQLITE_CORRUPT 11 /* The database disk image is malformed */
1460 #define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */
1461 #define SQLITE_FULL 13 /* Insertion failed because database is full */
1462 #define SQLITE_CANTOPEN 14 /* Unable to open the database file */
1463 #define SQLITE_PROTOCOL 15 /* Database lock protocol error */
1464 #define SQLITE_EMPTY 16 /* Database is empty */
1465 #define SQLITE_SCHEMA 17 /* The database schema changed */
1466 #define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
1467 #define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
1468 #define SQLITE_MISMATCH 20 /* Data type mismatch */
1469 #define SQLITE_MISUSE 21 /* Library used incorrectly */
1470 #define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
1471 #define SQLITE_AUTH 23 /* Authorization denied */
1472 #define SQLITE_FORMAT 24 /* Auxiliary database format error */
1473 #define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */
1474 #define SQLITE_NOTADB 26 /* File opened that is not a database file */
1475 #define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */
1476 #define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */
1477 #define SQLITE_ROW 100 /* sqlite3_step() has another row ready */
@@ -5294,10 +5294,32 @@
5294
5295 /*
5296 ** CAPI3REF: Result Values From A Query
5297 ** KEYWORDS: {column access functions}
5298 ** METHOD: sqlite3_stmt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5299 **
5300 ** ^These routines return information about a single column of the current
5301 ** result row of a query. ^In every case the first argument is a pointer
5302 ** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
5303 ** that was returned from [sqlite3_prepare_v3()] or one of its variants)
@@ -5316,19 +5338,32 @@
5316 ** something other than [SQLITE_ROW], the results are undefined.
5317 ** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()]
5318 ** are called from a different thread while any of these routines
5319 ** are pending, then the results are undefined.
5320 **
 
 
 
 
 
 
5321 ** ^The sqlite3_column_type() routine returns the
5322 ** [SQLITE_INTEGER | datatype code] for the initial data type
5323 ** of the result column. ^The returned value is one of [SQLITE_INTEGER],
5324 ** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. The value
5325 ** returned by sqlite3_column_type() is only meaningful if no type
5326 ** conversions have occurred as described below. After a type conversion,
5327 ** the value returned by sqlite3_column_type() is undefined. Future
 
 
 
5328 ** versions of SQLite may change the behavior of sqlite3_column_type()
5329 ** following a type conversion.
 
 
 
 
5330 **
5331 ** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
5332 ** routine returns the number of bytes in that BLOB or string.
5333 ** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts
5334 ** the string to UTF-8 and then returns the number of bytes.
@@ -5362,13 +5397,17 @@
5362 ** [sqlite3_bind_value()] and [sqlite3_result_value()].
5363 ** If the [unprotected sqlite3_value] object returned by
5364 ** [sqlite3_column_value()] is used in any other way, including calls
5365 ** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
5366 ** or [sqlite3_value_bytes()], the behavior is not threadsafe.
 
 
 
 
5367 **
5368 ** These routines attempt to convert the value where appropriate. ^For
5369 ** example, if the internal representation is FLOAT and a text result
5370 ** is requested, [sqlite3_snprintf()] is used internally to perform the
5371 ** conversion automatically. ^(The following table details the conversions
5372 ** that are applied:
5373 **
5374 ** <blockquote>
@@ -5436,11 +5475,11 @@
5436 ** with calls to sqlite3_column_bytes().
5437 **
5438 ** ^The pointers returned are valid until a type conversion occurs as
5439 ** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
5440 ** [sqlite3_finalize()] is called. ^The memory space used to hold strings
5441 ** and BLOBs is freed automatically. Do <em>not</em> pass the pointers returned
5442 ** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
5443 ** [sqlite3_free()].
5444 **
5445 ** ^(If a memory allocation error occurs during the evaluation of any
5446 ** of these routines, a default value is returned. The default value
@@ -5447,19 +5486,19 @@
5447 ** is either the integer 0, the floating point number 0.0, or a NULL
5448 ** pointer. Subsequent calls to [sqlite3_errcode()] will return
5449 ** [SQLITE_NOMEM].)^
5450 */
5451 SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
5452 SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
5453 SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
5454 SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
5455 SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
5456 SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
5457 SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
5458 SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
5459 SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
5460 SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
 
 
 
5461
5462 /*
5463 ** CAPI3REF: Destroy A Prepared Statement Object
5464 ** DESTRUCTOR: sqlite3_stmt
5465 **
@@ -5689,25 +5728,43 @@
5689
5690 /*
5691 ** CAPI3REF: Obtaining SQL Values
5692 ** METHOD: sqlite3_value
5693 **
5694 ** The C-language implementation of SQL functions and aggregates uses
5695 ** this set of interface routines to access the parameter values on
5696 ** the function or aggregate.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5697 **
5698 ** The xFunc (for scalar functions) or xStep (for aggregates) parameters
5699 ** to [sqlite3_create_function()] and [sqlite3_create_function16()]
5700 ** define callbacks that implement the SQL functions and aggregates.
5701 ** The 3rd parameter to these callbacks is an array of pointers to
5702 ** [protected sqlite3_value] objects. There is one [sqlite3_value] object for
5703 ** each parameter to the SQL function. These routines are used to
5704 ** extract values from the [sqlite3_value] objects.
5705 **
5706 ** These routines work only with [protected sqlite3_value] objects.
5707 ** Any attempt to use these routines on an [unprotected sqlite3_value]
5708 ** object results in undefined behavior.
5709 **
5710 ** ^These routines work just like the corresponding [column access functions]
5711 ** except that these routines take a single [protected sqlite3_value] object
5712 ** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
5713 **
@@ -5714,10 +5771,21 @@
5714 ** ^The sqlite3_value_text16() interface extracts a UTF-16 string
5715 ** in the native byte-order of the host machine. ^The
5716 ** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
5717 ** extract UTF-16 strings as big-endian and little-endian respectively.
5718 **
 
 
 
 
 
 
 
 
 
 
 
5719 ** ^(The sqlite3_value_numeric_type() interface attempts to apply
5720 ** numeric affinity to the value. This means that an attempt is
5721 ** made to convert the value to an integer or floating point. If
5722 ** such a conversion is possible without loss of information (in other
5723 ** words, if the value is a string that looks like a number)
@@ -5732,19 +5800,19 @@
5732 **
5733 ** These routines must be called from the same thread as
5734 ** the SQL function that supplied the [sqlite3_value*] parameters.
5735 */
5736 SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
5737 SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
5738 SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
5739 SQLITE_API double sqlite3_value_double(sqlite3_value*);
5740 SQLITE_API int sqlite3_value_int(sqlite3_value*);
5741 SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
5742 SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
5743 SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
5744 SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
5745 SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
 
 
5746 SQLITE_API int sqlite3_value_type(sqlite3_value*);
5747 SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
5748
5749 /*
5750 ** CAPI3REF: Finding The Subtype Of SQL Values
@@ -15143,10 +15211,11 @@
15143 #define SQLITE_OrderByIdxJoin 0x0080 /* ORDER BY of joins via index */
15144 #define SQLITE_SubqCoroutine 0x0100 /* Evaluate subqueries as coroutines */
15145 #define SQLITE_Transitive 0x0200 /* Transitive constraints */
15146 #define SQLITE_OmitNoopJoin 0x0400 /* Omit unused tables in joins */
15147 #define SQLITE_Stat34 0x0800 /* Use STAT3 or STAT4 data */
 
15148 #define SQLITE_CursorHints 0x2000 /* Add OP_CursorHint opcodes */
15149 #define SQLITE_AllOpts 0xffff /* All optimizations */
15150
15151 /*
15152 ** Macros for testing whether or not optimizations are enabled or disabled.
@@ -16005,11 +16074,11 @@
16005 /*
16006 ** The following are the meanings of bits in the Expr.flags field.
16007 */
16008 #define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */
16009 #define EP_Agg 0x000002 /* Contains one or more aggregate functions */
16010 #define EP_Resolved 0x000004 /* IDs have been resolved to COLUMNs */
16011 /* 0x000008 // available for use */
16012 #define EP_Distinct 0x000010 /* Aggregate function with DISTINCT keyword */
16013 #define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */
16014 #define EP_DblQuoted 0x000040 /* token.z was originally in "..." */
16015 #define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */
@@ -17437,12 +17506,11 @@
17437 #endif
17438 SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3*,int);
17439 SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse*, int);
17440 SQLITE_PRIVATE void sqlite3CodeVerifyNamedSchema(Parse*, const char *zDb);
17441 SQLITE_PRIVATE void sqlite3BeginTransaction(Parse*, int);
17442 SQLITE_PRIVATE void sqlite3CommitTransaction(Parse*);
17443 SQLITE_PRIVATE void sqlite3RollbackTransaction(Parse*);
17444 SQLITE_PRIVATE void sqlite3Savepoint(Parse*, int, Token*);
17445 SQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *);
17446 SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3*);
17447 SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*);
17448 SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*);
@@ -17559,11 +17627,13 @@
17559 SQLITE_PRIVATE int sqlite3FixExprList(DbFixer*, ExprList*);
17560 SQLITE_PRIVATE int sqlite3FixTriggerStep(DbFixer*, TriggerStep*);
17561 SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8);
17562 SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*);
17563 SQLITE_PRIVATE int sqlite3Atoi(const char*);
 
17564 SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar);
 
17565 SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);
17566 SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**);
17567 SQLITE_PRIVATE LogEst sqlite3LogEst(u64);
17568 SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst,LogEst);
17569 #ifndef SQLITE_OMIT_VIRTUALTABLE
@@ -17648,11 +17718,13 @@
17648 SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
17649 void(*)(void*));
17650 SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value*);
17651 SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*);
17652 SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *);
 
17653 SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8);
 
17654 SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
17655 SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
17656 #ifndef SQLITE_AMALGAMATION
17657 SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[];
17658 SQLITE_PRIVATE const char sqlite3StrBINARY[];
@@ -18012,11 +18084,13 @@
18012 SQLITE_PRIVATE int sqlite3ExprIsVector(Expr *pExpr);
18013 SQLITE_PRIVATE Expr *sqlite3VectorFieldSubexpr(Expr*, int);
18014 SQLITE_PRIVATE Expr *sqlite3ExprForVectorField(Parse*,Expr*,int);
18015 SQLITE_PRIVATE void sqlite3VectorErrorMsg(Parse*, Expr*);
18016
 
18017 SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt);
 
18018
18019 #endif /* SQLITEINT_H */
18020
18021 /************** End of sqliteInt.h *******************************************/
18022 /************** Begin file global.c ******************************************/
@@ -18873,16 +18947,18 @@
18873 SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *, int);
18874 #else
18875 # define sqlite3VdbeCheckFk(p,i) 0
18876 #endif
18877
18878 SQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem*, u8);
18879 #ifdef SQLITE_DEBUG
18880 SQLITE_PRIVATE void sqlite3VdbePrintSql(Vdbe*);
18881 SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf);
18882 #endif
18883 SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem);
 
 
 
18884
18885 #ifndef SQLITE_OMIT_INCRBLOB
18886 SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *);
18887 #define ExpandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0)
18888 #else
@@ -26962,21 +27038,21 @@
26962 }
26963 break;
26964 }
26965 #ifndef SQLITE_OMIT_SUBQUERY
26966 case TK_EXISTS: {
26967 sqlite3TreeViewLine(pView, "EXISTS-expr");
26968 sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
26969 break;
26970 }
26971 case TK_SELECT: {
26972 sqlite3TreeViewLine(pView, "SELECT-expr");
26973 sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
26974 break;
26975 }
26976 case TK_IN: {
26977 sqlite3TreeViewLine(pView, "IN");
26978 sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
26979 if( ExprHasProperty(pExpr, EP_xIsSelect) ){
26980 sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
26981 }else{
26982 sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0);
@@ -27860,11 +27936,13 @@
27860 fprintf(stderr, "OUTPUT: %s\n", zBuf);
27861 }
27862 #endif
27863 return SQLITE_OK;
27864 }
 
27865
 
27866 /*
27867 ** This routine checks for a byte-order mark at the beginning of the
27868 ** UTF-16 string stored in *pMem. If one is present, it is removed and
27869 ** the encoding of the Mem adjusted. This routine does not do any
27870 ** byte-swapping, it just sets Mem.enc appropriately.
@@ -29771,21 +29849,23 @@
29771 }
29772 return 1;
29773 }
29774
29775 /* This function (for internal use only) locates an element in an
29776 ** hash table that matches the given key. The hash for this key is
29777 ** also computed and returned in the *pH parameter.
 
29778 */
29779 static HashElem *findElementWithHash(
29780 const Hash *pH, /* The pH to be searched */
29781 const char *pKey, /* The key we are searching for */
29782 unsigned int *pHash /* Write the hash value here */
29783 ){
29784 HashElem *elem; /* Used to loop thru the element list */
29785 int count; /* Number of elements left to test */
29786 unsigned int h; /* The computed hash */
 
29787
29788 if( pH->ht ){ /*OPTIMIZATION-IF-TRUE*/
29789 struct _ht *pEntry;
29790 h = strHash(pKey) % pH->htsize;
29791 pEntry = &pH->ht[h];
@@ -29794,19 +29874,19 @@
29794 }else{
29795 h = 0;
29796 elem = pH->first;
29797 count = pH->count;
29798 }
29799 *pHash = h;
29800 while( count-- ){
29801 assert( elem!=0 );
29802 if( sqlite3StrICmp(elem->pKey,pKey)==0 ){
29803 return elem;
29804 }
29805 elem = elem->next;
29806 }
29807 return 0;
29808 }
29809
29810 /* Remove a single entry from the hash table given a pointer to that
29811 ** element and a hash on the element's key.
29812 */
@@ -29844,17 +29924,13 @@
29844 /* Attempt to locate an element of the hash table pH with a key
29845 ** that matches pKey. Return the data for this element if it is
29846 ** found, or NULL if there is no match.
29847 */
29848 SQLITE_PRIVATE void *sqlite3HashFind(const Hash *pH, const char *pKey){
29849 HashElem *elem; /* The element that matches key */
29850 unsigned int h; /* A hash on key */
29851
29852 assert( pH!=0 );
29853 assert( pKey!=0 );
29854 elem = findElementWithHash(pH, pKey, &h);
29855 return elem ? elem->data : 0;
29856 }
29857
29858 /* Insert an element into the hash table pH. The key is pKey
29859 ** and the data is "data".
29860 **
@@ -29875,11 +29951,11 @@
29875 HashElem *new_elem; /* New element added to the pH */
29876
29877 assert( pH!=0 );
29878 assert( pKey!=0 );
29879 elem = findElementWithHash(pH,pKey,&h);
29880 if( elem ){
29881 void *old_data = elem->data;
29882 if( data==0 ){
29883 removeElementGivenHash(pH,elem,h);
29884 }else{
29885 elem->data = data;
@@ -58883,14 +58959,16 @@
58883 ** Allowed values for BtShared.btsFlags
58884 */
58885 #define BTS_READ_ONLY 0x0001 /* Underlying file is readonly */
58886 #define BTS_PAGESIZE_FIXED 0x0002 /* Page size can no longer be changed */
58887 #define BTS_SECURE_DELETE 0x0004 /* PRAGMA secure_delete is enabled */
58888 #define BTS_INITIALLY_EMPTY 0x0008 /* Database was empty at trans start */
58889 #define BTS_NO_WAL 0x0010 /* Do not open write-ahead-log files */
58890 #define BTS_EXCLUSIVE 0x0020 /* pWriter has an exclusive lock */
58891 #define BTS_PENDING 0x0040 /* Waiting for read-locks to clear */
 
 
58892
58893 /*
58894 ** An instance of the following structure is used to hold information
58895 ** about a cell. The parseCellPtr() function fills in this structure
58896 ** based on information extract from the raw disk page.
@@ -61072,11 +61150,11 @@
61072 assert( iSize>=4 ); /* Minimum cell size is 4 */
61073 assert( iStart<=iLast );
61074
61075 /* Overwrite deleted information with zeros when the secure_delete
61076 ** option is enabled */
61077 if( pPage->pBt->btsFlags & BTS_SECURE_DELETE ){
61078 memset(&data[iStart], 0, iSize);
61079 }
61080
61081 /* The list of freeblocks must be in ascending order. Find the
61082 ** spot on the list where iStart should be inserted.
@@ -61363,11 +61441,11 @@
61363 assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno );
61364 assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage );
61365 assert( sqlite3PagerGetData(pPage->pDbPage) == data );
61366 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
61367 assert( sqlite3_mutex_held(pBt->mutex) );
61368 if( pBt->btsFlags & BTS_SECURE_DELETE ){
61369 memset(&data[hdr], 0, pBt->usableSize - hdr);
61370 }
61371 data[hdr] = (char)flags;
61372 first = hdr + ((flags&PTF_LEAF)==0 ? 12 : 8);
61373 memset(&data[hdr+1], 0, 4);
@@ -61786,12 +61864,14 @@
61786 p->pBt = pBt;
61787
61788 pBt->pCursor = 0;
61789 pBt->pPage1 = 0;
61790 if( sqlite3PagerIsreadonly(pBt->pPager) ) pBt->btsFlags |= BTS_READ_ONLY;
61791 #ifdef SQLITE_SECURE_DELETE
61792 pBt->btsFlags |= BTS_SECURE_DELETE;
 
 
61793 #endif
61794 /* EVIDENCE-OF: R-51873-39618 The page size for a database file is
61795 ** determined by the 2-byte integer located at an offset of 16 bytes from
61796 ** the beginning of the database file. */
61797 pBt->pageSize = (zDbHeader[16]<<8) | (zDbHeader[17]<<16);
@@ -62235,23 +62315,38 @@
62235 sqlite3BtreeLeave(p);
62236 return n;
62237 }
62238
62239 /*
62240 ** Set the BTS_SECURE_DELETE flag if newFlag is 0 or 1. If newFlag is -1,
62241 ** then make no changes. Always return the value of the BTS_SECURE_DELETE
62242 ** setting after the change.
 
 
 
 
 
 
 
 
 
 
 
 
 
62243 */
62244 SQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree *p, int newFlag){
62245 int b;
62246 if( p==0 ) return 0;
62247 sqlite3BtreeEnter(p);
 
 
62248 if( newFlag>=0 ){
62249 p->pBt->btsFlags &= ~BTS_SECURE_DELETE;
62250 if( newFlag ) p->pBt->btsFlags |= BTS_SECURE_DELETE;
62251 }
62252 b = (p->pBt->btsFlags & BTS_SECURE_DELETE)!=0;
62253 sqlite3BtreeLeave(p);
62254 return b;
62255 }
62256
62257 /*
@@ -64864,23 +64959,23 @@
64864 ** for the common case of merely incrementing the cell counter BtCursor.aiIdx
64865 ** to the next cell on the current page. The (slower) btreeNext() helper
64866 ** routine is called when it is necessary to move to a different page or
64867 ** to restore the cursor.
64868 **
64869 ** If bit 0x01 of the flags argument is 1, then the cursor corresponds to
64870 ** an SQL index and this routine could have been skipped if the SQL index
64871 ** had been a unique index. The flags argument is a hint to the implement.
64872 ** SQLite btree implementation does not use this hint, but COMDB2 does.
 
64873 */
64874 static SQLITE_NOINLINE int btreeNext(BtCursor *pCur, int flags){
64875 int rc;
64876 int idx;
64877 MemPage *pPage;
64878
64879 assert( cursorOwnsBtShared(pCur) );
64880 assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
64881 assert( flags==0 );
64882 if( pCur->eState!=CURSOR_VALID ){
64883 assert( (pCur->curFlags & BTCF_ValidOvfl)==0 );
64884 rc = restoreCursorPosition(pCur);
64885 if( rc!=SQLITE_OK ){
64886 return rc;
@@ -64923,11 +65018,11 @@
64923 }
64924 moveToParent(pCur);
64925 pPage = pCur->apPage[pCur->iPage];
64926 }while( pCur->ix>=pPage->nCell );
64927 if( pPage->intKey ){
64928 return sqlite3BtreeNext(pCur, flags);
64929 }else{
64930 return SQLITE_OK;
64931 }
64932 }
64933 if( pPage->leaf ){
@@ -64936,20 +65031,21 @@
64936 return moveToLeftmost(pCur);
64937 }
64938 }
64939 SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor *pCur, int flags){
64940 MemPage *pPage;
 
64941 assert( cursorOwnsBtShared(pCur) );
64942 assert( flags==0 || flags==1 );
64943 assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
64944 pCur->info.nSize = 0;
64945 pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
64946 if( pCur->eState!=CURSOR_VALID ) return btreeNext(pCur, 0);
64947 pPage = pCur->apPage[pCur->iPage];
64948 if( (++pCur->ix)>=pPage->nCell ){
64949 pCur->ix--;
64950 return btreeNext(pCur, 0);
64951 }
64952 if( pPage->leaf ){
64953 return SQLITE_OK;
64954 }else{
64955 return moveToLeftmost(pCur);
@@ -64968,22 +65064,21 @@
64968 ** for the common case of merely decrementing the cell counter BtCursor.aiIdx
64969 ** to the previous cell on the current page. The (slower) btreePrevious()
64970 ** helper routine is called when it is necessary to move to a different page
64971 ** or to restore the cursor.
64972 **
64973 **
64974 ** If bit 0x01 of the flags argument is 1, then the cursor corresponds to
64975 ** an SQL index and this routine could have been skipped if the SQL index
64976 ** had been a unique index. The flags argument is a hint to the implement.
64977 ** SQLite btree implementation does not use this hint, but COMDB2 does.
64978 */
64979 static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur, int flags){
64980 int rc;
64981 MemPage *pPage;
64982
64983 assert( cursorOwnsBtShared(pCur) );
64984 assert( flags==0 );
64985 assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
64986 assert( (pCur->curFlags & (BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey))==0 );
64987 assert( pCur->info.nSize==0 );
64988 if( pCur->eState!=CURSOR_VALID ){
64989 rc = restoreCursorPosition(pCur);
@@ -65023,11 +65118,11 @@
65023 assert( (pCur->curFlags & (BTCF_ValidOvfl))==0 );
65024
65025 pCur->ix--;
65026 pPage = pCur->apPage[pCur->iPage];
65027 if( pPage->intKey && !pPage->leaf ){
65028 rc = sqlite3BtreePrevious(pCur, flags);
65029 }else{
65030 rc = SQLITE_OK;
65031 }
65032 }
65033 return rc;
@@ -65034,17 +65129,18 @@
65034 }
65035 SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor *pCur, int flags){
65036 assert( cursorOwnsBtShared(pCur) );
65037 assert( flags==0 || flags==1 );
65038 assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
 
65039 pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey);
65040 pCur->info.nSize = 0;
65041 if( pCur->eState!=CURSOR_VALID
65042 || pCur->ix==0
65043 || pCur->apPage[pCur->iPage]->leaf==0
65044 ){
65045 return btreePrevious(pCur, 0);
65046 }
65047 pCur->ix--;
65048 return SQLITE_OK;
65049 }
65050
@@ -66642,11 +66738,11 @@
66642 ** But not if we are in secure-delete mode. In secure-delete mode,
66643 ** the dropCell() routine will overwrite the entire cell with zeroes.
66644 ** In this case, temporarily copy the cell into the aOvflSpace[]
66645 ** buffer. It will be copied out again as soon as the aSpace[] buffer
66646 ** is allocated. */
66647 if( pBt->btsFlags & BTS_SECURE_DELETE ){
66648 int iOff;
66649
66650 iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData);
66651 if( (iOff+szNew[i])>(int)pBt->usableSize ){
66652 rc = SQLITE_CORRUPT_BKPT;
@@ -72056,25 +72152,31 @@
72056 ** constants. The registers begin with iDest and increase consecutively.
72057 ** One register is initialized for each characgter in zTypes[]. For each
72058 ** "s" character in zTypes[], the register is a string if the argument is
72059 ** not NULL, or OP_Null if the value is a null pointer. For each "i" character
72060 ** in zTypes[], the register is initialized to an integer.
 
 
 
72061 */
72062 SQLITE_PRIVATE void sqlite3VdbeMultiLoad(Vdbe *p, int iDest, const char *zTypes, ...){
72063 va_list ap;
72064 int i;
72065 char c;
72066 va_start(ap, zTypes);
72067 for(i=0; (c = zTypes[i])!=0; i++){
72068 if( c=='s' ){
72069 const char *z = va_arg(ap, const char*);
72070 sqlite3VdbeAddOp4(p, z==0 ? OP_Null : OP_String8, 0, iDest++, 0, z, 0);
 
 
72071 }else{
72072 assert( c=='i' );
72073 sqlite3VdbeAddOp2(p, OP_Integer, va_arg(ap, int), iDest++);
72074 }
72075 }
 
 
72076 va_end(ap);
72077 }
72078
72079 /*
72080 ** Add an opcode that includes the p4 value as a pointer.
@@ -89667,19 +89769,21 @@
89667 static SQLITE_NOINLINE int walkExpr(Walker *pWalker, Expr *pExpr){
89668 int rc;
89669 testcase( ExprHasProperty(pExpr, EP_TokenOnly) );
89670 testcase( ExprHasProperty(pExpr, EP_Reduced) );
89671 rc = pWalker->xExprCallback(pWalker, pExpr);
89672 if( rc || ExprHasProperty(pExpr,(EP_TokenOnly|EP_Leaf)) ){
89673 return rc & WRC_Abort;
89674 }
89675 if( pExpr->pLeft && walkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;
89676 if( pExpr->pRight && walkExpr(pWalker, pExpr->pRight) ) return WRC_Abort;
89677 if( ExprHasProperty(pExpr, EP_xIsSelect) ){
89678 if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort;
89679 }else if( pExpr->x.pList ){
89680 if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;
 
 
89681 }
89682 return WRC_Continue;
89683 }
89684 SQLITE_PRIVATE int sqlite3WalkExpr(Walker *pWalker, Expr *pExpr){
89685 return pExpr ? walkExpr(pWalker,pExpr) : WRC_Continue;
@@ -89730,11 +89834,11 @@
89730 struct SrcList_item *pItem;
89731
89732 pSrc = p->pSrc;
89733 if( ALWAYS(pSrc) ){
89734 for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){
89735 if( sqlite3WalkSelect(pWalker, pItem->pSelect) ){
89736 return WRC_Abort;
89737 }
89738 if( pItem->fg.isTabFunc
89739 && sqlite3WalkExprList(pWalker, pItem->u1.pFuncArg)
89740 ){
@@ -89762,11 +89866,12 @@
89762 ** If the Walker does not have an xSelectCallback() then this routine
89763 ** is a no-op returning WRC_Continue.
89764 */
89765 SQLITE_PRIVATE int sqlite3WalkSelect(Walker *pWalker, Select *p){
89766 int rc;
89767 if( p==0 || pWalker->xSelectCallback==0 ) return WRC_Continue;
 
89768 do{
89769 rc = pWalker->xSelectCallback(pWalker, p);
89770 if( rc ) return rc & WRC_Abort;
89771 if( sqlite3WalkSelectExpr(pWalker, p)
89772 || sqlite3WalkSelectFrom(pWalker, p)
@@ -90261,10 +90366,11 @@
90261 sqlite3ExprDelete(db, pExpr->pLeft);
90262 pExpr->pLeft = 0;
90263 sqlite3ExprDelete(db, pExpr->pRight);
90264 pExpr->pRight = 0;
90265 pExpr->op = (isTrigger ? TK_TRIGGER : TK_COLUMN);
 
90266 lookupname_end:
90267 if( cnt==1 ){
90268 assert( pNC!=0 );
90269 if( !ExprHasProperty(pExpr, EP_Alias) ){
90270 sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
@@ -90299,11 +90405,10 @@
90299 p->iColumn = (ynVar)iCol;
90300 testcase( iCol==BMS );
90301 testcase( iCol==BMS-1 );
90302 pItem->colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol);
90303 }
90304 ExprSetProperty(p, EP_Resolved);
90305 }
90306 return p;
90307 }
90308
90309 /*
@@ -90359,12 +90464,10 @@
90359 pNC = pWalker->u.pNC;
90360 assert( pNC!=0 );
90361 pParse = pNC->pParse;
90362 assert( pParse==pWalker->pParse );
90363
90364 if( ExprHasProperty(pExpr, EP_Resolved) ) return WRC_Prune;
90365 ExprSetProperty(pExpr, EP_Resolved);
90366 #ifndef NDEBUG
90367 if( pNC->pSrcList && pNC->pSrcList->nAlloc>0 ){
90368 SrcList *pSrcList = pNC->pSrcList;
90369 int i;
90370 for(i=0; i<pNC->pSrcList->nSrc; i++){
@@ -92067,11 +92170,11 @@
92067 memset(pNew, 0, sizeof(Expr));
92068 pNew->op = (u8)op;
92069 pNew->iAgg = -1;
92070 if( pToken ){
92071 if( nExtra==0 ){
92072 pNew->flags |= EP_IntValue;
92073 pNew->u.iValue = iValue;
92074 }else{
92075 pNew->u.zToken = (char*)&pNew[1];
92076 assert( pToken->z!=0 || pToken->n==0 );
92077 if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
@@ -92348,12 +92451,13 @@
92348 #endif
92349 if( !ExprHasProperty(p, (EP_TokenOnly|EP_Leaf)) ){
92350 /* The Expr.x union is never used at the same time as Expr.pRight */
92351 assert( p->x.pList==0 || p->pRight==0 );
92352 if( p->pLeft && p->op!=TK_SELECT_COLUMN ) sqlite3ExprDeleteNN(db, p->pLeft);
92353 sqlite3ExprDelete(db, p->pRight);
92354 if( ExprHasProperty(p, EP_xIsSelect) ){
 
92355 sqlite3SelectDelete(db, p->x.pSelect);
92356 }else{
92357 sqlite3ExprListDelete(db, p->x.pList);
92358 }
92359 }
@@ -103955,16 +104059,16 @@
103955 pItem = &pList->a[pList->nSrc-1];
103956 if( pDatabase && pDatabase->z==0 ){
103957 pDatabase = 0;
103958 }
103959 if( pDatabase ){
103960 Token *pTemp = pDatabase;
103961 pDatabase = pTable;
103962 pTable = pTemp;
 
 
103963 }
103964 pItem->zName = sqlite3NameFromToken(db, pTable);
103965 pItem->zDatabase = sqlite3NameFromToken(db, pDatabase);
103966 return pList;
103967 }
103968
103969 /*
103970 ** Assign VdbeCursor index numbers to all tables in a SrcList
@@ -104149,40 +104253,29 @@
104149 }
104150 sqlite3VdbeAddOp0(v, OP_AutoCommit);
104151 }
104152
104153 /*
104154 ** Generate VDBE code for a COMMIT statement.
104155 */
104156 SQLITE_PRIVATE void sqlite3CommitTransaction(Parse *pParse){
104157 Vdbe *v;
104158
104159 assert( pParse!=0 );
104160 assert( pParse->db!=0 );
104161 if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "COMMIT", 0, 0) ){
104162 return;
104163 }
104164 v = sqlite3GetVdbe(pParse);
104165 if( v ){
104166 sqlite3VdbeAddOp1(v, OP_AutoCommit, 1);
104167 }
104168 }
104169
104170 /*
104171 ** Generate VDBE code for a ROLLBACK statement.
104172 */
104173 SQLITE_PRIVATE void sqlite3RollbackTransaction(Parse *pParse){
104174 Vdbe *v;
104175
104176 assert( pParse!=0 );
104177 assert( pParse->db!=0 );
104178 if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "ROLLBACK", 0, 0) ){
104179 return;
104180 }
104181 v = sqlite3GetVdbe(pParse);
104182 if( v ){
104183 sqlite3VdbeAddOp2(v, OP_AutoCommit, 1, 1);
104184 }
104185 }
104186
104187 /*
104188 ** This function is called by the parser when it parses a command to create,
@@ -104759,11 +104852,11 @@
104759 ** request a definition of the collating sequence. If this doesn't work,
104760 ** an equivalent collating sequence that uses a text encoding different
104761 ** from the main database is substituted, if one is available.
104762 */
104763 SQLITE_PRIVATE int sqlite3CheckCollSeq(Parse *pParse, CollSeq *pColl){
104764 if( pColl ){
104765 const char *zName = pColl->zName;
104766 sqlite3 *db = pParse->db;
104767 CollSeq *p = sqlite3GetCollSeq(pParse, ENC(db), pColl, zName);
104768 if( !p ){
104769 return SQLITE_ERROR;
@@ -104795,22 +104888,21 @@
104795 ){
104796 CollSeq *pColl;
104797 pColl = sqlite3HashFind(&db->aCollSeq, zName);
104798
104799 if( 0==pColl && create ){
104800 int nName = sqlite3Strlen30(zName);
104801 pColl = sqlite3DbMallocZero(db, 3*sizeof(*pColl) + nName + 1);
104802 if( pColl ){
104803 CollSeq *pDel = 0;
104804 pColl[0].zName = (char*)&pColl[3];
104805 pColl[0].enc = SQLITE_UTF8;
104806 pColl[1].zName = (char*)&pColl[3];
104807 pColl[1].enc = SQLITE_UTF16LE;
104808 pColl[2].zName = (char*)&pColl[3];
104809 pColl[2].enc = SQLITE_UTF16BE;
104810 memcpy(pColl[0].zName, zName, nName);
104811 pColl[0].zName[nName] = 0;
104812 pDel = sqlite3HashInsert(&db->aCollSeq, pColl[0].zName, pColl);
104813
104814 /* If a malloc() failure occurred in sqlite3HashInsert(), it will
104815 ** return the pColl pointer to be deleted (because it wasn't added
104816 ** to the hash table).
@@ -104946,11 +105038,12 @@
104946 int i;
104947 for(i=0; i<nDef; i++){
104948 FuncDef *pOther;
104949 const char *zName = aDef[i].zName;
104950 int nName = sqlite3Strlen30(zName);
104951 int h = (sqlite3UpperToLower[(u8)zName[0]] + nName) % SQLITE_FUNC_HASH_SZ;
 
104952 pOther = functionSearch(h, zName);
104953 if( pOther ){
104954 assert( pOther!=&aDef[i] && pOther->pNext!=&aDef[i] );
104955 aDef[i].pNext = pOther->pNext;
104956 pOther->pNext = &aDef[i];
@@ -106109,20 +106202,20 @@
106109 static void typeofFunc(
106110 sqlite3_context *context,
106111 int NotUsed,
106112 sqlite3_value **argv
106113 ){
106114 const char *z = 0;
 
106115 UNUSED_PARAMETER(NotUsed);
106116 switch( sqlite3_value_type(argv[0]) ){
106117 case SQLITE_INTEGER: z = "integer"; break;
106118 case SQLITE_TEXT: z = "text"; break;
106119 case SQLITE_FLOAT: z = "real"; break;
106120 case SQLITE_BLOB: z = "blob"; break;
106121 default: z = "null"; break;
106122 }
106123 sqlite3_result_text(context, z, -1, SQLITE_STATIC);
106124 }
106125
106126
106127 /*
106128 ** Implementation of the length() function
@@ -112042,10 +112135,15 @@
112042 /* Version 3.14.0 and later */
112043 int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*);
112044 char *(*expanded_sql)(sqlite3_stmt*);
112045 /* Version 3.18.0 and later */
112046 void (*set_last_insert_rowid)(sqlite3*,sqlite3_int64);
 
 
 
 
 
112047 };
112048
112049 /*
112050 ** This is the function signature used for all extension entry points. It
112051 ** is also defined in the file "loadext.c".
@@ -112302,10 +112400,13 @@
112302 /* Version 3.14.0 and later */
112303 #define sqlite3_trace_v2 sqlite3_api->trace_v2
112304 #define sqlite3_expanded_sql sqlite3_api->expanded_sql
112305 /* Version 3.18.0 and later */
112306 #define sqlite3_set_last_insert_rowid sqlite3_api->set_last_insert_rowid
 
 
 
112307 #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
112308
112309 #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
112310 /* This case when the file really is being compiled as a loadable
112311 ** extension */
@@ -112357,10 +112458,11 @@
112357 # define sqlite3_create_function16 0
112358 # define sqlite3_errmsg16 0
112359 # define sqlite3_open16 0
112360 # define sqlite3_prepare16 0
112361 # define sqlite3_prepare16_v2 0
 
112362 # define sqlite3_result_error16 0
112363 # define sqlite3_result_text16 0
112364 # define sqlite3_result_text16be 0
112365 # define sqlite3_result_text16le 0
112366 # define sqlite3_value_text16 0
@@ -112729,11 +112831,14 @@
112729 sqlite3_system_errno,
112730 /* Version 3.14.0 and later */
112731 sqlite3_trace_v2,
112732 sqlite3_expanded_sql,
112733 /* Version 3.18.0 and later */
112734 sqlite3_set_last_insert_rowid
 
 
 
112735 };
112736
112737 /*
112738 ** Attempt to load an SQLite extension library contained in the file
112739 ** zFile. The entry point is zProc. zProc may be 0 in which case a
@@ -113151,39 +113256,42 @@
113151 #define PragTyp_DATABASE_LIST 10
113152 #define PragTyp_DEFAULT_CACHE_SIZE 11
113153 #define PragTyp_ENCODING 12
113154 #define PragTyp_FOREIGN_KEY_CHECK 13
113155 #define PragTyp_FOREIGN_KEY_LIST 14
113156 #define PragTyp_INCREMENTAL_VACUUM 15
113157 #define PragTyp_INDEX_INFO 16
113158 #define PragTyp_INDEX_LIST 17
113159 #define PragTyp_INTEGRITY_CHECK 18
113160 #define PragTyp_JOURNAL_MODE 19
113161 #define PragTyp_JOURNAL_SIZE_LIMIT 20
113162 #define PragTyp_LOCK_PROXY_FILE 21
113163 #define PragTyp_LOCKING_MODE 22
113164 #define PragTyp_PAGE_COUNT 23
113165 #define PragTyp_MMAP_SIZE 24
113166 #define PragTyp_OPTIMIZE 25
113167 #define PragTyp_PAGE_SIZE 26
113168 #define PragTyp_SECURE_DELETE 27
113169 #define PragTyp_SHRINK_MEMORY 28
113170 #define PragTyp_SOFT_HEAP_LIMIT 29
113171 #define PragTyp_SYNCHRONOUS 30
113172 #define PragTyp_TABLE_INFO 31
113173 #define PragTyp_TEMP_STORE 32
113174 #define PragTyp_TEMP_STORE_DIRECTORY 33
113175 #define PragTyp_THREADS 34
113176 #define PragTyp_WAL_AUTOCHECKPOINT 35
113177 #define PragTyp_WAL_CHECKPOINT 36
113178 #define PragTyp_ACTIVATE_EXTENSIONS 37
113179 #define PragTyp_HEXKEY 38
113180 #define PragTyp_KEY 39
113181 #define PragTyp_REKEY 40
113182 #define PragTyp_LOCK_STATUS 41
113183 #define PragTyp_PARSER_TRACE 42
113184 #define PragTyp_STATS 43
 
 
 
113185
113186 /* Property flags associated with various pragma. */
113187 #define PragFlg_NeedSchema 0x01 /* Force schema load before running */
113188 #define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */
113189 #define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
@@ -113225,30 +113333,33 @@
113225 /* 24 */ "origin",
113226 /* 25 */ "partial",
113227 /* 26 */ "seq", /* Used by: database_list */
113228 /* 27 */ "name",
113229 /* 28 */ "file",
113230 /* 29 */ "seq", /* Used by: collation_list */
113231 /* 30 */ "name",
113232 /* 31 */ "id", /* Used by: foreign_key_list */
113233 /* 32 */ "seq",
113234 /* 33 */ "table",
113235 /* 34 */ "from",
113236 /* 35 */ "to",
113237 /* 36 */ "on_update",
113238 /* 37 */ "on_delete",
113239 /* 38 */ "match",
113240 /* 39 */ "table", /* Used by: foreign_key_check */
113241 /* 40 */ "rowid",
113242 /* 41 */ "parent",
113243 /* 42 */ "fkid",
113244 /* 43 */ "busy", /* Used by: wal_checkpoint */
113245 /* 44 */ "log",
113246 /* 45 */ "checkpointed",
113247 /* 46 */ "timeout", /* Used by: busy_timeout */
113248 /* 47 */ "database", /* Used by: lock_status */
113249 /* 48 */ "status",
 
 
 
113250 };
113251
113252 /* Definitions of all built-in pragmas */
113253 typedef struct PragmaName {
113254 const char *const zName; /* Name of pragma */
@@ -113290,11 +113401,11 @@
113290 #endif
113291 #endif
113292 {/* zName: */ "busy_timeout",
113293 /* ePragTyp: */ PragTyp_BUSY_TIMEOUT,
113294 /* ePragFlg: */ PragFlg_Result0,
113295 /* ColNames: */ 46, 1,
113296 /* iArg: */ 0 },
113297 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
113298 {/* zName: */ "cache_size",
113299 /* ePragTyp: */ PragTyp_CACHE_SIZE,
113300 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
@@ -113327,11 +113438,11 @@
113327 #endif
113328 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
113329 {/* zName: */ "collation_list",
113330 /* ePragTyp: */ PragTyp_COLLATION_LIST,
113331 /* ePragFlg: */ PragFlg_Result0,
113332 /* ColNames: */ 29, 2,
113333 /* iArg: */ 0 },
113334 #endif
113335 #if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
113336 {/* zName: */ "compile_options",
113337 /* ePragTyp: */ PragTyp_COMPILE_OPTIONS,
@@ -113399,18 +113510,18 @@
113399 #endif
113400 #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
113401 {/* zName: */ "foreign_key_check",
113402 /* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK,
113403 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0,
113404 /* ColNames: */ 39, 4,
113405 /* iArg: */ 0 },
113406 #endif
113407 #if !defined(SQLITE_OMIT_FOREIGN_KEY)
113408 {/* zName: */ "foreign_key_list",
113409 /* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST,
113410 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
113411 /* ColNames: */ 31, 8,
113412 /* iArg: */ 0 },
113413 #endif
113414 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
113415 #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
113416 {/* zName: */ "foreign_keys",
@@ -113436,10 +113547,19 @@
113436 {/* zName: */ "fullfsync",
113437 /* ePragTyp: */ PragTyp_FLAG,
113438 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
113439 /* ColNames: */ 0, 0,
113440 /* iArg: */ SQLITE_FullFSync },
 
 
 
 
 
 
 
 
 
113441 #endif
113442 #if defined(SQLITE_HAS_CODEC)
113443 {/* zName: */ "hexkey",
113444 /* ePragTyp: */ PragTyp_HEXKEY,
113445 /* ePragFlg: */ 0,
@@ -113526,11 +113646,11 @@
113526 #endif
113527 #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
113528 {/* zName: */ "lock_status",
113529 /* ePragTyp: */ PragTyp_LOCK_STATUS,
113530 /* ePragFlg: */ PragFlg_Result0,
113531 /* ColNames: */ 47, 2,
113532 /* iArg: */ 0 },
113533 #endif
113534 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
113535 {/* zName: */ "locking_mode",
113536 /* ePragTyp: */ PragTyp_LOCKING_MODE,
@@ -113545,10 +113665,21 @@
113545 {/* zName: */ "mmap_size",
113546 /* ePragTyp: */ PragTyp_MMAP_SIZE,
113547 /* ePragFlg: */ 0,
113548 /* ColNames: */ 0, 0,
113549 /* iArg: */ 0 },
 
 
 
 
 
 
 
 
 
 
 
113550 #endif
113551 {/* zName: */ "optimize",
113552 /* ePragTyp: */ PragTyp_OPTIMIZE,
113553 /* ePragFlg: */ PragFlg_Result1|PragFlg_NeedSchema,
113554 /* ColNames: */ 0, 0,
@@ -113569,10 +113700,17 @@
113569 {/* zName: */ "parser_trace",
113570 /* ePragTyp: */ PragTyp_PARSER_TRACE,
113571 /* ePragFlg: */ 0,
113572 /* ColNames: */ 0, 0,
113573 /* iArg: */ 0 },
 
 
 
 
 
 
 
113574 #endif
113575 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
113576 {/* zName: */ "query_only",
113577 /* ePragTyp: */ PragTyp_FLAG,
113578 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
@@ -113733,11 +113871,11 @@
113733 /* ColNames: */ 0, 0,
113734 /* iArg: */ 0 },
113735 {/* zName: */ "wal_checkpoint",
113736 /* ePragTyp: */ PragTyp_WAL_CHECKPOINT,
113737 /* ePragFlg: */ PragFlg_NeedSchema,
113738 /* ColNames: */ 43, 3,
113739 /* iArg: */ 0 },
113740 #endif
113741 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
113742 {/* zName: */ "writable_schema",
113743 /* ePragTyp: */ PragTyp_FLAG,
@@ -113744,11 +113882,11 @@
113744 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
113745 /* ColNames: */ 0, 0,
113746 /* iArg: */ SQLITE_WriteSchema },
113747 #endif
113748 };
113749 /* Number of pragmas: 60 on by default, 74 total. */
113750
113751 /************** End of pragma.h **********************************************/
113752 /************** Continuing where we left off in pragma.c *********************/
113753
113754 /*
@@ -114234,22 +114372,26 @@
114234 break;
114235 }
114236
114237 /*
114238 ** PRAGMA [schema.]secure_delete
114239 ** PRAGMA [schema.]secure_delete=ON/OFF
114240 **
114241 ** The first form reports the current setting for the
114242 ** secure_delete flag. The second form changes the secure_delete
114243 ** flag setting and reports thenew value.
114244 */
114245 case PragTyp_SECURE_DELETE: {
114246 Btree *pBt = pDb->pBt;
114247 int b = -1;
114248 assert( pBt!=0 );
114249 if( zRight ){
114250 b = sqlite3GetBoolean(zRight, 0);
 
 
 
 
114251 }
114252 if( pId2->n==0 && b>=0 ){
114253 int ii;
114254 for(ii=0; ii<db->nDb; ii++){
114255 sqlite3BtreeSecureDelete(db->aDb[ii].pBt, b);
@@ -114827,11 +114969,10 @@
114827 pCol->zName,
114828 sqlite3ColumnType(pCol,""),
114829 pCol->notNull ? 1 : 0,
114830 pCol->pDflt ? pCol->pDflt->u.zToken : 0,
114831 k);
114832 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 6);
114833 }
114834 }
114835 }
114836 break;
114837
@@ -114847,13 +114988,12 @@
114847 pTab->zName,
114848 0,
114849 pTab->szTabRow,
114850 pTab->nRowLogEst,
114851 pTab->tabFlags);
114852 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5);
114853 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
114854 sqlite3VdbeMultiLoad(v, 2, "siii",
114855 pIdx->zName,
114856 pIdx->szIdxRow,
114857 pIdx->aiRowLogEst[0],
114858 pIdx->hasStat1);
114859 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5);
@@ -114882,14 +115022,14 @@
114882 pTab = pIdx->pTable;
114883 sqlite3CodeVerifySchema(pParse, iDb);
114884 assert( pParse->nMem<=pPragma->nPragCName );
114885 for(i=0; i<mx; i++){
114886 i16 cnum = pIdx->aiColumn[i];
114887 sqlite3VdbeMultiLoad(v, 1, "iis", i, cnum,
114888 cnum<0 ? 0 : pTab->aCol[cnum].zName);
114889 if( pPragma->iArg ){
114890 sqlite3VdbeMultiLoad(v, 4, "isi",
114891 pIdx->aSortOrder[i],
114892 pIdx->azColl[i],
114893 i<pIdx->nKeyCol);
114894 }
114895 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, pParse->nMem);
@@ -114912,11 +115052,10 @@
114912 i,
114913 pIdx->zName,
114914 IsUniqueIndex(pIdx),
114915 azOrigin[pIdx->idxType],
114916 pIdx->pPartIdxWhere!=0);
114917 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5);
114918 }
114919 }
114920 }
114921 break;
114922
@@ -114928,11 +115067,10 @@
114928 assert( db->aDb[i].zDbSName!=0 );
114929 sqlite3VdbeMultiLoad(v, 1, "iss",
114930 i,
114931 db->aDb[i].zDbSName,
114932 sqlite3BtreeGetFilename(db->aDb[i].pBt));
114933 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3);
114934 }
114935 }
114936 break;
114937
114938 case PragTyp_COLLATION_LIST: {
@@ -114940,14 +115078,57 @@
114940 HashElem *p;
114941 pParse->nMem = 2;
114942 for(p=sqliteHashFirst(&db->aCollSeq); p; p=sqliteHashNext(p)){
114943 CollSeq *pColl = (CollSeq *)sqliteHashData(p);
114944 sqlite3VdbeMultiLoad(v, 1, "is", i++, pColl->zName);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114945 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);
114946 }
114947 }
114948 break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114949 #endif /* SQLITE_OMIT_SCHEMA_PRAGMAS */
114950
114951 #ifndef SQLITE_OMIT_FOREIGN_KEY
114952 case PragTyp_FOREIGN_KEY_LIST: if( zRight ){
114953 FKey *pFK;
@@ -114969,11 +115150,10 @@
114969 pTab->aCol[pFK->aCol[j].iFrom].zName,
114970 pFK->aCol[j].zCol,
114971 actionName(pFK->aAction[1]), /* ON UPDATE */
114972 actionName(pFK->aAction[0]), /* ON DELETE */
114973 "NONE");
114974 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 8);
114975 }
114976 ++i;
114977 pFK = pFK->pNextFrom;
114978 }
114979 }
@@ -115079,11 +115259,11 @@
115079 if( HasRowid(pTab) ){
115080 sqlite3VdbeAddOp2(v, OP_Rowid, 0, regResult+1);
115081 }else{
115082 sqlite3VdbeAddOp2(v, OP_Null, 0, regResult+1);
115083 }
115084 sqlite3VdbeMultiLoad(v, regResult+2, "si", pFK->zTo, i-1);
115085 sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, 4);
115086 sqlite3VdbeResolveLabel(v, addrOk);
115087 sqlite3DbFree(db, aiCols);
115088 }
115089 sqlite3VdbeAddOp2(v, OP_Next, 0, addrTop+1); VdbeCoverage(v);
@@ -115781,11 +115961,10 @@
115781 }else if( sqlite3_file_control(db, i ? db->aDb[i].zDbSName : 0,
115782 SQLITE_FCNTL_LOCKSTATE, &j)==SQLITE_OK ){
115783 zState = azLockName[j];
115784 }
115785 sqlite3VdbeMultiLoad(v, 1, "ss", db->aDb[i].zDbSName, zState);
115786 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);
115787 }
115788 break;
115789 }
115790 #endif
115791
@@ -118621,24 +118800,50 @@
118621 return 0;
118622 }
118623
118624
118625 /*
118626 ** Generate code that will tell the VDBE the names of columns
118627 ** in the result set. This information is used to provide the
118628 ** azCol[] values in the callback.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118629 */
118630 static void generateColumnNames(
118631 Parse *pParse, /* Parser context */
118632 SrcList *pTabList, /* List of tables */
118633 ExprList *pEList /* Expressions defining the result set */
118634 ){
118635 Vdbe *v = pParse->pVdbe;
118636 int i;
118637 Table *pTab;
118638 sqlite3 *db = pParse->db;
118639 int fullNames, shortNames;
 
118640
118641 #ifndef SQLITE_OMIT_EXPLAIN
118642 /* If this is an EXPLAIN, skip this step */
118643 if( pParse->explain ){
118644 return;
@@ -118647,21 +118852,23 @@
118647
118648 if( pParse->colNamesSet || db->mallocFailed ) return;
118649 assert( v!=0 );
118650 assert( pTabList!=0 );
118651 pParse->colNamesSet = 1;
118652 fullNames = (db->flags & SQLITE_FullColNames)!=0;
118653 shortNames = (db->flags & SQLITE_ShortColNames)!=0;
118654 sqlite3VdbeSetNumCols(v, pEList->nExpr);
118655 for(i=0; i<pEList->nExpr; i++){
118656 Expr *p;
118657 p = pEList->a[i].pExpr;
118658 if( NEVER(p==0) ) continue;
118659 if( pEList->a[i].zName ){
 
118660 char *zName = pEList->a[i].zName;
118661 sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_TRANSIENT);
118662 }else if( (p->op==TK_COLUMN || p->op==TK_AGG_COLUMN)
 
118663 && (pTab = tableWithCursor(pTabList, p->iTable))!=0
118664 ){
118665 char *zCol;
118666 int iCol = p->iColumn;
118667 if( iCol<0 ) iCol = pTab->iPKey;
@@ -118669,14 +118876,11 @@
118669 if( iCol<0 ){
118670 zCol = "rowid";
118671 }else{
118672 zCol = pTab->aCol[iCol].zName;
118673 }
118674 if( !shortNames && !fullNames ){
118675 sqlite3VdbeSetColName(v, i, COLNAME_NAME,
118676 sqlite3DbStrDup(db, pEList->a[i].zSpan), SQLITE_DYNAMIC);
118677 }else if( fullNames ){
118678 char *zName = 0;
118679 zName = sqlite3MPrintf(db, "%s.%s", pTab->zName, zCol);
118680 sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_DYNAMIC);
118681 }else{
118682 sqlite3VdbeSetColName(v, i, COLNAME_NAME, zCol, SQLITE_TRANSIENT);
@@ -118700,10 +118904,19 @@
118700 ** Only the column names are computed. Column.zType, Column.zColl,
118701 ** and other fields of Column are zeroed.
118702 **
118703 ** Return SQLITE_OK on success. If a memory allocation error occurs,
118704 ** store NULL in *paCol and 0 in *pnCol and return SQLITE_NOMEM.
 
 
 
 
 
 
 
 
 
118705 */
118706 SQLITE_PRIVATE int sqlite3ColumnsFromExprList(
118707 Parse *pParse, /* Parsing context */
118708 ExprList *pEList, /* Expr list from which to derive column names */
118709 i16 *pnCol, /* Write the number of columns here */
@@ -118712,11 +118925,10 @@
118712 sqlite3 *db = pParse->db; /* Database connection */
118713 int i, j; /* Loop counters */
118714 u32 cnt; /* Index added to make the name unique */
118715 Column *aCol, *pCol; /* For looping over result columns */
118716 int nCol; /* Number of columns in the result set */
118717 Expr *p; /* Expression for a single result column */
118718 char *zName; /* Column name */
118719 int nName; /* Size of name in zName[] */
118720 Hash ht; /* Hash table of column names */
118721
118722 sqlite3HashInit(&ht);
@@ -118733,24 +118945,22 @@
118733 *paCol = aCol;
118734
118735 for(i=0, pCol=aCol; i<nCol && !db->mallocFailed; i++, pCol++){
118736 /* Get an appropriate name for the column
118737 */
118738 p = sqlite3ExprSkipCollate(pEList->a[i].pExpr);
118739 if( (zName = pEList->a[i].zName)!=0 ){
118740 /* If the column contains an "AS <name>" phrase, use <name> as the name */
118741 }else{
118742 Expr *pColExpr = p; /* The expression that is the result column name */
118743 Table *pTab; /* Table associated with this expression */
118744 while( pColExpr->op==TK_DOT ){
118745 pColExpr = pColExpr->pRight;
118746 assert( pColExpr!=0 );
118747 }
118748 if( pColExpr->op==TK_COLUMN && pColExpr->pTab!=0 ){
118749 /* For columns use the column name name */
118750 int iCol = pColExpr->iColumn;
118751 pTab = pColExpr->pTab;
118752 if( iCol<0 ) iCol = pTab->iPKey;
118753 zName = iCol>=0 ? pTab->aCol[iCol].zName : "rowid";
118754 }else if( pColExpr->op==TK_ID ){
118755 assert( !ExprHasProperty(pColExpr, EP_IntValue) );
118756 zName = pColExpr->u.zToken;
@@ -118757,11 +118967,15 @@
118757 }else{
118758 /* Use the original text of the column expression as its name */
118759 zName = pEList->a[i].zSpan;
118760 }
118761 }
118762 zName = sqlite3MPrintf(db, "%s", zName);
 
 
 
 
118763
118764 /* Make sure the column name is unique. If the name is not unique,
118765 ** append an integer to the name so that it becomes unique.
118766 */
118767 cnt = 0;
@@ -122070,10 +122284,92 @@
122070 return pItem;
122071 }
122072 return 0;
122073 }
122074
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122075 /*
122076 ** Generate code for the SELECT statement given in the p argument.
122077 **
122078 ** The results are returned according to the SelectDest structure.
122079 ** See comments in sqliteInt.h for further information.
@@ -122381,10 +122677,20 @@
122381 if( sqlite3SelectTrace & 0x400 ){
122382 SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n"));
122383 sqlite3TreeViewSelect(0, p, 0);
122384 }
122385 #endif
 
 
 
 
 
 
 
 
 
 
122386
122387 /* If the query is DISTINCT with an ORDER BY but is not an aggregate, and
122388 ** if the select-list is the same as the ORDER BY list, then this query
122389 ** can be rewritten as a GROUP BY. In other words, this:
122390 **
@@ -127095,10 +127401,11 @@
127095 #endif
127096 #define TERM_LIKEOPT 0x100 /* Virtual terms from the LIKE optimization */
127097 #define TERM_LIKECOND 0x200 /* Conditionally this LIKE operator term */
127098 #define TERM_LIKE 0x400 /* The original LIKE operator */
127099 #define TERM_IS 0x800 /* Term.pExpr is an IS operator */
 
127100
127101 /*
127102 ** An instance of the WhereScan object is used as an iterator for locating
127103 ** terms in the WHERE clause that are useful to the query planner.
127104 */
@@ -127184,10 +127491,11 @@
127184 ** does not really matter. What is important is that sparse cursor
127185 ** numbers all get mapped into bit numbers that begin with 0 and contain
127186 ** no gaps.
127187 */
127188 struct WhereMaskSet {
 
127189 int n; /* Number of assigned cursor values */
127190 int ix[BMS]; /* Cursor assigned to each bit */
127191 };
127192
127193 /*
@@ -128481,11 +128789,11 @@
128481 int addrHalt; /* addrBrk for the outermost loop */
128482 int addrCont; /* Jump here to continue with next cycle */
128483 int iRowidReg = 0; /* Rowid is stored in this register, if not zero */
128484 int iReleaseReg = 0; /* Temp register to free before returning */
128485 Index *pIdx = 0; /* Index used by loop (if any) */
128486 int loopAgain; /* True if constraint generator loop should repeat */
128487
128488 pParse = pWInfo->pParse;
128489 v = pParse->pVdbe;
128490 pWC = &pWInfo->sWC;
128491 db = pParse->db;
@@ -129376,17 +129684,24 @@
129376 #endif
129377
129378 /* Insert code to test every subexpression that can be completely
129379 ** computed using the current set of tables.
129380 **
129381 ** This loop may run either once (pIdx==0) or twice (pIdx!=0). If
129382 ** it is run twice, then the first iteration codes those sub-expressions
129383 ** that can be computed using columns from pIdx only (without seeking
129384 ** the main table cursor).
 
 
 
 
 
 
129385 */
 
129386 do{
129387 loopAgain = 0;
129388 for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
129389 Expr *pE;
129390 int skipLikeAddr = 0;
129391 testcase( pTerm->wtFlags & TERM_VIRTUAL );
129392 testcase( pTerm->wtFlags & TERM_CODED );
@@ -129400,14 +129715,20 @@
129400 pE = pTerm->pExpr;
129401 assert( pE!=0 );
129402 if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){
129403 continue;
129404 }
129405 if( pIdx && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){
129406 loopAgain = 1;
 
 
 
 
 
129407 continue;
129408 }
 
129409 if( pTerm->wtFlags & TERM_LIKECOND ){
129410 /* If the TERM_LIKECOND flag is set, that means that the range search
129411 ** is sufficient to guarantee that the LIKE operator is true, so we
129412 ** can skip the call to the like(A,B) function. But this only works
129413 ** for strings. So do not skip the call to the function on the pass
@@ -129419,16 +129740,22 @@
129419 assert( x>0 );
129420 skipLikeAddr = sqlite3VdbeAddOp1(v, (x&1)?OP_IfNot:OP_If, (int)(x>>1));
129421 VdbeCoverage(v);
129422 #endif
129423 }
 
 
 
 
 
 
129424 sqlite3ExprIfFalse(pParse, pE, addrCont, SQLITE_JUMPIFNULL);
129425 if( skipLikeAddr ) sqlite3VdbeJumpHere(v, skipLikeAddr);
129426 pTerm->wtFlags |= TERM_CODED;
129427 }
129428 pIdx = 0;
129429 }while( loopAgain );
129430
129431 /* Insert code to test for implied constraints based on transitivity
129432 ** of the "==" operator.
129433 **
129434 ** Example: If the WHERE clause contains "t1.a=t2.b" and "t2.b=123"
@@ -130438,11 +130765,13 @@
130438 }else if( op==TK_ISNULL ){
130439 pTerm->prereqRight = 0;
130440 }else{
130441 pTerm->prereqRight = sqlite3WhereExprUsage(pMaskSet, pExpr->pRight);
130442 }
 
130443 prereqAll = sqlite3WhereExprUsage(pMaskSet, pExpr);
 
130444 if( ExprHasProperty(pExpr, EP_FromJoin) ){
130445 Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->iRightJoinTable);
130446 prereqAll |= x;
130447 extraRight = x-1; /* ON clause terms may not be used with an index
130448 ** on left table of a LEFT JOIN. Ticket #3015 */
@@ -130869,13 +131198,16 @@
130869 if( p->op==TK_COLUMN ){
130870 return sqlite3WhereGetMask(pMaskSet, p->iTable);
130871 }
130872 mask = (p->op==TK_IF_NULL_ROW) ? sqlite3WhereGetMask(pMaskSet, p->iTable) : 0;
130873 assert( !ExprHasProperty(p, EP_TokenOnly) );
130874 if( p->pRight ) mask |= sqlite3WhereExprUsage(pMaskSet, p->pRight);
130875 if( p->pLeft ) mask |= sqlite3WhereExprUsage(pMaskSet, p->pLeft);
130876 if( ExprHasProperty(p, EP_xIsSelect) ){
 
 
 
 
130877 mask |= exprSelectUsage(pMaskSet, p->x.pSelect);
130878 }else if( p->x.pList ){
130879 mask |= sqlite3WhereExprListUsage(pMaskSet, p->x.pList);
130880 }
130881 return mask;
@@ -135501,13 +135833,17 @@
135501 for(ii=0; ii<pTabList->nSrc; ii++){
135502 createMask(pMaskSet, pTabList->a[ii].iCursor);
135503 sqlite3WhereTabFuncArgs(pParse, &pTabList->a[ii], &pWInfo->sWC);
135504 }
135505 #ifdef SQLITE_DEBUG
135506 for(ii=0; ii<pTabList->nSrc; ii++){
135507 Bitmask m = sqlite3WhereGetMask(pMaskSet, pTabList->a[ii].iCursor);
135508 assert( m==MASKBIT(ii) );
 
 
 
 
135509 }
135510 #endif
135511
135512 /* Analyze all of the subexpressions. */
135513 sqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC);
@@ -136348,20 +136684,20 @@
136348 #define sqlite3ParserARG_SDECL Parse *pParse;
136349 #define sqlite3ParserARG_PDECL ,Parse *pParse
136350 #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse
136351 #define sqlite3ParserARG_STORE yypParser->pParse = pParse
136352 #define YYFALLBACK 1
136353 #define YYNSTATE 456
136354 #define YYNRULE 331
136355 #define YY_MAX_SHIFT 455
136356 #define YY_MIN_SHIFTREDUCE 667
136357 #define YY_MAX_SHIFTREDUCE 997
136358 #define YY_MIN_REDUCE 998
136359 #define YY_MAX_REDUCE 1328
136360 #define YY_ERROR_ACTION 1329
136361 #define YY_ACCEPT_ACTION 1330
136362 #define YY_NO_ACTION 1331
136363 /************* End control #defines *******************************************/
136364
136365 /* Define the yytestcase() macro to be a no-op if is not already defined
136366 ** otherwise.
136367 **
@@ -136429,169 +136765,169 @@
136429 ** yy_reduce_ofst[] For each state, the offset into yy_action for
136430 ** shifting non-terminals after a reduce.
136431 ** yy_default[] Default action for each state.
136432 **
136433 *********** Begin parsing tables **********************************************/
136434 #define YY_ACTTAB_COUNT (1566)
136435 static const YYACTIONTYPE yy_action[] = {
136436 /* 0 */ 325, 411, 343, 751, 751, 203, 944, 354, 974, 98,
136437 /* 10 */ 98, 98, 98, 91, 96, 96, 96, 96, 95, 95,
136438 /* 20 */ 94, 94, 94, 93, 351, 1330, 155, 155, 2, 812,
136439 /* 30 */ 976, 976, 98, 98, 98, 98, 20, 96, 96, 96,
136440 /* 40 */ 96, 95, 95, 94, 94, 94, 93, 351, 92, 89,
136441 /* 50 */ 178, 99, 100, 90, 852, 855, 844, 844, 97, 97,
136442 /* 60 */ 98, 98, 98, 98, 351, 96, 96, 96, 96, 95,
136443 /* 70 */ 95, 94, 94, 94, 93, 351, 325, 340, 974, 262,
136444 /* 80 */ 365, 251, 212, 169, 287, 405, 282, 404, 199, 790,
136445 /* 90 */ 242, 412, 21, 955, 379, 280, 93, 351, 791, 95,
136446 /* 100 */ 95, 94, 94, 94, 93, 351, 976, 976, 96, 96,
136447 /* 110 */ 96, 96, 95, 95, 94, 94, 94, 93, 351, 812,
136448 /* 120 */ 329, 242, 412, 1242, 831, 1242, 132, 99, 100, 90,
136449 /* 130 */ 852, 855, 844, 844, 97, 97, 98, 98, 98, 98,
136450 /* 140 */ 450, 96, 96, 96, 96, 95, 95, 94, 94, 94,
136451 /* 150 */ 93, 351, 325, 824, 349, 348, 120, 818, 120, 75,
136452 /* 160 */ 52, 52, 955, 956, 957, 1090, 982, 146, 361, 262,
136453 /* 170 */ 370, 261, 955, 980, 959, 981, 92, 89, 178, 371,
136454 /* 180 */ 230, 371, 976, 976, 1147, 361, 360, 101, 823, 823,
136455 /* 190 */ 825, 384, 24, 1293, 381, 428, 413, 369, 983, 380,
136456 /* 200 */ 983, 1038, 325, 99, 100, 90, 852, 855, 844, 844,
136457 /* 210 */ 97, 97, 98, 98, 98, 98, 373, 96, 96, 96,
136458 /* 220 */ 96, 95, 95, 94, 94, 94, 93, 351, 955, 132,
136459 /* 230 */ 895, 450, 976, 976, 895, 60, 94, 94, 94, 93,
136460 /* 240 */ 351, 955, 956, 957, 959, 103, 361, 955, 385, 334,
136461 /* 250 */ 701, 52, 52, 99, 100, 90, 852, 855, 844, 844,
136462 /* 260 */ 97, 97, 98, 98, 98, 98, 1028, 96, 96, 96,
136463 /* 270 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 455,
136464 /* 280 */ 1000, 450, 227, 61, 157, 243, 344, 114, 1031, 1218,
136465 /* 290 */ 147, 831, 955, 373, 1077, 955, 320, 955, 956, 957,
136466 /* 300 */ 194, 10, 10, 402, 399, 398, 1218, 1220, 976, 976,
136467 /* 310 */ 761, 171, 170, 157, 397, 337, 955, 956, 957, 701,
136468 /* 320 */ 824, 310, 153, 955, 818, 321, 82, 23, 80, 99,
136469 /* 330 */ 100, 90, 852, 855, 844, 844, 97, 97, 98, 98,
136470 /* 340 */ 98, 98, 893, 96, 96, 96, 96, 95, 95, 94,
136471 /* 350 */ 94, 94, 93, 351, 325, 823, 823, 825, 277, 231,
136472 /* 360 */ 300, 955, 956, 957, 955, 956, 957, 1218, 194, 25,
136473 /* 370 */ 450, 402, 399, 398, 955, 355, 300, 450, 955, 74,
136474 /* 380 */ 450, 1, 397, 132, 976, 976, 955, 224, 224, 812,
136475 /* 390 */ 10, 10, 955, 956, 957, 1297, 132, 52, 52, 415,
136476 /* 400 */ 52, 52, 1069, 1069, 339, 99, 100, 90, 852, 855,
136477 /* 410 */ 844, 844, 97, 97, 98, 98, 98, 98, 1120, 96,
136478 /* 420 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351,
136479 /* 430 */ 325, 1119, 428, 418, 705, 428, 427, 1267, 1267, 262,
136480 /* 440 */ 370, 261, 955, 955, 956, 957, 756, 955, 956, 957,
136481 /* 450 */ 450, 755, 450, 1064, 1043, 955, 956, 957, 443, 710,
136482 /* 460 */ 976, 976, 1064, 394, 92, 89, 178, 447, 447, 447,
136483 /* 470 */ 51, 51, 52, 52, 439, 777, 1030, 92, 89, 178,
136484 /* 480 */ 172, 99, 100, 90, 852, 855, 844, 844, 97, 97,
136485 /* 490 */ 98, 98, 98, 98, 198, 96, 96, 96, 96, 95,
136486 /* 500 */ 95, 94, 94, 94, 93, 351, 325, 428, 408, 914,
136487 /* 510 */ 698, 955, 956, 957, 92, 89, 178, 224, 224, 157,
136488 /* 520 */ 241, 221, 419, 299, 775, 915, 416, 375, 450, 415,
136489 /* 530 */ 58, 324, 1067, 1067, 1249, 379, 976, 976, 379, 776,
136490 /* 540 */ 449, 916, 363, 739, 296, 685, 9, 9, 52, 52,
136491 /* 550 */ 234, 330, 234, 256, 417, 740, 280, 99, 100, 90,
136492 /* 560 */ 852, 855, 844, 844, 97, 97, 98, 98, 98, 98,
136493 /* 570 */ 450, 96, 96, 96, 96, 95, 95, 94, 94, 94,
136494 /* 580 */ 93, 351, 325, 423, 72, 450, 832, 120, 368, 450,
136495 /* 590 */ 10, 10, 5, 301, 203, 450, 177, 974, 253, 420,
136496 /* 600 */ 255, 775, 200, 175, 233, 10, 10, 841, 841, 36,
136497 /* 610 */ 36, 1296, 976, 976, 728, 37, 37, 349, 348, 425,
136498 /* 620 */ 203, 260, 775, 974, 232, 935, 1323, 875, 338, 1323,
136499 /* 630 */ 422, 853, 856, 99, 100, 90, 852, 855, 844, 844,
136500 /* 640 */ 97, 97, 98, 98, 98, 98, 268, 96, 96, 96,
136501 /* 650 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 845,
136502 /* 660 */ 450, 983, 817, 983, 1207, 450, 914, 974, 719, 350,
136503 /* 670 */ 350, 350, 933, 177, 450, 935, 1324, 254, 198, 1324,
136504 /* 680 */ 12, 12, 915, 403, 450, 27, 27, 250, 976, 976,
136505 /* 690 */ 118, 720, 162, 974, 38, 38, 268, 176, 916, 775,
136506 /* 700 */ 433, 1272, 944, 354, 39, 39, 317, 996, 325, 99,
136507 /* 710 */ 100, 90, 852, 855, 844, 844, 97, 97, 98, 98,
136508 /* 720 */ 98, 98, 933, 96, 96, 96, 96, 95, 95, 94,
136509 /* 730 */ 94, 94, 93, 351, 450, 330, 450, 358, 976, 976,
136510 /* 740 */ 1047, 317, 934, 341, 898, 898, 387, 672, 673, 674,
136511 /* 750 */ 275, 1325, 318, 997, 40, 40, 41, 41, 268, 99,
136512 /* 760 */ 100, 90, 852, 855, 844, 844, 97, 97, 98, 98,
136513 /* 770 */ 98, 98, 450, 96, 96, 96, 96, 95, 95, 94,
136514 /* 780 */ 94, 94, 93, 351, 325, 450, 356, 450, 997, 450,
136515 /* 790 */ 1022, 331, 42, 42, 790, 270, 450, 273, 450, 228,
136516 /* 800 */ 450, 298, 450, 791, 450, 28, 28, 29, 29, 31,
136517 /* 810 */ 31, 450, 1147, 450, 976, 976, 43, 43, 44, 44,
136518 /* 820 */ 45, 45, 11, 11, 46, 46, 892, 78, 892, 268,
136519 /* 830 */ 268, 105, 105, 47, 47, 99, 100, 90, 852, 855,
136520 /* 840 */ 844, 844, 97, 97, 98, 98, 98, 98, 450, 96,
136521 /* 850 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351,
136522 /* 860 */ 325, 450, 117, 450, 1079, 158, 450, 695, 48, 48,
136523 /* 870 */ 229, 1248, 450, 1257, 450, 415, 450, 335, 450, 245,
136524 /* 880 */ 450, 33, 33, 49, 49, 450, 50, 50, 246, 1147,
136525 /* 890 */ 976, 976, 34, 34, 122, 122, 123, 123, 124, 124,
136526 /* 900 */ 56, 56, 268, 81, 249, 35, 35, 197, 196, 195,
136527 /* 910 */ 325, 99, 100, 90, 852, 855, 844, 844, 97, 97,
136528 /* 920 */ 98, 98, 98, 98, 450, 96, 96, 96, 96, 95,
136529 /* 930 */ 95, 94, 94, 94, 93, 351, 450, 695, 450, 1147,
136530 /* 940 */ 976, 976, 973, 1214, 106, 106, 268, 1216, 268, 1273,
136531 /* 950 */ 2, 891, 268, 891, 336, 1046, 53, 53, 107, 107,
136532 /* 960 */ 325, 99, 100, 90, 852, 855, 844, 844, 97, 97,
136533 /* 970 */ 98, 98, 98, 98, 450, 96, 96, 96, 96, 95,
136534 /* 980 */ 95, 94, 94, 94, 93, 351, 450, 1076, 450, 1072,
136535 /* 990 */ 976, 976, 1045, 267, 108, 108, 446, 331, 332, 133,
136536 /* 1000 */ 223, 175, 301, 225, 386, 1262, 104, 104, 121, 121,
136537 /* 1010 */ 325, 99, 88, 90, 852, 855, 844, 844, 97, 97,
136538 /* 1020 */ 98, 98, 98, 98, 1147, 96, 96, 96, 96, 95,
136539 /* 1030 */ 95, 94, 94, 94, 93, 351, 450, 347, 450, 167,
136540 /* 1040 */ 976, 976, 930, 814, 372, 319, 202, 202, 374, 263,
136541 /* 1050 */ 395, 202, 74, 208, 725, 726, 119, 119, 112, 112,
136542 /* 1060 */ 325, 407, 100, 90, 852, 855, 844, 844, 97, 97,
136543 /* 1070 */ 98, 98, 98, 98, 450, 96, 96, 96, 96, 95,
136544 /* 1080 */ 95, 94, 94, 94, 93, 351, 450, 756, 450, 345,
136545 /* 1090 */ 976, 976, 755, 278, 111, 111, 74, 718, 717, 708,
136546 /* 1100 */ 286, 882, 753, 1286, 257, 77, 109, 109, 110, 110,
136547 /* 1110 */ 1237, 285, 1140, 90, 852, 855, 844, 844, 97, 97,
136548 /* 1120 */ 98, 98, 98, 98, 1240, 96, 96, 96, 96, 95,
136549 /* 1130 */ 95, 94, 94, 94, 93, 351, 86, 445, 450, 3,
136550 /* 1140 */ 1200, 450, 1075, 132, 352, 120, 1019, 86, 445, 784,
136551 /* 1150 */ 3, 1097, 202, 377, 448, 352, 1236, 120, 55, 55,
136552 /* 1160 */ 450, 57, 57, 827, 878, 448, 450, 208, 450, 708,
136553 /* 1170 */ 450, 882, 237, 434, 436, 120, 440, 429, 362, 120,
136554 /* 1180 */ 54, 54, 132, 450, 434, 831, 52, 52, 26, 26,
136555 /* 1190 */ 30, 30, 382, 132, 409, 444, 831, 693, 264, 390,
136556 /* 1200 */ 116, 269, 272, 32, 32, 83, 84, 120, 274, 120,
136557 /* 1210 */ 120, 276, 85, 352, 452, 451, 83, 84, 818, 1060,
136558 /* 1220 */ 1044, 428, 430, 85, 352, 452, 451, 120, 120, 818,
136559 /* 1230 */ 378, 218, 281, 827, 1113, 1146, 86, 445, 410, 3,
136560 /* 1240 */ 1093, 1104, 431, 432, 352, 302, 303, 1153, 1027, 823,
136561 /* 1250 */ 823, 825, 826, 19, 448, 1021, 1010, 1009, 1011, 1280,
136562 /* 1260 */ 823, 823, 825, 826, 19, 289, 159, 291, 293, 7,
136563 /* 1270 */ 316, 173, 259, 434, 1135, 364, 252, 1239, 376, 1043,
136564 /* 1280 */ 295, 435, 168, 991, 400, 831, 284, 1211, 1210, 205,
136565 /* 1290 */ 1283, 308, 1256, 86, 445, 988, 3, 1254, 333, 144,
136566 /* 1300 */ 130, 352, 72, 135, 59, 83, 84, 760, 137, 366,
136567 /* 1310 */ 1132, 448, 85, 352, 452, 451, 139, 226, 818, 140,
136568 /* 1320 */ 156, 62, 315, 314, 313, 215, 311, 367, 393, 682,
136569 /* 1330 */ 434, 185, 141, 1241, 142, 160, 148, 1142, 1205, 383,
136570 /* 1340 */ 189, 67, 831, 180, 389, 248, 1225, 1105, 219, 823,
136571 /* 1350 */ 823, 825, 826, 19, 247, 190, 266, 154, 391, 271,
136572 /* 1360 */ 191, 192, 83, 84, 1012, 406, 1063, 182, 322, 85,
136573 /* 1370 */ 352, 452, 451, 1062, 183, 818, 342, 132, 181, 710,
136574 /* 1380 */ 1061, 421, 76, 445, 1035, 3, 323, 1034, 283, 1054,
136575 /* 1390 */ 352, 1101, 1033, 1295, 1053, 71, 204, 6, 288, 290,
136576 /* 1400 */ 448, 1102, 1100, 1099, 79, 292, 823, 823, 825, 826,
136577 /* 1410 */ 19, 294, 297, 438, 346, 442, 102, 1191, 1083, 434,
136578 /* 1420 */ 238, 426, 73, 305, 239, 304, 326, 240, 424, 306,
136579 /* 1430 */ 307, 831, 213, 1018, 22, 950, 453, 214, 216, 217,
136580 /* 1440 */ 454, 1007, 115, 1006, 1001, 125, 126, 235, 127, 668,
136581 /* 1450 */ 327, 83, 84, 359, 353, 244, 166, 328, 85, 352,
136582 /* 1460 */ 452, 451, 134, 179, 818, 357, 113, 890, 810, 888,
136583 /* 1470 */ 136, 128, 138, 742, 258, 184, 904, 143, 145, 63,
136584 /* 1480 */ 64, 65, 66, 129, 907, 903, 187, 186, 8, 13,
136585 /* 1490 */ 188, 265, 896, 149, 202, 823, 823, 825, 826, 19,
136586 /* 1500 */ 388, 985, 150, 161, 285, 684, 392, 396, 151, 721,
136587 /* 1510 */ 193, 68, 14, 401, 279, 15, 69, 236, 830, 829,
136588 /* 1520 */ 131, 858, 750, 70, 16, 414, 754, 4, 783, 220,
136589 /* 1530 */ 222, 174, 152, 437, 778, 201, 17, 77, 74, 18,
136590 /* 1540 */ 873, 859, 857, 913, 862, 912, 207, 206, 939, 163,
136591 /* 1550 */ 210, 940, 209, 164, 441, 861, 165, 211, 828, 694,
136592 /* 1560 */ 87, 312, 309, 945, 1288, 1287,
136593 };
136594 static const YYCODETYPE yy_lookahead[] = {
136595 /* 0 */ 19, 115, 19, 117, 118, 24, 1, 2, 27, 79,
136596 /* 10 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
136597 /* 20 */ 90, 91, 92, 93, 94, 144, 145, 146, 147, 58,
@@ -136734,26 +137070,26 @@
136734 /* 1390 */ 27, 216, 174, 174, 182, 107, 159, 22, 215, 215,
136735 /* 1400 */ 37, 216, 216, 216, 137, 215, 132, 133, 134, 135,
136736 /* 1410 */ 136, 215, 159, 177, 94, 177, 129, 224, 205, 56,
136737 /* 1420 */ 226, 126, 128, 203, 229, 204, 114, 229, 127, 202,
136738 /* 1430 */ 201, 68, 25, 162, 26, 13, 161, 153, 153, 6,
136739 /* 1440 */ 151, 151, 178, 151, 151, 165, 165, 178, 165, 4,
136740 /* 1450 */ 249, 88, 89, 141, 3, 142, 22, 249, 95, 96,
136741 /* 1460 */ 97, 98, 246, 15, 101, 67, 16, 23, 120, 23,
136742 /* 1470 */ 131, 111, 123, 20, 16, 125, 1, 123, 131, 78,
136743 /* 1480 */ 78, 78, 78, 111, 96, 1, 122, 35, 5, 22,
136744 /* 1490 */ 107, 140, 53, 53, 26, 132, 133, 134, 135, 136,
136745 /* 1500 */ 43, 60, 107, 24, 112, 20, 19, 52, 22, 29,
136746 /* 1510 */ 105, 22, 22, 52, 23, 22, 22, 52, 23, 23,
136747 /* 1520 */ 39, 23, 116, 26, 22, 26, 23, 22, 96, 23,
136748 /* 1530 */ 23, 122, 22, 24, 124, 35, 35, 26, 26, 35,
136749 /* 1540 */ 23, 23, 23, 23, 11, 23, 22, 26, 23, 22,
136750 /* 1550 */ 122, 23, 26, 22, 24, 23, 22, 122, 23, 23,
136751 /* 1560 */ 22, 15, 23, 1, 122, 122,
136752 };
136753 #define YY_SHIFT_USE_DFLT (1566)
136754 #define YY_SHIFT_COUNT (455)
136755 #define YY_SHIFT_MIN (-114)
136756 #define YY_SHIFT_MAX (1562)
136757 static const short yy_shift_ofst[] = {
136758 /* 0 */ 5, 1117, 1312, 1128, 1274, 1274, 1274, 1274, 61, -19,
136759 /* 10 */ 57, 57, 183, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
@@ -136765,15 +137101,15 @@
136765 /* 70 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
136766 /* 80 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
136767 /* 90 */ 1363, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
136768 /* 100 */ 1274, 1274, 1274, 1274, -70, -47, -47, -47, -47, -47,
136769 /* 110 */ 24, 11, 146, 296, 524, 444, 529, 529, 296, 3,
136770 /* 120 */ 2, -30, 1566, 1566, 1566, -17, -17, -17, 145, 145,
136771 /* 130 */ 497, 497, 265, 603, 653, 296, 296, 296, 296, 296,
136772 /* 140 */ 296, 296, 296, 296, 296, 296, 296, 296, 296, 296,
136773 /* 150 */ 296, 296, 296, 296, 296, 701, 1078, 147, 147, 2,
136774 /* 160 */ 164, 164, 164, 164, 164, 164, 1566, 1566, 1566, 223,
136775 /* 170 */ 56, 56, 268, 269, 220, 347, 351, 415, 359, 296,
136776 /* 180 */ 296, 296, 296, 296, 296, 296, 296, 296, 296, 296,
136777 /* 190 */ 296, 296, 296, 296, 296, 632, 632, 632, 296, 296,
136778 /* 200 */ 498, 296, 296, 296, 570, 296, 296, 654, 296, 296,
136779 /* 210 */ 296, 296, 296, 296, 296, 296, 296, 296, 636, 200,
@@ -136784,30 +137120,30 @@
136784 /* 260 */ 1277, 1230, 1230, 1172, 1167, 1310, 1204, 1299, 1167, 1167,
136785 /* 270 */ 1310, 1335, 1167, 1310, 1167, 1310, 1335, 1258, 1258, 1258,
136786 /* 280 */ 1329, 1335, 1258, 1273, 1258, 1329, 1258, 1258, 1256, 1288,
136787 /* 290 */ 1256, 1288, 1256, 1288, 1256, 1288, 1167, 1375, 1167, 1267,
136788 /* 300 */ 1335, 1320, 1320, 1335, 1287, 1295, 1294, 1301, 1172, 1407,
136789 /* 310 */ 1408, 1422, 1422, 1433, 1433, 1433, 1433, 1566, 1566, 1566,
136790 /* 320 */ 1566, 1566, 1566, 1566, 1566, 558, 537, 684, 719, 734,
136791 /* 330 */ 799, 840, 1019, 14, 1020, 1021, 1025, 1026, 1027, 1070,
136792 /* 340 */ 1072, 997, 1047, 999, 1079, 1126, 1074, 1141, 694, 819,
136793 /* 350 */ 1174, 1136, 981, 1445, 1451, 1434, 1313, 1448, 1398, 1450,
136794 /* 360 */ 1444, 1446, 1348, 1339, 1360, 1349, 1453, 1350, 1458, 1475,
136795 /* 370 */ 1354, 1347, 1401, 1402, 1403, 1404, 1372, 1388, 1452, 1364,
136796 /* 380 */ 1484, 1483, 1467, 1383, 1351, 1439, 1468, 1440, 1441, 1457,
136797 /* 390 */ 1395, 1479, 1485, 1487, 1392, 1405, 1486, 1455, 1489, 1490,
136798 /* 400 */ 1491, 1493, 1461, 1480, 1494, 1465, 1481, 1495, 1496, 1498,
136799 /* 410 */ 1497, 1406, 1502, 1503, 1505, 1499, 1409, 1506, 1507, 1432,
136800 /* 420 */ 1500, 1510, 1410, 1511, 1501, 1512, 1504, 1517, 1511, 1518,
136801 /* 430 */ 1519, 1520, 1521, 1522, 1524, 1533, 1525, 1527, 1509, 1526,
136802 /* 440 */ 1528, 1531, 1530, 1526, 1532, 1534, 1535, 1536, 1538, 1428,
136803 /* 450 */ 1435, 1442, 1443, 1539, 1546, 1562,
136804 };
136805 #define YY_REDUCE_USE_DFLT (-174)
136806 #define YY_REDUCE_COUNT (324)
136807 #define YY_REDUCE_MIN (-173)
136808 #define YY_REDUCE_MAX (1293)
136809 static const short yy_reduce_ofst[] = {
136810 /* 0 */ -119, 1014, 131, 1031, -12, 225, 228, 300, -40, -45,
136811 /* 10 */ 243, 256, 293, 129, 218, 418, 79, 376, 433, 298,
136812 /* 20 */ 16, 137, 367, 323, -38, 391, -173, -173, -173, -173,
136813 /* 30 */ -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,
@@ -136836,60 +137172,60 @@
136836 /* 260 */ 1115, 1147, 1148, 1137, 1180, 1182, 1110, 1121, 1188, 1189,
136837 /* 270 */ 1197, 1181, 1200, 1202, 1205, 1203, 1191, 1192, 1199, 1206,
136838 /* 280 */ 1207, 1209, 1210, 1211, 1214, 1212, 1218, 1219, 1175, 1183,
136839 /* 290 */ 1185, 1184, 1186, 1190, 1187, 1196, 1237, 1193, 1253, 1194,
136840 /* 300 */ 1236, 1195, 1198, 1238, 1213, 1221, 1220, 1227, 1229, 1271,
136841 /* 310 */ 1275, 1284, 1285, 1289, 1290, 1292, 1293, 1201, 1208, 1216,
136842 /* 320 */ 1280, 1281, 1264, 1269, 1283,
136843 };
136844 static const YYACTIONTYPE yy_default[] = {
136845 /* 0 */ 1277, 1267, 1267, 1267, 1200, 1200, 1200, 1200, 1267, 1094,
136846 /* 10 */ 1123, 1123, 1251, 1329, 1329, 1329, 1329, 1329, 1329, 1199,
136847 /* 20 */ 1329, 1329, 1329, 1329, 1267, 1098, 1129, 1329, 1329, 1329,
136848 /* 30 */ 1329, 1201, 1202, 1329, 1329, 1329, 1250, 1252, 1139, 1138,
136849 /* 40 */ 1137, 1136, 1233, 1110, 1134, 1127, 1131, 1201, 1195, 1196,
136850 /* 50 */ 1194, 1198, 1202, 1329, 1130, 1165, 1179, 1164, 1329, 1329,
136851 /* 60 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136852 /* 70 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136853 /* 80 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136854 /* 90 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136855 /* 100 */ 1329, 1329, 1329, 1329, 1173, 1178, 1185, 1177, 1174, 1167,
136856 /* 110 */ 1166, 1168, 1169, 1329, 1017, 1065, 1329, 1329, 1329, 1170,
136857 /* 120 */ 1329, 1171, 1182, 1181, 1180, 1258, 1285, 1284, 1329, 1329,
136858 /* 130 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136859 /* 140 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136860 /* 150 */ 1329, 1329, 1329, 1329, 1329, 1277, 1267, 1023, 1023, 1329,
136861 /* 160 */ 1267, 1267, 1267, 1267, 1267, 1267, 1263, 1098, 1089, 1329,
136862 /* 170 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136863 /* 180 */ 1255, 1253, 1329, 1215, 1329, 1329, 1329, 1329, 1329, 1329,
136864 /* 190 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136865 /* 200 */ 1329, 1329, 1329, 1329, 1094, 1329, 1329, 1329, 1329, 1329,
136866 /* 210 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1279, 1329, 1228,
136867 /* 220 */ 1094, 1094, 1094, 1096, 1078, 1088, 1002, 1133, 1112, 1112,
136868 /* 230 */ 1318, 1133, 1318, 1040, 1299, 1037, 1123, 1112, 1197, 1123,
136869 /* 240 */ 1123, 1095, 1088, 1329, 1321, 1103, 1103, 1320, 1320, 1103,
136870 /* 250 */ 1144, 1068, 1133, 1074, 1074, 1074, 1074, 1103, 1014, 1133,
136871 /* 260 */ 1144, 1068, 1068, 1133, 1103, 1014, 1232, 1315, 1103, 1103,
136872 /* 270 */ 1014, 1208, 1103, 1014, 1103, 1014, 1208, 1066, 1066, 1066,
136873 /* 280 */ 1055, 1208, 1066, 1040, 1066, 1055, 1066, 1066, 1116, 1111,
136874 /* 290 */ 1116, 1111, 1116, 1111, 1116, 1111, 1103, 1203, 1103, 1329,
136875 /* 300 */ 1208, 1212, 1212, 1208, 1128, 1117, 1126, 1124, 1133, 1020,
136876 /* 310 */ 1058, 1282, 1282, 1278, 1278, 1278, 1278, 1326, 1326, 1263,
136877 /* 320 */ 1294, 1294, 1042, 1042, 1294, 1329, 1329, 1329, 1329, 1329,
136878 /* 330 */ 1329, 1289, 1329, 1217, 1329, 1329, 1329, 1329, 1329, 1329,
136879 /* 340 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136880 /* 350 */ 1329, 1329, 1150, 1329, 998, 1260, 1329, 1329, 1259, 1329,
136881 /* 360 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136882 /* 370 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1317,
136883 /* 380 */ 1329, 1329, 1329, 1329, 1329, 1329, 1231, 1230, 1329, 1329,
136884 /* 390 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136885 /* 400 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329,
136886 /* 410 */ 1329, 1080, 1329, 1329, 1329, 1303, 1329, 1329, 1329, 1329,
136887 /* 420 */ 1329, 1329, 1329, 1125, 1329, 1118, 1329, 1329, 1308, 1329,
136888 /* 430 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1269,
136889 /* 440 */ 1329, 1329, 1329, 1268, 1329, 1329, 1329, 1329, 1329, 1152,
136890 /* 450 */ 1329, 1151, 1155, 1329, 1008, 1329,
136891 };
136892 /********** End of lemon-generated parsing tables *****************************/
136893
136894 /* The next table maps tokens (terminal symbols) into fallback tokens.
136895 ** If a construct like the following:
@@ -137138,333 +137474,331 @@
137138 /* 3 */ "cmd ::= BEGIN transtype trans_opt",
137139 /* 4 */ "transtype ::=",
137140 /* 5 */ "transtype ::= DEFERRED",
137141 /* 6 */ "transtype ::= IMMEDIATE",
137142 /* 7 */ "transtype ::= EXCLUSIVE",
137143 /* 8 */ "cmd ::= COMMIT trans_opt",
137144 /* 9 */ "cmd ::= END trans_opt",
137145 /* 10 */ "cmd ::= ROLLBACK trans_opt",
137146 /* 11 */ "cmd ::= SAVEPOINT nm",
137147 /* 12 */ "cmd ::= RELEASE savepoint_opt nm",
137148 /* 13 */ "cmd ::= ROLLBACK trans_opt TO savepoint_opt nm",
137149 /* 14 */ "create_table ::= createkw temp TABLE ifnotexists nm dbnm",
137150 /* 15 */ "createkw ::= CREATE",
137151 /* 16 */ "ifnotexists ::=",
137152 /* 17 */ "ifnotexists ::= IF NOT EXISTS",
137153 /* 18 */ "temp ::= TEMP",
137154 /* 19 */ "temp ::=",
137155 /* 20 */ "create_table_args ::= LP columnlist conslist_opt RP table_options",
137156 /* 21 */ "create_table_args ::= AS select",
137157 /* 22 */ "table_options ::=",
137158 /* 23 */ "table_options ::= WITHOUT nm",
137159 /* 24 */ "columnname ::= nm typetoken",
137160 /* 25 */ "typetoken ::=",
137161 /* 26 */ "typetoken ::= typename LP signed RP",
137162 /* 27 */ "typetoken ::= typename LP signed COMMA signed RP",
137163 /* 28 */ "typename ::= typename ID|STRING",
137164 /* 29 */ "ccons ::= CONSTRAINT nm",
137165 /* 30 */ "ccons ::= DEFAULT term",
137166 /* 31 */ "ccons ::= DEFAULT LP expr RP",
137167 /* 32 */ "ccons ::= DEFAULT PLUS term",
137168 /* 33 */ "ccons ::= DEFAULT MINUS term",
137169 /* 34 */ "ccons ::= DEFAULT ID|INDEXED",
137170 /* 35 */ "ccons ::= NOT NULL onconf",
137171 /* 36 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
137172 /* 37 */ "ccons ::= UNIQUE onconf",
137173 /* 38 */ "ccons ::= CHECK LP expr RP",
137174 /* 39 */ "ccons ::= REFERENCES nm eidlist_opt refargs",
137175 /* 40 */ "ccons ::= defer_subclause",
137176 /* 41 */ "ccons ::= COLLATE ID|STRING",
137177 /* 42 */ "autoinc ::=",
137178 /* 43 */ "autoinc ::= AUTOINCR",
137179 /* 44 */ "refargs ::=",
137180 /* 45 */ "refargs ::= refargs refarg",
137181 /* 46 */ "refarg ::= MATCH nm",
137182 /* 47 */ "refarg ::= ON INSERT refact",
137183 /* 48 */ "refarg ::= ON DELETE refact",
137184 /* 49 */ "refarg ::= ON UPDATE refact",
137185 /* 50 */ "refact ::= SET NULL",
137186 /* 51 */ "refact ::= SET DEFAULT",
137187 /* 52 */ "refact ::= CASCADE",
137188 /* 53 */ "refact ::= RESTRICT",
137189 /* 54 */ "refact ::= NO ACTION",
137190 /* 55 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
137191 /* 56 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
137192 /* 57 */ "init_deferred_pred_opt ::=",
137193 /* 58 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
137194 /* 59 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
137195 /* 60 */ "conslist_opt ::=",
137196 /* 61 */ "tconscomma ::= COMMA",
137197 /* 62 */ "tcons ::= CONSTRAINT nm",
137198 /* 63 */ "tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf",
137199 /* 64 */ "tcons ::= UNIQUE LP sortlist RP onconf",
137200 /* 65 */ "tcons ::= CHECK LP expr RP onconf",
137201 /* 66 */ "tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt",
137202 /* 67 */ "defer_subclause_opt ::=",
137203 /* 68 */ "onconf ::=",
137204 /* 69 */ "onconf ::= ON CONFLICT resolvetype",
137205 /* 70 */ "orconf ::=",
137206 /* 71 */ "orconf ::= OR resolvetype",
137207 /* 72 */ "resolvetype ::= IGNORE",
137208 /* 73 */ "resolvetype ::= REPLACE",
137209 /* 74 */ "cmd ::= DROP TABLE ifexists fullname",
137210 /* 75 */ "ifexists ::= IF EXISTS",
137211 /* 76 */ "ifexists ::=",
137212 /* 77 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select",
137213 /* 78 */ "cmd ::= DROP VIEW ifexists fullname",
137214 /* 79 */ "cmd ::= select",
137215 /* 80 */ "select ::= with selectnowith",
137216 /* 81 */ "selectnowith ::= selectnowith multiselect_op oneselect",
137217 /* 82 */ "multiselect_op ::= UNION",
137218 /* 83 */ "multiselect_op ::= UNION ALL",
137219 /* 84 */ "multiselect_op ::= EXCEPT|INTERSECT",
137220 /* 85 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
137221 /* 86 */ "values ::= VALUES LP nexprlist RP",
137222 /* 87 */ "values ::= values COMMA LP exprlist RP",
137223 /* 88 */ "distinct ::= DISTINCT",
137224 /* 89 */ "distinct ::= ALL",
137225 /* 90 */ "distinct ::=",
137226 /* 91 */ "sclp ::=",
137227 /* 92 */ "selcollist ::= sclp expr as",
137228 /* 93 */ "selcollist ::= sclp STAR",
137229 /* 94 */ "selcollist ::= sclp nm DOT STAR",
137230 /* 95 */ "as ::= AS nm",
137231 /* 96 */ "as ::=",
137232 /* 97 */ "from ::=",
137233 /* 98 */ "from ::= FROM seltablist",
137234 /* 99 */ "stl_prefix ::= seltablist joinop",
137235 /* 100 */ "stl_prefix ::=",
137236 /* 101 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt",
137237 /* 102 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt",
137238 /* 103 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt",
137239 /* 104 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
137240 /* 105 */ "dbnm ::=",
137241 /* 106 */ "dbnm ::= DOT nm",
137242 /* 107 */ "fullname ::= nm dbnm",
137243 /* 108 */ "joinop ::= COMMA|JOIN",
137244 /* 109 */ "joinop ::= JOIN_KW JOIN",
137245 /* 110 */ "joinop ::= JOIN_KW nm JOIN",
137246 /* 111 */ "joinop ::= JOIN_KW nm nm JOIN",
137247 /* 112 */ "on_opt ::= ON expr",
137248 /* 113 */ "on_opt ::=",
137249 /* 114 */ "indexed_opt ::=",
137250 /* 115 */ "indexed_opt ::= INDEXED BY nm",
137251 /* 116 */ "indexed_opt ::= NOT INDEXED",
137252 /* 117 */ "using_opt ::= USING LP idlist RP",
137253 /* 118 */ "using_opt ::=",
137254 /* 119 */ "orderby_opt ::=",
137255 /* 120 */ "orderby_opt ::= ORDER BY sortlist",
137256 /* 121 */ "sortlist ::= sortlist COMMA expr sortorder",
137257 /* 122 */ "sortlist ::= expr sortorder",
137258 /* 123 */ "sortorder ::= ASC",
137259 /* 124 */ "sortorder ::= DESC",
137260 /* 125 */ "sortorder ::=",
137261 /* 126 */ "groupby_opt ::=",
137262 /* 127 */ "groupby_opt ::= GROUP BY nexprlist",
137263 /* 128 */ "having_opt ::=",
137264 /* 129 */ "having_opt ::= HAVING expr",
137265 /* 130 */ "limit_opt ::=",
137266 /* 131 */ "limit_opt ::= LIMIT expr",
137267 /* 132 */ "limit_opt ::= LIMIT expr OFFSET expr",
137268 /* 133 */ "limit_opt ::= LIMIT expr COMMA expr",
137269 /* 134 */ "cmd ::= with DELETE FROM fullname indexed_opt where_opt",
137270 /* 135 */ "where_opt ::=",
137271 /* 136 */ "where_opt ::= WHERE expr",
137272 /* 137 */ "cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt",
137273 /* 138 */ "setlist ::= setlist COMMA nm EQ expr",
137274 /* 139 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
137275 /* 140 */ "setlist ::= nm EQ expr",
137276 /* 141 */ "setlist ::= LP idlist RP EQ expr",
137277 /* 142 */ "cmd ::= with insert_cmd INTO fullname idlist_opt select",
137278 /* 143 */ "cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES",
137279 /* 144 */ "insert_cmd ::= INSERT orconf",
137280 /* 145 */ "insert_cmd ::= REPLACE",
137281 /* 146 */ "idlist_opt ::=",
137282 /* 147 */ "idlist_opt ::= LP idlist RP",
137283 /* 148 */ "idlist ::= idlist COMMA nm",
137284 /* 149 */ "idlist ::= nm",
137285 /* 150 */ "expr ::= LP expr RP",
137286 /* 151 */ "term ::= NULL",
137287 /* 152 */ "expr ::= ID|INDEXED",
137288 /* 153 */ "expr ::= JOIN_KW",
137289 /* 154 */ "expr ::= nm DOT nm",
137290 /* 155 */ "expr ::= nm DOT nm DOT nm",
137291 /* 156 */ "term ::= FLOAT|BLOB",
137292 /* 157 */ "term ::= STRING",
137293 /* 158 */ "term ::= INTEGER",
137294 /* 159 */ "expr ::= VARIABLE",
137295 /* 160 */ "expr ::= expr COLLATE ID|STRING",
137296 /* 161 */ "expr ::= CAST LP expr AS typetoken RP",
137297 /* 162 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
137298 /* 163 */ "expr ::= ID|INDEXED LP STAR RP",
137299 /* 164 */ "term ::= CTIME_KW",
137300 /* 165 */ "expr ::= LP nexprlist COMMA expr RP",
137301 /* 166 */ "expr ::= expr AND expr",
137302 /* 167 */ "expr ::= expr OR expr",
137303 /* 168 */ "expr ::= expr LT|GT|GE|LE expr",
137304 /* 169 */ "expr ::= expr EQ|NE expr",
137305 /* 170 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
137306 /* 171 */ "expr ::= expr PLUS|MINUS expr",
137307 /* 172 */ "expr ::= expr STAR|SLASH|REM expr",
137308 /* 173 */ "expr ::= expr CONCAT expr",
137309 /* 174 */ "likeop ::= NOT LIKE_KW|MATCH",
137310 /* 175 */ "expr ::= expr likeop expr",
137311 /* 176 */ "expr ::= expr likeop expr ESCAPE expr",
137312 /* 177 */ "expr ::= expr ISNULL|NOTNULL",
137313 /* 178 */ "expr ::= expr NOT NULL",
137314 /* 179 */ "expr ::= expr IS expr",
137315 /* 180 */ "expr ::= expr IS NOT expr",
137316 /* 181 */ "expr ::= NOT expr",
137317 /* 182 */ "expr ::= BITNOT expr",
137318 /* 183 */ "expr ::= MINUS expr",
137319 /* 184 */ "expr ::= PLUS expr",
137320 /* 185 */ "between_op ::= BETWEEN",
137321 /* 186 */ "between_op ::= NOT BETWEEN",
137322 /* 187 */ "expr ::= expr between_op expr AND expr",
137323 /* 188 */ "in_op ::= IN",
137324 /* 189 */ "in_op ::= NOT IN",
137325 /* 190 */ "expr ::= expr in_op LP exprlist RP",
137326 /* 191 */ "expr ::= LP select RP",
137327 /* 192 */ "expr ::= expr in_op LP select RP",
137328 /* 193 */ "expr ::= expr in_op nm dbnm paren_exprlist",
137329 /* 194 */ "expr ::= EXISTS LP select RP",
137330 /* 195 */ "expr ::= CASE case_operand case_exprlist case_else END",
137331 /* 196 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
137332 /* 197 */ "case_exprlist ::= WHEN expr THEN expr",
137333 /* 198 */ "case_else ::= ELSE expr",
137334 /* 199 */ "case_else ::=",
137335 /* 200 */ "case_operand ::= expr",
137336 /* 201 */ "case_operand ::=",
137337 /* 202 */ "exprlist ::=",
137338 /* 203 */ "nexprlist ::= nexprlist COMMA expr",
137339 /* 204 */ "nexprlist ::= expr",
137340 /* 205 */ "paren_exprlist ::=",
137341 /* 206 */ "paren_exprlist ::= LP exprlist RP",
137342 /* 207 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
137343 /* 208 */ "uniqueflag ::= UNIQUE",
137344 /* 209 */ "uniqueflag ::=",
137345 /* 210 */ "eidlist_opt ::=",
137346 /* 211 */ "eidlist_opt ::= LP eidlist RP",
137347 /* 212 */ "eidlist ::= eidlist COMMA nm collate sortorder",
137348 /* 213 */ "eidlist ::= nm collate sortorder",
137349 /* 214 */ "collate ::=",
137350 /* 215 */ "collate ::= COLLATE ID|STRING",
137351 /* 216 */ "cmd ::= DROP INDEX ifexists fullname",
137352 /* 217 */ "cmd ::= VACUUM",
137353 /* 218 */ "cmd ::= VACUUM nm",
137354 /* 219 */ "cmd ::= PRAGMA nm dbnm",
137355 /* 220 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
137356 /* 221 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
137357 /* 222 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
137358 /* 223 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
137359 /* 224 */ "plus_num ::= PLUS INTEGER|FLOAT",
137360 /* 225 */ "minus_num ::= MINUS INTEGER|FLOAT",
137361 /* 226 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
137362 /* 227 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
137363 /* 228 */ "trigger_time ::= BEFORE|AFTER",
137364 /* 229 */ "trigger_time ::= INSTEAD OF",
137365 /* 230 */ "trigger_time ::=",
137366 /* 231 */ "trigger_event ::= DELETE|INSERT",
137367 /* 232 */ "trigger_event ::= UPDATE",
137368 /* 233 */ "trigger_event ::= UPDATE OF idlist",
137369 /* 234 */ "when_clause ::=",
137370 /* 235 */ "when_clause ::= WHEN expr",
137371 /* 236 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
137372 /* 237 */ "trigger_cmd_list ::= trigger_cmd SEMI",
137373 /* 238 */ "trnm ::= nm DOT nm",
137374 /* 239 */ "tridxby ::= INDEXED BY nm",
137375 /* 240 */ "tridxby ::= NOT INDEXED",
137376 /* 241 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt",
137377 /* 242 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select",
137378 /* 243 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
137379 /* 244 */ "trigger_cmd ::= select",
137380 /* 245 */ "expr ::= RAISE LP IGNORE RP",
137381 /* 246 */ "expr ::= RAISE LP raisetype COMMA nm RP",
137382 /* 247 */ "raisetype ::= ROLLBACK",
137383 /* 248 */ "raisetype ::= ABORT",
137384 /* 249 */ "raisetype ::= FAIL",
137385 /* 250 */ "cmd ::= DROP TRIGGER ifexists fullname",
137386 /* 251 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
137387 /* 252 */ "cmd ::= DETACH database_kw_opt expr",
137388 /* 253 */ "key_opt ::=",
137389 /* 254 */ "key_opt ::= KEY expr",
137390 /* 255 */ "cmd ::= REINDEX",
137391 /* 256 */ "cmd ::= REINDEX nm dbnm",
137392 /* 257 */ "cmd ::= ANALYZE",
137393 /* 258 */ "cmd ::= ANALYZE nm dbnm",
137394 /* 259 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
137395 /* 260 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
137396 /* 261 */ "add_column_fullname ::= fullname",
137397 /* 262 */ "cmd ::= create_vtab",
137398 /* 263 */ "cmd ::= create_vtab LP vtabarglist RP",
137399 /* 264 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
137400 /* 265 */ "vtabarg ::=",
137401 /* 266 */ "vtabargtoken ::= ANY",
137402 /* 267 */ "vtabargtoken ::= lp anylist RP",
137403 /* 268 */ "lp ::= LP",
137404 /* 269 */ "with ::=",
137405 /* 270 */ "with ::= WITH wqlist",
137406 /* 271 */ "with ::= WITH RECURSIVE wqlist",
137407 /* 272 */ "wqlist ::= nm eidlist_opt AS LP select RP",
137408 /* 273 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
137409 /* 274 */ "input ::= cmdlist",
137410 /* 275 */ "cmdlist ::= cmdlist ecmd",
137411 /* 276 */ "cmdlist ::= ecmd",
137412 /* 277 */ "ecmd ::= SEMI",
137413 /* 278 */ "ecmd ::= explain cmdx SEMI",
137414 /* 279 */ "explain ::=",
137415 /* 280 */ "trans_opt ::=",
137416 /* 281 */ "trans_opt ::= TRANSACTION",
137417 /* 282 */ "trans_opt ::= TRANSACTION nm",
137418 /* 283 */ "savepoint_opt ::= SAVEPOINT",
137419 /* 284 */ "savepoint_opt ::=",
137420 /* 285 */ "cmd ::= create_table create_table_args",
137421 /* 286 */ "columnlist ::= columnlist COMMA columnname carglist",
137422 /* 287 */ "columnlist ::= columnname carglist",
137423 /* 288 */ "nm ::= ID|INDEXED",
137424 /* 289 */ "nm ::= STRING",
137425 /* 290 */ "nm ::= JOIN_KW",
137426 /* 291 */ "typetoken ::= typename",
137427 /* 292 */ "typename ::= ID|STRING",
137428 /* 293 */ "signed ::= plus_num",
137429 /* 294 */ "signed ::= minus_num",
137430 /* 295 */ "carglist ::= carglist ccons",
137431 /* 296 */ "carglist ::=",
137432 /* 297 */ "ccons ::= NULL onconf",
137433 /* 298 */ "conslist_opt ::= COMMA conslist",
137434 /* 299 */ "conslist ::= conslist tconscomma tcons",
137435 /* 300 */ "conslist ::= tcons",
137436 /* 301 */ "tconscomma ::=",
137437 /* 302 */ "defer_subclause_opt ::= defer_subclause",
137438 /* 303 */ "resolvetype ::= raisetype",
137439 /* 304 */ "selectnowith ::= oneselect",
137440 /* 305 */ "oneselect ::= values",
137441 /* 306 */ "sclp ::= selcollist COMMA",
137442 /* 307 */ "as ::= ID|STRING",
137443 /* 308 */ "expr ::= term",
137444 /* 309 */ "likeop ::= LIKE_KW|MATCH",
137445 /* 310 */ "exprlist ::= nexprlist",
137446 /* 311 */ "nmnum ::= plus_num",
137447 /* 312 */ "nmnum ::= nm",
137448 /* 313 */ "nmnum ::= ON",
137449 /* 314 */ "nmnum ::= DELETE",
137450 /* 315 */ "nmnum ::= DEFAULT",
137451 /* 316 */ "plus_num ::= INTEGER|FLOAT",
137452 /* 317 */ "foreach_clause ::=",
137453 /* 318 */ "foreach_clause ::= FOR EACH ROW",
137454 /* 319 */ "trnm ::= nm",
137455 /* 320 */ "tridxby ::=",
137456 /* 321 */ "database_kw_opt ::= DATABASE",
137457 /* 322 */ "database_kw_opt ::=",
137458 /* 323 */ "kwcolumn_opt ::=",
137459 /* 324 */ "kwcolumn_opt ::= COLUMNKW",
137460 /* 325 */ "vtabarglist ::= vtabarg",
137461 /* 326 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
137462 /* 327 */ "vtabarg ::= vtabarg vtabargtoken",
137463 /* 328 */ "anylist ::=",
137464 /* 329 */ "anylist ::= anylist LP anylist RP",
137465 /* 330 */ "anylist ::= anylist ANY",
137466 };
137467 #endif /* NDEBUG */
137468
137469
137470 #if YYSTACKDEPTH<=0
@@ -137529,11 +137863,13 @@
137529 pParser->yyerrcnt = -1;
137530 #endif
137531 pParser->yytos = pParser->yystack;
137532 pParser->yystack[0].stateno = 0;
137533 pParser->yystack[0].major = 0;
 
137534 pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1];
 
137535 }
137536
137537 #ifndef sqlite3Parser_ENGINEALWAYSONSTACK
137538 /*
137539 ** This function allocates a new parser.
@@ -137914,11 +138250,10 @@
137914 { 150, -1 },
137915 { 150, -1 },
137916 { 149, -2 },
137917 { 149, -2 },
137918 { 149, -2 },
137919 { 149, -2 },
137920 { 149, -3 },
137921 { 149, -5 },
137922 { 154, -6 },
137923 { 156, -1 },
137924 { 158, 0 },
@@ -138054,11 +138389,10 @@
138054 { 220, 0 },
138055 { 220, -3 },
138056 { 217, -3 },
138057 { 217, -1 },
138058 { 173, -3 },
138059 { 172, -1 },
138060 { 173, -1 },
138061 { 173, -1 },
138062 { 173, -3 },
138063 { 173, -5 },
138064 { 172, -1 },
@@ -138317,256 +138651,253 @@
138317 case 5: /* transtype ::= DEFERRED */
138318 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
138319 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
138320 {yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-X*/}
138321 break;
138322 case 8: /* cmd ::= COMMIT trans_opt */
138323 case 9: /* cmd ::= END trans_opt */ yytestcase(yyruleno==9);
138324 {sqlite3CommitTransaction(pParse);}
138325 break;
138326 case 10: /* cmd ::= ROLLBACK trans_opt */
138327 {sqlite3RollbackTransaction(pParse);}
138328 break;
138329 case 11: /* cmd ::= SAVEPOINT nm */
138330 {
138331 sqlite3Savepoint(pParse, SAVEPOINT_BEGIN, &yymsp[0].minor.yy0);
138332 }
138333 break;
138334 case 12: /* cmd ::= RELEASE savepoint_opt nm */
138335 {
138336 sqlite3Savepoint(pParse, SAVEPOINT_RELEASE, &yymsp[0].minor.yy0);
138337 }
138338 break;
138339 case 13: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
138340 {
138341 sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
138342 }
138343 break;
138344 case 14: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
138345 {
138346 sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy194,0,0,yymsp[-2].minor.yy194);
138347 }
138348 break;
138349 case 15: /* createkw ::= CREATE */
138350 {disableLookaside(pParse);}
138351 break;
138352 case 16: /* ifnotexists ::= */
138353 case 19: /* temp ::= */ yytestcase(yyruleno==19);
138354 case 22: /* table_options ::= */ yytestcase(yyruleno==22);
138355 case 42: /* autoinc ::= */ yytestcase(yyruleno==42);
138356 case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);
138357 case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);
138358 case 76: /* ifexists ::= */ yytestcase(yyruleno==76);
138359 case 90: /* distinct ::= */ yytestcase(yyruleno==90);
138360 case 214: /* collate ::= */ yytestcase(yyruleno==214);
138361 {yymsp[1].minor.yy194 = 0;}
138362 break;
138363 case 17: /* ifnotexists ::= IF NOT EXISTS */
138364 {yymsp[-2].minor.yy194 = 1;}
138365 break;
138366 case 18: /* temp ::= TEMP */
138367 case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43);
138368 {yymsp[0].minor.yy194 = 1;}
138369 break;
138370 case 20: /* create_table_args ::= LP columnlist conslist_opt RP table_options */
138371 {
138372 sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy194,0);
138373 }
138374 break;
138375 case 21: /* create_table_args ::= AS select */
138376 {
138377 sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy243);
138378 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy243);
138379 }
138380 break;
138381 case 23: /* table_options ::= WITHOUT nm */
138382 {
138383 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
138384 yymsp[-1].minor.yy194 = TF_WithoutRowid | TF_NoVisibleRowid;
138385 }else{
138386 yymsp[-1].minor.yy194 = 0;
138387 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
138388 }
138389 }
138390 break;
138391 case 24: /* columnname ::= nm typetoken */
138392 {sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
138393 break;
138394 case 25: /* typetoken ::= */
138395 case 60: /* conslist_opt ::= */ yytestcase(yyruleno==60);
138396 case 96: /* as ::= */ yytestcase(yyruleno==96);
138397 {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;}
138398 break;
138399 case 26: /* typetoken ::= typename LP signed RP */
138400 {
138401 yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);
138402 }
138403 break;
138404 case 27: /* typetoken ::= typename LP signed COMMA signed RP */
138405 {
138406 yymsp[-5].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z);
138407 }
138408 break;
138409 case 28: /* typename ::= typename ID|STRING */
138410 {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
138411 break;
138412 case 29: /* ccons ::= CONSTRAINT nm */
138413 case 62: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==62);
138414 {pParse->constraintName = yymsp[0].minor.yy0;}
138415 break;
138416 case 30: /* ccons ::= DEFAULT term */
138417 case 32: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==32);
138418 {sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy190);}
138419 break;
138420 case 31: /* ccons ::= DEFAULT LP expr RP */
138421 {sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy190);}
138422 break;
138423 case 33: /* ccons ::= DEFAULT MINUS term */
138424 {
138425 ExprSpan v;
138426 v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy190.pExpr, 0);
138427 v.zStart = yymsp[-1].minor.yy0.z;
138428 v.zEnd = yymsp[0].minor.yy190.zEnd;
138429 sqlite3AddDefaultValue(pParse,&v);
138430 }
138431 break;
138432 case 34: /* ccons ::= DEFAULT ID|INDEXED */
138433 {
138434 ExprSpan v;
138435 spanExpr(&v, pParse, TK_STRING, yymsp[0].minor.yy0);
138436 sqlite3AddDefaultValue(pParse,&v);
138437 }
138438 break;
138439 case 35: /* ccons ::= NOT NULL onconf */
138440 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy194);}
138441 break;
138442 case 36: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
138443 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy194,yymsp[0].minor.yy194,yymsp[-2].minor.yy194);}
138444 break;
138445 case 37: /* ccons ::= UNIQUE onconf */
138446 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy194,0,0,0,0,
138447 SQLITE_IDXTYPE_UNIQUE);}
138448 break;
138449 case 38: /* ccons ::= CHECK LP expr RP */
138450 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy190.pExpr);}
138451 break;
138452 case 39: /* ccons ::= REFERENCES nm eidlist_opt refargs */
138453 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy148,yymsp[0].minor.yy194);}
138454 break;
138455 case 40: /* ccons ::= defer_subclause */
138456 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy194);}
138457 break;
138458 case 41: /* ccons ::= COLLATE ID|STRING */
138459 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
138460 break;
138461 case 44: /* refargs ::= */
138462 { yymsp[1].minor.yy194 = OE_None*0x0101; /* EV: R-19803-45884 */}
138463 break;
138464 case 45: /* refargs ::= refargs refarg */
138465 { yymsp[-1].minor.yy194 = (yymsp[-1].minor.yy194 & ~yymsp[0].minor.yy497.mask) | yymsp[0].minor.yy497.value; }
138466 break;
138467 case 46: /* refarg ::= MATCH nm */
138468 { yymsp[-1].minor.yy497.value = 0; yymsp[-1].minor.yy497.mask = 0x000000; }
138469 break;
138470 case 47: /* refarg ::= ON INSERT refact */
138471 { yymsp[-2].minor.yy497.value = 0; yymsp[-2].minor.yy497.mask = 0x000000; }
138472 break;
138473 case 48: /* refarg ::= ON DELETE refact */
138474 { yymsp[-2].minor.yy497.value = yymsp[0].minor.yy194; yymsp[-2].minor.yy497.mask = 0x0000ff; }
138475 break;
138476 case 49: /* refarg ::= ON UPDATE refact */
138477 { yymsp[-2].minor.yy497.value = yymsp[0].minor.yy194<<8; yymsp[-2].minor.yy497.mask = 0x00ff00; }
138478 break;
138479 case 50: /* refact ::= SET NULL */
138480 { yymsp[-1].minor.yy194 = OE_SetNull; /* EV: R-33326-45252 */}
138481 break;
138482 case 51: /* refact ::= SET DEFAULT */
138483 { yymsp[-1].minor.yy194 = OE_SetDflt; /* EV: R-33326-45252 */}
138484 break;
138485 case 52: /* refact ::= CASCADE */
138486 { yymsp[0].minor.yy194 = OE_Cascade; /* EV: R-33326-45252 */}
138487 break;
138488 case 53: /* refact ::= RESTRICT */
138489 { yymsp[0].minor.yy194 = OE_Restrict; /* EV: R-33326-45252 */}
138490 break;
138491 case 54: /* refact ::= NO ACTION */
138492 { yymsp[-1].minor.yy194 = OE_None; /* EV: R-33326-45252 */}
138493 break;
138494 case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
138495 {yymsp[-2].minor.yy194 = 0;}
138496 break;
138497 case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
138498 case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71);
138499 case 144: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==144);
138500 {yymsp[-1].minor.yy194 = yymsp[0].minor.yy194;}
138501 break;
138502 case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
138503 case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);
138504 case 186: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==186);
138505 case 189: /* in_op ::= NOT IN */ yytestcase(yyruleno==189);
138506 case 215: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==215);
138507 {yymsp[-1].minor.yy194 = 1;}
138508 break;
138509 case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
138510 {yymsp[-1].minor.yy194 = 0;}
138511 break;
138512 case 61: /* tconscomma ::= COMMA */
138513 {pParse->constraintName.n = 0;}
138514 break;
138515 case 63: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
138516 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy148,yymsp[0].minor.yy194,yymsp[-2].minor.yy194,0);}
138517 break;
138518 case 64: /* tcons ::= UNIQUE LP sortlist RP onconf */
138519 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy148,yymsp[0].minor.yy194,0,0,0,0,
138520 SQLITE_IDXTYPE_UNIQUE);}
138521 break;
138522 case 65: /* tcons ::= CHECK LP expr RP onconf */
138523 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy190.pExpr);}
138524 break;
138525 case 66: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
138526 {
138527 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy148, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy148, yymsp[-1].minor.yy194);
138528 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy194);
138529 }
138530 break;
138531 case 68: /* onconf ::= */
138532 case 70: /* orconf ::= */ yytestcase(yyruleno==70);
138533 {yymsp[1].minor.yy194 = OE_Default;}
138534 break;
138535 case 69: /* onconf ::= ON CONFLICT resolvetype */
138536 {yymsp[-2].minor.yy194 = yymsp[0].minor.yy194;}
138537 break;
138538 case 72: /* resolvetype ::= IGNORE */
138539 {yymsp[0].minor.yy194 = OE_Ignore;}
138540 break;
138541 case 73: /* resolvetype ::= REPLACE */
138542 case 145: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==145);
138543 {yymsp[0].minor.yy194 = OE_Replace;}
138544 break;
138545 case 74: /* cmd ::= DROP TABLE ifexists fullname */
138546 {
138547 sqlite3DropTable(pParse, yymsp[0].minor.yy185, 0, yymsp[-1].minor.yy194);
138548 }
138549 break;
138550 case 77: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
138551 {
138552 sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy148, yymsp[0].minor.yy243, yymsp[-7].minor.yy194, yymsp[-5].minor.yy194);
138553 }
138554 break;
138555 case 78: /* cmd ::= DROP VIEW ifexists fullname */
138556 {
138557 sqlite3DropTable(pParse, yymsp[0].minor.yy185, 1, yymsp[-1].minor.yy194);
138558 }
138559 break;
138560 case 79: /* cmd ::= select */
138561 {
138562 SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0};
138563 sqlite3Select(pParse, yymsp[0].minor.yy243, &dest);
138564 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy243);
138565 }
138566 break;
138567 case 80: /* select ::= with selectnowith */
138568 {
138569 Select *p = yymsp[0].minor.yy243;
138570 if( p ){
138571 p->pWith = yymsp[-1].minor.yy285;
138572 parserDoubleLinkSelect(pParse, p);
@@ -138574,11 +138905,11 @@
138574 sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy285);
138575 }
138576 yymsp[-1].minor.yy243 = p; /*A-overwrites-W*/
138577 }
138578 break;
138579 case 81: /* selectnowith ::= selectnowith multiselect_op oneselect */
138580 {
138581 Select *pRhs = yymsp[0].minor.yy243;
138582 Select *pLhs = yymsp[-2].minor.yy243;
138583 if( pRhs && pRhs->pPrior ){
138584 SrcList *pFrom;
@@ -138598,18 +138929,18 @@
138598 sqlite3SelectDelete(pParse->db, pLhs);
138599 }
138600 yymsp[-2].minor.yy243 = pRhs;
138601 }
138602 break;
138603 case 82: /* multiselect_op ::= UNION */
138604 case 84: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==84);
138605 {yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-OP*/}
138606 break;
138607 case 83: /* multiselect_op ::= UNION ALL */
138608 {yymsp[-1].minor.yy194 = TK_ALL;}
138609 break;
138610 case 85: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
138611 {
138612 #if SELECTTRACE_ENABLED
138613 Token s = yymsp[-8].minor.yy0; /*A-overwrites-S*/
138614 #endif
138615 yymsp[-8].minor.yy243 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy148,yymsp[-5].minor.yy185,yymsp[-4].minor.yy72,yymsp[-3].minor.yy148,yymsp[-2].minor.yy72,yymsp[-1].minor.yy148,yymsp[-7].minor.yy194,yymsp[0].minor.yy354.pLimit,yymsp[0].minor.yy354.pOffset);
@@ -138637,16 +138968,16 @@
138637 }
138638 }
138639 #endif /* SELECTRACE_ENABLED */
138640 }
138641 break;
138642 case 86: /* values ::= VALUES LP nexprlist RP */
138643 {
138644 yymsp[-3].minor.yy243 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy148,0,0,0,0,0,SF_Values,0,0);
138645 }
138646 break;
138647 case 87: /* values ::= values COMMA LP exprlist RP */
138648 {
138649 Select *pRight, *pLeft = yymsp[-4].minor.yy243;
138650 pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy148,0,0,0,0,0,SF_Values|SF_MultiValue,0,0);
138651 if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
138652 if( pRight ){
@@ -138656,86 +138987,86 @@
138656 }else{
138657 yymsp[-4].minor.yy243 = pLeft;
138658 }
138659 }
138660 break;
138661 case 88: /* distinct ::= DISTINCT */
138662 {yymsp[0].minor.yy194 = SF_Distinct;}
138663 break;
138664 case 89: /* distinct ::= ALL */
138665 {yymsp[0].minor.yy194 = SF_All;}
138666 break;
138667 case 91: /* sclp ::= */
138668 case 119: /* orderby_opt ::= */ yytestcase(yyruleno==119);
138669 case 126: /* groupby_opt ::= */ yytestcase(yyruleno==126);
138670 case 202: /* exprlist ::= */ yytestcase(yyruleno==202);
138671 case 205: /* paren_exprlist ::= */ yytestcase(yyruleno==205);
138672 case 210: /* eidlist_opt ::= */ yytestcase(yyruleno==210);
138673 {yymsp[1].minor.yy148 = 0;}
138674 break;
138675 case 92: /* selcollist ::= sclp expr as */
138676 {
138677 yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy148, yymsp[-1].minor.yy190.pExpr);
138678 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-2].minor.yy148, &yymsp[0].minor.yy0, 1);
138679 sqlite3ExprListSetSpan(pParse,yymsp[-2].minor.yy148,&yymsp[-1].minor.yy190);
138680 }
138681 break;
138682 case 93: /* selcollist ::= sclp STAR */
138683 {
138684 Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
138685 yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy148, p);
138686 }
138687 break;
138688 case 94: /* selcollist ::= sclp nm DOT STAR */
138689 {
138690 Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
138691 Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
138692 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
138693 yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, pDot);
138694 }
138695 break;
138696 case 95: /* as ::= AS nm */
138697 case 106: /* dbnm ::= DOT nm */ yytestcase(yyruleno==106);
138698 case 224: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==224);
138699 case 225: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==225);
138700 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
138701 break;
138702 case 97: /* from ::= */
138703 {yymsp[1].minor.yy185 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy185));}
138704 break;
138705 case 98: /* from ::= FROM seltablist */
138706 {
138707 yymsp[-1].minor.yy185 = yymsp[0].minor.yy185;
138708 sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy185);
138709 }
138710 break;
138711 case 99: /* stl_prefix ::= seltablist joinop */
138712 {
138713 if( ALWAYS(yymsp[-1].minor.yy185 && yymsp[-1].minor.yy185->nSrc>0) ) yymsp[-1].minor.yy185->a[yymsp[-1].minor.yy185->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy194;
138714 }
138715 break;
138716 case 100: /* stl_prefix ::= */
138717 {yymsp[1].minor.yy185 = 0;}
138718 break;
138719 case 101: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
138720 {
138721 yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
138722 sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy185, &yymsp[-2].minor.yy0);
138723 }
138724 break;
138725 case 102: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
138726 {
138727 yymsp[-8].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy185,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
138728 sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy185, yymsp[-4].minor.yy148);
138729 }
138730 break;
138731 case 103: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
138732 {
138733 yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy243,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
138734 }
138735 break;
138736 case 104: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
138737 {
138738 if( yymsp[-6].minor.yy185==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy72==0 && yymsp[0].minor.yy254==0 ){
138739 yymsp[-6].minor.yy185 = yymsp[-4].minor.yy185;
138740 }else if( yymsp[-4].minor.yy185->nSrc==1 ){
138741 yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
@@ -138755,191 +139086,189 @@
138755 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy185,0,0,0,0,SF_NestedFrom,0,0);
138756 yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
138757 }
138758 }
138759 break;
138760 case 105: /* dbnm ::= */
138761 case 114: /* indexed_opt ::= */ yytestcase(yyruleno==114);
138762 {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
138763 break;
138764 case 107: /* fullname ::= nm dbnm */
138765 {yymsp[-1].minor.yy185 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
138766 break;
138767 case 108: /* joinop ::= COMMA|JOIN */
138768 { yymsp[0].minor.yy194 = JT_INNER; }
138769 break;
138770 case 109: /* joinop ::= JOIN_KW JOIN */
138771 {yymsp[-1].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
138772 break;
138773 case 110: /* joinop ::= JOIN_KW nm JOIN */
138774 {yymsp[-2].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
138775 break;
138776 case 111: /* joinop ::= JOIN_KW nm nm JOIN */
138777 {yymsp[-3].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
138778 break;
138779 case 112: /* on_opt ::= ON expr */
138780 case 129: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==129);
138781 case 136: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==136);
138782 case 198: /* case_else ::= ELSE expr */ yytestcase(yyruleno==198);
138783 {yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr;}
138784 break;
138785 case 113: /* on_opt ::= */
138786 case 128: /* having_opt ::= */ yytestcase(yyruleno==128);
138787 case 135: /* where_opt ::= */ yytestcase(yyruleno==135);
138788 case 199: /* case_else ::= */ yytestcase(yyruleno==199);
138789 case 201: /* case_operand ::= */ yytestcase(yyruleno==201);
138790 {yymsp[1].minor.yy72 = 0;}
138791 break;
138792 case 115: /* indexed_opt ::= INDEXED BY nm */
138793 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
138794 break;
138795 case 116: /* indexed_opt ::= NOT INDEXED */
138796 {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
138797 break;
138798 case 117: /* using_opt ::= USING LP idlist RP */
138799 {yymsp[-3].minor.yy254 = yymsp[-1].minor.yy254;}
138800 break;
138801 case 118: /* using_opt ::= */
138802 case 146: /* idlist_opt ::= */ yytestcase(yyruleno==146);
138803 {yymsp[1].minor.yy254 = 0;}
138804 break;
138805 case 120: /* orderby_opt ::= ORDER BY sortlist */
138806 case 127: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==127);
138807 {yymsp[-2].minor.yy148 = yymsp[0].minor.yy148;}
138808 break;
138809 case 121: /* sortlist ::= sortlist COMMA expr sortorder */
138810 {
138811 yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148,yymsp[-1].minor.yy190.pExpr);
138812 sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy148,yymsp[0].minor.yy194);
138813 }
138814 break;
138815 case 122: /* sortlist ::= expr sortorder */
138816 {
138817 yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy190.pExpr); /*A-overwrites-Y*/
138818 sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy148,yymsp[0].minor.yy194);
138819 }
138820 break;
138821 case 123: /* sortorder ::= ASC */
138822 {yymsp[0].minor.yy194 = SQLITE_SO_ASC;}
138823 break;
138824 case 124: /* sortorder ::= DESC */
138825 {yymsp[0].minor.yy194 = SQLITE_SO_DESC;}
138826 break;
138827 case 125: /* sortorder ::= */
138828 {yymsp[1].minor.yy194 = SQLITE_SO_UNDEFINED;}
138829 break;
138830 case 130: /* limit_opt ::= */
138831 {yymsp[1].minor.yy354.pLimit = 0; yymsp[1].minor.yy354.pOffset = 0;}
138832 break;
138833 case 131: /* limit_opt ::= LIMIT expr */
138834 {yymsp[-1].minor.yy354.pLimit = yymsp[0].minor.yy190.pExpr; yymsp[-1].minor.yy354.pOffset = 0;}
138835 break;
138836 case 132: /* limit_opt ::= LIMIT expr OFFSET expr */
138837 {yymsp[-3].minor.yy354.pLimit = yymsp[-2].minor.yy190.pExpr; yymsp[-3].minor.yy354.pOffset = yymsp[0].minor.yy190.pExpr;}
138838 break;
138839 case 133: /* limit_opt ::= LIMIT expr COMMA expr */
138840 {yymsp[-3].minor.yy354.pOffset = yymsp[-2].minor.yy190.pExpr; yymsp[-3].minor.yy354.pLimit = yymsp[0].minor.yy190.pExpr;}
138841 break;
138842 case 134: /* cmd ::= with DELETE FROM fullname indexed_opt where_opt */
138843 {
138844 sqlite3WithPush(pParse, yymsp[-5].minor.yy285, 1);
138845 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy185, &yymsp[-1].minor.yy0);
138846 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy185,yymsp[0].minor.yy72);
138847 }
138848 break;
138849 case 137: /* cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */
138850 {
138851 sqlite3WithPush(pParse, yymsp[-7].minor.yy285, 1);
138852 sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy185, &yymsp[-3].minor.yy0);
138853 sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy148,"set list");
138854 sqlite3Update(pParse,yymsp[-4].minor.yy185,yymsp[-1].minor.yy148,yymsp[0].minor.yy72,yymsp[-5].minor.yy194);
138855 }
138856 break;
138857 case 138: /* setlist ::= setlist COMMA nm EQ expr */
138858 {
138859 yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr);
138860 sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, 1);
138861 }
138862 break;
138863 case 139: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
138864 {
138865 yymsp[-6].minor.yy148 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy148, yymsp[-3].minor.yy254, yymsp[0].minor.yy190.pExpr);
138866 }
138867 break;
138868 case 140: /* setlist ::= nm EQ expr */
138869 {
138870 yylhsminor.yy148 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy190.pExpr);
138871 sqlite3ExprListSetName(pParse, yylhsminor.yy148, &yymsp[-2].minor.yy0, 1);
138872 }
138873 yymsp[-2].minor.yy148 = yylhsminor.yy148;
138874 break;
138875 case 141: /* setlist ::= LP idlist RP EQ expr */
138876 {
138877 yymsp[-4].minor.yy148 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy254, yymsp[0].minor.yy190.pExpr);
138878 }
138879 break;
138880 case 142: /* cmd ::= with insert_cmd INTO fullname idlist_opt select */
138881 {
138882 sqlite3WithPush(pParse, yymsp[-5].minor.yy285, 1);
138883 sqlite3Insert(pParse, yymsp[-2].minor.yy185, yymsp[0].minor.yy243, yymsp[-1].minor.yy254, yymsp[-4].minor.yy194);
138884 }
138885 break;
138886 case 143: /* cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */
138887 {
138888 sqlite3WithPush(pParse, yymsp[-6].minor.yy285, 1);
138889 sqlite3Insert(pParse, yymsp[-3].minor.yy185, 0, yymsp[-2].minor.yy254, yymsp[-5].minor.yy194);
138890 }
138891 break;
138892 case 147: /* idlist_opt ::= LP idlist RP */
138893 {yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;}
138894 break;
138895 case 148: /* idlist ::= idlist COMMA nm */
138896 {yymsp[-2].minor.yy254 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
138897 break;
138898 case 149: /* idlist ::= nm */
138899 {yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
138900 break;
138901 case 150: /* expr ::= LP expr RP */
138902 {spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ yymsp[-2].minor.yy190.pExpr = yymsp[-1].minor.yy190.pExpr;}
138903 break;
138904 case 151: /* term ::= NULL */
138905 case 156: /* term ::= FLOAT|BLOB */ yytestcase(yyruleno==156);
138906 case 157: /* term ::= STRING */ yytestcase(yyruleno==157);
138907 {spanExpr(&yymsp[0].minor.yy190,pParse,yymsp[0].major,yymsp[0].minor.yy0);/*A-overwrites-X*/}
138908 break;
138909 case 152: /* expr ::= ID|INDEXED */
138910 case 153: /* expr ::= JOIN_KW */ yytestcase(yyruleno==153);
138911 {spanExpr(&yymsp[0].minor.yy190,pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
138912 break;
138913 case 154: /* expr ::= nm DOT nm */
138914 {
138915 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
138916 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
138917 spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
138918 yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
138919 }
138920 break;
138921 case 155: /* expr ::= nm DOT nm DOT nm */
138922 {
138923 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
138924 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
138925 Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
138926 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
138927 spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
138928 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
138929 }
138930 break;
138931 case 158: /* term ::= INTEGER */
 
 
 
 
138932 {
138933 yylhsminor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
138934 yylhsminor.yy190.zStart = yymsp[0].minor.yy0.z;
138935 yylhsminor.yy190.zEnd = yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n;
138936 if( yylhsminor.yy190.pExpr ) yylhsminor.yy190.pExpr->flags |= EP_Leaf|EP_Resolved;
138937 }
138938 yymsp[0].minor.yy190 = yylhsminor.yy190;
138939 break;
138940 case 159: /* expr ::= VARIABLE */
138941 {
138942 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
138943 u32 n = yymsp[0].minor.yy0.n;
138944 spanExpr(&yymsp[0].minor.yy190, pParse, TK_VARIABLE, yymsp[0].minor.yy0);
138945 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy190.pExpr, n);
@@ -138958,24 +139287,24 @@
138958 if( yymsp[0].minor.yy190.pExpr ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy190.pExpr->iTable);
138959 }
138960 }
138961 }
138962 break;
138963 case 160: /* expr ::= expr COLLATE ID|STRING */
138964 {
138965 yymsp[-2].minor.yy190.pExpr = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy190.pExpr, &yymsp[0].minor.yy0, 1);
138966 yymsp[-2].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
138967 }
138968 break;
138969 case 161: /* expr ::= CAST LP expr AS typetoken RP */
138970 {
138971 spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
138972 yymsp[-5].minor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
138973 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, 0);
138974 }
138975 break;
138976 case 162: /* expr ::= ID|INDEXED LP distinct exprlist RP */
138977 {
138978 if( yymsp[-1].minor.yy148 && yymsp[-1].minor.yy148->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
138979 sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
138980 }
138981 yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy148, &yymsp[-4].minor.yy0);
@@ -138984,25 +139313,25 @@
138984 yylhsminor.yy190.pExpr->flags |= EP_Distinct;
138985 }
138986 }
138987 yymsp[-4].minor.yy190 = yylhsminor.yy190;
138988 break;
138989 case 163: /* expr ::= ID|INDEXED LP STAR RP */
138990 {
138991 yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
138992 spanSet(&yylhsminor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
138993 }
138994 yymsp[-3].minor.yy190 = yylhsminor.yy190;
138995 break;
138996 case 164: /* term ::= CTIME_KW */
138997 {
138998 yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0);
138999 spanSet(&yylhsminor.yy190, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
139000 }
139001 yymsp[0].minor.yy190 = yylhsminor.yy190;
139002 break;
139003 case 165: /* expr ::= LP nexprlist COMMA expr RP */
139004 {
139005 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy148, yymsp[-1].minor.yy190.pExpr);
139006 yylhsminor.yy190.pExpr = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
139007 if( yylhsminor.yy190.pExpr ){
139008 yylhsminor.yy190.pExpr->x.pList = pList;
@@ -139011,24 +139340,24 @@
139011 sqlite3ExprListDelete(pParse->db, pList);
139012 }
139013 }
139014 yymsp[-4].minor.yy190 = yylhsminor.yy190;
139015 break;
139016 case 166: /* expr ::= expr AND expr */
139017 case 167: /* expr ::= expr OR expr */ yytestcase(yyruleno==167);
139018 case 168: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==168);
139019 case 169: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==169);
139020 case 170: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==170);
139021 case 171: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==171);
139022 case 172: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==172);
139023 case 173: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==173);
139024 {spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);}
139025 break;
139026 case 174: /* likeop ::= NOT LIKE_KW|MATCH */
139027 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
139028 break;
139029 case 175: /* expr ::= expr likeop expr */
139030 {
139031 ExprList *pList;
139032 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
139033 yymsp[-1].minor.yy0.n &= 0x7fffffff;
139034 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy190.pExpr);
@@ -139037,11 +139366,11 @@
139037 exprNot(pParse, bNot, &yymsp[-2].minor.yy190);
139038 yymsp[-2].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
139039 if( yymsp[-2].minor.yy190.pExpr ) yymsp[-2].minor.yy190.pExpr->flags |= EP_InfixFunc;
139040 }
139041 break;
139042 case 176: /* expr ::= expr likeop expr ESCAPE expr */
139043 {
139044 ExprList *pList;
139045 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
139046 yymsp[-3].minor.yy0.n &= 0x7fffffff;
139047 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
@@ -139051,43 +139380,43 @@
139051 exprNot(pParse, bNot, &yymsp[-4].minor.yy190);
139052 yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
139053 if( yymsp[-4].minor.yy190.pExpr ) yymsp[-4].minor.yy190.pExpr->flags |= EP_InfixFunc;
139054 }
139055 break;
139056 case 177: /* expr ::= expr ISNULL|NOTNULL */
139057 {spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy190,&yymsp[0].minor.yy0);}
139058 break;
139059 case 178: /* expr ::= expr NOT NULL */
139060 {spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy0);}
139061 break;
139062 case 179: /* expr ::= expr IS expr */
139063 {
139064 spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);
139065 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-2].minor.yy190.pExpr, TK_ISNULL);
139066 }
139067 break;
139068 case 180: /* expr ::= expr IS NOT expr */
139069 {
139070 spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy190,&yymsp[0].minor.yy190);
139071 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, TK_NOTNULL);
139072 }
139073 break;
139074 case 181: /* expr ::= NOT expr */
139075 case 182: /* expr ::= BITNOT expr */ yytestcase(yyruleno==182);
139076 {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,yymsp[-1].major,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
139077 break;
139078 case 183: /* expr ::= MINUS expr */
139079 {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UMINUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
139080 break;
139081 case 184: /* expr ::= PLUS expr */
139082 {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UPLUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
139083 break;
139084 case 185: /* between_op ::= BETWEEN */
139085 case 188: /* in_op ::= IN */ yytestcase(yyruleno==188);
139086 {yymsp[0].minor.yy194 = 0;}
139087 break;
139088 case 187: /* expr ::= expr between_op expr AND expr */
139089 {
139090 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
139091 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr);
139092 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy190.pExpr, 0);
139093 if( yymsp[-4].minor.yy190.pExpr ){
@@ -139097,11 +139426,11 @@
139097 }
139098 exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
139099 yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
139100 }
139101 break;
139102 case 190: /* expr ::= expr in_op LP exprlist RP */
139103 {
139104 if( yymsp[-1].minor.yy148==0 ){
139105 /* Expressions of the form
139106 **
139107 ** expr1 IN ()
@@ -139150,26 +139479,26 @@
139150 exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
139151 }
139152 yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
139153 }
139154 break;
139155 case 191: /* expr ::= LP select RP */
139156 {
139157 spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
139158 yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
139159 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy190.pExpr, yymsp[-1].minor.yy243);
139160 }
139161 break;
139162 case 192: /* expr ::= expr in_op LP select RP */
139163 {
139164 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0);
139165 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, yymsp[-1].minor.yy243);
139166 exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
139167 yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
139168 }
139169 break;
139170 case 193: /* expr ::= expr in_op nm dbnm paren_exprlist */
139171 {
139172 SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
139173 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
139174 if( yymsp[0].minor.yy148 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy148);
139175 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0);
@@ -139176,19 +139505,19 @@
139176 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, pSelect);
139177 exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
139178 yymsp[-4].minor.yy190.zEnd = yymsp[-1].minor.yy0.z ? &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n] : &yymsp[-2].minor.yy0.z[yymsp[-2].minor.yy0.n];
139179 }
139180 break;
139181 case 194: /* expr ::= EXISTS LP select RP */
139182 {
139183 Expr *p;
139184 spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
139185 p = yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
139186 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy243);
139187 }
139188 break;
139189 case 195: /* expr ::= CASE case_operand case_exprlist case_else END */
139190 {
139191 spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-C*/
139192 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy72, 0);
139193 if( yymsp[-4].minor.yy190.pExpr ){
139194 yymsp[-4].minor.yy190.pExpr->x.pList = yymsp[-1].minor.yy72 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[-1].minor.yy72) : yymsp[-2].minor.yy148;
@@ -139197,332 +139526,332 @@
139197 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy148);
139198 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy72);
139199 }
139200 }
139201 break;
139202 case 196: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
139203 {
139204 yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[-2].minor.yy190.pExpr);
139205 yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr);
139206 }
139207 break;
139208 case 197: /* case_exprlist ::= WHEN expr THEN expr */
139209 {
139210 yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
139211 yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, yymsp[0].minor.yy190.pExpr);
139212 }
139213 break;
139214 case 200: /* case_operand ::= expr */
139215 {yymsp[0].minor.yy72 = yymsp[0].minor.yy190.pExpr; /*A-overwrites-X*/}
139216 break;
139217 case 203: /* nexprlist ::= nexprlist COMMA expr */
139218 {yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[0].minor.yy190.pExpr);}
139219 break;
139220 case 204: /* nexprlist ::= expr */
139221 {yymsp[0].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy190.pExpr); /*A-overwrites-Y*/}
139222 break;
139223 case 206: /* paren_exprlist ::= LP exprlist RP */
139224 case 211: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==211);
139225 {yymsp[-2].minor.yy148 = yymsp[-1].minor.yy148;}
139226 break;
139227 case 207: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
139228 {
139229 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
139230 sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy148, yymsp[-10].minor.yy194,
139231 &yymsp[-11].minor.yy0, yymsp[0].minor.yy72, SQLITE_SO_ASC, yymsp[-8].minor.yy194, SQLITE_IDXTYPE_APPDEF);
139232 }
139233 break;
139234 case 208: /* uniqueflag ::= UNIQUE */
139235 case 248: /* raisetype ::= ABORT */ yytestcase(yyruleno==248);
139236 {yymsp[0].minor.yy194 = OE_Abort;}
139237 break;
139238 case 209: /* uniqueflag ::= */
139239 {yymsp[1].minor.yy194 = OE_None;}
139240 break;
139241 case 212: /* eidlist ::= eidlist COMMA nm collate sortorder */
139242 {
139243 yymsp[-4].minor.yy148 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194);
139244 }
139245 break;
139246 case 213: /* eidlist ::= nm collate sortorder */
139247 {
139248 yymsp[-2].minor.yy148 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); /*A-overwrites-Y*/
139249 }
139250 break;
139251 case 216: /* cmd ::= DROP INDEX ifexists fullname */
139252 {sqlite3DropIndex(pParse, yymsp[0].minor.yy185, yymsp[-1].minor.yy194);}
139253 break;
139254 case 217: /* cmd ::= VACUUM */
139255 {sqlite3Vacuum(pParse,0);}
139256 break;
139257 case 218: /* cmd ::= VACUUM nm */
139258 {sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);}
139259 break;
139260 case 219: /* cmd ::= PRAGMA nm dbnm */
139261 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
139262 break;
139263 case 220: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
139264 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
139265 break;
139266 case 221: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
139267 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
139268 break;
139269 case 222: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
139270 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
139271 break;
139272 case 223: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
139273 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
139274 break;
139275 case 226: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
139276 {
139277 Token all;
139278 all.z = yymsp[-3].minor.yy0.z;
139279 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
139280 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy145, &all);
139281 }
139282 break;
139283 case 227: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
139284 {
139285 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy194, yymsp[-4].minor.yy332.a, yymsp[-4].minor.yy332.b, yymsp[-2].minor.yy185, yymsp[0].minor.yy72, yymsp[-10].minor.yy194, yymsp[-8].minor.yy194);
139286 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
139287 }
139288 break;
139289 case 228: /* trigger_time ::= BEFORE|AFTER */
139290 { yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-X*/ }
139291 break;
139292 case 229: /* trigger_time ::= INSTEAD OF */
139293 { yymsp[-1].minor.yy194 = TK_INSTEAD;}
139294 break;
139295 case 230: /* trigger_time ::= */
139296 { yymsp[1].minor.yy194 = TK_BEFORE; }
139297 break;
139298 case 231: /* trigger_event ::= DELETE|INSERT */
139299 case 232: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==232);
139300 {yymsp[0].minor.yy332.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy332.b = 0;}
139301 break;
139302 case 233: /* trigger_event ::= UPDATE OF idlist */
139303 {yymsp[-2].minor.yy332.a = TK_UPDATE; yymsp[-2].minor.yy332.b = yymsp[0].minor.yy254;}
139304 break;
139305 case 234: /* when_clause ::= */
139306 case 253: /* key_opt ::= */ yytestcase(yyruleno==253);
139307 { yymsp[1].minor.yy72 = 0; }
139308 break;
139309 case 235: /* when_clause ::= WHEN expr */
139310 case 254: /* key_opt ::= KEY expr */ yytestcase(yyruleno==254);
139311 { yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr; }
139312 break;
139313 case 236: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
139314 {
139315 assert( yymsp[-2].minor.yy145!=0 );
139316 yymsp[-2].minor.yy145->pLast->pNext = yymsp[-1].minor.yy145;
139317 yymsp[-2].minor.yy145->pLast = yymsp[-1].minor.yy145;
139318 }
139319 break;
139320 case 237: /* trigger_cmd_list ::= trigger_cmd SEMI */
139321 {
139322 assert( yymsp[-1].minor.yy145!=0 );
139323 yymsp[-1].minor.yy145->pLast = yymsp[-1].minor.yy145;
139324 }
139325 break;
139326 case 238: /* trnm ::= nm DOT nm */
139327 {
139328 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
139329 sqlite3ErrorMsg(pParse,
139330 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
139331 "statements within triggers");
139332 }
139333 break;
139334 case 239: /* tridxby ::= INDEXED BY nm */
139335 {
139336 sqlite3ErrorMsg(pParse,
139337 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
139338 "within triggers");
139339 }
139340 break;
139341 case 240: /* tridxby ::= NOT INDEXED */
139342 {
139343 sqlite3ErrorMsg(pParse,
139344 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
139345 "within triggers");
139346 }
139347 break;
139348 case 241: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
139349 {yymsp[-6].minor.yy145 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy148, yymsp[0].minor.yy72, yymsp[-5].minor.yy194);}
139350 break;
139351 case 242: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */
139352 {yymsp[-4].minor.yy145 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy254, yymsp[0].minor.yy243, yymsp[-4].minor.yy194);/*A-overwrites-R*/}
139353 break;
139354 case 243: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
139355 {yymsp[-4].minor.yy145 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy72);}
139356 break;
139357 case 244: /* trigger_cmd ::= select */
139358 {yymsp[0].minor.yy145 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy243); /*A-overwrites-X*/}
139359 break;
139360 case 245: /* expr ::= RAISE LP IGNORE RP */
139361 {
139362 spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
139363 yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
139364 if( yymsp[-3].minor.yy190.pExpr ){
139365 yymsp[-3].minor.yy190.pExpr->affinity = OE_Ignore;
139366 }
139367 }
139368 break;
139369 case 246: /* expr ::= RAISE LP raisetype COMMA nm RP */
139370 {
139371 spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
139372 yymsp[-5].minor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
139373 if( yymsp[-5].minor.yy190.pExpr ) {
139374 yymsp[-5].minor.yy190.pExpr->affinity = (char)yymsp[-3].minor.yy194;
139375 }
139376 }
139377 break;
139378 case 247: /* raisetype ::= ROLLBACK */
139379 {yymsp[0].minor.yy194 = OE_Rollback;}
139380 break;
139381 case 249: /* raisetype ::= FAIL */
139382 {yymsp[0].minor.yy194 = OE_Fail;}
139383 break;
139384 case 250: /* cmd ::= DROP TRIGGER ifexists fullname */
139385 {
139386 sqlite3DropTrigger(pParse,yymsp[0].minor.yy185,yymsp[-1].minor.yy194);
139387 }
139388 break;
139389 case 251: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
139390 {
139391 sqlite3Attach(pParse, yymsp[-3].minor.yy190.pExpr, yymsp[-1].minor.yy190.pExpr, yymsp[0].minor.yy72);
139392 }
139393 break;
139394 case 252: /* cmd ::= DETACH database_kw_opt expr */
139395 {
139396 sqlite3Detach(pParse, yymsp[0].minor.yy190.pExpr);
139397 }
139398 break;
139399 case 255: /* cmd ::= REINDEX */
139400 {sqlite3Reindex(pParse, 0, 0);}
139401 break;
139402 case 256: /* cmd ::= REINDEX nm dbnm */
139403 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
139404 break;
139405 case 257: /* cmd ::= ANALYZE */
139406 {sqlite3Analyze(pParse, 0, 0);}
139407 break;
139408 case 258: /* cmd ::= ANALYZE nm dbnm */
139409 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
139410 break;
139411 case 259: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
139412 {
139413 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy185,&yymsp[0].minor.yy0);
139414 }
139415 break;
139416 case 260: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
139417 {
139418 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
139419 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
139420 }
139421 break;
139422 case 261: /* add_column_fullname ::= fullname */
139423 {
139424 disableLookaside(pParse);
139425 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy185);
139426 }
139427 break;
139428 case 262: /* cmd ::= create_vtab */
139429 {sqlite3VtabFinishParse(pParse,0);}
139430 break;
139431 case 263: /* cmd ::= create_vtab LP vtabarglist RP */
139432 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
139433 break;
139434 case 264: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
139435 {
139436 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy194);
139437 }
139438 break;
139439 case 265: /* vtabarg ::= */
139440 {sqlite3VtabArgInit(pParse);}
139441 break;
139442 case 266: /* vtabargtoken ::= ANY */
139443 case 267: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==267);
139444 case 268: /* lp ::= LP */ yytestcase(yyruleno==268);
139445 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
139446 break;
139447 case 269: /* with ::= */
139448 {yymsp[1].minor.yy285 = 0;}
139449 break;
139450 case 270: /* with ::= WITH wqlist */
139451 { yymsp[-1].minor.yy285 = yymsp[0].minor.yy285; }
139452 break;
139453 case 271: /* with ::= WITH RECURSIVE wqlist */
139454 { yymsp[-2].minor.yy285 = yymsp[0].minor.yy285; }
139455 break;
139456 case 272: /* wqlist ::= nm eidlist_opt AS LP select RP */
139457 {
139458 yymsp[-5].minor.yy285 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); /*A-overwrites-X*/
139459 }
139460 break;
139461 case 273: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
139462 {
139463 yymsp[-7].minor.yy285 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy285, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243);
139464 }
139465 break;
139466 default:
139467 /* (274) input ::= cmdlist */ yytestcase(yyruleno==274);
139468 /* (275) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==275);
139469 /* (276) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=276);
139470 /* (277) ecmd ::= SEMI */ yytestcase(yyruleno==277);
139471 /* (278) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==278);
139472 /* (279) explain ::= */ yytestcase(yyruleno==279);
139473 /* (280) trans_opt ::= */ yytestcase(yyruleno==280);
139474 /* (281) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==281);
139475 /* (282) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==282);
139476 /* (283) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==283);
139477 /* (284) savepoint_opt ::= */ yytestcase(yyruleno==284);
139478 /* (285) cmd ::= create_table create_table_args */ yytestcase(yyruleno==285);
139479 /* (286) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==286);
139480 /* (287) columnlist ::= columnname carglist */ yytestcase(yyruleno==287);
139481 /* (288) nm ::= ID|INDEXED */ yytestcase(yyruleno==288);
139482 /* (289) nm ::= STRING */ yytestcase(yyruleno==289);
139483 /* (290) nm ::= JOIN_KW */ yytestcase(yyruleno==290);
139484 /* (291) typetoken ::= typename */ yytestcase(yyruleno==291);
139485 /* (292) typename ::= ID|STRING */ yytestcase(yyruleno==292);
139486 /* (293) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=293);
139487 /* (294) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=294);
139488 /* (295) carglist ::= carglist ccons */ yytestcase(yyruleno==295);
139489 /* (296) carglist ::= */ yytestcase(yyruleno==296);
139490 /* (297) ccons ::= NULL onconf */ yytestcase(yyruleno==297);
139491 /* (298) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==298);
139492 /* (299) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==299);
139493 /* (300) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=300);
139494 /* (301) tconscomma ::= */ yytestcase(yyruleno==301);
139495 /* (302) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=302);
139496 /* (303) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=303);
139497 /* (304) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=304);
139498 /* (305) oneselect ::= values */ yytestcase(yyruleno==305);
139499 /* (306) sclp ::= selcollist COMMA */ yytestcase(yyruleno==306);
139500 /* (307) as ::= ID|STRING */ yytestcase(yyruleno==307);
139501 /* (308) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=308);
139502 /* (309) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==309);
139503 /* (310) exprlist ::= nexprlist */ yytestcase(yyruleno==310);
139504 /* (311) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=311);
139505 /* (312) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=312);
139506 /* (313) nmnum ::= ON */ yytestcase(yyruleno==313);
139507 /* (314) nmnum ::= DELETE */ yytestcase(yyruleno==314);
139508 /* (315) nmnum ::= DEFAULT */ yytestcase(yyruleno==315);
139509 /* (316) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==316);
139510 /* (317) foreach_clause ::= */ yytestcase(yyruleno==317);
139511 /* (318) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==318);
139512 /* (319) trnm ::= nm */ yytestcase(yyruleno==319);
139513 /* (320) tridxby ::= */ yytestcase(yyruleno==320);
139514 /* (321) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==321);
139515 /* (322) database_kw_opt ::= */ yytestcase(yyruleno==322);
139516 /* (323) kwcolumn_opt ::= */ yytestcase(yyruleno==323);
139517 /* (324) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==324);
139518 /* (325) vtabarglist ::= vtabarg */ yytestcase(yyruleno==325);
139519 /* (326) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==326);
139520 /* (327) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==327);
139521 /* (328) anylist ::= */ yytestcase(yyruleno==328);
139522 /* (329) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==329);
139523 /* (330) anylist ::= anylist ANY */ yytestcase(yyruleno==330);
139524 break;
139525 /********** End reduce actions ************************************************/
139526 };
139527 assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
139528 yygoto = yyRuleInfo[yyruleno].lhs;
@@ -139948,138 +140277,149 @@
139948 ** But by using this automatically generated code, the size of the code
139949 ** is substantially reduced. This is important for embedded applications
139950 ** on platforms with limited memory.
139951 */
139952 /* Hash score: 182 */
139953 static int keywordCode(const char *z, int n, int *pType){
139954 /* zText[] encodes 834 bytes of keywords in 554 bytes */
139955 /* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */
139956 /* ABLEFTHENDEFERRABLELSEXCEPTRANSACTIONATURALTERAISEXCLUSIVE */
139957 /* XISTSAVEPOINTERSECTRIGGEREFERENCESCONSTRAINTOFFSETEMPORARY */
139958 /* UNIQUERYWITHOUTERELEASEATTACHAVINGROUPDATEBEGINNERECURSIVE */
139959 /* BETWEENOTNULLIKECASCADELETECASECOLLATECREATECURRENT_DATEDETACH */
139960 /* IMMEDIATEJOINSERTMATCHPLANALYZEPRAGMABORTVALUESVIRTUALIMITWHEN */
139961 /* WHERENAMEAFTEREPLACEANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMIT */
139962 /* CONFLICTCROSSCURRENT_TIMESTAMPRIMARYDEFERREDISTINCTDROPFAIL */
139963 /* FROMFULLGLOBYIFISNULLORDERESTRICTRIGHTROLLBACKROWUNIONUSING */
139964 /* VACUUMVIEWINITIALLY */
139965 static const char zText[553] = {
139966 'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H',
139967 'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G',
139968 'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A',
139969 'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F',
139970 'E','R','R','A','B','L','E','L','S','E','X','C','E','P','T','R','A','N',
139971 'S','A','C','T','I','O','N','A','T','U','R','A','L','T','E','R','A','I',
139972 'S','E','X','C','L','U','S','I','V','E','X','I','S','T','S','A','V','E',
139973 'P','O','I','N','T','E','R','S','E','C','T','R','I','G','G','E','R','E',
139974 'F','E','R','E','N','C','E','S','C','O','N','S','T','R','A','I','N','T',
139975 'O','F','F','S','E','T','E','M','P','O','R','A','R','Y','U','N','I','Q',
139976 'U','E','R','Y','W','I','T','H','O','U','T','E','R','E','L','E','A','S',
139977 'E','A','T','T','A','C','H','A','V','I','N','G','R','O','U','P','D','A',
139978 'T','E','B','E','G','I','N','N','E','R','E','C','U','R','S','I','V','E',
139979 'B','E','T','W','E','E','N','O','T','N','U','L','L','I','K','E','C','A',
139980 'S','C','A','D','E','L','E','T','E','C','A','S','E','C','O','L','L','A',
139981 'T','E','C','R','E','A','T','E','C','U','R','R','E','N','T','_','D','A',
139982 'T','E','D','E','T','A','C','H','I','M','M','E','D','I','A','T','E','J',
139983 'O','I','N','S','E','R','T','M','A','T','C','H','P','L','A','N','A','L',
139984 'Y','Z','E','P','R','A','G','M','A','B','O','R','T','V','A','L','U','E',
139985 'S','V','I','R','T','U','A','L','I','M','I','T','W','H','E','N','W','H',
139986 'E','R','E','N','A','M','E','A','F','T','E','R','E','P','L','A','C','E',
139987 'A','N','D','E','F','A','U','L','T','A','U','T','O','I','N','C','R','E',
139988 'M','E','N','T','C','A','S','T','C','O','L','U','M','N','C','O','M','M',
139989 'I','T','C','O','N','F','L','I','C','T','C','R','O','S','S','C','U','R',
139990 'R','E','N','T','_','T','I','M','E','S','T','A','M','P','R','I','M','A',
139991 'R','Y','D','E','F','E','R','R','E','D','I','S','T','I','N','C','T','D',
139992 'R','O','P','F','A','I','L','F','R','O','M','F','U','L','L','G','L','O',
139993 'B','Y','I','F','I','S','N','U','L','L','O','R','D','E','R','E','S','T',
139994 'R','I','C','T','R','I','G','H','T','R','O','L','L','B','A','C','K','R',
139995 'O','W','U','N','I','O','N','U','S','I','N','G','V','A','C','U','U','M',
139996 'V','I','E','W','I','N','I','T','I','A','L','L','Y',
139997 };
139998 static const unsigned char aHash[127] = {
139999 76, 105, 117, 74, 0, 45, 0, 0, 82, 0, 77, 0, 0,
140000 42, 12, 78, 15, 0, 116, 85, 54, 112, 0, 19, 0, 0,
140001 121, 0, 119, 115, 0, 22, 93, 0, 9, 0, 0, 70, 71,
140002 0, 69, 6, 0, 48, 90, 102, 0, 118, 101, 0, 0, 44,
140003 0, 103, 24, 0, 17, 0, 122, 53, 23, 0, 5, 110, 25,
140004 96, 0, 0, 124, 106, 60, 123, 57, 28, 55, 0, 91, 0,
140005 100, 26, 0, 99, 0, 0, 0, 95, 92, 97, 88, 109, 14,
140006 39, 108, 0, 81, 0, 18, 89, 111, 32, 0, 120, 80, 113,
140007 62, 46, 84, 0, 0, 94, 40, 59, 114, 0, 36, 0, 0,
140008 29, 0, 86, 63, 64, 0, 20, 61, 0, 56,
140009 };
140010 static const unsigned char aNext[124] = {
140011 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
140012 0, 2, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0,
140013 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
140014 0, 0, 0, 0, 33, 0, 21, 0, 0, 0, 0, 0, 50,
140015 0, 43, 3, 47, 0, 0, 0, 0, 30, 0, 58, 0, 38,
140016 0, 0, 0, 1, 66, 0, 0, 67, 0, 41, 0, 0, 0,
140017 0, 0, 0, 49, 65, 0, 0, 0, 0, 31, 52, 16, 34,
140018 10, 0, 0, 0, 0, 0, 0, 0, 11, 72, 79, 0, 8,
140019 0, 104, 98, 0, 107, 0, 87, 0, 75, 51, 0, 27, 37,
140020 73, 83, 0, 35, 68, 0, 0,
140021 };
140022 static const unsigned char aLen[124] = {
140023 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
140024 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 6,
140025 11, 6, 2, 7, 5, 5, 9, 6, 9, 9, 7, 10, 10,
140026 4, 6, 2, 3, 9, 4, 2, 6, 5, 7, 4, 5, 7,
140027 6, 6, 5, 6, 5, 5, 9, 7, 7, 3, 2, 4, 4,
140028 7, 3, 6, 4, 7, 6, 12, 6, 9, 4, 6, 5, 4,
140029 7, 6, 5, 6, 7, 5, 4, 5, 6, 5, 7, 3, 7,
140030 13, 2, 2, 4, 6, 6, 8, 5, 17, 12, 7, 8, 8,
140031 2, 4, 4, 4, 4, 4, 2, 2, 6, 5, 8, 5, 8,
140032 3, 5, 5, 6, 4, 9, 3,
140033 };
140034 static const unsigned short int aOffset[124] = {
140035 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
140036 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
140037 86, 91, 95, 96, 101, 105, 109, 117, 122, 128, 136, 142, 152,
140038 159, 162, 162, 165, 167, 167, 171, 176, 179, 184, 184, 188, 192,
140039 199, 204, 209, 212, 218, 221, 225, 234, 240, 240, 240, 243, 246,
140040 250, 251, 255, 261, 265, 272, 278, 290, 296, 305, 307, 313, 318,
140041 320, 327, 332, 337, 343, 349, 354, 358, 361, 367, 371, 378, 380,
140042 387, 389, 391, 400, 404, 410, 416, 424, 429, 429, 445, 452, 459,
140043 460, 467, 471, 475, 479, 483, 486, 488, 490, 496, 500, 508, 513,
140044 521, 524, 529, 534, 540, 544, 549,
140045 };
140046 static const unsigned char aCode[124] = {
140047 TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
140048 TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
140049 TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
140050 TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
140051 TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
140052 TK_EXCEPT, TK_TRANSACTION,TK_ACTION, TK_ON, TK_JOIN_KW,
140053 TK_ALTER, TK_RAISE, TK_EXCLUSIVE, TK_EXISTS, TK_SAVEPOINT,
140054 TK_INTERSECT, TK_TRIGGER, TK_REFERENCES, TK_CONSTRAINT, TK_INTO,
140055 TK_OFFSET, TK_OF, TK_SET, TK_TEMP, TK_TEMP,
140056 TK_OR, TK_UNIQUE, TK_QUERY, TK_WITHOUT, TK_WITH,
140057 TK_JOIN_KW, TK_RELEASE, TK_ATTACH, TK_HAVING, TK_GROUP,
140058 TK_UPDATE, TK_BEGIN, TK_JOIN_KW, TK_RECURSIVE, TK_BETWEEN,
140059 TK_NOTNULL, TK_NOT, TK_NO, TK_NULL, TK_LIKE_KW,
140060 TK_CASCADE, TK_ASC, TK_DELETE, TK_CASE, TK_COLLATE,
140061 TK_CREATE, TK_CTIME_KW, TK_DETACH, TK_IMMEDIATE, TK_JOIN,
140062 TK_INSERT, TK_MATCH, TK_PLAN, TK_ANALYZE, TK_PRAGMA,
140063 TK_ABORT, TK_VALUES, TK_VIRTUAL, TK_LIMIT, TK_WHEN,
140064 TK_WHERE, TK_RENAME, TK_AFTER, TK_REPLACE, TK_AND,
140065 TK_DEFAULT, TK_AUTOINCR, TK_TO, TK_IN, TK_CAST,
140066 TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW,
140067 TK_CTIME_KW, TK_PRIMARY, TK_DEFERRED, TK_DISTINCT, TK_IS,
140068 TK_DROP, TK_FAIL, TK_FROM, TK_JOIN_KW, TK_LIKE_KW,
140069 TK_BY, TK_IF, TK_ISNULL, TK_ORDER, TK_RESTRICT,
140070 TK_JOIN_KW, TK_ROLLBACK, TK_ROW, TK_UNION, TK_USING,
140071 TK_VACUUM, TK_VIEW, TK_INITIALLY, TK_ALL,
140072 };
 
 
 
 
 
 
 
 
 
 
 
140073 int i, j;
140074 const char *zKW;
140075 if( n>=2 ){
140076 i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n) % 127;
140077 for(i=((int)aHash[i])-1; i>=0; i=((int)aNext[i])-1){
140078 if( aLen[i]!=n ) continue;
140079 j = 0;
140080 zKW = &zText[aOffset[i]];
140081 #ifdef SQLITE_ASCII
140082 while( j<n && (z[j]&~0x20)==zKW[j] ){ j++; }
140083 #endif
140084 #ifdef SQLITE_EBCDIC
140085 while( j<n && toupper(z[j])==zKW[j] ){ j++; }
@@ -140207,11 +140547,11 @@
140207 testcase( i==119 ); /* USING */
140208 testcase( i==120 ); /* VACUUM */
140209 testcase( i==121 ); /* VIEW */
140210 testcase( i==122 ); /* INITIALLY */
140211 testcase( i==123 ); /* ALL */
140212 *pType = aCode[i];
140213 break;
140214 }
140215 }
140216 return n;
140217 }
@@ -142486,14 +142826,14 @@
142486 ** argument.
142487 */
142488 SQLITE_PRIVATE const char *sqlite3ErrStr(int rc){
142489 static const char* const aMsg[] = {
142490 /* SQLITE_OK */ "not an error",
142491 /* SQLITE_ERROR */ "SQL logic error or missing database",
142492 /* SQLITE_INTERNAL */ 0,
142493 /* SQLITE_PERM */ "access permission denied",
142494 /* SQLITE_ABORT */ "callback requested query abort",
142495 /* SQLITE_BUSY */ "database is locked",
142496 /* SQLITE_LOCKED */ "database table is locked",
142497 /* SQLITE_NOMEM */ "out of memory",
142498 /* SQLITE_READONLY */ "attempt to write a readonly database",
142499 /* SQLITE_INTERRUPT */ "interrupted",
@@ -142501,21 +142841,25 @@
142501 /* SQLITE_CORRUPT */ "database disk image is malformed",
142502 /* SQLITE_NOTFOUND */ "unknown operation",
142503 /* SQLITE_FULL */ "database or disk is full",
142504 /* SQLITE_CANTOPEN */ "unable to open database file",
142505 /* SQLITE_PROTOCOL */ "locking protocol",
142506 /* SQLITE_EMPTY */ "table contains no data",
142507 /* SQLITE_SCHEMA */ "database schema has changed",
142508 /* SQLITE_TOOBIG */ "string or blob too big",
142509 /* SQLITE_CONSTRAINT */ "constraint failed",
142510 /* SQLITE_MISMATCH */ "datatype mismatch",
142511 /* SQLITE_MISUSE */ "library routine called out of sequence",
 
142512 /* SQLITE_NOLFS */ "large file support is disabled",
 
 
 
142513 /* SQLITE_AUTH */ "authorization denied",
142514 /* SQLITE_FORMAT */ "auxiliary database format error",
142515 /* SQLITE_RANGE */ "bind or column index out of range",
142516 /* SQLITE_NOTADB */ "file is encrypted or is not a database",
142517 };
142518 const char *zErr = "unknown error";
142519 switch( rc ){
142520 case SQLITE_ABORT_ROLLBACK: {
142521 zErr = "abort due to ROLLBACK";
@@ -143351,16 +143695,13 @@
143351 SQLITE_API const void *sqlite3_errmsg16(sqlite3 *db){
143352 static const u16 outOfMem[] = {
143353 'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0
143354 };
143355 static const u16 misuse[] = {
143356 'l', 'i', 'b', 'r', 'a', 'r', 'y', ' ',
143357 'r', 'o', 'u', 't', 'i', 'n', 'e', ' ',
143358 'c', 'a', 'l', 'l', 'e', 'd', ' ',
143359 'o', 'u', 't', ' ',
143360 'o', 'f', ' ',
143361 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', 0
143362 };
143363
143364 const void *z;
143365 if( !db ){
143366 return (void *)outOfMem;
@@ -143891,30 +144232,10 @@
143891 #ifndef SQLITE_OMIT_AUTOINIT
143892 rc = sqlite3_initialize();
143893 if( rc ) return rc;
143894 #endif
143895
143896 /* Only allow sensible combinations of bits in the flags argument.
143897 ** Throw an error if any non-sense combination is used. If we
143898 ** do not block illegal combinations here, it could trigger
143899 ** assert() statements in deeper layers. Sensible combinations
143900 ** are:
143901 **
143902 ** 1: SQLITE_OPEN_READONLY
143903 ** 2: SQLITE_OPEN_READWRITE
143904 ** 6: SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
143905 */
143906 assert( SQLITE_OPEN_READONLY == 0x01 );
143907 assert( SQLITE_OPEN_READWRITE == 0x02 );
143908 assert( SQLITE_OPEN_CREATE == 0x04 );
143909 testcase( (1<<(flags&7))==0x02 ); /* READONLY */
143910 testcase( (1<<(flags&7))==0x04 ); /* READWRITE */
143911 testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */
143912 if( ((1<<(flags&7)) & 0x46)==0 ){
143913 return SQLITE_MISUSE_BKPT; /* IMP: R-65497-44594 */
143914 }
143915
143916 if( sqlite3GlobalConfig.bCoreMutex==0 ){
143917 isThreadsafe = 0;
143918 }else if( flags & SQLITE_OPEN_NOMUTEX ){
143919 isThreadsafe = 0;
143920 }else if( flags & SQLITE_OPEN_FULLMUTEX ){
@@ -144032,13 +144353,34 @@
144032 ** strings is BINARY.
144033 */
144034 db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, sqlite3StrBINARY, 0);
144035 assert( db->pDfltColl!=0 );
144036
144037 /* Parse the filename/URI argument. */
 
 
 
 
 
 
 
 
 
 
 
144038 db->openFlags = flags;
144039 rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
 
 
 
 
 
 
 
 
 
 
144040 if( rc!=SQLITE_OK ){
144041 if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
144042 sqlite3ErrorWithMsg(db, rc, zErrMsg ? "%s" : 0, zErrMsg);
144043 sqlite3_free(zErrMsg);
144044 goto opendb_out;
@@ -148199,23 +148541,32 @@
148199 }
148200 pCsr->bSeekStmt = 0;
148201 }
148202 sqlite3_finalize(pCsr->pStmt);
148203 }
 
 
 
 
 
 
 
 
 
 
 
 
 
148204
148205 /*
148206 ** Close the cursor. For additional information see the documentation
148207 ** on the xClose method of the virtual table interface.
148208 */
148209 static int fts3CloseMethod(sqlite3_vtab_cursor *pCursor){
148210 Fts3Cursor *pCsr = (Fts3Cursor *)pCursor;
148211 assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );
148212 fts3CursorFinalizeStmt(pCsr);
148213 sqlite3Fts3ExprFree(pCsr->pExpr);
148214 sqlite3Fts3FreeDeferredTokens(pCsr);
148215 sqlite3_free(pCsr->aDoclist);
148216 sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);
148217 assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );
148218 sqlite3_free(pCsr);
148219 return SQLITE_OK;
148220 }
148221
@@ -149712,15 +150063,11 @@
149712 if( idxNum & FTS3_HAVE_DOCID_GE ) pDocidGe = apVal[iIdx++];
149713 if( idxNum & FTS3_HAVE_DOCID_LE ) pDocidLe = apVal[iIdx++];
149714 assert( iIdx==nVal );
149715
149716 /* In case the cursor has been used before, clear it now. */
149717 fts3CursorFinalizeStmt(pCsr);
149718 sqlite3_free(pCsr->aDoclist);
149719 sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);
149720 sqlite3Fts3ExprFree(pCsr->pExpr);
149721 memset(&pCursor[1], 0, sizeof(Fts3Cursor)-sizeof(sqlite3_vtab_cursor));
149722
149723 /* Set the lower and upper bounds on docids to return */
149724 pCsr->iMinDocid = fts3DocidRange(pDocidGe, SMALLEST_INT64);
149725 pCsr->iMaxDocid = fts3DocidRange(pDocidLe, LARGEST_INT64);
149726
@@ -149795,11 +150142,16 @@
149795 /*
149796 ** This is the xEof method of the virtual table. SQLite calls this
149797 ** routine to find out if it has reached the end of a result set.
149798 */
149799 static int fts3EofMethod(sqlite3_vtab_cursor *pCursor){
149800 return ((Fts3Cursor *)pCursor)->isEof;
 
 
 
 
 
149801 }
149802
149803 /*
149804 ** This is the xRowid method. The SQLite core calls this routine to
149805 ** retrieve the rowid for the current row of the result set. fts3
@@ -168168,10 +168520,14 @@
168168 pRtree->zDb, pRtree->zName
168169 );
168170 rc = getIntFromStmt(db, zSql, &pRtree->iNodeSize);
168171 if( rc!=SQLITE_OK ){
168172 *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db));
 
 
 
 
168173 }
168174 }
168175
168176 sqlite3_free(zSql);
168177 return rc;
@@ -175429,10 +175785,13 @@
175429 0, /* xSync */
175430 0, /* xCommit */
175431 0, /* xRollback */
175432 0, /* xFindMethod */
175433 0, /* xRename */
 
 
 
175434 };
175435 return sqlite3_create_module(db, "dbstat", &dbstat_module, 0);
175436 }
175437 #elif defined(SQLITE_ENABLE_DBSTAT_VTAB)
175438 SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3 *db){ return SQLITE_OK; }
@@ -184399,11 +184758,13 @@
184399 pParser->fts5yyerrcnt = -1;
184400 #endif
184401 pParser->fts5yytos = pParser->fts5yystack;
184402 pParser->fts5yystack[0].stateno = 0;
184403 pParser->fts5yystack[0].major = 0;
 
184404 pParser->fts5yystackEnd = &pParser->fts5yystack[fts5YYSTACKDEPTH-1];
 
184405 }
184406
184407 #ifndef sqlite3Fts5Parser_ENGINEALWAYSONSTACK
184408 /*
184409 ** This function allocates a new parser.
@@ -199766,11 +200127,11 @@
199766 int nArg, /* Number of args */
199767 sqlite3_value **apUnused /* Function arguments */
199768 ){
199769 assert( nArg==0 );
199770 UNUSED_PARAM2(nArg, apUnused);
199771 sqlite3_result_text(pCtx, "fts5: 2017-06-29 17:27:04 284707a7b3514a55cce24292e45632b7033d6edcff5b27deac5118b27c7b2954", -1, SQLITE_TRANSIENT);
199772 }
199773
199774 static int fts5Init(sqlite3 *db){
199775 static const sqlite3_module fts5Mod = {
199776 /* iVersion */ 2,
@@ -203694,20 +204055,20 @@
203694 sqlite3_int64 iRowid; /* The rowid */
203695 };
203696
203697 /*
203698 ** The stmtConnect() method is invoked to create a new
203699 ** stmt_vtab that describes the generate_stmt virtual table.
203700 **
203701 ** Think of this routine as the constructor for stmt_vtab objects.
203702 **
203703 ** All this routine needs to do is:
203704 **
203705 ** (1) Allocate the stmt_vtab object and initialize all fields.
203706 **
203707 ** (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
203708 ** result set of queries against generate_stmt will look like.
203709 */
203710 static int stmtConnect(
203711 sqlite3 *db,
203712 void *pAux,
203713 int argc, const char *const*argv,
@@ -203871,11 +204232,11 @@
203871 return stmtNext(pVtabCursor);
203872 }
203873
203874 /*
203875 ** SQLite will invoke this method one or more times while planning a query
203876 ** that uses the generate_stmt virtual table. This routine needs to create
203877 ** a query plan for each invocation and compute an estimated cost for that
203878 ** plan.
203879 */
203880 static int stmtBestIndex(
203881 sqlite3_vtab *tab,
@@ -203886,11 +204247,11 @@
203886 return SQLITE_OK;
203887 }
203888
203889 /*
203890 ** This following structure defines all the methods for the
203891 ** generate_stmt virtual table.
203892 */
203893 static sqlite3_module stmtModule = {
203894 0, /* iVersion */
203895 0, /* xCreate */
203896 stmtConnect, /* xConnect */
@@ -203909,10 +204270,13 @@
203909 0, /* xSync */
203910 0, /* xCommit */
203911 0, /* xRollback */
203912 0, /* xFindMethod */
203913 0, /* xRename */
 
 
 
203914 };
203915
203916 #endif /* SQLITE_OMIT_VIRTUALTABLE */
203917
203918 SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3 *db){
203919
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -1150,11 +1150,11 @@
1150 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
1151 ** [sqlite_version()] and [sqlite_source_id()].
1152 */
1153 #define SQLITE_VERSION "3.20.0"
1154 #define SQLITE_VERSION_NUMBER 3020000
1155 #define SQLITE_SOURCE_ID "2017-07-12 18:05:54 604c11d1a39f09e47b6fcee0f8b1c1054f9dbbc7b2c1cf93312aeaa4b7095018"
1156
1157 /*
1158 ** CAPI3REF: Run-Time Library Version Numbers
1159 ** KEYWORDS: sqlite3_version sqlite3_sourceid
1160 **
@@ -1444,11 +1444,11 @@
1444 **
1445 ** See also: [extended result code definitions]
1446 */
1447 #define SQLITE_OK 0 /* Successful result */
1448 /* beginning-of-error-codes */
1449 #define SQLITE_ERROR 1 /* Generic error */
1450 #define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */
1451 #define SQLITE_PERM 3 /* Access permission denied */
1452 #define SQLITE_ABORT 4 /* Callback routine requested an abort */
1453 #define SQLITE_BUSY 5 /* The database file is locked */
1454 #define SQLITE_LOCKED 6 /* A table in the database is locked */
@@ -1459,19 +1459,19 @@
1459 #define SQLITE_CORRUPT 11 /* The database disk image is malformed */
1460 #define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */
1461 #define SQLITE_FULL 13 /* Insertion failed because database is full */
1462 #define SQLITE_CANTOPEN 14 /* Unable to open the database file */
1463 #define SQLITE_PROTOCOL 15 /* Database lock protocol error */
1464 #define SQLITE_EMPTY 16 /* Not used */
1465 #define SQLITE_SCHEMA 17 /* The database schema changed */
1466 #define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
1467 #define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
1468 #define SQLITE_MISMATCH 20 /* Data type mismatch */
1469 #define SQLITE_MISUSE 21 /* Library used incorrectly */
1470 #define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
1471 #define SQLITE_AUTH 23 /* Authorization denied */
1472 #define SQLITE_FORMAT 24 /* Not used */
1473 #define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */
1474 #define SQLITE_NOTADB 26 /* File opened that is not a database file */
1475 #define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */
1476 #define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */
1477 #define SQLITE_ROW 100 /* sqlite3_step() has another row ready */
@@ -5294,10 +5294,32 @@
5294
5295 /*
5296 ** CAPI3REF: Result Values From A Query
5297 ** KEYWORDS: {column access functions}
5298 ** METHOD: sqlite3_stmt
5299 **
5300 ** <b>Summary:</b>
5301 ** <blockquote><table border=0 cellpadding=0 cellspacing=0>
5302 ** <tr><td><b>sqlite3_column_blob</b><td>&rarr;<td>BLOB result
5303 ** <tr><td><b>sqlite3_column_double</b><td>&rarr;<td>REAL result
5304 ** <tr><td><b>sqlite3_column_int</b><td>&rarr;<td>32-bit INTEGER result
5305 ** <tr><td><b>sqlite3_column_int64</b><td>&rarr;<td>64-bit INTEGER result
5306 ** <tr><td><b>sqlite3_column_text</b><td>&rarr;<td>UTF-8 TEXT result
5307 ** <tr><td><b>sqlite3_column_text16</b><td>&rarr;<td>UTF-16 TEXT result
5308 ** <tr><td><b>sqlite3_column_value</b><td>&rarr;<td>The result as an
5309 ** [sqlite3_value|unprotected sqlite3_value] object.
5310 ** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
5311 ** <tr><td><b>sqlite3_column_bytes</b><td>&rarr;<td>Size of a BLOB
5312 ** or a UTF-8 TEXT result in bytes
5313 ** <tr><td><b>sqlite3_column_bytes16&nbsp;&nbsp;</b>
5314 ** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
5315 ** TEXT in bytes
5316 ** <tr><td><b>sqlite3_column_type</b><td>&rarr;<td>Default
5317 ** datatype of the result
5318 ** </table></blockquote>
5319 **
5320 ** <b>Details:</b>
5321 **
5322 ** ^These routines return information about a single column of the current
5323 ** result row of a query. ^In every case the first argument is a pointer
5324 ** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
5325 ** that was returned from [sqlite3_prepare_v3()] or one of its variants)
@@ -5316,19 +5338,32 @@
5338 ** something other than [SQLITE_ROW], the results are undefined.
5339 ** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()]
5340 ** are called from a different thread while any of these routines
5341 ** are pending, then the results are undefined.
5342 **
5343 ** The first six interfaces (_blob, _double, _int, _int64, _text, and _text16)
5344 ** each return the value of a result column in a specific data format. If
5345 ** the result column is not initially in the requested format (for example,
5346 ** if the query returns an integer but the sqlite3_column_text() interface
5347 ** is used to extract the value) then an automatic type conversion is performed.
5348 **
5349 ** ^The sqlite3_column_type() routine returns the
5350 ** [SQLITE_INTEGER | datatype code] for the initial data type
5351 ** of the result column. ^The returned value is one of [SQLITE_INTEGER],
5352 ** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].
5353 ** The return value of sqlite3_column_type() can be used to decide which
5354 ** of the first six interface should be used to extract the column value.
5355 ** The value returned by sqlite3_column_type() is only meaningful if no
5356 ** automatic type conversions have occurred for the value in question.
5357 ** After a type conversion, the result of calling sqlite3_column_type()
5358 ** is undefined, though harmless. Future
5359 ** versions of SQLite may change the behavior of sqlite3_column_type()
5360 ** following a type conversion.
5361 **
5362 ** If the result is a BLOB or a TEXT string, then the sqlite3_column_bytes()
5363 ** or sqlite3_column_bytes16() interfaces can be used to determine the size
5364 ** of that BLOB or string.
5365 **
5366 ** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
5367 ** routine returns the number of bytes in that BLOB or string.
5368 ** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts
5369 ** the string to UTF-8 and then returns the number of bytes.
@@ -5362,13 +5397,17 @@
5397 ** [sqlite3_bind_value()] and [sqlite3_result_value()].
5398 ** If the [unprotected sqlite3_value] object returned by
5399 ** [sqlite3_column_value()] is used in any other way, including calls
5400 ** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
5401 ** or [sqlite3_value_bytes()], the behavior is not threadsafe.
5402 ** Hence, the sqlite3_column_value() interface
5403 ** is normally only useful within the implementation of
5404 ** [application-defined SQL functions] or [virtual tables], not within
5405 ** top-level application code.
5406 **
5407 ** The these routines may attempt to convert the datatype of the result.
5408 ** ^For example, if the internal representation is FLOAT and a text result
5409 ** is requested, [sqlite3_snprintf()] is used internally to perform the
5410 ** conversion automatically. ^(The following table details the conversions
5411 ** that are applied:
5412 **
5413 ** <blockquote>
@@ -5436,11 +5475,11 @@
5475 ** with calls to sqlite3_column_bytes().
5476 **
5477 ** ^The pointers returned are valid until a type conversion occurs as
5478 ** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
5479 ** [sqlite3_finalize()] is called. ^The memory space used to hold strings
5480 ** and BLOBs is freed automatically. Do not pass the pointers returned
5481 ** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
5482 ** [sqlite3_free()].
5483 **
5484 ** ^(If a memory allocation error occurs during the evaluation of any
5485 ** of these routines, a default value is returned. The default value
@@ -5447,19 +5486,19 @@
5486 ** is either the integer 0, the floating point number 0.0, or a NULL
5487 ** pointer. Subsequent calls to [sqlite3_errcode()] will return
5488 ** [SQLITE_NOMEM].)^
5489 */
5490 SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
 
 
5491 SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
5492 SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
5493 SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
5494 SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
5495 SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
 
5496 SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
5497 SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
5498 SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
5499 SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
5500
5501 /*
5502 ** CAPI3REF: Destroy A Prepared Statement Object
5503 ** DESTRUCTOR: sqlite3_stmt
5504 **
@@ -5689,25 +5728,43 @@
5728
5729 /*
5730 ** CAPI3REF: Obtaining SQL Values
5731 ** METHOD: sqlite3_value
5732 **
5733 ** <b>Summary:</b>
5734 ** <blockquote><table border=0 cellpadding=0 cellspacing=0>
5735 ** <tr><td><b>sqlite3_value_blob</b><td>&rarr;<td>BLOB value
5736 ** <tr><td><b>sqlite3_value_double</b><td>&rarr;<td>REAL value
5737 ** <tr><td><b>sqlite3_value_int</b><td>&rarr;<td>32-bit INTEGER value
5738 ** <tr><td><b>sqlite3_value_int64</b><td>&rarr;<td>64-bit INTEGER value
5739 ** <tr><td><b>sqlite3_value_text</b><td>&rarr;<td>UTF-8 TEXT value
5740 ** <tr><td><b>sqlite3_value_text16</b><td>&rarr;<td>UTF-16 TEXT value in
5741 ** the native byteorder
5742 ** <tr><td><b>sqlite3_value_text16be</b><td>&rarr;<td>UTF-16be TEXT value
5743 ** <tr><td><b>sqlite3_value_text16le</b><td>&rarr;<td>UTF-16le TEXT value
5744 ** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
5745 ** <tr><td><b>sqlite3_value_bytes</b><td>&rarr;<td>Size of a BLOB
5746 ** or a UTF-8 TEXT in bytes
5747 ** <tr><td><b>sqlite3_value_bytes16&nbsp;&nbsp;</b>
5748 ** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
5749 ** TEXT in bytes
5750 ** <tr><td><b>sqlite3_value_type</b><td>&rarr;<td>Default
5751 ** datatype of the value
5752 ** <tr><td><b>sqlite3_value_numeric_type&nbsp;&nbsp;</b>
5753 ** <td>&rarr;&nbsp;&nbsp;<td>Best numeric datatype of the value
5754 ** </table></blockquote>
5755 **
5756 ** <b>Details:</b>
5757 **
5758 ** This routine extract type, size, and content information from
5759 ** [protected sqlite3_value] objects. Protected sqlite3_value objects
5760 ** are used to pass parameter information into implementation of
5761 ** [application-defined SQL functions] and [virtual tables].
 
5762 **
5763 ** These routines work only with [protected sqlite3_value] objects.
5764 ** Any attempt to use these routines on an [unprotected sqlite3_value]
5765 ** is not threadsafe.
5766 **
5767 ** ^These routines work just like the corresponding [column access functions]
5768 ** except that these routines take a single [protected sqlite3_value] object
5769 ** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
5770 **
@@ -5714,10 +5771,21 @@
5771 ** ^The sqlite3_value_text16() interface extracts a UTF-16 string
5772 ** in the native byte-order of the host machine. ^The
5773 ** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
5774 ** extract UTF-16 strings as big-endian and little-endian respectively.
5775 **
5776 ** ^(The sqlite3_value_type(V) interface returns the
5777 ** [SQLITE_INTEGER | datatype code] for the initial datatype of the
5778 ** [sqlite3_value] object V. The returned value is one of [SQLITE_INTEGER],
5779 ** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].)^
5780 ** Other interfaces might change the datatype for an sqlite3_value object.
5781 ** For example, if the datatype is initially SQLITE_INTEGER and
5782 ** sqlite3_value_text(V) is called to extract a text value for that
5783 ** integer, then subsequent calls to sqlite3_value_type(V) might return
5784 ** SQLITE_TEXT. Whether or not a persistent internal datatype conversion
5785 ** occurs is undefined and may change from one release of SQLite to the next.
5786 **
5787 ** ^(The sqlite3_value_numeric_type() interface attempts to apply
5788 ** numeric affinity to the value. This means that an attempt is
5789 ** made to convert the value to an integer or floating point. If
5790 ** such a conversion is possible without loss of information (in other
5791 ** words, if the value is a string that looks like a number)
@@ -5732,19 +5800,19 @@
5800 **
5801 ** These routines must be called from the same thread as
5802 ** the SQL function that supplied the [sqlite3_value*] parameters.
5803 */
5804 SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
 
 
5805 SQLITE_API double sqlite3_value_double(sqlite3_value*);
5806 SQLITE_API int sqlite3_value_int(sqlite3_value*);
5807 SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
5808 SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
5809 SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
5810 SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
5811 SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
5812 SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
5813 SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
5814 SQLITE_API int sqlite3_value_type(sqlite3_value*);
5815 SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
5816
5817 /*
5818 ** CAPI3REF: Finding The Subtype Of SQL Values
@@ -15143,10 +15211,11 @@
15211 #define SQLITE_OrderByIdxJoin 0x0080 /* ORDER BY of joins via index */
15212 #define SQLITE_SubqCoroutine 0x0100 /* Evaluate subqueries as coroutines */
15213 #define SQLITE_Transitive 0x0200 /* Transitive constraints */
15214 #define SQLITE_OmitNoopJoin 0x0400 /* Omit unused tables in joins */
15215 #define SQLITE_Stat34 0x0800 /* Use STAT3 or STAT4 data */
15216 #define SQLITE_CountOfView 0x1000 /* The count-of-view optimization */
15217 #define SQLITE_CursorHints 0x2000 /* Add OP_CursorHint opcodes */
15218 #define SQLITE_AllOpts 0xffff /* All optimizations */
15219
15220 /*
15221 ** Macros for testing whether or not optimizations are enabled or disabled.
@@ -16005,11 +16074,11 @@
16074 /*
16075 ** The following are the meanings of bits in the Expr.flags field.
16076 */
16077 #define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */
16078 #define EP_Agg 0x000002 /* Contains one or more aggregate functions */
16079 /* 0x000004 // available for use */
16080 /* 0x000008 // available for use */
16081 #define EP_Distinct 0x000010 /* Aggregate function with DISTINCT keyword */
16082 #define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */
16083 #define EP_DblQuoted 0x000040 /* token.z was originally in "..." */
16084 #define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */
@@ -17437,12 +17506,11 @@
17506 #endif
17507 SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3*,int);
17508 SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse*, int);
17509 SQLITE_PRIVATE void sqlite3CodeVerifyNamedSchema(Parse*, const char *zDb);
17510 SQLITE_PRIVATE void sqlite3BeginTransaction(Parse*, int);
17511 SQLITE_PRIVATE void sqlite3EndTransaction(Parse*,int);
 
17512 SQLITE_PRIVATE void sqlite3Savepoint(Parse*, int, Token*);
17513 SQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *);
17514 SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3*);
17515 SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*);
17516 SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*);
@@ -17559,11 +17627,13 @@
17627 SQLITE_PRIVATE int sqlite3FixExprList(DbFixer*, ExprList*);
17628 SQLITE_PRIVATE int sqlite3FixTriggerStep(DbFixer*, TriggerStep*);
17629 SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8);
17630 SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*);
17631 SQLITE_PRIVATE int sqlite3Atoi(const char*);
17632 #ifndef SQLITE_OMIT_UTF16
17633 SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar);
17634 #endif
17635 SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);
17636 SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**);
17637 SQLITE_PRIVATE LogEst sqlite3LogEst(u64);
17638 SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst,LogEst);
17639 #ifndef SQLITE_OMIT_VIRTUALTABLE
@@ -17648,11 +17718,13 @@
17718 SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
17719 void(*)(void*));
17720 SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value*);
17721 SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*);
17722 SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *);
17723 #ifndef SQLITE_OMIT_UTF16
17724 SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8);
17725 #endif
17726 SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
17727 SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
17728 #ifndef SQLITE_AMALGAMATION
17729 SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[];
17730 SQLITE_PRIVATE const char sqlite3StrBINARY[];
@@ -18012,11 +18084,13 @@
18084 SQLITE_PRIVATE int sqlite3ExprIsVector(Expr *pExpr);
18085 SQLITE_PRIVATE Expr *sqlite3VectorFieldSubexpr(Expr*, int);
18086 SQLITE_PRIVATE Expr *sqlite3ExprForVectorField(Parse*,Expr*,int);
18087 SQLITE_PRIVATE void sqlite3VectorErrorMsg(Parse*, Expr*);
18088
18089 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
18090 SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt);
18091 #endif
18092
18093 #endif /* SQLITEINT_H */
18094
18095 /************** End of sqliteInt.h *******************************************/
18096 /************** Begin file global.c ******************************************/
@@ -18873,16 +18947,18 @@
18947 SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *, int);
18948 #else
18949 # define sqlite3VdbeCheckFk(p,i) 0
18950 #endif
18951
 
18952 #ifdef SQLITE_DEBUG
18953 SQLITE_PRIVATE void sqlite3VdbePrintSql(Vdbe*);
18954 SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf);
18955 #endif
18956 #ifndef SQLITE_OMIT_UTF16
18957 SQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem*, u8);
18958 SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem);
18959 #endif
18960
18961 #ifndef SQLITE_OMIT_INCRBLOB
18962 SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *);
18963 #define ExpandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0)
18964 #else
@@ -26962,21 +27038,21 @@
27038 }
27039 break;
27040 }
27041 #ifndef SQLITE_OMIT_SUBQUERY
27042 case TK_EXISTS: {
27043 sqlite3TreeViewLine(pView, "EXISTS-expr flags=0x%x", pExpr->flags);
27044 sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
27045 break;
27046 }
27047 case TK_SELECT: {
27048 sqlite3TreeViewLine(pView, "SELECT-expr flags=0x%x", pExpr->flags);
27049 sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
27050 break;
27051 }
27052 case TK_IN: {
27053 sqlite3TreeViewLine(pView, "IN flags=0x%x", pExpr->flags);
27054 sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
27055 if( ExprHasProperty(pExpr, EP_xIsSelect) ){
27056 sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
27057 }else{
27058 sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0);
@@ -27860,11 +27936,13 @@
27936 fprintf(stderr, "OUTPUT: %s\n", zBuf);
27937 }
27938 #endif
27939 return SQLITE_OK;
27940 }
27941 #endif /* SQLITE_OMIT_UTF16 */
27942
27943 #ifndef SQLITE_OMIT_UTF16
27944 /*
27945 ** This routine checks for a byte-order mark at the beginning of the
27946 ** UTF-16 string stored in *pMem. If one is present, it is removed and
27947 ** the encoding of the Mem adjusted. This routine does not do any
27948 ** byte-swapping, it just sets Mem.enc appropriately.
@@ -29771,21 +29849,23 @@
29849 }
29850 return 1;
29851 }
29852
29853 /* This function (for internal use only) locates an element in an
29854 ** hash table that matches the given key. If no element is found,
29855 ** a pointer to a static null element with HashElem.data==0 is returned.
29856 ** If pH is not NULL, then the hash for this key is written to *pH.
29857 */
29858 static HashElem *findElementWithHash(
29859 const Hash *pH, /* The pH to be searched */
29860 const char *pKey, /* The key we are searching for */
29861 unsigned int *pHash /* Write the hash value here */
29862 ){
29863 HashElem *elem; /* Used to loop thru the element list */
29864 int count; /* Number of elements left to test */
29865 unsigned int h; /* The computed hash */
29866 static HashElem nullElement = { 0, 0, 0, 0 };
29867
29868 if( pH->ht ){ /*OPTIMIZATION-IF-TRUE*/
29869 struct _ht *pEntry;
29870 h = strHash(pKey) % pH->htsize;
29871 pEntry = &pH->ht[h];
@@ -29794,19 +29874,19 @@
29874 }else{
29875 h = 0;
29876 elem = pH->first;
29877 count = pH->count;
29878 }
29879 if( pHash ) *pHash = h;
29880 while( count-- ){
29881 assert( elem!=0 );
29882 if( sqlite3StrICmp(elem->pKey,pKey)==0 ){
29883 return elem;
29884 }
29885 elem = elem->next;
29886 }
29887 return &nullElement;
29888 }
29889
29890 /* Remove a single entry from the hash table given a pointer to that
29891 ** element and a hash on the element's key.
29892 */
@@ -29844,17 +29924,13 @@
29924 /* Attempt to locate an element of the hash table pH with a key
29925 ** that matches pKey. Return the data for this element if it is
29926 ** found, or NULL if there is no match.
29927 */
29928 SQLITE_PRIVATE void *sqlite3HashFind(const Hash *pH, const char *pKey){
 
 
 
29929 assert( pH!=0 );
29930 assert( pKey!=0 );
29931 return findElementWithHash(pH, pKey, 0)->data;
 
29932 }
29933
29934 /* Insert an element into the hash table pH. The key is pKey
29935 ** and the data is "data".
29936 **
@@ -29875,11 +29951,11 @@
29951 HashElem *new_elem; /* New element added to the pH */
29952
29953 assert( pH!=0 );
29954 assert( pKey!=0 );
29955 elem = findElementWithHash(pH,pKey,&h);
29956 if( elem->data ){
29957 void *old_data = elem->data;
29958 if( data==0 ){
29959 removeElementGivenHash(pH,elem,h);
29960 }else{
29961 elem->data = data;
@@ -58883,14 +58959,16 @@
58959 ** Allowed values for BtShared.btsFlags
58960 */
58961 #define BTS_READ_ONLY 0x0001 /* Underlying file is readonly */
58962 #define BTS_PAGESIZE_FIXED 0x0002 /* Page size can no longer be changed */
58963 #define BTS_SECURE_DELETE 0x0004 /* PRAGMA secure_delete is enabled */
58964 #define BTS_OVERWRITE 0x0008 /* Overwrite deleted content with zeros */
58965 #define BTS_FAST_SECURE 0x000c /* Combination of the previous two */
58966 #define BTS_INITIALLY_EMPTY 0x0010 /* Database was empty at trans start */
58967 #define BTS_NO_WAL 0x0020 /* Do not open write-ahead-log files */
58968 #define BTS_EXCLUSIVE 0x0040 /* pWriter has an exclusive lock */
58969 #define BTS_PENDING 0x0080 /* Waiting for read-locks to clear */
58970
58971 /*
58972 ** An instance of the following structure is used to hold information
58973 ** about a cell. The parseCellPtr() function fills in this structure
58974 ** based on information extract from the raw disk page.
@@ -61072,11 +61150,11 @@
61150 assert( iSize>=4 ); /* Minimum cell size is 4 */
61151 assert( iStart<=iLast );
61152
61153 /* Overwrite deleted information with zeros when the secure_delete
61154 ** option is enabled */
61155 if( pPage->pBt->btsFlags & BTS_FAST_SECURE ){
61156 memset(&data[iStart], 0, iSize);
61157 }
61158
61159 /* The list of freeblocks must be in ascending order. Find the
61160 ** spot on the list where iStart should be inserted.
@@ -61363,11 +61441,11 @@
61441 assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno );
61442 assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage );
61443 assert( sqlite3PagerGetData(pPage->pDbPage) == data );
61444 assert( sqlite3PagerIswriteable(pPage->pDbPage) );
61445 assert( sqlite3_mutex_held(pBt->mutex) );
61446 if( pBt->btsFlags & BTS_FAST_SECURE ){
61447 memset(&data[hdr], 0, pBt->usableSize - hdr);
61448 }
61449 data[hdr] = (char)flags;
61450 first = hdr + ((flags&PTF_LEAF)==0 ? 12 : 8);
61451 memset(&data[hdr+1], 0, 4);
@@ -61786,12 +61864,14 @@
61864 p->pBt = pBt;
61865
61866 pBt->pCursor = 0;
61867 pBt->pPage1 = 0;
61868 if( sqlite3PagerIsreadonly(pBt->pPager) ) pBt->btsFlags |= BTS_READ_ONLY;
61869 #if defined(SQLITE_SECURE_DELETE)
61870 pBt->btsFlags |= BTS_SECURE_DELETE;
61871 #elif defined(SQLITE_FAST_SECURE_DELETE)
61872 pBt->btsFlags |= BTS_OVERWRITE;
61873 #endif
61874 /* EVIDENCE-OF: R-51873-39618 The page size for a database file is
61875 ** determined by the 2-byte integer located at an offset of 16 bytes from
61876 ** the beginning of the database file. */
61877 pBt->pageSize = (zDbHeader[16]<<8) | (zDbHeader[17]<<16);
@@ -62235,23 +62315,38 @@
62315 sqlite3BtreeLeave(p);
62316 return n;
62317 }
62318
62319 /*
62320 ** Change the values for the BTS_SECURE_DELETE and BTS_OVERWRITE flags:
62321 **
62322 ** newFlag==0 Both BTS_SECURE_DELETE and BTS_OVERWRITE are cleared
62323 ** newFlag==1 BTS_SECURE_DELETE set and BTS_OVERWRITE is cleared
62324 ** newFlag==2 BTS_SECURE_DELETE cleared and BTS_OVERWRITE is set
62325 ** newFlag==(-1) No changes
62326 **
62327 ** This routine acts as a query if newFlag is less than zero
62328 **
62329 ** With BTS_OVERWRITE set, deleted content is overwritten by zeros, but
62330 ** freelist leaf pages are not written back to the database. Thus in-page
62331 ** deleted content is cleared, but freelist deleted content is not.
62332 **
62333 ** With BTS_SECURE_DELETE, operation is like BTS_OVERWRITE with the addition
62334 ** that freelist leaf pages are written back into the database, increasing
62335 ** the amount of disk I/O.
62336 */
62337 SQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree *p, int newFlag){
62338 int b;
62339 if( p==0 ) return 0;
62340 sqlite3BtreeEnter(p);
62341 assert( BTS_OVERWRITE==BTS_SECURE_DELETE*2 );
62342 assert( BTS_FAST_SECURE==(BTS_OVERWRITE|BTS_SECURE_DELETE) );
62343 if( newFlag>=0 ){
62344 p->pBt->btsFlags &= ~BTS_FAST_SECURE;
62345 p->pBt->btsFlags |= BTS_SECURE_DELETE*newFlag;
62346 }
62347 b = (p->pBt->btsFlags & BTS_FAST_SECURE)/BTS_SECURE_DELETE;
62348 sqlite3BtreeLeave(p);
62349 return b;
62350 }
62351
62352 /*
@@ -64864,23 +64959,23 @@
64959 ** for the common case of merely incrementing the cell counter BtCursor.aiIdx
64960 ** to the next cell on the current page. The (slower) btreeNext() helper
64961 ** routine is called when it is necessary to move to a different page or
64962 ** to restore the cursor.
64963 **
64964 ** If bit 0x01 of the F argument in sqlite3BtreeNext(C,F) is 1, then the
64965 ** cursor corresponds to an SQL index and this routine could have been
64966 ** skipped if the SQL index had been a unique index. The F argument
64967 ** is a hint to the implement. SQLite btree implementation does not use
64968 ** this hint, but COMDB2 does.
64969 */
64970 static SQLITE_NOINLINE int btreeNext(BtCursor *pCur){
64971 int rc;
64972 int idx;
64973 MemPage *pPage;
64974
64975 assert( cursorOwnsBtShared(pCur) );
64976 assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
 
64977 if( pCur->eState!=CURSOR_VALID ){
64978 assert( (pCur->curFlags & BTCF_ValidOvfl)==0 );
64979 rc = restoreCursorPosition(pCur);
64980 if( rc!=SQLITE_OK ){
64981 return rc;
@@ -64923,11 +65018,11 @@
65018 }
65019 moveToParent(pCur);
65020 pPage = pCur->apPage[pCur->iPage];
65021 }while( pCur->ix>=pPage->nCell );
65022 if( pPage->intKey ){
65023 return sqlite3BtreeNext(pCur, 0);
65024 }else{
65025 return SQLITE_OK;
65026 }
65027 }
65028 if( pPage->leaf ){
@@ -64936,20 +65031,21 @@
65031 return moveToLeftmost(pCur);
65032 }
65033 }
65034 SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor *pCur, int flags){
65035 MemPage *pPage;
65036 UNUSED_PARAMETER( flags ); /* Used in COMDB2 but not native SQLite */
65037 assert( cursorOwnsBtShared(pCur) );
65038 assert( flags==0 || flags==1 );
65039 assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
65040 pCur->info.nSize = 0;
65041 pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
65042 if( pCur->eState!=CURSOR_VALID ) return btreeNext(pCur);
65043 pPage = pCur->apPage[pCur->iPage];
65044 if( (++pCur->ix)>=pPage->nCell ){
65045 pCur->ix--;
65046 return btreeNext(pCur);
65047 }
65048 if( pPage->leaf ){
65049 return SQLITE_OK;
65050 }else{
65051 return moveToLeftmost(pCur);
@@ -64968,22 +65064,21 @@
65064 ** for the common case of merely decrementing the cell counter BtCursor.aiIdx
65065 ** to the previous cell on the current page. The (slower) btreePrevious()
65066 ** helper routine is called when it is necessary to move to a different page
65067 ** or to restore the cursor.
65068 **
65069 ** If bit 0x01 of the F argument to sqlite3BtreePrevious(C,F) is 1, then
65070 ** the cursor corresponds to an SQL index and this routine could have been
65071 ** skipped if the SQL index had been a unique index. The F argument is a
65072 ** hint to the implement. The native SQLite btree implementation does not
65073 ** use this hint, but COMDB2 does.
65074 */
65075 static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur){
65076 int rc;
65077 MemPage *pPage;
65078
65079 assert( cursorOwnsBtShared(pCur) );
 
65080 assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
65081 assert( (pCur->curFlags & (BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey))==0 );
65082 assert( pCur->info.nSize==0 );
65083 if( pCur->eState!=CURSOR_VALID ){
65084 rc = restoreCursorPosition(pCur);
@@ -65023,11 +65118,11 @@
65118 assert( (pCur->curFlags & (BTCF_ValidOvfl))==0 );
65119
65120 pCur->ix--;
65121 pPage = pCur->apPage[pCur->iPage];
65122 if( pPage->intKey && !pPage->leaf ){
65123 rc = sqlite3BtreePrevious(pCur, 0);
65124 }else{
65125 rc = SQLITE_OK;
65126 }
65127 }
65128 return rc;
@@ -65034,17 +65129,18 @@
65129 }
65130 SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor *pCur, int flags){
65131 assert( cursorOwnsBtShared(pCur) );
65132 assert( flags==0 || flags==1 );
65133 assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
65134 UNUSED_PARAMETER( flags ); /* Used in COMDB2 but not native SQLite */
65135 pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey);
65136 pCur->info.nSize = 0;
65137 if( pCur->eState!=CURSOR_VALID
65138 || pCur->ix==0
65139 || pCur->apPage[pCur->iPage]->leaf==0
65140 ){
65141 return btreePrevious(pCur);
65142 }
65143 pCur->ix--;
65144 return SQLITE_OK;
65145 }
65146
@@ -66642,11 +66738,11 @@
66738 ** But not if we are in secure-delete mode. In secure-delete mode,
66739 ** the dropCell() routine will overwrite the entire cell with zeroes.
66740 ** In this case, temporarily copy the cell into the aOvflSpace[]
66741 ** buffer. It will be copied out again as soon as the aSpace[] buffer
66742 ** is allocated. */
66743 if( pBt->btsFlags & BTS_FAST_SECURE ){
66744 int iOff;
66745
66746 iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData);
66747 if( (iOff+szNew[i])>(int)pBt->usableSize ){
66748 rc = SQLITE_CORRUPT_BKPT;
@@ -72056,25 +72152,31 @@
72152 ** constants. The registers begin with iDest and increase consecutively.
72153 ** One register is initialized for each characgter in zTypes[]. For each
72154 ** "s" character in zTypes[], the register is a string if the argument is
72155 ** not NULL, or OP_Null if the value is a null pointer. For each "i" character
72156 ** in zTypes[], the register is initialized to an integer.
72157 **
72158 ** If the input string does not end with "X" then an OP_ResultRow instruction
72159 ** is generated for the values inserted.
72160 */
72161 SQLITE_PRIVATE void sqlite3VdbeMultiLoad(Vdbe *p, int iDest, const char *zTypes, ...){
72162 va_list ap;
72163 int i;
72164 char c;
72165 va_start(ap, zTypes);
72166 for(i=0; (c = zTypes[i])!=0; i++){
72167 if( c=='s' ){
72168 const char *z = va_arg(ap, const char*);
72169 sqlite3VdbeAddOp4(p, z==0 ? OP_Null : OP_String8, 0, iDest+i, 0, z, 0);
72170 }else if( c=='i' ){
72171 sqlite3VdbeAddOp2(p, OP_Integer, va_arg(ap, int), iDest+i);
72172 }else{
72173 goto skip_op_resultrow;
 
72174 }
72175 }
72176 sqlite3VdbeAddOp2(p, OP_ResultRow, iDest, i);
72177 skip_op_resultrow:
72178 va_end(ap);
72179 }
72180
72181 /*
72182 ** Add an opcode that includes the p4 value as a pointer.
@@ -89667,19 +89769,21 @@
89769 static SQLITE_NOINLINE int walkExpr(Walker *pWalker, Expr *pExpr){
89770 int rc;
89771 testcase( ExprHasProperty(pExpr, EP_TokenOnly) );
89772 testcase( ExprHasProperty(pExpr, EP_Reduced) );
89773 rc = pWalker->xExprCallback(pWalker, pExpr);
89774 if( rc ) return rc & WRC_Abort;
89775 if( !ExprHasProperty(pExpr,(EP_TokenOnly|EP_Leaf)) ){
89776 if( pExpr->pLeft && walkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;
89777 assert( pExpr->x.pList==0 || pExpr->pRight==0 );
89778 if( pExpr->pRight ){
89779 if( walkExpr(pWalker, pExpr->pRight) ) return WRC_Abort;
89780 }else if( ExprHasProperty(pExpr, EP_xIsSelect) ){
89781 if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort;
89782 }else if( pExpr->x.pList ){
89783 if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;
89784 }
89785 }
89786 return WRC_Continue;
89787 }
89788 SQLITE_PRIVATE int sqlite3WalkExpr(Walker *pWalker, Expr *pExpr){
89789 return pExpr ? walkExpr(pWalker,pExpr) : WRC_Continue;
@@ -89730,11 +89834,11 @@
89834 struct SrcList_item *pItem;
89835
89836 pSrc = p->pSrc;
89837 if( ALWAYS(pSrc) ){
89838 for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){
89839 if( pItem->pSelect && sqlite3WalkSelect(pWalker, pItem->pSelect) ){
89840 return WRC_Abort;
89841 }
89842 if( pItem->fg.isTabFunc
89843 && sqlite3WalkExprList(pWalker, pItem->u1.pFuncArg)
89844 ){
@@ -89762,11 +89866,12 @@
89866 ** If the Walker does not have an xSelectCallback() then this routine
89867 ** is a no-op returning WRC_Continue.
89868 */
89869 SQLITE_PRIVATE int sqlite3WalkSelect(Walker *pWalker, Select *p){
89870 int rc;
89871 if( p==0 ) return WRC_Continue;
89872 if( pWalker->xSelectCallback==0 ) return WRC_Continue;
89873 do{
89874 rc = pWalker->xSelectCallback(pWalker, p);
89875 if( rc ) return rc & WRC_Abort;
89876 if( sqlite3WalkSelectExpr(pWalker, p)
89877 || sqlite3WalkSelectFrom(pWalker, p)
@@ -90261,10 +90366,11 @@
90366 sqlite3ExprDelete(db, pExpr->pLeft);
90367 pExpr->pLeft = 0;
90368 sqlite3ExprDelete(db, pExpr->pRight);
90369 pExpr->pRight = 0;
90370 pExpr->op = (isTrigger ? TK_TRIGGER : TK_COLUMN);
90371 ExprSetProperty(pExpr, EP_Leaf);
90372 lookupname_end:
90373 if( cnt==1 ){
90374 assert( pNC!=0 );
90375 if( !ExprHasProperty(pExpr, EP_Alias) ){
90376 sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
@@ -90299,11 +90405,10 @@
90405 p->iColumn = (ynVar)iCol;
90406 testcase( iCol==BMS );
90407 testcase( iCol==BMS-1 );
90408 pItem->colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol);
90409 }
 
90410 }
90411 return p;
90412 }
90413
90414 /*
@@ -90359,12 +90464,10 @@
90464 pNC = pWalker->u.pNC;
90465 assert( pNC!=0 );
90466 pParse = pNC->pParse;
90467 assert( pParse==pWalker->pParse );
90468
 
 
90469 #ifndef NDEBUG
90470 if( pNC->pSrcList && pNC->pSrcList->nAlloc>0 ){
90471 SrcList *pSrcList = pNC->pSrcList;
90472 int i;
90473 for(i=0; i<pNC->pSrcList->nSrc; i++){
@@ -92067,11 +92170,11 @@
92170 memset(pNew, 0, sizeof(Expr));
92171 pNew->op = (u8)op;
92172 pNew->iAgg = -1;
92173 if( pToken ){
92174 if( nExtra==0 ){
92175 pNew->flags |= EP_IntValue|EP_Leaf;
92176 pNew->u.iValue = iValue;
92177 }else{
92178 pNew->u.zToken = (char*)&pNew[1];
92179 assert( pToken->z!=0 || pToken->n==0 );
92180 if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
@@ -92348,12 +92451,13 @@
92451 #endif
92452 if( !ExprHasProperty(p, (EP_TokenOnly|EP_Leaf)) ){
92453 /* The Expr.x union is never used at the same time as Expr.pRight */
92454 assert( p->x.pList==0 || p->pRight==0 );
92455 if( p->pLeft && p->op!=TK_SELECT_COLUMN ) sqlite3ExprDeleteNN(db, p->pLeft);
92456 if( p->pRight ){
92457 sqlite3ExprDeleteNN(db, p->pRight);
92458 }else if( ExprHasProperty(p, EP_xIsSelect) ){
92459 sqlite3SelectDelete(db, p->x.pSelect);
92460 }else{
92461 sqlite3ExprListDelete(db, p->x.pList);
92462 }
92463 }
@@ -103955,16 +104059,16 @@
104059 pItem = &pList->a[pList->nSrc-1];
104060 if( pDatabase && pDatabase->z==0 ){
104061 pDatabase = 0;
104062 }
104063 if( pDatabase ){
104064 pItem->zName = sqlite3NameFromToken(db, pDatabase);
104065 pItem->zDatabase = sqlite3NameFromToken(db, pTable);
104066 }else{
104067 pItem->zName = sqlite3NameFromToken(db, pTable);
104068 pItem->zDatabase = 0;
104069 }
 
 
104070 return pList;
104071 }
104072
104073 /*
104074 ** Assign VdbeCursor index numbers to all tables in a SrcList
@@ -104149,40 +104253,29 @@
104253 }
104254 sqlite3VdbeAddOp0(v, OP_AutoCommit);
104255 }
104256
104257 /*
104258 ** Generate VDBE code for a COMMIT or ROLLBACK statement.
104259 ** Code for ROLLBACK is generated if eType==TK_ROLLBACK. Otherwise
104260 ** code is generated for a COMMIT.
104261 */
104262 SQLITE_PRIVATE void sqlite3EndTransaction(Parse *pParse, int eType){
104263 Vdbe *v;
104264 int isRollback;
104265
104266 assert( pParse!=0 );
104267 assert( pParse->db!=0 );
104268 assert( eType==TK_COMMIT || eType==TK_END || eType==TK_ROLLBACK );
104269 isRollback = eType==TK_ROLLBACK;
104270 if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION,
104271 isRollback ? "ROLLBACK" : "COMMIT", 0, 0) ){
104272 return;
104273 }
104274 v = sqlite3GetVdbe(pParse);
104275 if( v ){
104276 sqlite3VdbeAddOp2(v, OP_AutoCommit, 1, isRollback);
 
 
 
 
 
 
 
 
 
 
 
104277 }
104278 }
104279
104280 /*
104281 ** This function is called by the parser when it parses a command to create,
@@ -104759,11 +104852,11 @@
104852 ** request a definition of the collating sequence. If this doesn't work,
104853 ** an equivalent collating sequence that uses a text encoding different
104854 ** from the main database is substituted, if one is available.
104855 */
104856 SQLITE_PRIVATE int sqlite3CheckCollSeq(Parse *pParse, CollSeq *pColl){
104857 if( pColl && pColl->xCmp==0 ){
104858 const char *zName = pColl->zName;
104859 sqlite3 *db = pParse->db;
104860 CollSeq *p = sqlite3GetCollSeq(pParse, ENC(db), pColl, zName);
104861 if( !p ){
104862 return SQLITE_ERROR;
@@ -104795,22 +104888,21 @@
104888 ){
104889 CollSeq *pColl;
104890 pColl = sqlite3HashFind(&db->aCollSeq, zName);
104891
104892 if( 0==pColl && create ){
104893 int nName = sqlite3Strlen30(zName) + 1;
104894 pColl = sqlite3DbMallocZero(db, 3*sizeof(*pColl) + nName);
104895 if( pColl ){
104896 CollSeq *pDel = 0;
104897 pColl[0].zName = (char*)&pColl[3];
104898 pColl[0].enc = SQLITE_UTF8;
104899 pColl[1].zName = (char*)&pColl[3];
104900 pColl[1].enc = SQLITE_UTF16LE;
104901 pColl[2].zName = (char*)&pColl[3];
104902 pColl[2].enc = SQLITE_UTF16BE;
104903 memcpy(pColl[0].zName, zName, nName);
 
104904 pDel = sqlite3HashInsert(&db->aCollSeq, pColl[0].zName, pColl);
104905
104906 /* If a malloc() failure occurred in sqlite3HashInsert(), it will
104907 ** return the pColl pointer to be deleted (because it wasn't added
104908 ** to the hash table).
@@ -104946,11 +105038,12 @@
105038 int i;
105039 for(i=0; i<nDef; i++){
105040 FuncDef *pOther;
105041 const char *zName = aDef[i].zName;
105042 int nName = sqlite3Strlen30(zName);
105043 int h = (zName[0] + nName) % SQLITE_FUNC_HASH_SZ;
105044 assert( zName[0]>='a' && zName[0]<='z' );
105045 pOther = functionSearch(h, zName);
105046 if( pOther ){
105047 assert( pOther!=&aDef[i] && pOther->pNext!=&aDef[i] );
105048 aDef[i].pNext = pOther->pNext;
105049 pOther->pNext = &aDef[i];
@@ -106109,20 +106202,20 @@
106202 static void typeofFunc(
106203 sqlite3_context *context,
106204 int NotUsed,
106205 sqlite3_value **argv
106206 ){
106207 static const char *azType[] = { "integer", "real", "text", "blob", "null" };
106208 int i = sqlite3_value_type(argv[0]) - 1;
106209 UNUSED_PARAMETER(NotUsed);
106210 assert( i>=0 && i<ArraySize(azType) );
106211 assert( SQLITE_INTEGER==1 );
106212 assert( SQLITE_FLOAT==2 );
106213 assert( SQLITE_TEXT==3 );
106214 assert( SQLITE_BLOB==4 );
106215 assert( SQLITE_NULL==5 );
106216 sqlite3_result_text(context, azType[i], -1, SQLITE_STATIC);
 
106217 }
106218
106219
106220 /*
106221 ** Implementation of the length() function
@@ -112042,10 +112135,15 @@
112135 /* Version 3.14.0 and later */
112136 int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*);
112137 char *(*expanded_sql)(sqlite3_stmt*);
112138 /* Version 3.18.0 and later */
112139 void (*set_last_insert_rowid)(sqlite3*,sqlite3_int64);
112140 /* Version 3.20.0 and later */
112141 int (*prepare_v3)(sqlite3*,const char*,int,unsigned int,
112142 sqlite3_stmt**,const char**);
112143 int (*prepare16_v3)(sqlite3*,const void*,int,unsigned int,
112144 sqlite3_stmt**,const void**);
112145 };
112146
112147 /*
112148 ** This is the function signature used for all extension entry points. It
112149 ** is also defined in the file "loadext.c".
@@ -112302,10 +112400,13 @@
112400 /* Version 3.14.0 and later */
112401 #define sqlite3_trace_v2 sqlite3_api->trace_v2
112402 #define sqlite3_expanded_sql sqlite3_api->expanded_sql
112403 /* Version 3.18.0 and later */
112404 #define sqlite3_set_last_insert_rowid sqlite3_api->set_last_insert_rowid
112405 /* Version 3.20.0 and later */
112406 #define sqlite3_prepare_v3 sqlite3_api->prepare_v3
112407 #define sqlite3_prepare16_v3 sqlite3_api->prepare16_v3
112408 #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
112409
112410 #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
112411 /* This case when the file really is being compiled as a loadable
112412 ** extension */
@@ -112357,10 +112458,11 @@
112458 # define sqlite3_create_function16 0
112459 # define sqlite3_errmsg16 0
112460 # define sqlite3_open16 0
112461 # define sqlite3_prepare16 0
112462 # define sqlite3_prepare16_v2 0
112463 # define sqlite3_prepare16_v3 0
112464 # define sqlite3_result_error16 0
112465 # define sqlite3_result_text16 0
112466 # define sqlite3_result_text16be 0
112467 # define sqlite3_result_text16le 0
112468 # define sqlite3_value_text16 0
@@ -112729,11 +112831,14 @@
112831 sqlite3_system_errno,
112832 /* Version 3.14.0 and later */
112833 sqlite3_trace_v2,
112834 sqlite3_expanded_sql,
112835 /* Version 3.18.0 and later */
112836 sqlite3_set_last_insert_rowid,
112837 /* Version 3.20.0 and later */
112838 sqlite3_prepare_v3,
112839 sqlite3_prepare16_v3
112840 };
112841
112842 /*
112843 ** Attempt to load an SQLite extension library contained in the file
112844 ** zFile. The entry point is zProc. zProc may be 0 in which case a
@@ -113151,39 +113256,42 @@
113256 #define PragTyp_DATABASE_LIST 10
113257 #define PragTyp_DEFAULT_CACHE_SIZE 11
113258 #define PragTyp_ENCODING 12
113259 #define PragTyp_FOREIGN_KEY_CHECK 13
113260 #define PragTyp_FOREIGN_KEY_LIST 14
113261 #define PragTyp_FUNCTION_LIST 15
113262 #define PragTyp_INCREMENTAL_VACUUM 16
113263 #define PragTyp_INDEX_INFO 17
113264 #define PragTyp_INDEX_LIST 18
113265 #define PragTyp_INTEGRITY_CHECK 19
113266 #define PragTyp_JOURNAL_MODE 20
113267 #define PragTyp_JOURNAL_SIZE_LIMIT 21
113268 #define PragTyp_LOCK_PROXY_FILE 22
113269 #define PragTyp_LOCKING_MODE 23
113270 #define PragTyp_PAGE_COUNT 24
113271 #define PragTyp_MMAP_SIZE 25
113272 #define PragTyp_MODULE_LIST 26
113273 #define PragTyp_OPTIMIZE 27
113274 #define PragTyp_PAGE_SIZE 28
113275 #define PragTyp_PRAGMA_LIST 29
113276 #define PragTyp_SECURE_DELETE 30
113277 #define PragTyp_SHRINK_MEMORY 31
113278 #define PragTyp_SOFT_HEAP_LIMIT 32
113279 #define PragTyp_SYNCHRONOUS 33
113280 #define PragTyp_TABLE_INFO 34
113281 #define PragTyp_TEMP_STORE 35
113282 #define PragTyp_TEMP_STORE_DIRECTORY 36
113283 #define PragTyp_THREADS 37
113284 #define PragTyp_WAL_AUTOCHECKPOINT 38
113285 #define PragTyp_WAL_CHECKPOINT 39
113286 #define PragTyp_ACTIVATE_EXTENSIONS 40
113287 #define PragTyp_HEXKEY 41
113288 #define PragTyp_KEY 42
113289 #define PragTyp_REKEY 43
113290 #define PragTyp_LOCK_STATUS 44
113291 #define PragTyp_PARSER_TRACE 45
113292 #define PragTyp_STATS 46
113293
113294 /* Property flags associated with various pragma. */
113295 #define PragFlg_NeedSchema 0x01 /* Force schema load before running */
113296 #define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */
113297 #define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */
@@ -113225,30 +113333,33 @@
113333 /* 24 */ "origin",
113334 /* 25 */ "partial",
113335 /* 26 */ "seq", /* Used by: database_list */
113336 /* 27 */ "name",
113337 /* 28 */ "file",
113338 /* 29 */ "name", /* Used by: function_list */
113339 /* 30 */ "builtin",
113340 /* 31 */ "name", /* Used by: module_list pragma_list */
113341 /* 32 */ "seq", /* Used by: collation_list */
113342 /* 33 */ "name",
113343 /* 34 */ "id", /* Used by: foreign_key_list */
113344 /* 35 */ "seq",
113345 /* 36 */ "table",
113346 /* 37 */ "from",
113347 /* 38 */ "to",
113348 /* 39 */ "on_update",
113349 /* 40 */ "on_delete",
113350 /* 41 */ "match",
113351 /* 42 */ "table", /* Used by: foreign_key_check */
113352 /* 43 */ "rowid",
113353 /* 44 */ "parent",
113354 /* 45 */ "fkid",
113355 /* 46 */ "busy", /* Used by: wal_checkpoint */
113356 /* 47 */ "log",
113357 /* 48 */ "checkpointed",
113358 /* 49 */ "timeout", /* Used by: busy_timeout */
113359 /* 50 */ "database", /* Used by: lock_status */
113360 /* 51 */ "status",
113361 };
113362
113363 /* Definitions of all built-in pragmas */
113364 typedef struct PragmaName {
113365 const char *const zName; /* Name of pragma */
@@ -113290,11 +113401,11 @@
113401 #endif
113402 #endif
113403 {/* zName: */ "busy_timeout",
113404 /* ePragTyp: */ PragTyp_BUSY_TIMEOUT,
113405 /* ePragFlg: */ PragFlg_Result0,
113406 /* ColNames: */ 49, 1,
113407 /* iArg: */ 0 },
113408 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
113409 {/* zName: */ "cache_size",
113410 /* ePragTyp: */ PragTyp_CACHE_SIZE,
113411 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1,
@@ -113327,11 +113438,11 @@
113438 #endif
113439 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
113440 {/* zName: */ "collation_list",
113441 /* ePragTyp: */ PragTyp_COLLATION_LIST,
113442 /* ePragFlg: */ PragFlg_Result0,
113443 /* ColNames: */ 32, 2,
113444 /* iArg: */ 0 },
113445 #endif
113446 #if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
113447 {/* zName: */ "compile_options",
113448 /* ePragTyp: */ PragTyp_COMPILE_OPTIONS,
@@ -113399,18 +113510,18 @@
113510 #endif
113511 #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
113512 {/* zName: */ "foreign_key_check",
113513 /* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK,
113514 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0,
113515 /* ColNames: */ 42, 4,
113516 /* iArg: */ 0 },
113517 #endif
113518 #if !defined(SQLITE_OMIT_FOREIGN_KEY)
113519 {/* zName: */ "foreign_key_list",
113520 /* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST,
113521 /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
113522 /* ColNames: */ 34, 8,
113523 /* iArg: */ 0 },
113524 #endif
113525 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
113526 #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
113527 {/* zName: */ "foreign_keys",
@@ -113436,10 +113547,19 @@
113547 {/* zName: */ "fullfsync",
113548 /* ePragTyp: */ PragTyp_FLAG,
113549 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
113550 /* ColNames: */ 0, 0,
113551 /* iArg: */ SQLITE_FullFSync },
113552 #endif
113553 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
113554 #if defined(SQLITE_INTROSPECTION_PRAGMAS)
113555 {/* zName: */ "function_list",
113556 /* ePragTyp: */ PragTyp_FUNCTION_LIST,
113557 /* ePragFlg: */ PragFlg_Result0,
113558 /* ColNames: */ 29, 2,
113559 /* iArg: */ 0 },
113560 #endif
113561 #endif
113562 #if defined(SQLITE_HAS_CODEC)
113563 {/* zName: */ "hexkey",
113564 /* ePragTyp: */ PragTyp_HEXKEY,
113565 /* ePragFlg: */ 0,
@@ -113526,11 +113646,11 @@
113646 #endif
113647 #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
113648 {/* zName: */ "lock_status",
113649 /* ePragTyp: */ PragTyp_LOCK_STATUS,
113650 /* ePragFlg: */ PragFlg_Result0,
113651 /* ColNames: */ 50, 2,
113652 /* iArg: */ 0 },
113653 #endif
113654 #if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
113655 {/* zName: */ "locking_mode",
113656 /* ePragTyp: */ PragTyp_LOCKING_MODE,
@@ -113545,10 +113665,21 @@
113665 {/* zName: */ "mmap_size",
113666 /* ePragTyp: */ PragTyp_MMAP_SIZE,
113667 /* ePragFlg: */ 0,
113668 /* ColNames: */ 0, 0,
113669 /* iArg: */ 0 },
113670 #endif
113671 #if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
113672 #if !defined(SQLITE_OMIT_VIRTUALTABLE)
113673 #if defined(SQLITE_INTROSPECTION_PRAGMAS)
113674 {/* zName: */ "module_list",
113675 /* ePragTyp: */ PragTyp_MODULE_LIST,
113676 /* ePragFlg: */ PragFlg_Result0,
113677 /* ColNames: */ 31, 1,
113678 /* iArg: */ 0 },
113679 #endif
113680 #endif
113681 #endif
113682 {/* zName: */ "optimize",
113683 /* ePragTyp: */ PragTyp_OPTIMIZE,
113684 /* ePragFlg: */ PragFlg_Result1|PragFlg_NeedSchema,
113685 /* ColNames: */ 0, 0,
@@ -113569,10 +113700,17 @@
113700 {/* zName: */ "parser_trace",
113701 /* ePragTyp: */ PragTyp_PARSER_TRACE,
113702 /* ePragFlg: */ 0,
113703 /* ColNames: */ 0, 0,
113704 /* iArg: */ 0 },
113705 #endif
113706 #if defined(SQLITE_INTROSPECTION_PRAGMAS)
113707 {/* zName: */ "pragma_list",
113708 /* ePragTyp: */ PragTyp_PRAGMA_LIST,
113709 /* ePragFlg: */ PragFlg_Result0,
113710 /* ColNames: */ 31, 1,
113711 /* iArg: */ 0 },
113712 #endif
113713 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
113714 {/* zName: */ "query_only",
113715 /* ePragTyp: */ PragTyp_FLAG,
113716 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
@@ -113733,11 +113871,11 @@
113871 /* ColNames: */ 0, 0,
113872 /* iArg: */ 0 },
113873 {/* zName: */ "wal_checkpoint",
113874 /* ePragTyp: */ PragTyp_WAL_CHECKPOINT,
113875 /* ePragFlg: */ PragFlg_NeedSchema,
113876 /* ColNames: */ 46, 3,
113877 /* iArg: */ 0 },
113878 #endif
113879 #if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
113880 {/* zName: */ "writable_schema",
113881 /* ePragTyp: */ PragTyp_FLAG,
@@ -113744,11 +113882,11 @@
113882 /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
113883 /* ColNames: */ 0, 0,
113884 /* iArg: */ SQLITE_WriteSchema },
113885 #endif
113886 };
113887 /* Number of pragmas: 60 on by default, 77 total. */
113888
113889 /************** End of pragma.h **********************************************/
113890 /************** Continuing where we left off in pragma.c *********************/
113891
113892 /*
@@ -114234,22 +114372,26 @@
114372 break;
114373 }
114374
114375 /*
114376 ** PRAGMA [schema.]secure_delete
114377 ** PRAGMA [schema.]secure_delete=ON/OFF/FAST
114378 **
114379 ** The first form reports the current setting for the
114380 ** secure_delete flag. The second form changes the secure_delete
114381 ** flag setting and reports the new value.
114382 */
114383 case PragTyp_SECURE_DELETE: {
114384 Btree *pBt = pDb->pBt;
114385 int b = -1;
114386 assert( pBt!=0 );
114387 if( zRight ){
114388 if( sqlite3_stricmp(zRight, "fast")==0 ){
114389 b = 2;
114390 }else{
114391 b = sqlite3GetBoolean(zRight, 0);
114392 }
114393 }
114394 if( pId2->n==0 && b>=0 ){
114395 int ii;
114396 for(ii=0; ii<db->nDb; ii++){
114397 sqlite3BtreeSecureDelete(db->aDb[ii].pBt, b);
@@ -114827,11 +114969,10 @@
114969 pCol->zName,
114970 sqlite3ColumnType(pCol,""),
114971 pCol->notNull ? 1 : 0,
114972 pCol->pDflt ? pCol->pDflt->u.zToken : 0,
114973 k);
 
114974 }
114975 }
114976 }
114977 break;
114978
@@ -114847,13 +114988,12 @@
114988 pTab->zName,
114989 0,
114990 pTab->szTabRow,
114991 pTab->nRowLogEst,
114992 pTab->tabFlags);
 
114993 for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
114994 sqlite3VdbeMultiLoad(v, 2, "siiiX",
114995 pIdx->zName,
114996 pIdx->szIdxRow,
114997 pIdx->aiRowLogEst[0],
114998 pIdx->hasStat1);
114999 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5);
@@ -114882,14 +115022,14 @@
115022 pTab = pIdx->pTable;
115023 sqlite3CodeVerifySchema(pParse, iDb);
115024 assert( pParse->nMem<=pPragma->nPragCName );
115025 for(i=0; i<mx; i++){
115026 i16 cnum = pIdx->aiColumn[i];
115027 sqlite3VdbeMultiLoad(v, 1, "iisX", i, cnum,
115028 cnum<0 ? 0 : pTab->aCol[cnum].zName);
115029 if( pPragma->iArg ){
115030 sqlite3VdbeMultiLoad(v, 4, "isiX",
115031 pIdx->aSortOrder[i],
115032 pIdx->azColl[i],
115033 i<pIdx->nKeyCol);
115034 }
115035 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, pParse->nMem);
@@ -114912,11 +115052,10 @@
115052 i,
115053 pIdx->zName,
115054 IsUniqueIndex(pIdx),
115055 azOrigin[pIdx->idxType],
115056 pIdx->pPartIdxWhere!=0);
 
115057 }
115058 }
115059 }
115060 break;
115061
@@ -114928,11 +115067,10 @@
115067 assert( db->aDb[i].zDbSName!=0 );
115068 sqlite3VdbeMultiLoad(v, 1, "iss",
115069 i,
115070 db->aDb[i].zDbSName,
115071 sqlite3BtreeGetFilename(db->aDb[i].pBt));
 
115072 }
115073 }
115074 break;
115075
115076 case PragTyp_COLLATION_LIST: {
@@ -114940,14 +115078,57 @@
115078 HashElem *p;
115079 pParse->nMem = 2;
115080 for(p=sqliteHashFirst(&db->aCollSeq); p; p=sqliteHashNext(p)){
115081 CollSeq *pColl = (CollSeq *)sqliteHashData(p);
115082 sqlite3VdbeMultiLoad(v, 1, "is", i++, pColl->zName);
115083 }
115084 }
115085 break;
115086
115087 #ifdef SQLITE_INTROSPECTION_PRAGMAS
115088 case PragTyp_FUNCTION_LIST: {
115089 int i;
115090 HashElem *j;
115091 FuncDef *p;
115092 pParse->nMem = 2;
115093 for(i=0; i<SQLITE_FUNC_HASH_SZ; i++){
115094 for(p=sqlite3BuiltinFunctions.a[i]; p; p=p->u.pHash ){
115095 sqlite3VdbeMultiLoad(v, 1, "si", p->zName, 1);
115096 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);
115097 }
115098 }
115099 for(j=sqliteHashFirst(&db->aFunc); j; j=sqliteHashNext(j)){
115100 p = (FuncDef*)sqliteHashData(j);
115101 sqlite3VdbeMultiLoad(v, 1, "si", p->zName, 0);
115102 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);
115103 }
115104 }
115105 break;
115106
115107 #ifndef SQLITE_OMIT_VIRTUALTABLE
115108 case PragTyp_MODULE_LIST: {
115109 HashElem *j;
115110 pParse->nMem = 1;
115111 for(j=sqliteHashFirst(&db->aModule); j; j=sqliteHashNext(j)){
115112 Module *pMod = (Module*)sqliteHashData(j);
115113 sqlite3VdbeMultiLoad(v, 1, "s", pMod->zName);
115114 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
115115 }
115116 }
115117 break;
115118 #endif /* SQLITE_OMIT_VIRTUALTABLE */
115119
115120 case PragTyp_PRAGMA_LIST: {
115121 int i;
115122 for(i=0; i<ArraySize(aPragmaName); i++){
115123 sqlite3VdbeMultiLoad(v, 1, "s", aPragmaName[i].zName);
115124 sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
115125 }
115126 }
115127 break;
115128 #endif /* SQLITE_INTROSPECTION_PRAGMAS */
115129
115130 #endif /* SQLITE_OMIT_SCHEMA_PRAGMAS */
115131
115132 #ifndef SQLITE_OMIT_FOREIGN_KEY
115133 case PragTyp_FOREIGN_KEY_LIST: if( zRight ){
115134 FKey *pFK;
@@ -114969,11 +115150,10 @@
115150 pTab->aCol[pFK->aCol[j].iFrom].zName,
115151 pFK->aCol[j].zCol,
115152 actionName(pFK->aAction[1]), /* ON UPDATE */
115153 actionName(pFK->aAction[0]), /* ON DELETE */
115154 "NONE");
 
115155 }
115156 ++i;
115157 pFK = pFK->pNextFrom;
115158 }
115159 }
@@ -115079,11 +115259,11 @@
115259 if( HasRowid(pTab) ){
115260 sqlite3VdbeAddOp2(v, OP_Rowid, 0, regResult+1);
115261 }else{
115262 sqlite3VdbeAddOp2(v, OP_Null, 0, regResult+1);
115263 }
115264 sqlite3VdbeMultiLoad(v, regResult+2, "siX", pFK->zTo, i-1);
115265 sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, 4);
115266 sqlite3VdbeResolveLabel(v, addrOk);
115267 sqlite3DbFree(db, aiCols);
115268 }
115269 sqlite3VdbeAddOp2(v, OP_Next, 0, addrTop+1); VdbeCoverage(v);
@@ -115781,11 +115961,10 @@
115961 }else if( sqlite3_file_control(db, i ? db->aDb[i].zDbSName : 0,
115962 SQLITE_FCNTL_LOCKSTATE, &j)==SQLITE_OK ){
115963 zState = azLockName[j];
115964 }
115965 sqlite3VdbeMultiLoad(v, 1, "ss", db->aDb[i].zDbSName, zState);
 
115966 }
115967 break;
115968 }
115969 #endif
115970
@@ -118621,24 +118800,50 @@
118800 return 0;
118801 }
118802
118803
118804 /*
118805 ** Compute the column names for a SELECT statement.
118806 **
118807 ** The only guarantee that SQLite makes about column names is that if the
118808 ** column has an AS clause assigning it a name, that will be the name used.
118809 ** That is the only documented guarantee. However, countless applications
118810 ** developed over the years have made baseless assumptions about column names
118811 ** and will break if those assumptions changes. Hence, use extreme caution
118812 ** when modifying this routine to avoid breaking legacy.
118813 **
118814 ** See Also: sqlite3ColumnsFromExprList()
118815 **
118816 ** The PRAGMA short_column_names and PRAGMA full_column_names settings are
118817 ** deprecated. The default setting is short=ON, full=OFF. 99.9% of all
118818 ** applications should operate this way. Nevertheless, we need to support the
118819 ** other modes for legacy:
118820 **
118821 ** short=OFF, full=OFF: Column name is the text of the expression has it
118822 ** originally appears in the SELECT statement. In
118823 ** other words, the zSpan of the result expression.
118824 **
118825 ** short=ON, full=OFF: (This is the default setting). If the result
118826 ** refers directly to a table column, then the result
118827 ** column name is just the table column name: COLUMN.
118828 ** Otherwise use zSpan.
118829 **
118830 ** full=ON, short=ANY: If the result refers directly to a table column,
118831 ** then the result column name with the table name
118832 ** prefix, ex: TABLE.COLUMN. Otherwise use zSpan.
118833 */
118834 static void generateColumnNames(
118835 Parse *pParse, /* Parser context */
118836 SrcList *pTabList, /* The FROM clause of the SELECT */
118837 ExprList *pEList /* Expressions defining the result set */
118838 ){
118839 Vdbe *v = pParse->pVdbe;
118840 int i;
118841 Table *pTab;
118842 sqlite3 *db = pParse->db;
118843 int fullName; /* TABLE.COLUMN if no AS clause and is a direct table ref */
118844 int srcName; /* COLUMN or TABLE.COLUMN if no AS clause and is direct */
118845
118846 #ifndef SQLITE_OMIT_EXPLAIN
118847 /* If this is an EXPLAIN, skip this step */
118848 if( pParse->explain ){
118849 return;
@@ -118647,21 +118852,23 @@
118852
118853 if( pParse->colNamesSet || db->mallocFailed ) return;
118854 assert( v!=0 );
118855 assert( pTabList!=0 );
118856 pParse->colNamesSet = 1;
118857 fullName = (db->flags & SQLITE_FullColNames)!=0;
118858 srcName = (db->flags & SQLITE_ShortColNames)!=0 || fullName;
118859 sqlite3VdbeSetNumCols(v, pEList->nExpr);
118860 for(i=0; i<pEList->nExpr; i++){
118861 Expr *p = pEList->a[i].pExpr;
118862
118863 assert( p!=0 );
118864 if( pEList->a[i].zName ){
118865 /* An AS clause always takes first priority */
118866 char *zName = pEList->a[i].zName;
118867 sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_TRANSIENT);
118868 }else if( srcName
118869 && (p->op==TK_COLUMN || p->op==TK_AGG_COLUMN)
118870 && (pTab = tableWithCursor(pTabList, p->iTable))!=0
118871 ){
118872 char *zCol;
118873 int iCol = p->iColumn;
118874 if( iCol<0 ) iCol = pTab->iPKey;
@@ -118669,14 +118876,11 @@
118876 if( iCol<0 ){
118877 zCol = "rowid";
118878 }else{
118879 zCol = pTab->aCol[iCol].zName;
118880 }
118881 if( fullName ){
 
 
 
118882 char *zName = 0;
118883 zName = sqlite3MPrintf(db, "%s.%s", pTab->zName, zCol);
118884 sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_DYNAMIC);
118885 }else{
118886 sqlite3VdbeSetColName(v, i, COLNAME_NAME, zCol, SQLITE_TRANSIENT);
@@ -118700,10 +118904,19 @@
118904 ** Only the column names are computed. Column.zType, Column.zColl,
118905 ** and other fields of Column are zeroed.
118906 **
118907 ** Return SQLITE_OK on success. If a memory allocation error occurs,
118908 ** store NULL in *paCol and 0 in *pnCol and return SQLITE_NOMEM.
118909 **
118910 ** The only guarantee that SQLite makes about column names is that if the
118911 ** column has an AS clause assigning it a name, that will be the name used.
118912 ** That is the only documented guarantee. However, countless applications
118913 ** developed over the years have made baseless assumptions about column names
118914 ** and will break if those assumptions changes. Hence, use extreme caution
118915 ** when modifying this routine to avoid breaking legacy.
118916 **
118917 ** See Also: generateColumnNames()
118918 */
118919 SQLITE_PRIVATE int sqlite3ColumnsFromExprList(
118920 Parse *pParse, /* Parsing context */
118921 ExprList *pEList, /* Expr list from which to derive column names */
118922 i16 *pnCol, /* Write the number of columns here */
@@ -118712,11 +118925,10 @@
118925 sqlite3 *db = pParse->db; /* Database connection */
118926 int i, j; /* Loop counters */
118927 u32 cnt; /* Index added to make the name unique */
118928 Column *aCol, *pCol; /* For looping over result columns */
118929 int nCol; /* Number of columns in the result set */
 
118930 char *zName; /* Column name */
118931 int nName; /* Size of name in zName[] */
118932 Hash ht; /* Hash table of column names */
118933
118934 sqlite3HashInit(&ht);
@@ -118733,24 +118945,22 @@
118945 *paCol = aCol;
118946
118947 for(i=0, pCol=aCol; i<nCol && !db->mallocFailed; i++, pCol++){
118948 /* Get an appropriate name for the column
118949 */
 
118950 if( (zName = pEList->a[i].zName)!=0 ){
118951 /* If the column contains an "AS <name>" phrase, use <name> as the name */
118952 }else{
118953 Expr *pColExpr = sqlite3ExprSkipCollate(pEList->a[i].pExpr);
 
118954 while( pColExpr->op==TK_DOT ){
118955 pColExpr = pColExpr->pRight;
118956 assert( pColExpr!=0 );
118957 }
118958 if( pColExpr->op==TK_COLUMN && pColExpr->pTab!=0 ){
118959 /* For columns use the column name name */
118960 int iCol = pColExpr->iColumn;
118961 Table *pTab = pColExpr->pTab;
118962 if( iCol<0 ) iCol = pTab->iPKey;
118963 zName = iCol>=0 ? pTab->aCol[iCol].zName : "rowid";
118964 }else if( pColExpr->op==TK_ID ){
118965 assert( !ExprHasProperty(pColExpr, EP_IntValue) );
118966 zName = pColExpr->u.zToken;
@@ -118757,11 +118967,15 @@
118967 }else{
118968 /* Use the original text of the column expression as its name */
118969 zName = pEList->a[i].zSpan;
118970 }
118971 }
118972 if( zName ){
118973 zName = sqlite3DbStrDup(db, zName);
118974 }else{
118975 zName = sqlite3MPrintf(db,"column%d",i+1);
118976 }
118977
118978 /* Make sure the column name is unique. If the name is not unique,
118979 ** append an integer to the name so that it becomes unique.
118980 */
118981 cnt = 0;
@@ -122070,10 +122284,92 @@
122284 return pItem;
122285 }
122286 return 0;
122287 }
122288
122289 #ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
122290 /*
122291 ** Attempt to transform a query of the form
122292 **
122293 ** SELECT count(*) FROM (SELECT x FROM t1 UNION ALL SELECT y FROM t2)
122294 **
122295 ** Into this:
122296 **
122297 ** SELECT (SELECT count(*) FROM t1)+(SELECT count(*) FROM t2)
122298 **
122299 ** The transformation only works if all of the following are true:
122300 **
122301 ** * The subquery is a UNION ALL of two or more terms
122302 ** * There is no WHERE or GROUP BY or HAVING clauses on the subqueries
122303 ** * The outer query is a simple count(*)
122304 **
122305 ** Return TRUE if the optimization is undertaken.
122306 */
122307 static int countOfViewOptimization(Parse *pParse, Select *p){
122308 Select *pSub, *pPrior;
122309 Expr *pExpr;
122310 Expr *pCount;
122311 sqlite3 *db;
122312 if( (p->selFlags & SF_Aggregate)==0 ) return 0; /* This is an aggregate query */
122313 if( p->pEList->nExpr!=1 ) return 0; /* Single result column */
122314 pExpr = p->pEList->a[0].pExpr;
122315 if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */
122316 if( sqlite3_stricmp(pExpr->u.zToken,"count") ) return 0; /* Must be count() */
122317 if( pExpr->x.pList!=0 ) return 0; /* Must be count(*) */
122318 if( p->pSrc->nSrc!=1 ) return 0; /* One table in the FROM clause */
122319 pSub = p->pSrc->a[0].pSelect;
122320 if( pSub==0 ) return 0; /* The FROM is a subquery */
122321 if( pSub->pPrior==0 ) return 0; /* Must be a compound subquery */
122322 do{
122323 if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
122324 if( pSub->pWhere ) return 0; /* No WHERE clause */
122325 if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */
122326 pSub = pSub->pPrior; /* Repeat over compound terms */
122327 }while( pSub );
122328
122329 /* If we reach this point, that means it is OK to perform the transformation */
122330
122331 db = pParse->db;
122332 pCount = pExpr;
122333 pExpr = 0;
122334 pSub = p->pSrc->a[0].pSelect;
122335 p->pSrc->a[0].pSelect = 0;
122336 sqlite3SrcListDelete(db, p->pSrc);
122337 p->pSrc = sqlite3DbMallocZero(pParse->db, sizeof(*p->pSrc));
122338 while( pSub ){
122339 Expr *pTerm;
122340 pPrior = pSub->pPrior;
122341 pSub->pPrior = 0;
122342 pSub->pNext = 0;
122343 pSub->selFlags |= SF_Aggregate;
122344 pSub->selFlags &= ~SF_Compound;
122345 pSub->nSelectRow = 0;
122346 sqlite3ExprListDelete(db, pSub->pEList);
122347 pTerm = pPrior ? sqlite3ExprDup(db, pCount, 0) : pCount;
122348 pSub->pEList = sqlite3ExprListAppend(pParse, 0, pTerm);
122349 pTerm = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
122350 sqlite3PExprAddSelect(pParse, pTerm, pSub);
122351 if( pExpr==0 ){
122352 pExpr = pTerm;
122353 }else{
122354 pExpr = sqlite3PExpr(pParse, TK_PLUS, pTerm, pExpr);
122355 }
122356 pSub = pPrior;
122357 }
122358 p->pEList->a[0].pExpr = pExpr;
122359 p->selFlags &= ~SF_Aggregate;
122360
122361 #if SELECTTRACE_ENABLED
122362 if( sqlite3SelectTrace & 0x400 ){
122363 SELECTTRACE(0x400,pParse,p,("After count-of-view optimization:\n"));
122364 sqlite3TreeViewSelect(0, p, 0);
122365 }
122366 #endif
122367 return 1;
122368 }
122369 #endif /* SQLITE_COUNTOFVIEW_OPTIMIZATION */
122370
122371 /*
122372 ** Generate code for the SELECT statement given in the p argument.
122373 **
122374 ** The results are returned according to the SelectDest structure.
122375 ** See comments in sqliteInt.h for further information.
@@ -122381,10 +122677,20 @@
122677 if( sqlite3SelectTrace & 0x400 ){
122678 SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n"));
122679 sqlite3TreeViewSelect(0, p, 0);
122680 }
122681 #endif
122682
122683 #ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
122684 if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView)
122685 && countOfViewOptimization(pParse, p)
122686 ){
122687 if( db->mallocFailed ) goto select_end;
122688 pEList = p->pEList;
122689 pTabList = p->pSrc;
122690 }
122691 #endif
122692
122693 /* If the query is DISTINCT with an ORDER BY but is not an aggregate, and
122694 ** if the select-list is the same as the ORDER BY list, then this query
122695 ** can be rewritten as a GROUP BY. In other words, this:
122696 **
@@ -127095,10 +127401,11 @@
127401 #endif
127402 #define TERM_LIKEOPT 0x100 /* Virtual terms from the LIKE optimization */
127403 #define TERM_LIKECOND 0x200 /* Conditionally this LIKE operator term */
127404 #define TERM_LIKE 0x400 /* The original LIKE operator */
127405 #define TERM_IS 0x800 /* Term.pExpr is an IS operator */
127406 #define TERM_VARSELECT 0x1000 /* Term.pExpr contains a correlated sub-query */
127407
127408 /*
127409 ** An instance of the WhereScan object is used as an iterator for locating
127410 ** terms in the WHERE clause that are useful to the query planner.
127411 */
@@ -127184,10 +127491,11 @@
127491 ** does not really matter. What is important is that sparse cursor
127492 ** numbers all get mapped into bit numbers that begin with 0 and contain
127493 ** no gaps.
127494 */
127495 struct WhereMaskSet {
127496 int bVarSelect; /* Used by sqlite3WhereExprUsage() */
127497 int n; /* Number of assigned cursor values */
127498 int ix[BMS]; /* Cursor assigned to each bit */
127499 };
127500
127501 /*
@@ -128481,11 +128789,11 @@
128789 int addrHalt; /* addrBrk for the outermost loop */
128790 int addrCont; /* Jump here to continue with next cycle */
128791 int iRowidReg = 0; /* Rowid is stored in this register, if not zero */
128792 int iReleaseReg = 0; /* Temp register to free before returning */
128793 Index *pIdx = 0; /* Index used by loop (if any) */
128794 int iLoop; /* Iteration of constraint generator loop */
128795
128796 pParse = pWInfo->pParse;
128797 v = pParse->pVdbe;
128798 pWC = &pWInfo->sWC;
128799 db = pParse->db;
@@ -129376,17 +129684,24 @@
129684 #endif
129685
129686 /* Insert code to test every subexpression that can be completely
129687 ** computed using the current set of tables.
129688 **
129689 ** This loop may run between one and three times, depending on the
129690 ** constraints to be generated. The value of stack variable iLoop
129691 ** determines the constraints coded by each iteration, as follows:
129692 **
129693 ** iLoop==1: Code only expressions that are entirely covered by pIdx.
129694 ** iLoop==2: Code remaining expressions that do not contain correlated
129695 ** sub-queries.
129696 ** iLoop==3: Code all remaining expressions.
129697 **
129698 ** An effort is made to skip unnecessary iterations of the loop.
129699 */
129700 iLoop = (pIdx ? 1 : 2);
129701 do{
129702 int iNext = 0; /* Next value for iLoop */
129703 for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
129704 Expr *pE;
129705 int skipLikeAddr = 0;
129706 testcase( pTerm->wtFlags & TERM_VIRTUAL );
129707 testcase( pTerm->wtFlags & TERM_CODED );
@@ -129400,14 +129715,20 @@
129715 pE = pTerm->pExpr;
129716 assert( pE!=0 );
129717 if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){
129718 continue;
129719 }
129720
129721 if( iLoop==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){
129722 iNext = 2;
129723 continue;
129724 }
129725 if( iLoop<3 && (pTerm->wtFlags & TERM_VARSELECT) ){
129726 if( iNext==0 ) iNext = 3;
129727 continue;
129728 }
129729
129730 if( pTerm->wtFlags & TERM_LIKECOND ){
129731 /* If the TERM_LIKECOND flag is set, that means that the range search
129732 ** is sufficient to guarantee that the LIKE operator is true, so we
129733 ** can skip the call to the like(A,B) function. But this only works
129734 ** for strings. So do not skip the call to the function on the pass
@@ -129419,16 +129740,22 @@
129740 assert( x>0 );
129741 skipLikeAddr = sqlite3VdbeAddOp1(v, (x&1)?OP_IfNot:OP_If, (int)(x>>1));
129742 VdbeCoverage(v);
129743 #endif
129744 }
129745 #ifdef WHERETRACE_ENABLED /* 0xffff */
129746 if( sqlite3WhereTrace ){
129747 VdbeNoopComment((v, "WhereTerm[%d] (%p) priority=%d",
129748 pWC->nTerm-j, pTerm, iLoop));
129749 }
129750 #endif
129751 sqlite3ExprIfFalse(pParse, pE, addrCont, SQLITE_JUMPIFNULL);
129752 if( skipLikeAddr ) sqlite3VdbeJumpHere(v, skipLikeAddr);
129753 pTerm->wtFlags |= TERM_CODED;
129754 }
129755 iLoop = iNext;
129756 }while( iLoop>0 );
129757
129758 /* Insert code to test for implied constraints based on transitivity
129759 ** of the "==" operator.
129760 **
129761 ** Example: If the WHERE clause contains "t1.a=t2.b" and "t2.b=123"
@@ -130438,11 +130765,13 @@
130765 }else if( op==TK_ISNULL ){
130766 pTerm->prereqRight = 0;
130767 }else{
130768 pTerm->prereqRight = sqlite3WhereExprUsage(pMaskSet, pExpr->pRight);
130769 }
130770 pMaskSet->bVarSelect = 0;
130771 prereqAll = sqlite3WhereExprUsage(pMaskSet, pExpr);
130772 if( pMaskSet->bVarSelect ) pTerm->wtFlags |= TERM_VARSELECT;
130773 if( ExprHasProperty(pExpr, EP_FromJoin) ){
130774 Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->iRightJoinTable);
130775 prereqAll |= x;
130776 extraRight = x-1; /* ON clause terms may not be used with an index
130777 ** on left table of a LEFT JOIN. Ticket #3015 */
@@ -130869,13 +131198,16 @@
131198 if( p->op==TK_COLUMN ){
131199 return sqlite3WhereGetMask(pMaskSet, p->iTable);
131200 }
131201 mask = (p->op==TK_IF_NULL_ROW) ? sqlite3WhereGetMask(pMaskSet, p->iTable) : 0;
131202 assert( !ExprHasProperty(p, EP_TokenOnly) );
 
131203 if( p->pLeft ) mask |= sqlite3WhereExprUsage(pMaskSet, p->pLeft);
131204 if( p->pRight ){
131205 mask |= sqlite3WhereExprUsage(pMaskSet, p->pRight);
131206 assert( p->x.pList==0 );
131207 }else if( ExprHasProperty(p, EP_xIsSelect) ){
131208 if( ExprHasProperty(p, EP_VarSelect) ) pMaskSet->bVarSelect = 1;
131209 mask |= exprSelectUsage(pMaskSet, p->x.pSelect);
131210 }else if( p->x.pList ){
131211 mask |= sqlite3WhereExprListUsage(pMaskSet, p->x.pList);
131212 }
131213 return mask;
@@ -135501,13 +135833,17 @@
135833 for(ii=0; ii<pTabList->nSrc; ii++){
135834 createMask(pMaskSet, pTabList->a[ii].iCursor);
135835 sqlite3WhereTabFuncArgs(pParse, &pTabList->a[ii], &pWInfo->sWC);
135836 }
135837 #ifdef SQLITE_DEBUG
135838 {
135839 Bitmask mx = 0;
135840 for(ii=0; ii<pTabList->nSrc; ii++){
135841 Bitmask m = sqlite3WhereGetMask(pMaskSet, pTabList->a[ii].iCursor);
135842 assert( m>=mx );
135843 mx = m;
135844 }
135845 }
135846 #endif
135847
135848 /* Analyze all of the subexpressions. */
135849 sqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC);
@@ -136348,20 +136684,20 @@
136684 #define sqlite3ParserARG_SDECL Parse *pParse;
136685 #define sqlite3ParserARG_PDECL ,Parse *pParse
136686 #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse
136687 #define sqlite3ParserARG_STORE yypParser->pParse = pParse
136688 #define YYFALLBACK 1
136689 #define YYNSTATE 455
136690 #define YYNRULE 329
136691 #define YY_MAX_SHIFT 454
136692 #define YY_MIN_SHIFTREDUCE 664
136693 #define YY_MAX_SHIFTREDUCE 992
136694 #define YY_MIN_REDUCE 993
136695 #define YY_MAX_REDUCE 1321
136696 #define YY_ERROR_ACTION 1322
136697 #define YY_ACCEPT_ACTION 1323
136698 #define YY_NO_ACTION 1324
136699 /************* End control #defines *******************************************/
136700
136701 /* Define the yytestcase() macro to be a no-op if is not already defined
136702 ** otherwise.
136703 **
@@ -136429,169 +136765,169 @@
136765 ** yy_reduce_ofst[] For each state, the offset into yy_action for
136766 ** shifting non-terminals after a reduce.
136767 ** yy_default[] Default action for each state.
136768 **
136769 *********** Begin parsing tables **********************************************/
136770 #define YY_ACTTAB_COUNT (1565)
136771 static const YYACTIONTYPE yy_action[] = {
136772 /* 0 */ 324, 410, 342, 747, 747, 203, 939, 353, 969, 98,
136773 /* 10 */ 98, 98, 98, 91, 96, 96, 96, 96, 95, 95,
136774 /* 20 */ 94, 94, 94, 93, 350, 1323, 155, 155, 2, 808,
136775 /* 30 */ 971, 971, 98, 98, 98, 98, 20, 96, 96, 96,
136776 /* 40 */ 96, 95, 95, 94, 94, 94, 93, 350, 92, 89,
136777 /* 50 */ 178, 99, 100, 90, 847, 850, 839, 839, 97, 97,
136778 /* 60 */ 98, 98, 98, 98, 350, 96, 96, 96, 96, 95,
136779 /* 70 */ 95, 94, 94, 94, 93, 350, 324, 339, 969, 262,
136780 /* 80 */ 364, 251, 212, 169, 287, 404, 282, 403, 199, 786,
136781 /* 90 */ 242, 411, 21, 950, 378, 280, 93, 350, 787, 95,
136782 /* 100 */ 95, 94, 94, 94, 93, 350, 971, 971, 96, 96,
136783 /* 110 */ 96, 96, 95, 95, 94, 94, 94, 93, 350, 808,
136784 /* 120 */ 328, 242, 411, 1235, 826, 1235, 132, 99, 100, 90,
136785 /* 130 */ 847, 850, 839, 839, 97, 97, 98, 98, 98, 98,
136786 /* 140 */ 449, 96, 96, 96, 96, 95, 95, 94, 94, 94,
136787 /* 150 */ 93, 350, 324, 819, 348, 347, 120, 818, 120, 75,
136788 /* 160 */ 52, 52, 950, 951, 952, 1084, 977, 146, 360, 262,
136789 /* 170 */ 369, 261, 950, 975, 954, 976, 92, 89, 178, 370,
136790 /* 180 */ 230, 370, 971, 971, 1141, 360, 359, 101, 818, 818,
136791 /* 190 */ 820, 383, 24, 1286, 380, 427, 412, 368, 978, 379,
136792 /* 200 */ 978, 1032, 324, 99, 100, 90, 847, 850, 839, 839,
136793 /* 210 */ 97, 97, 98, 98, 98, 98, 372, 96, 96, 96,
136794 /* 220 */ 96, 95, 95, 94, 94, 94, 93, 350, 950, 132,
136795 /* 230 */ 890, 449, 971, 971, 890, 60, 94, 94, 94, 93,
136796 /* 240 */ 350, 950, 951, 952, 954, 103, 360, 950, 384, 333,
136797 /* 250 */ 697, 52, 52, 99, 100, 90, 847, 850, 839, 839,
136798 /* 260 */ 97, 97, 98, 98, 98, 98, 1022, 96, 96, 96,
136799 /* 270 */ 96, 95, 95, 94, 94, 94, 93, 350, 324, 454,
136800 /* 280 */ 995, 449, 227, 61, 157, 243, 343, 114, 1025, 1211,
136801 /* 290 */ 147, 826, 950, 372, 1071, 950, 319, 950, 951, 952,
136802 /* 300 */ 194, 10, 10, 401, 398, 397, 1211, 1213, 971, 971,
136803 /* 310 */ 757, 171, 170, 157, 396, 336, 950, 951, 952, 697,
136804 /* 320 */ 819, 310, 153, 950, 818, 320, 82, 23, 80, 99,
136805 /* 330 */ 100, 90, 847, 850, 839, 839, 97, 97, 98, 98,
136806 /* 340 */ 98, 98, 888, 96, 96, 96, 96, 95, 95, 94,
136807 /* 350 */ 94, 94, 93, 350, 324, 818, 818, 820, 277, 231,
136808 /* 360 */ 300, 950, 951, 952, 950, 951, 952, 1211, 194, 25,
136809 /* 370 */ 449, 401, 398, 397, 950, 354, 300, 449, 950, 74,
136810 /* 380 */ 449, 1, 396, 132, 971, 971, 950, 224, 224, 808,
136811 /* 390 */ 10, 10, 950, 951, 952, 1290, 132, 52, 52, 414,
136812 /* 400 */ 52, 52, 1063, 1063, 338, 99, 100, 90, 847, 850,
136813 /* 410 */ 839, 839, 97, 97, 98, 98, 98, 98, 1114, 96,
136814 /* 420 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 350,
136815 /* 430 */ 324, 1113, 427, 417, 701, 427, 426, 1260, 1260, 262,
136816 /* 440 */ 369, 261, 950, 950, 951, 952, 752, 950, 951, 952,
136817 /* 450 */ 449, 751, 449, 1058, 1037, 950, 951, 952, 442, 706,
136818 /* 460 */ 971, 971, 1058, 393, 92, 89, 178, 446, 446, 446,
136819 /* 470 */ 51, 51, 52, 52, 438, 773, 1024, 92, 89, 178,
136820 /* 480 */ 172, 99, 100, 90, 847, 850, 839, 839, 97, 97,
136821 /* 490 */ 98, 98, 98, 98, 198, 96, 96, 96, 96, 95,
136822 /* 500 */ 95, 94, 94, 94, 93, 350, 324, 427, 407, 909,
136823 /* 510 */ 694, 950, 951, 952, 92, 89, 178, 224, 224, 157,
136824 /* 520 */ 241, 221, 418, 299, 771, 910, 415, 374, 449, 414,
136825 /* 530 */ 58, 323, 1061, 1061, 1242, 378, 971, 971, 378, 772,
136826 /* 540 */ 448, 911, 362, 735, 296, 681, 9, 9, 52, 52,
136827 /* 550 */ 234, 329, 234, 256, 416, 736, 280, 99, 100, 90,
136828 /* 560 */ 847, 850, 839, 839, 97, 97, 98, 98, 98, 98,
136829 /* 570 */ 449, 96, 96, 96, 96, 95, 95, 94, 94, 94,
136830 /* 580 */ 93, 350, 324, 422, 72, 449, 827, 120, 367, 449,
136831 /* 590 */ 10, 10, 5, 301, 203, 449, 177, 969, 253, 419,
136832 /* 600 */ 255, 771, 200, 175, 233, 10, 10, 836, 836, 36,
136833 /* 610 */ 36, 1289, 971, 971, 724, 37, 37, 348, 347, 424,
136834 /* 620 */ 203, 260, 771, 969, 232, 930, 1316, 870, 337, 1316,
136835 /* 630 */ 421, 848, 851, 99, 100, 90, 847, 850, 839, 839,
136836 /* 640 */ 97, 97, 98, 98, 98, 98, 268, 96, 96, 96,
136837 /* 650 */ 96, 95, 95, 94, 94, 94, 93, 350, 324, 840,
136838 /* 660 */ 449, 978, 813, 978, 1200, 449, 909, 969, 715, 349,
136839 /* 670 */ 349, 349, 928, 177, 449, 930, 1317, 254, 198, 1317,
136840 /* 680 */ 12, 12, 910, 402, 449, 27, 27, 250, 971, 971,
136841 /* 690 */ 118, 716, 162, 969, 38, 38, 268, 176, 911, 771,
136842 /* 700 */ 432, 1265, 939, 353, 39, 39, 316, 991, 324, 99,
136843 /* 710 */ 100, 90, 847, 850, 839, 839, 97, 97, 98, 98,
136844 /* 720 */ 98, 98, 928, 96, 96, 96, 96, 95, 95, 94,
136845 /* 730 */ 94, 94, 93, 350, 449, 329, 449, 357, 971, 971,
136846 /* 740 */ 1041, 316, 929, 340, 893, 893, 386, 669, 670, 671,
136847 /* 750 */ 275, 1318, 317, 992, 40, 40, 41, 41, 268, 99,
136848 /* 760 */ 100, 90, 847, 850, 839, 839, 97, 97, 98, 98,
136849 /* 770 */ 98, 98, 449, 96, 96, 96, 96, 95, 95, 94,
136850 /* 780 */ 94, 94, 93, 350, 324, 449, 355, 449, 992, 449,
136851 /* 790 */ 1016, 330, 42, 42, 786, 270, 449, 273, 449, 228,
136852 /* 800 */ 449, 298, 449, 787, 449, 28, 28, 29, 29, 31,
136853 /* 810 */ 31, 449, 1141, 449, 971, 971, 43, 43, 44, 44,
136854 /* 820 */ 45, 45, 11, 11, 46, 46, 887, 78, 887, 268,
136855 /* 830 */ 268, 105, 105, 47, 47, 99, 100, 90, 847, 850,
136856 /* 840 */ 839, 839, 97, 97, 98, 98, 98, 98, 449, 96,
136857 /* 850 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 350,
136858 /* 860 */ 324, 449, 117, 449, 1073, 158, 449, 691, 48, 48,
136859 /* 870 */ 229, 1241, 449, 1250, 449, 414, 449, 334, 449, 245,
136860 /* 880 */ 449, 33, 33, 49, 49, 449, 50, 50, 246, 1141,
136861 /* 890 */ 971, 971, 34, 34, 122, 122, 123, 123, 124, 124,
136862 /* 900 */ 56, 56, 268, 81, 249, 35, 35, 197, 196, 195,
136863 /* 910 */ 324, 99, 100, 90, 847, 850, 839, 839, 97, 97,
136864 /* 920 */ 98, 98, 98, 98, 449, 96, 96, 96, 96, 95,
136865 /* 930 */ 95, 94, 94, 94, 93, 350, 449, 691, 449, 1141,
136866 /* 940 */ 971, 971, 968, 1207, 106, 106, 268, 1209, 268, 1266,
136867 /* 950 */ 2, 886, 268, 886, 335, 1040, 53, 53, 107, 107,
136868 /* 960 */ 324, 99, 100, 90, 847, 850, 839, 839, 97, 97,
136869 /* 970 */ 98, 98, 98, 98, 449, 96, 96, 96, 96, 95,
136870 /* 980 */ 95, 94, 94, 94, 93, 350, 449, 1070, 449, 1066,
136871 /* 990 */ 971, 971, 1039, 267, 108, 108, 445, 330, 331, 133,
136872 /* 1000 */ 223, 175, 301, 225, 385, 1255, 104, 104, 121, 121,
136873 /* 1010 */ 324, 99, 88, 90, 847, 850, 839, 839, 97, 97,
136874 /* 1020 */ 98, 98, 98, 98, 1141, 96, 96, 96, 96, 95,
136875 /* 1030 */ 95, 94, 94, 94, 93, 350, 449, 346, 449, 167,
136876 /* 1040 */ 971, 971, 925, 810, 371, 318, 202, 202, 373, 263,
136877 /* 1050 */ 394, 202, 74, 208, 721, 722, 119, 119, 112, 112,
136878 /* 1060 */ 324, 406, 100, 90, 847, 850, 839, 839, 97, 97,
136879 /* 1070 */ 98, 98, 98, 98, 449, 96, 96, 96, 96, 95,
136880 /* 1080 */ 95, 94, 94, 94, 93, 350, 449, 752, 449, 344,
136881 /* 1090 */ 971, 971, 751, 278, 111, 111, 74, 714, 713, 704,
136882 /* 1100 */ 286, 877, 749, 1279, 257, 77, 109, 109, 110, 110,
136883 /* 1110 */ 1230, 285, 1134, 90, 847, 850, 839, 839, 97, 97,
136884 /* 1120 */ 98, 98, 98, 98, 1233, 96, 96, 96, 96, 95,
136885 /* 1130 */ 95, 94, 94, 94, 93, 350, 86, 444, 449, 3,
136886 /* 1140 */ 1193, 449, 1069, 132, 351, 120, 1013, 86, 444, 780,
136887 /* 1150 */ 3, 1091, 202, 376, 447, 351, 1229, 120, 55, 55,
136888 /* 1160 */ 449, 57, 57, 822, 873, 447, 449, 208, 449, 704,
136889 /* 1170 */ 449, 877, 237, 433, 435, 120, 439, 428, 361, 120,
136890 /* 1180 */ 54, 54, 132, 449, 433, 826, 52, 52, 26, 26,
136891 /* 1190 */ 30, 30, 381, 132, 408, 443, 826, 689, 264, 389,
136892 /* 1200 */ 116, 269, 272, 32, 32, 83, 84, 120, 274, 120,
136893 /* 1210 */ 120, 276, 85, 351, 451, 450, 83, 84, 818, 1054,
136894 /* 1220 */ 1038, 427, 429, 85, 351, 451, 450, 120, 120, 818,
136895 /* 1230 */ 377, 218, 281, 822, 1107, 1140, 86, 444, 409, 3,
136896 /* 1240 */ 1087, 1098, 430, 431, 351, 302, 303, 1146, 1021, 818,
136897 /* 1250 */ 818, 820, 821, 19, 447, 1015, 1004, 1003, 1005, 1273,
136898 /* 1260 */ 818, 818, 820, 821, 19, 289, 159, 291, 293, 7,
136899 /* 1270 */ 315, 173, 259, 433, 1129, 363, 252, 1232, 375, 1037,
136900 /* 1280 */ 295, 434, 168, 986, 399, 826, 284, 1204, 1203, 205,
136901 /* 1290 */ 1276, 308, 1249, 86, 444, 983, 3, 1247, 332, 144,
136902 /* 1300 */ 130, 351, 72, 135, 59, 83, 84, 756, 137, 365,
136903 /* 1310 */ 1126, 447, 85, 351, 451, 450, 139, 226, 818, 140,
136904 /* 1320 */ 156, 62, 314, 314, 313, 215, 311, 366, 392, 678,
136905 /* 1330 */ 433, 185, 141, 1234, 142, 160, 148, 1136, 1198, 382,
136906 /* 1340 */ 189, 67, 826, 180, 388, 248, 1218, 1099, 219, 818,
136907 /* 1350 */ 818, 820, 821, 19, 247, 190, 266, 154, 390, 271,
136908 /* 1360 */ 191, 192, 83, 84, 1006, 405, 1057, 182, 321, 85,
136909 /* 1370 */ 351, 451, 450, 1056, 183, 818, 341, 132, 181, 706,
136910 /* 1380 */ 1055, 420, 76, 444, 1029, 3, 322, 1028, 283, 1048,
136911 /* 1390 */ 351, 1095, 1027, 1288, 1047, 71, 204, 6, 288, 290,
136912 /* 1400 */ 447, 1096, 1094, 1093, 79, 292, 818, 818, 820, 821,
136913 /* 1410 */ 19, 294, 297, 437, 345, 441, 102, 1184, 1077, 433,
136914 /* 1420 */ 238, 425, 73, 305, 239, 304, 325, 240, 423, 306,
136915 /* 1430 */ 307, 826, 213, 1012, 22, 945, 452, 214, 216, 217,
136916 /* 1440 */ 453, 1001, 115, 996, 125, 126, 235, 127, 665, 352,
136917 /* 1450 */ 326, 83, 84, 358, 166, 244, 179, 327, 85, 351,
136918 /* 1460 */ 451, 450, 134, 356, 818, 113, 885, 806, 883, 136,
136919 /* 1470 */ 128, 138, 738, 258, 184, 899, 143, 145, 63, 64,
136920 /* 1480 */ 65, 66, 129, 902, 187, 186, 898, 8, 13, 188,
136921 /* 1490 */ 265, 891, 149, 202, 980, 818, 818, 820, 821, 19,
136922 /* 1500 */ 150, 387, 161, 680, 285, 391, 151, 395, 400, 193,
136923 /* 1510 */ 68, 14, 236, 279, 15, 69, 717, 825, 131, 824,
136924 /* 1520 */ 853, 70, 746, 16, 413, 750, 4, 174, 220, 222,
136925 /* 1530 */ 152, 779, 857, 774, 201, 77, 74, 868, 17, 854,
136926 /* 1540 */ 852, 908, 18, 907, 207, 206, 934, 163, 436, 210,
136927 /* 1550 */ 935, 164, 209, 165, 440, 856, 823, 690, 87, 211,
136928 /* 1560 */ 309, 312, 1281, 940, 1280,
136929 };
136930 static const YYCODETYPE yy_lookahead[] = {
136931 /* 0 */ 19, 115, 19, 117, 118, 24, 1, 2, 27, 79,
136932 /* 10 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
136933 /* 20 */ 90, 91, 92, 93, 94, 144, 145, 146, 147, 58,
@@ -136734,26 +137070,26 @@
137070 /* 1390 */ 27, 216, 174, 174, 182, 107, 159, 22, 215, 215,
137071 /* 1400 */ 37, 216, 216, 216, 137, 215, 132, 133, 134, 135,
137072 /* 1410 */ 136, 215, 159, 177, 94, 177, 129, 224, 205, 56,
137073 /* 1420 */ 226, 126, 128, 203, 229, 204, 114, 229, 127, 202,
137074 /* 1430 */ 201, 68, 25, 162, 26, 13, 161, 153, 153, 6,
137075 /* 1440 */ 151, 151, 178, 151, 165, 165, 178, 165, 4, 3,
137076 /* 1450 */ 249, 88, 89, 141, 22, 142, 15, 249, 95, 96,
137077 /* 1460 */ 97, 98, 246, 67, 101, 16, 23, 120, 23, 131,
137078 /* 1470 */ 111, 123, 20, 16, 125, 1, 123, 131, 78, 78,
137079 /* 1480 */ 78, 78, 111, 96, 122, 35, 1, 5, 22, 107,
137080 /* 1490 */ 140, 53, 53, 26, 60, 132, 133, 134, 135, 136,
137081 /* 1500 */ 107, 43, 24, 20, 112, 19, 22, 52, 52, 105,
137082 /* 1510 */ 22, 22, 52, 23, 22, 22, 29, 23, 39, 23,
137083 /* 1520 */ 23, 26, 116, 22, 26, 23, 22, 122, 23, 23,
137084 /* 1530 */ 22, 96, 11, 124, 35, 26, 26, 23, 35, 23,
137085 /* 1540 */ 23, 23, 35, 23, 22, 26, 23, 22, 24, 122,
137086 /* 1550 */ 23, 22, 26, 22, 24, 23, 23, 23, 22, 122,
137087 /* 1560 */ 23, 15, 122, 1, 122,
137088 };
137089 #define YY_SHIFT_USE_DFLT (1565)
137090 #define YY_SHIFT_COUNT (454)
137091 #define YY_SHIFT_MIN (-114)
137092 #define YY_SHIFT_MAX (1562)
137093 static const short yy_shift_ofst[] = {
137094 /* 0 */ 5, 1117, 1312, 1128, 1274, 1274, 1274, 1274, 61, -19,
137095 /* 10 */ 57, 57, 183, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
@@ -136765,15 +137101,15 @@
137101 /* 70 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
137102 /* 80 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
137103 /* 90 */ 1363, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
137104 /* 100 */ 1274, 1274, 1274, 1274, -70, -47, -47, -47, -47, -47,
137105 /* 110 */ 24, 11, 146, 296, 524, 444, 529, 529, 296, 3,
137106 /* 120 */ 2, -30, 1565, 1565, 1565, -17, -17, -17, 145, 145,
137107 /* 130 */ 497, 497, 265, 603, 653, 296, 296, 296, 296, 296,
137108 /* 140 */ 296, 296, 296, 296, 296, 296, 296, 296, 296, 296,
137109 /* 150 */ 296, 296, 296, 296, 296, 701, 1078, 147, 147, 2,
137110 /* 160 */ 164, 164, 164, 164, 164, 164, 1565, 1565, 1565, 223,
137111 /* 170 */ 56, 56, 268, 269, 220, 347, 351, 415, 359, 296,
137112 /* 180 */ 296, 296, 296, 296, 296, 296, 296, 296, 296, 296,
137113 /* 190 */ 296, 296, 296, 296, 296, 632, 632, 632, 296, 296,
137114 /* 200 */ 498, 296, 296, 296, 570, 296, 296, 654, 296, 296,
137115 /* 210 */ 296, 296, 296, 296, 296, 296, 296, 296, 636, 200,
@@ -136784,30 +137120,30 @@
137120 /* 260 */ 1277, 1230, 1230, 1172, 1167, 1310, 1204, 1299, 1167, 1167,
137121 /* 270 */ 1310, 1335, 1167, 1310, 1167, 1310, 1335, 1258, 1258, 1258,
137122 /* 280 */ 1329, 1335, 1258, 1273, 1258, 1329, 1258, 1258, 1256, 1288,
137123 /* 290 */ 1256, 1288, 1256, 1288, 1256, 1288, 1167, 1375, 1167, 1267,
137124 /* 300 */ 1335, 1320, 1320, 1335, 1287, 1295, 1294, 1301, 1172, 1407,
137125 /* 310 */ 1408, 1422, 1422, 1433, 1433, 1433, 1565, 1565, 1565, 1565,
137126 /* 320 */ 1565, 1565, 1565, 1565, 558, 537, 684, 719, 734, 799,
137127 /* 330 */ 840, 1019, 14, 1020, 1021, 1025, 1026, 1027, 1070, 1072,
137128 /* 340 */ 997, 1047, 999, 1079, 1126, 1074, 1141, 694, 819, 1174,
137129 /* 350 */ 1136, 981, 1444, 1446, 1432, 1313, 1441, 1396, 1449, 1443,
137130 /* 360 */ 1445, 1347, 1338, 1359, 1348, 1452, 1349, 1457, 1474, 1353,
137131 /* 370 */ 1346, 1400, 1401, 1402, 1403, 1371, 1387, 1450, 1362, 1485,
137132 /* 380 */ 1482, 1466, 1382, 1350, 1438, 1467, 1439, 1434, 1458, 1393,
137133 /* 390 */ 1478, 1483, 1486, 1392, 1404, 1484, 1455, 1488, 1489, 1490,
137134 /* 400 */ 1492, 1456, 1487, 1493, 1460, 1479, 1494, 1496, 1497, 1495,
137135 /* 410 */ 1406, 1501, 1502, 1504, 1498, 1405, 1505, 1506, 1435, 1499,
137136 /* 420 */ 1508, 1409, 1509, 1503, 1510, 1507, 1514, 1509, 1516, 1517,
137137 /* 430 */ 1518, 1519, 1520, 1522, 1521, 1523, 1525, 1524, 1526, 1527,
137138 /* 440 */ 1529, 1530, 1526, 1532, 1531, 1533, 1534, 1536, 1427, 1437,
137139 /* 450 */ 1440, 1442, 1537, 1546, 1562,
137140 };
137141 #define YY_REDUCE_USE_DFLT (-174)
137142 #define YY_REDUCE_COUNT (323)
137143 #define YY_REDUCE_MIN (-173)
137144 #define YY_REDUCE_MAX (1292)
137145 static const short yy_reduce_ofst[] = {
137146 /* 0 */ -119, 1014, 131, 1031, -12, 225, 228, 300, -40, -45,
137147 /* 10 */ 243, 256, 293, 129, 218, 418, 79, 376, 433, 298,
137148 /* 20 */ 16, 137, 367, 323, -38, 391, -173, -173, -173, -173,
137149 /* 30 */ -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,
@@ -136836,60 +137172,60 @@
137172 /* 260 */ 1115, 1147, 1148, 1137, 1180, 1182, 1110, 1121, 1188, 1189,
137173 /* 270 */ 1197, 1181, 1200, 1202, 1205, 1203, 1191, 1192, 1199, 1206,
137174 /* 280 */ 1207, 1209, 1210, 1211, 1214, 1212, 1218, 1219, 1175, 1183,
137175 /* 290 */ 1185, 1184, 1186, 1190, 1187, 1196, 1237, 1193, 1253, 1194,
137176 /* 300 */ 1236, 1195, 1198, 1238, 1213, 1221, 1220, 1227, 1229, 1271,
137177 /* 310 */ 1275, 1284, 1285, 1289, 1290, 1292, 1201, 1208, 1216, 1279,
137178 /* 320 */ 1280, 1264, 1268, 1282,
137179 };
137180 static const YYACTIONTYPE yy_default[] = {
137181 /* 0 */ 1270, 1260, 1260, 1260, 1193, 1193, 1193, 1193, 1260, 1088,
137182 /* 10 */ 1117, 1117, 1244, 1322, 1322, 1322, 1322, 1322, 1322, 1192,
137183 /* 20 */ 1322, 1322, 1322, 1322, 1260, 1092, 1123, 1322, 1322, 1322,
137184 /* 30 */ 1322, 1194, 1195, 1322, 1322, 1322, 1243, 1245, 1133, 1132,
137185 /* 40 */ 1131, 1130, 1226, 1104, 1128, 1121, 1125, 1194, 1188, 1189,
137186 /* 50 */ 1187, 1191, 1195, 1322, 1124, 1158, 1172, 1157, 1322, 1322,
137187 /* 60 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137188 /* 70 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137189 /* 80 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137190 /* 90 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137191 /* 100 */ 1322, 1322, 1322, 1322, 1166, 1171, 1178, 1170, 1167, 1160,
137192 /* 110 */ 1159, 1161, 1162, 1322, 1011, 1059, 1322, 1322, 1322, 1163,
137193 /* 120 */ 1322, 1164, 1175, 1174, 1173, 1251, 1278, 1277, 1322, 1322,
137194 /* 130 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137195 /* 140 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137196 /* 150 */ 1322, 1322, 1322, 1322, 1322, 1270, 1260, 1017, 1017, 1322,
137197 /* 160 */ 1260, 1260, 1260, 1260, 1260, 1260, 1256, 1092, 1083, 1322,
137198 /* 170 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137199 /* 180 */ 1248, 1246, 1322, 1208, 1322, 1322, 1322, 1322, 1322, 1322,
137200 /* 190 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137201 /* 200 */ 1322, 1322, 1322, 1322, 1088, 1322, 1322, 1322, 1322, 1322,
137202 /* 210 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1272, 1322, 1221,
137203 /* 220 */ 1088, 1088, 1088, 1090, 1072, 1082, 997, 1127, 1106, 1106,
137204 /* 230 */ 1311, 1127, 1311, 1034, 1292, 1031, 1117, 1106, 1190, 1117,
137205 /* 240 */ 1117, 1089, 1082, 1322, 1314, 1097, 1097, 1313, 1313, 1097,
137206 /* 250 */ 1138, 1062, 1127, 1068, 1068, 1068, 1068, 1097, 1008, 1127,
137207 /* 260 */ 1138, 1062, 1062, 1127, 1097, 1008, 1225, 1308, 1097, 1097,
137208 /* 270 */ 1008, 1201, 1097, 1008, 1097, 1008, 1201, 1060, 1060, 1060,
137209 /* 280 */ 1049, 1201, 1060, 1034, 1060, 1049, 1060, 1060, 1110, 1105,
137210 /* 290 */ 1110, 1105, 1110, 1105, 1110, 1105, 1097, 1196, 1097, 1322,
137211 /* 300 */ 1201, 1205, 1205, 1201, 1122, 1111, 1120, 1118, 1127, 1014,
137212 /* 310 */ 1052, 1275, 1275, 1271, 1271, 1271, 1319, 1319, 1256, 1287,
137213 /* 320 */ 1287, 1036, 1036, 1287, 1322, 1322, 1322, 1322, 1322, 1322,
137214 /* 330 */ 1282, 1322, 1210, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137215 /* 340 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137216 /* 350 */ 1322, 1143, 1322, 993, 1253, 1322, 1322, 1252, 1322, 1322,
137217 /* 360 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137218 /* 370 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1310, 1322,
137219 /* 380 */ 1322, 1322, 1322, 1322, 1322, 1224, 1223, 1322, 1322, 1322,
137220 /* 390 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137221 /* 400 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
137222 /* 410 */ 1074, 1322, 1322, 1322, 1296, 1322, 1322, 1322, 1322, 1322,
137223 /* 420 */ 1322, 1322, 1119, 1322, 1112, 1322, 1322, 1301, 1322, 1322,
137224 /* 430 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1262, 1322,
137225 /* 440 */ 1322, 1322, 1261, 1322, 1322, 1322, 1322, 1322, 1145, 1322,
137226 /* 450 */ 1144, 1148, 1322, 1002, 1322,
137227 };
137228 /********** End of lemon-generated parsing tables *****************************/
137229
137230 /* The next table maps tokens (terminal symbols) into fallback tokens.
137231 ** If a construct like the following:
@@ -137138,333 +137474,331 @@
137474 /* 3 */ "cmd ::= BEGIN transtype trans_opt",
137475 /* 4 */ "transtype ::=",
137476 /* 5 */ "transtype ::= DEFERRED",
137477 /* 6 */ "transtype ::= IMMEDIATE",
137478 /* 7 */ "transtype ::= EXCLUSIVE",
137479 /* 8 */ "cmd ::= COMMIT|END trans_opt",
137480 /* 9 */ "cmd ::= ROLLBACK trans_opt",
137481 /* 10 */ "cmd ::= SAVEPOINT nm",
137482 /* 11 */ "cmd ::= RELEASE savepoint_opt nm",
137483 /* 12 */ "cmd ::= ROLLBACK trans_opt TO savepoint_opt nm",
137484 /* 13 */ "create_table ::= createkw temp TABLE ifnotexists nm dbnm",
137485 /* 14 */ "createkw ::= CREATE",
137486 /* 15 */ "ifnotexists ::=",
137487 /* 16 */ "ifnotexists ::= IF NOT EXISTS",
137488 /* 17 */ "temp ::= TEMP",
137489 /* 18 */ "temp ::=",
137490 /* 19 */ "create_table_args ::= LP columnlist conslist_opt RP table_options",
137491 /* 20 */ "create_table_args ::= AS select",
137492 /* 21 */ "table_options ::=",
137493 /* 22 */ "table_options ::= WITHOUT nm",
137494 /* 23 */ "columnname ::= nm typetoken",
137495 /* 24 */ "typetoken ::=",
137496 /* 25 */ "typetoken ::= typename LP signed RP",
137497 /* 26 */ "typetoken ::= typename LP signed COMMA signed RP",
137498 /* 27 */ "typename ::= typename ID|STRING",
137499 /* 28 */ "ccons ::= CONSTRAINT nm",
137500 /* 29 */ "ccons ::= DEFAULT term",
137501 /* 30 */ "ccons ::= DEFAULT LP expr RP",
137502 /* 31 */ "ccons ::= DEFAULT PLUS term",
137503 /* 32 */ "ccons ::= DEFAULT MINUS term",
137504 /* 33 */ "ccons ::= DEFAULT ID|INDEXED",
137505 /* 34 */ "ccons ::= NOT NULL onconf",
137506 /* 35 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
137507 /* 36 */ "ccons ::= UNIQUE onconf",
137508 /* 37 */ "ccons ::= CHECK LP expr RP",
137509 /* 38 */ "ccons ::= REFERENCES nm eidlist_opt refargs",
137510 /* 39 */ "ccons ::= defer_subclause",
137511 /* 40 */ "ccons ::= COLLATE ID|STRING",
137512 /* 41 */ "autoinc ::=",
137513 /* 42 */ "autoinc ::= AUTOINCR",
137514 /* 43 */ "refargs ::=",
137515 /* 44 */ "refargs ::= refargs refarg",
137516 /* 45 */ "refarg ::= MATCH nm",
137517 /* 46 */ "refarg ::= ON INSERT refact",
137518 /* 47 */ "refarg ::= ON DELETE refact",
137519 /* 48 */ "refarg ::= ON UPDATE refact",
137520 /* 49 */ "refact ::= SET NULL",
137521 /* 50 */ "refact ::= SET DEFAULT",
137522 /* 51 */ "refact ::= CASCADE",
137523 /* 52 */ "refact ::= RESTRICT",
137524 /* 53 */ "refact ::= NO ACTION",
137525 /* 54 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
137526 /* 55 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
137527 /* 56 */ "init_deferred_pred_opt ::=",
137528 /* 57 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
137529 /* 58 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
137530 /* 59 */ "conslist_opt ::=",
137531 /* 60 */ "tconscomma ::= COMMA",
137532 /* 61 */ "tcons ::= CONSTRAINT nm",
137533 /* 62 */ "tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf",
137534 /* 63 */ "tcons ::= UNIQUE LP sortlist RP onconf",
137535 /* 64 */ "tcons ::= CHECK LP expr RP onconf",
137536 /* 65 */ "tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt",
137537 /* 66 */ "defer_subclause_opt ::=",
137538 /* 67 */ "onconf ::=",
137539 /* 68 */ "onconf ::= ON CONFLICT resolvetype",
137540 /* 69 */ "orconf ::=",
137541 /* 70 */ "orconf ::= OR resolvetype",
137542 /* 71 */ "resolvetype ::= IGNORE",
137543 /* 72 */ "resolvetype ::= REPLACE",
137544 /* 73 */ "cmd ::= DROP TABLE ifexists fullname",
137545 /* 74 */ "ifexists ::= IF EXISTS",
137546 /* 75 */ "ifexists ::=",
137547 /* 76 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select",
137548 /* 77 */ "cmd ::= DROP VIEW ifexists fullname",
137549 /* 78 */ "cmd ::= select",
137550 /* 79 */ "select ::= with selectnowith",
137551 /* 80 */ "selectnowith ::= selectnowith multiselect_op oneselect",
137552 /* 81 */ "multiselect_op ::= UNION",
137553 /* 82 */ "multiselect_op ::= UNION ALL",
137554 /* 83 */ "multiselect_op ::= EXCEPT|INTERSECT",
137555 /* 84 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
137556 /* 85 */ "values ::= VALUES LP nexprlist RP",
137557 /* 86 */ "values ::= values COMMA LP exprlist RP",
137558 /* 87 */ "distinct ::= DISTINCT",
137559 /* 88 */ "distinct ::= ALL",
137560 /* 89 */ "distinct ::=",
137561 /* 90 */ "sclp ::=",
137562 /* 91 */ "selcollist ::= sclp expr as",
137563 /* 92 */ "selcollist ::= sclp STAR",
137564 /* 93 */ "selcollist ::= sclp nm DOT STAR",
137565 /* 94 */ "as ::= AS nm",
137566 /* 95 */ "as ::=",
137567 /* 96 */ "from ::=",
137568 /* 97 */ "from ::= FROM seltablist",
137569 /* 98 */ "stl_prefix ::= seltablist joinop",
137570 /* 99 */ "stl_prefix ::=",
137571 /* 100 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt",
137572 /* 101 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt",
137573 /* 102 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt",
137574 /* 103 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
137575 /* 104 */ "dbnm ::=",
137576 /* 105 */ "dbnm ::= DOT nm",
137577 /* 106 */ "fullname ::= nm dbnm",
137578 /* 107 */ "joinop ::= COMMA|JOIN",
137579 /* 108 */ "joinop ::= JOIN_KW JOIN",
137580 /* 109 */ "joinop ::= JOIN_KW nm JOIN",
137581 /* 110 */ "joinop ::= JOIN_KW nm nm JOIN",
137582 /* 111 */ "on_opt ::= ON expr",
137583 /* 112 */ "on_opt ::=",
137584 /* 113 */ "indexed_opt ::=",
137585 /* 114 */ "indexed_opt ::= INDEXED BY nm",
137586 /* 115 */ "indexed_opt ::= NOT INDEXED",
137587 /* 116 */ "using_opt ::= USING LP idlist RP",
137588 /* 117 */ "using_opt ::=",
137589 /* 118 */ "orderby_opt ::=",
137590 /* 119 */ "orderby_opt ::= ORDER BY sortlist",
137591 /* 120 */ "sortlist ::= sortlist COMMA expr sortorder",
137592 /* 121 */ "sortlist ::= expr sortorder",
137593 /* 122 */ "sortorder ::= ASC",
137594 /* 123 */ "sortorder ::= DESC",
137595 /* 124 */ "sortorder ::=",
137596 /* 125 */ "groupby_opt ::=",
137597 /* 126 */ "groupby_opt ::= GROUP BY nexprlist",
137598 /* 127 */ "having_opt ::=",
137599 /* 128 */ "having_opt ::= HAVING expr",
137600 /* 129 */ "limit_opt ::=",
137601 /* 130 */ "limit_opt ::= LIMIT expr",
137602 /* 131 */ "limit_opt ::= LIMIT expr OFFSET expr",
137603 /* 132 */ "limit_opt ::= LIMIT expr COMMA expr",
137604 /* 133 */ "cmd ::= with DELETE FROM fullname indexed_opt where_opt",
137605 /* 134 */ "where_opt ::=",
137606 /* 135 */ "where_opt ::= WHERE expr",
137607 /* 136 */ "cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt",
137608 /* 137 */ "setlist ::= setlist COMMA nm EQ expr",
137609 /* 138 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
137610 /* 139 */ "setlist ::= nm EQ expr",
137611 /* 140 */ "setlist ::= LP idlist RP EQ expr",
137612 /* 141 */ "cmd ::= with insert_cmd INTO fullname idlist_opt select",
137613 /* 142 */ "cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES",
137614 /* 143 */ "insert_cmd ::= INSERT orconf",
137615 /* 144 */ "insert_cmd ::= REPLACE",
137616 /* 145 */ "idlist_opt ::=",
137617 /* 146 */ "idlist_opt ::= LP idlist RP",
137618 /* 147 */ "idlist ::= idlist COMMA nm",
137619 /* 148 */ "idlist ::= nm",
137620 /* 149 */ "expr ::= LP expr RP",
137621 /* 150 */ "expr ::= ID|INDEXED",
137622 /* 151 */ "expr ::= JOIN_KW",
137623 /* 152 */ "expr ::= nm DOT nm",
137624 /* 153 */ "expr ::= nm DOT nm DOT nm",
137625 /* 154 */ "term ::= NULL|FLOAT|BLOB",
137626 /* 155 */ "term ::= STRING",
137627 /* 156 */ "term ::= INTEGER",
137628 /* 157 */ "expr ::= VARIABLE",
137629 /* 158 */ "expr ::= expr COLLATE ID|STRING",
137630 /* 159 */ "expr ::= CAST LP expr AS typetoken RP",
137631 /* 160 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
137632 /* 161 */ "expr ::= ID|INDEXED LP STAR RP",
137633 /* 162 */ "term ::= CTIME_KW",
137634 /* 163 */ "expr ::= LP nexprlist COMMA expr RP",
137635 /* 164 */ "expr ::= expr AND expr",
137636 /* 165 */ "expr ::= expr OR expr",
137637 /* 166 */ "expr ::= expr LT|GT|GE|LE expr",
137638 /* 167 */ "expr ::= expr EQ|NE expr",
137639 /* 168 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
137640 /* 169 */ "expr ::= expr PLUS|MINUS expr",
137641 /* 170 */ "expr ::= expr STAR|SLASH|REM expr",
137642 /* 171 */ "expr ::= expr CONCAT expr",
137643 /* 172 */ "likeop ::= NOT LIKE_KW|MATCH",
137644 /* 173 */ "expr ::= expr likeop expr",
137645 /* 174 */ "expr ::= expr likeop expr ESCAPE expr",
137646 /* 175 */ "expr ::= expr ISNULL|NOTNULL",
137647 /* 176 */ "expr ::= expr NOT NULL",
137648 /* 177 */ "expr ::= expr IS expr",
137649 /* 178 */ "expr ::= expr IS NOT expr",
137650 /* 179 */ "expr ::= NOT expr",
137651 /* 180 */ "expr ::= BITNOT expr",
137652 /* 181 */ "expr ::= MINUS expr",
137653 /* 182 */ "expr ::= PLUS expr",
137654 /* 183 */ "between_op ::= BETWEEN",
137655 /* 184 */ "between_op ::= NOT BETWEEN",
137656 /* 185 */ "expr ::= expr between_op expr AND expr",
137657 /* 186 */ "in_op ::= IN",
137658 /* 187 */ "in_op ::= NOT IN",
137659 /* 188 */ "expr ::= expr in_op LP exprlist RP",
137660 /* 189 */ "expr ::= LP select RP",
137661 /* 190 */ "expr ::= expr in_op LP select RP",
137662 /* 191 */ "expr ::= expr in_op nm dbnm paren_exprlist",
137663 /* 192 */ "expr ::= EXISTS LP select RP",
137664 /* 193 */ "expr ::= CASE case_operand case_exprlist case_else END",
137665 /* 194 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
137666 /* 195 */ "case_exprlist ::= WHEN expr THEN expr",
137667 /* 196 */ "case_else ::= ELSE expr",
137668 /* 197 */ "case_else ::=",
137669 /* 198 */ "case_operand ::= expr",
137670 /* 199 */ "case_operand ::=",
137671 /* 200 */ "exprlist ::=",
137672 /* 201 */ "nexprlist ::= nexprlist COMMA expr",
137673 /* 202 */ "nexprlist ::= expr",
137674 /* 203 */ "paren_exprlist ::=",
137675 /* 204 */ "paren_exprlist ::= LP exprlist RP",
137676 /* 205 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
137677 /* 206 */ "uniqueflag ::= UNIQUE",
137678 /* 207 */ "uniqueflag ::=",
137679 /* 208 */ "eidlist_opt ::=",
137680 /* 209 */ "eidlist_opt ::= LP eidlist RP",
137681 /* 210 */ "eidlist ::= eidlist COMMA nm collate sortorder",
137682 /* 211 */ "eidlist ::= nm collate sortorder",
137683 /* 212 */ "collate ::=",
137684 /* 213 */ "collate ::= COLLATE ID|STRING",
137685 /* 214 */ "cmd ::= DROP INDEX ifexists fullname",
137686 /* 215 */ "cmd ::= VACUUM",
137687 /* 216 */ "cmd ::= VACUUM nm",
137688 /* 217 */ "cmd ::= PRAGMA nm dbnm",
137689 /* 218 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
137690 /* 219 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
137691 /* 220 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
137692 /* 221 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
137693 /* 222 */ "plus_num ::= PLUS INTEGER|FLOAT",
137694 /* 223 */ "minus_num ::= MINUS INTEGER|FLOAT",
137695 /* 224 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
137696 /* 225 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
137697 /* 226 */ "trigger_time ::= BEFORE|AFTER",
137698 /* 227 */ "trigger_time ::= INSTEAD OF",
137699 /* 228 */ "trigger_time ::=",
137700 /* 229 */ "trigger_event ::= DELETE|INSERT",
137701 /* 230 */ "trigger_event ::= UPDATE",
137702 /* 231 */ "trigger_event ::= UPDATE OF idlist",
137703 /* 232 */ "when_clause ::=",
137704 /* 233 */ "when_clause ::= WHEN expr",
137705 /* 234 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
137706 /* 235 */ "trigger_cmd_list ::= trigger_cmd SEMI",
137707 /* 236 */ "trnm ::= nm DOT nm",
137708 /* 237 */ "tridxby ::= INDEXED BY nm",
137709 /* 238 */ "tridxby ::= NOT INDEXED",
137710 /* 239 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt",
137711 /* 240 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select",
137712 /* 241 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
137713 /* 242 */ "trigger_cmd ::= select",
137714 /* 243 */ "expr ::= RAISE LP IGNORE RP",
137715 /* 244 */ "expr ::= RAISE LP raisetype COMMA nm RP",
137716 /* 245 */ "raisetype ::= ROLLBACK",
137717 /* 246 */ "raisetype ::= ABORT",
137718 /* 247 */ "raisetype ::= FAIL",
137719 /* 248 */ "cmd ::= DROP TRIGGER ifexists fullname",
137720 /* 249 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
137721 /* 250 */ "cmd ::= DETACH database_kw_opt expr",
137722 /* 251 */ "key_opt ::=",
137723 /* 252 */ "key_opt ::= KEY expr",
137724 /* 253 */ "cmd ::= REINDEX",
137725 /* 254 */ "cmd ::= REINDEX nm dbnm",
137726 /* 255 */ "cmd ::= ANALYZE",
137727 /* 256 */ "cmd ::= ANALYZE nm dbnm",
137728 /* 257 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
137729 /* 258 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
137730 /* 259 */ "add_column_fullname ::= fullname",
137731 /* 260 */ "cmd ::= create_vtab",
137732 /* 261 */ "cmd ::= create_vtab LP vtabarglist RP",
137733 /* 262 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
137734 /* 263 */ "vtabarg ::=",
137735 /* 264 */ "vtabargtoken ::= ANY",
137736 /* 265 */ "vtabargtoken ::= lp anylist RP",
137737 /* 266 */ "lp ::= LP",
137738 /* 267 */ "with ::=",
137739 /* 268 */ "with ::= WITH wqlist",
137740 /* 269 */ "with ::= WITH RECURSIVE wqlist",
137741 /* 270 */ "wqlist ::= nm eidlist_opt AS LP select RP",
137742 /* 271 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
137743 /* 272 */ "input ::= cmdlist",
137744 /* 273 */ "cmdlist ::= cmdlist ecmd",
137745 /* 274 */ "cmdlist ::= ecmd",
137746 /* 275 */ "ecmd ::= SEMI",
137747 /* 276 */ "ecmd ::= explain cmdx SEMI",
137748 /* 277 */ "explain ::=",
137749 /* 278 */ "trans_opt ::=",
137750 /* 279 */ "trans_opt ::= TRANSACTION",
137751 /* 280 */ "trans_opt ::= TRANSACTION nm",
137752 /* 281 */ "savepoint_opt ::= SAVEPOINT",
137753 /* 282 */ "savepoint_opt ::=",
137754 /* 283 */ "cmd ::= create_table create_table_args",
137755 /* 284 */ "columnlist ::= columnlist COMMA columnname carglist",
137756 /* 285 */ "columnlist ::= columnname carglist",
137757 /* 286 */ "nm ::= ID|INDEXED",
137758 /* 287 */ "nm ::= STRING",
137759 /* 288 */ "nm ::= JOIN_KW",
137760 /* 289 */ "typetoken ::= typename",
137761 /* 290 */ "typename ::= ID|STRING",
137762 /* 291 */ "signed ::= plus_num",
137763 /* 292 */ "signed ::= minus_num",
137764 /* 293 */ "carglist ::= carglist ccons",
137765 /* 294 */ "carglist ::=",
137766 /* 295 */ "ccons ::= NULL onconf",
137767 /* 296 */ "conslist_opt ::= COMMA conslist",
137768 /* 297 */ "conslist ::= conslist tconscomma tcons",
137769 /* 298 */ "conslist ::= tcons",
137770 /* 299 */ "tconscomma ::=",
137771 /* 300 */ "defer_subclause_opt ::= defer_subclause",
137772 /* 301 */ "resolvetype ::= raisetype",
137773 /* 302 */ "selectnowith ::= oneselect",
137774 /* 303 */ "oneselect ::= values",
137775 /* 304 */ "sclp ::= selcollist COMMA",
137776 /* 305 */ "as ::= ID|STRING",
137777 /* 306 */ "expr ::= term",
137778 /* 307 */ "likeop ::= LIKE_KW|MATCH",
137779 /* 308 */ "exprlist ::= nexprlist",
137780 /* 309 */ "nmnum ::= plus_num",
137781 /* 310 */ "nmnum ::= nm",
137782 /* 311 */ "nmnum ::= ON",
137783 /* 312 */ "nmnum ::= DELETE",
137784 /* 313 */ "nmnum ::= DEFAULT",
137785 /* 314 */ "plus_num ::= INTEGER|FLOAT",
137786 /* 315 */ "foreach_clause ::=",
137787 /* 316 */ "foreach_clause ::= FOR EACH ROW",
137788 /* 317 */ "trnm ::= nm",
137789 /* 318 */ "tridxby ::=",
137790 /* 319 */ "database_kw_opt ::= DATABASE",
137791 /* 320 */ "database_kw_opt ::=",
137792 /* 321 */ "kwcolumn_opt ::=",
137793 /* 322 */ "kwcolumn_opt ::= COLUMNKW",
137794 /* 323 */ "vtabarglist ::= vtabarg",
137795 /* 324 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
137796 /* 325 */ "vtabarg ::= vtabarg vtabargtoken",
137797 /* 326 */ "anylist ::=",
137798 /* 327 */ "anylist ::= anylist LP anylist RP",
137799 /* 328 */ "anylist ::= anylist ANY",
 
 
137800 };
137801 #endif /* NDEBUG */
137802
137803
137804 #if YYSTACKDEPTH<=0
@@ -137529,11 +137863,13 @@
137863 pParser->yyerrcnt = -1;
137864 #endif
137865 pParser->yytos = pParser->yystack;
137866 pParser->yystack[0].stateno = 0;
137867 pParser->yystack[0].major = 0;
137868 #if YYSTACKDEPTH>0
137869 pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1];
137870 #endif
137871 }
137872
137873 #ifndef sqlite3Parser_ENGINEALWAYSONSTACK
137874 /*
137875 ** This function allocates a new parser.
@@ -137914,11 +138250,10 @@
138250 { 150, -1 },
138251 { 150, -1 },
138252 { 149, -2 },
138253 { 149, -2 },
138254 { 149, -2 },
 
138255 { 149, -3 },
138256 { 149, -5 },
138257 { 154, -6 },
138258 { 156, -1 },
138259 { 158, 0 },
@@ -138054,11 +138389,10 @@
138389 { 220, 0 },
138390 { 220, -3 },
138391 { 217, -3 },
138392 { 217, -1 },
138393 { 173, -3 },
 
138394 { 173, -1 },
138395 { 173, -1 },
138396 { 173, -3 },
138397 { 173, -5 },
138398 { 172, -1 },
@@ -138317,256 +138651,253 @@
138651 case 5: /* transtype ::= DEFERRED */
138652 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
138653 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
138654 {yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-X*/}
138655 break;
138656 case 8: /* cmd ::= COMMIT|END trans_opt */
138657 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
138658 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
138659 break;
138660 case 10: /* cmd ::= SAVEPOINT nm */
 
 
 
138661 {
138662 sqlite3Savepoint(pParse, SAVEPOINT_BEGIN, &yymsp[0].minor.yy0);
138663 }
138664 break;
138665 case 11: /* cmd ::= RELEASE savepoint_opt nm */
138666 {
138667 sqlite3Savepoint(pParse, SAVEPOINT_RELEASE, &yymsp[0].minor.yy0);
138668 }
138669 break;
138670 case 12: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
138671 {
138672 sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
138673 }
138674 break;
138675 case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
138676 {
138677 sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy194,0,0,yymsp[-2].minor.yy194);
138678 }
138679 break;
138680 case 14: /* createkw ::= CREATE */
138681 {disableLookaside(pParse);}
138682 break;
138683 case 15: /* ifnotexists ::= */
138684 case 18: /* temp ::= */ yytestcase(yyruleno==18);
138685 case 21: /* table_options ::= */ yytestcase(yyruleno==21);
138686 case 41: /* autoinc ::= */ yytestcase(yyruleno==41);
138687 case 56: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==56);
138688 case 66: /* defer_subclause_opt ::= */ yytestcase(yyruleno==66);
138689 case 75: /* ifexists ::= */ yytestcase(yyruleno==75);
138690 case 89: /* distinct ::= */ yytestcase(yyruleno==89);
138691 case 212: /* collate ::= */ yytestcase(yyruleno==212);
138692 {yymsp[1].minor.yy194 = 0;}
138693 break;
138694 case 16: /* ifnotexists ::= IF NOT EXISTS */
138695 {yymsp[-2].minor.yy194 = 1;}
138696 break;
138697 case 17: /* temp ::= TEMP */
138698 case 42: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==42);
138699 {yymsp[0].minor.yy194 = 1;}
138700 break;
138701 case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */
138702 {
138703 sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy194,0);
138704 }
138705 break;
138706 case 20: /* create_table_args ::= AS select */
138707 {
138708 sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy243);
138709 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy243);
138710 }
138711 break;
138712 case 22: /* table_options ::= WITHOUT nm */
138713 {
138714 if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
138715 yymsp[-1].minor.yy194 = TF_WithoutRowid | TF_NoVisibleRowid;
138716 }else{
138717 yymsp[-1].minor.yy194 = 0;
138718 sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z);
138719 }
138720 }
138721 break;
138722 case 23: /* columnname ::= nm typetoken */
138723 {sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
138724 break;
138725 case 24: /* typetoken ::= */
138726 case 59: /* conslist_opt ::= */ yytestcase(yyruleno==59);
138727 case 95: /* as ::= */ yytestcase(yyruleno==95);
138728 {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;}
138729 break;
138730 case 25: /* typetoken ::= typename LP signed RP */
138731 {
138732 yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);
138733 }
138734 break;
138735 case 26: /* typetoken ::= typename LP signed COMMA signed RP */
138736 {
138737 yymsp[-5].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z);
138738 }
138739 break;
138740 case 27: /* typename ::= typename ID|STRING */
138741 {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
138742 break;
138743 case 28: /* ccons ::= CONSTRAINT nm */
138744 case 61: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==61);
138745 {pParse->constraintName = yymsp[0].minor.yy0;}
138746 break;
138747 case 29: /* ccons ::= DEFAULT term */
138748 case 31: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==31);
138749 {sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy190);}
138750 break;
138751 case 30: /* ccons ::= DEFAULT LP expr RP */
138752 {sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy190);}
138753 break;
138754 case 32: /* ccons ::= DEFAULT MINUS term */
138755 {
138756 ExprSpan v;
138757 v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy190.pExpr, 0);
138758 v.zStart = yymsp[-1].minor.yy0.z;
138759 v.zEnd = yymsp[0].minor.yy190.zEnd;
138760 sqlite3AddDefaultValue(pParse,&v);
138761 }
138762 break;
138763 case 33: /* ccons ::= DEFAULT ID|INDEXED */
138764 {
138765 ExprSpan v;
138766 spanExpr(&v, pParse, TK_STRING, yymsp[0].minor.yy0);
138767 sqlite3AddDefaultValue(pParse,&v);
138768 }
138769 break;
138770 case 34: /* ccons ::= NOT NULL onconf */
138771 {sqlite3AddNotNull(pParse, yymsp[0].minor.yy194);}
138772 break;
138773 case 35: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
138774 {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy194,yymsp[0].minor.yy194,yymsp[-2].minor.yy194);}
138775 break;
138776 case 36: /* ccons ::= UNIQUE onconf */
138777 {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy194,0,0,0,0,
138778 SQLITE_IDXTYPE_UNIQUE);}
138779 break;
138780 case 37: /* ccons ::= CHECK LP expr RP */
138781 {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy190.pExpr);}
138782 break;
138783 case 38: /* ccons ::= REFERENCES nm eidlist_opt refargs */
138784 {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy148,yymsp[0].minor.yy194);}
138785 break;
138786 case 39: /* ccons ::= defer_subclause */
138787 {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy194);}
138788 break;
138789 case 40: /* ccons ::= COLLATE ID|STRING */
138790 {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
138791 break;
138792 case 43: /* refargs ::= */
138793 { yymsp[1].minor.yy194 = OE_None*0x0101; /* EV: R-19803-45884 */}
138794 break;
138795 case 44: /* refargs ::= refargs refarg */
138796 { yymsp[-1].minor.yy194 = (yymsp[-1].minor.yy194 & ~yymsp[0].minor.yy497.mask) | yymsp[0].minor.yy497.value; }
138797 break;
138798 case 45: /* refarg ::= MATCH nm */
138799 { yymsp[-1].minor.yy497.value = 0; yymsp[-1].minor.yy497.mask = 0x000000; }
138800 break;
138801 case 46: /* refarg ::= ON INSERT refact */
138802 { yymsp[-2].minor.yy497.value = 0; yymsp[-2].minor.yy497.mask = 0x000000; }
138803 break;
138804 case 47: /* refarg ::= ON DELETE refact */
138805 { yymsp[-2].minor.yy497.value = yymsp[0].minor.yy194; yymsp[-2].minor.yy497.mask = 0x0000ff; }
138806 break;
138807 case 48: /* refarg ::= ON UPDATE refact */
138808 { yymsp[-2].minor.yy497.value = yymsp[0].minor.yy194<<8; yymsp[-2].minor.yy497.mask = 0x00ff00; }
138809 break;
138810 case 49: /* refact ::= SET NULL */
138811 { yymsp[-1].minor.yy194 = OE_SetNull; /* EV: R-33326-45252 */}
138812 break;
138813 case 50: /* refact ::= SET DEFAULT */
138814 { yymsp[-1].minor.yy194 = OE_SetDflt; /* EV: R-33326-45252 */}
138815 break;
138816 case 51: /* refact ::= CASCADE */
138817 { yymsp[0].minor.yy194 = OE_Cascade; /* EV: R-33326-45252 */}
138818 break;
138819 case 52: /* refact ::= RESTRICT */
138820 { yymsp[0].minor.yy194 = OE_Restrict; /* EV: R-33326-45252 */}
138821 break;
138822 case 53: /* refact ::= NO ACTION */
138823 { yymsp[-1].minor.yy194 = OE_None; /* EV: R-33326-45252 */}
138824 break;
138825 case 54: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
138826 {yymsp[-2].minor.yy194 = 0;}
138827 break;
138828 case 55: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
138829 case 70: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==70);
138830 case 143: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==143);
138831 {yymsp[-1].minor.yy194 = yymsp[0].minor.yy194;}
138832 break;
138833 case 57: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
138834 case 74: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==74);
138835 case 184: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==184);
138836 case 187: /* in_op ::= NOT IN */ yytestcase(yyruleno==187);
138837 case 213: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==213);
138838 {yymsp[-1].minor.yy194 = 1;}
138839 break;
138840 case 58: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
138841 {yymsp[-1].minor.yy194 = 0;}
138842 break;
138843 case 60: /* tconscomma ::= COMMA */
138844 {pParse->constraintName.n = 0;}
138845 break;
138846 case 62: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
138847 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy148,yymsp[0].minor.yy194,yymsp[-2].minor.yy194,0);}
138848 break;
138849 case 63: /* tcons ::= UNIQUE LP sortlist RP onconf */
138850 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy148,yymsp[0].minor.yy194,0,0,0,0,
138851 SQLITE_IDXTYPE_UNIQUE);}
138852 break;
138853 case 64: /* tcons ::= CHECK LP expr RP onconf */
138854 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy190.pExpr);}
138855 break;
138856 case 65: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
138857 {
138858 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy148, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy148, yymsp[-1].minor.yy194);
138859 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy194);
138860 }
138861 break;
138862 case 67: /* onconf ::= */
138863 case 69: /* orconf ::= */ yytestcase(yyruleno==69);
138864 {yymsp[1].minor.yy194 = OE_Default;}
138865 break;
138866 case 68: /* onconf ::= ON CONFLICT resolvetype */
138867 {yymsp[-2].minor.yy194 = yymsp[0].minor.yy194;}
138868 break;
138869 case 71: /* resolvetype ::= IGNORE */
138870 {yymsp[0].minor.yy194 = OE_Ignore;}
138871 break;
138872 case 72: /* resolvetype ::= REPLACE */
138873 case 144: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==144);
138874 {yymsp[0].minor.yy194 = OE_Replace;}
138875 break;
138876 case 73: /* cmd ::= DROP TABLE ifexists fullname */
138877 {
138878 sqlite3DropTable(pParse, yymsp[0].minor.yy185, 0, yymsp[-1].minor.yy194);
138879 }
138880 break;
138881 case 76: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
138882 {
138883 sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy148, yymsp[0].minor.yy243, yymsp[-7].minor.yy194, yymsp[-5].minor.yy194);
138884 }
138885 break;
138886 case 77: /* cmd ::= DROP VIEW ifexists fullname */
138887 {
138888 sqlite3DropTable(pParse, yymsp[0].minor.yy185, 1, yymsp[-1].minor.yy194);
138889 }
138890 break;
138891 case 78: /* cmd ::= select */
138892 {
138893 SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0};
138894 sqlite3Select(pParse, yymsp[0].minor.yy243, &dest);
138895 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy243);
138896 }
138897 break;
138898 case 79: /* select ::= with selectnowith */
138899 {
138900 Select *p = yymsp[0].minor.yy243;
138901 if( p ){
138902 p->pWith = yymsp[-1].minor.yy285;
138903 parserDoubleLinkSelect(pParse, p);
@@ -138574,11 +138905,11 @@
138905 sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy285);
138906 }
138907 yymsp[-1].minor.yy243 = p; /*A-overwrites-W*/
138908 }
138909 break;
138910 case 80: /* selectnowith ::= selectnowith multiselect_op oneselect */
138911 {
138912 Select *pRhs = yymsp[0].minor.yy243;
138913 Select *pLhs = yymsp[-2].minor.yy243;
138914 if( pRhs && pRhs->pPrior ){
138915 SrcList *pFrom;
@@ -138598,18 +138929,18 @@
138929 sqlite3SelectDelete(pParse->db, pLhs);
138930 }
138931 yymsp[-2].minor.yy243 = pRhs;
138932 }
138933 break;
138934 case 81: /* multiselect_op ::= UNION */
138935 case 83: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==83);
138936 {yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-OP*/}
138937 break;
138938 case 82: /* multiselect_op ::= UNION ALL */
138939 {yymsp[-1].minor.yy194 = TK_ALL;}
138940 break;
138941 case 84: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
138942 {
138943 #if SELECTTRACE_ENABLED
138944 Token s = yymsp[-8].minor.yy0; /*A-overwrites-S*/
138945 #endif
138946 yymsp[-8].minor.yy243 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy148,yymsp[-5].minor.yy185,yymsp[-4].minor.yy72,yymsp[-3].minor.yy148,yymsp[-2].minor.yy72,yymsp[-1].minor.yy148,yymsp[-7].minor.yy194,yymsp[0].minor.yy354.pLimit,yymsp[0].minor.yy354.pOffset);
@@ -138637,16 +138968,16 @@
138968 }
138969 }
138970 #endif /* SELECTRACE_ENABLED */
138971 }
138972 break;
138973 case 85: /* values ::= VALUES LP nexprlist RP */
138974 {
138975 yymsp[-3].minor.yy243 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy148,0,0,0,0,0,SF_Values,0,0);
138976 }
138977 break;
138978 case 86: /* values ::= values COMMA LP exprlist RP */
138979 {
138980 Select *pRight, *pLeft = yymsp[-4].minor.yy243;
138981 pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy148,0,0,0,0,0,SF_Values|SF_MultiValue,0,0);
138982 if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue;
138983 if( pRight ){
@@ -138656,86 +138987,86 @@
138987 }else{
138988 yymsp[-4].minor.yy243 = pLeft;
138989 }
138990 }
138991 break;
138992 case 87: /* distinct ::= DISTINCT */
138993 {yymsp[0].minor.yy194 = SF_Distinct;}
138994 break;
138995 case 88: /* distinct ::= ALL */
138996 {yymsp[0].minor.yy194 = SF_All;}
138997 break;
138998 case 90: /* sclp ::= */
138999 case 118: /* orderby_opt ::= */ yytestcase(yyruleno==118);
139000 case 125: /* groupby_opt ::= */ yytestcase(yyruleno==125);
139001 case 200: /* exprlist ::= */ yytestcase(yyruleno==200);
139002 case 203: /* paren_exprlist ::= */ yytestcase(yyruleno==203);
139003 case 208: /* eidlist_opt ::= */ yytestcase(yyruleno==208);
139004 {yymsp[1].minor.yy148 = 0;}
139005 break;
139006 case 91: /* selcollist ::= sclp expr as */
139007 {
139008 yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy148, yymsp[-1].minor.yy190.pExpr);
139009 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-2].minor.yy148, &yymsp[0].minor.yy0, 1);
139010 sqlite3ExprListSetSpan(pParse,yymsp[-2].minor.yy148,&yymsp[-1].minor.yy190);
139011 }
139012 break;
139013 case 92: /* selcollist ::= sclp STAR */
139014 {
139015 Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
139016 yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy148, p);
139017 }
139018 break;
139019 case 93: /* selcollist ::= sclp nm DOT STAR */
139020 {
139021 Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
139022 Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
139023 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
139024 yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, pDot);
139025 }
139026 break;
139027 case 94: /* as ::= AS nm */
139028 case 105: /* dbnm ::= DOT nm */ yytestcase(yyruleno==105);
139029 case 222: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==222);
139030 case 223: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==223);
139031 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
139032 break;
139033 case 96: /* from ::= */
139034 {yymsp[1].minor.yy185 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy185));}
139035 break;
139036 case 97: /* from ::= FROM seltablist */
139037 {
139038 yymsp[-1].minor.yy185 = yymsp[0].minor.yy185;
139039 sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy185);
139040 }
139041 break;
139042 case 98: /* stl_prefix ::= seltablist joinop */
139043 {
139044 if( ALWAYS(yymsp[-1].minor.yy185 && yymsp[-1].minor.yy185->nSrc>0) ) yymsp[-1].minor.yy185->a[yymsp[-1].minor.yy185->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy194;
139045 }
139046 break;
139047 case 99: /* stl_prefix ::= */
139048 {yymsp[1].minor.yy185 = 0;}
139049 break;
139050 case 100: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
139051 {
139052 yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
139053 sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy185, &yymsp[-2].minor.yy0);
139054 }
139055 break;
139056 case 101: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
139057 {
139058 yymsp[-8].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy185,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
139059 sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy185, yymsp[-4].minor.yy148);
139060 }
139061 break;
139062 case 102: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
139063 {
139064 yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy243,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
139065 }
139066 break;
139067 case 103: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
139068 {
139069 if( yymsp[-6].minor.yy185==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy72==0 && yymsp[0].minor.yy254==0 ){
139070 yymsp[-6].minor.yy185 = yymsp[-4].minor.yy185;
139071 }else if( yymsp[-4].minor.yy185->nSrc==1 ){
139072 yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
@@ -138755,191 +139086,189 @@
139086 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy185,0,0,0,0,SF_NestedFrom,0,0);
139087 yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
139088 }
139089 }
139090 break;
139091 case 104: /* dbnm ::= */
139092 case 113: /* indexed_opt ::= */ yytestcase(yyruleno==113);
139093 {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
139094 break;
139095 case 106: /* fullname ::= nm dbnm */
139096 {yymsp[-1].minor.yy185 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
139097 break;
139098 case 107: /* joinop ::= COMMA|JOIN */
139099 { yymsp[0].minor.yy194 = JT_INNER; }
139100 break;
139101 case 108: /* joinop ::= JOIN_KW JOIN */
139102 {yymsp[-1].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
139103 break;
139104 case 109: /* joinop ::= JOIN_KW nm JOIN */
139105 {yymsp[-2].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
139106 break;
139107 case 110: /* joinop ::= JOIN_KW nm nm JOIN */
139108 {yymsp[-3].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
139109 break;
139110 case 111: /* on_opt ::= ON expr */
139111 case 128: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==128);
139112 case 135: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==135);
139113 case 196: /* case_else ::= ELSE expr */ yytestcase(yyruleno==196);
139114 {yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr;}
139115 break;
139116 case 112: /* on_opt ::= */
139117 case 127: /* having_opt ::= */ yytestcase(yyruleno==127);
139118 case 134: /* where_opt ::= */ yytestcase(yyruleno==134);
139119 case 197: /* case_else ::= */ yytestcase(yyruleno==197);
139120 case 199: /* case_operand ::= */ yytestcase(yyruleno==199);
139121 {yymsp[1].minor.yy72 = 0;}
139122 break;
139123 case 114: /* indexed_opt ::= INDEXED BY nm */
139124 {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
139125 break;
139126 case 115: /* indexed_opt ::= NOT INDEXED */
139127 {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
139128 break;
139129 case 116: /* using_opt ::= USING LP idlist RP */
139130 {yymsp[-3].minor.yy254 = yymsp[-1].minor.yy254;}
139131 break;
139132 case 117: /* using_opt ::= */
139133 case 145: /* idlist_opt ::= */ yytestcase(yyruleno==145);
139134 {yymsp[1].minor.yy254 = 0;}
139135 break;
139136 case 119: /* orderby_opt ::= ORDER BY sortlist */
139137 case 126: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==126);
139138 {yymsp[-2].minor.yy148 = yymsp[0].minor.yy148;}
139139 break;
139140 case 120: /* sortlist ::= sortlist COMMA expr sortorder */
139141 {
139142 yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148,yymsp[-1].minor.yy190.pExpr);
139143 sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy148,yymsp[0].minor.yy194);
139144 }
139145 break;
139146 case 121: /* sortlist ::= expr sortorder */
139147 {
139148 yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy190.pExpr); /*A-overwrites-Y*/
139149 sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy148,yymsp[0].minor.yy194);
139150 }
139151 break;
139152 case 122: /* sortorder ::= ASC */
139153 {yymsp[0].minor.yy194 = SQLITE_SO_ASC;}
139154 break;
139155 case 123: /* sortorder ::= DESC */
139156 {yymsp[0].minor.yy194 = SQLITE_SO_DESC;}
139157 break;
139158 case 124: /* sortorder ::= */
139159 {yymsp[1].minor.yy194 = SQLITE_SO_UNDEFINED;}
139160 break;
139161 case 129: /* limit_opt ::= */
139162 {yymsp[1].minor.yy354.pLimit = 0; yymsp[1].minor.yy354.pOffset = 0;}
139163 break;
139164 case 130: /* limit_opt ::= LIMIT expr */
139165 {yymsp[-1].minor.yy354.pLimit = yymsp[0].minor.yy190.pExpr; yymsp[-1].minor.yy354.pOffset = 0;}
139166 break;
139167 case 131: /* limit_opt ::= LIMIT expr OFFSET expr */
139168 {yymsp[-3].minor.yy354.pLimit = yymsp[-2].minor.yy190.pExpr; yymsp[-3].minor.yy354.pOffset = yymsp[0].minor.yy190.pExpr;}
139169 break;
139170 case 132: /* limit_opt ::= LIMIT expr COMMA expr */
139171 {yymsp[-3].minor.yy354.pOffset = yymsp[-2].minor.yy190.pExpr; yymsp[-3].minor.yy354.pLimit = yymsp[0].minor.yy190.pExpr;}
139172 break;
139173 case 133: /* cmd ::= with DELETE FROM fullname indexed_opt where_opt */
139174 {
139175 sqlite3WithPush(pParse, yymsp[-5].minor.yy285, 1);
139176 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy185, &yymsp[-1].minor.yy0);
139177 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy185,yymsp[0].minor.yy72);
139178 }
139179 break;
139180 case 136: /* cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */
139181 {
139182 sqlite3WithPush(pParse, yymsp[-7].minor.yy285, 1);
139183 sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy185, &yymsp[-3].minor.yy0);
139184 sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy148,"set list");
139185 sqlite3Update(pParse,yymsp[-4].minor.yy185,yymsp[-1].minor.yy148,yymsp[0].minor.yy72,yymsp[-5].minor.yy194);
139186 }
139187 break;
139188 case 137: /* setlist ::= setlist COMMA nm EQ expr */
139189 {
139190 yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr);
139191 sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, 1);
139192 }
139193 break;
139194 case 138: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
139195 {
139196 yymsp[-6].minor.yy148 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy148, yymsp[-3].minor.yy254, yymsp[0].minor.yy190.pExpr);
139197 }
139198 break;
139199 case 139: /* setlist ::= nm EQ expr */
139200 {
139201 yylhsminor.yy148 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy190.pExpr);
139202 sqlite3ExprListSetName(pParse, yylhsminor.yy148, &yymsp[-2].minor.yy0, 1);
139203 }
139204 yymsp[-2].minor.yy148 = yylhsminor.yy148;
139205 break;
139206 case 140: /* setlist ::= LP idlist RP EQ expr */
139207 {
139208 yymsp[-4].minor.yy148 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy254, yymsp[0].minor.yy190.pExpr);
139209 }
139210 break;
139211 case 141: /* cmd ::= with insert_cmd INTO fullname idlist_opt select */
139212 {
139213 sqlite3WithPush(pParse, yymsp[-5].minor.yy285, 1);
139214 sqlite3Insert(pParse, yymsp[-2].minor.yy185, yymsp[0].minor.yy243, yymsp[-1].minor.yy254, yymsp[-4].minor.yy194);
139215 }
139216 break;
139217 case 142: /* cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */
139218 {
139219 sqlite3WithPush(pParse, yymsp[-6].minor.yy285, 1);
139220 sqlite3Insert(pParse, yymsp[-3].minor.yy185, 0, yymsp[-2].minor.yy254, yymsp[-5].minor.yy194);
139221 }
139222 break;
139223 case 146: /* idlist_opt ::= LP idlist RP */
139224 {yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;}
139225 break;
139226 case 147: /* idlist ::= idlist COMMA nm */
139227 {yymsp[-2].minor.yy254 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
139228 break;
139229 case 148: /* idlist ::= nm */
139230 {yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
139231 break;
139232 case 149: /* expr ::= LP expr RP */
139233 {spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ yymsp[-2].minor.yy190.pExpr = yymsp[-1].minor.yy190.pExpr;}
139234 break;
139235 case 150: /* expr ::= ID|INDEXED */
139236 case 151: /* expr ::= JOIN_KW */ yytestcase(yyruleno==151);
 
 
 
 
 
139237 {spanExpr(&yymsp[0].minor.yy190,pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
139238 break;
139239 case 152: /* expr ::= nm DOT nm */
139240 {
139241 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
139242 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
139243 spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
139244 yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
139245 }
139246 break;
139247 case 153: /* expr ::= nm DOT nm DOT nm */
139248 {
139249 Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
139250 Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
139251 Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
139252 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
139253 spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
139254 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
139255 }
139256 break;
139257 case 154: /* term ::= NULL|FLOAT|BLOB */
139258 case 155: /* term ::= STRING */ yytestcase(yyruleno==155);
139259 {spanExpr(&yymsp[0].minor.yy190,pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
139260 break;
139261 case 156: /* term ::= INTEGER */
139262 {
139263 yylhsminor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
139264 yylhsminor.yy190.zStart = yymsp[0].minor.yy0.z;
139265 yylhsminor.yy190.zEnd = yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n;
 
139266 }
139267 yymsp[0].minor.yy190 = yylhsminor.yy190;
139268 break;
139269 case 157: /* expr ::= VARIABLE */
139270 {
139271 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
139272 u32 n = yymsp[0].minor.yy0.n;
139273 spanExpr(&yymsp[0].minor.yy190, pParse, TK_VARIABLE, yymsp[0].minor.yy0);
139274 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy190.pExpr, n);
@@ -138958,24 +139287,24 @@
139287 if( yymsp[0].minor.yy190.pExpr ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy190.pExpr->iTable);
139288 }
139289 }
139290 }
139291 break;
139292 case 158: /* expr ::= expr COLLATE ID|STRING */
139293 {
139294 yymsp[-2].minor.yy190.pExpr = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy190.pExpr, &yymsp[0].minor.yy0, 1);
139295 yymsp[-2].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
139296 }
139297 break;
139298 case 159: /* expr ::= CAST LP expr AS typetoken RP */
139299 {
139300 spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
139301 yymsp[-5].minor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
139302 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, 0);
139303 }
139304 break;
139305 case 160: /* expr ::= ID|INDEXED LP distinct exprlist RP */
139306 {
139307 if( yymsp[-1].minor.yy148 && yymsp[-1].minor.yy148->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
139308 sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
139309 }
139310 yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy148, &yymsp[-4].minor.yy0);
@@ -138984,25 +139313,25 @@
139313 yylhsminor.yy190.pExpr->flags |= EP_Distinct;
139314 }
139315 }
139316 yymsp[-4].minor.yy190 = yylhsminor.yy190;
139317 break;
139318 case 161: /* expr ::= ID|INDEXED LP STAR RP */
139319 {
139320 yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
139321 spanSet(&yylhsminor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
139322 }
139323 yymsp[-3].minor.yy190 = yylhsminor.yy190;
139324 break;
139325 case 162: /* term ::= CTIME_KW */
139326 {
139327 yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0);
139328 spanSet(&yylhsminor.yy190, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
139329 }
139330 yymsp[0].minor.yy190 = yylhsminor.yy190;
139331 break;
139332 case 163: /* expr ::= LP nexprlist COMMA expr RP */
139333 {
139334 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy148, yymsp[-1].minor.yy190.pExpr);
139335 yylhsminor.yy190.pExpr = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
139336 if( yylhsminor.yy190.pExpr ){
139337 yylhsminor.yy190.pExpr->x.pList = pList;
@@ -139011,24 +139340,24 @@
139340 sqlite3ExprListDelete(pParse->db, pList);
139341 }
139342 }
139343 yymsp[-4].minor.yy190 = yylhsminor.yy190;
139344 break;
139345 case 164: /* expr ::= expr AND expr */
139346 case 165: /* expr ::= expr OR expr */ yytestcase(yyruleno==165);
139347 case 166: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==166);
139348 case 167: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==167);
139349 case 168: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==168);
139350 case 169: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==169);
139351 case 170: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==170);
139352 case 171: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==171);
139353 {spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);}
139354 break;
139355 case 172: /* likeop ::= NOT LIKE_KW|MATCH */
139356 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
139357 break;
139358 case 173: /* expr ::= expr likeop expr */
139359 {
139360 ExprList *pList;
139361 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
139362 yymsp[-1].minor.yy0.n &= 0x7fffffff;
139363 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy190.pExpr);
@@ -139037,11 +139366,11 @@
139366 exprNot(pParse, bNot, &yymsp[-2].minor.yy190);
139367 yymsp[-2].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
139368 if( yymsp[-2].minor.yy190.pExpr ) yymsp[-2].minor.yy190.pExpr->flags |= EP_InfixFunc;
139369 }
139370 break;
139371 case 174: /* expr ::= expr likeop expr ESCAPE expr */
139372 {
139373 ExprList *pList;
139374 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
139375 yymsp[-3].minor.yy0.n &= 0x7fffffff;
139376 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
@@ -139051,43 +139380,43 @@
139380 exprNot(pParse, bNot, &yymsp[-4].minor.yy190);
139381 yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
139382 if( yymsp[-4].minor.yy190.pExpr ) yymsp[-4].minor.yy190.pExpr->flags |= EP_InfixFunc;
139383 }
139384 break;
139385 case 175: /* expr ::= expr ISNULL|NOTNULL */
139386 {spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy190,&yymsp[0].minor.yy0);}
139387 break;
139388 case 176: /* expr ::= expr NOT NULL */
139389 {spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy0);}
139390 break;
139391 case 177: /* expr ::= expr IS expr */
139392 {
139393 spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);
139394 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-2].minor.yy190.pExpr, TK_ISNULL);
139395 }
139396 break;
139397 case 178: /* expr ::= expr IS NOT expr */
139398 {
139399 spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy190,&yymsp[0].minor.yy190);
139400 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, TK_NOTNULL);
139401 }
139402 break;
139403 case 179: /* expr ::= NOT expr */
139404 case 180: /* expr ::= BITNOT expr */ yytestcase(yyruleno==180);
139405 {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,yymsp[-1].major,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
139406 break;
139407 case 181: /* expr ::= MINUS expr */
139408 {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UMINUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
139409 break;
139410 case 182: /* expr ::= PLUS expr */
139411 {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UPLUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
139412 break;
139413 case 183: /* between_op ::= BETWEEN */
139414 case 186: /* in_op ::= IN */ yytestcase(yyruleno==186);
139415 {yymsp[0].minor.yy194 = 0;}
139416 break;
139417 case 185: /* expr ::= expr between_op expr AND expr */
139418 {
139419 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
139420 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr);
139421 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy190.pExpr, 0);
139422 if( yymsp[-4].minor.yy190.pExpr ){
@@ -139097,11 +139426,11 @@
139426 }
139427 exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
139428 yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
139429 }
139430 break;
139431 case 188: /* expr ::= expr in_op LP exprlist RP */
139432 {
139433 if( yymsp[-1].minor.yy148==0 ){
139434 /* Expressions of the form
139435 **
139436 ** expr1 IN ()
@@ -139150,26 +139479,26 @@
139479 exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
139480 }
139481 yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
139482 }
139483 break;
139484 case 189: /* expr ::= LP select RP */
139485 {
139486 spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
139487 yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
139488 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy190.pExpr, yymsp[-1].minor.yy243);
139489 }
139490 break;
139491 case 190: /* expr ::= expr in_op LP select RP */
139492 {
139493 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0);
139494 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, yymsp[-1].minor.yy243);
139495 exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
139496 yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
139497 }
139498 break;
139499 case 191: /* expr ::= expr in_op nm dbnm paren_exprlist */
139500 {
139501 SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
139502 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
139503 if( yymsp[0].minor.yy148 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy148);
139504 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0);
@@ -139176,19 +139505,19 @@
139505 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, pSelect);
139506 exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190);
139507 yymsp[-4].minor.yy190.zEnd = yymsp[-1].minor.yy0.z ? &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n] : &yymsp[-2].minor.yy0.z[yymsp[-2].minor.yy0.n];
139508 }
139509 break;
139510 case 192: /* expr ::= EXISTS LP select RP */
139511 {
139512 Expr *p;
139513 spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
139514 p = yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
139515 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy243);
139516 }
139517 break;
139518 case 193: /* expr ::= CASE case_operand case_exprlist case_else END */
139519 {
139520 spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-C*/
139521 yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy72, 0);
139522 if( yymsp[-4].minor.yy190.pExpr ){
139523 yymsp[-4].minor.yy190.pExpr->x.pList = yymsp[-1].minor.yy72 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[-1].minor.yy72) : yymsp[-2].minor.yy148;
@@ -139197,332 +139526,332 @@
139526 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy148);
139527 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy72);
139528 }
139529 }
139530 break;
139531 case 194: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
139532 {
139533 yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[-2].minor.yy190.pExpr);
139534 yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr);
139535 }
139536 break;
139537 case 195: /* case_exprlist ::= WHEN expr THEN expr */
139538 {
139539 yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
139540 yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, yymsp[0].minor.yy190.pExpr);
139541 }
139542 break;
139543 case 198: /* case_operand ::= expr */
139544 {yymsp[0].minor.yy72 = yymsp[0].minor.yy190.pExpr; /*A-overwrites-X*/}
139545 break;
139546 case 201: /* nexprlist ::= nexprlist COMMA expr */
139547 {yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[0].minor.yy190.pExpr);}
139548 break;
139549 case 202: /* nexprlist ::= expr */
139550 {yymsp[0].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy190.pExpr); /*A-overwrites-Y*/}
139551 break;
139552 case 204: /* paren_exprlist ::= LP exprlist RP */
139553 case 209: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==209);
139554 {yymsp[-2].minor.yy148 = yymsp[-1].minor.yy148;}
139555 break;
139556 case 205: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
139557 {
139558 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
139559 sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy148, yymsp[-10].minor.yy194,
139560 &yymsp[-11].minor.yy0, yymsp[0].minor.yy72, SQLITE_SO_ASC, yymsp[-8].minor.yy194, SQLITE_IDXTYPE_APPDEF);
139561 }
139562 break;
139563 case 206: /* uniqueflag ::= UNIQUE */
139564 case 246: /* raisetype ::= ABORT */ yytestcase(yyruleno==246);
139565 {yymsp[0].minor.yy194 = OE_Abort;}
139566 break;
139567 case 207: /* uniqueflag ::= */
139568 {yymsp[1].minor.yy194 = OE_None;}
139569 break;
139570 case 210: /* eidlist ::= eidlist COMMA nm collate sortorder */
139571 {
139572 yymsp[-4].minor.yy148 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194);
139573 }
139574 break;
139575 case 211: /* eidlist ::= nm collate sortorder */
139576 {
139577 yymsp[-2].minor.yy148 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); /*A-overwrites-Y*/
139578 }
139579 break;
139580 case 214: /* cmd ::= DROP INDEX ifexists fullname */
139581 {sqlite3DropIndex(pParse, yymsp[0].minor.yy185, yymsp[-1].minor.yy194);}
139582 break;
139583 case 215: /* cmd ::= VACUUM */
139584 {sqlite3Vacuum(pParse,0);}
139585 break;
139586 case 216: /* cmd ::= VACUUM nm */
139587 {sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);}
139588 break;
139589 case 217: /* cmd ::= PRAGMA nm dbnm */
139590 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
139591 break;
139592 case 218: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
139593 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
139594 break;
139595 case 219: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
139596 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
139597 break;
139598 case 220: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
139599 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
139600 break;
139601 case 221: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
139602 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
139603 break;
139604 case 224: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
139605 {
139606 Token all;
139607 all.z = yymsp[-3].minor.yy0.z;
139608 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
139609 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy145, &all);
139610 }
139611 break;
139612 case 225: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
139613 {
139614 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy194, yymsp[-4].minor.yy332.a, yymsp[-4].minor.yy332.b, yymsp[-2].minor.yy185, yymsp[0].minor.yy72, yymsp[-10].minor.yy194, yymsp[-8].minor.yy194);
139615 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
139616 }
139617 break;
139618 case 226: /* trigger_time ::= BEFORE|AFTER */
139619 { yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-X*/ }
139620 break;
139621 case 227: /* trigger_time ::= INSTEAD OF */
139622 { yymsp[-1].minor.yy194 = TK_INSTEAD;}
139623 break;
139624 case 228: /* trigger_time ::= */
139625 { yymsp[1].minor.yy194 = TK_BEFORE; }
139626 break;
139627 case 229: /* trigger_event ::= DELETE|INSERT */
139628 case 230: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==230);
139629 {yymsp[0].minor.yy332.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy332.b = 0;}
139630 break;
139631 case 231: /* trigger_event ::= UPDATE OF idlist */
139632 {yymsp[-2].minor.yy332.a = TK_UPDATE; yymsp[-2].minor.yy332.b = yymsp[0].minor.yy254;}
139633 break;
139634 case 232: /* when_clause ::= */
139635 case 251: /* key_opt ::= */ yytestcase(yyruleno==251);
139636 { yymsp[1].minor.yy72 = 0; }
139637 break;
139638 case 233: /* when_clause ::= WHEN expr */
139639 case 252: /* key_opt ::= KEY expr */ yytestcase(yyruleno==252);
139640 { yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr; }
139641 break;
139642 case 234: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
139643 {
139644 assert( yymsp[-2].minor.yy145!=0 );
139645 yymsp[-2].minor.yy145->pLast->pNext = yymsp[-1].minor.yy145;
139646 yymsp[-2].minor.yy145->pLast = yymsp[-1].minor.yy145;
139647 }
139648 break;
139649 case 235: /* trigger_cmd_list ::= trigger_cmd SEMI */
139650 {
139651 assert( yymsp[-1].minor.yy145!=0 );
139652 yymsp[-1].minor.yy145->pLast = yymsp[-1].minor.yy145;
139653 }
139654 break;
139655 case 236: /* trnm ::= nm DOT nm */
139656 {
139657 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
139658 sqlite3ErrorMsg(pParse,
139659 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
139660 "statements within triggers");
139661 }
139662 break;
139663 case 237: /* tridxby ::= INDEXED BY nm */
139664 {
139665 sqlite3ErrorMsg(pParse,
139666 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
139667 "within triggers");
139668 }
139669 break;
139670 case 238: /* tridxby ::= NOT INDEXED */
139671 {
139672 sqlite3ErrorMsg(pParse,
139673 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
139674 "within triggers");
139675 }
139676 break;
139677 case 239: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
139678 {yymsp[-6].minor.yy145 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy148, yymsp[0].minor.yy72, yymsp[-5].minor.yy194);}
139679 break;
139680 case 240: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */
139681 {yymsp[-4].minor.yy145 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy254, yymsp[0].minor.yy243, yymsp[-4].minor.yy194);/*A-overwrites-R*/}
139682 break;
139683 case 241: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
139684 {yymsp[-4].minor.yy145 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy72);}
139685 break;
139686 case 242: /* trigger_cmd ::= select */
139687 {yymsp[0].minor.yy145 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy243); /*A-overwrites-X*/}
139688 break;
139689 case 243: /* expr ::= RAISE LP IGNORE RP */
139690 {
139691 spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
139692 yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
139693 if( yymsp[-3].minor.yy190.pExpr ){
139694 yymsp[-3].minor.yy190.pExpr->affinity = OE_Ignore;
139695 }
139696 }
139697 break;
139698 case 244: /* expr ::= RAISE LP raisetype COMMA nm RP */
139699 {
139700 spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
139701 yymsp[-5].minor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
139702 if( yymsp[-5].minor.yy190.pExpr ) {
139703 yymsp[-5].minor.yy190.pExpr->affinity = (char)yymsp[-3].minor.yy194;
139704 }
139705 }
139706 break;
139707 case 245: /* raisetype ::= ROLLBACK */
139708 {yymsp[0].minor.yy194 = OE_Rollback;}
139709 break;
139710 case 247: /* raisetype ::= FAIL */
139711 {yymsp[0].minor.yy194 = OE_Fail;}
139712 break;
139713 case 248: /* cmd ::= DROP TRIGGER ifexists fullname */
139714 {
139715 sqlite3DropTrigger(pParse,yymsp[0].minor.yy185,yymsp[-1].minor.yy194);
139716 }
139717 break;
139718 case 249: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
139719 {
139720 sqlite3Attach(pParse, yymsp[-3].minor.yy190.pExpr, yymsp[-1].minor.yy190.pExpr, yymsp[0].minor.yy72);
139721 }
139722 break;
139723 case 250: /* cmd ::= DETACH database_kw_opt expr */
139724 {
139725 sqlite3Detach(pParse, yymsp[0].minor.yy190.pExpr);
139726 }
139727 break;
139728 case 253: /* cmd ::= REINDEX */
139729 {sqlite3Reindex(pParse, 0, 0);}
139730 break;
139731 case 254: /* cmd ::= REINDEX nm dbnm */
139732 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
139733 break;
139734 case 255: /* cmd ::= ANALYZE */
139735 {sqlite3Analyze(pParse, 0, 0);}
139736 break;
139737 case 256: /* cmd ::= ANALYZE nm dbnm */
139738 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
139739 break;
139740 case 257: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
139741 {
139742 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy185,&yymsp[0].minor.yy0);
139743 }
139744 break;
139745 case 258: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
139746 {
139747 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
139748 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
139749 }
139750 break;
139751 case 259: /* add_column_fullname ::= fullname */
139752 {
139753 disableLookaside(pParse);
139754 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy185);
139755 }
139756 break;
139757 case 260: /* cmd ::= create_vtab */
139758 {sqlite3VtabFinishParse(pParse,0);}
139759 break;
139760 case 261: /* cmd ::= create_vtab LP vtabarglist RP */
139761 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
139762 break;
139763 case 262: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
139764 {
139765 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy194);
139766 }
139767 break;
139768 case 263: /* vtabarg ::= */
139769 {sqlite3VtabArgInit(pParse);}
139770 break;
139771 case 264: /* vtabargtoken ::= ANY */
139772 case 265: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==265);
139773 case 266: /* lp ::= LP */ yytestcase(yyruleno==266);
139774 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
139775 break;
139776 case 267: /* with ::= */
139777 {yymsp[1].minor.yy285 = 0;}
139778 break;
139779 case 268: /* with ::= WITH wqlist */
139780 { yymsp[-1].minor.yy285 = yymsp[0].minor.yy285; }
139781 break;
139782 case 269: /* with ::= WITH RECURSIVE wqlist */
139783 { yymsp[-2].minor.yy285 = yymsp[0].minor.yy285; }
139784 break;
139785 case 270: /* wqlist ::= nm eidlist_opt AS LP select RP */
139786 {
139787 yymsp[-5].minor.yy285 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); /*A-overwrites-X*/
139788 }
139789 break;
139790 case 271: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
139791 {
139792 yymsp[-7].minor.yy285 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy285, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243);
139793 }
139794 break;
139795 default:
139796 /* (272) input ::= cmdlist */ yytestcase(yyruleno==272);
139797 /* (273) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==273);
139798 /* (274) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=274);
139799 /* (275) ecmd ::= SEMI */ yytestcase(yyruleno==275);
139800 /* (276) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==276);
139801 /* (277) explain ::= */ yytestcase(yyruleno==277);
139802 /* (278) trans_opt ::= */ yytestcase(yyruleno==278);
139803 /* (279) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==279);
139804 /* (280) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==280);
139805 /* (281) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==281);
139806 /* (282) savepoint_opt ::= */ yytestcase(yyruleno==282);
139807 /* (283) cmd ::= create_table create_table_args */ yytestcase(yyruleno==283);
139808 /* (284) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==284);
139809 /* (285) columnlist ::= columnname carglist */ yytestcase(yyruleno==285);
139810 /* (286) nm ::= ID|INDEXED */ yytestcase(yyruleno==286);
139811 /* (287) nm ::= STRING */ yytestcase(yyruleno==287);
139812 /* (288) nm ::= JOIN_KW */ yytestcase(yyruleno==288);
139813 /* (289) typetoken ::= typename */ yytestcase(yyruleno==289);
139814 /* (290) typename ::= ID|STRING */ yytestcase(yyruleno==290);
139815 /* (291) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=291);
139816 /* (292) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=292);
139817 /* (293) carglist ::= carglist ccons */ yytestcase(yyruleno==293);
139818 /* (294) carglist ::= */ yytestcase(yyruleno==294);
139819 /* (295) ccons ::= NULL onconf */ yytestcase(yyruleno==295);
139820 /* (296) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==296);
139821 /* (297) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==297);
139822 /* (298) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=298);
139823 /* (299) tconscomma ::= */ yytestcase(yyruleno==299);
139824 /* (300) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=300);
139825 /* (301) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=301);
139826 /* (302) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=302);
139827 /* (303) oneselect ::= values */ yytestcase(yyruleno==303);
139828 /* (304) sclp ::= selcollist COMMA */ yytestcase(yyruleno==304);
139829 /* (305) as ::= ID|STRING */ yytestcase(yyruleno==305);
139830 /* (306) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=306);
139831 /* (307) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==307);
139832 /* (308) exprlist ::= nexprlist */ yytestcase(yyruleno==308);
139833 /* (309) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=309);
139834 /* (310) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=310);
139835 /* (311) nmnum ::= ON */ yytestcase(yyruleno==311);
139836 /* (312) nmnum ::= DELETE */ yytestcase(yyruleno==312);
139837 /* (313) nmnum ::= DEFAULT */ yytestcase(yyruleno==313);
139838 /* (314) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==314);
139839 /* (315) foreach_clause ::= */ yytestcase(yyruleno==315);
139840 /* (316) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==316);
139841 /* (317) trnm ::= nm */ yytestcase(yyruleno==317);
139842 /* (318) tridxby ::= */ yytestcase(yyruleno==318);
139843 /* (319) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==319);
139844 /* (320) database_kw_opt ::= */ yytestcase(yyruleno==320);
139845 /* (321) kwcolumn_opt ::= */ yytestcase(yyruleno==321);
139846 /* (322) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==322);
139847 /* (323) vtabarglist ::= vtabarg */ yytestcase(yyruleno==323);
139848 /* (324) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==324);
139849 /* (325) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==325);
139850 /* (326) anylist ::= */ yytestcase(yyruleno==326);
139851 /* (327) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==327);
139852 /* (328) anylist ::= anylist ANY */ yytestcase(yyruleno==328);
139853 break;
139854 /********** End reduce actions ************************************************/
139855 };
139856 assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
139857 yygoto = yyRuleInfo[yyruleno].lhs;
@@ -139948,138 +140277,149 @@
140277 ** But by using this automatically generated code, the size of the code
140278 ** is substantially reduced. This is important for embedded applications
140279 ** on platforms with limited memory.
140280 */
140281 /* Hash score: 182 */
140282 /* zKWText[] encodes 834 bytes of keyword text in 554 bytes */
140283 /* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */
140284 /* ABLEFTHENDEFERRABLELSEXCEPTRANSACTIONATURALTERAISEXCLUSIVE */
140285 /* XISTSAVEPOINTERSECTRIGGEREFERENCESCONSTRAINTOFFSETEMPORARY */
140286 /* UNIQUERYWITHOUTERELEASEATTACHAVINGROUPDATEBEGINNERECURSIVE */
140287 /* BETWEENOTNULLIKECASCADELETECASECOLLATECREATECURRENT_DATEDETACH */
140288 /* IMMEDIATEJOINSERTMATCHPLANALYZEPRAGMABORTVALUESVIRTUALIMITWHEN */
140289 /* WHERENAMEAFTEREPLACEANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMIT */
140290 /* CONFLICTCROSSCURRENT_TIMESTAMPRIMARYDEFERREDISTINCTDROPFAIL */
140291 /* FROMFULLGLOBYIFISNULLORDERESTRICTRIGHTROLLBACKROWUNIONUSING */
140292 /* VACUUMVIEWINITIALLY */
140293 static const char zKWText[553] = {
140294 'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H',
140295 'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G',
140296 'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A',
140297 'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F',
140298 'E','R','R','A','B','L','E','L','S','E','X','C','E','P','T','R','A','N',
140299 'S','A','C','T','I','O','N','A','T','U','R','A','L','T','E','R','A','I',
140300 'S','E','X','C','L','U','S','I','V','E','X','I','S','T','S','A','V','E',
140301 'P','O','I','N','T','E','R','S','E','C','T','R','I','G','G','E','R','E',
140302 'F','E','R','E','N','C','E','S','C','O','N','S','T','R','A','I','N','T',
140303 'O','F','F','S','E','T','E','M','P','O','R','A','R','Y','U','N','I','Q',
140304 'U','E','R','Y','W','I','T','H','O','U','T','E','R','E','L','E','A','S',
140305 'E','A','T','T','A','C','H','A','V','I','N','G','R','O','U','P','D','A',
140306 'T','E','B','E','G','I','N','N','E','R','E','C','U','R','S','I','V','E',
140307 'B','E','T','W','E','E','N','O','T','N','U','L','L','I','K','E','C','A',
140308 'S','C','A','D','E','L','E','T','E','C','A','S','E','C','O','L','L','A',
140309 'T','E','C','R','E','A','T','E','C','U','R','R','E','N','T','_','D','A',
140310 'T','E','D','E','T','A','C','H','I','M','M','E','D','I','A','T','E','J',
140311 'O','I','N','S','E','R','T','M','A','T','C','H','P','L','A','N','A','L',
140312 'Y','Z','E','P','R','A','G','M','A','B','O','R','T','V','A','L','U','E',
140313 'S','V','I','R','T','U','A','L','I','M','I','T','W','H','E','N','W','H',
140314 'E','R','E','N','A','M','E','A','F','T','E','R','E','P','L','A','C','E',
140315 'A','N','D','E','F','A','U','L','T','A','U','T','O','I','N','C','R','E',
140316 'M','E','N','T','C','A','S','T','C','O','L','U','M','N','C','O','M','M',
140317 'I','T','C','O','N','F','L','I','C','T','C','R','O','S','S','C','U','R',
140318 'R','E','N','T','_','T','I','M','E','S','T','A','M','P','R','I','M','A',
140319 'R','Y','D','E','F','E','R','R','E','D','I','S','T','I','N','C','T','D',
140320 'R','O','P','F','A','I','L','F','R','O','M','F','U','L','L','G','L','O',
140321 'B','Y','I','F','I','S','N','U','L','L','O','R','D','E','R','E','S','T',
140322 'R','I','C','T','R','I','G','H','T','R','O','L','L','B','A','C','K','R',
140323 'O','W','U','N','I','O','N','U','S','I','N','G','V','A','C','U','U','M',
140324 'V','I','E','W','I','N','I','T','I','A','L','L','Y',
140325 };
140326 /* aKWHash[i] is the hash value for the i-th keyword */
140327 static const unsigned char aKWHash[127] = {
140328 76, 105, 117, 74, 0, 45, 0, 0, 82, 0, 77, 0, 0,
140329 42, 12, 78, 15, 0, 116, 85, 54, 112, 0, 19, 0, 0,
140330 121, 0, 119, 115, 0, 22, 93, 0, 9, 0, 0, 70, 71,
140331 0, 69, 6, 0, 48, 90, 102, 0, 118, 101, 0, 0, 44,
140332 0, 103, 24, 0, 17, 0, 122, 53, 23, 0, 5, 110, 25,
140333 96, 0, 0, 124, 106, 60, 123, 57, 28, 55, 0, 91, 0,
140334 100, 26, 0, 99, 0, 0, 0, 95, 92, 97, 88, 109, 14,
140335 39, 108, 0, 81, 0, 18, 89, 111, 32, 0, 120, 80, 113,
140336 62, 46, 84, 0, 0, 94, 40, 59, 114, 0, 36, 0, 0,
140337 29, 0, 86, 63, 64, 0, 20, 61, 0, 56,
140338 };
140339 /* aKWNext[] forms the hash collision chain. If aKWHash[i]==0
140340 ** then the i-th keyword has no more hash collisions. Otherwise,
140341 ** the next keyword with the same hash is aKWHash[i]-1. */
140342 static const unsigned char aKWNext[124] = {
140343 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
140344 0, 2, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0,
140345 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
140346 0, 0, 0, 0, 33, 0, 21, 0, 0, 0, 0, 0, 50,
140347 0, 43, 3, 47, 0, 0, 0, 0, 30, 0, 58, 0, 38,
140348 0, 0, 0, 1, 66, 0, 0, 67, 0, 41, 0, 0, 0,
140349 0, 0, 0, 49, 65, 0, 0, 0, 0, 31, 52, 16, 34,
140350 10, 0, 0, 0, 0, 0, 0, 0, 11, 72, 79, 0, 8,
140351 0, 104, 98, 0, 107, 0, 87, 0, 75, 51, 0, 27, 37,
140352 73, 83, 0, 35, 68, 0, 0,
140353 };
140354 /* aKWLen[i] is the length (in bytes) of the i-th keyword */
140355 static const unsigned char aKWLen[124] = {
140356 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
140357 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 6,
140358 11, 6, 2, 7, 5, 5, 9, 6, 9, 9, 7, 10, 10,
140359 4, 6, 2, 3, 9, 4, 2, 6, 5, 7, 4, 5, 7,
140360 6, 6, 5, 6, 5, 5, 9, 7, 7, 3, 2, 4, 4,
140361 7, 3, 6, 4, 7, 6, 12, 6, 9, 4, 6, 5, 4,
140362 7, 6, 5, 6, 7, 5, 4, 5, 6, 5, 7, 3, 7,
140363 13, 2, 2, 4, 6, 6, 8, 5, 17, 12, 7, 8, 8,
140364 2, 4, 4, 4, 4, 4, 2, 2, 6, 5, 8, 5, 8,
140365 3, 5, 5, 6, 4, 9, 3,
140366 };
140367 /* aKWOffset[i] is the index into zKWText[] of the start of
140368 ** the text for the i-th keyword. */
140369 static const unsigned short int aKWOffset[124] = {
140370 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
140371 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
140372 86, 91, 95, 96, 101, 105, 109, 117, 122, 128, 136, 142, 152,
140373 159, 162, 162, 165, 167, 167, 171, 176, 179, 184, 184, 188, 192,
140374 199, 204, 209, 212, 218, 221, 225, 234, 240, 240, 240, 243, 246,
140375 250, 251, 255, 261, 265, 272, 278, 290, 296, 305, 307, 313, 318,
140376 320, 327, 332, 337, 343, 349, 354, 358, 361, 367, 371, 378, 380,
140377 387, 389, 391, 400, 404, 410, 416, 424, 429, 429, 445, 452, 459,
140378 460, 467, 471, 475, 479, 483, 486, 488, 490, 496, 500, 508, 513,
140379 521, 524, 529, 534, 540, 544, 549,
140380 };
140381 /* aKWCode[i] is the parser symbol code for the i-th keyword */
140382 static const unsigned char aKWCode[124] = {
140383 TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
140384 TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
140385 TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
140386 TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
140387 TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
140388 TK_EXCEPT, TK_TRANSACTION,TK_ACTION, TK_ON, TK_JOIN_KW,
140389 TK_ALTER, TK_RAISE, TK_EXCLUSIVE, TK_EXISTS, TK_SAVEPOINT,
140390 TK_INTERSECT, TK_TRIGGER, TK_REFERENCES, TK_CONSTRAINT, TK_INTO,
140391 TK_OFFSET, TK_OF, TK_SET, TK_TEMP, TK_TEMP,
140392 TK_OR, TK_UNIQUE, TK_QUERY, TK_WITHOUT, TK_WITH,
140393 TK_JOIN_KW, TK_RELEASE, TK_ATTACH, TK_HAVING, TK_GROUP,
140394 TK_UPDATE, TK_BEGIN, TK_JOIN_KW, TK_RECURSIVE, TK_BETWEEN,
140395 TK_NOTNULL, TK_NOT, TK_NO, TK_NULL, TK_LIKE_KW,
140396 TK_CASCADE, TK_ASC, TK_DELETE, TK_CASE, TK_COLLATE,
140397 TK_CREATE, TK_CTIME_KW, TK_DETACH, TK_IMMEDIATE, TK_JOIN,
140398 TK_INSERT, TK_MATCH, TK_PLAN, TK_ANALYZE, TK_PRAGMA,
140399 TK_ABORT, TK_VALUES, TK_VIRTUAL, TK_LIMIT, TK_WHEN,
140400 TK_WHERE, TK_RENAME, TK_AFTER, TK_REPLACE, TK_AND,
140401 TK_DEFAULT, TK_AUTOINCR, TK_TO, TK_IN, TK_CAST,
140402 TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW,
140403 TK_CTIME_KW, TK_PRIMARY, TK_DEFERRED, TK_DISTINCT, TK_IS,
140404 TK_DROP, TK_FAIL, TK_FROM, TK_JOIN_KW, TK_LIKE_KW,
140405 TK_BY, TK_IF, TK_ISNULL, TK_ORDER, TK_RESTRICT,
140406 TK_JOIN_KW, TK_ROLLBACK, TK_ROW, TK_UNION, TK_USING,
140407 TK_VACUUM, TK_VIEW, TK_INITIALLY, TK_ALL,
140408 };
140409 /* Check to see if z[0..n-1] is a keyword. If it is, write the
140410 ** parser symbol code for that keyword into *pType. Always
140411 ** return the integer n (the length of the token). */
140412 static int keywordCode(const char *z, int n, int *pType){
140413 int i, j;
140414 const char *zKW;
140415 if( n>=2 ){
140416 i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n) % 127;
140417 for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){
140418 if( aKWLen[i]!=n ) continue;
140419 j = 0;
140420 zKW = &zKWText[aKWOffset[i]];
140421 #ifdef SQLITE_ASCII
140422 while( j<n && (z[j]&~0x20)==zKW[j] ){ j++; }
140423 #endif
140424 #ifdef SQLITE_EBCDIC
140425 while( j<n && toupper(z[j])==zKW[j] ){ j++; }
@@ -140207,11 +140547,11 @@
140547 testcase( i==119 ); /* USING */
140548 testcase( i==120 ); /* VACUUM */
140549 testcase( i==121 ); /* VIEW */
140550 testcase( i==122 ); /* INITIALLY */
140551 testcase( i==123 ); /* ALL */
140552 *pType = aKWCode[i];
140553 break;
140554 }
140555 }
140556 return n;
140557 }
@@ -142486,14 +142826,14 @@
142826 ** argument.
142827 */
142828 SQLITE_PRIVATE const char *sqlite3ErrStr(int rc){
142829 static const char* const aMsg[] = {
142830 /* SQLITE_OK */ "not an error",
142831 /* SQLITE_ERROR */ "SQL logic error",
142832 /* SQLITE_INTERNAL */ 0,
142833 /* SQLITE_PERM */ "access permission denied",
142834 /* SQLITE_ABORT */ "query aborted",
142835 /* SQLITE_BUSY */ "database is locked",
142836 /* SQLITE_LOCKED */ "database table is locked",
142837 /* SQLITE_NOMEM */ "out of memory",
142838 /* SQLITE_READONLY */ "attempt to write a readonly database",
142839 /* SQLITE_INTERRUPT */ "interrupted",
@@ -142501,21 +142841,25 @@
142841 /* SQLITE_CORRUPT */ "database disk image is malformed",
142842 /* SQLITE_NOTFOUND */ "unknown operation",
142843 /* SQLITE_FULL */ "database or disk is full",
142844 /* SQLITE_CANTOPEN */ "unable to open database file",
142845 /* SQLITE_PROTOCOL */ "locking protocol",
142846 /* SQLITE_EMPTY */ 0,
142847 /* SQLITE_SCHEMA */ "database schema has changed",
142848 /* SQLITE_TOOBIG */ "string or blob too big",
142849 /* SQLITE_CONSTRAINT */ "constraint failed",
142850 /* SQLITE_MISMATCH */ "datatype mismatch",
142851 /* SQLITE_MISUSE */ "bad parameter or other API misuse",
142852 #ifdef SQLITE_DISABLE_LFS
142853 /* SQLITE_NOLFS */ "large file support is disabled",
142854 #else
142855 /* SQLITE_NOLFS */ 0,
142856 #endif
142857 /* SQLITE_AUTH */ "authorization denied",
142858 /* SQLITE_FORMAT */ 0,
142859 /* SQLITE_RANGE */ "column index out of range",
142860 /* SQLITE_NOTADB */ "file is not a database",
142861 };
142862 const char *zErr = "unknown error";
142863 switch( rc ){
142864 case SQLITE_ABORT_ROLLBACK: {
142865 zErr = "abort due to ROLLBACK";
@@ -143351,16 +143695,13 @@
143695 SQLITE_API const void *sqlite3_errmsg16(sqlite3 *db){
143696 static const u16 outOfMem[] = {
143697 'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0
143698 };
143699 static const u16 misuse[] = {
143700 'b', 'a', 'd', ' ', 'p', 'a', 'r', 'a', 'm', 'e', 't', 'e', 'r', ' ',
143701 'o', 'r', ' ', 'o', 't', 'h', 'e', 'r', ' ', 'A', 'P', 'I', ' ',
143702 'm', 'i', 's', 'u', 's', 'e', 0
 
 
 
143703 };
143704
143705 const void *z;
143706 if( !db ){
143707 return (void *)outOfMem;
@@ -143891,30 +144232,10 @@
144232 #ifndef SQLITE_OMIT_AUTOINIT
144233 rc = sqlite3_initialize();
144234 if( rc ) return rc;
144235 #endif
144236
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144237 if( sqlite3GlobalConfig.bCoreMutex==0 ){
144238 isThreadsafe = 0;
144239 }else if( flags & SQLITE_OPEN_NOMUTEX ){
144240 isThreadsafe = 0;
144241 }else if( flags & SQLITE_OPEN_FULLMUTEX ){
@@ -144032,13 +144353,34 @@
144353 ** strings is BINARY.
144354 */
144355 db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, sqlite3StrBINARY, 0);
144356 assert( db->pDfltColl!=0 );
144357
144358 /* Parse the filename/URI argument
144359 **
144360 ** Only allow sensible combinations of bits in the flags argument.
144361 ** Throw an error if any non-sense combination is used. If we
144362 ** do not block illegal combinations here, it could trigger
144363 ** assert() statements in deeper layers. Sensible combinations
144364 ** are:
144365 **
144366 ** 1: SQLITE_OPEN_READONLY
144367 ** 2: SQLITE_OPEN_READWRITE
144368 ** 6: SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
144369 */
144370 db->openFlags = flags;
144371 assert( SQLITE_OPEN_READONLY == 0x01 );
144372 assert( SQLITE_OPEN_READWRITE == 0x02 );
144373 assert( SQLITE_OPEN_CREATE == 0x04 );
144374 testcase( (1<<(flags&7))==0x02 ); /* READONLY */
144375 testcase( (1<<(flags&7))==0x04 ); /* READWRITE */
144376 testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */
144377 if( ((1<<(flags&7)) & 0x46)==0 ){
144378 rc = SQLITE_MISUSE_BKPT; /* IMP: R-65497-44594 */
144379 }else{
144380 rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
144381 }
144382 if( rc!=SQLITE_OK ){
144383 if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
144384 sqlite3ErrorWithMsg(db, rc, zErrMsg ? "%s" : 0, zErrMsg);
144385 sqlite3_free(zErrMsg);
144386 goto opendb_out;
@@ -148199,23 +148541,32 @@
148541 }
148542 pCsr->bSeekStmt = 0;
148543 }
148544 sqlite3_finalize(pCsr->pStmt);
148545 }
148546
148547 /*
148548 ** Free all resources currently held by the cursor passed as the only
148549 ** argument.
148550 */
148551 static void fts3ClearCursor(Fts3Cursor *pCsr){
148552 fts3CursorFinalizeStmt(pCsr);
148553 sqlite3Fts3FreeDeferredTokens(pCsr);
148554 sqlite3_free(pCsr->aDoclist);
148555 sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);
148556 sqlite3Fts3ExprFree(pCsr->pExpr);
148557 memset(&(&pCsr->base)[1], 0, sizeof(Fts3Cursor)-sizeof(sqlite3_vtab_cursor));
148558 }
148559
148560 /*
148561 ** Close the cursor. For additional information see the documentation
148562 ** on the xClose method of the virtual table interface.
148563 */
148564 static int fts3CloseMethod(sqlite3_vtab_cursor *pCursor){
148565 Fts3Cursor *pCsr = (Fts3Cursor *)pCursor;
148566 assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );
148567 fts3ClearCursor(pCsr);
 
 
 
 
148568 assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );
148569 sqlite3_free(pCsr);
148570 return SQLITE_OK;
148571 }
148572
@@ -149712,15 +150063,11 @@
150063 if( idxNum & FTS3_HAVE_DOCID_GE ) pDocidGe = apVal[iIdx++];
150064 if( idxNum & FTS3_HAVE_DOCID_LE ) pDocidLe = apVal[iIdx++];
150065 assert( iIdx==nVal );
150066
150067 /* In case the cursor has been used before, clear it now. */
150068 fts3ClearCursor(pCsr);
 
 
 
 
150069
150070 /* Set the lower and upper bounds on docids to return */
150071 pCsr->iMinDocid = fts3DocidRange(pDocidGe, SMALLEST_INT64);
150072 pCsr->iMaxDocid = fts3DocidRange(pDocidLe, LARGEST_INT64);
150073
@@ -149795,11 +150142,16 @@
150142 /*
150143 ** This is the xEof method of the virtual table. SQLite calls this
150144 ** routine to find out if it has reached the end of a result set.
150145 */
150146 static int fts3EofMethod(sqlite3_vtab_cursor *pCursor){
150147 Fts3Cursor *pCsr = (Fts3Cursor*)pCursor;
150148 if( pCsr->isEof ){
150149 fts3ClearCursor(pCsr);
150150 pCsr->isEof = 1;
150151 }
150152 return pCsr->isEof;
150153 }
150154
150155 /*
150156 ** This is the xRowid method. The SQLite core calls this routine to
150157 ** retrieve the rowid for the current row of the result set. fts3
@@ -168168,10 +168520,14 @@
168520 pRtree->zDb, pRtree->zName
168521 );
168522 rc = getIntFromStmt(db, zSql, &pRtree->iNodeSize);
168523 if( rc!=SQLITE_OK ){
168524 *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db));
168525 }else if( pRtree->iNodeSize<(512-64) ){
168526 rc = SQLITE_CORRUPT;
168527 *pzErr = sqlite3_mprintf("undersize RTree blobs in \"%q_node\"",
168528 pRtree->zName);
168529 }
168530 }
168531
168532 sqlite3_free(zSql);
168533 return rc;
@@ -175429,10 +175785,13 @@
175785 0, /* xSync */
175786 0, /* xCommit */
175787 0, /* xRollback */
175788 0, /* xFindMethod */
175789 0, /* xRename */
175790 0, /* xSavepoint */
175791 0, /* xRelease */
175792 0, /* xRollbackTo */
175793 };
175794 return sqlite3_create_module(db, "dbstat", &dbstat_module, 0);
175795 }
175796 #elif defined(SQLITE_ENABLE_DBSTAT_VTAB)
175797 SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3 *db){ return SQLITE_OK; }
@@ -184399,11 +184758,13 @@
184758 pParser->fts5yyerrcnt = -1;
184759 #endif
184760 pParser->fts5yytos = pParser->fts5yystack;
184761 pParser->fts5yystack[0].stateno = 0;
184762 pParser->fts5yystack[0].major = 0;
184763 #if fts5YYSTACKDEPTH>0
184764 pParser->fts5yystackEnd = &pParser->fts5yystack[fts5YYSTACKDEPTH-1];
184765 #endif
184766 }
184767
184768 #ifndef sqlite3Fts5Parser_ENGINEALWAYSONSTACK
184769 /*
184770 ** This function allocates a new parser.
@@ -199766,11 +200127,11 @@
200127 int nArg, /* Number of args */
200128 sqlite3_value **apUnused /* Function arguments */
200129 ){
200130 assert( nArg==0 );
200131 UNUSED_PARAM2(nArg, apUnused);
200132 sqlite3_result_text(pCtx, "fts5: 2017-07-12 18:05:54 604c11d1a39f09e47b6fcee0f8b1c1054f9dbbc7b2c1cf93312aeaa4b7095018", -1, SQLITE_TRANSIENT);
200133 }
200134
200135 static int fts5Init(sqlite3 *db){
200136 static const sqlite3_module fts5Mod = {
200137 /* iVersion */ 2,
@@ -203694,20 +204055,20 @@
204055 sqlite3_int64 iRowid; /* The rowid */
204056 };
204057
204058 /*
204059 ** The stmtConnect() method is invoked to create a new
204060 ** stmt_vtab that describes the stmt virtual table.
204061 **
204062 ** Think of this routine as the constructor for stmt_vtab objects.
204063 **
204064 ** All this routine needs to do is:
204065 **
204066 ** (1) Allocate the stmt_vtab object and initialize all fields.
204067 **
204068 ** (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
204069 ** result set of queries against stmt will look like.
204070 */
204071 static int stmtConnect(
204072 sqlite3 *db,
204073 void *pAux,
204074 int argc, const char *const*argv,
@@ -203871,11 +204232,11 @@
204232 return stmtNext(pVtabCursor);
204233 }
204234
204235 /*
204236 ** SQLite will invoke this method one or more times while planning a query
204237 ** that uses the stmt virtual table. This routine needs to create
204238 ** a query plan for each invocation and compute an estimated cost for that
204239 ** plan.
204240 */
204241 static int stmtBestIndex(
204242 sqlite3_vtab *tab,
@@ -203886,11 +204247,11 @@
204247 return SQLITE_OK;
204248 }
204249
204250 /*
204251 ** This following structure defines all the methods for the
204252 ** stmt virtual table.
204253 */
204254 static sqlite3_module stmtModule = {
204255 0, /* iVersion */
204256 0, /* xCreate */
204257 stmtConnect, /* xConnect */
@@ -203909,10 +204270,13 @@
204270 0, /* xSync */
204271 0, /* xCommit */
204272 0, /* xRollback */
204273 0, /* xFindMethod */
204274 0, /* xRename */
204275 0, /* xSavepoint */
204276 0, /* xRelease */
204277 0, /* xRollbackTo */
204278 };
204279
204280 #endif /* SQLITE_OMIT_VIRTUALTABLE */
204281
204282 SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3 *db){
204283
+95 -27
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,11 +121,11 @@
121121
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122122
** [sqlite_version()] and [sqlite_source_id()].
123123
*/
124124
#define SQLITE_VERSION "3.20.0"
125125
#define SQLITE_VERSION_NUMBER 3020000
126
-#define SQLITE_SOURCE_ID "2017-06-29 17:27:04 284707a7b3514a55cce24292e45632b7033d6edcff5b27deac5118b27c7b2954"
126
+#define SQLITE_SOURCE_ID "2017-07-12 18:05:54 604c11d1a39f09e47b6fcee0f8b1c1054f9dbbc7b2c1cf93312aeaa4b7095018"
127127
128128
/*
129129
** CAPI3REF: Run-Time Library Version Numbers
130130
** KEYWORDS: sqlite3_version sqlite3_sourceid
131131
**
@@ -415,11 +415,11 @@
415415
**
416416
** See also: [extended result code definitions]
417417
*/
418418
#define SQLITE_OK 0 /* Successful result */
419419
/* beginning-of-error-codes */
420
-#define SQLITE_ERROR 1 /* SQL error or missing database */
420
+#define SQLITE_ERROR 1 /* Generic error */
421421
#define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */
422422
#define SQLITE_PERM 3 /* Access permission denied */
423423
#define SQLITE_ABORT 4 /* Callback routine requested an abort */
424424
#define SQLITE_BUSY 5 /* The database file is locked */
425425
#define SQLITE_LOCKED 6 /* A table in the database is locked */
@@ -430,19 +430,19 @@
430430
#define SQLITE_CORRUPT 11 /* The database disk image is malformed */
431431
#define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */
432432
#define SQLITE_FULL 13 /* Insertion failed because database is full */
433433
#define SQLITE_CANTOPEN 14 /* Unable to open the database file */
434434
#define SQLITE_PROTOCOL 15 /* Database lock protocol error */
435
-#define SQLITE_EMPTY 16 /* Database is empty */
435
+#define SQLITE_EMPTY 16 /* Not used */
436436
#define SQLITE_SCHEMA 17 /* The database schema changed */
437437
#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
438438
#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
439439
#define SQLITE_MISMATCH 20 /* Data type mismatch */
440440
#define SQLITE_MISUSE 21 /* Library used incorrectly */
441441
#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
442442
#define SQLITE_AUTH 23 /* Authorization denied */
443
-#define SQLITE_FORMAT 24 /* Auxiliary database format error */
443
+#define SQLITE_FORMAT 24 /* Not used */
444444
#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */
445445
#define SQLITE_NOTADB 26 /* File opened that is not a database file */
446446
#define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */
447447
#define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */
448448
#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */
@@ -4265,10 +4265,32 @@
42654265
42664266
/*
42674267
** CAPI3REF: Result Values From A Query
42684268
** KEYWORDS: {column access functions}
42694269
** METHOD: sqlite3_stmt
4270
+**
4271
+** <b>Summary:</b>
4272
+** <blockquote><table border=0 cellpadding=0 cellspacing=0>
4273
+** <tr><td><b>sqlite3_column_blob</b><td>&rarr;<td>BLOB result
4274
+** <tr><td><b>sqlite3_column_double</b><td>&rarr;<td>REAL result
4275
+** <tr><td><b>sqlite3_column_int</b><td>&rarr;<td>32-bit INTEGER result
4276
+** <tr><td><b>sqlite3_column_int64</b><td>&rarr;<td>64-bit INTEGER result
4277
+** <tr><td><b>sqlite3_column_text</b><td>&rarr;<td>UTF-8 TEXT result
4278
+** <tr><td><b>sqlite3_column_text16</b><td>&rarr;<td>UTF-16 TEXT result
4279
+** <tr><td><b>sqlite3_column_value</b><td>&rarr;<td>The result as an
4280
+** [sqlite3_value|unprotected sqlite3_value] object.
4281
+** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
4282
+** <tr><td><b>sqlite3_column_bytes</b><td>&rarr;<td>Size of a BLOB
4283
+** or a UTF-8 TEXT result in bytes
4284
+** <tr><td><b>sqlite3_column_bytes16&nbsp;&nbsp;</b>
4285
+** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
4286
+** TEXT in bytes
4287
+** <tr><td><b>sqlite3_column_type</b><td>&rarr;<td>Default
4288
+** datatype of the result
4289
+** </table></blockquote>
4290
+**
4291
+** <b>Details:</b>
42704292
**
42714293
** ^These routines return information about a single column of the current
42724294
** result row of a query. ^In every case the first argument is a pointer
42734295
** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
42744296
** that was returned from [sqlite3_prepare_v3()] or one of its variants)
@@ -4287,19 +4309,32 @@
42874309
** something other than [SQLITE_ROW], the results are undefined.
42884310
** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()]
42894311
** are called from a different thread while any of these routines
42904312
** are pending, then the results are undefined.
42914313
**
4314
+** The first six interfaces (_blob, _double, _int, _int64, _text, and _text16)
4315
+** each return the value of a result column in a specific data format. If
4316
+** the result column is not initially in the requested format (for example,
4317
+** if the query returns an integer but the sqlite3_column_text() interface
4318
+** is used to extract the value) then an automatic type conversion is performed.
4319
+**
42924320
** ^The sqlite3_column_type() routine returns the
42934321
** [SQLITE_INTEGER | datatype code] for the initial data type
42944322
** of the result column. ^The returned value is one of [SQLITE_INTEGER],
4295
-** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. The value
4296
-** returned by sqlite3_column_type() is only meaningful if no type
4297
-** conversions have occurred as described below. After a type conversion,
4298
-** the value returned by sqlite3_column_type() is undefined. Future
4323
+** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].
4324
+** The return value of sqlite3_column_type() can be used to decide which
4325
+** of the first six interface should be used to extract the column value.
4326
+** The value returned by sqlite3_column_type() is only meaningful if no
4327
+** automatic type conversions have occurred for the value in question.
4328
+** After a type conversion, the result of calling sqlite3_column_type()
4329
+** is undefined, though harmless. Future
42994330
** versions of SQLite may change the behavior of sqlite3_column_type()
43004331
** following a type conversion.
4332
+**
4333
+** If the result is a BLOB or a TEXT string, then the sqlite3_column_bytes()
4334
+** or sqlite3_column_bytes16() interfaces can be used to determine the size
4335
+** of that BLOB or string.
43014336
**
43024337
** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
43034338
** routine returns the number of bytes in that BLOB or string.
43044339
** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts
43054340
** the string to UTF-8 and then returns the number of bytes.
@@ -4333,13 +4368,17 @@
43334368
** [sqlite3_bind_value()] and [sqlite3_result_value()].
43344369
** If the [unprotected sqlite3_value] object returned by
43354370
** [sqlite3_column_value()] is used in any other way, including calls
43364371
** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
43374372
** or [sqlite3_value_bytes()], the behavior is not threadsafe.
4373
+** Hence, the sqlite3_column_value() interface
4374
+** is normally only useful within the implementation of
4375
+** [application-defined SQL functions] or [virtual tables], not within
4376
+** top-level application code.
43384377
**
4339
-** These routines attempt to convert the value where appropriate. ^For
4340
-** example, if the internal representation is FLOAT and a text result
4378
+** The these routines may attempt to convert the datatype of the result.
4379
+** ^For example, if the internal representation is FLOAT and a text result
43414380
** is requested, [sqlite3_snprintf()] is used internally to perform the
43424381
** conversion automatically. ^(The following table details the conversions
43434382
** that are applied:
43444383
**
43454384
** <blockquote>
@@ -4407,11 +4446,11 @@
44074446
** with calls to sqlite3_column_bytes().
44084447
**
44094448
** ^The pointers returned are valid until a type conversion occurs as
44104449
** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
44114450
** [sqlite3_finalize()] is called. ^The memory space used to hold strings
4412
-** and BLOBs is freed automatically. Do <em>not</em> pass the pointers returned
4451
+** and BLOBs is freed automatically. Do not pass the pointers returned
44134452
** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
44144453
** [sqlite3_free()].
44154454
**
44164455
** ^(If a memory allocation error occurs during the evaluation of any
44174456
** of these routines, a default value is returned. The default value
@@ -4418,19 +4457,19 @@
44184457
** is either the integer 0, the floating point number 0.0, or a NULL
44194458
** pointer. Subsequent calls to [sqlite3_errcode()] will return
44204459
** [SQLITE_NOMEM].)^
44214460
*/
44224461
SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
4423
-SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
4424
-SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
44254462
SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
44264463
SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
44274464
SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
44284465
SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
44294466
SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
4430
-SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
44314467
SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
4468
+SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
4469
+SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
4470
+SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
44324471
44334472
/*
44344473
** CAPI3REF: Destroy A Prepared Statement Object
44354474
** DESTRUCTOR: sqlite3_stmt
44364475
**
@@ -4660,25 +4699,43 @@
46604699
46614700
/*
46624701
** CAPI3REF: Obtaining SQL Values
46634702
** METHOD: sqlite3_value
46644703
**
4665
-** The C-language implementation of SQL functions and aggregates uses
4666
-** this set of interface routines to access the parameter values on
4667
-** the function or aggregate.
4704
+** <b>Summary:</b>
4705
+** <blockquote><table border=0 cellpadding=0 cellspacing=0>
4706
+** <tr><td><b>sqlite3_value_blob</b><td>&rarr;<td>BLOB value
4707
+** <tr><td><b>sqlite3_value_double</b><td>&rarr;<td>REAL value
4708
+** <tr><td><b>sqlite3_value_int</b><td>&rarr;<td>32-bit INTEGER value
4709
+** <tr><td><b>sqlite3_value_int64</b><td>&rarr;<td>64-bit INTEGER value
4710
+** <tr><td><b>sqlite3_value_text</b><td>&rarr;<td>UTF-8 TEXT value
4711
+** <tr><td><b>sqlite3_value_text16</b><td>&rarr;<td>UTF-16 TEXT value in
4712
+** the native byteorder
4713
+** <tr><td><b>sqlite3_value_text16be</b><td>&rarr;<td>UTF-16be TEXT value
4714
+** <tr><td><b>sqlite3_value_text16le</b><td>&rarr;<td>UTF-16le TEXT value
4715
+** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
4716
+** <tr><td><b>sqlite3_value_bytes</b><td>&rarr;<td>Size of a BLOB
4717
+** or a UTF-8 TEXT in bytes
4718
+** <tr><td><b>sqlite3_value_bytes16&nbsp;&nbsp;</b>
4719
+** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
4720
+** TEXT in bytes
4721
+** <tr><td><b>sqlite3_value_type</b><td>&rarr;<td>Default
4722
+** datatype of the value
4723
+** <tr><td><b>sqlite3_value_numeric_type&nbsp;&nbsp;</b>
4724
+** <td>&rarr;&nbsp;&nbsp;<td>Best numeric datatype of the value
4725
+** </table></blockquote>
46684726
**
4669
-** The xFunc (for scalar functions) or xStep (for aggregates) parameters
4670
-** to [sqlite3_create_function()] and [sqlite3_create_function16()]
4671
-** define callbacks that implement the SQL functions and aggregates.
4672
-** The 3rd parameter to these callbacks is an array of pointers to
4673
-** [protected sqlite3_value] objects. There is one [sqlite3_value] object for
4674
-** each parameter to the SQL function. These routines are used to
4675
-** extract values from the [sqlite3_value] objects.
4727
+** <b>Details:</b>
4728
+**
4729
+** This routine extract type, size, and content information from
4730
+** [protected sqlite3_value] objects. Protected sqlite3_value objects
4731
+** are used to pass parameter information into implementation of
4732
+** [application-defined SQL functions] and [virtual tables].
46764733
**
46774734
** These routines work only with [protected sqlite3_value] objects.
46784735
** Any attempt to use these routines on an [unprotected sqlite3_value]
4679
-** object results in undefined behavior.
4736
+** is not threadsafe.
46804737
**
46814738
** ^These routines work just like the corresponding [column access functions]
46824739
** except that these routines take a single [protected sqlite3_value] object
46834740
** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
46844741
**
@@ -4685,10 +4742,21 @@
46854742
** ^The sqlite3_value_text16() interface extracts a UTF-16 string
46864743
** in the native byte-order of the host machine. ^The
46874744
** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
46884745
** extract UTF-16 strings as big-endian and little-endian respectively.
46894746
**
4747
+** ^(The sqlite3_value_type(V) interface returns the
4748
+** [SQLITE_INTEGER | datatype code] for the initial datatype of the
4749
+** [sqlite3_value] object V. The returned value is one of [SQLITE_INTEGER],
4750
+** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].)^
4751
+** Other interfaces might change the datatype for an sqlite3_value object.
4752
+** For example, if the datatype is initially SQLITE_INTEGER and
4753
+** sqlite3_value_text(V) is called to extract a text value for that
4754
+** integer, then subsequent calls to sqlite3_value_type(V) might return
4755
+** SQLITE_TEXT. Whether or not a persistent internal datatype conversion
4756
+** occurs is undefined and may change from one release of SQLite to the next.
4757
+**
46904758
** ^(The sqlite3_value_numeric_type() interface attempts to apply
46914759
** numeric affinity to the value. This means that an attempt is
46924760
** made to convert the value to an integer or floating point. If
46934761
** such a conversion is possible without loss of information (in other
46944762
** words, if the value is a string that looks like a number)
@@ -4703,19 +4771,19 @@
47034771
**
47044772
** These routines must be called from the same thread as
47054773
** the SQL function that supplied the [sqlite3_value*] parameters.
47064774
*/
47074775
SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
4708
-SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
4709
-SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
47104776
SQLITE_API double sqlite3_value_double(sqlite3_value*);
47114777
SQLITE_API int sqlite3_value_int(sqlite3_value*);
47124778
SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
47134779
SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
47144780
SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
47154781
SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
47164782
SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
4783
+SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
4784
+SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
47174785
SQLITE_API int sqlite3_value_type(sqlite3_value*);
47184786
SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
47194787
47204788
/*
47214789
** CAPI3REF: Finding The Subtype Of SQL Values
47224790
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,11 +121,11 @@
121 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122 ** [sqlite_version()] and [sqlite_source_id()].
123 */
124 #define SQLITE_VERSION "3.20.0"
125 #define SQLITE_VERSION_NUMBER 3020000
126 #define SQLITE_SOURCE_ID "2017-06-29 17:27:04 284707a7b3514a55cce24292e45632b7033d6edcff5b27deac5118b27c7b2954"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version sqlite3_sourceid
131 **
@@ -415,11 +415,11 @@
415 **
416 ** See also: [extended result code definitions]
417 */
418 #define SQLITE_OK 0 /* Successful result */
419 /* beginning-of-error-codes */
420 #define SQLITE_ERROR 1 /* SQL error or missing database */
421 #define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */
422 #define SQLITE_PERM 3 /* Access permission denied */
423 #define SQLITE_ABORT 4 /* Callback routine requested an abort */
424 #define SQLITE_BUSY 5 /* The database file is locked */
425 #define SQLITE_LOCKED 6 /* A table in the database is locked */
@@ -430,19 +430,19 @@
430 #define SQLITE_CORRUPT 11 /* The database disk image is malformed */
431 #define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */
432 #define SQLITE_FULL 13 /* Insertion failed because database is full */
433 #define SQLITE_CANTOPEN 14 /* Unable to open the database file */
434 #define SQLITE_PROTOCOL 15 /* Database lock protocol error */
435 #define SQLITE_EMPTY 16 /* Database is empty */
436 #define SQLITE_SCHEMA 17 /* The database schema changed */
437 #define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
438 #define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
439 #define SQLITE_MISMATCH 20 /* Data type mismatch */
440 #define SQLITE_MISUSE 21 /* Library used incorrectly */
441 #define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
442 #define SQLITE_AUTH 23 /* Authorization denied */
443 #define SQLITE_FORMAT 24 /* Auxiliary database format error */
444 #define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */
445 #define SQLITE_NOTADB 26 /* File opened that is not a database file */
446 #define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */
447 #define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */
448 #define SQLITE_ROW 100 /* sqlite3_step() has another row ready */
@@ -4265,10 +4265,32 @@
4265
4266 /*
4267 ** CAPI3REF: Result Values From A Query
4268 ** KEYWORDS: {column access functions}
4269 ** METHOD: sqlite3_stmt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4270 **
4271 ** ^These routines return information about a single column of the current
4272 ** result row of a query. ^In every case the first argument is a pointer
4273 ** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
4274 ** that was returned from [sqlite3_prepare_v3()] or one of its variants)
@@ -4287,19 +4309,32 @@
4287 ** something other than [SQLITE_ROW], the results are undefined.
4288 ** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()]
4289 ** are called from a different thread while any of these routines
4290 ** are pending, then the results are undefined.
4291 **
 
 
 
 
 
 
4292 ** ^The sqlite3_column_type() routine returns the
4293 ** [SQLITE_INTEGER | datatype code] for the initial data type
4294 ** of the result column. ^The returned value is one of [SQLITE_INTEGER],
4295 ** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. The value
4296 ** returned by sqlite3_column_type() is only meaningful if no type
4297 ** conversions have occurred as described below. After a type conversion,
4298 ** the value returned by sqlite3_column_type() is undefined. Future
 
 
 
4299 ** versions of SQLite may change the behavior of sqlite3_column_type()
4300 ** following a type conversion.
 
 
 
 
4301 **
4302 ** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
4303 ** routine returns the number of bytes in that BLOB or string.
4304 ** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts
4305 ** the string to UTF-8 and then returns the number of bytes.
@@ -4333,13 +4368,17 @@
4333 ** [sqlite3_bind_value()] and [sqlite3_result_value()].
4334 ** If the [unprotected sqlite3_value] object returned by
4335 ** [sqlite3_column_value()] is used in any other way, including calls
4336 ** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
4337 ** or [sqlite3_value_bytes()], the behavior is not threadsafe.
 
 
 
 
4338 **
4339 ** These routines attempt to convert the value where appropriate. ^For
4340 ** example, if the internal representation is FLOAT and a text result
4341 ** is requested, [sqlite3_snprintf()] is used internally to perform the
4342 ** conversion automatically. ^(The following table details the conversions
4343 ** that are applied:
4344 **
4345 ** <blockquote>
@@ -4407,11 +4446,11 @@
4407 ** with calls to sqlite3_column_bytes().
4408 **
4409 ** ^The pointers returned are valid until a type conversion occurs as
4410 ** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
4411 ** [sqlite3_finalize()] is called. ^The memory space used to hold strings
4412 ** and BLOBs is freed automatically. Do <em>not</em> pass the pointers returned
4413 ** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
4414 ** [sqlite3_free()].
4415 **
4416 ** ^(If a memory allocation error occurs during the evaluation of any
4417 ** of these routines, a default value is returned. The default value
@@ -4418,19 +4457,19 @@
4418 ** is either the integer 0, the floating point number 0.0, or a NULL
4419 ** pointer. Subsequent calls to [sqlite3_errcode()] will return
4420 ** [SQLITE_NOMEM].)^
4421 */
4422 SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
4423 SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
4424 SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
4425 SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
4426 SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
4427 SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
4428 SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
4429 SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
4430 SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
4431 SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
 
 
 
4432
4433 /*
4434 ** CAPI3REF: Destroy A Prepared Statement Object
4435 ** DESTRUCTOR: sqlite3_stmt
4436 **
@@ -4660,25 +4699,43 @@
4660
4661 /*
4662 ** CAPI3REF: Obtaining SQL Values
4663 ** METHOD: sqlite3_value
4664 **
4665 ** The C-language implementation of SQL functions and aggregates uses
4666 ** this set of interface routines to access the parameter values on
4667 ** the function or aggregate.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4668 **
4669 ** The xFunc (for scalar functions) or xStep (for aggregates) parameters
4670 ** to [sqlite3_create_function()] and [sqlite3_create_function16()]
4671 ** define callbacks that implement the SQL functions and aggregates.
4672 ** The 3rd parameter to these callbacks is an array of pointers to
4673 ** [protected sqlite3_value] objects. There is one [sqlite3_value] object for
4674 ** each parameter to the SQL function. These routines are used to
4675 ** extract values from the [sqlite3_value] objects.
4676 **
4677 ** These routines work only with [protected sqlite3_value] objects.
4678 ** Any attempt to use these routines on an [unprotected sqlite3_value]
4679 ** object results in undefined behavior.
4680 **
4681 ** ^These routines work just like the corresponding [column access functions]
4682 ** except that these routines take a single [protected sqlite3_value] object
4683 ** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
4684 **
@@ -4685,10 +4742,21 @@
4685 ** ^The sqlite3_value_text16() interface extracts a UTF-16 string
4686 ** in the native byte-order of the host machine. ^The
4687 ** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
4688 ** extract UTF-16 strings as big-endian and little-endian respectively.
4689 **
 
 
 
 
 
 
 
 
 
 
 
4690 ** ^(The sqlite3_value_numeric_type() interface attempts to apply
4691 ** numeric affinity to the value. This means that an attempt is
4692 ** made to convert the value to an integer or floating point. If
4693 ** such a conversion is possible without loss of information (in other
4694 ** words, if the value is a string that looks like a number)
@@ -4703,19 +4771,19 @@
4703 **
4704 ** These routines must be called from the same thread as
4705 ** the SQL function that supplied the [sqlite3_value*] parameters.
4706 */
4707 SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
4708 SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
4709 SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
4710 SQLITE_API double sqlite3_value_double(sqlite3_value*);
4711 SQLITE_API int sqlite3_value_int(sqlite3_value*);
4712 SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
4713 SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
4714 SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
4715 SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
4716 SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
 
 
4717 SQLITE_API int sqlite3_value_type(sqlite3_value*);
4718 SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
4719
4720 /*
4721 ** CAPI3REF: Finding The Subtype Of SQL Values
4722
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -121,11 +121,11 @@
121 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
122 ** [sqlite_version()] and [sqlite_source_id()].
123 */
124 #define SQLITE_VERSION "3.20.0"
125 #define SQLITE_VERSION_NUMBER 3020000
126 #define SQLITE_SOURCE_ID "2017-07-12 18:05:54 604c11d1a39f09e47b6fcee0f8b1c1054f9dbbc7b2c1cf93312aeaa4b7095018"
127
128 /*
129 ** CAPI3REF: Run-Time Library Version Numbers
130 ** KEYWORDS: sqlite3_version sqlite3_sourceid
131 **
@@ -415,11 +415,11 @@
415 **
416 ** See also: [extended result code definitions]
417 */
418 #define SQLITE_OK 0 /* Successful result */
419 /* beginning-of-error-codes */
420 #define SQLITE_ERROR 1 /* Generic error */
421 #define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */
422 #define SQLITE_PERM 3 /* Access permission denied */
423 #define SQLITE_ABORT 4 /* Callback routine requested an abort */
424 #define SQLITE_BUSY 5 /* The database file is locked */
425 #define SQLITE_LOCKED 6 /* A table in the database is locked */
@@ -430,19 +430,19 @@
430 #define SQLITE_CORRUPT 11 /* The database disk image is malformed */
431 #define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */
432 #define SQLITE_FULL 13 /* Insertion failed because database is full */
433 #define SQLITE_CANTOPEN 14 /* Unable to open the database file */
434 #define SQLITE_PROTOCOL 15 /* Database lock protocol error */
435 #define SQLITE_EMPTY 16 /* Not used */
436 #define SQLITE_SCHEMA 17 /* The database schema changed */
437 #define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
438 #define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
439 #define SQLITE_MISMATCH 20 /* Data type mismatch */
440 #define SQLITE_MISUSE 21 /* Library used incorrectly */
441 #define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
442 #define SQLITE_AUTH 23 /* Authorization denied */
443 #define SQLITE_FORMAT 24 /* Not used */
444 #define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */
445 #define SQLITE_NOTADB 26 /* File opened that is not a database file */
446 #define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */
447 #define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */
448 #define SQLITE_ROW 100 /* sqlite3_step() has another row ready */
@@ -4265,10 +4265,32 @@
4265
4266 /*
4267 ** CAPI3REF: Result Values From A Query
4268 ** KEYWORDS: {column access functions}
4269 ** METHOD: sqlite3_stmt
4270 **
4271 ** <b>Summary:</b>
4272 ** <blockquote><table border=0 cellpadding=0 cellspacing=0>
4273 ** <tr><td><b>sqlite3_column_blob</b><td>&rarr;<td>BLOB result
4274 ** <tr><td><b>sqlite3_column_double</b><td>&rarr;<td>REAL result
4275 ** <tr><td><b>sqlite3_column_int</b><td>&rarr;<td>32-bit INTEGER result
4276 ** <tr><td><b>sqlite3_column_int64</b><td>&rarr;<td>64-bit INTEGER result
4277 ** <tr><td><b>sqlite3_column_text</b><td>&rarr;<td>UTF-8 TEXT result
4278 ** <tr><td><b>sqlite3_column_text16</b><td>&rarr;<td>UTF-16 TEXT result
4279 ** <tr><td><b>sqlite3_column_value</b><td>&rarr;<td>The result as an
4280 ** [sqlite3_value|unprotected sqlite3_value] object.
4281 ** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
4282 ** <tr><td><b>sqlite3_column_bytes</b><td>&rarr;<td>Size of a BLOB
4283 ** or a UTF-8 TEXT result in bytes
4284 ** <tr><td><b>sqlite3_column_bytes16&nbsp;&nbsp;</b>
4285 ** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
4286 ** TEXT in bytes
4287 ** <tr><td><b>sqlite3_column_type</b><td>&rarr;<td>Default
4288 ** datatype of the result
4289 ** </table></blockquote>
4290 **
4291 ** <b>Details:</b>
4292 **
4293 ** ^These routines return information about a single column of the current
4294 ** result row of a query. ^In every case the first argument is a pointer
4295 ** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
4296 ** that was returned from [sqlite3_prepare_v3()] or one of its variants)
@@ -4287,19 +4309,32 @@
4309 ** something other than [SQLITE_ROW], the results are undefined.
4310 ** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()]
4311 ** are called from a different thread while any of these routines
4312 ** are pending, then the results are undefined.
4313 **
4314 ** The first six interfaces (_blob, _double, _int, _int64, _text, and _text16)
4315 ** each return the value of a result column in a specific data format. If
4316 ** the result column is not initially in the requested format (for example,
4317 ** if the query returns an integer but the sqlite3_column_text() interface
4318 ** is used to extract the value) then an automatic type conversion is performed.
4319 **
4320 ** ^The sqlite3_column_type() routine returns the
4321 ** [SQLITE_INTEGER | datatype code] for the initial data type
4322 ** of the result column. ^The returned value is one of [SQLITE_INTEGER],
4323 ** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].
4324 ** The return value of sqlite3_column_type() can be used to decide which
4325 ** of the first six interface should be used to extract the column value.
4326 ** The value returned by sqlite3_column_type() is only meaningful if no
4327 ** automatic type conversions have occurred for the value in question.
4328 ** After a type conversion, the result of calling sqlite3_column_type()
4329 ** is undefined, though harmless. Future
4330 ** versions of SQLite may change the behavior of sqlite3_column_type()
4331 ** following a type conversion.
4332 **
4333 ** If the result is a BLOB or a TEXT string, then the sqlite3_column_bytes()
4334 ** or sqlite3_column_bytes16() interfaces can be used to determine the size
4335 ** of that BLOB or string.
4336 **
4337 ** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
4338 ** routine returns the number of bytes in that BLOB or string.
4339 ** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts
4340 ** the string to UTF-8 and then returns the number of bytes.
@@ -4333,13 +4368,17 @@
4368 ** [sqlite3_bind_value()] and [sqlite3_result_value()].
4369 ** If the [unprotected sqlite3_value] object returned by
4370 ** [sqlite3_column_value()] is used in any other way, including calls
4371 ** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
4372 ** or [sqlite3_value_bytes()], the behavior is not threadsafe.
4373 ** Hence, the sqlite3_column_value() interface
4374 ** is normally only useful within the implementation of
4375 ** [application-defined SQL functions] or [virtual tables], not within
4376 ** top-level application code.
4377 **
4378 ** The these routines may attempt to convert the datatype of the result.
4379 ** ^For example, if the internal representation is FLOAT and a text result
4380 ** is requested, [sqlite3_snprintf()] is used internally to perform the
4381 ** conversion automatically. ^(The following table details the conversions
4382 ** that are applied:
4383 **
4384 ** <blockquote>
@@ -4407,11 +4446,11 @@
4446 ** with calls to sqlite3_column_bytes().
4447 **
4448 ** ^The pointers returned are valid until a type conversion occurs as
4449 ** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
4450 ** [sqlite3_finalize()] is called. ^The memory space used to hold strings
4451 ** and BLOBs is freed automatically. Do not pass the pointers returned
4452 ** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
4453 ** [sqlite3_free()].
4454 **
4455 ** ^(If a memory allocation error occurs during the evaluation of any
4456 ** of these routines, a default value is returned. The default value
@@ -4418,19 +4457,19 @@
4457 ** is either the integer 0, the floating point number 0.0, or a NULL
4458 ** pointer. Subsequent calls to [sqlite3_errcode()] will return
4459 ** [SQLITE_NOMEM].)^
4460 */
4461 SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
 
 
4462 SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
4463 SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
4464 SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
4465 SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
4466 SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
 
4467 SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
4468 SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
4469 SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
4470 SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
4471
4472 /*
4473 ** CAPI3REF: Destroy A Prepared Statement Object
4474 ** DESTRUCTOR: sqlite3_stmt
4475 **
@@ -4660,25 +4699,43 @@
4699
4700 /*
4701 ** CAPI3REF: Obtaining SQL Values
4702 ** METHOD: sqlite3_value
4703 **
4704 ** <b>Summary:</b>
4705 ** <blockquote><table border=0 cellpadding=0 cellspacing=0>
4706 ** <tr><td><b>sqlite3_value_blob</b><td>&rarr;<td>BLOB value
4707 ** <tr><td><b>sqlite3_value_double</b><td>&rarr;<td>REAL value
4708 ** <tr><td><b>sqlite3_value_int</b><td>&rarr;<td>32-bit INTEGER value
4709 ** <tr><td><b>sqlite3_value_int64</b><td>&rarr;<td>64-bit INTEGER value
4710 ** <tr><td><b>sqlite3_value_text</b><td>&rarr;<td>UTF-8 TEXT value
4711 ** <tr><td><b>sqlite3_value_text16</b><td>&rarr;<td>UTF-16 TEXT value in
4712 ** the native byteorder
4713 ** <tr><td><b>sqlite3_value_text16be</b><td>&rarr;<td>UTF-16be TEXT value
4714 ** <tr><td><b>sqlite3_value_text16le</b><td>&rarr;<td>UTF-16le TEXT value
4715 ** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
4716 ** <tr><td><b>sqlite3_value_bytes</b><td>&rarr;<td>Size of a BLOB
4717 ** or a UTF-8 TEXT in bytes
4718 ** <tr><td><b>sqlite3_value_bytes16&nbsp;&nbsp;</b>
4719 ** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
4720 ** TEXT in bytes
4721 ** <tr><td><b>sqlite3_value_type</b><td>&rarr;<td>Default
4722 ** datatype of the value
4723 ** <tr><td><b>sqlite3_value_numeric_type&nbsp;&nbsp;</b>
4724 ** <td>&rarr;&nbsp;&nbsp;<td>Best numeric datatype of the value
4725 ** </table></blockquote>
4726 **
4727 ** <b>Details:</b>
4728 **
4729 ** This routine extract type, size, and content information from
4730 ** [protected sqlite3_value] objects. Protected sqlite3_value objects
4731 ** are used to pass parameter information into implementation of
4732 ** [application-defined SQL functions] and [virtual tables].
 
4733 **
4734 ** These routines work only with [protected sqlite3_value] objects.
4735 ** Any attempt to use these routines on an [unprotected sqlite3_value]
4736 ** is not threadsafe.
4737 **
4738 ** ^These routines work just like the corresponding [column access functions]
4739 ** except that these routines take a single [protected sqlite3_value] object
4740 ** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
4741 **
@@ -4685,10 +4742,21 @@
4742 ** ^The sqlite3_value_text16() interface extracts a UTF-16 string
4743 ** in the native byte-order of the host machine. ^The
4744 ** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
4745 ** extract UTF-16 strings as big-endian and little-endian respectively.
4746 **
4747 ** ^(The sqlite3_value_type(V) interface returns the
4748 ** [SQLITE_INTEGER | datatype code] for the initial datatype of the
4749 ** [sqlite3_value] object V. The returned value is one of [SQLITE_INTEGER],
4750 ** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].)^
4751 ** Other interfaces might change the datatype for an sqlite3_value object.
4752 ** For example, if the datatype is initially SQLITE_INTEGER and
4753 ** sqlite3_value_text(V) is called to extract a text value for that
4754 ** integer, then subsequent calls to sqlite3_value_type(V) might return
4755 ** SQLITE_TEXT. Whether or not a persistent internal datatype conversion
4756 ** occurs is undefined and may change from one release of SQLite to the next.
4757 **
4758 ** ^(The sqlite3_value_numeric_type() interface attempts to apply
4759 ** numeric affinity to the value. This means that an attempt is
4760 ** made to convert the value to an integer or floating point. If
4761 ** such a conversion is possible without loss of information (in other
4762 ** words, if the value is a string that looks like a number)
@@ -4703,19 +4771,19 @@
4771 **
4772 ** These routines must be called from the same thread as
4773 ** the SQL function that supplied the [sqlite3_value*] parameters.
4774 */
4775 SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
 
 
4776 SQLITE_API double sqlite3_value_double(sqlite3_value*);
4777 SQLITE_API int sqlite3_value_int(sqlite3_value*);
4778 SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
4779 SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
4780 SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
4781 SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
4782 SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
4783 SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
4784 SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
4785 SQLITE_API int sqlite3_value_type(sqlite3_value*);
4786 SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
4787
4788 /*
4789 ** CAPI3REF: Finding The Subtype Of SQL Values
4790
-1
--- src/wiki.c
+++ src/wiki.c
@@ -1425,11 +1425,10 @@
14251425
** Render markdown wiki from FILE to stdout.
14261426
**
14271427
*/
14281428
void test_markdown_render(void){
14291429
Blob in, out;
1430
- db_find_and_open_repository(0,0);
14311430
verify_all_options();
14321431
if( g.argc!=3 ) usage("FILE");
14331432
blob_zero(&out);
14341433
blob_read_from_file(&in, g.argv[2]);
14351434
markdown_to_html(&in, 0, &out);
14361435
--- src/wiki.c
+++ src/wiki.c
@@ -1425,11 +1425,10 @@
1425 ** Render markdown wiki from FILE to stdout.
1426 **
1427 */
1428 void test_markdown_render(void){
1429 Blob in, out;
1430 db_find_and_open_repository(0,0);
1431 verify_all_options();
1432 if( g.argc!=3 ) usage("FILE");
1433 blob_zero(&out);
1434 blob_read_from_file(&in, g.argv[2]);
1435 markdown_to_html(&in, 0, &out);
1436
--- src/wiki.c
+++ src/wiki.c
@@ -1425,11 +1425,10 @@
1425 ** Render markdown wiki from FILE to stdout.
1426 **
1427 */
1428 void test_markdown_render(void){
1429 Blob in, out;
 
1430 verify_all_options();
1431 if( g.argc!=3 ) usage("FILE");
1432 blob_zero(&out);
1433 blob_read_from_file(&in, g.argv[2]);
1434 markdown_to_html(&in, 0, &out);
1435
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1738,11 +1738,10 @@
17381738
if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY;
17391739
if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY;
17401740
if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS;
17411741
if( find_option("inline",0,0)!=0 ) flags |= WIKI_INLINE;
17421742
if( find_option("noblock",0,0)!=0 ) flags |= WIKI_NOBLOCK;
1743
- db_find_and_open_repository(0,0);
17441743
verify_all_options();
17451744
if( g.argc!=3 ) usage("FILE");
17461745
blob_zero(&out);
17471746
blob_read_from_file(&in, g.argv[2]);
17481747
wiki_convert(&in, &out, flags);
17491748
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1738,11 +1738,10 @@
1738 if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY;
1739 if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY;
1740 if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS;
1741 if( find_option("inline",0,0)!=0 ) flags |= WIKI_INLINE;
1742 if( find_option("noblock",0,0)!=0 ) flags |= WIKI_NOBLOCK;
1743 db_find_and_open_repository(0,0);
1744 verify_all_options();
1745 if( g.argc!=3 ) usage("FILE");
1746 blob_zero(&out);
1747 blob_read_from_file(&in, g.argv[2]);
1748 wiki_convert(&in, &out, flags);
1749
--- src/wikiformat.c
+++ src/wikiformat.c
@@ -1738,11 +1738,10 @@
1738 if( find_option("htmlonly",0,0)!=0 ) flags |= WIKI_HTMLONLY;
1739 if( find_option("linksonly",0,0)!=0 ) flags |= WIKI_LINKSONLY;
1740 if( find_option("nobadlinks",0,0)!=0 ) flags |= WIKI_NOBADLINKS;
1741 if( find_option("inline",0,0)!=0 ) flags |= WIKI_INLINE;
1742 if( find_option("noblock",0,0)!=0 ) flags |= WIKI_NOBLOCK;
 
1743 verify_all_options();
1744 if( g.argc!=3 ) usage("FILE");
1745 blob_zero(&out);
1746 blob_read_from_file(&in, g.argv[2]);
1747 wiki_convert(&in, &out, flags);
1748

Keyboard Shortcuts

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