Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Update the built-in SQLite to an early 3.35 version containing support for generalized upsert, math functions, and reduced memory usage for VACUUM of large blobs. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
ea5465149ff5bc27a303bc7819689400 |
| User & Date: | drh 2020-12-15 14:21:11.874 |
Context
|
2020-12-16
| ||
| 14:28 | Update to the latest SQLite 3.35 prerelease in order to fix harmless #ifdef errors and compiler warnings. check-in: c9b6be2f62 user: drh tags: trunk | |
|
2020-12-15
| ||
| 14:21 | Update the built-in SQLite to an early 3.35 version containing support for generalized upsert, math functions, and reduced memory usage for VACUUM of large blobs. check-in: ea5465149f user: drh tags: trunk | |
| 01:13 | Alternative to check-in [a098707051568156] for getting the --static option to ./configure working on pkg-config based systems. check-in: 6f9d265234 user: drh tags: trunk | |
Changes
Changes to src/shell.c.
| ︙ | ︙ | |||
1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 | ** 384, or 512, to determine SHA3 hash variant that is computed. */ /* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include <assert.h> #include <string.h> #include <stdarg.h> /* typedef sqlite3_uint64 u64; */ /****************************************************************************** ** The Hash Engine */ /* ** Macros to determine whether the machine is big or little endian, ** and whether or not that determination is run-time or compile-time. | > > > | 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 | ** 384, or 512, to determine SHA3 hash variant that is computed. */ /* #include "sqlite3ext.h" */ SQLITE_EXTENSION_INIT1 #include <assert.h> #include <string.h> #include <stdarg.h> #ifndef SQLITE_AMALGAMATION /* typedef sqlite3_uint64 u64; */ #endif /* SQLITE_AMALGAMATION */ /****************************************************************************** ** The Hash Engine */ /* ** Macros to determine whether the machine is big or little endian, ** and whether or not that determination is run-time or compile-time. |
| ︙ | ︙ | |||
5559 5560 5561 5562 5563 5564 5565 | ** is a bitmask showing which constraints are available: ** ** 1: start=VALUE ** 2: stop=VALUE ** 4: step=VALUE ** ** Also, if bit 8 is set, that means that the series should be output | | > | 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 | ** is a bitmask showing which constraints are available: ** ** 1: start=VALUE ** 2: stop=VALUE ** 4: step=VALUE ** ** Also, if bit 8 is set, that means that the series should be output ** in descending order rather than in ascending order. If bit 16 is ** set, then output must appear in ascending order. ** ** This routine should initialize the cursor and position it so that it ** is pointing at the first row, or pointing off the end of the table ** (so that seriesEof() will return true) if the table is empty. */ static int seriesFilter( sqlite3_vtab_cursor *pVtabCursor, |
| ︙ | ︙ | |||
5585 5586 5587 5588 5589 5590 5591 |
if( idxNum & 2 ){
pCur->mxValue = sqlite3_value_int64(argv[i++]);
}else{
pCur->mxValue = 0xffffffff;
}
if( idxNum & 4 ){
pCur->iStep = sqlite3_value_int64(argv[i++]);
| | > > > > > | 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 |
if( idxNum & 2 ){
pCur->mxValue = sqlite3_value_int64(argv[i++]);
}else{
pCur->mxValue = 0xffffffff;
}
if( idxNum & 4 ){
pCur->iStep = sqlite3_value_int64(argv[i++]);
if( pCur->iStep==0 ){
pCur->iStep = 1;
}else if( pCur->iStep<0 ){
pCur->iStep = -pCur->iStep;
if( (idxNum & 16)==0 ) idxNum |= 8;
}
}else{
pCur->iStep = 1;
}
for(i=0; i<argc; i++){
if( sqlite3_value_type(argv[i])==SQLITE_NULL ){
/* If any of the constraints have a NULL value, then return no rows.
** See ticket https://www.sqlite.org/src/info/fac496b61722daf2 */
|
| ︙ | ︙ | |||
5679 5680 5681 5682 5683 5684 5685 |
}
if( (idxNum & 3)==3 ){
/* Both start= and stop= boundaries are available. This is the
** the preferred case */
pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
pIdxInfo->estimatedRows = 1000;
if( pIdxInfo->nOrderBy==1 ){
| | > > > > | 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 |
}
if( (idxNum & 3)==3 ){
/* Both start= and stop= boundaries are available. This is the
** the preferred case */
pIdxInfo->estimatedCost = (double)(2 - ((idxNum&4)!=0));
pIdxInfo->estimatedRows = 1000;
if( pIdxInfo->nOrderBy==1 ){
if( pIdxInfo->aOrderBy[0].desc ){
idxNum |= 8;
}else{
idxNum |= 16;
}
pIdxInfo->orderByConsumed = 1;
}
}else{
/* If either boundary is missing, we have to generate a huge span
** of numbers. Make this case very expensive so that the query
** planner will work hard to avoid it. */
pIdxInfo->estimatedRows = 2147483647;
|
| ︙ | ︙ | |||
8930 8931 8932 8933 8934 8935 8936 | int nTab = STRLEN(zTab); int nByte = sizeof(IdxTable) + nTab + 1; IdxTable *pNew = 0; int rc, rc2; char *pCsr = 0; int nPk = 0; | | | 8943 8944 8945 8946 8947 8948 8949 8950 8951 8952 8953 8954 8955 8956 8957 |
int nTab = STRLEN(zTab);
int nByte = sizeof(IdxTable) + nTab + 1;
IdxTable *pNew = 0;
int rc, rc2;
char *pCsr = 0;
int nPk = 0;
rc = idxPrintfPrepareStmt(db, &p1, pzErrmsg, "PRAGMA table_xinfo=%Q", zTab);
while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(p1) ){
const char *zCol = (const char*)sqlite3_column_text(p1, 1);
nByte += 1 + STRLEN(zCol);
rc = sqlite3_table_column_metadata(
db, "main", zTab, zCol, 0, &zCol, 0, 0, 0
);
nByte += 1 + STRLEN(zCol);
|
| ︙ | ︙ | |||
9964 9965 9966 9967 9968 9969 9970 |
);
}
idxFinalize(&rc, pAllIndex);
idxFinalize(&rc, pIndexXInfo);
idxFinalize(&rc, pWrite);
| > | | | | > | 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 |
);
}
idxFinalize(&rc, pAllIndex);
idxFinalize(&rc, pIndexXInfo);
idxFinalize(&rc, pWrite);
if( pCtx ){
for(i=0; i<pCtx->nSlot; i++){
sqlite3_free(pCtx->aSlot[i].z);
}
sqlite3_free(pCtx);
}
if( rc==SQLITE_OK ){
rc = sqlite3_exec(p->dbm, "ANALYZE sqlite_schema", 0, 0, 0);
}
sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp."UNIQUE_TABLE_NAME,0,0,0);
return rc;
|
| ︙ | ︙ | |||
12904 12905 12906 12907 12908 12909 12910 | p->nIndent = 0; p->iIndent = 0; } /* ** Disable and restore .wheretrace and .selecttrace settings. */ | < < | < < < | < < > | | < < | | < < | < < | < | 12919 12920 12921 12922 12923 12924 12925 12926 12927 12928 12929 12930 12931 12932 12933 12934 12935 12936 12937 12938 12939 12940 12941 12942 12943 12944 |
p->nIndent = 0;
p->iIndent = 0;
}
/*
** Disable and restore .wheretrace and .selecttrace settings.
*/
static unsigned int savedSelectTrace;
static unsigned int savedWhereTrace;
static void disable_debug_trace_modes(void){
unsigned int zero = 0;
sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 0, &savedSelectTrace);
sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 1, &zero);
sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 2, &savedWhereTrace);
sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 3, &zero);
}
static void restore_debug_trace_modes(void){
sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 1, &savedSelectTrace);
sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 3, &savedWhereTrace);
}
/* Create the TEMP table used to store parameter bindings */
static void bind_table_init(ShellState *p){
int wrSchema = 0;
int defensiveMode = 0;
sqlite3_db_config(p->db, SQLITE_DBCONFIG_DEFENSIVE, -1, &defensiveMode);
|
| ︙ | ︙ | |||
18703 18704 18705 18706 18707 18708 18709 |
raw_printf(p->out, "oomCounter = %d\n", oomCounter);
raw_printf(p->out, "oomRepeat = %d\n", oomRepeat);
}
}else
#endif /* SQLITE_DEBUG */
if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
| | | | | | 18705 18706 18707 18708 18709 18710 18711 18712 18713 18714 18715 18716 18717 18718 18719 18720 18721 18722 18723 18724 18725 18726 18727 18728 18729 18730 18731 18732 18733 |
raw_printf(p->out, "oomCounter = %d\n", oomCounter);
raw_printf(p->out, "oomRepeat = %d\n", oomRepeat);
}
}else
#endif /* SQLITE_DEBUG */
if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){
char *zNewFilename = 0; /* Name of the database file to open */
int iName = 1; /* Index in azArg[] of the filename */
int newFlag = 0; /* True to delete file before opening */
/* Close the existing database */
session_close_all(p);
close_db(p->db);
p->db = 0;
p->zDbFilename = 0;
sqlite3_free(p->zFreeOnClose);
p->zFreeOnClose = 0;
p->openMode = SHELL_OPEN_UNSPEC;
p->openFlags = 0;
p->szMax = 0;
/* Check for command-line arguments */
for(iName=1; iName<nArg; iName++){
const char *z = azArg[iName];
if( optionMatch(z,"new") ){
newFlag = 1;
#ifdef SQLITE_HAVE_ZLIB
}else if( optionMatch(z, "zip") ){
p->openMode = SHELL_OPEN_ZIPFILE;
#endif
|
| ︙ | ︙ | |||
18743 18744 18745 18746 18747 18748 18749 18750 18751 18752 |
}else if( optionMatch(z, "maxsize") && iName+1<nArg ){
p->szMax = integerValue(azArg[++iName]);
#endif /* SQLITE_ENABLE_DESERIALIZE */
}else if( z[0]=='-' ){
utf8_printf(stderr, "unknown option: %s\n", z);
rc = 1;
goto meta_command_exit;
}
}
/* If a filename is specified, try to open it first */
| > > > > > > < | 18745 18746 18747 18748 18749 18750 18751 18752 18753 18754 18755 18756 18757 18758 18759 18760 18761 18762 18763 18764 18765 18766 18767 |
}else if( optionMatch(z, "maxsize") && iName+1<nArg ){
p->szMax = integerValue(azArg[++iName]);
#endif /* SQLITE_ENABLE_DESERIALIZE */
}else if( z[0]=='-' ){
utf8_printf(stderr, "unknown option: %s\n", z);
rc = 1;
goto meta_command_exit;
}else if( zNewFilename ){
utf8_printf(stderr, "extra argument: \"%s\"\n", z);
rc = 1;
goto meta_command_exit;
}else{
zNewFilename = sqlite3_mprintf("%s", z);
}
}
/* If a filename is specified, try to open it first */
if( zNewFilename || p->openMode==SHELL_OPEN_HEXDB ){
if( newFlag ) shellDeleteFile(zNewFilename);
p->zDbFilename = zNewFilename;
open_db(p, OPEN_DB_KEEPALIVE);
if( p->db==0 ){
utf8_printf(stderr, "Error: cannot open '%s'\n", zNewFilename);
sqlite3_free(zNewFilename);
|
| ︙ | ︙ | |||
19269 19270 19271 19272 19273 19274 19275 |
raw_printf(stderr,"Error: querying schema information\n");
rc = 1;
}else{
rc = 0;
}
}else
| < | > < | 19276 19277 19278 19279 19280 19281 19282 19283 19284 19285 19286 19287 19288 19289 19290 19291 19292 19293 |
raw_printf(stderr,"Error: querying schema information\n");
rc = 1;
}else{
rc = 0;
}
}else
if( c=='s' && n==11 && strncmp(azArg[0], "selecttrace", n)==0 ){
unsigned int x = nArg>=2 ? (unsigned int)integerValue(azArg[1]) : 0xffffffff;
sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 1, &x);
}else
#if defined(SQLITE_ENABLE_SESSION)
if( c=='s' && strncmp(azArg[0],"session",n)==0 && n>=3 ){
OpenSession *pSession = &p->aSession[0];
char **azCmd = &azArg[1];
int iSes = 0;
int nCmd = nArg - 1;
|
| ︙ | ︙ | |||
20328 20329 20330 20331 20332 20333 20334 |
if( zVfsName ){
utf8_printf(p->out, "%s\n", zVfsName);
sqlite3_free(zVfsName);
}
}
}else
| < | > < | 20334 20335 20336 20337 20338 20339 20340 20341 20342 20343 20344 20345 20346 20347 20348 20349 20350 20351 |
if( zVfsName ){
utf8_printf(p->out, "%s\n", zVfsName);
sqlite3_free(zVfsName);
}
}
}else
if( c=='w' && strncmp(azArg[0], "wheretrace", n)==0 ){
unsigned int x = nArg>=2 ? (unsigned int)integerValue(azArg[1]) : 0xffffffff;
sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, 3, &x);
}else
if( c=='w' && strncmp(azArg[0], "width", n)==0 ){
int j;
assert( nArg<=ArraySize(azArg) );
p->nWidth = nArg-1;
p->colWidth = realloc(p->colWidth, p->nWidth*sizeof(int)*2);
if( p->colWidth==0 && p->nWidth>0 ) shell_out_of_memory();
|
| ︙ | ︙ |
Changes to src/sqlite3.c.
1 2 | /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite | | | 1 2 3 4 5 6 7 8 9 10 | /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite ** version 3.35.0. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements ** of 5% or more are commonly seen when SQLite is compiled as a single ** translation unit. ** ** This file is all you need to compile SQLite. To use SQLite in other |
| ︙ | ︙ | |||
279 280 281 282 283 284 285 286 287 288 289 290 291 292 | "ENABLE_JSON1", #endif #if SQLITE_ENABLE_LOAD_EXTENSION "ENABLE_LOAD_EXTENSION", #endif #ifdef SQLITE_ENABLE_LOCKING_STYLE "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE), #endif #if SQLITE_ENABLE_MEMORY_MANAGEMENT "ENABLE_MEMORY_MANAGEMENT", #endif #if SQLITE_ENABLE_MEMSYS3 "ENABLE_MEMSYS3", #endif | > > > | 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | "ENABLE_JSON1", #endif #if SQLITE_ENABLE_LOAD_EXTENSION "ENABLE_LOAD_EXTENSION", #endif #ifdef SQLITE_ENABLE_LOCKING_STYLE "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE), #endif #if SQLITE_ENABLE_MATH_FUNCTIONS "ENABLE_MATH_FUNCTIONS" #endif #if SQLITE_ENABLE_MEMORY_MANAGEMENT "ENABLE_MEMORY_MANAGEMENT", #endif #if SQLITE_ENABLE_MEMSYS3 "ENABLE_MEMSYS3", #endif |
| ︙ | ︙ | |||
986 987 988 989 990 991 992 993 994 995 996 997 998 999 | #endif #if defined(_MSC_VER) && !defined(SQLITE_DISABLE_INTRINSIC) # define MSVC_VERSION _MSC_VER #else # define MSVC_VERSION 0 #endif /* Needed for various definitions... */ #if defined(__GNUC__) && !defined(_GNU_SOURCE) # define _GNU_SOURCE #endif #if defined(__OpenBSD__) && !defined(_BSD_SOURCE) # define _BSD_SOURCE | > > > > > > > > > > > > | 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 | #endif #if defined(_MSC_VER) && !defined(SQLITE_DISABLE_INTRINSIC) # define MSVC_VERSION _MSC_VER #else # define MSVC_VERSION 0 #endif /* ** Some C99 functions in "math.h" are only present for MSVC when its version ** is associated with Visual Studio 2013 or higher. */ #ifndef SQLITE_HAVE_C99_MATH_FUNCS # if MSVC_VERSION==0 || MSVC_VERSION>=1800 # define SQLITE_HAVE_C99_MATH_FUNCS (1) # else # define SQLITE_HAVE_C99_MATH_FUNCS (0) # endif #endif /* Needed for various definitions... */ #if defined(__GNUC__) && !defined(_GNU_SOURCE) # define _GNU_SOURCE #endif #if defined(__OpenBSD__) && !defined(_BSD_SOURCE) # define _BSD_SOURCE |
| ︙ | ︙ | |||
1167 1168 1169 1170 1171 1172 1173 | ** been edited in any way since it was last checked in, then the last ** four hexadecimal digits of the hash may be modified. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ | | | | | 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 | ** been edited in any way since it was last checked in, then the last ** four hexadecimal digits of the hash may be modified. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.35.0" #define SQLITE_VERSION_NUMBER 3035000 #define SQLITE_SOURCE_ID "2020-12-15 13:55:38 ea0a7f103a6f6a9e57d7377140ff9f372bf2b156f86f148291fb05a7030f2b36" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
| ︙ | ︙ | |||
8809 8810 8811 8812 8813 8814 8815 | #define SQLITE_TESTCTRL_SORTER_MMAP 24 #define SQLITE_TESTCTRL_IMPOSTER 25 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26 #define SQLITE_TESTCTRL_RESULT_INTREAL 27 #define SQLITE_TESTCTRL_PRNG_SEED 28 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29 #define SQLITE_TESTCTRL_SEEK_COUNT 30 | > | | 8824 8825 8826 8827 8828 8829 8830 8831 8832 8833 8834 8835 8836 8837 8838 8839 | #define SQLITE_TESTCTRL_SORTER_MMAP 24 #define SQLITE_TESTCTRL_IMPOSTER 25 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26 #define SQLITE_TESTCTRL_RESULT_INTREAL 27 #define SQLITE_TESTCTRL_PRNG_SEED 28 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29 #define SQLITE_TESTCTRL_SEEK_COUNT 30 #define SQLITE_TESTCTRL_TRACEFLAGS 31 #define SQLITE_TESTCTRL_LAST 31 /* Largest TESTCTRL */ /* ** CAPI3REF: SQL Keyword Checking ** ** These routines provide access to the set of SQL language keywords ** recognized by SQLite. Applications can uses these routines to determine ** whether or not a specific identifier needs to be escaped (for example, |
| ︙ | ︙ | |||
14590 14591 14592 14593 14594 14595 14596 | # define SQLITE_DEFAULT_MMAP_SIZE SQLITE_MAX_MMAP_SIZE #endif /* ** SELECTTRACE_ENABLED will be either 1 or 0 depending on whether or not ** the Select query generator tracing logic is turned on. */ | | < | < | > | > > > > > > > > > > > > > > > | 14606 14607 14608 14609 14610 14611 14612 14613 14614 14615 14616 14617 14618 14619 14620 14621 14622 14623 14624 14625 14626 14627 14628 14629 14630 14631 14632 14633 14634 14635 14636 14637 14638 14639 14640 14641 14642 14643 14644 14645 14646 14647 14648 |
# define SQLITE_DEFAULT_MMAP_SIZE SQLITE_MAX_MMAP_SIZE
#endif
/*
** SELECTTRACE_ENABLED will be either 1 or 0 depending on whether or not
** the Select query generator tracing logic is turned on.
*/
#if !defined(SQLITE_AMALGAMATION)
SQLITE_PRIVATE u32 sqlite3SelectTrace;
#endif
#if defined(SQLITE_DEBUG) \
&& (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_SELECTTRACE))
# define SELECTTRACE_ENABLED 1
# define SELECTTRACE(K,P,S,X) \
if(sqlite3SelectTrace&(K)) \
sqlite3DebugPrintf("%u/%d/%p: ",(S)->selId,(P)->addrExplain,(S)),\
sqlite3DebugPrintf X
#else
# define SELECTTRACE(K,P,S,X)
# define SELECTTRACE_ENABLED 0
#endif
/*
** Macros for "wheretrace"
*/
#if !defined(SQLITE_AMAGAMATION)
SQLITE_PRIVATE u32 sqlite3WhereTrace;
#endif
#if defined(SQLITE_DEBUG) \
&& (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHERETRACE))
# define WHERETRACE(K,X) if(sqlite3WhereTrace&(K)) sqlite3DebugPrintf X
# define WHERETRACE_ENABLED 1
#else
# define WHERETRACE(K,X)
#endif
/*
** An instance of the following structure is used to store the busy-handler
** callback for a given sqlite handle.
**
** The sqlite.busyHandler member of the sqlite struct contains the busy
** callback for the database handle. Each pager opened via the sqlite
|
| ︙ | ︙ | |||
15314 15315 15316 15317 15318 15319 15320 15321 15322 15323 15324 15325 15326 15327 | SQLITE_PRIVATE int sqlite3BtreeCursorRestore(BtCursor*, int*); SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor*, u8 flags); /* Allowed flags for sqlite3BtreeDelete() and sqlite3BtreeInsert() */ #define BTREE_SAVEPOSITION 0x02 /* Leave cursor pointing at NEXT or PREV */ #define BTREE_AUXDELETE 0x04 /* not the primary delete operation */ #define BTREE_APPEND 0x08 /* Insert is likely an append */ /* An instance of the BtreePayload object describes the content of a single ** entry in either an index or table btree. ** ** Index btrees (used for indexes and also WITHOUT ROWID tables) contain ** an arbitrary key and no data. These btrees have pKey,nKey set to the ** key and the pData,nData,nZero fields are uninitialized. The aMem,nMem | > | 15344 15345 15346 15347 15348 15349 15350 15351 15352 15353 15354 15355 15356 15357 15358 | SQLITE_PRIVATE int sqlite3BtreeCursorRestore(BtCursor*, int*); SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor*, u8 flags); /* Allowed flags for sqlite3BtreeDelete() and sqlite3BtreeInsert() */ #define BTREE_SAVEPOSITION 0x02 /* Leave cursor pointing at NEXT or PREV */ #define BTREE_AUXDELETE 0x04 /* not the primary delete operation */ #define BTREE_APPEND 0x08 /* Insert is likely an append */ #define BTREE_PREFORMAT 0x80 /* Insert is likely an append */ /* An instance of the BtreePayload object describes the content of a single ** entry in either an index or table btree. ** ** Index btrees (used for indexes and also WITHOUT ROWID tables) contain ** an arbitrary key and no data. These btrees have pKey,nKey set to the ** key and the pData,nData,nZero fields are uninitialized. The aMem,nMem |
| ︙ | ︙ | |||
15412 15413 15414 15415 15416 15417 15418 15419 15420 15421 15422 15423 15424 15425 | SQLITE_PRIVATE int sqlite3BtreeCursorInfo(BtCursor*, int*, int); SQLITE_PRIVATE void sqlite3BtreeCursorList(Btree*); #endif #ifndef SQLITE_OMIT_WAL SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree*, int, int *, int *); #endif /* ** If we are not using shared cache, then there is no need to ** use mutexes to access the BtShared structures. So make the ** Enter and Leave procedures no-ops. */ #ifndef SQLITE_OMIT_SHARED_CACHE | > > | 15443 15444 15445 15446 15447 15448 15449 15450 15451 15452 15453 15454 15455 15456 15457 15458 | SQLITE_PRIVATE int sqlite3BtreeCursorInfo(BtCursor*, int*, int); SQLITE_PRIVATE void sqlite3BtreeCursorList(Btree*); #endif #ifndef SQLITE_OMIT_WAL SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree*, int, int *, int *); #endif SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor*, BtCursor*, i64); /* ** If we are not using shared cache, then there is no need to ** use mutexes to access the BtShared structures. So make the ** Enter and Leave procedures no-ops. */ #ifndef SQLITE_OMIT_SHARED_CACHE |
| ︙ | ︙ | |||
15755 15756 15757 15758 15759 15760 15761 | #define OP_Close 116 #define OP_ColumnsUsed 117 #define OP_SeekScan 118 /* synopsis: Scan-ahead up to P1 rows */ #define OP_SeekHit 119 /* synopsis: set P2<=seekHit<=P3 */ #define OP_Sequence 120 /* synopsis: r[P2]=cursor[P1].ctr++ */ #define OP_NewRowid 121 /* synopsis: r[P2]=rowid */ #define OP_Insert 122 /* synopsis: intkey=r[P3] data=r[P2] */ | > | | | | | | | | | | | | | | | | | | | | | | | | | | < > | | | | | | | | | | | | | | | | | | | | | | | | | | | 15788 15789 15790 15791 15792 15793 15794 15795 15796 15797 15798 15799 15800 15801 15802 15803 15804 15805 15806 15807 15808 15809 15810 15811 15812 15813 15814 15815 15816 15817 15818 15819 15820 15821 15822 15823 15824 15825 15826 15827 15828 15829 15830 15831 15832 15833 15834 15835 15836 15837 15838 15839 15840 15841 15842 15843 15844 15845 15846 15847 15848 15849 15850 15851 15852 15853 15854 15855 15856 | #define OP_Close 116 #define OP_ColumnsUsed 117 #define OP_SeekScan 118 /* synopsis: Scan-ahead up to P1 rows */ #define OP_SeekHit 119 /* synopsis: set P2<=seekHit<=P3 */ #define OP_Sequence 120 /* synopsis: r[P2]=cursor[P1].ctr++ */ #define OP_NewRowid 121 /* synopsis: r[P2]=rowid */ #define OP_Insert 122 /* synopsis: intkey=r[P3] data=r[P2] */ #define OP_RowCell 123 #define OP_Delete 124 #define OP_ResetCount 125 #define OP_SorterCompare 126 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ #define OP_SorterData 127 /* synopsis: r[P2]=data */ #define OP_RowData 128 /* synopsis: r[P2]=data */ #define OP_Rowid 129 /* synopsis: r[P2]=rowid */ #define OP_NullRow 130 #define OP_SeekEnd 131 #define OP_IdxInsert 132 /* synopsis: key=r[P2] */ #define OP_SorterInsert 133 /* synopsis: key=r[P2] */ #define OP_IdxDelete 134 /* synopsis: key=r[P2@P3] */ #define OP_DeferredSeek 135 /* synopsis: Move P3 to P1.rowid if needed */ #define OP_IdxRowid 136 /* synopsis: r[P2]=rowid */ #define OP_FinishSeek 137 #define OP_Destroy 138 #define OP_Clear 139 #define OP_ResetSorter 140 #define OP_CreateBtree 141 /* synopsis: r[P2]=root iDb=P1 flags=P3 */ #define OP_SqlExec 142 #define OP_ParseSchema 143 #define OP_LoadAnalysis 144 #define OP_DropTable 145 #define OP_DropIndex 146 #define OP_DropTrigger 147 #define OP_IntegrityCk 148 #define OP_RowSetAdd 149 /* synopsis: rowset(P1)=r[P2] */ #define OP_Real 150 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ #define OP_Param 151 #define OP_FkCounter 152 /* synopsis: fkctr[P1]+=P2 */ #define OP_MemMax 153 /* synopsis: r[P1]=max(r[P1],r[P2]) */ #define OP_OffsetLimit 154 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ #define OP_AggInverse 155 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */ #define OP_AggStep 156 /* synopsis: accum=r[P3] step(r[P2@P5]) */ #define OP_AggStep1 157 /* synopsis: accum=r[P3] step(r[P2@P5]) */ #define OP_AggValue 158 /* synopsis: r[P3]=value N=P2 */ #define OP_AggFinal 159 /* synopsis: accum=r[P1] N=P2 */ #define OP_Expire 160 #define OP_CursorLock 161 #define OP_CursorUnlock 162 #define OP_TableLock 163 /* synopsis: iDb=P1 root=P2 write=P3 */ #define OP_VBegin 164 #define OP_VCreate 165 #define OP_VDestroy 166 #define OP_VOpen 167 #define OP_VColumn 168 /* synopsis: r[P3]=vcolumn(P2) */ #define OP_VRename 169 #define OP_Pagecount 170 #define OP_MaxPgcnt 171 #define OP_Trace 172 #define OP_CursorHint 173 #define OP_ReleaseReg 174 /* synopsis: release r[P1@P2] mask P3 */ #define OP_Noop 175 #define OP_Explain 176 #define OP_Abortable 177 /* Properties such as "out2" or "jump" that are specified in ** comments following the "case" for each opcode in the vdbe.c ** are encoded into bitvectors as follows: */ #define OPFLG_JUMP 0x01 /* jump: P2 holds jmp target */ #define OPFLG_IN1 0x02 /* in1: P1 is an input */ |
| ︙ | ︙ | |||
15837 15838 15839 15840 15841 15842 15843 | /* 72 */ 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10,\ /* 80 */ 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x12,\ /* 88 */ 0x20, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ /* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26, 0x26,\ /* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00,\ /* 112 */ 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\ /* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ | | | | | | | | 15871 15872 15873 15874 15875 15876 15877 15878 15879 15880 15881 15882 15883 15884 15885 15886 15887 15888 15889 15890 15891 | /* 72 */ 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10,\ /* 80 */ 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x12,\ /* 88 */ 0x20, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ /* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26, 0x26,\ /* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00,\ /* 112 */ 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\ /* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ /* 128 */ 0x00, 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00,\ /* 136 */ 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00,\ /* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10,\ /* 152 */ 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00,\ /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ /* 168 */ 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,\ /* 176 */ 0x00, 0x00,} /* The sqlite3P2Values() routine is able to run faster if it knows ** the value of the largest JUMP opcode. The smaller the maximum ** JUMP opcode the better, so the mkopcodeh.tcl script that ** generated this include file strives to group all JUMP opcodes ** together near the beginning of the list. */ |
| ︙ | ︙ | |||
17283 17284 17285 17286 17287 17288 17289 17290 17291 17292 17293 17294 17295 17296 | ** DFUNCTION(zName, nArg, iArg, bNC, xFunc) ** Like FUNCTION except it omits the SQLITE_FUNC_CONSTANT flag and ** adds the SQLITE_FUNC_SLOCHNG flag. Used for date & time functions ** and functions like sqlite_version() that can change, but not during ** a single query. The iArg is ignored. The user-data is always set ** to a NULL pointer. The bNC parameter is not used. ** ** PURE_DATE(zName, nArg, iArg, bNC, xFunc) ** Used for "pure" date/time functions, this macro is like DFUNCTION ** except that it does set the SQLITE_FUNC_CONSTANT flags. iArg is ** ignored and the user-data for these functions is set to an ** arbitrary non-NULL pointer. The bNC parameter is not used. ** ** AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal) | > > > | 17317 17318 17319 17320 17321 17322 17323 17324 17325 17326 17327 17328 17329 17330 17331 17332 17333 | ** DFUNCTION(zName, nArg, iArg, bNC, xFunc) ** Like FUNCTION except it omits the SQLITE_FUNC_CONSTANT flag and ** adds the SQLITE_FUNC_SLOCHNG flag. Used for date & time functions ** and functions like sqlite_version() that can change, but not during ** a single query. The iArg is ignored. The user-data is always set ** to a NULL pointer. The bNC parameter is not used. ** ** MFUNCTION(zName, nArg, xPtr, xFunc) ** For math-library functions. xPtr is an arbitrary pointer. ** ** PURE_DATE(zName, nArg, iArg, bNC, xFunc) ** Used for "pure" date/time functions, this macro is like DFUNCTION ** except that it does set the SQLITE_FUNC_CONSTANT flags. iArg is ** ignored and the user-data for these functions is set to an ** arbitrary non-NULL pointer. The bNC parameter is not used. ** ** AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal) |
| ︙ | ︙ | |||
17318 17319 17320 17321 17322 17323 17324 17325 17326 17327 17328 17329 17330 17331 |
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
#define VFUNCTION(zName, nArg, iArg, bNC, xFunc) \
{nArg, SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
#define SFUNCTION(zName, nArg, iArg, bNC, xFunc) \
{nArg, SQLITE_UTF8|SQLITE_DIRECTONLY|SQLITE_FUNC_UNSAFE, \
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
#define INLINE_FUNC(zName, nArg, iArg, mFlags) \
{nArg, SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }
#define TEST_FUNC(zName, nArg, iArg, mFlags) \
{nArg, SQLITE_UTF8|SQLITE_FUNC_INTERNAL|SQLITE_FUNC_TEST| \
SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }
| > > > | 17355 17356 17357 17358 17359 17360 17361 17362 17363 17364 17365 17366 17367 17368 17369 17370 17371 |
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
#define VFUNCTION(zName, nArg, iArg, bNC, xFunc) \
{nArg, SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
#define SFUNCTION(zName, nArg, iArg, bNC, xFunc) \
{nArg, SQLITE_UTF8|SQLITE_DIRECTONLY|SQLITE_FUNC_UNSAFE, \
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} }
#define MFUNCTION(zName, nArg, xPtr, xFunc) \
{nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \
xPtr, 0, xFunc, 0, 0, 0, #zName, {0} }
#define INLINE_FUNC(zName, nArg, iArg, mFlags) \
{nArg, SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }
#define TEST_FUNC(zName, nArg, iArg, mFlags) \
{nArg, SQLITE_UTF8|SQLITE_FUNC_INTERNAL|SQLITE_FUNC_TEST| \
SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \
SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} }
|
| ︙ | ︙ | |||
17717 17718 17719 17720 17721 17722 17723 17724 | ** the operation in progress stops and returns an error code. But prior ** changes due to the same operation are not backed out and no rollback ** occurs. IGNORE means that the particular row that caused the constraint ** error is not inserted or updated. Processing continues and no error ** is returned. REPLACE means that preexisting database rows that caused ** a UNIQUE constraint violation are removed so that the new insert or ** update can proceed. Processing continues and no error is reported. ** | > > | > | > > > | | 17757 17758 17759 17760 17761 17762 17763 17764 17765 17766 17767 17768 17769 17770 17771 17772 17773 17774 17775 17776 17777 17778 17779 17780 17781 17782 17783 17784 17785 17786 | ** the operation in progress stops and returns an error code. But prior ** changes due to the same operation are not backed out and no rollback ** occurs. IGNORE means that the particular row that caused the constraint ** error is not inserted or updated. Processing continues and no error ** is returned. REPLACE means that preexisting database rows that caused ** a UNIQUE constraint violation are removed so that the new insert or ** update can proceed. Processing continues and no error is reported. ** UPDATE applies to insert operations only and means that the insert ** is omitted and the DO UPDATE clause of an upsert is run instead. ** ** RESTRICT, SETNULL, SETDFLT, and CASCADE actions apply only to foreign keys. ** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the ** same as ROLLBACK for DEFERRED keys. SETNULL means that the foreign ** key is set to NULL. SETDFLT means that the foreign key is set ** to its default value. CASCADE means that a DELETE or UPDATE of the ** referenced table row is propagated into the row that holds the ** foreign key. ** ** The OE_Default value is a place holder that means to use whatever ** conflict resolution algorthm is required from context. ** ** The following symbolic values are used to record which type ** of conflict resolution action to take. */ #define OE_None 0 /* There is no constraint to check */ #define OE_Rollback 1 /* Fail the operation and rollback the transaction */ #define OE_Abort 2 /* Back out changes but do no rollback transaction */ #define OE_Fail 3 /* Stop the operation but leave all prior changes */ #define OE_Ignore 4 /* Ignore the error. Do not do the INSERT or UPDATE */ #define OE_Replace 5 /* Delete existing record, then do INSERT or UPDATE */ |
| ︙ | ︙ | |||
18480 18481 18482 18483 18484 18485 18486 |
**
** pUpsertSet is the list of column=expr terms of the UPDATE statement.
** The pUpsertSet field is NULL for a ON CONFLICT DO NOTHING. The
** pUpsertWhere is the WHERE clause for the UPDATE and is NULL if the
** WHERE clause is omitted.
*/
struct Upsert {
| | > > | > > > | | < > > | | 18526 18527 18528 18529 18530 18531 18532 18533 18534 18535 18536 18537 18538 18539 18540 18541 18542 18543 18544 18545 18546 18547 18548 18549 18550 18551 18552 18553 18554 |
**
** pUpsertSet is the list of column=expr terms of the UPDATE statement.
** The pUpsertSet field is NULL for a ON CONFLICT DO NOTHING. The
** pUpsertWhere is the WHERE clause for the UPDATE and is NULL if the
** WHERE clause is omitted.
*/
struct Upsert {
ExprList *pUpsertTarget; /* Optional description of conflict target */
Expr *pUpsertTargetWhere; /* WHERE clause for partial index targets */
ExprList *pUpsertSet; /* The SET clause from an ON CONFLICT UPDATE */
Expr *pUpsertWhere; /* WHERE clause for the ON CONFLICT UPDATE */
Upsert *pNextUpsert; /* Next ON CONFLICT clause in the list */
u8 isDoUpdate; /* True for DO UPDATE. False for DO NOTHING */
/* Above this point is the parse tree for the ON CONFLICT clauses.
** The next group of fields stores intermediate data. */
void *pToFree; /* Free memory when deleting the Upsert object */
/* All fields above are owned by the Upsert object and must be freed
** when the Upsert is destroyed. The fields below are used to transfer
** information from the INSERT processing down into the UPDATE processing
** while generating code. The fields below are owned by the INSERT
** statement and will be freed by INSERT processing. */
Index *pUpsertIdx; /* UNIQUE constraint specified by pUpsertTarget */
SrcList *pUpsertSrc; /* Table to be updated */
int regData; /* First register holding array of VALUES */
int iDataCur; /* Index of the data cursor */
int iIdxCur; /* Index of the first index cursor */
};
/*
|
| ︙ | ︙ | |||
18930 18931 18932 18933 18934 18935 18936 18937 18938 18939 18940 18941 18942 18943 | #define OPFLAG_SEEKEQ 0x02 /* OP_Open** cursor uses EQ seek only */ #define OPFLAG_FORDELETE 0x08 /* OP_Open should use BTREE_FORDELETE */ #define OPFLAG_P2ISREG 0x10 /* P2 to OP_Open** is a register number */ #define OPFLAG_PERMUTE 0x01 /* OP_Compare: use the permutation */ #define OPFLAG_SAVEPOSITION 0x02 /* OP_Delete/Insert: save cursor pos */ #define OPFLAG_AUXDELETE 0x04 /* OP_Delete: index in a DELETE op */ #define OPFLAG_NOCHNG_MAGIC 0x6d /* OP_MakeRecord: serialtype 10 is ok */ /* * Each trigger present in the database schema is stored as an instance of * struct Trigger. * * Pointers to instances of struct Trigger are stored in two ways. * 1. In the "trigHash" hash table (part of the sqlite3* that represents the | > | 18982 18983 18984 18985 18986 18987 18988 18989 18990 18991 18992 18993 18994 18995 18996 | #define OPFLAG_SEEKEQ 0x02 /* OP_Open** cursor uses EQ seek only */ #define OPFLAG_FORDELETE 0x08 /* OP_Open should use BTREE_FORDELETE */ #define OPFLAG_P2ISREG 0x10 /* P2 to OP_Open** is a register number */ #define OPFLAG_PERMUTE 0x01 /* OP_Compare: use the permutation */ #define OPFLAG_SAVEPOSITION 0x02 /* OP_Delete/Insert: save cursor pos */ #define OPFLAG_AUXDELETE 0x04 /* OP_Delete: index in a DELETE op */ #define OPFLAG_NOCHNG_MAGIC 0x6d /* OP_MakeRecord: serialtype 10 is ok */ #define OPFLAG_PREFORMAT 0x80 /* OP_Insert uses preformatted cell */ /* * Each trigger present in the database schema is stored as an instance of * struct Trigger. * * Pointers to instances of struct Trigger are stored in two ways. * 1. In the "trigHash" hash table (part of the sqlite3* that represents the |
| ︙ | ︙ | |||
20027 20028 20029 20030 20031 20032 20033 | #ifndef SQLITE_AMALGAMATION SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[]; SQLITE_PRIVATE const char sqlite3StrBINARY[]; SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[]; SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[]; SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config; SQLITE_PRIVATE FuncDefHash sqlite3BuiltinFunctions; | < | 20080 20081 20082 20083 20084 20085 20086 20087 20088 20089 20090 20091 20092 20093 | #ifndef SQLITE_AMALGAMATION SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[]; SQLITE_PRIVATE const char sqlite3StrBINARY[]; SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[]; SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[]; SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config; SQLITE_PRIVATE FuncDefHash sqlite3BuiltinFunctions; #ifndef SQLITE_OMIT_WSD SQLITE_PRIVATE int sqlite3PendingByte; #endif #endif /* SQLITE_AMALGAMATION */ #ifdef VDBE_PROFILE SQLITE_PRIVATE sqlite3_uint64 sqlite3NProfileCnt; #endif |
| ︙ | ︙ | |||
20238 20239 20240 20241 20242 20243 20244 | SQLITE_PRIVATE void sqlite3WithDelete(sqlite3*,With*); SQLITE_PRIVATE void sqlite3WithPush(Parse*, With*, u8); #else #define sqlite3WithPush(x,y,z) #define sqlite3WithDelete(x,y) #endif #ifndef SQLITE_OMIT_UPSERT | | > > | | > > | 20290 20291 20292 20293 20294 20295 20296 20297 20298 20299 20300 20301 20302 20303 20304 20305 20306 20307 20308 20309 20310 20311 20312 20313 20314 20315 20316 | SQLITE_PRIVATE void sqlite3WithDelete(sqlite3*,With*); SQLITE_PRIVATE void sqlite3WithPush(Parse*, With*, u8); #else #define sqlite3WithPush(x,y,z) #define sqlite3WithDelete(x,y) #endif #ifndef SQLITE_OMIT_UPSERT SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*,Upsert*); SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3*,Upsert*); SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3*,Upsert*); SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget(Parse*,SrcList*,Upsert*); SQLITE_PRIVATE void sqlite3UpsertDoUpdate(Parse*,Upsert*,Table*,Index*,int); SQLITE_PRIVATE Upsert *sqlite3UpsertOfIndex(Upsert*,Index*); SQLITE_PRIVATE int sqlite3UpsertNextIsIPK(Upsert*); #else #define sqlite3UpsertNew(u,v,w,x,y,z) ((Upsert*)0) #define sqlite3UpsertDelete(x,y) #define sqlite3UpsertDup(x,y) ((Upsert*)0) #define sqlite3UpsertOfIndex(x,y) ((Upsert*)0) #define sqlite3UpsertNextIsIPK(x) 0 #endif /* Declarations for functions in fkey.c. All of these are replaced by ** no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign ** key functionality is available. If OMIT_TRIGGER is defined but ** OMIT_FOREIGN_KEY is not, only some of the functions are no-oped. In |
| ︙ | ︙ | |||
20742 20743 20744 20745 20746 20747 20748 | ** and incorrect behavior. */ #ifndef SQLITE_OMIT_WSD SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000; #endif /* | | | > | 20798 20799 20800 20801 20802 20803 20804 20805 20806 20807 20808 20809 20810 20811 20812 20813 20814 20815 | ** and incorrect behavior. */ #ifndef SQLITE_OMIT_WSD SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000; #endif /* ** Tracing flags set by SQLITE_TESTCTRL_TRACEFLAGS. */ SQLITE_PRIVATE u32 sqlite3SelectTrace = 0; SQLITE_PRIVATE u32 sqlite3WhereTrace = 0; /* #include "opcodes.h" */ /* ** Properties of opcodes. The OPFLG_INITIALIZER macro is ** created by mkopcodeh.awk during compilation. Data is obtained ** from the comments following the "case OP_xxxx:" statements in ** the vdbe.c file. |
| ︙ | ︙ | |||
23168 23169 23170 23171 23172 23173 23174 23175 23176 23177 23178 23179 23180 23181 23182 23183 23184 |
** routine has no return value since the return value would be meaningless.
*/
SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){
if( id->pMethods==0 ) return SQLITE_NOTFOUND;
#ifdef SQLITE_TEST
if( op!=SQLITE_FCNTL_COMMIT_PHASETWO
&& op!=SQLITE_FCNTL_LOCK_TIMEOUT
){
/* Faults are not injected into COMMIT_PHASETWO because, assuming SQLite
** is using a regular VFS, it is called after the corresponding
** transaction has been committed. Injecting a fault at this point
** confuses the test scripts - the COMMIT comand returns SQLITE_NOMEM
** but the transaction is committed anyway.
**
** The core must call OsFileControl() though, not OsFileControlHint(),
** as if a custom VFS (e.g. zipvfs) returns an error here, it probably
** means the commit really has failed and an error should be returned
| > > | > > > > > | 23225 23226 23227 23228 23229 23230 23231 23232 23233 23234 23235 23236 23237 23238 23239 23240 23241 23242 23243 23244 23245 23246 23247 23248 23249 23250 23251 23252 23253 23254 23255 23256 |
** routine has no return value since the return value would be meaningless.
*/
SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){
if( id->pMethods==0 ) return SQLITE_NOTFOUND;
#ifdef SQLITE_TEST
if( op!=SQLITE_FCNTL_COMMIT_PHASETWO
&& op!=SQLITE_FCNTL_LOCK_TIMEOUT
&& op!=SQLITE_FCNTL_CKPT_DONE
&& op!=SQLITE_FCNTL_CKPT_START
){
/* Faults are not injected into COMMIT_PHASETWO because, assuming SQLite
** is using a regular VFS, it is called after the corresponding
** transaction has been committed. Injecting a fault at this point
** confuses the test scripts - the COMMIT comand returns SQLITE_NOMEM
** but the transaction is committed anyway.
**
** The core must call OsFileControl() though, not OsFileControlHint(),
** as if a custom VFS (e.g. zipvfs) returns an error here, it probably
** means the commit really has failed and an error should be returned
** to the user.
**
** The CKPT_DONE and CKPT_START file-controls are write-only signals
** to the cksumvfs. Their return code is meaningless and is ignored
** by the SQLite core, so there is no point in simulating OOMs for them.
*/
DO_OS_MALLOC_TEST(id);
}
#endif
return id->pMethods->xFileControl(id, op, pArg);
}
SQLITE_PRIVATE void sqlite3OsFileControlHint(sqlite3_file *id, int op, void *pArg){
if( id->pMethods ) (void)id->pMethods->xFileControl(id, op, pArg);
|
| ︙ | ︙ | |||
33369 33370 33371 33372 33373 33374 33375 |
/* 116 */ "Close" OpHelp(""),
/* 117 */ "ColumnsUsed" OpHelp(""),
/* 118 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
/* 119 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
/* 120 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
/* 121 */ "NewRowid" OpHelp("r[P2]=rowid"),
/* 122 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
| > | | | | | | | | | | | | | | | | | | | | | | | | | | < > | | | | | | | | | | | | | | | | | | | | | | | | | | | 33433 33434 33435 33436 33437 33438 33439 33440 33441 33442 33443 33444 33445 33446 33447 33448 33449 33450 33451 33452 33453 33454 33455 33456 33457 33458 33459 33460 33461 33462 33463 33464 33465 33466 33467 33468 33469 33470 33471 33472 33473 33474 33475 33476 33477 33478 33479 33480 33481 33482 33483 33484 33485 33486 33487 33488 33489 33490 33491 33492 33493 33494 33495 33496 33497 33498 33499 33500 33501 |
/* 116 */ "Close" OpHelp(""),
/* 117 */ "ColumnsUsed" OpHelp(""),
/* 118 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"),
/* 119 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"),
/* 120 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
/* 121 */ "NewRowid" OpHelp("r[P2]=rowid"),
/* 122 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
/* 123 */ "RowCell" OpHelp(""),
/* 124 */ "Delete" OpHelp(""),
/* 125 */ "ResetCount" OpHelp(""),
/* 126 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
/* 127 */ "SorterData" OpHelp("r[P2]=data"),
/* 128 */ "RowData" OpHelp("r[P2]=data"),
/* 129 */ "Rowid" OpHelp("r[P2]=rowid"),
/* 130 */ "NullRow" OpHelp(""),
/* 131 */ "SeekEnd" OpHelp(""),
/* 132 */ "IdxInsert" OpHelp("key=r[P2]"),
/* 133 */ "SorterInsert" OpHelp("key=r[P2]"),
/* 134 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
/* 135 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
/* 136 */ "IdxRowid" OpHelp("r[P2]=rowid"),
/* 137 */ "FinishSeek" OpHelp(""),
/* 138 */ "Destroy" OpHelp(""),
/* 139 */ "Clear" OpHelp(""),
/* 140 */ "ResetSorter" OpHelp(""),
/* 141 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
/* 142 */ "SqlExec" OpHelp(""),
/* 143 */ "ParseSchema" OpHelp(""),
/* 144 */ "LoadAnalysis" OpHelp(""),
/* 145 */ "DropTable" OpHelp(""),
/* 146 */ "DropIndex" OpHelp(""),
/* 147 */ "DropTrigger" OpHelp(""),
/* 148 */ "IntegrityCk" OpHelp(""),
/* 149 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
/* 150 */ "Real" OpHelp("r[P2]=P4"),
/* 151 */ "Param" OpHelp(""),
/* 152 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
/* 153 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
/* 154 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
/* 155 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"),
/* 156 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
/* 157 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"),
/* 158 */ "AggValue" OpHelp("r[P3]=value N=P2"),
/* 159 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
/* 160 */ "Expire" OpHelp(""),
/* 161 */ "CursorLock" OpHelp(""),
/* 162 */ "CursorUnlock" OpHelp(""),
/* 163 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
/* 164 */ "VBegin" OpHelp(""),
/* 165 */ "VCreate" OpHelp(""),
/* 166 */ "VDestroy" OpHelp(""),
/* 167 */ "VOpen" OpHelp(""),
/* 168 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
/* 169 */ "VRename" OpHelp(""),
/* 170 */ "Pagecount" OpHelp(""),
/* 171 */ "MaxPgcnt" OpHelp(""),
/* 172 */ "Trace" OpHelp(""),
/* 173 */ "CursorHint" OpHelp(""),
/* 174 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"),
/* 175 */ "Noop" OpHelp(""),
/* 176 */ "Explain" OpHelp(""),
/* 177 */ "Abortable" OpHelp(""),
};
return azName[i];
}
#endif
/************** End of opcodes.c *********************************************/
/************** Begin file os_unix.c *****************************************/
|
| ︙ | ︙ | |||
64145 64146 64147 64148 64149 64150 64151 64152 64153 64154 64155 64156 64157 64158 | #ifndef SQLITE_OMIT_SHARED_CACHE int nRef; /* Number of references to this structure */ BtShared *pNext; /* Next on a list of sharable BtShared structs */ BtLock *pLock; /* List of locks held on this shared-btree struct */ Btree *pWriter; /* Btree with currently open write transaction */ #endif u8 *pTmpSpace; /* Temp space sufficient to hold a single cell */ }; /* ** Allowed values for BtShared.btsFlags */ #define BTS_READ_ONLY 0x0001 /* Underlying file is readonly */ #define BTS_PAGESIZE_FIXED 0x0002 /* Page size can no longer be changed */ | > | 64210 64211 64212 64213 64214 64215 64216 64217 64218 64219 64220 64221 64222 64223 64224 | #ifndef SQLITE_OMIT_SHARED_CACHE int nRef; /* Number of references to this structure */ BtShared *pNext; /* Next on a list of sharable BtShared structs */ BtLock *pLock; /* List of locks held on this shared-btree struct */ Btree *pWriter; /* Btree with currently open write transaction */ #endif u8 *pTmpSpace; /* Temp space sufficient to hold a single cell */ int nPreformatSize; /* Size of last cell written by TransferRow() */ }; /* ** Allowed values for BtShared.btsFlags */ #define BTS_READ_ONLY 0x0001 /* Underlying file is readonly */ #define BTS_PAGESIZE_FIXED 0x0002 /* Page size can no longer be changed */ |
| ︙ | ︙ | |||
65857 65858 65859 65860 65861 65862 65863 65864 65865 65866 65867 65868 65869 65870 |
if( surplus <= maxLocal ){
pInfo->nLocal = (u16)surplus;
}else{
pInfo->nLocal = (u16)minLocal;
}
pInfo->nSize = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell) + 4;
}
/*
** The following routines are implementations of the MemPage.xParseCell()
** method.
**
** Parse a cell content block and fill in the CellInfo structure.
**
| > > > > > > > > > > > > > > > > > > | 65923 65924 65925 65926 65927 65928 65929 65930 65931 65932 65933 65934 65935 65936 65937 65938 65939 65940 65941 65942 65943 65944 65945 65946 65947 65948 65949 65950 65951 65952 65953 65954 |
if( surplus <= maxLocal ){
pInfo->nLocal = (u16)surplus;
}else{
pInfo->nLocal = (u16)minLocal;
}
pInfo->nSize = (u16)(&pInfo->pPayload[pInfo->nLocal] - pCell) + 4;
}
/*
** Given a record with nPayload bytes of payload stored within btree
** page pPage, return the number of bytes of payload stored locally.
*/
static int btreePayloadToLocal(MemPage *pPage, i64 nPayload){
int maxLocal; /* Maximum amount of payload held locally */
maxLocal = pPage->maxLocal;
if( nPayload<=maxLocal ){
return nPayload;
}else{
int minLocal; /* Minimum amount of payload held locally */
int surplus; /* Overflow payload available for local storage */
minLocal = pPage->minLocal;
surplus = minLocal + (nPayload - minLocal)%(pPage->pBt->usableSize-4);
return ( surplus <= maxLocal ) ? surplus : minLocal;
}
}
/*
** The following routines are implementations of the MemPage.xParseCell()
** method.
**
** Parse a cell content block and fill in the CellInfo structure.
**
|
| ︙ | ︙ | |||
73375 73376 73377 73378 73379 73380 73381 | int idx; MemPage *pPage; Btree *p = pCur->pBtree; BtShared *pBt = p->pBt; unsigned char *oldCell; unsigned char *newCell = 0; | | > | | 73459 73460 73461 73462 73463 73464 73465 73466 73467 73468 73469 73470 73471 73472 73473 73474 73475 73476 73477 73478 73479 73480 73481 73482 73483 73484 73485 73486 73487 73488 73489 73490 73491 73492 |
int idx;
MemPage *pPage;
Btree *p = pCur->pBtree;
BtShared *pBt = p->pBt;
unsigned char *oldCell;
unsigned char *newCell = 0;
assert( (flags & (BTREE_SAVEPOSITION|BTREE_APPEND|BTREE_PREFORMAT))==flags );
assert( (flags & BTREE_PREFORMAT)==0 || seekResult || pCur->pKeyInfo==0 );
if( pCur->eState==CURSOR_FAULT ){
assert( pCur->skipNext!=SQLITE_OK );
return pCur->skipNext;
}
assert( cursorOwnsBtShared(pCur) );
assert( (pCur->curFlags & BTCF_WriteFlag)!=0
&& pBt->inTransaction==TRANS_WRITE
&& (pBt->btsFlags & BTS_READ_ONLY)==0 );
assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) );
/* Assert that the caller has been consistent. If this cursor was opened
** expecting an index b-tree, then the caller should be inserting blob
** keys with no associated data. If the cursor was opened expecting an
** intkey table, the caller should be inserting integer keys with a
** blob of associated data. */
assert( (flags & BTREE_PREFORMAT) || (pX->pKey==0)==(pCur->pKeyInfo==0) );
/* Save the positions of any other cursors open on this table.
**
** In some cases, the call to btreeMoveto() below is a no-op. For
** example, when inserting data into a table with auto-generated integer
** keys, the VDBE layer invokes sqlite3BtreeLast() to figure out the
** integer key to use. It then calls this function to actually insert the
|
| ︙ | ︙ | |||
73503 73504 73505 73506 73507 73508 73509 |
}
assert( pCur->eState==CURSOR_VALID
|| (pCur->eState==CURSOR_INVALID && loc)
|| CORRUPT_DB );
pPage = pCur->pPage;
| | > > > > > > > > > > > > > | > | 73588 73589 73590 73591 73592 73593 73594 73595 73596 73597 73598 73599 73600 73601 73602 73603 73604 73605 73606 73607 73608 73609 73610 73611 73612 73613 73614 73615 73616 73617 73618 73619 73620 73621 73622 73623 73624 73625 73626 73627 73628 73629 73630 73631 73632 73633 |
}
assert( pCur->eState==CURSOR_VALID
|| (pCur->eState==CURSOR_INVALID && loc)
|| CORRUPT_DB );
pPage = pCur->pPage;
assert( pPage->intKey || pX->nKey>=0 || (flags & BTREE_PREFORMAT) );
assert( pPage->leaf || !pPage->intKey );
if( pPage->nFree<0 ){
if( pCur->eState>CURSOR_INVALID ){
rc = SQLITE_CORRUPT_BKPT;
}else{
rc = btreeComputeFreeSpace(pPage);
}
if( rc ) return rc;
}
TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno,
loc==0 ? "overwrite" : "new entry"));
assert( pPage->isInit );
newCell = pBt->pTmpSpace;
assert( newCell!=0 );
if( flags & BTREE_PREFORMAT ){
rc = SQLITE_OK;
szNew = pBt->nPreformatSize;
if( szNew<4 ) szNew = 4;
if( ISAUTOVACUUM && szNew>pPage->maxLocal ){
CellInfo info;
pPage->xParseCell(pPage, newCell, &info);
if( info.nPayload!=info.nLocal ){
Pgno ovfl = get4byte(&newCell[szNew-4]);
ptrmapPut(pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, &rc);
}
}
}else{
rc = fillInCell(pPage, newCell, pX, &szNew);
}
if( rc ) goto end_insert;
assert( szNew==pPage->xCellSize(pPage, newCell) );
assert( szNew <= MX_CELL_SIZE(pBt) );
idx = pCur->ix;
if( loc==0 ){
CellInfo info;
assert( idx<pPage->nCell );
|
| ︙ | ︙ | |||
73624 73625 73626 73627 73628 73629 73630 73631 73632 73633 73634 73635 73636 73637 |
pCur->eState = CURSOR_REQUIRESEEK;
pCur->nKey = pX->nKey;
}
}
assert( pCur->iPage<0 || pCur->pPage->nOverflow==0 );
end_insert:
return rc;
}
/*
** Delete the entry that the cursor is pointing to.
**
** If the BTREE_SAVEPOSITION bit of the flags parameter is zero, then
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 73723 73724 73725 73726 73727 73728 73729 73730 73731 73732 73733 73734 73735 73736 73737 73738 73739 73740 73741 73742 73743 73744 73745 73746 73747 73748 73749 73750 73751 73752 73753 73754 73755 73756 73757 73758 73759 73760 73761 73762 73763 73764 73765 73766 73767 73768 73769 73770 73771 73772 73773 73774 73775 73776 73777 73778 73779 73780 73781 73782 73783 73784 73785 73786 73787 73788 73789 73790 73791 73792 73793 73794 73795 73796 73797 73798 73799 73800 73801 73802 73803 73804 73805 73806 73807 73808 73809 73810 73811 73812 73813 73814 73815 73816 73817 73818 73819 73820 73821 73822 73823 73824 73825 73826 73827 73828 73829 73830 73831 73832 73833 73834 73835 73836 73837 73838 |
pCur->eState = CURSOR_REQUIRESEEK;
pCur->nKey = pX->nKey;
}
}
assert( pCur->iPage<0 || pCur->pPage->nOverflow==0 );
end_insert:
return rc;
}
/*
** This function is used as part of copying the current row from cursor
** pSrc into cursor pDest. If the cursors are open on intkey tables, then
** parameter iKey is used as the rowid value when the record is copied
** into pDest. Otherwise, the record is copied verbatim.
**
** This function does not actually write the new value to cursor pDest.
** Instead, it creates and populates any required overflow pages and
** writes the data for the new cell into the BtShared.pTmpSpace buffer
** for the destination database. The size of the cell, in bytes, is left
** in BtShared.nPreformatSize. The caller completes the insertion by
** calling sqlite3BtreeInsert() with the BTREE_PREFORMAT flag specified.
**
** SQLITE_OK is returned if successful, or an SQLite error code otherwise.
*/
SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){
int rc = SQLITE_OK;
BtShared *pBt = pDest->pBt;
u8 *aOut = pBt->pTmpSpace; /* Pointer to next output buffer */
const u8 *aIn; /* Pointer to next input buffer */
int nIn; /* Size of input buffer aIn[] */
int nRem; /* Bytes of data still to copy */
getCellInfo(pSrc);
aOut += putVarint32(aOut, pSrc->info.nPayload);
if( pDest->pKeyInfo==0 ) aOut += putVarint(aOut, iKey);
nIn = pSrc->info.nLocal;
aIn = pSrc->info.pPayload;
nRem = pSrc->info.nPayload;
if( nIn==nRem && nIn<pDest->pPage->maxLocal ){
memcpy(aOut, aIn, nIn);
pBt->nPreformatSize = nIn + (aOut - pBt->pTmpSpace);
}else{
Pager *pSrcPager = pSrc->pBt->pPager;
u8 *pPgnoOut = 0;
Pgno ovflIn = 0;
DbPage *pPageIn = 0;
MemPage *pPageOut = 0;
int nOut; /* Size of output buffer aOut[] */
nOut = btreePayloadToLocal(pDest->pPage, pSrc->info.nPayload);
pBt->nPreformatSize = nOut + (aOut - pBt->pTmpSpace);
if( nOut<pSrc->info.nPayload ){
pPgnoOut = &aOut[nOut];
pBt->nPreformatSize += 4;
}
if( nRem>nIn ){
ovflIn = get4byte(&pSrc->info.pPayload[nIn]);
}
do {
nRem -= nOut;
do{
assert( nOut>0 );
if( nIn>0 ){
int nCopy = MIN(nOut, nIn);
memcpy(aOut, aIn, nCopy);
nOut -= nCopy;
nIn -= nCopy;
aOut += nCopy;
aIn += nCopy;
}
if( nOut>0 ){
sqlite3PagerUnref(pPageIn);
pPageIn = 0;
rc = sqlite3PagerGet(pSrcPager, ovflIn, &pPageIn, PAGER_GET_READONLY);
if( rc==SQLITE_OK ){
aIn = (const u8*)sqlite3PagerGetData(pPageIn);
ovflIn = get4byte(aIn);
aIn += 4;
nIn = pSrc->pBt->usableSize - 4;
}
}
}while( rc==SQLITE_OK && nOut>0 );
if( rc==SQLITE_OK && nRem>0 ){
Pgno pgnoNew;
MemPage *pNew = 0;
rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0);
put4byte(pPgnoOut, pgnoNew);
if( ISAUTOVACUUM && pPageOut ){
ptrmapPut(pBt, pgnoNew, PTRMAP_OVERFLOW2, pPageOut->pgno, &rc);
}
releasePage(pPageOut);
pPageOut = pNew;
if( pPageOut ){
pPgnoOut = pPageOut->aData;
put4byte(pPgnoOut, 0);
aOut = &pPgnoOut[4];
nOut = MIN(pBt->usableSize - 4, nRem);
}
}
}while( nRem>0 && rc==SQLITE_OK );
releasePage(pPageOut);
sqlite3PagerUnref(pPageIn);
}
return rc;
}
/*
** Delete the entry that the cursor is pointing to.
**
** If the BTREE_SAVEPOSITION bit of the flags parameter is zero, then
|
| ︙ | ︙ | |||
90699 90700 90701 90702 90703 90704 90705 |
if( pData->flags & MEM_Zero ){
x.nZero = pData->u.nZero;
}else{
x.nZero = 0;
}
x.pKey = 0;
rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,
| | > > > > > > > > > > > > > > > > > > > > > > > > > > | 90900 90901 90902 90903 90904 90905 90906 90907 90908 90909 90910 90911 90912 90913 90914 90915 90916 90917 90918 90919 90920 90921 90922 90923 90924 90925 90926 90927 90928 90929 90930 90931 90932 90933 90934 90935 90936 90937 90938 90939 90940 90941 90942 90943 90944 90945 90946 90947 90948 90949 90950 90951 90952 90953 90954 90955 |
if( pData->flags & MEM_Zero ){
x.nZero = pData->u.nZero;
}else{
x.nZero = 0;
}
x.pKey = 0;
rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,
(pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION|OPFLAG_PREFORMAT)),
seekResult
);
pC->deferredMoveto = 0;
pC->cacheStatus = CACHE_STALE;
/* Invoke the update-hook if required. */
if( rc ) goto abort_due_to_error;
if( pTab ){
assert( db->xUpdateCallback!=0 );
assert( pTab->aCol!=0 );
db->xUpdateCallback(db->pUpdateArg,
(pOp->p5 & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_INSERT,
zDb, pTab->zName, x.nKey);
}
break;
}
/* Opcode: RowCell P1 P2 P3 * *
**
** P1 and P2 are both open cursors. Both must be opened on the same type
** of table - intkey or index. This opcode is used as part of copying
** the current row from P2 into P1. If the cursors are opened on intkey
** tables, register P3 contains the rowid to use with the new record in
** P1. If they are opened on index tables, P3 is not used.
**
** This opcode must be followed by either an Insert or InsertIdx opcode
** with the OPFLAG_PREFORMAT flag set to complete the insert operation.
*/
case OP_RowCell: {
VdbeCursor *pDest; /* Cursor to write to */
VdbeCursor *pSrc; /* Cursor to read from */
i64 iKey; /* Rowid value to insert with */
assert( pOp[1].opcode==OP_Insert || pOp[1].opcode==OP_IdxInsert );
assert( pOp[1].p5 & OPFLAG_PREFORMAT );
pDest = p->apCsr[pOp->p1];
pSrc = p->apCsr[pOp->p2];
iKey = pOp->p3 ? aMem[pOp->p3].u.i : 0;
rc = sqlite3BtreeTransferRow(pDest->uc.pCursor, pSrc->uc.pCursor, iKey);
if( rc!=SQLITE_OK ) goto abort_due_to_error;
break;
};
/* Opcode: Delete P1 P2 P3 P4 P5
**
** Delete the record at which the P1 cursor is currently pointing.
**
** If the OPFLAG_SAVEPOSITION bit of the P5 parameter is set, then
** the cursor will be left pointing at either the next or the previous
|
| ︙ | ︙ | |||
91371 91372 91373 91374 91375 91376 91377 | assert( pOp->p1>=0 && pOp->p1<p->nCursor ); pC = p->apCsr[pOp->p1]; sqlite3VdbeIncrWriteCounter(p, pC); assert( pC!=0 ); assert( !isSorter(pC) ); pIn2 = &aMem[pOp->p2]; | | | | 91598 91599 91600 91601 91602 91603 91604 91605 91606 91607 91608 91609 91610 91611 91612 91613 91614 91615 91616 91617 91618 91619 91620 91621 91622 91623 |
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
pC = p->apCsr[pOp->p1];
sqlite3VdbeIncrWriteCounter(p, pC);
assert( pC!=0 );
assert( !isSorter(pC) );
pIn2 = &aMem[pOp->p2];
assert( (pIn2->flags & MEM_Blob) || (pOp->p5 & OPFLAG_PREFORMAT) );
if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
assert( pC->eCurType==CURTYPE_BTREE );
assert( pC->isTable==0 );
rc = ExpandBlob(pIn2);
if( rc ) goto abort_due_to_error;
x.nKey = pIn2->n;
x.pKey = pIn2->z;
x.aMem = aMem + pOp->p3;
x.nMem = (u16)pOp->p4.i;
rc = sqlite3BtreeInsert(pC->uc.pCursor, &x,
(pOp->p5 & (OPFLAG_APPEND|OPFLAG_SAVEPOSITION|OPFLAG_PREFORMAT)),
((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0)
);
assert( pC->deferredMoveto==0 );
pC->cacheStatus = CACHE_STALE;
if( rc) goto abort_due_to_error;
break;
}
|
| ︙ | ︙ | |||
119439 119440 119441 119442 119443 119444 119445 119446 119447 119448 119449 119450 119451 119452 |
if( zEscape[0]==aWc[1] ) return 0;
aWc[3] = zEscape[0];
}
*pIsNocase = (pDef->funcFlags & SQLITE_FUNC_CASE)==0;
return 1;
}
/*
** All of the FuncDef structures in the aBuiltinFunc[] array above
** to the global function hash table. This occurs at start-time (as
** a consequence of calling sqlite3_initialize()).
**
** After this routine runs
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 119666 119667 119668 119669 119670 119671 119672 119673 119674 119675 119676 119677 119678 119679 119680 119681 119682 119683 119684 119685 119686 119687 119688 119689 119690 119691 119692 119693 119694 119695 119696 119697 119698 119699 119700 119701 119702 119703 119704 119705 119706 119707 119708 119709 119710 119711 119712 119713 119714 119715 119716 119717 119718 119719 119720 119721 119722 119723 119724 119725 119726 119727 119728 119729 119730 119731 119732 119733 119734 119735 119736 119737 119738 119739 119740 119741 119742 119743 119744 119745 119746 119747 119748 119749 119750 119751 119752 119753 119754 119755 119756 119757 119758 119759 119760 119761 119762 119763 119764 119765 119766 119767 119768 119769 119770 119771 119772 119773 119774 119775 119776 119777 119778 119779 119780 119781 119782 119783 119784 119785 119786 119787 119788 119789 119790 119791 119792 119793 119794 119795 119796 119797 119798 119799 119800 119801 119802 119803 119804 119805 119806 119807 119808 119809 119810 119811 119812 119813 119814 119815 119816 119817 119818 119819 119820 119821 119822 119823 119824 119825 119826 119827 119828 119829 119830 119831 119832 119833 119834 119835 119836 119837 119838 119839 119840 119841 119842 119843 119844 119845 119846 119847 119848 119849 119850 119851 119852 119853 119854 119855 119856 119857 119858 119859 119860 119861 119862 119863 119864 119865 119866 |
if( zEscape[0]==aWc[1] ) return 0;
aWc[3] = zEscape[0];
}
*pIsNocase = (pDef->funcFlags & SQLITE_FUNC_CASE)==0;
return 1;
}
/* Mathematical Constants */
#ifndef M_PI
# define M_PI 3.141592653589793238462643383279502884
#endif
#ifndef M_LN10
# define M_LN10 2.302585092994045684017991454684364208
#endif
#ifndef M_LN2
# define M_LN2 0.693147180559945309417232121458176568
#endif
/* Extra math functions that require linking with -lm
*/
#ifdef SQLITE_ENABLE_MATH_FUNCTIONS
/*
** Implementation SQL functions:
**
** ceil(X)
** ceiling(X)
** floor(X)
**
** The sqlite3_user_data() pointer is a pointer to the libm implementation
** of the underlying C function.
*/
static void ceilingFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
assert( argc==1 );
switch( sqlite3_value_numeric_type(argv[0]) ){
case SQLITE_INTEGER: {
sqlite3_result_int64(context, sqlite3_value_int64(argv[0]));
break;
}
case SQLITE_FLOAT: {
double (*x)(double) = (double(*)(double))sqlite3_user_data(context);
sqlite3_result_double(context, x(sqlite3_value_double(argv[0])));
break;
}
default: {
break;
}
}
}
/*
** Implementation of SQL functions:
**
** ln(X) - natural logarithm
** log(X) - log X base 10
** log10(X) - log X base 10
** log(B,X) - log X base B
*/
static void logFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
double x, b, ans;
assert( argc==1 || argc==2 );
switch( sqlite3_value_numeric_type(argv[0]) ){
case SQLITE_INTEGER:
case SQLITE_FLOAT:
x = sqlite3_value_double(argv[0]);
if( x<0.0 ) return;
break;
default:
return;
}
if( argc==2 ){
switch( sqlite3_value_numeric_type(argv[0]) ){
case SQLITE_INTEGER:
case SQLITE_FLOAT:
b = x;
x = sqlite3_value_double(argv[1]);
if( x<0.0 ) return;
break;
default:
return;
}
ans = log(x)/log(b);
}else{
ans = log(x);
switch( SQLITE_PTR_TO_INT(sqlite3_user_data(context)) ){
case 1:
/* Convert from natural logarithm to log base 10 */
ans *= 1.0/M_LN10;
break;
case 2:
/* Convert from natural logarithm to log base 2 */
ans *= 1.0/M_LN2;
break;
default:
break;
}
}
sqlite3_result_double(context, ans);
}
/*
** Functions to converts degrees to radians and radians to degrees.
*/
static double degToRad(double x){ return x*(M_PI/180.0); }
static double radToDeg(double x){ return x*(180.0/M_PI); }
/*
** Implementation of 1-argument SQL math functions:
**
** exp(X) - Compute e to the X-th power
*/
static void math1Func(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
int type0;
double v0, ans;
double (*x)(double);
assert( argc==1 );
type0 = sqlite3_value_numeric_type(argv[0]);
if( type0!=SQLITE_INTEGER && type0!=SQLITE_FLOAT ) return;
v0 = sqlite3_value_double(argv[0]);
x = (double(*)(double))sqlite3_user_data(context);
ans = x(v0);
sqlite3_result_double(context, ans);
}
/*
** Implementation of 2-argument SQL math functions:
**
** power(X,Y) - Compute X to the Y-th power
*/
static void math2Func(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
int type0, type1;
double v0, v1, ans;
double (*x)(double,double);
assert( argc==2 );
type0 = sqlite3_value_numeric_type(argv[0]);
if( type0!=SQLITE_INTEGER && type0!=SQLITE_FLOAT ) return;
type1 = sqlite3_value_numeric_type(argv[1]);
if( type1!=SQLITE_INTEGER && type1!=SQLITE_FLOAT ) return;
v0 = sqlite3_value_double(argv[0]);
v1 = sqlite3_value_double(argv[1]);
x = (double(*)(double,double))sqlite3_user_data(context);
ans = x(v0, v1);
sqlite3_result_double(context, ans);
}
/*
** Implementation of 2-argument SQL math functions:
**
** power(X,Y) - Compute X to the Y-th power
*/
static void piFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
assert( argc==0 );
sqlite3_result_double(context, M_PI);
}
#endif /* SQLITE_ENABLE_MATH_FUNCTIONS */
/*
** Implementation of sign(X) function.
*/
static void signFunc(
sqlite3_context *context,
int argc,
sqlite3_value **argv
){
int type0;
double x;
assert( argc==1 );
type0 = sqlite3_value_numeric_type(argv[0]);
if( type0!=SQLITE_INTEGER && type0!=SQLITE_FLOAT ) return;
x = sqlite3_value_double(argv[0]);
sqlite3_result_int(context, x<0.0 ? -1 : x>0.0 ? +1 : 0);
}
/*
** All of the FuncDef structures in the aBuiltinFunc[] array above
** to the global function hash table. This occurs at start-time (as
** a consequence of calling sqlite3_initialize()).
**
** After this routine runs
|
| ︙ | ︙ | |||
119558 119559 119560 119561 119562 119563 119564 119565 119566 119567 119568 119569 119570 119571 |
LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE),
#endif
#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
FUNCTION(unknown, -1, 0, 0, unknownFunc ),
#endif
FUNCTION(coalesce, 1, 0, 0, 0 ),
FUNCTION(coalesce, 0, 0, 0, 0 ),
INLINE_FUNC(coalesce, -1, INLINEFUNC_coalesce, 0 ),
INLINE_FUNC(iif, 3, INLINEFUNC_iif, 0 ),
};
#ifndef SQLITE_OMIT_ALTERTABLE
sqlite3AlterFunctions();
#endif
sqlite3WindowFunctions();
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 119972 119973 119974 119975 119976 119977 119978 119979 119980 119981 119982 119983 119984 119985 119986 119987 119988 119989 119990 119991 119992 119993 119994 119995 119996 119997 119998 119999 120000 120001 120002 120003 120004 120005 120006 120007 120008 120009 120010 120011 120012 120013 120014 120015 120016 120017 120018 120019 120020 120021 120022 |
LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE),
#endif
#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
FUNCTION(unknown, -1, 0, 0, unknownFunc ),
#endif
FUNCTION(coalesce, 1, 0, 0, 0 ),
FUNCTION(coalesce, 0, 0, 0, 0 ),
#ifdef SQLITE_ENABLE_MATH_FUNCTIONS
MFUNCTION(ceil, 1, ceil, ceilingFunc ),
MFUNCTION(ceiling, 1, ceil, ceilingFunc ),
MFUNCTION(floor, 1, floor, ceilingFunc ),
#if SQLITE_HAVE_C99_MATH_FUNCS
MFUNCTION(trunc, 1, trunc, ceilingFunc ),
#endif
FUNCTION(ln, 1, 0, 0, logFunc ),
FUNCTION(log, 1, 1, 0, logFunc ),
FUNCTION(log10, 1, 1, 0, logFunc ),
FUNCTION(log2, 1, 2, 0, logFunc ),
FUNCTION(log, 2, 0, 0, logFunc ),
MFUNCTION(exp, 1, exp, math1Func ),
MFUNCTION(pow, 2, pow, math2Func ),
MFUNCTION(power, 2, pow, math2Func ),
MFUNCTION(mod, 2, fmod, math2Func ),
MFUNCTION(acos, 1, acos, math1Func ),
MFUNCTION(asin, 1, asin, math1Func ),
MFUNCTION(atan, 1, atan, math1Func ),
MFUNCTION(atan2, 2, atan2, math2Func ),
MFUNCTION(cos, 1, cos, math1Func ),
MFUNCTION(sin, 1, sin, math1Func ),
MFUNCTION(tan, 1, tan, math1Func ),
MFUNCTION(cosh, 1, cosh, math1Func ),
MFUNCTION(sinh, 1, sinh, math1Func ),
MFUNCTION(tanh, 1, tanh, math1Func ),
#if SQLITE_HAVE_C99_MATH_FUNCS
MFUNCTION(acosh, 1, acosh, math1Func ),
MFUNCTION(asinh, 1, asinh, math1Func ),
MFUNCTION(atanh, 1, atanh, math1Func ),
#endif
MFUNCTION(sqrt, 1, sqrt, math1Func ),
MFUNCTION(radians, 1, degToRad, math1Func ),
MFUNCTION(degrees, 1, radToDeg, math1Func ),
FUNCTION(pi, 0, 0, 0, piFunc ),
#endif /* SQLITE_ENABLE_MATH_FUNCTIONS */
FUNCTION(sign, 1, 0, 0, signFunc ),
INLINE_FUNC(coalesce, -1, INLINEFUNC_coalesce, 0 ),
INLINE_FUNC(iif, 3, INLINEFUNC_iif, 0 ),
};
#ifndef SQLITE_OMIT_ALTERTABLE
sqlite3AlterFunctions();
#endif
sqlite3WindowFunctions();
|
| ︙ | ︙ | |||
122016 122017 122018 122019 122020 122021 122022 122023 122024 122025 122026 122027 122028 122029 122030 122031 122032 122033 122034 122035 |
aRegIdx[i] = ++pParse->nMem;
pParse->nMem += pIdx->nColumn;
}
aRegIdx[i] = ++pParse->nMem; /* Register to store the table record */
}
#ifndef SQLITE_OMIT_UPSERT
if( pUpsert ){
if( IsVirtual(pTab) ){
sqlite3ErrorMsg(pParse, "UPSERT not implemented for virtual table \"%s\"",
pTab->zName);
goto insert_cleanup;
}
if( pTab->pSelect ){
sqlite3ErrorMsg(pParse, "cannot UPSERT a view");
goto insert_cleanup;
}
if( sqlite3HasExplicitNulls(pParse, pUpsert->pUpsertTarget) ){
goto insert_cleanup;
}
pTabList->a[0].iCursor = iDataCur;
| > > > | | | | | | | > > | 122467 122468 122469 122470 122471 122472 122473 122474 122475 122476 122477 122478 122479 122480 122481 122482 122483 122484 122485 122486 122487 122488 122489 122490 122491 122492 122493 122494 122495 122496 122497 122498 122499 122500 122501 122502 122503 122504 122505 |
aRegIdx[i] = ++pParse->nMem;
pParse->nMem += pIdx->nColumn;
}
aRegIdx[i] = ++pParse->nMem; /* Register to store the table record */
}
#ifndef SQLITE_OMIT_UPSERT
if( pUpsert ){
Upsert *pNx;
if( IsVirtual(pTab) ){
sqlite3ErrorMsg(pParse, "UPSERT not implemented for virtual table \"%s\"",
pTab->zName);
goto insert_cleanup;
}
if( pTab->pSelect ){
sqlite3ErrorMsg(pParse, "cannot UPSERT a view");
goto insert_cleanup;
}
if( sqlite3HasExplicitNulls(pParse, pUpsert->pUpsertTarget) ){
goto insert_cleanup;
}
pTabList->a[0].iCursor = iDataCur;
pNx = pUpsert;
do{
pNx->pUpsertSrc = pTabList;
pNx->regData = regData;
pNx->iDataCur = iDataCur;
pNx->iIdxCur = iIdxCur;
if( pNx->pUpsertTarget ){
sqlite3UpsertAnalyzeTarget(pParse, pTabList, pNx);
}
pNx = pNx->pNextUpsert;
}while( pNx!=0 );
}
#endif
/* This is the top of the main insertion loop */
if( useTempTable ){
/* This block codes the top of loop only. The complete loop is the
|
| ︙ | ︙ | |||
122439 122440 122441 122442 122443 122444 122445 122446 122447 122448 122449 122450 122451 122452 | } testcase( w.eCode==0 ); testcase( w.eCode==CKCNSTRNT_COLUMN ); testcase( w.eCode==CKCNSTRNT_ROWID ); testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) ); return w.eCode!=0; } /* ** Generate code to do constraint checks prior to an INSERT or an UPDATE ** on table pTab. ** ** The regNewData parameter is the first register in a range that contains ** the data to be inserted or the data after the update. There will be | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 122895 122896 122897 122898 122899 122900 122901 122902 122903 122904 122905 122906 122907 122908 122909 122910 122911 122912 122913 122914 122915 122916 122917 122918 122919 122920 122921 122922 122923 122924 122925 122926 122927 122928 122929 122930 122931 122932 122933 122934 122935 122936 122937 122938 122939 122940 122941 122942 122943 122944 122945 122946 122947 122948 122949 122950 122951 122952 122953 122954 122955 122956 122957 122958 122959 122960 122961 122962 122963 122964 122965 122966 122967 122968 122969 122970 122971 122972 |
}
testcase( w.eCode==0 );
testcase( w.eCode==CKCNSTRNT_COLUMN );
testcase( w.eCode==CKCNSTRNT_ROWID );
testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) );
return w.eCode!=0;
}
/*
** The sqlite3GenerateConstraintChecks() routine usually wants to visit
** the indexes of a table in the order provided in the Table->pIndex list.
** However, sometimes (rarely - when there is an upsert) it wants to visit
** the indexes in a different order. The following data structures accomplish
** this.
**
** The IndexIterator object is used to walk through all of the indexes
** of a table in either Index.pNext order, or in some other order established
** by an array of IndexListTerm objects.
*/
typedef struct IndexListTerm IndexListTerm;
typedef struct IndexIterator IndexIterator;
struct IndexIterator {
int eType; /* 0 for Index.pNext list. 1 for an array of IndexListTerm */
int i; /* Index of the current item from the list */
union {
struct { /* Use this object for eType==0: A Index.pNext list */
Index *pIdx; /* The current Index */
} lx;
struct { /* Use this object for eType==1; Array of IndexListTerm */
int nIdx; /* Size of the array */
IndexListTerm *aIdx; /* Array of IndexListTerms */
} ax;
} u;
};
/* When IndexIterator.eType==1, then each index is an array of instances
** of the following object
*/
struct IndexListTerm {
Index *p; /* The index */
int ix; /* Which entry in the original Table.pIndex list is this index*/
};
/* Return the first index on the list */
static Index *indexIteratorFirst(IndexIterator *pIter, int *pIx){
assert( pIter->i==0 );
if( pIter->eType ){
*pIx = pIter->u.ax.aIdx[0].ix;
return pIter->u.ax.aIdx[0].p;
}else{
*pIx = 0;
return pIter->u.lx.pIdx;
}
}
/* Return the next index from the list. Return NULL when out of indexes */
static Index *indexIteratorNext(IndexIterator *pIter, int *pIx){
if( pIter->eType ){
int i = ++pIter->i;
if( i>=pIter->u.ax.nIdx ){
*pIx = i;
return 0;
}
*pIx = pIter->u.ax.aIdx[i].ix;
return pIter->u.ax.aIdx[i].p;
}else{
++(*pIx);
pIter->u.lx.pIdx = pIter->u.lx.pIdx->pNext;
return pIter->u.lx.pIdx;
}
}
/*
** Generate code to do constraint checks prior to an INSERT or an UPDATE
** on table pTab.
**
** The regNewData parameter is the first register in a range that contains
** the data to be inserted or the data after the update. There will be
|
| ︙ | ︙ | |||
122548 122549 122550 122551 122552 122553 122554 |
int ignoreDest, /* Jump to this label on an OE_Ignore resolution */
int *pbMayReplace, /* OUT: Set to true if constraint may cause a replace */
int *aiChng, /* column i is unchanged if aiChng[i]<0 */
Upsert *pUpsert /* ON CONFLICT clauses, if any. NULL otherwise */
){
Vdbe *v; /* VDBE under constrution */
Index *pIdx; /* Pointer to one of the indices */
| | | | | | > | 123068 123069 123070 123071 123072 123073 123074 123075 123076 123077 123078 123079 123080 123081 123082 123083 123084 123085 123086 123087 123088 123089 123090 123091 123092 123093 123094 123095 123096 123097 123098 123099 123100 123101 123102 123103 123104 |
int ignoreDest, /* Jump to this label on an OE_Ignore resolution */
int *pbMayReplace, /* OUT: Set to true if constraint may cause a replace */
int *aiChng, /* column i is unchanged if aiChng[i]<0 */
Upsert *pUpsert /* ON CONFLICT clauses, if any. NULL otherwise */
){
Vdbe *v; /* VDBE under constrution */
Index *pIdx; /* Pointer to one of the indices */
Index *pPk = 0; /* The PRIMARY KEY index for WITHOUT ROWID tables */
sqlite3 *db; /* Database connection */
int i; /* loop counter */
int ix; /* Index loop counter */
int nCol; /* Number of columns */
int onError; /* Conflict resolution strategy */
int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */
int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */
Upsert *pUpsertClause = 0; /* The specific ON CONFLICT clause for pIdx */
u8 isUpdate; /* True if this is an UPDATE operation */
u8 bAffinityDone = 0; /* True if the OP_Affinity operation has been run */
int upsertIpkReturn = 0; /* Address of Goto at end of IPK uniqueness check */
int upsertIpkDelay = 0; /* Address of Goto to bypass initial IPK check */
int ipkTop = 0; /* Top of the IPK uniqueness check */
int ipkBottom = 0; /* OP_Goto at the end of the IPK uniqueness check */
/* Variables associated with retesting uniqueness constraints after
** replace triggers fire have run */
int regTrigCnt; /* Register used to count replace trigger invocations */
int addrRecheck = 0; /* Jump here to recheck all uniqueness constraints */
int lblRecheckOk = 0; /* Each recheck jumps to this label if it passes */
Trigger *pTrigger; /* List of DELETE triggers on the table pTab */
int nReplaceTrig = 0; /* Number of replace triggers coded */
IndexIterator sIdxIter; /* Index iterator */
isUpdate = regOldData!=0;
db = pParse->db;
v = pParse->pVdbe;
assert( v!=0 );
assert( pTab->pSelect==0 ); /* This table is not a VIEW */
nCol = pTab->nCol;
|
| ︙ | ︙ | |||
122767 122768 122769 122770 122771 122772 122773 | ** default conflict resolution strategy ** (C) Unique index that do use OE_Replace by default. ** ** The ordering of (2) and (3) is accomplished by making sure the linked ** list of indexes attached to a table puts all OE_Replace indexes last ** in the list. See sqlite3CreateIndex() for where that happens. */ | | > > > > > > | | < | | > > > > | > | | > > > > > > > > > > | < > > > > > > > > > > > > > > > > > > > > > > > > > | 123288 123289 123290 123291 123292 123293 123294 123295 123296 123297 123298 123299 123300 123301 123302 123303 123304 123305 123306 123307 123308 123309 123310 123311 123312 123313 123314 123315 123316 123317 123318 123319 123320 123321 123322 123323 123324 123325 123326 123327 123328 123329 123330 123331 123332 123333 123334 123335 123336 123337 123338 123339 123340 123341 123342 123343 123344 123345 123346 123347 123348 123349 123350 123351 123352 123353 123354 123355 123356 123357 123358 |
** default conflict resolution strategy
** (C) Unique index that do use OE_Replace by default.
**
** The ordering of (2) and (3) is accomplished by making sure the linked
** list of indexes attached to a table puts all OE_Replace indexes last
** in the list. See sqlite3CreateIndex() for where that happens.
*/
sIdxIter.eType = 0;
sIdxIter.i = 0;
sIdxIter.u.ax.aIdx = 0; /* Silence harmless compiler warning */
sIdxIter.u.lx.pIdx = pTab->pIndex;
if( pUpsert ){
if( pUpsert->pUpsertTarget==0 ){
/* There is just on ON CONFLICT clause and it has no constraint-target */
assert( pUpsert->pNextUpsert==0 );
if( pUpsert->isDoUpdate==0 ){
/* A single ON CONFLICT DO NOTHING clause, without a constraint-target.
** Make all unique constraint resolution be OE_Ignore */
overrideError = OE_Ignore;
pUpsert = 0;
}else{
/* A single ON CONFLICT DO UPDATE. Make all resolutions OE_Update */
overrideError = OE_Update;
}
}else if( pTab->pIndex!=0 ){
/* Otherwise, we'll need to run the IndexListTerm array version of the
** iterator to ensure that all of the ON CONFLICT conditions are
** checked first and in order. */
int nIdx, jj;
u64 nByte;
Upsert *pTerm;
u8 *bUsed;
for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){
assert( aRegIdx[nIdx]>0 );
}
sIdxIter.eType = 1;
sIdxIter.u.ax.nIdx = nIdx;
nByte = (sizeof(IndexListTerm)+1)*nIdx + nIdx;
sIdxIter.u.ax.aIdx = sqlite3DbMallocZero(db, nByte);
if( sIdxIter.u.ax.aIdx==0 ) return; /* OOM */
bUsed = (u8*)&sIdxIter.u.ax.aIdx[nIdx];
pUpsert->pToFree = sIdxIter.u.ax.aIdx;
for(i=0, pTerm=pUpsert; pTerm; pTerm=pTerm->pNextUpsert){
if( pTerm->pUpsertTarget==0 ) break;
if( pTerm->pUpsertIdx==0 ) continue; /* Skip ON CONFLICT for the IPK */
jj = 0;
pIdx = pTab->pIndex;
while( ALWAYS(pIdx!=0) && pIdx!=pTerm->pUpsertIdx ){
pIdx = pIdx->pNext;
jj++;
}
if( bUsed[jj] ) continue; /* Duplicate ON CONFLICT clause ignored */
bUsed[jj] = 1;
sIdxIter.u.ax.aIdx[i].p = pIdx;
sIdxIter.u.ax.aIdx[i].ix = jj;
i++;
}
for(jj=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, jj++){
if( bUsed[jj] ) continue;
sIdxIter.u.ax.aIdx[i].p = pIdx;
sIdxIter.u.ax.aIdx[i].ix = jj;
i++;
}
assert( i==nIdx );
}
}
/* Determine if it is possible that triggers (either explicitly coded
** triggers or FK resolution actions) might run as a result of deletes
** that happen when OE_Replace conflict resolution occurs. (Call these
** "replace triggers".) If any replace triggers run, we will need to
|
| ︙ | ︙ | |||
122842 122843 122844 122845 122846 122847 122848 |
if( overrideError!=OE_Default ){
onError = overrideError;
}else if( onError==OE_Default ){
onError = OE_Abort;
}
/* figure out whether or not upsert applies in this case */
| | > | > | | | > > > > > > > | 123407 123408 123409 123410 123411 123412 123413 123414 123415 123416 123417 123418 123419 123420 123421 123422 123423 123424 123425 123426 123427 123428 123429 123430 123431 123432 123433 123434 |
if( overrideError!=OE_Default ){
onError = overrideError;
}else if( onError==OE_Default ){
onError = OE_Abort;
}
/* figure out whether or not upsert applies in this case */
if( pUpsert ){
pUpsertClause = sqlite3UpsertOfIndex(pUpsert,0);
if( pUpsertClause!=0 ){
if( pUpsertClause->isDoUpdate==0 ){
onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */
}else{
onError = OE_Update; /* DO UPDATE */
}
}
if( pUpsertClause!=pUpsert ){
/* The first ON CONFLICT clause has a conflict target other than
** the IPK. We have to jump ahead to that first ON CONFLICT clause
** and then come back here and deal with the IPK afterwards */
upsertIpkDelay = sqlite3VdbeAddOp0(v, OP_Goto);
}
}
/* If the response to a rowid conflict is REPLACE but the response
** to some other UNIQUE constraint is FAIL or IGNORE, then we need
** to defer the running of the rowid conflict checking until after
** the UNIQUE constraints have run.
|
| ︙ | ︙ | |||
122953 122954 122955 122956 122957 122958 122959 |
case OE_Ignore: {
testcase( onError==OE_Ignore );
sqlite3VdbeGoto(v, ignoreDest);
break;
}
}
sqlite3VdbeResolveLabel(v, addrRowidOk);
| > > | > | > > | < | | | < < | > > | | 123527 123528 123529 123530 123531 123532 123533 123534 123535 123536 123537 123538 123539 123540 123541 123542 123543 123544 123545 123546 123547 123548 123549 123550 123551 123552 123553 123554 123555 123556 123557 123558 123559 123560 123561 123562 123563 123564 123565 123566 123567 123568 123569 123570 123571 123572 123573 123574 |
case OE_Ignore: {
testcase( onError==OE_Ignore );
sqlite3VdbeGoto(v, ignoreDest);
break;
}
}
sqlite3VdbeResolveLabel(v, addrRowidOk);
if( pUpsert && pUpsertClause!=pUpsert ){
upsertIpkReturn = sqlite3VdbeAddOp0(v, OP_Goto);
}else if( ipkTop ){
ipkBottom = sqlite3VdbeAddOp0(v, OP_Goto);
sqlite3VdbeJumpHere(v, ipkTop-1);
}
}
/* Test all UNIQUE constraints by creating entries for each UNIQUE
** index and making sure that duplicate entries do not already exist.
** Compute the revised record entries for indices as we go.
**
** This loop also handles the case of the PRIMARY KEY index for a
** WITHOUT ROWID table.
*/
for(pIdx = indexIteratorFirst(&sIdxIter, &ix);
pIdx;
pIdx = indexIteratorNext(&sIdxIter, &ix)
){
int regIdx; /* Range of registers hold conent for pIdx */
int regR; /* Range of registers holding conflicting PK */
int iThisCur; /* Cursor for this UNIQUE index */
int addrUniqueOk; /* Jump here if the UNIQUE constraint is satisfied */
int addrConflictCk; /* First opcode in the conflict check logic */
if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */
if( pUpsert ){
pUpsertClause = sqlite3UpsertOfIndex(pUpsert, pIdx);
if( upsertIpkDelay && pUpsertClause==pUpsert ){
sqlite3VdbeJumpHere(v, upsertIpkDelay);
}
}
addrUniqueOk = sqlite3VdbeMakeLabel(pParse);
if( bAffinityDone==0 ){
sqlite3TableAffinity(v, pTab, regNewData+1);
bAffinityDone = 1;
}
VdbeNoopComment((v, "prep index %s", pIdx->zName));
iThisCur = iIdxCur+ix;
|
| ︙ | ︙ | |||
123053 123054 123055 123056 123057 123058 123059 |
if( overrideError!=OE_Default ){
onError = overrideError;
}else if( onError==OE_Default ){
onError = OE_Abort;
}
/* Figure out if the upsert clause applies to this index */
| | | | 123631 123632 123633 123634 123635 123636 123637 123638 123639 123640 123641 123642 123643 123644 123645 123646 |
if( overrideError!=OE_Default ){
onError = overrideError;
}else if( onError==OE_Default ){
onError = OE_Abort;
}
/* Figure out if the upsert clause applies to this index */
if( pUpsertClause ){
if( pUpsertClause->isDoUpdate==0 ){
onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */
}else{
onError = OE_Update; /* DO UPDATE */
}
}
/* Collision detection may be omitted if all of the following are true:
|
| ︙ | ︙ | |||
123092 123093 123094 123095 123096 123097 123098 |
/* Check to see if the new index entry will be unique */
sqlite3VdbeVerifyAbortable(v, onError);
addrConflictCk =
sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
regIdx, pIdx->nKeyCol); VdbeCoverage(v);
/* Generate code to handle collisions */
| | | 123670 123671 123672 123673 123674 123675 123676 123677 123678 123679 123680 123681 123682 123683 123684 |
/* Check to see if the new index entry will be unique */
sqlite3VdbeVerifyAbortable(v, onError);
addrConflictCk =
sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk,
regIdx, pIdx->nKeyCol); VdbeCoverage(v);
/* Generate code to handle collisions */
regR = pIdx==pPk ? regIdx : sqlite3GetTempRange(pParse, nPkField);
if( isUpdate || onError==OE_Replace ){
if( HasRowid(pTab) ){
sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR);
/* Conflict only if the rowid of the existing index entry
** is different from old-rowid */
if( isUpdate ){
sqlite3VdbeAddOp3(v, OP_Eq, regR, addrUniqueOk, regOldData);
|
| ︙ | ︙ | |||
123244 123245 123246 123247 123248 123249 123250 |
sqlite3VdbeJumpHere(v, addrBypass); /* Terminate the recheck bypass */
}
seenReplace = 1;
break;
}
}
| > > | > > > | | | < < | 123822 123823 123824 123825 123826 123827 123828 123829 123830 123831 123832 123833 123834 123835 123836 123837 123838 123839 123840 123841 123842 123843 123844 123845 |
sqlite3VdbeJumpHere(v, addrBypass); /* Terminate the recheck bypass */
}
seenReplace = 1;
break;
}
}
sqlite3VdbeResolveLabel(v, addrUniqueOk);
if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField);
if( pUpsertClause
&& upsertIpkReturn
&& sqlite3UpsertNextIsIPK(pUpsertClause)
){
sqlite3VdbeGoto(v, upsertIpkDelay+1);
sqlite3VdbeJumpHere(v, upsertIpkReturn);
upsertIpkReturn = 0;
}
}
/* If the IPK constraint is a REPLACE, run it last */
if( ipkTop ){
sqlite3VdbeGoto(v, ipkTop);
VdbeComment((v, "Do IPK REPLACE"));
sqlite3VdbeJumpHere(v, ipkBottom);
|
| ︙ | ︙ | |||
123789 123790 123791 123792 123793 123794 123795 123796 123797 123798 123799 123800 123801 123802 |
iDbSrc = sqlite3SchemaToIndex(db, pSrc->pSchema);
v = sqlite3GetVdbe(pParse);
sqlite3CodeVerifySchema(pParse, iDbSrc);
iSrc = pParse->nTab++;
iDest = pParse->nTab++;
regAutoinc = autoIncBegin(pParse, iDbDest, pDest);
regData = sqlite3GetTempReg(pParse);
regRowid = sqlite3GetTempReg(pParse);
sqlite3OpenTable(pParse, iDest, iDbDest, pDest, OP_OpenWrite);
assert( HasRowid(pDest) || destHasUniqueIdx );
if( (db->mDbFlags & DBFLAG_Vacuum)==0 && (
(pDest->iPKey<0 && pDest->pIndex!=0) /* (1) */
|| destHasUniqueIdx /* (2) */
|| (onError!=OE_Abort && onError!=OE_Rollback) /* (3) */
| > | 124370 124371 124372 124373 124374 124375 124376 124377 124378 124379 124380 124381 124382 124383 124384 |
iDbSrc = sqlite3SchemaToIndex(db, pSrc->pSchema);
v = sqlite3GetVdbe(pParse);
sqlite3CodeVerifySchema(pParse, iDbSrc);
iSrc = pParse->nTab++;
iDest = pParse->nTab++;
regAutoinc = autoIncBegin(pParse, iDbDest, pDest);
regData = sqlite3GetTempReg(pParse);
sqlite3VdbeAddOp2(v, OP_Null, 0, regData);
regRowid = sqlite3GetTempReg(pParse);
sqlite3OpenTable(pParse, iDest, iDbDest, pDest, OP_OpenWrite);
assert( HasRowid(pDest) || destHasUniqueIdx );
if( (db->mDbFlags & DBFLAG_Vacuum)==0 && (
(pDest->iPKey<0 && pDest->pIndex!=0) /* (1) */
|| destHasUniqueIdx /* (2) */
|| (onError!=OE_Abort && onError!=OE_Rollback) /* (3) */
|
| ︙ | ︙ | |||
123824 123825 123826 123827 123828 123829 123830 |
}
if( HasRowid(pSrc) ){
u8 insFlags;
sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead);
emptySrcTest = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); VdbeCoverage(v);
if( pDest->iPKey>=0 ){
addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
| > | | | | | > > | | > > | > > > > > > | > | 124406 124407 124408 124409 124410 124411 124412 124413 124414 124415 124416 124417 124418 124419 124420 124421 124422 124423 124424 124425 124426 124427 124428 124429 124430 124431 124432 124433 124434 124435 124436 124437 124438 124439 124440 124441 124442 124443 124444 124445 124446 124447 124448 124449 124450 124451 124452 124453 |
}
if( HasRowid(pSrc) ){
u8 insFlags;
sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead);
emptySrcTest = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); VdbeCoverage(v);
if( pDest->iPKey>=0 ){
addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
if( (db->mDbFlags & DBFLAG_Vacuum)==0 ){
sqlite3VdbeVerifyAbortable(v, onError);
addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid);
VdbeCoverage(v);
sqlite3RowidConstraint(pParse, onError, pDest);
sqlite3VdbeJumpHere(v, addr2);
}
autoIncStep(pParse, regAutoinc, regRowid);
}else if( pDest->pIndex==0 && !(db->mDbFlags & DBFLAG_VacuumInto) ){
addr1 = sqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid);
}else{
addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
assert( (pDest->tabFlags & TF_Autoincrement)==0 );
}
if( db->mDbFlags & DBFLAG_Vacuum ){
sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
insFlags = OPFLAG_APPEND|OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT;
}else{
insFlags = OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND|OPFLAG_PREFORMAT;
}
#ifdef SQLITE_ENABLE_PREUPDATE_HOOK
if( db->xPreUpdateCallback ){
sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
insFlags &= ~OPFLAG_PREFORMAT;
}else
#endif
{
sqlite3VdbeAddOp3(v, OP_RowCell, iDest, iSrc, regRowid);
}
sqlite3VdbeAddOp4(v, OP_Insert, iDest, regData, regRowid,
(char*)pDest, P4_TABLE);
sqlite3VdbeChangeP5(v, insFlags);
sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1); VdbeCoverage(v);
sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
}else{
sqlite3TableLock(pParse, iDbDest, pDest->tnum, 1, pDest->zName);
sqlite3TableLock(pParse, iDbSrc, pSrc->tnum, 0, pSrc->zName);
}
|
| ︙ | ︙ | |||
123887 123888 123889 123890 123891 123892 123893 |
** a VACUUM command. In that case keys may not be written in strictly
** sorted order. */
for(i=0; i<pSrcIdx->nColumn; i++){
const char *zColl = pSrcIdx->azColl[i];
if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break;
}
if( i==pSrcIdx->nColumn ){
| | > > | > | 124481 124482 124483 124484 124485 124486 124487 124488 124489 124490 124491 124492 124493 124494 124495 124496 124497 124498 124499 124500 124501 124502 124503 124504 |
** a VACUUM command. In that case keys may not be written in strictly
** sorted order. */
for(i=0; i<pSrcIdx->nColumn; i++){
const char *zColl = pSrcIdx->azColl[i];
if( sqlite3_stricmp(sqlite3StrBINARY, zColl) ) break;
}
if( i==pSrcIdx->nColumn ){
idxInsFlags = OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT;
sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
sqlite3VdbeAddOp3(v, OP_RowCell, iDest, iSrc, regData);
}
}else if( !HasRowid(pSrc) && pDestIdx->idxType==SQLITE_IDXTYPE_PRIMARYKEY ){
idxInsFlags |= OPFLAG_NCHANGE;
}
if( idxInsFlags!=(OPFLAG_USESEEKRESULT|OPFLAG_PREFORMAT) ){
sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
}
sqlite3VdbeAddOp2(v, OP_IdxInsert, iDest, regData);
sqlite3VdbeChangeP5(v, idxInsFlags|OPFLAG_APPEND);
sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); VdbeCoverage(v);
sqlite3VdbeJumpHere(v, addr1);
sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
}
|
| ︙ | ︙ | |||
134007 134008 134009 134010 134011 134012 134013 | ** success. */ sqlite3AggInfoPersistWalkerInit(&w, pParse); sqlite3WalkSelect(&w,pSub1); sqlite3SelectDelete(db, pSub1); #if SELECTTRACE_ENABLED | | | 134604 134605 134606 134607 134608 134609 134610 134611 134612 134613 134614 134615 134616 134617 134618 |
** success.
*/
sqlite3AggInfoPersistWalkerInit(&w, pParse);
sqlite3WalkSelect(&w,pSub1);
sqlite3SelectDelete(db, pSub1);
#if SELECTTRACE_ENABLED
if( sqlite3SelectTrace & 0x100 ){
SELECTTRACE(0x100,pParse,p,("After flattening:\n"));
sqlite3TreeViewSelect(0, p, 0);
}
#endif
return 1;
}
|
| ︙ | ︙ | |||
135451 135452 135453 135454 135455 135456 135457 | Walker sWalker; memset(&sWalker, 0, sizeof(sWalker)); sWalker.pParse = pParse; sWalker.xExprCallback = havingToWhereExprCb; sWalker.u.pSelect = p; sqlite3WalkExpr(&sWalker, p->pHaving); #if SELECTTRACE_ENABLED | | | 136048 136049 136050 136051 136052 136053 136054 136055 136056 136057 136058 136059 136060 136061 136062 |
Walker sWalker;
memset(&sWalker, 0, sizeof(sWalker));
sWalker.pParse = pParse;
sWalker.xExprCallback = havingToWhereExprCb;
sWalker.u.pSelect = p;
sqlite3WalkExpr(&sWalker, p->pHaving);
#if SELECTTRACE_ENABLED
if( sWalker.eCode && (sqlite3SelectTrace & 0x100)!=0 ){
SELECTTRACE(0x100,pParse,p,("Move HAVING terms into WHERE:\n"));
sqlite3TreeViewSelect(0, p, 0);
}
#endif
}
/*
|
| ︙ | ︙ | |||
135573 135574 135575 135576 135577 135578 135579 |
}
pSub = pPrior;
}
p->pEList->a[0].pExpr = pExpr;
p->selFlags &= ~SF_Aggregate;
#if SELECTTRACE_ENABLED
| | | 136170 136171 136172 136173 136174 136175 136176 136177 136178 136179 136180 136181 136182 136183 136184 |
}
pSub = pPrior;
}
p->pEList->a[0].pExpr = pExpr;
p->selFlags &= ~SF_Aggregate;
#if SELECTTRACE_ENABLED
if( sqlite3SelectTrace & 0x400 ){
SELECTTRACE(0x400,pParse,p,("After count-of-view optimization:\n"));
sqlite3TreeViewSelect(0, p, 0);
}
#endif
return 1;
}
#endif /* SQLITE_COUNTOFVIEW_OPTIMIZATION */
|
| ︙ | ︙ | |||
135626 135627 135628 135629 135630 135631 135632 |
v = sqlite3GetVdbe(pParse);
if( p==0 || db->mallocFailed || pParse->nErr ){
return 1;
}
if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
#if SELECTTRACE_ENABLED
SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->addrExplain));
| | | 136223 136224 136225 136226 136227 136228 136229 136230 136231 136232 136233 136234 136235 136236 136237 |
v = sqlite3GetVdbe(pParse);
if( p==0 || db->mallocFailed || pParse->nErr ){
return 1;
}
if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
#if SELECTTRACE_ENABLED
SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->addrExplain));
if( sqlite3SelectTrace & 0x100 ){
sqlite3TreeViewSelect(0, p, 0);
}
#endif
assert( p->pOrderBy==0 || pDest->eDest!=SRT_DistFifo );
assert( p->pOrderBy==0 || pDest->eDest!=SRT_Fifo );
assert( p->pOrderBy==0 || pDest->eDest!=SRT_DistQueue );
|
| ︙ | ︙ | |||
135651 135652 135653 135654 135655 135656 135657 |
}
sqlite3SelectPrep(pParse, p, 0);
if( pParse->nErr || db->mallocFailed ){
goto select_end;
}
assert( p->pEList!=0 );
#if SELECTTRACE_ENABLED
| | | 136248 136249 136250 136251 136252 136253 136254 136255 136256 136257 136258 136259 136260 136261 136262 |
}
sqlite3SelectPrep(pParse, p, 0);
if( pParse->nErr || db->mallocFailed ){
goto select_end;
}
assert( p->pEList!=0 );
#if SELECTTRACE_ENABLED
if( sqlite3SelectTrace & 0x104 ){
SELECTTRACE(0x104,pParse,p, ("after name resolution:\n"));
sqlite3TreeViewSelect(0, p, 0);
}
#endif
/* If the SF_UpdateFrom flag is set, then this function is being called
** as part of populating the temp table for an UPDATE...FROM statement.
|
| ︙ | ︙ | |||
135686 135687 135688 135689 135690 135691 135692 |
#ifndef SQLITE_OMIT_WINDOWFUNC
rc = sqlite3WindowRewrite(pParse, p);
if( rc ){
assert( db->mallocFailed || pParse->nErr>0 );
goto select_end;
}
#if SELECTTRACE_ENABLED
| | | 136283 136284 136285 136286 136287 136288 136289 136290 136291 136292 136293 136294 136295 136296 136297 |
#ifndef SQLITE_OMIT_WINDOWFUNC
rc = sqlite3WindowRewrite(pParse, p);
if( rc ){
assert( db->mallocFailed || pParse->nErr>0 );
goto select_end;
}
#if SELECTTRACE_ENABLED
if( p->pWin && (sqlite3SelectTrace & 0x108)!=0 ){
SELECTTRACE(0x104,pParse,p, ("after window rewrite:\n"));
sqlite3TreeViewSelect(0, p, 0);
}
#endif
#endif /* SQLITE_OMIT_WINDOWFUNC */
pTabList = p->pSrc;
isAgg = (p->selFlags & SF_Aggregate)!=0;
|
| ︙ | ︙ | |||
135793 135794 135795 135796 135797 135798 135799 |
/* Handle compound SELECT statements using the separate multiSelect()
** procedure.
*/
if( p->pPrior ){
rc = multiSelect(pParse, p, pDest);
#if SELECTTRACE_ENABLED
SELECTTRACE(0x1,pParse,p,("end compound-select processing\n"));
| | | | 136390 136391 136392 136393 136394 136395 136396 136397 136398 136399 136400 136401 136402 136403 136404 136405 136406 136407 136408 136409 136410 136411 136412 136413 136414 136415 136416 136417 136418 136419 136420 136421 136422 136423 |
/* Handle compound SELECT statements using the separate multiSelect()
** procedure.
*/
if( p->pPrior ){
rc = multiSelect(pParse, p, pDest);
#if SELECTTRACE_ENABLED
SELECTTRACE(0x1,pParse,p,("end compound-select processing\n"));
if( (sqlite3SelectTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
sqlite3TreeViewSelect(0, p, 0);
}
#endif
if( p->pNext==0 ) ExplainQueryPlanPop(pParse);
return rc;
}
#endif
/* Do the WHERE-clause constant propagation optimization if this is
** a join. No need to speed time on this operation for non-join queries
** as the equivalent optimization will be handled by query planner in
** sqlite3WhereBegin().
*/
if( pTabList->nSrc>1
&& OptimizationEnabled(db, SQLITE_PropagateConst)
&& propagateConstants(pParse, p)
){
#if SELECTTRACE_ENABLED
if( sqlite3SelectTrace & 0x100 ){
SELECTTRACE(0x100,pParse,p,("After constant propagation:\n"));
sqlite3TreeViewSelect(0, p, 0);
}
#endif
}else{
SELECTTRACE(0x100,pParse,p,("Constant propagation not helpful\n"));
}
|
| ︙ | ︙ | |||
135900 135901 135902 135903 135904 135905 135906 |
** inside the subquery. This can help the subquery to run more efficiently.
*/
if( OptimizationEnabled(db, SQLITE_PushDown)
&& pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor,
(pItem->fg.jointype & JT_OUTER)!=0)
){
#if SELECTTRACE_ENABLED
| | | 136497 136498 136499 136500 136501 136502 136503 136504 136505 136506 136507 136508 136509 136510 136511 |
** inside the subquery. This can help the subquery to run more efficiently.
*/
if( OptimizationEnabled(db, SQLITE_PushDown)
&& pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor,
(pItem->fg.jointype & JT_OUTER)!=0)
){
#if SELECTTRACE_ENABLED
if( sqlite3SelectTrace & 0x100 ){
SELECTTRACE(0x100,pParse,p,
("After WHERE-clause push-down into subquery %d:\n", pSub->selId));
sqlite3TreeViewSelect(0, p, 0);
}
#endif
}else{
SELECTTRACE(0x100,pParse,p,("Push-down not possible\n"));
|
| ︙ | ︙ | |||
136000 136001 136002 136003 136004 136005 136006 | pEList = p->pEList; pWhere = p->pWhere; pGroupBy = p->pGroupBy; pHaving = p->pHaving; sDistinct.isTnct = (p->selFlags & SF_Distinct)!=0; #if SELECTTRACE_ENABLED | | | 136597 136598 136599 136600 136601 136602 136603 136604 136605 136606 136607 136608 136609 136610 136611 |
pEList = p->pEList;
pWhere = p->pWhere;
pGroupBy = p->pGroupBy;
pHaving = p->pHaving;
sDistinct.isTnct = (p->selFlags & SF_Distinct)!=0;
#if SELECTTRACE_ENABLED
if( sqlite3SelectTrace & 0x400 ){
SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n"));
sqlite3TreeViewSelect(0, p, 0);
}
#endif
/* If the query is DISTINCT with an ORDER BY but is not an aggregate, and
** if the select-list is the same as the ORDER BY list, then this query
|
| ︙ | ︙ | |||
136036 136037 136038 136039 136040 136041 136042 |
p->selFlags |= SF_Aggregate;
/* Notice that even thought SF_Distinct has been cleared from p->selFlags,
** the sDistinct.isTnct is still set. Hence, isTnct represents the
** original setting of the SF_Distinct flag, not the current setting */
assert( sDistinct.isTnct );
#if SELECTTRACE_ENABLED
| | | 136633 136634 136635 136636 136637 136638 136639 136640 136641 136642 136643 136644 136645 136646 136647 |
p->selFlags |= SF_Aggregate;
/* Notice that even thought SF_Distinct has been cleared from p->selFlags,
** the sDistinct.isTnct is still set. Hence, isTnct represents the
** original setting of the SF_Distinct flag, not the current setting */
assert( sDistinct.isTnct );
#if SELECTTRACE_ENABLED
if( sqlite3SelectTrace & 0x400 ){
SELECTTRACE(0x400,pParse,p,("Transform DISTINCT into GROUP BY:\n"));
sqlite3TreeViewSelect(0, p, 0);
}
#endif
}
/* If there is an ORDER BY clause, then create an ephemeral index to
|
| ︙ | ︙ | |||
136284 136285 136286 136287 136288 136289 136290 |
}
#endif
sNC.ncFlags &= ~NC_InAggFunc;
}
pAggInfo->mxReg = pParse->nMem;
if( db->mallocFailed ) goto select_end;
#if SELECTTRACE_ENABLED
| | | 136881 136882 136883 136884 136885 136886 136887 136888 136889 136890 136891 136892 136893 136894 136895 |
}
#endif
sNC.ncFlags &= ~NC_InAggFunc;
}
pAggInfo->mxReg = pParse->nMem;
if( db->mallocFailed ) goto select_end;
#if SELECTTRACE_ENABLED
if( sqlite3SelectTrace & 0x400 ){
int ii;
SELECTTRACE(0x400,pParse,p,("After aggregate analysis %p:\n", pAggInfo));
sqlite3TreeViewSelect(0, p, 0);
for(ii=0; ii<pAggInfo->nColumn; ii++){
sqlite3DebugPrintf("agg-column[%d] iMem=%d\n",
ii, pAggInfo->aCol[ii].iMem);
sqlite3TreeViewExpr(0, pAggInfo->aCol[ii].pCExpr, 0);
|
| ︙ | ︙ | |||
136703 136704 136705 136706 136707 136708 136709 |
assert( pExpr->iAgg==i );
}
}
#endif
#if SELECTTRACE_ENABLED
SELECTTRACE(0x1,pParse,p,("end processing\n"));
| | | 137300 137301 137302 137303 137304 137305 137306 137307 137308 137309 137310 137311 137312 137313 137314 |
assert( pExpr->iAgg==i );
}
}
#endif
#if SELECTTRACE_ENABLED
SELECTTRACE(0x1,pParse,p,("end processing\n"));
if( (sqlite3SelectTrace & 0x2000)!=0 && ExplainQueryPlanParent(pParse)==0 ){
sqlite3TreeViewSelect(0, p, 0);
}
#endif
ExplainQueryPlanPop(pParse);
return rc;
}
|
| ︙ | ︙ | |||
139474 139475 139476 139477 139478 139479 139480 | */ /* #include "sqliteInt.h" */ #ifndef SQLITE_OMIT_UPSERT /* ** Free a list of Upsert objects */ | | > | > > > | > > > | > | > | > > | | 140071 140072 140073 140074 140075 140076 140077 140078 140079 140080 140081 140082 140083 140084 140085 140086 140087 140088 140089 140090 140091 140092 140093 140094 140095 140096 140097 140098 140099 140100 140101 140102 140103 140104 140105 140106 140107 140108 140109 140110 140111 140112 140113 140114 140115 140116 140117 140118 140119 140120 140121 140122 140123 140124 140125 140126 140127 140128 140129 140130 140131 140132 140133 140134 140135 140136 140137 140138 140139 140140 140141 140142 |
*/
/* #include "sqliteInt.h" */
#ifndef SQLITE_OMIT_UPSERT
/*
** Free a list of Upsert objects
*/
static void SQLITE_NOINLINE upsertDelete(sqlite3 *db, Upsert *p){
do{
Upsert *pNext = p->pNextUpsert;
sqlite3ExprListDelete(db, p->pUpsertTarget);
sqlite3ExprDelete(db, p->pUpsertTargetWhere);
sqlite3ExprListDelete(db, p->pUpsertSet);
sqlite3ExprDelete(db, p->pUpsertWhere);
sqlite3DbFree(db, p->pToFree);
sqlite3DbFree(db, p);
p = pNext;
}while( p );
}
SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3 *db, Upsert *p){
if( p ) upsertDelete(db, p);
}
/*
** Duplicate an Upsert object.
*/
SQLITE_PRIVATE Upsert *sqlite3UpsertDup(sqlite3 *db, Upsert *p){
if( p==0 ) return 0;
return sqlite3UpsertNew(db,
sqlite3ExprListDup(db, p->pUpsertTarget, 0),
sqlite3ExprDup(db, p->pUpsertTargetWhere, 0),
sqlite3ExprListDup(db, p->pUpsertSet, 0),
sqlite3ExprDup(db, p->pUpsertWhere, 0),
sqlite3UpsertDup(db, p->pNextUpsert)
);
}
/*
** Create a new Upsert object.
*/
SQLITE_PRIVATE Upsert *sqlite3UpsertNew(
sqlite3 *db, /* Determines which memory allocator to use */
ExprList *pTarget, /* Target argument to ON CONFLICT, or NULL */
Expr *pTargetWhere, /* Optional WHERE clause on the target */
ExprList *pSet, /* UPDATE columns, or NULL for a DO NOTHING */
Expr *pWhere, /* WHERE clause for the ON CONFLICT UPDATE */
Upsert *pNext /* Next ON CONFLICT clause in the list */
){
Upsert *pNew;
pNew = sqlite3DbMallocZero(db, sizeof(Upsert));
if( pNew==0 ){
sqlite3ExprListDelete(db, pTarget);
sqlite3ExprDelete(db, pTargetWhere);
sqlite3ExprListDelete(db, pSet);
sqlite3ExprDelete(db, pWhere);
sqlite3UpsertDelete(db, pNext);
return 0;
}else{
pNew->pUpsertTarget = pTarget;
pNew->pUpsertTargetWhere = pTargetWhere;
pNew->pUpsertSet = pSet;
pNew->pUpsertWhere = pWhere;
pNew->isDoUpdate = pSet!=0;
pNew->pNextUpsert = pNext;
}
return pNew;
}
/*
** Analyze the ON CONFLICT clause described by pUpsert. Resolve all
** symbols in the conflict-target.
|
| ︙ | ︙ | |||
139545 139546 139547 139548 139549 139550 139551 139552 139553 139554 139555 139556 139557 139558 139559 139560 139561 139562 139563 139564 | int rc; /* Result code */ int iCursor; /* Cursor used by pTab */ Index *pIdx; /* One of the indexes of pTab */ ExprList *pTarget; /* The conflict-target clause */ Expr *pTerm; /* One term of the conflict-target clause */ NameContext sNC; /* Context for resolving symbolic names */ Expr sCol[2]; /* Index column converted into an Expr */ assert( pTabList->nSrc==1 ); assert( pTabList->a[0].pTab!=0 ); assert( pUpsert!=0 ); assert( pUpsert->pUpsertTarget!=0 ); /* Resolve all symbolic names in the conflict-target clause, which ** includes both the list of columns and the optional partial-index ** WHERE clause. */ memset(&sNC, 0, sizeof(sNC)); sNC.pParse = pParse; sNC.pSrcList = pTabList; | > > > | | | | | | | | | | | | | | | < > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 140153 140154 140155 140156 140157 140158 140159 140160 140161 140162 140163 140164 140165 140166 140167 140168 140169 140170 140171 140172 140173 140174 140175 140176 140177 140178 140179 140180 140181 140182 140183 140184 140185 140186 140187 140188 140189 140190 140191 140192 140193 140194 140195 140196 140197 140198 140199 140200 140201 140202 140203 140204 140205 140206 140207 140208 140209 140210 140211 140212 140213 140214 140215 140216 140217 140218 140219 140220 140221 140222 140223 140224 140225 140226 140227 140228 140229 140230 140231 140232 140233 140234 140235 140236 140237 140238 140239 140240 140241 140242 140243 140244 140245 140246 140247 140248 140249 140250 140251 140252 140253 140254 140255 140256 140257 140258 140259 140260 140261 140262 140263 140264 140265 140266 140267 140268 140269 140270 140271 140272 140273 140274 140275 140276 140277 140278 140279 140280 140281 140282 140283 140284 140285 140286 140287 140288 140289 140290 140291 140292 140293 140294 140295 140296 140297 140298 140299 140300 140301 140302 140303 140304 140305 |
int rc; /* Result code */
int iCursor; /* Cursor used by pTab */
Index *pIdx; /* One of the indexes of pTab */
ExprList *pTarget; /* The conflict-target clause */
Expr *pTerm; /* One term of the conflict-target clause */
NameContext sNC; /* Context for resolving symbolic names */
Expr sCol[2]; /* Index column converted into an Expr */
int nClause = 0; /* Counter of ON CONFLICT clauses */
assert( pTabList->nSrc==1 );
assert( pTabList->a[0].pTab!=0 );
assert( pUpsert!=0 );
assert( pUpsert->pUpsertTarget!=0 );
/* Resolve all symbolic names in the conflict-target clause, which
** includes both the list of columns and the optional partial-index
** WHERE clause.
*/
memset(&sNC, 0, sizeof(sNC));
sNC.pParse = pParse;
sNC.pSrcList = pTabList;
for(; pUpsert && pUpsert->pUpsertTarget;
pUpsert=pUpsert->pNextUpsert, nClause++){
rc = sqlite3ResolveExprListNames(&sNC, pUpsert->pUpsertTarget);
if( rc ) return rc;
rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertTargetWhere);
if( rc ) return rc;
/* Check to see if the conflict target matches the rowid. */
pTab = pTabList->a[0].pTab;
pTarget = pUpsert->pUpsertTarget;
iCursor = pTabList->a[0].iCursor;
if( HasRowid(pTab)
&& pTarget->nExpr==1
&& (pTerm = pTarget->a[0].pExpr)->op==TK_COLUMN
&& pTerm->iColumn==XN_ROWID
){
/* The conflict-target is the rowid of the primary table */
assert( pUpsert->pUpsertIdx==0 );
continue;
}
/* Initialize sCol[0..1] to be an expression parse tree for a
** single column of an index. The sCol[0] node will be the TK_COLLATE
** operator and sCol[1] will be the TK_COLUMN operator. Code below
** will populate the specific collation and column number values
** prior to comparing against the conflict-target expression.
*/
memset(sCol, 0, sizeof(sCol));
sCol[0].op = TK_COLLATE;
sCol[0].pLeft = &sCol[1];
sCol[1].op = TK_COLUMN;
sCol[1].iTable = pTabList->a[0].iCursor;
/* Check for matches against other indexes */
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
int ii, jj, nn;
if( !IsUniqueIndex(pIdx) ) continue;
if( pTarget->nExpr!=pIdx->nKeyCol ) continue;
if( pIdx->pPartIdxWhere ){
if( pUpsert->pUpsertTargetWhere==0 ) continue;
if( sqlite3ExprCompare(pParse, pUpsert->pUpsertTargetWhere,
pIdx->pPartIdxWhere, iCursor)!=0 ){
continue;
}
}
nn = pIdx->nKeyCol;
for(ii=0; ii<nn; ii++){
Expr *pExpr;
sCol[0].u.zToken = (char*)pIdx->azColl[ii];
if( pIdx->aiColumn[ii]==XN_EXPR ){
assert( pIdx->aColExpr!=0 );
assert( pIdx->aColExpr->nExpr>ii );
pExpr = pIdx->aColExpr->a[ii].pExpr;
if( pExpr->op!=TK_COLLATE ){
sCol[0].pLeft = pExpr;
pExpr = &sCol[0];
}
}else{
sCol[0].pLeft = &sCol[1];
sCol[1].iColumn = pIdx->aiColumn[ii];
pExpr = &sCol[0];
}
for(jj=0; jj<nn; jj++){
if( sqlite3ExprCompare(pParse,pTarget->a[jj].pExpr,pExpr,iCursor)<2 ){
break; /* Column ii of the index matches column jj of target */
}
}
if( jj>=nn ){
/* The target contains no match for column jj of the index */
break;
}
}
if( ii<nn ){
/* Column ii of the index did not match any term of the conflict target.
** Continue the search with the next index. */
continue;
}
pUpsert->pUpsertIdx = pIdx;
break;
}
if( pUpsert->pUpsertIdx==0 ){
char zWhich[16];
if( nClause==0 && pUpsert->pNextUpsert==0 ){
zWhich[0] = 0;
}else{
sqlite3_snprintf(sizeof(zWhich),zWhich,"%r ", nClause+1);
}
sqlite3ErrorMsg(pParse, "%sON CONFLICT clause does not match any "
"PRIMARY KEY or UNIQUE constraint", zWhich);
return SQLITE_ERROR;
}
}
return SQLITE_OK;
}
/*
** Return true if pUpsert is the last ON CONFLICT clause with a
** conflict target, or if pUpsert is followed by another ON CONFLICT
** clause that targets the INTEGER PRIMARY KEY.
*/
SQLITE_PRIVATE int sqlite3UpsertNextIsIPK(Upsert *pUpsert){
Upsert *pNext;
if( NEVER(pUpsert==0) ) return 0;
pNext = pUpsert->pNextUpsert;
if( pNext==0 ) return 1;
if( pNext->pUpsertTarget==0 ) return 1;
if( pNext->pUpsertIdx==0 ) return 1;
return 0;
}
/*
** Given the list of ON CONFLICT clauses described by pUpsert, and
** a particular index pIdx, return a pointer to the particular ON CONFLICT
** clause that applies to the index. Or, if the index is not subject to
** any ON CONFLICT clause, return NULL.
*/
SQLITE_PRIVATE Upsert *sqlite3UpsertOfIndex(Upsert *pUpsert, Index *pIdx){
while(
pUpsert
&& pUpsert->pUpsertTarget!=0
&& pUpsert->pUpsertIdx!=pIdx
){
pUpsert = pUpsert->pNextUpsert;
}
return pUpsert;
}
/*
** Generate bytecode that does an UPDATE as part of an upsert.
**
** If pIdx is NULL, then the UNIQUE constraint that failed was the IPK.
** In this case parameter iCur is a cursor open on the table b-tree that
|
| ︙ | ︙ | |||
139662 139663 139664 139665 139666 139667 139668 139669 139670 139671 |
int iCur /* Cursor for pIdx (or pTab if pIdx==NULL) */
){
Vdbe *v = pParse->pVdbe;
sqlite3 *db = pParse->db;
SrcList *pSrc; /* FROM clause for the UPDATE */
int iDataCur;
int i;
assert( v!=0 );
assert( pUpsert!=0 );
| > < > > | 140315 140316 140317 140318 140319 140320 140321 140322 140323 140324 140325 140326 140327 140328 140329 140330 140331 140332 140333 140334 140335 |
int iCur /* Cursor for pIdx (or pTab if pIdx==NULL) */
){
Vdbe *v = pParse->pVdbe;
sqlite3 *db = pParse->db;
SrcList *pSrc; /* FROM clause for the UPDATE */
int iDataCur;
int i;
Upsert *pTop = pUpsert;
assert( v!=0 );
assert( pUpsert!=0 );
iDataCur = pUpsert->iDataCur;
pUpsert = sqlite3UpsertOfIndex(pTop, pIdx);
VdbeNoopComment((v, "Begin DO UPDATE of UPSERT"));
if( pIdx && iCur!=iDataCur ){
if( HasRowid(pTab) ){
int regRowid = sqlite3GetTempReg(pParse);
sqlite3VdbeAddOp2(v, OP_IdxRowid, iCur, regRowid);
sqlite3VdbeAddOp3(v, OP_SeekRowid, iDataCur, 0, regRowid);
VdbeCoverage(v);
sqlite3ReleaseTempReg(pParse, regRowid);
|
| ︙ | ︙ | |||
139696 139697 139698 139699 139700 139701 139702 |
VdbeCoverage(v);
sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0,
"corrupt database", P4_STATIC);
sqlite3MayAbort(pParse);
sqlite3VdbeJumpHere(v, i);
}
}
| | | | | | | < < | 140351 140352 140353 140354 140355 140356 140357 140358 140359 140360 140361 140362 140363 140364 140365 140366 140367 140368 140369 140370 140371 140372 140373 140374 140375 |
VdbeCoverage(v);
sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0,
"corrupt database", P4_STATIC);
sqlite3MayAbort(pParse);
sqlite3VdbeJumpHere(v, i);
}
}
/* pUpsert does not own pTop->pUpsertSrc - the outer INSERT statement does.
** So we have to make a copy before passing it down into sqlite3Update() */
pSrc = sqlite3SrcListDup(db, pTop->pUpsertSrc, 0);
/* excluded.* columns of type REAL need to be converted to a hard real */
for(i=0; i<pTab->nCol; i++){
if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){
sqlite3VdbeAddOp1(v, OP_RealAffinity, pTop->regData+i);
}
}
sqlite3Update(pParse, pSrc, sqlite3ExprListDup(db,pUpsert->pUpsertSet,0),
sqlite3ExprDup(db,pUpsert->pUpsertWhere,0), OE_Abort, 0, 0, pUpsert);
VdbeNoopComment((v, "End DO UPDATE of UPSERT"));
}
#endif /* SQLITE_OMIT_UPSERT */
/************** End of upsert.c **********************************************/
/************** Begin file vacuum.c ******************************************/
|
| ︙ | ︙ | |||
141485 141486 141487 141488 141489 141490 141491 | ** This file contains structure and macro definitions for the query ** planner logic in "where.c". These definitions are broken out into ** a separate source file for easier editing. */ #ifndef SQLITE_WHEREINT_H #define SQLITE_WHEREINT_H | < < < < < < < < < < < < < | 142138 142139 142140 142141 142142 142143 142144 142145 142146 142147 142148 142149 142150 142151 | ** This file contains structure and macro definitions for the query ** planner logic in "where.c". These definitions are broken out into ** a separate source file for easier editing. */ #ifndef SQLITE_WHEREINT_H #define SQLITE_WHEREINT_H /* Forward references */ typedef struct WhereClause WhereClause; typedef struct WhereMaskSet WhereMaskSet; typedef struct WhereOrInfo WhereOrInfo; typedef struct WhereAndInfo WhereAndInfo; |
| ︙ | ︙ | |||
146217 146218 146219 146220 146221 146222 146223 |
struct HiddenIndexInfo {
WhereClause *pWC; /* The Where clause being analyzed */
Parse *pParse; /* The parsing context */
};
/* Forward declaration of methods */
static int whereLoopResize(sqlite3*, WhereLoop*, int);
| < < < < < < | 146857 146858 146859 146860 146861 146862 146863 146864 146865 146866 146867 146868 146869 146870 |
struct HiddenIndexInfo {
WhereClause *pWC; /* The Where clause being analyzed */
Parse *pParse; /* The parsing context */
};
/* Forward declaration of methods */
static int whereLoopResize(sqlite3*, WhereLoop*, int);
/*
** Return the estimated number of output rows from a WHERE clause
*/
SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo *pWInfo){
return pWInfo->nRowOut;
}
|
| ︙ | ︙ | |||
155317 155318 155319 155320 155321 155322 155323 | #define sqlite3ParserARG_STORE #define sqlite3ParserCTX_SDECL Parse *pParse; #define sqlite3ParserCTX_PDECL ,Parse *pParse #define sqlite3ParserCTX_PARAM ,pParse #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; #define YYFALLBACK 1 | | | | | | | | | | | | | 155951 155952 155953 155954 155955 155956 155957 155958 155959 155960 155961 155962 155963 155964 155965 155966 155967 155968 155969 155970 155971 155972 155973 155974 155975 155976 | #define sqlite3ParserARG_STORE #define sqlite3ParserCTX_SDECL Parse *pParse; #define sqlite3ParserCTX_PDECL ,Parse *pParse #define sqlite3ParserCTX_PARAM ,pParse #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; #define YYFALLBACK 1 #define YYNSTATE 558 #define YYNRULE 386 #define YYNRULE_WITH_ACTION 326 #define YYNTOKEN 181 #define YY_MAX_SHIFT 557 #define YY_MIN_SHIFTREDUCE 809 #define YY_MAX_SHIFTREDUCE 1194 #define YY_ERROR_ACTION 1195 #define YY_ACCEPT_ACTION 1196 #define YY_NO_ACTION 1197 #define YY_MIN_REDUCE 1198 #define YY_MAX_REDUCE 1583 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) /* Define the yytestcase() macro to be a no-op if is not already defined ** otherwise. ** ** Applications can choose to define yytestcase() in the %include section |
| ︙ | ︙ | |||
155395 155396 155397 155398 155399 155400 155401 | ** yy_shift_ofst[] For each state, the offset into yy_action for ** shifting terminals. ** yy_reduce_ofst[] For each state, the offset into yy_action for ** shifting non-terminals after a reduce. ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 156029 156030 156031 156032 156033 156034 156035 156036 156037 156038 156039 156040 156041 156042 156043 156044 156045 156046 156047 156048 156049 156050 156051 156052 156053 156054 156055 156056 156057 156058 156059 156060 156061 156062 156063 156064 156065 156066 156067 156068 156069 156070 156071 156072 156073 156074 156075 156076 156077 156078 156079 156080 156081 156082 156083 156084 156085 156086 156087 156088 156089 156090 156091 156092 156093 156094 156095 156096 156097 156098 156099 156100 156101 156102 156103 156104 156105 156106 156107 156108 156109 156110 156111 156112 156113 156114 156115 156116 156117 156118 156119 156120 156121 156122 156123 156124 156125 156126 156127 156128 156129 156130 156131 156132 156133 156134 156135 156136 156137 156138 156139 156140 156141 156142 156143 156144 156145 156146 156147 156148 156149 156150 156151 156152 156153 156154 156155 156156 156157 156158 156159 156160 156161 156162 156163 156164 156165 156166 156167 156168 156169 156170 156171 156172 156173 156174 156175 156176 156177 156178 156179 156180 156181 156182 156183 156184 156185 156186 156187 156188 156189 156190 156191 156192 156193 156194 156195 156196 156197 156198 156199 156200 156201 156202 156203 156204 156205 156206 156207 156208 156209 156210 156211 156212 156213 156214 156215 156216 156217 156218 156219 156220 156221 156222 156223 156224 156225 156226 156227 156228 156229 156230 156231 156232 156233 156234 156235 156236 156237 156238 156239 156240 156241 |
** yy_shift_ofst[] For each state, the offset into yy_action for
** shifting terminals.
** yy_reduce_ofst[] For each state, the offset into yy_action for
** shifting non-terminals after a reduce.
** yy_default[] Default action for each state.
**
*********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (1968)
static const YYACTIONTYPE yy_action[] = {
/* 0 */ 551, 1229, 551, 456, 1267, 551, 1246, 551, 114, 111,
/* 10 */ 212, 551, 1545, 551, 1267, 528, 114, 111, 212, 396,
/* 20 */ 1239, 348, 42, 42, 42, 42, 1232, 42, 42, 71,
/* 30 */ 71, 943, 1231, 71, 71, 71, 71, 1470, 1501, 944,
/* 40 */ 826, 458, 6, 121, 122, 112, 1172, 1172, 1013, 1016,
/* 50 */ 1006, 1006, 119, 119, 120, 120, 120, 120, 1551, 396,
/* 60 */ 1366, 1525, 557, 2, 1200, 195, 533, 441, 143, 293,
/* 70 */ 533, 136, 533, 375, 262, 509, 273, 389, 1280, 532,
/* 80 */ 508, 498, 165, 121, 122, 112, 1172, 1172, 1013, 1016,
/* 90 */ 1006, 1006, 119, 119, 120, 120, 120, 120, 1366, 447,
/* 100 */ 1522, 118, 118, 118, 118, 117, 117, 116, 116, 116,
/* 110 */ 115, 429, 267, 267, 267, 267, 1506, 362, 1508, 440,
/* 120 */ 361, 1506, 522, 529, 1493, 548, 1121, 548, 1121, 396,
/* 130 */ 410, 242, 209, 114, 111, 212, 98, 292, 542, 222,
/* 140 */ 1036, 118, 118, 118, 118, 117, 117, 116, 116, 116,
/* 150 */ 115, 429, 1149, 121, 122, 112, 1172, 1172, 1013, 1016,
/* 160 */ 1006, 1006, 119, 119, 120, 120, 120, 120, 411, 433,
/* 170 */ 117, 117, 116, 116, 116, 115, 429, 1426, 473, 123,
/* 180 */ 118, 118, 118, 118, 117, 117, 116, 116, 116, 115,
/* 190 */ 429, 116, 116, 116, 115, 429, 545, 545, 545, 396,
/* 200 */ 510, 120, 120, 120, 120, 113, 1058, 1149, 1150, 1151,
/* 210 */ 1058, 118, 118, 118, 118, 117, 117, 116, 116, 116,
/* 220 */ 115, 429, 1469, 121, 122, 112, 1172, 1172, 1013, 1016,
/* 230 */ 1006, 1006, 119, 119, 120, 120, 120, 120, 396, 449,
/* 240 */ 320, 83, 468, 81, 363, 386, 1149, 80, 118, 118,
/* 250 */ 118, 118, 117, 117, 116, 116, 116, 115, 429, 180,
/* 260 */ 439, 429, 121, 122, 112, 1172, 1172, 1013, 1016, 1006,
/* 270 */ 1006, 119, 119, 120, 120, 120, 120, 439, 438, 267,
/* 280 */ 267, 118, 118, 118, 118, 117, 117, 116, 116, 116,
/* 290 */ 115, 429, 548, 1116, 909, 511, 1149, 114, 111, 212,
/* 300 */ 1439, 1149, 1150, 1151, 207, 496, 1116, 396, 454, 1116,
/* 310 */ 550, 334, 120, 120, 120, 120, 300, 1439, 1441, 17,
/* 320 */ 118, 118, 118, 118, 117, 117, 116, 116, 116, 115,
/* 330 */ 429, 121, 122, 112, 1172, 1172, 1013, 1016, 1006, 1006,
/* 340 */ 119, 119, 120, 120, 120, 120, 396, 1366, 439, 1149,
/* 350 */ 487, 1149, 1150, 1151, 1003, 1003, 1014, 1017, 406, 118,
/* 360 */ 118, 118, 118, 117, 117, 116, 116, 116, 115, 429,
/* 370 */ 121, 122, 112, 1172, 1172, 1013, 1016, 1006, 1006, 119,
/* 380 */ 119, 120, 120, 120, 120, 1061, 1061, 470, 1439, 118,
/* 390 */ 118, 118, 118, 117, 117, 116, 116, 116, 115, 429,
/* 400 */ 1149, 456, 551, 1434, 1149, 1150, 1151, 234, 973, 1149,
/* 410 */ 486, 483, 482, 172, 364, 396, 165, 412, 419, 848,
/* 420 */ 481, 165, 186, 338, 71, 71, 1250, 1007, 118, 118,
/* 430 */ 118, 118, 117, 117, 116, 116, 116, 115, 429, 121,
/* 440 */ 122, 112, 1172, 1172, 1013, 1016, 1006, 1006, 119, 119,
/* 450 */ 120, 120, 120, 120, 396, 1149, 1150, 1151, 841, 12,
/* 460 */ 318, 514, 164, 360, 1149, 1150, 1151, 114, 111, 212,
/* 470 */ 513, 292, 542, 551, 277, 181, 292, 542, 121, 122,
/* 480 */ 112, 1172, 1172, 1013, 1016, 1006, 1006, 119, 119, 120,
/* 490 */ 120, 120, 120, 349, 489, 71, 71, 118, 118, 118,
/* 500 */ 118, 117, 117, 116, 116, 116, 115, 429, 1149, 210,
/* 510 */ 416, 528, 1149, 1116, 1579, 382, 253, 270, 346, 492,
/* 520 */ 341, 491, 239, 396, 518, 368, 1116, 1134, 337, 1116,
/* 530 */ 192, 414, 288, 32, 462, 448, 118, 118, 118, 118,
/* 540 */ 117, 117, 116, 116, 116, 115, 429, 121, 122, 112,
/* 550 */ 1172, 1172, 1013, 1016, 1006, 1006, 119, 119, 120, 120,
/* 560 */ 120, 120, 396, 1149, 1150, 1151, 994, 1149, 1150, 1151,
/* 570 */ 1149, 234, 497, 1500, 486, 483, 482, 6, 164, 551,
/* 580 */ 517, 551, 115, 429, 481, 5, 121, 122, 112, 1172,
/* 590 */ 1172, 1013, 1016, 1006, 1006, 119, 119, 120, 120, 120,
/* 600 */ 120, 13, 13, 13, 13, 118, 118, 118, 118, 117,
/* 610 */ 117, 116, 116, 116, 115, 429, 408, 507, 413, 551,
/* 620 */ 1494, 549, 1149, 898, 898, 1149, 1150, 1151, 1481, 1149,
/* 630 */ 276, 396, 814, 815, 816, 978, 427, 427, 427, 16,
/* 640 */ 16, 55, 55, 1249, 118, 118, 118, 118, 117, 117,
/* 650 */ 116, 116, 116, 115, 429, 121, 122, 112, 1172, 1172,
/* 660 */ 1013, 1016, 1006, 1006, 119, 119, 120, 120, 120, 120,
/* 670 */ 396, 1196, 1, 1, 557, 2, 1200, 1149, 1150, 1151,
/* 680 */ 195, 293, 904, 136, 1149, 1150, 1151, 903, 526, 1500,
/* 690 */ 1280, 3, 384, 6, 121, 122, 112, 1172, 1172, 1013,
/* 700 */ 1016, 1006, 1006, 119, 119, 120, 120, 120, 120, 864,
/* 710 */ 551, 930, 551, 118, 118, 118, 118, 117, 117, 116,
/* 720 */ 116, 116, 115, 429, 267, 267, 1099, 1577, 1149, 556,
/* 730 */ 1577, 1200, 13, 13, 13, 13, 293, 548, 136, 396,
/* 740 */ 490, 426, 425, 973, 348, 1280, 473, 415, 865, 281,
/* 750 */ 140, 222, 118, 118, 118, 118, 117, 117, 116, 116,
/* 760 */ 116, 115, 429, 121, 122, 112, 1172, 1172, 1013, 1016,
/* 770 */ 1006, 1006, 119, 119, 120, 120, 120, 120, 551, 267,
/* 780 */ 267, 433, 396, 1149, 1150, 1151, 1179, 836, 1179, 473,
/* 790 */ 436, 145, 548, 1153, 405, 318, 444, 304, 844, 1498,
/* 800 */ 71, 71, 417, 6, 1097, 478, 222, 100, 112, 1172,
/* 810 */ 1172, 1013, 1016, 1006, 1006, 119, 119, 120, 120, 120,
/* 820 */ 120, 118, 118, 118, 118, 117, 117, 116, 116, 116,
/* 830 */ 115, 429, 238, 1433, 551, 456, 433, 289, 993, 551,
/* 840 */ 237, 236, 235, 836, 97, 534, 434, 1272, 1272, 1153,
/* 850 */ 499, 309, 435, 844, 984, 551, 71, 71, 983, 1248,
/* 860 */ 551, 51, 51, 302, 118, 118, 118, 118, 117, 117,
/* 870 */ 116, 116, 116, 115, 429, 195, 103, 70, 70, 267,
/* 880 */ 267, 551, 71, 71, 267, 267, 30, 395, 348, 983,
/* 890 */ 983, 985, 548, 533, 1116, 332, 396, 548, 500, 401,
/* 900 */ 460, 196, 535, 13, 13, 1366, 241, 1116, 278, 282,
/* 910 */ 1116, 282, 306, 462, 308, 337, 396, 31, 189, 424,
/* 920 */ 121, 122, 112, 1172, 1172, 1013, 1016, 1006, 1006, 119,
/* 930 */ 119, 120, 120, 120, 120, 142, 396, 369, 456, 993,
/* 940 */ 121, 122, 112, 1172, 1172, 1013, 1016, 1006, 1006, 119,
/* 950 */ 119, 120, 120, 120, 120, 984, 327, 1149, 330, 983,
/* 960 */ 121, 110, 112, 1172, 1172, 1013, 1016, 1006, 1006, 119,
/* 970 */ 119, 120, 120, 120, 120, 469, 381, 1192, 118, 118,
/* 980 */ 118, 118, 117, 117, 116, 116, 116, 115, 429, 1149,
/* 990 */ 983, 983, 985, 307, 9, 461, 245, 462, 118, 118,
/* 1000 */ 118, 118, 117, 117, 116, 116, 116, 115, 429, 317,
/* 1010 */ 551, 279, 1149, 1150, 1151, 301, 292, 542, 118, 118,
/* 1020 */ 118, 118, 117, 117, 116, 116, 116, 115, 429, 1270,
/* 1030 */ 1270, 1170, 13, 13, 531, 426, 425, 473, 396, 929,
/* 1040 */ 261, 261, 97, 1176, 1149, 1150, 1151, 190, 1178, 267,
/* 1050 */ 267, 473, 138, 548, 1193, 551, 1177, 264, 348, 494,
/* 1060 */ 928, 551, 548, 122, 112, 1172, 1172, 1013, 1016, 1006,
/* 1070 */ 1006, 119, 119, 120, 120, 120, 120, 71, 71, 1149,
/* 1080 */ 1179, 1279, 1179, 13, 13, 904, 1077, 1170, 551, 473,
/* 1090 */ 903, 107, 543, 280, 4, 1275, 1116, 450, 530, 1056,
/* 1100 */ 12, 1078, 1099, 1578, 316, 144, 1578, 525, 546, 1116,
/* 1110 */ 56, 56, 1116, 1499, 428, 1366, 1079, 6, 349, 970,
/* 1120 */ 118, 118, 118, 118, 117, 117, 116, 116, 116, 115,
/* 1130 */ 429, 430, 1278, 325, 1149, 1150, 1151, 884, 267, 267,
/* 1140 */ 855, 107, 543, 540, 4, 1497, 238, 885, 1218, 6,
/* 1150 */ 211, 548, 370, 165, 366, 501, 421, 1496, 546, 268,
/* 1160 */ 268, 6, 1550, 516, 504, 873, 267, 267, 400, 536,
/* 1170 */ 8, 993, 548, 524, 551, 928, 463, 105, 105, 548,
/* 1180 */ 1097, 430, 267, 267, 106, 422, 430, 553, 552, 267,
/* 1190 */ 267, 983, 523, 540, 1381, 548, 15, 15, 267, 267,
/* 1200 */ 1478, 1127, 548, 267, 267, 1077, 1380, 520, 292, 542,
/* 1210 */ 551, 548, 519, 401, 449, 320, 548, 551, 928, 125,
/* 1220 */ 1078, 993, 983, 983, 985, 986, 27, 105, 105, 405,
/* 1230 */ 347, 1519, 44, 44, 106, 1079, 430, 553, 552, 57,
/* 1240 */ 57, 983, 347, 1519, 107, 543, 551, 4, 467, 405,
/* 1250 */ 215, 1127, 464, 295, 381, 1098, 539, 296, 551, 1221,
/* 1260 */ 402, 546, 544, 402, 299, 245, 292, 542, 58, 58,
/* 1270 */ 551, 1284, 983, 983, 985, 986, 27, 1524, 1138, 432,
/* 1280 */ 59, 59, 271, 548, 430, 403, 166, 379, 379, 378,
/* 1290 */ 256, 376, 60, 60, 823, 1187, 540, 551, 274, 551,
/* 1300 */ 1170, 851, 393, 392, 551, 205, 551, 216, 211, 298,
/* 1310 */ 520, 1303, 551, 266, 209, 521, 1316, 297, 275, 61,
/* 1320 */ 61, 62, 62, 451, 993, 205, 45, 45, 46, 46,
/* 1330 */ 105, 105, 1193, 928, 47, 47, 291, 106, 551, 430,
/* 1340 */ 553, 552, 943, 551, 983, 313, 394, 218, 551, 109,
/* 1350 */ 944, 107, 543, 219, 4, 156, 1170, 851, 158, 551,
/* 1360 */ 49, 49, 104, 551, 102, 50, 50, 551, 546, 1315,
/* 1370 */ 63, 63, 551, 443, 217, 983, 983, 985, 986, 27,
/* 1380 */ 1484, 64, 64, 551, 310, 65, 65, 551, 1458, 14,
/* 1390 */ 14, 430, 1457, 551, 66, 66, 1094, 551, 1169, 383,
/* 1400 */ 141, 551, 38, 540, 269, 127, 127, 551, 397, 67,
/* 1410 */ 67, 551, 465, 292, 542, 52, 52, 520, 551, 68,
/* 1420 */ 68, 1043, 519, 69, 69, 315, 95, 322, 97, 53,
/* 1430 */ 53, 993, 975, 151, 151, 244, 437, 105, 105, 200,
/* 1440 */ 152, 152, 455, 1312, 106, 244, 430, 553, 552, 1138,
/* 1450 */ 432, 983, 457, 271, 321, 244, 326, 97, 379, 379,
/* 1460 */ 378, 256, 376, 863, 862, 823, 531, 551, 221, 551,
/* 1470 */ 107, 543, 551, 4, 551, 329, 479, 1043, 216, 240,
/* 1480 */ 298, 331, 983, 983, 985, 986, 27, 546, 297, 76,
/* 1490 */ 76, 54, 54, 333, 72, 72, 128, 128, 870, 871,
/* 1500 */ 107, 543, 551, 4, 1263, 551, 946, 947, 1247, 551,
/* 1510 */ 430, 551, 200, 1055, 551, 1055, 551, 546, 218, 551,
/* 1520 */ 335, 1538, 540, 97, 73, 73, 156, 129, 129, 158,
/* 1530 */ 340, 130, 130, 126, 126, 350, 150, 150, 149, 149,
/* 1540 */ 430, 134, 134, 345, 1039, 217, 937, 240, 901, 244,
/* 1550 */ 993, 109, 540, 344, 987, 551, 105, 105, 908, 351,
/* 1560 */ 551, 1513, 1054, 106, 1054, 430, 553, 552, 551, 1324,
/* 1570 */ 983, 834, 99, 543, 139, 4, 551, 133, 133, 397,
/* 1580 */ 993, 1365, 131, 131, 292, 542, 105, 105, 1299, 546,
/* 1590 */ 132, 132, 287, 106, 1310, 430, 553, 552, 75, 75,
/* 1600 */ 983, 983, 983, 985, 986, 27, 551, 437, 902, 537,
/* 1610 */ 987, 109, 430, 259, 551, 538, 1371, 1228, 474, 551,
/* 1620 */ 198, 551, 1220, 1209, 540, 1208, 1210, 1532, 77, 77,
/* 1630 */ 202, 983, 983, 985, 986, 27, 74, 74, 1296, 353,
/* 1640 */ 355, 43, 43, 48, 48, 357, 11, 380, 214, 343,
/* 1650 */ 303, 442, 993, 312, 305, 1360, 314, 484, 105, 105,
/* 1660 */ 459, 1246, 319, 206, 1430, 106, 1429, 430, 553, 552,
/* 1670 */ 359, 541, 983, 271, 1535, 1187, 168, 248, 379, 379,
/* 1680 */ 378, 256, 376, 201, 193, 823, 373, 194, 1477, 1475,
/* 1690 */ 1184, 79, 404, 82, 83, 453, 178, 95, 216, 1349,
/* 1700 */ 298, 162, 1435, 983, 983, 985, 986, 27, 297, 1354,
/* 1710 */ 1346, 35, 170, 445, 446, 477, 173, 174, 175, 176,
/* 1720 */ 385, 224, 1358, 1361, 1357, 466, 387, 36, 182, 452,
/* 1730 */ 388, 1424, 228, 88, 472, 260, 230, 1446, 218, 187,
/* 1740 */ 475, 328, 231, 390, 324, 1211, 156, 232, 493, 158,
/* 1750 */ 418, 90, 1257, 1266, 1549, 1265, 1264, 855, 1256, 207,
/* 1760 */ 420, 512, 1307, 1548, 94, 217, 352, 391, 1236, 1235,
/* 1770 */ 342, 1234, 1547, 1518, 354, 285, 503, 286, 506, 246,
/* 1780 */ 247, 1504, 1503, 423, 1308, 124, 531, 1306, 356, 10,
/* 1790 */ 1305, 367, 1331, 101, 290, 96, 254, 515, 1217, 397,
/* 1800 */ 34, 554, 1144, 255, 292, 542, 257, 372, 1289, 365,
/* 1810 */ 371, 358, 1288, 197, 258, 555, 1206, 1201, 1462, 153,
/* 1820 */ 1463, 1330, 1461, 154, 137, 283, 1460, 437, 155, 203,
/* 1830 */ 810, 204, 78, 431, 1410, 199, 294, 213, 272, 135,
/* 1840 */ 1053, 1051, 966, 157, 169, 220, 171, 887, 311, 223,
/* 1850 */ 1067, 177, 159, 160, 407, 84, 409, 179, 85, 86,
/* 1860 */ 87, 161, 1070, 225, 1066, 398, 167, 399, 18, 226,
/* 1870 */ 146, 227, 323, 244, 1181, 471, 229, 1059, 183, 184,
/* 1880 */ 37, 825, 344, 476, 233, 336, 488, 480, 185, 89,
/* 1890 */ 19, 20, 485, 92, 853, 339, 91, 163, 866, 147,
/* 1900 */ 284, 495, 502, 1132, 148, 1019, 936, 1102, 39, 93,
/* 1910 */ 1103, 40, 505, 263, 208, 265, 188, 931, 1122, 243,
/* 1920 */ 1126, 109, 33, 1120, 1118, 21, 1106, 22, 527, 1034,
/* 1930 */ 23, 24, 1125, 25, 191, 97, 26, 1020, 1018, 1022,
/* 1940 */ 1076, 250, 7, 1075, 249, 1023, 28, 41, 547, 988,
/* 1950 */ 835, 108, 29, 251, 252, 1540, 374, 897, 377, 1140,
/* 1960 */ 1139, 1197, 1197, 1197, 1197, 1197, 1197, 1539,
};
static const YYCODETYPE yy_lookahead[] = {
/* 0 */ 189, 211, 189, 189, 218, 189, 220, 189, 267, 268,
/* 10 */ 269, 189, 210, 189, 228, 189, 267, 268, 269, 19,
/* 20 */ 218, 189, 211, 212, 211, 212, 211, 211, 212, 211,
/* 30 */ 212, 31, 211, 211, 212, 211, 212, 288, 300, 39,
/* 40 */ 21, 189, 304, 43, 44, 45, 46, 47, 48, 49,
|
| ︙ | ︙ | |||
155686 155687 155688 155689 155690 155691 155692 | /* 830 */ 110, 111, 46, 233, 189, 189, 291, 248, 99, 189, /* 840 */ 125, 126, 127, 115, 26, 200, 289, 230, 231, 115, /* 850 */ 200, 16, 189, 114, 115, 189, 211, 212, 119, 221, /* 860 */ 189, 211, 212, 258, 101, 102, 103, 104, 105, 106, /* 870 */ 107, 108, 109, 110, 111, 189, 156, 211, 212, 234, /* 880 */ 235, 189, 211, 212, 234, 235, 22, 201, 189, 150, /* 890 */ 151, 152, 247, 248, 76, 16, 19, 247, 248, 113, | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | | | | | < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 156320 156321 156322 156323 156324 156325 156326 156327 156328 156329 156330 156331 156332 156333 156334 156335 156336 156337 156338 156339 156340 156341 156342 156343 156344 156345 156346 156347 156348 156349 156350 156351 156352 156353 156354 156355 156356 156357 156358 156359 156360 156361 156362 156363 156364 156365 156366 156367 156368 156369 156370 156371 156372 156373 156374 156375 156376 156377 156378 156379 156380 156381 156382 156383 156384 156385 156386 156387 156388 156389 156390 156391 156392 156393 156394 156395 156396 156397 156398 156399 156400 156401 156402 156403 156404 156405 156406 156407 156408 156409 156410 156411 156412 156413 156414 156415 156416 156417 156418 156419 156420 156421 156422 156423 156424 156425 156426 156427 156428 156429 156430 156431 156432 156433 156434 156435 156436 156437 156438 156439 156440 156441 156442 156443 156444 156445 156446 156447 156448 156449 156450 156451 156452 156453 156454 156455 156456 156457 156458 156459 156460 156461 156462 156463 156464 156465 156466 156467 156468 156469 156470 156471 156472 156473 156474 156475 156476 156477 156478 156479 156480 156481 156482 156483 156484 156485 156486 156487 156488 156489 156490 156491 156492 156493 156494 156495 156496 156497 156498 156499 156500 156501 156502 156503 156504 156505 156506 156507 156508 156509 156510 156511 156512 156513 156514 156515 156516 156517 156518 156519 156520 156521 156522 156523 156524 156525 156526 156527 156528 156529 156530 156531 156532 156533 156534 156535 156536 156537 156538 156539 156540 156541 156542 156543 156544 156545 156546 156547 156548 156549 156550 156551 156552 156553 156554 156555 156556 156557 156558 156559 156560 156561 156562 156563 156564 156565 156566 156567 156568 156569 156570 156571 156572 156573 156574 156575 156576 156577 156578 156579 156580 156581 156582 156583 156584 156585 156586 156587 156588 156589 156590 156591 156592 156593 156594 156595 156596 156597 156598 156599 156600 156601 156602 156603 156604 156605 156606 156607 156608 156609 156610 156611 156612 156613 156614 156615 156616 156617 156618 156619 156620 156621 156622 |
/* 830 */ 110, 111, 46, 233, 189, 189, 291, 248, 99, 189,
/* 840 */ 125, 126, 127, 115, 26, 200, 289, 230, 231, 115,
/* 850 */ 200, 16, 189, 114, 115, 189, 211, 212, 119, 221,
/* 860 */ 189, 211, 212, 258, 101, 102, 103, 104, 105, 106,
/* 870 */ 107, 108, 109, 110, 111, 189, 156, 211, 212, 234,
/* 880 */ 235, 189, 211, 212, 234, 235, 22, 201, 189, 150,
/* 890 */ 151, 152, 247, 248, 76, 16, 19, 247, 248, 113,
/* 900 */ 19, 24, 257, 211, 212, 189, 26, 89, 262, 223,
/* 910 */ 92, 225, 77, 189, 79, 129, 19, 53, 226, 248,
/* 920 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
/* 930 */ 53, 54, 55, 56, 57, 236, 19, 271, 189, 99,
/* 940 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
/* 950 */ 53, 54, 55, 56, 57, 115, 77, 59, 79, 119,
/* 960 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
/* 970 */ 53, 54, 55, 56, 57, 259, 22, 23, 101, 102,
/* 980 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 59,
/* 990 */ 150, 151, 152, 158, 22, 114, 24, 189, 101, 102,
/* 1000 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 285,
/* 1010 */ 189, 262, 114, 115, 116, 200, 136, 137, 101, 102,
/* 1020 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 230,
/* 1030 */ 231, 59, 211, 212, 143, 105, 106, 189, 19, 141,
/* 1040 */ 234, 235, 26, 113, 114, 115, 116, 226, 118, 234,
/* 1050 */ 235, 189, 161, 247, 100, 189, 126, 23, 189, 107,
/* 1060 */ 26, 189, 247, 44, 45, 46, 47, 48, 49, 50,
/* 1070 */ 51, 52, 53, 54, 55, 56, 57, 211, 212, 59,
/* 1080 */ 150, 233, 152, 211, 212, 133, 12, 115, 189, 189,
/* 1090 */ 138, 19, 20, 285, 22, 233, 76, 127, 226, 11,
/* 1100 */ 208, 27, 22, 23, 200, 236, 26, 87, 36, 89,
/* 1110 */ 211, 212, 92, 300, 248, 189, 42, 304, 189, 149,
/* 1120 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
/* 1130 */ 111, 59, 200, 233, 114, 115, 116, 63, 234, 235,
/* 1140 */ 124, 19, 20, 71, 22, 300, 46, 73, 200, 304,
/* 1150 */ 116, 247, 244, 81, 246, 200, 227, 300, 36, 234,
/* 1160 */ 235, 304, 23, 143, 200, 26, 234, 235, 194, 200,
/* 1170 */ 48, 99, 247, 66, 189, 141, 284, 105, 106, 247,
/* 1180 */ 100, 59, 234, 235, 112, 259, 114, 115, 116, 234,
/* 1190 */ 235, 119, 85, 71, 266, 247, 211, 212, 234, 235,
/* 1200 */ 189, 94, 247, 234, 235, 12, 266, 85, 136, 137,
/* 1210 */ 189, 247, 90, 113, 126, 127, 247, 189, 26, 22,
/* 1220 */ 27, 99, 150, 151, 152, 153, 154, 105, 106, 189,
/* 1230 */ 302, 303, 211, 212, 112, 42, 114, 115, 116, 211,
/* 1240 */ 212, 119, 302, 303, 19, 20, 189, 22, 274, 189,
/* 1250 */ 15, 144, 278, 189, 22, 23, 63, 189, 189, 203,
/* 1260 */ 204, 36, 203, 204, 189, 24, 136, 137, 211, 212,
/* 1270 */ 189, 235, 150, 151, 152, 153, 154, 0, 1, 2,
/* 1280 */ 211, 212, 5, 247, 59, 292, 293, 10, 11, 12,
/* 1290 */ 13, 14, 211, 212, 17, 60, 71, 189, 258, 189,
/* 1300 */ 59, 59, 105, 106, 189, 26, 189, 30, 116, 32,
/* 1310 */ 85, 253, 189, 251, 252, 90, 189, 40, 258, 211,
/* 1320 */ 212, 211, 212, 127, 99, 26, 211, 212, 211, 212,
/* 1330 */ 105, 106, 100, 141, 211, 212, 239, 112, 189, 114,
/* 1340 */ 115, 116, 31, 189, 119, 149, 249, 70, 189, 26,
/* 1350 */ 39, 19, 20, 24, 22, 78, 115, 115, 81, 189,
/* 1360 */ 211, 212, 155, 189, 157, 211, 212, 189, 36, 189,
/* 1370 */ 211, 212, 189, 189, 97, 150, 151, 152, 153, 154,
/* 1380 */ 189, 211, 212, 189, 189, 211, 212, 189, 189, 211,
/* 1390 */ 212, 59, 189, 189, 211, 212, 23, 189, 26, 26,
/* 1400 */ 22, 189, 24, 71, 22, 211, 212, 189, 131, 211,
/* 1410 */ 212, 189, 189, 136, 137, 211, 212, 85, 189, 211,
/* 1420 */ 212, 59, 90, 211, 212, 23, 147, 189, 26, 211,
/* 1430 */ 212, 99, 23, 211, 212, 26, 159, 105, 106, 140,
/* 1440 */ 211, 212, 23, 189, 112, 26, 114, 115, 116, 1,
/* 1450 */ 2, 119, 23, 5, 23, 26, 189, 26, 10, 11,
/* 1460 */ 12, 13, 14, 118, 119, 17, 143, 189, 139, 189,
/* 1470 */ 19, 20, 189, 22, 189, 189, 23, 115, 30, 26,
/* 1480 */ 32, 189, 150, 151, 152, 153, 154, 36, 40, 211,
/* 1490 */ 212, 211, 212, 189, 211, 212, 211, 212, 7, 8,
/* 1500 */ 19, 20, 189, 22, 189, 189, 83, 84, 189, 189,
/* 1510 */ 59, 189, 140, 150, 189, 152, 189, 36, 70, 189,
/* 1520 */ 23, 139, 71, 26, 211, 212, 78, 211, 212, 81,
/* 1530 */ 189, 211, 212, 211, 212, 189, 211, 212, 211, 212,
/* 1540 */ 59, 211, 212, 119, 23, 97, 23, 26, 23, 26,
/* 1550 */ 99, 26, 71, 129, 59, 189, 105, 106, 107, 189,
/* 1560 */ 189, 309, 150, 112, 152, 114, 115, 116, 189, 189,
/* 1570 */ 119, 23, 19, 20, 26, 22, 189, 211, 212, 131,
/* 1580 */ 99, 189, 211, 212, 136, 137, 105, 106, 189, 36,
/* 1590 */ 211, 212, 250, 112, 189, 114, 115, 116, 211, 212,
/* 1600 */ 119, 150, 151, 152, 153, 154, 189, 159, 23, 189,
/* 1610 */ 115, 26, 59, 280, 189, 231, 189, 189, 281, 189,
/* 1620 */ 237, 189, 189, 189, 71, 189, 189, 189, 211, 212,
/* 1630 */ 209, 150, 151, 152, 153, 154, 211, 212, 250, 250,
/* 1640 */ 250, 211, 212, 211, 212, 250, 238, 187, 290, 214,
/* 1650 */ 240, 254, 99, 286, 254, 241, 241, 215, 105, 106,
/* 1660 */ 286, 220, 240, 224, 214, 112, 214, 114, 115, 116,
/* 1670 */ 254, 273, 119, 5, 192, 60, 290, 139, 10, 11,
/* 1680 */ 12, 13, 14, 238, 244, 17, 240, 244, 196, 196,
/* 1690 */ 38, 287, 196, 287, 148, 113, 22, 147, 30, 241,
/* 1700 */ 32, 43, 276, 150, 151, 152, 153, 154, 40, 265,
/* 1710 */ 241, 264, 229, 18, 196, 18, 232, 232, 232, 232,
/* 1720 */ 241, 195, 265, 229, 265, 196, 265, 264, 229, 241,
/* 1730 */ 241, 241, 195, 155, 62, 196, 195, 283, 70, 22,
/* 1740 */ 216, 196, 195, 216, 282, 196, 78, 195, 113, 81,
/* 1750 */ 64, 22, 222, 213, 219, 213, 213, 124, 222, 162,
/* 1760 */ 111, 142, 256, 219, 113, 97, 255, 216, 213, 215,
/* 1770 */ 213, 213, 213, 303, 255, 275, 216, 275, 216, 196,
/* 1780 */ 91, 308, 308, 82, 256, 146, 143, 256, 255, 22,
/* 1790 */ 256, 196, 260, 155, 272, 145, 25, 144, 199, 131,
/* 1800 */ 26, 198, 13, 190, 136, 137, 190, 241, 245, 244,
/* 1810 */ 242, 255, 245, 243, 6, 188, 188, 188, 208, 202,
/* 1820 */ 208, 260, 208, 202, 217, 217, 208, 159, 202, 209,
/* 1830 */ 4, 209, 208, 3, 270, 22, 160, 15, 98, 16,
/* 1840 */ 23, 23, 137, 128, 148, 24, 140, 20, 16, 142,
/* 1850 */ 1, 140, 128, 128, 61, 53, 37, 148, 53, 53,
/* 1860 */ 53, 128, 114, 34, 1, 296, 293, 296, 22, 139,
/* 1870 */ 5, 113, 158, 26, 75, 41, 139, 68, 68, 113,
/* 1880 */ 24, 20, 129, 19, 123, 23, 96, 67, 22, 22,
/* 1890 */ 22, 22, 67, 147, 59, 24, 22, 37, 28, 23,
/* 1900 */ 67, 22, 24, 23, 23, 23, 114, 23, 22, 26,
/* 1910 */ 23, 22, 24, 23, 139, 23, 22, 141, 75, 34,
/* 1920 */ 75, 26, 22, 86, 88, 34, 23, 34, 24, 23,
/* 1930 */ 34, 34, 93, 34, 26, 26, 34, 23, 23, 23,
/* 1940 */ 23, 22, 44, 23, 26, 11, 22, 22, 26, 23,
/* 1950 */ 23, 22, 22, 139, 139, 139, 23, 133, 15, 1,
/* 1960 */ 1, 310, 310, 310, 310, 310, 310, 139, 310, 310,
/* 1970 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 1980 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 1990 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 2000 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 2010 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 2020 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 2030 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 2040 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 2050 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 2060 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 2070 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 2080 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 2090 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 2100 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 2110 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 2120 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 2130 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310,
/* 2140 */ 310, 310, 310, 310, 310, 310, 310, 310, 310,
};
#define YY_SHIFT_COUNT (557)
#define YY_SHIFT_MIN (0)
#define YY_SHIFT_MAX (1959)
static const unsigned short int yy_shift_ofst[] = {
/* 0 */ 1448, 1277, 1668, 1072, 1072, 340, 1122, 1225, 1332, 1481,
/* 10 */ 1481, 1481, 335, 0, 0, 180, 897, 1481, 1481, 1481,
/* 20 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
/* 30 */ 930, 930, 1020, 1020, 290, 1, 340, 340, 340, 340,
/* 40 */ 340, 340, 40, 110, 219, 288, 327, 396, 435, 504,
/* 50 */ 543, 612, 651, 720, 877, 897, 897, 897, 897, 897,
/* 60 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897,
/* 70 */ 897, 897, 897, 917, 897, 1019, 763, 763, 1451, 1481,
/* 80 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
/* 90 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
/* 100 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
/* 110 */ 1481, 1481, 1553, 1481, 1481, 1481, 1481, 1481, 1481, 1481,
/* 120 */ 1481, 1481, 1481, 1481, 1481, 1481, 147, 258, 258, 258,
/* 130 */ 258, 258, 79, 65, 84, 449, 19, 786, 449, 636,
/* 140 */ 636, 449, 880, 880, 880, 880, 113, 142, 142, 472,
/* 150 */ 150, 1968, 1968, 399, 399, 399, 93, 237, 341, 237,
/* 160 */ 237, 237, 1074, 1074, 437, 350, 704, 1080, 449, 449,
/* 170 */ 449, 449, 449, 449, 449, 449, 449, 449, 449, 449,
/* 180 */ 449, 449, 449, 449, 449, 449, 449, 449, 449, 818,
/* 190 */ 818, 449, 1088, 217, 217, 734, 734, 891, 1130, 1968,
/* 200 */ 1968, 1968, 739, 840, 840, 453, 454, 511, 187, 563,
/* 210 */ 570, 898, 669, 449, 449, 449, 449, 449, 449, 449,
/* 220 */ 449, 449, 670, 449, 449, 449, 449, 449, 449, 449,
/* 230 */ 449, 449, 449, 449, 449, 674, 674, 674, 449, 449,
/* 240 */ 449, 449, 1034, 449, 449, 449, 972, 1107, 449, 449,
/* 250 */ 1193, 449, 449, 449, 449, 449, 449, 449, 449, 260,
/* 260 */ 177, 489, 1241, 1241, 1241, 1241, 1192, 489, 489, 952,
/* 270 */ 1197, 625, 1235, 1299, 181, 181, 881, 1279, 1279, 1299,
/* 280 */ 881, 1016, 1139, 1100, 1311, 1311, 1311, 181, 1323, 1323,
/* 290 */ 1207, 1372, 549, 1378, 1615, 1538, 1538, 1652, 1652, 1538,
/* 300 */ 1546, 1582, 1674, 1550, 1658, 1550, 1695, 1695, 1695, 1695,
/* 310 */ 1538, 1697, 1550, 1582, 1582, 1550, 1582, 1674, 1658, 1550,
/* 320 */ 1658, 1550, 1538, 1697, 1578, 1672, 1538, 1697, 1717, 1538,
/* 330 */ 1697, 1538, 1697, 1717, 1635, 1635, 1635, 1686, 1729, 1729,
/* 340 */ 1717, 1635, 1633, 1635, 1686, 1635, 1635, 1597, 1717, 1649,
/* 350 */ 1649, 1717, 1619, 1651, 1619, 1651, 1619, 1651, 1619, 1651,
/* 360 */ 1538, 1689, 1689, 1701, 1701, 1639, 1643, 1767, 1538, 1638,
/* 370 */ 1639, 1650, 1653, 1550, 1771, 1774, 1789, 1789, 1808, 1808,
/* 380 */ 1808, 1968, 1968, 1968, 1968, 1968, 1968, 1968, 1968, 1968,
/* 390 */ 1968, 1968, 1968, 1968, 1968, 1968, 308, 835, 954, 1232,
/* 400 */ 879, 715, 728, 1373, 864, 1329, 970, 1196, 1402, 297,
/* 410 */ 1409, 1419, 1429, 1431, 1453, 1497, 1242, 1345, 1491, 1424,
/* 420 */ 1362, 1521, 1523, 1423, 1525, 1363, 1412, 1548, 1585, 1495,
/* 430 */ 1382, 1826, 1830, 1813, 1676, 1822, 1740, 1823, 1817, 1818,
/* 440 */ 1705, 1696, 1715, 1821, 1706, 1827, 1707, 1832, 1849, 1711,
/* 450 */ 1724, 1725, 1793, 1819, 1709, 1802, 1805, 1806, 1807, 1733,
/* 460 */ 1748, 1829, 1730, 1863, 1865, 1846, 1758, 1714, 1809, 1847,
/* 470 */ 1810, 1799, 1834, 1737, 1766, 1856, 1861, 1864, 1753, 1761,
/* 480 */ 1866, 1820, 1867, 1868, 1862, 1869, 1825, 1835, 1871, 1790,
/* 490 */ 1870, 1874, 1833, 1860, 1876, 1746, 1879, 1880, 1881, 1882,
/* 500 */ 1883, 1884, 1886, 1878, 1887, 1889, 1888, 1775, 1890, 1892,
/* 510 */ 1792, 1885, 1894, 1776, 1895, 1891, 1893, 1896, 1897, 1836,
/* 520 */ 1843, 1837, 1898, 1845, 1839, 1899, 1903, 1900, 1904, 1908,
/* 530 */ 1909, 1902, 1906, 1895, 1914, 1915, 1916, 1917, 1918, 1920,
/* 540 */ 1919, 1934, 1924, 1925, 1926, 1927, 1929, 1930, 1922, 1824,
/* 550 */ 1814, 1815, 1816, 1828, 1933, 1943, 1958, 1959,
};
#define YY_REDUCE_COUNT (395)
#define YY_REDUCE_MIN (-262)
#define YY_REDUCE_MAX (1629)
static const short yy_reduce_ofst[] = {
/* 0 */ 490, -122, 545, 645, 650, -120, -189, -187, -184, -182,
/* 10 */ -178, -176, 45, 30, 200, -251, -134, 390, 392, 521,
/* 20 */ 523, 213, 692, 821, 284, 589, 872, 666, 671, 866,
/* 30 */ 71, 111, 273, 389, 686, 815, 904, 932, 948, 955,
/* 40 */ 964, 969, -259, -259, -259, -259, -259, -259, -259, -259,
/* 50 */ -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,
/* 60 */ -259, -259, -259, -259, -259, -259, -259, -259, -259, -259,
/* 70 */ -259, -259, -259, -259, -259, -259, -259, -259, 428, 430,
/* 80 */ 899, 985, 1021, 1028, 1057, 1069, 1081, 1108, 1110, 1115,
/* 90 */ 1117, 1123, 1149, 1154, 1159, 1170, 1174, 1178, 1183, 1194,
/* 100 */ 1198, 1204, 1208, 1212, 1218, 1222, 1229, 1278, 1280, 1283,
/* 110 */ 1285, 1313, 1316, 1320, 1322, 1325, 1327, 1330, 1366, 1371,
/* 120 */ 1379, 1387, 1417, 1425, 1430, 1432, -259, -259, -259, -259,
/* 130 */ -259, -259, -259, -259, -259, 557, 974, -214, -174, -9,
/* 140 */ 431, -124, 806, 925, 806, 925, 251, 928, 940, -259,
/* 150 */ -259, -259, -259, -198, -198, -198, 127, -186, -168, 212,
/* 160 */ 646, 749, 617, 799, -262, 555, 220, 220, 491, 605,
/* 170 */ 1040, 1060, 699, -11, 600, 848, 862, 345, -129, 724,
/* 180 */ -91, 158, 808, 716, 900, 304, 869, 929, 926, 499,
/* 190 */ 813, 322, 892, 845, 857, 1056, 1059, 908, 1036, 993,
/* 200 */ 1062, 1097, -210, -185, -179, -148, -167, -89, 121, 274,
/* 210 */ 281, 320, 336, 439, 663, 1011, 1064, 1068, 1075, 1127,
/* 220 */ 1180, 1184, -196, 1191, 1195, 1199, 1203, 1223, 1238, 1254,
/* 230 */ 1267, 1286, 1292, 1304, 1315, 205, 422, 638, 1319, 1341,
/* 240 */ 1346, 1370, 1058, 1380, 1392, 1399, 1342, 1252, 1405, 1420,
/* 250 */ 1384, 1427, 121, 1428, 1433, 1434, 1436, 1437, 1438, 1337,
/* 260 */ 1333, 1383, 1388, 1389, 1390, 1395, 1058, 1383, 1383, 1408,
/* 270 */ 1421, 1460, 1358, 1410, 1397, 1400, 1367, 1414, 1415, 1422,
/* 280 */ 1374, 1442, 1439, 1441, 1435, 1450, 1452, 1416, 1440, 1443,
/* 290 */ 1398, 1446, 1445, 1482, 1386, 1492, 1493, 1404, 1406, 1496,
/* 300 */ 1426, 1444, 1447, 1458, 1483, 1469, 1484, 1485, 1486, 1487,
/* 310 */ 1518, 1526, 1479, 1457, 1459, 1488, 1461, 1463, 1494, 1489,
/* 320 */ 1499, 1490, 1529, 1537, 1454, 1462, 1539, 1541, 1524, 1545,
/* 330 */ 1547, 1549, 1552, 1527, 1540, 1542, 1543, 1530, 1535, 1544,
/* 340 */ 1551, 1555, 1554, 1557, 1536, 1558, 1559, 1470, 1560, 1500,
/* 350 */ 1502, 1562, 1506, 1511, 1528, 1519, 1531, 1533, 1534, 1556,
/* 360 */ 1583, 1473, 1474, 1532, 1561, 1563, 1565, 1564, 1595, 1522,
/* 370 */ 1567, 1570, 1568, 1566, 1599, 1603, 1613, 1616, 1627, 1628,
/* 380 */ 1629, 1569, 1571, 1573, 1617, 1610, 1612, 1614, 1618, 1621,
/* 390 */ 1607, 1608, 1620, 1622, 1624, 1626,
};
static const YYACTIONTYPE yy_default[] = {
/* 0 */ 1583, 1583, 1583, 1419, 1195, 1304, 1195, 1195, 1195, 1419,
/* 10 */ 1419, 1419, 1195, 1334, 1334, 1472, 1226, 1195, 1195, 1195,
/* 20 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1418, 1195, 1195,
/* 30 */ 1195, 1195, 1502, 1502, 1195, 1195, 1195, 1195, 1195, 1195,
/* 40 */ 1195, 1195, 1195, 1343, 1195, 1195, 1195, 1195, 1195, 1195,
/* 50 */ 1420, 1421, 1195, 1195, 1195, 1471, 1473, 1436, 1353, 1352,
/* 60 */ 1351, 1350, 1454, 1321, 1348, 1341, 1345, 1414, 1415, 1413,
/* 70 */ 1417, 1421, 1420, 1195, 1344, 1385, 1399, 1384, 1195, 1195,
/* 80 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
/* 90 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
/* 100 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
/* 110 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
/* 120 */ 1195, 1195, 1195, 1195, 1195, 1195, 1393, 1398, 1404, 1397,
/* 130 */ 1394, 1387, 1386, 1388, 1389, 1195, 1216, 1268, 1195, 1195,
/* 140 */ 1195, 1195, 1490, 1489, 1195, 1195, 1226, 1379, 1378, 1390,
/* 150 */ 1391, 1401, 1400, 1479, 1537, 1536, 1437, 1195, 1195, 1195,
/* 160 */ 1195, 1195, 1195, 1195, 1502, 1195, 1195, 1195, 1195, 1195,
/* 170 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
/* 180 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1502,
/* 190 */ 1502, 1195, 1226, 1502, 1502, 1222, 1222, 1328, 1195, 1485,
/* 200 */ 1304, 1295, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
/* 210 */ 1195, 1195, 1195, 1195, 1195, 1195, 1476, 1474, 1195, 1195,
/* 220 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
/* 230 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
/* 240 */ 1195, 1195, 1195, 1195, 1195, 1195, 1300, 1195, 1195, 1195,
/* 250 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1531, 1195,
/* 260 */ 1449, 1282, 1300, 1300, 1300, 1300, 1302, 1283, 1281, 1294,
/* 270 */ 1227, 1202, 1575, 1301, 1323, 1323, 1572, 1347, 1347, 1301,
/* 280 */ 1572, 1243, 1553, 1238, 1334, 1334, 1334, 1323, 1328, 1328,
/* 290 */ 1416, 1301, 1294, 1195, 1575, 1309, 1309, 1574, 1574, 1309,
/* 300 */ 1437, 1356, 1363, 1347, 1271, 1347, 1277, 1277, 1277, 1277,
/* 310 */ 1309, 1213, 1347, 1356, 1356, 1347, 1356, 1363, 1271, 1347,
/* 320 */ 1271, 1347, 1309, 1213, 1453, 1569, 1309, 1213, 1427, 1309,
/* 330 */ 1213, 1309, 1213, 1427, 1269, 1269, 1269, 1258, 1195, 1195,
/* 340 */ 1427, 1269, 1243, 1269, 1258, 1269, 1269, 1520, 1427, 1431,
/* 350 */ 1431, 1427, 1327, 1322, 1327, 1322, 1327, 1322, 1327, 1322,
/* 360 */ 1309, 1512, 1512, 1337, 1337, 1342, 1328, 1422, 1309, 1195,
/* 370 */ 1342, 1340, 1338, 1347, 1219, 1261, 1534, 1534, 1530, 1530,
/* 380 */ 1530, 1580, 1580, 1485, 1546, 1226, 1226, 1226, 1226, 1546,
/* 390 */ 1245, 1245, 1227, 1227, 1226, 1546, 1195, 1195, 1195, 1195,
/* 400 */ 1195, 1195, 1541, 1195, 1438, 1313, 1195, 1195, 1195, 1195,
/* 410 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
/* 420 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
/* 430 */ 1368, 1195, 1198, 1482, 1195, 1195, 1480, 1195, 1195, 1195,
/* 440 */ 1195, 1195, 1195, 1314, 1195, 1195, 1195, 1195, 1195, 1195,
/* 450 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
/* 460 */ 1195, 1195, 1571, 1195, 1195, 1195, 1195, 1195, 1195, 1452,
/* 470 */ 1451, 1195, 1195, 1311, 1195, 1195, 1195, 1195, 1195, 1195,
/* 480 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1241, 1195, 1195,
/* 490 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
/* 500 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195,
/* 510 */ 1195, 1195, 1195, 1195, 1339, 1195, 1195, 1195, 1195, 1195,
/* 520 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1517,
/* 530 */ 1329, 1195, 1195, 1562, 1195, 1195, 1195, 1195, 1195, 1195,
/* 540 */ 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1195, 1557, 1285,
/* 550 */ 1370, 1195, 1369, 1373, 1195, 1207, 1195, 1195,
};
/********** End of lemon-generated parsing tables *****************************/
/* The next table maps tokens (terminal symbols) into fallback tokens.
** If a construct like the following:
**
** %fallback ID X Y Z.
|
| ︙ | ︙ | |||
156739 156740 156741 156742 156743 156744 156745 | /* 152 */ "setlist ::= setlist COMMA nm EQ expr", /* 153 */ "setlist ::= setlist COMMA LP idlist RP EQ expr", /* 154 */ "setlist ::= nm EQ expr", /* 155 */ "setlist ::= LP idlist RP EQ expr", /* 156 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert", /* 157 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES", /* 158 */ "upsert ::=", | | | | | | | | | | | | | | | | | > | | | | | | | | | | | | | | | | | | < | | | | | | | | > | | | | | | | | | | | | | < | | | > | | | | | | | | | | | | | | | | | < | | | | | | > | | | | < | | | | | > | | | | | | | | | | | | | | | | | | | < | | | | | > | | | | | | | | | | | | | | | | | | | | | | < | > | | | | | | | | | | | | | | | | | | | | | | | | | < | | | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | | | | > | | | | | | | | | | | | | | | | | 157373 157374 157375 157376 157377 157378 157379 157380 157381 157382 157383 157384 157385 157386 157387 157388 157389 157390 157391 157392 157393 157394 157395 157396 157397 157398 157399 157400 157401 157402 157403 157404 157405 157406 157407 157408 157409 157410 157411 157412 157413 157414 157415 157416 157417 157418 157419 157420 157421 157422 157423 157424 157425 157426 157427 157428 157429 157430 157431 157432 157433 157434 157435 157436 157437 157438 157439 157440 157441 157442 157443 157444 157445 157446 157447 157448 157449 157450 157451 157452 157453 157454 157455 157456 157457 157458 157459 157460 157461 157462 157463 157464 157465 157466 157467 157468 157469 157470 157471 157472 157473 157474 157475 157476 157477 157478 157479 157480 157481 157482 157483 157484 157485 157486 157487 157488 157489 157490 157491 157492 157493 157494 157495 157496 157497 157498 157499 157500 157501 157502 157503 157504 157505 157506 157507 157508 157509 157510 157511 157512 157513 157514 157515 157516 157517 157518 157519 157520 157521 157522 157523 157524 157525 157526 157527 157528 157529 157530 157531 157532 157533 157534 157535 157536 157537 157538 157539 157540 157541 157542 157543 157544 157545 157546 157547 157548 157549 157550 157551 157552 157553 157554 157555 157556 157557 157558 157559 157560 157561 157562 157563 157564 157565 157566 157567 157568 157569 157570 157571 157572 157573 157574 157575 157576 157577 157578 157579 157580 157581 157582 157583 157584 157585 157586 157587 157588 157589 157590 157591 157592 157593 157594 157595 157596 157597 157598 157599 157600 157601 157602 157603 157604 157605 157606 157607 157608 157609 157610 157611 157612 157613 | /* 152 */ "setlist ::= setlist COMMA nm EQ expr", /* 153 */ "setlist ::= setlist COMMA LP idlist RP EQ expr", /* 154 */ "setlist ::= nm EQ expr", /* 155 */ "setlist ::= LP idlist RP EQ expr", /* 156 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert", /* 157 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES", /* 158 */ "upsert ::=", /* 159 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert", /* 160 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert", /* 161 */ "upsert ::= ON CONFLICT DO NOTHING", /* 162 */ "upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt", /* 163 */ "insert_cmd ::= INSERT orconf", /* 164 */ "insert_cmd ::= REPLACE", /* 165 */ "idlist_opt ::=", /* 166 */ "idlist_opt ::= LP idlist RP", /* 167 */ "idlist ::= idlist COMMA nm", /* 168 */ "idlist ::= nm", /* 169 */ "expr ::= LP expr RP", /* 170 */ "expr ::= ID|INDEXED", /* 171 */ "expr ::= JOIN_KW", /* 172 */ "expr ::= nm DOT nm", /* 173 */ "expr ::= nm DOT nm DOT nm", /* 174 */ "term ::= NULL|FLOAT|BLOB", /* 175 */ "term ::= STRING", /* 176 */ "term ::= INTEGER", /* 177 */ "expr ::= VARIABLE", /* 178 */ "expr ::= expr COLLATE ID|STRING", /* 179 */ "expr ::= CAST LP expr AS typetoken RP", /* 180 */ "expr ::= ID|INDEXED LP distinct exprlist RP", /* 181 */ "expr ::= ID|INDEXED LP STAR RP", /* 182 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over", /* 183 */ "expr ::= ID|INDEXED LP STAR RP filter_over", /* 184 */ "term ::= CTIME_KW", /* 185 */ "expr ::= LP nexprlist COMMA expr RP", /* 186 */ "expr ::= expr AND expr", /* 187 */ "expr ::= expr OR expr", /* 188 */ "expr ::= expr LT|GT|GE|LE expr", /* 189 */ "expr ::= expr EQ|NE expr", /* 190 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", /* 191 */ "expr ::= expr PLUS|MINUS expr", /* 192 */ "expr ::= expr STAR|SLASH|REM expr", /* 193 */ "expr ::= expr CONCAT expr", /* 194 */ "likeop ::= NOT LIKE_KW|MATCH", /* 195 */ "expr ::= expr likeop expr", /* 196 */ "expr ::= expr likeop expr ESCAPE expr", /* 197 */ "expr ::= expr ISNULL|NOTNULL", /* 198 */ "expr ::= expr NOT NULL", /* 199 */ "expr ::= expr IS expr", /* 200 */ "expr ::= expr IS NOT expr", /* 201 */ "expr ::= NOT expr", /* 202 */ "expr ::= BITNOT expr", /* 203 */ "expr ::= PLUS|MINUS expr", /* 204 */ "between_op ::= BETWEEN", /* 205 */ "between_op ::= NOT BETWEEN", /* 206 */ "expr ::= expr between_op expr AND expr", /* 207 */ "in_op ::= IN", /* 208 */ "in_op ::= NOT IN", /* 209 */ "expr ::= expr in_op LP exprlist RP", /* 210 */ "expr ::= LP select RP", /* 211 */ "expr ::= expr in_op LP select RP", /* 212 */ "expr ::= expr in_op nm dbnm paren_exprlist", /* 213 */ "expr ::= EXISTS LP select RP", /* 214 */ "expr ::= CASE case_operand case_exprlist case_else END", /* 215 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", /* 216 */ "case_exprlist ::= WHEN expr THEN expr", /* 217 */ "case_else ::= ELSE expr", /* 218 */ "case_else ::=", /* 219 */ "case_operand ::= expr", /* 220 */ "case_operand ::=", /* 221 */ "exprlist ::=", /* 222 */ "nexprlist ::= nexprlist COMMA expr", /* 223 */ "nexprlist ::= expr", /* 224 */ "paren_exprlist ::=", /* 225 */ "paren_exprlist ::= LP exprlist RP", /* 226 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", /* 227 */ "uniqueflag ::= UNIQUE", /* 228 */ "uniqueflag ::=", /* 229 */ "eidlist_opt ::=", /* 230 */ "eidlist_opt ::= LP eidlist RP", /* 231 */ "eidlist ::= eidlist COMMA nm collate sortorder", /* 232 */ "eidlist ::= nm collate sortorder", /* 233 */ "collate ::=", /* 234 */ "collate ::= COLLATE ID|STRING", /* 235 */ "cmd ::= DROP INDEX ifexists fullname", /* 236 */ "cmd ::= VACUUM vinto", /* 237 */ "cmd ::= VACUUM nm vinto", /* 238 */ "vinto ::= INTO expr", /* 239 */ "vinto ::=", /* 240 */ "cmd ::= PRAGMA nm dbnm", /* 241 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", /* 242 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", /* 243 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", /* 244 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", /* 245 */ "plus_num ::= PLUS INTEGER|FLOAT", /* 246 */ "minus_num ::= MINUS INTEGER|FLOAT", /* 247 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", /* 248 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", /* 249 */ "trigger_time ::= BEFORE|AFTER", /* 250 */ "trigger_time ::= INSTEAD OF", /* 251 */ "trigger_time ::=", /* 252 */ "trigger_event ::= DELETE|INSERT", /* 253 */ "trigger_event ::= UPDATE", /* 254 */ "trigger_event ::= UPDATE OF idlist", /* 255 */ "when_clause ::=", /* 256 */ "when_clause ::= WHEN expr", /* 257 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", /* 258 */ "trigger_cmd_list ::= trigger_cmd SEMI", /* 259 */ "trnm ::= nm DOT nm", /* 260 */ "tridxby ::= INDEXED BY nm", /* 261 */ "tridxby ::= NOT INDEXED", /* 262 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt", /* 263 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", /* 264 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", /* 265 */ "trigger_cmd ::= scanpt select scanpt", /* 266 */ "expr ::= RAISE LP IGNORE RP", /* 267 */ "expr ::= RAISE LP raisetype COMMA nm RP", /* 268 */ "raisetype ::= ROLLBACK", /* 269 */ "raisetype ::= ABORT", /* 270 */ "raisetype ::= FAIL", /* 271 */ "cmd ::= DROP TRIGGER ifexists fullname", /* 272 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", /* 273 */ "cmd ::= DETACH database_kw_opt expr", /* 274 */ "key_opt ::=", /* 275 */ "key_opt ::= KEY expr", /* 276 */ "cmd ::= REINDEX", /* 277 */ "cmd ::= REINDEX nm dbnm", /* 278 */ "cmd ::= ANALYZE", /* 279 */ "cmd ::= ANALYZE nm dbnm", /* 280 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", /* 281 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", /* 282 */ "add_column_fullname ::= fullname", /* 283 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", /* 284 */ "cmd ::= create_vtab", /* 285 */ "cmd ::= create_vtab LP vtabarglist RP", /* 286 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", /* 287 */ "vtabarg ::=", /* 288 */ "vtabargtoken ::= ANY", /* 289 */ "vtabargtoken ::= lp anylist RP", /* 290 */ "lp ::= LP", /* 291 */ "with ::= WITH wqlist", /* 292 */ "with ::= WITH RECURSIVE wqlist", /* 293 */ "wqlist ::= nm eidlist_opt AS LP select RP", /* 294 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", /* 295 */ "windowdefn_list ::= windowdefn", /* 296 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", /* 297 */ "windowdefn ::= nm AS LP window RP", /* 298 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", /* 299 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", /* 300 */ "window ::= ORDER BY sortlist frame_opt", /* 301 */ "window ::= nm ORDER BY sortlist frame_opt", /* 302 */ "window ::= frame_opt", /* 303 */ "window ::= nm frame_opt", /* 304 */ "frame_opt ::=", /* 305 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", /* 306 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", /* 307 */ "range_or_rows ::= RANGE|ROWS|GROUPS", /* 308 */ "frame_bound_s ::= frame_bound", /* 309 */ "frame_bound_s ::= UNBOUNDED PRECEDING", /* 310 */ "frame_bound_e ::= frame_bound", /* 311 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", /* 312 */ "frame_bound ::= expr PRECEDING|FOLLOWING", /* 313 */ "frame_bound ::= CURRENT ROW", /* 314 */ "frame_exclude_opt ::=", /* 315 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", /* 316 */ "frame_exclude ::= NO OTHERS", /* 317 */ "frame_exclude ::= CURRENT ROW", /* 318 */ "frame_exclude ::= GROUP|TIES", /* 319 */ "window_clause ::= WINDOW windowdefn_list", /* 320 */ "filter_over ::= filter_clause over_clause", /* 321 */ "filter_over ::= over_clause", /* 322 */ "filter_over ::= filter_clause", /* 323 */ "over_clause ::= OVER LP window RP", /* 324 */ "over_clause ::= OVER nm", /* 325 */ "filter_clause ::= FILTER LP WHERE expr RP", /* 326 */ "input ::= cmdlist", /* 327 */ "cmdlist ::= cmdlist ecmd", /* 328 */ "cmdlist ::= ecmd", /* 329 */ "ecmd ::= SEMI", /* 330 */ "ecmd ::= cmdx SEMI", /* 331 */ "ecmd ::= explain cmdx SEMI", /* 332 */ "trans_opt ::=", /* 333 */ "trans_opt ::= TRANSACTION", /* 334 */ "trans_opt ::= TRANSACTION nm", /* 335 */ "savepoint_opt ::= SAVEPOINT", /* 336 */ "savepoint_opt ::=", /* 337 */ "cmd ::= create_table create_table_args", /* 338 */ "columnlist ::= columnlist COMMA columnname carglist", /* 339 */ "columnlist ::= columnname carglist", /* 340 */ "nm ::= ID|INDEXED", /* 341 */ "nm ::= STRING", /* 342 */ "nm ::= JOIN_KW", /* 343 */ "typetoken ::= typename", /* 344 */ "typename ::= ID|STRING", /* 345 */ "signed ::= plus_num", /* 346 */ "signed ::= minus_num", /* 347 */ "carglist ::= carglist ccons", /* 348 */ "carglist ::=", /* 349 */ "ccons ::= NULL onconf", /* 350 */ "ccons ::= GENERATED ALWAYS AS generated", /* 351 */ "ccons ::= AS generated", /* 352 */ "conslist_opt ::= COMMA conslist", /* 353 */ "conslist ::= conslist tconscomma tcons", /* 354 */ "conslist ::= tcons", /* 355 */ "tconscomma ::=", /* 356 */ "defer_subclause_opt ::= defer_subclause", /* 357 */ "resolvetype ::= raisetype", /* 358 */ "selectnowith ::= oneselect", /* 359 */ "oneselect ::= values", /* 360 */ "sclp ::= selcollist COMMA", /* 361 */ "as ::= ID|STRING", /* 362 */ "expr ::= term", /* 363 */ "likeop ::= LIKE_KW|MATCH", /* 364 */ "exprlist ::= nexprlist", /* 365 */ "nmnum ::= plus_num", /* 366 */ "nmnum ::= nm", /* 367 */ "nmnum ::= ON", /* 368 */ "nmnum ::= DELETE", /* 369 */ "nmnum ::= DEFAULT", /* 370 */ "plus_num ::= INTEGER|FLOAT", /* 371 */ "foreach_clause ::=", /* 372 */ "foreach_clause ::= FOR EACH ROW", /* 373 */ "trnm ::= nm", /* 374 */ "tridxby ::=", /* 375 */ "database_kw_opt ::= DATABASE", /* 376 */ "database_kw_opt ::=", /* 377 */ "kwcolumn_opt ::=", /* 378 */ "kwcolumn_opt ::= COLUMNKW", /* 379 */ "vtabarglist ::= vtabarg", /* 380 */ "vtabarglist ::= vtabarglist COMMA vtabarg", /* 381 */ "vtabarg ::= vtabarg vtabargtoken", /* 382 */ "anylist ::=", /* 383 */ "anylist ::= anylist LP anylist RP", /* 384 */ "anylist ::= anylist ANY", /* 385 */ "with ::=", }; #endif /* NDEBUG */ #if YYSTACKDEPTH<=0 /* ** Try to increase the size of the parser stack. Return the number |
| ︙ | ︙ | |||
157631 157632 157633 157634 157635 157636 157637 | 262, /* (152) setlist ::= setlist COMMA nm EQ expr */ 262, /* (153) setlist ::= setlist COMMA LP idlist RP EQ expr */ 262, /* (154) setlist ::= nm EQ expr */ 262, /* (155) setlist ::= LP idlist RP EQ expr */ 186, /* (156) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ 186, /* (157) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */ 265, /* (158) upsert ::= */ | | | | | | | | | | | | | | | | | > | | | | | | | | < | | | | > | | | | | < | | | | | | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | | | | | | > | | | | < | | | | | > | | | | | | | | | | | | | | | | | | | < | | | | | > | | | | | | | | | | | | | | | | | | | | | < | | > | | | | | | | | | | | | | | | | | | | | | | | < | | | | | | | > | | | | | < | | > | | | | | | | | | | | | | | | | | | | | | | < | | | | > | | | | | | | | | | | | | | | | | 158266 158267 158268 158269 158270 158271 158272 158273 158274 158275 158276 158277 158278 158279 158280 158281 158282 158283 158284 158285 158286 158287 158288 158289 158290 158291 158292 158293 158294 158295 158296 158297 158298 158299 158300 158301 158302 158303 158304 158305 158306 158307 158308 158309 158310 158311 158312 158313 158314 158315 158316 158317 158318 158319 158320 158321 158322 158323 158324 158325 158326 158327 158328 158329 158330 158331 158332 158333 158334 158335 158336 158337 158338 158339 158340 158341 158342 158343 158344 158345 158346 158347 158348 158349 158350 158351 158352 158353 158354 158355 158356 158357 158358 158359 158360 158361 158362 158363 158364 158365 158366 158367 158368 158369 158370 158371 158372 158373 158374 158375 158376 158377 158378 158379 158380 158381 158382 158383 158384 158385 158386 158387 158388 158389 158390 158391 158392 158393 158394 158395 158396 158397 158398 158399 158400 158401 158402 158403 158404 158405 158406 158407 158408 158409 158410 158411 158412 158413 158414 158415 158416 158417 158418 158419 158420 158421 158422 158423 158424 158425 158426 158427 158428 158429 158430 158431 158432 158433 158434 158435 158436 158437 158438 158439 158440 158441 158442 158443 158444 158445 158446 158447 158448 158449 158450 158451 158452 158453 158454 158455 158456 158457 158458 158459 158460 158461 158462 158463 158464 158465 158466 158467 158468 158469 158470 158471 158472 158473 158474 158475 158476 158477 158478 158479 158480 158481 158482 158483 158484 158485 158486 158487 158488 158489 158490 158491 158492 158493 158494 158495 158496 158497 158498 158499 158500 158501 158502 158503 158504 158505 158506 |
262, /* (152) setlist ::= setlist COMMA nm EQ expr */
262, /* (153) setlist ::= setlist COMMA LP idlist RP EQ expr */
262, /* (154) setlist ::= nm EQ expr */
262, /* (155) setlist ::= LP idlist RP EQ expr */
186, /* (156) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
186, /* (157) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
265, /* (158) upsert ::= */
265, /* (159) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
265, /* (160) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
265, /* (161) upsert ::= ON CONFLICT DO NOTHING */
265, /* (162) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt */
263, /* (163) insert_cmd ::= INSERT orconf */
263, /* (164) insert_cmd ::= REPLACE */
264, /* (165) idlist_opt ::= */
264, /* (166) idlist_opt ::= LP idlist RP */
259, /* (167) idlist ::= idlist COMMA nm */
259, /* (168) idlist ::= nm */
212, /* (169) expr ::= LP expr RP */
212, /* (170) expr ::= ID|INDEXED */
212, /* (171) expr ::= JOIN_KW */
212, /* (172) expr ::= nm DOT nm */
212, /* (173) expr ::= nm DOT nm DOT nm */
211, /* (174) term ::= NULL|FLOAT|BLOB */
211, /* (175) term ::= STRING */
211, /* (176) term ::= INTEGER */
212, /* (177) expr ::= VARIABLE */
212, /* (178) expr ::= expr COLLATE ID|STRING */
212, /* (179) expr ::= CAST LP expr AS typetoken RP */
212, /* (180) expr ::= ID|INDEXED LP distinct exprlist RP */
212, /* (181) expr ::= ID|INDEXED LP STAR RP */
212, /* (182) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
212, /* (183) expr ::= ID|INDEXED LP STAR RP filter_over */
211, /* (184) term ::= CTIME_KW */
212, /* (185) expr ::= LP nexprlist COMMA expr RP */
212, /* (186) expr ::= expr AND expr */
212, /* (187) expr ::= expr OR expr */
212, /* (188) expr ::= expr LT|GT|GE|LE expr */
212, /* (189) expr ::= expr EQ|NE expr */
212, /* (190) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
212, /* (191) expr ::= expr PLUS|MINUS expr */
212, /* (192) expr ::= expr STAR|SLASH|REM expr */
212, /* (193) expr ::= expr CONCAT expr */
267, /* (194) likeop ::= NOT LIKE_KW|MATCH */
212, /* (195) expr ::= expr likeop expr */
212, /* (196) expr ::= expr likeop expr ESCAPE expr */
212, /* (197) expr ::= expr ISNULL|NOTNULL */
212, /* (198) expr ::= expr NOT NULL */
212, /* (199) expr ::= expr IS expr */
212, /* (200) expr ::= expr IS NOT expr */
212, /* (201) expr ::= NOT expr */
212, /* (202) expr ::= BITNOT expr */
212, /* (203) expr ::= PLUS|MINUS expr */
268, /* (204) between_op ::= BETWEEN */
268, /* (205) between_op ::= NOT BETWEEN */
212, /* (206) expr ::= expr between_op expr AND expr */
269, /* (207) in_op ::= IN */
269, /* (208) in_op ::= NOT IN */
212, /* (209) expr ::= expr in_op LP exprlist RP */
212, /* (210) expr ::= LP select RP */
212, /* (211) expr ::= expr in_op LP select RP */
212, /* (212) expr ::= expr in_op nm dbnm paren_exprlist */
212, /* (213) expr ::= EXISTS LP select RP */
212, /* (214) expr ::= CASE case_operand case_exprlist case_else END */
272, /* (215) case_exprlist ::= case_exprlist WHEN expr THEN expr */
272, /* (216) case_exprlist ::= WHEN expr THEN expr */
273, /* (217) case_else ::= ELSE expr */
273, /* (218) case_else ::= */
271, /* (219) case_operand ::= expr */
271, /* (220) case_operand ::= */
257, /* (221) exprlist ::= */
248, /* (222) nexprlist ::= nexprlist COMMA expr */
248, /* (223) nexprlist ::= expr */
270, /* (224) paren_exprlist ::= */
270, /* (225) paren_exprlist ::= LP exprlist RP */
186, /* (226) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
274, /* (227) uniqueflag ::= UNIQUE */
274, /* (228) uniqueflag ::= */
216, /* (229) eidlist_opt ::= */
216, /* (230) eidlist_opt ::= LP eidlist RP */
227, /* (231) eidlist ::= eidlist COMMA nm collate sortorder */
227, /* (232) eidlist ::= nm collate sortorder */
275, /* (233) collate ::= */
275, /* (234) collate ::= COLLATE ID|STRING */
186, /* (235) cmd ::= DROP INDEX ifexists fullname */
186, /* (236) cmd ::= VACUUM vinto */
186, /* (237) cmd ::= VACUUM nm vinto */
276, /* (238) vinto ::= INTO expr */
276, /* (239) vinto ::= */
186, /* (240) cmd ::= PRAGMA nm dbnm */
186, /* (241) cmd ::= PRAGMA nm dbnm EQ nmnum */
186, /* (242) cmd ::= PRAGMA nm dbnm LP nmnum RP */
186, /* (243) cmd ::= PRAGMA nm dbnm EQ minus_num */
186, /* (244) cmd ::= PRAGMA nm dbnm LP minus_num RP */
206, /* (245) plus_num ::= PLUS INTEGER|FLOAT */
207, /* (246) minus_num ::= MINUS INTEGER|FLOAT */
186, /* (247) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
278, /* (248) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
280, /* (249) trigger_time ::= BEFORE|AFTER */
280, /* (250) trigger_time ::= INSTEAD OF */
280, /* (251) trigger_time ::= */
281, /* (252) trigger_event ::= DELETE|INSERT */
281, /* (253) trigger_event ::= UPDATE */
281, /* (254) trigger_event ::= UPDATE OF idlist */
283, /* (255) when_clause ::= */
283, /* (256) when_clause ::= WHEN expr */
279, /* (257) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
279, /* (258) trigger_cmd_list ::= trigger_cmd SEMI */
285, /* (259) trnm ::= nm DOT nm */
286, /* (260) tridxby ::= INDEXED BY nm */
286, /* (261) tridxby ::= NOT INDEXED */
284, /* (262) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
284, /* (263) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
284, /* (264) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
284, /* (265) trigger_cmd ::= scanpt select scanpt */
212, /* (266) expr ::= RAISE LP IGNORE RP */
212, /* (267) expr ::= RAISE LP raisetype COMMA nm RP */
231, /* (268) raisetype ::= ROLLBACK */
231, /* (269) raisetype ::= ABORT */
231, /* (270) raisetype ::= FAIL */
186, /* (271) cmd ::= DROP TRIGGER ifexists fullname */
186, /* (272) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
186, /* (273) cmd ::= DETACH database_kw_opt expr */
288, /* (274) key_opt ::= */
288, /* (275) key_opt ::= KEY expr */
186, /* (276) cmd ::= REINDEX */
186, /* (277) cmd ::= REINDEX nm dbnm */
186, /* (278) cmd ::= ANALYZE */
186, /* (279) cmd ::= ANALYZE nm dbnm */
186, /* (280) cmd ::= ALTER TABLE fullname RENAME TO nm */
186, /* (281) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
289, /* (282) add_column_fullname ::= fullname */
186, /* (283) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
186, /* (284) cmd ::= create_vtab */
186, /* (285) cmd ::= create_vtab LP vtabarglist RP */
291, /* (286) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
293, /* (287) vtabarg ::= */
294, /* (288) vtabargtoken ::= ANY */
294, /* (289) vtabargtoken ::= lp anylist RP */
295, /* (290) lp ::= LP */
261, /* (291) with ::= WITH wqlist */
261, /* (292) with ::= WITH RECURSIVE wqlist */
236, /* (293) wqlist ::= nm eidlist_opt AS LP select RP */
236, /* (294) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
297, /* (295) windowdefn_list ::= windowdefn */
297, /* (296) windowdefn_list ::= windowdefn_list COMMA windowdefn */
298, /* (297) windowdefn ::= nm AS LP window RP */
299, /* (298) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
299, /* (299) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
299, /* (300) window ::= ORDER BY sortlist frame_opt */
299, /* (301) window ::= nm ORDER BY sortlist frame_opt */
299, /* (302) window ::= frame_opt */
299, /* (303) window ::= nm frame_opt */
300, /* (304) frame_opt ::= */
300, /* (305) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
300, /* (306) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
304, /* (307) range_or_rows ::= RANGE|ROWS|GROUPS */
306, /* (308) frame_bound_s ::= frame_bound */
306, /* (309) frame_bound_s ::= UNBOUNDED PRECEDING */
307, /* (310) frame_bound_e ::= frame_bound */
307, /* (311) frame_bound_e ::= UNBOUNDED FOLLOWING */
305, /* (312) frame_bound ::= expr PRECEDING|FOLLOWING */
305, /* (313) frame_bound ::= CURRENT ROW */
308, /* (314) frame_exclude_opt ::= */
308, /* (315) frame_exclude_opt ::= EXCLUDE frame_exclude */
309, /* (316) frame_exclude ::= NO OTHERS */
309, /* (317) frame_exclude ::= CURRENT ROW */
309, /* (318) frame_exclude ::= GROUP|TIES */
246, /* (319) window_clause ::= WINDOW windowdefn_list */
266, /* (320) filter_over ::= filter_clause over_clause */
266, /* (321) filter_over ::= over_clause */
266, /* (322) filter_over ::= filter_clause */
303, /* (323) over_clause ::= OVER LP window RP */
303, /* (324) over_clause ::= OVER nm */
302, /* (325) filter_clause ::= FILTER LP WHERE expr RP */
181, /* (326) input ::= cmdlist */
182, /* (327) cmdlist ::= cmdlist ecmd */
182, /* (328) cmdlist ::= ecmd */
183, /* (329) ecmd ::= SEMI */
183, /* (330) ecmd ::= cmdx SEMI */
183, /* (331) ecmd ::= explain cmdx SEMI */
188, /* (332) trans_opt ::= */
188, /* (333) trans_opt ::= TRANSACTION */
188, /* (334) trans_opt ::= TRANSACTION nm */
190, /* (335) savepoint_opt ::= SAVEPOINT */
190, /* (336) savepoint_opt ::= */
186, /* (337) cmd ::= create_table create_table_args */
197, /* (338) columnlist ::= columnlist COMMA columnname carglist */
197, /* (339) columnlist ::= columnname carglist */
189, /* (340) nm ::= ID|INDEXED */
189, /* (341) nm ::= STRING */
189, /* (342) nm ::= JOIN_KW */
203, /* (343) typetoken ::= typename */
204, /* (344) typename ::= ID|STRING */
205, /* (345) signed ::= plus_num */
205, /* (346) signed ::= minus_num */
202, /* (347) carglist ::= carglist ccons */
202, /* (348) carglist ::= */
210, /* (349) ccons ::= NULL onconf */
210, /* (350) ccons ::= GENERATED ALWAYS AS generated */
210, /* (351) ccons ::= AS generated */
198, /* (352) conslist_opt ::= COMMA conslist */
223, /* (353) conslist ::= conslist tconscomma tcons */
223, /* (354) conslist ::= tcons */
224, /* (355) tconscomma ::= */
228, /* (356) defer_subclause_opt ::= defer_subclause */
230, /* (357) resolvetype ::= raisetype */
234, /* (358) selectnowith ::= oneselect */
235, /* (359) oneselect ::= values */
249, /* (360) sclp ::= selcollist COMMA */
250, /* (361) as ::= ID|STRING */
212, /* (362) expr ::= term */
267, /* (363) likeop ::= LIKE_KW|MATCH */
257, /* (364) exprlist ::= nexprlist */
277, /* (365) nmnum ::= plus_num */
277, /* (366) nmnum ::= nm */
277, /* (367) nmnum ::= ON */
277, /* (368) nmnum ::= DELETE */
277, /* (369) nmnum ::= DEFAULT */
206, /* (370) plus_num ::= INTEGER|FLOAT */
282, /* (371) foreach_clause ::= */
282, /* (372) foreach_clause ::= FOR EACH ROW */
285, /* (373) trnm ::= nm */
286, /* (374) tridxby ::= */
287, /* (375) database_kw_opt ::= DATABASE */
287, /* (376) database_kw_opt ::= */
290, /* (377) kwcolumn_opt ::= */
290, /* (378) kwcolumn_opt ::= COLUMNKW */
292, /* (379) vtabarglist ::= vtabarg */
292, /* (380) vtabarglist ::= vtabarglist COMMA vtabarg */
293, /* (381) vtabarg ::= vtabarg vtabargtoken */
296, /* (382) anylist ::= */
296, /* (383) anylist ::= anylist LP anylist RP */
296, /* (384) anylist ::= anylist ANY */
261, /* (385) with ::= */
};
/* For rule J, yyRuleInfoNRhs[J] contains the negative of the number
** of symbols on the right-hand side of that rule. */
static const signed char yyRuleInfoNRhs[] = {
-1, /* (0) explain ::= EXPLAIN */
-3, /* (1) explain ::= EXPLAIN QUERY PLAN */
|
| ︙ | ︙ | |||
158021 158022 158023 158024 158025 158026 158027 |
-5, /* (152) setlist ::= setlist COMMA nm EQ expr */
-7, /* (153) setlist ::= setlist COMMA LP idlist RP EQ expr */
-3, /* (154) setlist ::= nm EQ expr */
-5, /* (155) setlist ::= LP idlist RP EQ expr */
-7, /* (156) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
-7, /* (157) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
0, /* (158) upsert ::= */
| | | > | | | | | | | | | | | | | | | | | | | | | | | < | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | | > | | | | | | | | | | | | | | | | | | | | | | < | | | | > | | | | | | | | | | | | | | | | | 158657 158658 158659 158660 158661 158662 158663 158664 158665 158666 158667 158668 158669 158670 158671 158672 158673 158674 158675 158676 158677 158678 158679 158680 158681 158682 158683 158684 158685 158686 158687 158688 158689 158690 158691 158692 158693 158694 158695 158696 158697 158698 158699 158700 158701 158702 158703 158704 158705 158706 158707 158708 158709 158710 158711 158712 158713 158714 158715 158716 158717 158718 158719 158720 158721 158722 158723 158724 158725 158726 158727 158728 158729 158730 158731 158732 158733 158734 158735 158736 158737 158738 158739 158740 158741 158742 158743 158744 158745 158746 158747 158748 158749 158750 158751 158752 158753 158754 158755 158756 158757 158758 158759 158760 158761 158762 158763 158764 158765 158766 158767 158768 158769 158770 158771 158772 158773 158774 158775 158776 158777 158778 158779 158780 158781 158782 158783 158784 158785 158786 158787 158788 158789 158790 158791 158792 158793 158794 158795 158796 158797 158798 158799 158800 158801 158802 158803 158804 158805 158806 158807 158808 158809 158810 158811 158812 158813 158814 158815 158816 158817 158818 158819 158820 158821 158822 158823 158824 158825 158826 158827 158828 158829 158830 158831 158832 158833 158834 158835 158836 158837 158838 158839 158840 158841 158842 158843 158844 158845 158846 158847 158848 158849 158850 158851 158852 158853 158854 158855 158856 158857 158858 158859 158860 158861 158862 158863 158864 158865 158866 158867 158868 158869 158870 158871 158872 158873 158874 158875 158876 158877 158878 158879 158880 158881 158882 158883 158884 158885 158886 158887 158888 158889 158890 158891 158892 158893 158894 158895 158896 158897 |
-5, /* (152) setlist ::= setlist COMMA nm EQ expr */
-7, /* (153) setlist ::= setlist COMMA LP idlist RP EQ expr */
-3, /* (154) setlist ::= nm EQ expr */
-5, /* (155) setlist ::= LP idlist RP EQ expr */
-7, /* (156) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */
-7, /* (157) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */
0, /* (158) upsert ::= */
-12, /* (159) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
-9, /* (160) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
-4, /* (161) upsert ::= ON CONFLICT DO NOTHING */
-7, /* (162) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt */
-2, /* (163) insert_cmd ::= INSERT orconf */
-1, /* (164) insert_cmd ::= REPLACE */
0, /* (165) idlist_opt ::= */
-3, /* (166) idlist_opt ::= LP idlist RP */
-3, /* (167) idlist ::= idlist COMMA nm */
-1, /* (168) idlist ::= nm */
-3, /* (169) expr ::= LP expr RP */
-1, /* (170) expr ::= ID|INDEXED */
-1, /* (171) expr ::= JOIN_KW */
-3, /* (172) expr ::= nm DOT nm */
-5, /* (173) expr ::= nm DOT nm DOT nm */
-1, /* (174) term ::= NULL|FLOAT|BLOB */
-1, /* (175) term ::= STRING */
-1, /* (176) term ::= INTEGER */
-1, /* (177) expr ::= VARIABLE */
-3, /* (178) expr ::= expr COLLATE ID|STRING */
-6, /* (179) expr ::= CAST LP expr AS typetoken RP */
-5, /* (180) expr ::= ID|INDEXED LP distinct exprlist RP */
-4, /* (181) expr ::= ID|INDEXED LP STAR RP */
-6, /* (182) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
-5, /* (183) expr ::= ID|INDEXED LP STAR RP filter_over */
-1, /* (184) term ::= CTIME_KW */
-5, /* (185) expr ::= LP nexprlist COMMA expr RP */
-3, /* (186) expr ::= expr AND expr */
-3, /* (187) expr ::= expr OR expr */
-3, /* (188) expr ::= expr LT|GT|GE|LE expr */
-3, /* (189) expr ::= expr EQ|NE expr */
-3, /* (190) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
-3, /* (191) expr ::= expr PLUS|MINUS expr */
-3, /* (192) expr ::= expr STAR|SLASH|REM expr */
-3, /* (193) expr ::= expr CONCAT expr */
-2, /* (194) likeop ::= NOT LIKE_KW|MATCH */
-3, /* (195) expr ::= expr likeop expr */
-5, /* (196) expr ::= expr likeop expr ESCAPE expr */
-2, /* (197) expr ::= expr ISNULL|NOTNULL */
-3, /* (198) expr ::= expr NOT NULL */
-3, /* (199) expr ::= expr IS expr */
-4, /* (200) expr ::= expr IS NOT expr */
-2, /* (201) expr ::= NOT expr */
-2, /* (202) expr ::= BITNOT expr */
-2, /* (203) expr ::= PLUS|MINUS expr */
-1, /* (204) between_op ::= BETWEEN */
-2, /* (205) between_op ::= NOT BETWEEN */
-5, /* (206) expr ::= expr between_op expr AND expr */
-1, /* (207) in_op ::= IN */
-2, /* (208) in_op ::= NOT IN */
-5, /* (209) expr ::= expr in_op LP exprlist RP */
-3, /* (210) expr ::= LP select RP */
-5, /* (211) expr ::= expr in_op LP select RP */
-5, /* (212) expr ::= expr in_op nm dbnm paren_exprlist */
-4, /* (213) expr ::= EXISTS LP select RP */
-5, /* (214) expr ::= CASE case_operand case_exprlist case_else END */
-5, /* (215) case_exprlist ::= case_exprlist WHEN expr THEN expr */
-4, /* (216) case_exprlist ::= WHEN expr THEN expr */
-2, /* (217) case_else ::= ELSE expr */
0, /* (218) case_else ::= */
-1, /* (219) case_operand ::= expr */
0, /* (220) case_operand ::= */
0, /* (221) exprlist ::= */
-3, /* (222) nexprlist ::= nexprlist COMMA expr */
-1, /* (223) nexprlist ::= expr */
0, /* (224) paren_exprlist ::= */
-3, /* (225) paren_exprlist ::= LP exprlist RP */
-12, /* (226) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
-1, /* (227) uniqueflag ::= UNIQUE */
0, /* (228) uniqueflag ::= */
0, /* (229) eidlist_opt ::= */
-3, /* (230) eidlist_opt ::= LP eidlist RP */
-5, /* (231) eidlist ::= eidlist COMMA nm collate sortorder */
-3, /* (232) eidlist ::= nm collate sortorder */
0, /* (233) collate ::= */
-2, /* (234) collate ::= COLLATE ID|STRING */
-4, /* (235) cmd ::= DROP INDEX ifexists fullname */
-2, /* (236) cmd ::= VACUUM vinto */
-3, /* (237) cmd ::= VACUUM nm vinto */
-2, /* (238) vinto ::= INTO expr */
0, /* (239) vinto ::= */
-3, /* (240) cmd ::= PRAGMA nm dbnm */
-5, /* (241) cmd ::= PRAGMA nm dbnm EQ nmnum */
-6, /* (242) cmd ::= PRAGMA nm dbnm LP nmnum RP */
-5, /* (243) cmd ::= PRAGMA nm dbnm EQ minus_num */
-6, /* (244) cmd ::= PRAGMA nm dbnm LP minus_num RP */
-2, /* (245) plus_num ::= PLUS INTEGER|FLOAT */
-2, /* (246) minus_num ::= MINUS INTEGER|FLOAT */
-5, /* (247) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
-11, /* (248) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
-1, /* (249) trigger_time ::= BEFORE|AFTER */
-2, /* (250) trigger_time ::= INSTEAD OF */
0, /* (251) trigger_time ::= */
-1, /* (252) trigger_event ::= DELETE|INSERT */
-1, /* (253) trigger_event ::= UPDATE */
-3, /* (254) trigger_event ::= UPDATE OF idlist */
0, /* (255) when_clause ::= */
-2, /* (256) when_clause ::= WHEN expr */
-3, /* (257) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
-2, /* (258) trigger_cmd_list ::= trigger_cmd SEMI */
-3, /* (259) trnm ::= nm DOT nm */
-3, /* (260) tridxby ::= INDEXED BY nm */
-2, /* (261) tridxby ::= NOT INDEXED */
-9, /* (262) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
-8, /* (263) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
-6, /* (264) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
-3, /* (265) trigger_cmd ::= scanpt select scanpt */
-4, /* (266) expr ::= RAISE LP IGNORE RP */
-6, /* (267) expr ::= RAISE LP raisetype COMMA nm RP */
-1, /* (268) raisetype ::= ROLLBACK */
-1, /* (269) raisetype ::= ABORT */
-1, /* (270) raisetype ::= FAIL */
-4, /* (271) cmd ::= DROP TRIGGER ifexists fullname */
-6, /* (272) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
-3, /* (273) cmd ::= DETACH database_kw_opt expr */
0, /* (274) key_opt ::= */
-2, /* (275) key_opt ::= KEY expr */
-1, /* (276) cmd ::= REINDEX */
-3, /* (277) cmd ::= REINDEX nm dbnm */
-1, /* (278) cmd ::= ANALYZE */
-3, /* (279) cmd ::= ANALYZE nm dbnm */
-6, /* (280) cmd ::= ALTER TABLE fullname RENAME TO nm */
-7, /* (281) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
-1, /* (282) add_column_fullname ::= fullname */
-8, /* (283) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
-1, /* (284) cmd ::= create_vtab */
-4, /* (285) cmd ::= create_vtab LP vtabarglist RP */
-8, /* (286) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
0, /* (287) vtabarg ::= */
-1, /* (288) vtabargtoken ::= ANY */
-3, /* (289) vtabargtoken ::= lp anylist RP */
-1, /* (290) lp ::= LP */
-2, /* (291) with ::= WITH wqlist */
-3, /* (292) with ::= WITH RECURSIVE wqlist */
-6, /* (293) wqlist ::= nm eidlist_opt AS LP select RP */
-8, /* (294) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
-1, /* (295) windowdefn_list ::= windowdefn */
-3, /* (296) windowdefn_list ::= windowdefn_list COMMA windowdefn */
-5, /* (297) windowdefn ::= nm AS LP window RP */
-5, /* (298) window ::= PARTITION BY nexprlist orderby_opt frame_opt */
-6, /* (299) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
-4, /* (300) window ::= ORDER BY sortlist frame_opt */
-5, /* (301) window ::= nm ORDER BY sortlist frame_opt */
-1, /* (302) window ::= frame_opt */
-2, /* (303) window ::= nm frame_opt */
0, /* (304) frame_opt ::= */
-3, /* (305) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
-6, /* (306) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
-1, /* (307) range_or_rows ::= RANGE|ROWS|GROUPS */
-1, /* (308) frame_bound_s ::= frame_bound */
-2, /* (309) frame_bound_s ::= UNBOUNDED PRECEDING */
-1, /* (310) frame_bound_e ::= frame_bound */
-2, /* (311) frame_bound_e ::= UNBOUNDED FOLLOWING */
-2, /* (312) frame_bound ::= expr PRECEDING|FOLLOWING */
-2, /* (313) frame_bound ::= CURRENT ROW */
0, /* (314) frame_exclude_opt ::= */
-2, /* (315) frame_exclude_opt ::= EXCLUDE frame_exclude */
-2, /* (316) frame_exclude ::= NO OTHERS */
-2, /* (317) frame_exclude ::= CURRENT ROW */
-1, /* (318) frame_exclude ::= GROUP|TIES */
-2, /* (319) window_clause ::= WINDOW windowdefn_list */
-2, /* (320) filter_over ::= filter_clause over_clause */
-1, /* (321) filter_over ::= over_clause */
-1, /* (322) filter_over ::= filter_clause */
-4, /* (323) over_clause ::= OVER LP window RP */
-2, /* (324) over_clause ::= OVER nm */
-5, /* (325) filter_clause ::= FILTER LP WHERE expr RP */
-1, /* (326) input ::= cmdlist */
-2, /* (327) cmdlist ::= cmdlist ecmd */
-1, /* (328) cmdlist ::= ecmd */
-1, /* (329) ecmd ::= SEMI */
-2, /* (330) ecmd ::= cmdx SEMI */
-3, /* (331) ecmd ::= explain cmdx SEMI */
0, /* (332) trans_opt ::= */
-1, /* (333) trans_opt ::= TRANSACTION */
-2, /* (334) trans_opt ::= TRANSACTION nm */
-1, /* (335) savepoint_opt ::= SAVEPOINT */
0, /* (336) savepoint_opt ::= */
-2, /* (337) cmd ::= create_table create_table_args */
-4, /* (338) columnlist ::= columnlist COMMA columnname carglist */
-2, /* (339) columnlist ::= columnname carglist */
-1, /* (340) nm ::= ID|INDEXED */
-1, /* (341) nm ::= STRING */
-1, /* (342) nm ::= JOIN_KW */
-1, /* (343) typetoken ::= typename */
-1, /* (344) typename ::= ID|STRING */
-1, /* (345) signed ::= plus_num */
-1, /* (346) signed ::= minus_num */
-2, /* (347) carglist ::= carglist ccons */
0, /* (348) carglist ::= */
-2, /* (349) ccons ::= NULL onconf */
-4, /* (350) ccons ::= GENERATED ALWAYS AS generated */
-2, /* (351) ccons ::= AS generated */
-2, /* (352) conslist_opt ::= COMMA conslist */
-3, /* (353) conslist ::= conslist tconscomma tcons */
-1, /* (354) conslist ::= tcons */
0, /* (355) tconscomma ::= */
-1, /* (356) defer_subclause_opt ::= defer_subclause */
-1, /* (357) resolvetype ::= raisetype */
-1, /* (358) selectnowith ::= oneselect */
-1, /* (359) oneselect ::= values */
-2, /* (360) sclp ::= selcollist COMMA */
-1, /* (361) as ::= ID|STRING */
-1, /* (362) expr ::= term */
-1, /* (363) likeop ::= LIKE_KW|MATCH */
-1, /* (364) exprlist ::= nexprlist */
-1, /* (365) nmnum ::= plus_num */
-1, /* (366) nmnum ::= nm */
-1, /* (367) nmnum ::= ON */
-1, /* (368) nmnum ::= DELETE */
-1, /* (369) nmnum ::= DEFAULT */
-1, /* (370) plus_num ::= INTEGER|FLOAT */
0, /* (371) foreach_clause ::= */
-3, /* (372) foreach_clause ::= FOR EACH ROW */
-1, /* (373) trnm ::= nm */
0, /* (374) tridxby ::= */
-1, /* (375) database_kw_opt ::= DATABASE */
0, /* (376) database_kw_opt ::= */
0, /* (377) kwcolumn_opt ::= */
-1, /* (378) kwcolumn_opt ::= COLUMNKW */
-1, /* (379) vtabarglist ::= vtabarg */
-3, /* (380) vtabarglist ::= vtabarglist COMMA vtabarg */
-2, /* (381) vtabarg ::= vtabarg vtabargtoken */
0, /* (382) anylist ::= */
-4, /* (383) anylist ::= anylist LP anylist RP */
-2, /* (384) anylist ::= anylist ANY */
0, /* (385) with ::= */
};
static void yy_accept(yyParser*); /* Forward Declaration */
/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
|
| ︙ | ︙ | |||
158355 158356 158357 158358 158359 158360 158361 |
break;
case 4: /* transtype ::= */
{yymsp[1].minor.yy192 = TK_DEFERRED;}
break;
case 5: /* transtype ::= DEFERRED */
case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
| | | 158992 158993 158994 158995 158996 158997 158998 158999 159000 159001 159002 159003 159004 159005 159006 |
break;
case 4: /* transtype ::= */
{yymsp[1].minor.yy192 = TK_DEFERRED;}
break;
case 5: /* transtype ::= DEFERRED */
case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6);
case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
case 307: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==307);
{yymsp[0].minor.yy192 = yymsp[0].major; /*A-overwrites-X*/}
break;
case 8: /* cmd ::= COMMIT|END trans_opt */
case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
{sqlite3EndTransaction(pParse,yymsp[-1].major);}
break;
case 10: /* cmd ::= SAVEPOINT nm */
|
| ︙ | ︙ | |||
158393 158394 158395 158396 158397 158398 158399 |
case 18: /* temp ::= */ yytestcase(yyruleno==18);
case 21: /* table_options ::= */ yytestcase(yyruleno==21);
case 45: /* autoinc ::= */ yytestcase(yyruleno==45);
case 60: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==60);
case 70: /* defer_subclause_opt ::= */ yytestcase(yyruleno==70);
case 79: /* ifexists ::= */ yytestcase(yyruleno==79);
case 96: /* distinct ::= */ yytestcase(yyruleno==96);
| | | 159030 159031 159032 159033 159034 159035 159036 159037 159038 159039 159040 159041 159042 159043 159044 |
case 18: /* temp ::= */ yytestcase(yyruleno==18);
case 21: /* table_options ::= */ yytestcase(yyruleno==21);
case 45: /* autoinc ::= */ yytestcase(yyruleno==45);
case 60: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==60);
case 70: /* defer_subclause_opt ::= */ yytestcase(yyruleno==70);
case 79: /* ifexists ::= */ yytestcase(yyruleno==79);
case 96: /* distinct ::= */ yytestcase(yyruleno==96);
case 233: /* collate ::= */ yytestcase(yyruleno==233);
{yymsp[1].minor.yy192 = 0;}
break;
case 16: /* ifnotexists ::= IF NOT EXISTS */
{yymsp[-2].minor.yy192 = 1;}
break;
case 17: /* temp ::= TEMP */
case 46: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==46);
|
| ︙ | ︙ | |||
158552 158553 158554 158555 158556 158557 158558 |
{ yymsp[-1].minor.yy192 = OE_None; /* EV: R-33326-45252 */}
break;
case 58: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
{yymsp[-2].minor.yy192 = 0;}
break;
case 59: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
case 74: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==74);
| | | | | | 159189 159190 159191 159192 159193 159194 159195 159196 159197 159198 159199 159200 159201 159202 159203 159204 159205 159206 159207 159208 159209 159210 |
{ yymsp[-1].minor.yy192 = OE_None; /* EV: R-33326-45252 */}
break;
case 58: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
{yymsp[-2].minor.yy192 = 0;}
break;
case 59: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
case 74: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==74);
case 163: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==163);
{yymsp[-1].minor.yy192 = yymsp[0].minor.yy192;}
break;
case 61: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
case 78: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==78);
case 205: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==205);
case 208: /* in_op ::= NOT IN */ yytestcase(yyruleno==208);
case 234: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==234);
{yymsp[-1].minor.yy192 = 1;}
break;
case 62: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
{yymsp[-1].minor.yy192 = 0;}
break;
case 64: /* tconscomma ::= COMMA */
{pParse->constraintName.n = 0;}
|
| ︙ | ︙ | |||
158595 158596 158597 158598 158599 158600 158601 |
case 72: /* onconf ::= ON CONFLICT resolvetype */
{yymsp[-2].minor.yy192 = yymsp[0].minor.yy192;}
break;
case 75: /* resolvetype ::= IGNORE */
{yymsp[0].minor.yy192 = OE_Ignore;}
break;
case 76: /* resolvetype ::= REPLACE */
| | | 159232 159233 159234 159235 159236 159237 159238 159239 159240 159241 159242 159243 159244 159245 159246 |
case 72: /* onconf ::= ON CONFLICT resolvetype */
{yymsp[-2].minor.yy192 = yymsp[0].minor.yy192;}
break;
case 75: /* resolvetype ::= IGNORE */
{yymsp[0].minor.yy192 = OE_Ignore;}
break;
case 76: /* resolvetype ::= REPLACE */
case 164: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==164);
{yymsp[0].minor.yy192 = OE_Replace;}
break;
case 77: /* cmd ::= DROP TABLE ifexists fullname */
{
sqlite3DropTable(pParse, yymsp[0].minor.yy47, 0, yymsp[-1].minor.yy192);
}
break;
|
| ︙ | ︙ | |||
158727 158728 158729 158730 158731 158732 158733 |
break;
case 95: /* distinct ::= ALL */
{yymsp[0].minor.yy192 = SF_All;}
break;
case 97: /* sclp ::= */
case 130: /* orderby_opt ::= */ yytestcase(yyruleno==130);
case 140: /* groupby_opt ::= */ yytestcase(yyruleno==140);
| | | | | 159364 159365 159366 159367 159368 159369 159370 159371 159372 159373 159374 159375 159376 159377 159378 159379 159380 |
break;
case 95: /* distinct ::= ALL */
{yymsp[0].minor.yy192 = SF_All;}
break;
case 97: /* sclp ::= */
case 130: /* orderby_opt ::= */ yytestcase(yyruleno==130);
case 140: /* groupby_opt ::= */ yytestcase(yyruleno==140);
case 221: /* exprlist ::= */ yytestcase(yyruleno==221);
case 224: /* paren_exprlist ::= */ yytestcase(yyruleno==224);
case 229: /* eidlist_opt ::= */ yytestcase(yyruleno==229);
{yymsp[1].minor.yy242 = 0;}
break;
case 98: /* selcollist ::= sclp scanpt expr scanpt as */
{
yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy242, yymsp[-2].minor.yy202);
if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy242, &yymsp[0].minor.yy0, 1);
sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy242,yymsp[-3].minor.yy436,yymsp[-1].minor.yy436);
|
| ︙ | ︙ | |||
158755 158756 158757 158758 158759 158760 158761 |
Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, pDot);
}
break;
case 101: /* as ::= AS nm */
case 112: /* dbnm ::= DOT nm */ yytestcase(yyruleno==112);
| | | | 159392 159393 159394 159395 159396 159397 159398 159399 159400 159401 159402 159403 159404 159405 159406 159407 |
Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight);
yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, pDot);
}
break;
case 101: /* as ::= AS nm */
case 112: /* dbnm ::= DOT nm */ yytestcase(yyruleno==112);
case 245: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==245);
case 246: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==246);
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
break;
case 103: /* from ::= */
case 106: /* stl_prefix ::= */ yytestcase(yyruleno==106);
{yymsp[1].minor.yy47 = 0;}
break;
case 104: /* from ::= FROM seltablist */
|
| ︙ | ︙ | |||
158872 158873 158874 158875 158876 158877 158878 |
break;
case 122: /* joinop ::= JOIN_KW nm nm JOIN */
{yymsp[-3].minor.yy192 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
break;
case 123: /* on_opt ::= ON expr */
case 143: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==143);
case 150: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==150);
| | | | | | | | 159509 159510 159511 159512 159513 159514 159515 159516 159517 159518 159519 159520 159521 159522 159523 159524 159525 159526 159527 159528 159529 159530 159531 159532 159533 159534 159535 159536 159537 159538 159539 159540 159541 159542 159543 159544 159545 159546 |
break;
case 122: /* joinop ::= JOIN_KW nm nm JOIN */
{yymsp[-3].minor.yy192 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
break;
case 123: /* on_opt ::= ON expr */
case 143: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==143);
case 150: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==150);
case 217: /* case_else ::= ELSE expr */ yytestcase(yyruleno==217);
case 238: /* vinto ::= INTO expr */ yytestcase(yyruleno==238);
{yymsp[-1].minor.yy202 = yymsp[0].minor.yy202;}
break;
case 124: /* on_opt ::= */
case 142: /* having_opt ::= */ yytestcase(yyruleno==142);
case 144: /* limit_opt ::= */ yytestcase(yyruleno==144);
case 149: /* where_opt ::= */ yytestcase(yyruleno==149);
case 218: /* case_else ::= */ yytestcase(yyruleno==218);
case 220: /* case_operand ::= */ yytestcase(yyruleno==220);
case 239: /* vinto ::= */ yytestcase(yyruleno==239);
{yymsp[1].minor.yy202 = 0;}
break;
case 126: /* indexed_opt ::= INDEXED BY nm */
{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
break;
case 127: /* indexed_opt ::= NOT INDEXED */
{yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
break;
case 128: /* using_opt ::= USING LP idlist RP */
{yymsp[-3].minor.yy600 = yymsp[-1].minor.yy600;}
break;
case 129: /* using_opt ::= */
case 165: /* idlist_opt ::= */ yytestcase(yyruleno==165);
{yymsp[1].minor.yy600 = 0;}
break;
case 131: /* orderby_opt ::= ORDER BY sortlist */
case 141: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==141);
{yymsp[-2].minor.yy242 = yymsp[0].minor.yy242;}
break;
case 132: /* sortlist ::= sortlist COMMA expr sortorder nulls */
|
| ︙ | ︙ | |||
158989 158990 158991 158992 158993 158994 158995 |
{
sqlite3Insert(pParse, yymsp[-3].minor.yy47, 0, yymsp[-2].minor.yy600, yymsp[-5].minor.yy192, 0);
}
break;
case 158: /* upsert ::= */
{ yymsp[1].minor.yy318 = 0; }
break;
| | | | | | > > > | | | | | | | | | | | | | 159626 159627 159628 159629 159630 159631 159632 159633 159634 159635 159636 159637 159638 159639 159640 159641 159642 159643 159644 159645 159646 159647 159648 159649 159650 159651 159652 159653 159654 159655 159656 159657 159658 159659 159660 159661 159662 159663 159664 159665 159666 159667 159668 159669 159670 159671 159672 159673 159674 159675 159676 159677 159678 159679 159680 159681 159682 159683 159684 159685 159686 159687 159688 159689 159690 159691 159692 159693 159694 159695 159696 159697 159698 159699 159700 159701 159702 159703 159704 |
{
sqlite3Insert(pParse, yymsp[-3].minor.yy47, 0, yymsp[-2].minor.yy600, yymsp[-5].minor.yy192, 0);
}
break;
case 158: /* upsert ::= */
{ yymsp[1].minor.yy318 = 0; }
break;
case 159: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */
{ yymsp[-11].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy242,yymsp[-6].minor.yy202,yymsp[-2].minor.yy242,yymsp[-1].minor.yy202,yymsp[0].minor.yy318);}
break;
case 160: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */
{ yymsp[-8].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy242,yymsp[-3].minor.yy202,0,0,yymsp[0].minor.yy318); }
break;
case 161: /* upsert ::= ON CONFLICT DO NOTHING */
{ yymsp[-3].minor.yy318 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); }
break;
case 162: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt */
{ yymsp[-6].minor.yy318 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-1].minor.yy242,yymsp[0].minor.yy202,0);}
break;
case 166: /* idlist_opt ::= LP idlist RP */
{yymsp[-2].minor.yy600 = yymsp[-1].minor.yy600;}
break;
case 167: /* idlist ::= idlist COMMA nm */
{yymsp[-2].minor.yy600 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy600,&yymsp[0].minor.yy0);}
break;
case 168: /* idlist ::= nm */
{yymsp[0].minor.yy600 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
break;
case 169: /* expr ::= LP expr RP */
{yymsp[-2].minor.yy202 = yymsp[-1].minor.yy202;}
break;
case 170: /* expr ::= ID|INDEXED */
case 171: /* expr ::= JOIN_KW */ yytestcase(yyruleno==171);
{yymsp[0].minor.yy202=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
break;
case 172: /* expr ::= nm DOT nm */
{
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
if( IN_RENAME_OBJECT ){
sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0);
sqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0);
}
yylhsminor.yy202 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
}
yymsp[-2].minor.yy202 = yylhsminor.yy202;
break;
case 173: /* expr ::= nm DOT nm DOT nm */
{
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3);
if( IN_RENAME_OBJECT ){
sqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0);
sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0);
}
yylhsminor.yy202 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
}
yymsp[-4].minor.yy202 = yylhsminor.yy202;
break;
case 174: /* term ::= NULL|FLOAT|BLOB */
case 175: /* term ::= STRING */ yytestcase(yyruleno==175);
{yymsp[0].minor.yy202=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
break;
case 176: /* term ::= INTEGER */
{
yylhsminor.yy202 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
}
yymsp[0].minor.yy202 = yylhsminor.yy202;
break;
case 177: /* expr ::= VARIABLE */
{
if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
u32 n = yymsp[0].minor.yy0.n;
yymsp[0].minor.yy202 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0);
sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy202, n);
}else{
/* When doing a nested parse, one can include terms in an expression
|
| ︙ | ︙ | |||
159072 159073 159074 159075 159076 159077 159078 |
}else{
yymsp[0].minor.yy202 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
if( yymsp[0].minor.yy202 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy202->iTable);
}
}
}
break;
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 159712 159713 159714 159715 159716 159717 159718 159719 159720 159721 159722 159723 159724 159725 159726 159727 159728 159729 159730 159731 159732 159733 159734 159735 159736 159737 159738 159739 159740 159741 159742 159743 159744 159745 159746 159747 159748 159749 159750 159751 159752 159753 159754 159755 159756 159757 159758 159759 159760 159761 159762 159763 159764 159765 159766 159767 159768 159769 159770 159771 159772 159773 159774 159775 159776 159777 159778 159779 159780 159781 159782 159783 159784 159785 159786 159787 159788 159789 159790 159791 159792 159793 159794 159795 159796 159797 159798 159799 159800 159801 159802 159803 159804 159805 159806 159807 159808 159809 159810 159811 159812 159813 159814 159815 159816 159817 159818 159819 159820 159821 159822 159823 159824 159825 159826 159827 159828 159829 159830 159831 159832 159833 159834 159835 159836 159837 159838 159839 159840 159841 159842 159843 159844 159845 159846 159847 159848 159849 159850 159851 159852 159853 159854 159855 159856 159857 159858 159859 159860 159861 159862 159863 159864 159865 159866 159867 159868 |
}else{
yymsp[0].minor.yy202 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0);
if( yymsp[0].minor.yy202 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy202->iTable);
}
}
}
break;
case 178: /* expr ::= expr COLLATE ID|STRING */
{
yymsp[-2].minor.yy202 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy202, &yymsp[0].minor.yy0, 1);
}
break;
case 179: /* expr ::= CAST LP expr AS typetoken RP */
{
yymsp[-5].minor.yy202 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy202, yymsp[-3].minor.yy202, 0);
}
break;
case 180: /* expr ::= ID|INDEXED LP distinct exprlist RP */
{
yylhsminor.yy202 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy192);
}
yymsp[-4].minor.yy202 = yylhsminor.yy202;
break;
case 181: /* expr ::= ID|INDEXED LP STAR RP */
{
yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0);
}
yymsp[-3].minor.yy202 = yylhsminor.yy202;
break;
case 182: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */
{
yylhsminor.yy202 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy242, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy192);
sqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303);
}
yymsp[-5].minor.yy202 = yylhsminor.yy202;
break;
case 183: /* expr ::= ID|INDEXED LP STAR RP filter_over */
{
yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0);
sqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303);
}
yymsp[-4].minor.yy202 = yylhsminor.yy202;
break;
case 184: /* term ::= CTIME_KW */
{
yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0);
}
yymsp[0].minor.yy202 = yylhsminor.yy202;
break;
case 185: /* expr ::= LP nexprlist COMMA expr RP */
{
ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy242, yymsp[-1].minor.yy202);
yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
if( yymsp[-4].minor.yy202 ){
yymsp[-4].minor.yy202->x.pList = pList;
if( ALWAYS(pList->nExpr) ){
yymsp[-4].minor.yy202->flags |= pList->a[0].pExpr->flags & EP_Propagate;
}
}else{
sqlite3ExprListDelete(pParse->db, pList);
}
}
break;
case 186: /* expr ::= expr AND expr */
{yymsp[-2].minor.yy202=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);}
break;
case 187: /* expr ::= expr OR expr */
case 188: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==188);
case 189: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==189);
case 190: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==190);
case 191: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==191);
case 192: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==192);
case 193: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==193);
{yymsp[-2].minor.yy202=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);}
break;
case 194: /* likeop ::= NOT LIKE_KW|MATCH */
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
break;
case 195: /* expr ::= expr likeop expr */
{
ExprList *pList;
int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
yymsp[-1].minor.yy0.n &= 0x7fffffff;
pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy202);
pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy202);
yymsp[-2].minor.yy202 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0);
if( bNot ) yymsp[-2].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy202, 0);
if( yymsp[-2].minor.yy202 ) yymsp[-2].minor.yy202->flags |= EP_InfixFunc;
}
break;
case 196: /* expr ::= expr likeop expr ESCAPE expr */
{
ExprList *pList;
int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
yymsp[-3].minor.yy0.n &= 0x7fffffff;
pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202);
pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy202);
pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy202);
yymsp[-4].minor.yy202 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0);
if( bNot ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
if( yymsp[-4].minor.yy202 ) yymsp[-4].minor.yy202->flags |= EP_InfixFunc;
}
break;
case 197: /* expr ::= expr ISNULL|NOTNULL */
{yymsp[-1].minor.yy202 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy202,0);}
break;
case 198: /* expr ::= expr NOT NULL */
{yymsp[-2].minor.yy202 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy202,0);}
break;
case 199: /* expr ::= expr IS expr */
{
yymsp[-2].minor.yy202 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy202, yymsp[-2].minor.yy202, TK_ISNULL);
}
break;
case 200: /* expr ::= expr IS NOT expr */
{
yymsp[-3].minor.yy202 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy202,yymsp[0].minor.yy202);
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy202, yymsp[-3].minor.yy202, TK_NOTNULL);
}
break;
case 201: /* expr ::= NOT expr */
case 202: /* expr ::= BITNOT expr */ yytestcase(yyruleno==202);
{yymsp[-1].minor.yy202 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy202, 0);/*A-overwrites-B*/}
break;
case 203: /* expr ::= PLUS|MINUS expr */
{
yymsp[-1].minor.yy202 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy202, 0);
/*A-overwrites-B*/
}
break;
case 204: /* between_op ::= BETWEEN */
case 207: /* in_op ::= IN */ yytestcase(yyruleno==207);
{yymsp[0].minor.yy192 = 0;}
break;
case 206: /* expr ::= expr between_op expr AND expr */
{
ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202);
pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy202);
yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy202, 0);
if( yymsp[-4].minor.yy202 ){
yymsp[-4].minor.yy202->x.pList = pList;
}else{
sqlite3ExprListDelete(pParse->db, pList);
}
if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
}
break;
case 209: /* expr ::= expr in_op LP exprlist RP */
{
if( yymsp[-1].minor.yy242==0 ){
/* Expressions of the form
**
** expr1 IN ()
** expr1 NOT IN ()
**
|
| ︙ | ︙ | |||
159246 159247 159248 159249 159250 159251 159252 |
}else{
sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy242);
}
if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
}
}
break;
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 159886 159887 159888 159889 159890 159891 159892 159893 159894 159895 159896 159897 159898 159899 159900 159901 159902 159903 159904 159905 159906 159907 159908 159909 159910 159911 159912 159913 159914 159915 159916 159917 159918 159919 159920 159921 159922 159923 159924 159925 159926 159927 159928 159929 159930 159931 159932 159933 159934 159935 159936 159937 159938 159939 159940 159941 159942 159943 159944 159945 159946 159947 159948 159949 159950 159951 159952 159953 159954 159955 159956 159957 159958 159959 159960 159961 159962 159963 159964 159965 159966 159967 159968 159969 159970 159971 159972 159973 159974 159975 159976 159977 159978 159979 159980 159981 159982 159983 159984 159985 159986 159987 159988 159989 159990 159991 159992 159993 159994 159995 159996 159997 159998 159999 160000 160001 160002 160003 160004 160005 160006 160007 160008 160009 160010 160011 160012 160013 160014 160015 160016 160017 160018 160019 160020 160021 160022 160023 160024 160025 160026 160027 160028 160029 160030 160031 160032 160033 160034 160035 160036 160037 160038 160039 160040 160041 160042 160043 160044 160045 160046 160047 160048 160049 160050 160051 160052 160053 160054 160055 160056 160057 160058 160059 160060 160061 160062 160063 160064 160065 160066 160067 160068 160069 160070 160071 160072 160073 160074 160075 160076 160077 160078 160079 160080 160081 160082 160083 160084 160085 160086 160087 160088 160089 160090 160091 160092 160093 160094 160095 160096 160097 160098 160099 160100 160101 160102 160103 160104 160105 160106 160107 160108 160109 160110 160111 160112 160113 160114 160115 160116 160117 160118 160119 160120 160121 160122 160123 160124 160125 160126 160127 160128 160129 160130 160131 160132 160133 160134 160135 160136 160137 160138 160139 160140 160141 160142 160143 160144 160145 160146 160147 160148 160149 160150 160151 160152 160153 160154 160155 160156 160157 160158 160159 160160 160161 160162 160163 160164 160165 160166 160167 160168 160169 160170 160171 160172 160173 160174 160175 160176 160177 160178 160179 160180 160181 160182 160183 160184 160185 160186 160187 160188 160189 160190 160191 160192 160193 160194 160195 160196 160197 160198 160199 160200 160201 160202 160203 160204 160205 160206 160207 160208 160209 160210 160211 160212 160213 160214 160215 160216 160217 160218 160219 160220 160221 160222 160223 160224 160225 160226 160227 160228 160229 160230 160231 160232 160233 160234 160235 160236 160237 160238 160239 160240 160241 160242 160243 160244 160245 160246 160247 160248 160249 160250 160251 160252 160253 160254 160255 160256 160257 160258 160259 160260 160261 160262 160263 160264 160265 160266 160267 160268 160269 160270 160271 160272 160273 160274 160275 160276 160277 160278 160279 160280 160281 160282 160283 160284 160285 160286 160287 160288 160289 160290 160291 160292 160293 160294 160295 160296 160297 160298 160299 160300 160301 160302 160303 160304 160305 160306 160307 160308 160309 160310 160311 160312 160313 160314 160315 160316 160317 160318 160319 160320 160321 160322 160323 160324 160325 160326 160327 160328 160329 160330 160331 160332 160333 160334 160335 160336 160337 160338 160339 160340 160341 160342 160343 160344 160345 160346 160347 160348 160349 160350 160351 160352 160353 160354 160355 160356 160357 160358 160359 160360 160361 160362 160363 160364 160365 160366 160367 160368 160369 160370 160371 160372 160373 160374 160375 160376 160377 160378 160379 160380 160381 160382 160383 160384 160385 160386 160387 160388 160389 160390 160391 160392 160393 160394 160395 160396 160397 160398 160399 160400 160401 160402 160403 160404 160405 160406 160407 160408 160409 160410 160411 160412 160413 160414 |
}else{
sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy242);
}
if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
}
}
break;
case 210: /* expr ::= LP select RP */
{
yymsp[-2].minor.yy202 = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy202, yymsp[-1].minor.yy539);
}
break;
case 211: /* expr ::= expr in_op LP select RP */
{
yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0);
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, yymsp[-1].minor.yy539);
if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
}
break;
case 212: /* expr ::= expr in_op nm dbnm paren_exprlist */
{
SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0);
if( yymsp[0].minor.yy242 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy242);
yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0);
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, pSelect);
if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0);
}
break;
case 213: /* expr ::= EXISTS LP select RP */
{
Expr *p;
p = yymsp[-3].minor.yy202 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0);
sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy539);
}
break;
case 214: /* expr ::= CASE case_operand case_exprlist case_else END */
{
yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy202, 0);
if( yymsp[-4].minor.yy202 ){
yymsp[-4].minor.yy202->x.pList = yymsp[-1].minor.yy202 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[-1].minor.yy202) : yymsp[-2].minor.yy242;
sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy202);
}else{
sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy242);
sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy202);
}
}
break;
case 215: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
{
yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[-2].minor.yy202);
yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[0].minor.yy202);
}
break;
case 216: /* case_exprlist ::= WHEN expr THEN expr */
{
yymsp[-3].minor.yy242 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202);
yymsp[-3].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy242, yymsp[0].minor.yy202);
}
break;
case 219: /* case_operand ::= expr */
{yymsp[0].minor.yy202 = yymsp[0].minor.yy202; /*A-overwrites-X*/}
break;
case 222: /* nexprlist ::= nexprlist COMMA expr */
{yymsp[-2].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[0].minor.yy202);}
break;
case 223: /* nexprlist ::= expr */
{yymsp[0].minor.yy242 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy202); /*A-overwrites-Y*/}
break;
case 225: /* paren_exprlist ::= LP exprlist RP */
case 230: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==230);
{yymsp[-2].minor.yy242 = yymsp[-1].minor.yy242;}
break;
case 226: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
{
sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy242, yymsp[-10].minor.yy192,
&yymsp[-11].minor.yy0, yymsp[0].minor.yy202, SQLITE_SO_ASC, yymsp[-8].minor.yy192, SQLITE_IDXTYPE_APPDEF);
if( IN_RENAME_OBJECT && pParse->pNewIndex ){
sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0);
}
}
break;
case 227: /* uniqueflag ::= UNIQUE */
case 269: /* raisetype ::= ABORT */ yytestcase(yyruleno==269);
{yymsp[0].minor.yy192 = OE_Abort;}
break;
case 228: /* uniqueflag ::= */
{yymsp[1].minor.yy192 = OE_None;}
break;
case 231: /* eidlist ::= eidlist COMMA nm collate sortorder */
{
yymsp[-4].minor.yy242 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy242, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy192, yymsp[0].minor.yy192);
}
break;
case 232: /* eidlist ::= nm collate sortorder */
{
yymsp[-2].minor.yy242 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy192, yymsp[0].minor.yy192); /*A-overwrites-Y*/
}
break;
case 235: /* cmd ::= DROP INDEX ifexists fullname */
{sqlite3DropIndex(pParse, yymsp[0].minor.yy47, yymsp[-1].minor.yy192);}
break;
case 236: /* cmd ::= VACUUM vinto */
{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy202);}
break;
case 237: /* cmd ::= VACUUM nm vinto */
{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy202);}
break;
case 240: /* cmd ::= PRAGMA nm dbnm */
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
break;
case 241: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
break;
case 242: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
break;
case 243: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
break;
case 244: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
break;
case 247: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
{
Token all;
all.z = yymsp[-3].minor.yy0.z;
all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy447, &all);
}
break;
case 248: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
{
sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy192, yymsp[-4].minor.yy230.a, yymsp[-4].minor.yy230.b, yymsp[-2].minor.yy47, yymsp[0].minor.yy202, yymsp[-10].minor.yy192, yymsp[-8].minor.yy192);
yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
}
break;
case 249: /* trigger_time ::= BEFORE|AFTER */
{ yymsp[0].minor.yy192 = yymsp[0].major; /*A-overwrites-X*/ }
break;
case 250: /* trigger_time ::= INSTEAD OF */
{ yymsp[-1].minor.yy192 = TK_INSTEAD;}
break;
case 251: /* trigger_time ::= */
{ yymsp[1].minor.yy192 = TK_BEFORE; }
break;
case 252: /* trigger_event ::= DELETE|INSERT */
case 253: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==253);
{yymsp[0].minor.yy230.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy230.b = 0;}
break;
case 254: /* trigger_event ::= UPDATE OF idlist */
{yymsp[-2].minor.yy230.a = TK_UPDATE; yymsp[-2].minor.yy230.b = yymsp[0].minor.yy600;}
break;
case 255: /* when_clause ::= */
case 274: /* key_opt ::= */ yytestcase(yyruleno==274);
{ yymsp[1].minor.yy202 = 0; }
break;
case 256: /* when_clause ::= WHEN expr */
case 275: /* key_opt ::= KEY expr */ yytestcase(yyruleno==275);
{ yymsp[-1].minor.yy202 = yymsp[0].minor.yy202; }
break;
case 257: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
{
assert( yymsp[-2].minor.yy447!=0 );
yymsp[-2].minor.yy447->pLast->pNext = yymsp[-1].minor.yy447;
yymsp[-2].minor.yy447->pLast = yymsp[-1].minor.yy447;
}
break;
case 258: /* trigger_cmd_list ::= trigger_cmd SEMI */
{
assert( yymsp[-1].minor.yy447!=0 );
yymsp[-1].minor.yy447->pLast = yymsp[-1].minor.yy447;
}
break;
case 259: /* trnm ::= nm DOT nm */
{
yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
sqlite3ErrorMsg(pParse,
"qualified table names are not allowed on INSERT, UPDATE, and DELETE "
"statements within triggers");
}
break;
case 260: /* tridxby ::= INDEXED BY nm */
{
sqlite3ErrorMsg(pParse,
"the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
"within triggers");
}
break;
case 261: /* tridxby ::= NOT INDEXED */
{
sqlite3ErrorMsg(pParse,
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
"within triggers");
}
break;
case 262: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */
{yylhsminor.yy447 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy47, yymsp[-3].minor.yy242, yymsp[-1].minor.yy202, yymsp[-7].minor.yy192, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy436);}
yymsp[-8].minor.yy447 = yylhsminor.yy447;
break;
case 263: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */
{
yylhsminor.yy447 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy600,yymsp[-2].minor.yy539,yymsp[-6].minor.yy192,yymsp[-1].minor.yy318,yymsp[-7].minor.yy436,yymsp[0].minor.yy436);/*yylhsminor.yy447-overwrites-yymsp[-6].minor.yy192*/
}
yymsp[-7].minor.yy447 = yylhsminor.yy447;
break;
case 264: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */
{yylhsminor.yy447 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy202, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy436);}
yymsp[-5].minor.yy447 = yylhsminor.yy447;
break;
case 265: /* trigger_cmd ::= scanpt select scanpt */
{yylhsminor.yy447 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy539, yymsp[-2].minor.yy436, yymsp[0].minor.yy436); /*yylhsminor.yy447-overwrites-yymsp[-1].minor.yy539*/}
yymsp[-2].minor.yy447 = yylhsminor.yy447;
break;
case 266: /* expr ::= RAISE LP IGNORE RP */
{
yymsp[-3].minor.yy202 = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
if( yymsp[-3].minor.yy202 ){
yymsp[-3].minor.yy202->affExpr = OE_Ignore;
}
}
break;
case 267: /* expr ::= RAISE LP raisetype COMMA nm RP */
{
yymsp[-5].minor.yy202 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
if( yymsp[-5].minor.yy202 ) {
yymsp[-5].minor.yy202->affExpr = (char)yymsp[-3].minor.yy192;
}
}
break;
case 268: /* raisetype ::= ROLLBACK */
{yymsp[0].minor.yy192 = OE_Rollback;}
break;
case 270: /* raisetype ::= FAIL */
{yymsp[0].minor.yy192 = OE_Fail;}
break;
case 271: /* cmd ::= DROP TRIGGER ifexists fullname */
{
sqlite3DropTrigger(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy192);
}
break;
case 272: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
{
sqlite3Attach(pParse, yymsp[-3].minor.yy202, yymsp[-1].minor.yy202, yymsp[0].minor.yy202);
}
break;
case 273: /* cmd ::= DETACH database_kw_opt expr */
{
sqlite3Detach(pParse, yymsp[0].minor.yy202);
}
break;
case 276: /* cmd ::= REINDEX */
{sqlite3Reindex(pParse, 0, 0);}
break;
case 277: /* cmd ::= REINDEX nm dbnm */
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
break;
case 278: /* cmd ::= ANALYZE */
{sqlite3Analyze(pParse, 0, 0);}
break;
case 279: /* cmd ::= ANALYZE nm dbnm */
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
break;
case 280: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
{
sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy47,&yymsp[0].minor.yy0);
}
break;
case 281: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
{
yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
}
break;
case 282: /* add_column_fullname ::= fullname */
{
disableLookaside(pParse);
sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy47);
}
break;
case 283: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */
{
sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy47, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
break;
case 284: /* cmd ::= create_vtab */
{sqlite3VtabFinishParse(pParse,0);}
break;
case 285: /* cmd ::= create_vtab LP vtabarglist RP */
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
break;
case 286: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
{
sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy192);
}
break;
case 287: /* vtabarg ::= */
{sqlite3VtabArgInit(pParse);}
break;
case 288: /* vtabargtoken ::= ANY */
case 289: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==289);
case 290: /* lp ::= LP */ yytestcase(yyruleno==290);
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
break;
case 291: /* with ::= WITH wqlist */
case 292: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==292);
{ sqlite3WithPush(pParse, yymsp[0].minor.yy131, 1); }
break;
case 293: /* wqlist ::= nm eidlist_opt AS LP select RP */
{
yymsp[-5].minor.yy131 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539); /*A-overwrites-X*/
}
break;
case 294: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
{
yymsp[-7].minor.yy131 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy131, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539);
}
break;
case 295: /* windowdefn_list ::= windowdefn */
{ yylhsminor.yy303 = yymsp[0].minor.yy303; }
yymsp[0].minor.yy303 = yylhsminor.yy303;
break;
case 296: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */
{
assert( yymsp[0].minor.yy303!=0 );
sqlite3WindowChain(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy303);
yymsp[0].minor.yy303->pNextWin = yymsp[-2].minor.yy303;
yylhsminor.yy303 = yymsp[0].minor.yy303;
}
yymsp[-2].minor.yy303 = yylhsminor.yy303;
break;
case 297: /* windowdefn ::= nm AS LP window RP */
{
if( ALWAYS(yymsp[-1].minor.yy303) ){
yymsp[-1].minor.yy303->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n);
}
yylhsminor.yy303 = yymsp[-1].minor.yy303;
}
yymsp[-4].minor.yy303 = yylhsminor.yy303;
break;
case 298: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */
{
yymsp[-4].minor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, 0);
}
break;
case 299: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */
{
yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, &yymsp[-5].minor.yy0);
}
yymsp[-5].minor.yy303 = yylhsminor.yy303;
break;
case 300: /* window ::= ORDER BY sortlist frame_opt */
{
yymsp[-3].minor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, 0);
}
break;
case 301: /* window ::= nm ORDER BY sortlist frame_opt */
{
yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0);
}
yymsp[-4].minor.yy303 = yylhsminor.yy303;
break;
case 302: /* window ::= frame_opt */
case 321: /* filter_over ::= over_clause */ yytestcase(yyruleno==321);
{
yylhsminor.yy303 = yymsp[0].minor.yy303;
}
yymsp[0].minor.yy303 = yylhsminor.yy303;
break;
case 303: /* window ::= nm frame_opt */
{
yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, 0, &yymsp[-1].minor.yy0);
}
yymsp[-1].minor.yy303 = yylhsminor.yy303;
break;
case 304: /* frame_opt ::= */
{
yymsp[1].minor.yy303 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0);
}
break;
case 305: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */
{
yylhsminor.yy303 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy192, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy58);
}
yymsp[-2].minor.yy303 = yylhsminor.yy303;
break;
case 306: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */
{
yylhsminor.yy303 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy192, yymsp[-3].minor.yy77.eType, yymsp[-3].minor.yy77.pExpr, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, yymsp[0].minor.yy58);
}
yymsp[-5].minor.yy303 = yylhsminor.yy303;
break;
case 308: /* frame_bound_s ::= frame_bound */
case 310: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==310);
{yylhsminor.yy77 = yymsp[0].minor.yy77;}
yymsp[0].minor.yy77 = yylhsminor.yy77;
break;
case 309: /* frame_bound_s ::= UNBOUNDED PRECEDING */
case 311: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==311);
case 313: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==313);
{yylhsminor.yy77.eType = yymsp[-1].major; yylhsminor.yy77.pExpr = 0;}
yymsp[-1].minor.yy77 = yylhsminor.yy77;
break;
case 312: /* frame_bound ::= expr PRECEDING|FOLLOWING */
{yylhsminor.yy77.eType = yymsp[0].major; yylhsminor.yy77.pExpr = yymsp[-1].minor.yy202;}
yymsp[-1].minor.yy77 = yylhsminor.yy77;
break;
case 314: /* frame_exclude_opt ::= */
{yymsp[1].minor.yy58 = 0;}
break;
case 315: /* frame_exclude_opt ::= EXCLUDE frame_exclude */
{yymsp[-1].minor.yy58 = yymsp[0].minor.yy58;}
break;
case 316: /* frame_exclude ::= NO OTHERS */
case 317: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==317);
{yymsp[-1].minor.yy58 = yymsp[-1].major; /*A-overwrites-X*/}
break;
case 318: /* frame_exclude ::= GROUP|TIES */
{yymsp[0].minor.yy58 = yymsp[0].major; /*A-overwrites-X*/}
break;
case 319: /* window_clause ::= WINDOW windowdefn_list */
{ yymsp[-1].minor.yy303 = yymsp[0].minor.yy303; }
break;
case 320: /* filter_over ::= filter_clause over_clause */
{
yymsp[0].minor.yy303->pFilter = yymsp[-1].minor.yy202;
yylhsminor.yy303 = yymsp[0].minor.yy303;
}
yymsp[-1].minor.yy303 = yylhsminor.yy303;
break;
case 322: /* filter_over ::= filter_clause */
{
yylhsminor.yy303 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
if( yylhsminor.yy303 ){
yylhsminor.yy303->eFrmType = TK_FILTER;
yylhsminor.yy303->pFilter = yymsp[0].minor.yy202;
}else{
sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy202);
}
}
yymsp[0].minor.yy303 = yylhsminor.yy303;
break;
case 323: /* over_clause ::= OVER LP window RP */
{
yymsp[-3].minor.yy303 = yymsp[-1].minor.yy303;
assert( yymsp[-3].minor.yy303!=0 );
}
break;
case 324: /* over_clause ::= OVER nm */
{
yymsp[-1].minor.yy303 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window));
if( yymsp[-1].minor.yy303 ){
yymsp[-1].minor.yy303->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n);
}
}
break;
case 325: /* filter_clause ::= FILTER LP WHERE expr RP */
{ yymsp[-4].minor.yy202 = yymsp[-1].minor.yy202; }
break;
default:
/* (326) input ::= cmdlist */ yytestcase(yyruleno==326);
/* (327) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==327);
/* (328) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=328);
/* (329) ecmd ::= SEMI */ yytestcase(yyruleno==329);
/* (330) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==330);
/* (331) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=331);
/* (332) trans_opt ::= */ yytestcase(yyruleno==332);
/* (333) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==333);
/* (334) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==334);
/* (335) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==335);
/* (336) savepoint_opt ::= */ yytestcase(yyruleno==336);
/* (337) cmd ::= create_table create_table_args */ yytestcase(yyruleno==337);
/* (338) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==338);
/* (339) columnlist ::= columnname carglist */ yytestcase(yyruleno==339);
/* (340) nm ::= ID|INDEXED */ yytestcase(yyruleno==340);
/* (341) nm ::= STRING */ yytestcase(yyruleno==341);
/* (342) nm ::= JOIN_KW */ yytestcase(yyruleno==342);
/* (343) typetoken ::= typename */ yytestcase(yyruleno==343);
/* (344) typename ::= ID|STRING */ yytestcase(yyruleno==344);
/* (345) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=345);
/* (346) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=346);
/* (347) carglist ::= carglist ccons */ yytestcase(yyruleno==347);
/* (348) carglist ::= */ yytestcase(yyruleno==348);
/* (349) ccons ::= NULL onconf */ yytestcase(yyruleno==349);
/* (350) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==350);
/* (351) ccons ::= AS generated */ yytestcase(yyruleno==351);
/* (352) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==352);
/* (353) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==353);
/* (354) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=354);
/* (355) tconscomma ::= */ yytestcase(yyruleno==355);
/* (356) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=356);
/* (357) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=357);
/* (358) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=358);
/* (359) oneselect ::= values */ yytestcase(yyruleno==359);
/* (360) sclp ::= selcollist COMMA */ yytestcase(yyruleno==360);
/* (361) as ::= ID|STRING */ yytestcase(yyruleno==361);
/* (362) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=362);
/* (363) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==363);
/* (364) exprlist ::= nexprlist */ yytestcase(yyruleno==364);
/* (365) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=365);
/* (366) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=366);
/* (367) nmnum ::= ON */ yytestcase(yyruleno==367);
/* (368) nmnum ::= DELETE */ yytestcase(yyruleno==368);
/* (369) nmnum ::= DEFAULT */ yytestcase(yyruleno==369);
/* (370) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==370);
/* (371) foreach_clause ::= */ yytestcase(yyruleno==371);
/* (372) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==372);
/* (373) trnm ::= nm */ yytestcase(yyruleno==373);
/* (374) tridxby ::= */ yytestcase(yyruleno==374);
/* (375) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==375);
/* (376) database_kw_opt ::= */ yytestcase(yyruleno==376);
/* (377) kwcolumn_opt ::= */ yytestcase(yyruleno==377);
/* (378) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==378);
/* (379) vtabarglist ::= vtabarg */ yytestcase(yyruleno==379);
/* (380) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==380);
/* (381) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==381);
/* (382) anylist ::= */ yytestcase(yyruleno==382);
/* (383) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==383);
/* (384) anylist ::= anylist ANY */ yytestcase(yyruleno==384);
/* (385) with ::= */ yytestcase(yyruleno==385);
break;
/********** End reduce actions ************************************************/
};
assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) );
yygoto = yyRuleInfoLhs[yyruleno];
yysize = yyRuleInfoNRhs[yyruleno];
yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto);
|
| ︙ | ︙ | |||
160091 160092 160093 160094 160095 160096 160097 | ** In the sqlite3GetToken() function, a switch() on aiClass[c] is implemented ** using a lookup table, whereas a switch() directly on c uses a binary search. ** The lookup table is much faster. To maximize speed, and to ensure that ** a lookup table is used, all of the classes need to be small integers and ** all of them need to be used within the switch. */ #define CC_X 0 /* The letter 'x', or start of BLOB literal */ | > | < | 160731 160732 160733 160734 160735 160736 160737 160738 160739 160740 160741 160742 160743 160744 160745 160746 | ** In the sqlite3GetToken() function, a switch() on aiClass[c] is implemented ** using a lookup table, whereas a switch() directly on c uses a binary search. ** The lookup table is much faster. To maximize speed, and to ensure that ** a lookup table is used, all of the classes need to be small integers and ** all of them need to be used within the switch. */ #define CC_X 0 /* The letter 'x', or start of BLOB literal */ #define CC_KYWD0 1 /* First letter of a keyword */ #define CC_KYWD 2 /* Alphabetics or '_'. Usable in a keyword */ #define CC_DIGIT 3 /* Digits */ #define CC_DOLLAR 4 /* '$' */ #define CC_VARALPHA 5 /* '@', '#', ':'. Alphabetic SQL variables */ #define CC_VARNUM 6 /* '?'. Numeric SQL variables */ #define CC_SPACE 7 /* Space characters */ #define CC_QUOTE 8 /* '"', '\'', or '`'. String literals, quoted ids */ #define CC_QUOTE2 9 /* '['. [...] style quoted ids */ |
| ︙ | ︙ | |||
160117 160118 160119 160120 160121 160122 160123 | #define CC_PLUS 20 /* '+' */ #define CC_STAR 21 /* '*' */ #define CC_PERCENT 22 /* '%' */ #define CC_COMMA 23 /* ',' */ #define CC_AND 24 /* '&' */ #define CC_TILDA 25 /* '~' */ #define CC_DOT 26 /* '.' */ | > | | | | | | | | | | | | | | | | | | | | | | | 160757 160758 160759 160760 160761 160762 160763 160764 160765 160766 160767 160768 160769 160770 160771 160772 160773 160774 160775 160776 160777 160778 160779 160780 160781 160782 160783 160784 160785 160786 160787 160788 160789 160790 160791 160792 160793 160794 160795 160796 160797 160798 160799 160800 160801 160802 160803 160804 160805 160806 160807 160808 160809 160810 160811 160812 |
#define CC_PLUS 20 /* '+' */
#define CC_STAR 21 /* '*' */
#define CC_PERCENT 22 /* '%' */
#define CC_COMMA 23 /* ',' */
#define CC_AND 24 /* '&' */
#define CC_TILDA 25 /* '~' */
#define CC_DOT 26 /* '.' */
#define CC_ID 27 /* unicode characters usable in IDs */
#define CC_ILLEGAL 28 /* Illegal character */
#define CC_NUL 29 /* 0x00 */
static const unsigned char aiClass[] = {
#ifdef SQLITE_ASCII
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */
/* 0x */ 29, 28, 28, 28, 28, 28, 28, 28, 28, 7, 7, 28, 7, 7, 28, 28,
/* 1x */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
/* 2x */ 7, 15, 8, 5, 4, 22, 24, 8, 17, 18, 21, 20, 23, 11, 26, 16,
/* 3x */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 5, 19, 12, 14, 13, 6,
/* 4x */ 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
/* 5x */ 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 9, 28, 28, 28, 2,
/* 6x */ 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
/* 7x */ 1, 1, 1, 1, 1, 1, 1, 1, 0, 2, 2, 28, 10, 28, 25, 28,
/* 8x */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
/* 9x */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
/* Ax */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
/* Bx */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
/* Cx */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
/* Dx */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
/* Ex */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
/* Fx */ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
#endif
#ifdef SQLITE_EBCDIC
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf */
/* 0x */ 29, 28, 28, 28, 28, 7, 28, 28, 28, 28, 28, 28, 7, 7, 28, 28,
/* 1x */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
/* 2x */ 28, 28, 28, 28, 28, 7, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
/* 3x */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
/* 4x */ 7, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 26, 12, 17, 20, 10,
/* 5x */ 24, 28, 28, 28, 28, 28, 28, 28, 28, 28, 15, 4, 21, 18, 19, 28,
/* 6x */ 11, 16, 28, 28, 28, 28, 28, 28, 28, 28, 28, 23, 22, 2, 13, 6,
/* 7x */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 8, 5, 5, 5, 8, 14, 8,
/* 8x */ 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 28, 28, 28, 28, 28, 28,
/* 9x */ 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 28, 28, 28, 28, 28, 28,
/* Ax */ 28, 25, 1, 1, 1, 1, 1, 0, 2, 2, 28, 28, 28, 28, 28, 28,
/* Bx */ 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 9, 28, 28, 28, 28, 28,
/* Cx */ 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 28, 28, 28, 28, 28, 28,
/* Dx */ 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 28, 28, 28, 28, 28, 28,
/* Ex */ 28, 28, 1, 1, 1, 1, 1, 0, 2, 2, 28, 28, 28, 28, 28, 28,
/* Fx */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 28, 28, 28, 28, 28, 28,
#endif
};
/*
** The charMap() macro maps alphabetic characters (only) into their
** lower-case ASCII equivalent. On ASCII machines, this is just
** an upper-to-lower case map. On EBCDIC machines we also need
|
| ︙ | ︙ | |||
160502 160503 160504 160505 160506 160507 160508 |
/* Check to see if z[0..n-1] is a keyword. If it is, write the
** parser symbol code for that keyword into *pType. Always
** return the integer n (the length of the token). */
static int keywordCode(const char *z, int n, int *pType){
int i, j;
const char *zKW;
if( n>=2 ){
| | | 161143 161144 161145 161146 161147 161148 161149 161150 161151 161152 161153 161154 161155 161156 161157 |
/* Check to see if z[0..n-1] is a keyword. If it is, write the
** parser symbol code for that keyword into *pType. Always
** return the integer n (the length of the token). */
static int keywordCode(const char *z, int n, int *pType){
int i, j;
const char *zKW;
if( n>=2 ){
i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n*1) % 127;
for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){
if( aKWLen[i]!=n ) continue;
zKW = &zKWText[aKWOffset[i]];
#ifdef SQLITE_ASCII
if( (z[0]&~0x20)!=zKW[0] ) continue;
if( (z[1]&~0x20)!=zKW[1] ) continue;
j = 2;
|
| ︙ | ︙ | |||
161044 161045 161046 161047 161048 161049 161050 |
}else{
break;
}
}
if( n==0 ) *tokenType = TK_ILLEGAL;
return i;
}
| | | 161685 161686 161687 161688 161689 161690 161691 161692 161693 161694 161695 161696 161697 161698 161699 |
}else{
break;
}
}
if( n==0 ) *tokenType = TK_ILLEGAL;
return i;
}
case CC_KYWD0: {
for(i=1; aiClass[z[i]]<=CC_KYWD; i++){}
if( IdChar(z[i]) ){
/* This token started out using characters that can appear in keywords,
** but z[i] is a character not allowed within keywords, so this must
** be an identifier instead */
i++;
break;
|
| ︙ | ︙ | |||
161074 161075 161076 161077 161078 161079 161080 161081 161082 161083 161084 161085 161086 161087 |
return i;
}
#endif
/* If it is not a BLOB literal, then it must be an ID, since no
** SQL keywords start with the letter 'x'. Fall through */
/* no break */ deliberate_fall_through
}
case CC_ID: {
i = 1;
break;
}
case CC_NUL: {
*tokenType = TK_ILLEGAL;
return 0;
| > | 161715 161716 161717 161718 161719 161720 161721 161722 161723 161724 161725 161726 161727 161728 161729 |
return i;
}
#endif
/* If it is not a BLOB literal, then it must be an ID, since no
** SQL keywords start with the letter 'x'. Fall through */
/* no break */ deliberate_fall_through
}
case CC_KYWD:
case CC_ID: {
i = 1;
break;
}
case CC_NUL: {
*tokenType = TK_ILLEGAL;
return 0;
|
| ︙ | ︙ | |||
166056 166057 166058 166059 166060 166061 166062 |
sqlite3 *db = va_arg(ap, sqlite3*);
u64 *pn = va_arg(ap, sqlite3_uint64*);
*pn = sqlite3BtreeSeekCount(db->aDb->pBt);
(void)db; /* Silence harmless unused variable warning */
break;
}
| > > > > > > > > > > > > > > > > > | > > | 166698 166699 166700 166701 166702 166703 166704 166705 166706 166707 166708 166709 166710 166711 166712 166713 166714 166715 166716 166717 166718 166719 166720 166721 166722 166723 166724 166725 166726 166727 166728 166729 166730 166731 |
sqlite3 *db = va_arg(ap, sqlite3*);
u64 *pn = va_arg(ap, sqlite3_uint64*);
*pn = sqlite3BtreeSeekCount(db->aDb->pBt);
(void)db; /* Silence harmless unused variable warning */
break;
}
/* sqlite3_test_control(SQLITE_TESTCTRL_TRACEFLAGS, op, ptr)
**
** "ptr" is a pointer to a u32.
**
** op==0 Store the current sqlite3SelectTrace in *ptr
** op==1 Set sqlite3SelectTrace to the value *ptr
** op==3 Store the current sqlite3WhereTrace in *ptr
** op==3 Set sqlite3WhereTrace to the value *ptr
*/
case SQLITE_TESTCTRL_TRACEFLAGS: {
int opTrace = va_arg(ap, int);
u32 *ptr = va_arg(ap, u32*);
switch( opTrace ){
case 0: *ptr = sqlite3SelectTrace; break;
case 1: sqlite3SelectTrace = *ptr; break;
case 2: *ptr = sqlite3WhereTrace; break;
case 3: sqlite3WhereTrace = *ptr; break;
}
break;
}
}
va_end(ap);
#endif /* SQLITE_UNTESTABLE */
return rc;
}
/*
|
| ︙ | ︙ | |||
215280 215281 215282 215283 215284 215285 215286 |
&& 0==pRoot->bEof
&& fts5RowidCmp(p, pRoot->iRowid, iFirst)<0
){
rc = fts5ExprNodeNext(p, pRoot, 1, iFirst);
}
/* If the iterator is not at a real match, skip forward until it is. */
| | | | 215941 215942 215943 215944 215945 215946 215947 215948 215949 215950 215951 215952 215953 215954 215955 215956 |
&& 0==pRoot->bEof
&& fts5RowidCmp(p, pRoot->iRowid, iFirst)<0
){
rc = fts5ExprNodeNext(p, pRoot, 1, iFirst);
}
/* If the iterator is not at a real match, skip forward until it is. */
while( pRoot->bNomatch && rc==SQLITE_OK ){
assert( pRoot->bEof==0 );
rc = fts5ExprNodeNext(p, pRoot, 0, 0);
}
return rc;
}
/*
** Move to the next document
|
| ︙ | ︙ | |||
220465 220466 220467 220468 220469 220470 220471 | int nRem = pSeg->nPos; /* Number of bytes still to come */ Fts5Data *pData = 0; u8 *pChunk = &pSeg->pLeaf->p[pSeg->iLeafOffset]; int nChunk = MIN(nRem, pSeg->pLeaf->szLeaf - pSeg->iLeafOffset); int pgno = pSeg->iLeafPgno; int pgnoSave = 0; | | > > > | 221126 221127 221128 221129 221130 221131 221132 221133 221134 221135 221136 221137 221138 221139 221140 221141 221142 221143 221144 221145 221146 221147 221148 221149 221150 221151 221152 221153 221154 221155 |
int nRem = pSeg->nPos; /* Number of bytes still to come */
Fts5Data *pData = 0;
u8 *pChunk = &pSeg->pLeaf->p[pSeg->iLeafOffset];
int nChunk = MIN(nRem, pSeg->pLeaf->szLeaf - pSeg->iLeafOffset);
int pgno = pSeg->iLeafPgno;
int pgnoSave = 0;
/* This function does not work with detail=none databases. */
assert( p->pConfig->eDetail!=FTS5_DETAIL_NONE );
if( (pSeg->flags & FTS5_SEGITER_REVERSE)==0 ){
pgnoSave = pgno+1;
}
while( 1 ){
xChunk(p, pCtx, pChunk, nChunk);
nRem -= nChunk;
fts5DataRelease(pData);
if( nRem<=0 ){
break;
}else if( pSeg->pSeg==0 ){
p->rc = FTS5_CORRUPT;
return;
}else{
pgno++;
pData = fts5LeafRead(p, FTS5_SEGMENT_ROWID(pSeg->pSeg->iSegid, pgno));
if( pData==0 ) break;
pChunk = &pData->p[4];
nChunk = MIN(nRem, pData->szLeaf - 4);
if( pgno==pgnoSave ){
|
| ︙ | ︙ | |||
220529 220530 220531 220532 220533 220534 220535 |
fts5ChunkIterate(p, pSeg, (void*)&sCtx, fts5PoslistOffsetsCallback);
}
}
}
}
/*
| | | | | < < < < < < < < < | | < < < < < | < < < < < < < < < < < < | < < < < < | | < | | > > > | > | > > > > > > > | > > > > > | > > > > > > | | > > > > | > > > > | > > > > > | > > > | 221193 221194 221195 221196 221197 221198 221199 221200 221201 221202 221203 221204 221205 221206 221207 221208 221209 221210 221211 221212 221213 221214 221215 221216 221217 221218 221219 221220 221221 221222 221223 221224 221225 221226 221227 221228 221229 221230 221231 221232 221233 221234 221235 221236 221237 221238 221239 221240 221241 221242 221243 221244 221245 221246 221247 221248 221249 221250 221251 221252 221253 221254 221255 221256 221257 221258 221259 221260 221261 221262 221263 221264 221265 221266 221267 221268 221269 221270 221271 221272 |
fts5ChunkIterate(p, pSeg, (void*)&sCtx, fts5PoslistOffsetsCallback);
}
}
}
}
/*
** Parameter pPos points to a buffer containing a position list, size nPos.
** This function filters it according to pColset (which must be non-NULL)
** and sets pIter->base.pData/nData to point to the new position list.
** If memory is required for the new position list, use buffer pIter->poslist.
** Or, if the new position list is a contiguous subset of the input, set
** pIter->base.pData/nData to point directly to it.
**
** This function is a no-op if *pRc is other than SQLITE_OK when it is
** called. If an OOM error is encountered, *pRc is set to SQLITE_NOMEM
** before returning.
*/
static void fts5IndexExtractColset(
int *pRc,
Fts5Colset *pColset, /* Colset to filter on */
const u8 *pPos, int nPos, /* Position list */
Fts5Iter *pIter
){
if( *pRc==SQLITE_OK ){
const u8 *p = pPos;
const u8 *aCopy = p;
const u8 *pEnd = &p[nPos]; /* One byte past end of position list */
int i = 0;
int iCurrent = 0;
if( pColset->nCol>1 && sqlite3Fts5BufferSize(pRc, &pIter->poslist, nPos) ){
return;
}
while( 1 ){
while( pColset->aiCol[i]<iCurrent ){
i++;
if( i==pColset->nCol ){
pIter->base.pData = pIter->poslist.p;
pIter->base.nData = pIter->poslist.n;
return;
}
}
/* Advance pointer p until it points to pEnd or an 0x01 byte that is
** not part of a varint */
while( p<pEnd && *p!=0x01 ){
while( *p++ & 0x80 );
}
if( pColset->aiCol[i]==iCurrent ){
if( pColset->nCol==1 ){
pIter->base.pData = aCopy;
pIter->base.nData = p-aCopy;
return;
}
fts5BufferSafeAppendBlob(&pIter->poslist, aCopy, p-aCopy);
}
if( p==pEnd ){
pIter->base.pData = pIter->poslist.p;
pIter->base.nData = pIter->poslist.n;
return;
}
aCopy = p++;
iCurrent = *p++;
if( iCurrent & 0x80 ){
p--;
p += fts5GetVarint32(p, iCurrent);
}
}
}
}
/*
** xSetOutputs callback used by detail=none tables.
*/
static void fts5IterSetOutputs_None(Fts5Iter *pIter, Fts5SegIter *pSeg){
assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_NONE );
|
| ︙ | ︙ | |||
220708 220709 220710 220711 220712 220713 220714 |
assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_FULL );
assert( pColset );
if( pSeg->iLeafOffset+pSeg->nPos<=pSeg->pLeaf->szLeaf ){
/* All data is stored on the current page. Populate the output
** variables to point into the body of the page object. */
const u8 *a = &pSeg->pLeaf->p[pSeg->iLeafOffset];
| < < < < | | | < < < | 221378 221379 221380 221381 221382 221383 221384 221385 221386 221387 221388 221389 221390 221391 221392 221393 221394 |
assert( pIter->pIndex->pConfig->eDetail==FTS5_DETAIL_FULL );
assert( pColset );
if( pSeg->iLeafOffset+pSeg->nPos<=pSeg->pLeaf->szLeaf ){
/* All data is stored on the current page. Populate the output
** variables to point into the body of the page object. */
const u8 *a = &pSeg->pLeaf->p[pSeg->iLeafOffset];
int *pRc = &pIter->pIndex->rc;
fts5BufferZero(&pIter->poslist);
fts5IndexExtractColset(pRc, pColset, a, pSeg->nPos, pIter);
}else{
/* The data is distributed over two or more pages. Copy it into the
** Fts5Iter.poslist buffer and then set the output pointer to point
** to this buffer. */
fts5BufferZero(&pIter->poslist);
fts5SegiterPoslist(pIter->pIndex, pSeg, pColset, &pIter->poslist);
pIter->base.pData = pIter->poslist.p;
|
| ︙ | ︙ | |||
222200 222201 222202 222203 222204 222205 222206 |
}
}
static void fts5DoclistIterNext(Fts5DoclistIter *pIter){
u8 *p = pIter->aPoslist + pIter->nSize + pIter->nPoslist;
| | | 222863 222864 222865 222866 222867 222868 222869 222870 222871 222872 222873 222874 222875 222876 222877 |
}
}
static void fts5DoclistIterNext(Fts5DoclistIter *pIter){
u8 *p = pIter->aPoslist + pIter->nSize + pIter->nPoslist;
assert( pIter->aPoslist || (p==0 && pIter->aPoslist==0) );
if( p>=pIter->aEof ){
pIter->aPoslist = 0;
}else{
i64 iDelta;
p += fts5GetVarint(p, (u64*)&iDelta);
pIter->iRowid += iDelta;
|
| ︙ | ︙ | |||
222284 222285 222286 222287 222288 222289 222290 | /* ** This is the equivalent of fts5MergePrefixLists() for detail=none mode. ** In this case the buffers consist of a delta-encoded list of rowids only. */ static void fts5MergeRowidLists( Fts5Index *p, /* FTS5 backend object */ Fts5Buffer *p1, /* First list to merge */ | > | | > > > | 222947 222948 222949 222950 222951 222952 222953 222954 222955 222956 222957 222958 222959 222960 222961 222962 222963 222964 222965 222966 222967 222968 222969 222970 222971 222972 222973 222974 |
/*
** This is the equivalent of fts5MergePrefixLists() for detail=none mode.
** In this case the buffers consist of a delta-encoded list of rowids only.
*/
static void fts5MergeRowidLists(
Fts5Index *p, /* FTS5 backend object */
Fts5Buffer *p1, /* First list to merge */
int nBuf, /* Number of entries in apBuf[] */
Fts5Buffer *aBuf /* Array of other lists to merge into p1 */
){
int i1 = 0;
int i2 = 0;
i64 iRowid1 = 0;
i64 iRowid2 = 0;
i64 iOut = 0;
Fts5Buffer *p2 = &aBuf[0];
Fts5Buffer out;
(void)nBuf;
memset(&out, 0, sizeof(out));
assert( nBuf==1 );
sqlite3Fts5BufferSize(&p->rc, &out, p1->n + p2->n);
if( p->rc ) return;
fts5NextRowid(p1, &i1, &iRowid1);
fts5NextRowid(p2, &i2, &iRowid2);
while( i1>=0 || i2>=0 ){
if( i1>=0 && (i2<0 || iRowid1<iRowid2) ){
|
| ︙ | ︙ | |||
222319 222320 222321 222322 222323 222324 222325 222326 |
fts5NextRowid(p2, &i2, &iRowid2);
}
}
fts5BufferSwap(&out, p1);
fts5BufferFree(&out);
}
| > > > > > | > > | > > > > > > > > > > > > > | > > | > > > > > > > | > > | | > > > > | < > > > > | | < > | | > > > > > > > > > > > > > > > > | | | | | | | | | | | | | < < | < < | < < < < | | < < < < | < < | > | > | | | | > > > > | > | > > > > | > > | | < < < | | | < < | < < | | < < < > < < | | | | > | < | < > | | | < | < > | < < < | | < < < | | | < | | > | < > | < > | > > | | | | | | | < < < < < | | < < < | | > | | > | > > > < < < | < | | | | < > | | > | > > > > > > > > > > > > > > > > > > > > > > > > > | > | | | | > > > | > | > > | > | > | > | 222986 222987 222988 222989 222990 222991 222992 222993 222994 222995 222996 222997 222998 222999 223000 223001 223002 223003 223004 223005 223006 223007 223008 223009 223010 223011 223012 223013 223014 223015 223016 223017 223018 223019 223020 223021 223022 223023 223024 223025 223026 223027 223028 223029 223030 223031 223032 223033 223034 223035 223036 223037 223038 223039 223040 223041 223042 223043 223044 223045 223046 223047 223048 223049 223050 223051 223052 223053 223054 223055 223056 223057 223058 223059 223060 223061 223062 223063 223064 223065 223066 223067 223068 223069 223070 223071 223072 223073 223074 223075 223076 223077 223078 223079 223080 223081 223082 223083 223084 223085 223086 223087 223088 223089 223090 223091 223092 223093 223094 223095 223096 223097 223098 223099 223100 223101 223102 223103 223104 223105 223106 223107 223108 223109 223110 223111 223112 223113 223114 223115 223116 223117 223118 223119 223120 223121 223122 223123 223124 223125 223126 223127 223128 223129 223130 223131 223132 223133 223134 223135 223136 223137 223138 223139 223140 223141 223142 223143 223144 223145 223146 223147 223148 223149 223150 223151 223152 223153 223154 223155 223156 223157 223158 223159 223160 223161 223162 223163 223164 223165 223166 223167 223168 223169 223170 223171 223172 223173 223174 223175 223176 223177 223178 223179 223180 223181 223182 223183 223184 223185 223186 223187 223188 223189 223190 223191 223192 223193 223194 223195 223196 223197 223198 223199 223200 223201 223202 223203 223204 223205 223206 223207 223208 223209 223210 223211 223212 223213 223214 223215 223216 223217 223218 223219 223220 223221 223222 223223 223224 223225 223226 223227 223228 223229 223230 223231 223232 223233 223234 223235 223236 223237 223238 223239 223240 223241 223242 223243 223244 223245 223246 223247 223248 223249 223250 223251 223252 223253 223254 223255 223256 223257 223258 223259 223260 223261 223262 223263 223264 223265 223266 223267 223268 223269 223270 223271 223272 223273 223274 223275 223276 223277 223278 223279 223280 223281 223282 223283 223284 223285 223286 223287 223288 223289 223290 223291 223292 223293 223294 223295 223296 223297 223298 223299 223300 |
fts5NextRowid(p2, &i2, &iRowid2);
}
}
fts5BufferSwap(&out, p1);
fts5BufferFree(&out);
}
typedef struct PrefixMerger PrefixMerger;
struct PrefixMerger {
Fts5DoclistIter iter; /* Doclist iterator */
i64 iPos; /* For iterating through a position list */
int iOff;
u8 *aPos;
PrefixMerger *pNext; /* Next in docid/poslist order */
};
static void fts5PrefixMergerInsertByRowid(
PrefixMerger **ppHead,
PrefixMerger *p
){
if( p->iter.aPoslist ){
PrefixMerger **pp = ppHead;
while( *pp && p->iter.iRowid>(*pp)->iter.iRowid ){
pp = &(*pp)->pNext;
}
p->pNext = *pp;
*pp = p;
}
}
static void fts5PrefixMergerInsertByPosition(
PrefixMerger **ppHead,
PrefixMerger *p
){
if( p->iPos>=0 ){
PrefixMerger **pp = ppHead;
while( *pp && p->iPos>(*pp)->iPos ){
pp = &(*pp)->pNext;
}
p->pNext = *pp;
*pp = p;
}
}
/*
** Array aBuf[] contains nBuf doclists. These are all merged in with the
** doclist in buffer p1.
*/
static void fts5MergePrefixLists(
Fts5Index *p, /* FTS5 backend object */
Fts5Buffer *p1, /* First list to merge */
int nBuf, /* Number of buffers in array aBuf[] */
Fts5Buffer *aBuf /* Other lists to merge in */
){
#define fts5PrefixMergerNextPosition(p) \
sqlite3Fts5PoslistNext64((p)->aPos,(p)->iter.nPoslist,&(p)->iOff,&(p)->iPos);
#define FTS5_MERGE_NLIST 16
PrefixMerger aMerger[FTS5_MERGE_NLIST];
PrefixMerger *pHead = 0;
int i;
int nOut = 0;
Fts5Buffer out = {0, 0, 0};
Fts5Buffer tmp = {0, 0, 0};
i64 iLastRowid = 0;
/* Initialize a doclist-iterator for each input buffer. Arrange them in
** a linked-list starting at pHead in ascending order of rowid. Avoid
** linking any iterators already at EOF into the linked list at all. */
assert( nBuf+1<=sizeof(aMerger)/sizeof(aMerger[0]) );
memset(aMerger, 0, sizeof(PrefixMerger)*(nBuf+1));
pHead = &aMerger[nBuf];
fts5DoclistIterInit(p1, &pHead->iter);
for(i=0; i<nBuf; i++){
fts5DoclistIterInit(&aBuf[i], &aMerger[i].iter);
fts5PrefixMergerInsertByRowid(&pHead, &aMerger[i]);
nOut += aBuf[i].n;
}
if( nOut==0 ) return;
nOut += p1->n + 9 + 10*nBuf;
/* The maximum size of the output is equal to the sum of the
** input sizes + 1 varint (9 bytes). The extra varint is because if the
** first rowid in one input is a large negative number, and the first in
** the other a non-negative number, the delta for the non-negative
** number will be larger on disk than the literal integer value
** was.
**
** Or, if the input position-lists are corrupt, then the output might
** include up to (nBuf+1) extra 10-byte positions created by interpreting -1
** (the value PoslistNext64() uses for EOF) as a position and appending
** it to the output. This can happen at most once for each input
** position-list, hence (nBuf+1) 10 byte paddings. */
if( sqlite3Fts5BufferSize(&p->rc, &out, nOut) ) return;
while( pHead ){
fts5MergeAppendDocid(&out, iLastRowid, pHead->iter.iRowid);
if( pHead->pNext && iLastRowid==pHead->pNext->iter.iRowid ){
/* Merge data from two or more poslists */
i64 iPrev = 0;
int nTmp = FTS5_DATA_ZERO_PADDING;
int nMerge = 0;
PrefixMerger *pSave = pHead;
PrefixMerger *pThis = 0;
int nTail = 0;
pHead = 0;
while( pSave && pSave->iter.iRowid==iLastRowid ){
PrefixMerger *pNext = pSave->pNext;
pSave->iOff = 0;
pSave->iPos = 0;
pSave->aPos = &pSave->iter.aPoslist[pSave->iter.nSize];
fts5PrefixMergerNextPosition(pSave);
nTmp += pSave->iter.nPoslist + 10;
nMerge++;
fts5PrefixMergerInsertByPosition(&pHead, pSave);
pSave = pNext;
}
if( pHead==0 || pHead->pNext==0 ){
p->rc = FTS5_CORRUPT;
break;
}
/* See the earlier comment in this function for an explanation of why
** corrupt input position lists might cause the output to consume
** at most nMerge*10 bytes of unexpected space. */
if( sqlite3Fts5BufferSize(&p->rc, &tmp, nTmp+nMerge*10) ){
break;
}
fts5BufferZero(&tmp);
pThis = pHead;
pHead = pThis->pNext;
sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, pThis->iPos);
fts5PrefixMergerNextPosition(pThis);
fts5PrefixMergerInsertByPosition(&pHead, pThis);
while( pHead->pNext ){
pThis = pHead;
if( pThis->iPos!=iPrev ){
sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, pThis->iPos);
}
fts5PrefixMergerNextPosition(pThis);
pHead = pThis->pNext;
fts5PrefixMergerInsertByPosition(&pHead, pThis);
}
if( pHead->iPos!=iPrev ){
sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, pHead->iPos);
}
nTail = pHead->iter.nPoslist - pHead->iOff;
/* WRITEPOSLISTSIZE */
assert( tmp.n+nTail<=nTmp );
if( tmp.n+nTail>nTmp-FTS5_DATA_ZERO_PADDING ){
if( p->rc==SQLITE_OK ) p->rc = FTS5_CORRUPT;
break;
}
fts5BufferSafeAppendVarint(&out, (tmp.n+nTail) * 2);
fts5BufferSafeAppendBlob(&out, tmp.p, tmp.n);
if( nTail>0 ){
fts5BufferSafeAppendBlob(&out, &pHead->aPos[pHead->iOff], nTail);
}
pHead = pSave;
for(i=0; i<nBuf+1; i++){
PrefixMerger *pX = &aMerger[i];
if( pX->iter.aPoslist && pX->iter.iRowid==iLastRowid ){
fts5DoclistIterNext(&pX->iter);
fts5PrefixMergerInsertByRowid(&pHead, pX);
}
}
}else{
/* Copy poslist from pHead to output */
PrefixMerger *pThis = pHead;
Fts5DoclistIter *pI = &pThis->iter;
fts5BufferSafeAppendBlob(&out, pI->aPoslist, pI->nPoslist+pI->nSize);
fts5DoclistIterNext(pI);
pHead = pThis->pNext;
fts5PrefixMergerInsertByRowid(&pHead, pThis);
}
}
fts5BufferFree(p1);
fts5BufferFree(&tmp);
memset(&out.p[out.n], 0, FTS5_DATA_ZERO_PADDING);
*p1 = out;
}
static void fts5SetupPrefixIter(
Fts5Index *p, /* Index to read from */
int bDesc, /* True for "ORDER BY rowid DESC" */
int iIdx, /* Index to scan for data */
u8 *pToken, /* Buffer containing prefix to match */
int nToken, /* Size of buffer pToken in bytes */
Fts5Colset *pColset, /* Restrict matches to these columns */
Fts5Iter **ppIter /* OUT: New iterator */
){
Fts5Structure *pStruct;
Fts5Buffer *aBuf;
int nBuf = 32;
int nMerge = 1;
void (*xMerge)(Fts5Index*, Fts5Buffer*, int, Fts5Buffer*);
void (*xAppend)(Fts5Index*, i64, Fts5Iter*, Fts5Buffer*);
if( p->pConfig->eDetail==FTS5_DETAIL_NONE ){
xMerge = fts5MergeRowidLists;
xAppend = fts5AppendRowid;
}else{
nMerge = FTS5_MERGE_NLIST-1;
nBuf = nMerge*8; /* Sufficient to merge (16^8)==(2^32) lists */
xMerge = fts5MergePrefixLists;
xAppend = fts5AppendPoslist;
}
aBuf = (Fts5Buffer*)fts5IdxMalloc(p, sizeof(Fts5Buffer)*nBuf);
pStruct = fts5StructureRead(p);
if( aBuf && pStruct ){
const int flags = FTS5INDEX_QUERY_SCAN
| FTS5INDEX_QUERY_SKIPEMPTY
| FTS5INDEX_QUERY_NOOUTPUT;
int i;
i64 iLastRowid = 0;
Fts5Iter *p1 = 0; /* Iterator used to gather data from index */
Fts5Data *pData;
Fts5Buffer doclist;
int bNewTerm = 1;
memset(&doclist, 0, sizeof(doclist));
if( iIdx!=0 ){
int dummy = 0;
const int f2 = FTS5INDEX_QUERY_SKIPEMPTY|FTS5INDEX_QUERY_NOOUTPUT;
pToken[0] = FTS5_MAIN_PREFIX;
fts5MultiIterNew(p, pStruct, f2, pColset, pToken, nToken, -1, 0, &p1);
fts5IterSetOutputCb(&p->rc, p1);
for(;
fts5MultiIterEof(p, p1)==0;
fts5MultiIterNext2(p, p1, &dummy)
){
Fts5SegIter *pSeg = &p1->aSeg[ p1->aFirst[1].iFirst ];
p1->xSetOutputs(p1, pSeg);
if( p1->base.nData ){
xAppend(p, p1->base.iRowid-iLastRowid, p1, &doclist);
iLastRowid = p1->base.iRowid;
}
}
fts5MultiIterFree(p1);
}
pToken[0] = FTS5_MAIN_PREFIX + iIdx;
fts5MultiIterNew(p, pStruct, flags, pColset, pToken, nToken, -1, 0, &p1);
fts5IterSetOutputCb(&p->rc, p1);
for( /* no-op */ ;
fts5MultiIterEof(p, p1)==0;
fts5MultiIterNext2(p, p1, &bNewTerm)
){
Fts5SegIter *pSeg = &p1->aSeg[ p1->aFirst[1].iFirst ];
int nTerm = pSeg->term.n;
const u8 *pTerm = pSeg->term.p;
p1->xSetOutputs(p1, pSeg);
assert_nc( memcmp(pToken, pTerm, MIN(nToken, nTerm))<=0 );
if( bNewTerm ){
if( nTerm<nToken || memcmp(pToken, pTerm, nToken) ) break;
}
if( p1->base.nData==0 ) continue;
if( p1->base.iRowid<=iLastRowid && doclist.n>0 ){
for(i=0; p->rc==SQLITE_OK && doclist.n; i++){
int i1 = i*nMerge;
int iStore;
assert( i1+nMerge<=nBuf );
for(iStore=i1; iStore<i1+nMerge; iStore++){
if( aBuf[iStore].n==0 ){
fts5BufferSwap(&doclist, &aBuf[iStore]);
fts5BufferZero(&doclist);
break;
}
}
if( iStore==i1+nMerge ){
xMerge(p, &doclist, nMerge, &aBuf[i1]);
for(iStore=i1; iStore<i1+nMerge; iStore++){
fts5BufferZero(&aBuf[iStore]);
}
}
}
iLastRowid = 0;
}
xAppend(p, p1->base.iRowid-iLastRowid, p1, &doclist);
iLastRowid = p1->base.iRowid;
}
assert( (nBuf%nMerge)==0 );
for(i=0; i<nBuf; i+=nMerge){
int iFree;
if( p->rc==SQLITE_OK ){
xMerge(p, &doclist, nMerge, &aBuf[i]);
}
for(iFree=i; iFree<i+nMerge; iFree++){
fts5BufferFree(&aBuf[iFree]);
}
}
fts5MultiIterFree(p1);
pData = fts5IdxMalloc(p, sizeof(Fts5Data)+doclist.n+FTS5_DATA_ZERO_PADDING);
if( pData ){
pData->p = (u8*)&pData[1];
pData->nn = pData->szLeaf = doclist.n;
|
| ︙ | ︙ | |||
222808 222809 222810 222811 222812 222813 222814 222815 222816 222817 222818 222819 222820 222821 |
Fts5Buffer buf = {0, 0, 0};
/* If the QUERY_SCAN flag is set, all other flags must be clear. */
assert( (flags & FTS5INDEX_QUERY_SCAN)==0 || flags==FTS5INDEX_QUERY_SCAN );
if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){
int iIdx = 0; /* Index to search */
if( nToken ) memcpy(&buf.p[1], pToken, nToken);
/* Figure out which index to search and set iIdx accordingly. If this
** is a prefix query for which there is no prefix index, set iIdx to
** greater than pConfig->nPrefix to indicate that the query will be
** satisfied by scanning multiple terms in the main index.
**
| > | 223541 223542 223543 223544 223545 223546 223547 223548 223549 223550 223551 223552 223553 223554 223555 |
Fts5Buffer buf = {0, 0, 0};
/* If the QUERY_SCAN flag is set, all other flags must be clear. */
assert( (flags & FTS5INDEX_QUERY_SCAN)==0 || flags==FTS5INDEX_QUERY_SCAN );
if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){
int iIdx = 0; /* Index to search */
int iPrefixIdx = 0; /* +1 prefix index */
if( nToken ) memcpy(&buf.p[1], pToken, nToken);
/* Figure out which index to search and set iIdx accordingly. If this
** is a prefix query for which there is no prefix index, set iIdx to
** greater than pConfig->nPrefix to indicate that the query will be
** satisfied by scanning multiple terms in the main index.
**
|
| ︙ | ︙ | |||
222829 222830 222831 222832 222833 222834 222835 |
assert( flags & FTS5INDEX_QUERY_PREFIX );
iIdx = 1+pConfig->nPrefix;
}else
#endif
if( flags & FTS5INDEX_QUERY_PREFIX ){
int nChar = fts5IndexCharlen(pToken, nToken);
for(iIdx=1; iIdx<=pConfig->nPrefix; iIdx++){
| | > > < | | 223563 223564 223565 223566 223567 223568 223569 223570 223571 223572 223573 223574 223575 223576 223577 223578 223579 223580 223581 223582 223583 223584 223585 223586 223587 223588 223589 223590 223591 223592 223593 223594 223595 223596 |
assert( flags & FTS5INDEX_QUERY_PREFIX );
iIdx = 1+pConfig->nPrefix;
}else
#endif
if( flags & FTS5INDEX_QUERY_PREFIX ){
int nChar = fts5IndexCharlen(pToken, nToken);
for(iIdx=1; iIdx<=pConfig->nPrefix; iIdx++){
int nIdxChar = pConfig->aPrefix[iIdx-1];
if( nIdxChar==nChar ) break;
if( nIdxChar==nChar+1 ) iPrefixIdx = iIdx;
}
}
if( iIdx<=pConfig->nPrefix ){
/* Straight index lookup */
Fts5Structure *pStruct = fts5StructureRead(p);
buf.p[0] = (u8)(FTS5_MAIN_PREFIX + iIdx);
if( pStruct ){
fts5MultiIterNew(p, pStruct, flags | FTS5INDEX_QUERY_SKIPEMPTY,
pColset, buf.p, nToken+1, -1, 0, &pRet
);
fts5StructureRelease(pStruct);
}
}else{
/* Scan multiple terms in the main index */
int bDesc = (flags & FTS5INDEX_QUERY_DESC)!=0;
fts5SetupPrefixIter(p, bDesc, iPrefixIdx, buf.p, nToken+1, pColset,&pRet);
assert( p->rc!=SQLITE_OK || pRet->pColset==0 );
fts5IterSetOutputCb(&p->rc, pRet);
if( p->rc==SQLITE_OK ){
Fts5SegIter *pSeg = &pRet->aSeg[pRet->aFirst[1].iFirst];
if( pSeg->pLeaf ) pRet->xSetOutputs(pRet, pSeg);
}
}
|
| ︙ | ︙ | |||
226815 226816 226817 226818 226819 226820 226821 |
static void fts5SourceIdFunc(
sqlite3_context *pCtx, /* Function call context */
int nArg, /* Number of args */
sqlite3_value **apUnused /* Function arguments */
){
assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused);
| | | 227550 227551 227552 227553 227554 227555 227556 227557 227558 227559 227560 227561 227562 227563 227564 |
static void fts5SourceIdFunc(
sqlite3_context *pCtx, /* Function call context */
int nArg, /* Number of args */
sqlite3_value **apUnused /* Function arguments */
){
assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused);
sqlite3_result_text(pCtx, "fts5: 2020-12-15 13:55:38 ea0a7f103a6f6a9e57d7377140ff9f372bf2b156f86f148291fb05a7030f2b36", -1, SQLITE_TRANSIENT);
}
/*
** Return true if zName is the extension on one of the shadow tables used
** by this module.
*/
static int fts5ShadowName(const char *zName){
|
| ︙ | ︙ | |||
231741 231742 231743 231744 231745 231746 231747 | #endif return rc; } #endif /* SQLITE_CORE */ #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ /************** End of stmt.c ************************************************/ | | | | 232476 232477 232478 232479 232480 232481 232482 232483 232484 232485 232486 232487 232488 232489 |
#endif
return rc;
}
#endif /* SQLITE_CORE */
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
/************** End of stmt.c ************************************************/
#if __LINE__!=232483
#undef SQLITE_SOURCE_ID
#define SQLITE_SOURCE_ID "2020-12-15 13:55:38 ea0a7f103a6f6a9e57d7377140ff9f372bf2b156f86f148291fb05a7030falt2"
#endif
/* Return the source-id for this library */
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
/************************** End of sqlite3.c ******************************/
|
Changes to src/sqlite3.h.
| ︙ | ︙ | |||
119 120 121 122 123 124 125 | ** been edited in any way since it was last checked in, then the last ** four hexadecimal digits of the hash may be modified. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ | | | | | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | ** been edited in any way since it was last checked in, then the last ** four hexadecimal digits of the hash may be modified. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.35.0" #define SQLITE_VERSION_NUMBER 3035000 #define SQLITE_SOURCE_ID "2020-12-15 13:55:38 ea0a7f103a6f6a9e57d7377140ff9f372bf2b156f86f148291fb05a7030f2b36" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
| ︙ | ︙ | |||
7761 7762 7763 7764 7765 7766 7767 | #define SQLITE_TESTCTRL_SORTER_MMAP 24 #define SQLITE_TESTCTRL_IMPOSTER 25 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26 #define SQLITE_TESTCTRL_RESULT_INTREAL 27 #define SQLITE_TESTCTRL_PRNG_SEED 28 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29 #define SQLITE_TESTCTRL_SEEK_COUNT 30 | > | | 7761 7762 7763 7764 7765 7766 7767 7768 7769 7770 7771 7772 7773 7774 7775 7776 | #define SQLITE_TESTCTRL_SORTER_MMAP 24 #define SQLITE_TESTCTRL_IMPOSTER 25 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26 #define SQLITE_TESTCTRL_RESULT_INTREAL 27 #define SQLITE_TESTCTRL_PRNG_SEED 28 #define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29 #define SQLITE_TESTCTRL_SEEK_COUNT 30 #define SQLITE_TESTCTRL_TRACEFLAGS 31 #define SQLITE_TESTCTRL_LAST 31 /* Largest TESTCTRL */ /* ** CAPI3REF: SQL Keyword Checking ** ** These routines provide access to the set of SQL language keywords ** recognized by SQLite. Applications can uses these routines to determine ** whether or not a specific identifier needs to be escaped (for example, |
| ︙ | ︙ |