Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Update the built-in SQLite to the latest 3.24.0 alpha version. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
de76c92a63e9e009804cbdbad9622137 |
User & Date: | drh 2018-04-25 13:34:17.474 |
Context
2018-04-26
| ||
19:02 | Improved handling of the the yw= query parameter on /timeline. ... (check-in: 881b4646 user: drh tags: trunk) | |
2018-04-25
| ||
13:34 | Update the built-in SQLite to the latest 3.24.0 alpha version. ... (check-in: de76c92a user: drh tags: trunk) | |
2018-04-21
| ||
22:58 | Fix minor typo in the fossil-v-git document. ... (check-in: 2e8f2887 user: drh tags: trunk) | |
Changes
Changes to src/main.mk.
︙ | ︙ | |||
587 588 589 590 591 592 593 | -DSQLITE_HAVE_ZLIB \ -DSQLITE_INTROSPECTION_PRAGMAS \ -DSQLITE_ENABLE_DBPAGE_VTAB \ -Dmain=sqlite3_shell \ -DSQLITE_SHELL_IS_UTF8=1 \ -DSQLITE_OMIT_LOAD_EXTENSION=1 \ -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \ | | > | 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | -DSQLITE_HAVE_ZLIB \ -DSQLITE_INTROSPECTION_PRAGMAS \ -DSQLITE_ENABLE_DBPAGE_VTAB \ -Dmain=sqlite3_shell \ -DSQLITE_SHELL_IS_UTF8=1 \ -DSQLITE_OMIT_LOAD_EXTENSION=1 \ -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \ -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname \ -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc # Setup the options used to compile the included miniz library. MINIZ_OPTIONS = -DMINIZ_NO_STDIO \ -DMINIZ_NO_TIME \ -DMINIZ_NO_ARCHIVE_APIS # The USE_SYSTEM_SQLITE variable may be undefined, set to 0, or set |
︙ | ︙ |
Changes to src/makemake.tcl.
︙ | ︙ | |||
204 205 206 207 208 209 210 | # Options used to compile the included SQLite shell. # set SHELL_OPTIONS [concat $SQLITE_OPTIONS { -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) | | > | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | # Options used to compile the included SQLite shell. # set SHELL_OPTIONS [concat $SQLITE_OPTIONS { -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc }] # miniz (libz drop-in alternative) precompiler flags. # set MINIZ_OPTIONS { -DMINIZ_NO_STDIO -DMINIZ_NO_TIME |
︙ | ︙ |
Changes to src/shell.c.
︙ | ︙ | |||
449 450 451 452 453 454 455 456 457 458 459 460 461 462 | /* ** Render output like fprintf(). This should not be used on anything that ** includes string formatting (e.g. "%s"). */ #if !defined(raw_printf) # define raw_printf fprintf #endif /* ** Write I/O traces to the following stream. */ #ifdef SQLITE_ENABLE_IOTRACE static FILE *iotrace = 0; #endif | > > > > > > | 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | /* ** Render output like fprintf(). This should not be used on anything that ** includes string formatting (e.g. "%s"). */ #if !defined(raw_printf) # define raw_printf fprintf #endif /* Indicate out-of-memory and exit. */ static void shell_out_of_memory(void){ raw_printf(stderr,"Error: out of memory\n"); exit(1); } /* ** Write I/O traces to the following stream. */ #ifdef SQLITE_ENABLE_IOTRACE static FILE *iotrace = 0; #endif |
︙ | ︙ | |||
8525 8526 8527 8528 8529 8530 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 | typedef struct ExpertInfo ExpertInfo; struct ExpertInfo { sqlite3expert *pExpert; int bVerbose; }; /* ** State information about the database connection is contained in an ** instance of the following structure. */ typedef struct ShellState ShellState; struct ShellState { sqlite3 *db; /* The database */ u8 autoExplain; /* Automatically turn on .explain mode */ u8 autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL stmt */ u8 statsOn; /* True to display memory stats before each finalize */ u8 scanstatsOn; /* True to display scan stats before each finalize */ u8 openMode; /* SHELL_OPEN_NORMAL, _APPENDVFS, or _ZIPFILE */ u8 doXdgOpen; /* Invoke start/open/xdg-open in output_reset() */ int outCount; /* Revert to stdout when reaching zero */ int cnt; /* Number of records displayed so far */ FILE *out; /* Write results here */ FILE *traceOut; /* Output for sqlite3_trace() */ int nErr; /* Number of errors seen */ int mode; /* An output mode setting */ int modePrior; /* Saved mode */ | > > > > > > > > > > > > > > > > > > | 8531 8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 8555 8556 8557 8558 8559 8560 8561 8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 | typedef struct ExpertInfo ExpertInfo; struct ExpertInfo { sqlite3expert *pExpert; int bVerbose; }; /* A single line in the EQP output */ typedef struct EQPGraphRow EQPGraphRow; struct EQPGraphRow { int iSelectId; /* The SelectID for this row */ EQPGraphRow *pNext; /* Next row in sequence */ char zText[1]; /* Text to display for this row */ }; /* All EQP output is collected into an instance of the following */ typedef struct EQPGraph EQPGraph; struct EQPGraph { EQPGraphRow *pRow; /* Linked list of all rows of the EQP output */ EQPGraphRow *pLast; /* Last element of the pRow list */ char zPrefix[100]; /* Graph prefix */ }; /* ** State information about the database connection is contained in an ** instance of the following structure. */ typedef struct ShellState ShellState; struct ShellState { sqlite3 *db; /* The database */ u8 autoExplain; /* Automatically turn on .explain mode */ u8 autoEQP; /* Run EXPLAIN QUERY PLAN prior to seach SQL stmt */ u8 statsOn; /* True to display memory stats before each finalize */ u8 scanstatsOn; /* True to display scan stats before each finalize */ u8 openMode; /* SHELL_OPEN_NORMAL, _APPENDVFS, or _ZIPFILE */ u8 doXdgOpen; /* Invoke start/open/xdg-open in output_reset() */ u8 nEqpLevel; /* Depth of the EQP output graph */ unsigned mEqpLines; /* Mask of veritical lines in the EQP output graph */ int outCount; /* Revert to stdout when reaching zero */ int cnt; /* Number of records displayed so far */ FILE *out; /* Write results here */ FILE *traceOut; /* Output for sqlite3_trace() */ int nErr; /* Number of errors seen */ int mode; /* An output mode setting */ int modePrior; /* Saved mode */ |
︙ | ︙ | |||
8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 | char *zFreeOnClose; /* Filename to free when closing */ const char *zVfs; /* Name of VFS to use */ sqlite3_stmt *pStmt; /* Current statement if any. */ FILE *pLog; /* Write log output here */ int *aiIndent; /* Array of indents used in MODE_Explain */ int nIndent; /* Size of array aiIndent[] */ int iIndent; /* Index of current op in aiIndent[] */ #if defined(SQLITE_ENABLE_SESSION) int nSession; /* Number of active sessions */ OpenSession aSession[4]; /* Array of sessions. [0] is in focus. */ #endif ExpertInfo expert; /* Valid if previous command was ".expert OPT..." */ }; | > | 8595 8596 8597 8598 8599 8600 8601 8602 8603 8604 8605 8606 8607 8608 8609 | char *zFreeOnClose; /* Filename to free when closing */ const char *zVfs; /* Name of VFS to use */ sqlite3_stmt *pStmt; /* Current statement if any. */ FILE *pLog; /* Write log output here */ int *aiIndent; /* Array of indents used in MODE_Explain */ int nIndent; /* Size of array aiIndent[] */ int iIndent; /* Index of current op in aiIndent[] */ EQPGraph sGraph; /* Information for the graphical EXPLAIN QUERY PLAN */ #if defined(SQLITE_ENABLE_SESSION) int nSession; /* Number of active sessions */ OpenSession aSession[4]; /* Array of sessions. [0] is in focus. */ #endif ExpertInfo expert; /* Valid if previous command was ".expert OPT..." */ }; |
︙ | ︙ | |||
8627 8628 8629 8630 8631 8632 8633 8634 8635 8636 8637 8638 8639 8640 8641 8642 8643 8644 8645 8646 8647 8648 8649 8650 8651 8652 8653 8654 | #define MODE_Insert 5 /* Generate SQL "insert" statements */ #define MODE_Quote 6 /* Quote values as for SQL */ #define MODE_Tcl 7 /* Generate ANSI-C or TCL quoted elements */ #define MODE_Csv 8 /* Quote strings, numbers are plain */ #define MODE_Explain 9 /* Like MODE_Column, but do not truncate data */ #define MODE_Ascii 10 /* Use ASCII unit and record separators (0x1F/0x1E) */ #define MODE_Pretty 11 /* Pretty-print schemas */ static const char *modeDescr[] = { "line", "column", "list", "semi", "html", "insert", "quote", "tcl", "csv", "explain", "ascii", "prettyprint", }; /* ** These are the column/row/line separators used by the various ** import/export modes. */ #define SEP_Column "|" | > > | 8652 8653 8654 8655 8656 8657 8658 8659 8660 8661 8662 8663 8664 8665 8666 8667 8668 8669 8670 8671 8672 8673 8674 8675 8676 8677 8678 8679 8680 8681 | #define MODE_Insert 5 /* Generate SQL "insert" statements */ #define MODE_Quote 6 /* Quote values as for SQL */ #define MODE_Tcl 7 /* Generate ANSI-C or TCL quoted elements */ #define MODE_Csv 8 /* Quote strings, numbers are plain */ #define MODE_Explain 9 /* Like MODE_Column, but do not truncate data */ #define MODE_Ascii 10 /* Use ASCII unit and record separators (0x1F/0x1E) */ #define MODE_Pretty 11 /* Pretty-print schemas */ #define MODE_EQP 12 /* Converts EXPLAIN QUERY PLAN output into a graph */ static const char *modeDescr[] = { "line", "column", "list", "semi", "html", "insert", "quote", "tcl", "csv", "explain", "ascii", "prettyprint", "eqp" }; /* ** These are the column/row/line separators used by the various ** import/export modes. */ #define SEP_Column "|" |
︙ | ︙ | |||
9189 9190 9191 9192 9193 9194 9195 | if( z[i]=='\n' ) return 1; if( IsSpace(z[i]) ) continue; if( z[i]=='-' && z[i+1]=='-' ) return 1; return 0; } return 1; } | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 9216 9217 9218 9219 9220 9221 9222 9223 9224 9225 9226 9227 9228 9229 9230 9231 9232 9233 9234 9235 9236 9237 9238 9239 9240 9241 9242 9243 9244 9245 9246 9247 9248 9249 9250 9251 9252 9253 9254 9255 9256 9257 9258 9259 9260 9261 9262 9263 9264 9265 9266 9267 9268 9269 9270 9271 9272 9273 9274 9275 9276 9277 9278 9279 9280 9281 9282 9283 9284 9285 9286 9287 9288 9289 9290 9291 9292 9293 9294 9295 9296 9297 9298 9299 9300 9301 9302 9303 9304 9305 9306 9307 9308 9309 9310 9311 9312 9313 9314 9315 9316 9317 9318 9319 9320 9321 9322 9323 9324 9325 9326 9327 9328 9329 | if( z[i]=='\n' ) return 1; if( IsSpace(z[i]) ) continue; if( z[i]=='-' && z[i+1]=='-' ) return 1; return 0; } return 1; } /* ** Add a new entry to the EXPLAIN QUERY PLAN data */ static void eqp_append(ShellState *p, int iSelectId, const char *zText){ EQPGraphRow *pNew; int nText = strlen30(zText); pNew = sqlite3_malloc64( sizeof(*pNew) + nText ); if( pNew==0 ) shell_out_of_memory(); pNew->iSelectId = iSelectId; memcpy(pNew->zText, zText, nText+1); pNew->pNext = 0; if( p->sGraph.pLast ){ p->sGraph.pLast->pNext = pNew; }else{ p->sGraph.pRow = pNew; } p->sGraph.pLast = pNew; } /* ** Free and reset the EXPLAIN QUERY PLAN data that has been collected ** in p->sGraph. */ static void eqp_reset(ShellState *p){ EQPGraphRow *pRow, *pNext; for(pRow = p->sGraph.pRow; pRow; pRow = pNext){ pNext = pRow->pNext; sqlite3_free(pRow); } memset(&p->sGraph, 0, sizeof(p->sGraph)); } /* Return the next EXPLAIN QUERY PLAN line with iSelectId that occurs after ** pOld, or return the first such line if pOld is NULL */ static EQPGraphRow *eqp_next_row(ShellState *p, int iSelectId, EQPGraphRow *pOld){ EQPGraphRow *pRow = pOld ? pOld->pNext : p->sGraph.pRow; while( pRow && pRow->iSelectId!=iSelectId ) pRow = pRow->pNext; return pRow; } /* Render a single level of the graph shell having iSelectId. Called ** recursively to render sublevels. */ static void eqp_render_level(ShellState *p, int iSelectId){ EQPGraphRow *pRow, *pNext; int i; int n = strlen30(p->sGraph.zPrefix); char *z; for(pRow = eqp_next_row(p, iSelectId, 0); pRow; pRow = pNext){ pNext = eqp_next_row(p, iSelectId, pRow); z = pRow->zText; utf8_printf(p->out, "%s%s%s\n", p->sGraph.zPrefix, pNext ? "|--" : "`--", z); if( n<sizeof(p->sGraph.zPrefix)-7 && (z = strstr(z, " SUBQUER"))!=0 ){ memcpy(&p->sGraph.zPrefix[n], pNext ? "| " : " ", 4); if( strncmp(z, " SUBQUERY ", 9)==0 && (i = atoi(z+10))>iSelectId ){ eqp_render_level(p, i); }else if( strncmp(z, " SUBQUERIES ", 12)==0 ){ i = atoi(z+12); if( i>iSelectId ){ utf8_printf(p->out, "%s|--SUBQUERY %d\n", p->sGraph.zPrefix, i); memcpy(&p->sGraph.zPrefix[n+3],"| ",4); eqp_render_level(p, i); } z = strstr(z, " AND "); if( z && (i = atoi(z+5))>iSelectId ){ p->sGraph.zPrefix[n+3] = 0; utf8_printf(p->out, "%s`--SUBQUERY %d\n", p->sGraph.zPrefix, i); memcpy(&p->sGraph.zPrefix[n+3]," ",4); eqp_render_level(p, i); } } p->sGraph.zPrefix[n] = 0; } } } /* ** Display and reset the EXPLAIN QUERY PLAN data */ static void eqp_render(ShellState *p){ EQPGraphRow *pRow = p->sGraph.pRow; if( pRow ){ if( pRow->zText[0]=='-' ){ if( pRow->pNext==0 ){ eqp_reset(p); return; } utf8_printf(p->out, "%s\n", pRow->zText+3); p->sGraph.pRow = pRow->pNext; sqlite3_free(pRow); }else{ utf8_printf(p->out, "QUERY PLAN\n"); } p->sGraph.zPrefix[0] = 0; eqp_render_level(p, 0); eqp_reset(p); } } /* ** This is the callback routine that the shell ** invokes for each row of a query result. */ static int shell_callback( void *pArg, |
︙ | ︙ | |||
9540 9541 9542 9543 9544 9545 9546 9547 9548 9549 9550 9551 9552 9553 | for(i=0; i<nArg; i++){ if( i>0 ) utf8_printf(p->out, "%s", p->colSeparator); utf8_printf(p->out,"%s",azArg[i] ? azArg[i] : p->nullValue); } utf8_printf(p->out, "%s", p->rowSeparator); break; } } return 0; } /* ** This is the callback routine that the SQLite library ** invokes for each row of a query result. | > > > > | 9666 9667 9668 9669 9670 9671 9672 9673 9674 9675 9676 9677 9678 9679 9680 9681 9682 9683 | for(i=0; i<nArg; i++){ if( i>0 ) utf8_printf(p->out, "%s", p->colSeparator); utf8_printf(p->out,"%s",azArg[i] ? azArg[i] : p->nullValue); } utf8_printf(p->out, "%s", p->rowSeparator); break; } case MODE_EQP: { eqp_append(p, atoi(azArg[0]), azArg[3]); break; } } return 0; } /* ** This is the callback routine that the SQLite library ** invokes for each row of a query result. |
︙ | ︙ | |||
9638 9639 9640 9641 9642 9643 9644 | p->zDestTable = 0; } if( zName==0 ) return; cQuote = quoteChar(zName); n = strlen30(zName); if( cQuote ) n += n+2; z = p->zDestTable = malloc( n+1 ); | | < < < | 9768 9769 9770 9771 9772 9773 9774 9775 9776 9777 9778 9779 9780 9781 9782 | p->zDestTable = 0; } if( zName==0 ) return; cQuote = quoteChar(zName); n = strlen30(zName); if( cQuote ) n += n+2; z = p->zDestTable = malloc( n+1 ); if( z==0 ) shell_out_of_memory(); n = 0; if( cQuote ) z[n++] = cQuote; for(i=0; zName[i]; i++){ z[n++] = zName[i]; if( zName[i]==cQuote ) z[n++] = cQuote; } if( cQuote ) z[n++] = cQuote; |
︙ | ︙ | |||
10381 10382 10383 10384 10385 10386 10387 | if( pArg->autoEQP>=AUTOEQP_trigger ){ sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, 1, 0); } zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", zStmtSql); rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0); if( rc==SQLITE_OK ){ while( sqlite3_step(pExplain)==SQLITE_ROW ){ | | | | | > | 10508 10509 10510 10511 10512 10513 10514 10515 10516 10517 10518 10519 10520 10521 10522 10523 10524 10525 10526 10527 | if( pArg->autoEQP>=AUTOEQP_trigger ){ sqlite3_db_config(db, SQLITE_DBCONFIG_TRIGGER_EQP, 1, 0); } zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", zStmtSql); rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0); if( rc==SQLITE_OK ){ while( sqlite3_step(pExplain)==SQLITE_ROW ){ const char *zEQPLine = (const char*)sqlite3_column_text(pExplain,3); int iSelectId = sqlite3_column_int(pExplain, 0); if( zEQPLine[0]=='-' ) eqp_render(pArg); eqp_append(pArg, iSelectId, zEQPLine); } eqp_render(pArg); } sqlite3_finalize(pExplain); sqlite3_free(zEQP); if( pArg->autoEQP>=AUTOEQP_full ){ /* Also do an EXPLAIN for ".eqp full" mode */ zEQP = sqlite3_mprintf("EXPLAIN %s", zStmtSql); rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0); |
︙ | ︙ | |||
10413 10414 10415 10416 10417 10418 10419 | sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); } restore_debug_trace_modes(); } if( pArg ){ pArg->cMode = pArg->mode; | | | | | | > > > > > > | 10541 10542 10543 10544 10545 10546 10547 10548 10549 10550 10551 10552 10553 10554 10555 10556 10557 10558 10559 10560 10561 10562 10563 10564 10565 10566 10567 10568 10569 10570 10571 10572 10573 10574 10575 10576 | sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); } restore_debug_trace_modes(); } if( pArg ){ pArg->cMode = pArg->mode; if( pArg->autoExplain ){ if( sqlite3_column_count(pStmt)==8 && sqlite3_strlike("EXPLAIN%", zStmtSql,0)==0 ){ pArg->cMode = MODE_Explain; } if( sqlite3_column_count(pStmt)==4 && sqlite3_strlike("EXPLAIN QUERY PLAN%", zStmtSql,0)==0 ){ pArg->cMode = MODE_EQP; } } /* If the shell is currently in ".explain" mode, gather the extra ** data required to add indents to the output.*/ if( pArg->cMode==MODE_Explain ){ explain_data_prepare(pArg, pStmt); } } exec_prepared_stmt(pArg, pStmt); explain_data_delete(pArg); eqp_render(pArg); /* print usage stats if stats on */ if( pArg && pArg->statsOn ){ display_stats(db, pArg, 0); } /* print loop-counters if required */ |
︙ | ︙ | |||
10506 10507 10508 10509 10510 10511 10512 | rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); sqlite3_free(zSql); if( rc ) return 0; while( sqlite3_step(pStmt)==SQLITE_ROW ){ if( nCol>=nAlloc-2 ){ nAlloc = nAlloc*2 + nCol + 10; azCol = sqlite3_realloc(azCol, nAlloc*sizeof(azCol[0])); | | < < < | 10640 10641 10642 10643 10644 10645 10646 10647 10648 10649 10650 10651 10652 10653 10654 | rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); sqlite3_free(zSql); if( rc ) return 0; while( sqlite3_step(pStmt)==SQLITE_ROW ){ if( nCol>=nAlloc-2 ){ nAlloc = nAlloc*2 + nCol + 10; azCol = sqlite3_realloc(azCol, nAlloc*sizeof(azCol[0])); if( azCol==0 ) shell_out_of_memory(); } azCol[++nCol] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 1)); if( sqlite3_column_int(pStmt, 5) ){ nPK++; if( nPK==1 && sqlite3_stricmp((const char*)sqlite3_column_text(pStmt,2), "INTEGER")==0 |
︙ | ︙ | |||
11004 11005 11006 11007 11008 11009 11010 | /* ** Make sure the database is open. If it is not, then open it. If ** the database fails to open, print an error message and exit. */ static void open_db(ShellState *p, int keepAlive){ if( p->db==0 ){ | < | 11135 11136 11137 11138 11139 11140 11141 11142 11143 11144 11145 11146 11147 11148 | /* ** Make sure the database is open. If it is not, then open it. If ** the database fails to open, print an error message and exit. */ static void open_db(ShellState *p, int keepAlive){ if( p->db==0 ){ if( p->openMode==SHELL_OPEN_UNSPEC && access(p->zDbFilename,0)==0 ){ p->openMode = (u8)deduceDatabaseType(p->zDbFilename, 0); } switch( p->openMode ){ case SHELL_OPEN_APPENDVFS: { sqlite3_open_v2(p->zDbFilename, &p->db, SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE, "apndvfs"); |
︙ | ︙ | |||
11307 11308 11309 11310 11311 11312 11313 | }; /* Append a single byte to z[] */ static void import_append_char(ImportCtx *p, int c){ if( p->n+1>=p->nAlloc ){ p->nAlloc += p->nAlloc + 100; p->z = sqlite3_realloc64(p->z, p->nAlloc); | | < < < | 11437 11438 11439 11440 11441 11442 11443 11444 11445 11446 11447 11448 11449 11450 11451 | }; /* Append a single byte to z[] */ static void import_append_char(ImportCtx *p, int c){ if( p->n+1>=p->nAlloc ){ p->nAlloc += p->nAlloc + 100; p->z = sqlite3_realloc64(p->z, p->nAlloc); if( p->z==0 ) shell_out_of_memory(); } p->z[p->n++] = (char)c; } /* Read a single field of CSV text. Compatible with rfc4180 and extended ** with the option of having a separator other than ",". ** |
︙ | ︙ | |||
11471 11472 11473 11474 11475 11476 11477 | utf8_printf(stderr, "Error %d: %s on [%s]\n", sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db), zQuery); goto end_data_xfer; } n = sqlite3_column_count(pQuery); zInsert = sqlite3_malloc64(200 + nTable + n*3); | | < < < | 11598 11599 11600 11601 11602 11603 11604 11605 11606 11607 11608 11609 11610 11611 11612 | utf8_printf(stderr, "Error %d: %s on [%s]\n", sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db), zQuery); goto end_data_xfer; } n = sqlite3_column_count(pQuery); zInsert = sqlite3_malloc64(200 + nTable + n*3); if( zInsert==0 ) shell_out_of_memory(); sqlite3_snprintf(200+nTable,zInsert, "INSERT OR IGNORE INTO \"%s\" VALUES(?", zTable); i = strlen30(zInsert); for(j=1; j<n; j++){ memcpy(zInsert+i, ",?", 2); i += 2; } |
︙ | ︙ | |||
11815 11816 11817 11818 11819 11820 11821 | */ static int shellDatabaseError(sqlite3 *db){ const char *zErr = sqlite3_errmsg(db); utf8_printf(stderr, "Error: %s\n", zErr); return 1; } | < < < < < < < < | 11939 11940 11941 11942 11943 11944 11945 11946 11947 11948 11949 11950 11951 11952 | */ static int shellDatabaseError(sqlite3 *db){ const char *zErr = sqlite3_errmsg(db); utf8_printf(stderr, "Error: %s\n", zErr); return 1; } /* ** Compare the pattern in zGlob[] against the text in z[]. Return TRUE ** if they match and FALSE (0) if they do not match. ** ** Globbing rules: ** ** '*' Matches any sequence of zero or more characters. |
︙ | ︙ | |||
13516 13517 13518 13519 13520 13521 13522 | utf8_printf(stderr, "Error: cannot open \"%s\"\n", zFile); return 1; } sCtx.cColSep = p->colSeparator[0]; sCtx.cRowSep = p->rowSeparator[0]; zSql = sqlite3_mprintf("SELECT * FROM %s", zTable); if( zSql==0 ){ | < < > | 13632 13633 13634 13635 13636 13637 13638 13639 13640 13641 13642 13643 13644 13645 13646 13647 | utf8_printf(stderr, "Error: cannot open \"%s\"\n", zFile); return 1; } sCtx.cColSep = p->colSeparator[0]; sCtx.cRowSep = p->rowSeparator[0]; zSql = sqlite3_mprintf("SELECT * FROM %s", zTable); if( zSql==0 ){ xCloser(sCtx.in); shell_out_of_memory(); } nByte = strlen30(zSql); rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); import_append_char(&sCtx, 0); /* To ensure sCtx.z is allocated */ if( rc && sqlite3_strglob("no such table: *", sqlite3_errmsg(p->db))==0 ){ char *zCreate = sqlite3_mprintf("CREATE TABLE %s", zTable); char cSep = '('; |
︙ | ︙ | |||
13563 13564 13565 13566 13567 13568 13569 | } nCol = sqlite3_column_count(pStmt); sqlite3_finalize(pStmt); pStmt = 0; if( nCol==0 ) return 0; /* no columns, no error */ zSql = sqlite3_malloc64( nByte*2 + 20 + nCol*2 ); if( zSql==0 ){ | < < > | 13678 13679 13680 13681 13682 13683 13684 13685 13686 13687 13688 13689 13690 13691 13692 13693 | } nCol = sqlite3_column_count(pStmt); sqlite3_finalize(pStmt); pStmt = 0; if( nCol==0 ) return 0; /* no columns, no error */ zSql = sqlite3_malloc64( nByte*2 + 20 + nCol*2 ); if( zSql==0 ){ xCloser(sCtx.in); shell_out_of_memory(); } sqlite3_snprintf(nByte+20, zSql, "INSERT INTO \"%w\" VALUES(?", zTable); j = strlen30(zSql); for(i=1; i<nCol; i++){ zSql[j++] = ','; zSql[j++] = '?'; } |
︙ | ︙ | |||
13641 13642 13643 13644 13645 13646 13647 | #ifndef SQLITE_UNTESTABLE if( c=='i' && strncmp(azArg[0], "imposter", n)==0 ){ char *zSql; char *zCollist = 0; sqlite3_stmt *pStmt; int tnum = 0; int i; | | | > > > > > | 13755 13756 13757 13758 13759 13760 13761 13762 13763 13764 13765 13766 13767 13768 13769 13770 13771 13772 13773 13774 13775 13776 13777 13778 13779 | #ifndef SQLITE_UNTESTABLE if( c=='i' && strncmp(azArg[0], "imposter", n)==0 ){ char *zSql; char *zCollist = 0; sqlite3_stmt *pStmt; int tnum = 0; int i; if( !(nArg==3 || (nArg==2 && sqlite3_stricmp(azArg[1],"off")==0)) ){ utf8_printf(stderr, "Usage: .imposter INDEX IMPOSTER\n" " .imposter off\n"); rc = 1; goto meta_command_exit; } open_db(p, 0); if( nArg==2 ){ sqlite3_test_control(SQLITE_TESTCTRL_IMPOSTER, p->db, "main", 0, 1); goto meta_command_exit; } zSql = sqlite3_mprintf("SELECT rootpage FROM sqlite_master" " WHERE name='%q' AND type='index'", azArg[1]); sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); sqlite3_free(zSql); if( sqlite3_step(pStmt)==SQLITE_ROW ){ tnum = sqlite3_column_int(pStmt, 0); } |
︙ | ︙ | |||
14831 14832 14833 14834 14835 14836 14837 | sqlite3_bind_text(pStmt, 1, "%", -1, SQLITE_STATIC); } while( sqlite3_step(pStmt)==SQLITE_ROW ){ if( nRow>=nAlloc ){ char **azNew; int n2 = nAlloc*2 + 10; azNew = sqlite3_realloc64(azResult, sizeof(azResult[0])*n2); | | < < < | < < < | 14950 14951 14952 14953 14954 14955 14956 14957 14958 14959 14960 14961 14962 14963 14964 14965 14966 14967 14968 14969 | sqlite3_bind_text(pStmt, 1, "%", -1, SQLITE_STATIC); } while( sqlite3_step(pStmt)==SQLITE_ROW ){ if( nRow>=nAlloc ){ char **azNew; int n2 = nAlloc*2 + 10; azNew = sqlite3_realloc64(azResult, sizeof(azResult[0])*n2); if( azNew==0 ) shell_out_of_memory(); nAlloc = n2; azResult = azNew; } azResult[nRow] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 0)); if( 0==azResult[nRow] ) shell_out_of_memory(); nRow++; } if( sqlite3_finalize(pStmt)!=SQLITE_OK ){ rc = shellDatabaseError(p->db); } /* Pretty-print the contents of array azResult[] to the output */ |
︙ | ︙ | |||
15413 15414 15415 15416 15417 15418 15419 | if( line_is_command_terminator(zLine) && line_is_complete(zSql, nSql) ){ memcpy(zLine,";",2); } nLine = strlen30(zLine); if( nSql+nLine+2>=nAlloc ){ nAlloc = nSql+nLine+100; zSql = realloc(zSql, nAlloc); | | < < < | 15526 15527 15528 15529 15530 15531 15532 15533 15534 15535 15536 15537 15538 15539 15540 | if( line_is_command_terminator(zLine) && line_is_complete(zSql, nSql) ){ memcpy(zLine,";",2); } nLine = strlen30(zLine); if( nSql+nLine+2>=nAlloc ){ nAlloc = nSql+nLine+100; zSql = realloc(zSql, nAlloc); if( zSql==0 ) shell_out_of_memory(); } nSqlPrior = nSql; if( nSql==0 ){ int i; for(i=0; zLine[i] && IsSpace(zLine[i]); i++){} assert( nAlloc>0 && zSql!=0 ); memcpy(zSql, zLine+i, nLine+1-i); |
︙ | ︙ | |||
15545 15546 15547 15548 15549 15550 15551 | if (sqliterc == NULL) { home_dir = find_home_dir(0); if( home_dir==0 ){ raw_printf(stderr, "-- warning: cannot find home directory;" " cannot read ~/.sqliterc\n"); return; } | < | 15655 15656 15657 15658 15659 15660 15661 15662 15663 15664 15665 15666 15667 15668 | if (sqliterc == NULL) { home_dir = find_home_dir(0); if( home_dir==0 ){ raw_printf(stderr, "-- warning: cannot find home directory;" " cannot read ~/.sqliterc\n"); return; } zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir); sqliterc = zBuf; } in = fopen(sqliterc,"rb"); if( in ){ if( stdin_is_interactive ){ utf8_printf(stderr,"-- Loading resources from %s\n",sqliterc); |
︙ | ︙ | |||
15596 15597 15598 15599 15600 15601 15602 15603 15604 15605 15606 15607 15608 15609 | #endif " -newline SEP set output row separator. Default: '\\n'\n" " -nullvalue TEXT set text string for NULL values. Default ''\n" " -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n" " -quote set output mode to 'quote'\n" " -readonly open the database read-only\n" " -separator SEP set output column separator. Default: '|'\n" " -stats print memory stats before each finalize\n" " -version show SQLite version\n" " -vfs NAME use NAME as the default VFS\n" #ifdef SQLITE_ENABLE_VFSTRACE " -vfstrace enable tracing of all VFS calls\n" #endif #ifdef SQLITE_HAVE_ZLIB | > > > | 15705 15706 15707 15708 15709 15710 15711 15712 15713 15714 15715 15716 15717 15718 15719 15720 15721 | #endif " -newline SEP set output row separator. Default: '\\n'\n" " -nullvalue TEXT set text string for NULL values. Default ''\n" " -pagecache SIZE N use N slots of SZ bytes each for page cache memory\n" " -quote set output mode to 'quote'\n" " -readonly open the database read-only\n" " -separator SEP set output column separator. Default: '|'\n" #ifdef SQLITE_ENABLE_SORTER_REFERENCES " -sorterref SIZE sorter references threshold size\n" #endif " -stats print memory stats before each finalize\n" " -version show SQLite version\n" " -vfs NAME use NAME as the default VFS\n" #ifdef SQLITE_ENABLE_VFSTRACE " -vfstrace enable tracing of all VFS calls\n" #endif #ifdef SQLITE_HAVE_ZLIB |
︙ | ︙ | |||
15618 15619 15620 15621 15622 15623 15624 15625 15626 15627 15628 15629 15630 15631 15632 15633 15634 15635 15636 15637 15638 15639 15640 15641 15642 15643 | if( showDetail ){ utf8_printf(stderr, "OPTIONS include:\n%s", zOptions); }else{ raw_printf(stderr, "Use the -help option for additional information\n"); } exit(1); } /* ** Initialize the state information in data */ static void main_init(ShellState *data) { memset(data, 0, sizeof(*data)); data->normalMode = data->cMode = data->mode = MODE_List; data->autoExplain = 1; memcpy(data->colSeparator,SEP_Column, 2); memcpy(data->rowSeparator,SEP_Row, 2); data->showHeader = 0; data->shellFlgs = SHFLG_Lookaside; sqlite3_config(SQLITE_CONFIG_URI, 1); sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data); sqlite3_config(SQLITE_CONFIG_MULTITHREAD); sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> "); sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> "); } | > > > > > > > > > > > > | 15730 15731 15732 15733 15734 15735 15736 15737 15738 15739 15740 15741 15742 15743 15744 15745 15746 15747 15748 15749 15750 15751 15752 15753 15754 15755 15756 15757 15758 15759 15760 15761 15762 15763 15764 15765 15766 15767 | if( showDetail ){ utf8_printf(stderr, "OPTIONS include:\n%s", zOptions); }else{ raw_printf(stderr, "Use the -help option for additional information\n"); } exit(1); } /* ** Internal check: Verify that the SQLite is uninitialized. Print a ** error message if it is initialized. */ static void verify_uninitialized(void){ if( sqlite3_config(-1)==SQLITE_MISUSE ){ utf8_printf(stdout, "WARNING: attempt to configuration SQLite after" " initialization.\n"); } } /* ** Initialize the state information in data */ static void main_init(ShellState *data) { memset(data, 0, sizeof(*data)); data->normalMode = data->cMode = data->mode = MODE_List; data->autoExplain = 1; memcpy(data->colSeparator,SEP_Column, 2); memcpy(data->rowSeparator,SEP_Row, 2); data->showHeader = 0; data->shellFlgs = SHFLG_Lookaside; verify_uninitialized(); sqlite3_config(SQLITE_CONFIG_URI, 1); sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data); sqlite3_config(SQLITE_CONFIG_MULTITHREAD); sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> "); sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> "); } |
︙ | ︙ | |||
15693 15694 15695 15696 15697 15698 15699 15700 15701 15702 15703 15704 15705 15706 | const char *zInitFile = 0; int i; int rc = 0; int warnInmemoryDb = 0; int readStdin = 1; int nCmd = 0; char **azCmd = 0; setBinaryMode(stdin, 0); setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */ stdin_is_interactive = isatty(0); stdout_is_console = isatty(1); #if USE_SYSTEM_SQLITE+0!=1 | > | 15817 15818 15819 15820 15821 15822 15823 15824 15825 15826 15827 15828 15829 15830 15831 | const char *zInitFile = 0; int i; int rc = 0; int warnInmemoryDb = 0; int readStdin = 1; int nCmd = 0; char **azCmd = 0; const char *zVfs = 0; /* Value of -vfs command-line option */ setBinaryMode(stdin, 0); setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */ stdin_is_interactive = isatty(0); stdout_is_console = isatty(1); #if USE_SYSTEM_SQLITE+0!=1 |
︙ | ︙ | |||
15717 15718 15719 15720 15721 15722 15723 | ** do this. But we want to run an sqlite3_shutdown() afterwards so that ** subsequent sqlite3_config() calls will work. So copy all results into ** memory that does not come from the SQLite memory allocator. */ #if !SQLITE_SHELL_IS_UTF8 sqlite3_initialize(); argv = malloc(sizeof(argv[0])*argc); | | < < < | < < < | < < < | 15842 15843 15844 15845 15846 15847 15848 15849 15850 15851 15852 15853 15854 15855 15856 15857 15858 15859 15860 15861 15862 15863 | ** do this. But we want to run an sqlite3_shutdown() afterwards so that ** subsequent sqlite3_config() calls will work. So copy all results into ** memory that does not come from the SQLite memory allocator. */ #if !SQLITE_SHELL_IS_UTF8 sqlite3_initialize(); argv = malloc(sizeof(argv[0])*argc); if( argv==0 ) shell_out_of_memory(); for(i=0; i<argc; i++){ char *z = sqlite3_win32_unicode_to_utf8(wargv[i]); int n; if( z==0 ) shell_out_of_memory(); n = (int)strlen(z); argv[i] = malloc( n+1 ); if( argv[i]==0 ) shell_out_of_memory(); memcpy(argv[i], z, n+1); sqlite3_free(z); } sqlite3_shutdown(); #endif assert( argc>=1 && argv && argv[0] ); |
︙ | ︙ | |||
15769 15770 15771 15772 15773 15774 15775 15776 15777 15778 15779 15780 15781 15782 15783 15784 15785 15786 15787 | #endif /* Do an initial pass through the command-line argument to locate ** the name of the database file, the name of the initialization file, ** the size of the alternative malloc heap, ** and the first command to execute. */ for(i=1; i<argc; i++){ char *z; z = argv[i]; if( z[0]!='-' ){ if( data.zDbFilename==0 ){ data.zDbFilename = z; }else{ /* Excesss arguments are interpreted as SQL (or dot-commands) and ** mean that nothing is read from stdin */ readStdin = 0; nCmd++; azCmd = realloc(azCmd, sizeof(azCmd[0])*nCmd); | > | < < < | 15885 15886 15887 15888 15889 15890 15891 15892 15893 15894 15895 15896 15897 15898 15899 15900 15901 15902 15903 15904 15905 15906 15907 15908 15909 15910 15911 15912 | #endif /* Do an initial pass through the command-line argument to locate ** the name of the database file, the name of the initialization file, ** the size of the alternative malloc heap, ** and the first command to execute. */ verify_uninitialized(); for(i=1; i<argc; i++){ char *z; z = argv[i]; if( z[0]!='-' ){ if( data.zDbFilename==0 ){ data.zDbFilename = z; }else{ /* Excesss arguments are interpreted as SQL (or dot-commands) and ** mean that nothing is read from stdin */ readStdin = 0; nCmd++; azCmd = realloc(azCmd, sizeof(azCmd[0])*nCmd); if( azCmd==0 ) shell_out_of_memory(); azCmd[nCmd-1] = z; } } if( z[1]=='-' ) z++; if( strcmp(z,"-separator")==0 || strcmp(z,"-nullvalue")==0 || strcmp(z,"-newline")==0 |
︙ | ︙ | |||
15851 15852 15853 15854 15855 15856 15857 | }else if( strcmp(z,"-multiplex")==0 ){ extern int sqlite3_multiple_initialize(const char*,int); sqlite3_multiplex_initialize(0, 1); #endif }else if( strcmp(z,"-mmap")==0 ){ sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i)); sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, sz, sz); | > | | > | < | | < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 15965 15966 15967 15968 15969 15970 15971 15972 15973 15974 15975 15976 15977 15978 15979 15980 15981 15982 15983 15984 15985 15986 15987 15988 15989 15990 15991 15992 15993 15994 15995 15996 15997 15998 15999 16000 16001 16002 16003 16004 16005 16006 16007 16008 16009 16010 16011 16012 16013 16014 16015 16016 16017 16018 16019 16020 16021 16022 16023 16024 16025 16026 16027 16028 16029 | }else if( strcmp(z,"-multiplex")==0 ){ extern int sqlite3_multiple_initialize(const char*,int); sqlite3_multiplex_initialize(0, 1); #endif }else if( strcmp(z,"-mmap")==0 ){ sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i)); sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, sz, sz); #ifdef SQLITE_ENABLE_SORTER_REFERENCES }else if( strcmp(z,"-sorterref")==0 ){ sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i)); sqlite3_config(SQLITE_CONFIG_SORTERREF_SIZE, (int)sz); #endif }else if( strcmp(z,"-vfs")==0 ){ zVfs = cmdline_option_value(argc, argv, ++i); #ifdef SQLITE_HAVE_ZLIB }else if( strcmp(z,"-zip")==0 ){ data.openMode = SHELL_OPEN_ZIPFILE; #endif }else if( strcmp(z,"-append")==0 ){ data.openMode = SHELL_OPEN_APPENDVFS; }else if( strcmp(z,"-readonly")==0 ){ data.openMode = SHELL_OPEN_READONLY; #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) }else if( strncmp(z, "-A",2)==0 ){ /* All remaining command-line arguments are passed to the ".archive" ** command, so ignore them */ break; #endif } } verify_uninitialized(); #ifdef SQLITE_SHELL_INIT_PROC { /* If the SQLITE_SHELL_INIT_PROC macro is defined, then it is the name ** of a C-function that will perform initialization actions on SQLite that ** occur just before or after sqlite3_initialize(). Use this compile-time ** option to embed this shell program in larger applications. */ extern void SQLITE_SHELL_INIT_PROC(void); SQLITE_SHELL_INIT_PROC(); } #else /* All the sqlite3_config() calls have now been made. So it is safe ** to call sqlite3_initialize() and process any command line -vfs option. */ sqlite3_initialize(); #endif if( zVfs ){ sqlite3_vfs *pVfs = sqlite3_vfs_find(zVfs); if( pVfs ){ sqlite3_vfs_register(pVfs, 1); }else{ utf8_printf(stderr, "no such VFS: \"%s\"\n", argv[i]); exit(1); } } if( data.zDbFilename==0 ){ #ifndef SQLITE_OMIT_MEMORYDB data.zDbFilename = ":memory:"; warnInmemoryDb = argc==1; #else utf8_printf(stderr,"%s: Error: no database filename specified\n", Argv0); return 1; |
︙ | ︙ | |||
15987 15988 15989 15990 15991 15992 15993 15994 15995 15996 15997 15998 15999 16000 | i++; }else if( strcmp(z,"-pagecache")==0 ){ i+=2; }else if( strcmp(z,"-lookaside")==0 ){ i+=2; }else if( strcmp(z,"-mmap")==0 ){ i++; }else if( strcmp(z,"-vfs")==0 ){ i++; #ifdef SQLITE_ENABLE_VFSTRACE }else if( strcmp(z,"-vfstrace")==0 ){ i++; #endif #ifdef SQLITE_ENABLE_MULTIPLEX | > > > > | 16128 16129 16130 16131 16132 16133 16134 16135 16136 16137 16138 16139 16140 16141 16142 16143 16144 16145 | i++; }else if( strcmp(z,"-pagecache")==0 ){ i+=2; }else if( strcmp(z,"-lookaside")==0 ){ i+=2; }else if( strcmp(z,"-mmap")==0 ){ i++; #ifdef SQLITE_ENABLE_SORTER_REFERENCES }else if( strcmp(z,"-sorterref")==0 ){ i++; #endif }else if( strcmp(z,"-vfs")==0 ){ i++; #ifdef SQLITE_ENABLE_VFSTRACE }else if( strcmp(z,"-vfstrace")==0 ){ i++; #endif #ifdef SQLITE_ENABLE_MULTIPLEX |
︙ | ︙ |
Changes to src/sqlcmd.c.
︙ | ︙ | |||
173 174 175 176 177 178 179 | ** atexit() handler that cleans up global state modified by this module. */ static void sqlcmd_atexit(void) { g.zConfigDbName = 0; /* prevent panic */ } /* | | | | < > > > > > > > > > | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | ** atexit() handler that cleans up global state modified by this module. */ static void sqlcmd_atexit(void) { g.zConfigDbName = 0; /* prevent panic */ } /* ** This routine is called by the sqlite3 command-line shell to ** to load the name the Fossil repository database. */ void sqlcmd_get_dbname(const char **pzRepoName){ *pzRepoName = g.zRepositoryName; } /* ** This routine is called by the sqlite3 command-line shell to do ** extra initialization prior to starting up the shell. */ void sqlcmd_init_proc(void){ sqlite3_initialize(); sqlite3_auto_extension((void(*)(void))sqlcmd_autoinit); } #if USE_SEE /* ** This routine is called by the patched sqlite3 command-line shell in order ** to load the encryption key for the open Fossil database. The memory that ** is pointed to by the value placed in pzKey must be obtained from SQLite. */ |
︙ | ︙ |
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.24.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 |
︙ | ︙ | |||
306 307 308 309 310 311 312 313 314 315 316 317 318 319 | "ENABLE_SELECTTRACE", #endif #if SQLITE_ENABLE_SESSION "ENABLE_SESSION", #endif #if SQLITE_ENABLE_SNAPSHOT "ENABLE_SNAPSHOT", #endif #if SQLITE_ENABLE_SQLLOG "ENABLE_SQLLOG", #endif #if defined(SQLITE_ENABLE_STAT4) "ENABLE_STAT4", #elif defined(SQLITE_ENABLE_STAT3) | > > > | 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | "ENABLE_SELECTTRACE", #endif #if SQLITE_ENABLE_SESSION "ENABLE_SESSION", #endif #if SQLITE_ENABLE_SNAPSHOT "ENABLE_SNAPSHOT", #endif #if SQLITE_ENABLE_SORTER_REFERENCES "ENABLE_SORTER_REFERENCES", #endif #if SQLITE_ENABLE_SQLLOG "ENABLE_SQLLOG", #endif #if defined(SQLITE_ENABLE_STAT4) "ENABLE_STAT4", #elif defined(SQLITE_ENABLE_STAT3) |
︙ | ︙ | |||
1143 1144 1145 1146 1147 1148 1149 | ** 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()]. */ | | | | | 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 | ** 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.24.0" #define SQLITE_VERSION_NUMBER 3024000 #define SQLITE_SOURCE_ID "2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8b4a3" /* ** 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 |
︙ | ︙ | |||
2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 | ** Or if the threshold is -1, statement journals are always held ** exclusively in memory. ** Since many statement journals never become large, setting the spill ** threshold to a value such as 64KiB can greatly reduce the amount of ** I/O required to support statement rollback. ** The default value for this setting is controlled by the ** [SQLITE_STMTJRNL_SPILL] compile-time option. ** </dl> */ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ #define SQLITE_CONFIG_SERIALIZED 3 /* nil */ #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ | > > > > > > > > > > > > > > > > | 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 | ** Or if the threshold is -1, statement journals are always held ** exclusively in memory. ** Since many statement journals never become large, setting the spill ** threshold to a value such as 64KiB can greatly reduce the amount of ** I/O required to support statement rollback. ** The default value for this setting is controlled by the ** [SQLITE_STMTJRNL_SPILL] compile-time option. ** ** [[SQLITE_CONFIG_SORTERREF_SIZE]] ** <dt>SQLITE_CONFIG_SORTERREF_SIZE ** <dd>The SQLITE_CONFIG_SORTERREF_SIZE option accepts a single parameter ** of type (int) - the new value of the sorter-reference size threshold. ** Usually, when SQLite uses an external sort to order records according ** to an ORDER BY clause, all fields required by the caller are present in the ** sorted records. However, if SQLite determines based on the declared type ** of a table column that its values are likely to be very large - larger ** than the configured sorter-reference size threshold - then a reference ** is stored in each sorted record and the required column values loaded ** from the database as records are returned in sorted order. The default ** value for this option is to never use this optimization. Specifying a ** negative value for this option restores the default behaviour. ** This option is only available if SQLite is compiled with the ** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option. ** </dl> */ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ #define SQLITE_CONFIG_SERIALIZED 3 /* nil */ #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ |
︙ | ︙ | |||
2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 | #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */ #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */ #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */ #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */ #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */ #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */ #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */ /* ** CAPI3REF: Database Connection Configuration Options ** ** These constants are the available integer configuration options that ** can be passed as the second argument to the [sqlite3_db_config()] interface. ** | > | 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 | #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */ #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */ #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */ #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */ #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */ #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */ #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */ #define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */ /* ** CAPI3REF: Database Connection Configuration Options ** ** These constants are the available integer configuration options that ** can be passed as the second argument to the [sqlite3_db_config()] interface. ** |
︙ | ︙ | |||
12937 12938 12939 12940 12941 12942 12943 | #define TK_GT 54 #define TK_LE 55 #define TK_LT 56 #define TK_GE 57 #define TK_ESCAPE 58 #define TK_ID 59 #define TK_COLUMNKW 60 | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | | | | | < | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 12957 12958 12959 12960 12961 12962 12963 12964 12965 12966 12967 12968 12969 12970 12971 12972 12973 12974 12975 12976 12977 12978 12979 12980 12981 12982 12983 12984 12985 12986 12987 12988 12989 12990 12991 12992 12993 12994 12995 12996 12997 12998 12999 13000 13001 13002 13003 13004 13005 13006 13007 13008 13009 13010 13011 13012 13013 13014 13015 13016 13017 13018 13019 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029 13030 13031 13032 13033 13034 13035 13036 13037 13038 13039 13040 13041 13042 13043 13044 13045 13046 13047 13048 13049 13050 13051 13052 13053 13054 13055 13056 13057 13058 13059 13060 13061 13062 13063 13064 13065 13066 13067 13068 13069 13070 13071 13072 13073 | #define TK_GT 54 #define TK_LE 55 #define TK_LT 56 #define TK_GE 57 #define TK_ESCAPE 58 #define TK_ID 59 #define TK_COLUMNKW 60 #define TK_DO 61 #define TK_FOR 62 #define TK_IGNORE 63 #define TK_INITIALLY 64 #define TK_INSTEAD 65 #define TK_NO 66 #define TK_KEY 67 #define TK_OF 68 #define TK_OFFSET 69 #define TK_PRAGMA 70 #define TK_RAISE 71 #define TK_RECURSIVE 72 #define TK_REPLACE 73 #define TK_RESTRICT 74 #define TK_ROW 75 #define TK_TRIGGER 76 #define TK_VACUUM 77 #define TK_VIEW 78 #define TK_VIRTUAL 79 #define TK_WITH 80 #define TK_REINDEX 81 #define TK_RENAME 82 #define TK_CTIME_KW 83 #define TK_ANY 84 #define TK_BITAND 85 #define TK_BITOR 86 #define TK_LSHIFT 87 #define TK_RSHIFT 88 #define TK_PLUS 89 #define TK_MINUS 90 #define TK_STAR 91 #define TK_SLASH 92 #define TK_REM 93 #define TK_CONCAT 94 #define TK_COLLATE 95 #define TK_BITNOT 96 #define TK_ON 97 #define TK_INDEXED 98 #define TK_STRING 99 #define TK_JOIN_KW 100 #define TK_CONSTRAINT 101 #define TK_DEFAULT 102 #define TK_NULL 103 #define TK_PRIMARY 104 #define TK_UNIQUE 105 #define TK_CHECK 106 #define TK_REFERENCES 107 #define TK_AUTOINCR 108 #define TK_INSERT 109 #define TK_DELETE 110 #define TK_UPDATE 111 #define TK_SET 112 #define TK_DEFERRABLE 113 #define TK_FOREIGN 114 #define TK_DROP 115 #define TK_UNION 116 #define TK_ALL 117 #define TK_EXCEPT 118 #define TK_INTERSECT 119 #define TK_SELECT 120 #define TK_VALUES 121 #define TK_DISTINCT 122 #define TK_DOT 123 #define TK_FROM 124 #define TK_JOIN 125 #define TK_USING 126 #define TK_ORDER 127 #define TK_GROUP 128 #define TK_HAVING 129 #define TK_LIMIT 130 #define TK_WHERE 131 #define TK_INTO 132 #define TK_NOTHING 133 #define TK_FLOAT 134 #define TK_BLOB 135 #define TK_INTEGER 136 #define TK_VARIABLE 137 #define TK_CASE 138 #define TK_WHEN 139 #define TK_THEN 140 #define TK_ELSE 141 #define TK_INDEX 142 #define TK_ALTER 143 #define TK_ADD 144 #define TK_TRUEFALSE 145 #define TK_ISNOT 146 #define TK_FUNCTION 147 #define TK_COLUMN 148 #define TK_AGG_FUNCTION 149 #define TK_AGG_COLUMN 150 #define TK_UMINUS 151 #define TK_UPLUS 152 #define TK_TRUTH 153 #define TK_REGISTER 154 #define TK_VECTOR 155 #define TK_SELECT_COLUMN 156 #define TK_IF_NULL_ROW 157 #define TK_ASTERISK 158 #define TK_SPAN 159 #define TK_END_OF_FILE 160 #define TK_UNCLOSED_STRING 161 #define TK_SPACE 162 #define TK_ILLEGAL 163 /* The token codes above must all fit in 8 bits */ #define TKFLG_MASK 0xff /* Flags that can be added to a token code when it is not ** being stored in a u8: */ #define TKFLG_DONTFOLD 0x100 /* Omit constant folding optimizations */ |
︙ | ︙ | |||
13157 13158 13159 13160 13161 13162 13163 13164 13165 13166 13167 13168 13169 13170 | ** The default value of "20" was choosen to minimize the run-time of the ** speedtest1 test program with options: --shrink-memory --reprepare */ #ifndef SQLITE_DEFAULT_PCACHE_INITSZ # define SQLITE_DEFAULT_PCACHE_INITSZ 20 #endif /* ** The compile-time options SQLITE_MMAP_READWRITE and ** SQLITE_ENABLE_BATCH_ATOMIC_WRITE are not compatible with one another. ** You must choose one or the other (or neither) but not both. */ #if defined(SQLITE_MMAP_READWRITE) && defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE) #error Cannot use both SQLITE_MMAP_READWRITE and SQLITE_ENABLE_BATCH_ATOMIC_WRITE | > > > > > > > | 13179 13180 13181 13182 13183 13184 13185 13186 13187 13188 13189 13190 13191 13192 13193 13194 13195 13196 13197 13198 13199 | ** The default value of "20" was choosen to minimize the run-time of the ** speedtest1 test program with options: --shrink-memory --reprepare */ #ifndef SQLITE_DEFAULT_PCACHE_INITSZ # define SQLITE_DEFAULT_PCACHE_INITSZ 20 #endif /* ** Default value for the SQLITE_CONFIG_SORTERREF_SIZE option. */ #ifndef SQLITE_DEFAULT_SORTERREF_SIZE # define SQLITE_DEFAULT_SORTERREF_SIZE 0x7fffffff #endif /* ** The compile-time options SQLITE_MMAP_READWRITE and ** SQLITE_ENABLE_BATCH_ATOMIC_WRITE are not compatible with one another. ** You must choose one or the other (or neither) but not both. */ #if defined(SQLITE_MMAP_READWRITE) && defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE) #error Cannot use both SQLITE_MMAP_READWRITE and SQLITE_ENABLE_BATCH_ATOMIC_WRITE |
︙ | ︙ | |||
13615 13616 13617 13618 13619 13620 13621 13622 13623 13624 13625 13626 13627 13628 | typedef struct TableLock TableLock; typedef struct Token Token; typedef struct TreeView TreeView; typedef struct Trigger Trigger; typedef struct TriggerPrg TriggerPrg; typedef struct TriggerStep TriggerStep; typedef struct UnpackedRecord UnpackedRecord; typedef struct VTable VTable; typedef struct VtabCtx VtabCtx; typedef struct Walker Walker; typedef struct WhereInfo WhereInfo; typedef struct With With; /* A VList object records a mapping between parameters/variables/wildcards | > | 13644 13645 13646 13647 13648 13649 13650 13651 13652 13653 13654 13655 13656 13657 13658 | typedef struct TableLock TableLock; typedef struct Token Token; typedef struct TreeView TreeView; typedef struct Trigger Trigger; typedef struct TriggerPrg TriggerPrg; typedef struct TriggerStep TriggerStep; typedef struct UnpackedRecord UnpackedRecord; typedef struct Upsert Upsert; typedef struct VTable VTable; typedef struct VtabCtx VtabCtx; typedef struct Walker Walker; typedef struct WhereInfo WhereInfo; typedef struct With With; /* A VList object records a mapping between parameters/variables/wildcards |
︙ | ︙ | |||
14272 14273 14274 14275 14276 14277 14278 | #define OP_IntCopy 77 /* synopsis: r[P2]=r[P1] */ #define OP_ResultRow 78 /* synopsis: output=r[P1@P2] */ #define OP_CollSeq 79 #define OP_AddImm 80 /* synopsis: r[P1]=r[P1]+P2 */ #define OP_RealAffinity 81 #define OP_Cast 82 /* synopsis: affinity(r[P1]) */ #define OP_Permutation 83 | > | | | | | | | | | | < < | | | | > | 14302 14303 14304 14305 14306 14307 14308 14309 14310 14311 14312 14313 14314 14315 14316 14317 14318 14319 14320 14321 14322 14323 14324 14325 14326 14327 14328 14329 14330 14331 | #define OP_IntCopy 77 /* synopsis: r[P2]=r[P1] */ #define OP_ResultRow 78 /* synopsis: output=r[P1@P2] */ #define OP_CollSeq 79 #define OP_AddImm 80 /* synopsis: r[P1]=r[P1]+P2 */ #define OP_RealAffinity 81 #define OP_Cast 82 /* synopsis: affinity(r[P1]) */ #define OP_Permutation 83 #define OP_Compare 84 /* synopsis: r[P1@P3] <-> r[P2@P3] */ #define OP_BitAnd 85 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */ #define OP_BitOr 86 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */ #define OP_ShiftLeft 87 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */ #define OP_ShiftRight 88 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */ #define OP_Add 89 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */ #define OP_Subtract 90 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */ #define OP_Multiply 91 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */ #define OP_Divide 92 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */ #define OP_Remainder 93 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */ #define OP_Concat 94 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */ #define OP_IsTrue 95 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */ #define OP_BitNot 96 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */ #define OP_Offset 97 /* synopsis: r[P3] = sqlite_offset(P1) */ #define OP_Column 98 /* synopsis: r[P3]=PX */ #define OP_String8 99 /* same as TK_STRING, synopsis: r[P2]='P4' */ #define OP_Affinity 100 /* synopsis: affinity(r[P1@P2]) */ #define OP_MakeRecord 101 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ #define OP_Count 102 /* synopsis: r[P2]=count() */ #define OP_ReadCookie 103 #define OP_SetCookie 104 #define OP_ReopenIdx 105 /* synopsis: root=P2 iDb=P3 */ #define OP_OpenRead 106 /* synopsis: root=P2 iDb=P3 */ |
︙ | ︙ | |||
14320 14321 14322 14323 14324 14325 14326 | #define OP_Rowid 125 /* synopsis: r[P2]=rowid */ #define OP_NullRow 126 #define OP_SeekEnd 127 #define OP_SorterInsert 128 /* synopsis: key=r[P2] */ #define OP_IdxInsert 129 /* synopsis: key=r[P2] */ #define OP_IdxDelete 130 /* synopsis: key=r[P2@P3] */ #define OP_DeferredSeek 131 /* synopsis: Move P3 to P1.rowid if needed */ | < | | > | 14350 14351 14352 14353 14354 14355 14356 14357 14358 14359 14360 14361 14362 14363 14364 14365 14366 | #define OP_Rowid 125 /* synopsis: r[P2]=rowid */ #define OP_NullRow 126 #define OP_SeekEnd 127 #define OP_SorterInsert 128 /* synopsis: key=r[P2] */ #define OP_IdxInsert 129 /* synopsis: key=r[P2] */ #define OP_IdxDelete 130 /* synopsis: key=r[P2@P3] */ #define OP_DeferredSeek 131 /* synopsis: Move P3 to P1.rowid if needed */ #define OP_IdxRowid 132 /* synopsis: r[P2]=rowid */ #define OP_Destroy 133 #define OP_Real 134 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ #define OP_Clear 135 #define OP_ResetSorter 136 #define OP_CreateBtree 137 /* synopsis: r[P2]=root iDb=P1 flags=P3 */ #define OP_SqlExec 138 #define OP_ParseSchema 139 #define OP_LoadAnalysis 140 #define OP_DropTable 141 |
︙ | ︙ | |||
14381 14382 14383 14384 14385 14386 14387 | /* 24 */ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,\ /* 32 */ 0x09, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\ /* 40 */ 0x01, 0x01, 0x23, 0x26, 0x26, 0x0b, 0x01, 0x01,\ /* 48 */ 0x03, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ /* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x01, 0x01, 0x01, 0x02,\ /* 64 */ 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00,\ /* 72 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ | | | | | 14411 14412 14413 14414 14415 14416 14417 14418 14419 14420 14421 14422 14423 14424 14425 14426 14427 | /* 24 */ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,\ /* 32 */ 0x09, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\ /* 40 */ 0x01, 0x01, 0x23, 0x26, 0x26, 0x0b, 0x01, 0x01,\ /* 48 */ 0x03, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ /* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x01, 0x01, 0x01, 0x02,\ /* 64 */ 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00,\ /* 72 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ /* 80 */ 0x02, 0x02, 0x02, 0x00, 0x00, 0x26, 0x26, 0x26,\ /* 88 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x12,\ /* 96 */ 0x12, 0x20, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10,\ /* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ /* 112 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ /* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,\ /* 128 */ 0x04, 0x04, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00,\ /* 136 */ 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ /* 144 */ 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a, 0x00, 0x00,\ /* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
︙ | ︙ | |||
14457 14458 14459 14460 14461 14462 14463 14464 14465 14466 14467 14468 14469 14470 | SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeReusable(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3*,Vdbe*); SQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,Parse*); SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe*, int); SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe*); #ifdef SQLITE_DEBUG SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *, int); #endif SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe*); SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe*); | > > > | 14487 14488 14489 14490 14491 14492 14493 14494 14495 14496 14497 14498 14499 14500 14501 14502 14503 | SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeReusable(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3*,Vdbe*); SQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,Parse*); SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe*, int); #ifdef SQLITE_COVERAGE_TEST SQLITE_PRIVATE int sqlite3VdbeLabelHasBeenResolved(Vdbe*,int); #endif SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe*); #ifdef SQLITE_DEBUG SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *, int); #endif SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe*); SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe*); |
︙ | ︙ | |||
15591 15592 15593 15594 15595 15596 15597 | u8 bBenignMalloc; /* Do not require OOMs if true */ u8 dfltLockMode; /* Default locking-mode for attached dbs */ signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */ u8 suppressErr; /* Do not issue error messages if true */ u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */ u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */ u8 mTrace; /* zero or more SQLITE_TRACE flags */ | | | 15624 15625 15626 15627 15628 15629 15630 15631 15632 15633 15634 15635 15636 15637 15638 | u8 bBenignMalloc; /* Do not require OOMs if true */ u8 dfltLockMode; /* Default locking-mode for attached dbs */ signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */ u8 suppressErr; /* Do not issue error messages if true */ u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */ u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */ u8 mTrace; /* zero or more SQLITE_TRACE flags */ u8 noSharedCache; /* True if no shared-cache backends */ u8 nSqlExec; /* Number of pending OP_SqlExec opcodes */ int nextPagesize; /* Pagesize after VACUUM if >0 */ u32 magic; /* Magic number for detect library misuse */ int nChange; /* Value returned by sqlite3_changes() */ int nTotalChange; /* Value returned by sqlite3_total_changes() */ int aLimit[SQLITE_N_LIMIT]; /* Limits */ int nMaxSorterMmap; /* Maximum size of regions mapped by sorter */ |
︙ | ︙ | |||
15751 15752 15753 15754 15755 15756 15757 15758 15759 15760 15761 15762 15763 15764 | /* ** Allowed values for sqlite3.mDbFlags */ #define DBFLAG_SchemaChange 0x0001 /* Uncommitted Hash table changes */ #define DBFLAG_PreferBuiltin 0x0002 /* Preference to built-in funcs */ #define DBFLAG_Vacuum 0x0004 /* Currently in a VACUUM */ /* ** Bits of the sqlite3.dbOptFlags field that are used by the ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to ** selectively disable various optimizations. */ #define SQLITE_QueryFlattener 0x0001 /* Query flattening */ | > | 15784 15785 15786 15787 15788 15789 15790 15791 15792 15793 15794 15795 15796 15797 15798 | /* ** Allowed values for sqlite3.mDbFlags */ #define DBFLAG_SchemaChange 0x0001 /* Uncommitted Hash table changes */ #define DBFLAG_PreferBuiltin 0x0002 /* Preference to built-in funcs */ #define DBFLAG_Vacuum 0x0004 /* Currently in a VACUUM */ #define DBFLAG_SchemaKnownOk 0x0008 /* Schema is known to be valid */ /* ** Bits of the sqlite3.dbOptFlags field that are used by the ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to ** selectively disable various optimizations. */ #define SQLITE_QueryFlattener 0x0001 /* Query flattening */ |
︙ | ︙ | |||
15996 15997 15998 15999 16000 16001 16002 16003 16004 16005 16006 16007 16008 16009 | /* Allowed values for Column.colFlags: */ #define COLFLAG_PRIMKEY 0x0001 /* Column is part of the primary key */ #define COLFLAG_HIDDEN 0x0002 /* A hidden column in a virtual table */ #define COLFLAG_HASTYPE 0x0004 /* Type name follows column name */ #define COLFLAG_UNIQUE 0x0008 /* Column def contains "UNIQUE" or "PK" */ /* ** A "Collating Sequence" is defined by an instance of the following ** structure. Conceptually, a collating sequence consists of a name and ** a comparison routine that defines the order of that sequence. ** ** If CollSeq.xCmp is NULL, it means that the | > | 16030 16031 16032 16033 16034 16035 16036 16037 16038 16039 16040 16041 16042 16043 16044 | /* Allowed values for Column.colFlags: */ #define COLFLAG_PRIMKEY 0x0001 /* Column is part of the primary key */ #define COLFLAG_HIDDEN 0x0002 /* A hidden column in a virtual table */ #define COLFLAG_HASTYPE 0x0004 /* Type name follows column name */ #define COLFLAG_UNIQUE 0x0008 /* Column def contains "UNIQUE" or "PK" */ #define COLFLAG_SORTERREF 0x0010 /* Use sorter-refs with this column */ /* ** A "Collating Sequence" is defined by an instance of the following ** structure. Conceptually, a collating sequence consists of a name and ** a comparison routine that defines the order of that sequence. ** ** If CollSeq.xCmp is NULL, it means that the |
︙ | ︙ | |||
16283 16284 16285 16286 16287 16288 16289 | */ #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 */ | | | | | | < | | 16318 16319 16320 16321 16322 16323 16324 16325 16326 16327 16328 16329 16330 16331 16332 16333 16334 16335 16336 16337 | */ #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 */ #define OE_Update 6 /* Process as a DO UPDATE in an upsert */ #define OE_Restrict 7 /* OE_Abort for IMMEDIATE, OE_Rollback for DEFERRED */ #define OE_SetNull 8 /* Set the foreign key value to NULL */ #define OE_SetDflt 9 /* Set the foreign key value to its default */ #define OE_Cascade 10 /* Cascade the changes */ #define OE_Default 11 /* Do whatever the default action is */ /* ** An instance of the following structure is passed as the first ** argument to sqlite3VdbeKeyCompare and is used to control the ** comparison of the two index keys. ** |
︙ | ︙ | |||
16736 16737 16738 16739 16740 16741 16742 16743 16744 16745 16746 16747 16748 16749 | Expr *pExpr; /* The parse tree for this expression */ char *zName; /* Token associated with this expression */ char *zSpan; /* Original text of the expression */ u8 sortOrder; /* 1 for DESC or 0 for ASC */ unsigned done :1; /* A flag to indicate when processing is finished */ unsigned bSpanIsTab :1; /* zSpan holds DB.TABLE.COLUMN */ unsigned reusable :1; /* Constant expression is reusable */ union { struct { u16 iOrderByCol; /* For ORDER BY, column number in result set */ u16 iAlias; /* Index into Parse.aAlias[] for zName */ } x; int iConstExprReg; /* Register in which Expr value is cached */ } u; | > | 16770 16771 16772 16773 16774 16775 16776 16777 16778 16779 16780 16781 16782 16783 16784 | Expr *pExpr; /* The parse tree for this expression */ char *zName; /* Token associated with this expression */ char *zSpan; /* Original text of the expression */ u8 sortOrder; /* 1 for DESC or 0 for ASC */ unsigned done :1; /* A flag to indicate when processing is finished */ unsigned bSpanIsTab :1; /* zSpan holds DB.TABLE.COLUMN */ unsigned reusable :1; /* Constant expression is reusable */ unsigned bSorterRef :1; /* Defer evaluation until after sorting */ union { struct { u16 iOrderByCol; /* For ORDER BY, column number in result set */ u16 iAlias; /* Index into Parse.aAlias[] for zName */ } x; int iConstExprReg; /* Register in which Expr value is cached */ } u; |
︙ | ︙ | |||
16919 16920 16921 16922 16923 16924 16925 | ** NameContext in the parent query. Thus the process of scanning the ** NameContext list corresponds to searching through successively outer ** subqueries looking for a match. */ struct NameContext { Parse *pParse; /* The parser */ SrcList *pSrcList; /* One or more tables used to resolve names */ | > | | > > | 16954 16955 16956 16957 16958 16959 16960 16961 16962 16963 16964 16965 16966 16967 16968 16969 16970 16971 16972 | ** NameContext in the parent query. Thus the process of scanning the ** NameContext list corresponds to searching through successively outer ** subqueries looking for a match. */ struct NameContext { Parse *pParse; /* The parser */ SrcList *pSrcList; /* One or more tables used to resolve names */ union { ExprList *pEList; /* Optional list of result-set columns */ AggInfo *pAggInfo; /* Information about aggregates at this level */ Upsert *pUpsert; /* ON CONFLICT clause information from an upsert */ } uNC; NameContext *pNext; /* Next outer name context. NULL for outermost */ int nRef; /* Number of names resolved by this context */ int nErr; /* Number of errors encountered while resolving names */ u16 ncFlags; /* Zero or more NC_* flags defined below */ }; /* |
︙ | ︙ | |||
16942 16943 16944 16945 16946 16947 16948 16949 16950 16951 16952 16953 16954 16955 16956 16957 | #define NC_AllowAgg 0x0001 /* Aggregate functions are allowed here */ #define NC_PartIdx 0x0002 /* True if resolving a partial index WHERE */ #define NC_IsCheck 0x0004 /* True if resolving names in a CHECK constraint */ #define NC_InAggFunc 0x0008 /* True if analyzing arguments to an agg func */ #define NC_HasAgg 0x0010 /* One or more aggregate functions seen */ #define NC_IdxExpr 0x0020 /* True if resolving columns of CREATE INDEX */ #define NC_VarSelect 0x0040 /* A correlated subquery has been seen */ #define NC_MinMaxAgg 0x1000 /* min/max aggregates seen. See note above */ #define NC_Complex 0x2000 /* True if a function or subquery seen */ /* ** An instance of the following structure contains all information ** needed to generate code for a single SELECT statement. ** ** nLimit is set to -1 if there is no LIMIT clause. nOffset is set to 0. ** If there is a LIMIT clause, the parser sets nLimit to the value of the | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 16980 16981 16982 16983 16984 16985 16986 16987 16988 16989 16990 16991 16992 16993 16994 16995 16996 16997 16998 16999 17000 17001 17002 17003 17004 17005 17006 17007 17008 17009 17010 17011 17012 17013 17014 17015 17016 17017 17018 17019 17020 17021 17022 17023 17024 17025 17026 17027 17028 | #define NC_AllowAgg 0x0001 /* Aggregate functions are allowed here */ #define NC_PartIdx 0x0002 /* True if resolving a partial index WHERE */ #define NC_IsCheck 0x0004 /* True if resolving names in a CHECK constraint */ #define NC_InAggFunc 0x0008 /* True if analyzing arguments to an agg func */ #define NC_HasAgg 0x0010 /* One or more aggregate functions seen */ #define NC_IdxExpr 0x0020 /* True if resolving columns of CREATE INDEX */ #define NC_VarSelect 0x0040 /* A correlated subquery has been seen */ #define NC_UEList 0x0080 /* True if uNC.pEList is used */ #define NC_UAggInfo 0x0100 /* True if uNC.pAggInfo is used */ #define NC_UUpsert 0x0200 /* True if uNC.pUpsert is used */ #define NC_MinMaxAgg 0x1000 /* min/max aggregates seen. See note above */ #define NC_Complex 0x2000 /* True if a function or subquery seen */ /* ** An instance of the following object describes a single ON CONFLICT ** clause in an upsert. ** ** The pUpsertTarget field is only set if the ON CONFLICT clause includes ** conflict-target clause. (In "ON CONFLICT(a,b)" the "(a,b)" is the ** conflict-target clause.) The pUpsertTargetWhere is the optional ** WHERE clause used to identify partial unique indexes. ** ** 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 conflicting index */ 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 */ /* The fields above comprise the parse tree for the upsert clause. ** The fields below are used to transfer information from the INSERT ** processing down into the UPDATE processing while generating code. ** Upsert owns the memory allocated above, but not the memory below. */ Index *pUpsertIdx; /* Constraint that pUpsertTarget identifies */ 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 */ }; /* ** An instance of the following structure contains all information ** needed to generate code for a single SELECT statement. ** ** nLimit is set to -1 if there is no LIMIT clause. nOffset is set to 0. ** If there is a LIMIT clause, the parser sets nLimit to the value of the |
︙ | ︙ | |||
16973 16974 16975 16976 16977 16978 16979 16980 16981 16982 16983 16984 16985 16986 | ExprList *pEList; /* The fields of the result */ u8 op; /* One of: TK_UNION TK_ALL TK_INTERSECT TK_EXCEPT */ LogEst nSelectRow; /* Estimated number of result rows */ u32 selFlags; /* Various SF_* values */ int iLimit, iOffset; /* Memory registers holding LIMIT & OFFSET counters */ #if SELECTTRACE_ENABLED char zSelName[12]; /* Symbolic name of this SELECT use for debugging */ #endif int addrOpenEphm[2]; /* OP_OpenEphem opcodes related to this select */ SrcList *pSrc; /* The FROM clause */ Expr *pWhere; /* The WHERE clause */ ExprList *pGroupBy; /* The GROUP BY clause */ Expr *pHaving; /* The HAVING clause */ ExprList *pOrderBy; /* The ORDER BY clause */ | > | 17044 17045 17046 17047 17048 17049 17050 17051 17052 17053 17054 17055 17056 17057 17058 | ExprList *pEList; /* The fields of the result */ u8 op; /* One of: TK_UNION TK_ALL TK_INTERSECT TK_EXCEPT */ LogEst nSelectRow; /* Estimated number of result rows */ u32 selFlags; /* Various SF_* values */ int iLimit, iOffset; /* Memory registers holding LIMIT & OFFSET counters */ #if SELECTTRACE_ENABLED char zSelName[12]; /* Symbolic name of this SELECT use for debugging */ u32 iSelectId; /* EXPLAIN QUERY PLAN select ID */ #endif int addrOpenEphm[2]; /* OP_OpenEphem opcodes related to this select */ SrcList *pSrc; /* The FROM clause */ Expr *pWhere; /* The WHERE clause */ ExprList *pGroupBy; /* The GROUP BY clause */ Expr *pHaving; /* The HAVING clause */ ExprList *pOrderBy; /* The ORDER BY clause */ |
︙ | ︙ | |||
17444 17445 17446 17447 17448 17449 17450 | struct TriggerStep { u8 op; /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT */ u8 orconf; /* OE_Rollback etc. */ Trigger *pTrig; /* The trigger that this step is a part of */ Select *pSelect; /* SELECT statement or RHS of INSERT INTO SELECT ... */ char *zTarget; /* Target table for DELETE, UPDATE, INSERT */ Expr *pWhere; /* The WHERE clause for DELETE or UPDATE steps */ | | > | 17516 17517 17518 17519 17520 17521 17522 17523 17524 17525 17526 17527 17528 17529 17530 17531 17532 | struct TriggerStep { u8 op; /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT */ u8 orconf; /* OE_Rollback etc. */ Trigger *pTrig; /* The trigger that this step is a part of */ Select *pSelect; /* SELECT statement or RHS of INSERT INTO SELECT ... */ char *zTarget; /* Target table for DELETE, UPDATE, INSERT */ Expr *pWhere; /* The WHERE clause for DELETE or UPDATE steps */ ExprList *pExprList; /* SET clause for UPDATE */ IdList *pIdList; /* Column names for INSERT */ Upsert *pUpsert; /* Upsert clauses on an INSERT */ char *zSpan; /* Original SQL text of this command */ TriggerStep *pNext; /* Next in the link-list */ TriggerStep *pLast; /* Last element in link-list. Valid for 1st elem only */ }; /* ** The following structure contains information used by the sqliteFix... |
︙ | ︙ | |||
17557 17558 17559 17560 17561 17562 17563 17564 17565 17566 17567 17568 17569 17570 | void *pVdbeBranchArg; /* 1st argument */ #endif #ifndef SQLITE_UNTESTABLE int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */ #endif int bLocaltimeFault; /* True to fail localtime() calls */ int iOnceResetThreshold; /* When to reset OP_Once counters */ }; /* ** This macro is used inside of assert() statements to indicate that ** the assert is only valid on a well-formed database. Instead of: ** ** assert( X ); | > | 17630 17631 17632 17633 17634 17635 17636 17637 17638 17639 17640 17641 17642 17643 17644 | void *pVdbeBranchArg; /* 1st argument */ #endif #ifndef SQLITE_UNTESTABLE int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */ #endif int bLocaltimeFault; /* True to fail localtime() calls */ int iOnceResetThreshold; /* When to reset OP_Once counters */ u32 szSorterRef; /* Min size in bytes to use sorter-refs */ }; /* ** This macro is used inside of assert() statements to indicate that ** the assert is only valid on a well-formed database. Instead of: ** ** assert( X ); |
︙ | ︙ | |||
17977 17978 17979 17980 17981 17982 17983 | #ifndef SQLITE_OMIT_AUTOINCREMENT SQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse); SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse); #else # define sqlite3AutoincrementBegin(X) # define sqlite3AutoincrementEnd(X) #endif | | | 18051 18052 18053 18054 18055 18056 18057 18058 18059 18060 18061 18062 18063 18064 18065 | #ifndef SQLITE_OMIT_AUTOINCREMENT SQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse); SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse); #else # define sqlite3AutoincrementBegin(X) # define sqlite3AutoincrementEnd(X) #endif SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int, Upsert*); SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*); SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*); SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*); SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int); SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(sqlite3*, SrcList*, Token*, Token*); SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*, Token*, Select*, Expr*, IdList*); |
︙ | ︙ | |||
18007 18008 18009 18010 18011 18012 18013 | SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*); SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, int); SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int); #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*); #endif SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*, ExprList*, Expr*); | | > | 18081 18082 18083 18084 18085 18086 18087 18088 18089 18090 18091 18092 18093 18094 18095 18096 | SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*); SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, int); SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int); #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*); #endif SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*, ExprList*, Expr*); SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*,Expr*,int,ExprList*,Expr*, Upsert*); SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int); SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*); SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereOrderedInnerLoop(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereIsSorted(WhereInfo*); |
︙ | ︙ | |||
18100 18101 18102 18103 18104 18105 18106 | SQLITE_PRIVATE int sqlite3IsRowid(const char*); SQLITE_PRIVATE void sqlite3GenerateRowDelete( Parse*,Table*,Trigger*,int,int,int,i16,u8,u8,u8,int); SQLITE_PRIVATE void sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int, int*, int); SQLITE_PRIVATE int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int, int*,Index*,int); SQLITE_PRIVATE void sqlite3ResolvePartIdxLabel(Parse*,int); SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(Parse*,Table*,int*,int,int,int,int, | | | 18175 18176 18177 18178 18179 18180 18181 18182 18183 18184 18185 18186 18187 18188 18189 | SQLITE_PRIVATE int sqlite3IsRowid(const char*); SQLITE_PRIVATE void sqlite3GenerateRowDelete( Parse*,Table*,Trigger*,int,int,int,i16,u8,u8,u8,int); SQLITE_PRIVATE void sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int, int*, int); SQLITE_PRIVATE int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int, int*,Index*,int); SQLITE_PRIVATE void sqlite3ResolvePartIdxLabel(Parse*,int); SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(Parse*,Table*,int*,int,int,int,int, u8,u8,int,int*,int*,Upsert*); #ifdef SQLITE_ENABLE_NULL_TRIM SQLITE_PRIVATE void sqlite3SetMakeRecordP5(Vdbe*,Table*); #else # define sqlite3SetMakeRecordP5(A,B) #endif SQLITE_PRIVATE void sqlite3CompleteInsertion(Parse*,Table*,int,int,int,int*,int,int,int); SQLITE_PRIVATE int sqlite3OpenTableAndIndices(Parse*, Table*, int, u8, int, u8*, int*, int*); |
︙ | ︙ | |||
18153 18154 18155 18156 18157 18158 18159 | int, int, int); SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect(Parse *, Trigger *, Table *, int, int, int); void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*); SQLITE_PRIVATE void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*); SQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*, const char*,const char*); SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(sqlite3*,Token*, IdList*, | > | | 18228 18229 18230 18231 18232 18233 18234 18235 18236 18237 18238 18239 18240 18241 18242 18243 | int, int, int); SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect(Parse *, Trigger *, Table *, int, int, int); void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*); SQLITE_PRIVATE void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*); SQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*, const char*,const char*); SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(sqlite3*,Token*, IdList*, Select*,u8,Upsert*, const char*,const char*); SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(sqlite3*,Token*,ExprList*, Expr*, u8, const char*,const char*); SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(sqlite3*,Token*, Expr*, const char*,const char*); SQLITE_PRIVATE void sqlite3DeleteTrigger(sqlite3*, Trigger*); SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*); SQLITE_PRIVATE u32 sqlite3TriggerColmask(Parse*,Trigger*,ExprList*,int,int,Table*,int); |
︙ | ︙ | |||
18339 18340 18341 18342 18343 18344 18345 | SQLITE_PRIVATE void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*); SQLITE_PRIVATE void sqlite3ResolveSelfReference(Parse*,Table*,int,Expr*,ExprList*); SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*); SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int); SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *); SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *); SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*); | | | 18415 18416 18417 18418 18419 18420 18421 18422 18423 18424 18425 18426 18427 18428 18429 | SQLITE_PRIVATE void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*); SQLITE_PRIVATE void sqlite3ResolveSelfReference(Parse*,Table*,int,Expr*,ExprList*); SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*); SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int); SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *); SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *); SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*); SQLITE_PRIVATE char sqlite3AffinityType(const char*, Column*); SQLITE_PRIVATE void sqlite3Analyze(Parse*, Token*, Token*); SQLITE_PRIVATE int sqlite3InvokeBusyHandler(BusyHandler*, sqlite3_file*); SQLITE_PRIVATE int sqlite3FindDb(sqlite3*, Token*); SQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *, const char *); SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3*,int iDB); SQLITE_PRIVATE void sqlite3DeleteIndexSamples(sqlite3*,Index*); SQLITE_PRIVATE void sqlite3DefaultRowEst(Index*); |
︙ | ︙ | |||
18401 18402 18403 18404 18405 18406 18407 | SQLITE_PRIVATE char sqlite3IndexColumnAffinity(sqlite3*, Index*, int); #endif /* ** The interface to the LEMON-generated parser */ #ifndef SQLITE_AMALGAMATION | | | | 18477 18478 18479 18480 18481 18482 18483 18484 18485 18486 18487 18488 18489 18490 18491 18492 18493 18494 | SQLITE_PRIVATE char sqlite3IndexColumnAffinity(sqlite3*, Index*, int); #endif /* ** The interface to the LEMON-generated parser */ #ifndef SQLITE_AMALGAMATION SQLITE_PRIVATE void *sqlite3ParserAlloc(void*(*)(u64), Parse*); SQLITE_PRIVATE void sqlite3ParserFree(void*, void(*)(void*)); #endif SQLITE_PRIVATE void sqlite3Parser(void*, int, Token); #ifdef YYTRACKMAXSTACKDEPTH SQLITE_PRIVATE int sqlite3ParserStackPeak(void*); #endif SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3*); #ifndef SQLITE_OMIT_LOAD_EXTENSION SQLITE_PRIVATE void sqlite3CloseExtensions(sqlite3*); |
︙ | ︙ | |||
18492 18493 18494 18495 18496 18497 18498 18499 18500 18501 18502 18503 18504 18505 | SQLITE_PRIVATE With *sqlite3WithAdd(Parse*,With*,Token*,ExprList*,Select*); SQLITE_PRIVATE void sqlite3WithDelete(sqlite3*,With*); SQLITE_PRIVATE void sqlite3WithPush(Parse*, With*, u8); #else #define sqlite3WithPush(x,y,z) #define sqlite3WithDelete(x,y) #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 ** this case foreign keys are parsed, but no other functionality is ** provided (enforcement of FK constraints requires the triggers sub-system). | > > > > > > > > > > > > | 18568 18569 18570 18571 18572 18573 18574 18575 18576 18577 18578 18579 18580 18581 18582 18583 18584 18585 18586 18587 18588 18589 18590 18591 18592 18593 | SQLITE_PRIVATE With *sqlite3WithAdd(Parse*,With*,Token*,ExprList*,Select*); 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*); 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); #else #define sqlite3UpsertNew(v,w,x,y,z) ((Upsert*)0) #define sqlite3UpsertDelete(x,y) #define sqlite3UpsertDup(x,y) ((Upsert*)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 ** this case foreign keys are parsed, but no other functionality is ** provided (enforcement of FK constraints requires the triggers sub-system). |
︙ | ︙ | |||
18924 18925 18926 18927 18928 18929 18930 | 0, /* xVdbeBranch */ 0, /* pVbeBranchArg */ #endif #ifndef SQLITE_UNTESTABLE 0, /* xTestCallback */ #endif 0, /* bLocaltimeFault */ | | > | 19012 19013 19014 19015 19016 19017 19018 19019 19020 19021 19022 19023 19024 19025 19026 19027 | 0, /* xVdbeBranch */ 0, /* pVbeBranchArg */ #endif #ifndef SQLITE_UNTESTABLE 0, /* xTestCallback */ #endif 0, /* bLocaltimeFault */ 0x7ffffffe, /* iOnceResetThreshold */ SQLITE_DEFAULT_SORTERREF_SIZE /* szSorterRef */ }; /* ** Hash table for global functions - functions common to all ** database connections. After initialization, this table is ** read-only. */ |
︙ | ︙ | |||
27497 27498 27499 27500 27501 27502 27503 | sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); if( p ){ for(i=0; i<p->iLevel && i<sizeof(p->bLine)-1; i++){ sqlite3StrAccumAppend(&acc, p->bLine[i] ? "| " : " ", 4); } sqlite3StrAccumAppend(&acc, p->bLine[i] ? "|-- " : "'-- ", 4); } | > | | | | | > | 27586 27587 27588 27589 27590 27591 27592 27593 27594 27595 27596 27597 27598 27599 27600 27601 27602 27603 27604 27605 27606 | sqlite3StrAccumInit(&acc, 0, zBuf, sizeof(zBuf), 0); if( p ){ for(i=0; i<p->iLevel && i<sizeof(p->bLine)-1; i++){ sqlite3StrAccumAppend(&acc, p->bLine[i] ? "| " : " ", 4); } sqlite3StrAccumAppend(&acc, p->bLine[i] ? "|-- " : "'-- ", 4); } if( zFormat!=0 ){ va_start(ap, zFormat); sqlite3VXPrintf(&acc, zFormat, ap); va_end(ap); assert( acc.nChar>0 ); sqlite3StrAccumAppend(&acc, "\n", 1); } sqlite3StrAccumFinish(&acc); fprintf(stdout,"%s", zBuf); fflush(stdout); } /* ** Shorthand for starting a new tree item that consists of a single label |
︙ | ︙ | |||
27574 27575 27576 27577 27578 27579 27580 | sqlite3TreeViewWith(pView, p->pWith, 1); cnt = 1; sqlite3TreeViewPush(pView, 1); } do{ #if SELECTTRACE_ENABLED sqlite3TreeViewLine(pView, | | | | 27665 27666 27667 27668 27669 27670 27671 27672 27673 27674 27675 27676 27677 27678 27679 27680 27681 27682 | sqlite3TreeViewWith(pView, p->pWith, 1); cnt = 1; sqlite3TreeViewPush(pView, 1); } do{ #if SELECTTRACE_ENABLED sqlite3TreeViewLine(pView, "SELECT%s%s (%s/%d/%p) selFlags=0x%x nSelectRow=%d", ((p->selFlags & SF_Distinct) ? " DISTINCT" : ""), ((p->selFlags & SF_Aggregate) ? " agg_flag" : ""), p->zSelName, p->iSelectId, p, p->selFlags, (int)p->nSelectRow ); #else sqlite3TreeViewLine(pView, "SELECT%s%s (0x%p) selFlags=0x%x nSelectRow=%d", ((p->selFlags & SF_Distinct) ? " DISTINCT" : ""), ((p->selFlags & SF_Aggregate) ? " agg_flag" : ""), p, p->selFlags, (int)p->nSelectRow |
︙ | ︙ | |||
27971 27972 27973 27974 27975 27976 27977 27978 | sqlite3TreeViewLine(pView, "%s (empty)", zLabel); }else{ int i; sqlite3TreeViewLine(pView, "%s", zLabel); for(i=0; i<pList->nExpr; i++){ int j = pList->a[i].u.x.iOrderByCol; char *zName = pList->a[i].zName; if( j || zName ){ | > | < > > | | | | | | > > > | | 28062 28063 28064 28065 28066 28067 28068 28069 28070 28071 28072 28073 28074 28075 28076 28077 28078 28079 28080 28081 28082 28083 28084 28085 28086 28087 28088 28089 28090 | sqlite3TreeViewLine(pView, "%s (empty)", zLabel); }else{ int i; sqlite3TreeViewLine(pView, "%s", zLabel); for(i=0; i<pList->nExpr; i++){ int j = pList->a[i].u.x.iOrderByCol; char *zName = pList->a[i].zName; int moreToFollow = i<pList->nExpr - 1; if( j || zName ){ sqlite3TreeViewPush(pView, moreToFollow); moreToFollow = 0; sqlite3TreeViewLine(pView, 0); if( zName ){ fprintf(stdout, "AS %s ", zName); } if( j ){ fprintf(stdout, "iOrderByCol=%d", j); } fprintf(stdout, "\n"); fflush(stdout); } sqlite3TreeViewExpr(pView, pList->a[i].pExpr, moreToFollow); if( j || zName ){ sqlite3TreeViewPop(pView); } } } } SQLITE_PRIVATE void sqlite3TreeViewExprList( |
︙ | ︙ | |||
30946 30947 30948 30949 30950 30951 30952 | /* 77 */ "IntCopy" OpHelp("r[P2]=r[P1]"), /* 78 */ "ResultRow" OpHelp("output=r[P1@P2]"), /* 79 */ "CollSeq" OpHelp(""), /* 80 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), /* 81 */ "RealAffinity" OpHelp(""), /* 82 */ "Cast" OpHelp("affinity(r[P1])"), /* 83 */ "Permutation" OpHelp(""), | > | | | | | | | | | | < < | | | | > | 31042 31043 31044 31045 31046 31047 31048 31049 31050 31051 31052 31053 31054 31055 31056 31057 31058 31059 31060 31061 31062 31063 31064 31065 31066 31067 31068 31069 31070 31071 | /* 77 */ "IntCopy" OpHelp("r[P2]=r[P1]"), /* 78 */ "ResultRow" OpHelp("output=r[P1@P2]"), /* 79 */ "CollSeq" OpHelp(""), /* 80 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), /* 81 */ "RealAffinity" OpHelp(""), /* 82 */ "Cast" OpHelp("affinity(r[P1])"), /* 83 */ "Permutation" OpHelp(""), /* 84 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), /* 85 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"), /* 86 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"), /* 87 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"), /* 88 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"), /* 89 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"), /* 90 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"), /* 91 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"), /* 92 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"), /* 93 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"), /* 94 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"), /* 95 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"), /* 96 */ "BitNot" OpHelp("r[P1]= ~r[P1]"), /* 97 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"), /* 98 */ "Column" OpHelp("r[P3]=PX"), /* 99 */ "String8" OpHelp("r[P2]='P4'"), /* 100 */ "Affinity" OpHelp("affinity(r[P1@P2])"), /* 101 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), /* 102 */ "Count" OpHelp("r[P2]=count()"), /* 103 */ "ReadCookie" OpHelp(""), /* 104 */ "SetCookie" OpHelp(""), /* 105 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), /* 106 */ "OpenRead" OpHelp("root=P2 iDb=P3"), |
︙ | ︙ | |||
30994 30995 30996 30997 30998 30999 31000 | /* 125 */ "Rowid" OpHelp("r[P2]=rowid"), /* 126 */ "NullRow" OpHelp(""), /* 127 */ "SeekEnd" OpHelp(""), /* 128 */ "SorterInsert" OpHelp("key=r[P2]"), /* 129 */ "IdxInsert" OpHelp("key=r[P2]"), /* 130 */ "IdxDelete" OpHelp("key=r[P2@P3]"), /* 131 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"), | < | | > | 31090 31091 31092 31093 31094 31095 31096 31097 31098 31099 31100 31101 31102 31103 31104 31105 31106 | /* 125 */ "Rowid" OpHelp("r[P2]=rowid"), /* 126 */ "NullRow" OpHelp(""), /* 127 */ "SeekEnd" OpHelp(""), /* 128 */ "SorterInsert" OpHelp("key=r[P2]"), /* 129 */ "IdxInsert" OpHelp("key=r[P2]"), /* 130 */ "IdxDelete" OpHelp("key=r[P2@P3]"), /* 131 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"), /* 132 */ "IdxRowid" OpHelp("r[P2]=rowid"), /* 133 */ "Destroy" OpHelp(""), /* 134 */ "Real" OpHelp("r[P2]=P4"), /* 135 */ "Clear" OpHelp(""), /* 136 */ "ResetSorter" OpHelp(""), /* 137 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"), /* 138 */ "SqlExec" OpHelp(""), /* 139 */ "ParseSchema" OpHelp(""), /* 140 */ "LoadAnalysis" OpHelp(""), /* 141 */ "DropTable" OpHelp(""), |
︙ | ︙ | |||
61478 61479 61480 61481 61482 61483 61484 | for(i=0; i<db->nDb; i++){ p = db->aDb[i].pBt; if( p && p->sharable ){ sqlite3BtreeEnter(p); skipOk = 0; } } | | | | | 61574 61575 61576 61577 61578 61579 61580 61581 61582 61583 61584 61585 61586 61587 61588 61589 61590 61591 61592 61593 61594 61595 61596 61597 61598 61599 61600 61601 61602 61603 | for(i=0; i<db->nDb; i++){ p = db->aDb[i].pBt; if( p && p->sharable ){ sqlite3BtreeEnter(p); skipOk = 0; } } db->noSharedCache = skipOk; } SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3 *db){ if( db->noSharedCache==0 ) btreeEnterAll(db); } static void SQLITE_NOINLINE btreeLeaveAll(sqlite3 *db){ int i; Btree *p; assert( sqlite3_mutex_held(db->mutex) ); for(i=0; i<db->nDb; i++){ p = db->aDb[i].pBt; if( p ) sqlite3BtreeLeave(p); } } SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3 *db){ if( db->noSharedCache==0 ) btreeLeaveAll(db); } #ifndef NDEBUG /* ** Return true if the current thread holds the database connection ** mutex and all required BtShared mutexes. ** |
︙ | ︙ | |||
73869 73870 73871 73872 73873 73874 73875 | zVal = &pExpr->u.zToken[2]; nVal = sqlite3Strlen30(zVal)-1; assert( zVal[nVal]=='\'' ); sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2, 0, SQLITE_DYNAMIC); } #endif | < > > > > > | 73965 73966 73967 73968 73969 73970 73971 73972 73973 73974 73975 73976 73977 73978 73979 73980 73981 73982 73983 73984 73985 73986 73987 73988 | zVal = &pExpr->u.zToken[2]; nVal = sqlite3Strlen30(zVal)-1; assert( zVal[nVal]=='\'' ); sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2, 0, SQLITE_DYNAMIC); } #endif #ifdef SQLITE_ENABLE_STAT3_OR_STAT4 else if( op==TK_FUNCTION && pCtx!=0 ){ rc = valueFromFunction(db, pExpr, enc, affinity, &pVal, pCtx); } #endif else if( op==TK_TRUEFALSE ){ pVal = valueNew(db, pCtx); pVal->flags = MEM_Int; pVal->u.i = pExpr->u.zToken[4]==0; } *ppVal = pVal; return rc; no_mem: #ifdef SQLITE_ENABLE_STAT3_OR_STAT4 if( pCtx==0 || pCtx->pParse->nErr==0 ) |
︙ | ︙ | |||
74622 74623 74624 74625 74626 74627 74628 74629 74630 74631 74632 74633 74634 74635 74636 74637 74638 74639 | SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe *v, int x){ Parse *p = v->pParse; int j = ADDR(x); assert( v->magic==VDBE_MAGIC_INIT ); assert( j<p->nLabel ); assert( j>=0 ); if( p->aLabel ){ p->aLabel[j] = v->nOp; } } /* ** Mark the VDBE as one that can only be run one time. */ SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe *p){ p->runOnlyOnce = 1; } | > > > > > > > > > > > > > > > > > > > | 74722 74723 74724 74725 74726 74727 74728 74729 74730 74731 74732 74733 74734 74735 74736 74737 74738 74739 74740 74741 74742 74743 74744 74745 74746 74747 74748 74749 74750 74751 74752 74753 74754 74755 74756 74757 74758 | SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe *v, int x){ Parse *p = v->pParse; int j = ADDR(x); assert( v->magic==VDBE_MAGIC_INIT ); assert( j<p->nLabel ); assert( j>=0 ); if( p->aLabel ){ #ifdef SQLITE_DEBUG if( p->db->flags & SQLITE_VdbeAddopTrace ){ printf("RESOLVE LABEL %d to %d\n", x, v->nOp); } #endif assert( p->aLabel[j]==(-1) ); /* Labels may only be resolved once */ p->aLabel[j] = v->nOp; } } #ifdef SQLITE_COVERAGE_TEST /* ** Return TRUE if and only if the label x has already been resolved. ** Return FALSE (zero) if label x is still unresolved. ** ** This routine is only used inside of testcase() macros, and so it ** only exists when measuring test coverage. */ SQLITE_PRIVATE int sqlite3VdbeLabelHasBeenResolved(Vdbe *v, int x){ return v->pParse->aLabel && v->pParse->aLabel[ADDR(x)]>=0; } #endif /* SQLITE_COVERAGE_TEST */ /* ** Mark the VDBE as one that can only be run one time. */ SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe *p){ p->runOnlyOnce = 1; } |
︙ | ︙ | |||
75856 75857 75858 75859 75860 75861 75862 75863 75864 75865 75866 75867 75868 75869 | ** running the code, it invokes the callback once for each instruction. ** This feature is used to implement "EXPLAIN". ** ** When p->explain==1, each instruction is listed. When ** p->explain==2, only OP_Explain instructions are listed and these ** are shown in a different format. p->explain==2 is used to implement ** EXPLAIN QUERY PLAN. ** ** When p->explain==1, first the main program is listed, then each of ** the trigger subprograms are listed one by one. */ SQLITE_PRIVATE int sqlite3VdbeList( Vdbe *p /* The VDBE */ ){ | > > > | 75975 75976 75977 75978 75979 75980 75981 75982 75983 75984 75985 75986 75987 75988 75989 75990 75991 | ** running the code, it invokes the callback once for each instruction. ** This feature is used to implement "EXPLAIN". ** ** When p->explain==1, each instruction is listed. When ** p->explain==2, only OP_Explain instructions are listed and these ** are shown in a different format. p->explain==2 is used to implement ** EXPLAIN QUERY PLAN. ** 2018-04-24: In p->explain==2 mode, the OP_Init opcodes of triggers ** are also shown, so that the boundaries between the main program and ** each trigger are clear. ** ** When p->explain==1, first the main program is listed, then each of ** the trigger subprograms are listed one by one. */ SQLITE_PRIVATE int sqlite3VdbeList( Vdbe *p /* The VDBE */ ){ |
︙ | ︙ | |||
75918 75919 75920 75921 75922 75923 75924 | apSub = (SubProgram **)pSub->z; } for(i=0; i<nSub; i++){ nRow += apSub[i]->nOp; } } | | | 76040 76041 76042 76043 76044 76045 76046 76047 76048 76049 76050 76051 76052 76053 76054 | apSub = (SubProgram **)pSub->z; } for(i=0; i<nSub; i++){ nRow += apSub[i]->nOp; } } while(1){ /* Loop exits via break */ i = p->pc++; if( i>=nRow ){ p->rc = SQLITE_OK; rc = SQLITE_DONE; break; } if( i<p->nOp ){ |
︙ | ︙ | |||
75964 75965 75966 75967 75968 75969 75970 | apSub = (SubProgram **)pSub->z; apSub[nSub++] = pOp->p4.pProgram; pSub->flags |= MEM_Blob; pSub->n = nSub*sizeof(SubProgram*); nRow += pOp->p4.pProgram->nOp; } } | | > > > | 76086 76087 76088 76089 76090 76091 76092 76093 76094 76095 76096 76097 76098 76099 76100 76101 76102 76103 | apSub = (SubProgram **)pSub->z; apSub[nSub++] = pOp->p4.pProgram; pSub->flags |= MEM_Blob; pSub->n = nSub*sizeof(SubProgram*); nRow += pOp->p4.pProgram->nOp; } } if( p->explain<2 ) break; if( pOp->opcode==OP_Explain ) break; if( pOp->opcode==OP_Init && p->pc>1 ) break; } if( rc==SQLITE_OK ){ if( db->u1.isInterrupted ){ p->rc = SQLITE_INTERRUPT; rc = SQLITE_ERROR; sqlite3VdbeError(p, sqlite3ErrStr(p->rc)); }else{ |
︙ | ︙ | |||
92642 92643 92644 92645 92646 92647 92648 | int cntTab = 0; /* Number of matching table names */ int nSubquery = 0; /* How many levels of subquery */ sqlite3 *db = pParse->db; /* The database connection */ struct SrcList_item *pItem; /* Use for looping over pSrcList items */ struct SrcList_item *pMatch = 0; /* The matching pSrcList item */ NameContext *pTopNC = pNC; /* First namecontext in the list */ Schema *pSchema = 0; /* Schema of the expression */ | | | 92767 92768 92769 92770 92771 92772 92773 92774 92775 92776 92777 92778 92779 92780 92781 | int cntTab = 0; /* Number of matching table names */ int nSubquery = 0; /* How many levels of subquery */ sqlite3 *db = pParse->db; /* The database connection */ struct SrcList_item *pItem; /* Use for looping over pSrcList items */ struct SrcList_item *pMatch = 0; /* The matching pSrcList item */ NameContext *pTopNC = pNC; /* First namecontext in the list */ Schema *pSchema = 0; /* Schema of the expression */ int eNewExprOp = TK_COLUMN; /* New value for pExpr->op on success */ Table *pTab = 0; /* Table hold the row */ Column *pCol; /* A column of pTab */ assert( pNC ); /* the name context cannot be NULL. */ assert( zCol ); /* The Z in X.Y.Z cannot be NULL */ assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) ); |
︙ | ︙ | |||
92747 92748 92749 92750 92751 92752 92753 | if( (pMatch->fg.jointype & JT_LEFT)!=0 ){ ExprSetProperty(pExpr, EP_CanBeNull); } pSchema = pExpr->pTab->pSchema; } } /* if( pSrcList ) */ | | | > | > > > | | | | | | | | > > > > | > > | > | > > > > > > > > > > > | | | | | | | | | | | > | | < > | | | > | | 92872 92873 92874 92875 92876 92877 92878 92879 92880 92881 92882 92883 92884 92885 92886 92887 92888 92889 92890 92891 92892 92893 92894 92895 92896 92897 92898 92899 92900 92901 92902 92903 92904 92905 92906 92907 92908 92909 92910 92911 92912 92913 92914 92915 92916 92917 92918 92919 92920 92921 92922 92923 92924 92925 92926 92927 92928 92929 92930 92931 92932 92933 92934 92935 92936 92937 92938 92939 92940 92941 92942 92943 92944 92945 92946 92947 92948 92949 92950 92951 92952 92953 92954 92955 92956 92957 92958 92959 92960 92961 92962 | if( (pMatch->fg.jointype & JT_LEFT)!=0 ){ ExprSetProperty(pExpr, EP_CanBeNull); } pSchema = pExpr->pTab->pSchema; } } /* if( pSrcList ) */ #if !defined(SQLITE_OMIT_TRIGGER) || !defined(SQLITE_OMIT_UPSERT) /* If we have not already resolved the name, then maybe ** it is a new.* or old.* trigger argument reference. Or ** maybe it is an excluded.* from an upsert. */ if( zDb==0 && zTab!=0 && cntTab==0 ){ pTab = 0; #ifndef SQLITE_OMIT_TRIGGER if( pParse->pTriggerTab!=0 ){ int op = pParse->eTriggerOp; assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT ); if( op!=TK_DELETE && sqlite3StrICmp("new",zTab) == 0 ){ pExpr->iTable = 1; pTab = pParse->pTriggerTab; }else if( op!=TK_INSERT && sqlite3StrICmp("old",zTab)==0 ){ pExpr->iTable = 0; pTab = pParse->pTriggerTab; } } #endif /* SQLITE_OMIT_TRIGGER */ #ifndef SQLITE_OMIT_UPSERT if( (pNC->ncFlags & NC_UUpsert)!=0 ){ Upsert *pUpsert = pNC->uNC.pUpsert; if( pUpsert && sqlite3StrICmp("excluded",zTab)==0 ){ pTab = pUpsert->pUpsertSrc->a[0].pTab; pExpr->iTable = 2; } } #endif /* SQLITE_OMIT_UPSERT */ if( pTab ){ int iCol; pSchema = pTab->pSchema; cntTab++; for(iCol=0, pCol=pTab->aCol; iCol<pTab->nCol; iCol++, pCol++){ if( sqlite3StrICmp(pCol->zName, zCol)==0 ){ if( iCol==pTab->iPKey ){ iCol = -1; } break; } } if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) && VisibleRowid(pTab) ){ /* IMP: R-51414-32910 */ iCol = -1; } if( iCol<pTab->nCol ){ cnt++; #ifndef SQLITE_OMIT_UPSERT if( pExpr->iTable==2 ){ testcase( iCol==(-1) ); pExpr->iTable = pNC->uNC.pUpsert->regData + iCol; eNewExprOp = TK_REGISTER; }else #endif /* SQLITE_OMIT_UPSERT */ { #ifndef SQLITE_OMIT_TRIGGER if( iCol<0 ){ pExpr->affinity = SQLITE_AFF_INTEGER; }else if( pExpr->iTable==0 ){ testcase( iCol==31 ); testcase( iCol==32 ); pParse->oldmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol)); }else{ testcase( iCol==31 ); testcase( iCol==32 ); pParse->newmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<<iCol)); } pExpr->pTab = pTab; pExpr->iColumn = (i16)iCol; eNewExprOp = TK_TRIGGER; #endif /* SQLITE_OMIT_TRIGGER */ } } } } #endif /* !defined(SQLITE_OMIT_TRIGGER) || !defined(SQLITE_OMIT_UPSERT) */ /* ** Perhaps the name is a reference to the ROWID */ if( cnt==0 && cntTab==1 && pMatch |
︙ | ︙ | |||
92834 92835 92836 92837 92838 92839 92840 | ** ** The ability to use an output result-set column in the WHERE, GROUP BY, ** or HAVING clauses, or as part of a larger expression in the ORDER BY ** clause is not standard SQL. This is a (goofy) SQLite extension, that ** is supported for backwards compatibility only. Hence, we issue a warning ** on sqlite3_log() whenever the capability is used. */ | | < > > > | 92983 92984 92985 92986 92987 92988 92989 92990 92991 92992 92993 92994 92995 92996 92997 92998 92999 93000 93001 93002 | ** ** The ability to use an output result-set column in the WHERE, GROUP BY, ** or HAVING clauses, or as part of a larger expression in the ORDER BY ** clause is not standard SQL. This is a (goofy) SQLite extension, that ** is supported for backwards compatibility only. Hence, we issue a warning ** on sqlite3_log() whenever the capability is used. */ if( (pNC->ncFlags & NC_UEList)!=0 && cnt==0 && zTab==0 ){ pEList = pNC->uNC.pEList; assert( pEList!=0 ); for(j=0; j<pEList->nExpr; j++){ char *zAs = pEList->a[j].zName; if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){ Expr *pOrig; assert( pExpr->pLeft==0 && pExpr->pRight==0 ); assert( pExpr->x.pList==0 ); assert( pExpr->x.pSelect==0 ); |
︙ | ︙ | |||
92934 92935 92936 92937 92938 92939 92940 | /* Clean up and return */ sqlite3ExprDelete(db, pExpr->pLeft); pExpr->pLeft = 0; sqlite3ExprDelete(db, pExpr->pRight); pExpr->pRight = 0; | | | 93085 93086 93087 93088 93089 93090 93091 93092 93093 93094 93095 93096 93097 93098 93099 | /* Clean up and return */ sqlite3ExprDelete(db, pExpr->pLeft); pExpr->pLeft = 0; sqlite3ExprDelete(db, pExpr->pRight); pExpr->pRight = 0; pExpr->op = eNewExprOp; ExprSetProperty(pExpr, EP_Leaf); lookupname_end: if( cnt==1 ){ assert( pNC!=0 ); if( !ExprHasProperty(pExpr, EP_Alias) ){ sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList); } |
︙ | ︙ | |||
93366 93367 93368 93369 93370 93371 93372 | pEList = pSelect->pEList; /* Resolve all names in the ORDER BY term expression */ memset(&nc, 0, sizeof(nc)); nc.pParse = pParse; nc.pSrcList = pSelect->pSrc; | | | | 93517 93518 93519 93520 93521 93522 93523 93524 93525 93526 93527 93528 93529 93530 93531 93532 | pEList = pSelect->pEList; /* Resolve all names in the ORDER BY term expression */ memset(&nc, 0, sizeof(nc)); nc.pParse = pParse; nc.pSrcList = pSelect->pSrc; nc.uNC.pEList = pEList; nc.ncFlags = NC_AllowAgg|NC_UEList; nc.nErr = 0; db = pParse->db; savedSuppErr = db->suppressErr; db->suppressErr = 1; rc = sqlite3ResolveExprNames(&nc, pE); db->suppressErr = savedSuppErr; if( rc ) return 0; |
︙ | ︙ | |||
93750 93751 93752 93753 93754 93755 93756 | ** other expressions in the SELECT statement. This is so that ** expressions in the WHERE clause (etc.) can refer to expressions by ** aliases in the result set. ** ** Minor point: If this is the case, then the expression will be ** re-evaluated for each reference to it. */ | > | > | 93901 93902 93903 93904 93905 93906 93907 93908 93909 93910 93911 93912 93913 93914 93915 93916 93917 | ** other expressions in the SELECT statement. This is so that ** expressions in the WHERE clause (etc.) can refer to expressions by ** aliases in the result set. ** ** Minor point: If this is the case, then the expression will be ** re-evaluated for each reference to it. */ assert( (sNC.ncFlags & (NC_UAggInfo|NC_UUpsert))==0 ); sNC.uNC.pEList = p->pEList; sNC.ncFlags |= NC_UEList; if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort; if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort; /* Resolve names in table-valued-function arguments */ for(i=0; i<p->pSrc->nSrc; i++){ struct SrcList_item *pItem = &p->pSrc->a[i]; if( pItem->fg.isTabFunc |
︙ | ︙ | |||
93983 93984 93985 93986 93987 93988 93989 | ** Any errors cause an error message to be set in pParse. */ SQLITE_PRIVATE void sqlite3ResolveSelfReference( Parse *pParse, /* Parsing context */ Table *pTab, /* The table being referenced */ int type, /* NC_IsCheck or NC_PartIdx or NC_IdxExpr */ Expr *pExpr, /* Expression to resolve. May be NULL. */ | | | 94136 94137 94138 94139 94140 94141 94142 94143 94144 94145 94146 94147 94148 94149 94150 | ** Any errors cause an error message to be set in pParse. */ SQLITE_PRIVATE void sqlite3ResolveSelfReference( Parse *pParse, /* Parsing context */ Table *pTab, /* The table being referenced */ int type, /* NC_IsCheck or NC_PartIdx or NC_IdxExpr */ Expr *pExpr, /* Expression to resolve. May be NULL. */ ExprList *pList /* Expression list to resolve. May be NULL. */ ){ SrcList sSrc; /* Fake SrcList for pParse->pNewTable */ NameContext sNC; /* Name context for pParse->pNewTable */ assert( type==NC_IsCheck || type==NC_PartIdx || type==NC_IdxExpr ); memset(&sNC, 0, sizeof(sNC)); memset(&sSrc, 0, sizeof(sSrc)); |
︙ | ︙ | |||
95369 95370 95371 95372 95373 95374 95375 95376 95377 95378 95379 95380 95381 95382 | } } pItem->zName = sqlite3DbStrDup(db, pOldItem->zName); pItem->zSpan = sqlite3DbStrDup(db, pOldItem->zSpan); pItem->sortOrder = pOldItem->sortOrder; pItem->done = 0; pItem->bSpanIsTab = pOldItem->bSpanIsTab; pItem->u = pOldItem->u; } return pNew; } /* ** If cursors, triggers, views and subqueries are all omitted from | > | 95522 95523 95524 95525 95526 95527 95528 95529 95530 95531 95532 95533 95534 95535 95536 | } } pItem->zName = sqlite3DbStrDup(db, pOldItem->zName); pItem->zSpan = sqlite3DbStrDup(db, pOldItem->zSpan); pItem->sortOrder = pOldItem->sortOrder; pItem->done = 0; pItem->bSpanIsTab = pOldItem->bSpanIsTab; pItem->bSorterRef = pOldItem->bSorterRef; pItem->u = pOldItem->u; } return pNew; } /* ** If cursors, triggers, views and subqueries are all omitted from |
︙ | ︙ | |||
95831 95832 95833 95834 95835 95836 95837 95838 95839 95840 95841 95842 95843 95844 95845 95846 95847 95848 95849 95850 95851 95852 95853 95854 | testcase( pExpr->op==TK_AGG_FUNCTION ); testcase( pExpr->op==TK_AGG_COLUMN ); if( pWalker->eCode==3 && pExpr->iTable==pWalker->u.iCur ){ return WRC_Continue; } /* Fall through */ case TK_IF_NULL_ROW: testcase( pExpr->op==TK_IF_NULL_ROW ); pWalker->eCode = 0; return WRC_Abort; case TK_VARIABLE: if( pWalker->eCode==5 ){ /* Silently convert bound parameters that appear inside of CREATE ** statements into a NULL when parsing the CREATE statement text out ** of the sqlite_master table */ pExpr->op = TK_NULL; }else if( pWalker->eCode==4 ){ /* A bound parameter in a CREATE statement that originates from ** sqlite3_prepare() causes an error */ pWalker->eCode = 0; return WRC_Abort; } /* Fall through */ default: | > > | | | 95985 95986 95987 95988 95989 95990 95991 95992 95993 95994 95995 95996 95997 95998 95999 96000 96001 96002 96003 96004 96005 96006 96007 96008 96009 96010 96011 96012 96013 96014 96015 96016 96017 96018 96019 | testcase( pExpr->op==TK_AGG_FUNCTION ); testcase( pExpr->op==TK_AGG_COLUMN ); if( pWalker->eCode==3 && pExpr->iTable==pWalker->u.iCur ){ return WRC_Continue; } /* Fall through */ case TK_IF_NULL_ROW: case TK_REGISTER: testcase( pExpr->op==TK_REGISTER ); testcase( pExpr->op==TK_IF_NULL_ROW ); pWalker->eCode = 0; return WRC_Abort; case TK_VARIABLE: if( pWalker->eCode==5 ){ /* Silently convert bound parameters that appear inside of CREATE ** statements into a NULL when parsing the CREATE statement text out ** of the sqlite_master table */ pExpr->op = TK_NULL; }else if( pWalker->eCode==4 ){ /* A bound parameter in a CREATE statement that originates from ** sqlite3_prepare() causes an error */ pWalker->eCode = 0; return WRC_Abort; } /* Fall through */ default: testcase( pExpr->op==TK_SELECT ); /* sqlite3SelectWalkFail() disallows */ testcase( pExpr->op==TK_EXISTS ); /* sqlite3SelectWalkFail() disallows */ return WRC_Continue; } } static int exprIsConst(Expr *p, int initFlag, int iCur){ Walker w; w.eCode = initFlag; w.xExprCallback = exprNodeIsConstant; |
︙ | ︙ | |||
96612 96613 96614 96615 96616 96617 96618 | ** If all of the above are false, then we can run this code just once ** save the results, and reuse the same result on subsequent invocations. */ if( !ExprHasProperty(pExpr, EP_VarSelect) ){ jmpIfDynamic = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); } | < < < < < < < < < < < | 96768 96769 96770 96771 96772 96773 96774 96775 96776 96777 96778 96779 96780 96781 | ** If all of the above are false, then we can run this code just once ** save the results, and reuse the same result on subsequent invocations. */ if( !ExprHasProperty(pExpr, EP_VarSelect) ){ jmpIfDynamic = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); } switch( pExpr->op ){ case TK_IN: { int addr; /* Address of OP_OpenEphemeral instruction */ Expr *pLeft = pExpr->pLeft; /* the LHS of the IN operator */ KeyInfo *pKeyInfo = 0; /* Key information */ int nVal; /* Size of vector pLeft */ |
︙ | ︙ | |||
96659 96660 96661 96662 96663 96664 96665 96666 96667 96668 96669 96670 96671 96672 | /* Case 1: expr IN (SELECT ...) ** ** Generate code to write the results of the select into the temporary ** table allocated and opened above. */ Select *pSelect = pExpr->x.pSelect; ExprList *pEList = pSelect->pEList; assert( !isRowid ); /* If the LHS and RHS of the IN operator do not match, that ** error will have been caught long before we reach this point. */ if( ALWAYS(pEList->nExpr==nVal) ){ SelectDest dest; int i; | > > > > > > > > > > > | 96804 96805 96806 96807 96808 96809 96810 96811 96812 96813 96814 96815 96816 96817 96818 96819 96820 96821 96822 96823 96824 96825 96826 96827 96828 | /* Case 1: expr IN (SELECT ...) ** ** Generate code to write the results of the select into the temporary ** table allocated and opened above. */ Select *pSelect = pExpr->x.pSelect; ExprList *pEList = pSelect->pEList; #ifndef SQLITE_OMIT_EXPLAIN if( pParse->explain==2 ){ char *zMsg = sqlite3MPrintf(pParse->db, "EXECUTE %sLIST SUBQUERY %d", jmpIfDynamic>=0?"":"CORRELATED ", pParse->iNextSelectId ); sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC); } #endif assert( !isRowid ); /* If the LHS and RHS of the IN operator do not match, that ** error will have been caught long before we reach this point. */ if( ALWAYS(pEList->nExpr==nVal) ){ SelectDest dest; int i; |
︙ | ︙ | |||
96701 96702 96703 96704 96705 96706 96707 | ** a column, use numeric affinity. */ char affinity; /* Affinity of the LHS of the IN */ int i; ExprList *pList = pExpr->x.pList; struct ExprList_item *pItem; int r1, r2, r3; | < | 96857 96858 96859 96860 96861 96862 96863 96864 96865 96866 96867 96868 96869 96870 | ** a column, use numeric affinity. */ char affinity; /* Affinity of the LHS of the IN */ int i; ExprList *pList = pExpr->x.pList; struct ExprList_item *pItem; int r1, r2, r3; affinity = sqlite3ExprAffinity(pLeft); if( !affinity ){ affinity = SQLITE_AFF_BLOB; } if( pKeyInfo ){ assert( sqlite3KeyInfoIsWriteable(pKeyInfo) ); pKeyInfo->aColl[0] = sqlite3ExprCollSeq(pParse, pExpr->pLeft); |
︙ | ︙ | |||
96780 96781 96782 96783 96784 96785 96786 96787 96788 96789 96790 96791 96792 96793 | int nReg; /* Registers to allocate */ Expr *pLimit; /* New limit expression */ testcase( pExpr->op==TK_EXISTS ); testcase( pExpr->op==TK_SELECT ); assert( pExpr->op==TK_EXISTS || pExpr->op==TK_SELECT ); assert( ExprHasProperty(pExpr, EP_xIsSelect) ); pSel = pExpr->x.pSelect; nReg = pExpr->op==TK_SELECT ? pSel->pEList->nExpr : 1; sqlite3SelectDestInit(&dest, 0, pParse->nMem+1); pParse->nMem += nReg; if( pExpr->op==TK_SELECT ){ dest.eDest = SRT_Mem; | > > > > > > > > > > > | 96935 96936 96937 96938 96939 96940 96941 96942 96943 96944 96945 96946 96947 96948 96949 96950 96951 96952 96953 96954 96955 96956 96957 96958 96959 | int nReg; /* Registers to allocate */ Expr *pLimit; /* New limit expression */ testcase( pExpr->op==TK_EXISTS ); testcase( pExpr->op==TK_SELECT ); assert( pExpr->op==TK_EXISTS || pExpr->op==TK_SELECT ); assert( ExprHasProperty(pExpr, EP_xIsSelect) ); #ifndef SQLITE_OMIT_EXPLAIN if( pParse->explain==2 ){ char *zMsg = sqlite3MPrintf(pParse->db, "EXECUTE %sSCALAR SUBQUERY %d", jmpIfDynamic>=0?"":"CORRELATED ", pParse->iNextSelectId ); sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC); } #endif pSel = pExpr->x.pSelect; nReg = pExpr->op==TK_SELECT ? pSel->pEList->nExpr : 1; sqlite3SelectDestInit(&dest, 0, pParse->nMem+1); pParse->nMem += nReg; if( pExpr->op==TK_SELECT ){ dest.eDest = SRT_Mem; |
︙ | ︙ | |||
98377 98378 98379 98380 98381 98382 98383 98384 98385 98386 98387 98388 98389 98390 | assert( pList!=0 ); assert( target>0 ); assert( pParse->pVdbe!=0 ); /* Never gets this far otherwise */ n = pList->nExpr; if( !ConstFactorOk(pParse) ) flags &= ~SQLITE_ECEL_FACTOR; for(pItem=pList->a, i=0; i<n; i++, pItem++){ Expr *pExpr = pItem->pExpr; if( (flags & SQLITE_ECEL_REF)!=0 && (j = pItem->u.x.iOrderByCol)>0 ){ if( flags & SQLITE_ECEL_OMITREF ){ i--; n--; }else{ sqlite3VdbeAddOp2(v, copyOp, j+srcReg-1, target+i); } | > > > > > > | 98543 98544 98545 98546 98547 98548 98549 98550 98551 98552 98553 98554 98555 98556 98557 98558 98559 98560 98561 98562 | assert( pList!=0 ); assert( target>0 ); assert( pParse->pVdbe!=0 ); /* Never gets this far otherwise */ n = pList->nExpr; if( !ConstFactorOk(pParse) ) flags &= ~SQLITE_ECEL_FACTOR; for(pItem=pList->a, i=0; i<n; i++, pItem++){ Expr *pExpr = pItem->pExpr; #ifdef SQLITE_ENABLE_SORTER_REFERENCES if( pItem->bSorterRef ){ i--; n--; }else #endif if( (flags & SQLITE_ECEL_REF)!=0 && (j = pItem->u.x.iOrderByCol)>0 ){ if( flags & SQLITE_ECEL_OMITREF ){ i--; n--; }else{ sqlite3VdbeAddOp2(v, copyOp, j+srcReg-1, target+i); } |
︙ | ︙ | |||
98905 98906 98907 98908 98909 98910 98911 98912 | return 1; } return 2; } if( pA->op!=TK_COLUMN && pA->op!=TK_AGG_COLUMN && pA->u.zToken ){ if( pA->op==TK_FUNCTION ){ if( sqlite3StrICmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2; }else if( strcmp(pA->u.zToken,pB->u.zToken)!=0 ){ | > > | | > | 99077 99078 99079 99080 99081 99082 99083 99084 99085 99086 99087 99088 99089 99090 99091 99092 99093 99094 99095 99096 99097 99098 99099 99100 99101 99102 99103 99104 | return 1; } return 2; } if( pA->op!=TK_COLUMN && pA->op!=TK_AGG_COLUMN && pA->u.zToken ){ if( pA->op==TK_FUNCTION ){ if( sqlite3StrICmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2; }else if( pA->op==TK_COLLATE ){ if( sqlite3_stricmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2; }else if( strcmp(pA->u.zToken,pB->u.zToken)!=0 ){ return 2; } } if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2; if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){ if( combinedFlags & EP_xIsSelect ) return 2; if( sqlite3ExprCompare(pParse, pA->pLeft, pB->pLeft, iTab) ) return 2; if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2; if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2; assert( (combinedFlags & EP_Reduced)==0 ); if( pA->op!=TK_STRING && pA->op!=TK_TRUEFALSE ){ if( pA->iColumn!=pB->iColumn ) return 2; if( pA->iTable!=pB->iTable && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2; } } return 0; } |
︙ | ︙ | |||
99261 99262 99263 99264 99265 99266 99267 | ** for additional information. */ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ int i; NameContext *pNC = pWalker->u.pNC; Parse *pParse = pNC->pParse; SrcList *pSrcList = pNC->pSrcList; | | > | 99436 99437 99438 99439 99440 99441 99442 99443 99444 99445 99446 99447 99448 99449 99450 99451 99452 | ** for additional information. */ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ int i; NameContext *pNC = pWalker->u.pNC; Parse *pParse = pNC->pParse; SrcList *pSrcList = pNC->pSrcList; AggInfo *pAggInfo = pNC->uNC.pAggInfo; assert( pNC->ncFlags & NC_UAggInfo ); switch( pExpr->op ){ case TK_AGG_COLUMN: case TK_COLUMN: { testcase( pExpr->op==TK_AGG_COLUMN ); testcase( pExpr->op==TK_COLUMN ); /* Check to see if the column is in one of the tables in the FROM ** clause of the aggregate query */ |
︙ | ︙ | |||
102432 102433 102434 102435 102436 102437 102438 | } assert( pVfs ); flags |= SQLITE_OPEN_MAIN_DB; rc = sqlite3BtreeOpen(pVfs, zPath, db, &pNew->pBt, 0, flags); sqlite3_free( zPath ); db->nDb++; } | | | 102608 102609 102610 102611 102612 102613 102614 102615 102616 102617 102618 102619 102620 102621 102622 | } assert( pVfs ); flags |= SQLITE_OPEN_MAIN_DB; rc = sqlite3BtreeOpen(pVfs, zPath, db, &pNew->pBt, 0, flags); sqlite3_free( zPath ); db->nDb++; } db->noSharedCache = 0; if( rc==SQLITE_CONSTRAINT ){ rc = SQLITE_ERROR; zErrDyn = sqlite3MPrintf(db, "database is already attached"); }else if( rc==SQLITE_OK ){ Pager *pPager; pNew->pSchema = sqlite3SchemaGet(db, pNew->pBt); if( !pNew->pSchema ){ |
︙ | ︙ | |||
102504 102505 102506 102507 102508 102509 102510 102511 102512 102513 102514 102515 102516 102517 | ** If this fails, or if opening the file failed, then close the file and ** remove the entry from the db->aDb[] array. i.e. put everything back the ** way we found it. */ if( rc==SQLITE_OK ){ sqlite3BtreeEnterAll(db); db->init.iDb = 0; rc = sqlite3Init(db, &zErrDyn); sqlite3BtreeLeaveAll(db); assert( zErrDyn==0 || rc!=SQLITE_OK ); } #ifdef SQLITE_USER_AUTHENTICATION if( rc==SQLITE_OK ){ u8 newAuth = 0; | > | 102680 102681 102682 102683 102684 102685 102686 102687 102688 102689 102690 102691 102692 102693 102694 | ** If this fails, or if opening the file failed, then close the file and ** remove the entry from the db->aDb[] array. i.e. put everything back the ** way we found it. */ if( rc==SQLITE_OK ){ sqlite3BtreeEnterAll(db); db->init.iDb = 0; db->mDbFlags &= ~(DBFLAG_SchemaKnownOk); rc = sqlite3Init(db, &zErrDyn); sqlite3BtreeLeaveAll(db); assert( zErrDyn==0 || rc!=SQLITE_OK ); } #ifdef SQLITE_USER_AUTHENTICATION if( rc==SQLITE_OK ){ u8 newAuth = 0; |
︙ | ︙ | |||
102776 102777 102778 102779 102780 102781 102782 102783 102784 102785 102786 102787 102788 102789 | pItem->zDatabase = 0; pItem->pSchema = pFix->pSchema; } #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) if( sqlite3FixSelect(pFix, pItem->pSelect) ) return 1; if( sqlite3FixExpr(pFix, pItem->pOn) ) return 1; #endif } return 0; } #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) SQLITE_PRIVATE int sqlite3FixSelect( DbFixer *pFix, /* Context of the fixation */ Select *pSelect /* The SELECT statement to be fixed to one database */ | > > > | 102953 102954 102955 102956 102957 102958 102959 102960 102961 102962 102963 102964 102965 102966 102967 102968 102969 | pItem->zDatabase = 0; pItem->pSchema = pFix->pSchema; } #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) if( sqlite3FixSelect(pFix, pItem->pSelect) ) return 1; if( sqlite3FixExpr(pFix, pItem->pOn) ) return 1; #endif if( pItem->fg.isTabFunc && sqlite3FixExprList(pFix, pItem->u1.pFuncArg) ){ return 1; } } return 0; } #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) SQLITE_PRIVATE int sqlite3FixSelect( DbFixer *pFix, /* Context of the fixation */ Select *pSelect /* The SELECT statement to be fixed to one database */ |
︙ | ︙ | |||
102875 102876 102877 102878 102879 102880 102881 102882 102883 102884 102885 102886 102887 102888 | } if( sqlite3FixExpr(pFix, pStep->pWhere) ){ return 1; } if( sqlite3FixExprList(pFix, pStep->pExprList) ){ return 1; } pStep = pStep->pNext; } return 0; } #endif /************** End of attach.c **********************************************/ | > > > > > > > > > > > > | 103055 103056 103057 103058 103059 103060 103061 103062 103063 103064 103065 103066 103067 103068 103069 103070 103071 103072 103073 103074 103075 103076 103077 103078 103079 103080 | } if( sqlite3FixExpr(pFix, pStep->pWhere) ){ return 1; } if( sqlite3FixExprList(pFix, pStep->pExprList) ){ return 1; } #ifndef SQLITE_OMIT_UPSERT if( pStep->pUpsert ){ Upsert *pUp = pStep->pUpsert; if( sqlite3FixExprList(pFix, pUp->pUpsertTarget) || sqlite3FixExpr(pFix, pUp->pUpsertTargetWhere) || sqlite3FixExprList(pFix, pUp->pUpsertSet) || sqlite3FixExpr(pFix, pUp->pUpsertWhere) ){ return 1; } } #endif pStep = pStep->pNext; } return 0; } #endif /************** End of attach.c **********************************************/ |
︙ | ︙ | |||
103502 103503 103504 103505 103506 103507 103508 103509 103510 103511 | SQLITE_PRIVATE Table *sqlite3LocateTable( Parse *pParse, /* context in which to report errors */ u32 flags, /* LOCATE_VIEW or LOCATE_NOERR */ const char *zName, /* Name of the table we are looking for */ const char *zDbase /* Name of the database. Might be NULL */ ){ Table *p; /* Read the database schema. If an error occurs, leave an error message ** and code in pParse and return NULL. */ | > > | > | | | | | 103694 103695 103696 103697 103698 103699 103700 103701 103702 103703 103704 103705 103706 103707 103708 103709 103710 103711 103712 103713 103714 103715 103716 103717 103718 103719 103720 103721 103722 103723 103724 103725 103726 103727 103728 | SQLITE_PRIVATE Table *sqlite3LocateTable( Parse *pParse, /* context in which to report errors */ u32 flags, /* LOCATE_VIEW or LOCATE_NOERR */ const char *zName, /* Name of the table we are looking for */ const char *zDbase /* Name of the database. Might be NULL */ ){ Table *p; sqlite3 *db = pParse->db; /* Read the database schema. If an error occurs, leave an error message ** and code in pParse and return NULL. */ if( (db->mDbFlags & DBFLAG_SchemaKnownOk)==0 && SQLITE_OK!=sqlite3ReadSchema(pParse) ){ return 0; } p = sqlite3FindTable(db, zName, zDbase); if( p==0 ){ const char *zMsg = flags & LOCATE_VIEW ? "no such view" : "no such table"; #ifndef SQLITE_OMIT_VIRTUALTABLE if( sqlite3FindDbName(db, zDbase)<1 ){ /* If zName is the not the name of a table in the schema created using ** CREATE, then check to see if it is the name of an virtual table that ** can be an eponymous virtual table. */ Module *pMod = (Module*)sqlite3HashFind(&db->aModule, zName); if( pMod==0 && sqlite3_strnicmp(zName, "pragma_", 7)==0 ){ pMod = sqlite3PragmaVtabRegister(db, zName); } if( pMod && sqlite3VtabEponymousTableInit(pParse, pMod) ){ return pMod->pEpoTab; } } #endif if( (flags & LOCATE_NOERR)==0 ){ |
︙ | ︙ | |||
103684 103685 103686 103687 103688 103689 103690 103691 103692 103693 103694 103695 103696 103697 | int i; assert( iDb<db->nDb ); if( iDb>=0 ){ assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); DbSetProperty(db, iDb, DB_ResetWanted); DbSetProperty(db, 1, DB_ResetWanted); } if( db->nSchemaLock==0 ){ for(i=0; i<db->nDb; i++){ if( DbHasProperty(db, i, DB_ResetWanted) ){ sqlite3SchemaClear(db->aDb[i].pSchema); } | > | 103879 103880 103881 103882 103883 103884 103885 103886 103887 103888 103889 103890 103891 103892 103893 | int i; assert( iDb<db->nDb ); if( iDb>=0 ){ assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); DbSetProperty(db, iDb, DB_ResetWanted); DbSetProperty(db, 1, DB_ResetWanted); db->mDbFlags &= ~DBFLAG_SchemaKnownOk; } if( db->nSchemaLock==0 ){ for(i=0; i<db->nDb; i++){ if( DbHasProperty(db, i, DB_ResetWanted) ){ sqlite3SchemaClear(db->aDb[i].pSchema); } |
︙ | ︙ | |||
103709 103710 103711 103712 103713 103714 103715 | assert( db->nSchemaLock==0 ); for(i=0; i<db->nDb; i++){ Db *pDb = &db->aDb[i]; if( pDb->pSchema ){ sqlite3SchemaClear(pDb->pSchema); } } | | | 103905 103906 103907 103908 103909 103910 103911 103912 103913 103914 103915 103916 103917 103918 103919 | assert( db->nSchemaLock==0 ); for(i=0; i<db->nDb; i++){ Db *pDb = &db->aDb[i]; if( pDb->pSchema ){ sqlite3SchemaClear(pDb->pSchema); } } db->mDbFlags &= ~(DBFLAG_SchemaChange|DBFLAG_SchemaKnownOk); sqlite3VtabUnlockList(db); sqlite3BtreeLeaveAll(db); sqlite3CollapseDatabaseArray(db); } /* ** This routine is called when a commit occurs. |
︙ | ︙ | |||
104254 104255 104256 104257 104258 104259 104260 | pCol = &p->aCol[p->nCol]; memset(pCol, 0, sizeof(p->aCol[0])); pCol->zName = z; sqlite3ColumnPropertiesFromName(p, pCol); if( pType->n==0 ){ /* If there is no type specified, columns have the default affinity | | > > > > > | | 104450 104451 104452 104453 104454 104455 104456 104457 104458 104459 104460 104461 104462 104463 104464 104465 104466 104467 104468 104469 104470 104471 104472 104473 104474 104475 104476 104477 | pCol = &p->aCol[p->nCol]; memset(pCol, 0, sizeof(p->aCol[0])); pCol->zName = z; sqlite3ColumnPropertiesFromName(p, pCol); if( pType->n==0 ){ /* If there is no type specified, columns have the default affinity ** 'BLOB' with a default size of 4 bytes. */ pCol->affinity = SQLITE_AFF_BLOB; pCol->szEst = 1; #ifdef SQLITE_ENABLE_SORTER_REFERENCES if( 4>=sqlite3GlobalConfig.szSorterRef ){ pCol->colFlags |= COLFLAG_SORTERREF; } #endif }else{ zType = z + sqlite3Strlen30(z) + 1; memcpy(zType, pType->z, pType->n); zType[pType->n] = 0; sqlite3Dequote(zType); pCol->affinity = sqlite3AffinityType(zType, pCol); pCol->colFlags |= COLFLAG_HASTYPE; } p->nCol++; pParse->constraintName.n = 0; } /* |
︙ | ︙ | |||
104322 104323 104324 104325 104326 104327 104328 | ** 'REAL' | SQLITE_AFF_REAL ** 'FLOA' | SQLITE_AFF_REAL ** 'DOUB' | SQLITE_AFF_REAL ** ** If none of the substrings in the above table are found, ** SQLITE_AFF_NUMERIC is returned. */ | | | 104523 104524 104525 104526 104527 104528 104529 104530 104531 104532 104533 104534 104535 104536 104537 | ** 'REAL' | SQLITE_AFF_REAL ** 'FLOA' | SQLITE_AFF_REAL ** 'DOUB' | SQLITE_AFF_REAL ** ** If none of the substrings in the above table are found, ** SQLITE_AFF_NUMERIC is returned. */ SQLITE_PRIVATE char sqlite3AffinityType(const char *zIn, Column *pCol){ u32 h = 0; char aff = SQLITE_AFF_NUMERIC; const char *zChar = 0; assert( zIn!=0 ); while( zIn[0] ){ h = (h<<8) + sqlite3UpperToLower[(*zIn)&0xff]; |
︙ | ︙ | |||
104359 104360 104361 104362 104363 104364 104365 | #endif }else if( (h&0x00FFFFFF)==(('i'<<16)+('n'<<8)+'t') ){ /* INT */ aff = SQLITE_AFF_INTEGER; break; } } | | | | | < < < | > > > > > > > > | 104560 104561 104562 104563 104564 104565 104566 104567 104568 104569 104570 104571 104572 104573 104574 104575 104576 104577 104578 104579 104580 104581 104582 104583 104584 104585 104586 104587 104588 104589 104590 104591 104592 104593 104594 104595 104596 104597 104598 104599 | #endif }else if( (h&0x00FFFFFF)==(('i'<<16)+('n'<<8)+'t') ){ /* INT */ aff = SQLITE_AFF_INTEGER; break; } } /* If pCol is not NULL, store an estimate of the field size. The ** estimate is scaled so that the size of an integer is 1. */ if( pCol ){ int v = 0; /* default size is approx 4 bytes */ if( aff<SQLITE_AFF_NUMERIC ){ if( zChar ){ while( zChar[0] ){ if( sqlite3Isdigit(zChar[0]) ){ /* BLOB(k), VARCHAR(k), CHAR(k) -> r=(k/4+1) */ sqlite3GetInt32(zChar, &v); break; } zChar++; } }else{ v = 16; /* BLOB, TEXT, CLOB -> r=5 (approx 20 bytes)*/ } } #ifdef SQLITE_ENABLE_SORTER_REFERENCES if( v>=sqlite3GlobalConfig.szSorterRef ){ pCol->colFlags |= COLFLAG_SORTERREF; } #endif v = v/4 + 1; if( v>255 ) v = 255; pCol->szEst = v; } return aff; } /* ** The expression is the default value for the most recently added column ** of the table currently under construction. |
︙ | ︙ | |||
108364 108365 108366 108367 108368 108369 108370 | int iDataCur = 0; /* VDBE cursor for the canonical data source */ int iIdxCur = 0; /* Cursor number of the first index */ int nIdx; /* Number of indices */ sqlite3 *db; /* Main database structure */ AuthContext sContext; /* Authorization context */ NameContext sNC; /* Name context to resolve expressions in */ int iDb; /* Database number */ | | | 108570 108571 108572 108573 108574 108575 108576 108577 108578 108579 108580 108581 108582 108583 108584 | int iDataCur = 0; /* VDBE cursor for the canonical data source */ int iIdxCur = 0; /* Cursor number of the first index */ int nIdx; /* Number of indices */ sqlite3 *db; /* Main database structure */ AuthContext sContext; /* Authorization context */ NameContext sNC; /* Name context to resolve expressions in */ int iDb; /* Database number */ int memCnt = 0; /* Memory cell used for change counting */ int rcauth; /* Value returned by authorization callback */ int eOnePass; /* ONEPASS_OFF or _SINGLE or _MULTI */ int aiCurOnePass[2]; /* The write cursors opened by WHERE_ONEPASS */ u8 *aToOpen = 0; /* Open cursor iTabCur+j if aToOpen[j] is true */ Index *pPk; /* The PRIMARY KEY index on the table */ int iPk = 0; /* First of nPk registers holding PRIMARY KEY value */ i16 nPk = 1; /* Number of columns in the PRIMARY KEY */ |
︙ | ︙ | |||
108469 108470 108471 108472 108473 108474 108475 | /* Begin generating code. */ v = sqlite3GetVdbe(pParse); if( v==0 ){ goto delete_from_cleanup; } if( pParse->nested==0 ) sqlite3VdbeCountChanges(v); | | | 108675 108676 108677 108678 108679 108680 108681 108682 108683 108684 108685 108686 108687 108688 108689 | /* Begin generating code. */ v = sqlite3GetVdbe(pParse); if( v==0 ){ goto delete_from_cleanup; } if( pParse->nested==0 ) sqlite3VdbeCountChanges(v); sqlite3BeginWriteOperation(pParse, bComplex, iDb); /* If we are trying to delete from a view, realize that view into ** an ephemeral table. */ #if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) if( isView ){ sqlite3MaterializeView(pParse, pTab, |
︙ | ︙ | |||
108497 108498 108499 108500 108501 108502 108503 | if( sqlite3ResolveExprNames(&sNC, pWhere) ){ goto delete_from_cleanup; } /* Initialize the counter of the number of rows deleted, if ** we are counting rows. */ | | > > > | 108703 108704 108705 108706 108707 108708 108709 108710 108711 108712 108713 108714 108715 108716 108717 108718 108719 108720 | if( sqlite3ResolveExprNames(&sNC, pWhere) ){ goto delete_from_cleanup; } /* Initialize the counter of the number of rows deleted, if ** we are counting rows. */ if( (db->flags & SQLITE_CountRows)!=0 && !pParse->nested && !pParse->pTriggerTab ){ memCnt = ++pParse->nMem; sqlite3VdbeAddOp2(v, OP_Integer, 0, memCnt); } #ifndef SQLITE_OMIT_TRUNCATE_OPTIMIZATION /* Special case: A DELETE without a WHERE clause deletes everything. ** It is easier just to erase the whole table. Prior to version 3.6.5, |
︙ | ︙ | |||
108525 108526 108527 108528 108529 108530 108531 | #ifdef SQLITE_ENABLE_PREUPDATE_HOOK && db->xPreUpdateCallback==0 #endif ){ assert( !isView ); sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName); if( HasRowid(pTab) ){ | | | 108734 108735 108736 108737 108738 108739 108740 108741 108742 108743 108744 108745 108746 108747 108748 | #ifdef SQLITE_ENABLE_PREUPDATE_HOOK && db->xPreUpdateCallback==0 #endif ){ assert( !isView ); sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName); if( HasRowid(pTab) ){ sqlite3VdbeAddOp4(v, OP_Clear, pTab->tnum, iDb, memCnt ? memCnt : -1, pTab->zName, P4_STATIC); } for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ assert( pIdx->pSchema==pTab->pSchema ); sqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb); } }else |
︙ | ︙ | |||
108570 108571 108572 108573 108574 108575 108576 108577 108578 | ** ONEPASS_MULTI: One-pass approach - any number of rows may be deleted. */ pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, wcf, iTabCur+1); if( pWInfo==0 ) goto delete_from_cleanup; eOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass); assert( IsVirtual(pTab)==0 || eOnePass!=ONEPASS_MULTI ); assert( IsVirtual(pTab) || bComplex || eOnePass!=ONEPASS_OFF ); /* Keep track of the number of rows to be deleted */ | > | | 108779 108780 108781 108782 108783 108784 108785 108786 108787 108788 108789 108790 108791 108792 108793 108794 108795 108796 | ** ONEPASS_MULTI: One-pass approach - any number of rows may be deleted. */ pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, wcf, iTabCur+1); if( pWInfo==0 ) goto delete_from_cleanup; eOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass); assert( IsVirtual(pTab)==0 || eOnePass!=ONEPASS_MULTI ); assert( IsVirtual(pTab) || bComplex || eOnePass!=ONEPASS_OFF ); if( eOnePass!=ONEPASS_SINGLE ) sqlite3MultiWrite(pParse); /* Keep track of the number of rows to be deleted */ if( memCnt ){ sqlite3VdbeAddOp2(v, OP_AddImm, memCnt, 1); } /* Extract the rowid or primary key for the current row */ if( pPk ){ for(i=0; i<nPk; i++){ assert( pPk->aiColumn[i]>=0 ); |
︙ | ︙ | |||
108715 108716 108717 108718 108719 108720 108721 | sqlite3AutoincrementEnd(pParse); } /* Return the number of rows that were deleted. If this routine is ** generating code because of a call to sqlite3NestedParse(), do not ** invoke the callback function. */ | | | 108925 108926 108927 108928 108929 108930 108931 108932 108933 108934 108935 108936 108937 108938 108939 | sqlite3AutoincrementEnd(pParse); } /* Return the number of rows that were deleted. If this routine is ** generating code because of a call to sqlite3NestedParse(), do not ** invoke the callback function. */ if( memCnt ){ sqlite3VdbeAddOp2(v, OP_ResultRow, memCnt, 1); sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", SQLITE_STATIC); } delete_from_cleanup: sqlite3AuthContextPop(&sContext); |
︙ | ︙ | |||
112897 112898 112899 112900 112901 112902 112903 | ** D: cleanup */ SQLITE_PRIVATE void sqlite3Insert( Parse *pParse, /* Parser context */ SrcList *pTabList, /* Name of table into which we are inserting */ Select *pSelect, /* A SELECT statement to use as the data source */ IdList *pColumn, /* Column names corresponding to IDLIST. */ | | > | 113107 113108 113109 113110 113111 113112 113113 113114 113115 113116 113117 113118 113119 113120 113121 113122 | ** D: cleanup */ SQLITE_PRIVATE void sqlite3Insert( Parse *pParse, /* Parser context */ SrcList *pTabList, /* Name of table into which we are inserting */ Select *pSelect, /* A SELECT statement to use as the data source */ IdList *pColumn, /* Column names corresponding to IDLIST. */ int onError, /* How to handle constraint errors */ Upsert *pUpsert /* ON CONFLICT clauses for upsert, or NULL */ ){ sqlite3 *db; /* The main database structure */ Table *pTab; /* The table to insert into. aka TABLE */ int i, j; /* Loop counters */ Vdbe *v; /* Generate code into this virtual machine */ Index *pIdx; /* For looping over indices of the table */ int nColumn; /* Number of columns in the data */ |
︙ | ︙ | |||
113192 113193 113194 113195 113196 113197 113198 | if( pColumn!=0 && nColumn!=pColumn->nId ){ sqlite3ErrorMsg(pParse, "%d values for %d columns", nColumn, pColumn->nId); goto insert_cleanup; } /* Initialize the count of rows to be inserted */ | | > > > > > > > > > > > > > > > > | 113403 113404 113405 113406 113407 113408 113409 113410 113411 113412 113413 113414 113415 113416 113417 113418 113419 113420 113421 113422 113423 113424 113425 113426 113427 113428 113429 113430 113431 113432 113433 113434 113435 113436 113437 113438 113439 113440 113441 113442 113443 113444 113445 113446 113447 113448 113449 113450 113451 113452 | if( pColumn!=0 && nColumn!=pColumn->nId ){ sqlite3ErrorMsg(pParse, "%d values for %d columns", nColumn, pColumn->nId); goto insert_cleanup; } /* Initialize the count of rows to be inserted */ if( (db->flags & SQLITE_CountRows)!=0 && !pParse->nested && !pParse->pTriggerTab ){ regRowCount = ++pParse->nMem; sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount); } /* If this is not a view, open the table and and all indices */ if( !isView ){ int nIdx; nIdx = sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, -1, 0, &iDataCur, &iIdxCur); aRegIdx = sqlite3DbMallocRawNN(db, sizeof(int)*(nIdx+1)); if( aRegIdx==0 ){ goto insert_cleanup; } for(i=0, pIdx=pTab->pIndex; i<nIdx; pIdx=pIdx->pNext, i++){ assert( pIdx ); aRegIdx[i] = ++pParse->nMem; pParse->nMem += pIdx->nColumn; } } #ifndef SQLITE_OMIT_UPSERT if( pUpsert ){ pTabList->a[0].iCursor = iDataCur; pUpsert->pUpsertSrc = pTabList; pUpsert->regData = regData; pUpsert->iDataCur = iDataCur; pUpsert->iIdxCur = iIdxCur; if( pUpsert->pUpsertTarget ){ sqlite3UpsertAnalyzeTarget(pParse, pTabList, pUpsert); } } #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 ** following pseudocode (template 4): ** ** rewind temp table, if empty goto D |
︙ | ︙ | |||
113414 113415 113416 113417 113418 113419 113420 | sqlite3MayAbort(pParse); }else #endif { int isReplace; /* Set to true if constraints may cause a replace */ int bUseSeek; /* True to use OPFLAG_SEEKRESULT */ sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur, | | | 113641 113642 113643 113644 113645 113646 113647 113648 113649 113650 113651 113652 113653 113654 113655 | sqlite3MayAbort(pParse); }else #endif { int isReplace; /* Set to true if constraints may cause a replace */ int bUseSeek; /* True to use OPFLAG_SEEKRESULT */ sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur, regIns, 0, ipkColumn>=0, onError, endOfLoop, &isReplace, 0, pUpsert ); sqlite3FkCheck(pParse, pTab, 0, regIns, 0, 0); /* Set the OPFLAG_USESEEKRESULT flag if either (a) there are no REPLACE ** constraints or (b) there are no triggers and this table is not a ** parent table in a foreign key constraint. It is safe to set the ** flag in the second case as if any REPLACE constraint is hit, an |
︙ | ︙ | |||
113437 113438 113439 113440 113441 113442 113443 | regIns, aRegIdx, 0, appendFlag, bUseSeek ); } } /* Update the count of rows that are inserted */ | | | 113664 113665 113666 113667 113668 113669 113670 113671 113672 113673 113674 113675 113676 113677 113678 | regIns, aRegIdx, 0, appendFlag, bUseSeek ); } } /* Update the count of rows that are inserted */ if( regRowCount ){ sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1); } if( pTrigger ){ /* Code AFTER triggers */ sqlite3CodeRowTrigger(pParse, pTrigger, TK_INSERT, 0, TRIGGER_AFTER, pTab, regData-2-pTab->nCol, onError, endOfLoop); |
︙ | ︙ | |||
113474 113475 113476 113477 113478 113479 113480 | } /* ** Return the number of rows inserted. If this routine is ** generating code because of a call to sqlite3NestedParse(), do not ** invoke the callback function. */ | | > | 113701 113702 113703 113704 113705 113706 113707 113708 113709 113710 113711 113712 113713 113714 113715 113716 113717 113718 113719 113720 113721 113722 113723 113724 | } /* ** Return the number of rows inserted. If this routine is ** generating code because of a call to sqlite3NestedParse(), do not ** invoke the callback function. */ if( regRowCount ){ sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1); sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows inserted", SQLITE_STATIC); } insert_cleanup: sqlite3SrcListDelete(db, pTabList); sqlite3ExprListDelete(db, pList); sqlite3UpsertDelete(db, pUpsert); sqlite3SelectDelete(db, pSelect); sqlite3IdListDelete(db, pColumn); sqlite3DbFree(db, aRegIdx); } /* Make sure "isView" and other macros defined above are undefined. Otherwise ** they may interfere with compilation of other functions in this file |
︙ | ︙ | |||
113553 113554 113555 113556 113557 113558 113559 113560 113561 113562 113563 113564 113565 113566 | } testcase( w.eCode==0 ); testcase( w.eCode==CKCNSTRNT_COLUMN ); testcase( w.eCode==CKCNSTRNT_ROWID ); testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) ); return !w.eCode; } /* ** 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 | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 113781 113782 113783 113784 113785 113786 113787 113788 113789 113790 113791 113792 113793 113794 113795 113796 113797 113798 113799 113800 113801 113802 113803 113804 113805 113806 113807 113808 113809 113810 113811 113812 113813 113814 113815 113816 113817 113818 113819 113820 113821 113822 113823 113824 113825 113826 113827 113828 113829 113830 113831 113832 | } testcase( w.eCode==0 ); testcase( w.eCode==CKCNSTRNT_COLUMN ); testcase( w.eCode==CKCNSTRNT_ROWID ); testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) ); return !w.eCode; } /* ** An instance of the ConstraintAddr object remembers the byte-code addresses ** for sections of the constraint checks that deal with uniqueness constraints ** on the rowid and on the upsert constraint. ** ** This information is passed into checkReorderConstraintChecks() to insert ** some OP_Goto operations so that the rowid and upsert constraints occur ** in the correct order relative to other constraints. */ typedef struct ConstraintAddr ConstraintAddr; struct ConstraintAddr { int ipkTop; /* Subroutine for rowid constraint check */ int upsertTop; /* Label for upsert constraint check subroutine */ int upsertTop2; /* Copy of upsertTop not cleared by the call */ int upsertBtm; /* upsert constraint returns to this label */ int ipkBtm; /* Return opcode rowid constraint check */ }; /* ** Generate any OP_Goto operations needed to cause constraints to be ** run that haven't already been run. */ static void reorderConstraintChecks(Vdbe *v, ConstraintAddr *p){ if( p->upsertTop ){ testcase( sqlite3VdbeLabelHasBeenResolved(v, p->upsertTop) ); sqlite3VdbeGoto(v, p->upsertTop); VdbeComment((v, "call upsert subroutine")); sqlite3VdbeResolveLabel(v, p->upsertBtm); p->upsertTop = 0; } if( p->ipkTop ){ sqlite3VdbeGoto(v, p->ipkTop); VdbeComment((v, "call rowid unique-check subroutine")); sqlite3VdbeJumpHere(v, p->ipkBtm); p->ipkTop = 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 |
︙ | ︙ | |||
113649 113650 113651 113652 113653 113654 113655 | int iIdxCur, /* First index cursor */ int regNewData, /* First register in a range holding values to insert */ int regOldData, /* Previous content. 0 for INSERTs */ u8 pkChng, /* Non-zero if the rowid or PRIMARY KEY changed */ u8 overrideError, /* Override onError to this if not OE_Default */ int ignoreDest, /* Jump to this label on an OE_Ignore resolution */ int *pbMayReplace, /* OUT: Set to true if constraint may cause a replace */ | | > | | > > | 113915 113916 113917 113918 113919 113920 113921 113922 113923 113924 113925 113926 113927 113928 113929 113930 113931 113932 113933 113934 113935 113936 113937 113938 113939 113940 113941 113942 113943 113944 113945 113946 113947 113948 113949 113950 113951 113952 113953 113954 113955 | int iIdxCur, /* First index cursor */ int regNewData, /* First register in a range holding values to insert */ int regOldData, /* Previous content. 0 for INSERTs */ u8 pkChng, /* Non-zero if the rowid or PRIMARY KEY changed */ u8 overrideError, /* Override onError to this if not OE_Default */ 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 */ sqlite3 *db; /* Database connection */ int i; /* loop counter */ int ix; /* Index loop counter */ int nCol; /* Number of columns */ int onError; /* Conflict resolution strategy */ int addr1; /* Address of jump instruction */ 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 */ ConstraintAddr sAddr;/* Address information for constraint reordering */ Index *pUpIdx = 0; /* Index to which to apply the upsert */ u8 isUpdate; /* True if this is an UPDATE operation */ u8 bAffinityDone = 0; /* True if the OP_Affinity operation has been run */ int upsertBypass = 0; /* Address of Goto to bypass upsert subroutine */ isUpdate = regOldData!=0; db = pParse->db; v = sqlite3GetVdbe(pParse); assert( v!=0 ); assert( pTab->pSelect==0 ); /* This table is not a VIEW */ nCol = pTab->nCol; memset(&sAddr, 0, sizeof(sAddr)); /* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for ** normal rowid tables. nPkField is the number of key fields in the ** pPk index or 1 for a rowid table. In other words, nPkField is the ** number of fields in the true primary key of the table. */ if( HasRowid(pTab) ){ pPk = 0; |
︙ | ︙ | |||
113771 113772 113773 113774 113775 113776 113777 113778 113779 113780 113781 113782 113783 113784 113785 113786 113787 113788 113789 113790 113791 113792 113793 113794 113795 113796 113797 113798 113799 113800 113801 | P5_ConstraintCheck); } sqlite3VdbeResolveLabel(v, allOk); } pParse->iSelfTab = 0; } #endif /* !defined(SQLITE_OMIT_CHECK) */ /* If rowid is changing, make sure the new rowid does not previously ** exist in the table. */ if( pkChng && pPk==0 ){ int addrRowidOk = sqlite3VdbeMakeLabel(v); /* Figure out what action to take in case of a rowid collision */ onError = pTab->keyConf; if( overrideError!=OE_Default ){ onError = overrideError; }else if( onError==OE_Default ){ onError = OE_Abort; } if( isUpdate ){ /* pkChng!=0 does not mean that the rowid has changed, only that ** it might have changed. Skip the conflict logic below if the rowid ** is unchanged. */ sqlite3VdbeAddOp3(v, OP_Eq, regNewData, addrRowidOk, regOldData); sqlite3VdbeChangeP5(v, SQLITE_NOTNULL); VdbeCoverage(v); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < < < < < < < < < < < < > < > > > | 114040 114041 114042 114043 114044 114045 114046 114047 114048 114049 114050 114051 114052 114053 114054 114055 114056 114057 114058 114059 114060 114061 114062 114063 114064 114065 114066 114067 114068 114069 114070 114071 114072 114073 114074 114075 114076 114077 114078 114079 114080 114081 114082 114083 114084 114085 114086 114087 114088 114089 114090 114091 114092 114093 114094 114095 114096 114097 114098 114099 114100 114101 114102 114103 114104 114105 114106 114107 114108 114109 114110 114111 114112 114113 114114 114115 114116 114117 114118 114119 114120 114121 114122 114123 114124 114125 114126 114127 114128 114129 114130 114131 114132 114133 114134 114135 114136 114137 114138 114139 114140 114141 114142 114143 114144 114145 114146 114147 114148 114149 114150 114151 114152 114153 114154 114155 114156 114157 114158 114159 114160 | P5_ConstraintCheck); } sqlite3VdbeResolveLabel(v, allOk); } pParse->iSelfTab = 0; } #endif /* !defined(SQLITE_OMIT_CHECK) */ /* UNIQUE and PRIMARY KEY constraints should be handled in the following ** order: ** ** (1) OE_Abort, OE_Fail, OE_Rollback, OE_Ignore ** (2) OE_Update ** (3) OE_Replace ** ** OE_Fail and OE_Ignore must happen before any changes are made. ** OE_Update guarantees that only a single row will change, so it ** must happen before OE_Replace. Technically, OE_Abort and OE_Rollback ** could happen in any order, but they are grouped up front for ** convenience. ** ** Constraint checking code is generated in this order: ** (A) The rowid constraint ** (B) Unique index constraints that do not have OE_Replace as their ** 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. */ if( pUpsert ){ if( pUpsert->pUpsertTarget==0 ){ /* An ON CONFLICT DO NOTHING clause, without a constraint-target. ** Make all unique constraint resolution be OE_Ignore */ assert( pUpsert->pUpsertSet==0 ); overrideError = OE_Ignore; pUpsert = 0; }else if( (pUpIdx = pUpsert->pUpsertIdx)!=0 ){ /* If the constraint-target is on some column other than ** then ROWID, then we might need to move the UPSERT around ** so that it occurs in the correct order. */ sAddr.upsertTop = sAddr.upsertTop2 = sqlite3VdbeMakeLabel(v); sAddr.upsertBtm = sqlite3VdbeMakeLabel(v); } } /* If rowid is changing, make sure the new rowid does not previously ** exist in the table. */ if( pkChng && pPk==0 ){ int addrRowidOk = sqlite3VdbeMakeLabel(v); /* Figure out what action to take in case of a rowid collision */ onError = pTab->keyConf; 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 && pUpsert->pUpsertIdx==0 ){ if( pUpsert->pUpsertSet==0 ){ onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */ }else{ onError = OE_Update; /* DO UPDATE */ } } /* 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. */ assert( OE_Update>OE_Replace ); assert( OE_Ignore<OE_Replace ); assert( OE_Fail<OE_Replace ); assert( OE_Abort<OE_Replace ); assert( OE_Rollback<OE_Replace ); if( onError>=OE_Replace && (pUpsert || onError!=overrideError) && pTab->pIndex ){ sAddr.ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1; } if( isUpdate ){ /* pkChng!=0 does not mean that the rowid has changed, only that ** it might have changed. Skip the conflict logic below if the rowid ** is unchanged. */ sqlite3VdbeAddOp3(v, OP_Eq, regNewData, addrRowidOk, regOldData); sqlite3VdbeChangeP5(v, SQLITE_NOTNULL); VdbeCoverage(v); } /* Check to see if the new rowid already exists in the table. Skip ** the following conflict logic if it does not. */ VdbeNoopComment((v, "uniqueness check for ROWID")); sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRowidOk, regNewData); VdbeCoverage(v); switch( onError ){ default: { onError = OE_Abort; /* Fall thru into the next case */ } case OE_Rollback: case OE_Abort: case OE_Fail: { testcase( onError==OE_Rollback ); testcase( onError==OE_Abort ); testcase( onError==OE_Fail ); sqlite3RowidConstraint(pParse, onError, pTab); break; } case OE_Replace: { /* If there are DELETE triggers on this table and the ** recursive-triggers flag is set, call GenerateRowDelete() to ** remove the conflicting row from the table. This will fire |
︙ | ︙ | |||
113859 113860 113861 113862 113863 113864 113865 | } if( pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0) ){ sqlite3MultiWrite(pParse); sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur, regNewData, 1, 0, OE_Replace, 1, -1); }else{ #ifdef SQLITE_ENABLE_PREUPDATE_HOOK | | | | | | | | < > > > > > > < > | | | > > > > > > > > > | | 114183 114184 114185 114186 114187 114188 114189 114190 114191 114192 114193 114194 114195 114196 114197 114198 114199 114200 114201 114202 114203 114204 114205 114206 114207 114208 114209 114210 114211 114212 114213 114214 114215 114216 114217 114218 114219 114220 114221 114222 114223 114224 114225 114226 114227 114228 114229 114230 114231 114232 114233 114234 114235 114236 114237 114238 114239 114240 114241 114242 114243 114244 114245 114246 114247 114248 114249 114250 114251 114252 114253 114254 114255 114256 114257 114258 114259 114260 | } if( pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0) ){ sqlite3MultiWrite(pParse); sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur, regNewData, 1, 0, OE_Replace, 1, -1); }else{ #ifdef SQLITE_ENABLE_PREUPDATE_HOOK assert( HasRowid(pTab) ); /* This OP_Delete opcode fires the pre-update-hook only. It does ** not modify the b-tree. It is more efficient to let the coming ** OP_Insert replace the existing entry than it is to delete the ** existing entry and then insert a new one. */ sqlite3VdbeAddOp2(v, OP_Delete, iDataCur, OPFLAG_ISNOOP); sqlite3VdbeAppendP4(v, pTab, P4_TABLE); #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */ if( pTab->pIndex ){ sqlite3MultiWrite(pParse); sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,-1); } } seenReplace = 1; break; } #ifndef SQLITE_OMIT_UPSERT case OE_Update: { sqlite3UpsertDoUpdate(pParse, pUpsert, pTab, 0, iDataCur); /* Fall through */ } #endif case OE_Ignore: { testcase( onError==OE_Ignore ); sqlite3VdbeGoto(v, ignoreDest); break; } } sqlite3VdbeResolveLabel(v, addrRowidOk); if( sAddr.ipkTop ){ sAddr.ipkBtm = sqlite3VdbeAddOp0(v, OP_Goto); sqlite3VdbeJumpHere(v, sAddr.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(ix=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, 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 */ if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */ if( pUpIdx==pIdx ){ addrUniqueOk = sAddr.upsertBtm; upsertBypass = sqlite3VdbeGoto(v, 0); VdbeComment((v, "Skip upsert subroutine")); sqlite3VdbeResolveLabel(v, sAddr.upsertTop2); }else{ addrUniqueOk = sqlite3VdbeMakeLabel(v); } VdbeNoopComment((v, "uniqueness check for %s", pIdx->zName)); if( bAffinityDone==0 ){ sqlite3TableAffinity(v, pTab, regNewData+1); bAffinityDone = 1; } iThisCur = iIdxCur+ix; /* Skip partial indices for which the WHERE clause is not true */ if( pIdx->pPartIdxWhere ){ sqlite3VdbeAddOp2(v, OP_Null, 0, aRegIdx[ix]); pParse->iSelfTab = -(regNewData+1); sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, addrUniqueOk, SQLITE_JUMPIFNULL); |
︙ | ︙ | |||
113967 113968 113969 113970 113971 113972 113973 113974 113975 113976 113977 113978 113979 113980 | continue; /* pIdx is not a UNIQUE index */ } if( overrideError!=OE_Default ){ onError = overrideError; }else if( onError==OE_Default ){ onError = OE_Abort; } /* Collision detection may be omitted if all of the following are true: ** (1) The conflict resolution algorithm is REPLACE ** (2) The table is a WITHOUT ROWID table ** (3) There are no secondary indexes on the table ** (4) No delete triggers need to be fired if there is a conflict ** (5) No FK constraint counters need to be updated if a conflict occurs. | > > > > > > > > > > > > > > > > > > | 114305 114306 114307 114308 114309 114310 114311 114312 114313 114314 114315 114316 114317 114318 114319 114320 114321 114322 114323 114324 114325 114326 114327 114328 114329 114330 114331 114332 114333 114334 114335 114336 | continue; /* pIdx is not a UNIQUE index */ } 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( pUpIdx==pIdx ){ if( pUpsert->pUpsertSet==0 ){ onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */ }else{ onError = OE_Update; /* DO UPDATE */ } } /* Invoke subroutines to handle IPK replace and upsert prior to running ** the first REPLACE constraint check. */ if( onError==OE_Replace ){ testcase( sAddr.ipkTop ); testcase( sAddr.upsertTop && sqlite3VdbeLabelHasBeenResolved(v,sAddr.upsertTop) ); reorderConstraintChecks(v, &sAddr); } /* Collision detection may be omitted if all of the following are true: ** (1) The conflict resolution algorithm is REPLACE ** (2) The table is a WITHOUT ROWID table ** (3) There are no secondary indexes on the table ** (4) No delete triggers need to be fired if there is a conflict ** (5) No FK constraint counters need to be updated if a conflict occurs. |
︙ | ︙ | |||
114050 114051 114052 114053 114054 114055 114056 | } } } } /* Generate code that executes if the new index entry is not unique */ assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail | | > > > > > > > > > > > > > | > | < < < > > > > | 114406 114407 114408 114409 114410 114411 114412 114413 114414 114415 114416 114417 114418 114419 114420 114421 114422 114423 114424 114425 114426 114427 114428 114429 114430 114431 114432 114433 114434 114435 114436 114437 114438 114439 114440 114441 114442 114443 114444 114445 114446 114447 114448 114449 114450 114451 114452 114453 114454 114455 114456 114457 114458 114459 114460 114461 114462 114463 114464 114465 114466 114467 114468 | } } } } /* Generate code that executes if the new index entry is not unique */ assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail || onError==OE_Ignore || onError==OE_Replace || onError==OE_Update ); switch( onError ){ case OE_Rollback: case OE_Abort: case OE_Fail: { testcase( onError==OE_Rollback ); testcase( onError==OE_Abort ); testcase( onError==OE_Fail ); sqlite3UniqueConstraint(pParse, onError, pIdx); break; } #ifndef SQLITE_OMIT_UPSERT case OE_Update: { sqlite3UpsertDoUpdate(pParse, pUpsert, pTab, pIdx, iIdxCur+ix); /* Fall through */ } #endif case OE_Ignore: { testcase( onError==OE_Ignore ); sqlite3VdbeGoto(v, ignoreDest); break; } default: { Trigger *pTrigger = 0; assert( onError==OE_Replace ); sqlite3MultiWrite(pParse); if( db->flags&SQLITE_RecTriggers ){ pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0); } sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur, regR, nPkField, 0, OE_Replace, (pIdx==pPk ? ONEPASS_SINGLE : ONEPASS_OFF), iThisCur); seenReplace = 1; break; } } if( pUpIdx==pIdx ){ sqlite3VdbeJumpHere(v, upsertBypass); }else{ sqlite3VdbeResolveLabel(v, addrUniqueOk); } sqlite3ExprCachePop(pParse); if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField); } testcase( sAddr.ipkTop!=0 ); testcase( sAddr.upsertTop && sqlite3VdbeLabelHasBeenResolved(v,sAddr.upsertTop) ); reorderConstraintChecks(v, &sAddr); *pbMayReplace = seenReplace; VdbeModuleComment((v, "END: GenCnstCks(%d)", seenReplace)); } #ifdef SQLITE_ENABLE_NULL_TRIM /* |
︙ | ︙ | |||
119509 119510 119511 119512 119513 119514 119515 119516 119517 119518 119519 119520 119521 119522 | Db *pDb; char const *azArg[4]; int meta[5]; InitData initData; const char *zMasterName; int openedTransaction = 0; assert( iDb>=0 && iDb<db->nDb ); assert( db->aDb[iDb].pSchema ); assert( sqlite3_mutex_held(db->mutex) ); assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) ); db->init.busy = 1; | > | 119880 119881 119882 119883 119884 119885 119886 119887 119888 119889 119890 119891 119892 119893 119894 | Db *pDb; char const *azArg[4]; int meta[5]; InitData initData; const char *zMasterName; int openedTransaction = 0; assert( (db->mDbFlags & DBFLAG_SchemaKnownOk)==0 ); assert( iDb>=0 && iDb<db->nDb ); assert( db->aDb[iDb].pSchema ); assert( sqlite3_mutex_held(db->mutex) ); assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) ); db->init.busy = 1; |
︙ | ︙ | |||
119738 119739 119740 119741 119742 119743 119744 119745 119746 119747 119748 119749 119750 119751 | /* Do the main schema first */ if( !DbHasProperty(db, 0, DB_SchemaLoaded) ){ rc = sqlite3InitOne(db, 0, pzErrMsg); if( rc ) return rc; } /* All other schemas after the main schema. The "temp" schema must be last */ for(i=db->nDb-1; i>0; i--){ if( !DbHasProperty(db, i, DB_SchemaLoaded) ){ rc = sqlite3InitOne(db, i, pzErrMsg); if( rc ) return rc; } } if( commit_internal ){ sqlite3CommitInternalChanges(db); | > | 120110 120111 120112 120113 120114 120115 120116 120117 120118 120119 120120 120121 120122 120123 120124 | /* Do the main schema first */ if( !DbHasProperty(db, 0, DB_SchemaLoaded) ){ rc = sqlite3InitOne(db, 0, pzErrMsg); if( rc ) return rc; } /* All other schemas after the main schema. The "temp" schema must be last */ for(i=db->nDb-1; i>0; i--){ assert( i==1 || sqlite3BtreeHoldsMutex(db->aDb[i].pBt) ); if( !DbHasProperty(db, i, DB_SchemaLoaded) ){ rc = sqlite3InitOne(db, i, pzErrMsg); if( rc ) return rc; } } if( commit_internal ){ sqlite3CommitInternalChanges(db); |
︙ | ︙ | |||
119759 119760 119761 119762 119763 119764 119765 | */ SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse){ int rc = SQLITE_OK; sqlite3 *db = pParse->db; assert( sqlite3_mutex_held(db->mutex) ); if( !db->init.busy ){ rc = sqlite3Init(db, &pParse->zErrMsg); | < | | | > > > | 120132 120133 120134 120135 120136 120137 120138 120139 120140 120141 120142 120143 120144 120145 120146 120147 120148 120149 120150 120151 | */ SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse){ int rc = SQLITE_OK; sqlite3 *db = pParse->db; assert( sqlite3_mutex_held(db->mutex) ); if( !db->init.busy ){ rc = sqlite3Init(db, &pParse->zErrMsg); if( rc!=SQLITE_OK ){ pParse->rc = rc; pParse->nErr++; }else if( db->noSharedCache ){ db->mDbFlags |= DBFLAG_SchemaKnownOk; } } return rc; } /* ** Check schema cookies in all databases. If any cookie is out |
︙ | ︙ | |||
120287 120288 120289 120290 120291 120292 120293 | /* ** Trace output macros */ #if SELECTTRACE_ENABLED /***/ int sqlite3SelectTrace = 0; # define SELECTTRACE(K,P,S,X) \ if(sqlite3SelectTrace&(K)) \ | | | 120662 120663 120664 120665 120666 120667 120668 120669 120670 120671 120672 120673 120674 120675 120676 | /* ** Trace output macros */ #if SELECTTRACE_ENABLED /***/ int sqlite3SelectTrace = 0; # define SELECTTRACE(K,P,S,X) \ if(sqlite3SelectTrace&(K)) \ sqlite3DebugPrintf("%s/%d/%p: ",(S)->zSelName,(P)->iSelectId,(S)),\ sqlite3DebugPrintf X #else # define SELECTTRACE(K,P,S,X) #endif /* |
︙ | ︙ | |||
120310 120311 120312 120313 120314 120315 120316 120317 120318 120319 120320 120321 120322 120323 120324 120325 120326 120327 120328 120329 120330 120331 120332 120333 120334 120335 | int tabTnct; /* Ephemeral table used for DISTINCT processing */ int addrTnct; /* Address of OP_OpenEphemeral opcode for tabTnct */ }; /* ** An instance of the following object is used to record information about ** the ORDER BY (or GROUP BY) clause of query is being coded. */ typedef struct SortCtx SortCtx; struct SortCtx { ExprList *pOrderBy; /* The ORDER BY (or GROUP BY clause) */ int nOBSat; /* Number of ORDER BY terms satisfied by indices */ int iECursor; /* Cursor number for the sorter */ int regReturn; /* Register holding block-output return address */ int labelBkOut; /* Start label for the block-output subroutine */ int addrSortIndex; /* Address of the OP_SorterOpen or OP_OpenEphemeral */ int labelDone; /* Jump here when done, ex: LIMIT reached */ u8 sortFlags; /* Zero or more SORTFLAG_* bits */ u8 bOrderedInnerLoop; /* ORDER BY correctly sorts the inner loop */ }; #define SORTFLAG_UseSorter 0x01 /* Use SorterOpen instead of OpenEphemeral */ /* ** Delete all the content of a Select structure. Deallocate the structure ** itself only if bFree is true. */ | > > > > > > > > > > > > > > > > > > > > > > | 120685 120686 120687 120688 120689 120690 120691 120692 120693 120694 120695 120696 120697 120698 120699 120700 120701 120702 120703 120704 120705 120706 120707 120708 120709 120710 120711 120712 120713 120714 120715 120716 120717 120718 120719 120720 120721 120722 120723 120724 120725 120726 120727 120728 120729 120730 120731 120732 | int tabTnct; /* Ephemeral table used for DISTINCT processing */ int addrTnct; /* Address of OP_OpenEphemeral opcode for tabTnct */ }; /* ** An instance of the following object is used to record information about ** the ORDER BY (or GROUP BY) clause of query is being coded. ** ** The aDefer[] array is used by the sorter-references optimization. For ** example, assuming there is no index that can be used for the ORDER BY, ** for the query: ** ** SELECT a, bigblob FROM t1 ORDER BY a LIMIT 10; ** ** it may be more efficient to add just the "a" values to the sorter, and ** retrieve the associated "bigblob" values directly from table t1 as the ** 10 smallest "a" values are extracted from the sorter. ** ** When the sorter-reference optimization is used, there is one entry in the ** aDefer[] array for each database table that may be read as values are ** extracted from the sorter. */ typedef struct SortCtx SortCtx; struct SortCtx { ExprList *pOrderBy; /* The ORDER BY (or GROUP BY clause) */ int nOBSat; /* Number of ORDER BY terms satisfied by indices */ int iECursor; /* Cursor number for the sorter */ int regReturn; /* Register holding block-output return address */ int labelBkOut; /* Start label for the block-output subroutine */ int addrSortIndex; /* Address of the OP_SorterOpen or OP_OpenEphemeral */ int labelDone; /* Jump here when done, ex: LIMIT reached */ u8 sortFlags; /* Zero or more SORTFLAG_* bits */ u8 bOrderedInnerLoop; /* ORDER BY correctly sorts the inner loop */ #ifdef SQLITE_ENABLE_SORTER_REFERENCES u8 nDefer; /* Number of valid entries in aDefer[] */ struct DeferredCsr { Table *pTab; /* Table definition */ int iCsr; /* Cursor number for table */ int nKey; /* Number of PK columns for table pTab (>=1) */ } aDefer[4]; #endif }; #define SORTFLAG_UseSorter 0x01 /* Use SorterOpen instead of OpenEphemeral */ /* ** Delete all the content of a Select structure. Deallocate the structure ** itself only if bFree is true. */ |
︙ | ︙ | |||
120944 120945 120946 120947 120948 120949 120950 120951 120952 120953 120954 120955 120956 120957 | sqlite3VdbeAddOp4Int(v, OP_Found, iTab, addrRepeat, iMem, N); VdbeCoverage(v); sqlite3VdbeAddOp3(v, OP_MakeRecord, iMem, N, r1); sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r1, iMem, N); sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); sqlite3ReleaseTempReg(pParse, r1); } /* ** This routine generates the code for the inside of the inner loop ** of a SELECT. ** ** If srcTab is negative, then the p->pEList expressions ** are evaluated in order to get the data for this row. If srcTab is ** zero or more, then data is pulled from srcTab and p->pEList is used only | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 121341 121342 121343 121344 121345 121346 121347 121348 121349 121350 121351 121352 121353 121354 121355 121356 121357 121358 121359 121360 121361 121362 121363 121364 121365 121366 121367 121368 121369 121370 121371 121372 121373 121374 121375 121376 121377 121378 121379 121380 121381 121382 121383 121384 121385 121386 121387 121388 121389 121390 121391 121392 121393 121394 121395 121396 121397 121398 121399 121400 121401 121402 121403 121404 121405 121406 121407 121408 121409 121410 121411 121412 121413 121414 121415 121416 121417 121418 121419 121420 121421 121422 121423 121424 121425 121426 121427 121428 121429 121430 121431 121432 121433 121434 121435 121436 121437 121438 | sqlite3VdbeAddOp4Int(v, OP_Found, iTab, addrRepeat, iMem, N); VdbeCoverage(v); sqlite3VdbeAddOp3(v, OP_MakeRecord, iMem, N, r1); sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r1, iMem, N); sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); sqlite3ReleaseTempReg(pParse, r1); } #ifdef SQLITE_ENABLE_SORTER_REFERENCES /* ** This function is called as part of inner-loop generation for a SELECT ** statement with an ORDER BY that is not optimized by an index. It ** determines the expressions, if any, that the sorter-reference ** optimization should be used for. The sorter-reference optimization ** is used for SELECT queries like: ** ** SELECT a, bigblob FROM t1 ORDER BY a LIMIT 10 ** ** If the optimization is used for expression "bigblob", then instead of ** storing values read from that column in the sorter records, the PK of ** the row from table t1 is stored instead. Then, as records are extracted from ** the sorter to return to the user, the required value of bigblob is ** retrieved directly from table t1. If the values are very large, this ** can be more efficient than storing them directly in the sorter records. ** ** The ExprList_item.bSorterRef flag is set for each expression in pEList ** for which the sorter-reference optimization should be enabled. ** Additionally, the pSort->aDefer[] array is populated with entries ** for all cursors required to evaluate all selected expressions. Finally. ** output variable (*ppExtra) is set to an expression list containing ** expressions for all extra PK values that should be stored in the ** sorter records. */ static void selectExprDefer( Parse *pParse, /* Leave any error here */ SortCtx *pSort, /* Sorter context */ ExprList *pEList, /* Expressions destined for sorter */ ExprList **ppExtra /* Expressions to append to sorter record */ ){ int i; int nDefer = 0; ExprList *pExtra = 0; for(i=0; i<pEList->nExpr; i++){ struct ExprList_item *pItem = &pEList->a[i]; if( pItem->u.x.iOrderByCol==0 ){ Expr *pExpr = pItem->pExpr; Table *pTab = pExpr->pTab; if( pExpr->op==TK_COLUMN && pTab && !IsVirtual(pTab) && (pTab->aCol[pExpr->iColumn].colFlags & COLFLAG_SORTERREF) #if 0 && pTab->pSchema && pTab->pSelect==0 && !IsVirtual(pTab) #endif ){ int j; for(j=0; j<nDefer; j++){ if( pSort->aDefer[j].iCsr==pExpr->iTable ) break; } if( j==nDefer ){ if( nDefer==ArraySize(pSort->aDefer) ){ continue; }else{ int nKey = 1; int k; Index *pPk = 0; if( !HasRowid(pTab) ){ pPk = sqlite3PrimaryKeyIndex(pTab); nKey = pPk->nKeyCol; } for(k=0; k<nKey; k++){ Expr *pNew = sqlite3PExpr(pParse, TK_COLUMN, 0, 0); if( pNew ){ pNew->iTable = pExpr->iTable; pNew->pTab = pExpr->pTab; pNew->iColumn = pPk ? pPk->aiColumn[k] : -1; pExtra = sqlite3ExprListAppend(pParse, pExtra, pNew); } } pSort->aDefer[nDefer].pTab = pExpr->pTab; pSort->aDefer[nDefer].iCsr = pExpr->iTable; pSort->aDefer[nDefer].nKey = nKey; nDefer++; } } pItem->bSorterRef = 1; } } } pSort->nDefer = (u8)nDefer; *ppExtra = pExtra; } #endif /* ** This routine generates the code for the inside of the inner loop ** of a SELECT. ** ** If srcTab is negative, then the p->pEList expressions ** are evaluated in order to get the data for this row. If srcTab is ** zero or more, then data is pulled from srcTab and p->pEList is used only |
︙ | ︙ | |||
121016 121017 121018 121019 121020 121021 121022 121023 121024 121025 121026 121027 121028 121029 | regOrig = regResult = pDest->iSdst; if( srcTab>=0 ){ for(i=0; i<nResultCol; i++){ sqlite3VdbeAddOp3(v, OP_Column, srcTab, i, regResult+i); VdbeComment((v, "%s", p->pEList->a[i].zName)); } }else if( eDest!=SRT_Exists ){ /* If the destination is an EXISTS(...) expression, the actual ** values returned by the SELECT are not required. */ u8 ecelFlags; if( eDest==SRT_Mem || eDest==SRT_Output || eDest==SRT_Coroutine ){ ecelFlags = SQLITE_ECEL_DUP; }else{ | > > > | 121497 121498 121499 121500 121501 121502 121503 121504 121505 121506 121507 121508 121509 121510 121511 121512 121513 | regOrig = regResult = pDest->iSdst; if( srcTab>=0 ){ for(i=0; i<nResultCol; i++){ sqlite3VdbeAddOp3(v, OP_Column, srcTab, i, regResult+i); VdbeComment((v, "%s", p->pEList->a[i].zName)); } }else if( eDest!=SRT_Exists ){ #ifdef SQLITE_ENABLE_SORTER_REFERENCES ExprList *pExtra = 0; #endif /* If the destination is an EXISTS(...) expression, the actual ** values returned by the SELECT are not required. */ u8 ecelFlags; if( eDest==SRT_Mem || eDest==SRT_Output || eDest==SRT_Coroutine ){ ecelFlags = SQLITE_ECEL_DUP; }else{ |
︙ | ︙ | |||
121039 121040 121041 121042 121043 121044 121045 121046 121047 121048 121049 121050 121051 121052 121053 121054 121055 121056 121057 121058 | ecelFlags |= (SQLITE_ECEL_OMITREF|SQLITE_ECEL_REF); for(i=pSort->nOBSat; i<pSort->pOrderBy->nExpr; i++){ int j; if( (j = pSort->pOrderBy->a[i].u.x.iOrderByCol)>0 ){ p->pEList->a[j-1].u.x.iOrderByCol = i+1-pSort->nOBSat; } } regOrig = 0; assert( eDest==SRT_Set || eDest==SRT_Mem || eDest==SRT_Coroutine || eDest==SRT_Output ); } nResultCol = sqlite3ExprCodeExprList(pParse,p->pEList,regResult, 0,ecelFlags); } /* If the DISTINCT keyword was present on the SELECT statement ** and this row has been seen before, then do not make this row ** part of the result. */ if( hasDistinct ){ | > > > > > > > > > > > > > > > > > > > > > > | 121523 121524 121525 121526 121527 121528 121529 121530 121531 121532 121533 121534 121535 121536 121537 121538 121539 121540 121541 121542 121543 121544 121545 121546 121547 121548 121549 121550 121551 121552 121553 121554 121555 121556 121557 121558 121559 121560 121561 121562 121563 121564 | ecelFlags |= (SQLITE_ECEL_OMITREF|SQLITE_ECEL_REF); for(i=pSort->nOBSat; i<pSort->pOrderBy->nExpr; i++){ int j; if( (j = pSort->pOrderBy->a[i].u.x.iOrderByCol)>0 ){ p->pEList->a[j-1].u.x.iOrderByCol = i+1-pSort->nOBSat; } } #ifdef SQLITE_ENABLE_SORTER_REFERENCES selectExprDefer(pParse, pSort, p->pEList, &pExtra); if( pExtra && pParse->db->mallocFailed==0 ){ /* If there are any extra PK columns to add to the sorter records, ** allocate extra memory cells and adjust the OpenEphemeral ** instruction to account for the larger records. This is only ** required if there are one or more WITHOUT ROWID tables with ** composite primary keys in the SortCtx.aDefer[] array. */ VdbeOp *pOp = sqlite3VdbeGetOp(v, pSort->addrSortIndex); pOp->p2 += (pExtra->nExpr - pSort->nDefer); pOp->p4.pKeyInfo->nAllField += (pExtra->nExpr - pSort->nDefer); pParse->nMem += pExtra->nExpr; } #endif regOrig = 0; assert( eDest==SRT_Set || eDest==SRT_Mem || eDest==SRT_Coroutine || eDest==SRT_Output ); } nResultCol = sqlite3ExprCodeExprList(pParse,p->pEList,regResult, 0,ecelFlags); #ifdef SQLITE_ENABLE_SORTER_REFERENCES if( pExtra ){ nResultCol += sqlite3ExprCodeExprList( pParse, pExtra, regResult + nResultCol, 0, 0 ); sqlite3ExprListDelete(pParse->db, pExtra); } #endif } /* If the DISTINCT keyword was present on the SELECT statement ** and this row has been seen before, then do not make this row ** part of the result. */ if( hasDistinct ){ |
︙ | ︙ | |||
121502 121503 121504 121505 121506 121507 121508 | SortCtx *pSort, /* Information on the ORDER BY clause */ int nColumn, /* Number of columns of data */ SelectDest *pDest /* Write the sorted results here */ ){ Vdbe *v = pParse->pVdbe; /* The prepared statement */ int addrBreak = pSort->labelDone; /* Jump here to exit loop */ int addrContinue = sqlite3VdbeMakeLabel(v); /* Jump here for next cycle */ | | | < > > > > > > > > > > > > < < | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > | | | | | | | | > | 122008 122009 122010 122011 122012 122013 122014 122015 122016 122017 122018 122019 122020 122021 122022 122023 122024 122025 122026 122027 122028 122029 122030 122031 122032 122033 122034 122035 122036 122037 122038 122039 122040 122041 122042 122043 122044 122045 122046 122047 122048 122049 122050 122051 122052 122053 122054 122055 122056 122057 122058 122059 122060 122061 122062 122063 122064 122065 122066 122067 122068 122069 122070 122071 122072 122073 122074 122075 122076 122077 122078 122079 122080 122081 122082 122083 122084 122085 122086 122087 122088 122089 122090 122091 122092 122093 122094 122095 122096 122097 122098 122099 122100 122101 122102 122103 122104 122105 122106 122107 122108 122109 122110 122111 122112 122113 122114 122115 122116 122117 122118 122119 122120 122121 122122 122123 122124 122125 122126 122127 122128 122129 122130 122131 122132 122133 122134 122135 122136 | SortCtx *pSort, /* Information on the ORDER BY clause */ int nColumn, /* Number of columns of data */ SelectDest *pDest /* Write the sorted results here */ ){ Vdbe *v = pParse->pVdbe; /* The prepared statement */ int addrBreak = pSort->labelDone; /* Jump here to exit loop */ int addrContinue = sqlite3VdbeMakeLabel(v); /* Jump here for next cycle */ int addr; /* Top of output loop. Jump for Next. */ int addrOnce = 0; int iTab; ExprList *pOrderBy = pSort->pOrderBy; int eDest = pDest->eDest; int iParm = pDest->iSDParm; int regRow; int regRowid; int iCol; int nKey; /* Number of key columns in sorter record */ int iSortTab; /* Sorter cursor to read from */ int i; int bSeq; /* True if sorter record includes seq. no. */ int nRefKey = 0; struct ExprList_item *aOutEx = p->pEList->a; assert( addrBreak<0 ); if( pSort->labelBkOut ){ sqlite3VdbeAddOp2(v, OP_Gosub, pSort->regReturn, pSort->labelBkOut); sqlite3VdbeGoto(v, addrBreak); sqlite3VdbeResolveLabel(v, pSort->labelBkOut); } #ifdef SQLITE_ENABLE_SORTER_REFERENCES /* Open any cursors needed for sorter-reference expressions */ for(i=0; i<pSort->nDefer; i++){ Table *pTab = pSort->aDefer[i].pTab; int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); sqlite3OpenTable(pParse, pSort->aDefer[i].iCsr, iDb, pTab, OP_OpenRead); nRefKey = MAX(nRefKey, pSort->aDefer[i].nKey); } #endif iTab = pSort->iECursor; if( eDest==SRT_Output || eDest==SRT_Coroutine || eDest==SRT_Mem ){ regRowid = 0; regRow = pDest->iSdst; }else{ regRowid = sqlite3GetTempReg(pParse); regRow = sqlite3GetTempRange(pParse, nColumn); } nKey = pOrderBy->nExpr - pSort->nOBSat; if( pSort->sortFlags & SORTFLAG_UseSorter ){ int regSortOut = ++pParse->nMem; iSortTab = pParse->nTab++; if( pSort->labelBkOut ){ addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); } sqlite3VdbeAddOp3(v, OP_OpenPseudo, iSortTab, regSortOut, nKey+1+nColumn+nRefKey); if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce); addr = 1 + sqlite3VdbeAddOp2(v, OP_SorterSort, iTab, addrBreak); VdbeCoverage(v); codeOffset(v, p->iOffset, addrContinue); sqlite3VdbeAddOp3(v, OP_SorterData, iTab, regSortOut, iSortTab); bSeq = 0; }else{ addr = 1 + sqlite3VdbeAddOp2(v, OP_Sort, iTab, addrBreak); VdbeCoverage(v); codeOffset(v, p->iOffset, addrContinue); iSortTab = iTab; bSeq = 1; } for(i=0, iCol=nKey+bSeq-1; i<nColumn; i++){ #ifdef SQLITE_ENABLE_SORTER_REFERENCES if( aOutEx[i].bSorterRef ) continue; #endif if( aOutEx[i].u.x.iOrderByCol==0 ) iCol++; } #ifdef SQLITE_ENABLE_SORTER_REFERENCES if( pSort->nDefer ){ int iKey = iCol+1; int regKey = sqlite3GetTempRange(pParse, nRefKey); for(i=0; i<pSort->nDefer; i++){ int iCsr = pSort->aDefer[i].iCsr; Table *pTab = pSort->aDefer[i].pTab; int nKey = pSort->aDefer[i].nKey; sqlite3VdbeAddOp1(v, OP_NullRow, iCsr); if( HasRowid(pTab) ){ sqlite3VdbeAddOp3(v, OP_Column, iSortTab, iKey++, regKey); sqlite3VdbeAddOp3(v, OP_SeekRowid, iCsr, sqlite3VdbeCurrentAddr(v)+1, regKey); }else{ int k; int iJmp; assert( sqlite3PrimaryKeyIndex(pTab)->nKeyCol==nKey ); for(k=0; k<nKey; k++){ sqlite3VdbeAddOp3(v, OP_Column, iSortTab, iKey++, regKey+k); } iJmp = sqlite3VdbeCurrentAddr(v); sqlite3VdbeAddOp4Int(v, OP_SeekGE, iCsr, iJmp+2, regKey, nKey); sqlite3VdbeAddOp4Int(v, OP_IdxLE, iCsr, iJmp+3, regKey, nKey); sqlite3VdbeAddOp1(v, OP_NullRow, iCsr); } } sqlite3ReleaseTempRange(pParse, regKey, nRefKey); } #endif for(i=nColumn-1; i>=0; i--){ #ifdef SQLITE_ENABLE_SORTER_REFERENCES if( aOutEx[i].bSorterRef ){ sqlite3ExprCode(pParse, aOutEx[i].pExpr, regRow+i); }else #endif { int iRead; if( aOutEx[i].u.x.iOrderByCol ){ iRead = aOutEx[i].u.x.iOrderByCol-1; }else{ iRead = iCol--; } sqlite3VdbeAddOp3(v, OP_Column, iSortTab, iRead, regRow+i); VdbeComment((v, "%s", aOutEx[i].zName?aOutEx[i].zName : aOutEx[i].zSpan)); } } switch( eDest ){ case SRT_Table: case SRT_EphemTab: { sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, regRowid); sqlite3VdbeAddOp3(v, OP_Insert, iParm, regRow, regRowid); sqlite3VdbeChangeP5(v, OPFLAG_APPEND); |
︙ | ︙ | |||
123903 123904 123905 123906 123907 123908 123909 | if( pNew==0 ){ p->pPrior = pPrior; }else{ pNew->pPrior = pPrior; if( pPrior ) pPrior->pNext = pNew; pNew->pNext = p; p->pPrior = pNew; | | < | | 124460 124461 124462 124463 124464 124465 124466 124467 124468 124469 124470 124471 124472 124473 124474 124475 | if( pNew==0 ){ p->pPrior = pPrior; }else{ pNew->pPrior = pPrior; if( pPrior ) pPrior->pNext = pNew; pNew->pNext = p; p->pPrior = pNew; SELECTTRACE(2,pParse,p,("compound-subquery flattener" " creates %s.%p as peer\n",pNew->zSelName, pNew)); } if( db->mallocFailed ) return 1; } /* Begin flattening the iFrom-th entry of the FROM clause ** in the outer query. */ |
︙ | ︙ | |||
125437 125438 125439 125440 125441 125442 125443 | db = pParse->db; if( p==0 || db->mallocFailed || pParse->nErr ){ return 1; } if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1; memset(&sAggInfo, 0, sizeof(sAggInfo)); #if SELECTTRACE_ENABLED | > > > | | 125993 125994 125995 125996 125997 125998 125999 126000 126001 126002 126003 126004 126005 126006 126007 126008 126009 126010 | db = pParse->db; if( p==0 || db->mallocFailed || pParse->nErr ){ return 1; } if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1; memset(&sAggInfo, 0, sizeof(sAggInfo)); #if SELECTTRACE_ENABLED #ifndef SQLITE_OMIT_EXPLAIN p->iSelectId = pParse->iSelectId; #endif SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->iSelectId)); if( sqlite3SelectTrace & 0x100 ){ sqlite3TreeViewSelect(0, p, 0); } #endif assert( p->pOrderBy==0 || pDest->eDest!=SRT_DistFifo ); assert( p->pOrderBy==0 || pDest->eDest!=SRT_Fifo ); |
︙ | ︙ | |||
125468 125469 125470 125471 125472 125473 125474 | pTabList = p->pSrc; if( pParse->nErr || db->mallocFailed ){ goto select_end; } assert( p->pEList!=0 ); isAgg = (p->selFlags & SF_Aggregate)!=0; #if SELECTTRACE_ENABLED | | | | 126027 126028 126029 126030 126031 126032 126033 126034 126035 126036 126037 126038 126039 126040 126041 126042 | pTabList = p->pSrc; if( pParse->nErr || db->mallocFailed ){ goto select_end; } assert( p->pEList!=0 ); isAgg = (p->selFlags & SF_Aggregate)!=0; #if SELECTTRACE_ENABLED if( sqlite3SelectTrace & 0x104 ){ SELECTTRACE(0x104,pParse,p, ("after name resolution:\n")); sqlite3TreeViewSelect(0, p, 0); } #endif /* Get a pointer the VDBE under construction, allocating a new VDBE if one ** does not already exist */ v = sqlite3GetVdbe(pParse); |
︙ | ︙ | |||
125570 125571 125572 125573 125574 125575 125576 | #ifndef SQLITE_OMIT_COMPOUND_SELECT /* Handle compound SELECT statements using the separate multiSelect() ** procedure. */ if( p->pPrior ){ rc = multiSelect(pParse, p, pDest); | < | > > > > | 126129 126130 126131 126132 126133 126134 126135 126136 126137 126138 126139 126140 126141 126142 126143 126144 126145 126146 126147 126148 126149 | #ifndef SQLITE_OMIT_COMPOUND_SELECT /* 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( pParse->iSelectId==0 && (sqlite3SelectTrace & 0x2000)!=0 ){ sqlite3TreeViewSelect(0, p, 0); } #endif explainSetInteger(pParse->iSelectId, iRestoreSelectId); return rc; } #endif /* For each term in the FROM clause, do two things: ** (1) Authorized unreferenced tables ** (2) Generate code for all sub-queries |
︙ | ︙ | |||
125952 125953 125954 125955 125956 125957 125958 | /* Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in ** sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the ** SELECT statement. */ memset(&sNC, 0, sizeof(sNC)); sNC.pParse = pParse; sNC.pSrcList = pTabList; | | > | 126514 126515 126516 126517 126518 126519 126520 126521 126522 126523 126524 126525 126526 126527 126528 126529 | /* Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in ** sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the ** SELECT statement. */ memset(&sNC, 0, sizeof(sNC)); sNC.pParse = pParse; sNC.pSrcList = pTabList; sNC.uNC.pAggInfo = &sAggInfo; VVA_ONLY( sNC.ncFlags = NC_UAggInfo; ) sAggInfo.mnReg = pParse->nMem+1; sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr : 0; sAggInfo.pGroupBy = pGroupBy; sqlite3ExprAnalyzeAggList(&sNC, pEList); sqlite3ExprAnalyzeAggList(&sNC, sSort.pOrderBy); if( pHaving ){ if( pGroupBy ){ |
︙ | ︙ | |||
126341 126342 126343 126344 126345 126346 126347 126348 126349 126350 126351 126352 126353 126354 126355 126356 126357 126358 126359 126360 126361 126362 | /* If there is an ORDER BY clause, then we need to sort the results ** and send them to the callback one by one. */ if( sSort.pOrderBy ){ explainTempTable(pParse, sSort.nOBSat>0 ? "RIGHT PART OF ORDER BY":"ORDER BY"); generateSortTail(pParse, p, &sSort, pEList->nExpr, pDest); } /* Jump here to skip this query */ sqlite3VdbeResolveLabel(v, iEnd); /* The SELECT has been coded. If there is an error in the Parse structure, ** set the return code to 1. Otherwise 0. */ rc = (pParse->nErr>0); /* Control jumps to here if an error is encountered above, or upon ** successful coding of the SELECT. */ select_end: | > < | > > > > | 126904 126905 126906 126907 126908 126909 126910 126911 126912 126913 126914 126915 126916 126917 126918 126919 126920 126921 126922 126923 126924 126925 126926 126927 126928 126929 126930 126931 126932 126933 126934 126935 126936 126937 126938 126939 126940 126941 126942 126943 | /* If there is an ORDER BY clause, then we need to sort the results ** and send them to the callback one by one. */ if( sSort.pOrderBy ){ explainTempTable(pParse, sSort.nOBSat>0 ? "RIGHT PART OF ORDER BY":"ORDER BY"); assert( p->pEList==pEList ); generateSortTail(pParse, p, &sSort, pEList->nExpr, pDest); } /* Jump here to skip this query */ sqlite3VdbeResolveLabel(v, iEnd); /* The SELECT has been coded. If there is an error in the Parse structure, ** set the return code to 1. Otherwise 0. */ rc = (pParse->nErr>0); /* Control jumps to here if an error is encountered above, or upon ** successful coding of the SELECT. */ select_end: sqlite3ExprListDelete(db, pMinMaxOrderBy); sqlite3DbFree(db, sAggInfo.aCol); sqlite3DbFree(db, sAggInfo.aFunc); #if SELECTTRACE_ENABLED SELECTTRACE(0x1,pParse,p,("end processing\n")); if( pParse->iSelectId==0 && (sqlite3SelectTrace & 0x2000)!=0 ){ sqlite3TreeViewSelect(0, p, 0); } #endif explainSetInteger(pParse->iSelectId, iRestoreSelectId); return rc; } /************** End of select.c **********************************************/ /************** Begin file table.c *******************************************/ /* ** 2001 September 15 |
︙ | ︙ | |||
126596 126597 126598 126599 126600 126601 126602 126603 126604 126605 126606 126607 126608 126609 | TriggerStep * pTmp = pTriggerStep; pTriggerStep = pTriggerStep->pNext; sqlite3ExprDelete(db, pTmp->pWhere); sqlite3ExprListDelete(db, pTmp->pExprList); sqlite3SelectDelete(db, pTmp->pSelect); sqlite3IdListDelete(db, pTmp->pIdList); sqlite3DbFree(db, pTmp->zSpan); sqlite3DbFree(db, pTmp); } } /* | > | 127163 127164 127165 127166 127167 127168 127169 127170 127171 127172 127173 127174 127175 127176 127177 | TriggerStep * pTmp = pTriggerStep; pTriggerStep = pTriggerStep->pNext; sqlite3ExprDelete(db, pTmp->pWhere); sqlite3ExprListDelete(db, pTmp->pExprList); sqlite3SelectDelete(db, pTmp->pSelect); sqlite3IdListDelete(db, pTmp->pIdList); sqlite3UpsertDelete(db, pTmp->pUpsert); sqlite3DbFree(db, pTmp->zSpan); sqlite3DbFree(db, pTmp); } } /* |
︙ | ︙ | |||
126987 126988 126989 126990 126991 126992 126993 126994 126995 126996 126997 126998 126999 127000 127001 127002 127003 127004 127005 127006 127007 127008 127009 127010 127011 127012 127013 127014 | */ SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep( sqlite3 *db, /* The database connection */ Token *pTableName, /* Name of the table into which we insert */ IdList *pColumn, /* List of columns in pTableName to insert into */ Select *pSelect, /* A SELECT statement that supplies values */ u8 orconf, /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */ const char *zStart, /* Start of SQL text */ const char *zEnd /* End of SQL text */ ){ TriggerStep *pTriggerStep; assert(pSelect != 0 || db->mallocFailed); pTriggerStep = triggerStepAllocate(db, TK_INSERT, pTableName, zStart, zEnd); if( pTriggerStep ){ pTriggerStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); pTriggerStep->pIdList = pColumn; pTriggerStep->orconf = orconf; }else{ sqlite3IdListDelete(db, pColumn); } sqlite3SelectDelete(db, pSelect); return pTriggerStep; } /* | > > > > > | 127555 127556 127557 127558 127559 127560 127561 127562 127563 127564 127565 127566 127567 127568 127569 127570 127571 127572 127573 127574 127575 127576 127577 127578 127579 127580 127581 127582 127583 127584 127585 127586 127587 | */ SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep( sqlite3 *db, /* The database connection */ Token *pTableName, /* Name of the table into which we insert */ IdList *pColumn, /* List of columns in pTableName to insert into */ Select *pSelect, /* A SELECT statement that supplies values */ u8 orconf, /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */ Upsert *pUpsert, /* ON CONFLICT clauses for upsert */ const char *zStart, /* Start of SQL text */ const char *zEnd /* End of SQL text */ ){ TriggerStep *pTriggerStep; assert(pSelect != 0 || db->mallocFailed); pTriggerStep = triggerStepAllocate(db, TK_INSERT, pTableName, zStart, zEnd); if( pTriggerStep ){ pTriggerStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); pTriggerStep->pIdList = pColumn; pTriggerStep->pUpsert = pUpsert; pTriggerStep->orconf = orconf; }else{ testcase( pColumn ); sqlite3IdListDelete(db, pColumn); testcase( pUpsert ); sqlite3UpsertDelete(db, pUpsert); } sqlite3SelectDelete(db, pSelect); return pTriggerStep; } /* |
︙ | ︙ | |||
127317 127318 127319 127320 127321 127322 127323 | switch( pStep->op ){ case TK_UPDATE: { sqlite3Update(pParse, targetSrcList(pParse, pStep), sqlite3ExprListDup(db, pStep->pExprList, 0), sqlite3ExprDup(db, pStep->pWhere, 0), | | | > | 127890 127891 127892 127893 127894 127895 127896 127897 127898 127899 127900 127901 127902 127903 127904 127905 127906 127907 127908 127909 127910 127911 127912 127913 127914 | switch( pStep->op ){ case TK_UPDATE: { sqlite3Update(pParse, targetSrcList(pParse, pStep), sqlite3ExprListDup(db, pStep->pExprList, 0), sqlite3ExprDup(db, pStep->pWhere, 0), pParse->eOrconf, 0, 0, 0 ); break; } case TK_INSERT: { sqlite3Insert(pParse, targetSrcList(pParse, pStep), sqlite3SelectDup(db, pStep->pSelect, 0), sqlite3IdListDup(db, pStep->pIdList), pParse->eOrconf, sqlite3UpsertDup(db, pStep->pUpsert) ); break; } case TK_DELETE: { sqlite3DeleteFrom(pParse, targetSrcList(pParse, pStep), sqlite3ExprDup(db, pStep->pWhere, 0), 0, 0 |
︙ | ︙ | |||
127804 127805 127806 127807 127808 127809 127810 | SQLITE_PRIVATE void sqlite3Update( Parse *pParse, /* The parser context */ SrcList *pTabList, /* The table in which we should change things */ ExprList *pChanges, /* Things to be changed */ Expr *pWhere, /* The WHERE clause. May be null */ int onError, /* How to handle constraint errors */ ExprList *pOrderBy, /* ORDER BY clause. May be null */ | | > | 128378 128379 128380 128381 128382 128383 128384 128385 128386 128387 128388 128389 128390 128391 128392 128393 | SQLITE_PRIVATE void sqlite3Update( Parse *pParse, /* The parser context */ SrcList *pTabList, /* The table in which we should change things */ ExprList *pChanges, /* Things to be changed */ Expr *pWhere, /* The WHERE clause. May be null */ int onError, /* How to handle constraint errors */ ExprList *pOrderBy, /* ORDER BY clause. May be null */ Expr *pLimit, /* LIMIT clause. May be null */ Upsert *pUpsert /* ON CONFLICT clause, or null */ ){ int i, j; /* Loop counters */ Table *pTab; /* The table to be updated */ int addrTop = 0; /* VDBE instruction address of the start of the loop */ WhereInfo *pWInfo; /* Information about the WHERE clause */ Vdbe *v; /* The virtual database engine */ Index *pIdx; /* For looping over indices */ |
︙ | ︙ | |||
127911 127912 127913 127914 127915 127916 127917 | } /* Allocate a cursors for the main database table and for all indices. ** The index cursors might not be used, but if they are used they ** need to occur right after the database cursor. So go ahead and ** allocate enough space, just in case. */ | | > | < > > > > > > > > > | 128486 128487 128488 128489 128490 128491 128492 128493 128494 128495 128496 128497 128498 128499 128500 128501 128502 128503 128504 128505 128506 128507 128508 128509 128510 128511 128512 128513 128514 128515 128516 128517 128518 128519 128520 128521 128522 128523 128524 128525 128526 128527 128528 128529 128530 128531 128532 128533 128534 | } /* Allocate a cursors for the main database table and for all indices. ** The index cursors might not be used, but if they are used they ** need to occur right after the database cursor. So go ahead and ** allocate enough space, just in case. */ iBaseCur = iDataCur = pParse->nTab++; iIdxCur = iDataCur+1; pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab); testcase( pPk!=0 && pPk!=pTab->pIndex ); for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ if( pPk==pIdx ){ iDataCur = pParse->nTab; } pParse->nTab++; } if( pUpsert ){ /* On an UPSERT, reuse the same cursors already opened by INSERT */ iDataCur = pUpsert->iDataCur; iIdxCur = pUpsert->iIdxCur; pParse->nTab = iBaseCur; } pTabList->a[0].iCursor = iDataCur; /* Allocate space for aXRef[], aRegIdx[], and aToOpen[]. ** Initialize aXRef[] and aToOpen[] to their default values. */ aXRef = sqlite3DbMallocRawNN(db, sizeof(int) * (pTab->nCol+nIdx) + nIdx+2 ); if( aXRef==0 ) goto update_cleanup; aRegIdx = aXRef+pTab->nCol; aToOpen = (u8*)(aRegIdx+nIdx); memset(aToOpen, 1, nIdx+1); aToOpen[nIdx+1] = 0; for(i=0; i<pTab->nCol; i++) aXRef[i] = -1; /* Initialize the name-context */ memset(&sNC, 0, sizeof(sNC)); sNC.pParse = pParse; sNC.pSrcList = pTabList; sNC.uNC.pUpsert = pUpsert; sNC.ncFlags = NC_UUpsert; /* Resolve the column names in all the expressions of the ** of the UPDATE statement. Also find the column index ** for each column to be updated in the pChanges array. For each ** column to be updated, make sure we have authorization to change ** that column. */ |
︙ | ︙ | |||
128040 128041 128042 128043 128044 128045 128046 | memset(aToOpen, 1, nIdx+1); } /* Begin generating code. */ v = sqlite3GetVdbe(pParse); if( v==0 ) goto update_cleanup; if( pParse->nested==0 ) sqlite3VdbeCountChanges(v); | | | 128624 128625 128626 128627 128628 128629 128630 128631 128632 128633 128634 128635 128636 128637 128638 | memset(aToOpen, 1, nIdx+1); } /* Begin generating code. */ v = sqlite3GetVdbe(pParse); if( v==0 ) goto update_cleanup; if( pParse->nested==0 ) sqlite3VdbeCountChanges(v); sqlite3BeginWriteOperation(pParse, pTrigger || hasFK, iDb); /* Allocate required registers. */ if( !IsVirtual(pTab) ){ regRowSet = ++pParse->nMem; regOldRowid = regNewRowid = ++pParse->nMem; if( chngPk || pTrigger || hasFK ){ regOld = pParse->nMem + 1; |
︙ | ︙ | |||
128091 128092 128093 128094 128095 128096 128097 | if( IsVirtual(pTab) ){ updateVirtualTable(pParse, pTabList, pTab, pChanges, pRowidExpr, aXRef, pWhere, onError); goto update_cleanup; } #endif | > > > > | > | > > > > | < | | | | | > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | > > | | | | | | | | > > | > | | | | < | | | | | | | | | | | | | | | | | | | | | | | | | < < | | | | | | | | | | | | | | | | | | | > | | | 128675 128676 128677 128678 128679 128680 128681 128682 128683 128684 128685 128686 128687 128688 128689 128690 128691 128692 128693 128694 128695 128696 128697 128698 128699 128700 128701 128702 128703 128704 128705 128706 128707 128708 128709 128710 128711 128712 128713 128714 128715 128716 128717 128718 128719 128720 128721 128722 128723 128724 128725 128726 128727 128728 128729 128730 128731 128732 128733 128734 128735 128736 128737 128738 128739 128740 128741 128742 128743 128744 128745 128746 128747 128748 128749 128750 128751 128752 128753 128754 128755 128756 128757 128758 128759 128760 128761 128762 128763 128764 128765 128766 128767 128768 128769 128770 128771 128772 128773 128774 128775 128776 128777 128778 128779 128780 128781 128782 128783 128784 128785 128786 128787 128788 128789 128790 128791 128792 128793 128794 128795 128796 128797 128798 128799 128800 128801 128802 128803 128804 128805 128806 128807 128808 128809 128810 128811 128812 128813 128814 128815 128816 128817 128818 128819 128820 128821 128822 128823 128824 128825 128826 128827 128828 128829 128830 128831 128832 128833 128834 128835 128836 128837 128838 128839 128840 128841 128842 128843 128844 128845 128846 | if( IsVirtual(pTab) ){ updateVirtualTable(pParse, pTabList, pTab, pChanges, pRowidExpr, aXRef, pWhere, onError); goto update_cleanup; } #endif /* Jump to labelBreak to abandon further processing of this UPDATE */ labelContinue = labelBreak = sqlite3VdbeMakeLabel(v); /* Not an UPSERT. Normal processing. Begin by ** initialize the count of updated rows */ if( (db->flags&SQLITE_CountRows)!=0 && !pParse->pTriggerTab && !pParse->nested && pUpsert==0 ){ regRowCount = ++pParse->nMem; sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount); } if( HasRowid(pTab) ){ sqlite3VdbeAddOp3(v, OP_Null, 0, regRowSet, regOldRowid); }else{ assert( pPk!=0 ); nPk = pPk->nKeyCol; iPk = pParse->nMem+1; pParse->nMem += nPk; regKey = ++pParse->nMem; if( pUpsert==0 ){ iEph = pParse->nTab++; sqlite3VdbeAddOp3(v, OP_Null, 0, iPk, iPk+nPk-1); addrOpen = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iEph, nPk); sqlite3VdbeSetP4KeyInfo(pParse, pPk); } } if( pUpsert ){ /* If this is an UPSERT, then all cursors have already been opened by ** the outer INSERT and the data cursor should be pointing at the row ** that is to be updated. So bypass the code that searches for the ** row(s) to be updated. */ pWInfo = 0; eOnePass = ONEPASS_SINGLE; sqlite3ExprIfFalse(pParse, pWhere, labelBreak, SQLITE_JUMPIFNULL); }else{ /* Begin the database scan. ** ** Do not consider a single-pass strategy for a multi-row update if ** there are any triggers or foreign keys to process, or rows may ** be deleted as a result of REPLACE conflict handling. Any of these ** things might disturb a cursor being used to scan through the table ** or index, causing a single-pass approach to malfunction. */ flags = WHERE_ONEPASS_DESIRED|WHERE_SEEK_UNIQ_TABLE; if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){ flags |= WHERE_ONEPASS_MULTIROW; } pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, flags, iIdxCur); if( pWInfo==0 ) goto update_cleanup; /* A one-pass strategy that might update more than one row may not ** be used if any column of the index used for the scan is being ** updated. Otherwise, if there is an index on "b", statements like ** the following could create an infinite loop: ** ** UPDATE t1 SET b=b+1 WHERE b>? ** ** Fall back to ONEPASS_OFF if where.c has selected a ONEPASS_MULTI ** strategy that uses an index for which one or more columns are being ** updated. */ eOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass); if( eOnePass!=ONEPASS_SINGLE ){ sqlite3MultiWrite(pParse); if( eOnePass==ONEPASS_MULTI ){ int iCur = aiCurOnePass[1]; if( iCur>=0 && iCur!=iDataCur && aToOpen[iCur-iBaseCur] ){ eOnePass = ONEPASS_OFF; } assert( iCur!=iDataCur || !HasRowid(pTab) ); } } } if( HasRowid(pTab) ){ /* Read the rowid of the current row of the WHERE scan. In ONEPASS_OFF ** mode, write the rowid into the FIFO. In either of the one-pass modes, ** leave it in register regOldRowid. */ sqlite3VdbeAddOp2(v, OP_Rowid, iDataCur, regOldRowid); if( eOnePass==ONEPASS_OFF ){ sqlite3VdbeAddOp2(v, OP_RowSetAdd, regRowSet, regOldRowid); } }else{ /* Read the PK of the current row into an array of registers. In ** ONEPASS_OFF mode, serialize the array into a record and store it in ** the ephemeral table. Or, in ONEPASS_SINGLE or MULTI mode, change ** the OP_OpenEphemeral instruction to a Noop (the ephemeral table ** is not required) and leave the PK fields in the array of registers. */ for(i=0; i<nPk; i++){ assert( pPk->aiColumn[i]>=0 ); sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur,pPk->aiColumn[i],iPk+i); } if( eOnePass ){ if( addrOpen ) sqlite3VdbeChangeToNoop(v, addrOpen); nKey = nPk; regKey = iPk; }else{ sqlite3VdbeAddOp4(v, OP_MakeRecord, iPk, nPk, regKey, sqlite3IndexAffinityStr(db, pPk), nPk); sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iEph, regKey, iPk, nPk); } } if( pUpsert==0 ){ if( eOnePass!=ONEPASS_MULTI ){ sqlite3WhereEnd(pWInfo); } if( !isView ){ int addrOnce = 0; /* Open every index that needs updating. */ if( eOnePass!=ONEPASS_OFF ){ if( aiCurOnePass[0]>=0 ) aToOpen[aiCurOnePass[0]-iBaseCur] = 0; if( aiCurOnePass[1]>=0 ) aToOpen[aiCurOnePass[1]-iBaseCur] = 0; } if( eOnePass==ONEPASS_MULTI && (nIdx-(aiCurOnePass[1]>=0))>0 ){ addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); } sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, iBaseCur, aToOpen, 0, 0); if( addrOnce ) sqlite3VdbeJumpHere(v, addrOnce); } /* Top of the update loop */ if( eOnePass!=ONEPASS_OFF ){ if( !isView && aiCurOnePass[0]!=iDataCur && aiCurOnePass[1]!=iDataCur ){ assert( pPk ); sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelBreak, regKey,nKey); VdbeCoverageNeverTaken(v); } if( eOnePass!=ONEPASS_SINGLE ){ labelContinue = sqlite3VdbeMakeLabel(v); } sqlite3VdbeAddOp2(v, OP_IsNull, pPk ? regKey : regOldRowid, labelBreak); VdbeCoverageIf(v, pPk==0); VdbeCoverageIf(v, pPk!=0); }else if( pPk ){ labelContinue = sqlite3VdbeMakeLabel(v); sqlite3VdbeAddOp2(v, OP_Rewind, iEph, labelBreak); VdbeCoverage(v); addrTop = sqlite3VdbeAddOp2(v, OP_RowData, iEph, regKey); sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelContinue, regKey, 0); VdbeCoverage(v); }else{ labelContinue = sqlite3VdbeAddOp3(v, OP_RowSetRead, regRowSet,labelBreak, regOldRowid); VdbeCoverage(v); sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue, regOldRowid); VdbeCoverage(v); } } /* If the rowid value will change, set register regNewRowid to ** contain the new value. If the rowid is not being modified, ** then regNewRowid is the same register as regOldRowid, which is ** already populated. */ assert( chngKey || pTrigger || hasFK || regOldRowid==regNewRowid ); if( chngRowid ){ sqlite3ExprCode(pParse, pRowidExpr, regNewRowid); sqlite3VdbeAddOp1(v, OP_MustBeInt, regNewRowid); VdbeCoverage(v); } |
︙ | ︙ | |||
128337 128338 128339 128340 128341 128342 128343 | if( !isView ){ int addr1 = 0; /* Address of jump instruction */ /* Do constraint checks. */ assert( regOldRowid>0 ); sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur, regNewRowid, regOldRowid, chngKey, onError, labelContinue, &bReplace, | | | 128943 128944 128945 128946 128947 128948 128949 128950 128951 128952 128953 128954 128955 128956 128957 | if( !isView ){ int addr1 = 0; /* Address of jump instruction */ /* Do constraint checks. */ assert( regOldRowid>0 ); sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur, regNewRowid, regOldRowid, chngKey, onError, labelContinue, &bReplace, aXRef, 0); /* Do FK constraint checks. */ if( hasFK ){ sqlite3FkCheck(pParse, pTab, regOldRowid, 0, aXRef, chngKey); } /* Delete the index entries associated with the current record. */ |
︙ | ︙ | |||
128407 128408 128409 128410 128411 128412 128413 | if( hasFK ){ sqlite3FkActions(pParse, pTab, pChanges, regOldRowid, aXRef, chngKey); } } /* Increment the row counter */ | | | 129013 129014 129015 129016 129017 129018 129019 129020 129021 129022 129023 129024 129025 129026 129027 | if( hasFK ){ sqlite3FkActions(pParse, pTab, pChanges, regOldRowid, aXRef, chngKey); } } /* Increment the row counter */ if( regRowCount ){ sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1); } sqlite3CodeRowTrigger(pParse, pTrigger, TK_UPDATE, pChanges, TRIGGER_AFTER, pTab, regOldRowid, onError, labelContinue); /* Repeat the above with the next record to be updated, until |
︙ | ︙ | |||
128434 128435 128436 128437 128438 128439 128440 | } sqlite3VdbeResolveLabel(v, labelBreak); /* Update the sqlite_sequence table by storing the content of the ** maximum rowid counter values recorded while inserting into ** autoincrement tables. */ | | | < | | | 129040 129041 129042 129043 129044 129045 129046 129047 129048 129049 129050 129051 129052 129053 129054 129055 129056 129057 129058 129059 129060 129061 129062 | } sqlite3VdbeResolveLabel(v, labelBreak); /* Update the sqlite_sequence table by storing the content of the ** maximum rowid counter values recorded while inserting into ** autoincrement tables. */ if( pParse->nested==0 && pParse->pTriggerTab==0 && pUpsert==0 ){ sqlite3AutoincrementEnd(pParse); } /* ** Return the number of rows that were changed, if we are tracking ** that information. */ if( regRowCount ){ sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1); sqlite3VdbeSetNumCols(v, 1); sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows updated", SQLITE_STATIC); } update_cleanup: sqlite3AuthContextPop(&sContext); |
︙ | ︙ | |||
128564 128565 128566 128567 128568 128569 128570 | sqlite3VdbeAddOp2(v, OP_SCopy, regArg+2+iPk, regArg+1); } bOnePass = sqlite3WhereOkOnePass(pWInfo, aDummy); if( bOnePass ){ /* If using the onepass strategy, no-op out the OP_OpenEphemeral coded | | < < < < > | 129169 129170 129171 129172 129173 129174 129175 129176 129177 129178 129179 129180 129181 129182 129183 129184 129185 129186 129187 129188 | sqlite3VdbeAddOp2(v, OP_SCopy, regArg+2+iPk, regArg+1); } bOnePass = sqlite3WhereOkOnePass(pWInfo, aDummy); if( bOnePass ){ /* If using the onepass strategy, no-op out the OP_OpenEphemeral coded ** above. */ sqlite3VdbeChangeToNoop(v, addr); }else{ /* Create a record from the argument register contents and insert it into ** the ephemeral table. */ sqlite3MultiWrite(pParse); sqlite3VdbeAddOp3(v, OP_MakeRecord, regArg, nArg, regRec); #ifdef SQLITE_DEBUG /* Signal an assert() within OP_MakeRecord that it is allowed to ** accept no-change records with serial_type 10 */ sqlite3VdbeChangeP5(v, OPFLAG_NOCHNG_MAGIC); #endif sqlite3VdbeAddOp2(v, OP_NewRowid, ephemTab, regRowid); |
︙ | ︙ | |||
128615 128616 128617 128618 128619 128620 128621 128622 128623 128624 128625 128626 128627 128628 | }else{ sqlite3WhereEnd(pWInfo); } } #endif /* SQLITE_OMIT_VIRTUALTABLE */ /************** End of update.c **********************************************/ /************** Begin file vacuum.c ******************************************/ /* ** 2003 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 129217 129218 129219 129220 129221 129222 129223 129224 129225 129226 129227 129228 129229 129230 129231 129232 129233 129234 129235 129236 129237 129238 129239 129240 129241 129242 129243 129244 129245 129246 129247 129248 129249 129250 129251 129252 129253 129254 129255 129256 129257 129258 129259 129260 129261 129262 129263 129264 129265 129266 129267 129268 129269 129270 129271 129272 129273 129274 129275 129276 129277 129278 129279 129280 129281 129282 129283 129284 129285 129286 129287 129288 129289 129290 129291 129292 129293 129294 129295 129296 129297 129298 129299 129300 129301 129302 129303 129304 129305 129306 129307 129308 129309 129310 129311 129312 129313 129314 129315 129316 129317 129318 129319 129320 129321 129322 129323 129324 129325 129326 129327 129328 129329 129330 129331 129332 129333 129334 129335 129336 129337 129338 129339 129340 129341 129342 129343 129344 129345 129346 129347 129348 129349 129350 129351 129352 129353 129354 129355 129356 129357 129358 129359 129360 129361 129362 129363 129364 129365 129366 129367 129368 129369 129370 129371 129372 129373 129374 129375 129376 129377 129378 129379 129380 129381 129382 129383 129384 129385 129386 129387 129388 129389 129390 129391 129392 129393 129394 129395 129396 129397 129398 129399 129400 129401 129402 129403 129404 129405 129406 129407 129408 129409 129410 129411 129412 129413 129414 129415 129416 129417 129418 129419 129420 129421 129422 129423 129424 129425 129426 129427 129428 129429 129430 129431 129432 129433 129434 129435 129436 129437 129438 129439 129440 129441 129442 129443 129444 129445 129446 129447 129448 129449 129450 129451 129452 129453 129454 129455 129456 129457 129458 129459 129460 129461 129462 129463 129464 129465 129466 129467 129468 129469 129470 129471 129472 129473 129474 129475 129476 129477 129478 129479 129480 129481 129482 | }else{ sqlite3WhereEnd(pWInfo); } } #endif /* SQLITE_OMIT_VIRTUALTABLE */ /************** End of update.c **********************************************/ /************** Begin file upsert.c ******************************************/ /* ** 2018-04-12 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code to implement various aspects of UPSERT ** processing and handling of the Upsert object. */ /* #include "sqliteInt.h" */ #ifndef SQLITE_OMIT_UPSERT /* ** Free a list of Upsert objects */ SQLITE_PRIVATE void sqlite3UpsertDelete(sqlite3 *db, Upsert *p){ if( p ){ sqlite3ExprListDelete(db, p->pUpsertTarget); sqlite3ExprDelete(db, p->pUpsertTargetWhere); sqlite3ExprListDelete(db, p->pUpsertSet); sqlite3ExprDelete(db, p->pUpsertWhere); sqlite3DbFree(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) ); } /* ** 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 *pNew; pNew = sqlite3DbMallocRaw(db, sizeof(Upsert)); if( pNew==0 ){ sqlite3ExprListDelete(db, pTarget); sqlite3ExprDelete(db, pTargetWhere); sqlite3ExprListDelete(db, pSet); sqlite3ExprDelete(db, pWhere); return 0; }else{ pNew->pUpsertTarget = pTarget; pNew->pUpsertTargetWhere = pTargetWhere; pNew->pUpsertSet = pSet; pNew->pUpsertWhere = pWhere; pNew->pUpsertIdx = 0; } return pNew; } /* ** Analyze the ON CONFLICT clause described by pUpsert. Resolve all ** symbols in the conflict-target. ** ** Return SQLITE_OK if everything works, or an error code is something ** is wrong. */ SQLITE_PRIVATE int sqlite3UpsertAnalyzeTarget( Parse *pParse, /* The parsing context */ SrcList *pTabList, /* Table into which we are inserting */ Upsert *pUpsert /* The ON CONFLICT clauses */ ){ Table *pTab; /* That table into which we are inserting */ 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; 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 ); return SQLITE_OK; } /* 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; return SQLITE_OK; } sqlite3ErrorMsg(pParse, "ON CONFLICT clause does not match any " "PRIMARY KEY or UNIQUE constraint"); return SQLITE_ERROR; } /* ** 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 ** currently points to the conflicting table row. Otherwise, if pIdx ** is not NULL, then pIdx is the constraint that failed and iCur is a ** cursor points to the conflicting row. */ SQLITE_PRIVATE void sqlite3UpsertDoUpdate( Parse *pParse, /* The parsing and code-generating context */ Upsert *pUpsert, /* The ON CONFLICT clause for the upsert */ Table *pTab, /* The table being updated */ Index *pIdx, /* The UNIQUE constraint that failed */ 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 = pUpsert->iDataCur; assert( v!=0 ); 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); }else{ Index *pPk = sqlite3PrimaryKeyIndex(pTab); int nPk = pPk->nKeyCol; int iPk = pParse->nMem+1; int i; pParse->nMem += nPk; for(i=0; i<nPk; i++){ int k; assert( pPk->aiColumn[i]>=0 ); k = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[i]); sqlite3VdbeAddOp3(v, OP_Column, iCur, k, iPk+i); VdbeComment((v, "%s.%s", pIdx->zName, pTab->aCol[pPk->aiColumn[i]].zName)); } i = sqlite3VdbeAddOp4Int(v, OP_Found, iDataCur, 0, iPk, nPk); VdbeCoverage(v); sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CORRUPT, OE_Abort, 0, "corrupt database", P4_STATIC); sqlite3VdbeJumpHere(v, i); } } /* pUpsert does not own pUpsertSrc - the outer INSERT statement does. So ** we have to make a copy before passing it down into sqlite3Update() */ pSrc = sqlite3SrcListDup(db, pUpsert->pUpsertSrc, 0); sqlite3Update(pParse, pSrc, pUpsert->pUpsertSet, pUpsert->pUpsertWhere, OE_Abort, 0, 0, pUpsert); pUpsert->pUpsertSet = 0; /* Will have been deleted by sqlite3Update() */ pUpsert->pUpsertWhere = 0; /* Will have been deleted by sqlite3Update() */ VdbeNoopComment((v, "End DO UPDATE of UPSERT")); } #endif /* SQLITE_OMIT_UPSERT */ /************** End of upsert.c **********************************************/ /************** Begin file vacuum.c ******************************************/ /* ** 2003 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** |
︙ | ︙ | |||
132016 132017 132018 132019 132020 132021 132022 132023 132024 132025 132026 132027 132028 132029 | addrBrk = pLevel->addrBrk = pLevel->addrNxt = sqlite3VdbeMakeLabel(v); addrCont = pLevel->addrCont = sqlite3VdbeMakeLabel(v); /* If this is the right table of a LEFT OUTER JOIN, allocate and ** initialize a memory cell that records if this table matches any ** row of the left table of the join. */ if( pLevel->iFrom>0 && (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){ pLevel->iLeftJoin = ++pParse->nMem; sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin); VdbeComment((v, "init LEFT JOIN no-match flag")); } /* Compute a safe address to jump to if we discover that the table for | > > > | 132870 132871 132872 132873 132874 132875 132876 132877 132878 132879 132880 132881 132882 132883 132884 132885 132886 | addrBrk = pLevel->addrBrk = pLevel->addrNxt = sqlite3VdbeMakeLabel(v); addrCont = pLevel->addrCont = sqlite3VdbeMakeLabel(v); /* If this is the right table of a LEFT OUTER JOIN, allocate and ** initialize a memory cell that records if this table matches any ** row of the left table of the join. */ assert( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE) || pLevel->iFrom>0 || (pTabItem[0].fg.jointype & JT_LEFT)==0 ); if( pLevel->iFrom>0 && (pTabItem[0].fg.jointype & JT_LEFT)!=0 ){ pLevel->iLeftJoin = ++pParse->nMem; sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin); VdbeComment((v, "init LEFT JOIN no-match flag")); } /* Compute a safe address to jump to if we discover that the table for |
︙ | ︙ | |||
132549 132550 132551 132552 132553 132554 132555 132556 | sqlite3VdbeAddOp4Int(v, OP_NotFound, iCur, addrCont, iRowidReg, pPk->nKeyCol); VdbeCoverage(v); } /* If pIdx is an index on one or more expressions, then look through ** all the expressions in pWInfo and try to transform matching expressions ** into reference to index columns. */ | > > > > > > > | | | 133406 133407 133408 133409 133410 133411 133412 133413 133414 133415 133416 133417 133418 133419 133420 133421 133422 133423 133424 133425 133426 133427 133428 133429 | sqlite3VdbeAddOp4Int(v, OP_NotFound, iCur, addrCont, iRowidReg, pPk->nKeyCol); VdbeCoverage(v); } /* If pIdx is an index on one or more expressions, then look through ** all the expressions in pWInfo and try to transform matching expressions ** into reference to index columns. ** ** Do not do this for the RHS of a LEFT JOIN. This is because the ** expression may be evaluated after OP_NullRow has been executed on ** the cursor. In this case it is important to do the full evaluation, ** as the result of the expression may not be NULL, even if all table ** column values are. https://www.sqlite.org/src/info/7fa8049685b50b5a */ if( pLevel->iLeftJoin==0 ){ whereIndexExprTrans(pIdx, iCur, iIdxCur, pWInfo); } /* Record the instruction used to terminate the loop. */ if( pLoop->wsFlags & WHERE_ONEROW ){ pLevel->op = OP_Noop; }else if( bRev ){ pLevel->op = OP_Prev; }else{ |
︙ | ︙ | |||
132707 132708 132709 132710 132711 132712 132713 | ** See ticket http://www.sqlite.org/src/info/f2369304e4 */ if( pWC->nTerm>1 ){ int iTerm; for(iTerm=0; iTerm<pWC->nTerm; iTerm++){ Expr *pExpr = pWC->a[iTerm].pExpr; if( &pWC->a[iTerm] == pTerm ) continue; | < | 133571 133572 133573 133574 133575 133576 133577 133578 133579 133580 133581 133582 133583 133584 | ** See ticket http://www.sqlite.org/src/info/f2369304e4 */ if( pWC->nTerm>1 ){ int iTerm; for(iTerm=0; iTerm<pWC->nTerm; iTerm++){ Expr *pExpr = pWC->a[iTerm].pExpr; if( &pWC->a[iTerm] == pTerm ) continue; testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL ); testcase( pWC->a[iTerm].wtFlags & TERM_CODED ); if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED))!=0 ) continue; if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue; testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO ); pExpr = sqlite3ExprDup(db, pExpr, 0); pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr); |
︙ | ︙ | |||
132732 132733 132734 132735 132736 132737 132738 | wctrlFlags = WHERE_OR_SUBCLAUSE | (pWInfo->wctrlFlags & WHERE_SEEK_TABLE); for(ii=0; ii<pOrWc->nTerm; ii++){ WhereTerm *pOrTerm = &pOrWc->a[ii]; if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){ WhereInfo *pSubWInfo; /* Info for single OR-term scan */ Expr *pOrExpr = pOrTerm->pExpr; /* Current OR clause term */ int jmp1 = 0; /* Address of jump operation */ | > | > > | 133595 133596 133597 133598 133599 133600 133601 133602 133603 133604 133605 133606 133607 133608 133609 133610 133611 133612 | wctrlFlags = WHERE_OR_SUBCLAUSE | (pWInfo->wctrlFlags & WHERE_SEEK_TABLE); for(ii=0; ii<pOrWc->nTerm; ii++){ WhereTerm *pOrTerm = &pOrWc->a[ii]; if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){ WhereInfo *pSubWInfo; /* Info for single OR-term scan */ Expr *pOrExpr = pOrTerm->pExpr; /* Current OR clause term */ int jmp1 = 0; /* Address of jump operation */ assert( (pTabItem[0].fg.jointype & JT_LEFT)==0 || ExprHasProperty(pOrExpr, EP_FromJoin) ); if( pAndExpr ){ pAndExpr->pLeft = pOrExpr; pOrExpr = pAndExpr; } /* Loop through table entries that match term pOrTerm. */ WHERETRACE(0xffff, ("Subplan for OR-clause:\n")); pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0, wctrlFlags, iCovCur); |
︙ | ︙ | |||
132915 132916 132917 132918 132919 132920 132921 | testcase( pWInfo->untestedTerms==0 && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)!=0 ); pWInfo->untestedTerms = 1; continue; } pE = pTerm->pExpr; assert( pE!=0 ); | | | 133781 133782 133783 133784 133785 133786 133787 133788 133789 133790 133791 133792 133793 133794 133795 | testcase( pWInfo->untestedTerms==0 && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)!=0 ); pWInfo->untestedTerms = 1; continue; } pE = pTerm->pExpr; assert( pE!=0 ); if( (pTabItem->fg.jointype&JT_LEFT) && !ExprHasProperty(pE,EP_FromJoin) ){ continue; } if( iLoop==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){ iNext = 2; continue; } |
︙ | ︙ | |||
133842 133843 133844 133845 133846 133847 133848 | testcase( idxNew==0 ); exprAnalyze(pSrc, pWC, idxNew); pTerm = &pWC->a[idxTerm]; markTermAsChild(pWC, idxNew, idxTerm); }else{ sqlite3ExprListDelete(db, pList); } | < | 134708 134709 134710 134711 134712 134713 134714 134715 134716 134717 134718 134719 134720 134721 | testcase( idxNew==0 ); exprAnalyze(pSrc, pWC, idxNew); pTerm = &pWC->a[idxTerm]; markTermAsChild(pWC, idxNew, idxTerm); }else{ sqlite3ExprListDelete(db, pList); } } } } #endif /* !SQLITE_OMIT_OR_OPTIMIZATION && !SQLITE_OMIT_SUBQUERY */ /* ** We already know that pExpr is a binary operator where both operands are |
︙ | ︙ | |||
136979 136980 136981 136982 136983 136984 136985 | } if( pTerm->prereqRight & pNew->maskSelf ) continue; /* Do not allow the upper bound of a LIKE optimization range constraint ** to mix with a lower range bound from some other source */ if( pTerm->wtFlags & TERM_LIKEOPT && pTerm->eOperator==WO_LT ) continue; | | < < < | 137844 137845 137846 137847 137848 137849 137850 137851 137852 137853 137854 137855 137856 137857 137858 137859 137860 137861 137862 137863 | } if( pTerm->prereqRight & pNew->maskSelf ) continue; /* Do not allow the upper bound of a LIKE optimization range constraint ** to mix with a lower range bound from some other source */ if( pTerm->wtFlags & TERM_LIKEOPT && pTerm->eOperator==WO_LT ) continue; /* Do not allow constraints from the WHERE clause to be used by the ** right table of a LEFT JOIN. Only constraints in the ON clause are ** allowed */ if( (pSrc->fg.jointype & JT_LEFT)!=0 && !ExprHasProperty(pTerm->pExpr, EP_FromJoin) ){ continue; } if( IsUniqueIndex(pProbe) && saved_nEq==pProbe->nKeyCol-1 ){ pBuilder->bldFlags |= SQLITE_BLDF_UNIQUE; }else{ pBuilder->bldFlags |= SQLITE_BLDF_INDEXED; |
︙ | ︙ | |||
139981 139982 139983 139984 139985 139986 139987 139988 139989 139990 139991 139992 139993 139994 139995 139996 139997 139998 139999 140000 140001 140002 140003 140004 140005 140006 140007 140008 | ** This is typically a union of many types, one of ** which is sqlite3ParserTOKENTYPE. The entry in the union ** for terminal symbols is called "yy0". ** YYSTACKDEPTH is the maximum depth of the parser's stack. If ** zero the stack is dynamically sized using realloc() ** sqlite3ParserARG_SDECL A static variable declaration for the %extra_argument ** sqlite3ParserARG_PDECL A parameter declaration for the %extra_argument ** sqlite3ParserARG_STORE Code to store %extra_argument into yypParser ** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** YYNSTATE the combined number of states. ** YYNRULE the number of rules in the grammar ** YYNTOKEN Number of terminal symbols ** YY_MAX_SHIFT Maximum value for shift actions ** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions ** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions ** YY_ERROR_ACTION The yy_action[] code for syntax error ** YY_ACCEPT_ACTION The yy_action[] code for accept ** YY_NO_ACTION The yy_action[] code for no-op ** YY_MIN_REDUCE Minimum value for reduce actions ** YY_MAX_REDUCE Maximum value for reduce actions */ #ifndef INTERFACE # define INTERFACE 1 #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned char | > > | | | < | > | < | > | > | | | | | | > | | > > > > > | | | | | | | | | | | | 140843 140844 140845 140846 140847 140848 140849 140850 140851 140852 140853 140854 140855 140856 140857 140858 140859 140860 140861 140862 140863 140864 140865 140866 140867 140868 140869 140870 140871 140872 140873 140874 140875 140876 140877 140878 140879 140880 140881 140882 140883 140884 140885 140886 140887 140888 140889 140890 140891 140892 140893 140894 140895 140896 140897 140898 140899 140900 140901 140902 140903 140904 140905 140906 140907 140908 140909 140910 140911 140912 140913 140914 140915 140916 140917 140918 140919 140920 140921 140922 140923 140924 | ** This is typically a union of many types, one of ** which is sqlite3ParserTOKENTYPE. The entry in the union ** for terminal symbols is called "yy0". ** YYSTACKDEPTH is the maximum depth of the parser's stack. If ** zero the stack is dynamically sized using realloc() ** sqlite3ParserARG_SDECL A static variable declaration for the %extra_argument ** sqlite3ParserARG_PDECL A parameter declaration for the %extra_argument ** sqlite3ParserARG_PARAM Code to pass %extra_argument as a subroutine parameter ** sqlite3ParserARG_STORE Code to store %extra_argument into yypParser ** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser ** sqlite3ParserCTX_* As sqlite3ParserARG_ except for %extra_context ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** YYNSTATE the combined number of states. ** YYNRULE the number of rules in the grammar ** YYNTOKEN Number of terminal symbols ** YY_MAX_SHIFT Maximum value for shift actions ** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions ** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions ** YY_ERROR_ACTION The yy_action[] code for syntax error ** YY_ACCEPT_ACTION The yy_action[] code for accept ** YY_NO_ACTION The yy_action[] code for no-op ** YY_MIN_REDUCE Minimum value for reduce actions ** YY_MAX_REDUCE Maximum value for reduce actions */ #ifndef INTERFACE # define INTERFACE 1 #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned char #define YYNOCODE 255 #define YYACTIONTYPE unsigned short int #define YYWILDCARD 84 #define sqlite3ParserTOKENTYPE Token typedef union { int yyinit; sqlite3ParserTOKENTYPE yy0; const char* yy36; TriggerStep* yy47; With* yy91; struct {int value; int mask;} yy107; Expr* yy182; Upsert* yy198; ExprList* yy232; struct TrigEvent yy300; Select* yy399; SrcList* yy427; int yy502; IdList* yy510; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 #endif #define sqlite3ParserARG_SDECL #define sqlite3ParserARG_PDECL #define sqlite3ParserARG_PARAM #define sqlite3ParserARG_FETCH #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 490 #define YYNRULE 341 #define YYNTOKEN 145 #define YY_MAX_SHIFT 489 #define YY_MIN_SHIFTREDUCE 705 #define YY_MAX_SHIFTREDUCE 1045 #define YY_ERROR_ACTION 1046 #define YY_ACCEPT_ACTION 1047 #define YY_NO_ACTION 1048 #define YY_MIN_REDUCE 1049 #define YY_MAX_REDUCE 1389 /************* End control #defines *******************************************/ /* 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 ** to a macro that can assist in verifying code coverage. For production |
︙ | ︙ | |||
140105 140106 140107 140108 140109 140110 140111 | ** 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 **********************************************/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < < < | > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > | < < < | < < | | | | | | | | | | | | > > > > > > < < < < < < | | | | | | | | | | | | | | > > > > > > > < < < < < < < | | | | | | | | | | | | | > > > > > > > > < < < < < < < < | | | | | | | | | | | | > > > > > > > > > | | | | | | | | | | | | | | < < < < < | | | | | | | | < < | < < < | | | | | | | | | | | | | | | > | > > > | > > > > > > > | | | | | | | | < | | > | > > > > > | | > | | | | | | | | | | | | < | | | | | | | | < < < < < < | | | | | | | | | | | | | | | | > > > > > > > < < < < < < < | | | | | | | | | | | | | | | | > > > > > > > | | | | > | | | | | | | | | | | | | | | | | | | | | | | > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | 140976 140977 140978 140979 140980 140981 140982 140983 140984 140985 140986 140987 140988 140989 140990 140991 140992 140993 140994 140995 140996 140997 140998 140999 141000 141001 141002 141003 141004 141005 141006 141007 141008 141009 141010 141011 141012 141013 141014 141015 141016 141017 141018 141019 141020 141021 141022 141023 141024 141025 141026 141027 141028 141029 141030 141031 141032 141033 141034 141035 141036 141037 141038 141039 141040 141041 141042 141043 141044 141045 141046 141047 141048 141049 141050 141051 141052 141053 141054 141055 141056 141057 141058 141059 141060 141061 141062 141063 141064 141065 141066 141067 141068 141069 141070 141071 141072 141073 141074 141075 141076 141077 141078 141079 141080 141081 141082 141083 141084 141085 141086 141087 141088 141089 141090 141091 141092 141093 141094 141095 141096 141097 141098 141099 141100 141101 141102 141103 141104 141105 141106 141107 141108 141109 141110 141111 141112 141113 141114 141115 141116 141117 141118 141119 141120 141121 141122 141123 141124 141125 141126 141127 141128 141129 141130 141131 141132 141133 141134 141135 141136 141137 141138 141139 141140 141141 141142 141143 141144 141145 141146 141147 141148 141149 141150 141151 141152 141153 141154 141155 141156 141157 141158 141159 141160 141161 141162 141163 141164 141165 141166 141167 141168 141169 141170 141171 141172 141173 141174 141175 141176 141177 141178 141179 141180 141181 141182 141183 141184 141185 141186 141187 141188 141189 141190 141191 141192 141193 141194 141195 141196 141197 141198 141199 141200 141201 141202 141203 141204 141205 141206 141207 141208 141209 141210 141211 141212 141213 141214 141215 141216 141217 141218 141219 141220 141221 141222 141223 141224 141225 141226 141227 141228 141229 141230 141231 141232 141233 141234 141235 141236 141237 141238 141239 141240 141241 141242 141243 141244 141245 141246 141247 141248 141249 141250 141251 141252 141253 141254 141255 141256 141257 141258 141259 141260 141261 141262 141263 141264 141265 141266 141267 141268 141269 141270 141271 141272 141273 141274 141275 141276 141277 141278 141279 141280 141281 141282 141283 141284 141285 141286 141287 141288 141289 141290 141291 141292 141293 141294 141295 141296 141297 141298 141299 141300 141301 141302 141303 141304 141305 141306 141307 141308 141309 141310 141311 141312 141313 141314 141315 141316 141317 141318 141319 141320 141321 141322 141323 141324 141325 141326 141327 141328 141329 141330 141331 141332 141333 141334 141335 141336 141337 141338 141339 141340 141341 141342 141343 141344 141345 141346 141347 141348 141349 141350 141351 141352 141353 141354 141355 141356 141357 141358 141359 141360 141361 141362 141363 141364 141365 141366 141367 141368 141369 141370 141371 141372 141373 141374 141375 141376 141377 141378 141379 141380 141381 141382 141383 141384 141385 141386 141387 141388 141389 141390 141391 141392 141393 141394 141395 141396 141397 141398 141399 141400 141401 141402 141403 141404 141405 141406 141407 141408 141409 141410 141411 141412 141413 141414 141415 141416 141417 141418 141419 141420 141421 141422 141423 141424 141425 141426 141427 141428 141429 141430 141431 141432 141433 141434 141435 141436 141437 141438 141439 141440 141441 141442 141443 141444 141445 141446 141447 141448 141449 141450 141451 141452 141453 141454 141455 141456 141457 141458 141459 141460 141461 141462 141463 141464 141465 141466 141467 141468 141469 141470 141471 141472 141473 141474 141475 141476 141477 141478 141479 141480 141481 141482 141483 141484 141485 141486 | ** 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 (1657) static const YYACTIONTYPE yy_action[] = { /* 0 */ 349, 99, 96, 185, 99, 96, 185, 233, 1047, 1, /* 10 */ 1, 489, 2, 1051, 484, 477, 477, 477, 260, 351, /* 20 */ 121, 1310, 1120, 1120, 1178, 1115, 1094, 1128, 380, 380, /* 30 */ 380, 835, 454, 410, 1115, 59, 59, 1357, 425, 836, /* 40 */ 710, 711, 712, 106, 107, 97, 1023, 1023, 900, 903, /* 50 */ 892, 892, 104, 104, 105, 105, 105, 105, 346, 238, /* 60 */ 238, 99, 96, 185, 238, 238, 889, 889, 901, 904, /* 70 */ 460, 481, 351, 99, 96, 185, 481, 347, 1177, 82, /* 80 */ 388, 214, 182, 23, 194, 103, 103, 103, 103, 102, /* 90 */ 102, 101, 101, 101, 100, 381, 106, 107, 97, 1023, /* 100 */ 1023, 900, 903, 892, 892, 104, 104, 105, 105, 105, /* 110 */ 105, 10, 385, 484, 24, 484, 1333, 489, 2, 1051, /* 120 */ 335, 1043, 108, 893, 260, 351, 121, 99, 96, 185, /* 130 */ 100, 381, 386, 1128, 59, 59, 59, 59, 103, 103, /* 140 */ 103, 103, 102, 102, 101, 101, 101, 100, 381, 106, /* 150 */ 107, 97, 1023, 1023, 900, 903, 892, 892, 104, 104, /* 160 */ 105, 105, 105, 105, 360, 238, 238, 170, 170, 467, /* 170 */ 455, 467, 464, 67, 381, 329, 169, 481, 351, 343, /* 180 */ 338, 400, 1044, 68, 101, 101, 101, 100, 381, 393, /* 190 */ 194, 103, 103, 103, 103, 102, 102, 101, 101, 101, /* 200 */ 100, 381, 106, 107, 97, 1023, 1023, 900, 903, 892, /* 210 */ 892, 104, 104, 105, 105, 105, 105, 483, 385, 103, /* 220 */ 103, 103, 103, 102, 102, 101, 101, 101, 100, 381, /* 230 */ 268, 351, 946, 946, 422, 296, 102, 102, 101, 101, /* 240 */ 101, 100, 381, 861, 103, 103, 103, 103, 102, 102, /* 250 */ 101, 101, 101, 100, 381, 106, 107, 97, 1023, 1023, /* 260 */ 900, 903, 892, 892, 104, 104, 105, 105, 105, 105, /* 270 */ 484, 983, 1383, 206, 1353, 1383, 438, 435, 434, 281, /* 280 */ 396, 269, 1089, 941, 351, 1002, 433, 861, 743, 401, /* 290 */ 282, 57, 57, 482, 145, 791, 791, 103, 103, 103, /* 300 */ 103, 102, 102, 101, 101, 101, 100, 381, 106, 107, /* 310 */ 97, 1023, 1023, 900, 903, 892, 892, 104, 104, 105, /* 320 */ 105, 105, 105, 281, 1002, 1003, 1004, 206, 879, 319, /* 330 */ 438, 435, 434, 981, 259, 474, 360, 351, 1118, 1118, /* 340 */ 433, 736, 379, 378, 872, 1002, 1356, 322, 871, 766, /* 350 */ 103, 103, 103, 103, 102, 102, 101, 101, 101, 100, /* 360 */ 381, 106, 107, 97, 1023, 1023, 900, 903, 892, 892, /* 370 */ 104, 104, 105, 105, 105, 105, 484, 801, 484, 871, /* 380 */ 871, 873, 401, 282, 1002, 1003, 1004, 1030, 360, 1030, /* 390 */ 351, 983, 1384, 213, 880, 1384, 145, 59, 59, 59, /* 400 */ 59, 1002, 244, 103, 103, 103, 103, 102, 102, 101, /* 410 */ 101, 101, 100, 381, 106, 107, 97, 1023, 1023, 900, /* 420 */ 903, 892, 892, 104, 104, 105, 105, 105, 105, 274, /* 430 */ 484, 110, 467, 479, 467, 444, 259, 474, 232, 232, /* 440 */ 1002, 1003, 1004, 351, 210, 335, 982, 866, 1385, 336, /* 450 */ 481, 59, 59, 981, 245, 307, 103, 103, 103, 103, /* 460 */ 102, 102, 101, 101, 101, 100, 381, 106, 107, 97, /* 470 */ 1023, 1023, 900, 903, 892, 892, 104, 104, 105, 105, /* 480 */ 105, 105, 453, 459, 484, 408, 377, 259, 474, 271, /* 490 */ 183, 273, 209, 208, 207, 356, 351, 307, 178, 177, /* 500 */ 127, 1006, 1098, 14, 14, 43, 43, 1044, 425, 103, /* 510 */ 103, 103, 103, 102, 102, 101, 101, 101, 100, 381, /* 520 */ 106, 107, 97, 1023, 1023, 900, 903, 892, 892, 104, /* 530 */ 104, 105, 105, 105, 105, 294, 1132, 408, 160, 484, /* 540 */ 408, 1006, 129, 962, 1209, 239, 239, 481, 307, 425, /* 550 */ 1309, 1097, 351, 235, 243, 272, 820, 481, 963, 425, /* 560 */ 11, 11, 103, 103, 103, 103, 102, 102, 101, 101, /* 570 */ 101, 100, 381, 964, 362, 1002, 106, 107, 97, 1023, /* 580 */ 1023, 900, 903, 892, 892, 104, 104, 105, 105, 105, /* 590 */ 105, 1275, 161, 126, 777, 289, 1209, 292, 1072, 357, /* 600 */ 1209, 1127, 476, 357, 778, 425, 247, 425, 351, 248, /* 610 */ 414, 364, 414, 171, 1002, 1003, 1004, 84, 103, 103, /* 620 */ 103, 103, 102, 102, 101, 101, 101, 100, 381, 1002, /* 630 */ 184, 484, 106, 107, 97, 1023, 1023, 900, 903, 892, /* 640 */ 892, 104, 104, 105, 105, 105, 105, 1123, 1209, 287, /* 650 */ 484, 1209, 11, 11, 179, 820, 259, 474, 307, 237, /* 660 */ 182, 351, 321, 365, 414, 308, 367, 366, 1002, 1003, /* 670 */ 1004, 44, 44, 87, 103, 103, 103, 103, 102, 102, /* 680 */ 101, 101, 101, 100, 381, 106, 107, 97, 1023, 1023, /* 690 */ 900, 903, 892, 892, 104, 104, 105, 105, 105, 105, /* 700 */ 246, 368, 280, 128, 10, 358, 146, 796, 835, 258, /* 710 */ 1020, 88, 795, 86, 351, 421, 836, 943, 376, 348, /* 720 */ 191, 943, 1318, 267, 308, 279, 456, 103, 103, 103, /* 730 */ 103, 102, 102, 101, 101, 101, 100, 381, 106, 95, /* 740 */ 97, 1023, 1023, 900, 903, 892, 892, 104, 104, 105, /* 750 */ 105, 105, 105, 420, 249, 238, 238, 238, 238, 79, /* 760 */ 375, 125, 305, 29, 262, 978, 351, 481, 337, 481, /* 770 */ 756, 755, 304, 278, 415, 15, 81, 940, 1126, 940, /* 780 */ 103, 103, 103, 103, 102, 102, 101, 101, 101, 100, /* 790 */ 381, 107, 97, 1023, 1023, 900, 903, 892, 892, 104, /* 800 */ 104, 105, 105, 105, 105, 457, 263, 484, 174, 484, /* 810 */ 238, 238, 863, 407, 402, 216, 216, 351, 409, 193, /* 820 */ 283, 216, 481, 81, 763, 764, 266, 5, 13, 13, /* 830 */ 34, 34, 103, 103, 103, 103, 102, 102, 101, 101, /* 840 */ 101, 100, 381, 97, 1023, 1023, 900, 903, 892, 892, /* 850 */ 104, 104, 105, 105, 105, 105, 93, 475, 1002, 4, /* 860 */ 403, 1002, 340, 431, 1002, 297, 212, 1277, 81, 746, /* 870 */ 1163, 152, 926, 478, 166, 212, 757, 829, 930, 939, /* 880 */ 216, 939, 858, 103, 103, 103, 103, 102, 102, 101, /* 890 */ 101, 101, 100, 381, 238, 238, 382, 1002, 1003, 1004, /* 900 */ 1002, 1003, 1004, 1002, 1003, 1004, 481, 439, 472, 746, /* 910 */ 105, 105, 105, 105, 98, 758, 1162, 145, 930, 412, /* 920 */ 879, 406, 793, 81, 395, 89, 90, 91, 105, 105, /* 930 */ 105, 105, 1323, 92, 484, 382, 486, 485, 240, 275, /* 940 */ 871, 103, 103, 103, 103, 102, 102, 101, 101, 101, /* 950 */ 100, 381, 1096, 371, 355, 45, 45, 259, 474, 103, /* 960 */ 103, 103, 103, 102, 102, 101, 101, 101, 100, 381, /* 970 */ 1150, 871, 871, 873, 874, 21, 1332, 991, 384, 730, /* 980 */ 722, 242, 123, 1298, 124, 875, 333, 333, 332, 227, /* 990 */ 330, 991, 384, 719, 256, 242, 484, 391, 413, 1297, /* 1000 */ 333, 333, 332, 227, 330, 748, 187, 719, 265, 470, /* 1010 */ 1279, 1002, 484, 417, 391, 390, 264, 11, 11, 284, /* 1020 */ 187, 732, 265, 93, 475, 875, 4, 1279, 1281, 419, /* 1030 */ 264, 369, 416, 11, 11, 1159, 288, 484, 399, 1346, /* 1040 */ 478, 379, 378, 291, 484, 293, 189, 250, 295, 1027, /* 1050 */ 1002, 1003, 1004, 190, 1029, 1111, 140, 188, 11, 11, /* 1060 */ 189, 732, 1028, 382, 923, 46, 46, 190, 1095, 230, /* 1070 */ 140, 188, 462, 93, 475, 472, 4, 300, 309, 391, /* 1080 */ 373, 6, 1069, 217, 739, 310, 1030, 879, 1030, 1171, /* 1090 */ 478, 352, 1279, 90, 91, 800, 259, 474, 1208, 484, /* 1100 */ 92, 1268, 382, 486, 485, 352, 1002, 871, 879, 426, /* 1110 */ 259, 474, 172, 382, 238, 238, 1146, 170, 1021, 389, /* 1120 */ 47, 47, 1157, 739, 872, 472, 481, 469, 871, 350, /* 1130 */ 1214, 83, 475, 389, 4, 1078, 1071, 879, 871, 871, /* 1140 */ 873, 874, 21, 90, 91, 1002, 1003, 1004, 478, 251, /* 1150 */ 92, 251, 382, 486, 485, 443, 370, 871, 1021, 871, /* 1160 */ 871, 873, 224, 241, 306, 441, 301, 440, 211, 1060, /* 1170 */ 820, 382, 822, 447, 299, 1059, 484, 1061, 1143, 962, /* 1180 */ 430, 796, 484, 472, 1340, 312, 795, 465, 871, 871, /* 1190 */ 873, 874, 21, 314, 963, 879, 316, 59, 59, 1002, /* 1200 */ 9, 90, 91, 48, 48, 238, 238, 210, 92, 964, /* 1210 */ 382, 486, 485, 176, 334, 871, 242, 481, 1193, 238, /* 1220 */ 238, 333, 333, 332, 227, 330, 394, 270, 719, 277, /* 1230 */ 471, 481, 467, 466, 484, 145, 217, 1201, 1002, 1003, /* 1240 */ 1004, 187, 3, 265, 184, 445, 871, 871, 873, 874, /* 1250 */ 21, 264, 1337, 450, 1051, 39, 39, 392, 356, 260, /* 1260 */ 342, 121, 468, 411, 436, 821, 180, 1094, 1128, 820, /* 1270 */ 303, 1021, 1272, 1271, 299, 259, 474, 238, 238, 1002, /* 1280 */ 473, 189, 484, 318, 327, 238, 238, 484, 190, 481, /* 1290 */ 446, 140, 188, 1343, 238, 238, 1038, 481, 148, 175, /* 1300 */ 238, 238, 484, 49, 49, 219, 481, 484, 35, 35, /* 1310 */ 1317, 1021, 481, 484, 1035, 484, 1315, 484, 1002, 1003, /* 1320 */ 1004, 484, 66, 36, 36, 194, 352, 484, 38, 38, /* 1330 */ 484, 259, 474, 69, 50, 50, 51, 51, 52, 52, /* 1340 */ 359, 484, 12, 12, 484, 1198, 484, 158, 53, 53, /* 1350 */ 405, 112, 112, 385, 389, 484, 26, 484, 143, 484, /* 1360 */ 150, 484, 54, 54, 397, 40, 40, 55, 55, 484, /* 1370 */ 79, 484, 153, 1190, 484, 154, 56, 56, 41, 41, /* 1380 */ 58, 58, 133, 133, 484, 398, 484, 429, 484, 155, /* 1390 */ 134, 134, 135, 135, 484, 63, 63, 484, 341, 484, /* 1400 */ 339, 484, 196, 484, 156, 42, 42, 113, 113, 60, /* 1410 */ 60, 484, 404, 484, 27, 114, 114, 1204, 115, 115, /* 1420 */ 111, 111, 132, 132, 131, 131, 1266, 418, 484, 162, /* 1430 */ 484, 200, 119, 119, 118, 118, 484, 74, 424, 484, /* 1440 */ 1286, 484, 231, 484, 202, 484, 167, 286, 427, 116, /* 1450 */ 116, 117, 117, 290, 203, 442, 1062, 62, 62, 204, /* 1460 */ 64, 64, 61, 61, 33, 33, 37, 37, 344, 372, /* 1470 */ 1114, 1105, 748, 1113, 374, 1112, 254, 458, 1086, 255, /* 1480 */ 345, 1085, 302, 1084, 1355, 78, 1154, 311, 1104, 449, /* 1490 */ 452, 1155, 1153, 218, 7, 313, 315, 320, 1152, 85, /* 1500 */ 1252, 317, 109, 80, 463, 225, 461, 1068, 25, 487, /* 1510 */ 997, 323, 257, 226, 229, 228, 1136, 324, 325, 326, /* 1520 */ 488, 136, 1057, 1052, 1302, 1303, 1301, 706, 1300, 137, /* 1530 */ 122, 138, 383, 173, 1082, 261, 186, 252, 1081, 65, /* 1540 */ 387, 120, 938, 936, 855, 353, 149, 1079, 139, 151, /* 1550 */ 192, 780, 195, 276, 952, 157, 141, 361, 70, 363, /* 1560 */ 859, 159, 71, 72, 142, 73, 955, 354, 147, 197, /* 1570 */ 198, 951, 130, 16, 199, 285, 216, 1032, 201, 423, /* 1580 */ 164, 944, 163, 28, 721, 428, 304, 165, 205, 759, /* 1590 */ 75, 432, 298, 17, 18, 437, 76, 253, 878, 144, /* 1600 */ 877, 906, 77, 986, 30, 448, 987, 31, 451, 181, /* 1610 */ 234, 236, 168, 828, 823, 89, 910, 921, 81, 907, /* 1620 */ 215, 905, 909, 961, 960, 19, 221, 20, 220, 22, /* 1630 */ 32, 331, 876, 731, 94, 790, 794, 8, 992, 222, /* 1640 */ 480, 328, 1048, 1048, 1048, 1048, 1048, 1048, 1048, 1048, /* 1650 */ 223, 1048, 1048, 1048, 1048, 1348, 1347, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 174, 226, 227, 228, 226, 227, 228, 172, 145, 146, /* 10 */ 147, 148, 149, 150, 153, 169, 170, 171, 155, 19, /* 20 */ 157, 246, 192, 193, 177, 181, 182, 164, 169, 170, /* 30 */ 171, 31, 164, 153, 190, 174, 175, 187, 153, 39, /* 40 */ 7, 8, 9, 43, 44, 45, 46, 47, 48, 49, /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 174, 196, /* 60 */ 197, 226, 227, 228, 196, 197, 46, 47, 48, 49, /* 70 */ 209, 208, 19, 226, 227, 228, 208, 174, 177, 26, /* 80 */ 195, 213, 214, 22, 221, 85, 86, 87, 88, 89, /* 90 */ 90, 91, 92, 93, 94, 95, 43, 44, 45, 46, /* 100 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, /* 110 */ 57, 172, 249, 153, 53, 153, 147, 148, 149, 150, /* 120 */ 22, 23, 69, 103, 155, 19, 157, 226, 227, 228, /* 130 */ 94, 95, 247, 164, 174, 175, 174, 175, 85, 86, /* 140 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 43, /* 150 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, /* 160 */ 54, 55, 56, 57, 153, 196, 197, 153, 153, 209, /* 170 */ 210, 209, 210, 67, 95, 161, 237, 208, 19, 165, /* 180 */ 165, 242, 84, 24, 91, 92, 93, 94, 95, 223, /* 190 */ 221, 85, 86, 87, 88, 89, 90, 91, 92, 93, /* 200 */ 94, 95, 43, 44, 45, 46, 47, 48, 49, 50, /* 210 */ 51, 52, 53, 54, 55, 56, 57, 153, 249, 85, /* 220 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, /* 230 */ 219, 19, 109, 110, 111, 23, 89, 90, 91, 92, /* 240 */ 93, 94, 95, 73, 85, 86, 87, 88, 89, 90, /* 250 */ 91, 92, 93, 94, 95, 43, 44, 45, 46, 47, /* 260 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, /* 270 */ 153, 22, 23, 101, 173, 26, 104, 105, 106, 109, /* 280 */ 110, 111, 181, 11, 19, 59, 114, 73, 23, 110, /* 290 */ 111, 174, 175, 116, 80, 118, 119, 85, 86, 87, /* 300 */ 88, 89, 90, 91, 92, 93, 94, 95, 43, 44, /* 310 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, /* 320 */ 55, 56, 57, 109, 98, 99, 100, 101, 83, 153, /* 330 */ 104, 105, 106, 84, 120, 121, 153, 19, 192, 193, /* 340 */ 114, 23, 89, 90, 99, 59, 23, 230, 103, 26, /* 350 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, /* 360 */ 95, 43, 44, 45, 46, 47, 48, 49, 50, 51, /* 370 */ 52, 53, 54, 55, 56, 57, 153, 91, 153, 134, /* 380 */ 135, 136, 110, 111, 98, 99, 100, 134, 153, 136, /* 390 */ 19, 22, 23, 26, 23, 26, 80, 174, 175, 174, /* 400 */ 175, 59, 219, 85, 86, 87, 88, 89, 90, 91, /* 410 */ 92, 93, 94, 95, 43, 44, 45, 46, 47, 48, /* 420 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 16, /* 430 */ 153, 22, 209, 210, 209, 210, 120, 121, 196, 197, /* 440 */ 98, 99, 100, 19, 46, 22, 23, 23, 252, 253, /* 450 */ 208, 174, 175, 84, 219, 153, 85, 86, 87, 88, /* 460 */ 89, 90, 91, 92, 93, 94, 95, 43, 44, 45, /* 470 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, /* 480 */ 56, 57, 153, 153, 153, 153, 209, 120, 121, 76, /* 490 */ 153, 78, 109, 110, 111, 97, 19, 153, 89, 90, /* 500 */ 198, 59, 183, 174, 175, 174, 175, 84, 153, 85, /* 510 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, /* 520 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, /* 530 */ 53, 54, 55, 56, 57, 16, 197, 153, 22, 153, /* 540 */ 153, 99, 198, 12, 153, 196, 197, 208, 153, 153, /* 550 */ 195, 183, 19, 23, 222, 142, 26, 208, 27, 153, /* 560 */ 174, 175, 85, 86, 87, 88, 89, 90, 91, 92, /* 570 */ 93, 94, 95, 42, 188, 59, 43, 44, 45, 46, /* 580 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, /* 590 */ 57, 195, 22, 198, 63, 76, 153, 78, 167, 168, /* 600 */ 153, 195, 167, 168, 73, 153, 222, 153, 19, 222, /* 610 */ 153, 220, 153, 24, 98, 99, 100, 140, 85, 86, /* 620 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 59, /* 630 */ 100, 153, 43, 44, 45, 46, 47, 48, 49, 50, /* 640 */ 51, 52, 53, 54, 55, 56, 57, 195, 153, 195, /* 650 */ 153, 153, 174, 175, 26, 125, 120, 121, 153, 213, /* 660 */ 214, 19, 153, 220, 153, 153, 188, 220, 98, 99, /* 670 */ 100, 174, 175, 140, 85, 86, 87, 88, 89, 90, /* 680 */ 91, 92, 93, 94, 95, 43, 44, 45, 46, 47, /* 690 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, /* 700 */ 243, 189, 243, 198, 172, 250, 251, 117, 31, 201, /* 710 */ 26, 139, 122, 141, 19, 220, 39, 29, 220, 211, /* 720 */ 24, 33, 153, 164, 153, 164, 19, 85, 86, 87, /* 730 */ 88, 89, 90, 91, 92, 93, 94, 95, 43, 44, /* 740 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, /* 750 */ 55, 56, 57, 65, 243, 196, 197, 196, 197, 131, /* 760 */ 189, 22, 103, 24, 153, 23, 19, 208, 26, 208, /* 770 */ 102, 103, 113, 23, 242, 22, 26, 134, 164, 136, /* 780 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, /* 790 */ 95, 44, 45, 46, 47, 48, 49, 50, 51, 52, /* 800 */ 53, 54, 55, 56, 57, 98, 153, 153, 124, 153, /* 810 */ 196, 197, 23, 23, 61, 26, 26, 19, 23, 123, /* 820 */ 23, 26, 208, 26, 7, 8, 153, 22, 174, 175, /* 830 */ 174, 175, 85, 86, 87, 88, 89, 90, 91, 92, /* 840 */ 93, 94, 95, 45, 46, 47, 48, 49, 50, 51, /* 850 */ 52, 53, 54, 55, 56, 57, 19, 20, 59, 22, /* 860 */ 111, 59, 164, 23, 59, 23, 26, 153, 26, 59, /* 870 */ 153, 72, 23, 36, 72, 26, 35, 23, 59, 134, /* 880 */ 26, 136, 133, 85, 86, 87, 88, 89, 90, 91, /* 890 */ 92, 93, 94, 95, 196, 197, 59, 98, 99, 100, /* 900 */ 98, 99, 100, 98, 99, 100, 208, 66, 71, 99, /* 910 */ 54, 55, 56, 57, 58, 74, 153, 80, 99, 19, /* 920 */ 83, 223, 23, 26, 153, 26, 89, 90, 54, 55, /* 930 */ 56, 57, 153, 96, 153, 98, 99, 100, 22, 153, /* 940 */ 103, 85, 86, 87, 88, 89, 90, 91, 92, 93, /* 950 */ 94, 95, 183, 112, 158, 174, 175, 120, 121, 85, /* 960 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, /* 970 */ 215, 134, 135, 136, 137, 138, 0, 1, 2, 23, /* 980 */ 21, 5, 26, 153, 22, 59, 10, 11, 12, 13, /* 990 */ 14, 1, 2, 17, 212, 5, 153, 153, 98, 153, /* 1000 */ 10, 11, 12, 13, 14, 108, 30, 17, 32, 193, /* 1010 */ 153, 59, 153, 153, 170, 171, 40, 174, 175, 153, /* 1020 */ 30, 59, 32, 19, 20, 99, 22, 170, 171, 233, /* 1030 */ 40, 188, 236, 174, 175, 153, 153, 153, 79, 123, /* 1040 */ 36, 89, 90, 153, 153, 153, 70, 188, 153, 97, /* 1050 */ 98, 99, 100, 77, 102, 153, 80, 81, 174, 175, /* 1060 */ 70, 99, 110, 59, 105, 174, 175, 77, 153, 238, /* 1070 */ 80, 81, 188, 19, 20, 71, 22, 153, 153, 235, /* 1080 */ 19, 22, 164, 24, 59, 153, 134, 83, 136, 153, /* 1090 */ 36, 115, 235, 89, 90, 91, 120, 121, 153, 153, /* 1100 */ 96, 142, 98, 99, 100, 115, 59, 103, 83, 239, /* 1110 */ 120, 121, 199, 59, 196, 197, 153, 153, 59, 143, /* 1120 */ 174, 175, 153, 98, 99, 71, 208, 153, 103, 165, /* 1130 */ 153, 19, 20, 143, 22, 153, 153, 83, 134, 135, /* 1140 */ 136, 137, 138, 89, 90, 98, 99, 100, 36, 185, /* 1150 */ 96, 187, 98, 99, 100, 91, 95, 103, 99, 134, /* 1160 */ 135, 136, 101, 102, 103, 104, 105, 106, 107, 153, /* 1170 */ 26, 59, 125, 164, 113, 153, 153, 153, 212, 12, /* 1180 */ 19, 117, 153, 71, 153, 212, 122, 164, 134, 135, /* 1190 */ 136, 137, 138, 212, 27, 83, 212, 174, 175, 59, /* 1200 */ 200, 89, 90, 174, 175, 196, 197, 46, 96, 42, /* 1210 */ 98, 99, 100, 172, 151, 103, 5, 208, 203, 196, /* 1220 */ 197, 10, 11, 12, 13, 14, 216, 216, 17, 244, /* 1230 */ 63, 208, 209, 210, 153, 80, 24, 203, 98, 99, /* 1240 */ 100, 30, 22, 32, 100, 164, 134, 135, 136, 137, /* 1250 */ 138, 40, 148, 164, 150, 174, 175, 102, 97, 155, /* 1260 */ 203, 157, 164, 244, 178, 125, 186, 182, 164, 125, /* 1270 */ 177, 59, 177, 177, 113, 120, 121, 196, 197, 59, /* 1280 */ 232, 70, 153, 216, 202, 196, 197, 153, 77, 208, /* 1290 */ 209, 80, 81, 156, 196, 197, 60, 208, 248, 200, /* 1300 */ 196, 197, 153, 174, 175, 123, 208, 153, 174, 175, /* 1310 */ 160, 99, 208, 153, 38, 153, 160, 153, 98, 99, /* 1320 */ 100, 153, 245, 174, 175, 221, 115, 153, 174, 175, /* 1330 */ 153, 120, 121, 245, 174, 175, 174, 175, 174, 175, /* 1340 */ 160, 153, 174, 175, 153, 225, 153, 22, 174, 175, /* 1350 */ 97, 174, 175, 249, 143, 153, 224, 153, 43, 153, /* 1360 */ 191, 153, 174, 175, 18, 174, 175, 174, 175, 153, /* 1370 */ 131, 153, 194, 203, 153, 194, 174, 175, 174, 175, /* 1380 */ 174, 175, 174, 175, 153, 160, 153, 18, 153, 194, /* 1390 */ 174, 175, 174, 175, 153, 174, 175, 153, 225, 153, /* 1400 */ 203, 153, 159, 153, 194, 174, 175, 174, 175, 174, /* 1410 */ 175, 153, 203, 153, 224, 174, 175, 191, 174, 175, /* 1420 */ 174, 175, 174, 175, 174, 175, 203, 160, 153, 191, /* 1430 */ 153, 159, 174, 175, 174, 175, 153, 139, 62, 153, /* 1440 */ 241, 153, 160, 153, 159, 153, 22, 240, 179, 174, /* 1450 */ 175, 174, 175, 160, 159, 97, 160, 174, 175, 159, /* 1460 */ 174, 175, 174, 175, 174, 175, 174, 175, 179, 64, /* 1470 */ 176, 184, 108, 176, 95, 176, 234, 126, 176, 234, /* 1480 */ 179, 178, 176, 176, 176, 97, 218, 217, 184, 179, /* 1490 */ 179, 218, 218, 160, 22, 217, 217, 160, 218, 139, /* 1500 */ 229, 217, 130, 129, 127, 25, 128, 163, 26, 162, /* 1510 */ 13, 206, 231, 154, 6, 154, 207, 205, 204, 203, /* 1520 */ 152, 166, 152, 152, 172, 172, 172, 4, 172, 166, /* 1530 */ 180, 166, 3, 22, 172, 144, 15, 180, 172, 172, /* 1540 */ 82, 16, 23, 23, 121, 254, 132, 172, 112, 124, /* 1550 */ 24, 20, 126, 16, 1, 124, 112, 61, 53, 37, /* 1560 */ 133, 132, 53, 53, 112, 53, 98, 254, 251, 34, /* 1570 */ 123, 1, 5, 22, 97, 142, 26, 75, 123, 41, /* 1580 */ 97, 68, 68, 24, 20, 19, 113, 22, 107, 28, /* 1590 */ 22, 67, 23, 22, 22, 67, 22, 67, 23, 37, /* 1600 */ 23, 23, 26, 23, 22, 24, 23, 22, 24, 123, /* 1610 */ 23, 23, 22, 98, 125, 26, 11, 23, 26, 23, /* 1620 */ 34, 23, 23, 23, 23, 34, 22, 34, 26, 22, /* 1630 */ 22, 15, 23, 23, 22, 117, 23, 22, 1, 123, /* 1640 */ 26, 23, 255, 255, 255, 255, 255, 255, 255, 255, /* 1650 */ 123, 255, 255, 255, 255, 123, 123, 255, 255, 255, /* 1660 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 1670 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 1680 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 1690 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 1700 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 1710 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 1720 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 1730 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 1740 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 1750 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 1760 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 1770 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 1780 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 1790 */ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, /* 1800 */ 255, 255, }; #define YY_SHIFT_COUNT (489) #define YY_SHIFT_MIN (0) #define YY_SHIFT_MAX (1637) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 990, 976, 1211, 837, 837, 316, 1054, 1054, 1054, 1054, /* 10 */ 214, 0, 0, 106, 642, 1054, 1054, 1054, 1054, 1054, /* 20 */ 1054, 1054, 1054, 952, 952, 226, 1155, 316, 316, 316, /* 30 */ 316, 316, 316, 53, 159, 212, 265, 318, 371, 424, /* 40 */ 477, 533, 589, 642, 642, 642, 642, 642, 642, 642, /* 50 */ 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, /* 60 */ 695, 642, 747, 798, 798, 1004, 1054, 1054, 1054, 1054, /* 70 */ 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, /* 80 */ 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, /* 90 */ 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1112, 1054, 1054, /* 100 */ 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, 1054, /* 110 */ 1054, 856, 874, 874, 874, 874, 874, 134, 147, 93, /* 120 */ 342, 959, 1161, 253, 253, 342, 367, 367, 367, 367, /* 130 */ 179, 36, 79, 1657, 1657, 1657, 1061, 1061, 1061, 516, /* 140 */ 799, 516, 516, 531, 531, 802, 249, 369, 342, 342, /* 150 */ 342, 342, 342, 342, 342, 342, 342, 342, 342, 342, /* 160 */ 342, 342, 342, 342, 342, 342, 342, 342, 342, 272, /* 170 */ 442, 442, 536, 1657, 1657, 1657, 1025, 245, 245, 570, /* 180 */ 172, 286, 805, 1047, 1140, 1220, 342, 342, 342, 342, /* 190 */ 342, 342, 342, 342, 170, 342, 342, 342, 342, 342, /* 200 */ 342, 342, 342, 342, 342, 342, 342, 841, 841, 841, /* 210 */ 342, 342, 342, 342, 530, 342, 342, 342, 1059, 342, /* 220 */ 342, 1167, 342, 342, 342, 342, 342, 342, 342, 342, /* 230 */ 123, 688, 177, 1212, 1212, 1212, 1212, 1144, 177, 177, /* 240 */ 1064, 409, 33, 628, 707, 707, 900, 628, 628, 900, /* 250 */ 897, 323, 398, 677, 677, 677, 707, 572, 684, 590, /* 260 */ 739, 1236, 1182, 1182, 1276, 1276, 1182, 1253, 1325, 1315, /* 270 */ 1239, 1346, 1346, 1346, 1346, 1182, 1369, 1239, 1239, 1253, /* 280 */ 1325, 1315, 1315, 1239, 1182, 1369, 1298, 1376, 1182, 1369, /* 290 */ 1424, 1182, 1369, 1182, 1369, 1424, 1358, 1358, 1358, 1405, /* 300 */ 1424, 1358, 1364, 1358, 1405, 1358, 1358, 1424, 1379, 1379, /* 310 */ 1424, 1351, 1388, 1351, 1388, 1351, 1388, 1351, 1388, 1182, /* 320 */ 1472, 1182, 1360, 1372, 1377, 1374, 1378, 1239, 1480, 1482, /* 330 */ 1497, 1497, 1508, 1508, 1508, 1657, 1657, 1657, 1657, 1657, /* 340 */ 1657, 1657, 1657, 1657, 1657, 1657, 1657, 1657, 1657, 1657, /* 350 */ 1657, 20, 413, 98, 423, 519, 383, 962, 742, 61, /* 360 */ 696, 749, 750, 753, 789, 790, 795, 797, 840, 842, /* 370 */ 810, 668, 817, 659, 819, 849, 854, 899, 643, 745, /* 380 */ 956, 926, 916, 1523, 1529, 1511, 1391, 1521, 1458, 1525, /* 390 */ 1519, 1520, 1423, 1414, 1436, 1526, 1425, 1531, 1426, 1537, /* 400 */ 1553, 1431, 1427, 1444, 1496, 1522, 1429, 1505, 1509, 1510, /* 410 */ 1512, 1452, 1468, 1535, 1447, 1570, 1567, 1551, 1477, 1433, /* 420 */ 1513, 1550, 1514, 1502, 1538, 1455, 1483, 1559, 1564, 1566, /* 430 */ 1473, 1481, 1565, 1524, 1568, 1571, 1569, 1572, 1528, 1561, /* 440 */ 1574, 1530, 1562, 1575, 1577, 1578, 1576, 1580, 1582, 1581, /* 450 */ 1583, 1585, 1584, 1486, 1587, 1588, 1515, 1586, 1590, 1489, /* 460 */ 1589, 1591, 1592, 1593, 1594, 1596, 1598, 1589, 1599, 1600, /* 470 */ 1602, 1601, 1604, 1605, 1607, 1608, 1609, 1610, 1612, 1613, /* 480 */ 1615, 1614, 1518, 1516, 1527, 1532, 1533, 1618, 1616, 1637, }; #define YY_REDUCE_COUNT (350) #define YY_REDUCE_MIN (-225) #define YY_REDUCE_MAX (1375) static const short yy_reduce_ofst[] = { /* 0 */ -137, -31, 1104, 1023, 1081, -132, -40, -38, 223, 225, /* 10 */ 698, -153, -99, -225, -165, 386, 478, 843, 859, -139, /* 20 */ 884, 117, 277, 844, 857, 964, 559, 561, 614, 918, /* 30 */ 1009, 1089, 1098, -222, -222, -222, -222, -222, -222, -222, /* 40 */ -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, /* 50 */ -222, -222, -222, -222, -222, -222, -222, -222, -222, -222, /* 60 */ -222, -222, -222, -222, -222, 329, 331, 497, 654, 656, /* 70 */ 781, 891, 946, 1029, 1129, 1134, 1149, 1154, 1160, 1162, /* 80 */ 1164, 1168, 1174, 1177, 1188, 1191, 1193, 1202, 1204, 1206, /* 90 */ 1208, 1216, 1218, 1221, 1231, 1233, 1235, 1241, 1244, 1246, /* 100 */ 1248, 1250, 1258, 1260, 1275, 1277, 1283, 1286, 1288, 1290, /* 110 */ 1292, -222, -222, -222, -222, -222, -222, -222, -222, -222, /* 120 */ -115, 796, -156, -154, -141, 14, 242, 349, 242, 349, /* 130 */ -61, -222, -222, -222, -222, -222, 101, 101, 101, 332, /* 140 */ 302, 384, 387, -170, 146, 344, 196, 196, 15, 11, /* 150 */ 183, 235, 395, 355, 396, 406, 452, 457, 391, 459, /* 160 */ 443, 447, 511, 495, 454, 512, 505, 571, 498, 532, /* 170 */ 431, 435, 339, 455, 446, 508, -174, -116, -97, -120, /* 180 */ -150, 64, 176, 330, 337, 509, 569, 611, 653, 673, /* 190 */ 714, 717, 763, 771, -34, 779, 786, 830, 846, 860, /* 200 */ 866, 882, 883, 890, 892, 895, 902, 319, 368, 769, /* 210 */ 915, 924, 925, 932, 755, 936, 945, 963, 782, 969, /* 220 */ 974, 816, 977, 64, 982, 983, 1016, 1022, 1024, 1031, /* 230 */ 870, 831, 913, 966, 973, 981, 984, 755, 913, 913, /* 240 */ 1000, 1041, 1063, 1015, 1010, 1011, 985, 1034, 1057, 1019, /* 250 */ 1086, 1080, 1085, 1093, 1095, 1096, 1067, 1048, 1082, 1099, /* 260 */ 1137, 1050, 1150, 1156, 1077, 1088, 1180, 1120, 1132, 1169, /* 270 */ 1170, 1178, 1181, 1195, 1210, 1225, 1243, 1197, 1209, 1173, /* 280 */ 1190, 1226, 1238, 1223, 1267, 1272, 1199, 1207, 1282, 1285, /* 290 */ 1269, 1293, 1295, 1296, 1300, 1289, 1294, 1297, 1299, 1287, /* 300 */ 1301, 1302, 1303, 1306, 1304, 1307, 1308, 1310, 1242, 1245, /* 310 */ 1311, 1268, 1270, 1273, 1278, 1274, 1279, 1280, 1284, 1333, /* 320 */ 1271, 1337, 1281, 1309, 1305, 1312, 1314, 1316, 1344, 1347, /* 330 */ 1359, 1361, 1368, 1370, 1371, 1291, 1313, 1317, 1355, 1352, /* 340 */ 1353, 1354, 1356, 1363, 1350, 1357, 1362, 1366, 1367, 1375, /* 350 */ 1365, }; static const YYACTIONTYPE yy_default[] = { /* 0 */ 1389, 1389, 1389, 1261, 1046, 1151, 1261, 1261, 1261, 1261, /* 10 */ 1046, 1181, 1181, 1312, 1077, 1046, 1046, 1046, 1046, 1046, /* 20 */ 1046, 1260, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, /* 30 */ 1046, 1046, 1046, 1187, 1046, 1046, 1046, 1046, 1262, 1263, /* 40 */ 1046, 1046, 1046, 1311, 1313, 1197, 1196, 1195, 1194, 1294, /* 50 */ 1168, 1192, 1185, 1189, 1256, 1257, 1255, 1259, 1262, 1263, /* 60 */ 1046, 1188, 1226, 1240, 1225, 1046, 1046, 1046, 1046, 1046, /* 70 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, /* 80 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, /* 90 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, /* 100 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, /* 110 */ 1046, 1234, 1239, 1246, 1238, 1235, 1228, 1227, 1229, 1230, /* 120 */ 1046, 1067, 1116, 1046, 1046, 1046, 1329, 1328, 1046, 1046, /* 130 */ 1077, 1231, 1232, 1243, 1242, 1241, 1319, 1345, 1344, 1046, /* 140 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, /* 150 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, /* 160 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1077, /* 170 */ 1073, 1073, 1046, 1324, 1151, 1142, 1046, 1046, 1046, 1046, /* 180 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1316, 1314, 1046, /* 190 */ 1276, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, /* 200 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, /* 210 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1147, 1046, /* 220 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1339, /* 230 */ 1046, 1289, 1130, 1147, 1147, 1147, 1147, 1149, 1131, 1129, /* 240 */ 1141, 1077, 1053, 1191, 1170, 1170, 1378, 1191, 1191, 1378, /* 250 */ 1091, 1359, 1088, 1181, 1181, 1181, 1170, 1258, 1148, 1141, /* 260 */ 1046, 1381, 1156, 1156, 1380, 1380, 1156, 1200, 1206, 1119, /* 270 */ 1191, 1125, 1125, 1125, 1125, 1156, 1064, 1191, 1191, 1200, /* 280 */ 1206, 1119, 1119, 1191, 1156, 1064, 1293, 1375, 1156, 1064, /* 290 */ 1269, 1156, 1064, 1156, 1064, 1269, 1117, 1117, 1117, 1106, /* 300 */ 1269, 1117, 1091, 1117, 1106, 1117, 1117, 1269, 1273, 1273, /* 310 */ 1269, 1174, 1169, 1174, 1169, 1174, 1169, 1174, 1169, 1156, /* 320 */ 1264, 1156, 1046, 1186, 1175, 1184, 1182, 1191, 1070, 1109, /* 330 */ 1342, 1342, 1338, 1338, 1338, 1386, 1386, 1324, 1354, 1077, /* 340 */ 1077, 1077, 1077, 1354, 1093, 1093, 1077, 1077, 1077, 1077, /* 350 */ 1354, 1046, 1046, 1046, 1046, 1046, 1046, 1349, 1046, 1278, /* 360 */ 1160, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, /* 370 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, /* 380 */ 1046, 1046, 1211, 1046, 1049, 1321, 1046, 1046, 1320, 1046, /* 390 */ 1046, 1046, 1046, 1046, 1046, 1161, 1046, 1046, 1046, 1046, /* 400 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, /* 410 */ 1046, 1046, 1046, 1046, 1377, 1046, 1046, 1046, 1046, 1046, /* 420 */ 1046, 1292, 1291, 1046, 1046, 1158, 1046, 1046, 1046, 1046, /* 430 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, /* 440 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, /* 450 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, /* 460 */ 1183, 1046, 1176, 1046, 1046, 1046, 1046, 1368, 1046, 1046, /* 470 */ 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, 1046, /* 480 */ 1046, 1363, 1133, 1213, 1046, 1212, 1216, 1046, 1058, 1046, }; /********** 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. |
︙ | ︙ | |||
140660 140661 140662 140663 140664 140665 140666 140667 140668 140669 140670 140671 140672 140673 | 0, /* GT => nothing */ 0, /* LE => nothing */ 0, /* LT => nothing */ 0, /* GE => nothing */ 0, /* ESCAPE => nothing */ 0, /* ID => nothing */ 59, /* COLUMNKW => ID */ 59, /* FOR => ID */ 59, /* IGNORE => ID */ 59, /* INITIALLY => ID */ 59, /* INSTEAD => ID */ 59, /* NO => ID */ 59, /* KEY => ID */ 59, /* OF => ID */ | > | 141553 141554 141555 141556 141557 141558 141559 141560 141561 141562 141563 141564 141565 141566 141567 | 0, /* GT => nothing */ 0, /* LE => nothing */ 0, /* LT => nothing */ 0, /* GE => nothing */ 0, /* ESCAPE => nothing */ 0, /* ID => nothing */ 59, /* COLUMNKW => ID */ 59, /* DO => ID */ 59, /* FOR => ID */ 59, /* IGNORE => ID */ 59, /* INITIALLY => ID */ 59, /* INSTEAD => ID */ 59, /* NO => ID */ 59, /* KEY => ID */ 59, /* OF => ID */ |
︙ | ︙ | |||
140721 140722 140723 140724 140725 140726 140727 140728 140729 140730 140731 140732 140733 140734 | #ifdef YYTRACKMAXSTACKDEPTH int yyhwm; /* High-water mark of the stack */ #endif #ifndef YYNOERRORRECOVERY int yyerrcnt; /* Shifts left before out of the error */ #endif sqlite3ParserARG_SDECL /* A place to hold %extra_argument */ #if YYSTACKDEPTH<=0 int yystksz; /* Current side of the stack */ yyStackEntry *yystack; /* The parser's stack */ yyStackEntry yystk0; /* First stack entry */ #else yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ yyStackEntry *yystackEnd; /* Last entry in the stack */ | > | 141615 141616 141617 141618 141619 141620 141621 141622 141623 141624 141625 141626 141627 141628 141629 | #ifdef YYTRACKMAXSTACKDEPTH int yyhwm; /* High-water mark of the stack */ #endif #ifndef YYNOERRORRECOVERY int yyerrcnt; /* Shifts left before out of the error */ #endif sqlite3ParserARG_SDECL /* A place to hold %extra_argument */ sqlite3ParserCTX_SDECL /* A place to hold %extra_context */ #if YYSTACKDEPTH<=0 int yystksz; /* Current side of the stack */ yyStackEntry *yystack; /* The parser's stack */ yyStackEntry yystk0; /* First stack entry */ #else yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ yyStackEntry *yystackEnd; /* Last entry in the stack */ |
︙ | ︙ | |||
140829 140830 140831 140832 140833 140834 140835 | /* 54 */ "GT", /* 55 */ "LE", /* 56 */ "LT", /* 57 */ "GE", /* 58 */ "ESCAPE", /* 59 */ "ID", /* 60 */ "COLUMNKW", | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > | 141724 141725 141726 141727 141728 141729 141730 141731 141732 141733 141734 141735 141736 141737 141738 141739 141740 141741 141742 141743 141744 141745 141746 141747 141748 141749 141750 141751 141752 141753 141754 141755 141756 141757 141758 141759 141760 141761 141762 141763 141764 141765 141766 141767 141768 141769 141770 141771 141772 141773 141774 141775 141776 141777 141778 141779 141780 141781 141782 141783 141784 141785 141786 141787 141788 141789 141790 141791 141792 141793 141794 141795 141796 141797 141798 141799 141800 141801 141802 141803 141804 141805 141806 141807 141808 141809 141810 141811 141812 141813 141814 141815 141816 141817 141818 141819 141820 141821 141822 141823 141824 141825 141826 141827 141828 141829 141830 141831 141832 141833 141834 141835 141836 141837 141838 141839 141840 141841 141842 141843 141844 141845 141846 141847 141848 141849 141850 141851 141852 141853 141854 141855 141856 141857 141858 141859 141860 141861 141862 141863 141864 141865 141866 141867 141868 141869 141870 141871 141872 141873 141874 141875 141876 141877 141878 141879 141880 141881 141882 141883 141884 141885 141886 141887 141888 141889 141890 141891 141892 141893 141894 141895 141896 141897 141898 141899 141900 141901 141902 141903 141904 141905 141906 141907 141908 141909 141910 141911 141912 141913 141914 141915 141916 141917 141918 141919 141920 141921 141922 141923 141924 141925 141926 141927 141928 141929 141930 141931 | /* 54 */ "GT", /* 55 */ "LE", /* 56 */ "LT", /* 57 */ "GE", /* 58 */ "ESCAPE", /* 59 */ "ID", /* 60 */ "COLUMNKW", /* 61 */ "DO", /* 62 */ "FOR", /* 63 */ "IGNORE", /* 64 */ "INITIALLY", /* 65 */ "INSTEAD", /* 66 */ "NO", /* 67 */ "KEY", /* 68 */ "OF", /* 69 */ "OFFSET", /* 70 */ "PRAGMA", /* 71 */ "RAISE", /* 72 */ "RECURSIVE", /* 73 */ "REPLACE", /* 74 */ "RESTRICT", /* 75 */ "ROW", /* 76 */ "TRIGGER", /* 77 */ "VACUUM", /* 78 */ "VIEW", /* 79 */ "VIRTUAL", /* 80 */ "WITH", /* 81 */ "REINDEX", /* 82 */ "RENAME", /* 83 */ "CTIME_KW", /* 84 */ "ANY", /* 85 */ "BITAND", /* 86 */ "BITOR", /* 87 */ "LSHIFT", /* 88 */ "RSHIFT", /* 89 */ "PLUS", /* 90 */ "MINUS", /* 91 */ "STAR", /* 92 */ "SLASH", /* 93 */ "REM", /* 94 */ "CONCAT", /* 95 */ "COLLATE", /* 96 */ "BITNOT", /* 97 */ "ON", /* 98 */ "INDEXED", /* 99 */ "STRING", /* 100 */ "JOIN_KW", /* 101 */ "CONSTRAINT", /* 102 */ "DEFAULT", /* 103 */ "NULL", /* 104 */ "PRIMARY", /* 105 */ "UNIQUE", /* 106 */ "CHECK", /* 107 */ "REFERENCES", /* 108 */ "AUTOINCR", /* 109 */ "INSERT", /* 110 */ "DELETE", /* 111 */ "UPDATE", /* 112 */ "SET", /* 113 */ "DEFERRABLE", /* 114 */ "FOREIGN", /* 115 */ "DROP", /* 116 */ "UNION", /* 117 */ "ALL", /* 118 */ "EXCEPT", /* 119 */ "INTERSECT", /* 120 */ "SELECT", /* 121 */ "VALUES", /* 122 */ "DISTINCT", /* 123 */ "DOT", /* 124 */ "FROM", /* 125 */ "JOIN", /* 126 */ "USING", /* 127 */ "ORDER", /* 128 */ "GROUP", /* 129 */ "HAVING", /* 130 */ "LIMIT", /* 131 */ "WHERE", /* 132 */ "INTO", /* 133 */ "NOTHING", /* 134 */ "FLOAT", /* 135 */ "BLOB", /* 136 */ "INTEGER", /* 137 */ "VARIABLE", /* 138 */ "CASE", /* 139 */ "WHEN", /* 140 */ "THEN", /* 141 */ "ELSE", /* 142 */ "INDEX", /* 143 */ "ALTER", /* 144 */ "ADD", /* 145 */ "input", /* 146 */ "cmdlist", /* 147 */ "ecmd", /* 148 */ "cmdx", /* 149 */ "explain", /* 150 */ "cmd", /* 151 */ "transtype", /* 152 */ "trans_opt", /* 153 */ "nm", /* 154 */ "savepoint_opt", /* 155 */ "create_table", /* 156 */ "create_table_args", /* 157 */ "createkw", /* 158 */ "temp", /* 159 */ "ifnotexists", /* 160 */ "dbnm", /* 161 */ "columnlist", /* 162 */ "conslist_opt", /* 163 */ "table_options", /* 164 */ "select", /* 165 */ "columnname", /* 166 */ "carglist", /* 167 */ "typetoken", /* 168 */ "typename", /* 169 */ "signed", /* 170 */ "plus_num", /* 171 */ "minus_num", /* 172 */ "scanpt", /* 173 */ "ccons", /* 174 */ "term", /* 175 */ "expr", /* 176 */ "onconf", /* 177 */ "sortorder", /* 178 */ "autoinc", /* 179 */ "eidlist_opt", /* 180 */ "refargs", /* 181 */ "defer_subclause", /* 182 */ "refarg", /* 183 */ "refact", /* 184 */ "init_deferred_pred_opt", /* 185 */ "conslist", /* 186 */ "tconscomma", /* 187 */ "tcons", /* 188 */ "sortlist", /* 189 */ "eidlist", /* 190 */ "defer_subclause_opt", /* 191 */ "orconf", /* 192 */ "resolvetype", /* 193 */ "raisetype", /* 194 */ "ifexists", /* 195 */ "fullname", /* 196 */ "selectnowith", /* 197 */ "oneselect", /* 198 */ "wqlist", /* 199 */ "multiselect_op", /* 200 */ "distinct", /* 201 */ "selcollist", /* 202 */ "from", /* 203 */ "where_opt", /* 204 */ "groupby_opt", /* 205 */ "having_opt", /* 206 */ "orderby_opt", /* 207 */ "limit_opt", /* 208 */ "values", /* 209 */ "nexprlist", /* 210 */ "exprlist", /* 211 */ "sclp", /* 212 */ "as", /* 213 */ "seltablist", /* 214 */ "stl_prefix", /* 215 */ "joinop", /* 216 */ "indexed_opt", /* 217 */ "on_opt", /* 218 */ "using_opt", /* 219 */ "xfullname", /* 220 */ "idlist", /* 221 */ "with", /* 222 */ "setlist", /* 223 */ "insert_cmd", /* 224 */ "idlist_opt", /* 225 */ "upsert", /* 226 */ "likeop", /* 227 */ "between_op", /* 228 */ "in_op", /* 229 */ "paren_exprlist", /* 230 */ "case_operand", /* 231 */ "case_exprlist", /* 232 */ "case_else", /* 233 */ "uniqueflag", /* 234 */ "collate", /* 235 */ "nmnum", /* 236 */ "trigger_decl", /* 237 */ "trigger_cmd_list", /* 238 */ "trigger_time", /* 239 */ "trigger_event", /* 240 */ "foreach_clause", /* 241 */ "when_clause", /* 242 */ "trigger_cmd", /* 243 */ "trnm", /* 244 */ "tridxby", /* 245 */ "database_kw_opt", /* 246 */ "key_opt", /* 247 */ "add_column_fullname", /* 248 */ "kwcolumn_opt", /* 249 */ "create_vtab", /* 250 */ "vtabarglist", /* 251 */ "vtabarg", /* 252 */ "vtabargtoken", /* 253 */ "lp", /* 254 */ "anylist", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ #ifndef NDEBUG /* For tracing reduce actions, the names of all rules are required. */ static const char *const yyRuleName[] = { |
︙ | ︙ | |||
141138 141139 141140 141141 141142 141143 141144 | /* 104 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt", /* 105 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt", /* 106 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt", /* 107 */ "dbnm ::=", /* 108 */ "dbnm ::= DOT nm", /* 109 */ "fullname ::= nm", /* 110 */ "fullname ::= nm DOT nm", | > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 142036 142037 142038 142039 142040 142041 142042 142043 142044 142045 142046 142047 142048 142049 142050 142051 142052 142053 142054 142055 142056 142057 142058 142059 142060 142061 142062 142063 142064 142065 142066 142067 142068 142069 142070 142071 142072 142073 142074 142075 142076 142077 142078 142079 142080 142081 142082 142083 142084 142085 142086 142087 142088 142089 142090 142091 142092 142093 142094 142095 142096 142097 142098 142099 142100 142101 142102 142103 142104 142105 142106 142107 142108 142109 142110 142111 142112 142113 142114 142115 142116 142117 142118 142119 142120 142121 142122 142123 142124 142125 142126 142127 142128 142129 142130 142131 142132 142133 142134 142135 142136 142137 142138 142139 142140 142141 142142 142143 142144 142145 142146 142147 142148 142149 142150 142151 142152 142153 142154 142155 142156 142157 142158 142159 142160 142161 142162 142163 142164 142165 142166 142167 142168 142169 142170 142171 142172 142173 142174 142175 142176 142177 142178 142179 142180 142181 142182 142183 142184 142185 142186 142187 142188 142189 142190 142191 142192 142193 142194 142195 142196 142197 142198 142199 142200 142201 142202 142203 142204 142205 142206 142207 142208 142209 142210 142211 142212 142213 142214 142215 142216 142217 142218 142219 142220 142221 142222 142223 142224 142225 142226 142227 142228 142229 142230 142231 142232 142233 142234 142235 142236 142237 142238 142239 142240 142241 142242 142243 142244 142245 142246 142247 142248 142249 142250 142251 142252 142253 142254 142255 142256 142257 142258 142259 142260 142261 142262 142263 142264 142265 142266 142267 142268 142269 142270 142271 142272 142273 142274 142275 142276 142277 142278 142279 | /* 104 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt", /* 105 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt", /* 106 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt", /* 107 */ "dbnm ::=", /* 108 */ "dbnm ::= DOT nm", /* 109 */ "fullname ::= nm", /* 110 */ "fullname ::= nm DOT nm", /* 111 */ "xfullname ::= nm", /* 112 */ "xfullname ::= nm DOT nm", /* 113 */ "xfullname ::= nm DOT nm AS nm", /* 114 */ "xfullname ::= nm AS nm", /* 115 */ "joinop ::= COMMA|JOIN", /* 116 */ "joinop ::= JOIN_KW JOIN", /* 117 */ "joinop ::= JOIN_KW nm JOIN", /* 118 */ "joinop ::= JOIN_KW nm nm JOIN", /* 119 */ "on_opt ::= ON expr", /* 120 */ "on_opt ::=", /* 121 */ "indexed_opt ::=", /* 122 */ "indexed_opt ::= INDEXED BY nm", /* 123 */ "indexed_opt ::= NOT INDEXED", /* 124 */ "using_opt ::= USING LP idlist RP", /* 125 */ "using_opt ::=", /* 126 */ "orderby_opt ::=", /* 127 */ "orderby_opt ::= ORDER BY sortlist", /* 128 */ "sortlist ::= sortlist COMMA expr sortorder", /* 129 */ "sortlist ::= expr sortorder", /* 130 */ "sortorder ::= ASC", /* 131 */ "sortorder ::= DESC", /* 132 */ "sortorder ::=", /* 133 */ "groupby_opt ::=", /* 134 */ "groupby_opt ::= GROUP BY nexprlist", /* 135 */ "having_opt ::=", /* 136 */ "having_opt ::= HAVING expr", /* 137 */ "limit_opt ::=", /* 138 */ "limit_opt ::= LIMIT expr", /* 139 */ "limit_opt ::= LIMIT expr OFFSET expr", /* 140 */ "limit_opt ::= LIMIT expr COMMA expr", /* 141 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt", /* 142 */ "where_opt ::=", /* 143 */ "where_opt ::= WHERE expr", /* 144 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt", /* 145 */ "setlist ::= setlist COMMA nm EQ expr", /* 146 */ "setlist ::= setlist COMMA LP idlist RP EQ expr", /* 147 */ "setlist ::= nm EQ expr", /* 148 */ "setlist ::= LP idlist RP EQ expr", /* 149 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert", /* 150 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES", /* 151 */ "upsert ::=", /* 152 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt", /* 153 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING", /* 154 */ "upsert ::= ON CONFLICT DO NOTHING", /* 155 */ "insert_cmd ::= INSERT orconf", /* 156 */ "insert_cmd ::= REPLACE", /* 157 */ "idlist_opt ::=", /* 158 */ "idlist_opt ::= LP idlist RP", /* 159 */ "idlist ::= idlist COMMA nm", /* 160 */ "idlist ::= nm", /* 161 */ "expr ::= LP expr RP", /* 162 */ "expr ::= ID|INDEXED", /* 163 */ "expr ::= JOIN_KW", /* 164 */ "expr ::= nm DOT nm", /* 165 */ "expr ::= nm DOT nm DOT nm", /* 166 */ "term ::= NULL|FLOAT|BLOB", /* 167 */ "term ::= STRING", /* 168 */ "term ::= INTEGER", /* 169 */ "expr ::= VARIABLE", /* 170 */ "expr ::= expr COLLATE ID|STRING", /* 171 */ "expr ::= CAST LP expr AS typetoken RP", /* 172 */ "expr ::= ID|INDEXED LP distinct exprlist RP", /* 173 */ "expr ::= ID|INDEXED LP STAR RP", /* 174 */ "term ::= CTIME_KW", /* 175 */ "expr ::= LP nexprlist COMMA expr RP", /* 176 */ "expr ::= expr AND expr", /* 177 */ "expr ::= expr OR expr", /* 178 */ "expr ::= expr LT|GT|GE|LE expr", /* 179 */ "expr ::= expr EQ|NE expr", /* 180 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", /* 181 */ "expr ::= expr PLUS|MINUS expr", /* 182 */ "expr ::= expr STAR|SLASH|REM expr", /* 183 */ "expr ::= expr CONCAT expr", /* 184 */ "likeop ::= NOT LIKE_KW|MATCH", /* 185 */ "expr ::= expr likeop expr", /* 186 */ "expr ::= expr likeop expr ESCAPE expr", /* 187 */ "expr ::= expr ISNULL|NOTNULL", /* 188 */ "expr ::= expr NOT NULL", /* 189 */ "expr ::= expr IS expr", /* 190 */ "expr ::= expr IS NOT expr", /* 191 */ "expr ::= NOT expr", /* 192 */ "expr ::= BITNOT expr", /* 193 */ "expr ::= MINUS expr", /* 194 */ "expr ::= PLUS expr", /* 195 */ "between_op ::= BETWEEN", /* 196 */ "between_op ::= NOT BETWEEN", /* 197 */ "expr ::= expr between_op expr AND expr", /* 198 */ "in_op ::= IN", /* 199 */ "in_op ::= NOT IN", /* 200 */ "expr ::= expr in_op LP exprlist RP", /* 201 */ "expr ::= LP select RP", /* 202 */ "expr ::= expr in_op LP select RP", /* 203 */ "expr ::= expr in_op nm dbnm paren_exprlist", /* 204 */ "expr ::= EXISTS LP select RP", /* 205 */ "expr ::= CASE case_operand case_exprlist case_else END", /* 206 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", /* 207 */ "case_exprlist ::= WHEN expr THEN expr", /* 208 */ "case_else ::= ELSE expr", /* 209 */ "case_else ::=", /* 210 */ "case_operand ::= expr", /* 211 */ "case_operand ::=", /* 212 */ "exprlist ::=", /* 213 */ "nexprlist ::= nexprlist COMMA expr", /* 214 */ "nexprlist ::= expr", /* 215 */ "paren_exprlist ::=", /* 216 */ "paren_exprlist ::= LP exprlist RP", /* 217 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", /* 218 */ "uniqueflag ::= UNIQUE", /* 219 */ "uniqueflag ::=", /* 220 */ "eidlist_opt ::=", /* 221 */ "eidlist_opt ::= LP eidlist RP", /* 222 */ "eidlist ::= eidlist COMMA nm collate sortorder", /* 223 */ "eidlist ::= nm collate sortorder", /* 224 */ "collate ::=", /* 225 */ "collate ::= COLLATE ID|STRING", /* 226 */ "cmd ::= DROP INDEX ifexists fullname", /* 227 */ "cmd ::= VACUUM", /* 228 */ "cmd ::= VACUUM nm", /* 229 */ "cmd ::= PRAGMA nm dbnm", /* 230 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", /* 231 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", /* 232 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", /* 233 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", /* 234 */ "plus_num ::= PLUS INTEGER|FLOAT", /* 235 */ "minus_num ::= MINUS INTEGER|FLOAT", /* 236 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", /* 237 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", /* 238 */ "trigger_time ::= BEFORE|AFTER", /* 239 */ "trigger_time ::= INSTEAD OF", /* 240 */ "trigger_time ::=", /* 241 */ "trigger_event ::= DELETE|INSERT", /* 242 */ "trigger_event ::= UPDATE", /* 243 */ "trigger_event ::= UPDATE OF idlist", /* 244 */ "when_clause ::=", /* 245 */ "when_clause ::= WHEN expr", /* 246 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", /* 247 */ "trigger_cmd_list ::= trigger_cmd SEMI", /* 248 */ "trnm ::= nm DOT nm", /* 249 */ "tridxby ::= INDEXED BY nm", /* 250 */ "tridxby ::= NOT INDEXED", /* 251 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt", /* 252 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", /* 253 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", /* 254 */ "trigger_cmd ::= scanpt select scanpt", /* 255 */ "expr ::= RAISE LP IGNORE RP", /* 256 */ "expr ::= RAISE LP raisetype COMMA nm RP", /* 257 */ "raisetype ::= ROLLBACK", /* 258 */ "raisetype ::= ABORT", /* 259 */ "raisetype ::= FAIL", /* 260 */ "cmd ::= DROP TRIGGER ifexists fullname", /* 261 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", /* 262 */ "cmd ::= DETACH database_kw_opt expr", /* 263 */ "key_opt ::=", /* 264 */ "key_opt ::= KEY expr", /* 265 */ "cmd ::= REINDEX", /* 266 */ "cmd ::= REINDEX nm dbnm", /* 267 */ "cmd ::= ANALYZE", /* 268 */ "cmd ::= ANALYZE nm dbnm", /* 269 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", /* 270 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", /* 271 */ "add_column_fullname ::= fullname", /* 272 */ "cmd ::= create_vtab", /* 273 */ "cmd ::= create_vtab LP vtabarglist RP", /* 274 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", /* 275 */ "vtabarg ::=", /* 276 */ "vtabargtoken ::= ANY", /* 277 */ "vtabargtoken ::= lp anylist RP", /* 278 */ "lp ::= LP", /* 279 */ "with ::= WITH wqlist", /* 280 */ "with ::= WITH RECURSIVE wqlist", /* 281 */ "wqlist ::= nm eidlist_opt AS LP select RP", /* 282 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", /* 283 */ "input ::= cmdlist", /* 284 */ "cmdlist ::= cmdlist ecmd", /* 285 */ "cmdlist ::= ecmd", /* 286 */ "ecmd ::= SEMI", /* 287 */ "ecmd ::= cmdx SEMI", /* 288 */ "ecmd ::= explain cmdx", /* 289 */ "trans_opt ::=", /* 290 */ "trans_opt ::= TRANSACTION", /* 291 */ "trans_opt ::= TRANSACTION nm", /* 292 */ "savepoint_opt ::= SAVEPOINT", /* 293 */ "savepoint_opt ::=", /* 294 */ "cmd ::= create_table create_table_args", /* 295 */ "columnlist ::= columnlist COMMA columnname carglist", /* 296 */ "columnlist ::= columnname carglist", /* 297 */ "nm ::= ID|INDEXED", /* 298 */ "nm ::= STRING", /* 299 */ "nm ::= JOIN_KW", /* 300 */ "typetoken ::= typename", /* 301 */ "typename ::= ID|STRING", /* 302 */ "signed ::= plus_num", /* 303 */ "signed ::= minus_num", /* 304 */ "carglist ::= carglist ccons", /* 305 */ "carglist ::=", /* 306 */ "ccons ::= NULL onconf", /* 307 */ "conslist_opt ::= COMMA conslist", /* 308 */ "conslist ::= conslist tconscomma tcons", /* 309 */ "conslist ::= tcons", /* 310 */ "tconscomma ::=", /* 311 */ "defer_subclause_opt ::= defer_subclause", /* 312 */ "resolvetype ::= raisetype", /* 313 */ "selectnowith ::= oneselect", /* 314 */ "oneselect ::= values", /* 315 */ "sclp ::= selcollist COMMA", /* 316 */ "as ::= ID|STRING", /* 317 */ "expr ::= term", /* 318 */ "likeop ::= LIKE_KW|MATCH", /* 319 */ "exprlist ::= nexprlist", /* 320 */ "nmnum ::= plus_num", /* 321 */ "nmnum ::= nm", /* 322 */ "nmnum ::= ON", /* 323 */ "nmnum ::= DELETE", /* 324 */ "nmnum ::= DEFAULT", /* 325 */ "plus_num ::= INTEGER|FLOAT", /* 326 */ "foreach_clause ::=", /* 327 */ "foreach_clause ::= FOR EACH ROW", /* 328 */ "trnm ::= nm", /* 329 */ "tridxby ::=", /* 330 */ "database_kw_opt ::= DATABASE", /* 331 */ "database_kw_opt ::=", /* 332 */ "kwcolumn_opt ::=", /* 333 */ "kwcolumn_opt ::= COLUMNKW", /* 334 */ "vtabarglist ::= vtabarg", /* 335 */ "vtabarglist ::= vtabarglist COMMA vtabarg", /* 336 */ "vtabarg ::= vtabarg vtabargtoken", /* 337 */ "anylist ::=", /* 338 */ "anylist ::= anylist LP anylist RP", /* 339 */ "anylist ::= anylist ANY", /* 340 */ "with ::=", }; #endif /* NDEBUG */ #if YYSTACKDEPTH<=0 /* ** Try to increase the size of the parser stack. Return the number |
︙ | ︙ | |||
141408 141409 141410 141411 141412 141413 141414 | */ #ifndef YYMALLOCARGTYPE # define YYMALLOCARGTYPE size_t #endif /* Initialize a new parser that has already been allocated. */ | | | > | | | | | | | | | | | | | | | > | > > | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | | | | | | | 142314 142315 142316 142317 142318 142319 142320 142321 142322 142323 142324 142325 142326 142327 142328 142329 142330 142331 142332 142333 142334 142335 142336 142337 142338 142339 142340 142341 142342 142343 142344 142345 142346 142347 142348 142349 142350 142351 142352 142353 142354 142355 142356 142357 142358 142359 142360 142361 142362 142363 142364 142365 142366 142367 142368 142369 142370 142371 142372 142373 142374 142375 142376 142377 142378 142379 142380 142381 142382 142383 142384 142385 142386 142387 142388 142389 142390 142391 142392 142393 142394 142395 142396 142397 142398 142399 142400 142401 142402 142403 142404 142405 142406 142407 142408 142409 142410 142411 142412 142413 142414 142415 142416 142417 142418 142419 142420 142421 142422 142423 142424 142425 142426 142427 142428 142429 142430 142431 142432 142433 142434 142435 142436 142437 142438 142439 142440 142441 142442 142443 142444 142445 142446 142447 142448 142449 142450 142451 142452 142453 142454 142455 142456 142457 142458 142459 142460 142461 142462 142463 142464 142465 142466 142467 142468 142469 142470 142471 | */ #ifndef YYMALLOCARGTYPE # define YYMALLOCARGTYPE size_t #endif /* Initialize a new parser that has already been allocated. */ SQLITE_PRIVATE void sqlite3ParserInit(void *yypRawParser sqlite3ParserCTX_PDECL){ yyParser *yypParser = (yyParser*)yypRawParser; sqlite3ParserCTX_STORE #ifdef YYTRACKMAXSTACKDEPTH yypParser->yyhwm = 0; #endif #if YYSTACKDEPTH<=0 yypParser->yytos = NULL; yypParser->yystack = NULL; yypParser->yystksz = 0; if( yyGrowStack(yypParser) ){ yypParser->yystack = &yypParser->yystk0; yypParser->yystksz = 1; } #endif #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt = -1; #endif yypParser->yytos = yypParser->yystack; yypParser->yystack[0].stateno = 0; yypParser->yystack[0].major = 0; #if YYSTACKDEPTH>0 yypParser->yystackEnd = &yypParser->yystack[YYSTACKDEPTH-1]; #endif } #ifndef sqlite3Parser_ENGINEALWAYSONSTACK /* ** This function allocates a new parser. ** The only argument is a pointer to a function which works like ** malloc. ** ** Inputs: ** A pointer to the function used to allocate memory. ** ** Outputs: ** A pointer to a parser. This pointer is used in subsequent calls ** to sqlite3Parser and sqlite3ParserFree. */ SQLITE_PRIVATE void *sqlite3ParserAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) sqlite3ParserCTX_PDECL){ yyParser *yypParser; yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); if( yypParser ){ sqlite3ParserCTX_STORE sqlite3ParserInit(yypParser sqlite3ParserCTX_PARAM); } return (void*)yypParser; } #endif /* sqlite3Parser_ENGINEALWAYSONSTACK */ /* The following function deletes the "minor type" or semantic value ** associated with a symbol. The symbol can be either a terminal ** or nonterminal. "yymajor" is the symbol code, and "yypminor" is ** a pointer to the value to be deleted. The code used to do the ** deletions is derived from the %destructor and/or %token_destructor ** directives of the input grammar. */ static void yy_destructor( yyParser *yypParser, /* The parser */ YYCODETYPE yymajor, /* Type code for object to destroy */ YYMINORTYPE *yypminor /* The object to be destroyed */ ){ sqlite3ParserARG_FETCH sqlite3ParserCTX_FETCH switch( yymajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen ** when the symbol is popped from the stack during a ** reduce or during error processing or when a parser is ** being destroyed before it is finished parsing. ** ** Note: during a reduce, the only symbols destroyed are those ** which appear on the RHS of the rule, but which are *not* used ** inside the C code. */ /********* Begin destructor definitions ***************************************/ case 164: /* select */ case 196: /* selectnowith */ case 197: /* oneselect */ case 208: /* values */ { sqlite3SelectDelete(pParse->db, (yypminor->yy399)); } break; case 174: /* term */ case 175: /* expr */ case 203: /* where_opt */ case 205: /* having_opt */ case 217: /* on_opt */ case 230: /* case_operand */ case 232: /* case_else */ case 241: /* when_clause */ case 246: /* key_opt */ { sqlite3ExprDelete(pParse->db, (yypminor->yy182)); } break; case 179: /* eidlist_opt */ case 188: /* sortlist */ case 189: /* eidlist */ case 201: /* selcollist */ case 204: /* groupby_opt */ case 206: /* orderby_opt */ case 209: /* nexprlist */ case 210: /* exprlist */ case 211: /* sclp */ case 222: /* setlist */ case 229: /* paren_exprlist */ case 231: /* case_exprlist */ { sqlite3ExprListDelete(pParse->db, (yypminor->yy232)); } break; case 195: /* fullname */ case 202: /* from */ case 213: /* seltablist */ case 214: /* stl_prefix */ case 219: /* xfullname */ { sqlite3SrcListDelete(pParse->db, (yypminor->yy427)); } break; case 198: /* wqlist */ { sqlite3WithDelete(pParse->db, (yypminor->yy91)); } break; case 218: /* using_opt */ case 220: /* idlist */ case 224: /* idlist_opt */ { sqlite3IdListDelete(pParse->db, (yypminor->yy510)); } break; case 237: /* trigger_cmd_list */ case 242: /* trigger_cmd */ { sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy47)); } break; case 239: /* trigger_event */ { sqlite3IdListDelete(pParse->db, (yypminor->yy300).b); } break; /********* End destructor definitions *****************************************/ default: break; /* If no destructor action specified: do nothing */ } } |
︙ | ︙ | |||
141657 141658 141659 141660 141661 141662 141663 | } #endif /* ** Find the appropriate action for a parser given the terminal ** look-ahead token iLookAhead. */ | | < | > < | | 142569 142570 142571 142572 142573 142574 142575 142576 142577 142578 142579 142580 142581 142582 142583 142584 142585 142586 142587 142588 | } #endif /* ** Find the appropriate action for a parser given the terminal ** look-ahead token iLookAhead. */ static YYACTIONTYPE yy_find_shift_action( YYCODETYPE iLookAhead, /* The look-ahead token */ YYACTIONTYPE stateno /* Current state number */ ){ int i; if( stateno>YY_MAX_SHIFT ) return stateno; assert( stateno <= YY_SHIFT_COUNT ); #if defined(YYCOVERAGE) yycoverage[stateno][iLookAhead] = 1; #endif do{ i = yy_shift_ofst[stateno]; |
︙ | ︙ | |||
141727 141728 141729 141730 141731 141732 141733 | } /* ** Find the appropriate action for a parser given the non-terminal ** look-ahead token iLookAhead. */ static int yy_find_reduce_action( | | | 142638 142639 142640 142641 142642 142643 142644 142645 142646 142647 142648 142649 142650 142651 142652 | } /* ** Find the appropriate action for a parser given the non-terminal ** look-ahead token iLookAhead. */ static int yy_find_reduce_action( YYACTIONTYPE stateno, /* Current state number */ YYCODETYPE iLookAhead /* The look-ahead token */ ){ int i; #ifdef YYERRORSYMBOL if( stateno>YY_REDUCE_COUNT ){ return yy_default[stateno]; } |
︙ | ︙ | |||
141756 141757 141758 141759 141760 141761 141762 | return yy_action[i]; } /* ** The following routine is called if the stack overflows. */ static void yyStackOverflow(yyParser *yypParser){ | | > | > | 142667 142668 142669 142670 142671 142672 142673 142674 142675 142676 142677 142678 142679 142680 142681 142682 142683 142684 142685 142686 142687 142688 142689 142690 142691 142692 142693 142694 142695 142696 | return yy_action[i]; } /* ** The following routine is called if the stack overflows. */ static void yyStackOverflow(yyParser *yypParser){ sqlite3ParserARG_FETCH sqlite3ParserCTX_FETCH #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); } #endif while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ sqlite3ErrorMsg(pParse, "parser stack overflow"); /******** End %stack_overflow code ********************************************/ sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument var */ sqlite3ParserCTX_STORE } /* ** Print tracing information for a SHIFT action */ #ifndef NDEBUG static void yyTraceShift(yyParser *yypParser, int yyNewState, const char *zTag){ |
︙ | ︙ | |||
141798 141799 141800 141801 141802 141803 141804 | #endif /* ** Perform a shift action. */ static void yy_shift( yyParser *yypParser, /* The parser to be shifted */ | | | | 142711 142712 142713 142714 142715 142716 142717 142718 142719 142720 142721 142722 142723 142724 142725 142726 | #endif /* ** Perform a shift action. */ static void yy_shift( yyParser *yypParser, /* The parser to be shifted */ YYACTIONTYPE yyNewState, /* The new state to shift in */ YYCODETYPE yyMajor, /* The major token to shift in */ sqlite3ParserTOKENTYPE yyMinor /* The minor token to shift in */ ){ yyStackEntry *yytos; yypParser->yytos++; #ifdef YYTRACKMAXSTACKDEPTH if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ yypParser->yyhwm++; |
︙ | ︙ | |||
141829 141830 141831 141832 141833 141834 141835 | } } #endif if( yyNewState > YY_MAX_SHIFT ){ yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; } yytos = yypParser->yytos; | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | < | | | > > > > > > | < < < < < < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | 142742 142743 142744 142745 142746 142747 142748 142749 142750 142751 142752 142753 142754 142755 142756 142757 142758 142759 142760 142761 142762 142763 142764 142765 142766 142767 142768 142769 142770 142771 142772 142773 142774 142775 142776 142777 142778 142779 142780 142781 142782 142783 142784 142785 142786 142787 142788 142789 142790 142791 142792 142793 142794 142795 142796 142797 142798 142799 142800 142801 142802 142803 142804 142805 142806 142807 142808 142809 142810 142811 142812 142813 142814 142815 142816 142817 142818 142819 142820 142821 142822 142823 142824 142825 142826 142827 142828 142829 142830 142831 142832 142833 142834 142835 142836 142837 142838 142839 142840 142841 142842 142843 142844 142845 142846 142847 142848 142849 142850 142851 142852 142853 142854 142855 142856 142857 142858 142859 142860 142861 142862 142863 142864 142865 142866 142867 142868 142869 142870 142871 142872 142873 142874 142875 142876 142877 142878 142879 142880 142881 142882 142883 142884 142885 142886 142887 142888 142889 142890 142891 142892 142893 142894 142895 142896 142897 142898 142899 142900 142901 142902 142903 142904 142905 142906 142907 142908 142909 142910 142911 142912 142913 142914 142915 142916 142917 142918 142919 142920 142921 142922 142923 142924 142925 142926 142927 142928 142929 142930 142931 142932 142933 142934 142935 142936 142937 142938 142939 142940 142941 142942 142943 142944 142945 142946 142947 142948 142949 142950 142951 142952 142953 142954 142955 142956 142957 142958 142959 142960 142961 142962 142963 142964 142965 142966 142967 142968 142969 142970 142971 142972 142973 142974 142975 142976 142977 142978 142979 142980 142981 142982 142983 142984 142985 142986 142987 142988 142989 142990 142991 142992 142993 142994 142995 142996 142997 142998 142999 143000 143001 143002 143003 143004 143005 143006 143007 143008 143009 143010 143011 143012 143013 143014 143015 143016 143017 143018 143019 143020 143021 143022 143023 143024 143025 143026 143027 143028 143029 143030 143031 143032 143033 143034 143035 143036 143037 143038 143039 143040 143041 143042 143043 143044 143045 143046 143047 143048 143049 143050 143051 143052 143053 143054 143055 143056 143057 143058 143059 143060 143061 143062 143063 143064 143065 143066 143067 143068 143069 143070 143071 143072 143073 143074 143075 143076 143077 143078 143079 143080 143081 143082 143083 143084 143085 143086 143087 143088 143089 143090 143091 143092 143093 143094 143095 143096 143097 143098 143099 143100 143101 143102 143103 143104 143105 143106 143107 143108 143109 143110 143111 143112 143113 143114 143115 143116 143117 143118 143119 143120 143121 143122 143123 143124 143125 143126 143127 143128 143129 143130 143131 143132 143133 143134 143135 | } } #endif if( yyNewState > YY_MAX_SHIFT ){ yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; } yytos = yypParser->yytos; yytos->stateno = yyNewState; yytos->major = yyMajor; yytos->minor.yy0 = yyMinor; yyTraceShift(yypParser, yyNewState, "Shift"); } /* The following table contains information about every rule that ** is used during the reduce. */ static const struct { YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } yyRuleInfo[] = { { 149, -1 }, /* (0) explain ::= EXPLAIN */ { 149, -3 }, /* (1) explain ::= EXPLAIN QUERY PLAN */ { 148, -1 }, /* (2) cmdx ::= cmd */ { 150, -3 }, /* (3) cmd ::= BEGIN transtype trans_opt */ { 151, 0 }, /* (4) transtype ::= */ { 151, -1 }, /* (5) transtype ::= DEFERRED */ { 151, -1 }, /* (6) transtype ::= IMMEDIATE */ { 151, -1 }, /* (7) transtype ::= EXCLUSIVE */ { 150, -2 }, /* (8) cmd ::= COMMIT|END trans_opt */ { 150, -2 }, /* (9) cmd ::= ROLLBACK trans_opt */ { 150, -2 }, /* (10) cmd ::= SAVEPOINT nm */ { 150, -3 }, /* (11) cmd ::= RELEASE savepoint_opt nm */ { 150, -5 }, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ { 155, -6 }, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */ { 157, -1 }, /* (14) createkw ::= CREATE */ { 159, 0 }, /* (15) ifnotexists ::= */ { 159, -3 }, /* (16) ifnotexists ::= IF NOT EXISTS */ { 158, -1 }, /* (17) temp ::= TEMP */ { 158, 0 }, /* (18) temp ::= */ { 156, -5 }, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_options */ { 156, -2 }, /* (20) create_table_args ::= AS select */ { 163, 0 }, /* (21) table_options ::= */ { 163, -2 }, /* (22) table_options ::= WITHOUT nm */ { 165, -2 }, /* (23) columnname ::= nm typetoken */ { 167, 0 }, /* (24) typetoken ::= */ { 167, -4 }, /* (25) typetoken ::= typename LP signed RP */ { 167, -6 }, /* (26) typetoken ::= typename LP signed COMMA signed RP */ { 168, -2 }, /* (27) typename ::= typename ID|STRING */ { 172, 0 }, /* (28) scanpt ::= */ { 173, -2 }, /* (29) ccons ::= CONSTRAINT nm */ { 173, -4 }, /* (30) ccons ::= DEFAULT scanpt term scanpt */ { 173, -4 }, /* (31) ccons ::= DEFAULT LP expr RP */ { 173, -4 }, /* (32) ccons ::= DEFAULT PLUS term scanpt */ { 173, -4 }, /* (33) ccons ::= DEFAULT MINUS term scanpt */ { 173, -3 }, /* (34) ccons ::= DEFAULT scanpt ID|INDEXED */ { 173, -3 }, /* (35) ccons ::= NOT NULL onconf */ { 173, -5 }, /* (36) ccons ::= PRIMARY KEY sortorder onconf autoinc */ { 173, -2 }, /* (37) ccons ::= UNIQUE onconf */ { 173, -4 }, /* (38) ccons ::= CHECK LP expr RP */ { 173, -4 }, /* (39) ccons ::= REFERENCES nm eidlist_opt refargs */ { 173, -1 }, /* (40) ccons ::= defer_subclause */ { 173, -2 }, /* (41) ccons ::= COLLATE ID|STRING */ { 178, 0 }, /* (42) autoinc ::= */ { 178, -1 }, /* (43) autoinc ::= AUTOINCR */ { 180, 0 }, /* (44) refargs ::= */ { 180, -2 }, /* (45) refargs ::= refargs refarg */ { 182, -2 }, /* (46) refarg ::= MATCH nm */ { 182, -3 }, /* (47) refarg ::= ON INSERT refact */ { 182, -3 }, /* (48) refarg ::= ON DELETE refact */ { 182, -3 }, /* (49) refarg ::= ON UPDATE refact */ { 183, -2 }, /* (50) refact ::= SET NULL */ { 183, -2 }, /* (51) refact ::= SET DEFAULT */ { 183, -1 }, /* (52) refact ::= CASCADE */ { 183, -1 }, /* (53) refact ::= RESTRICT */ { 183, -2 }, /* (54) refact ::= NO ACTION */ { 181, -3 }, /* (55) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ { 181, -2 }, /* (56) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ { 184, 0 }, /* (57) init_deferred_pred_opt ::= */ { 184, -2 }, /* (58) init_deferred_pred_opt ::= INITIALLY DEFERRED */ { 184, -2 }, /* (59) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ { 162, 0 }, /* (60) conslist_opt ::= */ { 186, -1 }, /* (61) tconscomma ::= COMMA */ { 187, -2 }, /* (62) tcons ::= CONSTRAINT nm */ { 187, -7 }, /* (63) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ { 187, -5 }, /* (64) tcons ::= UNIQUE LP sortlist RP onconf */ { 187, -5 }, /* (65) tcons ::= CHECK LP expr RP onconf */ { 187, -10 }, /* (66) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ { 190, 0 }, /* (67) defer_subclause_opt ::= */ { 176, 0 }, /* (68) onconf ::= */ { 176, -3 }, /* (69) onconf ::= ON CONFLICT resolvetype */ { 191, 0 }, /* (70) orconf ::= */ { 191, -2 }, /* (71) orconf ::= OR resolvetype */ { 192, -1 }, /* (72) resolvetype ::= IGNORE */ { 192, -1 }, /* (73) resolvetype ::= REPLACE */ { 150, -4 }, /* (74) cmd ::= DROP TABLE ifexists fullname */ { 194, -2 }, /* (75) ifexists ::= IF EXISTS */ { 194, 0 }, /* (76) ifexists ::= */ { 150, -9 }, /* (77) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ { 150, -4 }, /* (78) cmd ::= DROP VIEW ifexists fullname */ { 150, -1 }, /* (79) cmd ::= select */ { 164, -3 }, /* (80) select ::= WITH wqlist selectnowith */ { 164, -4 }, /* (81) select ::= WITH RECURSIVE wqlist selectnowith */ { 164, -1 }, /* (82) select ::= selectnowith */ { 196, -3 }, /* (83) selectnowith ::= selectnowith multiselect_op oneselect */ { 199, -1 }, /* (84) multiselect_op ::= UNION */ { 199, -2 }, /* (85) multiselect_op ::= UNION ALL */ { 199, -1 }, /* (86) multiselect_op ::= EXCEPT|INTERSECT */ { 197, -9 }, /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ { 208, -4 }, /* (88) values ::= VALUES LP nexprlist RP */ { 208, -5 }, /* (89) values ::= values COMMA LP exprlist RP */ { 200, -1 }, /* (90) distinct ::= DISTINCT */ { 200, -1 }, /* (91) distinct ::= ALL */ { 200, 0 }, /* (92) distinct ::= */ { 211, 0 }, /* (93) sclp ::= */ { 201, -5 }, /* (94) selcollist ::= sclp scanpt expr scanpt as */ { 201, -3 }, /* (95) selcollist ::= sclp scanpt STAR */ { 201, -5 }, /* (96) selcollist ::= sclp scanpt nm DOT STAR */ { 212, -2 }, /* (97) as ::= AS nm */ { 212, 0 }, /* (98) as ::= */ { 202, 0 }, /* (99) from ::= */ { 202, -2 }, /* (100) from ::= FROM seltablist */ { 214, -2 }, /* (101) stl_prefix ::= seltablist joinop */ { 214, 0 }, /* (102) stl_prefix ::= */ { 213, -7 }, /* (103) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ { 213, -9 }, /* (104) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ { 213, -7 }, /* (105) seltablist ::= stl_prefix LP select RP as on_opt using_opt */ { 213, -7 }, /* (106) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ { 160, 0 }, /* (107) dbnm ::= */ { 160, -2 }, /* (108) dbnm ::= DOT nm */ { 195, -1 }, /* (109) fullname ::= nm */ { 195, -3 }, /* (110) fullname ::= nm DOT nm */ { 219, -1 }, /* (111) xfullname ::= nm */ { 219, -3 }, /* (112) xfullname ::= nm DOT nm */ { 219, -5 }, /* (113) xfullname ::= nm DOT nm AS nm */ { 219, -3 }, /* (114) xfullname ::= nm AS nm */ { 215, -1 }, /* (115) joinop ::= COMMA|JOIN */ { 215, -2 }, /* (116) joinop ::= JOIN_KW JOIN */ { 215, -3 }, /* (117) joinop ::= JOIN_KW nm JOIN */ { 215, -4 }, /* (118) joinop ::= JOIN_KW nm nm JOIN */ { 217, -2 }, /* (119) on_opt ::= ON expr */ { 217, 0 }, /* (120) on_opt ::= */ { 216, 0 }, /* (121) indexed_opt ::= */ { 216, -3 }, /* (122) indexed_opt ::= INDEXED BY nm */ { 216, -2 }, /* (123) indexed_opt ::= NOT INDEXED */ { 218, -4 }, /* (124) using_opt ::= USING LP idlist RP */ { 218, 0 }, /* (125) using_opt ::= */ { 206, 0 }, /* (126) orderby_opt ::= */ { 206, -3 }, /* (127) orderby_opt ::= ORDER BY sortlist */ { 188, -4 }, /* (128) sortlist ::= sortlist COMMA expr sortorder */ { 188, -2 }, /* (129) sortlist ::= expr sortorder */ { 177, -1 }, /* (130) sortorder ::= ASC */ { 177, -1 }, /* (131) sortorder ::= DESC */ { 177, 0 }, /* (132) sortorder ::= */ { 204, 0 }, /* (133) groupby_opt ::= */ { 204, -3 }, /* (134) groupby_opt ::= GROUP BY nexprlist */ { 205, 0 }, /* (135) having_opt ::= */ { 205, -2 }, /* (136) having_opt ::= HAVING expr */ { 207, 0 }, /* (137) limit_opt ::= */ { 207, -2 }, /* (138) limit_opt ::= LIMIT expr */ { 207, -4 }, /* (139) limit_opt ::= LIMIT expr OFFSET expr */ { 207, -4 }, /* (140) limit_opt ::= LIMIT expr COMMA expr */ { 150, -6 }, /* (141) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */ { 203, 0 }, /* (142) where_opt ::= */ { 203, -2 }, /* (143) where_opt ::= WHERE expr */ { 150, -8 }, /* (144) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */ { 222, -5 }, /* (145) setlist ::= setlist COMMA nm EQ expr */ { 222, -7 }, /* (146) setlist ::= setlist COMMA LP idlist RP EQ expr */ { 222, -3 }, /* (147) setlist ::= nm EQ expr */ { 222, -5 }, /* (148) setlist ::= LP idlist RP EQ expr */ { 150, -7 }, /* (149) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ { 150, -7 }, /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */ { 225, 0 }, /* (151) upsert ::= */ { 225, -11 }, /* (152) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */ { 225, -8 }, /* (153) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */ { 225, -4 }, /* (154) upsert ::= ON CONFLICT DO NOTHING */ { 223, -2 }, /* (155) insert_cmd ::= INSERT orconf */ { 223, -1 }, /* (156) insert_cmd ::= REPLACE */ { 224, 0 }, /* (157) idlist_opt ::= */ { 224, -3 }, /* (158) idlist_opt ::= LP idlist RP */ { 220, -3 }, /* (159) idlist ::= idlist COMMA nm */ { 220, -1 }, /* (160) idlist ::= nm */ { 175, -3 }, /* (161) expr ::= LP expr RP */ { 175, -1 }, /* (162) expr ::= ID|INDEXED */ { 175, -1 }, /* (163) expr ::= JOIN_KW */ { 175, -3 }, /* (164) expr ::= nm DOT nm */ { 175, -5 }, /* (165) expr ::= nm DOT nm DOT nm */ { 174, -1 }, /* (166) term ::= NULL|FLOAT|BLOB */ { 174, -1 }, /* (167) term ::= STRING */ { 174, -1 }, /* (168) term ::= INTEGER */ { 175, -1 }, /* (169) expr ::= VARIABLE */ { 175, -3 }, /* (170) expr ::= expr COLLATE ID|STRING */ { 175, -6 }, /* (171) expr ::= CAST LP expr AS typetoken RP */ { 175, -5 }, /* (172) expr ::= ID|INDEXED LP distinct exprlist RP */ { 175, -4 }, /* (173) expr ::= ID|INDEXED LP STAR RP */ { 174, -1 }, /* (174) term ::= CTIME_KW */ { 175, -5 }, /* (175) expr ::= LP nexprlist COMMA expr RP */ { 175, -3 }, /* (176) expr ::= expr AND expr */ { 175, -3 }, /* (177) expr ::= expr OR expr */ { 175, -3 }, /* (178) expr ::= expr LT|GT|GE|LE expr */ { 175, -3 }, /* (179) expr ::= expr EQ|NE expr */ { 175, -3 }, /* (180) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ { 175, -3 }, /* (181) expr ::= expr PLUS|MINUS expr */ { 175, -3 }, /* (182) expr ::= expr STAR|SLASH|REM expr */ { 175, -3 }, /* (183) expr ::= expr CONCAT expr */ { 226, -2 }, /* (184) likeop ::= NOT LIKE_KW|MATCH */ { 175, -3 }, /* (185) expr ::= expr likeop expr */ { 175, -5 }, /* (186) expr ::= expr likeop expr ESCAPE expr */ { 175, -2 }, /* (187) expr ::= expr ISNULL|NOTNULL */ { 175, -3 }, /* (188) expr ::= expr NOT NULL */ { 175, -3 }, /* (189) expr ::= expr IS expr */ { 175, -4 }, /* (190) expr ::= expr IS NOT expr */ { 175, -2 }, /* (191) expr ::= NOT expr */ { 175, -2 }, /* (192) expr ::= BITNOT expr */ { 175, -2 }, /* (193) expr ::= MINUS expr */ { 175, -2 }, /* (194) expr ::= PLUS expr */ { 227, -1 }, /* (195) between_op ::= BETWEEN */ { 227, -2 }, /* (196) between_op ::= NOT BETWEEN */ { 175, -5 }, /* (197) expr ::= expr between_op expr AND expr */ { 228, -1 }, /* (198) in_op ::= IN */ { 228, -2 }, /* (199) in_op ::= NOT IN */ { 175, -5 }, /* (200) expr ::= expr in_op LP exprlist RP */ { 175, -3 }, /* (201) expr ::= LP select RP */ { 175, -5 }, /* (202) expr ::= expr in_op LP select RP */ { 175, -5 }, /* (203) expr ::= expr in_op nm dbnm paren_exprlist */ { 175, -4 }, /* (204) expr ::= EXISTS LP select RP */ { 175, -5 }, /* (205) expr ::= CASE case_operand case_exprlist case_else END */ { 231, -5 }, /* (206) case_exprlist ::= case_exprlist WHEN expr THEN expr */ { 231, -4 }, /* (207) case_exprlist ::= WHEN expr THEN expr */ { 232, -2 }, /* (208) case_else ::= ELSE expr */ { 232, 0 }, /* (209) case_else ::= */ { 230, -1 }, /* (210) case_operand ::= expr */ { 230, 0 }, /* (211) case_operand ::= */ { 210, 0 }, /* (212) exprlist ::= */ { 209, -3 }, /* (213) nexprlist ::= nexprlist COMMA expr */ { 209, -1 }, /* (214) nexprlist ::= expr */ { 229, 0 }, /* (215) paren_exprlist ::= */ { 229, -3 }, /* (216) paren_exprlist ::= LP exprlist RP */ { 150, -12 }, /* (217) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ { 233, -1 }, /* (218) uniqueflag ::= UNIQUE */ { 233, 0 }, /* (219) uniqueflag ::= */ { 179, 0 }, /* (220) eidlist_opt ::= */ { 179, -3 }, /* (221) eidlist_opt ::= LP eidlist RP */ { 189, -5 }, /* (222) eidlist ::= eidlist COMMA nm collate sortorder */ { 189, -3 }, /* (223) eidlist ::= nm collate sortorder */ { 234, 0 }, /* (224) collate ::= */ { 234, -2 }, /* (225) collate ::= COLLATE ID|STRING */ { 150, -4 }, /* (226) cmd ::= DROP INDEX ifexists fullname */ { 150, -1 }, /* (227) cmd ::= VACUUM */ { 150, -2 }, /* (228) cmd ::= VACUUM nm */ { 150, -3 }, /* (229) cmd ::= PRAGMA nm dbnm */ { 150, -5 }, /* (230) cmd ::= PRAGMA nm dbnm EQ nmnum */ { 150, -6 }, /* (231) cmd ::= PRAGMA nm dbnm LP nmnum RP */ { 150, -5 }, /* (232) cmd ::= PRAGMA nm dbnm EQ minus_num */ { 150, -6 }, /* (233) cmd ::= PRAGMA nm dbnm LP minus_num RP */ { 170, -2 }, /* (234) plus_num ::= PLUS INTEGER|FLOAT */ { 171, -2 }, /* (235) minus_num ::= MINUS INTEGER|FLOAT */ { 150, -5 }, /* (236) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ { 236, -11 }, /* (237) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ { 238, -1 }, /* (238) trigger_time ::= BEFORE|AFTER */ { 238, -2 }, /* (239) trigger_time ::= INSTEAD OF */ { 238, 0 }, /* (240) trigger_time ::= */ { 239, -1 }, /* (241) trigger_event ::= DELETE|INSERT */ { 239, -1 }, /* (242) trigger_event ::= UPDATE */ { 239, -3 }, /* (243) trigger_event ::= UPDATE OF idlist */ { 241, 0 }, /* (244) when_clause ::= */ { 241, -2 }, /* (245) when_clause ::= WHEN expr */ { 237, -3 }, /* (246) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ { 237, -2 }, /* (247) trigger_cmd_list ::= trigger_cmd SEMI */ { 243, -3 }, /* (248) trnm ::= nm DOT nm */ { 244, -3 }, /* (249) tridxby ::= INDEXED BY nm */ { 244, -2 }, /* (250) tridxby ::= NOT INDEXED */ { 242, -8 }, /* (251) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ { 242, -8 }, /* (252) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ { 242, -6 }, /* (253) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ { 242, -3 }, /* (254) trigger_cmd ::= scanpt select scanpt */ { 175, -4 }, /* (255) expr ::= RAISE LP IGNORE RP */ { 175, -6 }, /* (256) expr ::= RAISE LP raisetype COMMA nm RP */ { 193, -1 }, /* (257) raisetype ::= ROLLBACK */ { 193, -1 }, /* (258) raisetype ::= ABORT */ { 193, -1 }, /* (259) raisetype ::= FAIL */ { 150, -4 }, /* (260) cmd ::= DROP TRIGGER ifexists fullname */ { 150, -6 }, /* (261) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ { 150, -3 }, /* (262) cmd ::= DETACH database_kw_opt expr */ { 246, 0 }, /* (263) key_opt ::= */ { 246, -2 }, /* (264) key_opt ::= KEY expr */ { 150, -1 }, /* (265) cmd ::= REINDEX */ { 150, -3 }, /* (266) cmd ::= REINDEX nm dbnm */ { 150, -1 }, /* (267) cmd ::= ANALYZE */ { 150, -3 }, /* (268) cmd ::= ANALYZE nm dbnm */ { 150, -6 }, /* (269) cmd ::= ALTER TABLE fullname RENAME TO nm */ { 150, -7 }, /* (270) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ { 247, -1 }, /* (271) add_column_fullname ::= fullname */ { 150, -1 }, /* (272) cmd ::= create_vtab */ { 150, -4 }, /* (273) cmd ::= create_vtab LP vtabarglist RP */ { 249, -8 }, /* (274) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ { 251, 0 }, /* (275) vtabarg ::= */ { 252, -1 }, /* (276) vtabargtoken ::= ANY */ { 252, -3 }, /* (277) vtabargtoken ::= lp anylist RP */ { 253, -1 }, /* (278) lp ::= LP */ { 221, -2 }, /* (279) with ::= WITH wqlist */ { 221, -3 }, /* (280) with ::= WITH RECURSIVE wqlist */ { 198, -6 }, /* (281) wqlist ::= nm eidlist_opt AS LP select RP */ { 198, -8 }, /* (282) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ { 145, -1 }, /* (283) input ::= cmdlist */ { 146, -2 }, /* (284) cmdlist ::= cmdlist ecmd */ { 146, -1 }, /* (285) cmdlist ::= ecmd */ { 147, -1 }, /* (286) ecmd ::= SEMI */ { 147, -2 }, /* (287) ecmd ::= cmdx SEMI */ { 147, -2 }, /* (288) ecmd ::= explain cmdx */ { 152, 0 }, /* (289) trans_opt ::= */ { 152, -1 }, /* (290) trans_opt ::= TRANSACTION */ { 152, -2 }, /* (291) trans_opt ::= TRANSACTION nm */ { 154, -1 }, /* (292) savepoint_opt ::= SAVEPOINT */ { 154, 0 }, /* (293) savepoint_opt ::= */ { 150, -2 }, /* (294) cmd ::= create_table create_table_args */ { 161, -4 }, /* (295) columnlist ::= columnlist COMMA columnname carglist */ { 161, -2 }, /* (296) columnlist ::= columnname carglist */ { 153, -1 }, /* (297) nm ::= ID|INDEXED */ { 153, -1 }, /* (298) nm ::= STRING */ { 153, -1 }, /* (299) nm ::= JOIN_KW */ { 167, -1 }, /* (300) typetoken ::= typename */ { 168, -1 }, /* (301) typename ::= ID|STRING */ { 169, -1 }, /* (302) signed ::= plus_num */ { 169, -1 }, /* (303) signed ::= minus_num */ { 166, -2 }, /* (304) carglist ::= carglist ccons */ { 166, 0 }, /* (305) carglist ::= */ { 173, -2 }, /* (306) ccons ::= NULL onconf */ { 162, -2 }, /* (307) conslist_opt ::= COMMA conslist */ { 185, -3 }, /* (308) conslist ::= conslist tconscomma tcons */ { 185, -1 }, /* (309) conslist ::= tcons */ { 186, 0 }, /* (310) tconscomma ::= */ { 190, -1 }, /* (311) defer_subclause_opt ::= defer_subclause */ { 192, -1 }, /* (312) resolvetype ::= raisetype */ { 196, -1 }, /* (313) selectnowith ::= oneselect */ { 197, -1 }, /* (314) oneselect ::= values */ { 211, -2 }, /* (315) sclp ::= selcollist COMMA */ { 212, -1 }, /* (316) as ::= ID|STRING */ { 175, -1 }, /* (317) expr ::= term */ { 226, -1 }, /* (318) likeop ::= LIKE_KW|MATCH */ { 210, -1 }, /* (319) exprlist ::= nexprlist */ { 235, -1 }, /* (320) nmnum ::= plus_num */ { 235, -1 }, /* (321) nmnum ::= nm */ { 235, -1 }, /* (322) nmnum ::= ON */ { 235, -1 }, /* (323) nmnum ::= DELETE */ { 235, -1 }, /* (324) nmnum ::= DEFAULT */ { 170, -1 }, /* (325) plus_num ::= INTEGER|FLOAT */ { 240, 0 }, /* (326) foreach_clause ::= */ { 240, -3 }, /* (327) foreach_clause ::= FOR EACH ROW */ { 243, -1 }, /* (328) trnm ::= nm */ { 244, 0 }, /* (329) tridxby ::= */ { 245, -1 }, /* (330) database_kw_opt ::= DATABASE */ { 245, 0 }, /* (331) database_kw_opt ::= */ { 248, 0 }, /* (332) kwcolumn_opt ::= */ { 248, -1 }, /* (333) kwcolumn_opt ::= COLUMNKW */ { 250, -1 }, /* (334) vtabarglist ::= vtabarg */ { 250, -3 }, /* (335) vtabarglist ::= vtabarglist COMMA vtabarg */ { 251, -2 }, /* (336) vtabarg ::= vtabarg vtabargtoken */ { 254, 0 }, /* (337) anylist ::= */ { 254, -4 }, /* (338) anylist ::= anylist LP anylist RP */ { 254, -2 }, /* (339) anylist ::= anylist ANY */ { 221, 0 }, /* (340) with ::= */ }; static void yy_accept(yyParser*); /* Forward Declaration */ /* ** Perform a reduce action and the shift that must immediately ** follow the reduce. ** ** The yyLookahead and yyLookaheadToken parameters provide reduce actions ** access to the lookahead token (if any). The yyLookahead will be YYNOCODE ** if the lookahead token has already been consumed. As this procedure is ** only called from one place, optimizing compilers will in-line it, which ** means that the extra parameters have no performance impact. */ static YYACTIONTYPE yy_reduce( yyParser *yypParser, /* The parser */ unsigned int yyruleno, /* Number of the rule by which to reduce */ int yyLookahead, /* Lookahead token, or YYNOCODE if none */ sqlite3ParserTOKENTYPE yyLookaheadToken /* Value of the lookahead token */ sqlite3ParserCTX_PDECL /* %extra_context */ ){ int yygoto; /* The next state */ int yyact; /* The next action */ yyStackEntry *yymsp; /* The top of the parser's stack */ int yysize; /* Amount to pop the stack */ sqlite3ParserARG_FETCH (void)yyLookahead; (void)yyLookaheadToken; yymsp = yypParser->yytos; #ifndef NDEBUG if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ yysize = yyRuleInfo[yyruleno].nrhs; if( yysize ){ |
︙ | ︙ | |||
142230 142231 142232 142233 142234 142235 142236 | yypParser->yyhwm++; assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); } #endif #if YYSTACKDEPTH>0 if( yypParser->yytos>=yypParser->yystackEnd ){ yyStackOverflow(yypParser); | > > > | > > > | | 143152 143153 143154 143155 143156 143157 143158 143159 143160 143161 143162 143163 143164 143165 143166 143167 143168 143169 143170 143171 143172 143173 143174 143175 143176 143177 143178 | yypParser->yyhwm++; assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); } #endif #if YYSTACKDEPTH>0 if( yypParser->yytos>=yypParser->yystackEnd ){ yyStackOverflow(yypParser); /* The call to yyStackOverflow() above pops the stack until it is ** empty, causing the main parser loop to exit. So the return value ** is never used and does not matter. */ return 0; } #else if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ if( yyGrowStack(yypParser) ){ yyStackOverflow(yypParser); /* The call to yyStackOverflow() above pops the stack until it is ** empty, causing the main parser loop to exit. So the return value ** is never used and does not matter. */ return 0; } yymsp = yypParser->yytos; } #endif } switch( yyruleno ){ |
︙ | ︙ | |||
142264 142265 142266 142267 142268 142269 142270 | case 1: /* explain ::= EXPLAIN QUERY PLAN */ { pParse->explain = 2; } break; case 2: /* cmdx ::= cmd */ { sqlite3FinishCoding(pParse); } break; case 3: /* cmd ::= BEGIN transtype trans_opt */ | | | | | 143192 143193 143194 143195 143196 143197 143198 143199 143200 143201 143202 143203 143204 143205 143206 143207 143208 143209 143210 143211 143212 143213 143214 | case 1: /* explain ::= EXPLAIN QUERY PLAN */ { pParse->explain = 2; } break; case 2: /* cmdx ::= cmd */ { sqlite3FinishCoding(pParse); } break; case 3: /* cmd ::= BEGIN transtype trans_opt */ {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy502);} break; case 4: /* transtype ::= */ {yymsp[1].minor.yy502 = TK_DEFERRED;} break; case 5: /* transtype ::= DEFERRED */ case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6); case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7); {yymsp[0].minor.yy502 = 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 */ { |
︙ | ︙ | |||
142295 142296 142297 142298 142299 142300 142301 | case 12: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ { sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0); } break; case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ { | | | | | | | | | | | | 143223 143224 143225 143226 143227 143228 143229 143230 143231 143232 143233 143234 143235 143236 143237 143238 143239 143240 143241 143242 143243 143244 143245 143246 143247 143248 143249 143250 143251 143252 143253 143254 143255 143256 143257 143258 143259 143260 143261 143262 143263 143264 143265 143266 143267 143268 143269 143270 143271 143272 143273 143274 143275 143276 143277 | case 12: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ { sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0); } break; case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ { sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy502,0,0,yymsp[-2].minor.yy502); } break; case 14: /* createkw ::= CREATE */ {disableLookaside(pParse);} break; case 15: /* ifnotexists ::= */ case 18: /* temp ::= */ yytestcase(yyruleno==18); case 21: /* table_options ::= */ yytestcase(yyruleno==21); case 42: /* autoinc ::= */ yytestcase(yyruleno==42); case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57); case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67); case 76: /* ifexists ::= */ yytestcase(yyruleno==76); case 92: /* distinct ::= */ yytestcase(yyruleno==92); case 224: /* collate ::= */ yytestcase(yyruleno==224); {yymsp[1].minor.yy502 = 0;} break; case 16: /* ifnotexists ::= IF NOT EXISTS */ {yymsp[-2].minor.yy502 = 1;} break; case 17: /* temp ::= TEMP */ case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43); {yymsp[0].minor.yy502 = 1;} break; case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */ { sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy502,0); } break; case 20: /* create_table_args ::= AS select */ { sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy399); sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy399); } break; case 22: /* table_options ::= WITHOUT nm */ { if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){ yymsp[-1].minor.yy502 = TF_WithoutRowid | TF_NoVisibleRowid; }else{ yymsp[-1].minor.yy502 = 0; sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); } } break; case 23: /* columnname ::= nm typetoken */ {sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);} break; |
︙ | ︙ | |||
142364 142365 142366 142367 142368 142369 142370 | break; case 27: /* typename ::= typename ID|STRING */ {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);} break; case 28: /* scanpt ::= */ { assert( yyLookahead!=YYNOCODE ); | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | > | > > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > < < < < < < | | | | | | | | | | | | < < < > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | > | > | > | > | > | > | 143292 143293 143294 143295 143296 143297 143298 143299 143300 143301 143302 143303 143304 143305 143306 143307 143308 143309 143310 143311 143312 143313 143314 143315 143316 143317 143318 143319 143320 143321 143322 143323 143324 143325 143326 143327 143328 143329 143330 143331 143332 143333 143334 143335 143336 143337 143338 143339 143340 143341 143342 143343 143344 143345 143346 143347 143348 143349 143350 143351 143352 143353 143354 143355 143356 143357 143358 143359 143360 143361 143362 143363 143364 143365 143366 143367 143368 143369 143370 143371 143372 143373 143374 143375 143376 143377 143378 143379 143380 143381 143382 143383 143384 143385 143386 143387 143388 143389 143390 143391 143392 143393 143394 143395 143396 143397 143398 143399 143400 143401 143402 143403 143404 143405 143406 143407 143408 143409 143410 143411 143412 143413 143414 143415 143416 143417 143418 143419 143420 143421 143422 143423 143424 143425 143426 143427 143428 143429 143430 143431 143432 143433 143434 143435 143436 143437 143438 143439 143440 143441 143442 143443 143444 143445 143446 143447 143448 143449 143450 143451 143452 143453 143454 143455 143456 143457 143458 143459 143460 143461 143462 143463 143464 143465 143466 143467 143468 143469 143470 143471 143472 143473 143474 143475 143476 143477 143478 143479 143480 143481 143482 143483 143484 143485 143486 143487 143488 143489 143490 143491 143492 143493 143494 143495 143496 143497 143498 143499 143500 143501 143502 143503 143504 143505 143506 143507 143508 143509 143510 143511 143512 143513 143514 143515 143516 143517 143518 143519 143520 143521 143522 143523 143524 143525 143526 143527 143528 143529 143530 143531 143532 143533 143534 143535 143536 143537 143538 143539 143540 143541 143542 143543 143544 143545 143546 143547 143548 143549 143550 143551 143552 143553 143554 143555 143556 143557 143558 143559 143560 143561 143562 143563 143564 143565 143566 143567 143568 143569 143570 143571 143572 143573 143574 143575 143576 143577 143578 143579 143580 143581 143582 143583 143584 143585 143586 143587 143588 143589 143590 143591 143592 143593 143594 143595 143596 143597 143598 143599 143600 143601 143602 143603 143604 143605 143606 143607 143608 143609 143610 143611 143612 143613 143614 143615 143616 143617 143618 143619 143620 143621 143622 143623 143624 143625 143626 143627 143628 143629 143630 143631 143632 143633 143634 143635 143636 143637 143638 143639 143640 143641 143642 143643 143644 143645 143646 143647 143648 143649 143650 143651 143652 143653 143654 143655 143656 143657 143658 143659 143660 143661 143662 143663 143664 143665 143666 143667 143668 143669 143670 143671 143672 143673 143674 143675 143676 143677 143678 143679 143680 143681 143682 143683 143684 143685 143686 143687 143688 143689 143690 143691 143692 143693 143694 143695 143696 143697 143698 143699 143700 143701 143702 143703 143704 143705 143706 143707 143708 143709 143710 143711 143712 143713 143714 143715 143716 143717 143718 143719 143720 143721 143722 143723 143724 143725 143726 143727 143728 143729 143730 143731 143732 143733 143734 143735 143736 143737 143738 143739 143740 143741 143742 143743 143744 143745 143746 143747 143748 143749 143750 143751 143752 143753 143754 143755 143756 143757 143758 143759 143760 143761 143762 143763 143764 143765 143766 143767 143768 143769 143770 143771 143772 143773 143774 143775 143776 143777 143778 143779 143780 143781 143782 143783 143784 143785 143786 143787 143788 143789 143790 143791 143792 143793 143794 143795 143796 143797 143798 143799 143800 143801 143802 143803 143804 143805 143806 143807 143808 143809 143810 143811 143812 143813 143814 143815 143816 143817 143818 143819 143820 143821 143822 143823 143824 143825 143826 143827 143828 143829 143830 143831 143832 143833 143834 143835 143836 143837 143838 143839 143840 143841 143842 143843 143844 143845 143846 143847 143848 143849 143850 143851 143852 143853 143854 143855 143856 143857 143858 143859 143860 143861 143862 143863 143864 143865 143866 143867 143868 143869 143870 143871 143872 143873 143874 143875 143876 143877 143878 143879 143880 143881 143882 143883 143884 143885 143886 143887 143888 143889 143890 143891 143892 143893 143894 143895 143896 143897 143898 143899 143900 143901 143902 143903 143904 143905 143906 143907 143908 143909 143910 143911 143912 143913 143914 143915 143916 143917 143918 143919 143920 143921 143922 143923 143924 143925 143926 143927 143928 143929 143930 143931 143932 143933 143934 143935 143936 143937 143938 143939 143940 143941 143942 143943 143944 143945 143946 143947 143948 143949 143950 143951 143952 143953 143954 143955 143956 143957 143958 143959 143960 143961 143962 143963 143964 143965 143966 143967 143968 143969 143970 143971 143972 143973 143974 143975 143976 143977 143978 143979 143980 143981 143982 143983 143984 143985 143986 143987 143988 143989 143990 143991 143992 143993 143994 143995 143996 143997 143998 143999 144000 144001 144002 144003 144004 144005 144006 144007 144008 144009 144010 144011 144012 144013 144014 144015 144016 144017 144018 144019 144020 144021 144022 144023 144024 144025 144026 144027 144028 144029 144030 144031 144032 144033 144034 144035 144036 144037 144038 144039 144040 144041 144042 144043 144044 144045 144046 144047 144048 144049 144050 144051 144052 144053 144054 144055 144056 144057 144058 144059 144060 144061 144062 144063 144064 144065 144066 144067 144068 144069 144070 144071 144072 144073 144074 144075 144076 144077 144078 144079 144080 144081 144082 144083 144084 144085 144086 144087 144088 144089 144090 144091 144092 144093 144094 144095 144096 144097 144098 144099 144100 144101 144102 144103 144104 144105 144106 144107 144108 144109 144110 144111 144112 144113 144114 144115 144116 144117 144118 144119 144120 144121 144122 144123 144124 144125 144126 144127 144128 144129 144130 144131 144132 144133 144134 144135 144136 144137 144138 144139 144140 144141 144142 144143 144144 144145 144146 144147 144148 144149 144150 144151 144152 144153 144154 144155 144156 144157 144158 144159 144160 144161 144162 144163 144164 144165 144166 144167 144168 144169 144170 144171 144172 144173 144174 144175 144176 144177 144178 144179 144180 144181 144182 144183 144184 144185 144186 144187 144188 144189 144190 144191 144192 144193 144194 144195 144196 144197 144198 144199 144200 144201 144202 144203 144204 144205 144206 144207 144208 144209 144210 144211 144212 144213 144214 144215 144216 144217 144218 144219 144220 144221 144222 144223 144224 144225 144226 144227 144228 144229 144230 144231 144232 144233 144234 144235 144236 144237 144238 144239 144240 144241 144242 144243 144244 144245 144246 144247 144248 144249 144250 144251 144252 144253 144254 144255 144256 144257 144258 144259 144260 144261 144262 144263 144264 144265 144266 144267 144268 144269 144270 144271 144272 144273 144274 144275 144276 144277 144278 144279 144280 144281 144282 144283 144284 144285 144286 144287 144288 144289 144290 144291 144292 144293 144294 144295 144296 144297 144298 144299 144300 144301 144302 144303 144304 144305 144306 144307 144308 144309 144310 144311 144312 144313 144314 144315 144316 144317 144318 144319 144320 144321 144322 144323 144324 144325 144326 144327 144328 144329 144330 144331 144332 144333 144334 144335 144336 144337 144338 144339 144340 144341 144342 144343 144344 144345 144346 144347 144348 144349 144350 144351 144352 144353 144354 144355 144356 144357 144358 144359 144360 144361 144362 144363 144364 144365 144366 144367 144368 144369 144370 144371 144372 144373 144374 144375 144376 144377 144378 144379 144380 144381 144382 144383 144384 144385 144386 144387 144388 144389 144390 144391 144392 144393 144394 144395 144396 144397 144398 144399 144400 144401 144402 144403 144404 144405 144406 144407 144408 144409 144410 144411 144412 144413 144414 144415 144416 144417 144418 144419 144420 144421 144422 144423 144424 144425 144426 144427 144428 144429 144430 144431 144432 144433 144434 144435 144436 144437 144438 144439 144440 144441 144442 144443 144444 144445 144446 144447 144448 144449 144450 144451 144452 144453 144454 144455 144456 144457 144458 144459 144460 144461 144462 144463 144464 144465 144466 144467 144468 144469 144470 144471 144472 144473 144474 144475 144476 144477 144478 144479 144480 144481 144482 144483 144484 144485 144486 144487 144488 144489 144490 144491 144492 144493 144494 144495 144496 144497 144498 144499 144500 144501 144502 144503 144504 144505 144506 144507 144508 144509 144510 144511 144512 144513 144514 144515 144516 144517 144518 144519 144520 144521 144522 144523 144524 144525 144526 144527 144528 144529 144530 144531 144532 144533 144534 144535 144536 144537 144538 | break; case 27: /* typename ::= typename ID|STRING */ {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);} break; case 28: /* scanpt ::= */ { assert( yyLookahead!=YYNOCODE ); yymsp[1].minor.yy36 = yyLookaheadToken.z; } break; case 29: /* ccons ::= CONSTRAINT nm */ case 62: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==62); {pParse->constraintName = yymsp[0].minor.yy0;} break; case 30: /* ccons ::= DEFAULT scanpt term scanpt */ {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy182,yymsp[-2].minor.yy36,yymsp[0].minor.yy36);} break; case 31: /* ccons ::= DEFAULT LP expr RP */ {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy182,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);} break; case 32: /* ccons ::= DEFAULT PLUS term scanpt */ {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy182,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy36);} break; case 33: /* ccons ::= DEFAULT MINUS term scanpt */ { Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[-1].minor.yy182, 0); sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy36); } break; case 34: /* ccons ::= DEFAULT scanpt ID|INDEXED */ { Expr *p = tokenExpr(pParse, TK_STRING, yymsp[0].minor.yy0); if( p ){ sqlite3ExprIdToTrueFalse(p); testcase( p->op==TK_TRUEFALSE && sqlite3ExprTruthValue(p) ); } sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n); } break; case 35: /* ccons ::= NOT NULL onconf */ {sqlite3AddNotNull(pParse, yymsp[0].minor.yy502);} break; case 36: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy502,yymsp[0].minor.yy502,yymsp[-2].minor.yy502);} break; case 37: /* ccons ::= UNIQUE onconf */ {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy502,0,0,0,0, SQLITE_IDXTYPE_UNIQUE);} break; case 38: /* ccons ::= CHECK LP expr RP */ {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy182);} break; case 39: /* ccons ::= REFERENCES nm eidlist_opt refargs */ {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy232,yymsp[0].minor.yy502);} break; case 40: /* ccons ::= defer_subclause */ {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy502);} break; case 41: /* ccons ::= COLLATE ID|STRING */ {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);} break; case 44: /* refargs ::= */ { yymsp[1].minor.yy502 = OE_None*0x0101; /* EV: R-19803-45884 */} break; case 45: /* refargs ::= refargs refarg */ { yymsp[-1].minor.yy502 = (yymsp[-1].minor.yy502 & ~yymsp[0].minor.yy107.mask) | yymsp[0].minor.yy107.value; } break; case 46: /* refarg ::= MATCH nm */ { yymsp[-1].minor.yy107.value = 0; yymsp[-1].minor.yy107.mask = 0x000000; } break; case 47: /* refarg ::= ON INSERT refact */ { yymsp[-2].minor.yy107.value = 0; yymsp[-2].minor.yy107.mask = 0x000000; } break; case 48: /* refarg ::= ON DELETE refact */ { yymsp[-2].minor.yy107.value = yymsp[0].minor.yy502; yymsp[-2].minor.yy107.mask = 0x0000ff; } break; case 49: /* refarg ::= ON UPDATE refact */ { yymsp[-2].minor.yy107.value = yymsp[0].minor.yy502<<8; yymsp[-2].minor.yy107.mask = 0x00ff00; } break; case 50: /* refact ::= SET NULL */ { yymsp[-1].minor.yy502 = OE_SetNull; /* EV: R-33326-45252 */} break; case 51: /* refact ::= SET DEFAULT */ { yymsp[-1].minor.yy502 = OE_SetDflt; /* EV: R-33326-45252 */} break; case 52: /* refact ::= CASCADE */ { yymsp[0].minor.yy502 = OE_Cascade; /* EV: R-33326-45252 */} break; case 53: /* refact ::= RESTRICT */ { yymsp[0].minor.yy502 = OE_Restrict; /* EV: R-33326-45252 */} break; case 54: /* refact ::= NO ACTION */ { yymsp[-1].minor.yy502 = OE_None; /* EV: R-33326-45252 */} break; case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ {yymsp[-2].minor.yy502 = 0;} break; case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71); case 155: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==155); {yymsp[-1].minor.yy502 = yymsp[0].minor.yy502;} break; case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75); case 196: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==196); case 199: /* in_op ::= NOT IN */ yytestcase(yyruleno==199); case 225: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==225); {yymsp[-1].minor.yy502 = 1;} break; case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ {yymsp[-1].minor.yy502 = 0;} break; case 61: /* tconscomma ::= COMMA */ {pParse->constraintName.n = 0;} break; case 63: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy232,yymsp[0].minor.yy502,yymsp[-2].minor.yy502,0);} break; case 64: /* tcons ::= UNIQUE LP sortlist RP onconf */ {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy232,yymsp[0].minor.yy502,0,0,0,0, SQLITE_IDXTYPE_UNIQUE);} break; case 65: /* tcons ::= CHECK LP expr RP onconf */ {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy182);} break; case 66: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ { sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy232, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy232, yymsp[-1].minor.yy502); sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy502); } break; case 68: /* onconf ::= */ case 70: /* orconf ::= */ yytestcase(yyruleno==70); {yymsp[1].minor.yy502 = OE_Default;} break; case 69: /* onconf ::= ON CONFLICT resolvetype */ {yymsp[-2].minor.yy502 = yymsp[0].minor.yy502;} break; case 72: /* resolvetype ::= IGNORE */ {yymsp[0].minor.yy502 = OE_Ignore;} break; case 73: /* resolvetype ::= REPLACE */ case 156: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==156); {yymsp[0].minor.yy502 = OE_Replace;} break; case 74: /* cmd ::= DROP TABLE ifexists fullname */ { sqlite3DropTable(pParse, yymsp[0].minor.yy427, 0, yymsp[-1].minor.yy502); } break; case 77: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ { sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy232, yymsp[0].minor.yy399, yymsp[-7].minor.yy502, yymsp[-5].minor.yy502); } break; case 78: /* cmd ::= DROP VIEW ifexists fullname */ { sqlite3DropTable(pParse, yymsp[0].minor.yy427, 1, yymsp[-1].minor.yy502); } break; case 79: /* cmd ::= select */ { SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0}; sqlite3Select(pParse, yymsp[0].minor.yy399, &dest); sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy399); } break; case 80: /* select ::= WITH wqlist selectnowith */ { Select *p = yymsp[0].minor.yy399; if( p ){ p->pWith = yymsp[-1].minor.yy91; parserDoubleLinkSelect(pParse, p); }else{ sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy91); } yymsp[-2].minor.yy399 = p; } break; case 81: /* select ::= WITH RECURSIVE wqlist selectnowith */ { Select *p = yymsp[0].minor.yy399; if( p ){ p->pWith = yymsp[-1].minor.yy91; parserDoubleLinkSelect(pParse, p); }else{ sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy91); } yymsp[-3].minor.yy399 = p; } break; case 82: /* select ::= selectnowith */ { Select *p = yymsp[0].minor.yy399; if( p ){ parserDoubleLinkSelect(pParse, p); } yymsp[0].minor.yy399 = p; /*A-overwrites-X*/ } break; case 83: /* selectnowith ::= selectnowith multiselect_op oneselect */ { Select *pRhs = yymsp[0].minor.yy399; Select *pLhs = yymsp[-2].minor.yy399; if( pRhs && pRhs->pPrior ){ SrcList *pFrom; Token x; x.n = 0; parserDoubleLinkSelect(pParse, pRhs); pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0); pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0); } if( pRhs ){ pRhs->op = (u8)yymsp[-1].minor.yy502; pRhs->pPrior = pLhs; if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue; pRhs->selFlags &= ~SF_MultiValue; if( yymsp[-1].minor.yy502!=TK_ALL ) pParse->hasCompound = 1; }else{ sqlite3SelectDelete(pParse->db, pLhs); } yymsp[-2].minor.yy399 = pRhs; } break; case 84: /* multiselect_op ::= UNION */ case 86: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==86); {yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-OP*/} break; case 85: /* multiselect_op ::= UNION ALL */ {yymsp[-1].minor.yy502 = TK_ALL;} break; case 87: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ { #if SELECTTRACE_ENABLED Token s = yymsp[-8].minor.yy0; /*A-overwrites-S*/ #endif yymsp[-8].minor.yy399 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy232,yymsp[-5].minor.yy427,yymsp[-4].minor.yy182,yymsp[-3].minor.yy232,yymsp[-2].minor.yy182,yymsp[-1].minor.yy232,yymsp[-7].minor.yy502,yymsp[0].minor.yy182); #if SELECTTRACE_ENABLED /* Populate the Select.zSelName[] string that is used to help with ** query planner debugging, to differentiate between multiple Select ** objects in a complex query. ** ** If the SELECT keyword is immediately followed by a C-style comment ** then extract the first few alphanumeric characters from within that ** comment to be the zSelName value. Otherwise, the label is #N where ** is an integer that is incremented with each SELECT statement seen. */ if( yymsp[-8].minor.yy399!=0 ){ const char *z = s.z+6; int i; sqlite3_snprintf(sizeof(yymsp[-8].minor.yy399->zSelName), yymsp[-8].minor.yy399->zSelName,"#%d",++pParse->nSelect); while( z[0]==' ' ) z++; if( z[0]=='/' && z[1]=='*' ){ z += 2; while( z[0]==' ' ) z++; for(i=0; sqlite3Isalnum(z[i]); i++){} sqlite3_snprintf(sizeof(yymsp[-8].minor.yy399->zSelName), yymsp[-8].minor.yy399->zSelName, "%.*s", i, z); } } #endif /* SELECTRACE_ENABLED */ } break; case 88: /* values ::= VALUES LP nexprlist RP */ { yymsp[-3].minor.yy399 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy232,0,0,0,0,0,SF_Values,0); } break; case 89: /* values ::= values COMMA LP exprlist RP */ { Select *pRight, *pLeft = yymsp[-4].minor.yy399; pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy232,0,0,0,0,0,SF_Values|SF_MultiValue,0); if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue; if( pRight ){ pRight->op = TK_ALL; pRight->pPrior = pLeft; yymsp[-4].minor.yy399 = pRight; }else{ yymsp[-4].minor.yy399 = pLeft; } } break; case 90: /* distinct ::= DISTINCT */ {yymsp[0].minor.yy502 = SF_Distinct;} break; case 91: /* distinct ::= ALL */ {yymsp[0].minor.yy502 = SF_All;} break; case 93: /* sclp ::= */ case 126: /* orderby_opt ::= */ yytestcase(yyruleno==126); case 133: /* groupby_opt ::= */ yytestcase(yyruleno==133); case 212: /* exprlist ::= */ yytestcase(yyruleno==212); case 215: /* paren_exprlist ::= */ yytestcase(yyruleno==215); case 220: /* eidlist_opt ::= */ yytestcase(yyruleno==220); {yymsp[1].minor.yy232 = 0;} break; case 94: /* selcollist ::= sclp scanpt expr scanpt as */ { yymsp[-4].minor.yy232 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy232, yymsp[-2].minor.yy182); if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy232, &yymsp[0].minor.yy0, 1); sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy232,yymsp[-3].minor.yy36,yymsp[-1].minor.yy36); } break; case 95: /* selcollist ::= sclp scanpt STAR */ { Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0); yymsp[-2].minor.yy232 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy232, p); } break; case 96: /* selcollist ::= sclp scanpt nm DOT STAR */ { Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0); Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight); yymsp[-4].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy232, pDot); } break; case 97: /* as ::= AS nm */ case 108: /* dbnm ::= DOT nm */ yytestcase(yyruleno==108); case 234: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==234); case 235: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==235); {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} break; case 99: /* from ::= */ {yymsp[1].minor.yy427 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy427));} break; case 100: /* from ::= FROM seltablist */ { yymsp[-1].minor.yy427 = yymsp[0].minor.yy427; sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy427); } break; case 101: /* stl_prefix ::= seltablist joinop */ { if( ALWAYS(yymsp[-1].minor.yy427 && yymsp[-1].minor.yy427->nSrc>0) ) yymsp[-1].minor.yy427->a[yymsp[-1].minor.yy427->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy502; } break; case 102: /* stl_prefix ::= */ {yymsp[1].minor.yy427 = 0;} break; case 103: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ { yymsp[-6].minor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy427,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy182,yymsp[0].minor.yy510); sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy427, &yymsp[-2].minor.yy0); } break; case 104: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ { yymsp[-8].minor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy427,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy182,yymsp[0].minor.yy510); sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy427, yymsp[-4].minor.yy232); } break; case 105: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ { yymsp[-6].minor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy427,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy399,yymsp[-1].minor.yy182,yymsp[0].minor.yy510); } break; case 106: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ { if( yymsp[-6].minor.yy427==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy182==0 && yymsp[0].minor.yy510==0 ){ yymsp[-6].minor.yy427 = yymsp[-4].minor.yy427; }else if( yymsp[-4].minor.yy427->nSrc==1 ){ yymsp[-6].minor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy427,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy182,yymsp[0].minor.yy510); if( yymsp[-6].minor.yy427 ){ struct SrcList_item *pNew = &yymsp[-6].minor.yy427->a[yymsp[-6].minor.yy427->nSrc-1]; struct SrcList_item *pOld = yymsp[-4].minor.yy427->a; pNew->zName = pOld->zName; pNew->zDatabase = pOld->zDatabase; pNew->pSelect = pOld->pSelect; pOld->zName = pOld->zDatabase = 0; pOld->pSelect = 0; } sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy427); }else{ Select *pSubquery; sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy427); pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy427,0,0,0,0,SF_NestedFrom,0); yymsp[-6].minor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy427,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy182,yymsp[0].minor.yy510); } } break; case 107: /* dbnm ::= */ case 121: /* indexed_opt ::= */ yytestcase(yyruleno==121); {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;} break; case 109: /* fullname ::= nm */ case 111: /* xfullname ::= nm */ yytestcase(yyruleno==111); {yymsp[0].minor.yy427 = sqlite3SrcListAppend(pParse->db,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} break; case 110: /* fullname ::= nm DOT nm */ case 112: /* xfullname ::= nm DOT nm */ yytestcase(yyruleno==112); {yymsp[-2].minor.yy427 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} break; case 113: /* xfullname ::= nm DOT nm AS nm */ { yymsp[-4].minor.yy427 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ if( yymsp[-4].minor.yy427 ) yymsp[-4].minor.yy427->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); } break; case 114: /* xfullname ::= nm AS nm */ { yymsp[-2].minor.yy427 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/ if( yymsp[-2].minor.yy427 ) yymsp[-2].minor.yy427->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); } break; case 115: /* joinop ::= COMMA|JOIN */ { yymsp[0].minor.yy502 = JT_INNER; } break; case 116: /* joinop ::= JOIN_KW JOIN */ {yymsp[-1].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} break; case 117: /* joinop ::= JOIN_KW nm JOIN */ {yymsp[-2].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} break; case 118: /* joinop ::= JOIN_KW nm nm JOIN */ {yymsp[-3].minor.yy502 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} break; case 119: /* on_opt ::= ON expr */ case 136: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==136); case 143: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==143); case 208: /* case_else ::= ELSE expr */ yytestcase(yyruleno==208); {yymsp[-1].minor.yy182 = yymsp[0].minor.yy182;} break; case 120: /* on_opt ::= */ case 135: /* having_opt ::= */ yytestcase(yyruleno==135); case 137: /* limit_opt ::= */ yytestcase(yyruleno==137); case 142: /* where_opt ::= */ yytestcase(yyruleno==142); case 209: /* case_else ::= */ yytestcase(yyruleno==209); case 211: /* case_operand ::= */ yytestcase(yyruleno==211); {yymsp[1].minor.yy182 = 0;} break; case 122: /* indexed_opt ::= INDEXED BY nm */ {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;} break; case 123: /* indexed_opt ::= NOT INDEXED */ {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;} break; case 124: /* using_opt ::= USING LP idlist RP */ {yymsp[-3].minor.yy510 = yymsp[-1].minor.yy510;} break; case 125: /* using_opt ::= */ case 157: /* idlist_opt ::= */ yytestcase(yyruleno==157); {yymsp[1].minor.yy510 = 0;} break; case 127: /* orderby_opt ::= ORDER BY sortlist */ case 134: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==134); {yymsp[-2].minor.yy232 = yymsp[0].minor.yy232;} break; case 128: /* sortlist ::= sortlist COMMA expr sortorder */ { yymsp[-3].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy232,yymsp[-1].minor.yy182); sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy232,yymsp[0].minor.yy502); } break; case 129: /* sortlist ::= expr sortorder */ { yymsp[-1].minor.yy232 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy182); /*A-overwrites-Y*/ sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy232,yymsp[0].minor.yy502); } break; case 130: /* sortorder ::= ASC */ {yymsp[0].minor.yy502 = SQLITE_SO_ASC;} break; case 131: /* sortorder ::= DESC */ {yymsp[0].minor.yy502 = SQLITE_SO_DESC;} break; case 132: /* sortorder ::= */ {yymsp[1].minor.yy502 = SQLITE_SO_UNDEFINED;} break; case 138: /* limit_opt ::= LIMIT expr */ {yymsp[-1].minor.yy182 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy182,0);} break; case 139: /* limit_opt ::= LIMIT expr OFFSET expr */ {yymsp[-3].minor.yy182 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy182,yymsp[0].minor.yy182);} break; case 140: /* limit_opt ::= LIMIT expr COMMA expr */ {yymsp[-3].minor.yy182 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy182,yymsp[-2].minor.yy182);} break; case 141: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt */ { sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy427, &yymsp[-1].minor.yy0); sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy427,yymsp[0].minor.yy182,0,0); } break; case 144: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */ { sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy427, &yymsp[-3].minor.yy0); sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy232,"set list"); sqlite3Update(pParse,yymsp[-4].minor.yy427,yymsp[-1].minor.yy232,yymsp[0].minor.yy182,yymsp[-5].minor.yy502,0,0,0); } break; case 145: /* setlist ::= setlist COMMA nm EQ expr */ { yymsp[-4].minor.yy232 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy232, yymsp[0].minor.yy182); sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy232, &yymsp[-2].minor.yy0, 1); } break; case 146: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ { yymsp[-6].minor.yy232 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy232, yymsp[-3].minor.yy510, yymsp[0].minor.yy182); } break; case 147: /* setlist ::= nm EQ expr */ { yylhsminor.yy232 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy182); sqlite3ExprListSetName(pParse, yylhsminor.yy232, &yymsp[-2].minor.yy0, 1); } yymsp[-2].minor.yy232 = yylhsminor.yy232; break; case 148: /* setlist ::= LP idlist RP EQ expr */ { yymsp[-4].minor.yy232 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy510, yymsp[0].minor.yy182); } break; case 149: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ { sqlite3Insert(pParse, yymsp[-3].minor.yy427, yymsp[-1].minor.yy399, yymsp[-2].minor.yy510, yymsp[-5].minor.yy502, yymsp[0].minor.yy198); } break; case 150: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */ { sqlite3Insert(pParse, yymsp[-3].minor.yy427, 0, yymsp[-2].minor.yy510, yymsp[-5].minor.yy502, 0); } break; case 151: /* upsert ::= */ { yymsp[1].minor.yy198 = 0; } break; case 152: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */ { yymsp[-10].minor.yy198 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy232,yymsp[-5].minor.yy182,yymsp[-1].minor.yy232,yymsp[0].minor.yy182);} break; case 153: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */ { yymsp[-7].minor.yy198 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy232,yymsp[-2].minor.yy182,0,0); } break; case 154: /* upsert ::= ON CONFLICT DO NOTHING */ { yymsp[-3].minor.yy198 = sqlite3UpsertNew(pParse->db,0,0,0,0); } break; case 158: /* idlist_opt ::= LP idlist RP */ {yymsp[-2].minor.yy510 = yymsp[-1].minor.yy510;} break; case 159: /* idlist ::= idlist COMMA nm */ {yymsp[-2].minor.yy510 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy510,&yymsp[0].minor.yy0);} break; case 160: /* idlist ::= nm */ {yymsp[0].minor.yy510 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} break; case 161: /* expr ::= LP expr RP */ {yymsp[-2].minor.yy182 = yymsp[-1].minor.yy182;} break; case 162: /* expr ::= ID|INDEXED */ case 163: /* expr ::= JOIN_KW */ yytestcase(yyruleno==163); {yymsp[0].minor.yy182=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} break; case 164: /* 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); yylhsminor.yy182 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); } yymsp[-2].minor.yy182 = yylhsminor.yy182; break; case 165: /* 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); yylhsminor.yy182 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); } yymsp[-4].minor.yy182 = yylhsminor.yy182; break; case 166: /* term ::= NULL|FLOAT|BLOB */ case 167: /* term ::= STRING */ yytestcase(yyruleno==167); {yymsp[0].minor.yy182=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/} break; case 168: /* term ::= INTEGER */ { yylhsminor.yy182 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); } yymsp[0].minor.yy182 = yylhsminor.yy182; break; case 169: /* 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.yy182 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0); sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy182, n); }else{ /* When doing a nested parse, one can include terms in an expression ** that look like this: #1 #2 ... These terms refer to registers ** in the virtual machine. #N is the N-th register. */ Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/ assert( t.n>=2 ); if( pParse->nested==0 ){ sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t); yymsp[0].minor.yy182 = 0; }else{ yymsp[0].minor.yy182 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); if( yymsp[0].minor.yy182 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy182->iTable); } } } break; case 170: /* expr ::= expr COLLATE ID|STRING */ { yymsp[-2].minor.yy182 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy182, &yymsp[0].minor.yy0, 1); } break; case 171: /* expr ::= CAST LP expr AS typetoken RP */ { yymsp[-5].minor.yy182 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy182, yymsp[-3].minor.yy182, 0); } break; case 172: /* expr ::= ID|INDEXED LP distinct exprlist RP */ { if( yymsp[-1].minor.yy232 && yymsp[-1].minor.yy232->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){ sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0); } yylhsminor.yy182 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy232, &yymsp[-4].minor.yy0); if( yymsp[-2].minor.yy502==SF_Distinct && yylhsminor.yy182 ){ yylhsminor.yy182->flags |= EP_Distinct; } } yymsp[-4].minor.yy182 = yylhsminor.yy182; break; case 173: /* expr ::= ID|INDEXED LP STAR RP */ { yylhsminor.yy182 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0); } yymsp[-3].minor.yy182 = yylhsminor.yy182; break; case 174: /* term ::= CTIME_KW */ { yylhsminor.yy182 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0); } yymsp[0].minor.yy182 = yylhsminor.yy182; break; case 175: /* expr ::= LP nexprlist COMMA expr RP */ { ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy232, yymsp[-1].minor.yy182); yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); if( yymsp[-4].minor.yy182 ){ yymsp[-4].minor.yy182->x.pList = pList; }else{ sqlite3ExprListDelete(pParse->db, pList); } } break; case 176: /* expr ::= expr AND expr */ case 177: /* expr ::= expr OR expr */ yytestcase(yyruleno==177); case 178: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==178); case 179: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==179); case 180: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==180); case 181: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==181); case 182: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==182); case 183: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==183); {yymsp[-2].minor.yy182=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy182,yymsp[0].minor.yy182);} break; case 184: /* 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 185: /* 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.yy182); pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy182); yymsp[-2].minor.yy182 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0); if( bNot ) yymsp[-2].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy182, 0); if( yymsp[-2].minor.yy182 ) yymsp[-2].minor.yy182->flags |= EP_InfixFunc; } break; case 186: /* 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.yy182); pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy182); pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy182); yymsp[-4].minor.yy182 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0); if( bNot ) yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy182, 0); if( yymsp[-4].minor.yy182 ) yymsp[-4].minor.yy182->flags |= EP_InfixFunc; } break; case 187: /* expr ::= expr ISNULL|NOTNULL */ {yymsp[-1].minor.yy182 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy182,0);} break; case 188: /* expr ::= expr NOT NULL */ {yymsp[-2].minor.yy182 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy182,0);} break; case 189: /* expr ::= expr IS expr */ { yymsp[-2].minor.yy182 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy182,yymsp[0].minor.yy182); binaryToUnaryIfNull(pParse, yymsp[0].minor.yy182, yymsp[-2].minor.yy182, TK_ISNULL); } break; case 190: /* expr ::= expr IS NOT expr */ { yymsp[-3].minor.yy182 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy182,yymsp[0].minor.yy182); binaryToUnaryIfNull(pParse, yymsp[0].minor.yy182, yymsp[-3].minor.yy182, TK_NOTNULL); } break; case 191: /* expr ::= NOT expr */ case 192: /* expr ::= BITNOT expr */ yytestcase(yyruleno==192); {yymsp[-1].minor.yy182 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy182, 0);/*A-overwrites-B*/} break; case 193: /* expr ::= MINUS expr */ {yymsp[-1].minor.yy182 = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy182, 0);} break; case 194: /* expr ::= PLUS expr */ {yymsp[-1].minor.yy182 = sqlite3PExpr(pParse, TK_UPLUS, yymsp[0].minor.yy182, 0);} break; case 195: /* between_op ::= BETWEEN */ case 198: /* in_op ::= IN */ yytestcase(yyruleno==198); {yymsp[0].minor.yy502 = 0;} break; case 197: /* expr ::= expr between_op expr AND expr */ { ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy182); pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy182); yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy182, 0); if( yymsp[-4].minor.yy182 ){ yymsp[-4].minor.yy182->x.pList = pList; }else{ sqlite3ExprListDelete(pParse->db, pList); } if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy182, 0); } break; case 200: /* expr ::= expr in_op LP exprlist RP */ { if( yymsp[-1].minor.yy232==0 ){ /* Expressions of the form ** ** expr1 IN () ** expr1 NOT IN () ** ** simplify to constants 0 (false) and 1 (true), respectively, ** regardless of the value of expr1. */ sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy182); yymsp[-4].minor.yy182 = sqlite3ExprAlloc(pParse->db, TK_INTEGER,&sqlite3IntTokens[yymsp[-3].minor.yy502],1); }else if( yymsp[-1].minor.yy232->nExpr==1 ){ /* Expressions of the form: ** ** expr1 IN (?1) ** expr1 NOT IN (?2) ** ** with exactly one value on the RHS can be simplified to something ** like this: ** ** expr1 == ?1 ** expr1 <> ?2 ** ** But, the RHS of the == or <> is marked with the EP_Generic flag ** so that it may not contribute to the computation of comparison ** affinity or the collating sequence to use for comparison. Otherwise, ** the semantics would be subtly different from IN or NOT IN. */ Expr *pRHS = yymsp[-1].minor.yy232->a[0].pExpr; yymsp[-1].minor.yy232->a[0].pExpr = 0; sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy232); /* pRHS cannot be NULL because a malloc error would have been detected ** before now and control would have never reached this point */ if( ALWAYS(pRHS) ){ pRHS->flags &= ~EP_Collate; pRHS->flags |= EP_Generic; } yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, yymsp[-3].minor.yy502 ? TK_NE : TK_EQ, yymsp[-4].minor.yy182, pRHS); }else{ yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy182, 0); if( yymsp[-4].minor.yy182 ){ yymsp[-4].minor.yy182->x.pList = yymsp[-1].minor.yy232; sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy182); }else{ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy232); } if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy182, 0); } } break; case 201: /* expr ::= LP select RP */ { yymsp[-2].minor.yy182 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy182, yymsp[-1].minor.yy399); } break; case 202: /* expr ::= expr in_op LP select RP */ { yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy182, 0); sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy182, yymsp[-1].minor.yy399); if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy182, 0); } break; case 203: /* expr ::= expr in_op nm dbnm paren_exprlist */ { SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 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.yy232 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy232); yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy182, 0); sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy182, pSelect); if( yymsp[-3].minor.yy502 ) yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy182, 0); } break; case 204: /* expr ::= EXISTS LP select RP */ { Expr *p; p = yymsp[-3].minor.yy182 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy399); } break; case 205: /* expr ::= CASE case_operand case_exprlist case_else END */ { yymsp[-4].minor.yy182 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy182, 0); if( yymsp[-4].minor.yy182 ){ yymsp[-4].minor.yy182->x.pList = yymsp[-1].minor.yy182 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy232,yymsp[-1].minor.yy182) : yymsp[-2].minor.yy232; sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy182); }else{ sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy232); sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy182); } } break; case 206: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ { yymsp[-4].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy232, yymsp[-2].minor.yy182); yymsp[-4].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy232, yymsp[0].minor.yy182); } break; case 207: /* case_exprlist ::= WHEN expr THEN expr */ { yymsp[-3].minor.yy232 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy182); yymsp[-3].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy232, yymsp[0].minor.yy182); } break; case 210: /* case_operand ::= expr */ {yymsp[0].minor.yy182 = yymsp[0].minor.yy182; /*A-overwrites-X*/} break; case 213: /* nexprlist ::= nexprlist COMMA expr */ {yymsp[-2].minor.yy232 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy232,yymsp[0].minor.yy182);} break; case 214: /* nexprlist ::= expr */ {yymsp[0].minor.yy232 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy182); /*A-overwrites-Y*/} break; case 216: /* paren_exprlist ::= LP exprlist RP */ case 221: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==221); {yymsp[-2].minor.yy232 = yymsp[-1].minor.yy232;} break; case 217: /* 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->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy232, yymsp[-10].minor.yy502, &yymsp[-11].minor.yy0, yymsp[0].minor.yy182, SQLITE_SO_ASC, yymsp[-8].minor.yy502, SQLITE_IDXTYPE_APPDEF); } break; case 218: /* uniqueflag ::= UNIQUE */ case 258: /* raisetype ::= ABORT */ yytestcase(yyruleno==258); {yymsp[0].minor.yy502 = OE_Abort;} break; case 219: /* uniqueflag ::= */ {yymsp[1].minor.yy502 = OE_None;} break; case 222: /* eidlist ::= eidlist COMMA nm collate sortorder */ { yymsp[-4].minor.yy232 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy232, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy502, yymsp[0].minor.yy502); } break; case 223: /* eidlist ::= nm collate sortorder */ { yymsp[-2].minor.yy232 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy502, yymsp[0].minor.yy502); /*A-overwrites-Y*/ } break; case 226: /* cmd ::= DROP INDEX ifexists fullname */ {sqlite3DropIndex(pParse, yymsp[0].minor.yy427, yymsp[-1].minor.yy502);} break; case 227: /* cmd ::= VACUUM */ {sqlite3Vacuum(pParse,0);} break; case 228: /* cmd ::= VACUUM nm */ {sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);} break; case 229: /* cmd ::= PRAGMA nm dbnm */ {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} break; case 230: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} break; case 231: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} break; case 232: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} break; case 233: /* 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 236: /* 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.yy47, &all); } break; case 237: /* 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.yy502, yymsp[-4].minor.yy300.a, yymsp[-4].minor.yy300.b, yymsp[-2].minor.yy427, yymsp[0].minor.yy182, yymsp[-10].minor.yy502, yymsp[-8].minor.yy502); yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ } break; case 238: /* trigger_time ::= BEFORE|AFTER */ { yymsp[0].minor.yy502 = yymsp[0].major; /*A-overwrites-X*/ } break; case 239: /* trigger_time ::= INSTEAD OF */ { yymsp[-1].minor.yy502 = TK_INSTEAD;} break; case 240: /* trigger_time ::= */ { yymsp[1].minor.yy502 = TK_BEFORE; } break; case 241: /* trigger_event ::= DELETE|INSERT */ case 242: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==242); {yymsp[0].minor.yy300.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy300.b = 0;} break; case 243: /* trigger_event ::= UPDATE OF idlist */ {yymsp[-2].minor.yy300.a = TK_UPDATE; yymsp[-2].minor.yy300.b = yymsp[0].minor.yy510;} break; case 244: /* when_clause ::= */ case 263: /* key_opt ::= */ yytestcase(yyruleno==263); { yymsp[1].minor.yy182 = 0; } break; case 245: /* when_clause ::= WHEN expr */ case 264: /* key_opt ::= KEY expr */ yytestcase(yyruleno==264); { yymsp[-1].minor.yy182 = yymsp[0].minor.yy182; } break; case 246: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ { assert( yymsp[-2].minor.yy47!=0 ); yymsp[-2].minor.yy47->pLast->pNext = yymsp[-1].minor.yy47; yymsp[-2].minor.yy47->pLast = yymsp[-1].minor.yy47; } break; case 247: /* trigger_cmd_list ::= trigger_cmd SEMI */ { assert( yymsp[-1].minor.yy47!=0 ); yymsp[-1].minor.yy47->pLast = yymsp[-1].minor.yy47; } break; case 248: /* 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 249: /* tridxby ::= INDEXED BY nm */ { sqlite3ErrorMsg(pParse, "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; case 250: /* tridxby ::= NOT INDEXED */ { sqlite3ErrorMsg(pParse, "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; case 251: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ {yylhsminor.yy47 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy232, yymsp[-1].minor.yy182, yymsp[-6].minor.yy502, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy36);} yymsp[-7].minor.yy47 = yylhsminor.yy47; break; case 252: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ { yylhsminor.yy47 = sqlite3TriggerInsertStep(pParse->db,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy510,yymsp[-2].minor.yy399,yymsp[-6].minor.yy502,yymsp[-1].minor.yy198,yymsp[-7].minor.yy36,yymsp[0].minor.yy36);/*yylhsminor.yy47-overwrites-yymsp[-6].minor.yy502*/ } yymsp[-7].minor.yy47 = yylhsminor.yy47; break; case 253: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ {yylhsminor.yy47 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy182, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy36);} yymsp[-5].minor.yy47 = yylhsminor.yy47; break; case 254: /* trigger_cmd ::= scanpt select scanpt */ {yylhsminor.yy47 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy399, yymsp[-2].minor.yy36, yymsp[0].minor.yy36); /*yylhsminor.yy47-overwrites-yymsp[-1].minor.yy399*/} yymsp[-2].minor.yy47 = yylhsminor.yy47; break; case 255: /* expr ::= RAISE LP IGNORE RP */ { yymsp[-3].minor.yy182 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); if( yymsp[-3].minor.yy182 ){ yymsp[-3].minor.yy182->affinity = OE_Ignore; } } break; case 256: /* expr ::= RAISE LP raisetype COMMA nm RP */ { yymsp[-5].minor.yy182 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); if( yymsp[-5].minor.yy182 ) { yymsp[-5].minor.yy182->affinity = (char)yymsp[-3].minor.yy502; } } break; case 257: /* raisetype ::= ROLLBACK */ {yymsp[0].minor.yy502 = OE_Rollback;} break; case 259: /* raisetype ::= FAIL */ {yymsp[0].minor.yy502 = OE_Fail;} break; case 260: /* cmd ::= DROP TRIGGER ifexists fullname */ { sqlite3DropTrigger(pParse,yymsp[0].minor.yy427,yymsp[-1].minor.yy502); } break; case 261: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ { sqlite3Attach(pParse, yymsp[-3].minor.yy182, yymsp[-1].minor.yy182, yymsp[0].minor.yy182); } break; case 262: /* cmd ::= DETACH database_kw_opt expr */ { sqlite3Detach(pParse, yymsp[0].minor.yy182); } break; case 265: /* cmd ::= REINDEX */ {sqlite3Reindex(pParse, 0, 0);} break; case 266: /* cmd ::= REINDEX nm dbnm */ {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} break; case 267: /* cmd ::= ANALYZE */ {sqlite3Analyze(pParse, 0, 0);} break; case 268: /* cmd ::= ANALYZE nm dbnm */ {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} break; case 269: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ { sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy427,&yymsp[0].minor.yy0); } break; case 270: /* 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 271: /* add_column_fullname ::= fullname */ { disableLookaside(pParse); sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy427); } break; case 272: /* cmd ::= create_vtab */ {sqlite3VtabFinishParse(pParse,0);} break; case 273: /* cmd ::= create_vtab LP vtabarglist RP */ {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} break; case 274: /* 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.yy502); } break; case 275: /* vtabarg ::= */ {sqlite3VtabArgInit(pParse);} break; case 276: /* vtabargtoken ::= ANY */ case 277: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==277); case 278: /* lp ::= LP */ yytestcase(yyruleno==278); {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} break; case 279: /* with ::= WITH wqlist */ case 280: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==280); { sqlite3WithPush(pParse, yymsp[0].minor.yy91, 1); } break; case 281: /* wqlist ::= nm eidlist_opt AS LP select RP */ { yymsp[-5].minor.yy91 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy232, yymsp[-1].minor.yy399); /*A-overwrites-X*/ } break; case 282: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ { yymsp[-7].minor.yy91 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy91, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy232, yymsp[-1].minor.yy399); } break; default: /* (283) input ::= cmdlist */ yytestcase(yyruleno==283); /* (284) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==284); /* (285) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=285); /* (286) ecmd ::= SEMI */ yytestcase(yyruleno==286); /* (287) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==287); /* (288) ecmd ::= explain cmdx */ yytestcase(yyruleno==288); /* (289) trans_opt ::= */ yytestcase(yyruleno==289); /* (290) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==290); /* (291) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==291); /* (292) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==292); /* (293) savepoint_opt ::= */ yytestcase(yyruleno==293); /* (294) cmd ::= create_table create_table_args */ yytestcase(yyruleno==294); /* (295) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==295); /* (296) columnlist ::= columnname carglist */ yytestcase(yyruleno==296); /* (297) nm ::= ID|INDEXED */ yytestcase(yyruleno==297); /* (298) nm ::= STRING */ yytestcase(yyruleno==298); /* (299) nm ::= JOIN_KW */ yytestcase(yyruleno==299); /* (300) typetoken ::= typename */ yytestcase(yyruleno==300); /* (301) typename ::= ID|STRING */ yytestcase(yyruleno==301); /* (302) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=302); /* (303) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=303); /* (304) carglist ::= carglist ccons */ yytestcase(yyruleno==304); /* (305) carglist ::= */ yytestcase(yyruleno==305); /* (306) ccons ::= NULL onconf */ yytestcase(yyruleno==306); /* (307) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==307); /* (308) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==308); /* (309) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=309); /* (310) tconscomma ::= */ yytestcase(yyruleno==310); /* (311) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=311); /* (312) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=312); /* (313) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=313); /* (314) oneselect ::= values */ yytestcase(yyruleno==314); /* (315) sclp ::= selcollist COMMA */ yytestcase(yyruleno==315); /* (316) as ::= ID|STRING */ yytestcase(yyruleno==316); /* (317) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=317); /* (318) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==318); /* (319) exprlist ::= nexprlist */ yytestcase(yyruleno==319); /* (320) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=320); /* (321) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=321); /* (322) nmnum ::= ON */ yytestcase(yyruleno==322); /* (323) nmnum ::= DELETE */ yytestcase(yyruleno==323); /* (324) nmnum ::= DEFAULT */ yytestcase(yyruleno==324); /* (325) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==325); /* (326) foreach_clause ::= */ yytestcase(yyruleno==326); /* (327) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==327); /* (328) trnm ::= nm */ yytestcase(yyruleno==328); /* (329) tridxby ::= */ yytestcase(yyruleno==329); /* (330) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==330); /* (331) database_kw_opt ::= */ yytestcase(yyruleno==331); /* (332) kwcolumn_opt ::= */ yytestcase(yyruleno==332); /* (333) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==333); /* (334) vtabarglist ::= vtabarg */ yytestcase(yyruleno==334); /* (335) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==335); /* (336) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==336); /* (337) anylist ::= */ yytestcase(yyruleno==337); /* (338) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==338); /* (339) anylist ::= anylist ANY */ yytestcase(yyruleno==339); /* (340) with ::= */ yytestcase(yyruleno==340); break; /********** End reduce actions ************************************************/ }; assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) ); yygoto = yyRuleInfo[yyruleno].lhs; yysize = yyRuleInfo[yyruleno].nrhs; yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto); /* There are no SHIFTREDUCE actions on nonterminals because the table ** generator has simplified them to pure REDUCE actions. */ assert( !(yyact>YY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) ); /* It is not possible for a REDUCE to be followed by an error */ assert( yyact!=YY_ERROR_ACTION ); yymsp += yysize+1; yypParser->yytos = yymsp; yymsp->stateno = (YYACTIONTYPE)yyact; yymsp->major = (YYCODETYPE)yygoto; yyTraceShift(yypParser, yyact, "... then shift"); return yyact; } /* ** The following code executes when the parse fails */ #ifndef YYNOERRORRECOVERY static void yy_parse_failed( yyParser *yypParser /* The parser */ ){ sqlite3ParserARG_FETCH sqlite3ParserCTX_FETCH #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); } #endif while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); /* Here code is inserted which will be executed whenever the ** parser fails */ /************ Begin %parse_failure code ***************************************/ /************ End %parse_failure code *****************************************/ sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ sqlite3ParserCTX_STORE } #endif /* YYNOERRORRECOVERY */ /* ** The following code executes when a syntax error first occurs. */ static void yy_syntax_error( yyParser *yypParser, /* The parser */ int yymajor, /* The major type of the error token */ sqlite3ParserTOKENTYPE yyminor /* The minor type of the error token */ ){ sqlite3ParserARG_FETCH sqlite3ParserCTX_FETCH #define TOKEN yyminor /************ Begin %syntax_error code ****************************************/ UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */ if( TOKEN.z[0] ){ sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN); }else{ sqlite3ErrorMsg(pParse, "incomplete input"); } /************ End %syntax_error code ******************************************/ sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ sqlite3ParserCTX_STORE } /* ** The following is executed when the parser accepts */ static void yy_accept( yyParser *yypParser /* The parser */ ){ sqlite3ParserARG_FETCH sqlite3ParserCTX_FETCH #ifndef NDEBUG if( yyTraceFILE ){ fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); } #endif #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt = -1; #endif assert( yypParser->yytos==yypParser->yystack ); /* Here code is inserted which will be executed whenever the ** parser accepts */ /*********** Begin %parse_accept code *****************************************/ /*********** End %parse_accept code *******************************************/ sqlite3ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ sqlite3ParserCTX_STORE } /* The main parser program. ** The first argument is a pointer to a structure obtained from ** "sqlite3ParserAlloc" which describes the current state of the parser. ** The second argument is the major token number. The third is ** the minor token. The fourth optional argument is whatever the |
︙ | ︙ | |||
143590 143591 143592 143593 143594 143595 143596 | SQLITE_PRIVATE void sqlite3Parser( void *yyp, /* The parser */ int yymajor, /* The major token code number */ sqlite3ParserTOKENTYPE yyminor /* The value for the token */ sqlite3ParserARG_PDECL /* Optional %extra_argument parameter */ ){ YYMINORTYPE yyminorunion; | | | > > < < > < | | | > | | > | | 144553 144554 144555 144556 144557 144558 144559 144560 144561 144562 144563 144564 144565 144566 144567 144568 144569 144570 144571 144572 144573 144574 144575 144576 144577 144578 144579 144580 144581 144582 144583 144584 144585 144586 144587 144588 144589 144590 144591 144592 144593 144594 144595 144596 144597 144598 144599 144600 144601 144602 144603 144604 144605 144606 144607 | SQLITE_PRIVATE void sqlite3Parser( void *yyp, /* The parser */ int yymajor, /* The major token code number */ sqlite3ParserTOKENTYPE yyminor /* The value for the token */ sqlite3ParserARG_PDECL /* Optional %extra_argument parameter */ ){ YYMINORTYPE yyminorunion; YYACTIONTYPE yyact; /* The parser action. */ #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) int yyendofinput; /* True if we are at the end of input */ #endif #ifdef YYERRORSYMBOL int yyerrorhit = 0; /* True if yymajor has invoked an error */ #endif yyParser *yypParser = (yyParser*)yyp; /* The parser */ sqlite3ParserCTX_FETCH sqlite3ParserARG_STORE assert( yypParser->yytos!=0 ); #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) yyendofinput = (yymajor==0); #endif yyact = yypParser->yytos->stateno; #ifndef NDEBUG if( yyTraceFILE ){ if( yyact < YY_MIN_REDUCE ){ fprintf(yyTraceFILE,"%sInput '%s' in state %d\n", yyTracePrompt,yyTokenName[yymajor],yyact); }else{ fprintf(yyTraceFILE,"%sInput '%s' with pending reduce %d\n", yyTracePrompt,yyTokenName[yymajor],yyact-YY_MIN_REDUCE); } } #endif do{ assert( yyact==yypParser->yytos->stateno ); yyact = yy_find_shift_action(yymajor,yyact); if( yyact >= YY_MIN_REDUCE ){ yyact = yy_reduce(yypParser,yyact-YY_MIN_REDUCE,yymajor, yyminor sqlite3ParserCTX_PARAM); }else if( yyact <= YY_MAX_SHIFTREDUCE ){ yy_shift(yypParser,yyact,yymajor,yyminor); #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt--; #endif break; }else if( yyact==YY_ACCEPT_ACTION ){ yypParser->yytos--; yy_accept(yypParser); return; }else{ assert( yyact == YY_ERROR_ACTION ); yyminorunion.yy0 = yyminor; |
︙ | ︙ | |||
143699 143700 143701 143702 143703 143704 143705 143706 143707 143708 143709 143710 143711 143712 143713 143714 143715 | yymajor = YYNOCODE; }else if( yymx!=YYERRORSYMBOL ){ yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor); } } yypParser->yyerrcnt = 3; yyerrorhit = 1; #elif defined(YYNOERRORRECOVERY) /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to ** do any kind of error recovery. Instead, simply invoke the syntax ** error routine and continue going as if nothing had happened. ** ** Applications can set this macro (for example inside %include) if ** they intend to abandon the parse upon the first syntax error seen. */ yy_syntax_error(yypParser,yymajor, yyminor); yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); | > > < | | 144664 144665 144666 144667 144668 144669 144670 144671 144672 144673 144674 144675 144676 144677 144678 144679 144680 144681 144682 144683 144684 144685 144686 144687 144688 144689 144690 | yymajor = YYNOCODE; }else if( yymx!=YYERRORSYMBOL ){ yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor); } } yypParser->yyerrcnt = 3; yyerrorhit = 1; if( yymajor==YYNOCODE ) break; yyact = yypParser->yytos->stateno; #elif defined(YYNOERRORRECOVERY) /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to ** do any kind of error recovery. Instead, simply invoke the syntax ** error routine and continue going as if nothing had happened. ** ** Applications can set this macro (for example inside %include) if ** they intend to abandon the parse upon the first syntax error seen. */ yy_syntax_error(yypParser,yymajor, yyminor); yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); break; #else /* YYERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** ** * Report an error message, and throw away the input token. ** ** * If the input token is $, then fail the parse. ** |
︙ | ︙ | |||
143732 143733 143734 143735 143736 143737 143738 | yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); if( yyendofinput ){ yy_parse_failed(yypParser); #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt = -1; #endif } | | | | 144698 144699 144700 144701 144702 144703 144704 144705 144706 144707 144708 144709 144710 144711 144712 144713 144714 144715 | yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); if( yyendofinput ){ yy_parse_failed(yypParser); #ifndef YYNOERRORRECOVERY yypParser->yyerrcnt = -1; #endif } break; #endif } }while( yypParser->yytos>yypParser->yystack ); #ifndef NDEBUG if( yyTraceFILE ){ yyStackEntry *i; char cDiv = '['; fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt); for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){ fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]); |
︙ | ︙ | |||
143912 143913 143914 143915 143916 143917 143918 | ** The code in this file implements a function that determines whether ** or not a given identifier is really an SQL keyword. The same thing ** might be implemented more directly using a hand-written hash table. ** But by using this automatically generated code, the size of the code ** is substantially reduced. This is important for embedded applications ** on platforms with limited memory. */ | | | | | | | | | | | | | | | | | > | | | | | | | | < | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | < | | > | 144878 144879 144880 144881 144882 144883 144884 144885 144886 144887 144888 144889 144890 144891 144892 144893 144894 144895 144896 144897 144898 144899 144900 144901 144902 144903 144904 144905 144906 144907 144908 144909 144910 144911 144912 144913 144914 144915 144916 144917 144918 144919 144920 144921 144922 144923 144924 144925 144926 144927 144928 144929 144930 144931 144932 144933 144934 144935 144936 144937 144938 144939 144940 144941 144942 144943 144944 144945 144946 144947 144948 144949 144950 144951 144952 144953 144954 144955 144956 144957 144958 144959 144960 144961 144962 144963 144964 144965 144966 144967 144968 144969 144970 144971 144972 144973 144974 144975 144976 144977 144978 144979 144980 144981 144982 144983 144984 144985 144986 144987 144988 144989 144990 144991 144992 144993 144994 144995 144996 144997 144998 144999 145000 145001 145002 145003 145004 145005 145006 145007 145008 145009 145010 145011 145012 145013 145014 145015 145016 145017 145018 145019 145020 | ** The code in this file implements a function that determines whether ** or not a given identifier is really an SQL keyword. The same thing ** might be implemented more directly using a hand-written hash table. ** But by using this automatically generated code, the size of the code ** is substantially reduced. This is important for embedded applications ** on platforms with limited memory. */ /* Hash score: 185 */ /* zKWText[] encodes 845 bytes of keyword text in 561 bytes */ /* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */ /* ABLEFTHENDEFERRABLELSEXCEPTRANSACTIONATURALTERAISEXCLUSIVE */ /* XISTSAVEPOINTERSECTRIGGEREFERENCESCONSTRAINTOFFSETEMPORARY */ /* UNIQUERYWITHOUTERELEASEATTACHAVINGROUPDATEBEGINNERECURSIVE */ /* BETWEENOTHINGLOBYCASCADELETECASECOLLATECREATECURRENT_DATE */ /* DETACHIMMEDIATEJOINSERTLIKEMATCHPLANALYZEPRAGMABORTVALUES */ /* VIRTUALIMITWHENOTNULLWHERENAMEAFTEREPLACEANDEFAULT */ /* AUTOINCREMENTCASTCOLUMNCOMMITCONFLICTCROSSCURRENT_TIMESTAMP */ /* RIMARYDEFERREDISTINCTDORDERESTRICTDROPFAILFROMFULLIFISNULL */ /* RIGHTROLLBACKROWUNIONUSINGVACUUMVIEWINITIALLY */ static const char zKWText[560] = { 'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H', 'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G', 'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A', 'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F', 'E','R','R','A','B','L','E','L','S','E','X','C','E','P','T','R','A','N', 'S','A','C','T','I','O','N','A','T','U','R','A','L','T','E','R','A','I', 'S','E','X','C','L','U','S','I','V','E','X','I','S','T','S','A','V','E', 'P','O','I','N','T','E','R','S','E','C','T','R','I','G','G','E','R','E', 'F','E','R','E','N','C','E','S','C','O','N','S','T','R','A','I','N','T', 'O','F','F','S','E','T','E','M','P','O','R','A','R','Y','U','N','I','Q', 'U','E','R','Y','W','I','T','H','O','U','T','E','R','E','L','E','A','S', 'E','A','T','T','A','C','H','A','V','I','N','G','R','O','U','P','D','A', 'T','E','B','E','G','I','N','N','E','R','E','C','U','R','S','I','V','E', 'B','E','T','W','E','E','N','O','T','H','I','N','G','L','O','B','Y','C', 'A','S','C','A','D','E','L','E','T','E','C','A','S','E','C','O','L','L', 'A','T','E','C','R','E','A','T','E','C','U','R','R','E','N','T','_','D', 'A','T','E','D','E','T','A','C','H','I','M','M','E','D','I','A','T','E', 'J','O','I','N','S','E','R','T','L','I','K','E','M','A','T','C','H','P', 'L','A','N','A','L','Y','Z','E','P','R','A','G','M','A','B','O','R','T', 'V','A','L','U','E','S','V','I','R','T','U','A','L','I','M','I','T','W', 'H','E','N','O','T','N','U','L','L','W','H','E','R','E','N','A','M','E', 'A','F','T','E','R','E','P','L','A','C','E','A','N','D','E','F','A','U', 'L','T','A','U','T','O','I','N','C','R','E','M','E','N','T','C','A','S', 'T','C','O','L','U','M','N','C','O','M','M','I','T','C','O','N','F','L', 'I','C','T','C','R','O','S','S','C','U','R','R','E','N','T','_','T','I', 'M','E','S','T','A','M','P','R','I','M','A','R','Y','D','E','F','E','R', 'R','E','D','I','S','T','I','N','C','T','D','O','R','D','E','R','E','S', 'T','R','I','C','T','D','R','O','P','F','A','I','L','F','R','O','M','F', 'U','L','L','I','F','I','S','N','U','L','L','R','I','G','H','T','R','O', 'L','L','B','A','C','K','R','O','W','U','N','I','O','N','U','S','I','N', 'G','V','A','C','U','U','M','V','I','E','W','I','N','I','T','I','A','L', 'L','Y', }; /* aKWHash[i] is the hash value for the i-th keyword */ static const unsigned char aKWHash[127] = { 74, 108, 119, 72, 0, 45, 0, 0, 81, 0, 76, 61, 0, 42, 12, 77, 15, 0, 118, 84, 54, 116, 0, 19, 0, 0, 123, 0, 121, 111, 0, 22, 96, 0, 9, 0, 0, 68, 69, 0, 67, 6, 0, 48, 93, 105, 0, 120, 104, 0, 0, 44, 0, 106, 24, 0, 17, 0, 124, 53, 23, 0, 5, 62, 25, 99, 0, 0, 126, 112, 60, 125, 57, 28, 55, 0, 94, 0, 103, 26, 0, 102, 0, 0, 0, 98, 95, 100, 91, 115, 14, 39, 114, 0, 80, 0, 109, 92, 90, 32, 0, 122, 79, 117, 86, 46, 83, 0, 0, 97, 40, 59, 110, 0, 36, 0, 0, 29, 0, 89, 87, 88, 0, 20, 85, 0, 56, }; /* aKWNext[] forms the hash collision chain. If aKWHash[i]==0 ** then the i-th keyword has no more hash collisions. Otherwise, ** the next keyword with the same hash is aKWHash[i]-1. */ static const unsigned char aKWNext[126] = { 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 0, 21, 0, 0, 0, 0, 0, 50, 0, 43, 3, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 64, 0, 0, 65, 0, 41, 0, 38, 0, 0, 0, 0, 0, 49, 75, 0, 0, 30, 0, 58, 0, 0, 63, 31, 52, 16, 34, 10, 0, 0, 0, 0, 0, 0, 0, 11, 70, 78, 0, 8, 0, 18, 51, 0, 107, 101, 0, 113, 0, 73, 27, 37, 71, 82, 0, 35, 66, 0, 0, }; /* aKWLen[i] is the length (in bytes) of the i-th keyword */ static const unsigned char aKWLen[126] = { 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6, 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 6, 11, 6, 2, 7, 5, 5, 9, 6, 9, 9, 7, 10, 10, 4, 6, 2, 3, 9, 4, 2, 6, 5, 7, 4, 5, 7, 6, 6, 5, 6, 5, 5, 9, 7, 7, 4, 2, 7, 3, 6, 4, 7, 6, 12, 6, 9, 4, 6, 4, 5, 4, 7, 6, 5, 6, 7, 5, 4, 7, 3, 2, 4, 5, 6, 5, 7, 3, 7, 13, 2, 2, 4, 6, 6, 8, 5, 17, 12, 7, 8, 8, 2, 2, 5, 8, 4, 4, 4, 4, 2, 6, 5, 8, 3, 5, 5, 6, 4, 9, 3, }; /* aKWOffset[i] is the index into zKWText[] of the start of ** the text for the i-th keyword. */ static const unsigned short int aKWOffset[126] = { 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33, 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81, 86, 91, 95, 96, 101, 105, 109, 117, 122, 128, 136, 142, 152, 159, 162, 162, 165, 167, 167, 171, 176, 179, 184, 184, 188, 192, 199, 204, 209, 212, 218, 221, 225, 234, 240, 246, 249, 251, 252, 256, 262, 266, 273, 279, 291, 297, 306, 308, 314, 318, 323, 325, 332, 337, 342, 348, 354, 359, 362, 362, 362, 365, 369, 372, 378, 382, 389, 391, 398, 400, 402, 411, 415, 421, 427, 435, 440, 440, 456, 463, 470, 471, 478, 479, 483, 491, 495, 499, 503, 507, 509, 515, 520, 528, 531, 536, 541, 547, 551, 556, }; /* aKWCode[i] is the parser symbol code for the i-th keyword */ static const unsigned char aKWCode[126] = { TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE, TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN, TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD, TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE, TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE, TK_EXCEPT, TK_TRANSACTION,TK_ACTION, TK_ON, TK_JOIN_KW, TK_ALTER, TK_RAISE, TK_EXCLUSIVE, TK_EXISTS, TK_SAVEPOINT, TK_INTERSECT, TK_TRIGGER, TK_REFERENCES, TK_CONSTRAINT, TK_INTO, TK_OFFSET, TK_OF, TK_SET, TK_TEMP, TK_TEMP, TK_OR, TK_UNIQUE, TK_QUERY, TK_WITHOUT, TK_WITH, TK_JOIN_KW, TK_RELEASE, TK_ATTACH, TK_HAVING, TK_GROUP, TK_UPDATE, TK_BEGIN, TK_JOIN_KW, TK_RECURSIVE, TK_BETWEEN, TK_NOTHING, TK_LIKE_KW, TK_BY, TK_CASCADE, TK_ASC, TK_DELETE, TK_CASE, TK_COLLATE, TK_CREATE, TK_CTIME_KW, TK_DETACH, TK_IMMEDIATE, TK_JOIN, TK_INSERT, TK_LIKE_KW, TK_MATCH, TK_PLAN, TK_ANALYZE, TK_PRAGMA, TK_ABORT, TK_VALUES, TK_VIRTUAL, TK_LIMIT, TK_WHEN, TK_NOTNULL, TK_NOT, TK_NO, TK_NULL, TK_WHERE, TK_RENAME, TK_AFTER, TK_REPLACE, TK_AND, TK_DEFAULT, TK_AUTOINCR, TK_TO, TK_IN, TK_CAST, TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW, TK_CTIME_KW, TK_PRIMARY, TK_DEFERRED, TK_DISTINCT, TK_IS, TK_DO, TK_ORDER, TK_RESTRICT, TK_DROP, TK_FAIL, TK_FROM, TK_JOIN_KW, TK_IF, TK_ISNULL, TK_JOIN_KW, TK_ROLLBACK, TK_ROW, TK_UNION, TK_USING, TK_VACUUM, TK_VIEW, TK_INITIALLY, TK_ALL, }; /* 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; |
︙ | ︙ | |||
144119 144120 144121 144122 144123 144124 144125 | testcase( i==53 ); /* HAVING */ testcase( i==54 ); /* GROUP */ testcase( i==55 ); /* UPDATE */ testcase( i==56 ); /* BEGIN */ testcase( i==57 ); /* INNER */ testcase( i==58 ); /* RECURSIVE */ testcase( i==59 ); /* BETWEEN */ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > | | 145087 145088 145089 145090 145091 145092 145093 145094 145095 145096 145097 145098 145099 145100 145101 145102 145103 145104 145105 145106 145107 145108 145109 145110 145111 145112 145113 145114 145115 145116 145117 145118 145119 145120 145121 145122 145123 145124 145125 145126 145127 145128 145129 145130 145131 145132 145133 145134 145135 145136 145137 145138 145139 145140 145141 145142 145143 145144 145145 145146 145147 145148 145149 145150 145151 145152 145153 145154 145155 145156 145157 145158 145159 145160 145161 145162 145163 145164 145165 145166 145167 145168 145169 145170 145171 145172 145173 145174 145175 145176 145177 145178 | testcase( i==53 ); /* HAVING */ testcase( i==54 ); /* GROUP */ testcase( i==55 ); /* UPDATE */ testcase( i==56 ); /* BEGIN */ testcase( i==57 ); /* INNER */ testcase( i==58 ); /* RECURSIVE */ testcase( i==59 ); /* BETWEEN */ testcase( i==60 ); /* NOTHING */ testcase( i==61 ); /* GLOB */ testcase( i==62 ); /* BY */ testcase( i==63 ); /* CASCADE */ testcase( i==64 ); /* ASC */ testcase( i==65 ); /* DELETE */ testcase( i==66 ); /* CASE */ testcase( i==67 ); /* COLLATE */ testcase( i==68 ); /* CREATE */ testcase( i==69 ); /* CURRENT_DATE */ testcase( i==70 ); /* DETACH */ testcase( i==71 ); /* IMMEDIATE */ testcase( i==72 ); /* JOIN */ testcase( i==73 ); /* INSERT */ testcase( i==74 ); /* LIKE */ testcase( i==75 ); /* MATCH */ testcase( i==76 ); /* PLAN */ testcase( i==77 ); /* ANALYZE */ testcase( i==78 ); /* PRAGMA */ testcase( i==79 ); /* ABORT */ testcase( i==80 ); /* VALUES */ testcase( i==81 ); /* VIRTUAL */ testcase( i==82 ); /* LIMIT */ testcase( i==83 ); /* WHEN */ testcase( i==84 ); /* NOTNULL */ testcase( i==85 ); /* NOT */ testcase( i==86 ); /* NO */ testcase( i==87 ); /* NULL */ testcase( i==88 ); /* WHERE */ testcase( i==89 ); /* RENAME */ testcase( i==90 ); /* AFTER */ testcase( i==91 ); /* REPLACE */ testcase( i==92 ); /* AND */ testcase( i==93 ); /* DEFAULT */ testcase( i==94 ); /* AUTOINCREMENT */ testcase( i==95 ); /* TO */ testcase( i==96 ); /* IN */ testcase( i==97 ); /* CAST */ testcase( i==98 ); /* COLUMN */ testcase( i==99 ); /* COMMIT */ testcase( i==100 ); /* CONFLICT */ testcase( i==101 ); /* CROSS */ testcase( i==102 ); /* CURRENT_TIMESTAMP */ testcase( i==103 ); /* CURRENT_TIME */ testcase( i==104 ); /* PRIMARY */ testcase( i==105 ); /* DEFERRED */ testcase( i==106 ); /* DISTINCT */ testcase( i==107 ); /* IS */ testcase( i==108 ); /* DO */ testcase( i==109 ); /* ORDER */ testcase( i==110 ); /* RESTRICT */ testcase( i==111 ); /* DROP */ testcase( i==112 ); /* FAIL */ testcase( i==113 ); /* FROM */ testcase( i==114 ); /* FULL */ testcase( i==115 ); /* IF */ testcase( i==116 ); /* ISNULL */ testcase( i==117 ); /* RIGHT */ testcase( i==118 ); /* ROLLBACK */ testcase( i==119 ); /* ROW */ testcase( i==120 ); /* UNION */ testcase( i==121 ); /* USING */ testcase( i==122 ); /* VACUUM */ testcase( i==123 ); /* VIEW */ testcase( i==124 ); /* INITIALLY */ testcase( i==125 ); /* ALL */ *pType = aKWCode[i]; break; } } return n; } SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char *z, int n){ int id = TK_ID; keywordCode((char*)z, n, &id); return id; } #define SQLITE_N_KEYWORD 126 /************** End of keywordhash.h *****************************************/ /************** Continuing where we left off in tokenize.c *******************/ /* ** If X is a character that can be used in an identifier then |
︙ | ︙ | |||
144551 144552 144553 144554 144555 144556 144557 | } pParse->rc = SQLITE_OK; pParse->zTail = zSql; assert( pzErrMsg!=0 ); /* sqlite3ParserTrace(stdout, "parser: "); */ #ifdef sqlite3Parser_ENGINEALWAYSONSTACK pEngine = &sEngine; | | | | 145521 145522 145523 145524 145525 145526 145527 145528 145529 145530 145531 145532 145533 145534 145535 145536 145537 | } pParse->rc = SQLITE_OK; pParse->zTail = zSql; assert( pzErrMsg!=0 ); /* sqlite3ParserTrace(stdout, "parser: "); */ #ifdef sqlite3Parser_ENGINEALWAYSONSTACK pEngine = &sEngine; sqlite3ParserInit(pEngine, pParse); #else pEngine = sqlite3ParserAlloc(sqlite3Malloc, pParse); if( pEngine==0 ){ sqlite3OomFault(db); return SQLITE_NOMEM_BKPT; } #endif assert( pParse->pNewTable==0 ); assert( pParse->pNewTrigger==0 ); |
︙ | ︙ | |||
144597 144598 144599 144600 144601 144602 144603 | sqlite3ErrorMsg(pParse, "unrecognized token: \"%.*s\"", n, zSql); break; } zSql += n; }else{ pParse->sLastToken.z = zSql; pParse->sLastToken.n = n; | | | 145567 145568 145569 145570 145571 145572 145573 145574 145575 145576 145577 145578 145579 145580 145581 | sqlite3ErrorMsg(pParse, "unrecognized token: \"%.*s\"", n, zSql); break; } zSql += n; }else{ pParse->sLastToken.z = zSql; pParse->sLastToken.n = n; sqlite3Parser(pEngine, tokenType, pParse->sLastToken); lastTokenParsed = tokenType; zSql += n; if( pParse->rc!=SQLITE_OK || db->mallocFailed ) break; } } assert( nErr==0 ); pParse->zTail = zSql; |
︙ | ︙ | |||
145704 145705 145706 145707 145708 145709 145710 145711 145712 145713 145714 145715 145716 145717 | } case SQLITE_CONFIG_STMTJRNL_SPILL: { sqlite3GlobalConfig.nStmtSpill = va_arg(ap, int); break; } default: { rc = SQLITE_ERROR; break; } } va_end(ap); return rc; | > > > > > > > > > > > | 146674 146675 146676 146677 146678 146679 146680 146681 146682 146683 146684 146685 146686 146687 146688 146689 146690 146691 146692 146693 146694 146695 146696 146697 146698 | } case SQLITE_CONFIG_STMTJRNL_SPILL: { sqlite3GlobalConfig.nStmtSpill = va_arg(ap, int); break; } #ifdef SQLITE_ENABLE_SORTER_REFERENCES case SQLITE_CONFIG_SORTERREF_SIZE: { int iVal = va_arg(ap, int); if( iVal<0 ){ iVal = SQLITE_DEFAULT_SORTERREF_SIZE; } sqlite3GlobalConfig.szSorterRef = (u32)iVal; break; } #endif /* SQLITE_ENABLE_SORTER_REFERENCES */ default: { rc = SQLITE_ERROR; break; } } va_end(ap); return rc; |
︙ | ︙ | |||
189763 189764 189765 189766 189767 189768 189769 189770 189771 189772 189773 189774 189775 189776 189777 189778 189779 189780 189781 189782 189783 189784 189785 189786 189787 189788 189789 189790 | ** This is typically a union of many types, one of ** which is sqlite3Fts5ParserFTS5TOKENTYPE. The entry in the union ** for terminal symbols is called "fts5yy0". ** fts5YYSTACKDEPTH is the maximum depth of the parser's stack. If ** zero the stack is dynamically sized using realloc() ** sqlite3Fts5ParserARG_SDECL A static variable declaration for the %extra_argument ** sqlite3Fts5ParserARG_PDECL A parameter declaration for the %extra_argument ** sqlite3Fts5ParserARG_STORE Code to store %extra_argument into fts5yypParser ** sqlite3Fts5ParserARG_FETCH Code to extract %extra_argument from fts5yypParser ** fts5YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** fts5YYNSTATE the combined number of states. ** fts5YYNRULE the number of rules in the grammar ** fts5YYNFTS5TOKEN Number of terminal symbols ** fts5YY_MAX_SHIFT Maximum value for shift actions ** fts5YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions ** fts5YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions ** fts5YY_ERROR_ACTION The fts5yy_action[] code for syntax error ** fts5YY_ACCEPT_ACTION The fts5yy_action[] code for accept ** fts5YY_NO_ACTION The fts5yy_action[] code for no-op ** fts5YY_MIN_REDUCE Minimum value for reduce actions ** fts5YY_MAX_REDUCE Maximum value for reduce actions */ #ifndef INTERFACE # define INTERFACE 1 #endif /************* Begin control #defines *****************************************/ #define fts5YYCODETYPE unsigned char | > > | | > | < | > | | > > > > > | 190744 190745 190746 190747 190748 190749 190750 190751 190752 190753 190754 190755 190756 190757 190758 190759 190760 190761 190762 190763 190764 190765 190766 190767 190768 190769 190770 190771 190772 190773 190774 190775 190776 190777 190778 190779 190780 190781 190782 190783 190784 190785 190786 190787 190788 190789 190790 190791 190792 190793 190794 190795 190796 190797 190798 190799 190800 190801 190802 190803 190804 190805 | ** This is typically a union of many types, one of ** which is sqlite3Fts5ParserFTS5TOKENTYPE. The entry in the union ** for terminal symbols is called "fts5yy0". ** fts5YYSTACKDEPTH is the maximum depth of the parser's stack. If ** zero the stack is dynamically sized using realloc() ** sqlite3Fts5ParserARG_SDECL A static variable declaration for the %extra_argument ** sqlite3Fts5ParserARG_PDECL A parameter declaration for the %extra_argument ** sqlite3Fts5ParserARG_PARAM Code to pass %extra_argument as a subroutine parameter ** sqlite3Fts5ParserARG_STORE Code to store %extra_argument into fts5yypParser ** sqlite3Fts5ParserARG_FETCH Code to extract %extra_argument from fts5yypParser ** sqlite3Fts5ParserCTX_* As sqlite3Fts5ParserARG_ except for %extra_context ** fts5YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. ** fts5YYNSTATE the combined number of states. ** fts5YYNRULE the number of rules in the grammar ** fts5YYNFTS5TOKEN Number of terminal symbols ** fts5YY_MAX_SHIFT Maximum value for shift actions ** fts5YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions ** fts5YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions ** fts5YY_ERROR_ACTION The fts5yy_action[] code for syntax error ** fts5YY_ACCEPT_ACTION The fts5yy_action[] code for accept ** fts5YY_NO_ACTION The fts5yy_action[] code for no-op ** fts5YY_MIN_REDUCE Minimum value for reduce actions ** fts5YY_MAX_REDUCE Maximum value for reduce actions */ #ifndef INTERFACE # define INTERFACE 1 #endif /************* Begin control #defines *****************************************/ #define fts5YYCODETYPE unsigned char #define fts5YYNOCODE 27 #define fts5YYACTIONTYPE unsigned char #define sqlite3Fts5ParserFTS5TOKENTYPE Fts5Token typedef union { int fts5yyinit; sqlite3Fts5ParserFTS5TOKENTYPE fts5yy0; int fts5yy4; Fts5Colset* fts5yy11; Fts5ExprNode* fts5yy24; Fts5ExprNearset* fts5yy46; Fts5ExprPhrase* fts5yy53; } fts5YYMINORTYPE; #ifndef fts5YYSTACKDEPTH #define fts5YYSTACKDEPTH 100 #endif #define sqlite3Fts5ParserARG_SDECL Fts5Parse *pParse; #define sqlite3Fts5ParserARG_PDECL ,Fts5Parse *pParse #define sqlite3Fts5ParserARG_PARAM ,pParse #define sqlite3Fts5ParserARG_FETCH Fts5Parse *pParse=fts5yypParser->pParse; #define sqlite3Fts5ParserARG_STORE fts5yypParser->pParse=pParse; #define sqlite3Fts5ParserCTX_SDECL #define sqlite3Fts5ParserCTX_PDECL #define sqlite3Fts5ParserCTX_PARAM #define sqlite3Fts5ParserCTX_FETCH #define sqlite3Fts5ParserCTX_STORE #define fts5YYNSTATE 35 #define fts5YYNRULE 28 #define fts5YYNFTS5TOKEN 16 #define fts5YY_MAX_SHIFT 34 #define fts5YY_MIN_SHIFTREDUCE 52 #define fts5YY_MAX_SHIFTREDUCE 79 #define fts5YY_ERROR_ACTION 80 |
︙ | ︙ | |||
189883 189884 189885 189886 189887 189888 189889 | ** fts5yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ #define fts5YY_ACTTAB_COUNT (105) static const fts5YYACTIONTYPE fts5yy_action[] = { /* 0 */ 81, 20, 96, 6, 28, 99, 98, 26, 26, 18, /* 10 */ 96, 6, 28, 17, 98, 56, 26, 19, 96, 6, | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 190872 190873 190874 190875 190876 190877 190878 190879 190880 190881 190882 190883 190884 190885 190886 190887 190888 190889 190890 190891 190892 190893 190894 190895 190896 190897 190898 190899 190900 190901 190902 190903 190904 190905 190906 190907 190908 190909 190910 190911 190912 190913 190914 190915 190916 190917 190918 190919 190920 190921 190922 190923 190924 190925 | ** fts5yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ #define fts5YY_ACTTAB_COUNT (105) static const fts5YYACTIONTYPE fts5yy_action[] = { /* 0 */ 81, 20, 96, 6, 28, 99, 98, 26, 26, 18, /* 10 */ 96, 6, 28, 17, 98, 56, 26, 19, 96, 6, /* 20 */ 28, 14, 98, 14, 26, 31, 92, 96, 6, 28, /* 30 */ 108, 98, 25, 26, 21, 96, 6, 28, 78, 98, /* 40 */ 58, 26, 29, 96, 6, 28, 107, 98, 22, 26, /* 50 */ 24, 16, 12, 11, 1, 13, 13, 24, 16, 23, /* 60 */ 11, 33, 34, 13, 97, 8, 27, 32, 98, 7, /* 70 */ 26, 3, 4, 5, 3, 4, 5, 3, 83, 4, /* 80 */ 5, 3, 63, 5, 3, 62, 12, 2, 86, 13, /* 90 */ 9, 30, 10, 10, 54, 57, 75, 78, 78, 53, /* 100 */ 57, 15, 82, 82, 71, }; static const fts5YYCODETYPE fts5yy_lookahead[] = { /* 0 */ 16, 17, 18, 19, 20, 22, 22, 24, 24, 17, /* 10 */ 18, 19, 20, 7, 22, 9, 24, 17, 18, 19, /* 20 */ 20, 9, 22, 9, 24, 13, 17, 18, 19, 20, /* 30 */ 26, 22, 24, 24, 17, 18, 19, 20, 15, 22, /* 40 */ 9, 24, 17, 18, 19, 20, 26, 22, 21, 24, /* 50 */ 6, 7, 9, 9, 10, 12, 12, 6, 7, 21, /* 60 */ 9, 24, 25, 12, 18, 5, 20, 14, 22, 5, /* 70 */ 24, 3, 1, 2, 3, 1, 2, 3, 0, 1, /* 80 */ 2, 3, 11, 2, 3, 11, 9, 10, 5, 12, /* 90 */ 23, 24, 10, 10, 8, 9, 9, 15, 15, 8, /* 100 */ 9, 9, 27, 27, 11, 27, 27, 27, 27, 27, /* 110 */ 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, /* 120 */ 27, }; #define fts5YY_SHIFT_COUNT (34) #define fts5YY_SHIFT_MIN (0) #define fts5YY_SHIFT_MAX (93) static const unsigned char fts5yy_shift_ofst[] = { /* 0 */ 44, 44, 44, 44, 44, 44, 51, 77, 43, 12, /* 10 */ 14, 83, 82, 14, 23, 23, 31, 31, 71, 74, /* 20 */ 78, 81, 86, 91, 6, 53, 53, 60, 64, 68, /* 30 */ 53, 87, 92, 53, 93, }; #define fts5YY_REDUCE_COUNT (17) #define fts5YY_REDUCE_MIN (-17) #define fts5YY_REDUCE_MAX (67) static const signed char fts5yy_reduce_ofst[] = { /* 0 */ -16, -8, 0, 9, 17, 25, 46, -17, -17, 37, /* 10 */ 67, 4, 4, 8, 4, 20, 27, 38, }; static const fts5YYACTIONTYPE fts5yy_default[] = { /* 0 */ 80, 80, 80, 80, 80, 80, 95, 80, 80, 105, /* 10 */ 80, 110, 110, 80, 110, 110, 80, 80, 80, 80, /* 20 */ 80, 91, 80, 80, 80, 101, 100, 80, 80, 90, /* 30 */ 103, 80, 80, 104, 80, }; |
︙ | ︙ | |||
189987 189988 189989 189990 189991 189992 189993 189994 189995 189996 189997 189998 189999 190000 | #ifdef fts5YYTRACKMAXSTACKDEPTH int fts5yyhwm; /* High-water mark of the stack */ #endif #ifndef fts5YYNOERRORRECOVERY int fts5yyerrcnt; /* Shifts left before out of the error */ #endif sqlite3Fts5ParserARG_SDECL /* A place to hold %extra_argument */ #if fts5YYSTACKDEPTH<=0 int fts5yystksz; /* Current side of the stack */ fts5yyStackEntry *fts5yystack; /* The parser's stack */ fts5yyStackEntry fts5yystk0; /* First stack entry */ #else fts5yyStackEntry fts5yystack[fts5YYSTACKDEPTH]; /* The parser's stack */ fts5yyStackEntry *fts5yystackEnd; /* Last entry in the stack */ | > | 190976 190977 190978 190979 190980 190981 190982 190983 190984 190985 190986 190987 190988 190989 190990 | #ifdef fts5YYTRACKMAXSTACKDEPTH int fts5yyhwm; /* High-water mark of the stack */ #endif #ifndef fts5YYNOERRORRECOVERY int fts5yyerrcnt; /* Shifts left before out of the error */ #endif sqlite3Fts5ParserARG_SDECL /* A place to hold %extra_argument */ sqlite3Fts5ParserCTX_SDECL /* A place to hold %extra_context */ #if fts5YYSTACKDEPTH<=0 int fts5yystksz; /* Current side of the stack */ fts5yyStackEntry *fts5yystack; /* The parser's stack */ fts5yyStackEntry fts5yystk0; /* First stack entry */ #else fts5yyStackEntry fts5yystack[fts5YYSTACKDEPTH]; /* The parser's stack */ fts5yyStackEntry *fts5yystackEnd; /* Last entry in the stack */ |
︙ | ︙ | |||
190050 190051 190052 190053 190054 190055 190056 | /* 9 */ "STRING", /* 10 */ "LP", /* 11 */ "RP", /* 12 */ "CARET", /* 13 */ "COMMA", /* 14 */ "PLUS", /* 15 */ "STAR", | | | | | | | | | | | | < | 191040 191041 191042 191043 191044 191045 191046 191047 191048 191049 191050 191051 191052 191053 191054 191055 191056 191057 191058 191059 191060 191061 191062 191063 191064 | /* 9 */ "STRING", /* 10 */ "LP", /* 11 */ "RP", /* 12 */ "CARET", /* 13 */ "COMMA", /* 14 */ "PLUS", /* 15 */ "STAR", /* 16 */ "input", /* 17 */ "expr", /* 18 */ "cnearset", /* 19 */ "exprlist", /* 20 */ "colset", /* 21 */ "colsetlist", /* 22 */ "nearset", /* 23 */ "nearphrases", /* 24 */ "phrase", /* 25 */ "neardist_opt", /* 26 */ "star_opt", }; #endif /* defined(fts5YYCOVERAGE) || !defined(NDEBUG) */ #ifndef NDEBUG /* For tracing reduce actions, the names of all rules are required. */ static const char *const fts5yyRuleName[] = { |
︙ | ︙ | |||
190145 190146 190147 190148 190149 190150 190151 | */ #ifndef fts5YYMALLOCARGTYPE # define fts5YYMALLOCARGTYPE size_t #endif /* Initialize a new parser that has already been allocated. */ | | | > | | | | | | | | | | | | | | | > | > > | | > | | | | | | | | | | | | | | 191134 191135 191136 191137 191138 191139 191140 191141 191142 191143 191144 191145 191146 191147 191148 191149 191150 191151 191152 191153 191154 191155 191156 191157 191158 191159 191160 191161 191162 191163 191164 191165 191166 191167 191168 191169 191170 191171 191172 191173 191174 191175 191176 191177 191178 191179 191180 191181 191182 191183 191184 191185 191186 191187 191188 191189 191190 191191 191192 191193 191194 191195 191196 191197 191198 191199 191200 191201 191202 191203 191204 191205 191206 191207 191208 191209 191210 191211 191212 191213 191214 191215 191216 191217 191218 191219 191220 191221 191222 191223 191224 191225 191226 191227 191228 191229 191230 191231 191232 191233 191234 191235 191236 191237 191238 191239 191240 191241 191242 191243 191244 191245 191246 191247 191248 191249 191250 191251 | */ #ifndef fts5YYMALLOCARGTYPE # define fts5YYMALLOCARGTYPE size_t #endif /* Initialize a new parser that has already been allocated. */ static void sqlite3Fts5ParserInit(void *fts5yypRawParser sqlite3Fts5ParserCTX_PDECL){ fts5yyParser *fts5yypParser = (fts5yyParser*)fts5yypRawParser; sqlite3Fts5ParserCTX_STORE #ifdef fts5YYTRACKMAXSTACKDEPTH fts5yypParser->fts5yyhwm = 0; #endif #if fts5YYSTACKDEPTH<=0 fts5yypParser->fts5yytos = NULL; fts5yypParser->fts5yystack = NULL; fts5yypParser->fts5yystksz = 0; if( fts5yyGrowStack(fts5yypParser) ){ fts5yypParser->fts5yystack = &fts5yypParser->fts5yystk0; fts5yypParser->fts5yystksz = 1; } #endif #ifndef fts5YYNOERRORRECOVERY fts5yypParser->fts5yyerrcnt = -1; #endif fts5yypParser->fts5yytos = fts5yypParser->fts5yystack; fts5yypParser->fts5yystack[0].stateno = 0; fts5yypParser->fts5yystack[0].major = 0; #if fts5YYSTACKDEPTH>0 fts5yypParser->fts5yystackEnd = &fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1]; #endif } #ifndef sqlite3Fts5Parser_ENGINEALWAYSONSTACK /* ** This function allocates a new parser. ** The only argument is a pointer to a function which works like ** malloc. ** ** Inputs: ** A pointer to the function used to allocate memory. ** ** Outputs: ** A pointer to a parser. This pointer is used in subsequent calls ** to sqlite3Fts5Parser and sqlite3Fts5ParserFree. */ static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(fts5YYMALLOCARGTYPE) sqlite3Fts5ParserCTX_PDECL){ fts5yyParser *fts5yypParser; fts5yypParser = (fts5yyParser*)(*mallocProc)( (fts5YYMALLOCARGTYPE)sizeof(fts5yyParser) ); if( fts5yypParser ){ sqlite3Fts5ParserCTX_STORE sqlite3Fts5ParserInit(fts5yypParser sqlite3Fts5ParserCTX_PARAM); } return (void*)fts5yypParser; } #endif /* sqlite3Fts5Parser_ENGINEALWAYSONSTACK */ /* The following function deletes the "minor type" or semantic value ** associated with a symbol. The symbol can be either a terminal ** or nonterminal. "fts5yymajor" is the symbol code, and "fts5yypminor" is ** a pointer to the value to be deleted. The code used to do the ** deletions is derived from the %destructor and/or %token_destructor ** directives of the input grammar. */ static void fts5yy_destructor( fts5yyParser *fts5yypParser, /* The parser */ fts5YYCODETYPE fts5yymajor, /* Type code for object to destroy */ fts5YYMINORTYPE *fts5yypminor /* The object to be destroyed */ ){ sqlite3Fts5ParserARG_FETCH sqlite3Fts5ParserCTX_FETCH switch( fts5yymajor ){ /* Here is inserted the actions which take place when a ** terminal or non-terminal is destroyed. This can happen ** when the symbol is popped from the stack during a ** reduce or during error processing or when a parser is ** being destroyed before it is finished parsing. ** ** Note: during a reduce, the only symbols destroyed are those ** which appear on the RHS of the rule, but which are *not* used ** inside the C code. */ /********* Begin destructor definitions ***************************************/ case 16: /* input */ { (void)pParse; } break; case 17: /* expr */ case 18: /* cnearset */ case 19: /* exprlist */ { sqlite3Fts5ParseNodeFree((fts5yypminor->fts5yy24)); } break; case 20: /* colset */ case 21: /* colsetlist */ { sqlite3_free((fts5yypminor->fts5yy11)); } break; case 22: /* nearset */ case 23: /* nearphrases */ { sqlite3Fts5ParseNearsetFree((fts5yypminor->fts5yy46)); } break; case 24: /* phrase */ { sqlite3Fts5ParsePhraseFree((fts5yypminor->fts5yy53)); } break; /********* End destructor definitions *****************************************/ default: break; /* If no destructor action specified: do nothing */ } } |
︙ | ︙ | |||
190355 190356 190357 190358 190359 190360 190361 | } #endif /* ** Find the appropriate action for a parser given the terminal ** look-ahead token iLookAhead. */ | | < | > < | | 191349 191350 191351 191352 191353 191354 191355 191356 191357 191358 191359 191360 191361 191362 191363 191364 191365 191366 191367 191368 | } #endif /* ** Find the appropriate action for a parser given the terminal ** look-ahead token iLookAhead. */ static fts5YYACTIONTYPE fts5yy_find_shift_action( fts5YYCODETYPE iLookAhead, /* The look-ahead token */ fts5YYACTIONTYPE stateno /* Current state number */ ){ int i; if( stateno>fts5YY_MAX_SHIFT ) return stateno; assert( stateno <= fts5YY_SHIFT_COUNT ); #if defined(fts5YYCOVERAGE) fts5yycoverage[stateno][iLookAhead] = 1; #endif do{ i = fts5yy_shift_ofst[stateno]; |
︙ | ︙ | |||
190425 190426 190427 190428 190429 190430 190431 | } /* ** Find the appropriate action for a parser given the non-terminal ** look-ahead token iLookAhead. */ static int fts5yy_find_reduce_action( | | | 191418 191419 191420 191421 191422 191423 191424 191425 191426 191427 191428 191429 191430 191431 191432 | } /* ** Find the appropriate action for a parser given the non-terminal ** look-ahead token iLookAhead. */ static int fts5yy_find_reduce_action( fts5YYACTIONTYPE stateno, /* Current state number */ fts5YYCODETYPE iLookAhead /* The look-ahead token */ ){ int i; #ifdef fts5YYERRORSYMBOL if( stateno>fts5YY_REDUCE_COUNT ){ return fts5yy_default[stateno]; } |
︙ | ︙ | |||
190454 190455 190456 190457 190458 190459 190460 | return fts5yy_action[i]; } /* ** The following routine is called if the stack overflows. */ static void fts5yyStackOverflow(fts5yyParser *fts5yypParser){ | | > | > | 191447 191448 191449 191450 191451 191452 191453 191454 191455 191456 191457 191458 191459 191460 191461 191462 191463 191464 191465 191466 191467 191468 191469 191470 191471 191472 191473 191474 191475 191476 | return fts5yy_action[i]; } /* ** The following routine is called if the stack overflows. */ static void fts5yyStackOverflow(fts5yyParser *fts5yypParser){ sqlite3Fts5ParserARG_FETCH sqlite3Fts5ParserCTX_FETCH #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sStack Overflow!\n",fts5yyTracePrompt); } #endif while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser); /* Here code is inserted which will execute if the parser ** stack every overflows */ /******** Begin %stack_overflow code ******************************************/ sqlite3Fts5ParseError(pParse, "fts5: parser stack overflow"); /******** End %stack_overflow code ********************************************/ sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument var */ sqlite3Fts5ParserCTX_STORE } /* ** Print tracing information for a SHIFT action */ #ifndef NDEBUG static void fts5yyTraceShift(fts5yyParser *fts5yypParser, int fts5yyNewState, const char *zTag){ |
︙ | ︙ | |||
190496 190497 190498 190499 190500 190501 190502 | #endif /* ** Perform a shift action. */ static void fts5yy_shift( fts5yyParser *fts5yypParser, /* The parser to be shifted */ | | | | 191491 191492 191493 191494 191495 191496 191497 191498 191499 191500 191501 191502 191503 191504 191505 191506 | #endif /* ** Perform a shift action. */ static void fts5yy_shift( fts5yyParser *fts5yypParser, /* The parser to be shifted */ fts5YYACTIONTYPE fts5yyNewState, /* The new state to shift in */ fts5YYCODETYPE fts5yyMajor, /* The major token to shift in */ sqlite3Fts5ParserFTS5TOKENTYPE fts5yyMinor /* The minor token to shift in */ ){ fts5yyStackEntry *fts5yytos; fts5yypParser->fts5yytos++; #ifdef fts5YYTRACKMAXSTACKDEPTH if( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)>fts5yypParser->fts5yyhwm ){ fts5yypParser->fts5yyhwm++; |
︙ | ︙ | |||
190527 190528 190529 190530 190531 190532 190533 | } } #endif if( fts5yyNewState > fts5YY_MAX_SHIFT ){ fts5yyNewState += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; } fts5yytos = fts5yypParser->fts5yytos; | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | 191522 191523 191524 191525 191526 191527 191528 191529 191530 191531 191532 191533 191534 191535 191536 191537 191538 191539 191540 191541 191542 191543 191544 191545 191546 191547 191548 191549 191550 191551 191552 191553 191554 191555 191556 191557 191558 191559 191560 191561 191562 191563 191564 191565 191566 191567 191568 191569 191570 191571 191572 191573 191574 191575 191576 191577 191578 191579 191580 191581 191582 191583 191584 191585 191586 191587 191588 191589 191590 191591 191592 191593 191594 191595 191596 191597 191598 191599 191600 191601 191602 | } } #endif if( fts5yyNewState > fts5YY_MAX_SHIFT ){ fts5yyNewState += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; } fts5yytos = fts5yypParser->fts5yytos; fts5yytos->stateno = fts5yyNewState; fts5yytos->major = fts5yyMajor; fts5yytos->minor.fts5yy0 = fts5yyMinor; fts5yyTraceShift(fts5yypParser, fts5yyNewState, "Shift"); } /* The following table contains information about every rule that ** is used during the reduce. */ static const struct { fts5YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ signed char nrhs; /* Negative of the number of RHS symbols in the rule */ } fts5yyRuleInfo[] = { { 16, -1 }, /* (0) input ::= expr */ { 20, -4 }, /* (1) colset ::= MINUS LCP colsetlist RCP */ { 20, -3 }, /* (2) colset ::= LCP colsetlist RCP */ { 20, -1 }, /* (3) colset ::= STRING */ { 20, -2 }, /* (4) colset ::= MINUS STRING */ { 21, -2 }, /* (5) colsetlist ::= colsetlist STRING */ { 21, -1 }, /* (6) colsetlist ::= STRING */ { 17, -3 }, /* (7) expr ::= expr AND expr */ { 17, -3 }, /* (8) expr ::= expr OR expr */ { 17, -3 }, /* (9) expr ::= expr NOT expr */ { 17, -5 }, /* (10) expr ::= colset COLON LP expr RP */ { 17, -3 }, /* (11) expr ::= LP expr RP */ { 17, -1 }, /* (12) expr ::= exprlist */ { 19, -1 }, /* (13) exprlist ::= cnearset */ { 19, -2 }, /* (14) exprlist ::= exprlist cnearset */ { 18, -1 }, /* (15) cnearset ::= nearset */ { 18, -3 }, /* (16) cnearset ::= colset COLON nearset */ { 22, -1 }, /* (17) nearset ::= phrase */ { 22, -2 }, /* (18) nearset ::= CARET phrase */ { 22, -5 }, /* (19) nearset ::= STRING LP nearphrases neardist_opt RP */ { 23, -1 }, /* (20) nearphrases ::= phrase */ { 23, -2 }, /* (21) nearphrases ::= nearphrases phrase */ { 25, 0 }, /* (22) neardist_opt ::= */ { 25, -2 }, /* (23) neardist_opt ::= COMMA STRING */ { 24, -4 }, /* (24) phrase ::= phrase PLUS STRING star_opt */ { 24, -2 }, /* (25) phrase ::= STRING star_opt */ { 26, -1 }, /* (26) star_opt ::= STAR */ { 26, 0 }, /* (27) star_opt ::= */ }; static void fts5yy_accept(fts5yyParser*); /* Forward Declaration */ /* ** Perform a reduce action and the shift that must immediately ** follow the reduce. ** ** The fts5yyLookahead and fts5yyLookaheadToken parameters provide reduce actions ** access to the lookahead token (if any). The fts5yyLookahead will be fts5YYNOCODE ** if the lookahead token has already been consumed. As this procedure is ** only called from one place, optimizing compilers will in-line it, which ** means that the extra parameters have no performance impact. */ static fts5YYACTIONTYPE fts5yy_reduce( fts5yyParser *fts5yypParser, /* The parser */ unsigned int fts5yyruleno, /* Number of the rule by which to reduce */ int fts5yyLookahead, /* Lookahead token, or fts5YYNOCODE if none */ sqlite3Fts5ParserFTS5TOKENTYPE fts5yyLookaheadToken /* Value of the lookahead token */ sqlite3Fts5ParserCTX_PDECL /* %extra_context */ ){ int fts5yygoto; /* The next state */ int fts5yyact; /* The next action */ fts5yyStackEntry *fts5yymsp; /* The top of the parser's stack */ int fts5yysize; /* Amount to pop the stack */ sqlite3Fts5ParserARG_FETCH (void)fts5yyLookahead; (void)fts5yyLookaheadToken; fts5yymsp = fts5yypParser->fts5yytos; #ifndef NDEBUG if( fts5yyTraceFILE && fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) ){ fts5yysize = fts5yyRuleInfo[fts5yyruleno].nrhs; if( fts5yysize ){ |
︙ | ︙ | |||
190623 190624 190625 190626 190627 190628 190629 | fts5yypParser->fts5yyhwm++; assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)); } #endif #if fts5YYSTACKDEPTH>0 if( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystackEnd ){ fts5yyStackOverflow(fts5yypParser); | > > > | > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 191619 191620 191621 191622 191623 191624 191625 191626 191627 191628 191629 191630 191631 191632 191633 191634 191635 191636 191637 191638 191639 191640 191641 191642 191643 191644 191645 191646 191647 191648 191649 191650 191651 191652 191653 191654 191655 191656 191657 191658 191659 191660 191661 191662 191663 191664 191665 191666 191667 191668 191669 191670 191671 191672 191673 191674 191675 191676 191677 191678 191679 191680 191681 191682 191683 191684 191685 191686 191687 191688 191689 191690 191691 191692 191693 191694 191695 191696 191697 191698 191699 191700 191701 191702 191703 191704 191705 191706 191707 191708 191709 191710 191711 191712 191713 191714 191715 191716 191717 191718 191719 191720 191721 191722 191723 191724 191725 191726 191727 191728 191729 191730 191731 191732 191733 191734 191735 191736 191737 191738 191739 191740 191741 191742 191743 191744 191745 191746 191747 191748 191749 191750 191751 191752 191753 191754 191755 191756 191757 191758 191759 191760 191761 191762 191763 191764 191765 191766 191767 191768 191769 191770 191771 191772 191773 191774 191775 191776 191777 191778 191779 191780 191781 191782 191783 191784 191785 191786 191787 191788 191789 191790 191791 191792 191793 191794 191795 | fts5yypParser->fts5yyhwm++; assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)); } #endif #if fts5YYSTACKDEPTH>0 if( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystackEnd ){ fts5yyStackOverflow(fts5yypParser); /* The call to fts5yyStackOverflow() above pops the stack until it is ** empty, causing the main parser loop to exit. So the return value ** is never used and does not matter. */ return 0; } #else if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){ if( fts5yyGrowStack(fts5yypParser) ){ fts5yyStackOverflow(fts5yypParser); /* The call to fts5yyStackOverflow() above pops the stack until it is ** empty, causing the main parser loop to exit. So the return value ** is never used and does not matter. */ return 0; } fts5yymsp = fts5yypParser->fts5yytos; } #endif } switch( fts5yyruleno ){ /* Beginning here are the reduction cases. A typical example ** follows: ** case 0: ** #line <lineno> <grammarfile> ** { ... } // User supplied code ** #line <lineno> <thisfile> ** break; */ /********** Begin reduce actions **********************************************/ fts5YYMINORTYPE fts5yylhsminor; case 0: /* input ::= expr */ { sqlite3Fts5ParseFinished(pParse, fts5yymsp[0].minor.fts5yy24); } break; case 1: /* colset ::= MINUS LCP colsetlist RCP */ { fts5yymsp[-3].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11); } break; case 2: /* colset ::= LCP colsetlist RCP */ { fts5yymsp[-2].minor.fts5yy11 = fts5yymsp[-1].minor.fts5yy11; } break; case 3: /* colset ::= STRING */ { fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0); } fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11; break; case 4: /* colset ::= MINUS STRING */ { fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0); fts5yymsp[-1].minor.fts5yy11 = sqlite3Fts5ParseColsetInvert(pParse, fts5yymsp[-1].minor.fts5yy11); } break; case 5: /* colsetlist ::= colsetlist STRING */ { fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, fts5yymsp[-1].minor.fts5yy11, &fts5yymsp[0].minor.fts5yy0); } fts5yymsp[-1].minor.fts5yy11 = fts5yylhsminor.fts5yy11; break; case 6: /* colsetlist ::= STRING */ { fts5yylhsminor.fts5yy11 = sqlite3Fts5ParseColset(pParse, 0, &fts5yymsp[0].minor.fts5yy0); } fts5yymsp[0].minor.fts5yy11 = fts5yylhsminor.fts5yy11; break; case 7: /* expr ::= expr AND expr */ { fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_AND, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0); } fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24; break; case 8: /* expr ::= expr OR expr */ { fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_OR, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0); } fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24; break; case 9: /* expr ::= expr NOT expr */ { fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_NOT, fts5yymsp[-2].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24, 0); } fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24; break; case 10: /* expr ::= colset COLON LP expr RP */ { sqlite3Fts5ParseSetColset(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[-4].minor.fts5yy11); fts5yylhsminor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24; } fts5yymsp[-4].minor.fts5yy24 = fts5yylhsminor.fts5yy24; break; case 11: /* expr ::= LP expr RP */ {fts5yymsp[-2].minor.fts5yy24 = fts5yymsp[-1].minor.fts5yy24;} break; case 12: /* expr ::= exprlist */ case 13: /* exprlist ::= cnearset */ fts5yytestcase(fts5yyruleno==13); {fts5yylhsminor.fts5yy24 = fts5yymsp[0].minor.fts5yy24;} fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24; break; case 14: /* exprlist ::= exprlist cnearset */ { fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseImplicitAnd(pParse, fts5yymsp[-1].minor.fts5yy24, fts5yymsp[0].minor.fts5yy24); } fts5yymsp[-1].minor.fts5yy24 = fts5yylhsminor.fts5yy24; break; case 15: /* cnearset ::= nearset */ { fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46); } fts5yymsp[0].minor.fts5yy24 = fts5yylhsminor.fts5yy24; break; case 16: /* cnearset ::= colset COLON nearset */ { fts5yylhsminor.fts5yy24 = sqlite3Fts5ParseNode(pParse, FTS5_STRING, 0, 0, fts5yymsp[0].minor.fts5yy46); sqlite3Fts5ParseSetColset(pParse, fts5yylhsminor.fts5yy24, fts5yymsp[-2].minor.fts5yy11); } fts5yymsp[-2].minor.fts5yy24 = fts5yylhsminor.fts5yy24; break; case 17: /* nearset ::= phrase */ { fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); } fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46; break; case 18: /* nearset ::= CARET phrase */ { sqlite3Fts5ParseSetCaret(fts5yymsp[0].minor.fts5yy53); fts5yymsp[-1].minor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); } break; case 19: /* nearset ::= STRING LP nearphrases neardist_opt RP */ { sqlite3Fts5ParseNear(pParse, &fts5yymsp[-4].minor.fts5yy0); sqlite3Fts5ParseSetDistance(pParse, fts5yymsp[-2].minor.fts5yy46, &fts5yymsp[-1].minor.fts5yy0); fts5yylhsminor.fts5yy46 = fts5yymsp[-2].minor.fts5yy46; } fts5yymsp[-4].minor.fts5yy46 = fts5yylhsminor.fts5yy46; break; case 20: /* nearphrases ::= phrase */ { fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, 0, fts5yymsp[0].minor.fts5yy53); } fts5yymsp[0].minor.fts5yy46 = fts5yylhsminor.fts5yy46; break; case 21: /* nearphrases ::= nearphrases phrase */ { fts5yylhsminor.fts5yy46 = sqlite3Fts5ParseNearset(pParse, fts5yymsp[-1].minor.fts5yy46, fts5yymsp[0].minor.fts5yy53); } fts5yymsp[-1].minor.fts5yy46 = fts5yylhsminor.fts5yy46; break; case 22: /* neardist_opt ::= */ { fts5yymsp[1].minor.fts5yy0.p = 0; fts5yymsp[1].minor.fts5yy0.n = 0; } break; case 23: /* neardist_opt ::= COMMA STRING */ { fts5yymsp[-1].minor.fts5yy0 = fts5yymsp[0].minor.fts5yy0; } break; case 24: /* phrase ::= phrase PLUS STRING star_opt */ { fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, fts5yymsp[-3].minor.fts5yy53, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4); } fts5yymsp[-3].minor.fts5yy53 = fts5yylhsminor.fts5yy53; break; case 25: /* phrase ::= STRING star_opt */ { fts5yylhsminor.fts5yy53 = sqlite3Fts5ParseTerm(pParse, 0, &fts5yymsp[-1].minor.fts5yy0, fts5yymsp[0].minor.fts5yy4); } fts5yymsp[-1].minor.fts5yy53 = fts5yylhsminor.fts5yy53; break; case 26: /* star_opt ::= STAR */ { fts5yymsp[0].minor.fts5yy4 = 1; } break; case 27: /* star_opt ::= */ { fts5yymsp[1].minor.fts5yy4 = 0; } break; |
︙ | ︙ | |||
190808 190809 190810 190811 190812 190813 190814 190815 190816 190817 190818 190819 190820 190821 190822 190823 | assert( fts5yyact!=fts5YY_ERROR_ACTION ); fts5yymsp += fts5yysize+1; fts5yypParser->fts5yytos = fts5yymsp; fts5yymsp->stateno = (fts5YYACTIONTYPE)fts5yyact; fts5yymsp->major = (fts5YYCODETYPE)fts5yygoto; fts5yyTraceShift(fts5yypParser, fts5yyact, "... then shift"); } /* ** The following code executes when the parse fails */ #ifndef fts5YYNOERRORRECOVERY static void fts5yy_parse_failed( fts5yyParser *fts5yypParser /* The parser */ ){ | > | > | > | > | > | > | > | 191810 191811 191812 191813 191814 191815 191816 191817 191818 191819 191820 191821 191822 191823 191824 191825 191826 191827 191828 191829 191830 191831 191832 191833 191834 191835 191836 191837 191838 191839 191840 191841 191842 191843 191844 191845 191846 191847 191848 191849 191850 191851 191852 191853 191854 191855 191856 191857 191858 191859 191860 191861 191862 191863 191864 191865 191866 191867 191868 191869 191870 191871 191872 191873 191874 191875 191876 191877 191878 191879 191880 191881 191882 191883 191884 191885 191886 191887 191888 191889 191890 191891 191892 191893 191894 191895 | assert( fts5yyact!=fts5YY_ERROR_ACTION ); fts5yymsp += fts5yysize+1; fts5yypParser->fts5yytos = fts5yymsp; fts5yymsp->stateno = (fts5YYACTIONTYPE)fts5yyact; fts5yymsp->major = (fts5YYCODETYPE)fts5yygoto; fts5yyTraceShift(fts5yypParser, fts5yyact, "... then shift"); return fts5yyact; } /* ** The following code executes when the parse fails */ #ifndef fts5YYNOERRORRECOVERY static void fts5yy_parse_failed( fts5yyParser *fts5yypParser /* The parser */ ){ sqlite3Fts5ParserARG_FETCH sqlite3Fts5ParserCTX_FETCH #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sFail!\n",fts5yyTracePrompt); } #endif while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser); /* Here code is inserted which will be executed whenever the ** parser fails */ /************ Begin %parse_failure code ***************************************/ /************ End %parse_failure code *****************************************/ sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ sqlite3Fts5ParserCTX_STORE } #endif /* fts5YYNOERRORRECOVERY */ /* ** The following code executes when a syntax error first occurs. */ static void fts5yy_syntax_error( fts5yyParser *fts5yypParser, /* The parser */ int fts5yymajor, /* The major type of the error token */ sqlite3Fts5ParserFTS5TOKENTYPE fts5yyminor /* The minor type of the error token */ ){ sqlite3Fts5ParserARG_FETCH sqlite3Fts5ParserCTX_FETCH #define FTS5TOKEN fts5yyminor /************ Begin %syntax_error code ****************************************/ UNUSED_PARAM(fts5yymajor); /* Silence a compiler warning */ sqlite3Fts5ParseError( pParse, "fts5: syntax error near \"%.*s\"",FTS5TOKEN.n,FTS5TOKEN.p ); /************ End %syntax_error code ******************************************/ sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ sqlite3Fts5ParserCTX_STORE } /* ** The following is executed when the parser accepts */ static void fts5yy_accept( fts5yyParser *fts5yypParser /* The parser */ ){ sqlite3Fts5ParserARG_FETCH sqlite3Fts5ParserCTX_FETCH #ifndef NDEBUG if( fts5yyTraceFILE ){ fprintf(fts5yyTraceFILE,"%sAccept!\n",fts5yyTracePrompt); } #endif #ifndef fts5YYNOERRORRECOVERY fts5yypParser->fts5yyerrcnt = -1; #endif assert( fts5yypParser->fts5yytos==fts5yypParser->fts5yystack ); /* Here code is inserted which will be executed whenever the ** parser accepts */ /*********** Begin %parse_accept code *****************************************/ /*********** End %parse_accept code *******************************************/ sqlite3Fts5ParserARG_STORE /* Suppress warning about unused %extra_argument variable */ sqlite3Fts5ParserCTX_STORE } /* The main parser program. ** The first argument is a pointer to a structure obtained from ** "sqlite3Fts5ParserAlloc" which describes the current state of the parser. ** The second argument is the major token number. The third is ** the minor token. The fourth optional argument is whatever the |
︙ | ︙ | |||
190901 190902 190903 190904 190905 190906 190907 | static void sqlite3Fts5Parser( void *fts5yyp, /* The parser */ int fts5yymajor, /* The major token code number */ sqlite3Fts5ParserFTS5TOKENTYPE fts5yyminor /* The value for the token */ sqlite3Fts5ParserARG_PDECL /* Optional %extra_argument parameter */ ){ fts5YYMINORTYPE fts5yyminorunion; | | | > > < < > < | | | > | | > | | 191910 191911 191912 191913 191914 191915 191916 191917 191918 191919 191920 191921 191922 191923 191924 191925 191926 191927 191928 191929 191930 191931 191932 191933 191934 191935 191936 191937 191938 191939 191940 191941 191942 191943 191944 191945 191946 191947 191948 191949 191950 191951 191952 191953 191954 191955 191956 191957 191958 191959 191960 191961 191962 191963 191964 | static void sqlite3Fts5Parser( void *fts5yyp, /* The parser */ int fts5yymajor, /* The major token code number */ sqlite3Fts5ParserFTS5TOKENTYPE fts5yyminor /* The value for the token */ sqlite3Fts5ParserARG_PDECL /* Optional %extra_argument parameter */ ){ fts5YYMINORTYPE fts5yyminorunion; fts5YYACTIONTYPE fts5yyact; /* The parser action. */ #if !defined(fts5YYERRORSYMBOL) && !defined(fts5YYNOERRORRECOVERY) int fts5yyendofinput; /* True if we are at the end of input */ #endif #ifdef fts5YYERRORSYMBOL int fts5yyerrorhit = 0; /* True if fts5yymajor has invoked an error */ #endif fts5yyParser *fts5yypParser = (fts5yyParser*)fts5yyp; /* The parser */ sqlite3Fts5ParserCTX_FETCH sqlite3Fts5ParserARG_STORE assert( fts5yypParser->fts5yytos!=0 ); #if !defined(fts5YYERRORSYMBOL) && !defined(fts5YYNOERRORRECOVERY) fts5yyendofinput = (fts5yymajor==0); #endif fts5yyact = fts5yypParser->fts5yytos->stateno; #ifndef NDEBUG if( fts5yyTraceFILE ){ if( fts5yyact < fts5YY_MIN_REDUCE ){ fprintf(fts5yyTraceFILE,"%sInput '%s' in state %d\n", fts5yyTracePrompt,fts5yyTokenName[fts5yymajor],fts5yyact); }else{ fprintf(fts5yyTraceFILE,"%sInput '%s' with pending reduce %d\n", fts5yyTracePrompt,fts5yyTokenName[fts5yymajor],fts5yyact-fts5YY_MIN_REDUCE); } } #endif do{ assert( fts5yyact==fts5yypParser->fts5yytos->stateno ); fts5yyact = fts5yy_find_shift_action(fts5yymajor,fts5yyact); if( fts5yyact >= fts5YY_MIN_REDUCE ){ fts5yyact = fts5yy_reduce(fts5yypParser,fts5yyact-fts5YY_MIN_REDUCE,fts5yymajor, fts5yyminor sqlite3Fts5ParserCTX_PARAM); }else if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){ fts5yy_shift(fts5yypParser,fts5yyact,fts5yymajor,fts5yyminor); #ifndef fts5YYNOERRORRECOVERY fts5yypParser->fts5yyerrcnt--; #endif break; }else if( fts5yyact==fts5YY_ACCEPT_ACTION ){ fts5yypParser->fts5yytos--; fts5yy_accept(fts5yypParser); return; }else{ assert( fts5yyact == fts5YY_ERROR_ACTION ); fts5yyminorunion.fts5yy0 = fts5yyminor; |
︙ | ︙ | |||
191010 191011 191012 191013 191014 191015 191016 191017 191018 191019 191020 191021 191022 191023 191024 191025 191026 | fts5yymajor = fts5YYNOCODE; }else if( fts5yymx!=fts5YYERRORSYMBOL ){ fts5yy_shift(fts5yypParser,fts5yyact,fts5YYERRORSYMBOL,fts5yyminor); } } fts5yypParser->fts5yyerrcnt = 3; fts5yyerrorhit = 1; #elif defined(fts5YYNOERRORRECOVERY) /* If the fts5YYNOERRORRECOVERY macro is defined, then do not attempt to ** do any kind of error recovery. Instead, simply invoke the syntax ** error routine and continue going as if nothing had happened. ** ** Applications can set this macro (for example inside %include) if ** they intend to abandon the parse upon the first syntax error seen. */ fts5yy_syntax_error(fts5yypParser,fts5yymajor, fts5yyminor); fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion); | > > < | | 192021 192022 192023 192024 192025 192026 192027 192028 192029 192030 192031 192032 192033 192034 192035 192036 192037 192038 192039 192040 192041 192042 192043 192044 192045 192046 192047 | fts5yymajor = fts5YYNOCODE; }else if( fts5yymx!=fts5YYERRORSYMBOL ){ fts5yy_shift(fts5yypParser,fts5yyact,fts5YYERRORSYMBOL,fts5yyminor); } } fts5yypParser->fts5yyerrcnt = 3; fts5yyerrorhit = 1; if( fts5yymajor==fts5YYNOCODE ) break; fts5yyact = fts5yypParser->fts5yytos->stateno; #elif defined(fts5YYNOERRORRECOVERY) /* If the fts5YYNOERRORRECOVERY macro is defined, then do not attempt to ** do any kind of error recovery. Instead, simply invoke the syntax ** error routine and continue going as if nothing had happened. ** ** Applications can set this macro (for example inside %include) if ** they intend to abandon the parse upon the first syntax error seen. */ fts5yy_syntax_error(fts5yypParser,fts5yymajor, fts5yyminor); fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion); break; #else /* fts5YYERRORSYMBOL is not defined */ /* This is what we do if the grammar does not define ERROR: ** ** * Report an error message, and throw away the input token. ** ** * If the input token is $, then fail the parse. ** |
︙ | ︙ | |||
191043 191044 191045 191046 191047 191048 191049 | fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion); if( fts5yyendofinput ){ fts5yy_parse_failed(fts5yypParser); #ifndef fts5YYNOERRORRECOVERY fts5yypParser->fts5yyerrcnt = -1; #endif } | | | | 192055 192056 192057 192058 192059 192060 192061 192062 192063 192064 192065 192066 192067 192068 192069 192070 192071 192072 | fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion); if( fts5yyendofinput ){ fts5yy_parse_failed(fts5yypParser); #ifndef fts5YYNOERRORRECOVERY fts5yypParser->fts5yyerrcnt = -1; #endif } break; #endif } }while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ); #ifndef NDEBUG if( fts5yyTraceFILE ){ fts5yyStackEntry *i; char cDiv = '['; fprintf(fts5yyTraceFILE,"%sReturn. Stack=",fts5yyTracePrompt); for(i=&fts5yypParser->fts5yystack[1]; i<=fts5yypParser->fts5yytos; i++){ fprintf(fts5yyTraceFILE,"%c%s", cDiv, fts5yyTokenName[i->major]); |
︙ | ︙ | |||
205658 205659 205660 205661 205662 205663 205664 | 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); | | | 206670 206671 206672 206673 206674 206675 206676 206677 206678 206679 206680 206681 206682 206683 206684 | 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: 2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8b4a3", -1, SQLITE_TRANSIENT); } static int fts5Init(sqlite3 *db){ static const sqlite3_module fts5Mod = { /* iVersion */ 2, /* xCreate */ fts5CreateMethod, /* xConnect */ fts5ConnectMethod, |
︙ | ︙ | |||
209928 209929 209930 209931 209932 209933 209934 | #endif return rc; } #endif /* SQLITE_CORE */ #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ /************** End of stmt.c ************************************************/ | | | | 210940 210941 210942 210943 210944 210945 210946 210947 210948 210949 210950 210951 210952 210953 | #endif return rc; } #endif /* SQLITE_CORE */ #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ /************** End of stmt.c ************************************************/ #if __LINE__!=210947 #undef SQLITE_SOURCE_ID #define SQLITE_SOURCE_ID "2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8alt2" #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.24.0" #define SQLITE_VERSION_NUMBER 3024000 #define SQLITE_SOURCE_ID "2018-04-25 13:27:07 3bcdbccf530e2a5aab7b91f4b9e5535cced91f242c49ff69b05a75d643b8b4a3" /* ** 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 |
︙ | ︙ | |||
1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 | ** Or if the threshold is -1, statement journals are always held ** exclusively in memory. ** Since many statement journals never become large, setting the spill ** threshold to a value such as 64KiB can greatly reduce the amount of ** I/O required to support statement rollback. ** The default value for this setting is controlled by the ** [SQLITE_STMTJRNL_SPILL] compile-time option. ** </dl> */ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ #define SQLITE_CONFIG_SERIALIZED 3 /* nil */ #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ | > > > > > > > > > > > > > > > > | 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 | ** Or if the threshold is -1, statement journals are always held ** exclusively in memory. ** Since many statement journals never become large, setting the spill ** threshold to a value such as 64KiB can greatly reduce the amount of ** I/O required to support statement rollback. ** The default value for this setting is controlled by the ** [SQLITE_STMTJRNL_SPILL] compile-time option. ** ** [[SQLITE_CONFIG_SORTERREF_SIZE]] ** <dt>SQLITE_CONFIG_SORTERREF_SIZE ** <dd>The SQLITE_CONFIG_SORTERREF_SIZE option accepts a single parameter ** of type (int) - the new value of the sorter-reference size threshold. ** Usually, when SQLite uses an external sort to order records according ** to an ORDER BY clause, all fields required by the caller are present in the ** sorted records. However, if SQLite determines based on the declared type ** of a table column that its values are likely to be very large - larger ** than the configured sorter-reference size threshold - then a reference ** is stored in each sorted record and the required column values loaded ** from the database as records are returned in sorted order. The default ** value for this option is to never use this optimization. Specifying a ** negative value for this option restores the default behaviour. ** This option is only available if SQLite is compiled with the ** [SQLITE_ENABLE_SORTER_REFERENCES] compile-time option. ** </dl> */ #define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ #define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ #define SQLITE_CONFIG_SERIALIZED 3 /* nil */ #define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ #define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ |
︙ | ︙ | |||
1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 | #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */ #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */ #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */ #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */ #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */ #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */ #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */ /* ** CAPI3REF: Database Connection Configuration Options ** ** These constants are the available integer configuration options that ** can be passed as the second argument to the [sqlite3_db_config()] interface. ** | > | 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 | #define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */ #define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */ #define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */ #define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */ #define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */ #define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */ #define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */ #define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */ /* ** CAPI3REF: Database Connection Configuration Options ** ** These constants are the available integer configuration options that ** can be passed as the second argument to the [sqlite3_db_config()] interface. ** |
︙ | ︙ |
Changes to win/Makefile.PellesCGMake.
︙ | ︙ | |||
87 88 89 90 91 92 93 | SQLITEOBJ=$(foreach sf,$(SQLITESRC),$(sf:.c=.obj)) SQLITEDEFINES=-DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_WIN32_NO_ANSI # define the SQLite shell files, which need special flags on compile SQLITESHELLSRC=shell.c ORIGSQLITESHELLSRC=$(foreach sf,$(SQLITESHELLSRC),$(SRCDIR)$(sf)) SQLITESHELLOBJ=$(foreach sf,$(SQLITESHELLSRC),$(sf:.c=.obj)) | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | SQLITEOBJ=$(foreach sf,$(SQLITESRC),$(sf:.c=.obj)) SQLITEDEFINES=-DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_WIN32_NO_ANSI # define the SQLite shell files, which need special flags on compile SQLITESHELLSRC=shell.c ORIGSQLITESHELLSRC=$(foreach sf,$(SQLITESHELLSRC),$(SRCDIR)$(sf)) SQLITESHELLOBJ=$(foreach sf,$(SQLITESHELLSRC),$(sf:.c=.obj)) SQLITESHELLDEFINES=-DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen # define the th scripting files, which need special flags on compile THSRC=th.c th_lang.c ORIGTHSRC=$(foreach sf,$(THSRC),$(SRCDIR)$(sf)) THOBJ=$(foreach sf,$(THSRC),$(sf:.c=.obj)) # define the zlib files, needed by this compile |
︙ | ︙ |
Changes to win/Makefile.dmc.
︙ | ︙ | |||
24 25 26 27 28 29 30 | CFLAGS = -o BCC = $(DMDIR)\bin\dmc $(CFLAGS) TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL) LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB | | | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | CFLAGS = -o BCC = $(DMDIR)\bin\dmc $(CFLAGS) TCC = $(DMDIR)\bin\dmc $(CFLAGS) $(DMCDEF) $(SSL) $(INCL) LIBS = $(DMDIR)\extra\lib\ zlib wsock32 advapi32 SQLITE_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB SHELL_OPTIONS = -DNDEBUG=1 -DSQLITE_THREADSAFE=0 -DSQLITE_DEFAULT_MEMSTATUS=0 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 -DSQLITE_LIKE_DOESNT_MATCH_BLOBS -DSQLITE_OMIT_DECLTYPE -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_GET_TABLE -DSQLITE_OMIT_PROGRESS_CALLBACK -DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_MAX_EXPR_DEPTH=0 -DSQLITE_USE_ALLOCA -DSQLITE_ENABLE_LOCKING_STYLE=0 -DSQLITE_DEFAULT_FILE_FORMAT=4 -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_DBSTAT_VTAB -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_HAVE_ZLIB -DSQLITE_INTROSPECTION_PRAGMAS -DSQLITE_ENABLE_DBPAGE_VTAB -Dmain=sqlite3_shell -DSQLITE_SHELL_IS_UTF8=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc -Daccess=file_access -Dsystem=fossil_system -Dgetenv=fossil_getenv -Dfopen=fossil_fopen SRC = add_.c allrepo_.c attach_.c bag_.c bisect_.c blob_.c branch_.c browse_.c builtin_.c bundle_.c cache_.c captcha_.c cgi_.c checkin_.c checkout_.c clearsign_.c clone_.c comformat_.c configure_.c content_.c cookies_.c db_.c delta_.c deltacmd_.c descendants_.c diff_.c diffcmd_.c dispatch_.c doc_.c encode_.c etag_.c event_.c export_.c file_.c finfo_.c foci_.c fshell_.c fusefs_.c glob_.c graph_.c gzip_.c hname_.c http_.c http_socket_.c http_ssl_.c http_transport_.c import_.c info_.c json_.c json_artifact_.c json_branch_.c json_config_.c json_diff_.c json_dir_.c json_finfo_.c json_login_.c json_query_.c json_report_.c json_status_.c json_tag_.c json_timeline_.c json_user_.c json_wiki_.c leaf_.c loadctrl_.c login_.c lookslike_.c main_.c manifest_.c markdown_.c markdown_html_.c md5_.c merge_.c merge3_.c moderate_.c name_.c path_.c piechart_.c pivot_.c popen_.c pqueue_.c printf_.c publish_.c purge_.c rebuild_.c regexp_.c report_.c rss_.c schema_.c search_.c security_audit_.c setup_.c sha1_.c sha1hard_.c sha3_.c shun_.c sitemap_.c skins_.c sqlcmd_.c stash_.c stat_.c statrep_.c style_.c sync_.c tag_.c tar_.c th_main_.c timeline_.c tkt_.c tktsetup_.c undo_.c unicode_.c unversioned_.c update_.c url_.c user_.c utf8_.c util_.c verify_.c vfile_.c wiki_.c wikiformat_.c winfile_.c winhttp_.c wysiwyg_.c xfer_.c xfersetup_.c zip_.c OBJ = $(OBJDIR)\add$O $(OBJDIR)\allrepo$O $(OBJDIR)\attach$O $(OBJDIR)\bag$O $(OBJDIR)\bisect$O $(OBJDIR)\blob$O $(OBJDIR)\branch$O $(OBJDIR)\browse$O $(OBJDIR)\builtin$O $(OBJDIR)\bundle$O $(OBJDIR)\cache$O $(OBJDIR)\captcha$O $(OBJDIR)\cgi$O $(OBJDIR)\checkin$O $(OBJDIR)\checkout$O $(OBJDIR)\clearsign$O $(OBJDIR)\clone$O $(OBJDIR)\comformat$O $(OBJDIR)\configure$O $(OBJDIR)\content$O $(OBJDIR)\cookies$O $(OBJDIR)\db$O $(OBJDIR)\delta$O $(OBJDIR)\deltacmd$O $(OBJDIR)\descendants$O $(OBJDIR)\diff$O $(OBJDIR)\diffcmd$O $(OBJDIR)\dispatch$O $(OBJDIR)\doc$O $(OBJDIR)\encode$O $(OBJDIR)\etag$O $(OBJDIR)\event$O $(OBJDIR)\export$O $(OBJDIR)\file$O $(OBJDIR)\finfo$O $(OBJDIR)\foci$O $(OBJDIR)\fshell$O $(OBJDIR)\fusefs$O $(OBJDIR)\glob$O $(OBJDIR)\graph$O $(OBJDIR)\gzip$O $(OBJDIR)\hname$O $(OBJDIR)\http$O $(OBJDIR)\http_socket$O $(OBJDIR)\http_ssl$O $(OBJDIR)\http_transport$O $(OBJDIR)\import$O $(OBJDIR)\info$O $(OBJDIR)\json$O $(OBJDIR)\json_artifact$O $(OBJDIR)\json_branch$O $(OBJDIR)\json_config$O $(OBJDIR)\json_diff$O $(OBJDIR)\json_dir$O $(OBJDIR)\json_finfo$O $(OBJDIR)\json_login$O $(OBJDIR)\json_query$O $(OBJDIR)\json_report$O $(OBJDIR)\json_status$O $(OBJDIR)\json_tag$O $(OBJDIR)\json_timeline$O $(OBJDIR)\json_user$O $(OBJDIR)\json_wiki$O $(OBJDIR)\leaf$O $(OBJDIR)\loadctrl$O $(OBJDIR)\login$O $(OBJDIR)\lookslike$O $(OBJDIR)\main$O $(OBJDIR)\manifest$O $(OBJDIR)\markdown$O $(OBJDIR)\markdown_html$O $(OBJDIR)\md5$O $(OBJDIR)\merge$O $(OBJDIR)\merge3$O $(OBJDIR)\moderate$O $(OBJDIR)\name$O $(OBJDIR)\path$O $(OBJDIR)\piechart$O $(OBJDIR)\pivot$O $(OBJDIR)\popen$O $(OBJDIR)\pqueue$O $(OBJDIR)\printf$O $(OBJDIR)\publish$O $(OBJDIR)\purge$O $(OBJDIR)\rebuild$O $(OBJDIR)\regexp$O $(OBJDIR)\report$O $(OBJDIR)\rss$O $(OBJDIR)\schema$O $(OBJDIR)\search$O $(OBJDIR)\security_audit$O $(OBJDIR)\setup$O $(OBJDIR)\sha1$O $(OBJDIR)\sha1hard$O $(OBJDIR)\sha3$O $(OBJDIR)\shun$O $(OBJDIR)\sitemap$O $(OBJDIR)\skins$O $(OBJDIR)\sqlcmd$O $(OBJDIR)\stash$O $(OBJDIR)\stat$O $(OBJDIR)\statrep$O $(OBJDIR)\style$O $(OBJDIR)\sync$O $(OBJDIR)\tag$O $(OBJDIR)\tar$O $(OBJDIR)\th_main$O $(OBJDIR)\timeline$O $(OBJDIR)\tkt$O $(OBJDIR)\tktsetup$O $(OBJDIR)\undo$O $(OBJDIR)\unicode$O $(OBJDIR)\unversioned$O $(OBJDIR)\update$O $(OBJDIR)\url$O $(OBJDIR)\user$O $(OBJDIR)\utf8$O $(OBJDIR)\util$O $(OBJDIR)\verify$O $(OBJDIR)\vfile$O $(OBJDIR)\wiki$O $(OBJDIR)\wikiformat$O $(OBJDIR)\winfile$O $(OBJDIR)\winhttp$O $(OBJDIR)\wysiwyg$O $(OBJDIR)\xfer$O $(OBJDIR)\xfersetup$O $(OBJDIR)\zip$O $(OBJDIR)\shell$O $(OBJDIR)\sqlite3$O $(OBJDIR)\th$O $(OBJDIR)\th_lang$O RC=$(DMDIR)\bin\rcc |
︙ | ︙ |
Changes to win/Makefile.mingw.
︙ | ︙ | |||
2332 2333 2334 2335 2336 2337 2338 | -DSQLITE_HAVE_ZLIB \ -DSQLITE_INTROSPECTION_PRAGMAS \ -DSQLITE_ENABLE_DBPAGE_VTAB \ -Dmain=sqlite3_shell \ -DSQLITE_SHELL_IS_UTF8=1 \ -DSQLITE_OMIT_LOAD_EXTENSION=1 \ -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \ | | > | 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 | -DSQLITE_HAVE_ZLIB \ -DSQLITE_INTROSPECTION_PRAGMAS \ -DSQLITE_ENABLE_DBPAGE_VTAB \ -Dmain=sqlite3_shell \ -DSQLITE_SHELL_IS_UTF8=1 \ -DSQLITE_OMIT_LOAD_EXTENSION=1 \ -DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \ -DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname \ -DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc \ -Daccess=file_access \ -Dsystem=fossil_system \ -Dgetenv=fossil_getenv \ -Dfopen=fossil_fopen MINIZ_OPTIONS = -DMINIZ_NO_STDIO \ -DMINIZ_NO_TIME \ |
︙ | ︙ |
Changes to win/Makefile.msc.
︙ | ︙ | |||
365 366 367 368 369 370 371 | /DSQLITE_HAVE_ZLIB \ /DSQLITE_INTROSPECTION_PRAGMAS \ /DSQLITE_ENABLE_DBPAGE_VTAB \ /Dmain=sqlite3_shell \ /DSQLITE_SHELL_IS_UTF8=1 \ /DSQLITE_OMIT_LOAD_EXTENSION=1 \ /DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \ | | > | 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | /DSQLITE_HAVE_ZLIB \ /DSQLITE_INTROSPECTION_PRAGMAS \ /DSQLITE_ENABLE_DBPAGE_VTAB \ /Dmain=sqlite3_shell \ /DSQLITE_SHELL_IS_UTF8=1 \ /DSQLITE_OMIT_LOAD_EXTENSION=1 \ /DUSE_SYSTEM_SQLITE=$(USE_SYSTEM_SQLITE) \ /DSQLITE_SHELL_DBNAME_PROC=sqlcmd_get_dbname \ /DSQLITE_SHELL_INIT_PROC=sqlcmd_init_proc \ /Daccess=file_access \ /Dsystem=fossil_system \ /Dgetenv=fossil_getenv \ /Dfopen=fossil_fopen MINIZ_OPTIONS = /DMINIZ_NO_STDIO \ /DMINIZ_NO_TIME \ |
︙ | ︙ |