Check-in [82f5663270]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1 Hash:82f56632705e3d9179bcb6c7994662f652488d1b
Date: 2012-03-31 19:15:36
User: drh
Comment:Update to the latest SQLite code. Fix a compiler warning in style.c.
Tags And Properties
Changes

Changes to src/shell.c

64 # define stifle_history(X) 64 # define stifle_history(X) 65 #endif 65 #endif 66 66 67 #if defined(_WIN32) || defined(WIN32) 67 #if defined(_WIN32) || defined(WIN32) 68 # include <io.h> 68 # include <io.h> 69 #define isatty(h) _isatty(h) 69 #define isatty(h) _isatty(h) 70 #define access(f,m) _access((f),(m)) 70 #define access(f,m) _access((f),(m)) > 71 #define popen(a,b) _popen((a),(b)) > 72 #define pclose(x) _pclose(x) 71 #else 73 #else 72 /* Make sure isatty() has a prototype. 74 /* Make sure isatty() has a prototype. 73 */ 75 */ 74 extern int isatty(int); 76 extern int isatty(int); 75 #endif 77 #endif 76 78 77 #if defined(_WIN32_WCE) 79 #if defined(_WIN32_WCE) ................................................................................................................................................................................ 1072 sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, bReset); 1074 sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, bReset); 1073 fprintf(pArg->out, "Pager Heap Usage: %d bytes\n", iCur); 1075 fprintf(pArg->out, "Pager Heap Usage: %d bytes\n", iCur); 1074 sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_HIT, &iCur, &iHiwtr, 1); 1076 sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_HIT, &iCur, &iHiwtr, 1); 1075 fprintf(pArg->out, "Page cache hits: %d\n", iCur); 1077 fprintf(pArg->out, "Page cache hits: %d\n", iCur); 1076 iHiwtr = iCur = -1; 1078 iHiwtr = iCur = -1; 1077 sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_MISS, &iCur, &iHiwtr, 1); 1079 sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_MISS, &iCur, &iHiwtr, 1); 1078 fprintf(pArg->out, "Page cache misses: %d\n", iCur); 1080 fprintf(pArg->out, "Page cache misses: %d\n", iCur); > 1081 iHiwtr = iCur = -1; > 1082 sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_WRITE, &iCur, &iHiwtr, 1); > 1083 fprintf(pArg->out, "Page cache writes: %d\n", iCur); 1079 iHiwtr = iCur = -1; 1084 iHiwtr = iCur = -1; 1080 sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, bReset); 1085 sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, bReset); 1081 fprintf(pArg->out, "Schema Heap Usage: %d bytes\n", iCur); 1086 fprintf(pArg->out, "Schema Heap Usage: %d bytes\n", iCur); 1082 iHiwtr = iCur = -1; 1087 iHiwtr = iCur = -1; 1083 sqlite3_db_status(db, SQLITE_DBSTATUS_STMT_USED, &iCur, &iHiwtr, bReset); 1088 sqlite3_db_status(db, SQLITE_DBSTATUS_STMT_USED, &iCur, &iHiwtr, bReset); 1084 fprintf(pArg->out, "Statement Heap/Lookaside Usage: %d bytes\n", iCur); 1089 fprintf(pArg->out, "Statement Heap/Lookaside Usage: %d bytes\n", iCur); 1085 } 1090 } ................................................................................................................................................................................ 1283 1288 1284 if( strcmp(zType, "table")==0 ){ 1289 if( strcmp(zType, "table")==0 ){ 1285 sqlite3_stmt *pTableInfo = 0; 1290 sqlite3_stmt *pTableInfo = 0; 1286 char *zSelect = 0; 1291 char *zSelect = 0; 1287 char *zTableInfo = 0; 1292 char *zTableInfo = 0; 1288 char *zTmp = 0; 1293 char *zTmp = 0; 1289 int nRow = 0; 1294 int nRow = 0; 1290 int kk; < 1291 1295 1292 zTableInfo = appendText(zTableInfo, "PRAGMA table_info(", 0); 1296 zTableInfo = appendText(zTableInfo, "PRAGMA table_info(", 0); 1293 zTableInfo = appendText(zTableInfo, zTable, '"'); 1297 zTableInfo = appendText(zTableInfo, zTable, '"'); 1294 zTableInfo = appendText(zTableInfo, ");", 0); 1298 zTableInfo = appendText(zTableInfo, ");", 0); 1295 1299 1296 rc = sqlite3_prepare(p->db, zTableInfo, -1, &pTableInfo, 0); 1300 rc = sqlite3_prepare(p->db, zTableInfo, -1, &pTableInfo, 0); 1297 free(zTableInfo); 1301 free(zTableInfo); 1298 if( rc!=SQLITE_OK || !pTableInfo ){ 1302 if( rc!=SQLITE_OK || !pTableInfo ){ 1299 return 1; 1303 return 1; 1300 } 1304 } 1301 1305 1302 zSelect = appendText(zSelect, "SELECT 'INSERT INTO ' || ", 0); 1306 zSelect = appendText(zSelect, "SELECT 'INSERT INTO ' || ", 0); 1303 if( !isalpha(zTable[0]) ){ | 1307 /* Always quote the table name, even if it appears to be pure ascii, 1304 kk = 0; | 1308 ** in case it is a keyword. Ex: INSERT INTO "table" ... */ 1305 }else{ < 1306 for(kk=1; isalnum(zTable[kk]); kk++){} < 1307 } < 1308 zTmp = appendText(zTmp, zTable, zTable[kk] ? '"' : 0); | 1309 zTmp = appendText(zTmp, zTable, '"'); 1309 if( zTmp ){ 1310 if( zTmp ){ 1310 zSelect = appendText(zSelect, zTmp, '\''); 1311 zSelect = appendText(zSelect, zTmp, '\''); 1311 } 1312 } 1312 zSelect = appendText(zSelect, " || ' VALUES(' || ", 0); 1313 zSelect = appendText(zSelect, " || ' VALUES(' || ", 0); 1313 rc = sqlite3_step(pTableInfo); 1314 rc = sqlite3_step(pTableInfo); 1314 while( rc==SQLITE_ROW ){ 1315 while( rc==SQLITE_ROW ){ 1315 const char *zText = (const char *)sqlite3_column_text(pTableInfo, 1); 1316 const char *zText = (const char *)sqlite3_column_text(pTableInfo, 1); ................................................................................................................................................................................ 1996 if( c=='n' && strncmp(azArg[0], "nullvalue", n)==0 && nArg==2 ) { 1997 if( c=='n' && strncmp(azArg[0], "nullvalue", n)==0 && nArg==2 ) { 1997 sqlite3_snprintf(sizeof(p->nullvalue), p->nullvalue, 1998 sqlite3_snprintf(sizeof(p->nullvalue), p->nullvalue, 1998 "%.*s", (int)ArraySize(p->nullvalue)-1, azArg[1]); 1999 "%.*s", (int)ArraySize(p->nullvalue)-1, azArg[1]); 1999 }else 2000 }else 2000 2001 2001 if( c=='o' && strncmp(azArg[0], "output", n)==0 && nArg==2 ){ 2002 if( c=='o' && strncmp(azArg[0], "output", n)==0 && nArg==2 ){ 2002 if( p->out!=stdout ){ 2003 if( p->out!=stdout ){ > 2004 if( p->outfile[0]=='|' ){ > 2005 pclose(p->out); > 2006 }else{ 2003 fclose(p->out); | 2007 fclose(p->out); > 2008 } 2004 } 2009 } 2005 if( strcmp(azArg[1],"stdout")==0 ){ 2010 if( strcmp(azArg[1],"stdout")==0 ){ 2006 p->out = stdout; 2011 p->out = stdout; 2007 sqlite3_snprintf(sizeof(p->outfile), p->outfile, "stdout"); 2012 sqlite3_snprintf(sizeof(p->outfile), p->outfile, "stdout"); > 2013 }else if( azArg[1][0]=='|' ){ > 2014 p->out = popen(&azArg[1][1], "w"); > 2015 if( p->out==0 ){ > 2016 fprintf(stderr,"Error: cannot open pipe \"%s\"\n", &azArg[1][1]); > 2017 p->out = stdout; > 2018 rc = 1; > 2019 }else{ > 2020 sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", azArg[1]); > 2021 } 2008 }else{ 2022 }else{ 2009 p->out = fopen(azArg[1], "wb"); 2023 p->out = fopen(azArg[1], "wb"); 2010 if( p->out==0 ){ 2024 if( p->out==0 ){ 2011 fprintf(stderr,"Error: cannot write to \"%s\"\n", azArg[1]); 2025 fprintf(stderr,"Error: cannot write to \"%s\"\n", azArg[1]); 2012 p->out = stdout; 2026 p->out = stdout; 2013 rc = 1; 2027 rc = 1; 2014 } else { 2028 } else {

Changes to src/sqlite3.c

1 /****************************************************************************** 1 /****************************************************************************** 2 ** This file is an amalgamation of many separate C source files from SQLite 2 ** This file is an amalgamation of many separate C source files from SQLite 3 ** version 3.7.11. By combining all the individual C code files into this | 3 ** version 3.7.12. By combining all the individual C code files into this 4 ** single large file, the entire code can be compiled as a single translation 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 5 ** unit. This allows many compilers to do optimizations that would not be 6 ** possible if the files were compiled separately. Performance improvements 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 7 ** of 5% or more are commonly seen when SQLite is compiled as a single 8 ** translation unit. 8 ** translation unit. 9 ** 9 ** 10 ** This file is all you need to compile SQLite. To use SQLite in other 10 ** This file is all you need to compile SQLite. To use SQLite in other ................................................................................................................................................................................ 653 ** string contains the date and time of the check-in (UTC) and an SHA1 653 ** string contains the date and time of the check-in (UTC) and an SHA1 654 ** hash of the entire source tree. 654 ** hash of the entire source tree. 655 ** 655 ** 656 ** See also: [sqlite3_libversion()], 656 ** See also: [sqlite3_libversion()], 657 ** [sqlite3_libversion_number()], [sqlite3_sourceid()], 657 ** [sqlite3_libversion_number()], [sqlite3_sourceid()], 658 ** [sqlite_version()] and [sqlite_source_id()]. 658 ** [sqlite_version()] and [sqlite_source_id()]. 659 */ 659 */ 660 #define SQLITE_VERSION "3.7.11" | 660 #define SQLITE_VERSION "3.7.12" 661 #define SQLITE_VERSION_NUMBER 3007011 | 661 #define SQLITE_VERSION_NUMBER 3007012 662 #define SQLITE_SOURCE_ID "2012-03-16 00:28:11 74eadeec34c4b19cf5f8b7f648db3 | 662 #define SQLITE_SOURCE_ID "2012-03-31 19:12:23 af602d87736b52802a4e760ffeeaa 663 663 664 /* 664 /* 665 ** CAPI3REF: Run-Time Library Version Numbers 665 ** CAPI3REF: Run-Time Library Version Numbers 666 ** KEYWORDS: sqlite3_version, sqlite3_sourceid 666 ** KEYWORDS: sqlite3_version, sqlite3_sourceid 667 ** 667 ** 668 ** These interfaces provide the same information as the [SQLITE_VERSION], 668 ** These interfaces provide the same information as the [SQLITE_VERSION], 669 ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros 669 ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros ................................................................................................................................................................................ 6552 ** </dd> 6552 ** </dd> 6553 ** 6553 ** 6554 ** [[SQLITE_DBSTATUS_CACHE_MISS]] ^(<dt>SQLITE_DBSTATUS_CACHE_MISS</dt> 6554 ** [[SQLITE_DBSTATUS_CACHE_MISS]] ^(<dt>SQLITE_DBSTATUS_CACHE_MISS</dt> 6555 ** <dd>This parameter returns the number of pager cache misses that have 6555 ** <dd>This parameter returns the number of pager cache misses that have 6556 ** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS 6556 ** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS 6557 ** is always 0. 6557 ** is always 0. 6558 ** </dd> 6558 ** </dd> > 6559 ** > 6560 ** [[SQLITE_DBSTATUS_CACHE_WRITE]] ^(<dt>SQLITE_DBSTATUS_CACHE_WRITE</dt> > 6561 ** <dd>This parameter returns the number of dirty cache entries that have > 6562 ** been written to disk. Specifically, the number of pages written to the > 6563 ** wal file in wal mode databases, or the number of pages written to the > 6564 ** database file in rollback mode databases. Any pages written as part of > 6565 ** transaction rollback or database recovery operations are not included. > 6566 ** If an IO or other error occurs while writing a page to disk, the effect > 6567 ** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined). ^The > 6568 ** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0. > 6569 ** </dd> 6559 ** </dl> 6570 ** </dl> 6560 */ 6571 */ 6561 #define SQLITE_DBSTATUS_LOOKASIDE_USED 0 6572 #define SQLITE_DBSTATUS_LOOKASIDE_USED 0 6562 #define SQLITE_DBSTATUS_CACHE_USED 1 6573 #define SQLITE_DBSTATUS_CACHE_USED 1 6563 #define SQLITE_DBSTATUS_SCHEMA_USED 2 6574 #define SQLITE_DBSTATUS_SCHEMA_USED 2 6564 #define SQLITE_DBSTATUS_STMT_USED 3 6575 #define SQLITE_DBSTATUS_STMT_USED 3 6565 #define SQLITE_DBSTATUS_LOOKASIDE_HIT 4 6576 #define SQLITE_DBSTATUS_LOOKASIDE_HIT 4 6566 #define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5 6577 #define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5 6567 #define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6 6578 #define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6 6568 #define SQLITE_DBSTATUS_CACHE_HIT 7 6579 #define SQLITE_DBSTATUS_CACHE_HIT 7 6569 #define SQLITE_DBSTATUS_CACHE_MISS 8 6580 #define SQLITE_DBSTATUS_CACHE_MISS 8 > 6581 #define SQLITE_DBSTATUS_CACHE_WRITE 9 6570 #define SQLITE_DBSTATUS_MAX 8 /* Largest defined DBSTATUS */ | 6582 #define SQLITE_DBSTATUS_MAX 9 /* Largest defined DBSTATUS */ 6571 6583 6572 6584 6573 /* 6585 /* 6574 ** CAPI3REF: Prepared Statement Status 6586 ** CAPI3REF: Prepared Statement Status 6575 ** 6587 ** 6576 ** ^(Each prepared statement maintains various 6588 ** ^(Each prepared statement maintains various 6577 ** [SQLITE_STMTSTATUS counters] that measure the number 6589 ** [SQLITE_STMTSTATUS counters] that measure the number ................................................................................................................................................................................ 9917 struct FuncDestructor { 9929 struct FuncDestructor { 9918 int nRef; 9930 int nRef; 9919 void (*xDestroy)(void *); 9931 void (*xDestroy)(void *); 9920 void *pUserData; 9932 void *pUserData; 9921 }; 9933 }; 9922 9934 9923 /* 9935 /* 9924 ** Possible values for FuncDef.flags | 9936 ** Possible values for FuncDef.flags. Note that the _LENGTH and _TYPEOF > 9937 ** values must correspond to OPFLAG_LENGTHARG and OPFLAG_TYPEOFARG. There > 9938 ** are assert() statements in the code to verify this. 9925 */ 9939 */ 9926 #define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */ 9940 #define SQLITE_FUNC_LIKE 0x01 /* Candidate for the LIKE optimization */ 9927 #define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */ 9941 #define SQLITE_FUNC_CASE 0x02 /* Case-sensitive LIKE-type function */ 9928 #define SQLITE_FUNC_EPHEM 0x04 /* Ephemeral. Delete with VDBE */ 9942 #define SQLITE_FUNC_EPHEM 0x04 /* Ephemeral. Delete with VDBE */ 9929 #define SQLITE_FUNC_NEEDCOLL 0x08 /* sqlite3GetFuncCollSeq() might be called */ 9943 #define SQLITE_FUNC_NEEDCOLL 0x08 /* sqlite3GetFuncCollSeq() might be called */ 9930 #define SQLITE_FUNC_COUNT 0x20 /* Built-in count(*) aggregate */ | 9944 #define SQLITE_FUNC_COUNT 0x10 /* Built-in count(*) aggregate */ 9931 #define SQLITE_FUNC_COALESCE 0x40 /* Built-in coalesce() or ifnull() function */ | 9945 #define SQLITE_FUNC_COALESCE 0x20 /* Built-in coalesce() or ifnull() function */ > 9946 #define SQLITE_FUNC_LENGTH 0x40 /* Built-in length() function */ > 9947 #define SQLITE_FUNC_TYPEOF 0x80 /* Built-in typeof() function */ 9932 9948 9933 /* 9949 /* 9934 ** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are 9950 ** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are 9935 ** used to create the initializers for the FuncDef structures. 9951 ** used to create the initializers for the FuncDef structures. 9936 ** 9952 ** 9937 ** FUNCTION(zName, nArg, iArg, bNC, xFunc) 9953 ** FUNCTION(zName, nArg, iArg, bNC, xFunc) 9938 ** Used to create a scalar function definition of a function zName 9954 ** Used to create a scalar function definition of a function zName ................................................................................................................................................................................ 9952 ** that accepts nArg arguments and is implemented by a call to C 9968 ** that accepts nArg arguments and is implemented by a call to C 9953 ** function likeFunc. Argument pArg is cast to a (void *) and made 9969 ** function likeFunc. Argument pArg is cast to a (void *) and made 9954 ** available as the function user-data (sqlite3_user_data()). The 9970 ** available as the function user-data (sqlite3_user_data()). The 9955 ** FuncDef.flags variable is set to the value passed as the flags 9971 ** FuncDef.flags variable is set to the value passed as the flags 9956 ** parameter. 9972 ** parameter. 9957 */ 9973 */ 9958 #define FUNCTION(zName, nArg, iArg, bNC, xFunc) \ 9974 #define FUNCTION(zName, nArg, iArg, bNC, xFunc) \ 9959 {nArg, SQLITE_UTF8, bNC*SQLITE_FUNC_NEEDCOLL, \ | 9975 {nArg, SQLITE_UTF8, (bNC*SQLITE_FUNC_NEEDCOLL), \ > 9976 SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName, 0, 0} > 9977 #define FUNCTION2(zName, nArg, iArg, bNC, xFunc, extraFlags) \ > 9978 {nArg, SQLITE_UTF8, (bNC*SQLITE_FUNC_NEEDCOLL)|extraFlags, \ 9960 SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName, 0, 0} 9979 SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName, 0, 0} 9961 #define STR_FUNCTION(zName, nArg, pArg, bNC, xFunc) \ 9980 #define STR_FUNCTION(zName, nArg, pArg, bNC, xFunc) \ 9962 {nArg, SQLITE_UTF8, bNC*SQLITE_FUNC_NEEDCOLL, \ 9981 {nArg, SQLITE_UTF8, bNC*SQLITE_FUNC_NEEDCOLL, \ 9963 pArg, 0, xFunc, 0, 0, #zName, 0, 0} 9982 pArg, 0, xFunc, 0, 0, #zName, 0, 0} 9964 #define LIKEFUNC(zName, nArg, arg, flags) \ 9983 #define LIKEFUNC(zName, nArg, arg, flags) \ 9965 {nArg, SQLITE_UTF8, flags, (void *)arg, 0, likeFunc, 0, 0, #zName, 0, 0} 9984 {nArg, SQLITE_UTF8, flags, (void *)arg, 0, likeFunc, 0, 0, #zName, 0, 0} 9966 #define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal) \ 9985 #define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal) \ ................................................................................................................................................................................ 10182 Select *pSelect; /* NULL for tables. Points to definition if a view. */ 10201 Select *pSelect; /* NULL for tables. Points to definition if a view. */ 10183 u16 nRef; /* Number of pointers to this Table */ 10202 u16 nRef; /* Number of pointers to this Table */ 10184 u8 tabFlags; /* Mask of TF_* values */ 10203 u8 tabFlags; /* Mask of TF_* values */ 10185 u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */ 10204 u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */ 10186 FKey *pFKey; /* Linked list of all foreign keys in this table */ 10205 FKey *pFKey; /* Linked list of all foreign keys in this table */ 10187 char *zColAff; /* String defining the affinity of each column */ 10206 char *zColAff; /* String defining the affinity of each column */ 10188 #ifndef SQLITE_OMIT_CHECK 10207 #ifndef SQLITE_OMIT_CHECK 10189 Expr *pCheck; /* The AND of all CHECK constraints */ | 10208 ExprList *pCheck; /* All CHECK constraints */ 10190 #endif 10209 #endif 10191 #ifndef SQLITE_OMIT_ALTERTABLE 10210 #ifndef SQLITE_OMIT_ALTERTABLE 10192 int addColOffset; /* Offset in CREATE TABLE stmt to add a new column */ 10211 int addColOffset; /* Offset in CREATE TABLE stmt to add a new column */ 10193 #endif 10212 #endif 10194 #ifndef SQLITE_OMIT_VIRTUALTABLE 10213 #ifndef SQLITE_OMIT_VIRTUALTABLE 10195 VTable *pVTable; /* List of VTable objects. */ 10214 VTable *pVTable; /* List of VTable objects. */ 10196 int nModuleArg; /* Number of arguments to the module */ 10215 int nModuleArg; /* Number of arguments to the module */ ................................................................................................................................................................................ 10575 ** TK_TRIGGER: 1 -> new, 0 -> old */ 10594 ** TK_TRIGGER: 1 -> new, 0 -> old */ 10576 ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid. 10595 ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid. 10577 ** TK_VARIABLE: variable number (always >= 1). */ 10596 ** TK_VARIABLE: variable number (always >= 1). */ 10578 i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */ 10597 i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */ 10579 i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */ 10598 i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */ 10580 u8 flags2; /* Second set of flags. EP2_... */ 10599 u8 flags2; /* Second set of flags. EP2_... */ 10581 u8 op2; /* If a TK_REGISTER, the original value of Expr.op */ 10600 u8 op2; /* If a TK_REGISTER, the original value of Expr.op */ > 10601 /* If TK_COLUMN, the value of p5 for OP_Column */ 10582 AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ 10602 AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ 10583 Table *pTab; /* Table for TK_COLUMN expressions. */ 10603 Table *pTab; /* Table for TK_COLUMN expressions. */ 10584 #if SQLITE_MAX_EXPR_DEPTH>0 10604 #if SQLITE_MAX_EXPR_DEPTH>0 10585 int nHeight; /* Height of the tree headed by this node */ 10605 int nHeight; /* Height of the tree headed by this node */ 10586 #endif 10606 #endif 10587 }; 10607 }; 10588 10608 ................................................................................................................................................................................ 10597 #define EP_VarSelect 0x0020 /* pSelect is correlated, not constant */ 10617 #define EP_VarSelect 0x0020 /* pSelect is correlated, not constant */ 10598 #define EP_DblQuoted 0x0040 /* token.z was originally in "..." */ 10618 #define EP_DblQuoted 0x0040 /* token.z was originally in "..." */ 10599 #define EP_InfixFunc 0x0080 /* True for an infix function: LIKE, GLOB, etc */ 10619 #define EP_InfixFunc 0x0080 /* True for an infix function: LIKE, GLOB, etc */ 10600 #define EP_ExpCollate 0x0100 /* Collating sequence specified explicitly */ 10620 #define EP_ExpCollate 0x0100 /* Collating sequence specified explicitly */ 10601 #define EP_FixedDest 0x0200 /* Result needed in a specific register */ 10621 #define EP_FixedDest 0x0200 /* Result needed in a specific register */ 10602 #define EP_IntValue 0x0400 /* Integer value contained in u.iValue */ 10622 #define EP_IntValue 0x0400 /* Integer value contained in u.iValue */ 10603 #define EP_xIsSelect 0x0800 /* x.pSelect is valid (otherwise x.pList is) */ 10623 #define EP_xIsSelect 0x0800 /* x.pSelect is valid (otherwise x.pList is) */ 10604 #define EP_Hint 0x1000 /* Optimizer hint. Not required for correctness */ | 10624 #define EP_Hint 0x1000 /* Not used */ 10605 #define EP_Reduced 0x2000 /* Expr struct is EXPR_REDUCEDSIZE bytes only */ 10625 #define EP_Reduced 0x2000 /* Expr struct is EXPR_REDUCEDSIZE bytes only */ 10606 #define EP_TokenOnly 0x4000 /* Expr struct is EXPR_TOKENONLYSIZE bytes only */ 10626 #define EP_TokenOnly 0x4000 /* Expr struct is EXPR_TOKENONLYSIZE bytes only */ 10607 #define EP_Static 0x8000 /* Held in memory not obtained from malloc() */ 10627 #define EP_Static 0x8000 /* Held in memory not obtained from malloc() */ 10608 10628 10609 /* 10629 /* 10610 ** The following are the meanings of bits in the Expr.flags2 field. 10630 ** The following are the meanings of bits in the Expr.flags2 field. 10611 */ 10631 */ ................................................................................................................................................................................ 11116 yDbMask writeMask; /* Start a write transaction on these databases */ 11136 yDbMask writeMask; /* Start a write transaction on these databases */ 11117 yDbMask cookieMask; /* Bitmask of schema verified databases */ 11137 yDbMask cookieMask; /* Bitmask of schema verified databases */ 11118 int cookieGoto; /* Address of OP_Goto to cookie verifier subroutine */ 11138 int cookieGoto; /* Address of OP_Goto to cookie verifier subroutine */ 11119 int cookieValue[SQLITE_MAX_ATTACHED+2]; /* Values of cookies to verify */ 11139 int cookieValue[SQLITE_MAX_ATTACHED+2]; /* Values of cookies to verify */ 11120 int regRowid; /* Register holding rowid of CREATE TABLE entry */ 11140 int regRowid; /* Register holding rowid of CREATE TABLE entry */ 11121 int regRoot; /* Register holding root page number for new objects */ 11141 int regRoot; /* Register holding root page number for new objects */ 11122 int nMaxArg; /* Max args passed to user function by sub-program */ 11142 int nMaxArg; /* Max args passed to user function by sub-program */ > 11143 Token constraintName;/* Name of the constraint currently being parsed */ 11123 #ifndef SQLITE_OMIT_SHARED_CACHE 11144 #ifndef SQLITE_OMIT_SHARED_CACHE 11124 int nTableLock; /* Number of locks in aTableLock */ 11145 int nTableLock; /* Number of locks in aTableLock */ 11125 TableLock *aTableLock; /* Required table locks for shared-cache mode */ 11146 TableLock *aTableLock; /* Required table locks for shared-cache mode */ 11126 #endif 11147 #endif 11127 AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */ 11148 AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */ 11128 11149 11129 /* Information used while coding trigger programs. */ 11150 /* Information used while coding trigger programs. */ ................................................................................................................................................................................ 11184 */ 11205 */ 11185 struct AuthContext { 11206 struct AuthContext { 11186 const char *zAuthContext; /* Put saved Parse.zAuthContext here */ 11207 const char *zAuthContext; /* Put saved Parse.zAuthContext here */ 11187 Parse *pParse; /* The Parse structure */ 11208 Parse *pParse; /* The Parse structure */ 11188 }; 11209 }; 11189 11210 11190 /* 11211 /* 11191 ** Bitfield flags for P5 value in OP_Insert and OP_Delete | 11212 ** Bitfield flags for P5 value in various opcodes. 11192 */ 11213 */ 11193 #define OPFLAG_NCHANGE 0x01 /* Set to update db->nChange */ 11214 #define OPFLAG_NCHANGE 0x01 /* Set to update db->nChange */ 11194 #define OPFLAG_LASTROWID 0x02 /* Set to update db->lastRowid */ 11215 #define OPFLAG_LASTROWID 0x02 /* Set to update db->lastRowid */ 11195 #define OPFLAG_ISUPDATE 0x04 /* This OP_Insert is an sql UPDATE */ 11216 #define OPFLAG_ISUPDATE 0x04 /* This OP_Insert is an sql UPDATE */ 11196 #define OPFLAG_APPEND 0x08 /* This is likely to be an append */ 11217 #define OPFLAG_APPEND 0x08 /* This is likely to be an append */ 11197 #define OPFLAG_USESEEKRESULT 0x10 /* Try to avoid a seek in BtreeInsert() */ 11218 #define OPFLAG_USESEEKRESULT 0x10 /* Try to avoid a seek in BtreeInsert() */ 11198 #define OPFLAG_CLEARCACHE 0x20 /* Clear pseudo-table cache in OP_Column */ 11219 #define OPFLAG_CLEARCACHE 0x20 /* Clear pseudo-table cache in OP_Column */ > 11220 #define OPFLAG_LENGTHARG 0x40 /* OP_Column only used for length() */ > 11221 #define OPFLAG_TYPEOFARG 0x80 /* OP_Column only used for typeof() */ 11199 11222 11200 /* 11223 /* 11201 * Each trigger present in the database schema is stored as an instance of 11224 * Each trigger present in the database schema is stored as an instance of 11202 * struct Trigger. 11225 * struct Trigger. 11203 * 11226 * 11204 * Pointers to instances of struct Trigger are stored in two ways. 11227 * Pointers to instances of struct Trigger are stored in two ways. 11205 * 1. In the "trigHash" hash table (part of the sqlite3* that represents the 11228 * 1. In the "trigHash" hash table (part of the sqlite3* that represents the ................................................................................................................................................................................ 11675 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) 11698 #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) 11676 SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse *, SrcList *, Expr *, ExprList *, E 11699 SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse *, SrcList *, Expr *, ExprList *, E 11677 #endif 11700 #endif 11678 SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*); 11701 SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*); 11679 SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int); 11702 SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int); 11680 SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*, SrcList*, Expr*, ExprList**, 11703 SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*, SrcList*, Expr*, ExprList**, 11681 SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*); 11704 SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*); 11682 SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int); | 11705 SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, u8); 11683 SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int 11706 SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int 11684 SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int); 11707 SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int); 11685 SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, int, int, int); 11708 SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, int, int, int); 11686 SQLITE_PRIVATE void sqlite3ExprCacheStore(Parse*, int, int, int); 11709 SQLITE_PRIVATE void sqlite3ExprCacheStore(Parse*, int, int, int); 11687 SQLITE_PRIVATE void sqlite3ExprCachePush(Parse*); 11710 SQLITE_PRIVATE void sqlite3ExprCachePush(Parse*); 11688 SQLITE_PRIVATE void sqlite3ExprCachePop(Parse*, int); 11711 SQLITE_PRIVATE void sqlite3ExprCachePop(Parse*, int); 11689 SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse*, int, int); 11712 SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse*, int, int); ................................................................................................................................................................................ 13507 13530 13508 /* 13531 /* 13509 ** Set *pCurrent to the total cache hits or misses encountered by all 13532 ** Set *pCurrent to the total cache hits or misses encountered by all 13510 ** pagers the database handle is connected to. *pHighwater is always set 13533 ** pagers the database handle is connected to. *pHighwater is always set 13511 ** to zero. 13534 ** to zero. 13512 */ 13535 */ 13513 case SQLITE_DBSTATUS_CACHE_HIT: 13536 case SQLITE_DBSTATUS_CACHE_HIT: 13514 case SQLITE_DBSTATUS_CACHE_MISS: { | 13537 case SQLITE_DBSTATUS_CACHE_MISS: > 13538 case SQLITE_DBSTATUS_CACHE_WRITE:{ 13515 int i; 13539 int i; 13516 int nRet = 0; 13540 int nRet = 0; 13517 assert( SQLITE_DBSTATUS_CACHE_MISS==SQLITE_DBSTATUS_CACHE_HIT+1 ); 13541 assert( SQLITE_DBSTATUS_CACHE_MISS==SQLITE_DBSTATUS_CACHE_HIT+1 ); > 13542 assert( SQLITE_DBSTATUS_CACHE_WRITE==SQLITE_DBSTATUS_CACHE_HIT+2 ); 13518 13543 13519 for(i=0; i<db->nDb; i++){ 13544 for(i=0; i<db->nDb; i++){ 13520 if( db->aDb[i].pBt ){ 13545 if( db->aDb[i].pBt ){ 13521 Pager *pPager = sqlite3BtreePager(db->aDb[i].pBt); 13546 Pager *pPager = sqlite3BtreePager(db->aDb[i].pBt); 13522 sqlite3PagerCacheStat(pPager, op, resetFlag, &nRet); 13547 sqlite3PagerCacheStat(pPager, op, resetFlag, &nRet); 13523 } 13548 } 13524 } 13549 } ................................................................................................................................................................................ 21257 /* Convenient short-hand */ 21282 /* Convenient short-hand */ 21258 #define UpperToLower sqlite3UpperToLower 21283 #define UpperToLower sqlite3UpperToLower 21259 21284 21260 /* 21285 /* 21261 ** Some systems have stricmp(). Others have strcasecmp(). Because 21286 ** Some systems have stricmp(). Others have strcasecmp(). Because 21262 ** there is no consistency, we will define our own. 21287 ** there is no consistency, we will define our own. 21263 ** 21288 ** 21264 ** IMPLEMENTATION-OF: R-20522-24639 The sqlite3_strnicmp() API allows | 21289 ** IMPLEMENTATION-OF: R-30243-02494 The sqlite3_stricmp() and 21265 ** applications and extensions to compare the contents of two buffers | 21290 ** sqlite3_strnicmp() APIs allow applications and extensions to compare 21266 ** containing UTF-8 strings in a case-independent fashion, using the same | 21291 ** the contents of two buffers containing UTF-8 strings in a 21267 ** definition of case independence that SQLite uses internally when | 21292 ** case-independent fashion, using the same definition of "case 21268 ** comparing identifiers. | 21293 ** independence" that SQLite uses internally when comparing identifiers. 21269 */ 21294 */ 21270 SQLITE_API int sqlite3_stricmp(const char *zLeft, const char *zRight){ 21295 SQLITE_API int sqlite3_stricmp(const char *zLeft, const char *zRight){ 21271 register unsigned char *a, *b; 21296 register unsigned char *a, *b; 21272 a = (unsigned char *)zLeft; 21297 a = (unsigned char *)zLeft; 21273 b = (unsigned char *)zRight; 21298 b = (unsigned char *)zRight; 21274 while( *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; } 21299 while( *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; } 21275 return UpperToLower[*a] - UpperToLower[*b]; 21300 return UpperToLower[*a] - UpperToLower[*b]; ................................................................................................................................................................................ 33725 ){ 33750 ){ 33726 osSleep(100); /* Wait a little before trying again */ 33751 osSleep(100); /* Wait a little before trying again */ 33727 } 33752 } 33728 sqlite3_free(pFile->zDeleteOnClose); 33753 sqlite3_free(pFile->zDeleteOnClose); 33729 } 33754 } 33730 #endif 33755 #endif 33731 OSTRACE(("CLOSE %d %s\n", pFile->h, rc ? "ok" : "failed")); 33756 OSTRACE(("CLOSE %d %s\n", pFile->h, rc ? "ok" : "failed")); > 33757 if( rc ){ > 33758 pFile->h = NULL; > 33759 } 33732 OpenCounter(-1); 33760 OpenCounter(-1); 33733 return rc ? SQLITE_OK 33761 return rc ? SQLITE_OK 33734 : winLogError(SQLITE_IOERR_CLOSE, osGetLastError(), 33762 : winLogError(SQLITE_IOERR_CLOSE, osGetLastError(), 33735 "winClose", pFile->zPath); 33763 "winClose", pFile->zPath); 33736 } 33764 } 33737 33765 33738 /* 33766 /* ................................................................................................................................................................................ 33742 */ 33770 */ 33743 static int winRead( 33771 static int winRead( 33744 sqlite3_file *id, /* File to read from */ 33772 sqlite3_file *id, /* File to read from */ 33745 void *pBuf, /* Write content into this buffer */ 33773 void *pBuf, /* Write content into this buffer */ 33746 int amt, /* Number of bytes to read */ 33774 int amt, /* Number of bytes to read */ 33747 sqlite3_int64 offset /* Begin reading at this offset */ 33775 sqlite3_int64 offset /* Begin reading at this offset */ 33748 ){ 33776 ){ > 33777 #if !SQLITE_OS_WINCE > 33778 OVERLAPPED overlapped; /* The offset for ReadFile. */ > 33779 #endif 33749 winFile *pFile = (winFile*)id; /* file handle */ 33780 winFile *pFile = (winFile*)id; /* file handle */ 33750 DWORD nRead; /* Number of bytes actually read from file */ 33781 DWORD nRead; /* Number of bytes actually read from file */ 33751 int nRetry = 0; /* Number of retrys */ 33782 int nRetry = 0; /* Number of retrys */ 33752 33783 33753 assert( id!=0 ); 33784 assert( id!=0 ); 33754 SimulateIOError(return SQLITE_IOERR_READ); 33785 SimulateIOError(return SQLITE_IOERR_READ); 33755 OSTRACE(("READ %d lock=%d\n", pFile->h, pFile->locktype)); 33786 OSTRACE(("READ %d lock=%d\n", pFile->h, pFile->locktype)); 33756 33787 > 33788 #if SQLITE_OS_WINCE 33757 if( seekWinFile(pFile, offset) ){ 33789 if( seekWinFile(pFile, offset) ){ 33758 return SQLITE_FULL; 33790 return SQLITE_FULL; 33759 } 33791 } 33760 while( !osReadFile(pFile->h, pBuf, amt, &nRead, 0) ){ 33792 while( !osReadFile(pFile->h, pBuf, amt, &nRead, 0) ){ > 33793 #else > 33794 memset(&overlapped, 0, sizeof(OVERLAPPED)); > 33795 overlapped.Offset = (LONG)(offset & 0xffffffff); > 33796 overlapped.OffsetHigh = (LONG)((offset>>32) & 0x7fffffff); > 33797 while( !osReadFile(pFile->h, pBuf, amt, &nRead, &overlapped) && > 33798 osGetLastError()!=ERROR_HANDLE_EOF ){ > 33799 #endif 33761 DWORD lastErrno; 33800 DWORD lastErrno; 33762 if( retryIoerr(&nRetry, &lastErrno) ) continue; 33801 if( retryIoerr(&nRetry, &lastErrno) ) continue; 33763 pFile->lastErrno = lastErrno; 33802 pFile->lastErrno = lastErrno; 33764 return winLogError(SQLITE_IOERR_READ, pFile->lastErrno, 33803 return winLogError(SQLITE_IOERR_READ, pFile->lastErrno, 33765 "winRead", pFile->zPath); 33804 "winRead", pFile->zPath); 33766 } 33805 } 33767 logIoerr(nRetry); 33806 logIoerr(nRetry); ................................................................................................................................................................................ 33780 */ 33819 */ 33781 static int winWrite( 33820 static int winWrite( 33782 sqlite3_file *id, /* File to write into */ 33821 sqlite3_file *id, /* File to write into */ 33783 const void *pBuf, /* The bytes to be written */ 33822 const void *pBuf, /* The bytes to be written */ 33784 int amt, /* Number of bytes to write */ 33823 int amt, /* Number of bytes to write */ 33785 sqlite3_int64 offset /* Offset into the file to begin writing at */ 33824 sqlite3_int64 offset /* Offset into the file to begin writing at */ 33786 ){ 33825 ){ 33787 int rc; /* True if error has occured, else false */ | 33826 int rc = 0; /* True if error has occured, else false */ 33788 winFile *pFile = (winFile*)id; /* File handle */ 33827 winFile *pFile = (winFile*)id; /* File handle */ 33789 int nRetry = 0; /* Number of retries */ 33828 int nRetry = 0; /* Number of retries */ 33790 33829 33791 assert( amt>0 ); 33830 assert( amt>0 ); 33792 assert( pFile ); 33831 assert( pFile ); 33793 SimulateIOError(return SQLITE_IOERR_WRITE); 33832 SimulateIOError(return SQLITE_IOERR_WRITE); 33794 SimulateDiskfullError(return SQLITE_FULL); 33833 SimulateDiskfullError(return SQLITE_FULL); 33795 33834 33796 OSTRACE(("WRITE %d lock=%d\n", pFile->h, pFile->locktype)); 33835 OSTRACE(("WRITE %d lock=%d\n", pFile->h, pFile->locktype)); 33797 33836 > 33837 #if SQLITE_OS_WINCE 33798 rc = seekWinFile(pFile, offset); 33838 rc = seekWinFile(pFile, offset); 33799 if( rc==0 ){ 33839 if( rc==0 ){ > 33840 #else > 33841 { > 33842 #endif > 33843 #if !SQLITE_OS_WINCE > 33844 OVERLAPPED overlapped; /* The offset for WriteFile. */ > 33845 #endif 33800 u8 *aRem = (u8 *)pBuf; /* Data yet to be written */ 33846 u8 *aRem = (u8 *)pBuf; /* Data yet to be written */ 33801 int nRem = amt; /* Number of bytes yet to be written */ 33847 int nRem = amt; /* Number of bytes yet to be written */ 33802 DWORD nWrite; /* Bytes written by each WriteFile() call */ 33848 DWORD nWrite; /* Bytes written by each WriteFile() call */ 33803 DWORD lastErrno = NO_ERROR; /* Value returned by GetLastError() */ 33849 DWORD lastErrno = NO_ERROR; /* Value returned by GetLastError() */ 33804 33850 > 33851 #if !SQLITE_OS_WINCE > 33852 memset(&overlapped, 0, sizeof(OVERLAPPED)); > 33853 overlapped.Offset = (LONG)(offset & 0xffffffff); > 33854 overlapped.OffsetHigh = (LONG)((offset>>32) & 0x7fffffff); > 33855 #endif > 33856 33805 while( nRem>0 ){ 33857 while( nRem>0 ){ > 33858 #if SQLITE_OS_WINCE 33806 if( !osWriteFile(pFile->h, aRem, nRem, &nWrite, 0) ){ 33859 if( !osWriteFile(pFile->h, aRem, nRem, &nWrite, 0) ){ > 33860 #else > 33861 if( !osWriteFile(pFile->h, aRem, nRem, &nWrite, &overlapped) ){ > 33862 #endif 33807 if( retryIoerr(&nRetry, &lastErrno) ) continue; 33863 if( retryIoerr(&nRetry, &lastErrno) ) continue; 33808 break; 33864 break; 33809 } 33865 } 33810 if( nWrite<=0 ) break; | 33866 if( nWrite<=0 ){ > 33867 lastErrno = osGetLastError(); > 33868 break; > 33869 } > 33870 #if !SQLITE_OS_WINCE > 33871 offset += nWrite; > 33872 overlapped.Offset = (LONG)(offset & 0xffffffff); > 33873 overlapped.OffsetHigh = (LONG)((offset>>32) & 0x7fffffff); > 33874 #endif 33811 aRem += nWrite; 33875 aRem += nWrite; 33812 nRem -= nWrite; 33876 nRem -= nWrite; 33813 } 33877 } 33814 if( nRem>0 ){ 33878 if( nRem>0 ){ 33815 pFile->lastErrno = lastErrno; 33879 pFile->lastErrno = lastErrno; 33816 rc = 1; 33880 rc = 1; 33817 } 33881 } ................................................................................................................................................................................ 39092 int pageSize; /* Number of bytes in a page */ 39156 int pageSize; /* Number of bytes in a page */ 39093 Pgno mxPgno; /* Maximum allowed size of the database */ 39157 Pgno mxPgno; /* Maximum allowed size of the database */ 39094 i64 journalSizeLimit; /* Size limit for persistent journal files */ 39158 i64 journalSizeLimit; /* Size limit for persistent journal files */ 39095 char *zFilename; /* Name of the database file */ 39159 char *zFilename; /* Name of the database file */ 39096 char *zJournal; /* Name of the journal file */ 39160 char *zJournal; /* Name of the journal file */ 39097 int (*xBusyHandler)(void*); /* Function to call when busy */ 39161 int (*xBusyHandler)(void*); /* Function to call when busy */ 39098 void *pBusyHandlerArg; /* Context argument for xBusyHandler */ 39162 void *pBusyHandlerArg; /* Context argument for xBusyHandler */ 39099 int nHit, nMiss; /* Total cache hits and misses */ | 39163 int aStat[3]; /* Total cache hits, misses and writes */ 39100 #ifdef SQLITE_TEST 39164 #ifdef SQLITE_TEST 39101 int nRead, nWrite; /* Database pages read/written */ | 39165 int nRead; /* Database pages read */ 39102 #endif 39166 #endif 39103 void (*xReiniter)(DbPage*); /* Call this routine when reloading pages */ 39167 void (*xReiniter)(DbPage*); /* Call this routine when reloading pages */ 39104 #ifdef SQLITE_HAS_CODEC 39168 #ifdef SQLITE_HAS_CODEC 39105 void *(*xCodec)(void*,void*,Pgno,int); /* Routine for en/decoding data */ 39169 void *(*xCodec)(void*,void*,Pgno,int); /* Routine for en/decoding data */ 39106 void (*xCodecSizeChng)(void*,int,int); /* Notify of page size changes */ 39170 void (*xCodecSizeChng)(void*,int,int); /* Notify of page size changes */ 39107 void (*xCodecFree)(void*); /* Destructor for the codec */ 39171 void (*xCodecFree)(void*); /* Destructor for the codec */ 39108 void *pCodec; /* First argument to xCodec... methods */ 39172 void *pCodec; /* First argument to xCodec... methods */ ................................................................................................................................................................................ 39111 PCache *pPCache; /* Pointer to page cache object */ 39175 PCache *pPCache; /* Pointer to page cache object */ 39112 #ifndef SQLITE_OMIT_WAL 39176 #ifndef SQLITE_OMIT_WAL 39113 Wal *pWal; /* Write-ahead log used by "journal_mode=wal" */ 39177 Wal *pWal; /* Write-ahead log used by "journal_mode=wal" */ 39114 char *zWal; /* File name for write-ahead log */ 39178 char *zWal; /* File name for write-ahead log */ 39115 #endif 39179 #endif 39116 }; 39180 }; 39117 39181 > 39182 /* > 39183 ** Indexes for use with Pager.aStat[]. The Pager.aStat[] array contains > 39184 ** the values accessed by passing SQLITE_DBSTATUS_CACHE_HIT, CACHE_MISS > 39185 ** or CACHE_WRITE to sqlite3_db_status(). > 39186 */ > 39187 #define PAGER_STAT_HIT 0 > 39188 #define PAGER_STAT_MISS 1 > 39189 #define PAGER_STAT_WRITE 2 > 39190 39118 /* 39191 /* 39119 ** The following global variables hold counters used for 39192 ** The following global variables hold counters used for 39120 ** testing purposes only. These variables do not exist in 39193 ** testing purposes only. These variables do not exist in 39121 ** a non-testing build. These variables are not thread-safe. 39194 ** a non-testing build. These variables are not thread-safe. 39122 */ 39195 */ 39123 #ifdef SQLITE_TEST 39196 #ifdef SQLITE_TEST 39124 SQLITE_API int sqlite3_pager_readdb_count = 0; /* Number of full pages read f 39197 SQLITE_API int sqlite3_pager_readdb_count = 0; /* Number of full pages read f ................................................................................................................................................................................ 41393 static int pagerWalFrames( 41466 static int pagerWalFrames( 41394 Pager *pPager, /* Pager object */ 41467 Pager *pPager, /* Pager object */ 41395 PgHdr *pList, /* List of frames to log */ 41468 PgHdr *pList, /* List of frames to log */ 41396 Pgno nTruncate, /* Database size after this commit */ 41469 Pgno nTruncate, /* Database size after this commit */ 41397 int isCommit /* True if this is a commit */ 41470 int isCommit /* True if this is a commit */ 41398 ){ 41471 ){ 41399 int rc; /* Return code */ 41472 int rc; /* Return code */ > 41473 int nList; /* Number of pages in pList */ 41400 #if defined(SQLITE_DEBUG) || defined(SQLITE_CHECK_PAGES) 41474 #if defined(SQLITE_DEBUG) || defined(SQLITE_CHECK_PAGES) 41401 PgHdr *p; /* For looping over pages */ 41475 PgHdr *p; /* For looping over pages */ 41402 #endif 41476 #endif 41403 41477 41404 assert( pPager->pWal ); 41478 assert( pPager->pWal ); 41405 assert( pList ); 41479 assert( pList ); 41406 #ifdef SQLITE_DEBUG 41480 #ifdef SQLITE_DEBUG 41407 /* Verify that the page list is in accending order */ 41481 /* Verify that the page list is in accending order */ 41408 for(p=pList; p && p->pDirty; p=p->pDirty){ 41482 for(p=pList; p && p->pDirty; p=p->pDirty){ 41409 assert( p->pgno < p->pDirty->pgno ); 41483 assert( p->pgno < p->pDirty->pgno ); 41410 } 41484 } 41411 #endif 41485 #endif 41412 41486 > 41487 assert( pList->pDirty==0 || isCommit ); 41413 if( isCommit ){ 41488 if( isCommit ){ 41414 /* If a WAL transaction is being committed, there is no point in writing 41489 /* If a WAL transaction is being committed, there is no point in writing 41415 ** any pages with page numbers greater than nTruncate into the WAL file. 41490 ** any pages with page numbers greater than nTruncate into the WAL file. 41416 ** They will never be read by any client. So remove them from the pDirty 41491 ** They will never be read by any client. So remove them from the pDirty 41417 ** list here. */ 41492 ** list here. */ 41418 PgHdr *p; 41493 PgHdr *p; 41419 PgHdr **ppNext = &pList; 41494 PgHdr **ppNext = &pList; > 41495 nList = 0; 41420 for(p=pList; (*ppNext = p); p=p->pDirty){ 41496 for(p=pList; (*ppNext = p); p=p->pDirty){ 41421 if( p->pgno<=nTruncate ) ppNext = &p->pDirty; | 41497 if( p->pgno<=nTruncate ){ > 41498 ppNext = &p->pDirty; > 41499 nList++; 41422 } | 41500 } > 41501 } 41423 assert( pList ); 41502 assert( pList ); > 41503 }else{ > 41504 nList = 1; 41424 } 41505 } > 41506 pPager->aStat[PAGER_STAT_WRITE] += nList; 41425 41507 41426 if( pList->pgno==1 ) pager_write_changecounter(pList); 41508 if( pList->pgno==1 ) pager_write_changecounter(pList); 41427 rc = sqlite3WalFrames(pPager->pWal, 41509 rc = sqlite3WalFrames(pPager->pWal, 41428 pPager->pageSize, pList, nTruncate, isCommit, pPager->walSyncFlags 41510 pPager->pageSize, pList, nTruncate, isCommit, pPager->walSyncFlags 41429 ); 41511 ); 41430 if( rc==SQLITE_OK && pPager->pBackup ){ 41512 if( rc==SQLITE_OK && pPager->pBackup ){ 41431 PgHdr *p; 41513 PgHdr *p; ................................................................................................................................................................................ 42485 */ 42567 */ 42486 if( pgno==1 ){ 42568 if( pgno==1 ){ 42487 memcpy(&pPager->dbFileVers, &pData[24], sizeof(pPager->dbFileVers)); 42569 memcpy(&pPager->dbFileVers, &pData[24], sizeof(pPager->dbFileVers)); 42488 } 42570 } 42489 if( pgno>pPager->dbFileSize ){ 42571 if( pgno>pPager->dbFileSize ){ 42490 pPager->dbFileSize = pgno; 42572 pPager->dbFileSize = pgno; 42491 } 42573 } > 42574 pPager->aStat[PAGER_STAT_WRITE]++; 42492 42575 42493 /* Update any backup objects copying the contents of this pager. */ 42576 /* Update any backup objects copying the contents of this pager. */ 42494 sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)pList->pData); 42577 sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)pList->pData); 42495 42578 42496 PAGERTRACE(("STORE %d page %d hash(%08x)\n", 42579 PAGERTRACE(("STORE %d page %d hash(%08x)\n", 42497 PAGERID(pPager), pgno, pager_pagehash(pList))); 42580 PAGERID(pPager), pgno, pager_pagehash(pList))); 42498 IOTRACE(("PGOUT %p %d\n", pPager, pgno)); 42581 IOTRACE(("PGOUT %p %d\n", pPager, pgno)); 42499 PAGER_INCR(sqlite3_pager_writedb_count); 42582 PAGER_INCR(sqlite3_pager_writedb_count); 42500 PAGER_INCR(pPager->nWrite); < 42501 }else{ 42583 }else{ 42502 PAGERTRACE(("NOSTORE %d page %d\n", PAGERID(pPager), pgno)); 42584 PAGERTRACE(("NOSTORE %d page %d\n", PAGERID(pPager), pgno)); 42503 } 42585 } 42504 pager_set_pagehash(pList); 42586 pager_set_pagehash(pList); 42505 pList = pList->pDirty; 42587 pList = pList->pDirty; 42506 } 42588 } 42507 42589 ................................................................................................................................................................................ 43451 assert( (*ppPage)->pgno==pgno ); 43533 assert( (*ppPage)->pgno==pgno ); 43452 assert( (*ppPage)->pPager==pPager || (*ppPage)->pPager==0 ); 43534 assert( (*ppPage)->pPager==pPager || (*ppPage)->pPager==0 ); 43453 43535 43454 if( (*ppPage)->pPager && !noContent ){ 43536 if( (*ppPage)->pPager && !noContent ){ 43455 /* In this case the pcache already contains an initialized copy of 43537 /* In this case the pcache already contains an initialized copy of 43456 ** the page. Return without further ado. */ 43538 ** the page. Return without further ado. */ 43457 assert( pgno<=PAGER_MAX_PGNO && pgno!=PAGER_MJ_PGNO(pPager) ); 43539 assert( pgno<=PAGER_MAX_PGNO && pgno!=PAGER_MJ_PGNO(pPager) ); 43458 pPager->nHit++; | 43540 pPager->aStat[PAGER_STAT_HIT]++; 43459 return SQLITE_OK; 43541 return SQLITE_OK; 43460 43542 43461 }else{ 43543 }else{ 43462 /* The pager cache has created a new page. Its content needs to 43544 /* The pager cache has created a new page. Its content needs to 43463 ** be initialized. */ 43545 ** be initialized. */ 43464 43546 43465 pPg = *ppPage; 43547 pPg = *ppPage; ................................................................................................................................................................................ 43493 testcase( rc==SQLITE_NOMEM ); 43575 testcase( rc==SQLITE_NOMEM ); 43494 sqlite3EndBenignMalloc(); 43576 sqlite3EndBenignMalloc(); 43495 } 43577 } 43496 memset(pPg->pData, 0, pPager->pageSize); 43578 memset(pPg->pData, 0, pPager->pageSize); 43497 IOTRACE(("ZERO %p %d\n", pPager, pgno)); 43579 IOTRACE(("ZERO %p %d\n", pPager, pgno)); 43498 }else{ 43580 }else{ 43499 assert( pPg->pPager==pPager ); 43581 assert( pPg->pPager==pPager ); 43500 pPager->nMiss++; | 43582 pPager->aStat[PAGER_STAT_MISS]++; 43501 rc = readDbPage(pPg); 43583 rc = readDbPage(pPg); 43502 if( rc!=SQLITE_OK ){ 43584 if( rc!=SQLITE_OK ){ 43503 goto pager_acquire_err; 43585 goto pager_acquire_err; 43504 } 43586 } 43505 } 43587 } 43506 pager_set_pagehash(pPg); 43588 pager_set_pagehash(pPg); 43507 } 43589 } ................................................................................................................................................................................ 44078 /* If running in direct mode, write the contents of page 1 to the file. */ 44160 /* If running in direct mode, write the contents of page 1 to the file. */ 44079 if( DIRECT_MODE ){ 44161 if( DIRECT_MODE ){ 44080 const void *zBuf; 44162 const void *zBuf; 44081 assert( pPager->dbFileSize>0 ); 44163 assert( pPager->dbFileSize>0 ); 44082 CODEC2(pPager, pPgHdr->pData, 1, 6, rc=SQLITE_NOMEM, zBuf); 44164 CODEC2(pPager, pPgHdr->pData, 1, 6, rc=SQLITE_NOMEM, zBuf); 44083 if( rc==SQLITE_OK ){ 44165 if( rc==SQLITE_OK ){ 44084 rc = sqlite3OsWrite(pPager->fd, zBuf, pPager->pageSize, 0); 44166 rc = sqlite3OsWrite(pPager->fd, zBuf, pPager->pageSize, 0); > 44167 pPager->aStat[PAGER_STAT_WRITE]++; 44085 } 44168 } 44086 if( rc==SQLITE_OK ){ 44169 if( rc==SQLITE_OK ){ 44087 pPager->changeCountDone = 1; 44170 pPager->changeCountDone = 1; 44088 } 44171 } 44089 }else{ 44172 }else{ 44090 pPager->changeCountDone = 1; 44173 pPager->changeCountDone = 1; 44091 } 44174 } ................................................................................................................................................................................ 44521 static int a[11]; 44604 static int a[11]; 44522 a[0] = sqlite3PcacheRefCount(pPager->pPCache); 44605 a[0] = sqlite3PcacheRefCount(pPager->pPCache); 44523 a[1] = sqlite3PcachePagecount(pPager->pPCache); 44606 a[1] = sqlite3PcachePagecount(pPager->pPCache); 44524 a[2] = sqlite3PcacheGetCachesize(pPager->pPCache); 44607 a[2] = sqlite3PcacheGetCachesize(pPager->pPCache); 44525 a[3] = pPager->eState==PAGER_OPEN ? -1 : (int) pPager->dbSize; 44608 a[3] = pPager->eState==PAGER_OPEN ? -1 : (int) pPager->dbSize; 44526 a[4] = pPager->eState; 44609 a[4] = pPager->eState; 44527 a[5] = pPager->errCode; 44610 a[5] = pPager->errCode; 44528 a[6] = pPager->nHit; | 44611 a[6] = pPager->aStat[PAGER_STAT_HIT]; 44529 a[7] = pPager->nMiss; | 44612 a[7] = pPager->aStat[PAGER_STAT_MISS]; 44530 a[8] = 0; /* Used to be pPager->nOvfl */ 44613 a[8] = 0; /* Used to be pPager->nOvfl */ 44531 a[9] = pPager->nRead; 44614 a[9] = pPager->nRead; 44532 a[10] = pPager->nWrite; | 44615 a[10] = pPager->aStat[PAGER_STAT_WRITE]; 44533 return a; 44616 return a; 44534 } 44617 } 44535 #endif 44618 #endif 44536 44619 44537 /* 44620 /* 44538 ** Parameter eStat must be either SQLITE_DBSTATUS_CACHE_HIT or 44621 ** Parameter eStat must be either SQLITE_DBSTATUS_CACHE_HIT or 44539 ** SQLITE_DBSTATUS_CACHE_MISS. Before returning, *pnVal is incremented by the 44622 ** SQLITE_DBSTATUS_CACHE_MISS. Before returning, *pnVal is incremented by the 44540 ** current cache hit or miss count, according to the value of eStat. If the 44623 ** current cache hit or miss count, according to the value of eStat. If the 44541 ** reset parameter is non-zero, the cache hit or miss count is zeroed before 44624 ** reset parameter is non-zero, the cache hit or miss count is zeroed before 44542 ** returning. 44625 ** returning. 44543 */ 44626 */ 44544 SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, i 44627 SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, i 44545 int *piStat; < 44546 44628 44547 assert( eStat==SQLITE_DBSTATUS_CACHE_HIT 44629 assert( eStat==SQLITE_DBSTATUS_CACHE_HIT 44548 || eStat==SQLITE_DBSTATUS_CACHE_MISS 44630 || eStat==SQLITE_DBSTATUS_CACHE_MISS > 44631 || eStat==SQLITE_DBSTATUS_CACHE_WRITE 44549 ); 44632 ); 44550 if( eStat==SQLITE_DBSTATUS_CACHE_HIT ){ < 44551 piStat = &pPager->nHit; < 44552 }else{ < 44553 piStat = &pPager->nMiss; < 44554 } | 44633 > 44634 assert( SQLITE_DBSTATUS_CACHE_HIT+1==SQLITE_DBSTATUS_CACHE_MISS ); > 44635 assert( SQLITE_DBSTATUS_CACHE_HIT+2==SQLITE_DBSTATUS_CACHE_WRITE ); > 44636 assert( PAGER_STAT_HIT==0 && PAGER_STAT_MISS==1 && PAGER_STAT_WRITE==2 ); 44555 44637 44556 *pnVal += *piStat; | 44638 *pnVal += pPager->aStat[eStat - SQLITE_DBSTATUS_CACHE_HIT]; 44557 if( reset ){ 44639 if( reset ){ 44558 *piStat = 0; | 44640 pPager->aStat[eStat - SQLITE_DBSTATUS_CACHE_HIT] = 0; 44559 } 44641 } 44560 } 44642 } 44561 44643 44562 /* 44644 /* 44563 ** Return true if this is an in-memory pager. 44645 ** Return true if this is an in-memory pager. 44564 */ 44646 */ 44565 SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager *pPager){ 44647 SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager *pPager){ ................................................................................................................................................................................ 56149 /* Assert that the caller has been consistent. If this cursor was opened 56231 /* Assert that the caller has been consistent. If this cursor was opened 56150 ** expecting an index b-tree, then the caller should be inserting blob 56232 ** expecting an index b-tree, then the caller should be inserting blob 56151 ** keys with no associated data. If the cursor was opened expecting an 56233 ** keys with no associated data. If the cursor was opened expecting an 56152 ** intkey table, the caller should be inserting integer keys with a 56234 ** intkey table, the caller should be inserting integer keys with a 56153 ** blob of associated data. */ 56235 ** blob of associated data. */ 56154 assert( (pKey==0)==(pCur->pKeyInfo==0) ); 56236 assert( (pKey==0)==(pCur->pKeyInfo==0) ); 56155 56237 56156 /* If this is an insert into a table b-tree, invalidate any incrblob < 56157 ** cursors open on the row being replaced (assuming this is a replace < 56158 ** operation - if it is not, the following is a no-op). */ < 56159 if( pCur->pKeyInfo==0 ){ < 56160 invalidateIncrblobCursors(p, nKey, 0); < 56161 } < 56162 < 56163 /* Save the positions of any other cursors open on this table. 56238 /* Save the positions of any other cursors open on this table. 56164 ** 56239 ** 56165 ** In some cases, the call to btreeMoveto() below is a no-op. For 56240 ** In some cases, the call to btreeMoveto() below is a no-op. For 56166 ** example, when inserting data into a table with auto-generated integer 56241 ** example, when inserting data into a table with auto-generated integer 56167 ** keys, the VDBE layer invokes sqlite3BtreeLast() to figure out the 56242 ** keys, the VDBE layer invokes sqlite3BtreeLast() to figure out the 56168 ** integer key to use. It then calls this function to actually insert the 56243 ** integer key to use. It then calls this function to actually insert the 56169 ** data into the intkey B-Tree. In this case btreeMoveto() recognizes 56244 ** data into the intkey B-Tree. In this case btreeMoveto() recognizes 56170 ** that the cursor is already where it needs to be and returns without 56245 ** that the cursor is already where it needs to be and returns without 56171 ** doing any work. To avoid thwarting these optimizations, it is important 56246 ** doing any work. To avoid thwarting these optimizations, it is important 56172 ** not to clear the cursor here. 56247 ** not to clear the cursor here. 56173 */ 56248 */ 56174 rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur); 56249 rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur); 56175 if( rc ) return rc; 56250 if( rc ) return rc; > 56251 > 56252 /* If this is an insert into a table b-tree, invalidate any incrblob > 56253 ** cursors open on the row being replaced (assuming this is a replace > 56254 ** operation - if it is not, the following is a no-op). */ > 56255 if( pCur->pKeyInfo==0 ){ > 56256 invalidateIncrblobCursors(p, nKey, 0); > 56257 } > 56258 56176 if( !loc ){ 56259 if( !loc ){ 56177 rc = btreeMoveto(pCur, pKey, nKey, appendBias, &loc); 56260 rc = btreeMoveto(pCur, pKey, nKey, appendBias, &loc); 56178 if( rc ) return rc; 56261 if( rc ) return rc; 56179 } 56262 } 56180 assert( pCur->eState==CURSOR_VALID || (pCur->eState==CURSOR_INVALID && loc) ); 56263 assert( pCur->eState==CURSOR_VALID || (pCur->eState==CURSOR_INVALID && loc) ); 56181 56264 56182 pPage = pCur->apPage[pCur->iPage]; 56265 pPage = pCur->apPage[pCur->iPage]; ................................................................................................................................................................................ 56279 56362 56280 if( NEVER(pCur->aiIdx[pCur->iPage]>=pCur->apPage[pCur->iPage]->nCell) 56363 if( NEVER(pCur->aiIdx[pCur->iPage]>=pCur->apPage[pCur->iPage]->nCell) 56281 || NEVER(pCur->eState!=CURSOR_VALID) 56364 || NEVER(pCur->eState!=CURSOR_VALID) 56282 ){ 56365 ){ 56283 return SQLITE_ERROR; /* Something has gone awry. */ 56366 return SQLITE_ERROR; /* Something has gone awry. */ 56284 } 56367 } 56285 56368 56286 /* If this is a delete operation to remove a row from a table b-tree, < 56287 ** invalidate any incrblob cursors open on the row being deleted. */ < 56288 if( pCur->pKeyInfo==0 ){ < 56289 invalidateIncrblobCursors(p, pCur->info.nKey, 0); < 56290 } < 56291 < 56292 iCellDepth = pCur->iPage; 56369 iCellDepth = pCur->iPage; 56293 iCellIdx = pCur->aiIdx[iCellDepth]; 56370 iCellIdx = pCur->aiIdx[iCellDepth]; 56294 pPage = pCur->apPage[iCellDepth]; 56371 pPage = pCur->apPage[iCellDepth]; 56295 pCell = findCell(pPage, iCellIdx); 56372 pCell = findCell(pPage, iCellIdx); 56296 56373 56297 /* If the page containing the entry to delete is not a leaf page, move 56374 /* If the page containing the entry to delete is not a leaf page, move 56298 ** the cursor to the largest entry in the tree that is smaller than 56375 ** the cursor to the largest entry in the tree that is smaller than ................................................................................................................................................................................ 56310 /* Save the positions of any other cursors open on this table before 56387 /* Save the positions of any other cursors open on this table before 56311 ** making any modifications. Make the page containing the entry to be 56388 ** making any modifications. Make the page containing the entry to be 56312 ** deleted writable. Then free any overflow pages associated with the 56389 ** deleted writable. Then free any overflow pages associated with the 56313 ** entry and finally remove the cell itself from within the page. 56390 ** entry and finally remove the cell itself from within the page. 56314 */ 56391 */ 56315 rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur); 56392 rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur); 56316 if( rc ) return rc; 56393 if( rc ) return rc; > 56394 > 56395 /* If this is a delete operation to remove a row from a table b-tree, > 56396 ** invalidate any incrblob cursors open on the row being deleted. */ > 56397 if( pCur->pKeyInfo==0 ){ > 56398 invalidateIncrblobCursors(p, pCur->info.nKey, 0); > 56399 } > 56400 56317 rc = sqlite3PagerWrite(pPage->pDbPage); 56401 rc = sqlite3PagerWrite(pPage->pDbPage); 56318 if( rc ) return rc; 56402 if( rc ) return rc; 56319 rc = clearCell(pPage, pCell); 56403 rc = clearCell(pPage, pCell); 56320 dropCell(pPage, iCellIdx, cellSizePtr(pPage, pCell), &rc); 56404 dropCell(pPage, iCellIdx, cellSizePtr(pPage, pCell), &rc); 56321 if( rc ) return rc; 56405 if( rc ) return rc; 56322 56406 56323 /* If the cell deleted was not located on a leaf page, then the cursor 56407 /* If the cell deleted was not located on a leaf page, then the cursor ................................................................................................................................................................................ 56591 */ 56675 */ 56592 SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree *p, int iTable, int *pnChange){ 56676 SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree *p, int iTable, int *pnChange){ 56593 int rc; 56677 int rc; 56594 BtShared *pBt = p->pBt; 56678 BtShared *pBt = p->pBt; 56595 sqlite3BtreeEnter(p); 56679 sqlite3BtreeEnter(p); 56596 assert( p->inTrans==TRANS_WRITE ); 56680 assert( p->inTrans==TRANS_WRITE ); 56597 56681 > 56682 rc = saveAllCursors(pBt, (Pgno)iTable, 0); > 56683 > 56684 if( SQLITE_OK==rc ){ 56598 /* Invalidate all incrblob cursors open on table iTable (assuming iTable | 56685 /* Invalidate all incrblob cursors open on table iTable (assuming iTable 56599 ** is the root of a table b-tree - if it is not, the following call is | 56686 ** is the root of a table b-tree - if it is not, the following call is 56600 ** a no-op). */ | 56687 ** a no-op). */ 56601 invalidateIncrblobCursors(p, 0, 1); | 56688 invalidateIncrblobCursors(p, 0, 1); 56602 < 56603 rc = saveAllCursors(pBt, (Pgno)iTable, 0); < 56604 if( SQLITE_OK==rc ){ < 56605 rc = clearDatabasePage(pBt, (Pgno)iTable, 0, pnChange); 56689 rc = clearDatabasePage(pBt, (Pgno)iTable, 0, pnChange); 56606 } 56690 } 56607 sqlite3BtreeLeave(p); 56691 sqlite3BtreeLeave(p); 56608 return rc; 56692 return rc; 56609 } 56693 } 56610 56694 56611 /* 56695 /* ................................................................................................................................................................................ 58409 #endif 58493 #endif 58410 } 58494 } 58411 58495 58412 /* 58496 /* 58413 ** Make sure pMem->z points to a writable allocation of at least 58497 ** Make sure pMem->z points to a writable allocation of at least 58414 ** n bytes. 58498 ** n bytes. 58415 ** 58499 ** 58416 ** If the memory cell currently contains string or blob data < 58417 ** and the third argument passed to this function is true, the | 58500 ** If the third argument passed to this function is true, then memory > 58501 ** cell pMem must contain a string or blob. In this case the content is 58418 ** current content of the cell is preserved. Otherwise, it may | 58502 ** preserved. Otherwise, if the third parameter to this function is false, 58419 ** be discarded. | 58503 ** any current string or blob value may be discarded. 58420 ** 58504 ** 58421 ** This function sets the MEM_Dyn flag and clears any xDel callback. 58505 ** This function sets the MEM_Dyn flag and clears any xDel callback. 58422 ** It also clears MEM_Ephem and MEM_Static. If the preserve flag is 58506 ** It also clears MEM_Ephem and MEM_Static. If the preserve flag is 58423 ** not set, Mem.n is zeroed. 58507 ** not set, Mem.n is zeroed. 58424 */ 58508 */ 58425 SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve){ 58509 SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve){ 58426 assert( 1 >= 58510 assert( 1 >= 58427 ((pMem->zMalloc && pMem->zMalloc==pMem->z) ? 1 : 0) + 58511 ((pMem->zMalloc && pMem->zMalloc==pMem->z) ? 1 : 0) + 58428 (((pMem->flags&MEM_Dyn)&&pMem->xDel) ? 1 : 0) + 58512 (((pMem->flags&MEM_Dyn)&&pMem->xDel) ? 1 : 0) + 58429 ((pMem->flags&MEM_Ephem) ? 1 : 0) + 58513 ((pMem->flags&MEM_Ephem) ? 1 : 0) + 58430 ((pMem->flags&MEM_Static) ? 1 : 0) 58514 ((pMem->flags&MEM_Static) ? 1 : 0) 58431 ); 58515 ); 58432 assert( (pMem->flags&MEM_RowSet)==0 ); 58516 assert( (pMem->flags&MEM_RowSet)==0 ); > 58517 > 58518 /* If the preserve flag is set to true, then the memory cell must already > 58519 ** contain a valid string or blob value. */ > 58520 assert( preserve==0 || pMem->flags&(MEM_Blob|MEM_Str) ); 58433 58521 58434 if( n<32 ) n = 32; 58522 if( n<32 ) n = 32; 58435 if( sqlite3DbMallocSize(pMem->db, pMem->zMalloc)<n ){ 58523 if( sqlite3DbMallocSize(pMem->db, pMem->zMalloc)<n ){ 58436 if( preserve && pMem->z==pMem->zMalloc ){ 58524 if( preserve && pMem->z==pMem->zMalloc ){ 58437 pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n); 58525 pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n); 58438 preserve = 0; 58526 preserve = 0; 58439 }else{ 58527 }else{ ................................................................................................................................................................................ 60745 */ 60833 */ 60746 if( pOp->p4type==P4_SUBPROGRAM ){ 60834 if( pOp->p4type==P4_SUBPROGRAM ){ 60747 int nByte = (nSub+1)*sizeof(SubProgram*); 60835 int nByte = (nSub+1)*sizeof(SubProgram*); 60748 int j; 60836 int j; 60749 for(j=0; j<nSub; j++){ 60837 for(j=0; j<nSub; j++){ 60750 if( apSub[j]==pOp->p4.pProgram ) break; 60838 if( apSub[j]==pOp->p4.pProgram ) break; 60751 } 60839 } 60752 if( j==nSub && SQLITE_OK==sqlite3VdbeMemGrow(pSub, nByte, 1) ){ | 60840 if( j==nSub && SQLITE_OK==sqlite3VdbeMemGrow(pSub, nByte, nSub!=0) ){ 60753 apSub = (SubProgram **)pSub->z; 60841 apSub = (SubProgram **)pSub->z; 60754 apSub[nSub++] = pOp->p4.pProgram; 60842 apSub[nSub++] = pOp->p4.pProgram; 60755 pSub->flags |= MEM_Blob; 60843 pSub->flags |= MEM_Blob; 60756 pSub->n = nSub*sizeof(SubProgram*); 60844 pSub->n = nSub*sizeof(SubProgram*); 60757 } 60845 } 60758 } 60846 } 60759 } 60847 } ................................................................................................................................................................................ 66994 ** if the P4 argument is a P4_MEM use the value of the P4 argument as 67082 ** if the P4 argument is a P4_MEM use the value of the P4 argument as 66995 ** the result. 67083 ** the result. 66996 ** 67084 ** 66997 ** If the OPFLAG_CLEARCACHE bit is set on P5 and P1 is a pseudo-table cursor, 67085 ** If the OPFLAG_CLEARCACHE bit is set on P5 and P1 is a pseudo-table cursor, 66998 ** then the cache of the cursor is reset prior to extracting the column. 67086 ** then the cache of the cursor is reset prior to extracting the column. 66999 ** The first OP_Column against a pseudo-table after the value of the content 67087 ** The first OP_Column against a pseudo-table after the value of the content 67000 ** register has changed should have this bit set. 67088 ** register has changed should have this bit set. > 67089 ** > 67090 ** If the OPFLAG_LENGTHARG and OPFLAG_TYPEOFARG bits are set on P5 when > 67091 ** the result is guaranteed to only be used as the argument of a length() > 67092 ** or typeof() function, respectively. The loading of large blobs can be > 67093 ** skipped for length() and all content loading can be skipped for typeof(). 67001 */ 67094 */ 67002 case OP_Column: { 67095 case OP_Column: { 67003 #if 0 /* local variables moved into u.an */ 67096 #if 0 /* local variables moved into u.an */ 67004 u32 payloadSize; /* Number of bytes in the record */ 67097 u32 payloadSize; /* Number of bytes in the record */ 67005 i64 payloadSize64; /* Number of bytes in the record */ 67098 i64 payloadSize64; /* Number of bytes in the record */ 67006 int p1; /* P1 value of the opcode */ 67099 int p1; /* P1 value of the opcode */ 67007 int p2; /* column number to retrieve */ 67100 int p2; /* column number to retrieve */ ................................................................................................................................................................................ 67136 if( u.an.payloadSize <= (u32)u.an.avail ){ 67229 if( u.an.payloadSize <= (u32)u.an.avail ){ 67137 u.an.zRec = u.an.zData; 67230 u.an.zRec = u.an.zData; 67138 u.an.pC->aRow = (u8*)u.an.zData; 67231 u.an.pC->aRow = (u8*)u.an.zData; 67139 }else{ 67232 }else{ 67140 u.an.pC->aRow = 0; 67233 u.an.pC->aRow = 0; 67141 } 67234 } 67142 } 67235 } 67143 /* The following assert is true in all cases accept when | 67236 /* The following assert is true in all cases except when 67144 ** the database file has been corrupted externally. 67237 ** the database file has been corrupted externally. 67145 ** assert( u.an.zRec!=0 || u.an.avail>=u.an.payloadSize || u.an.avail>=9 67238 ** assert( u.an.zRec!=0 || u.an.avail>=u.an.payloadSize || u.an.avail>=9 67146 u.an.szHdr = getVarint32((u8*)u.an.zData, u.an.offset); 67239 u.an.szHdr = getVarint32((u8*)u.an.zData, u.an.offset); 67147 67240 67148 /* Make sure a corrupt database has not given us an oversize header. 67241 /* Make sure a corrupt database has not given us an oversize header. 67149 ** Do this now to avoid an oversize memory allocation. 67242 ** Do this now to avoid an oversize memory allocation. 67150 ** 67243 ** ................................................................................................................................................................................ 67211 u.an.szField = sqlite3VdbeSerialTypeLen(u.an.t); 67304 u.an.szField = sqlite3VdbeSerialTypeLen(u.an.t); 67212 u.an.offset += u.an.szField; 67305 u.an.offset += u.an.szField; 67213 if( u.an.offset<u.an.szField ){ /* True if u.an.offset overflows */ 67306 if( u.an.offset<u.an.szField ){ /* True if u.an.offset overflows */ 67214 u.an.zIdx = &u.an.zEndHdr[1]; /* Forces SQLITE_CORRUPT return below * 67307 u.an.zIdx = &u.an.zEndHdr[1]; /* Forces SQLITE_CORRUPT return below * 67215 break; 67308 break; 67216 } 67309 } 67217 }else{ 67310 }else{ 67218 /* If u.an.i is less that u.an.nField, then there are less fields in thi | 67311 /* If u.an.i is less that u.an.nField, then there are fewer fields in th 67219 ** record than SetNumColumns indicated there are columns in the 67312 ** record than SetNumColumns indicated there are columns in the 67220 ** table. Set the u.an.offset for any extra columns not present in 67313 ** table. Set the u.an.offset for any extra columns not present in 67221 ** the record to 0. This tells code below to store a NULL | 67314 ** the record to 0. This tells code below to store the default value 67222 ** instead of deserializing a value from the record. | 67315 ** for the column instead of deserializing a value from the record. 67223 */ 67316 */ 67224 u.an.aOffset[u.an.i] = 0; 67317 u.an.aOffset[u.an.i] = 0; 67225 } 67318 } 67226 } 67319 } 67227 sqlite3VdbeMemRelease(&u.an.sMem); 67320 sqlite3VdbeMemRelease(&u.an.sMem); 67228 u.an.sMem.flags = MEM_Null; 67321 u.an.sMem.flags = MEM_Null; 67229 67322 ................................................................................................................................................................................ 67245 ** then there are not enough fields in the record to satisfy the 67338 ** then there are not enough fields in the record to satisfy the 67246 ** request. In this case, set the value NULL or to P4 if P4 is 67339 ** request. In this case, set the value NULL or to P4 if P4 is 67247 ** a pointer to a Mem object. 67340 ** a pointer to a Mem object. 67248 */ 67341 */ 67249 if( u.an.aOffset[u.an.p2] ){ 67342 if( u.an.aOffset[u.an.p2] ){ 67250 assert( rc==SQLITE_OK ); 67343 assert( rc==SQLITE_OK ); 67251 if( u.an.zRec ){ 67344 if( u.an.zRec ){ > 67345 /* This is the common case where the whole row fits on a single page */ 67252 VdbeMemRelease(u.an.pDest); 67346 VdbeMemRelease(u.an.pDest); 67253 sqlite3VdbeSerialGet((u8 *)&u.an.zRec[u.an.aOffset[u.an.p2]], u.an.aType[u 67347 sqlite3VdbeSerialGet((u8 *)&u.an.zRec[u.an.aOffset[u.an.p2]], u.an.aType[u 67254 }else{ 67348 }else{ > 67349 /* This branch happens only when the row overflows onto multiple pages */ > 67350 u.an.t = u.an.aType[u.an.p2]; > 67351 if( (pOp->p5 & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG))!=0 > 67352 && ((u.an.t>=12 && (u.an.t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0) > 67353 ){ > 67354 /* Content is irrelevant for the typeof() function and for > 67355 ** the length(X) function if X is a blob. So we might as well use > 67356 ** bogus content rather than reading content from disk. NULL works > 67357 ** for text and blob and whatever is in the u.an.payloadSize64 variable > 67358 ** will work for everything else. */ > 67359 u.an.zData = u.an.t<12 ? (char*)&u.an.payloadSize64 : 0; > 67360 }else{ 67255 u.an.len = sqlite3VdbeSerialTypeLen(u.an.aType[u.an.p2]); | 67361 u.an.len = sqlite3VdbeSerialTypeLen(u.an.t); 67256 sqlite3VdbeMemMove(&u.an.sMem, u.an.pDest); | 67362 sqlite3VdbeMemMove(&u.an.sMem, u.an.pDest); 67257 rc = sqlite3VdbeMemFromBtree(u.an.pCrsr, u.an.aOffset[u.an.p2], u.an.len, | 67363 rc = sqlite3VdbeMemFromBtree(u.an.pCrsr, u.an.aOffset[u.an.p2], u.an.len > 67364 &u.an.sMem); 67258 if( rc!=SQLITE_OK ){ | 67365 if( rc!=SQLITE_OK ){ 67259 goto op_column_out; | 67366 goto op_column_out; 67260 } | 67367 } 67261 u.an.zData = u.an.sMem.z; | 67368 u.an.zData = u.an.sMem.z; > 67369 } 67262 sqlite3VdbeSerialGet((u8*)u.an.zData, u.an.aType[u.an.p2], u.an.pDest); | 67370 sqlite3VdbeSerialGet((u8*)u.an.zData, u.an.t, u.an.pDest); 67263 } 67371 } 67264 u.an.pDest->enc = encoding; 67372 u.an.pDest->enc = encoding; 67265 }else{ 67373 }else{ 67266 if( pOp->p4type==P4_MEM ){ 67374 if( pOp->p4type==P4_MEM ){ 67267 sqlite3VdbeMemShallowCopy(u.an.pDest, pOp->p4.pMem, MEM_Static); 67375 sqlite3VdbeMemShallowCopy(u.an.pDest, pOp->p4.pMem, MEM_Static); 67268 }else{ 67376 }else{ 67269 MemSetTypeFlag(u.an.pDest, MEM_Null); 67377 MemSetTypeFlag(u.an.pDest, MEM_Null); ................................................................................................................................................................................ 67591 p->rc = rc = SQLITE_BUSY; 67699 p->rc = rc = SQLITE_BUSY; 67592 goto vdbe_return; 67700 goto vdbe_return; 67593 } 67701 } 67594 db->isTransactionSavepoint = 0; 67702 db->isTransactionSavepoint = 0; 67595 rc = p->rc; 67703 rc = p->rc; 67596 }else{ 67704 }else{ 67597 u.ar.iSavepoint = db->nSavepoint - u.ar.iSavepoint - 1; 67705 u.ar.iSavepoint = db->nSavepoint - u.ar.iSavepoint - 1; > 67706 if( u.ar.p1==SAVEPOINT_ROLLBACK ){ 67598 for(u.ar.ii=0; u.ar.ii<db->nDb; u.ar.ii++){ | 67707 for(u.ar.ii=0; u.ar.ii<db->nDb; u.ar.ii++){ 67599 sqlite3BtreeTripAllCursors(db->aDb[u.ar.ii].pBt, SQLITE_ABORT); | 67708 sqlite3BtreeTripAllCursors(db->aDb[u.ar.ii].pBt, SQLITE_ABORT); > 67709 } 67600 } 67710 } 67601 for(u.ar.ii=0; u.ar.ii<db->nDb; u.ar.ii++){ 67711 for(u.ar.ii=0; u.ar.ii<db->nDb; u.ar.ii++){ 67602 rc = sqlite3BtreeSavepoint(db->aDb[u.ar.ii].pBt, u.ar.p1, u.ar.iSavepo 67712 rc = sqlite3BtreeSavepoint(db->aDb[u.ar.ii].pBt, u.ar.p1, u.ar.iSavepo 67603 if( rc!=SQLITE_OK ){ 67713 if( rc!=SQLITE_OK ){ 67604 goto abort_due_to_error; 67714 goto abort_due_to_error; 67605 } 67715 } 67606 } 67716 } ................................................................................................................................................................................ 74871 SQLITE_PRIVATE Expr *sqlite3PExpr( 74981 SQLITE_PRIVATE Expr *sqlite3PExpr( 74872 Parse *pParse, /* Parsing context */ 74982 Parse *pParse, /* Parsing context */ 74873 int op, /* Expression opcode */ 74983 int op, /* Expression opcode */ 74874 Expr *pLeft, /* Left operand */ 74984 Expr *pLeft, /* Left operand */ 74875 Expr *pRight, /* Right operand */ 74985 Expr *pRight, /* Right operand */ 74876 const Token *pToken /* Argument token */ 74986 const Token *pToken /* Argument token */ 74877 ){ 74987 ){ > 74988 Expr *p; > 74989 if( op==TK_AND && pLeft && pRight ){ > 74990 /* Take advantage of short-circuit false optimization for AND */ > 74991 p = sqlite3ExprAnd(pParse->db, pLeft, pRight); > 74992 }else{ 74878 Expr *p = sqlite3ExprAlloc(pParse->db, op, pToken, 1); | 74993 p = sqlite3ExprAlloc(pParse->db, op, pToken, 1); 74879 sqlite3ExprAttachSubtrees(pParse->db, p, pLeft, pRight); | 74994 sqlite3ExprAttachSubtrees(pParse->db, p, pLeft, pRight); > 74995 } 74880 if( p ) { 74996 if( p ) { 74881 sqlite3ExprCheckHeight(pParse, p->nHeight); 74997 sqlite3ExprCheckHeight(pParse, p->nHeight); 74882 } 74998 } 74883 return p; 74999 return p; 74884 } 75000 } > 75001 > 75002 /* > 75003 ** Return 1 if an expression must be FALSE in all cases and 0 if the > 75004 ** expression might be true. This is an optimization. If is OK to > 75005 ** return 0 here even if the expression really is always false (a > 75006 ** false negative). But it is a bug to return 1 if the expression > 75007 ** might be true in some rare circumstances (a false positive.) > 75008 ** > 75009 ** Note that if the expression is part of conditional for a > 75010 ** LEFT JOIN, then we cannot determine at compile-time whether or not > 75011 ** is it true or false, so always return 0. > 75012 */ > 75013 static int exprAlwaysFalse(Expr *p){ > 75014 int v = 0; > 75015 if( ExprHasProperty(p, EP_FromJoin) ) return 0; > 75016 if( !sqlite3ExprIsInteger(p, &v) ) return 0; > 75017 return v==0; > 75018 } 74885 75019 74886 /* 75020 /* 74887 ** Join two expressions using an AND operator. If either expression is 75021 ** Join two expressions using an AND operator. If either expression is 74888 ** NULL, then just return the other expression. 75022 ** NULL, then just return the other expression. > 75023 ** > 75024 ** If one side or the other of the AND is known to be false, then instead > 75025 ** of returning an AND expression, just return a constant expression with > 75026 ** a value of false. 74889 */ 75027 */ 74890 SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3 *db, Expr *pLeft, Expr *pRight){ 75028 SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3 *db, Expr *pLeft, Expr *pRight){ 74891 if( pLeft==0 ){ 75029 if( pLeft==0 ){ 74892 return pRight; 75030 return pRight; 74893 }else if( pRight==0 ){ 75031 }else if( pRight==0 ){ 74894 return pLeft; 75032 return pLeft; > 75033 }else if( exprAlwaysFalse(pLeft) || exprAlwaysFalse(pRight) ){ > 75034 sqlite3ExprDelete(db, pLeft); > 75035 sqlite3ExprDelete(db, pRight); > 75036 return sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[0], 0); 74895 }else{ 75037 }else{ 74896 Expr *pNew = sqlite3ExprAlloc(db, TK_AND, 0, 0); 75038 Expr *pNew = sqlite3ExprAlloc(db, TK_AND, 0, 0); 74897 sqlite3ExprAttachSubtrees(db, pNew, pLeft, pRight); 75039 sqlite3ExprAttachSubtrees(db, pNew, pLeft, pRight); 74898 return pNew; 75040 return pNew; 74899 } 75041 } 74900 } 75042 } 74901 75043 ................................................................................................................................................................................ 76419 /* First replace any existing entry. 76561 /* First replace any existing entry. 76420 ** 76562 ** 76421 ** Actually, the way the column cache is currently used, we are guaranteed 76563 ** Actually, the way the column cache is currently used, we are guaranteed 76422 ** that the object will never already be in cache. Verify this guarantee. 76564 ** that the object will never already be in cache. Verify this guarantee. 76423 */ 76565 */ 76424 #ifndef NDEBUG 76566 #ifndef NDEBUG 76425 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){ 76567 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){ 76426 #if 0 /* This code wold remove the entry from the cache if it existed */ < 76427 if( p->iReg && p->iTable==iTab && p->iColumn==iCol ){ < 76428 cacheEntryClear(pParse, p); < 76429 p->iLevel = pParse->iCacheLevel; < 76430 p->iReg = iReg; < 76431 p->lru = pParse->iCacheCnt++; < 76432 return; < 76433 } < 76434 #endif < 76435 assert( p->iReg==0 || p->iTable!=iTab || p->iColumn!=iCol ); 76568 assert( p->iReg==0 || p->iTable!=iTab || p->iColumn!=iCol ); 76436 } 76569 } 76437 #endif 76570 #endif 76438 76571 76439 /* Find an empty slot and replace it */ 76572 /* Find an empty slot and replace it */ 76440 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){ 76573 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){ 76441 if( p->iReg==0 ){ 76574 if( p->iReg==0 ){ ................................................................................................................................................................................ 76562 ** is called. If iColumn<0 then code is generated that extracts the rowid. 76695 ** is called. If iColumn<0 then code is generated that extracts the rowid. 76563 */ 76696 */ 76564 SQLITE_PRIVATE int sqlite3ExprCodeGetColumn( 76697 SQLITE_PRIVATE int sqlite3ExprCodeGetColumn( 76565 Parse *pParse, /* Parsing and code generating context */ 76698 Parse *pParse, /* Parsing and code generating context */ 76566 Table *pTab, /* Description of the table we are reading from */ 76699 Table *pTab, /* Description of the table we are reading from */ 76567 int iColumn, /* Index of the table column */ 76700 int iColumn, /* Index of the table column */ 76568 int iTable, /* The cursor pointing to the table */ 76701 int iTable, /* The cursor pointing to the table */ 76569 int iReg /* Store results here */ | 76702 int iReg, /* Store results here */ > 76703 u8 p5 /* P5 value for OP_Column */ 76570 ){ 76704 ){ 76571 Vdbe *v = pParse->pVdbe; 76705 Vdbe *v = pParse->pVdbe; 76572 int i; 76706 int i; 76573 struct yColCache *p; 76707 struct yColCache *p; 76574 76708 76575 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){ 76709 for(i=0, p=pParse->aColCache; i<SQLITE_N_COLCACHE; i++, p++){ 76576 if( p->iReg>0 && p->iTable==iTable && p->iColumn==iColumn ){ 76710 if( p->iReg>0 && p->iTable==iTable && p->iColumn==iColumn ){ ................................................................................................................................................................................ 76577 p->lru = pParse->iCacheCnt++; 76711 p->lru = pParse->iCacheCnt++; 76578 sqlite3ExprCachePinRegister(pParse, p->iReg); 76712 sqlite3ExprCachePinRegister(pParse, p->iReg); 76579 return p->iReg; 76713 return p->iReg; 76580 } 76714 } 76581 } 76715 } 76582 assert( v!=0 ); 76716 assert( v!=0 ); 76583 sqlite3ExprCodeGetColumnOfTable(v, pTab, iTable, iColumn, iReg); 76717 sqlite3ExprCodeGetColumnOfTable(v, pTab, iTable, iColumn, iReg); > 76718 if( p5 ){ > 76719 sqlite3VdbeChangeP5(v, p5); > 76720 }else{ 76584 sqlite3ExprCacheStore(pParse, iTable, iColumn, iReg); | 76721 sqlite3ExprCacheStore(pParse, iTable, iColumn, iReg); > 76722 } 76585 return iReg; 76723 return iReg; 76586 } 76724 } 76587 76725 76588 /* 76726 /* 76589 ** Clear all column cache entries. 76727 ** Clear all column cache entries. 76590 */ 76728 */ 76591 SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){ 76729 SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){ ................................................................................................................................................................................ 76705 case TK_COLUMN: { 76843 case TK_COLUMN: { 76706 if( pExpr->iTable<0 ){ 76844 if( pExpr->iTable<0 ){ 76707 /* This only happens when coding check constraints */ 76845 /* This only happens when coding check constraints */ 76708 assert( pParse->ckBase>0 ); 76846 assert( pParse->ckBase>0 ); 76709 inReg = pExpr->iColumn + pParse->ckBase; 76847 inReg = pExpr->iColumn + pParse->ckBase; 76710 }else{ 76848 }else{ 76711 inReg = sqlite3ExprCodeGetColumn(pParse, pExpr->pTab, 76849 inReg = sqlite3ExprCodeGetColumn(pParse, pExpr->pTab, 76712 pExpr->iColumn, pExpr->iTable, target); | 76850 pExpr->iColumn, pExpr->iTable, target, > 76851 pExpr->op2); 76713 } 76852 } 76714 break; 76853 break; 76715 } 76854 } 76716 case TK_INTEGER: { 76855 case TK_INTEGER: { 76717 codeInteger(pParse, pExpr, 0, target); 76856 codeInteger(pParse, pExpr, 0, target); 76718 break; 76857 break; 76719 } 76858 } ................................................................................................................................................................................ 76982 sqlite3VdbeResolveLabel(v, endCoalesce); 77121 sqlite3VdbeResolveLabel(v, endCoalesce); 76983 break; 77122 break; 76984 } 77123 } 76985 77124 76986 77125 76987 if( pFarg ){ 77126 if( pFarg ){ 76988 r1 = sqlite3GetTempRange(pParse, nFarg); 77127 r1 = sqlite3GetTempRange(pParse, nFarg); > 77128 > 77129 /* For length() and typeof() functions with a column argument, > 77130 ** set the P5 parameter to the OP_Column opcode to OPFLAG_LENGTHARG > 77131 ** or OPFLAG_TYPEOFARG respectively, to avoid unnecessary data > 77132 ** loading. > 77133 */ > 77134 if( (pDef->flags & (SQLITE_FUNC_LENGTH|SQLITE_FUNC_TYPEOF))!=0 ){ > 77135 u8 exprOp; > 77136 assert( nFarg==1 ); > 77137 assert( pFarg->a[0].pExpr!=0 ); > 77138 exprOp = pFarg->a[0].pExpr->op; > 77139 if( exprOp==TK_COLUMN || exprOp==TK_AGG_COLUMN ){ > 77140 assert( SQLITE_FUNC_LENGTH==OPFLAG_LENGTHARG ); > 77141 assert( SQLITE_FUNC_TYPEOF==OPFLAG_TYPEOFARG ); > 77142 testcase( pDef->flags==SQLITE_FUNC_LENGTH ); > 77143 pFarg->a[0].pExpr->op2 = pDef->flags; > 77144 } > 77145 } > 77146 76989 sqlite3ExprCachePush(pParse); /* Ticket 2ea2425d34be */ 77147 sqlite3ExprCachePush(pParse); /* Ticket 2ea2425d34be */ 76990 sqlite3ExprCodeExprList(pParse, pFarg, r1, 1); 77148 sqlite3ExprCodeExprList(pParse, pFarg, r1, 1); 76991 sqlite3ExprCachePop(pParse, 1); /* Ticket 2ea2425d34be */ 77149 sqlite3ExprCachePop(pParse, 1); /* Ticket 2ea2425d34be */ 76992 }else{ 77150 }else{ 76993 r1 = 0; 77151 r1 = 0; 76994 } 77152 } 76995 #ifndef SQLITE_OMIT_VIRTUALTABLE 77153 #ifndef SQLITE_OMIT_VIRTUALTABLE ................................................................................................................................................................................ 80187 sqlite3_stmt *pStmt = 0; /* An SQL statement being run */ 80345 sqlite3_stmt *pStmt = 0; /* An SQL statement being run */ 80188 char *zSql; /* Text of the SQL statement */ 80346 char *zSql; /* Text of the SQL statement */ 80189 Index *pPrevIdx = 0; /* Previous index in the loop */ 80347 Index *pPrevIdx = 0; /* Previous index in the loop */ 80190 int idx = 0; /* slot in pIdx->aSample[] for next sample */ 80348 int idx = 0; /* slot in pIdx->aSample[] for next sample */ 80191 int eType; /* Datatype of a sample */ 80349 int eType; /* Datatype of a sample */ 80192 IndexSample *pSample; /* A slot in pIdx->aSample[] */ 80350 IndexSample *pSample; /* A slot in pIdx->aSample[] */ 80193 80351 > 80352 assert( db->lookaside.bEnabled==0 ); 80194 if( !sqlite3FindTable(db, "sqlite_stat3", zDb) ){ 80353 if( !sqlite3FindTable(db, "sqlite_stat3", zDb) ){ 80195 return SQLITE_OK; 80354 return SQLITE_OK; 80196 } 80355 } 80197 80356 80198 zSql = sqlite3MPrintf(db, 80357 zSql = sqlite3MPrintf(db, 80199 "SELECT idx,count(*) FROM %Q.sqlite_stat3" 80358 "SELECT idx,count(*) FROM %Q.sqlite_stat3" 80200 " GROUP BY idx", zDb); 80359 " GROUP BY idx", zDb); ................................................................................................................................................................................ 80213 zIndex = (char *)sqlite3_column_text(pStmt, 0); 80372 zIndex = (char *)sqlite3_column_text(pStmt, 0); 80214 if( zIndex==0 ) continue; 80373 if( zIndex==0 ) continue; 80215 nSample = sqlite3_column_int(pStmt, 1); 80374 nSample = sqlite3_column_int(pStmt, 1); 80216 pIdx = sqlite3FindIndex(db, zIndex, zDb); 80375 pIdx = sqlite3FindIndex(db, zIndex, zDb); 80217 if( pIdx==0 ) continue; 80376 if( pIdx==0 ) continue; 80218 assert( pIdx->nSample==0 ); 80377 assert( pIdx->nSample==0 ); 80219 pIdx->nSample = nSample; 80378 pIdx->nSample = nSample; 80220 pIdx->aSample = sqlite3MallocZero( nSample*sizeof(IndexSample) ); | 80379 pIdx->aSample = sqlite3DbMallocZero(db, nSample*sizeof(IndexSample)); 80221 pIdx->avgEq = pIdx->aiRowEst[1]; 80380 pIdx->avgEq = pIdx->aiRowEst[1]; 80222 if( pIdx->aSample==0 ){ 80381 if( pIdx->aSample==0 ){ 80223 db->mallocFailed = 1; 80382 db->mallocFailed = 1; 80224 sqlite3_finalize(pStmt); 80383 sqlite3_finalize(pStmt); 80225 return SQLITE_NOMEM; 80384 return SQLITE_NOMEM; 80226 } 80385 } 80227 } 80386 } ................................................................................................................................................................................ 80286 sqlite3_column_text(pStmt, 4) 80445 sqlite3_column_text(pStmt, 4) 80287 ); 80446 ); 80288 int n = z ? sqlite3_column_bytes(pStmt, 4) : 0; 80447 int n = z ? sqlite3_column_bytes(pStmt, 4) : 0; 80289 pSample->nByte = n; 80448 pSample->nByte = n; 80290 if( n < 1){ 80449 if( n < 1){ 80291 pSample->u.z = 0; 80450 pSample->u.z = 0; 80292 }else{ 80451 }else{ 80293 pSample->u.z = sqlite3Malloc(n); | 80452 pSample->u.z = sqlite3DbMallocRaw(db, n); 80294 if( pSample->u.z==0 ){ 80453 if( pSample->u.z==0 ){ 80295 db->mallocFailed = 1; 80454 db->mallocFailed = 1; 80296 sqlite3_finalize(pStmt); 80455 sqlite3_finalize(pStmt); 80297 return SQLITE_NOMEM; 80456 return SQLITE_NOMEM; 80298 } 80457 } 80299 memcpy(pSample->u.z, z, n); 80458 memcpy(pSample->u.z, z, n); 80300 } 80459 } ................................................................................................................................................................................ 80362 sqlite3DbFree(db, zSql); 80521 sqlite3DbFree(db, zSql); 80363 } 80522 } 80364 80523 80365 80524 80366 /* Load the statistics from the sqlite_stat3 table. */ 80525 /* Load the statistics from the sqlite_stat3 table. */ 80367 #ifdef SQLITE_ENABLE_STAT3 80526 #ifdef SQLITE_ENABLE_STAT3 80368 if( rc==SQLITE_OK ){ 80527 if( rc==SQLITE_OK ){ > 80528 int lookasideEnabled = db->lookaside.bEnabled; > 80529 db->lookaside.bEnabled = 0; 80369 rc = loadStat3(db, sInfo.zDatabase); 80530 rc = loadStat3(db, sInfo.zDatabase); > 80531 db->lookaside.bEnabled = lookasideEnabled; 80370 } 80532 } 80371 #endif 80533 #endif 80372 80534 80373 if( rc==SQLITE_NOMEM ){ 80535 if( rc==SQLITE_NOMEM ){ 80374 db->mallocFailed = 1; 80536 db->mallocFailed = 1; 80375 } 80537 } 80376 return rc; 80538 return rc; ................................................................................................................................................................................ 81725 /* Delete the Table structure itself. 81887 /* Delete the Table structure itself. 81726 */ 81888 */ 81727 sqliteDeleteColumnNames(db, pTable); 81889 sqliteDeleteColumnNames(db, pTable); 81728 sqlite3DbFree(db, pTable->zName); 81890 sqlite3DbFree(db, pTable->zName); 81729 sqlite3DbFree(db, pTable->zColAff); 81891 sqlite3DbFree(db, pTable->zColAff); 81730 sqlite3SelectDelete(db, pTable->pSelect); 81892 sqlite3SelectDelete(db, pTable->pSelect); 81731 #ifndef SQLITE_OMIT_CHECK 81893 #ifndef SQLITE_OMIT_CHECK 81732 sqlite3ExprDelete(db, pTable->pCheck); | 81894 sqlite3ExprListDelete(db, pTable->pCheck); 81733 #endif 81895 #endif 81734 #ifndef SQLITE_OMIT_VIRTUALTABLE 81896 #ifndef SQLITE_OMIT_VIRTUALTABLE 81735 sqlite3VtabClear(db, pTable); 81897 sqlite3VtabClear(db, pTable); 81736 #endif 81898 #endif 81737 sqlite3DbFree(db, pTable); 81899 sqlite3DbFree(db, pTable); 81738 } 81900 } 81739 81901 ................................................................................................................................................................................ 82388 /* 82550 /* 82389 ** Add a new CHECK constraint to the table currently under construction. 82551 ** Add a new CHECK constraint to the table currently under construction. 82390 */ 82552 */ 82391 SQLITE_PRIVATE void sqlite3AddCheckConstraint( 82553 SQLITE_PRIVATE void sqlite3AddCheckConstraint( 82392 Parse *pParse, /* Parsing context */ 82554 Parse *pParse, /* Parsing context */ 82393 Expr *pCheckExpr /* The check expression */ 82555 Expr *pCheckExpr /* The check expression */ 82394 ){ 82556 ){ 82395 sqlite3 *db = pParse->db; < 82396 #ifndef SQLITE_OMIT_CHECK 82557 #ifndef SQLITE_OMIT_CHECK 82397 Table *pTab = pParse->pNewTable; 82558 Table *pTab = pParse->pNewTable; 82398 if( pTab && !IN_DECLARE_VTAB ){ 82559 if( pTab && !IN_DECLARE_VTAB ){ 82399 pTab->pCheck = sqlite3ExprAnd(db, pTab->pCheck, pCheckExpr); | 82560 pTab->pCheck = sqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr); > 82561 if( pParse->constraintName.n ){ > 82562 sqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1); > 82563 } 82400 }else 82564 }else 82401 #endif 82565 #endif 82402 { 82566 { 82403 sqlite3ExprDelete(db, pCheckExpr); | 82567 sqlite3ExprDelete(pParse->db, pCheckExpr); 82404 } 82568 } 82405 } 82569 } 82406 82570 82407 /* 82571 /* 82408 ** Set the collation function of the most recently parsed table column 82572 ** Set the collation function of the most recently parsed table column 82409 ** to the CollSeq given. 82573 ** to the CollSeq given. 82410 */ 82574 */ ................................................................................................................................................................................ 82666 82830 82667 #ifndef SQLITE_OMIT_CHECK 82831 #ifndef SQLITE_OMIT_CHECK 82668 /* Resolve names in all CHECK constraint expressions. 82832 /* Resolve names in all CHECK constraint expressions. 82669 */ 82833 */ 82670 if( p->pCheck ){ 82834 if( p->pCheck ){ 82671 SrcList sSrc; /* Fake SrcList for pParse->pNewTable */ 82835 SrcList sSrc; /* Fake SrcList for pParse->pNewTable */ 82672 NameContext sNC; /* Name context for pParse->pNewTable */ 82836 NameContext sNC; /* Name context for pParse->pNewTable */ > 82837 ExprList *pList; /* List of all CHECK constraints */ > 82838 int i; /* Loop counter */ 82673 82839 82674 memset(&sNC, 0, sizeof(sNC)); 82840 memset(&sNC, 0, sizeof(sNC)); 82675 memset(&sSrc, 0, sizeof(sSrc)); 82841 memset(&sSrc, 0, sizeof(sSrc)); 82676 sSrc.nSrc = 1; 82842 sSrc.nSrc = 1; 82677 sSrc.a[0].zName = p->zName; 82843 sSrc.a[0].zName = p->zName; 82678 sSrc.a[0].pTab = p; 82844 sSrc.a[0].pTab = p; 82679 sSrc.a[0].iCursor = -1; 82845 sSrc.a[0].iCursor = -1; 82680 sNC.pParse = pParse; 82846 sNC.pParse = pParse; 82681 sNC.pSrcList = &sSrc; 82847 sNC.pSrcList = &sSrc; 82682 sNC.isCheck = 1; 82848 sNC.isCheck = 1; > 82849 pList = p->pCheck; > 82850 for(i=0; i<pList->nExpr; i++){ 82683 if( sqlite3ResolveExprNames(&sNC, p->pCheck) ){ | 82851 if( sqlite3ResolveExprNames(&sNC, pList->a[i].pExpr) ){ 82684 return; | 82852 return; > 82853 } 82685 } 82854 } 82686 } 82855 } 82687 #endif /* !defined(SQLITE_OMIT_CHECK) */ 82856 #endif /* !defined(SQLITE_OMIT_CHECK) */ 82688 82857 82689 /* If the db->init.busy is 1 it means we are reading the SQL off the 82858 /* If the db->init.busy is 1 it means we are reading the SQL off the 82690 ** "sqlite_master" or "sqlite_temp_master" table on the disk. 82859 ** "sqlite_master" or "sqlite_temp_master" table on the disk. 82691 ** So do not write to the disk again. Extract the root page number 82860 ** So do not write to the disk again. Extract the root page number ................................................................................................................................................................................ 84228 } 84397 } 84229 84398 84230 exit_drop_index: 84399 exit_drop_index: 84231 sqlite3SrcListDelete(db, pName); 84400 sqlite3SrcListDelete(db, pName); 84232 } 84401 } 84233 84402 84234 /* 84403 /* 84235 ** pArray is a pointer to an array of objects. Each object in the | 84404 ** pArray is a pointer to an array of objects. Each object in the 84236 ** array is szEntry bytes in size. This routine allocates a new | 84405 ** array is szEntry bytes in size. This routine uses sqlite3DbRealloc() 84237 ** object on the end of the array. | 84406 ** to extend the array so that there is space for a new object at the end. 84238 ** 84407 ** 84239 ** *pnEntry is the number of entries already in use. *pnAlloc is | 84408 ** When this function is called, *pnEntry contains the current size of 84240 ** the previously allocated size of the array. initSize is the | 84409 ** the array (in entries - so the allocation is ((*pnEntry) * szEntry) bytes 84241 ** suggested initial array size allocation. | 84410 ** in total). 84242 ** 84411 ** 84243 ** The index of the new entry is returned in *pIdx. | 84412 ** If the realloc() is successful (i.e. if no OOM condition occurs), the > 84413 ** space allocated for the new object is zeroed, *pnEntry updated to > 84414 ** reflect the new size of the array and a pointer to the new allocation > 84415 ** returned. *pIdx is set to the index of the new array entry in this case. 84244 ** 84416 ** 84245 ** This routine returns a pointer to the array of objects. This < 84246 ** might be the same as the pArray parameter or it might be a different < 84247 ** pointer if the array was resized. < > 84417 ** Otherwise, if the realloc() fails, *pIdx is set to -1, *pnEntry remains > 84418 ** unchanged and a copy of pArray returned. 84248 */ 84419 */ 84249 SQLITE_PRIVATE void *sqlite3ArrayAllocate( 84420 SQLITE_PRIVATE void *sqlite3ArrayAllocate( 84250 sqlite3 *db, /* Connection to notify of malloc failures */ 84421 sqlite3 *db, /* Connection to notify of malloc failures */ 84251 void *pArray, /* Array of objects. Might be reallocated */ 84422 void *pArray, /* Array of objects. Might be reallocated */ 84252 int szEntry, /* Size of each object in the array */ 84423 int szEntry, /* Size of each object in the array */ 84253 int *pnEntry, /* Number of objects currently in use */ 84424 int *pnEntry, /* Number of objects currently in use */ 84254 int *pIdx /* Write the index of a new slot here */ 84425 int *pIdx /* Write the index of a new slot here */ ................................................................................................................................................................................ 85837 /* Collect rowids of every row to be deleted. 86008 /* Collect rowids of every row to be deleted. 85838 */ 86009 */ 85839 sqlite3VdbeAddOp2(v, OP_Null, 0, iRowSet); 86010 sqlite3VdbeAddOp2(v, OP_Null, 0, iRowSet); 85840 pWInfo = sqlite3WhereBegin( 86011 pWInfo = sqlite3WhereBegin( 85841 pParse, pTabList, pWhere, 0, 0, WHERE_DUPLICATES_OK 86012 pParse, pTabList, pWhere, 0, 0, WHERE_DUPLICATES_OK 85842 ); 86013 ); 85843 if( pWInfo==0 ) goto delete_from_cleanup; 86014 if( pWInfo==0 ) goto delete_from_cleanup; 85844 regRowid = sqlite3ExprCodeGetColumn(pParse, pTab, -1, iCur, iRowid); | 86015 regRowid = sqlite3ExprCodeGetColumn(pParse, pTab, -1, iCur, iRowid, 0); 85845 sqlite3VdbeAddOp2(v, OP_RowSetAdd, iRowSet, regRowid); 86016 sqlite3VdbeAddOp2(v, OP_RowSetAdd, iRowSet, regRowid); 85846 if( db->flags & SQLITE_CountRows ){ 86017 if( db->flags & SQLITE_CountRows ){ 85847 sqlite3VdbeAddOp2(v, OP_AddImm, memCnt, 1); 86018 sqlite3VdbeAddOp2(v, OP_AddImm, memCnt, 1); 85848 } 86019 } 85849 sqlite3WhereEnd(pWInfo); 86020 sqlite3WhereEnd(pWInfo); 85850 86021 85851 /* Delete every item whose key was written to the list during the 86022 /* Delete every item whose key was written to the list during the ................................................................................................................................................................................ 87657 FUNCTION(trim, 2, 3, 0, trimFunc ), 87828 FUNCTION(trim, 2, 3, 0, trimFunc ), 87658 FUNCTION(min, -1, 0, 1, minmaxFunc ), 87829 FUNCTION(min, -1, 0, 1, minmaxFunc ), 87659 FUNCTION(min, 0, 0, 1, 0 ), 87830 FUNCTION(min, 0, 0, 1, 0 ), 87660 AGGREGATE(min, 1, 0, 1, minmaxStep, minMaxFinalize ), 87831 AGGREGATE(min, 1, 0, 1, minmaxStep, minMaxFinalize ), 87661 FUNCTION(max, -1, 1, 1, minmaxFunc ), 87832 FUNCTION(max, -1, 1, 1, minmaxFunc ), 87662 FUNCTION(max, 0, 1, 1, 0 ), 87833 FUNCTION(max, 0, 1, 1, 0 ), 87663 AGGREGATE(max, 1, 1, 1, minmaxStep, minMaxFinalize ), 87834 AGGREGATE(max, 1, 1, 1, minmaxStep, minMaxFinalize ), 87664 FUNCTION(typeof, 1, 0, 0, typeofFunc ), | 87835 FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQLITE_FUNC_TYPEOF), 87665 FUNCTION(length, 1, 0, 0, lengthFunc ), | 87836 FUNCTION2(length, 1, 0, 0, lengthFunc, SQLITE_FUNC_LENGTH), 87666 FUNCTION(substr, 2, 0, 0, substrFunc ), 87837 FUNCTION(substr, 2, 0, 0, substrFunc ), 87667 FUNCTION(substr, 3, 0, 0, substrFunc ), 87838 FUNCTION(substr, 3, 0, 0, substrFunc ), 87668 FUNCTION(abs, 1, 0, 0, absFunc ), 87839 FUNCTION(abs, 1, 0, 0, absFunc ), 87669 #ifndef SQLITE_OMIT_FLOATING_POINT 87840 #ifndef SQLITE_OMIT_FLOATING_POINT 87670 FUNCTION(round, 1, 0, 0, roundFunc ), 87841 FUNCTION(round, 1, 0, 0, roundFunc ), 87671 FUNCTION(round, 2, 0, 0, roundFunc ), 87842 FUNCTION(round, 2, 0, 0, roundFunc ), 87672 #endif 87843 #endif 87673 FUNCTION(upper, 1, 0, 0, upperFunc ), 87844 FUNCTION(upper, 1, 0, 0, upperFunc ), 87674 FUNCTION(lower, 1, 0, 0, lowerFunc ), 87845 FUNCTION(lower, 1, 0, 0, lowerFunc ), 87675 FUNCTION(coalesce, 1, 0, 0, 0 ), 87846 FUNCTION(coalesce, 1, 0, 0, 0 ), 87676 FUNCTION(coalesce, 0, 0, 0, 0 ), 87847 FUNCTION(coalesce, 0, 0, 0, 0 ), 87677 /* FUNCTION(coalesce, -1, 0, 0, ifnullFunc ), */ | 87848 FUNCTION2(coalesce, -1, 0, 0, ifnullFunc, SQLITE_FUNC_COALESCE), 87678 {-1,SQLITE_UTF8,SQLITE_FUNC_COALESCE,0,0,ifnullFunc,0,0,"coalesce",0,0}, < 87679 FUNCTION(hex, 1, 0, 0, hexFunc ), 87849 FUNCTION(hex, 1, 0, 0, hexFunc ), 87680 /* FUNCTION(ifnull, 2, 0, 0, ifnullFunc ), */ | 87850 FUNCTION2(ifnull, 2, 0, 0, ifnullFunc, SQLITE_FUNC_COALESCE), 87681 {2,SQLITE_UTF8,SQLITE_FUNC_COALESCE,0,0,ifnullFunc,0,0,"ifnull",0,0}, < 87682 FUNCTION(random, 0, 0, 0, randomFunc ), 87851 FUNCTION(random, 0, 0, 0, randomFunc ), 87683 FUNCTION(randomblob, 1, 0, 0, randomBlob ), 87852 FUNCTION(randomblob, 1, 0, 0, randomBlob ), 87684 FUNCTION(nullif, 2, 0, 1, nullifFunc ), 87853 FUNCTION(nullif, 2, 0, 1, nullifFunc ), 87685 FUNCTION(sqlite_version, 0, 0, 0, versionFunc ), 87854 FUNCTION(sqlite_version, 0, 0, 0, versionFunc ), 87686 FUNCTION(sqlite_source_id, 0, 0, 0, sourceidFunc ), 87855 FUNCTION(sqlite_source_id, 0, 0, 0, sourceidFunc ), 87687 FUNCTION(sqlite_log, 2, 0, 0, errlogFunc ), 87856 FUNCTION(sqlite_log, 2, 0, 0, errlogFunc ), 87688 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS 87857 #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS ................................................................................................................................................................................ 90111 int nCol; /* Number of columns */ 90280 int nCol; /* Number of columns */ 90112 int onError; /* Conflict resolution strategy */ 90281 int onError; /* Conflict resolution strategy */ 90113 int j1; /* Addresss of jump instruction */ 90282 int j1; /* Addresss of jump instruction */ 90114 int j2 = 0, j3; /* Addresses of jump instructions */ 90283 int j2 = 0, j3; /* Addresses of jump instructions */ 90115 int regData; /* Register containing first data column */ 90284 int regData; /* Register containing first data column */ 90116 int iCur; /* Table cursor number */ 90285 int iCur; /* Table cursor number */ 90117 Index *pIdx; /* Pointer to one of the indices */ 90286 Index *pIdx; /* Pointer to one of the indices */ > 90287 sqlite3 *db; /* Database connection */ 90118 int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */ 90288 int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */ 90119 int regOldRowid = (rowidChng && isUpdate) ? rowidChng : regRowid; 90289 int regOldRowid = (rowidChng && isUpdate) ? rowidChng : regRowid; 90120 90290 > 90291 db = pParse->db; 90121 v = sqlite3GetVdbe(pParse); 90292 v = sqlite3GetVdbe(pParse); 90122 assert( v!=0 ); 90293 assert( v!=0 ); 90123 assert( pTab->pSelect==0 ); /* This table is not a VIEW */ 90294 assert( pTab->pSelect==0 ); /* This table is not a VIEW */ 90124 nCol = pTab->nCol; 90295 nCol = pTab->nCol; 90125 regData = regRowid + 1; 90296 regData = regRowid + 1; 90126 90297 90127 /* Test all NOT NULL constraints. 90298 /* Test all NOT NULL constraints. ................................................................................................................................................................................ 90146 case OE_Abort: 90317 case OE_Abort: 90147 sqlite3MayAbort(pParse); 90318 sqlite3MayAbort(pParse); 90148 case OE_Rollback: 90319 case OE_Rollback: 90149 case OE_Fail: { 90320 case OE_Fail: { 90150 char *zMsg; 90321 char *zMsg; 90151 sqlite3VdbeAddOp3(v, OP_HaltIfNull, 90322 sqlite3VdbeAddOp3(v, OP_HaltIfNull, 90152 SQLITE_CONSTRAINT, onError, regData+i); 90323 SQLITE_CONSTRAINT, onError, regData+i); 90153 zMsg = sqlite3MPrintf(pParse->db, "%s.%s may not be NULL", | 90324 zMsg = sqlite3MPrintf(db, "%s.%s may not be NULL", 90154 pTab->zName, pTab->aCol[i].zName); 90325 pTab->zName, pTab->aCol[i].zName); 90155 sqlite3VdbeChangeP4(v, -1, zMsg, P4_DYNAMIC); 90326 sqlite3VdbeChangeP4(v, -1, zMsg, P4_DYNAMIC); 90156 break; 90327 break; 90157 } 90328 } 90158 case OE_Ignore: { 90329 case OE_Ignore: { 90159 sqlite3VdbeAddOp2(v, OP_IsNull, regData+i, ignoreDest); 90330 sqlite3VdbeAddOp2(v, OP_IsNull, regData+i, ignoreDest); 90160 break; 90331 break; ................................................................................................................................................................................ 90168 } 90339 } 90169 } 90340 } 90170 } 90341 } 90171 90342 90172 /* Test all CHECK constraints 90343 /* Test all CHECK constraints 90173 */ 90344 */ 90174 #ifndef SQLITE_OMIT_CHECK 90345 #ifndef SQLITE_OMIT_CHECK 90175 if( pTab->pCheck && (pParse->db->flags & SQLITE_IgnoreChecks)==0 ){ | 90346 if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){ 90176 int allOk = sqlite3VdbeMakeLabel(v); | 90347 ExprList *pCheck = pTab->pCheck; 90177 pParse->ckBase = regData; 90348 pParse->ckBase = regData; 90178 sqlite3ExprIfTrue(pParse, pTab->pCheck, allOk, SQLITE_JUMPIFNULL); < 90179 onError = overrideError!=OE_Default ? overrideError : OE_Abort; 90349 onError = overrideError!=OE_Default ? overrideError : OE_Abort; > 90350 for(i=0; i<pCheck->nExpr; i++){ > 90351 int allOk = sqlite3VdbeMakeLabel(v); > 90352 sqlite3ExprIfTrue(pParse, pCheck->a[i].pExpr, allOk, SQLITE_JUMPIFNULL); 90180 if( onError==OE_Ignore ){ | 90353 if( onError==OE_Ignore ){ 90181 sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest); | 90354 sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest); 90182 }else{ | 90355 }else{ > 90356 char *zConsName = pCheck->a[i].zName; 90183 if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */ | 90357 if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */ > 90358 if( zConsName ){ > 90359 zConsName = sqlite3MPrintf(db, "constraint %s failed", zConsName); > 90360 }else{ > 90361 zConsName = 0; > 90362 } 90184 sqlite3HaltConstraint(pParse, onError, 0, 0); | 90363 sqlite3HaltConstraint(pParse, onError, zConsName, P4_DYNAMIC); 90185 } | 90364 } 90186 sqlite3VdbeResolveLabel(v, allOk); | 90365 sqlite3VdbeResolveLabel(v, allOk); > 90366 } 90187 } 90367 } 90188 #endif /* !defined(SQLITE_OMIT_CHECK) */ 90368 #endif /* !defined(SQLITE_OMIT_CHECK) */ 90189 90369 90190 /* If we have an INTEGER PRIMARY KEY, make sure the primary key 90370 /* If we have an INTEGER PRIMARY KEY, make sure the primary key 90191 ** of the new record does not previously exist. Except, if this 90371 ** of the new record does not previously exist. Except, if this 90192 ** is an UPDATE and the primary key is not changing, that is OK. 90372 ** is an UPDATE and the primary key is not changing, that is OK. 90193 */ 90373 */ ................................................................................................................................................................................ 90235 ** 90415 ** 90236 ** REPLACE INTO t(rowid) VALUES($newrowid) 90416 ** REPLACE INTO t(rowid) VALUES($newrowid) 90237 ** 90417 ** 90238 ** to run without a statement journal if there are no indexes on the 90418 ** to run without a statement journal if there are no indexes on the 90239 ** table. 90419 ** table. 90240 */ 90420 */ 90241 Trigger *pTrigger = 0; 90421 Trigger *pTrigger = 0; 90242 if( pParse->db->flags&SQLITE_RecTriggers ){ | 90422 if( db->flags&SQLITE_RecTriggers ){ 90243 pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0); 90423 pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0); 90244 } 90424 } 90245 if( pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0) ){ 90425 if( pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0) ){ 90246 sqlite3MultiWrite(pParse); 90426 sqlite3MultiWrite(pParse); 90247 sqlite3GenerateRowDelete( 90427 sqlite3GenerateRowDelete( 90248 pParse, pTab, baseCur, regRowid, 0, pTrigger, OE_Replace 90428 pParse, pTab, baseCur, regRowid, 0, pTrigger, OE_Replace 90249 ); 90429 ); ................................................................................................................................................................................ 90324 case OE_Fail: { 90504 case OE_Fail: { 90325 int j; 90505 int j; 90326 StrAccum errMsg; 90506 StrAccum errMsg; 90327 const char *zSep; 90507 const char *zSep; 90328 char *zErr; 90508 char *zErr; 90329 90509 90330 sqlite3StrAccumInit(&errMsg, 0, 0, 200); 90510 sqlite3StrAccumInit(&errMsg, 0, 0, 200); 90331 errMsg.db = pParse->db; | 90511 errMsg.db = db; 90332 zSep = pIdx->nColumn>1 ? "columns " : "column "; 90512 zSep = pIdx->nColumn>1 ? "columns " : "column "; 90333 for(j=0; j<pIdx->nColumn; j++){ 90513 for(j=0; j<pIdx->nColumn; j++){ 90334 char *zCol = pTab->aCol[pIdx->aiColumn[j]].zName; 90514 char *zCol = pTab->aCol[pIdx->aiColumn[j]].zName; 90335 sqlite3StrAccumAppend(&errMsg, zSep, -1); 90515 sqlite3StrAccumAppend(&errMsg, zSep, -1); 90336 zSep = ", "; 90516 zSep = ", "; 90337 sqlite3StrAccumAppend(&errMsg, zCol, -1); 90517 sqlite3StrAccumAppend(&errMsg, zCol, -1); 90338 } 90518 } ................................................................................................................................................................................ 90348 sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest); 90528 sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest); 90349 break; 90529 break; 90350 } 90530 } 90351 default: { 90531 default: { 90352 Trigger *pTrigger = 0; 90532 Trigger *pTrigger = 0; 90353 assert( onError==OE_Replace ); 90533 assert( onError==OE_Replace ); 90354 sqlite3MultiWrite(pParse); 90534 sqlite3MultiWrite(pParse); 90355 if( pParse->db->flags&SQLITE_RecTriggers ){ | 90535 if( db->flags&SQLITE_RecTriggers ){ 90356 pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0); 90536 pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0); 90357 } 90537 } 90358 sqlite3GenerateRowDelete( 90538 sqlite3GenerateRowDelete( 90359 pParse, pTab, baseCur, regR, 0, pTrigger, OE_Replace 90539 pParse, pTab, baseCur, regR, 0, pTrigger, OE_Replace 90360 ); 90540 ); 90361 seenReplace = 1; 90541 seenReplace = 1; 90362 break; 90542 break; ................................................................................................................................................................................ 90678 if( xferCompatibleIndex(pDestIdx, pSrcIdx) ) break; 90858 if( xferCompatibleIndex(pDestIdx, pSrcIdx) ) break; 90679 } 90859 } 90680 if( pSrcIdx==0 ){ 90860 if( pSrcIdx==0 ){ 90681 return 0; /* pDestIdx has no corresponding index in pSrc */ 90861 return 0; /* pDestIdx has no corresponding index in pSrc */ 90682 } 90862 } 90683 } 90863 } 90684 #ifndef SQLITE_OMIT_CHECK 90864 #ifndef SQLITE_OMIT_CHECK 90685 if( pDest->pCheck && sqlite3ExprCompare(pSrc->pCheck, pDest->pCheck) ){ | 90865 if( pDest->pCheck && sqlite3ExprListCompare(pSrc->pCheck, pDest->pCheck) ){ 90686 return 0; /* Tables have different CHECK constraints. Ticket #2252 */ 90866 return 0; /* Tables have different CHECK constraints. Ticket #2252 */ 90687 } 90867 } 90688 #endif 90868 #endif 90689 #ifndef SQLITE_OMIT_FOREIGN_KEY 90869 #ifndef SQLITE_OMIT_FOREIGN_KEY 90690 /* Disallow the transfer optimization if the destination table constains 90870 /* Disallow the transfer optimization if the destination table constains 90691 ** any foreign key constraints. This is more restrictive than necessary. 90871 ** any foreign key constraints. This is more restrictive than necessary. 90692 ** But the main beneficiary of the transfer optimization is the VACUUM 90872 ** But the main beneficiary of the transfer optimization is the VACUUM ................................................................................................................................................................................ 95751 int cnt; /* Index added to make the name unique */ 95931 int cnt; /* Index added to make the name unique */ 95752 Column *aCol, *pCol; /* For looping over result columns */ 95932 Column *aCol, *pCol; /* For looping over result columns */ 95753 int nCol; /* Number of columns in the result set */ 95933 int nCol; /* Number of columns in the result set */ 95754 Expr *p; /* Expression for a single result column */ 95934 Expr *p; /* Expression for a single result column */ 95755 char *zName; /* Column name */ 95935 char *zName; /* Column name */ 95756 int nName; /* Size of name in zName[] */ 95936 int nName; /* Size of name in zName[] */ 95757 95937 > 95938 if( pEList ){ 95758 *pnCol = nCol = pEList ? pEList->nExpr : 0; | 95939 nCol = pEList->nExpr; 95759 aCol = *paCol = sqlite3DbMallocZero(db, sizeof(aCol[0])*nCol); | 95940 aCol = sqlite3DbMallocZero(db, sizeof(aCol[0])*nCol); 95760 if( aCol==0 ) return SQLITE_NOMEM; | 95941 testcase( aCol==0 ); > 95942 }else{ > 95943 nCol = 0; > 95944 aCol = 0; > 95945 } > 95946 *pnCol = nCol; > 95947 *paCol = aCol; > 95948 95761 for(i=0, pCol=aCol; i<nCol; i++, pCol++){ 95949 for(i=0, pCol=aCol; i<nCol; i++, pCol++){ 95762 /* Get an appropriate name for the column 95950 /* Get an appropriate name for the column 95763 */ 95951 */ 95764 p = pEList->a[i].pExpr; 95952 p = pEList->a[i].pExpr; 95765 assert( p->pRight==0 || ExprHasProperty(p->pRight, EP_IntValue) 95953 assert( p->pRight==0 || ExprHasProperty(p->pRight, EP_IntValue) 95766 || p->pRight->u.zToken==0 || p->pRight->u.zToken[0]!=0 ); 95954 || p->pRight->u.zToken==0 || p->pRight->u.zToken[0]!=0 ); 95767 if( (zName = pEList->a[i].zName)!=0 ){ 95955 if( (zName = pEList->a[i].zName)!=0 ){ ................................................................................................................................................................................ 98721 for(i=0; i<sAggInfo.nColumn; i++){ 98909 for(i=0; i<sAggInfo.nColumn; i++){ 98722 struct AggInfo_col *pCol = &sAggInfo.aCol[i]; 98910 struct AggInfo_col *pCol = &sAggInfo.aCol[i]; 98723 if( pCol->iSorterColumn>=j ){ 98911 if( pCol->iSorterColumn>=j ){ 98724 int r1 = j + regBase; 98912 int r1 = j + regBase; 98725 int r2; 98913 int r2; 98726 98914 98727 r2 = sqlite3ExprCodeGetColumn(pParse, 98915 r2 = sqlite3ExprCodeGetColumn(pParse, 98728 pCol->pTab, pCol->iColumn, pCol->iTable, r1); | 98916 pCol->pTab, pCol->iColumn, pCol->iTable, r1, 0); 98729 if( r1!=r2 ){ 98917 if( r1!=r2 ){ 98730 sqlite3VdbeAddOp2(v, OP_SCopy, r2, r1); 98918 sqlite3VdbeAddOp2(v, OP_SCopy, r2, r1); 98731 } 98919 } 98732 j++; 98920 j++; 98733 } 98921 } 98734 } 98922 } 98735 regRecord = sqlite3GetTempReg(pParse); 98923 regRecord = sqlite3GetTempReg(pParse); ................................................................................................................................................................................ 103210 return 0; 103398 return 0; 103211 } 103399 } 103212 #ifdef SQLITE_EBCDIC 103400 #ifdef SQLITE_EBCDIC 103213 if( *pnoCase ) return 0; 103401 if( *pnoCase ) return 0; 103214 #endif 103402 #endif 103215 pList = pExpr->x.pList; 103403 pList = pExpr->x.pList; 103216 pLeft = pList->a[1].pExpr; 103404 pLeft = pList->a[1].pExpr; > 103405 if( pLeft->op!=TK_COLUMN 103217 if( pLeft->op!=TK_COLUMN || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT ){ | 103406 || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT > 103407 || IsVirtual(pLeft->pTab) > 103408 ){ 103218 /* IMP: R-02065-49465 The left-hand side of the LIKE or GLOB operator must 103409 /* IMP: R-02065-49465 The left-hand side of the LIKE or GLOB operator must 103219 ** be the name of an indexed column with TEXT affinity. */ 103410 ** be the name of an indexed column with TEXT affinity. */ 103220 return 0; 103411 return 0; 103221 } 103412 } 103222 assert( pLeft->iColumn!=(-1) ); /* Because IPK never has AFF_TEXT */ 103413 assert( pLeft->iColumn!=(-1) ); /* Because IPK never has AFF_TEXT */ 103223 103414 103224 pRight = pList->a[0].pExpr; 103415 pRight = pList->a[0].pExpr; ................................................................................................................................................................................ 106907 explainOneScan( 107098 explainOneScan( 106908 pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0 107099 pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0 106909 ); 107100 ); 106910 if( (wctrlFlags & WHERE_DUPLICATES_OK)==0 ){ 107101 if( (wctrlFlags & WHERE_DUPLICATES_OK)==0 ){ 106911 int iSet = ((ii==pOrWc->nTerm-1)?-1:ii); 107102 int iSet = ((ii==pOrWc->nTerm-1)?-1:ii); 106912 int r; 107103 int r; 106913 r = sqlite3ExprCodeGetColumn(pParse, pTabItem->pTab, -1, iCur, 107104 r = sqlite3ExprCodeGetColumn(pParse, pTabItem->pTab, -1, iCur, 106914 regRowid); | 107105 regRowid, 0); 106915 sqlite3VdbeAddOp4Int(v, OP_RowSetTest, regRowset, 107106 sqlite3VdbeAddOp4Int(v, OP_RowSetTest, regRowset, 106916 sqlite3VdbeCurrentAddr(v)+2, r, iSet); 107107 sqlite3VdbeCurrentAddr(v)+2, r, iSet); 106917 } 107108 } 106918 sqlite3VdbeAddOp2(v, OP_Gosub, regReturn, iLoopBody); 107109 sqlite3VdbeAddOp2(v, OP_Gosub, regReturn, iLoopBody); 106919 107110 106920 /* The pSubWInfo->untestedTerms flag means that this OR term 107111 /* The pSubWInfo->untestedTerms flag means that this OR term 106921 ** contained one or more AND term from a notReady table. The 107112 ** contained one or more AND term from a notReady table. The ................................................................................................................................................................................ 107820 108011 107821 /* 108012 /* 107822 ** An instance of this structure is used to store the LIKE, 108013 ** An instance of this structure is used to store the LIKE, 107823 ** GLOB, NOT LIKE, and NOT GLOB operators. 108014 ** GLOB, NOT LIKE, and NOT GLOB operators. 107824 */ 108015 */ 107825 struct LikeOp { 108016 struct LikeOp { 107826 Token eOperator; /* "like" or "glob" or "regexp" */ 108017 Token eOperator; /* "like" or "glob" or "regexp" */ 107827 int not; /* True if the NOT keyword is present */ | 108018 int bNot; /* True if the NOT keyword is present */ 107828 }; 108019 }; 107829 108020 107830 /* 108021 /* 107831 ** An instance of the following structure describes the event of a 108022 ** An instance of the following structure describes the event of a 107832 ** TRIGGER. "a" is the event type, one of TK_UPDATE, TK_INSERT, 108023 ** TRIGGER. "a" is the event type, one of TK_UPDATE, TK_INSERT, 107833 ** TK_DELETE, or TK_INSTEAD. If the event is of the form 108024 ** TK_DELETE, or TK_INSTEAD. If the event is of the form 107834 ** 108025 ** ................................................................................................................................................................................ 107999 #ifndef YYSTACKDEPTH 108190 #ifndef YYSTACKDEPTH 108000 #define YYSTACKDEPTH 100 108191 #define YYSTACKDEPTH 100 108001 #endif 108192 #endif 108002 #define sqlite3ParserARG_SDECL Parse *pParse; 108193 #define sqlite3ParserARG_SDECL Parse *pParse; 108003 #define sqlite3ParserARG_PDECL ,Parse *pParse 108194 #define sqlite3ParserARG_PDECL ,Parse *pParse 108004 #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse 108195 #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse 108005 #define sqlite3ParserARG_STORE yypParser->pParse = pParse 108196 #define sqlite3ParserARG_STORE yypParser->pParse = pParse 108006 #define YYNSTATE 629 | 108197 #define YYNSTATE 627 108007 #define YYNRULE 327 | 108198 #define YYNRULE 325 108008 #define YYFALLBACK 1 108199 #define YYFALLBACK 1 108009 #define YY_NO_ACTION (YYNSTATE+YYNRULE+2) 108200 #define YY_NO_ACTION (YYNSTATE+YYNRULE+2) 108010 #define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) 108201 #define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) 108011 #define YY_ERROR_ACTION (YYNSTATE+YYNRULE) 108202 #define YY_ERROR_ACTION (YYNSTATE+YYNRULE) 108012 108203 108013 /* The yyzerominor constant is used to initialize instances of 108204 /* The yyzerominor constant is used to initialize instances of 108014 ** YYMINORTYPE objects to zero. */ 108205 ** YYMINORTYPE objects to zero. */ ................................................................................................................................................................................ 108070 ** yy_action. Used to detect hash collisions. 108261 ** yy_action. Used to detect hash collisions. 108071 ** yy_shift_ofst[] For each state, the offset into yy_action for 108262 ** yy_shift_ofst[] For each state, the offset into yy_action for 108072 ** shifting terminals. 108263 ** shifting terminals. 108073 ** yy_reduce_ofst[] For each state, the offset into yy_action for 108264 ** yy_reduce_ofst[] For each state, the offset into yy_action for 108074 ** shifting non-terminals after a reduce. 108265 ** shifting non-terminals after a reduce. 108075 ** yy_default[] Default action for each state. 108266 ** yy_default[] Default action for each state. 108076 */ 108267 */ 108077 #define YY_ACTTAB_COUNT (1580) | 108268 #define YY_ACTTAB_COUNT (1561) 108078 static const YYACTIONTYPE yy_action[] = { 108269 static const YYACTIONTYPE yy_action[] = { 108079 /* 0 */ 310, 328, 574, 573, 15, 172, 187, 596, 56, 56, | 108270 /* 0 */ 310, 328, 573, 572, 15, 171, 185, 595, 56, 56, 108080 /* 10 */ 56, 56, 49, 54, 54, 54, 54, 53, 53, 52, 108271 /* 10 */ 56, 56, 49, 54, 54, 54, 54, 53, 53, 52, 108081 /* 20 */ 52, 52, 51, 234, 622, 621, 626, 622, 621, 299, | 108272 /* 20 */ 52, 52, 51, 233, 52, 52, 52, 51, 233, 624, 108082 /* 30 */ 589, 583, 56, 56, 56, 56, 236, 54, 54, 54, | 108273 /* 30 */ 588, 582, 56, 56, 56, 56, 314, 54, 54, 54, 108083 /* 40 */ 54, 53, 53, 52, 52, 52, 51, 234, 351, 57, | 108274 /* 40 */ 54, 53, 53, 52, 52, 52, 51, 233, 299, 57, 108084 /* 50 */ 58, 48, 581, 580, 582, 582, 55, 55, 56, 56, | 108275 /* 50 */ 58, 48, 580, 579, 581, 581, 55, 55, 56, 56, 108085 /* 60 */ 56, 56, 570, 54, 54, 54, 54, 53, 53, 52, | 108276 /* 60 */ 56, 56, 569, 54, 54, 54, 54, 53, 53, 52, 108086 /* 70 */ 52, 52, 51, 234, 310, 596, 326, 607, 233, 232, | 108277 /* 70 */ 52, 52, 51, 233, 310, 595, 326, 575, 663, 65, 108087 /* 80 */ 33, 54, 54, 54, 54, 53, 53, 52, 52, 52, 108278 /* 80 */ 33, 54, 54, 54, 54, 53, 53, 52, 52, 52, 108088 /* 90 */ 51, 234, 619, 618, 326, 619, 618, 166, 605, 492, | 108279 /* 90 */ 51, 233, 53, 53, 52, 52, 52, 51, 233, 489, 108089 /* 100 */ 381, 378, 377, 235, 589, 583, 554, 495, 1, 59, | 108280 /* 100 */ 663, 440, 663, 235, 588, 582, 553, 297, 363, 59, 108090 /* 110 */ 19, 376, 622, 621, 53, 53, 52, 52, 52, 51, | 108281 /* 110 */ 481, 67, 360, 1, 618, 351, 618, 620, 619, 207, 108091 /* 120 */ 234, 571, 571, 57, 58, 48, 581, 580, 582, 582, | 108282 /* 120 */ 6, 441, 442, 57, 58, 48, 580, 579, 581, 581, 108092 /* 130 */ 55, 55, 56, 56, 56, 56, 215, 54, 54, 54, | 108283 /* 130 */ 55, 55, 56, 56, 56, 56, 605, 54, 54, 54, 108093 /* 140 */ 54, 53, 53, 52, 52, 52, 51, 234, 310, 224, | 108284 /* 140 */ 54, 53, 53, 52, 52, 52, 51, 233, 310, 223, 108094 /* 150 */ 50, 47, 147, 177, 139, 281, 384, 276, 383, 169, | 108285 /* 150 */ 50, 47, 146, 598, 138, 281, 385, 276, 384, 168, 108095 /* 160 */ 408, 553, 578, 578, 622, 621, 272, 224, 439, 550, | 108286 /* 160 */ 489, 552, 620, 619, 620, 619, 272, 214, 440, 411, 108096 /* 170 */ 552, 410, 139, 281, 384, 276, 383, 169, 589, 583, | 108287 /* 170 */ 551, 604, 67, 165, 7, 618, 352, 353, 588, 582, 108097 /* 180 */ 619, 618, 280, 620, 272, 195, 413, 309, 440, 441, | 108288 /* 180 */ 443, 569, 192, 618, 414, 617, 616, 668, 441, 336, 108098 /* 190 */ 567, 491, 214, 279, 560, 600, 92, 57, 58, 48, | 108289 /* 190 */ 669, 62, 618, 599, 92, 382, 346, 57, 58, 48, 108099 /* 200 */ 581, 580, 582, 582, 55, 55, 56, 56, 56, 56, | 108290 /* 200 */ 580, 579, 581, 581, 55, 55, 56, 56, 56, 56, 108100 /* 210 */ 559, 54, 54, 54, 54, 53, 53, 52, 52, 52, | 108291 /* 210 */ 670, 54, 54, 54, 54, 53, 53, 52, 52, 52, 108101 /* 220 */ 51, 234, 310, 464, 233, 232, 558, 133, 519, 50, | 108292 /* 220 */ 51, 233, 310, 465, 232, 231, 373, 132, 514, 513, 108102 /* 230 */ 47, 147, 619, 618, 565, 436, 397, 515, 514, 518, | 108293 /* 230 */ 617, 616, 617, 616, 398, 437, 411, 66, 280, 388, 108103 /* 240 */ 410, 387, 438, 389, 437, 622, 621, 442, 570, 433, | 108294 /* 240 */ 411, 595, 439, 220, 438, 620, 619, 337, 569, 279, 108104 /* 250 */ 203, 390, 589, 583, 6, 413, 166, 670, 250, 381, | 108295 /* 250 */ 201, 414, 588, 582, 166, 414, 546, 167, 68, 234, 108105 /* 260 */ 378, 377, 525, 190, 600, 92, 594, 571, 571, 465, | 108296 /* 260 */ 599, 92, 620, 619, 599, 92, 19, 570, 570, 466, 108106 /* 270 */ 376, 57, 58, 48, 581, 580, 582, 582, 55, 55, | 108297 /* 270 */ 564, 57, 58, 48, 580, 579, 581, 581, 55, 55, 108107 /* 280 */ 56, 56, 56, 56, 599, 54, 54, 54, 54, 53, | 108298 /* 280 */ 56, 56, 56, 56, 598, 54, 54, 54, 54, 53, 108108 /* 290 */ 53, 52, 52, 52, 51, 234, 310, 592, 592, 592, | 108299 /* 290 */ 53, 52, 52, 52, 51, 233, 310, 411, 524, 232, 108109 /* 300 */ 490, 182, 247, 548, 249, 397, 273, 410, 7, 439, | 108300 /* 300 */ 231, 398, 593, 547, 559, 398, 348, 202, 175, 595, 108110 /* 310 */ 398, 606, 67, 619, 618, 620, 472, 256, 347, 255, | 108301 /* 310 */ 399, 315, 414, 617, 616, 387, 272, 255, 347, 254, 108111 /* 320 */ 473, 620, 413, 576, 620, 65, 589, 583, 236, 440, | 108302 /* 320 */ 558, 599, 74, 620, 619, 45, 588, 582, 235, 466, 108112 /* 330 */ 336, 600, 92, 68, 364, 192, 481, 622, 621, 547, | 108303 /* 330 */ 617, 616, 511, 591, 591, 591, 557, 578, 402, 545, 108113 /* 340 */ 622, 621, 560, 323, 207, 57, 58, 48, 581, 580, | 108304 /* 340 */ 600, 598, 570, 570, 601, 57, 58, 48, 580, 579, 108114 /* 350 */ 582, 582, 55, 55, 56, 56, 56, 56, 559, 54, | 108305 /* 350 */ 581, 581, 55, 55, 56, 56, 56, 56, 550, 54, 108115 /* 360 */ 54, 54, 54, 53, 53, 52, 52, 52, 51, 234, | 108306 /* 360 */ 54, 54, 54, 53, 53, 52, 52, 52, 51, 233, 108116 /* 370 */ 310, 410, 397, 146, 558, 531, 401, 348, 599, 166, | 108307 /* 370 */ 310, 309, 411, 145, 566, 490, 213, 255, 347, 254, 108117 /* 380 */ 248, 204, 381, 378, 377, 541, 413, 171, 337, 570, | 108308 /* 380 */ 196, 195, 194, 587, 586, 531, 600, 414, 235, 174, 108118 /* 390 */ 622, 621, 40, 376, 38, 600, 74, 465, 548, 490, | 108309 /* 390 */ 601, 617, 616, 411, 620, 619, 599, 91, 547, 574, 108119 /* 400 */ 589, 583, 532, 350, 579, 619, 618, 297, 619, 618, | 108310 /* 400 */ 588, 582, 50, 47, 146, 584, 583, 471, 414, 249, 108120 /* 410 */ 480, 67, 470, 39, 620, 599, 406, 574, 573, 57, | 108311 /* 410 */ 565, 542, 186, 39, 304, 424, 562, 599, 16, 57, 108121 /* 420 */ 58, 48, 581, 580, 582, 582, 55, 55, 56, 56, | 108312 /* 420 */ 58, 48, 580, 579, 581, 581, 55, 55, 56, 56, 108122 /* 430 */ 56, 56, 577, 54, 54, 54, 54, 53, 53, 52, | 108313 /* 430 */ 56, 56, 585, 54, 54, 54, 54, 53, 53, 52, 108123 /* 440 */ 52, 52, 51, 234, 310, 256, 347, 255, 530, 52, | 108314 /* 440 */ 52, 52, 51, 233, 310, 559, 290, 530, 529, 345, 108124 /* 450 */ 52, 52, 51, 234, 345, 564, 236, 386, 619, 618, | 108315 /* 450 */ 533, 576, 540, 246, 170, 248, 411, 396, 411, 422, 108125 /* 460 */ 957, 185, 418, 2, 408, 410, 578, 578, 198, 197, | 108316 /* 460 */ 199, 558, 617, 616, 165, 563, 50, 47, 146, 181, 108126 /* 470 */ 196, 499, 183, 167, 589, 583, 671, 570, 505, 506, | 108317 /* 470 */ 498, 414, 166, 414, 588, 582, 269, 557, 166, 518, 108127 /* 480 */ 413, 267, 601, 672, 546, 208, 602, 36, 601, 600, | 108318 /* 480 */ 599, 92, 599, 92, 561, 595, 469, 36, 173, 409, 108128 /* 490 */ 91, 468, 602, 57, 58, 48, 581, 580, 582, 582, | 108319 /* 490 */ 517, 577, 577, 57, 58, 48, 580, 579, 581, 581, 108129 /* 500 */ 55, 55, 56, 56, 56, 56, 202, 54, 54, 54, | 108320 /* 500 */ 55, 55, 56, 56, 56, 56, 338, 54, 54, 54, 108130 /* 510 */ 54, 53, 53, 52, 52, 52, 51, 234, 310, 599, | 108321 /* 510 */ 54, 53, 53, 52, 52, 52, 51, 233, 310, 304, 108131 /* 520 */ 157, 408, 527, 578, 578, 263, 490, 265, 410, 873, | 108322 /* 520 */ 423, 394, 526, 318, 869, 235, 167, 180, 473, 547, 108132 /* 530 */ 410, 474, 474, 366, 373, 410, 504, 428, 67, 290, | 108323 /* 530 */ 503, 247, 474, 381, 378, 377, 409, 351, 577, 577, 108133 /* 540 */ 599, 620, 352, 413, 408, 413, 578, 578, 589, 583, | 108324 /* 540 */ 409, 560, 577, 577, 376, 383, 364, 603, 588, 582, 108134 /* 550 */ 413, 382, 600, 92, 600, 16, 543, 62, 503, 600, | 108325 /* 550 */ 620, 619, 502, 595, 409, 494, 577, 577, 409, 266, 108135 /* 560 */ 92, 408, 346, 578, 578, 168, 45, 57, 58, 48, | 108326 /* 560 */ 577, 577, 421, 943, 422, 943, 198, 57, 58, 48, 108136 /* 570 */ 581, 580, 582, 582, 55, 55, 56, 56, 56, 56, | 108327 /* 570 */ 580, 579, 581, 581, 55, 55, 56, 56, 56, 56, 108137 /* 580 */ 200, 54, 54, 54, 54, 53, 53, 52, 52, 52, | 108328 /* 580 */ 315, 54, 54, 54, 54, 53, 53, 52, 52, 52, 108138 /* 590 */ 51, 234, 310, 393, 395, 534, 510, 617, 616, 615, | 108329 /* 590 */ 51, 233, 310, 390, 421, 942, 509, 942, 556, 145, 108139 /* 600 */ 318, 314, 172, 66, 596, 410, 338, 596, 324, 571, | 108330 /* 600 */ 598, 391, 324, 262, 549, 264, 411, 425, 407, 573, 108140 /* 610 */ 571, 50, 47, 147, 599, 629, 627, 330, 539, 315, | 108331 /* 610 */ 572, 12, 197, 143, 489, 50, 47, 146, 617, 616, 108141 /* 620 */ 413, 30, 589, 583, 272, 236, 199, 144, 176, 600, | 108332 /* 620 */ 206, 414, 588, 582, 547, 429, 67, 212, 143, 618, 108142 /* 630 */ 73, 420, 947, 620, 947, 420, 946, 351, 946, 175, | 108333 /* 630 */ 599, 73, 504, 505, 207, 434, 475, 475, 366, 425, 108143 /* 640 */ 596, 57, 58, 48, 581, 580, 582, 582, 55, 55, | 108334 /* 640 */ 35, 57, 58, 48, 580, 579, 581, 581, 55, 55, 108144 /* 650 */ 56, 56, 56, 56, 410, 54, 54, 54, 54, 53, | 108335 /* 650 */ 56, 56, 56, 56, 598, 54, 54, 54, 54, 53, 108145 /* 660 */ 53, 52, 52, 52, 51, 234, 310, 261, 410, 413, | 108336 /* 660 */ 53, 52, 52, 52, 51, 233, 310, 260, 598, 569, 108146 /* 670 */ 269, 208, 596, 363, 410, 596, 424, 360, 600, 69, | 108337 /* 670 */ 268, 615, 614, 613, 171, 411, 595, 11, 411, 350, 108147 /* 680 */ 424, 327, 620, 413, 50, 47, 147, 410, 358, 413, | 108338 /* 680 */ 411, 32, 618, 953, 183, 419, 2, 627, 625, 330, 108148 /* 690 */ 575, 553, 600, 94, 483, 509, 589, 583, 600, 97, | 108339 /* 690 */ 414, 352, 552, 414, 538, 414, 588, 582, 188, 599, 108149 /* 700 */ 552, 484, 413, 620, 188, 599, 551, 563, 596, 566, | 108340 /* 700 */ 69, 551, 599, 94, 599, 97, 374, 544, 166, 618, 108150 /* 710 */ 334, 600, 95, 205, 201, 57, 58, 48, 581, 580, | 108341 /* 710 */ 334, 359, 50, 47, 146, 57, 58, 48, 580, 579, 108151 /* 720 */ 582, 582, 55, 55, 56, 56, 56, 56, 352, 54, | 108342 /* 720 */ 581, 581, 55, 55, 56, 56, 56, 56, 411, 54, 108152 /* 730 */ 54, 54, 54, 53, 53, 52, 52, 52, 51, 234, | 108343 /* 730 */ 54, 54, 54, 53, 53, 52, 52, 52, 51, 233, 108153 /* 740 */ 310, 410, 261, 410, 167, 22, 356, 599, 359, 623, | 108344 /* 740 */ 310, 411, 129, 414, 595, 22, 273, 156, 411, 566, 108154 /* 750 */ 50, 47, 147, 548, 357, 562, 413, 620, 413, 332, | 108345 /* 750 */ 406, 213, 599, 95, 570, 570, 414, 327, 169, 332, 108155 /* 760 */ 523, 270, 410, 167, 620, 600, 104, 600, 103, 603, | 108346 /* 760 */ 411, 618, 536, 414, 358, 599, 104, 483, 508, 356, 108156 /* 770 */ 589, 583, 339, 539, 304, 423, 222, 413, 174, 304, | 108347 /* 770 */ 588, 582, 599, 103, 484, 414, 470, 357, 166, 618, 108157 /* 780 */ 422, 561, 567, 405, 214, 260, 600, 106, 620, 57, | 108348 /* 780 */ 626, 2, 204, 323, 599, 105, 40, 528, 38, 57, 108158 /* 790 */ 58, 48, 581, 580, 582, 582, 55, 55, 56, 56, | 108349 /* 790 */ 58, 48, 580, 579, 581, 581, 55, 55, 56, 56, 108159 /* 800 */ 56, 56, 410, 54, 54, 54, 54, 53, 53, 52, | 108350 /* 800 */ 56, 56, 411, 54, 54, 54, 54, 53, 53, 52, 108160 /* 810 */ 52, 52, 51, 234, 310, 410, 557, 413, 410, 421, | 108351 /* 810 */ 52, 52, 51, 233, 310, 411, 598, 414, 411, 260, 108161 /* 820 */ 273, 35, 512, 146, 421, 12, 600, 107, 213, 144, | 108352 /* 820 */ 273, 273, 273, 273, 426, 305, 599, 106, 520, 519, 108162 /* 830 */ 413, 410, 32, 413, 410, 620, 365, 353, 358, 600, | 108353 /* 830 */ 414, 411, 142, 414, 618, 618, 618, 618, 618, 599, 108163 /* 840 */ 134, 11, 600, 135, 589, 583, 413, 21, 548, 413, | 108354 /* 840 */ 133, 339, 599, 134, 588, 582, 414, 21, 30, 316, 108164 /* 850 */ 316, 148, 620, 620, 170, 600, 98, 223, 600, 102, | 108355 /* 850 */ 147, 459, 221, 170, 527, 599, 98, 222, 322, 321, 108165 /* 860 */ 374, 168, 167, 57, 58, 48, 581, 580, 582, 582, | 108356 /* 860 */ 320, 141, 259, 57, 58, 48, 580, 579, 581, 581, 108166 /* 870 */ 55, 55, 56, 56, 56, 56, 410, 54, 54, 54, | 108357 /* 870 */ 55, 55, 56, 56, 56, 56, 411, 54, 54, 54, 108167 /* 880 */ 54, 53, 53, 52, 52, 52, 51, 234, 310, 410, | 108358 /* 880 */ 54, 53, 53, 52, 52, 52, 51, 233, 310, 411, 108168 /* 890 */ 273, 413, 410, 273, 212, 469, 410, 167, 628, 2, | 108359 /* 890 */ 260, 414, 411, 458, 200, 35, 411, 358, 211, 228, 108169 /* 900 */ 600, 101, 545, 221, 413, 620, 130, 413, 620, 410, | 108360 /* 900 */ 599, 102, 468, 519, 414, 618, 28, 414, 538, 501, 108170 /* 910 */ 539, 413, 537, 600, 93, 315, 600, 100, 589, 583, | 108361 /* 910 */ 411, 414, 618, 599, 101, 358, 599, 93, 588, 582, 108171 /* 920 */ 600, 77, 425, 305, 413, 620, 254, 322, 599, 458, | 108362 /* 920 */ 599, 100, 522, 618, 427, 414, 306, 271, 598, 380, 108172 /* 930 */ 320, 171, 543, 600, 96, 521, 520, 57, 58, 48, | 108363 /* 930 */ 618, 602, 598, 452, 599, 77, 210, 57, 58, 48, 108173 /* 940 */ 581, 580, 582, 582, 55, 55, 56, 56, 56, 56, | 108364 /* 940 */ 580, 579, 581, 581, 55, 55, 56, 56, 56, 56, 108174 /* 950 */ 410, 54, 54, 54, 54, 53, 53, 52, 52, 52, | 108365 /* 950 */ 411, 54, 54, 54, 54, 53, 53, 52, 52, 52, 108175 /* 960 */ 51, 234, 310, 410, 273, 413, 410, 457, 358, 35, | 108366 /* 960 */ 51, 233, 310, 411, 621, 414, 411, 127, 609, 270, 108176 /* 970 */ 426, 230, 306, 319, 600, 138, 467, 520, 413, 620, | 108367 /* 970 */ 598, 365, 51, 233, 599, 96, 625, 330, 414, 618, 108177 /* 980 */ 143, 413, 410, 620, 410, 353, 529, 600, 137, 142, | 108368 /* 980 */ 126, 414, 411, 618, 411, 253, 608, 599, 137, 27, 108178 /* 990 */ 600, 136, 589, 583, 604, 261, 528, 413, 229, 413, | 108369 /* 990 */ 599, 136, 588, 582, 375, 260, 125, 414, 164, 414, 108179 /* 1000 */ 620, 321, 495, 28, 543, 543, 600, 76, 600, 90, | 108370 /* 1000 */ 371, 618, 279, 219, 542, 542, 599, 135, 599, 76, 108180 /* 1010 */ 620, 57, 46, 48, 581, 580, 582, 582, 55, 55, | 108371 /* 1010 */ 618, 57, 46, 48, 580, 579, 581, 581, 55, 55, 108181 /* 1020 */ 56, 56, 56, 56, 410, 54, 54, 54, 54, 53, | 108372 /* 1020 */ 56, 56, 56, 56, 411, 54, 54, 54, 54, 53, 108182 /* 1030 */ 53, 52, 52, 52, 51, 234, 310, 261, 451, 413, | 108373 /* 1030 */ 53, 52, 52, 52, 51, 233, 310, 411, 450, 414, 108183 /* 1040 */ 410, 211, 611, 285, 283, 610, 609, 502, 600, 89, | 108374 /* 1040 */ 411, 260, 542, 229, 285, 607, 479, 184, 599, 90, 108184 /* 1050 */ 380, 217, 620, 128, 140, 413, 220, 620, 410, 409, | 108375 /* 1050 */ 367, 122, 414, 476, 121, 414, 618, 170, 411, 353, 108185 /* 1060 */ 620, 620, 588, 587, 600, 75, 589, 583, 271, 620, | 108376 /* 1060 */ 618, 599, 89, 410, 599, 75, 588, 582, 472, 257, 108186 /* 1070 */ 51, 234, 127, 413, 620, 599, 627, 330, 27, 375, | 108377 /* 1070 */ 538, 120, 159, 414, 618, 14, 464, 158, 618, 157, 108187 /* 1080 */ 449, 279, 600, 88, 585, 584, 58, 48, 581, 580, | 108378 /* 1080 */ 461, 283, 599, 88, 449, 618, 58, 48, 580, 579, 108188 /* 1090 */ 582, 582, 55, 55, 56, 56, 56, 56, 410, 54, | 108379 /* 1090 */ 581, 581, 55, 55, 56, 56, 56, 56, 411, 54, 108189 /* 1100 */ 54, 54, 54, 53, 53, 52, 52, 52, 51, 234, | 108380 /* 1100 */ 54, 54, 54, 53, 53, 52, 52, 52, 51, 233, 108190 /* 1110 */ 310, 586, 410, 413, 410, 261, 593, 165, 399, 556, | 108381 /* 1110 */ 310, 411, 260, 414, 411, 592, 260, 118, 25, 400, 108191 /* 1120 */ 126, 371, 600, 87, 478, 186, 123, 413, 367, 413, | 108382 /* 1120 */ 10, 24, 599, 87, 117, 216, 414, 618, 349, 414, 108192 /* 1130 */ 620, 620, 410, 620, 620, 410, 600, 99, 600, 86, | 108383 /* 1130 */ 618, 618, 411, 319, 618, 599, 99, 555, 599, 86, 108193 /* 1140 */ 589, 583, 475, 122, 258, 171, 471, 413, 160, 121, | 108384 /* 1140 */ 588, 582, 4, 260, 457, 455, 115, 414, 251, 154, 108194 /* 1150 */ 413, 14, 159, 463, 25, 24, 600, 17, 448, 600, | 108385 /* 1150 */ 451, 108, 618, 110, 436, 448, 599, 17, 618, 218, 108195 /* 1160 */ 85, 48, 581, 580, 582, 582, 55, 55, 56, 56, | 108386 /* 1160 */ 107, 48, 580, 579, 581, 581, 55, 55, 56, 56, 108196 /* 1170 */ 56, 56, 158, 54, 54, 54, 54, 53, 53, 52, | 108387 /* 1170 */ 56, 56, 435, 54, 54, 54, 54, 53, 53, 52, 108197 /* 1180 */ 52, 52, 51, 234, 44, 404, 261, 3, 544, 261, | 108388 /* 1180 */ 52, 52, 51, 233, 44, 405, 217, 3, 411, 260, 108198 /* 1190 */ 540, 414, 621, 460, 119, 118, 538, 275, 10, 349, | 108389 /* 1190 */ 543, 415, 619, 445, 64, 149, 539, 237, 333, 329, 108199 /* 1200 */ 4, 620, 407, 620, 620, 620, 116, 44, 404, 410, | 108390 /* 1200 */ 203, 187, 408, 414, 618, 618, 420, 44, 405, 411, 108200 /* 1210 */ 3, 620, 620, 410, 414, 621, 456, 454, 252, 450, | 108391 /* 1210 */ 3, 618, 599, 85, 415, 619, 148, 227, 622, 179, 108201 /* 1220 */ 508, 402, 111, 109, 413, 407, 155, 444, 413, 447, | 108392 /* 1220 */ 313, 403, 312, 612, 414, 408, 611, 124, 417, 178, 108202 /* 1230 */ 435, 565, 219, 600, 84, 620, 108, 600, 83, 64, | 108393 /* 1230 */ 610, 564, 243, 599, 84, 537, 8, 176, 235, 416, 108203 /* 1240 */ 434, 417, 625, 150, 402, 333, 410, 237, 238, 124, | 108394 /* 1240 */ 294, 418, 623, 30, 403, 597, 411, 236, 293, 123, 108204 /* 1250 */ 274, 41, 42, 533, 565, 206, 189, 261, 43, 412, | 108395 /* 1250 */ 618, 41, 42, 532, 564, 205, 292, 275, 43, 413, 108205 /* 1260 */ 411, 413, 261, 594, 488, 620, 329, 149, 419, 268, | 108396 /* 1260 */ 412, 414, 395, 593, 507, 274, 31, 397, 291, 37, 108206 /* 1270 */ 600, 72, 620, 266, 41, 42, 181, 620, 410, 620, | 108397 /* 1270 */ 599, 83, 618, 491, 41, 42, 267, 411, 265, 618, 108207 /* 1280 */ 105, 43, 412, 411, 620, 624, 594, 614, 620, 599, | 108398 /* 1280 */ 618, 43, 413, 412, 596, 263, 593, 60, 618, 598, 108208 /* 1290 */ 228, 125, 313, 413, 592, 592, 592, 591, 590, 13, | 108399 /* 1290 */ 261, 618, 414, 618, 591, 591, 591, 590, 589, 13, 108209 /* 1300 */ 218, 410, 600, 71, 236, 244, 44, 404, 264, 3, | 108400 /* 1300 */ 618, 599, 72, 554, 235, 618, 44, 405, 256, 3, 108210 /* 1310 */ 312, 613, 340, 414, 621, 180, 413, 592, 592, 592, | 108401 /* 1310 */ 361, 172, 340, 415, 619, 230, 411, 591, 591, 591, 108211 /* 1320 */ 591, 590, 13, 620, 407, 600, 82, 410, 416, 34, | 108402 /* 1320 */ 590, 589, 13, 618, 408, 618, 182, 411, 286, 34, 108212 /* 1330 */ 404, 410, 3, 410, 262, 410, 414, 621, 612, 331, | 108403 /* 1330 */ 405, 414, 3, 411, 463, 411, 415, 619, 29, 331, 108213 /* 1340 */ 178, 415, 413, 402, 8, 236, 413, 407, 413, 620, | 108404 /* 1340 */ 599, 71, 414, 403, 392, 386, 284, 408, 414, 618, 108214 /* 1350 */ 413, 600, 81, 565, 257, 600, 80, 600, 70, 600, | 108405 /* 1350 */ 414, 599, 82, 564, 411, 462, 354, 599, 81, 599, 108215 /* 1360 */ 18, 598, 361, 462, 461, 30, 402, 294, 31, 620, | 108406 /* 1360 */ 80, 541, 250, 535, 282, 521, 403, 534, 516, 414, 108216 /* 1370 */ 293, 354, 251, 41, 42, 410, 565, 620, 620, 620, | 108407 /* 1370 */ 618, 618, 454, 41, 42, 411, 564, 618, 599, 70, 108217 /* 1380 */ 43, 412, 411, 453, 396, 594, 620, 620, 394, 61, | 108408 /* 1380 */ 43, 413, 412, 444, 515, 593, 242, 618, 325, 61, 108218 /* 1390 */ 413, 292, 443, 622, 621, 243, 41, 42, 620, 600, | 108409 /* 1390 */ 414, 277, 239, 620, 619, 238, 41, 42, 618, 599, 108219 /* 1400 */ 79, 597, 291, 43, 412, 411, 60, 620, 594, 240, | 108410 /* 1400 */ 18, 618, 512, 43, 413, 412, 511, 618, 593, 430, 108220 /* 1410 */ 620, 410, 231, 37, 555, 173, 592, 592, 592, 591, | 108411 /* 1410 */ 618, 411, 128, 510, 308, 226, 591, 591, 591, 590, 108221 /* 1420 */ 590, 13, 216, 239, 620, 184, 413, 302, 301, 300, | 108412 /* 1420 */ 589, 13, 215, 289, 618, 225, 414, 302, 301, 300, 108222 /* 1430 */ 179, 298, 388, 565, 452, 600, 78, 286, 620, 592, | 108413 /* 1430 */ 177, 298, 411, 564, 453, 599, 79, 224, 618, 591, 108223 /* 1440 */ 592, 592, 591, 590, 13, 429, 29, 413, 151, 289, | 108414 /* 1440 */ 591, 591, 590, 589, 13, 389, 492, 414, 150, 144, 108224 /* 1450 */ 242, 145, 392, 194, 193, 288, 600, 9, 542, 241, | 108415 /* 1450 */ 241, 393, 288, 191, 190, 193, 599, 78, 165, 240, 108225 /* 1460 */ 620, 525, 391, 284, 620, 594, 620, 620, 522, 536, | 108416 /* 1460 */ 414, 524, 487, 307, 618, 593, 618, 618, 486, 599, 108226 /* 1470 */ 620, 535, 153, 385, 465, 516, 282, 325, 154, 517, | 108417 /* 1470 */ 9, 163, 152, 485, 466, 372, 480, 162, 153, 370, 108227 /* 1480 */ 277, 152, 512, 511, 513, 129, 226, 308, 487, 486, | 108418 /* 1480 */ 161, 151, 209, 478, 258, 368, 477, 26, 160, 467, 108228 /* 1490 */ 485, 164, 372, 493, 307, 227, 592, 592, 592, 225, | 108419 /* 1490 */ 140, 362, 131, 119, 116, 456, 591, 591, 591, 155, 108229 /* 1500 */ 479, 163, 368, 370, 162, 476, 210, 477, 26, 259, | 108420 /* 1500 */ 114, 344, 343, 113, 112, 111, 447, 109, 130, 23, 108230 /* 1510 */ 161, 466, 362, 141, 132, 120, 117, 455, 156, 115, | 108421 /* 1510 */ 317, 433, 20, 432, 431, 428, 606, 594, 63, 189, 108231 /* 1520 */ 344, 343, 256, 342, 245, 114, 113, 446, 311, 112, | 108422 /* 1520 */ 404, 571, 255, 342, 244, 295, 287, 278, 311, 508, 108232 /* 1530 */ 23, 317, 432, 236, 131, 431, 110, 430, 20, 427, | 108423 /* 1530 */ 496, 497, 495, 235, 493, 568, 379, 355, 460, 245, 108233 /* 1540 */ 608, 595, 295, 63, 379, 287, 509, 191, 278, 403, | 108424 /* 1540 */ 341, 446, 303, 567, 5, 252, 548, 208, 139, 506, 108234 /* 1550 */ 572, 569, 497, 498, 496, 494, 335, 459, 445, 303, | 108425 /* 1550 */ 369, 401, 500, 499, 296, 525, 335, 488, 482, 523, 108235 /* 1560 */ 296, 246, 341, 355, 5, 568, 369, 507, 253, 549, | 108426 /* 1560 */ 233, 108236 /* 1570 */ 526, 209, 400, 501, 500, 524, 234, 958, 489, 482, < 108237 }; 108427 }; 108238 static const YYCODETYPE yy_lookahead[] = { 108428 static const YYCODETYPE yy_lookahead[] = { 108239 /* 0 */ 19, 169, 170, 171, 22, 24, 24, 26, 77, 78, 108429 /* 0 */ 19, 169, 170, 171, 22, 24, 24, 26, 77, 78, 108240 /* 10 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 108430 /* 10 */ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 108241 /* 20 */ 89, 90, 91, 92, 26, 27, 1, 26, 27, 15, | 108431 /* 20 */ 89, 90, 91, 92, 88, 89, 90, 91, 92, 1, 108242 /* 30 */ 49, 50, 77, 78, 79, 80, 116, 82, 83, 84, | 108432 /* 30 */ 49, 50, 77, 78, 79, 80, 155, 82, 83, 84, 108243 /* 40 */ 85, 86, 87, 88, 89, 90, 91, 92, 128, 68, | 108433 /* 40 */ 85, 86, 87, 88, 89, 90, 91, 92, 15, 68, 108244 /* 50 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 108434 /* 50 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 108245 /* 60 */ 79, 80, 230, 82, 83, 84, 85, 86, 87, 88, 108435 /* 60 */ 79, 80, 230, 82, 83, 84, 85, 86, 87, 88, 108246 /* 70 */ 89, 90, 91, 92, 19, 94, 19, 23, 86, 87, | 108436 /* 70 */ 89, 90, 91, 92, 19, 94, 19, 23, 1, 25, 108247 /* 80 */ 25, 82, 83, 84, 85, 86, 87, 88, 89, 90, 108437 /* 80 */ 25, 82, 83, 84, 85, 86, 87, 88, 89, 90, 108248 /* 90 */ 91, 92, 94, 95, 19, 94, 95, 96, 172, 173, < 108249 /* 100 */ 99, 100, 101, 197, 49, 50, 177, 181, 22, 54, < 108250 /* 110 */ 204, 110, 26, 27, 86, 87, 88, 89, 90, 91, | 108438 /* 90 */ 91, 92, 86, 87, 88, 89, 90, 91, 92, 150, > 108439 /* 100 */ 23, 150, 25, 116, 49, 50, 177, 158, 227, 54, > 108440 /* 110 */ 161, 162, 231, 22, 165, 128, 165, 26, 27, 160, 108251 /* 120 */ 92, 129, 130, 68, 69, 70, 71, 72, 73, 74, | 108441 /* 120 */ 22, 170, 171, 68, 69, 70, 71, 72, 73, 74, 108252 /* 130 */ 75, 76, 77, 78, 79, 80, 22, 82, 83, 84, | 108442 /* 130 */ 75, 76, 77, 78, 79, 80, 23, 82, 83, 84, 108253 /* 140 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 92, 108443 /* 140 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 92, 108254 /* 150 */ 221, 222, 223, 96, 97, 98, 99, 100, 101, 102, | 108444 /* 150 */ 221, 222, 223, 194, 97, 98, 99, 100, 101, 102, > 108445 /* 160 */ 150, 32, 26, 27, 26, 27, 109, 22, 150, 150, 108255 /* 160 */ 112, 32, 114, 115, 26, 27, 109, 92, 150, 25, | 108446 /* 170 */ 41, 161, 162, 96, 76, 165, 217, 150, 49, 50, 108256 /* 170 */ 41, 150, 97, 98, 99, 100, 101, 102, 49, 50, | 108447 /* 180 */ 229, 230, 172, 165, 165, 94, 95, 118, 170, 171, 108257 /* 180 */ 94, 95, 98, 165, 109, 25, 165, 163, 170, 171, | 108448 /* 190 */ 118, 232, 165, 174, 175, 185, 237, 68, 69, 70, 108258 /* 190 */ 166, 167, 168, 109, 12, 174, 175, 68, 69, 70, < 108259 /* 200 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 108449 /* 200 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 108260 /* 210 */ 28, 82, 83, 84, 85, 86, 87, 88, 89, 90, | 108450 /* 210 */ 118, 82, 83, 84, 85, 86, 87, 88, 89, 90, 108261 /* 220 */ 91, 92, 19, 11, 86, 87, 44, 24, 46, 221, | 108451 /* 220 */ 91, 92, 19, 11, 86, 87, 19, 24, 7, 8, 108262 /* 230 */ 222, 223, 94, 95, 66, 97, 215, 7, 8, 57, < > 108452 /* 230 */ 94, 95, 94, 95, 215, 97, 150, 22, 98, 220, 108263 /* 240 */ 150, 220, 104, 19, 106, 26, 27, 229, 230, 241, | 108453 /* 240 */ 150, 26, 104, 216, 106, 26, 27, 229, 230, 109, > 108454 /* 250 */ 160, 165, 49, 50, 25, 165, 120, 50, 22, 197, 108264 /* 250 */ 160, 27, 49, 50, 22, 165, 96, 118, 16, 99, | 108455 /* 260 */ 174, 175, 26, 27, 174, 175, 204, 129, 130, 57, 108265 /* 260 */ 100, 101, 94, 119, 174, 175, 98, 129, 130, 57, < 108266 /* 270 */ 110, 68, 69, 70, 71, 72, 73, 74, 75, 76, | 108456 /* 270 */ 66, 68, 69, 70, 71, 72, 73, 74, 75, 76, 108267 /* 280 */ 77, 78, 79, 80, 194, 82, 83, 84, 85, 86, 108457 /* 280 */ 77, 78, 79, 80, 194, 82, 83, 84, 85, 86, 108268 /* 290 */ 87, 88, 89, 90, 91, 92, 19, 129, 130, 131, | 108458 /* 290 */ 87, 88, 89, 90, 91, 92, 19, 150, 94, 86, > 108459 /* 300 */ 87, 215, 98, 25, 12, 215, 220, 160, 118, 94, 108269 /* 300 */ 150, 23, 60, 25, 62, 215, 150, 150, 76, 150, | 108460 /* 310 */ 220, 104, 165, 94, 95, 88, 109, 105, 106, 107, 108270 /* 310 */ 220, 161, 162, 94, 95, 165, 30, 105, 106, 107, | 108461 /* 320 */ 28, 174, 175, 26, 27, 22, 49, 50, 116, 57, 108271 /* 320 */ 34, 165, 165, 23, 165, 25, 49, 50, 116, 170, | 108462 /* 330 */ 94, 95, 103, 129, 130, 131, 44, 113, 46, 120, 108272 /* 330 */ 171, 174, 175, 22, 48, 185, 186, 26, 27, 120, < 108273 /* 340 */ 26, 27, 12, 187, 160, 68, 69, 70, 71, 72, | 108463 /* 340 */ 113, 194, 129, 130, 117, 68, 69, 70, 71, 72, 108274 /* 350 */ 73, 74, 75, 76, 77, 78, 79, 80, 28, 82, | 108464 /* 350 */ 73, 74, 75, 76, 77, 78, 79, 80, 177, 82, 108275 /* 360 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 108465 /* 360 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, > 108466 /* 370 */ 19, 163, 150, 95, 166, 167, 168, 105, 106, 107, 108276 /* 370 */ 19, 150, 215, 95, 44, 23, 46, 220, 194, 96, | 108467 /* 380 */ 105, 106, 107, 49, 50, 88, 113, 165, 116, 118, 108277 /* 380 */ 138, 160, 99, 100, 101, 23, 165, 25, 229, 230, | 108468 /* 390 */ 117, 94, 95, 150, 26, 27, 174, 175, 120, 23, 108278 /* 390 */ 26, 27, 135, 110, 137, 174, 175, 57, 120, 150, < 108279 /* 400 */ 49, 50, 88, 219, 113, 94, 95, 158, 94, 95, | 108469 /* 400 */ 49, 50, 221, 222, 223, 71, 72, 21, 165, 16, 108280 /* 410 */ 161, 162, 21, 136, 165, 194, 169, 170, 171, 68, < > 108470 /* 410 */ 23, 166, 22, 136, 22, 23, 11, 174, 175, 68, 108281 /* 420 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 108471 /* 420 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 108282 /* 430 */ 79, 80, 23, 82, 83, 84, 85, 86, 87, 88, | 108472 /* 430 */ 79, 80, 98, 82, 83, 84, 85, 86, 87, 88, 108283 /* 440 */ 89, 90, 91, 92, 19, 105, 106, 107, 23, 88, | 108473 /* 440 */ 89, 90, 91, 92, 19, 12, 224, 23, 23, 63, > 108474 /* 450 */ 205, 23, 23, 60, 25, 62, 150, 214, 150, 67, 108284 /* 450 */ 89, 90, 91, 92, 63, 23, 116, 88, 94, 95, | 108475 /* 460 */ 22, 28, 94, 95, 96, 23, 221, 222, 223, 23, 108285 /* 460 */ 142, 143, 144, 145, 112, 150, 114, 115, 105, 106, | 108476 /* 470 */ 23, 165, 25, 165, 49, 50, 23, 44, 25, 46, 108286 /* 470 */ 107, 23, 23, 25, 49, 50, 118, 230, 97, 98, | 108477 /* 480 */ 174, 175, 174, 175, 23, 26, 100, 136, 25, 112, 108287 /* 480 */ 165, 16, 113, 118, 120, 160, 117, 136, 113, 174, < 108288 /* 490 */ 175, 100, 117, 68, 69, 70, 71, 72, 73, 74, | 108478 /* 490 */ 57, 114, 115, 68, 69, 70, 71, 72, 73, 74, 108289 /* 500 */ 75, 76, 77, 78, 79, 80, 160, 82, 83, 84, | 108479 /* 500 */ 75, 76, 77, 78, 79, 80, 97, 82, 83, 84, 108290 /* 510 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 194, | 108480 /* 510 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 22, > 108481 /* 520 */ 23, 215, 23, 215, 138, 116, 50, 23, 30, 25, > 108482 /* 530 */ 36, 138, 34, 99, 100, 101, 112, 128, 114, 115, 108291 /* 520 */ 25, 112, 23, 114, 115, 60, 150, 62, 150, 138, | 108483 /* 540 */ 112, 23, 114, 115, 110, 51, 48, 173, 49, 50, 108292 /* 530 */ 150, 105, 106, 107, 19, 150, 36, 161, 162, 224, < 108293 /* 540 */ 194, 165, 217, 165, 112, 165, 114, 115, 49, 50, | 108484 /* 550 */ 26, 27, 58, 94, 112, 181, 114, 115, 112, 16, 108294 /* 550 */ 165, 51, 174, 175, 174, 175, 166, 232, 58, 174, | 108485 /* 560 */ 114, 115, 22, 23, 67, 25, 160, 68, 69, 70, 108295 /* 560 */ 175, 112, 237, 114, 115, 50, 22, 68, 69, 70, < 108296 /* 570 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 108486 /* 570 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 108297 /* 580 */ 160, 82, 83, 84, 85, 86, 87, 88, 89, 90, | 108487 /* 580 */ 104, 82, 83, 84, 85, 86, 87, 88, 89, 90, 108298 /* 590 */ 91, 92, 19, 215, 214, 205, 23, 7, 8, 9, | 108488 /* 590 */ 91, 92, 19, 19, 22, 23, 23, 25, 23, 95, > 108489 /* 600 */ 194, 27, 108, 60, 25, 62, 150, 67, 169, 170, 108299 /* 600 */ 215, 155, 24, 22, 26, 150, 97, 26, 108, 129, | 108490 /* 610 */ 171, 35, 206, 207, 150, 221, 222, 223, 94, 95, 108300 /* 610 */ 130, 221, 222, 223, 194, 0, 1, 2, 150, 104, | 108491 /* 620 */ 160, 165, 49, 50, 120, 161, 162, 206, 207, 165, 108301 /* 620 */ 165, 126, 49, 50, 109, 116, 206, 207, 118, 174, | 108492 /* 630 */ 174, 175, 97, 98, 160, 241, 105, 106, 107, 67, 108302 /* 630 */ 175, 22, 23, 165, 25, 22, 23, 128, 25, 118, < 108303 /* 640 */ 26, 68, 69, 70, 71, 72, 73, 74, 75, 76, | 108493 /* 640 */ 25, 68, 69, 70, 71, 72, 73, 74, 75, 76, 108304 /* 650 */ 77, 78, 79, 80, 150, 82, 83, 84, 85, 86, | 108494 /* 650 */ 77, 78, 79, 80, 194, 82, 83, 84, 85, 86, 108305 /* 660 */ 87, 88, 89, 90, 91, 92, 19, 150, 150, 165, | 108495 /* 660 */ 87, 88, 89, 90, 91, 92, 19, 150, 194, 230, > 108496 /* 670 */ 23, 7, 8, 9, 24, 150, 26, 35, 150, 219, 108306 /* 670 */ 23, 160, 94, 227, 150, 94, 67, 231, 174, 175, | 108497 /* 680 */ 150, 25, 165, 142, 143, 144, 145, 0, 1, 2, 108307 /* 680 */ 67, 213, 165, 165, 221, 222, 223, 150, 150, 165, | 108498 /* 690 */ 165, 217, 32, 165, 150, 165, 49, 50, 119, 174, 108308 /* 690 */ 23, 32, 174, 175, 181, 182, 49, 50, 174, 175, | 108499 /* 700 */ 175, 41, 174, 175, 174, 175, 23, 120, 25, 165, 108309 /* 700 */ 41, 188, 165, 165, 22, 194, 177, 11, 94, 23, < 108310 /* 710 */ 193, 174, 175, 160, 22, 68, 69, 70, 71, 72, | 108500 /* 710 */ 193, 237, 221, 222, 223, 68, 69, 70, 71, 72, 108311 /* 720 */ 73, 74, 75, 76, 77, 78, 79, 80, 217, 82, | 108501 /* 720 */ 73, 74, 75, 76, 77, 78, 79, 80, 150, 82, 108312 /* 730 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 108502 /* 730 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 108313 /* 740 */ 19, 150, 150, 150, 25, 24, 19, 194, 237, 150, | 108503 /* 740 */ 19, 150, 22, 165, 94, 24, 150, 25, 150, 166, > 108504 /* 750 */ 167, 168, 174, 175, 129, 130, 165, 213, 35, 242, 108314 /* 750 */ 221, 222, 223, 25, 27, 23, 165, 165, 165, 242, | 108505 /* 760 */ 150, 165, 27, 165, 150, 174, 175, 181, 182, 19, 108315 /* 760 */ 165, 23, 150, 25, 165, 174, 175, 174, 175, 174, < 108316 /* 770 */ 49, 50, 219, 150, 22, 23, 238, 165, 25, 22, | 108506 /* 770 */ 49, 50, 174, 175, 188, 165, 23, 27, 25, 165, 108317 /* 780 */ 23, 23, 166, 167, 168, 193, 174, 175, 165, 68, < > 108507 /* 780 */ 144, 145, 160, 187, 174, 175, 135, 23, 137, 68, 108318 /* 790 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 108508 /* 790 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 108319 /* 800 */ 79, 80, 150, 82, 83, 84, 85, 86, 87, 88, 108509 /* 800 */ 79, 80, 150, 82, 83, 84, 85, 86, 87, 88, 108320 /* 810 */ 89, 90, 91, 92, 19, 150, 23, 165, 150, 67, | 108510 /* 810 */ 89, 90, 91, 92, 19, 150, 194, 165, 150, 150, 108321 /* 820 */ 150, 25, 103, 95, 67, 35, 174, 175, 206, 207, < > 108511 /* 820 */ 150, 150, 150, 150, 247, 248, 174, 175, 190, 191, 108322 /* 830 */ 165, 150, 25, 165, 150, 165, 213, 150, 150, 174, | 108512 /* 830 */ 165, 150, 118, 165, 165, 165, 165, 165, 165, 174, 108323 /* 840 */ 175, 35, 174, 175, 49, 50, 165, 52, 120, 165, | 108513 /* 840 */ 175, 219, 174, 175, 49, 50, 165, 52, 126, 245, 108324 /* 850 */ 245, 246, 165, 165, 35, 174, 175, 187, 174, 175, < > 108514 /* 850 */ 246, 23, 238, 25, 23, 174, 175, 187, 187, 187, 108325 /* 860 */ 23, 50, 25, 68, 69, 70, 71, 72, 73, 74, | 108515 /* 860 */ 187, 39, 193, 68, 69, 70, 71, 72, 73, 74, 108326 /* 870 */ 75, 76, 77, 78, 79, 80, 150, 82, 83, 84, 108516 /* 870 */ 75, 76, 77, 78, 79, 80, 150, 82, 83, 84, 108327 /* 880 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 150, 108517 /* 880 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 150, 108328 /* 890 */ 150, 165, 150, 150, 160, 23, 150, 25, 144, 145, | 108518 /* 890 */ 150, 165, 150, 23, 160, 25, 150, 150, 160, 52, 108329 /* 900 */ 174, 175, 120, 216, 165, 165, 22, 165, 165, 150, | 108519 /* 900 */ 174, 175, 190, 191, 165, 165, 22, 165, 150, 29, 108330 /* 910 */ 150, 165, 27, 174, 175, 104, 174, 175, 49, 50, | 108520 /* 910 */ 150, 165, 165, 174, 175, 150, 174, 175, 49, 50, 108331 /* 920 */ 174, 175, 247, 248, 165, 165, 238, 187, 194, 23, | 108521 /* 920 */ 174, 175, 165, 165, 23, 165, 25, 25, 194, 52, 108332 /* 930 */ 187, 25, 166, 174, 175, 190, 191, 68, 69, 70, < > 108522 /* 930 */ 165, 174, 194, 193, 174, 175, 160, 68, 69, 70, 108333 /* 940 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 108523 /* 940 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 108334 /* 950 */ 150, 82, 83, 84, 85, 86, 87, 88, 89, 90, 108524 /* 950 */ 150, 82, 83, 84, 85, 86, 87, 88, 89, 90, 108335 /* 960 */ 91, 92, 19, 150, 150, 165, 150, 23, 150, 25, | 108525 /* 960 */ 91, 92, 19, 150, 150, 165, 150, 22, 150, 23, 108336 /* 970 */ 23, 205, 25, 213, 174, 175, 190, 191, 165, 165, < > 108526 /* 970 */ 194, 213, 91, 92, 174, 175, 1, 2, 165, 165, 108337 /* 980 */ 118, 165, 150, 165, 150, 150, 23, 174, 175, 39, | 108527 /* 980 */ 22, 165, 150, 165, 150, 238, 150, 174, 175, 22, 108338 /* 990 */ 174, 175, 49, 50, 173, 150, 23, 165, 52, 165, | 108528 /* 990 */ 174, 175, 49, 50, 52, 150, 22, 165, 102, 165, 108339 /* 1000 */ 165, 187, 181, 22, 166, 166, 174, 175, 174, 175, | 108529 /* 1000 */ 19, 165, 109, 238, 166, 166, 174, 175, 174, 175, 108340 /* 1010 */ 165, 68, 69, 70, 71, 72, 73, 74, 75, 76, 108530 /* 1010 */ 165, 68, 69, 70, 71, 72, 73, 74, 75, 76, 108341 /* 1020 */ 77, 78, 79, 80, 150, 82, 83, 84, 85, 86, 108531 /* 1020 */ 77, 78, 79, 80, 150, 82, 83, 84, 85, 86, 108342 /* 1030 */ 87, 88, 89, 90, 91, 92, 19, 150, 193, 165, 108532 /* 1030 */ 87, 88, 89, 90, 91, 92, 19, 150, 193, 165, 108343 /* 1040 */ 150, 160, 150, 205, 205, 150, 150, 29, 174, 175, | 108533 /* 1040 */ 150, 150, 166, 205, 205, 150, 20, 24, 174, 175, 108344 /* 1050 */ 52, 216, 165, 22, 150, 165, 238, 165, 150, 150, | 108534 /* 1050 */ 43, 104, 165, 59, 53, 165, 165, 25, 150, 150, 108345 /* 1060 */ 165, 165, 49, 50, 174, 175, 49, 50, 23, 165, | 108535 /* 1060 */ 165, 174, 175, 150, 174, 175, 49, 50, 53, 138, 108346 /* 1070 */ 91, 92, 22, 165, 165, 194, 1, 2, 22, 52, | 108536 /* 1070 */ 150, 22, 104, 165, 165, 5, 1, 118, 165, 35, 108347 /* 1080 */ 193, 109, 174, 175, 71, 72, 69, 70, 71, 72, | 108537 /* 1080 */ 27, 205, 174, 175, 193, 165, 69, 70, 71, 72, 108348 /* 1090 */ 73, 74, 75, 76, 77, 78, 79, 80, 150, 82, 108538 /* 1090 */ 73, 74, 75, 76, 77, 78, 79, 80, 150, 82, 108349 /* 1100 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 108539 /* 1100 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 108350 /* 1110 */ 19, 98, 150, 165, 150, 150, 150, 102, 150, 150, | 108540 /* 1110 */ 19, 150, 150, 165, 150, 150, 150, 108, 76, 150, 108351 /* 1120 */ 22, 19, 174, 175, 20, 24, 104, 165, 43, 165, | 108541 /* 1120 */ 22, 76, 174, 175, 127, 216, 165, 165, 25, 165, 108352 /* 1130 */ 165, 165, 150, 165, 165, 150, 174, 175, 174, 175, | 108542 /* 1130 */ 165, 165, 150, 213, 165, 174, 175, 150, 174, 175, 108353 /* 1140 */ 49, 50, 59, 53, 138, 25, 53, 165, 104, 22, | 108543 /* 1140 */ 49, 50, 22, 150, 23, 1, 119, 165, 16, 121, 108354 /* 1150 */ 165, 5, 118, 1, 76, 76, 174, 175, 193, 174, | 108544 /* 1150 */ 20, 108, 165, 119, 23, 193, 174, 175, 165, 193, 108355 /* 1160 */ 175, 70, 71, 72, 73, 74, 75, 76, 77, 78, | 108545 /* 1160 */ 127, 70, 71, 72, 73, 74, 75, 76, 77, 78, 108356 /* 1170 */ 79, 80, 35, 82, 83, 84, 85, 86, 87, 88, | 108546 /* 1170 */ 79, 80, 23, 82, 83, 84, 85, 86, 87, 88, 108357 /* 1180 */ 89, 90, 91, 92, 19, 20, 150, 22, 150, 150, | 108547 /* 1180 */ 89, 90, 91, 92, 19, 20, 193, 22, 150, 150, 108358 /* 1190 */ 150, 26, 27, 27, 108, 127, 150, 150, 22, 25, | 108548 /* 1190 */ 150, 26, 27, 128, 16, 15, 150, 140, 65, 3, 108359 /* 1200 */ 22, 165, 37, 165, 165, 165, 119, 19, 20, 150, | 108549 /* 1200 */ 164, 22, 37, 165, 165, 165, 4, 19, 20, 150, 108360 /* 1210 */ 22, 165, 165, 150, 26, 27, 23, 1, 16, 20, | 108550 /* 1210 */ 22, 165, 174, 175, 26, 27, 246, 180, 149, 6, 108361 /* 1220 */ 150, 56, 119, 108, 165, 37, 121, 128, 165, 193, | 108551 /* 1220 */ 249, 56, 249, 149, 165, 37, 149, 180, 149, 151, 108362 /* 1230 */ 23, 66, 193, 174, 175, 165, 127, 174, 175, 16, | 108552 /* 1230 */ 13, 66, 193, 174, 175, 150, 25, 151, 116, 159, 108363 /* 1240 */ 23, 146, 147, 15, 56, 65, 150, 152, 140, 154, | 108553 /* 1240 */ 199, 146, 147, 126, 56, 194, 150, 152, 200, 154, 108364 /* 1250 */ 150, 86, 87, 88, 66, 160, 22, 150, 93, 94, | 108554 /* 1250 */ 165, 86, 87, 88, 66, 160, 201, 150, 93, 94, 108365 /* 1260 */ 95, 165, 150, 98, 150, 165, 3, 246, 4, 150, | 108555 /* 1260 */ 95, 165, 123, 98, 150, 150, 124, 122, 202, 135, 108366 /* 1270 */ 174, 175, 165, 150, 86, 87, 6, 165, 150, 165, | 108556 /* 1270 */ 174, 175, 165, 150, 86, 87, 150, 150, 150, 165, 108367 /* 1280 */ 164, 93, 94, 95, 165, 149, 98, 149, 165, 194, | 108557 /* 1280 */ 165, 93, 94, 95, 203, 150, 98, 125, 165, 194, 108368 /* 1290 */ 180, 180, 249, 165, 129, 130, 131, 132, 133, 134, | 108558 /* 1290 */ 150, 165, 165, 165, 129, 130, 131, 132, 133, 134, 108369 /* 1300 */ 193, 150, 174, 175, 116, 193, 19, 20, 150, 22, | 108559 /* 1300 */ 165, 174, 175, 157, 116, 165, 19, 20, 150, 22, 108370 /* 1310 */ 249, 149, 217, 26, 27, 151, 165, 129, 130, 131, | 108560 /* 1310 */ 150, 118, 217, 26, 27, 225, 150, 129, 130, 131, 108371 /* 1320 */ 132, 133, 134, 165, 37, 174, 175, 150, 149, 19, | 108561 /* 1320 */ 132, 133, 134, 165, 37, 165, 157, 150, 210, 19, 108372 /* 1330 */ 20, 150, 22, 150, 150, 150, 26, 27, 13, 244, | 108562 /* 1330 */ 20, 165, 22, 150, 150, 150, 26, 27, 104, 244, 108373 /* 1340 */ 151, 159, 165, 56, 25, 116, 165, 37, 165, 165, | 108563 /* 1340 */ 174, 175, 165, 56, 121, 104, 210, 37, 165, 165, 108374 /* 1350 */ 165, 174, 175, 66, 150, 174, 175, 174, 175, 174, | 108564 /* 1350 */ 165, 174, 175, 66, 150, 150, 150, 174, 175, 174, 108375 /* 1360 */ 175, 194, 150, 150, 150, 126, 56, 199, 124, 165, | 108565 /* 1360 */ 175, 211, 150, 211, 210, 176, 56, 211, 176, 165, 108376 /* 1370 */ 200, 150, 150, 86, 87, 150, 66, 165, 165, 165, | 108566 /* 1370 */ 165, 165, 150, 86, 87, 150, 66, 165, 174, 175, 108377 /* 1380 */ 93, 94, 95, 150, 122, 98, 165, 165, 123, 22, | 108567 /* 1380 */ 93, 94, 95, 150, 184, 98, 150, 165, 47, 22, 108378 /* 1390 */ 165, 201, 150, 26, 27, 150, 86, 87, 165, 174, | 108568 /* 1390 */ 165, 176, 150, 26, 27, 150, 86, 87, 165, 174, 108379 /* 1400 */ 175, 203, 202, 93, 94, 95, 125, 165, 98, 150, | 108569 /* 1400 */ 175, 165, 178, 93, 94, 95, 103, 165, 98, 150, 108380 /* 1410 */ 165, 150, 225, 135, 157, 118, 129, 130, 131, 132, | 108570 /* 1410 */ 165, 150, 22, 176, 179, 228, 129, 130, 131, 132, 108381 /* 1420 */ 133, 134, 5, 150, 165, 157, 165, 10, 11, 12, | 108571 /* 1420 */ 133, 134, 5, 150, 165, 92, 165, 10, 11, 12, 108382 /* 1430 */ 13, 14, 150, 66, 17, 174, 175, 210, 165, 129, | 108572 /* 1430 */ 13, 14, 150, 66, 17, 174, 175, 228, 165, 129, 108383 /* 1440 */ 130, 131, 132, 133, 134, 150, 104, 165, 31, 150, | 108573 /* 1440 */ 130, 131, 132, 133, 134, 150, 184, 165, 31, 150, 108384 /* 1450 */ 33, 150, 150, 86, 87, 150, 174, 175, 211, 42, | 108574 /* 1450 */ 33, 150, 150, 86, 87, 172, 174, 175, 96, 42, 108385 /* 1460 */ 165, 94, 121, 210, 165, 98, 165, 165, 176, 211, | 108575 /* 1460 */ 165, 94, 176, 179, 165, 98, 165, 165, 176, 174, 108386 /* 1470 */ 165, 211, 55, 104, 57, 184, 210, 47, 61, 176, | 108576 /* 1470 */ 175, 156, 55, 176, 57, 18, 157, 156, 61, 157, 108387 /* 1480 */ 176, 64, 103, 176, 178, 22, 92, 179, 176, 176, | 108577 /* 1480 */ 156, 64, 157, 157, 235, 45, 236, 135, 156, 189, 108388 /* 1490 */ 176, 156, 18, 184, 179, 228, 129, 130, 131, 228, | 108578 /* 1490 */ 68, 157, 218, 189, 22, 199, 129, 130, 131, 156, 108389 /* 1500 */ 157, 156, 45, 157, 156, 236, 157, 157, 135, 235, | 108579 /* 1500 */ 192, 157, 18, 192, 192, 192, 199, 189, 218, 240, 108390 /* 1510 */ 156, 189, 157, 68, 218, 189, 22, 199, 156, 192, | 108580 /* 1510 */ 157, 40, 240, 157, 157, 38, 153, 166, 243, 196, 108391 /* 1520 */ 157, 18, 105, 106, 107, 192, 192, 199, 111, 192, | 108581 /* 1520 */ 226, 230, 105, 106, 107, 198, 209, 177, 111, 182, 108392 /* 1530 */ 240, 157, 40, 116, 218, 157, 189, 157, 240, 38, | 108582 /* 1530 */ 166, 177, 177, 116, 166, 230, 178, 239, 199, 209, 108393 /* 1540 */ 153, 166, 198, 243, 178, 209, 182, 196, 177, 226, | 108583 /* 1540 */ 209, 199, 148, 166, 196, 239, 208, 233, 172, 183, 108394 /* 1550 */ 230, 230, 166, 177, 177, 166, 139, 199, 199, 148, | 108584 /* 1550 */ 234, 191, 183, 183, 195, 174, 139, 186, 186, 174, 108395 /* 1560 */ 195, 209, 209, 239, 196, 166, 234, 183, 239, 208, | 108585 /* 1560 */ 92, 108396 /* 1570 */ 174, 233, 191, 183, 183, 174, 92, 250, 186, 186, < 108397 }; 108586 }; 108398 #define YY_SHIFT_USE_DFLT (-81) | 108587 #define YY_SHIFT_USE_DFLT (-70) 108399 #define YY_SHIFT_COUNT (417) | 108588 #define YY_SHIFT_COUNT (418) 108400 #define YY_SHIFT_MIN (-80) | 108589 #define YY_SHIFT_MIN (-69) 108401 #define YY_SHIFT_MAX (1503) | 108590 #define YY_SHIFT_MAX (1484) 108402 static const short yy_shift_ofst[] = { 108591 static const short yy_shift_ofst[] = { 108403 /* 0 */ 1075, 1188, 1417, 1188, 1287, 1287, 138, 138, 1, -19, | 108592 /* 0 */ 975, 1188, 1417, 1188, 1287, 1287, 138, 138, 368, -19, 108404 /* 10 */ 1287, 1287, 1287, 1287, 340, -2, 129, 129, 795, 1165, | 108593 /* 10 */ 1287, 1287, 1287, 1287, 272, 524, 129, 129, 795, 1165, 108405 /* 20 */ 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 108594 /* 20 */ 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 108406 /* 30 */ 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 108595 /* 30 */ 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 108407 /* 40 */ 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1310, 1287, 108596 /* 40 */ 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1310, 1287, 108408 /* 50 */ 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 108597 /* 50 */ 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 1287, 108409 /* 60 */ 1287, 1287, 212, -2, -2, -8, -8, 614, 1229, 55, | 108598 /* 60 */ 1287, 1287, 212, 524, 524, 213, 213, 459, 1122, 55, 108410 /* 70 */ 721, 647, 573, 499, 425, 351, 277, 203, 869, 869, 108599 /* 70 */ 721, 647, 573, 499, 425, 351, 277, 203, 869, 869, 108411 /* 80 */ 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, 108600 /* 80 */ 869, 869, 869, 869, 869, 869, 869, 869, 869, 869, 108412 /* 90 */ 869, 869, 869, 943, 869, 1017, 1091, 1091, -69, -45, 108601 /* 90 */ 869, 869, 869, 943, 869, 1017, 1091, 1091, -69, -45, 108413 /* 100 */ -45, -45, -45, -45, -1, 57, 28, 361, -2, -2, | 108602 /* 100 */ -45, -45, -45, -45, -1, 6, -64, 524, 524, 524, 108414 /* 110 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, | 108603 /* 110 */ 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, 108415 /* 120 */ -2, -2, -2, -2, 391, 515, -2, -2, -2, -2, | 108604 /* 120 */ 524, 524, 524, 386, 207, 524, 524, 524, 524, 524, 108416 /* 130 */ -2, 509, -80, 614, 979, 1484, -81, -81, -81, 1367, | 108605 /* 130 */ 409, -13, 459, 881, 1468, -70, -70, -70, 1367, 57, 108417 /* 140 */ 75, 182, 182, 314, 311, 364, 219, 86, 613, 609, | 108606 /* 140 */ 433, 433, 297, 236, 219, 136, 91, 572, 540, 524, 108418 /* 150 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, | 108607 /* 150 */ 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, 108419 /* 160 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, | 108608 /* 160 */ 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, 108420 /* 170 */ -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, | 108609 /* 170 */ 524, 524, 524, 524, 524, 524, 524, 524, 524, 524, 108421 /* 180 */ -2, -2, 578, 578, 578, 615, 1229, 1229, 1229, -81, | 108610 /* 180 */ 650, 650, 650, 687, 1122, 1122, 1122, -70, -70, -70, 108422 /* 190 */ -81, -81, 160, 168, 168, 283, 500, 500, 500, 278, | 108611 /* 190 */ 204, 204, 434, 434, 494, 494, 494, 504, 446, 292, 108423 /* 200 */ 449, 330, 432, 409, 352, 48, 48, 48, 48, 426, | 108612 /* 200 */ 442, 428, 424, 77, 377, 377, 377, 377, 531, 498, 108424 /* 210 */ 286, 48, 48, 728, 581, 369, 590, 495, 224, 224, | 108613 /* 210 */ 377, 377, 278, 215, 227, 664, 722, 574, 574, 750, 108425 /* 220 */ 727, 495, 727, 719, 614, 659, 614, 659, 811, 659, | 108614 /* 220 */ 722, 750, 229, 459, 660, 459, 660, 476, 660, 574, 108426 /* 230 */ 224, 257, 480, 480, 614, 144, 375, -18, 1501, 1297, | 108615 /* 230 */ 651, 625, 625, 459, 579, 273, -18, 1477, 1193, 1193, 108427 /* 240 */ 1297, 1492, 1492, 1297, 1494, 1445, 1239, 1503, 1503, 1503, | 108616 /* 240 */ 1471, 1471, 1193, 1472, 1422, 1117, 1484, 1484, 1484, 1484, 108428 /* 250 */ 1503, 1297, 1474, 1239, 1494, 1445, 1445, 1297, 1474, 1373, | 108617 /* 250 */ 1193, 1457, 1117, 1472, 1422, 1422, 1193, 1457, 1352, 1440, 108429 /* 260 */ 1457, 1297, 1297, 1474, 1297, 1474, 1297, 1474, 1463, 1369, | 108618 /* 260 */ 1193, 1193, 1457, 1193, 1457, 1193, 1457, 1390, 1241, 1241, 108430 /* 270 */ 1369, 1369, 1430, 1394, 1394, 1463, 1369, 1379, 1369, 1430, | 108619 /* 270 */ 1241, 1362, 1341, 1333, 1333, 1390, 1241, 1303, 1241, 1341, 108431 /* 280 */ 1369, 1369, 1341, 1342, 1341, 1342, 1341, 1342, 1297, 1297, | 108620 /* 280 */ 1241, 1241, 1223, 1234, 1223, 1234, 1223, 1234, 1193, 1193, 108432 /* 290 */ 1278, 1281, 1262, 1244, 1265, 1239, 1229, 1319, 1325, 1325, | 108621 /* 290 */ 1134, 1162, 1145, 1142, 1139, 1117, 1122, 1211, 1217, 1217, 108433 /* 300 */ 1270, 1270, 1270, 1270, -81, -81, -81, -81, -81, -81, | 108622 /* 300 */ 1213, 1213, 1213, 1213, -70, -70, -70, -70, -70, -70, 108434 /* 310 */ 1013, 242, 757, 752, 465, 363, 947, 232, 944, 906, | 108623 /* 310 */ 334, 393, 497, 392, 543, 275, 901, 98, 870, 828, 108435 /* 320 */ 872, 837, 738, 448, 381, 230, 84, 362, 300, 1264, | 108624 /* 320 */ 753, 683, 453, 447, 535, 221, 140, 429, 54, 1202, 108436 /* 330 */ 1263, 1234, 1108, 1228, 1180, 1223, 1217, 1207, 1099, 1174, | 108625 /* 330 */ 1196, 1179, 1057, 1180, 1133, 1178, 1149, 1131, 1065, 1103, 108437 /* 340 */ 1109, 1115, 1103, 1199, 1105, 1202, 1216, 1087, 1193, 1178, | 108626 /* 340 */ 1033, 1043, 1034, 1130, 1028, 1132, 1144, 1027, 1121, 1120, 108438 /* 350 */ 1174, 1176, 1068, 1079, 1078, 1086, 1166, 1137, 1034, 1152, | 108627 /* 350 */ 1103, 1098, 997, 1045, 1042, 1009, 1053, 1044, 959, 1075, 108439 /* 360 */ 1146, 1127, 1044, 1006, 1093, 1120, 1090, 1083, 1085, 1022, | 108628 /* 360 */ 1070, 1049, 968, 931, 1015, 1032, 1001, 994, 1007, 947, 108440 /* 370 */ 1101, 1104, 1102, 972, 1015, 1098, 1027, 1056, 1050, 1045, | 108629 /* 370 */ 1023, 1026, 981, 893, 896, 974, 942, 967, 958, 946, 108441 /* 380 */ 1031, 998, 1018, 981, 946, 950, 973, 963, 862, 885, | 108630 /* 380 */ 945, 877, 902, 880, 884, 847, 822, 831, 764, 714, 108442 /* 390 */ 819, 884, 782, 796, 806, 807, 790, 796, 793, 758, | 108631 /* 390 */ 735, 723, 720, 587, 615, 642, 656, 576, 615, 575, 108443 /* 400 */ 753, 732, 692, 696, 682, 686, 667, 544, 291, 521, | 108632 /* 400 */ 518, 463, 461, 438, 405, 390, 387, 376, 303, 224, 108444 /* 410 */ 510, 365, 358, 139, 114, 54, 14, 25, | 108633 /* 410 */ 271, 190, 92, 72, 69, 145, 113, 33, 28, 108445 }; 108634 }; 108446 #define YY_REDUCE_USE_DFLT (-169) 108635 #define YY_REDUCE_USE_DFLT (-169) 108447 #define YY_REDUCE_COUNT (309) 108636 #define YY_REDUCE_COUNT (309) 108448 #define YY_REDUCE_MIN (-168) 108637 #define YY_REDUCE_MIN (-168) 108449 #define YY_REDUCE_MAX (1411) | 108638 #define YY_REDUCE_MAX (1394) 108450 static const short yy_reduce_ofst[] = { 108639 static const short yy_reduce_ofst[] = { 108451 /* 0 */ 318, 90, 1095, 221, 157, 21, 159, 18, 150, 390, | 108640 /* 0 */ 541, 90, 1095, 147, 86, 19, 18, -49, 10, 245, 108452 /* 10 */ 385, 378, 380, 315, 325, 249, 529, -71, 8, 1282, | 108641 /* 10 */ 308, 306, 243, 222, -41, -51, 181, -71, 394, 1295, 108453 /* 20 */ 1261, 1225, 1185, 1183, 1181, 1177, 1151, 1128, 1096, 1063, | 108642 /* 20 */ 1282, 1261, 1225, 1204, 1185, 1183, 1177, 1166, 1127, 1096, 108454 /* 30 */ 1059, 985, 982, 964, 962, 948, 908, 890, 874, 834, | 108643 /* 30 */ 1059, 1038, 982, 964, 961, 948, 908, 890, 887, 874, 108455 /* 40 */ 832, 816, 813, 800, 759, 746, 742, 739, 726, 684, | 108644 /* 40 */ 834, 832, 816, 813, 800, 760, 746, 742, 739, 726, 108456 /* 50 */ 681, 668, 665, 652, 612, 593, 591, 537, 524, 518, | 108645 /* 50 */ 681, 668, 665, 652, 610, 598, 591, 578, 530, 528, 108457 /* 60 */ 504, 455, 511, 376, 517, 247, -168, 24, 420, 463, | 108646 /* 60 */ 525, 456, 474, 464, 517, 439, -168, 208, 406, 491, 108458 /* 70 */ 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, | 108647 /* 70 */ 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 108459 /* 80 */ 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, | 108648 /* 80 */ 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 108460 /* 90 */ 463, 463, 463, 463, 463, 463, 463, 463, 463, 463, | 108649 /* 90 */ 491, 491, 491, 491, 491, 491, 491, 491, 491, 491, 108461 /* 100 */ 463, 463, 463, 463, 463, -74, 463, 463, 1112, 835, | 108650 /* 100 */ 491, 491, 491, 491, 491, 491, 491, 1039, 909, 993, 108462 /* 110 */ 1107, 1039, 1036, 965, 887, 845, 818, 760, 688, 687, | 108651 /* 110 */ 966, 962, 891, 845, 740, 765, 920, 747, 27, 614, 108463 /* 120 */ 538, 743, 623, 592, 446, 513, 814, 740, 670, 156, | 108652 /* 120 */ 673, 758, 669, -119, 586, 672, 671, 670, 596, 544, 108464 /* 130 */ 468, 553, 184, 616, 463, 463, 463, 463, 463, 595, | 108653 /* 130 */ 622, 460, 583, 491, 491, 491, 491, 491, 757, 374, 108465 /* 140 */ 821, 786, 745, 909, 1305, 1302, 1301, 1299, 675, 675, | 108654 /* 140 */ 712, 638, 913, 1302, 1301, 1299, 1273, 577, 577, 1259, 108466 /* 150 */ 1295, 1273, 1259, 1245, 1242, 1233, 1222, 1221, 1214, 1213, | 108655 /* 150 */ 1245, 1242, 1236, 1233, 1222, 1212, 1206, 1205, 1184, 1160, 108467 /* 160 */ 1212, 1204, 1184, 1158, 1123, 1119, 1114, 1100, 1070, 1047, | 108656 /* 160 */ 1158, 1140, 1135, 1128, 1126, 1123, 1115, 1114, 1107, 1085, 108468 /* 170 */ 1046, 1040, 1038, 969, 968, 966, 909, 904, 896, 895, | 108657 /* 170 */ 1046, 1040, 987, 969, 965, 913, 895, 836, 818, 814, 108469 /* 180 */ 892, 599, 839, 838, 766, 754, 881, 734, 346, 605, | 108658 /* 180 */ 876, 839, 838, 636, 776, 738, 734, 604, 421, 62, 108470 /* 190 */ 622, -94, 1393, 1401, 1396, 1392, 1391, 1390, 1384, 1361, | 108659 /* 190 */ 1385, 1381, 1372, 1371, 1370, 1369, 1366, 1338, 1359, 1360, 108471 /* 200 */ 1365, 1381, 1365, 1365, 1365, 1365, 1365, 1365, 1365, 1332, | 108660 /* 200 */ 1359, 1359, 1359, 1376, 1359, 1359, 1359, 1359, 1316, 1314, 108472 /* 210 */ 1338, 1365, 1365, 1361, 1399, 1368, 1411, 1359, 1353, 1352, | 108661 /* 210 */ 1359, 1359, 1338, 1377, 1348, 1394, 1342, 1331, 1330, 1306, 108473 /* 220 */ 1329, 1358, 1324, 1366, 1389, 1377, 1386, 1376, 1364, 1371, | 108662 /* 220 */ 1339, 1298, 1358, 1368, 1355, 1364, 1354, 1347, 1350, 1317, 108474 /* 230 */ 1336, 1323, 1321, 1320, 1375, 1344, 1351, 1387, 1300, 1380, | 108663 /* 230 */ 1294, 1305, 1291, 1351, 1327, 1323, 1363, 1275, 1357, 1356, 108475 /* 240 */ 1378, 1298, 1290, 1374, 1316, 1347, 1328, 1337, 1334, 1333, | 108664 /* 240 */ 1272, 1269, 1353, 1290, 1318, 1307, 1313, 1312, 1311, 1308, 108476 /* 250 */ 1327, 1363, 1362, 1318, 1296, 1326, 1322, 1355, 1354, 1269, | 108665 /* 250 */ 1344, 1343, 1296, 1274, 1304, 1300, 1334, 1332, 1250, 1249, 108477 /* 260 */ 1274, 1350, 1349, 1348, 1346, 1345, 1343, 1335, 1315, 1314, | 108666 /* 260 */ 1326, 1325, 1324, 1322, 1321, 1319, 1315, 1284, 1297, 1292, 108478 /* 270 */ 1313, 1312, 1309, 1271, 1267, 1308, 1307, 1306, 1304, 1291, | 108667 /* 270 */ 1286, 1283, 1262, 1209, 1187, 1235, 1237, 1224, 1215, 1200, 108479 /* 280 */ 1303, 1292, 1260, 1266, 1258, 1253, 1247, 1227, 1268, 1257, | 108668 /* 280 */ 1192, 1189, 1156, 1154, 1152, 1136, 1150, 1118, 1169, 1146, 108480 /* 290 */ 1187, 1198, 1200, 1190, 1170, 1168, 1167, 1182, 1189, 1164, | 108669 /* 290 */ 1090, 1081, 1066, 1055, 1048, 1041, 1051, 1080, 1086, 1078, 108481 /* 300 */ 1179, 1162, 1138, 1136, 1061, 1043, 1021, 1111, 1110, 1116, | 108670 /* 300 */ 1079, 1077, 1074, 1069, 973, 971, 970, 1047, 1037, 1036, 108482 }; 108671 }; 108483 static const YYACTIONTYPE yy_default[] = { 108672 static const YYACTIONTYPE yy_default[] = { 108484 /* 0 */ 634, 868, 956, 956, 868, 868, 956, 956, 956, 758, | 108673 /* 0 */ 632, 864, 952, 952, 864, 864, 952, 952, 683, 754, 108485 /* 10 */ 956, 956, 956, 866, 956, 956, 786, 786, 930, 956, | 108674 /* 10 */ 952, 952, 952, 862, 952, 952, 782, 782, 926, 952, 108486 /* 20 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, | 108675 /* 20 */ 952, 952, 952, 952, 952, 952, 952, 952, 952, 952, 108487 /* 30 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, | 108676 /* 30 */ 952, 952, 952, 952, 952, 952, 952, 952, 952, 952, 108488 /* 40 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, | 108677 /* 40 */ 952, 952, 952, 952, 952, 952, 952, 952, 952, 952, 108489 /* 50 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, | 108678 /* 50 */ 952, 952, 952, 952, 952, 952, 952, 952, 952, 952, 108490 /* 60 */ 956, 956, 956, 956, 956, 956, 956, 673, 762, 792, | 108679 /* 60 */ 952, 952, 952, 952, 952, 952, 952, 671, 758, 788, 108491 /* 70 */ 956, 956, 956, 956, 956, 956, 956, 956, 929, 931, | 108680 /* 70 */ 952, 952, 952, 952, 952, 952, 952, 952, 925, 927, 108492 /* 80 */ 800, 799, 909, 773, 797, 790, 794, 869, 862, 863, | 108681 /* 80 */ 796, 795, 905, 769, 793, 786, 790, 865, 858, 859, 108493 /* 90 */ 861, 865, 870, 956, 793, 829, 846, 828, 840, 845, | 108682 /* 90 */ 857, 861, 866, 952, 789, 825, 842, 824, 836, 841, 108494 /* 100 */ 852, 844, 841, 831, 830, 665, 832, 833, 956, 956, | 108683 /* 100 */ 848, 840, 837, 827, 826, 828, 829, 952, 952, 952, 108495 /* 110 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, | 108684 /* 110 */ 952, 952, 952, 952, 952, 952, 952, 952, 952, 952, 108496 /* 120 */ 956, 956, 956, 956, 660, 727, 956, 956, 956, 956, | 108685 /* 120 */ 952, 952, 952, 658, 723, 952, 952, 952, 952, 952, 108497 /* 130 */ 956, 956, 956, 956, 834, 835, 849, 848, 847, 956, | 108686 /* 130 */ 952, 952, 952, 830, 831, 845, 844, 843, 952, 952, 108498 /* 140 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, | 108687 /* 140 */ 952, 952, 952, 952, 952, 952, 952, 952, 952, 952, 108499 /* 150 */ 956, 936, 934, 956, 881, 956, 956, 956, 956, 956, | 108688 /* 150 */ 932, 930, 952, 877, 952, 952, 952, 952, 952, 952, 108500 /* 160 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, | 108689 /* 160 */ 952, 952, 952, 952, 952, 952, 952, 952, 952, 952, 108501 /* 170 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, | 108690 /* 170 */ 952, 952, 952, 952, 952, 952, 952, 952, 952, 638, 108502 /* 180 */ 956, 640, 758, 758, 758, 634, 956, 956, 956, 948, | 108691 /* 180 */ 754, 754, 754, 632, 952, 952, 952, 944, 758, 748, 108503 /* 190 */ 762, 752, 718, 956, 956, 956, 956, 956, 956, 956, | 108692 /* 190 */ 952, 952, 952, 952, 952, 952, 952, 952, 952, 952, 108504 /* 200 */ 956, 956, 956, 956, 956, 802, 741, 919, 921, 956, | 108693 /* 200 */ 952, 952, 952, 683, 798, 737, 915, 917, 952, 898, 108505 /* 210 */ 902, 739, 662, 760, 675, 750, 642, 796, 775, 775, | 108694 /* 210 */ 735, 660, 756, 673, 746, 640, 792, 771, 771, 910, 108506 /* 220 */ 914, 796, 914, 699, 956, 786, 956, 786, 696, 786, | 108695 /* 220 */ 792, 910, 697, 952, 782, 952, 782, 694, 782, 771, 108507 /* 230 */ 775, 864, 956, 956, 956, 759, 750, 956, 941, 766, | 108696 /* 230 */ 860, 952, 952, 952, 755, 746, 952, 937, 762, 762, 108508 /* 240 */ 766, 933, 933, 766, 808, 731, 796, 738, 738, 738, | 108697 /* 240 */ 929, 929, 762, 804, 727, 792, 734, 734, 734, 734, 108509 /* 250 */ 738, 766, 657, 796, 808, 731, 731, 766, 657, 908, | 108698 /* 250 */ 762, 655, 792, 804, 727, 727, 762, 655, 904, 902, 108510 /* 260 */ 906, 766, 766, 657, 766, 657, 766, 657, 874, 729, | 108699 /* 260 */ 762, 762, 655, 762, 655, 762, 655, 870, 725, 725, 108511 /* 270 */ 729, 729, 714, 878, 878, 874, 729, 699, 729, 714, | 108700 /* 270 */ 725, 683, 712, 874, 874, 870, 725, 697, 725, 712, 108512 /* 280 */ 729, 729, 779, 774, 779, 774, 779, 774, 766, 766, | 108701 /* 280 */ 725, 725, 775, 770, 775, 770, 775, 770, 762, 762, 108513 /* 290 */ 956, 791, 780, 789, 787, 796, 956, 717, 650, 650, | 108702 /* 290 */ 952, 787, 776, 785, 783, 792, 952, 715, 648, 648, 108514 /* 300 */ 639, 639, 639, 639, 953, 953, 948, 701, 701, 683, | 108703 /* 300 */ 637, 637, 637, 637, 949, 949, 944, 699, 699, 681, 108515 /* 310 */ 956, 956, 956, 956, 956, 956, 956, 883, 956, 956, | 108704 /* 310 */ 952, 952, 952, 952, 952, 952, 952, 879, 952, 952, 108516 /* 320 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, | 108705 /* 320 */ 952, 952, 952, 952, 952, 952, 952, 952, 952, 952, 108517 /* 330 */ 635, 943, 956, 956, 940, 956, 956, 956, 956, 801, | 108706 /* 330 */ 633, 939, 952, 952, 936, 952, 952, 952, 952, 797, 108518 /* 340 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, | 108707 /* 340 */ 952, 952, 952, 952, 952, 952, 952, 952, 952, 952, 108519 /* 350 */ 918, 956, 956, 956, 956, 956, 956, 956, 912, 956, | 108708 /* 350 */ 914, 952, 952, 952, 952, 952, 952, 952, 908, 952, 108520 /* 360 */ 956, 956, 956, 956, 956, 905, 904, 956, 956, 956, | 108709 /* 360 */ 952, 952, 952, 952, 952, 901, 900, 952, 952, 952, 108521 /* 370 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, | 108710 /* 370 */ 952, 952, 952, 952, 952, 952, 952, 952, 952, 952, 108522 /* 380 */ 956, 956, 956, 956, 956, 956, 956, 956, 956, 956, | 108711 /* 380 */ 952, 952, 716, 952, 952, 952, 952, 952, 952, 952, 108523 /* 390 */ 956, 956, 956, 788, 956, 781, 956, 867, 956, 956, | 108712 /* 390 */ 952, 952, 952, 952, 784, 952, 777, 952, 863, 952, 108524 /* 400 */ 956, 956, 956, 956, 956, 956, 956, 956, 744, 817, | 108713 /* 400 */ 952, 952, 952, 952, 952, 952, 952, 952, 952, 740, 108525 /* 410 */ 956, 816, 820, 815, 667, 956, 648, 956, 631, 636, | 108714 /* 410 */ 813, 952, 812, 816, 811, 665, 952, 646, 952, 629, 108526 /* 420 */ 952, 955, 954, 951, 950, 949, 944, 942, 939, 938, | 108715 /* 420 */ 634, 948, 951, 950, 947, 946, 945, 940, 938, 935, 108527 /* 430 */ 937, 935, 932, 928, 887, 885, 892, 891, 890, 889, | 108716 /* 430 */ 934, 933, 931, 928, 924, 883, 881, 888, 887, 886, 108528 /* 440 */ 888, 886, 884, 882, 803, 798, 795, 927, 880, 740, | 108717 /* 440 */ 885, 884, 882, 880, 878, 799, 794, 791, 923, 876, 108529 /* 450 */ 737, 736, 656, 945, 911, 920, 807, 806, 809, 917, | 108718 /* 450 */ 736, 733, 732, 654, 941, 907, 916, 803, 802, 805, 108530 /* 460 */ 916, 915, 913, 910, 897, 805, 804, 732, 872, 871, | 108719 /* 460 */ 913, 912, 911, 909, 906, 893, 801, 800, 728, 868, 108531 /* 470 */ 659, 901, 900, 899, 903, 907, 898, 768, 658, 655, | 108720 /* 470 */ 867, 657, 897, 896, 895, 899, 903, 894, 764, 656, 108532 /* 480 */ 664, 721, 720, 728, 726, 725, 724, 723, 722, 719, | 108721 /* 480 */ 653, 662, 718, 724, 722, 721, 720, 719, 717, 664, 108533 /* 490 */ 666, 674, 685, 713, 698, 697, 877, 879, 876, 875, | 108722 /* 490 */ 672, 682, 711, 696, 695, 873, 875, 872, 871, 704, 108534 /* 500 */ 706, 705, 711, 710, 709, 708, 707, 704, 703, 702, | 108723 /* 500 */ 703, 709, 708, 707, 706, 705, 702, 701, 700, 693, 108535 /* 510 */ 695, 694, 700, 693, 716, 715, 712, 692, 735, 734, | 108724 /* 510 */ 692, 698, 691, 714, 713, 710, 690, 731, 730, 729, 108536 /* 520 */ 733, 730, 691, 690, 689, 820, 688, 687, 826, 825, | 108725 /* 520 */ 726, 689, 688, 687, 816, 686, 685, 822, 821, 809, 108537 /* 530 */ 813, 856, 755, 754, 753, 765, 764, 777, 776, 811, | 108726 /* 530 */ 852, 751, 750, 749, 761, 760, 773, 772, 807, 806, 108538 /* 540 */ 810, 778, 763, 757, 756, 772, 771, 770, 769, 761, | 108727 /* 540 */ 774, 759, 753, 752, 768, 767, 766, 765, 757, 747, 108539 /* 550 */ 751, 783, 785, 784, 782, 858, 767, 855, 926, 925, | 108728 /* 550 */ 779, 781, 780, 778, 854, 763, 851, 922, 921, 920, 108540 /* 560 */ 924, 923, 922, 860, 859, 827, 824, 678, 679, 895, | 108729 /* 560 */ 919, 918, 856, 855, 823, 820, 676, 677, 891, 890, 108541 /* 570 */ 894, 896, 893, 681, 680, 677, 676, 857, 746, 745, | 108730 /* 570 */ 892, 889, 679, 678, 675, 674, 853, 742, 741, 849, 108542 /* 580 */ 853, 850, 842, 838, 854, 851, 843, 839, 837, 836, | 108731 /* 580 */ 846, 838, 834, 850, 847, 839, 835, 833, 832, 818, 108543 /* 590 */ 822, 821, 819, 818, 814, 823, 669, 747, 743, 742, | 108732 /* 590 */ 817, 815, 814, 810, 819, 667, 743, 739, 738, 808, 108544 /* 600 */ 812, 749, 748, 686, 684, 682, 663, 661, 654, 652, | 108733 /* 600 */ 745, 744, 684, 680, 661, 659, 652, 650, 649, 651, 108545 /* 610 */ 651, 653, 649, 647, 646, 645, 644, 643, 672, 671, | 108734 /* 610 */ 647, 645, 644, 643, 642, 641, 670, 669, 668, 666, 108546 /* 620 */ 670, 668, 667, 641, 638, 637, 633, 632, 630, | 108735 /* 620 */ 665, 639, 636, 635, 631, 630, 628, 108547 }; 108736 }; 108548 108737 108549 /* The next table maps tokens into fallback tokens. If a construct 108738 /* The next table maps tokens into fallback tokens. If a construct 108550 ** like the following: 108739 ** like the following: 108551 ** 108740 ** 108552 ** %fallback ID X Y Z. 108741 ** %fallback ID X Y Z. 108553 ** 108742 ** ................................................................................................................................................................................ 108742 "ecmd", "explain", "cmdx", "cmd", 108931 "ecmd", "explain", "cmdx", "cmd", 108743 "transtype", "trans_opt", "nm", "savepoint_opt", 108932 "transtype", "trans_opt", "nm", "savepoint_opt", 108744 "create_table", "create_table_args", "createkw", "temp", 108933 "create_table", "create_table_args", "createkw", "temp", 108745 "ifnotexists", "dbnm", "columnlist", "conslist_opt", 108934 "ifnotexists", "dbnm", "columnlist", "conslist_opt", 108746 "select", "column", "columnid", "type", 108935 "select", "column", "columnid", "type", 108747 "carglist", "id", "ids", "typetoken", 108936 "carglist", "id", "ids", "typetoken", 108748 "typename", "signed", "plus_num", "minus_num", 108937 "typename", "signed", "plus_num", "minus_num", 108749 "carg", "ccons", "term", "expr", | 108938 "cname", "ccons", "term", "expr", 108750 "onconf", "sortorder", "autoinc", "idxlist_opt", 108939 "onconf", "sortorder", "autoinc", "idxlist_opt", 108751 "refargs", "defer_subclause", "refarg", "refact", 108940 "refargs", "defer_subclause", "refarg", "refact", 108752 "init_deferred_pred_opt", "conslist", "tcons", "idxlist", 108941 "init_deferred_pred_opt", "conslist", "tcons", "idxlist", 108753 "defer_subclause_opt", "orconf", "resolvetype", "raisetype", 108942 "defer_subclause_opt", "orconf", "resolvetype", "raisetype", 108754 "ifexists", "fullname", "oneselect", "multiselect_op", 108943 "ifexists", "fullname", "oneselect", "multiselect_op", 108755 "distinct", "selcollist", "from", "where_opt", 108944 "distinct", "selcollist", "from", "where_opt", 108756 "groupby_opt", "having_opt", "orderby_opt", "limit_opt", 108945 "groupby_opt", "having_opt", "orderby_opt", "limit_opt", ................................................................................................................................................................................ 108822 /* 46 */ "typetoken ::= typename", 109011 /* 46 */ "typetoken ::= typename", 108823 /* 47 */ "typetoken ::= typename LP signed RP", 109012 /* 47 */ "typetoken ::= typename LP signed RP", 108824 /* 48 */ "typetoken ::= typename LP signed COMMA signed RP", 109013 /* 48 */ "typetoken ::= typename LP signed COMMA signed RP", 108825 /* 49 */ "typename ::= ids", 109014 /* 49 */ "typename ::= ids", 108826 /* 50 */ "typename ::= typename ids", 109015 /* 50 */ "typename ::= typename ids", 108827 /* 51 */ "signed ::= plus_num", 109016 /* 51 */ "signed ::= plus_num", 108828 /* 52 */ "signed ::= minus_num", 109017 /* 52 */ "signed ::= minus_num", 108829 /* 53 */ "carglist ::= carglist carg", | 109018 /* 53 */ "carglist ::= carglist cname ccons", 108830 /* 54 */ "carglist ::=", 109019 /* 54 */ "carglist ::=", 108831 /* 55 */ "carg ::= CONSTRAINT nm ccons", | 109020 /* 55 */ "cname ::= CONSTRAINT nm", 108832 /* 56 */ "carg ::= ccons", | 109021 /* 56 */ "cname ::=", 108833 /* 57 */ "ccons ::= DEFAULT term", 109022 /* 57 */ "ccons ::= DEFAULT term", 108834 /* 58 */ "ccons ::= DEFAULT LP expr RP", 109023 /* 58 */ "ccons ::= DEFAULT LP expr RP", 108835 /* 59 */ "ccons ::= DEFAULT PLUS term", 109024 /* 59 */ "ccons ::= DEFAULT PLUS term", 108836 /* 60 */ "ccons ::= DEFAULT MINUS term", 109025 /* 60 */ "ccons ::= DEFAULT MINUS term", 108837 /* 61 */ "ccons ::= DEFAULT id", 109026 /* 61 */ "ccons ::= DEFAULT id", 108838 /* 62 */ "ccons ::= NULL onconf", 109027 /* 62 */ "ccons ::= NULL onconf", 108839 /* 63 */ "ccons ::= NOT NULL onconf", 109028 /* 63 */ "ccons ::= NOT NULL onconf", ................................................................................................................................................................................ 108859 /* 83 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt", 109048 /* 83 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt", 108860 /* 84 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt", 109049 /* 84 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt", 108861 /* 85 */ "init_deferred_pred_opt ::=", 109050 /* 85 */ "init_deferred_pred_opt ::=", 108862 /* 86 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED", 109051 /* 86 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED", 108863 /* 87 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE", 109052 /* 87 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE", 108864 /* 88 */ "conslist_opt ::=", 109053 /* 88 */ "conslist_opt ::=", 108865 /* 89 */ "conslist_opt ::= COMMA conslist", 109054 /* 89 */ "conslist_opt ::= COMMA conslist", 108866 /* 90 */ "conslist ::= conslist COMMA tcons", | 109055 /* 90 */ "conslist ::= conslist COMMA cname tcons", 108867 /* 91 */ "conslist ::= conslist tcons", | 109056 /* 91 */ "conslist ::= cname tcons", 108868 /* 92 */ "conslist ::= tcons", < 108869 /* 93 */ "tcons ::= CONSTRAINT nm", < 108870 /* 94 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf", | 109057 /* 92 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf", 108871 /* 95 */ "tcons ::= UNIQUE LP idxlist RP onconf", | 109058 /* 93 */ "tcons ::= UNIQUE LP idxlist RP onconf", 108872 /* 96 */ "tcons ::= CHECK LP expr RP onconf", | 109059 /* 94 */ "tcons ::= CHECK LP expr RP onconf", 108873 /* 97 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refarg | 109060 /* 95 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refarg 108874 /* 98 */ "defer_subclause_opt ::=", | 109061 /* 96 */ "defer_subclause_opt ::=", 108875 /* 99 */ "defer_subclause_opt ::= defer_subclause", | 109062 /* 97 */ "defer_subclause_opt ::= defer_subclause", 108876 /* 100 */ "onconf ::=", | 109063 /* 98 */ "onconf ::=", 108877 /* 101 */ "onconf ::= ON CONFLICT resolvetype", | 109064 /* 99 */ "onconf ::= ON CONFLICT resolvetype", 108878 /* 102 */ "orconf ::=", | 109065 /* 100 */ "orconf ::=", 108879 /* 103 */ "orconf ::= OR resolvetype", | 109066 /* 101 */ "orconf ::= OR resolvetype", 108880 /* 104 */ "resolvetype ::= raisetype", | 109067 /* 102 */ "resolvetype ::= raisetype", 108881 /* 105 */ "resolvetype ::= IGNORE", | 109068 /* 103 */ "resolvetype ::= IGNORE", 108882 /* 106 */ "resolvetype ::= REPLACE", | 109069 /* 104 */ "resolvetype ::= REPLACE", 108883 /* 107 */ "cmd ::= DROP TABLE ifexists fullname", | 109070 /* 105 */ "cmd ::= DROP TABLE ifexists fullname", 108884 /* 108 */ "ifexists ::= IF EXISTS", | 109071 /* 106 */ "ifexists ::= IF EXISTS", 108885 /* 109 */ "ifexists ::=", | 109072 /* 107 */ "ifexists ::=", 108886 /* 110 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm AS select", | 109073 /* 108 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm AS select", 108887 /* 111 */ "cmd ::= DROP VIEW ifexists fullname", | 109074 /* 109 */ "cmd ::= DROP VIEW ifexists fullname", 108888 /* 112 */ "cmd ::= select", | 109075 /* 110 */ "cmd ::= select", 108889 /* 113 */ "select ::= oneselect", | 109076 /* 111 */ "select ::= oneselect", 108890 /* 114 */ "select ::= select multiselect_op oneselect", | 109077 /* 112 */ "select ::= select multiselect_op oneselect", 108891 /* 115 */ "multiselect_op ::= UNION", | 109078 /* 113 */ "multiselect_op ::= UNION", 108892 /* 116 */ "multiselect_op ::= UNION ALL", | 109079 /* 114 */ "multiselect_op ::= UNION ALL", 108893 /* 117 */ "multiselect_op ::= EXCEPT|INTERSECT", | 109080 /* 115 */ "multiselect_op ::= EXCEPT|INTERSECT", 108894 /* 118 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt | 109081 /* 116 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt 108895 /* 119 */ "distinct ::= DISTINCT", | 109082 /* 117 */ "distinct ::= DISTINCT", 108896 /* 120 */ "distinct ::= ALL", | 109083 /* 118 */ "distinct ::= ALL", 108897 /* 121 */ "distinct ::=", | 109084 /* 119 */ "distinct ::=", 108898 /* 122 */ "sclp ::= selcollist COMMA", | 109085 /* 120 */ "sclp ::= selcollist COMMA", 108899 /* 123 */ "sclp ::=", | 109086 /* 121 */ "sclp ::=", 108900 /* 124 */ "selcollist ::= sclp expr as", | 109087 /* 122 */ "selcollist ::= sclp expr as", 108901 /* 125 */ "selcollist ::= sclp STAR", | 109088 /* 123 */ "selcollist ::= sclp STAR", 108902 /* 126 */ "selcollist ::= sclp nm DOT STAR", | 109089 /* 124 */ "selcollist ::= sclp nm DOT STAR", 108903 /* 127 */ "as ::= AS nm", | 109090 /* 125 */ "as ::= AS nm", 108904 /* 128 */ "as ::= ids", | 109091 /* 126 */ "as ::= ids", 108905 /* 129 */ "as ::=", | 109092 /* 127 */ "as ::=", 108906 /* 130 */ "from ::=", | 109093 /* 128 */ "from ::=", 108907 /* 131 */ "from ::= FROM seltablist", | 109094 /* 129 */ "from ::= FROM seltablist", 108908 /* 132 */ "stl_prefix ::= seltablist joinop", | 109095 /* 130 */ "stl_prefix ::= seltablist joinop", 108909 /* 133 */ "stl_prefix ::=", | 109096 /* 131 */ "stl_prefix ::=", 108910 /* 134 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt", | 109097 /* 132 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt", 108911 /* 135 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt", | 109098 /* 133 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt", 108912 /* 136 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt", | 109099 /* 134 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt", 108913 /* 137 */ "dbnm ::=", | 109100 /* 135 */ "dbnm ::=", 108914 /* 138 */ "dbnm ::= DOT nm", | 109101 /* 136 */ "dbnm ::= DOT nm", 108915 /* 139 */ "fullname ::= nm dbnm", | 109102 /* 137 */ "fullname ::= nm dbnm", 108916 /* 140 */ "joinop ::= COMMA|JOIN", | 109103 /* 138 */ "joinop ::= COMMA|JOIN", 108917 /* 141 */ "joinop ::= JOIN_KW JOIN", | 109104 /* 139 */ "joinop ::= JOIN_KW JOIN", 108918 /* 142 */ "joinop ::= JOIN_KW nm JOIN", | 109105 /* 140 */ "joinop ::= JOIN_KW nm JOIN", 108919 /* 143 */ "joinop ::= JOIN_KW nm nm JOIN", | 109106 /* 141 */ "joinop ::= JOIN_KW nm nm JOIN", 108920 /* 144 */ "on_opt ::= ON expr", | 109107 /* 142 */ "on_opt ::= ON expr", 108921 /* 145 */ "on_opt ::=", | 109108 /* 143 */ "on_opt ::=", 108922 /* 146 */ "indexed_opt ::=", | 109109 /* 144 */ "indexed_opt ::=", 108923 /* 147 */ "indexed_opt ::= INDEXED BY nm", | 109110 /* 145 */ "indexed_opt ::= INDEXED BY nm", 108924 /* 148 */ "indexed_opt ::= NOT INDEXED", | 109111 /* 146 */ "indexed_opt ::= NOT INDEXED", 108925 /* 149 */ "using_opt ::= USING LP inscollist RP", | 109112 /* 147 */ "using_opt ::= USING LP inscollist RP", 108926 /* 150 */ "using_opt ::=", | 109113 /* 148 */ "using_opt ::=", 108927 /* 151 */ "orderby_opt ::=", | 109114 /* 149 */ "orderby_opt ::=", 108928 /* 152 */ "orderby_opt ::= ORDER BY sortlist", | 109115 /* 150 */ "orderby_opt ::= ORDER BY sortlist", 108929 /* 153 */ "sortlist ::= sortlist COMMA expr sortorder", | 109116 /* 151 */ "sortlist ::= sortlist COMMA expr sortorder", 108930 /* 154 */ "sortlist ::= expr sortorder", | 109117 /* 152 */ "sortlist ::= expr sortorder", 108931 /* 155 */ "sortorder ::= ASC", | 109118 /* 153 */ "sortorder ::= ASC", 108932 /* 156 */ "sortorder ::= DESC", | 109119 /* 154 */ "sortorder ::= DESC", 108933 /* 157 */ "sortorder ::=", | 109120 /* 155 */ "sortorder ::=", 108934 /* 158 */ "groupby_opt ::=", | 109121 /* 156 */ "groupby_opt ::=", 108935 /* 159 */ "groupby_opt ::= GROUP BY nexprlist", | 109122 /* 157 */ "groupby_opt ::= GROUP BY nexprlist", 108936 /* 160 */ "having_opt ::=", | 109123 /* 158 */ "having_opt ::=", 108937 /* 161 */ "having_opt ::= HAVING expr", | 109124 /* 159 */ "having_opt ::= HAVING expr", 108938 /* 162 */ "limit_opt ::=", | 109125 /* 160 */ "limit_opt ::=", 108939 /* 163 */ "limit_opt ::= LIMIT expr", | 109126 /* 161 */ "limit_opt ::= LIMIT expr", 108940 /* 164 */ "limit_opt ::= LIMIT expr OFFSET expr", | 109127 /* 162 */ "limit_opt ::= LIMIT expr OFFSET expr", 108941 /* 165 */ "limit_opt ::= LIMIT expr COMMA expr", | 109128 /* 163 */ "limit_opt ::= LIMIT expr COMMA expr", 108942 /* 166 */ "cmd ::= DELETE FROM fullname indexed_opt where_opt", | 109129 /* 164 */ "cmd ::= DELETE FROM fullname indexed_opt where_opt", 108943 /* 167 */ "where_opt ::=", | 109130 /* 165 */ "where_opt ::=", 108944 /* 168 */ "where_opt ::= WHERE expr", | 109131 /* 166 */ "where_opt ::= WHERE expr", 108945 /* 169 */ "cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt", | 109132 /* 167 */ "cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt", 108946 /* 170 */ "setlist ::= setlist COMMA nm EQ expr", | 109133 /* 168 */ "setlist ::= setlist COMMA nm EQ expr", 108947 /* 171 */ "setlist ::= nm EQ expr", | 109134 /* 169 */ "setlist ::= nm EQ expr", 108948 /* 172 */ "cmd ::= insert_cmd INTO fullname inscollist_opt valuelist", | 109135 /* 170 */ "cmd ::= insert_cmd INTO fullname inscollist_opt valuelist", 108949 /* 173 */ "cmd ::= insert_cmd INTO fullname inscollist_opt select", | 109136 /* 171 */ "cmd ::= insert_cmd INTO fullname inscollist_opt select", 108950 /* 174 */ "cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES", | 109137 /* 172 */ "cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES", 108951 /* 175 */ "insert_cmd ::= INSERT orconf", | 109138 /* 173 */ "insert_cmd ::= INSERT orconf", 108952 /* 176 */ "insert_cmd ::= REPLACE", | 109139 /* 174 */ "insert_cmd ::= REPLACE", 108953 /* 177 */ "valuelist ::= VALUES LP nexprlist RP", | 109140 /* 175 */ "valuelist ::= VALUES LP nexprlist RP", 108954 /* 178 */ "valuelist ::= valuelist COMMA LP exprlist RP", | 109141 /* 176 */ "valuelist ::= valuelist COMMA LP exprlist RP", 108955 /* 179 */ "inscollist_opt ::=", | 109142 /* 177 */ "inscollist_opt ::=", 108956 /* 180 */ "inscollist_opt ::= LP inscollist RP", | 109143 /* 178 */ "inscollist_opt ::= LP inscollist RP", 108957 /* 181 */ "inscollist ::= inscollist COMMA nm", | 109144 /* 179 */ "inscollist ::= inscollist COMMA nm", 108958 /* 182 */ "inscollist ::= nm", | 109145 /* 180 */ "inscollist ::= nm", 108959 /* 183 */ "expr ::= term", | 109146 /* 181 */ "expr ::= term", 108960 /* 184 */ "expr ::= LP expr RP", | 109147 /* 182 */ "expr ::= LP expr RP", 108961 /* 185 */ "term ::= NULL", | 109148 /* 183 */ "term ::= NULL", 108962 /* 186 */ "expr ::= id", | 109149 /* 184 */ "expr ::= id", 108963 /* 187 */ "expr ::= JOIN_KW", | 109150 /* 185 */ "expr ::= JOIN_KW", 108964 /* 188 */ "expr ::= nm DOT nm", | 109151 /* 186 */ "expr ::= nm DOT nm", 108965 /* 189 */ "expr ::= nm DOT nm DOT nm", | 109152 /* 187 */ "expr ::= nm DOT nm DOT nm", 108966 /* 190 */ "term ::= INTEGER|FLOAT|BLOB", | 109153 /* 188 */ "term ::= INTEGER|FLOAT|BLOB", 108967 /* 191 */ "term ::= STRING", | 109154 /* 189 */ "term ::= STRING", 108968 /* 192 */ "expr ::= REGISTER", | 109155 /* 190 */ "expr ::= REGISTER", 108969 /* 193 */ "expr ::= VARIABLE", | 109156 /* 191 */ "expr ::= VARIABLE", 108970 /* 194 */ "expr ::= expr COLLATE ids", | 109157 /* 192 */ "expr ::= expr COLLATE ids", 108971 /* 195 */ "expr ::= CAST LP expr AS typetoken RP", | 109158 /* 193 */ "expr ::= CAST LP expr AS typetoken RP", 108972 /* 196 */ "expr ::= ID LP distinct exprlist RP", | 109159 /* 194 */ "expr ::= ID LP distinct exprlist RP", 108973 /* 197 */ "expr ::= ID LP STAR RP", | 109160 /* 195 */ "expr ::= ID LP STAR RP", 108974 /* 198 */ "term ::= CTIME_KW", | 109161 /* 196 */ "term ::= CTIME_KW", 108975 /* 199 */ "expr ::= expr AND expr", | 109162 /* 197 */ "expr ::= expr AND expr", 108976 /* 200 */ "expr ::= expr OR expr", | 109163 /* 198 */ "expr ::= expr OR expr", 108977 /* 201 */ "expr ::= expr LT|GT|GE|LE expr", | 109164 /* 199 */ "expr ::= expr LT|GT|GE|LE expr", 108978 /* 202 */ "expr ::= expr EQ|NE expr", | 109165 /* 200 */ "expr ::= expr EQ|NE expr", 108979 /* 203 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", | 109166 /* 201 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", 108980 /* 204 */ "expr ::= expr PLUS|MINUS expr", | 109167 /* 202 */ "expr ::= expr PLUS|MINUS expr", 108981 /* 205 */ "expr ::= expr STAR|SLASH|REM expr", | 109168 /* 203 */ "expr ::= expr STAR|SLASH|REM expr", 108982 /* 206 */ "expr ::= expr CONCAT expr", | 109169 /* 204 */ "expr ::= expr CONCAT expr", 108983 /* 207 */ "likeop ::= LIKE_KW", | 109170 /* 205 */ "likeop ::= LIKE_KW", 108984 /* 208 */ "likeop ::= NOT LIKE_KW", | 109171 /* 206 */ "likeop ::= NOT LIKE_KW", 108985 /* 209 */ "likeop ::= MATCH", | 109172 /* 207 */ "likeop ::= MATCH", 108986 /* 210 */ "likeop ::= NOT MATCH", | 109173 /* 208 */ "likeop ::= NOT MATCH", 108987 /* 211 */ "expr ::= expr likeop expr", | 109174 /* 209 */ "expr ::= expr likeop expr", 108988 /* 212 */ "expr ::= expr likeop expr ESCAPE expr", | 109175 /* 210 */ "expr ::= expr likeop expr ESCAPE expr", 108989 /* 213 */ "expr ::= expr ISNULL|NOTNULL", | 109176 /* 211 */ "expr ::= expr ISNULL|NOTNULL", 108990 /* 214 */ "expr ::= expr NOT NULL", | 109177 /* 212 */ "expr ::= expr NOT NULL", 108991 /* 215 */ "expr ::= expr IS expr", | 109178 /* 213 */ "expr ::= expr IS expr", 108992 /* 216 */ "expr ::= expr IS NOT expr", | 109179 /* 214 */ "expr ::= expr IS NOT expr", 108993 /* 217 */ "expr ::= NOT expr", | 109180 /* 215 */ "expr ::= NOT expr", 108994 /* 218 */ "expr ::= BITNOT expr", | 109181 /* 216 */ "expr ::= BITNOT expr", 108995 /* 219 */ "expr ::= MINUS expr", | 109182 /* 217 */ "expr ::= MINUS expr", 108996 /* 220 */ "expr ::= PLUS expr", | 109183 /* 218 */ "expr ::= PLUS expr", 108997 /* 221 */ "between_op ::= BETWEEN", | 109184 /* 219 */ "between_op ::= BETWEEN", 108998 /* 222 */ "between_op ::= NOT BETWEEN", | 109185 /* 220 */ "between_op ::= NOT BETWEEN", 108999 /* 223 */ "expr ::= expr between_op expr AND expr", | 109186 /* 221 */ "expr ::= expr between_op expr AND expr", 109000 /* 224 */ "in_op ::= IN", | 109187 /* 222 */ "in_op ::= IN", 109001 /* 225 */ "in_op ::= NOT IN", | 109188 /* 223 */ "in_op ::= NOT IN", 109002 /* 226 */ "expr ::= expr in_op LP exprlist RP", | 109189 /* 224 */ "expr ::= expr in_op LP exprlist RP", 109003 /* 227 */ "expr ::= LP select RP", | 109190 /* 225 */ "expr ::= LP select RP", 109004 /* 228 */ "expr ::= expr in_op LP select RP", | 109191 /* 226 */ "expr ::= expr in_op LP select RP", 109005 /* 229 */ "expr ::= expr in_op nm dbnm", | 109192 /* 227 */ "expr ::= expr in_op nm dbnm", 109006 /* 230 */ "expr ::= EXISTS LP select RP", | 109193 /* 228 */ "expr ::= EXISTS LP select RP", 109007 /* 231 */ "expr ::= CASE case_operand case_exprlist case_else END", | 109194 /* 229 */ "expr ::= CASE case_operand case_exprlist case_else END", 109008 /* 232 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", | 109195 /* 230 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", 109009 /* 233 */ "case_exprlist ::= WHEN expr THEN expr", | 109196 /* 231 */ "case_exprlist ::= WHEN expr THEN expr", 109010 /* 234 */ "case_else ::= ELSE expr", | 109197 /* 232 */ "case_else ::= ELSE expr", 109011 /* 235 */ "case_else ::=", | 109198 /* 233 */ "case_else ::=", 109012 /* 236 */ "case_operand ::= expr", | 109199 /* 234 */ "case_operand ::= expr", 109013 /* 237 */ "case_operand ::=", | 109200 /* 235 */ "case_operand ::=", 109014 /* 238 */ "exprlist ::= nexprlist", | 109201 /* 236 */ "exprlist ::= nexprlist", 109015 /* 239 */ "exprlist ::=", | 109202 /* 237 */ "exprlist ::=", 109016 /* 240 */ "nexprlist ::= nexprlist COMMA expr", | 109203 /* 238 */ "nexprlist ::= nexprlist COMMA expr", 109017 /* 241 */ "nexprlist ::= expr", | 109204 /* 239 */ "nexprlist ::= expr", 109018 /* 242 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxli | 109205 /* 240 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxli 109019 /* 243 */ "uniqueflag ::= UNIQUE", | 109206 /* 241 */ "uniqueflag ::= UNIQUE", 109020 /* 244 */ "uniqueflag ::=", | 109207 /* 242 */ "uniqueflag ::=", 109021 /* 245 */ "idxlist_opt ::=", | 109208 /* 243 */ "idxlist_opt ::=", 109022 /* 246 */ "idxlist_opt ::= LP idxlist RP", | 109209 /* 244 */ "idxlist_opt ::= LP idxlist RP", 109023 /* 247 */ "idxlist ::= idxlist COMMA nm collate sortorder", | 109210 /* 245 */ "idxlist ::= idxlist COMMA nm collate sortorder", 109024 /* 248 */ "idxlist ::= nm collate sortorder", | 109211 /* 246 */ "idxlist ::= nm collate sortorder", 109025 /* 249 */ "collate ::=", | 109212 /* 247 */ "collate ::=", 109026 /* 250 */ "collate ::= COLLATE ids", | 109213 /* 248 */ "collate ::= COLLATE ids", 109027 /* 251 */ "cmd ::= DROP INDEX ifexists fullname", | 109214 /* 249 */ "cmd ::= DROP INDEX ifexists fullname", 109028 /* 252 */ "cmd ::= VACUUM", | 109215 /* 250 */ "cmd ::= VACUUM", 109029 /* 253 */ "cmd ::= VACUUM nm", | 109216 /* 251 */ "cmd ::= VACUUM nm", 109030 /* 254 */ "cmd ::= PRAGMA nm dbnm", | 109217 /* 252 */ "cmd ::= PRAGMA nm dbnm", 109031 /* 255 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", | 109218 /* 253 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", 109032 /* 256 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", | 109219 /* 254 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", 109033 /* 257 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", | 109220 /* 255 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", 109034 /* 258 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", | 109221 /* 256 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", 109035 /* 259 */ "nmnum ::= plus_num", | 109222 /* 257 */ "nmnum ::= plus_num", 109036 /* 260 */ "nmnum ::= nm", | 109223 /* 258 */ "nmnum ::= nm", 109037 /* 261 */ "nmnum ::= ON", | 109224 /* 259 */ "nmnum ::= ON", 109038 /* 262 */ "nmnum ::= DELETE", | 109225 /* 260 */ "nmnum ::= DELETE", 109039 /* 263 */ "nmnum ::= DEFAULT", | 109226 /* 261 */ "nmnum ::= DEFAULT", 109040 /* 264 */ "plus_num ::= PLUS number", | 109227 /* 262 */ "plus_num ::= PLUS number", 109041 /* 265 */ "plus_num ::= number", | 109228 /* 263 */ "plus_num ::= number", 109042 /* 266 */ "minus_num ::= MINUS number", | 109229 /* 264 */ "minus_num ::= MINUS number", 109043 /* 267 */ "number ::= INTEGER|FLOAT", | 109230 /* 265 */ "number ::= INTEGER|FLOAT", 109044 /* 268 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", | 109231 /* 266 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", 109045 /* 269 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigg | 109232 /* 267 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigg 109046 /* 270 */ "trigger_time ::= BEFORE", | 109233 /* 268 */ "trigger_time ::= BEFORE", 109047 /* 271 */ "trigger_time ::= AFTER", | 109234 /* 269 */ "trigger_time ::= AFTER", 109048 /* 272 */ "trigger_time ::= INSTEAD OF", | 109235 /* 270 */ "trigger_time ::= INSTEAD OF", 109049 /* 273 */ "trigger_time ::=", | 109236 /* 271 */ "trigger_time ::=", 109050 /* 274 */ "trigger_event ::= DELETE|INSERT", | 109237 /* 272 */ "trigger_event ::= DELETE|INSERT", 109051 /* 275 */ "trigger_event ::= UPDATE", | 109238 /* 273 */ "trigger_event ::= UPDATE", 109052 /* 276 */ "trigger_event ::= UPDATE OF inscollist", | 109239 /* 274 */ "trigger_event ::= UPDATE OF inscollist", 109053 /* 277 */ "foreach_clause ::=", | 109240 /* 275 */ "foreach_clause ::=", 109054 /* 278 */ "foreach_clause ::= FOR EACH ROW", | 109241 /* 276 */ "foreach_clause ::= FOR EACH ROW", 109055 /* 279 */ "when_clause ::=", | 109242 /* 277 */ "when_clause ::=", 109056 /* 280 */ "when_clause ::= WHEN expr", | 109243 /* 278 */ "when_clause ::= WHEN expr", 109057 /* 281 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", | 109244 /* 279 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", 109058 /* 282 */ "trigger_cmd_list ::= trigger_cmd SEMI", | 109245 /* 280 */ "trigger_cmd_list ::= trigger_cmd SEMI", 109059 /* 283 */ "trnm ::= nm", | 109246 /* 281 */ "trnm ::= nm", 109060 /* 284 */ "trnm ::= nm DOT nm", | 109247 /* 282 */ "trnm ::= nm DOT nm", 109061 /* 285 */ "tridxby ::=", | 109248 /* 283 */ "tridxby ::=", 109062 /* 286 */ "tridxby ::= INDEXED BY nm", | 109249 /* 284 */ "tridxby ::= INDEXED BY nm", 109063 /* 287 */ "tridxby ::= NOT INDEXED", | 109250 /* 285 */ "tridxby ::= NOT INDEXED", 109064 /* 288 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt", | 109251 /* 286 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt", 109065 /* 289 */ "trigger_cmd ::= insert_cmd INTO trnm inscollist_opt valuelist", | 109252 /* 287 */ "trigger_cmd ::= insert_cmd INTO trnm inscollist_opt valuelist", 109066 /* 290 */ "trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select", | 109253 /* 288 */ "trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select", 109067 /* 291 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt", | 109254 /* 289 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt", 109068 /* 292 */ "trigger_cmd ::= select", | 109255 /* 290 */ "trigger_cmd ::= select", 109069 /* 293 */ "expr ::= RAISE LP IGNORE RP", | 109256 /* 291 */ "expr ::= RAISE LP IGNORE RP", 109070 /* 294 */ "expr ::= RAISE LP raisetype COMMA nm RP", | 109257 /* 292 */ "expr ::= RAISE LP raisetype COMMA nm RP", 109071 /* 295 */ "raisetype ::= ROLLBACK", | 109258 /* 293 */ "raisetype ::= ROLLBACK", 109072 /* 296 */ "raisetype ::= ABORT", | 109259 /* 294 */ "raisetype ::= ABORT", 109073 /* 297 */ "raisetype ::= FAIL", | 109260 /* 295 */ "raisetype ::= FAIL", 109074 /* 298 */ "cmd ::= DROP TRIGGER ifexists fullname", | 109261 /* 296 */ "cmd ::= DROP TRIGGER ifexists fullname", 109075 /* 299 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", | 109262 /* 297 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", 109076 /* 300 */ "cmd ::= DETACH database_kw_opt expr", | 109263 /* 298 */ "cmd ::= DETACH database_kw_opt expr", 109077 /* 301 */ "key_opt ::=", | 109264 /* 299 */ "key_opt ::=", 109078 /* 302 */ "key_opt ::= KEY expr", | 109265 /* 300 */ "key_opt ::= KEY expr", 109079 /* 303 */ "database_kw_opt ::= DATABASE", | 109266 /* 301 */ "database_kw_opt ::= DATABASE", 109080 /* 304 */ "database_kw_opt ::=", | 109267 /* 302 */ "database_kw_opt ::=", 109081 /* 305 */ "cmd ::= REINDEX", | 109268 /* 303 */ "cmd ::= REINDEX", 109082 /* 306 */ "cmd ::= REINDEX nm dbnm", | 109269 /* 304 */ "cmd ::= REINDEX nm dbnm", 109083 /* 307 */ "cmd ::= ANALYZE", | 109270 /* 305 */ "cmd ::= ANALYZE", 109084 /* 308 */ "cmd ::= ANALYZE nm dbnm", | 109271 /* 306 */ "cmd ::= ANALYZE nm dbnm", 109085 /* 309 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", | 109272 /* 307 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", 109086 /* 310 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column", | 109273 /* 308 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column", 109087 /* 311 */ "add_column_fullname ::= fullname", | 109274 /* 309 */ "add_column_fullname ::= fullname", 109088 /* 312 */ "kwcolumn_opt ::=", | 109275 /* 310 */ "kwcolumn_opt ::=", 109089 /* 313 */ "kwcolumn_opt ::= COLUMNKW", | 109276 /* 311 */ "kwcolumn_opt ::= COLUMNKW", 109090 /* 314 */ "cmd ::= create_vtab", | 109277 /* 312 */ "cmd ::= create_vtab", 109091 /* 315 */ "cmd ::= create_vtab LP vtabarglist RP", | 109278 /* 313 */ "cmd ::= create_vtab LP vtabarglist RP", 109092 /* 316 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm" | 109279 /* 314 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm" 109093 /* 317 */ "vtabarglist ::= vtabarg", | 109280 /* 315 */ "vtabarglist ::= vtabarg", 109094 /* 318 */ "vtabarglist ::= vtabarglist COMMA vtabarg", | 109281 /* 316 */ "vtabarglist ::= vtabarglist COMMA vtabarg", 109095 /* 319 */ "vtabarg ::=", | 109282 /* 317 */ "vtabarg ::=", 109096 /* 320 */ "vtabarg ::= vtabarg vtabargtoken", | 109283 /* 318 */ "vtabarg ::= vtabarg vtabargtoken", 109097 /* 321 */ "vtabargtoken ::= ANY", | 109284 /* 319 */ "vtabargtoken ::= ANY", 109098 /* 322 */ "vtabargtoken ::= lp anylist RP", | 109285 /* 320 */ "vtabargtoken ::= lp anylist RP", 109099 /* 323 */ "lp ::= LP", | 109286 /* 321 */ "lp ::= LP", 109100 /* 324 */ "anylist ::=", | 109287 /* 322 */ "anylist ::=", 109101 /* 325 */ "anylist ::= anylist LP anylist RP", | 109288 /* 323 */ "anylist ::= anylist LP anylist RP", 109102 /* 326 */ "anylist ::= anylist ANY", | 109289 /* 324 */ "anylist ::= anylist ANY", 109103 }; 109290 }; 109104 #endif /* NDEBUG */ 109291 #endif /* NDEBUG */ 109105 109292 109106 109293 109107 #if YYSTACKDEPTH<=0 109294 #if YYSTACKDEPTH<=0 109108 /* 109295 /* 109109 ** Try to increase the size of the parser stack. 109296 ** Try to increase the size of the parser stack. ................................................................................................................................................................................ 109541 { 167, 1 }, 109728 { 167, 1 }, 109542 { 167, 4 }, 109729 { 167, 4 }, 109543 { 167, 6 }, 109730 { 167, 6 }, 109544 { 168, 1 }, 109731 { 168, 1 }, 109545 { 168, 2 }, 109732 { 168, 2 }, 109546 { 169, 1 }, 109733 { 169, 1 }, 109547 { 169, 1 }, 109734 { 169, 1 }, 109548 { 164, 2 }, | 109735 { 164, 3 }, 109549 { 164, 0 }, 109736 { 164, 0 }, 109550 { 172, 3 }, | 109737 { 172, 2 }, 109551 { 172, 1 }, | 109738 { 172, 0 }, 109552 { 173, 2 }, 109739 { 173, 2 }, 109553 { 173, 4 }, 109740 { 173, 4 }, 109554 { 173, 3 }, 109741 { 173, 3 }, 109555 { 173, 3 }, 109742 { 173, 3 }, 109556 { 173, 2 }, 109743 { 173, 2 }, 109557 { 173, 2 }, 109744 { 173, 2 }, 109558 { 173, 3 }, 109745 { 173, 3 }, ................................................................................................................................................................................ 109578 { 181, 3 }, 109765 { 181, 3 }, 109579 { 181, 2 }, 109766 { 181, 2 }, 109580 { 184, 0 }, 109767 { 184, 0 }, 109581 { 184, 2 }, 109768 { 184, 2 }, 109582 { 184, 2 }, 109769 { 184, 2 }, 109583 { 159, 0 }, 109770 { 159, 0 }, 109584 { 159, 2 }, 109771 { 159, 2 }, 109585 { 185, 3 }, | 109772 { 185, 4 }, 109586 { 185, 2 }, 109773 { 185, 2 }, 109587 { 185, 1 }, < 109588 { 186, 2 }, < 109589 { 186, 7 }, 109774 { 186, 7 }, 109590 { 186, 5 }, 109775 { 186, 5 }, 109591 { 186, 5 }, 109776 { 186, 5 }, 109592 { 186, 10 }, 109777 { 186, 10 }, 109593 { 188, 0 }, 109778 { 188, 0 }, 109594 { 188, 1 }, 109779 { 188, 1 }, 109595 { 176, 0 }, 109780 { 176, 0 }, ................................................................................................................................................................................ 109890 break; 110075 break; 109891 case 13: /* transtype ::= */ 110076 case 13: /* transtype ::= */ 109892 {yygotominor.yy392 = TK_DEFERRED;} 110077 {yygotominor.yy392 = TK_DEFERRED;} 109893 break; 110078 break; 109894 case 14: /* transtype ::= DEFERRED */ 110079 case 14: /* transtype ::= DEFERRED */ 109895 case 15: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==15); 110080 case 15: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==15); 109896 case 16: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==16); 110081 case 16: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==16); 109897 case 115: /* multiselect_op ::= UNION */ yytestcase(yyruleno==115); | 110082 case 113: /* multiselect_op ::= UNION */ yytestcase(yyruleno==113); 109898 case 117: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==1 | 110083 case 115: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==1 109899 {yygotominor.yy392 = yymsp[0].major;} 110084 {yygotominor.yy392 = yymsp[0].major;} 109900 break; 110085 break; 109901 case 17: /* cmd ::= COMMIT trans_opt */ 110086 case 17: /* cmd ::= COMMIT trans_opt */ 109902 case 18: /* cmd ::= END trans_opt */ yytestcase(yyruleno==18); 110087 case 18: /* cmd ::= END trans_opt */ yytestcase(yyruleno==18); 109903 {sqlite3CommitTransaction(pParse);} 110088 {sqlite3CommitTransaction(pParse);} 109904 break; 110089 break; 109905 case 19: /* cmd ::= ROLLBACK trans_opt */ 110090 case 19: /* cmd ::= ROLLBACK trans_opt */ ................................................................................................................................................................................ 109933 break; 110118 break; 109934 case 28: /* ifnotexists ::= */ 110119 case 28: /* ifnotexists ::= */ 109935 case 31: /* temp ::= */ yytestcase(yyruleno==31); 110120 case 31: /* temp ::= */ yytestcase(yyruleno==31); 109936 case 70: /* autoinc ::= */ yytestcase(yyruleno==70); 110121 case 70: /* autoinc ::= */ yytestcase(yyruleno==70); 109937 case 83: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ y 110122 case 83: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ y 109938 case 85: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==85); 110123 case 85: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==85); 109939 case 87: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ yytestcase(y 110124 case 87: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ yytestcase(y 109940 case 98: /* defer_subclause_opt ::= */ yytestcase(yyruleno==98); | 110125 case 96: /* defer_subclause_opt ::= */ yytestcase(yyruleno==96); 109941 case 109: /* ifexists ::= */ yytestcase(yyruleno==109); | 110126 case 107: /* ifexists ::= */ yytestcase(yyruleno==107); 109942 case 120: /* distinct ::= ALL */ yytestcase(yyruleno==120); | 110127 case 118: /* distinct ::= ALL */ yytestcase(yyruleno==118); 109943 case 121: /* distinct ::= */ yytestcase(yyruleno==121); | 110128 case 119: /* distinct ::= */ yytestcase(yyruleno==119); 109944 case 221: /* between_op ::= BETWEEN */ yytestcase(yyruleno==221); | 110129 case 219: /* between_op ::= BETWEEN */ yytestcase(yyruleno==219); 109945 case 224: /* in_op ::= IN */ yytestcase(yyruleno==224); | 110130 case 222: /* in_op ::= IN */ yytestcase(yyruleno==222); 109946 {yygotominor.yy392 = 0;} 110131 {yygotominor.yy392 = 0;} 109947 break; 110132 break; 109948 case 29: /* ifnotexists ::= IF NOT EXISTS */ 110133 case 29: /* ifnotexists ::= IF NOT EXISTS */ 109949 case 30: /* temp ::= TEMP */ yytestcase(yyruleno==30); 110134 case 30: /* temp ::= TEMP */ yytestcase(yyruleno==30); 109950 case 71: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==71); 110135 case 71: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==71); 109951 case 86: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ yytestcase(yy 110136 case 86: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ yytestcase(yy 109952 case 108: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==108); | 110137 case 106: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==106); 109953 case 119: /* distinct ::= DISTINCT */ yytestcase(yyruleno==119); | 110138 case 117: /* distinct ::= DISTINCT */ yytestcase(yyruleno==117); 109954 case 222: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==222); | 110139 case 220: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==220); 109955 case 225: /* in_op ::= NOT IN */ yytestcase(yyruleno==225); | 110140 case 223: /* in_op ::= NOT IN */ yytestcase(yyruleno==223); 109956 {yygotominor.yy392 = 1;} 110141 {yygotominor.yy392 = 1;} 109957 break; 110142 break; 109958 case 32: /* create_table_args ::= LP columnlist conslist_opt RP */ 110143 case 32: /* create_table_args ::= LP columnlist conslist_opt RP */ 109959 { 110144 { 109960 sqlite3EndTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0); 110145 sqlite3EndTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0); 109961 } 110146 } 109962 break; 110147 break; ................................................................................................................................................................................ 109982 case 39: /* id ::= INDEXED */ yytestcase(yyruleno==39); 110167 case 39: /* id ::= INDEXED */ yytestcase(yyruleno==39); 109983 case 40: /* ids ::= ID|STRING */ yytestcase(yyruleno==40); 110168 case 40: /* ids ::= ID|STRING */ yytestcase(yyruleno==40); 109984 case 41: /* nm ::= id */ yytestcase(yyruleno==41); 110169 case 41: /* nm ::= id */ yytestcase(yyruleno==41); 109985 case 42: /* nm ::= STRING */ yytestcase(yyruleno==42); 110170 case 42: /* nm ::= STRING */ yytestcase(yyruleno==42); 109986 case 43: /* nm ::= JOIN_KW */ yytestcase(yyruleno==43); 110171 case 43: /* nm ::= JOIN_KW */ yytestcase(yyruleno==43); 109987 case 46: /* typetoken ::= typename */ yytestcase(yyruleno==46); 110172 case 46: /* typetoken ::= typename */ yytestcase(yyruleno==46); 109988 case 49: /* typename ::= ids */ yytestcase(yyruleno==49); 110173 case 49: /* typename ::= ids */ yytestcase(yyruleno==49); 109989 case 127: /* as ::= AS nm */ yytestcase(yyruleno==127); | 110174 case 125: /* as ::= AS nm */ yytestcase(yyruleno==125); 109990 case 128: /* as ::= ids */ yytestcase(yyruleno==128); | 110175 case 126: /* as ::= ids */ yytestcase(yyruleno==126); 109991 case 138: /* dbnm ::= DOT nm */ yytestcase(yyruleno==138); | 110176 case 136: /* dbnm ::= DOT nm */ yytestcase(yyruleno==136); 109992 case 147: /* indexed_opt ::= INDEXED BY nm */ yytestcase(yyruleno==147); | 110177 case 145: /* indexed_opt ::= INDEXED BY nm */ yytestcase(yyruleno==145); 109993 case 250: /* collate ::= COLLATE ids */ yytestcase(yyruleno==250); | 110178 case 248: /* collate ::= COLLATE ids */ yytestcase(yyruleno==248); 109994 case 259: /* nmnum ::= plus_num */ yytestcase(yyruleno==259); | 110179 case 257: /* nmnum ::= plus_num */ yytestcase(yyruleno==257); 109995 case 260: /* nmnum ::= nm */ yytestcase(yyruleno==260); | 110180 case 258: /* nmnum ::= nm */ yytestcase(yyruleno==258); 109996 case 261: /* nmnum ::= ON */ yytestcase(yyruleno==261); | 110181 case 259: /* nmnum ::= ON */ yytestcase(yyruleno==259); 109997 case 262: /* nmnum ::= DELETE */ yytestcase(yyruleno==262); | 110182 case 260: /* nmnum ::= DELETE */ yytestcase(yyruleno==260); 109998 case 263: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==263); | 110183 case 261: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==261); 109999 case 264: /* plus_num ::= PLUS number */ yytestcase(yyruleno==264); | 110184 case 262: /* plus_num ::= PLUS number */ yytestcase(yyruleno==262); 110000 case 265: /* plus_num ::= number */ yytestcase(yyruleno==265); | 110185 case 263: /* plus_num ::= number */ yytestcase(yyruleno==263); 110001 case 266: /* minus_num ::= MINUS number */ yytestcase(yyruleno==266); | 110186 case 264: /* minus_num ::= MINUS number */ yytestcase(yyruleno==264); 110002 case 267: /* number ::= INTEGER|FLOAT */ yytestcase(yyruleno==267); | 110187 case 265: /* number ::= INTEGER|FLOAT */ yytestcase(yyruleno==265); 110003 case 283: /* trnm ::= nm */ yytestcase(yyruleno==283); | 110188 case 281: /* trnm ::= nm */ yytestcase(yyruleno==281); 110004 {yygotominor.yy0 = yymsp[0].minor.yy0;} 110189 {yygotominor.yy0 = yymsp[0].minor.yy0;} 110005 break; 110190 break; 110006 case 45: /* type ::= typetoken */ 110191 case 45: /* type ::= typetoken */ 110007 {sqlite3AddColumnType(pParse,&yymsp[0].minor.yy0);} 110192 {sqlite3AddColumnType(pParse,&yymsp[0].minor.yy0);} 110008 break; 110193 break; 110009 case 47: /* typetoken ::= typename LP signed RP */ 110194 case 47: /* typetoken ::= typename LP signed RP */ 110010 { 110195 { ................................................................................................................................................................................ 110016 { 110201 { 110017 yygotominor.yy0.z = yymsp[-5].minor.yy0.z; 110202 yygotominor.yy0.z = yymsp[-5].minor.yy0.z; 110018 yygotominor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[ 110203 yygotominor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[ 110019 } 110204 } 110020 break; 110205 break; 110021 case 50: /* typename ::= typename ids */ 110206 case 50: /* typename ::= typename ids */ 110022 {yygotominor.yy0.z=yymsp[-1].minor.yy0.z; yygotominor.yy0.n=yymsp[0].minor.yy0.n 110207 {yygotominor.yy0.z=yymsp[-1].minor.yy0.z; yygotominor.yy0.n=yymsp[0].minor.yy0.n > 110208 break; > 110209 case 55: /* cname ::= CONSTRAINT nm */ > 110210 {pParse->constraintName = yymsp[0].minor.yy0;} > 110211 break; > 110212 case 56: /* cname ::= */ > 110213 {pParse->constraintName.n = 0;} 110023 break; 110214 break; 110024 case 57: /* ccons ::= DEFAULT term */ 110215 case 57: /* ccons ::= DEFAULT term */ 110025 case 59: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==59); 110216 case 59: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==59); 110026 {sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy342);} 110217 {sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy342);} 110027 break; 110218 break; 110028 case 58: /* ccons ::= DEFAULT LP expr RP */ 110219 case 58: /* ccons ::= DEFAULT LP expr RP */ 110029 {sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy342);} 110220 {sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy342);} ................................................................................................................................................................................ 110093 case 81: /* refact ::= RESTRICT */ 110284 case 81: /* refact ::= RESTRICT */ 110094 { yygotominor.yy392 = OE_Restrict; /* EV: R-33326-45252 */} 110285 { yygotominor.yy392 = OE_Restrict; /* EV: R-33326-45252 */} 110095 break; 110286 break; 110096 case 82: /* refact ::= NO ACTION */ 110287 case 82: /* refact ::= NO ACTION */ 110097 { yygotominor.yy392 = OE_None; /* EV: R-33326-45252 */} 110288 { yygotominor.yy392 = OE_None; /* EV: R-33326-45252 */} 110098 break; 110289 break; 110099 case 84: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ 110290 case 84: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ 110100 case 99: /* defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno | 110291 case 97: /* defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno 110101 case 101: /* onconf ::= ON CONFLICT resolvetype */ yytestcase(yyruleno==10 | 110292 case 99: /* onconf ::= ON CONFLICT resolvetype */ yytestcase(yyruleno==99) 110102 case 104: /* resolvetype ::= raisetype */ yytestcase(yyruleno==104); | 110293 case 102: /* resolvetype ::= raisetype */ yytestcase(yyruleno==102); 110103 {yygotominor.yy392 = yymsp[0].minor.yy392;} 110294 {yygotominor.yy392 = yymsp[0].minor.yy392;} 110104 break; 110295 break; 110105 case 88: /* conslist_opt ::= */ 110296 case 88: /* conslist_opt ::= */ 110106 {yygotominor.yy0.n = 0; yygotominor.yy0.z = 0;} 110297 {yygotominor.yy0.n = 0; yygotominor.yy0.z = 0;} 110107 break; 110298 break; 110108 case 89: /* conslist_opt ::= COMMA conslist */ 110299 case 89: /* conslist_opt ::= COMMA conslist */ 110109 {yygotominor.yy0 = yymsp[-1].minor.yy0;} 110300 {yygotominor.yy0 = yymsp[-1].minor.yy0;} 110110 break; 110301 break; 110111 case 94: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */ | 110302 case 92: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */ 110112 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy442,yymsp[0].minor.yy392,yymsp[-2 110303 {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy442,yymsp[0].minor.yy392,yymsp[-2 110113 break; 110304 break; 110114 case 95: /* tcons ::= UNIQUE LP idxlist RP onconf */ | 110305 case 93: /* tcons ::= UNIQUE LP idxlist RP onconf */ 110115 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy442,yymsp[0].minor.yy392,0,0, 110306 {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy442,yymsp[0].minor.yy392,0,0, 110116 break; 110307 break; 110117 case 96: /* tcons ::= CHECK LP expr RP onconf */ | 110308 case 94: /* tcons ::= CHECK LP expr RP onconf */ 110118 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy342.pExpr);} 110309 {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy342.pExpr);} 110119 break; 110310 break; 110120 case 97: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt | 110311 case 95: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt 110121 { 110312 { 110122 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy442, &yymsp[-3].minor.yy0, 110313 sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy442, &yymsp[-3].minor.yy0, 110123 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy392); 110314 sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy392); 110124 } 110315 } 110125 break; 110316 break; 110126 case 100: /* onconf ::= */ | 110317 case 98: /* onconf ::= */ 110127 {yygotominor.yy392 = OE_Default;} 110318 {yygotominor.yy392 = OE_Default;} 110128 break; 110319 break; 110129 case 102: /* orconf ::= */ | 110320 case 100: /* orconf ::= */ 110130 {yygotominor.yy258 = OE_Default;} 110321 {yygotominor.yy258 = OE_Default;} 110131 break; 110322 break; 110132 case 103: /* orconf ::= OR resolvetype */ | 110323 case 101: /* orconf ::= OR resolvetype */ 110133 {yygotominor.yy258 = (u8)yymsp[0].minor.yy392;} 110324 {yygotominor.yy258 = (u8)yymsp[0].minor.yy392;} 110134 break; 110325 break; 110135 case 105: /* resolvetype ::= IGNORE */ | 110326 case 103: /* resolvetype ::= IGNORE */ 110136 {yygotominor.yy392 = OE_Ignore;} 110327 {yygotominor.yy392 = OE_Ignore;} 110137 break; 110328 break; 110138 case 106: /* resolvetype ::= REPLACE */ | 110329 case 104: /* resolvetype ::= REPLACE */ 110139 {yygotominor.yy392 = OE_Replace;} 110330 {yygotominor.yy392 = OE_Replace;} 110140 break; 110331 break; 110141 case 107: /* cmd ::= DROP TABLE ifexists fullname */ | 110332 case 105: /* cmd ::= DROP TABLE ifexists fullname */ 110142 { 110333 { 110143 sqlite3DropTable(pParse, yymsp[0].minor.yy347, 0, yymsp[-1].minor.yy392); 110334 sqlite3DropTable(pParse, yymsp[0].minor.yy347, 0, yymsp[-1].minor.yy392); 110144 } 110335 } 110145 break; 110336 break; 110146 case 110: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm AS select */ | 110337 case 108: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm AS select */ 110147 { 110338 { 110148 sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[- 110339 sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[- 110149 } 110340 } 110150 break; 110341 break; 110151 case 111: /* cmd ::= DROP VIEW ifexists fullname */ | 110342 case 109: /* cmd ::= DROP VIEW ifexists fullname */ 110152 { 110343 { 110153 sqlite3DropTable(pParse, yymsp[0].minor.yy347, 1, yymsp[-1].minor.yy392); 110344 sqlite3DropTable(pParse, yymsp[0].minor.yy347, 1, yymsp[-1].minor.yy392); 110154 } 110345 } 110155 break; 110346 break; 110156 case 112: /* cmd ::= select */ | 110347 case 110: /* cmd ::= select */ 110157 { 110348 { 110158 SelectDest dest = {SRT_Output, 0, 0, 0, 0}; 110349 SelectDest dest = {SRT_Output, 0, 0, 0, 0}; 110159 sqlite3Select(pParse, yymsp[0].minor.yy159, &dest); 110350 sqlite3Select(pParse, yymsp[0].minor.yy159, &dest); 110160 sqlite3ExplainBegin(pParse->pVdbe); 110351 sqlite3ExplainBegin(pParse->pVdbe); 110161 sqlite3ExplainSelect(pParse->pVdbe, yymsp[0].minor.yy159); 110352 sqlite3ExplainSelect(pParse->pVdbe, yymsp[0].minor.yy159); 110162 sqlite3ExplainFinish(pParse->pVdbe); 110353 sqlite3ExplainFinish(pParse->pVdbe); 110163 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy159); 110354 sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy159); 110164 } 110355 } 110165 break; 110356 break; 110166 case 113: /* select ::= oneselect */ | 110357 case 111: /* select ::= oneselect */ 110167 {yygotominor.yy159 = yymsp[0].minor.yy159;} 110358 {yygotominor.yy159 = yymsp[0].minor.yy159;} 110168 break; 110359 break; 110169 case 114: /* select ::= select multiselect_op oneselect */ | 110360 case 112: /* select ::= select multiselect_op oneselect */ 110170 { 110361 { 110171 if( yymsp[0].minor.yy159 ){ 110362 if( yymsp[0].minor.yy159 ){ 110172 yymsp[0].minor.yy159->op = (u8)yymsp[-1].minor.yy392; 110363 yymsp[0].minor.yy159->op = (u8)yymsp[-1].minor.yy392; 110173 yymsp[0].minor.yy159->pPrior = yymsp[-2].minor.yy159; 110364 yymsp[0].minor.yy159->pPrior = yymsp[-2].minor.yy159; 110174 }else{ 110365 }else{ 110175 sqlite3SelectDelete(pParse->db, yymsp[-2].minor.yy159); 110366 sqlite3SelectDelete(pParse->db, yymsp[-2].minor.yy159); 110176 } 110367 } 110177 yygotominor.yy159 = yymsp[0].minor.yy159; 110368 yygotominor.yy159 = yymsp[0].minor.yy159; 110178 } 110369 } 110179 break; 110370 break; 110180 case 116: /* multiselect_op ::= UNION ALL */ | 110371 case 114: /* multiselect_op ::= UNION ALL */ 110181 {yygotominor.yy392 = TK_ALL;} 110372 {yygotominor.yy392 = TK_ALL;} 110182 break; 110373 break; 110183 case 118: /* oneselect ::= SELECT distinct selcollist from where_opt group | 110374 case 116: /* oneselect ::= SELECT distinct selcollist from where_opt group 110184 { 110375 { 110185 yygotominor.yy159 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy442,yymsp[-5].mi 110376 yygotominor.yy159 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy442,yymsp[-5].mi 110186 } 110377 } 110187 break; 110378 break; 110188 case 122: /* sclp ::= selcollist COMMA */ | 110379 case 120: /* sclp ::= selcollist COMMA */ 110189 case 246: /* idxlist_opt ::= LP idxlist RP */ yytestcase(yyruleno==246); | 110380 case 244: /* idxlist_opt ::= LP idxlist RP */ yytestcase(yyruleno==244); 110190 {yygotominor.yy442 = yymsp[-1].minor.yy442;} 110381 {yygotominor.yy442 = yymsp[-1].minor.yy442;} 110191 break; 110382 break; 110192 case 123: /* sclp ::= */ | 110383 case 121: /* sclp ::= */ 110193 case 151: /* orderby_opt ::= */ yytestcase(yyruleno==151); | 110384 case 149: /* orderby_opt ::= */ yytestcase(yyruleno==149); 110194 case 158: /* groupby_opt ::= */ yytestcase(yyruleno==158); | 110385 case 156: /* groupby_opt ::= */ yytestcase(yyruleno==156); 110195 case 239: /* exprlist ::= */ yytestcase(yyruleno==239); | 110386 case 237: /* exprlist ::= */ yytestcase(yyruleno==237); 110196 case 245: /* idxlist_opt ::= */ yytestcase(yyruleno==245); | 110387 case 243: /* idxlist_opt ::= */ yytestcase(yyruleno==243); 110197 {yygotominor.yy442 = 0;} 110388 {yygotominor.yy442 = 0;} 110198 break; 110389 break; 110199 case 124: /* selcollist ::= sclp expr as */ | 110390 case 122: /* selcollist ::= sclp expr as */ 110200 { 110391 { 110201 yygotominor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy442, yyms 110392 yygotominor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy442, yyms 110202 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yygotominor.yy442 110393 if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yygotominor.yy442 110203 sqlite3ExprListSetSpan(pParse,yygotominor.yy442,&yymsp[-1].minor.yy342); 110394 sqlite3ExprListSetSpan(pParse,yygotominor.yy442,&yymsp[-1].minor.yy342); 110204 } 110395 } 110205 break; 110396 break; 110206 case 125: /* selcollist ::= sclp STAR */ | 110397 case 123: /* selcollist ::= sclp STAR */ 110207 { 110398 { 110208 Expr *p = sqlite3Expr(pParse->db, TK_ALL, 0); 110399 Expr *p = sqlite3Expr(pParse->db, TK_ALL, 0); 110209 yygotominor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy442, p); 110400 yygotominor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy442, p); 110210 } 110401 } 110211 break; 110402 break; 110212 case 126: /* selcollist ::= sclp nm DOT STAR */ | 110403 case 124: /* selcollist ::= sclp nm DOT STAR */ 110213 { 110404 { 110214 Expr *pRight = sqlite3PExpr(pParse, TK_ALL, 0, 0, &yymsp[0].minor.yy0); 110405 Expr *pRight = sqlite3PExpr(pParse, TK_ALL, 0, 0, &yymsp[0].minor.yy0); 110215 Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); 110406 Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); 110216 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0); 110407 Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0); 110217 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442, pDot); 110408 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442, pDot); 110218 } 110409 } 110219 break; 110410 break; 110220 case 129: /* as ::= */ | 110411 case 127: /* as ::= */ 110221 {yygotominor.yy0.n = 0;} 110412 {yygotominor.yy0.n = 0;} 110222 break; 110413 break; 110223 case 130: /* from ::= */ | 110414 case 128: /* from ::= */ 110224 {yygotominor.yy347 = sqlite3DbMallocZero(pParse->db, sizeof(*yygotominor.yy347)) 110415 {yygotominor.yy347 = sqlite3DbMallocZero(pParse->db, sizeof(*yygotominor.yy347)) 110225 break; 110416 break; 110226 case 131: /* from ::= FROM seltablist */ | 110417 case 129: /* from ::= FROM seltablist */ 110227 { 110418 { 110228 yygotominor.yy347 = yymsp[0].minor.yy347; 110419 yygotominor.yy347 = yymsp[0].minor.yy347; 110229 sqlite3SrcListShiftJoinType(yygotominor.yy347); 110420 sqlite3SrcListShiftJoinType(yygotominor.yy347); 110230 } 110421 } 110231 break; 110422 break; 110232 case 132: /* stl_prefix ::= seltablist joinop */ | 110423 case 130: /* stl_prefix ::= seltablist joinop */ 110233 { 110424 { 110234 yygotominor.yy347 = yymsp[-1].minor.yy347; 110425 yygotominor.yy347 = yymsp[-1].minor.yy347; 110235 if( ALWAYS(yygotominor.yy347 && yygotominor.yy347->nSrc>0) ) yygotominor.yy34 110426 if( ALWAYS(yygotominor.yy347 && yygotominor.yy347->nSrc>0) ) yygotominor.yy34 110236 } 110427 } 110237 break; 110428 break; 110238 case 133: /* stl_prefix ::= */ | 110429 case 131: /* stl_prefix ::= */ 110239 {yygotominor.yy347 = 0;} 110430 {yygotominor.yy347 = 0;} 110240 break; 110431 break; 110241 case 134: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using | 110432 case 132: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using 110242 { 110433 { 110243 yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347, 110434 yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347, 110244 sqlite3SrcListIndexedBy(pParse, yygotominor.yy347, &yymsp[-2].minor.yy0); 110435 sqlite3SrcListIndexedBy(pParse, yygotominor.yy347, &yymsp[-2].minor.yy0); 110245 } 110436 } 110246 break; 110437 break; 110247 case 135: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ | 110438 case 133: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ 110248 { 110439 { 110249 yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy34 110440 yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy34 110250 } 110441 } 110251 break; 110442 break; 110252 case 136: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_op | 110443 case 134: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_op 110253 { 110444 { 110254 if( yymsp[-6].minor.yy347==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor. 110445 if( yymsp[-6].minor.yy347==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor. 110255 yygotominor.yy347 = yymsp[-4].minor.yy347; 110446 yygotominor.yy347 = yymsp[-4].minor.yy347; 110256 }else{ 110447 }else{ 110257 Select *pSubquery; 110448 Select *pSubquery; 110258 sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy347); 110449 sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy347); 110259 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy347,0,0,0,0,0,0,0) 110450 pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy347,0,0,0,0,0,0,0) 110260 yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy 110451 yygotominor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy 110261 } 110452 } 110262 } 110453 } 110263 break; 110454 break; 110264 case 137: /* dbnm ::= */ | 110455 case 135: /* dbnm ::= */ 110265 case 146: /* indexed_opt ::= */ yytestcase(yyruleno==146); | 110456 case 144: /* indexed_opt ::= */ yytestcase(yyruleno==144); 110266 {yygotominor.yy0.z=0; yygotominor.yy0.n=0;} 110457 {yygotominor.yy0.z=0; yygotominor.yy0.n=0;} 110267 break; 110458 break; 110268 case 139: /* fullname ::= nm dbnm */ | 110459 case 137: /* fullname ::= nm dbnm */ 110269 {yygotominor.yy347 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yym 110460 {yygotominor.yy347 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yym 110270 break; 110461 break; 110271 case 140: /* joinop ::= COMMA|JOIN */ | 110462 case 138: /* joinop ::= COMMA|JOIN */ 110272 { yygotominor.yy392 = JT_INNER; } 110463 { yygotominor.yy392 = JT_INNER; } 110273 break; 110464 break; 110274 case 141: /* joinop ::= JOIN_KW JOIN */ | 110465 case 139: /* joinop ::= JOIN_KW JOIN */ 110275 { yygotominor.yy392 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); } 110466 { yygotominor.yy392 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); } 110276 break; 110467 break; 110277 case 142: /* joinop ::= JOIN_KW nm JOIN */ | 110468 case 140: /* joinop ::= JOIN_KW nm JOIN */ 110278 { yygotominor.yy392 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].min 110469 { yygotominor.yy392 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].min 110279 break; 110470 break; 110280 case 143: /* joinop ::= JOIN_KW nm nm JOIN */ | 110471 case 141: /* joinop ::= JOIN_KW nm nm JOIN */ 110281 { yygotominor.yy392 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].min 110472 { yygotominor.yy392 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].min 110282 break; 110473 break; 110283 case 144: /* on_opt ::= ON expr */ | 110474 case 142: /* on_opt ::= ON expr */ 110284 case 161: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==161); | 110475 case 159: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==159); 110285 case 168: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==168); | 110476 case 166: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==166); 110286 case 234: /* case_else ::= ELSE expr */ yytestcase(yyruleno==234); | 110477 case 232: /* case_else ::= ELSE expr */ yytestcase(yyruleno==232); 110287 case 236: /* case_operand ::= expr */ yytestcase(yyruleno==236); | 110478 case 234: /* case_operand ::= expr */ yytestcase(yyruleno==234); 110288 {yygotominor.yy122 = yymsp[0].minor.yy342.pExpr;} 110479 {yygotominor.yy122 = yymsp[0].minor.yy342.pExpr;} 110289 break; 110480 break; 110290 case 145: /* on_opt ::= */ | 110481 case 143: /* on_opt ::= */ 110291 case 160: /* having_opt ::= */ yytestcase(yyruleno==160); | 110482 case 158: /* having_opt ::= */ yytestcase(yyruleno==158); 110292 case 167: /* where_opt ::= */ yytestcase(yyruleno==167); | 110483 case 165: /* where_opt ::= */ yytestcase(yyruleno==165); 110293 case 235: /* case_else ::= */ yytestcase(yyruleno==235); | 110484 case 233: /* case_else ::= */ yytestcase(yyruleno==233); 110294 case 237: /* case_operand ::= */ yytestcase(yyruleno==237); | 110485 case 235: /* case_operand ::= */ yytestcase(yyruleno==235); 110295 {yygotominor.yy122 = 0;} 110486 {yygotominor.yy122 = 0;} 110296 break; 110487 break; 110297 case 148: /* indexed_opt ::= NOT INDEXED */ | 110488 case 146: /* indexed_opt ::= NOT INDEXED */ 110298 {yygotominor.yy0.z=0; yygotominor.yy0.n=1;} 110489 {yygotominor.yy0.z=0; yygotominor.yy0.n=1;} 110299 break; 110490 break; 110300 case 149: /* using_opt ::= USING LP inscollist RP */ | 110491 case 147: /* using_opt ::= USING LP inscollist RP */ 110301 case 180: /* inscollist_opt ::= LP inscollist RP */ yytestcase(yyruleno==1 | 110492 case 178: /* inscollist_opt ::= LP inscollist RP */ yytestcase(yyruleno==1 110302 {yygotominor.yy180 = yymsp[-1].minor.yy180;} 110493 {yygotominor.yy180 = yymsp[-1].minor.yy180;} 110303 break; 110494 break; 110304 case 150: /* using_opt ::= */ | 110495 case 148: /* using_opt ::= */ 110305 case 179: /* inscollist_opt ::= */ yytestcase(yyruleno==179); | 110496 case 177: /* inscollist_opt ::= */ yytestcase(yyruleno==177); 110306 {yygotominor.yy180 = 0;} 110497 {yygotominor.yy180 = 0;} 110307 break; 110498 break; 110308 case 152: /* orderby_opt ::= ORDER BY sortlist */ | 110499 case 150: /* orderby_opt ::= ORDER BY sortlist */ 110309 case 159: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==15 | 110500 case 157: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==15 110310 case 238: /* exprlist ::= nexprlist */ yytestcase(yyruleno==238); | 110501 case 236: /* exprlist ::= nexprlist */ yytestcase(yyruleno==236); 110311 {yygotominor.yy442 = yymsp[0].minor.yy442;} 110502 {yygotominor.yy442 = yymsp[0].minor.yy442;} 110312 break; 110503 break; 110313 case 153: /* sortlist ::= sortlist COMMA expr sortorder */ | 110504 case 151: /* sortlist ::= sortlist COMMA expr sortorder */ 110314 { 110505 { 110315 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442,yymsp[- 110506 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442,yymsp[- 110316 if( yygotominor.yy442 ) yygotominor.yy442->a[yygotominor.yy442->nExpr-1].sortO 110507 if( yygotominor.yy442 ) yygotominor.yy442->a[yygotominor.yy442->nExpr-1].sortO 110317 } 110508 } 110318 break; 110509 break; 110319 case 154: /* sortlist ::= expr sortorder */ | 110510 case 152: /* sortlist ::= expr sortorder */ 110320 { 110511 { 110321 yygotominor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy342.pExpr 110512 yygotominor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy342.pExpr 110322 if( yygotominor.yy442 && ALWAYS(yygotominor.yy442->a) ) yygotominor.yy442->a[0 110513 if( yygotominor.yy442 && ALWAYS(yygotominor.yy442->a) ) yygotominor.yy442->a[0 110323 } 110514 } 110324 break; 110515 break; 110325 case 155: /* sortorder ::= ASC */ | 110516 case 153: /* sortorder ::= ASC */ 110326 case 157: /* sortorder ::= */ yytestcase(yyruleno==157); | 110517 case 155: /* sortorder ::= */ yytestcase(yyruleno==155); 110327 {yygotominor.yy392 = SQLITE_SO_ASC;} 110518 {yygotominor.yy392 = SQLITE_SO_ASC;} 110328 break; 110519 break; 110329 case 156: /* sortorder ::= DESC */ | 110520 case 154: /* sortorder ::= DESC */ 110330 {yygotominor.yy392 = SQLITE_SO_DESC;} 110521 {yygotominor.yy392 = SQLITE_SO_DESC;} 110331 break; 110522 break; 110332 case 162: /* limit_opt ::= */ | 110523 case 160: /* limit_opt ::= */ 110333 {yygotominor.yy64.pLimit = 0; yygotominor.yy64.pOffset = 0;} 110524 {yygotominor.yy64.pLimit = 0; yygotominor.yy64.pOffset = 0;} 110334 break; 110525 break; 110335 case 163: /* limit_opt ::= LIMIT expr */ | 110526 case 161: /* limit_opt ::= LIMIT expr */ 110336 {yygotominor.yy64.pLimit = yymsp[0].minor.yy342.pExpr; yygotominor.yy64.pOffset 110527 {yygotominor.yy64.pLimit = yymsp[0].minor.yy342.pExpr; yygotominor.yy64.pOffset 110337 break; 110528 break; 110338 case 164: /* limit_opt ::= LIMIT expr OFFSET expr */ | 110529 case 162: /* limit_opt ::= LIMIT expr OFFSET expr */ 110339 {yygotominor.yy64.pLimit = yymsp[-2].minor.yy342.pExpr; yygotominor.yy64.pOffset 110530 {yygotominor.yy64.pLimit = yymsp[-2].minor.yy342.pExpr; yygotominor.yy64.pOffset 110340 break; 110531 break; 110341 case 165: /* limit_opt ::= LIMIT expr COMMA expr */ | 110532 case 163: /* limit_opt ::= LIMIT expr COMMA expr */ 110342 {yygotominor.yy64.pOffset = yymsp[-2].minor.yy342.pExpr; yygotominor.yy64.pLimit 110533 {yygotominor.yy64.pOffset = yymsp[-2].minor.yy342.pExpr; yygotominor.yy64.pLimit 110343 break; 110534 break; 110344 case 166: /* cmd ::= DELETE FROM fullname indexed_opt where_opt */ | 110535 case 164: /* cmd ::= DELETE FROM fullname indexed_opt where_opt */ 110345 { 110536 { 110346 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy347, &yymsp[-1].minor.yy0); 110537 sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy347, &yymsp[-1].minor.yy0); 110347 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy347,yymsp[0].minor.yy122); 110538 sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy347,yymsp[0].minor.yy122); 110348 } 110539 } 110349 break; 110540 break; 110350 case 169: /* cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_ | 110541 case 167: /* cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_ 110351 { 110542 { 110352 sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy347, &yymsp[-3].minor.yy0); 110543 sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy347, &yymsp[-3].minor.yy0); 110353 sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy442,"set list"); 110544 sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy442,"set list"); 110354 sqlite3Update(pParse,yymsp[-4].minor.yy347,yymsp[-1].minor.yy442,yymsp[0].mino 110545 sqlite3Update(pParse,yymsp[-4].minor.yy347,yymsp[-1].minor.yy442,yymsp[0].mino 110355 } 110546 } 110356 break; 110547 break; 110357 case 170: /* setlist ::= setlist COMMA nm EQ expr */ | 110548 case 168: /* setlist ::= setlist COMMA nm EQ expr */ 110358 { 110549 { 110359 yygotominor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy442, yymsp 110550 yygotominor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy442, yymsp 110360 sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[-2].minor.yy0, 1); 110551 sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[-2].minor.yy0, 1); 110361 } 110552 } 110362 break; 110553 break; 110363 case 171: /* setlist ::= nm EQ expr */ | 110554 case 169: /* setlist ::= nm EQ expr */ 110364 { 110555 { 110365 yygotominor.yy442 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy342.pExp 110556 yygotominor.yy442 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy342.pExp 110366 sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[-2].minor.yy0, 1); 110557 sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[-2].minor.yy0, 1); 110367 } 110558 } 110368 break; 110559 break; 110369 case 172: /* cmd ::= insert_cmd INTO fullname inscollist_opt valuelist */ | 110560 case 170: /* cmd ::= insert_cmd INTO fullname inscollist_opt valuelist */ 110370 {sqlite3Insert(pParse, yymsp[-2].minor.yy347, yymsp[0].minor.yy487.pList, yymsp[ 110561 {sqlite3Insert(pParse, yymsp[-2].minor.yy347, yymsp[0].minor.yy487.pList, yymsp[ 110371 break; 110562 break; 110372 case 173: /* cmd ::= insert_cmd INTO fullname inscollist_opt select */ | 110563 case 171: /* cmd ::= insert_cmd INTO fullname inscollist_opt select */ 110373 {sqlite3Insert(pParse, yymsp[-2].minor.yy347, 0, yymsp[0].minor.yy159, yymsp[-1] 110564 {sqlite3Insert(pParse, yymsp[-2].minor.yy347, 0, yymsp[0].minor.yy159, yymsp[-1] 110374 break; 110565 break; 110375 case 174: /* cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUE | 110566 case 172: /* cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUE 110376 {sqlite3Insert(pParse, yymsp[-3].minor.yy347, 0, 0, yymsp[-2].minor.yy180, yymsp 110567 {sqlite3Insert(pParse, yymsp[-3].minor.yy347, 0, 0, yymsp[-2].minor.yy180, yymsp 110377 break; 110568 break; 110378 case 175: /* insert_cmd ::= INSERT orconf */ | 110569 case 173: /* insert_cmd ::= INSERT orconf */ 110379 {yygotominor.yy258 = yymsp[0].minor.yy258;} 110570 {yygotominor.yy258 = yymsp[0].minor.yy258;} 110380 break; 110571 break; 110381 case 176: /* insert_cmd ::= REPLACE */ | 110572 case 174: /* insert_cmd ::= REPLACE */ 110382 {yygotominor.yy258 = OE_Replace;} 110573 {yygotominor.yy258 = OE_Replace;} 110383 break; 110574 break; 110384 case 177: /* valuelist ::= VALUES LP nexprlist RP */ | 110575 case 175: /* valuelist ::= VALUES LP nexprlist RP */ 110385 { 110576 { 110386 yygotominor.yy487.pList = yymsp[-1].minor.yy442; 110577 yygotominor.yy487.pList = yymsp[-1].minor.yy442; 110387 yygotominor.yy487.pSelect = 0; 110578 yygotominor.yy487.pSelect = 0; 110388 } 110579 } 110389 break; 110580 break; 110390 case 178: /* valuelist ::= valuelist COMMA LP exprlist RP */ | 110581 case 176: /* valuelist ::= valuelist COMMA LP exprlist RP */ 110391 { 110582 { 110392 Select *pRight = sqlite3SelectNew(pParse, yymsp[-1].minor.yy442, 0, 0, 0, 0, 0 110583 Select *pRight = sqlite3SelectNew(pParse, yymsp[-1].minor.yy442, 0, 0, 0, 0, 0 110393 if( yymsp[-4].minor.yy487.pList ){ 110584 if( yymsp[-4].minor.yy487.pList ){ 110394 yymsp[-4].minor.yy487.pSelect = sqlite3SelectNew(pParse, yymsp[-4].minor.yy4 110585 yymsp[-4].minor.yy487.pSelect = sqlite3SelectNew(pParse, yymsp[-4].minor.yy4 110395 yymsp[-4].minor.yy487.pList = 0; 110586 yymsp[-4].minor.yy487.pList = 0; 110396 } 110587 } 110397 yygotominor.yy487.pList = 0; 110588 yygotominor.yy487.pList = 0; ................................................................................................................................................................................ 110404 pRight->pPrior = yymsp[-4].minor.yy487.pSelect; 110595 pRight->pPrior = yymsp[-4].minor.yy487.pSelect; 110405 pRight->selFlags |= SF_Values; 110596 pRight->selFlags |= SF_Values; 110406 pRight->pPrior->selFlags |= SF_Values; 110597 pRight->pPrior->selFlags |= SF_Values; 110407 yygotominor.yy487.pSelect = pRight; 110598 yygotominor.yy487.pSelect = pRight; 110408 } 110599 } 110409 } 110600 } 110410 break; 110601 break; 110411 case 181: /* inscollist ::= inscollist COMMA nm */ | 110602 case 179: /* inscollist ::= inscollist COMMA nm */ 110412 {yygotominor.yy180 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy180,&yymsp 110603 {yygotominor.yy180 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy180,&yymsp 110413 break; 110604 break; 110414 case 182: /* inscollist ::= nm */ | 110605 case 180: /* inscollist ::= nm */ 110415 {yygotominor.yy180 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0);} 110606 {yygotominor.yy180 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0);} 110416 break; 110607 break; 110417 case 183: /* expr ::= term */ | 110608 case 181: /* expr ::= term */ 110418 {yygotominor.yy342 = yymsp[0].minor.yy342;} 110609 {yygotominor.yy342 = yymsp[0].minor.yy342;} 110419 break; 110610 break; 110420 case 184: /* expr ::= LP expr RP */ | 110611 case 182: /* expr ::= LP expr RP */ 110421 {yygotominor.yy342.pExpr = yymsp[-1].minor.yy342.pExpr; spanSet(&yygotominor.yy3 110612 {yygotominor.yy342.pExpr = yymsp[-1].minor.yy342.pExpr; spanSet(&yygotominor.yy3 110422 break; 110613 break; 110423 case 185: /* term ::= NULL */ | 110614 case 183: /* term ::= NULL */ 110424 case 190: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==190); | 110615 case 188: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==188); 110425 case 191: /* term ::= STRING */ yytestcase(yyruleno==191); | 110616 case 189: /* term ::= STRING */ yytestcase(yyruleno==189); 110426 {spanExpr(&yygotominor.yy342, pParse, yymsp[0].major, &yymsp[0].minor.yy0);} 110617 {spanExpr(&yygotominor.yy342, pParse, yymsp[0].major, &yymsp[0].minor.yy0);} 110427 break; 110618 break; 110428 case 186: /* expr ::= id */ | 110619 case 184: /* expr ::= id */ 110429 case 187: /* expr ::= JOIN_KW */ yytestcase(yyruleno==187); | 110620 case 185: /* expr ::= JOIN_KW */ yytestcase(yyruleno==185); 110430 {spanExpr(&yygotominor.yy342, pParse, TK_ID, &yymsp[0].minor.yy0);} 110621 {spanExpr(&yygotominor.yy342, pParse, TK_ID, &yymsp[0].minor.yy0);} 110431 break; 110622 break; 110432 case 188: /* expr ::= nm DOT nm */ | 110623 case 186: /* expr ::= nm DOT nm */ 110433 { 110624 { 110434 Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); 110625 Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); 110435 Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0); 110626 Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0); 110436 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0); 110627 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0); 110437 spanSet(&yygotominor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); 110628 spanSet(&yygotominor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); 110438 } 110629 } 110439 break; 110630 break; 110440 case 189: /* expr ::= nm DOT nm DOT nm */ | 110631 case 187: /* expr ::= nm DOT nm DOT nm */ 110441 { 110632 { 110442 Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy0); 110633 Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy0); 110443 Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); 110634 Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); 110444 Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0); 110635 Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0); 110445 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0); 110636 Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0); 110446 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0); 110637 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0); 110447 spanSet(&yygotominor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); 110638 spanSet(&yygotominor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); 110448 } 110639 } 110449 break; 110640 break; 110450 case 192: /* expr ::= REGISTER */ | 110641 case 190: /* expr ::= REGISTER */ 110451 { 110642 { 110452 /* When doing a nested parse, one can include terms in an expression 110643 /* When doing a nested parse, one can include terms in an expression 110453 ** that look like this: #1 #2 ... These terms refer to registers 110644 ** that look like this: #1 #2 ... These terms refer to registers 110454 ** in the virtual machine. #N is the N-th register. */ 110645 ** in the virtual machine. #N is the N-th register. */ 110455 if( pParse->nested==0 ){ 110646 if( pParse->nested==0 ){ 110456 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &yymsp[0].minor.yy0); 110647 sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &yymsp[0].minor.yy0); 110457 yygotominor.yy342.pExpr = 0; 110648 yygotominor.yy342.pExpr = 0; ................................................................................................................................................................................ 110458 }else{ 110649 }else{ 110459 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &yymsp[0]. 110650 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &yymsp[0]. 110460 if( yygotominor.yy342.pExpr ) sqlite3GetInt32(&yymsp[0].minor.yy0.z[1], &yyg 110651 if( yygotominor.yy342.pExpr ) sqlite3GetInt32(&yymsp[0].minor.yy0.z[1], &yyg 110461 } 110652 } 110462 spanSet(&yygotominor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0); 110653 spanSet(&yygotominor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0); 110463 } 110654 } 110464 break; 110655 break; 110465 case 193: /* expr ::= VARIABLE */ | 110656 case 191: /* expr ::= VARIABLE */ 110466 { 110657 { 110467 spanExpr(&yygotominor.yy342, pParse, TK_VARIABLE, &yymsp[0].minor.yy0); 110658 spanExpr(&yygotominor.yy342, pParse, TK_VARIABLE, &yymsp[0].minor.yy0); 110468 sqlite3ExprAssignVarNumber(pParse, yygotominor.yy342.pExpr); 110659 sqlite3ExprAssignVarNumber(pParse, yygotominor.yy342.pExpr); 110469 spanSet(&yygotominor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0); 110660 spanSet(&yygotominor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0); 110470 } 110661 } 110471 break; 110662 break; 110472 case 194: /* expr ::= expr COLLATE ids */ | 110663 case 192: /* expr ::= expr COLLATE ids */ 110473 { 110664 { 110474 yygotominor.yy342.pExpr = sqlite3ExprSetCollByToken(pParse, yymsp[-2].minor.yy 110665 yygotominor.yy342.pExpr = sqlite3ExprSetCollByToken(pParse, yymsp[-2].minor.yy 110475 yygotominor.yy342.zStart = yymsp[-2].minor.yy342.zStart; 110666 yygotominor.yy342.zStart = yymsp[-2].minor.yy342.zStart; 110476 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; 110667 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; 110477 } 110668 } 110478 break; 110669 break; 110479 case 195: /* expr ::= CAST LP expr AS typetoken RP */ | 110670 case 193: /* expr ::= CAST LP expr AS typetoken RP */ 110480 { 110671 { 110481 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy342. 110672 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy342. 110482 spanSet(&yygotominor.yy342,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); 110673 spanSet(&yygotominor.yy342,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); 110483 } 110674 } 110484 break; 110675 break; 110485 case 196: /* expr ::= ID LP distinct exprlist RP */ | 110676 case 194: /* expr ::= ID LP distinct exprlist RP */ 110486 { 110677 { 110487 if( yymsp[-1].minor.yy442 && yymsp[-1].minor.yy442->nExpr>pParse->db->aLimit[S 110678 if( yymsp[-1].minor.yy442 && yymsp[-1].minor.yy442->nExpr>pParse->db->aLimit[S 110488 sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].mino 110679 sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].mino 110489 } 110680 } 110490 yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy442, & 110681 yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy442, & 110491 spanSet(&yygotominor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); 110682 spanSet(&yygotominor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); 110492 if( yymsp[-2].minor.yy392 && yygotominor.yy342.pExpr ){ 110683 if( yymsp[-2].minor.yy392 && yygotominor.yy342.pExpr ){ 110493 yygotominor.yy342.pExpr->flags |= EP_Distinct; 110684 yygotominor.yy342.pExpr->flags |= EP_Distinct; 110494 } 110685 } 110495 } 110686 } 110496 break; 110687 break; 110497 case 197: /* expr ::= ID LP STAR RP */ | 110688 case 195: /* expr ::= ID LP STAR RP */ 110498 { 110689 { 110499 yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0) 110690 yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0) 110500 spanSet(&yygotominor.yy342,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); 110691 spanSet(&yygotominor.yy342,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); 110501 } 110692 } 110502 break; 110693 break; 110503 case 198: /* term ::= CTIME_KW */ | 110694 case 196: /* term ::= CTIME_KW */ 110504 { 110695 { 110505 /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are 110696 /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are 110506 ** treated as functions that return constants */ 110697 ** treated as functions that return constants */ 110507 yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, 0,&yymsp[0].minor.yy0); 110698 yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, 0,&yymsp[0].minor.yy0); 110508 if( yygotominor.yy342.pExpr ){ 110699 if( yygotominor.yy342.pExpr ){ 110509 yygotominor.yy342.pExpr->op = TK_CONST_FUNC; 110700 yygotominor.yy342.pExpr->op = TK_CONST_FUNC; 110510 } 110701 } 110511 spanSet(&yygotominor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0); 110702 spanSet(&yygotominor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0); 110512 } 110703 } 110513 break; 110704 break; 110514 case 199: /* expr ::= expr AND expr */ | 110705 case 197: /* expr ::= expr AND expr */ 110515 case 200: /* expr ::= expr OR expr */ yytestcase(yyruleno==200); | 110706 case 198: /* expr ::= expr OR expr */ yytestcase(yyruleno==198); 110516 case 201: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==201); | 110707 case 199: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==199); 110517 case 202: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==202); | 110708 case 200: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==200); 110518 case 203: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(y | 110709 case 201: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(y 110519 case 204: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==204); | 110710 case 202: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==202); 110520 case 205: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==205 | 110711 case 203: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==203 110521 case 206: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==206); | 110712 case 204: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==204); 110522 {spanBinaryExpr(&yygotominor.yy342,pParse,yymsp[-1].major,&yymsp[-2].minor.yy342 110713 {spanBinaryExpr(&yygotominor.yy342,pParse,yymsp[-1].major,&yymsp[-2].minor.yy342 110523 break; 110714 break; 110524 case 207: /* likeop ::= LIKE_KW */ | 110715 case 205: /* likeop ::= LIKE_KW */ 110525 case 209: /* likeop ::= MATCH */ yytestcase(yyruleno==209); | 110716 case 207: /* likeop ::= MATCH */ yytestcase(yyruleno==207); 110526 {yygotominor.yy318.eOperator = yymsp[0].minor.yy0; yygotominor.yy318.not = 0;} | 110717 {yygotominor.yy318.eOperator = yymsp[0].minor.yy0; yygotominor.yy318.bNot = 0;} 110527 break; 110718 break; 110528 case 208: /* likeop ::= NOT LIKE_KW */ | 110719 case 206: /* likeop ::= NOT LIKE_KW */ 110529 case 210: /* likeop ::= NOT MATCH */ yytestcase(yyruleno==210); | 110720 case 208: /* likeop ::= NOT MATCH */ yytestcase(yyruleno==208); 110530 {yygotominor.yy318.eOperator = yymsp[0].minor.yy0; yygotominor.yy318.not = 1;} | 110721 {yygotominor.yy318.eOperator = yymsp[0].minor.yy0; yygotominor.yy318.bNot = 1;} 110531 break; 110722 break; 110532 case 211: /* expr ::= expr likeop expr */ | 110723 case 209: /* expr ::= expr likeop expr */ 110533 { 110724 { 110534 ExprList *pList; 110725 ExprList *pList; 110535 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy342.pExpr); 110726 pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy342.pExpr); 110536 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy342.pExpr); 110727 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy342.pExpr); 110537 yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor. 110728 yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor. 110538 if( yymsp[-1].minor.yy318.not ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, | 110729 if( yymsp[-1].minor.yy318.bNot ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse 110539 yygotominor.yy342.zStart = yymsp[-2].minor.yy342.zStart; 110730 yygotominor.yy342.zStart = yymsp[-2].minor.yy342.zStart; 110540 yygotominor.yy342.zEnd = yymsp[0].minor.yy342.zEnd; 110731 yygotominor.yy342.zEnd = yymsp[0].minor.yy342.zEnd; 110541 if( yygotominor.yy342.pExpr ) yygotominor.yy342.pExpr->flags |= EP_InfixFunc; 110732 if( yygotominor.yy342.pExpr ) yygotominor.yy342.pExpr->flags |= EP_InfixFunc; 110542 } 110733 } 110543 break; 110734 break; 110544 case 212: /* expr ::= expr likeop expr ESCAPE expr */ | 110735 case 210: /* expr ::= expr likeop expr ESCAPE expr */ 110545 { 110736 { 110546 ExprList *pList; 110737 ExprList *pList; 110547 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr); 110738 pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr); 110548 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy342.pExpr); 110739 pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy342.pExpr); 110549 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy342.pExpr); 110740 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy342.pExpr); 110550 yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor. 110741 yygotominor.yy342.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor. 110551 if( yymsp[-3].minor.yy318.not ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, | 110742 if( yymsp[-3].minor.yy318.bNot ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse 110552 yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart; 110743 yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart; 110553 yygotominor.yy342.zEnd = yymsp[0].minor.yy342.zEnd; 110744 yygotominor.yy342.zEnd = yymsp[0].minor.yy342.zEnd; 110554 if( yygotominor.yy342.pExpr ) yygotominor.yy342.pExpr->flags |= EP_InfixFunc; 110745 if( yygotominor.yy342.pExpr ) yygotominor.yy342.pExpr->flags |= EP_InfixFunc; 110555 } 110746 } 110556 break; 110747 break; 110557 case 213: /* expr ::= expr ISNULL|NOTNULL */ | 110748 case 211: /* expr ::= expr ISNULL|NOTNULL */ 110558 {spanUnaryPostfix(&yygotominor.yy342,pParse,yymsp[0].major,&yymsp[-1].minor.yy34 110749 {spanUnaryPostfix(&yygotominor.yy342,pParse,yymsp[0].major,&yymsp[-1].minor.yy34 110559 break; 110750 break; 110560 case 214: /* expr ::= expr NOT NULL */ | 110751 case 212: /* expr ::= expr NOT NULL */ 110561 {spanUnaryPostfix(&yygotominor.yy342,pParse,TK_NOTNULL,&yymsp[-2].minor.yy342,&y 110752 {spanUnaryPostfix(&yygotominor.yy342,pParse,TK_NOTNULL,&yymsp[-2].minor.yy342,&y 110562 break; 110753 break; 110563 case 215: /* expr ::= expr IS expr */ | 110754 case 213: /* expr ::= expr IS expr */ 110564 { 110755 { 110565 spanBinaryExpr(&yygotominor.yy342,pParse,TK_IS,&yymsp[-2].minor.yy342,&yymsp[0 110756 spanBinaryExpr(&yygotominor.yy342,pParse,TK_IS,&yymsp[-2].minor.yy342,&yymsp[0 110566 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy342.pExpr, yygotominor.yy342.pExp 110757 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy342.pExpr, yygotominor.yy342.pExp 110567 } 110758 } 110568 break; 110759 break; 110569 case 216: /* expr ::= expr IS NOT expr */ | 110760 case 214: /* expr ::= expr IS NOT expr */ 110570 { 110761 { 110571 spanBinaryExpr(&yygotominor.yy342,pParse,TK_ISNOT,&yymsp[-3].minor.yy342,&yyms 110762 spanBinaryExpr(&yygotominor.yy342,pParse,TK_ISNOT,&yymsp[-3].minor.yy342,&yyms 110572 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy342.pExpr, yygotominor.yy342.pExp 110763 binaryToUnaryIfNull(pParse, yymsp[0].minor.yy342.pExpr, yygotominor.yy342.pExp 110573 } 110764 } 110574 break; 110765 break; 110575 case 217: /* expr ::= NOT expr */ | 110766 case 215: /* expr ::= NOT expr */ 110576 case 218: /* expr ::= BITNOT expr */ yytestcase(yyruleno==218); | 110767 case 216: /* expr ::= BITNOT expr */ yytestcase(yyruleno==216); 110577 {spanUnaryPrefix(&yygotominor.yy342,pParse,yymsp[-1].major,&yymsp[0].minor.yy342 110768 {spanUnaryPrefix(&yygotominor.yy342,pParse,yymsp[-1].major,&yymsp[0].minor.yy342 110578 break; 110769 break; 110579 case 219: /* expr ::= MINUS expr */ | 110770 case 217: /* expr ::= MINUS expr */ 110580 {spanUnaryPrefix(&yygotominor.yy342,pParse,TK_UMINUS,&yymsp[0].minor.yy342,&yyms 110771 {spanUnaryPrefix(&yygotominor.yy342,pParse,TK_UMINUS,&yymsp[0].minor.yy342,&yyms 110581 break; 110772 break; 110582 case 220: /* expr ::= PLUS expr */ | 110773 case 218: /* expr ::= PLUS expr */ 110583 {spanUnaryPrefix(&yygotominor.yy342,pParse,TK_UPLUS,&yymsp[0].minor.yy342,&yymsp 110774 {spanUnaryPrefix(&yygotominor.yy342,pParse,TK_UPLUS,&yymsp[0].minor.yy342,&yymsp 110584 break; 110775 break; 110585 case 223: /* expr ::= expr between_op expr AND expr */ | 110776 case 221: /* expr ::= expr between_op expr AND expr */ 110586 { 110777 { 110587 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr) 110778 ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr) 110588 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy342.pExpr); 110779 pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy342.pExpr); 110589 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy3 110780 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy3 110590 if( yygotominor.yy342.pExpr ){ 110781 if( yygotominor.yy342.pExpr ){ 110591 yygotominor.yy342.pExpr->x.pList = pList; 110782 yygotominor.yy342.pExpr->x.pList = pList; 110592 }else{ 110783 }else{ ................................................................................................................................................................................ 110593 sqlite3ExprListDelete(pParse->db, pList); 110784 sqlite3ExprListDelete(pParse->db, pList); 110594 } 110785 } 110595 if( yymsp[-3].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_ 110786 if( yymsp[-3].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_ 110596 yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart; 110787 yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart; 110597 yygotominor.yy342.zEnd = yymsp[0].minor.yy342.zEnd; 110788 yygotominor.yy342.zEnd = yymsp[0].minor.yy342.zEnd; 110598 } 110789 } 110599 break; 110790 break; 110600 case 226: /* expr ::= expr in_op LP exprlist RP */ | 110791 case 224: /* expr ::= expr in_op LP exprlist RP */ 110601 { 110792 { 110602 if( yymsp[-1].minor.yy442==0 ){ 110793 if( yymsp[-1].minor.yy442==0 ){ 110603 /* Expressions of the form 110794 /* Expressions of the form 110604 ** 110795 ** 110605 ** expr1 IN () 110796 ** expr1 IN () 110606 ** expr1 NOT IN () 110797 ** expr1 NOT IN () 110607 ** 110798 ** ................................................................................................................................................................................ 110620 } 110811 } 110621 if( yymsp[-3].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, 110812 if( yymsp[-3].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, 110622 } 110813 } 110623 yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart; 110814 yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart; 110624 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; 110815 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; 110625 } 110816 } 110626 break; 110817 break; 110627 case 227: /* expr ::= LP select RP */ | 110818 case 225: /* expr ::= LP select RP */ 110628 { 110819 { 110629 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0); 110820 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0); 110630 if( yygotominor.yy342.pExpr ){ 110821 if( yygotominor.yy342.pExpr ){ 110631 yygotominor.yy342.pExpr->x.pSelect = yymsp[-1].minor.yy159; 110822 yygotominor.yy342.pExpr->x.pSelect = yymsp[-1].minor.yy159; 110632 ExprSetProperty(yygotominor.yy342.pExpr, EP_xIsSelect); 110823 ExprSetProperty(yygotominor.yy342.pExpr, EP_xIsSelect); 110633 sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr); 110824 sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr); 110634 }else{ 110825 }else{ 110635 sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy159); 110826 sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy159); 110636 } 110827 } 110637 yygotominor.yy342.zStart = yymsp[-2].minor.yy0.z; 110828 yygotominor.yy342.zStart = yymsp[-2].minor.yy0.z; 110638 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; 110829 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; 110639 } 110830 } 110640 break; 110831 break; 110641 case 228: /* expr ::= expr in_op LP select RP */ | 110832 case 226: /* expr ::= expr in_op LP select RP */ 110642 { 110833 { 110643 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy342. 110834 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy342. 110644 if( yygotominor.yy342.pExpr ){ 110835 if( yygotominor.yy342.pExpr ){ 110645 yygotominor.yy342.pExpr->x.pSelect = yymsp[-1].minor.yy159; 110836 yygotominor.yy342.pExpr->x.pSelect = yymsp[-1].minor.yy159; 110646 ExprSetProperty(yygotominor.yy342.pExpr, EP_xIsSelect); 110837 ExprSetProperty(yygotominor.yy342.pExpr, EP_xIsSelect); 110647 sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr); 110838 sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr); 110648 }else{ 110839 }else{ ................................................................................................................................................................................ 110649 sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy159); 110840 sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy159); 110650 } 110841 } 110651 if( yymsp[-3].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, T 110842 if( yymsp[-3].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, T 110652 yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart; 110843 yygotominor.yy342.zStart = yymsp[-4].minor.yy342.zStart; 110653 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; 110844 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; 110654 } 110845 } 110655 break; 110846 break; 110656 case 229: /* expr ::= expr in_op nm dbnm */ | 110847 case 227: /* expr ::= expr in_op nm dbnm */ 110657 { 110848 { 110658 SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0,&yym 110849 SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0,&yym 110659 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy342. 110850 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy342. 110660 if( yygotominor.yy342.pExpr ){ 110851 if( yygotominor.yy342.pExpr ){ 110661 yygotominor.yy342.pExpr->x.pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0 110852 yygotominor.yy342.pExpr->x.pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0 110662 ExprSetProperty(yygotominor.yy342.pExpr, EP_xIsSelect); 110853 ExprSetProperty(yygotominor.yy342.pExpr, EP_xIsSelect); 110663 sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr); 110854 sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr); ................................................................................................................................................................................ 110665 sqlite3SrcListDelete(pParse->db, pSrc); 110856 sqlite3SrcListDelete(pParse->db, pSrc); 110666 } 110857 } 110667 if( yymsp[-2].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, T 110858 if( yymsp[-2].minor.yy392 ) yygotominor.yy342.pExpr = sqlite3PExpr(pParse, T 110668 yygotominor.yy342.zStart = yymsp[-3].minor.yy342.zStart; 110859 yygotominor.yy342.zStart = yymsp[-3].minor.yy342.zStart; 110669 yygotominor.yy342.zEnd = yymsp[0].minor.yy0.z ? &yymsp[0].minor.yy0.z[yymsp[ 110860 yygotominor.yy342.zEnd = yymsp[0].minor.yy0.z ? &yymsp[0].minor.yy0.z[yymsp[ 110670 } 110861 } 110671 break; 110862 break; 110672 case 230: /* expr ::= EXISTS LP select RP */ | 110863 case 228: /* expr ::= EXISTS LP select RP */ 110673 { 110864 { 110674 Expr *p = yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0) 110865 Expr *p = yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0) 110675 if( p ){ 110866 if( p ){ 110676 p->x.pSelect = yymsp[-1].minor.yy159; 110867 p->x.pSelect = yymsp[-1].minor.yy159; 110677 ExprSetProperty(p, EP_xIsSelect); 110868 ExprSetProperty(p, EP_xIsSelect); 110678 sqlite3ExprSetHeight(pParse, p); 110869 sqlite3ExprSetHeight(pParse, p); 110679 }else{ 110870 }else{ 110680 sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy159); 110871 sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy159); 110681 } 110872 } 110682 yygotominor.yy342.zStart = yymsp[-3].minor.yy0.z; 110873 yygotominor.yy342.zStart = yymsp[-3].minor.yy0.z; 110683 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; 110874 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; 110684 } 110875 } 110685 break; 110876 break; 110686 case 231: /* expr ::= CASE case_operand case_exprlist case_else END */ | 110877 case 229: /* expr ::= CASE case_operand case_exprlist case_else END */ 110687 { 110878 { 110688 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy122, 110879 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy122, 110689 if( yygotominor.yy342.pExpr ){ 110880 if( yygotominor.yy342.pExpr ){ 110690 yygotominor.yy342.pExpr->x.pList = yymsp[-2].minor.yy442; 110881 yygotominor.yy342.pExpr->x.pList = yymsp[-2].minor.yy442; 110691 sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr); 110882 sqlite3ExprSetHeight(pParse, yygotominor.yy342.pExpr); 110692 }else{ 110883 }else{ 110693 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy442); 110884 sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy442); 110694 } 110885 } 110695 yygotominor.yy342.zStart = yymsp[-4].minor.yy0.z; 110886 yygotominor.yy342.zStart = yymsp[-4].minor.yy0.z; 110696 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; 110887 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; 110697 } 110888 } 110698 break; 110889 break; 110699 case 232: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ | 110890 case 230: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ 110700 { 110891 { 110701 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, yymsp[ 110892 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, yymsp[ 110702 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yygotominor.yy442, yymsp[0].m 110893 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yygotominor.yy442, yymsp[0].m 110703 } 110894 } 110704 break; 110895 break; 110705 case 233: /* case_exprlist ::= WHEN expr THEN expr */ | 110896 case 231: /* case_exprlist ::= WHEN expr THEN expr */ 110706 { 110897 { 110707 yygotominor.yy442 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExp 110898 yygotominor.yy442 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExp 110708 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yygotominor.yy442, yymsp[0].m 110899 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yygotominor.yy442, yymsp[0].m 110709 } 110900 } 110710 break; 110901 break; 110711 case 240: /* nexprlist ::= nexprlist COMMA expr */ | 110902 case 238: /* nexprlist ::= nexprlist COMMA expr */ 110712 {yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy442,yymsp[0] 110903 {yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy442,yymsp[0] 110713 break; 110904 break; 110714 case 241: /* nexprlist ::= expr */ | 110905 case 239: /* nexprlist ::= expr */ 110715 {yygotominor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy342.pExpr); 110906 {yygotominor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy342.pExpr); 110716 break; 110907 break; 110717 case 242: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm L | 110908 case 240: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm L 110718 { 110909 { 110719 sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy0, &yymsp[-5].minor.yy0, 110910 sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy0, &yymsp[-5].minor.yy0, 110720 sqlite3SrcListAppend(pParse->db,0,&yymsp[-3].minor.yy0,0), 110911 sqlite3SrcListAppend(pParse->db,0,&yymsp[-3].minor.yy0,0), 110721 &yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, 110912 &yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, 110722 } 110913 } 110723 break; 110914 break; 110724 case 243: /* uniqueflag ::= UNIQUE */ | 110915 case 241: /* uniqueflag ::= UNIQUE */ 110725 case 296: /* raisetype ::= ABORT */ yytestcase(yyruleno==296); | 110916 case 294: /* raisetype ::= ABORT */ yytestcase(yyruleno==294); 110726 {yygotominor.yy392 = OE_Abort;} 110917 {yygotominor.yy392 = OE_Abort;} 110727 break; 110918 break; 110728 case 244: /* uniqueflag ::= */ | 110919 case 242: /* uniqueflag ::= */ 110729 {yygotominor.yy392 = OE_None;} 110920 {yygotominor.yy392 = OE_None;} 110730 break; 110921 break; 110731 case 247: /* idxlist ::= idxlist COMMA nm collate sortorder */ | 110922 case 245: /* idxlist ::= idxlist COMMA nm collate sortorder */ 110732 { 110923 { 110733 Expr *p = 0; 110924 Expr *p = 0; 110734 if( yymsp[-1].minor.yy0.n>0 ){ 110925 if( yymsp[-1].minor.yy0.n>0 ){ 110735 p = sqlite3Expr(pParse->db, TK_COLUMN, 0); 110926 p = sqlite3Expr(pParse->db, TK_COLUMN, 0); 110736 sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0); 110927 sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0); 110737 } 110928 } 110738 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, p); 110929 yygotominor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, p); 110739 sqlite3ExprListSetName(pParse,yygotominor.yy442,&yymsp[-2].minor.yy0,1); 110930 sqlite3ExprListSetName(pParse,yygotominor.yy442,&yymsp[-2].minor.yy0,1); 110740 sqlite3ExprListCheckLength(pParse, yygotominor.yy442, "index"); 110931 sqlite3ExprListCheckLength(pParse, yygotominor.yy442, "index"); 110741 if( yygotominor.yy442 ) yygotominor.yy442->a[yygotominor.yy442->nExpr-1].sortO 110932 if( yygotominor.yy442 ) yygotominor.yy442->a[yygotominor.yy442->nExpr-1].sortO 110742 } 110933 } 110743 break; 110934 break; 110744 case 248: /* idxlist ::= nm collate sortorder */ | 110935 case 246: /* idxlist ::= nm collate sortorder */ 110745 { 110936 { 110746 Expr *p = 0; 110937 Expr *p = 0; 110747 if( yymsp[-1].minor.yy0.n>0 ){ 110938 if( yymsp[-1].minor.yy0.n>0 ){ 110748 p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0); 110939 p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0); 110749 sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0); 110940 sqlite3ExprSetCollByToken(pParse, p, &yymsp[-1].minor.yy0); 110750 } 110941 } 110751 yygotominor.yy442 = sqlite3ExprListAppend(pParse,0, p); 110942 yygotominor.yy442 = sqlite3ExprListAppend(pParse,0, p); 110752 sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[-2].minor.yy0, 1); 110943 sqlite3ExprListSetName(pParse, yygotominor.yy442, &yymsp[-2].minor.yy0, 1); 110753 sqlite3ExprListCheckLength(pParse, yygotominor.yy442, "index"); 110944 sqlite3ExprListCheckLength(pParse, yygotominor.yy442, "index"); 110754 if( yygotominor.yy442 ) yygotominor.yy442->a[yygotominor.yy442->nExpr-1].sortO 110945 if( yygotominor.yy442 ) yygotominor.yy442->a[yygotominor.yy442->nExpr-1].sortO 110755 } 110946 } 110756 break; 110947 break; 110757 case 249: /* collate ::= */ | 110948 case 247: /* collate ::= */ 110758 {yygotominor.yy0.z = 0; yygotominor.yy0.n = 0;} 110949 {yygotominor.yy0.z = 0; yygotominor.yy0.n = 0;} 110759 break; 110950 break; 110760 case 251: /* cmd ::= DROP INDEX ifexists fullname */ | 110951 case 249: /* cmd ::= DROP INDEX ifexists fullname */ 110761 {sqlite3DropIndex(pParse, yymsp[0].minor.yy347, yymsp[-1].minor.yy392);} 110952 {sqlite3DropIndex(pParse, yymsp[0].minor.yy347, yymsp[-1].minor.yy392);} 110762 break; 110953 break; 110763 case 252: /* cmd ::= VACUUM */ | 110954 case 250: /* cmd ::= VACUUM */ 110764 case 253: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==253); | 110955 case 251: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==251); 110765 {sqlite3Vacuum(pParse);} 110956 {sqlite3Vacuum(pParse);} 110766 break; 110957 break; 110767 case 254: /* cmd ::= PRAGMA nm dbnm */ | 110958 case 252: /* cmd ::= PRAGMA nm dbnm */ 110768 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} 110959 {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} 110769 break; 110960 break; 110770 case 255: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ | 110961 case 253: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ 110771 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor. 110962 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor. 110772 break; 110963 break; 110773 case 256: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ | 110964 case 254: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ 110774 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor 110965 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor 110775 break; 110966 break; 110776 case 257: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ | 110967 case 255: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ 110777 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor. 110968 {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor. 110778 break; 110969 break; 110779 case 258: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ | 110970 case 256: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ 110780 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor 110971 {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor 110781 break; 110972 break; 110782 case 268: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ | 110973 case 266: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ 110783 { 110974 { 110784 Token all; 110975 Token all; 110785 all.z = yymsp[-3].minor.yy0.z; 110976 all.z = yymsp[-3].minor.yy0.z; 110786 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.y 110977 all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.y 110787 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy327, &all); 110978 sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy327, &all); 110788 } 110979 } 110789 break; 110980 break; 110790 case 269: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_tim | 110981 case 267: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_tim 110791 { 110982 { 110792 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[ 110983 sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[ 110793 yygotominor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].mino 110984 yygotominor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].mino 110794 } 110985 } 110795 break; 110986 break; 110796 case 270: /* trigger_time ::= BEFORE */ | 110987 case 268: /* trigger_time ::= BEFORE */ 110797 case 273: /* trigger_time ::= */ yytestcase(yyruleno==273); | 110988 case 271: /* trigger_time ::= */ yytestcase(yyruleno==271); 110798 { yygotominor.yy392 = TK_BEFORE; } 110989 { yygotominor.yy392 = TK_BEFORE; } 110799 break; 110990 break; 110800 case 271: /* trigger_time ::= AFTER */ | 110991 case 269: /* trigger_time ::= AFTER */ 110801 { yygotominor.yy392 = TK_AFTER; } 110992 { yygotominor.yy392 = TK_AFTER; } 110802 break; 110993 break; 110803 case 272: /* trigger_time ::= INSTEAD OF */ | 110994 case 270: /* trigger_time ::= INSTEAD OF */ 110804 { yygotominor.yy392 = TK_INSTEAD;} 110995 { yygotominor.yy392 = TK_INSTEAD;} 110805 break; 110996 break; 110806 case 274: /* trigger_event ::= DELETE|INSERT */ | 110997 case 272: /* trigger_event ::= DELETE|INSERT */ 110807 case 275: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==275); | 110998 case 273: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==273); 110808 {yygotominor.yy410.a = yymsp[0].major; yygotominor.yy410.b = 0;} 110999 {yygotominor.yy410.a = yymsp[0].major; yygotominor.yy410.b = 0;} 110809 break; 111000 break; 110810 case 276: /* trigger_event ::= UPDATE OF inscollist */ | 111001 case 274: /* trigger_event ::= UPDATE OF inscollist */ 110811 {yygotominor.yy410.a = TK_UPDATE; yygotominor.yy410.b = yymsp[0].minor.yy180;} 111002 {yygotominor.yy410.a = TK_UPDATE; yygotominor.yy410.b = yymsp[0].minor.yy180;} 110812 break; 111003 break; 110813 case 279: /* when_clause ::= */ | 111004 case 277: /* when_clause ::= */ 110814 case 301: /* key_opt ::= */ yytestcase(yyruleno==301); | 111005 case 299: /* key_opt ::= */ yytestcase(yyruleno==299); 110815 { yygotominor.yy122 = 0; } 111006 { yygotominor.yy122 = 0; } 110816 break; 111007 break; 110817 case 280: /* when_clause ::= WHEN expr */ | 111008 case 278: /* when_clause ::= WHEN expr */ 110818 case 302: /* key_opt ::= KEY expr */ yytestcase(yyruleno==302); | 111009 case 300: /* key_opt ::= KEY expr */ yytestcase(yyruleno==300); 110819 { yygotominor.yy122 = yymsp[0].minor.yy342.pExpr; } 111010 { yygotominor.yy122 = yymsp[0].minor.yy342.pExpr; } 110820 break; 111011 break; 110821 case 281: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ | 111012 case 279: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ 110822 { 111013 { 110823 assert( yymsp[-2].minor.yy327!=0 ); 111014 assert( yymsp[-2].minor.yy327!=0 ); 110824 yymsp[-2].minor.yy327->pLast->pNext = yymsp[-1].minor.yy327; 111015 yymsp[-2].minor.yy327->pLast->pNext = yymsp[-1].minor.yy327; 110825 yymsp[-2].minor.yy327->pLast = yymsp[-1].minor.yy327; 111016 yymsp[-2].minor.yy327->pLast = yymsp[-1].minor.yy327; 110826 yygotominor.yy327 = yymsp[-2].minor.yy327; 111017 yygotominor.yy327 = yymsp[-2].minor.yy327; 110827 } 111018 } 110828 break; 111019 break; 110829 case 282: /* trigger_cmd_list ::= trigger_cmd SEMI */ | 111020 case 280: /* trigger_cmd_list ::= trigger_cmd SEMI */ 110830 { 111021 { 110831 assert( yymsp[-1].minor.yy327!=0 ); 111022 assert( yymsp[-1].minor.yy327!=0 ); 110832 yymsp[-1].minor.yy327->pLast = yymsp[-1].minor.yy327; 111023 yymsp[-1].minor.yy327->pLast = yymsp[-1].minor.yy327; 110833 yygotominor.yy327 = yymsp[-1].minor.yy327; 111024 yygotominor.yy327 = yymsp[-1].minor.yy327; 110834 } 111025 } 110835 break; 111026 break; 110836 case 284: /* trnm ::= nm DOT nm */ | 111027 case 282: /* trnm ::= nm DOT nm */ 110837 { 111028 { 110838 yygotominor.yy0 = yymsp[0].minor.yy0; 111029 yygotominor.yy0 = yymsp[0].minor.yy0; 110839 sqlite3ErrorMsg(pParse, 111030 sqlite3ErrorMsg(pParse, 110840 "qualified table names are not allowed on INSERT, UPDATE, and DELETE " 111031 "qualified table names are not allowed on INSERT, UPDATE, and DELETE " 110841 "statements within triggers"); 111032 "statements within triggers"); 110842 } 111033 } 110843 break; 111034 break; 110844 case 286: /* tridxby ::= INDEXED BY nm */ | 111035 case 284: /* tridxby ::= INDEXED BY nm */ 110845 { 111036 { 110846 sqlite3ErrorMsg(pParse, 111037 sqlite3ErrorMsg(pParse, 110847 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " 111038 "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " 110848 "within triggers"); 111039 "within triggers"); 110849 } 111040 } 110850 break; 111041 break; 110851 case 287: /* tridxby ::= NOT INDEXED */ | 111042 case 285: /* tridxby ::= NOT INDEXED */ 110852 { 111043 { 110853 sqlite3ErrorMsg(pParse, 111044 sqlite3ErrorMsg(pParse, 110854 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " 111045 "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " 110855 "within triggers"); 111046 "within triggers"); 110856 } 111047 } 110857 break; 111048 break; 110858 case 288: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_ | 111049 case 286: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_ 110859 { yygotominor.yy327 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, 111050 { yygotominor.yy327 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, 110860 break; 111051 break; 110861 case 289: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt valuelist | 111052 case 287: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt valuelist 110862 {yygotominor.yy327 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, 111053 {yygotominor.yy327 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, 110863 break; 111054 break; 110864 case 290: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select */ | 111055 case 288: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select */ 110865 {yygotominor.yy327 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, 111056 {yygotominor.yy327 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, 110866 break; 111057 break; 110867 case 291: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */ | 111058 case 289: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */ 110868 {yygotominor.yy327 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, 111059 {yygotominor.yy327 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, 110869 break; 111060 break; 110870 case 292: /* trigger_cmd ::= select */ | 111061 case 290: /* trigger_cmd ::= select */ 110871 {yygotominor.yy327 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy159); 111062 {yygotominor.yy327 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy159); 110872 break; 111063 break; 110873 case 293: /* expr ::= RAISE LP IGNORE RP */ | 111064 case 291: /* expr ::= RAISE LP IGNORE RP */ 110874 { 111065 { 110875 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0); 111066 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0); 110876 if( yygotominor.yy342.pExpr ){ 111067 if( yygotominor.yy342.pExpr ){ 110877 yygotominor.yy342.pExpr->affinity = OE_Ignore; 111068 yygotominor.yy342.pExpr->affinity = OE_Ignore; 110878 } 111069 } 110879 yygotominor.yy342.zStart = yymsp[-3].minor.yy0.z; 111070 yygotominor.yy342.zStart = yymsp[-3].minor.yy0.z; 110880 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; 111071 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; 110881 } 111072 } 110882 break; 111073 break; 110883 case 294: /* expr ::= RAISE LP raisetype COMMA nm RP */ | 111074 case 292: /* expr ::= RAISE LP raisetype COMMA nm RP */ 110884 { 111075 { 110885 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].mino 111076 yygotominor.yy342.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].mino 110886 if( yygotominor.yy342.pExpr ) { 111077 if( yygotominor.yy342.pExpr ) { 110887 yygotominor.yy342.pExpr->affinity = (char)yymsp[-3].minor.yy392; 111078 yygotominor.yy342.pExpr->affinity = (char)yymsp[-3].minor.yy392; 110888 } 111079 } 110889 yygotominor.yy342.zStart = yymsp[-5].minor.yy0.z; 111080 yygotominor.yy342.zStart = yymsp[-5].minor.yy0.z; 110890 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; 111081 yygotominor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; 110891 } 111082 } 110892 break; 111083 break; 110893 case 295: /* raisetype ::= ROLLBACK */ | 111084 case 293: /* raisetype ::= ROLLBACK */ 110894 {yygotominor.yy392 = OE_Rollback;} 111085 {yygotominor.yy392 = OE_Rollback;} 110895 break; 111086 break; 110896 case 297: /* raisetype ::= FAIL */ | 111087 case 295: /* raisetype ::= FAIL */ 110897 {yygotominor.yy392 = OE_Fail;} 111088 {yygotominor.yy392 = OE_Fail;} 110898 break; 111089 break; 110899 case 298: /* cmd ::= DROP TRIGGER ifexists fullname */ | 111090 case 296: /* cmd ::= DROP TRIGGER ifexists fullname */ 110900 { 111091 { 110901 sqlite3DropTrigger(pParse,yymsp[0].minor.yy347,yymsp[-1].minor.yy392); 111092 sqlite3DropTrigger(pParse,yymsp[0].minor.yy347,yymsp[-1].minor.yy392); 110902 } 111093 } 110903 break; 111094 break; 110904 case 299: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ | 111095 case 297: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ 110905 { 111096 { 110906 sqlite3Attach(pParse, yymsp[-3].minor.yy342.pExpr, yymsp[-1].minor.yy342.pExpr 111097 sqlite3Attach(pParse, yymsp[-3].minor.yy342.pExpr, yymsp[-1].minor.yy342.pExpr 110907 } 111098 } 110908 break; 111099 break; 110909 case 300: /* cmd ::= DETACH database_kw_opt expr */ | 111100 case 298: /* cmd ::= DETACH database_kw_opt expr */ 110910 { 111101 { 110911 sqlite3Detach(pParse, yymsp[0].minor.yy342.pExpr); 111102 sqlite3Detach(pParse, yymsp[0].minor.yy342.pExpr); 110912 } 111103 } 110913 break; 111104 break; 110914 case 305: /* cmd ::= REINDEX */ | 111105 case 303: /* cmd ::= REINDEX */ 110915 {sqlite3Reindex(pParse, 0, 0);} 111106 {sqlite3Reindex(pParse, 0, 0);} 110916 break; 111107 break; 110917 case 306: /* cmd ::= REINDEX nm dbnm */ | 111108 case 304: /* cmd ::= REINDEX nm dbnm */ 110918 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} 111109 {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} 110919 break; 111110 break; 110920 case 307: /* cmd ::= ANALYZE */ | 111111 case 305: /* cmd ::= ANALYZE */ 110921 {sqlite3Analyze(pParse, 0, 0);} 111112 {sqlite3Analyze(pParse, 0, 0);} 110922 break; 111113 break; 110923 case 308: /* cmd ::= ANALYZE nm dbnm */ | 111114 case 306: /* cmd ::= ANALYZE nm dbnm */ 110924 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} 111115 {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} 110925 break; 111116 break; 110926 case 309: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ | 111117 case 307: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ 110927 { 111118 { 110928 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy347,&yymsp[0].minor.yy0); 111119 sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy347,&yymsp[0].minor.yy0); 110929 } 111120 } 110930 break; 111121 break; 110931 case 310: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt colu | 111122 case 308: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt colu 110932 { 111123 { 110933 sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy0); 111124 sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy0); 110934 } 111125 } 110935 break; 111126 break; 110936 case 311: /* add_column_fullname ::= fullname */ | 111127 case 309: /* add_column_fullname ::= fullname */ 110937 { 111128 { 110938 pParse->db->lookaside.bEnabled = 0; 111129 pParse->db->lookaside.bEnabled = 0; 110939 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy347); 111130 sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy347); 110940 } 111131 } 110941 break; 111132 break; 110942 case 314: /* cmd ::= create_vtab */ | 111133 case 312: /* cmd ::= create_vtab */ 110943 {sqlite3VtabFinishParse(pParse,0);} 111134 {sqlite3VtabFinishParse(pParse,0);} 110944 break; 111135 break; 110945 case 315: /* cmd ::= create_vtab LP vtabarglist RP */ | 111136 case 313: /* cmd ::= create_vtab LP vtabarglist RP */ 110946 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} 111137 {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} 110947 break; 111138 break; 110948 case 316: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm US | 111139 case 314: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm US 110949 { 111140 { 110950 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &y 111141 sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &y 110951 } 111142 } 110952 break; 111143 break; 110953 case 319: /* vtabarg ::= */ | 111144 case 317: /* vtabarg ::= */ 110954 {sqlite3VtabArgInit(pParse);} 111145 {sqlite3VtabArgInit(pParse);} 110955 break; 111146 break; 110956 case 321: /* vtabargtoken ::= ANY */ | 111147 case 319: /* vtabargtoken ::= ANY */ 110957 case 322: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==322); | 111148 case 320: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==320); 110958 case 323: /* lp ::= LP */ yytestcase(yyruleno==323); | 111149 case 321: /* lp ::= LP */ yytestcase(yyruleno==321); 110959 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} 111150 {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} 110960 break; 111151 break; 110961 default: 111152 default: 110962 /* (0) input ::= cmdlist */ yytestcase(yyruleno==0); 111153 /* (0) input ::= cmdlist */ yytestcase(yyruleno==0); 110963 /* (1) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==1); 111154 /* (1) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==1); 110964 /* (2) cmdlist ::= ecmd */ yytestcase(yyruleno==2); 111155 /* (2) cmdlist ::= ecmd */ yytestcase(yyruleno==2); 110965 /* (3) ecmd ::= SEMI */ yytestcase(yyruleno==3); 111156 /* (3) ecmd ::= SEMI */ yytestcase(yyruleno==3); ................................................................................................................................................................................ 110971 /* (21) savepoint_opt ::= */ yytestcase(yyruleno==21); 111162 /* (21) savepoint_opt ::= */ yytestcase(yyruleno==21); 110972 /* (25) cmd ::= create_table create_table_args */ yytestcase(yyruleno==25) 111163 /* (25) cmd ::= create_table create_table_args */ yytestcase(yyruleno==25) 110973 /* (34) columnlist ::= columnlist COMMA column */ yytestcase(yyruleno==34) 111164 /* (34) columnlist ::= columnlist COMMA column */ yytestcase(yyruleno==34) 110974 /* (35) columnlist ::= column */ yytestcase(yyruleno==35); 111165 /* (35) columnlist ::= column */ yytestcase(yyruleno==35); 110975 /* (44) type ::= */ yytestcase(yyruleno==44); 111166 /* (44) type ::= */ yytestcase(yyruleno==44); 110976 /* (51) signed ::= plus_num */ yytestcase(yyruleno==51); 111167 /* (51) signed ::= plus_num */ yytestcase(yyruleno==51); 110977 /* (52) signed ::= minus_num */ yytestcase(yyruleno==52); 111168 /* (52) signed ::= minus_num */ yytestcase(yyruleno==52); 110978 /* (53) carglist ::= carglist carg */ yytestcase(yyruleno==53); | 111169 /* (53) carglist ::= carglist cname ccons */ yytestcase(yyruleno==53); 110979 /* (54) carglist ::= */ yytestcase(yyruleno==54); 111170 /* (54) carglist ::= */ yytestcase(yyruleno==54); 110980 /* (55) carg ::= CONSTRAINT nm ccons */ yytestcase(yyruleno==55); < 110981 /* (56) carg ::= ccons */ yytestcase(yyruleno==56); < 110982 /* (62) ccons ::= NULL onconf */ yytestcase(yyruleno==62); 111171 /* (62) ccons ::= NULL onconf */ yytestcase(yyruleno==62); 110983 /* (90) conslist ::= conslist COMMA tcons */ yytestcase(yyruleno==90); | 111172 /* (90) conslist ::= conslist COMMA cname tcons */ yytestcase(yyruleno==90 110984 /* (91) conslist ::= conslist tcons */ yytestcase(yyruleno==91); | 111173 /* (91) conslist ::= cname tcons */ yytestcase(yyruleno==91); 110985 /* (92) conslist ::= tcons */ yytestcase(yyruleno==92); < 110986 /* (93) tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==93); < 110987 /* (277) foreach_clause ::= */ yytestcase(yyruleno==277); | 111174 /* (275) foreach_clause ::= */ yytestcase(yyruleno==275); 110988 /* (278) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==278); | 111175 /* (276) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==276); 110989 /* (285) tridxby ::= */ yytestcase(yyruleno==285); | 111176 /* (283) tridxby ::= */ yytestcase(yyruleno==283); 110990 /* (303) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==303); | 111177 /* (301) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==301); 110991 /* (304) database_kw_opt ::= */ yytestcase(yyruleno==304); | 111178 /* (302) database_kw_opt ::= */ yytestcase(yyruleno==302); 110992 /* (312) kwcolumn_opt ::= */ yytestcase(yyruleno==312); | 111179 /* (310) kwcolumn_opt ::= */ yytestcase(yyruleno==310); 110993 /* (313) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==313); | 111180 /* (311) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==311); 110994 /* (317) vtabarglist ::= vtabarg */ yytestcase(yyruleno==317); | 111181 /* (315) vtabarglist ::= vtabarg */ yytestcase(yyruleno==315); 110995 /* (318) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno= | 111182 /* (316) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno= 110996 /* (320) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==320); | 111183 /* (318) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==318); 110997 /* (324) anylist ::= */ yytestcase(yyruleno==324); | 111184 /* (322) anylist ::= */ yytestcase(yyruleno==322); 110998 /* (325) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==325); | 111185 /* (323) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==323); 110999 /* (326) anylist ::= anylist ANY */ yytestcase(yyruleno==326); | 111186 /* (324) anylist ::= anylist ANY */ yytestcase(yyruleno==324); 111000 break; 111187 break; 111001 }; 111188 }; 111002 yygoto = yyRuleInfo[yyruleno].lhs; 111189 yygoto = yyRuleInfo[yyruleno].lhs; 111003 yysize = yyRuleInfo[yyruleno].nrhs; 111190 yysize = yyRuleInfo[yyruleno].nrhs; 111004 yypParser->yyidx -= yysize; 111191 yypParser->yyidx -= yysize; 111005 yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto); 111192 yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto); 111006 if( yyact < YYNSTATE ){ 111193 if( yyact < YYNSTATE ){ ................................................................................................................................................................................ 115887 ** 116074 ** 115888 ** FTS3 used to optionally store character offsets using a compile-time 116075 ** FTS3 used to optionally store character offsets using a compile-time 115889 ** option. But that functionality is no longer supported. 116076 ** option. But that functionality is no longer supported. 115890 ** 116077 ** 115891 ** A doclist is stored like this: 116078 ** A doclist is stored like this: 115892 ** 116079 ** 115893 ** array { 116080 ** array { 115894 ** varint docid; | 116081 ** varint docid; (delta from previous doclist) 115895 ** array { (position list for column 0) 116082 ** array { (position list for column 0) 115896 ** varint position; (2 more than the delta from previous position) 116083 ** varint position; (2 more than the delta from previous position) 115897 ** } 116084 ** } 115898 ** array { 116085 ** array { 115899 ** varint POS_COLUMN; (marks start of position list for new column) 116086 ** varint POS_COLUMN; (marks start of position list for new column) 115900 ** varint column; (index of new column) 116087 ** varint column; (index of new column) 115901 ** array { 116088 ** array { ................................................................................................................................................................................ 115918 ** value: 123 5 9 1 1 14 35 0 234 72 0 116105 ** value: 123 5 9 1 1 14 35 0 234 72 0 115919 ** 116106 ** 115920 ** The 123 value is the first docid. For column zero in this document 116107 ** The 123 value is the first docid. For column zero in this document 115921 ** there are two matches at positions 3 and 10 (5-2 and 9-2+3). The 1 116108 ** there are two matches at positions 3 and 10 (5-2 and 9-2+3). The 1 115922 ** at D signals the start of a new column; the 1 at E indicates that the 116109 ** at D signals the start of a new column; the 1 at E indicates that the 115923 ** new column is column number 1. There are two positions at 12 and 45 116110 ** new column is column number 1. There are two positions at 12 and 45 115924 ** (14-2 and 35-2+12). The 0 at H indicate the end-of-document. The 116111 ** (14-2 and 35-2+12). The 0 at H indicate the end-of-document. The 115925 ** 234 at I is the next docid. It has one position 72 (72-2) and then | 116112 ** 234 at I is the delta to next docid (357). It has one position 70 115926 ** terminates with the 0 at K. | 116113 ** (72-2) and then terminates with the 0 at K. 115927 ** 116114 ** 115928 ** A "position-list" is the list of positions for multiple columns for 116115 ** A "position-list" is the list of positions for multiple columns for 115929 ** a single docid. A "column-list" is the set of positions for a single 116116 ** a single docid. A "column-list" is the set of positions for a single 115930 ** column. Hence, a position-list consists of one or more column-lists, 116117 ** column. Hence, a position-list consists of one or more column-lists, 115931 ** a document record consists of a docid followed by a position-list and 116118 ** a document record consists of a docid followed by a position-list and 115932 ** a doclist consists of one or more document records. 116119 ** a doclist consists of one or more document records. 115933 ** 116120 ** ................................................................................................................................................................................ 116454 */ 116641 */ 116455 #define SizeofArray(X) ((int)(sizeof(X)/sizeof(X[0]))) 116642 #define SizeofArray(X) ((int)(sizeof(X)/sizeof(X[0]))) 116456 116643 116457 116644 116458 #ifndef MIN 116645 #ifndef MIN 116459 # define MIN(x,y) ((x)<(y)?(x):(y)) 116646 # define MIN(x,y) ((x)<(y)?(x):(y)) 116460 #endif 116647 #endif > 116648 #ifndef MAX > 116649 # define MAX(x,y) ((x)>(y)?(x):(y)) > 116650 #endif 116461 116651 116462 /* 116652 /* 116463 ** Maximum length of a varint encoded integer. The varint format is different 116653 ** Maximum length of a varint encoded integer. The varint format is different 116464 ** from that used by SQLite, so the maximum length is 10, not 9. 116654 ** from that used by SQLite, so the maximum length is 10, not 9. 116465 */ 116655 */ 116466 #define FTS3_VARINT_MAX 10 116656 #define FTS3_VARINT_MAX 10 116467 116657 ................................................................................................................................................................................ 116508 ** false. 116698 ** false. 116509 */ 116699 */ 116510 #ifdef SQLITE_COVERAGE_TEST 116700 #ifdef SQLITE_COVERAGE_TEST 116511 # define ALWAYS(x) (1) 116701 # define ALWAYS(x) (1) 116512 # define NEVER(X) (0) 116702 # define NEVER(X) (0) 116513 #else 116703 #else 116514 # define ALWAYS(x) (x) 116704 # define ALWAYS(x) (x) 116515 # define NEVER(X) (x) | 116705 # define NEVER(x) (x) 116516 #endif 116706 #endif 116517 116707 116518 /* 116708 /* 116519 ** Internal types used by SQLite. 116709 ** Internal types used by SQLite. 116520 */ 116710 */ 116521 typedef unsigned char u8; /* 1-byte (or larger) unsigned integer */ 116711 typedef unsigned char u8; /* 1-byte (or larger) unsigned integer */ 116522 typedef short int i16; /* 2-byte (or larger) signed integer */ 116712 typedef short int i16; /* 2-byte (or larger) signed integer */ 116523 typedef unsigned int u32; /* 4-byte unsigned integer */ 116713 typedef unsigned int u32; /* 4-byte unsigned integer */ 116524 typedef sqlite3_uint64 u64; /* 8-byte unsigned integer */ 116714 typedef sqlite3_uint64 u64; /* 8-byte unsigned integer */ > 116715 typedef sqlite3_int64 i64; /* 8-byte signed integer */ 116525 116716 116526 /* 116717 /* 116527 ** Macro used to suppress compiler warnings for unused parameters. 116718 ** Macro used to suppress compiler warnings for unused parameters. 116528 */ 116719 */ 116529 #define UNUSED_PARAMETER(x) (void)(x) 116720 #define UNUSED_PARAMETER(x) (void)(x) 116530 116721 116531 /* 116722 /* ................................................................................................................................................................................ 116580 const char *zDb; /* logical database name */ 116771 const char *zDb; /* logical database name */ 116581 const char *zName; /* virtual table name */ 116772 const char *zName; /* virtual table name */ 116582 int nColumn; /* number of named columns in virtual table */ 116773 int nColumn; /* number of named columns in virtual table */ 116583 char **azColumn; /* column names. malloced */ 116774 char **azColumn; /* column names. malloced */ 116584 sqlite3_tokenizer *pTokenizer; /* tokenizer for inserts and queries */ 116775 sqlite3_tokenizer *pTokenizer; /* tokenizer for inserts and queries */ 116585 char *zContentTbl; /* content=xxx option, or NULL */ 116776 char *zContentTbl; /* content=xxx option, or NULL */ 116586 char *zLanguageid; /* languageid=xxx option, or NULL */ 116777 char *zLanguageid; /* languageid=xxx option, or NULL */ > 116778 u8 bAutoincrmerge; /* True if automerge=1 */ > 116779 u32 nLeafAdd; /* Number of leaf blocks added this trans */ 116587 116780 116588 /* Precompiled statements used by the implementation. Each of these 116781 /* Precompiled statements used by the implementation. Each of these 116589 ** statements is run and reset within a single virtual table API call. 116782 ** statements is run and reset within a single virtual table API call. 116590 */ 116783 */ 116591 sqlite3_stmt *aStmt[28]; | 116784 sqlite3_stmt *aStmt[37]; 116592 116785 116593 char *zReadExprlist; 116786 char *zReadExprlist; 116594 char *zWriteExprlist; 116787 char *zWriteExprlist; 116595 116788 116596 int nNodeSize; /* Soft limit for node size */ 116789 int nNodeSize; /* Soft limit for node size */ > 116790 u8 bFts4; /* True for FTS4, false for FTS3 */ 116597 u8 bHasStat; /* True if %_stat table exists */ 116791 u8 bHasStat; /* True if %_stat table exists */ 116598 u8 bHasDocsize; /* True if %_docsize table exists */ 116792 u8 bHasDocsize; /* True if %_docsize table exists */ 116599 u8 bDescIdx; /* True if doclists are in reverse order */ 116793 u8 bDescIdx; /* True if doclists are in reverse order */ > 116794 u8 bIgnoreSavepoint; /* True to ignore xSavepoint invocations */ 116600 int nPgsz; /* Page size for host database */ 116795 int nPgsz; /* Page size for host database */ 116601 char *zSegmentsTbl; /* Name of %_segments table */ 116796 char *zSegmentsTbl; /* Name of %_segments table */ 116602 sqlite3_blob *pSegments; /* Blob handle open on %_segments table */ 116797 sqlite3_blob *pSegments; /* Blob handle open on %_segments table */ 116603 116798 116604 /* TODO: Fix the first paragraph of this comment. | 116799 /* 116605 ** < 116606 ** The following array of hash tables is used to buffer pending index 116800 ** The following array of hash tables is used to buffer pending index 116607 ** updates during transactions. Variable nPendingData estimates the memory | 116801 ** updates during transactions. All pending updates buffered at any one > 116802 ** time must share a common language-id (see the FTS4 langid= feature). 116608 ** size of the pending data, including hash table overhead, not including | 116803 ** The current language id is stored in variable iPrevLangid. 116609 ** malloc overhead. When nPendingData exceeds nMaxPendingData, the buffer < 116610 ** is flushed automatically. Variable iPrevDocid is the docid of the most < 116611 ** recently inserted record. < 116612 ** 116804 ** 116613 ** A single FTS4 table may have multiple full-text indexes. For each index 116805 ** A single FTS4 table may have multiple full-text indexes. For each index 116614 ** there is an entry in the aIndex[] array. Index 0 is an index of all the 116806 ** there is an entry in the aIndex[] array. Index 0 is an index of all the 116615 ** terms that appear in the document set. Each subsequent index in aIndex[] 116807 ** terms that appear in the document set. Each subsequent index in aIndex[] 116616 ** is an index of prefixes of a specific length. 116808 ** is an index of prefixes of a specific length. > 116809 ** > 116810 ** Variable nPendingData contains an estimate the memory consumed by the > 116811 ** pending data structures, including hash table overhead, but not including > 116812 ** malloc overhead. When nPendingData exceeds nMaxPendingData, all hash > 116813 ** tables are flushed to disk. Variable iPrevDocid is the docid of the most > 116814 ** recently inserted record. 116617 */ 116815 */ 116618 int nIndex; /* Size of aIndex[] */ 116816 int nIndex; /* Size of aIndex[] */ 116619 struct Fts3Index { 116817 struct Fts3Index { 116620 int nPrefix; /* Prefix length (0 for main terms index) */ 116818 int nPrefix; /* Prefix length (0 for main terms index) */ 116621 Fts3Hash hPending; /* Pending terms table for this index */ 116819 Fts3Hash hPending; /* Pending terms table for this index */ 116622 } *aIndex; 116820 } *aIndex; 116623 int nMaxPendingData; /* Max pending data before flush to disk */ 116821 int nMaxPendingData; /* Max pending data before flush to disk */ ................................................................................................................................................................................ 116808 SQLITE_PRIVATE int sqlite3Fts3SelectDocsize(Fts3Table *, sqlite3_int64, sqlite3_ 117006 SQLITE_PRIVATE int sqlite3Fts3SelectDocsize(Fts3Table *, sqlite3_int64, sqlite3_ 116809 117007 116810 SQLITE_PRIVATE void sqlite3Fts3FreeDeferredTokens(Fts3Cursor *); 117008 SQLITE_PRIVATE void sqlite3Fts3FreeDeferredTokens(Fts3Cursor *); 116811 SQLITE_PRIVATE int sqlite3Fts3DeferToken(Fts3Cursor *, Fts3PhraseToken *, int); 117009 SQLITE_PRIVATE int sqlite3Fts3DeferToken(Fts3Cursor *, Fts3PhraseToken *, int); 116812 SQLITE_PRIVATE int sqlite3Fts3CacheDeferredDoclists(Fts3Cursor *); 117010 SQLITE_PRIVATE int sqlite3Fts3CacheDeferredDoclists(Fts3Cursor *); 116813 SQLITE_PRIVATE void sqlite3Fts3FreeDeferredDoclists(Fts3Cursor *); 117011 SQLITE_PRIVATE void sqlite3Fts3FreeDeferredDoclists(Fts3Cursor *); 116814 SQLITE_PRIVATE void sqlite3Fts3SegmentsClose(Fts3Table *); 117012 SQLITE_PRIVATE void sqlite3Fts3SegmentsClose(Fts3Table *); > 117013 SQLITE_PRIVATE int sqlite3Fts3MaxLevel(Fts3Table *, int *); 116815 117014 116816 /* Special values interpreted by sqlite3SegReaderCursor() */ 117015 /* Special values interpreted by sqlite3SegReaderCursor() */ 116817 #define FTS3_SEGCURSOR_PENDING -1 117016 #define FTS3_SEGCURSOR_PENDING -1 116818 #define FTS3_SEGCURSOR_ALL -2 117017 #define FTS3_SEGCURSOR_ALL -2 116819 117018 116820 SQLITE_PRIVATE int sqlite3Fts3SegReaderStart(Fts3Table*, Fts3MultiSegReader*, Ft 117019 SQLITE_PRIVATE int sqlite3Fts3SegReaderStart(Fts3Table*, Fts3MultiSegReader*, Ft 116821 SQLITE_PRIVATE int sqlite3Fts3SegReaderStep(Fts3Table *, Fts3MultiSegReader *); 117020 SQLITE_PRIVATE int sqlite3Fts3SegReaderStep(Fts3Table *, Fts3MultiSegReader *); ................................................................................................................................................................................ 116859 /* Output values. Valid only after Fts3SegReaderStep() returns SQLITE_ROW. */ 117058 /* Output values. Valid only after Fts3SegReaderStep() returns SQLITE_ROW. */ 116860 char *zTerm; /* Pointer to term buffer */ 117059 char *zTerm; /* Pointer to term buffer */ 116861 int nTerm; /* Size of zTerm in bytes */ 117060 int nTerm; /* Size of zTerm in bytes */ 116862 char *aDoclist; /* Pointer to doclist buffer */ 117061 char *aDoclist; /* Pointer to doclist buffer */ 116863 int nDoclist; /* Size of aDoclist[] in bytes */ 117062 int nDoclist; /* Size of aDoclist[] in bytes */ 116864 }; 117063 }; 116865 117064 > 117065 SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table*,int,int); > 117066 116866 /* fts3.c */ 117067 /* fts3.c */ 116867 SQLITE_PRIVATE int sqlite3Fts3PutVarint(char *, sqlite3_int64); 117068 SQLITE_PRIVATE int sqlite3Fts3PutVarint(char *, sqlite3_int64); 116868 SQLITE_PRIVATE int sqlite3Fts3GetVarint(const char *, sqlite_int64 *); 117069 SQLITE_PRIVATE int sqlite3Fts3GetVarint(const char *, sqlite_int64 *); 116869 SQLITE_PRIVATE int sqlite3Fts3GetVarint32(const char *, int *); 117070 SQLITE_PRIVATE int sqlite3Fts3GetVarint32(const char *, int *); 116870 SQLITE_PRIVATE int sqlite3Fts3VarintLen(sqlite3_uint64); 117071 SQLITE_PRIVATE int sqlite3Fts3VarintLen(sqlite3_uint64); 116871 SQLITE_PRIVATE void sqlite3Fts3Dequote(char *); 117072 SQLITE_PRIVATE void sqlite3Fts3Dequote(char *); 116872 SQLITE_PRIVATE void sqlite3Fts3DoclistPrev(int,char*,int,char**,sqlite3_int64*,i 117073 SQLITE_PRIVATE void sqlite3Fts3DoclistPrev(int,char*,int,char**,sqlite3_int64*,i 116873 SQLITE_PRIVATE int sqlite3Fts3EvalPhraseStats(Fts3Cursor *, Fts3Expr *, u32 *); 117074 SQLITE_PRIVATE int sqlite3Fts3EvalPhraseStats(Fts3Cursor *, Fts3Expr *, u32 *); 116874 SQLITE_PRIVATE int sqlite3Fts3FirstFilter(sqlite3_int64, char *, int, char *); 117075 SQLITE_PRIVATE int sqlite3Fts3FirstFilter(sqlite3_int64, char *, int, char *); > 117076 SQLITE_PRIVATE void sqlite3Fts3CreateStatTable(int*, Fts3Table*); 116875 117077 116876 /* fts3_tokenizer.c */ 117078 /* fts3_tokenizer.c */ 116877 SQLITE_PRIVATE const char *sqlite3Fts3NextToken(const char *, int *); 117079 SQLITE_PRIVATE const char *sqlite3Fts3NextToken(const char *, int *); 116878 SQLITE_PRIVATE int sqlite3Fts3InitHashTable(sqlite3 *, Fts3Hash *, const char *) 117080 SQLITE_PRIVATE int sqlite3Fts3InitHashTable(sqlite3 *, Fts3Hash *, const char *) 116879 SQLITE_PRIVATE int sqlite3Fts3InitTokenizer(Fts3Hash *pHash, const char *, 117081 SQLITE_PRIVATE int sqlite3Fts3InitTokenizer(Fts3Hash *pHash, const char *, 116880 sqlite3_tokenizer **, char ** 117082 sqlite3_tokenizer **, char ** 116881 ); 117083 ); ................................................................................................................................................................................ 117196 } 117398 } 117197 117399 117198 sqlite3_free(zSql); 117400 sqlite3_free(zSql); 117199 sqlite3_free(zCols); 117401 sqlite3_free(zCols); 117200 *pRc = rc; 117402 *pRc = rc; 117201 } 117403 } 117202 } 117404 } > 117405 > 117406 /* > 117407 ** Create the %_stat table if it does not already exist. > 117408 */ > 117409 SQLITE_PRIVATE void sqlite3Fts3CreateStatTable(int *pRc, Fts3Table *p){ > 117410 fts3DbExec(pRc, p->db, > 117411 "CREATE TABLE IF NOT EXISTS %Q.'%q_stat'" > 117412 "(id INTEGER PRIMARY KEY, value BLOB);", > 117413 p->zDb, p->zName > 117414 ); > 117415 if( (*pRc)==SQLITE_OK ) p->bHasStat = 1; > 117416 } 117203 117417 117204 /* 117418 /* 117205 ** Create the backing store tables (%_content, %_segments and %_segdir) 117419 ** Create the backing store tables (%_content, %_segments and %_segdir) 117206 ** required by the FTS3 table passed as the only argument. This is done 117420 ** required by the FTS3 table passed as the only argument. This is done 117207 ** as part of the vtab xCreate() method. 117421 ** as part of the vtab xCreate() method. 117208 ** 117422 ** 117209 ** If the p->bHasDocsize boolean is true (indicating that this is an 117423 ** If the p->bHasDocsize boolean is true (indicating that this is an ................................................................................................................................................................................ 117257 ); 117471 ); 117258 if( p->bHasDocsize ){ 117472 if( p->bHasDocsize ){ 117259 fts3DbExec(&rc, db, 117473 fts3DbExec(&rc, db, 117260 "CREATE TABLE %Q.'%q_docsize'(docid INTEGER PRIMARY KEY, size BLOB);", 117474 "CREATE TABLE %Q.'%q_docsize'(docid INTEGER PRIMARY KEY, size BLOB);", 117261 p->zDb, p->zName 117475 p->zDb, p->zName 117262 ); 117476 ); 117263 } 117477 } > 117478 assert( p->bHasStat==p->bFts4 ); 117264 if( p->bHasStat ){ 117479 if( p->bHasStat ){ 117265 fts3DbExec(&rc, db, < 117266 "CREATE TABLE %Q.'%q_stat'(id INTEGER PRIMARY KEY, value BLOB);", | 117480 sqlite3Fts3CreateStatTable(&rc, p); 117267 p->zDb, p->zName < 117268 ); < 117269 } 117481 } 117270 return rc; 117482 return rc; 117271 } 117483 } 117272 117484 117273 /* 117485 /* 117274 ** Store the current database page-size in bytes in p->nPgsz. 117486 ** Store the current database page-size in bytes in p->nPgsz. 117275 ** 117487 ** ................................................................................................................................................................................ 117368 ** The pointer returned points to memory obtained from sqlite3_malloc(). It 117580 ** The pointer returned points to memory obtained from sqlite3_malloc(). It 117369 ** is the callers responsibility to call sqlite3_free() to release this 117581 ** is the callers responsibility to call sqlite3_free() to release this 117370 ** memory. 117582 ** memory. 117371 */ 117583 */ 117372 static char *fts3QuoteId(char const *zInput){ 117584 static char *fts3QuoteId(char const *zInput){ 117373 int nRet; 117585 int nRet; 117374 char *zRet; 117586 char *zRet; 117375 nRet = 2 + strlen(zInput)*2 + 1; | 117587 nRet = 2 + (int)strlen(zInput)*2 + 1; 117376 zRet = sqlite3_malloc(nRet); 117588 zRet = sqlite3_malloc(nRet); 117377 if( zRet ){ 117589 if( zRet ){ 117378 int i; 117590 int i; 117379 char *z = zRet; 117591 char *z = zRet; 117380 *(z++) = '"'; 117592 *(z++) = '"'; 117381 for(i=0; zInput[i]; i++){ 117593 for(i=0; zInput[i]; i++){ 117382 if( zInput[i]=='"' ) *(z++) = '"'; 117594 if( zInput[i]=='"' ) *(z++) = '"'; ................................................................................................................................................................................ 117624 117836 117625 /* Loop through the returned columns. Set nStr to the number of bytes of 117837 /* Loop through the returned columns. Set nStr to the number of bytes of 117626 ** space required to store a copy of each column name, including the 117838 ** space required to store a copy of each column name, including the 117627 ** nul-terminator byte. */ 117839 ** nul-terminator byte. */ 117628 nCol = sqlite3_column_count(pStmt); 117840 nCol = sqlite3_column_count(pStmt); 117629 for(i=0; i<nCol; i++){ 117841 for(i=0; i<nCol; i++){ 117630 const char *zCol = sqlite3_column_name(pStmt, i); 117842 const char *zCol = sqlite3_column_name(pStmt, i); 117631 nStr += strlen(zCol) + 1; | 117843 nStr += (int)strlen(zCol) + 1; 117632 } 117844 } 117633 117845 117634 /* Allocate and populate the array to return. */ 117846 /* Allocate and populate the array to return. */ 117635 azCol = (const char **)sqlite3_malloc(sizeof(char *) * nCol + nStr); 117847 azCol = (const char **)sqlite3_malloc(sizeof(char *) * nCol + nStr); 117636 if( azCol==0 ){ 117848 if( azCol==0 ){ 117637 rc = SQLITE_NOMEM; 117849 rc = SQLITE_NOMEM; 117638 }else{ 117850 }else{ 117639 char *p = (char *)&azCol[nCol]; 117851 char *p = (char *)&azCol[nCol]; 117640 for(i=0; i<nCol; i++){ 117852 for(i=0; i<nCol; i++){ 117641 const char *zCol = sqlite3_column_name(pStmt, i); 117853 const char *zCol = sqlite3_column_name(pStmt, i); 117642 int n = strlen(zCol)+1; | 117854 int n = (int)strlen(zCol)+1; 117643 memcpy(p, zCol, n); 117855 memcpy(p, zCol, n); 117644 azCol[i] = p; 117856 azCol[i] = p; 117645 p += n; 117857 p += n; 117646 } 117858 } 117647 } 117859 } 117648 sqlite3_finalize(pStmt); 117860 sqlite3_finalize(pStmt); 117649 117861 ................................................................................................................................................................................ 117850 118062 117851 /* If a languageid= option was specified, remove the language id 118063 /* If a languageid= option was specified, remove the language id 117852 ** column from the aCol[] array. */ 118064 ** column from the aCol[] array. */ 117853 if( rc==SQLITE_OK && zLanguageid ){ 118065 if( rc==SQLITE_OK && zLanguageid ){ 117854 int j; 118066 int j; 117855 for(j=0; j<nCol; j++){ 118067 for(j=0; j<nCol; j++){ 117856 if( sqlite3_stricmp(zLanguageid, aCol[j])==0 ){ 118068 if( sqlite3_stricmp(zLanguageid, aCol[j])==0 ){ 117857 memmove(&aCol[j], &aCol[j+1], (nCol-j) * sizeof(aCol[0])); | 118069 int k; > 118070 for(k=j; k<nCol; k++) aCol[k] = aCol[k+1]; 117858 nCol--; 118071 nCol--; 117859 break; 118072 break; 117860 } 118073 } 117861 } 118074 } 117862 } 118075 } 117863 } 118076 } 117864 } 118077 } ................................................................................................................................................................................ 117901 p->nColumn = nCol; 118114 p->nColumn = nCol; 117902 p->nPendingData = 0; 118115 p->nPendingData = 0; 117903 p->azColumn = (char **)&p[1]; 118116 p->azColumn = (char **)&p[1]; 117904 p->pTokenizer = pTokenizer; 118117 p->pTokenizer = pTokenizer; 117905 p->nMaxPendingData = FTS3_MAX_PENDING_DATA; 118118 p->nMaxPendingData = FTS3_MAX_PENDING_DATA; 117906 p->bHasDocsize = (isFts4 && bNoDocsize==0); 118119 p->bHasDocsize = (isFts4 && bNoDocsize==0); 117907 p->bHasStat = isFts4; 118120 p->bHasStat = isFts4; > 118121 p->bFts4 = isFts4; 117908 p->bDescIdx = bDescIdx; 118122 p->bDescIdx = bDescIdx; > 118123 p->bAutoincrmerge = 0xff; /* 0xff means setting unknown */ 117909 p->zContentTbl = zContent; 118124 p->zContentTbl = zContent; 117910 p->zLanguageid = zLanguageid; 118125 p->zLanguageid = zLanguageid; 117911 zContent = 0; 118126 zContent = 0; 117912 zLanguageid = 0; 118127 zLanguageid = 0; 117913 TESTONLY( p->inTransaction = -1 ); 118128 TESTONLY( p->inTransaction = -1 ); 117914 TESTONLY( p->mxSavepoint = -1 ); 118129 TESTONLY( p->mxSavepoint = -1 ); 117915 118130 ................................................................................................................................................................................ 117953 118168 117954 /* If this is an xCreate call, create the underlying tables in the 118169 /* If this is an xCreate call, create the underlying tables in the 117955 ** database. TODO: For xConnect(), it could verify that said tables exist. 118170 ** database. TODO: For xConnect(), it could verify that said tables exist. 117956 */ 118171 */ 117957 if( isCreate ){ 118172 if( isCreate ){ 117958 rc = fts3CreateTables(p); 118173 rc = fts3CreateTables(p); 117959 } 118174 } > 118175 > 118176 /* Check to see if a legacy fts3 table has been "upgraded" by the > 118177 ** addition of a %_stat table so that it can use incremental merge. > 118178 */ > 118179 if( !isFts4 && !isCreate ){ > 118180 int rc2 = SQLITE_OK; > 118181 fts3DbExec(&rc2, db, "SELECT 1 FROM %Q.'%q_stat' WHERE id=2", > 118182 p->zDb, p->zName); > 118183 if( rc2==SQLITE_OK ) p->bHasStat = 1; > 118184 } 117960 118185 117961 /* Figure out the page-size for the database. This is required in order to 118186 /* Figure out the page-size for the database. This is required in order to 117962 ** estimate the cost of loading large doclists from the database. */ 118187 ** estimate the cost of loading large doclists from the database. */ 117963 fts3DatabasePageSize(&rc, p); 118188 fts3DatabasePageSize(&rc, p); 117964 p->nNodeSize = p->nPgsz-35; 118189 p->nNodeSize = p->nPgsz-35; 117965 118190 117966 /* Declare the table schema to SQLite. */ 118191 /* Declare the table schema to SQLite. */ ................................................................................................................................................................................ 118957 fts3PutDeltaVarint3(&p, bDescDoclist, &iPrev, &bFirstOut, i2); 119182 fts3PutDeltaVarint3(&p, bDescDoclist, &iPrev, &bFirstOut, i2); 118958 fts3PoslistCopy(&p, &p2); 119183 fts3PoslistCopy(&p, &p2); 118959 fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2); 119184 fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2); 118960 } 119185 } 118961 } 119186 } 118962 119187 118963 *paOut = aOut; 119188 *paOut = aOut; 118964 *pnOut = (p-aOut); | 119189 *pnOut = (int)(p-aOut); 118965 assert( *pnOut<=n1+n2+FTS3_VARINT_MAX-1 ); 119190 assert( *pnOut<=n1+n2+FTS3_VARINT_MAX-1 ); 118966 return SQLITE_OK; 119191 return SQLITE_OK; 118967 } 119192 } 118968 119193 118969 /* 119194 /* 118970 ** This function does a "phrase" merge of two doclists. In a phrase merge, 119195 ** This function does a "phrase" merge of two doclists. In a phrase merge, 118971 ** the output contains a copy of each position from the right-hand input 119196 ** the output contains a copy of each position from the right-hand input ................................................................................................................................................................................ 119021 fts3GetDeltaVarint3(&p1, pEnd1, bDescDoclist, &i1); 119246 fts3GetDeltaVarint3(&p1, pEnd1, bDescDoclist, &i1); 119022 }else{ 119247 }else{ 119023 fts3PoslistCopy(0, &p2); 119248 fts3PoslistCopy(0, &p2); 119024 fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2); 119249 fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2); 119025 } 119250 } 119026 } 119251 } 119027 119252 119028 *pnRight = p - aOut; | 119253 *pnRight = (int)(p - aOut); 119029 } 119254 } 119030 119255 119031 /* 119256 /* 119032 ** Argument pList points to a position list nList bytes in size. This 119257 ** Argument pList points to a position list nList bytes in size. This 119033 ** function checks to see if the position list contains any entries for 119258 ** function checks to see if the position list contains any entries for 119034 ** a token in position 0 (of any column). If so, it writes argument iDelta 119259 ** a token in position 0 (of any column). If so, it writes argument iDelta 119035 ** to the output buffer pOut, followed by a position list consisting only 119260 ** to the output buffer pOut, followed by a position list consisting only ................................................................................................................................................................................ 119297 119522 119298 /* 119523 /* 119299 ** Set up a cursor object for iterating through a full-text index or a 119524 ** Set up a cursor object for iterating through a full-text index or a 119300 ** single level therein. 119525 ** single level therein. 119301 */ 119526 */ 119302 SQLITE_PRIVATE int sqlite3Fts3SegReaderCursor( 119527 SQLITE_PRIVATE int sqlite3Fts3SegReaderCursor( 119303 Fts3Table *p, /* FTS3 table handle */ 119528 Fts3Table *p, /* FTS3 table handle */ 119304 int iLangid, | 119529 int iLangid, /* Language-id to search */ 119305 int iIndex, /* Index to search (from 0 to p->nIndex-1) */ 119530 int iIndex, /* Index to search (from 0 to p->nIndex-1) */ 119306 int iLevel, /* Level of segments to scan */ 119531 int iLevel, /* Level of segments to scan */ 119307 const char *zTerm, /* Term to query for */ 119532 const char *zTerm, /* Term to query for */ 119308 int nTerm, /* Size of zTerm in bytes */ 119533 int nTerm, /* Size of zTerm in bytes */ 119309 int isPrefix, /* True for a prefix search */ 119534 int isPrefix, /* True for a prefix search */ 119310 int isScan, /* True to scan from zTerm to EOF */ 119535 int isScan, /* True to scan from zTerm to EOF */ 119311 Fts3MultiSegReader *pCsr /* Cursor object to populate */ 119536 Fts3MultiSegReader *pCsr /* Cursor object to populate */ ................................................................................................................................................................................ 119315 || iLevel==FTS3_SEGCURSOR_PENDING 119540 || iLevel==FTS3_SEGCURSOR_PENDING 119316 || iLevel>=0 119541 || iLevel>=0 119317 ); 119542 ); 119318 assert( iLevel<FTS3_SEGDIR_MAXLEVEL ); 119543 assert( iLevel<FTS3_SEGDIR_MAXLEVEL ); 119319 assert( FTS3_SEGCURSOR_ALL<0 && FTS3_SEGCURSOR_PENDING<0 ); 119544 assert( FTS3_SEGCURSOR_ALL<0 && FTS3_SEGCURSOR_PENDING<0 ); 119320 assert( isPrefix==0 || isScan==0 ); 119545 assert( isPrefix==0 || isScan==0 ); 119321 119546 119322 /* "isScan" is only set to true by the ft4aux module, an ordinary < 119323 ** full-text tables. */ < 119324 assert( isScan==0 || p->aIndex==0 ); < 119325 < 119326 memset(pCsr, 0, sizeof(Fts3MultiSegReader)); 119547 memset(pCsr, 0, sizeof(Fts3MultiSegReader)); 119327 < 119328 return fts3SegReaderCursor( 119548 return fts3SegReaderCursor( 119329 p, iLangid, iIndex, iLevel, zTerm, nTerm, isPrefix, isScan, pCsr 119549 p, iLangid, iIndex, iLevel, zTerm, nTerm, isPrefix, isScan, pCsr 119330 ); 119550 ); 119331 } 119551 } 119332 119552 119333 /* 119553 /* 119334 ** In addition to its current configuration, have the Fts3MultiSegReader 119554 ** In addition to its current configuration, have the Fts3MultiSegReader ................................................................................................................................................................................ 119585 return SQLITE_NOMEM; 119805 return SQLITE_NOMEM; 119586 } 119806 } 119587 119807 119588 pCsr->iLangid = 0; 119808 pCsr->iLangid = 0; 119589 if( nVal==2 ) pCsr->iLangid = sqlite3_value_int(apVal[1]); 119809 if( nVal==2 ) pCsr->iLangid = sqlite3_value_int(apVal[1]); 119590 119810 119591 rc = sqlite3Fts3ExprParse(p->pTokenizer, pCsr->iLangid, 119811 rc = sqlite3Fts3ExprParse(p->pTokenizer, pCsr->iLangid, 119592 p->azColumn, p->bHasStat, p->nColumn, iCol, zQuery, -1, &pCsr->pExpr | 119812 p->azColumn, p->bFts4, p->nColumn, iCol, zQuery, -1, &pCsr->pExpr 119593 ); 119813 ); 119594 if( rc!=SQLITE_OK ){ 119814 if( rc!=SQLITE_OK ){ 119595 if( rc==SQLITE_ERROR ){ 119815 if( rc==SQLITE_ERROR ){ 119596 static const char *zErr = "malformed MATCH expression: [%s]"; 119816 static const char *zErr = "malformed MATCH expression: [%s]"; 119597 p->base.zErrMsg = sqlite3_mprintf(zErr, zQuery); 119817 p->base.zErrMsg = sqlite3_mprintf(zErr, zQuery); 119598 } 119818 } 119599 return rc; 119819 return rc; ................................................................................................................................................................................ 119728 } 119948 } 119729 119949 119730 /* 119950 /* 119731 ** Implementation of xSync() method. Flush the contents of the pending-terms 119951 ** Implementation of xSync() method. Flush the contents of the pending-terms 119732 ** hash-table to the database. 119952 ** hash-table to the database. 119733 */ 119953 */ 119734 static int fts3SyncMethod(sqlite3_vtab *pVtab){ 119954 static int fts3SyncMethod(sqlite3_vtab *pVtab){ > 119955 > 119956 /* Following an incremental-merge operation, assuming that the input > 119957 ** segments are not completely consumed (the usual case), they are updated > 119958 ** in place to remove the entries that have already been merged. This > 119959 ** involves updating the leaf block that contains the smallest unmerged > 119960 ** entry and each block (if any) between the leaf and the root node. So > 119961 ** if the height of the input segment b-trees is N, and input segments > 119962 ** are merged eight at a time, updating the input segments at the end > 119963 ** of an incremental-merge requires writing (8*(1+N)) blocks. N is usually > 119964 ** small - often between 0 and 2. So the overhead of the incremental > 119965 ** merge is somewhere between 8 and 24 blocks. To avoid this overhead > 119966 ** dwarfing the actual productive work accomplished, the incremental merge > 119967 ** is only attempted if it will write at least 64 leaf blocks. Hence > 119968 ** nMinMerge. > 119969 ** > 119970 ** Of course, updating the input segments also involves deleting a bunch > 119971 ** of blocks from the segments table. But this is not considered overhead > 119972 ** as it would also be required by a crisis-merge that used the same input > 119973 ** segments. > 119974 */ > 119975 const u32 nMinMerge = 64; /* Minimum amount of incr-merge work to do */ > 119976 > 119977 Fts3Table *p = (Fts3Table*)pVtab; 119735 int rc = sqlite3Fts3PendingTermsFlush((Fts3Table *)pVtab); | 119978 int rc = sqlite3Fts3PendingTermsFlush(p); > 119979 > 119980 if( rc==SQLITE_OK && p->bAutoincrmerge==1 && p->nLeafAdd>(nMinMerge/16) ){ > 119981 int mxLevel = 0; /* Maximum relative level value in db */ > 119982 int A; /* Incr-merge parameter A */ > 119983 > 119984 rc = sqlite3Fts3MaxLevel(p, &mxLevel); > 119985 assert( rc==SQLITE_OK || mxLevel==0 ); > 119986 A = p->nLeafAdd * mxLevel; > 119987 A += (A/2); > 119988 if( A>(int)nMinMerge ) rc = sqlite3Fts3Incrmerge(p, A, 8); > 119989 } 119736 sqlite3Fts3SegmentsClose((Fts3Table *)pVtab); | 119990 sqlite3Fts3SegmentsClose(p); 119737 return rc; 119991 return rc; 119738 } 119992 } 119739 119993 119740 /* 119994 /* 119741 ** Implementation of xBegin() method. This is a no-op. 119995 ** Implementation of xBegin() method. This is a no-op. 119742 */ 119996 */ 119743 static int fts3BeginMethod(sqlite3_vtab *pVtab){ 119997 static int fts3BeginMethod(sqlite3_vtab *pVtab){ 119744 TESTONLY( Fts3Table *p = (Fts3Table*)pVtab ); | 119998 Fts3Table *p = (Fts3Table*)pVtab; 119745 UNUSED_PARAMETER(pVtab); 119999 UNUSED_PARAMETER(pVtab); 119746 assert( p->pSegments==0 ); 120000 assert( p->pSegments==0 ); 119747 assert( p->nPendingData==0 ); 120001 assert( p->nPendingData==0 ); 119748 assert( p->inTransaction!=1 ); 120002 assert( p->inTransaction!=1 ); 119749 TESTONLY( p->inTransaction = 1 ); 120003 TESTONLY( p->inTransaction = 1 ); 119750 TESTONLY( p->mxSavepoint = -1; ); 120004 TESTONLY( p->mxSavepoint = -1; ); > 120005 p->nLeafAdd = 0; 119751 return SQLITE_OK; 120006 return SQLITE_OK; 119752 } 120007 } 119753 120008 119754 /* 120009 /* 119755 ** Implementation of xCommit() method. This is a no-op. The contents of 120010 ** Implementation of xCommit() method. This is a no-op. The contents of 119756 ** the pending-terms hash-table have already been flushed into the database 120011 ** the pending-terms hash-table have already been flushed into the database 119757 ** by fts3SyncMethod(). 120012 ** by fts3SyncMethod(). ................................................................................................................................................................................ 120038 120293 120039 /* 120294 /* 120040 ** The xSavepoint() method. 120295 ** The xSavepoint() method. 120041 ** 120296 ** 120042 ** Flush the contents of the pending-terms table to disk. 120297 ** Flush the contents of the pending-terms table to disk. 120043 */ 120298 */ 120044 static int fts3SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ 120299 static int fts3SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ > 120300 int rc = SQLITE_OK; 120045 UNUSED_PARAMETER(iSavepoint); 120301 UNUSED_PARAMETER(iSavepoint); 120046 assert( ((Fts3Table *)pVtab)->inTransaction ); 120302 assert( ((Fts3Table *)pVtab)->inTransaction ); 120047 assert( ((Fts3Table *)pVtab)->mxSavepoint < iSavepoint ); 120303 assert( ((Fts3Table *)pVtab)->mxSavepoint < iSavepoint ); 120048 TESTONLY( ((Fts3Table *)pVtab)->mxSavepoint = iSavepoint ); 120304 TESTONLY( ((Fts3Table *)pVtab)->mxSavepoint = iSavepoint ); > 120305 if( ((Fts3Table *)pVtab)->bIgnoreSavepoint==0 ){ 120049 return fts3SyncMethod(pVtab); | 120306 rc = fts3SyncMethod(pVtab); > 120307 } > 120308 return rc; 120050 } 120309 } 120051 120310 120052 /* 120311 /* 120053 ** The xRelease() method. 120312 ** The xRelease() method. 120054 ** 120313 ** 120055 ** This is a no-op. 120314 ** This is a no-op. 120056 */ 120315 */ ................................................................................................................................................................................ 120402 char *p1 = aPoslist; 120661 char *p1 = aPoslist; 120403 char *p2 = aOut; 120662 char *p2 = aOut; 120404 120663 120405 assert( iPrev>=0 ); 120664 assert( iPrev>=0 ); 120406 fts3PoslistPhraseMerge(&aOut, iToken-iPrev, 0, 1, &p1, &p2); 120665 fts3PoslistPhraseMerge(&aOut, iToken-iPrev, 0, 1, &p1, &p2); 120407 sqlite3_free(aPoslist); 120666 sqlite3_free(aPoslist); 120408 aPoslist = pList; 120667 aPoslist = pList; 120409 nPoslist = aOut - aPoslist; | 120668 nPoslist = (int)(aOut - aPoslist); 120410 if( nPoslist==0 ){ 120669 if( nPoslist==0 ){ 120411 sqlite3_free(aPoslist); 120670 sqlite3_free(aPoslist); 120412 pPhrase->doclist.pList = 0; 120671 pPhrase->doclist.pList = 0; 120413 pPhrase->doclist.nList = 0; 120672 pPhrase->doclist.nList = 0; 120414 return SQLITE_OK; 120673 return SQLITE_OK; 120415 } 120674 } 120416 } 120675 } ................................................................................................................................................................................ 120446 sqlite3_free(aPoslist); 120705 sqlite3_free(aPoslist); 120447 return SQLITE_NOMEM; 120706 return SQLITE_NOMEM; 120448 } 120707 } 120449 120708 120450 pPhrase->doclist.pList = aOut; 120709 pPhrase->doclist.pList = aOut; 120451 if( fts3PoslistPhraseMerge(&aOut, nDistance, 0, 1, &p1, &p2) ){ 120710 if( fts3PoslistPhraseMerge(&aOut, nDistance, 0, 1, &p1, &p2) ){ 120452 pPhrase->doclist.bFreeList = 1; 120711 pPhrase->doclist.bFreeList = 1; 120453 pPhrase->doclist.nList = (aOut - pPhrase->doclist.pList); | 120712 pPhrase->doclist.nList = (int)(aOut - pPhrase->doclist.pList); 120454 }else{ 120713 }else{ 120455 sqlite3_free(aOut); 120714 sqlite3_free(aOut); 120456 pPhrase->doclist.pList = 0; 120715 pPhrase->doclist.pList = 0; 120457 pPhrase->doclist.nList = 0; 120716 pPhrase->doclist.nList = 0; 120458 } 120717 } 120459 sqlite3_free(aPoslist); 120718 sqlite3_free(aPoslist); 120460 } 120719 } ................................................................................................................................................................................ 120542 iDocid += (iMul * iDelta); 120801 iDocid += (iMul * iDelta); 120543 pNext = pDocid; 120802 pNext = pDocid; 120544 fts3PoslistCopy(0, &pDocid); 120803 fts3PoslistCopy(0, &pDocid); 120545 while( pDocid<pEnd && *pDocid==0 ) pDocid++; 120804 while( pDocid<pEnd && *pDocid==0 ) pDocid++; 120546 iMul = (bDescIdx ? -1 : 1); 120805 iMul = (bDescIdx ? -1 : 1); 120547 } 120806 } 120548 120807 120549 *pnList = pEnd - pNext; | 120808 *pnList = (int)(pEnd - pNext); 120550 *ppIter = pNext; 120809 *ppIter = pNext; 120551 *piDocid = iDocid; 120810 *piDocid = iDocid; 120552 }else{ 120811 }else{ 120553 int iMul = (bDescIdx ? -1 : 1); 120812 int iMul = (bDescIdx ? -1 : 1); 120554 sqlite3_int64 iDelta; 120813 sqlite3_int64 iDelta; 120555 fts3GetReverseVarint(&p, aDoclist, &iDelta); 120814 fts3GetReverseVarint(&p, aDoclist, &iDelta); 120556 *piDocid -= (iMul * iDelta); 120815 *piDocid -= (iMul * iDelta); 120557 120816 120558 if( p==aDoclist ){ 120817 if( p==aDoclist ){ 120559 *pbEof = 1; 120818 *pbEof = 1; 120560 }else{ 120819 }else{ 120561 char *pSave = p; 120820 char *pSave = p; 120562 fts3ReversePoslist(aDoclist, &p); 120821 fts3ReversePoslist(aDoclist, &p); 120563 *pnList = (pSave - p); | 120822 *pnList = (int)(pSave - p); 120564 } 120823 } 120565 *ppIter = p; 120824 *ppIter = p; 120566 } 120825 } 120567 } 120826 } 120568 120827 120569 /* 120828 /* 120570 ** Attempt to move the phrase iterator to point to the next matching docid. 120829 ** Attempt to move the phrase iterator to point to the next matching docid. ................................................................................................................................................................................ 120616 if( pTab->bDescIdx==0 || pDL->pNextDocid==0 ){ 120875 if( pTab->bDescIdx==0 || pDL->pNextDocid==0 ){ 120617 pDL->iDocid += iDelta; 120876 pDL->iDocid += iDelta; 120618 }else{ 120877 }else{ 120619 pDL->iDocid -= iDelta; 120878 pDL->iDocid -= iDelta; 120620 } 120879 } 120621 pDL->pList = pIter; 120880 pDL->pList = pIter; 120622 fts3PoslistCopy(0, &pIter); 120881 fts3PoslistCopy(0, &pIter); 120623 pDL->nList = (pIter - pDL->pList); | 120882 pDL->nList = (int)(pIter - pDL->pList); 120624 120883 120625 /* pIter now points just past the 0x00 that terminates the position- 120884 /* pIter now points just past the 0x00 that terminates the position- 120626 ** list for document pDL->iDocid. However, if this position-list was 120885 ** list for document pDL->iDocid. However, if this position-list was 120627 ** edited in place by fts3EvalNearTrim(), then pIter may not actually 120886 ** edited in place by fts3EvalNearTrim(), then pIter may not actually 120628 ** point to the start of the next docid value. The following line deals 120887 ** point to the start of the next docid value. The following line deals 120629 ** with this case by advancing pIter past the zero-padding added by 120888 ** with this case by advancing pIter past the zero-padding added by 120630 ** fts3EvalNearTrim(). */ 120889 ** fts3EvalNearTrim(). */ ................................................................................................................................................................................ 120957 int nToken = 0; 121216 int nToken = 0; 120958 int nOr = 0; 121217 int nOr = 0; 120959 121218 120960 /* Allocate a MultiSegReader for each token in the expression. */ 121219 /* Allocate a MultiSegReader for each token in the expression. */ 120961 fts3EvalAllocateReaders(pCsr, pCsr->pExpr, &nToken, &nOr, &rc); 121220 fts3EvalAllocateReaders(pCsr, pCsr->pExpr, &nToken, &nOr, &rc); 120962 121221 120963 /* Determine which, if any, tokens in the expression should be deferred. */ 121222 /* Determine which, if any, tokens in the expression should be deferred. */ 120964 if( rc==SQLITE_OK && nToken>1 && pTab->bHasStat ){ | 121223 if( rc==SQLITE_OK && nToken>1 && pTab->bFts4 ){ 120965 Fts3TokenAndCost *aTC; 121224 Fts3TokenAndCost *aTC; 120966 Fts3Expr **apOr; 121225 Fts3Expr **apOr; 120967 aTC = (Fts3TokenAndCost *)sqlite3_malloc( 121226 aTC = (Fts3TokenAndCost *)sqlite3_malloc( 120968 sizeof(Fts3TokenAndCost) * nToken 121227 sizeof(Fts3TokenAndCost) * nToken 120969 + sizeof(Fts3Expr *) * nOr * 2 121228 + sizeof(Fts3Expr *) * nOr * 2 120970 ); 121229 ); 120971 apOr = (Fts3Expr **)&aTC[nToken]; 121230 apOr = (Fts3Expr **)&aTC[nToken]; ................................................................................................................................................................................ 120974 rc = SQLITE_NOMEM; 121233 rc = SQLITE_NOMEM; 120975 }else{ 121234 }else{ 120976 int ii; 121235 int ii; 120977 Fts3TokenAndCost *pTC = aTC; 121236 Fts3TokenAndCost *pTC = aTC; 120978 Fts3Expr **ppOr = apOr; 121237 Fts3Expr **ppOr = apOr; 120979 121238 120980 fts3EvalTokenCosts(pCsr, 0, pCsr->pExpr, &pTC, &ppOr, &rc); 121239 fts3EvalTokenCosts(pCsr, 0, pCsr->pExpr, &pTC, &ppOr, &rc); 120981 nToken = pTC-aTC; | 121240 nToken = (int)(pTC-aTC); 120982 nOr = ppOr-apOr; | 121241 nOr = (int)(ppOr-apOr); 120983 121242 120984 if( rc==SQLITE_OK ){ 121243 if( rc==SQLITE_OK ){ 120985 rc = fts3EvalSelectDeferred(pCsr, 0, aTC, nToken); 121244 rc = fts3EvalSelectDeferred(pCsr, 0, aTC, nToken); 120986 for(ii=0; rc==SQLITE_OK && ii<nOr; ii++){ 121245 for(ii=0; rc==SQLITE_OK && ii<nOr; ii++){ 120987 rc = fts3EvalSelectDeferred(pCsr, apOr[ii], aTC, nToken); 121246 rc = fts3EvalSelectDeferred(pCsr, apOr[ii], aTC, nToken); 120988 } 121247 } 120989 } 121248 } ................................................................................................................................................................................ 121047 assert( pPhrase->doclist.pList ); 121306 assert( pPhrase->doclist.pList ); 121048 121307 121049 p2 = pOut = pPhrase->doclist.pList; 121308 p2 = pOut = pPhrase->doclist.pList; 121050 res = fts3PoslistNearMerge( 121309 res = fts3PoslistNearMerge( 121051 &pOut, aTmp, nParam1, nParam2, paPoslist, &p2 121310 &pOut, aTmp, nParam1, nParam2, paPoslist, &p2 121052 ); 121311 ); 121053 if( res ){ 121312 if( res ){ 121054 nNew = (pOut - pPhrase->doclist.pList) - 1; | 121313 nNew = (int)(pOut - pPhrase->doclist.pList) - 1; 121055 assert( pPhrase->doclist.pList[nNew]=='\0' ); 121314 assert( pPhrase->doclist.pList[nNew]=='\0' ); 121056 assert( nNew<=pPhrase->doclist.nList && nNew>0 ); 121315 assert( nNew<=pPhrase->doclist.nList && nNew>0 ); 121057 memset(&pPhrase->doclist.pList[nNew], 0, pPhrase->doclist.nList - nNew); 121316 memset(&pPhrase->doclist.pList[nNew], 0, pPhrase->doclist.nList - nNew); 121058 pPhrase->doclist.nList = nNew; 121317 pPhrase->doclist.nList = nNew; 121059 *paPoslist = pPhrase->doclist.pList; 121318 *paPoslist = pPhrase->doclist.pList; 121060 *pnToken = pPhrase->nToken; 121319 *pnToken = pPhrase->nToken; 121061 } 121320 } ................................................................................................................................................................................ 121772 memset(&pPhrase->doclist, 0, sizeof(Fts3Doclist)); 122031 memset(&pPhrase->doclist, 0, sizeof(Fts3Doclist)); 121773 for(i=0; i<pPhrase->nToken; i++){ 122032 for(i=0; i<pPhrase->nToken; i++){ 121774 fts3SegReaderCursorFree(pPhrase->aToken[i].pSegcsr); 122033 fts3SegReaderCursorFree(pPhrase->aToken[i].pSegcsr); 121775 pPhrase->aToken[i].pSegcsr = 0; 122034 pPhrase->aToken[i].pSegcsr = 0; 121776 } 122035 } 121777 } 122036 } 121778 } 122037 } > 122038 121779 122039 121780 /* 122040 /* 121781 ** Return SQLITE_CORRUPT_VTAB. 122041 ** Return SQLITE_CORRUPT_VTAB. 121782 */ 122042 */ 121783 #ifdef SQLITE_DEBUG 122043 #ifdef SQLITE_DEBUG 121784 SQLITE_PRIVATE int sqlite3Fts3Corrupt(){ 122044 SQLITE_PRIVATE int sqlite3Fts3Corrupt(){ 121785 return SQLITE_CORRUPT_VTAB; 122045 return SQLITE_CORRUPT_VTAB; ................................................................................................................................................................................ 121880 *pzErr = sqlite3_mprintf( 122140 *pzErr = sqlite3_mprintf( 121881 "wrong number of arguments to fts4aux constructor" 122141 "wrong number of arguments to fts4aux constructor" 121882 ); 122142 ); 121883 return SQLITE_ERROR; 122143 return SQLITE_ERROR; 121884 } 122144 } 121885 122145 121886 zDb = argv[1]; 122146 zDb = argv[1]; 121887 nDb = strlen(zDb); | 122147 nDb = (int)strlen(zDb); 121888 zFts3 = argv[3]; 122148 zFts3 = argv[3]; 121889 nFts3 = strlen(zFts3); | 122149 nFts3 = (int)strlen(zFts3); 121890 122150 121891 rc = sqlite3_declare_vtab(db, FTS3_TERMS_SCHEMA); 122151 rc = sqlite3_declare_vtab(db, FTS3_TERMS_SCHEMA); 121892 if( rc!=SQLITE_OK ) return rc; 122152 if( rc!=SQLITE_OK ) return rc; 121893 122153 121894 nByte = sizeof(Fts3auxTable) + sizeof(Fts3Table) + nDb + nFts3 + 2; 122154 nByte = sizeof(Fts3auxTable) + sizeof(Fts3Table) + nDb + nFts3 + 2; 121895 p = (Fts3auxTable *)sqlite3_malloc(nByte); 122155 p = (Fts3auxTable *)sqlite3_malloc(nByte); 121896 if( !p ) return SQLITE_NOMEM; 122156 if( !p ) return SQLITE_NOMEM; ................................................................................................................................................................................ 125072 125332 125073 #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) 125333 #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) 125074 125334 125075 /* #include <string.h> */ 125335 /* #include <string.h> */ 125076 /* #include <assert.h> */ 125336 /* #include <assert.h> */ 125077 /* #include <stdlib.h> */ 125337 /* #include <stdlib.h> */ 125078 125338 > 125339 > 125340 #define FTS_MAX_APPENDABLE_HEIGHT 16 > 125341 125079 /* 125342 /* 125080 ** When full-text index nodes are loaded from disk, the buffer that they 125343 ** When full-text index nodes are loaded from disk, the buffer that they 125081 ** are loaded into has the following number of bytes of padding at the end 125344 ** are loaded into has the following number of bytes of padding at the end 125082 ** of it. i.e. if a full-text index node is 900 bytes in size, then a buffer 125345 ** of it. i.e. if a full-text index node is 900 bytes in size, then a buffer 125083 ** of 920 bytes is allocated for it. 125346 ** of 920 bytes is allocated for it. 125084 ** 125347 ** 125085 ** This means that if we have a pointer into a buffer containing node data, 125348 ** This means that if we have a pointer into a buffer containing node data, ................................................................................................................................................................................ 125110 int test_fts3_node_chunk_threshold = (4*1024)*4; 125373 int test_fts3_node_chunk_threshold = (4*1024)*4; 125111 # define FTS3_NODE_CHUNKSIZE test_fts3_node_chunksize 125374 # define FTS3_NODE_CHUNKSIZE test_fts3_node_chunksize 125112 # define FTS3_NODE_CHUNK_THRESHOLD test_fts3_node_chunk_threshold 125375 # define FTS3_NODE_CHUNK_THRESHOLD test_fts3_node_chunk_threshold 125113 #else 125376 #else 125114 # define FTS3_NODE_CHUNKSIZE (4*1024) 125377 # define FTS3_NODE_CHUNKSIZE (4*1024) 125115 # define FTS3_NODE_CHUNK_THRESHOLD (FTS3_NODE_CHUNKSIZE*4) 125378 # define FTS3_NODE_CHUNK_THRESHOLD (FTS3_NODE_CHUNKSIZE*4) 125116 #endif 125379 #endif > 125380 > 125381 /* > 125382 ** The two values that may be meaningfully bound to the :1 parameter in > 125383 ** statements SQL_REPLACE_STAT and SQL_SELECT_STAT. > 125384 */ > 125385 #define FTS_STAT_DOCTOTAL 0 > 125386 #define FTS_STAT_INCRMERGEHINT 1 > 125387 #define FTS_STAT_AUTOINCRMERGE 2 > 125388 > 125389 /* > 125390 ** If FTS_LOG_MERGES is defined, call sqlite3_log() to report each automatic > 125391 ** and incremental merge operation that takes place. This is used for > 125392 ** debugging FTS only, it should not usually be turned on in production > 125393 ** systems. > 125394 */ > 125395 #ifdef FTS3_LOG_MERGES > 125396 static void fts3LogMerge(int nMerge, sqlite3_int64 iAbsLevel){ > 125397 sqlite3_log(SQLITE_OK, "%d-way merge from level %d", nMerge, (int)iAbsLevel); > 125398 } > 125399 #else > 125400 #define fts3LogMerge(x, y) > 125401 #endif > 125402 125117 125403 125118 typedef struct PendingList PendingList; 125404 typedef struct PendingList PendingList; 125119 typedef struct SegmentNode SegmentNode; 125405 typedef struct SegmentNode SegmentNode; 125120 typedef struct SegmentWriter SegmentWriter; 125406 typedef struct SegmentWriter SegmentWriter; 125121 125407 125122 /* 125408 /* 125123 ** An instance of the following data structure is used to build doclists 125409 ** An instance of the following data structure is used to build doclists ................................................................................................................................................................................ 125272 #define SQL_SELECT_SEGDIR_MAX_LEVEL 15 125558 #define SQL_SELECT_SEGDIR_MAX_LEVEL 15 125273 #define SQL_DELETE_SEGDIR_LEVEL 16 125559 #define SQL_DELETE_SEGDIR_LEVEL 16 125274 #define SQL_DELETE_SEGMENTS_RANGE 17 125560 #define SQL_DELETE_SEGMENTS_RANGE 17 125275 #define SQL_CONTENT_INSERT 18 125561 #define SQL_CONTENT_INSERT 18 125276 #define SQL_DELETE_DOCSIZE 19 125562 #define SQL_DELETE_DOCSIZE 19 125277 #define SQL_REPLACE_DOCSIZE 20 125563 #define SQL_REPLACE_DOCSIZE 20 125278 #define SQL_SELECT_DOCSIZE 21 125564 #define SQL_SELECT_DOCSIZE 21 125279 #define SQL_SELECT_DOCTOTAL 22 | 125565 #define SQL_SELECT_STAT 22 125280 #define SQL_REPLACE_DOCTOTAL 23 | 125566 #define SQL_REPLACE_STAT 23 125281 125567 125282 #define SQL_SELECT_ALL_PREFIX_LEVEL 24 125568 #define SQL_SELECT_ALL_PREFIX_LEVEL 24 125283 #define SQL_DELETE_ALL_TERMS_SEGDIR 25 125569 #define SQL_DELETE_ALL_TERMS_SEGDIR 25 125284 < 125285 #define SQL_DELETE_SEGDIR_RANGE 26 125570 #define SQL_DELETE_SEGDIR_RANGE 26 125286 < 125287 #define SQL_SELECT_ALL_LANGID 27 125571 #define SQL_SELECT_ALL_LANGID 27 > 125572 #define SQL_FIND_MERGE_LEVEL 28 > 125573 #define SQL_MAX_LEAF_NODE_ESTIMATE 29 > 125574 #define SQL_DELETE_SEGDIR_ENTRY 30 > 125575 #define SQL_SHIFT_SEGDIR_ENTRY 31 > 125576 #define SQL_SELECT_SEGDIR 32 > 125577 #define SQL_CHOMP_SEGDIR 33 > 125578 #define SQL_SEGMENT_IS_APPENDABLE 34 > 125579 #define SQL_SELECT_INDEXES 35 > 125580 #define SQL_SELECT_MXLEVEL 36 125288 125581 125289 /* 125582 /* 125290 ** This function is used to obtain an SQLite prepared statement handle 125583 ** This function is used to obtain an SQLite prepared statement handle 125291 ** for the statement identified by the second argument. If successful, 125584 ** for the statement identified by the second argument. If successful, 125292 ** *pp is set to the requested statement handle and SQLITE_OK returned. 125585 ** *pp is set to the requested statement handle and SQLITE_OK returned. 125293 ** Otherwise, an SQLite error code is returned and *pp is set to 0. 125586 ** Otherwise, an SQLite error code is returned and *pp is set to 0. 125294 ** 125587 ** ................................................................................................................................................................................ 125309 /* 2 */ "DELETE FROM %Q.'%q_content'", 125602 /* 2 */ "DELETE FROM %Q.'%q_content'", 125310 /* 3 */ "DELETE FROM %Q.'%q_segments'", 125603 /* 3 */ "DELETE FROM %Q.'%q_segments'", 125311 /* 4 */ "DELETE FROM %Q.'%q_segdir'", 125604 /* 4 */ "DELETE FROM %Q.'%q_segdir'", 125312 /* 5 */ "DELETE FROM %Q.'%q_docsize'", 125605 /* 5 */ "DELETE FROM %Q.'%q_docsize'", 125313 /* 6 */ "DELETE FROM %Q.'%q_stat'", 125606 /* 6 */ "DELETE FROM %Q.'%q_stat'", 125314 /* 7 */ "SELECT %s WHERE rowid=?", 125607 /* 7 */ "SELECT %s WHERE rowid=?", 125315 /* 8 */ "SELECT (SELECT max(idx) FROM %Q.'%q_segdir' WHERE level = ?) + 1", 125608 /* 8 */ "SELECT (SELECT max(idx) FROM %Q.'%q_segdir' WHERE level = ?) + 1", 125316 /* 9 */ "INSERT INTO %Q.'%q_segments'(blockid, block) VALUES(?, ?)", | 125609 /* 9 */ "REPLACE INTO %Q.'%q_segments'(blockid, block) VALUES(?, ?)", 125317 /* 10 */ "SELECT coalesce((SELECT max(blockid) FROM %Q.'%q_segments') + 1, 1)", 125610 /* 10 */ "SELECT coalesce((SELECT max(blockid) FROM %Q.'%q_segments') + 1, 1)", 125318 /* 11 */ "INSERT INTO %Q.'%q_segdir' VALUES(?,?,?,?,?,?)", | 125611 /* 11 */ "REPLACE INTO %Q.'%q_segdir' VALUES(?,?,?,?,?,?)", 125319 125612 125320 /* Return segments in order from oldest to newest.*/ 125613 /* Return segments in order from oldest to newest.*/ 125321 /* 12 */ "SELECT idx, start_block, leaves_end_block, end_block, root " 125614 /* 12 */ "SELECT idx, start_block, leaves_end_block, end_block, root " 125322 "FROM %Q.'%q_segdir' WHERE level = ? ORDER BY idx ASC", 125615 "FROM %Q.'%q_segdir' WHERE level = ? ORDER BY idx ASC", 125323 /* 13 */ "SELECT idx, start_block, leaves_end_block, end_block, root " 125616 /* 13 */ "SELECT idx, start_block, leaves_end_block, end_block, root " 125324 "FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?" 125617 "FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?" 125325 "ORDER BY level DESC, idx ASC", 125618 "ORDER BY level DESC, idx ASC", ................................................................................................................................................................................ 125329 125622 125330 /* 16 */ "DELETE FROM %Q.'%q_segdir' WHERE level = ?", 125623 /* 16 */ "DELETE FROM %Q.'%q_segdir' WHERE level = ?", 125331 /* 17 */ "DELETE FROM %Q.'%q_segments' WHERE blockid BETWEEN ? AND ?", 125624 /* 17 */ "DELETE FROM %Q.'%q_segments' WHERE blockid BETWEEN ? AND ?", 125332 /* 18 */ "INSERT INTO %Q.'%q_content' VALUES(%s)", 125625 /* 18 */ "INSERT INTO %Q.'%q_content' VALUES(%s)", 125333 /* 19 */ "DELETE FROM %Q.'%q_docsize' WHERE docid = ?", 125626 /* 19 */ "DELETE FROM %Q.'%q_docsize' WHERE docid = ?", 125334 /* 20 */ "REPLACE INTO %Q.'%q_docsize' VALUES(?,?)", 125627 /* 20 */ "REPLACE INTO %Q.'%q_docsize' VALUES(?,?)", 125335 /* 21 */ "SELECT size FROM %Q.'%q_docsize' WHERE docid=?", 125628 /* 21 */ "SELECT size FROM %Q.'%q_docsize' WHERE docid=?", 125336 /* 22 */ "SELECT value FROM %Q.'%q_stat' WHERE id=0", | 125629 /* 22 */ "SELECT value FROM %Q.'%q_stat' WHERE id=?", 125337 /* 23 */ "REPLACE INTO %Q.'%q_stat' VALUES(0,?)", | 125630 /* 23 */ "REPLACE INTO %Q.'%q_stat' VALUES(?,?)", 125338 /* 24 */ "", 125631 /* 24 */ "", 125339 /* 25 */ "", 125632 /* 25 */ "", 125340 125633 125341 /* 26 */ "DELETE FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?", 125634 /* 26 */ "DELETE FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?", 125342 /* 27 */ "SELECT DISTINCT level / (1024 * ?) FROM %Q.'%q_segdir'", 125635 /* 27 */ "SELECT DISTINCT level / (1024 * ?) FROM %Q.'%q_segdir'", 125343 125636 > 125637 /* This statement is used to determine which level to read the input from > 125638 ** when performing an incremental merge. It returns the absolute level number > 125639 ** of the oldest level in the db that contains at least ? segments. Or, > 125640 ** if no level in the FTS index contains more than ? segments, the statement > 125641 ** returns zero rows. */ > 125642 /* 28 */ "SELECT level FROM %Q.'%q_segdir' GROUP BY level HAVING count(*)>=?" > 125643 " ORDER BY (level %% 1024) ASC LIMIT 1", > 125644 > 125645 /* Estimate the upper limit on the number of leaf nodes in a new segment > 125646 ** created by merging the oldest :2 segments from absolute level :1. See > 125647 ** function sqlite3Fts3Incrmerge() for details. */ > 125648 /* 29 */ "SELECT 2 * total(1 + leaves_end_block - start_block) " > 125649 " FROM %Q.'%q_segdir' WHERE level = ? AND idx < ?", > 125650 > 125651 /* SQL_DELETE_SEGDIR_ENTRY > 125652 ** Delete the %_segdir entry on absolute level :1 with index :2. */ > 125653 /* 30 */ "DELETE FROM %Q.'%q_segdir' WHERE level = ? AND idx = ?", > 125654 > 125655 /* SQL_SHIFT_SEGDIR_ENTRY > 125656 ** Modify the idx value for the segment with idx=:3 on absolute level :2 > 125657 ** to :1. */ > 125658 /* 31 */ "UPDATE %Q.'%q_segdir' SET idx = ? WHERE level=? AND idx=?", > 125659 > 125660 /* SQL_SELECT_SEGDIR > 125661 ** Read a single entry from the %_segdir table. The entry from absolute > 125662 ** level :1 with index value :2. */ > 125663 /* 32 */ "SELECT idx, start_block, leaves_end_block, end_block, root " > 125664 "FROM %Q.'%q_segdir' WHERE level = ? AND idx = ?", > 125665 > 125666 /* SQL_CHOMP_SEGDIR > 125667 ** Update the start_block (:1) and root (:2) fields of the %_segdir > 125668 ** entry located on absolute level :3 with index :4. */ > 125669 /* 33 */ "UPDATE %Q.'%q_segdir' SET start_block = ?, root = ?" > 125670 "WHERE level = ? AND idx = ?", > 125671 > 125672 /* SQL_SEGMENT_IS_APPENDABLE > 125673 ** Return a single row if the segment with end_block=? is appendable. Or > 125674 ** no rows otherwise. */ > 125675 /* 34 */ "SELECT 1 FROM %Q.'%q_segments' WHERE blockid=? AND block IS NULL", > 125676 > 125677 /* SQL_SELECT_INDEXES > 125678 ** Return the list of valid segment indexes for absolute level ? */ > 125679 /* 35 */ "SELECT idx FROM %Q.'%q_segdir' WHERE level=? ORDER BY 1 ASC", > 125680 > 125681 /* SQL_SELECT_MXLEVEL > 125682 ** Return the largest relative level in the FTS index or indexes. */ > 125683 /* 36 */ "SELECT max( level %% 1024 ) FROM %Q.'%q_segdir'" 125344 }; 125684 }; 125345 int rc = SQLITE_OK; 125685 int rc = SQLITE_OK; 125346 sqlite3_stmt *pStmt; 125686 sqlite3_stmt *pStmt; 125347 125687 125348 assert( SizeofArray(azSql)==SizeofArray(p->aStmt) ); 125688 assert( SizeofArray(azSql)==SizeofArray(p->aStmt) ); 125349 assert( eStmt<SizeofArray(azSql) && eStmt>=0 ); 125689 assert( eStmt<SizeofArray(azSql) && eStmt>=0 ); 125350 125690 ................................................................................................................................................................................ 125373 for(i=0; rc==SQLITE_OK && i<nParam; i++){ 125713 for(i=0; rc==SQLITE_OK && i<nParam; i++){ 125374 rc = sqlite3_bind_value(pStmt, i+1, apVal[i]); 125714 rc = sqlite3_bind_value(pStmt, i+1, apVal[i]); 125375 } 125715 } 125376 } 125716 } 125377 *pp = pStmt; 125717 *pp = pStmt; 125378 return rc; 125718 return rc; 125379 } 125719 } > 125720 125380 125721 125381 static int fts3SelectDocsize( 125722 static int fts3SelectDocsize( 125382 Fts3Table *pTab, /* FTS3 table handle */ 125723 Fts3Table *pTab, /* FTS3 table handle */ 125383 int eStmt, /* Either SQL_SELECT_DOCSIZE or DOCTOTAL */ < 125384 sqlite3_int64 iDocid, /* Docid to bind for SQL_SELECT_DOCSIZE */ 125724 sqlite3_int64 iDocid, /* Docid to bind for SQL_SELECT_DOCSIZE */ 125385 sqlite3_stmt **ppStmt /* OUT: Statement handle */ 125725 sqlite3_stmt **ppStmt /* OUT: Statement handle */ 125386 ){ 125726 ){ 125387 sqlite3_stmt *pStmt = 0; /* Statement requested from fts3SqlStmt() */ 125727 sqlite3_stmt *pStmt = 0; /* Statement requested from fts3SqlStmt() */ 125388 int rc; /* Return code */ 125728 int rc; /* Return code */ 125389 125729 125390 assert( eStmt==SQL_SELECT_DOCSIZE || eStmt==SQL_SELECT_DOCTOTAL ); < 125391 < 125392 rc = fts3SqlStmt(pTab, eStmt, &pStmt, 0); | 125730 rc = fts3SqlStmt(pTab, SQL_SELECT_DOCSIZE, &pStmt, 0); 125393 if( rc==SQLITE_OK ){ 125731 if( rc==SQLITE_OK ){ 125394 if( eStmt==SQL_SELECT_DOCSIZE ){ < 125395 sqlite3_bind_int64(pStmt, 1, iDocid); | 125732 sqlite3_bind_int64(pStmt, 1, iDocid); 125396 } < 125397 rc = sqlite3_step(pStmt); 125733 rc = sqlite3_step(pStmt); 125398 if( rc!=SQLITE_ROW || sqlite3_column_type(pStmt, 0)!=SQLITE_BLOB ){ 125734 if( rc!=SQLITE_ROW || sqlite3_column_type(pStmt, 0)!=SQLITE_BLOB ){ 125399 rc = sqlite3_reset(pStmt); 125735 rc = sqlite3_reset(pStmt); 125400 if( rc==SQLITE_OK ) rc = FTS_CORRUPT_VTAB; 125736 if( rc==SQLITE_OK ) rc = FTS_CORRUPT_VTAB; 125401 pStmt = 0; 125737 pStmt = 0; 125402 }else{ 125738 }else{ 125403 rc = SQLITE_OK; 125739 rc = SQLITE_OK; ................................................................................................................................................................................ 125408 return rc; 125744 return rc; 125409 } 125745 } 125410 125746 125411 SQLITE_PRIVATE int sqlite3Fts3SelectDoctotal( 125747 SQLITE_PRIVATE int sqlite3Fts3SelectDoctotal( 125412 Fts3Table *pTab, /* Fts3 table handle */ 125748 Fts3Table *pTab, /* Fts3 table handle */ 125413 sqlite3_stmt **ppStmt /* OUT: Statement handle */ 125749 sqlite3_stmt **ppStmt /* OUT: Statement handle */ 125414 ){ 125750 ){ 125415 return fts3SelectDocsize(pTab, SQL_SELECT_DOCTOTAL, 0, ppStmt); | 125751 sqlite3_stmt *pStmt = 0; > 125752 int rc; > 125753 rc = fts3SqlStmt(pTab, SQL_SELECT_STAT, &pStmt, 0); > 125754 if( rc==SQLITE_OK ){ > 125755 sqlite3_bind_int(pStmt, 1, FTS_STAT_DOCTOTAL); > 125756 if( sqlite3_step(pStmt)!=SQLITE_ROW > 125757 || sqlite3_column_type(pStmt, 0)!=SQLITE_BLOB > 125758 ){ > 125759 rc = sqlite3_reset(pStmt); > 125760 if( rc==SQLITE_OK ) rc = FTS_CORRUPT_VTAB; > 125761 pStmt = 0; > 125762 } > 125763 } > 125764 *ppStmt = pStmt; > 125765 return rc; 125416 } 125766 } 125417 125767 125418 SQLITE_PRIVATE int sqlite3Fts3SelectDocsize( 125768 SQLITE_PRIVATE int sqlite3Fts3SelectDocsize( 125419 Fts3Table *pTab, /* Fts3 table handle */ 125769 Fts3Table *pTab, /* Fts3 table handle */ 125420 sqlite3_int64 iDocid, /* Docid to read size data for */ 125770 sqlite3_int64 iDocid, /* Docid to read size data for */ 125421 sqlite3_stmt **ppStmt /* OUT: Statement handle */ 125771 sqlite3_stmt **ppStmt /* OUT: Statement handle */ 125422 ){ 125772 ){ 125423 return fts3SelectDocsize(pTab, SQL_SELECT_DOCSIZE, iDocid, ppStmt); | 125773 return fts3SelectDocsize(pTab, iDocid, ppStmt); 125424 } 125774 } 125425 125775 125426 /* 125776 /* 125427 ** Similar to fts3SqlStmt(). Except, after binding the parameters in 125777 ** Similar to fts3SqlStmt(). Except, after binding the parameters in 125428 ** array apVal[] to the SQL statement identified by eStmt, the statement 125778 ** array apVal[] to the SQL statement identified by eStmt, the statement 125429 ** is executed. 125779 ** is executed. 125430 ** 125780 ** ................................................................................................................................................................................ 125482 }else{ 125832 }else{ 125483 rc = SQLITE_OK; 125833 rc = SQLITE_OK; 125484 } 125834 } 125485 125835 125486 return rc; 125836 return rc; 125487 } 125837 } 125488 125838 > 125839 /* > 125840 ** FTS maintains a separate indexes for each language-id (a 32-bit integer). > 125841 ** Within each language id, a separate index is maintained to store the > 125842 ** document terms, and each configured prefix size (configured the FTS > 125843 ** "prefix=" option). And each index consists of multiple levels ("relative > 125844 ** levels"). > 125845 ** > 125846 ** All three of these values (the language id, the specific index and the > 125847 ** level within the index) are encoded in 64-bit integer values stored > 125848 ** in the %_segdir table on disk. This function is used to convert three > 125849 ** separate component values into the single 64-bit integer value that > 125850 ** can be used to query the %_segdir table. > 125851 ** > 125852 ** Specifically, each language-id/index combination is allocated 1024 > 125853 ** 64-bit integer level values ("absolute levels"). The main terms index > 125854 ** for language-id 0 is allocate values 0-1023. The first prefix index > 125855 ** (if any) for language-id 0 is allocated values 1024-2047. And so on. > 125856 ** Language 1 indexes are allocated immediately following language 0. > 125857 ** > 125858 ** So, for a system with nPrefix prefix indexes configured, the block of > 125859 ** absolute levels that corresponds to language-id iLangid and index > 125860 ** iIndex starts at absolute level ((iLangid * (nPrefix+1) + iIndex) * 1024). > 125861 */ 125489 static sqlite3_int64 getAbsoluteLevel( 125862 static sqlite3_int64 getAbsoluteLevel( 125490 Fts3Table *p, | 125863 Fts3Table *p, /* FTS3 table handle */ 125491 int iLangid, | 125864 int iLangid, /* Language id */ 125492 int iIndex, < 125493 int iLevel < > 125865 int iIndex, /* Index in p->aIndex[] */ > 125866 int iLevel /* Level of segments */ 125494 ){ 125867 ){ > 125868 sqlite3_int64 iBase; /* First absolute level for iLangid/iIndex */ 125495 assert( iLangid>=0 ); 125869 assert( iLangid>=0 ); 125496 assert( p->nIndex>0 ); 125870 assert( p->nIndex>0 ); 125497 assert( iIndex>=0 && iIndex<p->nIndex ); 125871 assert( iIndex>=0 && iIndex<p->nIndex ); 125498 return (iLangid * p->nIndex + iIndex) * FTS3_SEGDIR_MAXLEVEL + iLevel; < 125499 } | 125872 > 125873 iBase = ((sqlite3_int64)iLangid * p->nIndex + iIndex) * FTS3_SEGDIR_MAXLEVEL; > 125874 return iBase + iLevel; 125500 | 125875 } 125501 125876 125502 /* 125877 /* 125503 ** Set *ppStmt to a statement handle that may be used to iterate through 125878 ** Set *ppStmt to a statement handle that may be used to iterate through 125504 ** all rows in the %_segdir table, from oldest to newest. If successful, 125879 ** all rows in the %_segdir table, from oldest to newest. If successful, 125505 ** return SQLITE_OK. If an error occurs while preparing the statement, 125880 ** return SQLITE_OK. If an error occurs while preparing the statement, 125506 ** return an SQLite error code. 125881 ** return an SQLite error code. 125507 ** 125882 ** ................................................................................................................................................................................ 125516 ** 3: end_block 125891 ** 3: end_block 125517 ** 4: root 125892 ** 4: root 125518 */ 125893 */ 125519 SQLITE_PRIVATE int sqlite3Fts3AllSegdirs( 125894 SQLITE_PRIVATE int sqlite3Fts3AllSegdirs( 125520 Fts3Table *p, /* FTS3 table */ 125895 Fts3Table *p, /* FTS3 table */ 125521 int iLangid, /* Language being queried */ 125896 int iLangid, /* Language being queried */ 125522 int iIndex, /* Index for p->aIndex[] */ 125897 int iIndex, /* Index for p->aIndex[] */ 125523 int iLevel, /* Level to select */ | 125898 int iLevel, /* Level to select (relative level) */ 125524 sqlite3_stmt **ppStmt /* OUT: Compiled statement */ 125899 sqlite3_stmt **ppStmt /* OUT: Compiled statement */ 125525 ){ 125900 ){ 125526 int rc; 125901 int rc; 125527 sqlite3_stmt *pStmt = 0; 125902 sqlite3_stmt *pStmt = 0; 125528 125903 125529 assert( iLevel==FTS3_SEGCURSOR_ALL || iLevel>=0 ); 125904 assert( iLevel==FTS3_SEGCURSOR_ALL || iLevel>=0 ); 125530 assert( iLevel<FTS3_SEGDIR_MAXLEVEL ); 125905 assert( iLevel<FTS3_SEGDIR_MAXLEVEL ); ................................................................................................................................................................................ 125531 assert( iIndex>=0 && iIndex<p->nIndex ); 125906 assert( iIndex>=0 && iIndex<p->nIndex ); 125532 125907 125533 if( iLevel<0 ){ 125908 if( iLevel<0 ){ 125534 /* "SELECT * FROM %_segdir WHERE level BETWEEN ? AND ? ORDER BY ..." */ 125909 /* "SELECT * FROM %_segdir WHERE level BETWEEN ? AND ? ORDER BY ..." */ 125535 rc = fts3SqlStmt(p, SQL_SELECT_LEVEL_RANGE, &pStmt, 0); 125910 rc = fts3SqlStmt(p, SQL_SELECT_LEVEL_RANGE, &pStmt, 0); 125536 if( rc==SQLITE_OK ){ 125911 if( rc==SQLITE_OK ){ 125537 sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, 0)); 125912 sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, 0)); 125538 sqlite3_bind_int(pStmt, 2, | 125913 sqlite3_bind_int64(pStmt, 2, 125539 getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1) 125914 getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1) 125540 ); 125915 ); 125541 } 125916 } 125542 }else{ 125917 }else{ 125543 /* "SELECT * FROM %_segdir WHERE level = ? ORDER BY ..." */ 125918 /* "SELECT * FROM %_segdir WHERE level = ? ORDER BY ..." */ 125544 rc = fts3SqlStmt(p, SQL_SELECT_LEVEL, &pStmt, 0); 125919 rc = fts3SqlStmt(p, SQL_SELECT_LEVEL, &pStmt, 0); 125545 if( rc==SQLITE_OK ){ 125920 if( rc==SQLITE_OK ){ 125546 sqlite3_bind_int(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, iLevel)); | 125921 sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex,iLevel)); 125547 } 125922 } 125548 } 125923 } 125549 *ppStmt = pStmt; 125924 *ppStmt = pStmt; 125550 return rc; 125925 return rc; 125551 } 125926 } 125552 125927 125553 125928 ................................................................................................................................................................................ 126060 if( rc==SQLITE_OK ){ 126435 if( rc==SQLITE_OK ){ 126061 /* If iNext is FTS3_MERGE_COUNT, indicating that level iLevel is already 126436 /* If iNext is FTS3_MERGE_COUNT, indicating that level iLevel is already 126062 ** full, merge all segments in level iLevel into a single iLevel+1 126437 ** full, merge all segments in level iLevel into a single iLevel+1 126063 ** segment and allocate (newly freed) index 0 at level iLevel. Otherwise, 126438 ** segment and allocate (newly freed) index 0 at level iLevel. Otherwise, 126064 ** if iNext is less than FTS3_MERGE_COUNT, allocate index iNext. 126439 ** if iNext is less than FTS3_MERGE_COUNT, allocate index iNext. 126065 */ 126440 */ 126066 if( iNext>=FTS3_MERGE_COUNT ){ 126441 if( iNext>=FTS3_MERGE_COUNT ){ > 126442 fts3LogMerge(16, getAbsoluteLevel(p, iLangid, iIndex, iLevel)); 126067 rc = fts3SegmentMerge(p, iLangid, iIndex, iLevel); 126443 rc = fts3SegmentMerge(p, iLangid, iIndex, iLevel); 126068 *piIdx = 0; 126444 *piIdx = 0; 126069 }else{ 126445 }else{ 126070 *piIdx = iNext; 126446 *piIdx = iNext; 126071 } 126447 } 126072 } 126448 } 126073 126449 ................................................................................................................................................................................ 126107 char **paBlob, /* OUT: Blob data in malloc'd buffer */ 126483 char **paBlob, /* OUT: Blob data in malloc'd buffer */ 126108 int *pnBlob, /* OUT: Size of blob data */ 126484 int *pnBlob, /* OUT: Size of blob data */ 126109 int *pnLoad /* OUT: Bytes actually loaded */ 126485 int *pnLoad /* OUT: Bytes actually loaded */ 126110 ){ 126486 ){ 126111 int rc; /* Return code */ 126487 int rc; /* Return code */ 126112 126488 126113 /* pnBlob must be non-NULL. paBlob may be NULL or non-NULL. */ 126489 /* pnBlob must be non-NULL. paBlob may be NULL or non-NULL. */ 126114 assert( pnBlob); | 126490 assert( pnBlob ); 126115 126491 126116 if( p->pSegments ){ 126492 if( p->pSegments ){ 126117 rc = sqlite3_blob_reopen(p->pSegments, iBlockid); 126493 rc = sqlite3_blob_reopen(p->pSegments, iBlockid); 126118 }else{ 126494 }else{ 126119 if( 0==p->zSegmentsTbl ){ 126495 if( 0==p->zSegmentsTbl ){ 126120 p->zSegmentsTbl = sqlite3_mprintf("%s_segments", p->zName); 126496 p->zSegmentsTbl = sqlite3_mprintf("%s_segments", p->zName); 126121 if( 0==p->zSegmentsTbl ) return SQLITE_NOMEM; 126497 if( 0==p->zSegmentsTbl ) return SQLITE_NOMEM; ................................................................................................................................................................................ 126448 ){ 126824 ){ 126449 Fts3Table *p = (Fts3Table*)pCsr->base.pVtab; 126825 Fts3Table *p = (Fts3Table*)pCsr->base.pVtab; 126450 int nOvfl = 0; 126826 int nOvfl = 0; 126451 int ii; 126827 int ii; 126452 int rc = SQLITE_OK; 126828 int rc = SQLITE_OK; 126453 int pgsz = p->nPgsz; 126829 int pgsz = p->nPgsz; 126454 126830 126455 assert( p->bHasStat ); | 126831 assert( p->bFts4 ); 126456 assert( pgsz>0 ); 126832 assert( pgsz>0 ); 126457 126833 126458 for(ii=0; rc==SQLITE_OK && ii<pMsr->nSegment; ii++){ 126834 for(ii=0; rc==SQLITE_OK && ii<pMsr->nSegment; ii++){ 126459 Fts3SegReader *pReader = pMsr->apSegment[ii]; 126835 Fts3SegReader *pReader = pMsr->apSegment[ii]; 126460 if( !fts3SegReaderIsPending(pReader) 126836 if( !fts3SegReaderIsPending(pReader) 126461 && !fts3SegReaderIsRootOnly(pReader) 126837 && !fts3SegReaderIsRootOnly(pReader) 126462 ){ 126838 ){ ................................................................................................................................................................................ 126805 sqlite3_bind_int64(pStmt, 1, iBlock); 127181 sqlite3_bind_int64(pStmt, 1, iBlock); 126806 sqlite3_bind_blob(pStmt, 2, z, n, SQLITE_STATIC); 127182 sqlite3_bind_blob(pStmt, 2, z, n, SQLITE_STATIC); 126807 sqlite3_step(pStmt); 127183 sqlite3_step(pStmt); 126808 rc = sqlite3_reset(pStmt); 127184 rc = sqlite3_reset(pStmt); 126809 } 127185 } 126810 return rc; 127186 return rc; 126811 } 127187 } > 127188 > 127189 /* > 127190 ** Find the largest relative level number in the table. If successful, set > 127191 ** *pnMax to this value and return SQLITE_OK. Otherwise, if an error occurs, > 127192 ** set *pnMax to zero and return an SQLite error code. > 127193 */ > 127194 SQLITE_PRIVATE int sqlite3Fts3MaxLevel(Fts3Table *p, int *pnMax){ > 127195 int rc; > 127196 int mxLevel = 0; > 127197 sqlite3_stmt *pStmt = 0; > 127198 > 127199 rc = fts3SqlStmt(p, SQL_SELECT_MXLEVEL, &pStmt, 0); > 127200 if( rc==SQLITE_OK ){ > 127201 if( SQLITE_ROW==sqlite3_step(pStmt) ){ > 127202 mxLevel = sqlite3_column_int(pStmt, 0); > 127203 } > 127204 rc = sqlite3_reset(pStmt); > 127205 } > 127206 *pnMax = mxLevel; > 127207 return rc; > 127208 } 126812 127209 126813 /* 127210 /* 126814 ** Insert a record into the %_segdir table. 127211 ** Insert a record into the %_segdir table. 126815 */ 127212 */ 126816 static int fts3WriteSegdir( 127213 static int fts3WriteSegdir( 126817 Fts3Table *p, /* Virtual table handle */ 127214 Fts3Table *p, /* Virtual table handle */ 126818 int iLevel, /* Value for "level" field */ | 127215 sqlite3_int64 iLevel, /* Value for "level" field (absolute level) */ 126819 int iIdx, /* Value for "idx" field */ 127216 int iIdx, /* Value for "idx" field */ 126820 sqlite3_int64 iStartBlock, /* Value for "start_block" field */ 127217 sqlite3_int64 iStartBlock, /* Value for "start_block" field */ 126821 sqlite3_int64 iLeafEndBlock, /* Value for "leaves_end_block" field */ 127218 sqlite3_int64 iLeafEndBlock, /* Value for "leaves_end_block" field */ 126822 sqlite3_int64 iEndBlock, /* Value for "end_block" field */ 127219 sqlite3_int64 iEndBlock, /* Value for "end_block" field */ 126823 char *zRoot, /* Blob value for "root" field */ 127220 char *zRoot, /* Blob value for "root" field */ 126824 int nRoot /* Number of bytes in buffer zRoot */ 127221 int nRoot /* Number of bytes in buffer zRoot */ 126825 ){ 127222 ){ 126826 sqlite3_stmt *pStmt; 127223 sqlite3_stmt *pStmt; 126827 int rc = fts3SqlStmt(p, SQL_INSERT_SEGDIR, &pStmt, 0); 127224 int rc = fts3SqlStmt(p, SQL_INSERT_SEGDIR, &pStmt, 0); 126828 if( rc==SQLITE_OK ){ 127225 if( rc==SQLITE_OK ){ 126829 sqlite3_bind_int(pStmt, 1, iLevel); | 127226 sqlite3_bind_int64(pStmt, 1, iLevel); 126830 sqlite3_bind_int(pStmt, 2, iIdx); 127227 sqlite3_bind_int(pStmt, 2, iIdx); 126831 sqlite3_bind_int64(pStmt, 3, iStartBlock); 127228 sqlite3_bind_int64(pStmt, 3, iStartBlock); 126832 sqlite3_bind_int64(pStmt, 4, iLeafEndBlock); 127229 sqlite3_bind_int64(pStmt, 4, iLeafEndBlock); 126833 sqlite3_bind_int64(pStmt, 5, iEndBlock); 127230 sqlite3_bind_int64(pStmt, 5, iEndBlock); 126834 sqlite3_bind_blob(pStmt, 6, zRoot, nRoot, SQLITE_STATIC); 127231 sqlite3_bind_blob(pStmt, 6, zRoot, nRoot, SQLITE_STATIC); 126835 sqlite3_step(pStmt); 127232 sqlite3_step(pStmt); 126836 rc = sqlite3_reset(pStmt); 127233 rc = sqlite3_reset(pStmt); ................................................................................................................................................................................ 127122 127519 127123 if( nData>0 && nData+nReq>p->nNodeSize ){ 127520 if( nData>0 && nData+nReq>p->nNodeSize ){ 127124 int rc; 127521 int rc; 127125 127522 127126 /* The current leaf node is full. Write it out to the database. */ 127523 /* The current leaf node is full. Write it out to the database. */ 127127 rc = fts3WriteSegment(p, pWriter->iFree++, pWriter->aData, nData); 127524 rc = fts3WriteSegment(p, pWriter->iFree++, pWriter->aData, nData); 127128 if( rc!=SQLITE_OK ) return rc; 127525 if( rc!=SQLITE_OK ) return rc; > 127526 p->nLeafAdd++; 127129 127527 127130 /* Add the current term to the interior node tree. The term added to 127528 /* Add the current term to the interior node tree. The term added to 127131 ** the interior tree must: 127529 ** the interior tree must: 127132 ** 127530 ** 127133 ** a) be greater than the largest term on the leaf node just written 127531 ** a) be greater than the largest term on the leaf node just written 127134 ** to the database (still available in pWriter->zTerm), and 127532 ** to the database (still available in pWriter->zTerm), and 127135 ** 127533 ** ................................................................................................................................................................................ 127205 ** database. This function must be called after all terms have been added 127603 ** database. This function must be called after all terms have been added 127206 ** to the segment using fts3SegWriterAdd(). If successful, SQLITE_OK is 127604 ** to the segment using fts3SegWriterAdd(). If successful, SQLITE_OK is 127207 ** returned. Otherwise, an SQLite error code. 127605 ** returned. Otherwise, an SQLite error code. 127208 */ 127606 */ 127209 static int fts3SegWriterFlush( 127607 static int fts3SegWriterFlush( 127210 Fts3Table *p, /* Virtual table handle */ 127608 Fts3Table *p, /* Virtual table handle */ 127211 SegmentWriter *pWriter, /* SegmentWriter to flush to the db */ 127609 SegmentWriter *pWriter, /* SegmentWriter to flush to the db */ 127212 int iLevel, /* Value for 'level' column of %_segdir */ | 127610 sqlite3_int64 iLevel, /* Value for 'level' column of %_segdir */ 127213 int iIdx /* Value for 'idx' column of %_segdir */ 127611 int iIdx /* Value for 'idx' column of %_segdir */ 127214 ){ 127612 ){ 127215 int rc; /* Return code */ 127613 int rc; /* Return code */ 127216 if( pWriter->pTree ){ 127614 if( pWriter->pTree ){ 127217 sqlite3_int64 iLast = 0; /* Largest block id written to database */ 127615 sqlite3_int64 iLast = 0; /* Largest block id written to database */ 127218 sqlite3_int64 iLastLeaf; /* Largest leaf block id written to db */ 127616 sqlite3_int64 iLastLeaf; /* Largest leaf block id written to db */ 127219 char *zRoot = NULL; /* Pointer to buffer containing root node */ 127617 char *zRoot = NULL; /* Pointer to buffer containing root node */ ................................................................................................................................................................................ 127230 p, iLevel, iIdx, pWriter->iFirst, iLastLeaf, iLast, zRoot, nRoot); 127628 p, iLevel, iIdx, pWriter->iFirst, iLastLeaf, iLast, zRoot, nRoot); 127231 } 127629 } 127232 }else{ 127630 }else{ 127233 /* The entire tree fits on the root node. Write it to the segdir table. */ 127631 /* The entire tree fits on the root node. Write it to the segdir table. */ 127234 rc = fts3WriteSegdir( 127632 rc = fts3WriteSegdir( 127235 p, iLevel, iIdx, 0, 0, 0, pWriter->aData, pWriter->nData); 127633 p, iLevel, iIdx, 0, 0, 0, pWriter->aData, pWriter->nData); 127236 } 127634 } > 127635 p->nLeafAdd++; 127237 return rc; 127636 return rc; 127238 } 127637 } 127239 127638 127240 /* 127639 /* 127241 ** Release all memory held by the SegmentWriter object passed as the 127640 ** Release all memory held by the SegmentWriter object passed as the 127242 ** first argument. 127641 ** first argument. 127243 */ 127642 */ ................................................................................................................................................................................ 127287 ** 127686 ** 127288 ** Return SQLITE_OK if successful, or an SQLite error code if not. 127687 ** Return SQLITE_OK if successful, or an SQLite error code if not. 127289 */ 127688 */ 127290 static int fts3SegmentMaxLevel( 127689 static int fts3SegmentMaxLevel( 127291 Fts3Table *p, 127690 Fts3Table *p, 127292 int iLangid, 127691 int iLangid, 127293 int iIndex, 127692 int iIndex, 127294 int *pnMax | 127693 sqlite3_int64 *pnMax 127295 ){ 127694 ){ 127296 sqlite3_stmt *pStmt; 127695 sqlite3_stmt *pStmt; 127297 int rc; 127696 int rc; 127298 assert( iIndex>=0 && iIndex<p->nIndex ); 127697 assert( iIndex>=0 && iIndex<p->nIndex ); 127299 127698 127300 /* Set pStmt to the compiled version of: 127699 /* Set pStmt to the compiled version of: 127301 ** 127700 ** 127302 ** SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ? 127701 ** SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ? 127303 ** 127702 ** 127304 ** (1024 is actually the value of macro FTS3_SEGDIR_PREFIXLEVEL_STR). 127703 ** (1024 is actually the value of macro FTS3_SEGDIR_PREFIXLEVEL_STR). 127305 */ 127704 */ 127306 rc = fts3SqlStmt(p, SQL_SELECT_SEGDIR_MAX_LEVEL, &pStmt, 0); 127705 rc = fts3SqlStmt(p, SQL_SELECT_SEGDIR_MAX_LEVEL, &pStmt, 0); 127307 if( rc!=SQLITE_OK ) return rc; 127706 if( rc!=SQLITE_OK ) return rc; 127308 sqlite3_bind_int(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, 0)); | 127707 sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, 0)); 127309 sqlite3_bind_int(pStmt, 2, | 127708 sqlite3_bind_int64(pStmt, 2, 127310 getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1) 127709 getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1) 127311 ); 127710 ); 127312 if( SQLITE_ROW==sqlite3_step(pStmt) ){ 127711 if( SQLITE_ROW==sqlite3_step(pStmt) ){ 127313 *pnMax = sqlite3_column_int(pStmt, 0); | 127712 *pnMax = sqlite3_column_int64(pStmt, 0); 127314 } 127713 } 127315 return sqlite3_reset(pStmt); 127714 return sqlite3_reset(pStmt); 127316 } 127715 } > 127716 > 127717 /* > 127718 ** Delete all entries in the %_segments table associated with the segment > 127719 ** opened with seg-reader pSeg. This function does not affect the contents > 127720 ** of the %_segdir table. > 127721 */ > 127722 static int fts3DeleteSegment( > 127723 Fts3Table *p, /* FTS table handle */ > 127724 Fts3SegReader *pSeg /* Segment to delete */ > 127725 ){ > 127726 int rc = SQLITE_OK; /* Return code */ > 127727 if( pSeg->iStartBlock ){ > 127728 sqlite3_stmt *pDelete; /* SQL statement to delete rows */ > 127729 rc = fts3SqlStmt(p, SQL_DELETE_SEGMENTS_RANGE, &pDelete, 0); > 127730 if( rc==SQLITE_OK ){ > 127731 sqlite3_bind_int64(pDelete, 1, pSeg->iStartBlock); > 127732 sqlite3_bind_int64(pDelete, 2, pSeg->iEndBlock); > 127733 sqlite3_step(pDelete); > 127734 rc = sqlite3_reset(pDelete); > 127735 } > 127736 } > 127737 return rc; > 127738 } 127317 127739 127318 /* 127740 /* 127319 ** This function is used after merging multiple segments into a single large 127741 ** This function is used after merging multiple segments into a single large 127320 ** segment to delete the old, now redundant, segment b-trees. Specifically, 127742 ** segment to delete the old, now redundant, segment b-trees. Specifically, 127321 ** it: 127743 ** it: 127322 ** 127744 ** 127323 ** 1) Deletes all %_segments entries for the segments associated with 127745 ** 1) Deletes all %_segments entries for the segments associated with ................................................................................................................................................................................ 127333 Fts3Table *p, /* Virtual table handle */ 127755 Fts3Table *p, /* Virtual table handle */ 127334 int iLangid, /* Language id */ 127756 int iLangid, /* Language id */ 127335 int iIndex, /* Index for p->aIndex */ 127757 int iIndex, /* Index for p->aIndex */ 127336 int iLevel, /* Level of %_segdir entries to delete */ 127758 int iLevel, /* Level of %_segdir entries to delete */ 127337 Fts3SegReader **apSegment, /* Array of SegReader objects */ 127759 Fts3SegReader **apSegment, /* Array of SegReader objects */ 127338 int nReader /* Size of array apSegment */ 127760 int nReader /* Size of array apSegment */ 127339 ){ 127761 ){ 127340 int rc; /* Return Code */ | 127762 int rc = SQLITE_OK; /* Return Code */ 127341 int i; /* Iterator variable */ 127763 int i; /* Iterator variable */ 127342 sqlite3_stmt *pDelete; /* SQL statement to delete rows */ | 127764 sqlite3_stmt *pDelete = 0; /* SQL statement to delete rows */ 127343 127765 127344 rc = fts3SqlStmt(p, SQL_DELETE_SEGMENTS_RANGE, &pDelete, 0); < 127345 for(i=0; rc==SQLITE_OK && i<nReader; i++){ 127766 for(i=0; rc==SQLITE_OK && i<nReader; i++){ 127346 Fts3SegReader *pSegment = apSegment[i]; < 127347 if( pSegment->iStartBlock ){ < 127348 sqlite3_bind_int64(pDelete, 1, pSegment->iStartBlock); < 127349 sqlite3_bind_int64(pDelete, 2, pSegment->iEndBlock); < 127350 sqlite3_step(pDelete); < 127351 rc = sqlite3_reset(pDelete); < 127352 } < > 127767 rc = fts3DeleteSegment(p, apSegment[i]); 127353 } 127768 } 127354 if( rc!=SQLITE_OK ){ 127769 if( rc!=SQLITE_OK ){ 127355 return rc; 127770 return rc; 127356 } 127771 } 127357 127772 127358 assert( iLevel>=0 || iLevel==FTS3_SEGCURSOR_ALL ); 127773 assert( iLevel>=0 || iLevel==FTS3_SEGCURSOR_ALL ); 127359 if( iLevel==FTS3_SEGCURSOR_ALL ){ 127774 if( iLevel==FTS3_SEGCURSOR_ALL ){ 127360 rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_RANGE, &pDelete, 0); 127775 rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_RANGE, &pDelete, 0); 127361 if( rc==SQLITE_OK ){ 127776 if( rc==SQLITE_OK ){ 127362 sqlite3_bind_int(pDelete, 1, getAbsoluteLevel(p, iLangid, iIndex, 0)); | 127777 sqlite3_bind_int64(pDelete, 1, getAbsoluteLevel(p, iLangid, iIndex, 0)); 127363 sqlite3_bind_int(pDelete, 2, | 127778 sqlite3_bind_int64(pDelete, 2, 127364 getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1) 127779 getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1) 127365 ); 127780 ); 127366 } 127781 } 127367 }else{ 127782 }else{ 127368 rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_LEVEL, &pDelete, 0); 127783 rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_LEVEL, &pDelete, 0); 127369 if( rc==SQLITE_OK ){ 127784 if( rc==SQLITE_OK ){ > 127785 sqlite3_bind_int64( 127370 sqlite3_bind_int(pDelete, 1, getAbsoluteLevel(p, iLangid, iIndex,iLevel)); | 127786 pDelete, 1, getAbsoluteLevel(p, iLangid, iIndex, iLevel) > 127787 ); 127371 } 127788 } 127372 } 127789 } 127373 127790 127374 if( rc==SQLITE_OK ){ 127791 if( rc==SQLITE_OK ){ 127375 sqlite3_step(pDelete); 127792 sqlite3_step(pDelete); 127376 rc = sqlite3_reset(pDelete); 127793 rc = sqlite3_reset(pDelete); 127377 } 127794 } ................................................................................................................................................................................ 127840 Fts3Table *p, 128257 Fts3Table *p, 127841 int iLangid, /* Language id to merge */ 128258 int iLangid, /* Language id to merge */ 127842 int iIndex, /* Index in p->aIndex[] to merge */ 128259 int iIndex, /* Index in p->aIndex[] to merge */ 127843 int iLevel /* Level to merge */ 128260 int iLevel /* Level to merge */ 127844 ){ 128261 ){ 127845 int rc; /* Return code */ 128262 int rc; /* Return code */ 127846 int iIdx = 0; /* Index of new segment */ 128263 int iIdx = 0; /* Index of new segment */ 127847 int iNewLevel = 0; /* Level/index to create new segment at */ | 128264 sqlite3_int64 iNewLevel = 0; /* Level/index to create new segment at */ 127848 SegmentWriter *pWriter = 0; /* Used to write the new, merged, segment */ 128265 SegmentWriter *pWriter = 0; /* Used to write the new, merged, segment */ 127849 Fts3SegFilter filter; /* Segment term filter condition */ 128266 Fts3SegFilter filter; /* Segment term filter condition */ 127850 Fts3MultiSegReader csr; /* Cursor to iterate through level(s) */ 128267 Fts3MultiSegReader csr; /* Cursor to iterate through level(s) */ 127851 int bIgnoreEmpty = 0; /* True to ignore empty segments */ 128268 int bIgnoreEmpty = 0; /* True to ignore empty segments */ 127852 128269 127853 assert( iLevel==FTS3_SEGCURSOR_ALL 128270 assert( iLevel==FTS3_SEGCURSOR_ALL 127854 || iLevel==FTS3_SEGCURSOR_PENDING 128271 || iLevel==FTS3_SEGCURSOR_PENDING ................................................................................................................................................................................ 127919 128336 127920 /* 128337 /* 127921 ** Flush the contents of pendingTerms to level 0 segments. 128338 ** Flush the contents of pendingTerms to level 0 segments. 127922 */ 128339 */ 127923 SQLITE_PRIVATE int sqlite3Fts3PendingTermsFlush(Fts3Table *p){ 128340 SQLITE_PRIVATE int sqlite3Fts3PendingTermsFlush(Fts3Table *p){ 127924 int rc = SQLITE_OK; 128341 int rc = SQLITE_OK; 127925 int i; 128342 int i; > 128343 127926 for(i=0; rc==SQLITE_OK && i<p->nIndex; i++){ 128344 for(i=0; rc==SQLITE_OK && i<p->nIndex; i++){ 127927 rc = fts3SegmentMerge(p, p->iPrevLangid, i, FTS3_SEGCURSOR_PENDING); 128345 rc = fts3SegmentMerge(p, p->iPrevLangid, i, FTS3_SEGCURSOR_PENDING); 127928 if( rc==SQLITE_DONE ) rc = SQLITE_OK; 128346 if( rc==SQLITE_DONE ) rc = SQLITE_OK; 127929 } 128347 } 127930 sqlite3Fts3PendingTermsClear(p); 128348 sqlite3Fts3PendingTermsClear(p); > 128349 > 128350 /* Determine the auto-incr-merge setting if unknown. If enabled, > 128351 ** estimate the number of leaf blocks of content to be written > 128352 */ > 128353 if( rc==SQLITE_OK && p->bHasStat > 128354 && p->bAutoincrmerge==0xff && p->nLeafAdd>0 > 128355 ){ > 128356 sqlite3_stmt *pStmt = 0; > 128357 rc = fts3SqlStmt(p, SQL_SELECT_STAT, &pStmt, 0); > 128358 if( rc==SQLITE_OK ){ > 128359 sqlite3_bind_int(pStmt, 1, FTS_STAT_AUTOINCRMERGE); > 128360 rc = sqlite3_step(pStmt); > 128361 p->bAutoincrmerge = (rc==SQLITE_ROW && sqlite3_column_int(pStmt, 0)); > 128362 rc = sqlite3_reset(pStmt); > 128363 } > 128364 } 127931 return rc; 128365 return rc; 127932 } 128366 } 127933 128367 127934 /* 128368 /* 127935 ** Encode N integers as varints into a blob. 128369 ** Encode N integers as varints into a blob. 127936 */ 128370 */ 127937 static void fts3EncodeIntArray( 128371 static void fts3EncodeIntArray( ................................................................................................................................................................................ 128034 if( *pRC ) return; 128468 if( *pRC ) return; 128035 a = sqlite3_malloc( (sizeof(u32)+10)*nStat ); 128469 a = sqlite3_malloc( (sizeof(u32)+10)*nStat ); 128036 if( a==0 ){ 128470 if( a==0 ){ 128037 *pRC = SQLITE_NOMEM; 128471 *pRC = SQLITE_NOMEM; 128038 return; 128472 return; 128039 } 128473 } 128040 pBlob = (char*)&a[nStat]; 128474 pBlob = (char*)&a[nStat]; 128041 rc = fts3SqlStmt(p, SQL_SELECT_DOCTOTAL, &pStmt, 0); | 128475 rc = fts3SqlStmt(p, SQL_SELECT_STAT, &pStmt, 0); 128042 if( rc ){ 128476 if( rc ){ 128043 sqlite3_free(a); 128477 sqlite3_free(a); 128044 *pRC = rc; 128478 *pRC = rc; 128045 return; 128479 return; 128046 } 128480 } > 128481 sqlite3_bind_int(pStmt, 1, FTS_STAT_DOCTOTAL); 128047 if( sqlite3_step(pStmt)==SQLITE_ROW ){ 128482 if( sqlite3_step(pStmt)==SQLITE_ROW ){ 128048 fts3DecodeIntArray(nStat, a, 128483 fts3DecodeIntArray(nStat, a, 128049 sqlite3_column_blob(pStmt, 0), 128484 sqlite3_column_blob(pStmt, 0), 128050 sqlite3_column_bytes(pStmt, 0)); 128485 sqlite3_column_bytes(pStmt, 0)); 128051 }else{ 128486 }else{ 128052 memset(a, 0, sizeof(u32)*(nStat) ); 128487 memset(a, 0, sizeof(u32)*(nStat) ); 128053 } 128488 } ................................................................................................................................................................................ 128063 x = 0; 128498 x = 0; 128064 }else{ 128499 }else{ 128065 x = x + aSzIns[i] - aSzDel[i]; 128500 x = x + aSzIns[i] - aSzDel[i]; 128066 } 128501 } 128067 a[i+1] = x; 128502 a[i+1] = x; 128068 } 128503 } 128069 fts3EncodeIntArray(nStat, a, pBlob, &nBlob); 128504 fts3EncodeIntArray(nStat, a, pBlob, &nBlob); 128070 rc = fts3SqlStmt(p, SQL_REPLACE_DOCTOTAL, &pStmt, 0); | 128505 rc = fts3SqlStmt(p, SQL_REPLACE_STAT, &pStmt, 0); 128071 if( rc ){ 128506 if( rc ){ 128072 sqlite3_free(a); 128507 sqlite3_free(a); 128073 *pRC = rc; 128508 *pRC = rc; 128074 return; 128509 return; 128075 } 128510 } > 128511 sqlite3_bind_int(pStmt, 1, FTS_STAT_DOCTOTAL); 128076 sqlite3_bind_blob(pStmt, 1, pBlob, nBlob, SQLITE_STATIC); | 128512 sqlite3_bind_blob(pStmt, 2, pBlob, nBlob, SQLITE_STATIC); 128077 sqlite3_step(pStmt); 128513 sqlite3_step(pStmt); 128078 *pRC = sqlite3_reset(pStmt); 128514 *pRC = sqlite3_reset(pStmt); 128079 sqlite3_free(a); 128515 sqlite3_free(a); 128080 } 128516 } 128081 128517 128082 /* 128518 /* 128083 ** Merge the entire database so that there is one segment for each 128519 ** Merge the entire database so that there is one segment for each ................................................................................................................................................................................ 128174 }else{ 128610 }else{ 128175 nEntry++; 128611 nEntry++; 128176 for(iCol=0; iCol<=p->nColumn; iCol++){ 128612 for(iCol=0; iCol<=p->nColumn; iCol++){ 128177 aSzIns[iCol] += aSz[iCol]; 128613 aSzIns[iCol] += aSz[iCol]; 128178 } 128614 } 128179 } 128615 } 128180 } 128616 } 128181 if( p->bHasStat ){ | 128617 if( p->bFts4 ){ 128182 fts3UpdateDocTotals(&rc, p, aSzIns, aSzDel, nEntry); 128618 fts3UpdateDocTotals(&rc, p, aSzIns, aSzDel, nEntry); 128183 } 128619 } 128184 sqlite3_free(aSz); 128620 sqlite3_free(aSz); 128185 128621 128186 if( pStmt ){ 128622 if( pStmt ){ 128187 int rc2 = sqlite3_finalize(pStmt); 128623 int rc2 = sqlite3_finalize(pStmt); 128188 if( rc==SQLITE_OK ){ 128624 if( rc==SQLITE_OK ){ ................................................................................................................................................................................ 128190 } 128626 } 128191 }