Fossil SCM

Update the built-in SQLite to the latest trunk version (pre-3.42.0) for testing.

drh 2023-04-01 15:52 trunk
Commit 2516fca74d93ddfe16bad170df14b1855c3cb17ac5136d6889aacc2af854a9c0
3 files changed +95 -180 +2090 -1543 +68 -12
+95 -180
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -115,10 +115,11 @@
115115
116116
#include <stdlib.h>
117117
#include <string.h>
118118
#include <stdio.h>
119119
#include <assert.h>
120
+#include <math.h>
120121
#include "sqlite3.h"
121122
typedef sqlite3_int64 i64;
122123
typedef sqlite3_uint64 u64;
123124
typedef unsigned char u8;
124125
#if SQLITE_USER_AUTHENTICATION
@@ -13021,14 +13022,18 @@
1302113022
if( pCsr->aPage==0 ){
1302213023
while( 1 ){
1302313024
if( pCsr->bOnePage==0 && pCsr->iPgno>pCsr->szDb ) return SQLITE_OK;
1302413025
rc = dbdataLoadPage(pCsr, pCsr->iPgno, &pCsr->aPage, &pCsr->nPage);
1302513026
if( rc!=SQLITE_OK ) return rc;
13026
- if( pCsr->aPage ) break;
13027
+ if( pCsr->aPage && pCsr->nPage>=256 ) break;
13028
+ sqlite3_free(pCsr->aPage);
13029
+ pCsr->aPage = 0;
1302713030
if( pCsr->bOnePage ) return SQLITE_OK;
1302813031
pCsr->iPgno++;
1302913032
}
13033
+
13034
+ assert( iOff+3+2<=pCsr->nPage );
1303013035
pCsr->iCell = pTab->bPtr ? -2 : 0;
1303113036
pCsr->nCell = get_uint16(&pCsr->aPage[iOff+3]);
1303213037
}
1303313038
1303413039
if( pTab->bPtr ){
@@ -13317,19 +13322,21 @@
1331713322
);
1331813323
}
1331913324
}
1332013325
if( rc==SQLITE_OK ){
1332113326
rc = sqlite3_bind_text(pCsr->pStmt, 1, zSchema, -1, SQLITE_TRANSIENT);
13322
- }else{
13323
- pTab->base.zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pTab->db));
1332413327
}
1332513328
1332613329
/* Try to determine the encoding of the db by inspecting the header
1332713330
** field on page 1. */
1332813331
if( rc==SQLITE_OK ){
1332913332
rc = dbdataGetEncoding(pCsr);
1333013333
}
13334
+
13335
+ if( rc!=SQLITE_OK ){
13336
+ pTab->base.zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pTab->db));
13337
+ }
1333113338
1333213339
if( rc==SQLITE_OK ){
1333313340
rc = dbdataNext(pCursor);
1333413341
}
1333513342
return rc;
@@ -17232,10 +17239,11 @@
1723217239
const char *zOrig = z;
1723317240
static const char *azTerm[] = { "", "*/", "\n" };
1723417241
int i;
1723517242
for(i=0; i<ArraySize(azTerm); i++){
1723617243
char *zNew = sqlite3_mprintf("%s%s;", zOrig, azTerm[i]);
17244
+ shell_check_oom(zNew);
1723717245
if( sqlite3_complete(zNew) ){
1723817246
size_t n = strlen(zNew);
1723917247
zNew[n-1] = 0;
1724017248
zToFree = zNew;
1724117249
z = zNew;
@@ -17666,13 +17674,13 @@
1766617674
char z[50];
1766717675
double r = sqlite3_column_double(p->pStmt, i);
1766817676
sqlite3_uint64 ur;
1766917677
memcpy(&ur,&r,sizeof(r));
1767017678
if( ur==0x7ff0000000000000LL ){
17671
- raw_printf(p->out, "1e999");
17679
+ raw_printf(p->out, "9.0e+999");
1767217680
}else if( ur==0xfff0000000000000LL ){
17673
- raw_printf(p->out, "-1e999");
17681
+ raw_printf(p->out, "-9.0e+999");
1767417682
}else{
1767517683
sqlite3_int64 ir = (sqlite3_int64)r;
1767617684
if( r==(double)ir ){
1767717685
sqlite3_snprintf(50,z,"%lld.0", ir);
1767817686
}else{
@@ -17712,13 +17720,13 @@
1771217720
char z[50];
1771317721
double r = sqlite3_column_double(p->pStmt, i);
1771417722
sqlite3_uint64 ur;
1771517723
memcpy(&ur,&r,sizeof(r));
1771617724
if( ur==0x7ff0000000000000LL ){
17717
- raw_printf(p->out, "1e999");
17725
+ raw_printf(p->out, "9.0e+999");
1771817726
}else if( ur==0xfff0000000000000LL ){
17719
- raw_printf(p->out, "-1e999");
17727
+ raw_printf(p->out, "-9.0e+999");
1772017728
}else{
1772117729
sqlite3_snprintf(50,z,"%!.20g", r);
1772217730
raw_printf(p->out, "%s", z);
1772317731
}
1772417732
}else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){
@@ -17918,10 +17926,11 @@
1791817926
char *zMsg;
1791917927
int i;
1792017928
if( db==0
1792117929
|| zSql==0
1792217930
|| (iOffset = sqlite3_error_offset(db))<0
17931
+ || iOffset>=strlen(zSql)
1792317932
){
1792417933
return sqlite3_mprintf("");
1792517934
}
1792617935
while( iOffset>50 ){
1792717936
iOffset--;
@@ -18530,26 +18539,31 @@
1853018539
1853118540
nVar = sqlite3_bind_parameter_count(pStmt);
1853218541
if( nVar==0 ) return; /* Nothing to do */
1853318542
if( sqlite3_table_column_metadata(pArg->db, "TEMP", "sqlite_parameters",
1853418543
"key", 0, 0, 0, 0, 0)!=SQLITE_OK ){
18535
- return; /* Parameter table does not exist */
18544
+ rc = SQLITE_NOTFOUND;
18545
+ pQ = 0;
18546
+ }else{
18547
+ rc = sqlite3_prepare_v2(pArg->db,
18548
+ "SELECT value FROM temp.sqlite_parameters"
18549
+ " WHERE key=?1", -1, &pQ, 0);
1853618550
}
18537
- rc = sqlite3_prepare_v2(pArg->db,
18538
- "SELECT value FROM temp.sqlite_parameters"
18539
- " WHERE key=?1", -1, &pQ, 0);
18540
- if( rc || pQ==0 ) return;
1854118551
for(i=1; i<=nVar; i++){
1854218552
char zNum[30];
1854318553
const char *zVar = sqlite3_bind_parameter_name(pStmt, i);
1854418554
if( zVar==0 ){
1854518555
sqlite3_snprintf(sizeof(zNum),zNum,"?%d",i);
1854618556
zVar = zNum;
1854718557
}
1854818558
sqlite3_bind_text(pQ, 1, zVar, -1, SQLITE_STATIC);
18549
- if( sqlite3_step(pQ)==SQLITE_ROW ){
18559
+ if( rc==SQLITE_OK && pQ && sqlite3_step(pQ)==SQLITE_ROW ){
1855018560
sqlite3_bind_value(pStmt, i, sqlite3_column_value(pQ, 0));
18561
+ }else if( sqlite3_strlike("_NAN", zVar, 0)==0 ){
18562
+ sqlite3_bind_double(pStmt, i, NAN);
18563
+ }else if( sqlite3_strlike("_INF", zVar, 0)==0 ){
18564
+ sqlite3_bind_double(pStmt, i, INFINITY);
1855118565
}else{
1855218566
sqlite3_bind_null(pStmt, i);
1855318567
}
1855418568
sqlite3_reset(pQ);
1855518569
}
@@ -19767,12 +19781,14 @@
1976719781
" Options:",
1976819782
" fkey-indexes Find missing foreign key indexes",
1976919783
#if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_FIDDLE)
1977019784
".load FILE ?ENTRY? Load an extension library",
1977119785
#endif
19772
-#ifndef SQLITE_SHELL_FIDDLE
19773
- ".log FILE|off Turn logging on or off. FILE can be stderr/stdout",
19786
+#if !defined(SQLITE_SHELL_FIDDLE)
19787
+ ".log FILE|on|off Turn logging on or off. FILE can be stderr/stdout",
19788
+#else
19789
+ ".log on|off Turn logging on or off.",
1977419790
#endif
1977519791
".mode MODE ?OPTIONS? Set output mode",
1977619792
" MODE is one of:",
1977719793
" ascii Columns/rows delimited by 0x1F and 0x1E",
1977819794
" box Tables using unicode box-drawing characters",
@@ -20036,20 +20052,31 @@
2003620052
static char *readFile(const char *zName, int *pnByte){
2003720053
FILE *in = fopen(zName, "rb");
2003820054
long nIn;
2003920055
size_t nRead;
2004020056
char *pBuf;
20057
+ int rc;
2004120058
if( in==0 ) return 0;
20042
- fseek(in, 0, SEEK_END);
20059
+ rc = fseek(in, 0, SEEK_END);
20060
+ if( rc!=0 ){
20061
+ raw_printf(stderr, "Error: '%s' not seekable\n", zName);
20062
+ fclose(in);
20063
+ return 0;
20064
+ }
2004320065
nIn = ftell(in);
2004420066
rewind(in);
2004520067
pBuf = sqlite3_malloc64( nIn+1 );
20046
- if( pBuf==0 ){ fclose(in); return 0; }
20068
+ if( pBuf==0 ){
20069
+ raw_printf(stderr, "Error: out of memory\n");
20070
+ fclose(in);
20071
+ return 0;
20072
+ }
2004720073
nRead = fread(pBuf, nIn, 1, in);
2004820074
fclose(in);
2004920075
if( nRead!=1 ){
2005020076
sqlite3_free(pBuf);
20077
+ raw_printf(stderr, "Error: cannot read '%s'\n", zName);
2005120078
return 0;
2005220079
}
2005320080
pBuf[nIn] = 0;
2005420081
if( pnByte ) *pnByte = nIn;
2005520082
return pBuf;
@@ -20234,57 +20261,10 @@
2023420261
utf8_printf(stderr,"Error on line %d of --hexdb input\n", nLine);
2023520262
return 0;
2023620263
}
2023720264
#endif /* SQLITE_OMIT_DESERIALIZE */
2023820265
20239
-/*
20240
-** Scalar function "shell_int32". The first argument to this function
20241
-** must be a blob. The second a non-negative integer. This function
20242
-** reads and returns a 32-bit big-endian integer from byte
20243
-** offset (4*<arg2>) of the blob.
20244
-*/
20245
-static void shellInt32(
20246
- sqlite3_context *context,
20247
- int argc,
20248
- sqlite3_value **argv
20249
-){
20250
- const unsigned char *pBlob;
20251
- int nBlob;
20252
- int iInt;
20253
-
20254
- UNUSED_PARAMETER(argc);
20255
- nBlob = sqlite3_value_bytes(argv[0]);
20256
- pBlob = (const unsigned char*)sqlite3_value_blob(argv[0]);
20257
- iInt = sqlite3_value_int(argv[1]);
20258
-
20259
- if( iInt>=0 && (iInt+1)*4<=nBlob ){
20260
- const unsigned char *a = &pBlob[iInt*4];
20261
- sqlite3_int64 iVal = ((sqlite3_int64)a[0]<<24)
20262
- + ((sqlite3_int64)a[1]<<16)
20263
- + ((sqlite3_int64)a[2]<< 8)
20264
- + ((sqlite3_int64)a[3]<< 0);
20265
- sqlite3_result_int64(context, iVal);
20266
- }
20267
-}
20268
-
20269
-/*
20270
-** Scalar function "shell_idquote(X)" returns string X quoted as an identifier,
20271
-** using "..." with internal double-quote characters doubled.
20272
-*/
20273
-static void shellIdQuote(
20274
- sqlite3_context *context,
20275
- int argc,
20276
- sqlite3_value **argv
20277
-){
20278
- const char *zName = (const char*)sqlite3_value_text(argv[0]);
20279
- UNUSED_PARAMETER(argc);
20280
- if( zName ){
20281
- char *z = sqlite3_mprintf("\"%w\"", zName);
20282
- sqlite3_result_text(context, z, -1, sqlite3_free);
20283
- }
20284
-}
20285
-
2028620266
/*
2028720267
** Scalar function "usleep(X)" invokes sqlite3_sleep(X) and returns X.
2028820268
*/
2028920269
static void shellUSleepFunc(
2029020270
sqlite3_context *context,
@@ -20295,101 +20275,10 @@
2029520275
(void)argcUnused;
2029620276
sqlite3_sleep(sleep/1000);
2029720277
sqlite3_result_int(context, sleep);
2029820278
}
2029920279
20300
-/*
20301
-** Scalar function "shell_escape_crnl" used by the .recover command.
20302
-** The argument passed to this function is the output of built-in
20303
-** function quote(). If the first character of the input is "'",
20304
-** indicating that the value passed to quote() was a text value,
20305
-** then this function searches the input for "\n" and "\r" characters
20306
-** and adds a wrapper similar to the following:
20307
-**
20308
-** replace(replace(<input>, '\n', char(10), '\r', char(13));
20309
-**
20310
-** Or, if the first character of the input is not "'", then a copy
20311
-** of the input is returned.
20312
-*/
20313
-static void shellEscapeCrnl(
20314
- sqlite3_context *context,
20315
- int argc,
20316
- sqlite3_value **argv
20317
-){
20318
- const char *zText = (const char*)sqlite3_value_text(argv[0]);
20319
- UNUSED_PARAMETER(argc);
20320
- if( zText && zText[0]=='\'' ){
20321
- i64 nText = sqlite3_value_bytes(argv[0]);
20322
- i64 i;
20323
- char zBuf1[20];
20324
- char zBuf2[20];
20325
- const char *zNL = 0;
20326
- const char *zCR = 0;
20327
- i64 nCR = 0;
20328
- i64 nNL = 0;
20329
-
20330
- for(i=0; zText[i]; i++){
20331
- if( zNL==0 && zText[i]=='\n' ){
20332
- zNL = unused_string(zText, "\\n", "\\012", zBuf1);
20333
- nNL = strlen(zNL);
20334
- }
20335
- if( zCR==0 && zText[i]=='\r' ){
20336
- zCR = unused_string(zText, "\\r", "\\015", zBuf2);
20337
- nCR = strlen(zCR);
20338
- }
20339
- }
20340
-
20341
- if( zNL || zCR ){
20342
- i64 iOut = 0;
20343
- i64 nMax = (nNL > nCR) ? nNL : nCR;
20344
- i64 nAlloc = nMax * nText + (nMax+64)*2;
20345
- char *zOut = (char*)sqlite3_malloc64(nAlloc);
20346
- if( zOut==0 ){
20347
- sqlite3_result_error_nomem(context);
20348
- return;
20349
- }
20350
-
20351
- if( zNL && zCR ){
20352
- memcpy(&zOut[iOut], "replace(replace(", 16);
20353
- iOut += 16;
20354
- }else{
20355
- memcpy(&zOut[iOut], "replace(", 8);
20356
- iOut += 8;
20357
- }
20358
- for(i=0; zText[i]; i++){
20359
- if( zText[i]=='\n' ){
20360
- memcpy(&zOut[iOut], zNL, nNL);
20361
- iOut += nNL;
20362
- }else if( zText[i]=='\r' ){
20363
- memcpy(&zOut[iOut], zCR, nCR);
20364
- iOut += nCR;
20365
- }else{
20366
- zOut[iOut] = zText[i];
20367
- iOut++;
20368
- }
20369
- }
20370
-
20371
- if( zNL ){
20372
- memcpy(&zOut[iOut], ",'", 2); iOut += 2;
20373
- memcpy(&zOut[iOut], zNL, nNL); iOut += nNL;
20374
- memcpy(&zOut[iOut], "', char(10))", 12); iOut += 12;
20375
- }
20376
- if( zCR ){
20377
- memcpy(&zOut[iOut], ",'", 2); iOut += 2;
20378
- memcpy(&zOut[iOut], zCR, nCR); iOut += nCR;
20379
- memcpy(&zOut[iOut], "', char(13))", 12); iOut += 12;
20380
- }
20381
-
20382
- sqlite3_result_text(context, zOut, iOut, SQLITE_TRANSIENT);
20383
- sqlite3_free(zOut);
20384
- return;
20385
- }
20386
- }
20387
-
20388
- sqlite3_result_value(context, argv[0]);
20389
-}
20390
-
2039120280
/* Flags for open_db().
2039220281
**
2039320282
** The default behavior of open_db() is to exit(1) if the database fails to
2039420283
** open. The OPEN_DB_KEEPALIVE flag changes that so that it prints an error
2039520284
** but still returns without calling exit.
@@ -20451,10 +20340,11 @@
2045120340
sqlite3_open(":memory:", &p->db);
2045220341
return;
2045320342
}
2045420343
exit(1);
2045520344
}
20345
+ sqlite3_db_config(p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, (int)0, (int*)0);
2045620346
2045720347
#ifndef SQLITE_OMIT_LOAD_EXTENSION
2045820348
sqlite3_enable_load_extension(p->db, 1);
2045920349
#endif
2046020350
sqlite3_shathree_init(p->db, 0, 0);
@@ -20467,13 +20357,10 @@
2046720357
sqlite3_series_init(p->db, 0, 0);
2046820358
#ifndef SQLITE_SHELL_FIDDLE
2046920359
sqlite3_fileio_init(p->db, 0, 0);
2047020360
sqlite3_completion_init(p->db, 0, 0);
2047120361
#endif
20472
-#if SQLITE_SHELL_HAVE_RECOVER
20473
- sqlite3_dbdata_init(p->db, 0, 0);
20474
-#endif
2047520362
#ifdef SQLITE_HAVE_ZLIB
2047620363
if( !p->bSafeModePersist ){
2047720364
sqlite3_zipfile_init(p->db, 0, 0);
2047820365
sqlite3_sqlar_init(p->db, 0, 0);
2047920366
}
@@ -20510,16 +20397,10 @@
2051020397
shellAddSchemaName, 0, 0);
2051120398
sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0,
2051220399
shellModuleSchema, 0, 0);
2051320400
sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p,
2051420401
shellPutsFunc, 0, 0);
20515
- sqlite3_create_function(p->db, "shell_escape_crnl", 1, SQLITE_UTF8, 0,
20516
- shellEscapeCrnl, 0, 0);
20517
- sqlite3_create_function(p->db, "shell_int32", 2, SQLITE_UTF8, 0,
20518
- shellInt32, 0, 0);
20519
- sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0,
20520
- shellIdQuote, 0, 0);
2052120402
sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
2052220403
shellUSleepFunc, 0, 0);
2052320404
#ifndef SQLITE_NOHAVE_SYSTEM
2052420405
sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0,
2052520406
editFunc, 0, 0);
@@ -20542,13 +20423,13 @@
2054220423
unsigned char *aData;
2054320424
if( p->openMode==SHELL_OPEN_DESERIALIZE ){
2054420425
aData = (unsigned char*)readFile(zDbFilename, &nData);
2054520426
}else{
2054620427
aData = readHexDb(p, &nData);
20547
- if( aData==0 ){
20548
- return;
20549
- }
20428
+ }
20429
+ if( aData==0 ){
20430
+ return;
2055020431
}
2055120432
rc = sqlite3_deserialize(p->db, "main", aData, nData, nData,
2055220433
SQLITE_DESERIALIZE_RESIZEABLE |
2055320434
SQLITE_DESERIALIZE_FREEONCLOSE);
2055420435
if( rc ){
@@ -20558,12 +20439,17 @@
2055820439
sqlite3_file_control(p->db, "main", SQLITE_FCNTL_SIZE_LIMIT, &p->szMax);
2055920440
}
2056020441
}
2056120442
#endif
2056220443
}
20563
- if( p->bSafeModePersist && p->db!=0 ){
20564
- sqlite3_set_authorizer(p->db, safeModeAuth, p);
20444
+ if( p->db!=0 ){
20445
+ if( p->bSafeModePersist ){
20446
+ sqlite3_set_authorizer(p->db, safeModeAuth, p);
20447
+ }
20448
+ sqlite3_db_config(
20449
+ p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, p->scanstatsOn, (int*)0
20450
+ );
2056520451
}
2056620452
}
2056720453
2056820454
/*
2056920455
** Attempt to close the databaes connection. Report errors.
@@ -23178,11 +23064,10 @@
2317823064
output_reset(p);
2317923065
if( nArg!=2 ){
2318023066
raw_printf(stderr, "Usage: .check GLOB-PATTERN\n");
2318123067
rc = 2;
2318223068
}else if( (zRes = readFile("testcase-out.txt", 0))==0 ){
23183
- raw_printf(stderr, "Error: cannot read 'testcase-out.txt'\n");
2318423069
rc = 2;
2318523070
}else if( testcase_glob(azArg[1],zRes)==0 ){
2318623071
utf8_printf(stderr,
2318723072
"testcase-%s FAILED\n Expected: [%s]\n Got: [%s]\n",
2318823073
p->zTestcase, azArg[1], zRes);
@@ -23308,10 +23193,12 @@
2330823193
{ "legacy_alter_table", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE },
2330923194
{ "legacy_file_format", SQLITE_DBCONFIG_LEGACY_FILE_FORMAT },
2331023195
{ "load_extension", SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION },
2331123196
{ "no_ckpt_on_close", SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE },
2331223197
{ "reset_database", SQLITE_DBCONFIG_RESET_DATABASE },
23198
+ { "reverse_scanorder", SQLITE_DBCONFIG_REVERSE_SCANORDER },
23199
+ { "stmt_scanstatus", SQLITE_DBCONFIG_STMT_SCANSTATUS },
2331323200
{ "trigger_eqp", SQLITE_DBCONFIG_TRIGGER_EQP },
2331423201
{ "trusted_schema", SQLITE_DBCONFIG_TRUSTED_SCHEMA },
2331523202
{ "writable_schema", SQLITE_DBCONFIG_WRITABLE_SCHEMA },
2331623203
};
2331723204
int ii, v;
@@ -24257,23 +24144,29 @@
2425724144
rc = 1;
2425824145
}
2425924146
}else
2426024147
#endif
2426124148
24262
-#ifndef SQLITE_SHELL_FIDDLE
2426324149
if( c=='l' && cli_strncmp(azArg[0], "log", n)==0 ){
24264
- failIfSafeMode(p, "cannot run .log in safe mode");
2426524150
if( nArg!=2 ){
2426624151
raw_printf(stderr, "Usage: .log FILENAME\n");
2426724152
rc = 1;
2426824153
}else{
2426924154
const char *zFile = azArg[1];
24155
+ if( p->bSafeMode
24156
+ && cli_strcmp(zFile,"on")!=0
24157
+ && cli_strcmp(zFile,"off")!=0
24158
+ ){
24159
+ raw_printf(stdout, "cannot set .log to anything other "
24160
+ "than \"on\" or \"off\"\n");
24161
+ zFile = "off";
24162
+ }
2427024163
output_file_close(p->pLog);
24164
+ if( cli_strcmp(zFile,"on")==0 ) zFile = "stdout";
2427124165
p->pLog = output_file_open(zFile, 0);
2427224166
}
2427324167
}else
24274
-#endif
2427524168
2427624169
if( c=='m' && cli_strncmp(azArg[0], "mode", n)==0 ){
2427724170
const char *zMode = 0;
2427824171
const char *zTabname = 0;
2427924172
int i, n2;
@@ -24905,10 +24798,13 @@
2490524798
if( cli_strcmp(azArg[1], "est")==0 ){
2490624799
p->scanstatsOn = 2;
2490724800
}else{
2490824801
p->scanstatsOn = (u8)booleanValue(azArg[1]);
2490924802
}
24803
+ sqlite3_db_config(
24804
+ p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, p->scanstatsOn, (int*)0
24805
+ );
2491024806
#ifndef SQLITE_ENABLE_STMT_SCANSTATUS
2491124807
raw_printf(stderr, "Warning: .scanstats not available in this build.\n");
2491224808
#endif
2491324809
}else{
2491424810
raw_printf(stderr, "Usage: .scanstats on|off|est\n");
@@ -26785,10 +26681,11 @@
2678526681
2678626682
/*
2678726683
** Show available command line options
2678826684
*/
2678926685
static const char zOptions[] =
26686
+ " -- treat no subsequent arguments as options\n"
2679026687
#if defined(SQLITE_HAVE_ZLIB) && !defined(SQLITE_OMIT_VIRTUALTABLE)
2679126688
" -A ARGS... run \".archive ARGS\" and exit\n"
2679226689
#endif
2679326690
" -append append the database to the end of the file\n"
2679426691
" -ascii set output mode to 'ascii'\n"
@@ -26847,13 +26744,13 @@
2684726744
" -zip open the file as a ZIP Archive\n"
2684826745
#endif
2684926746
;
2685026747
static void usage(int showDetail){
2685126748
utf8_printf(stderr,
26852
- "Usage: %s [OPTIONS] FILENAME [SQL]\n"
26749
+ "Usage: %s [OPTIONS] [FILENAME [SQL]]\n"
2685326750
"FILENAME is the name of an SQLite database. A new database is created\n"
26854
- "if the file does not previously exist.\n", Argv0);
26751
+ "if the file does not previously exist. Defaults to :memory:.\n", Argv0);
2685526752
if( showDetail ){
2685626753
utf8_printf(stderr, "OPTIONS include:\n%s", zOptions);
2685726754
}else{
2685826755
raw_printf(stderr, "Use the -help option for additional information\n");
2685926756
}
@@ -26881,13 +26778,15 @@
2688126778
data->pAuxDb = &data->aAuxDb[0];
2688226779
memcpy(data->colSeparator,SEP_Column, 2);
2688326780
memcpy(data->rowSeparator,SEP_Row, 2);
2688426781
data->showHeader = 0;
2688526782
data->shellFlgs = SHFLG_Lookaside;
26783
+ sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
26784
+#if !defined(SQLITE_SHELL_FIDDLE)
2688626785
verify_uninitialized();
26786
+#endif
2688726787
sqlite3_config(SQLITE_CONFIG_URI, 1);
26888
- sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
2688926788
sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
2689026789
sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
2689126790
sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
2689226791
}
2689326792
@@ -26960,10 +26859,11 @@
2696026859
int i;
2696126860
int rc = 0;
2696226861
int warnInmemoryDb = 0;
2696326862
int readStdin = 1;
2696426863
int nCmd = 0;
26864
+ int nOptsEnd = argc;
2696526865
char **azCmd = 0;
2696626866
const char *zVfs = 0; /* Value of -vfs command-line option */
2696726867
#if !SQLITE_SHELL_IS_UTF8
2696826868
char **argvToFree = 0;
2696926869
int argcToFree = 0;
@@ -27063,15 +26963,17 @@
2706326963
/* Do an initial pass through the command-line argument to locate
2706426964
** the name of the database file, the name of the initialization file,
2706526965
** the size of the alternative malloc heap,
2706626966
** and the first command to execute.
2706726967
*/
26968
+#ifndef SQLITE_SHELL_FIDDLE
2706826969
verify_uninitialized();
26970
+#endif
2706926971
for(i=1; i<argc; i++){
2707026972
char *z;
2707126973
z = argv[i];
27072
- if( z[0]!='-' ){
26974
+ if( z[0]!='-' || i>nOptsEnd ){
2707326975
if( data.aAuxDb->zDbFilename==0 ){
2707426976
data.aAuxDb->zDbFilename = z;
2707526977
}else{
2707626978
/* Excesss arguments are interpreted as SQL (or dot-commands) and
2707726979
** mean that nothing is read from stdin */
@@ -27079,13 +26981,17 @@
2707926981
nCmd++;
2708026982
azCmd = realloc(azCmd, sizeof(azCmd[0])*nCmd);
2708126983
shell_check_oom(azCmd);
2708226984
azCmd[nCmd-1] = z;
2708326985
}
26986
+ continue;
2708426987
}
2708526988
if( z[1]=='-' ) z++;
27086
- if( cli_strcmp(z,"-separator")==0
26989
+ if( cli_strcmp(z, "-")==0 ){
26990
+ nOptsEnd = i;
26991
+ continue;
26992
+ }else if( cli_strcmp(z,"-separator")==0
2708726993
|| cli_strcmp(z,"-nullvalue")==0
2708826994
|| cli_strcmp(z,"-newline")==0
2708926995
|| cli_strcmp(z,"-cmd")==0
2709026996
){
2709126997
(void)cmdline_option_value(argc, argv, ++i);
@@ -27103,10 +27009,11 @@
2710327009
sqlite3_int64 szHeap;
2710427010
2710527011
zSize = cmdline_option_value(argc, argv, ++i);
2710627012
szHeap = integerValue(zSize);
2710727013
if( szHeap>0x7fff0000 ) szHeap = 0x7fff0000;
27014
+ verify_uninitialized();
2710827015
sqlite3_config(SQLITE_CONFIG_HEAP, malloc((int)szHeap), (int)szHeap, 64);
2710927016
#else
2711027017
(void)cmdline_option_value(argc, argv, ++i);
2711127018
#endif
2711227019
}else if( cli_strcmp(z,"-pagecache")==0 ){
@@ -27116,24 +27023,27 @@
2711627023
if( sz<0 ) sz = 0;
2711727024
n = integerValue(cmdline_option_value(argc,argv,++i));
2711827025
if( sz>0 && n>0 && 0xffffffffffffLL/sz<n ){
2711927026
n = 0xffffffffffffLL/sz;
2712027027
}
27028
+ verify_uninitialized();
2712127029
sqlite3_config(SQLITE_CONFIG_PAGECACHE,
2712227030
(n>0 && sz>0) ? malloc(n*sz) : 0, sz, n);
2712327031
data.shellFlgs |= SHFLG_Pagecache;
2712427032
}else if( cli_strcmp(z,"-lookaside")==0 ){
2712527033
int n, sz;
2712627034
sz = (int)integerValue(cmdline_option_value(argc,argv,++i));
2712727035
if( sz<0 ) sz = 0;
2712827036
n = (int)integerValue(cmdline_option_value(argc,argv,++i));
2712927037
if( n<0 ) n = 0;
27038
+ verify_uninitialized();
2713027039
sqlite3_config(SQLITE_CONFIG_LOOKASIDE, sz, n);
2713127040
if( sz*n==0 ) data.shellFlgs &= ~SHFLG_Lookaside;
2713227041
}else if( cli_strcmp(z,"-threadsafe")==0 ){
2713327042
int n;
2713427043
n = (int)integerValue(cmdline_option_value(argc,argv,++i));
27044
+ verify_uninitialized();
2713527045
switch( n ){
2713627046
case 0: sqlite3_config(SQLITE_CONFIG_SINGLETHREAD); break;
2713727047
case 2: sqlite3_config(SQLITE_CONFIG_MULTITHREAD); break;
2713827048
default: sqlite3_config(SQLITE_CONFIG_SERIALIZED); break;
2713927049
}
@@ -27153,14 +27063,16 @@
2715327063
extern int sqlite3_multiple_initialize(const char*,int);
2715427064
sqlite3_multiplex_initialize(0, 1);
2715527065
#endif
2715627066
}else if( cli_strcmp(z,"-mmap")==0 ){
2715727067
sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
27068
+ verify_uninitialized();
2715827069
sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, sz, sz);
27159
-#ifdef SQLITE_ENABLE_SORTER_REFERENCES
27070
+#if defined(SQLITE_ENABLE_SORTER_REFERENCES)
2716027071
}else if( cli_strcmp(z,"-sorterref")==0 ){
2716127072
sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
27073
+ verify_uninitialized();
2716227074
sqlite3_config(SQLITE_CONFIG_SORTERREF_SIZE, (int)sz);
2716327075
#endif
2716427076
}else if( cli_strcmp(z,"-vfs")==0 ){
2716527077
zVfs = cmdline_option_value(argc, argv, ++i);
2716627078
#ifdef SQLITE_HAVE_ZLIB
@@ -27194,11 +27106,13 @@
2719427106
data.zNonce = strdup(argv[++i]);
2719527107
}else if( cli_strcmp(z,"-safe")==0 ){
2719627108
/* no-op - catch this on the second pass */
2719727109
}
2719827110
}
27111
+#ifndef SQLITE_SHELL_FIDDLE
2719927112
verify_uninitialized();
27113
+#endif
2720027114
2720127115
2720227116
#ifdef SQLITE_SHELL_INIT_PROC
2720327117
{
2720427118
/* If the SQLITE_SHELL_INIT_PROC macro is defined, then it is the name
@@ -27258,11 +27172,11 @@
2725827172
** file is processed so that the command-line arguments will override
2725927173
** settings in the initialization file.
2726027174
*/
2726127175
for(i=1; i<argc; i++){
2726227176
char *z = argv[i];
27263
- if( z[0]!='-' ) continue;
27177
+ if( z[0]!='-' || i>=nOptsEnd ) continue;
2726427178
if( z[1]=='-' ){ z++; }
2726527179
if( cli_strcmp(z,"-init")==0 ){
2726627180
i++;
2726727181
}else if( cli_strcmp(z,"-html")==0 ){
2726827182
data.mode = MODE_Html;
@@ -27442,10 +27356,11 @@
2744227356
free(azCmd);
2744327357
return rc==2 ? 0 : rc;
2744427358
}
2744527359
}else{
2744627360
open_db(&data, 0);
27361
+ echo_group_input(&data, azCmd[i]);
2744727362
rc = shell_exec(&data, azCmd[i], &zErrMsg);
2744827363
if( zErrMsg || rc ){
2744927364
if( zErrMsg!=0 ){
2745027365
utf8_printf(stderr,"Error: %s\n", zErrMsg);
2745127366
}else{
2745227367
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -115,10 +115,11 @@
115
116 #include <stdlib.h>
117 #include <string.h>
118 #include <stdio.h>
119 #include <assert.h>
 
120 #include "sqlite3.h"
121 typedef sqlite3_int64 i64;
122 typedef sqlite3_uint64 u64;
123 typedef unsigned char u8;
124 #if SQLITE_USER_AUTHENTICATION
@@ -13021,14 +13022,18 @@
13021 if( pCsr->aPage==0 ){
13022 while( 1 ){
13023 if( pCsr->bOnePage==0 && pCsr->iPgno>pCsr->szDb ) return SQLITE_OK;
13024 rc = dbdataLoadPage(pCsr, pCsr->iPgno, &pCsr->aPage, &pCsr->nPage);
13025 if( rc!=SQLITE_OK ) return rc;
13026 if( pCsr->aPage ) break;
 
 
13027 if( pCsr->bOnePage ) return SQLITE_OK;
13028 pCsr->iPgno++;
13029 }
 
 
13030 pCsr->iCell = pTab->bPtr ? -2 : 0;
13031 pCsr->nCell = get_uint16(&pCsr->aPage[iOff+3]);
13032 }
13033
13034 if( pTab->bPtr ){
@@ -13317,19 +13322,21 @@
13317 );
13318 }
13319 }
13320 if( rc==SQLITE_OK ){
13321 rc = sqlite3_bind_text(pCsr->pStmt, 1, zSchema, -1, SQLITE_TRANSIENT);
13322 }else{
13323 pTab->base.zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pTab->db));
13324 }
13325
13326 /* Try to determine the encoding of the db by inspecting the header
13327 ** field on page 1. */
13328 if( rc==SQLITE_OK ){
13329 rc = dbdataGetEncoding(pCsr);
13330 }
 
 
 
 
13331
13332 if( rc==SQLITE_OK ){
13333 rc = dbdataNext(pCursor);
13334 }
13335 return rc;
@@ -17232,10 +17239,11 @@
17232 const char *zOrig = z;
17233 static const char *azTerm[] = { "", "*/", "\n" };
17234 int i;
17235 for(i=0; i<ArraySize(azTerm); i++){
17236 char *zNew = sqlite3_mprintf("%s%s;", zOrig, azTerm[i]);
 
17237 if( sqlite3_complete(zNew) ){
17238 size_t n = strlen(zNew);
17239 zNew[n-1] = 0;
17240 zToFree = zNew;
17241 z = zNew;
@@ -17666,13 +17674,13 @@
17666 char z[50];
17667 double r = sqlite3_column_double(p->pStmt, i);
17668 sqlite3_uint64 ur;
17669 memcpy(&ur,&r,sizeof(r));
17670 if( ur==0x7ff0000000000000LL ){
17671 raw_printf(p->out, "1e999");
17672 }else if( ur==0xfff0000000000000LL ){
17673 raw_printf(p->out, "-1e999");
17674 }else{
17675 sqlite3_int64 ir = (sqlite3_int64)r;
17676 if( r==(double)ir ){
17677 sqlite3_snprintf(50,z,"%lld.0", ir);
17678 }else{
@@ -17712,13 +17720,13 @@
17712 char z[50];
17713 double r = sqlite3_column_double(p->pStmt, i);
17714 sqlite3_uint64 ur;
17715 memcpy(&ur,&r,sizeof(r));
17716 if( ur==0x7ff0000000000000LL ){
17717 raw_printf(p->out, "1e999");
17718 }else if( ur==0xfff0000000000000LL ){
17719 raw_printf(p->out, "-1e999");
17720 }else{
17721 sqlite3_snprintf(50,z,"%!.20g", r);
17722 raw_printf(p->out, "%s", z);
17723 }
17724 }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){
@@ -17918,10 +17926,11 @@
17918 char *zMsg;
17919 int i;
17920 if( db==0
17921 || zSql==0
17922 || (iOffset = sqlite3_error_offset(db))<0
 
17923 ){
17924 return sqlite3_mprintf("");
17925 }
17926 while( iOffset>50 ){
17927 iOffset--;
@@ -18530,26 +18539,31 @@
18530
18531 nVar = sqlite3_bind_parameter_count(pStmt);
18532 if( nVar==0 ) return; /* Nothing to do */
18533 if( sqlite3_table_column_metadata(pArg->db, "TEMP", "sqlite_parameters",
18534 "key", 0, 0, 0, 0, 0)!=SQLITE_OK ){
18535 return; /* Parameter table does not exist */
 
 
 
 
 
18536 }
18537 rc = sqlite3_prepare_v2(pArg->db,
18538 "SELECT value FROM temp.sqlite_parameters"
18539 " WHERE key=?1", -1, &pQ, 0);
18540 if( rc || pQ==0 ) return;
18541 for(i=1; i<=nVar; i++){
18542 char zNum[30];
18543 const char *zVar = sqlite3_bind_parameter_name(pStmt, i);
18544 if( zVar==0 ){
18545 sqlite3_snprintf(sizeof(zNum),zNum,"?%d",i);
18546 zVar = zNum;
18547 }
18548 sqlite3_bind_text(pQ, 1, zVar, -1, SQLITE_STATIC);
18549 if( sqlite3_step(pQ)==SQLITE_ROW ){
18550 sqlite3_bind_value(pStmt, i, sqlite3_column_value(pQ, 0));
 
 
 
 
18551 }else{
18552 sqlite3_bind_null(pStmt, i);
18553 }
18554 sqlite3_reset(pQ);
18555 }
@@ -19767,12 +19781,14 @@
19767 " Options:",
19768 " fkey-indexes Find missing foreign key indexes",
19769 #if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_FIDDLE)
19770 ".load FILE ?ENTRY? Load an extension library",
19771 #endif
19772 #ifndef SQLITE_SHELL_FIDDLE
19773 ".log FILE|off Turn logging on or off. FILE can be stderr/stdout",
 
 
19774 #endif
19775 ".mode MODE ?OPTIONS? Set output mode",
19776 " MODE is one of:",
19777 " ascii Columns/rows delimited by 0x1F and 0x1E",
19778 " box Tables using unicode box-drawing characters",
@@ -20036,20 +20052,31 @@
20036 static char *readFile(const char *zName, int *pnByte){
20037 FILE *in = fopen(zName, "rb");
20038 long nIn;
20039 size_t nRead;
20040 char *pBuf;
 
20041 if( in==0 ) return 0;
20042 fseek(in, 0, SEEK_END);
 
 
 
 
 
20043 nIn = ftell(in);
20044 rewind(in);
20045 pBuf = sqlite3_malloc64( nIn+1 );
20046 if( pBuf==0 ){ fclose(in); return 0; }
 
 
 
 
20047 nRead = fread(pBuf, nIn, 1, in);
20048 fclose(in);
20049 if( nRead!=1 ){
20050 sqlite3_free(pBuf);
 
20051 return 0;
20052 }
20053 pBuf[nIn] = 0;
20054 if( pnByte ) *pnByte = nIn;
20055 return pBuf;
@@ -20234,57 +20261,10 @@
20234 utf8_printf(stderr,"Error on line %d of --hexdb input\n", nLine);
20235 return 0;
20236 }
20237 #endif /* SQLITE_OMIT_DESERIALIZE */
20238
20239 /*
20240 ** Scalar function "shell_int32". The first argument to this function
20241 ** must be a blob. The second a non-negative integer. This function
20242 ** reads and returns a 32-bit big-endian integer from byte
20243 ** offset (4*<arg2>) of the blob.
20244 */
20245 static void shellInt32(
20246 sqlite3_context *context,
20247 int argc,
20248 sqlite3_value **argv
20249 ){
20250 const unsigned char *pBlob;
20251 int nBlob;
20252 int iInt;
20253
20254 UNUSED_PARAMETER(argc);
20255 nBlob = sqlite3_value_bytes(argv[0]);
20256 pBlob = (const unsigned char*)sqlite3_value_blob(argv[0]);
20257 iInt = sqlite3_value_int(argv[1]);
20258
20259 if( iInt>=0 && (iInt+1)*4<=nBlob ){
20260 const unsigned char *a = &pBlob[iInt*4];
20261 sqlite3_int64 iVal = ((sqlite3_int64)a[0]<<24)
20262 + ((sqlite3_int64)a[1]<<16)
20263 + ((sqlite3_int64)a[2]<< 8)
20264 + ((sqlite3_int64)a[3]<< 0);
20265 sqlite3_result_int64(context, iVal);
20266 }
20267 }
20268
20269 /*
20270 ** Scalar function "shell_idquote(X)" returns string X quoted as an identifier,
20271 ** using "..." with internal double-quote characters doubled.
20272 */
20273 static void shellIdQuote(
20274 sqlite3_context *context,
20275 int argc,
20276 sqlite3_value **argv
20277 ){
20278 const char *zName = (const char*)sqlite3_value_text(argv[0]);
20279 UNUSED_PARAMETER(argc);
20280 if( zName ){
20281 char *z = sqlite3_mprintf("\"%w\"", zName);
20282 sqlite3_result_text(context, z, -1, sqlite3_free);
20283 }
20284 }
20285
20286 /*
20287 ** Scalar function "usleep(X)" invokes sqlite3_sleep(X) and returns X.
20288 */
20289 static void shellUSleepFunc(
20290 sqlite3_context *context,
@@ -20295,101 +20275,10 @@
20295 (void)argcUnused;
20296 sqlite3_sleep(sleep/1000);
20297 sqlite3_result_int(context, sleep);
20298 }
20299
20300 /*
20301 ** Scalar function "shell_escape_crnl" used by the .recover command.
20302 ** The argument passed to this function is the output of built-in
20303 ** function quote(). If the first character of the input is "'",
20304 ** indicating that the value passed to quote() was a text value,
20305 ** then this function searches the input for "\n" and "\r" characters
20306 ** and adds a wrapper similar to the following:
20307 **
20308 ** replace(replace(<input>, '\n', char(10), '\r', char(13));
20309 **
20310 ** Or, if the first character of the input is not "'", then a copy
20311 ** of the input is returned.
20312 */
20313 static void shellEscapeCrnl(
20314 sqlite3_context *context,
20315 int argc,
20316 sqlite3_value **argv
20317 ){
20318 const char *zText = (const char*)sqlite3_value_text(argv[0]);
20319 UNUSED_PARAMETER(argc);
20320 if( zText && zText[0]=='\'' ){
20321 i64 nText = sqlite3_value_bytes(argv[0]);
20322 i64 i;
20323 char zBuf1[20];
20324 char zBuf2[20];
20325 const char *zNL = 0;
20326 const char *zCR = 0;
20327 i64 nCR = 0;
20328 i64 nNL = 0;
20329
20330 for(i=0; zText[i]; i++){
20331 if( zNL==0 && zText[i]=='\n' ){
20332 zNL = unused_string(zText, "\\n", "\\012", zBuf1);
20333 nNL = strlen(zNL);
20334 }
20335 if( zCR==0 && zText[i]=='\r' ){
20336 zCR = unused_string(zText, "\\r", "\\015", zBuf2);
20337 nCR = strlen(zCR);
20338 }
20339 }
20340
20341 if( zNL || zCR ){
20342 i64 iOut = 0;
20343 i64 nMax = (nNL > nCR) ? nNL : nCR;
20344 i64 nAlloc = nMax * nText + (nMax+64)*2;
20345 char *zOut = (char*)sqlite3_malloc64(nAlloc);
20346 if( zOut==0 ){
20347 sqlite3_result_error_nomem(context);
20348 return;
20349 }
20350
20351 if( zNL && zCR ){
20352 memcpy(&zOut[iOut], "replace(replace(", 16);
20353 iOut += 16;
20354 }else{
20355 memcpy(&zOut[iOut], "replace(", 8);
20356 iOut += 8;
20357 }
20358 for(i=0; zText[i]; i++){
20359 if( zText[i]=='\n' ){
20360 memcpy(&zOut[iOut], zNL, nNL);
20361 iOut += nNL;
20362 }else if( zText[i]=='\r' ){
20363 memcpy(&zOut[iOut], zCR, nCR);
20364 iOut += nCR;
20365 }else{
20366 zOut[iOut] = zText[i];
20367 iOut++;
20368 }
20369 }
20370
20371 if( zNL ){
20372 memcpy(&zOut[iOut], ",'", 2); iOut += 2;
20373 memcpy(&zOut[iOut], zNL, nNL); iOut += nNL;
20374 memcpy(&zOut[iOut], "', char(10))", 12); iOut += 12;
20375 }
20376 if( zCR ){
20377 memcpy(&zOut[iOut], ",'", 2); iOut += 2;
20378 memcpy(&zOut[iOut], zCR, nCR); iOut += nCR;
20379 memcpy(&zOut[iOut], "', char(13))", 12); iOut += 12;
20380 }
20381
20382 sqlite3_result_text(context, zOut, iOut, SQLITE_TRANSIENT);
20383 sqlite3_free(zOut);
20384 return;
20385 }
20386 }
20387
20388 sqlite3_result_value(context, argv[0]);
20389 }
20390
20391 /* Flags for open_db().
20392 **
20393 ** The default behavior of open_db() is to exit(1) if the database fails to
20394 ** open. The OPEN_DB_KEEPALIVE flag changes that so that it prints an error
20395 ** but still returns without calling exit.
@@ -20451,10 +20340,11 @@
20451 sqlite3_open(":memory:", &p->db);
20452 return;
20453 }
20454 exit(1);
20455 }
 
20456
20457 #ifndef SQLITE_OMIT_LOAD_EXTENSION
20458 sqlite3_enable_load_extension(p->db, 1);
20459 #endif
20460 sqlite3_shathree_init(p->db, 0, 0);
@@ -20467,13 +20357,10 @@
20467 sqlite3_series_init(p->db, 0, 0);
20468 #ifndef SQLITE_SHELL_FIDDLE
20469 sqlite3_fileio_init(p->db, 0, 0);
20470 sqlite3_completion_init(p->db, 0, 0);
20471 #endif
20472 #if SQLITE_SHELL_HAVE_RECOVER
20473 sqlite3_dbdata_init(p->db, 0, 0);
20474 #endif
20475 #ifdef SQLITE_HAVE_ZLIB
20476 if( !p->bSafeModePersist ){
20477 sqlite3_zipfile_init(p->db, 0, 0);
20478 sqlite3_sqlar_init(p->db, 0, 0);
20479 }
@@ -20510,16 +20397,10 @@
20510 shellAddSchemaName, 0, 0);
20511 sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0,
20512 shellModuleSchema, 0, 0);
20513 sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p,
20514 shellPutsFunc, 0, 0);
20515 sqlite3_create_function(p->db, "shell_escape_crnl", 1, SQLITE_UTF8, 0,
20516 shellEscapeCrnl, 0, 0);
20517 sqlite3_create_function(p->db, "shell_int32", 2, SQLITE_UTF8, 0,
20518 shellInt32, 0, 0);
20519 sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0,
20520 shellIdQuote, 0, 0);
20521 sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
20522 shellUSleepFunc, 0, 0);
20523 #ifndef SQLITE_NOHAVE_SYSTEM
20524 sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0,
20525 editFunc, 0, 0);
@@ -20542,13 +20423,13 @@
20542 unsigned char *aData;
20543 if( p->openMode==SHELL_OPEN_DESERIALIZE ){
20544 aData = (unsigned char*)readFile(zDbFilename, &nData);
20545 }else{
20546 aData = readHexDb(p, &nData);
20547 if( aData==0 ){
20548 return;
20549 }
20550 }
20551 rc = sqlite3_deserialize(p->db, "main", aData, nData, nData,
20552 SQLITE_DESERIALIZE_RESIZEABLE |
20553 SQLITE_DESERIALIZE_FREEONCLOSE);
20554 if( rc ){
@@ -20558,12 +20439,17 @@
20558 sqlite3_file_control(p->db, "main", SQLITE_FCNTL_SIZE_LIMIT, &p->szMax);
20559 }
20560 }
20561 #endif
20562 }
20563 if( p->bSafeModePersist && p->db!=0 ){
20564 sqlite3_set_authorizer(p->db, safeModeAuth, p);
 
 
 
 
 
20565 }
20566 }
20567
20568 /*
20569 ** Attempt to close the databaes connection. Report errors.
@@ -23178,11 +23064,10 @@
23178 output_reset(p);
23179 if( nArg!=2 ){
23180 raw_printf(stderr, "Usage: .check GLOB-PATTERN\n");
23181 rc = 2;
23182 }else if( (zRes = readFile("testcase-out.txt", 0))==0 ){
23183 raw_printf(stderr, "Error: cannot read 'testcase-out.txt'\n");
23184 rc = 2;
23185 }else if( testcase_glob(azArg[1],zRes)==0 ){
23186 utf8_printf(stderr,
23187 "testcase-%s FAILED\n Expected: [%s]\n Got: [%s]\n",
23188 p->zTestcase, azArg[1], zRes);
@@ -23308,10 +23193,12 @@
23308 { "legacy_alter_table", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE },
23309 { "legacy_file_format", SQLITE_DBCONFIG_LEGACY_FILE_FORMAT },
23310 { "load_extension", SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION },
23311 { "no_ckpt_on_close", SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE },
23312 { "reset_database", SQLITE_DBCONFIG_RESET_DATABASE },
 
 
23313 { "trigger_eqp", SQLITE_DBCONFIG_TRIGGER_EQP },
23314 { "trusted_schema", SQLITE_DBCONFIG_TRUSTED_SCHEMA },
23315 { "writable_schema", SQLITE_DBCONFIG_WRITABLE_SCHEMA },
23316 };
23317 int ii, v;
@@ -24257,23 +24144,29 @@
24257 rc = 1;
24258 }
24259 }else
24260 #endif
24261
24262 #ifndef SQLITE_SHELL_FIDDLE
24263 if( c=='l' && cli_strncmp(azArg[0], "log", n)==0 ){
24264 failIfSafeMode(p, "cannot run .log in safe mode");
24265 if( nArg!=2 ){
24266 raw_printf(stderr, "Usage: .log FILENAME\n");
24267 rc = 1;
24268 }else{
24269 const char *zFile = azArg[1];
 
 
 
 
 
 
 
 
24270 output_file_close(p->pLog);
 
24271 p->pLog = output_file_open(zFile, 0);
24272 }
24273 }else
24274 #endif
24275
24276 if( c=='m' && cli_strncmp(azArg[0], "mode", n)==0 ){
24277 const char *zMode = 0;
24278 const char *zTabname = 0;
24279 int i, n2;
@@ -24905,10 +24798,13 @@
24905 if( cli_strcmp(azArg[1], "est")==0 ){
24906 p->scanstatsOn = 2;
24907 }else{
24908 p->scanstatsOn = (u8)booleanValue(azArg[1]);
24909 }
 
 
 
24910 #ifndef SQLITE_ENABLE_STMT_SCANSTATUS
24911 raw_printf(stderr, "Warning: .scanstats not available in this build.\n");
24912 #endif
24913 }else{
24914 raw_printf(stderr, "Usage: .scanstats on|off|est\n");
@@ -26785,10 +26681,11 @@
26785
26786 /*
26787 ** Show available command line options
26788 */
26789 static const char zOptions[] =
 
26790 #if defined(SQLITE_HAVE_ZLIB) && !defined(SQLITE_OMIT_VIRTUALTABLE)
26791 " -A ARGS... run \".archive ARGS\" and exit\n"
26792 #endif
26793 " -append append the database to the end of the file\n"
26794 " -ascii set output mode to 'ascii'\n"
@@ -26847,13 +26744,13 @@
26847 " -zip open the file as a ZIP Archive\n"
26848 #endif
26849 ;
26850 static void usage(int showDetail){
26851 utf8_printf(stderr,
26852 "Usage: %s [OPTIONS] FILENAME [SQL]\n"
26853 "FILENAME is the name of an SQLite database. A new database is created\n"
26854 "if the file does not previously exist.\n", Argv0);
26855 if( showDetail ){
26856 utf8_printf(stderr, "OPTIONS include:\n%s", zOptions);
26857 }else{
26858 raw_printf(stderr, "Use the -help option for additional information\n");
26859 }
@@ -26881,13 +26778,15 @@
26881 data->pAuxDb = &data->aAuxDb[0];
26882 memcpy(data->colSeparator,SEP_Column, 2);
26883 memcpy(data->rowSeparator,SEP_Row, 2);
26884 data->showHeader = 0;
26885 data->shellFlgs = SHFLG_Lookaside;
 
 
26886 verify_uninitialized();
 
26887 sqlite3_config(SQLITE_CONFIG_URI, 1);
26888 sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
26889 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
26890 sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
26891 sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
26892 }
26893
@@ -26960,10 +26859,11 @@
26960 int i;
26961 int rc = 0;
26962 int warnInmemoryDb = 0;
26963 int readStdin = 1;
26964 int nCmd = 0;
 
26965 char **azCmd = 0;
26966 const char *zVfs = 0; /* Value of -vfs command-line option */
26967 #if !SQLITE_SHELL_IS_UTF8
26968 char **argvToFree = 0;
26969 int argcToFree = 0;
@@ -27063,15 +26963,17 @@
27063 /* Do an initial pass through the command-line argument to locate
27064 ** the name of the database file, the name of the initialization file,
27065 ** the size of the alternative malloc heap,
27066 ** and the first command to execute.
27067 */
 
27068 verify_uninitialized();
 
27069 for(i=1; i<argc; i++){
27070 char *z;
27071 z = argv[i];
27072 if( z[0]!='-' ){
27073 if( data.aAuxDb->zDbFilename==0 ){
27074 data.aAuxDb->zDbFilename = z;
27075 }else{
27076 /* Excesss arguments are interpreted as SQL (or dot-commands) and
27077 ** mean that nothing is read from stdin */
@@ -27079,13 +26981,17 @@
27079 nCmd++;
27080 azCmd = realloc(azCmd, sizeof(azCmd[0])*nCmd);
27081 shell_check_oom(azCmd);
27082 azCmd[nCmd-1] = z;
27083 }
 
27084 }
27085 if( z[1]=='-' ) z++;
27086 if( cli_strcmp(z,"-separator")==0
 
 
 
27087 || cli_strcmp(z,"-nullvalue")==0
27088 || cli_strcmp(z,"-newline")==0
27089 || cli_strcmp(z,"-cmd")==0
27090 ){
27091 (void)cmdline_option_value(argc, argv, ++i);
@@ -27103,10 +27009,11 @@
27103 sqlite3_int64 szHeap;
27104
27105 zSize = cmdline_option_value(argc, argv, ++i);
27106 szHeap = integerValue(zSize);
27107 if( szHeap>0x7fff0000 ) szHeap = 0x7fff0000;
 
27108 sqlite3_config(SQLITE_CONFIG_HEAP, malloc((int)szHeap), (int)szHeap, 64);
27109 #else
27110 (void)cmdline_option_value(argc, argv, ++i);
27111 #endif
27112 }else if( cli_strcmp(z,"-pagecache")==0 ){
@@ -27116,24 +27023,27 @@
27116 if( sz<0 ) sz = 0;
27117 n = integerValue(cmdline_option_value(argc,argv,++i));
27118 if( sz>0 && n>0 && 0xffffffffffffLL/sz<n ){
27119 n = 0xffffffffffffLL/sz;
27120 }
 
27121 sqlite3_config(SQLITE_CONFIG_PAGECACHE,
27122 (n>0 && sz>0) ? malloc(n*sz) : 0, sz, n);
27123 data.shellFlgs |= SHFLG_Pagecache;
27124 }else if( cli_strcmp(z,"-lookaside")==0 ){
27125 int n, sz;
27126 sz = (int)integerValue(cmdline_option_value(argc,argv,++i));
27127 if( sz<0 ) sz = 0;
27128 n = (int)integerValue(cmdline_option_value(argc,argv,++i));
27129 if( n<0 ) n = 0;
 
27130 sqlite3_config(SQLITE_CONFIG_LOOKASIDE, sz, n);
27131 if( sz*n==0 ) data.shellFlgs &= ~SHFLG_Lookaside;
27132 }else if( cli_strcmp(z,"-threadsafe")==0 ){
27133 int n;
27134 n = (int)integerValue(cmdline_option_value(argc,argv,++i));
 
27135 switch( n ){
27136 case 0: sqlite3_config(SQLITE_CONFIG_SINGLETHREAD); break;
27137 case 2: sqlite3_config(SQLITE_CONFIG_MULTITHREAD); break;
27138 default: sqlite3_config(SQLITE_CONFIG_SERIALIZED); break;
27139 }
@@ -27153,14 +27063,16 @@
27153 extern int sqlite3_multiple_initialize(const char*,int);
27154 sqlite3_multiplex_initialize(0, 1);
27155 #endif
27156 }else if( cli_strcmp(z,"-mmap")==0 ){
27157 sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
 
27158 sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, sz, sz);
27159 #ifdef SQLITE_ENABLE_SORTER_REFERENCES
27160 }else if( cli_strcmp(z,"-sorterref")==0 ){
27161 sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
 
27162 sqlite3_config(SQLITE_CONFIG_SORTERREF_SIZE, (int)sz);
27163 #endif
27164 }else if( cli_strcmp(z,"-vfs")==0 ){
27165 zVfs = cmdline_option_value(argc, argv, ++i);
27166 #ifdef SQLITE_HAVE_ZLIB
@@ -27194,11 +27106,13 @@
27194 data.zNonce = strdup(argv[++i]);
27195 }else if( cli_strcmp(z,"-safe")==0 ){
27196 /* no-op - catch this on the second pass */
27197 }
27198 }
 
27199 verify_uninitialized();
 
27200
27201
27202 #ifdef SQLITE_SHELL_INIT_PROC
27203 {
27204 /* If the SQLITE_SHELL_INIT_PROC macro is defined, then it is the name
@@ -27258,11 +27172,11 @@
27258 ** file is processed so that the command-line arguments will override
27259 ** settings in the initialization file.
27260 */
27261 for(i=1; i<argc; i++){
27262 char *z = argv[i];
27263 if( z[0]!='-' ) continue;
27264 if( z[1]=='-' ){ z++; }
27265 if( cli_strcmp(z,"-init")==0 ){
27266 i++;
27267 }else if( cli_strcmp(z,"-html")==0 ){
27268 data.mode = MODE_Html;
@@ -27442,10 +27356,11 @@
27442 free(azCmd);
27443 return rc==2 ? 0 : rc;
27444 }
27445 }else{
27446 open_db(&data, 0);
 
27447 rc = shell_exec(&data, azCmd[i], &zErrMsg);
27448 if( zErrMsg || rc ){
27449 if( zErrMsg!=0 ){
27450 utf8_printf(stderr,"Error: %s\n", zErrMsg);
27451 }else{
27452
--- extsrc/shell.c
+++ extsrc/shell.c
@@ -115,10 +115,11 @@
115
116 #include <stdlib.h>
117 #include <string.h>
118 #include <stdio.h>
119 #include <assert.h>
120 #include <math.h>
121 #include "sqlite3.h"
122 typedef sqlite3_int64 i64;
123 typedef sqlite3_uint64 u64;
124 typedef unsigned char u8;
125 #if SQLITE_USER_AUTHENTICATION
@@ -13021,14 +13022,18 @@
13022 if( pCsr->aPage==0 ){
13023 while( 1 ){
13024 if( pCsr->bOnePage==0 && pCsr->iPgno>pCsr->szDb ) return SQLITE_OK;
13025 rc = dbdataLoadPage(pCsr, pCsr->iPgno, &pCsr->aPage, &pCsr->nPage);
13026 if( rc!=SQLITE_OK ) return rc;
13027 if( pCsr->aPage && pCsr->nPage>=256 ) break;
13028 sqlite3_free(pCsr->aPage);
13029 pCsr->aPage = 0;
13030 if( pCsr->bOnePage ) return SQLITE_OK;
13031 pCsr->iPgno++;
13032 }
13033
13034 assert( iOff+3+2<=pCsr->nPage );
13035 pCsr->iCell = pTab->bPtr ? -2 : 0;
13036 pCsr->nCell = get_uint16(&pCsr->aPage[iOff+3]);
13037 }
13038
13039 if( pTab->bPtr ){
@@ -13317,19 +13322,21 @@
13322 );
13323 }
13324 }
13325 if( rc==SQLITE_OK ){
13326 rc = sqlite3_bind_text(pCsr->pStmt, 1, zSchema, -1, SQLITE_TRANSIENT);
 
 
13327 }
13328
13329 /* Try to determine the encoding of the db by inspecting the header
13330 ** field on page 1. */
13331 if( rc==SQLITE_OK ){
13332 rc = dbdataGetEncoding(pCsr);
13333 }
13334
13335 if( rc!=SQLITE_OK ){
13336 pTab->base.zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pTab->db));
13337 }
13338
13339 if( rc==SQLITE_OK ){
13340 rc = dbdataNext(pCursor);
13341 }
13342 return rc;
@@ -17232,10 +17239,11 @@
17239 const char *zOrig = z;
17240 static const char *azTerm[] = { "", "*/", "\n" };
17241 int i;
17242 for(i=0; i<ArraySize(azTerm); i++){
17243 char *zNew = sqlite3_mprintf("%s%s;", zOrig, azTerm[i]);
17244 shell_check_oom(zNew);
17245 if( sqlite3_complete(zNew) ){
17246 size_t n = strlen(zNew);
17247 zNew[n-1] = 0;
17248 zToFree = zNew;
17249 z = zNew;
@@ -17666,13 +17674,13 @@
17674 char z[50];
17675 double r = sqlite3_column_double(p->pStmt, i);
17676 sqlite3_uint64 ur;
17677 memcpy(&ur,&r,sizeof(r));
17678 if( ur==0x7ff0000000000000LL ){
17679 raw_printf(p->out, "9.0e+999");
17680 }else if( ur==0xfff0000000000000LL ){
17681 raw_printf(p->out, "-9.0e+999");
17682 }else{
17683 sqlite3_int64 ir = (sqlite3_int64)r;
17684 if( r==(double)ir ){
17685 sqlite3_snprintf(50,z,"%lld.0", ir);
17686 }else{
@@ -17712,13 +17720,13 @@
17720 char z[50];
17721 double r = sqlite3_column_double(p->pStmt, i);
17722 sqlite3_uint64 ur;
17723 memcpy(&ur,&r,sizeof(r));
17724 if( ur==0x7ff0000000000000LL ){
17725 raw_printf(p->out, "9.0e+999");
17726 }else if( ur==0xfff0000000000000LL ){
17727 raw_printf(p->out, "-9.0e+999");
17728 }else{
17729 sqlite3_snprintf(50,z,"%!.20g", r);
17730 raw_printf(p->out, "%s", z);
17731 }
17732 }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){
@@ -17918,10 +17926,11 @@
17926 char *zMsg;
17927 int i;
17928 if( db==0
17929 || zSql==0
17930 || (iOffset = sqlite3_error_offset(db))<0
17931 || iOffset>=strlen(zSql)
17932 ){
17933 return sqlite3_mprintf("");
17934 }
17935 while( iOffset>50 ){
17936 iOffset--;
@@ -18530,26 +18539,31 @@
18539
18540 nVar = sqlite3_bind_parameter_count(pStmt);
18541 if( nVar==0 ) return; /* Nothing to do */
18542 if( sqlite3_table_column_metadata(pArg->db, "TEMP", "sqlite_parameters",
18543 "key", 0, 0, 0, 0, 0)!=SQLITE_OK ){
18544 rc = SQLITE_NOTFOUND;
18545 pQ = 0;
18546 }else{
18547 rc = sqlite3_prepare_v2(pArg->db,
18548 "SELECT value FROM temp.sqlite_parameters"
18549 " WHERE key=?1", -1, &pQ, 0);
18550 }
 
 
 
 
18551 for(i=1; i<=nVar; i++){
18552 char zNum[30];
18553 const char *zVar = sqlite3_bind_parameter_name(pStmt, i);
18554 if( zVar==0 ){
18555 sqlite3_snprintf(sizeof(zNum),zNum,"?%d",i);
18556 zVar = zNum;
18557 }
18558 sqlite3_bind_text(pQ, 1, zVar, -1, SQLITE_STATIC);
18559 if( rc==SQLITE_OK && pQ && sqlite3_step(pQ)==SQLITE_ROW ){
18560 sqlite3_bind_value(pStmt, i, sqlite3_column_value(pQ, 0));
18561 }else if( sqlite3_strlike("_NAN", zVar, 0)==0 ){
18562 sqlite3_bind_double(pStmt, i, NAN);
18563 }else if( sqlite3_strlike("_INF", zVar, 0)==0 ){
18564 sqlite3_bind_double(pStmt, i, INFINITY);
18565 }else{
18566 sqlite3_bind_null(pStmt, i);
18567 }
18568 sqlite3_reset(pQ);
18569 }
@@ -19767,12 +19781,14 @@
19781 " Options:",
19782 " fkey-indexes Find missing foreign key indexes",
19783 #if !defined(SQLITE_OMIT_LOAD_EXTENSION) && !defined(SQLITE_SHELL_FIDDLE)
19784 ".load FILE ?ENTRY? Load an extension library",
19785 #endif
19786 #if !defined(SQLITE_SHELL_FIDDLE)
19787 ".log FILE|on|off Turn logging on or off. FILE can be stderr/stdout",
19788 #else
19789 ".log on|off Turn logging on or off.",
19790 #endif
19791 ".mode MODE ?OPTIONS? Set output mode",
19792 " MODE is one of:",
19793 " ascii Columns/rows delimited by 0x1F and 0x1E",
19794 " box Tables using unicode box-drawing characters",
@@ -20036,20 +20052,31 @@
20052 static char *readFile(const char *zName, int *pnByte){
20053 FILE *in = fopen(zName, "rb");
20054 long nIn;
20055 size_t nRead;
20056 char *pBuf;
20057 int rc;
20058 if( in==0 ) return 0;
20059 rc = fseek(in, 0, SEEK_END);
20060 if( rc!=0 ){
20061 raw_printf(stderr, "Error: '%s' not seekable\n", zName);
20062 fclose(in);
20063 return 0;
20064 }
20065 nIn = ftell(in);
20066 rewind(in);
20067 pBuf = sqlite3_malloc64( nIn+1 );
20068 if( pBuf==0 ){
20069 raw_printf(stderr, "Error: out of memory\n");
20070 fclose(in);
20071 return 0;
20072 }
20073 nRead = fread(pBuf, nIn, 1, in);
20074 fclose(in);
20075 if( nRead!=1 ){
20076 sqlite3_free(pBuf);
20077 raw_printf(stderr, "Error: cannot read '%s'\n", zName);
20078 return 0;
20079 }
20080 pBuf[nIn] = 0;
20081 if( pnByte ) *pnByte = nIn;
20082 return pBuf;
@@ -20234,57 +20261,10 @@
20261 utf8_printf(stderr,"Error on line %d of --hexdb input\n", nLine);
20262 return 0;
20263 }
20264 #endif /* SQLITE_OMIT_DESERIALIZE */
20265
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20266 /*
20267 ** Scalar function "usleep(X)" invokes sqlite3_sleep(X) and returns X.
20268 */
20269 static void shellUSleepFunc(
20270 sqlite3_context *context,
@@ -20295,101 +20275,10 @@
20275 (void)argcUnused;
20276 sqlite3_sleep(sleep/1000);
20277 sqlite3_result_int(context, sleep);
20278 }
20279
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20280 /* Flags for open_db().
20281 **
20282 ** The default behavior of open_db() is to exit(1) if the database fails to
20283 ** open. The OPEN_DB_KEEPALIVE flag changes that so that it prints an error
20284 ** but still returns without calling exit.
@@ -20451,10 +20340,11 @@
20340 sqlite3_open(":memory:", &p->db);
20341 return;
20342 }
20343 exit(1);
20344 }
20345 sqlite3_db_config(p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, (int)0, (int*)0);
20346
20347 #ifndef SQLITE_OMIT_LOAD_EXTENSION
20348 sqlite3_enable_load_extension(p->db, 1);
20349 #endif
20350 sqlite3_shathree_init(p->db, 0, 0);
@@ -20467,13 +20357,10 @@
20357 sqlite3_series_init(p->db, 0, 0);
20358 #ifndef SQLITE_SHELL_FIDDLE
20359 sqlite3_fileio_init(p->db, 0, 0);
20360 sqlite3_completion_init(p->db, 0, 0);
20361 #endif
 
 
 
20362 #ifdef SQLITE_HAVE_ZLIB
20363 if( !p->bSafeModePersist ){
20364 sqlite3_zipfile_init(p->db, 0, 0);
20365 sqlite3_sqlar_init(p->db, 0, 0);
20366 }
@@ -20510,16 +20397,10 @@
20397 shellAddSchemaName, 0, 0);
20398 sqlite3_create_function(p->db, "shell_module_schema", 1, SQLITE_UTF8, 0,
20399 shellModuleSchema, 0, 0);
20400 sqlite3_create_function(p->db, "shell_putsnl", 1, SQLITE_UTF8, p,
20401 shellPutsFunc, 0, 0);
 
 
 
 
 
 
20402 sqlite3_create_function(p->db, "usleep",1,SQLITE_UTF8,0,
20403 shellUSleepFunc, 0, 0);
20404 #ifndef SQLITE_NOHAVE_SYSTEM
20405 sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0,
20406 editFunc, 0, 0);
@@ -20542,13 +20423,13 @@
20423 unsigned char *aData;
20424 if( p->openMode==SHELL_OPEN_DESERIALIZE ){
20425 aData = (unsigned char*)readFile(zDbFilename, &nData);
20426 }else{
20427 aData = readHexDb(p, &nData);
20428 }
20429 if( aData==0 ){
20430 return;
20431 }
20432 rc = sqlite3_deserialize(p->db, "main", aData, nData, nData,
20433 SQLITE_DESERIALIZE_RESIZEABLE |
20434 SQLITE_DESERIALIZE_FREEONCLOSE);
20435 if( rc ){
@@ -20558,12 +20439,17 @@
20439 sqlite3_file_control(p->db, "main", SQLITE_FCNTL_SIZE_LIMIT, &p->szMax);
20440 }
20441 }
20442 #endif
20443 }
20444 if( p->db!=0 ){
20445 if( p->bSafeModePersist ){
20446 sqlite3_set_authorizer(p->db, safeModeAuth, p);
20447 }
20448 sqlite3_db_config(
20449 p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, p->scanstatsOn, (int*)0
20450 );
20451 }
20452 }
20453
20454 /*
20455 ** Attempt to close the databaes connection. Report errors.
@@ -23178,11 +23064,10 @@
23064 output_reset(p);
23065 if( nArg!=2 ){
23066 raw_printf(stderr, "Usage: .check GLOB-PATTERN\n");
23067 rc = 2;
23068 }else if( (zRes = readFile("testcase-out.txt", 0))==0 ){
 
23069 rc = 2;
23070 }else if( testcase_glob(azArg[1],zRes)==0 ){
23071 utf8_printf(stderr,
23072 "testcase-%s FAILED\n Expected: [%s]\n Got: [%s]\n",
23073 p->zTestcase, azArg[1], zRes);
@@ -23308,10 +23193,12 @@
23193 { "legacy_alter_table", SQLITE_DBCONFIG_LEGACY_ALTER_TABLE },
23194 { "legacy_file_format", SQLITE_DBCONFIG_LEGACY_FILE_FORMAT },
23195 { "load_extension", SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION },
23196 { "no_ckpt_on_close", SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE },
23197 { "reset_database", SQLITE_DBCONFIG_RESET_DATABASE },
23198 { "reverse_scanorder", SQLITE_DBCONFIG_REVERSE_SCANORDER },
23199 { "stmt_scanstatus", SQLITE_DBCONFIG_STMT_SCANSTATUS },
23200 { "trigger_eqp", SQLITE_DBCONFIG_TRIGGER_EQP },
23201 { "trusted_schema", SQLITE_DBCONFIG_TRUSTED_SCHEMA },
23202 { "writable_schema", SQLITE_DBCONFIG_WRITABLE_SCHEMA },
23203 };
23204 int ii, v;
@@ -24257,23 +24144,29 @@
24144 rc = 1;
24145 }
24146 }else
24147 #endif
24148
 
24149 if( c=='l' && cli_strncmp(azArg[0], "log", n)==0 ){
 
24150 if( nArg!=2 ){
24151 raw_printf(stderr, "Usage: .log FILENAME\n");
24152 rc = 1;
24153 }else{
24154 const char *zFile = azArg[1];
24155 if( p->bSafeMode
24156 && cli_strcmp(zFile,"on")!=0
24157 && cli_strcmp(zFile,"off")!=0
24158 ){
24159 raw_printf(stdout, "cannot set .log to anything other "
24160 "than \"on\" or \"off\"\n");
24161 zFile = "off";
24162 }
24163 output_file_close(p->pLog);
24164 if( cli_strcmp(zFile,"on")==0 ) zFile = "stdout";
24165 p->pLog = output_file_open(zFile, 0);
24166 }
24167 }else
 
24168
24169 if( c=='m' && cli_strncmp(azArg[0], "mode", n)==0 ){
24170 const char *zMode = 0;
24171 const char *zTabname = 0;
24172 int i, n2;
@@ -24905,10 +24798,13 @@
24798 if( cli_strcmp(azArg[1], "est")==0 ){
24799 p->scanstatsOn = 2;
24800 }else{
24801 p->scanstatsOn = (u8)booleanValue(azArg[1]);
24802 }
24803 sqlite3_db_config(
24804 p->db, SQLITE_DBCONFIG_STMT_SCANSTATUS, p->scanstatsOn, (int*)0
24805 );
24806 #ifndef SQLITE_ENABLE_STMT_SCANSTATUS
24807 raw_printf(stderr, "Warning: .scanstats not available in this build.\n");
24808 #endif
24809 }else{
24810 raw_printf(stderr, "Usage: .scanstats on|off|est\n");
@@ -26785,10 +26681,11 @@
26681
26682 /*
26683 ** Show available command line options
26684 */
26685 static const char zOptions[] =
26686 " -- treat no subsequent arguments as options\n"
26687 #if defined(SQLITE_HAVE_ZLIB) && !defined(SQLITE_OMIT_VIRTUALTABLE)
26688 " -A ARGS... run \".archive ARGS\" and exit\n"
26689 #endif
26690 " -append append the database to the end of the file\n"
26691 " -ascii set output mode to 'ascii'\n"
@@ -26847,13 +26744,13 @@
26744 " -zip open the file as a ZIP Archive\n"
26745 #endif
26746 ;
26747 static void usage(int showDetail){
26748 utf8_printf(stderr,
26749 "Usage: %s [OPTIONS] [FILENAME [SQL]]\n"
26750 "FILENAME is the name of an SQLite database. A new database is created\n"
26751 "if the file does not previously exist. Defaults to :memory:.\n", Argv0);
26752 if( showDetail ){
26753 utf8_printf(stderr, "OPTIONS include:\n%s", zOptions);
26754 }else{
26755 raw_printf(stderr, "Use the -help option for additional information\n");
26756 }
@@ -26881,13 +26778,15 @@
26778 data->pAuxDb = &data->aAuxDb[0];
26779 memcpy(data->colSeparator,SEP_Column, 2);
26780 memcpy(data->rowSeparator,SEP_Row, 2);
26781 data->showHeader = 0;
26782 data->shellFlgs = SHFLG_Lookaside;
26783 sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
26784 #if !defined(SQLITE_SHELL_FIDDLE)
26785 verify_uninitialized();
26786 #endif
26787 sqlite3_config(SQLITE_CONFIG_URI, 1);
 
26788 sqlite3_config(SQLITE_CONFIG_MULTITHREAD);
26789 sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
26790 sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> ");
26791 }
26792
@@ -26960,10 +26859,11 @@
26859 int i;
26860 int rc = 0;
26861 int warnInmemoryDb = 0;
26862 int readStdin = 1;
26863 int nCmd = 0;
26864 int nOptsEnd = argc;
26865 char **azCmd = 0;
26866 const char *zVfs = 0; /* Value of -vfs command-line option */
26867 #if !SQLITE_SHELL_IS_UTF8
26868 char **argvToFree = 0;
26869 int argcToFree = 0;
@@ -27063,15 +26963,17 @@
26963 /* Do an initial pass through the command-line argument to locate
26964 ** the name of the database file, the name of the initialization file,
26965 ** the size of the alternative malloc heap,
26966 ** and the first command to execute.
26967 */
26968 #ifndef SQLITE_SHELL_FIDDLE
26969 verify_uninitialized();
26970 #endif
26971 for(i=1; i<argc; i++){
26972 char *z;
26973 z = argv[i];
26974 if( z[0]!='-' || i>nOptsEnd ){
26975 if( data.aAuxDb->zDbFilename==0 ){
26976 data.aAuxDb->zDbFilename = z;
26977 }else{
26978 /* Excesss arguments are interpreted as SQL (or dot-commands) and
26979 ** mean that nothing is read from stdin */
@@ -27079,13 +26981,17 @@
26981 nCmd++;
26982 azCmd = realloc(azCmd, sizeof(azCmd[0])*nCmd);
26983 shell_check_oom(azCmd);
26984 azCmd[nCmd-1] = z;
26985 }
26986 continue;
26987 }
26988 if( z[1]=='-' ) z++;
26989 if( cli_strcmp(z, "-")==0 ){
26990 nOptsEnd = i;
26991 continue;
26992 }else if( cli_strcmp(z,"-separator")==0
26993 || cli_strcmp(z,"-nullvalue")==0
26994 || cli_strcmp(z,"-newline")==0
26995 || cli_strcmp(z,"-cmd")==0
26996 ){
26997 (void)cmdline_option_value(argc, argv, ++i);
@@ -27103,10 +27009,11 @@
27009 sqlite3_int64 szHeap;
27010
27011 zSize = cmdline_option_value(argc, argv, ++i);
27012 szHeap = integerValue(zSize);
27013 if( szHeap>0x7fff0000 ) szHeap = 0x7fff0000;
27014 verify_uninitialized();
27015 sqlite3_config(SQLITE_CONFIG_HEAP, malloc((int)szHeap), (int)szHeap, 64);
27016 #else
27017 (void)cmdline_option_value(argc, argv, ++i);
27018 #endif
27019 }else if( cli_strcmp(z,"-pagecache")==0 ){
@@ -27116,24 +27023,27 @@
27023 if( sz<0 ) sz = 0;
27024 n = integerValue(cmdline_option_value(argc,argv,++i));
27025 if( sz>0 && n>0 && 0xffffffffffffLL/sz<n ){
27026 n = 0xffffffffffffLL/sz;
27027 }
27028 verify_uninitialized();
27029 sqlite3_config(SQLITE_CONFIG_PAGECACHE,
27030 (n>0 && sz>0) ? malloc(n*sz) : 0, sz, n);
27031 data.shellFlgs |= SHFLG_Pagecache;
27032 }else if( cli_strcmp(z,"-lookaside")==0 ){
27033 int n, sz;
27034 sz = (int)integerValue(cmdline_option_value(argc,argv,++i));
27035 if( sz<0 ) sz = 0;
27036 n = (int)integerValue(cmdline_option_value(argc,argv,++i));
27037 if( n<0 ) n = 0;
27038 verify_uninitialized();
27039 sqlite3_config(SQLITE_CONFIG_LOOKASIDE, sz, n);
27040 if( sz*n==0 ) data.shellFlgs &= ~SHFLG_Lookaside;
27041 }else if( cli_strcmp(z,"-threadsafe")==0 ){
27042 int n;
27043 n = (int)integerValue(cmdline_option_value(argc,argv,++i));
27044 verify_uninitialized();
27045 switch( n ){
27046 case 0: sqlite3_config(SQLITE_CONFIG_SINGLETHREAD); break;
27047 case 2: sqlite3_config(SQLITE_CONFIG_MULTITHREAD); break;
27048 default: sqlite3_config(SQLITE_CONFIG_SERIALIZED); break;
27049 }
@@ -27153,14 +27063,16 @@
27063 extern int sqlite3_multiple_initialize(const char*,int);
27064 sqlite3_multiplex_initialize(0, 1);
27065 #endif
27066 }else if( cli_strcmp(z,"-mmap")==0 ){
27067 sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
27068 verify_uninitialized();
27069 sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, sz, sz);
27070 #if defined(SQLITE_ENABLE_SORTER_REFERENCES)
27071 }else if( cli_strcmp(z,"-sorterref")==0 ){
27072 sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i));
27073 verify_uninitialized();
27074 sqlite3_config(SQLITE_CONFIG_SORTERREF_SIZE, (int)sz);
27075 #endif
27076 }else if( cli_strcmp(z,"-vfs")==0 ){
27077 zVfs = cmdline_option_value(argc, argv, ++i);
27078 #ifdef SQLITE_HAVE_ZLIB
@@ -27194,11 +27106,13 @@
27106 data.zNonce = strdup(argv[++i]);
27107 }else if( cli_strcmp(z,"-safe")==0 ){
27108 /* no-op - catch this on the second pass */
27109 }
27110 }
27111 #ifndef SQLITE_SHELL_FIDDLE
27112 verify_uninitialized();
27113 #endif
27114
27115
27116 #ifdef SQLITE_SHELL_INIT_PROC
27117 {
27118 /* If the SQLITE_SHELL_INIT_PROC macro is defined, then it is the name
@@ -27258,11 +27172,11 @@
27172 ** file is processed so that the command-line arguments will override
27173 ** settings in the initialization file.
27174 */
27175 for(i=1; i<argc; i++){
27176 char *z = argv[i];
27177 if( z[0]!='-' || i>=nOptsEnd ) continue;
27178 if( z[1]=='-' ){ z++; }
27179 if( cli_strcmp(z,"-init")==0 ){
27180 i++;
27181 }else if( cli_strcmp(z,"-html")==0 ){
27182 data.mode = MODE_Html;
@@ -27442,10 +27356,11 @@
27356 free(azCmd);
27357 return rc==2 ? 0 : rc;
27358 }
27359 }else{
27360 open_db(&data, 0);
27361 echo_group_input(&data, azCmd[i]);
27362 rc = shell_exec(&data, azCmd[i], &zErrMsg);
27363 if( zErrMsg || rc ){
27364 if( zErrMsg!=0 ){
27365 utf8_printf(stderr,"Error: %s\n", zErrMsg);
27366 }else{
27367
+2090 -1543
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -1,8 +1,8 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3
-** version 3.41.2. By combining all the individual C code files into this
3
+** version 3.42.0. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
77
** of 5% or more are commonly seen when SQLite is compiled as a single
88
** translation unit.
@@ -450,13 +450,13 @@
450450
**
451451
** See also: [sqlite3_libversion()],
452452
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453453
** [sqlite_version()] and [sqlite_source_id()].
454454
*/
455
-#define SQLITE_VERSION "3.41.2"
456
-#define SQLITE_VERSION_NUMBER 3041002
457
-#define SQLITE_SOURCE_ID "2023-03-17 12:25:10 c5bd0ea3b5b2f3ed8e971c5fd6e85e8f06d8055d74df65612c3794138306e6ba"
455
+#define SQLITE_VERSION "3.42.0"
456
+#define SQLITE_VERSION_NUMBER 3042000
457
+#define SQLITE_SOURCE_ID "2023-04-01 15:51:21 a4fb2864fe01cce9694242a0750623ca47fcecd68f74c4239d3eb5fbf978770a"
458458
459459
/*
460460
** CAPI3REF: Run-Time Library Version Numbers
461461
** KEYWORDS: sqlite3_version sqlite3_sourceid
462462
**
@@ -1959,23 +1959,26 @@
19591959
**
19601960
** <b>The sqlite3_config() interface is not threadsafe. The application
19611961
** must ensure that no other SQLite interfaces are invoked by other
19621962
** threads while sqlite3_config() is running.</b>
19631963
**
1964
-** The sqlite3_config() interface
1965
-** may only be invoked prior to library initialization using
1966
-** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1967
-** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1968
-** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
1969
-** Note, however, that ^sqlite3_config() can be called as part of the
1970
-** implementation of an application-defined [sqlite3_os_init()].
1971
-**
19721964
** The first argument to sqlite3_config() is an integer
19731965
** [configuration option] that determines
19741966
** what property of SQLite is to be configured. Subsequent arguments
19751967
** vary depending on the [configuration option]
19761968
** in the first argument.
1969
+**
1970
+** For most configuration options, the sqlite3_config() interface
1971
+** may only be invoked prior to library initialization using
1972
+** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1973
+** The exceptional configuration options that may be invoked at any time
1974
+** are called "anytime configuration options".
1975
+** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1976
+** [sqlite3_shutdown()] with a first argument that is not an anytime
1977
+** configuration option, then the sqlite3_config() call will return SQLITE_MISUSE.
1978
+** Note, however, that ^sqlite3_config() can be called as part of the
1979
+** implementation of an application-defined [sqlite3_os_init()].
19771980
**
19781981
** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
19791982
** ^If the option is unknown or SQLite is unable to set the option
19801983
** then this routine returns a non-zero [error code].
19811984
*/
@@ -2079,10 +2082,27 @@
20792082
** CAPI3REF: Configuration Options
20802083
** KEYWORDS: {configuration option}
20812084
**
20822085
** These constants are the available integer configuration options that
20832086
** can be passed as the first argument to the [sqlite3_config()] interface.
2087
+**
2088
+** Most of the configuration options for sqlite3_config()
2089
+** will only work if invoked prior to [sqlite3_initialize()] or after
2090
+** [sqlite3_shutdown()]. The few exceptions to this rule are called
2091
+** "anytime configuration options".
2092
+** ^Calling [sqlite3_config()] with a first argument that is not an
2093
+** anytime configuration option in between calls to [sqlite3_initialize()] and
2094
+** [sqlite3_shutdown()] is a no-op that returns SQLITE_MISUSE.
2095
+**
2096
+** The set of anytime configuration options can change (by insertions
2097
+** and/or deletions) from one release of SQLite to the next.
2098
+** As of SQLite version 3.42.0, the complete set of anytime configuration
2099
+** options is:
2100
+** <ul>
2101
+** <li> SQLITE_CONFIG_LOG
2102
+** <li> SQLITE_CONFIG_PCACHE_HDRSZ
2103
+** </ul>
20842104
**
20852105
** New configuration options may be added in future releases of SQLite.
20862106
** Existing configuration options might be discontinued. Applications
20872107
** should check the return code from [sqlite3_config()] to make sure that
20882108
** the call worked. The [sqlite3_config()] interface will return a
@@ -2740,10 +2760,30 @@
27402760
** the [VACUUM] command will fail with an obscure error when attempting to
27412761
** process a table with generated columns and a descending index. This is
27422762
** not considered a bug since SQLite versions 3.3.0 and earlier do not support
27432763
** either generated columns or decending indexes.
27442764
** </dd>
2765
+**
2766
+** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
2767
+** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</td>
2768
+** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
2769
+** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
2770
+** a flag that enables collection of the sqlite3_stmt_scanstatus_v2()
2771
+** statistics. For statistics to be collected, the flag must be set on
2772
+** the database handle both when the SQL statement is prepared and when it
2773
+** is stepped. The flag is set (collection of statistics is enabled)
2774
+** by default.</dd>
2775
+**
2776
+** [[SQLITE_DBCONFIG_REVERSE_SCANORDER]]
2777
+** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</td>
2778
+** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option change the default order
2779
+** in which tables and indexes are scanned so that the scans start at the end
2780
+** and work toward the beginning rather than starting at the beginning and
2781
+** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
2782
+** same as setting [PRAGMA reverse_unordered_selects]. This configuration option
2783
+** is useful for application testing.</dd>
2784
+**
27452785
** </dl>
27462786
*/
27472787
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
27482788
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
27492789
#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
@@ -2760,11 +2800,13 @@
27602800
#define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
27612801
#define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
27622802
#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
27632803
#define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
27642804
#define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
2765
-#define SQLITE_DBCONFIG_MAX 1017 /* Largest DBCONFIG */
2805
+#define SQLITE_DBCONFIG_STMT_SCANSTATUS 1080 /* int int* */
2806
+#define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
2807
+#define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */
27662808
27672809
/*
27682810
** CAPI3REF: Enable Or Disable Extended Result Codes
27692811
** METHOD: sqlite3
27702812
**
@@ -12217,13 +12259,27 @@
1221712259
**
1221812260
** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
1221912261
** Invert the changeset before applying it. This is equivalent to inverting
1222012262
** a changeset using sqlite3changeset_invert() before applying it. It is
1222112263
** an error to specify this flag with a patchset.
12264
+**
12265
+** <dt>SQLITE_CHANGESETAPPLY_IGNORENOOP <dd>
12266
+** Do not invoke the conflict handler callback for any changes that
12267
+** would not actually modify the database even if they were applied.
12268
+** Specifically, this means that the conflict handler is not invoked
12269
+** for:
12270
+** <ul>
12271
+** <li>a delete change if the row being deleted cannot be found,
12272
+** <li>an update change if the modified fields are already set to
12273
+** their new values in the conflicting row, or
12274
+** <li>an insert change if all fields of the conflicting row match
12275
+** the row being inserted.
12276
+** </ul>
1222212277
*/
1222312278
#define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
1222412279
#define SQLITE_CHANGESETAPPLY_INVERT 0x0002
12280
+#define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004
1222512281
1222612282
/*
1222712283
** CAPI3REF: Constants Passed To The Conflict Handler
1222812284
**
1222912285
** Values that may be passed as the second argument to a conflict-handler.
@@ -13516,12 +13572,12 @@
1351613572
#pragma warn -csu /* Comparing signed and unsigned */
1351713573
#pragma warn -spa /* Suspicious pointer arithmetic */
1351813574
#endif
1351913575
1352013576
/*
13521
-** WAL mode depends on atomic aligned 32-bit loads and stores in a few
13522
-** places. The following macros try to make this explicit.
13577
+** A few places in the code require atomic load/store of aligned
13578
+** integer values.
1352313579
*/
1352413580
#ifndef __has_extension
1352513581
# define __has_extension(x) 0 /* compatibility with non-clang compilers */
1352613582
#endif
1352713583
#if GCC_VERSION>=4007000 || __has_extension(c_atomic)
@@ -16590,11 +16646,11 @@
1659016646
/**********************************************************************
1659116647
** Elements above, except pCache, are public. All that follow are
1659216648
** private to pcache.c and should not be accessed by other modules.
1659316649
** pCache is grouped with the public elements for efficiency.
1659416650
*/
16595
- i16 nRef; /* Number of users of this page */
16651
+ i64 nRef; /* Number of users of this page */
1659616652
PgHdr *pDirtyNext; /* Next element in list of dirty pages */
1659716653
PgHdr *pDirtyPrev; /* Previous element in list of dirty pages */
1659816654
/* NB: pDirtyNext and pDirtyPrev are undefined if the
1659916655
** PgHdr object is not dirty */
1660016656
};
@@ -16671,16 +16727,16 @@
1667116727
1667216728
/* Discard the contents of the cache */
1667316729
SQLITE_PRIVATE void sqlite3PcacheClear(PCache*);
1667416730
1667516731
/* Return the total number of outstanding page references */
16676
-SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache*);
16732
+SQLITE_PRIVATE i64 sqlite3PcacheRefCount(PCache*);
1667716733
1667816734
/* Increment the reference count of an existing page */
1667916735
SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr*);
1668016736
16681
-SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr*);
16737
+SQLITE_PRIVATE i64 sqlite3PcachePageRefcount(PgHdr*);
1668216738
1668316739
/* Return the total number of pages stored in the cache */
1668416740
SQLITE_PRIVATE int sqlite3PcachePagecount(PCache*);
1668516741
1668616742
#if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
@@ -17251,11 +17307,11 @@
1725117307
#define SQLITE_TrustedSchema 0x00000080 /* Allow unsafe functions and
1725217308
** vtabs in the schema definition */
1725317309
#define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */
1725417310
/* result set is empty */
1725517311
#define SQLITE_IgnoreChecks 0x00000200 /* Do not enforce check constraints */
17256
-#define SQLITE_ReadUncommit 0x00000400 /* READ UNCOMMITTED in shared-cache */
17312
+#define SQLITE_StmtScanStatus 0x00000400 /* Enable stmt_scanstats() counters */
1725717313
#define SQLITE_NoCkptOnClose 0x00000800 /* No checkpoint on close()/DETACH */
1725817314
#define SQLITE_ReverseOrder 0x00001000 /* Reverse unordered SELECTs */
1725917315
#define SQLITE_RecTriggers 0x00002000 /* Enable recursive triggers */
1726017316
#define SQLITE_ForeignKeys 0x00004000 /* Enforce foreign key constraints */
1726117317
#define SQLITE_AutoIndex 0x00008000 /* Enable automatic indexes */
@@ -17277,10 +17333,11 @@
1727717333
#define SQLITE_EnableView 0x80000000 /* Enable the use of views */
1727817334
#define SQLITE_CountRows HI(0x00001) /* Count rows changed by INSERT, */
1727917335
/* DELETE, or UPDATE and return */
1728017336
/* the count using a callback. */
1728117337
#define SQLITE_CorruptRdOnly HI(0x00002) /* Prohibit writes due to error */
17338
+#define SQLITE_ReadUncommit HI(0x00004) /* READ UNCOMMITTED in shared-cache */
1728217339
1728317340
/* Flags used only if debugging */
1728417341
#ifdef SQLITE_DEBUG
1728517342
#define SQLITE_SqlTrace HI(0x0100000) /* Debug print SQL as it executes */
1728617343
#define SQLITE_VdbeListing HI(0x0200000) /* Debug listings of VDBE progs */
@@ -17333,10 +17390,11 @@
1733317390
#define SQLITE_ReleaseReg 0x00400000 /* Use OP_ReleaseReg for testing */
1733417391
#define SQLITE_FlttnUnionAll 0x00800000 /* Disable the UNION ALL flattener */
1733517392
/* TH3 expects this value ^^^^^^^^^^ See flatten04.test */
1733617393
#define SQLITE_IndexedExpr 0x01000000 /* Pull exprs from index when able */
1733717394
#define SQLITE_Coroutines 0x02000000 /* Co-routines for subqueries */
17395
+#define SQLITE_NullUnusedCols 0x04000000 /* NULL unused columns in subqueries */
1733817396
#define SQLITE_AllOpts 0xffffffff /* All optimizations */
1733917397
1734017398
/*
1734117399
** Macros for testing whether or not optimizations are enabled or disabled.
1734217400
*/
@@ -20141,10 +20199,14 @@
2014120199
SQLITE_PRIVATE int sqlite3GetTempReg(Parse*);
2014220200
SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int);
2014320201
SQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int);
2014420202
SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int);
2014520203
SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse*);
20204
+SQLITE_PRIVATE void sqlite3TouchRegister(Parse*,int);
20205
+#if defined(SQLITE_ENABLE_STAT4) || defined(SQLITE_DEBUG)
20206
+SQLITE_PRIVATE int sqlite3FirstAvailableRegister(Parse*,int);
20207
+#endif
2014620208
#ifdef SQLITE_DEBUG
2014720209
SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int);
2014820210
#endif
2014920211
SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
2015020212
SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
@@ -20291,11 +20353,11 @@
2029120353
SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*);
2029220354
SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*,
2029320355
Expr*,ExprList*,u32,Expr*);
2029420356
SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*);
2029520357
SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*);
20296
-SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, int);
20358
+SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, Trigger*);
2029720359
SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
2029820360
#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
2029920361
SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*);
2030020362
#endif
2030120363
SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe*,int,const char*);
@@ -21077,10 +21139,16 @@
2107721139
#if defined(VDBE_PROFILE) \
2107821140
|| defined(SQLITE_PERFORMANCE_TRACE) \
2107921141
|| defined(SQLITE_ENABLE_STMT_SCANSTATUS)
2108021142
SQLITE_PRIVATE sqlite3_uint64 sqlite3Hwtime(void);
2108121143
#endif
21144
+
21145
+#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
21146
+# define IS_STMT_SCANSTATUS(db) (db->flags & SQLITE_StmtScanStatus)
21147
+#else
21148
+# define IS_STMT_SCANSTATUS(db) 0
21149
+#endif
2108221150
2108321151
#endif /* SQLITEINT_H */
2108421152
2108521153
/************** End of sqliteInt.h *******************************************/
2108621154
/************** Begin file os_common.h ***************************************/
@@ -22267,11 +22335,11 @@
2226722335
0, /* xAltLocaltime */
2226822336
0x7ffffffe, /* iOnceResetThreshold */
2226922337
SQLITE_DEFAULT_SORTERREF_SIZE, /* szSorterRef */
2227022338
0, /* iPrngSeed */
2227122339
#ifdef SQLITE_DEBUG
22272
- {0,0,0,0,0,0} /* aTune */
22340
+ {0,0,0,0,0,0}, /* aTune */
2227322341
#endif
2227422342
};
2227522343
2227622344
/*
2227722345
** Hash table for global functions - functions common to all
@@ -30072,10 +30140,24 @@
3007230140
*val = (*val - d)*10.0;
3007330141
return (char)digit;
3007430142
}
3007530143
#endif /* SQLITE_OMIT_FLOATING_POINT */
3007630144
30145
+#ifndef SQLITE_OMIT_FLOATING_POINT
30146
+/*
30147
+** "*val" is a u64. *msd is a divisor used to extract the
30148
+** most significant digit of *val. Extract that most significant
30149
+** digit and return it.
30150
+*/
30151
+static char et_getdigit_int(u64 *val, u64 *msd){
30152
+ u64 x = (*val)/(*msd);
30153
+ *val -= x*(*msd);
30154
+ if( *msd>=10 ) *msd /= 10;
30155
+ return '0' + (char)(x & 15);
30156
+}
30157
+#endif /* SQLITE_OMIT_FLOATING_POINT */
30158
+
3007730159
/*
3007830160
** Set the StrAccum object to an error mode.
3007930161
*/
3008030162
SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum *p, u8 eError){
3008130163
assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG );
@@ -30164,10 +30246,12 @@
3016430246
etByte xtype = etINVALID; /* Conversion paradigm */
3016530247
u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */
3016630248
char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
3016730249
sqlite_uint64 longvalue; /* Value for integer types */
3016830250
LONGDOUBLE_TYPE realvalue; /* Value for real types */
30251
+ sqlite_uint64 msd; /* Divisor to get most-significant-digit
30252
+ ** of longvalue */
3016930253
const et_info *infop; /* Pointer to the appropriate info structure */
3017030254
char *zOut; /* Rendering buffer */
3017130255
int nOut; /* Size of the rendering buffer */
3017230256
char *zExtra = 0; /* Malloced memory used by some conversion */
3017330257
#ifndef SQLITE_OMIT_FLOATING_POINT
@@ -30470,56 +30554,82 @@
3047030554
realvalue = -realvalue;
3047130555
prefix = '-';
3047230556
}else{
3047330557
prefix = flag_prefix;
3047430558
}
30559
+ exp = 0;
3047530560
if( xtype==etGENERIC && precision>0 ) precision--;
3047630561
testcase( precision>0xfff );
30477
- idx = precision & 0xfff;
30478
- rounder = arRound[idx%10];
30479
- while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; }
30480
- if( xtype==etFLOAT ){
30481
- double rx = (double)realvalue;
30482
- sqlite3_uint64 u;
30483
- int ex;
30484
- memcpy(&u, &rx, sizeof(u));
30485
- ex = -1023 + (int)((u>>52)&0x7ff);
30486
- if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16;
30487
- realvalue += rounder;
30488
- }
30489
- /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
30490
- exp = 0;
30491
- if( sqlite3IsNaN((double)realvalue) ){
30492
- bufpt = "NaN";
30493
- length = 3;
30494
- break;
30495
- }
30496
- if( realvalue>0.0 ){
30497
- LONGDOUBLE_TYPE scale = 1.0;
30498
- while( realvalue>=1e100*scale && exp<=350 ){ scale *= 1e100;exp+=100;}
30499
- while( realvalue>=1e10*scale && exp<=350 ){ scale *= 1e10; exp+=10; }
30500
- while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; }
30501
- realvalue /= scale;
30502
- while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }
30503
- while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }
30504
- if( exp>350 ){
30505
- bufpt = buf;
30506
- buf[0] = prefix;
30507
- memcpy(buf+(prefix!=0),"Inf",4);
30508
- length = 3+(prefix!=0);
30509
- break;
30510
- }
30511
- }
30512
- bufpt = buf;
30562
+ if( realvalue<1.0e+16
30563
+ && realvalue==(LONGDOUBLE_TYPE)(longvalue = (u64)realvalue)
30564
+ ){
30565
+ /* Number is a pure integer that can be represented as u64 */
30566
+ for(msd=1; msd*10<=longvalue; msd *= 10, exp++){}
30567
+ if( exp>precision && xtype!=etFLOAT ){
30568
+ u64 rnd = msd/2;
30569
+ int kk = precision;
30570
+ while( kk-- > 0 ){ rnd /= 10; }
30571
+ longvalue += rnd;
30572
+ }
30573
+ }else{
30574
+ msd = 0;
30575
+ longvalue = 0; /* To prevent a compiler warning */
30576
+ idx = precision & 0xfff;
30577
+ rounder = arRound[idx%10];
30578
+ while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; }
30579
+ if( xtype==etFLOAT ){
30580
+ double rx = (double)realvalue;
30581
+ sqlite3_uint64 u;
30582
+ int ex;
30583
+ memcpy(&u, &rx, sizeof(u));
30584
+ ex = -1023 + (int)((u>>52)&0x7ff);
30585
+ if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16;
30586
+ realvalue += rounder;
30587
+ }
30588
+ if( sqlite3IsNaN((double)realvalue) ){
30589
+ if( flag_zeropad ){
30590
+ bufpt = "null";
30591
+ length = 4;
30592
+ }else{
30593
+ bufpt = "NaN";
30594
+ length = 3;
30595
+ }
30596
+ break;
30597
+ }
30598
+
30599
+ /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
30600
+ if( ALWAYS(realvalue>0.0) ){
30601
+ LONGDOUBLE_TYPE scale = 1.0;
30602
+ while( realvalue>=1e100*scale && exp<=350){ scale*=1e100;exp+=100;}
30603
+ while( realvalue>=1e10*scale && exp<=350 ){ scale*=1e10; exp+=10; }
30604
+ while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; }
30605
+ realvalue /= scale;
30606
+ while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }
30607
+ while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }
30608
+ if( exp>350 ){
30609
+ if( flag_zeropad ){
30610
+ realvalue = 9.0;
30611
+ exp = 999;
30612
+ }else{
30613
+ bufpt = buf;
30614
+ buf[0] = prefix;
30615
+ memcpy(buf+(prefix!=0),"Inf",4);
30616
+ length = 3+(prefix!=0);
30617
+ break;
30618
+ }
30619
+ }
30620
+ if( xtype!=etFLOAT ){
30621
+ realvalue += rounder;
30622
+ if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
30623
+ }
30624
+ }
30625
+ }
30626
+
3051330627
/*
3051430628
** If the field type is etGENERIC, then convert to either etEXP
3051530629
** or etFLOAT, as appropriate.
3051630630
*/
30517
- if( xtype!=etFLOAT ){
30518
- realvalue += rounder;
30519
- if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
30520
- }
3052130631
if( xtype==etGENERIC ){
3052230632
flag_rtz = !flag_alternateform;
3052330633
if( exp<-4 || exp>precision ){
3052430634
xtype = etEXP;
3052530635
}else{
@@ -30532,28 +30642,33 @@
3053230642
if( xtype==etEXP ){
3053330643
e2 = 0;
3053430644
}else{
3053530645
e2 = exp;
3053630646
}
30647
+ nsd = 16 + flag_altform2*10;
30648
+ bufpt = buf;
3053730649
{
3053830650
i64 szBufNeeded; /* Size of a temporary buffer needed */
3053930651
szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15;
3054030652
if( szBufNeeded > etBUFSIZE ){
3054130653
bufpt = zExtra = printfTempBuf(pAccum, szBufNeeded);
3054230654
if( bufpt==0 ) return;
3054330655
}
3054430656
}
3054530657
zOut = bufpt;
30546
- nsd = 16 + flag_altform2*10;
3054730658
flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2;
3054830659
/* The sign in front of the number */
3054930660
if( prefix ){
3055030661
*(bufpt++) = prefix;
3055130662
}
3055230663
/* Digits prior to the decimal point */
3055330664
if( e2<0 ){
3055430665
*(bufpt++) = '0';
30666
+ }else if( msd>0 ){
30667
+ for(; e2>=0; e2--){
30668
+ *(bufpt++) = et_getdigit_int(&longvalue,&msd);
30669
+ }
3055530670
}else{
3055630671
for(; e2>=0; e2--){
3055730672
*(bufpt++) = et_getdigit(&realvalue,&nsd);
3055830673
}
3055930674
}
@@ -30566,12 +30681,18 @@
3056630681
for(e2++; e2<0; precision--, e2++){
3056730682
assert( precision>0 );
3056830683
*(bufpt++) = '0';
3056930684
}
3057030685
/* Significant digits after the decimal point */
30571
- while( (precision--)>0 ){
30572
- *(bufpt++) = et_getdigit(&realvalue,&nsd);
30686
+ if( msd>0 ){
30687
+ while( (precision--)>0 ){
30688
+ *(bufpt++) = et_getdigit_int(&longvalue,&msd);
30689
+ }
30690
+ }else{
30691
+ while( (precision--)>0 ){
30692
+ *(bufpt++) = et_getdigit(&realvalue,&nsd);
30693
+ }
3057330694
}
3057430695
/* Remove trailing zeros and the "." if no digits follow the "." */
3057530696
if( flag_rtz && flag_dp ){
3057630697
while( bufpt[-1]=='0' ) *(--bufpt) = 0;
3057730698
assert( bufpt>zOut );
@@ -31248,16 +31369,26 @@
3124831369
sqlite3_str_vappendf(&acc, zFormat, ap);
3124931370
zBuf[acc.nChar] = 0;
3125031371
return zBuf;
3125131372
}
3125231373
SQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
31253
- char *z;
31374
+ StrAccum acc;
3125431375
va_list ap;
31376
+ if( n<=0 ) return zBuf;
31377
+#ifdef SQLITE_ENABLE_API_ARMOR
31378
+ if( zBuf==0 || zFormat==0 ) {
31379
+ (void)SQLITE_MISUSE_BKPT;
31380
+ if( zBuf ) zBuf[0] = 0;
31381
+ return zBuf;
31382
+ }
31383
+#endif
31384
+ sqlite3StrAccumInit(&acc, 0, zBuf, n, 0);
3125531385
va_start(ap,zFormat);
31256
- z = sqlite3_vsnprintf(n, zBuf, zFormat, ap);
31386
+ sqlite3_str_vappendf(&acc, zFormat, ap);
3125731387
va_end(ap);
31258
- return z;
31388
+ zBuf[acc.nChar] = 0;
31389
+ return zBuf;
3125931390
}
3126031391
3126131392
/*
3126231393
** This is the routine that actually formats the sqlite3_log() message.
3126331394
** We house it in a separate routine from sqlite3_log() to avoid using
@@ -52655,11 +52786,11 @@
5265552786
** pointers).
5265652787
*/
5265752788
struct PCache {
5265852789
PgHdr *pDirty, *pDirtyTail; /* List of dirty pages in LRU order */
5265952790
PgHdr *pSynced; /* Last synced page in dirty page list */
52660
- int nRefSum; /* Sum of ref counts over all pages */
52791
+ i64 nRefSum; /* Sum of ref counts over all pages */
5266152792
int szCache; /* Configured cache size */
5266252793
int szSpill; /* Size before spilling occurs */
5266352794
int szPage; /* Size of every page in this cache */
5266452795
int szExtra; /* Size of extra space for each page */
5266552796
u8 bPurgeable; /* True if pages are on backing store */
@@ -52685,11 +52816,11 @@
5268552816
static void pcachePageTrace(int i, sqlite3_pcache_page *pLower){
5268652817
PgHdr *pPg;
5268752818
unsigned char *a;
5268852819
int j;
5268952820
pPg = (PgHdr*)pLower->pExtra;
52690
- printf("%3d: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags);
52821
+ printf("%3lld: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags);
5269152822
a = (unsigned char *)pLower->pBuf;
5269252823
for(j=0; j<12; j++) printf("%02x", a[j]);
5269352824
printf(" ptr %p\n", pPg);
5269452825
}
5269552826
static void pcacheDump(PCache *pCache){
@@ -53429,18 +53560,18 @@
5342953560
** Return the total number of references to all pages held by the cache.
5343053561
**
5343153562
** This is not the total number of pages referenced, but the sum of the
5343253563
** reference count for all pages.
5343353564
*/
53434
-SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache *pCache){
53565
+SQLITE_PRIVATE i64 sqlite3PcacheRefCount(PCache *pCache){
5343553566
return pCache->nRefSum;
5343653567
}
5343753568
5343853569
/*
5343953570
** Return the number of references to the page supplied as an argument.
5344053571
*/
53441
-SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr *p){
53572
+SQLITE_PRIVATE i64 sqlite3PcachePageRefcount(PgHdr *p){
5344253573
return p->nRef;
5344353574
}
5344453575
5344553576
/*
5344653577
** Return the total number of pages in the cache.
@@ -68094,12 +68225,13 @@
6809468225
int mxErr; /* Stop accumulating errors when this reaches zero */
6809568226
int nErr; /* Number of messages written to zErrMsg so far */
6809668227
int rc; /* SQLITE_OK, SQLITE_NOMEM, or SQLITE_INTERRUPT */
6809768228
u32 nStep; /* Number of steps into the integrity_check process */
6809868229
const char *zPfx; /* Error message prefix */
68099
- Pgno v1; /* Value for first %u substitution in zPfx */
68100
- int v2; /* Value for second %d substitution in zPfx */
68230
+ Pgno v0; /* Value for first %u substitution in zPfx (root page) */
68231
+ Pgno v1; /* Value for second %u substitution in zPfx (current pg) */
68232
+ int v2; /* Value for third %d substitution in zPfx */
6810168233
StrAccum errMsg; /* Accumulate the error message text here */
6810268234
u32 *heap; /* Min-heap used for analyzing cell coverage */
6810368235
sqlite3 *db; /* Database connection running the check */
6810468236
};
6810568237
@@ -68558,12 +68690,12 @@
6855868690
*/
6855968691
#ifdef SQLITE_DEBUG
6856068692
int corruptPageError(int lineno, MemPage *p){
6856168693
char *zMsg;
6856268694
sqlite3BeginBenignMalloc();
68563
- zMsg = sqlite3_mprintf("database corruption page %d of %s",
68564
- (int)p->pgno, sqlite3PagerFilename(p->pBt->pPager, 0)
68695
+ zMsg = sqlite3_mprintf("database corruption page %u of %s",
68696
+ p->pgno, sqlite3PagerFilename(p->pBt->pPager, 0)
6856568697
);
6856668698
sqlite3EndBenignMalloc();
6856768699
if( zMsg ){
6856868700
sqlite3ReportError(SQLITE_CORRUPT, lineno, zMsg);
6856968701
}
@@ -69454,11 +69586,11 @@
6945469586
}
6945569587
assert( offset <= (int)pBt->usableSize-5 );
6945669588
pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);
6945769589
6945869590
if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){
69459
- TRACE(("PTRMAP_UPDATE: %d->(%d,%d)\n", key, eType, parent));
69591
+ TRACE(("PTRMAP_UPDATE: %u->(%u,%u)\n", key, eType, parent));
6946069592
*pRC= rc = sqlite3PagerWrite(pDbPage);
6946169593
if( rc==SQLITE_OK ){
6946269594
pPtrmap[offset] = eType;
6946369595
put4byte(&pPtrmap[offset+1], parent);
6946469596
}
@@ -69653,31 +69785,35 @@
6965369785
** This routine is a high-runner.
6965469786
*/
6965569787
iKey = *pIter;
6965669788
if( iKey>=0x80 ){
6965769789
u8 x;
69658
- iKey = ((iKey&0x7f)<<7) | ((x = *++pIter) & 0x7f);
69659
- if( x>=0x80 ){
69660
- iKey = (iKey<<7) | ((x =*++pIter) & 0x7f);
69661
- if( x>=0x80 ){
69662
- iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69663
- if( x>=0x80 ){
69664
- iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69665
- if( x>=0x80 ){
69666
- iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69667
- if( x>=0x80 ){
69668
- iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69669
- if( x>=0x80 ){
69670
- iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69671
- if( x>=0x80 ){
69672
- iKey = (iKey<<8) | (*++pIter);
69673
- }
69674
- }
69675
- }
69676
- }
69677
- }
69678
- }
69790
+ iKey = (iKey<<7) ^ (x = *++pIter);
69791
+ if( x>=0x80 ){
69792
+ iKey = (iKey<<7) ^ (x = *++pIter);
69793
+ if( x>=0x80 ){
69794
+ iKey = (iKey<<7) ^ 0x10204000 ^ (x = *++pIter);
69795
+ if( x>=0x80 ){
69796
+ iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
69797
+ if( x>=0x80 ){
69798
+ iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
69799
+ if( x>=0x80 ){
69800
+ iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
69801
+ if( x>=0x80 ){
69802
+ iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
69803
+ if( x>=0x80 ){
69804
+ iKey = (iKey<<8) ^ 0x8000 ^ (*++pIter);
69805
+ }
69806
+ }
69807
+ }
69808
+ }
69809
+ }
69810
+ }else{
69811
+ iKey ^= 0x204000;
69812
+ }
69813
+ }else{
69814
+ iKey ^= 0x4000;
6967969815
}
6968069816
}
6968169817
pIter++;
6968269818
6968369819
pInfo->nKey = *(i64*)&iKey;
@@ -69750,14 +69886,57 @@
6975069886
** data header and the local payload, but not any overflow page or
6975169887
** the space used by the cell pointer.
6975269888
**
6975369889
** cellSizePtrNoPayload() => table internal nodes
6975469890
** cellSizePtrTableLeaf() => table leaf nodes
69755
-** cellSizePtr() => all index nodes & table leaf nodes
69891
+** cellSizePtr() => index internal nodes
69892
+** cellSizeIdxLeaf() => index leaf nodes
6975669893
*/
6975769894
static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
69758
- u8 *pIter = pCell + pPage->childPtrSize; /* For looping over bytes of pCell */
69895
+ u8 *pIter = pCell + 4; /* For looping over bytes of pCell */
69896
+ u8 *pEnd; /* End mark for a varint */
69897
+ u32 nSize; /* Size value to return */
69898
+
69899
+#ifdef SQLITE_DEBUG
69900
+ /* The value returned by this function should always be the same as
69901
+ ** the (CellInfo.nSize) value found by doing a full parse of the
69902
+ ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of
69903
+ ** this function verifies that this invariant is not violated. */
69904
+ CellInfo debuginfo;
69905
+ pPage->xParseCell(pPage, pCell, &debuginfo);
69906
+#endif
69907
+
69908
+ assert( pPage->childPtrSize==4 );
69909
+ nSize = *pIter;
69910
+ if( nSize>=0x80 ){
69911
+ pEnd = &pIter[8];
69912
+ nSize &= 0x7f;
69913
+ do{
69914
+ nSize = (nSize<<7) | (*++pIter & 0x7f);
69915
+ }while( *(pIter)>=0x80 && pIter<pEnd );
69916
+ }
69917
+ pIter++;
69918
+ testcase( nSize==pPage->maxLocal );
69919
+ testcase( nSize==(u32)pPage->maxLocal+1 );
69920
+ if( nSize<=pPage->maxLocal ){
69921
+ nSize += (u32)(pIter - pCell);
69922
+ assert( nSize>4 );
69923
+ }else{
69924
+ int minLocal = pPage->minLocal;
69925
+ nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
69926
+ testcase( nSize==pPage->maxLocal );
69927
+ testcase( nSize==(u32)pPage->maxLocal+1 );
69928
+ if( nSize>pPage->maxLocal ){
69929
+ nSize = minLocal;
69930
+ }
69931
+ nSize += 4 + (u16)(pIter - pCell);
69932
+ }
69933
+ assert( nSize==debuginfo.nSize || CORRUPT_DB );
69934
+ return (u16)nSize;
69935
+}
69936
+static u16 cellSizePtrIdxLeaf(MemPage *pPage, u8 *pCell){
69937
+ u8 *pIter = pCell; /* For looping over bytes of pCell */
6975969938
u8 *pEnd; /* End mark for a varint */
6976069939
u32 nSize; /* Size value to return */
6976169940
6976269941
#ifdef SQLITE_DEBUG
6976369942
/* The value returned by this function should always be the same as
@@ -69766,10 +69945,11 @@
6976669945
** this function verifies that this invariant is not violated. */
6976769946
CellInfo debuginfo;
6976869947
pPage->xParseCell(pPage, pCell, &debuginfo);
6976969948
#endif
6977069949
69950
+ assert( pPage->childPtrSize==0 );
6977169951
nSize = *pIter;
6977269952
if( nSize>=0x80 ){
6977369953
pEnd = &pIter[8];
6977469954
nSize &= 0x7f;
6977569955
do{
@@ -70002,14 +70182,14 @@
7000270182
testcase( pc==iCellFirst );
7000370183
testcase( pc==iCellLast );
7000470184
/* These conditions have already been verified in btreeInitPage()
7000570185
** if PRAGMA cell_size_check=ON.
7000670186
*/
70007
- if( pc<iCellStart || pc>iCellLast ){
70187
+ if( pc>iCellLast ){
7000870188
return SQLITE_CORRUPT_PAGE(pPage);
7000970189
}
70010
- assert( pc>=iCellStart && pc<=iCellLast );
70190
+ assert( pc>=0 && pc<=iCellLast );
7001170191
size = pPage->xCellSize(pPage, &src[pc]);
7001270192
cbrk -= size;
7001370193
if( cbrk<iCellStart || pc+size>usableSize ){
7001470194
return SQLITE_CORRUPT_PAGE(pPage);
7001570195
}
@@ -70347,18 +70527,18 @@
7034770527
pPage->maxLocal = pBt->maxLeaf;
7034870528
pPage->minLocal = pBt->minLeaf;
7034970529
}else if( flagByte==(PTF_ZERODATA | PTF_LEAF) ){
7035070530
pPage->intKey = 0;
7035170531
pPage->intKeyLeaf = 0;
70352
- pPage->xCellSize = cellSizePtr;
70532
+ pPage->xCellSize = cellSizePtrIdxLeaf;
7035370533
pPage->xParseCell = btreeParseCellPtrIndex;
7035470534
pPage->maxLocal = pBt->maxLocal;
7035570535
pPage->minLocal = pBt->minLocal;
7035670536
}else{
7035770537
pPage->intKey = 0;
7035870538
pPage->intKeyLeaf = 0;
70359
- pPage->xCellSize = cellSizePtr;
70539
+ pPage->xCellSize = cellSizePtrIdxLeaf;
7036070540
pPage->xParseCell = btreeParseCellPtrIndex;
7036170541
return SQLITE_CORRUPT_PAGE(pPage);
7036270542
}
7036370543
}else{
7036470544
pPage->childPtrSize = 4;
@@ -72220,11 +72400,11 @@
7222072400
assert( sqlite3_mutex_held(pBt->mutex) );
7222172401
assert( pDbPage->pBt==pBt );
7222272402
if( iDbPage<3 ) return SQLITE_CORRUPT_BKPT;
7222372403
7222472404
/* Move page iDbPage from its current location to page number iFreePage */
72225
- TRACE(("AUTOVACUUM: Moving %d to free page %d (ptr page %d type %d)\n",
72405
+ TRACE(("AUTOVACUUM: Moving %u to free page %u (ptr page %u type %u)\n",
7222672406
iDbPage, iFreePage, iPtrPage, eType));
7222772407
rc = sqlite3PagerMovepage(pPager, pDbPage->pDbPage, iFreePage, isCommit);
7222872408
if( rc!=SQLITE_OK ){
7222972409
return rc;
7223072410
}
@@ -74506,11 +74686,12 @@
7450674686
}
7450774687
}
7450874688
7450974689
pPage = pCur->pPage;
7451074690
idx = ++pCur->ix;
74511
- if( !pPage->isInit || sqlite3FaultSim(412) ){
74691
+ if( sqlite3FaultSim(412) ) pPage->isInit = 0;
74692
+ if( !pPage->isInit ){
7451274693
return SQLITE_CORRUPT_BKPT;
7451374694
}
7451474695
7451574696
if( idx>=pPage->nCell ){
7451674697
if( !pPage->leaf ){
@@ -74769,11 +74950,11 @@
7476974950
}
7477074951
*pPgno = iTrunk;
7477174952
memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);
7477274953
*ppPage = pTrunk;
7477374954
pTrunk = 0;
74774
- TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
74955
+ TRACE(("ALLOCATE: %u trunk - %u free pages left\n", *pPgno, n-1));
7477574956
}else if( k>(u32)(pBt->usableSize/4 - 2) ){
7477674957
/* Value of k is out of range. Database corruption */
7477774958
rc = SQLITE_CORRUPT_PGNO(iTrunk);
7477874959
goto end_allocate_page;
7477974960
#ifndef SQLITE_OMIT_AUTOVACUUM
@@ -74835,11 +75016,11 @@
7483575016
}
7483675017
put4byte(&pPrevTrunk->aData[0], iNewTrunk);
7483775018
}
7483875019
}
7483975020
pTrunk = 0;
74840
- TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
75021
+ TRACE(("ALLOCATE: %u trunk - %u free pages left\n", *pPgno, n-1));
7484175022
#endif
7484275023
}else if( k>0 ){
7484375024
/* Extract a leaf from the trunk */
7484475025
u32 closest;
7484575026
Pgno iPage;
@@ -74880,12 +75061,12 @@
7488075061
if( !searchList
7488175062
|| (iPage==nearby || (iPage<nearby && eMode==BTALLOC_LE))
7488275063
){
7488375064
int noContent;
7488475065
*pPgno = iPage;
74885
- TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d"
74886
- ": %d more free pages\n",
75066
+ TRACE(("ALLOCATE: %u was leaf %u of %u on trunk %u"
75067
+ ": %u more free pages\n",
7488775068
*pPgno, closest+1, k, pTrunk->pgno, n-1));
7488875069
rc = sqlite3PagerWrite(pTrunk->pDbPage);
7488975070
if( rc ) goto end_allocate_page;
7489075071
if( closest<k-1 ){
7489175072
memcpy(&aData[8+closest*4], &aData[4+k*4], 4);
@@ -74937,11 +75118,11 @@
7493775118
/* If *pPgno refers to a pointer-map page, allocate two new pages
7493875119
** at the end of the file instead of one. The first allocated page
7493975120
** becomes a new pointer-map page, the second is used by the caller.
7494075121
*/
7494175122
MemPage *pPg = 0;
74942
- TRACE(("ALLOCATE: %d from end of file (pointer-map page)\n", pBt->nPage));
75123
+ TRACE(("ALLOCATE: %u from end of file (pointer-map page)\n", pBt->nPage));
7494375124
assert( pBt->nPage!=PENDING_BYTE_PAGE(pBt) );
7494475125
rc = btreeGetUnusedPage(pBt, pBt->nPage, &pPg, bNoContent);
7494575126
if( rc==SQLITE_OK ){
7494675127
rc = sqlite3PagerWrite(pPg->pDbPage);
7494775128
releasePage(pPg);
@@ -74960,11 +75141,11 @@
7496075141
rc = sqlite3PagerWrite((*ppPage)->pDbPage);
7496175142
if( rc!=SQLITE_OK ){
7496275143
releasePage(*ppPage);
7496375144
*ppPage = 0;
7496475145
}
74965
- TRACE(("ALLOCATE: %d from end of file\n", *pPgno));
75146
+ TRACE(("ALLOCATE: %u from end of file\n", *pPgno));
7496675147
}
7496775148
7496875149
assert( CORRUPT_DB || *pPgno!=PENDING_BYTE_PAGE(pBt) );
7496975150
7497075151
end_allocate_page:
@@ -75088,11 +75269,11 @@
7508875269
if( pPage && (pBt->btsFlags & BTS_SECURE_DELETE)==0 ){
7508975270
sqlite3PagerDontWrite(pPage->pDbPage);
7509075271
}
7509175272
rc = btreeSetHasContent(pBt, iPage);
7509275273
}
75093
- TRACE(("FREE-PAGE: %d leaf on trunk page %d\n",pPage->pgno,pTrunk->pgno));
75274
+ TRACE(("FREE-PAGE: %u leaf on trunk page %u\n",pPage->pgno,pTrunk->pgno));
7509475275
goto freepage_out;
7509575276
}
7509675277
}
7509775278
7509875279
/* If control flows to this point, then it was not possible to add the
@@ -75109,11 +75290,11 @@
7510975290
goto freepage_out;
7511075291
}
7511175292
put4byte(pPage->aData, iTrunk);
7511275293
put4byte(&pPage->aData[4], 0);
7511375294
put4byte(&pPage1->aData[32], iPage);
75114
- TRACE(("FREE-PAGE: %d new trunk page replacing %d\n", pPage->pgno, iTrunk));
75295
+ TRACE(("FREE-PAGE: %u new trunk page replacing %u\n", pPage->pgno, iTrunk));
7511575296
7511675297
freepage_out:
7511775298
if( pPage ){
7511875299
pPage->isInit = 0;
7511975300
}
@@ -76695,11 +76876,11 @@
7669576876
** (2) pPage is a virtual root page. A virtual root page is when
7669676877
** the real root page is page 1 and we are the only child of
7669776878
** that page.
7669876879
*/
7669976880
assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) || CORRUPT_DB);
76700
- TRACE(("BALANCE: old: %d(nc=%d) %d(nc=%d) %d(nc=%d)\n",
76881
+ TRACE(("BALANCE: old: %u(nc=%u) %u(nc=%u) %u(nc=%u)\n",
7670176882
apOld[0]->pgno, apOld[0]->nCell,
7670276883
nOld>=2 ? apOld[1]->pgno : 0, nOld>=2 ? apOld[1]->nCell : 0,
7670376884
nOld>=3 ? apOld[2]->pgno : 0, nOld>=3 ? apOld[2]->nCell : 0
7670476885
));
7670576886
@@ -76779,12 +76960,12 @@
7677976960
apNew[i]->pgno = pgnoB;
7678076961
apNew[iB]->pgno = pgnoA;
7678176962
}
7678276963
}
7678376964
76784
- TRACE(("BALANCE: new: %d(%d nc=%d) %d(%d nc=%d) %d(%d nc=%d) "
76785
- "%d(%d nc=%d) %d(%d nc=%d)\n",
76965
+ TRACE(("BALANCE: new: %u(%u nc=%u) %u(%u nc=%u) %u(%u nc=%u) "
76966
+ "%u(%u nc=%u) %u(%u nc=%u)\n",
7678676967
apNew[0]->pgno, szNew[0], cntNew[0],
7678776968
nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0,
7678876969
nNew>=2 ? cntNew[1] - cntNew[0] - !leafData : 0,
7678976970
nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0,
7679076971
nNew>=3 ? cntNew[2] - cntNew[1] - !leafData : 0,
@@ -77025,11 +77206,11 @@
7702577206
ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);
7702677207
}
7702777208
}
7702877209
7702977210
assert( pParent->isInit );
77030
- TRACE(("BALANCE: finished: old=%d new=%d cells=%d\n",
77211
+ TRACE(("BALANCE: finished: old=%u new=%u cells=%u\n",
7703177212
nOld, nNew, b.nCell));
7703277213
7703377214
/* Free any old pages that were not reused as new pages.
7703477215
*/
7703577216
for(i=nNew; i<nOld; i++){
@@ -77110,11 +77291,11 @@
7711077291
}
7711177292
assert( sqlite3PagerIswriteable(pChild->pDbPage) );
7711277293
assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
7711377294
assert( pChild->nCell==pRoot->nCell || CORRUPT_DB );
7711477295
77115
- TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno));
77296
+ TRACE(("BALANCE: copy root %u into %u\n", pRoot->pgno, pChild->pgno));
7711677297
7711777298
/* Copy the overflow cells from pRoot to pChild */
7711877299
memcpy(pChild->aiOvfl, pRoot->aiOvfl,
7711977300
pRoot->nOverflow*sizeof(pRoot->aiOvfl[0]));
7712077301
memcpy(pChild->apOvfl, pRoot->apOvfl,
@@ -77608,11 +77789,11 @@
7760877789
rc = btreeComputeFreeSpace(pPage);
7760977790
}
7761077791
if( rc ) return rc;
7761177792
}
7761277793
77613
- TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
77794
+ TRACE(("INSERT: table=%u nkey=%lld ndata=%u page=%u %s\n",
7761477795
pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
7761577796
loc==0 ? "overwrite" : "new entry"));
7761677797
assert( pPage->isInit || CORRUPT_DB );
7761777798
newCell = p->pBt->pTmpSpace;
7761877799
assert( newCell!=0 );
@@ -77635,10 +77816,11 @@
7763577816
if( rc ) goto end_insert;
7763677817
}
7763777818
assert( szNew==pPage->xCellSize(pPage, newCell) );
7763877819
assert( szNew <= MX_CELL_SIZE(p->pBt) );
7763977820
idx = pCur->ix;
77821
+ pCur->info.nSize = 0;
7764077822
if( loc==0 ){
7764177823
CellInfo info;
7764277824
assert( idx>=0 );
7764377825
if( idx>=pPage->nCell ){
7764477826
return SQLITE_CORRUPT_BKPT;
@@ -77707,11 +77889,10 @@
7770777889
** the b-tree if possible. If the cursor is left pointing to the last
7770877890
** entry in the table, and the next row inserted has an integer key
7770977891
** larger than the largest existing key, it is possible to insert the
7771077892
** row without seeking the cursor. This can be a big performance boost.
7771177893
*/
77712
- pCur->info.nSize = 0;
7771377894
if( pPage->nOverflow ){
7771477895
assert( rc==SQLITE_OK );
7771577896
pCur->curFlags &= ~(BTCF_ValidNKey);
7771677897
rc = balance(pCur);
7771777898
@@ -78656,11 +78837,12 @@
7865678837
va_start(ap, zFormat);
7865778838
if( pCheck->errMsg.nChar ){
7865878839
sqlite3_str_append(&pCheck->errMsg, "\n", 1);
7865978840
}
7866078841
if( pCheck->zPfx ){
78661
- sqlite3_str_appendf(&pCheck->errMsg, pCheck->zPfx, pCheck->v1, pCheck->v2);
78842
+ sqlite3_str_appendf(&pCheck->errMsg, pCheck->zPfx,
78843
+ pCheck->v0, pCheck->v1, pCheck->v2);
7866278844
}
7866378845
sqlite3_str_vappendf(&pCheck->errMsg, zFormat, ap);
7866478846
va_end(ap);
7866578847
if( pCheck->errMsg.accError==SQLITE_NOMEM ){
7866678848
checkOom(pCheck);
@@ -78696,15 +78878,15 @@
7869678878
**
7869778879
** Also check that the page number is in bounds.
7869878880
*/
7869978881
static int checkRef(IntegrityCk *pCheck, Pgno iPage){
7870078882
if( iPage>pCheck->nPage || iPage==0 ){
78701
- checkAppendMsg(pCheck, "invalid page number %d", iPage);
78883
+ checkAppendMsg(pCheck, "invalid page number %u", iPage);
7870278884
return 1;
7870378885
}
7870478886
if( getPageReferenced(pCheck, iPage) ){
78705
- checkAppendMsg(pCheck, "2nd reference to page %d", iPage);
78887
+ checkAppendMsg(pCheck, "2nd reference to page %u", iPage);
7870678888
return 1;
7870778889
}
7870878890
setPageReferenced(pCheck, iPage);
7870978891
return 0;
7871078892
}
@@ -78726,17 +78908,17 @@
7872678908
Pgno iPtrmapParent;
7872778909
7872878910
rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent);
7872978911
if( rc!=SQLITE_OK ){
7873078912
if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) checkOom(pCheck);
78731
- checkAppendMsg(pCheck, "Failed to read ptrmap key=%d", iChild);
78913
+ checkAppendMsg(pCheck, "Failed to read ptrmap key=%u", iChild);
7873278914
return;
7873378915
}
7873478916
7873578917
if( ePtrmapType!=eType || iPtrmapParent!=iParent ){
7873678918
checkAppendMsg(pCheck,
78737
- "Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)",
78919
+ "Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)",
7873878920
iChild, eType, iParent, ePtrmapType, iPtrmapParent);
7873978921
}
7874078922
}
7874178923
#endif
7874278924
@@ -78757,11 +78939,11 @@
7875778939
DbPage *pOvflPage;
7875878940
unsigned char *pOvflData;
7875978941
if( checkRef(pCheck, iPage) ) break;
7876078942
N--;
7876178943
if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage, 0) ){
78762
- checkAppendMsg(pCheck, "failed to get page %d", iPage);
78944
+ checkAppendMsg(pCheck, "failed to get page %u", iPage);
7876378945
break;
7876478946
}
7876578947
pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage);
7876678948
if( isFreeList ){
7876778949
u32 n = (u32)get4byte(&pOvflData[4]);
@@ -78770,11 +78952,11 @@
7877078952
checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0);
7877178953
}
7877278954
#endif
7877378955
if( n>pCheck->pBt->usableSize/4-2 ){
7877478956
checkAppendMsg(pCheck,
78775
- "freelist leaf count too big on page %d", iPage);
78957
+ "freelist leaf count too big on page %u", iPage);
7877678958
N--;
7877778959
}else{
7877878960
for(i=0; i<(int)n; i++){
7877978961
Pgno iFreePage = get4byte(&pOvflData[8+i*4]);
7878078962
#ifndef SQLITE_OMIT_AUTOVACUUM
@@ -78802,11 +78984,11 @@
7880278984
iPage = get4byte(pOvflData);
7880378985
sqlite3PagerUnref(pOvflPage);
7880478986
}
7880578987
if( N && nErrAtStart==pCheck->nErr ){
7880678988
checkAppendMsg(pCheck,
78807
- "%s is %d but should be %d",
78989
+ "%s is %u but should be %u",
7880878990
isFreeList ? "size" : "overflow list length",
7880978991
expected-N, expected);
7881078992
}
7881178993
}
7881278994
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */
@@ -78917,12 +79099,12 @@
7891779099
if( pCheck->mxErr==0 ) goto end_of_check;
7891879100
pBt = pCheck->pBt;
7891979101
usableSize = pBt->usableSize;
7892079102
if( iPage==0 ) return 0;
7892179103
if( checkRef(pCheck, iPage) ) return 0;
78922
- pCheck->zPfx = "Page %u: ";
78923
- pCheck->v1 = iPage;
79104
+ pCheck->zPfx = "Tree %u page %u: ";
79105
+ pCheck->v0 = pCheck->v1 = iPage;
7892479106
if( (rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0 ){
7892579107
checkAppendMsg(pCheck,
7892679108
"unable to get the page. error code=%d", rc);
7892779109
goto end_of_check;
7892879110
}
@@ -78944,11 +79126,11 @@
7894479126
}
7894579127
data = pPage->aData;
7894679128
hdr = pPage->hdrOffset;
7894779129
7894879130
/* Set up for cell analysis */
78949
- pCheck->zPfx = "On tree page %u cell %d: ";
79131
+ pCheck->zPfx = "Tree %u page %u cell %u: ";
7895079132
contentOffset = get2byteNotZero(&data[hdr+5]);
7895179133
assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */
7895279134
7895379135
/* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
7895479136
** number of cells on the page. */
@@ -78964,11 +79146,11 @@
7896479146
if( !pPage->leaf ){
7896579147
/* Analyze the right-child page of internal pages */
7896679148
pgno = get4byte(&data[hdr+8]);
7896779149
#ifndef SQLITE_OMIT_AUTOVACUUM
7896879150
if( pBt->autoVacuum ){
78969
- pCheck->zPfx = "On page %u at right child: ";
79151
+ pCheck->zPfx = "Tree %u page %u right child: ";
7897079152
checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage);
7897179153
}
7897279154
#endif
7897379155
depth = checkTreePage(pCheck, pgno, &maxKey, maxKey);
7897479156
keyCanBeEqual = 0;
@@ -78988,11 +79170,11 @@
7898879170
pCheck->v2 = i;
7898979171
assert( pCellIdx==&data[cellStart + i*2] );
7899079172
pc = get2byteAligned(pCellIdx);
7899179173
pCellIdx -= 2;
7899279174
if( pc<contentOffset || pc>usableSize-4 ){
78993
- checkAppendMsg(pCheck, "Offset %d out of range %d..%d",
79175
+ checkAppendMsg(pCheck, "Offset %u out of range %u..%u",
7899479176
pc, contentOffset, usableSize-4);
7899579177
doCoverageCheck = 0;
7899679178
continue;
7899779179
}
7899879180
pCell = &data[pc];
@@ -79120,11 +79302,11 @@
7912079302
** EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the
7912179303
** number of fragmented free bytes within the cell content area.
7912279304
*/
7912379305
if( heap[0]==0 && nFrag!=data[hdr+7] ){
7912479306
checkAppendMsg(pCheck,
79125
- "Fragmentation of %d bytes reported as %d on page %u",
79307
+ "Fragmentation of %u bytes reported as %u on page %u",
7912679308
nFrag, data[hdr+7], iPage);
7912779309
}
7912879310
}
7912979311
7913079312
end_of_check:
@@ -79217,11 +79399,11 @@
7921779399
if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i);
7921879400
7921979401
/* Check the integrity of the freelist
7922079402
*/
7922179403
if( bCkFreelist ){
79222
- sCheck.zPfx = "Main freelist: ";
79404
+ sCheck.zPfx = "Freelist: ";
7922379405
checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]),
7922479406
get4byte(&pBt->pPage1->aData[36]));
7922579407
sCheck.zPfx = 0;
7922679408
}
7922779409
@@ -79234,11 +79416,11 @@
7923479416
Pgno mxInHdr;
7923579417
for(i=0; (int)i<nRoot; i++) if( mx<aRoot[i] ) mx = aRoot[i];
7923679418
mxInHdr = get4byte(&pBt->pPage1->aData[52]);
7923779419
if( mx!=mxInHdr ){
7923879420
checkAppendMsg(&sCheck,
79239
- "max rootpage (%d) disagrees with header (%d)",
79421
+ "max rootpage (%u) disagrees with header (%u)",
7924079422
mx, mxInHdr
7924179423
);
7924279424
}
7924379425
}else if( get4byte(&pBt->pPage1->aData[64])!=0 ){
7924479426
checkAppendMsg(&sCheck,
@@ -79265,23 +79447,23 @@
7926579447
*/
7926679448
if( !bPartial ){
7926779449
for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){
7926879450
#ifdef SQLITE_OMIT_AUTOVACUUM
7926979451
if( getPageReferenced(&sCheck, i)==0 ){
79270
- checkAppendMsg(&sCheck, "Page %d is never used", i);
79452
+ checkAppendMsg(&sCheck, "Page %u: never used", i);
7927179453
}
7927279454
#else
7927379455
/* If the database supports auto-vacuum, make sure no tables contain
7927479456
** references to pointer-map pages.
7927579457
*/
7927679458
if( getPageReferenced(&sCheck, i)==0 &&
7927779459
(PTRMAP_PAGENO(pBt, i)!=i || !pBt->autoVacuum) ){
79278
- checkAppendMsg(&sCheck, "Page %d is never used", i);
79460
+ checkAppendMsg(&sCheck, "Page %u: never used", i);
7927979461
}
7928079462
if( getPageReferenced(&sCheck, i)!=0 &&
7928179463
(PTRMAP_PAGENO(pBt, i)==i && pBt->autoVacuum) ){
79282
- checkAppendMsg(&sCheck, "Pointer map page %d is referenced", i);
79464
+ checkAppendMsg(&sCheck, "Page %u: pointer map referenced", i);
7928379465
}
7928479466
#endif
7928579467
}
7928679468
}
7928779469
@@ -81889,20 +82071,15 @@
8188982071
rc = ctx.isError;
8189082072
sqlite3ErrorMsg(pCtx->pParse, "%s", sqlite3_value_text(pVal));
8189182073
}else{
8189282074
sqlite3ValueApplyAffinity(pVal, aff, SQLITE_UTF8);
8189382075
assert( rc==SQLITE_OK );
81894
- assert( enc==pVal->enc
81895
- || (pVal->flags & MEM_Str)==0
81896
- || db->mallocFailed );
81897
-#if 0 /* Not reachable except after a prior failure */
8189882076
rc = sqlite3VdbeChangeEncoding(pVal, enc);
81899
- if( rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal) ){
82077
+ if( NEVER(rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal)) ){
8190082078
rc = SQLITE_TOOBIG;
8190182079
pCtx->pParse->nErr++;
8190282080
}
81903
-#endif
8190482081
}
8190582082
8190682083
value_from_function_out:
8190782084
if( rc!=SQLITE_OK ){
8190882085
pVal = 0;
@@ -81962,10 +82139,17 @@
8196282139
assert( !ExprHasProperty(pExpr, EP_IntValue) );
8196382140
aff = sqlite3AffinityType(pExpr->u.zToken,0);
8196482141
rc = valueFromExpr(db, pExpr->pLeft, enc, aff, ppVal, pCtx);
8196582142
testcase( rc!=SQLITE_OK );
8196682143
if( *ppVal ){
82144
+#ifdef SQLITE_ENABLE_STAT4
82145
+ rc = ExpandBlob(*ppVal);
82146
+#else
82147
+ /* zero-blobs only come from functions, not literal values. And
82148
+ ** functions are only processed under STAT4 */
82149
+ assert( (ppVal[0][0].flags & MEM_Zero)==0 );
82150
+#endif
8196782151
sqlite3VdbeMemCast(*ppVal, aff, enc);
8196882152
sqlite3ValueApplyAffinity(*ppVal, affinity, enc);
8196982153
}
8197082154
return rc;
8197182155
}
@@ -82808,14 +82992,14 @@
8280882992
** If the bPush flag is true, then make this opcode the parent for
8280982993
** subsequent Explains until sqlite3VdbeExplainPop() is called.
8281082994
*/
8281182995
SQLITE_PRIVATE int sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){
8281282996
int addr = 0;
82813
-#if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
82997
+#if !defined(SQLITE_DEBUG)
8281482998
/* Always include the OP_Explain opcodes if SQLITE_DEBUG is defined.
8281582999
** But omit them (for performance) during production builds */
82816
- if( pParse->explain==2 )
83000
+ if( pParse->explain==2 || IS_STMT_SCANSTATUS(pParse->db) )
8281783001
#endif
8281883002
{
8281983003
char *zMsg;
8282083004
Vdbe *v;
8282183005
va_list ap;
@@ -83487,22 +83671,24 @@
8348783671
int addrLoop, /* Address of loop counter */
8348883672
int addrVisit, /* Address of rows visited counter */
8348983673
LogEst nEst, /* Estimated number of output rows */
8349083674
const char *zName /* Name of table or index being scanned */
8349183675
){
83492
- sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus);
83493
- ScanStatus *aNew;
83494
- aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
83495
- if( aNew ){
83496
- ScanStatus *pNew = &aNew[p->nScan++];
83497
- memset(pNew, 0, sizeof(ScanStatus));
83498
- pNew->addrExplain = addrExplain;
83499
- pNew->addrLoop = addrLoop;
83500
- pNew->addrVisit = addrVisit;
83501
- pNew->nEst = nEst;
83502
- pNew->zName = sqlite3DbStrDup(p->db, zName);
83503
- p->aScan = aNew;
83676
+ if( IS_STMT_SCANSTATUS(p->db) ){
83677
+ sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus);
83678
+ ScanStatus *aNew;
83679
+ aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
83680
+ if( aNew ){
83681
+ ScanStatus *pNew = &aNew[p->nScan++];
83682
+ memset(pNew, 0, sizeof(ScanStatus));
83683
+ pNew->addrExplain = addrExplain;
83684
+ pNew->addrLoop = addrLoop;
83685
+ pNew->addrVisit = addrVisit;
83686
+ pNew->nEst = nEst;
83687
+ pNew->zName = sqlite3DbStrDup(p->db, zName);
83688
+ p->aScan = aNew;
83689
+ }
8350483690
}
8350583691
}
8350683692
8350783693
/*
8350883694
** Add the range of instructions from addrStart to addrEnd (inclusive) to
@@ -83515,24 +83701,26 @@
8351583701
Vdbe *p,
8351683702
int addrExplain,
8351783703
int addrStart,
8351883704
int addrEnd
8351983705
){
83520
- ScanStatus *pScan = 0;
83521
- int ii;
83522
- for(ii=p->nScan-1; ii>=0; ii--){
83523
- pScan = &p->aScan[ii];
83524
- if( pScan->addrExplain==addrExplain ) break;
83525
- pScan = 0;
83526
- }
83527
- if( pScan ){
83528
- if( addrEnd<0 ) addrEnd = sqlite3VdbeCurrentAddr(p)-1;
83529
- for(ii=0; ii<ArraySize(pScan->aAddrRange); ii+=2){
83530
- if( pScan->aAddrRange[ii]==0 ){
83531
- pScan->aAddrRange[ii] = addrStart;
83532
- pScan->aAddrRange[ii+1] = addrEnd;
83533
- break;
83706
+ if( IS_STMT_SCANSTATUS(p->db) ){
83707
+ ScanStatus *pScan = 0;
83708
+ int ii;
83709
+ for(ii=p->nScan-1; ii>=0; ii--){
83710
+ pScan = &p->aScan[ii];
83711
+ if( pScan->addrExplain==addrExplain ) break;
83712
+ pScan = 0;
83713
+ }
83714
+ if( pScan ){
83715
+ if( addrEnd<0 ) addrEnd = sqlite3VdbeCurrentAddr(p)-1;
83716
+ for(ii=0; ii<ArraySize(pScan->aAddrRange); ii+=2){
83717
+ if( pScan->aAddrRange[ii]==0 ){
83718
+ pScan->aAddrRange[ii] = addrStart;
83719
+ pScan->aAddrRange[ii+1] = addrEnd;
83720
+ break;
83721
+ }
8353483722
}
8353583723
}
8353683724
}
8353783725
}
8353883726
@@ -83545,23 +83733,25 @@
8354583733
Vdbe *p,
8354683734
int addrExplain,
8354783735
int addrLoop,
8354883736
int addrVisit
8354983737
){
83550
- ScanStatus *pScan = 0;
83551
- int ii;
83552
- for(ii=p->nScan-1; ii>=0; ii--){
83553
- pScan = &p->aScan[ii];
83554
- if( pScan->addrExplain==addrExplain ) break;
83555
- pScan = 0;
83556
- }
83557
- if( pScan ){
83558
- pScan->addrLoop = addrLoop;
83559
- pScan->addrVisit = addrVisit;
83738
+ if( IS_STMT_SCANSTATUS(p->db) ){
83739
+ ScanStatus *pScan = 0;
83740
+ int ii;
83741
+ for(ii=p->nScan-1; ii>=0; ii--){
83742
+ pScan = &p->aScan[ii];
83743
+ if( pScan->addrExplain==addrExplain ) break;
83744
+ pScan = 0;
83745
+ }
83746
+ if( pScan ){
83747
+ pScan->addrLoop = addrLoop;
83748
+ pScan->addrVisit = addrVisit;
83749
+ }
8356083750
}
8356183751
}
83562
-#endif
83752
+#endif /* defined(SQLITE_ENABLE_STMT_SCANSTATUS) */
8356383753
8356483754
8356583755
/*
8356683756
** Change the value of the opcode, or P1, P2, P3, or P5 operands
8356783757
** for a specific instruction.
@@ -86003,13 +86193,13 @@
8600386193
vdbeFreeOpArray(db, p->aOp, p->nOp);
8600486194
if( p->zSql ) sqlite3DbNNFreeNN(db, p->zSql);
8600586195
#ifdef SQLITE_ENABLE_NORMALIZE
8600686196
sqlite3DbFree(db, p->zNormSql);
8600786197
{
86008
- DblquoteStr *pThis, *pNext;
86009
- for(pThis=p->pDblStr; pThis; pThis=pNext){
86010
- pNext = pThis->pNextStr;
86198
+ DblquoteStr *pThis, *pNxt;
86199
+ for(pThis=p->pDblStr; pThis; pThis=pNxt){
86200
+ pNxt = pThis->pNextStr;
8601186201
sqlite3DbFree(db, pThis);
8601286202
}
8601386203
}
8601486204
#endif
8601586205
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
@@ -89885,19 +90075,28 @@
8988590075
int iScanStatusOp, /* Which metric to return */
8988690076
int flags,
8988790077
void *pOut /* OUT: Write the answer here */
8988890078
){
8988990079
Vdbe *p = (Vdbe*)pStmt;
89890
- ScanStatus *pScan;
90080
+ VdbeOp *aOp = p->aOp;
90081
+ int nOp = p->nOp;
90082
+ ScanStatus *pScan = 0;
8989190083
int idx;
90084
+
90085
+ if( p->pFrame ){
90086
+ VdbeFrame *pFrame;
90087
+ for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent);
90088
+ aOp = pFrame->aOp;
90089
+ nOp = pFrame->nOp;
90090
+ }
8989290091
8989390092
if( iScan<0 ){
8989490093
int ii;
8989590094
if( iScanStatusOp==SQLITE_SCANSTAT_NCYCLE ){
8989690095
i64 res = 0;
89897
- for(ii=0; ii<p->nOp; ii++){
89898
- res += p->aOp[ii].nCycle;
90096
+ for(ii=0; ii<nOp; ii++){
90097
+ res += aOp[ii].nCycle;
8989990098
}
8990090099
*(i64*)pOut = res;
8990190100
return 0;
8990290101
}
8990390102
return 1;
@@ -89919,19 +90118,19 @@
8991990118
if( idx>=p->nScan ) return 1;
8992090119
8992190120
switch( iScanStatusOp ){
8992290121
case SQLITE_SCANSTAT_NLOOP: {
8992390122
if( pScan->addrLoop>0 ){
89924
- *(sqlite3_int64*)pOut = p->aOp[pScan->addrLoop].nExec;
90123
+ *(sqlite3_int64*)pOut = aOp[pScan->addrLoop].nExec;
8992590124
}else{
8992690125
*(sqlite3_int64*)pOut = -1;
8992790126
}
8992890127
break;
8992990128
}
8993090129
case SQLITE_SCANSTAT_NVISIT: {
8993190130
if( pScan->addrVisit>0 ){
89932
- *(sqlite3_int64*)pOut = p->aOp[pScan->addrVisit].nExec;
90131
+ *(sqlite3_int64*)pOut = aOp[pScan->addrVisit].nExec;
8993390132
}else{
8993490133
*(sqlite3_int64*)pOut = -1;
8993590134
}
8993690135
break;
8993790136
}
@@ -89949,27 +90148,27 @@
8994990148
*(const char**)pOut = pScan->zName;
8995090149
break;
8995190150
}
8995290151
case SQLITE_SCANSTAT_EXPLAIN: {
8995390152
if( pScan->addrExplain ){
89954
- *(const char**)pOut = p->aOp[ pScan->addrExplain ].p4.z;
90153
+ *(const char**)pOut = aOp[ pScan->addrExplain ].p4.z;
8995590154
}else{
8995690155
*(const char**)pOut = 0;
8995790156
}
8995890157
break;
8995990158
}
8996090159
case SQLITE_SCANSTAT_SELECTID: {
8996190160
if( pScan->addrExplain ){
89962
- *(int*)pOut = p->aOp[ pScan->addrExplain ].p1;
90161
+ *(int*)pOut = aOp[ pScan->addrExplain ].p1;
8996390162
}else{
8996490163
*(int*)pOut = -1;
8996590164
}
8996690165
break;
8996790166
}
8996890167
case SQLITE_SCANSTAT_PARENTID: {
8996990168
if( pScan->addrExplain ){
89970
- *(int*)pOut = p->aOp[ pScan->addrExplain ].p2;
90169
+ *(int*)pOut = aOp[ pScan->addrExplain ].p2;
8997190170
}else{
8997290171
*(int*)pOut = -1;
8997390172
}
8997490173
break;
8997590174
}
@@ -89983,22 +90182,22 @@
8998390182
int iIns = pScan->aAddrRange[ii];
8998490183
int iEnd = pScan->aAddrRange[ii+1];
8998590184
if( iIns==0 ) break;
8998690185
if( iIns>0 ){
8998790186
while( iIns<=iEnd ){
89988
- res += p->aOp[iIns].nCycle;
90187
+ res += aOp[iIns].nCycle;
8998990188
iIns++;
8999090189
}
8999190190
}else{
8999290191
int iOp;
89993
- for(iOp=0; iOp<p->nOp; iOp++){
89994
- Op *pOp = &p->aOp[iOp];
90192
+ for(iOp=0; iOp<nOp; iOp++){
90193
+ Op *pOp = &aOp[iOp];
8999590194
if( pOp->p1!=iEnd ) continue;
8999690195
if( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_NCYCLE)==0 ){
8999790196
continue;
8999890197
}
89999
- res += p->aOp[iOp].nCycle;
90198
+ res += aOp[iOp].nCycle;
9000090199
}
9000190200
}
9000290201
}
9000390202
}
9000490203
*(i64*)pOut = res;
@@ -90917,11 +91116,14 @@
9091791116
if( p->flags & (MEM_Int|MEM_IntReal) ){
9091891117
h += p->u.i;
9091991118
}else if( p->flags & MEM_Real ){
9092091119
h += sqlite3VdbeIntValue(p);
9092191120
}else if( p->flags & (MEM_Str|MEM_Blob) ){
90922
- /* no-op */
91121
+ /* All strings have the same hash and all blobs have the same hash,
91122
+ ** though, at least, those hashes are different from each other and
91123
+ ** from NULL. */
91124
+ h += 4093 + (p->flags & (MEM_Str|MEM_Blob));
9092391125
}
9092491126
}
9092591127
return h;
9092691128
}
9092791129
@@ -90967,10 +91169,11 @@
9096791169
Mem *pIn2 = 0; /* 2nd input operand */
9096891170
Mem *pIn3 = 0; /* 3rd input operand */
9096991171
Mem *pOut = 0; /* Output operand */
9097091172
#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE)
9097191173
u64 *pnCycle = 0;
91174
+ int bStmtScanStatus = IS_STMT_SCANSTATUS(db)!=0;
9097291175
#endif
9097391176
/*** INSERT STACK UNION HERE ***/
9097491177
9097591178
assert( p->eVdbeState==VDBE_RUN_STATE ); /* sqlite3_step() verifies this */
9097691179
if( DbMaskNonZero(p->lockMask) ){
@@ -91031,17 +91234,21 @@
9103191234
** jumps to abort_due_to_error. */
9103291235
assert( rc==SQLITE_OK );
9103391236
9103491237
assert( pOp>=aOp && pOp<&aOp[p->nOp]);
9103591238
nVmStep++;
91036
-#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE)
91239
+
91240
+#if defined(VDBE_PROFILE)
9103791241
pOp->nExec++;
9103891242
pnCycle = &pOp->nCycle;
91039
-# ifdef VDBE_PROFILE
91040
- if( sqlite3NProfileCnt==0 )
91041
-# endif
91243
+ if( sqlite3NProfileCnt==0 ) *pnCycle -= sqlite3Hwtime();
91244
+#elif defined(SQLITE_ENABLE_STMT_SCANSTATUS)
91245
+ if( bStmtScanStatus ){
91246
+ pOp->nExec++;
91247
+ pnCycle = &pOp->nCycle;
9104291248
*pnCycle -= sqlite3Hwtime();
91249
+ }
9104391250
#endif
9104491251
9104591252
/* Only allow tracing if SQLITE_DEBUG is defined.
9104691253
*/
9104791254
#ifdef SQLITE_DEBUG
@@ -92851,10 +93058,16 @@
9285193058
** from the value in that register.
9285293059
**
9285393060
** P5 is a bitmask of data types. SQLITE_INTEGER is the least significant
9285493061
** (0x01) bit. SQLITE_FLOAT is the 0x02 bit. SQLITE_TEXT is 0x04.
9285593062
** SQLITE_BLOB is 0x08. SQLITE_NULL is 0x10.
93063
+**
93064
+** WARNING: This opcode does not reliably distinguish between NULL and REAL
93065
+** when P1>=0. If the database contains a NaN value, this opcode will think
93066
+** that the datatype is REAL when it should be NULL. When P1<0 and the value
93067
+** is already stored in register P3, then this opcode does reliably
93068
+** distinguish between NULL and REAL. The problem only arises then P1>=0.
9285693069
**
9285793070
** Take the jump to address P2 if and only if the datatype of the
9285893071
** value determined by P1 and P3 corresponds to one of the bits in the
9285993072
** P5 bitmask.
9286093073
**
@@ -95199,10 +95412,11 @@
9519995412
#endif
9520095413
VdbeBranchTaken(0,3);
9520195414
break;
9520295415
}
9520395416
nStep--;
95417
+ pC->cacheStatus = CACHE_STALE;
9520495418
rc = sqlite3BtreeNext(pC->uc.pCursor, 0);
9520595419
if( rc ){
9520695420
if( rc==SQLITE_DONE ){
9520795421
rc = SQLITE_OK;
9520895422
goto seekscan_search_fail;
@@ -97851,10 +98065,11 @@
9785198065
sqlite3VdbeError(p, "%s", sqlite3_value_text(pMem));
9785298066
goto abort_due_to_error;
9785398067
}
9785498068
sqlite3VdbeChangeEncoding(pMem, encoding);
9785598069
UPDATE_MAX_BLOBSIZE(pMem);
98070
+ REGISTER_TRACE((int)(pMem-aMem), pMem);
9785698071
break;
9785798072
}
9785898073
9785998074
#ifndef SQLITE_OMIT_WAL
9786098075
/* Opcode: Checkpoint P1 P2 P3 * *
@@ -98989,12 +99204,14 @@
9898999204
9899099205
#if defined(VDBE_PROFILE)
9899199206
*pnCycle += sqlite3NProfileCnt ? sqlite3NProfileCnt : sqlite3Hwtime();
9899299207
pnCycle = 0;
9899399208
#elif defined(SQLITE_ENABLE_STMT_SCANSTATUS)
98994
- *pnCycle += sqlite3Hwtime();
98995
- pnCycle = 0;
99209
+ if( pnCycle ){
99210
+ *pnCycle += sqlite3Hwtime();
99211
+ pnCycle = 0;
99212
+ }
9899699213
#endif
9899799214
9899899215
/* The following code adds nothing to the actual functionality
9899999216
** of the program. It is only here for testing and debugging.
9900099217
** On the other hand, it does burn CPU cycles every time through
@@ -104016,11 +104233,12 @@
104016104233
if( pParse->pTriggerTab!=0 ){
104017104234
int op = pParse->eTriggerOp;
104018104235
assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
104019104236
if( pParse->bReturning ){
104020104237
if( (pNC->ncFlags & NC_UBaseReg)!=0
104021
- && (zTab==0 || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0)
104238
+ && ALWAYS(zTab==0
104239
+ || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0)
104022104240
){
104023104241
pExpr->iTable = op!=TK_DELETE;
104024104242
pTab = pParse->pTriggerTab;
104025104243
}
104026104244
}else if( op!=TK_DELETE && zTab && sqlite3StrICmp("new",zTab) == 0 ){
@@ -108362,11 +108580,11 @@
108362108580
108363108581
/*
108364108582
** pX is the RHS of an IN operator. If pX is a SELECT statement
108365108583
** that can be simplified to a direct table access, then return
108366108584
** a pointer to the SELECT statement. If pX is not a SELECT statement,
108367
-** or if the SELECT statement needs to be manifested into a transient
108585
+** or if the SELECT statement needs to be materialized into a transient
108368108586
** table, then return NULL.
108369108587
*/
108370108588
#ifndef SQLITE_OMIT_SUBQUERY
108371108589
static Select *isCandidateForInOpt(const Expr *pX){
108372108590
Select *p;
@@ -109551,10 +109769,11 @@
109551109769
Column *pCol, /* The generated column */
109552109770
int regOut /* Put the result in this register */
109553109771
){
109554109772
int iAddr;
109555109773
Vdbe *v = pParse->pVdbe;
109774
+ int nErr = pParse->nErr;
109556109775
assert( v!=0 );
109557109776
assert( pParse->iSelfTab!=0 );
109558109777
if( pParse->iSelfTab>0 ){
109559109778
iAddr = sqlite3VdbeAddOp3(v, OP_IfNullRow, pParse->iSelfTab-1, 0, regOut);
109560109779
}else{
@@ -109563,10 +109782,11 @@
109563109782
sqlite3ExprCodeCopy(pParse, sqlite3ColumnExpr(pTab,pCol), regOut);
109564109783
if( pCol->affinity>=SQLITE_AFF_TEXT ){
109565109784
sqlite3VdbeAddOp4(v, OP_Affinity, regOut, 1, 0, &pCol->affinity, 1);
109566109785
}
109567109786
if( iAddr ) sqlite3VdbeJumpHere(v, iAddr);
109787
+ if( pParse->nErr>nErr ) pParse->db->errByteOffset = -1;
109568109788
}
109569109789
#endif /* SQLITE_OMIT_GENERATED_COLUMNS */
109570109790
109571109791
/*
109572109792
** Generate code to extract the value of the iCol-th column of a table.
@@ -109932,11 +110152,23 @@
109932110152
switch( op ){
109933110153
case TK_AGG_COLUMN: {
109934110154
AggInfo *pAggInfo = pExpr->pAggInfo;
109935110155
struct AggInfo_col *pCol;
109936110156
assert( pAggInfo!=0 );
109937
- assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
110157
+ assert( pExpr->iAgg>=0 );
110158
+ if( pExpr->iAgg>=pAggInfo->nColumn ){
110159
+ /* Happens when the left table of a RIGHT JOIN is null and
110160
+ ** is using an expression index */
110161
+ sqlite3VdbeAddOp2(v, OP_Null, 0, target);
110162
+#ifdef SQLITE_VDBE_COVERAGE
110163
+ /* Verify that the OP_Null above is exercised by tests
110164
+ ** tag-20230325-2 */
110165
+ sqlite3VdbeAddOp2(v, OP_NotNull, target, 1);
110166
+ VdbeCoverageNeverTaken(v);
110167
+#endif
110168
+ break;
110169
+ }
109938110170
pCol = &pAggInfo->aCol[pExpr->iAgg];
109939110171
if( !pAggInfo->directMode ){
109940110172
return AggInfoColumnReg(pAggInfo, pExpr->iAgg);
109941110173
}else if( pAggInfo->useSortingIdx ){
109942110174
Table *pTab = pCol->pTab;
@@ -110107,15 +110339,12 @@
110107110339
return pExpr->iTable;
110108110340
}
110109110341
#ifndef SQLITE_OMIT_CAST
110110110342
case TK_CAST: {
110111110343
/* Expressions of the form: CAST(pLeft AS token) */
110112
- inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
110113
- if( inReg!=target ){
110114
- sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
110115
- inReg = target;
110116
- }
110344
+ sqlite3ExprCode(pParse, pExpr->pLeft, target);
110345
+ assert( inReg==target );
110117110346
assert( !ExprHasProperty(pExpr, EP_IntValue) );
110118110347
sqlite3VdbeAddOp2(v, OP_Cast, target,
110119110348
sqlite3AffinityType(pExpr->u.zToken, 0));
110120110349
return inReg;
110121110350
}
@@ -110450,17 +110679,13 @@
110450110679
** "SOFT-COLLATE" that is added to constraints that are pushed down
110451110680
** from outer queries into sub-queries by the push-down optimization.
110452110681
** Clear subtypes as subtypes may not cross a subquery boundary.
110453110682
*/
110454110683
assert( pExpr->pLeft );
110455
- inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
110456
- if( inReg!=target ){
110457
- sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
110458
- inReg = target;
110459
- }
110460
- sqlite3VdbeAddOp1(v, OP_ClrSubtype, inReg);
110461
- return inReg;
110684
+ sqlite3ExprCode(pParse, pExpr->pLeft, target);
110685
+ sqlite3VdbeAddOp1(v, OP_ClrSubtype, target);
110686
+ return target;
110462110687
}else{
110463110688
pExpr = pExpr->pLeft;
110464110689
goto expr_code_doover; /* 2018-04-28: Prevent deep recursion. */
110465110690
}
110466110691
}
@@ -110566,16 +110791,13 @@
110566110791
** (1) Temporarily disable factoring of constant expressions
110567110792
** (2) Make sure the computed value really is stored in register
110568110793
** "target" and not someplace else.
110569110794
*/
110570110795
pParse->okConstFactor = 0; /* note (1) above */
110571
- inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
110796
+ sqlite3ExprCode(pParse, pExpr->pLeft, target);
110797
+ assert( target==inReg );
110572110798
pParse->okConstFactor = okConstFactor;
110573
- if( inReg!=target ){ /* note (2) above */
110574
- sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
110575
- inReg = target;
110576
- }
110577110799
sqlite3VdbeJumpHere(v, addrINR);
110578110800
break;
110579110801
}
110580110802
110581110803
/*
@@ -111994,23 +112216,26 @@
111994112216
){
111995112217
AggInfo *pAggInfo = pExpr->pAggInfo;
111996112218
int iAgg = pExpr->iAgg;
111997112219
Parse *pParse = pWalker->pParse;
111998112220
sqlite3 *db = pParse->db;
112221
+ assert( iAgg>=0 );
111999112222
if( pExpr->op!=TK_AGG_FUNCTION ){
112000
- assert( iAgg>=0 && iAgg<pAggInfo->nColumn );
112001
- if( pAggInfo->aCol[iAgg].pCExpr==pExpr ){
112223
+ if( iAgg<pAggInfo->nColumn
112224
+ && pAggInfo->aCol[iAgg].pCExpr==pExpr
112225
+ ){
112002112226
pExpr = sqlite3ExprDup(db, pExpr, 0);
112003112227
if( pExpr ){
112004112228
pAggInfo->aCol[iAgg].pCExpr = pExpr;
112005112229
sqlite3ExprDeferredDelete(pParse, pExpr);
112006112230
}
112007112231
}
112008112232
}else{
112009112233
assert( pExpr->op==TK_AGG_FUNCTION );
112010
- assert( iAgg>=0 && iAgg<pAggInfo->nFunc );
112011
- if( pAggInfo->aFunc[iAgg].pFExpr==pExpr ){
112234
+ if( ALWAYS(iAgg<pAggInfo->nFunc)
112235
+ && pAggInfo->aFunc[iAgg].pFExpr==pExpr
112236
+ ){
112012112237
pExpr = sqlite3ExprDup(db, pExpr, 0);
112013112238
if( pExpr ){
112014112239
pAggInfo->aFunc[iAgg].pFExpr = pExpr;
112015112240
sqlite3ExprDeferredDelete(pParse, pExpr);
112016112241
}
@@ -112157,10 +112382,11 @@
112157112382
if( sqlite3ExprCompare(0, pExpr, pIEpr->pExpr, iDataCur)==0 ) break;
112158112383
}
112159112384
if( pIEpr==0 ) break;
112160112385
if( NEVER(!ExprUseYTab(pExpr)) ) break;
112161112386
if( pExpr->pAggInfo!=0 ) break; /* Already resolved by outer context */
112387
+ if( pParse->nErr ){ return WRC_Abort; }
112162112388
112163112389
/* If we reach this point, it means that expression pExpr can be
112164112390
** translated into a reference to an index column as described by
112165112391
** pIEpr.
112166112392
*/
@@ -112167,10 +112393,13 @@
112167112393
memset(&tmp, 0, sizeof(tmp));
112168112394
tmp.op = TK_AGG_COLUMN;
112169112395
tmp.iTable = pIEpr->iIdxCur;
112170112396
tmp.iColumn = pIEpr->iIdxCol;
112171112397
findOrCreateAggInfoColumn(pParse, pAggInfo, &tmp);
112398
+ if( pParse->nErr ){ return WRC_Abort; }
112399
+ assert( pAggInfo->aCol!=0 );
112400
+ assert( tmp.iAgg<pAggInfo->nColumn );
112172112401
pAggInfo->aCol[tmp.iAgg].pCExpr = pExpr;
112173112402
pExpr->pAggInfo = pAggInfo;
112174112403
pExpr->iAgg = tmp.iAgg;
112175112404
return WRC_Prune;
112176112405
}
@@ -112343,10 +112572,41 @@
112343112572
SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse *pParse){
112344112573
pParse->nTempReg = 0;
112345112574
pParse->nRangeReg = 0;
112346112575
}
112347112576
112577
+/*
112578
+** Make sure sufficient registers have been allocated so that
112579
+** iReg is a valid register number.
112580
+*/
112581
+SQLITE_PRIVATE void sqlite3TouchRegister(Parse *pParse, int iReg){
112582
+ if( pParse->nMem<iReg ) pParse->nMem = iReg;
112583
+}
112584
+
112585
+#if defined(SQLITE_ENABLE_STAT4) || defined(SQLITE_DEBUG)
112586
+/*
112587
+** Return the latest reusable register in the set of all registers.
112588
+** The value returned is no less than iMin. If any register iMin or
112589
+** greater is in permanent use, then return one more than that last
112590
+** permanent register.
112591
+*/
112592
+SQLITE_PRIVATE int sqlite3FirstAvailableRegister(Parse *pParse, int iMin){
112593
+ const ExprList *pList = pParse->pConstExpr;
112594
+ if( pList ){
112595
+ int i;
112596
+ for(i=0; i<pList->nExpr; i++){
112597
+ if( pList->a[i].u.iConstExprReg>=iMin ){
112598
+ iMin = pList->a[i].u.iConstExprReg + 1;
112599
+ }
112600
+ }
112601
+ }
112602
+ pParse->nTempReg = 0;
112603
+ pParse->nRangeReg = 0;
112604
+ return iMin;
112605
+}
112606
+#endif /* SQLITE_ENABLE_STAT4 || SQLITE_DEBUG */
112607
+
112348112608
/*
112349112609
** Validate that no temporary register falls within the range of
112350112610
** iFirst..iLast, inclusive. This routine is only call from within assert()
112351112611
** statements.
112352112612
*/
@@ -112361,10 +112621,18 @@
112361112621
}
112362112622
for(i=0; i<pParse->nTempReg; i++){
112363112623
if( pParse->aTempReg[i]>=iFirst && pParse->aTempReg[i]<=iLast ){
112364112624
return 0;
112365112625
}
112626
+ }
112627
+ if( pParse->pConstExpr ){
112628
+ ExprList *pList = pParse->pConstExpr;
112629
+ for(i=0; i<pList->nExpr; i++){
112630
+ int iReg = pList->a[i].u.iConstExprReg;
112631
+ if( iReg==0 ) continue;
112632
+ if( iReg>=iFirst && iReg<=iLast ) return 0;
112633
+ }
112366112634
}
112367112635
return 1;
112368112636
}
112369112637
#endif /* SQLITE_DEBUG */
112370112638
@@ -115645,15 +115913,19 @@
115645115913
int regTemp2 = iMem++; /* Second temporary use register */
115646115914
int regTabname = iMem++; /* Register containing table name */
115647115915
int regIdxname = iMem++; /* Register containing index name */
115648115916
int regStat1 = iMem++; /* Value for the stat column of sqlite_stat1 */
115649115917
int regPrev = iMem; /* MUST BE LAST (see below) */
115918
+#ifdef SQLITE_ENABLE_STAT4
115919
+ int doOnce = 1; /* Flag for a one-time computation */
115920
+#endif
115650115921
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
115651115922
Table *pStat1 = 0;
115652115923
#endif
115653115924
115654
- pParse->nMem = MAX(pParse->nMem, iMem);
115925
+ sqlite3TouchRegister(pParse, iMem);
115926
+ assert( sqlite3NoTempsInRange(pParse, regNewRowid, iMem) );
115655115927
v = sqlite3GetVdbe(pParse);
115656115928
if( v==0 || NEVER(pTab==0) ){
115657115929
return;
115658115930
}
115659115931
if( !IsOrdinaryTable(pTab) ){
@@ -115755,11 +116027,11 @@
115755116027
115756116028
/* Make sure there are enough memory cells allocated to accommodate
115757116029
** the regPrev array and a trailing rowid (the rowid slot is required
115758116030
** when building a record to insert into the sample column of
115759116031
** the sqlite_stat4 table. */
115760
- pParse->nMem = MAX(pParse->nMem, regPrev+nColTest);
116032
+ sqlite3TouchRegister(pParse, regPrev+nColTest);
115761116033
115762116034
/* Open a read-only cursor on the index being analyzed. */
115763116035
assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );
115764116036
sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb);
115765116037
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
@@ -115927,11 +116199,39 @@
115927116199
int regSampleRowid = regCol + nCol;
115928116200
int addrNext;
115929116201
int addrIsNull;
115930116202
u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
115931116203
115932
- pParse->nMem = MAX(pParse->nMem, regCol+nCol);
116204
+ if( doOnce ){
116205
+ int mxCol = nCol;
116206
+ Index *pX;
116207
+
116208
+ /* Compute the maximum number of columns in any index */
116209
+ for(pX=pTab->pIndex; pX; pX=pX->pNext){
116210
+ int nColX; /* Number of columns in pX */
116211
+ if( !HasRowid(pTab) && IsPrimaryKeyIndex(pX) ){
116212
+ nColX = pX->nKeyCol;
116213
+ }else{
116214
+ nColX = pX->nColumn;
116215
+ }
116216
+ if( nColX>mxCol ) mxCol = nColX;
116217
+ }
116218
+
116219
+ /* Allocate space to compute results for the largest index */
116220
+ sqlite3TouchRegister(pParse, regCol+mxCol);
116221
+ doOnce = 0;
116222
+#ifdef SQLITE_DEBUG
116223
+ /* Verify that the call to sqlite3ClearTempRegCache() below
116224
+ ** really is needed.
116225
+ ** https://sqlite.org/forum/forumpost/83cb4a95a0 (2023-03-25)
116226
+ */
116227
+ testcase( !sqlite3NoTempsInRange(pParse, regEq, regCol+mxCol) );
116228
+#endif
116229
+ sqlite3ClearTempRegCache(pParse); /* tag-20230325-1 */
116230
+ assert( sqlite3NoTempsInRange(pParse, regEq, regCol+mxCol) );
116231
+ }
116232
+ assert( sqlite3NoTempsInRange(pParse, regEq, regCol+nCol) );
115933116233
115934116234
addrNext = sqlite3VdbeCurrentAddr(v);
115935116235
callStatGet(pParse, regStat, STAT_GET_ROWID, regSampleRowid);
115936116236
addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regSampleRowid);
115937116237
VdbeCoverage(v);
@@ -116008,10 +116308,15 @@
116008116308
iTab = pParse->nTab;
116009116309
assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
116010116310
for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
116011116311
Table *pTab = (Table*)sqliteHashData(k);
116012116312
analyzeOneTable(pParse, pTab, 0, iStatCur, iMem, iTab);
116313
+#ifdef SQLITE_ENABLE_STAT4
116314
+ iMem = sqlite3FirstAvailableRegister(pParse, iMem);
116315
+#else
116316
+ assert( iMem==sqlite3FirstAvailableRegister(pParse,iMem) );
116317
+#endif
116013116318
}
116014116319
loadAnalysis(pParse, iDb);
116015116320
}
116016116321
116017116322
/*
@@ -123835,17 +124140,19 @@
123835124140
**
123836124141
** If pTab is not writable -> generate an error message and return 1.
123837124142
** If pTab is writable but other errors have occurred -> return 1.
123838124143
** If pTab is writable and no prior errors -> return 0;
123839124144
*/
123840
-SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){
124145
+SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, Trigger *pTrigger){
123841124146
if( tabIsReadOnly(pParse, pTab) ){
123842124147
sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName);
123843124148
return 1;
123844124149
}
123845124150
#ifndef SQLITE_OMIT_VIEW
123846
- if( !viewOk && IsView(pTab) ){
124151
+ if( IsView(pTab)
124152
+ && (pTrigger==0 || (pTrigger->bReturning && pTrigger->pNext==0))
124153
+ ){
123847124154
sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName);
123848124155
return 1;
123849124156
}
123850124157
#endif
123851124158
return 0;
@@ -124095,11 +124402,11 @@
124095124402
*/
124096124403
if( sqlite3ViewGetColumnNames(pParse, pTab) ){
124097124404
goto delete_from_cleanup;
124098124405
}
124099124406
124100
- if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){
124407
+ if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
124101124408
goto delete_from_cleanup;
124102124409
}
124103124410
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
124104124411
assert( iDb<db->nDb );
124105124412
rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0,
@@ -128792,49 +129099,51 @@
128792129099
**
128793129100
** Memory for the buffer containing the column index affinity string
128794129101
** is managed along with the rest of the Index structure. It will be
128795129102
** released when sqlite3DeleteIndex() is called.
128796129103
*/
128797
-SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){
128798
- if( !pIdx->zColAff ){
128799
- /* The first time a column affinity string for a particular index is
128800
- ** required, it is allocated and populated here. It is then stored as
128801
- ** a member of the Index structure for subsequent use.
128802
- **
128803
- ** The column affinity string will eventually be deleted by
128804
- ** sqliteDeleteIndex() when the Index structure itself is cleaned
128805
- ** up.
128806
- */
128807
- int n;
128808
- Table *pTab = pIdx->pTable;
128809
- pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1);
128810
- if( !pIdx->zColAff ){
128811
- sqlite3OomFault(db);
128812
- return 0;
128813
- }
128814
- for(n=0; n<pIdx->nColumn; n++){
128815
- i16 x = pIdx->aiColumn[n];
128816
- char aff;
128817
- if( x>=0 ){
128818
- aff = pTab->aCol[x].affinity;
128819
- }else if( x==XN_ROWID ){
128820
- aff = SQLITE_AFF_INTEGER;
128821
- }else{
128822
- assert( x==XN_EXPR );
128823
- assert( pIdx->bHasExpr );
128824
- assert( pIdx->aColExpr!=0 );
128825
- aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr);
128826
- }
128827
- if( aff<SQLITE_AFF_BLOB ) aff = SQLITE_AFF_BLOB;
128828
- if( aff>SQLITE_AFF_NUMERIC) aff = SQLITE_AFF_NUMERIC;
128829
- pIdx->zColAff[n] = aff;
128830
- }
128831
- pIdx->zColAff[n] = 0;
128832
- }
128833
-
129104
+static SQLITE_NOINLINE const char *computeIndexAffStr(sqlite3 *db, Index *pIdx){
129105
+ /* The first time a column affinity string for a particular index is
129106
+ ** required, it is allocated and populated here. It is then stored as
129107
+ ** a member of the Index structure for subsequent use.
129108
+ **
129109
+ ** The column affinity string will eventually be deleted by
129110
+ ** sqliteDeleteIndex() when the Index structure itself is cleaned
129111
+ ** up.
129112
+ */
129113
+ int n;
129114
+ Table *pTab = pIdx->pTable;
129115
+ pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1);
129116
+ if( !pIdx->zColAff ){
129117
+ sqlite3OomFault(db);
129118
+ return 0;
129119
+ }
129120
+ for(n=0; n<pIdx->nColumn; n++){
129121
+ i16 x = pIdx->aiColumn[n];
129122
+ char aff;
129123
+ if( x>=0 ){
129124
+ aff = pTab->aCol[x].affinity;
129125
+ }else if( x==XN_ROWID ){
129126
+ aff = SQLITE_AFF_INTEGER;
129127
+ }else{
129128
+ assert( x==XN_EXPR );
129129
+ assert( pIdx->bHasExpr );
129130
+ assert( pIdx->aColExpr!=0 );
129131
+ aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr);
129132
+ }
129133
+ if( aff<SQLITE_AFF_BLOB ) aff = SQLITE_AFF_BLOB;
129134
+ if( aff>SQLITE_AFF_NUMERIC) aff = SQLITE_AFF_NUMERIC;
129135
+ pIdx->zColAff[n] = aff;
129136
+ }
129137
+ pIdx->zColAff[n] = 0;
129138
+ return pIdx->zColAff;
129139
+}
129140
+SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){
129141
+ if( !pIdx->zColAff ) return computeIndexAffStr(db, pIdx);
128834129142
return pIdx->zColAff;
128835129143
}
129144
+
128836129145
128837129146
/*
128838129147
** Compute an affinity string for a table. Space is obtained
128839129148
** from sqlite3DbMalloc(). The caller is responsible for freeing
128840129149
** the space when done.
@@ -129516,11 +129825,11 @@
129516129825
goto insert_cleanup;
129517129826
}
129518129827
129519129828
/* Cannot insert into a read-only table.
129520129829
*/
129521
- if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
129830
+ if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
129522129831
goto insert_cleanup;
129523129832
}
129524129833
129525129834
/* Allocate a VDBE
129526129835
*/
@@ -129963,11 +130272,11 @@
129963130272
sqlite3VdbeJumpHere(v, addr1);
129964130273
sqlite3VdbeAddOp1(v, OP_MustBeInt, regCols); VdbeCoverage(v);
129965130274
}
129966130275
129967130276
/* Copy the new data already generated. */
129968
- assert( pTab->nNVCol>0 );
130277
+ assert( pTab->nNVCol>0 || pParse->nErr>0 );
129969130278
sqlite3VdbeAddOp3(v, OP_Copy, regRowid+1, regCols+1, pTab->nNVCol-1);
129970130279
129971130280
#ifndef SQLITE_OMIT_GENERATED_COLUMNS
129972130281
/* Compute the new value for generated columns after all other
129973130282
** columns have already been computed. This must be done after
@@ -133326,19 +133635,25 @@
133326133635
zEntry = zProc ? zProc : "sqlite3_extension_init";
133327133636
133328133637
/* tag-20210611-1. Some dlopen() implementations will segfault if given
133329133638
** an oversize filename. Most filesystems have a pathname limit of 4K,
133330133639
** so limit the extension filename length to about twice that.
133331
- ** https://sqlite.org/forum/forumpost/08a0d6d9bf */
133640
+ ** https://sqlite.org/forum/forumpost/08a0d6d9bf
133641
+ **
133642
+ ** Later (2023-03-25): Save an extra 6 bytes for the filename suffix.
133643
+ ** See https://sqlite.org/forum/forumpost/24083b579d.
133644
+ */
133332133645
if( nMsg>SQLITE_MAX_PATHLEN ) goto extension_not_found;
133333133646
133334133647
handle = sqlite3OsDlOpen(pVfs, zFile);
133335133648
#if SQLITE_OS_UNIX || SQLITE_OS_WIN
133336133649
for(ii=0; ii<ArraySize(azEndings) && handle==0; ii++){
133337133650
char *zAltFile = sqlite3_mprintf("%s.%s", zFile, azEndings[ii]);
133338133651
if( zAltFile==0 ) return SQLITE_NOMEM_BKPT;
133339
- handle = sqlite3OsDlOpen(pVfs, zAltFile);
133652
+ if( nMsg+strlen(azEndings[ii])+1<=SQLITE_MAX_PATHLEN ){
133653
+ handle = sqlite3OsDlOpen(pVfs, zAltFile);
133654
+ }
133340133655
sqlite3_free(zAltFile);
133341133656
}
133342133657
#endif
133343133658
if( handle==0 ) goto extension_not_found;
133344133659
xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry);
@@ -135829,11 +136144,11 @@
135829136144
if( pTab==0 || !IsOrdinaryTable(pTab) || pTab->u.tab.pFKey==0 ) continue;
135830136145
iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
135831136146
zDb = db->aDb[iDb].zDbSName;
135832136147
sqlite3CodeVerifySchema(pParse, iDb);
135833136148
sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
135834
- if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow;
136149
+ sqlite3TouchRegister(pParse, pTab->nCol+regRow);
135835136150
sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead);
135836136151
sqlite3VdbeLoadString(v, regResult, pTab->zName);
135837136152
assert( IsOrdinaryTable(pTab) );
135838136153
for(i=1, pFK=pTab->u.tab.pFKey; pFK; i++, pFK=pFK->pNextFrom){
135839136154
pParent = sqlite3FindTable(db, pFK->zTo, zDb);
@@ -135870,11 +136185,11 @@
135870136185
135871136186
/* Generate code to read the child key values into registers
135872136187
** regRow..regRow+n. If any of the child key values are NULL, this
135873136188
** row cannot cause an FK violation. Jump directly to addrOk in
135874136189
** this case. */
135875
- if( regRow+pFK->nCol>pParse->nMem ) pParse->nMem = regRow+pFK->nCol;
136190
+ sqlite3TouchRegister(pParse, regRow + pFK->nCol);
135876136191
for(j=0; j<pFK->nCol; j++){
135877136192
int iCol = aiCols ? aiCols[j] : pFK->aCol[j].iFrom;
135878136193
sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, iCol, regRow+j);
135879136194
sqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk); VdbeCoverage(v);
135880136195
}
@@ -135999,10 +136314,11 @@
135999136314
136000136315
if( OMIT_TEMPDB && i==1 ) continue;
136001136316
if( iDb>=0 && i!=iDb ) continue;
136002136317
136003136318
sqlite3CodeVerifySchema(pParse, i);
136319
+ pParse->okConstFactor = 0; /* tag-20230327-1 */
136004136320
136005136321
/* Do an integrity check of the B-Tree
136006136322
**
136007136323
** Begin by finding the root pages numbers
136008136324
** for all tables and indices in the database.
@@ -136034,11 +136350,11 @@
136034136350
}
136035136351
}
136036136352
aRoot[0] = cnt;
136037136353
136038136354
/* Make sure sufficient number of registers have been allocated */
136039
- pParse->nMem = MAX( pParse->nMem, 8+mxIdx );
136355
+ sqlite3TouchRegister(pParse, 8+mxIdx);
136040136356
sqlite3ClearTempRegCache(pParse);
136041136357
136042136358
/* Do the b-tree integrity checks */
136043136359
sqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY);
136044136360
sqlite3VdbeChangeP5(v, (u8)i);
@@ -136184,19 +136500,33 @@
136184136500
136185136501
labelError = sqlite3VdbeMakeLabel(pParse);
136186136502
labelOk = sqlite3VdbeMakeLabel(pParse);
136187136503
if( pCol->notNull ){
136188136504
/* (1) NOT NULL columns may not contain a NULL */
136505
+ int jmp3;
136189136506
int jmp2 = sqlite3VdbeAddOp4Int(v, OP_IsType, p1, labelOk, p3, p4);
136190
- sqlite3VdbeChangeP5(v, 0x0f);
136191136507
VdbeCoverage(v);
136508
+ if( p1<0 ){
136509
+ sqlite3VdbeChangeP5(v, 0x0f); /* INT, REAL, TEXT, or BLOB */
136510
+ jmp3 = jmp2;
136511
+ }else{
136512
+ sqlite3VdbeChangeP5(v, 0x0d); /* INT, TEXT, or BLOB */
136513
+ /* OP_IsType does not detect NaN values in the database file
136514
+ ** which should be treated as a NULL. So if the header type
136515
+ ** is REAL, we have to load the actual data using OP_Column
136516
+ ** to reliably determine if the value is a NULL. */
136517
+ sqlite3VdbeAddOp3(v, OP_Column, p1, p3, 3);
136518
+ jmp3 = sqlite3VdbeAddOp2(v, OP_NotNull, 3, labelOk);
136519
+ VdbeCoverage(v);
136520
+ }
136192136521
zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
136193136522
pCol->zCnName);
136194136523
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
136195136524
if( doTypeCheck ){
136196136525
sqlite3VdbeGoto(v, labelError);
136197136526
sqlite3VdbeJumpHere(v, jmp2);
136527
+ sqlite3VdbeJumpHere(v, jmp3);
136198136528
}else{
136199136529
/* VDBE byte code will fall thru */
136200136530
}
136201136531
}
136202136532
if( bStrict && doTypeCheck ){
@@ -136300,11 +136630,11 @@
136300136630
** any extra bytes at the end. Verify that this is the case. */
136301136631
if( HasRowid(pTab) ){
136302136632
int jmp7;
136303136633
sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur+j, 3);
136304136634
jmp7 = sqlite3VdbeAddOp3(v, OP_Eq, 3, 0, r1+pIdx->nColumn-1);
136305
- VdbeCoverage(v);
136635
+ VdbeCoverageNeverNull(v);
136306136636
sqlite3VdbeLoadString(v, 3,
136307136637
"rowid not at end-of-record for row ");
136308136638
sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3);
136309136639
sqlite3VdbeLoadString(v, 4, " of index ");
136310136640
sqlite3VdbeGoto(v, jmp5-1);
@@ -142513,12 +142843,11 @@
142513142843
** (17f) the subquery must not be the RHS of a LEFT JOIN.
142514142844
** (17g) either the subquery is the first element of the outer
142515142845
** query or there are no RIGHT or FULL JOINs in any arm
142516142846
** of the subquery. (This is a duplicate of condition (27b).)
142517142847
** (17h) The corresponding result set expressions in all arms of the
142518
-** compound must have the same affinity. (See restriction (9)
142519
-** on the push-down optimization.)
142848
+** compound must have the same affinity.
142520142849
**
142521142850
** The parent and sub-query may contain WHERE clauses. Subject to
142522142851
** rules (11), (13) and (14), they may also contain ORDER BY,
142523142852
** LIMIT and OFFSET clauses. The subquery cannot use any compound
142524142853
** operator other than UNION ALL because all the other compound
@@ -143382,14 +143711,10 @@
143382143711
**
143383143712
** (8) If the subquery is a compound that uses UNION, INTERSECT,
143384143713
** or EXCEPT, then all of the result set columns for all arms of
143385143714
** the compound must use the BINARY collating sequence.
143386143715
**
143387
-** (9) If the subquery is a compound, then all arms of the compound must
143388
-** have the same affinity. (This is the same as restriction (17h)
143389
-** for query flattening.)
143390
-**
143391143716
**
143392143717
** Return 0 if no changes are made and non-zero if one or more WHERE clause
143393143718
** terms are duplicated into the subquery.
143394143719
*/
143395143720
static int pushDownWhereTerms(
@@ -143416,13 +143741,10 @@
143416143741
}
143417143742
#ifndef SQLITE_OMIT_WINDOWFUNC
143418143743
if( pSel->pWin ) return 0; /* restriction (6b) */
143419143744
#endif
143420143745
}
143421
- if( compoundHasDifferentAffinities(pSubq) ){
143422
- return 0; /* restriction (9) */
143423
- }
143424143746
if( notUnionAll ){
143425143747
/* If any of the compound arms are connected using UNION, INTERSECT,
143426143748
** or EXCEPT, then we must ensure that none of the columns use a
143427143749
** non-BINARY collating sequence. */
143428143750
for(pSel=pSubq; pSel; pSel=pSel->pPrior){
@@ -143509,10 +143831,80 @@
143509143831
}
143510143832
}
143511143833
return nChng;
143512143834
}
143513143835
#endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
143836
+
143837
+/*
143838
+** Check to see if a subquery contains result-set columns that are
143839
+** never used. If it does, change the value of those result-set columns
143840
+** to NULL so that they do not cause unnecessary work to compute.
143841
+**
143842
+** Return the number of column that were changed to NULL.
143843
+*/
143844
+static int disableUnusedSubqueryResultColumns(SrcItem *pItem){
143845
+ int nCol;
143846
+ Select *pSub; /* The subquery to be simplified */
143847
+ Select *pX; /* For looping over compound elements of pSub */
143848
+ Table *pTab; /* The table that describes the subquery */
143849
+ int j; /* Column number */
143850
+ int nChng = 0; /* Number of columns converted to NULL */
143851
+ Bitmask colUsed; /* Columns that may not be NULLed out */
143852
+
143853
+ assert( pItem!=0 );
143854
+ if( pItem->fg.isCorrelated || pItem->fg.isCte ){
143855
+ return 0;
143856
+ }
143857
+ assert( pItem->pTab!=0 );
143858
+ pTab = pItem->pTab;
143859
+ assert( pItem->pSelect!=0 );
143860
+ pSub = pItem->pSelect;
143861
+ assert( pSub->pEList->nExpr==pTab->nCol );
143862
+ if( (pSub->selFlags & (SF_Distinct|SF_Aggregate))!=0 ){
143863
+ testcase( pSub->selFlags & SF_Distinct );
143864
+ testcase( pSub->selFlags & SF_Aggregate );
143865
+ return 0;
143866
+ }
143867
+ for(pX=pSub; pX; pX=pX->pPrior){
143868
+ if( pX->pPrior && pX->op!=TK_ALL ){
143869
+ /* This optimization does not work for compound subqueries that
143870
+ ** use UNION, INTERSECT, or EXCEPT. Only UNION ALL is allowed. */
143871
+ return 0;
143872
+ }
143873
+ if( pX->pWin ){
143874
+ /* This optimization does not work for subqueries that use window
143875
+ ** functions. */
143876
+ return 0;
143877
+ }
143878
+ }
143879
+ colUsed = pItem->colUsed;
143880
+ if( pSub->pOrderBy ){
143881
+ ExprList *pList = pSub->pOrderBy;
143882
+ for(j=0; j<pList->nExpr; j++){
143883
+ u16 iCol = pList->a[j].u.x.iOrderByCol;
143884
+ if( iCol>0 ){
143885
+ iCol--;
143886
+ colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol);
143887
+ }
143888
+ }
143889
+ }
143890
+ nCol = pTab->nCol;
143891
+ for(j=0; j<nCol; j++){
143892
+ Bitmask m = j<BMS-1 ? MASKBIT(j) : TOPBIT;
143893
+ if( (m & colUsed)!=0 ) continue;
143894
+ for(pX=pSub; pX; pX=pX->pPrior) {
143895
+ Expr *pY = pX->pEList->a[j].pExpr;
143896
+ if( pY->op==TK_NULL ) continue;
143897
+ pY->op = TK_NULL;
143898
+ ExprClearProperty(pY, EP_Skip|EP_Unlikely);
143899
+ pX->selFlags |= SF_PushDown;
143900
+ nChng++;
143901
+ }
143902
+ }
143903
+ return nChng;
143904
+}
143905
+
143514143906
143515143907
/*
143516143908
** The pFunc is the only aggregate function in the query. Check to see
143517143909
** if the query is a candidate for the min/max optimization.
143518143910
**
@@ -144695,11 +145087,12 @@
144695145087
if( pExpr->pAggInfo==0 ) return WRC_Continue;
144696145088
if( pExpr->op==TK_AGG_COLUMN ) return WRC_Continue;
144697145089
if( pExpr->op==TK_AGG_FUNCTION ) return WRC_Continue;
144698145090
if( pExpr->op==TK_IF_NULL_ROW ) return WRC_Continue;
144699145091
pAggInfo = pExpr->pAggInfo;
144700
- assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
145092
+ if( pExpr->iAgg>=pAggInfo->nColumn ) return WRC_Continue;
145093
+ assert( pExpr->iAgg>=0 );
144701145094
pCol = &pAggInfo->aCol[pExpr->iAgg];
144702145095
pExpr->op = TK_AGG_COLUMN;
144703145096
pExpr->iTable = pCol->iTable;
144704145097
pExpr->iColumn = pCol->iColumn;
144705145098
return WRC_Prune;
@@ -145053,11 +145446,10 @@
145053145446
sqlite3DbFree(db, p->aCol);
145054145447
sqlite3DbFree(db, p->aFunc);
145055145448
sqlite3DbFreeNN(db, p);
145056145449
}
145057145450
145058
-#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
145059145451
/*
145060145452
** Attempt to transform a query of the form
145061145453
**
145062145454
** SELECT count(*) FROM (SELECT x FROM t1 UNION ALL SELECT y FROM t2)
145063145455
**
@@ -145081,10 +145473,11 @@
145081145473
Expr *pCount;
145082145474
sqlite3 *db;
145083145475
if( (p->selFlags & SF_Aggregate)==0 ) return 0; /* This is an aggregate */
145084145476
if( p->pEList->nExpr!=1 ) return 0; /* Single result column */
145085145477
if( p->pWhere ) return 0;
145478
+ if( p->pHaving ) return 0;
145086145479
if( p->pGroupBy ) return 0;
145087145480
if( p->pOrderBy ) return 0;
145088145481
pExpr = p->pEList->a[0].pExpr;
145089145482
if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */
145090145483
assert( ExprUseUToken(pExpr) );
@@ -145100,11 +145493,12 @@
145100145493
do{
145101145494
if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
145102145495
if( pSub->pWhere ) return 0; /* No WHERE clause */
145103145496
if( pSub->pLimit ) return 0; /* No LIMIT clause */
145104145497
if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */
145105
- pSub = pSub->pPrior; /* Repeat over compound */
145498
+ assert( pSub->pHaving==0 ); /* Due to the previous */
145499
+ pSub = pSub->pPrior; /* Repeat over compound */
145106145500
}while( pSub );
145107145501
145108145502
/* If we reach this point then it is OK to perform the transformation */
145109145503
145110145504
db = pParse->db;
@@ -145143,11 +145537,10 @@
145143145537
sqlite3TreeViewSelect(0, p, 0);
145144145538
}
145145145539
#endif
145146145540
return 1;
145147145541
}
145148
-#endif /* SQLITE_COUNTOFVIEW_OPTIMIZATION */
145149145542
145150145543
/*
145151145544
** If any term of pSrc, or any SF_NestedFrom sub-query, is not the same
145152145545
** as pSrcItem but has the same alias as p0, then return true.
145153145546
** Otherwise return false.
@@ -145532,18 +145925,16 @@
145532145925
#endif
145533145926
}else{
145534145927
TREETRACE(0x2000,pParse,p,("Constant propagation not helpful\n"));
145535145928
}
145536145929
145537
-#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
145538145930
if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView)
145539145931
&& countOfViewOptimization(pParse, p)
145540145932
){
145541145933
if( db->mallocFailed ) goto select_end;
145542145934
pTabList = p->pSrc;
145543145935
}
145544
-#endif
145545145936
145546145937
/* For each term in the FROM clause, do two things:
145547145938
** (1) Authorized unreferenced tables
145548145939
** (2) Generate code for all sub-queries
145549145940
*/
@@ -145611,10 +146002,26 @@
145611146002
#endif
145612146003
assert( pItem->pSelect && (pItem->pSelect->selFlags & SF_PushDown)!=0 );
145613146004
}else{
145614146005
TREETRACE(0x4000,pParse,p,("Push-down not possible\n"));
145615146006
}
146007
+
146008
+ /* Convert unused result columns of the subquery into simple NULL
146009
+ ** expressions, to avoid unneeded searching and computation.
146010
+ */
146011
+ if( OptimizationEnabled(db, SQLITE_NullUnusedCols)
146012
+ && disableUnusedSubqueryResultColumns(pItem)
146013
+ ){
146014
+#if TREETRACE_ENABLED
146015
+ if( sqlite3TreeTrace & 0x4000 ){
146016
+ TREETRACE(0x4000,pParse,p,
146017
+ ("Change unused result columns to NULL for subquery %d:\n",
146018
+ pSub->selId));
146019
+ sqlite3TreeViewSelect(0, p, 0);
146020
+ }
146021
+#endif
146022
+ }
145616146023
145617146024
zSavedAuthContext = pParse->zAuthContext;
145618146025
pParse->zAuthContext = pItem->zName;
145619146026
145620146027
/* Generate code to implement the subquery
@@ -148149,10 +148556,13 @@
148149148556
const int op = pChanges ? TK_UPDATE : TK_DELETE;
148150148557
u32 mask = 0;
148151148558
Trigger *p;
148152148559
148153148560
assert( isNew==1 || isNew==0 );
148561
+ if( IsView(pTab) ){
148562
+ return 0xffffffff;
148563
+ }
148154148564
for(p=pTrigger; p; p=p->pNext){
148155148565
if( p->op==op
148156148566
&& (tr_tm&p->tr_tm)
148157148567
&& checkColumnOverlap(p->pColumns,pChanges)
148158148568
){
@@ -148583,11 +148993,11 @@
148583148993
#endif
148584148994
148585148995
if( sqlite3ViewGetColumnNames(pParse, pTab) ){
148586148996
goto update_cleanup;
148587148997
}
148588
- if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
148998
+ if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
148589148999
goto update_cleanup;
148590149000
}
148591149001
148592149002
/* Allocate a cursors for the main database table and for all indices.
148593149003
** The index cursors might not be used, but if they are used they
@@ -152376,13 +152786,13 @@
152376152786
sqlite3_str_append(pStr, ")", 1);
152377152787
}
152378152788
152379152789
/*
152380152790
** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN
152381
-** command, or if either SQLITE_DEBUG or SQLITE_ENABLE_STMT_SCANSTATUS was
152382
-** defined at compile-time. If it is not a no-op, a single OP_Explain opcode
152383
-** is added to the output to describe the table scan strategy in pLevel.
152791
+** command, or if stmt_scanstatus_v2() stats are enabled, or if SQLITE_DEBUG
152792
+** was defined at compile-time. If it is not a no-op, a single OP_Explain
152793
+** opcode is added to the output to describe the table scan strategy in pLevel.
152384152794
**
152385152795
** If an OP_Explain opcode is added to the VM, its address is returned.
152386152796
** Otherwise, if no OP_Explain is coded, zero is returned.
152387152797
*/
152388152798
SQLITE_PRIVATE int sqlite3WhereExplainOneScan(
@@ -152390,12 +152800,12 @@
152390152800
SrcList *pTabList, /* Table list this loop refers to */
152391152801
WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
152392152802
u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
152393152803
){
152394152804
int ret = 0;
152395
-#if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
152396
- if( sqlite3ParseToplevel(pParse)->explain==2 )
152805
+#if !defined(SQLITE_DEBUG)
152806
+ if( sqlite3ParseToplevel(pParse)->explain==2 || IS_STMT_SCANSTATUS(pParse->db) )
152397152807
#endif
152398152808
{
152399152809
SrcItem *pItem = &pTabList->a[pLevel->iFrom];
152400152810
Vdbe *v = pParse->pVdbe; /* VM being constructed */
152401152811
sqlite3 *db = pParse->db; /* Database handle */
@@ -152557,31 +152967,33 @@
152557152967
Vdbe *v, /* Vdbe to add scanstatus entry to */
152558152968
SrcList *pSrclist, /* FROM clause pLvl reads data from */
152559152969
WhereLevel *pLvl, /* Level to add scanstatus() entry for */
152560152970
int addrExplain /* Address of OP_Explain (or 0) */
152561152971
){
152562
- const char *zObj = 0;
152563
- WhereLoop *pLoop = pLvl->pWLoop;
152564
- int wsFlags = pLoop->wsFlags;
152565
- int viaCoroutine = 0;
152566
-
152567
- if( (wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
152568
- zObj = pLoop->u.btree.pIndex->zName;
152569
- }else{
152570
- zObj = pSrclist->a[pLvl->iFrom].zName;
152571
- viaCoroutine = pSrclist->a[pLvl->iFrom].fg.viaCoroutine;
152572
- }
152573
- sqlite3VdbeScanStatus(
152574
- v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
152575
- );
152576
-
152577
- if( viaCoroutine==0 ){
152578
- if( (wsFlags & (WHERE_MULTI_OR|WHERE_AUTO_INDEX))==0 ){
152579
- sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iTabCur);
152580
- }
152581
- if( wsFlags & WHERE_INDEXED ){
152582
- sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iIdxCur);
152972
+ if( IS_STMT_SCANSTATUS( sqlite3VdbeDb(v) ) ){
152973
+ const char *zObj = 0;
152974
+ WhereLoop *pLoop = pLvl->pWLoop;
152975
+ int wsFlags = pLoop->wsFlags;
152976
+ int viaCoroutine = 0;
152977
+
152978
+ if( (wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
152979
+ zObj = pLoop->u.btree.pIndex->zName;
152980
+ }else{
152981
+ zObj = pSrclist->a[pLvl->iFrom].zName;
152982
+ viaCoroutine = pSrclist->a[pLvl->iFrom].fg.viaCoroutine;
152983
+ }
152984
+ sqlite3VdbeScanStatus(
152985
+ v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
152986
+ );
152987
+
152988
+ if( viaCoroutine==0 ){
152989
+ if( (wsFlags & (WHERE_MULTI_OR|WHERE_AUTO_INDEX))==0 ){
152990
+ sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iTabCur);
152991
+ }
152992
+ if( wsFlags & WHERE_INDEXED ){
152993
+ sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iIdxCur);
152994
+ }
152583152995
}
152584152996
}
152585152997
}
152586152998
#endif
152587152999
@@ -154190,11 +154602,11 @@
154190154602
** of entries in the tree, so basing the number of steps to try
154191154603
** on the estimated number of rows in the btree seems like a good
154192154604
** guess. */
154193154605
addrSeekScan = sqlite3VdbeAddOp1(v, OP_SeekScan,
154194154606
(pIdx->aiRowLogEst[0]+9)/10);
154195
- if( pRangeStart ){
154607
+ if( pRangeStart || pRangeEnd ){
154196154608
sqlite3VdbeChangeP5(v, 1);
154197154609
sqlite3VdbeChangeP2(v, addrSeekScan, sqlite3VdbeCurrentAddr(v)+1);
154198154610
addrSeekScan = 0;
154199154611
}
154200154612
VdbeCoverage(v);
@@ -154231,20 +154643,11 @@
154231154643
*/
154232154644
nConstraint = nEq;
154233154645
assert( pLevel->p2==0 );
154234154646
if( pRangeEnd ){
154235154647
Expr *pRight = pRangeEnd->pExpr->pRight;
154236
- if( addrSeekScan ){
154237
- /* For a seek-scan that has a range on the lowest term of the index,
154238
- ** we have to make the top of the loop be code that sets the end
154239
- ** condition of the range. Otherwise, the OP_SeekScan might jump
154240
- ** over that initialization, leaving the range-end value set to the
154241
- ** range-start value, resulting in a wrong answer.
154242
- ** See ticket 5981a8c041a3c2f3 (2021-11-02).
154243
- */
154244
- pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154245
- }
154648
+ assert( addrSeekScan==0 );
154246154649
codeExprOrVector(pParse, pRight, regBase+nEq, nTop);
154247154650
whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd);
154248154651
if( (pRangeEnd->wtFlags & TERM_VNULL)==0
154249154652
&& sqlite3ExprCanBeNull(pRight)
154250154653
){
@@ -154274,11 +154677,11 @@
154274154677
}
154275154678
if( zStartAff ) sqlite3DbNNFreeNN(db, zStartAff);
154276154679
if( zEndAff ) sqlite3DbNNFreeNN(db, zEndAff);
154277154680
154278154681
/* Top of the loop body */
154279
- if( pLevel->p2==0 ) pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154682
+ pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154280154683
154281154684
/* Check if the index cursor is past the end of the range. */
154282154685
if( nConstraint ){
154283154686
if( regBignull ){
154284154687
/* Except, skip the end-of-range check while doing the NULL-scan */
@@ -156916,13 +157319,16 @@
156916157319
pColRef->y.pTab = pTab;
156917157320
pItem->colUsed |= sqlite3ExprColUsed(pColRef);
156918157321
pRhs = sqlite3PExpr(pParse, TK_UPLUS,
156919157322
sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0);
156920157323
pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs);
156921
- if( pItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT) ){
157324
+ if( pItem->fg.jointype & (JT_LEFT|JT_RIGHT) ){
157325
+ testcase( pItem->fg.jointype & JT_LEFT ); /* testtag-20230227a */
157326
+ testcase( pItem->fg.jointype & JT_RIGHT ); /* testtag-20230227b */
156922157327
joinType = EP_OuterON;
156923157328
}else{
157329
+ testcase( pItem->fg.jointype & JT_LTORJ ); /* testtag-20230227c */
156924157330
joinType = EP_InnerON;
156925157331
}
156926157332
sqlite3SetJoinExpr(pTerm, pItem->iCursor, joinType);
156927157333
whereClauseInsert(pWC, pTerm, TERM_DYNAMIC);
156928157334
}
@@ -157761,11 +158167,11 @@
157761158167
Parse *pParse,
157762158168
Index *pIdx, /* Automatic index to explain */
157763158169
int bPartial, /* True if pIdx is a partial index */
157764158170
int *pAddrExplain /* OUT: Address of OP_Explain */
157765158171
){
157766
- if( pParse->explain!=2 ){
158172
+ if( IS_STMT_SCANSTATUS(pParse->db) && pParse->explain!=2 ){
157767158173
Table *pTab = pIdx->pTable;
157768158174
const char *zSep = "";
157769158175
char *zText = 0;
157770158176
int ii = 0;
157771158177
sqlite3_str *pStr = sqlite3_str_new(pParse->db);
@@ -157822,11 +158228,12 @@
157822158228
CollSeq *pColl; /* Collating sequence to on a column */
157823158229
WhereLoop *pLoop; /* The Loop object */
157824158230
char *zNotUsed; /* Extra space on the end of pIdx */
157825158231
Bitmask idxCols; /* Bitmap of columns used for indexing */
157826158232
Bitmask extraCols; /* Bitmap of additional columns */
157827
- u8 sentWarning = 0; /* True if a warnning has been issued */
158233
+ u8 sentWarning = 0; /* True if a warning has been issued */
158234
+ u8 useBloomFilter = 0; /* True to also add a Bloom filter */
157828158235
Expr *pPartial = 0; /* Partial Index Expression */
157829158236
int iContinue = 0; /* Jump here to skip excluded rows */
157830158237
SrcItem *pTabItem; /* FROM clause term being indexed */
157831158238
int addrCounter = 0; /* Address where integer counter is initialized */
157832158239
int regBase; /* Array of registers where record is assembled */
@@ -157892,11 +158299,15 @@
157892158299
** original table never needs to be accessed. Automatic indices must
157893158300
** be a covering index because the index will not be updated if the
157894158301
** original table changes and the index and table cannot both be used
157895158302
** if they go out of sync.
157896158303
*/
157897
- extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
158304
+ if( IsView(pTable) ){
158305
+ extraCols = ALLBITS;
158306
+ }else{
158307
+ extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
158308
+ }
157898158309
mxBitCol = MIN(BMS-1,pTable->nCol);
157899158310
testcase( pTable->nCol==BMS-1 );
157900158311
testcase( pTable->nCol==BMS-2 );
157901158312
for(i=0; i<mxBitCol; i++){
157902158313
if( extraCols & MASKBIT(i) ) nKeyCol++;
@@ -157928,10 +158339,20 @@
157928158339
pIdx->aiColumn[n] = pTerm->u.x.leftColumn;
157929158340
pColl = sqlite3ExprCompareCollSeq(pParse, pX);
157930158341
assert( pColl!=0 || pParse->nErr>0 ); /* TH3 collate01.800 */
157931158342
pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
157932158343
n++;
158344
+ if( ALWAYS(pX->pLeft!=0)
158345
+ && sqlite3ExprAffinity(pX->pLeft)!=SQLITE_AFF_TEXT
158346
+ ){
158347
+ /* TUNING: only use a Bloom filter on an automatic index
158348
+ ** if one or more key columns has the ability to hold numeric
158349
+ ** values, since strings all have the same hash in the Bloom
158350
+ ** filter implementation and hence a Bloom filter on a text column
158351
+ ** is not usually helpful. */
158352
+ useBloomFilter = 1;
158353
+ }
157933158354
}
157934158355
}
157935158356
}
157936158357
assert( (u32)n==pLoop->u.btree.nEq );
157937158358
@@ -157960,11 +158381,12 @@
157960158381
assert( pLevel->iIdxCur>=0 );
157961158382
pLevel->iIdxCur = pParse->nTab++;
157962158383
sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
157963158384
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
157964158385
VdbeComment((v, "for %s", pTable->zName));
157965
- if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) ){
158386
+ if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) && useBloomFilter ){
158387
+ sqlite3WhereExplainBloomFilter(pParse, pWC->pWInfo, pLevel);
157966158388
pLevel->regFilter = ++pParse->nMem;
157967158389
sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter);
157968158390
}
157969158391
157970158392
/* Fill the automatic index with content */
@@ -158444,10 +158866,11 @@
158444158866
UNUSED_PARAMETER( pParse );
158445158867
#endif
158446158868
assert( pRec!=0 );
158447158869
assert( pIdx->nSample>0 );
158448158870
assert( pRec->nField>0 );
158871
+
158449158872
158450158873
/* Do a binary search to find the first sample greater than or equal
158451158874
** to pRec. If pRec contains a single field, the set of samples to search
158452158875
** is simply the aSample[] array. If the samples in aSample[] contain more
158453158876
** than one fields, all fields following the first are ignored.
@@ -158489,11 +158912,16 @@
158489158912
** appears that it should be 1 field in size. However, that would make it
158490158913
** smaller than sample 1, so the binary search would not work. As a result,
158491158914
** it is extended to two fields. The duplicates that this creates do not
158492158915
** cause any problems.
158493158916
*/
158494
- nField = MIN(pRec->nField, pIdx->nSample);
158917
+ if( !HasRowid(pIdx->pTable) && IsPrimaryKeyIndex(pIdx) ){
158918
+ nField = pIdx->nKeyCol;
158919
+ }else{
158920
+ nField = pIdx->nColumn;
158921
+ }
158922
+ nField = MIN(pRec->nField, nField);
158495158923
iCol = 0;
158496158924
iSample = pIdx->nSample * nField;
158497158925
do{
158498158926
int iSamp; /* Index in aSample[] of test sample */
158499158927
int n; /* Number of fields in test sample */
@@ -163150,11 +163578,11 @@
163150163578
for(; b; b=b>>1, n++){}
163151163579
sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(n), P4_INT32);
163152163580
assert( n<=pTab->nCol );
163153163581
}
163154163582
#ifdef SQLITE_ENABLE_CURSOR_HINTS
163155
- if( pLoop->u.btree.pIndex!=0 ){
163583
+ if( pLoop->u.btree.pIndex!=0 && (pTab->tabFlags & TF_WithoutRowid)==0 ){
163156163584
sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ|bFordelete);
163157163585
}else
163158163586
#endif
163159163587
{
163160163588
sqlite3VdbeChangeP5(v, bFordelete);
@@ -167311,22 +167739,22 @@
167311167739
#define sqlite3ParserCTX_PDECL ,Parse *pParse
167312167740
#define sqlite3ParserCTX_PARAM ,pParse
167313167741
#define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
167314167742
#define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
167315167743
#define YYFALLBACK 1
167316
-#define YYNSTATE 576
167317
-#define YYNRULE 405
167318
-#define YYNRULE_WITH_ACTION 342
167744
+#define YYNSTATE 575
167745
+#define YYNRULE 403
167746
+#define YYNRULE_WITH_ACTION 341
167319167747
#define YYNTOKEN 185
167320
-#define YY_MAX_SHIFT 575
167321
-#define YY_MIN_SHIFTREDUCE 835
167322
-#define YY_MAX_SHIFTREDUCE 1239
167323
-#define YY_ERROR_ACTION 1240
167324
-#define YY_ACCEPT_ACTION 1241
167325
-#define YY_NO_ACTION 1242
167326
-#define YY_MIN_REDUCE 1243
167327
-#define YY_MAX_REDUCE 1647
167748
+#define YY_MAX_SHIFT 574
167749
+#define YY_MIN_SHIFTREDUCE 833
167750
+#define YY_MAX_SHIFTREDUCE 1235
167751
+#define YY_ERROR_ACTION 1236
167752
+#define YY_ACCEPT_ACTION 1237
167753
+#define YY_NO_ACTION 1238
167754
+#define YY_MIN_REDUCE 1239
167755
+#define YY_MAX_REDUCE 1641
167328167756
/************* End control #defines *******************************************/
167329167757
#define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
167330167758
167331167759
/* Define the yytestcase() macro to be a no-op if is not already defined
167332167760
** otherwise.
@@ -167389,222 +167817,222 @@
167389167817
** yy_reduce_ofst[] For each state, the offset into yy_action for
167390167818
** shifting non-terminals after a reduce.
167391167819
** yy_default[] Default action for each state.
167392167820
**
167393167821
*********** Begin parsing tables **********************************************/
167394
-#define YY_ACTTAB_COUNT (2098)
167822
+#define YY_ACTTAB_COUNT (2096)
167395167823
static const YYACTIONTYPE yy_action[] = {
167396167824
/* 0 */ 568, 208, 568, 118, 115, 229, 568, 118, 115, 229,
167397
- /* 10 */ 568, 1314, 377, 1293, 408, 562, 562, 562, 568, 409,
167398
- /* 20 */ 378, 1314, 1276, 41, 41, 41, 41, 208, 1526, 71,
167399
- /* 30 */ 71, 971, 419, 41, 41, 491, 303, 279, 303, 972,
167400
- /* 40 */ 397, 71, 71, 125, 126, 80, 1217, 1217, 1050, 1053,
167401
- /* 50 */ 1040, 1040, 123, 123, 124, 124, 124, 124, 476, 409,
167402
- /* 60 */ 1241, 1, 1, 575, 2, 1245, 550, 118, 115, 229,
167403
- /* 70 */ 317, 480, 146, 480, 524, 118, 115, 229, 529, 1327,
167404
- /* 80 */ 417, 523, 142, 125, 126, 80, 1217, 1217, 1050, 1053,
167405
- /* 90 */ 1040, 1040, 123, 123, 124, 124, 124, 124, 118, 115,
167825
+ /* 10 */ 568, 1310, 377, 1289, 408, 562, 562, 562, 568, 409,
167826
+ /* 20 */ 378, 1310, 1272, 41, 41, 41, 41, 208, 1521, 71,
167827
+ /* 30 */ 71, 969, 419, 41, 41, 491, 303, 279, 303, 970,
167828
+ /* 40 */ 397, 71, 71, 125, 126, 80, 1213, 1213, 1047, 1050,
167829
+ /* 50 */ 1037, 1037, 123, 123, 124, 124, 124, 124, 476, 409,
167830
+ /* 60 */ 1237, 1, 1, 574, 2, 1241, 550, 118, 115, 229,
167831
+ /* 70 */ 317, 480, 146, 480, 524, 118, 115, 229, 529, 1323,
167832
+ /* 80 */ 417, 523, 142, 125, 126, 80, 1213, 1213, 1047, 1050,
167833
+ /* 90 */ 1037, 1037, 123, 123, 124, 124, 124, 124, 118, 115,
167406167834
/* 100 */ 229, 327, 122, 122, 122, 122, 121, 121, 120, 120,
167407167835
/* 110 */ 120, 119, 116, 444, 284, 284, 284, 284, 442, 442,
167408
- /* 120 */ 442, 1567, 376, 1569, 1192, 375, 1163, 565, 1163, 565,
167409
- /* 130 */ 409, 1567, 537, 259, 226, 444, 101, 145, 449, 316,
167836
+ /* 120 */ 442, 1562, 376, 1564, 1189, 375, 1160, 565, 1160, 565,
167837
+ /* 130 */ 409, 1562, 537, 259, 226, 444, 101, 145, 449, 316,
167410167838
/* 140 */ 559, 240, 122, 122, 122, 122, 121, 121, 120, 120,
167411
- /* 150 */ 120, 119, 116, 444, 125, 126, 80, 1217, 1217, 1050,
167412
- /* 160 */ 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, 142,
167413
- /* 170 */ 294, 1192, 339, 448, 120, 120, 120, 119, 116, 444,
167414
- /* 180 */ 127, 1192, 1193, 1194, 148, 441, 440, 568, 119, 116,
167839
+ /* 150 */ 120, 119, 116, 444, 125, 126, 80, 1213, 1213, 1047,
167840
+ /* 160 */ 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, 142,
167841
+ /* 170 */ 294, 1189, 339, 448, 120, 120, 120, 119, 116, 444,
167842
+ /* 180 */ 127, 1189, 1190, 1189, 148, 441, 440, 568, 119, 116,
167415167843
/* 190 */ 444, 124, 124, 124, 124, 117, 122, 122, 122, 122,
167416167844
/* 200 */ 121, 121, 120, 120, 120, 119, 116, 444, 454, 113,
167417167845
/* 210 */ 13, 13, 546, 122, 122, 122, 122, 121, 121, 120,
167418
- /* 220 */ 120, 120, 119, 116, 444, 422, 316, 559, 1192, 1193,
167419
- /* 230 */ 1194, 149, 1224, 409, 1224, 124, 124, 124, 124, 122,
167846
+ /* 220 */ 120, 120, 119, 116, 444, 422, 316, 559, 1189, 1190,
167847
+ /* 230 */ 1189, 149, 1220, 409, 1220, 124, 124, 124, 124, 122,
167420167848
/* 240 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116,
167421
- /* 250 */ 444, 465, 342, 1037, 1037, 1051, 1054, 125, 126, 80,
167422
- /* 260 */ 1217, 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124,
167423
- /* 270 */ 124, 124, 1279, 522, 222, 1192, 568, 409, 224, 514,
167849
+ /* 250 */ 444, 465, 342, 1034, 1034, 1048, 1051, 125, 126, 80,
167850
+ /* 260 */ 1213, 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124,
167851
+ /* 270 */ 124, 124, 1275, 522, 222, 1189, 568, 409, 224, 514,
167424167852
/* 280 */ 175, 82, 83, 122, 122, 122, 122, 121, 121, 120,
167425
- /* 290 */ 120, 120, 119, 116, 444, 1007, 16, 16, 1192, 133,
167426
- /* 300 */ 133, 125, 126, 80, 1217, 1217, 1050, 1053, 1040, 1040,
167853
+ /* 290 */ 120, 120, 119, 116, 444, 1005, 16, 16, 1189, 133,
167854
+ /* 300 */ 133, 125, 126, 80, 1213, 1213, 1047, 1050, 1037, 1037,
167427167855
/* 310 */ 123, 123, 124, 124, 124, 124, 122, 122, 122, 122,
167428
- /* 320 */ 121, 121, 120, 120, 120, 119, 116, 444, 1041, 546,
167429
- /* 330 */ 1192, 373, 1192, 1193, 1194, 252, 1434, 399, 504, 501,
167430
- /* 340 */ 500, 111, 560, 566, 4, 926, 926, 433, 499, 340,
167431
- /* 350 */ 460, 328, 360, 394, 1237, 1192, 1193, 1194, 563, 568,
167856
+ /* 320 */ 121, 121, 120, 120, 120, 119, 116, 444, 1038, 546,
167857
+ /* 330 */ 1189, 373, 1189, 1190, 1189, 252, 1429, 399, 504, 501,
167858
+ /* 340 */ 500, 111, 560, 566, 4, 924, 924, 433, 499, 340,
167859
+ /* 350 */ 460, 328, 360, 394, 1233, 1189, 1190, 1189, 563, 568,
167432167860
/* 360 */ 122, 122, 122, 122, 121, 121, 120, 120, 120, 119,
167433
- /* 370 */ 116, 444, 284, 284, 369, 1580, 1607, 441, 440, 154,
167434
- /* 380 */ 409, 445, 71, 71, 1286, 565, 1221, 1192, 1193, 1194,
167435
- /* 390 */ 85, 1223, 271, 557, 543, 515, 1561, 568, 98, 1222,
167436
- /* 400 */ 6, 1278, 472, 142, 125, 126, 80, 1217, 1217, 1050,
167437
- /* 410 */ 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, 550,
167438
- /* 420 */ 13, 13, 1027, 507, 1224, 1192, 1224, 549, 109, 109,
167439
- /* 430 */ 222, 568, 1238, 175, 568, 427, 110, 197, 445, 570,
167440
- /* 440 */ 569, 430, 1552, 1017, 325, 551, 1192, 270, 287, 368,
167861
+ /* 370 */ 116, 444, 284, 284, 369, 1575, 1601, 441, 440, 154,
167862
+ /* 380 */ 409, 445, 71, 71, 1282, 565, 1217, 1189, 1190, 1189,
167863
+ /* 390 */ 85, 1219, 271, 557, 543, 515, 1556, 568, 98, 1218,
167864
+ /* 400 */ 6, 1274, 472, 142, 125, 126, 80, 1213, 1213, 1047,
167865
+ /* 410 */ 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, 550,
167866
+ /* 420 */ 13, 13, 1024, 507, 1220, 1189, 1220, 549, 109, 109,
167867
+ /* 430 */ 222, 568, 1234, 175, 568, 427, 110, 197, 445, 569,
167868
+ /* 440 */ 445, 430, 1547, 1014, 325, 551, 1189, 270, 287, 368,
167441167869
/* 450 */ 510, 363, 509, 257, 71, 71, 543, 71, 71, 359,
167442
- /* 460 */ 316, 559, 1613, 122, 122, 122, 122, 121, 121, 120,
167443
- /* 470 */ 120, 120, 119, 116, 444, 1017, 1017, 1019, 1020, 27,
167444
- /* 480 */ 284, 284, 1192, 1193, 1194, 1158, 568, 1612, 409, 901,
167445
- /* 490 */ 190, 550, 356, 565, 550, 937, 533, 517, 1158, 516,
167446
- /* 500 */ 413, 1158, 552, 1192, 1193, 1194, 568, 544, 1554, 51,
167447
- /* 510 */ 51, 214, 125, 126, 80, 1217, 1217, 1050, 1053, 1040,
167448
- /* 520 */ 1040, 123, 123, 124, 124, 124, 124, 1192, 474, 135,
167449
- /* 530 */ 135, 409, 284, 284, 1490, 505, 121, 121, 120, 120,
167450
- /* 540 */ 120, 119, 116, 444, 1007, 565, 518, 217, 541, 1561,
167451
- /* 550 */ 316, 559, 142, 6, 532, 125, 126, 80, 1217, 1217,
167452
- /* 560 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167453
- /* 570 */ 1555, 122, 122, 122, 122, 121, 121, 120, 120, 120,
167454
- /* 580 */ 119, 116, 444, 485, 1192, 1193, 1194, 482, 281, 1267,
167455
- /* 590 */ 957, 252, 1192, 373, 504, 501, 500, 1192, 340, 571,
167456
- /* 600 */ 1192, 571, 409, 292, 499, 957, 876, 191, 480, 316,
167870
+ /* 460 */ 316, 559, 1607, 122, 122, 122, 122, 121, 121, 120,
167871
+ /* 470 */ 120, 120, 119, 116, 444, 1014, 1014, 1016, 1017, 27,
167872
+ /* 480 */ 284, 284, 1189, 1190, 1189, 1155, 568, 1606, 409, 899,
167873
+ /* 490 */ 190, 550, 356, 565, 550, 935, 533, 517, 1155, 516,
167874
+ /* 500 */ 413, 1155, 552, 1189, 1190, 1189, 568, 544, 1549, 51,
167875
+ /* 510 */ 51, 214, 125, 126, 80, 1213, 1213, 1047, 1050, 1037,
167876
+ /* 520 */ 1037, 123, 123, 124, 124, 124, 124, 1189, 474, 135,
167877
+ /* 530 */ 135, 409, 284, 284, 1485, 505, 121, 121, 120, 120,
167878
+ /* 540 */ 120, 119, 116, 444, 1005, 565, 518, 217, 541, 1556,
167879
+ /* 550 */ 316, 559, 142, 6, 532, 125, 126, 80, 1213, 1213,
167880
+ /* 560 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124,
167881
+ /* 570 */ 1550, 122, 122, 122, 122, 121, 121, 120, 120, 120,
167882
+ /* 580 */ 119, 116, 444, 485, 1189, 1190, 1189, 482, 281, 1263,
167883
+ /* 590 */ 955, 252, 1189, 373, 504, 501, 500, 1189, 340, 570,
167884
+ /* 600 */ 1189, 570, 409, 292, 499, 955, 874, 191, 480, 316,
167457167885
/* 610 */ 559, 384, 290, 380, 122, 122, 122, 122, 121, 121,
167458
- /* 620 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167459
- /* 630 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167460
- /* 640 */ 124, 409, 394, 1136, 1192, 869, 100, 284, 284, 1192,
167461
- /* 650 */ 1193, 1194, 373, 1093, 1192, 1193, 1194, 1192, 1193, 1194,
167462
- /* 660 */ 565, 455, 32, 373, 233, 125, 126, 80, 1217, 1217,
167463
- /* 670 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167464
- /* 680 */ 1433, 959, 568, 228, 958, 122, 122, 122, 122, 121,
167465
- /* 690 */ 121, 120, 120, 120, 119, 116, 444, 1158, 228, 1192,
167466
- /* 700 */ 157, 1192, 1193, 1194, 1553, 13, 13, 301, 957, 1232,
167467
- /* 710 */ 1158, 153, 409, 1158, 373, 1583, 1176, 5, 369, 1580,
167468
- /* 720 */ 429, 1238, 3, 957, 122, 122, 122, 122, 121, 121,
167469
- /* 730 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167470
- /* 740 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167471
- /* 750 */ 124, 409, 208, 567, 1192, 1028, 1192, 1193, 1194, 1192,
167472
- /* 760 */ 388, 852, 155, 1552, 286, 402, 1098, 1098, 488, 568,
167473
- /* 770 */ 465, 342, 1319, 1319, 1552, 125, 126, 80, 1217, 1217,
167474
- /* 780 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167886
+ /* 620 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213,
167887
+ /* 630 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
167888
+ /* 640 */ 124, 409, 394, 1133, 1189, 867, 100, 284, 284, 1189,
167889
+ /* 650 */ 1190, 1189, 373, 1090, 1189, 1190, 1189, 1189, 1190, 1189,
167890
+ /* 660 */ 565, 455, 32, 373, 233, 125, 126, 80, 1213, 1213,
167891
+ /* 670 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124,
167892
+ /* 680 */ 1428, 957, 568, 228, 956, 122, 122, 122, 122, 121,
167893
+ /* 690 */ 121, 120, 120, 120, 119, 116, 444, 1155, 228, 1189,
167894
+ /* 700 */ 157, 1189, 1190, 1189, 1548, 13, 13, 301, 955, 1228,
167895
+ /* 710 */ 1155, 153, 409, 1155, 373, 1578, 1173, 5, 369, 1575,
167896
+ /* 720 */ 429, 1234, 3, 955, 122, 122, 122, 122, 121, 121,
167897
+ /* 730 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213,
167898
+ /* 740 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
167899
+ /* 750 */ 124, 409, 208, 567, 1189, 1025, 1189, 1190, 1189, 1189,
167900
+ /* 760 */ 388, 850, 155, 1547, 286, 402, 1095, 1095, 488, 568,
167901
+ /* 770 */ 465, 342, 1315, 1315, 1547, 125, 126, 80, 1213, 1213,
167902
+ /* 780 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124,
167475167903
/* 790 */ 129, 568, 13, 13, 374, 122, 122, 122, 122, 121,
167476167904
/* 800 */ 121, 120, 120, 120, 119, 116, 444, 302, 568, 453,
167477
- /* 810 */ 528, 1192, 1193, 1194, 13, 13, 1192, 1193, 1194, 1297,
167478
- /* 820 */ 463, 1267, 409, 1317, 1317, 1552, 1012, 453, 452, 200,
167479
- /* 830 */ 299, 71, 71, 1265, 122, 122, 122, 122, 121, 121,
167480
- /* 840 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167481
- /* 850 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167482
- /* 860 */ 124, 409, 227, 1073, 1158, 284, 284, 419, 312, 278,
167483
- /* 870 */ 278, 285, 285, 1419, 406, 405, 382, 1158, 565, 568,
167484
- /* 880 */ 1158, 1196, 565, 1600, 565, 125, 126, 80, 1217, 1217,
167485
- /* 890 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167486
- /* 900 */ 453, 1482, 13, 13, 1536, 122, 122, 122, 122, 121,
167905
+ /* 810 */ 528, 1189, 1190, 1189, 13, 13, 1189, 1190, 1189, 1293,
167906
+ /* 820 */ 463, 1263, 409, 1313, 1313, 1547, 1010, 453, 452, 200,
167907
+ /* 830 */ 299, 71, 71, 1261, 122, 122, 122, 122, 121, 121,
167908
+ /* 840 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213,
167909
+ /* 850 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
167910
+ /* 860 */ 124, 409, 227, 1070, 1155, 284, 284, 419, 312, 278,
167911
+ /* 870 */ 278, 285, 285, 1415, 406, 405, 382, 1155, 565, 568,
167912
+ /* 880 */ 1155, 1192, 565, 1595, 565, 125, 126, 80, 1213, 1213,
167913
+ /* 890 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124,
167914
+ /* 900 */ 453, 1477, 13, 13, 1531, 122, 122, 122, 122, 121,
167487167915
/* 910 */ 121, 120, 120, 120, 119, 116, 444, 201, 568, 354,
167488
- /* 920 */ 1586, 575, 2, 1245, 840, 841, 842, 1562, 317, 1212,
167489
- /* 930 */ 146, 6, 409, 255, 254, 253, 206, 1327, 9, 1196,
167916
+ /* 920 */ 1581, 574, 2, 1241, 838, 839, 840, 1557, 317, 1208,
167917
+ /* 930 */ 146, 6, 409, 255, 254, 253, 206, 1323, 9, 1192,
167490167918
/* 940 */ 262, 71, 71, 424, 122, 122, 122, 122, 121, 121,
167491
- /* 950 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167492
- /* 960 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167493
- /* 970 */ 124, 568, 284, 284, 568, 1213, 409, 574, 313, 1245,
167494
- /* 980 */ 349, 1296, 352, 419, 317, 565, 146, 491, 525, 1643,
167495
- /* 990 */ 395, 371, 491, 1327, 70, 70, 1295, 71, 71, 240,
167496
- /* 1000 */ 1325, 104, 80, 1217, 1217, 1050, 1053, 1040, 1040, 123,
167919
+ /* 950 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213,
167920
+ /* 960 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
167921
+ /* 970 */ 124, 568, 284, 284, 568, 1209, 409, 573, 313, 1241,
167922
+ /* 980 */ 349, 1292, 352, 419, 317, 565, 146, 491, 525, 1637,
167923
+ /* 990 */ 395, 371, 491, 1323, 70, 70, 1291, 71, 71, 240,
167924
+ /* 1000 */ 1321, 104, 80, 1213, 1213, 1047, 1050, 1037, 1037, 123,
167497167925
/* 1010 */ 123, 124, 124, 124, 124, 122, 122, 122, 122, 121,
167498
- /* 1020 */ 121, 120, 120, 120, 119, 116, 444, 1114, 284, 284,
167499
- /* 1030 */ 428, 448, 1525, 1213, 439, 284, 284, 1489, 1352, 311,
167500
- /* 1040 */ 474, 565, 1115, 971, 491, 491, 217, 1263, 565, 1538,
167501
- /* 1050 */ 568, 972, 207, 568, 1027, 240, 383, 1116, 519, 122,
167926
+ /* 1020 */ 121, 120, 120, 120, 119, 116, 444, 1111, 284, 284,
167927
+ /* 1030 */ 428, 448, 1520, 1209, 439, 284, 284, 1484, 1348, 311,
167928
+ /* 1040 */ 474, 565, 1112, 969, 491, 491, 217, 1259, 565, 1533,
167929
+ /* 1050 */ 568, 970, 207, 568, 1024, 240, 383, 1113, 519, 122,
167502167930
/* 1060 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116,
167503
- /* 1070 */ 444, 1018, 107, 71, 71, 1017, 13, 13, 912, 568,
167504
- /* 1080 */ 1495, 568, 284, 284, 97, 526, 491, 448, 913, 1326,
167505
- /* 1090 */ 1322, 545, 409, 284, 284, 565, 151, 209, 1495, 1497,
167506
- /* 1100 */ 262, 450, 55, 55, 56, 56, 565, 1017, 1017, 1019,
167507
- /* 1110 */ 443, 332, 409, 527, 12, 295, 125, 126, 80, 1217,
167508
- /* 1120 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167509
- /* 1130 */ 124, 347, 409, 864, 1534, 1213, 125, 126, 80, 1217,
167510
- /* 1140 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167511
- /* 1150 */ 124, 1137, 1641, 474, 1641, 371, 125, 114, 80, 1217,
167512
- /* 1160 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167513
- /* 1170 */ 124, 1495, 329, 474, 331, 122, 122, 122, 122, 121,
167514
- /* 1180 */ 121, 120, 120, 120, 119, 116, 444, 203, 1419, 568,
167515
- /* 1190 */ 1294, 864, 464, 1213, 436, 122, 122, 122, 122, 121,
167516
- /* 1200 */ 121, 120, 120, 120, 119, 116, 444, 553, 1137, 1642,
167517
- /* 1210 */ 539, 1642, 15, 15, 892, 122, 122, 122, 122, 121,
167931
+ /* 1070 */ 444, 1015, 107, 71, 71, 1014, 13, 13, 910, 568,
167932
+ /* 1080 */ 1490, 568, 284, 284, 97, 526, 491, 448, 911, 1322,
167933
+ /* 1090 */ 1318, 545, 409, 284, 284, 565, 151, 209, 1490, 1492,
167934
+ /* 1100 */ 262, 450, 55, 55, 56, 56, 565, 1014, 1014, 1016,
167935
+ /* 1110 */ 443, 332, 409, 527, 12, 295, 125, 126, 80, 1213,
167936
+ /* 1120 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
167937
+ /* 1130 */ 124, 347, 409, 862, 1529, 1209, 125, 126, 80, 1213,
167938
+ /* 1140 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
167939
+ /* 1150 */ 124, 1134, 1635, 474, 1635, 371, 125, 114, 80, 1213,
167940
+ /* 1160 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
167941
+ /* 1170 */ 124, 1490, 329, 474, 331, 122, 122, 122, 122, 121,
167942
+ /* 1180 */ 121, 120, 120, 120, 119, 116, 444, 203, 1415, 568,
167943
+ /* 1190 */ 1290, 862, 464, 1209, 436, 122, 122, 122, 122, 121,
167944
+ /* 1200 */ 121, 120, 120, 120, 119, 116, 444, 553, 1134, 1636,
167945
+ /* 1210 */ 539, 1636, 15, 15, 890, 122, 122, 122, 122, 121,
167518167946
/* 1220 */ 121, 120, 120, 120, 119, 116, 444, 568, 298, 538,
167519
- /* 1230 */ 1135, 1419, 1559, 1560, 1331, 409, 6, 6, 1169, 1268,
167520
- /* 1240 */ 415, 320, 284, 284, 1419, 508, 565, 525, 300, 457,
167521
- /* 1250 */ 43, 43, 568, 893, 12, 565, 330, 478, 425, 407,
167522
- /* 1260 */ 126, 80, 1217, 1217, 1050, 1053, 1040, 1040, 123, 123,
167523
- /* 1270 */ 124, 124, 124, 124, 568, 57, 57, 288, 1192, 1419,
167524
- /* 1280 */ 496, 458, 392, 392, 391, 273, 389, 1135, 1558, 849,
167525
- /* 1290 */ 1169, 407, 6, 568, 321, 1158, 470, 44, 44, 1557,
167526
- /* 1300 */ 1114, 426, 234, 6, 323, 256, 540, 256, 1158, 431,
167527
- /* 1310 */ 568, 1158, 322, 17, 487, 1115, 58, 58, 122, 122,
167947
+ /* 1230 */ 1132, 1415, 1554, 1555, 1327, 409, 6, 6, 1166, 1264,
167948
+ /* 1240 */ 415, 320, 284, 284, 1415, 508, 565, 525, 300, 457,
167949
+ /* 1250 */ 43, 43, 568, 891, 12, 565, 330, 478, 425, 407,
167950
+ /* 1260 */ 126, 80, 1213, 1213, 1047, 1050, 1037, 1037, 123, 123,
167951
+ /* 1270 */ 124, 124, 124, 124, 568, 57, 57, 288, 1189, 1415,
167952
+ /* 1280 */ 496, 458, 392, 392, 391, 273, 389, 1132, 1553, 847,
167953
+ /* 1290 */ 1166, 407, 6, 568, 321, 1155, 470, 44, 44, 1552,
167954
+ /* 1300 */ 1111, 426, 234, 6, 323, 256, 540, 256, 1155, 431,
167955
+ /* 1310 */ 568, 1155, 322, 17, 487, 1112, 58, 58, 122, 122,
167528167956
/* 1320 */ 122, 122, 121, 121, 120, 120, 120, 119, 116, 444,
167529
- /* 1330 */ 1116, 216, 481, 59, 59, 1192, 1193, 1194, 111, 560,
167957
+ /* 1330 */ 1113, 216, 481, 59, 59, 1189, 1190, 1189, 111, 560,
167530167958
/* 1340 */ 324, 4, 236, 456, 526, 568, 237, 456, 568, 437,
167531
- /* 1350 */ 168, 556, 420, 141, 479, 563, 568, 293, 568, 1095,
167532
- /* 1360 */ 568, 293, 568, 1095, 531, 568, 872, 8, 60, 60,
167959
+ /* 1350 */ 168, 556, 420, 141, 479, 563, 568, 293, 568, 1092,
167960
+ /* 1360 */ 568, 293, 568, 1092, 531, 568, 870, 8, 60, 60,
167533167961
/* 1370 */ 235, 61, 61, 568, 414, 568, 414, 568, 445, 62,
167534167962
/* 1380 */ 62, 45, 45, 46, 46, 47, 47, 199, 49, 49,
167535167963
/* 1390 */ 557, 568, 359, 568, 100, 486, 50, 50, 63, 63,
167536
- /* 1400 */ 64, 64, 561, 415, 535, 410, 568, 1027, 568, 534,
167537
- /* 1410 */ 316, 559, 316, 559, 65, 65, 14, 14, 568, 1027,
167538
- /* 1420 */ 568, 512, 932, 872, 1018, 109, 109, 931, 1017, 66,
167539
- /* 1430 */ 66, 131, 131, 110, 451, 445, 570, 569, 416, 177,
167540
- /* 1440 */ 1017, 132, 132, 67, 67, 568, 467, 568, 932, 471,
167541
- /* 1450 */ 1364, 283, 226, 931, 315, 1363, 407, 568, 459, 407,
167542
- /* 1460 */ 1017, 1017, 1019, 239, 407, 86, 213, 1350, 52, 52,
167543
- /* 1470 */ 68, 68, 1017, 1017, 1019, 1020, 27, 1585, 1180, 447,
167544
- /* 1480 */ 69, 69, 288, 97, 108, 1541, 106, 392, 392, 391,
167545
- /* 1490 */ 273, 389, 568, 879, 849, 883, 568, 111, 560, 466,
167546
- /* 1500 */ 4, 568, 152, 30, 38, 568, 1132, 234, 396, 323,
167964
+ /* 1400 */ 64, 64, 561, 415, 535, 410, 568, 1024, 568, 534,
167965
+ /* 1410 */ 316, 559, 316, 559, 65, 65, 14, 14, 568, 1024,
167966
+ /* 1420 */ 568, 512, 930, 870, 1015, 109, 109, 929, 1014, 66,
167967
+ /* 1430 */ 66, 131, 131, 110, 451, 445, 569, 445, 416, 177,
167968
+ /* 1440 */ 1014, 132, 132, 67, 67, 568, 467, 568, 930, 471,
167969
+ /* 1450 */ 1360, 283, 226, 929, 315, 1359, 407, 568, 459, 407,
167970
+ /* 1460 */ 1014, 1014, 1016, 239, 407, 86, 213, 1346, 52, 52,
167971
+ /* 1470 */ 68, 68, 1014, 1014, 1016, 1017, 27, 1580, 1177, 447,
167972
+ /* 1480 */ 69, 69, 288, 97, 108, 1536, 106, 392, 392, 391,
167973
+ /* 1490 */ 273, 389, 568, 877, 847, 881, 568, 111, 560, 466,
167974
+ /* 1500 */ 4, 568, 152, 30, 38, 568, 1129, 234, 396, 323,
167547167975
/* 1510 */ 111, 560, 527, 4, 563, 53, 53, 322, 568, 163,
167548167976
/* 1520 */ 163, 568, 337, 468, 164, 164, 333, 563, 76, 76,
167549
- /* 1530 */ 568, 289, 1514, 568, 31, 1513, 568, 445, 338, 483,
167550
- /* 1540 */ 100, 54, 54, 344, 72, 72, 296, 236, 1080, 557,
167551
- /* 1550 */ 445, 879, 1360, 134, 134, 168, 73, 73, 141, 161,
167552
- /* 1560 */ 161, 1574, 557, 535, 568, 319, 568, 348, 536, 1009,
167553
- /* 1570 */ 473, 261, 261, 891, 890, 235, 535, 568, 1027, 568,
167977
+ /* 1530 */ 568, 289, 1509, 568, 31, 1508, 568, 445, 338, 483,
167978
+ /* 1540 */ 100, 54, 54, 344, 72, 72, 296, 236, 1077, 557,
167979
+ /* 1550 */ 445, 877, 1356, 134, 134, 168, 73, 73, 141, 161,
167980
+ /* 1560 */ 161, 1569, 557, 535, 568, 319, 568, 348, 536, 1007,
167981
+ /* 1570 */ 473, 261, 261, 889, 888, 235, 535, 568, 1024, 568,
167554167982
/* 1580 */ 475, 534, 261, 367, 109, 109, 521, 136, 136, 130,
167555
- /* 1590 */ 130, 1027, 110, 366, 445, 570, 569, 109, 109, 1017,
167556
- /* 1600 */ 162, 162, 156, 156, 568, 110, 1080, 445, 570, 569,
167557
- /* 1610 */ 410, 351, 1017, 568, 353, 316, 559, 568, 343, 568,
167558
- /* 1620 */ 100, 497, 357, 258, 100, 898, 899, 140, 140, 355,
167559
- /* 1630 */ 1310, 1017, 1017, 1019, 1020, 27, 139, 139, 362, 451,
167560
- /* 1640 */ 137, 137, 138, 138, 1017, 1017, 1019, 1020, 27, 1180,
167561
- /* 1650 */ 447, 568, 372, 288, 111, 560, 1021, 4, 392, 392,
167562
- /* 1660 */ 391, 273, 389, 568, 1141, 849, 568, 1076, 568, 258,
167563
- /* 1670 */ 492, 563, 568, 211, 75, 75, 555, 962, 234, 261,
167564
- /* 1680 */ 323, 111, 560, 929, 4, 113, 77, 77, 322, 74,
167565
- /* 1690 */ 74, 42, 42, 1373, 445, 48, 48, 1418, 563, 974,
167566
- /* 1700 */ 975, 1092, 1091, 1092, 1091, 862, 557, 150, 930, 1346,
167567
- /* 1710 */ 113, 1358, 554, 1424, 1021, 1275, 1266, 1254, 236, 1253,
167568
- /* 1720 */ 1255, 445, 1593, 1343, 308, 276, 168, 309, 11, 141,
167569
- /* 1730 */ 393, 310, 232, 557, 1405, 1027, 335, 291, 1400, 219,
167570
- /* 1740 */ 336, 109, 109, 936, 297, 1410, 235, 341, 477, 110,
167571
- /* 1750 */ 502, 445, 570, 569, 1393, 1409, 1017, 400, 1293, 365,
167572
- /* 1760 */ 223, 1486, 1027, 1485, 1355, 1356, 1354, 1353, 109, 109,
167573
- /* 1770 */ 204, 1596, 1232, 558, 265, 218, 110, 205, 445, 570,
167574
- /* 1780 */ 569, 410, 387, 1017, 1533, 179, 316, 559, 1017, 1017,
167575
- /* 1790 */ 1019, 1020, 27, 230, 1531, 1229, 79, 560, 85, 4,
167576
- /* 1800 */ 418, 215, 548, 81, 84, 188, 1406, 173, 181, 461,
167577
- /* 1810 */ 451, 35, 462, 563, 183, 1017, 1017, 1019, 1020, 27,
167578
- /* 1820 */ 184, 1491, 185, 186, 495, 242, 98, 398, 1412, 36,
167579
- /* 1830 */ 1411, 484, 91, 469, 401, 1414, 445, 192, 1480, 246,
167580
- /* 1840 */ 1502, 490, 346, 277, 248, 196, 493, 511, 557, 350,
167581
- /* 1850 */ 1256, 249, 250, 403, 1313, 1312, 111, 560, 432, 4,
167582
- /* 1860 */ 1311, 1304, 93, 1611, 883, 1610, 224, 404, 434, 520,
167583
- /* 1870 */ 263, 435, 1579, 563, 1283, 1282, 364, 1027, 306, 1281,
167584
- /* 1880 */ 264, 1609, 1565, 109, 109, 370, 1303, 307, 1564, 438,
167585
- /* 1890 */ 128, 110, 1378, 445, 570, 569, 445, 546, 1017, 10,
167586
- /* 1900 */ 1466, 105, 381, 1377, 34, 572, 99, 1336, 557, 314,
167587
- /* 1910 */ 1186, 530, 272, 274, 379, 210, 1335, 547, 385, 386,
167588
- /* 1920 */ 275, 573, 1251, 1246, 411, 412, 1518, 165, 178, 1519,
167589
- /* 1930 */ 1017, 1017, 1019, 1020, 27, 1517, 1516, 1027, 78, 147,
167590
- /* 1940 */ 166, 220, 221, 109, 109, 836, 304, 167, 446, 212,
167591
- /* 1950 */ 318, 110, 231, 445, 570, 569, 144, 1090, 1017, 1088,
167592
- /* 1960 */ 326, 180, 169, 1212, 182, 334, 238, 915, 241, 1104,
167983
+ /* 1590 */ 130, 1024, 110, 366, 445, 569, 445, 109, 109, 1014,
167984
+ /* 1600 */ 162, 162, 156, 156, 568, 110, 1077, 445, 569, 445,
167985
+ /* 1610 */ 410, 351, 1014, 568, 353, 316, 559, 568, 343, 568,
167986
+ /* 1620 */ 100, 497, 357, 258, 100, 896, 897, 140, 140, 355,
167987
+ /* 1630 */ 1306, 1014, 1014, 1016, 1017, 27, 139, 139, 362, 451,
167988
+ /* 1640 */ 137, 137, 138, 138, 1014, 1014, 1016, 1017, 27, 1177,
167989
+ /* 1650 */ 447, 568, 372, 288, 111, 560, 1018, 4, 392, 392,
167990
+ /* 1660 */ 391, 273, 389, 568, 1138, 847, 568, 1073, 568, 258,
167991
+ /* 1670 */ 492, 563, 568, 211, 75, 75, 555, 960, 234, 261,
167992
+ /* 1680 */ 323, 111, 560, 927, 4, 113, 77, 77, 322, 74,
167993
+ /* 1690 */ 74, 42, 42, 1369, 445, 48, 48, 1414, 563, 972,
167994
+ /* 1700 */ 973, 1089, 1088, 1089, 1088, 860, 557, 150, 928, 1342,
167995
+ /* 1710 */ 113, 1354, 554, 1419, 1018, 1271, 1262, 1250, 236, 1249,
167996
+ /* 1720 */ 1251, 445, 1588, 1339, 308, 276, 168, 309, 11, 141,
167997
+ /* 1730 */ 393, 310, 232, 557, 1401, 1024, 335, 291, 1396, 219,
167998
+ /* 1740 */ 336, 109, 109, 934, 297, 1406, 235, 341, 477, 110,
167999
+ /* 1750 */ 502, 445, 569, 445, 1389, 1405, 1014, 400, 1289, 365,
168000
+ /* 1760 */ 223, 1481, 1024, 1480, 1351, 1352, 1350, 1349, 109, 109,
168001
+ /* 1770 */ 204, 1591, 1228, 558, 265, 218, 110, 205, 445, 569,
168002
+ /* 1780 */ 445, 410, 387, 1014, 1528, 179, 316, 559, 1014, 1014,
168003
+ /* 1790 */ 1016, 1017, 27, 230, 1526, 1225, 79, 560, 85, 4,
168004
+ /* 1800 */ 418, 215, 548, 81, 84, 188, 1402, 173, 181, 461,
168005
+ /* 1810 */ 451, 35, 462, 563, 183, 1014, 1014, 1016, 1017, 27,
168006
+ /* 1820 */ 184, 1486, 185, 186, 495, 242, 98, 398, 1408, 36,
168007
+ /* 1830 */ 1407, 484, 91, 469, 401, 1410, 445, 192, 1475, 246,
168008
+ /* 1840 */ 1497, 490, 346, 277, 248, 196, 493, 511, 557, 350,
168009
+ /* 1850 */ 1252, 249, 250, 403, 1309, 1308, 111, 560, 432, 4,
168010
+ /* 1860 */ 1307, 1300, 93, 1605, 881, 1604, 224, 404, 434, 520,
168011
+ /* 1870 */ 263, 435, 1574, 563, 1279, 1278, 364, 1024, 306, 1277,
168012
+ /* 1880 */ 264, 1603, 1560, 109, 109, 370, 1299, 307, 1559, 438,
168013
+ /* 1890 */ 128, 110, 1374, 445, 569, 445, 445, 546, 1014, 10,
168014
+ /* 1900 */ 1461, 105, 381, 1373, 34, 571, 99, 1332, 557, 314,
168015
+ /* 1910 */ 1183, 530, 272, 274, 379, 210, 1331, 547, 385, 386,
168016
+ /* 1920 */ 275, 572, 1247, 1242, 411, 412, 1513, 165, 178, 1514,
168017
+ /* 1930 */ 1014, 1014, 1016, 1017, 27, 1512, 1511, 1024, 78, 147,
168018
+ /* 1940 */ 166, 220, 221, 109, 109, 834, 304, 167, 446, 212,
168019
+ /* 1950 */ 318, 110, 231, 445, 569, 445, 144, 1087, 1014, 1085,
168020
+ /* 1960 */ 326, 180, 169, 1208, 182, 334, 238, 913, 241, 1101,
167593168021
/* 1970 */ 187, 170, 171, 421, 87, 88, 423, 189, 89, 90,
167594
- /* 1980 */ 172, 1107, 243, 1103, 244, 158, 18, 245, 345, 247,
167595
- /* 1990 */ 1017, 1017, 1019, 1020, 27, 261, 1096, 193, 1226, 489,
167596
- /* 2000 */ 194, 37, 366, 851, 494, 251, 195, 506, 92, 19,
167597
- /* 2010 */ 498, 358, 20, 503, 881, 361, 94, 894, 305, 159,
167598
- /* 2020 */ 513, 39, 95, 1174, 160, 1056, 966, 1143, 96, 174,
167599
- /* 2030 */ 1142, 225, 280, 282, 198, 960, 113, 1164, 1160, 260,
167600
- /* 2040 */ 21, 22, 23, 1162, 1168, 1167, 1148, 24, 33, 25,
167601
- /* 2050 */ 202, 542, 26, 100, 1071, 102, 1057, 103, 7, 1055,
167602
- /* 2060 */ 1059, 1113, 1060, 1112, 266, 267, 28, 40, 390, 1022,
167603
- /* 2070 */ 863, 112, 29, 564, 1182, 1181, 268, 176, 143, 925,
167604
- /* 2080 */ 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242,
167605
- /* 2090 */ 1242, 1242, 1242, 1242, 269, 1602, 1242, 1601,
168022
+ /* 1980 */ 172, 1104, 243, 1100, 244, 158, 18, 245, 345, 247,
168023
+ /* 1990 */ 1014, 1014, 1016, 1017, 27, 261, 1093, 193, 1222, 489,
168024
+ /* 2000 */ 194, 37, 366, 849, 494, 251, 195, 506, 92, 19,
168025
+ /* 2010 */ 498, 358, 20, 503, 879, 361, 94, 892, 305, 159,
168026
+ /* 2020 */ 513, 39, 95, 1171, 160, 1053, 964, 1140, 96, 174,
168027
+ /* 2030 */ 1139, 225, 280, 282, 198, 958, 113, 1161, 1157, 260,
168028
+ /* 2040 */ 21, 22, 23, 1159, 1165, 1164, 1145, 24, 33, 25,
168029
+ /* 2050 */ 202, 542, 26, 100, 1068, 102, 1054, 103, 7, 1052,
168030
+ /* 2060 */ 1056, 1110, 1057, 1109, 266, 267, 28, 40, 390, 1019,
168031
+ /* 2070 */ 861, 112, 29, 564, 1179, 1178, 268, 176, 143, 923,
168032
+ /* 2080 */ 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238,
168033
+ /* 2090 */ 1238, 1238, 1238, 1238, 269, 1596,
167606168034
};
167607168035
static const YYCODETYPE yy_lookahead[] = {
167608168036
/* 0 */ 193, 193, 193, 274, 275, 276, 193, 274, 275, 276,
167609168037
/* 10 */ 193, 223, 219, 225, 206, 210, 211, 212, 193, 19,
167610168038
/* 20 */ 219, 233, 216, 216, 217, 216, 217, 193, 295, 216,
@@ -167812,11 +168240,11 @@
167812168240
/* 2040 */ 34, 34, 34, 86, 75, 93, 23, 34, 22, 34,
167813168241
/* 2050 */ 25, 24, 34, 25, 23, 142, 23, 142, 44, 23,
167814168242
/* 2060 */ 23, 23, 11, 23, 25, 22, 22, 22, 15, 23,
167815168243
/* 2070 */ 23, 22, 22, 25, 1, 1, 141, 25, 23, 135,
167816168244
/* 2080 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167817
- /* 2090 */ 319, 319, 319, 319, 141, 141, 319, 141, 319, 319,
168245
+ /* 2090 */ 319, 319, 319, 319, 141, 141, 319, 319, 319, 319,
167818168246
/* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167819168247
/* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167820168248
/* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167821168249
/* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167822168250
/* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
@@ -167831,13 +168259,13 @@
167831168259
/* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167832168260
/* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167833168261
/* 2250 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167834168262
/* 2260 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167835168263
/* 2270 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167836
- /* 2280 */ 319, 319, 319,
168264
+ /* 2280 */ 319,
167837168265
};
167838
-#define YY_SHIFT_COUNT (575)
168266
+#define YY_SHIFT_COUNT (574)
167839168267
#define YY_SHIFT_MIN (0)
167840168268
#define YY_SHIFT_MAX (2074)
167841168269
static const unsigned short int yy_shift_ofst[] = {
167842168270
/* 0 */ 1648, 1477, 1272, 322, 322, 1, 1319, 1478, 1491, 1837,
167843168271
/* 10 */ 1837, 1837, 471, 0, 0, 214, 1093, 1837, 1837, 1837,
@@ -167853,16 +168281,16 @@
167853168281
/* 110 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
167854168282
/* 120 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
167855168283
/* 130 */ 137, 181, 181, 181, 181, 181, 181, 181, 94, 430,
167856168284
/* 140 */ 66, 65, 112, 366, 533, 533, 740, 1261, 533, 533,
167857168285
/* 150 */ 79, 79, 533, 412, 412, 412, 77, 412, 123, 113,
167858
- /* 160 */ 113, 22, 22, 2098, 2098, 328, 328, 328, 239, 468,
168286
+ /* 160 */ 113, 22, 22, 2096, 2096, 328, 328, 328, 239, 468,
167859168287
/* 170 */ 468, 468, 468, 1015, 1015, 409, 366, 1129, 1186, 533,
167860168288
/* 180 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167861168289
/* 190 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 969,
167862168290
/* 200 */ 621, 621, 533, 642, 788, 788, 1228, 1228, 822, 822,
167863
- /* 210 */ 67, 1274, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 1307,
168291
+ /* 210 */ 67, 1274, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 1307,
167864168292
/* 220 */ 954, 954, 585, 472, 640, 387, 695, 538, 541, 700,
167865168293
/* 230 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167866168294
/* 240 */ 222, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167867168295
/* 250 */ 533, 533, 533, 1179, 1179, 1179, 533, 533, 533, 565,
167868168296
/* 260 */ 533, 533, 533, 916, 1144, 533, 533, 1288, 533, 533,
@@ -167876,12 +168304,12 @@
167876168304
/* 340 */ 1764, 1677, 1764, 1677, 1633, 1806, 1674, 1779, 1633, 1806,
167877168305
/* 350 */ 1823, 1633, 1806, 1633, 1806, 1823, 1732, 1732, 1732, 1794,
167878168306
/* 360 */ 1840, 1840, 1823, 1732, 1738, 1732, 1794, 1732, 1732, 1701,
167879168307
/* 370 */ 1844, 1758, 1758, 1823, 1633, 1789, 1789, 1807, 1807, 1742,
167880168308
/* 380 */ 1752, 1877, 1633, 1743, 1742, 1759, 1765, 1677, 1879, 1897,
167881
- /* 390 */ 1897, 1914, 1914, 1914, 2098, 2098, 2098, 2098, 2098, 2098,
167882
- /* 400 */ 2098, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 207,
168309
+ /* 390 */ 1897, 1914, 1914, 1914, 2096, 2096, 2096, 2096, 2096, 2096,
168310
+ /* 400 */ 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 207,
167883168311
/* 410 */ 1095, 331, 620, 903, 806, 1074, 1483, 1432, 1481, 1322,
167884168312
/* 420 */ 1370, 1394, 1515, 1291, 1546, 1547, 1557, 1595, 1598, 1599,
167885168313
/* 430 */ 1434, 1453, 1618, 1462, 1567, 1489, 1644, 1654, 1616, 1660,
167886168314
/* 440 */ 1548, 1549, 1682, 1685, 1597, 742, 1941, 1945, 1927, 1787,
167887168315
/* 450 */ 1937, 1940, 1934, 1936, 1821, 1810, 1832, 1938, 1938, 1942,
@@ -167894,11 +168322,11 @@
167894168322
/* 520 */ 1999, 1933, 1890, 2009, 2010, 1910, 2005, 2012, 1892, 2011,
167895168323
/* 530 */ 2006, 2007, 2008, 2013, 1950, 1962, 1957, 2014, 1969, 1952,
167896168324
/* 540 */ 2015, 2023, 2026, 2027, 2025, 2028, 2018, 1913, 1915, 2031,
167897168325
/* 550 */ 2011, 2033, 2036, 2037, 2038, 2039, 2040, 2043, 2051, 2044,
167898168326
/* 560 */ 2045, 2046, 2047, 2049, 2050, 2048, 1944, 1935, 1953, 1954,
167899
- /* 570 */ 1956, 2052, 2055, 2053, 2073, 2074,
168327
+ /* 570 */ 2052, 2055, 2053, 2073, 2074,
167900168328
};
167901168329
#define YY_REDUCE_COUNT (408)
167902168330
#define YY_REDUCE_MIN (-271)
167903168331
#define YY_REDUCE_MAX (1740)
167904168332
static const short yy_reduce_ofst[] = {
@@ -167943,68 +168371,68 @@
167943168371
/* 380 */ 1665, 1623, 1702, 1630, 1666, 1667, 1671, 1673, 1703, 1718,
167944168372
/* 390 */ 1719, 1729, 1730, 1731, 1621, 1622, 1628, 1720, 1713, 1716,
167945168373
/* 400 */ 1722, 1723, 1733, 1717, 1724, 1727, 1728, 1725, 1740,
167946168374
};
167947168375
static const YYACTIONTYPE yy_default[] = {
167948
- /* 0 */ 1647, 1647, 1647, 1475, 1240, 1351, 1240, 1240, 1240, 1475,
167949
- /* 10 */ 1475, 1475, 1240, 1381, 1381, 1528, 1273, 1240, 1240, 1240,
167950
- /* 20 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1474, 1240, 1240,
167951
- /* 30 */ 1240, 1240, 1563, 1563, 1240, 1240, 1240, 1240, 1240, 1240,
167952
- /* 40 */ 1240, 1240, 1390, 1240, 1397, 1240, 1240, 1240, 1240, 1240,
167953
- /* 50 */ 1476, 1477, 1240, 1240, 1240, 1527, 1529, 1492, 1404, 1403,
167954
- /* 60 */ 1402, 1401, 1510, 1369, 1395, 1388, 1392, 1470, 1471, 1469,
167955
- /* 70 */ 1473, 1477, 1476, 1240, 1391, 1438, 1454, 1437, 1240, 1240,
167956
- /* 80 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167957
- /* 90 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167958
- /* 100 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167959
- /* 110 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167960
- /* 120 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167961
- /* 130 */ 1446, 1453, 1452, 1451, 1460, 1450, 1447, 1440, 1439, 1441,
167962
- /* 140 */ 1442, 1240, 1240, 1264, 1240, 1240, 1261, 1315, 1240, 1240,
167963
- /* 150 */ 1240, 1240, 1240, 1547, 1546, 1240, 1443, 1240, 1273, 1432,
167964
- /* 160 */ 1431, 1457, 1444, 1456, 1455, 1535, 1599, 1598, 1493, 1240,
167965
- /* 170 */ 1240, 1240, 1240, 1240, 1240, 1563, 1240, 1240, 1240, 1240,
167966
- /* 180 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167967
- /* 190 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1371,
167968
- /* 200 */ 1563, 1563, 1240, 1273, 1563, 1563, 1372, 1372, 1269, 1269,
167969
- /* 210 */ 1375, 1240, 1542, 1342, 1342, 1342, 1342, 1351, 1342, 1240,
167970
- /* 220 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167971
- /* 230 */ 1240, 1240, 1240, 1240, 1532, 1530, 1240, 1240, 1240, 1240,
167972
- /* 240 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167973
- /* 250 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167974
- /* 260 */ 1240, 1240, 1240, 1347, 1240, 1240, 1240, 1240, 1240, 1240,
167975
- /* 270 */ 1240, 1240, 1240, 1240, 1240, 1592, 1240, 1505, 1329, 1347,
167976
- /* 280 */ 1347, 1347, 1347, 1349, 1330, 1328, 1341, 1274, 1247, 1639,
167977
- /* 290 */ 1407, 1396, 1348, 1396, 1636, 1394, 1407, 1407, 1394, 1407,
167978
- /* 300 */ 1348, 1636, 1290, 1615, 1285, 1381, 1381, 1381, 1371, 1371,
167979
- /* 310 */ 1371, 1371, 1375, 1375, 1472, 1348, 1341, 1240, 1639, 1639,
167980
- /* 320 */ 1357, 1357, 1638, 1638, 1357, 1493, 1623, 1416, 1318, 1324,
167981
- /* 330 */ 1324, 1324, 1324, 1357, 1258, 1394, 1623, 1623, 1394, 1416,
167982
- /* 340 */ 1318, 1394, 1318, 1394, 1357, 1258, 1509, 1633, 1357, 1258,
167983
- /* 350 */ 1483, 1357, 1258, 1357, 1258, 1483, 1316, 1316, 1316, 1305,
167984
- /* 360 */ 1240, 1240, 1483, 1316, 1290, 1316, 1305, 1316, 1316, 1581,
167985
- /* 370 */ 1240, 1487, 1487, 1483, 1357, 1573, 1573, 1384, 1384, 1389,
167986
- /* 380 */ 1375, 1478, 1357, 1240, 1389, 1387, 1385, 1394, 1308, 1595,
167987
- /* 390 */ 1595, 1591, 1591, 1591, 1644, 1644, 1542, 1608, 1273, 1273,
167988
- /* 400 */ 1273, 1273, 1608, 1292, 1292, 1274, 1274, 1273, 1608, 1240,
167989
- /* 410 */ 1240, 1240, 1240, 1240, 1240, 1603, 1240, 1537, 1494, 1361,
167990
- /* 420 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167991
- /* 430 */ 1240, 1240, 1240, 1240, 1548, 1240, 1240, 1240, 1240, 1240,
167992
- /* 440 */ 1240, 1240, 1240, 1240, 1240, 1421, 1240, 1243, 1539, 1240,
167993
- /* 450 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1398, 1399, 1362,
167994
- /* 460 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1413, 1240, 1240,
167995
- /* 470 */ 1240, 1408, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167996
- /* 480 */ 1635, 1240, 1240, 1240, 1240, 1240, 1240, 1508, 1507, 1240,
167997
- /* 490 */ 1240, 1359, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167998
- /* 500 */ 1240, 1240, 1240, 1240, 1240, 1288, 1240, 1240, 1240, 1240,
167999
- /* 510 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
168000
- /* 520 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1386,
168001
- /* 530 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
168002
- /* 540 */ 1240, 1240, 1240, 1240, 1578, 1376, 1240, 1240, 1240, 1240,
168003
- /* 550 */ 1626, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
168004
- /* 560 */ 1240, 1240, 1240, 1240, 1240, 1619, 1332, 1423, 1240, 1422,
168005
- /* 570 */ 1426, 1262, 1240, 1252, 1240, 1240,
168376
+ /* 0 */ 1641, 1641, 1641, 1470, 1236, 1347, 1236, 1236, 1236, 1470,
168377
+ /* 10 */ 1470, 1470, 1236, 1377, 1377, 1523, 1269, 1236, 1236, 1236,
168378
+ /* 20 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1469, 1236, 1236,
168379
+ /* 30 */ 1236, 1236, 1558, 1558, 1236, 1236, 1236, 1236, 1236, 1236,
168380
+ /* 40 */ 1236, 1236, 1386, 1236, 1393, 1236, 1236, 1236, 1236, 1236,
168381
+ /* 50 */ 1471, 1472, 1236, 1236, 1236, 1522, 1524, 1487, 1400, 1399,
168382
+ /* 60 */ 1398, 1397, 1505, 1365, 1391, 1384, 1388, 1465, 1466, 1464,
168383
+ /* 70 */ 1468, 1472, 1471, 1236, 1387, 1433, 1449, 1432, 1236, 1236,
168384
+ /* 80 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168385
+ /* 90 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168386
+ /* 100 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168387
+ /* 110 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168388
+ /* 120 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168389
+ /* 130 */ 1441, 1448, 1447, 1446, 1455, 1445, 1442, 1435, 1434, 1436,
168390
+ /* 140 */ 1437, 1236, 1236, 1260, 1236, 1236, 1257, 1311, 1236, 1236,
168391
+ /* 150 */ 1236, 1236, 1236, 1542, 1541, 1236, 1438, 1236, 1269, 1427,
168392
+ /* 160 */ 1426, 1452, 1439, 1451, 1450, 1530, 1594, 1593, 1488, 1236,
168393
+ /* 170 */ 1236, 1236, 1236, 1236, 1236, 1558, 1236, 1236, 1236, 1236,
168394
+ /* 180 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168395
+ /* 190 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1367,
168396
+ /* 200 */ 1558, 1558, 1236, 1269, 1558, 1558, 1368, 1368, 1265, 1265,
168397
+ /* 210 */ 1371, 1236, 1537, 1338, 1338, 1338, 1338, 1347, 1338, 1236,
168398
+ /* 220 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168399
+ /* 230 */ 1236, 1236, 1236, 1236, 1527, 1525, 1236, 1236, 1236, 1236,
168400
+ /* 240 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168401
+ /* 250 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168402
+ /* 260 */ 1236, 1236, 1236, 1343, 1236, 1236, 1236, 1236, 1236, 1236,
168403
+ /* 270 */ 1236, 1236, 1236, 1236, 1236, 1587, 1236, 1500, 1325, 1343,
168404
+ /* 280 */ 1343, 1343, 1343, 1345, 1326, 1324, 1337, 1270, 1243, 1633,
168405
+ /* 290 */ 1403, 1392, 1344, 1392, 1630, 1390, 1403, 1403, 1390, 1403,
168406
+ /* 300 */ 1344, 1630, 1286, 1609, 1281, 1377, 1377, 1377, 1367, 1367,
168407
+ /* 310 */ 1367, 1367, 1371, 1371, 1467, 1344, 1337, 1236, 1633, 1633,
168408
+ /* 320 */ 1353, 1353, 1632, 1632, 1353, 1488, 1617, 1412, 1314, 1320,
168409
+ /* 330 */ 1320, 1320, 1320, 1353, 1254, 1390, 1617, 1617, 1390, 1412,
168410
+ /* 340 */ 1314, 1390, 1314, 1390, 1353, 1254, 1504, 1627, 1353, 1254,
168411
+ /* 350 */ 1478, 1353, 1254, 1353, 1254, 1478, 1312, 1312, 1312, 1301,
168412
+ /* 360 */ 1236, 1236, 1478, 1312, 1286, 1312, 1301, 1312, 1312, 1576,
168413
+ /* 370 */ 1236, 1482, 1482, 1478, 1353, 1568, 1568, 1380, 1380, 1385,
168414
+ /* 380 */ 1371, 1473, 1353, 1236, 1385, 1383, 1381, 1390, 1304, 1590,
168415
+ /* 390 */ 1590, 1586, 1586, 1586, 1638, 1638, 1537, 1602, 1269, 1269,
168416
+ /* 400 */ 1269, 1269, 1602, 1288, 1288, 1270, 1270, 1269, 1602, 1236,
168417
+ /* 410 */ 1236, 1236, 1236, 1236, 1236, 1597, 1236, 1532, 1489, 1357,
168418
+ /* 420 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168419
+ /* 430 */ 1236, 1236, 1236, 1236, 1543, 1236, 1236, 1236, 1236, 1236,
168420
+ /* 440 */ 1236, 1236, 1236, 1236, 1236, 1417, 1236, 1239, 1534, 1236,
168421
+ /* 450 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1394, 1395, 1358,
168422
+ /* 460 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1409, 1236, 1236,
168423
+ /* 470 */ 1236, 1404, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168424
+ /* 480 */ 1629, 1236, 1236, 1236, 1236, 1236, 1236, 1503, 1502, 1236,
168425
+ /* 490 */ 1236, 1355, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168426
+ /* 500 */ 1236, 1236, 1236, 1236, 1236, 1284, 1236, 1236, 1236, 1236,
168427
+ /* 510 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168428
+ /* 520 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1382,
168429
+ /* 530 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168430
+ /* 540 */ 1236, 1236, 1236, 1236, 1573, 1372, 1236, 1236, 1236, 1236,
168431
+ /* 550 */ 1620, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168432
+ /* 560 */ 1236, 1236, 1236, 1236, 1236, 1613, 1328, 1418, 1236, 1421,
168433
+ /* 570 */ 1258, 1236, 1248, 1236, 1236,
168006168434
};
168007168435
/********** End of lemon-generated parsing tables *****************************/
168008168436
168009168437
/* The next table maps tokens (terminal symbols) into fallback tokens.
168010168438
** If a construct like the following:
@@ -168797,237 +169225,235 @@
168797169225
/* 173 */ "idlist_opt ::=",
168798169226
/* 174 */ "idlist_opt ::= LP idlist RP",
168799169227
/* 175 */ "idlist ::= idlist COMMA nm",
168800169228
/* 176 */ "idlist ::= nm",
168801169229
/* 177 */ "expr ::= LP expr RP",
168802
- /* 178 */ "expr ::= ID|INDEXED",
168803
- /* 179 */ "expr ::= JOIN_KW",
168804
- /* 180 */ "expr ::= nm DOT nm",
168805
- /* 181 */ "expr ::= nm DOT nm DOT nm",
168806
- /* 182 */ "term ::= NULL|FLOAT|BLOB",
168807
- /* 183 */ "term ::= STRING",
168808
- /* 184 */ "term ::= INTEGER",
168809
- /* 185 */ "expr ::= VARIABLE",
168810
- /* 186 */ "expr ::= expr COLLATE ID|STRING",
168811
- /* 187 */ "expr ::= CAST LP expr AS typetoken RP",
168812
- /* 188 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
168813
- /* 189 */ "expr ::= ID|INDEXED LP STAR RP",
168814
- /* 190 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over",
168815
- /* 191 */ "expr ::= ID|INDEXED LP STAR RP filter_over",
168816
- /* 192 */ "term ::= CTIME_KW",
168817
- /* 193 */ "expr ::= LP nexprlist COMMA expr RP",
168818
- /* 194 */ "expr ::= expr AND expr",
168819
- /* 195 */ "expr ::= expr OR expr",
168820
- /* 196 */ "expr ::= expr LT|GT|GE|LE expr",
168821
- /* 197 */ "expr ::= expr EQ|NE expr",
168822
- /* 198 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
168823
- /* 199 */ "expr ::= expr PLUS|MINUS expr",
168824
- /* 200 */ "expr ::= expr STAR|SLASH|REM expr",
168825
- /* 201 */ "expr ::= expr CONCAT expr",
168826
- /* 202 */ "likeop ::= NOT LIKE_KW|MATCH",
168827
- /* 203 */ "expr ::= expr likeop expr",
168828
- /* 204 */ "expr ::= expr likeop expr ESCAPE expr",
168829
- /* 205 */ "expr ::= expr ISNULL|NOTNULL",
168830
- /* 206 */ "expr ::= expr NOT NULL",
168831
- /* 207 */ "expr ::= expr IS expr",
168832
- /* 208 */ "expr ::= expr IS NOT expr",
168833
- /* 209 */ "expr ::= expr IS NOT DISTINCT FROM expr",
168834
- /* 210 */ "expr ::= expr IS DISTINCT FROM expr",
168835
- /* 211 */ "expr ::= NOT expr",
168836
- /* 212 */ "expr ::= BITNOT expr",
168837
- /* 213 */ "expr ::= PLUS|MINUS expr",
168838
- /* 214 */ "expr ::= expr PTR expr",
168839
- /* 215 */ "between_op ::= BETWEEN",
168840
- /* 216 */ "between_op ::= NOT BETWEEN",
168841
- /* 217 */ "expr ::= expr between_op expr AND expr",
168842
- /* 218 */ "in_op ::= IN",
168843
- /* 219 */ "in_op ::= NOT IN",
168844
- /* 220 */ "expr ::= expr in_op LP exprlist RP",
168845
- /* 221 */ "expr ::= LP select RP",
168846
- /* 222 */ "expr ::= expr in_op LP select RP",
168847
- /* 223 */ "expr ::= expr in_op nm dbnm paren_exprlist",
168848
- /* 224 */ "expr ::= EXISTS LP select RP",
168849
- /* 225 */ "expr ::= CASE case_operand case_exprlist case_else END",
168850
- /* 226 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
168851
- /* 227 */ "case_exprlist ::= WHEN expr THEN expr",
168852
- /* 228 */ "case_else ::= ELSE expr",
168853
- /* 229 */ "case_else ::=",
168854
- /* 230 */ "case_operand ::= expr",
168855
- /* 231 */ "case_operand ::=",
168856
- /* 232 */ "exprlist ::=",
168857
- /* 233 */ "nexprlist ::= nexprlist COMMA expr",
168858
- /* 234 */ "nexprlist ::= expr",
168859
- /* 235 */ "paren_exprlist ::=",
168860
- /* 236 */ "paren_exprlist ::= LP exprlist RP",
168861
- /* 237 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
168862
- /* 238 */ "uniqueflag ::= UNIQUE",
168863
- /* 239 */ "uniqueflag ::=",
168864
- /* 240 */ "eidlist_opt ::=",
168865
- /* 241 */ "eidlist_opt ::= LP eidlist RP",
168866
- /* 242 */ "eidlist ::= eidlist COMMA nm collate sortorder",
168867
- /* 243 */ "eidlist ::= nm collate sortorder",
168868
- /* 244 */ "collate ::=",
168869
- /* 245 */ "collate ::= COLLATE ID|STRING",
168870
- /* 246 */ "cmd ::= DROP INDEX ifexists fullname",
168871
- /* 247 */ "cmd ::= VACUUM vinto",
168872
- /* 248 */ "cmd ::= VACUUM nm vinto",
168873
- /* 249 */ "vinto ::= INTO expr",
168874
- /* 250 */ "vinto ::=",
168875
- /* 251 */ "cmd ::= PRAGMA nm dbnm",
168876
- /* 252 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
168877
- /* 253 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
168878
- /* 254 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
168879
- /* 255 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
168880
- /* 256 */ "plus_num ::= PLUS INTEGER|FLOAT",
168881
- /* 257 */ "minus_num ::= MINUS INTEGER|FLOAT",
168882
- /* 258 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
168883
- /* 259 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
168884
- /* 260 */ "trigger_time ::= BEFORE|AFTER",
168885
- /* 261 */ "trigger_time ::= INSTEAD OF",
168886
- /* 262 */ "trigger_time ::=",
168887
- /* 263 */ "trigger_event ::= DELETE|INSERT",
168888
- /* 264 */ "trigger_event ::= UPDATE",
168889
- /* 265 */ "trigger_event ::= UPDATE OF idlist",
168890
- /* 266 */ "when_clause ::=",
168891
- /* 267 */ "when_clause ::= WHEN expr",
168892
- /* 268 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
168893
- /* 269 */ "trigger_cmd_list ::= trigger_cmd SEMI",
168894
- /* 270 */ "trnm ::= nm DOT nm",
168895
- /* 271 */ "tridxby ::= INDEXED BY nm",
168896
- /* 272 */ "tridxby ::= NOT INDEXED",
168897
- /* 273 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
168898
- /* 274 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
168899
- /* 275 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
168900
- /* 276 */ "trigger_cmd ::= scanpt select scanpt",
168901
- /* 277 */ "expr ::= RAISE LP IGNORE RP",
168902
- /* 278 */ "expr ::= RAISE LP raisetype COMMA nm RP",
168903
- /* 279 */ "raisetype ::= ROLLBACK",
168904
- /* 280 */ "raisetype ::= ABORT",
168905
- /* 281 */ "raisetype ::= FAIL",
168906
- /* 282 */ "cmd ::= DROP TRIGGER ifexists fullname",
168907
- /* 283 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
168908
- /* 284 */ "cmd ::= DETACH database_kw_opt expr",
168909
- /* 285 */ "key_opt ::=",
168910
- /* 286 */ "key_opt ::= KEY expr",
168911
- /* 287 */ "cmd ::= REINDEX",
168912
- /* 288 */ "cmd ::= REINDEX nm dbnm",
168913
- /* 289 */ "cmd ::= ANALYZE",
168914
- /* 290 */ "cmd ::= ANALYZE nm dbnm",
168915
- /* 291 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
168916
- /* 292 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
168917
- /* 293 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
168918
- /* 294 */ "add_column_fullname ::= fullname",
168919
- /* 295 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
168920
- /* 296 */ "cmd ::= create_vtab",
168921
- /* 297 */ "cmd ::= create_vtab LP vtabarglist RP",
168922
- /* 298 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
168923
- /* 299 */ "vtabarg ::=",
168924
- /* 300 */ "vtabargtoken ::= ANY",
168925
- /* 301 */ "vtabargtoken ::= lp anylist RP",
168926
- /* 302 */ "lp ::= LP",
168927
- /* 303 */ "with ::= WITH wqlist",
168928
- /* 304 */ "with ::= WITH RECURSIVE wqlist",
168929
- /* 305 */ "wqas ::= AS",
168930
- /* 306 */ "wqas ::= AS MATERIALIZED",
168931
- /* 307 */ "wqas ::= AS NOT MATERIALIZED",
168932
- /* 308 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
168933
- /* 309 */ "wqlist ::= wqitem",
168934
- /* 310 */ "wqlist ::= wqlist COMMA wqitem",
168935
- /* 311 */ "windowdefn_list ::= windowdefn",
168936
- /* 312 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
168937
- /* 313 */ "windowdefn ::= nm AS LP window RP",
168938
- /* 314 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
168939
- /* 315 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
168940
- /* 316 */ "window ::= ORDER BY sortlist frame_opt",
168941
- /* 317 */ "window ::= nm ORDER BY sortlist frame_opt",
168942
- /* 318 */ "window ::= frame_opt",
168943
- /* 319 */ "window ::= nm frame_opt",
168944
- /* 320 */ "frame_opt ::=",
168945
- /* 321 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
168946
- /* 322 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
168947
- /* 323 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
168948
- /* 324 */ "frame_bound_s ::= frame_bound",
168949
- /* 325 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
168950
- /* 326 */ "frame_bound_e ::= frame_bound",
168951
- /* 327 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
168952
- /* 328 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
168953
- /* 329 */ "frame_bound ::= CURRENT ROW",
168954
- /* 330 */ "frame_exclude_opt ::=",
168955
- /* 331 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
168956
- /* 332 */ "frame_exclude ::= NO OTHERS",
168957
- /* 333 */ "frame_exclude ::= CURRENT ROW",
168958
- /* 334 */ "frame_exclude ::= GROUP|TIES",
168959
- /* 335 */ "window_clause ::= WINDOW windowdefn_list",
168960
- /* 336 */ "filter_over ::= filter_clause over_clause",
168961
- /* 337 */ "filter_over ::= over_clause",
168962
- /* 338 */ "filter_over ::= filter_clause",
168963
- /* 339 */ "over_clause ::= OVER LP window RP",
168964
- /* 340 */ "over_clause ::= OVER nm",
168965
- /* 341 */ "filter_clause ::= FILTER LP WHERE expr RP",
168966
- /* 342 */ "input ::= cmdlist",
168967
- /* 343 */ "cmdlist ::= cmdlist ecmd",
168968
- /* 344 */ "cmdlist ::= ecmd",
168969
- /* 345 */ "ecmd ::= SEMI",
168970
- /* 346 */ "ecmd ::= cmdx SEMI",
168971
- /* 347 */ "ecmd ::= explain cmdx SEMI",
168972
- /* 348 */ "trans_opt ::=",
168973
- /* 349 */ "trans_opt ::= TRANSACTION",
168974
- /* 350 */ "trans_opt ::= TRANSACTION nm",
168975
- /* 351 */ "savepoint_opt ::= SAVEPOINT",
168976
- /* 352 */ "savepoint_opt ::=",
168977
- /* 353 */ "cmd ::= create_table create_table_args",
168978
- /* 354 */ "table_option_set ::= table_option",
168979
- /* 355 */ "columnlist ::= columnlist COMMA columnname carglist",
168980
- /* 356 */ "columnlist ::= columnname carglist",
168981
- /* 357 */ "nm ::= ID|INDEXED",
168982
- /* 358 */ "nm ::= STRING",
168983
- /* 359 */ "nm ::= JOIN_KW",
168984
- /* 360 */ "typetoken ::= typename",
168985
- /* 361 */ "typename ::= ID|STRING",
168986
- /* 362 */ "signed ::= plus_num",
168987
- /* 363 */ "signed ::= minus_num",
168988
- /* 364 */ "carglist ::= carglist ccons",
168989
- /* 365 */ "carglist ::=",
168990
- /* 366 */ "ccons ::= NULL onconf",
168991
- /* 367 */ "ccons ::= GENERATED ALWAYS AS generated",
168992
- /* 368 */ "ccons ::= AS generated",
168993
- /* 369 */ "conslist_opt ::= COMMA conslist",
168994
- /* 370 */ "conslist ::= conslist tconscomma tcons",
168995
- /* 371 */ "conslist ::= tcons",
168996
- /* 372 */ "tconscomma ::=",
168997
- /* 373 */ "defer_subclause_opt ::= defer_subclause",
168998
- /* 374 */ "resolvetype ::= raisetype",
168999
- /* 375 */ "selectnowith ::= oneselect",
169000
- /* 376 */ "oneselect ::= values",
169001
- /* 377 */ "sclp ::= selcollist COMMA",
169002
- /* 378 */ "as ::= ID|STRING",
169003
- /* 379 */ "indexed_opt ::= indexed_by",
169004
- /* 380 */ "returning ::=",
169005
- /* 381 */ "expr ::= term",
169006
- /* 382 */ "likeop ::= LIKE_KW|MATCH",
169007
- /* 383 */ "exprlist ::= nexprlist",
169008
- /* 384 */ "nmnum ::= plus_num",
169009
- /* 385 */ "nmnum ::= nm",
169010
- /* 386 */ "nmnum ::= ON",
169011
- /* 387 */ "nmnum ::= DELETE",
169012
- /* 388 */ "nmnum ::= DEFAULT",
169013
- /* 389 */ "plus_num ::= INTEGER|FLOAT",
169014
- /* 390 */ "foreach_clause ::=",
169015
- /* 391 */ "foreach_clause ::= FOR EACH ROW",
169016
- /* 392 */ "trnm ::= nm",
169017
- /* 393 */ "tridxby ::=",
169018
- /* 394 */ "database_kw_opt ::= DATABASE",
169019
- /* 395 */ "database_kw_opt ::=",
169020
- /* 396 */ "kwcolumn_opt ::=",
169021
- /* 397 */ "kwcolumn_opt ::= COLUMNKW",
169022
- /* 398 */ "vtabarglist ::= vtabarg",
169023
- /* 399 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
169024
- /* 400 */ "vtabarg ::= vtabarg vtabargtoken",
169025
- /* 401 */ "anylist ::=",
169026
- /* 402 */ "anylist ::= anylist LP anylist RP",
169027
- /* 403 */ "anylist ::= anylist ANY",
169028
- /* 404 */ "with ::=",
169230
+ /* 178 */ "expr ::= ID|INDEXED|JOIN_KW",
169231
+ /* 179 */ "expr ::= nm DOT nm",
169232
+ /* 180 */ "expr ::= nm DOT nm DOT nm",
169233
+ /* 181 */ "term ::= NULL|FLOAT|BLOB",
169234
+ /* 182 */ "term ::= STRING",
169235
+ /* 183 */ "term ::= INTEGER",
169236
+ /* 184 */ "expr ::= VARIABLE",
169237
+ /* 185 */ "expr ::= expr COLLATE ID|STRING",
169238
+ /* 186 */ "expr ::= CAST LP expr AS typetoken RP",
169239
+ /* 187 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP",
169240
+ /* 188 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP",
169241
+ /* 189 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over",
169242
+ /* 190 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over",
169243
+ /* 191 */ "term ::= CTIME_KW",
169244
+ /* 192 */ "expr ::= LP nexprlist COMMA expr RP",
169245
+ /* 193 */ "expr ::= expr AND expr",
169246
+ /* 194 */ "expr ::= expr OR expr",
169247
+ /* 195 */ "expr ::= expr LT|GT|GE|LE expr",
169248
+ /* 196 */ "expr ::= expr EQ|NE expr",
169249
+ /* 197 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
169250
+ /* 198 */ "expr ::= expr PLUS|MINUS expr",
169251
+ /* 199 */ "expr ::= expr STAR|SLASH|REM expr",
169252
+ /* 200 */ "expr ::= expr CONCAT expr",
169253
+ /* 201 */ "likeop ::= NOT LIKE_KW|MATCH",
169254
+ /* 202 */ "expr ::= expr likeop expr",
169255
+ /* 203 */ "expr ::= expr likeop expr ESCAPE expr",
169256
+ /* 204 */ "expr ::= expr ISNULL|NOTNULL",
169257
+ /* 205 */ "expr ::= expr NOT NULL",
169258
+ /* 206 */ "expr ::= expr IS expr",
169259
+ /* 207 */ "expr ::= expr IS NOT expr",
169260
+ /* 208 */ "expr ::= expr IS NOT DISTINCT FROM expr",
169261
+ /* 209 */ "expr ::= expr IS DISTINCT FROM expr",
169262
+ /* 210 */ "expr ::= NOT expr",
169263
+ /* 211 */ "expr ::= BITNOT expr",
169264
+ /* 212 */ "expr ::= PLUS|MINUS expr",
169265
+ /* 213 */ "expr ::= expr PTR expr",
169266
+ /* 214 */ "between_op ::= BETWEEN",
169267
+ /* 215 */ "between_op ::= NOT BETWEEN",
169268
+ /* 216 */ "expr ::= expr between_op expr AND expr",
169269
+ /* 217 */ "in_op ::= IN",
169270
+ /* 218 */ "in_op ::= NOT IN",
169271
+ /* 219 */ "expr ::= expr in_op LP exprlist RP",
169272
+ /* 220 */ "expr ::= LP select RP",
169273
+ /* 221 */ "expr ::= expr in_op LP select RP",
169274
+ /* 222 */ "expr ::= expr in_op nm dbnm paren_exprlist",
169275
+ /* 223 */ "expr ::= EXISTS LP select RP",
169276
+ /* 224 */ "expr ::= CASE case_operand case_exprlist case_else END",
169277
+ /* 225 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
169278
+ /* 226 */ "case_exprlist ::= WHEN expr THEN expr",
169279
+ /* 227 */ "case_else ::= ELSE expr",
169280
+ /* 228 */ "case_else ::=",
169281
+ /* 229 */ "case_operand ::= expr",
169282
+ /* 230 */ "case_operand ::=",
169283
+ /* 231 */ "exprlist ::=",
169284
+ /* 232 */ "nexprlist ::= nexprlist COMMA expr",
169285
+ /* 233 */ "nexprlist ::= expr",
169286
+ /* 234 */ "paren_exprlist ::=",
169287
+ /* 235 */ "paren_exprlist ::= LP exprlist RP",
169288
+ /* 236 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
169289
+ /* 237 */ "uniqueflag ::= UNIQUE",
169290
+ /* 238 */ "uniqueflag ::=",
169291
+ /* 239 */ "eidlist_opt ::=",
169292
+ /* 240 */ "eidlist_opt ::= LP eidlist RP",
169293
+ /* 241 */ "eidlist ::= eidlist COMMA nm collate sortorder",
169294
+ /* 242 */ "eidlist ::= nm collate sortorder",
169295
+ /* 243 */ "collate ::=",
169296
+ /* 244 */ "collate ::= COLLATE ID|STRING",
169297
+ /* 245 */ "cmd ::= DROP INDEX ifexists fullname",
169298
+ /* 246 */ "cmd ::= VACUUM vinto",
169299
+ /* 247 */ "cmd ::= VACUUM nm vinto",
169300
+ /* 248 */ "vinto ::= INTO expr",
169301
+ /* 249 */ "vinto ::=",
169302
+ /* 250 */ "cmd ::= PRAGMA nm dbnm",
169303
+ /* 251 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
169304
+ /* 252 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
169305
+ /* 253 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
169306
+ /* 254 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
169307
+ /* 255 */ "plus_num ::= PLUS INTEGER|FLOAT",
169308
+ /* 256 */ "minus_num ::= MINUS INTEGER|FLOAT",
169309
+ /* 257 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
169310
+ /* 258 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
169311
+ /* 259 */ "trigger_time ::= BEFORE|AFTER",
169312
+ /* 260 */ "trigger_time ::= INSTEAD OF",
169313
+ /* 261 */ "trigger_time ::=",
169314
+ /* 262 */ "trigger_event ::= DELETE|INSERT",
169315
+ /* 263 */ "trigger_event ::= UPDATE",
169316
+ /* 264 */ "trigger_event ::= UPDATE OF idlist",
169317
+ /* 265 */ "when_clause ::=",
169318
+ /* 266 */ "when_clause ::= WHEN expr",
169319
+ /* 267 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
169320
+ /* 268 */ "trigger_cmd_list ::= trigger_cmd SEMI",
169321
+ /* 269 */ "trnm ::= nm DOT nm",
169322
+ /* 270 */ "tridxby ::= INDEXED BY nm",
169323
+ /* 271 */ "tridxby ::= NOT INDEXED",
169324
+ /* 272 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
169325
+ /* 273 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
169326
+ /* 274 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
169327
+ /* 275 */ "trigger_cmd ::= scanpt select scanpt",
169328
+ /* 276 */ "expr ::= RAISE LP IGNORE RP",
169329
+ /* 277 */ "expr ::= RAISE LP raisetype COMMA nm RP",
169330
+ /* 278 */ "raisetype ::= ROLLBACK",
169331
+ /* 279 */ "raisetype ::= ABORT",
169332
+ /* 280 */ "raisetype ::= FAIL",
169333
+ /* 281 */ "cmd ::= DROP TRIGGER ifexists fullname",
169334
+ /* 282 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
169335
+ /* 283 */ "cmd ::= DETACH database_kw_opt expr",
169336
+ /* 284 */ "key_opt ::=",
169337
+ /* 285 */ "key_opt ::= KEY expr",
169338
+ /* 286 */ "cmd ::= REINDEX",
169339
+ /* 287 */ "cmd ::= REINDEX nm dbnm",
169340
+ /* 288 */ "cmd ::= ANALYZE",
169341
+ /* 289 */ "cmd ::= ANALYZE nm dbnm",
169342
+ /* 290 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
169343
+ /* 291 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
169344
+ /* 292 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
169345
+ /* 293 */ "add_column_fullname ::= fullname",
169346
+ /* 294 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
169347
+ /* 295 */ "cmd ::= create_vtab",
169348
+ /* 296 */ "cmd ::= create_vtab LP vtabarglist RP",
169349
+ /* 297 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
169350
+ /* 298 */ "vtabarg ::=",
169351
+ /* 299 */ "vtabargtoken ::= ANY",
169352
+ /* 300 */ "vtabargtoken ::= lp anylist RP",
169353
+ /* 301 */ "lp ::= LP",
169354
+ /* 302 */ "with ::= WITH wqlist",
169355
+ /* 303 */ "with ::= WITH RECURSIVE wqlist",
169356
+ /* 304 */ "wqas ::= AS",
169357
+ /* 305 */ "wqas ::= AS MATERIALIZED",
169358
+ /* 306 */ "wqas ::= AS NOT MATERIALIZED",
169359
+ /* 307 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
169360
+ /* 308 */ "wqlist ::= wqitem",
169361
+ /* 309 */ "wqlist ::= wqlist COMMA wqitem",
169362
+ /* 310 */ "windowdefn_list ::= windowdefn",
169363
+ /* 311 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
169364
+ /* 312 */ "windowdefn ::= nm AS LP window RP",
169365
+ /* 313 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
169366
+ /* 314 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
169367
+ /* 315 */ "window ::= ORDER BY sortlist frame_opt",
169368
+ /* 316 */ "window ::= nm ORDER BY sortlist frame_opt",
169369
+ /* 317 */ "window ::= frame_opt",
169370
+ /* 318 */ "window ::= nm frame_opt",
169371
+ /* 319 */ "frame_opt ::=",
169372
+ /* 320 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
169373
+ /* 321 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
169374
+ /* 322 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
169375
+ /* 323 */ "frame_bound_s ::= frame_bound",
169376
+ /* 324 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
169377
+ /* 325 */ "frame_bound_e ::= frame_bound",
169378
+ /* 326 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
169379
+ /* 327 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
169380
+ /* 328 */ "frame_bound ::= CURRENT ROW",
169381
+ /* 329 */ "frame_exclude_opt ::=",
169382
+ /* 330 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
169383
+ /* 331 */ "frame_exclude ::= NO OTHERS",
169384
+ /* 332 */ "frame_exclude ::= CURRENT ROW",
169385
+ /* 333 */ "frame_exclude ::= GROUP|TIES",
169386
+ /* 334 */ "window_clause ::= WINDOW windowdefn_list",
169387
+ /* 335 */ "filter_over ::= filter_clause over_clause",
169388
+ /* 336 */ "filter_over ::= over_clause",
169389
+ /* 337 */ "filter_over ::= filter_clause",
169390
+ /* 338 */ "over_clause ::= OVER LP window RP",
169391
+ /* 339 */ "over_clause ::= OVER nm",
169392
+ /* 340 */ "filter_clause ::= FILTER LP WHERE expr RP",
169393
+ /* 341 */ "input ::= cmdlist",
169394
+ /* 342 */ "cmdlist ::= cmdlist ecmd",
169395
+ /* 343 */ "cmdlist ::= ecmd",
169396
+ /* 344 */ "ecmd ::= SEMI",
169397
+ /* 345 */ "ecmd ::= cmdx SEMI",
169398
+ /* 346 */ "ecmd ::= explain cmdx SEMI",
169399
+ /* 347 */ "trans_opt ::=",
169400
+ /* 348 */ "trans_opt ::= TRANSACTION",
169401
+ /* 349 */ "trans_opt ::= TRANSACTION nm",
169402
+ /* 350 */ "savepoint_opt ::= SAVEPOINT",
169403
+ /* 351 */ "savepoint_opt ::=",
169404
+ /* 352 */ "cmd ::= create_table create_table_args",
169405
+ /* 353 */ "table_option_set ::= table_option",
169406
+ /* 354 */ "columnlist ::= columnlist COMMA columnname carglist",
169407
+ /* 355 */ "columnlist ::= columnname carglist",
169408
+ /* 356 */ "nm ::= ID|INDEXED|JOIN_KW",
169409
+ /* 357 */ "nm ::= STRING",
169410
+ /* 358 */ "typetoken ::= typename",
169411
+ /* 359 */ "typename ::= ID|STRING",
169412
+ /* 360 */ "signed ::= plus_num",
169413
+ /* 361 */ "signed ::= minus_num",
169414
+ /* 362 */ "carglist ::= carglist ccons",
169415
+ /* 363 */ "carglist ::=",
169416
+ /* 364 */ "ccons ::= NULL onconf",
169417
+ /* 365 */ "ccons ::= GENERATED ALWAYS AS generated",
169418
+ /* 366 */ "ccons ::= AS generated",
169419
+ /* 367 */ "conslist_opt ::= COMMA conslist",
169420
+ /* 368 */ "conslist ::= conslist tconscomma tcons",
169421
+ /* 369 */ "conslist ::= tcons",
169422
+ /* 370 */ "tconscomma ::=",
169423
+ /* 371 */ "defer_subclause_opt ::= defer_subclause",
169424
+ /* 372 */ "resolvetype ::= raisetype",
169425
+ /* 373 */ "selectnowith ::= oneselect",
169426
+ /* 374 */ "oneselect ::= values",
169427
+ /* 375 */ "sclp ::= selcollist COMMA",
169428
+ /* 376 */ "as ::= ID|STRING",
169429
+ /* 377 */ "indexed_opt ::= indexed_by",
169430
+ /* 378 */ "returning ::=",
169431
+ /* 379 */ "expr ::= term",
169432
+ /* 380 */ "likeop ::= LIKE_KW|MATCH",
169433
+ /* 381 */ "exprlist ::= nexprlist",
169434
+ /* 382 */ "nmnum ::= plus_num",
169435
+ /* 383 */ "nmnum ::= nm",
169436
+ /* 384 */ "nmnum ::= ON",
169437
+ /* 385 */ "nmnum ::= DELETE",
169438
+ /* 386 */ "nmnum ::= DEFAULT",
169439
+ /* 387 */ "plus_num ::= INTEGER|FLOAT",
169440
+ /* 388 */ "foreach_clause ::=",
169441
+ /* 389 */ "foreach_clause ::= FOR EACH ROW",
169442
+ /* 390 */ "trnm ::= nm",
169443
+ /* 391 */ "tridxby ::=",
169444
+ /* 392 */ "database_kw_opt ::= DATABASE",
169445
+ /* 393 */ "database_kw_opt ::=",
169446
+ /* 394 */ "kwcolumn_opt ::=",
169447
+ /* 395 */ "kwcolumn_opt ::= COLUMNKW",
169448
+ /* 396 */ "vtabarglist ::= vtabarg",
169449
+ /* 397 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
169450
+ /* 398 */ "vtabarg ::= vtabarg vtabargtoken",
169451
+ /* 399 */ "anylist ::=",
169452
+ /* 400 */ "anylist ::= anylist LP anylist RP",
169453
+ /* 401 */ "anylist ::= anylist ANY",
169454
+ /* 402 */ "with ::=",
169029169455
};
169030169456
#endif /* NDEBUG */
169031169457
169032169458
169033169459
#if YYSTACKDEPTH<=0
@@ -169708,237 +170134,235 @@
169708170134
270, /* (173) idlist_opt ::= */
169709170135
270, /* (174) idlist_opt ::= LP idlist RP */
169710170136
263, /* (175) idlist ::= idlist COMMA nm */
169711170137
263, /* (176) idlist ::= nm */
169712170138
217, /* (177) expr ::= LP expr RP */
169713
- 217, /* (178) expr ::= ID|INDEXED */
169714
- 217, /* (179) expr ::= JOIN_KW */
169715
- 217, /* (180) expr ::= nm DOT nm */
169716
- 217, /* (181) expr ::= nm DOT nm DOT nm */
169717
- 216, /* (182) term ::= NULL|FLOAT|BLOB */
169718
- 216, /* (183) term ::= STRING */
169719
- 216, /* (184) term ::= INTEGER */
169720
- 217, /* (185) expr ::= VARIABLE */
169721
- 217, /* (186) expr ::= expr COLLATE ID|STRING */
169722
- 217, /* (187) expr ::= CAST LP expr AS typetoken RP */
169723
- 217, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */
169724
- 217, /* (189) expr ::= ID|INDEXED LP STAR RP */
169725
- 217, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
169726
- 217, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */
169727
- 216, /* (192) term ::= CTIME_KW */
169728
- 217, /* (193) expr ::= LP nexprlist COMMA expr RP */
169729
- 217, /* (194) expr ::= expr AND expr */
169730
- 217, /* (195) expr ::= expr OR expr */
169731
- 217, /* (196) expr ::= expr LT|GT|GE|LE expr */
169732
- 217, /* (197) expr ::= expr EQ|NE expr */
169733
- 217, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
169734
- 217, /* (199) expr ::= expr PLUS|MINUS expr */
169735
- 217, /* (200) expr ::= expr STAR|SLASH|REM expr */
169736
- 217, /* (201) expr ::= expr CONCAT expr */
169737
- 274, /* (202) likeop ::= NOT LIKE_KW|MATCH */
169738
- 217, /* (203) expr ::= expr likeop expr */
169739
- 217, /* (204) expr ::= expr likeop expr ESCAPE expr */
169740
- 217, /* (205) expr ::= expr ISNULL|NOTNULL */
169741
- 217, /* (206) expr ::= expr NOT NULL */
169742
- 217, /* (207) expr ::= expr IS expr */
169743
- 217, /* (208) expr ::= expr IS NOT expr */
169744
- 217, /* (209) expr ::= expr IS NOT DISTINCT FROM expr */
169745
- 217, /* (210) expr ::= expr IS DISTINCT FROM expr */
169746
- 217, /* (211) expr ::= NOT expr */
169747
- 217, /* (212) expr ::= BITNOT expr */
169748
- 217, /* (213) expr ::= PLUS|MINUS expr */
169749
- 217, /* (214) expr ::= expr PTR expr */
169750
- 275, /* (215) between_op ::= BETWEEN */
169751
- 275, /* (216) between_op ::= NOT BETWEEN */
169752
- 217, /* (217) expr ::= expr between_op expr AND expr */
169753
- 276, /* (218) in_op ::= IN */
169754
- 276, /* (219) in_op ::= NOT IN */
169755
- 217, /* (220) expr ::= expr in_op LP exprlist RP */
169756
- 217, /* (221) expr ::= LP select RP */
169757
- 217, /* (222) expr ::= expr in_op LP select RP */
169758
- 217, /* (223) expr ::= expr in_op nm dbnm paren_exprlist */
169759
- 217, /* (224) expr ::= EXISTS LP select RP */
169760
- 217, /* (225) expr ::= CASE case_operand case_exprlist case_else END */
169761
- 279, /* (226) case_exprlist ::= case_exprlist WHEN expr THEN expr */
169762
- 279, /* (227) case_exprlist ::= WHEN expr THEN expr */
169763
- 280, /* (228) case_else ::= ELSE expr */
169764
- 280, /* (229) case_else ::= */
169765
- 278, /* (230) case_operand ::= expr */
169766
- 278, /* (231) case_operand ::= */
169767
- 261, /* (232) exprlist ::= */
169768
- 253, /* (233) nexprlist ::= nexprlist COMMA expr */
169769
- 253, /* (234) nexprlist ::= expr */
169770
- 277, /* (235) paren_exprlist ::= */
169771
- 277, /* (236) paren_exprlist ::= LP exprlist RP */
169772
- 190, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
169773
- 281, /* (238) uniqueflag ::= UNIQUE */
169774
- 281, /* (239) uniqueflag ::= */
169775
- 221, /* (240) eidlist_opt ::= */
169776
- 221, /* (241) eidlist_opt ::= LP eidlist RP */
169777
- 232, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */
169778
- 232, /* (243) eidlist ::= nm collate sortorder */
169779
- 282, /* (244) collate ::= */
169780
- 282, /* (245) collate ::= COLLATE ID|STRING */
169781
- 190, /* (246) cmd ::= DROP INDEX ifexists fullname */
169782
- 190, /* (247) cmd ::= VACUUM vinto */
169783
- 190, /* (248) cmd ::= VACUUM nm vinto */
169784
- 283, /* (249) vinto ::= INTO expr */
169785
- 283, /* (250) vinto ::= */
169786
- 190, /* (251) cmd ::= PRAGMA nm dbnm */
169787
- 190, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */
169788
- 190, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */
169789
- 190, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */
169790
- 190, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */
169791
- 211, /* (256) plus_num ::= PLUS INTEGER|FLOAT */
169792
- 212, /* (257) minus_num ::= MINUS INTEGER|FLOAT */
169793
- 190, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
169794
- 285, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
169795
- 287, /* (260) trigger_time ::= BEFORE|AFTER */
169796
- 287, /* (261) trigger_time ::= INSTEAD OF */
169797
- 287, /* (262) trigger_time ::= */
169798
- 288, /* (263) trigger_event ::= DELETE|INSERT */
169799
- 288, /* (264) trigger_event ::= UPDATE */
169800
- 288, /* (265) trigger_event ::= UPDATE OF idlist */
169801
- 290, /* (266) when_clause ::= */
169802
- 290, /* (267) when_clause ::= WHEN expr */
169803
- 286, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
169804
- 286, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */
169805
- 292, /* (270) trnm ::= nm DOT nm */
169806
- 293, /* (271) tridxby ::= INDEXED BY nm */
169807
- 293, /* (272) tridxby ::= NOT INDEXED */
169808
- 291, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
169809
- 291, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
169810
- 291, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
169811
- 291, /* (276) trigger_cmd ::= scanpt select scanpt */
169812
- 217, /* (277) expr ::= RAISE LP IGNORE RP */
169813
- 217, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */
169814
- 236, /* (279) raisetype ::= ROLLBACK */
169815
- 236, /* (280) raisetype ::= ABORT */
169816
- 236, /* (281) raisetype ::= FAIL */
169817
- 190, /* (282) cmd ::= DROP TRIGGER ifexists fullname */
169818
- 190, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
169819
- 190, /* (284) cmd ::= DETACH database_kw_opt expr */
169820
- 295, /* (285) key_opt ::= */
169821
- 295, /* (286) key_opt ::= KEY expr */
169822
- 190, /* (287) cmd ::= REINDEX */
169823
- 190, /* (288) cmd ::= REINDEX nm dbnm */
169824
- 190, /* (289) cmd ::= ANALYZE */
169825
- 190, /* (290) cmd ::= ANALYZE nm dbnm */
169826
- 190, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */
169827
- 190, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
169828
- 190, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
169829
- 296, /* (294) add_column_fullname ::= fullname */
169830
- 190, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
169831
- 190, /* (296) cmd ::= create_vtab */
169832
- 190, /* (297) cmd ::= create_vtab LP vtabarglist RP */
169833
- 298, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
169834
- 300, /* (299) vtabarg ::= */
169835
- 301, /* (300) vtabargtoken ::= ANY */
169836
- 301, /* (301) vtabargtoken ::= lp anylist RP */
169837
- 302, /* (302) lp ::= LP */
169838
- 266, /* (303) with ::= WITH wqlist */
169839
- 266, /* (304) with ::= WITH RECURSIVE wqlist */
169840
- 305, /* (305) wqas ::= AS */
169841
- 305, /* (306) wqas ::= AS MATERIALIZED */
169842
- 305, /* (307) wqas ::= AS NOT MATERIALIZED */
169843
- 304, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */
169844
- 241, /* (309) wqlist ::= wqitem */
169845
- 241, /* (310) wqlist ::= wqlist COMMA wqitem */
169846
- 306, /* (311) windowdefn_list ::= windowdefn */
169847
- 306, /* (312) windowdefn_list ::= windowdefn_list COMMA windowdefn */
169848
- 307, /* (313) windowdefn ::= nm AS LP window RP */
169849
- 308, /* (314) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
169850
- 308, /* (315) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
169851
- 308, /* (316) window ::= ORDER BY sortlist frame_opt */
169852
- 308, /* (317) window ::= nm ORDER BY sortlist frame_opt */
169853
- 308, /* (318) window ::= frame_opt */
169854
- 308, /* (319) window ::= nm frame_opt */
169855
- 309, /* (320) frame_opt ::= */
169856
- 309, /* (321) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
169857
- 309, /* (322) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
169858
- 313, /* (323) range_or_rows ::= RANGE|ROWS|GROUPS */
169859
- 315, /* (324) frame_bound_s ::= frame_bound */
169860
- 315, /* (325) frame_bound_s ::= UNBOUNDED PRECEDING */
169861
- 316, /* (326) frame_bound_e ::= frame_bound */
169862
- 316, /* (327) frame_bound_e ::= UNBOUNDED FOLLOWING */
169863
- 314, /* (328) frame_bound ::= expr PRECEDING|FOLLOWING */
169864
- 314, /* (329) frame_bound ::= CURRENT ROW */
169865
- 317, /* (330) frame_exclude_opt ::= */
169866
- 317, /* (331) frame_exclude_opt ::= EXCLUDE frame_exclude */
169867
- 318, /* (332) frame_exclude ::= NO OTHERS */
169868
- 318, /* (333) frame_exclude ::= CURRENT ROW */
169869
- 318, /* (334) frame_exclude ::= GROUP|TIES */
169870
- 251, /* (335) window_clause ::= WINDOW windowdefn_list */
169871
- 273, /* (336) filter_over ::= filter_clause over_clause */
169872
- 273, /* (337) filter_over ::= over_clause */
169873
- 273, /* (338) filter_over ::= filter_clause */
169874
- 312, /* (339) over_clause ::= OVER LP window RP */
169875
- 312, /* (340) over_clause ::= OVER nm */
169876
- 311, /* (341) filter_clause ::= FILTER LP WHERE expr RP */
169877
- 185, /* (342) input ::= cmdlist */
169878
- 186, /* (343) cmdlist ::= cmdlist ecmd */
169879
- 186, /* (344) cmdlist ::= ecmd */
169880
- 187, /* (345) ecmd ::= SEMI */
169881
- 187, /* (346) ecmd ::= cmdx SEMI */
169882
- 187, /* (347) ecmd ::= explain cmdx SEMI */
169883
- 192, /* (348) trans_opt ::= */
169884
- 192, /* (349) trans_opt ::= TRANSACTION */
169885
- 192, /* (350) trans_opt ::= TRANSACTION nm */
169886
- 194, /* (351) savepoint_opt ::= SAVEPOINT */
169887
- 194, /* (352) savepoint_opt ::= */
169888
- 190, /* (353) cmd ::= create_table create_table_args */
169889
- 203, /* (354) table_option_set ::= table_option */
169890
- 201, /* (355) columnlist ::= columnlist COMMA columnname carglist */
169891
- 201, /* (356) columnlist ::= columnname carglist */
169892
- 193, /* (357) nm ::= ID|INDEXED */
169893
- 193, /* (358) nm ::= STRING */
169894
- 193, /* (359) nm ::= JOIN_KW */
169895
- 208, /* (360) typetoken ::= typename */
169896
- 209, /* (361) typename ::= ID|STRING */
169897
- 210, /* (362) signed ::= plus_num */
169898
- 210, /* (363) signed ::= minus_num */
169899
- 207, /* (364) carglist ::= carglist ccons */
169900
- 207, /* (365) carglist ::= */
169901
- 215, /* (366) ccons ::= NULL onconf */
169902
- 215, /* (367) ccons ::= GENERATED ALWAYS AS generated */
169903
- 215, /* (368) ccons ::= AS generated */
169904
- 202, /* (369) conslist_opt ::= COMMA conslist */
169905
- 228, /* (370) conslist ::= conslist tconscomma tcons */
169906
- 228, /* (371) conslist ::= tcons */
169907
- 229, /* (372) tconscomma ::= */
169908
- 233, /* (373) defer_subclause_opt ::= defer_subclause */
169909
- 235, /* (374) resolvetype ::= raisetype */
169910
- 239, /* (375) selectnowith ::= oneselect */
169911
- 240, /* (376) oneselect ::= values */
169912
- 254, /* (377) sclp ::= selcollist COMMA */
169913
- 255, /* (378) as ::= ID|STRING */
169914
- 264, /* (379) indexed_opt ::= indexed_by */
169915
- 272, /* (380) returning ::= */
169916
- 217, /* (381) expr ::= term */
169917
- 274, /* (382) likeop ::= LIKE_KW|MATCH */
169918
- 261, /* (383) exprlist ::= nexprlist */
169919
- 284, /* (384) nmnum ::= plus_num */
169920
- 284, /* (385) nmnum ::= nm */
169921
- 284, /* (386) nmnum ::= ON */
169922
- 284, /* (387) nmnum ::= DELETE */
169923
- 284, /* (388) nmnum ::= DEFAULT */
169924
- 211, /* (389) plus_num ::= INTEGER|FLOAT */
169925
- 289, /* (390) foreach_clause ::= */
169926
- 289, /* (391) foreach_clause ::= FOR EACH ROW */
169927
- 292, /* (392) trnm ::= nm */
169928
- 293, /* (393) tridxby ::= */
169929
- 294, /* (394) database_kw_opt ::= DATABASE */
169930
- 294, /* (395) database_kw_opt ::= */
169931
- 297, /* (396) kwcolumn_opt ::= */
169932
- 297, /* (397) kwcolumn_opt ::= COLUMNKW */
169933
- 299, /* (398) vtabarglist ::= vtabarg */
169934
- 299, /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */
169935
- 300, /* (400) vtabarg ::= vtabarg vtabargtoken */
169936
- 303, /* (401) anylist ::= */
169937
- 303, /* (402) anylist ::= anylist LP anylist RP */
169938
- 303, /* (403) anylist ::= anylist ANY */
169939
- 266, /* (404) with ::= */
170139
+ 217, /* (178) expr ::= ID|INDEXED|JOIN_KW */
170140
+ 217, /* (179) expr ::= nm DOT nm */
170141
+ 217, /* (180) expr ::= nm DOT nm DOT nm */
170142
+ 216, /* (181) term ::= NULL|FLOAT|BLOB */
170143
+ 216, /* (182) term ::= STRING */
170144
+ 216, /* (183) term ::= INTEGER */
170145
+ 217, /* (184) expr ::= VARIABLE */
170146
+ 217, /* (185) expr ::= expr COLLATE ID|STRING */
170147
+ 217, /* (186) expr ::= CAST LP expr AS typetoken RP */
170148
+ 217, /* (187) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
170149
+ 217, /* (188) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
170150
+ 217, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
170151
+ 217, /* (190) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
170152
+ 216, /* (191) term ::= CTIME_KW */
170153
+ 217, /* (192) expr ::= LP nexprlist COMMA expr RP */
170154
+ 217, /* (193) expr ::= expr AND expr */
170155
+ 217, /* (194) expr ::= expr OR expr */
170156
+ 217, /* (195) expr ::= expr LT|GT|GE|LE expr */
170157
+ 217, /* (196) expr ::= expr EQ|NE expr */
170158
+ 217, /* (197) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
170159
+ 217, /* (198) expr ::= expr PLUS|MINUS expr */
170160
+ 217, /* (199) expr ::= expr STAR|SLASH|REM expr */
170161
+ 217, /* (200) expr ::= expr CONCAT expr */
170162
+ 274, /* (201) likeop ::= NOT LIKE_KW|MATCH */
170163
+ 217, /* (202) expr ::= expr likeop expr */
170164
+ 217, /* (203) expr ::= expr likeop expr ESCAPE expr */
170165
+ 217, /* (204) expr ::= expr ISNULL|NOTNULL */
170166
+ 217, /* (205) expr ::= expr NOT NULL */
170167
+ 217, /* (206) expr ::= expr IS expr */
170168
+ 217, /* (207) expr ::= expr IS NOT expr */
170169
+ 217, /* (208) expr ::= expr IS NOT DISTINCT FROM expr */
170170
+ 217, /* (209) expr ::= expr IS DISTINCT FROM expr */
170171
+ 217, /* (210) expr ::= NOT expr */
170172
+ 217, /* (211) expr ::= BITNOT expr */
170173
+ 217, /* (212) expr ::= PLUS|MINUS expr */
170174
+ 217, /* (213) expr ::= expr PTR expr */
170175
+ 275, /* (214) between_op ::= BETWEEN */
170176
+ 275, /* (215) between_op ::= NOT BETWEEN */
170177
+ 217, /* (216) expr ::= expr between_op expr AND expr */
170178
+ 276, /* (217) in_op ::= IN */
170179
+ 276, /* (218) in_op ::= NOT IN */
170180
+ 217, /* (219) expr ::= expr in_op LP exprlist RP */
170181
+ 217, /* (220) expr ::= LP select RP */
170182
+ 217, /* (221) expr ::= expr in_op LP select RP */
170183
+ 217, /* (222) expr ::= expr in_op nm dbnm paren_exprlist */
170184
+ 217, /* (223) expr ::= EXISTS LP select RP */
170185
+ 217, /* (224) expr ::= CASE case_operand case_exprlist case_else END */
170186
+ 279, /* (225) case_exprlist ::= case_exprlist WHEN expr THEN expr */
170187
+ 279, /* (226) case_exprlist ::= WHEN expr THEN expr */
170188
+ 280, /* (227) case_else ::= ELSE expr */
170189
+ 280, /* (228) case_else ::= */
170190
+ 278, /* (229) case_operand ::= expr */
170191
+ 278, /* (230) case_operand ::= */
170192
+ 261, /* (231) exprlist ::= */
170193
+ 253, /* (232) nexprlist ::= nexprlist COMMA expr */
170194
+ 253, /* (233) nexprlist ::= expr */
170195
+ 277, /* (234) paren_exprlist ::= */
170196
+ 277, /* (235) paren_exprlist ::= LP exprlist RP */
170197
+ 190, /* (236) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
170198
+ 281, /* (237) uniqueflag ::= UNIQUE */
170199
+ 281, /* (238) uniqueflag ::= */
170200
+ 221, /* (239) eidlist_opt ::= */
170201
+ 221, /* (240) eidlist_opt ::= LP eidlist RP */
170202
+ 232, /* (241) eidlist ::= eidlist COMMA nm collate sortorder */
170203
+ 232, /* (242) eidlist ::= nm collate sortorder */
170204
+ 282, /* (243) collate ::= */
170205
+ 282, /* (244) collate ::= COLLATE ID|STRING */
170206
+ 190, /* (245) cmd ::= DROP INDEX ifexists fullname */
170207
+ 190, /* (246) cmd ::= VACUUM vinto */
170208
+ 190, /* (247) cmd ::= VACUUM nm vinto */
170209
+ 283, /* (248) vinto ::= INTO expr */
170210
+ 283, /* (249) vinto ::= */
170211
+ 190, /* (250) cmd ::= PRAGMA nm dbnm */
170212
+ 190, /* (251) cmd ::= PRAGMA nm dbnm EQ nmnum */
170213
+ 190, /* (252) cmd ::= PRAGMA nm dbnm LP nmnum RP */
170214
+ 190, /* (253) cmd ::= PRAGMA nm dbnm EQ minus_num */
170215
+ 190, /* (254) cmd ::= PRAGMA nm dbnm LP minus_num RP */
170216
+ 211, /* (255) plus_num ::= PLUS INTEGER|FLOAT */
170217
+ 212, /* (256) minus_num ::= MINUS INTEGER|FLOAT */
170218
+ 190, /* (257) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
170219
+ 285, /* (258) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
170220
+ 287, /* (259) trigger_time ::= BEFORE|AFTER */
170221
+ 287, /* (260) trigger_time ::= INSTEAD OF */
170222
+ 287, /* (261) trigger_time ::= */
170223
+ 288, /* (262) trigger_event ::= DELETE|INSERT */
170224
+ 288, /* (263) trigger_event ::= UPDATE */
170225
+ 288, /* (264) trigger_event ::= UPDATE OF idlist */
170226
+ 290, /* (265) when_clause ::= */
170227
+ 290, /* (266) when_clause ::= WHEN expr */
170228
+ 286, /* (267) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
170229
+ 286, /* (268) trigger_cmd_list ::= trigger_cmd SEMI */
170230
+ 292, /* (269) trnm ::= nm DOT nm */
170231
+ 293, /* (270) tridxby ::= INDEXED BY nm */
170232
+ 293, /* (271) tridxby ::= NOT INDEXED */
170233
+ 291, /* (272) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
170234
+ 291, /* (273) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
170235
+ 291, /* (274) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
170236
+ 291, /* (275) trigger_cmd ::= scanpt select scanpt */
170237
+ 217, /* (276) expr ::= RAISE LP IGNORE RP */
170238
+ 217, /* (277) expr ::= RAISE LP raisetype COMMA nm RP */
170239
+ 236, /* (278) raisetype ::= ROLLBACK */
170240
+ 236, /* (279) raisetype ::= ABORT */
170241
+ 236, /* (280) raisetype ::= FAIL */
170242
+ 190, /* (281) cmd ::= DROP TRIGGER ifexists fullname */
170243
+ 190, /* (282) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
170244
+ 190, /* (283) cmd ::= DETACH database_kw_opt expr */
170245
+ 295, /* (284) key_opt ::= */
170246
+ 295, /* (285) key_opt ::= KEY expr */
170247
+ 190, /* (286) cmd ::= REINDEX */
170248
+ 190, /* (287) cmd ::= REINDEX nm dbnm */
170249
+ 190, /* (288) cmd ::= ANALYZE */
170250
+ 190, /* (289) cmd ::= ANALYZE nm dbnm */
170251
+ 190, /* (290) cmd ::= ALTER TABLE fullname RENAME TO nm */
170252
+ 190, /* (291) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
170253
+ 190, /* (292) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
170254
+ 296, /* (293) add_column_fullname ::= fullname */
170255
+ 190, /* (294) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
170256
+ 190, /* (295) cmd ::= create_vtab */
170257
+ 190, /* (296) cmd ::= create_vtab LP vtabarglist RP */
170258
+ 298, /* (297) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
170259
+ 300, /* (298) vtabarg ::= */
170260
+ 301, /* (299) vtabargtoken ::= ANY */
170261
+ 301, /* (300) vtabargtoken ::= lp anylist RP */
170262
+ 302, /* (301) lp ::= LP */
170263
+ 266, /* (302) with ::= WITH wqlist */
170264
+ 266, /* (303) with ::= WITH RECURSIVE wqlist */
170265
+ 305, /* (304) wqas ::= AS */
170266
+ 305, /* (305) wqas ::= AS MATERIALIZED */
170267
+ 305, /* (306) wqas ::= AS NOT MATERIALIZED */
170268
+ 304, /* (307) wqitem ::= nm eidlist_opt wqas LP select RP */
170269
+ 241, /* (308) wqlist ::= wqitem */
170270
+ 241, /* (309) wqlist ::= wqlist COMMA wqitem */
170271
+ 306, /* (310) windowdefn_list ::= windowdefn */
170272
+ 306, /* (311) windowdefn_list ::= windowdefn_list COMMA windowdefn */
170273
+ 307, /* (312) windowdefn ::= nm AS LP window RP */
170274
+ 308, /* (313) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
170275
+ 308, /* (314) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
170276
+ 308, /* (315) window ::= ORDER BY sortlist frame_opt */
170277
+ 308, /* (316) window ::= nm ORDER BY sortlist frame_opt */
170278
+ 308, /* (317) window ::= frame_opt */
170279
+ 308, /* (318) window ::= nm frame_opt */
170280
+ 309, /* (319) frame_opt ::= */
170281
+ 309, /* (320) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
170282
+ 309, /* (321) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
170283
+ 313, /* (322) range_or_rows ::= RANGE|ROWS|GROUPS */
170284
+ 315, /* (323) frame_bound_s ::= frame_bound */
170285
+ 315, /* (324) frame_bound_s ::= UNBOUNDED PRECEDING */
170286
+ 316, /* (325) frame_bound_e ::= frame_bound */
170287
+ 316, /* (326) frame_bound_e ::= UNBOUNDED FOLLOWING */
170288
+ 314, /* (327) frame_bound ::= expr PRECEDING|FOLLOWING */
170289
+ 314, /* (328) frame_bound ::= CURRENT ROW */
170290
+ 317, /* (329) frame_exclude_opt ::= */
170291
+ 317, /* (330) frame_exclude_opt ::= EXCLUDE frame_exclude */
170292
+ 318, /* (331) frame_exclude ::= NO OTHERS */
170293
+ 318, /* (332) frame_exclude ::= CURRENT ROW */
170294
+ 318, /* (333) frame_exclude ::= GROUP|TIES */
170295
+ 251, /* (334) window_clause ::= WINDOW windowdefn_list */
170296
+ 273, /* (335) filter_over ::= filter_clause over_clause */
170297
+ 273, /* (336) filter_over ::= over_clause */
170298
+ 273, /* (337) filter_over ::= filter_clause */
170299
+ 312, /* (338) over_clause ::= OVER LP window RP */
170300
+ 312, /* (339) over_clause ::= OVER nm */
170301
+ 311, /* (340) filter_clause ::= FILTER LP WHERE expr RP */
170302
+ 185, /* (341) input ::= cmdlist */
170303
+ 186, /* (342) cmdlist ::= cmdlist ecmd */
170304
+ 186, /* (343) cmdlist ::= ecmd */
170305
+ 187, /* (344) ecmd ::= SEMI */
170306
+ 187, /* (345) ecmd ::= cmdx SEMI */
170307
+ 187, /* (346) ecmd ::= explain cmdx SEMI */
170308
+ 192, /* (347) trans_opt ::= */
170309
+ 192, /* (348) trans_opt ::= TRANSACTION */
170310
+ 192, /* (349) trans_opt ::= TRANSACTION nm */
170311
+ 194, /* (350) savepoint_opt ::= SAVEPOINT */
170312
+ 194, /* (351) savepoint_opt ::= */
170313
+ 190, /* (352) cmd ::= create_table create_table_args */
170314
+ 203, /* (353) table_option_set ::= table_option */
170315
+ 201, /* (354) columnlist ::= columnlist COMMA columnname carglist */
170316
+ 201, /* (355) columnlist ::= columnname carglist */
170317
+ 193, /* (356) nm ::= ID|INDEXED|JOIN_KW */
170318
+ 193, /* (357) nm ::= STRING */
170319
+ 208, /* (358) typetoken ::= typename */
170320
+ 209, /* (359) typename ::= ID|STRING */
170321
+ 210, /* (360) signed ::= plus_num */
170322
+ 210, /* (361) signed ::= minus_num */
170323
+ 207, /* (362) carglist ::= carglist ccons */
170324
+ 207, /* (363) carglist ::= */
170325
+ 215, /* (364) ccons ::= NULL onconf */
170326
+ 215, /* (365) ccons ::= GENERATED ALWAYS AS generated */
170327
+ 215, /* (366) ccons ::= AS generated */
170328
+ 202, /* (367) conslist_opt ::= COMMA conslist */
170329
+ 228, /* (368) conslist ::= conslist tconscomma tcons */
170330
+ 228, /* (369) conslist ::= tcons */
170331
+ 229, /* (370) tconscomma ::= */
170332
+ 233, /* (371) defer_subclause_opt ::= defer_subclause */
170333
+ 235, /* (372) resolvetype ::= raisetype */
170334
+ 239, /* (373) selectnowith ::= oneselect */
170335
+ 240, /* (374) oneselect ::= values */
170336
+ 254, /* (375) sclp ::= selcollist COMMA */
170337
+ 255, /* (376) as ::= ID|STRING */
170338
+ 264, /* (377) indexed_opt ::= indexed_by */
170339
+ 272, /* (378) returning ::= */
170340
+ 217, /* (379) expr ::= term */
170341
+ 274, /* (380) likeop ::= LIKE_KW|MATCH */
170342
+ 261, /* (381) exprlist ::= nexprlist */
170343
+ 284, /* (382) nmnum ::= plus_num */
170344
+ 284, /* (383) nmnum ::= nm */
170345
+ 284, /* (384) nmnum ::= ON */
170346
+ 284, /* (385) nmnum ::= DELETE */
170347
+ 284, /* (386) nmnum ::= DEFAULT */
170348
+ 211, /* (387) plus_num ::= INTEGER|FLOAT */
170349
+ 289, /* (388) foreach_clause ::= */
170350
+ 289, /* (389) foreach_clause ::= FOR EACH ROW */
170351
+ 292, /* (390) trnm ::= nm */
170352
+ 293, /* (391) tridxby ::= */
170353
+ 294, /* (392) database_kw_opt ::= DATABASE */
170354
+ 294, /* (393) database_kw_opt ::= */
170355
+ 297, /* (394) kwcolumn_opt ::= */
170356
+ 297, /* (395) kwcolumn_opt ::= COLUMNKW */
170357
+ 299, /* (396) vtabarglist ::= vtabarg */
170358
+ 299, /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */
170359
+ 300, /* (398) vtabarg ::= vtabarg vtabargtoken */
170360
+ 303, /* (399) anylist ::= */
170361
+ 303, /* (400) anylist ::= anylist LP anylist RP */
170362
+ 303, /* (401) anylist ::= anylist ANY */
170363
+ 266, /* (402) with ::= */
169940170364
};
169941170365
169942170366
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
169943170367
** of symbols on the right-hand side of that rule. */
169944170368
static const signed char yyRuleInfoNRhs[] = {
@@ -170118,237 +170542,235 @@
170118170542
0, /* (173) idlist_opt ::= */
170119170543
-3, /* (174) idlist_opt ::= LP idlist RP */
170120170544
-3, /* (175) idlist ::= idlist COMMA nm */
170121170545
-1, /* (176) idlist ::= nm */
170122170546
-3, /* (177) expr ::= LP expr RP */
170123
- -1, /* (178) expr ::= ID|INDEXED */
170124
- -1, /* (179) expr ::= JOIN_KW */
170125
- -3, /* (180) expr ::= nm DOT nm */
170126
- -5, /* (181) expr ::= nm DOT nm DOT nm */
170127
- -1, /* (182) term ::= NULL|FLOAT|BLOB */
170128
- -1, /* (183) term ::= STRING */
170129
- -1, /* (184) term ::= INTEGER */
170130
- -1, /* (185) expr ::= VARIABLE */
170131
- -3, /* (186) expr ::= expr COLLATE ID|STRING */
170132
- -6, /* (187) expr ::= CAST LP expr AS typetoken RP */
170133
- -5, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */
170134
- -4, /* (189) expr ::= ID|INDEXED LP STAR RP */
170135
- -6, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
170136
- -5, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */
170137
- -1, /* (192) term ::= CTIME_KW */
170138
- -5, /* (193) expr ::= LP nexprlist COMMA expr RP */
170139
- -3, /* (194) expr ::= expr AND expr */
170140
- -3, /* (195) expr ::= expr OR expr */
170141
- -3, /* (196) expr ::= expr LT|GT|GE|LE expr */
170142
- -3, /* (197) expr ::= expr EQ|NE expr */
170143
- -3, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
170144
- -3, /* (199) expr ::= expr PLUS|MINUS expr */
170145
- -3, /* (200) expr ::= expr STAR|SLASH|REM expr */
170146
- -3, /* (201) expr ::= expr CONCAT expr */
170147
- -2, /* (202) likeop ::= NOT LIKE_KW|MATCH */
170148
- -3, /* (203) expr ::= expr likeop expr */
170149
- -5, /* (204) expr ::= expr likeop expr ESCAPE expr */
170150
- -2, /* (205) expr ::= expr ISNULL|NOTNULL */
170151
- -3, /* (206) expr ::= expr NOT NULL */
170152
- -3, /* (207) expr ::= expr IS expr */
170153
- -4, /* (208) expr ::= expr IS NOT expr */
170154
- -6, /* (209) expr ::= expr IS NOT DISTINCT FROM expr */
170155
- -5, /* (210) expr ::= expr IS DISTINCT FROM expr */
170156
- -2, /* (211) expr ::= NOT expr */
170157
- -2, /* (212) expr ::= BITNOT expr */
170158
- -2, /* (213) expr ::= PLUS|MINUS expr */
170159
- -3, /* (214) expr ::= expr PTR expr */
170160
- -1, /* (215) between_op ::= BETWEEN */
170161
- -2, /* (216) between_op ::= NOT BETWEEN */
170162
- -5, /* (217) expr ::= expr between_op expr AND expr */
170163
- -1, /* (218) in_op ::= IN */
170164
- -2, /* (219) in_op ::= NOT IN */
170165
- -5, /* (220) expr ::= expr in_op LP exprlist RP */
170166
- -3, /* (221) expr ::= LP select RP */
170167
- -5, /* (222) expr ::= expr in_op LP select RP */
170168
- -5, /* (223) expr ::= expr in_op nm dbnm paren_exprlist */
170169
- -4, /* (224) expr ::= EXISTS LP select RP */
170170
- -5, /* (225) expr ::= CASE case_operand case_exprlist case_else END */
170171
- -5, /* (226) case_exprlist ::= case_exprlist WHEN expr THEN expr */
170172
- -4, /* (227) case_exprlist ::= WHEN expr THEN expr */
170173
- -2, /* (228) case_else ::= ELSE expr */
170174
- 0, /* (229) case_else ::= */
170175
- -1, /* (230) case_operand ::= expr */
170176
- 0, /* (231) case_operand ::= */
170177
- 0, /* (232) exprlist ::= */
170178
- -3, /* (233) nexprlist ::= nexprlist COMMA expr */
170179
- -1, /* (234) nexprlist ::= expr */
170180
- 0, /* (235) paren_exprlist ::= */
170181
- -3, /* (236) paren_exprlist ::= LP exprlist RP */
170182
- -12, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
170183
- -1, /* (238) uniqueflag ::= UNIQUE */
170184
- 0, /* (239) uniqueflag ::= */
170185
- 0, /* (240) eidlist_opt ::= */
170186
- -3, /* (241) eidlist_opt ::= LP eidlist RP */
170187
- -5, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */
170188
- -3, /* (243) eidlist ::= nm collate sortorder */
170189
- 0, /* (244) collate ::= */
170190
- -2, /* (245) collate ::= COLLATE ID|STRING */
170191
- -4, /* (246) cmd ::= DROP INDEX ifexists fullname */
170192
- -2, /* (247) cmd ::= VACUUM vinto */
170193
- -3, /* (248) cmd ::= VACUUM nm vinto */
170194
- -2, /* (249) vinto ::= INTO expr */
170195
- 0, /* (250) vinto ::= */
170196
- -3, /* (251) cmd ::= PRAGMA nm dbnm */
170197
- -5, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */
170198
- -6, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */
170199
- -5, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */
170200
- -6, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */
170201
- -2, /* (256) plus_num ::= PLUS INTEGER|FLOAT */
170202
- -2, /* (257) minus_num ::= MINUS INTEGER|FLOAT */
170203
- -5, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
170204
- -11, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
170205
- -1, /* (260) trigger_time ::= BEFORE|AFTER */
170206
- -2, /* (261) trigger_time ::= INSTEAD OF */
170207
- 0, /* (262) trigger_time ::= */
170208
- -1, /* (263) trigger_event ::= DELETE|INSERT */
170209
- -1, /* (264) trigger_event ::= UPDATE */
170210
- -3, /* (265) trigger_event ::= UPDATE OF idlist */
170211
- 0, /* (266) when_clause ::= */
170212
- -2, /* (267) when_clause ::= WHEN expr */
170213
- -3, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
170214
- -2, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */
170215
- -3, /* (270) trnm ::= nm DOT nm */
170216
- -3, /* (271) tridxby ::= INDEXED BY nm */
170217
- -2, /* (272) tridxby ::= NOT INDEXED */
170218
- -9, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
170219
- -8, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
170220
- -6, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
170221
- -3, /* (276) trigger_cmd ::= scanpt select scanpt */
170222
- -4, /* (277) expr ::= RAISE LP IGNORE RP */
170223
- -6, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */
170224
- -1, /* (279) raisetype ::= ROLLBACK */
170225
- -1, /* (280) raisetype ::= ABORT */
170226
- -1, /* (281) raisetype ::= FAIL */
170227
- -4, /* (282) cmd ::= DROP TRIGGER ifexists fullname */
170228
- -6, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
170229
- -3, /* (284) cmd ::= DETACH database_kw_opt expr */
170230
- 0, /* (285) key_opt ::= */
170231
- -2, /* (286) key_opt ::= KEY expr */
170232
- -1, /* (287) cmd ::= REINDEX */
170233
- -3, /* (288) cmd ::= REINDEX nm dbnm */
170234
- -1, /* (289) cmd ::= ANALYZE */
170235
- -3, /* (290) cmd ::= ANALYZE nm dbnm */
170236
- -6, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */
170237
- -7, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
170238
- -6, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
170239
- -1, /* (294) add_column_fullname ::= fullname */
170240
- -8, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
170241
- -1, /* (296) cmd ::= create_vtab */
170242
- -4, /* (297) cmd ::= create_vtab LP vtabarglist RP */
170243
- -8, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
170244
- 0, /* (299) vtabarg ::= */
170245
- -1, /* (300) vtabargtoken ::= ANY */
170246
- -3, /* (301) vtabargtoken ::= lp anylist RP */
170247
- -1, /* (302) lp ::= LP */
170248
- -2, /* (303) with ::= WITH wqlist */
170249
- -3, /* (304) with ::= WITH RECURSIVE wqlist */
170250
- -1, /* (305) wqas ::= AS */
170251
- -2, /* (306) wqas ::= AS MATERIALIZED */
170252
- -3, /* (307) wqas ::= AS NOT MATERIALIZED */
170253
- -6, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */
170254
- -1, /* (309) wqlist ::= wqitem */
170255
- -3, /* (310) wqlist ::= wqlist COMMA wqitem */
170256
- -1, /* (311) windowdefn_list ::= windowdefn */
170257
- -3, /* (312) windowdefn_list ::= windowdefn_list COMMA windowdefn */
170258
- -5, /* (313) windowdefn ::= nm AS LP window RP */
170259
- -5, /* (314) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
170260
- -6, /* (315) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
170261
- -4, /* (316) window ::= ORDER BY sortlist frame_opt */
170262
- -5, /* (317) window ::= nm ORDER BY sortlist frame_opt */
170263
- -1, /* (318) window ::= frame_opt */
170264
- -2, /* (319) window ::= nm frame_opt */
170265
- 0, /* (320) frame_opt ::= */
170266
- -3, /* (321) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
170267
- -6, /* (322) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
170268
- -1, /* (323) range_or_rows ::= RANGE|ROWS|GROUPS */
170269
- -1, /* (324) frame_bound_s ::= frame_bound */
170270
- -2, /* (325) frame_bound_s ::= UNBOUNDED PRECEDING */
170271
- -1, /* (326) frame_bound_e ::= frame_bound */
170272
- -2, /* (327) frame_bound_e ::= UNBOUNDED FOLLOWING */
170273
- -2, /* (328) frame_bound ::= expr PRECEDING|FOLLOWING */
170274
- -2, /* (329) frame_bound ::= CURRENT ROW */
170275
- 0, /* (330) frame_exclude_opt ::= */
170276
- -2, /* (331) frame_exclude_opt ::= EXCLUDE frame_exclude */
170277
- -2, /* (332) frame_exclude ::= NO OTHERS */
170278
- -2, /* (333) frame_exclude ::= CURRENT ROW */
170279
- -1, /* (334) frame_exclude ::= GROUP|TIES */
170280
- -2, /* (335) window_clause ::= WINDOW windowdefn_list */
170281
- -2, /* (336) filter_over ::= filter_clause over_clause */
170282
- -1, /* (337) filter_over ::= over_clause */
170283
- -1, /* (338) filter_over ::= filter_clause */
170284
- -4, /* (339) over_clause ::= OVER LP window RP */
170285
- -2, /* (340) over_clause ::= OVER nm */
170286
- -5, /* (341) filter_clause ::= FILTER LP WHERE expr RP */
170287
- -1, /* (342) input ::= cmdlist */
170288
- -2, /* (343) cmdlist ::= cmdlist ecmd */
170289
- -1, /* (344) cmdlist ::= ecmd */
170290
- -1, /* (345) ecmd ::= SEMI */
170291
- -2, /* (346) ecmd ::= cmdx SEMI */
170292
- -3, /* (347) ecmd ::= explain cmdx SEMI */
170293
- 0, /* (348) trans_opt ::= */
170294
- -1, /* (349) trans_opt ::= TRANSACTION */
170295
- -2, /* (350) trans_opt ::= TRANSACTION nm */
170296
- -1, /* (351) savepoint_opt ::= SAVEPOINT */
170297
- 0, /* (352) savepoint_opt ::= */
170298
- -2, /* (353) cmd ::= create_table create_table_args */
170299
- -1, /* (354) table_option_set ::= table_option */
170300
- -4, /* (355) columnlist ::= columnlist COMMA columnname carglist */
170301
- -2, /* (356) columnlist ::= columnname carglist */
170302
- -1, /* (357) nm ::= ID|INDEXED */
170303
- -1, /* (358) nm ::= STRING */
170304
- -1, /* (359) nm ::= JOIN_KW */
170305
- -1, /* (360) typetoken ::= typename */
170306
- -1, /* (361) typename ::= ID|STRING */
170307
- -1, /* (362) signed ::= plus_num */
170308
- -1, /* (363) signed ::= minus_num */
170309
- -2, /* (364) carglist ::= carglist ccons */
170310
- 0, /* (365) carglist ::= */
170311
- -2, /* (366) ccons ::= NULL onconf */
170312
- -4, /* (367) ccons ::= GENERATED ALWAYS AS generated */
170313
- -2, /* (368) ccons ::= AS generated */
170314
- -2, /* (369) conslist_opt ::= COMMA conslist */
170315
- -3, /* (370) conslist ::= conslist tconscomma tcons */
170316
- -1, /* (371) conslist ::= tcons */
170317
- 0, /* (372) tconscomma ::= */
170318
- -1, /* (373) defer_subclause_opt ::= defer_subclause */
170319
- -1, /* (374) resolvetype ::= raisetype */
170320
- -1, /* (375) selectnowith ::= oneselect */
170321
- -1, /* (376) oneselect ::= values */
170322
- -2, /* (377) sclp ::= selcollist COMMA */
170323
- -1, /* (378) as ::= ID|STRING */
170324
- -1, /* (379) indexed_opt ::= indexed_by */
170325
- 0, /* (380) returning ::= */
170326
- -1, /* (381) expr ::= term */
170327
- -1, /* (382) likeop ::= LIKE_KW|MATCH */
170328
- -1, /* (383) exprlist ::= nexprlist */
170329
- -1, /* (384) nmnum ::= plus_num */
170330
- -1, /* (385) nmnum ::= nm */
170331
- -1, /* (386) nmnum ::= ON */
170332
- -1, /* (387) nmnum ::= DELETE */
170333
- -1, /* (388) nmnum ::= DEFAULT */
170334
- -1, /* (389) plus_num ::= INTEGER|FLOAT */
170335
- 0, /* (390) foreach_clause ::= */
170336
- -3, /* (391) foreach_clause ::= FOR EACH ROW */
170337
- -1, /* (392) trnm ::= nm */
170338
- 0, /* (393) tridxby ::= */
170339
- -1, /* (394) database_kw_opt ::= DATABASE */
170340
- 0, /* (395) database_kw_opt ::= */
170341
- 0, /* (396) kwcolumn_opt ::= */
170342
- -1, /* (397) kwcolumn_opt ::= COLUMNKW */
170343
- -1, /* (398) vtabarglist ::= vtabarg */
170344
- -3, /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */
170345
- -2, /* (400) vtabarg ::= vtabarg vtabargtoken */
170346
- 0, /* (401) anylist ::= */
170347
- -4, /* (402) anylist ::= anylist LP anylist RP */
170348
- -2, /* (403) anylist ::= anylist ANY */
170349
- 0, /* (404) with ::= */
170547
+ -1, /* (178) expr ::= ID|INDEXED|JOIN_KW */
170548
+ -3, /* (179) expr ::= nm DOT nm */
170549
+ -5, /* (180) expr ::= nm DOT nm DOT nm */
170550
+ -1, /* (181) term ::= NULL|FLOAT|BLOB */
170551
+ -1, /* (182) term ::= STRING */
170552
+ -1, /* (183) term ::= INTEGER */
170553
+ -1, /* (184) expr ::= VARIABLE */
170554
+ -3, /* (185) expr ::= expr COLLATE ID|STRING */
170555
+ -6, /* (186) expr ::= CAST LP expr AS typetoken RP */
170556
+ -5, /* (187) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
170557
+ -4, /* (188) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
170558
+ -6, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
170559
+ -5, /* (190) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
170560
+ -1, /* (191) term ::= CTIME_KW */
170561
+ -5, /* (192) expr ::= LP nexprlist COMMA expr RP */
170562
+ -3, /* (193) expr ::= expr AND expr */
170563
+ -3, /* (194) expr ::= expr OR expr */
170564
+ -3, /* (195) expr ::= expr LT|GT|GE|LE expr */
170565
+ -3, /* (196) expr ::= expr EQ|NE expr */
170566
+ -3, /* (197) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
170567
+ -3, /* (198) expr ::= expr PLUS|MINUS expr */
170568
+ -3, /* (199) expr ::= expr STAR|SLASH|REM expr */
170569
+ -3, /* (200) expr ::= expr CONCAT expr */
170570
+ -2, /* (201) likeop ::= NOT LIKE_KW|MATCH */
170571
+ -3, /* (202) expr ::= expr likeop expr */
170572
+ -5, /* (203) expr ::= expr likeop expr ESCAPE expr */
170573
+ -2, /* (204) expr ::= expr ISNULL|NOTNULL */
170574
+ -3, /* (205) expr ::= expr NOT NULL */
170575
+ -3, /* (206) expr ::= expr IS expr */
170576
+ -4, /* (207) expr ::= expr IS NOT expr */
170577
+ -6, /* (208) expr ::= expr IS NOT DISTINCT FROM expr */
170578
+ -5, /* (209) expr ::= expr IS DISTINCT FROM expr */
170579
+ -2, /* (210) expr ::= NOT expr */
170580
+ -2, /* (211) expr ::= BITNOT expr */
170581
+ -2, /* (212) expr ::= PLUS|MINUS expr */
170582
+ -3, /* (213) expr ::= expr PTR expr */
170583
+ -1, /* (214) between_op ::= BETWEEN */
170584
+ -2, /* (215) between_op ::= NOT BETWEEN */
170585
+ -5, /* (216) expr ::= expr between_op expr AND expr */
170586
+ -1, /* (217) in_op ::= IN */
170587
+ -2, /* (218) in_op ::= NOT IN */
170588
+ -5, /* (219) expr ::= expr in_op LP exprlist RP */
170589
+ -3, /* (220) expr ::= LP select RP */
170590
+ -5, /* (221) expr ::= expr in_op LP select RP */
170591
+ -5, /* (222) expr ::= expr in_op nm dbnm paren_exprlist */
170592
+ -4, /* (223) expr ::= EXISTS LP select RP */
170593
+ -5, /* (224) expr ::= CASE case_operand case_exprlist case_else END */
170594
+ -5, /* (225) case_exprlist ::= case_exprlist WHEN expr THEN expr */
170595
+ -4, /* (226) case_exprlist ::= WHEN expr THEN expr */
170596
+ -2, /* (227) case_else ::= ELSE expr */
170597
+ 0, /* (228) case_else ::= */
170598
+ -1, /* (229) case_operand ::= expr */
170599
+ 0, /* (230) case_operand ::= */
170600
+ 0, /* (231) exprlist ::= */
170601
+ -3, /* (232) nexprlist ::= nexprlist COMMA expr */
170602
+ -1, /* (233) nexprlist ::= expr */
170603
+ 0, /* (234) paren_exprlist ::= */
170604
+ -3, /* (235) paren_exprlist ::= LP exprlist RP */
170605
+ -12, /* (236) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
170606
+ -1, /* (237) uniqueflag ::= UNIQUE */
170607
+ 0, /* (238) uniqueflag ::= */
170608
+ 0, /* (239) eidlist_opt ::= */
170609
+ -3, /* (240) eidlist_opt ::= LP eidlist RP */
170610
+ -5, /* (241) eidlist ::= eidlist COMMA nm collate sortorder */
170611
+ -3, /* (242) eidlist ::= nm collate sortorder */
170612
+ 0, /* (243) collate ::= */
170613
+ -2, /* (244) collate ::= COLLATE ID|STRING */
170614
+ -4, /* (245) cmd ::= DROP INDEX ifexists fullname */
170615
+ -2, /* (246) cmd ::= VACUUM vinto */
170616
+ -3, /* (247) cmd ::= VACUUM nm vinto */
170617
+ -2, /* (248) vinto ::= INTO expr */
170618
+ 0, /* (249) vinto ::= */
170619
+ -3, /* (250) cmd ::= PRAGMA nm dbnm */
170620
+ -5, /* (251) cmd ::= PRAGMA nm dbnm EQ nmnum */
170621
+ -6, /* (252) cmd ::= PRAGMA nm dbnm LP nmnum RP */
170622
+ -5, /* (253) cmd ::= PRAGMA nm dbnm EQ minus_num */
170623
+ -6, /* (254) cmd ::= PRAGMA nm dbnm LP minus_num RP */
170624
+ -2, /* (255) plus_num ::= PLUS INTEGER|FLOAT */
170625
+ -2, /* (256) minus_num ::= MINUS INTEGER|FLOAT */
170626
+ -5, /* (257) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
170627
+ -11, /* (258) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
170628
+ -1, /* (259) trigger_time ::= BEFORE|AFTER */
170629
+ -2, /* (260) trigger_time ::= INSTEAD OF */
170630
+ 0, /* (261) trigger_time ::= */
170631
+ -1, /* (262) trigger_event ::= DELETE|INSERT */
170632
+ -1, /* (263) trigger_event ::= UPDATE */
170633
+ -3, /* (264) trigger_event ::= UPDATE OF idlist */
170634
+ 0, /* (265) when_clause ::= */
170635
+ -2, /* (266) when_clause ::= WHEN expr */
170636
+ -3, /* (267) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
170637
+ -2, /* (268) trigger_cmd_list ::= trigger_cmd SEMI */
170638
+ -3, /* (269) trnm ::= nm DOT nm */
170639
+ -3, /* (270) tridxby ::= INDEXED BY nm */
170640
+ -2, /* (271) tridxby ::= NOT INDEXED */
170641
+ -9, /* (272) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
170642
+ -8, /* (273) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
170643
+ -6, /* (274) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
170644
+ -3, /* (275) trigger_cmd ::= scanpt select scanpt */
170645
+ -4, /* (276) expr ::= RAISE LP IGNORE RP */
170646
+ -6, /* (277) expr ::= RAISE LP raisetype COMMA nm RP */
170647
+ -1, /* (278) raisetype ::= ROLLBACK */
170648
+ -1, /* (279) raisetype ::= ABORT */
170649
+ -1, /* (280) raisetype ::= FAIL */
170650
+ -4, /* (281) cmd ::= DROP TRIGGER ifexists fullname */
170651
+ -6, /* (282) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
170652
+ -3, /* (283) cmd ::= DETACH database_kw_opt expr */
170653
+ 0, /* (284) key_opt ::= */
170654
+ -2, /* (285) key_opt ::= KEY expr */
170655
+ -1, /* (286) cmd ::= REINDEX */
170656
+ -3, /* (287) cmd ::= REINDEX nm dbnm */
170657
+ -1, /* (288) cmd ::= ANALYZE */
170658
+ -3, /* (289) cmd ::= ANALYZE nm dbnm */
170659
+ -6, /* (290) cmd ::= ALTER TABLE fullname RENAME TO nm */
170660
+ -7, /* (291) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
170661
+ -6, /* (292) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
170662
+ -1, /* (293) add_column_fullname ::= fullname */
170663
+ -8, /* (294) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
170664
+ -1, /* (295) cmd ::= create_vtab */
170665
+ -4, /* (296) cmd ::= create_vtab LP vtabarglist RP */
170666
+ -8, /* (297) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
170667
+ 0, /* (298) vtabarg ::= */
170668
+ -1, /* (299) vtabargtoken ::= ANY */
170669
+ -3, /* (300) vtabargtoken ::= lp anylist RP */
170670
+ -1, /* (301) lp ::= LP */
170671
+ -2, /* (302) with ::= WITH wqlist */
170672
+ -3, /* (303) with ::= WITH RECURSIVE wqlist */
170673
+ -1, /* (304) wqas ::= AS */
170674
+ -2, /* (305) wqas ::= AS MATERIALIZED */
170675
+ -3, /* (306) wqas ::= AS NOT MATERIALIZED */
170676
+ -6, /* (307) wqitem ::= nm eidlist_opt wqas LP select RP */
170677
+ -1, /* (308) wqlist ::= wqitem */
170678
+ -3, /* (309) wqlist ::= wqlist COMMA wqitem */
170679
+ -1, /* (310) windowdefn_list ::= windowdefn */
170680
+ -3, /* (311) windowdefn_list ::= windowdefn_list COMMA windowdefn */
170681
+ -5, /* (312) windowdefn ::= nm AS LP window RP */
170682
+ -5, /* (313) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
170683
+ -6, /* (314) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
170684
+ -4, /* (315) window ::= ORDER BY sortlist frame_opt */
170685
+ -5, /* (316) window ::= nm ORDER BY sortlist frame_opt */
170686
+ -1, /* (317) window ::= frame_opt */
170687
+ -2, /* (318) window ::= nm frame_opt */
170688
+ 0, /* (319) frame_opt ::= */
170689
+ -3, /* (320) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
170690
+ -6, /* (321) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
170691
+ -1, /* (322) range_or_rows ::= RANGE|ROWS|GROUPS */
170692
+ -1, /* (323) frame_bound_s ::= frame_bound */
170693
+ -2, /* (324) frame_bound_s ::= UNBOUNDED PRECEDING */
170694
+ -1, /* (325) frame_bound_e ::= frame_bound */
170695
+ -2, /* (326) frame_bound_e ::= UNBOUNDED FOLLOWING */
170696
+ -2, /* (327) frame_bound ::= expr PRECEDING|FOLLOWING */
170697
+ -2, /* (328) frame_bound ::= CURRENT ROW */
170698
+ 0, /* (329) frame_exclude_opt ::= */
170699
+ -2, /* (330) frame_exclude_opt ::= EXCLUDE frame_exclude */
170700
+ -2, /* (331) frame_exclude ::= NO OTHERS */
170701
+ -2, /* (332) frame_exclude ::= CURRENT ROW */
170702
+ -1, /* (333) frame_exclude ::= GROUP|TIES */
170703
+ -2, /* (334) window_clause ::= WINDOW windowdefn_list */
170704
+ -2, /* (335) filter_over ::= filter_clause over_clause */
170705
+ -1, /* (336) filter_over ::= over_clause */
170706
+ -1, /* (337) filter_over ::= filter_clause */
170707
+ -4, /* (338) over_clause ::= OVER LP window RP */
170708
+ -2, /* (339) over_clause ::= OVER nm */
170709
+ -5, /* (340) filter_clause ::= FILTER LP WHERE expr RP */
170710
+ -1, /* (341) input ::= cmdlist */
170711
+ -2, /* (342) cmdlist ::= cmdlist ecmd */
170712
+ -1, /* (343) cmdlist ::= ecmd */
170713
+ -1, /* (344) ecmd ::= SEMI */
170714
+ -2, /* (345) ecmd ::= cmdx SEMI */
170715
+ -3, /* (346) ecmd ::= explain cmdx SEMI */
170716
+ 0, /* (347) trans_opt ::= */
170717
+ -1, /* (348) trans_opt ::= TRANSACTION */
170718
+ -2, /* (349) trans_opt ::= TRANSACTION nm */
170719
+ -1, /* (350) savepoint_opt ::= SAVEPOINT */
170720
+ 0, /* (351) savepoint_opt ::= */
170721
+ -2, /* (352) cmd ::= create_table create_table_args */
170722
+ -1, /* (353) table_option_set ::= table_option */
170723
+ -4, /* (354) columnlist ::= columnlist COMMA columnname carglist */
170724
+ -2, /* (355) columnlist ::= columnname carglist */
170725
+ -1, /* (356) nm ::= ID|INDEXED|JOIN_KW */
170726
+ -1, /* (357) nm ::= STRING */
170727
+ -1, /* (358) typetoken ::= typename */
170728
+ -1, /* (359) typename ::= ID|STRING */
170729
+ -1, /* (360) signed ::= plus_num */
170730
+ -1, /* (361) signed ::= minus_num */
170731
+ -2, /* (362) carglist ::= carglist ccons */
170732
+ 0, /* (363) carglist ::= */
170733
+ -2, /* (364) ccons ::= NULL onconf */
170734
+ -4, /* (365) ccons ::= GENERATED ALWAYS AS generated */
170735
+ -2, /* (366) ccons ::= AS generated */
170736
+ -2, /* (367) conslist_opt ::= COMMA conslist */
170737
+ -3, /* (368) conslist ::= conslist tconscomma tcons */
170738
+ -1, /* (369) conslist ::= tcons */
170739
+ 0, /* (370) tconscomma ::= */
170740
+ -1, /* (371) defer_subclause_opt ::= defer_subclause */
170741
+ -1, /* (372) resolvetype ::= raisetype */
170742
+ -1, /* (373) selectnowith ::= oneselect */
170743
+ -1, /* (374) oneselect ::= values */
170744
+ -2, /* (375) sclp ::= selcollist COMMA */
170745
+ -1, /* (376) as ::= ID|STRING */
170746
+ -1, /* (377) indexed_opt ::= indexed_by */
170747
+ 0, /* (378) returning ::= */
170748
+ -1, /* (379) expr ::= term */
170749
+ -1, /* (380) likeop ::= LIKE_KW|MATCH */
170750
+ -1, /* (381) exprlist ::= nexprlist */
170751
+ -1, /* (382) nmnum ::= plus_num */
170752
+ -1, /* (383) nmnum ::= nm */
170753
+ -1, /* (384) nmnum ::= ON */
170754
+ -1, /* (385) nmnum ::= DELETE */
170755
+ -1, /* (386) nmnum ::= DEFAULT */
170756
+ -1, /* (387) plus_num ::= INTEGER|FLOAT */
170757
+ 0, /* (388) foreach_clause ::= */
170758
+ -3, /* (389) foreach_clause ::= FOR EACH ROW */
170759
+ -1, /* (390) trnm ::= nm */
170760
+ 0, /* (391) tridxby ::= */
170761
+ -1, /* (392) database_kw_opt ::= DATABASE */
170762
+ 0, /* (393) database_kw_opt ::= */
170763
+ 0, /* (394) kwcolumn_opt ::= */
170764
+ -1, /* (395) kwcolumn_opt ::= COLUMNKW */
170765
+ -1, /* (396) vtabarglist ::= vtabarg */
170766
+ -3, /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */
170767
+ -2, /* (398) vtabarg ::= vtabarg vtabargtoken */
170768
+ 0, /* (399) anylist ::= */
170769
+ -4, /* (400) anylist ::= anylist LP anylist RP */
170770
+ -2, /* (401) anylist ::= anylist ANY */
170771
+ 0, /* (402) with ::= */
170350170772
};
170351170773
170352170774
static void yy_accept(yyParser*); /* Forward Declaration */
170353170775
170354170776
/*
@@ -170404,11 +170826,11 @@
170404170826
{yymsp[1].minor.yy394 = TK_DEFERRED;}
170405170827
break;
170406170828
case 5: /* transtype ::= DEFERRED */
170407170829
case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
170408170830
case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
170409
- case 323: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==323);
170831
+ case 322: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==322);
170410170832
{yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/}
170411170833
break;
170412170834
case 8: /* cmd ::= COMMIT|END trans_opt */
170413170835
case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
170414170836
{sqlite3EndTransaction(pParse,yymsp[-1].major);}
@@ -170441,11 +170863,11 @@
170441170863
case 47: /* autoinc ::= */ yytestcase(yyruleno==47);
170442170864
case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
170443170865
case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
170444170866
case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
170445170867
case 98: /* distinct ::= */ yytestcase(yyruleno==98);
170446
- case 244: /* collate ::= */ yytestcase(yyruleno==244);
170868
+ case 243: /* collate ::= */ yytestcase(yyruleno==243);
170447170869
{yymsp[1].minor.yy394 = 0;}
170448170870
break;
170449170871
case 16: /* ifnotexists ::= IF NOT EXISTS */
170450170872
{yymsp[-2].minor.yy394 = 1;}
170451170873
break;
@@ -170625,13 +171047,13 @@
170625171047
case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171);
170626171048
{yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;}
170627171049
break;
170628171050
case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
170629171051
case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
170630
- case 216: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==216);
170631
- case 219: /* in_op ::= NOT IN */ yytestcase(yyruleno==219);
170632
- case 245: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==245);
171052
+ case 215: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==215);
171053
+ case 218: /* in_op ::= NOT IN */ yytestcase(yyruleno==218);
171054
+ case 244: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==244);
170633171055
{yymsp[-1].minor.yy394 = 1;}
170634171056
break;
170635171057
case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
170636171058
{yymsp[-1].minor.yy394 = 0;}
170637171059
break;
@@ -170777,13 +171199,13 @@
170777171199
{yymsp[0].minor.yy394 = SF_All;}
170778171200
break;
170779171201
case 99: /* sclp ::= */
170780171202
case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132);
170781171203
case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142);
170782
- case 232: /* exprlist ::= */ yytestcase(yyruleno==232);
170783
- case 235: /* paren_exprlist ::= */ yytestcase(yyruleno==235);
170784
- case 240: /* eidlist_opt ::= */ yytestcase(yyruleno==240);
171204
+ case 231: /* exprlist ::= */ yytestcase(yyruleno==231);
171205
+ case 234: /* paren_exprlist ::= */ yytestcase(yyruleno==234);
171206
+ case 239: /* eidlist_opt ::= */ yytestcase(yyruleno==239);
170785171207
{yymsp[1].minor.yy322 = 0;}
170786171208
break;
170787171209
case 100: /* selcollist ::= sclp scanpt expr scanpt as */
170788171210
{
170789171211
yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
@@ -170805,12 +171227,12 @@
170805171227
yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot);
170806171228
}
170807171229
break;
170808171230
case 103: /* as ::= AS nm */
170809171231
case 115: /* dbnm ::= DOT nm */ yytestcase(yyruleno==115);
170810
- case 256: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==256);
170811
- case 257: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==257);
171232
+ case 255: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==255);
171233
+ case 256: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==256);
170812171234
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
170813171235
break;
170814171236
case 105: /* from ::= */
170815171237
case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108);
170816171238
{yymsp[1].minor.yy131 = 0;}
@@ -170978,20 +171400,20 @@
170978171400
break;
170979171401
case 144: /* having_opt ::= */
170980171402
case 146: /* limit_opt ::= */ yytestcase(yyruleno==146);
170981171403
case 151: /* where_opt ::= */ yytestcase(yyruleno==151);
170982171404
case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153);
170983
- case 229: /* case_else ::= */ yytestcase(yyruleno==229);
170984
- case 231: /* case_operand ::= */ yytestcase(yyruleno==231);
170985
- case 250: /* vinto ::= */ yytestcase(yyruleno==250);
171405
+ case 228: /* case_else ::= */ yytestcase(yyruleno==228);
171406
+ case 230: /* case_operand ::= */ yytestcase(yyruleno==230);
171407
+ case 249: /* vinto ::= */ yytestcase(yyruleno==249);
170986171408
{yymsp[1].minor.yy528 = 0;}
170987171409
break;
170988171410
case 145: /* having_opt ::= HAVING expr */
170989171411
case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152);
170990171412
case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154);
170991
- case 228: /* case_else ::= ELSE expr */ yytestcase(yyruleno==228);
170992
- case 249: /* vinto ::= INTO expr */ yytestcase(yyruleno==249);
171413
+ case 227: /* case_else ::= ELSE expr */ yytestcase(yyruleno==227);
171414
+ case 248: /* vinto ::= INTO expr */ yytestcase(yyruleno==248);
170993171415
{yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;}
170994171416
break;
170995171417
case 147: /* limit_opt ::= LIMIT expr */
170996171418
{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);}
170997171419
break;
@@ -171099,23 +171521,22 @@
171099171521
{yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
171100171522
break;
171101171523
case 177: /* expr ::= LP expr RP */
171102171524
{yymsp[-2].minor.yy528 = yymsp[-1].minor.yy528;}
171103171525
break;
171104
- case 178: /* expr ::= ID|INDEXED */
171105
- case 179: /* expr ::= JOIN_KW */ yytestcase(yyruleno==179);
171526
+ case 178: /* expr ::= ID|INDEXED|JOIN_KW */
171106171527
{yymsp[0].minor.yy528=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
171107171528
break;
171108
- case 180: /* expr ::= nm DOT nm */
171529
+ case 179: /* expr ::= nm DOT nm */
171109171530
{
171110171531
Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
171111171532
Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
171112171533
yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
171113171534
}
171114171535
yymsp[-2].minor.yy528 = yylhsminor.yy528;
171115171536
break;
171116
- case 181: /* expr ::= nm DOT nm DOT nm */
171537
+ case 180: /* expr ::= nm DOT nm DOT nm */
171117171538
{
171118171539
Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0);
171119171540
Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
171120171541
Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
171121171542
Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
@@ -171124,22 +171545,22 @@
171124171545
}
171125171546
yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
171126171547
}
171127171548
yymsp[-4].minor.yy528 = yylhsminor.yy528;
171128171549
break;
171129
- case 182: /* term ::= NULL|FLOAT|BLOB */
171130
- case 183: /* term ::= STRING */ yytestcase(yyruleno==183);
171550
+ case 181: /* term ::= NULL|FLOAT|BLOB */
171551
+ case 182: /* term ::= STRING */ yytestcase(yyruleno==182);
171131171552
{yymsp[0].minor.yy528=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
171132171553
break;
171133
- case 184: /* term ::= INTEGER */
171554
+ case 183: /* term ::= INTEGER */
171134171555
{
171135171556
yylhsminor.yy528 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
171136171557
if( yylhsminor.yy528 ) yylhsminor.yy528->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
171137171558
}
171138171559
yymsp[0].minor.yy528 = yylhsminor.yy528;
171139171560
break;
171140
- case 185: /* expr ::= VARIABLE */
171561
+ case 184: /* expr ::= VARIABLE */
171141171562
{
171142171563
if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
171143171564
u32 n = yymsp[0].minor.yy0.n;
171144171565
yymsp[0].minor.yy528 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
171145171566
sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy528, n);
@@ -171157,54 +171578,54 @@
171157171578
if( yymsp[0].minor.yy528 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy528->iTable);
171158171579
}
171159171580
}
171160171581
}
171161171582
break;
171162
- case 186: /* expr ::= expr COLLATE ID|STRING */
171583
+ case 185: /* expr ::= expr COLLATE ID|STRING */
171163171584
{
171164171585
yymsp[-2].minor.yy528 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy528, &yymsp[0].minor.yy0, 1);
171165171586
}
171166171587
break;
171167
- case 187: /* expr ::= CAST LP expr AS typetoken RP */
171588
+ case 186: /* expr ::= CAST LP expr AS typetoken RP */
171168171589
{
171169171590
yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
171170171591
sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy528, yymsp[-3].minor.yy528, 0);
171171171592
}
171172171593
break;
171173
- case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP */
171594
+ case 187: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
171174171595
{
171175171596
yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy394);
171176171597
}
171177171598
yymsp[-4].minor.yy528 = yylhsminor.yy528;
171178171599
break;
171179
- case 189: /* expr ::= ID|INDEXED LP STAR RP */
171600
+ case 188: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
171180171601
{
171181171602
yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
171182171603
}
171183171604
yymsp[-3].minor.yy528 = yylhsminor.yy528;
171184171605
break;
171185
- case 190: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
171606
+ case 189: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
171186171607
{
171187171608
yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy322, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy394);
171188171609
sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
171189171610
}
171190171611
yymsp[-5].minor.yy528 = yylhsminor.yy528;
171191171612
break;
171192
- case 191: /* expr ::= ID|INDEXED LP STAR RP filter_over */
171613
+ case 190: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
171193171614
{
171194171615
yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
171195171616
sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
171196171617
}
171197171618
yymsp[-4].minor.yy528 = yylhsminor.yy528;
171198171619
break;
171199
- case 192: /* term ::= CTIME_KW */
171620
+ case 191: /* term ::= CTIME_KW */
171200171621
{
171201171622
yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
171202171623
}
171203171624
yymsp[0].minor.yy528 = yylhsminor.yy528;
171204171625
break;
171205
- case 193: /* expr ::= LP nexprlist COMMA expr RP */
171626
+ case 192: /* expr ::= LP nexprlist COMMA expr RP */
171206171627
{
171207171628
ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528);
171208171629
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
171209171630
if( yymsp[-4].minor.yy528 ){
171210171631
yymsp[-4].minor.yy528->x.pList = pList;
@@ -171214,26 +171635,26 @@
171214171635
}else{
171215171636
sqlite3ExprListDelete(pParse->db, pList);
171216171637
}
171217171638
}
171218171639
break;
171219
- case 194: /* expr ::= expr AND expr */
171640
+ case 193: /* expr ::= expr AND expr */
171220171641
{yymsp[-2].minor.yy528=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
171221171642
break;
171222
- case 195: /* expr ::= expr OR expr */
171223
- case 196: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==196);
171224
- case 197: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==197);
171225
- case 198: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==198);
171226
- case 199: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==199);
171227
- case 200: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==200);
171228
- case 201: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==201);
171643
+ case 194: /* expr ::= expr OR expr */
171644
+ case 195: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==195);
171645
+ case 196: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==196);
171646
+ case 197: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==197);
171647
+ case 198: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==198);
171648
+ case 199: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==199);
171649
+ case 200: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==200);
171229171650
{yymsp[-2].minor.yy528=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
171230171651
break;
171231
- case 202: /* likeop ::= NOT LIKE_KW|MATCH */
171652
+ case 201: /* likeop ::= NOT LIKE_KW|MATCH */
171232171653
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
171233171654
break;
171234
- case 203: /* expr ::= expr likeop expr */
171655
+ case 202: /* expr ::= expr likeop expr */
171235171656
{
171236171657
ExprList *pList;
171237171658
int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
171238171659
yymsp[-1].minor.yy0.n &= 0x7fffffff;
171239171660
pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy528);
@@ -171241,11 +171662,11 @@
171241171662
yymsp[-2].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
171242171663
if( bNot ) yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy528, 0);
171243171664
if( yymsp[-2].minor.yy528 ) yymsp[-2].minor.yy528->flags |= EP_InfixFunc;
171244171665
}
171245171666
break;
171246
- case 204: /* expr ::= expr likeop expr ESCAPE expr */
171667
+ case 203: /* expr ::= expr likeop expr ESCAPE expr */
171247171668
{
171248171669
ExprList *pList;
171249171670
int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
171250171671
yymsp[-3].minor.yy0.n &= 0x7fffffff;
171251171672
pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
@@ -171254,63 +171675,63 @@
171254171675
yymsp[-4].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
171255171676
if( bNot ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171256171677
if( yymsp[-4].minor.yy528 ) yymsp[-4].minor.yy528->flags |= EP_InfixFunc;
171257171678
}
171258171679
break;
171259
- case 205: /* expr ::= expr ISNULL|NOTNULL */
171680
+ case 204: /* expr ::= expr ISNULL|NOTNULL */
171260171681
{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy528,0);}
171261171682
break;
171262
- case 206: /* expr ::= expr NOT NULL */
171683
+ case 205: /* expr ::= expr NOT NULL */
171263171684
{yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy528,0);}
171264171685
break;
171265
- case 207: /* expr ::= expr IS expr */
171686
+ case 206: /* expr ::= expr IS expr */
171266171687
{
171267171688
yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);
171268171689
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-2].minor.yy528, TK_ISNULL);
171269171690
}
171270171691
break;
171271
- case 208: /* expr ::= expr IS NOT expr */
171692
+ case 207: /* expr ::= expr IS NOT expr */
171272171693
{
171273171694
yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528);
171274171695
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL);
171275171696
}
171276171697
break;
171277
- case 209: /* expr ::= expr IS NOT DISTINCT FROM expr */
171698
+ case 208: /* expr ::= expr IS NOT DISTINCT FROM expr */
171278171699
{
171279171700
yymsp[-5].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy528,yymsp[0].minor.yy528);
171280171701
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-5].minor.yy528, TK_ISNULL);
171281171702
}
171282171703
break;
171283
- case 210: /* expr ::= expr IS DISTINCT FROM expr */
171704
+ case 209: /* expr ::= expr IS DISTINCT FROM expr */
171284171705
{
171285171706
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy528,yymsp[0].minor.yy528);
171286171707
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-4].minor.yy528, TK_NOTNULL);
171287171708
}
171288171709
break;
171289
- case 211: /* expr ::= NOT expr */
171290
- case 212: /* expr ::= BITNOT expr */ yytestcase(yyruleno==212);
171710
+ case 210: /* expr ::= NOT expr */
171711
+ case 211: /* expr ::= BITNOT expr */ yytestcase(yyruleno==211);
171291171712
{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/}
171292171713
break;
171293
- case 213: /* expr ::= PLUS|MINUS expr */
171714
+ case 212: /* expr ::= PLUS|MINUS expr */
171294171715
{
171295171716
yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0);
171296171717
/*A-overwrites-B*/
171297171718
}
171298171719
break;
171299
- case 214: /* expr ::= expr PTR expr */
171720
+ case 213: /* expr ::= expr PTR expr */
171300171721
{
171301171722
ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528);
171302171723
pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528);
171303171724
yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
171304171725
}
171305171726
yymsp[-2].minor.yy528 = yylhsminor.yy528;
171306171727
break;
171307
- case 215: /* between_op ::= BETWEEN */
171308
- case 218: /* in_op ::= IN */ yytestcase(yyruleno==218);
171728
+ case 214: /* between_op ::= BETWEEN */
171729
+ case 217: /* in_op ::= IN */ yytestcase(yyruleno==217);
171309171730
{yymsp[0].minor.yy394 = 0;}
171310171731
break;
171311
- case 217: /* expr ::= expr between_op expr AND expr */
171732
+ case 216: /* expr ::= expr between_op expr AND expr */
171312171733
{
171313171734
ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
171314171735
pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528);
171315171736
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0);
171316171737
if( yymsp[-4].minor.yy528 ){
@@ -171319,11 +171740,11 @@
171319171740
sqlite3ExprListDelete(pParse->db, pList);
171320171741
}
171321171742
if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171322171743
}
171323171744
break;
171324
- case 220: /* expr ::= expr in_op LP exprlist RP */
171745
+ case 219: /* expr ::= expr in_op LP exprlist RP */
171325171746
{
171326171747
if( yymsp[-1].minor.yy322==0 ){
171327171748
/* Expressions of the form
171328171749
**
171329171750
** expr1 IN ()
@@ -171365,41 +171786,41 @@
171365171786
}
171366171787
if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171367171788
}
171368171789
}
171369171790
break;
171370
- case 221: /* expr ::= LP select RP */
171791
+ case 220: /* expr ::= LP select RP */
171371171792
{
171372171793
yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
171373171794
sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47);
171374171795
}
171375171796
break;
171376
- case 222: /* expr ::= expr in_op LP select RP */
171797
+ case 221: /* expr ::= expr in_op LP select RP */
171377171798
{
171378171799
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
171379171800
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47);
171380171801
if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171381171802
}
171382171803
break;
171383
- case 223: /* expr ::= expr in_op nm dbnm paren_exprlist */
171804
+ case 222: /* expr ::= expr in_op nm dbnm paren_exprlist */
171384171805
{
171385171806
SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
171386171807
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
171387171808
if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322);
171388171809
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
171389171810
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect);
171390171811
if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171391171812
}
171392171813
break;
171393
- case 224: /* expr ::= EXISTS LP select RP */
171814
+ case 223: /* expr ::= EXISTS LP select RP */
171394171815
{
171395171816
Expr *p;
171396171817
p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
171397171818
sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47);
171398171819
}
171399171820
break;
171400
- case 225: /* expr ::= CASE case_operand case_exprlist case_else END */
171821
+ case 224: /* expr ::= CASE case_operand case_exprlist case_else END */
171401171822
{
171402171823
yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0);
171403171824
if( yymsp[-4].minor.yy528 ){
171404171825
yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322;
171405171826
sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528);
@@ -171407,406 +171828,406 @@
171407171828
sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
171408171829
sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
171409171830
}
171410171831
}
171411171832
break;
171412
- case 226: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
171833
+ case 225: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
171413171834
{
171414171835
yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
171415171836
yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528);
171416171837
}
171417171838
break;
171418
- case 227: /* case_exprlist ::= WHEN expr THEN expr */
171839
+ case 226: /* case_exprlist ::= WHEN expr THEN expr */
171419171840
{
171420171841
yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
171421171842
yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528);
171422171843
}
171423171844
break;
171424
- case 230: /* case_operand ::= expr */
171845
+ case 229: /* case_operand ::= expr */
171425171846
{yymsp[0].minor.yy528 = yymsp[0].minor.yy528; /*A-overwrites-X*/}
171426171847
break;
171427
- case 233: /* nexprlist ::= nexprlist COMMA expr */
171848
+ case 232: /* nexprlist ::= nexprlist COMMA expr */
171428171849
{yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);}
171429171850
break;
171430
- case 234: /* nexprlist ::= expr */
171851
+ case 233: /* nexprlist ::= expr */
171431171852
{yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/}
171432171853
break;
171433
- case 236: /* paren_exprlist ::= LP exprlist RP */
171434
- case 241: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==241);
171854
+ case 235: /* paren_exprlist ::= LP exprlist RP */
171855
+ case 240: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==240);
171435171856
{yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;}
171436171857
break;
171437
- case 237: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
171858
+ case 236: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
171438171859
{
171439171860
sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
171440171861
sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394,
171441171862
&yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF);
171442171863
if( IN_RENAME_OBJECT && pParse->pNewIndex ){
171443171864
sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
171444171865
}
171445171866
}
171446171867
break;
171447
- case 238: /* uniqueflag ::= UNIQUE */
171448
- case 280: /* raisetype ::= ABORT */ yytestcase(yyruleno==280);
171868
+ case 237: /* uniqueflag ::= UNIQUE */
171869
+ case 279: /* raisetype ::= ABORT */ yytestcase(yyruleno==279);
171449171870
{yymsp[0].minor.yy394 = OE_Abort;}
171450171871
break;
171451
- case 239: /* uniqueflag ::= */
171872
+ case 238: /* uniqueflag ::= */
171452171873
{yymsp[1].minor.yy394 = OE_None;}
171453171874
break;
171454
- case 242: /* eidlist ::= eidlist COMMA nm collate sortorder */
171875
+ case 241: /* eidlist ::= eidlist COMMA nm collate sortorder */
171455171876
{
171456171877
yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394);
171457171878
}
171458171879
break;
171459
- case 243: /* eidlist ::= nm collate sortorder */
171880
+ case 242: /* eidlist ::= nm collate sortorder */
171460171881
{
171461171882
yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/
171462171883
}
171463171884
break;
171464
- case 246: /* cmd ::= DROP INDEX ifexists fullname */
171885
+ case 245: /* cmd ::= DROP INDEX ifexists fullname */
171465171886
{sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);}
171466171887
break;
171467
- case 247: /* cmd ::= VACUUM vinto */
171888
+ case 246: /* cmd ::= VACUUM vinto */
171468171889
{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);}
171469171890
break;
171470
- case 248: /* cmd ::= VACUUM nm vinto */
171891
+ case 247: /* cmd ::= VACUUM nm vinto */
171471171892
{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);}
171472171893
break;
171473
- case 251: /* cmd ::= PRAGMA nm dbnm */
171894
+ case 250: /* cmd ::= PRAGMA nm dbnm */
171474171895
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
171475171896
break;
171476
- case 252: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
171897
+ case 251: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
171477171898
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
171478171899
break;
171479
- case 253: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
171900
+ case 252: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
171480171901
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
171481171902
break;
171482
- case 254: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
171903
+ case 253: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
171483171904
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
171484171905
break;
171485
- case 255: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
171906
+ case 254: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
171486171907
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
171487171908
break;
171488
- case 258: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
171909
+ case 257: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
171489171910
{
171490171911
Token all;
171491171912
all.z = yymsp[-3].minor.yy0.z;
171492171913
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
171493171914
sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all);
171494171915
}
171495171916
break;
171496
- case 259: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
171917
+ case 258: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
171497171918
{
171498171919
sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy394, yymsp[-4].minor.yy180.a, yymsp[-4].minor.yy180.b, yymsp[-2].minor.yy131, yymsp[0].minor.yy528, yymsp[-10].minor.yy394, yymsp[-8].minor.yy394);
171499171920
yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
171500171921
}
171501171922
break;
171502
- case 260: /* trigger_time ::= BEFORE|AFTER */
171923
+ case 259: /* trigger_time ::= BEFORE|AFTER */
171503171924
{ yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ }
171504171925
break;
171505
- case 261: /* trigger_time ::= INSTEAD OF */
171926
+ case 260: /* trigger_time ::= INSTEAD OF */
171506171927
{ yymsp[-1].minor.yy394 = TK_INSTEAD;}
171507171928
break;
171508
- case 262: /* trigger_time ::= */
171929
+ case 261: /* trigger_time ::= */
171509171930
{ yymsp[1].minor.yy394 = TK_BEFORE; }
171510171931
break;
171511
- case 263: /* trigger_event ::= DELETE|INSERT */
171512
- case 264: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==264);
171932
+ case 262: /* trigger_event ::= DELETE|INSERT */
171933
+ case 263: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==263);
171513171934
{yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;}
171514171935
break;
171515
- case 265: /* trigger_event ::= UPDATE OF idlist */
171936
+ case 264: /* trigger_event ::= UPDATE OF idlist */
171516171937
{yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;}
171517171938
break;
171518
- case 266: /* when_clause ::= */
171519
- case 285: /* key_opt ::= */ yytestcase(yyruleno==285);
171939
+ case 265: /* when_clause ::= */
171940
+ case 284: /* key_opt ::= */ yytestcase(yyruleno==284);
171520171941
{ yymsp[1].minor.yy528 = 0; }
171521171942
break;
171522
- case 267: /* when_clause ::= WHEN expr */
171523
- case 286: /* key_opt ::= KEY expr */ yytestcase(yyruleno==286);
171943
+ case 266: /* when_clause ::= WHEN expr */
171944
+ case 285: /* key_opt ::= KEY expr */ yytestcase(yyruleno==285);
171524171945
{ yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; }
171525171946
break;
171526
- case 268: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
171947
+ case 267: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
171527171948
{
171528171949
assert( yymsp[-2].minor.yy33!=0 );
171529171950
yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33;
171530171951
yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33;
171531171952
}
171532171953
break;
171533
- case 269: /* trigger_cmd_list ::= trigger_cmd SEMI */
171954
+ case 268: /* trigger_cmd_list ::= trigger_cmd SEMI */
171534171955
{
171535171956
assert( yymsp[-1].minor.yy33!=0 );
171536171957
yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33;
171537171958
}
171538171959
break;
171539
- case 270: /* trnm ::= nm DOT nm */
171960
+ case 269: /* trnm ::= nm DOT nm */
171540171961
{
171541171962
yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
171542171963
sqlite3ErrorMsg(pParse,
171543171964
"qualified table names are not allowed on INSERT, UPDATE, and DELETE "
171544171965
"statements within triggers");
171545171966
}
171546171967
break;
171547
- case 271: /* tridxby ::= INDEXED BY nm */
171968
+ case 270: /* tridxby ::= INDEXED BY nm */
171548171969
{
171549171970
sqlite3ErrorMsg(pParse,
171550171971
"the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
171551171972
"within triggers");
171552171973
}
171553171974
break;
171554
- case 272: /* tridxby ::= NOT INDEXED */
171975
+ case 271: /* tridxby ::= NOT INDEXED */
171555171976
{
171556171977
sqlite3ErrorMsg(pParse,
171557171978
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
171558171979
"within triggers");
171559171980
}
171560171981
break;
171561
- case 273: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
171982
+ case 272: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
171562171983
{yylhsminor.yy33 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy131, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528, yymsp[-7].minor.yy394, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy522);}
171563171984
yymsp[-8].minor.yy33 = yylhsminor.yy33;
171564171985
break;
171565
- case 274: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
171986
+ case 273: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
171566171987
{
171567171988
yylhsminor.yy33 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy254,yymsp[-2].minor.yy47,yymsp[-6].minor.yy394,yymsp[-1].minor.yy444,yymsp[-7].minor.yy522,yymsp[0].minor.yy522);/*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/
171568171989
}
171569171990
yymsp[-7].minor.yy33 = yylhsminor.yy33;
171570171991
break;
171571
- case 275: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
171992
+ case 274: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
171572171993
{yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);}
171573171994
yymsp[-5].minor.yy33 = yylhsminor.yy33;
171574171995
break;
171575
- case 276: /* trigger_cmd ::= scanpt select scanpt */
171996
+ case 275: /* trigger_cmd ::= scanpt select scanpt */
171576171997
{yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/}
171577171998
yymsp[-2].minor.yy33 = yylhsminor.yy33;
171578171999
break;
171579
- case 277: /* expr ::= RAISE LP IGNORE RP */
172000
+ case 276: /* expr ::= RAISE LP IGNORE RP */
171580172001
{
171581172002
yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
171582172003
if( yymsp[-3].minor.yy528 ){
171583172004
yymsp[-3].minor.yy528->affExpr = OE_Ignore;
171584172005
}
171585172006
}
171586172007
break;
171587
- case 278: /* expr ::= RAISE LP raisetype COMMA nm RP */
172008
+ case 277: /* expr ::= RAISE LP raisetype COMMA nm RP */
171588172009
{
171589172010
yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
171590172011
if( yymsp[-5].minor.yy528 ) {
171591172012
yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394;
171592172013
}
171593172014
}
171594172015
break;
171595
- case 279: /* raisetype ::= ROLLBACK */
172016
+ case 278: /* raisetype ::= ROLLBACK */
171596172017
{yymsp[0].minor.yy394 = OE_Rollback;}
171597172018
break;
171598
- case 281: /* raisetype ::= FAIL */
172019
+ case 280: /* raisetype ::= FAIL */
171599172020
{yymsp[0].minor.yy394 = OE_Fail;}
171600172021
break;
171601
- case 282: /* cmd ::= DROP TRIGGER ifexists fullname */
172022
+ case 281: /* cmd ::= DROP TRIGGER ifexists fullname */
171602172023
{
171603172024
sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394);
171604172025
}
171605172026
break;
171606
- case 283: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
172027
+ case 282: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
171607172028
{
171608172029
sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528);
171609172030
}
171610172031
break;
171611
- case 284: /* cmd ::= DETACH database_kw_opt expr */
172032
+ case 283: /* cmd ::= DETACH database_kw_opt expr */
171612172033
{
171613172034
sqlite3Detach(pParse, yymsp[0].minor.yy528);
171614172035
}
171615172036
break;
171616
- case 287: /* cmd ::= REINDEX */
172037
+ case 286: /* cmd ::= REINDEX */
171617172038
{sqlite3Reindex(pParse, 0, 0);}
171618172039
break;
171619
- case 288: /* cmd ::= REINDEX nm dbnm */
172040
+ case 287: /* cmd ::= REINDEX nm dbnm */
171620172041
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
171621172042
break;
171622
- case 289: /* cmd ::= ANALYZE */
172043
+ case 288: /* cmd ::= ANALYZE */
171623172044
{sqlite3Analyze(pParse, 0, 0);}
171624172045
break;
171625
- case 290: /* cmd ::= ANALYZE nm dbnm */
172046
+ case 289: /* cmd ::= ANALYZE nm dbnm */
171626172047
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
171627172048
break;
171628
- case 291: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
172049
+ case 290: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
171629172050
{
171630172051
sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0);
171631172052
}
171632172053
break;
171633
- case 292: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
172054
+ case 291: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
171634172055
{
171635172056
yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
171636172057
sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
171637172058
}
171638172059
break;
171639
- case 293: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
172060
+ case 292: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
171640172061
{
171641172062
sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0);
171642172063
}
171643172064
break;
171644
- case 294: /* add_column_fullname ::= fullname */
172065
+ case 293: /* add_column_fullname ::= fullname */
171645172066
{
171646172067
disableLookaside(pParse);
171647172068
sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131);
171648172069
}
171649172070
break;
171650
- case 295: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
172071
+ case 294: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
171651172072
{
171652172073
sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
171653172074
}
171654172075
break;
171655
- case 296: /* cmd ::= create_vtab */
172076
+ case 295: /* cmd ::= create_vtab */
171656172077
{sqlite3VtabFinishParse(pParse,0);}
171657172078
break;
171658
- case 297: /* cmd ::= create_vtab LP vtabarglist RP */
172079
+ case 296: /* cmd ::= create_vtab LP vtabarglist RP */
171659172080
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
171660172081
break;
171661
- case 298: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
172082
+ case 297: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
171662172083
{
171663172084
sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394);
171664172085
}
171665172086
break;
171666
- case 299: /* vtabarg ::= */
172087
+ case 298: /* vtabarg ::= */
171667172088
{sqlite3VtabArgInit(pParse);}
171668172089
break;
171669
- case 300: /* vtabargtoken ::= ANY */
171670
- case 301: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==301);
171671
- case 302: /* lp ::= LP */ yytestcase(yyruleno==302);
172090
+ case 299: /* vtabargtoken ::= ANY */
172091
+ case 300: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==300);
172092
+ case 301: /* lp ::= LP */ yytestcase(yyruleno==301);
171672172093
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
171673172094
break;
171674
- case 303: /* with ::= WITH wqlist */
171675
- case 304: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==304);
172095
+ case 302: /* with ::= WITH wqlist */
172096
+ case 303: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==303);
171676172097
{ sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); }
171677172098
break;
171678
- case 305: /* wqas ::= AS */
172099
+ case 304: /* wqas ::= AS */
171679172100
{yymsp[0].minor.yy516 = M10d_Any;}
171680172101
break;
171681
- case 306: /* wqas ::= AS MATERIALIZED */
172102
+ case 305: /* wqas ::= AS MATERIALIZED */
171682172103
{yymsp[-1].minor.yy516 = M10d_Yes;}
171683172104
break;
171684
- case 307: /* wqas ::= AS NOT MATERIALIZED */
172105
+ case 306: /* wqas ::= AS NOT MATERIALIZED */
171685172106
{yymsp[-2].minor.yy516 = M10d_No;}
171686172107
break;
171687
- case 308: /* wqitem ::= nm eidlist_opt wqas LP select RP */
172108
+ case 307: /* wqitem ::= nm eidlist_opt wqas LP select RP */
171688172109
{
171689172110
yymsp[-5].minor.yy385 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy47, yymsp[-3].minor.yy516); /*A-overwrites-X*/
171690172111
}
171691172112
break;
171692
- case 309: /* wqlist ::= wqitem */
172113
+ case 308: /* wqlist ::= wqitem */
171693172114
{
171694172115
yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/
171695172116
}
171696172117
break;
171697
- case 310: /* wqlist ::= wqlist COMMA wqitem */
172118
+ case 309: /* wqlist ::= wqlist COMMA wqitem */
171698172119
{
171699172120
yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385);
171700172121
}
171701172122
break;
171702
- case 311: /* windowdefn_list ::= windowdefn */
172123
+ case 310: /* windowdefn_list ::= windowdefn */
171703172124
{ yylhsminor.yy41 = yymsp[0].minor.yy41; }
171704172125
yymsp[0].minor.yy41 = yylhsminor.yy41;
171705172126
break;
171706
- case 312: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
172127
+ case 311: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
171707172128
{
171708172129
assert( yymsp[0].minor.yy41!=0 );
171709172130
sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41);
171710172131
yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41;
171711172132
yylhsminor.yy41 = yymsp[0].minor.yy41;
171712172133
}
171713172134
yymsp[-2].minor.yy41 = yylhsminor.yy41;
171714172135
break;
171715
- case 313: /* windowdefn ::= nm AS LP window RP */
172136
+ case 312: /* windowdefn ::= nm AS LP window RP */
171716172137
{
171717172138
if( ALWAYS(yymsp[-1].minor.yy41) ){
171718172139
yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
171719172140
}
171720172141
yylhsminor.yy41 = yymsp[-1].minor.yy41;
171721172142
}
171722172143
yymsp[-4].minor.yy41 = yylhsminor.yy41;
171723172144
break;
171724
- case 314: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
172145
+ case 313: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
171725172146
{
171726172147
yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0);
171727172148
}
171728172149
break;
171729
- case 315: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
172150
+ case 314: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
171730172151
{
171731172152
yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0);
171732172153
}
171733172154
yymsp[-5].minor.yy41 = yylhsminor.yy41;
171734172155
break;
171735
- case 316: /* window ::= ORDER BY sortlist frame_opt */
172156
+ case 315: /* window ::= ORDER BY sortlist frame_opt */
171736172157
{
171737172158
yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0);
171738172159
}
171739172160
break;
171740
- case 317: /* window ::= nm ORDER BY sortlist frame_opt */
172161
+ case 316: /* window ::= nm ORDER BY sortlist frame_opt */
171741172162
{
171742172163
yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
171743172164
}
171744172165
yymsp[-4].minor.yy41 = yylhsminor.yy41;
171745172166
break;
171746
- case 318: /* window ::= frame_opt */
171747
- case 337: /* filter_over ::= over_clause */ yytestcase(yyruleno==337);
172167
+ case 317: /* window ::= frame_opt */
172168
+ case 336: /* filter_over ::= over_clause */ yytestcase(yyruleno==336);
171748172169
{
171749172170
yylhsminor.yy41 = yymsp[0].minor.yy41;
171750172171
}
171751172172
yymsp[0].minor.yy41 = yylhsminor.yy41;
171752172173
break;
171753
- case 319: /* window ::= nm frame_opt */
172174
+ case 318: /* window ::= nm frame_opt */
171754172175
{
171755172176
yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0);
171756172177
}
171757172178
yymsp[-1].minor.yy41 = yylhsminor.yy41;
171758172179
break;
171759
- case 320: /* frame_opt ::= */
172180
+ case 319: /* frame_opt ::= */
171760172181
{
171761172182
yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
171762172183
}
171763172184
break;
171764
- case 321: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
172185
+ case 320: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
171765172186
{
171766172187
yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy394, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy516);
171767172188
}
171768172189
yymsp[-2].minor.yy41 = yylhsminor.yy41;
171769172190
break;
171770
- case 322: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
172191
+ case 321: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
171771172192
{
171772172193
yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy394, yymsp[-3].minor.yy595.eType, yymsp[-3].minor.yy595.pExpr, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, yymsp[0].minor.yy516);
171773172194
}
171774172195
yymsp[-5].minor.yy41 = yylhsminor.yy41;
171775172196
break;
171776
- case 324: /* frame_bound_s ::= frame_bound */
171777
- case 326: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==326);
172197
+ case 323: /* frame_bound_s ::= frame_bound */
172198
+ case 325: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==325);
171778172199
{yylhsminor.yy595 = yymsp[0].minor.yy595;}
171779172200
yymsp[0].minor.yy595 = yylhsminor.yy595;
171780172201
break;
171781
- case 325: /* frame_bound_s ::= UNBOUNDED PRECEDING */
171782
- case 327: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==327);
171783
- case 329: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==329);
172202
+ case 324: /* frame_bound_s ::= UNBOUNDED PRECEDING */
172203
+ case 326: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==326);
172204
+ case 328: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==328);
171784172205
{yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;}
171785172206
yymsp[-1].minor.yy595 = yylhsminor.yy595;
171786172207
break;
171787
- case 328: /* frame_bound ::= expr PRECEDING|FOLLOWING */
172208
+ case 327: /* frame_bound ::= expr PRECEDING|FOLLOWING */
171788172209
{yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;}
171789172210
yymsp[-1].minor.yy595 = yylhsminor.yy595;
171790172211
break;
171791
- case 330: /* frame_exclude_opt ::= */
172212
+ case 329: /* frame_exclude_opt ::= */
171792172213
{yymsp[1].minor.yy516 = 0;}
171793172214
break;
171794
- case 331: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
172215
+ case 330: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
171795172216
{yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;}
171796172217
break;
171797
- case 332: /* frame_exclude ::= NO OTHERS */
171798
- case 333: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==333);
172218
+ case 331: /* frame_exclude ::= NO OTHERS */
172219
+ case 332: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==332);
171799172220
{yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/}
171800172221
break;
171801
- case 334: /* frame_exclude ::= GROUP|TIES */
172222
+ case 333: /* frame_exclude ::= GROUP|TIES */
171802172223
{yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/}
171803172224
break;
171804
- case 335: /* window_clause ::= WINDOW windowdefn_list */
172225
+ case 334: /* window_clause ::= WINDOW windowdefn_list */
171805172226
{ yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; }
171806172227
break;
171807
- case 336: /* filter_over ::= filter_clause over_clause */
172228
+ case 335: /* filter_over ::= filter_clause over_clause */
171808172229
{
171809172230
if( yymsp[0].minor.yy41 ){
171810172231
yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528;
171811172232
}else{
171812172233
sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
@@ -171813,11 +172234,11 @@
171813172234
}
171814172235
yylhsminor.yy41 = yymsp[0].minor.yy41;
171815172236
}
171816172237
yymsp[-1].minor.yy41 = yylhsminor.yy41;
171817172238
break;
171818
- case 338: /* filter_over ::= filter_clause */
172239
+ case 337: /* filter_over ::= filter_clause */
171819172240
{
171820172241
yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
171821172242
if( yylhsminor.yy41 ){
171822172243
yylhsminor.yy41->eFrmType = TK_FILTER;
171823172244
yylhsminor.yy41->pFilter = yymsp[0].minor.yy528;
@@ -171825,91 +172246,90 @@
171825172246
sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528);
171826172247
}
171827172248
}
171828172249
yymsp[0].minor.yy41 = yylhsminor.yy41;
171829172250
break;
171830
- case 339: /* over_clause ::= OVER LP window RP */
172251
+ case 338: /* over_clause ::= OVER LP window RP */
171831172252
{
171832172253
yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41;
171833172254
assert( yymsp[-3].minor.yy41!=0 );
171834172255
}
171835172256
break;
171836
- case 340: /* over_clause ::= OVER nm */
172257
+ case 339: /* over_clause ::= OVER nm */
171837172258
{
171838172259
yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
171839172260
if( yymsp[-1].minor.yy41 ){
171840172261
yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
171841172262
}
171842172263
}
171843172264
break;
171844
- case 341: /* filter_clause ::= FILTER LP WHERE expr RP */
172265
+ case 340: /* filter_clause ::= FILTER LP WHERE expr RP */
171845172266
{ yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; }
171846172267
break;
171847172268
default:
171848
- /* (342) input ::= cmdlist */ yytestcase(yyruleno==342);
171849
- /* (343) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==343);
171850
- /* (344) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=344);
171851
- /* (345) ecmd ::= SEMI */ yytestcase(yyruleno==345);
171852
- /* (346) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==346);
171853
- /* (347) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=347);
171854
- /* (348) trans_opt ::= */ yytestcase(yyruleno==348);
171855
- /* (349) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==349);
171856
- /* (350) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==350);
171857
- /* (351) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==351);
171858
- /* (352) savepoint_opt ::= */ yytestcase(yyruleno==352);
171859
- /* (353) cmd ::= create_table create_table_args */ yytestcase(yyruleno==353);
171860
- /* (354) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=354);
171861
- /* (355) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==355);
171862
- /* (356) columnlist ::= columnname carglist */ yytestcase(yyruleno==356);
171863
- /* (357) nm ::= ID|INDEXED */ yytestcase(yyruleno==357);
171864
- /* (358) nm ::= STRING */ yytestcase(yyruleno==358);
171865
- /* (359) nm ::= JOIN_KW */ yytestcase(yyruleno==359);
171866
- /* (360) typetoken ::= typename */ yytestcase(yyruleno==360);
171867
- /* (361) typename ::= ID|STRING */ yytestcase(yyruleno==361);
171868
- /* (362) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=362);
171869
- /* (363) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=363);
171870
- /* (364) carglist ::= carglist ccons */ yytestcase(yyruleno==364);
171871
- /* (365) carglist ::= */ yytestcase(yyruleno==365);
171872
- /* (366) ccons ::= NULL onconf */ yytestcase(yyruleno==366);
171873
- /* (367) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==367);
171874
- /* (368) ccons ::= AS generated */ yytestcase(yyruleno==368);
171875
- /* (369) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==369);
171876
- /* (370) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==370);
171877
- /* (371) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=371);
171878
- /* (372) tconscomma ::= */ yytestcase(yyruleno==372);
171879
- /* (373) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=373);
171880
- /* (374) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=374);
171881
- /* (375) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=375);
171882
- /* (376) oneselect ::= values */ yytestcase(yyruleno==376);
171883
- /* (377) sclp ::= selcollist COMMA */ yytestcase(yyruleno==377);
171884
- /* (378) as ::= ID|STRING */ yytestcase(yyruleno==378);
171885
- /* (379) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=379);
171886
- /* (380) returning ::= */ yytestcase(yyruleno==380);
171887
- /* (381) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=381);
171888
- /* (382) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==382);
171889
- /* (383) exprlist ::= nexprlist */ yytestcase(yyruleno==383);
171890
- /* (384) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=384);
171891
- /* (385) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=385);
171892
- /* (386) nmnum ::= ON */ yytestcase(yyruleno==386);
171893
- /* (387) nmnum ::= DELETE */ yytestcase(yyruleno==387);
171894
- /* (388) nmnum ::= DEFAULT */ yytestcase(yyruleno==388);
171895
- /* (389) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==389);
171896
- /* (390) foreach_clause ::= */ yytestcase(yyruleno==390);
171897
- /* (391) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==391);
171898
- /* (392) trnm ::= nm */ yytestcase(yyruleno==392);
171899
- /* (393) tridxby ::= */ yytestcase(yyruleno==393);
171900
- /* (394) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==394);
171901
- /* (395) database_kw_opt ::= */ yytestcase(yyruleno==395);
171902
- /* (396) kwcolumn_opt ::= */ yytestcase(yyruleno==396);
171903
- /* (397) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==397);
171904
- /* (398) vtabarglist ::= vtabarg */ yytestcase(yyruleno==398);
171905
- /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==399);
171906
- /* (400) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==400);
171907
- /* (401) anylist ::= */ yytestcase(yyruleno==401);
171908
- /* (402) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==402);
171909
- /* (403) anylist ::= anylist ANY */ yytestcase(yyruleno==403);
171910
- /* (404) with ::= */ yytestcase(yyruleno==404);
172269
+ /* (341) input ::= cmdlist */ yytestcase(yyruleno==341);
172270
+ /* (342) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==342);
172271
+ /* (343) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=343);
172272
+ /* (344) ecmd ::= SEMI */ yytestcase(yyruleno==344);
172273
+ /* (345) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==345);
172274
+ /* (346) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=346);
172275
+ /* (347) trans_opt ::= */ yytestcase(yyruleno==347);
172276
+ /* (348) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==348);
172277
+ /* (349) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==349);
172278
+ /* (350) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==350);
172279
+ /* (351) savepoint_opt ::= */ yytestcase(yyruleno==351);
172280
+ /* (352) cmd ::= create_table create_table_args */ yytestcase(yyruleno==352);
172281
+ /* (353) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=353);
172282
+ /* (354) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==354);
172283
+ /* (355) columnlist ::= columnname carglist */ yytestcase(yyruleno==355);
172284
+ /* (356) nm ::= ID|INDEXED|JOIN_KW */ yytestcase(yyruleno==356);
172285
+ /* (357) nm ::= STRING */ yytestcase(yyruleno==357);
172286
+ /* (358) typetoken ::= typename */ yytestcase(yyruleno==358);
172287
+ /* (359) typename ::= ID|STRING */ yytestcase(yyruleno==359);
172288
+ /* (360) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=360);
172289
+ /* (361) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=361);
172290
+ /* (362) carglist ::= carglist ccons */ yytestcase(yyruleno==362);
172291
+ /* (363) carglist ::= */ yytestcase(yyruleno==363);
172292
+ /* (364) ccons ::= NULL onconf */ yytestcase(yyruleno==364);
172293
+ /* (365) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==365);
172294
+ /* (366) ccons ::= AS generated */ yytestcase(yyruleno==366);
172295
+ /* (367) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==367);
172296
+ /* (368) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==368);
172297
+ /* (369) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=369);
172298
+ /* (370) tconscomma ::= */ yytestcase(yyruleno==370);
172299
+ /* (371) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=371);
172300
+ /* (372) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=372);
172301
+ /* (373) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=373);
172302
+ /* (374) oneselect ::= values */ yytestcase(yyruleno==374);
172303
+ /* (375) sclp ::= selcollist COMMA */ yytestcase(yyruleno==375);
172304
+ /* (376) as ::= ID|STRING */ yytestcase(yyruleno==376);
172305
+ /* (377) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=377);
172306
+ /* (378) returning ::= */ yytestcase(yyruleno==378);
172307
+ /* (379) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=379);
172308
+ /* (380) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==380);
172309
+ /* (381) exprlist ::= nexprlist */ yytestcase(yyruleno==381);
172310
+ /* (382) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=382);
172311
+ /* (383) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=383);
172312
+ /* (384) nmnum ::= ON */ yytestcase(yyruleno==384);
172313
+ /* (385) nmnum ::= DELETE */ yytestcase(yyruleno==385);
172314
+ /* (386) nmnum ::= DEFAULT */ yytestcase(yyruleno==386);
172315
+ /* (387) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==387);
172316
+ /* (388) foreach_clause ::= */ yytestcase(yyruleno==388);
172317
+ /* (389) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==389);
172318
+ /* (390) trnm ::= nm */ yytestcase(yyruleno==390);
172319
+ /* (391) tridxby ::= */ yytestcase(yyruleno==391);
172320
+ /* (392) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==392);
172321
+ /* (393) database_kw_opt ::= */ yytestcase(yyruleno==393);
172322
+ /* (394) kwcolumn_opt ::= */ yytestcase(yyruleno==394);
172323
+ /* (395) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==395);
172324
+ /* (396) vtabarglist ::= vtabarg */ yytestcase(yyruleno==396);
172325
+ /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==397);
172326
+ /* (398) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==398);
172327
+ /* (399) anylist ::= */ yytestcase(yyruleno==399);
172328
+ /* (400) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==400);
172329
+ /* (401) anylist ::= anylist ANY */ yytestcase(yyruleno==401);
172330
+ /* (402) with ::= */ yytestcase(yyruleno==402);
171911172331
break;
171912172332
/********** End reduce actions ************************************************/
171913172333
};
171914172334
assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
171915172335
yygoto = yyRuleInfoLhs[yyruleno];
@@ -174411,13 +174831,25 @@
174411174831
*/
174412174832
SQLITE_API int sqlite3_config(int op, ...){
174413174833
va_list ap;
174414174834
int rc = SQLITE_OK;
174415174835
174416
- /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while
174417
- ** the SQLite library is in use. */
174418
- if( sqlite3GlobalConfig.isInit ) return SQLITE_MISUSE_BKPT;
174836
+ /* sqlite3_config() normally returns SQLITE_MISUSE if it is invoked while
174837
+ ** the SQLite library is in use. Except, a few selected opcodes
174838
+ ** are allowed.
174839
+ */
174840
+ if( sqlite3GlobalConfig.isInit ){
174841
+ static const u64 mAnytimeConfigOption = 0
174842
+ | MASKBIT64( SQLITE_CONFIG_LOG )
174843
+ | MASKBIT64( SQLITE_CONFIG_PCACHE_HDRSZ )
174844
+ ;
174845
+ if( op<0 || op>63 || (MASKBIT64(op) & mAnytimeConfigOption)==0 ){
174846
+ return SQLITE_MISUSE_BKPT;
174847
+ }
174848
+ testcase( op==SQLITE_CONFIG_LOG );
174849
+ testcase( op==SQLITE_CONFIG_PCACHE_HDRSZ );
174850
+ }
174419174851
174420174852
va_start(ap, op);
174421174853
switch( op ){
174422174854
174423174855
/* Mutex configuration options are only available in a threadsafe
@@ -174482,10 +174914,11 @@
174482174914
if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault();
174483174915
*va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m;
174484174916
break;
174485174917
}
174486174918
case SQLITE_CONFIG_MEMSTATUS: {
174919
+ assert( !sqlite3GlobalConfig.isInit ); /* Cannot change at runtime */
174487174920
/* EVIDENCE-OF: R-61275-35157 The SQLITE_CONFIG_MEMSTATUS option takes
174488174921
** single argument of type int, interpreted as a boolean, which enables
174489174922
** or disables the collection of memory allocation statistics. */
174490174923
sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
174491174924
break;
@@ -174605,12 +175038,14 @@
174605175038
/* MSVC is picky about pulling func ptrs from va lists.
174606175039
** http://support.microsoft.com/kb/47961
174607175040
** sqlite3GlobalConfig.xLog = va_arg(ap, void(*)(void*,int,const char*));
174608175041
*/
174609175042
typedef void(*LOGFUNC_t)(void*,int,const char*);
174610
- sqlite3GlobalConfig.xLog = va_arg(ap, LOGFUNC_t);
174611
- sqlite3GlobalConfig.pLogArg = va_arg(ap, void*);
175043
+ LOGFUNC_t xLog = va_arg(ap, LOGFUNC_t);
175044
+ void *pLogArg = va_arg(ap, void*);
175045
+ AtomicStore(&sqlite3GlobalConfig.xLog, xLog);
175046
+ AtomicStore(&sqlite3GlobalConfig.pLogArg, pLogArg);
174612175047
break;
174613175048
}
174614175049
174615175050
/* EVIDENCE-OF: R-55548-33817 The compile-time setting for URI filenames
174616175051
** can be changed at start-time using the
@@ -174620,11 +175055,12 @@
174620175055
case SQLITE_CONFIG_URI: {
174621175056
/* EVIDENCE-OF: R-25451-61125 The SQLITE_CONFIG_URI option takes a single
174622175057
** argument of type int. If non-zero, then URI handling is globally
174623175058
** enabled. If the parameter is zero, then URI handling is globally
174624175059
** disabled. */
174625
- sqlite3GlobalConfig.bOpenUri = va_arg(ap, int);
175060
+ int bOpenUri = va_arg(ap, int);
175061
+ AtomicStore(&sqlite3GlobalConfig.bOpenUri, bOpenUri);
174626175062
break;
174627175063
}
174628175064
174629175065
case SQLITE_CONFIG_COVERING_INDEX_SCAN: {
174630175066
/* EVIDENCE-OF: R-36592-02772 The SQLITE_CONFIG_COVERING_INDEX_SCAN
@@ -174935,10 +175371,12 @@
174935175371
{ SQLITE_DBCONFIG_LEGACY_ALTER_TABLE, SQLITE_LegacyAlter },
174936175372
{ SQLITE_DBCONFIG_DQS_DDL, SQLITE_DqsDDL },
174937175373
{ SQLITE_DBCONFIG_DQS_DML, SQLITE_DqsDML },
174938175374
{ SQLITE_DBCONFIG_LEGACY_FILE_FORMAT, SQLITE_LegacyFileFmt },
174939175375
{ SQLITE_DBCONFIG_TRUSTED_SCHEMA, SQLITE_TrustedSchema },
175376
+ { SQLITE_DBCONFIG_STMT_SCANSTATUS, SQLITE_StmtScanStatus },
175377
+ { SQLITE_DBCONFIG_REVERSE_SCANORDER, SQLITE_ReverseOrder },
174940175378
};
174941175379
unsigned int i;
174942175380
rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
174943175381
for(i=0; i<ArraySize(aFlagOp); i++){
174944175382
if( aFlagOp[i].op==op ){
@@ -176920,13 +177358,13 @@
176920177358
char c;
176921177359
int nUri = sqlite3Strlen30(zUri);
176922177360
176923177361
assert( *pzErrMsg==0 );
176924177362
176925
- if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */
176926
- || sqlite3GlobalConfig.bOpenUri) /* IMP: R-51689-46548 */
176927
- && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
177363
+ if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */
177364
+ || AtomicLoad(&sqlite3GlobalConfig.bOpenUri)) /* IMP: R-51689-46548 */
177365
+ && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
176928177366
){
176929177367
char *zOpt;
176930177368
int eState; /* Parser state when parsing URI */
176931177369
int iIn; /* Input character index */
176932177370
int iOut = 0; /* Output character index */
@@ -177328,10 +177766,13 @@
177328177766
#if defined(SQLITE_DEFAULT_DEFENSIVE)
177329177767
| SQLITE_Defensive
177330177768
#endif
177331177769
#if defined(SQLITE_DEFAULT_LEGACY_ALTER_TABLE)
177332177770
| SQLITE_LegacyAlter
177771
+#endif
177772
+#if defined(SQLITE_ENABLE_STMT_SCANSTATUS)
177773
+ | SQLITE_StmtScanStatus
177333177774
#endif
177334177775
;
177335177776
sqlite3HashInit(&db->aCollSeq);
177336177777
#ifndef SQLITE_OMIT_VIRTUALTABLE
177337177778
sqlite3HashInit(&db->aModule);
@@ -193097,20 +193538,22 @@
193097193538
static int fts3MsrBufferData(
193098193539
Fts3MultiSegReader *pMsr, /* Multi-segment-reader handle */
193099193540
char *pList,
193100193541
i64 nList
193101193542
){
193102
- if( nList>pMsr->nBuffer ){
193543
+ if( (nList+FTS3_NODE_PADDING)>pMsr->nBuffer ){
193103193544
char *pNew;
193104
- pMsr->nBuffer = nList*2;
193105
- pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, pMsr->nBuffer);
193545
+ int nNew = nList*2 + FTS3_NODE_PADDING;
193546
+ pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, nNew);
193106193547
if( !pNew ) return SQLITE_NOMEM;
193107193548
pMsr->aBuffer = pNew;
193549
+ pMsr->nBuffer = nNew;
193108193550
}
193109193551
193110193552
assert( nList>0 );
193111193553
memcpy(pMsr->aBuffer, pList, nList);
193554
+ memset(&pMsr->aBuffer[nList], 0, FTS3_NODE_PADDING);
193112193555
return SQLITE_OK;
193113193556
}
193114193557
193115193558
SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext(
193116193559
Fts3Table *p, /* Virtual table handle */
@@ -199098,12 +199541,15 @@
199098199541
switch( sqlite3_value_type(pValue) ){
199099199542
case SQLITE_NULL: {
199100199543
jsonAppendRaw(p, "null", 4);
199101199544
break;
199102199545
}
199103
- case SQLITE_INTEGER:
199104199546
case SQLITE_FLOAT: {
199547
+ jsonPrintf(100, p, "%!0.15g", sqlite3_value_double(pValue));
199548
+ break;
199549
+ }
199550
+ case SQLITE_INTEGER: {
199105199551
const char *z = (const char*)sqlite3_value_text(pValue);
199106199552
u32 n = (u32)sqlite3_value_bytes(pValue);
199107199553
jsonAppendRaw(p, z, n);
199108199554
break;
199109199555
}
@@ -218244,13 +218690,14 @@
218244218690
SessionBuffer *p,
218245218691
const char *zStr,
218246218692
int *pRc
218247218693
){
218248218694
int nStr = sqlite3Strlen30(zStr);
218249
- if( 0==sessionBufferGrow(p, nStr, pRc) ){
218695
+ if( 0==sessionBufferGrow(p, nStr+1, pRc) ){
218250218696
memcpy(&p->aBuf[p->nBuf], zStr, nStr);
218251218697
p->nBuf += nStr;
218698
+ p->aBuf[p->nBuf] = 0x00;
218252218699
}
218253218700
}
218254218701
218255218702
/*
218256218703
** This function is a no-op if *pRc is other than SQLITE_OK when it is
@@ -218267,10 +218714,31 @@
218267218714
){
218268218715
char aBuf[24];
218269218716
sqlite3_snprintf(sizeof(aBuf)-1, aBuf, "%d", iVal);
218270218717
sessionAppendStr(p, aBuf, pRc);
218271218718
}
218719
+
218720
+static void sessionAppendPrintf(
218721
+ SessionBuffer *p, /* Buffer to append to */
218722
+ int *pRc,
218723
+ const char *zFmt,
218724
+ ...
218725
+){
218726
+ if( *pRc==SQLITE_OK ){
218727
+ char *zApp = 0;
218728
+ va_list ap;
218729
+ va_start(ap, zFmt);
218730
+ zApp = sqlite3_vmprintf(zFmt, ap);
218731
+ if( zApp==0 ){
218732
+ *pRc = SQLITE_NOMEM;
218733
+ }else{
218734
+ sessionAppendStr(p, zApp, pRc);
218735
+ }
218736
+ va_end(ap);
218737
+ sqlite3_free(zApp);
218738
+ }
218739
+}
218272218740
218273218741
/*
218274218742
** This function is a no-op if *pRc is other than SQLITE_OK when it is
218275218743
** called. Otherwise, append the string zStr enclosed in quotes (") and
218276218744
** with any embedded quote characters escaped to the buffer. No
@@ -218282,11 +218750,11 @@
218282218750
static void sessionAppendIdent(
218283218751
SessionBuffer *p, /* Buffer to a append to */
218284218752
const char *zStr, /* String to quote, escape and append */
218285218753
int *pRc /* IN/OUT: Error code */
218286218754
){
218287
- int nStr = sqlite3Strlen30(zStr)*2 + 2 + 1;
218755
+ int nStr = sqlite3Strlen30(zStr)*2 + 2 + 2;
218288218756
if( 0==sessionBufferGrow(p, nStr, pRc) ){
218289218757
char *zOut = (char *)&p->aBuf[p->nBuf];
218290218758
const char *zIn = zStr;
218291218759
*zOut++ = '"';
218292218760
while( *zIn ){
@@ -218293,10 +218761,11 @@
218293218761
if( *zIn=='"' ) *zOut++ = '"';
218294218762
*zOut++ = *(zIn++);
218295218763
}
218296218764
*zOut++ = '"';
218297218765
p->nBuf = (int)((u8 *)zOut - p->aBuf);
218766
+ p->aBuf[p->nBuf] = 0x00;
218298218767
}
218299218768
}
218300218769
218301218770
/*
218302218771
** This function is a no-op if *pRc is other than SQLITE_OK when it is
@@ -218517,33 +218986,82 @@
218517218986
218518218987
/*
218519218988
** Formulate and prepare a SELECT statement to retrieve a row from table
218520218989
** zTab in database zDb based on its primary key. i.e.
218521218990
**
218522
-** SELECT * FROM zDb.zTab WHERE pk1 = ? AND pk2 = ? AND ...
218991
+** SELECT *, <noop-test> FROM zDb.zTab WHERE (pk1, pk2,...) IS (?1, ?2,...)
218992
+**
218993
+** where <noop-test> is:
218994
+**
218995
+** 1 AND (?A OR ?1 IS <column>) AND ...
218996
+**
218997
+** for each non-pk <column>.
218523218998
*/
218524218999
static int sessionSelectStmt(
218525219000
sqlite3 *db, /* Database handle */
219001
+ int bIgnoreNoop,
218526219002
const char *zDb, /* Database name */
218527219003
const char *zTab, /* Table name */
218528219004
int nCol, /* Number of columns in table */
218529219005
const char **azCol, /* Names of table columns */
218530219006
u8 *abPK, /* PRIMARY KEY array */
218531219007
sqlite3_stmt **ppStmt /* OUT: Prepared SELECT statement */
218532219008
){
218533219009
int rc = SQLITE_OK;
218534219010
char *zSql = 0;
219011
+ const char *zSep = "";
219012
+ const char *zCols = "*";
218535219013
int nSql = -1;
219014
+ int i;
218536219015
219016
+ SessionBuffer nooptest = {0, 0, 0};
219017
+ SessionBuffer pkfield = {0, 0, 0};
219018
+ SessionBuffer pkvar = {0, 0, 0};
219019
+
219020
+ sessionAppendStr(&nooptest, ", 1", &rc);
219021
+
219022
+ if( 0==sqlite3_stricmp("sqlite_stat1", zTab) ){
219023
+ sessionAppendStr(&nooptest, " AND (?6 OR ?3 IS stat)", &rc);
219024
+ sessionAppendStr(&pkfield, "tbl, idx", &rc);
219025
+ sessionAppendStr(&pkvar,
219026
+ "?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", &rc
219027
+ );
219028
+ zCols = "tbl, ?2, stat";
219029
+ }else{
219030
+ for(i=0; i<nCol; i++){
219031
+
219032
+ if( abPK[i] ){
219033
+ sessionAppendStr(&pkfield, zSep, &rc);
219034
+ sessionAppendStr(&pkvar, zSep, &rc);
219035
+ zSep = ", ";
219036
+ sessionAppendIdent(&pkfield, azCol[i], &rc);
219037
+ sessionAppendPrintf(&pkvar, &rc, "?%d", i+1);
219038
+ }else{
219039
+ sessionAppendPrintf(&nooptest, &rc,
219040
+ " AND (?%d OR ?%d IS %w.%w)", i+1+nCol, i+1, zTab, azCol[i]
219041
+ );
219042
+ }
219043
+ }
219044
+ }
219045
+
219046
+ if( rc==SQLITE_OK ){
219047
+ zSql = sqlite3_mprintf(
219048
+ "SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)",
219049
+ zCols, (bIgnoreNoop ? (char*)nooptest.aBuf : ""),
219050
+ zDb, zTab, (char*)pkfield.aBuf, (char*)pkvar.aBuf
219051
+ );
219052
+ if( zSql==0 ) rc = SQLITE_NOMEM;
219053
+ }
219054
+
219055
+#if 0
218537219056
if( 0==sqlite3_stricmp("sqlite_stat1", zTab) ){
218538219057
zSql = sqlite3_mprintf(
218539219058
"SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND "
218540219059
"idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", zDb
218541219060
);
218542219061
if( zSql==0 ) rc = SQLITE_NOMEM;
218543219062
}else{
218544
- int i;
218545219063
const char *zSep = "";
218546219064
SessionBuffer buf = {0, 0, 0};
218547219065
218548219066
sessionAppendStr(&buf, "SELECT * FROM ", &rc);
218549219067
sessionAppendIdent(&buf, zDb, &rc);
@@ -218560,15 +219078,19 @@
218560219078
}
218561219079
}
218562219080
zSql = (char*)buf.aBuf;
218563219081
nSql = buf.nBuf;
218564219082
}
219083
+#endif
218565219084
218566219085
if( rc==SQLITE_OK ){
218567219086
rc = sqlite3_prepare_v2(db, zSql, nSql, ppStmt, 0);
218568219087
}
218569219088
sqlite3_free(zSql);
219089
+ sqlite3_free(nooptest.aBuf);
219090
+ sqlite3_free(pkfield.aBuf);
219091
+ sqlite3_free(pkvar.aBuf);
218570219092
return rc;
218571219093
}
218572219094
218573219095
/*
218574219096
** Bind the PRIMARY KEY values from the change passed in argument pChange
@@ -218724,11 +219246,12 @@
218724219246
sessionAppendTableHdr(&buf, bPatchset, pTab, &rc);
218725219247
218726219248
/* Build and compile a statement to execute: */
218727219249
if( rc==SQLITE_OK ){
218728219250
rc = sessionSelectStmt(
218729
- db, pSession->zDb, zName, nCol, azCol, abPK, &pSel);
219251
+ db, 0, pSession->zDb, zName, nCol, azCol, abPK, &pSel
219252
+ );
218730219253
}
218731219254
218732219255
nNoop = buf.nBuf;
218733219256
for(i=0; i<pTab->nChange && rc==SQLITE_OK; i++){
218734219257
SessionChange *p; /* Used to iterate through changes */
@@ -219913,10 +220436,11 @@
219913220436
int bInvertConstraints; /* Invert when iterating constraints buffer */
219914220437
SessionBuffer constraints; /* Deferred constraints are stored here */
219915220438
SessionBuffer rebase; /* Rebase information (if any) here */
219916220439
u8 bRebaseStarted; /* If table header is already in rebase */
219917220440
u8 bRebase; /* True to collect rebase information */
220441
+ u8 bIgnoreNoop; /* True to ignore no-op conflicts */
219918220442
};
219919220443
219920220444
/* Number of prepared UPDATE statements to cache. */
219921220445
#define SESSION_UPDATE_CACHE_SZ 12
219922220446
@@ -220163,12 +220687,13 @@
220163220687
static int sessionSelectRow(
220164220688
sqlite3 *db, /* Database handle */
220165220689
const char *zTab, /* Table name */
220166220690
SessionApplyCtx *p /* Session changeset-apply context */
220167220691
){
220168
- return sessionSelectStmt(
220169
- db, "main", zTab, p->nCol, p->azCol, p->abPK, &p->pSelect);
220692
+ return sessionSelectStmt(db, p->bIgnoreNoop,
220693
+ "main", zTab, p->nCol, p->azCol, p->abPK, &p->pSelect
220694
+ );
220170220695
}
220171220696
220172220697
/*
220173220698
** Formulate and prepare an INSERT statement to add a record to table zTab.
220174220699
** For example:
@@ -220323,23 +220848,36 @@
220323220848
** new.* record to the SELECT statement. Or, if it points to a DELETE or
220324220849
** UPDATE, bind values from the old.* record.
220325220850
*/
220326220851
static int sessionSeekToRow(
220327220852
sqlite3_changeset_iter *pIter, /* Changeset iterator */
220328
- u8 *abPK, /* Primary key flags array */
220329
- sqlite3_stmt *pSelect /* SELECT statement from sessionSelectRow() */
220853
+ SessionApplyCtx *p
220330220854
){
220855
+ sqlite3_stmt *pSelect = p->pSelect;
220331220856
int rc; /* Return code */
220332220857
int nCol; /* Number of columns in table */
220333220858
int op; /* Changset operation (SQLITE_UPDATE etc.) */
220334220859
const char *zDummy; /* Unused */
220335220860
220861
+ sqlite3_clear_bindings(pSelect);
220336220862
sqlite3changeset_op(pIter, &zDummy, &nCol, &op, 0);
220337220863
rc = sessionBindRow(pIter,
220338220864
op==SQLITE_INSERT ? sqlite3changeset_new : sqlite3changeset_old,
220339
- nCol, abPK, pSelect
220865
+ nCol, p->abPK, pSelect
220340220866
);
220867
+
220868
+ if( op!=SQLITE_DELETE && p->bIgnoreNoop ){
220869
+ int ii;
220870
+ for(ii=0; rc==SQLITE_OK && ii<nCol; ii++){
220871
+ if( p->abPK[ii]==0 ){
220872
+ sqlite3_value *pVal = 0;
220873
+ sqlite3changeset_new(pIter, ii, &pVal);
220874
+ sqlite3_bind_int(pSelect, ii+1+nCol, (pVal==0));
220875
+ if( pVal ) rc = sessionBindValue(pSelect, ii+1, pVal);
220876
+ }
220877
+ }
220878
+ }
220341220879
220342220880
if( rc==SQLITE_OK ){
220343220881
rc = sqlite3_step(pSelect);
220344220882
if( rc!=SQLITE_ROW ) rc = sqlite3_reset(pSelect);
220345220883
}
@@ -220451,20 +220989,26 @@
220451220989
assert( SQLITE_CHANGESET_CONFLICT+1==SQLITE_CHANGESET_CONSTRAINT );
220452220990
assert( SQLITE_CHANGESET_DATA+1==SQLITE_CHANGESET_NOTFOUND );
220453220991
220454220992
/* Bind the new.* PRIMARY KEY values to the SELECT statement. */
220455220993
if( pbReplace ){
220456
- rc = sessionSeekToRow(pIter, p->abPK, p->pSelect);
220994
+ rc = sessionSeekToRow(pIter, p);
220457220995
}else{
220458220996
rc = SQLITE_OK;
220459220997
}
220460220998
220461220999
if( rc==SQLITE_ROW ){
220462221000
/* There exists another row with the new.* primary key. */
220463
- pIter->pConflict = p->pSelect;
220464
- res = xConflict(pCtx, eType, pIter);
220465
- pIter->pConflict = 0;
221001
+ if( p->bIgnoreNoop
221002
+ && sqlite3_column_int(p->pSelect, sqlite3_column_count(p->pSelect)-1)
221003
+ ){
221004
+ res = SQLITE_CHANGESET_OMIT;
221005
+ }else{
221006
+ pIter->pConflict = p->pSelect;
221007
+ res = xConflict(pCtx, eType, pIter);
221008
+ pIter->pConflict = 0;
221009
+ }
220466221010
rc = sqlite3_reset(p->pSelect);
220467221011
}else if( rc==SQLITE_OK ){
220468221012
if( p->bDeferConstraints && eType==SQLITE_CHANGESET_CONFLICT ){
220469221013
/* Instead of invoking the conflict handler, append the change blob
220470221014
** to the SessionApplyCtx.constraints buffer. */
@@ -220568,11 +221112,11 @@
220568221112
}
220569221113
if( rc!=SQLITE_OK ) return rc;
220570221114
220571221115
sqlite3_step(p->pDelete);
220572221116
rc = sqlite3_reset(p->pDelete);
220573
- if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 ){
221117
+ if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 && p->bIgnoreNoop==0 ){
220574221118
rc = sessionConflictHandler(
220575221119
SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry
220576221120
);
220577221121
}else if( (rc&0xff)==SQLITE_CONSTRAINT ){
220578221122
rc = sessionConflictHandler(
@@ -220625,11 +221169,11 @@
220625221169
assert( op==SQLITE_INSERT );
220626221170
if( p->bStat1 ){
220627221171
/* Check if there is a conflicting row. For sqlite_stat1, this needs
220628221172
** to be done using a SELECT, as there is no PRIMARY KEY in the
220629221173
** database schema to throw an exception if a duplicate is inserted. */
220630
- rc = sessionSeekToRow(pIter, p->abPK, p->pSelect);
221174
+ rc = sessionSeekToRow(pIter, p);
220631221175
if( rc==SQLITE_ROW ){
220632221176
rc = SQLITE_CONSTRAINT;
220633221177
sqlite3_reset(p->pSelect);
220634221178
}
220635221179
}
@@ -220802,10 +221346,11 @@
220802221346
220803221347
pIter->in.bNoDiscard = 1;
220804221348
memset(&sApply, 0, sizeof(sApply));
220805221349
sApply.bRebase = (ppRebase && pnRebase);
220806221350
sApply.bInvertConstraints = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
221351
+ sApply.bIgnoreNoop = !!(flags & SQLITE_CHANGESETAPPLY_IGNORENOOP);
220807221352
sqlite3_mutex_enter(sqlite3_db_mutex(db));
220808221353
if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){
220809221354
rc = sqlite3_exec(db, "SAVEPOINT changeset_apply", 0, 0, 0);
220810221355
}
220811221356
if( rc==SQLITE_OK ){
@@ -225058,11 +225603,11 @@
225058225603
UNUSED_PARAM2(pToken, nToken);
225059225604
225060225605
if( tflags & FTS5_TOKEN_COLOCATED ) return SQLITE_OK;
225061225606
iPos = p->iPos++;
225062225607
225063
- if( p->iRangeEnd>0 ){
225608
+ if( p->iRangeEnd>=0 ){
225064225609
if( iPos<p->iRangeStart || iPos>p->iRangeEnd ) return SQLITE_OK;
225065225610
if( p->iRangeStart && iPos==p->iRangeStart ) p->iOff = iStartOff;
225066225611
}
225067225612
225068225613
if( iPos==p->iter.iStart ){
@@ -225070,11 +225615,11 @@
225070225615
fts5HighlightAppend(&rc, p, p->zOpen, -1);
225071225616
p->iOff = iStartOff;
225072225617
}
225073225618
225074225619
if( iPos==p->iter.iEnd ){
225075
- if( p->iRangeEnd && p->iter.iStart<p->iRangeStart ){
225620
+ if( p->iRangeEnd>=0 && p->iter.iStart<p->iRangeStart ){
225076225621
fts5HighlightAppend(&rc, p, p->zOpen, -1);
225077225622
}
225078225623
fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
225079225624
fts5HighlightAppend(&rc, p, p->zClose, -1);
225080225625
p->iOff = iEndOff;
@@ -225081,11 +225626,11 @@
225081225626
if( rc==SQLITE_OK ){
225082225627
rc = fts5CInstIterNext(&p->iter);
225083225628
}
225084225629
}
225085225630
225086
- if( p->iRangeEnd>0 && iPos==p->iRangeEnd ){
225631
+ if( p->iRangeEnd>=0 && iPos==p->iRangeEnd ){
225087225632
fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
225088225633
p->iOff = iEndOff;
225089225634
if( iPos>=p->iter.iStart && iPos<p->iter.iEnd ){
225090225635
fts5HighlightAppend(&rc, p, p->zClose, -1);
225091225636
}
@@ -225116,10 +225661,11 @@
225116225661
225117225662
iCol = sqlite3_value_int(apVal[0]);
225118225663
memset(&ctx, 0, sizeof(HighlightContext));
225119225664
ctx.zOpen = (const char*)sqlite3_value_text(apVal[1]);
225120225665
ctx.zClose = (const char*)sqlite3_value_text(apVal[2]);
225666
+ ctx.iRangeEnd = -1;
225121225667
rc = pApi->xColumnText(pFts, iCol, &ctx.zIn, &ctx.nIn);
225122225668
225123225669
if( ctx.zIn ){
225124225670
if( rc==SQLITE_OK ){
225125225671
rc = fts5CInstIterInit(pApi, pFts, iCol, &ctx.iter);
@@ -225301,10 +225847,11 @@
225301225847
nCol = pApi->xColumnCount(pFts);
225302225848
memset(&ctx, 0, sizeof(HighlightContext));
225303225849
iCol = sqlite3_value_int(apVal[0]);
225304225850
ctx.zOpen = fts5ValueToText(apVal[1]);
225305225851
ctx.zClose = fts5ValueToText(apVal[2]);
225852
+ ctx.iRangeEnd = -1;
225306225853
zEllips = fts5ValueToText(apVal[3]);
225307225854
nToken = sqlite3_value_int(apVal[4]);
225308225855
225309225856
iBestCol = (iCol>=0 ? iCol : 0);
225310225857
nPhrase = pApi->xPhraseCount(pFts);
@@ -240250,11 +240797,11 @@
240250240797
int nArg, /* Number of args */
240251240798
sqlite3_value **apUnused /* Function arguments */
240252240799
){
240253240800
assert( nArg==0 );
240254240801
UNUSED_PARAM2(nArg, apUnused);
240255
- sqlite3_result_text(pCtx, "fts5: 2023-03-17 12:25:10 c5bd0ea3b5b2f3ed8e971c5fd6e85e8f06d8055d74df65612c3794138306e6ba", -1, SQLITE_TRANSIENT);
240802
+ sqlite3_result_text(pCtx, "fts5: 2023-04-01 12:22:57 33ac62d8eec56eb71f20ccd28a5d6e4e8051522feb2db0199abee9e18ce1f64e", -1, SQLITE_TRANSIENT);
240256240803
}
240257240804
240258240805
/*
240259240806
** Return true if zName is the extension on one of the shadow tables used
240260240807
** by this module.
240261240808
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.41.2. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -450,13 +450,13 @@
450 **
451 ** See also: [sqlite3_libversion()],
452 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453 ** [sqlite_version()] and [sqlite_source_id()].
454 */
455 #define SQLITE_VERSION "3.41.2"
456 #define SQLITE_VERSION_NUMBER 3041002
457 #define SQLITE_SOURCE_ID "2023-03-17 12:25:10 c5bd0ea3b5b2f3ed8e971c5fd6e85e8f06d8055d74df65612c3794138306e6ba"
458
459 /*
460 ** CAPI3REF: Run-Time Library Version Numbers
461 ** KEYWORDS: sqlite3_version sqlite3_sourceid
462 **
@@ -1959,23 +1959,26 @@
1959 **
1960 ** <b>The sqlite3_config() interface is not threadsafe. The application
1961 ** must ensure that no other SQLite interfaces are invoked by other
1962 ** threads while sqlite3_config() is running.</b>
1963 **
1964 ** The sqlite3_config() interface
1965 ** may only be invoked prior to library initialization using
1966 ** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1967 ** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1968 ** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
1969 ** Note, however, that ^sqlite3_config() can be called as part of the
1970 ** implementation of an application-defined [sqlite3_os_init()].
1971 **
1972 ** The first argument to sqlite3_config() is an integer
1973 ** [configuration option] that determines
1974 ** what property of SQLite is to be configured. Subsequent arguments
1975 ** vary depending on the [configuration option]
1976 ** in the first argument.
 
 
 
 
 
 
 
 
 
 
 
1977 **
1978 ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
1979 ** ^If the option is unknown or SQLite is unable to set the option
1980 ** then this routine returns a non-zero [error code].
1981 */
@@ -2079,10 +2082,27 @@
2079 ** CAPI3REF: Configuration Options
2080 ** KEYWORDS: {configuration option}
2081 **
2082 ** These constants are the available integer configuration options that
2083 ** can be passed as the first argument to the [sqlite3_config()] interface.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2084 **
2085 ** New configuration options may be added in future releases of SQLite.
2086 ** Existing configuration options might be discontinued. Applications
2087 ** should check the return code from [sqlite3_config()] to make sure that
2088 ** the call worked. The [sqlite3_config()] interface will return a
@@ -2740,10 +2760,30 @@
2740 ** the [VACUUM] command will fail with an obscure error when attempting to
2741 ** process a table with generated columns and a descending index. This is
2742 ** not considered a bug since SQLite versions 3.3.0 and earlier do not support
2743 ** either generated columns or decending indexes.
2744 ** </dd>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2745 ** </dl>
2746 */
2747 #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
2748 #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
2749 #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
@@ -2760,11 +2800,13 @@
2760 #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
2761 #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
2762 #define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
2763 #define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
2764 #define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
2765 #define SQLITE_DBCONFIG_MAX 1017 /* Largest DBCONFIG */
 
 
2766
2767 /*
2768 ** CAPI3REF: Enable Or Disable Extended Result Codes
2769 ** METHOD: sqlite3
2770 **
@@ -12217,13 +12259,27 @@
12217 **
12218 ** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
12219 ** Invert the changeset before applying it. This is equivalent to inverting
12220 ** a changeset using sqlite3changeset_invert() before applying it. It is
12221 ** an error to specify this flag with a patchset.
 
 
 
 
 
 
 
 
 
 
 
 
 
12222 */
12223 #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
12224 #define SQLITE_CHANGESETAPPLY_INVERT 0x0002
 
12225
12226 /*
12227 ** CAPI3REF: Constants Passed To The Conflict Handler
12228 **
12229 ** Values that may be passed as the second argument to a conflict-handler.
@@ -13516,12 +13572,12 @@
13516 #pragma warn -csu /* Comparing signed and unsigned */
13517 #pragma warn -spa /* Suspicious pointer arithmetic */
13518 #endif
13519
13520 /*
13521 ** WAL mode depends on atomic aligned 32-bit loads and stores in a few
13522 ** places. The following macros try to make this explicit.
13523 */
13524 #ifndef __has_extension
13525 # define __has_extension(x) 0 /* compatibility with non-clang compilers */
13526 #endif
13527 #if GCC_VERSION>=4007000 || __has_extension(c_atomic)
@@ -16590,11 +16646,11 @@
16590 /**********************************************************************
16591 ** Elements above, except pCache, are public. All that follow are
16592 ** private to pcache.c and should not be accessed by other modules.
16593 ** pCache is grouped with the public elements for efficiency.
16594 */
16595 i16 nRef; /* Number of users of this page */
16596 PgHdr *pDirtyNext; /* Next element in list of dirty pages */
16597 PgHdr *pDirtyPrev; /* Previous element in list of dirty pages */
16598 /* NB: pDirtyNext and pDirtyPrev are undefined if the
16599 ** PgHdr object is not dirty */
16600 };
@@ -16671,16 +16727,16 @@
16671
16672 /* Discard the contents of the cache */
16673 SQLITE_PRIVATE void sqlite3PcacheClear(PCache*);
16674
16675 /* Return the total number of outstanding page references */
16676 SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache*);
16677
16678 /* Increment the reference count of an existing page */
16679 SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr*);
16680
16681 SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr*);
16682
16683 /* Return the total number of pages stored in the cache */
16684 SQLITE_PRIVATE int sqlite3PcachePagecount(PCache*);
16685
16686 #if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
@@ -17251,11 +17307,11 @@
17251 #define SQLITE_TrustedSchema 0x00000080 /* Allow unsafe functions and
17252 ** vtabs in the schema definition */
17253 #define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */
17254 /* result set is empty */
17255 #define SQLITE_IgnoreChecks 0x00000200 /* Do not enforce check constraints */
17256 #define SQLITE_ReadUncommit 0x00000400 /* READ UNCOMMITTED in shared-cache */
17257 #define SQLITE_NoCkptOnClose 0x00000800 /* No checkpoint on close()/DETACH */
17258 #define SQLITE_ReverseOrder 0x00001000 /* Reverse unordered SELECTs */
17259 #define SQLITE_RecTriggers 0x00002000 /* Enable recursive triggers */
17260 #define SQLITE_ForeignKeys 0x00004000 /* Enforce foreign key constraints */
17261 #define SQLITE_AutoIndex 0x00008000 /* Enable automatic indexes */
@@ -17277,10 +17333,11 @@
17277 #define SQLITE_EnableView 0x80000000 /* Enable the use of views */
17278 #define SQLITE_CountRows HI(0x00001) /* Count rows changed by INSERT, */
17279 /* DELETE, or UPDATE and return */
17280 /* the count using a callback. */
17281 #define SQLITE_CorruptRdOnly HI(0x00002) /* Prohibit writes due to error */
 
17282
17283 /* Flags used only if debugging */
17284 #ifdef SQLITE_DEBUG
17285 #define SQLITE_SqlTrace HI(0x0100000) /* Debug print SQL as it executes */
17286 #define SQLITE_VdbeListing HI(0x0200000) /* Debug listings of VDBE progs */
@@ -17333,10 +17390,11 @@
17333 #define SQLITE_ReleaseReg 0x00400000 /* Use OP_ReleaseReg for testing */
17334 #define SQLITE_FlttnUnionAll 0x00800000 /* Disable the UNION ALL flattener */
17335 /* TH3 expects this value ^^^^^^^^^^ See flatten04.test */
17336 #define SQLITE_IndexedExpr 0x01000000 /* Pull exprs from index when able */
17337 #define SQLITE_Coroutines 0x02000000 /* Co-routines for subqueries */
 
17338 #define SQLITE_AllOpts 0xffffffff /* All optimizations */
17339
17340 /*
17341 ** Macros for testing whether or not optimizations are enabled or disabled.
17342 */
@@ -20141,10 +20199,14 @@
20141 SQLITE_PRIVATE int sqlite3GetTempReg(Parse*);
20142 SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int);
20143 SQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int);
20144 SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int);
20145 SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse*);
 
 
 
 
20146 #ifdef SQLITE_DEBUG
20147 SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int);
20148 #endif
20149 SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
20150 SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
@@ -20291,11 +20353,11 @@
20291 SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*);
20292 SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*,
20293 Expr*,ExprList*,u32,Expr*);
20294 SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*);
20295 SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*);
20296 SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, int);
20297 SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
20298 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
20299 SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*);
20300 #endif
20301 SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe*,int,const char*);
@@ -21077,10 +21139,16 @@
21077 #if defined(VDBE_PROFILE) \
21078 || defined(SQLITE_PERFORMANCE_TRACE) \
21079 || defined(SQLITE_ENABLE_STMT_SCANSTATUS)
21080 SQLITE_PRIVATE sqlite3_uint64 sqlite3Hwtime(void);
21081 #endif
 
 
 
 
 
 
21082
21083 #endif /* SQLITEINT_H */
21084
21085 /************** End of sqliteInt.h *******************************************/
21086 /************** Begin file os_common.h ***************************************/
@@ -22267,11 +22335,11 @@
22267 0, /* xAltLocaltime */
22268 0x7ffffffe, /* iOnceResetThreshold */
22269 SQLITE_DEFAULT_SORTERREF_SIZE, /* szSorterRef */
22270 0, /* iPrngSeed */
22271 #ifdef SQLITE_DEBUG
22272 {0,0,0,0,0,0} /* aTune */
22273 #endif
22274 };
22275
22276 /*
22277 ** Hash table for global functions - functions common to all
@@ -30072,10 +30140,24 @@
30072 *val = (*val - d)*10.0;
30073 return (char)digit;
30074 }
30075 #endif /* SQLITE_OMIT_FLOATING_POINT */
30076
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30077 /*
30078 ** Set the StrAccum object to an error mode.
30079 */
30080 SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum *p, u8 eError){
30081 assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG );
@@ -30164,10 +30246,12 @@
30164 etByte xtype = etINVALID; /* Conversion paradigm */
30165 u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */
30166 char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
30167 sqlite_uint64 longvalue; /* Value for integer types */
30168 LONGDOUBLE_TYPE realvalue; /* Value for real types */
 
 
30169 const et_info *infop; /* Pointer to the appropriate info structure */
30170 char *zOut; /* Rendering buffer */
30171 int nOut; /* Size of the rendering buffer */
30172 char *zExtra = 0; /* Malloced memory used by some conversion */
30173 #ifndef SQLITE_OMIT_FLOATING_POINT
@@ -30470,56 +30554,82 @@
30470 realvalue = -realvalue;
30471 prefix = '-';
30472 }else{
30473 prefix = flag_prefix;
30474 }
 
30475 if( xtype==etGENERIC && precision>0 ) precision--;
30476 testcase( precision>0xfff );
30477 idx = precision & 0xfff;
30478 rounder = arRound[idx%10];
30479 while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; }
30480 if( xtype==etFLOAT ){
30481 double rx = (double)realvalue;
30482 sqlite3_uint64 u;
30483 int ex;
30484 memcpy(&u, &rx, sizeof(u));
30485 ex = -1023 + (int)((u>>52)&0x7ff);
30486 if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16;
30487 realvalue += rounder;
30488 }
30489 /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
30490 exp = 0;
30491 if( sqlite3IsNaN((double)realvalue) ){
30492 bufpt = "NaN";
30493 length = 3;
30494 break;
30495 }
30496 if( realvalue>0.0 ){
30497 LONGDOUBLE_TYPE scale = 1.0;
30498 while( realvalue>=1e100*scale && exp<=350 ){ scale *= 1e100;exp+=100;}
30499 while( realvalue>=1e10*scale && exp<=350 ){ scale *= 1e10; exp+=10; }
30500 while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; }
30501 realvalue /= scale;
30502 while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }
30503 while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }
30504 if( exp>350 ){
30505 bufpt = buf;
30506 buf[0] = prefix;
30507 memcpy(buf+(prefix!=0),"Inf",4);
30508 length = 3+(prefix!=0);
30509 break;
30510 }
30511 }
30512 bufpt = buf;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30513 /*
30514 ** If the field type is etGENERIC, then convert to either etEXP
30515 ** or etFLOAT, as appropriate.
30516 */
30517 if( xtype!=etFLOAT ){
30518 realvalue += rounder;
30519 if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
30520 }
30521 if( xtype==etGENERIC ){
30522 flag_rtz = !flag_alternateform;
30523 if( exp<-4 || exp>precision ){
30524 xtype = etEXP;
30525 }else{
@@ -30532,28 +30642,33 @@
30532 if( xtype==etEXP ){
30533 e2 = 0;
30534 }else{
30535 e2 = exp;
30536 }
 
 
30537 {
30538 i64 szBufNeeded; /* Size of a temporary buffer needed */
30539 szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15;
30540 if( szBufNeeded > etBUFSIZE ){
30541 bufpt = zExtra = printfTempBuf(pAccum, szBufNeeded);
30542 if( bufpt==0 ) return;
30543 }
30544 }
30545 zOut = bufpt;
30546 nsd = 16 + flag_altform2*10;
30547 flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2;
30548 /* The sign in front of the number */
30549 if( prefix ){
30550 *(bufpt++) = prefix;
30551 }
30552 /* Digits prior to the decimal point */
30553 if( e2<0 ){
30554 *(bufpt++) = '0';
 
 
 
 
30555 }else{
30556 for(; e2>=0; e2--){
30557 *(bufpt++) = et_getdigit(&realvalue,&nsd);
30558 }
30559 }
@@ -30566,12 +30681,18 @@
30566 for(e2++; e2<0; precision--, e2++){
30567 assert( precision>0 );
30568 *(bufpt++) = '0';
30569 }
30570 /* Significant digits after the decimal point */
30571 while( (precision--)>0 ){
30572 *(bufpt++) = et_getdigit(&realvalue,&nsd);
 
 
 
 
 
 
30573 }
30574 /* Remove trailing zeros and the "." if no digits follow the "." */
30575 if( flag_rtz && flag_dp ){
30576 while( bufpt[-1]=='0' ) *(--bufpt) = 0;
30577 assert( bufpt>zOut );
@@ -31248,16 +31369,26 @@
31248 sqlite3_str_vappendf(&acc, zFormat, ap);
31249 zBuf[acc.nChar] = 0;
31250 return zBuf;
31251 }
31252 SQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
31253 char *z;
31254 va_list ap;
 
 
 
 
 
 
 
 
 
31255 va_start(ap,zFormat);
31256 z = sqlite3_vsnprintf(n, zBuf, zFormat, ap);
31257 va_end(ap);
31258 return z;
 
31259 }
31260
31261 /*
31262 ** This is the routine that actually formats the sqlite3_log() message.
31263 ** We house it in a separate routine from sqlite3_log() to avoid using
@@ -52655,11 +52786,11 @@
52655 ** pointers).
52656 */
52657 struct PCache {
52658 PgHdr *pDirty, *pDirtyTail; /* List of dirty pages in LRU order */
52659 PgHdr *pSynced; /* Last synced page in dirty page list */
52660 int nRefSum; /* Sum of ref counts over all pages */
52661 int szCache; /* Configured cache size */
52662 int szSpill; /* Size before spilling occurs */
52663 int szPage; /* Size of every page in this cache */
52664 int szExtra; /* Size of extra space for each page */
52665 u8 bPurgeable; /* True if pages are on backing store */
@@ -52685,11 +52816,11 @@
52685 static void pcachePageTrace(int i, sqlite3_pcache_page *pLower){
52686 PgHdr *pPg;
52687 unsigned char *a;
52688 int j;
52689 pPg = (PgHdr*)pLower->pExtra;
52690 printf("%3d: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags);
52691 a = (unsigned char *)pLower->pBuf;
52692 for(j=0; j<12; j++) printf("%02x", a[j]);
52693 printf(" ptr %p\n", pPg);
52694 }
52695 static void pcacheDump(PCache *pCache){
@@ -53429,18 +53560,18 @@
53429 ** Return the total number of references to all pages held by the cache.
53430 **
53431 ** This is not the total number of pages referenced, but the sum of the
53432 ** reference count for all pages.
53433 */
53434 SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache *pCache){
53435 return pCache->nRefSum;
53436 }
53437
53438 /*
53439 ** Return the number of references to the page supplied as an argument.
53440 */
53441 SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr *p){
53442 return p->nRef;
53443 }
53444
53445 /*
53446 ** Return the total number of pages in the cache.
@@ -68094,12 +68225,13 @@
68094 int mxErr; /* Stop accumulating errors when this reaches zero */
68095 int nErr; /* Number of messages written to zErrMsg so far */
68096 int rc; /* SQLITE_OK, SQLITE_NOMEM, or SQLITE_INTERRUPT */
68097 u32 nStep; /* Number of steps into the integrity_check process */
68098 const char *zPfx; /* Error message prefix */
68099 Pgno v1; /* Value for first %u substitution in zPfx */
68100 int v2; /* Value for second %d substitution in zPfx */
 
68101 StrAccum errMsg; /* Accumulate the error message text here */
68102 u32 *heap; /* Min-heap used for analyzing cell coverage */
68103 sqlite3 *db; /* Database connection running the check */
68104 };
68105
@@ -68558,12 +68690,12 @@
68558 */
68559 #ifdef SQLITE_DEBUG
68560 int corruptPageError(int lineno, MemPage *p){
68561 char *zMsg;
68562 sqlite3BeginBenignMalloc();
68563 zMsg = sqlite3_mprintf("database corruption page %d of %s",
68564 (int)p->pgno, sqlite3PagerFilename(p->pBt->pPager, 0)
68565 );
68566 sqlite3EndBenignMalloc();
68567 if( zMsg ){
68568 sqlite3ReportError(SQLITE_CORRUPT, lineno, zMsg);
68569 }
@@ -69454,11 +69586,11 @@
69454 }
69455 assert( offset <= (int)pBt->usableSize-5 );
69456 pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);
69457
69458 if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){
69459 TRACE(("PTRMAP_UPDATE: %d->(%d,%d)\n", key, eType, parent));
69460 *pRC= rc = sqlite3PagerWrite(pDbPage);
69461 if( rc==SQLITE_OK ){
69462 pPtrmap[offset] = eType;
69463 put4byte(&pPtrmap[offset+1], parent);
69464 }
@@ -69653,31 +69785,35 @@
69653 ** This routine is a high-runner.
69654 */
69655 iKey = *pIter;
69656 if( iKey>=0x80 ){
69657 u8 x;
69658 iKey = ((iKey&0x7f)<<7) | ((x = *++pIter) & 0x7f);
69659 if( x>=0x80 ){
69660 iKey = (iKey<<7) | ((x =*++pIter) & 0x7f);
69661 if( x>=0x80 ){
69662 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69663 if( x>=0x80 ){
69664 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69665 if( x>=0x80 ){
69666 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69667 if( x>=0x80 ){
69668 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69669 if( x>=0x80 ){
69670 iKey = (iKey<<7) | ((x = *++pIter) & 0x7f);
69671 if( x>=0x80 ){
69672 iKey = (iKey<<8) | (*++pIter);
69673 }
69674 }
69675 }
69676 }
69677 }
69678 }
 
 
 
 
69679 }
69680 }
69681 pIter++;
69682
69683 pInfo->nKey = *(i64*)&iKey;
@@ -69750,14 +69886,57 @@
69750 ** data header and the local payload, but not any overflow page or
69751 ** the space used by the cell pointer.
69752 **
69753 ** cellSizePtrNoPayload() => table internal nodes
69754 ** cellSizePtrTableLeaf() => table leaf nodes
69755 ** cellSizePtr() => all index nodes & table leaf nodes
 
69756 */
69757 static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
69758 u8 *pIter = pCell + pPage->childPtrSize; /* For looping over bytes of pCell */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69759 u8 *pEnd; /* End mark for a varint */
69760 u32 nSize; /* Size value to return */
69761
69762 #ifdef SQLITE_DEBUG
69763 /* The value returned by this function should always be the same as
@@ -69766,10 +69945,11 @@
69766 ** this function verifies that this invariant is not violated. */
69767 CellInfo debuginfo;
69768 pPage->xParseCell(pPage, pCell, &debuginfo);
69769 #endif
69770
 
69771 nSize = *pIter;
69772 if( nSize>=0x80 ){
69773 pEnd = &pIter[8];
69774 nSize &= 0x7f;
69775 do{
@@ -70002,14 +70182,14 @@
70002 testcase( pc==iCellFirst );
70003 testcase( pc==iCellLast );
70004 /* These conditions have already been verified in btreeInitPage()
70005 ** if PRAGMA cell_size_check=ON.
70006 */
70007 if( pc<iCellStart || pc>iCellLast ){
70008 return SQLITE_CORRUPT_PAGE(pPage);
70009 }
70010 assert( pc>=iCellStart && pc<=iCellLast );
70011 size = pPage->xCellSize(pPage, &src[pc]);
70012 cbrk -= size;
70013 if( cbrk<iCellStart || pc+size>usableSize ){
70014 return SQLITE_CORRUPT_PAGE(pPage);
70015 }
@@ -70347,18 +70527,18 @@
70347 pPage->maxLocal = pBt->maxLeaf;
70348 pPage->minLocal = pBt->minLeaf;
70349 }else if( flagByte==(PTF_ZERODATA | PTF_LEAF) ){
70350 pPage->intKey = 0;
70351 pPage->intKeyLeaf = 0;
70352 pPage->xCellSize = cellSizePtr;
70353 pPage->xParseCell = btreeParseCellPtrIndex;
70354 pPage->maxLocal = pBt->maxLocal;
70355 pPage->minLocal = pBt->minLocal;
70356 }else{
70357 pPage->intKey = 0;
70358 pPage->intKeyLeaf = 0;
70359 pPage->xCellSize = cellSizePtr;
70360 pPage->xParseCell = btreeParseCellPtrIndex;
70361 return SQLITE_CORRUPT_PAGE(pPage);
70362 }
70363 }else{
70364 pPage->childPtrSize = 4;
@@ -72220,11 +72400,11 @@
72220 assert( sqlite3_mutex_held(pBt->mutex) );
72221 assert( pDbPage->pBt==pBt );
72222 if( iDbPage<3 ) return SQLITE_CORRUPT_BKPT;
72223
72224 /* Move page iDbPage from its current location to page number iFreePage */
72225 TRACE(("AUTOVACUUM: Moving %d to free page %d (ptr page %d type %d)\n",
72226 iDbPage, iFreePage, iPtrPage, eType));
72227 rc = sqlite3PagerMovepage(pPager, pDbPage->pDbPage, iFreePage, isCommit);
72228 if( rc!=SQLITE_OK ){
72229 return rc;
72230 }
@@ -74506,11 +74686,12 @@
74506 }
74507 }
74508
74509 pPage = pCur->pPage;
74510 idx = ++pCur->ix;
74511 if( !pPage->isInit || sqlite3FaultSim(412) ){
 
74512 return SQLITE_CORRUPT_BKPT;
74513 }
74514
74515 if( idx>=pPage->nCell ){
74516 if( !pPage->leaf ){
@@ -74769,11 +74950,11 @@
74769 }
74770 *pPgno = iTrunk;
74771 memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);
74772 *ppPage = pTrunk;
74773 pTrunk = 0;
74774 TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
74775 }else if( k>(u32)(pBt->usableSize/4 - 2) ){
74776 /* Value of k is out of range. Database corruption */
74777 rc = SQLITE_CORRUPT_PGNO(iTrunk);
74778 goto end_allocate_page;
74779 #ifndef SQLITE_OMIT_AUTOVACUUM
@@ -74835,11 +75016,11 @@
74835 }
74836 put4byte(&pPrevTrunk->aData[0], iNewTrunk);
74837 }
74838 }
74839 pTrunk = 0;
74840 TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
74841 #endif
74842 }else if( k>0 ){
74843 /* Extract a leaf from the trunk */
74844 u32 closest;
74845 Pgno iPage;
@@ -74880,12 +75061,12 @@
74880 if( !searchList
74881 || (iPage==nearby || (iPage<nearby && eMode==BTALLOC_LE))
74882 ){
74883 int noContent;
74884 *pPgno = iPage;
74885 TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d"
74886 ": %d more free pages\n",
74887 *pPgno, closest+1, k, pTrunk->pgno, n-1));
74888 rc = sqlite3PagerWrite(pTrunk->pDbPage);
74889 if( rc ) goto end_allocate_page;
74890 if( closest<k-1 ){
74891 memcpy(&aData[8+closest*4], &aData[4+k*4], 4);
@@ -74937,11 +75118,11 @@
74937 /* If *pPgno refers to a pointer-map page, allocate two new pages
74938 ** at the end of the file instead of one. The first allocated page
74939 ** becomes a new pointer-map page, the second is used by the caller.
74940 */
74941 MemPage *pPg = 0;
74942 TRACE(("ALLOCATE: %d from end of file (pointer-map page)\n", pBt->nPage));
74943 assert( pBt->nPage!=PENDING_BYTE_PAGE(pBt) );
74944 rc = btreeGetUnusedPage(pBt, pBt->nPage, &pPg, bNoContent);
74945 if( rc==SQLITE_OK ){
74946 rc = sqlite3PagerWrite(pPg->pDbPage);
74947 releasePage(pPg);
@@ -74960,11 +75141,11 @@
74960 rc = sqlite3PagerWrite((*ppPage)->pDbPage);
74961 if( rc!=SQLITE_OK ){
74962 releasePage(*ppPage);
74963 *ppPage = 0;
74964 }
74965 TRACE(("ALLOCATE: %d from end of file\n", *pPgno));
74966 }
74967
74968 assert( CORRUPT_DB || *pPgno!=PENDING_BYTE_PAGE(pBt) );
74969
74970 end_allocate_page:
@@ -75088,11 +75269,11 @@
75088 if( pPage && (pBt->btsFlags & BTS_SECURE_DELETE)==0 ){
75089 sqlite3PagerDontWrite(pPage->pDbPage);
75090 }
75091 rc = btreeSetHasContent(pBt, iPage);
75092 }
75093 TRACE(("FREE-PAGE: %d leaf on trunk page %d\n",pPage->pgno,pTrunk->pgno));
75094 goto freepage_out;
75095 }
75096 }
75097
75098 /* If control flows to this point, then it was not possible to add the
@@ -75109,11 +75290,11 @@
75109 goto freepage_out;
75110 }
75111 put4byte(pPage->aData, iTrunk);
75112 put4byte(&pPage->aData[4], 0);
75113 put4byte(&pPage1->aData[32], iPage);
75114 TRACE(("FREE-PAGE: %d new trunk page replacing %d\n", pPage->pgno, iTrunk));
75115
75116 freepage_out:
75117 if( pPage ){
75118 pPage->isInit = 0;
75119 }
@@ -76695,11 +76876,11 @@
76695 ** (2) pPage is a virtual root page. A virtual root page is when
76696 ** the real root page is page 1 and we are the only child of
76697 ** that page.
76698 */
76699 assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) || CORRUPT_DB);
76700 TRACE(("BALANCE: old: %d(nc=%d) %d(nc=%d) %d(nc=%d)\n",
76701 apOld[0]->pgno, apOld[0]->nCell,
76702 nOld>=2 ? apOld[1]->pgno : 0, nOld>=2 ? apOld[1]->nCell : 0,
76703 nOld>=3 ? apOld[2]->pgno : 0, nOld>=3 ? apOld[2]->nCell : 0
76704 ));
76705
@@ -76779,12 +76960,12 @@
76779 apNew[i]->pgno = pgnoB;
76780 apNew[iB]->pgno = pgnoA;
76781 }
76782 }
76783
76784 TRACE(("BALANCE: new: %d(%d nc=%d) %d(%d nc=%d) %d(%d nc=%d) "
76785 "%d(%d nc=%d) %d(%d nc=%d)\n",
76786 apNew[0]->pgno, szNew[0], cntNew[0],
76787 nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0,
76788 nNew>=2 ? cntNew[1] - cntNew[0] - !leafData : 0,
76789 nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0,
76790 nNew>=3 ? cntNew[2] - cntNew[1] - !leafData : 0,
@@ -77025,11 +77206,11 @@
77025 ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);
77026 }
77027 }
77028
77029 assert( pParent->isInit );
77030 TRACE(("BALANCE: finished: old=%d new=%d cells=%d\n",
77031 nOld, nNew, b.nCell));
77032
77033 /* Free any old pages that were not reused as new pages.
77034 */
77035 for(i=nNew; i<nOld; i++){
@@ -77110,11 +77291,11 @@
77110 }
77111 assert( sqlite3PagerIswriteable(pChild->pDbPage) );
77112 assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
77113 assert( pChild->nCell==pRoot->nCell || CORRUPT_DB );
77114
77115 TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno));
77116
77117 /* Copy the overflow cells from pRoot to pChild */
77118 memcpy(pChild->aiOvfl, pRoot->aiOvfl,
77119 pRoot->nOverflow*sizeof(pRoot->aiOvfl[0]));
77120 memcpy(pChild->apOvfl, pRoot->apOvfl,
@@ -77608,11 +77789,11 @@
77608 rc = btreeComputeFreeSpace(pPage);
77609 }
77610 if( rc ) return rc;
77611 }
77612
77613 TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
77614 pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
77615 loc==0 ? "overwrite" : "new entry"));
77616 assert( pPage->isInit || CORRUPT_DB );
77617 newCell = p->pBt->pTmpSpace;
77618 assert( newCell!=0 );
@@ -77635,10 +77816,11 @@
77635 if( rc ) goto end_insert;
77636 }
77637 assert( szNew==pPage->xCellSize(pPage, newCell) );
77638 assert( szNew <= MX_CELL_SIZE(p->pBt) );
77639 idx = pCur->ix;
 
77640 if( loc==0 ){
77641 CellInfo info;
77642 assert( idx>=0 );
77643 if( idx>=pPage->nCell ){
77644 return SQLITE_CORRUPT_BKPT;
@@ -77707,11 +77889,10 @@
77707 ** the b-tree if possible. If the cursor is left pointing to the last
77708 ** entry in the table, and the next row inserted has an integer key
77709 ** larger than the largest existing key, it is possible to insert the
77710 ** row without seeking the cursor. This can be a big performance boost.
77711 */
77712 pCur->info.nSize = 0;
77713 if( pPage->nOverflow ){
77714 assert( rc==SQLITE_OK );
77715 pCur->curFlags &= ~(BTCF_ValidNKey);
77716 rc = balance(pCur);
77717
@@ -78656,11 +78837,12 @@
78656 va_start(ap, zFormat);
78657 if( pCheck->errMsg.nChar ){
78658 sqlite3_str_append(&pCheck->errMsg, "\n", 1);
78659 }
78660 if( pCheck->zPfx ){
78661 sqlite3_str_appendf(&pCheck->errMsg, pCheck->zPfx, pCheck->v1, pCheck->v2);
 
78662 }
78663 sqlite3_str_vappendf(&pCheck->errMsg, zFormat, ap);
78664 va_end(ap);
78665 if( pCheck->errMsg.accError==SQLITE_NOMEM ){
78666 checkOom(pCheck);
@@ -78696,15 +78878,15 @@
78696 **
78697 ** Also check that the page number is in bounds.
78698 */
78699 static int checkRef(IntegrityCk *pCheck, Pgno iPage){
78700 if( iPage>pCheck->nPage || iPage==0 ){
78701 checkAppendMsg(pCheck, "invalid page number %d", iPage);
78702 return 1;
78703 }
78704 if( getPageReferenced(pCheck, iPage) ){
78705 checkAppendMsg(pCheck, "2nd reference to page %d", iPage);
78706 return 1;
78707 }
78708 setPageReferenced(pCheck, iPage);
78709 return 0;
78710 }
@@ -78726,17 +78908,17 @@
78726 Pgno iPtrmapParent;
78727
78728 rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent);
78729 if( rc!=SQLITE_OK ){
78730 if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) checkOom(pCheck);
78731 checkAppendMsg(pCheck, "Failed to read ptrmap key=%d", iChild);
78732 return;
78733 }
78734
78735 if( ePtrmapType!=eType || iPtrmapParent!=iParent ){
78736 checkAppendMsg(pCheck,
78737 "Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)",
78738 iChild, eType, iParent, ePtrmapType, iPtrmapParent);
78739 }
78740 }
78741 #endif
78742
@@ -78757,11 +78939,11 @@
78757 DbPage *pOvflPage;
78758 unsigned char *pOvflData;
78759 if( checkRef(pCheck, iPage) ) break;
78760 N--;
78761 if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage, 0) ){
78762 checkAppendMsg(pCheck, "failed to get page %d", iPage);
78763 break;
78764 }
78765 pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage);
78766 if( isFreeList ){
78767 u32 n = (u32)get4byte(&pOvflData[4]);
@@ -78770,11 +78952,11 @@
78770 checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0);
78771 }
78772 #endif
78773 if( n>pCheck->pBt->usableSize/4-2 ){
78774 checkAppendMsg(pCheck,
78775 "freelist leaf count too big on page %d", iPage);
78776 N--;
78777 }else{
78778 for(i=0; i<(int)n; i++){
78779 Pgno iFreePage = get4byte(&pOvflData[8+i*4]);
78780 #ifndef SQLITE_OMIT_AUTOVACUUM
@@ -78802,11 +78984,11 @@
78802 iPage = get4byte(pOvflData);
78803 sqlite3PagerUnref(pOvflPage);
78804 }
78805 if( N && nErrAtStart==pCheck->nErr ){
78806 checkAppendMsg(pCheck,
78807 "%s is %d but should be %d",
78808 isFreeList ? "size" : "overflow list length",
78809 expected-N, expected);
78810 }
78811 }
78812 #endif /* SQLITE_OMIT_INTEGRITY_CHECK */
@@ -78917,12 +79099,12 @@
78917 if( pCheck->mxErr==0 ) goto end_of_check;
78918 pBt = pCheck->pBt;
78919 usableSize = pBt->usableSize;
78920 if( iPage==0 ) return 0;
78921 if( checkRef(pCheck, iPage) ) return 0;
78922 pCheck->zPfx = "Page %u: ";
78923 pCheck->v1 = iPage;
78924 if( (rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0 ){
78925 checkAppendMsg(pCheck,
78926 "unable to get the page. error code=%d", rc);
78927 goto end_of_check;
78928 }
@@ -78944,11 +79126,11 @@
78944 }
78945 data = pPage->aData;
78946 hdr = pPage->hdrOffset;
78947
78948 /* Set up for cell analysis */
78949 pCheck->zPfx = "On tree page %u cell %d: ";
78950 contentOffset = get2byteNotZero(&data[hdr+5]);
78951 assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */
78952
78953 /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
78954 ** number of cells on the page. */
@@ -78964,11 +79146,11 @@
78964 if( !pPage->leaf ){
78965 /* Analyze the right-child page of internal pages */
78966 pgno = get4byte(&data[hdr+8]);
78967 #ifndef SQLITE_OMIT_AUTOVACUUM
78968 if( pBt->autoVacuum ){
78969 pCheck->zPfx = "On page %u at right child: ";
78970 checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage);
78971 }
78972 #endif
78973 depth = checkTreePage(pCheck, pgno, &maxKey, maxKey);
78974 keyCanBeEqual = 0;
@@ -78988,11 +79170,11 @@
78988 pCheck->v2 = i;
78989 assert( pCellIdx==&data[cellStart + i*2] );
78990 pc = get2byteAligned(pCellIdx);
78991 pCellIdx -= 2;
78992 if( pc<contentOffset || pc>usableSize-4 ){
78993 checkAppendMsg(pCheck, "Offset %d out of range %d..%d",
78994 pc, contentOffset, usableSize-4);
78995 doCoverageCheck = 0;
78996 continue;
78997 }
78998 pCell = &data[pc];
@@ -79120,11 +79302,11 @@
79120 ** EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the
79121 ** number of fragmented free bytes within the cell content area.
79122 */
79123 if( heap[0]==0 && nFrag!=data[hdr+7] ){
79124 checkAppendMsg(pCheck,
79125 "Fragmentation of %d bytes reported as %d on page %u",
79126 nFrag, data[hdr+7], iPage);
79127 }
79128 }
79129
79130 end_of_check:
@@ -79217,11 +79399,11 @@
79217 if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i);
79218
79219 /* Check the integrity of the freelist
79220 */
79221 if( bCkFreelist ){
79222 sCheck.zPfx = "Main freelist: ";
79223 checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]),
79224 get4byte(&pBt->pPage1->aData[36]));
79225 sCheck.zPfx = 0;
79226 }
79227
@@ -79234,11 +79416,11 @@
79234 Pgno mxInHdr;
79235 for(i=0; (int)i<nRoot; i++) if( mx<aRoot[i] ) mx = aRoot[i];
79236 mxInHdr = get4byte(&pBt->pPage1->aData[52]);
79237 if( mx!=mxInHdr ){
79238 checkAppendMsg(&sCheck,
79239 "max rootpage (%d) disagrees with header (%d)",
79240 mx, mxInHdr
79241 );
79242 }
79243 }else if( get4byte(&pBt->pPage1->aData[64])!=0 ){
79244 checkAppendMsg(&sCheck,
@@ -79265,23 +79447,23 @@
79265 */
79266 if( !bPartial ){
79267 for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){
79268 #ifdef SQLITE_OMIT_AUTOVACUUM
79269 if( getPageReferenced(&sCheck, i)==0 ){
79270 checkAppendMsg(&sCheck, "Page %d is never used", i);
79271 }
79272 #else
79273 /* If the database supports auto-vacuum, make sure no tables contain
79274 ** references to pointer-map pages.
79275 */
79276 if( getPageReferenced(&sCheck, i)==0 &&
79277 (PTRMAP_PAGENO(pBt, i)!=i || !pBt->autoVacuum) ){
79278 checkAppendMsg(&sCheck, "Page %d is never used", i);
79279 }
79280 if( getPageReferenced(&sCheck, i)!=0 &&
79281 (PTRMAP_PAGENO(pBt, i)==i && pBt->autoVacuum) ){
79282 checkAppendMsg(&sCheck, "Pointer map page %d is referenced", i);
79283 }
79284 #endif
79285 }
79286 }
79287
@@ -81889,20 +82071,15 @@
81889 rc = ctx.isError;
81890 sqlite3ErrorMsg(pCtx->pParse, "%s", sqlite3_value_text(pVal));
81891 }else{
81892 sqlite3ValueApplyAffinity(pVal, aff, SQLITE_UTF8);
81893 assert( rc==SQLITE_OK );
81894 assert( enc==pVal->enc
81895 || (pVal->flags & MEM_Str)==0
81896 || db->mallocFailed );
81897 #if 0 /* Not reachable except after a prior failure */
81898 rc = sqlite3VdbeChangeEncoding(pVal, enc);
81899 if( rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal) ){
81900 rc = SQLITE_TOOBIG;
81901 pCtx->pParse->nErr++;
81902 }
81903 #endif
81904 }
81905
81906 value_from_function_out:
81907 if( rc!=SQLITE_OK ){
81908 pVal = 0;
@@ -81962,10 +82139,17 @@
81962 assert( !ExprHasProperty(pExpr, EP_IntValue) );
81963 aff = sqlite3AffinityType(pExpr->u.zToken,0);
81964 rc = valueFromExpr(db, pExpr->pLeft, enc, aff, ppVal, pCtx);
81965 testcase( rc!=SQLITE_OK );
81966 if( *ppVal ){
 
 
 
 
 
 
 
81967 sqlite3VdbeMemCast(*ppVal, aff, enc);
81968 sqlite3ValueApplyAffinity(*ppVal, affinity, enc);
81969 }
81970 return rc;
81971 }
@@ -82808,14 +82992,14 @@
82808 ** If the bPush flag is true, then make this opcode the parent for
82809 ** subsequent Explains until sqlite3VdbeExplainPop() is called.
82810 */
82811 SQLITE_PRIVATE int sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){
82812 int addr = 0;
82813 #if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
82814 /* Always include the OP_Explain opcodes if SQLITE_DEBUG is defined.
82815 ** But omit them (for performance) during production builds */
82816 if( pParse->explain==2 )
82817 #endif
82818 {
82819 char *zMsg;
82820 Vdbe *v;
82821 va_list ap;
@@ -83487,22 +83671,24 @@
83487 int addrLoop, /* Address of loop counter */
83488 int addrVisit, /* Address of rows visited counter */
83489 LogEst nEst, /* Estimated number of output rows */
83490 const char *zName /* Name of table or index being scanned */
83491 ){
83492 sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus);
83493 ScanStatus *aNew;
83494 aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
83495 if( aNew ){
83496 ScanStatus *pNew = &aNew[p->nScan++];
83497 memset(pNew, 0, sizeof(ScanStatus));
83498 pNew->addrExplain = addrExplain;
83499 pNew->addrLoop = addrLoop;
83500 pNew->addrVisit = addrVisit;
83501 pNew->nEst = nEst;
83502 pNew->zName = sqlite3DbStrDup(p->db, zName);
83503 p->aScan = aNew;
 
 
83504 }
83505 }
83506
83507 /*
83508 ** Add the range of instructions from addrStart to addrEnd (inclusive) to
@@ -83515,24 +83701,26 @@
83515 Vdbe *p,
83516 int addrExplain,
83517 int addrStart,
83518 int addrEnd
83519 ){
83520 ScanStatus *pScan = 0;
83521 int ii;
83522 for(ii=p->nScan-1; ii>=0; ii--){
83523 pScan = &p->aScan[ii];
83524 if( pScan->addrExplain==addrExplain ) break;
83525 pScan = 0;
83526 }
83527 if( pScan ){
83528 if( addrEnd<0 ) addrEnd = sqlite3VdbeCurrentAddr(p)-1;
83529 for(ii=0; ii<ArraySize(pScan->aAddrRange); ii+=2){
83530 if( pScan->aAddrRange[ii]==0 ){
83531 pScan->aAddrRange[ii] = addrStart;
83532 pScan->aAddrRange[ii+1] = addrEnd;
83533 break;
 
 
83534 }
83535 }
83536 }
83537 }
83538
@@ -83545,23 +83733,25 @@
83545 Vdbe *p,
83546 int addrExplain,
83547 int addrLoop,
83548 int addrVisit
83549 ){
83550 ScanStatus *pScan = 0;
83551 int ii;
83552 for(ii=p->nScan-1; ii>=0; ii--){
83553 pScan = &p->aScan[ii];
83554 if( pScan->addrExplain==addrExplain ) break;
83555 pScan = 0;
83556 }
83557 if( pScan ){
83558 pScan->addrLoop = addrLoop;
83559 pScan->addrVisit = addrVisit;
 
 
83560 }
83561 }
83562 #endif
83563
83564
83565 /*
83566 ** Change the value of the opcode, or P1, P2, P3, or P5 operands
83567 ** for a specific instruction.
@@ -86003,13 +86193,13 @@
86003 vdbeFreeOpArray(db, p->aOp, p->nOp);
86004 if( p->zSql ) sqlite3DbNNFreeNN(db, p->zSql);
86005 #ifdef SQLITE_ENABLE_NORMALIZE
86006 sqlite3DbFree(db, p->zNormSql);
86007 {
86008 DblquoteStr *pThis, *pNext;
86009 for(pThis=p->pDblStr; pThis; pThis=pNext){
86010 pNext = pThis->pNextStr;
86011 sqlite3DbFree(db, pThis);
86012 }
86013 }
86014 #endif
86015 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
@@ -89885,19 +90075,28 @@
89885 int iScanStatusOp, /* Which metric to return */
89886 int flags,
89887 void *pOut /* OUT: Write the answer here */
89888 ){
89889 Vdbe *p = (Vdbe*)pStmt;
89890 ScanStatus *pScan;
 
 
89891 int idx;
 
 
 
 
 
 
 
89892
89893 if( iScan<0 ){
89894 int ii;
89895 if( iScanStatusOp==SQLITE_SCANSTAT_NCYCLE ){
89896 i64 res = 0;
89897 for(ii=0; ii<p->nOp; ii++){
89898 res += p->aOp[ii].nCycle;
89899 }
89900 *(i64*)pOut = res;
89901 return 0;
89902 }
89903 return 1;
@@ -89919,19 +90118,19 @@
89919 if( idx>=p->nScan ) return 1;
89920
89921 switch( iScanStatusOp ){
89922 case SQLITE_SCANSTAT_NLOOP: {
89923 if( pScan->addrLoop>0 ){
89924 *(sqlite3_int64*)pOut = p->aOp[pScan->addrLoop].nExec;
89925 }else{
89926 *(sqlite3_int64*)pOut = -1;
89927 }
89928 break;
89929 }
89930 case SQLITE_SCANSTAT_NVISIT: {
89931 if( pScan->addrVisit>0 ){
89932 *(sqlite3_int64*)pOut = p->aOp[pScan->addrVisit].nExec;
89933 }else{
89934 *(sqlite3_int64*)pOut = -1;
89935 }
89936 break;
89937 }
@@ -89949,27 +90148,27 @@
89949 *(const char**)pOut = pScan->zName;
89950 break;
89951 }
89952 case SQLITE_SCANSTAT_EXPLAIN: {
89953 if( pScan->addrExplain ){
89954 *(const char**)pOut = p->aOp[ pScan->addrExplain ].p4.z;
89955 }else{
89956 *(const char**)pOut = 0;
89957 }
89958 break;
89959 }
89960 case SQLITE_SCANSTAT_SELECTID: {
89961 if( pScan->addrExplain ){
89962 *(int*)pOut = p->aOp[ pScan->addrExplain ].p1;
89963 }else{
89964 *(int*)pOut = -1;
89965 }
89966 break;
89967 }
89968 case SQLITE_SCANSTAT_PARENTID: {
89969 if( pScan->addrExplain ){
89970 *(int*)pOut = p->aOp[ pScan->addrExplain ].p2;
89971 }else{
89972 *(int*)pOut = -1;
89973 }
89974 break;
89975 }
@@ -89983,22 +90182,22 @@
89983 int iIns = pScan->aAddrRange[ii];
89984 int iEnd = pScan->aAddrRange[ii+1];
89985 if( iIns==0 ) break;
89986 if( iIns>0 ){
89987 while( iIns<=iEnd ){
89988 res += p->aOp[iIns].nCycle;
89989 iIns++;
89990 }
89991 }else{
89992 int iOp;
89993 for(iOp=0; iOp<p->nOp; iOp++){
89994 Op *pOp = &p->aOp[iOp];
89995 if( pOp->p1!=iEnd ) continue;
89996 if( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_NCYCLE)==0 ){
89997 continue;
89998 }
89999 res += p->aOp[iOp].nCycle;
90000 }
90001 }
90002 }
90003 }
90004 *(i64*)pOut = res;
@@ -90917,11 +91116,14 @@
90917 if( p->flags & (MEM_Int|MEM_IntReal) ){
90918 h += p->u.i;
90919 }else if( p->flags & MEM_Real ){
90920 h += sqlite3VdbeIntValue(p);
90921 }else if( p->flags & (MEM_Str|MEM_Blob) ){
90922 /* no-op */
 
 
 
90923 }
90924 }
90925 return h;
90926 }
90927
@@ -90967,10 +91169,11 @@
90967 Mem *pIn2 = 0; /* 2nd input operand */
90968 Mem *pIn3 = 0; /* 3rd input operand */
90969 Mem *pOut = 0; /* Output operand */
90970 #if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE)
90971 u64 *pnCycle = 0;
 
90972 #endif
90973 /*** INSERT STACK UNION HERE ***/
90974
90975 assert( p->eVdbeState==VDBE_RUN_STATE ); /* sqlite3_step() verifies this */
90976 if( DbMaskNonZero(p->lockMask) ){
@@ -91031,17 +91234,21 @@
91031 ** jumps to abort_due_to_error. */
91032 assert( rc==SQLITE_OK );
91033
91034 assert( pOp>=aOp && pOp<&aOp[p->nOp]);
91035 nVmStep++;
91036 #if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE)
 
91037 pOp->nExec++;
91038 pnCycle = &pOp->nCycle;
91039 # ifdef VDBE_PROFILE
91040 if( sqlite3NProfileCnt==0 )
91041 # endif
 
 
91042 *pnCycle -= sqlite3Hwtime();
 
91043 #endif
91044
91045 /* Only allow tracing if SQLITE_DEBUG is defined.
91046 */
91047 #ifdef SQLITE_DEBUG
@@ -92851,10 +93058,16 @@
92851 ** from the value in that register.
92852 **
92853 ** P5 is a bitmask of data types. SQLITE_INTEGER is the least significant
92854 ** (0x01) bit. SQLITE_FLOAT is the 0x02 bit. SQLITE_TEXT is 0x04.
92855 ** SQLITE_BLOB is 0x08. SQLITE_NULL is 0x10.
 
 
 
 
 
 
92856 **
92857 ** Take the jump to address P2 if and only if the datatype of the
92858 ** value determined by P1 and P3 corresponds to one of the bits in the
92859 ** P5 bitmask.
92860 **
@@ -95199,10 +95412,11 @@
95199 #endif
95200 VdbeBranchTaken(0,3);
95201 break;
95202 }
95203 nStep--;
 
95204 rc = sqlite3BtreeNext(pC->uc.pCursor, 0);
95205 if( rc ){
95206 if( rc==SQLITE_DONE ){
95207 rc = SQLITE_OK;
95208 goto seekscan_search_fail;
@@ -97851,10 +98065,11 @@
97851 sqlite3VdbeError(p, "%s", sqlite3_value_text(pMem));
97852 goto abort_due_to_error;
97853 }
97854 sqlite3VdbeChangeEncoding(pMem, encoding);
97855 UPDATE_MAX_BLOBSIZE(pMem);
 
97856 break;
97857 }
97858
97859 #ifndef SQLITE_OMIT_WAL
97860 /* Opcode: Checkpoint P1 P2 P3 * *
@@ -98989,12 +99204,14 @@
98989
98990 #if defined(VDBE_PROFILE)
98991 *pnCycle += sqlite3NProfileCnt ? sqlite3NProfileCnt : sqlite3Hwtime();
98992 pnCycle = 0;
98993 #elif defined(SQLITE_ENABLE_STMT_SCANSTATUS)
98994 *pnCycle += sqlite3Hwtime();
98995 pnCycle = 0;
 
 
98996 #endif
98997
98998 /* The following code adds nothing to the actual functionality
98999 ** of the program. It is only here for testing and debugging.
99000 ** On the other hand, it does burn CPU cycles every time through
@@ -104016,11 +104233,12 @@
104016 if( pParse->pTriggerTab!=0 ){
104017 int op = pParse->eTriggerOp;
104018 assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
104019 if( pParse->bReturning ){
104020 if( (pNC->ncFlags & NC_UBaseReg)!=0
104021 && (zTab==0 || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0)
 
104022 ){
104023 pExpr->iTable = op!=TK_DELETE;
104024 pTab = pParse->pTriggerTab;
104025 }
104026 }else if( op!=TK_DELETE && zTab && sqlite3StrICmp("new",zTab) == 0 ){
@@ -108362,11 +108580,11 @@
108362
108363 /*
108364 ** pX is the RHS of an IN operator. If pX is a SELECT statement
108365 ** that can be simplified to a direct table access, then return
108366 ** a pointer to the SELECT statement. If pX is not a SELECT statement,
108367 ** or if the SELECT statement needs to be manifested into a transient
108368 ** table, then return NULL.
108369 */
108370 #ifndef SQLITE_OMIT_SUBQUERY
108371 static Select *isCandidateForInOpt(const Expr *pX){
108372 Select *p;
@@ -109551,10 +109769,11 @@
109551 Column *pCol, /* The generated column */
109552 int regOut /* Put the result in this register */
109553 ){
109554 int iAddr;
109555 Vdbe *v = pParse->pVdbe;
 
109556 assert( v!=0 );
109557 assert( pParse->iSelfTab!=0 );
109558 if( pParse->iSelfTab>0 ){
109559 iAddr = sqlite3VdbeAddOp3(v, OP_IfNullRow, pParse->iSelfTab-1, 0, regOut);
109560 }else{
@@ -109563,10 +109782,11 @@
109563 sqlite3ExprCodeCopy(pParse, sqlite3ColumnExpr(pTab,pCol), regOut);
109564 if( pCol->affinity>=SQLITE_AFF_TEXT ){
109565 sqlite3VdbeAddOp4(v, OP_Affinity, regOut, 1, 0, &pCol->affinity, 1);
109566 }
109567 if( iAddr ) sqlite3VdbeJumpHere(v, iAddr);
 
109568 }
109569 #endif /* SQLITE_OMIT_GENERATED_COLUMNS */
109570
109571 /*
109572 ** Generate code to extract the value of the iCol-th column of a table.
@@ -109932,11 +110152,23 @@
109932 switch( op ){
109933 case TK_AGG_COLUMN: {
109934 AggInfo *pAggInfo = pExpr->pAggInfo;
109935 struct AggInfo_col *pCol;
109936 assert( pAggInfo!=0 );
109937 assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
 
 
 
 
 
 
 
 
 
 
 
 
109938 pCol = &pAggInfo->aCol[pExpr->iAgg];
109939 if( !pAggInfo->directMode ){
109940 return AggInfoColumnReg(pAggInfo, pExpr->iAgg);
109941 }else if( pAggInfo->useSortingIdx ){
109942 Table *pTab = pCol->pTab;
@@ -110107,15 +110339,12 @@
110107 return pExpr->iTable;
110108 }
110109 #ifndef SQLITE_OMIT_CAST
110110 case TK_CAST: {
110111 /* Expressions of the form: CAST(pLeft AS token) */
110112 inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
110113 if( inReg!=target ){
110114 sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
110115 inReg = target;
110116 }
110117 assert( !ExprHasProperty(pExpr, EP_IntValue) );
110118 sqlite3VdbeAddOp2(v, OP_Cast, target,
110119 sqlite3AffinityType(pExpr->u.zToken, 0));
110120 return inReg;
110121 }
@@ -110450,17 +110679,13 @@
110450 ** "SOFT-COLLATE" that is added to constraints that are pushed down
110451 ** from outer queries into sub-queries by the push-down optimization.
110452 ** Clear subtypes as subtypes may not cross a subquery boundary.
110453 */
110454 assert( pExpr->pLeft );
110455 inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
110456 if( inReg!=target ){
110457 sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
110458 inReg = target;
110459 }
110460 sqlite3VdbeAddOp1(v, OP_ClrSubtype, inReg);
110461 return inReg;
110462 }else{
110463 pExpr = pExpr->pLeft;
110464 goto expr_code_doover; /* 2018-04-28: Prevent deep recursion. */
110465 }
110466 }
@@ -110566,16 +110791,13 @@
110566 ** (1) Temporarily disable factoring of constant expressions
110567 ** (2) Make sure the computed value really is stored in register
110568 ** "target" and not someplace else.
110569 */
110570 pParse->okConstFactor = 0; /* note (1) above */
110571 inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
 
110572 pParse->okConstFactor = okConstFactor;
110573 if( inReg!=target ){ /* note (2) above */
110574 sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
110575 inReg = target;
110576 }
110577 sqlite3VdbeJumpHere(v, addrINR);
110578 break;
110579 }
110580
110581 /*
@@ -111994,23 +112216,26 @@
111994 ){
111995 AggInfo *pAggInfo = pExpr->pAggInfo;
111996 int iAgg = pExpr->iAgg;
111997 Parse *pParse = pWalker->pParse;
111998 sqlite3 *db = pParse->db;
 
111999 if( pExpr->op!=TK_AGG_FUNCTION ){
112000 assert( iAgg>=0 && iAgg<pAggInfo->nColumn );
112001 if( pAggInfo->aCol[iAgg].pCExpr==pExpr ){
 
112002 pExpr = sqlite3ExprDup(db, pExpr, 0);
112003 if( pExpr ){
112004 pAggInfo->aCol[iAgg].pCExpr = pExpr;
112005 sqlite3ExprDeferredDelete(pParse, pExpr);
112006 }
112007 }
112008 }else{
112009 assert( pExpr->op==TK_AGG_FUNCTION );
112010 assert( iAgg>=0 && iAgg<pAggInfo->nFunc );
112011 if( pAggInfo->aFunc[iAgg].pFExpr==pExpr ){
 
112012 pExpr = sqlite3ExprDup(db, pExpr, 0);
112013 if( pExpr ){
112014 pAggInfo->aFunc[iAgg].pFExpr = pExpr;
112015 sqlite3ExprDeferredDelete(pParse, pExpr);
112016 }
@@ -112157,10 +112382,11 @@
112157 if( sqlite3ExprCompare(0, pExpr, pIEpr->pExpr, iDataCur)==0 ) break;
112158 }
112159 if( pIEpr==0 ) break;
112160 if( NEVER(!ExprUseYTab(pExpr)) ) break;
112161 if( pExpr->pAggInfo!=0 ) break; /* Already resolved by outer context */
 
112162
112163 /* If we reach this point, it means that expression pExpr can be
112164 ** translated into a reference to an index column as described by
112165 ** pIEpr.
112166 */
@@ -112167,10 +112393,13 @@
112167 memset(&tmp, 0, sizeof(tmp));
112168 tmp.op = TK_AGG_COLUMN;
112169 tmp.iTable = pIEpr->iIdxCur;
112170 tmp.iColumn = pIEpr->iIdxCol;
112171 findOrCreateAggInfoColumn(pParse, pAggInfo, &tmp);
 
 
 
112172 pAggInfo->aCol[tmp.iAgg].pCExpr = pExpr;
112173 pExpr->pAggInfo = pAggInfo;
112174 pExpr->iAgg = tmp.iAgg;
112175 return WRC_Prune;
112176 }
@@ -112343,10 +112572,41 @@
112343 SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse *pParse){
112344 pParse->nTempReg = 0;
112345 pParse->nRangeReg = 0;
112346 }
112347
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112348 /*
112349 ** Validate that no temporary register falls within the range of
112350 ** iFirst..iLast, inclusive. This routine is only call from within assert()
112351 ** statements.
112352 */
@@ -112361,10 +112621,18 @@
112361 }
112362 for(i=0; i<pParse->nTempReg; i++){
112363 if( pParse->aTempReg[i]>=iFirst && pParse->aTempReg[i]<=iLast ){
112364 return 0;
112365 }
 
 
 
 
 
 
 
 
112366 }
112367 return 1;
112368 }
112369 #endif /* SQLITE_DEBUG */
112370
@@ -115645,15 +115913,19 @@
115645 int regTemp2 = iMem++; /* Second temporary use register */
115646 int regTabname = iMem++; /* Register containing table name */
115647 int regIdxname = iMem++; /* Register containing index name */
115648 int regStat1 = iMem++; /* Value for the stat column of sqlite_stat1 */
115649 int regPrev = iMem; /* MUST BE LAST (see below) */
 
 
 
115650 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
115651 Table *pStat1 = 0;
115652 #endif
115653
115654 pParse->nMem = MAX(pParse->nMem, iMem);
 
115655 v = sqlite3GetVdbe(pParse);
115656 if( v==0 || NEVER(pTab==0) ){
115657 return;
115658 }
115659 if( !IsOrdinaryTable(pTab) ){
@@ -115755,11 +116027,11 @@
115755
115756 /* Make sure there are enough memory cells allocated to accommodate
115757 ** the regPrev array and a trailing rowid (the rowid slot is required
115758 ** when building a record to insert into the sample column of
115759 ** the sqlite_stat4 table. */
115760 pParse->nMem = MAX(pParse->nMem, regPrev+nColTest);
115761
115762 /* Open a read-only cursor on the index being analyzed. */
115763 assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );
115764 sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb);
115765 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
@@ -115927,11 +116199,39 @@
115927 int regSampleRowid = regCol + nCol;
115928 int addrNext;
115929 int addrIsNull;
115930 u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
115931
115932 pParse->nMem = MAX(pParse->nMem, regCol+nCol);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115933
115934 addrNext = sqlite3VdbeCurrentAddr(v);
115935 callStatGet(pParse, regStat, STAT_GET_ROWID, regSampleRowid);
115936 addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regSampleRowid);
115937 VdbeCoverage(v);
@@ -116008,10 +116308,15 @@
116008 iTab = pParse->nTab;
116009 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
116010 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
116011 Table *pTab = (Table*)sqliteHashData(k);
116012 analyzeOneTable(pParse, pTab, 0, iStatCur, iMem, iTab);
 
 
 
 
 
116013 }
116014 loadAnalysis(pParse, iDb);
116015 }
116016
116017 /*
@@ -123835,17 +124140,19 @@
123835 **
123836 ** If pTab is not writable -> generate an error message and return 1.
123837 ** If pTab is writable but other errors have occurred -> return 1.
123838 ** If pTab is writable and no prior errors -> return 0;
123839 */
123840 SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){
123841 if( tabIsReadOnly(pParse, pTab) ){
123842 sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName);
123843 return 1;
123844 }
123845 #ifndef SQLITE_OMIT_VIEW
123846 if( !viewOk && IsView(pTab) ){
 
 
123847 sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName);
123848 return 1;
123849 }
123850 #endif
123851 return 0;
@@ -124095,11 +124402,11 @@
124095 */
124096 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
124097 goto delete_from_cleanup;
124098 }
124099
124100 if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){
124101 goto delete_from_cleanup;
124102 }
124103 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
124104 assert( iDb<db->nDb );
124105 rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0,
@@ -128792,49 +129099,51 @@
128792 **
128793 ** Memory for the buffer containing the column index affinity string
128794 ** is managed along with the rest of the Index structure. It will be
128795 ** released when sqlite3DeleteIndex() is called.
128796 */
128797 SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){
128798 if( !pIdx->zColAff ){
128799 /* The first time a column affinity string for a particular index is
128800 ** required, it is allocated and populated here. It is then stored as
128801 ** a member of the Index structure for subsequent use.
128802 **
128803 ** The column affinity string will eventually be deleted by
128804 ** sqliteDeleteIndex() when the Index structure itself is cleaned
128805 ** up.
128806 */
128807 int n;
128808 Table *pTab = pIdx->pTable;
128809 pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1);
128810 if( !pIdx->zColAff ){
128811 sqlite3OomFault(db);
128812 return 0;
128813 }
128814 for(n=0; n<pIdx->nColumn; n++){
128815 i16 x = pIdx->aiColumn[n];
128816 char aff;
128817 if( x>=0 ){
128818 aff = pTab->aCol[x].affinity;
128819 }else if( x==XN_ROWID ){
128820 aff = SQLITE_AFF_INTEGER;
128821 }else{
128822 assert( x==XN_EXPR );
128823 assert( pIdx->bHasExpr );
128824 assert( pIdx->aColExpr!=0 );
128825 aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr);
128826 }
128827 if( aff<SQLITE_AFF_BLOB ) aff = SQLITE_AFF_BLOB;
128828 if( aff>SQLITE_AFF_NUMERIC) aff = SQLITE_AFF_NUMERIC;
128829 pIdx->zColAff[n] = aff;
128830 }
128831 pIdx->zColAff[n] = 0;
128832 }
128833
 
128834 return pIdx->zColAff;
128835 }
 
128836
128837 /*
128838 ** Compute an affinity string for a table. Space is obtained
128839 ** from sqlite3DbMalloc(). The caller is responsible for freeing
128840 ** the space when done.
@@ -129516,11 +129825,11 @@
129516 goto insert_cleanup;
129517 }
129518
129519 /* Cannot insert into a read-only table.
129520 */
129521 if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
129522 goto insert_cleanup;
129523 }
129524
129525 /* Allocate a VDBE
129526 */
@@ -129963,11 +130272,11 @@
129963 sqlite3VdbeJumpHere(v, addr1);
129964 sqlite3VdbeAddOp1(v, OP_MustBeInt, regCols); VdbeCoverage(v);
129965 }
129966
129967 /* Copy the new data already generated. */
129968 assert( pTab->nNVCol>0 );
129969 sqlite3VdbeAddOp3(v, OP_Copy, regRowid+1, regCols+1, pTab->nNVCol-1);
129970
129971 #ifndef SQLITE_OMIT_GENERATED_COLUMNS
129972 /* Compute the new value for generated columns after all other
129973 ** columns have already been computed. This must be done after
@@ -133326,19 +133635,25 @@
133326 zEntry = zProc ? zProc : "sqlite3_extension_init";
133327
133328 /* tag-20210611-1. Some dlopen() implementations will segfault if given
133329 ** an oversize filename. Most filesystems have a pathname limit of 4K,
133330 ** so limit the extension filename length to about twice that.
133331 ** https://sqlite.org/forum/forumpost/08a0d6d9bf */
 
 
 
 
133332 if( nMsg>SQLITE_MAX_PATHLEN ) goto extension_not_found;
133333
133334 handle = sqlite3OsDlOpen(pVfs, zFile);
133335 #if SQLITE_OS_UNIX || SQLITE_OS_WIN
133336 for(ii=0; ii<ArraySize(azEndings) && handle==0; ii++){
133337 char *zAltFile = sqlite3_mprintf("%s.%s", zFile, azEndings[ii]);
133338 if( zAltFile==0 ) return SQLITE_NOMEM_BKPT;
133339 handle = sqlite3OsDlOpen(pVfs, zAltFile);
 
 
133340 sqlite3_free(zAltFile);
133341 }
133342 #endif
133343 if( handle==0 ) goto extension_not_found;
133344 xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry);
@@ -135829,11 +136144,11 @@
135829 if( pTab==0 || !IsOrdinaryTable(pTab) || pTab->u.tab.pFKey==0 ) continue;
135830 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
135831 zDb = db->aDb[iDb].zDbSName;
135832 sqlite3CodeVerifySchema(pParse, iDb);
135833 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
135834 if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow;
135835 sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead);
135836 sqlite3VdbeLoadString(v, regResult, pTab->zName);
135837 assert( IsOrdinaryTable(pTab) );
135838 for(i=1, pFK=pTab->u.tab.pFKey; pFK; i++, pFK=pFK->pNextFrom){
135839 pParent = sqlite3FindTable(db, pFK->zTo, zDb);
@@ -135870,11 +136185,11 @@
135870
135871 /* Generate code to read the child key values into registers
135872 ** regRow..regRow+n. If any of the child key values are NULL, this
135873 ** row cannot cause an FK violation. Jump directly to addrOk in
135874 ** this case. */
135875 if( regRow+pFK->nCol>pParse->nMem ) pParse->nMem = regRow+pFK->nCol;
135876 for(j=0; j<pFK->nCol; j++){
135877 int iCol = aiCols ? aiCols[j] : pFK->aCol[j].iFrom;
135878 sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, iCol, regRow+j);
135879 sqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk); VdbeCoverage(v);
135880 }
@@ -135999,10 +136314,11 @@
135999
136000 if( OMIT_TEMPDB && i==1 ) continue;
136001 if( iDb>=0 && i!=iDb ) continue;
136002
136003 sqlite3CodeVerifySchema(pParse, i);
 
136004
136005 /* Do an integrity check of the B-Tree
136006 **
136007 ** Begin by finding the root pages numbers
136008 ** for all tables and indices in the database.
@@ -136034,11 +136350,11 @@
136034 }
136035 }
136036 aRoot[0] = cnt;
136037
136038 /* Make sure sufficient number of registers have been allocated */
136039 pParse->nMem = MAX( pParse->nMem, 8+mxIdx );
136040 sqlite3ClearTempRegCache(pParse);
136041
136042 /* Do the b-tree integrity checks */
136043 sqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY);
136044 sqlite3VdbeChangeP5(v, (u8)i);
@@ -136184,19 +136500,33 @@
136184
136185 labelError = sqlite3VdbeMakeLabel(pParse);
136186 labelOk = sqlite3VdbeMakeLabel(pParse);
136187 if( pCol->notNull ){
136188 /* (1) NOT NULL columns may not contain a NULL */
 
136189 int jmp2 = sqlite3VdbeAddOp4Int(v, OP_IsType, p1, labelOk, p3, p4);
136190 sqlite3VdbeChangeP5(v, 0x0f);
136191 VdbeCoverage(v);
 
 
 
 
 
 
 
 
 
 
 
 
 
136192 zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
136193 pCol->zCnName);
136194 sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
136195 if( doTypeCheck ){
136196 sqlite3VdbeGoto(v, labelError);
136197 sqlite3VdbeJumpHere(v, jmp2);
 
136198 }else{
136199 /* VDBE byte code will fall thru */
136200 }
136201 }
136202 if( bStrict && doTypeCheck ){
@@ -136300,11 +136630,11 @@
136300 ** any extra bytes at the end. Verify that this is the case. */
136301 if( HasRowid(pTab) ){
136302 int jmp7;
136303 sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur+j, 3);
136304 jmp7 = sqlite3VdbeAddOp3(v, OP_Eq, 3, 0, r1+pIdx->nColumn-1);
136305 VdbeCoverage(v);
136306 sqlite3VdbeLoadString(v, 3,
136307 "rowid not at end-of-record for row ");
136308 sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3);
136309 sqlite3VdbeLoadString(v, 4, " of index ");
136310 sqlite3VdbeGoto(v, jmp5-1);
@@ -142513,12 +142843,11 @@
142513 ** (17f) the subquery must not be the RHS of a LEFT JOIN.
142514 ** (17g) either the subquery is the first element of the outer
142515 ** query or there are no RIGHT or FULL JOINs in any arm
142516 ** of the subquery. (This is a duplicate of condition (27b).)
142517 ** (17h) The corresponding result set expressions in all arms of the
142518 ** compound must have the same affinity. (See restriction (9)
142519 ** on the push-down optimization.)
142520 **
142521 ** The parent and sub-query may contain WHERE clauses. Subject to
142522 ** rules (11), (13) and (14), they may also contain ORDER BY,
142523 ** LIMIT and OFFSET clauses. The subquery cannot use any compound
142524 ** operator other than UNION ALL because all the other compound
@@ -143382,14 +143711,10 @@
143382 **
143383 ** (8) If the subquery is a compound that uses UNION, INTERSECT,
143384 ** or EXCEPT, then all of the result set columns for all arms of
143385 ** the compound must use the BINARY collating sequence.
143386 **
143387 ** (9) If the subquery is a compound, then all arms of the compound must
143388 ** have the same affinity. (This is the same as restriction (17h)
143389 ** for query flattening.)
143390 **
143391 **
143392 ** Return 0 if no changes are made and non-zero if one or more WHERE clause
143393 ** terms are duplicated into the subquery.
143394 */
143395 static int pushDownWhereTerms(
@@ -143416,13 +143741,10 @@
143416 }
143417 #ifndef SQLITE_OMIT_WINDOWFUNC
143418 if( pSel->pWin ) return 0; /* restriction (6b) */
143419 #endif
143420 }
143421 if( compoundHasDifferentAffinities(pSubq) ){
143422 return 0; /* restriction (9) */
143423 }
143424 if( notUnionAll ){
143425 /* If any of the compound arms are connected using UNION, INTERSECT,
143426 ** or EXCEPT, then we must ensure that none of the columns use a
143427 ** non-BINARY collating sequence. */
143428 for(pSel=pSubq; pSel; pSel=pSel->pPrior){
@@ -143509,10 +143831,80 @@
143509 }
143510 }
143511 return nChng;
143512 }
143513 #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143514
143515 /*
143516 ** The pFunc is the only aggregate function in the query. Check to see
143517 ** if the query is a candidate for the min/max optimization.
143518 **
@@ -144695,11 +145087,12 @@
144695 if( pExpr->pAggInfo==0 ) return WRC_Continue;
144696 if( pExpr->op==TK_AGG_COLUMN ) return WRC_Continue;
144697 if( pExpr->op==TK_AGG_FUNCTION ) return WRC_Continue;
144698 if( pExpr->op==TK_IF_NULL_ROW ) return WRC_Continue;
144699 pAggInfo = pExpr->pAggInfo;
144700 assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn );
 
144701 pCol = &pAggInfo->aCol[pExpr->iAgg];
144702 pExpr->op = TK_AGG_COLUMN;
144703 pExpr->iTable = pCol->iTable;
144704 pExpr->iColumn = pCol->iColumn;
144705 return WRC_Prune;
@@ -145053,11 +145446,10 @@
145053 sqlite3DbFree(db, p->aCol);
145054 sqlite3DbFree(db, p->aFunc);
145055 sqlite3DbFreeNN(db, p);
145056 }
145057
145058 #ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
145059 /*
145060 ** Attempt to transform a query of the form
145061 **
145062 ** SELECT count(*) FROM (SELECT x FROM t1 UNION ALL SELECT y FROM t2)
145063 **
@@ -145081,10 +145473,11 @@
145081 Expr *pCount;
145082 sqlite3 *db;
145083 if( (p->selFlags & SF_Aggregate)==0 ) return 0; /* This is an aggregate */
145084 if( p->pEList->nExpr!=1 ) return 0; /* Single result column */
145085 if( p->pWhere ) return 0;
 
145086 if( p->pGroupBy ) return 0;
145087 if( p->pOrderBy ) return 0;
145088 pExpr = p->pEList->a[0].pExpr;
145089 if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */
145090 assert( ExprUseUToken(pExpr) );
@@ -145100,11 +145493,12 @@
145100 do{
145101 if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
145102 if( pSub->pWhere ) return 0; /* No WHERE clause */
145103 if( pSub->pLimit ) return 0; /* No LIMIT clause */
145104 if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */
145105 pSub = pSub->pPrior; /* Repeat over compound */
 
145106 }while( pSub );
145107
145108 /* If we reach this point then it is OK to perform the transformation */
145109
145110 db = pParse->db;
@@ -145143,11 +145537,10 @@
145143 sqlite3TreeViewSelect(0, p, 0);
145144 }
145145 #endif
145146 return 1;
145147 }
145148 #endif /* SQLITE_COUNTOFVIEW_OPTIMIZATION */
145149
145150 /*
145151 ** If any term of pSrc, or any SF_NestedFrom sub-query, is not the same
145152 ** as pSrcItem but has the same alias as p0, then return true.
145153 ** Otherwise return false.
@@ -145532,18 +145925,16 @@
145532 #endif
145533 }else{
145534 TREETRACE(0x2000,pParse,p,("Constant propagation not helpful\n"));
145535 }
145536
145537 #ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
145538 if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView)
145539 && countOfViewOptimization(pParse, p)
145540 ){
145541 if( db->mallocFailed ) goto select_end;
145542 pTabList = p->pSrc;
145543 }
145544 #endif
145545
145546 /* For each term in the FROM clause, do two things:
145547 ** (1) Authorized unreferenced tables
145548 ** (2) Generate code for all sub-queries
145549 */
@@ -145611,10 +146002,26 @@
145611 #endif
145612 assert( pItem->pSelect && (pItem->pSelect->selFlags & SF_PushDown)!=0 );
145613 }else{
145614 TREETRACE(0x4000,pParse,p,("Push-down not possible\n"));
145615 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145616
145617 zSavedAuthContext = pParse->zAuthContext;
145618 pParse->zAuthContext = pItem->zName;
145619
145620 /* Generate code to implement the subquery
@@ -148149,10 +148556,13 @@
148149 const int op = pChanges ? TK_UPDATE : TK_DELETE;
148150 u32 mask = 0;
148151 Trigger *p;
148152
148153 assert( isNew==1 || isNew==0 );
 
 
 
148154 for(p=pTrigger; p; p=p->pNext){
148155 if( p->op==op
148156 && (tr_tm&p->tr_tm)
148157 && checkColumnOverlap(p->pColumns,pChanges)
148158 ){
@@ -148583,11 +148993,11 @@
148583 #endif
148584
148585 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
148586 goto update_cleanup;
148587 }
148588 if( sqlite3IsReadOnly(pParse, pTab, tmask) ){
148589 goto update_cleanup;
148590 }
148591
148592 /* Allocate a cursors for the main database table and for all indices.
148593 ** The index cursors might not be used, but if they are used they
@@ -152376,13 +152786,13 @@
152376 sqlite3_str_append(pStr, ")", 1);
152377 }
152378
152379 /*
152380 ** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN
152381 ** command, or if either SQLITE_DEBUG or SQLITE_ENABLE_STMT_SCANSTATUS was
152382 ** defined at compile-time. If it is not a no-op, a single OP_Explain opcode
152383 ** is added to the output to describe the table scan strategy in pLevel.
152384 **
152385 ** If an OP_Explain opcode is added to the VM, its address is returned.
152386 ** Otherwise, if no OP_Explain is coded, zero is returned.
152387 */
152388 SQLITE_PRIVATE int sqlite3WhereExplainOneScan(
@@ -152390,12 +152800,12 @@
152390 SrcList *pTabList, /* Table list this loop refers to */
152391 WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
152392 u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
152393 ){
152394 int ret = 0;
152395 #if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS)
152396 if( sqlite3ParseToplevel(pParse)->explain==2 )
152397 #endif
152398 {
152399 SrcItem *pItem = &pTabList->a[pLevel->iFrom];
152400 Vdbe *v = pParse->pVdbe; /* VM being constructed */
152401 sqlite3 *db = pParse->db; /* Database handle */
@@ -152557,31 +152967,33 @@
152557 Vdbe *v, /* Vdbe to add scanstatus entry to */
152558 SrcList *pSrclist, /* FROM clause pLvl reads data from */
152559 WhereLevel *pLvl, /* Level to add scanstatus() entry for */
152560 int addrExplain /* Address of OP_Explain (or 0) */
152561 ){
152562 const char *zObj = 0;
152563 WhereLoop *pLoop = pLvl->pWLoop;
152564 int wsFlags = pLoop->wsFlags;
152565 int viaCoroutine = 0;
152566
152567 if( (wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
152568 zObj = pLoop->u.btree.pIndex->zName;
152569 }else{
152570 zObj = pSrclist->a[pLvl->iFrom].zName;
152571 viaCoroutine = pSrclist->a[pLvl->iFrom].fg.viaCoroutine;
152572 }
152573 sqlite3VdbeScanStatus(
152574 v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
152575 );
152576
152577 if( viaCoroutine==0 ){
152578 if( (wsFlags & (WHERE_MULTI_OR|WHERE_AUTO_INDEX))==0 ){
152579 sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iTabCur);
152580 }
152581 if( wsFlags & WHERE_INDEXED ){
152582 sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iIdxCur);
 
 
152583 }
152584 }
152585 }
152586 #endif
152587
@@ -154190,11 +154602,11 @@
154190 ** of entries in the tree, so basing the number of steps to try
154191 ** on the estimated number of rows in the btree seems like a good
154192 ** guess. */
154193 addrSeekScan = sqlite3VdbeAddOp1(v, OP_SeekScan,
154194 (pIdx->aiRowLogEst[0]+9)/10);
154195 if( pRangeStart ){
154196 sqlite3VdbeChangeP5(v, 1);
154197 sqlite3VdbeChangeP2(v, addrSeekScan, sqlite3VdbeCurrentAddr(v)+1);
154198 addrSeekScan = 0;
154199 }
154200 VdbeCoverage(v);
@@ -154231,20 +154643,11 @@
154231 */
154232 nConstraint = nEq;
154233 assert( pLevel->p2==0 );
154234 if( pRangeEnd ){
154235 Expr *pRight = pRangeEnd->pExpr->pRight;
154236 if( addrSeekScan ){
154237 /* For a seek-scan that has a range on the lowest term of the index,
154238 ** we have to make the top of the loop be code that sets the end
154239 ** condition of the range. Otherwise, the OP_SeekScan might jump
154240 ** over that initialization, leaving the range-end value set to the
154241 ** range-start value, resulting in a wrong answer.
154242 ** See ticket 5981a8c041a3c2f3 (2021-11-02).
154243 */
154244 pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154245 }
154246 codeExprOrVector(pParse, pRight, regBase+nEq, nTop);
154247 whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd);
154248 if( (pRangeEnd->wtFlags & TERM_VNULL)==0
154249 && sqlite3ExprCanBeNull(pRight)
154250 ){
@@ -154274,11 +154677,11 @@
154274 }
154275 if( zStartAff ) sqlite3DbNNFreeNN(db, zStartAff);
154276 if( zEndAff ) sqlite3DbNNFreeNN(db, zEndAff);
154277
154278 /* Top of the loop body */
154279 if( pLevel->p2==0 ) pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154280
154281 /* Check if the index cursor is past the end of the range. */
154282 if( nConstraint ){
154283 if( regBignull ){
154284 /* Except, skip the end-of-range check while doing the NULL-scan */
@@ -156916,13 +157319,16 @@
156916 pColRef->y.pTab = pTab;
156917 pItem->colUsed |= sqlite3ExprColUsed(pColRef);
156918 pRhs = sqlite3PExpr(pParse, TK_UPLUS,
156919 sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0);
156920 pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs);
156921 if( pItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT) ){
 
 
156922 joinType = EP_OuterON;
156923 }else{
 
156924 joinType = EP_InnerON;
156925 }
156926 sqlite3SetJoinExpr(pTerm, pItem->iCursor, joinType);
156927 whereClauseInsert(pWC, pTerm, TERM_DYNAMIC);
156928 }
@@ -157761,11 +158167,11 @@
157761 Parse *pParse,
157762 Index *pIdx, /* Automatic index to explain */
157763 int bPartial, /* True if pIdx is a partial index */
157764 int *pAddrExplain /* OUT: Address of OP_Explain */
157765 ){
157766 if( pParse->explain!=2 ){
157767 Table *pTab = pIdx->pTable;
157768 const char *zSep = "";
157769 char *zText = 0;
157770 int ii = 0;
157771 sqlite3_str *pStr = sqlite3_str_new(pParse->db);
@@ -157822,11 +158228,12 @@
157822 CollSeq *pColl; /* Collating sequence to on a column */
157823 WhereLoop *pLoop; /* The Loop object */
157824 char *zNotUsed; /* Extra space on the end of pIdx */
157825 Bitmask idxCols; /* Bitmap of columns used for indexing */
157826 Bitmask extraCols; /* Bitmap of additional columns */
157827 u8 sentWarning = 0; /* True if a warnning has been issued */
 
157828 Expr *pPartial = 0; /* Partial Index Expression */
157829 int iContinue = 0; /* Jump here to skip excluded rows */
157830 SrcItem *pTabItem; /* FROM clause term being indexed */
157831 int addrCounter = 0; /* Address where integer counter is initialized */
157832 int regBase; /* Array of registers where record is assembled */
@@ -157892,11 +158299,15 @@
157892 ** original table never needs to be accessed. Automatic indices must
157893 ** be a covering index because the index will not be updated if the
157894 ** original table changes and the index and table cannot both be used
157895 ** if they go out of sync.
157896 */
157897 extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
 
 
 
 
157898 mxBitCol = MIN(BMS-1,pTable->nCol);
157899 testcase( pTable->nCol==BMS-1 );
157900 testcase( pTable->nCol==BMS-2 );
157901 for(i=0; i<mxBitCol; i++){
157902 if( extraCols & MASKBIT(i) ) nKeyCol++;
@@ -157928,10 +158339,20 @@
157928 pIdx->aiColumn[n] = pTerm->u.x.leftColumn;
157929 pColl = sqlite3ExprCompareCollSeq(pParse, pX);
157930 assert( pColl!=0 || pParse->nErr>0 ); /* TH3 collate01.800 */
157931 pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
157932 n++;
 
 
 
 
 
 
 
 
 
 
157933 }
157934 }
157935 }
157936 assert( (u32)n==pLoop->u.btree.nEq );
157937
@@ -157960,11 +158381,12 @@
157960 assert( pLevel->iIdxCur>=0 );
157961 pLevel->iIdxCur = pParse->nTab++;
157962 sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
157963 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
157964 VdbeComment((v, "for %s", pTable->zName));
157965 if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) ){
 
157966 pLevel->regFilter = ++pParse->nMem;
157967 sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter);
157968 }
157969
157970 /* Fill the automatic index with content */
@@ -158444,10 +158866,11 @@
158444 UNUSED_PARAMETER( pParse );
158445 #endif
158446 assert( pRec!=0 );
158447 assert( pIdx->nSample>0 );
158448 assert( pRec->nField>0 );
 
158449
158450 /* Do a binary search to find the first sample greater than or equal
158451 ** to pRec. If pRec contains a single field, the set of samples to search
158452 ** is simply the aSample[] array. If the samples in aSample[] contain more
158453 ** than one fields, all fields following the first are ignored.
@@ -158489,11 +158912,16 @@
158489 ** appears that it should be 1 field in size. However, that would make it
158490 ** smaller than sample 1, so the binary search would not work. As a result,
158491 ** it is extended to two fields. The duplicates that this creates do not
158492 ** cause any problems.
158493 */
158494 nField = MIN(pRec->nField, pIdx->nSample);
 
 
 
 
 
158495 iCol = 0;
158496 iSample = pIdx->nSample * nField;
158497 do{
158498 int iSamp; /* Index in aSample[] of test sample */
158499 int n; /* Number of fields in test sample */
@@ -163150,11 +163578,11 @@
163150 for(; b; b=b>>1, n++){}
163151 sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(n), P4_INT32);
163152 assert( n<=pTab->nCol );
163153 }
163154 #ifdef SQLITE_ENABLE_CURSOR_HINTS
163155 if( pLoop->u.btree.pIndex!=0 ){
163156 sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ|bFordelete);
163157 }else
163158 #endif
163159 {
163160 sqlite3VdbeChangeP5(v, bFordelete);
@@ -167311,22 +167739,22 @@
167311 #define sqlite3ParserCTX_PDECL ,Parse *pParse
167312 #define sqlite3ParserCTX_PARAM ,pParse
167313 #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
167314 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
167315 #define YYFALLBACK 1
167316 #define YYNSTATE 576
167317 #define YYNRULE 405
167318 #define YYNRULE_WITH_ACTION 342
167319 #define YYNTOKEN 185
167320 #define YY_MAX_SHIFT 575
167321 #define YY_MIN_SHIFTREDUCE 835
167322 #define YY_MAX_SHIFTREDUCE 1239
167323 #define YY_ERROR_ACTION 1240
167324 #define YY_ACCEPT_ACTION 1241
167325 #define YY_NO_ACTION 1242
167326 #define YY_MIN_REDUCE 1243
167327 #define YY_MAX_REDUCE 1647
167328 /************* End control #defines *******************************************/
167329 #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
167330
167331 /* Define the yytestcase() macro to be a no-op if is not already defined
167332 ** otherwise.
@@ -167389,222 +167817,222 @@
167389 ** yy_reduce_ofst[] For each state, the offset into yy_action for
167390 ** shifting non-terminals after a reduce.
167391 ** yy_default[] Default action for each state.
167392 **
167393 *********** Begin parsing tables **********************************************/
167394 #define YY_ACTTAB_COUNT (2098)
167395 static const YYACTIONTYPE yy_action[] = {
167396 /* 0 */ 568, 208, 568, 118, 115, 229, 568, 118, 115, 229,
167397 /* 10 */ 568, 1314, 377, 1293, 408, 562, 562, 562, 568, 409,
167398 /* 20 */ 378, 1314, 1276, 41, 41, 41, 41, 208, 1526, 71,
167399 /* 30 */ 71, 971, 419, 41, 41, 491, 303, 279, 303, 972,
167400 /* 40 */ 397, 71, 71, 125, 126, 80, 1217, 1217, 1050, 1053,
167401 /* 50 */ 1040, 1040, 123, 123, 124, 124, 124, 124, 476, 409,
167402 /* 60 */ 1241, 1, 1, 575, 2, 1245, 550, 118, 115, 229,
167403 /* 70 */ 317, 480, 146, 480, 524, 118, 115, 229, 529, 1327,
167404 /* 80 */ 417, 523, 142, 125, 126, 80, 1217, 1217, 1050, 1053,
167405 /* 90 */ 1040, 1040, 123, 123, 124, 124, 124, 124, 118, 115,
167406 /* 100 */ 229, 327, 122, 122, 122, 122, 121, 121, 120, 120,
167407 /* 110 */ 120, 119, 116, 444, 284, 284, 284, 284, 442, 442,
167408 /* 120 */ 442, 1567, 376, 1569, 1192, 375, 1163, 565, 1163, 565,
167409 /* 130 */ 409, 1567, 537, 259, 226, 444, 101, 145, 449, 316,
167410 /* 140 */ 559, 240, 122, 122, 122, 122, 121, 121, 120, 120,
167411 /* 150 */ 120, 119, 116, 444, 125, 126, 80, 1217, 1217, 1050,
167412 /* 160 */ 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, 142,
167413 /* 170 */ 294, 1192, 339, 448, 120, 120, 120, 119, 116, 444,
167414 /* 180 */ 127, 1192, 1193, 1194, 148, 441, 440, 568, 119, 116,
167415 /* 190 */ 444, 124, 124, 124, 124, 117, 122, 122, 122, 122,
167416 /* 200 */ 121, 121, 120, 120, 120, 119, 116, 444, 454, 113,
167417 /* 210 */ 13, 13, 546, 122, 122, 122, 122, 121, 121, 120,
167418 /* 220 */ 120, 120, 119, 116, 444, 422, 316, 559, 1192, 1193,
167419 /* 230 */ 1194, 149, 1224, 409, 1224, 124, 124, 124, 124, 122,
167420 /* 240 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116,
167421 /* 250 */ 444, 465, 342, 1037, 1037, 1051, 1054, 125, 126, 80,
167422 /* 260 */ 1217, 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124,
167423 /* 270 */ 124, 124, 1279, 522, 222, 1192, 568, 409, 224, 514,
167424 /* 280 */ 175, 82, 83, 122, 122, 122, 122, 121, 121, 120,
167425 /* 290 */ 120, 120, 119, 116, 444, 1007, 16, 16, 1192, 133,
167426 /* 300 */ 133, 125, 126, 80, 1217, 1217, 1050, 1053, 1040, 1040,
167427 /* 310 */ 123, 123, 124, 124, 124, 124, 122, 122, 122, 122,
167428 /* 320 */ 121, 121, 120, 120, 120, 119, 116, 444, 1041, 546,
167429 /* 330 */ 1192, 373, 1192, 1193, 1194, 252, 1434, 399, 504, 501,
167430 /* 340 */ 500, 111, 560, 566, 4, 926, 926, 433, 499, 340,
167431 /* 350 */ 460, 328, 360, 394, 1237, 1192, 1193, 1194, 563, 568,
167432 /* 360 */ 122, 122, 122, 122, 121, 121, 120, 120, 120, 119,
167433 /* 370 */ 116, 444, 284, 284, 369, 1580, 1607, 441, 440, 154,
167434 /* 380 */ 409, 445, 71, 71, 1286, 565, 1221, 1192, 1193, 1194,
167435 /* 390 */ 85, 1223, 271, 557, 543, 515, 1561, 568, 98, 1222,
167436 /* 400 */ 6, 1278, 472, 142, 125, 126, 80, 1217, 1217, 1050,
167437 /* 410 */ 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, 550,
167438 /* 420 */ 13, 13, 1027, 507, 1224, 1192, 1224, 549, 109, 109,
167439 /* 430 */ 222, 568, 1238, 175, 568, 427, 110, 197, 445, 570,
167440 /* 440 */ 569, 430, 1552, 1017, 325, 551, 1192, 270, 287, 368,
167441 /* 450 */ 510, 363, 509, 257, 71, 71, 543, 71, 71, 359,
167442 /* 460 */ 316, 559, 1613, 122, 122, 122, 122, 121, 121, 120,
167443 /* 470 */ 120, 120, 119, 116, 444, 1017, 1017, 1019, 1020, 27,
167444 /* 480 */ 284, 284, 1192, 1193, 1194, 1158, 568, 1612, 409, 901,
167445 /* 490 */ 190, 550, 356, 565, 550, 937, 533, 517, 1158, 516,
167446 /* 500 */ 413, 1158, 552, 1192, 1193, 1194, 568, 544, 1554, 51,
167447 /* 510 */ 51, 214, 125, 126, 80, 1217, 1217, 1050, 1053, 1040,
167448 /* 520 */ 1040, 123, 123, 124, 124, 124, 124, 1192, 474, 135,
167449 /* 530 */ 135, 409, 284, 284, 1490, 505, 121, 121, 120, 120,
167450 /* 540 */ 120, 119, 116, 444, 1007, 565, 518, 217, 541, 1561,
167451 /* 550 */ 316, 559, 142, 6, 532, 125, 126, 80, 1217, 1217,
167452 /* 560 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167453 /* 570 */ 1555, 122, 122, 122, 122, 121, 121, 120, 120, 120,
167454 /* 580 */ 119, 116, 444, 485, 1192, 1193, 1194, 482, 281, 1267,
167455 /* 590 */ 957, 252, 1192, 373, 504, 501, 500, 1192, 340, 571,
167456 /* 600 */ 1192, 571, 409, 292, 499, 957, 876, 191, 480, 316,
167457 /* 610 */ 559, 384, 290, 380, 122, 122, 122, 122, 121, 121,
167458 /* 620 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167459 /* 630 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167460 /* 640 */ 124, 409, 394, 1136, 1192, 869, 100, 284, 284, 1192,
167461 /* 650 */ 1193, 1194, 373, 1093, 1192, 1193, 1194, 1192, 1193, 1194,
167462 /* 660 */ 565, 455, 32, 373, 233, 125, 126, 80, 1217, 1217,
167463 /* 670 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167464 /* 680 */ 1433, 959, 568, 228, 958, 122, 122, 122, 122, 121,
167465 /* 690 */ 121, 120, 120, 120, 119, 116, 444, 1158, 228, 1192,
167466 /* 700 */ 157, 1192, 1193, 1194, 1553, 13, 13, 301, 957, 1232,
167467 /* 710 */ 1158, 153, 409, 1158, 373, 1583, 1176, 5, 369, 1580,
167468 /* 720 */ 429, 1238, 3, 957, 122, 122, 122, 122, 121, 121,
167469 /* 730 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167470 /* 740 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167471 /* 750 */ 124, 409, 208, 567, 1192, 1028, 1192, 1193, 1194, 1192,
167472 /* 760 */ 388, 852, 155, 1552, 286, 402, 1098, 1098, 488, 568,
167473 /* 770 */ 465, 342, 1319, 1319, 1552, 125, 126, 80, 1217, 1217,
167474 /* 780 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167475 /* 790 */ 129, 568, 13, 13, 374, 122, 122, 122, 122, 121,
167476 /* 800 */ 121, 120, 120, 120, 119, 116, 444, 302, 568, 453,
167477 /* 810 */ 528, 1192, 1193, 1194, 13, 13, 1192, 1193, 1194, 1297,
167478 /* 820 */ 463, 1267, 409, 1317, 1317, 1552, 1012, 453, 452, 200,
167479 /* 830 */ 299, 71, 71, 1265, 122, 122, 122, 122, 121, 121,
167480 /* 840 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167481 /* 850 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167482 /* 860 */ 124, 409, 227, 1073, 1158, 284, 284, 419, 312, 278,
167483 /* 870 */ 278, 285, 285, 1419, 406, 405, 382, 1158, 565, 568,
167484 /* 880 */ 1158, 1196, 565, 1600, 565, 125, 126, 80, 1217, 1217,
167485 /* 890 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124,
167486 /* 900 */ 453, 1482, 13, 13, 1536, 122, 122, 122, 122, 121,
167487 /* 910 */ 121, 120, 120, 120, 119, 116, 444, 201, 568, 354,
167488 /* 920 */ 1586, 575, 2, 1245, 840, 841, 842, 1562, 317, 1212,
167489 /* 930 */ 146, 6, 409, 255, 254, 253, 206, 1327, 9, 1196,
167490 /* 940 */ 262, 71, 71, 424, 122, 122, 122, 122, 121, 121,
167491 /* 950 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217,
167492 /* 960 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167493 /* 970 */ 124, 568, 284, 284, 568, 1213, 409, 574, 313, 1245,
167494 /* 980 */ 349, 1296, 352, 419, 317, 565, 146, 491, 525, 1643,
167495 /* 990 */ 395, 371, 491, 1327, 70, 70, 1295, 71, 71, 240,
167496 /* 1000 */ 1325, 104, 80, 1217, 1217, 1050, 1053, 1040, 1040, 123,
167497 /* 1010 */ 123, 124, 124, 124, 124, 122, 122, 122, 122, 121,
167498 /* 1020 */ 121, 120, 120, 120, 119, 116, 444, 1114, 284, 284,
167499 /* 1030 */ 428, 448, 1525, 1213, 439, 284, 284, 1489, 1352, 311,
167500 /* 1040 */ 474, 565, 1115, 971, 491, 491, 217, 1263, 565, 1538,
167501 /* 1050 */ 568, 972, 207, 568, 1027, 240, 383, 1116, 519, 122,
167502 /* 1060 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116,
167503 /* 1070 */ 444, 1018, 107, 71, 71, 1017, 13, 13, 912, 568,
167504 /* 1080 */ 1495, 568, 284, 284, 97, 526, 491, 448, 913, 1326,
167505 /* 1090 */ 1322, 545, 409, 284, 284, 565, 151, 209, 1495, 1497,
167506 /* 1100 */ 262, 450, 55, 55, 56, 56, 565, 1017, 1017, 1019,
167507 /* 1110 */ 443, 332, 409, 527, 12, 295, 125, 126, 80, 1217,
167508 /* 1120 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167509 /* 1130 */ 124, 347, 409, 864, 1534, 1213, 125, 126, 80, 1217,
167510 /* 1140 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167511 /* 1150 */ 124, 1137, 1641, 474, 1641, 371, 125, 114, 80, 1217,
167512 /* 1160 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124,
167513 /* 1170 */ 124, 1495, 329, 474, 331, 122, 122, 122, 122, 121,
167514 /* 1180 */ 121, 120, 120, 120, 119, 116, 444, 203, 1419, 568,
167515 /* 1190 */ 1294, 864, 464, 1213, 436, 122, 122, 122, 122, 121,
167516 /* 1200 */ 121, 120, 120, 120, 119, 116, 444, 553, 1137, 1642,
167517 /* 1210 */ 539, 1642, 15, 15, 892, 122, 122, 122, 122, 121,
167518 /* 1220 */ 121, 120, 120, 120, 119, 116, 444, 568, 298, 538,
167519 /* 1230 */ 1135, 1419, 1559, 1560, 1331, 409, 6, 6, 1169, 1268,
167520 /* 1240 */ 415, 320, 284, 284, 1419, 508, 565, 525, 300, 457,
167521 /* 1250 */ 43, 43, 568, 893, 12, 565, 330, 478, 425, 407,
167522 /* 1260 */ 126, 80, 1217, 1217, 1050, 1053, 1040, 1040, 123, 123,
167523 /* 1270 */ 124, 124, 124, 124, 568, 57, 57, 288, 1192, 1419,
167524 /* 1280 */ 496, 458, 392, 392, 391, 273, 389, 1135, 1558, 849,
167525 /* 1290 */ 1169, 407, 6, 568, 321, 1158, 470, 44, 44, 1557,
167526 /* 1300 */ 1114, 426, 234, 6, 323, 256, 540, 256, 1158, 431,
167527 /* 1310 */ 568, 1158, 322, 17, 487, 1115, 58, 58, 122, 122,
167528 /* 1320 */ 122, 122, 121, 121, 120, 120, 120, 119, 116, 444,
167529 /* 1330 */ 1116, 216, 481, 59, 59, 1192, 1193, 1194, 111, 560,
167530 /* 1340 */ 324, 4, 236, 456, 526, 568, 237, 456, 568, 437,
167531 /* 1350 */ 168, 556, 420, 141, 479, 563, 568, 293, 568, 1095,
167532 /* 1360 */ 568, 293, 568, 1095, 531, 568, 872, 8, 60, 60,
167533 /* 1370 */ 235, 61, 61, 568, 414, 568, 414, 568, 445, 62,
167534 /* 1380 */ 62, 45, 45, 46, 46, 47, 47, 199, 49, 49,
167535 /* 1390 */ 557, 568, 359, 568, 100, 486, 50, 50, 63, 63,
167536 /* 1400 */ 64, 64, 561, 415, 535, 410, 568, 1027, 568, 534,
167537 /* 1410 */ 316, 559, 316, 559, 65, 65, 14, 14, 568, 1027,
167538 /* 1420 */ 568, 512, 932, 872, 1018, 109, 109, 931, 1017, 66,
167539 /* 1430 */ 66, 131, 131, 110, 451, 445, 570, 569, 416, 177,
167540 /* 1440 */ 1017, 132, 132, 67, 67, 568, 467, 568, 932, 471,
167541 /* 1450 */ 1364, 283, 226, 931, 315, 1363, 407, 568, 459, 407,
167542 /* 1460 */ 1017, 1017, 1019, 239, 407, 86, 213, 1350, 52, 52,
167543 /* 1470 */ 68, 68, 1017, 1017, 1019, 1020, 27, 1585, 1180, 447,
167544 /* 1480 */ 69, 69, 288, 97, 108, 1541, 106, 392, 392, 391,
167545 /* 1490 */ 273, 389, 568, 879, 849, 883, 568, 111, 560, 466,
167546 /* 1500 */ 4, 568, 152, 30, 38, 568, 1132, 234, 396, 323,
167547 /* 1510 */ 111, 560, 527, 4, 563, 53, 53, 322, 568, 163,
167548 /* 1520 */ 163, 568, 337, 468, 164, 164, 333, 563, 76, 76,
167549 /* 1530 */ 568, 289, 1514, 568, 31, 1513, 568, 445, 338, 483,
167550 /* 1540 */ 100, 54, 54, 344, 72, 72, 296, 236, 1080, 557,
167551 /* 1550 */ 445, 879, 1360, 134, 134, 168, 73, 73, 141, 161,
167552 /* 1560 */ 161, 1574, 557, 535, 568, 319, 568, 348, 536, 1009,
167553 /* 1570 */ 473, 261, 261, 891, 890, 235, 535, 568, 1027, 568,
167554 /* 1580 */ 475, 534, 261, 367, 109, 109, 521, 136, 136, 130,
167555 /* 1590 */ 130, 1027, 110, 366, 445, 570, 569, 109, 109, 1017,
167556 /* 1600 */ 162, 162, 156, 156, 568, 110, 1080, 445, 570, 569,
167557 /* 1610 */ 410, 351, 1017, 568, 353, 316, 559, 568, 343, 568,
167558 /* 1620 */ 100, 497, 357, 258, 100, 898, 899, 140, 140, 355,
167559 /* 1630 */ 1310, 1017, 1017, 1019, 1020, 27, 139, 139, 362, 451,
167560 /* 1640 */ 137, 137, 138, 138, 1017, 1017, 1019, 1020, 27, 1180,
167561 /* 1650 */ 447, 568, 372, 288, 111, 560, 1021, 4, 392, 392,
167562 /* 1660 */ 391, 273, 389, 568, 1141, 849, 568, 1076, 568, 258,
167563 /* 1670 */ 492, 563, 568, 211, 75, 75, 555, 962, 234, 261,
167564 /* 1680 */ 323, 111, 560, 929, 4, 113, 77, 77, 322, 74,
167565 /* 1690 */ 74, 42, 42, 1373, 445, 48, 48, 1418, 563, 974,
167566 /* 1700 */ 975, 1092, 1091, 1092, 1091, 862, 557, 150, 930, 1346,
167567 /* 1710 */ 113, 1358, 554, 1424, 1021, 1275, 1266, 1254, 236, 1253,
167568 /* 1720 */ 1255, 445, 1593, 1343, 308, 276, 168, 309, 11, 141,
167569 /* 1730 */ 393, 310, 232, 557, 1405, 1027, 335, 291, 1400, 219,
167570 /* 1740 */ 336, 109, 109, 936, 297, 1410, 235, 341, 477, 110,
167571 /* 1750 */ 502, 445, 570, 569, 1393, 1409, 1017, 400, 1293, 365,
167572 /* 1760 */ 223, 1486, 1027, 1485, 1355, 1356, 1354, 1353, 109, 109,
167573 /* 1770 */ 204, 1596, 1232, 558, 265, 218, 110, 205, 445, 570,
167574 /* 1780 */ 569, 410, 387, 1017, 1533, 179, 316, 559, 1017, 1017,
167575 /* 1790 */ 1019, 1020, 27, 230, 1531, 1229, 79, 560, 85, 4,
167576 /* 1800 */ 418, 215, 548, 81, 84, 188, 1406, 173, 181, 461,
167577 /* 1810 */ 451, 35, 462, 563, 183, 1017, 1017, 1019, 1020, 27,
167578 /* 1820 */ 184, 1491, 185, 186, 495, 242, 98, 398, 1412, 36,
167579 /* 1830 */ 1411, 484, 91, 469, 401, 1414, 445, 192, 1480, 246,
167580 /* 1840 */ 1502, 490, 346, 277, 248, 196, 493, 511, 557, 350,
167581 /* 1850 */ 1256, 249, 250, 403, 1313, 1312, 111, 560, 432, 4,
167582 /* 1860 */ 1311, 1304, 93, 1611, 883, 1610, 224, 404, 434, 520,
167583 /* 1870 */ 263, 435, 1579, 563, 1283, 1282, 364, 1027, 306, 1281,
167584 /* 1880 */ 264, 1609, 1565, 109, 109, 370, 1303, 307, 1564, 438,
167585 /* 1890 */ 128, 110, 1378, 445, 570, 569, 445, 546, 1017, 10,
167586 /* 1900 */ 1466, 105, 381, 1377, 34, 572, 99, 1336, 557, 314,
167587 /* 1910 */ 1186, 530, 272, 274, 379, 210, 1335, 547, 385, 386,
167588 /* 1920 */ 275, 573, 1251, 1246, 411, 412, 1518, 165, 178, 1519,
167589 /* 1930 */ 1017, 1017, 1019, 1020, 27, 1517, 1516, 1027, 78, 147,
167590 /* 1940 */ 166, 220, 221, 109, 109, 836, 304, 167, 446, 212,
167591 /* 1950 */ 318, 110, 231, 445, 570, 569, 144, 1090, 1017, 1088,
167592 /* 1960 */ 326, 180, 169, 1212, 182, 334, 238, 915, 241, 1104,
167593 /* 1970 */ 187, 170, 171, 421, 87, 88, 423, 189, 89, 90,
167594 /* 1980 */ 172, 1107, 243, 1103, 244, 158, 18, 245, 345, 247,
167595 /* 1990 */ 1017, 1017, 1019, 1020, 27, 261, 1096, 193, 1226, 489,
167596 /* 2000 */ 194, 37, 366, 851, 494, 251, 195, 506, 92, 19,
167597 /* 2010 */ 498, 358, 20, 503, 881, 361, 94, 894, 305, 159,
167598 /* 2020 */ 513, 39, 95, 1174, 160, 1056, 966, 1143, 96, 174,
167599 /* 2030 */ 1142, 225, 280, 282, 198, 960, 113, 1164, 1160, 260,
167600 /* 2040 */ 21, 22, 23, 1162, 1168, 1167, 1148, 24, 33, 25,
167601 /* 2050 */ 202, 542, 26, 100, 1071, 102, 1057, 103, 7, 1055,
167602 /* 2060 */ 1059, 1113, 1060, 1112, 266, 267, 28, 40, 390, 1022,
167603 /* 2070 */ 863, 112, 29, 564, 1182, 1181, 268, 176, 143, 925,
167604 /* 2080 */ 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242,
167605 /* 2090 */ 1242, 1242, 1242, 1242, 269, 1602, 1242, 1601,
167606 };
167607 static const YYCODETYPE yy_lookahead[] = {
167608 /* 0 */ 193, 193, 193, 274, 275, 276, 193, 274, 275, 276,
167609 /* 10 */ 193, 223, 219, 225, 206, 210, 211, 212, 193, 19,
167610 /* 20 */ 219, 233, 216, 216, 217, 216, 217, 193, 295, 216,
@@ -167812,11 +168240,11 @@
167812 /* 2040 */ 34, 34, 34, 86, 75, 93, 23, 34, 22, 34,
167813 /* 2050 */ 25, 24, 34, 25, 23, 142, 23, 142, 44, 23,
167814 /* 2060 */ 23, 23, 11, 23, 25, 22, 22, 22, 15, 23,
167815 /* 2070 */ 23, 22, 22, 25, 1, 1, 141, 25, 23, 135,
167816 /* 2080 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167817 /* 2090 */ 319, 319, 319, 319, 141, 141, 319, 141, 319, 319,
167818 /* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167819 /* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167820 /* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167821 /* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167822 /* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
@@ -167831,13 +168259,13 @@
167831 /* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167832 /* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167833 /* 2250 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167834 /* 2260 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167835 /* 2270 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
167836 /* 2280 */ 319, 319, 319,
167837 };
167838 #define YY_SHIFT_COUNT (575)
167839 #define YY_SHIFT_MIN (0)
167840 #define YY_SHIFT_MAX (2074)
167841 static const unsigned short int yy_shift_ofst[] = {
167842 /* 0 */ 1648, 1477, 1272, 322, 322, 1, 1319, 1478, 1491, 1837,
167843 /* 10 */ 1837, 1837, 471, 0, 0, 214, 1093, 1837, 1837, 1837,
@@ -167853,16 +168281,16 @@
167853 /* 110 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
167854 /* 120 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
167855 /* 130 */ 137, 181, 181, 181, 181, 181, 181, 181, 94, 430,
167856 /* 140 */ 66, 65, 112, 366, 533, 533, 740, 1261, 533, 533,
167857 /* 150 */ 79, 79, 533, 412, 412, 412, 77, 412, 123, 113,
167858 /* 160 */ 113, 22, 22, 2098, 2098, 328, 328, 328, 239, 468,
167859 /* 170 */ 468, 468, 468, 1015, 1015, 409, 366, 1129, 1186, 533,
167860 /* 180 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167861 /* 190 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 969,
167862 /* 200 */ 621, 621, 533, 642, 788, 788, 1228, 1228, 822, 822,
167863 /* 210 */ 67, 1274, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 1307,
167864 /* 220 */ 954, 954, 585, 472, 640, 387, 695, 538, 541, 700,
167865 /* 230 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167866 /* 240 */ 222, 533, 533, 533, 533, 533, 533, 533, 533, 533,
167867 /* 250 */ 533, 533, 533, 1179, 1179, 1179, 533, 533, 533, 565,
167868 /* 260 */ 533, 533, 533, 916, 1144, 533, 533, 1288, 533, 533,
@@ -167876,12 +168304,12 @@
167876 /* 340 */ 1764, 1677, 1764, 1677, 1633, 1806, 1674, 1779, 1633, 1806,
167877 /* 350 */ 1823, 1633, 1806, 1633, 1806, 1823, 1732, 1732, 1732, 1794,
167878 /* 360 */ 1840, 1840, 1823, 1732, 1738, 1732, 1794, 1732, 1732, 1701,
167879 /* 370 */ 1844, 1758, 1758, 1823, 1633, 1789, 1789, 1807, 1807, 1742,
167880 /* 380 */ 1752, 1877, 1633, 1743, 1742, 1759, 1765, 1677, 1879, 1897,
167881 /* 390 */ 1897, 1914, 1914, 1914, 2098, 2098, 2098, 2098, 2098, 2098,
167882 /* 400 */ 2098, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 207,
167883 /* 410 */ 1095, 331, 620, 903, 806, 1074, 1483, 1432, 1481, 1322,
167884 /* 420 */ 1370, 1394, 1515, 1291, 1546, 1547, 1557, 1595, 1598, 1599,
167885 /* 430 */ 1434, 1453, 1618, 1462, 1567, 1489, 1644, 1654, 1616, 1660,
167886 /* 440 */ 1548, 1549, 1682, 1685, 1597, 742, 1941, 1945, 1927, 1787,
167887 /* 450 */ 1937, 1940, 1934, 1936, 1821, 1810, 1832, 1938, 1938, 1942,
@@ -167894,11 +168322,11 @@
167894 /* 520 */ 1999, 1933, 1890, 2009, 2010, 1910, 2005, 2012, 1892, 2011,
167895 /* 530 */ 2006, 2007, 2008, 2013, 1950, 1962, 1957, 2014, 1969, 1952,
167896 /* 540 */ 2015, 2023, 2026, 2027, 2025, 2028, 2018, 1913, 1915, 2031,
167897 /* 550 */ 2011, 2033, 2036, 2037, 2038, 2039, 2040, 2043, 2051, 2044,
167898 /* 560 */ 2045, 2046, 2047, 2049, 2050, 2048, 1944, 1935, 1953, 1954,
167899 /* 570 */ 1956, 2052, 2055, 2053, 2073, 2074,
167900 };
167901 #define YY_REDUCE_COUNT (408)
167902 #define YY_REDUCE_MIN (-271)
167903 #define YY_REDUCE_MAX (1740)
167904 static const short yy_reduce_ofst[] = {
@@ -167943,68 +168371,68 @@
167943 /* 380 */ 1665, 1623, 1702, 1630, 1666, 1667, 1671, 1673, 1703, 1718,
167944 /* 390 */ 1719, 1729, 1730, 1731, 1621, 1622, 1628, 1720, 1713, 1716,
167945 /* 400 */ 1722, 1723, 1733, 1717, 1724, 1727, 1728, 1725, 1740,
167946 };
167947 static const YYACTIONTYPE yy_default[] = {
167948 /* 0 */ 1647, 1647, 1647, 1475, 1240, 1351, 1240, 1240, 1240, 1475,
167949 /* 10 */ 1475, 1475, 1240, 1381, 1381, 1528, 1273, 1240, 1240, 1240,
167950 /* 20 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1474, 1240, 1240,
167951 /* 30 */ 1240, 1240, 1563, 1563, 1240, 1240, 1240, 1240, 1240, 1240,
167952 /* 40 */ 1240, 1240, 1390, 1240, 1397, 1240, 1240, 1240, 1240, 1240,
167953 /* 50 */ 1476, 1477, 1240, 1240, 1240, 1527, 1529, 1492, 1404, 1403,
167954 /* 60 */ 1402, 1401, 1510, 1369, 1395, 1388, 1392, 1470, 1471, 1469,
167955 /* 70 */ 1473, 1477, 1476, 1240, 1391, 1438, 1454, 1437, 1240, 1240,
167956 /* 80 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167957 /* 90 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167958 /* 100 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167959 /* 110 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167960 /* 120 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167961 /* 130 */ 1446, 1453, 1452, 1451, 1460, 1450, 1447, 1440, 1439, 1441,
167962 /* 140 */ 1442, 1240, 1240, 1264, 1240, 1240, 1261, 1315, 1240, 1240,
167963 /* 150 */ 1240, 1240, 1240, 1547, 1546, 1240, 1443, 1240, 1273, 1432,
167964 /* 160 */ 1431, 1457, 1444, 1456, 1455, 1535, 1599, 1598, 1493, 1240,
167965 /* 170 */ 1240, 1240, 1240, 1240, 1240, 1563, 1240, 1240, 1240, 1240,
167966 /* 180 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167967 /* 190 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1371,
167968 /* 200 */ 1563, 1563, 1240, 1273, 1563, 1563, 1372, 1372, 1269, 1269,
167969 /* 210 */ 1375, 1240, 1542, 1342, 1342, 1342, 1342, 1351, 1342, 1240,
167970 /* 220 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167971 /* 230 */ 1240, 1240, 1240, 1240, 1532, 1530, 1240, 1240, 1240, 1240,
167972 /* 240 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167973 /* 250 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167974 /* 260 */ 1240, 1240, 1240, 1347, 1240, 1240, 1240, 1240, 1240, 1240,
167975 /* 270 */ 1240, 1240, 1240, 1240, 1240, 1592, 1240, 1505, 1329, 1347,
167976 /* 280 */ 1347, 1347, 1347, 1349, 1330, 1328, 1341, 1274, 1247, 1639,
167977 /* 290 */ 1407, 1396, 1348, 1396, 1636, 1394, 1407, 1407, 1394, 1407,
167978 /* 300 */ 1348, 1636, 1290, 1615, 1285, 1381, 1381, 1381, 1371, 1371,
167979 /* 310 */ 1371, 1371, 1375, 1375, 1472, 1348, 1341, 1240, 1639, 1639,
167980 /* 320 */ 1357, 1357, 1638, 1638, 1357, 1493, 1623, 1416, 1318, 1324,
167981 /* 330 */ 1324, 1324, 1324, 1357, 1258, 1394, 1623, 1623, 1394, 1416,
167982 /* 340 */ 1318, 1394, 1318, 1394, 1357, 1258, 1509, 1633, 1357, 1258,
167983 /* 350 */ 1483, 1357, 1258, 1357, 1258, 1483, 1316, 1316, 1316, 1305,
167984 /* 360 */ 1240, 1240, 1483, 1316, 1290, 1316, 1305, 1316, 1316, 1581,
167985 /* 370 */ 1240, 1487, 1487, 1483, 1357, 1573, 1573, 1384, 1384, 1389,
167986 /* 380 */ 1375, 1478, 1357, 1240, 1389, 1387, 1385, 1394, 1308, 1595,
167987 /* 390 */ 1595, 1591, 1591, 1591, 1644, 1644, 1542, 1608, 1273, 1273,
167988 /* 400 */ 1273, 1273, 1608, 1292, 1292, 1274, 1274, 1273, 1608, 1240,
167989 /* 410 */ 1240, 1240, 1240, 1240, 1240, 1603, 1240, 1537, 1494, 1361,
167990 /* 420 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167991 /* 430 */ 1240, 1240, 1240, 1240, 1548, 1240, 1240, 1240, 1240, 1240,
167992 /* 440 */ 1240, 1240, 1240, 1240, 1240, 1421, 1240, 1243, 1539, 1240,
167993 /* 450 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1398, 1399, 1362,
167994 /* 460 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1413, 1240, 1240,
167995 /* 470 */ 1240, 1408, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167996 /* 480 */ 1635, 1240, 1240, 1240, 1240, 1240, 1240, 1508, 1507, 1240,
167997 /* 490 */ 1240, 1359, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
167998 /* 500 */ 1240, 1240, 1240, 1240, 1240, 1288, 1240, 1240, 1240, 1240,
167999 /* 510 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
168000 /* 520 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1386,
168001 /* 530 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
168002 /* 540 */ 1240, 1240, 1240, 1240, 1578, 1376, 1240, 1240, 1240, 1240,
168003 /* 550 */ 1626, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240,
168004 /* 560 */ 1240, 1240, 1240, 1240, 1240, 1619, 1332, 1423, 1240, 1422,
168005 /* 570 */ 1426, 1262, 1240, 1252, 1240, 1240,
168006 };
168007 /********** End of lemon-generated parsing tables *****************************/
168008
168009 /* The next table maps tokens (terminal symbols) into fallback tokens.
168010 ** If a construct like the following:
@@ -168797,237 +169225,235 @@
168797 /* 173 */ "idlist_opt ::=",
168798 /* 174 */ "idlist_opt ::= LP idlist RP",
168799 /* 175 */ "idlist ::= idlist COMMA nm",
168800 /* 176 */ "idlist ::= nm",
168801 /* 177 */ "expr ::= LP expr RP",
168802 /* 178 */ "expr ::= ID|INDEXED",
168803 /* 179 */ "expr ::= JOIN_KW",
168804 /* 180 */ "expr ::= nm DOT nm",
168805 /* 181 */ "expr ::= nm DOT nm DOT nm",
168806 /* 182 */ "term ::= NULL|FLOAT|BLOB",
168807 /* 183 */ "term ::= STRING",
168808 /* 184 */ "term ::= INTEGER",
168809 /* 185 */ "expr ::= VARIABLE",
168810 /* 186 */ "expr ::= expr COLLATE ID|STRING",
168811 /* 187 */ "expr ::= CAST LP expr AS typetoken RP",
168812 /* 188 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
168813 /* 189 */ "expr ::= ID|INDEXED LP STAR RP",
168814 /* 190 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over",
168815 /* 191 */ "expr ::= ID|INDEXED LP STAR RP filter_over",
168816 /* 192 */ "term ::= CTIME_KW",
168817 /* 193 */ "expr ::= LP nexprlist COMMA expr RP",
168818 /* 194 */ "expr ::= expr AND expr",
168819 /* 195 */ "expr ::= expr OR expr",
168820 /* 196 */ "expr ::= expr LT|GT|GE|LE expr",
168821 /* 197 */ "expr ::= expr EQ|NE expr",
168822 /* 198 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
168823 /* 199 */ "expr ::= expr PLUS|MINUS expr",
168824 /* 200 */ "expr ::= expr STAR|SLASH|REM expr",
168825 /* 201 */ "expr ::= expr CONCAT expr",
168826 /* 202 */ "likeop ::= NOT LIKE_KW|MATCH",
168827 /* 203 */ "expr ::= expr likeop expr",
168828 /* 204 */ "expr ::= expr likeop expr ESCAPE expr",
168829 /* 205 */ "expr ::= expr ISNULL|NOTNULL",
168830 /* 206 */ "expr ::= expr NOT NULL",
168831 /* 207 */ "expr ::= expr IS expr",
168832 /* 208 */ "expr ::= expr IS NOT expr",
168833 /* 209 */ "expr ::= expr IS NOT DISTINCT FROM expr",
168834 /* 210 */ "expr ::= expr IS DISTINCT FROM expr",
168835 /* 211 */ "expr ::= NOT expr",
168836 /* 212 */ "expr ::= BITNOT expr",
168837 /* 213 */ "expr ::= PLUS|MINUS expr",
168838 /* 214 */ "expr ::= expr PTR expr",
168839 /* 215 */ "between_op ::= BETWEEN",
168840 /* 216 */ "between_op ::= NOT BETWEEN",
168841 /* 217 */ "expr ::= expr between_op expr AND expr",
168842 /* 218 */ "in_op ::= IN",
168843 /* 219 */ "in_op ::= NOT IN",
168844 /* 220 */ "expr ::= expr in_op LP exprlist RP",
168845 /* 221 */ "expr ::= LP select RP",
168846 /* 222 */ "expr ::= expr in_op LP select RP",
168847 /* 223 */ "expr ::= expr in_op nm dbnm paren_exprlist",
168848 /* 224 */ "expr ::= EXISTS LP select RP",
168849 /* 225 */ "expr ::= CASE case_operand case_exprlist case_else END",
168850 /* 226 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
168851 /* 227 */ "case_exprlist ::= WHEN expr THEN expr",
168852 /* 228 */ "case_else ::= ELSE expr",
168853 /* 229 */ "case_else ::=",
168854 /* 230 */ "case_operand ::= expr",
168855 /* 231 */ "case_operand ::=",
168856 /* 232 */ "exprlist ::=",
168857 /* 233 */ "nexprlist ::= nexprlist COMMA expr",
168858 /* 234 */ "nexprlist ::= expr",
168859 /* 235 */ "paren_exprlist ::=",
168860 /* 236 */ "paren_exprlist ::= LP exprlist RP",
168861 /* 237 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
168862 /* 238 */ "uniqueflag ::= UNIQUE",
168863 /* 239 */ "uniqueflag ::=",
168864 /* 240 */ "eidlist_opt ::=",
168865 /* 241 */ "eidlist_opt ::= LP eidlist RP",
168866 /* 242 */ "eidlist ::= eidlist COMMA nm collate sortorder",
168867 /* 243 */ "eidlist ::= nm collate sortorder",
168868 /* 244 */ "collate ::=",
168869 /* 245 */ "collate ::= COLLATE ID|STRING",
168870 /* 246 */ "cmd ::= DROP INDEX ifexists fullname",
168871 /* 247 */ "cmd ::= VACUUM vinto",
168872 /* 248 */ "cmd ::= VACUUM nm vinto",
168873 /* 249 */ "vinto ::= INTO expr",
168874 /* 250 */ "vinto ::=",
168875 /* 251 */ "cmd ::= PRAGMA nm dbnm",
168876 /* 252 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
168877 /* 253 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
168878 /* 254 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
168879 /* 255 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
168880 /* 256 */ "plus_num ::= PLUS INTEGER|FLOAT",
168881 /* 257 */ "minus_num ::= MINUS INTEGER|FLOAT",
168882 /* 258 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
168883 /* 259 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
168884 /* 260 */ "trigger_time ::= BEFORE|AFTER",
168885 /* 261 */ "trigger_time ::= INSTEAD OF",
168886 /* 262 */ "trigger_time ::=",
168887 /* 263 */ "trigger_event ::= DELETE|INSERT",
168888 /* 264 */ "trigger_event ::= UPDATE",
168889 /* 265 */ "trigger_event ::= UPDATE OF idlist",
168890 /* 266 */ "when_clause ::=",
168891 /* 267 */ "when_clause ::= WHEN expr",
168892 /* 268 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
168893 /* 269 */ "trigger_cmd_list ::= trigger_cmd SEMI",
168894 /* 270 */ "trnm ::= nm DOT nm",
168895 /* 271 */ "tridxby ::= INDEXED BY nm",
168896 /* 272 */ "tridxby ::= NOT INDEXED",
168897 /* 273 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
168898 /* 274 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
168899 /* 275 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
168900 /* 276 */ "trigger_cmd ::= scanpt select scanpt",
168901 /* 277 */ "expr ::= RAISE LP IGNORE RP",
168902 /* 278 */ "expr ::= RAISE LP raisetype COMMA nm RP",
168903 /* 279 */ "raisetype ::= ROLLBACK",
168904 /* 280 */ "raisetype ::= ABORT",
168905 /* 281 */ "raisetype ::= FAIL",
168906 /* 282 */ "cmd ::= DROP TRIGGER ifexists fullname",
168907 /* 283 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
168908 /* 284 */ "cmd ::= DETACH database_kw_opt expr",
168909 /* 285 */ "key_opt ::=",
168910 /* 286 */ "key_opt ::= KEY expr",
168911 /* 287 */ "cmd ::= REINDEX",
168912 /* 288 */ "cmd ::= REINDEX nm dbnm",
168913 /* 289 */ "cmd ::= ANALYZE",
168914 /* 290 */ "cmd ::= ANALYZE nm dbnm",
168915 /* 291 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
168916 /* 292 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
168917 /* 293 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
168918 /* 294 */ "add_column_fullname ::= fullname",
168919 /* 295 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
168920 /* 296 */ "cmd ::= create_vtab",
168921 /* 297 */ "cmd ::= create_vtab LP vtabarglist RP",
168922 /* 298 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
168923 /* 299 */ "vtabarg ::=",
168924 /* 300 */ "vtabargtoken ::= ANY",
168925 /* 301 */ "vtabargtoken ::= lp anylist RP",
168926 /* 302 */ "lp ::= LP",
168927 /* 303 */ "with ::= WITH wqlist",
168928 /* 304 */ "with ::= WITH RECURSIVE wqlist",
168929 /* 305 */ "wqas ::= AS",
168930 /* 306 */ "wqas ::= AS MATERIALIZED",
168931 /* 307 */ "wqas ::= AS NOT MATERIALIZED",
168932 /* 308 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
168933 /* 309 */ "wqlist ::= wqitem",
168934 /* 310 */ "wqlist ::= wqlist COMMA wqitem",
168935 /* 311 */ "windowdefn_list ::= windowdefn",
168936 /* 312 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
168937 /* 313 */ "windowdefn ::= nm AS LP window RP",
168938 /* 314 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
168939 /* 315 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
168940 /* 316 */ "window ::= ORDER BY sortlist frame_opt",
168941 /* 317 */ "window ::= nm ORDER BY sortlist frame_opt",
168942 /* 318 */ "window ::= frame_opt",
168943 /* 319 */ "window ::= nm frame_opt",
168944 /* 320 */ "frame_opt ::=",
168945 /* 321 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
168946 /* 322 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
168947 /* 323 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
168948 /* 324 */ "frame_bound_s ::= frame_bound",
168949 /* 325 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
168950 /* 326 */ "frame_bound_e ::= frame_bound",
168951 /* 327 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
168952 /* 328 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
168953 /* 329 */ "frame_bound ::= CURRENT ROW",
168954 /* 330 */ "frame_exclude_opt ::=",
168955 /* 331 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
168956 /* 332 */ "frame_exclude ::= NO OTHERS",
168957 /* 333 */ "frame_exclude ::= CURRENT ROW",
168958 /* 334 */ "frame_exclude ::= GROUP|TIES",
168959 /* 335 */ "window_clause ::= WINDOW windowdefn_list",
168960 /* 336 */ "filter_over ::= filter_clause over_clause",
168961 /* 337 */ "filter_over ::= over_clause",
168962 /* 338 */ "filter_over ::= filter_clause",
168963 /* 339 */ "over_clause ::= OVER LP window RP",
168964 /* 340 */ "over_clause ::= OVER nm",
168965 /* 341 */ "filter_clause ::= FILTER LP WHERE expr RP",
168966 /* 342 */ "input ::= cmdlist",
168967 /* 343 */ "cmdlist ::= cmdlist ecmd",
168968 /* 344 */ "cmdlist ::= ecmd",
168969 /* 345 */ "ecmd ::= SEMI",
168970 /* 346 */ "ecmd ::= cmdx SEMI",
168971 /* 347 */ "ecmd ::= explain cmdx SEMI",
168972 /* 348 */ "trans_opt ::=",
168973 /* 349 */ "trans_opt ::= TRANSACTION",
168974 /* 350 */ "trans_opt ::= TRANSACTION nm",
168975 /* 351 */ "savepoint_opt ::= SAVEPOINT",
168976 /* 352 */ "savepoint_opt ::=",
168977 /* 353 */ "cmd ::= create_table create_table_args",
168978 /* 354 */ "table_option_set ::= table_option",
168979 /* 355 */ "columnlist ::= columnlist COMMA columnname carglist",
168980 /* 356 */ "columnlist ::= columnname carglist",
168981 /* 357 */ "nm ::= ID|INDEXED",
168982 /* 358 */ "nm ::= STRING",
168983 /* 359 */ "nm ::= JOIN_KW",
168984 /* 360 */ "typetoken ::= typename",
168985 /* 361 */ "typename ::= ID|STRING",
168986 /* 362 */ "signed ::= plus_num",
168987 /* 363 */ "signed ::= minus_num",
168988 /* 364 */ "carglist ::= carglist ccons",
168989 /* 365 */ "carglist ::=",
168990 /* 366 */ "ccons ::= NULL onconf",
168991 /* 367 */ "ccons ::= GENERATED ALWAYS AS generated",
168992 /* 368 */ "ccons ::= AS generated",
168993 /* 369 */ "conslist_opt ::= COMMA conslist",
168994 /* 370 */ "conslist ::= conslist tconscomma tcons",
168995 /* 371 */ "conslist ::= tcons",
168996 /* 372 */ "tconscomma ::=",
168997 /* 373 */ "defer_subclause_opt ::= defer_subclause",
168998 /* 374 */ "resolvetype ::= raisetype",
168999 /* 375 */ "selectnowith ::= oneselect",
169000 /* 376 */ "oneselect ::= values",
169001 /* 377 */ "sclp ::= selcollist COMMA",
169002 /* 378 */ "as ::= ID|STRING",
169003 /* 379 */ "indexed_opt ::= indexed_by",
169004 /* 380 */ "returning ::=",
169005 /* 381 */ "expr ::= term",
169006 /* 382 */ "likeop ::= LIKE_KW|MATCH",
169007 /* 383 */ "exprlist ::= nexprlist",
169008 /* 384 */ "nmnum ::= plus_num",
169009 /* 385 */ "nmnum ::= nm",
169010 /* 386 */ "nmnum ::= ON",
169011 /* 387 */ "nmnum ::= DELETE",
169012 /* 388 */ "nmnum ::= DEFAULT",
169013 /* 389 */ "plus_num ::= INTEGER|FLOAT",
169014 /* 390 */ "foreach_clause ::=",
169015 /* 391 */ "foreach_clause ::= FOR EACH ROW",
169016 /* 392 */ "trnm ::= nm",
169017 /* 393 */ "tridxby ::=",
169018 /* 394 */ "database_kw_opt ::= DATABASE",
169019 /* 395 */ "database_kw_opt ::=",
169020 /* 396 */ "kwcolumn_opt ::=",
169021 /* 397 */ "kwcolumn_opt ::= COLUMNKW",
169022 /* 398 */ "vtabarglist ::= vtabarg",
169023 /* 399 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
169024 /* 400 */ "vtabarg ::= vtabarg vtabargtoken",
169025 /* 401 */ "anylist ::=",
169026 /* 402 */ "anylist ::= anylist LP anylist RP",
169027 /* 403 */ "anylist ::= anylist ANY",
169028 /* 404 */ "with ::=",
169029 };
169030 #endif /* NDEBUG */
169031
169032
169033 #if YYSTACKDEPTH<=0
@@ -169708,237 +170134,235 @@
169708 270, /* (173) idlist_opt ::= */
169709 270, /* (174) idlist_opt ::= LP idlist RP */
169710 263, /* (175) idlist ::= idlist COMMA nm */
169711 263, /* (176) idlist ::= nm */
169712 217, /* (177) expr ::= LP expr RP */
169713 217, /* (178) expr ::= ID|INDEXED */
169714 217, /* (179) expr ::= JOIN_KW */
169715 217, /* (180) expr ::= nm DOT nm */
169716 217, /* (181) expr ::= nm DOT nm DOT nm */
169717 216, /* (182) term ::= NULL|FLOAT|BLOB */
169718 216, /* (183) term ::= STRING */
169719 216, /* (184) term ::= INTEGER */
169720 217, /* (185) expr ::= VARIABLE */
169721 217, /* (186) expr ::= expr COLLATE ID|STRING */
169722 217, /* (187) expr ::= CAST LP expr AS typetoken RP */
169723 217, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */
169724 217, /* (189) expr ::= ID|INDEXED LP STAR RP */
169725 217, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
169726 217, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */
169727 216, /* (192) term ::= CTIME_KW */
169728 217, /* (193) expr ::= LP nexprlist COMMA expr RP */
169729 217, /* (194) expr ::= expr AND expr */
169730 217, /* (195) expr ::= expr OR expr */
169731 217, /* (196) expr ::= expr LT|GT|GE|LE expr */
169732 217, /* (197) expr ::= expr EQ|NE expr */
169733 217, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
169734 217, /* (199) expr ::= expr PLUS|MINUS expr */
169735 217, /* (200) expr ::= expr STAR|SLASH|REM expr */
169736 217, /* (201) expr ::= expr CONCAT expr */
169737 274, /* (202) likeop ::= NOT LIKE_KW|MATCH */
169738 217, /* (203) expr ::= expr likeop expr */
169739 217, /* (204) expr ::= expr likeop expr ESCAPE expr */
169740 217, /* (205) expr ::= expr ISNULL|NOTNULL */
169741 217, /* (206) expr ::= expr NOT NULL */
169742 217, /* (207) expr ::= expr IS expr */
169743 217, /* (208) expr ::= expr IS NOT expr */
169744 217, /* (209) expr ::= expr IS NOT DISTINCT FROM expr */
169745 217, /* (210) expr ::= expr IS DISTINCT FROM expr */
169746 217, /* (211) expr ::= NOT expr */
169747 217, /* (212) expr ::= BITNOT expr */
169748 217, /* (213) expr ::= PLUS|MINUS expr */
169749 217, /* (214) expr ::= expr PTR expr */
169750 275, /* (215) between_op ::= BETWEEN */
169751 275, /* (216) between_op ::= NOT BETWEEN */
169752 217, /* (217) expr ::= expr between_op expr AND expr */
169753 276, /* (218) in_op ::= IN */
169754 276, /* (219) in_op ::= NOT IN */
169755 217, /* (220) expr ::= expr in_op LP exprlist RP */
169756 217, /* (221) expr ::= LP select RP */
169757 217, /* (222) expr ::= expr in_op LP select RP */
169758 217, /* (223) expr ::= expr in_op nm dbnm paren_exprlist */
169759 217, /* (224) expr ::= EXISTS LP select RP */
169760 217, /* (225) expr ::= CASE case_operand case_exprlist case_else END */
169761 279, /* (226) case_exprlist ::= case_exprlist WHEN expr THEN expr */
169762 279, /* (227) case_exprlist ::= WHEN expr THEN expr */
169763 280, /* (228) case_else ::= ELSE expr */
169764 280, /* (229) case_else ::= */
169765 278, /* (230) case_operand ::= expr */
169766 278, /* (231) case_operand ::= */
169767 261, /* (232) exprlist ::= */
169768 253, /* (233) nexprlist ::= nexprlist COMMA expr */
169769 253, /* (234) nexprlist ::= expr */
169770 277, /* (235) paren_exprlist ::= */
169771 277, /* (236) paren_exprlist ::= LP exprlist RP */
169772 190, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
169773 281, /* (238) uniqueflag ::= UNIQUE */
169774 281, /* (239) uniqueflag ::= */
169775 221, /* (240) eidlist_opt ::= */
169776 221, /* (241) eidlist_opt ::= LP eidlist RP */
169777 232, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */
169778 232, /* (243) eidlist ::= nm collate sortorder */
169779 282, /* (244) collate ::= */
169780 282, /* (245) collate ::= COLLATE ID|STRING */
169781 190, /* (246) cmd ::= DROP INDEX ifexists fullname */
169782 190, /* (247) cmd ::= VACUUM vinto */
169783 190, /* (248) cmd ::= VACUUM nm vinto */
169784 283, /* (249) vinto ::= INTO expr */
169785 283, /* (250) vinto ::= */
169786 190, /* (251) cmd ::= PRAGMA nm dbnm */
169787 190, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */
169788 190, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */
169789 190, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */
169790 190, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */
169791 211, /* (256) plus_num ::= PLUS INTEGER|FLOAT */
169792 212, /* (257) minus_num ::= MINUS INTEGER|FLOAT */
169793 190, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
169794 285, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
169795 287, /* (260) trigger_time ::= BEFORE|AFTER */
169796 287, /* (261) trigger_time ::= INSTEAD OF */
169797 287, /* (262) trigger_time ::= */
169798 288, /* (263) trigger_event ::= DELETE|INSERT */
169799 288, /* (264) trigger_event ::= UPDATE */
169800 288, /* (265) trigger_event ::= UPDATE OF idlist */
169801 290, /* (266) when_clause ::= */
169802 290, /* (267) when_clause ::= WHEN expr */
169803 286, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
169804 286, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */
169805 292, /* (270) trnm ::= nm DOT nm */
169806 293, /* (271) tridxby ::= INDEXED BY nm */
169807 293, /* (272) tridxby ::= NOT INDEXED */
169808 291, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
169809 291, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
169810 291, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
169811 291, /* (276) trigger_cmd ::= scanpt select scanpt */
169812 217, /* (277) expr ::= RAISE LP IGNORE RP */
169813 217, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */
169814 236, /* (279) raisetype ::= ROLLBACK */
169815 236, /* (280) raisetype ::= ABORT */
169816 236, /* (281) raisetype ::= FAIL */
169817 190, /* (282) cmd ::= DROP TRIGGER ifexists fullname */
169818 190, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
169819 190, /* (284) cmd ::= DETACH database_kw_opt expr */
169820 295, /* (285) key_opt ::= */
169821 295, /* (286) key_opt ::= KEY expr */
169822 190, /* (287) cmd ::= REINDEX */
169823 190, /* (288) cmd ::= REINDEX nm dbnm */
169824 190, /* (289) cmd ::= ANALYZE */
169825 190, /* (290) cmd ::= ANALYZE nm dbnm */
169826 190, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */
169827 190, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
169828 190, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
169829 296, /* (294) add_column_fullname ::= fullname */
169830 190, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
169831 190, /* (296) cmd ::= create_vtab */
169832 190, /* (297) cmd ::= create_vtab LP vtabarglist RP */
169833 298, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
169834 300, /* (299) vtabarg ::= */
169835 301, /* (300) vtabargtoken ::= ANY */
169836 301, /* (301) vtabargtoken ::= lp anylist RP */
169837 302, /* (302) lp ::= LP */
169838 266, /* (303) with ::= WITH wqlist */
169839 266, /* (304) with ::= WITH RECURSIVE wqlist */
169840 305, /* (305) wqas ::= AS */
169841 305, /* (306) wqas ::= AS MATERIALIZED */
169842 305, /* (307) wqas ::= AS NOT MATERIALIZED */
169843 304, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */
169844 241, /* (309) wqlist ::= wqitem */
169845 241, /* (310) wqlist ::= wqlist COMMA wqitem */
169846 306, /* (311) windowdefn_list ::= windowdefn */
169847 306, /* (312) windowdefn_list ::= windowdefn_list COMMA windowdefn */
169848 307, /* (313) windowdefn ::= nm AS LP window RP */
169849 308, /* (314) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
169850 308, /* (315) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
169851 308, /* (316) window ::= ORDER BY sortlist frame_opt */
169852 308, /* (317) window ::= nm ORDER BY sortlist frame_opt */
169853 308, /* (318) window ::= frame_opt */
169854 308, /* (319) window ::= nm frame_opt */
169855 309, /* (320) frame_opt ::= */
169856 309, /* (321) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
169857 309, /* (322) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
169858 313, /* (323) range_or_rows ::= RANGE|ROWS|GROUPS */
169859 315, /* (324) frame_bound_s ::= frame_bound */
169860 315, /* (325) frame_bound_s ::= UNBOUNDED PRECEDING */
169861 316, /* (326) frame_bound_e ::= frame_bound */
169862 316, /* (327) frame_bound_e ::= UNBOUNDED FOLLOWING */
169863 314, /* (328) frame_bound ::= expr PRECEDING|FOLLOWING */
169864 314, /* (329) frame_bound ::= CURRENT ROW */
169865 317, /* (330) frame_exclude_opt ::= */
169866 317, /* (331) frame_exclude_opt ::= EXCLUDE frame_exclude */
169867 318, /* (332) frame_exclude ::= NO OTHERS */
169868 318, /* (333) frame_exclude ::= CURRENT ROW */
169869 318, /* (334) frame_exclude ::= GROUP|TIES */
169870 251, /* (335) window_clause ::= WINDOW windowdefn_list */
169871 273, /* (336) filter_over ::= filter_clause over_clause */
169872 273, /* (337) filter_over ::= over_clause */
169873 273, /* (338) filter_over ::= filter_clause */
169874 312, /* (339) over_clause ::= OVER LP window RP */
169875 312, /* (340) over_clause ::= OVER nm */
169876 311, /* (341) filter_clause ::= FILTER LP WHERE expr RP */
169877 185, /* (342) input ::= cmdlist */
169878 186, /* (343) cmdlist ::= cmdlist ecmd */
169879 186, /* (344) cmdlist ::= ecmd */
169880 187, /* (345) ecmd ::= SEMI */
169881 187, /* (346) ecmd ::= cmdx SEMI */
169882 187, /* (347) ecmd ::= explain cmdx SEMI */
169883 192, /* (348) trans_opt ::= */
169884 192, /* (349) trans_opt ::= TRANSACTION */
169885 192, /* (350) trans_opt ::= TRANSACTION nm */
169886 194, /* (351) savepoint_opt ::= SAVEPOINT */
169887 194, /* (352) savepoint_opt ::= */
169888 190, /* (353) cmd ::= create_table create_table_args */
169889 203, /* (354) table_option_set ::= table_option */
169890 201, /* (355) columnlist ::= columnlist COMMA columnname carglist */
169891 201, /* (356) columnlist ::= columnname carglist */
169892 193, /* (357) nm ::= ID|INDEXED */
169893 193, /* (358) nm ::= STRING */
169894 193, /* (359) nm ::= JOIN_KW */
169895 208, /* (360) typetoken ::= typename */
169896 209, /* (361) typename ::= ID|STRING */
169897 210, /* (362) signed ::= plus_num */
169898 210, /* (363) signed ::= minus_num */
169899 207, /* (364) carglist ::= carglist ccons */
169900 207, /* (365) carglist ::= */
169901 215, /* (366) ccons ::= NULL onconf */
169902 215, /* (367) ccons ::= GENERATED ALWAYS AS generated */
169903 215, /* (368) ccons ::= AS generated */
169904 202, /* (369) conslist_opt ::= COMMA conslist */
169905 228, /* (370) conslist ::= conslist tconscomma tcons */
169906 228, /* (371) conslist ::= tcons */
169907 229, /* (372) tconscomma ::= */
169908 233, /* (373) defer_subclause_opt ::= defer_subclause */
169909 235, /* (374) resolvetype ::= raisetype */
169910 239, /* (375) selectnowith ::= oneselect */
169911 240, /* (376) oneselect ::= values */
169912 254, /* (377) sclp ::= selcollist COMMA */
169913 255, /* (378) as ::= ID|STRING */
169914 264, /* (379) indexed_opt ::= indexed_by */
169915 272, /* (380) returning ::= */
169916 217, /* (381) expr ::= term */
169917 274, /* (382) likeop ::= LIKE_KW|MATCH */
169918 261, /* (383) exprlist ::= nexprlist */
169919 284, /* (384) nmnum ::= plus_num */
169920 284, /* (385) nmnum ::= nm */
169921 284, /* (386) nmnum ::= ON */
169922 284, /* (387) nmnum ::= DELETE */
169923 284, /* (388) nmnum ::= DEFAULT */
169924 211, /* (389) plus_num ::= INTEGER|FLOAT */
169925 289, /* (390) foreach_clause ::= */
169926 289, /* (391) foreach_clause ::= FOR EACH ROW */
169927 292, /* (392) trnm ::= nm */
169928 293, /* (393) tridxby ::= */
169929 294, /* (394) database_kw_opt ::= DATABASE */
169930 294, /* (395) database_kw_opt ::= */
169931 297, /* (396) kwcolumn_opt ::= */
169932 297, /* (397) kwcolumn_opt ::= COLUMNKW */
169933 299, /* (398) vtabarglist ::= vtabarg */
169934 299, /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */
169935 300, /* (400) vtabarg ::= vtabarg vtabargtoken */
169936 303, /* (401) anylist ::= */
169937 303, /* (402) anylist ::= anylist LP anylist RP */
169938 303, /* (403) anylist ::= anylist ANY */
169939 266, /* (404) with ::= */
169940 };
169941
169942 /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
169943 ** of symbols on the right-hand side of that rule. */
169944 static const signed char yyRuleInfoNRhs[] = {
@@ -170118,237 +170542,235 @@
170118 0, /* (173) idlist_opt ::= */
170119 -3, /* (174) idlist_opt ::= LP idlist RP */
170120 -3, /* (175) idlist ::= idlist COMMA nm */
170121 -1, /* (176) idlist ::= nm */
170122 -3, /* (177) expr ::= LP expr RP */
170123 -1, /* (178) expr ::= ID|INDEXED */
170124 -1, /* (179) expr ::= JOIN_KW */
170125 -3, /* (180) expr ::= nm DOT nm */
170126 -5, /* (181) expr ::= nm DOT nm DOT nm */
170127 -1, /* (182) term ::= NULL|FLOAT|BLOB */
170128 -1, /* (183) term ::= STRING */
170129 -1, /* (184) term ::= INTEGER */
170130 -1, /* (185) expr ::= VARIABLE */
170131 -3, /* (186) expr ::= expr COLLATE ID|STRING */
170132 -6, /* (187) expr ::= CAST LP expr AS typetoken RP */
170133 -5, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */
170134 -4, /* (189) expr ::= ID|INDEXED LP STAR RP */
170135 -6, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
170136 -5, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */
170137 -1, /* (192) term ::= CTIME_KW */
170138 -5, /* (193) expr ::= LP nexprlist COMMA expr RP */
170139 -3, /* (194) expr ::= expr AND expr */
170140 -3, /* (195) expr ::= expr OR expr */
170141 -3, /* (196) expr ::= expr LT|GT|GE|LE expr */
170142 -3, /* (197) expr ::= expr EQ|NE expr */
170143 -3, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
170144 -3, /* (199) expr ::= expr PLUS|MINUS expr */
170145 -3, /* (200) expr ::= expr STAR|SLASH|REM expr */
170146 -3, /* (201) expr ::= expr CONCAT expr */
170147 -2, /* (202) likeop ::= NOT LIKE_KW|MATCH */
170148 -3, /* (203) expr ::= expr likeop expr */
170149 -5, /* (204) expr ::= expr likeop expr ESCAPE expr */
170150 -2, /* (205) expr ::= expr ISNULL|NOTNULL */
170151 -3, /* (206) expr ::= expr NOT NULL */
170152 -3, /* (207) expr ::= expr IS expr */
170153 -4, /* (208) expr ::= expr IS NOT expr */
170154 -6, /* (209) expr ::= expr IS NOT DISTINCT FROM expr */
170155 -5, /* (210) expr ::= expr IS DISTINCT FROM expr */
170156 -2, /* (211) expr ::= NOT expr */
170157 -2, /* (212) expr ::= BITNOT expr */
170158 -2, /* (213) expr ::= PLUS|MINUS expr */
170159 -3, /* (214) expr ::= expr PTR expr */
170160 -1, /* (215) between_op ::= BETWEEN */
170161 -2, /* (216) between_op ::= NOT BETWEEN */
170162 -5, /* (217) expr ::= expr between_op expr AND expr */
170163 -1, /* (218) in_op ::= IN */
170164 -2, /* (219) in_op ::= NOT IN */
170165 -5, /* (220) expr ::= expr in_op LP exprlist RP */
170166 -3, /* (221) expr ::= LP select RP */
170167 -5, /* (222) expr ::= expr in_op LP select RP */
170168 -5, /* (223) expr ::= expr in_op nm dbnm paren_exprlist */
170169 -4, /* (224) expr ::= EXISTS LP select RP */
170170 -5, /* (225) expr ::= CASE case_operand case_exprlist case_else END */
170171 -5, /* (226) case_exprlist ::= case_exprlist WHEN expr THEN expr */
170172 -4, /* (227) case_exprlist ::= WHEN expr THEN expr */
170173 -2, /* (228) case_else ::= ELSE expr */
170174 0, /* (229) case_else ::= */
170175 -1, /* (230) case_operand ::= expr */
170176 0, /* (231) case_operand ::= */
170177 0, /* (232) exprlist ::= */
170178 -3, /* (233) nexprlist ::= nexprlist COMMA expr */
170179 -1, /* (234) nexprlist ::= expr */
170180 0, /* (235) paren_exprlist ::= */
170181 -3, /* (236) paren_exprlist ::= LP exprlist RP */
170182 -12, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
170183 -1, /* (238) uniqueflag ::= UNIQUE */
170184 0, /* (239) uniqueflag ::= */
170185 0, /* (240) eidlist_opt ::= */
170186 -3, /* (241) eidlist_opt ::= LP eidlist RP */
170187 -5, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */
170188 -3, /* (243) eidlist ::= nm collate sortorder */
170189 0, /* (244) collate ::= */
170190 -2, /* (245) collate ::= COLLATE ID|STRING */
170191 -4, /* (246) cmd ::= DROP INDEX ifexists fullname */
170192 -2, /* (247) cmd ::= VACUUM vinto */
170193 -3, /* (248) cmd ::= VACUUM nm vinto */
170194 -2, /* (249) vinto ::= INTO expr */
170195 0, /* (250) vinto ::= */
170196 -3, /* (251) cmd ::= PRAGMA nm dbnm */
170197 -5, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */
170198 -6, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */
170199 -5, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */
170200 -6, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */
170201 -2, /* (256) plus_num ::= PLUS INTEGER|FLOAT */
170202 -2, /* (257) minus_num ::= MINUS INTEGER|FLOAT */
170203 -5, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
170204 -11, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
170205 -1, /* (260) trigger_time ::= BEFORE|AFTER */
170206 -2, /* (261) trigger_time ::= INSTEAD OF */
170207 0, /* (262) trigger_time ::= */
170208 -1, /* (263) trigger_event ::= DELETE|INSERT */
170209 -1, /* (264) trigger_event ::= UPDATE */
170210 -3, /* (265) trigger_event ::= UPDATE OF idlist */
170211 0, /* (266) when_clause ::= */
170212 -2, /* (267) when_clause ::= WHEN expr */
170213 -3, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
170214 -2, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */
170215 -3, /* (270) trnm ::= nm DOT nm */
170216 -3, /* (271) tridxby ::= INDEXED BY nm */
170217 -2, /* (272) tridxby ::= NOT INDEXED */
170218 -9, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
170219 -8, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
170220 -6, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
170221 -3, /* (276) trigger_cmd ::= scanpt select scanpt */
170222 -4, /* (277) expr ::= RAISE LP IGNORE RP */
170223 -6, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */
170224 -1, /* (279) raisetype ::= ROLLBACK */
170225 -1, /* (280) raisetype ::= ABORT */
170226 -1, /* (281) raisetype ::= FAIL */
170227 -4, /* (282) cmd ::= DROP TRIGGER ifexists fullname */
170228 -6, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
170229 -3, /* (284) cmd ::= DETACH database_kw_opt expr */
170230 0, /* (285) key_opt ::= */
170231 -2, /* (286) key_opt ::= KEY expr */
170232 -1, /* (287) cmd ::= REINDEX */
170233 -3, /* (288) cmd ::= REINDEX nm dbnm */
170234 -1, /* (289) cmd ::= ANALYZE */
170235 -3, /* (290) cmd ::= ANALYZE nm dbnm */
170236 -6, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */
170237 -7, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
170238 -6, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
170239 -1, /* (294) add_column_fullname ::= fullname */
170240 -8, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
170241 -1, /* (296) cmd ::= create_vtab */
170242 -4, /* (297) cmd ::= create_vtab LP vtabarglist RP */
170243 -8, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
170244 0, /* (299) vtabarg ::= */
170245 -1, /* (300) vtabargtoken ::= ANY */
170246 -3, /* (301) vtabargtoken ::= lp anylist RP */
170247 -1, /* (302) lp ::= LP */
170248 -2, /* (303) with ::= WITH wqlist */
170249 -3, /* (304) with ::= WITH RECURSIVE wqlist */
170250 -1, /* (305) wqas ::= AS */
170251 -2, /* (306) wqas ::= AS MATERIALIZED */
170252 -3, /* (307) wqas ::= AS NOT MATERIALIZED */
170253 -6, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */
170254 -1, /* (309) wqlist ::= wqitem */
170255 -3, /* (310) wqlist ::= wqlist COMMA wqitem */
170256 -1, /* (311) windowdefn_list ::= windowdefn */
170257 -3, /* (312) windowdefn_list ::= windowdefn_list COMMA windowdefn */
170258 -5, /* (313) windowdefn ::= nm AS LP window RP */
170259 -5, /* (314) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
170260 -6, /* (315) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
170261 -4, /* (316) window ::= ORDER BY sortlist frame_opt */
170262 -5, /* (317) window ::= nm ORDER BY sortlist frame_opt */
170263 -1, /* (318) window ::= frame_opt */
170264 -2, /* (319) window ::= nm frame_opt */
170265 0, /* (320) frame_opt ::= */
170266 -3, /* (321) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
170267 -6, /* (322) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
170268 -1, /* (323) range_or_rows ::= RANGE|ROWS|GROUPS */
170269 -1, /* (324) frame_bound_s ::= frame_bound */
170270 -2, /* (325) frame_bound_s ::= UNBOUNDED PRECEDING */
170271 -1, /* (326) frame_bound_e ::= frame_bound */
170272 -2, /* (327) frame_bound_e ::= UNBOUNDED FOLLOWING */
170273 -2, /* (328) frame_bound ::= expr PRECEDING|FOLLOWING */
170274 -2, /* (329) frame_bound ::= CURRENT ROW */
170275 0, /* (330) frame_exclude_opt ::= */
170276 -2, /* (331) frame_exclude_opt ::= EXCLUDE frame_exclude */
170277 -2, /* (332) frame_exclude ::= NO OTHERS */
170278 -2, /* (333) frame_exclude ::= CURRENT ROW */
170279 -1, /* (334) frame_exclude ::= GROUP|TIES */
170280 -2, /* (335) window_clause ::= WINDOW windowdefn_list */
170281 -2, /* (336) filter_over ::= filter_clause over_clause */
170282 -1, /* (337) filter_over ::= over_clause */
170283 -1, /* (338) filter_over ::= filter_clause */
170284 -4, /* (339) over_clause ::= OVER LP window RP */
170285 -2, /* (340) over_clause ::= OVER nm */
170286 -5, /* (341) filter_clause ::= FILTER LP WHERE expr RP */
170287 -1, /* (342) input ::= cmdlist */
170288 -2, /* (343) cmdlist ::= cmdlist ecmd */
170289 -1, /* (344) cmdlist ::= ecmd */
170290 -1, /* (345) ecmd ::= SEMI */
170291 -2, /* (346) ecmd ::= cmdx SEMI */
170292 -3, /* (347) ecmd ::= explain cmdx SEMI */
170293 0, /* (348) trans_opt ::= */
170294 -1, /* (349) trans_opt ::= TRANSACTION */
170295 -2, /* (350) trans_opt ::= TRANSACTION nm */
170296 -1, /* (351) savepoint_opt ::= SAVEPOINT */
170297 0, /* (352) savepoint_opt ::= */
170298 -2, /* (353) cmd ::= create_table create_table_args */
170299 -1, /* (354) table_option_set ::= table_option */
170300 -4, /* (355) columnlist ::= columnlist COMMA columnname carglist */
170301 -2, /* (356) columnlist ::= columnname carglist */
170302 -1, /* (357) nm ::= ID|INDEXED */
170303 -1, /* (358) nm ::= STRING */
170304 -1, /* (359) nm ::= JOIN_KW */
170305 -1, /* (360) typetoken ::= typename */
170306 -1, /* (361) typename ::= ID|STRING */
170307 -1, /* (362) signed ::= plus_num */
170308 -1, /* (363) signed ::= minus_num */
170309 -2, /* (364) carglist ::= carglist ccons */
170310 0, /* (365) carglist ::= */
170311 -2, /* (366) ccons ::= NULL onconf */
170312 -4, /* (367) ccons ::= GENERATED ALWAYS AS generated */
170313 -2, /* (368) ccons ::= AS generated */
170314 -2, /* (369) conslist_opt ::= COMMA conslist */
170315 -3, /* (370) conslist ::= conslist tconscomma tcons */
170316 -1, /* (371) conslist ::= tcons */
170317 0, /* (372) tconscomma ::= */
170318 -1, /* (373) defer_subclause_opt ::= defer_subclause */
170319 -1, /* (374) resolvetype ::= raisetype */
170320 -1, /* (375) selectnowith ::= oneselect */
170321 -1, /* (376) oneselect ::= values */
170322 -2, /* (377) sclp ::= selcollist COMMA */
170323 -1, /* (378) as ::= ID|STRING */
170324 -1, /* (379) indexed_opt ::= indexed_by */
170325 0, /* (380) returning ::= */
170326 -1, /* (381) expr ::= term */
170327 -1, /* (382) likeop ::= LIKE_KW|MATCH */
170328 -1, /* (383) exprlist ::= nexprlist */
170329 -1, /* (384) nmnum ::= plus_num */
170330 -1, /* (385) nmnum ::= nm */
170331 -1, /* (386) nmnum ::= ON */
170332 -1, /* (387) nmnum ::= DELETE */
170333 -1, /* (388) nmnum ::= DEFAULT */
170334 -1, /* (389) plus_num ::= INTEGER|FLOAT */
170335 0, /* (390) foreach_clause ::= */
170336 -3, /* (391) foreach_clause ::= FOR EACH ROW */
170337 -1, /* (392) trnm ::= nm */
170338 0, /* (393) tridxby ::= */
170339 -1, /* (394) database_kw_opt ::= DATABASE */
170340 0, /* (395) database_kw_opt ::= */
170341 0, /* (396) kwcolumn_opt ::= */
170342 -1, /* (397) kwcolumn_opt ::= COLUMNKW */
170343 -1, /* (398) vtabarglist ::= vtabarg */
170344 -3, /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */
170345 -2, /* (400) vtabarg ::= vtabarg vtabargtoken */
170346 0, /* (401) anylist ::= */
170347 -4, /* (402) anylist ::= anylist LP anylist RP */
170348 -2, /* (403) anylist ::= anylist ANY */
170349 0, /* (404) with ::= */
170350 };
170351
170352 static void yy_accept(yyParser*); /* Forward Declaration */
170353
170354 /*
@@ -170404,11 +170826,11 @@
170404 {yymsp[1].minor.yy394 = TK_DEFERRED;}
170405 break;
170406 case 5: /* transtype ::= DEFERRED */
170407 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
170408 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
170409 case 323: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==323);
170410 {yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/}
170411 break;
170412 case 8: /* cmd ::= COMMIT|END trans_opt */
170413 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
170414 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
@@ -170441,11 +170863,11 @@
170441 case 47: /* autoinc ::= */ yytestcase(yyruleno==47);
170442 case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
170443 case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
170444 case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
170445 case 98: /* distinct ::= */ yytestcase(yyruleno==98);
170446 case 244: /* collate ::= */ yytestcase(yyruleno==244);
170447 {yymsp[1].minor.yy394 = 0;}
170448 break;
170449 case 16: /* ifnotexists ::= IF NOT EXISTS */
170450 {yymsp[-2].minor.yy394 = 1;}
170451 break;
@@ -170625,13 +171047,13 @@
170625 case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171);
170626 {yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;}
170627 break;
170628 case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
170629 case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
170630 case 216: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==216);
170631 case 219: /* in_op ::= NOT IN */ yytestcase(yyruleno==219);
170632 case 245: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==245);
170633 {yymsp[-1].minor.yy394 = 1;}
170634 break;
170635 case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
170636 {yymsp[-1].minor.yy394 = 0;}
170637 break;
@@ -170777,13 +171199,13 @@
170777 {yymsp[0].minor.yy394 = SF_All;}
170778 break;
170779 case 99: /* sclp ::= */
170780 case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132);
170781 case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142);
170782 case 232: /* exprlist ::= */ yytestcase(yyruleno==232);
170783 case 235: /* paren_exprlist ::= */ yytestcase(yyruleno==235);
170784 case 240: /* eidlist_opt ::= */ yytestcase(yyruleno==240);
170785 {yymsp[1].minor.yy322 = 0;}
170786 break;
170787 case 100: /* selcollist ::= sclp scanpt expr scanpt as */
170788 {
170789 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
@@ -170805,12 +171227,12 @@
170805 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot);
170806 }
170807 break;
170808 case 103: /* as ::= AS nm */
170809 case 115: /* dbnm ::= DOT nm */ yytestcase(yyruleno==115);
170810 case 256: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==256);
170811 case 257: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==257);
170812 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
170813 break;
170814 case 105: /* from ::= */
170815 case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108);
170816 {yymsp[1].minor.yy131 = 0;}
@@ -170978,20 +171400,20 @@
170978 break;
170979 case 144: /* having_opt ::= */
170980 case 146: /* limit_opt ::= */ yytestcase(yyruleno==146);
170981 case 151: /* where_opt ::= */ yytestcase(yyruleno==151);
170982 case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153);
170983 case 229: /* case_else ::= */ yytestcase(yyruleno==229);
170984 case 231: /* case_operand ::= */ yytestcase(yyruleno==231);
170985 case 250: /* vinto ::= */ yytestcase(yyruleno==250);
170986 {yymsp[1].minor.yy528 = 0;}
170987 break;
170988 case 145: /* having_opt ::= HAVING expr */
170989 case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152);
170990 case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154);
170991 case 228: /* case_else ::= ELSE expr */ yytestcase(yyruleno==228);
170992 case 249: /* vinto ::= INTO expr */ yytestcase(yyruleno==249);
170993 {yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;}
170994 break;
170995 case 147: /* limit_opt ::= LIMIT expr */
170996 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);}
170997 break;
@@ -171099,23 +171521,22 @@
171099 {yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
171100 break;
171101 case 177: /* expr ::= LP expr RP */
171102 {yymsp[-2].minor.yy528 = yymsp[-1].minor.yy528;}
171103 break;
171104 case 178: /* expr ::= ID|INDEXED */
171105 case 179: /* expr ::= JOIN_KW */ yytestcase(yyruleno==179);
171106 {yymsp[0].minor.yy528=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
171107 break;
171108 case 180: /* expr ::= nm DOT nm */
171109 {
171110 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
171111 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
171112 yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
171113 }
171114 yymsp[-2].minor.yy528 = yylhsminor.yy528;
171115 break;
171116 case 181: /* expr ::= nm DOT nm DOT nm */
171117 {
171118 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0);
171119 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
171120 Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
171121 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
@@ -171124,22 +171545,22 @@
171124 }
171125 yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
171126 }
171127 yymsp[-4].minor.yy528 = yylhsminor.yy528;
171128 break;
171129 case 182: /* term ::= NULL|FLOAT|BLOB */
171130 case 183: /* term ::= STRING */ yytestcase(yyruleno==183);
171131 {yymsp[0].minor.yy528=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
171132 break;
171133 case 184: /* term ::= INTEGER */
171134 {
171135 yylhsminor.yy528 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
171136 if( yylhsminor.yy528 ) yylhsminor.yy528->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
171137 }
171138 yymsp[0].minor.yy528 = yylhsminor.yy528;
171139 break;
171140 case 185: /* expr ::= VARIABLE */
171141 {
171142 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
171143 u32 n = yymsp[0].minor.yy0.n;
171144 yymsp[0].minor.yy528 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
171145 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy528, n);
@@ -171157,54 +171578,54 @@
171157 if( yymsp[0].minor.yy528 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy528->iTable);
171158 }
171159 }
171160 }
171161 break;
171162 case 186: /* expr ::= expr COLLATE ID|STRING */
171163 {
171164 yymsp[-2].minor.yy528 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy528, &yymsp[0].minor.yy0, 1);
171165 }
171166 break;
171167 case 187: /* expr ::= CAST LP expr AS typetoken RP */
171168 {
171169 yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
171170 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy528, yymsp[-3].minor.yy528, 0);
171171 }
171172 break;
171173 case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP */
171174 {
171175 yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy394);
171176 }
171177 yymsp[-4].minor.yy528 = yylhsminor.yy528;
171178 break;
171179 case 189: /* expr ::= ID|INDEXED LP STAR RP */
171180 {
171181 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
171182 }
171183 yymsp[-3].minor.yy528 = yylhsminor.yy528;
171184 break;
171185 case 190: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
171186 {
171187 yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy322, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy394);
171188 sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
171189 }
171190 yymsp[-5].minor.yy528 = yylhsminor.yy528;
171191 break;
171192 case 191: /* expr ::= ID|INDEXED LP STAR RP filter_over */
171193 {
171194 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
171195 sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
171196 }
171197 yymsp[-4].minor.yy528 = yylhsminor.yy528;
171198 break;
171199 case 192: /* term ::= CTIME_KW */
171200 {
171201 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
171202 }
171203 yymsp[0].minor.yy528 = yylhsminor.yy528;
171204 break;
171205 case 193: /* expr ::= LP nexprlist COMMA expr RP */
171206 {
171207 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528);
171208 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
171209 if( yymsp[-4].minor.yy528 ){
171210 yymsp[-4].minor.yy528->x.pList = pList;
@@ -171214,26 +171635,26 @@
171214 }else{
171215 sqlite3ExprListDelete(pParse->db, pList);
171216 }
171217 }
171218 break;
171219 case 194: /* expr ::= expr AND expr */
171220 {yymsp[-2].minor.yy528=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
171221 break;
171222 case 195: /* expr ::= expr OR expr */
171223 case 196: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==196);
171224 case 197: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==197);
171225 case 198: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==198);
171226 case 199: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==199);
171227 case 200: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==200);
171228 case 201: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==201);
171229 {yymsp[-2].minor.yy528=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
171230 break;
171231 case 202: /* likeop ::= NOT LIKE_KW|MATCH */
171232 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
171233 break;
171234 case 203: /* expr ::= expr likeop expr */
171235 {
171236 ExprList *pList;
171237 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
171238 yymsp[-1].minor.yy0.n &= 0x7fffffff;
171239 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy528);
@@ -171241,11 +171662,11 @@
171241 yymsp[-2].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
171242 if( bNot ) yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy528, 0);
171243 if( yymsp[-2].minor.yy528 ) yymsp[-2].minor.yy528->flags |= EP_InfixFunc;
171244 }
171245 break;
171246 case 204: /* expr ::= expr likeop expr ESCAPE expr */
171247 {
171248 ExprList *pList;
171249 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
171250 yymsp[-3].minor.yy0.n &= 0x7fffffff;
171251 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
@@ -171254,63 +171675,63 @@
171254 yymsp[-4].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
171255 if( bNot ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171256 if( yymsp[-4].minor.yy528 ) yymsp[-4].minor.yy528->flags |= EP_InfixFunc;
171257 }
171258 break;
171259 case 205: /* expr ::= expr ISNULL|NOTNULL */
171260 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy528,0);}
171261 break;
171262 case 206: /* expr ::= expr NOT NULL */
171263 {yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy528,0);}
171264 break;
171265 case 207: /* expr ::= expr IS expr */
171266 {
171267 yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);
171268 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-2].minor.yy528, TK_ISNULL);
171269 }
171270 break;
171271 case 208: /* expr ::= expr IS NOT expr */
171272 {
171273 yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528);
171274 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL);
171275 }
171276 break;
171277 case 209: /* expr ::= expr IS NOT DISTINCT FROM expr */
171278 {
171279 yymsp[-5].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy528,yymsp[0].minor.yy528);
171280 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-5].minor.yy528, TK_ISNULL);
171281 }
171282 break;
171283 case 210: /* expr ::= expr IS DISTINCT FROM expr */
171284 {
171285 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy528,yymsp[0].minor.yy528);
171286 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-4].minor.yy528, TK_NOTNULL);
171287 }
171288 break;
171289 case 211: /* expr ::= NOT expr */
171290 case 212: /* expr ::= BITNOT expr */ yytestcase(yyruleno==212);
171291 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/}
171292 break;
171293 case 213: /* expr ::= PLUS|MINUS expr */
171294 {
171295 yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0);
171296 /*A-overwrites-B*/
171297 }
171298 break;
171299 case 214: /* expr ::= expr PTR expr */
171300 {
171301 ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528);
171302 pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528);
171303 yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
171304 }
171305 yymsp[-2].minor.yy528 = yylhsminor.yy528;
171306 break;
171307 case 215: /* between_op ::= BETWEEN */
171308 case 218: /* in_op ::= IN */ yytestcase(yyruleno==218);
171309 {yymsp[0].minor.yy394 = 0;}
171310 break;
171311 case 217: /* expr ::= expr between_op expr AND expr */
171312 {
171313 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
171314 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528);
171315 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0);
171316 if( yymsp[-4].minor.yy528 ){
@@ -171319,11 +171740,11 @@
171319 sqlite3ExprListDelete(pParse->db, pList);
171320 }
171321 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171322 }
171323 break;
171324 case 220: /* expr ::= expr in_op LP exprlist RP */
171325 {
171326 if( yymsp[-1].minor.yy322==0 ){
171327 /* Expressions of the form
171328 **
171329 ** expr1 IN ()
@@ -171365,41 +171786,41 @@
171365 }
171366 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171367 }
171368 }
171369 break;
171370 case 221: /* expr ::= LP select RP */
171371 {
171372 yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
171373 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47);
171374 }
171375 break;
171376 case 222: /* expr ::= expr in_op LP select RP */
171377 {
171378 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
171379 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47);
171380 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171381 }
171382 break;
171383 case 223: /* expr ::= expr in_op nm dbnm paren_exprlist */
171384 {
171385 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
171386 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
171387 if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322);
171388 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
171389 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect);
171390 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171391 }
171392 break;
171393 case 224: /* expr ::= EXISTS LP select RP */
171394 {
171395 Expr *p;
171396 p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
171397 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47);
171398 }
171399 break;
171400 case 225: /* expr ::= CASE case_operand case_exprlist case_else END */
171401 {
171402 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0);
171403 if( yymsp[-4].minor.yy528 ){
171404 yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322;
171405 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528);
@@ -171407,406 +171828,406 @@
171407 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
171408 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
171409 }
171410 }
171411 break;
171412 case 226: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
171413 {
171414 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
171415 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528);
171416 }
171417 break;
171418 case 227: /* case_exprlist ::= WHEN expr THEN expr */
171419 {
171420 yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
171421 yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528);
171422 }
171423 break;
171424 case 230: /* case_operand ::= expr */
171425 {yymsp[0].minor.yy528 = yymsp[0].minor.yy528; /*A-overwrites-X*/}
171426 break;
171427 case 233: /* nexprlist ::= nexprlist COMMA expr */
171428 {yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);}
171429 break;
171430 case 234: /* nexprlist ::= expr */
171431 {yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/}
171432 break;
171433 case 236: /* paren_exprlist ::= LP exprlist RP */
171434 case 241: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==241);
171435 {yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;}
171436 break;
171437 case 237: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
171438 {
171439 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
171440 sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394,
171441 &yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF);
171442 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
171443 sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
171444 }
171445 }
171446 break;
171447 case 238: /* uniqueflag ::= UNIQUE */
171448 case 280: /* raisetype ::= ABORT */ yytestcase(yyruleno==280);
171449 {yymsp[0].minor.yy394 = OE_Abort;}
171450 break;
171451 case 239: /* uniqueflag ::= */
171452 {yymsp[1].minor.yy394 = OE_None;}
171453 break;
171454 case 242: /* eidlist ::= eidlist COMMA nm collate sortorder */
171455 {
171456 yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394);
171457 }
171458 break;
171459 case 243: /* eidlist ::= nm collate sortorder */
171460 {
171461 yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/
171462 }
171463 break;
171464 case 246: /* cmd ::= DROP INDEX ifexists fullname */
171465 {sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);}
171466 break;
171467 case 247: /* cmd ::= VACUUM vinto */
171468 {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);}
171469 break;
171470 case 248: /* cmd ::= VACUUM nm vinto */
171471 {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);}
171472 break;
171473 case 251: /* cmd ::= PRAGMA nm dbnm */
171474 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
171475 break;
171476 case 252: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
171477 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
171478 break;
171479 case 253: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
171480 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
171481 break;
171482 case 254: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
171483 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
171484 break;
171485 case 255: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
171486 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
171487 break;
171488 case 258: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
171489 {
171490 Token all;
171491 all.z = yymsp[-3].minor.yy0.z;
171492 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
171493 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all);
171494 }
171495 break;
171496 case 259: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
171497 {
171498 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy394, yymsp[-4].minor.yy180.a, yymsp[-4].minor.yy180.b, yymsp[-2].minor.yy131, yymsp[0].minor.yy528, yymsp[-10].minor.yy394, yymsp[-8].minor.yy394);
171499 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
171500 }
171501 break;
171502 case 260: /* trigger_time ::= BEFORE|AFTER */
171503 { yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ }
171504 break;
171505 case 261: /* trigger_time ::= INSTEAD OF */
171506 { yymsp[-1].minor.yy394 = TK_INSTEAD;}
171507 break;
171508 case 262: /* trigger_time ::= */
171509 { yymsp[1].minor.yy394 = TK_BEFORE; }
171510 break;
171511 case 263: /* trigger_event ::= DELETE|INSERT */
171512 case 264: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==264);
171513 {yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;}
171514 break;
171515 case 265: /* trigger_event ::= UPDATE OF idlist */
171516 {yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;}
171517 break;
171518 case 266: /* when_clause ::= */
171519 case 285: /* key_opt ::= */ yytestcase(yyruleno==285);
171520 { yymsp[1].minor.yy528 = 0; }
171521 break;
171522 case 267: /* when_clause ::= WHEN expr */
171523 case 286: /* key_opt ::= KEY expr */ yytestcase(yyruleno==286);
171524 { yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; }
171525 break;
171526 case 268: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
171527 {
171528 assert( yymsp[-2].minor.yy33!=0 );
171529 yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33;
171530 yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33;
171531 }
171532 break;
171533 case 269: /* trigger_cmd_list ::= trigger_cmd SEMI */
171534 {
171535 assert( yymsp[-1].minor.yy33!=0 );
171536 yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33;
171537 }
171538 break;
171539 case 270: /* trnm ::= nm DOT nm */
171540 {
171541 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
171542 sqlite3ErrorMsg(pParse,
171543 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
171544 "statements within triggers");
171545 }
171546 break;
171547 case 271: /* tridxby ::= INDEXED BY nm */
171548 {
171549 sqlite3ErrorMsg(pParse,
171550 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
171551 "within triggers");
171552 }
171553 break;
171554 case 272: /* tridxby ::= NOT INDEXED */
171555 {
171556 sqlite3ErrorMsg(pParse,
171557 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
171558 "within triggers");
171559 }
171560 break;
171561 case 273: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
171562 {yylhsminor.yy33 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy131, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528, yymsp[-7].minor.yy394, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy522);}
171563 yymsp[-8].minor.yy33 = yylhsminor.yy33;
171564 break;
171565 case 274: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
171566 {
171567 yylhsminor.yy33 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy254,yymsp[-2].minor.yy47,yymsp[-6].minor.yy394,yymsp[-1].minor.yy444,yymsp[-7].minor.yy522,yymsp[0].minor.yy522);/*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/
171568 }
171569 yymsp[-7].minor.yy33 = yylhsminor.yy33;
171570 break;
171571 case 275: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
171572 {yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);}
171573 yymsp[-5].minor.yy33 = yylhsminor.yy33;
171574 break;
171575 case 276: /* trigger_cmd ::= scanpt select scanpt */
171576 {yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/}
171577 yymsp[-2].minor.yy33 = yylhsminor.yy33;
171578 break;
171579 case 277: /* expr ::= RAISE LP IGNORE RP */
171580 {
171581 yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
171582 if( yymsp[-3].minor.yy528 ){
171583 yymsp[-3].minor.yy528->affExpr = OE_Ignore;
171584 }
171585 }
171586 break;
171587 case 278: /* expr ::= RAISE LP raisetype COMMA nm RP */
171588 {
171589 yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
171590 if( yymsp[-5].minor.yy528 ) {
171591 yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394;
171592 }
171593 }
171594 break;
171595 case 279: /* raisetype ::= ROLLBACK */
171596 {yymsp[0].minor.yy394 = OE_Rollback;}
171597 break;
171598 case 281: /* raisetype ::= FAIL */
171599 {yymsp[0].minor.yy394 = OE_Fail;}
171600 break;
171601 case 282: /* cmd ::= DROP TRIGGER ifexists fullname */
171602 {
171603 sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394);
171604 }
171605 break;
171606 case 283: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
171607 {
171608 sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528);
171609 }
171610 break;
171611 case 284: /* cmd ::= DETACH database_kw_opt expr */
171612 {
171613 sqlite3Detach(pParse, yymsp[0].minor.yy528);
171614 }
171615 break;
171616 case 287: /* cmd ::= REINDEX */
171617 {sqlite3Reindex(pParse, 0, 0);}
171618 break;
171619 case 288: /* cmd ::= REINDEX nm dbnm */
171620 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
171621 break;
171622 case 289: /* cmd ::= ANALYZE */
171623 {sqlite3Analyze(pParse, 0, 0);}
171624 break;
171625 case 290: /* cmd ::= ANALYZE nm dbnm */
171626 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
171627 break;
171628 case 291: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
171629 {
171630 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0);
171631 }
171632 break;
171633 case 292: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
171634 {
171635 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
171636 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
171637 }
171638 break;
171639 case 293: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
171640 {
171641 sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0);
171642 }
171643 break;
171644 case 294: /* add_column_fullname ::= fullname */
171645 {
171646 disableLookaside(pParse);
171647 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131);
171648 }
171649 break;
171650 case 295: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
171651 {
171652 sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
171653 }
171654 break;
171655 case 296: /* cmd ::= create_vtab */
171656 {sqlite3VtabFinishParse(pParse,0);}
171657 break;
171658 case 297: /* cmd ::= create_vtab LP vtabarglist RP */
171659 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
171660 break;
171661 case 298: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
171662 {
171663 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394);
171664 }
171665 break;
171666 case 299: /* vtabarg ::= */
171667 {sqlite3VtabArgInit(pParse);}
171668 break;
171669 case 300: /* vtabargtoken ::= ANY */
171670 case 301: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==301);
171671 case 302: /* lp ::= LP */ yytestcase(yyruleno==302);
171672 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
171673 break;
171674 case 303: /* with ::= WITH wqlist */
171675 case 304: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==304);
171676 { sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); }
171677 break;
171678 case 305: /* wqas ::= AS */
171679 {yymsp[0].minor.yy516 = M10d_Any;}
171680 break;
171681 case 306: /* wqas ::= AS MATERIALIZED */
171682 {yymsp[-1].minor.yy516 = M10d_Yes;}
171683 break;
171684 case 307: /* wqas ::= AS NOT MATERIALIZED */
171685 {yymsp[-2].minor.yy516 = M10d_No;}
171686 break;
171687 case 308: /* wqitem ::= nm eidlist_opt wqas LP select RP */
171688 {
171689 yymsp[-5].minor.yy385 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy47, yymsp[-3].minor.yy516); /*A-overwrites-X*/
171690 }
171691 break;
171692 case 309: /* wqlist ::= wqitem */
171693 {
171694 yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/
171695 }
171696 break;
171697 case 310: /* wqlist ::= wqlist COMMA wqitem */
171698 {
171699 yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385);
171700 }
171701 break;
171702 case 311: /* windowdefn_list ::= windowdefn */
171703 { yylhsminor.yy41 = yymsp[0].minor.yy41; }
171704 yymsp[0].minor.yy41 = yylhsminor.yy41;
171705 break;
171706 case 312: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
171707 {
171708 assert( yymsp[0].minor.yy41!=0 );
171709 sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41);
171710 yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41;
171711 yylhsminor.yy41 = yymsp[0].minor.yy41;
171712 }
171713 yymsp[-2].minor.yy41 = yylhsminor.yy41;
171714 break;
171715 case 313: /* windowdefn ::= nm AS LP window RP */
171716 {
171717 if( ALWAYS(yymsp[-1].minor.yy41) ){
171718 yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
171719 }
171720 yylhsminor.yy41 = yymsp[-1].minor.yy41;
171721 }
171722 yymsp[-4].minor.yy41 = yylhsminor.yy41;
171723 break;
171724 case 314: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
171725 {
171726 yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0);
171727 }
171728 break;
171729 case 315: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
171730 {
171731 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0);
171732 }
171733 yymsp[-5].minor.yy41 = yylhsminor.yy41;
171734 break;
171735 case 316: /* window ::= ORDER BY sortlist frame_opt */
171736 {
171737 yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0);
171738 }
171739 break;
171740 case 317: /* window ::= nm ORDER BY sortlist frame_opt */
171741 {
171742 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
171743 }
171744 yymsp[-4].minor.yy41 = yylhsminor.yy41;
171745 break;
171746 case 318: /* window ::= frame_opt */
171747 case 337: /* filter_over ::= over_clause */ yytestcase(yyruleno==337);
171748 {
171749 yylhsminor.yy41 = yymsp[0].minor.yy41;
171750 }
171751 yymsp[0].minor.yy41 = yylhsminor.yy41;
171752 break;
171753 case 319: /* window ::= nm frame_opt */
171754 {
171755 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0);
171756 }
171757 yymsp[-1].minor.yy41 = yylhsminor.yy41;
171758 break;
171759 case 320: /* frame_opt ::= */
171760 {
171761 yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
171762 }
171763 break;
171764 case 321: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
171765 {
171766 yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy394, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy516);
171767 }
171768 yymsp[-2].minor.yy41 = yylhsminor.yy41;
171769 break;
171770 case 322: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
171771 {
171772 yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy394, yymsp[-3].minor.yy595.eType, yymsp[-3].minor.yy595.pExpr, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, yymsp[0].minor.yy516);
171773 }
171774 yymsp[-5].minor.yy41 = yylhsminor.yy41;
171775 break;
171776 case 324: /* frame_bound_s ::= frame_bound */
171777 case 326: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==326);
171778 {yylhsminor.yy595 = yymsp[0].minor.yy595;}
171779 yymsp[0].minor.yy595 = yylhsminor.yy595;
171780 break;
171781 case 325: /* frame_bound_s ::= UNBOUNDED PRECEDING */
171782 case 327: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==327);
171783 case 329: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==329);
171784 {yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;}
171785 yymsp[-1].minor.yy595 = yylhsminor.yy595;
171786 break;
171787 case 328: /* frame_bound ::= expr PRECEDING|FOLLOWING */
171788 {yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;}
171789 yymsp[-1].minor.yy595 = yylhsminor.yy595;
171790 break;
171791 case 330: /* frame_exclude_opt ::= */
171792 {yymsp[1].minor.yy516 = 0;}
171793 break;
171794 case 331: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
171795 {yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;}
171796 break;
171797 case 332: /* frame_exclude ::= NO OTHERS */
171798 case 333: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==333);
171799 {yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/}
171800 break;
171801 case 334: /* frame_exclude ::= GROUP|TIES */
171802 {yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/}
171803 break;
171804 case 335: /* window_clause ::= WINDOW windowdefn_list */
171805 { yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; }
171806 break;
171807 case 336: /* filter_over ::= filter_clause over_clause */
171808 {
171809 if( yymsp[0].minor.yy41 ){
171810 yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528;
171811 }else{
171812 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
@@ -171813,11 +172234,11 @@
171813 }
171814 yylhsminor.yy41 = yymsp[0].minor.yy41;
171815 }
171816 yymsp[-1].minor.yy41 = yylhsminor.yy41;
171817 break;
171818 case 338: /* filter_over ::= filter_clause */
171819 {
171820 yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
171821 if( yylhsminor.yy41 ){
171822 yylhsminor.yy41->eFrmType = TK_FILTER;
171823 yylhsminor.yy41->pFilter = yymsp[0].minor.yy528;
@@ -171825,91 +172246,90 @@
171825 sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528);
171826 }
171827 }
171828 yymsp[0].minor.yy41 = yylhsminor.yy41;
171829 break;
171830 case 339: /* over_clause ::= OVER LP window RP */
171831 {
171832 yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41;
171833 assert( yymsp[-3].minor.yy41!=0 );
171834 }
171835 break;
171836 case 340: /* over_clause ::= OVER nm */
171837 {
171838 yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
171839 if( yymsp[-1].minor.yy41 ){
171840 yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
171841 }
171842 }
171843 break;
171844 case 341: /* filter_clause ::= FILTER LP WHERE expr RP */
171845 { yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; }
171846 break;
171847 default:
171848 /* (342) input ::= cmdlist */ yytestcase(yyruleno==342);
171849 /* (343) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==343);
171850 /* (344) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=344);
171851 /* (345) ecmd ::= SEMI */ yytestcase(yyruleno==345);
171852 /* (346) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==346);
171853 /* (347) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=347);
171854 /* (348) trans_opt ::= */ yytestcase(yyruleno==348);
171855 /* (349) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==349);
171856 /* (350) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==350);
171857 /* (351) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==351);
171858 /* (352) savepoint_opt ::= */ yytestcase(yyruleno==352);
171859 /* (353) cmd ::= create_table create_table_args */ yytestcase(yyruleno==353);
171860 /* (354) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=354);
171861 /* (355) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==355);
171862 /* (356) columnlist ::= columnname carglist */ yytestcase(yyruleno==356);
171863 /* (357) nm ::= ID|INDEXED */ yytestcase(yyruleno==357);
171864 /* (358) nm ::= STRING */ yytestcase(yyruleno==358);
171865 /* (359) nm ::= JOIN_KW */ yytestcase(yyruleno==359);
171866 /* (360) typetoken ::= typename */ yytestcase(yyruleno==360);
171867 /* (361) typename ::= ID|STRING */ yytestcase(yyruleno==361);
171868 /* (362) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=362);
171869 /* (363) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=363);
171870 /* (364) carglist ::= carglist ccons */ yytestcase(yyruleno==364);
171871 /* (365) carglist ::= */ yytestcase(yyruleno==365);
171872 /* (366) ccons ::= NULL onconf */ yytestcase(yyruleno==366);
171873 /* (367) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==367);
171874 /* (368) ccons ::= AS generated */ yytestcase(yyruleno==368);
171875 /* (369) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==369);
171876 /* (370) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==370);
171877 /* (371) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=371);
171878 /* (372) tconscomma ::= */ yytestcase(yyruleno==372);
171879 /* (373) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=373);
171880 /* (374) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=374);
171881 /* (375) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=375);
171882 /* (376) oneselect ::= values */ yytestcase(yyruleno==376);
171883 /* (377) sclp ::= selcollist COMMA */ yytestcase(yyruleno==377);
171884 /* (378) as ::= ID|STRING */ yytestcase(yyruleno==378);
171885 /* (379) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=379);
171886 /* (380) returning ::= */ yytestcase(yyruleno==380);
171887 /* (381) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=381);
171888 /* (382) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==382);
171889 /* (383) exprlist ::= nexprlist */ yytestcase(yyruleno==383);
171890 /* (384) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=384);
171891 /* (385) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=385);
171892 /* (386) nmnum ::= ON */ yytestcase(yyruleno==386);
171893 /* (387) nmnum ::= DELETE */ yytestcase(yyruleno==387);
171894 /* (388) nmnum ::= DEFAULT */ yytestcase(yyruleno==388);
171895 /* (389) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==389);
171896 /* (390) foreach_clause ::= */ yytestcase(yyruleno==390);
171897 /* (391) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==391);
171898 /* (392) trnm ::= nm */ yytestcase(yyruleno==392);
171899 /* (393) tridxby ::= */ yytestcase(yyruleno==393);
171900 /* (394) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==394);
171901 /* (395) database_kw_opt ::= */ yytestcase(yyruleno==395);
171902 /* (396) kwcolumn_opt ::= */ yytestcase(yyruleno==396);
171903 /* (397) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==397);
171904 /* (398) vtabarglist ::= vtabarg */ yytestcase(yyruleno==398);
171905 /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==399);
171906 /* (400) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==400);
171907 /* (401) anylist ::= */ yytestcase(yyruleno==401);
171908 /* (402) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==402);
171909 /* (403) anylist ::= anylist ANY */ yytestcase(yyruleno==403);
171910 /* (404) with ::= */ yytestcase(yyruleno==404);
171911 break;
171912 /********** End reduce actions ************************************************/
171913 };
171914 assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
171915 yygoto = yyRuleInfoLhs[yyruleno];
@@ -174411,13 +174831,25 @@
174411 */
174412 SQLITE_API int sqlite3_config(int op, ...){
174413 va_list ap;
174414 int rc = SQLITE_OK;
174415
174416 /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while
174417 ** the SQLite library is in use. */
174418 if( sqlite3GlobalConfig.isInit ) return SQLITE_MISUSE_BKPT;
 
 
 
 
 
 
 
 
 
 
 
 
174419
174420 va_start(ap, op);
174421 switch( op ){
174422
174423 /* Mutex configuration options are only available in a threadsafe
@@ -174482,10 +174914,11 @@
174482 if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault();
174483 *va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m;
174484 break;
174485 }
174486 case SQLITE_CONFIG_MEMSTATUS: {
 
174487 /* EVIDENCE-OF: R-61275-35157 The SQLITE_CONFIG_MEMSTATUS option takes
174488 ** single argument of type int, interpreted as a boolean, which enables
174489 ** or disables the collection of memory allocation statistics. */
174490 sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
174491 break;
@@ -174605,12 +175038,14 @@
174605 /* MSVC is picky about pulling func ptrs from va lists.
174606 ** http://support.microsoft.com/kb/47961
174607 ** sqlite3GlobalConfig.xLog = va_arg(ap, void(*)(void*,int,const char*));
174608 */
174609 typedef void(*LOGFUNC_t)(void*,int,const char*);
174610 sqlite3GlobalConfig.xLog = va_arg(ap, LOGFUNC_t);
174611 sqlite3GlobalConfig.pLogArg = va_arg(ap, void*);
 
 
174612 break;
174613 }
174614
174615 /* EVIDENCE-OF: R-55548-33817 The compile-time setting for URI filenames
174616 ** can be changed at start-time using the
@@ -174620,11 +175055,12 @@
174620 case SQLITE_CONFIG_URI: {
174621 /* EVIDENCE-OF: R-25451-61125 The SQLITE_CONFIG_URI option takes a single
174622 ** argument of type int. If non-zero, then URI handling is globally
174623 ** enabled. If the parameter is zero, then URI handling is globally
174624 ** disabled. */
174625 sqlite3GlobalConfig.bOpenUri = va_arg(ap, int);
 
174626 break;
174627 }
174628
174629 case SQLITE_CONFIG_COVERING_INDEX_SCAN: {
174630 /* EVIDENCE-OF: R-36592-02772 The SQLITE_CONFIG_COVERING_INDEX_SCAN
@@ -174935,10 +175371,12 @@
174935 { SQLITE_DBCONFIG_LEGACY_ALTER_TABLE, SQLITE_LegacyAlter },
174936 { SQLITE_DBCONFIG_DQS_DDL, SQLITE_DqsDDL },
174937 { SQLITE_DBCONFIG_DQS_DML, SQLITE_DqsDML },
174938 { SQLITE_DBCONFIG_LEGACY_FILE_FORMAT, SQLITE_LegacyFileFmt },
174939 { SQLITE_DBCONFIG_TRUSTED_SCHEMA, SQLITE_TrustedSchema },
 
 
174940 };
174941 unsigned int i;
174942 rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
174943 for(i=0; i<ArraySize(aFlagOp); i++){
174944 if( aFlagOp[i].op==op ){
@@ -176920,13 +177358,13 @@
176920 char c;
176921 int nUri = sqlite3Strlen30(zUri);
176922
176923 assert( *pzErrMsg==0 );
176924
176925 if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */
176926 || sqlite3GlobalConfig.bOpenUri) /* IMP: R-51689-46548 */
176927 && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
176928 ){
176929 char *zOpt;
176930 int eState; /* Parser state when parsing URI */
176931 int iIn; /* Input character index */
176932 int iOut = 0; /* Output character index */
@@ -177328,10 +177766,13 @@
177328 #if defined(SQLITE_DEFAULT_DEFENSIVE)
177329 | SQLITE_Defensive
177330 #endif
177331 #if defined(SQLITE_DEFAULT_LEGACY_ALTER_TABLE)
177332 | SQLITE_LegacyAlter
 
 
 
177333 #endif
177334 ;
177335 sqlite3HashInit(&db->aCollSeq);
177336 #ifndef SQLITE_OMIT_VIRTUALTABLE
177337 sqlite3HashInit(&db->aModule);
@@ -193097,20 +193538,22 @@
193097 static int fts3MsrBufferData(
193098 Fts3MultiSegReader *pMsr, /* Multi-segment-reader handle */
193099 char *pList,
193100 i64 nList
193101 ){
193102 if( nList>pMsr->nBuffer ){
193103 char *pNew;
193104 pMsr->nBuffer = nList*2;
193105 pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, pMsr->nBuffer);
193106 if( !pNew ) return SQLITE_NOMEM;
193107 pMsr->aBuffer = pNew;
 
193108 }
193109
193110 assert( nList>0 );
193111 memcpy(pMsr->aBuffer, pList, nList);
 
193112 return SQLITE_OK;
193113 }
193114
193115 SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext(
193116 Fts3Table *p, /* Virtual table handle */
@@ -199098,12 +199541,15 @@
199098 switch( sqlite3_value_type(pValue) ){
199099 case SQLITE_NULL: {
199100 jsonAppendRaw(p, "null", 4);
199101 break;
199102 }
199103 case SQLITE_INTEGER:
199104 case SQLITE_FLOAT: {
 
 
 
 
199105 const char *z = (const char*)sqlite3_value_text(pValue);
199106 u32 n = (u32)sqlite3_value_bytes(pValue);
199107 jsonAppendRaw(p, z, n);
199108 break;
199109 }
@@ -218244,13 +218690,14 @@
218244 SessionBuffer *p,
218245 const char *zStr,
218246 int *pRc
218247 ){
218248 int nStr = sqlite3Strlen30(zStr);
218249 if( 0==sessionBufferGrow(p, nStr, pRc) ){
218250 memcpy(&p->aBuf[p->nBuf], zStr, nStr);
218251 p->nBuf += nStr;
 
218252 }
218253 }
218254
218255 /*
218256 ** This function is a no-op if *pRc is other than SQLITE_OK when it is
@@ -218267,10 +218714,31 @@
218267 ){
218268 char aBuf[24];
218269 sqlite3_snprintf(sizeof(aBuf)-1, aBuf, "%d", iVal);
218270 sessionAppendStr(p, aBuf, pRc);
218271 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218272
218273 /*
218274 ** This function is a no-op if *pRc is other than SQLITE_OK when it is
218275 ** called. Otherwise, append the string zStr enclosed in quotes (") and
218276 ** with any embedded quote characters escaped to the buffer. No
@@ -218282,11 +218750,11 @@
218282 static void sessionAppendIdent(
218283 SessionBuffer *p, /* Buffer to a append to */
218284 const char *zStr, /* String to quote, escape and append */
218285 int *pRc /* IN/OUT: Error code */
218286 ){
218287 int nStr = sqlite3Strlen30(zStr)*2 + 2 + 1;
218288 if( 0==sessionBufferGrow(p, nStr, pRc) ){
218289 char *zOut = (char *)&p->aBuf[p->nBuf];
218290 const char *zIn = zStr;
218291 *zOut++ = '"';
218292 while( *zIn ){
@@ -218293,10 +218761,11 @@
218293 if( *zIn=='"' ) *zOut++ = '"';
218294 *zOut++ = *(zIn++);
218295 }
218296 *zOut++ = '"';
218297 p->nBuf = (int)((u8 *)zOut - p->aBuf);
 
218298 }
218299 }
218300
218301 /*
218302 ** This function is a no-op if *pRc is other than SQLITE_OK when it is
@@ -218517,33 +218986,82 @@
218517
218518 /*
218519 ** Formulate and prepare a SELECT statement to retrieve a row from table
218520 ** zTab in database zDb based on its primary key. i.e.
218521 **
218522 ** SELECT * FROM zDb.zTab WHERE pk1 = ? AND pk2 = ? AND ...
 
 
 
 
 
 
218523 */
218524 static int sessionSelectStmt(
218525 sqlite3 *db, /* Database handle */
 
218526 const char *zDb, /* Database name */
218527 const char *zTab, /* Table name */
218528 int nCol, /* Number of columns in table */
218529 const char **azCol, /* Names of table columns */
218530 u8 *abPK, /* PRIMARY KEY array */
218531 sqlite3_stmt **ppStmt /* OUT: Prepared SELECT statement */
218532 ){
218533 int rc = SQLITE_OK;
218534 char *zSql = 0;
 
 
218535 int nSql = -1;
 
218536
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218537 if( 0==sqlite3_stricmp("sqlite_stat1", zTab) ){
218538 zSql = sqlite3_mprintf(
218539 "SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND "
218540 "idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", zDb
218541 );
218542 if( zSql==0 ) rc = SQLITE_NOMEM;
218543 }else{
218544 int i;
218545 const char *zSep = "";
218546 SessionBuffer buf = {0, 0, 0};
218547
218548 sessionAppendStr(&buf, "SELECT * FROM ", &rc);
218549 sessionAppendIdent(&buf, zDb, &rc);
@@ -218560,15 +219078,19 @@
218560 }
218561 }
218562 zSql = (char*)buf.aBuf;
218563 nSql = buf.nBuf;
218564 }
 
218565
218566 if( rc==SQLITE_OK ){
218567 rc = sqlite3_prepare_v2(db, zSql, nSql, ppStmt, 0);
218568 }
218569 sqlite3_free(zSql);
 
 
 
218570 return rc;
218571 }
218572
218573 /*
218574 ** Bind the PRIMARY KEY values from the change passed in argument pChange
@@ -218724,11 +219246,12 @@
218724 sessionAppendTableHdr(&buf, bPatchset, pTab, &rc);
218725
218726 /* Build and compile a statement to execute: */
218727 if( rc==SQLITE_OK ){
218728 rc = sessionSelectStmt(
218729 db, pSession->zDb, zName, nCol, azCol, abPK, &pSel);
 
218730 }
218731
218732 nNoop = buf.nBuf;
218733 for(i=0; i<pTab->nChange && rc==SQLITE_OK; i++){
218734 SessionChange *p; /* Used to iterate through changes */
@@ -219913,10 +220436,11 @@
219913 int bInvertConstraints; /* Invert when iterating constraints buffer */
219914 SessionBuffer constraints; /* Deferred constraints are stored here */
219915 SessionBuffer rebase; /* Rebase information (if any) here */
219916 u8 bRebaseStarted; /* If table header is already in rebase */
219917 u8 bRebase; /* True to collect rebase information */
 
219918 };
219919
219920 /* Number of prepared UPDATE statements to cache. */
219921 #define SESSION_UPDATE_CACHE_SZ 12
219922
@@ -220163,12 +220687,13 @@
220163 static int sessionSelectRow(
220164 sqlite3 *db, /* Database handle */
220165 const char *zTab, /* Table name */
220166 SessionApplyCtx *p /* Session changeset-apply context */
220167 ){
220168 return sessionSelectStmt(
220169 db, "main", zTab, p->nCol, p->azCol, p->abPK, &p->pSelect);
 
220170 }
220171
220172 /*
220173 ** Formulate and prepare an INSERT statement to add a record to table zTab.
220174 ** For example:
@@ -220323,23 +220848,36 @@
220323 ** new.* record to the SELECT statement. Or, if it points to a DELETE or
220324 ** UPDATE, bind values from the old.* record.
220325 */
220326 static int sessionSeekToRow(
220327 sqlite3_changeset_iter *pIter, /* Changeset iterator */
220328 u8 *abPK, /* Primary key flags array */
220329 sqlite3_stmt *pSelect /* SELECT statement from sessionSelectRow() */
220330 ){
 
220331 int rc; /* Return code */
220332 int nCol; /* Number of columns in table */
220333 int op; /* Changset operation (SQLITE_UPDATE etc.) */
220334 const char *zDummy; /* Unused */
220335
 
220336 sqlite3changeset_op(pIter, &zDummy, &nCol, &op, 0);
220337 rc = sessionBindRow(pIter,
220338 op==SQLITE_INSERT ? sqlite3changeset_new : sqlite3changeset_old,
220339 nCol, abPK, pSelect
220340 );
 
 
 
 
 
 
 
 
 
 
 
 
220341
220342 if( rc==SQLITE_OK ){
220343 rc = sqlite3_step(pSelect);
220344 if( rc!=SQLITE_ROW ) rc = sqlite3_reset(pSelect);
220345 }
@@ -220451,20 +220989,26 @@
220451 assert( SQLITE_CHANGESET_CONFLICT+1==SQLITE_CHANGESET_CONSTRAINT );
220452 assert( SQLITE_CHANGESET_DATA+1==SQLITE_CHANGESET_NOTFOUND );
220453
220454 /* Bind the new.* PRIMARY KEY values to the SELECT statement. */
220455 if( pbReplace ){
220456 rc = sessionSeekToRow(pIter, p->abPK, p->pSelect);
220457 }else{
220458 rc = SQLITE_OK;
220459 }
220460
220461 if( rc==SQLITE_ROW ){
220462 /* There exists another row with the new.* primary key. */
220463 pIter->pConflict = p->pSelect;
220464 res = xConflict(pCtx, eType, pIter);
220465 pIter->pConflict = 0;
 
 
 
 
 
 
220466 rc = sqlite3_reset(p->pSelect);
220467 }else if( rc==SQLITE_OK ){
220468 if( p->bDeferConstraints && eType==SQLITE_CHANGESET_CONFLICT ){
220469 /* Instead of invoking the conflict handler, append the change blob
220470 ** to the SessionApplyCtx.constraints buffer. */
@@ -220568,11 +221112,11 @@
220568 }
220569 if( rc!=SQLITE_OK ) return rc;
220570
220571 sqlite3_step(p->pDelete);
220572 rc = sqlite3_reset(p->pDelete);
220573 if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 ){
220574 rc = sessionConflictHandler(
220575 SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry
220576 );
220577 }else if( (rc&0xff)==SQLITE_CONSTRAINT ){
220578 rc = sessionConflictHandler(
@@ -220625,11 +221169,11 @@
220625 assert( op==SQLITE_INSERT );
220626 if( p->bStat1 ){
220627 /* Check if there is a conflicting row. For sqlite_stat1, this needs
220628 ** to be done using a SELECT, as there is no PRIMARY KEY in the
220629 ** database schema to throw an exception if a duplicate is inserted. */
220630 rc = sessionSeekToRow(pIter, p->abPK, p->pSelect);
220631 if( rc==SQLITE_ROW ){
220632 rc = SQLITE_CONSTRAINT;
220633 sqlite3_reset(p->pSelect);
220634 }
220635 }
@@ -220802,10 +221346,11 @@
220802
220803 pIter->in.bNoDiscard = 1;
220804 memset(&sApply, 0, sizeof(sApply));
220805 sApply.bRebase = (ppRebase && pnRebase);
220806 sApply.bInvertConstraints = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
 
220807 sqlite3_mutex_enter(sqlite3_db_mutex(db));
220808 if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){
220809 rc = sqlite3_exec(db, "SAVEPOINT changeset_apply", 0, 0, 0);
220810 }
220811 if( rc==SQLITE_OK ){
@@ -225058,11 +225603,11 @@
225058 UNUSED_PARAM2(pToken, nToken);
225059
225060 if( tflags & FTS5_TOKEN_COLOCATED ) return SQLITE_OK;
225061 iPos = p->iPos++;
225062
225063 if( p->iRangeEnd>0 ){
225064 if( iPos<p->iRangeStart || iPos>p->iRangeEnd ) return SQLITE_OK;
225065 if( p->iRangeStart && iPos==p->iRangeStart ) p->iOff = iStartOff;
225066 }
225067
225068 if( iPos==p->iter.iStart ){
@@ -225070,11 +225615,11 @@
225070 fts5HighlightAppend(&rc, p, p->zOpen, -1);
225071 p->iOff = iStartOff;
225072 }
225073
225074 if( iPos==p->iter.iEnd ){
225075 if( p->iRangeEnd && p->iter.iStart<p->iRangeStart ){
225076 fts5HighlightAppend(&rc, p, p->zOpen, -1);
225077 }
225078 fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
225079 fts5HighlightAppend(&rc, p, p->zClose, -1);
225080 p->iOff = iEndOff;
@@ -225081,11 +225626,11 @@
225081 if( rc==SQLITE_OK ){
225082 rc = fts5CInstIterNext(&p->iter);
225083 }
225084 }
225085
225086 if( p->iRangeEnd>0 && iPos==p->iRangeEnd ){
225087 fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
225088 p->iOff = iEndOff;
225089 if( iPos>=p->iter.iStart && iPos<p->iter.iEnd ){
225090 fts5HighlightAppend(&rc, p, p->zClose, -1);
225091 }
@@ -225116,10 +225661,11 @@
225116
225117 iCol = sqlite3_value_int(apVal[0]);
225118 memset(&ctx, 0, sizeof(HighlightContext));
225119 ctx.zOpen = (const char*)sqlite3_value_text(apVal[1]);
225120 ctx.zClose = (const char*)sqlite3_value_text(apVal[2]);
 
225121 rc = pApi->xColumnText(pFts, iCol, &ctx.zIn, &ctx.nIn);
225122
225123 if( ctx.zIn ){
225124 if( rc==SQLITE_OK ){
225125 rc = fts5CInstIterInit(pApi, pFts, iCol, &ctx.iter);
@@ -225301,10 +225847,11 @@
225301 nCol = pApi->xColumnCount(pFts);
225302 memset(&ctx, 0, sizeof(HighlightContext));
225303 iCol = sqlite3_value_int(apVal[0]);
225304 ctx.zOpen = fts5ValueToText(apVal[1]);
225305 ctx.zClose = fts5ValueToText(apVal[2]);
 
225306 zEllips = fts5ValueToText(apVal[3]);
225307 nToken = sqlite3_value_int(apVal[4]);
225308
225309 iBestCol = (iCol>=0 ? iCol : 0);
225310 nPhrase = pApi->xPhraseCount(pFts);
@@ -240250,11 +240797,11 @@
240250 int nArg, /* Number of args */
240251 sqlite3_value **apUnused /* Function arguments */
240252 ){
240253 assert( nArg==0 );
240254 UNUSED_PARAM2(nArg, apUnused);
240255 sqlite3_result_text(pCtx, "fts5: 2023-03-17 12:25:10 c5bd0ea3b5b2f3ed8e971c5fd6e85e8f06d8055d74df65612c3794138306e6ba", -1, SQLITE_TRANSIENT);
240256 }
240257
240258 /*
240259 ** Return true if zName is the extension on one of the shadow tables used
240260 ** by this module.
240261
--- extsrc/sqlite3.c
+++ extsrc/sqlite3.c
@@ -1,8 +1,8 @@
1 /******************************************************************************
2 ** This file is an amalgamation of many separate C source files from SQLite
3 ** version 3.42.0. By combining all the individual C code files into this
4 ** single large file, the entire code can be compiled as a single translation
5 ** unit. This allows many compilers to do optimizations that would not be
6 ** possible if the files were compiled separately. Performance improvements
7 ** of 5% or more are commonly seen when SQLite is compiled as a single
8 ** translation unit.
@@ -450,13 +450,13 @@
450 **
451 ** See also: [sqlite3_libversion()],
452 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
453 ** [sqlite_version()] and [sqlite_source_id()].
454 */
455 #define SQLITE_VERSION "3.42.0"
456 #define SQLITE_VERSION_NUMBER 3042000
457 #define SQLITE_SOURCE_ID "2023-04-01 15:51:21 a4fb2864fe01cce9694242a0750623ca47fcecd68f74c4239d3eb5fbf978770a"
458
459 /*
460 ** CAPI3REF: Run-Time Library Version Numbers
461 ** KEYWORDS: sqlite3_version sqlite3_sourceid
462 **
@@ -1959,23 +1959,26 @@
1959 **
1960 ** <b>The sqlite3_config() interface is not threadsafe. The application
1961 ** must ensure that no other SQLite interfaces are invoked by other
1962 ** threads while sqlite3_config() is running.</b>
1963 **
 
 
 
 
 
 
 
 
1964 ** The first argument to sqlite3_config() is an integer
1965 ** [configuration option] that determines
1966 ** what property of SQLite is to be configured. Subsequent arguments
1967 ** vary depending on the [configuration option]
1968 ** in the first argument.
1969 **
1970 ** For most configuration options, the sqlite3_config() interface
1971 ** may only be invoked prior to library initialization using
1972 ** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1973 ** The exceptional configuration options that may be invoked at any time
1974 ** are called "anytime configuration options".
1975 ** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1976 ** [sqlite3_shutdown()] with a first argument that is not an anytime
1977 ** configuration option, then the sqlite3_config() call will return SQLITE_MISUSE.
1978 ** Note, however, that ^sqlite3_config() can be called as part of the
1979 ** implementation of an application-defined [sqlite3_os_init()].
1980 **
1981 ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
1982 ** ^If the option is unknown or SQLite is unable to set the option
1983 ** then this routine returns a non-zero [error code].
1984 */
@@ -2079,10 +2082,27 @@
2082 ** CAPI3REF: Configuration Options
2083 ** KEYWORDS: {configuration option}
2084 **
2085 ** These constants are the available integer configuration options that
2086 ** can be passed as the first argument to the [sqlite3_config()] interface.
2087 **
2088 ** Most of the configuration options for sqlite3_config()
2089 ** will only work if invoked prior to [sqlite3_initialize()] or after
2090 ** [sqlite3_shutdown()]. The few exceptions to this rule are called
2091 ** "anytime configuration options".
2092 ** ^Calling [sqlite3_config()] with a first argument that is not an
2093 ** anytime configuration option in between calls to [sqlite3_initialize()] and
2094 ** [sqlite3_shutdown()] is a no-op that returns SQLITE_MISUSE.
2095 **
2096 ** The set of anytime configuration options can change (by insertions
2097 ** and/or deletions) from one release of SQLite to the next.
2098 ** As of SQLite version 3.42.0, the complete set of anytime configuration
2099 ** options is:
2100 ** <ul>
2101 ** <li> SQLITE_CONFIG_LOG
2102 ** <li> SQLITE_CONFIG_PCACHE_HDRSZ
2103 ** </ul>
2104 **
2105 ** New configuration options may be added in future releases of SQLite.
2106 ** Existing configuration options might be discontinued. Applications
2107 ** should check the return code from [sqlite3_config()] to make sure that
2108 ** the call worked. The [sqlite3_config()] interface will return a
@@ -2740,10 +2760,30 @@
2760 ** the [VACUUM] command will fail with an obscure error when attempting to
2761 ** process a table with generated columns and a descending index. This is
2762 ** not considered a bug since SQLite versions 3.3.0 and earlier do not support
2763 ** either generated columns or decending indexes.
2764 ** </dd>
2765 **
2766 ** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
2767 ** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</td>
2768 ** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
2769 ** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
2770 ** a flag that enables collection of the sqlite3_stmt_scanstatus_v2()
2771 ** statistics. For statistics to be collected, the flag must be set on
2772 ** the database handle both when the SQL statement is prepared and when it
2773 ** is stepped. The flag is set (collection of statistics is enabled)
2774 ** by default.</dd>
2775 **
2776 ** [[SQLITE_DBCONFIG_REVERSE_SCANORDER]]
2777 ** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</td>
2778 ** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option change the default order
2779 ** in which tables and indexes are scanned so that the scans start at the end
2780 ** and work toward the beginning rather than starting at the beginning and
2781 ** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
2782 ** same as setting [PRAGMA reverse_unordered_selects]. This configuration option
2783 ** is useful for application testing.</dd>
2784 **
2785 ** </dl>
2786 */
2787 #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
2788 #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
2789 #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
@@ -2760,11 +2800,13 @@
2800 #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
2801 #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
2802 #define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
2803 #define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
2804 #define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
2805 #define SQLITE_DBCONFIG_STMT_SCANSTATUS 1080 /* int int* */
2806 #define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
2807 #define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */
2808
2809 /*
2810 ** CAPI3REF: Enable Or Disable Extended Result Codes
2811 ** METHOD: sqlite3
2812 **
@@ -12217,13 +12259,27 @@
12259 **
12260 ** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
12261 ** Invert the changeset before applying it. This is equivalent to inverting
12262 ** a changeset using sqlite3changeset_invert() before applying it. It is
12263 ** an error to specify this flag with a patchset.
12264 **
12265 ** <dt>SQLITE_CHANGESETAPPLY_IGNORENOOP <dd>
12266 ** Do not invoke the conflict handler callback for any changes that
12267 ** would not actually modify the database even if they were applied.
12268 ** Specifically, this means that the conflict handler is not invoked
12269 ** for:
12270 ** <ul>
12271 ** <li>a delete change if the row being deleted cannot be found,
12272 ** <li>an update change if the modified fields are already set to
12273 ** their new values in the conflicting row, or
12274 ** <li>an insert change if all fields of the conflicting row match
12275 ** the row being inserted.
12276 ** </ul>
12277 */
12278 #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
12279 #define SQLITE_CHANGESETAPPLY_INVERT 0x0002
12280 #define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004
12281
12282 /*
12283 ** CAPI3REF: Constants Passed To The Conflict Handler
12284 **
12285 ** Values that may be passed as the second argument to a conflict-handler.
@@ -13516,12 +13572,12 @@
13572 #pragma warn -csu /* Comparing signed and unsigned */
13573 #pragma warn -spa /* Suspicious pointer arithmetic */
13574 #endif
13575
13576 /*
13577 ** A few places in the code require atomic load/store of aligned
13578 ** integer values.
13579 */
13580 #ifndef __has_extension
13581 # define __has_extension(x) 0 /* compatibility with non-clang compilers */
13582 #endif
13583 #if GCC_VERSION>=4007000 || __has_extension(c_atomic)
@@ -16590,11 +16646,11 @@
16646 /**********************************************************************
16647 ** Elements above, except pCache, are public. All that follow are
16648 ** private to pcache.c and should not be accessed by other modules.
16649 ** pCache is grouped with the public elements for efficiency.
16650 */
16651 i64 nRef; /* Number of users of this page */
16652 PgHdr *pDirtyNext; /* Next element in list of dirty pages */
16653 PgHdr *pDirtyPrev; /* Previous element in list of dirty pages */
16654 /* NB: pDirtyNext and pDirtyPrev are undefined if the
16655 ** PgHdr object is not dirty */
16656 };
@@ -16671,16 +16727,16 @@
16727
16728 /* Discard the contents of the cache */
16729 SQLITE_PRIVATE void sqlite3PcacheClear(PCache*);
16730
16731 /* Return the total number of outstanding page references */
16732 SQLITE_PRIVATE i64 sqlite3PcacheRefCount(PCache*);
16733
16734 /* Increment the reference count of an existing page */
16735 SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr*);
16736
16737 SQLITE_PRIVATE i64 sqlite3PcachePageRefcount(PgHdr*);
16738
16739 /* Return the total number of pages stored in the cache */
16740 SQLITE_PRIVATE int sqlite3PcachePagecount(PCache*);
16741
16742 #if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG)
@@ -17251,11 +17307,11 @@
17307 #define SQLITE_TrustedSchema 0x00000080 /* Allow unsafe functions and
17308 ** vtabs in the schema definition */
17309 #define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */
17310 /* result set is empty */
17311 #define SQLITE_IgnoreChecks 0x00000200 /* Do not enforce check constraints */
17312 #define SQLITE_StmtScanStatus 0x00000400 /* Enable stmt_scanstats() counters */
17313 #define SQLITE_NoCkptOnClose 0x00000800 /* No checkpoint on close()/DETACH */
17314 #define SQLITE_ReverseOrder 0x00001000 /* Reverse unordered SELECTs */
17315 #define SQLITE_RecTriggers 0x00002000 /* Enable recursive triggers */
17316 #define SQLITE_ForeignKeys 0x00004000 /* Enforce foreign key constraints */
17317 #define SQLITE_AutoIndex 0x00008000 /* Enable automatic indexes */
@@ -17277,10 +17333,11 @@
17333 #define SQLITE_EnableView 0x80000000 /* Enable the use of views */
17334 #define SQLITE_CountRows HI(0x00001) /* Count rows changed by INSERT, */
17335 /* DELETE, or UPDATE and return */
17336 /* the count using a callback. */
17337 #define SQLITE_CorruptRdOnly HI(0x00002) /* Prohibit writes due to error */
17338 #define SQLITE_ReadUncommit HI(0x00004) /* READ UNCOMMITTED in shared-cache */
17339
17340 /* Flags used only if debugging */
17341 #ifdef SQLITE_DEBUG
17342 #define SQLITE_SqlTrace HI(0x0100000) /* Debug print SQL as it executes */
17343 #define SQLITE_VdbeListing HI(0x0200000) /* Debug listings of VDBE progs */
@@ -17333,10 +17390,11 @@
17390 #define SQLITE_ReleaseReg 0x00400000 /* Use OP_ReleaseReg for testing */
17391 #define SQLITE_FlttnUnionAll 0x00800000 /* Disable the UNION ALL flattener */
17392 /* TH3 expects this value ^^^^^^^^^^ See flatten04.test */
17393 #define SQLITE_IndexedExpr 0x01000000 /* Pull exprs from index when able */
17394 #define SQLITE_Coroutines 0x02000000 /* Co-routines for subqueries */
17395 #define SQLITE_NullUnusedCols 0x04000000 /* NULL unused columns in subqueries */
17396 #define SQLITE_AllOpts 0xffffffff /* All optimizations */
17397
17398 /*
17399 ** Macros for testing whether or not optimizations are enabled or disabled.
17400 */
@@ -20141,10 +20199,14 @@
20199 SQLITE_PRIVATE int sqlite3GetTempReg(Parse*);
20200 SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int);
20201 SQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int);
20202 SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int);
20203 SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse*);
20204 SQLITE_PRIVATE void sqlite3TouchRegister(Parse*,int);
20205 #if defined(SQLITE_ENABLE_STAT4) || defined(SQLITE_DEBUG)
20206 SQLITE_PRIVATE int sqlite3FirstAvailableRegister(Parse*,int);
20207 #endif
20208 #ifdef SQLITE_DEBUG
20209 SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int);
20210 #endif
20211 SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int);
20212 SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*);
@@ -20291,11 +20353,11 @@
20353 SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*);
20354 SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*,
20355 Expr*,ExprList*,u32,Expr*);
20356 SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*);
20357 SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*);
20358 SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, Trigger*);
20359 SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
20360 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY)
20361 SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*);
20362 #endif
20363 SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe*,int,const char*);
@@ -21077,10 +21139,16 @@
21139 #if defined(VDBE_PROFILE) \
21140 || defined(SQLITE_PERFORMANCE_TRACE) \
21141 || defined(SQLITE_ENABLE_STMT_SCANSTATUS)
21142 SQLITE_PRIVATE sqlite3_uint64 sqlite3Hwtime(void);
21143 #endif
21144
21145 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
21146 # define IS_STMT_SCANSTATUS(db) (db->flags & SQLITE_StmtScanStatus)
21147 #else
21148 # define IS_STMT_SCANSTATUS(db) 0
21149 #endif
21150
21151 #endif /* SQLITEINT_H */
21152
21153 /************** End of sqliteInt.h *******************************************/
21154 /************** Begin file os_common.h ***************************************/
@@ -22267,11 +22335,11 @@
22335 0, /* xAltLocaltime */
22336 0x7ffffffe, /* iOnceResetThreshold */
22337 SQLITE_DEFAULT_SORTERREF_SIZE, /* szSorterRef */
22338 0, /* iPrngSeed */
22339 #ifdef SQLITE_DEBUG
22340 {0,0,0,0,0,0}, /* aTune */
22341 #endif
22342 };
22343
22344 /*
22345 ** Hash table for global functions - functions common to all
@@ -30072,10 +30140,24 @@
30140 *val = (*val - d)*10.0;
30141 return (char)digit;
30142 }
30143 #endif /* SQLITE_OMIT_FLOATING_POINT */
30144
30145 #ifndef SQLITE_OMIT_FLOATING_POINT
30146 /*
30147 ** "*val" is a u64. *msd is a divisor used to extract the
30148 ** most significant digit of *val. Extract that most significant
30149 ** digit and return it.
30150 */
30151 static char et_getdigit_int(u64 *val, u64 *msd){
30152 u64 x = (*val)/(*msd);
30153 *val -= x*(*msd);
30154 if( *msd>=10 ) *msd /= 10;
30155 return '0' + (char)(x & 15);
30156 }
30157 #endif /* SQLITE_OMIT_FLOATING_POINT */
30158
30159 /*
30160 ** Set the StrAccum object to an error mode.
30161 */
30162 SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum *p, u8 eError){
30163 assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG );
@@ -30164,10 +30246,12 @@
30246 etByte xtype = etINVALID; /* Conversion paradigm */
30247 u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */
30248 char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
30249 sqlite_uint64 longvalue; /* Value for integer types */
30250 LONGDOUBLE_TYPE realvalue; /* Value for real types */
30251 sqlite_uint64 msd; /* Divisor to get most-significant-digit
30252 ** of longvalue */
30253 const et_info *infop; /* Pointer to the appropriate info structure */
30254 char *zOut; /* Rendering buffer */
30255 int nOut; /* Size of the rendering buffer */
30256 char *zExtra = 0; /* Malloced memory used by some conversion */
30257 #ifndef SQLITE_OMIT_FLOATING_POINT
@@ -30470,56 +30554,82 @@
30554 realvalue = -realvalue;
30555 prefix = '-';
30556 }else{
30557 prefix = flag_prefix;
30558 }
30559 exp = 0;
30560 if( xtype==etGENERIC && precision>0 ) precision--;
30561 testcase( precision>0xfff );
30562 if( realvalue<1.0e+16
30563 && realvalue==(LONGDOUBLE_TYPE)(longvalue = (u64)realvalue)
30564 ){
30565 /* Number is a pure integer that can be represented as u64 */
30566 for(msd=1; msd*10<=longvalue; msd *= 10, exp++){}
30567 if( exp>precision && xtype!=etFLOAT ){
30568 u64 rnd = msd/2;
30569 int kk = precision;
30570 while( kk-- > 0 ){ rnd /= 10; }
30571 longvalue += rnd;
30572 }
30573 }else{
30574 msd = 0;
30575 longvalue = 0; /* To prevent a compiler warning */
30576 idx = precision & 0xfff;
30577 rounder = arRound[idx%10];
30578 while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; }
30579 if( xtype==etFLOAT ){
30580 double rx = (double)realvalue;
30581 sqlite3_uint64 u;
30582 int ex;
30583 memcpy(&u, &rx, sizeof(u));
30584 ex = -1023 + (int)((u>>52)&0x7ff);
30585 if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16;
30586 realvalue += rounder;
30587 }
30588 if( sqlite3IsNaN((double)realvalue) ){
30589 if( flag_zeropad ){
30590 bufpt = "null";
30591 length = 4;
30592 }else{
30593 bufpt = "NaN";
30594 length = 3;
30595 }
30596 break;
30597 }
30598
30599 /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
30600 if( ALWAYS(realvalue>0.0) ){
30601 LONGDOUBLE_TYPE scale = 1.0;
30602 while( realvalue>=1e100*scale && exp<=350){ scale*=1e100;exp+=100;}
30603 while( realvalue>=1e10*scale && exp<=350 ){ scale*=1e10; exp+=10; }
30604 while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; }
30605 realvalue /= scale;
30606 while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }
30607 while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }
30608 if( exp>350 ){
30609 if( flag_zeropad ){
30610 realvalue = 9.0;
30611 exp = 999;
30612 }else{
30613 bufpt = buf;
30614 buf[0] = prefix;
30615 memcpy(buf+(prefix!=0),"Inf",4);
30616 length = 3+(prefix!=0);
30617 break;
30618 }
30619 }
30620 if( xtype!=etFLOAT ){
30621 realvalue += rounder;
30622 if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
30623 }
30624 }
30625 }
30626
30627 /*
30628 ** If the field type is etGENERIC, then convert to either etEXP
30629 ** or etFLOAT, as appropriate.
30630 */
 
 
 
 
30631 if( xtype==etGENERIC ){
30632 flag_rtz = !flag_alternateform;
30633 if( exp<-4 || exp>precision ){
30634 xtype = etEXP;
30635 }else{
@@ -30532,28 +30642,33 @@
30642 if( xtype==etEXP ){
30643 e2 = 0;
30644 }else{
30645 e2 = exp;
30646 }
30647 nsd = 16 + flag_altform2*10;
30648 bufpt = buf;
30649 {
30650 i64 szBufNeeded; /* Size of a temporary buffer needed */
30651 szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15;
30652 if( szBufNeeded > etBUFSIZE ){
30653 bufpt = zExtra = printfTempBuf(pAccum, szBufNeeded);
30654 if( bufpt==0 ) return;
30655 }
30656 }
30657 zOut = bufpt;
 
30658 flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2;
30659 /* The sign in front of the number */
30660 if( prefix ){
30661 *(bufpt++) = prefix;
30662 }
30663 /* Digits prior to the decimal point */
30664 if( e2<0 ){
30665 *(bufpt++) = '0';
30666 }else if( msd>0 ){
30667 for(; e2>=0; e2--){
30668 *(bufpt++) = et_getdigit_int(&longvalue,&msd);
30669 }
30670 }else{
30671 for(; e2>=0; e2--){
30672 *(bufpt++) = et_getdigit(&realvalue,&nsd);
30673 }
30674 }
@@ -30566,12 +30681,18 @@
30681 for(e2++; e2<0; precision--, e2++){
30682 assert( precision>0 );
30683 *(bufpt++) = '0';
30684 }
30685 /* Significant digits after the decimal point */
30686 if( msd>0 ){
30687 while( (precision--)>0 ){
30688 *(bufpt++) = et_getdigit_int(&longvalue,&msd);
30689 }
30690 }else{
30691 while( (precision--)>0 ){
30692 *(bufpt++) = et_getdigit(&realvalue,&nsd);
30693 }
30694 }
30695 /* Remove trailing zeros and the "." if no digits follow the "." */
30696 if( flag_rtz && flag_dp ){
30697 while( bufpt[-1]=='0' ) *(--bufpt) = 0;
30698 assert( bufpt>zOut );
@@ -31248,16 +31369,26 @@
31369 sqlite3_str_vappendf(&acc, zFormat, ap);
31370 zBuf[acc.nChar] = 0;
31371 return zBuf;
31372 }
31373 SQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
31374 StrAccum acc;
31375 va_list ap;
31376 if( n<=0 ) return zBuf;
31377 #ifdef SQLITE_ENABLE_API_ARMOR
31378 if( zBuf==0 || zFormat==0 ) {
31379 (void)SQLITE_MISUSE_BKPT;
31380 if( zBuf ) zBuf[0] = 0;
31381 return zBuf;
31382 }
31383 #endif
31384 sqlite3StrAccumInit(&acc, 0, zBuf, n, 0);
31385 va_start(ap,zFormat);
31386 sqlite3_str_vappendf(&acc, zFormat, ap);
31387 va_end(ap);
31388 zBuf[acc.nChar] = 0;
31389 return zBuf;
31390 }
31391
31392 /*
31393 ** This is the routine that actually formats the sqlite3_log() message.
31394 ** We house it in a separate routine from sqlite3_log() to avoid using
@@ -52655,11 +52786,11 @@
52786 ** pointers).
52787 */
52788 struct PCache {
52789 PgHdr *pDirty, *pDirtyTail; /* List of dirty pages in LRU order */
52790 PgHdr *pSynced; /* Last synced page in dirty page list */
52791 i64 nRefSum; /* Sum of ref counts over all pages */
52792 int szCache; /* Configured cache size */
52793 int szSpill; /* Size before spilling occurs */
52794 int szPage; /* Size of every page in this cache */
52795 int szExtra; /* Size of extra space for each page */
52796 u8 bPurgeable; /* True if pages are on backing store */
@@ -52685,11 +52816,11 @@
52816 static void pcachePageTrace(int i, sqlite3_pcache_page *pLower){
52817 PgHdr *pPg;
52818 unsigned char *a;
52819 int j;
52820 pPg = (PgHdr*)pLower->pExtra;
52821 printf("%3lld: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags);
52822 a = (unsigned char *)pLower->pBuf;
52823 for(j=0; j<12; j++) printf("%02x", a[j]);
52824 printf(" ptr %p\n", pPg);
52825 }
52826 static void pcacheDump(PCache *pCache){
@@ -53429,18 +53560,18 @@
53560 ** Return the total number of references to all pages held by the cache.
53561 **
53562 ** This is not the total number of pages referenced, but the sum of the
53563 ** reference count for all pages.
53564 */
53565 SQLITE_PRIVATE i64 sqlite3PcacheRefCount(PCache *pCache){
53566 return pCache->nRefSum;
53567 }
53568
53569 /*
53570 ** Return the number of references to the page supplied as an argument.
53571 */
53572 SQLITE_PRIVATE i64 sqlite3PcachePageRefcount(PgHdr *p){
53573 return p->nRef;
53574 }
53575
53576 /*
53577 ** Return the total number of pages in the cache.
@@ -68094,12 +68225,13 @@
68225 int mxErr; /* Stop accumulating errors when this reaches zero */
68226 int nErr; /* Number of messages written to zErrMsg so far */
68227 int rc; /* SQLITE_OK, SQLITE_NOMEM, or SQLITE_INTERRUPT */
68228 u32 nStep; /* Number of steps into the integrity_check process */
68229 const char *zPfx; /* Error message prefix */
68230 Pgno v0; /* Value for first %u substitution in zPfx (root page) */
68231 Pgno v1; /* Value for second %u substitution in zPfx (current pg) */
68232 int v2; /* Value for third %d substitution in zPfx */
68233 StrAccum errMsg; /* Accumulate the error message text here */
68234 u32 *heap; /* Min-heap used for analyzing cell coverage */
68235 sqlite3 *db; /* Database connection running the check */
68236 };
68237
@@ -68558,12 +68690,12 @@
68690 */
68691 #ifdef SQLITE_DEBUG
68692 int corruptPageError(int lineno, MemPage *p){
68693 char *zMsg;
68694 sqlite3BeginBenignMalloc();
68695 zMsg = sqlite3_mprintf("database corruption page %u of %s",
68696 p->pgno, sqlite3PagerFilename(p->pBt->pPager, 0)
68697 );
68698 sqlite3EndBenignMalloc();
68699 if( zMsg ){
68700 sqlite3ReportError(SQLITE_CORRUPT, lineno, zMsg);
68701 }
@@ -69454,11 +69586,11 @@
69586 }
69587 assert( offset <= (int)pBt->usableSize-5 );
69588 pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);
69589
69590 if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){
69591 TRACE(("PTRMAP_UPDATE: %u->(%u,%u)\n", key, eType, parent));
69592 *pRC= rc = sqlite3PagerWrite(pDbPage);
69593 if( rc==SQLITE_OK ){
69594 pPtrmap[offset] = eType;
69595 put4byte(&pPtrmap[offset+1], parent);
69596 }
@@ -69653,31 +69785,35 @@
69785 ** This routine is a high-runner.
69786 */
69787 iKey = *pIter;
69788 if( iKey>=0x80 ){
69789 u8 x;
69790 iKey = (iKey<<7) ^ (x = *++pIter);
69791 if( x>=0x80 ){
69792 iKey = (iKey<<7) ^ (x = *++pIter);
69793 if( x>=0x80 ){
69794 iKey = (iKey<<7) ^ 0x10204000 ^ (x = *++pIter);
69795 if( x>=0x80 ){
69796 iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
69797 if( x>=0x80 ){
69798 iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
69799 if( x>=0x80 ){
69800 iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
69801 if( x>=0x80 ){
69802 iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter);
69803 if( x>=0x80 ){
69804 iKey = (iKey<<8) ^ 0x8000 ^ (*++pIter);
69805 }
69806 }
69807 }
69808 }
69809 }
69810 }else{
69811 iKey ^= 0x204000;
69812 }
69813 }else{
69814 iKey ^= 0x4000;
69815 }
69816 }
69817 pIter++;
69818
69819 pInfo->nKey = *(i64*)&iKey;
@@ -69750,14 +69886,57 @@
69886 ** data header and the local payload, but not any overflow page or
69887 ** the space used by the cell pointer.
69888 **
69889 ** cellSizePtrNoPayload() => table internal nodes
69890 ** cellSizePtrTableLeaf() => table leaf nodes
69891 ** cellSizePtr() => index internal nodes
69892 ** cellSizeIdxLeaf() => index leaf nodes
69893 */
69894 static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
69895 u8 *pIter = pCell + 4; /* For looping over bytes of pCell */
69896 u8 *pEnd; /* End mark for a varint */
69897 u32 nSize; /* Size value to return */
69898
69899 #ifdef SQLITE_DEBUG
69900 /* The value returned by this function should always be the same as
69901 ** the (CellInfo.nSize) value found by doing a full parse of the
69902 ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of
69903 ** this function verifies that this invariant is not violated. */
69904 CellInfo debuginfo;
69905 pPage->xParseCell(pPage, pCell, &debuginfo);
69906 #endif
69907
69908 assert( pPage->childPtrSize==4 );
69909 nSize = *pIter;
69910 if( nSize>=0x80 ){
69911 pEnd = &pIter[8];
69912 nSize &= 0x7f;
69913 do{
69914 nSize = (nSize<<7) | (*++pIter & 0x7f);
69915 }while( *(pIter)>=0x80 && pIter<pEnd );
69916 }
69917 pIter++;
69918 testcase( nSize==pPage->maxLocal );
69919 testcase( nSize==(u32)pPage->maxLocal+1 );
69920 if( nSize<=pPage->maxLocal ){
69921 nSize += (u32)(pIter - pCell);
69922 assert( nSize>4 );
69923 }else{
69924 int minLocal = pPage->minLocal;
69925 nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4);
69926 testcase( nSize==pPage->maxLocal );
69927 testcase( nSize==(u32)pPage->maxLocal+1 );
69928 if( nSize>pPage->maxLocal ){
69929 nSize = minLocal;
69930 }
69931 nSize += 4 + (u16)(pIter - pCell);
69932 }
69933 assert( nSize==debuginfo.nSize || CORRUPT_DB );
69934 return (u16)nSize;
69935 }
69936 static u16 cellSizePtrIdxLeaf(MemPage *pPage, u8 *pCell){
69937 u8 *pIter = pCell; /* For looping over bytes of pCell */
69938 u8 *pEnd; /* End mark for a varint */
69939 u32 nSize; /* Size value to return */
69940
69941 #ifdef SQLITE_DEBUG
69942 /* The value returned by this function should always be the same as
@@ -69766,10 +69945,11 @@
69945 ** this function verifies that this invariant is not violated. */
69946 CellInfo debuginfo;
69947 pPage->xParseCell(pPage, pCell, &debuginfo);
69948 #endif
69949
69950 assert( pPage->childPtrSize==0 );
69951 nSize = *pIter;
69952 if( nSize>=0x80 ){
69953 pEnd = &pIter[8];
69954 nSize &= 0x7f;
69955 do{
@@ -70002,14 +70182,14 @@
70182 testcase( pc==iCellFirst );
70183 testcase( pc==iCellLast );
70184 /* These conditions have already been verified in btreeInitPage()
70185 ** if PRAGMA cell_size_check=ON.
70186 */
70187 if( pc>iCellLast ){
70188 return SQLITE_CORRUPT_PAGE(pPage);
70189 }
70190 assert( pc>=0 && pc<=iCellLast );
70191 size = pPage->xCellSize(pPage, &src[pc]);
70192 cbrk -= size;
70193 if( cbrk<iCellStart || pc+size>usableSize ){
70194 return SQLITE_CORRUPT_PAGE(pPage);
70195 }
@@ -70347,18 +70527,18 @@
70527 pPage->maxLocal = pBt->maxLeaf;
70528 pPage->minLocal = pBt->minLeaf;
70529 }else if( flagByte==(PTF_ZERODATA | PTF_LEAF) ){
70530 pPage->intKey = 0;
70531 pPage->intKeyLeaf = 0;
70532 pPage->xCellSize = cellSizePtrIdxLeaf;
70533 pPage->xParseCell = btreeParseCellPtrIndex;
70534 pPage->maxLocal = pBt->maxLocal;
70535 pPage->minLocal = pBt->minLocal;
70536 }else{
70537 pPage->intKey = 0;
70538 pPage->intKeyLeaf = 0;
70539 pPage->xCellSize = cellSizePtrIdxLeaf;
70540 pPage->xParseCell = btreeParseCellPtrIndex;
70541 return SQLITE_CORRUPT_PAGE(pPage);
70542 }
70543 }else{
70544 pPage->childPtrSize = 4;
@@ -72220,11 +72400,11 @@
72400 assert( sqlite3_mutex_held(pBt->mutex) );
72401 assert( pDbPage->pBt==pBt );
72402 if( iDbPage<3 ) return SQLITE_CORRUPT_BKPT;
72403
72404 /* Move page iDbPage from its current location to page number iFreePage */
72405 TRACE(("AUTOVACUUM: Moving %u to free page %u (ptr page %u type %u)\n",
72406 iDbPage, iFreePage, iPtrPage, eType));
72407 rc = sqlite3PagerMovepage(pPager, pDbPage->pDbPage, iFreePage, isCommit);
72408 if( rc!=SQLITE_OK ){
72409 return rc;
72410 }
@@ -74506,11 +74686,12 @@
74686 }
74687 }
74688
74689 pPage = pCur->pPage;
74690 idx = ++pCur->ix;
74691 if( sqlite3FaultSim(412) ) pPage->isInit = 0;
74692 if( !pPage->isInit ){
74693 return SQLITE_CORRUPT_BKPT;
74694 }
74695
74696 if( idx>=pPage->nCell ){
74697 if( !pPage->leaf ){
@@ -74769,11 +74950,11 @@
74950 }
74951 *pPgno = iTrunk;
74952 memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);
74953 *ppPage = pTrunk;
74954 pTrunk = 0;
74955 TRACE(("ALLOCATE: %u trunk - %u free pages left\n", *pPgno, n-1));
74956 }else if( k>(u32)(pBt->usableSize/4 - 2) ){
74957 /* Value of k is out of range. Database corruption */
74958 rc = SQLITE_CORRUPT_PGNO(iTrunk);
74959 goto end_allocate_page;
74960 #ifndef SQLITE_OMIT_AUTOVACUUM
@@ -74835,11 +75016,11 @@
75016 }
75017 put4byte(&pPrevTrunk->aData[0], iNewTrunk);
75018 }
75019 }
75020 pTrunk = 0;
75021 TRACE(("ALLOCATE: %u trunk - %u free pages left\n", *pPgno, n-1));
75022 #endif
75023 }else if( k>0 ){
75024 /* Extract a leaf from the trunk */
75025 u32 closest;
75026 Pgno iPage;
@@ -74880,12 +75061,12 @@
75061 if( !searchList
75062 || (iPage==nearby || (iPage<nearby && eMode==BTALLOC_LE))
75063 ){
75064 int noContent;
75065 *pPgno = iPage;
75066 TRACE(("ALLOCATE: %u was leaf %u of %u on trunk %u"
75067 ": %u more free pages\n",
75068 *pPgno, closest+1, k, pTrunk->pgno, n-1));
75069 rc = sqlite3PagerWrite(pTrunk->pDbPage);
75070 if( rc ) goto end_allocate_page;
75071 if( closest<k-1 ){
75072 memcpy(&aData[8+closest*4], &aData[4+k*4], 4);
@@ -74937,11 +75118,11 @@
75118 /* If *pPgno refers to a pointer-map page, allocate two new pages
75119 ** at the end of the file instead of one. The first allocated page
75120 ** becomes a new pointer-map page, the second is used by the caller.
75121 */
75122 MemPage *pPg = 0;
75123 TRACE(("ALLOCATE: %u from end of file (pointer-map page)\n", pBt->nPage));
75124 assert( pBt->nPage!=PENDING_BYTE_PAGE(pBt) );
75125 rc = btreeGetUnusedPage(pBt, pBt->nPage, &pPg, bNoContent);
75126 if( rc==SQLITE_OK ){
75127 rc = sqlite3PagerWrite(pPg->pDbPage);
75128 releasePage(pPg);
@@ -74960,11 +75141,11 @@
75141 rc = sqlite3PagerWrite((*ppPage)->pDbPage);
75142 if( rc!=SQLITE_OK ){
75143 releasePage(*ppPage);
75144 *ppPage = 0;
75145 }
75146 TRACE(("ALLOCATE: %u from end of file\n", *pPgno));
75147 }
75148
75149 assert( CORRUPT_DB || *pPgno!=PENDING_BYTE_PAGE(pBt) );
75150
75151 end_allocate_page:
@@ -75088,11 +75269,11 @@
75269 if( pPage && (pBt->btsFlags & BTS_SECURE_DELETE)==0 ){
75270 sqlite3PagerDontWrite(pPage->pDbPage);
75271 }
75272 rc = btreeSetHasContent(pBt, iPage);
75273 }
75274 TRACE(("FREE-PAGE: %u leaf on trunk page %u\n",pPage->pgno,pTrunk->pgno));
75275 goto freepage_out;
75276 }
75277 }
75278
75279 /* If control flows to this point, then it was not possible to add the
@@ -75109,11 +75290,11 @@
75290 goto freepage_out;
75291 }
75292 put4byte(pPage->aData, iTrunk);
75293 put4byte(&pPage->aData[4], 0);
75294 put4byte(&pPage1->aData[32], iPage);
75295 TRACE(("FREE-PAGE: %u new trunk page replacing %u\n", pPage->pgno, iTrunk));
75296
75297 freepage_out:
75298 if( pPage ){
75299 pPage->isInit = 0;
75300 }
@@ -76695,11 +76876,11 @@
76876 ** (2) pPage is a virtual root page. A virtual root page is when
76877 ** the real root page is page 1 and we are the only child of
76878 ** that page.
76879 */
76880 assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) || CORRUPT_DB);
76881 TRACE(("BALANCE: old: %u(nc=%u) %u(nc=%u) %u(nc=%u)\n",
76882 apOld[0]->pgno, apOld[0]->nCell,
76883 nOld>=2 ? apOld[1]->pgno : 0, nOld>=2 ? apOld[1]->nCell : 0,
76884 nOld>=3 ? apOld[2]->pgno : 0, nOld>=3 ? apOld[2]->nCell : 0
76885 ));
76886
@@ -76779,12 +76960,12 @@
76960 apNew[i]->pgno = pgnoB;
76961 apNew[iB]->pgno = pgnoA;
76962 }
76963 }
76964
76965 TRACE(("BALANCE: new: %u(%u nc=%u) %u(%u nc=%u) %u(%u nc=%u) "
76966 "%u(%u nc=%u) %u(%u nc=%u)\n",
76967 apNew[0]->pgno, szNew[0], cntNew[0],
76968 nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0,
76969 nNew>=2 ? cntNew[1] - cntNew[0] - !leafData : 0,
76970 nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0,
76971 nNew>=3 ? cntNew[2] - cntNew[1] - !leafData : 0,
@@ -77025,11 +77206,11 @@
77206 ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);
77207 }
77208 }
77209
77210 assert( pParent->isInit );
77211 TRACE(("BALANCE: finished: old=%u new=%u cells=%u\n",
77212 nOld, nNew, b.nCell));
77213
77214 /* Free any old pages that were not reused as new pages.
77215 */
77216 for(i=nNew; i<nOld; i++){
@@ -77110,11 +77291,11 @@
77291 }
77292 assert( sqlite3PagerIswriteable(pChild->pDbPage) );
77293 assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
77294 assert( pChild->nCell==pRoot->nCell || CORRUPT_DB );
77295
77296 TRACE(("BALANCE: copy root %u into %u\n", pRoot->pgno, pChild->pgno));
77297
77298 /* Copy the overflow cells from pRoot to pChild */
77299 memcpy(pChild->aiOvfl, pRoot->aiOvfl,
77300 pRoot->nOverflow*sizeof(pRoot->aiOvfl[0]));
77301 memcpy(pChild->apOvfl, pRoot->apOvfl,
@@ -77608,11 +77789,11 @@
77789 rc = btreeComputeFreeSpace(pPage);
77790 }
77791 if( rc ) return rc;
77792 }
77793
77794 TRACE(("INSERT: table=%u nkey=%lld ndata=%u page=%u %s\n",
77795 pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
77796 loc==0 ? "overwrite" : "new entry"));
77797 assert( pPage->isInit || CORRUPT_DB );
77798 newCell = p->pBt->pTmpSpace;
77799 assert( newCell!=0 );
@@ -77635,10 +77816,11 @@
77816 if( rc ) goto end_insert;
77817 }
77818 assert( szNew==pPage->xCellSize(pPage, newCell) );
77819 assert( szNew <= MX_CELL_SIZE(p->pBt) );
77820 idx = pCur->ix;
77821 pCur->info.nSize = 0;
77822 if( loc==0 ){
77823 CellInfo info;
77824 assert( idx>=0 );
77825 if( idx>=pPage->nCell ){
77826 return SQLITE_CORRUPT_BKPT;
@@ -77707,11 +77889,10 @@
77889 ** the b-tree if possible. If the cursor is left pointing to the last
77890 ** entry in the table, and the next row inserted has an integer key
77891 ** larger than the largest existing key, it is possible to insert the
77892 ** row without seeking the cursor. This can be a big performance boost.
77893 */
 
77894 if( pPage->nOverflow ){
77895 assert( rc==SQLITE_OK );
77896 pCur->curFlags &= ~(BTCF_ValidNKey);
77897 rc = balance(pCur);
77898
@@ -78656,11 +78837,12 @@
78837 va_start(ap, zFormat);
78838 if( pCheck->errMsg.nChar ){
78839 sqlite3_str_append(&pCheck->errMsg, "\n", 1);
78840 }
78841 if( pCheck->zPfx ){
78842 sqlite3_str_appendf(&pCheck->errMsg, pCheck->zPfx,
78843 pCheck->v0, pCheck->v1, pCheck->v2);
78844 }
78845 sqlite3_str_vappendf(&pCheck->errMsg, zFormat, ap);
78846 va_end(ap);
78847 if( pCheck->errMsg.accError==SQLITE_NOMEM ){
78848 checkOom(pCheck);
@@ -78696,15 +78878,15 @@
78878 **
78879 ** Also check that the page number is in bounds.
78880 */
78881 static int checkRef(IntegrityCk *pCheck, Pgno iPage){
78882 if( iPage>pCheck->nPage || iPage==0 ){
78883 checkAppendMsg(pCheck, "invalid page number %u", iPage);
78884 return 1;
78885 }
78886 if( getPageReferenced(pCheck, iPage) ){
78887 checkAppendMsg(pCheck, "2nd reference to page %u", iPage);
78888 return 1;
78889 }
78890 setPageReferenced(pCheck, iPage);
78891 return 0;
78892 }
@@ -78726,17 +78908,17 @@
78908 Pgno iPtrmapParent;
78909
78910 rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent);
78911 if( rc!=SQLITE_OK ){
78912 if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) checkOom(pCheck);
78913 checkAppendMsg(pCheck, "Failed to read ptrmap key=%u", iChild);
78914 return;
78915 }
78916
78917 if( ePtrmapType!=eType || iPtrmapParent!=iParent ){
78918 checkAppendMsg(pCheck,
78919 "Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)",
78920 iChild, eType, iParent, ePtrmapType, iPtrmapParent);
78921 }
78922 }
78923 #endif
78924
@@ -78757,11 +78939,11 @@
78939 DbPage *pOvflPage;
78940 unsigned char *pOvflData;
78941 if( checkRef(pCheck, iPage) ) break;
78942 N--;
78943 if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage, 0) ){
78944 checkAppendMsg(pCheck, "failed to get page %u", iPage);
78945 break;
78946 }
78947 pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage);
78948 if( isFreeList ){
78949 u32 n = (u32)get4byte(&pOvflData[4]);
@@ -78770,11 +78952,11 @@
78952 checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0);
78953 }
78954 #endif
78955 if( n>pCheck->pBt->usableSize/4-2 ){
78956 checkAppendMsg(pCheck,
78957 "freelist leaf count too big on page %u", iPage);
78958 N--;
78959 }else{
78960 for(i=0; i<(int)n; i++){
78961 Pgno iFreePage = get4byte(&pOvflData[8+i*4]);
78962 #ifndef SQLITE_OMIT_AUTOVACUUM
@@ -78802,11 +78984,11 @@
78984 iPage = get4byte(pOvflData);
78985 sqlite3PagerUnref(pOvflPage);
78986 }
78987 if( N && nErrAtStart==pCheck->nErr ){
78988 checkAppendMsg(pCheck,
78989 "%s is %u but should be %u",
78990 isFreeList ? "size" : "overflow list length",
78991 expected-N, expected);
78992 }
78993 }
78994 #endif /* SQLITE_OMIT_INTEGRITY_CHECK */
@@ -78917,12 +79099,12 @@
79099 if( pCheck->mxErr==0 ) goto end_of_check;
79100 pBt = pCheck->pBt;
79101 usableSize = pBt->usableSize;
79102 if( iPage==0 ) return 0;
79103 if( checkRef(pCheck, iPage) ) return 0;
79104 pCheck->zPfx = "Tree %u page %u: ";
79105 pCheck->v0 = pCheck->v1 = iPage;
79106 if( (rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0 ){
79107 checkAppendMsg(pCheck,
79108 "unable to get the page. error code=%d", rc);
79109 goto end_of_check;
79110 }
@@ -78944,11 +79126,11 @@
79126 }
79127 data = pPage->aData;
79128 hdr = pPage->hdrOffset;
79129
79130 /* Set up for cell analysis */
79131 pCheck->zPfx = "Tree %u page %u cell %u: ";
79132 contentOffset = get2byteNotZero(&data[hdr+5]);
79133 assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */
79134
79135 /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
79136 ** number of cells on the page. */
@@ -78964,11 +79146,11 @@
79146 if( !pPage->leaf ){
79147 /* Analyze the right-child page of internal pages */
79148 pgno = get4byte(&data[hdr+8]);
79149 #ifndef SQLITE_OMIT_AUTOVACUUM
79150 if( pBt->autoVacuum ){
79151 pCheck->zPfx = "Tree %u page %u right child: ";
79152 checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage);
79153 }
79154 #endif
79155 depth = checkTreePage(pCheck, pgno, &maxKey, maxKey);
79156 keyCanBeEqual = 0;
@@ -78988,11 +79170,11 @@
79170 pCheck->v2 = i;
79171 assert( pCellIdx==&data[cellStart + i*2] );
79172 pc = get2byteAligned(pCellIdx);
79173 pCellIdx -= 2;
79174 if( pc<contentOffset || pc>usableSize-4 ){
79175 checkAppendMsg(pCheck, "Offset %u out of range %u..%u",
79176 pc, contentOffset, usableSize-4);
79177 doCoverageCheck = 0;
79178 continue;
79179 }
79180 pCell = &data[pc];
@@ -79120,11 +79302,11 @@
79302 ** EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the
79303 ** number of fragmented free bytes within the cell content area.
79304 */
79305 if( heap[0]==0 && nFrag!=data[hdr+7] ){
79306 checkAppendMsg(pCheck,
79307 "Fragmentation of %u bytes reported as %u on page %u",
79308 nFrag, data[hdr+7], iPage);
79309 }
79310 }
79311
79312 end_of_check:
@@ -79217,11 +79399,11 @@
79399 if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i);
79400
79401 /* Check the integrity of the freelist
79402 */
79403 if( bCkFreelist ){
79404 sCheck.zPfx = "Freelist: ";
79405 checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]),
79406 get4byte(&pBt->pPage1->aData[36]));
79407 sCheck.zPfx = 0;
79408 }
79409
@@ -79234,11 +79416,11 @@
79416 Pgno mxInHdr;
79417 for(i=0; (int)i<nRoot; i++) if( mx<aRoot[i] ) mx = aRoot[i];
79418 mxInHdr = get4byte(&pBt->pPage1->aData[52]);
79419 if( mx!=mxInHdr ){
79420 checkAppendMsg(&sCheck,
79421 "max rootpage (%u) disagrees with header (%u)",
79422 mx, mxInHdr
79423 );
79424 }
79425 }else if( get4byte(&pBt->pPage1->aData[64])!=0 ){
79426 checkAppendMsg(&sCheck,
@@ -79265,23 +79447,23 @@
79447 */
79448 if( !bPartial ){
79449 for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){
79450 #ifdef SQLITE_OMIT_AUTOVACUUM
79451 if( getPageReferenced(&sCheck, i)==0 ){
79452 checkAppendMsg(&sCheck, "Page %u: never used", i);
79453 }
79454 #else
79455 /* If the database supports auto-vacuum, make sure no tables contain
79456 ** references to pointer-map pages.
79457 */
79458 if( getPageReferenced(&sCheck, i)==0 &&
79459 (PTRMAP_PAGENO(pBt, i)!=i || !pBt->autoVacuum) ){
79460 checkAppendMsg(&sCheck, "Page %u: never used", i);
79461 }
79462 if( getPageReferenced(&sCheck, i)!=0 &&
79463 (PTRMAP_PAGENO(pBt, i)==i && pBt->autoVacuum) ){
79464 checkAppendMsg(&sCheck, "Page %u: pointer map referenced", i);
79465 }
79466 #endif
79467 }
79468 }
79469
@@ -81889,20 +82071,15 @@
82071 rc = ctx.isError;
82072 sqlite3ErrorMsg(pCtx->pParse, "%s", sqlite3_value_text(pVal));
82073 }else{
82074 sqlite3ValueApplyAffinity(pVal, aff, SQLITE_UTF8);
82075 assert( rc==SQLITE_OK );
 
 
 
 
82076 rc = sqlite3VdbeChangeEncoding(pVal, enc);
82077 if( NEVER(rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal)) ){
82078 rc = SQLITE_TOOBIG;
82079 pCtx->pParse->nErr++;
82080 }
 
82081 }
82082
82083 value_from_function_out:
82084 if( rc!=SQLITE_OK ){
82085 pVal = 0;
@@ -81962,10 +82139,17 @@
82139 assert( !ExprHasProperty(pExpr, EP_IntValue) );
82140 aff = sqlite3AffinityType(pExpr->u.zToken,0);
82141 rc = valueFromExpr(db, pExpr->pLeft, enc, aff, ppVal, pCtx);
82142 testcase( rc!=SQLITE_OK );
82143 if( *ppVal ){
82144 #ifdef SQLITE_ENABLE_STAT4
82145 rc = ExpandBlob(*ppVal);
82146 #else
82147 /* zero-blobs only come from functions, not literal values. And
82148 ** functions are only processed under STAT4 */
82149 assert( (ppVal[0][0].flags & MEM_Zero)==0 );
82150 #endif
82151 sqlite3VdbeMemCast(*ppVal, aff, enc);
82152 sqlite3ValueApplyAffinity(*ppVal, affinity, enc);
82153 }
82154 return rc;
82155 }
@@ -82808,14 +82992,14 @@
82992 ** If the bPush flag is true, then make this opcode the parent for
82993 ** subsequent Explains until sqlite3VdbeExplainPop() is called.
82994 */
82995 SQLITE_PRIVATE int sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){
82996 int addr = 0;
82997 #if !defined(SQLITE_DEBUG)
82998 /* Always include the OP_Explain opcodes if SQLITE_DEBUG is defined.
82999 ** But omit them (for performance) during production builds */
83000 if( pParse->explain==2 || IS_STMT_SCANSTATUS(pParse->db) )
83001 #endif
83002 {
83003 char *zMsg;
83004 Vdbe *v;
83005 va_list ap;
@@ -83487,22 +83671,24 @@
83671 int addrLoop, /* Address of loop counter */
83672 int addrVisit, /* Address of rows visited counter */
83673 LogEst nEst, /* Estimated number of output rows */
83674 const char *zName /* Name of table or index being scanned */
83675 ){
83676 if( IS_STMT_SCANSTATUS(p->db) ){
83677 sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus);
83678 ScanStatus *aNew;
83679 aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte);
83680 if( aNew ){
83681 ScanStatus *pNew = &aNew[p->nScan++];
83682 memset(pNew, 0, sizeof(ScanStatus));
83683 pNew->addrExplain = addrExplain;
83684 pNew->addrLoop = addrLoop;
83685 pNew->addrVisit = addrVisit;
83686 pNew->nEst = nEst;
83687 pNew->zName = sqlite3DbStrDup(p->db, zName);
83688 p->aScan = aNew;
83689 }
83690 }
83691 }
83692
83693 /*
83694 ** Add the range of instructions from addrStart to addrEnd (inclusive) to
@@ -83515,24 +83701,26 @@
83701 Vdbe *p,
83702 int addrExplain,
83703 int addrStart,
83704 int addrEnd
83705 ){
83706 if( IS_STMT_SCANSTATUS(p->db) ){
83707 ScanStatus *pScan = 0;
83708 int ii;
83709 for(ii=p->nScan-1; ii>=0; ii--){
83710 pScan = &p->aScan[ii];
83711 if( pScan->addrExplain==addrExplain ) break;
83712 pScan = 0;
83713 }
83714 if( pScan ){
83715 if( addrEnd<0 ) addrEnd = sqlite3VdbeCurrentAddr(p)-1;
83716 for(ii=0; ii<ArraySize(pScan->aAddrRange); ii+=2){
83717 if( pScan->aAddrRange[ii]==0 ){
83718 pScan->aAddrRange[ii] = addrStart;
83719 pScan->aAddrRange[ii+1] = addrEnd;
83720 break;
83721 }
83722 }
83723 }
83724 }
83725 }
83726
@@ -83545,23 +83733,25 @@
83733 Vdbe *p,
83734 int addrExplain,
83735 int addrLoop,
83736 int addrVisit
83737 ){
83738 if( IS_STMT_SCANSTATUS(p->db) ){
83739 ScanStatus *pScan = 0;
83740 int ii;
83741 for(ii=p->nScan-1; ii>=0; ii--){
83742 pScan = &p->aScan[ii];
83743 if( pScan->addrExplain==addrExplain ) break;
83744 pScan = 0;
83745 }
83746 if( pScan ){
83747 pScan->addrLoop = addrLoop;
83748 pScan->addrVisit = addrVisit;
83749 }
83750 }
83751 }
83752 #endif /* defined(SQLITE_ENABLE_STMT_SCANSTATUS) */
83753
83754
83755 /*
83756 ** Change the value of the opcode, or P1, P2, P3, or P5 operands
83757 ** for a specific instruction.
@@ -86003,13 +86193,13 @@
86193 vdbeFreeOpArray(db, p->aOp, p->nOp);
86194 if( p->zSql ) sqlite3DbNNFreeNN(db, p->zSql);
86195 #ifdef SQLITE_ENABLE_NORMALIZE
86196 sqlite3DbFree(db, p->zNormSql);
86197 {
86198 DblquoteStr *pThis, *pNxt;
86199 for(pThis=p->pDblStr; pThis; pThis=pNxt){
86200 pNxt = pThis->pNextStr;
86201 sqlite3DbFree(db, pThis);
86202 }
86203 }
86204 #endif
86205 #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
@@ -89885,19 +90075,28 @@
90075 int iScanStatusOp, /* Which metric to return */
90076 int flags,
90077 void *pOut /* OUT: Write the answer here */
90078 ){
90079 Vdbe *p = (Vdbe*)pStmt;
90080 VdbeOp *aOp = p->aOp;
90081 int nOp = p->nOp;
90082 ScanStatus *pScan = 0;
90083 int idx;
90084
90085 if( p->pFrame ){
90086 VdbeFrame *pFrame;
90087 for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent);
90088 aOp = pFrame->aOp;
90089 nOp = pFrame->nOp;
90090 }
90091
90092 if( iScan<0 ){
90093 int ii;
90094 if( iScanStatusOp==SQLITE_SCANSTAT_NCYCLE ){
90095 i64 res = 0;
90096 for(ii=0; ii<nOp; ii++){
90097 res += aOp[ii].nCycle;
90098 }
90099 *(i64*)pOut = res;
90100 return 0;
90101 }
90102 return 1;
@@ -89919,19 +90118,19 @@
90118 if( idx>=p->nScan ) return 1;
90119
90120 switch( iScanStatusOp ){
90121 case SQLITE_SCANSTAT_NLOOP: {
90122 if( pScan->addrLoop>0 ){
90123 *(sqlite3_int64*)pOut = aOp[pScan->addrLoop].nExec;
90124 }else{
90125 *(sqlite3_int64*)pOut = -1;
90126 }
90127 break;
90128 }
90129 case SQLITE_SCANSTAT_NVISIT: {
90130 if( pScan->addrVisit>0 ){
90131 *(sqlite3_int64*)pOut = aOp[pScan->addrVisit].nExec;
90132 }else{
90133 *(sqlite3_int64*)pOut = -1;
90134 }
90135 break;
90136 }
@@ -89949,27 +90148,27 @@
90148 *(const char**)pOut = pScan->zName;
90149 break;
90150 }
90151 case SQLITE_SCANSTAT_EXPLAIN: {
90152 if( pScan->addrExplain ){
90153 *(const char**)pOut = aOp[ pScan->addrExplain ].p4.z;
90154 }else{
90155 *(const char**)pOut = 0;
90156 }
90157 break;
90158 }
90159 case SQLITE_SCANSTAT_SELECTID: {
90160 if( pScan->addrExplain ){
90161 *(int*)pOut = aOp[ pScan->addrExplain ].p1;
90162 }else{
90163 *(int*)pOut = -1;
90164 }
90165 break;
90166 }
90167 case SQLITE_SCANSTAT_PARENTID: {
90168 if( pScan->addrExplain ){
90169 *(int*)pOut = aOp[ pScan->addrExplain ].p2;
90170 }else{
90171 *(int*)pOut = -1;
90172 }
90173 break;
90174 }
@@ -89983,22 +90182,22 @@
90182 int iIns = pScan->aAddrRange[ii];
90183 int iEnd = pScan->aAddrRange[ii+1];
90184 if( iIns==0 ) break;
90185 if( iIns>0 ){
90186 while( iIns<=iEnd ){
90187 res += aOp[iIns].nCycle;
90188 iIns++;
90189 }
90190 }else{
90191 int iOp;
90192 for(iOp=0; iOp<nOp; iOp++){
90193 Op *pOp = &aOp[iOp];
90194 if( pOp->p1!=iEnd ) continue;
90195 if( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_NCYCLE)==0 ){
90196 continue;
90197 }
90198 res += aOp[iOp].nCycle;
90199 }
90200 }
90201 }
90202 }
90203 *(i64*)pOut = res;
@@ -90917,11 +91116,14 @@
91116 if( p->flags & (MEM_Int|MEM_IntReal) ){
91117 h += p->u.i;
91118 }else if( p->flags & MEM_Real ){
91119 h += sqlite3VdbeIntValue(p);
91120 }else if( p->flags & (MEM_Str|MEM_Blob) ){
91121 /* All strings have the same hash and all blobs have the same hash,
91122 ** though, at least, those hashes are different from each other and
91123 ** from NULL. */
91124 h += 4093 + (p->flags & (MEM_Str|MEM_Blob));
91125 }
91126 }
91127 return h;
91128 }
91129
@@ -90967,10 +91169,11 @@
91169 Mem *pIn2 = 0; /* 2nd input operand */
91170 Mem *pIn3 = 0; /* 3rd input operand */
91171 Mem *pOut = 0; /* Output operand */
91172 #if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE)
91173 u64 *pnCycle = 0;
91174 int bStmtScanStatus = IS_STMT_SCANSTATUS(db)!=0;
91175 #endif
91176 /*** INSERT STACK UNION HERE ***/
91177
91178 assert( p->eVdbeState==VDBE_RUN_STATE ); /* sqlite3_step() verifies this */
91179 if( DbMaskNonZero(p->lockMask) ){
@@ -91031,17 +91234,21 @@
91234 ** jumps to abort_due_to_error. */
91235 assert( rc==SQLITE_OK );
91236
91237 assert( pOp>=aOp && pOp<&aOp[p->nOp]);
91238 nVmStep++;
91239
91240 #if defined(VDBE_PROFILE)
91241 pOp->nExec++;
91242 pnCycle = &pOp->nCycle;
91243 if( sqlite3NProfileCnt==0 ) *pnCycle -= sqlite3Hwtime();
91244 #elif defined(SQLITE_ENABLE_STMT_SCANSTATUS)
91245 if( bStmtScanStatus ){
91246 pOp->nExec++;
91247 pnCycle = &pOp->nCycle;
91248 *pnCycle -= sqlite3Hwtime();
91249 }
91250 #endif
91251
91252 /* Only allow tracing if SQLITE_DEBUG is defined.
91253 */
91254 #ifdef SQLITE_DEBUG
@@ -92851,10 +93058,16 @@
93058 ** from the value in that register.
93059 **
93060 ** P5 is a bitmask of data types. SQLITE_INTEGER is the least significant
93061 ** (0x01) bit. SQLITE_FLOAT is the 0x02 bit. SQLITE_TEXT is 0x04.
93062 ** SQLITE_BLOB is 0x08. SQLITE_NULL is 0x10.
93063 **
93064 ** WARNING: This opcode does not reliably distinguish between NULL and REAL
93065 ** when P1>=0. If the database contains a NaN value, this opcode will think
93066 ** that the datatype is REAL when it should be NULL. When P1<0 and the value
93067 ** is already stored in register P3, then this opcode does reliably
93068 ** distinguish between NULL and REAL. The problem only arises then P1>=0.
93069 **
93070 ** Take the jump to address P2 if and only if the datatype of the
93071 ** value determined by P1 and P3 corresponds to one of the bits in the
93072 ** P5 bitmask.
93073 **
@@ -95199,10 +95412,11 @@
95412 #endif
95413 VdbeBranchTaken(0,3);
95414 break;
95415 }
95416 nStep--;
95417 pC->cacheStatus = CACHE_STALE;
95418 rc = sqlite3BtreeNext(pC->uc.pCursor, 0);
95419 if( rc ){
95420 if( rc==SQLITE_DONE ){
95421 rc = SQLITE_OK;
95422 goto seekscan_search_fail;
@@ -97851,10 +98065,11 @@
98065 sqlite3VdbeError(p, "%s", sqlite3_value_text(pMem));
98066 goto abort_due_to_error;
98067 }
98068 sqlite3VdbeChangeEncoding(pMem, encoding);
98069 UPDATE_MAX_BLOBSIZE(pMem);
98070 REGISTER_TRACE((int)(pMem-aMem), pMem);
98071 break;
98072 }
98073
98074 #ifndef SQLITE_OMIT_WAL
98075 /* Opcode: Checkpoint P1 P2 P3 * *
@@ -98989,12 +99204,14 @@
99204
99205 #if defined(VDBE_PROFILE)
99206 *pnCycle += sqlite3NProfileCnt ? sqlite3NProfileCnt : sqlite3Hwtime();
99207 pnCycle = 0;
99208 #elif defined(SQLITE_ENABLE_STMT_SCANSTATUS)
99209 if( pnCycle ){
99210 *pnCycle += sqlite3Hwtime();
99211 pnCycle = 0;
99212 }
99213 #endif
99214
99215 /* The following code adds nothing to the actual functionality
99216 ** of the program. It is only here for testing and debugging.
99217 ** On the other hand, it does burn CPU cycles every time through
@@ -104016,11 +104233,12 @@
104233 if( pParse->pTriggerTab!=0 ){
104234 int op = pParse->eTriggerOp;
104235 assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT );
104236 if( pParse->bReturning ){
104237 if( (pNC->ncFlags & NC_UBaseReg)!=0
104238 && ALWAYS(zTab==0
104239 || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0)
104240 ){
104241 pExpr->iTable = op!=TK_DELETE;
104242 pTab = pParse->pTriggerTab;
104243 }
104244 }else if( op!=TK_DELETE && zTab && sqlite3StrICmp("new",zTab) == 0 ){
@@ -108362,11 +108580,11 @@
108580
108581 /*
108582 ** pX is the RHS of an IN operator. If pX is a SELECT statement
108583 ** that can be simplified to a direct table access, then return
108584 ** a pointer to the SELECT statement. If pX is not a SELECT statement,
108585 ** or if the SELECT statement needs to be materialized into a transient
108586 ** table, then return NULL.
108587 */
108588 #ifndef SQLITE_OMIT_SUBQUERY
108589 static Select *isCandidateForInOpt(const Expr *pX){
108590 Select *p;
@@ -109551,10 +109769,11 @@
109769 Column *pCol, /* The generated column */
109770 int regOut /* Put the result in this register */
109771 ){
109772 int iAddr;
109773 Vdbe *v = pParse->pVdbe;
109774 int nErr = pParse->nErr;
109775 assert( v!=0 );
109776 assert( pParse->iSelfTab!=0 );
109777 if( pParse->iSelfTab>0 ){
109778 iAddr = sqlite3VdbeAddOp3(v, OP_IfNullRow, pParse->iSelfTab-1, 0, regOut);
109779 }else{
@@ -109563,10 +109782,11 @@
109782 sqlite3ExprCodeCopy(pParse, sqlite3ColumnExpr(pTab,pCol), regOut);
109783 if( pCol->affinity>=SQLITE_AFF_TEXT ){
109784 sqlite3VdbeAddOp4(v, OP_Affinity, regOut, 1, 0, &pCol->affinity, 1);
109785 }
109786 if( iAddr ) sqlite3VdbeJumpHere(v, iAddr);
109787 if( pParse->nErr>nErr ) pParse->db->errByteOffset = -1;
109788 }
109789 #endif /* SQLITE_OMIT_GENERATED_COLUMNS */
109790
109791 /*
109792 ** Generate code to extract the value of the iCol-th column of a table.
@@ -109932,11 +110152,23 @@
110152 switch( op ){
110153 case TK_AGG_COLUMN: {
110154 AggInfo *pAggInfo = pExpr->pAggInfo;
110155 struct AggInfo_col *pCol;
110156 assert( pAggInfo!=0 );
110157 assert( pExpr->iAgg>=0 );
110158 if( pExpr->iAgg>=pAggInfo->nColumn ){
110159 /* Happens when the left table of a RIGHT JOIN is null and
110160 ** is using an expression index */
110161 sqlite3VdbeAddOp2(v, OP_Null, 0, target);
110162 #ifdef SQLITE_VDBE_COVERAGE
110163 /* Verify that the OP_Null above is exercised by tests
110164 ** tag-20230325-2 */
110165 sqlite3VdbeAddOp2(v, OP_NotNull, target, 1);
110166 VdbeCoverageNeverTaken(v);
110167 #endif
110168 break;
110169 }
110170 pCol = &pAggInfo->aCol[pExpr->iAgg];
110171 if( !pAggInfo->directMode ){
110172 return AggInfoColumnReg(pAggInfo, pExpr->iAgg);
110173 }else if( pAggInfo->useSortingIdx ){
110174 Table *pTab = pCol->pTab;
@@ -110107,15 +110339,12 @@
110339 return pExpr->iTable;
110340 }
110341 #ifndef SQLITE_OMIT_CAST
110342 case TK_CAST: {
110343 /* Expressions of the form: CAST(pLeft AS token) */
110344 sqlite3ExprCode(pParse, pExpr->pLeft, target);
110345 assert( inReg==target );
 
 
 
110346 assert( !ExprHasProperty(pExpr, EP_IntValue) );
110347 sqlite3VdbeAddOp2(v, OP_Cast, target,
110348 sqlite3AffinityType(pExpr->u.zToken, 0));
110349 return inReg;
110350 }
@@ -110450,17 +110679,13 @@
110679 ** "SOFT-COLLATE" that is added to constraints that are pushed down
110680 ** from outer queries into sub-queries by the push-down optimization.
110681 ** Clear subtypes as subtypes may not cross a subquery boundary.
110682 */
110683 assert( pExpr->pLeft );
110684 sqlite3ExprCode(pParse, pExpr->pLeft, target);
110685 sqlite3VdbeAddOp1(v, OP_ClrSubtype, target);
110686 return target;
 
 
 
 
110687 }else{
110688 pExpr = pExpr->pLeft;
110689 goto expr_code_doover; /* 2018-04-28: Prevent deep recursion. */
110690 }
110691 }
@@ -110566,16 +110791,13 @@
110791 ** (1) Temporarily disable factoring of constant expressions
110792 ** (2) Make sure the computed value really is stored in register
110793 ** "target" and not someplace else.
110794 */
110795 pParse->okConstFactor = 0; /* note (1) above */
110796 sqlite3ExprCode(pParse, pExpr->pLeft, target);
110797 assert( target==inReg );
110798 pParse->okConstFactor = okConstFactor;
 
 
 
 
110799 sqlite3VdbeJumpHere(v, addrINR);
110800 break;
110801 }
110802
110803 /*
@@ -111994,23 +112216,26 @@
112216 ){
112217 AggInfo *pAggInfo = pExpr->pAggInfo;
112218 int iAgg = pExpr->iAgg;
112219 Parse *pParse = pWalker->pParse;
112220 sqlite3 *db = pParse->db;
112221 assert( iAgg>=0 );
112222 if( pExpr->op!=TK_AGG_FUNCTION ){
112223 if( iAgg<pAggInfo->nColumn
112224 && pAggInfo->aCol[iAgg].pCExpr==pExpr
112225 ){
112226 pExpr = sqlite3ExprDup(db, pExpr, 0);
112227 if( pExpr ){
112228 pAggInfo->aCol[iAgg].pCExpr = pExpr;
112229 sqlite3ExprDeferredDelete(pParse, pExpr);
112230 }
112231 }
112232 }else{
112233 assert( pExpr->op==TK_AGG_FUNCTION );
112234 if( ALWAYS(iAgg<pAggInfo->nFunc)
112235 && pAggInfo->aFunc[iAgg].pFExpr==pExpr
112236 ){
112237 pExpr = sqlite3ExprDup(db, pExpr, 0);
112238 if( pExpr ){
112239 pAggInfo->aFunc[iAgg].pFExpr = pExpr;
112240 sqlite3ExprDeferredDelete(pParse, pExpr);
112241 }
@@ -112157,10 +112382,11 @@
112382 if( sqlite3ExprCompare(0, pExpr, pIEpr->pExpr, iDataCur)==0 ) break;
112383 }
112384 if( pIEpr==0 ) break;
112385 if( NEVER(!ExprUseYTab(pExpr)) ) break;
112386 if( pExpr->pAggInfo!=0 ) break; /* Already resolved by outer context */
112387 if( pParse->nErr ){ return WRC_Abort; }
112388
112389 /* If we reach this point, it means that expression pExpr can be
112390 ** translated into a reference to an index column as described by
112391 ** pIEpr.
112392 */
@@ -112167,10 +112393,13 @@
112393 memset(&tmp, 0, sizeof(tmp));
112394 tmp.op = TK_AGG_COLUMN;
112395 tmp.iTable = pIEpr->iIdxCur;
112396 tmp.iColumn = pIEpr->iIdxCol;
112397 findOrCreateAggInfoColumn(pParse, pAggInfo, &tmp);
112398 if( pParse->nErr ){ return WRC_Abort; }
112399 assert( pAggInfo->aCol!=0 );
112400 assert( tmp.iAgg<pAggInfo->nColumn );
112401 pAggInfo->aCol[tmp.iAgg].pCExpr = pExpr;
112402 pExpr->pAggInfo = pAggInfo;
112403 pExpr->iAgg = tmp.iAgg;
112404 return WRC_Prune;
112405 }
@@ -112343,10 +112572,41 @@
112572 SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse *pParse){
112573 pParse->nTempReg = 0;
112574 pParse->nRangeReg = 0;
112575 }
112576
112577 /*
112578 ** Make sure sufficient registers have been allocated so that
112579 ** iReg is a valid register number.
112580 */
112581 SQLITE_PRIVATE void sqlite3TouchRegister(Parse *pParse, int iReg){
112582 if( pParse->nMem<iReg ) pParse->nMem = iReg;
112583 }
112584
112585 #if defined(SQLITE_ENABLE_STAT4) || defined(SQLITE_DEBUG)
112586 /*
112587 ** Return the latest reusable register in the set of all registers.
112588 ** The value returned is no less than iMin. If any register iMin or
112589 ** greater is in permanent use, then return one more than that last
112590 ** permanent register.
112591 */
112592 SQLITE_PRIVATE int sqlite3FirstAvailableRegister(Parse *pParse, int iMin){
112593 const ExprList *pList = pParse->pConstExpr;
112594 if( pList ){
112595 int i;
112596 for(i=0; i<pList->nExpr; i++){
112597 if( pList->a[i].u.iConstExprReg>=iMin ){
112598 iMin = pList->a[i].u.iConstExprReg + 1;
112599 }
112600 }
112601 }
112602 pParse->nTempReg = 0;
112603 pParse->nRangeReg = 0;
112604 return iMin;
112605 }
112606 #endif /* SQLITE_ENABLE_STAT4 || SQLITE_DEBUG */
112607
112608 /*
112609 ** Validate that no temporary register falls within the range of
112610 ** iFirst..iLast, inclusive. This routine is only call from within assert()
112611 ** statements.
112612 */
@@ -112361,10 +112621,18 @@
112621 }
112622 for(i=0; i<pParse->nTempReg; i++){
112623 if( pParse->aTempReg[i]>=iFirst && pParse->aTempReg[i]<=iLast ){
112624 return 0;
112625 }
112626 }
112627 if( pParse->pConstExpr ){
112628 ExprList *pList = pParse->pConstExpr;
112629 for(i=0; i<pList->nExpr; i++){
112630 int iReg = pList->a[i].u.iConstExprReg;
112631 if( iReg==0 ) continue;
112632 if( iReg>=iFirst && iReg<=iLast ) return 0;
112633 }
112634 }
112635 return 1;
112636 }
112637 #endif /* SQLITE_DEBUG */
112638
@@ -115645,15 +115913,19 @@
115913 int regTemp2 = iMem++; /* Second temporary use register */
115914 int regTabname = iMem++; /* Register containing table name */
115915 int regIdxname = iMem++; /* Register containing index name */
115916 int regStat1 = iMem++; /* Value for the stat column of sqlite_stat1 */
115917 int regPrev = iMem; /* MUST BE LAST (see below) */
115918 #ifdef SQLITE_ENABLE_STAT4
115919 int doOnce = 1; /* Flag for a one-time computation */
115920 #endif
115921 #ifdef SQLITE_ENABLE_PREUPDATE_HOOK
115922 Table *pStat1 = 0;
115923 #endif
115924
115925 sqlite3TouchRegister(pParse, iMem);
115926 assert( sqlite3NoTempsInRange(pParse, regNewRowid, iMem) );
115927 v = sqlite3GetVdbe(pParse);
115928 if( v==0 || NEVER(pTab==0) ){
115929 return;
115930 }
115931 if( !IsOrdinaryTable(pTab) ){
@@ -115755,11 +116027,11 @@
116027
116028 /* Make sure there are enough memory cells allocated to accommodate
116029 ** the regPrev array and a trailing rowid (the rowid slot is required
116030 ** when building a record to insert into the sample column of
116031 ** the sqlite_stat4 table. */
116032 sqlite3TouchRegister(pParse, regPrev+nColTest);
116033
116034 /* Open a read-only cursor on the index being analyzed. */
116035 assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) );
116036 sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb);
116037 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
@@ -115927,11 +116199,39 @@
116199 int regSampleRowid = regCol + nCol;
116200 int addrNext;
116201 int addrIsNull;
116202 u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound;
116203
116204 if( doOnce ){
116205 int mxCol = nCol;
116206 Index *pX;
116207
116208 /* Compute the maximum number of columns in any index */
116209 for(pX=pTab->pIndex; pX; pX=pX->pNext){
116210 int nColX; /* Number of columns in pX */
116211 if( !HasRowid(pTab) && IsPrimaryKeyIndex(pX) ){
116212 nColX = pX->nKeyCol;
116213 }else{
116214 nColX = pX->nColumn;
116215 }
116216 if( nColX>mxCol ) mxCol = nColX;
116217 }
116218
116219 /* Allocate space to compute results for the largest index */
116220 sqlite3TouchRegister(pParse, regCol+mxCol);
116221 doOnce = 0;
116222 #ifdef SQLITE_DEBUG
116223 /* Verify that the call to sqlite3ClearTempRegCache() below
116224 ** really is needed.
116225 ** https://sqlite.org/forum/forumpost/83cb4a95a0 (2023-03-25)
116226 */
116227 testcase( !sqlite3NoTempsInRange(pParse, regEq, regCol+mxCol) );
116228 #endif
116229 sqlite3ClearTempRegCache(pParse); /* tag-20230325-1 */
116230 assert( sqlite3NoTempsInRange(pParse, regEq, regCol+mxCol) );
116231 }
116232 assert( sqlite3NoTempsInRange(pParse, regEq, regCol+nCol) );
116233
116234 addrNext = sqlite3VdbeCurrentAddr(v);
116235 callStatGet(pParse, regStat, STAT_GET_ROWID, regSampleRowid);
116236 addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regSampleRowid);
116237 VdbeCoverage(v);
@@ -116008,10 +116308,15 @@
116308 iTab = pParse->nTab;
116309 assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
116310 for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
116311 Table *pTab = (Table*)sqliteHashData(k);
116312 analyzeOneTable(pParse, pTab, 0, iStatCur, iMem, iTab);
116313 #ifdef SQLITE_ENABLE_STAT4
116314 iMem = sqlite3FirstAvailableRegister(pParse, iMem);
116315 #else
116316 assert( iMem==sqlite3FirstAvailableRegister(pParse,iMem) );
116317 #endif
116318 }
116319 loadAnalysis(pParse, iDb);
116320 }
116321
116322 /*
@@ -123835,17 +124140,19 @@
124140 **
124141 ** If pTab is not writable -> generate an error message and return 1.
124142 ** If pTab is writable but other errors have occurred -> return 1.
124143 ** If pTab is writable and no prior errors -> return 0;
124144 */
124145 SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, Trigger *pTrigger){
124146 if( tabIsReadOnly(pParse, pTab) ){
124147 sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName);
124148 return 1;
124149 }
124150 #ifndef SQLITE_OMIT_VIEW
124151 if( IsView(pTab)
124152 && (pTrigger==0 || (pTrigger->bReturning && pTrigger->pNext==0))
124153 ){
124154 sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName);
124155 return 1;
124156 }
124157 #endif
124158 return 0;
@@ -124095,11 +124402,11 @@
124402 */
124403 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
124404 goto delete_from_cleanup;
124405 }
124406
124407 if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
124408 goto delete_from_cleanup;
124409 }
124410 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
124411 assert( iDb<db->nDb );
124412 rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0,
@@ -128792,49 +129099,51 @@
129099 **
129100 ** Memory for the buffer containing the column index affinity string
129101 ** is managed along with the rest of the Index structure. It will be
129102 ** released when sqlite3DeleteIndex() is called.
129103 */
129104 static SQLITE_NOINLINE const char *computeIndexAffStr(sqlite3 *db, Index *pIdx){
129105 /* The first time a column affinity string for a particular index is
129106 ** required, it is allocated and populated here. It is then stored as
129107 ** a member of the Index structure for subsequent use.
129108 **
129109 ** The column affinity string will eventually be deleted by
129110 ** sqliteDeleteIndex() when the Index structure itself is cleaned
129111 ** up.
129112 */
129113 int n;
129114 Table *pTab = pIdx->pTable;
129115 pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1);
129116 if( !pIdx->zColAff ){
129117 sqlite3OomFault(db);
129118 return 0;
129119 }
129120 for(n=0; n<pIdx->nColumn; n++){
129121 i16 x = pIdx->aiColumn[n];
129122 char aff;
129123 if( x>=0 ){
129124 aff = pTab->aCol[x].affinity;
129125 }else if( x==XN_ROWID ){
129126 aff = SQLITE_AFF_INTEGER;
129127 }else{
129128 assert( x==XN_EXPR );
129129 assert( pIdx->bHasExpr );
129130 assert( pIdx->aColExpr!=0 );
129131 aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr);
129132 }
129133 if( aff<SQLITE_AFF_BLOB ) aff = SQLITE_AFF_BLOB;
129134 if( aff>SQLITE_AFF_NUMERIC) aff = SQLITE_AFF_NUMERIC;
129135 pIdx->zColAff[n] = aff;
129136 }
129137 pIdx->zColAff[n] = 0;
129138 return pIdx->zColAff;
129139 }
129140 SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){
129141 if( !pIdx->zColAff ) return computeIndexAffStr(db, pIdx);
129142 return pIdx->zColAff;
129143 }
129144
129145
129146 /*
129147 ** Compute an affinity string for a table. Space is obtained
129148 ** from sqlite3DbMalloc(). The caller is responsible for freeing
129149 ** the space when done.
@@ -129516,11 +129825,11 @@
129825 goto insert_cleanup;
129826 }
129827
129828 /* Cannot insert into a read-only table.
129829 */
129830 if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
129831 goto insert_cleanup;
129832 }
129833
129834 /* Allocate a VDBE
129835 */
@@ -129963,11 +130272,11 @@
130272 sqlite3VdbeJumpHere(v, addr1);
130273 sqlite3VdbeAddOp1(v, OP_MustBeInt, regCols); VdbeCoverage(v);
130274 }
130275
130276 /* Copy the new data already generated. */
130277 assert( pTab->nNVCol>0 || pParse->nErr>0 );
130278 sqlite3VdbeAddOp3(v, OP_Copy, regRowid+1, regCols+1, pTab->nNVCol-1);
130279
130280 #ifndef SQLITE_OMIT_GENERATED_COLUMNS
130281 /* Compute the new value for generated columns after all other
130282 ** columns have already been computed. This must be done after
@@ -133326,19 +133635,25 @@
133635 zEntry = zProc ? zProc : "sqlite3_extension_init";
133636
133637 /* tag-20210611-1. Some dlopen() implementations will segfault if given
133638 ** an oversize filename. Most filesystems have a pathname limit of 4K,
133639 ** so limit the extension filename length to about twice that.
133640 ** https://sqlite.org/forum/forumpost/08a0d6d9bf
133641 **
133642 ** Later (2023-03-25): Save an extra 6 bytes for the filename suffix.
133643 ** See https://sqlite.org/forum/forumpost/24083b579d.
133644 */
133645 if( nMsg>SQLITE_MAX_PATHLEN ) goto extension_not_found;
133646
133647 handle = sqlite3OsDlOpen(pVfs, zFile);
133648 #if SQLITE_OS_UNIX || SQLITE_OS_WIN
133649 for(ii=0; ii<ArraySize(azEndings) && handle==0; ii++){
133650 char *zAltFile = sqlite3_mprintf("%s.%s", zFile, azEndings[ii]);
133651 if( zAltFile==0 ) return SQLITE_NOMEM_BKPT;
133652 if( nMsg+strlen(azEndings[ii])+1<=SQLITE_MAX_PATHLEN ){
133653 handle = sqlite3OsDlOpen(pVfs, zAltFile);
133654 }
133655 sqlite3_free(zAltFile);
133656 }
133657 #endif
133658 if( handle==0 ) goto extension_not_found;
133659 xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry);
@@ -135829,11 +136144,11 @@
136144 if( pTab==0 || !IsOrdinaryTable(pTab) || pTab->u.tab.pFKey==0 ) continue;
136145 iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
136146 zDb = db->aDb[iDb].zDbSName;
136147 sqlite3CodeVerifySchema(pParse, iDb);
136148 sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
136149 sqlite3TouchRegister(pParse, pTab->nCol+regRow);
136150 sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead);
136151 sqlite3VdbeLoadString(v, regResult, pTab->zName);
136152 assert( IsOrdinaryTable(pTab) );
136153 for(i=1, pFK=pTab->u.tab.pFKey; pFK; i++, pFK=pFK->pNextFrom){
136154 pParent = sqlite3FindTable(db, pFK->zTo, zDb);
@@ -135870,11 +136185,11 @@
136185
136186 /* Generate code to read the child key values into registers
136187 ** regRow..regRow+n. If any of the child key values are NULL, this
136188 ** row cannot cause an FK violation. Jump directly to addrOk in
136189 ** this case. */
136190 sqlite3TouchRegister(pParse, regRow + pFK->nCol);
136191 for(j=0; j<pFK->nCol; j++){
136192 int iCol = aiCols ? aiCols[j] : pFK->aCol[j].iFrom;
136193 sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, iCol, regRow+j);
136194 sqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk); VdbeCoverage(v);
136195 }
@@ -135999,10 +136314,11 @@
136314
136315 if( OMIT_TEMPDB && i==1 ) continue;
136316 if( iDb>=0 && i!=iDb ) continue;
136317
136318 sqlite3CodeVerifySchema(pParse, i);
136319 pParse->okConstFactor = 0; /* tag-20230327-1 */
136320
136321 /* Do an integrity check of the B-Tree
136322 **
136323 ** Begin by finding the root pages numbers
136324 ** for all tables and indices in the database.
@@ -136034,11 +136350,11 @@
136350 }
136351 }
136352 aRoot[0] = cnt;
136353
136354 /* Make sure sufficient number of registers have been allocated */
136355 sqlite3TouchRegister(pParse, 8+mxIdx);
136356 sqlite3ClearTempRegCache(pParse);
136357
136358 /* Do the b-tree integrity checks */
136359 sqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY);
136360 sqlite3VdbeChangeP5(v, (u8)i);
@@ -136184,19 +136500,33 @@
136500
136501 labelError = sqlite3VdbeMakeLabel(pParse);
136502 labelOk = sqlite3VdbeMakeLabel(pParse);
136503 if( pCol->notNull ){
136504 /* (1) NOT NULL columns may not contain a NULL */
136505 int jmp3;
136506 int jmp2 = sqlite3VdbeAddOp4Int(v, OP_IsType, p1, labelOk, p3, p4);
 
136507 VdbeCoverage(v);
136508 if( p1<0 ){
136509 sqlite3VdbeChangeP5(v, 0x0f); /* INT, REAL, TEXT, or BLOB */
136510 jmp3 = jmp2;
136511 }else{
136512 sqlite3VdbeChangeP5(v, 0x0d); /* INT, TEXT, or BLOB */
136513 /* OP_IsType does not detect NaN values in the database file
136514 ** which should be treated as a NULL. So if the header type
136515 ** is REAL, we have to load the actual data using OP_Column
136516 ** to reliably determine if the value is a NULL. */
136517 sqlite3VdbeAddOp3(v, OP_Column, p1, p3, 3);
136518 jmp3 = sqlite3VdbeAddOp2(v, OP_NotNull, 3, labelOk);
136519 VdbeCoverage(v);
136520 }
136521 zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
136522 pCol->zCnName);
136523 sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
136524 if( doTypeCheck ){
136525 sqlite3VdbeGoto(v, labelError);
136526 sqlite3VdbeJumpHere(v, jmp2);
136527 sqlite3VdbeJumpHere(v, jmp3);
136528 }else{
136529 /* VDBE byte code will fall thru */
136530 }
136531 }
136532 if( bStrict && doTypeCheck ){
@@ -136300,11 +136630,11 @@
136630 ** any extra bytes at the end. Verify that this is the case. */
136631 if( HasRowid(pTab) ){
136632 int jmp7;
136633 sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur+j, 3);
136634 jmp7 = sqlite3VdbeAddOp3(v, OP_Eq, 3, 0, r1+pIdx->nColumn-1);
136635 VdbeCoverageNeverNull(v);
136636 sqlite3VdbeLoadString(v, 3,
136637 "rowid not at end-of-record for row ");
136638 sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3);
136639 sqlite3VdbeLoadString(v, 4, " of index ");
136640 sqlite3VdbeGoto(v, jmp5-1);
@@ -142513,12 +142843,11 @@
142843 ** (17f) the subquery must not be the RHS of a LEFT JOIN.
142844 ** (17g) either the subquery is the first element of the outer
142845 ** query or there are no RIGHT or FULL JOINs in any arm
142846 ** of the subquery. (This is a duplicate of condition (27b).)
142847 ** (17h) The corresponding result set expressions in all arms of the
142848 ** compound must have the same affinity.
 
142849 **
142850 ** The parent and sub-query may contain WHERE clauses. Subject to
142851 ** rules (11), (13) and (14), they may also contain ORDER BY,
142852 ** LIMIT and OFFSET clauses. The subquery cannot use any compound
142853 ** operator other than UNION ALL because all the other compound
@@ -143382,14 +143711,10 @@
143711 **
143712 ** (8) If the subquery is a compound that uses UNION, INTERSECT,
143713 ** or EXCEPT, then all of the result set columns for all arms of
143714 ** the compound must use the BINARY collating sequence.
143715 **
 
 
 
 
143716 **
143717 ** Return 0 if no changes are made and non-zero if one or more WHERE clause
143718 ** terms are duplicated into the subquery.
143719 */
143720 static int pushDownWhereTerms(
@@ -143416,13 +143741,10 @@
143741 }
143742 #ifndef SQLITE_OMIT_WINDOWFUNC
143743 if( pSel->pWin ) return 0; /* restriction (6b) */
143744 #endif
143745 }
 
 
 
143746 if( notUnionAll ){
143747 /* If any of the compound arms are connected using UNION, INTERSECT,
143748 ** or EXCEPT, then we must ensure that none of the columns use a
143749 ** non-BINARY collating sequence. */
143750 for(pSel=pSubq; pSel; pSel=pSel->pPrior){
@@ -143509,10 +143831,80 @@
143831 }
143832 }
143833 return nChng;
143834 }
143835 #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */
143836
143837 /*
143838 ** Check to see if a subquery contains result-set columns that are
143839 ** never used. If it does, change the value of those result-set columns
143840 ** to NULL so that they do not cause unnecessary work to compute.
143841 **
143842 ** Return the number of column that were changed to NULL.
143843 */
143844 static int disableUnusedSubqueryResultColumns(SrcItem *pItem){
143845 int nCol;
143846 Select *pSub; /* The subquery to be simplified */
143847 Select *pX; /* For looping over compound elements of pSub */
143848 Table *pTab; /* The table that describes the subquery */
143849 int j; /* Column number */
143850 int nChng = 0; /* Number of columns converted to NULL */
143851 Bitmask colUsed; /* Columns that may not be NULLed out */
143852
143853 assert( pItem!=0 );
143854 if( pItem->fg.isCorrelated || pItem->fg.isCte ){
143855 return 0;
143856 }
143857 assert( pItem->pTab!=0 );
143858 pTab = pItem->pTab;
143859 assert( pItem->pSelect!=0 );
143860 pSub = pItem->pSelect;
143861 assert( pSub->pEList->nExpr==pTab->nCol );
143862 if( (pSub->selFlags & (SF_Distinct|SF_Aggregate))!=0 ){
143863 testcase( pSub->selFlags & SF_Distinct );
143864 testcase( pSub->selFlags & SF_Aggregate );
143865 return 0;
143866 }
143867 for(pX=pSub; pX; pX=pX->pPrior){
143868 if( pX->pPrior && pX->op!=TK_ALL ){
143869 /* This optimization does not work for compound subqueries that
143870 ** use UNION, INTERSECT, or EXCEPT. Only UNION ALL is allowed. */
143871 return 0;
143872 }
143873 if( pX->pWin ){
143874 /* This optimization does not work for subqueries that use window
143875 ** functions. */
143876 return 0;
143877 }
143878 }
143879 colUsed = pItem->colUsed;
143880 if( pSub->pOrderBy ){
143881 ExprList *pList = pSub->pOrderBy;
143882 for(j=0; j<pList->nExpr; j++){
143883 u16 iCol = pList->a[j].u.x.iOrderByCol;
143884 if( iCol>0 ){
143885 iCol--;
143886 colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol);
143887 }
143888 }
143889 }
143890 nCol = pTab->nCol;
143891 for(j=0; j<nCol; j++){
143892 Bitmask m = j<BMS-1 ? MASKBIT(j) : TOPBIT;
143893 if( (m & colUsed)!=0 ) continue;
143894 for(pX=pSub; pX; pX=pX->pPrior) {
143895 Expr *pY = pX->pEList->a[j].pExpr;
143896 if( pY->op==TK_NULL ) continue;
143897 pY->op = TK_NULL;
143898 ExprClearProperty(pY, EP_Skip|EP_Unlikely);
143899 pX->selFlags |= SF_PushDown;
143900 nChng++;
143901 }
143902 }
143903 return nChng;
143904 }
143905
143906
143907 /*
143908 ** The pFunc is the only aggregate function in the query. Check to see
143909 ** if the query is a candidate for the min/max optimization.
143910 **
@@ -144695,11 +145087,12 @@
145087 if( pExpr->pAggInfo==0 ) return WRC_Continue;
145088 if( pExpr->op==TK_AGG_COLUMN ) return WRC_Continue;
145089 if( pExpr->op==TK_AGG_FUNCTION ) return WRC_Continue;
145090 if( pExpr->op==TK_IF_NULL_ROW ) return WRC_Continue;
145091 pAggInfo = pExpr->pAggInfo;
145092 if( pExpr->iAgg>=pAggInfo->nColumn ) return WRC_Continue;
145093 assert( pExpr->iAgg>=0 );
145094 pCol = &pAggInfo->aCol[pExpr->iAgg];
145095 pExpr->op = TK_AGG_COLUMN;
145096 pExpr->iTable = pCol->iTable;
145097 pExpr->iColumn = pCol->iColumn;
145098 return WRC_Prune;
@@ -145053,11 +145446,10 @@
145446 sqlite3DbFree(db, p->aCol);
145447 sqlite3DbFree(db, p->aFunc);
145448 sqlite3DbFreeNN(db, p);
145449 }
145450
 
145451 /*
145452 ** Attempt to transform a query of the form
145453 **
145454 ** SELECT count(*) FROM (SELECT x FROM t1 UNION ALL SELECT y FROM t2)
145455 **
@@ -145081,10 +145473,11 @@
145473 Expr *pCount;
145474 sqlite3 *db;
145475 if( (p->selFlags & SF_Aggregate)==0 ) return 0; /* This is an aggregate */
145476 if( p->pEList->nExpr!=1 ) return 0; /* Single result column */
145477 if( p->pWhere ) return 0;
145478 if( p->pHaving ) return 0;
145479 if( p->pGroupBy ) return 0;
145480 if( p->pOrderBy ) return 0;
145481 pExpr = p->pEList->a[0].pExpr;
145482 if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */
145483 assert( ExprUseUToken(pExpr) );
@@ -145100,11 +145493,12 @@
145493 do{
145494 if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
145495 if( pSub->pWhere ) return 0; /* No WHERE clause */
145496 if( pSub->pLimit ) return 0; /* No LIMIT clause */
145497 if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */
145498 assert( pSub->pHaving==0 ); /* Due to the previous */
145499 pSub = pSub->pPrior; /* Repeat over compound */
145500 }while( pSub );
145501
145502 /* If we reach this point then it is OK to perform the transformation */
145503
145504 db = pParse->db;
@@ -145143,11 +145537,10 @@
145537 sqlite3TreeViewSelect(0, p, 0);
145538 }
145539 #endif
145540 return 1;
145541 }
 
145542
145543 /*
145544 ** If any term of pSrc, or any SF_NestedFrom sub-query, is not the same
145545 ** as pSrcItem but has the same alias as p0, then return true.
145546 ** Otherwise return false.
@@ -145532,18 +145925,16 @@
145925 #endif
145926 }else{
145927 TREETRACE(0x2000,pParse,p,("Constant propagation not helpful\n"));
145928 }
145929
 
145930 if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView)
145931 && countOfViewOptimization(pParse, p)
145932 ){
145933 if( db->mallocFailed ) goto select_end;
145934 pTabList = p->pSrc;
145935 }
 
145936
145937 /* For each term in the FROM clause, do two things:
145938 ** (1) Authorized unreferenced tables
145939 ** (2) Generate code for all sub-queries
145940 */
@@ -145611,10 +146002,26 @@
146002 #endif
146003 assert( pItem->pSelect && (pItem->pSelect->selFlags & SF_PushDown)!=0 );
146004 }else{
146005 TREETRACE(0x4000,pParse,p,("Push-down not possible\n"));
146006 }
146007
146008 /* Convert unused result columns of the subquery into simple NULL
146009 ** expressions, to avoid unneeded searching and computation.
146010 */
146011 if( OptimizationEnabled(db, SQLITE_NullUnusedCols)
146012 && disableUnusedSubqueryResultColumns(pItem)
146013 ){
146014 #if TREETRACE_ENABLED
146015 if( sqlite3TreeTrace & 0x4000 ){
146016 TREETRACE(0x4000,pParse,p,
146017 ("Change unused result columns to NULL for subquery %d:\n",
146018 pSub->selId));
146019 sqlite3TreeViewSelect(0, p, 0);
146020 }
146021 #endif
146022 }
146023
146024 zSavedAuthContext = pParse->zAuthContext;
146025 pParse->zAuthContext = pItem->zName;
146026
146027 /* Generate code to implement the subquery
@@ -148149,10 +148556,13 @@
148556 const int op = pChanges ? TK_UPDATE : TK_DELETE;
148557 u32 mask = 0;
148558 Trigger *p;
148559
148560 assert( isNew==1 || isNew==0 );
148561 if( IsView(pTab) ){
148562 return 0xffffffff;
148563 }
148564 for(p=pTrigger; p; p=p->pNext){
148565 if( p->op==op
148566 && (tr_tm&p->tr_tm)
148567 && checkColumnOverlap(p->pColumns,pChanges)
148568 ){
@@ -148583,11 +148993,11 @@
148993 #endif
148994
148995 if( sqlite3ViewGetColumnNames(pParse, pTab) ){
148996 goto update_cleanup;
148997 }
148998 if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){
148999 goto update_cleanup;
149000 }
149001
149002 /* Allocate a cursors for the main database table and for all indices.
149003 ** The index cursors might not be used, but if they are used they
@@ -152376,13 +152786,13 @@
152786 sqlite3_str_append(pStr, ")", 1);
152787 }
152788
152789 /*
152790 ** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN
152791 ** command, or if stmt_scanstatus_v2() stats are enabled, or if SQLITE_DEBUG
152792 ** was defined at compile-time. If it is not a no-op, a single OP_Explain
152793 ** opcode is added to the output to describe the table scan strategy in pLevel.
152794 **
152795 ** If an OP_Explain opcode is added to the VM, its address is returned.
152796 ** Otherwise, if no OP_Explain is coded, zero is returned.
152797 */
152798 SQLITE_PRIVATE int sqlite3WhereExplainOneScan(
@@ -152390,12 +152800,12 @@
152800 SrcList *pTabList, /* Table list this loop refers to */
152801 WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */
152802 u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */
152803 ){
152804 int ret = 0;
152805 #if !defined(SQLITE_DEBUG)
152806 if( sqlite3ParseToplevel(pParse)->explain==2 || IS_STMT_SCANSTATUS(pParse->db) )
152807 #endif
152808 {
152809 SrcItem *pItem = &pTabList->a[pLevel->iFrom];
152810 Vdbe *v = pParse->pVdbe; /* VM being constructed */
152811 sqlite3 *db = pParse->db; /* Database handle */
@@ -152557,31 +152967,33 @@
152967 Vdbe *v, /* Vdbe to add scanstatus entry to */
152968 SrcList *pSrclist, /* FROM clause pLvl reads data from */
152969 WhereLevel *pLvl, /* Level to add scanstatus() entry for */
152970 int addrExplain /* Address of OP_Explain (or 0) */
152971 ){
152972 if( IS_STMT_SCANSTATUS( sqlite3VdbeDb(v) ) ){
152973 const char *zObj = 0;
152974 WhereLoop *pLoop = pLvl->pWLoop;
152975 int wsFlags = pLoop->wsFlags;
152976 int viaCoroutine = 0;
152977
152978 if( (wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){
152979 zObj = pLoop->u.btree.pIndex->zName;
152980 }else{
152981 zObj = pSrclist->a[pLvl->iFrom].zName;
152982 viaCoroutine = pSrclist->a[pLvl->iFrom].fg.viaCoroutine;
152983 }
152984 sqlite3VdbeScanStatus(
152985 v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj
152986 );
152987
152988 if( viaCoroutine==0 ){
152989 if( (wsFlags & (WHERE_MULTI_OR|WHERE_AUTO_INDEX))==0 ){
152990 sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iTabCur);
152991 }
152992 if( wsFlags & WHERE_INDEXED ){
152993 sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iIdxCur);
152994 }
152995 }
152996 }
152997 }
152998 #endif
152999
@@ -154190,11 +154602,11 @@
154602 ** of entries in the tree, so basing the number of steps to try
154603 ** on the estimated number of rows in the btree seems like a good
154604 ** guess. */
154605 addrSeekScan = sqlite3VdbeAddOp1(v, OP_SeekScan,
154606 (pIdx->aiRowLogEst[0]+9)/10);
154607 if( pRangeStart || pRangeEnd ){
154608 sqlite3VdbeChangeP5(v, 1);
154609 sqlite3VdbeChangeP2(v, addrSeekScan, sqlite3VdbeCurrentAddr(v)+1);
154610 addrSeekScan = 0;
154611 }
154612 VdbeCoverage(v);
@@ -154231,20 +154643,11 @@
154643 */
154644 nConstraint = nEq;
154645 assert( pLevel->p2==0 );
154646 if( pRangeEnd ){
154647 Expr *pRight = pRangeEnd->pExpr->pRight;
154648 assert( addrSeekScan==0 );
 
 
 
 
 
 
 
 
 
154649 codeExprOrVector(pParse, pRight, regBase+nEq, nTop);
154650 whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd);
154651 if( (pRangeEnd->wtFlags & TERM_VNULL)==0
154652 && sqlite3ExprCanBeNull(pRight)
154653 ){
@@ -154274,11 +154677,11 @@
154677 }
154678 if( zStartAff ) sqlite3DbNNFreeNN(db, zStartAff);
154679 if( zEndAff ) sqlite3DbNNFreeNN(db, zEndAff);
154680
154681 /* Top of the loop body */
154682 pLevel->p2 = sqlite3VdbeCurrentAddr(v);
154683
154684 /* Check if the index cursor is past the end of the range. */
154685 if( nConstraint ){
154686 if( regBignull ){
154687 /* Except, skip the end-of-range check while doing the NULL-scan */
@@ -156916,13 +157319,16 @@
157319 pColRef->y.pTab = pTab;
157320 pItem->colUsed |= sqlite3ExprColUsed(pColRef);
157321 pRhs = sqlite3PExpr(pParse, TK_UPLUS,
157322 sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0);
157323 pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs);
157324 if( pItem->fg.jointype & (JT_LEFT|JT_RIGHT) ){
157325 testcase( pItem->fg.jointype & JT_LEFT ); /* testtag-20230227a */
157326 testcase( pItem->fg.jointype & JT_RIGHT ); /* testtag-20230227b */
157327 joinType = EP_OuterON;
157328 }else{
157329 testcase( pItem->fg.jointype & JT_LTORJ ); /* testtag-20230227c */
157330 joinType = EP_InnerON;
157331 }
157332 sqlite3SetJoinExpr(pTerm, pItem->iCursor, joinType);
157333 whereClauseInsert(pWC, pTerm, TERM_DYNAMIC);
157334 }
@@ -157761,11 +158167,11 @@
158167 Parse *pParse,
158168 Index *pIdx, /* Automatic index to explain */
158169 int bPartial, /* True if pIdx is a partial index */
158170 int *pAddrExplain /* OUT: Address of OP_Explain */
158171 ){
158172 if( IS_STMT_SCANSTATUS(pParse->db) && pParse->explain!=2 ){
158173 Table *pTab = pIdx->pTable;
158174 const char *zSep = "";
158175 char *zText = 0;
158176 int ii = 0;
158177 sqlite3_str *pStr = sqlite3_str_new(pParse->db);
@@ -157822,11 +158228,12 @@
158228 CollSeq *pColl; /* Collating sequence to on a column */
158229 WhereLoop *pLoop; /* The Loop object */
158230 char *zNotUsed; /* Extra space on the end of pIdx */
158231 Bitmask idxCols; /* Bitmap of columns used for indexing */
158232 Bitmask extraCols; /* Bitmap of additional columns */
158233 u8 sentWarning = 0; /* True if a warning has been issued */
158234 u8 useBloomFilter = 0; /* True to also add a Bloom filter */
158235 Expr *pPartial = 0; /* Partial Index Expression */
158236 int iContinue = 0; /* Jump here to skip excluded rows */
158237 SrcItem *pTabItem; /* FROM clause term being indexed */
158238 int addrCounter = 0; /* Address where integer counter is initialized */
158239 int regBase; /* Array of registers where record is assembled */
@@ -157892,11 +158299,15 @@
158299 ** original table never needs to be accessed. Automatic indices must
158300 ** be a covering index because the index will not be updated if the
158301 ** original table changes and the index and table cannot both be used
158302 ** if they go out of sync.
158303 */
158304 if( IsView(pTable) ){
158305 extraCols = ALLBITS;
158306 }else{
158307 extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
158308 }
158309 mxBitCol = MIN(BMS-1,pTable->nCol);
158310 testcase( pTable->nCol==BMS-1 );
158311 testcase( pTable->nCol==BMS-2 );
158312 for(i=0; i<mxBitCol; i++){
158313 if( extraCols & MASKBIT(i) ) nKeyCol++;
@@ -157928,10 +158339,20 @@
158339 pIdx->aiColumn[n] = pTerm->u.x.leftColumn;
158340 pColl = sqlite3ExprCompareCollSeq(pParse, pX);
158341 assert( pColl!=0 || pParse->nErr>0 ); /* TH3 collate01.800 */
158342 pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
158343 n++;
158344 if( ALWAYS(pX->pLeft!=0)
158345 && sqlite3ExprAffinity(pX->pLeft)!=SQLITE_AFF_TEXT
158346 ){
158347 /* TUNING: only use a Bloom filter on an automatic index
158348 ** if one or more key columns has the ability to hold numeric
158349 ** values, since strings all have the same hash in the Bloom
158350 ** filter implementation and hence a Bloom filter on a text column
158351 ** is not usually helpful. */
158352 useBloomFilter = 1;
158353 }
158354 }
158355 }
158356 }
158357 assert( (u32)n==pLoop->u.btree.nEq );
158358
@@ -157960,11 +158381,12 @@
158381 assert( pLevel->iIdxCur>=0 );
158382 pLevel->iIdxCur = pParse->nTab++;
158383 sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
158384 sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
158385 VdbeComment((v, "for %s", pTable->zName));
158386 if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) && useBloomFilter ){
158387 sqlite3WhereExplainBloomFilter(pParse, pWC->pWInfo, pLevel);
158388 pLevel->regFilter = ++pParse->nMem;
158389 sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter);
158390 }
158391
158392 /* Fill the automatic index with content */
@@ -158444,10 +158866,11 @@
158866 UNUSED_PARAMETER( pParse );
158867 #endif
158868 assert( pRec!=0 );
158869 assert( pIdx->nSample>0 );
158870 assert( pRec->nField>0 );
158871
158872
158873 /* Do a binary search to find the first sample greater than or equal
158874 ** to pRec. If pRec contains a single field, the set of samples to search
158875 ** is simply the aSample[] array. If the samples in aSample[] contain more
158876 ** than one fields, all fields following the first are ignored.
@@ -158489,11 +158912,16 @@
158912 ** appears that it should be 1 field in size. However, that would make it
158913 ** smaller than sample 1, so the binary search would not work. As a result,
158914 ** it is extended to two fields. The duplicates that this creates do not
158915 ** cause any problems.
158916 */
158917 if( !HasRowid(pIdx->pTable) && IsPrimaryKeyIndex(pIdx) ){
158918 nField = pIdx->nKeyCol;
158919 }else{
158920 nField = pIdx->nColumn;
158921 }
158922 nField = MIN(pRec->nField, nField);
158923 iCol = 0;
158924 iSample = pIdx->nSample * nField;
158925 do{
158926 int iSamp; /* Index in aSample[] of test sample */
158927 int n; /* Number of fields in test sample */
@@ -163150,11 +163578,11 @@
163578 for(; b; b=b>>1, n++){}
163579 sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(n), P4_INT32);
163580 assert( n<=pTab->nCol );
163581 }
163582 #ifdef SQLITE_ENABLE_CURSOR_HINTS
163583 if( pLoop->u.btree.pIndex!=0 && (pTab->tabFlags & TF_WithoutRowid)==0 ){
163584 sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ|bFordelete);
163585 }else
163586 #endif
163587 {
163588 sqlite3VdbeChangeP5(v, bFordelete);
@@ -167311,22 +167739,22 @@
167739 #define sqlite3ParserCTX_PDECL ,Parse *pParse
167740 #define sqlite3ParserCTX_PARAM ,pParse
167741 #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse;
167742 #define sqlite3ParserCTX_STORE yypParser->pParse=pParse;
167743 #define YYFALLBACK 1
167744 #define YYNSTATE 575
167745 #define YYNRULE 403
167746 #define YYNRULE_WITH_ACTION 341
167747 #define YYNTOKEN 185
167748 #define YY_MAX_SHIFT 574
167749 #define YY_MIN_SHIFTREDUCE 833
167750 #define YY_MAX_SHIFTREDUCE 1235
167751 #define YY_ERROR_ACTION 1236
167752 #define YY_ACCEPT_ACTION 1237
167753 #define YY_NO_ACTION 1238
167754 #define YY_MIN_REDUCE 1239
167755 #define YY_MAX_REDUCE 1641
167756 /************* End control #defines *******************************************/
167757 #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])))
167758
167759 /* Define the yytestcase() macro to be a no-op if is not already defined
167760 ** otherwise.
@@ -167389,222 +167817,222 @@
167817 ** yy_reduce_ofst[] For each state, the offset into yy_action for
167818 ** shifting non-terminals after a reduce.
167819 ** yy_default[] Default action for each state.
167820 **
167821 *********** Begin parsing tables **********************************************/
167822 #define YY_ACTTAB_COUNT (2096)
167823 static const YYACTIONTYPE yy_action[] = {
167824 /* 0 */ 568, 208, 568, 118, 115, 229, 568, 118, 115, 229,
167825 /* 10 */ 568, 1310, 377, 1289, 408, 562, 562, 562, 568, 409,
167826 /* 20 */ 378, 1310, 1272, 41, 41, 41, 41, 208, 1521, 71,
167827 /* 30 */ 71, 969, 419, 41, 41, 491, 303, 279, 303, 970,
167828 /* 40 */ 397, 71, 71, 125, 126, 80, 1213, 1213, 1047, 1050,
167829 /* 50 */ 1037, 1037, 123, 123, 124, 124, 124, 124, 476, 409,
167830 /* 60 */ 1237, 1, 1, 574, 2, 1241, 550, 118, 115, 229,
167831 /* 70 */ 317, 480, 146, 480, 524, 118, 115, 229, 529, 1323,
167832 /* 80 */ 417, 523, 142, 125, 126, 80, 1213, 1213, 1047, 1050,
167833 /* 90 */ 1037, 1037, 123, 123, 124, 124, 124, 124, 118, 115,
167834 /* 100 */ 229, 327, 122, 122, 122, 122, 121, 121, 120, 120,
167835 /* 110 */ 120, 119, 116, 444, 284, 284, 284, 284, 442, 442,
167836 /* 120 */ 442, 1562, 376, 1564, 1189, 375, 1160, 565, 1160, 565,
167837 /* 130 */ 409, 1562, 537, 259, 226, 444, 101, 145, 449, 316,
167838 /* 140 */ 559, 240, 122, 122, 122, 122, 121, 121, 120, 120,
167839 /* 150 */ 120, 119, 116, 444, 125, 126, 80, 1213, 1213, 1047,
167840 /* 160 */ 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, 142,
167841 /* 170 */ 294, 1189, 339, 448, 120, 120, 120, 119, 116, 444,
167842 /* 180 */ 127, 1189, 1190, 1189, 148, 441, 440, 568, 119, 116,
167843 /* 190 */ 444, 124, 124, 124, 124, 117, 122, 122, 122, 122,
167844 /* 200 */ 121, 121, 120, 120, 120, 119, 116, 444, 454, 113,
167845 /* 210 */ 13, 13, 546, 122, 122, 122, 122, 121, 121, 120,
167846 /* 220 */ 120, 120, 119, 116, 444, 422, 316, 559, 1189, 1190,
167847 /* 230 */ 1189, 149, 1220, 409, 1220, 124, 124, 124, 124, 122,
167848 /* 240 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116,
167849 /* 250 */ 444, 465, 342, 1034, 1034, 1048, 1051, 125, 126, 80,
167850 /* 260 */ 1213, 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124,
167851 /* 270 */ 124, 124, 1275, 522, 222, 1189, 568, 409, 224, 514,
167852 /* 280 */ 175, 82, 83, 122, 122, 122, 122, 121, 121, 120,
167853 /* 290 */ 120, 120, 119, 116, 444, 1005, 16, 16, 1189, 133,
167854 /* 300 */ 133, 125, 126, 80, 1213, 1213, 1047, 1050, 1037, 1037,
167855 /* 310 */ 123, 123, 124, 124, 124, 124, 122, 122, 122, 122,
167856 /* 320 */ 121, 121, 120, 120, 120, 119, 116, 444, 1038, 546,
167857 /* 330 */ 1189, 373, 1189, 1190, 1189, 252, 1429, 399, 504, 501,
167858 /* 340 */ 500, 111, 560, 566, 4, 924, 924, 433, 499, 340,
167859 /* 350 */ 460, 328, 360, 394, 1233, 1189, 1190, 1189, 563, 568,
167860 /* 360 */ 122, 122, 122, 122, 121, 121, 120, 120, 120, 119,
167861 /* 370 */ 116, 444, 284, 284, 369, 1575, 1601, 441, 440, 154,
167862 /* 380 */ 409, 445, 71, 71, 1282, 565, 1217, 1189, 1190, 1189,
167863 /* 390 */ 85, 1219, 271, 557, 543, 515, 1556, 568, 98, 1218,
167864 /* 400 */ 6, 1274, 472, 142, 125, 126, 80, 1213, 1213, 1047,
167865 /* 410 */ 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, 550,
167866 /* 420 */ 13, 13, 1024, 507, 1220, 1189, 1220, 549, 109, 109,
167867 /* 430 */ 222, 568, 1234, 175, 568, 427, 110, 197, 445, 569,
167868 /* 440 */ 445, 430, 1547, 1014, 325, 551, 1189, 270, 287, 368,
167869 /* 450 */ 510, 363, 509, 257, 71, 71, 543, 71, 71, 359,
167870 /* 460 */ 316, 559, 1607, 122, 122, 122, 122, 121, 121, 120,
167871 /* 470 */ 120, 120, 119, 116, 444, 1014, 1014, 1016, 1017, 27,
167872 /* 480 */ 284, 284, 1189, 1190, 1189, 1155, 568, 1606, 409, 899,
167873 /* 490 */ 190, 550, 356, 565, 550, 935, 533, 517, 1155, 516,
167874 /* 500 */ 413, 1155, 552, 1189, 1190, 1189, 568, 544, 1549, 51,
167875 /* 510 */ 51, 214, 125, 126, 80, 1213, 1213, 1047, 1050, 1037,
167876 /* 520 */ 1037, 123, 123, 124, 124, 124, 124, 1189, 474, 135,
167877 /* 530 */ 135, 409, 284, 284, 1485, 505, 121, 121, 120, 120,
167878 /* 540 */ 120, 119, 116, 444, 1005, 565, 518, 217, 541, 1556,
167879 /* 550 */ 316, 559, 142, 6, 532, 125, 126, 80, 1213, 1213,
167880 /* 560 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124,
167881 /* 570 */ 1550, 122, 122, 122, 122, 121, 121, 120, 120, 120,
167882 /* 580 */ 119, 116, 444, 485, 1189, 1190, 1189, 482, 281, 1263,
167883 /* 590 */ 955, 252, 1189, 373, 504, 501, 500, 1189, 340, 570,
167884 /* 600 */ 1189, 570, 409, 292, 499, 955, 874, 191, 480, 316,
167885 /* 610 */ 559, 384, 290, 380, 122, 122, 122, 122, 121, 121,
167886 /* 620 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213,
167887 /* 630 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
167888 /* 640 */ 124, 409, 394, 1133, 1189, 867, 100, 284, 284, 1189,
167889 /* 650 */ 1190, 1189, 373, 1090, 1189, 1190, 1189, 1189, 1190, 1189,
167890 /* 660 */ 565, 455, 32, 373, 233, 125, 126, 80, 1213, 1213,
167891 /* 670 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124,
167892 /* 680 */ 1428, 957, 568, 228, 956, 122, 122, 122, 122, 121,
167893 /* 690 */ 121, 120, 120, 120, 119, 116, 444, 1155, 228, 1189,
167894 /* 700 */ 157, 1189, 1190, 1189, 1548, 13, 13, 301, 955, 1228,
167895 /* 710 */ 1155, 153, 409, 1155, 373, 1578, 1173, 5, 369, 1575,
167896 /* 720 */ 429, 1234, 3, 955, 122, 122, 122, 122, 121, 121,
167897 /* 730 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213,
167898 /* 740 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
167899 /* 750 */ 124, 409, 208, 567, 1189, 1025, 1189, 1190, 1189, 1189,
167900 /* 760 */ 388, 850, 155, 1547, 286, 402, 1095, 1095, 488, 568,
167901 /* 770 */ 465, 342, 1315, 1315, 1547, 125, 126, 80, 1213, 1213,
167902 /* 780 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124,
167903 /* 790 */ 129, 568, 13, 13, 374, 122, 122, 122, 122, 121,
167904 /* 800 */ 121, 120, 120, 120, 119, 116, 444, 302, 568, 453,
167905 /* 810 */ 528, 1189, 1190, 1189, 13, 13, 1189, 1190, 1189, 1293,
167906 /* 820 */ 463, 1263, 409, 1313, 1313, 1547, 1010, 453, 452, 200,
167907 /* 830 */ 299, 71, 71, 1261, 122, 122, 122, 122, 121, 121,
167908 /* 840 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213,
167909 /* 850 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
167910 /* 860 */ 124, 409, 227, 1070, 1155, 284, 284, 419, 312, 278,
167911 /* 870 */ 278, 285, 285, 1415, 406, 405, 382, 1155, 565, 568,
167912 /* 880 */ 1155, 1192, 565, 1595, 565, 125, 126, 80, 1213, 1213,
167913 /* 890 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124,
167914 /* 900 */ 453, 1477, 13, 13, 1531, 122, 122, 122, 122, 121,
167915 /* 910 */ 121, 120, 120, 120, 119, 116, 444, 201, 568, 354,
167916 /* 920 */ 1581, 574, 2, 1241, 838, 839, 840, 1557, 317, 1208,
167917 /* 930 */ 146, 6, 409, 255, 254, 253, 206, 1323, 9, 1192,
167918 /* 940 */ 262, 71, 71, 424, 122, 122, 122, 122, 121, 121,
167919 /* 950 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213,
167920 /* 960 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
167921 /* 970 */ 124, 568, 284, 284, 568, 1209, 409, 573, 313, 1241,
167922 /* 980 */ 349, 1292, 352, 419, 317, 565, 146, 491, 525, 1637,
167923 /* 990 */ 395, 371, 491, 1323, 70, 70, 1291, 71, 71, 240,
167924 /* 1000 */ 1321, 104, 80, 1213, 1213, 1047, 1050, 1037, 1037, 123,
167925 /* 1010 */ 123, 124, 124, 124, 124, 122, 122, 122, 122, 121,
167926 /* 1020 */ 121, 120, 120, 120, 119, 116, 444, 1111, 284, 284,
167927 /* 1030 */ 428, 448, 1520, 1209, 439, 284, 284, 1484, 1348, 311,
167928 /* 1040 */ 474, 565, 1112, 969, 491, 491, 217, 1259, 565, 1533,
167929 /* 1050 */ 568, 970, 207, 568, 1024, 240, 383, 1113, 519, 122,
167930 /* 1060 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116,
167931 /* 1070 */ 444, 1015, 107, 71, 71, 1014, 13, 13, 910, 568,
167932 /* 1080 */ 1490, 568, 284, 284, 97, 526, 491, 448, 911, 1322,
167933 /* 1090 */ 1318, 545, 409, 284, 284, 565, 151, 209, 1490, 1492,
167934 /* 1100 */ 262, 450, 55, 55, 56, 56, 565, 1014, 1014, 1016,
167935 /* 1110 */ 443, 332, 409, 527, 12, 295, 125, 126, 80, 1213,
167936 /* 1120 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
167937 /* 1130 */ 124, 347, 409, 862, 1529, 1209, 125, 126, 80, 1213,
167938 /* 1140 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
167939 /* 1150 */ 124, 1134, 1635, 474, 1635, 371, 125, 114, 80, 1213,
167940 /* 1160 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124,
167941 /* 1170 */ 124, 1490, 329, 474, 331, 122, 122, 122, 122, 121,
167942 /* 1180 */ 121, 120, 120, 120, 119, 116, 444, 203, 1415, 568,
167943 /* 1190 */ 1290, 862, 464, 1209, 436, 122, 122, 122, 122, 121,
167944 /* 1200 */ 121, 120, 120, 120, 119, 116, 444, 553, 1134, 1636,
167945 /* 1210 */ 539, 1636, 15, 15, 890, 122, 122, 122, 122, 121,
167946 /* 1220 */ 121, 120, 120, 120, 119, 116, 444, 568, 298, 538,
167947 /* 1230 */ 1132, 1415, 1554, 1555, 1327, 409, 6, 6, 1166, 1264,
167948 /* 1240 */ 415, 320, 284, 284, 1415, 508, 565, 525, 300, 457,
167949 /* 1250 */ 43, 43, 568, 891, 12, 565, 330, 478, 425, 407,
167950 /* 1260 */ 126, 80, 1213, 1213, 1047, 1050, 1037, 1037, 123, 123,
167951 /* 1270 */ 124, 124, 124, 124, 568, 57, 57, 288, 1189, 1415,
167952 /* 1280 */ 496, 458, 392, 392, 391, 273, 389, 1132, 1553, 847,
167953 /* 1290 */ 1166, 407, 6, 568, 321, 1155, 470, 44, 44, 1552,
167954 /* 1300 */ 1111, 426, 234, 6, 323, 256, 540, 256, 1155, 431,
167955 /* 1310 */ 568, 1155, 322, 17, 487, 1112, 58, 58, 122, 122,
167956 /* 1320 */ 122, 122, 121, 121, 120, 120, 120, 119, 116, 444,
167957 /* 1330 */ 1113, 216, 481, 59, 59, 1189, 1190, 1189, 111, 560,
167958 /* 1340 */ 324, 4, 236, 456, 526, 568, 237, 456, 568, 437,
167959 /* 1350 */ 168, 556, 420, 141, 479, 563, 568, 293, 568, 1092,
167960 /* 1360 */ 568, 293, 568, 1092, 531, 568, 870, 8, 60, 60,
167961 /* 1370 */ 235, 61, 61, 568, 414, 568, 414, 568, 445, 62,
167962 /* 1380 */ 62, 45, 45, 46, 46, 47, 47, 199, 49, 49,
167963 /* 1390 */ 557, 568, 359, 568, 100, 486, 50, 50, 63, 63,
167964 /* 1400 */ 64, 64, 561, 415, 535, 410, 568, 1024, 568, 534,
167965 /* 1410 */ 316, 559, 316, 559, 65, 65, 14, 14, 568, 1024,
167966 /* 1420 */ 568, 512, 930, 870, 1015, 109, 109, 929, 1014, 66,
167967 /* 1430 */ 66, 131, 131, 110, 451, 445, 569, 445, 416, 177,
167968 /* 1440 */ 1014, 132, 132, 67, 67, 568, 467, 568, 930, 471,
167969 /* 1450 */ 1360, 283, 226, 929, 315, 1359, 407, 568, 459, 407,
167970 /* 1460 */ 1014, 1014, 1016, 239, 407, 86, 213, 1346, 52, 52,
167971 /* 1470 */ 68, 68, 1014, 1014, 1016, 1017, 27, 1580, 1177, 447,
167972 /* 1480 */ 69, 69, 288, 97, 108, 1536, 106, 392, 392, 391,
167973 /* 1490 */ 273, 389, 568, 877, 847, 881, 568, 111, 560, 466,
167974 /* 1500 */ 4, 568, 152, 30, 38, 568, 1129, 234, 396, 323,
167975 /* 1510 */ 111, 560, 527, 4, 563, 53, 53, 322, 568, 163,
167976 /* 1520 */ 163, 568, 337, 468, 164, 164, 333, 563, 76, 76,
167977 /* 1530 */ 568, 289, 1509, 568, 31, 1508, 568, 445, 338, 483,
167978 /* 1540 */ 100, 54, 54, 344, 72, 72, 296, 236, 1077, 557,
167979 /* 1550 */ 445, 877, 1356, 134, 134, 168, 73, 73, 141, 161,
167980 /* 1560 */ 161, 1569, 557, 535, 568, 319, 568, 348, 536, 1007,
167981 /* 1570 */ 473, 261, 261, 889, 888, 235, 535, 568, 1024, 568,
167982 /* 1580 */ 475, 534, 261, 367, 109, 109, 521, 136, 136, 130,
167983 /* 1590 */ 130, 1024, 110, 366, 445, 569, 445, 109, 109, 1014,
167984 /* 1600 */ 162, 162, 156, 156, 568, 110, 1077, 445, 569, 445,
167985 /* 1610 */ 410, 351, 1014, 568, 353, 316, 559, 568, 343, 568,
167986 /* 1620 */ 100, 497, 357, 258, 100, 896, 897, 140, 140, 355,
167987 /* 1630 */ 1306, 1014, 1014, 1016, 1017, 27, 139, 139, 362, 451,
167988 /* 1640 */ 137, 137, 138, 138, 1014, 1014, 1016, 1017, 27, 1177,
167989 /* 1650 */ 447, 568, 372, 288, 111, 560, 1018, 4, 392, 392,
167990 /* 1660 */ 391, 273, 389, 568, 1138, 847, 568, 1073, 568, 258,
167991 /* 1670 */ 492, 563, 568, 211, 75, 75, 555, 960, 234, 261,
167992 /* 1680 */ 323, 111, 560, 927, 4, 113, 77, 77, 322, 74,
167993 /* 1690 */ 74, 42, 42, 1369, 445, 48, 48, 1414, 563, 972,
167994 /* 1700 */ 973, 1089, 1088, 1089, 1088, 860, 557, 150, 928, 1342,
167995 /* 1710 */ 113, 1354, 554, 1419, 1018, 1271, 1262, 1250, 236, 1249,
167996 /* 1720 */ 1251, 445, 1588, 1339, 308, 276, 168, 309, 11, 141,
167997 /* 1730 */ 393, 310, 232, 557, 1401, 1024, 335, 291, 1396, 219,
167998 /* 1740 */ 336, 109, 109, 934, 297, 1406, 235, 341, 477, 110,
167999 /* 1750 */ 502, 445, 569, 445, 1389, 1405, 1014, 400, 1289, 365,
168000 /* 1760 */ 223, 1481, 1024, 1480, 1351, 1352, 1350, 1349, 109, 109,
168001 /* 1770 */ 204, 1591, 1228, 558, 265, 218, 110, 205, 445, 569,
168002 /* 1780 */ 445, 410, 387, 1014, 1528, 179, 316, 559, 1014, 1014,
168003 /* 1790 */ 1016, 1017, 27, 230, 1526, 1225, 79, 560, 85, 4,
168004 /* 1800 */ 418, 215, 548, 81, 84, 188, 1402, 173, 181, 461,
168005 /* 1810 */ 451, 35, 462, 563, 183, 1014, 1014, 1016, 1017, 27,
168006 /* 1820 */ 184, 1486, 185, 186, 495, 242, 98, 398, 1408, 36,
168007 /* 1830 */ 1407, 484, 91, 469, 401, 1410, 445, 192, 1475, 246,
168008 /* 1840 */ 1497, 490, 346, 277, 248, 196, 493, 511, 557, 350,
168009 /* 1850 */ 1252, 249, 250, 403, 1309, 1308, 111, 560, 432, 4,
168010 /* 1860 */ 1307, 1300, 93, 1605, 881, 1604, 224, 404, 434, 520,
168011 /* 1870 */ 263, 435, 1574, 563, 1279, 1278, 364, 1024, 306, 1277,
168012 /* 1880 */ 264, 1603, 1560, 109, 109, 370, 1299, 307, 1559, 438,
168013 /* 1890 */ 128, 110, 1374, 445, 569, 445, 445, 546, 1014, 10,
168014 /* 1900 */ 1461, 105, 381, 1373, 34, 571, 99, 1332, 557, 314,
168015 /* 1910 */ 1183, 530, 272, 274, 379, 210, 1331, 547, 385, 386,
168016 /* 1920 */ 275, 572, 1247, 1242, 411, 412, 1513, 165, 178, 1514,
168017 /* 1930 */ 1014, 1014, 1016, 1017, 27, 1512, 1511, 1024, 78, 147,
168018 /* 1940 */ 166, 220, 221, 109, 109, 834, 304, 167, 446, 212,
168019 /* 1950 */ 318, 110, 231, 445, 569, 445, 144, 1087, 1014, 1085,
168020 /* 1960 */ 326, 180, 169, 1208, 182, 334, 238, 913, 241, 1101,
168021 /* 1970 */ 187, 170, 171, 421, 87, 88, 423, 189, 89, 90,
168022 /* 1980 */ 172, 1104, 243, 1100, 244, 158, 18, 245, 345, 247,
168023 /* 1990 */ 1014, 1014, 1016, 1017, 27, 261, 1093, 193, 1222, 489,
168024 /* 2000 */ 194, 37, 366, 849, 494, 251, 195, 506, 92, 19,
168025 /* 2010 */ 498, 358, 20, 503, 879, 361, 94, 892, 305, 159,
168026 /* 2020 */ 513, 39, 95, 1171, 160, 1053, 964, 1140, 96, 174,
168027 /* 2030 */ 1139, 225, 280, 282, 198, 958, 113, 1161, 1157, 260,
168028 /* 2040 */ 21, 22, 23, 1159, 1165, 1164, 1145, 24, 33, 25,
168029 /* 2050 */ 202, 542, 26, 100, 1068, 102, 1054, 103, 7, 1052,
168030 /* 2060 */ 1056, 1110, 1057, 1109, 266, 267, 28, 40, 390, 1019,
168031 /* 2070 */ 861, 112, 29, 564, 1179, 1178, 268, 176, 143, 923,
168032 /* 2080 */ 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238,
168033 /* 2090 */ 1238, 1238, 1238, 1238, 269, 1596,
168034 };
168035 static const YYCODETYPE yy_lookahead[] = {
168036 /* 0 */ 193, 193, 193, 274, 275, 276, 193, 274, 275, 276,
168037 /* 10 */ 193, 223, 219, 225, 206, 210, 211, 212, 193, 19,
168038 /* 20 */ 219, 233, 216, 216, 217, 216, 217, 193, 295, 216,
@@ -167812,11 +168240,11 @@
168240 /* 2040 */ 34, 34, 34, 86, 75, 93, 23, 34, 22, 34,
168241 /* 2050 */ 25, 24, 34, 25, 23, 142, 23, 142, 44, 23,
168242 /* 2060 */ 23, 23, 11, 23, 25, 22, 22, 22, 15, 23,
168243 /* 2070 */ 23, 22, 22, 25, 1, 1, 141, 25, 23, 135,
168244 /* 2080 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168245 /* 2090 */ 319, 319, 319, 319, 141, 141, 319, 319, 319, 319,
168246 /* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168247 /* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168248 /* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168249 /* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168250 /* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
@@ -167831,13 +168259,13 @@
168259 /* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168260 /* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168261 /* 2250 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168262 /* 2260 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168263 /* 2270 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319,
168264 /* 2280 */ 319,
168265 };
168266 #define YY_SHIFT_COUNT (574)
168267 #define YY_SHIFT_MIN (0)
168268 #define YY_SHIFT_MAX (2074)
168269 static const unsigned short int yy_shift_ofst[] = {
168270 /* 0 */ 1648, 1477, 1272, 322, 322, 1, 1319, 1478, 1491, 1837,
168271 /* 10 */ 1837, 1837, 471, 0, 0, 214, 1093, 1837, 1837, 1837,
@@ -167853,16 +168281,16 @@
168281 /* 110 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
168282 /* 120 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837,
168283 /* 130 */ 137, 181, 181, 181, 181, 181, 181, 181, 94, 430,
168284 /* 140 */ 66, 65, 112, 366, 533, 533, 740, 1261, 533, 533,
168285 /* 150 */ 79, 79, 533, 412, 412, 412, 77, 412, 123, 113,
168286 /* 160 */ 113, 22, 22, 2096, 2096, 328, 328, 328, 239, 468,
168287 /* 170 */ 468, 468, 468, 1015, 1015, 409, 366, 1129, 1186, 533,
168288 /* 180 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
168289 /* 190 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 969,
168290 /* 200 */ 621, 621, 533, 642, 788, 788, 1228, 1228, 822, 822,
168291 /* 210 */ 67, 1274, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 1307,
168292 /* 220 */ 954, 954, 585, 472, 640, 387, 695, 538, 541, 700,
168293 /* 230 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533,
168294 /* 240 */ 222, 533, 533, 533, 533, 533, 533, 533, 533, 533,
168295 /* 250 */ 533, 533, 533, 1179, 1179, 1179, 533, 533, 533, 565,
168296 /* 260 */ 533, 533, 533, 916, 1144, 533, 533, 1288, 533, 533,
@@ -167876,12 +168304,12 @@
168304 /* 340 */ 1764, 1677, 1764, 1677, 1633, 1806, 1674, 1779, 1633, 1806,
168305 /* 350 */ 1823, 1633, 1806, 1633, 1806, 1823, 1732, 1732, 1732, 1794,
168306 /* 360 */ 1840, 1840, 1823, 1732, 1738, 1732, 1794, 1732, 1732, 1701,
168307 /* 370 */ 1844, 1758, 1758, 1823, 1633, 1789, 1789, 1807, 1807, 1742,
168308 /* 380 */ 1752, 1877, 1633, 1743, 1742, 1759, 1765, 1677, 1879, 1897,
168309 /* 390 */ 1897, 1914, 1914, 1914, 2096, 2096, 2096, 2096, 2096, 2096,
168310 /* 400 */ 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 207,
168311 /* 410 */ 1095, 331, 620, 903, 806, 1074, 1483, 1432, 1481, 1322,
168312 /* 420 */ 1370, 1394, 1515, 1291, 1546, 1547, 1557, 1595, 1598, 1599,
168313 /* 430 */ 1434, 1453, 1618, 1462, 1567, 1489, 1644, 1654, 1616, 1660,
168314 /* 440 */ 1548, 1549, 1682, 1685, 1597, 742, 1941, 1945, 1927, 1787,
168315 /* 450 */ 1937, 1940, 1934, 1936, 1821, 1810, 1832, 1938, 1938, 1942,
@@ -167894,11 +168322,11 @@
168322 /* 520 */ 1999, 1933, 1890, 2009, 2010, 1910, 2005, 2012, 1892, 2011,
168323 /* 530 */ 2006, 2007, 2008, 2013, 1950, 1962, 1957, 2014, 1969, 1952,
168324 /* 540 */ 2015, 2023, 2026, 2027, 2025, 2028, 2018, 1913, 1915, 2031,
168325 /* 550 */ 2011, 2033, 2036, 2037, 2038, 2039, 2040, 2043, 2051, 2044,
168326 /* 560 */ 2045, 2046, 2047, 2049, 2050, 2048, 1944, 1935, 1953, 1954,
168327 /* 570 */ 2052, 2055, 2053, 2073, 2074,
168328 };
168329 #define YY_REDUCE_COUNT (408)
168330 #define YY_REDUCE_MIN (-271)
168331 #define YY_REDUCE_MAX (1740)
168332 static const short yy_reduce_ofst[] = {
@@ -167943,68 +168371,68 @@
168371 /* 380 */ 1665, 1623, 1702, 1630, 1666, 1667, 1671, 1673, 1703, 1718,
168372 /* 390 */ 1719, 1729, 1730, 1731, 1621, 1622, 1628, 1720, 1713, 1716,
168373 /* 400 */ 1722, 1723, 1733, 1717, 1724, 1727, 1728, 1725, 1740,
168374 };
168375 static const YYACTIONTYPE yy_default[] = {
168376 /* 0 */ 1641, 1641, 1641, 1470, 1236, 1347, 1236, 1236, 1236, 1470,
168377 /* 10 */ 1470, 1470, 1236, 1377, 1377, 1523, 1269, 1236, 1236, 1236,
168378 /* 20 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1469, 1236, 1236,
168379 /* 30 */ 1236, 1236, 1558, 1558, 1236, 1236, 1236, 1236, 1236, 1236,
168380 /* 40 */ 1236, 1236, 1386, 1236, 1393, 1236, 1236, 1236, 1236, 1236,
168381 /* 50 */ 1471, 1472, 1236, 1236, 1236, 1522, 1524, 1487, 1400, 1399,
168382 /* 60 */ 1398, 1397, 1505, 1365, 1391, 1384, 1388, 1465, 1466, 1464,
168383 /* 70 */ 1468, 1472, 1471, 1236, 1387, 1433, 1449, 1432, 1236, 1236,
168384 /* 80 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168385 /* 90 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168386 /* 100 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168387 /* 110 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168388 /* 120 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168389 /* 130 */ 1441, 1448, 1447, 1446, 1455, 1445, 1442, 1435, 1434, 1436,
168390 /* 140 */ 1437, 1236, 1236, 1260, 1236, 1236, 1257, 1311, 1236, 1236,
168391 /* 150 */ 1236, 1236, 1236, 1542, 1541, 1236, 1438, 1236, 1269, 1427,
168392 /* 160 */ 1426, 1452, 1439, 1451, 1450, 1530, 1594, 1593, 1488, 1236,
168393 /* 170 */ 1236, 1236, 1236, 1236, 1236, 1558, 1236, 1236, 1236, 1236,
168394 /* 180 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168395 /* 190 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1367,
168396 /* 200 */ 1558, 1558, 1236, 1269, 1558, 1558, 1368, 1368, 1265, 1265,
168397 /* 210 */ 1371, 1236, 1537, 1338, 1338, 1338, 1338, 1347, 1338, 1236,
168398 /* 220 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168399 /* 230 */ 1236, 1236, 1236, 1236, 1527, 1525, 1236, 1236, 1236, 1236,
168400 /* 240 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168401 /* 250 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168402 /* 260 */ 1236, 1236, 1236, 1343, 1236, 1236, 1236, 1236, 1236, 1236,
168403 /* 270 */ 1236, 1236, 1236, 1236, 1236, 1587, 1236, 1500, 1325, 1343,
168404 /* 280 */ 1343, 1343, 1343, 1345, 1326, 1324, 1337, 1270, 1243, 1633,
168405 /* 290 */ 1403, 1392, 1344, 1392, 1630, 1390, 1403, 1403, 1390, 1403,
168406 /* 300 */ 1344, 1630, 1286, 1609, 1281, 1377, 1377, 1377, 1367, 1367,
168407 /* 310 */ 1367, 1367, 1371, 1371, 1467, 1344, 1337, 1236, 1633, 1633,
168408 /* 320 */ 1353, 1353, 1632, 1632, 1353, 1488, 1617, 1412, 1314, 1320,
168409 /* 330 */ 1320, 1320, 1320, 1353, 1254, 1390, 1617, 1617, 1390, 1412,
168410 /* 340 */ 1314, 1390, 1314, 1390, 1353, 1254, 1504, 1627, 1353, 1254,
168411 /* 350 */ 1478, 1353, 1254, 1353, 1254, 1478, 1312, 1312, 1312, 1301,
168412 /* 360 */ 1236, 1236, 1478, 1312, 1286, 1312, 1301, 1312, 1312, 1576,
168413 /* 370 */ 1236, 1482, 1482, 1478, 1353, 1568, 1568, 1380, 1380, 1385,
168414 /* 380 */ 1371, 1473, 1353, 1236, 1385, 1383, 1381, 1390, 1304, 1590,
168415 /* 390 */ 1590, 1586, 1586, 1586, 1638, 1638, 1537, 1602, 1269, 1269,
168416 /* 400 */ 1269, 1269, 1602, 1288, 1288, 1270, 1270, 1269, 1602, 1236,
168417 /* 410 */ 1236, 1236, 1236, 1236, 1236, 1597, 1236, 1532, 1489, 1357,
168418 /* 420 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168419 /* 430 */ 1236, 1236, 1236, 1236, 1543, 1236, 1236, 1236, 1236, 1236,
168420 /* 440 */ 1236, 1236, 1236, 1236, 1236, 1417, 1236, 1239, 1534, 1236,
168421 /* 450 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1394, 1395, 1358,
168422 /* 460 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1409, 1236, 1236,
168423 /* 470 */ 1236, 1404, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168424 /* 480 */ 1629, 1236, 1236, 1236, 1236, 1236, 1236, 1503, 1502, 1236,
168425 /* 490 */ 1236, 1355, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168426 /* 500 */ 1236, 1236, 1236, 1236, 1236, 1284, 1236, 1236, 1236, 1236,
168427 /* 510 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168428 /* 520 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1382,
168429 /* 530 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168430 /* 540 */ 1236, 1236, 1236, 1236, 1573, 1372, 1236, 1236, 1236, 1236,
168431 /* 550 */ 1620, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236,
168432 /* 560 */ 1236, 1236, 1236, 1236, 1236, 1613, 1328, 1418, 1236, 1421,
168433 /* 570 */ 1258, 1236, 1248, 1236, 1236,
168434 };
168435 /********** End of lemon-generated parsing tables *****************************/
168436
168437 /* The next table maps tokens (terminal symbols) into fallback tokens.
168438 ** If a construct like the following:
@@ -168797,237 +169225,235 @@
169225 /* 173 */ "idlist_opt ::=",
169226 /* 174 */ "idlist_opt ::= LP idlist RP",
169227 /* 175 */ "idlist ::= idlist COMMA nm",
169228 /* 176 */ "idlist ::= nm",
169229 /* 177 */ "expr ::= LP expr RP",
169230 /* 178 */ "expr ::= ID|INDEXED|JOIN_KW",
169231 /* 179 */ "expr ::= nm DOT nm",
169232 /* 180 */ "expr ::= nm DOT nm DOT nm",
169233 /* 181 */ "term ::= NULL|FLOAT|BLOB",
169234 /* 182 */ "term ::= STRING",
169235 /* 183 */ "term ::= INTEGER",
169236 /* 184 */ "expr ::= VARIABLE",
169237 /* 185 */ "expr ::= expr COLLATE ID|STRING",
169238 /* 186 */ "expr ::= CAST LP expr AS typetoken RP",
169239 /* 187 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP",
169240 /* 188 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP",
169241 /* 189 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over",
169242 /* 190 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over",
169243 /* 191 */ "term ::= CTIME_KW",
169244 /* 192 */ "expr ::= LP nexprlist COMMA expr RP",
169245 /* 193 */ "expr ::= expr AND expr",
169246 /* 194 */ "expr ::= expr OR expr",
169247 /* 195 */ "expr ::= expr LT|GT|GE|LE expr",
169248 /* 196 */ "expr ::= expr EQ|NE expr",
169249 /* 197 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
169250 /* 198 */ "expr ::= expr PLUS|MINUS expr",
169251 /* 199 */ "expr ::= expr STAR|SLASH|REM expr",
169252 /* 200 */ "expr ::= expr CONCAT expr",
169253 /* 201 */ "likeop ::= NOT LIKE_KW|MATCH",
169254 /* 202 */ "expr ::= expr likeop expr",
169255 /* 203 */ "expr ::= expr likeop expr ESCAPE expr",
169256 /* 204 */ "expr ::= expr ISNULL|NOTNULL",
169257 /* 205 */ "expr ::= expr NOT NULL",
169258 /* 206 */ "expr ::= expr IS expr",
169259 /* 207 */ "expr ::= expr IS NOT expr",
169260 /* 208 */ "expr ::= expr IS NOT DISTINCT FROM expr",
169261 /* 209 */ "expr ::= expr IS DISTINCT FROM expr",
169262 /* 210 */ "expr ::= NOT expr",
169263 /* 211 */ "expr ::= BITNOT expr",
169264 /* 212 */ "expr ::= PLUS|MINUS expr",
169265 /* 213 */ "expr ::= expr PTR expr",
169266 /* 214 */ "between_op ::= BETWEEN",
169267 /* 215 */ "between_op ::= NOT BETWEEN",
169268 /* 216 */ "expr ::= expr between_op expr AND expr",
169269 /* 217 */ "in_op ::= IN",
169270 /* 218 */ "in_op ::= NOT IN",
169271 /* 219 */ "expr ::= expr in_op LP exprlist RP",
169272 /* 220 */ "expr ::= LP select RP",
169273 /* 221 */ "expr ::= expr in_op LP select RP",
169274 /* 222 */ "expr ::= expr in_op nm dbnm paren_exprlist",
169275 /* 223 */ "expr ::= EXISTS LP select RP",
169276 /* 224 */ "expr ::= CASE case_operand case_exprlist case_else END",
169277 /* 225 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
169278 /* 226 */ "case_exprlist ::= WHEN expr THEN expr",
169279 /* 227 */ "case_else ::= ELSE expr",
169280 /* 228 */ "case_else ::=",
169281 /* 229 */ "case_operand ::= expr",
169282 /* 230 */ "case_operand ::=",
169283 /* 231 */ "exprlist ::=",
169284 /* 232 */ "nexprlist ::= nexprlist COMMA expr",
169285 /* 233 */ "nexprlist ::= expr",
169286 /* 234 */ "paren_exprlist ::=",
169287 /* 235 */ "paren_exprlist ::= LP exprlist RP",
169288 /* 236 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
169289 /* 237 */ "uniqueflag ::= UNIQUE",
169290 /* 238 */ "uniqueflag ::=",
169291 /* 239 */ "eidlist_opt ::=",
169292 /* 240 */ "eidlist_opt ::= LP eidlist RP",
169293 /* 241 */ "eidlist ::= eidlist COMMA nm collate sortorder",
169294 /* 242 */ "eidlist ::= nm collate sortorder",
169295 /* 243 */ "collate ::=",
169296 /* 244 */ "collate ::= COLLATE ID|STRING",
169297 /* 245 */ "cmd ::= DROP INDEX ifexists fullname",
169298 /* 246 */ "cmd ::= VACUUM vinto",
169299 /* 247 */ "cmd ::= VACUUM nm vinto",
169300 /* 248 */ "vinto ::= INTO expr",
169301 /* 249 */ "vinto ::=",
169302 /* 250 */ "cmd ::= PRAGMA nm dbnm",
169303 /* 251 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
169304 /* 252 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
169305 /* 253 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
169306 /* 254 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
169307 /* 255 */ "plus_num ::= PLUS INTEGER|FLOAT",
169308 /* 256 */ "minus_num ::= MINUS INTEGER|FLOAT",
169309 /* 257 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
169310 /* 258 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
169311 /* 259 */ "trigger_time ::= BEFORE|AFTER",
169312 /* 260 */ "trigger_time ::= INSTEAD OF",
169313 /* 261 */ "trigger_time ::=",
169314 /* 262 */ "trigger_event ::= DELETE|INSERT",
169315 /* 263 */ "trigger_event ::= UPDATE",
169316 /* 264 */ "trigger_event ::= UPDATE OF idlist",
169317 /* 265 */ "when_clause ::=",
169318 /* 266 */ "when_clause ::= WHEN expr",
169319 /* 267 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
169320 /* 268 */ "trigger_cmd_list ::= trigger_cmd SEMI",
169321 /* 269 */ "trnm ::= nm DOT nm",
169322 /* 270 */ "tridxby ::= INDEXED BY nm",
169323 /* 271 */ "tridxby ::= NOT INDEXED",
169324 /* 272 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt",
169325 /* 273 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt",
169326 /* 274 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt",
169327 /* 275 */ "trigger_cmd ::= scanpt select scanpt",
169328 /* 276 */ "expr ::= RAISE LP IGNORE RP",
169329 /* 277 */ "expr ::= RAISE LP raisetype COMMA nm RP",
169330 /* 278 */ "raisetype ::= ROLLBACK",
169331 /* 279 */ "raisetype ::= ABORT",
169332 /* 280 */ "raisetype ::= FAIL",
169333 /* 281 */ "cmd ::= DROP TRIGGER ifexists fullname",
169334 /* 282 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
169335 /* 283 */ "cmd ::= DETACH database_kw_opt expr",
169336 /* 284 */ "key_opt ::=",
169337 /* 285 */ "key_opt ::= KEY expr",
169338 /* 286 */ "cmd ::= REINDEX",
169339 /* 287 */ "cmd ::= REINDEX nm dbnm",
169340 /* 288 */ "cmd ::= ANALYZE",
169341 /* 289 */ "cmd ::= ANALYZE nm dbnm",
169342 /* 290 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
169343 /* 291 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
169344 /* 292 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm",
169345 /* 293 */ "add_column_fullname ::= fullname",
169346 /* 294 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm",
169347 /* 295 */ "cmd ::= create_vtab",
169348 /* 296 */ "cmd ::= create_vtab LP vtabarglist RP",
169349 /* 297 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
169350 /* 298 */ "vtabarg ::=",
169351 /* 299 */ "vtabargtoken ::= ANY",
169352 /* 300 */ "vtabargtoken ::= lp anylist RP",
169353 /* 301 */ "lp ::= LP",
169354 /* 302 */ "with ::= WITH wqlist",
169355 /* 303 */ "with ::= WITH RECURSIVE wqlist",
169356 /* 304 */ "wqas ::= AS",
169357 /* 305 */ "wqas ::= AS MATERIALIZED",
169358 /* 306 */ "wqas ::= AS NOT MATERIALIZED",
169359 /* 307 */ "wqitem ::= nm eidlist_opt wqas LP select RP",
169360 /* 308 */ "wqlist ::= wqitem",
169361 /* 309 */ "wqlist ::= wqlist COMMA wqitem",
169362 /* 310 */ "windowdefn_list ::= windowdefn",
169363 /* 311 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn",
169364 /* 312 */ "windowdefn ::= nm AS LP window RP",
169365 /* 313 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt",
169366 /* 314 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt",
169367 /* 315 */ "window ::= ORDER BY sortlist frame_opt",
169368 /* 316 */ "window ::= nm ORDER BY sortlist frame_opt",
169369 /* 317 */ "window ::= frame_opt",
169370 /* 318 */ "window ::= nm frame_opt",
169371 /* 319 */ "frame_opt ::=",
169372 /* 320 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt",
169373 /* 321 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt",
169374 /* 322 */ "range_or_rows ::= RANGE|ROWS|GROUPS",
169375 /* 323 */ "frame_bound_s ::= frame_bound",
169376 /* 324 */ "frame_bound_s ::= UNBOUNDED PRECEDING",
169377 /* 325 */ "frame_bound_e ::= frame_bound",
169378 /* 326 */ "frame_bound_e ::= UNBOUNDED FOLLOWING",
169379 /* 327 */ "frame_bound ::= expr PRECEDING|FOLLOWING",
169380 /* 328 */ "frame_bound ::= CURRENT ROW",
169381 /* 329 */ "frame_exclude_opt ::=",
169382 /* 330 */ "frame_exclude_opt ::= EXCLUDE frame_exclude",
169383 /* 331 */ "frame_exclude ::= NO OTHERS",
169384 /* 332 */ "frame_exclude ::= CURRENT ROW",
169385 /* 333 */ "frame_exclude ::= GROUP|TIES",
169386 /* 334 */ "window_clause ::= WINDOW windowdefn_list",
169387 /* 335 */ "filter_over ::= filter_clause over_clause",
169388 /* 336 */ "filter_over ::= over_clause",
169389 /* 337 */ "filter_over ::= filter_clause",
169390 /* 338 */ "over_clause ::= OVER LP window RP",
169391 /* 339 */ "over_clause ::= OVER nm",
169392 /* 340 */ "filter_clause ::= FILTER LP WHERE expr RP",
169393 /* 341 */ "input ::= cmdlist",
169394 /* 342 */ "cmdlist ::= cmdlist ecmd",
169395 /* 343 */ "cmdlist ::= ecmd",
169396 /* 344 */ "ecmd ::= SEMI",
169397 /* 345 */ "ecmd ::= cmdx SEMI",
169398 /* 346 */ "ecmd ::= explain cmdx SEMI",
169399 /* 347 */ "trans_opt ::=",
169400 /* 348 */ "trans_opt ::= TRANSACTION",
169401 /* 349 */ "trans_opt ::= TRANSACTION nm",
169402 /* 350 */ "savepoint_opt ::= SAVEPOINT",
169403 /* 351 */ "savepoint_opt ::=",
169404 /* 352 */ "cmd ::= create_table create_table_args",
169405 /* 353 */ "table_option_set ::= table_option",
169406 /* 354 */ "columnlist ::= columnlist COMMA columnname carglist",
169407 /* 355 */ "columnlist ::= columnname carglist",
169408 /* 356 */ "nm ::= ID|INDEXED|JOIN_KW",
169409 /* 357 */ "nm ::= STRING",
169410 /* 358 */ "typetoken ::= typename",
169411 /* 359 */ "typename ::= ID|STRING",
169412 /* 360 */ "signed ::= plus_num",
169413 /* 361 */ "signed ::= minus_num",
169414 /* 362 */ "carglist ::= carglist ccons",
169415 /* 363 */ "carglist ::=",
169416 /* 364 */ "ccons ::= NULL onconf",
169417 /* 365 */ "ccons ::= GENERATED ALWAYS AS generated",
169418 /* 366 */ "ccons ::= AS generated",
169419 /* 367 */ "conslist_opt ::= COMMA conslist",
169420 /* 368 */ "conslist ::= conslist tconscomma tcons",
169421 /* 369 */ "conslist ::= tcons",
169422 /* 370 */ "tconscomma ::=",
169423 /* 371 */ "defer_subclause_opt ::= defer_subclause",
169424 /* 372 */ "resolvetype ::= raisetype",
169425 /* 373 */ "selectnowith ::= oneselect",
169426 /* 374 */ "oneselect ::= values",
169427 /* 375 */ "sclp ::= selcollist COMMA",
169428 /* 376 */ "as ::= ID|STRING",
169429 /* 377 */ "indexed_opt ::= indexed_by",
169430 /* 378 */ "returning ::=",
169431 /* 379 */ "expr ::= term",
169432 /* 380 */ "likeop ::= LIKE_KW|MATCH",
169433 /* 381 */ "exprlist ::= nexprlist",
169434 /* 382 */ "nmnum ::= plus_num",
169435 /* 383 */ "nmnum ::= nm",
169436 /* 384 */ "nmnum ::= ON",
169437 /* 385 */ "nmnum ::= DELETE",
169438 /* 386 */ "nmnum ::= DEFAULT",
169439 /* 387 */ "plus_num ::= INTEGER|FLOAT",
169440 /* 388 */ "foreach_clause ::=",
169441 /* 389 */ "foreach_clause ::= FOR EACH ROW",
169442 /* 390 */ "trnm ::= nm",
169443 /* 391 */ "tridxby ::=",
169444 /* 392 */ "database_kw_opt ::= DATABASE",
169445 /* 393 */ "database_kw_opt ::=",
169446 /* 394 */ "kwcolumn_opt ::=",
169447 /* 395 */ "kwcolumn_opt ::= COLUMNKW",
169448 /* 396 */ "vtabarglist ::= vtabarg",
169449 /* 397 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
169450 /* 398 */ "vtabarg ::= vtabarg vtabargtoken",
169451 /* 399 */ "anylist ::=",
169452 /* 400 */ "anylist ::= anylist LP anylist RP",
169453 /* 401 */ "anylist ::= anylist ANY",
169454 /* 402 */ "with ::=",
 
 
169455 };
169456 #endif /* NDEBUG */
169457
169458
169459 #if YYSTACKDEPTH<=0
@@ -169708,237 +170134,235 @@
170134 270, /* (173) idlist_opt ::= */
170135 270, /* (174) idlist_opt ::= LP idlist RP */
170136 263, /* (175) idlist ::= idlist COMMA nm */
170137 263, /* (176) idlist ::= nm */
170138 217, /* (177) expr ::= LP expr RP */
170139 217, /* (178) expr ::= ID|INDEXED|JOIN_KW */
170140 217, /* (179) expr ::= nm DOT nm */
170141 217, /* (180) expr ::= nm DOT nm DOT nm */
170142 216, /* (181) term ::= NULL|FLOAT|BLOB */
170143 216, /* (182) term ::= STRING */
170144 216, /* (183) term ::= INTEGER */
170145 217, /* (184) expr ::= VARIABLE */
170146 217, /* (185) expr ::= expr COLLATE ID|STRING */
170147 217, /* (186) expr ::= CAST LP expr AS typetoken RP */
170148 217, /* (187) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
170149 217, /* (188) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
170150 217, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
170151 217, /* (190) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
170152 216, /* (191) term ::= CTIME_KW */
170153 217, /* (192) expr ::= LP nexprlist COMMA expr RP */
170154 217, /* (193) expr ::= expr AND expr */
170155 217, /* (194) expr ::= expr OR expr */
170156 217, /* (195) expr ::= expr LT|GT|GE|LE expr */
170157 217, /* (196) expr ::= expr EQ|NE expr */
170158 217, /* (197) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
170159 217, /* (198) expr ::= expr PLUS|MINUS expr */
170160 217, /* (199) expr ::= expr STAR|SLASH|REM expr */
170161 217, /* (200) expr ::= expr CONCAT expr */
170162 274, /* (201) likeop ::= NOT LIKE_KW|MATCH */
170163 217, /* (202) expr ::= expr likeop expr */
170164 217, /* (203) expr ::= expr likeop expr ESCAPE expr */
170165 217, /* (204) expr ::= expr ISNULL|NOTNULL */
170166 217, /* (205) expr ::= expr NOT NULL */
170167 217, /* (206) expr ::= expr IS expr */
170168 217, /* (207) expr ::= expr IS NOT expr */
170169 217, /* (208) expr ::= expr IS NOT DISTINCT FROM expr */
170170 217, /* (209) expr ::= expr IS DISTINCT FROM expr */
170171 217, /* (210) expr ::= NOT expr */
170172 217, /* (211) expr ::= BITNOT expr */
170173 217, /* (212) expr ::= PLUS|MINUS expr */
170174 217, /* (213) expr ::= expr PTR expr */
170175 275, /* (214) between_op ::= BETWEEN */
170176 275, /* (215) between_op ::= NOT BETWEEN */
170177 217, /* (216) expr ::= expr between_op expr AND expr */
170178 276, /* (217) in_op ::= IN */
170179 276, /* (218) in_op ::= NOT IN */
170180 217, /* (219) expr ::= expr in_op LP exprlist RP */
170181 217, /* (220) expr ::= LP select RP */
170182 217, /* (221) expr ::= expr in_op LP select RP */
170183 217, /* (222) expr ::= expr in_op nm dbnm paren_exprlist */
170184 217, /* (223) expr ::= EXISTS LP select RP */
170185 217, /* (224) expr ::= CASE case_operand case_exprlist case_else END */
170186 279, /* (225) case_exprlist ::= case_exprlist WHEN expr THEN expr */
170187 279, /* (226) case_exprlist ::= WHEN expr THEN expr */
170188 280, /* (227) case_else ::= ELSE expr */
170189 280, /* (228) case_else ::= */
170190 278, /* (229) case_operand ::= expr */
170191 278, /* (230) case_operand ::= */
170192 261, /* (231) exprlist ::= */
170193 253, /* (232) nexprlist ::= nexprlist COMMA expr */
170194 253, /* (233) nexprlist ::= expr */
170195 277, /* (234) paren_exprlist ::= */
170196 277, /* (235) paren_exprlist ::= LP exprlist RP */
170197 190, /* (236) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
170198 281, /* (237) uniqueflag ::= UNIQUE */
170199 281, /* (238) uniqueflag ::= */
170200 221, /* (239) eidlist_opt ::= */
170201 221, /* (240) eidlist_opt ::= LP eidlist RP */
170202 232, /* (241) eidlist ::= eidlist COMMA nm collate sortorder */
170203 232, /* (242) eidlist ::= nm collate sortorder */
170204 282, /* (243) collate ::= */
170205 282, /* (244) collate ::= COLLATE ID|STRING */
170206 190, /* (245) cmd ::= DROP INDEX ifexists fullname */
170207 190, /* (246) cmd ::= VACUUM vinto */
170208 190, /* (247) cmd ::= VACUUM nm vinto */
170209 283, /* (248) vinto ::= INTO expr */
170210 283, /* (249) vinto ::= */
170211 190, /* (250) cmd ::= PRAGMA nm dbnm */
170212 190, /* (251) cmd ::= PRAGMA nm dbnm EQ nmnum */
170213 190, /* (252) cmd ::= PRAGMA nm dbnm LP nmnum RP */
170214 190, /* (253) cmd ::= PRAGMA nm dbnm EQ minus_num */
170215 190, /* (254) cmd ::= PRAGMA nm dbnm LP minus_num RP */
170216 211, /* (255) plus_num ::= PLUS INTEGER|FLOAT */
170217 212, /* (256) minus_num ::= MINUS INTEGER|FLOAT */
170218 190, /* (257) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
170219 285, /* (258) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
170220 287, /* (259) trigger_time ::= BEFORE|AFTER */
170221 287, /* (260) trigger_time ::= INSTEAD OF */
170222 287, /* (261) trigger_time ::= */
170223 288, /* (262) trigger_event ::= DELETE|INSERT */
170224 288, /* (263) trigger_event ::= UPDATE */
170225 288, /* (264) trigger_event ::= UPDATE OF idlist */
170226 290, /* (265) when_clause ::= */
170227 290, /* (266) when_clause ::= WHEN expr */
170228 286, /* (267) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
170229 286, /* (268) trigger_cmd_list ::= trigger_cmd SEMI */
170230 292, /* (269) trnm ::= nm DOT nm */
170231 293, /* (270) tridxby ::= INDEXED BY nm */
170232 293, /* (271) tridxby ::= NOT INDEXED */
170233 291, /* (272) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
170234 291, /* (273) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
170235 291, /* (274) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
170236 291, /* (275) trigger_cmd ::= scanpt select scanpt */
170237 217, /* (276) expr ::= RAISE LP IGNORE RP */
170238 217, /* (277) expr ::= RAISE LP raisetype COMMA nm RP */
170239 236, /* (278) raisetype ::= ROLLBACK */
170240 236, /* (279) raisetype ::= ABORT */
170241 236, /* (280) raisetype ::= FAIL */
170242 190, /* (281) cmd ::= DROP TRIGGER ifexists fullname */
170243 190, /* (282) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
170244 190, /* (283) cmd ::= DETACH database_kw_opt expr */
170245 295, /* (284) key_opt ::= */
170246 295, /* (285) key_opt ::= KEY expr */
170247 190, /* (286) cmd ::= REINDEX */
170248 190, /* (287) cmd ::= REINDEX nm dbnm */
170249 190, /* (288) cmd ::= ANALYZE */
170250 190, /* (289) cmd ::= ANALYZE nm dbnm */
170251 190, /* (290) cmd ::= ALTER TABLE fullname RENAME TO nm */
170252 190, /* (291) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
170253 190, /* (292) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
170254 296, /* (293) add_column_fullname ::= fullname */
170255 190, /* (294) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
170256 190, /* (295) cmd ::= create_vtab */
170257 190, /* (296) cmd ::= create_vtab LP vtabarglist RP */
170258 298, /* (297) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
170259 300, /* (298) vtabarg ::= */
170260 301, /* (299) vtabargtoken ::= ANY */
170261 301, /* (300) vtabargtoken ::= lp anylist RP */
170262 302, /* (301) lp ::= LP */
170263 266, /* (302) with ::= WITH wqlist */
170264 266, /* (303) with ::= WITH RECURSIVE wqlist */
170265 305, /* (304) wqas ::= AS */
170266 305, /* (305) wqas ::= AS MATERIALIZED */
170267 305, /* (306) wqas ::= AS NOT MATERIALIZED */
170268 304, /* (307) wqitem ::= nm eidlist_opt wqas LP select RP */
170269 241, /* (308) wqlist ::= wqitem */
170270 241, /* (309) wqlist ::= wqlist COMMA wqitem */
170271 306, /* (310) windowdefn_list ::= windowdefn */
170272 306, /* (311) windowdefn_list ::= windowdefn_list COMMA windowdefn */
170273 307, /* (312) windowdefn ::= nm AS LP window RP */
170274 308, /* (313) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
170275 308, /* (314) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
170276 308, /* (315) window ::= ORDER BY sortlist frame_opt */
170277 308, /* (316) window ::= nm ORDER BY sortlist frame_opt */
170278 308, /* (317) window ::= frame_opt */
170279 308, /* (318) window ::= nm frame_opt */
170280 309, /* (319) frame_opt ::= */
170281 309, /* (320) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
170282 309, /* (321) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
170283 313, /* (322) range_or_rows ::= RANGE|ROWS|GROUPS */
170284 315, /* (323) frame_bound_s ::= frame_bound */
170285 315, /* (324) frame_bound_s ::= UNBOUNDED PRECEDING */
170286 316, /* (325) frame_bound_e ::= frame_bound */
170287 316, /* (326) frame_bound_e ::= UNBOUNDED FOLLOWING */
170288 314, /* (327) frame_bound ::= expr PRECEDING|FOLLOWING */
170289 314, /* (328) frame_bound ::= CURRENT ROW */
170290 317, /* (329) frame_exclude_opt ::= */
170291 317, /* (330) frame_exclude_opt ::= EXCLUDE frame_exclude */
170292 318, /* (331) frame_exclude ::= NO OTHERS */
170293 318, /* (332) frame_exclude ::= CURRENT ROW */
170294 318, /* (333) frame_exclude ::= GROUP|TIES */
170295 251, /* (334) window_clause ::= WINDOW windowdefn_list */
170296 273, /* (335) filter_over ::= filter_clause over_clause */
170297 273, /* (336) filter_over ::= over_clause */
170298 273, /* (337) filter_over ::= filter_clause */
170299 312, /* (338) over_clause ::= OVER LP window RP */
170300 312, /* (339) over_clause ::= OVER nm */
170301 311, /* (340) filter_clause ::= FILTER LP WHERE expr RP */
170302 185, /* (341) input ::= cmdlist */
170303 186, /* (342) cmdlist ::= cmdlist ecmd */
170304 186, /* (343) cmdlist ::= ecmd */
170305 187, /* (344) ecmd ::= SEMI */
170306 187, /* (345) ecmd ::= cmdx SEMI */
170307 187, /* (346) ecmd ::= explain cmdx SEMI */
170308 192, /* (347) trans_opt ::= */
170309 192, /* (348) trans_opt ::= TRANSACTION */
170310 192, /* (349) trans_opt ::= TRANSACTION nm */
170311 194, /* (350) savepoint_opt ::= SAVEPOINT */
170312 194, /* (351) savepoint_opt ::= */
170313 190, /* (352) cmd ::= create_table create_table_args */
170314 203, /* (353) table_option_set ::= table_option */
170315 201, /* (354) columnlist ::= columnlist COMMA columnname carglist */
170316 201, /* (355) columnlist ::= columnname carglist */
170317 193, /* (356) nm ::= ID|INDEXED|JOIN_KW */
170318 193, /* (357) nm ::= STRING */
170319 208, /* (358) typetoken ::= typename */
170320 209, /* (359) typename ::= ID|STRING */
170321 210, /* (360) signed ::= plus_num */
170322 210, /* (361) signed ::= minus_num */
170323 207, /* (362) carglist ::= carglist ccons */
170324 207, /* (363) carglist ::= */
170325 215, /* (364) ccons ::= NULL onconf */
170326 215, /* (365) ccons ::= GENERATED ALWAYS AS generated */
170327 215, /* (366) ccons ::= AS generated */
170328 202, /* (367) conslist_opt ::= COMMA conslist */
170329 228, /* (368) conslist ::= conslist tconscomma tcons */
170330 228, /* (369) conslist ::= tcons */
170331 229, /* (370) tconscomma ::= */
170332 233, /* (371) defer_subclause_opt ::= defer_subclause */
170333 235, /* (372) resolvetype ::= raisetype */
170334 239, /* (373) selectnowith ::= oneselect */
170335 240, /* (374) oneselect ::= values */
170336 254, /* (375) sclp ::= selcollist COMMA */
170337 255, /* (376) as ::= ID|STRING */
170338 264, /* (377) indexed_opt ::= indexed_by */
170339 272, /* (378) returning ::= */
170340 217, /* (379) expr ::= term */
170341 274, /* (380) likeop ::= LIKE_KW|MATCH */
170342 261, /* (381) exprlist ::= nexprlist */
170343 284, /* (382) nmnum ::= plus_num */
170344 284, /* (383) nmnum ::= nm */
170345 284, /* (384) nmnum ::= ON */
170346 284, /* (385) nmnum ::= DELETE */
170347 284, /* (386) nmnum ::= DEFAULT */
170348 211, /* (387) plus_num ::= INTEGER|FLOAT */
170349 289, /* (388) foreach_clause ::= */
170350 289, /* (389) foreach_clause ::= FOR EACH ROW */
170351 292, /* (390) trnm ::= nm */
170352 293, /* (391) tridxby ::= */
170353 294, /* (392) database_kw_opt ::= DATABASE */
170354 294, /* (393) database_kw_opt ::= */
170355 297, /* (394) kwcolumn_opt ::= */
170356 297, /* (395) kwcolumn_opt ::= COLUMNKW */
170357 299, /* (396) vtabarglist ::= vtabarg */
170358 299, /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */
170359 300, /* (398) vtabarg ::= vtabarg vtabargtoken */
170360 303, /* (399) anylist ::= */
170361 303, /* (400) anylist ::= anylist LP anylist RP */
170362 303, /* (401) anylist ::= anylist ANY */
170363 266, /* (402) with ::= */
 
 
170364 };
170365
170366 /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
170367 ** of symbols on the right-hand side of that rule. */
170368 static const signed char yyRuleInfoNRhs[] = {
@@ -170118,237 +170542,235 @@
170542 0, /* (173) idlist_opt ::= */
170543 -3, /* (174) idlist_opt ::= LP idlist RP */
170544 -3, /* (175) idlist ::= idlist COMMA nm */
170545 -1, /* (176) idlist ::= nm */
170546 -3, /* (177) expr ::= LP expr RP */
170547 -1, /* (178) expr ::= ID|INDEXED|JOIN_KW */
170548 -3, /* (179) expr ::= nm DOT nm */
170549 -5, /* (180) expr ::= nm DOT nm DOT nm */
170550 -1, /* (181) term ::= NULL|FLOAT|BLOB */
170551 -1, /* (182) term ::= STRING */
170552 -1, /* (183) term ::= INTEGER */
170553 -1, /* (184) expr ::= VARIABLE */
170554 -3, /* (185) expr ::= expr COLLATE ID|STRING */
170555 -6, /* (186) expr ::= CAST LP expr AS typetoken RP */
170556 -5, /* (187) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
170557 -4, /* (188) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
170558 -6, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
170559 -5, /* (190) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
170560 -1, /* (191) term ::= CTIME_KW */
170561 -5, /* (192) expr ::= LP nexprlist COMMA expr RP */
170562 -3, /* (193) expr ::= expr AND expr */
170563 -3, /* (194) expr ::= expr OR expr */
170564 -3, /* (195) expr ::= expr LT|GT|GE|LE expr */
170565 -3, /* (196) expr ::= expr EQ|NE expr */
170566 -3, /* (197) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
170567 -3, /* (198) expr ::= expr PLUS|MINUS expr */
170568 -3, /* (199) expr ::= expr STAR|SLASH|REM expr */
170569 -3, /* (200) expr ::= expr CONCAT expr */
170570 -2, /* (201) likeop ::= NOT LIKE_KW|MATCH */
170571 -3, /* (202) expr ::= expr likeop expr */
170572 -5, /* (203) expr ::= expr likeop expr ESCAPE expr */
170573 -2, /* (204) expr ::= expr ISNULL|NOTNULL */
170574 -3, /* (205) expr ::= expr NOT NULL */
170575 -3, /* (206) expr ::= expr IS expr */
170576 -4, /* (207) expr ::= expr IS NOT expr */
170577 -6, /* (208) expr ::= expr IS NOT DISTINCT FROM expr */
170578 -5, /* (209) expr ::= expr IS DISTINCT FROM expr */
170579 -2, /* (210) expr ::= NOT expr */
170580 -2, /* (211) expr ::= BITNOT expr */
170581 -2, /* (212) expr ::= PLUS|MINUS expr */
170582 -3, /* (213) expr ::= expr PTR expr */
170583 -1, /* (214) between_op ::= BETWEEN */
170584 -2, /* (215) between_op ::= NOT BETWEEN */
170585 -5, /* (216) expr ::= expr between_op expr AND expr */
170586 -1, /* (217) in_op ::= IN */
170587 -2, /* (218) in_op ::= NOT IN */
170588 -5, /* (219) expr ::= expr in_op LP exprlist RP */
170589 -3, /* (220) expr ::= LP select RP */
170590 -5, /* (221) expr ::= expr in_op LP select RP */
170591 -5, /* (222) expr ::= expr in_op nm dbnm paren_exprlist */
170592 -4, /* (223) expr ::= EXISTS LP select RP */
170593 -5, /* (224) expr ::= CASE case_operand case_exprlist case_else END */
170594 -5, /* (225) case_exprlist ::= case_exprlist WHEN expr THEN expr */
170595 -4, /* (226) case_exprlist ::= WHEN expr THEN expr */
170596 -2, /* (227) case_else ::= ELSE expr */
170597 0, /* (228) case_else ::= */
170598 -1, /* (229) case_operand ::= expr */
170599 0, /* (230) case_operand ::= */
170600 0, /* (231) exprlist ::= */
170601 -3, /* (232) nexprlist ::= nexprlist COMMA expr */
170602 -1, /* (233) nexprlist ::= expr */
170603 0, /* (234) paren_exprlist ::= */
170604 -3, /* (235) paren_exprlist ::= LP exprlist RP */
170605 -12, /* (236) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
170606 -1, /* (237) uniqueflag ::= UNIQUE */
170607 0, /* (238) uniqueflag ::= */
170608 0, /* (239) eidlist_opt ::= */
170609 -3, /* (240) eidlist_opt ::= LP eidlist RP */
170610 -5, /* (241) eidlist ::= eidlist COMMA nm collate sortorder */
170611 -3, /* (242) eidlist ::= nm collate sortorder */
170612 0, /* (243) collate ::= */
170613 -2, /* (244) collate ::= COLLATE ID|STRING */
170614 -4, /* (245) cmd ::= DROP INDEX ifexists fullname */
170615 -2, /* (246) cmd ::= VACUUM vinto */
170616 -3, /* (247) cmd ::= VACUUM nm vinto */
170617 -2, /* (248) vinto ::= INTO expr */
170618 0, /* (249) vinto ::= */
170619 -3, /* (250) cmd ::= PRAGMA nm dbnm */
170620 -5, /* (251) cmd ::= PRAGMA nm dbnm EQ nmnum */
170621 -6, /* (252) cmd ::= PRAGMA nm dbnm LP nmnum RP */
170622 -5, /* (253) cmd ::= PRAGMA nm dbnm EQ minus_num */
170623 -6, /* (254) cmd ::= PRAGMA nm dbnm LP minus_num RP */
170624 -2, /* (255) plus_num ::= PLUS INTEGER|FLOAT */
170625 -2, /* (256) minus_num ::= MINUS INTEGER|FLOAT */
170626 -5, /* (257) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
170627 -11, /* (258) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
170628 -1, /* (259) trigger_time ::= BEFORE|AFTER */
170629 -2, /* (260) trigger_time ::= INSTEAD OF */
170630 0, /* (261) trigger_time ::= */
170631 -1, /* (262) trigger_event ::= DELETE|INSERT */
170632 -1, /* (263) trigger_event ::= UPDATE */
170633 -3, /* (264) trigger_event ::= UPDATE OF idlist */
170634 0, /* (265) when_clause ::= */
170635 -2, /* (266) when_clause ::= WHEN expr */
170636 -3, /* (267) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
170637 -2, /* (268) trigger_cmd_list ::= trigger_cmd SEMI */
170638 -3, /* (269) trnm ::= nm DOT nm */
170639 -3, /* (270) tridxby ::= INDEXED BY nm */
170640 -2, /* (271) tridxby ::= NOT INDEXED */
170641 -9, /* (272) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
170642 -8, /* (273) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
170643 -6, /* (274) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
170644 -3, /* (275) trigger_cmd ::= scanpt select scanpt */
170645 -4, /* (276) expr ::= RAISE LP IGNORE RP */
170646 -6, /* (277) expr ::= RAISE LP raisetype COMMA nm RP */
170647 -1, /* (278) raisetype ::= ROLLBACK */
170648 -1, /* (279) raisetype ::= ABORT */
170649 -1, /* (280) raisetype ::= FAIL */
170650 -4, /* (281) cmd ::= DROP TRIGGER ifexists fullname */
170651 -6, /* (282) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
170652 -3, /* (283) cmd ::= DETACH database_kw_opt expr */
170653 0, /* (284) key_opt ::= */
170654 -2, /* (285) key_opt ::= KEY expr */
170655 -1, /* (286) cmd ::= REINDEX */
170656 -3, /* (287) cmd ::= REINDEX nm dbnm */
170657 -1, /* (288) cmd ::= ANALYZE */
170658 -3, /* (289) cmd ::= ANALYZE nm dbnm */
170659 -6, /* (290) cmd ::= ALTER TABLE fullname RENAME TO nm */
170660 -7, /* (291) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
170661 -6, /* (292) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
170662 -1, /* (293) add_column_fullname ::= fullname */
170663 -8, /* (294) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
170664 -1, /* (295) cmd ::= create_vtab */
170665 -4, /* (296) cmd ::= create_vtab LP vtabarglist RP */
170666 -8, /* (297) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
170667 0, /* (298) vtabarg ::= */
170668 -1, /* (299) vtabargtoken ::= ANY */
170669 -3, /* (300) vtabargtoken ::= lp anylist RP */
170670 -1, /* (301) lp ::= LP */
170671 -2, /* (302) with ::= WITH wqlist */
170672 -3, /* (303) with ::= WITH RECURSIVE wqlist */
170673 -1, /* (304) wqas ::= AS */
170674 -2, /* (305) wqas ::= AS MATERIALIZED */
170675 -3, /* (306) wqas ::= AS NOT MATERIALIZED */
170676 -6, /* (307) wqitem ::= nm eidlist_opt wqas LP select RP */
170677 -1, /* (308) wqlist ::= wqitem */
170678 -3, /* (309) wqlist ::= wqlist COMMA wqitem */
170679 -1, /* (310) windowdefn_list ::= windowdefn */
170680 -3, /* (311) windowdefn_list ::= windowdefn_list COMMA windowdefn */
170681 -5, /* (312) windowdefn ::= nm AS LP window RP */
170682 -5, /* (313) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
170683 -6, /* (314) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
170684 -4, /* (315) window ::= ORDER BY sortlist frame_opt */
170685 -5, /* (316) window ::= nm ORDER BY sortlist frame_opt */
170686 -1, /* (317) window ::= frame_opt */
170687 -2, /* (318) window ::= nm frame_opt */
170688 0, /* (319) frame_opt ::= */
170689 -3, /* (320) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
170690 -6, /* (321) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
170691 -1, /* (322) range_or_rows ::= RANGE|ROWS|GROUPS */
170692 -1, /* (323) frame_bound_s ::= frame_bound */
170693 -2, /* (324) frame_bound_s ::= UNBOUNDED PRECEDING */
170694 -1, /* (325) frame_bound_e ::= frame_bound */
170695 -2, /* (326) frame_bound_e ::= UNBOUNDED FOLLOWING */
170696 -2, /* (327) frame_bound ::= expr PRECEDING|FOLLOWING */
170697 -2, /* (328) frame_bound ::= CURRENT ROW */
170698 0, /* (329) frame_exclude_opt ::= */
170699 -2, /* (330) frame_exclude_opt ::= EXCLUDE frame_exclude */
170700 -2, /* (331) frame_exclude ::= NO OTHERS */
170701 -2, /* (332) frame_exclude ::= CURRENT ROW */
170702 -1, /* (333) frame_exclude ::= GROUP|TIES */
170703 -2, /* (334) window_clause ::= WINDOW windowdefn_list */
170704 -2, /* (335) filter_over ::= filter_clause over_clause */
170705 -1, /* (336) filter_over ::= over_clause */
170706 -1, /* (337) filter_over ::= filter_clause */
170707 -4, /* (338) over_clause ::= OVER LP window RP */
170708 -2, /* (339) over_clause ::= OVER nm */
170709 -5, /* (340) filter_clause ::= FILTER LP WHERE expr RP */
170710 -1, /* (341) input ::= cmdlist */
170711 -2, /* (342) cmdlist ::= cmdlist ecmd */
170712 -1, /* (343) cmdlist ::= ecmd */
170713 -1, /* (344) ecmd ::= SEMI */
170714 -2, /* (345) ecmd ::= cmdx SEMI */
170715 -3, /* (346) ecmd ::= explain cmdx SEMI */
170716 0, /* (347) trans_opt ::= */
170717 -1, /* (348) trans_opt ::= TRANSACTION */
170718 -2, /* (349) trans_opt ::= TRANSACTION nm */
170719 -1, /* (350) savepoint_opt ::= SAVEPOINT */
170720 0, /* (351) savepoint_opt ::= */
170721 -2, /* (352) cmd ::= create_table create_table_args */
170722 -1, /* (353) table_option_set ::= table_option */
170723 -4, /* (354) columnlist ::= columnlist COMMA columnname carglist */
170724 -2, /* (355) columnlist ::= columnname carglist */
170725 -1, /* (356) nm ::= ID|INDEXED|JOIN_KW */
170726 -1, /* (357) nm ::= STRING */
170727 -1, /* (358) typetoken ::= typename */
170728 -1, /* (359) typename ::= ID|STRING */
170729 -1, /* (360) signed ::= plus_num */
170730 -1, /* (361) signed ::= minus_num */
170731 -2, /* (362) carglist ::= carglist ccons */
170732 0, /* (363) carglist ::= */
170733 -2, /* (364) ccons ::= NULL onconf */
170734 -4, /* (365) ccons ::= GENERATED ALWAYS AS generated */
170735 -2, /* (366) ccons ::= AS generated */
170736 -2, /* (367) conslist_opt ::= COMMA conslist */
170737 -3, /* (368) conslist ::= conslist tconscomma tcons */
170738 -1, /* (369) conslist ::= tcons */
170739 0, /* (370) tconscomma ::= */
170740 -1, /* (371) defer_subclause_opt ::= defer_subclause */
170741 -1, /* (372) resolvetype ::= raisetype */
170742 -1, /* (373) selectnowith ::= oneselect */
170743 -1, /* (374) oneselect ::= values */
170744 -2, /* (375) sclp ::= selcollist COMMA */
170745 -1, /* (376) as ::= ID|STRING */
170746 -1, /* (377) indexed_opt ::= indexed_by */
170747 0, /* (378) returning ::= */
170748 -1, /* (379) expr ::= term */
170749 -1, /* (380) likeop ::= LIKE_KW|MATCH */
170750 -1, /* (381) exprlist ::= nexprlist */
170751 -1, /* (382) nmnum ::= plus_num */
170752 -1, /* (383) nmnum ::= nm */
170753 -1, /* (384) nmnum ::= ON */
170754 -1, /* (385) nmnum ::= DELETE */
170755 -1, /* (386) nmnum ::= DEFAULT */
170756 -1, /* (387) plus_num ::= INTEGER|FLOAT */
170757 0, /* (388) foreach_clause ::= */
170758 -3, /* (389) foreach_clause ::= FOR EACH ROW */
170759 -1, /* (390) trnm ::= nm */
170760 0, /* (391) tridxby ::= */
170761 -1, /* (392) database_kw_opt ::= DATABASE */
170762 0, /* (393) database_kw_opt ::= */
170763 0, /* (394) kwcolumn_opt ::= */
170764 -1, /* (395) kwcolumn_opt ::= COLUMNKW */
170765 -1, /* (396) vtabarglist ::= vtabarg */
170766 -3, /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */
170767 -2, /* (398) vtabarg ::= vtabarg vtabargtoken */
170768 0, /* (399) anylist ::= */
170769 -4, /* (400) anylist ::= anylist LP anylist RP */
170770 -2, /* (401) anylist ::= anylist ANY */
170771 0, /* (402) with ::= */
 
 
170772 };
170773
170774 static void yy_accept(yyParser*); /* Forward Declaration */
170775
170776 /*
@@ -170404,11 +170826,11 @@
170826 {yymsp[1].minor.yy394 = TK_DEFERRED;}
170827 break;
170828 case 5: /* transtype ::= DEFERRED */
170829 case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
170830 case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
170831 case 322: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==322);
170832 {yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/}
170833 break;
170834 case 8: /* cmd ::= COMMIT|END trans_opt */
170835 case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
170836 {sqlite3EndTransaction(pParse,yymsp[-1].major);}
@@ -170441,11 +170863,11 @@
170863 case 47: /* autoinc ::= */ yytestcase(yyruleno==47);
170864 case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62);
170865 case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72);
170866 case 81: /* ifexists ::= */ yytestcase(yyruleno==81);
170867 case 98: /* distinct ::= */ yytestcase(yyruleno==98);
170868 case 243: /* collate ::= */ yytestcase(yyruleno==243);
170869 {yymsp[1].minor.yy394 = 0;}
170870 break;
170871 case 16: /* ifnotexists ::= IF NOT EXISTS */
170872 {yymsp[-2].minor.yy394 = 1;}
170873 break;
@@ -170625,13 +171047,13 @@
171047 case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171);
171048 {yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;}
171049 break;
171050 case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
171051 case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80);
171052 case 215: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==215);
171053 case 218: /* in_op ::= NOT IN */ yytestcase(yyruleno==218);
171054 case 244: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==244);
171055 {yymsp[-1].minor.yy394 = 1;}
171056 break;
171057 case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
171058 {yymsp[-1].minor.yy394 = 0;}
171059 break;
@@ -170777,13 +171199,13 @@
171199 {yymsp[0].minor.yy394 = SF_All;}
171200 break;
171201 case 99: /* sclp ::= */
171202 case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132);
171203 case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142);
171204 case 231: /* exprlist ::= */ yytestcase(yyruleno==231);
171205 case 234: /* paren_exprlist ::= */ yytestcase(yyruleno==234);
171206 case 239: /* eidlist_opt ::= */ yytestcase(yyruleno==239);
171207 {yymsp[1].minor.yy322 = 0;}
171208 break;
171209 case 100: /* selcollist ::= sclp scanpt expr scanpt as */
171210 {
171211 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
@@ -170805,12 +171227,12 @@
171227 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot);
171228 }
171229 break;
171230 case 103: /* as ::= AS nm */
171231 case 115: /* dbnm ::= DOT nm */ yytestcase(yyruleno==115);
171232 case 255: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==255);
171233 case 256: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==256);
171234 {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
171235 break;
171236 case 105: /* from ::= */
171237 case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108);
171238 {yymsp[1].minor.yy131 = 0;}
@@ -170978,20 +171400,20 @@
171400 break;
171401 case 144: /* having_opt ::= */
171402 case 146: /* limit_opt ::= */ yytestcase(yyruleno==146);
171403 case 151: /* where_opt ::= */ yytestcase(yyruleno==151);
171404 case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153);
171405 case 228: /* case_else ::= */ yytestcase(yyruleno==228);
171406 case 230: /* case_operand ::= */ yytestcase(yyruleno==230);
171407 case 249: /* vinto ::= */ yytestcase(yyruleno==249);
171408 {yymsp[1].minor.yy528 = 0;}
171409 break;
171410 case 145: /* having_opt ::= HAVING expr */
171411 case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152);
171412 case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154);
171413 case 227: /* case_else ::= ELSE expr */ yytestcase(yyruleno==227);
171414 case 248: /* vinto ::= INTO expr */ yytestcase(yyruleno==248);
171415 {yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;}
171416 break;
171417 case 147: /* limit_opt ::= LIMIT expr */
171418 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);}
171419 break;
@@ -171099,23 +171521,22 @@
171521 {yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
171522 break;
171523 case 177: /* expr ::= LP expr RP */
171524 {yymsp[-2].minor.yy528 = yymsp[-1].minor.yy528;}
171525 break;
171526 case 178: /* expr ::= ID|INDEXED|JOIN_KW */
 
171527 {yymsp[0].minor.yy528=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
171528 break;
171529 case 179: /* expr ::= nm DOT nm */
171530 {
171531 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
171532 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
171533 yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
171534 }
171535 yymsp[-2].minor.yy528 = yylhsminor.yy528;
171536 break;
171537 case 180: /* expr ::= nm DOT nm DOT nm */
171538 {
171539 Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0);
171540 Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0);
171541 Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0);
171542 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
@@ -171124,22 +171545,22 @@
171545 }
171546 yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
171547 }
171548 yymsp[-4].minor.yy528 = yylhsminor.yy528;
171549 break;
171550 case 181: /* term ::= NULL|FLOAT|BLOB */
171551 case 182: /* term ::= STRING */ yytestcase(yyruleno==182);
171552 {yymsp[0].minor.yy528=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
171553 break;
171554 case 183: /* term ::= INTEGER */
171555 {
171556 yylhsminor.yy528 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
171557 if( yylhsminor.yy528 ) yylhsminor.yy528->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail);
171558 }
171559 yymsp[0].minor.yy528 = yylhsminor.yy528;
171560 break;
171561 case 184: /* expr ::= VARIABLE */
171562 {
171563 if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
171564 u32 n = yymsp[0].minor.yy0.n;
171565 yymsp[0].minor.yy528 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
171566 sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy528, n);
@@ -171157,54 +171578,54 @@
171578 if( yymsp[0].minor.yy528 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy528->iTable);
171579 }
171580 }
171581 }
171582 break;
171583 case 185: /* expr ::= expr COLLATE ID|STRING */
171584 {
171585 yymsp[-2].minor.yy528 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy528, &yymsp[0].minor.yy0, 1);
171586 }
171587 break;
171588 case 186: /* expr ::= CAST LP expr AS typetoken RP */
171589 {
171590 yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
171591 sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy528, yymsp[-3].minor.yy528, 0);
171592 }
171593 break;
171594 case 187: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */
171595 {
171596 yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy394);
171597 }
171598 yymsp[-4].minor.yy528 = yylhsminor.yy528;
171599 break;
171600 case 188: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */
171601 {
171602 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
171603 }
171604 yymsp[-3].minor.yy528 = yylhsminor.yy528;
171605 break;
171606 case 189: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */
171607 {
171608 yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy322, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy394);
171609 sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
171610 }
171611 yymsp[-5].minor.yy528 = yylhsminor.yy528;
171612 break;
171613 case 190: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */
171614 {
171615 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
171616 sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41);
171617 }
171618 yymsp[-4].minor.yy528 = yylhsminor.yy528;
171619 break;
171620 case 191: /* term ::= CTIME_KW */
171621 {
171622 yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
171623 }
171624 yymsp[0].minor.yy528 = yylhsminor.yy528;
171625 break;
171626 case 192: /* expr ::= LP nexprlist COMMA expr RP */
171627 {
171628 ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528);
171629 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
171630 if( yymsp[-4].minor.yy528 ){
171631 yymsp[-4].minor.yy528->x.pList = pList;
@@ -171214,26 +171635,26 @@
171635 }else{
171636 sqlite3ExprListDelete(pParse->db, pList);
171637 }
171638 }
171639 break;
171640 case 193: /* expr ::= expr AND expr */
171641 {yymsp[-2].minor.yy528=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
171642 break;
171643 case 194: /* expr ::= expr OR expr */
171644 case 195: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==195);
171645 case 196: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==196);
171646 case 197: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==197);
171647 case 198: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==198);
171648 case 199: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==199);
171649 case 200: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==200);
171650 {yymsp[-2].minor.yy528=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);}
171651 break;
171652 case 201: /* likeop ::= NOT LIKE_KW|MATCH */
171653 {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
171654 break;
171655 case 202: /* expr ::= expr likeop expr */
171656 {
171657 ExprList *pList;
171658 int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
171659 yymsp[-1].minor.yy0.n &= 0x7fffffff;
171660 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy528);
@@ -171241,11 +171662,11 @@
171662 yymsp[-2].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
171663 if( bNot ) yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy528, 0);
171664 if( yymsp[-2].minor.yy528 ) yymsp[-2].minor.yy528->flags |= EP_InfixFunc;
171665 }
171666 break;
171667 case 203: /* expr ::= expr likeop expr ESCAPE expr */
171668 {
171669 ExprList *pList;
171670 int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
171671 yymsp[-3].minor.yy0.n &= 0x7fffffff;
171672 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
@@ -171254,63 +171675,63 @@
171675 yymsp[-4].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
171676 if( bNot ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171677 if( yymsp[-4].minor.yy528 ) yymsp[-4].minor.yy528->flags |= EP_InfixFunc;
171678 }
171679 break;
171680 case 204: /* expr ::= expr ISNULL|NOTNULL */
171681 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy528,0);}
171682 break;
171683 case 205: /* expr ::= expr NOT NULL */
171684 {yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy528,0);}
171685 break;
171686 case 206: /* expr ::= expr IS expr */
171687 {
171688 yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);
171689 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-2].minor.yy528, TK_ISNULL);
171690 }
171691 break;
171692 case 207: /* expr ::= expr IS NOT expr */
171693 {
171694 yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528);
171695 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL);
171696 }
171697 break;
171698 case 208: /* expr ::= expr IS NOT DISTINCT FROM expr */
171699 {
171700 yymsp[-5].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy528,yymsp[0].minor.yy528);
171701 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-5].minor.yy528, TK_ISNULL);
171702 }
171703 break;
171704 case 209: /* expr ::= expr IS DISTINCT FROM expr */
171705 {
171706 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy528,yymsp[0].minor.yy528);
171707 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-4].minor.yy528, TK_NOTNULL);
171708 }
171709 break;
171710 case 210: /* expr ::= NOT expr */
171711 case 211: /* expr ::= BITNOT expr */ yytestcase(yyruleno==211);
171712 {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/}
171713 break;
171714 case 212: /* expr ::= PLUS|MINUS expr */
171715 {
171716 yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0);
171717 /*A-overwrites-B*/
171718 }
171719 break;
171720 case 213: /* expr ::= expr PTR expr */
171721 {
171722 ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528);
171723 pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528);
171724 yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
171725 }
171726 yymsp[-2].minor.yy528 = yylhsminor.yy528;
171727 break;
171728 case 214: /* between_op ::= BETWEEN */
171729 case 217: /* in_op ::= IN */ yytestcase(yyruleno==217);
171730 {yymsp[0].minor.yy394 = 0;}
171731 break;
171732 case 216: /* expr ::= expr between_op expr AND expr */
171733 {
171734 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
171735 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528);
171736 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0);
171737 if( yymsp[-4].minor.yy528 ){
@@ -171319,11 +171740,11 @@
171740 sqlite3ExprListDelete(pParse->db, pList);
171741 }
171742 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171743 }
171744 break;
171745 case 219: /* expr ::= expr in_op LP exprlist RP */
171746 {
171747 if( yymsp[-1].minor.yy322==0 ){
171748 /* Expressions of the form
171749 **
171750 ** expr1 IN ()
@@ -171365,41 +171786,41 @@
171786 }
171787 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171788 }
171789 }
171790 break;
171791 case 220: /* expr ::= LP select RP */
171792 {
171793 yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
171794 sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47);
171795 }
171796 break;
171797 case 221: /* expr ::= expr in_op LP select RP */
171798 {
171799 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
171800 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47);
171801 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171802 }
171803 break;
171804 case 222: /* expr ::= expr in_op nm dbnm paren_exprlist */
171805 {
171806 SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
171807 Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
171808 if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322);
171809 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0);
171810 sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect);
171811 if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0);
171812 }
171813 break;
171814 case 223: /* expr ::= EXISTS LP select RP */
171815 {
171816 Expr *p;
171817 p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
171818 sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47);
171819 }
171820 break;
171821 case 224: /* expr ::= CASE case_operand case_exprlist case_else END */
171822 {
171823 yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0);
171824 if( yymsp[-4].minor.yy528 ){
171825 yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322;
171826 sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528);
@@ -171407,406 +171828,406 @@
171828 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322);
171829 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
171830 }
171831 }
171832 break;
171833 case 225: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
171834 {
171835 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528);
171836 yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528);
171837 }
171838 break;
171839 case 226: /* case_exprlist ::= WHEN expr THEN expr */
171840 {
171841 yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528);
171842 yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528);
171843 }
171844 break;
171845 case 229: /* case_operand ::= expr */
171846 {yymsp[0].minor.yy528 = yymsp[0].minor.yy528; /*A-overwrites-X*/}
171847 break;
171848 case 232: /* nexprlist ::= nexprlist COMMA expr */
171849 {yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);}
171850 break;
171851 case 233: /* nexprlist ::= expr */
171852 {yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/}
171853 break;
171854 case 235: /* paren_exprlist ::= LP exprlist RP */
171855 case 240: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==240);
171856 {yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;}
171857 break;
171858 case 236: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
171859 {
171860 sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
171861 sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394,
171862 &yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF);
171863 if( IN_RENAME_OBJECT && pParse->pNewIndex ){
171864 sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
171865 }
171866 }
171867 break;
171868 case 237: /* uniqueflag ::= UNIQUE */
171869 case 279: /* raisetype ::= ABORT */ yytestcase(yyruleno==279);
171870 {yymsp[0].minor.yy394 = OE_Abort;}
171871 break;
171872 case 238: /* uniqueflag ::= */
171873 {yymsp[1].minor.yy394 = OE_None;}
171874 break;
171875 case 241: /* eidlist ::= eidlist COMMA nm collate sortorder */
171876 {
171877 yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394);
171878 }
171879 break;
171880 case 242: /* eidlist ::= nm collate sortorder */
171881 {
171882 yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/
171883 }
171884 break;
171885 case 245: /* cmd ::= DROP INDEX ifexists fullname */
171886 {sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);}
171887 break;
171888 case 246: /* cmd ::= VACUUM vinto */
171889 {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);}
171890 break;
171891 case 247: /* cmd ::= VACUUM nm vinto */
171892 {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);}
171893 break;
171894 case 250: /* cmd ::= PRAGMA nm dbnm */
171895 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
171896 break;
171897 case 251: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
171898 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
171899 break;
171900 case 252: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
171901 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
171902 break;
171903 case 253: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
171904 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
171905 break;
171906 case 254: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
171907 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
171908 break;
171909 case 257: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
171910 {
171911 Token all;
171912 all.z = yymsp[-3].minor.yy0.z;
171913 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
171914 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all);
171915 }
171916 break;
171917 case 258: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
171918 {
171919 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy394, yymsp[-4].minor.yy180.a, yymsp[-4].minor.yy180.b, yymsp[-2].minor.yy131, yymsp[0].minor.yy528, yymsp[-10].minor.yy394, yymsp[-8].minor.yy394);
171920 yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
171921 }
171922 break;
171923 case 259: /* trigger_time ::= BEFORE|AFTER */
171924 { yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ }
171925 break;
171926 case 260: /* trigger_time ::= INSTEAD OF */
171927 { yymsp[-1].minor.yy394 = TK_INSTEAD;}
171928 break;
171929 case 261: /* trigger_time ::= */
171930 { yymsp[1].minor.yy394 = TK_BEFORE; }
171931 break;
171932 case 262: /* trigger_event ::= DELETE|INSERT */
171933 case 263: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==263);
171934 {yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;}
171935 break;
171936 case 264: /* trigger_event ::= UPDATE OF idlist */
171937 {yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;}
171938 break;
171939 case 265: /* when_clause ::= */
171940 case 284: /* key_opt ::= */ yytestcase(yyruleno==284);
171941 { yymsp[1].minor.yy528 = 0; }
171942 break;
171943 case 266: /* when_clause ::= WHEN expr */
171944 case 285: /* key_opt ::= KEY expr */ yytestcase(yyruleno==285);
171945 { yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; }
171946 break;
171947 case 267: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
171948 {
171949 assert( yymsp[-2].minor.yy33!=0 );
171950 yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33;
171951 yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33;
171952 }
171953 break;
171954 case 268: /* trigger_cmd_list ::= trigger_cmd SEMI */
171955 {
171956 assert( yymsp[-1].minor.yy33!=0 );
171957 yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33;
171958 }
171959 break;
171960 case 269: /* trnm ::= nm DOT nm */
171961 {
171962 yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
171963 sqlite3ErrorMsg(pParse,
171964 "qualified table names are not allowed on INSERT, UPDATE, and DELETE "
171965 "statements within triggers");
171966 }
171967 break;
171968 case 270: /* tridxby ::= INDEXED BY nm */
171969 {
171970 sqlite3ErrorMsg(pParse,
171971 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
171972 "within triggers");
171973 }
171974 break;
171975 case 271: /* tridxby ::= NOT INDEXED */
171976 {
171977 sqlite3ErrorMsg(pParse,
171978 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
171979 "within triggers");
171980 }
171981 break;
171982 case 272: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
171983 {yylhsminor.yy33 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy131, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528, yymsp[-7].minor.yy394, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy522);}
171984 yymsp[-8].minor.yy33 = yylhsminor.yy33;
171985 break;
171986 case 273: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
171987 {
171988 yylhsminor.yy33 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy254,yymsp[-2].minor.yy47,yymsp[-6].minor.yy394,yymsp[-1].minor.yy444,yymsp[-7].minor.yy522,yymsp[0].minor.yy522);/*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/
171989 }
171990 yymsp[-7].minor.yy33 = yylhsminor.yy33;
171991 break;
171992 case 274: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
171993 {yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);}
171994 yymsp[-5].minor.yy33 = yylhsminor.yy33;
171995 break;
171996 case 275: /* trigger_cmd ::= scanpt select scanpt */
171997 {yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/}
171998 yymsp[-2].minor.yy33 = yylhsminor.yy33;
171999 break;
172000 case 276: /* expr ::= RAISE LP IGNORE RP */
172001 {
172002 yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
172003 if( yymsp[-3].minor.yy528 ){
172004 yymsp[-3].minor.yy528->affExpr = OE_Ignore;
172005 }
172006 }
172007 break;
172008 case 277: /* expr ::= RAISE LP raisetype COMMA nm RP */
172009 {
172010 yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
172011 if( yymsp[-5].minor.yy528 ) {
172012 yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394;
172013 }
172014 }
172015 break;
172016 case 278: /* raisetype ::= ROLLBACK */
172017 {yymsp[0].minor.yy394 = OE_Rollback;}
172018 break;
172019 case 280: /* raisetype ::= FAIL */
172020 {yymsp[0].minor.yy394 = OE_Fail;}
172021 break;
172022 case 281: /* cmd ::= DROP TRIGGER ifexists fullname */
172023 {
172024 sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394);
172025 }
172026 break;
172027 case 282: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
172028 {
172029 sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528);
172030 }
172031 break;
172032 case 283: /* cmd ::= DETACH database_kw_opt expr */
172033 {
172034 sqlite3Detach(pParse, yymsp[0].minor.yy528);
172035 }
172036 break;
172037 case 286: /* cmd ::= REINDEX */
172038 {sqlite3Reindex(pParse, 0, 0);}
172039 break;
172040 case 287: /* cmd ::= REINDEX nm dbnm */
172041 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
172042 break;
172043 case 288: /* cmd ::= ANALYZE */
172044 {sqlite3Analyze(pParse, 0, 0);}
172045 break;
172046 case 289: /* cmd ::= ANALYZE nm dbnm */
172047 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
172048 break;
172049 case 290: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
172050 {
172051 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0);
172052 }
172053 break;
172054 case 291: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
172055 {
172056 yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
172057 sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
172058 }
172059 break;
172060 case 292: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */
172061 {
172062 sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0);
172063 }
172064 break;
172065 case 293: /* add_column_fullname ::= fullname */
172066 {
172067 disableLookaside(pParse);
172068 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131);
172069 }
172070 break;
172071 case 294: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
172072 {
172073 sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
172074 }
172075 break;
172076 case 295: /* cmd ::= create_vtab */
172077 {sqlite3VtabFinishParse(pParse,0);}
172078 break;
172079 case 296: /* cmd ::= create_vtab LP vtabarglist RP */
172080 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
172081 break;
172082 case 297: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
172083 {
172084 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394);
172085 }
172086 break;
172087 case 298: /* vtabarg ::= */
172088 {sqlite3VtabArgInit(pParse);}
172089 break;
172090 case 299: /* vtabargtoken ::= ANY */
172091 case 300: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==300);
172092 case 301: /* lp ::= LP */ yytestcase(yyruleno==301);
172093 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
172094 break;
172095 case 302: /* with ::= WITH wqlist */
172096 case 303: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==303);
172097 { sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); }
172098 break;
172099 case 304: /* wqas ::= AS */
172100 {yymsp[0].minor.yy516 = M10d_Any;}
172101 break;
172102 case 305: /* wqas ::= AS MATERIALIZED */
172103 {yymsp[-1].minor.yy516 = M10d_Yes;}
172104 break;
172105 case 306: /* wqas ::= AS NOT MATERIALIZED */
172106 {yymsp[-2].minor.yy516 = M10d_No;}
172107 break;
172108 case 307: /* wqitem ::= nm eidlist_opt wqas LP select RP */
172109 {
172110 yymsp[-5].minor.yy385 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy47, yymsp[-3].minor.yy516); /*A-overwrites-X*/
172111 }
172112 break;
172113 case 308: /* wqlist ::= wqitem */
172114 {
172115 yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/
172116 }
172117 break;
172118 case 309: /* wqlist ::= wqlist COMMA wqitem */
172119 {
172120 yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385);
172121 }
172122 break;
172123 case 310: /* windowdefn_list ::= windowdefn */
172124 { yylhsminor.yy41 = yymsp[0].minor.yy41; }
172125 yymsp[0].minor.yy41 = yylhsminor.yy41;
172126 break;
172127 case 311: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
172128 {
172129 assert( yymsp[0].minor.yy41!=0 );
172130 sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41);
172131 yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41;
172132 yylhsminor.yy41 = yymsp[0].minor.yy41;
172133 }
172134 yymsp[-2].minor.yy41 = yylhsminor.yy41;
172135 break;
172136 case 312: /* windowdefn ::= nm AS LP window RP */
172137 {
172138 if( ALWAYS(yymsp[-1].minor.yy41) ){
172139 yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
172140 }
172141 yylhsminor.yy41 = yymsp[-1].minor.yy41;
172142 }
172143 yymsp[-4].minor.yy41 = yylhsminor.yy41;
172144 break;
172145 case 313: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
172146 {
172147 yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0);
172148 }
172149 break;
172150 case 314: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
172151 {
172152 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0);
172153 }
172154 yymsp[-5].minor.yy41 = yylhsminor.yy41;
172155 break;
172156 case 315: /* window ::= ORDER BY sortlist frame_opt */
172157 {
172158 yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0);
172159 }
172160 break;
172161 case 316: /* window ::= nm ORDER BY sortlist frame_opt */
172162 {
172163 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0);
172164 }
172165 yymsp[-4].minor.yy41 = yylhsminor.yy41;
172166 break;
172167 case 317: /* window ::= frame_opt */
172168 case 336: /* filter_over ::= over_clause */ yytestcase(yyruleno==336);
172169 {
172170 yylhsminor.yy41 = yymsp[0].minor.yy41;
172171 }
172172 yymsp[0].minor.yy41 = yylhsminor.yy41;
172173 break;
172174 case 318: /* window ::= nm frame_opt */
172175 {
172176 yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0);
172177 }
172178 yymsp[-1].minor.yy41 = yylhsminor.yy41;
172179 break;
172180 case 319: /* frame_opt ::= */
172181 {
172182 yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
172183 }
172184 break;
172185 case 320: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
172186 {
172187 yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy394, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy516);
172188 }
172189 yymsp[-2].minor.yy41 = yylhsminor.yy41;
172190 break;
172191 case 321: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
172192 {
172193 yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy394, yymsp[-3].minor.yy595.eType, yymsp[-3].minor.yy595.pExpr, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, yymsp[0].minor.yy516);
172194 }
172195 yymsp[-5].minor.yy41 = yylhsminor.yy41;
172196 break;
172197 case 323: /* frame_bound_s ::= frame_bound */
172198 case 325: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==325);
172199 {yylhsminor.yy595 = yymsp[0].minor.yy595;}
172200 yymsp[0].minor.yy595 = yylhsminor.yy595;
172201 break;
172202 case 324: /* frame_bound_s ::= UNBOUNDED PRECEDING */
172203 case 326: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==326);
172204 case 328: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==328);
172205 {yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;}
172206 yymsp[-1].minor.yy595 = yylhsminor.yy595;
172207 break;
172208 case 327: /* frame_bound ::= expr PRECEDING|FOLLOWING */
172209 {yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;}
172210 yymsp[-1].minor.yy595 = yylhsminor.yy595;
172211 break;
172212 case 329: /* frame_exclude_opt ::= */
172213 {yymsp[1].minor.yy516 = 0;}
172214 break;
172215 case 330: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
172216 {yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;}
172217 break;
172218 case 331: /* frame_exclude ::= NO OTHERS */
172219 case 332: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==332);
172220 {yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/}
172221 break;
172222 case 333: /* frame_exclude ::= GROUP|TIES */
172223 {yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/}
172224 break;
172225 case 334: /* window_clause ::= WINDOW windowdefn_list */
172226 { yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; }
172227 break;
172228 case 335: /* filter_over ::= filter_clause over_clause */
172229 {
172230 if( yymsp[0].minor.yy41 ){
172231 yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528;
172232 }else{
172233 sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528);
@@ -171813,11 +172234,11 @@
172234 }
172235 yylhsminor.yy41 = yymsp[0].minor.yy41;
172236 }
172237 yymsp[-1].minor.yy41 = yylhsminor.yy41;
172238 break;
172239 case 337: /* filter_over ::= filter_clause */
172240 {
172241 yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
172242 if( yylhsminor.yy41 ){
172243 yylhsminor.yy41->eFrmType = TK_FILTER;
172244 yylhsminor.yy41->pFilter = yymsp[0].minor.yy528;
@@ -171825,91 +172246,90 @@
172246 sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528);
172247 }
172248 }
172249 yymsp[0].minor.yy41 = yylhsminor.yy41;
172250 break;
172251 case 338: /* over_clause ::= OVER LP window RP */
172252 {
172253 yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41;
172254 assert( yymsp[-3].minor.yy41!=0 );
172255 }
172256 break;
172257 case 339: /* over_clause ::= OVER nm */
172258 {
172259 yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
172260 if( yymsp[-1].minor.yy41 ){
172261 yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
172262 }
172263 }
172264 break;
172265 case 340: /* filter_clause ::= FILTER LP WHERE expr RP */
172266 { yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; }
172267 break;
172268 default:
172269 /* (341) input ::= cmdlist */ yytestcase(yyruleno==341);
172270 /* (342) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==342);
172271 /* (343) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=343);
172272 /* (344) ecmd ::= SEMI */ yytestcase(yyruleno==344);
172273 /* (345) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==345);
172274 /* (346) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=346);
172275 /* (347) trans_opt ::= */ yytestcase(yyruleno==347);
172276 /* (348) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==348);
172277 /* (349) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==349);
172278 /* (350) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==350);
172279 /* (351) savepoint_opt ::= */ yytestcase(yyruleno==351);
172280 /* (352) cmd ::= create_table create_table_args */ yytestcase(yyruleno==352);
172281 /* (353) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=353);
172282 /* (354) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==354);
172283 /* (355) columnlist ::= columnname carglist */ yytestcase(yyruleno==355);
172284 /* (356) nm ::= ID|INDEXED|JOIN_KW */ yytestcase(yyruleno==356);
172285 /* (357) nm ::= STRING */ yytestcase(yyruleno==357);
172286 /* (358) typetoken ::= typename */ yytestcase(yyruleno==358);
172287 /* (359) typename ::= ID|STRING */ yytestcase(yyruleno==359);
172288 /* (360) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=360);
172289 /* (361) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=361);
172290 /* (362) carglist ::= carglist ccons */ yytestcase(yyruleno==362);
172291 /* (363) carglist ::= */ yytestcase(yyruleno==363);
172292 /* (364) ccons ::= NULL onconf */ yytestcase(yyruleno==364);
172293 /* (365) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==365);
172294 /* (366) ccons ::= AS generated */ yytestcase(yyruleno==366);
172295 /* (367) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==367);
172296 /* (368) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==368);
172297 /* (369) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=369);
172298 /* (370) tconscomma ::= */ yytestcase(yyruleno==370);
172299 /* (371) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=371);
172300 /* (372) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=372);
172301 /* (373) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=373);
172302 /* (374) oneselect ::= values */ yytestcase(yyruleno==374);
172303 /* (375) sclp ::= selcollist COMMA */ yytestcase(yyruleno==375);
172304 /* (376) as ::= ID|STRING */ yytestcase(yyruleno==376);
172305 /* (377) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=377);
172306 /* (378) returning ::= */ yytestcase(yyruleno==378);
172307 /* (379) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=379);
172308 /* (380) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==380);
172309 /* (381) exprlist ::= nexprlist */ yytestcase(yyruleno==381);
172310 /* (382) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=382);
172311 /* (383) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=383);
172312 /* (384) nmnum ::= ON */ yytestcase(yyruleno==384);
172313 /* (385) nmnum ::= DELETE */ yytestcase(yyruleno==385);
172314 /* (386) nmnum ::= DEFAULT */ yytestcase(yyruleno==386);
172315 /* (387) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==387);
172316 /* (388) foreach_clause ::= */ yytestcase(yyruleno==388);
172317 /* (389) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==389);
172318 /* (390) trnm ::= nm */ yytestcase(yyruleno==390);
172319 /* (391) tridxby ::= */ yytestcase(yyruleno==391);
172320 /* (392) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==392);
172321 /* (393) database_kw_opt ::= */ yytestcase(yyruleno==393);
172322 /* (394) kwcolumn_opt ::= */ yytestcase(yyruleno==394);
172323 /* (395) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==395);
172324 /* (396) vtabarglist ::= vtabarg */ yytestcase(yyruleno==396);
172325 /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==397);
172326 /* (398) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==398);
172327 /* (399) anylist ::= */ yytestcase(yyruleno==399);
172328 /* (400) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==400);
172329 /* (401) anylist ::= anylist ANY */ yytestcase(yyruleno==401);
172330 /* (402) with ::= */ yytestcase(yyruleno==402);
 
172331 break;
172332 /********** End reduce actions ************************************************/
172333 };
172334 assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
172335 yygoto = yyRuleInfoLhs[yyruleno];
@@ -174411,13 +174831,25 @@
174831 */
174832 SQLITE_API int sqlite3_config(int op, ...){
174833 va_list ap;
174834 int rc = SQLITE_OK;
174835
174836 /* sqlite3_config() normally returns SQLITE_MISUSE if it is invoked while
174837 ** the SQLite library is in use. Except, a few selected opcodes
174838 ** are allowed.
174839 */
174840 if( sqlite3GlobalConfig.isInit ){
174841 static const u64 mAnytimeConfigOption = 0
174842 | MASKBIT64( SQLITE_CONFIG_LOG )
174843 | MASKBIT64( SQLITE_CONFIG_PCACHE_HDRSZ )
174844 ;
174845 if( op<0 || op>63 || (MASKBIT64(op) & mAnytimeConfigOption)==0 ){
174846 return SQLITE_MISUSE_BKPT;
174847 }
174848 testcase( op==SQLITE_CONFIG_LOG );
174849 testcase( op==SQLITE_CONFIG_PCACHE_HDRSZ );
174850 }
174851
174852 va_start(ap, op);
174853 switch( op ){
174854
174855 /* Mutex configuration options are only available in a threadsafe
@@ -174482,10 +174914,11 @@
174914 if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault();
174915 *va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m;
174916 break;
174917 }
174918 case SQLITE_CONFIG_MEMSTATUS: {
174919 assert( !sqlite3GlobalConfig.isInit ); /* Cannot change at runtime */
174920 /* EVIDENCE-OF: R-61275-35157 The SQLITE_CONFIG_MEMSTATUS option takes
174921 ** single argument of type int, interpreted as a boolean, which enables
174922 ** or disables the collection of memory allocation statistics. */
174923 sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
174924 break;
@@ -174605,12 +175038,14 @@
175038 /* MSVC is picky about pulling func ptrs from va lists.
175039 ** http://support.microsoft.com/kb/47961
175040 ** sqlite3GlobalConfig.xLog = va_arg(ap, void(*)(void*,int,const char*));
175041 */
175042 typedef void(*LOGFUNC_t)(void*,int,const char*);
175043 LOGFUNC_t xLog = va_arg(ap, LOGFUNC_t);
175044 void *pLogArg = va_arg(ap, void*);
175045 AtomicStore(&sqlite3GlobalConfig.xLog, xLog);
175046 AtomicStore(&sqlite3GlobalConfig.pLogArg, pLogArg);
175047 break;
175048 }
175049
175050 /* EVIDENCE-OF: R-55548-33817 The compile-time setting for URI filenames
175051 ** can be changed at start-time using the
@@ -174620,11 +175055,12 @@
175055 case SQLITE_CONFIG_URI: {
175056 /* EVIDENCE-OF: R-25451-61125 The SQLITE_CONFIG_URI option takes a single
175057 ** argument of type int. If non-zero, then URI handling is globally
175058 ** enabled. If the parameter is zero, then URI handling is globally
175059 ** disabled. */
175060 int bOpenUri = va_arg(ap, int);
175061 AtomicStore(&sqlite3GlobalConfig.bOpenUri, bOpenUri);
175062 break;
175063 }
175064
175065 case SQLITE_CONFIG_COVERING_INDEX_SCAN: {
175066 /* EVIDENCE-OF: R-36592-02772 The SQLITE_CONFIG_COVERING_INDEX_SCAN
@@ -174935,10 +175371,12 @@
175371 { SQLITE_DBCONFIG_LEGACY_ALTER_TABLE, SQLITE_LegacyAlter },
175372 { SQLITE_DBCONFIG_DQS_DDL, SQLITE_DqsDDL },
175373 { SQLITE_DBCONFIG_DQS_DML, SQLITE_DqsDML },
175374 { SQLITE_DBCONFIG_LEGACY_FILE_FORMAT, SQLITE_LegacyFileFmt },
175375 { SQLITE_DBCONFIG_TRUSTED_SCHEMA, SQLITE_TrustedSchema },
175376 { SQLITE_DBCONFIG_STMT_SCANSTATUS, SQLITE_StmtScanStatus },
175377 { SQLITE_DBCONFIG_REVERSE_SCANORDER, SQLITE_ReverseOrder },
175378 };
175379 unsigned int i;
175380 rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
175381 for(i=0; i<ArraySize(aFlagOp); i++){
175382 if( aFlagOp[i].op==op ){
@@ -176920,13 +177358,13 @@
177358 char c;
177359 int nUri = sqlite3Strlen30(zUri);
177360
177361 assert( *pzErrMsg==0 );
177362
177363 if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */
177364 || AtomicLoad(&sqlite3GlobalConfig.bOpenUri)) /* IMP: R-51689-46548 */
177365 && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */
177366 ){
177367 char *zOpt;
177368 int eState; /* Parser state when parsing URI */
177369 int iIn; /* Input character index */
177370 int iOut = 0; /* Output character index */
@@ -177328,10 +177766,13 @@
177766 #if defined(SQLITE_DEFAULT_DEFENSIVE)
177767 | SQLITE_Defensive
177768 #endif
177769 #if defined(SQLITE_DEFAULT_LEGACY_ALTER_TABLE)
177770 | SQLITE_LegacyAlter
177771 #endif
177772 #if defined(SQLITE_ENABLE_STMT_SCANSTATUS)
177773 | SQLITE_StmtScanStatus
177774 #endif
177775 ;
177776 sqlite3HashInit(&db->aCollSeq);
177777 #ifndef SQLITE_OMIT_VIRTUALTABLE
177778 sqlite3HashInit(&db->aModule);
@@ -193097,20 +193538,22 @@
193538 static int fts3MsrBufferData(
193539 Fts3MultiSegReader *pMsr, /* Multi-segment-reader handle */
193540 char *pList,
193541 i64 nList
193542 ){
193543 if( (nList+FTS3_NODE_PADDING)>pMsr->nBuffer ){
193544 char *pNew;
193545 int nNew = nList*2 + FTS3_NODE_PADDING;
193546 pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, nNew);
193547 if( !pNew ) return SQLITE_NOMEM;
193548 pMsr->aBuffer = pNew;
193549 pMsr->nBuffer = nNew;
193550 }
193551
193552 assert( nList>0 );
193553 memcpy(pMsr->aBuffer, pList, nList);
193554 memset(&pMsr->aBuffer[nList], 0, FTS3_NODE_PADDING);
193555 return SQLITE_OK;
193556 }
193557
193558 SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext(
193559 Fts3Table *p, /* Virtual table handle */
@@ -199098,12 +199541,15 @@
199541 switch( sqlite3_value_type(pValue) ){
199542 case SQLITE_NULL: {
199543 jsonAppendRaw(p, "null", 4);
199544 break;
199545 }
 
199546 case SQLITE_FLOAT: {
199547 jsonPrintf(100, p, "%!0.15g", sqlite3_value_double(pValue));
199548 break;
199549 }
199550 case SQLITE_INTEGER: {
199551 const char *z = (const char*)sqlite3_value_text(pValue);
199552 u32 n = (u32)sqlite3_value_bytes(pValue);
199553 jsonAppendRaw(p, z, n);
199554 break;
199555 }
@@ -218244,13 +218690,14 @@
218690 SessionBuffer *p,
218691 const char *zStr,
218692 int *pRc
218693 ){
218694 int nStr = sqlite3Strlen30(zStr);
218695 if( 0==sessionBufferGrow(p, nStr+1, pRc) ){
218696 memcpy(&p->aBuf[p->nBuf], zStr, nStr);
218697 p->nBuf += nStr;
218698 p->aBuf[p->nBuf] = 0x00;
218699 }
218700 }
218701
218702 /*
218703 ** This function is a no-op if *pRc is other than SQLITE_OK when it is
@@ -218267,10 +218714,31 @@
218714 ){
218715 char aBuf[24];
218716 sqlite3_snprintf(sizeof(aBuf)-1, aBuf, "%d", iVal);
218717 sessionAppendStr(p, aBuf, pRc);
218718 }
218719
218720 static void sessionAppendPrintf(
218721 SessionBuffer *p, /* Buffer to append to */
218722 int *pRc,
218723 const char *zFmt,
218724 ...
218725 ){
218726 if( *pRc==SQLITE_OK ){
218727 char *zApp = 0;
218728 va_list ap;
218729 va_start(ap, zFmt);
218730 zApp = sqlite3_vmprintf(zFmt, ap);
218731 if( zApp==0 ){
218732 *pRc = SQLITE_NOMEM;
218733 }else{
218734 sessionAppendStr(p, zApp, pRc);
218735 }
218736 va_end(ap);
218737 sqlite3_free(zApp);
218738 }
218739 }
218740
218741 /*
218742 ** This function is a no-op if *pRc is other than SQLITE_OK when it is
218743 ** called. Otherwise, append the string zStr enclosed in quotes (") and
218744 ** with any embedded quote characters escaped to the buffer. No
@@ -218282,11 +218750,11 @@
218750 static void sessionAppendIdent(
218751 SessionBuffer *p, /* Buffer to a append to */
218752 const char *zStr, /* String to quote, escape and append */
218753 int *pRc /* IN/OUT: Error code */
218754 ){
218755 int nStr = sqlite3Strlen30(zStr)*2 + 2 + 2;
218756 if( 0==sessionBufferGrow(p, nStr, pRc) ){
218757 char *zOut = (char *)&p->aBuf[p->nBuf];
218758 const char *zIn = zStr;
218759 *zOut++ = '"';
218760 while( *zIn ){
@@ -218293,10 +218761,11 @@
218761 if( *zIn=='"' ) *zOut++ = '"';
218762 *zOut++ = *(zIn++);
218763 }
218764 *zOut++ = '"';
218765 p->nBuf = (int)((u8 *)zOut - p->aBuf);
218766 p->aBuf[p->nBuf] = 0x00;
218767 }
218768 }
218769
218770 /*
218771 ** This function is a no-op if *pRc is other than SQLITE_OK when it is
@@ -218517,33 +218986,82 @@
218986
218987 /*
218988 ** Formulate and prepare a SELECT statement to retrieve a row from table
218989 ** zTab in database zDb based on its primary key. i.e.
218990 **
218991 ** SELECT *, <noop-test> FROM zDb.zTab WHERE (pk1, pk2,...) IS (?1, ?2,...)
218992 **
218993 ** where <noop-test> is:
218994 **
218995 ** 1 AND (?A OR ?1 IS <column>) AND ...
218996 **
218997 ** for each non-pk <column>.
218998 */
218999 static int sessionSelectStmt(
219000 sqlite3 *db, /* Database handle */
219001 int bIgnoreNoop,
219002 const char *zDb, /* Database name */
219003 const char *zTab, /* Table name */
219004 int nCol, /* Number of columns in table */
219005 const char **azCol, /* Names of table columns */
219006 u8 *abPK, /* PRIMARY KEY array */
219007 sqlite3_stmt **ppStmt /* OUT: Prepared SELECT statement */
219008 ){
219009 int rc = SQLITE_OK;
219010 char *zSql = 0;
219011 const char *zSep = "";
219012 const char *zCols = "*";
219013 int nSql = -1;
219014 int i;
219015
219016 SessionBuffer nooptest = {0, 0, 0};
219017 SessionBuffer pkfield = {0, 0, 0};
219018 SessionBuffer pkvar = {0, 0, 0};
219019
219020 sessionAppendStr(&nooptest, ", 1", &rc);
219021
219022 if( 0==sqlite3_stricmp("sqlite_stat1", zTab) ){
219023 sessionAppendStr(&nooptest, " AND (?6 OR ?3 IS stat)", &rc);
219024 sessionAppendStr(&pkfield, "tbl, idx", &rc);
219025 sessionAppendStr(&pkvar,
219026 "?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", &rc
219027 );
219028 zCols = "tbl, ?2, stat";
219029 }else{
219030 for(i=0; i<nCol; i++){
219031
219032 if( abPK[i] ){
219033 sessionAppendStr(&pkfield, zSep, &rc);
219034 sessionAppendStr(&pkvar, zSep, &rc);
219035 zSep = ", ";
219036 sessionAppendIdent(&pkfield, azCol[i], &rc);
219037 sessionAppendPrintf(&pkvar, &rc, "?%d", i+1);
219038 }else{
219039 sessionAppendPrintf(&nooptest, &rc,
219040 " AND (?%d OR ?%d IS %w.%w)", i+1+nCol, i+1, zTab, azCol[i]
219041 );
219042 }
219043 }
219044 }
219045
219046 if( rc==SQLITE_OK ){
219047 zSql = sqlite3_mprintf(
219048 "SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)",
219049 zCols, (bIgnoreNoop ? (char*)nooptest.aBuf : ""),
219050 zDb, zTab, (char*)pkfield.aBuf, (char*)pkvar.aBuf
219051 );
219052 if( zSql==0 ) rc = SQLITE_NOMEM;
219053 }
219054
219055 #if 0
219056 if( 0==sqlite3_stricmp("sqlite_stat1", zTab) ){
219057 zSql = sqlite3_mprintf(
219058 "SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND "
219059 "idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", zDb
219060 );
219061 if( zSql==0 ) rc = SQLITE_NOMEM;
219062 }else{
 
219063 const char *zSep = "";
219064 SessionBuffer buf = {0, 0, 0};
219065
219066 sessionAppendStr(&buf, "SELECT * FROM ", &rc);
219067 sessionAppendIdent(&buf, zDb, &rc);
@@ -218560,15 +219078,19 @@
219078 }
219079 }
219080 zSql = (char*)buf.aBuf;
219081 nSql = buf.nBuf;
219082 }
219083 #endif
219084
219085 if( rc==SQLITE_OK ){
219086 rc = sqlite3_prepare_v2(db, zSql, nSql, ppStmt, 0);
219087 }
219088 sqlite3_free(zSql);
219089 sqlite3_free(nooptest.aBuf);
219090 sqlite3_free(pkfield.aBuf);
219091 sqlite3_free(pkvar.aBuf);
219092 return rc;
219093 }
219094
219095 /*
219096 ** Bind the PRIMARY KEY values from the change passed in argument pChange
@@ -218724,11 +219246,12 @@
219246 sessionAppendTableHdr(&buf, bPatchset, pTab, &rc);
219247
219248 /* Build and compile a statement to execute: */
219249 if( rc==SQLITE_OK ){
219250 rc = sessionSelectStmt(
219251 db, 0, pSession->zDb, zName, nCol, azCol, abPK, &pSel
219252 );
219253 }
219254
219255 nNoop = buf.nBuf;
219256 for(i=0; i<pTab->nChange && rc==SQLITE_OK; i++){
219257 SessionChange *p; /* Used to iterate through changes */
@@ -219913,10 +220436,11 @@
220436 int bInvertConstraints; /* Invert when iterating constraints buffer */
220437 SessionBuffer constraints; /* Deferred constraints are stored here */
220438 SessionBuffer rebase; /* Rebase information (if any) here */
220439 u8 bRebaseStarted; /* If table header is already in rebase */
220440 u8 bRebase; /* True to collect rebase information */
220441 u8 bIgnoreNoop; /* True to ignore no-op conflicts */
220442 };
220443
220444 /* Number of prepared UPDATE statements to cache. */
220445 #define SESSION_UPDATE_CACHE_SZ 12
220446
@@ -220163,12 +220687,13 @@
220687 static int sessionSelectRow(
220688 sqlite3 *db, /* Database handle */
220689 const char *zTab, /* Table name */
220690 SessionApplyCtx *p /* Session changeset-apply context */
220691 ){
220692 return sessionSelectStmt(db, p->bIgnoreNoop,
220693 "main", zTab, p->nCol, p->azCol, p->abPK, &p->pSelect
220694 );
220695 }
220696
220697 /*
220698 ** Formulate and prepare an INSERT statement to add a record to table zTab.
220699 ** For example:
@@ -220323,23 +220848,36 @@
220848 ** new.* record to the SELECT statement. Or, if it points to a DELETE or
220849 ** UPDATE, bind values from the old.* record.
220850 */
220851 static int sessionSeekToRow(
220852 sqlite3_changeset_iter *pIter, /* Changeset iterator */
220853 SessionApplyCtx *p
 
220854 ){
220855 sqlite3_stmt *pSelect = p->pSelect;
220856 int rc; /* Return code */
220857 int nCol; /* Number of columns in table */
220858 int op; /* Changset operation (SQLITE_UPDATE etc.) */
220859 const char *zDummy; /* Unused */
220860
220861 sqlite3_clear_bindings(pSelect);
220862 sqlite3changeset_op(pIter, &zDummy, &nCol, &op, 0);
220863 rc = sessionBindRow(pIter,
220864 op==SQLITE_INSERT ? sqlite3changeset_new : sqlite3changeset_old,
220865 nCol, p->abPK, pSelect
220866 );
220867
220868 if( op!=SQLITE_DELETE && p->bIgnoreNoop ){
220869 int ii;
220870 for(ii=0; rc==SQLITE_OK && ii<nCol; ii++){
220871 if( p->abPK[ii]==0 ){
220872 sqlite3_value *pVal = 0;
220873 sqlite3changeset_new(pIter, ii, &pVal);
220874 sqlite3_bind_int(pSelect, ii+1+nCol, (pVal==0));
220875 if( pVal ) rc = sessionBindValue(pSelect, ii+1, pVal);
220876 }
220877 }
220878 }
220879
220880 if( rc==SQLITE_OK ){
220881 rc = sqlite3_step(pSelect);
220882 if( rc!=SQLITE_ROW ) rc = sqlite3_reset(pSelect);
220883 }
@@ -220451,20 +220989,26 @@
220989 assert( SQLITE_CHANGESET_CONFLICT+1==SQLITE_CHANGESET_CONSTRAINT );
220990 assert( SQLITE_CHANGESET_DATA+1==SQLITE_CHANGESET_NOTFOUND );
220991
220992 /* Bind the new.* PRIMARY KEY values to the SELECT statement. */
220993 if( pbReplace ){
220994 rc = sessionSeekToRow(pIter, p);
220995 }else{
220996 rc = SQLITE_OK;
220997 }
220998
220999 if( rc==SQLITE_ROW ){
221000 /* There exists another row with the new.* primary key. */
221001 if( p->bIgnoreNoop
221002 && sqlite3_column_int(p->pSelect, sqlite3_column_count(p->pSelect)-1)
221003 ){
221004 res = SQLITE_CHANGESET_OMIT;
221005 }else{
221006 pIter->pConflict = p->pSelect;
221007 res = xConflict(pCtx, eType, pIter);
221008 pIter->pConflict = 0;
221009 }
221010 rc = sqlite3_reset(p->pSelect);
221011 }else if( rc==SQLITE_OK ){
221012 if( p->bDeferConstraints && eType==SQLITE_CHANGESET_CONFLICT ){
221013 /* Instead of invoking the conflict handler, append the change blob
221014 ** to the SessionApplyCtx.constraints buffer. */
@@ -220568,11 +221112,11 @@
221112 }
221113 if( rc!=SQLITE_OK ) return rc;
221114
221115 sqlite3_step(p->pDelete);
221116 rc = sqlite3_reset(p->pDelete);
221117 if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 && p->bIgnoreNoop==0 ){
221118 rc = sessionConflictHandler(
221119 SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry
221120 );
221121 }else if( (rc&0xff)==SQLITE_CONSTRAINT ){
221122 rc = sessionConflictHandler(
@@ -220625,11 +221169,11 @@
221169 assert( op==SQLITE_INSERT );
221170 if( p->bStat1 ){
221171 /* Check if there is a conflicting row. For sqlite_stat1, this needs
221172 ** to be done using a SELECT, as there is no PRIMARY KEY in the
221173 ** database schema to throw an exception if a duplicate is inserted. */
221174 rc = sessionSeekToRow(pIter, p);
221175 if( rc==SQLITE_ROW ){
221176 rc = SQLITE_CONSTRAINT;
221177 sqlite3_reset(p->pSelect);
221178 }
221179 }
@@ -220802,10 +221346,11 @@
221346
221347 pIter->in.bNoDiscard = 1;
221348 memset(&sApply, 0, sizeof(sApply));
221349 sApply.bRebase = (ppRebase && pnRebase);
221350 sApply.bInvertConstraints = !!(flags & SQLITE_CHANGESETAPPLY_INVERT);
221351 sApply.bIgnoreNoop = !!(flags & SQLITE_CHANGESETAPPLY_IGNORENOOP);
221352 sqlite3_mutex_enter(sqlite3_db_mutex(db));
221353 if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){
221354 rc = sqlite3_exec(db, "SAVEPOINT changeset_apply", 0, 0, 0);
221355 }
221356 if( rc==SQLITE_OK ){
@@ -225058,11 +225603,11 @@
225603 UNUSED_PARAM2(pToken, nToken);
225604
225605 if( tflags & FTS5_TOKEN_COLOCATED ) return SQLITE_OK;
225606 iPos = p->iPos++;
225607
225608 if( p->iRangeEnd>=0 ){
225609 if( iPos<p->iRangeStart || iPos>p->iRangeEnd ) return SQLITE_OK;
225610 if( p->iRangeStart && iPos==p->iRangeStart ) p->iOff = iStartOff;
225611 }
225612
225613 if( iPos==p->iter.iStart ){
@@ -225070,11 +225615,11 @@
225615 fts5HighlightAppend(&rc, p, p->zOpen, -1);
225616 p->iOff = iStartOff;
225617 }
225618
225619 if( iPos==p->iter.iEnd ){
225620 if( p->iRangeEnd>=0 && p->iter.iStart<p->iRangeStart ){
225621 fts5HighlightAppend(&rc, p, p->zOpen, -1);
225622 }
225623 fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
225624 fts5HighlightAppend(&rc, p, p->zClose, -1);
225625 p->iOff = iEndOff;
@@ -225081,11 +225626,11 @@
225626 if( rc==SQLITE_OK ){
225627 rc = fts5CInstIterNext(&p->iter);
225628 }
225629 }
225630
225631 if( p->iRangeEnd>=0 && iPos==p->iRangeEnd ){
225632 fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff);
225633 p->iOff = iEndOff;
225634 if( iPos>=p->iter.iStart && iPos<p->iter.iEnd ){
225635 fts5HighlightAppend(&rc, p, p->zClose, -1);
225636 }
@@ -225116,10 +225661,11 @@
225661
225662 iCol = sqlite3_value_int(apVal[0]);
225663 memset(&ctx, 0, sizeof(HighlightContext));
225664 ctx.zOpen = (const char*)sqlite3_value_text(apVal[1]);
225665 ctx.zClose = (const char*)sqlite3_value_text(apVal[2]);
225666 ctx.iRangeEnd = -1;
225667 rc = pApi->xColumnText(pFts, iCol, &ctx.zIn, &ctx.nIn);
225668
225669 if( ctx.zIn ){
225670 if( rc==SQLITE_OK ){
225671 rc = fts5CInstIterInit(pApi, pFts, iCol, &ctx.iter);
@@ -225301,10 +225847,11 @@
225847 nCol = pApi->xColumnCount(pFts);
225848 memset(&ctx, 0, sizeof(HighlightContext));
225849 iCol = sqlite3_value_int(apVal[0]);
225850 ctx.zOpen = fts5ValueToText(apVal[1]);
225851 ctx.zClose = fts5ValueToText(apVal[2]);
225852 ctx.iRangeEnd = -1;
225853 zEllips = fts5ValueToText(apVal[3]);
225854 nToken = sqlite3_value_int(apVal[4]);
225855
225856 iBestCol = (iCol>=0 ? iCol : 0);
225857 nPhrase = pApi->xPhraseCount(pFts);
@@ -240250,11 +240797,11 @@
240797 int nArg, /* Number of args */
240798 sqlite3_value **apUnused /* Function arguments */
240799 ){
240800 assert( nArg==0 );
240801 UNUSED_PARAM2(nArg, apUnused);
240802 sqlite3_result_text(pCtx, "fts5: 2023-04-01 12:22:57 33ac62d8eec56eb71f20ccd28a5d6e4e8051522feb2db0199abee9e18ce1f64e", -1, SQLITE_TRANSIENT);
240803 }
240804
240805 /*
240806 ** Return true if zName is the extension on one of the shadow tables used
240807 ** by this module.
240808
+68 -12
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -144,13 +144,13 @@
144144
**
145145
** See also: [sqlite3_libversion()],
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149
-#define SQLITE_VERSION "3.41.2"
150
-#define SQLITE_VERSION_NUMBER 3041002
151
-#define SQLITE_SOURCE_ID "2023-03-17 12:25:10 c5bd0ea3b5b2f3ed8e971c5fd6e85e8f06d8055d74df65612c3794138306e6ba"
149
+#define SQLITE_VERSION "3.42.0"
150
+#define SQLITE_VERSION_NUMBER 3042000
151
+#define SQLITE_SOURCE_ID "2023-04-01 15:51:21 a4fb2864fe01cce9694242a0750623ca47fcecd68f74c4239d3eb5fbf978770a"
152152
153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
155155
** KEYWORDS: sqlite3_version sqlite3_sourceid
156156
**
@@ -1653,23 +1653,26 @@
16531653
**
16541654
** <b>The sqlite3_config() interface is not threadsafe. The application
16551655
** must ensure that no other SQLite interfaces are invoked by other
16561656
** threads while sqlite3_config() is running.</b>
16571657
**
1658
-** The sqlite3_config() interface
1659
-** may only be invoked prior to library initialization using
1660
-** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1661
-** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1662
-** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
1663
-** Note, however, that ^sqlite3_config() can be called as part of the
1664
-** implementation of an application-defined [sqlite3_os_init()].
1665
-**
16661658
** The first argument to sqlite3_config() is an integer
16671659
** [configuration option] that determines
16681660
** what property of SQLite is to be configured. Subsequent arguments
16691661
** vary depending on the [configuration option]
16701662
** in the first argument.
1663
+**
1664
+** For most configuration options, the sqlite3_config() interface
1665
+** may only be invoked prior to library initialization using
1666
+** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1667
+** The exceptional configuration options that may be invoked at any time
1668
+** are called "anytime configuration options".
1669
+** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1670
+** [sqlite3_shutdown()] with a first argument that is not an anytime
1671
+** configuration option, then the sqlite3_config() call will return SQLITE_MISUSE.
1672
+** Note, however, that ^sqlite3_config() can be called as part of the
1673
+** implementation of an application-defined [sqlite3_os_init()].
16711674
**
16721675
** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
16731676
** ^If the option is unknown or SQLite is unable to set the option
16741677
** then this routine returns a non-zero [error code].
16751678
*/
@@ -1773,10 +1776,27 @@
17731776
** CAPI3REF: Configuration Options
17741777
** KEYWORDS: {configuration option}
17751778
**
17761779
** These constants are the available integer configuration options that
17771780
** can be passed as the first argument to the [sqlite3_config()] interface.
1781
+**
1782
+** Most of the configuration options for sqlite3_config()
1783
+** will only work if invoked prior to [sqlite3_initialize()] or after
1784
+** [sqlite3_shutdown()]. The few exceptions to this rule are called
1785
+** "anytime configuration options".
1786
+** ^Calling [sqlite3_config()] with a first argument that is not an
1787
+** anytime configuration option in between calls to [sqlite3_initialize()] and
1788
+** [sqlite3_shutdown()] is a no-op that returns SQLITE_MISUSE.
1789
+**
1790
+** The set of anytime configuration options can change (by insertions
1791
+** and/or deletions) from one release of SQLite to the next.
1792
+** As of SQLite version 3.42.0, the complete set of anytime configuration
1793
+** options is:
1794
+** <ul>
1795
+** <li> SQLITE_CONFIG_LOG
1796
+** <li> SQLITE_CONFIG_PCACHE_HDRSZ
1797
+** </ul>
17781798
**
17791799
** New configuration options may be added in future releases of SQLite.
17801800
** Existing configuration options might be discontinued. Applications
17811801
** should check the return code from [sqlite3_config()] to make sure that
17821802
** the call worked. The [sqlite3_config()] interface will return a
@@ -2434,10 +2454,30 @@
24342454
** the [VACUUM] command will fail with an obscure error when attempting to
24352455
** process a table with generated columns and a descending index. This is
24362456
** not considered a bug since SQLite versions 3.3.0 and earlier do not support
24372457
** either generated columns or decending indexes.
24382458
** </dd>
2459
+**
2460
+** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
2461
+** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</td>
2462
+** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
2463
+** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
2464
+** a flag that enables collection of the sqlite3_stmt_scanstatus_v2()
2465
+** statistics. For statistics to be collected, the flag must be set on
2466
+** the database handle both when the SQL statement is prepared and when it
2467
+** is stepped. The flag is set (collection of statistics is enabled)
2468
+** by default.</dd>
2469
+**
2470
+** [[SQLITE_DBCONFIG_REVERSE_SCANORDER]]
2471
+** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</td>
2472
+** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option change the default order
2473
+** in which tables and indexes are scanned so that the scans start at the end
2474
+** and work toward the beginning rather than starting at the beginning and
2475
+** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
2476
+** same as setting [PRAGMA reverse_unordered_selects]. This configuration option
2477
+** is useful for application testing.</dd>
2478
+**
24392479
** </dl>
24402480
*/
24412481
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
24422482
#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
24432483
#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
@@ -2454,11 +2494,13 @@
24542494
#define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
24552495
#define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
24562496
#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
24572497
#define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
24582498
#define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
2459
-#define SQLITE_DBCONFIG_MAX 1017 /* Largest DBCONFIG */
2499
+#define SQLITE_DBCONFIG_STMT_SCANSTATUS 1080 /* int int* */
2500
+#define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
2501
+#define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */
24602502
24612503
/*
24622504
** CAPI3REF: Enable Or Disable Extended Result Codes
24632505
** METHOD: sqlite3
24642506
**
@@ -11911,13 +11953,27 @@
1191111953
**
1191211954
** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
1191311955
** Invert the changeset before applying it. This is equivalent to inverting
1191411956
** a changeset using sqlite3changeset_invert() before applying it. It is
1191511957
** an error to specify this flag with a patchset.
11958
+**
11959
+** <dt>SQLITE_CHANGESETAPPLY_IGNORENOOP <dd>
11960
+** Do not invoke the conflict handler callback for any changes that
11961
+** would not actually modify the database even if they were applied.
11962
+** Specifically, this means that the conflict handler is not invoked
11963
+** for:
11964
+** <ul>
11965
+** <li>a delete change if the row being deleted cannot be found,
11966
+** <li>an update change if the modified fields are already set to
11967
+** their new values in the conflicting row, or
11968
+** <li>an insert change if all fields of the conflicting row match
11969
+** the row being inserted.
11970
+** </ul>
1191611971
*/
1191711972
#define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
1191811973
#define SQLITE_CHANGESETAPPLY_INVERT 0x0002
11974
+#define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004
1191911975
1192011976
/*
1192111977
** CAPI3REF: Constants Passed To The Conflict Handler
1192211978
**
1192311979
** Values that may be passed as the second argument to a conflict-handler.
1192411980
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -144,13 +144,13 @@
144 **
145 ** See also: [sqlite3_libversion()],
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.41.2"
150 #define SQLITE_VERSION_NUMBER 3041002
151 #define SQLITE_SOURCE_ID "2023-03-17 12:25:10 c5bd0ea3b5b2f3ed8e971c5fd6e85e8f06d8055d74df65612c3794138306e6ba"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -1653,23 +1653,26 @@
1653 **
1654 ** <b>The sqlite3_config() interface is not threadsafe. The application
1655 ** must ensure that no other SQLite interfaces are invoked by other
1656 ** threads while sqlite3_config() is running.</b>
1657 **
1658 ** The sqlite3_config() interface
1659 ** may only be invoked prior to library initialization using
1660 ** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1661 ** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1662 ** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
1663 ** Note, however, that ^sqlite3_config() can be called as part of the
1664 ** implementation of an application-defined [sqlite3_os_init()].
1665 **
1666 ** The first argument to sqlite3_config() is an integer
1667 ** [configuration option] that determines
1668 ** what property of SQLite is to be configured. Subsequent arguments
1669 ** vary depending on the [configuration option]
1670 ** in the first argument.
 
 
 
 
 
 
 
 
 
 
 
1671 **
1672 ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
1673 ** ^If the option is unknown or SQLite is unable to set the option
1674 ** then this routine returns a non-zero [error code].
1675 */
@@ -1773,10 +1776,27 @@
1773 ** CAPI3REF: Configuration Options
1774 ** KEYWORDS: {configuration option}
1775 **
1776 ** These constants are the available integer configuration options that
1777 ** can be passed as the first argument to the [sqlite3_config()] interface.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1778 **
1779 ** New configuration options may be added in future releases of SQLite.
1780 ** Existing configuration options might be discontinued. Applications
1781 ** should check the return code from [sqlite3_config()] to make sure that
1782 ** the call worked. The [sqlite3_config()] interface will return a
@@ -2434,10 +2454,30 @@
2434 ** the [VACUUM] command will fail with an obscure error when attempting to
2435 ** process a table with generated columns and a descending index. This is
2436 ** not considered a bug since SQLite versions 3.3.0 and earlier do not support
2437 ** either generated columns or decending indexes.
2438 ** </dd>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2439 ** </dl>
2440 */
2441 #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
2442 #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
2443 #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
@@ -2454,11 +2494,13 @@
2454 #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
2455 #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
2456 #define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
2457 #define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
2458 #define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
2459 #define SQLITE_DBCONFIG_MAX 1017 /* Largest DBCONFIG */
 
 
2460
2461 /*
2462 ** CAPI3REF: Enable Or Disable Extended Result Codes
2463 ** METHOD: sqlite3
2464 **
@@ -11911,13 +11953,27 @@
11911 **
11912 ** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
11913 ** Invert the changeset before applying it. This is equivalent to inverting
11914 ** a changeset using sqlite3changeset_invert() before applying it. It is
11915 ** an error to specify this flag with a patchset.
 
 
 
 
 
 
 
 
 
 
 
 
 
11916 */
11917 #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
11918 #define SQLITE_CHANGESETAPPLY_INVERT 0x0002
 
11919
11920 /*
11921 ** CAPI3REF: Constants Passed To The Conflict Handler
11922 **
11923 ** Values that may be passed as the second argument to a conflict-handler.
11924
--- extsrc/sqlite3.h
+++ extsrc/sqlite3.h
@@ -144,13 +144,13 @@
144 **
145 ** See also: [sqlite3_libversion()],
146 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147 ** [sqlite_version()] and [sqlite_source_id()].
148 */
149 #define SQLITE_VERSION "3.42.0"
150 #define SQLITE_VERSION_NUMBER 3042000
151 #define SQLITE_SOURCE_ID "2023-04-01 15:51:21 a4fb2864fe01cce9694242a0750623ca47fcecd68f74c4239d3eb5fbf978770a"
152
153 /*
154 ** CAPI3REF: Run-Time Library Version Numbers
155 ** KEYWORDS: sqlite3_version sqlite3_sourceid
156 **
@@ -1653,23 +1653,26 @@
1653 **
1654 ** <b>The sqlite3_config() interface is not threadsafe. The application
1655 ** must ensure that no other SQLite interfaces are invoked by other
1656 ** threads while sqlite3_config() is running.</b>
1657 **
 
 
 
 
 
 
 
 
1658 ** The first argument to sqlite3_config() is an integer
1659 ** [configuration option] that determines
1660 ** what property of SQLite is to be configured. Subsequent arguments
1661 ** vary depending on the [configuration option]
1662 ** in the first argument.
1663 **
1664 ** For most configuration options, the sqlite3_config() interface
1665 ** may only be invoked prior to library initialization using
1666 ** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
1667 ** The exceptional configuration options that may be invoked at any time
1668 ** are called "anytime configuration options".
1669 ** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
1670 ** [sqlite3_shutdown()] with a first argument that is not an anytime
1671 ** configuration option, then the sqlite3_config() call will return SQLITE_MISUSE.
1672 ** Note, however, that ^sqlite3_config() can be called as part of the
1673 ** implementation of an application-defined [sqlite3_os_init()].
1674 **
1675 ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
1676 ** ^If the option is unknown or SQLite is unable to set the option
1677 ** then this routine returns a non-zero [error code].
1678 */
@@ -1773,10 +1776,27 @@
1776 ** CAPI3REF: Configuration Options
1777 ** KEYWORDS: {configuration option}
1778 **
1779 ** These constants are the available integer configuration options that
1780 ** can be passed as the first argument to the [sqlite3_config()] interface.
1781 **
1782 ** Most of the configuration options for sqlite3_config()
1783 ** will only work if invoked prior to [sqlite3_initialize()] or after
1784 ** [sqlite3_shutdown()]. The few exceptions to this rule are called
1785 ** "anytime configuration options".
1786 ** ^Calling [sqlite3_config()] with a first argument that is not an
1787 ** anytime configuration option in between calls to [sqlite3_initialize()] and
1788 ** [sqlite3_shutdown()] is a no-op that returns SQLITE_MISUSE.
1789 **
1790 ** The set of anytime configuration options can change (by insertions
1791 ** and/or deletions) from one release of SQLite to the next.
1792 ** As of SQLite version 3.42.0, the complete set of anytime configuration
1793 ** options is:
1794 ** <ul>
1795 ** <li> SQLITE_CONFIG_LOG
1796 ** <li> SQLITE_CONFIG_PCACHE_HDRSZ
1797 ** </ul>
1798 **
1799 ** New configuration options may be added in future releases of SQLite.
1800 ** Existing configuration options might be discontinued. Applications
1801 ** should check the return code from [sqlite3_config()] to make sure that
1802 ** the call worked. The [sqlite3_config()] interface will return a
@@ -2434,10 +2454,30 @@
2454 ** the [VACUUM] command will fail with an obscure error when attempting to
2455 ** process a table with generated columns and a descending index. This is
2456 ** not considered a bug since SQLite versions 3.3.0 and earlier do not support
2457 ** either generated columns or decending indexes.
2458 ** </dd>
2459 **
2460 ** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]]
2461 ** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</td>
2462 ** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in
2463 ** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears
2464 ** a flag that enables collection of the sqlite3_stmt_scanstatus_v2()
2465 ** statistics. For statistics to be collected, the flag must be set on
2466 ** the database handle both when the SQL statement is prepared and when it
2467 ** is stepped. The flag is set (collection of statistics is enabled)
2468 ** by default.</dd>
2469 **
2470 ** [[SQLITE_DBCONFIG_REVERSE_SCANORDER]]
2471 ** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</td>
2472 ** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option change the default order
2473 ** in which tables and indexes are scanned so that the scans start at the end
2474 ** and work toward the beginning rather than starting at the beginning and
2475 ** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the
2476 ** same as setting [PRAGMA reverse_unordered_selects]. This configuration option
2477 ** is useful for application testing.</dd>
2478 **
2479 ** </dl>
2480 */
2481 #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
2482 #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */
2483 #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */
@@ -2454,11 +2494,13 @@
2494 #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */
2495 #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */
2496 #define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */
2497 #define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */
2498 #define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */
2499 #define SQLITE_DBCONFIG_STMT_SCANSTATUS 1080 /* int int* */
2500 #define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */
2501 #define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */
2502
2503 /*
2504 ** CAPI3REF: Enable Or Disable Extended Result Codes
2505 ** METHOD: sqlite3
2506 **
@@ -11911,13 +11953,27 @@
11953 **
11954 ** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd>
11955 ** Invert the changeset before applying it. This is equivalent to inverting
11956 ** a changeset using sqlite3changeset_invert() before applying it. It is
11957 ** an error to specify this flag with a patchset.
11958 **
11959 ** <dt>SQLITE_CHANGESETAPPLY_IGNORENOOP <dd>
11960 ** Do not invoke the conflict handler callback for any changes that
11961 ** would not actually modify the database even if they were applied.
11962 ** Specifically, this means that the conflict handler is not invoked
11963 ** for:
11964 ** <ul>
11965 ** <li>a delete change if the row being deleted cannot be found,
11966 ** <li>an update change if the modified fields are already set to
11967 ** their new values in the conflicting row, or
11968 ** <li>an insert change if all fields of the conflicting row match
11969 ** the row being inserted.
11970 ** </ul>
11971 */
11972 #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001
11973 #define SQLITE_CHANGESETAPPLY_INVERT 0x0002
11974 #define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004
11975
11976 /*
11977 ** CAPI3REF: Constants Passed To The Conflict Handler
11978 **
11979 ** Values that may be passed as the second argument to a conflict-handler.
11980

Keyboard Shortcuts

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