diff options
| author | 2022-02-27 15:06:20 +0100 | |
|---|---|---|
| committer | 2022-02-27 15:24:21 +0100 | |
| commit | 9a22661f70e839c528d931c677667088b35277dc (patch) | |
| tree | d616ae50f415c14e848ee2c85824647efe0a9953 /c | |
| parent | fix sentinel (diff) | |
| download | zig-sqlite-9a22661f70e839c528d931c677667088b35277dc.tar.gz zig-sqlite-9a22661f70e839c528d931c677667088b35277dc.tar.xz zig-sqlite-9a22661f70e839c528d931c677667088b35277dc.zip | |
update sqlite bundled source code to 3.38.0
Diffstat (limited to 'c')
| -rw-r--r-- | c/sqlite3.c | 9436 | ||||
| -rw-r--r-- | c/sqlite3.h | 372 |
2 files changed, 5958 insertions, 3850 deletions
diff --git a/c/sqlite3.c b/c/sqlite3.c index fba450a..5394db4 100644 --- a/c/sqlite3.c +++ b/c/sqlite3.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /****************************************************************************** | 1 | /****************************************************************************** |
| 2 | ** This file is an amalgamation of many separate C source files from SQLite | 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | ** version 3.37.1. By combining all the individual C code files into this | 3 | ** version 3.38.0. By combining all the individual C code files into this |
| 4 | ** single large file, the entire code can be compiled as a single translation | 4 | ** single large file, the entire code can be compiled as a single translation |
| 5 | ** unit. This allows many compilers to do optimizations that would not be | 5 | ** unit. This allows many compilers to do optimizations that would not be |
| 6 | ** possible if the files were compiled separately. Performance improvements | 6 | ** possible if the files were compiled separately. Performance improvements |
| @@ -452,9 +452,9 @@ extern "C" { | |||
| 452 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], | 452 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 453 | ** [sqlite_version()] and [sqlite_source_id()]. | 453 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 454 | */ | 454 | */ |
| 455 | #define SQLITE_VERSION "3.37.1" | 455 | #define SQLITE_VERSION "3.38.0" |
| 456 | #define SQLITE_VERSION_NUMBER 3037001 | 456 | #define SQLITE_VERSION_NUMBER 3038000 |
| 457 | #define SQLITE_SOURCE_ID "2021-12-30 15:30:28 378629bf2ea546f73eee84063c5358439a12f7300e433f18c9e1bddd948dea62" | 457 | #define SQLITE_SOURCE_ID "2022-02-22 18:58:40 40fa792d359f84c3b9e9d6623743e1a59826274e221df1bde8f47086968a1bab" |
| 458 | 458 | ||
| 459 | /* | 459 | /* |
| 460 | ** CAPI3REF: Run-Time Library Version Numbers | 460 | ** CAPI3REF: Run-Time Library Version Numbers |
| @@ -872,7 +872,7 @@ SQLITE_API int sqlite3_exec( | |||
| 872 | #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) | 872 | #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) |
| 873 | #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8)) | 873 | #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8)) |
| 874 | #define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8)) | 874 | #define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8)) |
| 875 | #define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8)) | 875 | #define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8)) /* internal use only */ |
| 876 | 876 | ||
| 877 | /* | 877 | /* |
| 878 | ** CAPI3REF: Flags For File Open Operations | 878 | ** CAPI3REF: Flags For File Open Operations |
| @@ -4130,13 +4130,14 @@ SQLITE_API void sqlite3_free_filename(char*); | |||
| 4130 | ** sqlite3_extended_errcode() might change with each API call. | 4130 | ** sqlite3_extended_errcode() might change with each API call. |
| 4131 | ** Except, there are some interfaces that are guaranteed to never | 4131 | ** Except, there are some interfaces that are guaranteed to never |
| 4132 | ** change the value of the error code. The error-code preserving | 4132 | ** change the value of the error code. The error-code preserving |
| 4133 | ** interfaces are: | 4133 | ** interfaces include the following: |
| 4134 | ** | 4134 | ** |
| 4135 | ** <ul> | 4135 | ** <ul> |
| 4136 | ** <li> sqlite3_errcode() | 4136 | ** <li> sqlite3_errcode() |
| 4137 | ** <li> sqlite3_extended_errcode() | 4137 | ** <li> sqlite3_extended_errcode() |
| 4138 | ** <li> sqlite3_errmsg() | 4138 | ** <li> sqlite3_errmsg() |
| 4139 | ** <li> sqlite3_errmsg16() | 4139 | ** <li> sqlite3_errmsg16() |
| 4140 | ** <li> sqlite3_error_offset() | ||
| 4140 | ** </ul> | 4141 | ** </ul> |
| 4141 | ** | 4142 | ** |
| 4142 | ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language | 4143 | ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language |
| @@ -4151,6 +4152,13 @@ SQLITE_API void sqlite3_free_filename(char*); | |||
| 4151 | ** ^(Memory to hold the error message string is managed internally | 4152 | ** ^(Memory to hold the error message string is managed internally |
| 4152 | ** and must not be freed by the application)^. | 4153 | ** and must not be freed by the application)^. |
| 4153 | ** | 4154 | ** |
| 4155 | ** ^If the most recent error references a specific token in the input | ||
| 4156 | ** SQL, the sqlite3_error_offset() interface returns the byte offset | ||
| 4157 | ** of the start of that token. ^The byte offset returned by | ||
| 4158 | ** sqlite3_error_offset() assumes that the input SQL is UTF8. | ||
| 4159 | ** ^If the most recent error does not reference a specific token in the input | ||
| 4160 | ** SQL, then the sqlite3_error_offset() function returns -1. | ||
| 4161 | ** | ||
| 4154 | ** When the serialized [threading mode] is in use, it might be the | 4162 | ** When the serialized [threading mode] is in use, it might be the |
| 4155 | ** case that a second error occurs on a separate thread in between | 4163 | ** case that a second error occurs on a separate thread in between |
| 4156 | ** the time of the first error and the call to these interfaces. | 4164 | ** the time of the first error and the call to these interfaces. |
| @@ -4170,6 +4178,7 @@ SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); | |||
| 4170 | SQLITE_API const char *sqlite3_errmsg(sqlite3*); | 4178 | SQLITE_API const char *sqlite3_errmsg(sqlite3*); |
| 4171 | SQLITE_API const void *sqlite3_errmsg16(sqlite3*); | 4179 | SQLITE_API const void *sqlite3_errmsg16(sqlite3*); |
| 4172 | SQLITE_API const char *sqlite3_errstr(int); | 4180 | SQLITE_API const char *sqlite3_errstr(int); |
| 4181 | SQLITE_API int sqlite3_error_offset(sqlite3 *db); | ||
| 4173 | 4182 | ||
| 4174 | /* | 4183 | /* |
| 4175 | ** CAPI3REF: Prepared Statement Object | 4184 | ** CAPI3REF: Prepared Statement Object |
| @@ -4581,6 +4590,10 @@ SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt); | |||
| 4581 | ** be false. ^Similarly, a CREATE TABLE IF NOT EXISTS statement is a | 4590 | ** be false. ^Similarly, a CREATE TABLE IF NOT EXISTS statement is a |
| 4582 | ** read-only no-op if the table already exists, but | 4591 | ** read-only no-op if the table already exists, but |
| 4583 | ** sqlite3_stmt_readonly() still returns false for such a statement. | 4592 | ** sqlite3_stmt_readonly() still returns false for such a statement. |
| 4593 | ** | ||
| 4594 | ** ^If prepared statement X is an [EXPLAIN] or [EXPLAIN QUERY PLAN] | ||
| 4595 | ** statement, then sqlite3_stmt_readonly(X) returns the same value as | ||
| 4596 | ** if the EXPLAIN or EXPLAIN QUERY PLAN prefix were omitted. | ||
| 4584 | */ | 4597 | */ |
| 4585 | SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); | 4598 | SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); |
| 4586 | 4599 | ||
| @@ -4649,6 +4662,8 @@ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*); | |||
| 4649 | ** | 4662 | ** |
| 4650 | ** ^The sqlite3_value objects that are passed as parameters into the | 4663 | ** ^The sqlite3_value objects that are passed as parameters into the |
| 4651 | ** implementation of [application-defined SQL functions] are protected. | 4664 | ** implementation of [application-defined SQL functions] are protected. |
| 4665 | ** ^The sqlite3_value objects returned by [sqlite3_vtab_rhs_value()] | ||
| 4666 | ** are protected. | ||
| 4652 | ** ^The sqlite3_value object returned by | 4667 | ** ^The sqlite3_value object returned by |
| 4653 | ** [sqlite3_column_value()] is unprotected. | 4668 | ** [sqlite3_column_value()] is unprotected. |
| 4654 | ** Unprotected sqlite3_value objects may only be used as arguments | 4669 | ** Unprotected sqlite3_value objects may only be used as arguments |
| @@ -7428,24 +7443,56 @@ struct sqlite3_index_info { | |||
| 7428 | ** | 7443 | ** |
| 7429 | ** These macros define the allowed values for the | 7444 | ** These macros define the allowed values for the |
| 7430 | ** [sqlite3_index_info].aConstraint[].op field. Each value represents | 7445 | ** [sqlite3_index_info].aConstraint[].op field. Each value represents |
| 7431 | ** an operator that is part of a constraint term in the wHERE clause of | 7446 | ** an operator that is part of a constraint term in the WHERE clause of |
| 7432 | ** a query that uses a [virtual table]. | 7447 | ** a query that uses a [virtual table]. |
| 7433 | */ | 7448 | ** |
| 7434 | #define SQLITE_INDEX_CONSTRAINT_EQ 2 | 7449 | ** ^The left-hand operand of the operator is given by the corresponding |
| 7435 | #define SQLITE_INDEX_CONSTRAINT_GT 4 | 7450 | ** aConstraint[].iColumn field. ^An iColumn of -1 indicates the left-hand |
| 7436 | #define SQLITE_INDEX_CONSTRAINT_LE 8 | 7451 | ** operand is the rowid. |
| 7437 | #define SQLITE_INDEX_CONSTRAINT_LT 16 | 7452 | ** The SQLITE_INDEX_CONSTRAINT_LIMIT and SQLITE_INDEX_CONSTRAINT_OFFSET |
| 7438 | #define SQLITE_INDEX_CONSTRAINT_GE 32 | 7453 | ** operators have no left-hand operand, and so for those operators the |
| 7439 | #define SQLITE_INDEX_CONSTRAINT_MATCH 64 | 7454 | ** corresponding aConstraint[].iColumn is meaningless and should not be |
| 7440 | #define SQLITE_INDEX_CONSTRAINT_LIKE 65 | 7455 | ** used. |
| 7441 | #define SQLITE_INDEX_CONSTRAINT_GLOB 66 | 7456 | ** |
| 7442 | #define SQLITE_INDEX_CONSTRAINT_REGEXP 67 | 7457 | ** All operator values from SQLITE_INDEX_CONSTRAINT_FUNCTION through |
| 7443 | #define SQLITE_INDEX_CONSTRAINT_NE 68 | 7458 | ** value 255 are reserved to represent functions that are overloaded |
| 7444 | #define SQLITE_INDEX_CONSTRAINT_ISNOT 69 | 7459 | ** by the [xFindFunction|xFindFunction method] of the virtual table |
| 7445 | #define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70 | 7460 | ** implementation. |
| 7446 | #define SQLITE_INDEX_CONSTRAINT_ISNULL 71 | 7461 | ** |
| 7447 | #define SQLITE_INDEX_CONSTRAINT_IS 72 | 7462 | ** The right-hand operands for each constraint might be accessible using |
| 7448 | #define SQLITE_INDEX_CONSTRAINT_FUNCTION 150 | 7463 | ** the [sqlite3_vtab_rhs_value()] interface. Usually the right-hand |
| 7464 | ** operand is only available if it appears as a single constant literal | ||
| 7465 | ** in the input SQL. If the right-hand operand is another column or an | ||
| 7466 | ** expression (even a constant expression) or a parameter, then the | ||
| 7467 | ** sqlite3_vtab_rhs_value() probably will not be able to extract it. | ||
| 7468 | ** ^The SQLITE_INDEX_CONSTRAINT_ISNULL and | ||
| 7469 | ** SQLITE_INDEX_CONSTRAINT_ISNOTNULL operators have no right-hand operand | ||
| 7470 | ** and hence calls to sqlite3_vtab_rhs_value() for those operators will | ||
| 7471 | ** always return SQLITE_NOTFOUND. | ||
| 7472 | ** | ||
| 7473 | ** The collating sequence to be used for comparison can be found using | ||
| 7474 | ** the [sqlite3_vtab_collation()] interface. For most real-world virtual | ||
| 7475 | ** tables, the collating sequence of constraints does not matter (for example | ||
| 7476 | ** because the constraints are numeric) and so the sqlite3_vtab_collation() | ||
| 7477 | ** interface is no commonly needed. | ||
| 7478 | */ | ||
| 7479 | #define SQLITE_INDEX_CONSTRAINT_EQ 2 | ||
| 7480 | #define SQLITE_INDEX_CONSTRAINT_GT 4 | ||
| 7481 | #define SQLITE_INDEX_CONSTRAINT_LE 8 | ||
| 7482 | #define SQLITE_INDEX_CONSTRAINT_LT 16 | ||
| 7483 | #define SQLITE_INDEX_CONSTRAINT_GE 32 | ||
| 7484 | #define SQLITE_INDEX_CONSTRAINT_MATCH 64 | ||
| 7485 | #define SQLITE_INDEX_CONSTRAINT_LIKE 65 | ||
| 7486 | #define SQLITE_INDEX_CONSTRAINT_GLOB 66 | ||
| 7487 | #define SQLITE_INDEX_CONSTRAINT_REGEXP 67 | ||
| 7488 | #define SQLITE_INDEX_CONSTRAINT_NE 68 | ||
| 7489 | #define SQLITE_INDEX_CONSTRAINT_ISNOT 69 | ||
| 7490 | #define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70 | ||
| 7491 | #define SQLITE_INDEX_CONSTRAINT_ISNULL 71 | ||
| 7492 | #define SQLITE_INDEX_CONSTRAINT_IS 72 | ||
| 7493 | #define SQLITE_INDEX_CONSTRAINT_LIMIT 73 | ||
| 7494 | #define SQLITE_INDEX_CONSTRAINT_OFFSET 74 | ||
| 7495 | #define SQLITE_INDEX_CONSTRAINT_FUNCTION 150 | ||
| 7449 | 7496 | ||
| 7450 | /* | 7497 | /* |
| 7451 | ** CAPI3REF: Register A Virtual Table Implementation | 7498 | ** CAPI3REF: Register A Virtual Table Implementation |
| @@ -7474,7 +7521,7 @@ struct sqlite3_index_info { | |||
| 7474 | ** destructor. | 7521 | ** destructor. |
| 7475 | ** | 7522 | ** |
| 7476 | ** ^If the third parameter (the pointer to the sqlite3_module object) is | 7523 | ** ^If the third parameter (the pointer to the sqlite3_module object) is |
| 7477 | ** NULL then no new module is create and any existing modules with the | 7524 | ** NULL then no new module is created and any existing modules with the |
| 7478 | ** same name are dropped. | 7525 | ** same name are dropped. |
| 7479 | ** | 7526 | ** |
| 7480 | ** See also: [sqlite3_drop_modules()] | 7527 | ** See also: [sqlite3_drop_modules()] |
| @@ -8250,7 +8297,8 @@ SQLITE_API int sqlite3_test_control(int op, ...); | |||
| 8250 | #define SQLITE_TESTCTRL_SEEK_COUNT 30 | 8297 | #define SQLITE_TESTCTRL_SEEK_COUNT 30 |
| 8251 | #define SQLITE_TESTCTRL_TRACEFLAGS 31 | 8298 | #define SQLITE_TESTCTRL_TRACEFLAGS 31 |
| 8252 | #define SQLITE_TESTCTRL_TUNE 32 | 8299 | #define SQLITE_TESTCTRL_TUNE 32 |
| 8253 | #define SQLITE_TESTCTRL_LAST 32 /* Largest TESTCTRL */ | 8300 | #define SQLITE_TESTCTRL_LOGEST 33 |
| 8301 | #define SQLITE_TESTCTRL_LAST 33 /* Largest TESTCTRL */ | ||
| 8254 | 8302 | ||
| 8255 | /* | 8303 | /* |
| 8256 | ** CAPI3REF: SQL Keyword Checking | 8304 | ** CAPI3REF: SQL Keyword Checking |
| @@ -8773,6 +8821,16 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); | |||
| 8773 | ** The counter is incremented on the first [sqlite3_step()] call of each | 8821 | ** The counter is incremented on the first [sqlite3_step()] call of each |
| 8774 | ** cycle. | 8822 | ** cycle. |
| 8775 | ** | 8823 | ** |
| 8824 | ** [[SQLITE_STMTSTATUS_FILTER_MISS]] | ||
| 8825 | ** [[SQLITE_STMTSTATUS_FILTER HIT]] | ||
| 8826 | ** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br> | ||
| 8827 | ** SQLITE_STMTSTATUS_FILTER_MISS</dt> | ||
| 8828 | ** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join | ||
| 8829 | ** step was bypassed because a Bloom filter returned not-found. The | ||
| 8830 | ** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of | ||
| 8831 | ** times that the Bloom filter returned a find, and thus the join step | ||
| 8832 | ** had to be processed as normal. | ||
| 8833 | ** | ||
| 8776 | ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt> | 8834 | ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt> |
| 8777 | ** <dd>^This is the approximate number of bytes of heap memory | 8835 | ** <dd>^This is the approximate number of bytes of heap memory |
| 8778 | ** used to store the prepared statement. ^This value is not actually | 8836 | ** used to store the prepared statement. ^This value is not actually |
| @@ -8787,6 +8845,8 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); | |||
| 8787 | #define SQLITE_STMTSTATUS_VM_STEP 4 | 8845 | #define SQLITE_STMTSTATUS_VM_STEP 4 |
| 8788 | #define SQLITE_STMTSTATUS_REPREPARE 5 | 8846 | #define SQLITE_STMTSTATUS_REPREPARE 5 |
| 8789 | #define SQLITE_STMTSTATUS_RUN 6 | 8847 | #define SQLITE_STMTSTATUS_RUN 6 |
| 8848 | #define SQLITE_STMTSTATUS_FILTER_MISS 7 | ||
| 8849 | #define SQLITE_STMTSTATUS_FILTER_HIT 8 | ||
| 8790 | #define SQLITE_STMTSTATUS_MEMUSED 99 | 8850 | #define SQLITE_STMTSTATUS_MEMUSED 99 |
| 8791 | 8851 | ||
| 8792 | /* | 8852 | /* |
| @@ -9755,20 +9815,270 @@ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*); | |||
| 9755 | 9815 | ||
| 9756 | /* | 9816 | /* |
| 9757 | ** CAPI3REF: Determine The Collation For a Virtual Table Constraint | 9817 | ** CAPI3REF: Determine The Collation For a Virtual Table Constraint |
| 9818 | ** METHOD: sqlite3_index_info | ||
| 9758 | ** | 9819 | ** |
| 9759 | ** This function may only be called from within a call to the [xBestIndex] | 9820 | ** This function may only be called from within a call to the [xBestIndex] |
| 9760 | ** method of a [virtual table]. | 9821 | ** method of a [virtual table]. This function returns a pointer to a string |
| 9822 | ** that is the name of the appropriate collation sequence to use for text | ||
| 9823 | ** comparisons on the constraint identified by its arguments. | ||
| 9824 | ** | ||
| 9825 | ** The first argument must be the pointer to the [sqlite3_index_info] object | ||
| 9826 | ** that is the first parameter to the xBestIndex() method. The second argument | ||
| 9827 | ** must be an index into the aConstraint[] array belonging to the | ||
| 9828 | ** sqlite3_index_info structure passed to xBestIndex. | ||
| 9829 | ** | ||
| 9830 | ** Important: | ||
| 9831 | ** The first parameter must be the same pointer that is passed into the | ||
| 9832 | ** xBestMethod() method. The first parameter may not be a pointer to a | ||
| 9833 | ** different [sqlite3_index_info] object, even an exact copy. | ||
| 9761 | ** | 9834 | ** |
| 9762 | ** The first argument must be the sqlite3_index_info object that is the | 9835 | ** The return value is computed as follows: |
| 9763 | ** first parameter to the xBestIndex() method. The second argument must be | 9836 | ** |
| 9764 | ** an index into the aConstraint[] array belonging to the sqlite3_index_info | 9837 | ** <ol> |
| 9765 | ** structure passed to xBestIndex. This function returns a pointer to a buffer | 9838 | ** <li><p> If the constraint comes from a WHERE clause expression that contains |
| 9766 | ** containing the name of the collation sequence for the corresponding | 9839 | ** a [COLLATE operator], then the name of the collation specified by |
| 9767 | ** constraint. | 9840 | ** that COLLATE operator is returned. |
| 9841 | ** <li><p> If there is no COLLATE operator, but the column that is the subject | ||
| 9842 | ** of the constraint specifies an alternative collating sequence via | ||
| 9843 | ** a [COLLATE clause] on the column definition within the CREATE TABLE | ||
| 9844 | ** statement that was passed into [sqlite3_declare_vtab()], then the | ||
| 9845 | ** name of that alternative collating sequence is returned. | ||
| 9846 | ** <li><p> Otherwise, "BINARY" is returned. | ||
| 9847 | ** </ol> | ||
| 9768 | */ | 9848 | */ |
| 9769 | SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int); | 9849 | SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int); |
| 9770 | 9850 | ||
| 9771 | /* | 9851 | /* |
| 9852 | ** CAPI3REF: Determine if a virtual table query is DISTINCT | ||
| 9853 | ** METHOD: sqlite3_index_info | ||
| 9854 | ** | ||
| 9855 | ** This API may only be used from within an [xBestIndex|xBestIndex method] | ||
| 9856 | ** of a [virtual table] implementation. The result of calling this | ||
| 9857 | ** interface from outside of xBestIndex() is undefined and probably harmful. | ||
| 9858 | ** | ||
| 9859 | ** ^The sqlite3_vtab_distinct() interface returns an integer that is | ||
| 9860 | ** either 0, 1, or 2. The integer returned by sqlite3_vtab_distinct() | ||
| 9861 | ** gives the virtual table additional information about how the query | ||
| 9862 | ** planner wants the output to be ordered. As long as the virtual table | ||
| 9863 | ** can meet the ordering requirements of the query planner, it may set | ||
| 9864 | ** the "orderByConsumed" flag. | ||
| 9865 | ** | ||
| 9866 | ** <ol><li value="0"><p> | ||
| 9867 | ** ^If the sqlite3_vtab_distinct() interface returns 0, that means | ||
| 9868 | ** that the query planner needs the virtual table to return all rows in the | ||
| 9869 | ** sort order defined by the "nOrderBy" and "aOrderBy" fields of the | ||
| 9870 | ** [sqlite3_index_info] object. This is the default expectation. If the | ||
| 9871 | ** virtual table outputs all rows in sorted order, then it is always safe for | ||
| 9872 | ** the xBestIndex method to set the "orderByConsumed" flag, regardless of | ||
| 9873 | ** the return value from sqlite3_vtab_distinct(). | ||
| 9874 | ** <li value="1"><p> | ||
| 9875 | ** ^(If the sqlite3_vtab_distinct() interface returns 1, that means | ||
| 9876 | ** that the query planner does not need the rows to be returned in sorted order | ||
| 9877 | ** as long as all rows with the same values in all columns identified by the | ||
| 9878 | ** "aOrderBy" field are adjacent.)^ This mode is used when the query planner | ||
| 9879 | ** is doing a GROUP BY. | ||
| 9880 | ** <li value="2"><p> | ||
| 9881 | ** ^(If the sqlite3_vtab_distinct() interface returns 2, that means | ||
| 9882 | ** that the query planner does not need the rows returned in any particular | ||
| 9883 | ** order, as long as rows with the same values in all "aOrderBy" columns | ||
| 9884 | ** are adjacent.)^ ^(Furthermore, only a single row for each particular | ||
| 9885 | ** combination of values in the columns identified by the "aOrderBy" field | ||
| 9886 | ** needs to be returned.)^ ^It is always ok for two or more rows with the same | ||
| 9887 | ** values in all "aOrderBy" columns to be returned, as long as all such rows | ||
| 9888 | ** are adjacent. ^The virtual table may, if it chooses, omit extra rows | ||
| 9889 | ** that have the same value for all columns identified by "aOrderBy". | ||
| 9890 | ** ^However omitting the extra rows is optional. | ||
| 9891 | ** This mode is used for a DISTINCT query. | ||
| 9892 | ** </ol> | ||
| 9893 | ** | ||
| 9894 | ** ^For the purposes of comparing virtual table output values to see if the | ||
| 9895 | ** values are same value for sorting purposes, two NULL values are considered | ||
| 9896 | ** to be the same. In other words, the comparison operator is "IS" | ||
| 9897 | ** (or "IS NOT DISTINCT FROM") and not "==". | ||
| 9898 | ** | ||
| 9899 | ** If a virtual table implementation is unable to meet the requirements | ||
| 9900 | ** specified above, then it must not set the "orderByConsumed" flag in the | ||
| 9901 | ** [sqlite3_index_info] object or an incorrect answer may result. | ||
| 9902 | ** | ||
| 9903 | ** ^A virtual table implementation is always free to return rows in any order | ||
| 9904 | ** it wants, as long as the "orderByConsumed" flag is not set. ^When the | ||
| 9905 | ** the "orderByConsumed" flag is unset, the query planner will add extra | ||
| 9906 | ** [bytecode] to ensure that the final results returned by the SQL query are | ||
| 9907 | ** ordered correctly. The use of the "orderByConsumed" flag and the | ||
| 9908 | ** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful | ||
| 9909 | ** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed" | ||
| 9910 | ** flag might help queries against a virtual table to run faster. Being | ||
| 9911 | ** overly aggressive and setting the "orderByConsumed" flag when it is not | ||
| 9912 | ** valid to do so, on the other hand, might cause SQLite to return incorrect | ||
| 9913 | ** results. | ||
| 9914 | */ | ||
| 9915 | SQLITE_API int sqlite3_vtab_distinct(sqlite3_index_info*); | ||
| 9916 | |||
| 9917 | /* | ||
| 9918 | ** CAPI3REF: Identify and handle IN constraints in xBestIndex | ||
| 9919 | ** | ||
| 9920 | ** This interface may only be used from within an | ||
| 9921 | ** [xBestIndex|xBestIndex() method] of a [virtual table] implementation. | ||
| 9922 | ** The result of invoking this interface from any other context is | ||
| 9923 | ** undefined and probably harmful. | ||
| 9924 | ** | ||
| 9925 | ** ^(A constraint on a virtual table of the form | ||
| 9926 | ** "[IN operator|column IN (...)]" is | ||
| 9927 | ** communicated to the xBestIndex method as a | ||
| 9928 | ** [SQLITE_INDEX_CONSTRAINT_EQ] constraint.)^ If xBestIndex wants to use | ||
| 9929 | ** this constraint, it must set the corresponding | ||
| 9930 | ** aConstraintUsage[].argvIndex to a postive integer. ^(Then, under | ||
| 9931 | ** the usual mode of handling IN operators, SQLite generates [bytecode] | ||
| 9932 | ** that invokes the [xFilter|xFilter() method] once for each value | ||
| 9933 | ** on the right-hand side of the IN operator.)^ Thus the virtual table | ||
| 9934 | ** only sees a single value from the right-hand side of the IN operator | ||
| 9935 | ** at a time. | ||
| 9936 | ** | ||
| 9937 | ** In some cases, however, it would be advantageous for the virtual | ||
| 9938 | ** table to see all values on the right-hand of the IN operator all at | ||
| 9939 | ** once. The sqlite3_vtab_in() interfaces facilitates this in two ways: | ||
| 9940 | ** | ||
| 9941 | ** <ol> | ||
| 9942 | ** <li><p> | ||
| 9943 | ** ^A call to sqlite3_vtab_in(P,N,-1) will return true (non-zero) | ||
| 9944 | ** if and only if the [sqlite3_index_info|P->aConstraint][N] constraint | ||
| 9945 | ** is an [IN operator] that can be processed all at once. ^In other words, | ||
| 9946 | ** sqlite3_vtab_in() with -1 in the third argument is a mechanism | ||
| 9947 | ** by which the virtual table can ask SQLite if all-at-once processing | ||
| 9948 | ** of the IN operator is even possible. | ||
| 9949 | ** | ||
| 9950 | ** <li><p> | ||
| 9951 | ** ^A call to sqlite3_vtab_in(P,N,F) with F==1 or F==0 indicates | ||
| 9952 | ** to SQLite that the virtual table does or does not want to process | ||
| 9953 | ** the IN operator all-at-once, respectively. ^Thus when the third | ||
| 9954 | ** parameter (F) is non-negative, this interface is the mechanism by | ||
| 9955 | ** which the virtual table tells SQLite how it wants to process the | ||
| 9956 | ** IN operator. | ||
| 9957 | ** </ol> | ||
| 9958 | ** | ||
| 9959 | ** ^The sqlite3_vtab_in(P,N,F) interface can be invoked multiple times | ||
| 9960 | ** within the same xBestIndex method call. ^For any given P,N pair, | ||
| 9961 | ** the return value from sqlite3_vtab_in(P,N,F) will always be the same | ||
| 9962 | ** within the same xBestIndex call. ^If the interface returns true | ||
| 9963 | ** (non-zero), that means that the constraint is an IN operator | ||
| 9964 | ** that can be processed all-at-once. ^If the constraint is not an IN | ||
| 9965 | ** operator or cannot be processed all-at-once, then the interface returns | ||
| 9966 | ** false. | ||
| 9967 | ** | ||
| 9968 | ** ^(All-at-once processing of the IN operator is selected if both of the | ||
| 9969 | ** following conditions are met: | ||
| 9970 | ** | ||
| 9971 | ** <ol> | ||
| 9972 | ** <li><p> The P->aConstraintUsage[N].argvIndex value is set to a positive | ||
| 9973 | ** integer. This is how the virtual table tells SQLite that it wants to | ||
| 9974 | ** use the N-th constraint. | ||
| 9975 | ** | ||
| 9976 | ** <li><p> The last call to sqlite3_vtab_in(P,N,F) for which F was | ||
| 9977 | ** non-negative had F>=1. | ||
| 9978 | ** </ol>)^ | ||
| 9979 | ** | ||
| 9980 | ** ^If either or both of the conditions above are false, then SQLite uses | ||
| 9981 | ** the traditional one-at-a-time processing strategy for the IN constraint. | ||
| 9982 | ** ^If both conditions are true, then the argvIndex-th parameter to the | ||
| 9983 | ** xFilter method will be an [sqlite3_value] that appears to be NULL, | ||
| 9984 | ** but which can be passed to [sqlite3_vtab_in_first()] and | ||
| 9985 | ** [sqlite3_vtab_in_next()] to find all values on the right-hand side | ||
| 9986 | ** of the IN constraint. | ||
| 9987 | */ | ||
| 9988 | SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle); | ||
| 9989 | |||
| 9990 | /* | ||
| 9991 | ** CAPI3REF: Find all elements on the right-hand side of an IN constraint. | ||
| 9992 | ** | ||
| 9993 | ** These interfaces are only useful from within the | ||
| 9994 | ** [xFilter|xFilter() method] of a [virtual table] implementation. | ||
| 9995 | ** The result of invoking these interfaces from any other context | ||
| 9996 | ** is undefined and probably harmful. | ||
| 9997 | ** | ||
| 9998 | ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or | ||
| 9999 | ** sqlite3_vtab_in_next(X,P) must be one of the parameters to the | ||
| 10000 | ** xFilter method which invokes these routines, and specifically | ||
| 10001 | ** a parameter that was previously selected for all-at-once IN constraint | ||
| 10002 | ** processing use the [sqlite3_vtab_in()] interface in the | ||
| 10003 | ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not | ||
| 10004 | ** an xFilter argument that was selected for all-at-once IN constraint | ||
| 10005 | ** processing, then these routines return [SQLITE_MISUSE])^ or perhaps | ||
| 10006 | ** exhibit some other undefined or harmful behavior. | ||
| 10007 | ** | ||
| 10008 | ** ^(Use these routines to access all values on the right-hand side | ||
| 10009 | ** of the IN constraint using code like the following: | ||
| 10010 | ** | ||
| 10011 | ** <blockquote><pre> | ||
| 10012 | ** for(rc=sqlite3_vtab_in_first(pList, &pVal); | ||
| 10013 | ** rc==SQLITE_OK && pVal | ||
| 10014 | ** rc=sqlite3_vtab_in_next(pList, &pVal) | ||
| 10015 | ** ){ | ||
| 10016 | ** // do something with pVal | ||
| 10017 | ** } | ||
| 10018 | ** if( rc!=SQLITE_OK ){ | ||
| 10019 | ** // an error has occurred | ||
| 10020 | ** } | ||
| 10021 | ** </pre></blockquote>)^ | ||
| 10022 | ** | ||
| 10023 | ** ^On success, the sqlite3_vtab_in_first(X,P) and sqlite3_vtab_in_next(X,P) | ||
| 10024 | ** routines return SQLITE_OK and set *P to point to the first or next value | ||
| 10025 | ** on the RHS of the IN constraint. ^If there are no more values on the | ||
| 10026 | ** right hand side of the IN constraint, then *P is set to NULL and these | ||
| 10027 | ** routines return [SQLITE_DONE]. ^The return value might be | ||
| 10028 | ** some other value, such as SQLITE_NOMEM, in the event of a malfunction. | ||
| 10029 | ** | ||
| 10030 | ** The *ppOut values returned by these routines are only valid until the | ||
| 10031 | ** next call to either of these routines or until the end of the xFilter | ||
| 10032 | ** method from which these routines were called. If the virtual table | ||
| 10033 | ** implementation needs to retain the *ppOut values for longer, it must make | ||
| 10034 | ** copies. The *ppOut values are [protected sqlite3_value|protected]. | ||
| 10035 | */ | ||
| 10036 | SQLITE_API int sqlite3_vtab_in_first(sqlite3_value *pVal, sqlite3_value **ppOut); | ||
| 10037 | SQLITE_API int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut); | ||
| 10038 | |||
| 10039 | /* | ||
| 10040 | ** CAPI3REF: Constraint values in xBestIndex() | ||
| 10041 | ** METHOD: sqlite3_index_info | ||
| 10042 | ** | ||
| 10043 | ** This API may only be used from within the [xBestIndex|xBestIndex method] | ||
| 10044 | ** of a [virtual table] implementation. The result of calling this interface | ||
| 10045 | ** from outside of an xBestIndex method are undefined and probably harmful. | ||
| 10046 | ** | ||
| 10047 | ** ^When the sqlite3_vtab_rhs_value(P,J,V) interface is invoked from within | ||
| 10048 | ** the [xBestIndex] method of a [virtual table] implementation, with P being | ||
| 10049 | ** a copy of the [sqlite3_index_info] object pointer passed into xBestIndex and | ||
| 10050 | ** J being a 0-based index into P->aConstraint[], then this routine | ||
| 10051 | ** attempts to set *V to the value of the right-hand operand of | ||
| 10052 | ** that constraint if the right-hand operand is known. ^If the | ||
| 10053 | ** right-hand operand is not known, then *V is set to a NULL pointer. | ||
| 10054 | ** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if | ||
| 10055 | ** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V) | ||
| 10056 | ** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th | ||
| 10057 | ** constraint is not available. ^The sqlite3_vtab_rhs_value() interface | ||
| 10058 | ** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if | ||
| 10059 | ** something goes wrong. | ||
| 10060 | ** | ||
| 10061 | ** The sqlite3_vtab_rhs_value() interface is usually only successful if | ||
| 10062 | ** the right-hand operand of a constraint is a literal value in the original | ||
| 10063 | ** SQL statement. If the right-hand operand is an expression or a reference | ||
| 10064 | ** to some other column or a [host parameter], then sqlite3_vtab_rhs_value() | ||
| 10065 | ** will probably return [SQLITE_NOTFOUND]. | ||
| 10066 | ** | ||
| 10067 | ** ^(Some constraints, such as [SQLITE_INDEX_CONSTRAINT_ISNULL] and | ||
| 10068 | ** [SQLITE_INDEX_CONSTRAINT_ISNOTNULL], have no right-hand operand. For such | ||
| 10069 | ** constraints, sqlite3_vtab_rhs_value() always returns SQLITE_NOTFOUND.)^ | ||
| 10070 | ** | ||
| 10071 | ** ^The [sqlite3_value] object returned in *V is a protected sqlite3_value | ||
| 10072 | ** and remains valid for the duration of the xBestIndex method call. | ||
| 10073 | ** ^When xBestIndex returns, the sqlite3_value object returned by | ||
| 10074 | ** sqlite3_vtab_rhs_value() is automatically deallocated. | ||
| 10075 | ** | ||
| 10076 | ** The "_rhs_" in the name of this routine is an appreviation for | ||
| 10077 | ** "Right-Hand Side". | ||
| 10078 | */ | ||
| 10079 | SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **ppVal); | ||
| 10080 | |||
| 10081 | /* | ||
| 9772 | ** CAPI3REF: Conflict resolution modes | 10082 | ** CAPI3REF: Conflict resolution modes |
| 9773 | ** KEYWORDS: {conflict resolution mode} | 10083 | ** KEYWORDS: {conflict resolution mode} |
| 9774 | ** | 10084 | ** |
| @@ -13621,78 +13931,79 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*); | |||
| 13621 | #define TK_SLASH 109 | 13931 | #define TK_SLASH 109 |
| 13622 | #define TK_REM 110 | 13932 | #define TK_REM 110 |
| 13623 | #define TK_CONCAT 111 | 13933 | #define TK_CONCAT 111 |
| 13624 | #define TK_COLLATE 112 | 13934 | #define TK_PTR 112 |
| 13625 | #define TK_BITNOT 113 | 13935 | #define TK_COLLATE 113 |
| 13626 | #define TK_ON 114 | 13936 | #define TK_BITNOT 114 |
| 13627 | #define TK_INDEXED 115 | 13937 | #define TK_ON 115 |
| 13628 | #define TK_STRING 116 | 13938 | #define TK_INDEXED 116 |
| 13629 | #define TK_JOIN_KW 117 | 13939 | #define TK_STRING 117 |
| 13630 | #define TK_CONSTRAINT 118 | 13940 | #define TK_JOIN_KW 118 |
| 13631 | #define TK_DEFAULT 119 | 13941 | #define TK_CONSTRAINT 119 |
| 13632 | #define TK_NULL 120 | 13942 | #define TK_DEFAULT 120 |
| 13633 | #define TK_PRIMARY 121 | 13943 | #define TK_NULL 121 |
| 13634 | #define TK_UNIQUE 122 | 13944 | #define TK_PRIMARY 122 |
| 13635 | #define TK_CHECK 123 | 13945 | #define TK_UNIQUE 123 |
| 13636 | #define TK_REFERENCES 124 | 13946 | #define TK_CHECK 124 |
| 13637 | #define TK_AUTOINCR 125 | 13947 | #define TK_REFERENCES 125 |
| 13638 | #define TK_INSERT 126 | 13948 | #define TK_AUTOINCR 126 |
| 13639 | #define TK_DELETE 127 | 13949 | #define TK_INSERT 127 |
| 13640 | #define TK_UPDATE 128 | 13950 | #define TK_DELETE 128 |
| 13641 | #define TK_SET 129 | 13951 | #define TK_UPDATE 129 |
| 13642 | #define TK_DEFERRABLE 130 | 13952 | #define TK_SET 130 |
| 13643 | #define TK_FOREIGN 131 | 13953 | #define TK_DEFERRABLE 131 |
| 13644 | #define TK_DROP 132 | 13954 | #define TK_FOREIGN 132 |
| 13645 | #define TK_UNION 133 | 13955 | #define TK_DROP 133 |
| 13646 | #define TK_ALL 134 | 13956 | #define TK_UNION 134 |
| 13647 | #define TK_EXCEPT 135 | 13957 | #define TK_ALL 135 |
| 13648 | #define TK_INTERSECT 136 | 13958 | #define TK_EXCEPT 136 |
| 13649 | #define TK_SELECT 137 | 13959 | #define TK_INTERSECT 137 |
| 13650 | #define TK_VALUES 138 | 13960 | #define TK_SELECT 138 |
| 13651 | #define TK_DISTINCT 139 | 13961 | #define TK_VALUES 139 |
| 13652 | #define TK_DOT 140 | 13962 | #define TK_DISTINCT 140 |
| 13653 | #define TK_FROM 141 | 13963 | #define TK_DOT 141 |
| 13654 | #define TK_JOIN 142 | 13964 | #define TK_FROM 142 |
| 13655 | #define TK_USING 143 | 13965 | #define TK_JOIN 143 |
| 13656 | #define TK_ORDER 144 | 13966 | #define TK_USING 144 |
| 13657 | #define TK_GROUP 145 | 13967 | #define TK_ORDER 145 |
| 13658 | #define TK_HAVING 146 | 13968 | #define TK_GROUP 146 |
| 13659 | #define TK_LIMIT 147 | 13969 | #define TK_HAVING 147 |
| 13660 | #define TK_WHERE 148 | 13970 | #define TK_LIMIT 148 |
| 13661 | #define TK_RETURNING 149 | 13971 | #define TK_WHERE 149 |
| 13662 | #define TK_INTO 150 | 13972 | #define TK_RETURNING 150 |
| 13663 | #define TK_NOTHING 151 | 13973 | #define TK_INTO 151 |
| 13664 | #define TK_FLOAT 152 | 13974 | #define TK_NOTHING 152 |
| 13665 | #define TK_BLOB 153 | 13975 | #define TK_FLOAT 153 |
| 13666 | #define TK_INTEGER 154 | 13976 | #define TK_BLOB 154 |
| 13667 | #define TK_VARIABLE 155 | 13977 | #define TK_INTEGER 155 |
| 13668 | #define TK_CASE 156 | 13978 | #define TK_VARIABLE 156 |
| 13669 | #define TK_WHEN 157 | 13979 | #define TK_CASE 157 |
| 13670 | #define TK_THEN 158 | 13980 | #define TK_WHEN 158 |
| 13671 | #define TK_ELSE 159 | 13981 | #define TK_THEN 159 |
| 13672 | #define TK_INDEX 160 | 13982 | #define TK_ELSE 160 |
| 13673 | #define TK_ALTER 161 | 13983 | #define TK_INDEX 161 |
| 13674 | #define TK_ADD 162 | 13984 | #define TK_ALTER 162 |
| 13675 | #define TK_WINDOW 163 | 13985 | #define TK_ADD 163 |
| 13676 | #define TK_OVER 164 | 13986 | #define TK_WINDOW 164 |
| 13677 | #define TK_FILTER 165 | 13987 | #define TK_OVER 165 |
| 13678 | #define TK_COLUMN 166 | 13988 | #define TK_FILTER 166 |
| 13679 | #define TK_AGG_FUNCTION 167 | 13989 | #define TK_COLUMN 167 |
| 13680 | #define TK_AGG_COLUMN 168 | 13990 | #define TK_AGG_FUNCTION 168 |
| 13681 | #define TK_TRUEFALSE 169 | 13991 | #define TK_AGG_COLUMN 169 |
| 13682 | #define TK_ISNOT 170 | 13992 | #define TK_TRUEFALSE 170 |
| 13683 | #define TK_FUNCTION 171 | 13993 | #define TK_ISNOT 171 |
| 13684 | #define TK_UMINUS 172 | 13994 | #define TK_FUNCTION 172 |
| 13685 | #define TK_UPLUS 173 | 13995 | #define TK_UMINUS 173 |
| 13686 | #define TK_TRUTH 174 | 13996 | #define TK_UPLUS 174 |
| 13687 | #define TK_REGISTER 175 | 13997 | #define TK_TRUTH 175 |
| 13688 | #define TK_VECTOR 176 | 13998 | #define TK_REGISTER 176 |
| 13689 | #define TK_SELECT_COLUMN 177 | 13999 | #define TK_VECTOR 177 |
| 13690 | #define TK_IF_NULL_ROW 178 | 14000 | #define TK_SELECT_COLUMN 178 |
| 13691 | #define TK_ASTERISK 179 | 14001 | #define TK_IF_NULL_ROW 179 |
| 13692 | #define TK_SPAN 180 | 14002 | #define TK_ASTERISK 180 |
| 13693 | #define TK_ERROR 181 | 14003 | #define TK_SPAN 181 |
| 13694 | #define TK_SPACE 182 | 14004 | #define TK_ERROR 182 |
| 13695 | #define TK_ILLEGAL 183 | 14005 | #define TK_SPACE 183 |
| 14006 | #define TK_ILLEGAL 184 | ||
| 13696 | 14007 | ||
| 13697 | /************** End of parse.h ***********************************************/ | 14008 | /************** End of parse.h ***********************************************/ |
| 13698 | /************** Continuing where we left off in sqliteInt.h ******************/ | 14009 | /************** Continuing where we left off in sqliteInt.h ******************/ |
| @@ -14334,10 +14645,11 @@ typedef struct With With; | |||
| 14334 | /* | 14645 | /* |
| 14335 | ** A bit in a Bitmask | 14646 | ** A bit in a Bitmask |
| 14336 | */ | 14647 | */ |
| 14337 | #define MASKBIT(n) (((Bitmask)1)<<(n)) | 14648 | #define MASKBIT(n) (((Bitmask)1)<<(n)) |
| 14338 | #define MASKBIT64(n) (((u64)1)<<(n)) | 14649 | #define MASKBIT64(n) (((u64)1)<<(n)) |
| 14339 | #define MASKBIT32(n) (((unsigned int)1)<<(n)) | 14650 | #define MASKBIT32(n) (((unsigned int)1)<<(n)) |
| 14340 | #define ALLBITS ((Bitmask)-1) | 14651 | #define SMASKBIT32(n) ((n)<=31?((unsigned int)1)<<(n):0) |
| 14652 | #define ALLBITS ((Bitmask)-1) | ||
| 14341 | 14653 | ||
| 14342 | /* A VList object records a mapping between parameters/variables/wildcards | 14654 | /* A VList object records a mapping between parameters/variables/wildcards |
| 14343 | ** in the SQL statement (such as $abc, @pqr, or :xyz) and the integer | 14655 | ** in the SQL statement (such as $abc, @pqr, or :xyz) and the integer |
| @@ -15253,45 +15565,45 @@ typedef struct VdbeOpList VdbeOpList; | |||
| 15253 | #define OP_DecrJumpZero 60 /* jump, synopsis: if (--r[P1])==0 goto P2 */ | 15565 | #define OP_DecrJumpZero 60 /* jump, synopsis: if (--r[P1])==0 goto P2 */ |
| 15254 | #define OP_IncrVacuum 61 /* jump */ | 15566 | #define OP_IncrVacuum 61 /* jump */ |
| 15255 | #define OP_VNext 62 /* jump */ | 15567 | #define OP_VNext 62 /* jump */ |
| 15256 | #define OP_Init 63 /* jump, synopsis: Start at P2 */ | 15568 | #define OP_Filter 63 /* jump, synopsis: if key(P3@P4) not in filter(P1) goto P2 */ |
| 15257 | #define OP_PureFunc 64 /* synopsis: r[P3]=func(r[P2@NP]) */ | 15569 | #define OP_Init 64 /* jump, synopsis: Start at P2 */ |
| 15258 | #define OP_Function 65 /* synopsis: r[P3]=func(r[P2@NP]) */ | 15570 | #define OP_PureFunc 65 /* synopsis: r[P3]=func(r[P2@NP]) */ |
| 15259 | #define OP_Return 66 | 15571 | #define OP_Function 66 /* synopsis: r[P3]=func(r[P2@NP]) */ |
| 15260 | #define OP_EndCoroutine 67 | 15572 | #define OP_Return 67 |
| 15261 | #define OP_HaltIfNull 68 /* synopsis: if r[P3]=null halt */ | 15573 | #define OP_EndCoroutine 68 |
| 15262 | #define OP_Halt 69 | 15574 | #define OP_HaltIfNull 69 /* synopsis: if r[P3]=null halt */ |
| 15263 | #define OP_Integer 70 /* synopsis: r[P2]=P1 */ | 15575 | #define OP_Halt 70 |
| 15264 | #define OP_Int64 71 /* synopsis: r[P2]=P4 */ | 15576 | #define OP_Integer 71 /* synopsis: r[P2]=P1 */ |
| 15265 | #define OP_String 72 /* synopsis: r[P2]='P4' (len=P1) */ | 15577 | #define OP_Int64 72 /* synopsis: r[P2]=P4 */ |
| 15266 | #define OP_Null 73 /* synopsis: r[P2..P3]=NULL */ | 15578 | #define OP_String 73 /* synopsis: r[P2]='P4' (len=P1) */ |
| 15267 | #define OP_SoftNull 74 /* synopsis: r[P1]=NULL */ | 15579 | #define OP_Null 74 /* synopsis: r[P2..P3]=NULL */ |
| 15268 | #define OP_Blob 75 /* synopsis: r[P2]=P4 (len=P1) */ | 15580 | #define OP_SoftNull 75 /* synopsis: r[P1]=NULL */ |
| 15269 | #define OP_Variable 76 /* synopsis: r[P2]=parameter(P1,P4) */ | 15581 | #define OP_Blob 76 /* synopsis: r[P2]=P4 (len=P1) */ |
| 15270 | #define OP_Move 77 /* synopsis: r[P2@P3]=r[P1@P3] */ | 15582 | #define OP_Variable 77 /* synopsis: r[P2]=parameter(P1,P4) */ |
| 15271 | #define OP_Copy 78 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ | 15583 | #define OP_Move 78 /* synopsis: r[P2@P3]=r[P1@P3] */ |
| 15272 | #define OP_SCopy 79 /* synopsis: r[P2]=r[P1] */ | 15584 | #define OP_Copy 79 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ |
| 15273 | #define OP_IntCopy 80 /* synopsis: r[P2]=r[P1] */ | 15585 | #define OP_SCopy 80 /* synopsis: r[P2]=r[P1] */ |
| 15274 | #define OP_ChngCntRow 81 /* synopsis: output=r[P1] */ | 15586 | #define OP_IntCopy 81 /* synopsis: r[P2]=r[P1] */ |
| 15275 | #define OP_ResultRow 82 /* synopsis: output=r[P1@P2] */ | 15587 | #define OP_FkCheck 82 |
| 15276 | #define OP_CollSeq 83 | 15588 | #define OP_ResultRow 83 /* synopsis: output=r[P1@P2] */ |
| 15277 | #define OP_AddImm 84 /* synopsis: r[P1]=r[P1]+P2 */ | 15589 | #define OP_CollSeq 84 |
| 15278 | #define OP_RealAffinity 85 | 15590 | #define OP_AddImm 85 /* synopsis: r[P1]=r[P1]+P2 */ |
| 15279 | #define OP_Cast 86 /* synopsis: affinity(r[P1]) */ | 15591 | #define OP_RealAffinity 86 |
| 15280 | #define OP_Permutation 87 | 15592 | #define OP_Cast 87 /* synopsis: affinity(r[P1]) */ |
| 15281 | #define OP_Compare 88 /* synopsis: r[P1@P3] <-> r[P2@P3] */ | 15593 | #define OP_Permutation 88 |
| 15282 | #define OP_IsTrue 89 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */ | 15594 | #define OP_Compare 89 /* synopsis: r[P1@P3] <-> r[P2@P3] */ |
| 15283 | #define OP_ZeroOrNull 90 /* synopsis: r[P2] = 0 OR NULL */ | 15595 | #define OP_IsTrue 90 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */ |
| 15284 | #define OP_Offset 91 /* synopsis: r[P3] = sqlite_offset(P1) */ | 15596 | #define OP_ZeroOrNull 91 /* synopsis: r[P2] = 0 OR NULL */ |
| 15285 | #define OP_Column 92 /* synopsis: r[P3]=PX */ | 15597 | #define OP_Offset 92 /* synopsis: r[P3] = sqlite_offset(P1) */ |
| 15286 | #define OP_TypeCheck 93 /* synopsis: typecheck(r[P1@P2]) */ | 15598 | #define OP_Column 93 /* synopsis: r[P3]=PX */ |
| 15287 | #define OP_Affinity 94 /* synopsis: affinity(r[P1@P2]) */ | 15599 | #define OP_TypeCheck 94 /* synopsis: typecheck(r[P1@P2]) */ |
| 15288 | #define OP_MakeRecord 95 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ | 15600 | #define OP_Affinity 95 /* synopsis: affinity(r[P1@P2]) */ |
| 15289 | #define OP_Count 96 /* synopsis: r[P2]=count() */ | 15601 | #define OP_MakeRecord 96 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ |
| 15290 | #define OP_ReadCookie 97 | 15602 | #define OP_Count 97 /* synopsis: r[P2]=count() */ |
| 15291 | #define OP_SetCookie 98 | 15603 | #define OP_ReadCookie 98 |
| 15292 | #define OP_ReopenIdx 99 /* synopsis: root=P2 iDb=P3 */ | 15604 | #define OP_SetCookie 99 |
| 15293 | #define OP_OpenRead 100 /* synopsis: root=P2 iDb=P3 */ | 15605 | #define OP_ReopenIdx 100 /* synopsis: root=P2 iDb=P3 */ |
| 15294 | #define OP_OpenWrite 101 /* synopsis: root=P2 iDb=P3 */ | 15606 | #define OP_OpenRead 101 /* synopsis: root=P2 iDb=P3 */ |
| 15295 | #define OP_BitAnd 102 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */ | 15607 | #define OP_BitAnd 102 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */ |
| 15296 | #define OP_BitOr 103 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */ | 15608 | #define OP_BitOr 103 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */ |
| 15297 | #define OP_ShiftLeft 104 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */ | 15609 | #define OP_ShiftLeft 104 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */ |
| @@ -15302,76 +15614,79 @@ typedef struct VdbeOpList VdbeOpList; | |||
| 15302 | #define OP_Divide 109 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */ | 15614 | #define OP_Divide 109 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */ |
| 15303 | #define OP_Remainder 110 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */ | 15615 | #define OP_Remainder 110 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */ |
| 15304 | #define OP_Concat 111 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */ | 15616 | #define OP_Concat 111 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */ |
| 15305 | #define OP_OpenDup 112 | 15617 | #define OP_OpenWrite 112 /* synopsis: root=P2 iDb=P3 */ |
| 15306 | #define OP_BitNot 113 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */ | 15618 | #define OP_OpenDup 113 |
| 15307 | #define OP_OpenAutoindex 114 /* synopsis: nColumn=P2 */ | 15619 | #define OP_BitNot 114 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */ |
| 15308 | #define OP_OpenEphemeral 115 /* synopsis: nColumn=P2 */ | 15620 | #define OP_OpenAutoindex 115 /* synopsis: nColumn=P2 */ |
| 15309 | #define OP_String8 116 /* same as TK_STRING, synopsis: r[P2]='P4' */ | 15621 | #define OP_OpenEphemeral 116 /* synopsis: nColumn=P2 */ |
| 15310 | #define OP_SorterOpen 117 | 15622 | #define OP_String8 117 /* same as TK_STRING, synopsis: r[P2]='P4' */ |
| 15311 | #define OP_SequenceTest 118 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ | 15623 | #define OP_SorterOpen 118 |
| 15312 | #define OP_OpenPseudo 119 /* synopsis: P3 columns in r[P2] */ | 15624 | #define OP_SequenceTest 119 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ |
| 15313 | #define OP_Close 120 | 15625 | #define OP_OpenPseudo 120 /* synopsis: P3 columns in r[P2] */ |
| 15314 | #define OP_ColumnsUsed 121 | 15626 | #define OP_Close 121 |
| 15315 | #define OP_SeekScan 122 /* synopsis: Scan-ahead up to P1 rows */ | 15627 | #define OP_ColumnsUsed 122 |
| 15316 | #define OP_SeekHit 123 /* synopsis: set P2<=seekHit<=P3 */ | 15628 | #define OP_SeekScan 123 /* synopsis: Scan-ahead up to P1 rows */ |
| 15317 | #define OP_Sequence 124 /* synopsis: r[P2]=cursor[P1].ctr++ */ | 15629 | #define OP_SeekHit 124 /* synopsis: set P2<=seekHit<=P3 */ |
| 15318 | #define OP_NewRowid 125 /* synopsis: r[P2]=rowid */ | 15630 | #define OP_Sequence 125 /* synopsis: r[P2]=cursor[P1].ctr++ */ |
| 15319 | #define OP_Insert 126 /* synopsis: intkey=r[P3] data=r[P2] */ | 15631 | #define OP_NewRowid 126 /* synopsis: r[P2]=rowid */ |
| 15320 | #define OP_RowCell 127 | 15632 | #define OP_Insert 127 /* synopsis: intkey=r[P3] data=r[P2] */ |
| 15321 | #define OP_Delete 128 | 15633 | #define OP_RowCell 128 |
| 15322 | #define OP_ResetCount 129 | 15634 | #define OP_Delete 129 |
| 15323 | #define OP_SorterCompare 130 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ | 15635 | #define OP_ResetCount 130 |
| 15324 | #define OP_SorterData 131 /* synopsis: r[P2]=data */ | 15636 | #define OP_SorterCompare 131 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ |
| 15325 | #define OP_RowData 132 /* synopsis: r[P2]=data */ | 15637 | #define OP_SorterData 132 /* synopsis: r[P2]=data */ |
| 15326 | #define OP_Rowid 133 /* synopsis: r[P2]=rowid */ | 15638 | #define OP_RowData 133 /* synopsis: r[P2]=data */ |
| 15327 | #define OP_NullRow 134 | 15639 | #define OP_Rowid 134 /* synopsis: r[P2]=rowid */ |
| 15328 | #define OP_SeekEnd 135 | 15640 | #define OP_NullRow 135 |
| 15329 | #define OP_IdxInsert 136 /* synopsis: key=r[P2] */ | 15641 | #define OP_SeekEnd 136 |
| 15330 | #define OP_SorterInsert 137 /* synopsis: key=r[P2] */ | 15642 | #define OP_IdxInsert 137 /* synopsis: key=r[P2] */ |
| 15331 | #define OP_IdxDelete 138 /* synopsis: key=r[P2@P3] */ | 15643 | #define OP_SorterInsert 138 /* synopsis: key=r[P2] */ |
| 15332 | #define OP_DeferredSeek 139 /* synopsis: Move P3 to P1.rowid if needed */ | 15644 | #define OP_IdxDelete 139 /* synopsis: key=r[P2@P3] */ |
| 15333 | #define OP_IdxRowid 140 /* synopsis: r[P2]=rowid */ | 15645 | #define OP_DeferredSeek 140 /* synopsis: Move P3 to P1.rowid if needed */ |
| 15334 | #define OP_FinishSeek 141 | 15646 | #define OP_IdxRowid 141 /* synopsis: r[P2]=rowid */ |
| 15335 | #define OP_Destroy 142 | 15647 | #define OP_FinishSeek 142 |
| 15336 | #define OP_Clear 143 | 15648 | #define OP_Destroy 143 |
| 15337 | #define OP_ResetSorter 144 | 15649 | #define OP_Clear 144 |
| 15338 | #define OP_CreateBtree 145 /* synopsis: r[P2]=root iDb=P1 flags=P3 */ | 15650 | #define OP_ResetSorter 145 |
| 15339 | #define OP_SqlExec 146 | 15651 | #define OP_CreateBtree 146 /* synopsis: r[P2]=root iDb=P1 flags=P3 */ |
| 15340 | #define OP_ParseSchema 147 | 15652 | #define OP_SqlExec 147 |
| 15341 | #define OP_LoadAnalysis 148 | 15653 | #define OP_ParseSchema 148 |
| 15342 | #define OP_DropTable 149 | 15654 | #define OP_LoadAnalysis 149 |
| 15343 | #define OP_DropIndex 150 | 15655 | #define OP_DropTable 150 |
| 15344 | #define OP_DropTrigger 151 | 15656 | #define OP_DropIndex 151 |
| 15345 | #define OP_Real 152 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ | 15657 | #define OP_DropTrigger 152 |
| 15346 | #define OP_IntegrityCk 153 | 15658 | #define OP_Real 153 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ |
| 15347 | #define OP_RowSetAdd 154 /* synopsis: rowset(P1)=r[P2] */ | 15659 | #define OP_IntegrityCk 154 |
| 15348 | #define OP_Param 155 | 15660 | #define OP_RowSetAdd 155 /* synopsis: rowset(P1)=r[P2] */ |
| 15349 | #define OP_FkCounter 156 /* synopsis: fkctr[P1]+=P2 */ | 15661 | #define OP_Param 156 |
| 15350 | #define OP_MemMax 157 /* synopsis: r[P1]=max(r[P1],r[P2]) */ | 15662 | #define OP_FkCounter 157 /* synopsis: fkctr[P1]+=P2 */ |
| 15351 | #define OP_OffsetLimit 158 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ | 15663 | #define OP_MemMax 158 /* synopsis: r[P1]=max(r[P1],r[P2]) */ |
| 15352 | #define OP_AggInverse 159 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */ | 15664 | #define OP_OffsetLimit 159 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ |
| 15353 | #define OP_AggStep 160 /* synopsis: accum=r[P3] step(r[P2@P5]) */ | 15665 | #define OP_AggInverse 160 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */ |
| 15354 | #define OP_AggStep1 161 /* synopsis: accum=r[P3] step(r[P2@P5]) */ | 15666 | #define OP_AggStep 161 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 15355 | #define OP_AggValue 162 /* synopsis: r[P3]=value N=P2 */ | 15667 | #define OP_AggStep1 162 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 15356 | #define OP_AggFinal 163 /* synopsis: accum=r[P1] N=P2 */ | 15668 | #define OP_AggValue 163 /* synopsis: r[P3]=value N=P2 */ |
| 15357 | #define OP_Expire 164 | 15669 | #define OP_AggFinal 164 /* synopsis: accum=r[P1] N=P2 */ |
| 15358 | #define OP_CursorLock 165 | 15670 | #define OP_Expire 165 |
| 15359 | #define OP_CursorUnlock 166 | 15671 | #define OP_CursorLock 166 |
| 15360 | #define OP_TableLock 167 /* synopsis: iDb=P1 root=P2 write=P3 */ | 15672 | #define OP_CursorUnlock 167 |
| 15361 | #define OP_VBegin 168 | 15673 | #define OP_TableLock 168 /* synopsis: iDb=P1 root=P2 write=P3 */ |
| 15362 | #define OP_VCreate 169 | 15674 | #define OP_VBegin 169 |
| 15363 | #define OP_VDestroy 170 | 15675 | #define OP_VCreate 170 |
| 15364 | #define OP_VOpen 171 | 15676 | #define OP_VDestroy 171 |
| 15365 | #define OP_VColumn 172 /* synopsis: r[P3]=vcolumn(P2) */ | 15677 | #define OP_VOpen 172 |
| 15366 | #define OP_VRename 173 | 15678 | #define OP_VInitIn 173 /* synopsis: r[P2]=ValueList(P1,P3) */ |
| 15367 | #define OP_Pagecount 174 | 15679 | #define OP_VColumn 174 /* synopsis: r[P3]=vcolumn(P2) */ |
| 15368 | #define OP_MaxPgcnt 175 | 15680 | #define OP_VRename 175 |
| 15369 | #define OP_Trace 176 | 15681 | #define OP_Pagecount 176 |
| 15370 | #define OP_CursorHint 177 | 15682 | #define OP_MaxPgcnt 177 |
| 15371 | #define OP_ReleaseReg 178 /* synopsis: release r[P1@P2] mask P3 */ | 15683 | #define OP_FilterAdd 178 /* synopsis: filter(P1) += key(P3@P4) */ |
| 15372 | #define OP_Noop 179 | 15684 | #define OP_Trace 179 |
| 15373 | #define OP_Explain 180 | 15685 | #define OP_CursorHint 180 |
| 15374 | #define OP_Abortable 181 | 15686 | #define OP_ReleaseReg 181 /* synopsis: release r[P1@P2] mask P3 */ |
| 15687 | #define OP_Noop 182 | ||
| 15688 | #define OP_Explain 183 | ||
| 15689 | #define OP_Abortable 184 | ||
| 15375 | 15690 | ||
| 15376 | /* Properties such as "out2" or "jump" that are specified in | 15691 | /* Properties such as "out2" or "jump" that are specified in |
| 15377 | ** comments following the "case" for each opcode in the vdbe.c | 15692 | ** comments following the "case" for each opcode in the vdbe.c |
| @@ -15392,21 +15707,22 @@ typedef struct VdbeOpList VdbeOpList; | |||
| 15392 | /* 40 */ 0x01, 0x01, 0x01, 0x26, 0x26, 0x23, 0x0b, 0x01,\ | 15707 | /* 40 */ 0x01, 0x01, 0x01, 0x26, 0x26, 0x23, 0x0b, 0x01,\ |
| 15393 | /* 48 */ 0x01, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ | 15708 | /* 48 */ 0x01, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ |
| 15394 | /* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x03, 0x01, 0x01, 0x01,\ | 15709 | /* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x03, 0x01, 0x01, 0x01,\ |
| 15395 | /* 64 */ 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10, 0x10,\ | 15710 | /* 64 */ 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10,\ |
| 15396 | /* 72 */ 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10,\ | 15711 | /* 72 */ 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00,\ |
| 15397 | /* 80 */ 0x10, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00,\ | 15712 | /* 80 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02,\ |
| 15398 | /* 88 */ 0x00, 0x12, 0x1e, 0x20, 0x00, 0x00, 0x00, 0x00,\ | 15713 | /* 88 */ 0x00, 0x00, 0x12, 0x1e, 0x20, 0x00, 0x00, 0x00,\ |
| 15399 | /* 96 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26,\ | 15714 | /* 96 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x26, 0x26,\ |
| 15400 | /* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\ | 15715 | /* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\ |
| 15401 | /* 112 */ 0x00, 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\ | 15716 | /* 112 */ 0x00, 0x00, 0x12, 0x00, 0x00, 0x10, 0x00, 0x00,\ |
| 15402 | /* 120 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ | 15717 | /* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\ |
| 15403 | /* 128 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,\ | 15718 | /* 128 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\ |
| 15404 | /* 136 */ 0x04, 0x04, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00,\ | 15719 | /* 136 */ 0x00, 0x04, 0x04, 0x00, 0x00, 0x10, 0x00, 0x10,\ |
| 15405 | /* 144 */ 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ | 15720 | /* 144 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15406 | /* 152 */ 0x10, 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a, 0x00,\ | 15721 | /* 152 */ 0x00, 0x10, 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a,\ |
| 15407 | /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ | 15722 | /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15408 | /* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,\ | 15723 | /* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,\ |
| 15409 | /* 176 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,} | 15724 | /* 176 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15725 | /* 184 */ 0x00,} | ||
| 15410 | 15726 | ||
| 15411 | /* The resolve3P2Values() routine is able to run faster if it knows | 15727 | /* The resolve3P2Values() routine is able to run faster if it knows |
| 15412 | ** the value of the largest JUMP opcode. The smaller the maximum | 15728 | ** the value of the largest JUMP opcode. The smaller the maximum |
| @@ -15414,7 +15730,7 @@ typedef struct VdbeOpList VdbeOpList; | |||
| 15414 | ** generated this include file strives to group all JUMP opcodes | 15730 | ** generated this include file strives to group all JUMP opcodes |
| 15415 | ** together near the beginning of the list. | 15731 | ** together near the beginning of the list. |
| 15416 | */ | 15732 | */ |
| 15417 | #define SQLITE_MX_JUMP_OPCODE 63 /* Maximum JUMP opcode */ | 15733 | #define SQLITE_MX_JUMP_OPCODE 64 /* Maximum JUMP opcode */ |
| 15418 | 15734 | ||
| 15419 | /************** End of opcodes.h *********************************************/ | 15735 | /************** End of opcodes.h *********************************************/ |
| 15420 | /************** Continuing where we left off in vdbe.h ***********************/ | 15736 | /************** Continuing where we left off in vdbe.h ***********************/ |
| @@ -16475,6 +16791,7 @@ struct sqlite3 { | |||
| 16475 | u32 nSchemaLock; /* Do not reset the schema when non-zero */ | 16791 | u32 nSchemaLock; /* Do not reset the schema when non-zero */ |
| 16476 | unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */ | 16792 | unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */ |
| 16477 | int errCode; /* Most recent error code (SQLITE_*) */ | 16793 | int errCode; /* Most recent error code (SQLITE_*) */ |
| 16794 | int errByteOffset; /* Byte offset of error in SQL statement */ | ||
| 16478 | int errMask; /* & result codes with this before returning */ | 16795 | int errMask; /* & result codes with this before returning */ |
| 16479 | int iSysErrno; /* Errno value from last system error */ | 16796 | int iSysErrno; /* Errno value from last system error */ |
| 16480 | u32 dbOptFlags; /* Flags to enable/disable optimizations */ | 16797 | u32 dbOptFlags; /* Flags to enable/disable optimizations */ |
| @@ -16709,6 +17026,9 @@ struct sqlite3 { | |||
| 16709 | #define SQLITE_SeekScan 0x00020000 /* The OP_SeekScan optimization */ | 17026 | #define SQLITE_SeekScan 0x00020000 /* The OP_SeekScan optimization */ |
| 16710 | #define SQLITE_OmitOrderBy 0x00040000 /* Omit pointless ORDER BY */ | 17027 | #define SQLITE_OmitOrderBy 0x00040000 /* Omit pointless ORDER BY */ |
| 16711 | /* TH3 expects this value ^^^^^^^^^^ to be 0x40000. Coordinate any change */ | 17028 | /* TH3 expects this value ^^^^^^^^^^ to be 0x40000. Coordinate any change */ |
| 17029 | #define SQLITE_BloomFilter 0x00080000 /* Use a Bloom filter on searches */ | ||
| 17030 | #define SQLITE_BloomPulldown 0x00100000 /* Run Bloom filters early */ | ||
| 17031 | #define SQLITE_BalancedMerge 0x00200000 /* Balance multi-way merges */ | ||
| 16712 | #define SQLITE_AllOpts 0xffffffff /* All optimizations */ | 17032 | #define SQLITE_AllOpts 0xffffffff /* All optimizations */ |
| 16713 | 17033 | ||
| 16714 | /* | 17034 | /* |
| @@ -16882,7 +17202,7 @@ struct FuncDestructor { | |||
| 16882 | ** are interpreted in the same way as the first 4 parameters to | 17202 | ** are interpreted in the same way as the first 4 parameters to |
| 16883 | ** FUNCTION(). | 17203 | ** FUNCTION(). |
| 16884 | ** | 17204 | ** |
| 16885 | ** WFUNCTION(zName, nArg, iArg, xStep, xFinal, xValue, xInverse) | 17205 | ** WAGGREGATE(zName, nArg, iArg, xStep, xFinal, xValue, xInverse) |
| 16886 | ** Used to create an aggregate function definition implemented by | 17206 | ** Used to create an aggregate function definition implemented by |
| 16887 | ** the C functions xStep and xFinal. The first four parameters | 17207 | ** the C functions xStep and xFinal. The first four parameters |
| 16888 | ** are interpreted in the same way as the first 4 parameters to | 17208 | ** are interpreted in the same way as the first 4 parameters to |
| @@ -16909,6 +17229,10 @@ struct FuncDestructor { | |||
| 16909 | #define MFUNCTION(zName, nArg, xPtr, xFunc) \ | 17229 | #define MFUNCTION(zName, nArg, xPtr, xFunc) \ |
| 16910 | {nArg, SQLITE_FUNC_BUILTIN|SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \ | 17230 | {nArg, SQLITE_FUNC_BUILTIN|SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \ |
| 16911 | xPtr, 0, xFunc, 0, 0, 0, #zName, {0} } | 17231 | xPtr, 0, xFunc, 0, 0, 0, #zName, {0} } |
| 17232 | #define JFUNCTION(zName, nArg, iArg, xFunc) \ | ||
| 17233 | {nArg, SQLITE_FUNC_BUILTIN|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS|\ | ||
| 17234 | SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \ | ||
| 17235 | SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} } | ||
| 16912 | #define INLINE_FUNC(zName, nArg, iArg, mFlags) \ | 17236 | #define INLINE_FUNC(zName, nArg, iArg, mFlags) \ |
| 16913 | {nArg, SQLITE_FUNC_BUILTIN|\ | 17237 | {nArg, SQLITE_FUNC_BUILTIN|\ |
| 16914 | SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \ | 17238 | SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \ |
| @@ -17763,7 +18087,10 @@ struct Expr { | |||
| 17763 | ** TK_VARIABLE: variable number (always >= 1). | 18087 | ** TK_VARIABLE: variable number (always >= 1). |
| 17764 | ** TK_SELECT_COLUMN: column of the result vector */ | 18088 | ** TK_SELECT_COLUMN: column of the result vector */ |
| 17765 | i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */ | 18089 | i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */ |
| 17766 | int iRightJoinTable; /* If EP_FromJoin, the right table of the join */ | 18090 | union { |
| 18091 | int iRightJoinTable; /* If EP_FromJoin, the right table of the join */ | ||
| 18092 | int iOfst; /* else: start of token from start of statement */ | ||
| 18093 | } w; | ||
| 17767 | AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ | 18094 | AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ |
| 17768 | union { | 18095 | union { |
| 17769 | Table *pTab; /* TK_COLUMN: Table containing column. Can be NULL | 18096 | Table *pTab; /* TK_COLUMN: Table containing column. Can be NULL |
| @@ -18503,6 +18830,8 @@ struct Parse { | |||
| 18503 | AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */ | 18830 | AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */ |
| 18504 | Parse *pToplevel; /* Parse structure for main program (or NULL) */ | 18831 | Parse *pToplevel; /* Parse structure for main program (or NULL) */ |
| 18505 | Table *pTriggerTab; /* Table triggers are being coded for */ | 18832 | Table *pTriggerTab; /* Table triggers are being coded for */ |
| 18833 | TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */ | ||
| 18834 | ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */ | ||
| 18506 | union { | 18835 | union { |
| 18507 | int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */ | 18836 | int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */ |
| 18508 | Returning *pReturning; /* The RETURNING clause */ | 18837 | Returning *pReturning; /* The RETURNING clause */ |
| @@ -18523,6 +18852,7 @@ struct Parse { | |||
| 18523 | **************************************************************************/ | 18852 | **************************************************************************/ |
| 18524 | 18853 | ||
| 18525 | int aTempReg[8]; /* Holding area for temporary registers */ | 18854 | int aTempReg[8]; /* Holding area for temporary registers */ |
| 18855 | Parse *pOuterParse; /* Outer Parse object when nested */ | ||
| 18526 | Token sNameToken; /* Token with unqualified schema object name */ | 18856 | Token sNameToken; /* Token with unqualified schema object name */ |
| 18527 | 18857 | ||
| 18528 | /************************************************************************ | 18858 | /************************************************************************ |
| @@ -18557,9 +18887,7 @@ struct Parse { | |||
| 18557 | Token sArg; /* Complete text of a module argument */ | 18887 | Token sArg; /* Complete text of a module argument */ |
| 18558 | Table **apVtabLock; /* Pointer to virtual tables needing locking */ | 18888 | Table **apVtabLock; /* Pointer to virtual tables needing locking */ |
| 18559 | #endif | 18889 | #endif |
| 18560 | TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */ | ||
| 18561 | With *pWith; /* Current WITH clause, or NULL */ | 18890 | With *pWith; /* Current WITH clause, or NULL */ |
| 18562 | ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */ | ||
| 18563 | #ifndef SQLITE_OMIT_ALTERTABLE | 18891 | #ifndef SQLITE_OMIT_ALTERTABLE |
| 18564 | RenameToken *pRename; /* Tokens subject to renaming by ALTER TABLE */ | 18892 | RenameToken *pRename; /* Tokens subject to renaming by ALTER TABLE */ |
| 18565 | #endif | 18893 | #endif |
| @@ -18575,7 +18903,8 @@ struct Parse { | |||
| 18575 | /* | 18903 | /* |
| 18576 | ** Sizes and pointers of various parts of the Parse object. | 18904 | ** Sizes and pointers of various parts of the Parse object. |
| 18577 | */ | 18905 | */ |
| 18578 | #define PARSE_HDR_SZ offsetof(Parse,aTempReg) /* Recursive part w/o aColCache*/ | 18906 | #define PARSE_HDR(X) (((char*)(X))+offsetof(Parse,zErrMsg)) |
| 18907 | #define PARSE_HDR_SZ (offsetof(Parse,aTempReg)-offsetof(Parse,zErrMsg)) /* Recursive part w/o aColCache*/ | ||
| 18579 | #define PARSE_RECURSE_SZ offsetof(Parse,sLastToken) /* Recursive part */ | 18908 | #define PARSE_RECURSE_SZ offsetof(Parse,sLastToken) /* Recursive part */ |
| 18580 | #define PARSE_TAIL_SZ (sizeof(Parse)-PARSE_RECURSE_SZ) /* Non-recursive part */ | 18909 | #define PARSE_TAIL_SZ (sizeof(Parse)-PARSE_RECURSE_SZ) /* Non-recursive part */ |
| 18581 | #define PARSE_TAIL(X) (((char*)(X))+PARSE_RECURSE_SZ) /* Pointer to tail */ | 18910 | #define PARSE_TAIL(X) (((char*)(X))+PARSE_RECURSE_SZ) /* Pointer to tail */ |
| @@ -18870,6 +19199,7 @@ struct Sqlite3Config { | |||
| 18870 | int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */ | 19199 | int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */ |
| 18871 | #endif | 19200 | #endif |
| 18872 | int bLocaltimeFault; /* True to fail localtime() calls */ | 19201 | int bLocaltimeFault; /* True to fail localtime() calls */ |
| 19202 | int (*xAltLocaltime)(const void*,void*); /* Alternative localtime() routine */ | ||
| 18873 | int iOnceResetThreshold; /* When to reset OP_Once counters */ | 19203 | int iOnceResetThreshold; /* When to reset OP_Once counters */ |
| 18874 | u32 szSorterRef; /* Min size in bytes to use sorter-refs */ | 19204 | u32 szSorterRef; /* Min size in bytes to use sorter-refs */ |
| 18875 | unsigned int iPrngSeed; /* Alternative fixed seed for the PRNG */ | 19205 | unsigned int iPrngSeed; /* Alternative fixed seed for the PRNG */ |
| @@ -19350,7 +19680,7 @@ SQLITE_PRIVATE void sqlite3DequoteExpr(Expr*); | |||
| 19350 | SQLITE_PRIVATE void sqlite3DequoteToken(Token*); | 19680 | SQLITE_PRIVATE void sqlite3DequoteToken(Token*); |
| 19351 | SQLITE_PRIVATE void sqlite3TokenInit(Token*,char*); | 19681 | SQLITE_PRIVATE void sqlite3TokenInit(Token*,char*); |
| 19352 | SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char*, int); | 19682 | SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char*, int); |
| 19353 | SQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*, char **); | 19683 | SQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*); |
| 19354 | SQLITE_PRIVATE void sqlite3FinishCoding(Parse*); | 19684 | SQLITE_PRIVATE void sqlite3FinishCoding(Parse*); |
| 19355 | SQLITE_PRIVATE int sqlite3GetTempReg(Parse*); | 19685 | SQLITE_PRIVATE int sqlite3GetTempReg(Parse*); |
| 19356 | SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int); | 19686 | SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int); |
| @@ -19511,10 +19841,12 @@ SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int); | |||
| 19511 | #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) | 19841 | #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) |
| 19512 | SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*); | 19842 | SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*); |
| 19513 | #endif | 19843 | #endif |
| 19844 | SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe*,int,const char*); | ||
| 19514 | SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*, ExprList*, Expr*); | 19845 | SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*, ExprList*, Expr*); |
| 19515 | SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*,Expr*,int,ExprList*,Expr*, | 19846 | SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*,Expr*,int,ExprList*,Expr*, |
| 19516 | Upsert*); | 19847 | Upsert*); |
| 19517 | SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int); | 19848 | SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*, |
| 19849 | ExprList*,Select*,u16,int); | ||
| 19518 | SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*); | 19850 | SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*); |
| 19519 | SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo*); | 19851 | SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo*); |
| 19520 | SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*); | 19852 | SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*); |
| @@ -19629,9 +19961,14 @@ SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3*,const Select*,int); | |||
| 19629 | SQLITE_PRIVATE FuncDef *sqlite3FunctionSearch(int,const char*); | 19961 | SQLITE_PRIVATE FuncDef *sqlite3FunctionSearch(int,const char*); |
| 19630 | SQLITE_PRIVATE void sqlite3InsertBuiltinFuncs(FuncDef*,int); | 19962 | SQLITE_PRIVATE void sqlite3InsertBuiltinFuncs(FuncDef*,int); |
| 19631 | SQLITE_PRIVATE FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,u8,u8); | 19963 | SQLITE_PRIVATE FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,u8,u8); |
| 19964 | SQLITE_PRIVATE void sqlite3QuoteValue(StrAccum*,sqlite3_value*); | ||
| 19632 | SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void); | 19965 | SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void); |
| 19633 | SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void); | 19966 | SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void); |
| 19967 | SQLITE_PRIVATE void sqlite3RegisterJsonFunctions(void); | ||
| 19634 | SQLITE_PRIVATE void sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3*); | 19968 | SQLITE_PRIVATE void sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3*); |
| 19969 | #if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON) | ||
| 19970 | SQLITE_PRIVATE int sqlite3JsonTableFunctions(sqlite3*); | ||
| 19971 | #endif | ||
| 19635 | SQLITE_PRIVATE int sqlite3SafetyCheckOk(sqlite3*); | 19972 | SQLITE_PRIVATE int sqlite3SafetyCheckOk(sqlite3*); |
| 19636 | SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3*); | 19973 | SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3*); |
| 19637 | SQLITE_PRIVATE void sqlite3ChangeCookie(Parse*, int); | 19974 | SQLITE_PRIVATE void sqlite3ChangeCookie(Parse*, int); |
| @@ -19721,14 +20058,8 @@ SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte); | |||
| 19721 | SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**); | 20058 | SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**); |
| 19722 | SQLITE_PRIVATE LogEst sqlite3LogEst(u64); | 20059 | SQLITE_PRIVATE LogEst sqlite3LogEst(u64); |
| 19723 | SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst,LogEst); | 20060 | SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst,LogEst); |
| 19724 | #ifndef SQLITE_OMIT_VIRTUALTABLE | ||
| 19725 | SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double); | 20061 | SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double); |
| 19726 | #endif | ||
| 19727 | #if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \ | ||
| 19728 | defined(SQLITE_ENABLE_STAT4) || \ | ||
| 19729 | defined(SQLITE_EXPLAIN_ESTIMATED_ROWS) | ||
| 19730 | SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst); | 20062 | SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst); |
| 19731 | #endif | ||
| 19732 | SQLITE_PRIVATE VList *sqlite3VListAdd(sqlite3*,VList*,const char*,int,int); | 20063 | SQLITE_PRIVATE VList *sqlite3VListAdd(sqlite3*,VList*,const char*,int,int); |
| 19733 | SQLITE_PRIVATE const char *sqlite3VListNumToName(VList*,int); | 20064 | SQLITE_PRIVATE const char *sqlite3VListNumToName(VList*,int); |
| 19734 | SQLITE_PRIVATE int sqlite3VListNameToNum(VList*,const char*,int); | 20065 | SQLITE_PRIVATE int sqlite3VListNameToNum(VList*,const char*,int); |
| @@ -19915,17 +20246,20 @@ SQLITE_PRIVATE int sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *, | |||
| 19915 | FuncDestructor *pDestructor | 20246 | FuncDestructor *pDestructor |
| 19916 | ); | 20247 | ); |
| 19917 | SQLITE_PRIVATE void sqlite3NoopDestructor(void*); | 20248 | SQLITE_PRIVATE void sqlite3NoopDestructor(void*); |
| 19918 | SQLITE_PRIVATE void sqlite3OomFault(sqlite3*); | 20249 | SQLITE_PRIVATE void *sqlite3OomFault(sqlite3*); |
| 19919 | SQLITE_PRIVATE void sqlite3OomClear(sqlite3*); | 20250 | SQLITE_PRIVATE void sqlite3OomClear(sqlite3*); |
| 19920 | SQLITE_PRIVATE int sqlite3ApiExit(sqlite3 *db, int); | 20251 | SQLITE_PRIVATE int sqlite3ApiExit(sqlite3 *db, int); |
| 19921 | SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *); | 20252 | SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *); |
| 19922 | 20253 | ||
| 19923 | SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, sqlite3*, char*, int, int); | 20254 | SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, sqlite3*, char*, int, int); |
| 20255 | SQLITE_PRIVATE int sqlite3StrAccumEnlarge(StrAccum*, int); | ||
| 19924 | SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*); | 20256 | SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*); |
| 19925 | SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum*, u8); | 20257 | SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum*, u8); |
| 19926 | SQLITE_PRIVATE void sqlite3ResultStrAccum(sqlite3_context*,StrAccum*); | 20258 | SQLITE_PRIVATE void sqlite3ResultStrAccum(sqlite3_context*,StrAccum*); |
| 19927 | SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int); | 20259 | SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int); |
| 19928 | SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int); | 20260 | SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int); |
| 20261 | SQLITE_PRIVATE void sqlite3RecordErrorByteOffset(sqlite3*,const char*); | ||
| 20262 | SQLITE_PRIVATE void sqlite3RecordErrorOffsetOfExpr(sqlite3*,const Expr*); | ||
| 19929 | 20263 | ||
| 19930 | SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *); | 20264 | SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *); |
| 19931 | SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *); | 20265 | SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *); |
| @@ -20034,7 +20368,8 @@ SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg | |||
| 20034 | SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*); | 20368 | SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*); |
| 20035 | SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int); | 20369 | SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int); |
| 20036 | SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *); | 20370 | SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *); |
| 20037 | SQLITE_PRIVATE void sqlite3ParserReset(Parse*); | 20371 | SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse*,sqlite3*); |
| 20372 | SQLITE_PRIVATE void sqlite3ParseObjectReset(Parse*); | ||
| 20038 | SQLITE_PRIVATE void *sqlite3ParserAddCleanup(Parse*,void(*)(sqlite3*,void*),void*); | 20373 | SQLITE_PRIVATE void *sqlite3ParserAddCleanup(Parse*,void(*)(sqlite3*,void*),void*); |
| 20039 | #ifdef SQLITE_ENABLE_NORMALIZE | 20374 | #ifdef SQLITE_ENABLE_NORMALIZE |
| 20040 | SQLITE_PRIVATE char *sqlite3Normalize(Vdbe*, const char*); | 20375 | SQLITE_PRIVATE char *sqlite3Normalize(Vdbe*, const char*); |
| @@ -20093,6 +20428,7 @@ SQLITE_PRIVATE void sqlite3FkActions(Parse*, Table*, ExprList*, int, int*, int | |||
| 20093 | SQLITE_PRIVATE int sqlite3FkRequired(Parse*, Table*, int*, int); | 20428 | SQLITE_PRIVATE int sqlite3FkRequired(Parse*, Table*, int*, int); |
| 20094 | SQLITE_PRIVATE u32 sqlite3FkOldmask(Parse*, Table*); | 20429 | SQLITE_PRIVATE u32 sqlite3FkOldmask(Parse*, Table*); |
| 20095 | SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *); | 20430 | SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *); |
| 20431 | SQLITE_PRIVATE void sqlite3FkClearTriggerCache(sqlite3*,int); | ||
| 20096 | #else | 20432 | #else |
| 20097 | #define sqlite3FkActions(a,b,c,d,e,f) | 20433 | #define sqlite3FkActions(a,b,c,d,e,f) |
| 20098 | #define sqlite3FkCheck(a,b,c,d,e,f) | 20434 | #define sqlite3FkCheck(a,b,c,d,e,f) |
| @@ -20100,6 +20436,7 @@ SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *); | |||
| 20100 | #define sqlite3FkOldmask(a,b) 0 | 20436 | #define sqlite3FkOldmask(a,b) 0 |
| 20101 | #define sqlite3FkRequired(a,b,c,d) 0 | 20437 | #define sqlite3FkRequired(a,b,c,d) 0 |
| 20102 | #define sqlite3FkReferences(a) 0 | 20438 | #define sqlite3FkReferences(a) 0 |
| 20439 | #define sqlite3FkClearTriggerCache(a,b) | ||
| 20103 | #endif | 20440 | #endif |
| 20104 | #ifndef SQLITE_OMIT_FOREIGN_KEY | 20441 | #ifndef SQLITE_OMIT_FOREIGN_KEY |
| 20105 | SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *, Table*); | 20442 | SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *, Table*); |
| @@ -20465,6 +20802,14 @@ SQLITE_API extern int sqlite3_open_file_count; | |||
| 20465 | 20802 | ||
| 20466 | /************** End of os_common.h *******************************************/ | 20803 | /************** End of os_common.h *******************************************/ |
| 20467 | /************** Begin file ctime.c *******************************************/ | 20804 | /************** Begin file ctime.c *******************************************/ |
| 20805 | /* DO NOT EDIT! | ||
| 20806 | ** This file is automatically generated by the script in the canonical | ||
| 20807 | ** SQLite source tree at tool/mkctimec.tcl. | ||
| 20808 | ** | ||
| 20809 | ** To modify this header, edit any of the various lists in that script | ||
| 20810 | ** which specify categories of generated conditionals in this file. | ||
| 20811 | */ | ||
| 20812 | |||
| 20468 | /* | 20813 | /* |
| 20469 | ** 2010 February 23 | 20814 | ** 2010 February 23 |
| 20470 | ** | 20815 | ** |
| @@ -20513,9 +20858,6 @@ SQLITE_API extern int sqlite3_open_file_count; | |||
| 20513 | */ | 20858 | */ |
| 20514 | static const char * const sqlite3azCompileOpt[] = { | 20859 | static const char * const sqlite3azCompileOpt[] = { |
| 20515 | 20860 | ||
| 20516 | /* | ||
| 20517 | ** BEGIN CODE GENERATED BY tool/mkctime.tcl | ||
| 20518 | */ | ||
| 20519 | #ifdef SQLITE_32BIT_ROWID | 20861 | #ifdef SQLITE_32BIT_ROWID |
| 20520 | "32BIT_ROWID", | 20862 | "32BIT_ROWID", |
| 20521 | #endif | 20863 | #endif |
| @@ -20724,9 +21066,6 @@ static const char * const sqlite3azCompileOpt[] = { | |||
| 20724 | #ifdef SQLITE_ENABLE_IOTRACE | 21066 | #ifdef SQLITE_ENABLE_IOTRACE |
| 20725 | "ENABLE_IOTRACE", | 21067 | "ENABLE_IOTRACE", |
| 20726 | #endif | 21068 | #endif |
| 20727 | #ifdef SQLITE_ENABLE_JSON1 | ||
| 20728 | "ENABLE_JSON1", | ||
| 20729 | #endif | ||
| 20730 | #ifdef SQLITE_ENABLE_LOAD_EXTENSION | 21069 | #ifdef SQLITE_ENABLE_LOAD_EXTENSION |
| 20731 | "ENABLE_LOAD_EXTENSION", | 21070 | "ENABLE_LOAD_EXTENSION", |
| 20732 | #endif | 21071 | #endif |
| @@ -21050,6 +21389,9 @@ static const char * const sqlite3azCompileOpt[] = { | |||
| 21050 | #ifdef SQLITE_OMIT_INTROSPECTION_PRAGMAS | 21389 | #ifdef SQLITE_OMIT_INTROSPECTION_PRAGMAS |
| 21051 | "OMIT_INTROSPECTION_PRAGMAS", | 21390 | "OMIT_INTROSPECTION_PRAGMAS", |
| 21052 | #endif | 21391 | #endif |
| 21392 | #ifdef SQLITE_OMIT_JSON | ||
| 21393 | "OMIT_JSON", | ||
| 21394 | #endif | ||
| 21053 | #ifdef SQLITE_OMIT_LIKE_OPTIMIZATION | 21395 | #ifdef SQLITE_OMIT_LIKE_OPTIMIZATION |
| 21054 | "OMIT_LIKE_OPTIMIZATION", | 21396 | "OMIT_LIKE_OPTIMIZATION", |
| 21055 | #endif | 21397 | #endif |
| @@ -21238,10 +21580,8 @@ static const char * const sqlite3azCompileOpt[] = { | |||
| 21238 | #ifdef SQLITE_ZERO_MALLOC | 21580 | #ifdef SQLITE_ZERO_MALLOC |
| 21239 | "ZERO_MALLOC", | 21581 | "ZERO_MALLOC", |
| 21240 | #endif | 21582 | #endif |
| 21241 | /* | 21583 | |
| 21242 | ** END CODE GENERATED BY tool/mkctime.tcl | 21584 | } ; |
| 21243 | */ | ||
| 21244 | }; | ||
| 21245 | 21585 | ||
| 21246 | SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt){ | 21586 | SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt){ |
| 21247 | *pnOpt = sizeof(sqlite3azCompileOpt) / sizeof(sqlite3azCompileOpt[0]); | 21587 | *pnOpt = sizeof(sqlite3azCompileOpt) / sizeof(sqlite3azCompileOpt[0]); |
| @@ -21540,6 +21880,7 @@ SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = { | |||
| 21540 | 0, /* xTestCallback */ | 21880 | 0, /* xTestCallback */ |
| 21541 | #endif | 21881 | #endif |
| 21542 | 0, /* bLocaltimeFault */ | 21882 | 0, /* bLocaltimeFault */ |
| 21883 | 0, /* xAltLocaltime */ | ||
| 21543 | 0x7ffffffe, /* iOnceResetThreshold */ | 21884 | 0x7ffffffe, /* iOnceResetThreshold */ |
| 21544 | SQLITE_DEFAULT_SORTERREF_SIZE, /* szSorterRef */ | 21885 | SQLITE_DEFAULT_SORTERREF_SIZE, /* szSorterRef */ |
| 21545 | 0, /* iPrngSeed */ | 21886 | 0, /* iPrngSeed */ |
| @@ -21753,7 +22094,7 @@ typedef struct AuxData AuxData; | |||
| 21753 | typedef struct VdbeCursor VdbeCursor; | 22094 | typedef struct VdbeCursor VdbeCursor; |
| 21754 | struct VdbeCursor { | 22095 | struct VdbeCursor { |
| 21755 | u8 eCurType; /* One of the CURTYPE_* values above */ | 22096 | u8 eCurType; /* One of the CURTYPE_* values above */ |
| 21756 | i8 iDb; /* Index of cursor database in db->aDb[] (or -1) */ | 22097 | i8 iDb; /* Index of cursor database in db->aDb[] */ |
| 21757 | u8 nullRow; /* True if pointing to a row with no data */ | 22098 | u8 nullRow; /* True if pointing to a row with no data */ |
| 21758 | u8 deferredMoveto; /* A call to sqlite3BtreeMoveto() is needed */ | 22099 | u8 deferredMoveto; /* A call to sqlite3BtreeMoveto() is needed */ |
| 21759 | u8 isTable; /* True for rowid tables. False for indexes */ | 22100 | u8 isTable; /* True for rowid tables. False for indexes */ |
| @@ -21766,9 +22107,11 @@ struct VdbeCursor { | |||
| 21766 | Bool isOrdered:1; /* True if the table is not BTREE_UNORDERED */ | 22107 | Bool isOrdered:1; /* True if the table is not BTREE_UNORDERED */ |
| 21767 | Bool hasBeenDuped:1; /* This cursor was source or target of OP_OpenDup */ | 22108 | Bool hasBeenDuped:1; /* This cursor was source or target of OP_OpenDup */ |
| 21768 | u16 seekHit; /* See the OP_SeekHit and OP_IfNoHope opcodes */ | 22109 | u16 seekHit; /* See the OP_SeekHit and OP_IfNoHope opcodes */ |
| 21769 | Btree *pBtx; /* Separate file holding temporary table */ | 22110 | union { /* pBtx for isEphermeral. pAltMap otherwise */ |
| 22111 | Btree *pBtx; /* Separate file holding temporary table */ | ||
| 22112 | u32 *aAltMap; /* Mapping from table to index column numbers */ | ||
| 22113 | } ub; | ||
| 21770 | i64 seqCount; /* Sequence counter */ | 22114 | i64 seqCount; /* Sequence counter */ |
| 21771 | u32 *aAltMap; /* Mapping from table to index column numbers */ | ||
| 21772 | 22115 | ||
| 21773 | /* Cached OP_Column parse information is only valid if cacheStatus matches | 22116 | /* Cached OP_Column parse information is only valid if cacheStatus matches |
| 21774 | ** Vdbe.cacheCtr. Vdbe.cacheCtr will never take on the value of | 22117 | ** Vdbe.cacheCtr. Vdbe.cacheCtr will never take on the value of |
| @@ -22108,7 +22451,7 @@ struct Vdbe { | |||
| 22108 | bft bIsReader:1; /* True for statements that read */ | 22451 | bft bIsReader:1; /* True for statements that read */ |
| 22109 | yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */ | 22452 | yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */ |
| 22110 | yDbMask lockMask; /* Subset of btreeMask that requires a lock */ | 22453 | yDbMask lockMask; /* Subset of btreeMask that requires a lock */ |
| 22111 | u32 aCounter[7]; /* Counters used by sqlite3_stmt_status() */ | 22454 | u32 aCounter[9]; /* Counters used by sqlite3_stmt_status() */ |
| 22112 | char *zSql; /* Text of the SQL statement that generated this */ | 22455 | char *zSql; /* Text of the SQL statement that generated this */ |
| 22113 | #ifdef SQLITE_ENABLE_NORMALIZE | 22456 | #ifdef SQLITE_ENABLE_NORMALIZE |
| 22114 | char *zNormSql; /* Normalization of the associated SQL statement */ | 22457 | char *zNormSql; /* Normalization of the associated SQL statement */ |
| @@ -22159,6 +22502,24 @@ struct PreUpdate { | |||
| 22159 | }; | 22502 | }; |
| 22160 | 22503 | ||
| 22161 | /* | 22504 | /* |
| 22505 | ** An instance of this object is used to pass an vector of values into | ||
| 22506 | ** OP_VFilter, the xFilter method of a virtual table. The vector is the | ||
| 22507 | ** set of values on the right-hand side of an IN constraint. | ||
| 22508 | ** | ||
| 22509 | ** The value as passed into xFilter is an sqlite3_value with a "pointer" | ||
| 22510 | ** type, such as is generated by sqlite3_result_pointer() and read by | ||
| 22511 | ** sqlite3_value_pointer. Such values have MEM_Term|MEM_Subtype|MEM_Null | ||
| 22512 | ** and a subtype of 'p'. The sqlite3_vtab_in_first() and _next() interfaces | ||
| 22513 | ** know how to use this object to step through all the values in the | ||
| 22514 | ** right operand of the IN constraint. | ||
| 22515 | */ | ||
| 22516 | typedef struct ValueList ValueList; | ||
| 22517 | struct ValueList { | ||
| 22518 | BtCursor *pCsr; /* An ephemeral table holding all values */ | ||
| 22519 | sqlite3_value *pOut; /* Register to hold each decoded output value */ | ||
| 22520 | }; | ||
| 22521 | |||
| 22522 | /* | ||
| 22162 | ** Function prototypes | 22523 | ** Function prototypes |
| 22163 | */ | 22524 | */ |
| 22164 | SQLITE_PRIVATE void sqlite3VdbeError(Vdbe*, const char *, ...); | 22525 | SQLITE_PRIVATE void sqlite3VdbeError(Vdbe*, const char *, ...); |
| @@ -22170,7 +22531,7 @@ SQLITE_PRIVATE int sqlite3VdbeCursorRestore(VdbeCursor*); | |||
| 22170 | SQLITE_PRIVATE u32 sqlite3VdbeSerialTypeLen(u32); | 22531 | SQLITE_PRIVATE u32 sqlite3VdbeSerialTypeLen(u32); |
| 22171 | SQLITE_PRIVATE u8 sqlite3VdbeOneByteSerialTypeLen(u8); | 22532 | SQLITE_PRIVATE u8 sqlite3VdbeOneByteSerialTypeLen(u8); |
| 22172 | SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32); | 22533 | SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32); |
| 22173 | SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*); | 22534 | SQLITE_PRIVATE void sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*); |
| 22174 | SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(sqlite3*, AuxData**, int, int); | 22535 | SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(sqlite3*, AuxData**, int, int); |
| 22175 | 22536 | ||
| 22176 | int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *); | 22537 | int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *); |
| @@ -22216,7 +22577,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemSetRowSet(Mem*); | |||
| 22216 | SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem*); | 22577 | SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem*); |
| 22217 | SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem*, u8, u8); | 22578 | SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem*, u8, u8); |
| 22218 | SQLITE_PRIVATE int sqlite3IntFloatCompare(i64,double); | 22579 | SQLITE_PRIVATE int sqlite3IntFloatCompare(i64,double); |
| 22219 | SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem*); | 22580 | SQLITE_PRIVATE i64 sqlite3VdbeIntValue(const Mem*); |
| 22220 | SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem*); | 22581 | SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem*); |
| 22221 | SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem*); | 22582 | SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem*); |
| 22222 | SQLITE_PRIVATE int sqlite3VdbeBooleanValue(Mem*, int ifNull); | 22583 | SQLITE_PRIVATE int sqlite3VdbeBooleanValue(Mem*, int ifNull); |
| @@ -23194,8 +23555,10 @@ static void clearYMD_HMS_TZ(DateTime *p){ | |||
| 23194 | ** is available. This routine returns 0 on success and | 23555 | ** is available. This routine returns 0 on success and |
| 23195 | ** non-zero on any kind of error. | 23556 | ** non-zero on any kind of error. |
| 23196 | ** | 23557 | ** |
| 23197 | ** If the sqlite3GlobalConfig.bLocaltimeFault variable is true then this | 23558 | ** If the sqlite3GlobalConfig.bLocaltimeFault variable is non-zero then this |
| 23198 | ** routine will always fail. | 23559 | ** routine will always fail. If bLocaltimeFault is nonzero and |
| 23560 | ** sqlite3GlobalConfig.xAltLocaltime is not NULL, then xAltLocaltime() is | ||
| 23561 | ** invoked in place of the OS-defined localtime() function. | ||
| 23199 | ** | 23562 | ** |
| 23200 | ** EVIDENCE-OF: R-62172-00036 In this implementation, the standard C | 23563 | ** EVIDENCE-OF: R-62172-00036 In this implementation, the standard C |
| 23201 | ** library function localtime_r() is used to assist in the calculation of | 23564 | ** library function localtime_r() is used to assist in the calculation of |
| @@ -23211,14 +23574,30 @@ static int osLocaltime(time_t *t, struct tm *pTm){ | |||
| 23211 | sqlite3_mutex_enter(mutex); | 23574 | sqlite3_mutex_enter(mutex); |
| 23212 | pX = localtime(t); | 23575 | pX = localtime(t); |
| 23213 | #ifndef SQLITE_UNTESTABLE | 23576 | #ifndef SQLITE_UNTESTABLE |
| 23214 | if( sqlite3GlobalConfig.bLocaltimeFault ) pX = 0; | 23577 | if( sqlite3GlobalConfig.bLocaltimeFault ){ |
| 23578 | if( sqlite3GlobalConfig.xAltLocaltime!=0 | ||
| 23579 | && 0==sqlite3GlobalConfig.xAltLocaltime((const void*)t,(void*)pTm) | ||
| 23580 | ){ | ||
| 23581 | pX = pTm; | ||
| 23582 | }else{ | ||
| 23583 | pX = 0; | ||
| 23584 | } | ||
| 23585 | } | ||
| 23215 | #endif | 23586 | #endif |
| 23216 | if( pX ) *pTm = *pX; | 23587 | if( pX ) *pTm = *pX; |
| 23588 | #if SQLITE_THREADSAFE>0 | ||
| 23217 | sqlite3_mutex_leave(mutex); | 23589 | sqlite3_mutex_leave(mutex); |
| 23590 | #endif | ||
| 23218 | rc = pX==0; | 23591 | rc = pX==0; |
| 23219 | #else | 23592 | #else |
| 23220 | #ifndef SQLITE_UNTESTABLE | 23593 | #ifndef SQLITE_UNTESTABLE |
| 23221 | if( sqlite3GlobalConfig.bLocaltimeFault ) return 1; | 23594 | if( sqlite3GlobalConfig.bLocaltimeFault ){ |
| 23595 | if( sqlite3GlobalConfig.xAltLocaltime!=0 ){ | ||
| 23596 | return sqlite3GlobalConfig.xAltLocaltime((const void*)t,(void*)pTm); | ||
| 23597 | }else{ | ||
| 23598 | return 1; | ||
| 23599 | } | ||
| 23600 | } | ||
| 23222 | #endif | 23601 | #endif |
| 23223 | #if HAVE_LOCALTIME_R | 23602 | #if HAVE_LOCALTIME_R |
| 23224 | rc = localtime_r(t, pTm)==0; | 23603 | rc = localtime_r(t, pTm)==0; |
| @@ -23233,67 +23612,56 @@ static int osLocaltime(time_t *t, struct tm *pTm){ | |||
| 23233 | 23612 | ||
| 23234 | #ifndef SQLITE_OMIT_LOCALTIME | 23613 | #ifndef SQLITE_OMIT_LOCALTIME |
| 23235 | /* | 23614 | /* |
| 23236 | ** Compute the difference (in milliseconds) between localtime and UTC | 23615 | ** Assuming the input DateTime is UTC, move it to its localtime equivalent. |
| 23237 | ** (a.k.a. GMT) for the time value p where p is in UTC. If no error occurs, | ||
| 23238 | ** return this value and set *pRc to SQLITE_OK. | ||
| 23239 | ** | ||
| 23240 | ** Or, if an error does occur, set *pRc to SQLITE_ERROR. The returned value | ||
| 23241 | ** is undefined in this case. | ||
| 23242 | */ | 23616 | */ |
| 23243 | static sqlite3_int64 localtimeOffset( | 23617 | static int toLocaltime( |
| 23244 | DateTime *p, /* Date at which to calculate offset */ | 23618 | DateTime *p, /* Date at which to calculate offset */ |
| 23245 | sqlite3_context *pCtx, /* Write error here if one occurs */ | 23619 | sqlite3_context *pCtx /* Write error here if one occurs */ |
| 23246 | int *pRc /* OUT: Error code. SQLITE_OK or ERROR */ | ||
| 23247 | ){ | 23620 | ){ |
| 23248 | DateTime x, y; | ||
| 23249 | time_t t; | 23621 | time_t t; |
| 23250 | struct tm sLocal; | 23622 | struct tm sLocal; |
| 23623 | int iYearDiff; | ||
| 23251 | 23624 | ||
| 23252 | /* Initialize the contents of sLocal to avoid a compiler warning. */ | 23625 | /* Initialize the contents of sLocal to avoid a compiler warning. */ |
| 23253 | memset(&sLocal, 0, sizeof(sLocal)); | 23626 | memset(&sLocal, 0, sizeof(sLocal)); |
| 23254 | 23627 | ||
| 23255 | x = *p; | 23628 | computeJD(p); |
| 23256 | computeYMD_HMS(&x); | 23629 | if( p->iJD<2108667600*(i64)100000 /* 1970-01-01 */ |
| 23257 | if( x.Y<1971 || x.Y>=2038 ){ | 23630 | || p->iJD>2130141456*(i64)100000 /* 2038-01-18 */ |
| 23631 | ){ | ||
| 23258 | /* EVIDENCE-OF: R-55269-29598 The localtime_r() C function normally only | 23632 | /* EVIDENCE-OF: R-55269-29598 The localtime_r() C function normally only |
| 23259 | ** works for years between 1970 and 2037. For dates outside this range, | 23633 | ** works for years between 1970 and 2037. For dates outside this range, |
| 23260 | ** SQLite attempts to map the year into an equivalent year within this | 23634 | ** SQLite attempts to map the year into an equivalent year within this |
| 23261 | ** range, do the calculation, then map the year back. | 23635 | ** range, do the calculation, then map the year back. |
| 23262 | */ | 23636 | */ |
| 23263 | x.Y = 2000; | 23637 | DateTime x = *p; |
| 23264 | x.M = 1; | 23638 | computeYMD_HMS(&x); |
| 23265 | x.D = 1; | 23639 | iYearDiff = (2000 + x.Y%4) - x.Y; |
| 23266 | x.h = 0; | 23640 | x.Y += iYearDiff; |
| 23267 | x.m = 0; | 23641 | x.validJD = 0; |
| 23268 | x.s = 0.0; | 23642 | computeJD(&x); |
| 23269 | } else { | 23643 | t = (time_t)(x.iJD/1000 - 21086676*(i64)10000); |
| 23270 | int s = (int)(x.s + 0.5); | 23644 | }else{ |
| 23271 | x.s = s; | 23645 | iYearDiff = 0; |
| 23646 | t = (time_t)(p->iJD/1000 - 21086676*(i64)10000); | ||
| 23272 | } | 23647 | } |
| 23273 | x.tz = 0; | ||
| 23274 | x.validJD = 0; | ||
| 23275 | computeJD(&x); | ||
| 23276 | t = (time_t)(x.iJD/1000 - 21086676*(i64)10000); | ||
| 23277 | if( osLocaltime(&t, &sLocal) ){ | 23648 | if( osLocaltime(&t, &sLocal) ){ |
| 23278 | sqlite3_result_error(pCtx, "local time unavailable", -1); | 23649 | sqlite3_result_error(pCtx, "local time unavailable", -1); |
| 23279 | *pRc = SQLITE_ERROR; | 23650 | return SQLITE_ERROR; |
| 23280 | return 0; | ||
| 23281 | } | 23651 | } |
| 23282 | y.Y = sLocal.tm_year + 1900; | 23652 | p->Y = sLocal.tm_year + 1900 - iYearDiff; |
| 23283 | y.M = sLocal.tm_mon + 1; | 23653 | p->M = sLocal.tm_mon + 1; |
| 23284 | y.D = sLocal.tm_mday; | 23654 | p->D = sLocal.tm_mday; |
| 23285 | y.h = sLocal.tm_hour; | 23655 | p->h = sLocal.tm_hour; |
| 23286 | y.m = sLocal.tm_min; | 23656 | p->m = sLocal.tm_min; |
| 23287 | y.s = sLocal.tm_sec; | 23657 | p->s = sLocal.tm_sec; |
| 23288 | y.validYMD = 1; | 23658 | p->validYMD = 1; |
| 23289 | y.validHMS = 1; | 23659 | p->validHMS = 1; |
| 23290 | y.validJD = 0; | 23660 | p->validJD = 0; |
| 23291 | y.rawS = 0; | 23661 | p->rawS = 0; |
| 23292 | y.validTZ = 0; | 23662 | p->validTZ = 0; |
| 23293 | y.isError = 0; | 23663 | p->isError = 0; |
| 23294 | computeJD(&y); | 23664 | return SQLITE_OK; |
| 23295 | *pRc = SQLITE_OK; | ||
| 23296 | return y.iJD - x.iJD; | ||
| 23297 | } | 23665 | } |
| 23298 | #endif /* SQLITE_OMIT_LOCALTIME */ | 23666 | #endif /* SQLITE_OMIT_LOCALTIME */ |
| 23299 | 23667 | ||
| @@ -23306,18 +23674,17 @@ static sqlite3_int64 localtimeOffset( | |||
| 23306 | ** of several units of time. | 23674 | ** of several units of time. |
| 23307 | */ | 23675 | */ |
| 23308 | static const struct { | 23676 | static const struct { |
| 23309 | u8 eType; /* Transformation type code */ | 23677 | u8 nName; /* Length of the name */ |
| 23310 | u8 nName; /* Length of th name */ | 23678 | char zName[7]; /* Name of the transformation */ |
| 23311 | char *zName; /* Name of the transformation */ | 23679 | float rLimit; /* Maximum NNN value for this transform */ |
| 23312 | double rLimit; /* Maximum NNN value for this transform */ | 23680 | float rXform; /* Constant used for this transform */ |
| 23313 | double rXform; /* Constant used for this transform */ | ||
| 23314 | } aXformType[] = { | 23681 | } aXformType[] = { |
| 23315 | { 0, 6, "second", 464269060800.0, 1000.0 }, | 23682 | { 6, "second", 4.6427e+14, 1.0 }, |
| 23316 | { 0, 6, "minute", 7737817680.0, 60000.0 }, | 23683 | { 6, "minute", 7.7379e+12, 60.0 }, |
| 23317 | { 0, 4, "hour", 128963628.0, 3600000.0 }, | 23684 | { 4, "hour", 1.2897e+11, 3600.0 }, |
| 23318 | { 0, 3, "day", 5373485.0, 86400000.0 }, | 23685 | { 3, "day", 5373485.0, 86400.0 }, |
| 23319 | { 1, 5, "month", 176546.0, 2592000000.0 }, | 23686 | { 5, "month", 176546.0, 2592000.0 }, |
| 23320 | { 2, 4, "year", 14713.0, 31536000000.0 }, | 23687 | { 4, "year", 14713.0, 31536000.0 }, |
| 23321 | }; | 23688 | }; |
| 23322 | 23689 | ||
| 23323 | /* | 23690 | /* |
| @@ -23348,11 +23715,55 @@ static int parseModifier( | |||
| 23348 | sqlite3_context *pCtx, /* Function context */ | 23715 | sqlite3_context *pCtx, /* Function context */ |
| 23349 | const char *z, /* The text of the modifier */ | 23716 | const char *z, /* The text of the modifier */ |
| 23350 | int n, /* Length of zMod in bytes */ | 23717 | int n, /* Length of zMod in bytes */ |
| 23351 | DateTime *p /* The date/time value to be modified */ | 23718 | DateTime *p, /* The date/time value to be modified */ |
| 23719 | int idx /* Parameter index of the modifier */ | ||
| 23352 | ){ | 23720 | ){ |
| 23353 | int rc = 1; | 23721 | int rc = 1; |
| 23354 | double r; | 23722 | double r; |
| 23355 | switch(sqlite3UpperToLower[(u8)z[0]] ){ | 23723 | switch(sqlite3UpperToLower[(u8)z[0]] ){ |
| 23724 | case 'a': { | ||
| 23725 | /* | ||
| 23726 | ** auto | ||
| 23727 | ** | ||
| 23728 | ** If rawS is available, then interpret as a julian day number, or | ||
| 23729 | ** a unix timestamp, depending on its magnitude. | ||
| 23730 | */ | ||
| 23731 | if( sqlite3_stricmp(z, "auto")==0 ){ | ||
| 23732 | if( idx>1 ) return 1; /* IMP: R-33611-57934 */ | ||
| 23733 | if( !p->rawS || p->validJD ){ | ||
| 23734 | rc = 0; | ||
| 23735 | p->rawS = 0; | ||
| 23736 | }else if( p->s>=-21086676*(i64)10000 /* -4713-11-24 12:00:00 */ | ||
| 23737 | && p->s<=(25340230*(i64)10000)+799 /* 9999-12-31 23:59:59 */ | ||
| 23738 | ){ | ||
| 23739 | r = p->s*1000.0 + 210866760000000.0; | ||
| 23740 | clearYMD_HMS_TZ(p); | ||
| 23741 | p->iJD = (sqlite3_int64)(r + 0.5); | ||
| 23742 | p->validJD = 1; | ||
| 23743 | p->rawS = 0; | ||
| 23744 | rc = 0; | ||
| 23745 | } | ||
| 23746 | } | ||
| 23747 | break; | ||
| 23748 | } | ||
| 23749 | case 'j': { | ||
| 23750 | /* | ||
| 23751 | ** julianday | ||
| 23752 | ** | ||
| 23753 | ** Always interpret the prior number as a julian-day value. If this | ||
| 23754 | ** is not the first modifier, or if the prior argument is not a numeric | ||
| 23755 | ** value in the allowed range of julian day numbers understood by | ||
| 23756 | ** SQLite (0..5373484.5) then the result will be NULL. | ||
| 23757 | */ | ||
| 23758 | if( sqlite3_stricmp(z, "julianday")==0 ){ | ||
| 23759 | if( idx>1 ) return 1; /* IMP: R-31176-64601 */ | ||
| 23760 | if( p->validJD && p->rawS ){ | ||
| 23761 | rc = 0; | ||
| 23762 | p->rawS = 0; | ||
| 23763 | } | ||
| 23764 | } | ||
| 23765 | break; | ||
| 23766 | } | ||
| 23356 | #ifndef SQLITE_OMIT_LOCALTIME | 23767 | #ifndef SQLITE_OMIT_LOCALTIME |
| 23357 | case 'l': { | 23768 | case 'l': { |
| 23358 | /* localtime | 23769 | /* localtime |
| @@ -23361,9 +23772,7 @@ static int parseModifier( | |||
| 23361 | ** show local time. | 23772 | ** show local time. |
| 23362 | */ | 23773 | */ |
| 23363 | if( sqlite3_stricmp(z, "localtime")==0 && sqlite3NotPureFunc(pCtx) ){ | 23774 | if( sqlite3_stricmp(z, "localtime")==0 && sqlite3NotPureFunc(pCtx) ){ |
| 23364 | computeJD(p); | 23775 | rc = toLocaltime(p, pCtx); |
| 23365 | p->iJD += localtimeOffset(p, pCtx, &rc); | ||
| 23366 | clearYMD_HMS_TZ(p); | ||
| 23367 | } | 23776 | } |
| 23368 | break; | 23777 | break; |
| 23369 | } | 23778 | } |
| @@ -23376,6 +23785,7 @@ static int parseModifier( | |||
| 23376 | ** seconds since 1970. Convert to a real julian day number. | 23785 | ** seconds since 1970. Convert to a real julian day number. |
| 23377 | */ | 23786 | */ |
| 23378 | if( sqlite3_stricmp(z, "unixepoch")==0 && p->rawS ){ | 23787 | if( sqlite3_stricmp(z, "unixepoch")==0 && p->rawS ){ |
| 23788 | if( idx>1 ) return 1; /* IMP: R-49255-55373 */ | ||
| 23379 | r = p->s*1000.0 + 210866760000000.0; | 23789 | r = p->s*1000.0 + 210866760000000.0; |
| 23380 | if( r>=0.0 && r<464269060800000.0 ){ | 23790 | if( r>=0.0 && r<464269060800000.0 ){ |
| 23381 | clearYMD_HMS_TZ(p); | 23791 | clearYMD_HMS_TZ(p); |
| @@ -23388,18 +23798,31 @@ static int parseModifier( | |||
| 23388 | #ifndef SQLITE_OMIT_LOCALTIME | 23798 | #ifndef SQLITE_OMIT_LOCALTIME |
| 23389 | else if( sqlite3_stricmp(z, "utc")==0 && sqlite3NotPureFunc(pCtx) ){ | 23799 | else if( sqlite3_stricmp(z, "utc")==0 && sqlite3NotPureFunc(pCtx) ){ |
| 23390 | if( p->tzSet==0 ){ | 23800 | if( p->tzSet==0 ){ |
| 23391 | sqlite3_int64 c1; | 23801 | i64 iOrigJD; /* Original localtime */ |
| 23802 | i64 iGuess; /* Guess at the corresponding utc time */ | ||
| 23803 | int cnt = 0; /* Safety to prevent infinite loop */ | ||
| 23804 | int iErr; /* Guess is off by this much */ | ||
| 23805 | |||
| 23392 | computeJD(p); | 23806 | computeJD(p); |
| 23393 | c1 = localtimeOffset(p, pCtx, &rc); | 23807 | iGuess = iOrigJD = p->iJD; |
| 23394 | if( rc==SQLITE_OK ){ | 23808 | iErr = 0; |
| 23395 | p->iJD -= c1; | 23809 | do{ |
| 23396 | clearYMD_HMS_TZ(p); | 23810 | DateTime new; |
| 23397 | p->iJD += c1 - localtimeOffset(p, pCtx, &rc); | 23811 | memset(&new, 0, sizeof(new)); |
| 23398 | } | 23812 | iGuess -= iErr; |
| 23813 | new.iJD = iGuess; | ||
| 23814 | new.validJD = 1; | ||
| 23815 | rc = toLocaltime(&new, pCtx); | ||
| 23816 | if( rc ) return rc; | ||
| 23817 | computeJD(&new); | ||
| 23818 | iErr = new.iJD - iOrigJD; | ||
| 23819 | }while( iErr && cnt++<3 ); | ||
| 23820 | memset(p, 0, sizeof(*p)); | ||
| 23821 | p->iJD = iGuess; | ||
| 23822 | p->validJD = 1; | ||
| 23399 | p->tzSet = 1; | 23823 | p->tzSet = 1; |
| 23400 | }else{ | ||
| 23401 | rc = SQLITE_OK; | ||
| 23402 | } | 23824 | } |
| 23825 | rc = SQLITE_OK; | ||
| 23403 | } | 23826 | } |
| 23404 | #endif | 23827 | #endif |
| 23405 | break; | 23828 | break; |
| @@ -23515,9 +23938,10 @@ static int parseModifier( | |||
| 23515 | && sqlite3_strnicmp(aXformType[i].zName, z, n)==0 | 23938 | && sqlite3_strnicmp(aXformType[i].zName, z, n)==0 |
| 23516 | && r>-aXformType[i].rLimit && r<aXformType[i].rLimit | 23939 | && r>-aXformType[i].rLimit && r<aXformType[i].rLimit |
| 23517 | ){ | 23940 | ){ |
| 23518 | switch( aXformType[i].eType ){ | 23941 | switch( i ){ |
| 23519 | case 1: { /* Special processing to add months */ | 23942 | case 4: { /* Special processing to add months */ |
| 23520 | int x; | 23943 | int x; |
| 23944 | assert( strcmp(aXformType[i].zName,"month")==0 ); | ||
| 23521 | computeYMD_HMS(p); | 23945 | computeYMD_HMS(p); |
| 23522 | p->M += (int)r; | 23946 | p->M += (int)r; |
| 23523 | x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12; | 23947 | x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12; |
| @@ -23527,8 +23951,9 @@ static int parseModifier( | |||
| 23527 | r -= (int)r; | 23951 | r -= (int)r; |
| 23528 | break; | 23952 | break; |
| 23529 | } | 23953 | } |
| 23530 | case 2: { /* Special processing to add years */ | 23954 | case 5: { /* Special processing to add years */ |
| 23531 | int y = (int)r; | 23955 | int y = (int)r; |
| 23956 | assert( strcmp(aXformType[i].zName,"year")==0 ); | ||
| 23532 | computeYMD_HMS(p); | 23957 | computeYMD_HMS(p); |
| 23533 | p->Y += y; | 23958 | p->Y += y; |
| 23534 | p->validJD = 0; | 23959 | p->validJD = 0; |
| @@ -23537,7 +23962,7 @@ static int parseModifier( | |||
| 23537 | } | 23962 | } |
| 23538 | } | 23963 | } |
| 23539 | computeJD(p); | 23964 | computeJD(p); |
| 23540 | p->iJD += (sqlite3_int64)(r*aXformType[i].rXform + rRounder); | 23965 | p->iJD += (sqlite3_int64)(r*1000.0*aXformType[i].rXform + rRounder); |
| 23541 | rc = 0; | 23966 | rc = 0; |
| 23542 | break; | 23967 | break; |
| 23543 | } | 23968 | } |
| @@ -23587,7 +24012,7 @@ static int isDate( | |||
| 23587 | for(i=1; i<argc; i++){ | 24012 | for(i=1; i<argc; i++){ |
| 23588 | z = sqlite3_value_text(argv[i]); | 24013 | z = sqlite3_value_text(argv[i]); |
| 23589 | n = sqlite3_value_bytes(argv[i]); | 24014 | n = sqlite3_value_bytes(argv[i]); |
| 23590 | if( z==0 || parseModifier(context, (char*)z, n, p) ) return 1; | 24015 | if( z==0 || parseModifier(context, (char*)z, n, p, i) ) return 1; |
| 23591 | } | 24016 | } |
| 23592 | computeJD(p); | 24017 | computeJD(p); |
| 23593 | if( p->isError || !validJulianDay(p->iJD) ) return 1; | 24018 | if( p->isError || !validJulianDay(p->iJD) ) return 1; |
| @@ -23618,6 +24043,24 @@ static void juliandayFunc( | |||
| 23618 | } | 24043 | } |
| 23619 | 24044 | ||
| 23620 | /* | 24045 | /* |
| 24046 | ** unixepoch( TIMESTRING, MOD, MOD, ...) | ||
| 24047 | ** | ||
| 24048 | ** Return the number of seconds (including fractional seconds) since | ||
| 24049 | ** the unix epoch of 1970-01-01 00:00:00 GMT. | ||
| 24050 | */ | ||
| 24051 | static void unixepochFunc( | ||
| 24052 | sqlite3_context *context, | ||
| 24053 | int argc, | ||
| 24054 | sqlite3_value **argv | ||
| 24055 | ){ | ||
| 24056 | DateTime x; | ||
| 24057 | if( isDate(context, argc, argv, &x)==0 ){ | ||
| 24058 | computeJD(&x); | ||
| 24059 | sqlite3_result_int64(context, x.iJD/1000 - 21086676*(i64)10000); | ||
| 24060 | } | ||
| 24061 | } | ||
| 24062 | |||
| 24063 | /* | ||
| 23621 | ** datetime( TIMESTRING, MOD, MOD, ...) | 24064 | ** datetime( TIMESTRING, MOD, MOD, ...) |
| 23622 | ** | 24065 | ** |
| 23623 | ** Return YYYY-MM-DD HH:MM:SS | 24066 | ** Return YYYY-MM-DD HH:MM:SS |
| @@ -23629,11 +24072,38 @@ static void datetimeFunc( | |||
| 23629 | ){ | 24072 | ){ |
| 23630 | DateTime x; | 24073 | DateTime x; |
| 23631 | if( isDate(context, argc, argv, &x)==0 ){ | 24074 | if( isDate(context, argc, argv, &x)==0 ){ |
| 23632 | char zBuf[100]; | 24075 | int Y, s; |
| 24076 | char zBuf[24]; | ||
| 23633 | computeYMD_HMS(&x); | 24077 | computeYMD_HMS(&x); |
| 23634 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%04d-%02d-%02d %02d:%02d:%02d", | 24078 | Y = x.Y; |
| 23635 | x.Y, x.M, x.D, x.h, x.m, (int)(x.s)); | 24079 | if( Y<0 ) Y = -Y; |
| 23636 | sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); | 24080 | zBuf[1] = '0' + (Y/1000)%10; |
| 24081 | zBuf[2] = '0' + (Y/100)%10; | ||
| 24082 | zBuf[3] = '0' + (Y/10)%10; | ||
| 24083 | zBuf[4] = '0' + (Y)%10; | ||
| 24084 | zBuf[5] = '-'; | ||
| 24085 | zBuf[6] = '0' + (x.M/10)%10; | ||
| 24086 | zBuf[7] = '0' + (x.M)%10; | ||
| 24087 | zBuf[8] = '-'; | ||
| 24088 | zBuf[9] = '0' + (x.D/10)%10; | ||
| 24089 | zBuf[10] = '0' + (x.D)%10; | ||
| 24090 | zBuf[11] = ' '; | ||
| 24091 | zBuf[12] = '0' + (x.h/10)%10; | ||
| 24092 | zBuf[13] = '0' + (x.h)%10; | ||
| 24093 | zBuf[14] = ':'; | ||
| 24094 | zBuf[15] = '0' + (x.m/10)%10; | ||
| 24095 | zBuf[16] = '0' + (x.m)%10; | ||
| 24096 | zBuf[17] = ':'; | ||
| 24097 | s = (int)x.s; | ||
| 24098 | zBuf[18] = '0' + (s/10)%10; | ||
| 24099 | zBuf[19] = '0' + (s)%10; | ||
| 24100 | zBuf[20] = 0; | ||
| 24101 | if( x.Y<0 ){ | ||
| 24102 | zBuf[0] = '-'; | ||
| 24103 | sqlite3_result_text(context, zBuf, 20, SQLITE_TRANSIENT); | ||
| 24104 | }else{ | ||
| 24105 | sqlite3_result_text(context, &zBuf[1], 19, SQLITE_TRANSIENT); | ||
| 24106 | } | ||
| 23637 | } | 24107 | } |
| 23638 | } | 24108 | } |
| 23639 | 24109 | ||
| @@ -23649,10 +24119,20 @@ static void timeFunc( | |||
| 23649 | ){ | 24119 | ){ |
| 23650 | DateTime x; | 24120 | DateTime x; |
| 23651 | if( isDate(context, argc, argv, &x)==0 ){ | 24121 | if( isDate(context, argc, argv, &x)==0 ){ |
| 23652 | char zBuf[100]; | 24122 | int s; |
| 24123 | char zBuf[16]; | ||
| 23653 | computeHMS(&x); | 24124 | computeHMS(&x); |
| 23654 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%02d:%02d:%02d", x.h, x.m, (int)x.s); | 24125 | zBuf[0] = '0' + (x.h/10)%10; |
| 23655 | sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); | 24126 | zBuf[1] = '0' + (x.h)%10; |
| 24127 | zBuf[2] = ':'; | ||
| 24128 | zBuf[3] = '0' + (x.m/10)%10; | ||
| 24129 | zBuf[4] = '0' + (x.m)%10; | ||
| 24130 | zBuf[5] = ':'; | ||
| 24131 | s = (int)x.s; | ||
| 24132 | zBuf[6] = '0' + (s/10)%10; | ||
| 24133 | zBuf[7] = '0' + (s)%10; | ||
| 24134 | zBuf[8] = 0; | ||
| 24135 | sqlite3_result_text(context, zBuf, 8, SQLITE_TRANSIENT); | ||
| 23656 | } | 24136 | } |
| 23657 | } | 24137 | } |
| 23658 | 24138 | ||
| @@ -23668,10 +24148,28 @@ static void dateFunc( | |||
| 23668 | ){ | 24148 | ){ |
| 23669 | DateTime x; | 24149 | DateTime x; |
| 23670 | if( isDate(context, argc, argv, &x)==0 ){ | 24150 | if( isDate(context, argc, argv, &x)==0 ){ |
| 23671 | char zBuf[100]; | 24151 | int Y; |
| 24152 | char zBuf[16]; | ||
| 23672 | computeYMD(&x); | 24153 | computeYMD(&x); |
| 23673 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%04d-%02d-%02d", x.Y, x.M, x.D); | 24154 | Y = x.Y; |
| 23674 | sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); | 24155 | if( Y<0 ) Y = -Y; |
| 24156 | zBuf[1] = '0' + (Y/1000)%10; | ||
| 24157 | zBuf[2] = '0' + (Y/100)%10; | ||
| 24158 | zBuf[3] = '0' + (Y/10)%10; | ||
| 24159 | zBuf[4] = '0' + (Y)%10; | ||
| 24160 | zBuf[5] = '-'; | ||
| 24161 | zBuf[6] = '0' + (x.M/10)%10; | ||
| 24162 | zBuf[7] = '0' + (x.M)%10; | ||
| 24163 | zBuf[8] = '-'; | ||
| 24164 | zBuf[9] = '0' + (x.D/10)%10; | ||
| 24165 | zBuf[10] = '0' + (x.D)%10; | ||
| 24166 | zBuf[11] = 0; | ||
| 24167 | if( x.Y<0 ){ | ||
| 24168 | zBuf[0] = '-'; | ||
| 24169 | sqlite3_result_text(context, zBuf, 11, SQLITE_TRANSIENT); | ||
| 24170 | }else{ | ||
| 24171 | sqlite3_result_text(context, &zBuf[1], 10, SQLITE_TRANSIENT); | ||
| 24172 | } | ||
| 23675 | } | 24173 | } |
| 23676 | } | 24174 | } |
| 23677 | 24175 | ||
| @@ -23893,6 +24391,7 @@ SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){ | |||
| 23893 | static FuncDef aDateTimeFuncs[] = { | 24391 | static FuncDef aDateTimeFuncs[] = { |
| 23894 | #ifndef SQLITE_OMIT_DATETIME_FUNCS | 24392 | #ifndef SQLITE_OMIT_DATETIME_FUNCS |
| 23895 | PURE_DATE(julianday, -1, 0, 0, juliandayFunc ), | 24393 | PURE_DATE(julianday, -1, 0, 0, juliandayFunc ), |
| 24394 | PURE_DATE(unixepoch, -1, 0, 0, unixepochFunc ), | ||
| 23896 | PURE_DATE(date, -1, 0, 0, dateFunc ), | 24395 | PURE_DATE(date, -1, 0, 0, dateFunc ), |
| 23897 | PURE_DATE(time, -1, 0, 0, timeFunc ), | 24396 | PURE_DATE(time, -1, 0, 0, timeFunc ), |
| 23898 | PURE_DATE(datetime, -1, 0, 0, datetimeFunc ), | 24397 | PURE_DATE(datetime, -1, 0, 0, datetimeFunc ), |
| @@ -28838,8 +29337,15 @@ SQLITE_PRIVATE void sqlite3SetString(char **pz, sqlite3 *db, const char *zNew){ | |||
| 28838 | ** has happened. This routine will set db->mallocFailed, and also | 29337 | ** has happened. This routine will set db->mallocFailed, and also |
| 28839 | ** temporarily disable the lookaside memory allocator and interrupt | 29338 | ** temporarily disable the lookaside memory allocator and interrupt |
| 28840 | ** any running VDBEs. | 29339 | ** any running VDBEs. |
| 29340 | ** | ||
| 29341 | ** Always return a NULL pointer so that this routine can be invoked using | ||
| 29342 | ** | ||
| 29343 | ** return sqlite3OomFault(db); | ||
| 29344 | ** | ||
| 29345 | ** and thereby avoid unnecessary stack frame allocations for the overwhelmingly | ||
| 29346 | ** common case where no OOM occurs. | ||
| 28841 | */ | 29347 | */ |
| 28842 | SQLITE_PRIVATE void sqlite3OomFault(sqlite3 *db){ | 29348 | SQLITE_PRIVATE void *sqlite3OomFault(sqlite3 *db){ |
| 28843 | if( db->mallocFailed==0 && db->bBenignMalloc==0 ){ | 29349 | if( db->mallocFailed==0 && db->bBenignMalloc==0 ){ |
| 28844 | db->mallocFailed = 1; | 29350 | db->mallocFailed = 1; |
| 28845 | if( db->nVdbeExec>0 ){ | 29351 | if( db->nVdbeExec>0 ){ |
| @@ -28847,9 +29353,11 @@ SQLITE_PRIVATE void sqlite3OomFault(sqlite3 *db){ | |||
| 28847 | } | 29353 | } |
| 28848 | DisableLookaside; | 29354 | DisableLookaside; |
| 28849 | if( db->pParse ){ | 29355 | if( db->pParse ){ |
| 29356 | sqlite3ErrorMsg(db->pParse, "out of memory"); | ||
| 28850 | db->pParse->rc = SQLITE_NOMEM_BKPT; | 29357 | db->pParse->rc = SQLITE_NOMEM_BKPT; |
| 28851 | } | 29358 | } |
| 28852 | } | 29359 | } |
| 29360 | return 0; | ||
| 28853 | } | 29361 | } |
| 28854 | 29362 | ||
| 28855 | /* | 29363 | /* |
| @@ -29758,12 +30266,22 @@ SQLITE_API void sqlite3_str_vappendf( | |||
| 29758 | goto adjust_width_for_utf8; | 30266 | goto adjust_width_for_utf8; |
| 29759 | } | 30267 | } |
| 29760 | case etTOKEN: { | 30268 | case etTOKEN: { |
| 29761 | Token *pToken; | ||
| 29762 | if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return; | 30269 | if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return; |
| 29763 | pToken = va_arg(ap, Token*); | 30270 | if( flag_alternateform ){ |
| 29764 | assert( bArgList==0 ); | 30271 | /* %#T means an Expr pointer that uses Expr.u.zToken */ |
| 29765 | if( pToken && pToken->n ){ | 30272 | Expr *pExpr = va_arg(ap,Expr*); |
| 29766 | sqlite3_str_append(pAccum, (const char*)pToken->z, pToken->n); | 30273 | if( ALWAYS(pExpr) && ALWAYS(!ExprHasProperty(pExpr,EP_IntValue)) ){ |
| 30274 | sqlite3_str_appendall(pAccum, (const char*)pExpr->u.zToken); | ||
| 30275 | sqlite3RecordErrorOffsetOfExpr(pAccum->db, pExpr); | ||
| 30276 | } | ||
| 30277 | }else{ | ||
| 30278 | /* %T means a Token pointer */ | ||
| 30279 | Token *pToken = va_arg(ap, Token*); | ||
| 30280 | assert( bArgList==0 ); | ||
| 30281 | if( pToken && pToken->n ){ | ||
| 30282 | sqlite3_str_append(pAccum, (const char*)pToken->z, pToken->n); | ||
| 30283 | sqlite3RecordErrorByteOffset(pAccum->db, pToken->z); | ||
| 30284 | } | ||
| 29767 | } | 30285 | } |
| 29768 | length = width = 0; | 30286 | length = width = 0; |
| 29769 | break; | 30287 | break; |
| @@ -29818,6 +30336,42 @@ SQLITE_API void sqlite3_str_vappendf( | |||
| 29818 | }/* End for loop over the format string */ | 30336 | }/* End for loop over the format string */ |
| 29819 | } /* End of function */ | 30337 | } /* End of function */ |
| 29820 | 30338 | ||
| 30339 | |||
| 30340 | /* | ||
| 30341 | ** The z string points to the first character of a token that is | ||
| 30342 | ** associated with an error. If db does not already have an error | ||
| 30343 | ** byte offset recorded, try to compute the error byte offset for | ||
| 30344 | ** z and set the error byte offset in db. | ||
| 30345 | */ | ||
| 30346 | SQLITE_PRIVATE void sqlite3RecordErrorByteOffset(sqlite3 *db, const char *z){ | ||
| 30347 | const Parse *pParse; | ||
| 30348 | const char *zText; | ||
| 30349 | const char *zEnd; | ||
| 30350 | assert( z!=0 ); | ||
| 30351 | if( NEVER(db==0) ) return; | ||
| 30352 | if( db->errByteOffset!=(-2) ) return; | ||
| 30353 | pParse = db->pParse; | ||
| 30354 | if( NEVER(pParse==0) ) return; | ||
| 30355 | zText =pParse->zTail; | ||
| 30356 | if( NEVER(zText==0) ) return; | ||
| 30357 | zEnd = &zText[strlen(zText)]; | ||
| 30358 | if( SQLITE_WITHIN(z,zText,zEnd) ){ | ||
| 30359 | db->errByteOffset = (int)(z-zText); | ||
| 30360 | } | ||
| 30361 | } | ||
| 30362 | |||
| 30363 | /* | ||
| 30364 | ** If pExpr has a byte offset for the start of a token, record that as | ||
| 30365 | ** as the error offset. | ||
| 30366 | */ | ||
| 30367 | SQLITE_PRIVATE void sqlite3RecordErrorOffsetOfExpr(sqlite3 *db, const Expr *pExpr){ | ||
| 30368 | while( pExpr && (ExprHasProperty(pExpr,EP_FromJoin) || pExpr->w.iOfst<=0) ){ | ||
| 30369 | pExpr = pExpr->pLeft; | ||
| 30370 | } | ||
| 30371 | if( pExpr==0 ) return; | ||
| 30372 | db->errByteOffset = pExpr->w.iOfst; | ||
| 30373 | } | ||
| 30374 | |||
| 29821 | /* | 30375 | /* |
| 29822 | ** Enlarge the memory allocation on a StrAccum object so that it is | 30376 | ** Enlarge the memory allocation on a StrAccum object so that it is |
| 29823 | ** able to accept at least N more bytes of text. | 30377 | ** able to accept at least N more bytes of text. |
| @@ -29825,7 +30379,7 @@ SQLITE_API void sqlite3_str_vappendf( | |||
| 29825 | ** Return the number of bytes of text that StrAccum is able to accept | 30379 | ** Return the number of bytes of text that StrAccum is able to accept |
| 29826 | ** after the attempted enlargement. The value returned might be zero. | 30380 | ** after the attempted enlargement. The value returned might be zero. |
| 29827 | */ | 30381 | */ |
| 29828 | static int sqlite3StrAccumEnlarge(StrAccum *p, int N){ | 30382 | SQLITE_PRIVATE int sqlite3StrAccumEnlarge(StrAccum *p, int N){ |
| 29829 | char *zNew; | 30383 | char *zNew; |
| 29830 | assert( p->nChar+(i64)N >= p->nAlloc ); /* Only called if really needed */ | 30384 | assert( p->nChar+(i64)N >= p->nAlloc ); /* Only called if really needed */ |
| 29831 | if( p->accError ){ | 30385 | if( p->accError ){ |
| @@ -30659,7 +31213,7 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m | |||
| 30659 | sqlite3_str_appendf(&x, " fg.af=%x.%c", | 31213 | sqlite3_str_appendf(&x, " fg.af=%x.%c", |
| 30660 | pExpr->flags, pExpr->affExpr ? pExpr->affExpr : 'n'); | 31214 | pExpr->flags, pExpr->affExpr ? pExpr->affExpr : 'n'); |
| 30661 | if( ExprHasProperty(pExpr, EP_FromJoin) ){ | 31215 | if( ExprHasProperty(pExpr, EP_FromJoin) ){ |
| 30662 | sqlite3_str_appendf(&x, " iRJT=%d", pExpr->iRightJoinTable); | 31216 | sqlite3_str_appendf(&x, " iRJT=%d", pExpr->w.iRightJoinTable); |
| 30663 | } | 31217 | } |
| 30664 | if( ExprHasProperty(pExpr, EP_FromDDL) ){ | 31218 | if( ExprHasProperty(pExpr, EP_FromDDL) ){ |
| 30665 | sqlite3_str_appendf(&x, " DDL"); | 31219 | sqlite3_str_appendf(&x, " DDL"); |
| @@ -32141,7 +32695,11 @@ static SQLITE_NOINLINE void sqlite3ErrorFinish(sqlite3 *db, int err_code){ | |||
| 32141 | SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){ | 32695 | SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){ |
| 32142 | assert( db!=0 ); | 32696 | assert( db!=0 ); |
| 32143 | db->errCode = err_code; | 32697 | db->errCode = err_code; |
| 32144 | if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code); | 32698 | if( err_code || db->pErr ){ |
| 32699 | sqlite3ErrorFinish(db, err_code); | ||
| 32700 | }else{ | ||
| 32701 | db->errByteOffset = -1; | ||
| 32702 | } | ||
| 32145 | } | 32703 | } |
| 32146 | 32704 | ||
| 32147 | /* | 32705 | /* |
| @@ -32151,6 +32709,7 @@ SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){ | |||
| 32151 | SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3 *db){ | 32709 | SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3 *db){ |
| 32152 | assert( db!=0 ); | 32710 | assert( db!=0 ); |
| 32153 | db->errCode = SQLITE_OK; | 32711 | db->errCode = SQLITE_OK; |
| 32712 | db->errByteOffset = -1; | ||
| 32154 | if( db->pErr ) sqlite3ValueSetNull(db->pErr); | 32713 | if( db->pErr ) sqlite3ValueSetNull(db->pErr); |
| 32155 | } | 32714 | } |
| 32156 | 32715 | ||
| @@ -32171,17 +32730,8 @@ SQLITE_PRIVATE void sqlite3SystemError(sqlite3 *db, int rc){ | |||
| 32171 | ** handle "db". The error code is set to "err_code". | 32730 | ** handle "db". The error code is set to "err_code". |
| 32172 | ** | 32731 | ** |
| 32173 | ** If it is not NULL, string zFormat specifies the format of the | 32732 | ** If it is not NULL, string zFormat specifies the format of the |
| 32174 | ** error string in the style of the printf functions: The following | 32733 | ** error string. zFormat and any string tokens that follow it are |
| 32175 | ** format characters are allowed: | 32734 | ** assumed to be encoded in UTF-8. |
| 32176 | ** | ||
| 32177 | ** %s Insert a string | ||
| 32178 | ** %z A string that should be freed after use | ||
| 32179 | ** %d Insert an integer | ||
| 32180 | ** %T Insert a token | ||
| 32181 | ** %S Insert the first element of a SrcList | ||
| 32182 | ** | ||
| 32183 | ** zFormat and any string tokens that follow it are assumed to be | ||
| 32184 | ** encoded in UTF-8. | ||
| 32185 | ** | 32735 | ** |
| 32186 | ** To clear the most recent error for sqlite handle "db", sqlite3Error | 32736 | ** To clear the most recent error for sqlite handle "db", sqlite3Error |
| 32187 | ** should be called with err_code set to SQLITE_OK and zFormat set | 32737 | ** should be called with err_code set to SQLITE_OK and zFormat set |
| @@ -32205,13 +32755,6 @@ SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3 *db, int err_code, const char *z | |||
| 32205 | 32755 | ||
| 32206 | /* | 32756 | /* |
| 32207 | ** Add an error message to pParse->zErrMsg and increment pParse->nErr. | 32757 | ** Add an error message to pParse->zErrMsg and increment pParse->nErr. |
| 32208 | ** The following formatting characters are allowed: | ||
| 32209 | ** | ||
| 32210 | ** %s Insert a string | ||
| 32211 | ** %z A string that should be freed after use | ||
| 32212 | ** %d Insert an integer | ||
| 32213 | ** %T Insert a token | ||
| 32214 | ** %S Insert the first element of a SrcList | ||
| 32215 | ** | 32758 | ** |
| 32216 | ** This function should be used to report any error that occurs while | 32759 | ** This function should be used to report any error that occurs while |
| 32217 | ** compiling an SQL statement (i.e. within sqlite3_prepare()). The | 32760 | ** compiling an SQL statement (i.e. within sqlite3_prepare()). The |
| @@ -32224,11 +32767,19 @@ SQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){ | |||
| 32224 | char *zMsg; | 32767 | char *zMsg; |
| 32225 | va_list ap; | 32768 | va_list ap; |
| 32226 | sqlite3 *db = pParse->db; | 32769 | sqlite3 *db = pParse->db; |
| 32770 | assert( db!=0 ); | ||
| 32771 | assert( db->pParse==pParse ); | ||
| 32772 | db->errByteOffset = -2; | ||
| 32227 | va_start(ap, zFormat); | 32773 | va_start(ap, zFormat); |
| 32228 | zMsg = sqlite3VMPrintf(db, zFormat, ap); | 32774 | zMsg = sqlite3VMPrintf(db, zFormat, ap); |
| 32229 | va_end(ap); | 32775 | va_end(ap); |
| 32776 | if( db->errByteOffset<-1 ) db->errByteOffset = -1; | ||
| 32230 | if( db->suppressErr ){ | 32777 | if( db->suppressErr ){ |
| 32231 | sqlite3DbFree(db, zMsg); | 32778 | sqlite3DbFree(db, zMsg); |
| 32779 | if( db->mallocFailed ){ | ||
| 32780 | pParse->nErr++; | ||
| 32781 | pParse->rc = SQLITE_NOMEM; | ||
| 32782 | } | ||
| 32232 | }else{ | 32783 | }else{ |
| 32233 | pParse->nErr++; | 32784 | pParse->nErr++; |
| 32234 | sqlite3DbFree(db, pParse->zErrMsg); | 32785 | sqlite3DbFree(db, pParse->zErrMsg); |
| @@ -33610,7 +34161,6 @@ SQLITE_PRIVATE LogEst sqlite3LogEst(u64 x){ | |||
| 33610 | return a[x&7] + y - 10; | 34161 | return a[x&7] + y - 10; |
| 33611 | } | 34162 | } |
| 33612 | 34163 | ||
| 33613 | #ifndef SQLITE_OMIT_VIRTUALTABLE | ||
| 33614 | /* | 34164 | /* |
| 33615 | ** Convert a double into a LogEst | 34165 | ** Convert a double into a LogEst |
| 33616 | ** In other words, compute an approximation for 10*log2(x). | 34166 | ** In other words, compute an approximation for 10*log2(x). |
| @@ -33625,16 +34175,9 @@ SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double x){ | |||
| 33625 | e = (a>>52) - 1022; | 34175 | e = (a>>52) - 1022; |
| 33626 | return e*10; | 34176 | return e*10; |
| 33627 | } | 34177 | } |
| 33628 | #endif /* SQLITE_OMIT_VIRTUALTABLE */ | ||
| 33629 | 34178 | ||
| 33630 | #if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \ | ||
| 33631 | defined(SQLITE_ENABLE_STAT4) || \ | ||
| 33632 | defined(SQLITE_EXPLAIN_ESTIMATED_ROWS) | ||
| 33633 | /* | 34179 | /* |
| 33634 | ** Convert a LogEst into an integer. | 34180 | ** Convert a LogEst into an integer. |
| 33635 | ** | ||
| 33636 | ** Note that this routine is only used when one or more of various | ||
| 33637 | ** non-standard compile-time options is enabled. | ||
| 33638 | */ | 34181 | */ |
| 33639 | SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst x){ | 34182 | SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst x){ |
| 33640 | u64 n; | 34183 | u64 n; |
| @@ -33642,17 +34185,9 @@ SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst x){ | |||
| 33642 | x /= 10; | 34185 | x /= 10; |
| 33643 | if( n>=5 ) n -= 2; | 34186 | if( n>=5 ) n -= 2; |
| 33644 | else if( n>=1 ) n -= 1; | 34187 | else if( n>=1 ) n -= 1; |
| 33645 | #if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \ | ||
| 33646 | defined(SQLITE_EXPLAIN_ESTIMATED_ROWS) | ||
| 33647 | if( x>60 ) return (u64)LARGEST_INT64; | 34188 | if( x>60 ) return (u64)LARGEST_INT64; |
| 33648 | #else | ||
| 33649 | /* If only SQLITE_ENABLE_STAT4 is on, then the largest input | ||
| 33650 | ** possible to this routine is 310, resulting in a maximum x of 31 */ | ||
| 33651 | assert( x<=60 ); | ||
| 33652 | #endif | ||
| 33653 | return x>=3 ? (n+8)<<(x-3) : (n+8)>>(3-x); | 34189 | return x>=3 ? (n+8)<<(x-3) : (n+8)>>(3-x); |
| 33654 | } | 34190 | } |
| 33655 | #endif /* defined SCANSTAT or STAT4 or ESTIMATED_ROWS */ | ||
| 33656 | 34191 | ||
| 33657 | /* | 34192 | /* |
| 33658 | ** Add a new name/number pair to a VList. This might require that the | 34193 | ** Add a new name/number pair to a VList. This might require that the |
| @@ -34106,45 +34641,45 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ | |||
| 34106 | /* 60 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"), | 34641 | /* 60 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"), |
| 34107 | /* 61 */ "IncrVacuum" OpHelp(""), | 34642 | /* 61 */ "IncrVacuum" OpHelp(""), |
| 34108 | /* 62 */ "VNext" OpHelp(""), | 34643 | /* 62 */ "VNext" OpHelp(""), |
| 34109 | /* 63 */ "Init" OpHelp("Start at P2"), | 34644 | /* 63 */ "Filter" OpHelp("if key(P3@P4) not in filter(P1) goto P2"), |
| 34110 | /* 64 */ "PureFunc" OpHelp("r[P3]=func(r[P2@NP])"), | 34645 | /* 64 */ "Init" OpHelp("Start at P2"), |
| 34111 | /* 65 */ "Function" OpHelp("r[P3]=func(r[P2@NP])"), | 34646 | /* 65 */ "PureFunc" OpHelp("r[P3]=func(r[P2@NP])"), |
| 34112 | /* 66 */ "Return" OpHelp(""), | 34647 | /* 66 */ "Function" OpHelp("r[P3]=func(r[P2@NP])"), |
| 34113 | /* 67 */ "EndCoroutine" OpHelp(""), | 34648 | /* 67 */ "Return" OpHelp(""), |
| 34114 | /* 68 */ "HaltIfNull" OpHelp("if r[P3]=null halt"), | 34649 | /* 68 */ "EndCoroutine" OpHelp(""), |
| 34115 | /* 69 */ "Halt" OpHelp(""), | 34650 | /* 69 */ "HaltIfNull" OpHelp("if r[P3]=null halt"), |
| 34116 | /* 70 */ "Integer" OpHelp("r[P2]=P1"), | 34651 | /* 70 */ "Halt" OpHelp(""), |
| 34117 | /* 71 */ "Int64" OpHelp("r[P2]=P4"), | 34652 | /* 71 */ "Integer" OpHelp("r[P2]=P1"), |
| 34118 | /* 72 */ "String" OpHelp("r[P2]='P4' (len=P1)"), | 34653 | /* 72 */ "Int64" OpHelp("r[P2]=P4"), |
| 34119 | /* 73 */ "Null" OpHelp("r[P2..P3]=NULL"), | 34654 | /* 73 */ "String" OpHelp("r[P2]='P4' (len=P1)"), |
| 34120 | /* 74 */ "SoftNull" OpHelp("r[P1]=NULL"), | 34655 | /* 74 */ "Null" OpHelp("r[P2..P3]=NULL"), |
| 34121 | /* 75 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), | 34656 | /* 75 */ "SoftNull" OpHelp("r[P1]=NULL"), |
| 34122 | /* 76 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), | 34657 | /* 76 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), |
| 34123 | /* 77 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), | 34658 | /* 77 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), |
| 34124 | /* 78 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), | 34659 | /* 78 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), |
| 34125 | /* 79 */ "SCopy" OpHelp("r[P2]=r[P1]"), | 34660 | /* 79 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), |
| 34126 | /* 80 */ "IntCopy" OpHelp("r[P2]=r[P1]"), | 34661 | /* 80 */ "SCopy" OpHelp("r[P2]=r[P1]"), |
| 34127 | /* 81 */ "ChngCntRow" OpHelp("output=r[P1]"), | 34662 | /* 81 */ "IntCopy" OpHelp("r[P2]=r[P1]"), |
| 34128 | /* 82 */ "ResultRow" OpHelp("output=r[P1@P2]"), | 34663 | /* 82 */ "FkCheck" OpHelp(""), |
| 34129 | /* 83 */ "CollSeq" OpHelp(""), | 34664 | /* 83 */ "ResultRow" OpHelp("output=r[P1@P2]"), |
| 34130 | /* 84 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), | 34665 | /* 84 */ "CollSeq" OpHelp(""), |
| 34131 | /* 85 */ "RealAffinity" OpHelp(""), | 34666 | /* 85 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), |
| 34132 | /* 86 */ "Cast" OpHelp("affinity(r[P1])"), | 34667 | /* 86 */ "RealAffinity" OpHelp(""), |
| 34133 | /* 87 */ "Permutation" OpHelp(""), | 34668 | /* 87 */ "Cast" OpHelp("affinity(r[P1])"), |
| 34134 | /* 88 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), | 34669 | /* 88 */ "Permutation" OpHelp(""), |
| 34135 | /* 89 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"), | 34670 | /* 89 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), |
| 34136 | /* 90 */ "ZeroOrNull" OpHelp("r[P2] = 0 OR NULL"), | 34671 | /* 90 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"), |
| 34137 | /* 91 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"), | 34672 | /* 91 */ "ZeroOrNull" OpHelp("r[P2] = 0 OR NULL"), |
| 34138 | /* 92 */ "Column" OpHelp("r[P3]=PX"), | 34673 | /* 92 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"), |
| 34139 | /* 93 */ "TypeCheck" OpHelp("typecheck(r[P1@P2])"), | 34674 | /* 93 */ "Column" OpHelp("r[P3]=PX"), |
| 34140 | /* 94 */ "Affinity" OpHelp("affinity(r[P1@P2])"), | 34675 | /* 94 */ "TypeCheck" OpHelp("typecheck(r[P1@P2])"), |
| 34141 | /* 95 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), | 34676 | /* 95 */ "Affinity" OpHelp("affinity(r[P1@P2])"), |
| 34142 | /* 96 */ "Count" OpHelp("r[P2]=count()"), | 34677 | /* 96 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), |
| 34143 | /* 97 */ "ReadCookie" OpHelp(""), | 34678 | /* 97 */ "Count" OpHelp("r[P2]=count()"), |
| 34144 | /* 98 */ "SetCookie" OpHelp(""), | 34679 | /* 98 */ "ReadCookie" OpHelp(""), |
| 34145 | /* 99 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), | 34680 | /* 99 */ "SetCookie" OpHelp(""), |
| 34146 | /* 100 */ "OpenRead" OpHelp("root=P2 iDb=P3"), | 34681 | /* 100 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), |
| 34147 | /* 101 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), | 34682 | /* 101 */ "OpenRead" OpHelp("root=P2 iDb=P3"), |
| 34148 | /* 102 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"), | 34683 | /* 102 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"), |
| 34149 | /* 103 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"), | 34684 | /* 103 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"), |
| 34150 | /* 104 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"), | 34685 | /* 104 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"), |
| @@ -34155,76 +34690,79 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ | |||
| 34155 | /* 109 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"), | 34690 | /* 109 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"), |
| 34156 | /* 110 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"), | 34691 | /* 110 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"), |
| 34157 | /* 111 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"), | 34692 | /* 111 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"), |
| 34158 | /* 112 */ "OpenDup" OpHelp(""), | 34693 | /* 112 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), |
| 34159 | /* 113 */ "BitNot" OpHelp("r[P2]= ~r[P1]"), | 34694 | /* 113 */ "OpenDup" OpHelp(""), |
| 34160 | /* 114 */ "OpenAutoindex" OpHelp("nColumn=P2"), | 34695 | /* 114 */ "BitNot" OpHelp("r[P2]= ~r[P1]"), |
| 34161 | /* 115 */ "OpenEphemeral" OpHelp("nColumn=P2"), | 34696 | /* 115 */ "OpenAutoindex" OpHelp("nColumn=P2"), |
| 34162 | /* 116 */ "String8" OpHelp("r[P2]='P4'"), | 34697 | /* 116 */ "OpenEphemeral" OpHelp("nColumn=P2"), |
| 34163 | /* 117 */ "SorterOpen" OpHelp(""), | 34698 | /* 117 */ "String8" OpHelp("r[P2]='P4'"), |
| 34164 | /* 118 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), | 34699 | /* 118 */ "SorterOpen" OpHelp(""), |
| 34165 | /* 119 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"), | 34700 | /* 119 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), |
| 34166 | /* 120 */ "Close" OpHelp(""), | 34701 | /* 120 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"), |
| 34167 | /* 121 */ "ColumnsUsed" OpHelp(""), | 34702 | /* 121 */ "Close" OpHelp(""), |
| 34168 | /* 122 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"), | 34703 | /* 122 */ "ColumnsUsed" OpHelp(""), |
| 34169 | /* 123 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"), | 34704 | /* 123 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"), |
| 34170 | /* 124 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), | 34705 | /* 124 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"), |
| 34171 | /* 125 */ "NewRowid" OpHelp("r[P2]=rowid"), | 34706 | /* 125 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), |
| 34172 | /* 126 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), | 34707 | /* 126 */ "NewRowid" OpHelp("r[P2]=rowid"), |
| 34173 | /* 127 */ "RowCell" OpHelp(""), | 34708 | /* 127 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), |
| 34174 | /* 128 */ "Delete" OpHelp(""), | 34709 | /* 128 */ "RowCell" OpHelp(""), |
| 34175 | /* 129 */ "ResetCount" OpHelp(""), | 34710 | /* 129 */ "Delete" OpHelp(""), |
| 34176 | /* 130 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), | 34711 | /* 130 */ "ResetCount" OpHelp(""), |
| 34177 | /* 131 */ "SorterData" OpHelp("r[P2]=data"), | 34712 | /* 131 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), |
| 34178 | /* 132 */ "RowData" OpHelp("r[P2]=data"), | 34713 | /* 132 */ "SorterData" OpHelp("r[P2]=data"), |
| 34179 | /* 133 */ "Rowid" OpHelp("r[P2]=rowid"), | 34714 | /* 133 */ "RowData" OpHelp("r[P2]=data"), |
| 34180 | /* 134 */ "NullRow" OpHelp(""), | 34715 | /* 134 */ "Rowid" OpHelp("r[P2]=rowid"), |
| 34181 | /* 135 */ "SeekEnd" OpHelp(""), | 34716 | /* 135 */ "NullRow" OpHelp(""), |
| 34182 | /* 136 */ "IdxInsert" OpHelp("key=r[P2]"), | 34717 | /* 136 */ "SeekEnd" OpHelp(""), |
| 34183 | /* 137 */ "SorterInsert" OpHelp("key=r[P2]"), | 34718 | /* 137 */ "IdxInsert" OpHelp("key=r[P2]"), |
| 34184 | /* 138 */ "IdxDelete" OpHelp("key=r[P2@P3]"), | 34719 | /* 138 */ "SorterInsert" OpHelp("key=r[P2]"), |
| 34185 | /* 139 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"), | 34720 | /* 139 */ "IdxDelete" OpHelp("key=r[P2@P3]"), |
| 34186 | /* 140 */ "IdxRowid" OpHelp("r[P2]=rowid"), | 34721 | /* 140 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"), |
| 34187 | /* 141 */ "FinishSeek" OpHelp(""), | 34722 | /* 141 */ "IdxRowid" OpHelp("r[P2]=rowid"), |
| 34188 | /* 142 */ "Destroy" OpHelp(""), | 34723 | /* 142 */ "FinishSeek" OpHelp(""), |
| 34189 | /* 143 */ "Clear" OpHelp(""), | 34724 | /* 143 */ "Destroy" OpHelp(""), |
| 34190 | /* 144 */ "ResetSorter" OpHelp(""), | 34725 | /* 144 */ "Clear" OpHelp(""), |
| 34191 | /* 145 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"), | 34726 | /* 145 */ "ResetSorter" OpHelp(""), |
| 34192 | /* 146 */ "SqlExec" OpHelp(""), | 34727 | /* 146 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"), |
| 34193 | /* 147 */ "ParseSchema" OpHelp(""), | 34728 | /* 147 */ "SqlExec" OpHelp(""), |
| 34194 | /* 148 */ "LoadAnalysis" OpHelp(""), | 34729 | /* 148 */ "ParseSchema" OpHelp(""), |
| 34195 | /* 149 */ "DropTable" OpHelp(""), | 34730 | /* 149 */ "LoadAnalysis" OpHelp(""), |
| 34196 | /* 150 */ "DropIndex" OpHelp(""), | 34731 | /* 150 */ "DropTable" OpHelp(""), |
| 34197 | /* 151 */ "DropTrigger" OpHelp(""), | 34732 | /* 151 */ "DropIndex" OpHelp(""), |
| 34198 | /* 152 */ "Real" OpHelp("r[P2]=P4"), | 34733 | /* 152 */ "DropTrigger" OpHelp(""), |
| 34199 | /* 153 */ "IntegrityCk" OpHelp(""), | 34734 | /* 153 */ "Real" OpHelp("r[P2]=P4"), |
| 34200 | /* 154 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), | 34735 | /* 154 */ "IntegrityCk" OpHelp(""), |
| 34201 | /* 155 */ "Param" OpHelp(""), | 34736 | /* 155 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), |
| 34202 | /* 156 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), | 34737 | /* 156 */ "Param" OpHelp(""), |
| 34203 | /* 157 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), | 34738 | /* 157 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), |
| 34204 | /* 158 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), | 34739 | /* 158 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), |
| 34205 | /* 159 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"), | 34740 | /* 159 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), |
| 34206 | /* 160 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), | 34741 | /* 160 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"), |
| 34207 | /* 161 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"), | 34742 | /* 161 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 34208 | /* 162 */ "AggValue" OpHelp("r[P3]=value N=P2"), | 34743 | /* 162 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 34209 | /* 163 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), | 34744 | /* 163 */ "AggValue" OpHelp("r[P3]=value N=P2"), |
| 34210 | /* 164 */ "Expire" OpHelp(""), | 34745 | /* 164 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), |
| 34211 | /* 165 */ "CursorLock" OpHelp(""), | 34746 | /* 165 */ "Expire" OpHelp(""), |
| 34212 | /* 166 */ "CursorUnlock" OpHelp(""), | 34747 | /* 166 */ "CursorLock" OpHelp(""), |
| 34213 | /* 167 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), | 34748 | /* 167 */ "CursorUnlock" OpHelp(""), |
| 34214 | /* 168 */ "VBegin" OpHelp(""), | 34749 | /* 168 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), |
| 34215 | /* 169 */ "VCreate" OpHelp(""), | 34750 | /* 169 */ "VBegin" OpHelp(""), |
| 34216 | /* 170 */ "VDestroy" OpHelp(""), | 34751 | /* 170 */ "VCreate" OpHelp(""), |
| 34217 | /* 171 */ "VOpen" OpHelp(""), | 34752 | /* 171 */ "VDestroy" OpHelp(""), |
| 34218 | /* 172 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), | 34753 | /* 172 */ "VOpen" OpHelp(""), |
| 34219 | /* 173 */ "VRename" OpHelp(""), | 34754 | /* 173 */ "VInitIn" OpHelp("r[P2]=ValueList(P1,P3)"), |
| 34220 | /* 174 */ "Pagecount" OpHelp(""), | 34755 | /* 174 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), |
| 34221 | /* 175 */ "MaxPgcnt" OpHelp(""), | 34756 | /* 175 */ "VRename" OpHelp(""), |
| 34222 | /* 176 */ "Trace" OpHelp(""), | 34757 | /* 176 */ "Pagecount" OpHelp(""), |
| 34223 | /* 177 */ "CursorHint" OpHelp(""), | 34758 | /* 177 */ "MaxPgcnt" OpHelp(""), |
| 34224 | /* 178 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"), | 34759 | /* 178 */ "FilterAdd" OpHelp("filter(P1) += key(P3@P4)"), |
| 34225 | /* 179 */ "Noop" OpHelp(""), | 34760 | /* 179 */ "Trace" OpHelp(""), |
| 34226 | /* 180 */ "Explain" OpHelp(""), | 34761 | /* 180 */ "CursorHint" OpHelp(""), |
| 34227 | /* 181 */ "Abortable" OpHelp(""), | 34762 | /* 181 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"), |
| 34763 | /* 182 */ "Noop" OpHelp(""), | ||
| 34764 | /* 183 */ "Explain" OpHelp(""), | ||
| 34765 | /* 184 */ "Abortable" OpHelp(""), | ||
| 34228 | }; | 34766 | }; |
| 34229 | return azName[i]; | 34767 | return azName[i]; |
| 34230 | } | 34768 | } |
| @@ -56557,8 +57095,7 @@ static int pager_wait_on_lock(Pager *pPager, int locktype){ | |||
| 56557 | ** current database image, in pages, OR | 57095 | ** current database image, in pages, OR |
| 56558 | ** | 57096 | ** |
| 56559 | ** b) if the page content were written at this time, it would not | 57097 | ** b) if the page content were written at this time, it would not |
| 56560 | ** be necessary to write the current content out to the sub-journal | 57098 | ** be necessary to write the current content out to the sub-journal. |
| 56561 | ** (as determined by function subjRequiresPage()). | ||
| 56562 | ** | 57099 | ** |
| 56563 | ** If the condition asserted by this function were not true, and the | 57100 | ** If the condition asserted by this function were not true, and the |
| 56564 | ** dirty page were to be discarded from the cache via the pagerStress() | 57101 | ** dirty page were to be discarded from the cache via the pagerStress() |
| @@ -56573,8 +57110,16 @@ static int pager_wait_on_lock(Pager *pPager, int locktype){ | |||
| 56573 | */ | 57110 | */ |
| 56574 | #if defined(SQLITE_DEBUG) | 57111 | #if defined(SQLITE_DEBUG) |
| 56575 | static void assertTruncateConstraintCb(PgHdr *pPg){ | 57112 | static void assertTruncateConstraintCb(PgHdr *pPg){ |
| 57113 | Pager *pPager = pPg->pPager; | ||
| 56576 | assert( pPg->flags&PGHDR_DIRTY ); | 57114 | assert( pPg->flags&PGHDR_DIRTY ); |
| 56577 | assert( !subjRequiresPage(pPg) || pPg->pgno<=pPg->pPager->dbSize ); | 57115 | if( pPg->pgno>pPager->dbSize ){ /* if (a) is false */ |
| 57116 | Pgno pgno = pPg->pgno; | ||
| 57117 | int i; | ||
| 57118 | for(i=0; i<pPg->pPager->nSavepoint; i++){ | ||
| 57119 | PagerSavepoint *p = &pPager->aSavepoint[i]; | ||
| 57120 | assert( p->nOrig<pgno || sqlite3BitvecTestNotNull(p->pInSavepoint,pgno) ); | ||
| 57121 | } | ||
| 57122 | } | ||
| 56578 | } | 57123 | } |
| 56579 | static void assertTruncateConstraint(Pager *pPager){ | 57124 | static void assertTruncateConstraint(Pager *pPager){ |
| 56580 | sqlite3PcacheIterateDirty(pPager->pPCache, assertTruncateConstraintCb); | 57125 | sqlite3PcacheIterateDirty(pPager->pPCache, assertTruncateConstraintCb); |
| @@ -56596,7 +57141,6 @@ static void assertTruncateConstraint(Pager *pPager){ | |||
| 56596 | */ | 57141 | */ |
| 56597 | SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){ | 57142 | SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){ |
| 56598 | assert( pPager->dbSize>=nPage || CORRUPT_DB ); | 57143 | assert( pPager->dbSize>=nPage || CORRUPT_DB ); |
| 56599 | testcase( pPager->dbSize<nPage ); | ||
| 56600 | assert( pPager->eState>=PAGER_WRITER_CACHEMOD ); | 57144 | assert( pPager->eState>=PAGER_WRITER_CACHEMOD ); |
| 56601 | pPager->dbSize = nPage; | 57145 | pPager->dbSize = nPage; |
| 56602 | 57146 | ||
| @@ -57915,7 +58459,7 @@ SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){ | |||
| 57915 | ** may mean that the pager was in the error-state when this | 58459 | ** may mean that the pager was in the error-state when this |
| 57916 | ** function was called and the journal file does not exist. | 58460 | ** function was called and the journal file does not exist. |
| 57917 | */ | 58461 | */ |
| 57918 | if( !isOpen(pPager->jfd) ){ | 58462 | if( !isOpen(pPager->jfd) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){ |
| 57919 | sqlite3_vfs * const pVfs = pPager->pVfs; | 58463 | sqlite3_vfs * const pVfs = pPager->pVfs; |
| 57920 | int bExists; /* True if journal file exists */ | 58464 | int bExists; /* True if journal file exists */ |
| 57921 | rc = sqlite3OsAccess( | 58465 | rc = sqlite3OsAccess( |
| @@ -58317,6 +58861,7 @@ SQLITE_PRIVATE int sqlite3PagerGet( | |||
| 58317 | DbPage **ppPage, /* Write a pointer to the page here */ | 58861 | DbPage **ppPage, /* Write a pointer to the page here */ |
| 58318 | int flags /* PAGER_GET_XXX flags */ | 58862 | int flags /* PAGER_GET_XXX flags */ |
| 58319 | ){ | 58863 | ){ |
| 58864 | /* printf("PAGE %u\n", pgno); fflush(stdout); */ | ||
| 58320 | return pPager->xGet(pPager, pgno, ppPage, flags); | 58865 | return pPager->xGet(pPager, pgno, ppPage, flags); |
| 58321 | } | 58866 | } |
| 58322 | 58867 | ||
| @@ -59922,12 +60467,12 @@ SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){ | |||
| 59922 | u8 eOld = pPager->journalMode; /* Prior journalmode */ | 60467 | u8 eOld = pPager->journalMode; /* Prior journalmode */ |
| 59923 | 60468 | ||
| 59924 | /* The eMode parameter is always valid */ | 60469 | /* The eMode parameter is always valid */ |
| 59925 | assert( eMode==PAGER_JOURNALMODE_DELETE | 60470 | assert( eMode==PAGER_JOURNALMODE_DELETE /* 0 */ |
| 59926 | || eMode==PAGER_JOURNALMODE_TRUNCATE | 60471 | || eMode==PAGER_JOURNALMODE_PERSIST /* 1 */ |
| 59927 | || eMode==PAGER_JOURNALMODE_PERSIST | 60472 | || eMode==PAGER_JOURNALMODE_OFF /* 2 */ |
| 59928 | || eMode==PAGER_JOURNALMODE_OFF | 60473 | || eMode==PAGER_JOURNALMODE_TRUNCATE /* 3 */ |
| 59929 | || eMode==PAGER_JOURNALMODE_WAL | 60474 | || eMode==PAGER_JOURNALMODE_MEMORY /* 4 */ |
| 59930 | || eMode==PAGER_JOURNALMODE_MEMORY ); | 60475 | || eMode==PAGER_JOURNALMODE_WAL /* 5 */ ); |
| 59931 | 60476 | ||
| 59932 | /* This routine is only called from the OP_JournalMode opcode, and | 60477 | /* This routine is only called from the OP_JournalMode opcode, and |
| 59933 | ** the logic there will never allow a temporary file to be changed | 60478 | ** the logic there will never allow a temporary file to be changed |
| @@ -59964,7 +60509,6 @@ SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){ | |||
| 59964 | 60509 | ||
| 59965 | assert( isOpen(pPager->fd) || pPager->exclusiveMode ); | 60510 | assert( isOpen(pPager->fd) || pPager->exclusiveMode ); |
| 59966 | if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){ | 60511 | if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){ |
| 59967 | |||
| 59968 | /* In this case we would like to delete the journal file. If it is | 60512 | /* In this case we would like to delete the journal file. If it is |
| 59969 | ** not possible, then that is not a problem. Deleting the journal file | 60513 | ** not possible, then that is not a problem. Deleting the journal file |
| 59970 | ** here is an optimization only. | 60514 | ** here is an optimization only. |
| @@ -60076,6 +60620,18 @@ SQLITE_PRIVATE int sqlite3PagerCheckpoint( | |||
| 60076 | int *pnCkpt /* OUT: Final number of checkpointed frames */ | 60620 | int *pnCkpt /* OUT: Final number of checkpointed frames */ |
| 60077 | ){ | 60621 | ){ |
| 60078 | int rc = SQLITE_OK; | 60622 | int rc = SQLITE_OK; |
| 60623 | if( pPager->pWal==0 && pPager->journalMode==PAGER_JOURNALMODE_WAL ){ | ||
| 60624 | /* This only happens when a database file is zero bytes in size opened and | ||
| 60625 | ** then "PRAGMA journal_mode=WAL" is run and then sqlite3_wal_checkpoint() | ||
| 60626 | ** is invoked without any intervening transactions. We need to start | ||
| 60627 | ** a transaction to initialize pWal. The PRAGMA table_list statement is | ||
| 60628 | ** used for this since it starts transactions on every database file, | ||
| 60629 | ** including all ATTACHed databases. This seems expensive for a single | ||
| 60630 | ** sqlite3_wal_checkpoint() call, but it happens very rarely. | ||
| 60631 | ** https://sqlite.org/forum/forumpost/fd0f19d229156939 | ||
| 60632 | */ | ||
| 60633 | sqlite3_exec(db, "PRAGMA table_list",0,0,0); | ||
| 60634 | } | ||
| 60079 | if( pPager->pWal ){ | 60635 | if( pPager->pWal ){ |
| 60080 | rc = sqlite3WalCheckpoint(pPager->pWal, db, eMode, | 60636 | rc = sqlite3WalCheckpoint(pPager->pWal, db, eMode, |
| 60081 | (eMode==SQLITE_CHECKPOINT_PASSIVE ? 0 : pPager->xBusyHandler), | 60637 | (eMode==SQLITE_CHECKPOINT_PASSIVE ? 0 : pPager->xBusyHandler), |
| @@ -62975,7 +63531,9 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){ | |||
| 62975 | } | 63531 | } |
| 62976 | 63532 | ||
| 62977 | /* Allocate a buffer to read frames into */ | 63533 | /* Allocate a buffer to read frames into */ |
| 62978 | szFrame = pWal->hdr.szPage + WAL_FRAME_HDRSIZE; | 63534 | assert( (pWal->szPage & (pWal->szPage-1))==0 ); |
| 63535 | assert( pWal->szPage>=512 && pWal->szPage<=65536 ); | ||
| 63536 | szFrame = pWal->szPage + WAL_FRAME_HDRSIZE; | ||
| 62979 | aFrame = (u8 *)sqlite3_malloc64(szFrame); | 63537 | aFrame = (u8 *)sqlite3_malloc64(szFrame); |
| 62980 | if( aFrame==0 ){ | 63538 | if( aFrame==0 ){ |
| 62981 | rc = SQLITE_NOMEM_BKPT; | 63539 | rc = SQLITE_NOMEM_BKPT; |
| @@ -62989,7 +63547,7 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){ | |||
| 62989 | ** the caller. */ | 63547 | ** the caller. */ |
| 62990 | aSaveCksum[0] = pWal->hdr.aFrameCksum[0]; | 63548 | aSaveCksum[0] = pWal->hdr.aFrameCksum[0]; |
| 62991 | aSaveCksum[1] = pWal->hdr.aFrameCksum[1]; | 63549 | aSaveCksum[1] = pWal->hdr.aFrameCksum[1]; |
| 62992 | for(iOffset=walFrameOffset(pWal->hdr.mxFrame+1, pWal->hdr.szPage); | 63550 | for(iOffset=walFrameOffset(pWal->hdr.mxFrame+1, pWal->szPage); |
| 62993 | iOffset+szFrame<=szWal; | 63551 | iOffset+szFrame<=szWal; |
| 62994 | iOffset+=szFrame | 63552 | iOffset+=szFrame |
| 62995 | ){ | 63553 | ){ |
| @@ -66797,18 +67355,32 @@ static void btreeParseCellPtr( | |||
| 66797 | ** | 67355 | ** |
| 66798 | ** pIter += getVarint(pIter, (u64*)&pInfo->nKey); | 67356 | ** pIter += getVarint(pIter, (u64*)&pInfo->nKey); |
| 66799 | ** | 67357 | ** |
| 66800 | ** The code is inlined to avoid a function call. | 67358 | ** The code is inlined and the loop is unrolled for performance. |
| 67359 | ** This routine is a high-runner. | ||
| 66801 | */ | 67360 | */ |
| 66802 | iKey = *pIter; | 67361 | iKey = *pIter; |
| 66803 | if( iKey>=0x80 ){ | 67362 | if( iKey>=0x80 ){ |
| 66804 | u8 *pEnd = &pIter[7]; | 67363 | u8 x; |
| 66805 | iKey &= 0x7f; | 67364 | iKey = ((iKey&0x7f)<<7) | ((x = *++pIter) & 0x7f); |
| 66806 | while(1){ | 67365 | if( x>=0x80 ){ |
| 66807 | iKey = (iKey<<7) | (*++pIter & 0x7f); | 67366 | iKey = (iKey<<7) | ((x =*++pIter) & 0x7f); |
| 66808 | if( (*pIter)<0x80 ) break; | 67367 | if( x>=0x80 ){ |
| 66809 | if( pIter>=pEnd ){ | 67368 | iKey = (iKey<<7) | ((x = *++pIter) & 0x7f); |
| 66810 | iKey = (iKey<<8) | *++pIter; | 67369 | if( x>=0x80 ){ |
| 66811 | break; | 67370 | iKey = (iKey<<7) | ((x = *++pIter) & 0x7f); |
| 67371 | if( x>=0x80 ){ | ||
| 67372 | iKey = (iKey<<7) | ((x = *++pIter) & 0x7f); | ||
| 67373 | if( x>=0x80 ){ | ||
| 67374 | iKey = (iKey<<7) | ((x = *++pIter) & 0x7f); | ||
| 67375 | if( x>=0x80 ){ | ||
| 67376 | iKey = (iKey<<7) | ((x = *++pIter) & 0x7f); | ||
| 67377 | if( x>=0x80 ){ | ||
| 67378 | iKey = (iKey<<8) | (*++pIter); | ||
| 67379 | } | ||
| 67380 | } | ||
| 67381 | } | ||
| 67382 | } | ||
| 67383 | } | ||
| 66812 | } | 67384 | } |
| 66813 | } | 67385 | } |
| 66814 | } | 67386 | } |
| @@ -66818,7 +67390,7 @@ static void btreeParseCellPtr( | |||
| 66818 | pInfo->nPayload = nPayload; | 67390 | pInfo->nPayload = nPayload; |
| 66819 | pInfo->pPayload = pIter; | 67391 | pInfo->pPayload = pIter; |
| 66820 | testcase( nPayload==pPage->maxLocal ); | 67392 | testcase( nPayload==pPage->maxLocal ); |
| 66821 | testcase( nPayload==pPage->maxLocal+1 ); | 67393 | testcase( nPayload==(u32)pPage->maxLocal+1 ); |
| 66822 | if( nPayload<=pPage->maxLocal ){ | 67394 | if( nPayload<=pPage->maxLocal ){ |
| 66823 | /* This is the (easy) common case where the entire payload fits | 67395 | /* This is the (easy) common case where the entire payload fits |
| 66824 | ** on the local page. No overflow is required. | 67396 | ** on the local page. No overflow is required. |
| @@ -66855,7 +67427,7 @@ static void btreeParseCellPtrIndex( | |||
| 66855 | pInfo->nPayload = nPayload; | 67427 | pInfo->nPayload = nPayload; |
| 66856 | pInfo->pPayload = pIter; | 67428 | pInfo->pPayload = pIter; |
| 66857 | testcase( nPayload==pPage->maxLocal ); | 67429 | testcase( nPayload==pPage->maxLocal ); |
| 66858 | testcase( nPayload==pPage->maxLocal+1 ); | 67430 | testcase( nPayload==(u32)pPage->maxLocal+1 ); |
| 66859 | if( nPayload<=pPage->maxLocal ){ | 67431 | if( nPayload<=pPage->maxLocal ){ |
| 66860 | /* This is the (easy) common case where the entire payload fits | 67432 | /* This is the (easy) common case where the entire payload fits |
| 66861 | ** on the local page. No overflow is required. | 67433 | ** on the local page. No overflow is required. |
| @@ -66918,7 +67490,7 @@ static u16 cellSizePtr(MemPage *pPage, u8 *pCell){ | |||
| 66918 | while( (*pIter++)&0x80 && pIter<pEnd ); | 67490 | while( (*pIter++)&0x80 && pIter<pEnd ); |
| 66919 | } | 67491 | } |
| 66920 | testcase( nSize==pPage->maxLocal ); | 67492 | testcase( nSize==pPage->maxLocal ); |
| 66921 | testcase( nSize==pPage->maxLocal+1 ); | 67493 | testcase( nSize==(u32)pPage->maxLocal+1 ); |
| 66922 | if( nSize<=pPage->maxLocal ){ | 67494 | if( nSize<=pPage->maxLocal ){ |
| 66923 | nSize += (u32)(pIter - pCell); | 67495 | nSize += (u32)(pIter - pCell); |
| 66924 | if( nSize<4 ) nSize = 4; | 67496 | if( nSize<4 ) nSize = 4; |
| @@ -66926,7 +67498,7 @@ static u16 cellSizePtr(MemPage *pPage, u8 *pCell){ | |||
| 66926 | int minLocal = pPage->minLocal; | 67498 | int minLocal = pPage->minLocal; |
| 66927 | nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4); | 67499 | nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4); |
| 66928 | testcase( nSize==pPage->maxLocal ); | 67500 | testcase( nSize==pPage->maxLocal ); |
| 66929 | testcase( nSize==pPage->maxLocal+1 ); | 67501 | testcase( nSize==(u32)pPage->maxLocal+1 ); |
| 66930 | if( nSize>pPage->maxLocal ){ | 67502 | if( nSize>pPage->maxLocal ){ |
| 66931 | nSize = minLocal; | 67503 | nSize = minLocal; |
| 66932 | } | 67504 | } |
| @@ -67340,7 +67912,7 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){ | |||
| 67340 | if( iFreeBlk>pPage->pBt->usableSize-4 ){ /* TH3: corrupt081.100 */ | 67912 | if( iFreeBlk>pPage->pBt->usableSize-4 ){ /* TH3: corrupt081.100 */ |
| 67341 | return SQLITE_CORRUPT_PAGE(pPage); | 67913 | return SQLITE_CORRUPT_PAGE(pPage); |
| 67342 | } | 67914 | } |
| 67343 | assert( iFreeBlk>iPtr || iFreeBlk==0 ); | 67915 | assert( iFreeBlk>iPtr || iFreeBlk==0 || CORRUPT_DB ); |
| 67344 | 67916 | ||
| 67345 | /* At this point: | 67917 | /* At this point: |
| 67346 | ** iFreeBlk: First freeblock after iStart, or zero if none | 67918 | ** iFreeBlk: First freeblock after iStart, or zero if none |
| @@ -68265,30 +68837,38 @@ static int removeFromSharingList(BtShared *pBt){ | |||
| 68265 | ** MX_CELL_SIZE(pBt) bytes with a 4-byte prefix for a left-child | 68837 | ** MX_CELL_SIZE(pBt) bytes with a 4-byte prefix for a left-child |
| 68266 | ** pointer. | 68838 | ** pointer. |
| 68267 | */ | 68839 | */ |
| 68268 | static void allocateTempSpace(BtShared *pBt){ | 68840 | static SQLITE_NOINLINE int allocateTempSpace(BtShared *pBt){ |
| 68269 | if( !pBt->pTmpSpace ){ | 68841 | assert( pBt!=0 ); |
| 68270 | pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize ); | 68842 | assert( pBt->pTmpSpace==0 ); |
| 68271 | 68843 | /* This routine is called only by btreeCursor() when allocating the | |
| 68272 | /* One of the uses of pBt->pTmpSpace is to format cells before | 68844 | ** first write cursor for the BtShared object */ |
| 68273 | ** inserting them into a leaf page (function fillInCell()). If | 68845 | assert( pBt->pCursor!=0 && (pBt->pCursor->curFlags & BTCF_WriteFlag)!=0 ); |
| 68274 | ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes | 68846 | pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize ); |
| 68275 | ** by the various routines that manipulate binary cells. Which | 68847 | if( pBt->pTmpSpace==0 ){ |
| 68276 | ** can mean that fillInCell() only initializes the first 2 or 3 | 68848 | BtCursor *pCur = pBt->pCursor; |
| 68277 | ** bytes of pTmpSpace, but that the first 4 bytes are copied from | 68849 | pBt->pCursor = pCur->pNext; /* Unlink the cursor */ |
| 68278 | ** it into a database page. This is not actually a problem, but it | 68850 | memset(pCur, 0, sizeof(*pCur)); |
| 68279 | ** does cause a valgrind error when the 1 or 2 bytes of unitialized | 68851 | return SQLITE_NOMEM_BKPT; |
| 68280 | ** data is passed to system call write(). So to avoid this error, | ||
| 68281 | ** zero the first 4 bytes of temp space here. | ||
| 68282 | ** | ||
| 68283 | ** Also: Provide four bytes of initialized space before the | ||
| 68284 | ** beginning of pTmpSpace as an area available to prepend the | ||
| 68285 | ** left-child pointer to the beginning of a cell. | ||
| 68286 | */ | ||
| 68287 | if( pBt->pTmpSpace ){ | ||
| 68288 | memset(pBt->pTmpSpace, 0, 8); | ||
| 68289 | pBt->pTmpSpace += 4; | ||
| 68290 | } | ||
| 68291 | } | 68852 | } |
| 68853 | |||
| 68854 | /* One of the uses of pBt->pTmpSpace is to format cells before | ||
| 68855 | ** inserting them into a leaf page (function fillInCell()). If | ||
| 68856 | ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes | ||
| 68857 | ** by the various routines that manipulate binary cells. Which | ||
| 68858 | ** can mean that fillInCell() only initializes the first 2 or 3 | ||
| 68859 | ** bytes of pTmpSpace, but that the first 4 bytes are copied from | ||
| 68860 | ** it into a database page. This is not actually a problem, but it | ||
| 68861 | ** does cause a valgrind error when the 1 or 2 bytes of unitialized | ||
| 68862 | ** data is passed to system call write(). So to avoid this error, | ||
| 68863 | ** zero the first 4 bytes of temp space here. | ||
| 68864 | ** | ||
| 68865 | ** Also: Provide four bytes of initialized space before the | ||
| 68866 | ** beginning of pTmpSpace as an area available to prepend the | ||
| 68867 | ** left-child pointer to the beginning of a cell. | ||
| 68868 | */ | ||
| 68869 | memset(pBt->pTmpSpace, 0, 8); | ||
| 68870 | pBt->pTmpSpace += 4; | ||
| 68871 | return SQLITE_OK; | ||
| 68292 | } | 68872 | } |
| 68293 | 68873 | ||
| 68294 | /* | 68874 | /* |
| @@ -68785,9 +69365,13 @@ static int lockBtree(BtShared *pBt){ | |||
| 68785 | pageSize-usableSize); | 69365 | pageSize-usableSize); |
| 68786 | return rc; | 69366 | return rc; |
| 68787 | } | 69367 | } |
| 68788 | if( sqlite3WritableSchema(pBt->db)==0 && nPage>nPageFile ){ | 69368 | if( nPage>nPageFile ){ |
| 68789 | rc = SQLITE_CORRUPT_BKPT; | 69369 | if( sqlite3WritableSchema(pBt->db)==0 ){ |
| 68790 | goto page1_init_failed; | 69370 | rc = SQLITE_CORRUPT_BKPT; |
| 69371 | goto page1_init_failed; | ||
| 69372 | }else{ | ||
| 69373 | nPage = nPageFile; | ||
| 69374 | } | ||
| 68791 | } | 69375 | } |
| 68792 | /* EVIDENCE-OF: R-28312-64704 However, the usable size is not allowed to | 69376 | /* EVIDENCE-OF: R-28312-64704 However, the usable size is not allowed to |
| 68793 | ** be less than 480. In other words, if the page size is 512, then the | 69377 | ** be less than 480. In other words, if the page size is 512, then the |
| @@ -69817,7 +70401,7 @@ static void btreeSetNPage(BtShared *pBt, MemPage *pPage1){ | |||
| 69817 | int nPage = get4byte(&pPage1->aData[28]); | 70401 | int nPage = get4byte(&pPage1->aData[28]); |
| 69818 | testcase( nPage==0 ); | 70402 | testcase( nPage==0 ); |
| 69819 | if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage); | 70403 | if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage); |
| 69820 | testcase( pBt->nPage!=nPage ); | 70404 | testcase( pBt->nPage!=(u32)nPage ); |
| 69821 | pBt->nPage = nPage; | 70405 | pBt->nPage = nPage; |
| 69822 | } | 70406 | } |
| 69823 | 70407 | ||
| @@ -70029,10 +70613,6 @@ static int btreeCursor( | |||
| 70029 | assert( pBt->pPage1 && pBt->pPage1->aData ); | 70613 | assert( pBt->pPage1 && pBt->pPage1->aData ); |
| 70030 | assert( wrFlag==0 || (pBt->btsFlags & BTS_READ_ONLY)==0 ); | 70614 | assert( wrFlag==0 || (pBt->btsFlags & BTS_READ_ONLY)==0 ); |
| 70031 | 70615 | ||
| 70032 | if( wrFlag ){ | ||
| 70033 | allocateTempSpace(pBt); | ||
| 70034 | if( pBt->pTmpSpace==0 ) return SQLITE_NOMEM_BKPT; | ||
| 70035 | } | ||
| 70036 | if( iTable<=1 ){ | 70616 | if( iTable<=1 ){ |
| 70037 | if( iTable<1 ){ | 70617 | if( iTable<1 ){ |
| 70038 | return SQLITE_CORRUPT_BKPT; | 70618 | return SQLITE_CORRUPT_BKPT; |
| @@ -70049,19 +70629,25 @@ static int btreeCursor( | |||
| 70049 | pCur->pKeyInfo = pKeyInfo; | 70629 | pCur->pKeyInfo = pKeyInfo; |
| 70050 | pCur->pBtree = p; | 70630 | pCur->pBtree = p; |
| 70051 | pCur->pBt = pBt; | 70631 | pCur->pBt = pBt; |
| 70052 | pCur->curFlags = wrFlag ? BTCF_WriteFlag : 0; | 70632 | pCur->curFlags = 0; |
| 70053 | pCur->curPagerFlags = wrFlag ? 0 : PAGER_GET_READONLY; | ||
| 70054 | /* If there are two or more cursors on the same btree, then all such | 70633 | /* If there are two or more cursors on the same btree, then all such |
| 70055 | ** cursors *must* have the BTCF_Multiple flag set. */ | 70634 | ** cursors *must* have the BTCF_Multiple flag set. */ |
| 70056 | for(pX=pBt->pCursor; pX; pX=pX->pNext){ | 70635 | for(pX=pBt->pCursor; pX; pX=pX->pNext){ |
| 70057 | if( pX->pgnoRoot==iTable ){ | 70636 | if( pX->pgnoRoot==iTable ){ |
| 70058 | pX->curFlags |= BTCF_Multiple; | 70637 | pX->curFlags |= BTCF_Multiple; |
| 70059 | pCur->curFlags |= BTCF_Multiple; | 70638 | pCur->curFlags = BTCF_Multiple; |
| 70060 | } | 70639 | } |
| 70061 | } | 70640 | } |
| 70641 | pCur->eState = CURSOR_INVALID; | ||
| 70062 | pCur->pNext = pBt->pCursor; | 70642 | pCur->pNext = pBt->pCursor; |
| 70063 | pBt->pCursor = pCur; | 70643 | pBt->pCursor = pCur; |
| 70064 | pCur->eState = CURSOR_INVALID; | 70644 | if( wrFlag ){ |
| 70645 | pCur->curFlags |= BTCF_WriteFlag; | ||
| 70646 | pCur->curPagerFlags = 0; | ||
| 70647 | if( pBt->pTmpSpace==0 ) return allocateTempSpace(pBt); | ||
| 70648 | }else{ | ||
| 70649 | pCur->curPagerFlags = PAGER_GET_READONLY; | ||
| 70650 | } | ||
| 70065 | return SQLITE_OK; | 70651 | return SQLITE_OK; |
| 70066 | } | 70652 | } |
| 70067 | static int btreeCursorWithLock( | 70653 | static int btreeCursorWithLock( |
| @@ -70836,7 +71422,7 @@ static int moveToRoot(BtCursor *pCur){ | |||
| 70836 | while( --pCur->iPage ){ | 71422 | while( --pCur->iPage ){ |
| 70837 | releasePageNotNull(pCur->apPage[pCur->iPage]); | 71423 | releasePageNotNull(pCur->apPage[pCur->iPage]); |
| 70838 | } | 71424 | } |
| 70839 | pCur->pPage = pCur->apPage[0]; | 71425 | pRoot = pCur->pPage = pCur->apPage[0]; |
| 70840 | goto skip_init; | 71426 | goto skip_init; |
| 70841 | } | 71427 | } |
| 70842 | }else if( pCur->pgnoRoot==0 ){ | 71428 | }else if( pCur->pgnoRoot==0 ){ |
| @@ -70883,7 +71469,6 @@ skip_init: | |||
| 70883 | pCur->info.nSize = 0; | 71469 | pCur->info.nSize = 0; |
| 70884 | pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidNKey|BTCF_ValidOvfl); | 71470 | pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidNKey|BTCF_ValidOvfl); |
| 70885 | 71471 | ||
| 70886 | pRoot = pCur->pPage; | ||
| 70887 | if( pRoot->nCell>0 ){ | 71472 | if( pRoot->nCell>0 ){ |
| 70888 | pCur->eState = CURSOR_VALID; | 71473 | pCur->eState = CURSOR_VALID; |
| 70889 | }else if( !pRoot->leaf ){ | 71474 | }else if( !pRoot->leaf ){ |
| @@ -71124,7 +71709,6 @@ SQLITE_PRIVATE int sqlite3BtreeTableMoveto( | |||
| 71124 | upr = pPage->nCell-1; | 71709 | upr = pPage->nCell-1; |
| 71125 | assert( biasRight==0 || biasRight==1 ); | 71710 | assert( biasRight==0 || biasRight==1 ); |
| 71126 | idx = upr>>(1-biasRight); /* idx = biasRight ? upr : (lwr+upr)/2; */ | 71711 | idx = upr>>(1-biasRight); /* idx = biasRight ? upr : (lwr+upr)/2; */ |
| 71127 | pCur->ix = (u16)idx; | ||
| 71128 | for(;;){ | 71712 | for(;;){ |
| 71129 | i64 nCellKey; | 71713 | i64 nCellKey; |
| 71130 | pCell = findCellPastPtr(pPage, idx); | 71714 | pCell = findCellPastPtr(pPage, idx); |
| @@ -71266,7 +71850,6 @@ SQLITE_PRIVATE int sqlite3BtreeIndexMoveto( | |||
| 71266 | lwr = 0; | 71850 | lwr = 0; |
| 71267 | upr = pPage->nCell-1; | 71851 | upr = pPage->nCell-1; |
| 71268 | idx = upr>>1; /* idx = (lwr+upr)/2; */ | 71852 | idx = upr>>1; /* idx = (lwr+upr)/2; */ |
| 71269 | pCur->ix = (u16)idx; | ||
| 71270 | for(;;){ | 71853 | for(;;){ |
| 71271 | int nCell; /* Size of the pCell cell in bytes */ | 71854 | int nCell; /* Size of the pCell cell in bytes */ |
| 71272 | pCell = findCellPastPtr(pPage, idx); | 71855 | pCell = findCellPastPtr(pPage, idx); |
| @@ -71958,7 +72541,7 @@ static int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){ | |||
| 71958 | assert( CORRUPT_DB || iPage>1 ); | 72541 | assert( CORRUPT_DB || iPage>1 ); |
| 71959 | assert( !pMemPage || pMemPage->pgno==iPage ); | 72542 | assert( !pMemPage || pMemPage->pgno==iPage ); |
| 71960 | 72543 | ||
| 71961 | if( NEVER(iPage<2) || iPage>pBt->nPage ){ | 72544 | if( iPage<2 || iPage>pBt->nPage ){ |
| 71962 | return SQLITE_CORRUPT_BKPT; | 72545 | return SQLITE_CORRUPT_BKPT; |
| 71963 | } | 72546 | } |
| 71964 | if( pMemPage ){ | 72547 | if( pMemPage ){ |
| @@ -72382,16 +72965,24 @@ static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){ | |||
| 72382 | int hdr; /* Beginning of the header. 0 most pages. 100 page 1 */ | 72965 | int hdr; /* Beginning of the header. 0 most pages. 100 page 1 */ |
| 72383 | 72966 | ||
| 72384 | if( *pRC ) return; | 72967 | if( *pRC ) return; |
| 72385 | assert( idx>=0 && idx<pPage->nCell ); | 72968 | assert( idx>=0 ); |
| 72969 | assert( idx<pPage->nCell ); | ||
| 72386 | assert( CORRUPT_DB || sz==cellSize(pPage, idx) ); | 72970 | assert( CORRUPT_DB || sz==cellSize(pPage, idx) ); |
| 72387 | assert( sqlite3PagerIswriteable(pPage->pDbPage) ); | 72971 | assert( sqlite3PagerIswriteable(pPage->pDbPage) ); |
| 72388 | assert( sqlite3_mutex_held(pPage->pBt->mutex) ); | 72972 | assert( sqlite3_mutex_held(pPage->pBt->mutex) ); |
| 72389 | assert( pPage->nFree>=0 ); | 72973 | assert( pPage->nFree>=0 ); |
| 72390 | data = pPage->aData; | 72974 | data = pPage->aData; |
| 72391 | ptr = &pPage->aCellIdx[2*idx]; | 72975 | ptr = &pPage->aCellIdx[2*idx]; |
| 72976 | assert( pPage->pBt->usableSize > (u32)(ptr-data) ); | ||
| 72392 | pc = get2byte(ptr); | 72977 | pc = get2byte(ptr); |
| 72393 | hdr = pPage->hdrOffset; | 72978 | hdr = pPage->hdrOffset; |
| 72394 | testcase( pc==get2byte(&data[hdr+5]) ); | 72979 | #if 0 /* Not required. Omit for efficiency */ |
| 72980 | if( pc<hdr+pPage->nCell*2 ){ | ||
| 72981 | *pRC = SQLITE_CORRUPT_BKPT; | ||
| 72982 | return; | ||
| 72983 | } | ||
| 72984 | #endif | ||
| 72985 | testcase( pc==(u32)get2byte(&data[hdr+5]) ); | ||
| 72395 | testcase( pc+sz==pPage->pBt->usableSize ); | 72986 | testcase( pc+sz==pPage->pBt->usableSize ); |
| 72396 | if( pc+sz > pPage->pBt->usableSize ){ | 72987 | if( pc+sz > pPage->pBt->usableSize ){ |
| 72397 | *pRC = SQLITE_CORRUPT_BKPT; | 72988 | *pRC = SQLITE_CORRUPT_BKPT; |
| @@ -72683,7 +73274,7 @@ static int rebuildPage( | |||
| 72683 | 73274 | ||
| 72684 | assert( i<iEnd ); | 73275 | assert( i<iEnd ); |
| 72685 | j = get2byte(&aData[hdr+5]); | 73276 | j = get2byte(&aData[hdr+5]); |
| 72686 | if( NEVER(j>(u32)usableSize) ){ j = 0; } | 73277 | if( j>(u32)usableSize ){ j = 0; } |
| 72687 | memcpy(&pTmp[j], &aData[j], usableSize - j); | 73278 | memcpy(&pTmp[j], &aData[j], usableSize - j); |
| 72688 | 73279 | ||
| 72689 | for(k=0; pCArray->ixNx[k]<=i && ALWAYS(k<NB*2); k++){} | 73280 | for(k=0; pCArray->ixNx[k]<=i && ALWAYS(k<NB*2); k++){} |
| @@ -72914,7 +73505,7 @@ static int editPage( | |||
| 72914 | 73505 | ||
| 72915 | pData = &aData[get2byteNotZero(&aData[hdr+5])]; | 73506 | pData = &aData[get2byteNotZero(&aData[hdr+5])]; |
| 72916 | if( pData<pBegin ) goto editpage_fail; | 73507 | if( pData<pBegin ) goto editpage_fail; |
| 72917 | if( NEVER(pData>pPg->aDataEnd) ) goto editpage_fail; | 73508 | if( pData>pPg->aDataEnd ) goto editpage_fail; |
| 72918 | 73509 | ||
| 72919 | /* Add cells to the start of the page */ | 73510 | /* Add cells to the start of the page */ |
| 72920 | if( iNew<iOld ){ | 73511 | if( iNew<iOld ){ |
| @@ -74790,14 +75381,13 @@ SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 | |||
| 74790 | SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ | 75381 | SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ |
| 74791 | Btree *p = pCur->pBtree; | 75382 | Btree *p = pCur->pBtree; |
| 74792 | BtShared *pBt = p->pBt; | 75383 | BtShared *pBt = p->pBt; |
| 74793 | int rc; /* Return code */ | 75384 | int rc; /* Return code */ |
| 74794 | MemPage *pPage; /* Page to delete cell from */ | 75385 | MemPage *pPage; /* Page to delete cell from */ |
| 74795 | unsigned char *pCell; /* Pointer to cell to delete */ | 75386 | unsigned char *pCell; /* Pointer to cell to delete */ |
| 74796 | int iCellIdx; /* Index of cell to delete */ | 75387 | int iCellIdx; /* Index of cell to delete */ |
| 74797 | int iCellDepth; /* Depth of node containing pCell */ | 75388 | int iCellDepth; /* Depth of node containing pCell */ |
| 74798 | CellInfo info; /* Size of the cell being deleted */ | 75389 | CellInfo info; /* Size of the cell being deleted */ |
| 74799 | int bSkipnext = 0; /* Leaf cursor in SKIPNEXT state */ | 75390 | u8 bPreserve; /* Keep cursor valid. 2 for CURSOR_SKIPNEXT */ |
| 74800 | u8 bPreserve = flags & BTREE_SAVEPOSITION; /* Keep cursor valid */ | ||
| 74801 | 75391 | ||
| 74802 | assert( cursorOwnsBtShared(pCur) ); | 75392 | assert( cursorOwnsBtShared(pCur) ); |
| 74803 | assert( pBt->inTransaction==TRANS_WRITE ); | 75393 | assert( pBt->inTransaction==TRANS_WRITE ); |
| @@ -74816,18 +75406,31 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ | |||
| 74816 | iCellDepth = pCur->iPage; | 75406 | iCellDepth = pCur->iPage; |
| 74817 | iCellIdx = pCur->ix; | 75407 | iCellIdx = pCur->ix; |
| 74818 | pPage = pCur->pPage; | 75408 | pPage = pCur->pPage; |
| 75409 | if( pPage->nCell<=iCellIdx ){ | ||
| 75410 | return SQLITE_CORRUPT_BKPT; | ||
| 75411 | } | ||
| 74819 | pCell = findCell(pPage, iCellIdx); | 75412 | pCell = findCell(pPage, iCellIdx); |
| 74820 | if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ) return SQLITE_CORRUPT; | 75413 | if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ){ |
| 75414 | return SQLITE_CORRUPT_BKPT; | ||
| 75415 | } | ||
| 74821 | 75416 | ||
| 74822 | /* If the bPreserve flag is set to true, then the cursor position must | 75417 | /* If the BTREE_SAVEPOSITION bit is on, then the cursor position must |
| 74823 | ** be preserved following this delete operation. If the current delete | 75418 | ** be preserved following this delete operation. If the current delete |
| 74824 | ** will cause a b-tree rebalance, then this is done by saving the cursor | 75419 | ** will cause a b-tree rebalance, then this is done by saving the cursor |
| 74825 | ** key and leaving the cursor in CURSOR_REQUIRESEEK state before | 75420 | ** key and leaving the cursor in CURSOR_REQUIRESEEK state before |
| 74826 | ** returning. | 75421 | ** returning. |
| 74827 | ** | 75422 | ** |
| 74828 | ** Or, if the current delete will not cause a rebalance, then the cursor | 75423 | ** If the current delete will not cause a rebalance, then the cursor |
| 74829 | ** will be left in CURSOR_SKIPNEXT state pointing to the entry immediately | 75424 | ** will be left in CURSOR_SKIPNEXT state pointing to the entry immediately |
| 74830 | ** before or after the deleted entry. In this case set bSkipnext to true. */ | 75425 | ** before or after the deleted entry. |
| 75426 | ** | ||
| 75427 | ** The bPreserve value records which path is required: | ||
| 75428 | ** | ||
| 75429 | ** bPreserve==0 Not necessary to save the cursor position | ||
| 75430 | ** bPreserve==1 Use CURSOR_REQUIRESEEK to save the cursor position | ||
| 75431 | ** bPreserve==2 Cursor won't move. Set CURSOR_SKIPNEXT. | ||
| 75432 | */ | ||
| 75433 | bPreserve = (flags & BTREE_SAVEPOSITION)!=0; | ||
| 74831 | if( bPreserve ){ | 75434 | if( bPreserve ){ |
| 74832 | if( !pPage->leaf | 75435 | if( !pPage->leaf |
| 74833 | || (pPage->nFree+cellSizePtr(pPage,pCell)+2)>(int)(pBt->usableSize*2/3) | 75436 | || (pPage->nFree+cellSizePtr(pPage,pCell)+2)>(int)(pBt->usableSize*2/3) |
| @@ -74838,7 +75441,7 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ | |||
| 74838 | rc = saveCursorKey(pCur); | 75441 | rc = saveCursorKey(pCur); |
| 74839 | if( rc ) return rc; | 75442 | if( rc ) return rc; |
| 74840 | }else{ | 75443 | }else{ |
| 74841 | bSkipnext = 1; | 75444 | bPreserve = 2; |
| 74842 | } | 75445 | } |
| 74843 | } | 75446 | } |
| 74844 | 75447 | ||
| @@ -74938,8 +75541,8 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ | |||
| 74938 | } | 75541 | } |
| 74939 | 75542 | ||
| 74940 | if( rc==SQLITE_OK ){ | 75543 | if( rc==SQLITE_OK ){ |
| 74941 | if( bSkipnext ){ | 75544 | if( bPreserve>1 ){ |
| 74942 | assert( bPreserve && (pCur->iPage==iCellDepth || CORRUPT_DB) ); | 75545 | assert( (pCur->iPage==iCellDepth || CORRUPT_DB) ); |
| 74943 | assert( pPage==pCur->pPage || CORRUPT_DB ); | 75546 | assert( pPage==pCur->pPage || CORRUPT_DB ); |
| 74944 | assert( (pPage->nCell>0 || CORRUPT_DB) && iCellIdx<=pPage->nCell ); | 75547 | assert( (pPage->nCell>0 || CORRUPT_DB) && iCellIdx<=pPage->nCell ); |
| 74945 | pCur->eState = CURSOR_SKIPNEXT; | 75548 | pCur->eState = CURSOR_SKIPNEXT; |
| @@ -75149,7 +75752,7 @@ static int clearDatabasePage( | |||
| 75149 | rc = getAndInitPage(pBt, pgno, &pPage, 0, 0); | 75752 | rc = getAndInitPage(pBt, pgno, &pPage, 0, 0); |
| 75150 | if( rc ) return rc; | 75753 | if( rc ) return rc; |
| 75151 | if( (pBt->openFlags & BTREE_SINGLE)==0 | 75754 | if( (pBt->openFlags & BTREE_SINGLE)==0 |
| 75152 | && sqlite3PagerPageRefcount(pPage->pDbPage)!=1 | 75755 | && sqlite3PagerPageRefcount(pPage->pDbPage) != (1 + (pgno==1)) |
| 75153 | ){ | 75756 | ){ |
| 75154 | rc = SQLITE_CORRUPT_BKPT; | 75757 | rc = SQLITE_CORRUPT_BKPT; |
| 75155 | goto cleardatabasepage_out; | 75758 | goto cleardatabasepage_out; |
| @@ -76529,14 +77132,13 @@ static Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){ | |||
| 76529 | if( i==1 ){ | 77132 | if( i==1 ){ |
| 76530 | Parse sParse; | 77133 | Parse sParse; |
| 76531 | int rc = 0; | 77134 | int rc = 0; |
| 76532 | memset(&sParse, 0, sizeof(sParse)); | 77135 | sqlite3ParseObjectInit(&sParse,pDb); |
| 76533 | sParse.db = pDb; | ||
| 76534 | if( sqlite3OpenTempDatabase(&sParse) ){ | 77136 | if( sqlite3OpenTempDatabase(&sParse) ){ |
| 76535 | sqlite3ErrorWithMsg(pErrorDb, sParse.rc, "%s", sParse.zErrMsg); | 77137 | sqlite3ErrorWithMsg(pErrorDb, sParse.rc, "%s", sParse.zErrMsg); |
| 76536 | rc = SQLITE_ERROR; | 77138 | rc = SQLITE_ERROR; |
| 76537 | } | 77139 | } |
| 76538 | sqlite3DbFree(pErrorDb, sParse.zErrMsg); | 77140 | sqlite3DbFree(pErrorDb, sParse.zErrMsg); |
| 76539 | sqlite3ParserReset(&sParse); | 77141 | sqlite3ParseObjectReset(&sParse); |
| 76540 | if( rc ){ | 77142 | if( rc ){ |
| 76541 | return 0; | 77143 | return 0; |
| 76542 | } | 77144 | } |
| @@ -77814,12 +78416,12 @@ static SQLITE_NOINLINE i64 doubleToInt64(double r){ | |||
| 77814 | ** | 78416 | ** |
| 77815 | ** If pMem represents a string value, its encoding might be changed. | 78417 | ** If pMem represents a string value, its encoding might be changed. |
| 77816 | */ | 78418 | */ |
| 77817 | static SQLITE_NOINLINE i64 memIntValue(Mem *pMem){ | 78419 | static SQLITE_NOINLINE i64 memIntValue(const Mem *pMem){ |
| 77818 | i64 value = 0; | 78420 | i64 value = 0; |
| 77819 | sqlite3Atoi64(pMem->z, &value, pMem->n, pMem->enc); | 78421 | sqlite3Atoi64(pMem->z, &value, pMem->n, pMem->enc); |
| 77820 | return value; | 78422 | return value; |
| 77821 | } | 78423 | } |
| 77822 | SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){ | 78424 | SQLITE_PRIVATE i64 sqlite3VdbeIntValue(const Mem *pMem){ |
| 77823 | int flags; | 78425 | int flags; |
| 77824 | assert( pMem!=0 ); | 78426 | assert( pMem!=0 ); |
| 77825 | assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); | 78427 | assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); |
| @@ -78748,11 +79350,7 @@ static int valueFromExpr( | |||
| 78748 | 79350 | ||
| 78749 | assert( pExpr!=0 ); | 79351 | assert( pExpr!=0 ); |
| 78750 | while( (op = pExpr->op)==TK_UPLUS || op==TK_SPAN ) pExpr = pExpr->pLeft; | 79352 | while( (op = pExpr->op)==TK_UPLUS || op==TK_SPAN ) pExpr = pExpr->pLeft; |
| 78751 | #if defined(SQLITE_ENABLE_STAT4) | ||
| 78752 | if( op==TK_REGISTER ) op = pExpr->op2; | 79353 | if( op==TK_REGISTER ) op = pExpr->op2; |
| 78753 | #else | ||
| 78754 | if( NEVER(op==TK_REGISTER) ) op = pExpr->op2; | ||
| 78755 | #endif | ||
| 78756 | 79354 | ||
| 78757 | /* Compressed expressions only appear when parsing the DEFAULT clause | 79355 | /* Compressed expressions only appear when parsing the DEFAULT clause |
| 78758 | ** on a table column definition, and hence only when pCtx==0. This | 79356 | ** on a table column definition, and hence only when pCtx==0. This |
| @@ -78867,7 +79465,7 @@ static int valueFromExpr( | |||
| 78867 | 79465 | ||
| 78868 | no_mem: | 79466 | no_mem: |
| 78869 | #ifdef SQLITE_ENABLE_STAT4 | 79467 | #ifdef SQLITE_ENABLE_STAT4 |
| 78870 | if( pCtx==0 || pCtx->pParse->nErr==0 ) | 79468 | if( pCtx==0 || NEVER(pCtx->pParse->nErr==0) ) |
| 78871 | #endif | 79469 | #endif |
| 78872 | sqlite3OomFault(db); | 79470 | sqlite3OomFault(db); |
| 78873 | sqlite3DbFree(db, zVal); | 79471 | sqlite3DbFree(db, zVal); |
| @@ -80545,8 +81143,7 @@ SQLITE_PRIVATE void sqlite3VdbeSetP4KeyInfo(Parse *pParse, Index *pIdx){ | |||
| 80545 | */ | 81143 | */ |
| 80546 | static void vdbeVComment(Vdbe *p, const char *zFormat, va_list ap){ | 81144 | static void vdbeVComment(Vdbe *p, const char *zFormat, va_list ap){ |
| 80547 | assert( p->nOp>0 || p->aOp==0 ); | 81145 | assert( p->nOp>0 || p->aOp==0 ); |
| 80548 | assert( p->aOp==0 || p->aOp[p->nOp-1].zComment==0 || p->db->mallocFailed | 81146 | assert( p->aOp==0 || p->aOp[p->nOp-1].zComment==0 || p->pParse->nErr>0 ); |
| 80549 | || p->pParse->nErr>0 ); | ||
| 80550 | if( p->nOp ){ | 81147 | if( p->nOp ){ |
| 80551 | assert( p->aOp ); | 81148 | assert( p->aOp ); |
| 80552 | sqlite3DbFree(p->db, p->aOp[p->nOp-1].zComment); | 81149 | sqlite3DbFree(p->db, p->aOp[p->nOp-1].zComment); |
| @@ -81637,8 +82234,6 @@ SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){ | |||
| 81637 | if( pCx==0 ){ | 82234 | if( pCx==0 ){ |
| 81638 | return; | 82235 | return; |
| 81639 | } | 82236 | } |
| 81640 | assert( pCx->pBtx==0 || pCx->eCurType==CURTYPE_BTREE ); | ||
| 81641 | assert( pCx->pBtx==0 || pCx->isEphemeral ); | ||
| 81642 | switch( pCx->eCurType ){ | 82237 | switch( pCx->eCurType ){ |
| 81643 | case CURTYPE_SORTER: { | 82238 | case CURTYPE_SORTER: { |
| 81644 | sqlite3VdbeSorterClose(p->db, pCx); | 82239 | sqlite3VdbeSorterClose(p->db, pCx); |
| @@ -82419,6 +83014,7 @@ SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p){ | |||
| 82419 | sqlite3ValueSetNull(db->pErr); | 83014 | sqlite3ValueSetNull(db->pErr); |
| 82420 | } | 83015 | } |
| 82421 | db->errCode = rc; | 83016 | db->errCode = rc; |
| 83017 | db->errByteOffset = -1; | ||
| 82422 | return rc; | 83018 | return rc; |
| 82423 | } | 83019 | } |
| 82424 | 83020 | ||
| @@ -82740,7 +83336,7 @@ SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor **pp, u32 *piCol){ | |||
| 82740 | if( p->deferredMoveto ){ | 83336 | if( p->deferredMoveto ){ |
| 82741 | u32 iMap; | 83337 | u32 iMap; |
| 82742 | assert( !p->isEphemeral ); | 83338 | assert( !p->isEphemeral ); |
| 82743 | if( p->aAltMap && (iMap = p->aAltMap[1+*piCol])>0 && !p->nullRow ){ | 83339 | if( p->ub.aAltMap && (iMap = p->ub.aAltMap[1+*piCol])>0 && !p->nullRow ){ |
| 82744 | *pp = p->pAltCursor; | 83340 | *pp = p->pAltCursor; |
| 82745 | *piCol = iMap - 1; | 83341 | *piCol = iMap - 1; |
| 82746 | return SQLITE_OK; | 83342 | return SQLITE_OK; |
| @@ -83018,14 +83614,14 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_type){ | |||
| 83018 | 83614 | ||
| 83019 | /* | 83615 | /* |
| 83020 | ** Deserialize the data blob pointed to by buf as serial type serial_type | 83616 | ** Deserialize the data blob pointed to by buf as serial type serial_type |
| 83021 | ** and store the result in pMem. Return the number of bytes read. | 83617 | ** and store the result in pMem. |
| 83022 | ** | 83618 | ** |
| 83023 | ** This function is implemented as two separate routines for performance. | 83619 | ** This function is implemented as two separate routines for performance. |
| 83024 | ** The few cases that require local variables are broken out into a separate | 83620 | ** The few cases that require local variables are broken out into a separate |
| 83025 | ** routine so that in most cases the overhead of moving the stack pointer | 83621 | ** routine so that in most cases the overhead of moving the stack pointer |
| 83026 | ** is avoided. | 83622 | ** is avoided. |
| 83027 | */ | 83623 | */ |
| 83028 | static u32 serialGet( | 83624 | static void serialGet( |
| 83029 | const unsigned char *buf, /* Buffer to deserialize from */ | 83625 | const unsigned char *buf, /* Buffer to deserialize from */ |
| 83030 | u32 serial_type, /* Serial type to deserialize */ | 83626 | u32 serial_type, /* Serial type to deserialize */ |
| 83031 | Mem *pMem /* Memory cell to write value into */ | 83627 | Mem *pMem /* Memory cell to write value into */ |
| @@ -83059,9 +83655,8 @@ static u32 serialGet( | |||
| 83059 | memcpy(&pMem->u.r, &x, sizeof(x)); | 83655 | memcpy(&pMem->u.r, &x, sizeof(x)); |
| 83060 | pMem->flags = IsNaN(x) ? MEM_Null : MEM_Real; | 83656 | pMem->flags = IsNaN(x) ? MEM_Null : MEM_Real; |
| 83061 | } | 83657 | } |
| 83062 | return 8; | ||
| 83063 | } | 83658 | } |
| 83064 | SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( | 83659 | SQLITE_PRIVATE void sqlite3VdbeSerialGet( |
| 83065 | const unsigned char *buf, /* Buffer to deserialize from */ | 83660 | const unsigned char *buf, /* Buffer to deserialize from */ |
| 83066 | u32 serial_type, /* Serial type to deserialize */ | 83661 | u32 serial_type, /* Serial type to deserialize */ |
| 83067 | Mem *pMem /* Memory cell to write value into */ | 83662 | Mem *pMem /* Memory cell to write value into */ |
| @@ -83072,13 +83667,13 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( | |||
| 83072 | pMem->flags = MEM_Null|MEM_Zero; | 83667 | pMem->flags = MEM_Null|MEM_Zero; |
| 83073 | pMem->n = 0; | 83668 | pMem->n = 0; |
| 83074 | pMem->u.nZero = 0; | 83669 | pMem->u.nZero = 0; |
| 83075 | break; | 83670 | return; |
| 83076 | } | 83671 | } |
| 83077 | case 11: /* Reserved for future use */ | 83672 | case 11: /* Reserved for future use */ |
| 83078 | case 0: { /* Null */ | 83673 | case 0: { /* Null */ |
| 83079 | /* EVIDENCE-OF: R-24078-09375 Value is a NULL. */ | 83674 | /* EVIDENCE-OF: R-24078-09375 Value is a NULL. */ |
| 83080 | pMem->flags = MEM_Null; | 83675 | pMem->flags = MEM_Null; |
| 83081 | break; | 83676 | return; |
| 83082 | } | 83677 | } |
| 83083 | case 1: { | 83678 | case 1: { |
| 83084 | /* EVIDENCE-OF: R-44885-25196 Value is an 8-bit twos-complement | 83679 | /* EVIDENCE-OF: R-44885-25196 Value is an 8-bit twos-complement |
| @@ -83086,7 +83681,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( | |||
| 83086 | pMem->u.i = ONE_BYTE_INT(buf); | 83681 | pMem->u.i = ONE_BYTE_INT(buf); |
| 83087 | pMem->flags = MEM_Int; | 83682 | pMem->flags = MEM_Int; |
| 83088 | testcase( pMem->u.i<0 ); | 83683 | testcase( pMem->u.i<0 ); |
| 83089 | return 1; | 83684 | return; |
| 83090 | } | 83685 | } |
| 83091 | case 2: { /* 2-byte signed integer */ | 83686 | case 2: { /* 2-byte signed integer */ |
| 83092 | /* EVIDENCE-OF: R-49794-35026 Value is a big-endian 16-bit | 83687 | /* EVIDENCE-OF: R-49794-35026 Value is a big-endian 16-bit |
| @@ -83094,7 +83689,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( | |||
| 83094 | pMem->u.i = TWO_BYTE_INT(buf); | 83689 | pMem->u.i = TWO_BYTE_INT(buf); |
| 83095 | pMem->flags = MEM_Int; | 83690 | pMem->flags = MEM_Int; |
| 83096 | testcase( pMem->u.i<0 ); | 83691 | testcase( pMem->u.i<0 ); |
| 83097 | return 2; | 83692 | return; |
| 83098 | } | 83693 | } |
| 83099 | case 3: { /* 3-byte signed integer */ | 83694 | case 3: { /* 3-byte signed integer */ |
| 83100 | /* EVIDENCE-OF: R-37839-54301 Value is a big-endian 24-bit | 83695 | /* EVIDENCE-OF: R-37839-54301 Value is a big-endian 24-bit |
| @@ -83102,7 +83697,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( | |||
| 83102 | pMem->u.i = THREE_BYTE_INT(buf); | 83697 | pMem->u.i = THREE_BYTE_INT(buf); |
| 83103 | pMem->flags = MEM_Int; | 83698 | pMem->flags = MEM_Int; |
| 83104 | testcase( pMem->u.i<0 ); | 83699 | testcase( pMem->u.i<0 ); |
| 83105 | return 3; | 83700 | return; |
| 83106 | } | 83701 | } |
| 83107 | case 4: { /* 4-byte signed integer */ | 83702 | case 4: { /* 4-byte signed integer */ |
| 83108 | /* EVIDENCE-OF: R-01849-26079 Value is a big-endian 32-bit | 83703 | /* EVIDENCE-OF: R-01849-26079 Value is a big-endian 32-bit |
| @@ -83114,7 +83709,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( | |||
| 83114 | #endif | 83709 | #endif |
| 83115 | pMem->flags = MEM_Int; | 83710 | pMem->flags = MEM_Int; |
| 83116 | testcase( pMem->u.i<0 ); | 83711 | testcase( pMem->u.i<0 ); |
| 83117 | return 4; | 83712 | return; |
| 83118 | } | 83713 | } |
| 83119 | case 5: { /* 6-byte signed integer */ | 83714 | case 5: { /* 6-byte signed integer */ |
| 83120 | /* EVIDENCE-OF: R-50385-09674 Value is a big-endian 48-bit | 83715 | /* EVIDENCE-OF: R-50385-09674 Value is a big-endian 48-bit |
| @@ -83122,13 +83717,14 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( | |||
| 83122 | pMem->u.i = FOUR_BYTE_UINT(buf+2) + (((i64)1)<<32)*TWO_BYTE_INT(buf); | 83717 | pMem->u.i = FOUR_BYTE_UINT(buf+2) + (((i64)1)<<32)*TWO_BYTE_INT(buf); |
| 83123 | pMem->flags = MEM_Int; | 83718 | pMem->flags = MEM_Int; |
| 83124 | testcase( pMem->u.i<0 ); | 83719 | testcase( pMem->u.i<0 ); |
| 83125 | return 6; | 83720 | return; |
| 83126 | } | 83721 | } |
| 83127 | case 6: /* 8-byte signed integer */ | 83722 | case 6: /* 8-byte signed integer */ |
| 83128 | case 7: { /* IEEE floating point */ | 83723 | case 7: { /* IEEE floating point */ |
| 83129 | /* These use local variables, so do them in a separate routine | 83724 | /* These use local variables, so do them in a separate routine |
| 83130 | ** to avoid having to move the frame pointer in the common case */ | 83725 | ** to avoid having to move the frame pointer in the common case */ |
| 83131 | return serialGet(buf,serial_type,pMem); | 83726 | serialGet(buf,serial_type,pMem); |
| 83727 | return; | ||
| 83132 | } | 83728 | } |
| 83133 | case 8: /* Integer 0 */ | 83729 | case 8: /* Integer 0 */ |
| 83134 | case 9: { /* Integer 1 */ | 83730 | case 9: { /* Integer 1 */ |
| @@ -83136,7 +83732,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( | |||
| 83136 | /* EVIDENCE-OF: R-18143-12121 Value is the integer 1. */ | 83732 | /* EVIDENCE-OF: R-18143-12121 Value is the integer 1. */ |
| 83137 | pMem->u.i = serial_type-8; | 83733 | pMem->u.i = serial_type-8; |
| 83138 | pMem->flags = MEM_Int; | 83734 | pMem->flags = MEM_Int; |
| 83139 | return 0; | 83735 | return; |
| 83140 | } | 83736 | } |
| 83141 | default: { | 83737 | default: { |
| 83142 | /* EVIDENCE-OF: R-14606-31564 Value is a BLOB that is (N-12)/2 bytes in | 83738 | /* EVIDENCE-OF: R-14606-31564 Value is a BLOB that is (N-12)/2 bytes in |
| @@ -83147,10 +83743,10 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( | |||
| 83147 | pMem->z = (char *)buf; | 83743 | pMem->z = (char *)buf; |
| 83148 | pMem->n = (serial_type-12)/2; | 83744 | pMem->n = (serial_type-12)/2; |
| 83149 | pMem->flags = aFlag[serial_type&1]; | 83745 | pMem->flags = aFlag[serial_type&1]; |
| 83150 | return pMem->n; | 83746 | return; |
| 83151 | } | 83747 | } |
| 83152 | } | 83748 | } |
| 83153 | return 0; | 83749 | return; |
| 83154 | } | 83750 | } |
| 83155 | /* | 83751 | /* |
| 83156 | ** This routine is used to allocate sufficient space for an UnpackedRecord | 83752 | ** This routine is used to allocate sufficient space for an UnpackedRecord |
| @@ -83213,7 +83809,8 @@ SQLITE_PRIVATE void sqlite3VdbeRecordUnpack( | |||
| 83213 | /* pMem->flags = 0; // sqlite3VdbeSerialGet() will set this for us */ | 83809 | /* pMem->flags = 0; // sqlite3VdbeSerialGet() will set this for us */ |
| 83214 | pMem->szMalloc = 0; | 83810 | pMem->szMalloc = 0; |
| 83215 | pMem->z = 0; | 83811 | pMem->z = 0; |
| 83216 | d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem); | 83812 | sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem); |
| 83813 | d += sqlite3VdbeSerialTypeLen(serial_type); | ||
| 83217 | pMem++; | 83814 | pMem++; |
| 83218 | if( (++u)>=p->nField ) break; | 83815 | if( (++u)>=p->nField ) break; |
| 83219 | } | 83816 | } |
| @@ -83297,7 +83894,8 @@ static int vdbeRecordCompareDebug( | |||
| 83297 | 83894 | ||
| 83298 | /* Extract the values to be compared. | 83895 | /* Extract the values to be compared. |
| 83299 | */ | 83896 | */ |
| 83300 | d1 += sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1); | 83897 | sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1); |
| 83898 | d1 += sqlite3VdbeSerialTypeLen(serial_type1); | ||
| 83301 | 83899 | ||
| 83302 | /* Do the comparison | 83900 | /* Do the comparison |
| 83303 | */ | 83901 | */ |
| @@ -84101,7 +84699,7 @@ SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 *rowid){ | |||
| 84101 | /* The index entry must begin with a header size */ | 84699 | /* The index entry must begin with a header size */ |
| 84102 | getVarint32NR((u8*)m.z, szHdr); | 84700 | getVarint32NR((u8*)m.z, szHdr); |
| 84103 | testcase( szHdr==3 ); | 84701 | testcase( szHdr==3 ); |
| 84104 | testcase( szHdr==m.n ); | 84702 | testcase( szHdr==(u32)m.n ); |
| 84105 | testcase( szHdr>0x7fffffff ); | 84703 | testcase( szHdr>0x7fffffff ); |
| 84106 | assert( m.n>=0 ); | 84704 | assert( m.n>=0 ); |
| 84107 | if( unlikely(szHdr<3 || szHdr>(unsigned)m.n) ){ | 84705 | if( unlikely(szHdr<3 || szHdr>(unsigned)m.n) ){ |
| @@ -85276,6 +85874,70 @@ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context *p){ | |||
| 85276 | } | 85874 | } |
| 85277 | 85875 | ||
| 85278 | /* | 85876 | /* |
| 85877 | ** Implementation of sqlite3_vtab_in_first() (if bNext==0) and | ||
| 85878 | ** sqlite3_vtab_in_next() (if bNext!=0). | ||
| 85879 | */ | ||
| 85880 | static int valueFromValueList( | ||
| 85881 | sqlite3_value *pVal, /* Pointer to the ValueList object */ | ||
| 85882 | sqlite3_value **ppOut, /* Store the next value from the list here */ | ||
| 85883 | int bNext /* 1 for _next(). 0 for _first() */ | ||
| 85884 | ){ | ||
| 85885 | int rc; | ||
| 85886 | ValueList *pRhs; | ||
| 85887 | |||
| 85888 | *ppOut = 0; | ||
| 85889 | if( pVal==0 ) return SQLITE_MISUSE; | ||
| 85890 | pRhs = (ValueList*)sqlite3_value_pointer(pVal, "ValueList"); | ||
| 85891 | if( pRhs==0 ) return SQLITE_MISUSE; | ||
| 85892 | if( bNext ){ | ||
| 85893 | rc = sqlite3BtreeNext(pRhs->pCsr, 0); | ||
| 85894 | }else{ | ||
| 85895 | int dummy = 0; | ||
| 85896 | rc = sqlite3BtreeFirst(pRhs->pCsr, &dummy); | ||
| 85897 | assert( rc==SQLITE_OK || sqlite3BtreeEof(pRhs->pCsr) ); | ||
| 85898 | if( sqlite3BtreeEof(pRhs->pCsr) ) rc = SQLITE_DONE; | ||
| 85899 | } | ||
| 85900 | if( rc==SQLITE_OK ){ | ||
| 85901 | u32 sz; /* Size of current row in bytes */ | ||
| 85902 | Mem sMem; /* Raw content of current row */ | ||
| 85903 | memset(&sMem, 0, sizeof(sMem)); | ||
| 85904 | sz = sqlite3BtreePayloadSize(pRhs->pCsr); | ||
| 85905 | rc = sqlite3VdbeMemFromBtreeZeroOffset(pRhs->pCsr,(int)sz,&sMem); | ||
| 85906 | if( rc==SQLITE_OK ){ | ||
| 85907 | u8 *zBuf = (u8*)sMem.z; | ||
| 85908 | u32 iSerial; | ||
| 85909 | sqlite3_value *pOut = pRhs->pOut; | ||
| 85910 | int iOff = 1 + getVarint32(&zBuf[1], iSerial); | ||
| 85911 | sqlite3VdbeSerialGet(&zBuf[iOff], iSerial, pOut); | ||
| 85912 | pOut->enc = ENC(pOut->db); | ||
| 85913 | if( (pOut->flags & MEM_Ephem)!=0 && sqlite3VdbeMemMakeWriteable(pOut) ){ | ||
| 85914 | rc = SQLITE_NOMEM; | ||
| 85915 | }else{ | ||
| 85916 | *ppOut = pOut; | ||
| 85917 | } | ||
| 85918 | } | ||
| 85919 | sqlite3VdbeMemRelease(&sMem); | ||
| 85920 | } | ||
| 85921 | return rc; | ||
| 85922 | } | ||
| 85923 | |||
| 85924 | /* | ||
| 85925 | ** Set the iterator value pVal to point to the first value in the set. | ||
| 85926 | ** Set (*ppOut) to point to this value before returning. | ||
| 85927 | */ | ||
| 85928 | SQLITE_API int sqlite3_vtab_in_first(sqlite3_value *pVal, sqlite3_value **ppOut){ | ||
| 85929 | return valueFromValueList(pVal, ppOut, 0); | ||
| 85930 | } | ||
| 85931 | |||
| 85932 | /* | ||
| 85933 | ** Set the iterator value pVal to point to the next value in the set. | ||
| 85934 | ** Set (*ppOut) to point to this value before returning. | ||
| 85935 | */ | ||
| 85936 | SQLITE_API int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut){ | ||
| 85937 | return valueFromValueList(pVal, ppOut, 1); | ||
| 85938 | } | ||
| 85939 | |||
| 85940 | /* | ||
| 85279 | ** Return the current time for a statement. If the current time | 85941 | ** Return the current time for a statement. If the current time |
| 85280 | ** is requested more than once within the same run of a single prepared | 85942 | ** is requested more than once within the same run of a single prepared |
| 85281 | ** statement, the exact same time is returned for each invocation regardless | 85943 | ** statement, the exact same time is returned for each invocation regardless |
| @@ -85959,7 +86621,10 @@ SQLITE_API int sqlite3_bind_value(sqlite3_stmt *pStmt, int i, const sqlite3_valu | |||
| 85959 | break; | 86621 | break; |
| 85960 | } | 86622 | } |
| 85961 | case SQLITE_FLOAT: { | 86623 | case SQLITE_FLOAT: { |
| 85962 | rc = sqlite3_bind_double(pStmt, i, pValue->u.r); | 86624 | assert( pValue->flags & (MEM_Real|MEM_IntReal) ); |
| 86625 | rc = sqlite3_bind_double(pStmt, i, | ||
| 86626 | (pValue->flags & MEM_Real) ? pValue->u.r : (double)pValue->u.i | ||
| 86627 | ); | ||
| 85963 | break; | 86628 | break; |
| 85964 | } | 86629 | } |
| 85965 | case SQLITE_BLOB: { | 86630 | case SQLITE_BLOB: { |
| @@ -86939,7 +87604,6 @@ static VdbeCursor *allocateCursor( | |||
| 86939 | Vdbe *p, /* The virtual machine */ | 87604 | Vdbe *p, /* The virtual machine */ |
| 86940 | int iCur, /* Index of the new VdbeCursor */ | 87605 | int iCur, /* Index of the new VdbeCursor */ |
| 86941 | int nField, /* Number of fields in the table or index */ | 87606 | int nField, /* Number of fields in the table or index */ |
| 86942 | int iDb, /* Database the cursor belongs to, or -1 */ | ||
| 86943 | u8 eCurType /* Type of the new cursor */ | 87607 | u8 eCurType /* Type of the new cursor */ |
| 86944 | ){ | 87608 | ){ |
| 86945 | /* Find the memory cell that will be used to store the blob of memory | 87609 | /* Find the memory cell that will be used to store the blob of memory |
| @@ -86996,7 +87660,6 @@ static VdbeCursor *allocateCursor( | |||
| 86996 | p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->zMalloc; | 87660 | p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->zMalloc; |
| 86997 | memset(pCx, 0, offsetof(VdbeCursor,pAltCursor)); | 87661 | memset(pCx, 0, offsetof(VdbeCursor,pAltCursor)); |
| 86998 | pCx->eCurType = eCurType; | 87662 | pCx->eCurType = eCurType; |
| 86999 | pCx->iDb = iDb; | ||
| 87000 | pCx->nField = nField; | 87663 | pCx->nField = nField; |
| 87001 | pCx->aOffset = &pCx->aType[nField]; | 87664 | pCx->aOffset = &pCx->aType[nField]; |
| 87002 | if( eCurType==CURTYPE_BTREE ){ | 87665 | if( eCurType==CURTYPE_BTREE ){ |
| @@ -87370,6 +88033,29 @@ static Mem *out2Prerelease(Vdbe *p, VdbeOp *pOp){ | |||
| 87370 | } | 88033 | } |
| 87371 | 88034 | ||
| 87372 | /* | 88035 | /* |
| 88036 | ** Compute a bloom filter hash using pOp->p4.i registers from aMem[] beginning | ||
| 88037 | ** with pOp->p3. Return the hash. | ||
| 88038 | */ | ||
| 88039 | static u64 filterHash(const Mem *aMem, const Op *pOp){ | ||
| 88040 | int i, mx; | ||
| 88041 | u64 h = 0; | ||
| 88042 | |||
| 88043 | assert( pOp->p4type==P4_INT32 ); | ||
| 88044 | for(i=pOp->p3, mx=i+pOp->p4.i; i<mx; i++){ | ||
| 88045 | const Mem *p = &aMem[i]; | ||
| 88046 | if( p->flags & (MEM_Int|MEM_IntReal) ){ | ||
| 88047 | h += p->u.i; | ||
| 88048 | }else if( p->flags & MEM_Real ){ | ||
| 88049 | h += sqlite3VdbeIntValue(p); | ||
| 88050 | }else if( p->flags & (MEM_Str|MEM_Blob) ){ | ||
| 88051 | h += p->n; | ||
| 88052 | if( p->flags & MEM_Zero ) h += p->u.nZero; | ||
| 88053 | } | ||
| 88054 | } | ||
| 88055 | return h; | ||
| 88056 | } | ||
| 88057 | |||
| 88058 | /* | ||
| 87373 | ** Return the symbolic name for the data type of a pMem | 88059 | ** Return the symbolic name for the data type of a pMem |
| 87374 | */ | 88060 | */ |
| 87375 | static const char *vdbeMemTypeName(Mem *pMem){ | 88061 | static const char *vdbeMemTypeName(Mem *pMem){ |
| @@ -88023,12 +88709,18 @@ case OP_SoftNull: { | |||
| 88023 | ** Synopsis: r[P2]=P4 (len=P1) | 88709 | ** Synopsis: r[P2]=P4 (len=P1) |
| 88024 | ** | 88710 | ** |
| 88025 | ** P4 points to a blob of data P1 bytes long. Store this | 88711 | ** P4 points to a blob of data P1 bytes long. Store this |
| 88026 | ** blob in register P2. | 88712 | ** blob in register P2. If P4 is a NULL pointer, then construct |
| 88713 | ** a zero-filled blob that is P1 bytes long in P2. | ||
| 88027 | */ | 88714 | */ |
| 88028 | case OP_Blob: { /* out2 */ | 88715 | case OP_Blob: { /* out2 */ |
| 88029 | assert( pOp->p1 <= SQLITE_MAX_LENGTH ); | 88716 | assert( pOp->p1 <= SQLITE_MAX_LENGTH ); |
| 88030 | pOut = out2Prerelease(p, pOp); | 88717 | pOut = out2Prerelease(p, pOp); |
| 88031 | sqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0); | 88718 | if( pOp->p4.z==0 ){ |
| 88719 | sqlite3VdbeMemSetZeroBlob(pOut, pOp->p1); | ||
| 88720 | if( sqlite3VdbeMemExpandBlob(pOut) ) goto no_mem; | ||
| 88721 | }else{ | ||
| 88722 | sqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0); | ||
| 88723 | } | ||
| 88032 | pOut->enc = encoding; | 88724 | pOut->enc = encoding; |
| 88033 | UPDATE_MAX_BLOBSIZE(pOut); | 88725 | UPDATE_MAX_BLOBSIZE(pOut); |
| 88034 | break; | 88726 | break; |
| @@ -88177,24 +88869,22 @@ case OP_IntCopy: { /* out2 */ | |||
| 88177 | break; | 88869 | break; |
| 88178 | } | 88870 | } |
| 88179 | 88871 | ||
| 88180 | /* Opcode: ChngCntRow P1 P2 * * * | 88872 | /* Opcode: FkCheck * * * * * |
| 88181 | ** Synopsis: output=r[P1] | ||
| 88182 | ** | 88873 | ** |
| 88183 | ** Output value in register P1 as the chance count for a DML statement, | 88874 | ** Halt with an SQLITE_CONSTRAINT error if there are any unresolved |
| 88184 | ** due to the "PRAGMA count_changes=ON" setting. Or, if there was a | 88875 | ** foreign key constraint violations. If there are no foreign key |
| 88185 | ** foreign key error in the statement, trigger the error now. | 88876 | ** constraint violations, this is a no-op. |
| 88186 | ** | 88877 | ** |
| 88187 | ** This opcode is a variant of OP_ResultRow that checks the foreign key | 88878 | ** FK constraint violations are also checked when the prepared statement |
| 88188 | ** immediate constraint count and throws an error if the count is | 88879 | ** exits. This opcode is used to raise foreign key constraint errors prior |
| 88189 | ** non-zero. The P2 opcode must be 1. | 88880 | ** to returning results such as a row change count or the result of a |
| 88881 | ** RETURNING clause. | ||
| 88190 | */ | 88882 | */ |
| 88191 | case OP_ChngCntRow: { | 88883 | case OP_FkCheck: { |
| 88192 | assert( pOp->p2==1 ); | ||
| 88193 | if( (rc = sqlite3VdbeCheckFk(p,0))!=SQLITE_OK ){ | 88884 | if( (rc = sqlite3VdbeCheckFk(p,0))!=SQLITE_OK ){ |
| 88194 | goto abort_due_to_error; | 88885 | goto abort_due_to_error; |
| 88195 | } | 88886 | } |
| 88196 | /* Fall through to the next case, OP_ResultRow */ | 88887 | break; |
| 88197 | /* no break */ deliberate_fall_through | ||
| 88198 | } | 88888 | } |
| 88199 | 88889 | ||
| 88200 | /* Opcode: ResultRow P1 P2 * * * | 88890 | /* Opcode: ResultRow P1 P2 * * * |
| @@ -88832,7 +89522,7 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */ | |||
| 88832 | sqlite3VdbeMemStringify(pIn1, encoding, 1); | 89522 | sqlite3VdbeMemStringify(pIn1, encoding, 1); |
| 88833 | testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) ); | 89523 | testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) ); |
| 88834 | flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask); | 89524 | flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask); |
| 88835 | if( NEVER(pIn1==pIn3) ) flags3 = flags1 | MEM_Str; | 89525 | if( pIn1==pIn3 ) flags3 = flags1 | MEM_Str; |
| 88836 | } | 89526 | } |
| 88837 | if( (flags3 & MEM_Str)==0 && (flags3&(MEM_Int|MEM_Real|MEM_IntReal))!=0 ){ | 89527 | if( (flags3 & MEM_Str)==0 && (flags3&(MEM_Int|MEM_Real|MEM_IntReal))!=0 ){ |
| 88838 | testcase( pIn3->flags & MEM_Int ); | 89528 | testcase( pIn3->flags & MEM_Int ); |
| @@ -89362,6 +90052,7 @@ case OP_Column: { | |||
| 89362 | assert( pC!=0 ); | 90052 | assert( pC!=0 ); |
| 89363 | assert( p2<(u32)pC->nField ); | 90053 | assert( p2<(u32)pC->nField ); |
| 89364 | aOffset = pC->aOffset; | 90054 | aOffset = pC->aOffset; |
| 90055 | assert( aOffset==pC->aType+pC->nField ); | ||
| 89365 | assert( pC->eCurType!=CURTYPE_VTAB ); | 90056 | assert( pC->eCurType!=CURTYPE_VTAB ); |
| 89366 | assert( pC->eCurType!=CURTYPE_PSEUDO || pC->nullRow ); | 90057 | assert( pC->eCurType!=CURTYPE_PSEUDO || pC->nullRow ); |
| 89367 | assert( pC->eCurType!=CURTYPE_SORTER ); | 90058 | assert( pC->eCurType!=CURTYPE_SORTER ); |
| @@ -89657,6 +90348,8 @@ case OP_TypeCheck: { | |||
| 89657 | break; | 90348 | break; |
| 89658 | } | 90349 | } |
| 89659 | case COLTYPE_REAL: { | 90350 | case COLTYPE_REAL: { |
| 90351 | testcase( (pIn1->flags & (MEM_Real|MEM_IntReal))==MEM_Real ); | ||
| 90352 | testcase( (pIn1->flags & (MEM_Real|MEM_IntReal))==MEM_IntReal ); | ||
| 89660 | if( pIn1->flags & MEM_Int ){ | 90353 | if( pIn1->flags & MEM_Int ){ |
| 89661 | /* When applying REAL affinity, if the result is still an MEM_Int | 90354 | /* When applying REAL affinity, if the result is still an MEM_Int |
| 89662 | ** that will fit in 6 bytes, then change the type to MEM_IntReal | 90355 | ** that will fit in 6 bytes, then change the type to MEM_IntReal |
| @@ -89674,7 +90367,7 @@ case OP_TypeCheck: { | |||
| 89674 | pIn1->flags |= MEM_Real; | 90367 | pIn1->flags |= MEM_Real; |
| 89675 | pIn1->flags &= ~MEM_Int; | 90368 | pIn1->flags &= ~MEM_Int; |
| 89676 | } | 90369 | } |
| 89677 | }else if( (pIn1->flags & MEM_Real)==0 ){ | 90370 | }else if( (pIn1->flags & (MEM_Real|MEM_IntReal))==0 ){ |
| 89678 | goto vdbe_type_error; | 90371 | goto vdbe_type_error; |
| 89679 | } | 90372 | } |
| 89680 | break; | 90373 | break; |
| @@ -89913,7 +90606,7 @@ case OP_MakeRecord: { | |||
| 89913 | testcase( uu==127 ); testcase( uu==128 ); | 90606 | testcase( uu==127 ); testcase( uu==128 ); |
| 89914 | testcase( uu==32767 ); testcase( uu==32768 ); | 90607 | testcase( uu==32767 ); testcase( uu==32768 ); |
| 89915 | testcase( uu==8388607 ); testcase( uu==8388608 ); | 90608 | testcase( uu==8388607 ); testcase( uu==8388608 ); |
| 89916 | testcase( uu==2147483647 ); testcase( uu==2147483648 ); | 90609 | testcase( uu==2147483647 ); testcase( uu==2147483648LL ); |
| 89917 | testcase( uu==140737488355327LL ); testcase( uu==140737488355328LL ); | 90610 | testcase( uu==140737488355327LL ); testcase( uu==140737488355328LL ); |
| 89918 | if( uu<=127 ){ | 90611 | if( uu<=127 ){ |
| 89919 | if( (i&1)==i && file_format>=4 ){ | 90612 | if( (i&1)==i && file_format>=4 ){ |
| @@ -90041,7 +90734,7 @@ case OP_MakeRecord: { | |||
| 90041 | break; | 90734 | break; |
| 90042 | } | 90735 | } |
| 90043 | 90736 | ||
| 90044 | /* Opcode: Count P1 P2 p3 * * | 90737 | /* Opcode: Count P1 P2 P3 * * |
| 90045 | ** Synopsis: r[P2]=count() | 90738 | ** Synopsis: r[P2]=count() |
| 90046 | ** | 90739 | ** |
| 90047 | ** Store the number of entries (an integer value) in the table or index | 90740 | ** Store the number of entries (an integer value) in the table or index |
| @@ -90511,6 +91204,7 @@ case OP_SetCookie: { | |||
| 90511 | /* When the schema cookie changes, record the new cookie internally */ | 91204 | /* When the schema cookie changes, record the new cookie internally */ |
| 90512 | pDb->pSchema->schema_cookie = pOp->p3 - pOp->p5; | 91205 | pDb->pSchema->schema_cookie = pOp->p3 - pOp->p5; |
| 90513 | db->mDbFlags |= DBFLAG_SchemaChange; | 91206 | db->mDbFlags |= DBFLAG_SchemaChange; |
| 91207 | sqlite3FkClearTriggerCache(db, pOp->p1); | ||
| 90514 | }else if( pOp->p2==BTREE_FILE_FORMAT ){ | 91208 | }else if( pOp->p2==BTREE_FILE_FORMAT ){ |
| 90515 | /* Record changes in the file format */ | 91209 | /* Record changes in the file format */ |
| 90516 | pDb->pSchema->file_format = pOp->p3; | 91210 | pDb->pSchema->file_format = pOp->p3; |
| @@ -90688,8 +91382,9 @@ case OP_OpenWrite: | |||
| 90688 | assert( pOp->p1>=0 ); | 91382 | assert( pOp->p1>=0 ); |
| 90689 | assert( nField>=0 ); | 91383 | assert( nField>=0 ); |
| 90690 | testcase( nField==0 ); /* Table with INTEGER PRIMARY KEY and nothing else */ | 91384 | testcase( nField==0 ); /* Table with INTEGER PRIMARY KEY and nothing else */ |
| 90691 | pCur = allocateCursor(p, pOp->p1, nField, iDb, CURTYPE_BTREE); | 91385 | pCur = allocateCursor(p, pOp->p1, nField, CURTYPE_BTREE); |
| 90692 | if( pCur==0 ) goto no_mem; | 91386 | if( pCur==0 ) goto no_mem; |
| 91387 | pCur->iDb = iDb; | ||
| 90693 | pCur->nullRow = 1; | 91388 | pCur->nullRow = 1; |
| 90694 | pCur->isOrdered = 1; | 91389 | pCur->isOrdered = 1; |
| 90695 | pCur->pgnoRoot = p2; | 91390 | pCur->pgnoRoot = p2; |
| @@ -90731,7 +91426,7 @@ case OP_OpenDup: { | |||
| 90731 | assert( pOrig ); | 91426 | assert( pOrig ); |
| 90732 | assert( pOrig->isEphemeral ); /* Only ephemeral cursors can be duplicated */ | 91427 | assert( pOrig->isEphemeral ); /* Only ephemeral cursors can be duplicated */ |
| 90733 | 91428 | ||
| 90734 | pCx = allocateCursor(p, pOp->p1, pOrig->nField, -1, CURTYPE_BTREE); | 91429 | pCx = allocateCursor(p, pOp->p1, pOrig->nField, CURTYPE_BTREE); |
| 90735 | if( pCx==0 ) goto no_mem; | 91430 | if( pCx==0 ) goto no_mem; |
| 90736 | pCx->nullRow = 1; | 91431 | pCx->nullRow = 1; |
| 90737 | pCx->isEphemeral = 1; | 91432 | pCx->isEphemeral = 1; |
| @@ -90739,10 +91434,10 @@ case OP_OpenDup: { | |||
| 90739 | pCx->isTable = pOrig->isTable; | 91434 | pCx->isTable = pOrig->isTable; |
| 90740 | pCx->pgnoRoot = pOrig->pgnoRoot; | 91435 | pCx->pgnoRoot = pOrig->pgnoRoot; |
| 90741 | pCx->isOrdered = pOrig->isOrdered; | 91436 | pCx->isOrdered = pOrig->isOrdered; |
| 90742 | pCx->pBtx = pOrig->pBtx; | 91437 | pCx->ub.pBtx = pOrig->ub.pBtx; |
| 90743 | pCx->hasBeenDuped = 1; | 91438 | pCx->hasBeenDuped = 1; |
| 90744 | pOrig->hasBeenDuped = 1; | 91439 | pOrig->hasBeenDuped = 1; |
| 90745 | rc = sqlite3BtreeCursor(pCx->pBtx, pCx->pgnoRoot, BTREE_WRCSR, | 91440 | rc = sqlite3BtreeCursor(pCx->ub.pBtx, pCx->pgnoRoot, BTREE_WRCSR, |
| 90746 | pCx->pKeyInfo, pCx->uc.pCursor); | 91441 | pCx->pKeyInfo, pCx->uc.pCursor); |
| 90747 | /* The sqlite3BtreeCursor() routine can only fail for the first cursor | 91442 | /* The sqlite3BtreeCursor() routine can only fail for the first cursor |
| 90748 | ** opened for a database. Since there is already an open cursor when this | 91443 | ** opened for a database. Since there is already an open cursor when this |
| @@ -90815,16 +91510,16 @@ case OP_OpenEphemeral: { | |||
| 90815 | assert( pCx->isEphemeral ); | 91510 | assert( pCx->isEphemeral ); |
| 90816 | pCx->seqCount = 0; | 91511 | pCx->seqCount = 0; |
| 90817 | pCx->cacheStatus = CACHE_STALE; | 91512 | pCx->cacheStatus = CACHE_STALE; |
| 90818 | rc = sqlite3BtreeClearTable(pCx->pBtx, pCx->pgnoRoot, 0); | 91513 | rc = sqlite3BtreeClearTable(pCx->ub.pBtx, pCx->pgnoRoot, 0); |
| 90819 | }else{ | 91514 | }else{ |
| 90820 | pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_BTREE); | 91515 | pCx = allocateCursor(p, pOp->p1, pOp->p2, CURTYPE_BTREE); |
| 90821 | if( pCx==0 ) goto no_mem; | 91516 | if( pCx==0 ) goto no_mem; |
| 90822 | pCx->isEphemeral = 1; | 91517 | pCx->isEphemeral = 1; |
| 90823 | rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->pBtx, | 91518 | rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->ub.pBtx, |
| 90824 | BTREE_OMIT_JOURNAL | BTREE_SINGLE | pOp->p5, | 91519 | BTREE_OMIT_JOURNAL | BTREE_SINGLE | pOp->p5, |
| 90825 | vfsFlags); | 91520 | vfsFlags); |
| 90826 | if( rc==SQLITE_OK ){ | 91521 | if( rc==SQLITE_OK ){ |
| 90827 | rc = sqlite3BtreeBeginTrans(pCx->pBtx, 1, 0); | 91522 | rc = sqlite3BtreeBeginTrans(pCx->ub.pBtx, 1, 0); |
| 90828 | if( rc==SQLITE_OK ){ | 91523 | if( rc==SQLITE_OK ){ |
| 90829 | /* If a transient index is required, create it by calling | 91524 | /* If a transient index is required, create it by calling |
| 90830 | ** sqlite3BtreeCreateTable() with the BTREE_BLOBKEY flag before | 91525 | ** sqlite3BtreeCreateTable() with the BTREE_BLOBKEY flag before |
| @@ -90833,26 +91528,26 @@ case OP_OpenEphemeral: { | |||
| 90833 | */ | 91528 | */ |
| 90834 | if( (pCx->pKeyInfo = pKeyInfo = pOp->p4.pKeyInfo)!=0 ){ | 91529 | if( (pCx->pKeyInfo = pKeyInfo = pOp->p4.pKeyInfo)!=0 ){ |
| 90835 | assert( pOp->p4type==P4_KEYINFO ); | 91530 | assert( pOp->p4type==P4_KEYINFO ); |
| 90836 | rc = sqlite3BtreeCreateTable(pCx->pBtx, &pCx->pgnoRoot, | 91531 | rc = sqlite3BtreeCreateTable(pCx->ub.pBtx, &pCx->pgnoRoot, |
| 90837 | BTREE_BLOBKEY | pOp->p5); | 91532 | BTREE_BLOBKEY | pOp->p5); |
| 90838 | if( rc==SQLITE_OK ){ | 91533 | if( rc==SQLITE_OK ){ |
| 90839 | assert( pCx->pgnoRoot==SCHEMA_ROOT+1 ); | 91534 | assert( pCx->pgnoRoot==SCHEMA_ROOT+1 ); |
| 90840 | assert( pKeyInfo->db==db ); | 91535 | assert( pKeyInfo->db==db ); |
| 90841 | assert( pKeyInfo->enc==ENC(db) ); | 91536 | assert( pKeyInfo->enc==ENC(db) ); |
| 90842 | rc = sqlite3BtreeCursor(pCx->pBtx, pCx->pgnoRoot, BTREE_WRCSR, | 91537 | rc = sqlite3BtreeCursor(pCx->ub.pBtx, pCx->pgnoRoot, BTREE_WRCSR, |
| 90843 | pKeyInfo, pCx->uc.pCursor); | 91538 | pKeyInfo, pCx->uc.pCursor); |
| 90844 | } | 91539 | } |
| 90845 | pCx->isTable = 0; | 91540 | pCx->isTable = 0; |
| 90846 | }else{ | 91541 | }else{ |
| 90847 | pCx->pgnoRoot = SCHEMA_ROOT; | 91542 | pCx->pgnoRoot = SCHEMA_ROOT; |
| 90848 | rc = sqlite3BtreeCursor(pCx->pBtx, SCHEMA_ROOT, BTREE_WRCSR, | 91543 | rc = sqlite3BtreeCursor(pCx->ub.pBtx, SCHEMA_ROOT, BTREE_WRCSR, |
| 90849 | 0, pCx->uc.pCursor); | 91544 | 0, pCx->uc.pCursor); |
| 90850 | pCx->isTable = 1; | 91545 | pCx->isTable = 1; |
| 90851 | } | 91546 | } |
| 90852 | } | 91547 | } |
| 90853 | pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED); | 91548 | pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED); |
| 90854 | if( rc ){ | 91549 | if( rc ){ |
| 90855 | sqlite3BtreeClose(pCx->pBtx); | 91550 | sqlite3BtreeClose(pCx->ub.pBtx); |
| 90856 | } | 91551 | } |
| 90857 | } | 91552 | } |
| 90858 | } | 91553 | } |
| @@ -90876,7 +91571,7 @@ case OP_SorterOpen: { | |||
| 90876 | 91571 | ||
| 90877 | assert( pOp->p1>=0 ); | 91572 | assert( pOp->p1>=0 ); |
| 90878 | assert( pOp->p2>=0 ); | 91573 | assert( pOp->p2>=0 ); |
| 90879 | pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_SORTER); | 91574 | pCx = allocateCursor(p, pOp->p1, pOp->p2, CURTYPE_SORTER); |
| 90880 | if( pCx==0 ) goto no_mem; | 91575 | if( pCx==0 ) goto no_mem; |
| 90881 | pCx->pKeyInfo = pOp->p4.pKeyInfo; | 91576 | pCx->pKeyInfo = pOp->p4.pKeyInfo; |
| 90882 | assert( pCx->pKeyInfo->db==db ); | 91577 | assert( pCx->pKeyInfo->db==db ); |
| @@ -90925,7 +91620,7 @@ case OP_OpenPseudo: { | |||
| 90925 | 91620 | ||
| 90926 | assert( pOp->p1>=0 ); | 91621 | assert( pOp->p1>=0 ); |
| 90927 | assert( pOp->p3>=0 ); | 91622 | assert( pOp->p3>=0 ); |
| 90928 | pCx = allocateCursor(p, pOp->p1, pOp->p3, -1, CURTYPE_PSEUDO); | 91623 | pCx = allocateCursor(p, pOp->p1, pOp->p3, CURTYPE_PSEUDO); |
| 90929 | if( pCx==0 ) goto no_mem; | 91624 | if( pCx==0 ) goto no_mem; |
| 90930 | pCx->nullRow = 1; | 91625 | pCx->nullRow = 1; |
| 90931 | pCx->seekResult = pOp->p2; | 91626 | pCx->seekResult = pOp->p2; |
| @@ -92865,9 +93560,9 @@ case OP_IdxRowid: { /* out2 */ | |||
| 92865 | pTabCur->movetoTarget = rowid; | 93560 | pTabCur->movetoTarget = rowid; |
| 92866 | pTabCur->deferredMoveto = 1; | 93561 | pTabCur->deferredMoveto = 1; |
| 92867 | assert( pOp->p4type==P4_INTARRAY || pOp->p4.ai==0 ); | 93562 | assert( pOp->p4type==P4_INTARRAY || pOp->p4.ai==0 ); |
| 92868 | pTabCur->aAltMap = pOp->p4.ai; | ||
| 92869 | assert( !pC->isEphemeral ); | ||
| 92870 | assert( !pTabCur->isEphemeral ); | 93563 | assert( !pTabCur->isEphemeral ); |
| 93564 | pTabCur->ub.aAltMap = pOp->p4.ai; | ||
| 93565 | assert( !pC->isEphemeral ); | ||
| 92871 | pTabCur->pAltCursor = pC; | 93566 | pTabCur->pAltCursor = pC; |
| 92872 | }else{ | 93567 | }else{ |
| 92873 | pOut = out2Prerelease(p, pOp); | 93568 | pOut = out2Prerelease(p, pOp); |
| @@ -94389,7 +95084,7 @@ case OP_VOpen: { | |||
| 94389 | pVCur->pVtab = pVtab; | 95084 | pVCur->pVtab = pVtab; |
| 94390 | 95085 | ||
| 94391 | /* Initialize vdbe cursor object */ | 95086 | /* Initialize vdbe cursor object */ |
| 94392 | pCur = allocateCursor(p, pOp->p1, 0, -1, CURTYPE_VTAB); | 95087 | pCur = allocateCursor(p, pOp->p1, 0, CURTYPE_VTAB); |
| 94393 | if( pCur ){ | 95088 | if( pCur ){ |
| 94394 | pCur->uc.pVCur = pVCur; | 95089 | pCur->uc.pVCur = pVCur; |
| 94395 | pVtab->nRef++; | 95090 | pVtab->nRef++; |
| @@ -94403,6 +95098,34 @@ case OP_VOpen: { | |||
| 94403 | #endif /* SQLITE_OMIT_VIRTUALTABLE */ | 95098 | #endif /* SQLITE_OMIT_VIRTUALTABLE */ |
| 94404 | 95099 | ||
| 94405 | #ifndef SQLITE_OMIT_VIRTUALTABLE | 95100 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 95101 | /* Opcode: VInitIn P1 P2 P3 * * | ||
| 95102 | ** Synopsis: r[P2]=ValueList(P1,P3) | ||
| 95103 | ** | ||
| 95104 | ** Set register P2 to be a pointer to a ValueList object for cursor P1 | ||
| 95105 | ** with cache register P3 and output register P3+1. This ValueList object | ||
| 95106 | ** can be used as the first argument to sqlite3_vtab_in_first() and | ||
| 95107 | ** sqlite3_vtab_in_next() to extract all of the values stored in the P1 | ||
| 95108 | ** cursor. Register P3 is used to hold the values returned by | ||
| 95109 | ** sqlite3_vtab_in_first() and sqlite3_vtab_in_next(). | ||
| 95110 | */ | ||
| 95111 | case OP_VInitIn: { /* out2 */ | ||
| 95112 | VdbeCursor *pC; /* The cursor containing the RHS values */ | ||
| 95113 | ValueList *pRhs; /* New ValueList object to put in reg[P2] */ | ||
| 95114 | |||
| 95115 | pC = p->apCsr[pOp->p1]; | ||
| 95116 | pRhs = sqlite3_malloc64( sizeof(*pRhs) ); | ||
| 95117 | if( pRhs==0 ) goto no_mem; | ||
| 95118 | pRhs->pCsr = pC->uc.pCursor; | ||
| 95119 | pRhs->pOut = &aMem[pOp->p3]; | ||
| 95120 | pOut = out2Prerelease(p, pOp); | ||
| 95121 | pOut->flags = MEM_Null; | ||
| 95122 | sqlite3VdbeMemSetPointer(pOut, pRhs, "ValueList", sqlite3_free); | ||
| 95123 | break; | ||
| 95124 | } | ||
| 95125 | #endif /* SQLITE_OMIT_VIRTUALTABLE */ | ||
| 95126 | |||
| 95127 | |||
| 95128 | #ifndef SQLITE_OMIT_VIRTUALTABLE | ||
| 94406 | /* Opcode: VFilter P1 P2 P3 P4 * | 95129 | /* Opcode: VFilter P1 P2 P3 P4 * |
| 94407 | ** Synopsis: iplan=r[P3] zplan='P4' | 95130 | ** Synopsis: iplan=r[P3] zplan='P4' |
| 94408 | ** | 95131 | ** |
| @@ -94827,6 +95550,77 @@ case OP_Function: { /* group */ | |||
| 94827 | break; | 95550 | break; |
| 94828 | } | 95551 | } |
| 94829 | 95552 | ||
| 95553 | /* Opcode: FilterAdd P1 * P3 P4 * | ||
| 95554 | ** Synopsis: filter(P1) += key(P3@P4) | ||
| 95555 | ** | ||
| 95556 | ** Compute a hash on the P4 registers starting with r[P3] and | ||
| 95557 | ** add that hash to the bloom filter contained in r[P1]. | ||
| 95558 | */ | ||
| 95559 | case OP_FilterAdd: { | ||
| 95560 | u64 h; | ||
| 95561 | |||
| 95562 | assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) ); | ||
| 95563 | pIn1 = &aMem[pOp->p1]; | ||
| 95564 | assert( pIn1->flags & MEM_Blob ); | ||
| 95565 | assert( pIn1->n>0 ); | ||
| 95566 | h = filterHash(aMem, pOp); | ||
| 95567 | #ifdef SQLITE_DEBUG | ||
| 95568 | if( db->flags&SQLITE_VdbeTrace ){ | ||
| 95569 | int ii; | ||
| 95570 | for(ii=pOp->p3; ii<pOp->p3+pOp->p4.i; ii++){ | ||
| 95571 | registerTrace(ii, &aMem[ii]); | ||
| 95572 | } | ||
| 95573 | printf("hash: %llu modulo %d -> %u\n", h, pIn1->n, (int)(h%pIn1->n)); | ||
| 95574 | } | ||
| 95575 | #endif | ||
| 95576 | h %= pIn1->n; | ||
| 95577 | pIn1->z[h/8] |= 1<<(h&7); | ||
| 95578 | break; | ||
| 95579 | } | ||
| 95580 | |||
| 95581 | /* Opcode: Filter P1 P2 P3 P4 * | ||
| 95582 | ** Synopsis: if key(P3@P4) not in filter(P1) goto P2 | ||
| 95583 | ** | ||
| 95584 | ** Compute a hash on the key contained in the P4 registers starting | ||
| 95585 | ** with r[P3]. Check to see if that hash is found in the | ||
| 95586 | ** bloom filter hosted by register P1. If it is not present then | ||
| 95587 | ** maybe jump to P2. Otherwise fall through. | ||
| 95588 | ** | ||
| 95589 | ** False negatives are harmless. It is always safe to fall through, | ||
| 95590 | ** even if the value is in the bloom filter. A false negative causes | ||
| 95591 | ** more CPU cycles to be used, but it should still yield the correct | ||
| 95592 | ** answer. However, an incorrect answer may well arise from a | ||
| 95593 | ** false positive - if the jump is taken when it should fall through. | ||
| 95594 | */ | ||
| 95595 | case OP_Filter: { /* jump */ | ||
| 95596 | u64 h; | ||
| 95597 | |||
| 95598 | assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) ); | ||
| 95599 | pIn1 = &aMem[pOp->p1]; | ||
| 95600 | assert( (pIn1->flags & MEM_Blob)!=0 ); | ||
| 95601 | assert( pIn1->n >= 1 ); | ||
| 95602 | h = filterHash(aMem, pOp); | ||
| 95603 | #ifdef SQLITE_DEBUG | ||
| 95604 | if( db->flags&SQLITE_VdbeTrace ){ | ||
| 95605 | int ii; | ||
| 95606 | for(ii=pOp->p3; ii<pOp->p3+pOp->p4.i; ii++){ | ||
| 95607 | registerTrace(ii, &aMem[ii]); | ||
| 95608 | } | ||
| 95609 | printf("hash: %llu modulo %d -> %u\n", h, pIn1->n, (int)(h%pIn1->n)); | ||
| 95610 | } | ||
| 95611 | #endif | ||
| 95612 | h %= pIn1->n; | ||
| 95613 | if( (pIn1->z[h/8] & (1<<(h&7)))==0 ){ | ||
| 95614 | VdbeBranchTaken(1, 2); | ||
| 95615 | p->aCounter[SQLITE_STMTSTATUS_FILTER_HIT]++; | ||
| 95616 | goto jump_to_p2; | ||
| 95617 | }else{ | ||
| 95618 | p->aCounter[SQLITE_STMTSTATUS_FILTER_MISS]++; | ||
| 95619 | VdbeBranchTaken(0, 2); | ||
| 95620 | } | ||
| 95621 | break; | ||
| 95622 | } | ||
| 95623 | |||
| 94830 | /* Opcode: Trace P1 P2 * P4 * | 95624 | /* Opcode: Trace P1 P2 * P4 * |
| 94831 | ** | 95625 | ** |
| 94832 | ** Write P4 on the statement trace output if statement tracing is | 95626 | ** Write P4 on the statement trace output if statement tracing is |
| @@ -95317,10 +96111,9 @@ SQLITE_API int sqlite3_blob_open( | |||
| 95317 | sqlite3_mutex_enter(db->mutex); | 96111 | sqlite3_mutex_enter(db->mutex); |
| 95318 | 96112 | ||
| 95319 | pBlob = (Incrblob *)sqlite3DbMallocZero(db, sizeof(Incrblob)); | 96113 | pBlob = (Incrblob *)sqlite3DbMallocZero(db, sizeof(Incrblob)); |
| 95320 | do { | 96114 | while(1){ |
| 95321 | memset(&sParse, 0, sizeof(Parse)); | 96115 | sqlite3ParseObjectInit(&sParse,db); |
| 95322 | if( !pBlob ) goto blob_open_out; | 96116 | if( !pBlob ) goto blob_open_out; |
| 95323 | sParse.db = db; | ||
| 95324 | sqlite3DbFree(db, zErr); | 96117 | sqlite3DbFree(db, zErr); |
| 95325 | zErr = 0; | 96118 | zErr = 0; |
| 95326 | 96119 | ||
| @@ -95497,7 +96290,9 @@ SQLITE_API int sqlite3_blob_open( | |||
| 95497 | goto blob_open_out; | 96290 | goto blob_open_out; |
| 95498 | } | 96291 | } |
| 95499 | rc = blobSeekToRow(pBlob, iRow, &zErr); | 96292 | rc = blobSeekToRow(pBlob, iRow, &zErr); |
| 95500 | } while( (++nAttempt)<SQLITE_MAX_SCHEMA_RETRY && rc==SQLITE_SCHEMA ); | 96293 | if( (++nAttempt)>=SQLITE_MAX_SCHEMA_RETRY || rc!=SQLITE_SCHEMA ) break; |
| 96294 | sqlite3ParseObjectReset(&sParse); | ||
| 96295 | } | ||
| 95501 | 96296 | ||
| 95502 | blob_open_out: | 96297 | blob_open_out: |
| 95503 | if( rc==SQLITE_OK && db->mallocFailed==0 ){ | 96298 | if( rc==SQLITE_OK && db->mallocFailed==0 ){ |
| @@ -95508,7 +96303,7 @@ blob_open_out: | |||
| 95508 | } | 96303 | } |
| 95509 | sqlite3ErrorWithMsg(db, rc, (zErr ? "%s" : 0), zErr); | 96304 | sqlite3ErrorWithMsg(db, rc, (zErr ? "%s" : 0), zErr); |
| 95510 | sqlite3DbFree(db, zErr); | 96305 | sqlite3DbFree(db, zErr); |
| 95511 | sqlite3ParserReset(&sParse); | 96306 | sqlite3ParseObjectReset(&sParse); |
| 95512 | rc = sqlite3ApiExit(db, rc); | 96307 | rc = sqlite3ApiExit(db, rc); |
| 95513 | sqlite3_mutex_leave(db->mutex); | 96308 | sqlite3_mutex_leave(db->mutex); |
| 95514 | return rc; | 96309 | return rc; |
| @@ -96643,7 +97438,8 @@ SQLITE_PRIVATE int sqlite3VdbeSorterInit( | |||
| 96643 | } | 97438 | } |
| 96644 | #endif | 97439 | #endif |
| 96645 | 97440 | ||
| 96646 | assert( pCsr->pKeyInfo && pCsr->pBtx==0 ); | 97441 | assert( pCsr->pKeyInfo ); |
| 97442 | assert( !pCsr->isEphemeral ); | ||
| 96647 | assert( pCsr->eCurType==CURTYPE_SORTER ); | 97443 | assert( pCsr->eCurType==CURTYPE_SORTER ); |
| 96648 | szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nKeyField-1)*sizeof(CollSeq*); | 97444 | szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nKeyField-1)*sizeof(CollSeq*); |
| 96649 | sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask); | 97445 | sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask); |
| @@ -99056,6 +99852,9 @@ static int memjrnlCreateFile(MemJournal *p){ | |||
| 99056 | } | 99852 | } |
| 99057 | 99853 | ||
| 99058 | 99854 | ||
| 99855 | /* Forward reference */ | ||
| 99856 | static int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size); | ||
| 99857 | |||
| 99059 | /* | 99858 | /* |
| 99060 | ** Write data to the file. | 99859 | ** Write data to the file. |
| 99061 | */ | 99860 | */ |
| @@ -99086,22 +99885,20 @@ static int memjrnlWrite( | |||
| 99086 | ** the in-memory journal is being used by a connection using the | 99885 | ** the in-memory journal is being used by a connection using the |
| 99087 | ** atomic-write optimization. In this case the first 28 bytes of the | 99886 | ** atomic-write optimization. In this case the first 28 bytes of the |
| 99088 | ** journal file may be written as part of committing the transaction. */ | 99887 | ** journal file may be written as part of committing the transaction. */ |
| 99089 | assert( iOfst==p->endpoint.iOffset || iOfst==0 ); | 99888 | assert( iOfst<=p->endpoint.iOffset ); |
| 99090 | #if defined(SQLITE_ENABLE_ATOMIC_WRITE) \ | 99889 | if( iOfst>0 && iOfst!=p->endpoint.iOffset ){ |
| 99091 | || defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE) | 99890 | memjrnlTruncate(pJfd, iOfst); |
| 99891 | } | ||
| 99092 | if( iOfst==0 && p->pFirst ){ | 99892 | if( iOfst==0 && p->pFirst ){ |
| 99093 | assert( p->nChunkSize>iAmt ); | 99893 | assert( p->nChunkSize>iAmt ); |
| 99094 | memcpy((u8*)p->pFirst->zChunk, zBuf, iAmt); | 99894 | memcpy((u8*)p->pFirst->zChunk, zBuf, iAmt); |
| 99095 | }else | 99895 | }else{ |
| 99096 | #else | ||
| 99097 | assert( iOfst>0 || p->pFirst==0 ); | ||
| 99098 | #endif | ||
| 99099 | { | ||
| 99100 | while( nWrite>0 ){ | 99896 | while( nWrite>0 ){ |
| 99101 | FileChunk *pChunk = p->endpoint.pChunk; | 99897 | FileChunk *pChunk = p->endpoint.pChunk; |
| 99102 | int iChunkOffset = (int)(p->endpoint.iOffset%p->nChunkSize); | 99898 | int iChunkOffset = (int)(p->endpoint.iOffset%p->nChunkSize); |
| 99103 | int iSpace = MIN(nWrite, p->nChunkSize - iChunkOffset); | 99899 | int iSpace = MIN(nWrite, p->nChunkSize - iChunkOffset); |
| 99104 | 99900 | ||
| 99901 | assert( pChunk!=0 || iChunkOffset==0 ); | ||
| 99105 | if( iChunkOffset==0 ){ | 99902 | if( iChunkOffset==0 ){ |
| 99106 | /* New chunk is required to extend the file. */ | 99903 | /* New chunk is required to extend the file. */ |
| 99107 | FileChunk *pNew = sqlite3_malloc(fileChunkSize(p->nChunkSize)); | 99904 | FileChunk *pNew = sqlite3_malloc(fileChunkSize(p->nChunkSize)); |
| @@ -99116,10 +99913,11 @@ static int memjrnlWrite( | |||
| 99116 | assert( !p->pFirst ); | 99913 | assert( !p->pFirst ); |
| 99117 | p->pFirst = pNew; | 99914 | p->pFirst = pNew; |
| 99118 | } | 99915 | } |
| 99119 | p->endpoint.pChunk = pNew; | 99916 | pChunk = p->endpoint.pChunk = pNew; |
| 99120 | } | 99917 | } |
| 99121 | 99918 | ||
| 99122 | memcpy((u8*)p->endpoint.pChunk->zChunk + iChunkOffset, zWrite, iSpace); | 99919 | assert( pChunk!=0 ); |
| 99920 | memcpy((u8*)pChunk->zChunk + iChunkOffset, zWrite, iSpace); | ||
| 99123 | zWrite += iSpace; | 99921 | zWrite += iSpace; |
| 99124 | nWrite -= iSpace; | 99922 | nWrite -= iSpace; |
| 99125 | p->endpoint.iOffset += iSpace; | 99923 | p->endpoint.iOffset += iSpace; |
| @@ -99143,7 +99941,7 @@ static int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){ | |||
| 99143 | p->pFirst = 0; | 99941 | p->pFirst = 0; |
| 99144 | }else{ | 99942 | }else{ |
| 99145 | i64 iOff = p->nChunkSize; | 99943 | i64 iOff = p->nChunkSize; |
| 99146 | for(pIter=p->pFirst; ALWAYS(pIter) && iOff<=size; pIter=pIter->pNext){ | 99944 | for(pIter=p->pFirst; ALWAYS(pIter) && iOff<size; pIter=pIter->pNext){ |
| 99147 | iOff += p->nChunkSize; | 99945 | iOff += p->nChunkSize; |
| 99148 | } | 99946 | } |
| 99149 | if( ALWAYS(pIter) ){ | 99947 | if( ALWAYS(pIter) ){ |
| @@ -99897,8 +100695,9 @@ static int lookupName( | |||
| 99897 | } | 100695 | } |
| 99898 | if( hit || zTab==0 ) continue; | 100696 | if( hit || zTab==0 ) continue; |
| 99899 | } | 100697 | } |
| 99900 | if( zDb && pTab->pSchema!=pSchema ){ | 100698 | if( zDb ){ |
| 99901 | continue; | 100699 | if( pTab->pSchema!=pSchema ) continue; |
| 100700 | if( pSchema==0 && strcmp(zDb,"*")!=0 ) continue; | ||
| 99902 | } | 100701 | } |
| 99903 | if( zTab ){ | 100702 | if( zTab ){ |
| 99904 | const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName; | 100703 | const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName; |
| @@ -100029,6 +100828,7 @@ static int lookupName( | |||
| 100029 | pExpr->y.pTab = pTab; | 100828 | pExpr->y.pTab = pTab; |
| 100030 | if( pParse->bReturning ){ | 100829 | if( pParse->bReturning ){ |
| 100031 | eNewExprOp = TK_REGISTER; | 100830 | eNewExprOp = TK_REGISTER; |
| 100831 | pExpr->op2 = TK_COLUMN; | ||
| 100032 | pExpr->iTable = pNC->uNC.iBaseReg + (pTab->nCol+1)*pExpr->iTable + | 100832 | pExpr->iTable = pNC->uNC.iBaseReg + (pTab->nCol+1)*pExpr->iTable + |
| 100033 | sqlite3TableColumnToStorage(pTab, iCol) + 1; | 100833 | sqlite3TableColumnToStorage(pTab, iCol) + 1; |
| 100034 | }else{ | 100834 | }else{ |
| @@ -100195,6 +100995,7 @@ static int lookupName( | |||
| 100195 | }else{ | 100995 | }else{ |
| 100196 | sqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol); | 100996 | sqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol); |
| 100197 | } | 100997 | } |
| 100998 | sqlite3RecordErrorOffsetOfExpr(pParse->db, pExpr); | ||
| 100198 | pParse->checkSchema = 1; | 100999 | pParse->checkSchema = 1; |
| 100199 | pTopNC->nNcErr++; | 101000 | pTopNC->nNcErr++; |
| 100200 | } | 101001 | } |
| @@ -100303,7 +101104,8 @@ static void notValidImpl( | |||
| 100303 | Parse *pParse, /* Leave error message here */ | 101104 | Parse *pParse, /* Leave error message here */ |
| 100304 | NameContext *pNC, /* The name context */ | 101105 | NameContext *pNC, /* The name context */ |
| 100305 | const char *zMsg, /* Type of error */ | 101106 | const char *zMsg, /* Type of error */ |
| 100306 | Expr *pExpr /* Invalidate this expression on error */ | 101107 | Expr *pExpr, /* Invalidate this expression on error */ |
| 101108 | Expr *pError /* Associate error with this expression */ | ||
| 100307 | ){ | 101109 | ){ |
| 100308 | const char *zIn = "partial index WHERE clauses"; | 101110 | const char *zIn = "partial index WHERE clauses"; |
| 100309 | if( pNC->ncFlags & NC_IdxExpr ) zIn = "index expressions"; | 101111 | if( pNC->ncFlags & NC_IdxExpr ) zIn = "index expressions"; |
| @@ -100315,10 +101117,11 @@ static void notValidImpl( | |||
| 100315 | #endif | 101117 | #endif |
| 100316 | sqlite3ErrorMsg(pParse, "%s prohibited in %s", zMsg, zIn); | 101118 | sqlite3ErrorMsg(pParse, "%s prohibited in %s", zMsg, zIn); |
| 100317 | if( pExpr ) pExpr->op = TK_NULL; | 101119 | if( pExpr ) pExpr->op = TK_NULL; |
| 101120 | sqlite3RecordErrorOffsetOfExpr(pParse->db, pError); | ||
| 100318 | } | 101121 | } |
| 100319 | #define sqlite3ResolveNotValid(P,N,M,X,E) \ | 101122 | #define sqlite3ResolveNotValid(P,N,M,X,E,R) \ |
| 100320 | assert( ((X)&~(NC_IsCheck|NC_PartIdx|NC_IdxExpr|NC_GenCol))==0 ); \ | 101123 | assert( ((X)&~(NC_IsCheck|NC_PartIdx|NC_IdxExpr|NC_GenCol))==0 ); \ |
| 100321 | if( ((N)->ncFlags & (X))!=0 ) notValidImpl(P,N,M,E); | 101124 | if( ((N)->ncFlags & (X))!=0 ) notValidImpl(P,N,M,E,R); |
| 100322 | 101125 | ||
| 100323 | /* | 101126 | /* |
| 100324 | ** Expression p should encode a floating point value between 1.0 and 0.0. | 101127 | ** Expression p should encode a floating point value between 1.0 and 0.0. |
| @@ -100453,7 +101256,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ | |||
| 100453 | testcase( pNC->ncFlags & NC_IdxExpr ); | 101256 | testcase( pNC->ncFlags & NC_IdxExpr ); |
| 100454 | testcase( pNC->ncFlags & NC_GenCol ); | 101257 | testcase( pNC->ncFlags & NC_GenCol ); |
| 100455 | sqlite3ResolveNotValid(pParse, pNC, "the \".\" operator", | 101258 | sqlite3ResolveNotValid(pParse, pNC, "the \".\" operator", |
| 100456 | NC_IdxExpr|NC_GenCol, 0); | 101259 | NC_IdxExpr|NC_GenCol, 0, pExpr); |
| 100457 | pRight = pExpr->pRight; | 101260 | pRight = pExpr->pRight; |
| 100458 | if( pRight->op==TK_ID ){ | 101261 | if( pRight->op==TK_ID ){ |
| 100459 | zDb = 0; | 101262 | zDb = 0; |
| @@ -100484,7 +101287,6 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ | |||
| 100484 | int no_such_func = 0; /* True if no such function exists */ | 101287 | int no_such_func = 0; /* True if no such function exists */ |
| 100485 | int wrong_num_args = 0; /* True if wrong number of arguments */ | 101288 | int wrong_num_args = 0; /* True if wrong number of arguments */ |
| 100486 | int is_agg = 0; /* True if is an aggregate function */ | 101289 | int is_agg = 0; /* True if is an aggregate function */ |
| 100487 | int nId; /* Number of characters in function name */ | ||
| 100488 | const char *zId; /* The function name. */ | 101290 | const char *zId; /* The function name. */ |
| 100489 | FuncDef *pDef; /* Information about the function */ | 101291 | FuncDef *pDef; /* Information about the function */ |
| 100490 | u8 enc = ENC(pParse->db); /* The database encoding */ | 101292 | u8 enc = ENC(pParse->db); /* The database encoding */ |
| @@ -100494,7 +101296,6 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ | |||
| 100494 | #endif | 101296 | #endif |
| 100495 | assert( !ExprHasProperty(pExpr, EP_xIsSelect|EP_IntValue) ); | 101297 | assert( !ExprHasProperty(pExpr, EP_xIsSelect|EP_IntValue) ); |
| 100496 | zId = pExpr->u.zToken; | 101298 | zId = pExpr->u.zToken; |
| 100497 | nId = sqlite3Strlen30(zId); | ||
| 100498 | pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0); | 101299 | pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0); |
| 100499 | if( pDef==0 ){ | 101300 | if( pDef==0 ){ |
| 100500 | pDef = sqlite3FindFunction(pParse->db, zId, -2, enc, 0); | 101301 | pDef = sqlite3FindFunction(pParse->db, zId, -2, enc, 0); |
| @@ -100511,8 +101312,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ | |||
| 100511 | pExpr->iTable = exprProbability(pList->a[1].pExpr); | 101312 | pExpr->iTable = exprProbability(pList->a[1].pExpr); |
| 100512 | if( pExpr->iTable<0 ){ | 101313 | if( pExpr->iTable<0 ){ |
| 100513 | sqlite3ErrorMsg(pParse, | 101314 | sqlite3ErrorMsg(pParse, |
| 100514 | "second argument to likelihood() must be a " | 101315 | "second argument to %#T() must be a " |
| 100515 | "constant between 0.0 and 1.0"); | 101316 | "constant between 0.0 and 1.0", pExpr); |
| 100516 | pNC->nNcErr++; | 101317 | pNC->nNcErr++; |
| 100517 | } | 101318 | } |
| 100518 | }else{ | 101319 | }else{ |
| @@ -100533,8 +101334,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ | |||
| 100533 | int auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0,pDef->zName,0); | 101334 | int auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0,pDef->zName,0); |
| 100534 | if( auth!=SQLITE_OK ){ | 101335 | if( auth!=SQLITE_OK ){ |
| 100535 | if( auth==SQLITE_DENY ){ | 101336 | if( auth==SQLITE_DENY ){ |
| 100536 | sqlite3ErrorMsg(pParse, "not authorized to use function: %s", | 101337 | sqlite3ErrorMsg(pParse, "not authorized to use function: %#T", |
| 100537 | pDef->zName); | 101338 | pExpr); |
| 100538 | pNC->nNcErr++; | 101339 | pNC->nNcErr++; |
| 100539 | } | 101340 | } |
| 100540 | pExpr->op = TK_NULL; | 101341 | pExpr->op = TK_NULL; |
| @@ -100557,7 +101358,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ | |||
| 100557 | ** in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all | 101358 | ** in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all |
| 100558 | ** all this. */ | 101359 | ** all this. */ |
| 100559 | sqlite3ResolveNotValid(pParse, pNC, "non-deterministic functions", | 101360 | sqlite3ResolveNotValid(pParse, pNC, "non-deterministic functions", |
| 100560 | NC_IdxExpr|NC_PartIdx|NC_GenCol, 0); | 101361 | NC_IdxExpr|NC_PartIdx|NC_GenCol, 0, pExpr); |
| 100561 | }else{ | 101362 | }else{ |
| 100562 | assert( (NC_SelfRef & 0xff)==NC_SelfRef ); /* Must fit in 8 bits */ | 101363 | assert( (NC_SelfRef & 0xff)==NC_SelfRef ); /* Must fit in 8 bits */ |
| 100563 | pExpr->op2 = pNC->ncFlags & NC_SelfRef; | 101364 | pExpr->op2 = pNC->ncFlags & NC_SelfRef; |
| @@ -100570,7 +101371,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ | |||
| 100570 | /* Internal-use-only functions are disallowed unless the | 101371 | /* Internal-use-only functions are disallowed unless the |
| 100571 | ** SQL is being compiled using sqlite3NestedParse() or | 101372 | ** SQL is being compiled using sqlite3NestedParse() or |
| 100572 | ** the SQLITE_TESTCTRL_INTERNAL_FUNCTIONS test-control has be | 101373 | ** the SQLITE_TESTCTRL_INTERNAL_FUNCTIONS test-control has be |
| 100573 | ** used to activate internal functionsn for testing purposes */ | 101374 | ** used to activate internal functions for testing purposes */ |
| 100574 | no_such_func = 1; | 101375 | no_such_func = 1; |
| 100575 | pDef = 0; | 101376 | pDef = 0; |
| 100576 | }else | 101377 | }else |
| @@ -100589,7 +101390,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ | |||
| 100589 | ); | 101390 | ); |
| 100590 | if( pDef && pDef->xValue==0 && pWin ){ | 101391 | if( pDef && pDef->xValue==0 && pWin ){ |
| 100591 | sqlite3ErrorMsg(pParse, | 101392 | sqlite3ErrorMsg(pParse, |
| 100592 | "%.*s() may not be used as a window function", nId, zId | 101393 | "%#T() may not be used as a window function", pExpr |
| 100593 | ); | 101394 | ); |
| 100594 | pNC->nNcErr++; | 101395 | pNC->nNcErr++; |
| 100595 | }else if( | 101396 | }else if( |
| @@ -100603,13 +101404,13 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ | |||
| 100603 | }else{ | 101404 | }else{ |
| 100604 | zType = "aggregate"; | 101405 | zType = "aggregate"; |
| 100605 | } | 101406 | } |
| 100606 | sqlite3ErrorMsg(pParse, "misuse of %s function %.*s()",zType,nId,zId); | 101407 | sqlite3ErrorMsg(pParse, "misuse of %s function %#T()",zType,pExpr); |
| 100607 | pNC->nNcErr++; | 101408 | pNC->nNcErr++; |
| 100608 | is_agg = 0; | 101409 | is_agg = 0; |
| 100609 | } | 101410 | } |
| 100610 | #else | 101411 | #else |
| 100611 | if( (is_agg && (pNC->ncFlags & NC_AllowAgg)==0) ){ | 101412 | if( (is_agg && (pNC->ncFlags & NC_AllowAgg)==0) ){ |
| 100612 | sqlite3ErrorMsg(pParse,"misuse of aggregate function %.*s()",nId,zId); | 101413 | sqlite3ErrorMsg(pParse,"misuse of aggregate function %#T()",pExpr); |
| 100613 | pNC->nNcErr++; | 101414 | pNC->nNcErr++; |
| 100614 | is_agg = 0; | 101415 | is_agg = 0; |
| 100615 | } | 101416 | } |
| @@ -100619,18 +101420,18 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ | |||
| 100619 | && pParse->explain==0 | 101420 | && pParse->explain==0 |
| 100620 | #endif | 101421 | #endif |
| 100621 | ){ | 101422 | ){ |
| 100622 | sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId); | 101423 | sqlite3ErrorMsg(pParse, "no such function: %#T", pExpr); |
| 100623 | pNC->nNcErr++; | 101424 | pNC->nNcErr++; |
| 100624 | }else if( wrong_num_args ){ | 101425 | }else if( wrong_num_args ){ |
| 100625 | sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()", | 101426 | sqlite3ErrorMsg(pParse,"wrong number of arguments to function %#T()", |
| 100626 | nId, zId); | 101427 | pExpr); |
| 100627 | pNC->nNcErr++; | 101428 | pNC->nNcErr++; |
| 100628 | } | 101429 | } |
| 100629 | #ifndef SQLITE_OMIT_WINDOWFUNC | 101430 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 100630 | else if( is_agg==0 && ExprHasProperty(pExpr, EP_WinFunc) ){ | 101431 | else if( is_agg==0 && ExprHasProperty(pExpr, EP_WinFunc) ){ |
| 100631 | sqlite3ErrorMsg(pParse, | 101432 | sqlite3ErrorMsg(pParse, |
| 100632 | "FILTER may not be used with non-aggregate %.*s()", | 101433 | "FILTER may not be used with non-aggregate %#T()", |
| 100633 | nId, zId | 101434 | pExpr |
| 100634 | ); | 101435 | ); |
| 100635 | pNC->nNcErr++; | 101436 | pNC->nNcErr++; |
| 100636 | } | 101437 | } |
| @@ -100715,7 +101516,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ | |||
| 100715 | testcase( pNC->ncFlags & NC_IdxExpr ); | 101516 | testcase( pNC->ncFlags & NC_IdxExpr ); |
| 100716 | testcase( pNC->ncFlags & NC_GenCol ); | 101517 | testcase( pNC->ncFlags & NC_GenCol ); |
| 100717 | if( pNC->ncFlags & NC_SelfRef ){ | 101518 | if( pNC->ncFlags & NC_SelfRef ){ |
| 100718 | notValidImpl(pParse, pNC, "subqueries", pExpr); | 101519 | notValidImpl(pParse, pNC, "subqueries", pExpr, pExpr); |
| 100719 | }else{ | 101520 | }else{ |
| 100720 | sqlite3WalkSelect(pWalker, pExpr->x.pSelect); | 101521 | sqlite3WalkSelect(pWalker, pExpr->x.pSelect); |
| 100721 | } | 101522 | } |
| @@ -100733,7 +101534,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ | |||
| 100733 | testcase( pNC->ncFlags & NC_IdxExpr ); | 101534 | testcase( pNC->ncFlags & NC_IdxExpr ); |
| 100734 | testcase( pNC->ncFlags & NC_GenCol ); | 101535 | testcase( pNC->ncFlags & NC_GenCol ); |
| 100735 | sqlite3ResolveNotValid(pParse, pNC, "parameters", | 101536 | sqlite3ResolveNotValid(pParse, pNC, "parameters", |
| 100736 | NC_IsCheck|NC_PartIdx|NC_IdxExpr|NC_GenCol, pExpr); | 101537 | NC_IsCheck|NC_PartIdx|NC_IdxExpr|NC_GenCol, pExpr, pExpr); |
| 100737 | break; | 101538 | break; |
| 100738 | } | 101539 | } |
| 100739 | case TK_IS: | 101540 | case TK_IS: |
| @@ -100785,11 +101586,13 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ | |||
| 100785 | testcase( pExpr->op==TK_ISNOT ); | 101586 | testcase( pExpr->op==TK_ISNOT ); |
| 100786 | testcase( pExpr->op==TK_BETWEEN ); | 101587 | testcase( pExpr->op==TK_BETWEEN ); |
| 100787 | sqlite3ErrorMsg(pParse, "row value misused"); | 101588 | sqlite3ErrorMsg(pParse, "row value misused"); |
| 101589 | sqlite3RecordErrorOffsetOfExpr(pParse->db, pExpr); | ||
| 100788 | } | 101590 | } |
| 100789 | break; | 101591 | break; |
| 100790 | } | 101592 | } |
| 100791 | } | 101593 | } |
| 100792 | return (pParse->nErr || pParse->db->mallocFailed) ? WRC_Abort : WRC_Continue; | 101594 | assert( pParse->db->mallocFailed==0 || pParse->nErr!=0 ); |
| 101595 | return pParse->nErr ? WRC_Abort : WRC_Continue; | ||
| 100793 | } | 101596 | } |
| 100794 | 101597 | ||
| 100795 | /* | 101598 | /* |
| @@ -100897,11 +101700,13 @@ static void resolveOutOfRangeError( | |||
| 100897 | Parse *pParse, /* The error context into which to write the error */ | 101700 | Parse *pParse, /* The error context into which to write the error */ |
| 100898 | const char *zType, /* "ORDER" or "GROUP" */ | 101701 | const char *zType, /* "ORDER" or "GROUP" */ |
| 100899 | int i, /* The index (1-based) of the term out of range */ | 101702 | int i, /* The index (1-based) of the term out of range */ |
| 100900 | int mx /* Largest permissible value of i */ | 101703 | int mx, /* Largest permissible value of i */ |
| 101704 | Expr *pError /* Associate the error with the expression */ | ||
| 100901 | ){ | 101705 | ){ |
| 100902 | sqlite3ErrorMsg(pParse, | 101706 | sqlite3ErrorMsg(pParse, |
| 100903 | "%r %s BY term out of range - should be " | 101707 | "%r %s BY term out of range - should be " |
| 100904 | "between 1 and %d", i, zType, mx); | 101708 | "between 1 and %d", i, zType, mx); |
| 101709 | sqlite3RecordErrorOffsetOfExpr(pParse->db, pError); | ||
| 100905 | } | 101710 | } |
| 100906 | 101711 | ||
| 100907 | /* | 101712 | /* |
| @@ -100957,7 +101762,7 @@ static int resolveCompoundOrderBy( | |||
| 100957 | if( NEVER(pE==0) ) continue; | 101762 | if( NEVER(pE==0) ) continue; |
| 100958 | if( sqlite3ExprIsInteger(pE, &iCol) ){ | 101763 | if( sqlite3ExprIsInteger(pE, &iCol) ){ |
| 100959 | if( iCol<=0 || iCol>pEList->nExpr ){ | 101764 | if( iCol<=0 || iCol>pEList->nExpr ){ |
| 100960 | resolveOutOfRangeError(pParse, "ORDER", i+1, pEList->nExpr); | 101765 | resolveOutOfRangeError(pParse, "ORDER", i+1, pEList->nExpr, pE); |
| 100961 | return 1; | 101766 | return 1; |
| 100962 | } | 101767 | } |
| 100963 | }else{ | 101768 | }else{ |
| @@ -101053,7 +101858,7 @@ SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy( | |||
| 101053 | for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){ | 101858 | for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){ |
| 101054 | if( pItem->u.x.iOrderByCol ){ | 101859 | if( pItem->u.x.iOrderByCol ){ |
| 101055 | if( pItem->u.x.iOrderByCol>pEList->nExpr ){ | 101860 | if( pItem->u.x.iOrderByCol>pEList->nExpr ){ |
| 101056 | resolveOutOfRangeError(pParse, zType, i+1, pEList->nExpr); | 101861 | resolveOutOfRangeError(pParse, zType, i+1, pEList->nExpr, 0); |
| 101057 | return 1; | 101862 | return 1; |
| 101058 | } | 101863 | } |
| 101059 | resolveAlias(pParse, pEList, pItem->u.x.iOrderByCol-1, pItem->pExpr,0); | 101864 | resolveAlias(pParse, pEList, pItem->u.x.iOrderByCol-1, pItem->pExpr,0); |
| @@ -101145,7 +101950,7 @@ static int resolveOrderGroupBy( | |||
| 101145 | ** number so that sqlite3ResolveOrderGroupBy() will convert the | 101950 | ** number so that sqlite3ResolveOrderGroupBy() will convert the |
| 101146 | ** order-by term to a copy of the result-set expression */ | 101951 | ** order-by term to a copy of the result-set expression */ |
| 101147 | if( iCol<1 || iCol>0xffff ){ | 101952 | if( iCol<1 || iCol>0xffff ){ |
| 101148 | resolveOutOfRangeError(pParse, zType, i+1, nResult); | 101953 | resolveOutOfRangeError(pParse, zType, i+1, nResult, pE2); |
| 101149 | return 1; | 101954 | return 1; |
| 101150 | } | 101955 | } |
| 101151 | pItem->u.x.iOrderByCol = (u16)iCol; | 101956 | pItem->u.x.iOrderByCol = (u16)iCol; |
| @@ -101203,7 +102008,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ | |||
| 101203 | */ | 102008 | */ |
| 101204 | if( (p->selFlags & SF_Expanded)==0 ){ | 102009 | if( (p->selFlags & SF_Expanded)==0 ){ |
| 101205 | sqlite3SelectPrep(pParse, p, pOuterNC); | 102010 | sqlite3SelectPrep(pParse, p, pOuterNC); |
| 101206 | return (pParse->nErr || db->mallocFailed) ? WRC_Abort : WRC_Prune; | 102011 | return pParse->nErr ? WRC_Abort : WRC_Prune; |
| 101207 | } | 102012 | } |
| 101208 | 102013 | ||
| 101209 | isCompound = p->pPrior!=0; | 102014 | isCompound = p->pPrior!=0; |
| @@ -101251,7 +102056,8 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ | |||
| 101251 | if( pItem->zName ) pParse->zAuthContext = pItem->zName; | 102056 | if( pItem->zName ) pParse->zAuthContext = pItem->zName; |
| 101252 | sqlite3ResolveSelectNames(pParse, pItem->pSelect, pOuterNC); | 102057 | sqlite3ResolveSelectNames(pParse, pItem->pSelect, pOuterNC); |
| 101253 | pParse->zAuthContext = zSavedContext; | 102058 | pParse->zAuthContext = zSavedContext; |
| 101254 | if( pParse->nErr || db->mallocFailed ) return WRC_Abort; | 102059 | if( pParse->nErr ) return WRC_Abort; |
| 102060 | assert( db->mallocFailed==0 ); | ||
| 101255 | 102061 | ||
| 101256 | /* If the number of references to the outer context changed when | 102062 | /* If the number of references to the outer context changed when |
| 101257 | ** expressions in the sub-select were resolved, the sub-select | 102063 | ** expressions in the sub-select were resolved, the sub-select |
| @@ -102397,9 +103203,8 @@ static void heightOfSelect(const Select *pSelect, int *pnHeight){ | |||
| 102397 | ** if appropriate. | 103203 | ** if appropriate. |
| 102398 | */ | 103204 | */ |
| 102399 | static void exprSetHeight(Expr *p){ | 103205 | static void exprSetHeight(Expr *p){ |
| 102400 | int nHeight = 0; | 103206 | int nHeight = p->pLeft ? p->pLeft->nHeight : 0; |
| 102401 | heightOfExpr(p->pLeft, &nHeight); | 103207 | if( p->pRight && p->pRight->nHeight>nHeight ) nHeight = p->pRight->nHeight; |
| 102402 | heightOfExpr(p->pRight, &nHeight); | ||
| 102403 | if( ExprUseXSelect(p) ){ | 103208 | if( ExprUseXSelect(p) ){ |
| 102404 | heightOfSelect(p->x.pSelect, &nHeight); | 103209 | heightOfSelect(p->x.pSelect, &nHeight); |
| 102405 | }else if( p->x.pList ){ | 103210 | }else if( p->x.pList ){ |
| @@ -102698,6 +103503,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprFunction( | |||
| 102698 | sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */ | 103503 | sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */ |
| 102699 | return 0; | 103504 | return 0; |
| 102700 | } | 103505 | } |
| 103506 | pNew->w.iOfst = (int)(pToken->z - pParse->zTail); | ||
| 102701 | if( pList | 103507 | if( pList |
| 102702 | && pList->nExpr > pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] | 103508 | && pList->nExpr > pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] |
| 102703 | && !pParse->nested | 103509 | && !pParse->nested |
| @@ -102741,7 +103547,7 @@ SQLITE_PRIVATE void sqlite3ExprFunctionUsable( | |||
| 102741 | ** SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning | 103547 | ** SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning |
| 102742 | ** that the schema is possibly tainted). | 103548 | ** that the schema is possibly tainted). |
| 102743 | */ | 103549 | */ |
| 102744 | sqlite3ErrorMsg(pParse, "unsafe use of %s()", pDef->zName); | 103550 | sqlite3ErrorMsg(pParse, "unsafe use of %#T()", pExpr); |
| 102745 | } | 103551 | } |
| 102746 | } | 103552 | } |
| 102747 | } | 103553 | } |
| @@ -102797,6 +103603,7 @@ SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n | |||
| 102797 | if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){ | 103603 | if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){ |
| 102798 | sqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d", | 103604 | sqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d", |
| 102799 | db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]); | 103605 | db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]); |
| 103606 | sqlite3RecordErrorOffsetOfExpr(pParse->db, pExpr); | ||
| 102800 | return; | 103607 | return; |
| 102801 | } | 103608 | } |
| 102802 | x = (ynVar)i; | 103609 | x = (ynVar)i; |
| @@ -102824,6 +103631,7 @@ SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n | |||
| 102824 | pExpr->iColumn = x; | 103631 | pExpr->iColumn = x; |
| 102825 | if( x>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){ | 103632 | if( x>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){ |
| 102826 | sqlite3ErrorMsg(pParse, "too many SQL variables"); | 103633 | sqlite3ErrorMsg(pParse, "too many SQL variables"); |
| 103634 | sqlite3RecordErrorOffsetOfExpr(pParse->db, pExpr); | ||
| 102827 | } | 103635 | } |
| 102828 | } | 103636 | } |
| 102829 | 103637 | ||
| @@ -104431,8 +105239,7 @@ SQLITE_PRIVATE int sqlite3FindInIndex( | |||
| 104431 | CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs); | 105239 | CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs); |
| 104432 | int j; | 105240 | int j; |
| 104433 | 105241 | ||
| 104434 | assert( pReq!=0 || pRhs->iColumn==XN_ROWID | 105242 | assert( pReq!=0 || pRhs->iColumn==XN_ROWID || pParse->nErr ); |
| 104435 | || pParse->nErr || db->mallocFailed ); | ||
| 104436 | for(j=0; j<nExpr; j++){ | 105243 | for(j=0; j<nExpr; j++){ |
| 104437 | if( pIdx->aiColumn[j]!=pRhs->iColumn ) continue; | 105244 | if( pIdx->aiColumn[j]!=pRhs->iColumn ) continue; |
| 104438 | assert( pIdx->azColl[j] ); | 105245 | assert( pIdx->azColl[j] ); |
| @@ -104908,10 +105715,8 @@ SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){ | |||
| 104908 | } | 105715 | } |
| 104909 | pSel->iLimit = 0; | 105716 | pSel->iLimit = 0; |
| 104910 | if( sqlite3Select(pParse, pSel, &dest) ){ | 105717 | if( sqlite3Select(pParse, pSel, &dest) ){ |
| 104911 | if( pParse->nErr ){ | 105718 | pExpr->op2 = pExpr->op; |
| 104912 | pExpr->op2 = pExpr->op; | 105719 | pExpr->op = TK_ERROR; |
| 104913 | pExpr->op = TK_ERROR; | ||
| 104914 | } | ||
| 104915 | return 0; | 105720 | return 0; |
| 104916 | } | 105721 | } |
| 104917 | pExpr->iTable = rReg = dest.iSDParm; | 105722 | pExpr->iTable = rReg = dest.iSDParm; |
| @@ -105128,10 +105933,9 @@ static void sqlite3ExprCodeIN( | |||
| 105128 | }else{ | 105933 | }else{ |
| 105129 | destStep2 = destStep6 = sqlite3VdbeMakeLabel(pParse); | 105934 | destStep2 = destStep6 = sqlite3VdbeMakeLabel(pParse); |
| 105130 | } | 105935 | } |
| 105131 | if( pParse->nErr ) goto sqlite3ExprCodeIN_finished; | ||
| 105132 | for(i=0; i<nVector; i++){ | 105936 | for(i=0; i<nVector; i++){ |
| 105133 | Expr *p = sqlite3VectorFieldSubexpr(pExpr->pLeft, i); | 105937 | Expr *p = sqlite3VectorFieldSubexpr(pExpr->pLeft, i); |
| 105134 | if( pParse->db->mallocFailed ) goto sqlite3ExprCodeIN_oom_error; | 105938 | if( pParse->nErr ) goto sqlite3ExprCodeIN_oom_error; |
| 105135 | if( sqlite3ExprCanBeNull(p) ){ | 105939 | if( sqlite3ExprCanBeNull(p) ){ |
| 105136 | sqlite3VdbeAddOp2(v, OP_IsNull, rLhs+i, destStep2); | 105940 | sqlite3VdbeAddOp2(v, OP_IsNull, rLhs+i, destStep2); |
| 105137 | VdbeCoverage(v); | 105941 | VdbeCoverage(v); |
| @@ -105269,11 +106073,12 @@ static void codeInteger(Parse *pParse, Expr *pExpr, int negFlag, int iMem){ | |||
| 105269 | c = sqlite3DecOrHexToI64(z, &value); | 106073 | c = sqlite3DecOrHexToI64(z, &value); |
| 105270 | if( (c==3 && !negFlag) || (c==2) || (negFlag && value==SMALLEST_INT64)){ | 106074 | if( (c==3 && !negFlag) || (c==2) || (negFlag && value==SMALLEST_INT64)){ |
| 105271 | #ifdef SQLITE_OMIT_FLOATING_POINT | 106075 | #ifdef SQLITE_OMIT_FLOATING_POINT |
| 105272 | sqlite3ErrorMsg(pParse, "oversized integer: %s%s", negFlag ? "-" : "", z); | 106076 | sqlite3ErrorMsg(pParse, "oversized integer: %s%#T", negFlag?"-":"",pExpr); |
| 105273 | #else | 106077 | #else |
| 105274 | #ifndef SQLITE_OMIT_HEX_INTEGER | 106078 | #ifndef SQLITE_OMIT_HEX_INTEGER |
| 105275 | if( sqlite3_strnicmp(z,"0x",2)==0 ){ | 106079 | if( sqlite3_strnicmp(z,"0x",2)==0 ){ |
| 105276 | sqlite3ErrorMsg(pParse, "hex literal too big: %s%s", negFlag?"-":"",z); | 106080 | sqlite3ErrorMsg(pParse, "hex literal too big: %s%#T", |
| 106081 | negFlag?"-":"",pExpr); | ||
| 105277 | }else | 106082 | }else |
| 105278 | #endif | 106083 | #endif |
| 105279 | { | 106084 | { |
| @@ -105949,7 +106754,7 @@ expr_code_doover: | |||
| 105949 | || NEVER(pExpr->iAgg>=pInfo->nFunc) | 106754 | || NEVER(pExpr->iAgg>=pInfo->nFunc) |
| 105950 | ){ | 106755 | ){ |
| 105951 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); | 106756 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 105952 | sqlite3ErrorMsg(pParse, "misuse of aggregate: %s()", pExpr->u.zToken); | 106757 | sqlite3ErrorMsg(pParse, "misuse of aggregate: %#T()", pExpr); |
| 105953 | }else{ | 106758 | }else{ |
| 105954 | return pInfo->aFunc[pExpr->iAgg].iMem; | 106759 | return pInfo->aFunc[pExpr->iAgg].iMem; |
| 105955 | } | 106760 | } |
| @@ -105990,7 +106795,7 @@ expr_code_doover: | |||
| 105990 | } | 106795 | } |
| 105991 | #endif | 106796 | #endif |
| 105992 | if( pDef==0 || pDef->xFinalize!=0 ){ | 106797 | if( pDef==0 || pDef->xFinalize!=0 ){ |
| 105993 | sqlite3ErrorMsg(pParse, "unknown function: %s()", zId); | 106798 | sqlite3ErrorMsg(pParse, "unknown function: %#T()", pExpr); |
| 105994 | break; | 106799 | break; |
| 105995 | } | 106800 | } |
| 105996 | if( pDef->funcFlags & SQLITE_FUNC_INLINE ){ | 106801 | if( pDef->funcFlags & SQLITE_FUNC_INLINE ){ |
| @@ -108306,7 +109111,9 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ | |||
| 108306 | int r1; /* Temporary registers */ | 109111 | int r1; /* Temporary registers */ |
| 108307 | 109112 | ||
| 108308 | db = pParse->db; | 109113 | db = pParse->db; |
| 108309 | if( pParse->nErr || db->mallocFailed ) return; | 109114 | assert( db->pParse==pParse ); |
| 109115 | if( pParse->nErr ) return; | ||
| 109116 | assert( db->mallocFailed==0 ); | ||
| 108310 | pNew = pParse->pNewTable; | 109117 | pNew = pParse->pNewTable; |
| 108311 | assert( pNew ); | 109118 | assert( pNew ); |
| 108312 | 109119 | ||
| @@ -108432,7 +109239,7 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ | |||
| 108432 | " THEN raise(ABORT,'CHECK constraint failed')" | 109239 | " THEN raise(ABORT,'CHECK constraint failed')" |
| 108433 | " ELSE raise(ABORT,'NOT NULL constraint failed')" | 109240 | " ELSE raise(ABORT,'NOT NULL constraint failed')" |
| 108434 | " END" | 109241 | " END" |
| 108435 | " FROM pragma_quick_check(\"%w\",\"%w\")" | 109242 | " FROM pragma_quick_check(%Q,%Q)" |
| 108436 | " WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*'", | 109243 | " WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*'", |
| 108437 | zTab, zDb | 109244 | zTab, zDb |
| 108438 | ); | 109245 | ); |
| @@ -108611,7 +109418,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameColumn( | |||
| 108611 | if( 0==sqlite3StrICmp(pTab->aCol[iCol].zCnName, zOld) ) break; | 109418 | if( 0==sqlite3StrICmp(pTab->aCol[iCol].zCnName, zOld) ) break; |
| 108612 | } | 109419 | } |
| 108613 | if( iCol==pTab->nCol ){ | 109420 | if( iCol==pTab->nCol ){ |
| 108614 | sqlite3ErrorMsg(pParse, "no such column: \"%s\"", zOld); | 109421 | sqlite3ErrorMsg(pParse, "no such column: \"%T\"", pOld); |
| 108615 | goto exit_rename_column; | 109422 | goto exit_rename_column; |
| 108616 | } | 109423 | } |
| 108617 | 109424 | ||
| @@ -108717,7 +109524,9 @@ struct RenameCtx { | |||
| 108717 | ** following a valid object, it may not be used in comparison operations. | 109524 | ** following a valid object, it may not be used in comparison operations. |
| 108718 | */ | 109525 | */ |
| 108719 | static void renameTokenCheckAll(Parse *pParse, const void *pPtr){ | 109526 | static void renameTokenCheckAll(Parse *pParse, const void *pPtr){ |
| 108720 | if( pParse->nErr==0 && pParse->db->mallocFailed==0 ){ | 109527 | assert( pParse==pParse->db->pParse ); |
| 109528 | assert( pParse->db->mallocFailed==0 || pParse->nErr!=0 ); | ||
| 109529 | if( pParse->nErr==0 ){ | ||
| 108721 | const RenameToken *p; | 109530 | const RenameToken *p; |
| 108722 | u8 i = 0; | 109531 | u8 i = 0; |
| 108723 | for(p=pParse->pRename; p; p=p->pNext){ | 109532 | for(p=pParse->pRename; p; p=p->pNext){ |
| @@ -109039,12 +109848,12 @@ static void renameColumnParseError( | |||
| 109039 | const char *zN = (const char*)sqlite3_value_text(pObject); | 109848 | const char *zN = (const char*)sqlite3_value_text(pObject); |
| 109040 | char *zErr; | 109849 | char *zErr; |
| 109041 | 109850 | ||
| 109042 | zErr = sqlite3_mprintf("error in %s %s%s%s: %s", | 109851 | zErr = sqlite3MPrintf(pParse->db, "error in %s %s%s%s: %s", |
| 109043 | zT, zN, (zWhen[0] ? " " : ""), zWhen, | 109852 | zT, zN, (zWhen[0] ? " " : ""), zWhen, |
| 109044 | pParse->zErrMsg | 109853 | pParse->zErrMsg |
| 109045 | ); | 109854 | ); |
| 109046 | sqlite3_result_error(pCtx, zErr, -1); | 109855 | sqlite3_result_error(pCtx, zErr, -1); |
| 109047 | sqlite3_free(zErr); | 109856 | sqlite3DbFree(pParse->db, zErr); |
| 109048 | } | 109857 | } |
| 109049 | 109858 | ||
| 109050 | /* | 109859 | /* |
| @@ -109108,21 +109917,17 @@ static int renameParseSql( | |||
| 109108 | int bTemp /* True if SQL is from temp schema */ | 109917 | int bTemp /* True if SQL is from temp schema */ |
| 109109 | ){ | 109918 | ){ |
| 109110 | int rc; | 109919 | int rc; |
| 109111 | char *zErr = 0; | ||
| 109112 | 109920 | ||
| 109113 | db->init.iDb = bTemp ? 1 : sqlite3FindDbName(db, zDb); | 109921 | db->init.iDb = bTemp ? 1 : sqlite3FindDbName(db, zDb); |
| 109114 | 109922 | ||
| 109115 | /* Parse the SQL statement passed as the first argument. If no error | 109923 | /* Parse the SQL statement passed as the first argument. If no error |
| 109116 | ** occurs and the parse does not result in a new table, index or | 109924 | ** occurs and the parse does not result in a new table, index or |
| 109117 | ** trigger object, the database must be corrupt. */ | 109925 | ** trigger object, the database must be corrupt. */ |
| 109118 | memset(p, 0, sizeof(Parse)); | 109926 | sqlite3ParseObjectInit(p, db); |
| 109119 | p->eParseMode = PARSE_MODE_RENAME; | 109927 | p->eParseMode = PARSE_MODE_RENAME; |
| 109120 | p->db = db; | 109928 | p->db = db; |
| 109121 | p->nQueryLoop = 1; | 109929 | p->nQueryLoop = 1; |
| 109122 | rc = zSql ? sqlite3RunParser(p, zSql, &zErr) : SQLITE_NOMEM; | 109930 | rc = zSql ? sqlite3RunParser(p, zSql) : SQLITE_NOMEM; |
| 109123 | assert( p->zErrMsg==0 ); | ||
| 109124 | assert( rc!=SQLITE_OK || zErr==0 ); | ||
| 109125 | p->zErrMsg = zErr; | ||
| 109126 | if( db->mallocFailed ) rc = SQLITE_NOMEM; | 109931 | if( db->mallocFailed ) rc = SQLITE_NOMEM; |
| 109127 | if( rc==SQLITE_OK | 109932 | if( rc==SQLITE_OK |
| 109128 | && p->pNewTable==0 && p->pNewIndex==0 && p->pNewTrigger==0 | 109933 | && p->pNewTable==0 && p->pNewIndex==0 && p->pNewTrigger==0 |
| @@ -109403,13 +110208,13 @@ static void renameParseCleanup(Parse *pParse){ | |||
| 109403 | sqlite3DeleteTrigger(db, pParse->pNewTrigger); | 110208 | sqlite3DeleteTrigger(db, pParse->pNewTrigger); |
| 109404 | sqlite3DbFree(db, pParse->zErrMsg); | 110209 | sqlite3DbFree(db, pParse->zErrMsg); |
| 109405 | renameTokenFree(db, pParse->pRename); | 110210 | renameTokenFree(db, pParse->pRename); |
| 109406 | sqlite3ParserReset(pParse); | 110211 | sqlite3ParseObjectReset(pParse); |
| 109407 | } | 110212 | } |
| 109408 | 110213 | ||
| 109409 | /* | 110214 | /* |
| 109410 | ** SQL function: | 110215 | ** SQL function: |
| 109411 | ** | 110216 | ** |
| 109412 | ** sqlite_rename_column(zSql, iCol, bQuote, zNew, zTable, zOld) | 110217 | ** sqlite_rename_column(SQL,TYPE,OBJ,DB,TABLE,COL,NEWNAME,QUOTE,TEMP) |
| 109413 | ** | 110218 | ** |
| 109414 | ** 0. zSql: SQL statement to rewrite | 110219 | ** 0. zSql: SQL statement to rewrite |
| 109415 | ** 1. type: Type of object ("table", "view" etc.) | 110220 | ** 1. type: Type of object ("table", "view" etc.) |
| @@ -109427,7 +110232,8 @@ static void renameParseCleanup(Parse *pParse){ | |||
| 109427 | ** | 110232 | ** |
| 109428 | ** This function is used internally by the ALTER TABLE RENAME COLUMN command. | 110233 | ** This function is used internally by the ALTER TABLE RENAME COLUMN command. |
| 109429 | ** It is only accessible to SQL created using sqlite3NestedParse(). It is | 110234 | ** It is only accessible to SQL created using sqlite3NestedParse(). It is |
| 109430 | ** not reachable from ordinary SQL passed into sqlite3_prepare(). | 110235 | ** not reachable from ordinary SQL passed into sqlite3_prepare() unless the |
| 110236 | ** SQLITE_TESTCTRL_INTERNAL_FUNCTIONS test setting is enabled. | ||
| 109431 | */ | 110237 | */ |
| 109432 | static void renameColumnFunc( | 110238 | static void renameColumnFunc( |
| 109433 | sqlite3_context *context, | 110239 | sqlite3_context *context, |
| @@ -109576,7 +110382,9 @@ static void renameColumnFunc( | |||
| 109576 | 110382 | ||
| 109577 | renameColumnFunc_done: | 110383 | renameColumnFunc_done: |
| 109578 | if( rc!=SQLITE_OK ){ | 110384 | if( rc!=SQLITE_OK ){ |
| 109579 | if( sParse.zErrMsg ){ | 110385 | if( rc==SQLITE_ERROR && sqlite3WritableSchema(db) ){ |
| 110386 | sqlite3_result_value(context, argv[0]); | ||
| 110387 | }else if( sParse.zErrMsg ){ | ||
| 109580 | renameColumnParseError(context, "", argv[1], argv[2], &sParse); | 110388 | renameColumnParseError(context, "", argv[1], argv[2], &sParse); |
| 109581 | }else{ | 110389 | }else{ |
| 109582 | sqlite3_result_error_code(context, rc); | 110390 | sqlite3_result_error_code(context, rc); |
| @@ -109775,7 +110583,9 @@ static void renameTableFunc( | |||
| 109775 | rc = renameEditSql(context, &sCtx, zInput, zNew, bQuote); | 110583 | rc = renameEditSql(context, &sCtx, zInput, zNew, bQuote); |
| 109776 | } | 110584 | } |
| 109777 | if( rc!=SQLITE_OK ){ | 110585 | if( rc!=SQLITE_OK ){ |
| 109778 | if( sParse.zErrMsg ){ | 110586 | if( rc==SQLITE_ERROR && sqlite3WritableSchema(db) ){ |
| 110587 | sqlite3_result_value(context, argv[3]); | ||
| 110588 | }else if( sParse.zErrMsg ){ | ||
| 109779 | renameColumnParseError(context, "", argv[1], argv[2], &sParse); | 110589 | renameColumnParseError(context, "", argv[1], argv[2], &sParse); |
| 109780 | }else{ | 110590 | }else{ |
| 109781 | sqlite3_result_error_code(context, rc); | 110591 | sqlite3_result_error_code(context, rc); |
| @@ -109800,10 +110610,10 @@ static int renameQuotefixExprCb(Walker *pWalker, Expr *pExpr){ | |||
| 109800 | return WRC_Continue; | 110610 | return WRC_Continue; |
| 109801 | } | 110611 | } |
| 109802 | 110612 | ||
| 109803 | /* | 110613 | /* SQL function: sqlite_rename_quotefix(DB,SQL) |
| 109804 | ** The implementation of an SQL scalar function that rewrites DDL statements | 110614 | ** |
| 109805 | ** so that any string literals that use double-quotes are modified so that | 110615 | ** Rewrite the DDL statement "SQL" so that any string literals that use |
| 109806 | ** they use single quotes. | 110616 | ** double-quotes use single quotes instead. |
| 109807 | ** | 110617 | ** |
| 109808 | ** Two arguments must be passed: | 110618 | ** Two arguments must be passed: |
| 109809 | ** | 110619 | ** |
| @@ -109822,6 +110632,10 @@ static int renameQuotefixExprCb(Walker *pWalker, Expr *pExpr){ | |||
| 109822 | ** returns the string: | 110632 | ** returns the string: |
| 109823 | ** | 110633 | ** |
| 109824 | ** CREATE VIEW v1 AS SELECT "a", 'string' FROM t1 | 110634 | ** CREATE VIEW v1 AS SELECT "a", 'string' FROM t1 |
| 110635 | ** | ||
| 110636 | ** If there is a error in the input SQL, then raise an error, except | ||
| 110637 | ** if PRAGMA writable_schema=ON, then just return the input string | ||
| 110638 | ** unmodified following an error. | ||
| 109825 | */ | 110639 | */ |
| 109826 | static void renameQuotefixFunc( | 110640 | static void renameQuotefixFunc( |
| 109827 | sqlite3_context *context, | 110641 | sqlite3_context *context, |
| @@ -109896,7 +110710,11 @@ static void renameQuotefixFunc( | |||
| 109896 | renameTokenFree(db, sCtx.pList); | 110710 | renameTokenFree(db, sCtx.pList); |
| 109897 | } | 110711 | } |
| 109898 | if( rc!=SQLITE_OK ){ | 110712 | if( rc!=SQLITE_OK ){ |
| 109899 | sqlite3_result_error_code(context, rc); | 110713 | if( sqlite3WritableSchema(db) && rc==SQLITE_ERROR ){ |
| 110714 | sqlite3_result_value(context, argv[1]); | ||
| 110715 | }else{ | ||
| 110716 | sqlite3_result_error_code(context, rc); | ||
| 110717 | } | ||
| 109900 | } | 110718 | } |
| 109901 | renameParseCleanup(&sParse); | 110719 | renameParseCleanup(&sParse); |
| 109902 | } | 110720 | } |
| @@ -109908,7 +110726,8 @@ static void renameQuotefixFunc( | |||
| 109908 | sqlite3BtreeLeaveAll(db); | 110726 | sqlite3BtreeLeaveAll(db); |
| 109909 | } | 110727 | } |
| 109910 | 110728 | ||
| 109911 | /* | 110729 | /* Function: sqlite_rename_test(DB,SQL,TYPE,NAME,ISTEMP,WHEN,DQS) |
| 110730 | ** | ||
| 109912 | ** An SQL user function that checks that there are no parse or symbol | 110731 | ** An SQL user function that checks that there are no parse or symbol |
| 109913 | ** resolution problems in a CREATE TRIGGER|TABLE|VIEW|INDEX statement. | 110732 | ** resolution problems in a CREATE TRIGGER|TABLE|VIEW|INDEX statement. |
| 109914 | ** After an ALTER TABLE .. RENAME operation is performed and the schema | 110733 | ** After an ALTER TABLE .. RENAME operation is performed and the schema |
| @@ -109923,11 +110742,13 @@ static void renameQuotefixFunc( | |||
| 109923 | ** 5: "when" part of error message. | 110742 | ** 5: "when" part of error message. |
| 109924 | ** 6: True to disable the DQS quirk when parsing SQL. | 110743 | ** 6: True to disable the DQS quirk when parsing SQL. |
| 109925 | ** | 110744 | ** |
| 109926 | ** Unless it finds an error, this function normally returns NULL. However, it | 110745 | ** The return value is computed as follows: |
| 109927 | ** returns integer value 1 if: | ||
| 109928 | ** | 110746 | ** |
| 109929 | ** * the SQL argument creates a trigger, and | 110747 | ** A. If an error is seen and not in PRAGMA writable_schema=ON mode, |
| 109930 | ** * the table that the trigger is attached to is in database zDb. | 110748 | ** then raise the error. |
| 110749 | ** B. Else if a trigger is created and the the table that the trigger is | ||
| 110750 | ** attached to is in database zDb, then return 1. | ||
| 110751 | ** C. Otherwise return NULL. | ||
| 109931 | */ | 110752 | */ |
| 109932 | static void renameTableTest( | 110753 | static void renameTableTest( |
| 109933 | sqlite3_context *context, | 110754 | sqlite3_context *context, |
| @@ -109972,12 +110793,16 @@ static void renameTableTest( | |||
| 109972 | if( rc==SQLITE_OK ){ | 110793 | if( rc==SQLITE_OK ){ |
| 109973 | int i1 = sqlite3SchemaToIndex(db, sParse.pNewTrigger->pTabSchema); | 110794 | int i1 = sqlite3SchemaToIndex(db, sParse.pNewTrigger->pTabSchema); |
| 109974 | int i2 = sqlite3FindDbName(db, zDb); | 110795 | int i2 = sqlite3FindDbName(db, zDb); |
| 109975 | if( i1==i2 ) sqlite3_result_int(context, 1); | 110796 | if( i1==i2 ){ |
| 110797 | /* Handle output case B */ | ||
| 110798 | sqlite3_result_int(context, 1); | ||
| 110799 | } | ||
| 109976 | } | 110800 | } |
| 109977 | } | 110801 | } |
| 109978 | } | 110802 | } |
| 109979 | 110803 | ||
| 109980 | if( rc!=SQLITE_OK && zWhen ){ | 110804 | if( rc!=SQLITE_OK && zWhen && !sqlite3WritableSchema(db) ){ |
| 110805 | /* Output case A */ | ||
| 109981 | renameColumnParseError(context, zWhen, argv[2], argv[3],&sParse); | 110806 | renameColumnParseError(context, zWhen, argv[2], argv[3],&sParse); |
| 109982 | } | 110807 | } |
| 109983 | renameParseCleanup(&sParse); | 110808 | renameParseCleanup(&sParse); |
| @@ -110093,7 +110918,7 @@ SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, const T | |||
| 110093 | } | 110918 | } |
| 110094 | iCol = sqlite3ColumnIndex(pTab, zCol); | 110919 | iCol = sqlite3ColumnIndex(pTab, zCol); |
| 110095 | if( iCol<0 ){ | 110920 | if( iCol<0 ){ |
| 110096 | sqlite3ErrorMsg(pParse, "no such column: \"%s\"", zCol); | 110921 | sqlite3ErrorMsg(pParse, "no such column: \"%T\"", pName); |
| 110097 | goto exit_drop_column; | 110922 | goto exit_drop_column; |
| 110098 | } | 110923 | } |
| 110099 | 110924 | ||
| @@ -110117,6 +110942,12 @@ SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, const T | |||
| 110117 | iDb = sqlite3SchemaToIndex(db, pTab->pSchema); | 110942 | iDb = sqlite3SchemaToIndex(db, pTab->pSchema); |
| 110118 | assert( iDb>=0 ); | 110943 | assert( iDb>=0 ); |
| 110119 | zDb = db->aDb[iDb].zDbSName; | 110944 | zDb = db->aDb[iDb].zDbSName; |
| 110945 | #ifndef SQLITE_OMIT_AUTHORIZATION | ||
| 110946 | /* Invoke the authorization callback. */ | ||
| 110947 | if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, zCol) ){ | ||
| 110948 | goto exit_drop_column; | ||
| 110949 | } | ||
| 110950 | #endif | ||
| 110120 | renameTestSchema(pParse, zDb, iDb==1, "", 0); | 110951 | renameTestSchema(pParse, zDb, iDb==1, "", 0); |
| 110121 | renameFixQuotes(pParse, zDb, iDb==1); | 110952 | renameFixQuotes(pParse, zDb, iDb==1); |
| 110122 | sqlite3NestedParse(pParse, | 110953 | sqlite3NestedParse(pParse, |
| @@ -112504,7 +113335,7 @@ static void codeAttach( | |||
| 112504 | } | 113335 | } |
| 112505 | 113336 | ||
| 112506 | #ifndef SQLITE_OMIT_AUTHORIZATION | 113337 | #ifndef SQLITE_OMIT_AUTHORIZATION |
| 112507 | if( pAuthArg ){ | 113338 | if( ALWAYS(pAuthArg) ){ |
| 112508 | char *zAuthArg; | 113339 | char *zAuthArg; |
| 112509 | if( pAuthArg->op==TK_STRING ){ | 113340 | if( pAuthArg->op==TK_STRING ){ |
| 112510 | assert( !ExprHasProperty(pAuthArg, EP_IntValue) ); | 113341 | assert( !ExprHasProperty(pAuthArg, EP_IntValue) ); |
| @@ -113165,11 +113996,13 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ | |||
| 113165 | 113996 | ||
| 113166 | assert( pParse->pToplevel==0 ); | 113997 | assert( pParse->pToplevel==0 ); |
| 113167 | db = pParse->db; | 113998 | db = pParse->db; |
| 113999 | assert( db->pParse==pParse ); | ||
| 113168 | if( pParse->nested ) return; | 114000 | if( pParse->nested ) return; |
| 113169 | if( db->mallocFailed || pParse->nErr ){ | 114001 | if( pParse->nErr ){ |
| 113170 | if( pParse->rc==SQLITE_OK ) pParse->rc = SQLITE_ERROR; | 114002 | if( db->mallocFailed ) pParse->rc = SQLITE_NOMEM; |
| 113171 | return; | 114003 | return; |
| 113172 | } | 114004 | } |
| 114005 | assert( db->mallocFailed==0 ); | ||
| 113173 | 114006 | ||
| 113174 | /* Begin by generating some termination code at the end of the | 114007 | /* Begin by generating some termination code at the end of the |
| 113175 | ** vdbe program | 114008 | ** vdbe program |
| @@ -113192,9 +114025,10 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ | |||
| 113192 | int i; | 114025 | int i; |
| 113193 | int reg; | 114026 | int reg; |
| 113194 | 114027 | ||
| 113195 | if( pReturning->nRetCol==0 ){ | 114028 | if( NEVER(pReturning->nRetCol==0) ){ |
| 113196 | assert( CORRUPT_DB ); | 114029 | assert( CORRUPT_DB ); |
| 113197 | }else{ | 114030 | }else{ |
| 114031 | sqlite3VdbeAddOp0(v, OP_FkCheck); | ||
| 113198 | addrRewind = | 114032 | addrRewind = |
| 113199 | sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur); | 114033 | sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur); |
| 113200 | VdbeCoverage(v); | 114034 | VdbeCoverage(v); |
| @@ -113287,7 +114121,7 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ | |||
| 113287 | 114121 | ||
| 113288 | if( pParse->bReturning ){ | 114122 | if( pParse->bReturning ){ |
| 113289 | Returning *pRet = pParse->u1.pReturning; | 114123 | Returning *pRet = pParse->u1.pReturning; |
| 113290 | if( pRet->nRetCol==0 ){ | 114124 | if( NEVER(pRet->nRetCol==0) ){ |
| 113291 | assert( CORRUPT_DB ); | 114125 | assert( CORRUPT_DB ); |
| 113292 | }else{ | 114126 | }else{ |
| 113293 | sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRet->iRetCur, pRet->nRetCol); | 114127 | sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRet->iRetCur, pRet->nRetCol); |
| @@ -113301,7 +114135,9 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ | |||
| 113301 | 114135 | ||
| 113302 | /* Get the VDBE program ready for execution | 114136 | /* Get the VDBE program ready for execution |
| 113303 | */ | 114137 | */ |
| 113304 | if( v && pParse->nErr==0 && !db->mallocFailed ){ | 114138 | assert( v!=0 || pParse->nErr ); |
| 114139 | assert( db->mallocFailed==0 || pParse->nErr ); | ||
| 114140 | if( pParse->nErr==0 ){ | ||
| 113305 | /* A minimum of one cursor is required if autoincrement is used | 114141 | /* A minimum of one cursor is required if autoincrement is used |
| 113306 | * See ticket [a696379c1f08866] */ | 114142 | * See ticket [a696379c1f08866] */ |
| 113307 | assert( pParse->pAinc==0 || pParse->nTab>0 ); | 114143 | assert( pParse->pAinc==0 || pParse->nTab>0 ); |
| @@ -113328,7 +114164,6 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ | |||
| 113328 | SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){ | 114164 | SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){ |
| 113329 | va_list ap; | 114165 | va_list ap; |
| 113330 | char *zSql; | 114166 | char *zSql; |
| 113331 | char *zErrMsg = 0; | ||
| 113332 | sqlite3 *db = pParse->db; | 114167 | sqlite3 *db = pParse->db; |
| 113333 | u32 savedDbFlags = db->mDbFlags; | 114168 | u32 savedDbFlags = db->mDbFlags; |
| 113334 | char saveBuf[PARSE_TAIL_SZ]; | 114169 | char saveBuf[PARSE_TAIL_SZ]; |
| @@ -113350,9 +114185,10 @@ SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){ | |||
| 113350 | memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ); | 114185 | memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ); |
| 113351 | memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ); | 114186 | memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ); |
| 113352 | db->mDbFlags |= DBFLAG_PreferBuiltin; | 114187 | db->mDbFlags |= DBFLAG_PreferBuiltin; |
| 113353 | sqlite3RunParser(pParse, zSql, &zErrMsg); | 114188 | sqlite3RunParser(pParse, zSql); |
| 114189 | sqlite3DbFree(db, pParse->zErrMsg); | ||
| 114190 | pParse->zErrMsg = 0; | ||
| 113354 | db->mDbFlags = savedDbFlags; | 114191 | db->mDbFlags = savedDbFlags; |
| 113355 | sqlite3DbFree(db, zErrMsg); | ||
| 113356 | sqlite3DbFree(db, zSql); | 114192 | sqlite3DbFree(db, zSql); |
| 113357 | memcpy(PARSE_TAIL(pParse), saveBuf, PARSE_TAIL_SZ); | 114193 | memcpy(PARSE_TAIL(pParse), saveBuf, PARSE_TAIL_SZ); |
| 113358 | pParse->nested--; | 114194 | pParse->nested--; |
| @@ -114312,7 +115148,8 @@ SQLITE_PRIVATE void sqlite3StartTable( | |||
| 114312 | pTable = sqlite3FindTable(db, zName, zDb); | 115148 | pTable = sqlite3FindTable(db, zName, zDb); |
| 114313 | if( pTable ){ | 115149 | if( pTable ){ |
| 114314 | if( !noErr ){ | 115150 | if( !noErr ){ |
| 114315 | sqlite3ErrorMsg(pParse, "table %T already exists", pName); | 115151 | sqlite3ErrorMsg(pParse, "%s %T already exists", |
| 115152 | (IsView(pTable)? "view" : "table"), pName); | ||
| 114316 | }else{ | 115153 | }else{ |
| 114317 | assert( !db->init.busy || CORRUPT_DB ); | 115154 | assert( !db->init.busy || CORRUPT_DB ); |
| 114318 | sqlite3CodeVerifySchema(pParse, iDb); | 115155 | sqlite3CodeVerifySchema(pParse, iDb); |
| @@ -115407,10 +116244,11 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ | |||
| 115407 | pTab->iPKey = -1; | 116244 | pTab->iPKey = -1; |
| 115408 | sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, | 116245 | sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, |
| 115409 | SQLITE_IDXTYPE_PRIMARYKEY); | 116246 | SQLITE_IDXTYPE_PRIMARYKEY); |
| 115410 | if( db->mallocFailed || pParse->nErr ){ | 116247 | if( pParse->nErr ){ |
| 115411 | pTab->tabFlags &= ~TF_WithoutRowid; | 116248 | pTab->tabFlags &= ~TF_WithoutRowid; |
| 115412 | return; | 116249 | return; |
| 115413 | } | 116250 | } |
| 116251 | assert( db->mallocFailed==0 ); | ||
| 115414 | pPk = sqlite3PrimaryKeyIndex(pTab); | 116252 | pPk = sqlite3PrimaryKeyIndex(pTab); |
| 115415 | assert( pPk->nKeyCol==1 ); | 116253 | assert( pPk->nKeyCol==1 ); |
| 115416 | }else{ | 116254 | }else{ |
| @@ -116151,10 +116989,10 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ | |||
| 116151 | */ | 116989 | */ |
| 116152 | sqlite3ColumnsFromExprList(pParse, pTable->pCheck, | 116990 | sqlite3ColumnsFromExprList(pParse, pTable->pCheck, |
| 116153 | &pTable->nCol, &pTable->aCol); | 116991 | &pTable->nCol, &pTable->aCol); |
| 116154 | if( db->mallocFailed==0 | 116992 | if( pParse->nErr==0 |
| 116155 | && pParse->nErr==0 | ||
| 116156 | && pTable->nCol==pSel->pEList->nExpr | 116993 | && pTable->nCol==pSel->pEList->nExpr |
| 116157 | ){ | 116994 | ){ |
| 116995 | assert( db->mallocFailed==0 ); | ||
| 116158 | sqlite3SelectAddColumnTypeAndCollation(pParse, pTable, pSel, | 116996 | sqlite3SelectAddColumnTypeAndCollation(pParse, pTable, pSel, |
| 116159 | SQLITE_AFF_NONE); | 116997 | SQLITE_AFF_NONE); |
| 116160 | } | 116998 | } |
| @@ -116773,7 +117611,7 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){ | |||
| 116773 | tnum = pIndex->tnum; | 117611 | tnum = pIndex->tnum; |
| 116774 | } | 117612 | } |
| 116775 | pKey = sqlite3KeyInfoOfIndex(pParse, pIndex); | 117613 | pKey = sqlite3KeyInfoOfIndex(pParse, pIndex); |
| 116776 | assert( pKey!=0 || db->mallocFailed || pParse->nErr ); | 117614 | assert( pKey!=0 || pParse->nErr ); |
| 116777 | 117615 | ||
| 116778 | /* Open the sorter cursor if we are to use one. */ | 117616 | /* Open the sorter cursor if we are to use one. */ |
| 116779 | iSorter = pParse->nTab++; | 117617 | iSorter = pParse->nTab++; |
| @@ -116937,9 +117775,11 @@ SQLITE_PRIVATE void sqlite3CreateIndex( | |||
| 116937 | char *zExtra = 0; /* Extra space after the Index object */ | 117775 | char *zExtra = 0; /* Extra space after the Index object */ |
| 116938 | Index *pPk = 0; /* PRIMARY KEY index for WITHOUT ROWID tables */ | 117776 | Index *pPk = 0; /* PRIMARY KEY index for WITHOUT ROWID tables */ |
| 116939 | 117777 | ||
| 116940 | if( db->mallocFailed || pParse->nErr>0 ){ | 117778 | assert( db->pParse==pParse ); |
| 117779 | if( pParse->nErr ){ | ||
| 116941 | goto exit_create_index; | 117780 | goto exit_create_index; |
| 116942 | } | 117781 | } |
| 117782 | assert( db->mallocFailed==0 ); | ||
| 116943 | if( IN_DECLARE_VTAB && idxType!=SQLITE_IDXTYPE_PRIMARYKEY ){ | 117783 | if( IN_DECLARE_VTAB && idxType!=SQLITE_IDXTYPE_PRIMARYKEY ){ |
| 116944 | goto exit_create_index; | 117784 | goto exit_create_index; |
| 116945 | } | 117785 | } |
| @@ -117003,7 +117843,6 @@ SQLITE_PRIVATE void sqlite3CreateIndex( | |||
| 117003 | pDb = &db->aDb[iDb]; | 117843 | pDb = &db->aDb[iDb]; |
| 117004 | 117844 | ||
| 117005 | assert( pTab!=0 ); | 117845 | assert( pTab!=0 ); |
| 117006 | assert( pParse->nErr==0 ); | ||
| 117007 | if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 | 117846 | if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 |
| 117008 | && db->init.busy==0 | 117847 | && db->init.busy==0 |
| 117009 | && pTblName!=0 | 117848 | && pTblName!=0 |
| @@ -117427,13 +118266,13 @@ SQLITE_PRIVATE void sqlite3CreateIndex( | |||
| 117427 | /* Add an entry in sqlite_schema for this index | 118266 | /* Add an entry in sqlite_schema for this index |
| 117428 | */ | 118267 | */ |
| 117429 | sqlite3NestedParse(pParse, | 118268 | sqlite3NestedParse(pParse, |
| 117430 | "INSERT INTO %Q." LEGACY_SCHEMA_TABLE " VALUES('index',%Q,%Q,#%d,%Q);", | 118269 | "INSERT INTO %Q." LEGACY_SCHEMA_TABLE " VALUES('index',%Q,%Q,#%d,%Q);", |
| 117431 | db->aDb[iDb].zDbSName, | 118270 | db->aDb[iDb].zDbSName, |
| 117432 | pIndex->zName, | 118271 | pIndex->zName, |
| 117433 | pTab->zName, | 118272 | pTab->zName, |
| 117434 | iMem, | 118273 | iMem, |
| 117435 | zStmt | 118274 | zStmt |
| 117436 | ); | 118275 | ); |
| 117437 | sqlite3DbFree(db, zStmt); | 118276 | sqlite3DbFree(db, zStmt); |
| 117438 | 118277 | ||
| 117439 | /* Fill the index with data and reparse the schema. Code an OP_Expire | 118278 | /* Fill the index with data and reparse the schema. Code an OP_Expire |
| @@ -117567,10 +118406,10 @@ SQLITE_PRIVATE void sqlite3DropIndex(Parse *pParse, SrcList *pName, int ifExists | |||
| 117567 | sqlite3 *db = pParse->db; | 118406 | sqlite3 *db = pParse->db; |
| 117568 | int iDb; | 118407 | int iDb; |
| 117569 | 118408 | ||
| 117570 | assert( pParse->nErr==0 ); /* Never called with prior errors */ | ||
| 117571 | if( db->mallocFailed ){ | 118409 | if( db->mallocFailed ){ |
| 117572 | goto exit_drop_index; | 118410 | goto exit_drop_index; |
| 117573 | } | 118411 | } |
| 118412 | assert( pParse->nErr==0 ); /* Never called with prior non-OOM errors */ | ||
| 117574 | assert( pName->nSrc==1 ); | 118413 | assert( pName->nSrc==1 ); |
| 117575 | if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ | 118414 | if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ |
| 117576 | goto exit_drop_index; | 118415 | goto exit_drop_index; |
| @@ -117981,7 +118820,7 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm( | |||
| 117981 | pItem->pUsing = pUsing; | 118820 | pItem->pUsing = pUsing; |
| 117982 | return p; | 118821 | return p; |
| 117983 | 118822 | ||
| 117984 | append_from_error: | 118823 | append_from_error: |
| 117985 | assert( p==0 ); | 118824 | assert( p==0 ); |
| 117986 | sqlite3ExprDelete(db, pOn); | 118825 | sqlite3ExprDelete(db, pOn); |
| 117987 | sqlite3IdListDelete(db, pUsing); | 118826 | sqlite3IdListDelete(db, pUsing); |
| @@ -119011,7 +119850,6 @@ SQLITE_PRIVATE void sqlite3InsertBuiltinFuncs( | |||
| 119011 | const char *zName = aDef[i].zName; | 119850 | const char *zName = aDef[i].zName; |
| 119012 | int nName = sqlite3Strlen30(zName); | 119851 | int nName = sqlite3Strlen30(zName); |
| 119013 | int h = SQLITE_FUNC_HASH(zName[0], nName); | 119852 | int h = SQLITE_FUNC_HASH(zName[0], nName); |
| 119014 | assert( zName[0]>='a' && zName[0]<='z' ); | ||
| 119015 | assert( aDef[i].funcFlags & SQLITE_FUNC_BUILTIN ); | 119853 | assert( aDef[i].funcFlags & SQLITE_FUNC_BUILTIN ); |
| 119016 | pOther = sqlite3FunctionSearch(h, zName); | 119854 | pOther = sqlite3FunctionSearch(h, zName); |
| 119017 | if( pOther ){ | 119855 | if( pOther ){ |
| @@ -119238,6 +120076,16 @@ SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){ | |||
| 119238 | return pTab; | 120076 | return pTab; |
| 119239 | } | 120077 | } |
| 119240 | 120078 | ||
| 120079 | /* Generate byte-code that will report the number of rows modified | ||
| 120080 | ** by a DELETE, INSERT, or UPDATE statement. | ||
| 120081 | */ | ||
| 120082 | SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe *v, int regCounter, const char *zColName){ | ||
| 120083 | sqlite3VdbeAddOp0(v, OP_FkCheck); | ||
| 120084 | sqlite3VdbeAddOp2(v, OP_ResultRow, regCounter, 1); | ||
| 120085 | sqlite3VdbeSetNumCols(v, 1); | ||
| 120086 | sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zColName, SQLITE_STATIC); | ||
| 120087 | } | ||
| 120088 | |||
| 119241 | /* Return true if table pTab is read-only. | 120089 | /* Return true if table pTab is read-only. |
| 119242 | ** | 120090 | ** |
| 119243 | ** A table is read-only if any of the following are true: | 120091 | ** A table is read-only if any of the following are true: |
| @@ -119477,9 +120325,11 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( | |||
| 119477 | 120325 | ||
| 119478 | memset(&sContext, 0, sizeof(sContext)); | 120326 | memset(&sContext, 0, sizeof(sContext)); |
| 119479 | db = pParse->db; | 120327 | db = pParse->db; |
| 119480 | if( pParse->nErr || db->mallocFailed ){ | 120328 | assert( db->pParse==pParse ); |
| 120329 | if( pParse->nErr ){ | ||
| 119481 | goto delete_from_cleanup; | 120330 | goto delete_from_cleanup; |
| 119482 | } | 120331 | } |
| 120332 | assert( db->mallocFailed==0 ); | ||
| 119483 | assert( pTabList->nSrc==1 ); | 120333 | assert( pTabList->nSrc==1 ); |
| 119484 | 120334 | ||
| 119485 | 120335 | ||
| @@ -119660,7 +120510,7 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( | |||
| 119660 | ** ONEPASS_SINGLE: One-pass approach - at most one row deleted. | 120510 | ** ONEPASS_SINGLE: One-pass approach - at most one row deleted. |
| 119661 | ** ONEPASS_MULTI: One-pass approach - any number of rows may be deleted. | 120511 | ** ONEPASS_MULTI: One-pass approach - any number of rows may be deleted. |
| 119662 | */ | 120512 | */ |
| 119663 | pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, wcf, iTabCur+1); | 120513 | pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0,0,wcf,iTabCur+1); |
| 119664 | if( pWInfo==0 ) goto delete_from_cleanup; | 120514 | if( pWInfo==0 ) goto delete_from_cleanup; |
| 119665 | eOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass); | 120515 | eOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass); |
| 119666 | assert( IsVirtual(pTab)==0 || eOnePass!=ONEPASS_MULTI ); | 120516 | assert( IsVirtual(pTab)==0 || eOnePass!=ONEPASS_MULTI ); |
| @@ -119813,9 +120663,7 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( | |||
| 119813 | ** invoke the callback function. | 120663 | ** invoke the callback function. |
| 119814 | */ | 120664 | */ |
| 119815 | if( memCnt ){ | 120665 | if( memCnt ){ |
| 119816 | sqlite3VdbeAddOp2(v, OP_ChngCntRow, memCnt, 1); | 120666 | sqlite3CodeChangeCount(v, memCnt, "rows deleted"); |
| 119817 | sqlite3VdbeSetNumCols(v, 1); | ||
| 119818 | sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", SQLITE_STATIC); | ||
| 119819 | } | 120667 | } |
| 119820 | 120668 | ||
| 119821 | delete_from_cleanup: | 120669 | delete_from_cleanup: |
| @@ -120266,6 +121114,18 @@ static void typeofFunc( | |||
| 120266 | sqlite3_result_text(context, azType[i], -1, SQLITE_STATIC); | 121114 | sqlite3_result_text(context, azType[i], -1, SQLITE_STATIC); |
| 120267 | } | 121115 | } |
| 120268 | 121116 | ||
| 121117 | /* subtype(X) | ||
| 121118 | ** | ||
| 121119 | ** Return the subtype of X | ||
| 121120 | */ | ||
| 121121 | static void subtypeFunc( | ||
| 121122 | sqlite3_context *context, | ||
| 121123 | int argc, | ||
| 121124 | sqlite3_value **argv | ||
| 121125 | ){ | ||
| 121126 | UNUSED_PARAMETER(argc); | ||
| 121127 | sqlite3_result_int(context, sqlite3_value_subtype(argv[0])); | ||
| 121128 | } | ||
| 120269 | 121129 | ||
| 120270 | /* | 121130 | /* |
| 120271 | ** Implementation of the length() function | 121131 | ** Implementation of the length() function |
| @@ -120427,7 +121287,7 @@ endInstrOOM: | |||
| 120427 | } | 121287 | } |
| 120428 | 121288 | ||
| 120429 | /* | 121289 | /* |
| 120430 | ** Implementation of the printf() function. | 121290 | ** Implementation of the printf() (a.k.a. format()) SQL function. |
| 120431 | */ | 121291 | */ |
| 120432 | static void printfFunc( | 121292 | static void printfFunc( |
| 120433 | sqlite3_context *context, | 121293 | sqlite3_context *context, |
| @@ -121196,39 +122056,42 @@ static const char hexdigits[] = { | |||
| 121196 | }; | 122056 | }; |
| 121197 | 122057 | ||
| 121198 | /* | 122058 | /* |
| 121199 | ** Implementation of the QUOTE() function. This function takes a single | 122059 | ** Append to pStr text that is the SQL literal representation of the |
| 121200 | ** argument. If the argument is numeric, the return value is the same as | 122060 | ** value contained in pValue. |
| 121201 | ** the argument. If the argument is NULL, the return value is the string | ||
| 121202 | ** "NULL". Otherwise, the argument is enclosed in single quotes with | ||
| 121203 | ** single-quote escapes. | ||
| 121204 | */ | 122061 | */ |
| 121205 | static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ | 122062 | SQLITE_PRIVATE void sqlite3QuoteValue(StrAccum *pStr, sqlite3_value *pValue){ |
| 121206 | assert( argc==1 ); | 122063 | /* As currently implemented, the string must be initially empty. |
| 121207 | UNUSED_PARAMETER(argc); | 122064 | ** we might relax this requirement in the future, but that will |
| 121208 | switch( sqlite3_value_type(argv[0]) ){ | 122065 | ** require enhancements to the implementation. */ |
| 122066 | assert( pStr!=0 && pStr->nChar==0 ); | ||
| 122067 | |||
| 122068 | switch( sqlite3_value_type(pValue) ){ | ||
| 121209 | case SQLITE_FLOAT: { | 122069 | case SQLITE_FLOAT: { |
| 121210 | double r1, r2; | 122070 | double r1, r2; |
| 121211 | char zBuf[50]; | 122071 | const char *zVal; |
| 121212 | r1 = sqlite3_value_double(argv[0]); | 122072 | r1 = sqlite3_value_double(pValue); |
| 121213 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.15g", r1); | 122073 | sqlite3_str_appendf(pStr, "%!.15g", r1); |
| 121214 | sqlite3AtoF(zBuf, &r2, 20, SQLITE_UTF8); | 122074 | zVal = sqlite3_str_value(pStr); |
| 121215 | if( r1!=r2 ){ | 122075 | if( zVal ){ |
| 121216 | sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.20e", r1); | 122076 | sqlite3AtoF(zVal, &r2, pStr->nChar, SQLITE_UTF8); |
| 122077 | if( r1!=r2 ){ | ||
| 122078 | sqlite3_str_reset(pStr); | ||
| 122079 | sqlite3_str_appendf(pStr, "%!.20e", r1); | ||
| 122080 | } | ||
| 121217 | } | 122081 | } |
| 121218 | sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); | ||
| 121219 | break; | 122082 | break; |
| 121220 | } | 122083 | } |
| 121221 | case SQLITE_INTEGER: { | 122084 | case SQLITE_INTEGER: { |
| 121222 | sqlite3_result_value(context, argv[0]); | 122085 | sqlite3_str_appendf(pStr, "%lld", sqlite3_value_int64(pValue)); |
| 121223 | break; | 122086 | break; |
| 121224 | } | 122087 | } |
| 121225 | case SQLITE_BLOB: { | 122088 | case SQLITE_BLOB: { |
| 121226 | char *zText = 0; | 122089 | char const *zBlob = sqlite3_value_blob(pValue); |
| 121227 | char const *zBlob = sqlite3_value_blob(argv[0]); | 122090 | int nBlob = sqlite3_value_bytes(pValue); |
| 121228 | int nBlob = sqlite3_value_bytes(argv[0]); | 122091 | assert( zBlob==sqlite3_value_blob(pValue) ); /* No encoding change */ |
| 121229 | assert( zBlob==sqlite3_value_blob(argv[0]) ); /* No encoding change */ | 122092 | sqlite3StrAccumEnlarge(pStr, nBlob*2 + 4); |
| 121230 | zText = (char *)contextMalloc(context, (2*(i64)nBlob)+4); | 122093 | if( pStr->accError==0 ){ |
| 121231 | if( zText ){ | 122094 | char *zText = pStr->zText; |
| 121232 | int i; | 122095 | int i; |
| 121233 | for(i=0; i<nBlob; i++){ | 122096 | for(i=0; i<nBlob; i++){ |
| 121234 | zText[(i*2)+2] = hexdigits[(zBlob[i]>>4)&0x0F]; | 122097 | zText[(i*2)+2] = hexdigits[(zBlob[i]>>4)&0x0F]; |
| @@ -121238,43 +122101,49 @@ static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ | |||
| 121238 | zText[(nBlob*2)+3] = '\0'; | 122101 | zText[(nBlob*2)+3] = '\0'; |
| 121239 | zText[0] = 'X'; | 122102 | zText[0] = 'X'; |
| 121240 | zText[1] = '\''; | 122103 | zText[1] = '\''; |
| 121241 | sqlite3_result_text(context, zText, -1, SQLITE_TRANSIENT); | 122104 | pStr->nChar = nBlob*2 + 3; |
| 121242 | sqlite3_free(zText); | ||
| 121243 | } | 122105 | } |
| 121244 | break; | 122106 | break; |
| 121245 | } | 122107 | } |
| 121246 | case SQLITE_TEXT: { | 122108 | case SQLITE_TEXT: { |
| 121247 | int i,j; | 122109 | const unsigned char *zArg = sqlite3_value_text(pValue); |
| 121248 | u64 n; | 122110 | sqlite3_str_appendf(pStr, "%Q", zArg); |
| 121249 | const unsigned char *zArg = sqlite3_value_text(argv[0]); | ||
| 121250 | char *z; | ||
| 121251 | |||
| 121252 | if( zArg==0 ) return; | ||
| 121253 | for(i=0, n=0; zArg[i]; i++){ if( zArg[i]=='\'' ) n++; } | ||
| 121254 | z = contextMalloc(context, ((i64)i)+((i64)n)+3); | ||
| 121255 | if( z ){ | ||
| 121256 | z[0] = '\''; | ||
| 121257 | for(i=0, j=1; zArg[i]; i++){ | ||
| 121258 | z[j++] = zArg[i]; | ||
| 121259 | if( zArg[i]=='\'' ){ | ||
| 121260 | z[j++] = '\''; | ||
| 121261 | } | ||
| 121262 | } | ||
| 121263 | z[j++] = '\''; | ||
| 121264 | z[j] = 0; | ||
| 121265 | sqlite3_result_text(context, z, j, sqlite3_free); | ||
| 121266 | } | ||
| 121267 | break; | 122111 | break; |
| 121268 | } | 122112 | } |
| 121269 | default: { | 122113 | default: { |
| 121270 | assert( sqlite3_value_type(argv[0])==SQLITE_NULL ); | 122114 | assert( sqlite3_value_type(pValue)==SQLITE_NULL ); |
| 121271 | sqlite3_result_text(context, "NULL", 4, SQLITE_STATIC); | 122115 | sqlite3_str_append(pStr, "NULL", 4); |
| 121272 | break; | 122116 | break; |
| 121273 | } | 122117 | } |
| 121274 | } | 122118 | } |
| 121275 | } | 122119 | } |
| 121276 | 122120 | ||
| 121277 | /* | 122121 | /* |
| 122122 | ** Implementation of the QUOTE() function. | ||
| 122123 | ** | ||
| 122124 | ** The quote(X) function returns the text of an SQL literal which is the | ||
| 122125 | ** value of its argument suitable for inclusion into an SQL statement. | ||
| 122126 | ** Strings are surrounded by single-quotes with escapes on interior quotes | ||
| 122127 | ** as needed. BLOBs are encoded as hexadecimal literals. Strings with | ||
| 122128 | ** embedded NUL characters cannot be represented as string literals in SQL | ||
| 122129 | ** and hence the returned string literal is truncated prior to the first NUL. | ||
| 122130 | */ | ||
| 122131 | static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ | ||
| 122132 | sqlite3_str str; | ||
| 122133 | sqlite3 *db = sqlite3_context_db_handle(context); | ||
| 122134 | assert( argc==1 ); | ||
| 122135 | UNUSED_PARAMETER(argc); | ||
| 122136 | sqlite3StrAccumInit(&str, db, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]); | ||
| 122137 | sqlite3QuoteValue(&str,argv[0]); | ||
| 122138 | sqlite3_result_text(context, sqlite3StrAccumFinish(&str), str.nChar, | ||
| 122139 | SQLITE_DYNAMIC); | ||
| 122140 | if( str.accError!=SQLITE_OK ){ | ||
| 122141 | sqlite3_result_null(context); | ||
| 122142 | sqlite3_result_error_code(context, str.accError); | ||
| 122143 | } | ||
| 122144 | } | ||
| 122145 | |||
| 122146 | /* | ||
| 121278 | ** The unicode() function. Return the integer unicode code-point value | 122147 | ** The unicode() function. Return the integer unicode code-point value |
| 121279 | ** for the first character of the input string. | 122148 | ** for the first character of the input string. |
| 121280 | */ | 122149 | */ |
| @@ -122407,9 +123276,11 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ | |||
| 122407 | WAGGREGATE(max, 1, 1, 1, minmaxStep, minMaxFinalize, minMaxValue, 0, | 123276 | WAGGREGATE(max, 1, 1, 1, minmaxStep, minMaxFinalize, minMaxValue, 0, |
| 122408 | SQLITE_FUNC_MINMAX|SQLITE_FUNC_ANYORDER ), | 123277 | SQLITE_FUNC_MINMAX|SQLITE_FUNC_ANYORDER ), |
| 122409 | FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQLITE_FUNC_TYPEOF), | 123278 | FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQLITE_FUNC_TYPEOF), |
| 123279 | FUNCTION2(subtype, 1, 0, 0, subtypeFunc, SQLITE_FUNC_TYPEOF), | ||
| 122410 | FUNCTION2(length, 1, 0, 0, lengthFunc, SQLITE_FUNC_LENGTH), | 123280 | FUNCTION2(length, 1, 0, 0, lengthFunc, SQLITE_FUNC_LENGTH), |
| 122411 | FUNCTION(instr, 2, 0, 0, instrFunc ), | 123281 | FUNCTION(instr, 2, 0, 0, instrFunc ), |
| 122412 | FUNCTION(printf, -1, 0, 0, printfFunc ), | 123282 | FUNCTION(printf, -1, 0, 0, printfFunc ), |
| 123283 | FUNCTION(format, -1, 0, 0, printfFunc ), | ||
| 122413 | FUNCTION(unicode, 1, 0, 0, unicodeFunc ), | 123284 | FUNCTION(unicode, 1, 0, 0, unicodeFunc ), |
| 122414 | FUNCTION(char, -1, 0, 0, charFunc ), | 123285 | FUNCTION(char, -1, 0, 0, charFunc ), |
| 122415 | FUNCTION(abs, 1, 0, 0, absFunc ), | 123286 | FUNCTION(abs, 1, 0, 0, absFunc ), |
| @@ -122508,6 +123379,7 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ | |||
| 122508 | #endif | 123379 | #endif |
| 122509 | sqlite3WindowFunctions(); | 123380 | sqlite3WindowFunctions(); |
| 122510 | sqlite3RegisterDateTimeFunctions(); | 123381 | sqlite3RegisterDateTimeFunctions(); |
| 123382 | sqlite3RegisterJsonFunctions(); | ||
| 122511 | sqlite3InsertBuiltinFuncs(aBuiltinFunc, ArraySize(aBuiltinFunc)); | 123383 | sqlite3InsertBuiltinFuncs(aBuiltinFunc, ArraySize(aBuiltinFunc)); |
| 122512 | 123384 | ||
| 122513 | #if 0 /* Enable to print out how the built-in functions are hashed */ | 123385 | #if 0 /* Enable to print out how the built-in functions are hashed */ |
| @@ -123183,7 +124055,7 @@ static void fkScanChildren( | |||
| 123183 | ** clause. For each row found, increment either the deferred or immediate | 124055 | ** clause. For each row found, increment either the deferred or immediate |
| 123184 | ** foreign key constraint counter. */ | 124056 | ** foreign key constraint counter. */ |
| 123185 | if( pParse->nErr==0 ){ | 124057 | if( pParse->nErr==0 ){ |
| 123186 | pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0); | 124058 | pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0, 0); |
| 123187 | sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr); | 124059 | sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr); |
| 123188 | if( pWInfo ){ | 124060 | if( pWInfo ){ |
| 123189 | sqlite3WhereEnd(pWInfo); | 124061 | sqlite3WhereEnd(pWInfo); |
| @@ -123235,6 +124107,25 @@ static void fkTriggerDelete(sqlite3 *dbMem, Trigger *p){ | |||
| 123235 | } | 124107 | } |
| 123236 | 124108 | ||
| 123237 | /* | 124109 | /* |
| 124110 | ** Clear the apTrigger[] cache of CASCADE triggers for all foreign keys | ||
| 124111 | ** in a particular database. This needs to happen when the schema | ||
| 124112 | ** changes. | ||
| 124113 | */ | ||
| 124114 | SQLITE_PRIVATE void sqlite3FkClearTriggerCache(sqlite3 *db, int iDb){ | ||
| 124115 | HashElem *k; | ||
| 124116 | Hash *pHash = &db->aDb[iDb].pSchema->tblHash; | ||
| 124117 | for(k=sqliteHashFirst(pHash); k; k=sqliteHashNext(k)){ | ||
| 124118 | Table *pTab = sqliteHashData(k); | ||
| 124119 | FKey *pFKey; | ||
| 124120 | if( !IsOrdinaryTable(pTab) ) continue; | ||
| 124121 | for(pFKey=pTab->u.tab.pFKey; pFKey; pFKey=pFKey->pNextFrom){ | ||
| 124122 | fkTriggerDelete(db, pFKey->apTrigger[0]); pFKey->apTrigger[0] = 0; | ||
| 124123 | fkTriggerDelete(db, pFKey->apTrigger[1]); pFKey->apTrigger[1] = 0; | ||
| 124124 | } | ||
| 124125 | } | ||
| 124126 | } | ||
| 124127 | |||
| 124128 | /* | ||
| 123238 | ** This function is called to generate code that runs when table pTab is | 124129 | ** This function is called to generate code that runs when table pTab is |
| 123239 | ** being dropped from the database. The SrcList passed as the second argument | 124130 | ** being dropped from the database. The SrcList passed as the second argument |
| 123240 | ** to this function contains a single entry guaranteed to resolve to | 124131 | ** to this function contains a single entry guaranteed to resolve to |
| @@ -124034,7 +124925,7 @@ SQLITE_PRIVATE void sqlite3OpenTable( | |||
| 124034 | }else{ | 124925 | }else{ |
| 124035 | Index *pPk = sqlite3PrimaryKeyIndex(pTab); | 124926 | Index *pPk = sqlite3PrimaryKeyIndex(pTab); |
| 124036 | assert( pPk!=0 ); | 124927 | assert( pPk!=0 ); |
| 124037 | assert( pPk->tnum==pTab->tnum ); | 124928 | assert( pPk->tnum==pTab->tnum || CORRUPT_DB ); |
| 124038 | sqlite3VdbeAddOp3(v, opcode, iCur, pPk->tnum, iDb); | 124929 | sqlite3VdbeAddOp3(v, opcode, iCur, pPk->tnum, iDb); |
| 124039 | sqlite3VdbeSetP4KeyInfo(pParse, pPk); | 124930 | sqlite3VdbeSetP4KeyInfo(pParse, pPk); |
| 124040 | VdbeComment((v, "%s", pTab->zName)); | 124931 | VdbeComment((v, "%s", pTab->zName)); |
| @@ -124706,9 +125597,11 @@ SQLITE_PRIVATE void sqlite3Insert( | |||
| 124706 | #endif | 125597 | #endif |
| 124707 | 125598 | ||
| 124708 | db = pParse->db; | 125599 | db = pParse->db; |
| 124709 | if( pParse->nErr || db->mallocFailed ){ | 125600 | assert( db->pParse==pParse ); |
| 125601 | if( pParse->nErr ){ | ||
| 124710 | goto insert_cleanup; | 125602 | goto insert_cleanup; |
| 124711 | } | 125603 | } |
| 125604 | assert( db->mallocFailed==0 ); | ||
| 124712 | dest.iSDParm = 0; /* Suppress a harmless compiler warning */ | 125605 | dest.iSDParm = 0; /* Suppress a harmless compiler warning */ |
| 124713 | 125606 | ||
| 124714 | /* If the Select object is really just a simple VALUES() list with a | 125607 | /* If the Select object is really just a simple VALUES() list with a |
| @@ -124884,7 +125777,9 @@ SQLITE_PRIVATE void sqlite3Insert( | |||
| 124884 | dest.nSdst = pTab->nCol; | 125777 | dest.nSdst = pTab->nCol; |
| 124885 | rc = sqlite3Select(pParse, pSelect, &dest); | 125778 | rc = sqlite3Select(pParse, pSelect, &dest); |
| 124886 | regFromSelect = dest.iSdst; | 125779 | regFromSelect = dest.iSdst; |
| 124887 | if( rc || db->mallocFailed || pParse->nErr ) goto insert_cleanup; | 125780 | assert( db->pParse==pParse ); |
| 125781 | if( rc || pParse->nErr ) goto insert_cleanup; | ||
| 125782 | assert( db->mallocFailed==0 ); | ||
| 124888 | sqlite3VdbeEndCoroutine(v, regYield); | 125783 | sqlite3VdbeEndCoroutine(v, regYield); |
| 124889 | sqlite3VdbeJumpHere(v, addrTop - 1); /* label B: */ | 125784 | sqlite3VdbeJumpHere(v, addrTop - 1); /* label B: */ |
| 124890 | assert( pSelect->pEList ); | 125785 | assert( pSelect->pEList ); |
| @@ -125373,9 +126268,7 @@ insert_end: | |||
| 125373 | ** invoke the callback function. | 126268 | ** invoke the callback function. |
| 125374 | */ | 126269 | */ |
| 125375 | if( regRowCount ){ | 126270 | if( regRowCount ){ |
| 125376 | sqlite3VdbeAddOp2(v, OP_ChngCntRow, regRowCount, 1); | 126271 | sqlite3CodeChangeCount(v, regRowCount, "rows inserted"); |
| 125377 | sqlite3VdbeSetNumCols(v, 1); | ||
| 125378 | sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows inserted", SQLITE_STATIC); | ||
| 125379 | } | 126272 | } |
| 125380 | 126273 | ||
| 125381 | insert_cleanup: | 126274 | insert_cleanup: |
| @@ -126540,7 +127433,6 @@ SQLITE_PRIVATE void sqlite3CompleteInsertion( | |||
| 126540 | } | 127433 | } |
| 126541 | pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0); | 127434 | pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0); |
| 126542 | if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){ | 127435 | if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){ |
| 126543 | assert( pParse->nested==0 ); | ||
| 126544 | pik_flags |= OPFLAG_NCHANGE; | 127436 | pik_flags |= OPFLAG_NCHANGE; |
| 126545 | pik_flags |= (update_flags & OPFLAG_SAVEPOSITION); | 127437 | pik_flags |= (update_flags & OPFLAG_SAVEPOSITION); |
| 126546 | if( update_flags==0 ){ | 127438 | if( update_flags==0 ){ |
| @@ -127630,6 +128522,13 @@ struct sqlite3_api_routines { | |||
| 127630 | int (*autovacuum_pages)(sqlite3*, | 128522 | int (*autovacuum_pages)(sqlite3*, |
| 127631 | unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int), | 128523 | unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int), |
| 127632 | void*, void(*)(void*)); | 128524 | void*, void(*)(void*)); |
| 128525 | /* Version 3.38.0 and later */ | ||
| 128526 | int (*error_offset)(sqlite3*); | ||
| 128527 | int (*vtab_rhs_value)(sqlite3_index_info*,int,sqlite3_value**); | ||
| 128528 | int (*vtab_distinct)(sqlite3_index_info*); | ||
| 128529 | int (*vtab_in)(sqlite3_index_info*,int,int); | ||
| 128530 | int (*vtab_in_first)(sqlite3_value*,sqlite3_value**); | ||
| 128531 | int (*vtab_in_next)(sqlite3_value*,sqlite3_value**); | ||
| 127633 | }; | 128532 | }; |
| 127634 | 128533 | ||
| 127635 | /* | 128534 | /* |
| @@ -127941,6 +128840,13 @@ typedef int (*sqlite3_loadext_entry)( | |||
| 127941 | #define sqlite3_total_changes64 sqlite3_api->total_changes64 | 128840 | #define sqlite3_total_changes64 sqlite3_api->total_changes64 |
| 127942 | /* Version 3.37.0 and later */ | 128841 | /* Version 3.37.0 and later */ |
| 127943 | #define sqlite3_autovacuum_pages sqlite3_api->autovacuum_pages | 128842 | #define sqlite3_autovacuum_pages sqlite3_api->autovacuum_pages |
| 128843 | /* Version 3.38.0 and later */ | ||
| 128844 | #define sqlite3_error_offset sqlite3_api->error_offset | ||
| 128845 | #define sqlite3_vtab_rhs_value sqlite3_api->vtab_rhs_value | ||
| 128846 | #define sqlite3_vtab_distinct sqlite3_api->vtab_distinct | ||
| 128847 | #define sqlite3_vtab_in sqlite3_api->vtab_in | ||
| 128848 | #define sqlite3_vtab_in_first sqlite3_api->vtab_in_first | ||
| 128849 | #define sqlite3_vtab_in_next sqlite3_api->vtab_in_next | ||
| 127944 | #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ | 128850 | #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ |
| 127945 | 128851 | ||
| 127946 | #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) | 128852 | #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) |
| @@ -128430,6 +129336,13 @@ static const sqlite3_api_routines sqlite3Apis = { | |||
| 128430 | sqlite3_total_changes64, | 129336 | sqlite3_total_changes64, |
| 128431 | /* Version 3.37.0 and later */ | 129337 | /* Version 3.37.0 and later */ |
| 128432 | sqlite3_autovacuum_pages, | 129338 | sqlite3_autovacuum_pages, |
| 129339 | /* Version 3.38.0 and later */ | ||
| 129340 | sqlite3_error_offset, | ||
| 129341 | sqlite3_vtab_rhs_value, | ||
| 129342 | sqlite3_vtab_distinct, | ||
| 129343 | sqlite3_vtab_in, | ||
| 129344 | sqlite3_vtab_in_first, | ||
| 129345 | sqlite3_vtab_in_next | ||
| 128433 | }; | 129346 | }; |
| 128434 | 129347 | ||
| 128435 | /* True if x is the directory separator character | 129348 | /* True if x is the directory separator character |
| @@ -130731,6 +131644,10 @@ SQLITE_PRIVATE void sqlite3Pragma( | |||
| 130731 | (void)sqlite3_finalize(pDummy); | 131644 | (void)sqlite3_finalize(pDummy); |
| 130732 | sqlite3DbFree(db, zSql); | 131645 | sqlite3DbFree(db, zSql); |
| 130733 | } | 131646 | } |
| 131647 | if( db->mallocFailed ){ | ||
| 131648 | sqlite3ErrorMsg(db->pParse, "out of memory"); | ||
| 131649 | db->pParse->rc = SQLITE_NOMEM_BKPT; | ||
| 131650 | } | ||
| 130734 | pHash = &db->aDb[ii].pSchema->tblHash; | 131651 | pHash = &db->aDb[ii].pSchema->tblHash; |
| 130735 | break; | 131652 | break; |
| 130736 | } | 131653 | } |
| @@ -132767,8 +133684,14 @@ SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){ | |||
| 132767 | /* | 133684 | /* |
| 132768 | ** Free all memory allocations in the pParse object | 133685 | ** Free all memory allocations in the pParse object |
| 132769 | */ | 133686 | */ |
| 132770 | SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){ | 133687 | SQLITE_PRIVATE void sqlite3ParseObjectReset(Parse *pParse){ |
| 132771 | sqlite3 *db = pParse->db; | 133688 | sqlite3 *db = pParse->db; |
| 133689 | assert( db!=0 ); | ||
| 133690 | assert( db->pParse==pParse ); | ||
| 133691 | assert( pParse->nested==0 ); | ||
| 133692 | #ifndef SQLITE_OMIT_SHARED_CACHE | ||
| 133693 | sqlite3DbFree(db, pParse->aTableLock); | ||
| 133694 | #endif | ||
| 132772 | while( pParse->pCleanup ){ | 133695 | while( pParse->pCleanup ){ |
| 132773 | ParseCleanup *pCleanup = pParse->pCleanup; | 133696 | ParseCleanup *pCleanup = pParse->pCleanup; |
| 132774 | pParse->pCleanup = pCleanup->pNext; | 133697 | pParse->pCleanup = pCleanup->pNext; |
| @@ -132779,11 +133702,12 @@ SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){ | |||
| 132779 | if( pParse->pConstExpr ){ | 133702 | if( pParse->pConstExpr ){ |
| 132780 | sqlite3ExprListDelete(db, pParse->pConstExpr); | 133703 | sqlite3ExprListDelete(db, pParse->pConstExpr); |
| 132781 | } | 133704 | } |
| 132782 | if( db ){ | 133705 | assert( db->lookaside.bDisable >= pParse->disableLookaside ); |
| 132783 | assert( db->lookaside.bDisable >= pParse->disableLookaside ); | 133706 | db->lookaside.bDisable -= pParse->disableLookaside; |
| 132784 | db->lookaside.bDisable -= pParse->disableLookaside; | 133707 | db->lookaside.sz = db->lookaside.bDisable ? 0 : db->lookaside.szTrue; |
| 132785 | db->lookaside.sz = db->lookaside.bDisable ? 0 : db->lookaside.szTrue; | 133708 | assert( pParse->db->pParse==pParse ); |
| 132786 | } | 133709 | db->pParse = pParse->pOuterParse; |
| 133710 | pParse->db = 0; | ||
| 132787 | pParse->disableLookaside = 0; | 133711 | pParse->disableLookaside = 0; |
| 132788 | } | 133712 | } |
| 132789 | 133713 | ||
| @@ -132796,7 +133720,7 @@ SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){ | |||
| 132796 | ** cost for this mechansim (an extra malloc), so it should not be used | 133720 | ** cost for this mechansim (an extra malloc), so it should not be used |
| 132797 | ** for common cleanups that happen on most calls. But for less | 133721 | ** for common cleanups that happen on most calls. But for less |
| 132798 | ** common cleanups, we save a single NULL-pointer comparison in | 133722 | ** common cleanups, we save a single NULL-pointer comparison in |
| 132799 | ** sqlite3ParserReset(), which reduces the total CPU cycle count. | 133723 | ** sqlite3ParseObjectReset(), which reduces the total CPU cycle count. |
| 132800 | ** | 133724 | ** |
| 132801 | ** If a memory allocation error occurs, then the cleanup happens immediately. | 133725 | ** If a memory allocation error occurs, then the cleanup happens immediately. |
| 132802 | ** When either SQLITE_DEBUG or SQLITE_COVERAGE_TEST are defined, the | 133726 | ** When either SQLITE_DEBUG or SQLITE_COVERAGE_TEST are defined, the |
| @@ -132837,6 +133761,25 @@ SQLITE_PRIVATE void *sqlite3ParserAddCleanup( | |||
| 132837 | } | 133761 | } |
| 132838 | 133762 | ||
| 132839 | /* | 133763 | /* |
| 133764 | ** Turn bulk memory into a valid Parse object and link that Parse object | ||
| 133765 | ** into database connection db. | ||
| 133766 | ** | ||
| 133767 | ** Call sqlite3ParseObjectReset() to undo this operation. | ||
| 133768 | ** | ||
| 133769 | ** Caution: Do not confuse this routine with sqlite3ParseObjectInit() which | ||
| 133770 | ** is generated by Lemon. | ||
| 133771 | */ | ||
| 133772 | SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse *pParse, sqlite3 *db){ | ||
| 133773 | memset(PARSE_HDR(pParse), 0, PARSE_HDR_SZ); | ||
| 133774 | memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ); | ||
| 133775 | assert( db->pParse!=pParse ); | ||
| 133776 | pParse->pOuterParse = db->pParse; | ||
| 133777 | db->pParse = pParse; | ||
| 133778 | pParse->db = db; | ||
| 133779 | if( db->mallocFailed ) sqlite3ErrorMsg(pParse, "out of memory"); | ||
| 133780 | } | ||
| 133781 | |||
| 133782 | /* | ||
| 132840 | ** Compile the UTF-8 encoded SQL statement zSql into a statement handle. | 133783 | ** Compile the UTF-8 encoded SQL statement zSql into a statement handle. |
| 132841 | */ | 133784 | */ |
| 132842 | static int sqlite3Prepare( | 133785 | static int sqlite3Prepare( |
| @@ -132848,16 +133791,19 @@ static int sqlite3Prepare( | |||
| 132848 | sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ | 133791 | sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ |
| 132849 | const char **pzTail /* OUT: End of parsed string */ | 133792 | const char **pzTail /* OUT: End of parsed string */ |
| 132850 | ){ | 133793 | ){ |
| 132851 | char *zErrMsg = 0; /* Error message */ | ||
| 132852 | int rc = SQLITE_OK; /* Result code */ | 133794 | int rc = SQLITE_OK; /* Result code */ |
| 132853 | int i; /* Loop counter */ | 133795 | int i; /* Loop counter */ |
| 132854 | Parse sParse; /* Parsing context */ | 133796 | Parse sParse; /* Parsing context */ |
| 132855 | 133797 | ||
| 132856 | memset(&sParse, 0, PARSE_HDR_SZ); | 133798 | /* sqlite3ParseObjectInit(&sParse, db); // inlined for performance */ |
| 133799 | memset(PARSE_HDR(&sParse), 0, PARSE_HDR_SZ); | ||
| 132857 | memset(PARSE_TAIL(&sParse), 0, PARSE_TAIL_SZ); | 133800 | memset(PARSE_TAIL(&sParse), 0, PARSE_TAIL_SZ); |
| 133801 | sParse.pOuterParse = db->pParse; | ||
| 133802 | db->pParse = &sParse; | ||
| 133803 | sParse.db = db; | ||
| 132858 | sParse.pReprepare = pReprepare; | 133804 | sParse.pReprepare = pReprepare; |
| 132859 | assert( ppStmt && *ppStmt==0 ); | 133805 | assert( ppStmt && *ppStmt==0 ); |
| 132860 | /* assert( !db->mallocFailed ); // not true with SQLITE_USE_ALLOCA */ | 133806 | if( db->mallocFailed ) sqlite3ErrorMsg(&sParse, "out of memory"); |
| 132861 | assert( sqlite3_mutex_held(db->mutex) ); | 133807 | assert( sqlite3_mutex_held(db->mutex) ); |
| 132862 | 133808 | ||
| 132863 | /* For a long-term use prepared statement avoid the use of | 133809 | /* For a long-term use prepared statement avoid the use of |
| @@ -132910,7 +133856,6 @@ static int sqlite3Prepare( | |||
| 132910 | 133856 | ||
| 132911 | sqlite3VtabUnlockList(db); | 133857 | sqlite3VtabUnlockList(db); |
| 132912 | 133858 | ||
| 132913 | sParse.db = db; | ||
| 132914 | if( nBytes>=0 && (nBytes==0 || zSql[nBytes-1]!=0) ){ | 133859 | if( nBytes>=0 && (nBytes==0 || zSql[nBytes-1]!=0) ){ |
| 132915 | char *zSqlCopy; | 133860 | char *zSqlCopy; |
| 132916 | int mxLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH]; | 133861 | int mxLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH]; |
| @@ -132923,14 +133868,14 @@ static int sqlite3Prepare( | |||
| 132923 | } | 133868 | } |
| 132924 | zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes); | 133869 | zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes); |
| 132925 | if( zSqlCopy ){ | 133870 | if( zSqlCopy ){ |
| 132926 | sqlite3RunParser(&sParse, zSqlCopy, &zErrMsg); | 133871 | sqlite3RunParser(&sParse, zSqlCopy); |
| 132927 | sParse.zTail = &zSql[sParse.zTail-zSqlCopy]; | 133872 | sParse.zTail = &zSql[sParse.zTail-zSqlCopy]; |
| 132928 | sqlite3DbFree(db, zSqlCopy); | 133873 | sqlite3DbFree(db, zSqlCopy); |
| 132929 | }else{ | 133874 | }else{ |
| 132930 | sParse.zTail = &zSql[nBytes]; | 133875 | sParse.zTail = &zSql[nBytes]; |
| 132931 | } | 133876 | } |
| 132932 | }else{ | 133877 | }else{ |
| 132933 | sqlite3RunParser(&sParse, zSql, &zErrMsg); | 133878 | sqlite3RunParser(&sParse, zSql); |
| 132934 | } | 133879 | } |
| 132935 | assert( 0==sParse.nQueryLoop ); | 133880 | assert( 0==sParse.nQueryLoop ); |
| 132936 | 133881 | ||
| @@ -132946,7 +133891,7 @@ static int sqlite3Prepare( | |||
| 132946 | sParse.checkSchema = 0; | 133891 | sParse.checkSchema = 0; |
| 132947 | } | 133892 | } |
| 132948 | if( sParse.rc!=SQLITE_OK && sParse.rc!=SQLITE_DONE ){ | 133893 | if( sParse.rc!=SQLITE_OK && sParse.rc!=SQLITE_DONE ){ |
| 132949 | if( sParse.checkSchema ){ | 133894 | if( sParse.checkSchema && db->init.busy==0 ){ |
| 132950 | schemaIsValid(&sParse); | 133895 | schemaIsValid(&sParse); |
| 132951 | } | 133896 | } |
| 132952 | if( sParse.pVdbe ){ | 133897 | if( sParse.pVdbe ){ |
| @@ -132954,14 +133899,14 @@ static int sqlite3Prepare( | |||
| 132954 | } | 133899 | } |
| 132955 | assert( 0==(*ppStmt) ); | 133900 | assert( 0==(*ppStmt) ); |
| 132956 | rc = sParse.rc; | 133901 | rc = sParse.rc; |
| 132957 | if( zErrMsg ){ | 133902 | if( sParse.zErrMsg ){ |
| 132958 | sqlite3ErrorWithMsg(db, rc, "%s", zErrMsg); | 133903 | sqlite3ErrorWithMsg(db, rc, "%s", sParse.zErrMsg); |
| 132959 | sqlite3DbFree(db, zErrMsg); | 133904 | sqlite3DbFree(db, sParse.zErrMsg); |
| 132960 | }else{ | 133905 | }else{ |
| 132961 | sqlite3Error(db, rc); | 133906 | sqlite3Error(db, rc); |
| 132962 | } | 133907 | } |
| 132963 | }else{ | 133908 | }else{ |
| 132964 | assert( zErrMsg==0 ); | 133909 | assert( sParse.zErrMsg==0 ); |
| 132965 | *ppStmt = (sqlite3_stmt*)sParse.pVdbe; | 133910 | *ppStmt = (sqlite3_stmt*)sParse.pVdbe; |
| 132966 | rc = SQLITE_OK; | 133911 | rc = SQLITE_OK; |
| 132967 | sqlite3ErrorClear(db); | 133912 | sqlite3ErrorClear(db); |
| @@ -132977,7 +133922,7 @@ static int sqlite3Prepare( | |||
| 132977 | 133922 | ||
| 132978 | end_prepare: | 133923 | end_prepare: |
| 132979 | 133924 | ||
| 132980 | sqlite3ParserReset(&sParse); | 133925 | sqlite3ParseObjectReset(&sParse); |
| 132981 | return rc; | 133926 | return rc; |
| 132982 | } | 133927 | } |
| 132983 | static int sqlite3LockAndPrepare( | 133928 | static int sqlite3LockAndPrepare( |
| @@ -133582,14 +134527,14 @@ static void addWhereTerm( | |||
| 133582 | ExprSetProperty(pEq, EP_FromJoin); | 134527 | ExprSetProperty(pEq, EP_FromJoin); |
| 133583 | assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) ); | 134528 | assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) ); |
| 133584 | ExprSetVVAProperty(pEq, EP_NoReduce); | 134529 | ExprSetVVAProperty(pEq, EP_NoReduce); |
| 133585 | pEq->iRightJoinTable = pE2->iTable; | 134530 | pEq->w.iRightJoinTable = pE2->iTable; |
| 133586 | } | 134531 | } |
| 133587 | *ppWhere = sqlite3ExprAnd(pParse, *ppWhere, pEq); | 134532 | *ppWhere = sqlite3ExprAnd(pParse, *ppWhere, pEq); |
| 133588 | } | 134533 | } |
| 133589 | 134534 | ||
| 133590 | /* | 134535 | /* |
| 133591 | ** Set the EP_FromJoin property on all terms of the given expression. | 134536 | ** Set the EP_FromJoin property on all terms of the given expression. |
| 133592 | ** And set the Expr.iRightJoinTable to iTable for every term in the | 134537 | ** And set the Expr.w.iRightJoinTable to iTable for every term in the |
| 133593 | ** expression. | 134538 | ** expression. |
| 133594 | ** | 134539 | ** |
| 133595 | ** The EP_FromJoin property is used on terms of an expression to tell | 134540 | ** The EP_FromJoin property is used on terms of an expression to tell |
| @@ -133599,8 +134544,8 @@ static void addWhereTerm( | |||
| 133599 | ** WHERE clause during join processing but we need to remember that they | 134544 | ** WHERE clause during join processing but we need to remember that they |
| 133600 | ** originated in the ON or USING clause. | 134545 | ** originated in the ON or USING clause. |
| 133601 | ** | 134546 | ** |
| 133602 | ** The Expr.iRightJoinTable tells the WHERE clause processing that the | 134547 | ** The Expr.w.iRightJoinTable tells the WHERE clause processing that the |
| 133603 | ** expression depends on table iRightJoinTable even if that table is not | 134548 | ** expression depends on table w.iRightJoinTable even if that table is not |
| 133604 | ** explicitly mentioned in the expression. That information is needed | 134549 | ** explicitly mentioned in the expression. That information is needed |
| 133605 | ** for cases like this: | 134550 | ** for cases like this: |
| 133606 | ** | 134551 | ** |
| @@ -133618,7 +134563,7 @@ SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr *p, int iTable){ | |||
| 133618 | ExprSetProperty(p, EP_FromJoin); | 134563 | ExprSetProperty(p, EP_FromJoin); |
| 133619 | assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) ); | 134564 | assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) ); |
| 133620 | ExprSetVVAProperty(p, EP_NoReduce); | 134565 | ExprSetVVAProperty(p, EP_NoReduce); |
| 133621 | p->iRightJoinTable = iTable; | 134566 | p->w.iRightJoinTable = iTable; |
| 133622 | if( p->op==TK_FUNCTION ){ | 134567 | if( p->op==TK_FUNCTION ){ |
| 133623 | assert( ExprUseXList(p) ); | 134568 | assert( ExprUseXList(p) ); |
| 133624 | if( p->x.pList ){ | 134569 | if( p->x.pList ){ |
| @@ -133634,7 +134579,7 @@ SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr *p, int iTable){ | |||
| 133634 | } | 134579 | } |
| 133635 | 134580 | ||
| 133636 | /* Undo the work of sqlite3SetJoinExpr(). In the expression p, convert every | 134581 | /* Undo the work of sqlite3SetJoinExpr(). In the expression p, convert every |
| 133637 | ** term that is marked with EP_FromJoin and iRightJoinTable==iTable into | 134582 | ** term that is marked with EP_FromJoin and w.iRightJoinTable==iTable into |
| 133638 | ** an ordinary term that omits the EP_FromJoin mark. | 134583 | ** an ordinary term that omits the EP_FromJoin mark. |
| 133639 | ** | 134584 | ** |
| 133640 | ** This happens when a LEFT JOIN is simplified into an ordinary JOIN. | 134585 | ** This happens when a LEFT JOIN is simplified into an ordinary JOIN. |
| @@ -133642,7 +134587,7 @@ SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr *p, int iTable){ | |||
| 133642 | static void unsetJoinExpr(Expr *p, int iTable){ | 134587 | static void unsetJoinExpr(Expr *p, int iTable){ |
| 133643 | while( p ){ | 134588 | while( p ){ |
| 133644 | if( ExprHasProperty(p, EP_FromJoin) | 134589 | if( ExprHasProperty(p, EP_FromJoin) |
| 133645 | && (iTable<0 || p->iRightJoinTable==iTable) ){ | 134590 | && (iTable<0 || p->w.iRightJoinTable==iTable) ){ |
| 133646 | ExprClearProperty(p, EP_FromJoin); | 134591 | ExprClearProperty(p, EP_FromJoin); |
| 133647 | } | 134592 | } |
| 133648 | if( p->op==TK_COLUMN && p->iTable==iTable ){ | 134593 | if( p->op==TK_COLUMN && p->iTable==iTable ){ |
| @@ -134632,7 +135577,7 @@ SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){ | |||
| 134632 | p->nRef = 1; | 135577 | p->nRef = 1; |
| 134633 | memset(&p[1], 0, nExtra); | 135578 | memset(&p[1], 0, nExtra); |
| 134634 | }else{ | 135579 | }else{ |
| 134635 | sqlite3OomFault(db); | 135580 | return (KeyInfo*)sqlite3OomFault(db); |
| 134636 | } | 135581 | } |
| 134637 | return p; | 135582 | return p; |
| 134638 | } | 135583 | } |
| @@ -134803,6 +135748,9 @@ static void generateSortTail( | |||
| 134803 | 135748 | ||
| 134804 | iTab = pSort->iECursor; | 135749 | iTab = pSort->iECursor; |
| 134805 | if( eDest==SRT_Output || eDest==SRT_Coroutine || eDest==SRT_Mem ){ | 135750 | if( eDest==SRT_Output || eDest==SRT_Coroutine || eDest==SRT_Mem ){ |
| 135751 | if( eDest==SRT_Mem && p->iOffset ){ | ||
| 135752 | sqlite3VdbeAddOp2(v, OP_Null, 0, pDest->iSdst); | ||
| 135753 | } | ||
| 134806 | regRowid = 0; | 135754 | regRowid = 0; |
| 134807 | regRow = pDest->iSdst; | 135755 | regRow = pDest->iSdst; |
| 134808 | }else{ | 135756 | }else{ |
| @@ -136524,6 +137472,8 @@ static int multiSelectOrderBy( | |||
| 136524 | ){ | 137472 | ){ |
| 136525 | int i, j; /* Loop counters */ | 137473 | int i, j; /* Loop counters */ |
| 136526 | Select *pPrior; /* Another SELECT immediately to our left */ | 137474 | Select *pPrior; /* Another SELECT immediately to our left */ |
| 137475 | Select *pSplit; /* Left-most SELECT in the right-hand group */ | ||
| 137476 | int nSelect; /* Number of SELECT statements in the compound */ | ||
| 136527 | Vdbe *v; /* Generate code to this VDBE */ | 137477 | Vdbe *v; /* Generate code to this VDBE */ |
| 136528 | SelectDest destA; /* Destination for coroutine A */ | 137478 | SelectDest destA; /* Destination for coroutine A */ |
| 136529 | SelectDest destB; /* Destination for coroutine B */ | 137479 | SelectDest destB; /* Destination for coroutine B */ |
| @@ -136569,8 +137519,7 @@ static int multiSelectOrderBy( | |||
| 136569 | /* Patch up the ORDER BY clause | 137519 | /* Patch up the ORDER BY clause |
| 136570 | */ | 137520 | */ |
| 136571 | op = p->op; | 137521 | op = p->op; |
| 136572 | pPrior = p->pPrior; | 137522 | assert( p->pPrior->pOrderBy==0 ); |
| 136573 | assert( pPrior->pOrderBy==0 ); | ||
| 136574 | pOrderBy = p->pOrderBy; | 137523 | pOrderBy = p->pOrderBy; |
| 136575 | assert( pOrderBy ); | 137524 | assert( pOrderBy ); |
| 136576 | nOrderBy = pOrderBy->nExpr; | 137525 | nOrderBy = pOrderBy->nExpr; |
| @@ -136620,11 +137569,6 @@ static int multiSelectOrderBy( | |||
| 136620 | pKeyMerge = 0; | 137569 | pKeyMerge = 0; |
| 136621 | } | 137570 | } |
| 136622 | 137571 | ||
| 136623 | /* Reattach the ORDER BY clause to the query. | ||
| 136624 | */ | ||
| 136625 | p->pOrderBy = pOrderBy; | ||
| 136626 | pPrior->pOrderBy = sqlite3ExprListDup(pParse->db, pOrderBy, 0); | ||
| 136627 | |||
| 136628 | /* Allocate a range of temporary registers and the KeyInfo needed | 137572 | /* Allocate a range of temporary registers and the KeyInfo needed |
| 136629 | ** for the logic that removes duplicate result rows when the | 137573 | ** for the logic that removes duplicate result rows when the |
| 136630 | ** operator is UNION, EXCEPT, or INTERSECT (but not UNION ALL). | 137574 | ** operator is UNION, EXCEPT, or INTERSECT (but not UNION ALL). |
| @@ -136649,12 +137593,30 @@ static int multiSelectOrderBy( | |||
| 136649 | 137593 | ||
| 136650 | /* Separate the left and the right query from one another | 137594 | /* Separate the left and the right query from one another |
| 136651 | */ | 137595 | */ |
| 136652 | p->pPrior = 0; | 137596 | nSelect = 1; |
| 137597 | if( (op==TK_ALL || op==TK_UNION) | ||
| 137598 | && OptimizationEnabled(db, SQLITE_BalancedMerge) | ||
| 137599 | ){ | ||
| 137600 | for(pSplit=p; pSplit->pPrior!=0 && pSplit->op==op; pSplit=pSplit->pPrior){ | ||
| 137601 | nSelect++; | ||
| 137602 | assert( pSplit->pPrior->pNext==pSplit ); | ||
| 137603 | } | ||
| 137604 | } | ||
| 137605 | if( nSelect<=3 ){ | ||
| 137606 | pSplit = p; | ||
| 137607 | }else{ | ||
| 137608 | pSplit = p; | ||
| 137609 | for(i=2; i<nSelect; i+=2){ pSplit = pSplit->pPrior; } | ||
| 137610 | } | ||
| 137611 | pPrior = pSplit->pPrior; | ||
| 137612 | assert( pPrior!=0 ); | ||
| 137613 | pSplit->pPrior = 0; | ||
| 136653 | pPrior->pNext = 0; | 137614 | pPrior->pNext = 0; |
| 137615 | assert( p->pOrderBy == pOrderBy ); | ||
| 137616 | assert( pOrderBy!=0 || db->mallocFailed ); | ||
| 137617 | pPrior->pOrderBy = sqlite3ExprListDup(pParse->db, pOrderBy, 0); | ||
| 136654 | sqlite3ResolveOrderGroupBy(pParse, p, p->pOrderBy, "ORDER"); | 137618 | sqlite3ResolveOrderGroupBy(pParse, p, p->pOrderBy, "ORDER"); |
| 136655 | if( pPrior->pPrior==0 ){ | 137619 | sqlite3ResolveOrderGroupBy(pParse, pPrior, pPrior->pOrderBy, "ORDER"); |
| 136656 | sqlite3ResolveOrderGroupBy(pParse, pPrior, pPrior->pOrderBy, "ORDER"); | ||
| 136657 | } | ||
| 136658 | 137620 | ||
| 136659 | /* Compute the limit registers */ | 137621 | /* Compute the limit registers */ |
| 136660 | computeLimitRegisters(pParse, p, labelEnd); | 137622 | computeLimitRegisters(pParse, p, labelEnd); |
| @@ -136805,12 +137767,11 @@ static int multiSelectOrderBy( | |||
| 136805 | 137767 | ||
| 136806 | /* Reassembly the compound query so that it will be freed correctly | 137768 | /* Reassembly the compound query so that it will be freed correctly |
| 136807 | ** by the calling function */ | 137769 | ** by the calling function */ |
| 136808 | if( p->pPrior ){ | 137770 | if( pSplit->pPrior ){ |
| 136809 | sqlite3SelectDelete(db, p->pPrior); | 137771 | sqlite3SelectDelete(db, pSplit->pPrior); |
| 136810 | } | 137772 | } |
| 136811 | p->pPrior = pPrior; | 137773 | pSplit->pPrior = pPrior; |
| 136812 | pPrior->pNext = p; | 137774 | pPrior->pNext = pSplit; |
| 136813 | |||
| 136814 | sqlite3ExprListDelete(db, pPrior->pOrderBy); | 137775 | sqlite3ExprListDelete(db, pPrior->pOrderBy); |
| 136815 | pPrior->pOrderBy = 0; | 137776 | pPrior->pOrderBy = 0; |
| 136816 | 137777 | ||
| @@ -136860,9 +137821,9 @@ static Expr *substExpr( | |||
| 136860 | ){ | 137821 | ){ |
| 136861 | if( pExpr==0 ) return 0; | 137822 | if( pExpr==0 ) return 0; |
| 136862 | if( ExprHasProperty(pExpr, EP_FromJoin) | 137823 | if( ExprHasProperty(pExpr, EP_FromJoin) |
| 136863 | && pExpr->iRightJoinTable==pSubst->iTable | 137824 | && pExpr->w.iRightJoinTable==pSubst->iTable |
| 136864 | ){ | 137825 | ){ |
| 136865 | pExpr->iRightJoinTable = pSubst->iNewTable; | 137826 | pExpr->w.iRightJoinTable = pSubst->iNewTable; |
| 136866 | } | 137827 | } |
| 136867 | if( pExpr->op==TK_COLUMN | 137828 | if( pExpr->op==TK_COLUMN |
| 136868 | && pExpr->iTable==pSubst->iTable | 137829 | && pExpr->iTable==pSubst->iTable |
| @@ -136901,7 +137862,7 @@ static Expr *substExpr( | |||
| 136901 | ExprSetProperty(pNew, EP_CanBeNull); | 137862 | ExprSetProperty(pNew, EP_CanBeNull); |
| 136902 | } | 137863 | } |
| 136903 | if( ExprHasProperty(pExpr,EP_FromJoin) ){ | 137864 | if( ExprHasProperty(pExpr,EP_FromJoin) ){ |
| 136904 | sqlite3SetJoinExpr(pNew, pExpr->iRightJoinTable); | 137865 | sqlite3SetJoinExpr(pNew, pExpr->w.iRightJoinTable); |
| 136905 | } | 137866 | } |
| 136906 | sqlite3ExprDelete(db, pExpr); | 137867 | sqlite3ExprDelete(db, pExpr); |
| 136907 | pExpr = pNew; | 137868 | pExpr = pNew; |
| @@ -137066,7 +138027,7 @@ static int renumberCursorsCb(Walker *pWalker, Expr *pExpr){ | |||
| 137066 | renumberCursorDoMapping(pWalker, &pExpr->iTable); | 138027 | renumberCursorDoMapping(pWalker, &pExpr->iTable); |
| 137067 | } | 138028 | } |
| 137068 | if( ExprHasProperty(pExpr, EP_FromJoin) ){ | 138029 | if( ExprHasProperty(pExpr, EP_FromJoin) ){ |
| 137069 | renumberCursorDoMapping(pWalker, &pExpr->iRightJoinTable); | 138030 | renumberCursorDoMapping(pWalker, &pExpr->w.iRightJoinTable); |
| 137070 | } | 138031 | } |
| 137071 | return WRC_Continue; | 138032 | return WRC_Continue; |
| 137072 | } | 138033 | } |
| @@ -138076,11 +139037,13 @@ static int pushDownWhereTerms( | |||
| 138076 | } | 139037 | } |
| 138077 | if( isLeftJoin | 139038 | if( isLeftJoin |
| 138078 | && (ExprHasProperty(pWhere,EP_FromJoin)==0 | 139039 | && (ExprHasProperty(pWhere,EP_FromJoin)==0 |
| 138079 | || pWhere->iRightJoinTable!=iCursor) | 139040 | || pWhere->w.iRightJoinTable!=iCursor) |
| 138080 | ){ | 139041 | ){ |
| 138081 | return 0; /* restriction (4) */ | 139042 | return 0; /* restriction (4) */ |
| 138082 | } | 139043 | } |
| 138083 | if( ExprHasProperty(pWhere,EP_FromJoin) && pWhere->iRightJoinTable!=iCursor ){ | 139044 | if( ExprHasProperty(pWhere,EP_FromJoin) |
| 139045 | && pWhere->w.iRightJoinTable!=iCursor | ||
| 139046 | ){ | ||
| 138084 | return 0; /* restriction (5) */ | 139047 | return 0; /* restriction (5) */ |
| 138085 | } | 139048 | } |
| 138086 | if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){ | 139049 | if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){ |
| @@ -138800,7 +139763,8 @@ static int selectExpander(Walker *pWalker, Select *p){ | |||
| 138800 | 139763 | ||
| 138801 | /* Process NATURAL keywords, and ON and USING clauses of joins. | 139764 | /* Process NATURAL keywords, and ON and USING clauses of joins. |
| 138802 | */ | 139765 | */ |
| 138803 | if( pParse->nErr || db->mallocFailed || sqliteProcessJoin(pParse, p) ){ | 139766 | assert( db->mallocFailed==0 || pParse->nErr!=0 ); |
| 139767 | if( pParse->nErr || sqliteProcessJoin(pParse, p) ){ | ||
| 138804 | return WRC_Abort; | 139768 | return WRC_Abort; |
| 138805 | } | 139769 | } |
| 138806 | 139770 | ||
| @@ -139097,12 +140061,13 @@ SQLITE_PRIVATE void sqlite3SelectPrep( | |||
| 139097 | NameContext *pOuterNC /* Name context for container */ | 140061 | NameContext *pOuterNC /* Name context for container */ |
| 139098 | ){ | 140062 | ){ |
| 139099 | assert( p!=0 || pParse->db->mallocFailed ); | 140063 | assert( p!=0 || pParse->db->mallocFailed ); |
| 140064 | assert( pParse->db->pParse==pParse ); | ||
| 139100 | if( pParse->db->mallocFailed ) return; | 140065 | if( pParse->db->mallocFailed ) return; |
| 139101 | if( p->selFlags & SF_HasTypeInfo ) return; | 140066 | if( p->selFlags & SF_HasTypeInfo ) return; |
| 139102 | sqlite3SelectExpand(pParse, p); | 140067 | sqlite3SelectExpand(pParse, p); |
| 139103 | if( pParse->nErr || pParse->db->mallocFailed ) return; | 140068 | if( pParse->nErr ) return; |
| 139104 | sqlite3ResolveSelectNames(pParse, p, pOuterNC); | 140069 | sqlite3ResolveSelectNames(pParse, p, pOuterNC); |
| 139105 | if( pParse->nErr || pParse->db->mallocFailed ) return; | 140070 | if( pParse->nErr ) return; |
| 139106 | sqlite3SelectAddTypeInfo(pParse, p); | 140071 | sqlite3SelectAddTypeInfo(pParse, p); |
| 139107 | } | 140072 | } |
| 139108 | 140073 | ||
| @@ -139119,8 +140084,10 @@ static void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){ | |||
| 139119 | int i; | 140084 | int i; |
| 139120 | struct AggInfo_func *pFunc; | 140085 | struct AggInfo_func *pFunc; |
| 139121 | int nReg = pAggInfo->nFunc + pAggInfo->nColumn; | 140086 | int nReg = pAggInfo->nFunc + pAggInfo->nColumn; |
| 140087 | assert( pParse->db->pParse==pParse ); | ||
| 140088 | assert( pParse->db->mallocFailed==0 || pParse->nErr!=0 ); | ||
| 139122 | if( nReg==0 ) return; | 140089 | if( nReg==0 ) return; |
| 139123 | if( pParse->nErr || pParse->db->mallocFailed ) return; | 140090 | if( pParse->nErr ) return; |
| 139124 | #ifdef SQLITE_DEBUG | 140091 | #ifdef SQLITE_DEBUG |
| 139125 | /* Verify that all AggInfo registers are within the range specified by | 140092 | /* Verify that all AggInfo registers are within the range specified by |
| 139126 | ** AggInfo.mnReg..AggInfo.mxReg */ | 140093 | ** AggInfo.mnReg..AggInfo.mxReg */ |
| @@ -139543,10 +140510,12 @@ SQLITE_PRIVATE int sqlite3Select( | |||
| 139543 | u8 minMaxFlag; /* Flag for min/max queries */ | 140510 | u8 minMaxFlag; /* Flag for min/max queries */ |
| 139544 | 140511 | ||
| 139545 | db = pParse->db; | 140512 | db = pParse->db; |
| 140513 | assert( pParse==db->pParse ); | ||
| 139546 | v = sqlite3GetVdbe(pParse); | 140514 | v = sqlite3GetVdbe(pParse); |
| 139547 | if( p==0 || db->mallocFailed || pParse->nErr ){ | 140515 | if( p==0 || pParse->nErr ){ |
| 139548 | return 1; | 140516 | return 1; |
| 139549 | } | 140517 | } |
| 140518 | assert( db->mallocFailed==0 ); | ||
| 139550 | if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1; | 140519 | if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1; |
| 139551 | #if SELECTTRACE_ENABLED | 140520 | #if SELECTTRACE_ENABLED |
| 139552 | SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->addrExplain)); | 140521 | SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->addrExplain)); |
| @@ -139581,9 +140550,10 @@ SQLITE_PRIVATE int sqlite3Select( | |||
| 139581 | p->selFlags |= SF_NoopOrderBy; | 140550 | p->selFlags |= SF_NoopOrderBy; |
| 139582 | } | 140551 | } |
| 139583 | sqlite3SelectPrep(pParse, p, 0); | 140552 | sqlite3SelectPrep(pParse, p, 0); |
| 139584 | if( pParse->nErr || db->mallocFailed ){ | 140553 | if( pParse->nErr ){ |
| 139585 | goto select_end; | 140554 | goto select_end; |
| 139586 | } | 140555 | } |
| 140556 | assert( db->mallocFailed==0 ); | ||
| 139587 | assert( p->pEList!=0 ); | 140557 | assert( p->pEList!=0 ); |
| 139588 | #if SELECTTRACE_ENABLED | 140558 | #if SELECTTRACE_ENABLED |
| 139589 | if( sqlite3SelectTrace & 0x104 ){ | 140559 | if( sqlite3SelectTrace & 0x104 ){ |
| @@ -139627,7 +140597,7 @@ SQLITE_PRIVATE int sqlite3Select( | |||
| 139627 | 140597 | ||
| 139628 | #ifndef SQLITE_OMIT_WINDOWFUNC | 140598 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 139629 | if( sqlite3WindowRewrite(pParse, p) ){ | 140599 | if( sqlite3WindowRewrite(pParse, p) ){ |
| 139630 | assert( db->mallocFailed || pParse->nErr>0 ); | 140600 | assert( pParse->nErr ); |
| 139631 | goto select_end; | 140601 | goto select_end; |
| 139632 | } | 140602 | } |
| 139633 | #if SELECTTRACE_ENABLED | 140603 | #if SELECTTRACE_ENABLED |
| @@ -140103,7 +141073,7 @@ SQLITE_PRIVATE int sqlite3Select( | |||
| 140103 | /* Begin the database scan. */ | 141073 | /* Begin the database scan. */ |
| 140104 | SELECTTRACE(1,pParse,p,("WhereBegin\n")); | 141074 | SELECTTRACE(1,pParse,p,("WhereBegin\n")); |
| 140105 | pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, sSort.pOrderBy, | 141075 | pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, sSort.pOrderBy, |
| 140106 | p->pEList, wctrlFlags, p->nSelectRow); | 141076 | p->pEList, p, wctrlFlags, p->nSelectRow); |
| 140107 | if( pWInfo==0 ) goto select_end; | 141077 | if( pWInfo==0 ) goto select_end; |
| 140108 | if( sqlite3WhereOutputRowCount(pWInfo) < p->nSelectRow ){ | 141078 | if( sqlite3WhereOutputRowCount(pWInfo) < p->nSelectRow ){ |
| 140109 | p->nSelectRow = sqlite3WhereOutputRowCount(pWInfo); | 141079 | p->nSelectRow = sqlite3WhereOutputRowCount(pWInfo); |
| @@ -140367,7 +141337,7 @@ SQLITE_PRIVATE int sqlite3Select( | |||
| 140367 | sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset); | 141337 | sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset); |
| 140368 | SELECTTRACE(1,pParse,p,("WhereBegin\n")); | 141338 | SELECTTRACE(1,pParse,p,("WhereBegin\n")); |
| 140369 | pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pGroupBy, pDistinct, | 141339 | pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pGroupBy, pDistinct, |
| 140370 | WHERE_GROUPBY | (orderByGrp ? WHERE_SORTBYGROUP : 0) | distFlag, 0 | 141340 | 0, (WHERE_GROUPBY|(orderByGrp ? WHERE_SORTBYGROUP : 0)|distFlag), 0 |
| 140371 | ); | 141341 | ); |
| 140372 | if( pWInfo==0 ){ | 141342 | if( pWInfo==0 ){ |
| 140373 | sqlite3ExprListDelete(db, pDistinct); | 141343 | sqlite3ExprListDelete(db, pDistinct); |
| @@ -140665,7 +141635,7 @@ SQLITE_PRIVATE int sqlite3Select( | |||
| 140665 | 141635 | ||
| 140666 | SELECTTRACE(1,pParse,p,("WhereBegin\n")); | 141636 | SELECTTRACE(1,pParse,p,("WhereBegin\n")); |
| 140667 | pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pMinMaxOrderBy, | 141637 | pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pMinMaxOrderBy, |
| 140668 | pDistinct, minMaxFlag|distFlag, 0); | 141638 | pDistinct, 0, minMaxFlag|distFlag, 0); |
| 140669 | if( pWInfo==0 ){ | 141639 | if( pWInfo==0 ){ |
| 140670 | goto select_end; | 141640 | goto select_end; |
| 140671 | } | 141641 | } |
| @@ -140722,7 +141692,7 @@ SQLITE_PRIVATE int sqlite3Select( | |||
| 140722 | */ | 141692 | */ |
| 140723 | select_end: | 141693 | select_end: |
| 140724 | assert( db->mallocFailed==0 || db->mallocFailed==1 ); | 141694 | assert( db->mallocFailed==0 || db->mallocFailed==1 ); |
| 140725 | pParse->nErr += db->mallocFailed; | 141695 | assert( db->mallocFailed==0 || pParse->nErr!=0 ); |
| 140726 | sqlite3ExprListDelete(db, pMinMaxOrderBy); | 141696 | sqlite3ExprListDelete(db, pMinMaxOrderBy); |
| 140727 | #ifdef SQLITE_DEBUG | 141697 | #ifdef SQLITE_DEBUG |
| 140728 | if( pAggInfo && !db->mallocFailed ){ | 141698 | if( pAggInfo && !db->mallocFailed ){ |
| @@ -141874,6 +142844,7 @@ static void codeReturningTrigger( | |||
| 141874 | 142844 | ||
| 141875 | assert( v!=0 ); | 142845 | assert( v!=0 ); |
| 141876 | assert( pParse->bReturning ); | 142846 | assert( pParse->bReturning ); |
| 142847 | assert( db->pParse==pParse ); | ||
| 141877 | pReturning = pParse->u1.pReturning; | 142848 | pReturning = pParse->u1.pReturning; |
| 141878 | assert( pTrigger == &(pReturning->retTrig) ); | 142849 | assert( pTrigger == &(pReturning->retTrig) ); |
| 141879 | memset(&sSelect, 0, sizeof(sSelect)); | 142850 | memset(&sSelect, 0, sizeof(sSelect)); |
| @@ -141884,12 +142855,13 @@ static void codeReturningTrigger( | |||
| 141884 | sFrom.a[0].pTab = pTab; | 142855 | sFrom.a[0].pTab = pTab; |
| 141885 | sFrom.a[0].iCursor = -1; | 142856 | sFrom.a[0].iCursor = -1; |
| 141886 | sqlite3SelectPrep(pParse, &sSelect, 0); | 142857 | sqlite3SelectPrep(pParse, &sSelect, 0); |
| 141887 | if( db->mallocFailed==0 && pParse->nErr==0 ){ | 142858 | if( pParse->nErr==0 ){ |
| 142859 | assert( db->mallocFailed==0 ); | ||
| 141888 | sqlite3GenerateColumnNames(pParse, &sSelect); | 142860 | sqlite3GenerateColumnNames(pParse, &sSelect); |
| 141889 | } | 142861 | } |
| 141890 | sqlite3ExprListDelete(db, sSelect.pEList); | 142862 | sqlite3ExprListDelete(db, sSelect.pEList); |
| 141891 | pNew = sqlite3ExpandReturning(pParse, pReturning->pReturnEL, pTab); | 142863 | pNew = sqlite3ExpandReturning(pParse, pReturning->pReturnEL, pTab); |
| 141892 | if( pNew ){ | 142864 | if( !db->mallocFailed ){ |
| 141893 | NameContext sNC; | 142865 | NameContext sNC; |
| 141894 | memset(&sNC, 0, sizeof(sNC)); | 142866 | memset(&sNC, 0, sizeof(sNC)); |
| 141895 | if( pReturning->nRetCol==0 ){ | 142867 | if( pReturning->nRetCol==0 ){ |
| @@ -141901,7 +142873,9 @@ static void codeReturningTrigger( | |||
| 141901 | sNC.ncFlags = NC_UBaseReg; | 142873 | sNC.ncFlags = NC_UBaseReg; |
| 141902 | pParse->eTriggerOp = pTrigger->op; | 142874 | pParse->eTriggerOp = pTrigger->op; |
| 141903 | pParse->pTriggerTab = pTab; | 142875 | pParse->pTriggerTab = pTab; |
| 141904 | if( sqlite3ResolveExprListNames(&sNC, pNew)==SQLITE_OK ){ | 142876 | if( sqlite3ResolveExprListNames(&sNC, pNew)==SQLITE_OK |
| 142877 | && ALWAYS(!db->mallocFailed) | ||
| 142878 | ){ | ||
| 141905 | int i; | 142879 | int i; |
| 141906 | int nCol = pNew->nExpr; | 142880 | int nCol = pNew->nExpr; |
| 141907 | int reg = pParse->nMem+1; | 142881 | int reg = pParse->nMem+1; |
| @@ -141909,16 +142883,20 @@ static void codeReturningTrigger( | |||
| 141909 | pReturning->iRetReg = reg; | 142883 | pReturning->iRetReg = reg; |
| 141910 | for(i=0; i<nCol; i++){ | 142884 | for(i=0; i<nCol; i++){ |
| 141911 | Expr *pCol = pNew->a[i].pExpr; | 142885 | Expr *pCol = pNew->a[i].pExpr; |
| 142886 | assert( pCol!=0 ); /* Due to !db->mallocFailed ~9 lines above */ | ||
| 141912 | sqlite3ExprCodeFactorable(pParse, pCol, reg+i); | 142887 | sqlite3ExprCodeFactorable(pParse, pCol, reg+i); |
| 142888 | if( sqlite3ExprAffinity(pCol)==SQLITE_AFF_REAL ){ | ||
| 142889 | sqlite3VdbeAddOp1(v, OP_RealAffinity, reg+i); | ||
| 142890 | } | ||
| 141913 | } | 142891 | } |
| 141914 | sqlite3VdbeAddOp3(v, OP_MakeRecord, reg, i, reg+i); | 142892 | sqlite3VdbeAddOp3(v, OP_MakeRecord, reg, i, reg+i); |
| 141915 | sqlite3VdbeAddOp2(v, OP_NewRowid, pReturning->iRetCur, reg+i+1); | 142893 | sqlite3VdbeAddOp2(v, OP_NewRowid, pReturning->iRetCur, reg+i+1); |
| 141916 | sqlite3VdbeAddOp3(v, OP_Insert, pReturning->iRetCur, reg+i, reg+i+1); | 142894 | sqlite3VdbeAddOp3(v, OP_Insert, pReturning->iRetCur, reg+i, reg+i+1); |
| 141917 | } | 142895 | } |
| 141918 | sqlite3ExprListDelete(db, pNew); | ||
| 141919 | pParse->eTriggerOp = 0; | ||
| 141920 | pParse->pTriggerTab = 0; | ||
| 141921 | } | 142896 | } |
| 142897 | sqlite3ExprListDelete(db, pNew); | ||
| 142898 | pParse->eTriggerOp = 0; | ||
| 142899 | pParse->pTriggerTab = 0; | ||
| 141922 | } | 142900 | } |
| 141923 | 142901 | ||
| 141924 | 142902 | ||
| @@ -142060,8 +143038,8 @@ static TriggerPrg *codeRowTrigger( | |||
| 142060 | Vdbe *v; /* Temporary VM */ | 143038 | Vdbe *v; /* Temporary VM */ |
| 142061 | NameContext sNC; /* Name context for sub-vdbe */ | 143039 | NameContext sNC; /* Name context for sub-vdbe */ |
| 142062 | SubProgram *pProgram = 0; /* Sub-vdbe for trigger program */ | 143040 | SubProgram *pProgram = 0; /* Sub-vdbe for trigger program */ |
| 142063 | Parse *pSubParse; /* Parse context for sub-vdbe */ | ||
| 142064 | int iEndTrigger = 0; /* Label to jump to if WHEN is false */ | 143041 | int iEndTrigger = 0; /* Label to jump to if WHEN is false */ |
| 143042 | Parse sSubParse; /* Parse context for sub-vdbe */ | ||
| 142065 | 143043 | ||
| 142066 | assert( pTrigger->zName==0 || pTab==tableOfTrigger(pTrigger) ); | 143044 | assert( pTrigger->zName==0 || pTab==tableOfTrigger(pTrigger) ); |
| 142067 | assert( pTop->pVdbe ); | 143045 | assert( pTop->pVdbe ); |
| @@ -142083,19 +143061,17 @@ static TriggerPrg *codeRowTrigger( | |||
| 142083 | 143061 | ||
| 142084 | /* Allocate and populate a new Parse context to use for coding the | 143062 | /* Allocate and populate a new Parse context to use for coding the |
| 142085 | ** trigger sub-program. */ | 143063 | ** trigger sub-program. */ |
| 142086 | pSubParse = sqlite3StackAllocZero(db, sizeof(Parse)); | 143064 | sqlite3ParseObjectInit(&sSubParse, db); |
| 142087 | if( !pSubParse ) return 0; | ||
| 142088 | memset(&sNC, 0, sizeof(sNC)); | 143065 | memset(&sNC, 0, sizeof(sNC)); |
| 142089 | sNC.pParse = pSubParse; | 143066 | sNC.pParse = &sSubParse; |
| 142090 | pSubParse->db = db; | 143067 | sSubParse.pTriggerTab = pTab; |
| 142091 | pSubParse->pTriggerTab = pTab; | 143068 | sSubParse.pToplevel = pTop; |
| 142092 | pSubParse->pToplevel = pTop; | 143069 | sSubParse.zAuthContext = pTrigger->zName; |
| 142093 | pSubParse->zAuthContext = pTrigger->zName; | 143070 | sSubParse.eTriggerOp = pTrigger->op; |
| 142094 | pSubParse->eTriggerOp = pTrigger->op; | 143071 | sSubParse.nQueryLoop = pParse->nQueryLoop; |
| 142095 | pSubParse->nQueryLoop = pParse->nQueryLoop; | 143072 | sSubParse.disableVtab = pParse->disableVtab; |
| 142096 | pSubParse->disableVtab = pParse->disableVtab; | 143073 | |
| 142097 | 143074 | v = sqlite3GetVdbe(&sSubParse); | |
| 142098 | v = sqlite3GetVdbe(pSubParse); | ||
| 142099 | if( v ){ | 143075 | if( v ){ |
| 142100 | VdbeComment((v, "Start: %s.%s (%s %s%s%s ON %s)", | 143076 | VdbeComment((v, "Start: %s.%s (%s %s%s%s ON %s)", |
| 142101 | pTrigger->zName, onErrorText(orconf), | 143077 | pTrigger->zName, onErrorText(orconf), |
| @@ -142121,14 +143097,14 @@ static TriggerPrg *codeRowTrigger( | |||
| 142121 | if( db->mallocFailed==0 | 143097 | if( db->mallocFailed==0 |
| 142122 | && SQLITE_OK==sqlite3ResolveExprNames(&sNC, pWhen) | 143098 | && SQLITE_OK==sqlite3ResolveExprNames(&sNC, pWhen) |
| 142123 | ){ | 143099 | ){ |
| 142124 | iEndTrigger = sqlite3VdbeMakeLabel(pSubParse); | 143100 | iEndTrigger = sqlite3VdbeMakeLabel(&sSubParse); |
| 142125 | sqlite3ExprIfFalse(pSubParse, pWhen, iEndTrigger, SQLITE_JUMPIFNULL); | 143101 | sqlite3ExprIfFalse(&sSubParse, pWhen, iEndTrigger, SQLITE_JUMPIFNULL); |
| 142126 | } | 143102 | } |
| 142127 | sqlite3ExprDelete(db, pWhen); | 143103 | sqlite3ExprDelete(db, pWhen); |
| 142128 | } | 143104 | } |
| 142129 | 143105 | ||
| 142130 | /* Code the trigger program into the sub-vdbe. */ | 143106 | /* Code the trigger program into the sub-vdbe. */ |
| 142131 | codeTriggerProgram(pSubParse, pTrigger->step_list, orconf); | 143107 | codeTriggerProgram(&sSubParse, pTrigger->step_list, orconf); |
| 142132 | 143108 | ||
| 142133 | /* Insert an OP_Halt at the end of the sub-program. */ | 143109 | /* Insert an OP_Halt at the end of the sub-program. */ |
| 142134 | if( iEndTrigger ){ | 143110 | if( iEndTrigger ){ |
| @@ -142136,23 +143112,24 @@ static TriggerPrg *codeRowTrigger( | |||
| 142136 | } | 143112 | } |
| 142137 | sqlite3VdbeAddOp0(v, OP_Halt); | 143113 | sqlite3VdbeAddOp0(v, OP_Halt); |
| 142138 | VdbeComment((v, "End: %s.%s", pTrigger->zName, onErrorText(orconf))); | 143114 | VdbeComment((v, "End: %s.%s", pTrigger->zName, onErrorText(orconf))); |
| 143115 | transferParseError(pParse, &sSubParse); | ||
| 142139 | 143116 | ||
| 142140 | transferParseError(pParse, pSubParse); | 143117 | if( pParse->nErr==0 ){ |
| 142141 | if( db->mallocFailed==0 && pParse->nErr==0 ){ | 143118 | assert( db->mallocFailed==0 ); |
| 142142 | pProgram->aOp = sqlite3VdbeTakeOpArray(v, &pProgram->nOp, &pTop->nMaxArg); | 143119 | pProgram->aOp = sqlite3VdbeTakeOpArray(v, &pProgram->nOp, &pTop->nMaxArg); |
| 142143 | } | 143120 | } |
| 142144 | pProgram->nMem = pSubParse->nMem; | 143121 | pProgram->nMem = sSubParse.nMem; |
| 142145 | pProgram->nCsr = pSubParse->nTab; | 143122 | pProgram->nCsr = sSubParse.nTab; |
| 142146 | pProgram->token = (void *)pTrigger; | 143123 | pProgram->token = (void *)pTrigger; |
| 142147 | pPrg->aColmask[0] = pSubParse->oldmask; | 143124 | pPrg->aColmask[0] = sSubParse.oldmask; |
| 142148 | pPrg->aColmask[1] = pSubParse->newmask; | 143125 | pPrg->aColmask[1] = sSubParse.newmask; |
| 142149 | sqlite3VdbeDelete(v); | 143126 | sqlite3VdbeDelete(v); |
| 143127 | }else{ | ||
| 143128 | transferParseError(pParse, &sSubParse); | ||
| 142150 | } | 143129 | } |
| 142151 | 143130 | ||
| 142152 | assert( !pSubParse->pTriggerPrg && !pSubParse->nMaxArg ); | 143131 | assert( !sSubParse.pTriggerPrg && !sSubParse.nMaxArg ); |
| 142153 | sqlite3ParserReset(pSubParse); | 143132 | sqlite3ParseObjectReset(&sSubParse); |
| 142154 | sqlite3StackFree(db, pSubParse); | ||
| 142155 | |||
| 142156 | return pPrg; | 143133 | return pPrg; |
| 142157 | } | 143134 | } |
| 142158 | 143135 | ||
| @@ -142185,6 +143162,7 @@ static TriggerPrg *getRowTrigger( | |||
| 142185 | /* If an existing TriggerPrg could not be located, create a new one. */ | 143162 | /* If an existing TriggerPrg could not be located, create a new one. */ |
| 142186 | if( !pPrg ){ | 143163 | if( !pPrg ){ |
| 142187 | pPrg = codeRowTrigger(pParse, pTrigger, pTab, orconf); | 143164 | pPrg = codeRowTrigger(pParse, pTrigger, pTab, orconf); |
| 143165 | pParse->db->errByteOffset = -1; | ||
| 142188 | } | 143166 | } |
| 142189 | 143167 | ||
| 142190 | return pPrg; | 143168 | return pPrg; |
| @@ -142207,7 +143185,7 @@ SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect( | |||
| 142207 | Vdbe *v = sqlite3GetVdbe(pParse); /* Main VM */ | 143185 | Vdbe *v = sqlite3GetVdbe(pParse); /* Main VM */ |
| 142208 | TriggerPrg *pPrg; | 143186 | TriggerPrg *pPrg; |
| 142209 | pPrg = getRowTrigger(pParse, p, pTab, orconf); | 143187 | pPrg = getRowTrigger(pParse, p, pTab, orconf); |
| 142210 | assert( pPrg || pParse->nErr || pParse->db->mallocFailed ); | 143188 | assert( pPrg || pParse->nErr ); |
| 142211 | 143189 | ||
| 142212 | /* Code the OP_Program opcode in the parent VDBE. P4 of the OP_Program | 143190 | /* Code the OP_Program opcode in the parent VDBE. P4 of the OP_Program |
| 142213 | ** is a pointer to the sub-vdbe containing the trigger program. */ | 143191 | ** is a pointer to the sub-vdbe containing the trigger program. */ |
| @@ -142725,9 +143703,11 @@ SQLITE_PRIVATE void sqlite3Update( | |||
| 142725 | 143703 | ||
| 142726 | memset(&sContext, 0, sizeof(sContext)); | 143704 | memset(&sContext, 0, sizeof(sContext)); |
| 142727 | db = pParse->db; | 143705 | db = pParse->db; |
| 142728 | if( pParse->nErr || db->mallocFailed ){ | 143706 | assert( db->pParse==pParse ); |
| 143707 | if( pParse->nErr ){ | ||
| 142729 | goto update_cleanup; | 143708 | goto update_cleanup; |
| 142730 | } | 143709 | } |
| 143710 | assert( db->mallocFailed==0 ); | ||
| 142731 | 143711 | ||
| 142732 | /* Locate the table which we want to update. | 143712 | /* Locate the table which we want to update. |
| 142733 | */ | 143713 | */ |
| @@ -143099,7 +144079,7 @@ SQLITE_PRIVATE void sqlite3Update( | |||
| 143099 | if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){ | 144079 | if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){ |
| 143100 | flags |= WHERE_ONEPASS_MULTIROW; | 144080 | flags |= WHERE_ONEPASS_MULTIROW; |
| 143101 | } | 144081 | } |
| 143102 | pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, flags,iIdxCur); | 144082 | pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere,0,0,0,flags,iIdxCur); |
| 143103 | if( pWInfo==0 ) goto update_cleanup; | 144083 | if( pWInfo==0 ) goto update_cleanup; |
| 143104 | 144084 | ||
| 143105 | /* A one-pass strategy that might update more than one row may not | 144085 | /* A one-pass strategy that might update more than one row may not |
| @@ -143499,9 +144479,7 @@ SQLITE_PRIVATE void sqlite3Update( | |||
| 143499 | ** that information. | 144479 | ** that information. |
| 143500 | */ | 144480 | */ |
| 143501 | if( regRowCount ){ | 144481 | if( regRowCount ){ |
| 143502 | sqlite3VdbeAddOp2(v, OP_ChngCntRow, regRowCount, 1); | 144482 | sqlite3CodeChangeCount(v, regRowCount, "rows updated"); |
| 143503 | sqlite3VdbeSetNumCols(v, 1); | ||
| 143504 | sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows updated", SQLITE_STATIC); | ||
| 143505 | } | 144483 | } |
| 143506 | 144484 | ||
| 143507 | update_cleanup: | 144485 | update_cleanup: |
| @@ -143623,7 +144601,9 @@ static void updateVirtualTable( | |||
| 143623 | regRowid = ++pParse->nMem; | 144601 | regRowid = ++pParse->nMem; |
| 143624 | 144602 | ||
| 143625 | /* Start scanning the virtual table */ | 144603 | /* Start scanning the virtual table */ |
| 143626 | pWInfo = sqlite3WhereBegin(pParse, pSrc,pWhere,0,0,WHERE_ONEPASS_DESIRED,0); | 144604 | pWInfo = sqlite3WhereBegin( |
| 144605 | pParse, pSrc, pWhere, 0, 0, 0, WHERE_ONEPASS_DESIRED, 0 | ||
| 144606 | ); | ||
| 143627 | if( pWInfo==0 ) return; | 144607 | if( pWInfo==0 ) return; |
| 143628 | 144608 | ||
| 143629 | /* Populate the argument registers. */ | 144609 | /* Populate the argument registers. */ |
| @@ -145250,7 +146230,6 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ | |||
| 145250 | VtabCtx *pCtx; | 146230 | VtabCtx *pCtx; |
| 145251 | int rc = SQLITE_OK; | 146231 | int rc = SQLITE_OK; |
| 145252 | Table *pTab; | 146232 | Table *pTab; |
| 145253 | char *zErr = 0; | ||
| 145254 | Parse sParse; | 146233 | Parse sParse; |
| 145255 | int initBusy; | 146234 | int initBusy; |
| 145256 | 146235 | ||
| @@ -145269,9 +146248,8 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ | |||
| 145269 | pTab = pCtx->pTab; | 146248 | pTab = pCtx->pTab; |
| 145270 | assert( IsVirtual(pTab) ); | 146249 | assert( IsVirtual(pTab) ); |
| 145271 | 146250 | ||
| 145272 | memset(&sParse, 0, sizeof(sParse)); | 146251 | sqlite3ParseObjectInit(&sParse, db); |
| 145273 | sParse.eParseMode = PARSE_MODE_DECLARE_VTAB; | 146252 | sParse.eParseMode = PARSE_MODE_DECLARE_VTAB; |
| 145274 | sParse.db = db; | ||
| 145275 | /* We should never be able to reach this point while loading the | 146253 | /* We should never be able to reach this point while loading the |
| 145276 | ** schema. Nevertheless, defend against that (turn off db->init.busy) | 146254 | ** schema. Nevertheless, defend against that (turn off db->init.busy) |
| 145277 | ** in case a bug arises. */ | 146255 | ** in case a bug arises. */ |
| @@ -145279,11 +146257,12 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ | |||
| 145279 | initBusy = db->init.busy; | 146257 | initBusy = db->init.busy; |
| 145280 | db->init.busy = 0; | 146258 | db->init.busy = 0; |
| 145281 | sParse.nQueryLoop = 1; | 146259 | sParse.nQueryLoop = 1; |
| 145282 | if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable, &zErr) | 146260 | if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable) |
| 145283 | && sParse.pNewTable | 146261 | && ALWAYS(sParse.pNewTable!=0) |
| 145284 | && !db->mallocFailed | 146262 | && ALWAYS(!db->mallocFailed) |
| 145285 | && IsOrdinaryTable(sParse.pNewTable) | 146263 | && IsOrdinaryTable(sParse.pNewTable) |
| 145286 | ){ | 146264 | ){ |
| 146265 | assert( sParse.zErrMsg==0 ); | ||
| 145287 | if( !pTab->aCol ){ | 146266 | if( !pTab->aCol ){ |
| 145288 | Table *pNew = sParse.pNewTable; | 146267 | Table *pNew = sParse.pNewTable; |
| 145289 | Index *pIdx; | 146268 | Index *pIdx; |
| @@ -145313,8 +146292,9 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ | |||
| 145313 | } | 146292 | } |
| 145314 | pCtx->bDeclared = 1; | 146293 | pCtx->bDeclared = 1; |
| 145315 | }else{ | 146294 | }else{ |
| 145316 | sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr); | 146295 | sqlite3ErrorWithMsg(db, SQLITE_ERROR, |
| 145317 | sqlite3DbFree(db, zErr); | 146296 | (sParse.zErrMsg ? "%s" : 0), sParse.zErrMsg); |
| 146297 | sqlite3DbFree(db, sParse.zErrMsg); | ||
| 145318 | rc = SQLITE_ERROR; | 146298 | rc = SQLITE_ERROR; |
| 145319 | } | 146299 | } |
| 145320 | sParse.eParseMode = PARSE_MODE_NORMAL; | 146300 | sParse.eParseMode = PARSE_MODE_NORMAL; |
| @@ -145323,7 +146303,7 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ | |||
| 145323 | sqlite3VdbeFinalize(sParse.pVdbe); | 146303 | sqlite3VdbeFinalize(sParse.pVdbe); |
| 145324 | } | 146304 | } |
| 145325 | sqlite3DeleteTable(db, sParse.pNewTable); | 146305 | sqlite3DeleteTable(db, sParse.pNewTable); |
| 145326 | sqlite3ParserReset(&sParse); | 146306 | sqlite3ParseObjectReset(&sParse); |
| 145327 | db->init.busy = initBusy; | 146307 | db->init.busy = initBusy; |
| 145328 | 146308 | ||
| 145329 | assert( (rc&0xff)==rc ); | 146309 | assert( (rc&0xff)==rc ); |
| @@ -145875,6 +146855,7 @@ struct WhereLevel { | |||
| 145875 | u32 iLikeRepCntr; /* LIKE range processing counter register (times 2) */ | 146855 | u32 iLikeRepCntr; /* LIKE range processing counter register (times 2) */ |
| 145876 | int addrLikeRep; /* LIKE range processing address */ | 146856 | int addrLikeRep; /* LIKE range processing address */ |
| 145877 | #endif | 146857 | #endif |
| 146858 | int regFilter; /* Bloom filter */ | ||
| 145878 | u8 iFrom; /* Which entry in the FROM clause */ | 146859 | u8 iFrom; /* Which entry in the FROM clause */ |
| 145879 | u8 op, p3, p5; /* Opcode, P3 & P5 of the opcode that ends the loop */ | 146860 | u8 op, p3, p5; /* Opcode, P3 & P5 of the opcode that ends the loop */ |
| 145880 | int p1, p2; /* Operands of the opcode used to end the loop */ | 146861 | int p1, p2; /* Operands of the opcode used to end the loop */ |
| @@ -145933,10 +146914,12 @@ struct WhereLoop { | |||
| 145933 | } btree; | 146914 | } btree; |
| 145934 | struct { /* Information for virtual tables */ | 146915 | struct { /* Information for virtual tables */ |
| 145935 | int idxNum; /* Index number */ | 146916 | int idxNum; /* Index number */ |
| 145936 | u8 needFree; /* True if sqlite3_free(idxStr) is needed */ | 146917 | u32 needFree : 1; /* True if sqlite3_free(idxStr) is needed */ |
| 146918 | u32 bOmitOffset : 1; /* True to let virtual table handle offset */ | ||
| 145937 | i8 isOrdered; /* True if satisfies ORDER BY */ | 146919 | i8 isOrdered; /* True if satisfies ORDER BY */ |
| 145938 | u16 omitMask; /* Terms that may be omitted */ | 146920 | u16 omitMask; /* Terms that may be omitted */ |
| 145939 | char *idxStr; /* Index identifier string */ | 146921 | char *idxStr; /* Index identifier string */ |
| 146922 | u32 mHandleIn; /* Terms to handle as IN(...) instead of == */ | ||
| 145940 | } vtab; | 146923 | } vtab; |
| 145941 | } u; | 146924 | } u; |
| 145942 | u32 wsFlags; /* WHERE_* flags describing the plan */ | 146925 | u32 wsFlags; /* WHERE_* flags describing the plan */ |
| @@ -146080,7 +147063,7 @@ struct WhereTerm { | |||
| 146080 | #define TERM_COPIED 0x0008 /* Has a child */ | 147063 | #define TERM_COPIED 0x0008 /* Has a child */ |
| 146081 | #define TERM_ORINFO 0x0010 /* Need to free the WhereTerm.u.pOrInfo object */ | 147064 | #define TERM_ORINFO 0x0010 /* Need to free the WhereTerm.u.pOrInfo object */ |
| 146082 | #define TERM_ANDINFO 0x0020 /* Need to free the WhereTerm.u.pAndInfo obj */ | 147065 | #define TERM_ANDINFO 0x0020 /* Need to free the WhereTerm.u.pAndInfo obj */ |
| 146083 | #define TERM_OR_OK 0x0040 /* Used during OR-clause processing */ | 147066 | #define TERM_OK 0x0040 /* Used during OR-clause processing */ |
| 146084 | #define TERM_VNULL 0x0080 /* Manufactured x>NULL or x<=NULL term */ | 147067 | #define TERM_VNULL 0x0080 /* Manufactured x>NULL or x<=NULL term */ |
| 146085 | #define TERM_LIKEOPT 0x0100 /* Virtual terms from the LIKE optimization */ | 147068 | #define TERM_LIKEOPT 0x0100 /* Virtual terms from the LIKE optimization */ |
| 146086 | #define TERM_LIKECOND 0x0200 /* Conditionally this LIKE operator term */ | 147069 | #define TERM_LIKECOND 0x0200 /* Conditionally this LIKE operator term */ |
| @@ -146093,6 +147076,7 @@ struct WhereTerm { | |||
| 146093 | #else | 147076 | #else |
| 146094 | # define TERM_HIGHTRUTH 0 /* Only used with STAT4 */ | 147077 | # define TERM_HIGHTRUTH 0 /* Only used with STAT4 */ |
| 146095 | #endif | 147078 | #endif |
| 147079 | #define TERM_SLICE 0x8000 /* One slice of a row-value/vector comparison */ | ||
| 146096 | 147080 | ||
| 146097 | /* | 147081 | /* |
| 146098 | ** An instance of the WhereScan object is used as an iterator for locating | 147082 | ** An instance of the WhereScan object is used as an iterator for locating |
| @@ -146103,11 +147087,11 @@ struct WhereScan { | |||
| 146103 | WhereClause *pWC; /* WhereClause currently being scanned */ | 147087 | WhereClause *pWC; /* WhereClause currently being scanned */ |
| 146104 | const char *zCollName; /* Required collating sequence, if not NULL */ | 147088 | const char *zCollName; /* Required collating sequence, if not NULL */ |
| 146105 | Expr *pIdxExpr; /* Search for this index expression */ | 147089 | Expr *pIdxExpr; /* Search for this index expression */ |
| 147090 | int k; /* Resume scanning at this->pWC->a[this->k] */ | ||
| 147091 | u32 opMask; /* Acceptable operators */ | ||
| 146106 | char idxaff; /* Must match this affinity, if zCollName!=NULL */ | 147092 | char idxaff; /* Must match this affinity, if zCollName!=NULL */ |
| 147093 | unsigned char iEquiv; /* Current slot in aiCur[] and aiColumn[] */ | ||
| 146107 | unsigned char nEquiv; /* Number of entries in aiCur[] and aiColumn[] */ | 147094 | unsigned char nEquiv; /* Number of entries in aiCur[] and aiColumn[] */ |
| 146108 | unsigned char iEquiv; /* Next unused slot in aiCur[] and aiColumn[] */ | ||
| 146109 | u32 opMask; /* Acceptable operators */ | ||
| 146110 | int k; /* Resume scanning at this->pWC->a[this->k] */ | ||
| 146111 | int aiCur[11]; /* Cursors in the equivalence class */ | 147095 | int aiCur[11]; /* Cursors in the equivalence class */ |
| 146112 | i16 aiColumn[11]; /* Corresponding column number in the eq-class */ | 147096 | i16 aiColumn[11]; /* Corresponding column number in the eq-class */ |
| 146113 | }; | 147097 | }; |
| @@ -146131,6 +147115,7 @@ struct WhereClause { | |||
| 146131 | u8 hasOr; /* True if any a[].eOperator is WO_OR */ | 147115 | u8 hasOr; /* True if any a[].eOperator is WO_OR */ |
| 146132 | int nTerm; /* Number of terms */ | 147116 | int nTerm; /* Number of terms */ |
| 146133 | int nSlot; /* Number of entries in a[] */ | 147117 | int nSlot; /* Number of entries in a[] */ |
| 147118 | int nBase; /* Number of terms through the last non-Virtual */ | ||
| 146134 | WhereTerm *a; /* Each a[] describes a term of the WHERE cluase */ | 147119 | WhereTerm *a; /* Each a[] describes a term of the WHERE cluase */ |
| 146135 | #if defined(SQLITE_SMALL_STACK) | 147120 | #if defined(SQLITE_SMALL_STACK) |
| 146136 | WhereTerm aStatic[1]; /* Initial static space for a[] */ | 147121 | WhereTerm aStatic[1]; /* Initial static space for a[] */ |
| @@ -146189,18 +147174,12 @@ struct WhereMaskSet { | |||
| 146189 | }; | 147174 | }; |
| 146190 | 147175 | ||
| 146191 | /* | 147176 | /* |
| 146192 | ** Initialize a WhereMaskSet object | ||
| 146193 | */ | ||
| 146194 | #define initMaskSet(P) (P)->n=0 | ||
| 146195 | |||
| 146196 | /* | ||
| 146197 | ** This object is a convenience wrapper holding all information needed | 147177 | ** This object is a convenience wrapper holding all information needed |
| 146198 | ** to construct WhereLoop objects for a particular query. | 147178 | ** to construct WhereLoop objects for a particular query. |
| 146199 | */ | 147179 | */ |
| 146200 | struct WhereLoopBuilder { | 147180 | struct WhereLoopBuilder { |
| 146201 | WhereInfo *pWInfo; /* Information about this WHERE */ | 147181 | WhereInfo *pWInfo; /* Information about this WHERE */ |
| 146202 | WhereClause *pWC; /* WHERE clause terms */ | 147182 | WhereClause *pWC; /* WHERE clause terms */ |
| 146203 | ExprList *pOrderBy; /* ORDER BY clause */ | ||
| 146204 | WhereLoop *pNew; /* Template WhereLoop */ | 147183 | WhereLoop *pNew; /* Template WhereLoop */ |
| 146205 | WhereOrSet *pOrSet; /* Record best loops here, if not NULL */ | 147184 | WhereOrSet *pOrSet; /* Record best loops here, if not NULL */ |
| 146206 | #ifdef SQLITE_ENABLE_STAT4 | 147185 | #ifdef SQLITE_ENABLE_STAT4 |
| @@ -146268,6 +147247,9 @@ struct WhereInfo { | |||
| 146268 | ExprList *pOrderBy; /* The ORDER BY clause or NULL */ | 147247 | ExprList *pOrderBy; /* The ORDER BY clause or NULL */ |
| 146269 | ExprList *pResultSet; /* Result set of the query */ | 147248 | ExprList *pResultSet; /* Result set of the query */ |
| 146270 | Expr *pWhere; /* The complete WHERE clause */ | 147249 | Expr *pWhere; /* The complete WHERE clause */ |
| 147250 | #ifndef SQLITE_OMIT_VIRTUALTABLE | ||
| 147251 | Select *pLimit; /* Used to access LIMIT expr/registers for vtabs */ | ||
| 147252 | #endif | ||
| 146271 | int aiCurOnePass[2]; /* OP_OpenWrite cursors for the ONEPASS opt */ | 147253 | int aiCurOnePass[2]; /* OP_OpenWrite cursors for the ONEPASS opt */ |
| 146272 | int iContinue; /* Jump here to continue with next record */ | 147254 | int iContinue; /* Jump here to continue with next record */ |
| 146273 | int iBreak; /* Jump here to break out of the loop */ | 147255 | int iBreak; /* Jump here to break out of the loop */ |
| @@ -146321,8 +147303,14 @@ SQLITE_PRIVATE int sqlite3WhereExplainOneScan( | |||
| 146321 | WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */ | 147303 | WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */ |
| 146322 | u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */ | 147304 | u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */ |
| 146323 | ); | 147305 | ); |
| 147306 | SQLITE_PRIVATE int sqlite3WhereExplainBloomFilter( | ||
| 147307 | const Parse *pParse, /* Parse context */ | ||
| 147308 | const WhereInfo *pWInfo, /* WHERE clause */ | ||
| 147309 | const WhereLevel *pLevel /* Bloom filter on this level */ | ||
| 147310 | ); | ||
| 146324 | #else | 147311 | #else |
| 146325 | # define sqlite3WhereExplainOneScan(u,v,w,x) 0 | 147312 | # define sqlite3WhereExplainOneScan(u,v,w,x) 0 |
| 147313 | # define sqlite3WhereExplainBloomFilter(u,v,w) 0 | ||
| 146326 | #endif /* SQLITE_OMIT_EXPLAIN */ | 147314 | #endif /* SQLITE_OMIT_EXPLAIN */ |
| 146327 | #ifdef SQLITE_ENABLE_STMT_SCANSTATUS | 147315 | #ifdef SQLITE_ENABLE_STMT_SCANSTATUS |
| 146328 | SQLITE_PRIVATE void sqlite3WhereAddScanStatus( | 147316 | SQLITE_PRIVATE void sqlite3WhereAddScanStatus( |
| @@ -146347,6 +147335,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( | |||
| 146347 | SQLITE_PRIVATE void sqlite3WhereClauseInit(WhereClause*,WhereInfo*); | 147335 | SQLITE_PRIVATE void sqlite3WhereClauseInit(WhereClause*,WhereInfo*); |
| 146348 | SQLITE_PRIVATE void sqlite3WhereClauseClear(WhereClause*); | 147336 | SQLITE_PRIVATE void sqlite3WhereClauseClear(WhereClause*); |
| 146349 | SQLITE_PRIVATE void sqlite3WhereSplit(WhereClause*,Expr*,u8); | 147337 | SQLITE_PRIVATE void sqlite3WhereSplit(WhereClause*,Expr*,u8); |
| 147338 | SQLITE_PRIVATE void sqlite3WhereAddLimit(WhereClause*, Select*); | ||
| 146350 | SQLITE_PRIVATE Bitmask sqlite3WhereExprUsage(WhereMaskSet*, Expr*); | 147339 | SQLITE_PRIVATE Bitmask sqlite3WhereExprUsage(WhereMaskSet*, Expr*); |
| 146351 | SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet*, Expr*); | 147340 | SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet*, Expr*); |
| 146352 | SQLITE_PRIVATE Bitmask sqlite3WhereExprListUsage(WhereMaskSet*, ExprList*); | 147341 | SQLITE_PRIVATE Bitmask sqlite3WhereExprListUsage(WhereMaskSet*, ExprList*); |
| @@ -146415,6 +147404,9 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(Parse*, SrcItem*, WhereClause*); | |||
| 146415 | #define WHERE_BIGNULL_SORT 0x00080000 /* Column nEq of index is BIGNULL */ | 147404 | #define WHERE_BIGNULL_SORT 0x00080000 /* Column nEq of index is BIGNULL */ |
| 146416 | #define WHERE_IN_SEEKSCAN 0x00100000 /* Seek-scan optimization for IN */ | 147405 | #define WHERE_IN_SEEKSCAN 0x00100000 /* Seek-scan optimization for IN */ |
| 146417 | #define WHERE_TRANSCONS 0x00200000 /* Uses a transitive constraint */ | 147406 | #define WHERE_TRANSCONS 0x00200000 /* Uses a transitive constraint */ |
| 147407 | #define WHERE_BLOOMFILTER 0x00400000 /* Consider using a Bloom-filter */ | ||
| 147408 | #define WHERE_SELFCULL 0x00800000 /* nOut reduced by extra WHERE terms */ | ||
| 147409 | #define WHERE_OMIT_OFFSET 0x01000000 /* Set offset counter to zero */ | ||
| 146418 | 147410 | ||
| 146419 | #endif /* !defined(SQLITE_WHEREINT_H) */ | 147411 | #endif /* !defined(SQLITE_WHEREINT_H) */ |
| 146420 | 147412 | ||
| @@ -146577,19 +147569,27 @@ SQLITE_PRIVATE int sqlite3WhereExplainOneScan( | |||
| 146577 | explainIndexRange(&str, pLoop); | 147569 | explainIndexRange(&str, pLoop); |
| 146578 | } | 147570 | } |
| 146579 | }else if( (flags & WHERE_IPK)!=0 && (flags & WHERE_CONSTRAINT)!=0 ){ | 147571 | }else if( (flags & WHERE_IPK)!=0 && (flags & WHERE_CONSTRAINT)!=0 ){ |
| 146580 | const char *zRangeOp; | 147572 | char cRangeOp; |
| 147573 | #if 0 /* Better output, but breaks many tests */ | ||
| 147574 | const Table *pTab = pItem->pTab; | ||
| 147575 | const char *zRowid = pTab->iPKey>=0 ? pTab->aCol[pTab->iPKey].zCnName: | ||
| 147576 | "rowid"; | ||
| 147577 | #else | ||
| 147578 | const char *zRowid = "rowid"; | ||
| 147579 | #endif | ||
| 147580 | sqlite3_str_appendf(&str, " USING INTEGER PRIMARY KEY (%s", zRowid); | ||
| 146581 | if( flags&(WHERE_COLUMN_EQ|WHERE_COLUMN_IN) ){ | 147581 | if( flags&(WHERE_COLUMN_EQ|WHERE_COLUMN_IN) ){ |
| 146582 | zRangeOp = "="; | 147582 | cRangeOp = '='; |
| 146583 | }else if( (flags&WHERE_BOTH_LIMIT)==WHERE_BOTH_LIMIT ){ | 147583 | }else if( (flags&WHERE_BOTH_LIMIT)==WHERE_BOTH_LIMIT ){ |
| 146584 | zRangeOp = ">? AND rowid<"; | 147584 | sqlite3_str_appendf(&str, ">? AND %s", zRowid); |
| 147585 | cRangeOp = '<'; | ||
| 146585 | }else if( flags&WHERE_BTM_LIMIT ){ | 147586 | }else if( flags&WHERE_BTM_LIMIT ){ |
| 146586 | zRangeOp = ">"; | 147587 | cRangeOp = '>'; |
| 146587 | }else{ | 147588 | }else{ |
| 146588 | assert( flags&WHERE_TOP_LIMIT); | 147589 | assert( flags&WHERE_TOP_LIMIT); |
| 146589 | zRangeOp = "<"; | 147590 | cRangeOp = '<'; |
| 146590 | } | 147591 | } |
| 146591 | sqlite3_str_appendf(&str, | 147592 | sqlite3_str_appendf(&str, "%c?)", cRangeOp); |
| 146592 | " USING INTEGER PRIMARY KEY (rowid%s?)",zRangeOp); | ||
| 146593 | } | 147593 | } |
| 146594 | #ifndef SQLITE_OMIT_VIRTUALTABLE | 147594 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 146595 | else if( (flags & WHERE_VIRTUALTABLE)!=0 ){ | 147595 | else if( (flags & WHERE_VIRTUALTABLE)!=0 ){ |
| @@ -146612,6 +147612,56 @@ SQLITE_PRIVATE int sqlite3WhereExplainOneScan( | |||
| 146612 | } | 147612 | } |
| 146613 | return ret; | 147613 | return ret; |
| 146614 | } | 147614 | } |
| 147615 | |||
| 147616 | /* | ||
| 147617 | ** Add a single OP_Explain opcode that describes a Bloom filter. | ||
| 147618 | ** | ||
| 147619 | ** Or if not processing EXPLAIN QUERY PLAN and not in a SQLITE_DEBUG and/or | ||
| 147620 | ** SQLITE_ENABLE_STMT_SCANSTATUS build, then OP_Explain opcodes are not | ||
| 147621 | ** required and this routine is a no-op. | ||
| 147622 | ** | ||
| 147623 | ** If an OP_Explain opcode is added to the VM, its address is returned. | ||
| 147624 | ** Otherwise, if no OP_Explain is coded, zero is returned. | ||
| 147625 | */ | ||
| 147626 | SQLITE_PRIVATE int sqlite3WhereExplainBloomFilter( | ||
| 147627 | const Parse *pParse, /* Parse context */ | ||
| 147628 | const WhereInfo *pWInfo, /* WHERE clause */ | ||
| 147629 | const WhereLevel *pLevel /* Bloom filter on this level */ | ||
| 147630 | ){ | ||
| 147631 | int ret = 0; | ||
| 147632 | SrcItem *pItem = &pWInfo->pTabList->a[pLevel->iFrom]; | ||
| 147633 | Vdbe *v = pParse->pVdbe; /* VM being constructed */ | ||
| 147634 | sqlite3 *db = pParse->db; /* Database handle */ | ||
| 147635 | char *zMsg; /* Text to add to EQP output */ | ||
| 147636 | int i; /* Loop counter */ | ||
| 147637 | WhereLoop *pLoop; /* The where loop */ | ||
| 147638 | StrAccum str; /* EQP output string */ | ||
| 147639 | char zBuf[100]; /* Initial space for EQP output string */ | ||
| 147640 | |||
| 147641 | sqlite3StrAccumInit(&str, db, zBuf, sizeof(zBuf), SQLITE_MAX_LENGTH); | ||
| 147642 | str.printfFlags = SQLITE_PRINTF_INTERNAL; | ||
| 147643 | sqlite3_str_appendf(&str, "BLOOM FILTER ON %S (", pItem); | ||
| 147644 | pLoop = pLevel->pWLoop; | ||
| 147645 | if( pLoop->wsFlags & WHERE_IPK ){ | ||
| 147646 | const Table *pTab = pItem->pTab; | ||
| 147647 | if( pTab->iPKey>=0 ){ | ||
| 147648 | sqlite3_str_appendf(&str, "%s=?", pTab->aCol[pTab->iPKey].zCnName); | ||
| 147649 | }else{ | ||
| 147650 | sqlite3_str_appendf(&str, "rowid=?"); | ||
| 147651 | } | ||
| 147652 | }else{ | ||
| 147653 | for(i=pLoop->nSkip; i<pLoop->u.btree.nEq; i++){ | ||
| 147654 | const char *z = explainIndexColumnName(pLoop->u.btree.pIndex, i); | ||
| 147655 | if( i>pLoop->nSkip ) sqlite3_str_append(&str, " AND ", 5); | ||
| 147656 | sqlite3_str_appendf(&str, "%s=?", z); | ||
| 147657 | } | ||
| 147658 | } | ||
| 147659 | sqlite3_str_append(&str, ")", 1); | ||
| 147660 | zMsg = sqlite3StrAccumFinish(&str); | ||
| 147661 | ret = sqlite3VdbeAddOp4(v, OP_Explain, sqlite3VdbeCurrentAddr(v), | ||
| 147662 | pParse->addrExplain, 0, zMsg,P4_DYNAMIC); | ||
| 147663 | return ret; | ||
| 147664 | } | ||
| 146615 | #endif /* SQLITE_OMIT_EXPLAIN */ | 147665 | #endif /* SQLITE_OMIT_EXPLAIN */ |
| 146616 | 147666 | ||
| 146617 | #ifdef SQLITE_ENABLE_STMT_SCANSTATUS | 147667 | #ifdef SQLITE_ENABLE_STMT_SCANSTATUS |
| @@ -147167,6 +148217,9 @@ static int codeAllEqualityTerms( | |||
| 147167 | sqlite3VdbeAddOp2(v, OP_Copy, r1, regBase+j); | 148217 | sqlite3VdbeAddOp2(v, OP_Copy, r1, regBase+j); |
| 147168 | } | 148218 | } |
| 147169 | } | 148219 | } |
| 148220 | } | ||
| 148221 | for(j=nSkip; j<nEq; j++){ | ||
| 148222 | pTerm = pLoop->aLTerm[j]; | ||
| 147170 | if( pTerm->eOperator & WO_IN ){ | 148223 | if( pTerm->eOperator & WO_IN ){ |
| 147171 | if( pTerm->pExpr->flags & EP_xIsSelect ){ | 148224 | if( pTerm->pExpr->flags & EP_xIsSelect ){ |
| 147172 | /* No affinity ever needs to be (or should be) applied to a value | 148225 | /* No affinity ever needs to be (or should be) applied to a value |
| @@ -147181,7 +148234,8 @@ static int codeAllEqualityTerms( | |||
| 147181 | sqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->addrBrk); | 148234 | sqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->addrBrk); |
| 147182 | VdbeCoverage(v); | 148235 | VdbeCoverage(v); |
| 147183 | } | 148236 | } |
| 147184 | if( pParse->db->mallocFailed==0 && pParse->nErr==0 ){ | 148237 | if( pParse->nErr==0 ){ |
| 148238 | assert( pParse->db->mallocFailed==0 ); | ||
| 147185 | if( sqlite3CompareAffinity(pRight, zAff[j])==SQLITE_AFF_BLOB ){ | 148239 | if( sqlite3CompareAffinity(pRight, zAff[j])==SQLITE_AFF_BLOB ){ |
| 147186 | zAff[j] = SQLITE_AFF_BLOB; | 148240 | zAff[j] = SQLITE_AFF_BLOB; |
| 147187 | } | 148241 | } |
| @@ -147371,7 +148425,7 @@ static void codeCursorHint( | |||
| 147371 | sWalker.pParse = pParse; | 148425 | sWalker.pParse = pParse; |
| 147372 | sWalker.u.pCCurHint = &sHint; | 148426 | sWalker.u.pCCurHint = &sHint; |
| 147373 | pWC = &pWInfo->sWC; | 148427 | pWC = &pWInfo->sWC; |
| 147374 | for(i=0; i<pWC->nTerm; i++){ | 148428 | for(i=0; i<pWC->nBase; i++){ |
| 147375 | pTerm = &pWC->a[i]; | 148429 | pTerm = &pWC->a[i]; |
| 147376 | if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; | 148430 | if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; |
| 147377 | if( pTerm->prereqAll & pLevel->notReady ) continue; | 148431 | if( pTerm->prereqAll & pLevel->notReady ) continue; |
| @@ -147401,7 +148455,7 @@ static void codeCursorHint( | |||
| 147401 | if( pTabItem->fg.jointype & JT_LEFT ){ | 148455 | if( pTabItem->fg.jointype & JT_LEFT ){ |
| 147402 | Expr *pExpr = pTerm->pExpr; | 148456 | Expr *pExpr = pTerm->pExpr; |
| 147403 | if( !ExprHasProperty(pExpr, EP_FromJoin) | 148457 | if( !ExprHasProperty(pExpr, EP_FromJoin) |
| 147404 | || pExpr->iRightJoinTable!=pTabItem->iCursor | 148458 | || pExpr->w.iRightJoinTable!=pTabItem->iCursor |
| 147405 | ){ | 148459 | ){ |
| 147406 | sWalker.eCode = 0; | 148460 | sWalker.eCode = 0; |
| 147407 | sWalker.xExprCallback = codeCursorHintIsOrFunction; | 148461 | sWalker.xExprCallback = codeCursorHintIsOrFunction; |
| @@ -147703,6 +148757,64 @@ static void whereApplyPartialIndexConstraints( | |||
| 147703 | } | 148757 | } |
| 147704 | 148758 | ||
| 147705 | /* | 148759 | /* |
| 148760 | ** This routine is called right after An OP_Filter has been generated and | ||
| 148761 | ** before the corresponding index search has been performed. This routine | ||
| 148762 | ** checks to see if there are additional Bloom filters in inner loops that | ||
| 148763 | ** can be checked prior to doing the index lookup. If there are available | ||
| 148764 | ** inner-loop Bloom filters, then evaluate those filters now, before the | ||
| 148765 | ** index lookup. The idea is that a Bloom filter check is way faster than | ||
| 148766 | ** an index lookup, and the Bloom filter might return false, meaning that | ||
| 148767 | ** the index lookup can be skipped. | ||
| 148768 | ** | ||
| 148769 | ** We know that an inner loop uses a Bloom filter because it has the | ||
| 148770 | ** WhereLevel.regFilter set. If an inner-loop Bloom filter is checked, | ||
| 148771 | ** then clear the WhereLevel.regFilter value to prevent the Bloom filter | ||
| 148772 | ** from being checked a second time when the inner loop is evaluated. | ||
| 148773 | */ | ||
| 148774 | static SQLITE_NOINLINE void filterPullDown( | ||
| 148775 | Parse *pParse, /* Parsing context */ | ||
| 148776 | WhereInfo *pWInfo, /* Complete information about the WHERE clause */ | ||
| 148777 | int iLevel, /* Which level of pWInfo->a[] should be coded */ | ||
| 148778 | int addrNxt, /* Jump here to bypass inner loops */ | ||
| 148779 | Bitmask notReady /* Loops that are not ready */ | ||
| 148780 | ){ | ||
| 148781 | while( ++iLevel < pWInfo->nLevel ){ | ||
| 148782 | WhereLevel *pLevel = &pWInfo->a[iLevel]; | ||
| 148783 | WhereLoop *pLoop = pLevel->pWLoop; | ||
| 148784 | if( pLevel->regFilter==0 ) continue; | ||
| 148785 | /* ,--- Because sqlite3ConstructBloomFilter() has will not have set | ||
| 148786 | ** vvvvv--' pLevel->regFilter if this were true. */ | ||
| 148787 | if( NEVER(pLoop->prereq & notReady) ) continue; | ||
| 148788 | if( pLoop->wsFlags & WHERE_IPK ){ | ||
| 148789 | WhereTerm *pTerm = pLoop->aLTerm[0]; | ||
| 148790 | int regRowid; | ||
| 148791 | assert( pTerm!=0 ); | ||
| 148792 | assert( pTerm->pExpr!=0 ); | ||
| 148793 | testcase( pTerm->wtFlags & TERM_VIRTUAL ); | ||
| 148794 | regRowid = sqlite3GetTempReg(pParse); | ||
| 148795 | regRowid = codeEqualityTerm(pParse, pTerm, pLevel, 0, 0, regRowid); | ||
| 148796 | sqlite3VdbeAddOp4Int(pParse->pVdbe, OP_Filter, pLevel->regFilter, | ||
| 148797 | addrNxt, regRowid, 1); | ||
| 148798 | VdbeCoverage(pParse->pVdbe); | ||
| 148799 | }else{ | ||
| 148800 | u16 nEq = pLoop->u.btree.nEq; | ||
| 148801 | int r1; | ||
| 148802 | char *zStartAff; | ||
| 148803 | |||
| 148804 | assert( pLoop->wsFlags & WHERE_INDEXED ); | ||
| 148805 | assert( (pLoop->wsFlags & WHERE_COLUMN_IN)==0 ); | ||
| 148806 | r1 = codeAllEqualityTerms(pParse,pLevel,0,0,&zStartAff); | ||
| 148807 | codeApplyAffinity(pParse, r1, nEq, zStartAff); | ||
| 148808 | sqlite3DbFree(pParse->db, zStartAff); | ||
| 148809 | sqlite3VdbeAddOp4Int(pParse->pVdbe, OP_Filter, pLevel->regFilter, | ||
| 148810 | addrNxt, r1, nEq); | ||
| 148811 | VdbeCoverage(pParse->pVdbe); | ||
| 148812 | } | ||
| 148813 | pLevel->regFilter = 0; | ||
| 148814 | } | ||
| 148815 | } | ||
| 148816 | |||
| 148817 | /* | ||
| 147706 | ** Generate code for the start of the iLevel-th loop in the WHERE clause | 148818 | ** Generate code for the start of the iLevel-th loop in the WHERE clause |
| 147707 | ** implementation described by pWInfo. | 148819 | ** implementation described by pWInfo. |
| 147708 | */ | 148820 | */ |
| @@ -147813,11 +148925,27 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( | |||
| 147813 | pTerm = pLoop->aLTerm[j]; | 148925 | pTerm = pLoop->aLTerm[j]; |
| 147814 | if( NEVER(pTerm==0) ) continue; | 148926 | if( NEVER(pTerm==0) ) continue; |
| 147815 | if( pTerm->eOperator & WO_IN ){ | 148927 | if( pTerm->eOperator & WO_IN ){ |
| 147816 | codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, iTarget); | 148928 | if( SMASKBIT32(j) & pLoop->u.vtab.mHandleIn ){ |
| 147817 | addrNotFound = pLevel->addrNxt; | 148929 | int iTab = pParse->nTab++; |
| 148930 | int iCache = ++pParse->nMem; | ||
| 148931 | sqlite3CodeRhsOfIN(pParse, pTerm->pExpr, iTab); | ||
| 148932 | sqlite3VdbeAddOp3(v, OP_VInitIn, iTab, iTarget, iCache); | ||
| 148933 | }else{ | ||
| 148934 | codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, iTarget); | ||
| 148935 | addrNotFound = pLevel->addrNxt; | ||
| 148936 | } | ||
| 147818 | }else{ | 148937 | }else{ |
| 147819 | Expr *pRight = pTerm->pExpr->pRight; | 148938 | Expr *pRight = pTerm->pExpr->pRight; |
| 147820 | codeExprOrVector(pParse, pRight, iTarget, 1); | 148939 | codeExprOrVector(pParse, pRight, iTarget, 1); |
| 148940 | if( pTerm->eMatchOp==SQLITE_INDEX_CONSTRAINT_OFFSET | ||
| 148941 | && pLoop->u.vtab.bOmitOffset | ||
| 148942 | ){ | ||
| 148943 | assert( pTerm->eOperator==WO_AUX ); | ||
| 148944 | assert( pWInfo->pLimit!=0 ); | ||
| 148945 | assert( pWInfo->pLimit->iOffset>0 ); | ||
| 148946 | sqlite3VdbeAddOp2(v, OP_Integer, 0, pWInfo->pLimit->iOffset); | ||
| 148947 | VdbeComment((v,"Zero OFFSET counter")); | ||
| 148948 | } | ||
| 147821 | } | 148949 | } |
| 147822 | } | 148950 | } |
| 147823 | sqlite3VdbeAddOp2(v, OP_Integer, pLoop->u.vtab.idxNum, iReg); | 148951 | sqlite3VdbeAddOp2(v, OP_Integer, pLoop->u.vtab.idxNum, iReg); |
| @@ -147840,13 +148968,19 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( | |||
| 147840 | iIn = 0; | 148968 | iIn = 0; |
| 147841 | } | 148969 | } |
| 147842 | for(j=nConstraint-1; j>=0; j--){ | 148970 | for(j=nConstraint-1; j>=0; j--){ |
| 148971 | int bIn; /* True to generate byte code to loop over RHS IN values */ | ||
| 147843 | pTerm = pLoop->aLTerm[j]; | 148972 | pTerm = pLoop->aLTerm[j]; |
| 147844 | if( (pTerm->eOperator & WO_IN)!=0 ) iIn--; | 148973 | if( (pTerm->eOperator & WO_IN)!=0 |
| 148974 | && (SMASKBIT32(j) & pLoop->u.vtab.mHandleIn)==0 | ||
| 148975 | ){ | ||
| 148976 | bIn = 1; | ||
| 148977 | }else{ | ||
| 148978 | bIn = 0; | ||
| 148979 | } | ||
| 148980 | if( bIn ) iIn--; | ||
| 147845 | if( j<16 && (pLoop->u.vtab.omitMask>>j)&1 ){ | 148981 | if( j<16 && (pLoop->u.vtab.omitMask>>j)&1 ){ |
| 147846 | disableTerm(pLevel, pTerm); | 148982 | disableTerm(pLevel, pTerm); |
| 147847 | }else if( (pTerm->eOperator & WO_IN)!=0 | 148983 | }else if( bIn && sqlite3ExprVectorSize(pTerm->pExpr->pLeft)==1 ){ |
| 147848 | && sqlite3ExprVectorSize(pTerm->pExpr->pLeft)==1 | ||
| 147849 | ){ | ||
| 147850 | Expr *pCompare; /* The comparison operator */ | 148984 | Expr *pCompare; /* The comparison operator */ |
| 147851 | Expr *pRight; /* RHS of the comparison */ | 148985 | Expr *pRight; /* RHS of the comparison */ |
| 147852 | VdbeOp *pOp; /* Opcode to access the value of the IN constraint */ | 148986 | VdbeOp *pOp; /* Opcode to access the value of the IN constraint */ |
| @@ -147912,6 +149046,12 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( | |||
| 147912 | iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg); | 149046 | iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg); |
| 147913 | if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg); | 149047 | if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg); |
| 147914 | addrNxt = pLevel->addrNxt; | 149048 | addrNxt = pLevel->addrNxt; |
| 149049 | if( pLevel->regFilter ){ | ||
| 149050 | sqlite3VdbeAddOp4Int(v, OP_Filter, pLevel->regFilter, addrNxt, | ||
| 149051 | iRowidReg, 1); | ||
| 149052 | VdbeCoverage(v); | ||
| 149053 | filterPullDown(pParse, pWInfo, iLevel, addrNxt, notReady); | ||
| 149054 | } | ||
| 147915 | sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg); | 149055 | sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg); |
| 147916 | VdbeCoverage(v); | 149056 | VdbeCoverage(v); |
| 147917 | pLevel->op = OP_Noop; | 149057 | pLevel->op = OP_Noop; |
| @@ -148237,6 +149377,12 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( | |||
| 148237 | sqlite3VdbeAddOp2(v, OP_Integer, 1, regBignull); | 149377 | sqlite3VdbeAddOp2(v, OP_Integer, 1, regBignull); |
| 148238 | VdbeComment((v, "NULL-scan pass ctr")); | 149378 | VdbeComment((v, "NULL-scan pass ctr")); |
| 148239 | } | 149379 | } |
| 149380 | if( pLevel->regFilter ){ | ||
| 149381 | sqlite3VdbeAddOp4Int(v, OP_Filter, pLevel->regFilter, addrNxt, | ||
| 149382 | regBase, nEq); | ||
| 149383 | VdbeCoverage(v); | ||
| 149384 | filterPullDown(pParse, pWInfo, iLevel, addrNxt, notReady); | ||
| 149385 | } | ||
| 148240 | 149386 | ||
| 148241 | op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev]; | 149387 | op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev]; |
| 148242 | assert( op!=0 ); | 149388 | assert( op!=0 ); |
| @@ -148564,7 +149710,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( | |||
| 148564 | iRetInit = sqlite3VdbeAddOp2(v, OP_Integer, 0, regReturn); | 149710 | iRetInit = sqlite3VdbeAddOp2(v, OP_Integer, 0, regReturn); |
| 148565 | 149711 | ||
| 148566 | /* If the original WHERE clause is z of the form: (x1 OR x2 OR ...) AND y | 149712 | /* If the original WHERE clause is z of the form: (x1 OR x2 OR ...) AND y |
| 148567 | ** Then for every term xN, evaluate as the subexpression: xN AND z | 149713 | ** Then for every term xN, evaluate as the subexpression: xN AND y |
| 148568 | ** That way, terms in y that are factored into the disjunction will | 149714 | ** That way, terms in y that are factored into the disjunction will |
| 148569 | ** be picked up by the recursive calls to sqlite3WhereBegin() below. | 149715 | ** be picked up by the recursive calls to sqlite3WhereBegin() below. |
| 148570 | ** | 149716 | ** |
| @@ -148576,6 +149722,12 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( | |||
| 148576 | ** This optimization also only applies if the (x1 OR x2 OR ...) term | 149722 | ** This optimization also only applies if the (x1 OR x2 OR ...) term |
| 148577 | ** is not contained in the ON clause of a LEFT JOIN. | 149723 | ** is not contained in the ON clause of a LEFT JOIN. |
| 148578 | ** See ticket http://www.sqlite.org/src/info/f2369304e4 | 149724 | ** See ticket http://www.sqlite.org/src/info/f2369304e4 |
| 149725 | ** | ||
| 149726 | ** 2022-02-04: Do not push down slices of a row-value comparison. | ||
| 149727 | ** In other words, "w" or "y" may not be a slice of a vector. Otherwise, | ||
| 149728 | ** the initialization of the right-hand operand of the vector comparison | ||
| 149729 | ** might not occur, or might occur only in an OR branch that is not | ||
| 149730 | ** taken. dbsqlfuzz 80a9fade844b4fb43564efc972bcb2c68270f5d1. | ||
| 148579 | */ | 149731 | */ |
| 148580 | if( pWC->nTerm>1 ){ | 149732 | if( pWC->nTerm>1 ){ |
| 148581 | int iTerm; | 149733 | int iTerm; |
| @@ -148584,7 +149736,10 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( | |||
| 148584 | if( &pWC->a[iTerm] == pTerm ) continue; | 149736 | if( &pWC->a[iTerm] == pTerm ) continue; |
| 148585 | testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL ); | 149737 | testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL ); |
| 148586 | testcase( pWC->a[iTerm].wtFlags & TERM_CODED ); | 149738 | testcase( pWC->a[iTerm].wtFlags & TERM_CODED ); |
| 148587 | if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED))!=0 ) continue; | 149739 | testcase( pWC->a[iTerm].wtFlags & TERM_SLICE ); |
| 149740 | if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED|TERM_SLICE))!=0 ){ | ||
| 149741 | continue; | ||
| 149742 | } | ||
| 148588 | if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue; | 149743 | if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue; |
| 148589 | testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO ); | 149744 | testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO ); |
| 148590 | pExpr = sqlite3ExprDup(db, pExpr, 0); | 149745 | pExpr = sqlite3ExprDup(db, pExpr, 0); |
| @@ -148627,9 +149782,9 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( | |||
| 148627 | /* Loop through table entries that match term pOrTerm. */ | 149782 | /* Loop through table entries that match term pOrTerm. */ |
| 148628 | ExplainQueryPlan((pParse, 1, "INDEX %d", ii+1)); | 149783 | ExplainQueryPlan((pParse, 1, "INDEX %d", ii+1)); |
| 148629 | WHERETRACE(0xffff, ("Subplan for OR-clause:\n")); | 149784 | WHERETRACE(0xffff, ("Subplan for OR-clause:\n")); |
| 148630 | pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0, | 149785 | pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0, 0, |
| 148631 | WHERE_OR_SUBCLAUSE, iCovCur); | 149786 | WHERE_OR_SUBCLAUSE, iCovCur); |
| 148632 | assert( pSubWInfo || pParse->nErr || db->mallocFailed ); | 149787 | assert( pSubWInfo || pParse->nErr ); |
| 148633 | if( pSubWInfo ){ | 149788 | if( pSubWInfo ){ |
| 148634 | WhereLoop *pSubLoop; | 149789 | WhereLoop *pSubLoop; |
| 148635 | int addrExplain = sqlite3WhereExplainOneScan( | 149790 | int addrExplain = sqlite3WhereExplainOneScan( |
| @@ -148868,7 +150023,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( | |||
| 148868 | ** then we cannot use the "t1.a=t2.b" constraint, but we can code | 150023 | ** then we cannot use the "t1.a=t2.b" constraint, but we can code |
| 148869 | ** the implied "t1.a=123" constraint. | 150024 | ** the implied "t1.a=123" constraint. |
| 148870 | */ | 150025 | */ |
| 148871 | for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){ | 150026 | for(pTerm=pWC->a, j=pWC->nBase; j>0; j--, pTerm++){ |
| 148872 | Expr *pE, sEAlt; | 150027 | Expr *pE, sEAlt; |
| 148873 | WhereTerm *pAlt; | 150028 | WhereTerm *pAlt; |
| 148874 | if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; | 150029 | if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; |
| @@ -148913,7 +150068,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( | |||
| 148913 | pLevel->addrFirst = sqlite3VdbeCurrentAddr(v); | 150068 | pLevel->addrFirst = sqlite3VdbeCurrentAddr(v); |
| 148914 | sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin); | 150069 | sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin); |
| 148915 | VdbeComment((v, "record LEFT JOIN hit")); | 150070 | VdbeComment((v, "record LEFT JOIN hit")); |
| 148916 | for(pTerm=pWC->a, j=0; j<pWC->nTerm; j++, pTerm++){ | 150071 | for(pTerm=pWC->a, j=0; j<pWC->nBase; j++, pTerm++){ |
| 148917 | testcase( pTerm->wtFlags & TERM_VIRTUAL ); | 150072 | testcase( pTerm->wtFlags & TERM_VIRTUAL ); |
| 148918 | testcase( pTerm->wtFlags & TERM_CODED ); | 150073 | testcase( pTerm->wtFlags & TERM_CODED ); |
| 148919 | if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; | 150074 | if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; |
| @@ -149024,6 +150179,7 @@ static int whereClauseInsert(WhereClause *pWC, Expr *p, u16 wtFlags){ | |||
| 149024 | pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]); | 150179 | pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]); |
| 149025 | } | 150180 | } |
| 149026 | pTerm = &pWC->a[idx = pWC->nTerm++]; | 150181 | pTerm = &pWC->a[idx = pWC->nTerm++]; |
| 150182 | if( (wtFlags & TERM_VIRTUAL)==0 ) pWC->nBase = pWC->nTerm; | ||
| 149027 | if( p && ExprHasProperty(p, EP_Unlikely) ){ | 150183 | if( p && ExprHasProperty(p, EP_Unlikely) ){ |
| 149028 | pTerm->truthProb = sqlite3LogEst(p->iTable) - 270; | 150184 | pTerm->truthProb = sqlite3LogEst(p->iTable) - 270; |
| 149029 | }else{ | 150185 | }else{ |
| @@ -149366,7 +150522,7 @@ static int isAuxiliaryVtabOperator( | |||
| 149366 | assert( pVtab!=0 ); | 150522 | assert( pVtab!=0 ); |
| 149367 | assert( pVtab->pModule!=0 ); | 150523 | assert( pVtab->pModule!=0 ); |
| 149368 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); | 150524 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 149369 | pMod = (sqlite3_module *)pVtab->pModule; | 150525 | pMod = (sqlite3_module *)pVtab->pModule; |
| 149370 | if( pMod->xFindFunction!=0 ){ | 150526 | if( pMod->xFindFunction!=0 ){ |
| 149371 | i = pMod->xFindFunction(pVtab,2, pExpr->u.zToken, &xNotUsed, &pNotUsed); | 150527 | i = pMod->xFindFunction(pVtab,2, pExpr->u.zToken, &xNotUsed, &pNotUsed); |
| 149372 | if( i>=SQLITE_INDEX_CONSTRAINT_FUNCTION ){ | 150528 | if( i>=SQLITE_INDEX_CONSTRAINT_FUNCTION ){ |
| @@ -149410,7 +150566,7 @@ static int isAuxiliaryVtabOperator( | |||
| 149410 | static void transferJoinMarkings(Expr *pDerived, Expr *pBase){ | 150566 | static void transferJoinMarkings(Expr *pDerived, Expr *pBase){ |
| 149411 | if( pDerived ){ | 150567 | if( pDerived ){ |
| 149412 | pDerived->flags |= pBase->flags & EP_FromJoin; | 150568 | pDerived->flags |= pBase->flags & EP_FromJoin; |
| 149413 | pDerived->iRightJoinTable = pBase->iRightJoinTable; | 150569 | pDerived->w.iRightJoinTable = pBase->w.iRightJoinTable; |
| 149414 | } | 150570 | } |
| 149415 | } | 150571 | } |
| 149416 | 150572 | ||
| @@ -149740,7 +150896,7 @@ static void exprAnalyzeOrTerm( | |||
| 149740 | pOrTerm = pOrWc->a; | 150896 | pOrTerm = pOrWc->a; |
| 149741 | for(i=pOrWc->nTerm-1; i>=0; i--, pOrTerm++){ | 150897 | for(i=pOrWc->nTerm-1; i>=0; i--, pOrTerm++){ |
| 149742 | assert( pOrTerm->eOperator & WO_EQ ); | 150898 | assert( pOrTerm->eOperator & WO_EQ ); |
| 149743 | pOrTerm->wtFlags &= ~TERM_OR_OK; | 150899 | pOrTerm->wtFlags &= ~TERM_OK; |
| 149744 | if( pOrTerm->leftCursor==iCursor ){ | 150900 | if( pOrTerm->leftCursor==iCursor ){ |
| 149745 | /* This is the 2-bit case and we are on the second iteration and | 150901 | /* This is the 2-bit case and we are on the second iteration and |
| 149746 | ** current term is from the first iteration. So skip this term. */ | 150902 | ** current term is from the first iteration. So skip this term. */ |
| @@ -149781,7 +150937,7 @@ static void exprAnalyzeOrTerm( | |||
| 149781 | assert( pOrTerm->eOperator & WO_EQ ); | 150937 | assert( pOrTerm->eOperator & WO_EQ ); |
| 149782 | assert( (pOrTerm->eOperator & (WO_OR|WO_AND))==0 ); | 150938 | assert( (pOrTerm->eOperator & (WO_OR|WO_AND))==0 ); |
| 149783 | if( pOrTerm->leftCursor!=iCursor ){ | 150939 | if( pOrTerm->leftCursor!=iCursor ){ |
| 149784 | pOrTerm->wtFlags &= ~TERM_OR_OK; | 150940 | pOrTerm->wtFlags &= ~TERM_OK; |
| 149785 | }else if( pOrTerm->u.x.leftColumn!=iColumn || (iColumn==XN_EXPR | 150941 | }else if( pOrTerm->u.x.leftColumn!=iColumn || (iColumn==XN_EXPR |
| 149786 | && sqlite3ExprCompare(pParse, pOrTerm->pExpr->pLeft, pLeft, -1) | 150942 | && sqlite3ExprCompare(pParse, pOrTerm->pExpr->pLeft, pLeft, -1) |
| 149787 | )){ | 150943 | )){ |
| @@ -149797,7 +150953,7 @@ static void exprAnalyzeOrTerm( | |||
| 149797 | if( affRight!=0 && affRight!=affLeft ){ | 150953 | if( affRight!=0 && affRight!=affLeft ){ |
| 149798 | okToChngToIN = 0; | 150954 | okToChngToIN = 0; |
| 149799 | }else{ | 150955 | }else{ |
| 149800 | pOrTerm->wtFlags |= TERM_OR_OK; | 150956 | pOrTerm->wtFlags |= TERM_OK; |
| 149801 | } | 150957 | } |
| 149802 | } | 150958 | } |
| 149803 | } | 150959 | } |
| @@ -149814,7 +150970,7 @@ static void exprAnalyzeOrTerm( | |||
| 149814 | Expr *pNew; /* The complete IN operator */ | 150970 | Expr *pNew; /* The complete IN operator */ |
| 149815 | 150971 | ||
| 149816 | for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0; i--, pOrTerm++){ | 150972 | for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0; i--, pOrTerm++){ |
| 149817 | if( (pOrTerm->wtFlags & TERM_OR_OK)==0 ) continue; | 150973 | if( (pOrTerm->wtFlags & TERM_OK)==0 ) continue; |
| 149818 | assert( pOrTerm->eOperator & WO_EQ ); | 150974 | assert( pOrTerm->eOperator & WO_EQ ); |
| 149819 | assert( (pOrTerm->eOperator & (WO_OR|WO_AND))==0 ); | 150975 | assert( (pOrTerm->eOperator & (WO_OR|WO_AND))==0 ); |
| 149820 | assert( pOrTerm->leftCursor==iCursor ); | 150976 | assert( pOrTerm->leftCursor==iCursor ); |
| @@ -150015,10 +151171,13 @@ static void exprAnalyze( | |||
| 150015 | if( db->mallocFailed ){ | 151171 | if( db->mallocFailed ){ |
| 150016 | return; | 151172 | return; |
| 150017 | } | 151173 | } |
| 151174 | assert( pWC->nTerm > idxTerm ); | ||
| 150018 | pTerm = &pWC->a[idxTerm]; | 151175 | pTerm = &pWC->a[idxTerm]; |
| 150019 | pMaskSet = &pWInfo->sMaskSet; | 151176 | pMaskSet = &pWInfo->sMaskSet; |
| 150020 | pExpr = pTerm->pExpr; | 151177 | pExpr = pTerm->pExpr; |
| 151178 | assert( pExpr!=0 ); /* Because malloc() has not failed */ | ||
| 150021 | assert( pExpr->op!=TK_AS && pExpr->op!=TK_COLLATE ); | 151179 | assert( pExpr->op!=TK_AS && pExpr->op!=TK_COLLATE ); |
| 151180 | pMaskSet->bVarSelect = 0; | ||
| 150022 | prereqLeft = sqlite3WhereExprUsage(pMaskSet, pExpr->pLeft); | 151181 | prereqLeft = sqlite3WhereExprUsage(pMaskSet, pExpr->pLeft); |
| 150023 | op = pExpr->op; | 151182 | op = pExpr->op; |
| 150024 | if( op==TK_IN ){ | 151183 | if( op==TK_IN ){ |
| @@ -150029,16 +151188,30 @@ static void exprAnalyze( | |||
| 150029 | }else{ | 151188 | }else{ |
| 150030 | pTerm->prereqRight = sqlite3WhereExprListUsage(pMaskSet, pExpr->x.pList); | 151189 | pTerm->prereqRight = sqlite3WhereExprListUsage(pMaskSet, pExpr->x.pList); |
| 150031 | } | 151190 | } |
| 150032 | }else if( op==TK_ISNULL ){ | 151191 | prereqAll = prereqLeft | pTerm->prereqRight; |
| 150033 | pTerm->prereqRight = 0; | ||
| 150034 | }else{ | 151192 | }else{ |
| 150035 | pTerm->prereqRight = sqlite3WhereExprUsage(pMaskSet, pExpr->pRight); | 151193 | pTerm->prereqRight = sqlite3WhereExprUsage(pMaskSet, pExpr->pRight); |
| 151194 | if( pExpr->pLeft==0 | ||
| 151195 | || ExprHasProperty(pExpr, EP_xIsSelect|EP_IfNullRow) | ||
| 151196 | || pExpr->x.pList!=0 | ||
| 151197 | ){ | ||
| 151198 | prereqAll = sqlite3WhereExprUsageNN(pMaskSet, pExpr); | ||
| 151199 | }else{ | ||
| 151200 | prereqAll = prereqLeft | pTerm->prereqRight; | ||
| 151201 | } | ||
| 150036 | } | 151202 | } |
| 150037 | pMaskSet->bVarSelect = 0; | ||
| 150038 | prereqAll = sqlite3WhereExprUsageNN(pMaskSet, pExpr); | ||
| 150039 | if( pMaskSet->bVarSelect ) pTerm->wtFlags |= TERM_VARSELECT; | 151203 | if( pMaskSet->bVarSelect ) pTerm->wtFlags |= TERM_VARSELECT; |
| 151204 | |||
| 151205 | #ifdef SQLITE_DEBUG | ||
| 151206 | if( prereqAll!=sqlite3WhereExprUsageNN(pMaskSet, pExpr) ){ | ||
| 151207 | printf("\n*** Incorrect prereqAll computed for:\n"); | ||
| 151208 | sqlite3TreeViewExpr(0,pExpr,0); | ||
| 151209 | abort(); | ||
| 151210 | } | ||
| 151211 | #endif | ||
| 151212 | |||
| 150040 | if( ExprHasProperty(pExpr, EP_FromJoin) ){ | 151213 | if( ExprHasProperty(pExpr, EP_FromJoin) ){ |
| 150041 | Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->iRightJoinTable); | 151214 | Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->w.iRightJoinTable); |
| 150042 | prereqAll |= x; | 151215 | prereqAll |= x; |
| 150043 | extraRight = x-1; /* ON clause terms may not be used with an index | 151216 | extraRight = x-1; /* ON clause terms may not be used with an index |
| 150044 | ** on left table of a LEFT JOIN. Ticket #3015 */ | 151217 | ** on left table of a LEFT JOIN. Ticket #3015 */ |
| @@ -150306,7 +151479,10 @@ static void exprAnalyze( | |||
| 150306 | ** no longer used. | 151479 | ** no longer used. |
| 150307 | ** | 151480 | ** |
| 150308 | ** This is only required if at least one side of the comparison operation | 151481 | ** This is only required if at least one side of the comparison operation |
| 150309 | ** is not a sub-select. */ | 151482 | ** is not a sub-select. |
| 151483 | ** | ||
| 151484 | ** tag-20220128a | ||
| 151485 | */ | ||
| 150310 | if( (pExpr->op==TK_EQ || pExpr->op==TK_IS) | 151486 | if( (pExpr->op==TK_EQ || pExpr->op==TK_IS) |
| 150311 | && (nLeft = sqlite3ExprVectorSize(pExpr->pLeft))>1 | 151487 | && (nLeft = sqlite3ExprVectorSize(pExpr->pLeft))>1 |
| 150312 | && sqlite3ExprVectorSize(pExpr->pRight)==nLeft | 151488 | && sqlite3ExprVectorSize(pExpr->pRight)==nLeft |
| @@ -150323,7 +151499,7 @@ static void exprAnalyze( | |||
| 150323 | 151499 | ||
| 150324 | pNew = sqlite3PExpr(pParse, pExpr->op, pLeft, pRight); | 151500 | pNew = sqlite3PExpr(pParse, pExpr->op, pLeft, pRight); |
| 150325 | transferJoinMarkings(pNew, pExpr); | 151501 | transferJoinMarkings(pNew, pExpr); |
| 150326 | idxNew = whereClauseInsert(pWC, pNew, TERM_DYNAMIC); | 151502 | idxNew = whereClauseInsert(pWC, pNew, TERM_DYNAMIC|TERM_SLICE); |
| 150327 | exprAnalyze(pSrc, pWC, idxNew); | 151503 | exprAnalyze(pSrc, pWC, idxNew); |
| 150328 | } | 151504 | } |
| 150329 | pTerm = &pWC->a[idxTerm]; | 151505 | pTerm = &pWC->a[idxTerm]; |
| @@ -150353,7 +151529,7 @@ static void exprAnalyze( | |||
| 150353 | int i; | 151529 | int i; |
| 150354 | for(i=0; i<sqlite3ExprVectorSize(pExpr->pLeft); i++){ | 151530 | for(i=0; i<sqlite3ExprVectorSize(pExpr->pLeft); i++){ |
| 150355 | int idxNew; | 151531 | int idxNew; |
| 150356 | idxNew = whereClauseInsert(pWC, pExpr, TERM_VIRTUAL); | 151532 | idxNew = whereClauseInsert(pWC, pExpr, TERM_VIRTUAL|TERM_SLICE); |
| 150357 | pWC->a[idxNew].u.x.iField = i+1; | 151533 | pWC->a[idxNew].u.x.iField = i+1; |
| 150358 | exprAnalyze(pSrc, pWC, idxNew); | 151534 | exprAnalyze(pSrc, pWC, idxNew); |
| 150359 | markTermAsChild(pWC, idxNew, idxTerm); | 151535 | markTermAsChild(pWC, idxNew, idxTerm); |
| @@ -150386,7 +151562,7 @@ static void exprAnalyze( | |||
| 150386 | 0, sqlite3ExprDup(db, pRight, 0)); | 151562 | 0, sqlite3ExprDup(db, pRight, 0)); |
| 150387 | if( ExprHasProperty(pExpr, EP_FromJoin) && pNewExpr ){ | 151563 | if( ExprHasProperty(pExpr, EP_FromJoin) && pNewExpr ){ |
| 150388 | ExprSetProperty(pNewExpr, EP_FromJoin); | 151564 | ExprSetProperty(pNewExpr, EP_FromJoin); |
| 150389 | pNewExpr->iRightJoinTable = pExpr->iRightJoinTable; | 151565 | pNewExpr->w.iRightJoinTable = pExpr->w.iRightJoinTable; |
| 150390 | } | 151566 | } |
| 150391 | idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC); | 151567 | idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC); |
| 150392 | testcase( idxNew==0 ); | 151568 | testcase( idxNew==0 ); |
| @@ -150450,6 +151626,113 @@ SQLITE_PRIVATE void sqlite3WhereSplit(WhereClause *pWC, Expr *pExpr, u8 op){ | |||
| 150450 | } | 151626 | } |
| 150451 | 151627 | ||
| 150452 | /* | 151628 | /* |
| 151629 | ** Add either a LIMIT (if eMatchOp==SQLITE_INDEX_CONSTRAINT_LIMIT) or | ||
| 151630 | ** OFFSET (if eMatchOp==SQLITE_INDEX_CONSTRAINT_OFFSET) term to the | ||
| 151631 | ** where-clause passed as the first argument. The value for the term | ||
| 151632 | ** is found in register iReg. | ||
| 151633 | ** | ||
| 151634 | ** In the common case where the value is a simple integer | ||
| 151635 | ** (example: "LIMIT 5 OFFSET 10") then the expression codes as a | ||
| 151636 | ** TK_INTEGER so that it will be available to sqlite3_vtab_rhs_value(). | ||
| 151637 | ** If not, then it codes as a TK_REGISTER expression. | ||
| 151638 | */ | ||
| 151639 | static void whereAddLimitExpr( | ||
| 151640 | WhereClause *pWC, /* Add the constraint to this WHERE clause */ | ||
| 151641 | int iReg, /* Register that will hold value of the limit/offset */ | ||
| 151642 | Expr *pExpr, /* Expression that defines the limit/offset */ | ||
| 151643 | int iCsr, /* Cursor to which the constraint applies */ | ||
| 151644 | int eMatchOp /* SQLITE_INDEX_CONSTRAINT_LIMIT or _OFFSET */ | ||
| 151645 | ){ | ||
| 151646 | Parse *pParse = pWC->pWInfo->pParse; | ||
| 151647 | sqlite3 *db = pParse->db; | ||
| 151648 | Expr *pNew; | ||
| 151649 | int iVal = 0; | ||
| 151650 | |||
| 151651 | if( sqlite3ExprIsInteger(pExpr, &iVal) && iVal>=0 ){ | ||
| 151652 | Expr *pVal = sqlite3Expr(db, TK_INTEGER, 0); | ||
| 151653 | if( pVal==0 ) return; | ||
| 151654 | ExprSetProperty(pVal, EP_IntValue); | ||
| 151655 | pVal->u.iValue = iVal; | ||
| 151656 | pNew = sqlite3PExpr(pParse, TK_MATCH, 0, pVal); | ||
| 151657 | }else{ | ||
| 151658 | Expr *pVal = sqlite3Expr(db, TK_REGISTER, 0); | ||
| 151659 | if( pVal==0 ) return; | ||
| 151660 | pVal->iTable = iReg; | ||
| 151661 | pNew = sqlite3PExpr(pParse, TK_MATCH, 0, pVal); | ||
| 151662 | } | ||
| 151663 | if( pNew ){ | ||
| 151664 | WhereTerm *pTerm; | ||
| 151665 | int idx; | ||
| 151666 | idx = whereClauseInsert(pWC, pNew, TERM_DYNAMIC|TERM_VIRTUAL); | ||
| 151667 | pTerm = &pWC->a[idx]; | ||
| 151668 | pTerm->leftCursor = iCsr; | ||
| 151669 | pTerm->eOperator = WO_AUX; | ||
| 151670 | pTerm->eMatchOp = eMatchOp; | ||
| 151671 | } | ||
| 151672 | } | ||
| 151673 | |||
| 151674 | /* | ||
| 151675 | ** Possibly add terms corresponding to the LIMIT and OFFSET clauses of the | ||
| 151676 | ** SELECT statement passed as the second argument. These terms are only | ||
| 151677 | ** added if: | ||
| 151678 | ** | ||
| 151679 | ** 1. The SELECT statement has a LIMIT clause, and | ||
| 151680 | ** 2. The SELECT statement is not an aggregate or DISTINCT query, and | ||
| 151681 | ** 3. The SELECT statement has exactly one object in its from clause, and | ||
| 151682 | ** that object is a virtual table, and | ||
| 151683 | ** 4. There are no terms in the WHERE clause that will not be passed | ||
| 151684 | ** to the virtual table xBestIndex method. | ||
| 151685 | ** 5. The ORDER BY clause, if any, will be made available to the xBestIndex | ||
| 151686 | ** method. | ||
| 151687 | ** | ||
| 151688 | ** LIMIT and OFFSET terms are ignored by most of the planner code. They | ||
| 151689 | ** exist only so that they may be passed to the xBestIndex method of the | ||
| 151690 | ** single virtual table in the FROM clause of the SELECT. | ||
| 151691 | */ | ||
| 151692 | SQLITE_PRIVATE void sqlite3WhereAddLimit(WhereClause *pWC, Select *p){ | ||
| 151693 | assert( p==0 || (p->pGroupBy==0 && (p->selFlags & SF_Aggregate)==0) ); | ||
| 151694 | if( (p && p->pLimit) /* 1 */ | ||
| 151695 | && (p->selFlags & (SF_Distinct|SF_Aggregate))==0 /* 2 */ | ||
| 151696 | && (p->pSrc->nSrc==1 && IsVirtual(p->pSrc->a[0].pTab)) /* 3 */ | ||
| 151697 | ){ | ||
| 151698 | ExprList *pOrderBy = p->pOrderBy; | ||
| 151699 | int iCsr = p->pSrc->a[0].iCursor; | ||
| 151700 | int ii; | ||
| 151701 | |||
| 151702 | /* Check condition (4). Return early if it is not met. */ | ||
| 151703 | for(ii=0; ii<pWC->nTerm; ii++){ | ||
| 151704 | if( pWC->a[ii].wtFlags & TERM_CODED ){ | ||
| 151705 | /* This term is a vector operation that has been decomposed into | ||
| 151706 | ** other, subsequent terms. It can be ignored. See tag-20220128a */ | ||
| 151707 | assert( pWC->a[ii].wtFlags & TERM_VIRTUAL ); | ||
| 151708 | assert( pWC->a[ii].eOperator==0 ); | ||
| 151709 | continue; | ||
| 151710 | } | ||
| 151711 | if( pWC->a[ii].leftCursor!=iCsr ) return; | ||
| 151712 | } | ||
| 151713 | |||
| 151714 | /* Check condition (5). Return early if it is not met. */ | ||
| 151715 | if( pOrderBy ){ | ||
| 151716 | for(ii=0; ii<pOrderBy->nExpr; ii++){ | ||
| 151717 | Expr *pExpr = pOrderBy->a[ii].pExpr; | ||
| 151718 | if( pExpr->op!=TK_COLUMN ) return; | ||
| 151719 | if( pExpr->iTable!=iCsr ) return; | ||
| 151720 | if( pOrderBy->a[ii].sortFlags & KEYINFO_ORDER_BIGNULL ) return; | ||
| 151721 | } | ||
| 151722 | } | ||
| 151723 | |||
| 151724 | /* All conditions are met. Add the terms to the where-clause object. */ | ||
| 151725 | assert( p->pLimit->op==TK_LIMIT ); | ||
| 151726 | whereAddLimitExpr(pWC, p->iLimit, p->pLimit->pLeft, | ||
| 151727 | iCsr, SQLITE_INDEX_CONSTRAINT_LIMIT); | ||
| 151728 | if( p->iOffset>0 ){ | ||
| 151729 | whereAddLimitExpr(pWC, p->iOffset, p->pLimit->pRight, | ||
| 151730 | iCsr, SQLITE_INDEX_CONSTRAINT_OFFSET); | ||
| 151731 | } | ||
| 151732 | } | ||
| 151733 | } | ||
| 151734 | |||
| 151735 | /* | ||
| 150453 | ** Initialize a preallocated WhereClause structure. | 151736 | ** Initialize a preallocated WhereClause structure. |
| 150454 | */ | 151737 | */ |
| 150455 | SQLITE_PRIVATE void sqlite3WhereClauseInit( | 151738 | SQLITE_PRIVATE void sqlite3WhereClauseInit( |
| @@ -150460,6 +151743,7 @@ SQLITE_PRIVATE void sqlite3WhereClauseInit( | |||
| 150460 | pWC->hasOr = 0; | 151743 | pWC->hasOr = 0; |
| 150461 | pWC->pOuter = 0; | 151744 | pWC->pOuter = 0; |
| 150462 | pWC->nTerm = 0; | 151745 | pWC->nTerm = 0; |
| 151746 | pWC->nBase = 0; | ||
| 150463 | pWC->nSlot = ArraySize(pWC->aStatic); | 151747 | pWC->nSlot = ArraySize(pWC->aStatic); |
| 150464 | pWC->a = pWC->aStatic; | 151748 | pWC->a = pWC->aStatic; |
| 150465 | } | 151749 | } |
| @@ -150470,17 +151754,34 @@ SQLITE_PRIVATE void sqlite3WhereClauseInit( | |||
| 150470 | ** sqlite3WhereClauseInit(). | 151754 | ** sqlite3WhereClauseInit(). |
| 150471 | */ | 151755 | */ |
| 150472 | SQLITE_PRIVATE void sqlite3WhereClauseClear(WhereClause *pWC){ | 151756 | SQLITE_PRIVATE void sqlite3WhereClauseClear(WhereClause *pWC){ |
| 150473 | int i; | ||
| 150474 | WhereTerm *a; | ||
| 150475 | sqlite3 *db = pWC->pWInfo->pParse->db; | 151757 | sqlite3 *db = pWC->pWInfo->pParse->db; |
| 150476 | for(i=pWC->nTerm-1, a=pWC->a; i>=0; i--, a++){ | 151758 | assert( pWC->nTerm>=pWC->nBase ); |
| 150477 | if( a->wtFlags & TERM_DYNAMIC ){ | 151759 | if( pWC->nTerm>0 ){ |
| 150478 | sqlite3ExprDelete(db, a->pExpr); | 151760 | WhereTerm *a = pWC->a; |
| 151761 | WhereTerm *aLast = &pWC->a[pWC->nTerm-1]; | ||
| 151762 | #ifdef SQLITE_DEBUG | ||
| 151763 | int i; | ||
| 151764 | /* Verify that every term past pWC->nBase is virtual */ | ||
| 151765 | for(i=pWC->nBase; i<pWC->nTerm; i++){ | ||
| 151766 | assert( (pWC->a[i].wtFlags & TERM_VIRTUAL)!=0 ); | ||
| 150479 | } | 151767 | } |
| 150480 | if( a->wtFlags & TERM_ORINFO ){ | 151768 | #endif |
| 150481 | whereOrInfoDelete(db, a->u.pOrInfo); | 151769 | while(1){ |
| 150482 | }else if( a->wtFlags & TERM_ANDINFO ){ | 151770 | assert( a->eMatchOp==0 || a->eOperator==WO_AUX ); |
| 150483 | whereAndInfoDelete(db, a->u.pAndInfo); | 151771 | if( a->wtFlags & TERM_DYNAMIC ){ |
| 151772 | sqlite3ExprDelete(db, a->pExpr); | ||
| 151773 | } | ||
| 151774 | if( a->wtFlags & (TERM_ORINFO|TERM_ANDINFO) ){ | ||
| 151775 | if( a->wtFlags & TERM_ORINFO ){ | ||
| 151776 | assert( (a->wtFlags & TERM_ANDINFO)==0 ); | ||
| 151777 | whereOrInfoDelete(db, a->u.pOrInfo); | ||
| 151778 | }else{ | ||
| 151779 | assert( (a->wtFlags & TERM_ANDINFO)!=0 ); | ||
| 151780 | whereAndInfoDelete(db, a->u.pAndInfo); | ||
| 151781 | } | ||
| 151782 | } | ||
| 151783 | if( a==aLast ) break; | ||
| 151784 | a++; | ||
| 150484 | } | 151785 | } |
| 150485 | } | 151786 | } |
| 150486 | if( pWC->a!=pWC->aStatic ){ | 151787 | if( pWC->a!=pWC->aStatic ){ |
| @@ -150493,15 +151794,38 @@ SQLITE_PRIVATE void sqlite3WhereClauseClear(WhereClause *pWC){ | |||
| 150493 | ** These routines walk (recursively) an expression tree and generate | 151794 | ** These routines walk (recursively) an expression tree and generate |
| 150494 | ** a bitmask indicating which tables are used in that expression | 151795 | ** a bitmask indicating which tables are used in that expression |
| 150495 | ** tree. | 151796 | ** tree. |
| 151797 | ** | ||
| 151798 | ** sqlite3WhereExprUsage(MaskSet, Expr) -> | ||
| 151799 | ** | ||
| 151800 | ** Return a Bitmask of all tables referenced by Expr. Expr can be | ||
| 151801 | ** be NULL, in which case 0 is returned. | ||
| 151802 | ** | ||
| 151803 | ** sqlite3WhereExprUsageNN(MaskSet, Expr) -> | ||
| 151804 | ** | ||
| 151805 | ** Same as sqlite3WhereExprUsage() except that Expr must not be | ||
| 151806 | ** NULL. The "NN" suffix on the name stands for "Not Null". | ||
| 151807 | ** | ||
| 151808 | ** sqlite3WhereExprListUsage(MaskSet, ExprList) -> | ||
| 151809 | ** | ||
| 151810 | ** Return a Bitmask of all tables referenced by every expression | ||
| 151811 | ** in the expression list ExprList. ExprList can be NULL, in which | ||
| 151812 | ** case 0 is returned. | ||
| 151813 | ** | ||
| 151814 | ** sqlite3WhereExprUsageFull(MaskSet, ExprList) -> | ||
| 151815 | ** | ||
| 151816 | ** Internal use only. Called only by sqlite3WhereExprUsageNN() for | ||
| 151817 | ** complex expressions that require pushing register values onto | ||
| 151818 | ** the stack. Many calls to sqlite3WhereExprUsageNN() do not need | ||
| 151819 | ** the more complex analysis done by this routine. Hence, the | ||
| 151820 | ** computations done by this routine are broken out into a separate | ||
| 151821 | ** "no-inline" function to avoid the stack push overhead in the | ||
| 151822 | ** common case where it is not needed. | ||
| 150496 | */ | 151823 | */ |
| 150497 | SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){ | 151824 | static SQLITE_NOINLINE Bitmask sqlite3WhereExprUsageFull( |
| 151825 | WhereMaskSet *pMaskSet, | ||
| 151826 | Expr *p | ||
| 151827 | ){ | ||
| 150498 | Bitmask mask; | 151828 | Bitmask mask; |
| 150499 | if( p->op==TK_COLUMN && !ExprHasProperty(p, EP_FixedCol) ){ | ||
| 150500 | return sqlite3WhereGetMask(pMaskSet, p->iTable); | ||
| 150501 | }else if( ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){ | ||
| 150502 | assert( p->op!=TK_IF_NULL_ROW ); | ||
| 150503 | return 0; | ||
| 150504 | } | ||
| 150505 | mask = (p->op==TK_IF_NULL_ROW) ? sqlite3WhereGetMask(pMaskSet, p->iTable) : 0; | 151829 | mask = (p->op==TK_IF_NULL_ROW) ? sqlite3WhereGetMask(pMaskSet, p->iTable) : 0; |
| 150506 | if( p->pLeft ) mask |= sqlite3WhereExprUsageNN(pMaskSet, p->pLeft); | 151830 | if( p->pLeft ) mask |= sqlite3WhereExprUsageNN(pMaskSet, p->pLeft); |
| 150507 | if( p->pRight ){ | 151831 | if( p->pRight ){ |
| @@ -150523,6 +151847,15 @@ SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){ | |||
| 150523 | #endif | 151847 | #endif |
| 150524 | return mask; | 151848 | return mask; |
| 150525 | } | 151849 | } |
| 151850 | SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){ | ||
| 151851 | if( p->op==TK_COLUMN && !ExprHasProperty(p, EP_FixedCol) ){ | ||
| 151852 | return sqlite3WhereGetMask(pMaskSet, p->iTable); | ||
| 151853 | }else if( ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){ | ||
| 151854 | assert( p->op!=TK_IF_NULL_ROW ); | ||
| 151855 | return 0; | ||
| 151856 | } | ||
| 151857 | return sqlite3WhereExprUsageFull(pMaskSet, p); | ||
| 151858 | } | ||
| 150526 | SQLITE_PRIVATE Bitmask sqlite3WhereExprUsage(WhereMaskSet *pMaskSet, Expr *p){ | 151859 | SQLITE_PRIVATE Bitmask sqlite3WhereExprUsage(WhereMaskSet *pMaskSet, Expr *p){ |
| 150527 | return p ? sqlite3WhereExprUsageNN(pMaskSet,p) : 0; | 151860 | return p ? sqlite3WhereExprUsageNN(pMaskSet,p) : 0; |
| 150528 | } | 151861 | } |
| @@ -150592,6 +151925,7 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs( | |||
| 150592 | pColRef->iColumn = k++; | 151925 | pColRef->iColumn = k++; |
| 150593 | assert( ExprUseYTab(pColRef) ); | 151926 | assert( ExprUseYTab(pColRef) ); |
| 150594 | pColRef->y.pTab = pTab; | 151927 | pColRef->y.pTab = pTab; |
| 151928 | pItem->colUsed |= sqlite3ExprColUsed(pColRef); | ||
| 150595 | pRhs = sqlite3PExpr(pParse, TK_UPLUS, | 151929 | pRhs = sqlite3PExpr(pParse, TK_UPLUS, |
| 150596 | sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0); | 151930 | sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0); |
| 150597 | pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs); | 151931 | pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs); |
| @@ -150636,8 +151970,14 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs( | |||
| 150636 | */ | 151970 | */ |
| 150637 | typedef struct HiddenIndexInfo HiddenIndexInfo; | 151971 | typedef struct HiddenIndexInfo HiddenIndexInfo; |
| 150638 | struct HiddenIndexInfo { | 151972 | struct HiddenIndexInfo { |
| 150639 | WhereClause *pWC; /* The Where clause being analyzed */ | 151973 | WhereClause *pWC; /* The Where clause being analyzed */ |
| 150640 | Parse *pParse; /* The parsing context */ | 151974 | Parse *pParse; /* The parsing context */ |
| 151975 | int eDistinct; /* Value to return from sqlite3_vtab_distinct() */ | ||
| 151976 | u32 mIn; /* Mask of terms that are <col> IN (...) */ | ||
| 151977 | u32 mHandleIn; /* Terms that vtab will handle as <col> IN (...) */ | ||
| 151978 | sqlite3_value *aRhs[1]; /* RHS values for constraints. MUST BE LAST | ||
| 151979 | ** because extra space is allocated to hold up | ||
| 151980 | ** to nTerm such values */ | ||
| 150641 | }; | 151981 | }; |
| 150642 | 151982 | ||
| 150643 | /* Forward declaration of methods */ | 151983 | /* Forward declaration of methods */ |
| @@ -150840,7 +152180,12 @@ whereOrInsert_done: | |||
| 150840 | SQLITE_PRIVATE Bitmask sqlite3WhereGetMask(WhereMaskSet *pMaskSet, int iCursor){ | 152180 | SQLITE_PRIVATE Bitmask sqlite3WhereGetMask(WhereMaskSet *pMaskSet, int iCursor){ |
| 150841 | int i; | 152181 | int i; |
| 150842 | assert( pMaskSet->n<=(int)sizeof(Bitmask)*8 ); | 152182 | assert( pMaskSet->n<=(int)sizeof(Bitmask)*8 ); |
| 150843 | for(i=0; i<pMaskSet->n; i++){ | 152183 | assert( pMaskSet->n>0 || pMaskSet->ix[0]<0 ); |
| 152184 | assert( iCursor>=-1 ); | ||
| 152185 | if( pMaskSet->ix[0]==iCursor ){ | ||
| 152186 | return 1; | ||
| 152187 | } | ||
| 152188 | for(i=1; i<pMaskSet->n; i++){ | ||
| 150844 | if( pMaskSet->ix[i]==iCursor ){ | 152189 | if( pMaskSet->ix[i]==iCursor ){ |
| 150845 | return MASKBIT(i); | 152190 | return MASKBIT(i); |
| 150846 | } | 152191 | } |
| @@ -151025,16 +152370,16 @@ static WhereTerm *whereScanInit( | |||
| 151025 | if( pIdx ){ | 152370 | if( pIdx ){ |
| 151026 | int j = iColumn; | 152371 | int j = iColumn; |
| 151027 | iColumn = pIdx->aiColumn[j]; | 152372 | iColumn = pIdx->aiColumn[j]; |
| 151028 | if( iColumn==XN_EXPR ){ | 152373 | if( iColumn==pIdx->pTable->iPKey ){ |
| 151029 | pScan->pIdxExpr = pIdx->aColExpr->a[j].pExpr; | ||
| 151030 | pScan->zCollName = pIdx->azColl[j]; | ||
| 151031 | pScan->aiColumn[0] = XN_EXPR; | ||
| 151032 | return whereScanInitIndexExpr(pScan); | ||
| 151033 | }else if( iColumn==pIdx->pTable->iPKey ){ | ||
| 151034 | iColumn = XN_ROWID; | 152374 | iColumn = XN_ROWID; |
| 151035 | }else if( iColumn>=0 ){ | 152375 | }else if( iColumn>=0 ){ |
| 151036 | pScan->idxaff = pIdx->pTable->aCol[iColumn].affinity; | 152376 | pScan->idxaff = pIdx->pTable->aCol[iColumn].affinity; |
| 151037 | pScan->zCollName = pIdx->azColl[j]; | 152377 | pScan->zCollName = pIdx->azColl[j]; |
| 152378 | }else if( iColumn==XN_EXPR ){ | ||
| 152379 | pScan->pIdxExpr = pIdx->aColExpr->a[j].pExpr; | ||
| 152380 | pScan->zCollName = pIdx->azColl[j]; | ||
| 152381 | pScan->aiColumn[0] = XN_EXPR; | ||
| 152382 | return whereScanInitIndexExpr(pScan); | ||
| 151038 | } | 152383 | } |
| 151039 | }else if( iColumn==XN_EXPR ){ | 152384 | }else if( iColumn==XN_EXPR ){ |
| 151040 | return 0; | 152385 | return 0; |
| @@ -151277,12 +152622,14 @@ static void whereTraceIndexInfoInputs(sqlite3_index_info *p){ | |||
| 151277 | int i; | 152622 | int i; |
| 151278 | if( !sqlite3WhereTrace ) return; | 152623 | if( !sqlite3WhereTrace ) return; |
| 151279 | for(i=0; i<p->nConstraint; i++){ | 152624 | for(i=0; i<p->nConstraint; i++){ |
| 151280 | sqlite3DebugPrintf(" constraint[%d]: col=%d termid=%d op=%d usabled=%d\n", | 152625 | sqlite3DebugPrintf( |
| 152626 | " constraint[%d]: col=%d termid=%d op=%d usabled=%d collseq=%s\n", | ||
| 151281 | i, | 152627 | i, |
| 151282 | p->aConstraint[i].iColumn, | 152628 | p->aConstraint[i].iColumn, |
| 151283 | p->aConstraint[i].iTermOffset, | 152629 | p->aConstraint[i].iTermOffset, |
| 151284 | p->aConstraint[i].op, | 152630 | p->aConstraint[i].op, |
| 151285 | p->aConstraint[i].usable); | 152631 | p->aConstraint[i].usable, |
| 152632 | sqlite3_vtab_collation(p,i)); | ||
| 151286 | } | 152633 | } |
| 151287 | for(i=0; i<p->nOrderBy; i++){ | 152634 | for(i=0; i<p->nOrderBy; i++){ |
| 151288 | sqlite3DebugPrintf(" orderby[%d]: col=%d desc=%d\n", | 152635 | sqlite3DebugPrintf(" orderby[%d]: col=%d desc=%d\n", |
| @@ -151318,9 +152665,9 @@ static void whereTraceIndexInfoOutputs(sqlite3_index_info *p){ | |||
| 151318 | ** index existed. | 152665 | ** index existed. |
| 151319 | */ | 152666 | */ |
| 151320 | static int termCanDriveIndex( | 152667 | static int termCanDriveIndex( |
| 151321 | WhereTerm *pTerm, /* WHERE clause term to check */ | 152668 | const WhereTerm *pTerm, /* WHERE clause term to check */ |
| 151322 | SrcItem *pSrc, /* Table we are trying to access */ | 152669 | const SrcItem *pSrc, /* Table we are trying to access */ |
| 151323 | Bitmask notReady /* Tables in outer loops of the join */ | 152670 | const Bitmask notReady /* Tables in outer loops of the join */ |
| 151324 | ){ | 152671 | ){ |
| 151325 | char aff; | 152672 | char aff; |
| 151326 | if( pTerm->leftCursor!=pSrc->iCursor ) return 0; | 152673 | if( pTerm->leftCursor!=pSrc->iCursor ) return 0; |
| @@ -151351,11 +152698,11 @@ static int termCanDriveIndex( | |||
| 151351 | ** and to set up the WhereLevel object pLevel so that the code generator | 152698 | ** and to set up the WhereLevel object pLevel so that the code generator |
| 151352 | ** makes use of the automatic index. | 152699 | ** makes use of the automatic index. |
| 151353 | */ | 152700 | */ |
| 151354 | static void constructAutomaticIndex( | 152701 | static SQLITE_NOINLINE void constructAutomaticIndex( |
| 151355 | Parse *pParse, /* The parsing context */ | 152702 | Parse *pParse, /* The parsing context */ |
| 151356 | WhereClause *pWC, /* The WHERE clause */ | 152703 | const WhereClause *pWC, /* The WHERE clause */ |
| 151357 | SrcItem *pSrc, /* The FROM clause term to get the next index */ | 152704 | const SrcItem *pSrc, /* The FROM clause term to get the next index */ |
| 151358 | Bitmask notReady, /* Mask of cursors that are not available */ | 152705 | const Bitmask notReady, /* Mask of cursors that are not available */ |
| 151359 | WhereLevel *pLevel /* Write new index here */ | 152706 | WhereLevel *pLevel /* Write new index here */ |
| 151360 | ){ | 152707 | ){ |
| 151361 | int nKeyCol; /* Number of columns in the constructed index */ | 152708 | int nKeyCol; /* Number of columns in the constructed index */ |
| @@ -151397,13 +152744,13 @@ static void constructAutomaticIndex( | |||
| 151397 | idxCols = 0; | 152744 | idxCols = 0; |
| 151398 | for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){ | 152745 | for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){ |
| 151399 | Expr *pExpr = pTerm->pExpr; | 152746 | Expr *pExpr = pTerm->pExpr; |
| 151400 | assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */ | 152747 | /* Make the automatic index a partial index if there are terms in the |
| 151401 | || pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */ | 152748 | ** WHERE clause (or the ON clause of a LEFT join) that constrain which |
| 151402 | || pLoop->prereq!=0 ); /* table of a LEFT JOIN */ | 152749 | ** rows of the target table (pSrc) that can be used. */ |
| 151403 | if( pLoop->prereq==0 | 152750 | if( (pTerm->wtFlags & TERM_VIRTUAL)==0 |
| 151404 | && (pTerm->wtFlags & TERM_VIRTUAL)==0 | 152751 | && ((pSrc->fg.jointype&JT_LEFT)==0 || ExprHasProperty(pExpr,EP_FromJoin)) |
| 151405 | && !ExprHasProperty(pExpr, EP_FromJoin) | 152752 | && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) |
| 151406 | && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){ | 152753 | ){ |
| 151407 | pPartial = sqlite3ExprAnd(pParse, pPartial, | 152754 | pPartial = sqlite3ExprAnd(pParse, pPartial, |
| 151408 | sqlite3ExprDup(pParse->db, pExpr, 0)); | 152755 | sqlite3ExprDup(pParse->db, pExpr, 0)); |
| 151409 | } | 152756 | } |
| @@ -151510,6 +152857,10 @@ static void constructAutomaticIndex( | |||
| 151510 | sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1); | 152857 | sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1); |
| 151511 | sqlite3VdbeSetP4KeyInfo(pParse, pIdx); | 152858 | sqlite3VdbeSetP4KeyInfo(pParse, pIdx); |
| 151512 | VdbeComment((v, "for %s", pTable->zName)); | 152859 | VdbeComment((v, "for %s", pTable->zName)); |
| 152860 | if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) ){ | ||
| 152861 | pLevel->regFilter = ++pParse->nMem; | ||
| 152862 | sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter); | ||
| 152863 | } | ||
| 151513 | 152864 | ||
| 151514 | /* Fill the automatic index with content */ | 152865 | /* Fill the automatic index with content */ |
| 151515 | pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom]; | 152866 | pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom]; |
| @@ -151532,6 +152883,10 @@ static void constructAutomaticIndex( | |||
| 151532 | regBase = sqlite3GenerateIndexKey( | 152883 | regBase = sqlite3GenerateIndexKey( |
| 151533 | pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0 | 152884 | pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0 |
| 151534 | ); | 152885 | ); |
| 152886 | if( pLevel->regFilter ){ | ||
| 152887 | sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, | ||
| 152888 | regBase, pLoop->u.btree.nEq); | ||
| 152889 | } | ||
| 151535 | sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord); | 152890 | sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord); |
| 151536 | sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); | 152891 | sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); |
| 151537 | if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue); | 152892 | if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue); |
| @@ -151558,22 +152913,146 @@ end_auto_index_create: | |||
| 151558 | } | 152913 | } |
| 151559 | #endif /* SQLITE_OMIT_AUTOMATIC_INDEX */ | 152914 | #endif /* SQLITE_OMIT_AUTOMATIC_INDEX */ |
| 151560 | 152915 | ||
| 152916 | /* | ||
| 152917 | ** Generate bytecode that will initialize a Bloom filter that is appropriate | ||
| 152918 | ** for pLevel. | ||
| 152919 | ** | ||
| 152920 | ** If there are inner loops within pLevel that have the WHERE_BLOOMFILTER | ||
| 152921 | ** flag set, initialize a Bloomfilter for them as well. Except don't do | ||
| 152922 | ** this recursive initialization if the SQLITE_BloomPulldown optimization has | ||
| 152923 | ** been turned off. | ||
| 152924 | ** | ||
| 152925 | ** When the Bloom filter is initialized, the WHERE_BLOOMFILTER flag is cleared | ||
| 152926 | ** from the loop, but the regFilter value is set to a register that implements | ||
| 152927 | ** the Bloom filter. When regFilter is positive, the | ||
| 152928 | ** sqlite3WhereCodeOneLoopStart() will generate code to test the Bloom filter | ||
| 152929 | ** and skip the subsequence B-Tree seek if the Bloom filter indicates that | ||
| 152930 | ** no matching rows exist. | ||
| 152931 | ** | ||
| 152932 | ** This routine may only be called if it has previously been determined that | ||
| 152933 | ** the loop would benefit from a Bloom filter, and the WHERE_BLOOMFILTER bit | ||
| 152934 | ** is set. | ||
| 152935 | */ | ||
| 152936 | static SQLITE_NOINLINE void sqlite3ConstructBloomFilter( | ||
| 152937 | WhereInfo *pWInfo, /* The WHERE clause */ | ||
| 152938 | int iLevel, /* Index in pWInfo->a[] that is pLevel */ | ||
| 152939 | WhereLevel *pLevel, /* Make a Bloom filter for this FROM term */ | ||
| 152940 | Bitmask notReady /* Loops that are not ready */ | ||
| 152941 | ){ | ||
| 152942 | int addrOnce; /* Address of opening OP_Once */ | ||
| 152943 | int addrTop; /* Address of OP_Rewind */ | ||
| 152944 | int addrCont; /* Jump here to skip a row */ | ||
| 152945 | const WhereTerm *pTerm; /* For looping over WHERE clause terms */ | ||
| 152946 | const WhereTerm *pWCEnd; /* Last WHERE clause term */ | ||
| 152947 | Parse *pParse = pWInfo->pParse; /* Parsing context */ | ||
| 152948 | Vdbe *v = pParse->pVdbe; /* VDBE under construction */ | ||
| 152949 | WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */ | ||
| 152950 | int iCur; /* Cursor for table getting the filter */ | ||
| 152951 | |||
| 152952 | assert( pLoop!=0 ); | ||
| 152953 | assert( v!=0 ); | ||
| 152954 | assert( pLoop->wsFlags & WHERE_BLOOMFILTER ); | ||
| 152955 | |||
| 152956 | addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); | ||
| 152957 | do{ | ||
| 152958 | const SrcItem *pItem; | ||
| 152959 | const Table *pTab; | ||
| 152960 | u64 sz; | ||
| 152961 | sqlite3WhereExplainBloomFilter(pParse, pWInfo, pLevel); | ||
| 152962 | addrCont = sqlite3VdbeMakeLabel(pParse); | ||
| 152963 | iCur = pLevel->iTabCur; | ||
| 152964 | pLevel->regFilter = ++pParse->nMem; | ||
| 152965 | |||
| 152966 | /* The Bloom filter is a Blob held in a register. Initialize it | ||
| 152967 | ** to zero-filled blob of at least 80K bits, but maybe more if the | ||
| 152968 | ** estimated size of the table is larger. We could actually | ||
| 152969 | ** measure the size of the table at run-time using OP_Count with | ||
| 152970 | ** P3==1 and use that value to initialize the blob. But that makes | ||
| 152971 | ** testing complicated. By basing the blob size on the value in the | ||
| 152972 | ** sqlite_stat1 table, testing is much easier. | ||
| 152973 | */ | ||
| 152974 | pItem = &pWInfo->pTabList->a[pLevel->iFrom]; | ||
| 152975 | assert( pItem!=0 ); | ||
| 152976 | pTab = pItem->pTab; | ||
| 152977 | assert( pTab!=0 ); | ||
| 152978 | sz = sqlite3LogEstToInt(pTab->nRowLogEst); | ||
| 152979 | if( sz<10000 ){ | ||
| 152980 | sz = 10000; | ||
| 152981 | }else if( sz>10000000 ){ | ||
| 152982 | sz = 10000000; | ||
| 152983 | } | ||
| 152984 | sqlite3VdbeAddOp2(v, OP_Blob, (int)sz, pLevel->regFilter); | ||
| 152985 | |||
| 152986 | addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, iCur); VdbeCoverage(v); | ||
| 152987 | pWCEnd = &pWInfo->sWC.a[pWInfo->sWC.nTerm]; | ||
| 152988 | for(pTerm=pWInfo->sWC.a; pTerm<pWCEnd; pTerm++){ | ||
| 152989 | Expr *pExpr = pTerm->pExpr; | ||
| 152990 | if( (pTerm->wtFlags & TERM_VIRTUAL)==0 | ||
| 152991 | && sqlite3ExprIsTableConstant(pExpr, iCur) | ||
| 152992 | ){ | ||
| 152993 | sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL); | ||
| 152994 | } | ||
| 152995 | } | ||
| 152996 | if( pLoop->wsFlags & WHERE_IPK ){ | ||
| 152997 | int r1 = sqlite3GetTempReg(pParse); | ||
| 152998 | sqlite3VdbeAddOp2(v, OP_Rowid, iCur, r1); | ||
| 152999 | sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, 1); | ||
| 153000 | sqlite3ReleaseTempReg(pParse, r1); | ||
| 153001 | }else{ | ||
| 153002 | Index *pIdx = pLoop->u.btree.pIndex; | ||
| 153003 | int n = pLoop->u.btree.nEq; | ||
| 153004 | int r1 = sqlite3GetTempRange(pParse, n); | ||
| 153005 | int jj; | ||
| 153006 | for(jj=0; jj<n; jj++){ | ||
| 153007 | int iCol = pIdx->aiColumn[jj]; | ||
| 153008 | assert( pIdx->pTable==pItem->pTab ); | ||
| 153009 | sqlite3ExprCodeGetColumnOfTable(v, pIdx->pTable, iCur, iCol,r1+jj); | ||
| 153010 | } | ||
| 153011 | sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, n); | ||
| 153012 | sqlite3ReleaseTempRange(pParse, r1, n); | ||
| 153013 | } | ||
| 153014 | sqlite3VdbeResolveLabel(v, addrCont); | ||
| 153015 | sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); | ||
| 153016 | VdbeCoverage(v); | ||
| 153017 | sqlite3VdbeJumpHere(v, addrTop); | ||
| 153018 | pLoop->wsFlags &= ~WHERE_BLOOMFILTER; | ||
| 153019 | if( OptimizationDisabled(pParse->db, SQLITE_BloomPulldown) ) break; | ||
| 153020 | while( ++iLevel < pWInfo->nLevel ){ | ||
| 153021 | pLevel = &pWInfo->a[iLevel]; | ||
| 153022 | pLoop = pLevel->pWLoop; | ||
| 153023 | if( NEVER(pLoop==0) ) continue; | ||
| 153024 | if( pLoop->prereq & notReady ) continue; | ||
| 153025 | if( (pLoop->wsFlags & (WHERE_BLOOMFILTER|WHERE_COLUMN_IN)) | ||
| 153026 | ==WHERE_BLOOMFILTER | ||
| 153027 | ){ | ||
| 153028 | /* This is a candidate for bloom-filter pull-down (early evaluation). | ||
| 153029 | ** The test that WHERE_COLUMN_IN is omitted is important, as we are | ||
| 153030 | ** not able to do early evaluation of bloom filters that make use of | ||
| 153031 | ** the IN operator */ | ||
| 153032 | break; | ||
| 153033 | } | ||
| 153034 | } | ||
| 153035 | }while( iLevel < pWInfo->nLevel ); | ||
| 153036 | sqlite3VdbeJumpHere(v, addrOnce); | ||
| 153037 | } | ||
| 153038 | |||
| 153039 | |||
| 151561 | #ifndef SQLITE_OMIT_VIRTUALTABLE | 153040 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 151562 | /* | 153041 | /* |
| 151563 | ** Allocate and populate an sqlite3_index_info structure. It is the | 153042 | ** Allocate and populate an sqlite3_index_info structure. It is the |
| 151564 | ** responsibility of the caller to eventually release the structure | 153043 | ** responsibility of the caller to eventually release the structure |
| 151565 | ** by passing the pointer returned by this function to sqlite3_free(). | 153044 | ** by passing the pointer returned by this function to freeIndexInfo(). |
| 151566 | */ | 153045 | */ |
| 151567 | static sqlite3_index_info *allocateIndexInfo( | 153046 | static sqlite3_index_info *allocateIndexInfo( |
| 151568 | Parse *pParse, /* The parsing context */ | 153047 | WhereInfo *pWInfo, /* The WHERE clause */ |
| 151569 | WhereClause *pWC, /* The WHERE clause being analyzed */ | 153048 | WhereClause *pWC, /* The WHERE clause being analyzed */ |
| 151570 | Bitmask mUnusable, /* Ignore terms with these prereqs */ | 153049 | Bitmask mUnusable, /* Ignore terms with these prereqs */ |
| 151571 | SrcItem *pSrc, /* The FROM clause term that is the vtab */ | 153050 | SrcItem *pSrc, /* The FROM clause term that is the vtab */ |
| 151572 | ExprList *pOrderBy, /* The ORDER BY clause */ | ||
| 151573 | u16 *pmNoOmit /* Mask of terms not to omit */ | 153051 | u16 *pmNoOmit /* Mask of terms not to omit */ |
| 151574 | ){ | 153052 | ){ |
| 151575 | int i, j; | 153053 | int i, j; |
| 151576 | int nTerm; | 153054 | int nTerm; |
| 153055 | Parse *pParse = pWInfo->pParse; | ||
| 151577 | struct sqlite3_index_constraint *pIdxCons; | 153056 | struct sqlite3_index_constraint *pIdxCons; |
| 151578 | struct sqlite3_index_orderby *pIdxOrderBy; | 153057 | struct sqlite3_index_orderby *pIdxOrderBy; |
| 151579 | struct sqlite3_index_constraint_usage *pUsage; | 153058 | struct sqlite3_index_constraint_usage *pUsage; |
| @@ -151582,10 +153061,21 @@ static sqlite3_index_info *allocateIndexInfo( | |||
| 151582 | int nOrderBy; | 153061 | int nOrderBy; |
| 151583 | sqlite3_index_info *pIdxInfo; | 153062 | sqlite3_index_info *pIdxInfo; |
| 151584 | u16 mNoOmit = 0; | 153063 | u16 mNoOmit = 0; |
| 153064 | const Table *pTab; | ||
| 153065 | int eDistinct = 0; | ||
| 153066 | ExprList *pOrderBy = pWInfo->pOrderBy; | ||
| 151585 | 153067 | ||
| 151586 | /* Count the number of possible WHERE clause constraints referring | 153068 | assert( pSrc!=0 ); |
| 151587 | ** to this virtual table */ | 153069 | pTab = pSrc->pTab; |
| 153070 | assert( pTab!=0 ); | ||
| 153071 | assert( IsVirtual(pTab) ); | ||
| 153072 | |||
| 153073 | /* Find all WHERE clause constraints referring to this virtual table. | ||
| 153074 | ** Mark each term with the TERM_OK flag. Set nTerm to the number of | ||
| 153075 | ** terms found. | ||
| 153076 | */ | ||
| 151588 | for(i=nTerm=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ | 153077 | for(i=nTerm=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ |
| 153078 | pTerm->wtFlags &= ~TERM_OK; | ||
| 151589 | if( pTerm->leftCursor != pSrc->iCursor ) continue; | 153079 | if( pTerm->leftCursor != pSrc->iCursor ) continue; |
| 151590 | if( pTerm->prereqRight & mUnusable ) continue; | 153080 | if( pTerm->prereqRight & mUnusable ) continue; |
| 151591 | assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) ); | 153081 | assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) ); |
| @@ -151595,9 +153085,21 @@ static sqlite3_index_info *allocateIndexInfo( | |||
| 151595 | testcase( pTerm->eOperator & WO_ALL ); | 153085 | testcase( pTerm->eOperator & WO_ALL ); |
| 151596 | if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue; | 153086 | if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue; |
| 151597 | if( pTerm->wtFlags & TERM_VNULL ) continue; | 153087 | if( pTerm->wtFlags & TERM_VNULL ) continue; |
| 153088 | |||
| 151598 | assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 ); | 153089 | assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 ); |
| 151599 | assert( pTerm->u.x.leftColumn>=(-1) ); | 153090 | assert( pTerm->u.x.leftColumn>=XN_ROWID ); |
| 153091 | assert( pTerm->u.x.leftColumn<pTab->nCol ); | ||
| 153092 | |||
| 153093 | /* tag-20191211-002: WHERE-clause constraints are not useful to the | ||
| 153094 | ** right-hand table of a LEFT JOIN. See tag-20191211-001 for the | ||
| 153095 | ** equivalent restriction for ordinary tables. */ | ||
| 153096 | if( (pSrc->fg.jointype & JT_LEFT)!=0 | ||
| 153097 | && !ExprHasProperty(pTerm->pExpr, EP_FromJoin) | ||
| 153098 | ){ | ||
| 153099 | continue; | ||
| 153100 | } | ||
| 151600 | nTerm++; | 153101 | nTerm++; |
| 153102 | pTerm->wtFlags |= TERM_OK; | ||
| 151601 | } | 153103 | } |
| 151602 | 153104 | ||
| 151603 | /* If the ORDER BY clause contains only columns in the current | 153105 | /* If the ORDER BY clause contains only columns in the current |
| @@ -151609,11 +153111,47 @@ static sqlite3_index_info *allocateIndexInfo( | |||
| 151609 | int n = pOrderBy->nExpr; | 153111 | int n = pOrderBy->nExpr; |
| 151610 | for(i=0; i<n; i++){ | 153112 | for(i=0; i<n; i++){ |
| 151611 | Expr *pExpr = pOrderBy->a[i].pExpr; | 153113 | Expr *pExpr = pOrderBy->a[i].pExpr; |
| 151612 | if( pExpr->op!=TK_COLUMN || pExpr->iTable!=pSrc->iCursor ) break; | 153114 | Expr *pE2; |
| 153115 | |||
| 153116 | /* Skip over constant terms in the ORDER BY clause */ | ||
| 153117 | if( sqlite3ExprIsConstant(pExpr) ){ | ||
| 153118 | continue; | ||
| 153119 | } | ||
| 153120 | |||
| 153121 | /* Virtual tables are unable to deal with NULLS FIRST */ | ||
| 151613 | if( pOrderBy->a[i].sortFlags & KEYINFO_ORDER_BIGNULL ) break; | 153122 | if( pOrderBy->a[i].sortFlags & KEYINFO_ORDER_BIGNULL ) break; |
| 153123 | |||
| 153124 | /* First case - a direct column references without a COLLATE operator */ | ||
| 153125 | if( pExpr->op==TK_COLUMN && pExpr->iTable==pSrc->iCursor ){ | ||
| 153126 | assert( pExpr->iColumn>=XN_ROWID && pExpr->iColumn<pTab->nCol ); | ||
| 153127 | continue; | ||
| 153128 | } | ||
| 153129 | |||
| 153130 | /* 2nd case - a column reference with a COLLATE operator. Only match | ||
| 153131 | ** of the COLLATE operator matches the collation of the column. */ | ||
| 153132 | if( pExpr->op==TK_COLLATE | ||
| 153133 | && (pE2 = pExpr->pLeft)->op==TK_COLUMN | ||
| 153134 | && pE2->iTable==pSrc->iCursor | ||
| 153135 | ){ | ||
| 153136 | const char *zColl; /* The collating sequence name */ | ||
| 153137 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); | ||
| 153138 | assert( pExpr->u.zToken!=0 ); | ||
| 153139 | assert( pE2->iColumn>=XN_ROWID && pE2->iColumn<pTab->nCol ); | ||
| 153140 | pExpr->iColumn = pE2->iColumn; | ||
| 153141 | if( pE2->iColumn<0 ) continue; /* Collseq does not matter for rowid */ | ||
| 153142 | zColl = sqlite3ColumnColl(&pTab->aCol[pE2->iColumn]); | ||
| 153143 | if( zColl==0 ) zColl = sqlite3StrBINARY; | ||
| 153144 | if( sqlite3_stricmp(pExpr->u.zToken, zColl)==0 ) continue; | ||
| 153145 | } | ||
| 153146 | |||
| 153147 | /* No matches cause a break out of the loop */ | ||
| 153148 | break; | ||
| 151614 | } | 153149 | } |
| 151615 | if( i==n){ | 153150 | if( i==n ){ |
| 151616 | nOrderBy = n; | 153151 | nOrderBy = n; |
| 153152 | if( (pWInfo->wctrlFlags & (WHERE_GROUPBY|WHERE_DISTINCTBY)) ){ | ||
| 153153 | eDistinct = 1 + ((pWInfo->wctrlFlags & WHERE_DISTINCTBY)!=0); | ||
| 153154 | } | ||
| 151617 | } | 153155 | } |
| 151618 | } | 153156 | } |
| 151619 | 153157 | ||
| @@ -151621,47 +153159,35 @@ static sqlite3_index_info *allocateIndexInfo( | |||
| 151621 | */ | 153159 | */ |
| 151622 | pIdxInfo = sqlite3DbMallocZero(pParse->db, sizeof(*pIdxInfo) | 153160 | pIdxInfo = sqlite3DbMallocZero(pParse->db, sizeof(*pIdxInfo) |
| 151623 | + (sizeof(*pIdxCons) + sizeof(*pUsage))*nTerm | 153161 | + (sizeof(*pIdxCons) + sizeof(*pUsage))*nTerm |
| 151624 | + sizeof(*pIdxOrderBy)*nOrderBy + sizeof(*pHidden) ); | 153162 | + sizeof(*pIdxOrderBy)*nOrderBy + sizeof(*pHidden) |
| 153163 | + sizeof(sqlite3_value*)*nTerm ); | ||
| 151625 | if( pIdxInfo==0 ){ | 153164 | if( pIdxInfo==0 ){ |
| 151626 | sqlite3ErrorMsg(pParse, "out of memory"); | 153165 | sqlite3ErrorMsg(pParse, "out of memory"); |
| 151627 | return 0; | 153166 | return 0; |
| 151628 | } | 153167 | } |
| 151629 | pHidden = (struct HiddenIndexInfo*)&pIdxInfo[1]; | 153168 | pHidden = (struct HiddenIndexInfo*)&pIdxInfo[1]; |
| 151630 | pIdxCons = (struct sqlite3_index_constraint*)&pHidden[1]; | 153169 | pIdxCons = (struct sqlite3_index_constraint*)&pHidden->aRhs[nTerm]; |
| 151631 | pIdxOrderBy = (struct sqlite3_index_orderby*)&pIdxCons[nTerm]; | 153170 | pIdxOrderBy = (struct sqlite3_index_orderby*)&pIdxCons[nTerm]; |
| 151632 | pUsage = (struct sqlite3_index_constraint_usage*)&pIdxOrderBy[nOrderBy]; | 153171 | pUsage = (struct sqlite3_index_constraint_usage*)&pIdxOrderBy[nOrderBy]; |
| 151633 | pIdxInfo->nOrderBy = nOrderBy; | ||
| 151634 | pIdxInfo->aConstraint = pIdxCons; | 153172 | pIdxInfo->aConstraint = pIdxCons; |
| 151635 | pIdxInfo->aOrderBy = pIdxOrderBy; | 153173 | pIdxInfo->aOrderBy = pIdxOrderBy; |
| 151636 | pIdxInfo->aConstraintUsage = pUsage; | 153174 | pIdxInfo->aConstraintUsage = pUsage; |
| 151637 | pHidden->pWC = pWC; | 153175 | pHidden->pWC = pWC; |
| 151638 | pHidden->pParse = pParse; | 153176 | pHidden->pParse = pParse; |
| 153177 | pHidden->eDistinct = eDistinct; | ||
| 153178 | pHidden->mIn = 0; | ||
| 151639 | for(i=j=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ | 153179 | for(i=j=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ |
| 151640 | u16 op; | 153180 | u16 op; |
| 151641 | if( pTerm->leftCursor != pSrc->iCursor ) continue; | 153181 | if( (pTerm->wtFlags & TERM_OK)==0 ) continue; |
| 151642 | if( pTerm->prereqRight & mUnusable ) continue; | ||
| 151643 | assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) ); | ||
| 151644 | testcase( pTerm->eOperator & WO_IN ); | ||
| 151645 | testcase( pTerm->eOperator & WO_IS ); | ||
| 151646 | testcase( pTerm->eOperator & WO_ISNULL ); | ||
| 151647 | testcase( pTerm->eOperator & WO_ALL ); | ||
| 151648 | if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue; | ||
| 151649 | if( pTerm->wtFlags & TERM_VNULL ) continue; | ||
| 151650 | |||
| 151651 | /* tag-20191211-002: WHERE-clause constraints are not useful to the | ||
| 151652 | ** right-hand table of a LEFT JOIN. See tag-20191211-001 for the | ||
| 151653 | ** equivalent restriction for ordinary tables. */ | ||
| 151654 | if( (pSrc->fg.jointype & JT_LEFT)!=0 | ||
| 151655 | && !ExprHasProperty(pTerm->pExpr, EP_FromJoin) | ||
| 151656 | ){ | ||
| 151657 | continue; | ||
| 151658 | } | ||
| 151659 | assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 ); | ||
| 151660 | assert( pTerm->u.x.leftColumn>=(-1) ); | ||
| 151661 | pIdxCons[j].iColumn = pTerm->u.x.leftColumn; | 153182 | pIdxCons[j].iColumn = pTerm->u.x.leftColumn; |
| 151662 | pIdxCons[j].iTermOffset = i; | 153183 | pIdxCons[j].iTermOffset = i; |
| 151663 | op = pTerm->eOperator & WO_ALL; | 153184 | op = pTerm->eOperator & WO_ALL; |
| 151664 | if( op==WO_IN ) op = WO_EQ; | 153185 | if( op==WO_IN ){ |
| 153186 | if( (pTerm->wtFlags & TERM_SLICE)==0 ){ | ||
| 153187 | pHidden->mIn |= SMASKBIT32(j); | ||
| 153188 | } | ||
| 153189 | op = WO_EQ; | ||
| 153190 | } | ||
| 151665 | if( op==WO_AUX ){ | 153191 | if( op==WO_AUX ){ |
| 151666 | pIdxCons[j].op = pTerm->eMatchOp; | 153192 | pIdxCons[j].op = pTerm->eMatchOp; |
| 151667 | }else if( op & (WO_ISNULL|WO_IS) ){ | 153193 | }else if( op & (WO_ISNULL|WO_IS) ){ |
| @@ -151694,18 +153220,43 @@ static sqlite3_index_info *allocateIndexInfo( | |||
| 151694 | 153220 | ||
| 151695 | j++; | 153221 | j++; |
| 151696 | } | 153222 | } |
| 153223 | assert( j==nTerm ); | ||
| 151697 | pIdxInfo->nConstraint = j; | 153224 | pIdxInfo->nConstraint = j; |
| 151698 | for(i=0; i<nOrderBy; i++){ | 153225 | for(i=j=0; i<nOrderBy; i++){ |
| 151699 | Expr *pExpr = pOrderBy->a[i].pExpr; | 153226 | Expr *pExpr = pOrderBy->a[i].pExpr; |
| 151700 | pIdxOrderBy[i].iColumn = pExpr->iColumn; | 153227 | if( sqlite3ExprIsConstant(pExpr) ) continue; |
| 151701 | pIdxOrderBy[i].desc = pOrderBy->a[i].sortFlags & KEYINFO_ORDER_DESC; | 153228 | assert( pExpr->op==TK_COLUMN |
| 153229 | || (pExpr->op==TK_COLLATE && pExpr->pLeft->op==TK_COLUMN | ||
| 153230 | && pExpr->iColumn==pExpr->pLeft->iColumn) ); | ||
| 153231 | pIdxOrderBy[j].iColumn = pExpr->iColumn; | ||
| 153232 | pIdxOrderBy[j].desc = pOrderBy->a[i].sortFlags & KEYINFO_ORDER_DESC; | ||
| 153233 | j++; | ||
| 151702 | } | 153234 | } |
| 153235 | pIdxInfo->nOrderBy = j; | ||
| 151703 | 153236 | ||
| 151704 | *pmNoOmit = mNoOmit; | 153237 | *pmNoOmit = mNoOmit; |
| 151705 | return pIdxInfo; | 153238 | return pIdxInfo; |
| 151706 | } | 153239 | } |
| 151707 | 153240 | ||
| 151708 | /* | 153241 | /* |
| 153242 | ** Free an sqlite3_index_info structure allocated by allocateIndexInfo() | ||
| 153243 | ** and possibly modified by xBestIndex methods. | ||
| 153244 | */ | ||
| 153245 | static void freeIndexInfo(sqlite3 *db, sqlite3_index_info *pIdxInfo){ | ||
| 153246 | HiddenIndexInfo *pHidden; | ||
| 153247 | int i; | ||
| 153248 | assert( pIdxInfo!=0 ); | ||
| 153249 | pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; | ||
| 153250 | assert( pHidden->pParse!=0 ); | ||
| 153251 | assert( pHidden->pParse->db==db ); | ||
| 153252 | for(i=0; i<pIdxInfo->nConstraint; i++){ | ||
| 153253 | sqlite3ValueFree(pHidden->aRhs[i]); /* IMP: R-14553-25174 */ | ||
| 153254 | pHidden->aRhs[i] = 0; | ||
| 153255 | } | ||
| 153256 | sqlite3DbFree(db, pIdxInfo); | ||
| 153257 | } | ||
| 153258 | |||
| 153259 | /* | ||
| 151709 | ** The table object reference passed as the second argument to this function | 153260 | ** The table object reference passed as the second argument to this function |
| 151710 | ** must represent a virtual table. This function invokes the xBestIndex() | 153261 | ** must represent a virtual table. This function invokes the xBestIndex() |
| 151711 | ** method of the virtual table with the sqlite3_index_info object that | 153262 | ** method of the virtual table with the sqlite3_index_info object that |
| @@ -151726,7 +153277,9 @@ static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){ | |||
| 151726 | int rc; | 153277 | int rc; |
| 151727 | 153278 | ||
| 151728 | whereTraceIndexInfoInputs(p); | 153279 | whereTraceIndexInfoInputs(p); |
| 153280 | pParse->db->nSchemaLock++; | ||
| 151729 | rc = pVtab->pModule->xBestIndex(pVtab, p); | 153281 | rc = pVtab->pModule->xBestIndex(pVtab, p); |
| 153282 | pParse->db->nSchemaLock--; | ||
| 151730 | whereTraceIndexInfoOutputs(p); | 153283 | whereTraceIndexInfoOutputs(p); |
| 151731 | 153284 | ||
| 151732 | if( rc!=SQLITE_OK && rc!=SQLITE_CONSTRAINT ){ | 153285 | if( rc!=SQLITE_OK && rc!=SQLITE_CONSTRAINT ){ |
| @@ -152500,9 +154053,9 @@ SQLITE_PRIVATE void sqlite3WhereLoopPrint(WhereLoop *p, WhereClause *pWC){ | |||
| 152500 | sqlite3_free(z); | 154053 | sqlite3_free(z); |
| 152501 | } | 154054 | } |
| 152502 | if( p->wsFlags & WHERE_SKIPSCAN ){ | 154055 | if( p->wsFlags & WHERE_SKIPSCAN ){ |
| 152503 | sqlite3DebugPrintf(" f %05x %d-%d", p->wsFlags, p->nLTerm,p->nSkip); | 154056 | sqlite3DebugPrintf(" f %06x %d-%d", p->wsFlags, p->nLTerm,p->nSkip); |
| 152504 | }else{ | 154057 | }else{ |
| 152505 | sqlite3DebugPrintf(" f %05x N %d", p->wsFlags, p->nLTerm); | 154058 | sqlite3DebugPrintf(" f %06x N %d", p->wsFlags, p->nLTerm); |
| 152506 | } | 154059 | } |
| 152507 | sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut); | 154060 | sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut); |
| 152508 | if( p->nLTerm && (sqlite3WhereTrace & 0x100)!=0 ){ | 154061 | if( p->nLTerm && (sqlite3WhereTrace & 0x100)!=0 ){ |
| @@ -152962,11 +154515,11 @@ static void whereLoopOutputAdjust( | |||
| 152962 | LogEst iReduce = 0; /* pLoop->nOut should not exceed nRow-iReduce */ | 154515 | LogEst iReduce = 0; /* pLoop->nOut should not exceed nRow-iReduce */ |
| 152963 | 154516 | ||
| 152964 | assert( (pLoop->wsFlags & WHERE_AUTO_INDEX)==0 ); | 154517 | assert( (pLoop->wsFlags & WHERE_AUTO_INDEX)==0 ); |
| 152965 | for(i=pWC->nTerm, pTerm=pWC->a; i>0; i--, pTerm++){ | 154518 | for(i=pWC->nBase, pTerm=pWC->a; i>0; i--, pTerm++){ |
| 152966 | assert( pTerm!=0 ); | 154519 | assert( pTerm!=0 ); |
| 152967 | if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) break; | ||
| 152968 | if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue; | ||
| 152969 | if( (pTerm->prereqAll & notAllowed)!=0 ) continue; | 154520 | if( (pTerm->prereqAll & notAllowed)!=0 ) continue; |
| 154521 | if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue; | ||
| 154522 | if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) continue; | ||
| 152970 | for(j=pLoop->nLTerm-1; j>=0; j--){ | 154523 | for(j=pLoop->nLTerm-1; j>=0; j--){ |
| 152971 | pX = pLoop->aLTerm[j]; | 154524 | pX = pLoop->aLTerm[j]; |
| 152972 | if( pX==0 ) continue; | 154525 | if( pX==0 ) continue; |
| @@ -152974,6 +154527,13 @@ static void whereLoopOutputAdjust( | |||
| 152974 | if( pX->iParent>=0 && (&pWC->a[pX->iParent])==pTerm ) break; | 154527 | if( pX->iParent>=0 && (&pWC->a[pX->iParent])==pTerm ) break; |
| 152975 | } | 154528 | } |
| 152976 | if( j<0 ){ | 154529 | if( j<0 ){ |
| 154530 | if( pLoop->maskSelf==pTerm->prereqAll ){ | ||
| 154531 | /* If there are extra terms in the WHERE clause not used by an index | ||
| 154532 | ** that depend only on the table being scanned, and that will tend to | ||
| 154533 | ** cause many rows to be omitted, then mark that table as | ||
| 154534 | ** "self-culling". */ | ||
| 154535 | pLoop->wsFlags |= WHERE_SELFCULL; | ||
| 154536 | } | ||
| 152977 | if( pTerm->truthProb<=0 ){ | 154537 | if( pTerm->truthProb<=0 ){ |
| 152978 | /* If a truth probability is specified using the likelihood() hints, | 154538 | /* If a truth probability is specified using the likelihood() hints, |
| 152979 | ** then use the probability provided by the application. */ | 154539 | ** then use the probability provided by the application. */ |
| @@ -153001,7 +154561,9 @@ static void whereLoopOutputAdjust( | |||
| 153001 | } | 154561 | } |
| 153002 | } | 154562 | } |
| 153003 | } | 154563 | } |
| 153004 | if( pLoop->nOut > nRow-iReduce ) pLoop->nOut = nRow - iReduce; | 154564 | if( pLoop->nOut > nRow-iReduce ){ |
| 154565 | pLoop->nOut = nRow - iReduce; | ||
| 154566 | } | ||
| 153005 | } | 154567 | } |
| 153006 | 154568 | ||
| 153007 | /* | 154569 | /* |
| @@ -153546,7 +155108,7 @@ static int whereUsablePartialIndex( | |||
| 153546 | for(i=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ | 155108 | for(i=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ |
| 153547 | Expr *pExpr; | 155109 | Expr *pExpr; |
| 153548 | pExpr = pTerm->pExpr; | 155110 | pExpr = pTerm->pExpr; |
| 153549 | if( (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->iRightJoinTable==iTab) | 155111 | if( (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->w.iRightJoinTable==iTab) |
| 153550 | && (isLeft==0 || ExprHasProperty(pExpr, EP_FromJoin)) | 155112 | && (isLeft==0 || ExprHasProperty(pExpr, EP_FromJoin)) |
| 153551 | && sqlite3ExprImpliesExpr(pParse, pExpr, pWhere, iTab) | 155113 | && sqlite3ExprImpliesExpr(pParse, pExpr, pWhere, iTab) |
| 153552 | && (pTerm->wtFlags & TERM_VNULL)==0 | 155114 | && (pTerm->wtFlags & TERM_VNULL)==0 |
| @@ -153849,6 +155411,15 @@ static int whereLoopAddBtree( | |||
| 153849 | #ifndef SQLITE_OMIT_VIRTUALTABLE | 155411 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 153850 | 155412 | ||
| 153851 | /* | 155413 | /* |
| 155414 | ** Return true if pTerm is a virtual table LIMIT or OFFSET term. | ||
| 155415 | */ | ||
| 155416 | static int isLimitTerm(WhereTerm *pTerm){ | ||
| 155417 | assert( pTerm->eOperator==WO_AUX || pTerm->eMatchOp==0 ); | ||
| 155418 | return pTerm->eMatchOp>=SQLITE_INDEX_CONSTRAINT_LIMIT | ||
| 155419 | && pTerm->eMatchOp<=SQLITE_INDEX_CONSTRAINT_OFFSET; | ||
| 155420 | } | ||
| 155421 | |||
| 155422 | /* | ||
| 153852 | ** Argument pIdxInfo is already populated with all constraints that may | 155423 | ** Argument pIdxInfo is already populated with all constraints that may |
| 153853 | ** be used by the virtual table identified by pBuilder->pNew->iTab. This | 155424 | ** be used by the virtual table identified by pBuilder->pNew->iTab. This |
| 153854 | ** function marks a subset of those constraints usable, invokes the | 155425 | ** function marks a subset of those constraints usable, invokes the |
| @@ -153875,9 +155446,11 @@ static int whereLoopAddVirtualOne( | |||
| 153875 | u16 mExclude, /* Exclude terms using these operators */ | 155446 | u16 mExclude, /* Exclude terms using these operators */ |
| 153876 | sqlite3_index_info *pIdxInfo, /* Populated object for xBestIndex */ | 155447 | sqlite3_index_info *pIdxInfo, /* Populated object for xBestIndex */ |
| 153877 | u16 mNoOmit, /* Do not omit these constraints */ | 155448 | u16 mNoOmit, /* Do not omit these constraints */ |
| 153878 | int *pbIn /* OUT: True if plan uses an IN(...) op */ | 155449 | int *pbIn, /* OUT: True if plan uses an IN(...) op */ |
| 155450 | int *pbRetryLimit /* OUT: Retry without LIMIT/OFFSET */ | ||
| 153879 | ){ | 155451 | ){ |
| 153880 | WhereClause *pWC = pBuilder->pWC; | 155452 | WhereClause *pWC = pBuilder->pWC; |
| 155453 | HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; | ||
| 153881 | struct sqlite3_index_constraint *pIdxCons; | 155454 | struct sqlite3_index_constraint *pIdxCons; |
| 153882 | struct sqlite3_index_constraint_usage *pUsage = pIdxInfo->aConstraintUsage; | 155455 | struct sqlite3_index_constraint_usage *pUsage = pIdxInfo->aConstraintUsage; |
| 153883 | int i; | 155456 | int i; |
| @@ -153900,6 +155473,7 @@ static int whereLoopAddVirtualOne( | |||
| 153900 | pIdxCons->usable = 0; | 155473 | pIdxCons->usable = 0; |
| 153901 | if( (pTerm->prereqRight & mUsable)==pTerm->prereqRight | 155474 | if( (pTerm->prereqRight & mUsable)==pTerm->prereqRight |
| 153902 | && (pTerm->eOperator & mExclude)==0 | 155475 | && (pTerm->eOperator & mExclude)==0 |
| 155476 | && (pbRetryLimit || !isLimitTerm(pTerm)) | ||
| 153903 | ){ | 155477 | ){ |
| 153904 | pIdxCons->usable = 1; | 155478 | pIdxCons->usable = 1; |
| 153905 | } | 155479 | } |
| @@ -153915,6 +155489,7 @@ static int whereLoopAddVirtualOne( | |||
| 153915 | pIdxInfo->estimatedRows = 25; | 155489 | pIdxInfo->estimatedRows = 25; |
| 153916 | pIdxInfo->idxFlags = 0; | 155490 | pIdxInfo->idxFlags = 0; |
| 153917 | pIdxInfo->colUsed = (sqlite3_int64)pSrc->colUsed; | 155491 | pIdxInfo->colUsed = (sqlite3_int64)pSrc->colUsed; |
| 155492 | pHidden->mHandleIn = 0; | ||
| 153918 | 155493 | ||
| 153919 | /* Invoke the virtual table xBestIndex() method */ | 155494 | /* Invoke the virtual table xBestIndex() method */ |
| 153920 | rc = vtabBestIndex(pParse, pSrc->pTab, pIdxInfo); | 155495 | rc = vtabBestIndex(pParse, pSrc->pTab, pIdxInfo); |
| @@ -153932,8 +155507,8 @@ static int whereLoopAddVirtualOne( | |||
| 153932 | 155507 | ||
| 153933 | mxTerm = -1; | 155508 | mxTerm = -1; |
| 153934 | assert( pNew->nLSlot>=nConstraint ); | 155509 | assert( pNew->nLSlot>=nConstraint ); |
| 153935 | for(i=0; i<nConstraint; i++) pNew->aLTerm[i] = 0; | 155510 | memset(pNew->aLTerm, 0, sizeof(pNew->aLTerm[0])*nConstraint ); |
| 153936 | pNew->u.vtab.omitMask = 0; | 155511 | memset(&pNew->u.vtab, 0, sizeof(pNew->u.vtab)); |
| 153937 | pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint; | 155512 | pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint; |
| 153938 | for(i=0; i<nConstraint; i++, pIdxCons++){ | 155513 | for(i=0; i<nConstraint; i++, pIdxCons++){ |
| 153939 | int iTerm; | 155514 | int iTerm; |
| @@ -153967,8 +155542,13 @@ static int whereLoopAddVirtualOne( | |||
| 153967 | }else{ | 155542 | }else{ |
| 153968 | testcase( i!=iTerm ); | 155543 | testcase( i!=iTerm ); |
| 153969 | } | 155544 | } |
| 155545 | if( pTerm->eMatchOp==SQLITE_INDEX_CONSTRAINT_OFFSET ){ | ||
| 155546 | pNew->u.vtab.bOmitOffset = 1; | ||
| 155547 | } | ||
| 153970 | } | 155548 | } |
| 153971 | if( (pTerm->eOperator & WO_IN)!=0 ){ | 155549 | if( SMASKBIT32(i) & pHidden->mHandleIn ){ |
| 155550 | pNew->u.vtab.mHandleIn |= MASKBIT32(iTerm); | ||
| 155551 | }else if( (pTerm->eOperator & WO_IN)!=0 ){ | ||
| 153972 | /* A virtual table that is constrained by an IN clause may not | 155552 | /* A virtual table that is constrained by an IN clause may not |
| 153973 | ** consume the ORDER BY clause because (1) the order of IN terms | 155553 | ** consume the ORDER BY clause because (1) the order of IN terms |
| 153974 | ** is not necessarily related to the order of output terms and | 155554 | ** is not necessarily related to the order of output terms and |
| @@ -153978,6 +155558,21 @@ static int whereLoopAddVirtualOne( | |||
| 153978 | pIdxInfo->idxFlags &= ~SQLITE_INDEX_SCAN_UNIQUE; | 155558 | pIdxInfo->idxFlags &= ~SQLITE_INDEX_SCAN_UNIQUE; |
| 153979 | *pbIn = 1; assert( (mExclude & WO_IN)==0 ); | 155559 | *pbIn = 1; assert( (mExclude & WO_IN)==0 ); |
| 153980 | } | 155560 | } |
| 155561 | |||
| 155562 | if( isLimitTerm(pTerm) && *pbIn ){ | ||
| 155563 | /* If there is an IN(...) term handled as an == (separate call to | ||
| 155564 | ** xFilter for each value on the RHS of the IN) and a LIMIT or | ||
| 155565 | ** OFFSET term handled as well, the plan is unusable. Set output | ||
| 155566 | ** variable *pbRetryLimit to true to tell the caller to retry with | ||
| 155567 | ** LIMIT and OFFSET disabled. */ | ||
| 155568 | if( pIdxInfo->needToFreeIdxStr ){ | ||
| 155569 | sqlite3_free(pIdxInfo->idxStr); | ||
| 155570 | pIdxInfo->idxStr = 0; | ||
| 155571 | pIdxInfo->needToFreeIdxStr = 0; | ||
| 155572 | } | ||
| 155573 | *pbRetryLimit = 1; | ||
| 155574 | return SQLITE_OK; | ||
| 155575 | } | ||
| 153981 | } | 155576 | } |
| 153982 | } | 155577 | } |
| 153983 | 155578 | ||
| @@ -154022,11 +155617,19 @@ static int whereLoopAddVirtualOne( | |||
| 154022 | } | 155617 | } |
| 154023 | 155618 | ||
| 154024 | /* | 155619 | /* |
| 154025 | ** If this function is invoked from within an xBestIndex() callback, it | 155620 | ** Return the collating sequence for a constraint passed into xBestIndex. |
| 154026 | ** returns a pointer to a buffer containing the name of the collation | 155621 | ** |
| 154027 | ** sequence associated with element iCons of the sqlite3_index_info.aConstraint | 155622 | ** pIdxInfo must be an sqlite3_index_info structure passed into xBestIndex. |
| 154028 | ** array. Or, if iCons is out of range or there is no active xBestIndex | 155623 | ** This routine depends on there being a HiddenIndexInfo structure immediately |
| 154029 | ** call, return NULL. | 155624 | ** following the sqlite3_index_info structure. |
| 155625 | ** | ||
| 155626 | ** Return a pointer to the collation name: | ||
| 155627 | ** | ||
| 155628 | ** 1. If there is an explicit COLLATE operator on the constaint, return it. | ||
| 155629 | ** | ||
| 155630 | ** 2. Else, if the column has an alternative collation, return that. | ||
| 155631 | ** | ||
| 155632 | ** 3. Otherwise, return "BINARY". | ||
| 154030 | */ | 155633 | */ |
| 154031 | SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info *pIdxInfo, int iCons){ | 155634 | SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info *pIdxInfo, int iCons){ |
| 154032 | HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; | 155635 | HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; |
| @@ -154044,6 +155647,73 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info *pIdxInfo, int | |||
| 154044 | } | 155647 | } |
| 154045 | 155648 | ||
| 154046 | /* | 155649 | /* |
| 155650 | ** Return true if constraint iCons is really an IN(...) constraint, or | ||
| 155651 | ** false otherwise. If iCons is an IN(...) constraint, set (if bHandle!=0) | ||
| 155652 | ** or clear (if bHandle==0) the flag to handle it using an iterator. | ||
| 155653 | */ | ||
| 155654 | SQLITE_API int sqlite3_vtab_in(sqlite3_index_info *pIdxInfo, int iCons, int bHandle){ | ||
| 155655 | HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; | ||
| 155656 | u32 m = SMASKBIT32(iCons); | ||
| 155657 | if( m & pHidden->mIn ){ | ||
| 155658 | if( bHandle==0 ){ | ||
| 155659 | pHidden->mHandleIn &= ~m; | ||
| 155660 | }else if( bHandle>0 ){ | ||
| 155661 | pHidden->mHandleIn |= m; | ||
| 155662 | } | ||
| 155663 | return 1; | ||
| 155664 | } | ||
| 155665 | return 0; | ||
| 155666 | } | ||
| 155667 | |||
| 155668 | /* | ||
| 155669 | ** This interface is callable from within the xBestIndex callback only. | ||
| 155670 | ** | ||
| 155671 | ** If possible, set (*ppVal) to point to an object containing the value | ||
| 155672 | ** on the right-hand-side of constraint iCons. | ||
| 155673 | */ | ||
| 155674 | SQLITE_API int sqlite3_vtab_rhs_value( | ||
| 155675 | sqlite3_index_info *pIdxInfo, /* Copy of first argument to xBestIndex */ | ||
| 155676 | int iCons, /* Constraint for which RHS is wanted */ | ||
| 155677 | sqlite3_value **ppVal /* Write value extracted here */ | ||
| 155678 | ){ | ||
| 155679 | HiddenIndexInfo *pH = (HiddenIndexInfo*)&pIdxInfo[1]; | ||
| 155680 | sqlite3_value *pVal = 0; | ||
| 155681 | int rc = SQLITE_OK; | ||
| 155682 | if( iCons<0 || iCons>=pIdxInfo->nConstraint ){ | ||
| 155683 | rc = SQLITE_MISUSE; /* EV: R-30545-25046 */ | ||
| 155684 | }else{ | ||
| 155685 | if( pH->aRhs[iCons]==0 ){ | ||
| 155686 | WhereTerm *pTerm = &pH->pWC->a[pIdxInfo->aConstraint[iCons].iTermOffset]; | ||
| 155687 | rc = sqlite3ValueFromExpr( | ||
| 155688 | pH->pParse->db, pTerm->pExpr->pRight, ENC(pH->pParse->db), | ||
| 155689 | SQLITE_AFF_BLOB, &pH->aRhs[iCons] | ||
| 155690 | ); | ||
| 155691 | testcase( rc!=SQLITE_OK ); | ||
| 155692 | } | ||
| 155693 | pVal = pH->aRhs[iCons]; | ||
| 155694 | } | ||
| 155695 | *ppVal = pVal; | ||
| 155696 | |||
| 155697 | if( rc==SQLITE_OK && pVal==0 ){ /* IMP: R-19933-32160 */ | ||
| 155698 | rc = SQLITE_NOTFOUND; /* IMP: R-36424-56542 */ | ||
| 155699 | } | ||
| 155700 | |||
| 155701 | return rc; | ||
| 155702 | } | ||
| 155703 | |||
| 155704 | |||
| 155705 | /* | ||
| 155706 | ** Return true if ORDER BY clause may be handled as DISTINCT. | ||
| 155707 | */ | ||
| 155708 | SQLITE_API int sqlite3_vtab_distinct(sqlite3_index_info *pIdxInfo){ | ||
| 155709 | HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; | ||
| 155710 | assert( pHidden->eDistinct==0 | ||
| 155711 | || pHidden->eDistinct==1 | ||
| 155712 | || pHidden->eDistinct==2 ); | ||
| 155713 | return pHidden->eDistinct; | ||
| 155714 | } | ||
| 155715 | |||
| 155716 | /* | ||
| 154047 | ** Add all WhereLoop objects for a table of the join identified by | 155717 | ** Add all WhereLoop objects for a table of the join identified by |
| 154048 | ** pBuilder->pNew->iTab. That table is guaranteed to be a virtual table. | 155718 | ** pBuilder->pNew->iTab. That table is guaranteed to be a virtual table. |
| 154049 | ** | 155719 | ** |
| @@ -154084,6 +155754,7 @@ static int whereLoopAddVirtual( | |||
| 154084 | WhereLoop *pNew; | 155754 | WhereLoop *pNew; |
| 154085 | Bitmask mBest; /* Tables used by best possible plan */ | 155755 | Bitmask mBest; /* Tables used by best possible plan */ |
| 154086 | u16 mNoOmit; | 155756 | u16 mNoOmit; |
| 155757 | int bRetry = 0; /* True to retry with LIMIT/OFFSET disabled */ | ||
| 154087 | 155758 | ||
| 154088 | assert( (mPrereq & mUnusable)==0 ); | 155759 | assert( (mPrereq & mUnusable)==0 ); |
| 154089 | pWInfo = pBuilder->pWInfo; | 155760 | pWInfo = pBuilder->pWInfo; |
| @@ -154092,8 +155763,7 @@ static int whereLoopAddVirtual( | |||
| 154092 | pNew = pBuilder->pNew; | 155763 | pNew = pBuilder->pNew; |
| 154093 | pSrc = &pWInfo->pTabList->a[pNew->iTab]; | 155764 | pSrc = &pWInfo->pTabList->a[pNew->iTab]; |
| 154094 | assert( IsVirtual(pSrc->pTab) ); | 155765 | assert( IsVirtual(pSrc->pTab) ); |
| 154095 | p = allocateIndexInfo(pParse, pWC, mUnusable, pSrc, pBuilder->pOrderBy, | 155766 | p = allocateIndexInfo(pWInfo, pWC, mUnusable, pSrc, &mNoOmit); |
| 154096 | &mNoOmit); | ||
| 154097 | if( p==0 ) return SQLITE_NOMEM_BKPT; | 155767 | if( p==0 ) return SQLITE_NOMEM_BKPT; |
| 154098 | pNew->rSetup = 0; | 155768 | pNew->rSetup = 0; |
| 154099 | pNew->wsFlags = WHERE_VIRTUALTABLE; | 155769 | pNew->wsFlags = WHERE_VIRTUALTABLE; |
| @@ -154101,14 +155771,22 @@ static int whereLoopAddVirtual( | |||
| 154101 | pNew->u.vtab.needFree = 0; | 155771 | pNew->u.vtab.needFree = 0; |
| 154102 | nConstraint = p->nConstraint; | 155772 | nConstraint = p->nConstraint; |
| 154103 | if( whereLoopResize(pParse->db, pNew, nConstraint) ){ | 155773 | if( whereLoopResize(pParse->db, pNew, nConstraint) ){ |
| 154104 | sqlite3DbFree(pParse->db, p); | 155774 | freeIndexInfo(pParse->db, p); |
| 154105 | return SQLITE_NOMEM_BKPT; | 155775 | return SQLITE_NOMEM_BKPT; |
| 154106 | } | 155776 | } |
| 154107 | 155777 | ||
| 154108 | /* First call xBestIndex() with all constraints usable. */ | 155778 | /* First call xBestIndex() with all constraints usable. */ |
| 154109 | WHERETRACE(0x800, ("BEGIN %s.addVirtual()\n", pSrc->pTab->zName)); | 155779 | WHERETRACE(0x800, ("BEGIN %s.addVirtual()\n", pSrc->pTab->zName)); |
| 154110 | WHERETRACE(0x40, (" VirtualOne: all usable\n")); | 155780 | WHERETRACE(0x40, (" VirtualOne: all usable\n")); |
| 154111 | rc = whereLoopAddVirtualOne(pBuilder, mPrereq, ALLBITS, 0, p, mNoOmit, &bIn); | 155781 | rc = whereLoopAddVirtualOne( |
| 155782 | pBuilder, mPrereq, ALLBITS, 0, p, mNoOmit, &bIn, &bRetry | ||
| 155783 | ); | ||
| 155784 | if( bRetry ){ | ||
| 155785 | assert( rc==SQLITE_OK ); | ||
| 155786 | rc = whereLoopAddVirtualOne( | ||
| 155787 | pBuilder, mPrereq, ALLBITS, 0, p, mNoOmit, &bIn, 0 | ||
| 155788 | ); | ||
| 155789 | } | ||
| 154112 | 155790 | ||
| 154113 | /* If the call to xBestIndex() with all terms enabled produced a plan | 155791 | /* If the call to xBestIndex() with all terms enabled produced a plan |
| 154114 | ** that does not require any source tables (IOW: a plan with mBest==0) | 155792 | ** that does not require any source tables (IOW: a plan with mBest==0) |
| @@ -154126,7 +155804,7 @@ static int whereLoopAddVirtual( | |||
| 154126 | if( bIn ){ | 155804 | if( bIn ){ |
| 154127 | WHERETRACE(0x40, (" VirtualOne: all usable w/o IN\n")); | 155805 | WHERETRACE(0x40, (" VirtualOne: all usable w/o IN\n")); |
| 154128 | rc = whereLoopAddVirtualOne( | 155806 | rc = whereLoopAddVirtualOne( |
| 154129 | pBuilder, mPrereq, ALLBITS, WO_IN, p, mNoOmit, &bIn); | 155807 | pBuilder, mPrereq, ALLBITS, WO_IN, p, mNoOmit, &bIn, 0); |
| 154130 | assert( bIn==0 ); | 155808 | assert( bIn==0 ); |
| 154131 | mBestNoIn = pNew->prereq & ~mPrereq; | 155809 | mBestNoIn = pNew->prereq & ~mPrereq; |
| 154132 | if( mBestNoIn==0 ){ | 155810 | if( mBestNoIn==0 ){ |
| @@ -154153,7 +155831,7 @@ static int whereLoopAddVirtual( | |||
| 154153 | WHERETRACE(0x40, (" VirtualOne: mPrev=%04llx mNext=%04llx\n", | 155831 | WHERETRACE(0x40, (" VirtualOne: mPrev=%04llx mNext=%04llx\n", |
| 154154 | (sqlite3_uint64)mPrev, (sqlite3_uint64)mNext)); | 155832 | (sqlite3_uint64)mPrev, (sqlite3_uint64)mNext)); |
| 154155 | rc = whereLoopAddVirtualOne( | 155833 | rc = whereLoopAddVirtualOne( |
| 154156 | pBuilder, mPrereq, mNext|mPrereq, 0, p, mNoOmit, &bIn); | 155834 | pBuilder, mPrereq, mNext|mPrereq, 0, p, mNoOmit, &bIn, 0); |
| 154157 | if( pNew->prereq==mPrereq ){ | 155835 | if( pNew->prereq==mPrereq ){ |
| 154158 | seenZero = 1; | 155836 | seenZero = 1; |
| 154159 | if( bIn==0 ) seenZeroNoIN = 1; | 155837 | if( bIn==0 ) seenZeroNoIN = 1; |
| @@ -154166,7 +155844,7 @@ static int whereLoopAddVirtual( | |||
| 154166 | if( rc==SQLITE_OK && seenZero==0 ){ | 155844 | if( rc==SQLITE_OK && seenZero==0 ){ |
| 154167 | WHERETRACE(0x40, (" VirtualOne: all disabled\n")); | 155845 | WHERETRACE(0x40, (" VirtualOne: all disabled\n")); |
| 154168 | rc = whereLoopAddVirtualOne( | 155846 | rc = whereLoopAddVirtualOne( |
| 154169 | pBuilder, mPrereq, mPrereq, 0, p, mNoOmit, &bIn); | 155847 | pBuilder, mPrereq, mPrereq, 0, p, mNoOmit, &bIn, 0); |
| 154170 | if( bIn==0 ) seenZeroNoIN = 1; | 155848 | if( bIn==0 ) seenZeroNoIN = 1; |
| 154171 | } | 155849 | } |
| 154172 | 155850 | ||
| @@ -154176,12 +155854,12 @@ static int whereLoopAddVirtual( | |||
| 154176 | if( rc==SQLITE_OK && seenZeroNoIN==0 ){ | 155854 | if( rc==SQLITE_OK && seenZeroNoIN==0 ){ |
| 154177 | WHERETRACE(0x40, (" VirtualOne: all disabled and w/o IN\n")); | 155855 | WHERETRACE(0x40, (" VirtualOne: all disabled and w/o IN\n")); |
| 154178 | rc = whereLoopAddVirtualOne( | 155856 | rc = whereLoopAddVirtualOne( |
| 154179 | pBuilder, mPrereq, mPrereq, WO_IN, p, mNoOmit, &bIn); | 155857 | pBuilder, mPrereq, mPrereq, WO_IN, p, mNoOmit, &bIn, 0); |
| 154180 | } | 155858 | } |
| 154181 | } | 155859 | } |
| 154182 | 155860 | ||
| 154183 | if( p->needToFreeIdxStr ) sqlite3_free(p->idxStr); | 155861 | if( p->needToFreeIdxStr ) sqlite3_free(p->idxStr); |
| 154184 | sqlite3DbFreeNN(pParse->db, p); | 155862 | freeIndexInfo(pParse->db, p); |
| 154185 | WHERETRACE(0x800, ("END %s.addVirtual(), rc=%d\n", pSrc->pTab->zName, rc)); | 155863 | WHERETRACE(0x800, ("END %s.addVirtual(), rc=%d\n", pSrc->pTab->zName, rc)); |
| 154186 | return rc; | 155864 | return rc; |
| 154187 | } | 155865 | } |
| @@ -154225,7 +155903,6 @@ static int whereLoopAddOr( | |||
| 154225 | int i, j; | 155903 | int i, j; |
| 154226 | 155904 | ||
| 154227 | sSubBuild = *pBuilder; | 155905 | sSubBuild = *pBuilder; |
| 154228 | sSubBuild.pOrderBy = 0; | ||
| 154229 | sSubBuild.pOrSet = &sCur; | 155906 | sSubBuild.pOrSet = &sCur; |
| 154230 | 155907 | ||
| 154231 | WHERETRACE(0x200, ("Begin processing OR-clause %p\n", pTerm)); | 155908 | WHERETRACE(0x200, ("Begin processing OR-clause %p\n", pTerm)); |
| @@ -154237,6 +155914,7 @@ static int whereLoopAddOr( | |||
| 154237 | tempWC.pOuter = pWC; | 155914 | tempWC.pOuter = pWC; |
| 154238 | tempWC.op = TK_AND; | 155915 | tempWC.op = TK_AND; |
| 154239 | tempWC.nTerm = 1; | 155916 | tempWC.nTerm = 1; |
| 155917 | tempWC.nBase = 1; | ||
| 154240 | tempWC.a = pOrTerm; | 155918 | tempWC.a = pOrTerm; |
| 154241 | sSubBuild.pWC = &tempWC; | 155919 | sSubBuild.pWC = &tempWC; |
| 154242 | }else{ | 155920 | }else{ |
| @@ -155344,6 +157022,150 @@ static void showAllWhereLoops(WhereInfo *pWInfo, WhereClause *pWC){ | |||
| 155344 | # define WHERETRACE_ALL_LOOPS(W,C) | 157022 | # define WHERETRACE_ALL_LOOPS(W,C) |
| 155345 | #endif | 157023 | #endif |
| 155346 | 157024 | ||
| 157025 | /* Attempt to omit tables from a join that do not affect the result. | ||
| 157026 | ** For a table to not affect the result, the following must be true: | ||
| 157027 | ** | ||
| 157028 | ** 1) The query must not be an aggregate. | ||
| 157029 | ** 2) The table must be the RHS of a LEFT JOIN. | ||
| 157030 | ** 3) Either the query must be DISTINCT, or else the ON or USING clause | ||
| 157031 | ** must contain a constraint that limits the scan of the table to | ||
| 157032 | ** at most a single row. | ||
| 157033 | ** 4) The table must not be referenced by any part of the query apart | ||
| 157034 | ** from its own USING or ON clause. | ||
| 157035 | ** | ||
| 157036 | ** For example, given: | ||
| 157037 | ** | ||
| 157038 | ** CREATE TABLE t1(ipk INTEGER PRIMARY KEY, v1); | ||
| 157039 | ** CREATE TABLE t2(ipk INTEGER PRIMARY KEY, v2); | ||
| 157040 | ** CREATE TABLE t3(ipk INTEGER PRIMARY KEY, v3); | ||
| 157041 | ** | ||
| 157042 | ** then table t2 can be omitted from the following: | ||
| 157043 | ** | ||
| 157044 | ** SELECT v1, v3 FROM t1 | ||
| 157045 | ** LEFT JOIN t2 ON (t1.ipk=t2.ipk) | ||
| 157046 | ** LEFT JOIN t3 ON (t1.ipk=t3.ipk) | ||
| 157047 | ** | ||
| 157048 | ** or from: | ||
| 157049 | ** | ||
| 157050 | ** SELECT DISTINCT v1, v3 FROM t1 | ||
| 157051 | ** LEFT JOIN t2 | ||
| 157052 | ** LEFT JOIN t3 ON (t1.ipk=t3.ipk) | ||
| 157053 | */ | ||
| 157054 | static SQLITE_NOINLINE Bitmask whereOmitNoopJoin( | ||
| 157055 | WhereInfo *pWInfo, | ||
| 157056 | Bitmask notReady | ||
| 157057 | ){ | ||
| 157058 | int i; | ||
| 157059 | Bitmask tabUsed; | ||
| 157060 | |||
| 157061 | /* Preconditions checked by the caller */ | ||
| 157062 | assert( pWInfo->nLevel>=2 ); | ||
| 157063 | assert( OptimizationEnabled(pWInfo->pParse->db, SQLITE_OmitNoopJoin) ); | ||
| 157064 | |||
| 157065 | /* These two preconditions checked by the caller combine to guarantee | ||
| 157066 | ** condition (1) of the header comment */ | ||
| 157067 | assert( pWInfo->pResultSet!=0 ); | ||
| 157068 | assert( 0==(pWInfo->wctrlFlags & WHERE_AGG_DISTINCT) ); | ||
| 157069 | |||
| 157070 | tabUsed = sqlite3WhereExprListUsage(&pWInfo->sMaskSet, pWInfo->pResultSet); | ||
| 157071 | if( pWInfo->pOrderBy ){ | ||
| 157072 | tabUsed |= sqlite3WhereExprListUsage(&pWInfo->sMaskSet, pWInfo->pOrderBy); | ||
| 157073 | } | ||
| 157074 | for(i=pWInfo->nLevel-1; i>=1; i--){ | ||
| 157075 | WhereTerm *pTerm, *pEnd; | ||
| 157076 | SrcItem *pItem; | ||
| 157077 | WhereLoop *pLoop; | ||
| 157078 | pLoop = pWInfo->a[i].pWLoop; | ||
| 157079 | pItem = &pWInfo->pTabList->a[pLoop->iTab]; | ||
| 157080 | if( (pItem->fg.jointype & JT_LEFT)==0 ) continue; | ||
| 157081 | if( (pWInfo->wctrlFlags & WHERE_WANT_DISTINCT)==0 | ||
| 157082 | && (pLoop->wsFlags & WHERE_ONEROW)==0 | ||
| 157083 | ){ | ||
| 157084 | continue; | ||
| 157085 | } | ||
| 157086 | if( (tabUsed & pLoop->maskSelf)!=0 ) continue; | ||
| 157087 | pEnd = pWInfo->sWC.a + pWInfo->sWC.nTerm; | ||
| 157088 | for(pTerm=pWInfo->sWC.a; pTerm<pEnd; pTerm++){ | ||
| 157089 | if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){ | ||
| 157090 | if( !ExprHasProperty(pTerm->pExpr, EP_FromJoin) | ||
| 157091 | || pTerm->pExpr->w.iRightJoinTable!=pItem->iCursor | ||
| 157092 | ){ | ||
| 157093 | break; | ||
| 157094 | } | ||
| 157095 | } | ||
| 157096 | } | ||
| 157097 | if( pTerm<pEnd ) continue; | ||
| 157098 | WHERETRACE(0xffff, ("-> drop loop %c not used\n", pLoop->cId)); | ||
| 157099 | notReady &= ~pLoop->maskSelf; | ||
| 157100 | for(pTerm=pWInfo->sWC.a; pTerm<pEnd; pTerm++){ | ||
| 157101 | if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){ | ||
| 157102 | pTerm->wtFlags |= TERM_CODED; | ||
| 157103 | } | ||
| 157104 | } | ||
| 157105 | if( i!=pWInfo->nLevel-1 ){ | ||
| 157106 | int nByte = (pWInfo->nLevel-1-i) * sizeof(WhereLevel); | ||
| 157107 | memmove(&pWInfo->a[i], &pWInfo->a[i+1], nByte); | ||
| 157108 | } | ||
| 157109 | pWInfo->nLevel--; | ||
| 157110 | assert( pWInfo->nLevel>0 ); | ||
| 157111 | } | ||
| 157112 | return notReady; | ||
| 157113 | } | ||
| 157114 | |||
| 157115 | /* | ||
| 157116 | ** Check to see if there are any SEARCH loops that might benefit from | ||
| 157117 | ** using a Bloom filter. Consider a Bloom filter if: | ||
| 157118 | ** | ||
| 157119 | ** (1) The SEARCH happens more than N times where N is the number | ||
| 157120 | ** of rows in the table that is being considered for the Bloom | ||
| 157121 | ** filter. | ||
| 157122 | ** (2) Some searches are expected to find zero rows. (This is determined | ||
| 157123 | ** by the WHERE_SELFCULL flag on the term.) | ||
| 157124 | ** (3) Bloom-filter processing is not disabled. (Checked by the | ||
| 157125 | ** caller.) | ||
| 157126 | ** (4) The size of the table being searched is known by ANALYZE. | ||
| 157127 | ** | ||
| 157128 | ** This block of code merely checks to see if a Bloom filter would be | ||
| 157129 | ** appropriate, and if so sets the WHERE_BLOOMFILTER flag on the | ||
| 157130 | ** WhereLoop. The implementation of the Bloom filter comes further | ||
| 157131 | ** down where the code for each WhereLoop is generated. | ||
| 157132 | */ | ||
| 157133 | static SQLITE_NOINLINE void whereCheckIfBloomFilterIsUseful( | ||
| 157134 | const WhereInfo *pWInfo | ||
| 157135 | ){ | ||
| 157136 | int i; | ||
| 157137 | LogEst nSearch; | ||
| 157138 | |||
| 157139 | assert( pWInfo->nLevel>=2 ); | ||
| 157140 | assert( OptimizationEnabled(pWInfo->pParse->db, SQLITE_BloomFilter) ); | ||
| 157141 | nSearch = pWInfo->a[0].pWLoop->nOut; | ||
| 157142 | for(i=1; i<pWInfo->nLevel; i++){ | ||
| 157143 | WhereLoop *pLoop = pWInfo->a[i].pWLoop; | ||
| 157144 | const unsigned int reqFlags = (WHERE_SELFCULL|WHERE_COLUMN_EQ); | ||
| 157145 | if( (pLoop->wsFlags & reqFlags)==reqFlags | ||
| 157146 | /* vvvvvv--- Always the case if WHERE_COLUMN_EQ is defined */ | ||
| 157147 | && ALWAYS((pLoop->wsFlags & (WHERE_IPK|WHERE_INDEXED))!=0) | ||
| 157148 | ){ | ||
| 157149 | SrcItem *pItem = &pWInfo->pTabList->a[pLoop->iTab]; | ||
| 157150 | Table *pTab = pItem->pTab; | ||
| 157151 | pTab->tabFlags |= TF_StatsUsed; | ||
| 157152 | if( nSearch > pTab->nRowLogEst | ||
| 157153 | && (pTab->tabFlags & TF_HasStat1)!=0 | ||
| 157154 | ){ | ||
| 157155 | testcase( pItem->fg.jointype & JT_LEFT ); | ||
| 157156 | pLoop->wsFlags |= WHERE_BLOOMFILTER; | ||
| 157157 | pLoop->wsFlags &= ~WHERE_IDX_ONLY; | ||
| 157158 | WHERETRACE(0xffff, ( | ||
| 157159 | "-> use Bloom-filter on loop %c because there are ~%.1e " | ||
| 157160 | "lookups into %s which has only ~%.1e rows\n", | ||
| 157161 | pLoop->cId, (double)sqlite3LogEstToInt(nSearch), pTab->zName, | ||
| 157162 | (double)sqlite3LogEstToInt(pTab->nRowLogEst))); | ||
| 157163 | } | ||
| 157164 | } | ||
| 157165 | nSearch += pLoop->nOut; | ||
| 157166 | } | ||
| 157167 | } | ||
| 157168 | |||
| 155347 | /* | 157169 | /* |
| 155348 | ** Generate the beginning of the loop used for WHERE clause processing. | 157170 | ** Generate the beginning of the loop used for WHERE clause processing. |
| 155349 | ** The return value is a pointer to an opaque structure that contains | 157171 | ** The return value is a pointer to an opaque structure that contains |
| @@ -155438,6 +157260,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( | |||
| 155438 | Expr *pWhere, /* The WHERE clause */ | 157260 | Expr *pWhere, /* The WHERE clause */ |
| 155439 | ExprList *pOrderBy, /* An ORDER BY (or GROUP BY) clause, or NULL */ | 157261 | ExprList *pOrderBy, /* An ORDER BY (or GROUP BY) clause, or NULL */ |
| 155440 | ExprList *pResultSet, /* Query result set. Req'd for DISTINCT */ | 157262 | ExprList *pResultSet, /* Query result set. Req'd for DISTINCT */ |
| 157263 | Select *pLimit, /* Use this LIMIT/OFFSET clause, if any */ | ||
| 155441 | u16 wctrlFlags, /* The WHERE_* flags defined in sqliteInt.h */ | 157264 | u16 wctrlFlags, /* The WHERE_* flags defined in sqliteInt.h */ |
| 155442 | int iAuxArg /* If WHERE_OR_SUBCLAUSE is set, index cursor number | 157265 | int iAuxArg /* If WHERE_OR_SUBCLAUSE is set, index cursor number |
| 155443 | ** If WHERE_USE_LIMIT, then the limit amount */ | 157266 | ** If WHERE_USE_LIMIT, then the limit amount */ |
| @@ -155472,13 +157295,6 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( | |||
| 155472 | /* An ORDER/GROUP BY clause of more than 63 terms cannot be optimized */ | 157295 | /* An ORDER/GROUP BY clause of more than 63 terms cannot be optimized */ |
| 155473 | testcase( pOrderBy && pOrderBy->nExpr==BMS-1 ); | 157296 | testcase( pOrderBy && pOrderBy->nExpr==BMS-1 ); |
| 155474 | if( pOrderBy && pOrderBy->nExpr>=BMS ) pOrderBy = 0; | 157297 | if( pOrderBy && pOrderBy->nExpr>=BMS ) pOrderBy = 0; |
| 155475 | sWLB.pOrderBy = pOrderBy; | ||
| 155476 | |||
| 155477 | /* Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via | ||
| 155478 | ** sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */ | ||
| 155479 | if( OptimizationDisabled(db, SQLITE_DistinctOpt) ){ | ||
| 155480 | wctrlFlags &= ~WHERE_WANT_DISTINCT; | ||
| 155481 | } | ||
| 155482 | 157298 | ||
| 155483 | /* The number of tables in the FROM clause is limited by the number of | 157299 | /* The number of tables in the FROM clause is limited by the number of |
| 155484 | ** bits in a Bitmask | 157300 | ** bits in a Bitmask |
| @@ -155521,11 +157337,18 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( | |||
| 155521 | pWInfo->wctrlFlags = wctrlFlags; | 157337 | pWInfo->wctrlFlags = wctrlFlags; |
| 155522 | pWInfo->iLimit = iAuxArg; | 157338 | pWInfo->iLimit = iAuxArg; |
| 155523 | pWInfo->savedNQueryLoop = pParse->nQueryLoop; | 157339 | pWInfo->savedNQueryLoop = pParse->nQueryLoop; |
| 157340 | #ifndef SQLITE_OMIT_VIRTUALTABLE | ||
| 157341 | pWInfo->pLimit = pLimit; | ||
| 157342 | #endif | ||
| 155524 | memset(&pWInfo->nOBSat, 0, | 157343 | memset(&pWInfo->nOBSat, 0, |
| 155525 | offsetof(WhereInfo,sWC) - offsetof(WhereInfo,nOBSat)); | 157344 | offsetof(WhereInfo,sWC) - offsetof(WhereInfo,nOBSat)); |
| 155526 | memset(&pWInfo->a[0], 0, sizeof(WhereLoop)+nTabList*sizeof(WhereLevel)); | 157345 | memset(&pWInfo->a[0], 0, sizeof(WhereLoop)+nTabList*sizeof(WhereLevel)); |
| 155527 | assert( pWInfo->eOnePass==ONEPASS_OFF ); /* ONEPASS defaults to OFF */ | 157346 | assert( pWInfo->eOnePass==ONEPASS_OFF ); /* ONEPASS defaults to OFF */ |
| 155528 | pMaskSet = &pWInfo->sMaskSet; | 157347 | pMaskSet = &pWInfo->sMaskSet; |
| 157348 | pMaskSet->n = 0; | ||
| 157349 | pMaskSet->ix[0] = -99; /* Initialize ix[0] to a value that can never be | ||
| 157350 | ** a valid cursor number, to avoid an initial | ||
| 157351 | ** test for pMaskSet->n==0 in sqlite3WhereGetMask() */ | ||
| 155529 | sWLB.pWInfo = pWInfo; | 157352 | sWLB.pWInfo = pWInfo; |
| 155530 | sWLB.pWC = &pWInfo->sWC; | 157353 | sWLB.pWC = &pWInfo->sWC; |
| 155531 | sWLB.pNew = (WhereLoop*)(((char*)pWInfo)+nByteWInfo); | 157354 | sWLB.pNew = (WhereLoop*)(((char*)pWInfo)+nByteWInfo); |
| @@ -155538,7 +157361,6 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( | |||
| 155538 | /* Split the WHERE clause into separate subexpressions where each | 157361 | /* Split the WHERE clause into separate subexpressions where each |
| 155539 | ** subexpression is separated by an AND operator. | 157362 | ** subexpression is separated by an AND operator. |
| 155540 | */ | 157363 | */ |
| 155541 | initMaskSet(pMaskSet); | ||
| 155542 | sqlite3WhereClauseInit(&pWInfo->sWC, pWInfo); | 157364 | sqlite3WhereClauseInit(&pWInfo->sWC, pWInfo); |
| 155543 | sqlite3WhereSplit(&pWInfo->sWC, pWhere, TK_AND); | 157365 | sqlite3WhereSplit(&pWInfo->sWC, pWhere, TK_AND); |
| 155544 | 157366 | ||
| @@ -155546,7 +157368,9 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( | |||
| 155546 | */ | 157368 | */ |
| 155547 | if( nTabList==0 ){ | 157369 | if( nTabList==0 ){ |
| 155548 | if( pOrderBy ) pWInfo->nOBSat = pOrderBy->nExpr; | 157370 | if( pOrderBy ) pWInfo->nOBSat = pOrderBy->nExpr; |
| 155549 | if( wctrlFlags & WHERE_WANT_DISTINCT ){ | 157371 | if( (wctrlFlags & WHERE_WANT_DISTINCT)!=0 |
| 157372 | && OptimizationEnabled(db, SQLITE_DistinctOpt) | ||
| 157373 | ){ | ||
| 155550 | pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE; | 157374 | pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE; |
| 155551 | } | 157375 | } |
| 155552 | ExplainQueryPlan((pParse, 0, "SCAN CONSTANT ROW")); | 157376 | ExplainQueryPlan((pParse, 0, "SCAN CONSTANT ROW")); |
| @@ -155584,6 +157408,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( | |||
| 155584 | 157408 | ||
| 155585 | /* Analyze all of the subexpressions. */ | 157409 | /* Analyze all of the subexpressions. */ |
| 155586 | sqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC); | 157410 | sqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC); |
| 157411 | sqlite3WhereAddLimit(&pWInfo->sWC, pLimit); | ||
| 155587 | if( db->mallocFailed ) goto whereBeginError; | 157412 | if( db->mallocFailed ) goto whereBeginError; |
| 155588 | 157413 | ||
| 155589 | /* Special case: WHERE terms that do not refer to any tables in the join | 157414 | /* Special case: WHERE terms that do not refer to any tables in the join |
| @@ -155597,7 +157422,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( | |||
| 155597 | ** FROM ... WHERE random()>0; -- eval random() once per row | 157422 | ** FROM ... WHERE random()>0; -- eval random() once per row |
| 155598 | ** FROM ... WHERE (SELECT random())>0; -- eval random() once overall | 157423 | ** FROM ... WHERE (SELECT random())>0; -- eval random() once overall |
| 155599 | */ | 157424 | */ |
| 155600 | for(ii=0; ii<sWLB.pWC->nTerm; ii++){ | 157425 | for(ii=0; ii<sWLB.pWC->nBase; ii++){ |
| 155601 | WhereTerm *pT = &sWLB.pWC->a[ii]; | 157426 | WhereTerm *pT = &sWLB.pWC->a[ii]; |
| 155602 | if( pT->wtFlags & TERM_VIRTUAL ) continue; | 157427 | if( pT->wtFlags & TERM_VIRTUAL ) continue; |
| 155603 | if( pT->prereqAll==0 && (nTabList==0 || exprIsDeterministic(pT->pExpr)) ){ | 157428 | if( pT->prereqAll==0 && (nTabList==0 || exprIsDeterministic(pT->pExpr)) ){ |
| @@ -155607,7 +157432,12 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( | |||
| 155607 | } | 157432 | } |
| 155608 | 157433 | ||
| 155609 | if( wctrlFlags & WHERE_WANT_DISTINCT ){ | 157434 | if( wctrlFlags & WHERE_WANT_DISTINCT ){ |
| 155610 | if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){ | 157435 | if( OptimizationDisabled(db, SQLITE_DistinctOpt) ){ |
| 157436 | /* Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via | ||
| 157437 | ** sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */ | ||
| 157438 | wctrlFlags &= ~WHERE_WANT_DISTINCT; | ||
| 157439 | pWInfo->wctrlFlags &= ~WHERE_WANT_DISTINCT; | ||
| 157440 | }else if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){ | ||
| 155611 | /* The DISTINCT marking is pointless. Ignore it. */ | 157441 | /* The DISTINCT marking is pointless. Ignore it. */ |
| 155612 | pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE; | 157442 | pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE; |
| 155613 | }else if( pOrderBy==0 ){ | 157443 | }else if( pOrderBy==0 ){ |
| @@ -155678,9 +157508,10 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( | |||
| 155678 | if( pWInfo->pOrderBy==0 && (db->flags & SQLITE_ReverseOrder)!=0 ){ | 157508 | if( pWInfo->pOrderBy==0 && (db->flags & SQLITE_ReverseOrder)!=0 ){ |
| 155679 | pWInfo->revMask = ALLBITS; | 157509 | pWInfo->revMask = ALLBITS; |
| 155680 | } | 157510 | } |
| 155681 | if( pParse->nErr || db->mallocFailed ){ | 157511 | if( pParse->nErr ){ |
| 155682 | goto whereBeginError; | 157512 | goto whereBeginError; |
| 155683 | } | 157513 | } |
| 157514 | assert( db->mallocFailed==0 ); | ||
| 155684 | #ifdef WHERETRACE_ENABLED | 157515 | #ifdef WHERETRACE_ENABLED |
| 155685 | if( sqlite3WhereTrace ){ | 157516 | if( sqlite3WhereTrace ){ |
| 155686 | sqlite3DebugPrintf("---- Solution nRow=%d", pWInfo->nRowOut); | 157517 | sqlite3DebugPrintf("---- Solution nRow=%d", pWInfo->nRowOut); |
| @@ -155708,34 +157539,15 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( | |||
| 155708 | } | 157539 | } |
| 155709 | #endif | 157540 | #endif |
| 155710 | 157541 | ||
| 155711 | /* Attempt to omit tables from the join that do not affect the result. | 157542 | /* Attempt to omit tables from a join that do not affect the result. |
| 155712 | ** For a table to not affect the result, the following must be true: | 157543 | ** See the comment on whereOmitNoopJoin() for further information. |
| 155713 | ** | ||
| 155714 | ** 1) The query must not be an aggregate. | ||
| 155715 | ** 2) The table must be the RHS of a LEFT JOIN. | ||
| 155716 | ** 3) Either the query must be DISTINCT, or else the ON or USING clause | ||
| 155717 | ** must contain a constraint that limits the scan of the table to | ||
| 155718 | ** at most a single row. | ||
| 155719 | ** 4) The table must not be referenced by any part of the query apart | ||
| 155720 | ** from its own USING or ON clause. | ||
| 155721 | ** | ||
| 155722 | ** For example, given: | ||
| 155723 | ** | ||
| 155724 | ** CREATE TABLE t1(ipk INTEGER PRIMARY KEY, v1); | ||
| 155725 | ** CREATE TABLE t2(ipk INTEGER PRIMARY KEY, v2); | ||
| 155726 | ** CREATE TABLE t3(ipk INTEGER PRIMARY KEY, v3); | ||
| 155727 | ** | 157544 | ** |
| 155728 | ** then table t2 can be omitted from the following: | 157545 | ** This query optimization is factored out into a separate "no-inline" |
| 155729 | ** | 157546 | ** procedure to keep the sqlite3WhereBegin() procedure from becoming |
| 155730 | ** SELECT v1, v3 FROM t1 | 157547 | ** too large. If sqlite3WhereBegin() becomes too large, that prevents |
| 155731 | ** LEFT JOIN t2 ON (t1.ipk=t2.ipk) | 157548 | ** some C-compiler optimizers from in-lining the |
| 155732 | ** LEFT JOIN t3 ON (t1.ipk=t3.ipk) | 157549 | ** sqlite3WhereCodeOneLoopStart() procedure, and it is important to |
| 155733 | ** | 157550 | ** in-line sqlite3WhereCodeOneLoopStart() for performance reasons. |
| 155734 | ** or from: | ||
| 155735 | ** | ||
| 155736 | ** SELECT DISTINCT v1, v3 FROM t1 | ||
| 155737 | ** LEFT JOIN t2 | ||
| 155738 | ** LEFT JOIN t3 ON (t1.ipk=t3.ipk) | ||
| 155739 | */ | 157551 | */ |
| 155740 | notReady = ~(Bitmask)0; | 157552 | notReady = ~(Bitmask)0; |
| 155741 | if( pWInfo->nLevel>=2 | 157553 | if( pWInfo->nLevel>=2 |
| @@ -155743,49 +157555,20 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( | |||
| 155743 | && 0==(wctrlFlags & WHERE_AGG_DISTINCT) /* condition (1) above */ | 157555 | && 0==(wctrlFlags & WHERE_AGG_DISTINCT) /* condition (1) above */ |
| 155744 | && OptimizationEnabled(db, SQLITE_OmitNoopJoin) | 157556 | && OptimizationEnabled(db, SQLITE_OmitNoopJoin) |
| 155745 | ){ | 157557 | ){ |
| 155746 | int i; | 157558 | notReady = whereOmitNoopJoin(pWInfo, notReady); |
| 155747 | Bitmask tabUsed = sqlite3WhereExprListUsage(pMaskSet, pResultSet); | 157559 | nTabList = pWInfo->nLevel; |
| 155748 | if( sWLB.pOrderBy ){ | 157560 | assert( nTabList>0 ); |
| 155749 | tabUsed |= sqlite3WhereExprListUsage(pMaskSet, sWLB.pOrderBy); | ||
| 155750 | } | ||
| 155751 | for(i=pWInfo->nLevel-1; i>=1; i--){ | ||
| 155752 | WhereTerm *pTerm, *pEnd; | ||
| 155753 | SrcItem *pItem; | ||
| 155754 | pLoop = pWInfo->a[i].pWLoop; | ||
| 155755 | pItem = &pWInfo->pTabList->a[pLoop->iTab]; | ||
| 155756 | if( (pItem->fg.jointype & JT_LEFT)==0 ) continue; | ||
| 155757 | if( (wctrlFlags & WHERE_WANT_DISTINCT)==0 | ||
| 155758 | && (pLoop->wsFlags & WHERE_ONEROW)==0 | ||
| 155759 | ){ | ||
| 155760 | continue; | ||
| 155761 | } | ||
| 155762 | if( (tabUsed & pLoop->maskSelf)!=0 ) continue; | ||
| 155763 | pEnd = sWLB.pWC->a + sWLB.pWC->nTerm; | ||
| 155764 | for(pTerm=sWLB.pWC->a; pTerm<pEnd; pTerm++){ | ||
| 155765 | if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){ | ||
| 155766 | if( !ExprHasProperty(pTerm->pExpr, EP_FromJoin) | ||
| 155767 | || pTerm->pExpr->iRightJoinTable!=pItem->iCursor | ||
| 155768 | ){ | ||
| 155769 | break; | ||
| 155770 | } | ||
| 155771 | } | ||
| 155772 | } | ||
| 155773 | if( pTerm<pEnd ) continue; | ||
| 155774 | WHERETRACE(0xffff, ("-> drop loop %c not used\n", pLoop->cId)); | ||
| 155775 | notReady &= ~pLoop->maskSelf; | ||
| 155776 | for(pTerm=sWLB.pWC->a; pTerm<pEnd; pTerm++){ | ||
| 155777 | if( (pTerm->prereqAll & pLoop->maskSelf)!=0 ){ | ||
| 155778 | pTerm->wtFlags |= TERM_CODED; | ||
| 155779 | } | ||
| 155780 | } | ||
| 155781 | if( i!=pWInfo->nLevel-1 ){ | ||
| 155782 | int nByte = (pWInfo->nLevel-1-i) * sizeof(WhereLevel); | ||
| 155783 | memmove(&pWInfo->a[i], &pWInfo->a[i+1], nByte); | ||
| 155784 | } | ||
| 155785 | pWInfo->nLevel--; | ||
| 155786 | nTabList--; | ||
| 155787 | } | ||
| 155788 | } | 157561 | } |
| 157562 | |||
| 157563 | /* Check to see if there are any SEARCH loops that might benefit from | ||
| 157564 | ** using a Bloom filter. | ||
| 157565 | */ | ||
| 157566 | if( pWInfo->nLevel>=2 | ||
| 157567 | && OptimizationEnabled(db, SQLITE_BloomFilter) | ||
| 157568 | ){ | ||
| 157569 | whereCheckIfBloomFilterIsUseful(pWInfo); | ||
| 157570 | } | ||
| 157571 | |||
| 155789 | #if defined(WHERETRACE_ENABLED) | 157572 | #if defined(WHERETRACE_ENABLED) |
| 155790 | if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */ | 157573 | if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */ |
| 155791 | sqlite3DebugPrintf("---- WHERE clause at end of analysis:\n"); | 157574 | sqlite3DebugPrintf("---- WHERE clause at end of analysis:\n"); |
| @@ -155872,6 +157655,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( | |||
| 155872 | if( pWInfo->eOnePass==ONEPASS_OFF | 157655 | if( pWInfo->eOnePass==ONEPASS_OFF |
| 155873 | && pTab->nCol<BMS | 157656 | && pTab->nCol<BMS |
| 155874 | && (pTab->tabFlags & (TF_HasGenerated|TF_WithoutRowid))==0 | 157657 | && (pTab->tabFlags & (TF_HasGenerated|TF_WithoutRowid))==0 |
| 157658 | && (pLoop->wsFlags & (WHERE_AUTO_INDEX|WHERE_BLOOMFILTER))==0 | ||
| 155875 | ){ | 157659 | ){ |
| 155876 | /* If we know that only a prefix of the record will be used, | 157660 | /* If we know that only a prefix of the record will be used, |
| 155877 | ** it is advantageous to reduce the "column count" field in | 157661 | ** it is advantageous to reduce the "column count" field in |
| @@ -155974,13 +157758,17 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( | |||
| 155974 | if( pParse->nErr ) goto whereBeginError; | 157758 | if( pParse->nErr ) goto whereBeginError; |
| 155975 | pLevel = &pWInfo->a[ii]; | 157759 | pLevel = &pWInfo->a[ii]; |
| 155976 | wsFlags = pLevel->pWLoop->wsFlags; | 157760 | wsFlags = pLevel->pWLoop->wsFlags; |
| 157761 | if( (wsFlags & (WHERE_AUTO_INDEX|WHERE_BLOOMFILTER))!=0 ){ | ||
| 157762 | if( (wsFlags & WHERE_AUTO_INDEX)!=0 ){ | ||
| 155977 | #ifndef SQLITE_OMIT_AUTOMATIC_INDEX | 157763 | #ifndef SQLITE_OMIT_AUTOMATIC_INDEX |
| 155978 | if( (pLevel->pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0 ){ | 157764 | constructAutomaticIndex(pParse, &pWInfo->sWC, |
| 155979 | constructAutomaticIndex(pParse, &pWInfo->sWC, | 157765 | &pTabList->a[pLevel->iFrom], notReady, pLevel); |
| 155980 | &pTabList->a[pLevel->iFrom], notReady, pLevel); | 157766 | #endif |
| 157767 | }else{ | ||
| 157768 | sqlite3ConstructBloomFilter(pWInfo, ii, pLevel, notReady); | ||
| 157769 | } | ||
| 155981 | if( db->mallocFailed ) goto whereBeginError; | 157770 | if( db->mallocFailed ) goto whereBeginError; |
| 155982 | } | 157771 | } |
| 155983 | #endif | ||
| 155984 | addrExplain = sqlite3WhereExplainOneScan( | 157772 | addrExplain = sqlite3WhereExplainOneScan( |
| 155985 | pParse, pTabList, pLevel, wctrlFlags | 157773 | pParse, pTabList, pLevel, wctrlFlags |
| 155986 | ); | 157774 | ); |
| @@ -157432,12 +159220,7 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){ | |||
| 157432 | sqlite3ParserAddCleanup(pParse, sqlite3DbFree, pTab); | 159220 | sqlite3ParserAddCleanup(pParse, sqlite3DbFree, pTab); |
| 157433 | } | 159221 | } |
| 157434 | 159222 | ||
| 157435 | if( rc ){ | 159223 | assert( rc==SQLITE_OK || pParse->nErr!=0 ); |
| 157436 | if( pParse->nErr==0 ){ | ||
| 157437 | assert( pParse->db->mallocFailed ); | ||
| 157438 | sqlite3ErrorToParser(pParse->db, SQLITE_NOMEM); | ||
| 157439 | } | ||
| 157440 | } | ||
| 157441 | return rc; | 159224 | return rc; |
| 157442 | } | 159225 | } |
| 157443 | 159226 | ||
| @@ -159585,10 +161368,7 @@ static void updateDeleteLimitError( | |||
| 159585 | } | 161368 | } |
| 159586 | 161369 | ||
| 159587 | 161370 | ||
| 159588 | /* Construct a new Expr object from a single identifier. Use the | 161371 | /* Construct a new Expr object from a single token */ |
| 159589 | ** new Expr to populate pOut. Set the span of pOut to be the identifier | ||
| 159590 | ** that created the expression. | ||
| 159591 | */ | ||
| 159592 | static Expr *tokenExpr(Parse *pParse, int op, Token t){ | 161372 | static Expr *tokenExpr(Parse *pParse, int op, Token t){ |
| 159593 | Expr *p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr)+t.n+1); | 161373 | Expr *p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr)+t.n+1); |
| 159594 | if( p ){ | 161374 | if( p ){ |
| @@ -159608,6 +161388,7 @@ static void updateDeleteLimitError( | |||
| 159608 | p->u.zToken = (char*)&p[1]; | 161388 | p->u.zToken = (char*)&p[1]; |
| 159609 | memcpy(p->u.zToken, t.z, t.n); | 161389 | memcpy(p->u.zToken, t.z, t.n); |
| 159610 | p->u.zToken[t.n] = 0; | 161390 | p->u.zToken[t.n] = 0; |
| 161391 | p->w.iOfst = (int)(t.z - pParse->zTail); | ||
| 159611 | if( sqlite3Isquote(p->u.zToken[0]) ){ | 161392 | if( sqlite3Isquote(p->u.zToken[0]) ){ |
| 159612 | sqlite3DequoteExpr(p); | 161393 | sqlite3DequoteExpr(p); |
| 159613 | } | 161394 | } |
| @@ -159774,78 +161555,79 @@ static void updateDeleteLimitError( | |||
| 159774 | #define TK_SLASH 109 | 161555 | #define TK_SLASH 109 |
| 159775 | #define TK_REM 110 | 161556 | #define TK_REM 110 |
| 159776 | #define TK_CONCAT 111 | 161557 | #define TK_CONCAT 111 |
| 159777 | #define TK_COLLATE 112 | 161558 | #define TK_PTR 112 |
| 159778 | #define TK_BITNOT 113 | 161559 | #define TK_COLLATE 113 |
| 159779 | #define TK_ON 114 | 161560 | #define TK_BITNOT 114 |
| 159780 | #define TK_INDEXED 115 | 161561 | #define TK_ON 115 |
| 159781 | #define TK_STRING 116 | 161562 | #define TK_INDEXED 116 |
| 159782 | #define TK_JOIN_KW 117 | 161563 | #define TK_STRING 117 |
| 159783 | #define TK_CONSTRAINT 118 | 161564 | #define TK_JOIN_KW 118 |
| 159784 | #define TK_DEFAULT 119 | 161565 | #define TK_CONSTRAINT 119 |
| 159785 | #define TK_NULL 120 | 161566 | #define TK_DEFAULT 120 |
| 159786 | #define TK_PRIMARY 121 | 161567 | #define TK_NULL 121 |
| 159787 | #define TK_UNIQUE 122 | 161568 | #define TK_PRIMARY 122 |
| 159788 | #define TK_CHECK 123 | 161569 | #define TK_UNIQUE 123 |
| 159789 | #define TK_REFERENCES 124 | 161570 | #define TK_CHECK 124 |
| 159790 | #define TK_AUTOINCR 125 | 161571 | #define TK_REFERENCES 125 |
| 159791 | #define TK_INSERT 126 | 161572 | #define TK_AUTOINCR 126 |
| 159792 | #define TK_DELETE 127 | 161573 | #define TK_INSERT 127 |
| 159793 | #define TK_UPDATE 128 | 161574 | #define TK_DELETE 128 |
| 159794 | #define TK_SET 129 | 161575 | #define TK_UPDATE 129 |
| 159795 | #define TK_DEFERRABLE 130 | 161576 | #define TK_SET 130 |
| 159796 | #define TK_FOREIGN 131 | 161577 | #define TK_DEFERRABLE 131 |
| 159797 | #define TK_DROP 132 | 161578 | #define TK_FOREIGN 132 |
| 159798 | #define TK_UNION 133 | 161579 | #define TK_DROP 133 |
| 159799 | #define TK_ALL 134 | 161580 | #define TK_UNION 134 |
| 159800 | #define TK_EXCEPT 135 | 161581 | #define TK_ALL 135 |
| 159801 | #define TK_INTERSECT 136 | 161582 | #define TK_EXCEPT 136 |
| 159802 | #define TK_SELECT 137 | 161583 | #define TK_INTERSECT 137 |
| 159803 | #define TK_VALUES 138 | 161584 | #define TK_SELECT 138 |
| 159804 | #define TK_DISTINCT 139 | 161585 | #define TK_VALUES 139 |
| 159805 | #define TK_DOT 140 | 161586 | #define TK_DISTINCT 140 |
| 159806 | #define TK_FROM 141 | 161587 | #define TK_DOT 141 |
| 159807 | #define TK_JOIN 142 | 161588 | #define TK_FROM 142 |
| 159808 | #define TK_USING 143 | 161589 | #define TK_JOIN 143 |
| 159809 | #define TK_ORDER 144 | 161590 | #define TK_USING 144 |
| 159810 | #define TK_GROUP 145 | 161591 | #define TK_ORDER 145 |
| 159811 | #define TK_HAVING 146 | 161592 | #define TK_GROUP 146 |
| 159812 | #define TK_LIMIT 147 | 161593 | #define TK_HAVING 147 |
| 159813 | #define TK_WHERE 148 | 161594 | #define TK_LIMIT 148 |
| 159814 | #define TK_RETURNING 149 | 161595 | #define TK_WHERE 149 |
| 159815 | #define TK_INTO 150 | 161596 | #define TK_RETURNING 150 |
| 159816 | #define TK_NOTHING 151 | 161597 | #define TK_INTO 151 |
| 159817 | #define TK_FLOAT 152 | 161598 | #define TK_NOTHING 152 |
| 159818 | #define TK_BLOB 153 | 161599 | #define TK_FLOAT 153 |
| 159819 | #define TK_INTEGER 154 | 161600 | #define TK_BLOB 154 |
| 159820 | #define TK_VARIABLE 155 | 161601 | #define TK_INTEGER 155 |
| 159821 | #define TK_CASE 156 | 161602 | #define TK_VARIABLE 156 |
| 159822 | #define TK_WHEN 157 | 161603 | #define TK_CASE 157 |
| 159823 | #define TK_THEN 158 | 161604 | #define TK_WHEN 158 |
| 159824 | #define TK_ELSE 159 | 161605 | #define TK_THEN 159 |
| 159825 | #define TK_INDEX 160 | 161606 | #define TK_ELSE 160 |
| 159826 | #define TK_ALTER 161 | 161607 | #define TK_INDEX 161 |
| 159827 | #define TK_ADD 162 | 161608 | #define TK_ALTER 162 |
| 159828 | #define TK_WINDOW 163 | 161609 | #define TK_ADD 163 |
| 159829 | #define TK_OVER 164 | 161610 | #define TK_WINDOW 164 |
| 159830 | #define TK_FILTER 165 | 161611 | #define TK_OVER 165 |
| 159831 | #define TK_COLUMN 166 | 161612 | #define TK_FILTER 166 |
| 159832 | #define TK_AGG_FUNCTION 167 | 161613 | #define TK_COLUMN 167 |
| 159833 | #define TK_AGG_COLUMN 168 | 161614 | #define TK_AGG_FUNCTION 168 |
| 159834 | #define TK_TRUEFALSE 169 | 161615 | #define TK_AGG_COLUMN 169 |
| 159835 | #define TK_ISNOT 170 | 161616 | #define TK_TRUEFALSE 170 |
| 159836 | #define TK_FUNCTION 171 | 161617 | #define TK_ISNOT 171 |
| 159837 | #define TK_UMINUS 172 | 161618 | #define TK_FUNCTION 172 |
| 159838 | #define TK_UPLUS 173 | 161619 | #define TK_UMINUS 173 |
| 159839 | #define TK_TRUTH 174 | 161620 | #define TK_UPLUS 174 |
| 159840 | #define TK_REGISTER 175 | 161621 | #define TK_TRUTH 175 |
| 159841 | #define TK_VECTOR 176 | 161622 | #define TK_REGISTER 176 |
| 159842 | #define TK_SELECT_COLUMN 177 | 161623 | #define TK_VECTOR 177 |
| 159843 | #define TK_IF_NULL_ROW 178 | 161624 | #define TK_SELECT_COLUMN 178 |
| 159844 | #define TK_ASTERISK 179 | 161625 | #define TK_IF_NULL_ROW 179 |
| 159845 | #define TK_SPAN 180 | 161626 | #define TK_ASTERISK 180 |
| 159846 | #define TK_ERROR 181 | 161627 | #define TK_SPAN 181 |
| 159847 | #define TK_SPACE 182 | 161628 | #define TK_ERROR 182 |
| 159848 | #define TK_ILLEGAL 183 | 161629 | #define TK_SPACE 183 |
| 161630 | #define TK_ILLEGAL 184 | ||
| 159849 | #endif | 161631 | #endif |
| 159850 | /**************** End token definitions ***************************************/ | 161632 | /**************** End token definitions ***************************************/ |
| 159851 | 161633 | ||
| @@ -159905,30 +161687,30 @@ static void updateDeleteLimitError( | |||
| 159905 | #endif | 161687 | #endif |
| 159906 | /************* Begin control #defines *****************************************/ | 161688 | /************* Begin control #defines *****************************************/ |
| 159907 | #define YYCODETYPE unsigned short int | 161689 | #define YYCODETYPE unsigned short int |
| 159908 | #define YYNOCODE 318 | 161690 | #define YYNOCODE 319 |
| 159909 | #define YYACTIONTYPE unsigned short int | 161691 | #define YYACTIONTYPE unsigned short int |
| 159910 | #define YYWILDCARD 101 | 161692 | #define YYWILDCARD 101 |
| 159911 | #define sqlite3ParserTOKENTYPE Token | 161693 | #define sqlite3ParserTOKENTYPE Token |
| 159912 | typedef union { | 161694 | typedef union { |
| 159913 | int yyinit; | 161695 | int yyinit; |
| 159914 | sqlite3ParserTOKENTYPE yy0; | 161696 | sqlite3ParserTOKENTYPE yy0; |
| 159915 | With* yy43; | 161697 | TriggerStep* yy33; |
| 159916 | u32 yy51; | 161698 | Window* yy41; |
| 159917 | int yy64; | 161699 | Select* yy47; |
| 159918 | struct FrameBound yy81; | 161700 | SrcList* yy131; |
| 159919 | struct {int value; int mask;} yy83; | 161701 | struct TrigEvent yy180; |
| 159920 | TriggerStep* yy95; | 161702 | struct {int value; int mask;} yy231; |
| 159921 | Upsert* yy138; | 161703 | IdList* yy254; |
| 159922 | IdList* yy240; | 161704 | u32 yy285; |
| 159923 | Cte* yy255; | 161705 | ExprList* yy322; |
| 159924 | Select* yy303; | 161706 | Cte* yy385; |
| 159925 | Window* yy375; | 161707 | int yy394; |
| 159926 | u8 yy534; | 161708 | Upsert* yy444; |
| 159927 | ExprList* yy562; | 161709 | u8 yy516; |
| 159928 | struct TrigEvent yy570; | 161710 | With* yy521; |
| 159929 | const char* yy600; | 161711 | const char* yy522; |
| 159930 | SrcList* yy607; | 161712 | Expr* yy528; |
| 159931 | Expr* yy626; | 161713 | struct FrameBound yy595; |
| 159932 | } YYMINORTYPE; | 161714 | } YYMINORTYPE; |
| 159933 | #ifndef YYSTACKDEPTH | 161715 | #ifndef YYSTACKDEPTH |
| 159934 | #define YYSTACKDEPTH 100 | 161716 | #define YYSTACKDEPTH 100 |
| @@ -159944,18 +161726,18 @@ typedef union { | |||
| 159944 | #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; | 161726 | #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; |
| 159945 | #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; | 161727 | #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; |
| 159946 | #define YYFALLBACK 1 | 161728 | #define YYFALLBACK 1 |
| 159947 | #define YYNSTATE 572 | 161729 | #define YYNSTATE 574 |
| 159948 | #define YYNRULE 401 | 161730 | #define YYNRULE 402 |
| 159949 | #define YYNRULE_WITH_ACTION 339 | 161731 | #define YYNRULE_WITH_ACTION 340 |
| 159950 | #define YYNTOKEN 184 | 161732 | #define YYNTOKEN 185 |
| 159951 | #define YY_MAX_SHIFT 571 | 161733 | #define YY_MAX_SHIFT 573 |
| 159952 | #define YY_MIN_SHIFTREDUCE 829 | 161734 | #define YY_MIN_SHIFTREDUCE 831 |
| 159953 | #define YY_MAX_SHIFTREDUCE 1229 | 161735 | #define YY_MAX_SHIFTREDUCE 1232 |
| 159954 | #define YY_ERROR_ACTION 1230 | 161736 | #define YY_ERROR_ACTION 1233 |
| 159955 | #define YY_ACCEPT_ACTION 1231 | 161737 | #define YY_ACCEPT_ACTION 1234 |
| 159956 | #define YY_NO_ACTION 1232 | 161738 | #define YY_NO_ACTION 1235 |
| 159957 | #define YY_MIN_REDUCE 1233 | 161739 | #define YY_MIN_REDUCE 1236 |
| 159958 | #define YY_MAX_REDUCE 1633 | 161740 | #define YY_MAX_REDUCE 1637 |
| 159959 | /************* End control #defines *******************************************/ | 161741 | /************* End control #defines *******************************************/ |
| 159960 | #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) | 161742 | #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) |
| 159961 | 161743 | ||
| @@ -160022,606 +161804,612 @@ typedef union { | |||
| 160022 | ** yy_default[] Default action for each state. | 161804 | ** yy_default[] Default action for each state. |
| 160023 | ** | 161805 | ** |
| 160024 | *********** Begin parsing tables **********************************************/ | 161806 | *********** Begin parsing tables **********************************************/ |
| 160025 | #define YY_ACTTAB_COUNT (2037) | 161807 | #define YY_ACTTAB_COUNT (2070) |
| 160026 | static const YYACTIONTYPE yy_action[] = { | 161808 | static const YYACTIONTYPE yy_action[] = { |
| 160027 | /* 0 */ 564, 115, 112, 220, 169, 199, 115, 112, 220, 564, | 161809 | /* 0 */ 566, 1307, 566, 1286, 201, 201, 566, 116, 112, 222, |
| 160028 | /* 10 */ 375, 1266, 564, 376, 564, 270, 1309, 1309, 406, 407, | 161810 | /* 10 */ 566, 1307, 377, 566, 116, 112, 222, 397, 408, 409, |
| 160029 | /* 20 */ 1084, 199, 1513, 41, 41, 515, 489, 521, 558, 558, | 161811 | /* 20 */ 1260, 378, 1269, 41, 41, 41, 41, 1412, 1517, 71, |
| 160030 | /* 30 */ 558, 965, 41, 41, 395, 41, 41, 51, 51, 966, | 161812 | /* 30 */ 71, 967, 1258, 41, 41, 491, 71, 71, 272, 968, |
| 160031 | /* 40 */ 296, 1269, 296, 122, 123, 113, 1207, 1207, 1041, 1044, | 161813 | /* 40 */ 298, 476, 298, 123, 124, 114, 1210, 1210, 1044, 1047, |
| 160032 | /* 50 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 564, 407, | 161814 | /* 50 */ 1036, 1036, 121, 121, 122, 122, 122, 122, 543, 409, |
| 160033 | /* 60 */ 275, 275, 275, 275, 1268, 115, 112, 220, 115, 112, | 161815 | /* 60 */ 1234, 1, 1, 573, 2, 1238, 548, 116, 112, 222, |
| 160034 | /* 70 */ 220, 1512, 846, 561, 516, 561, 115, 112, 220, 250, | 161816 | /* 70 */ 309, 480, 142, 548, 1272, 524, 116, 112, 222, 1320, |
| 160035 | /* 80 */ 217, 71, 71, 122, 123, 113, 1207, 1207, 1041, 1044, | 161817 | /* 80 */ 417, 523, 547, 123, 124, 114, 1210, 1210, 1044, 1047, |
| 160036 | /* 90 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 440, 440, | 161818 | /* 90 */ 1036, 1036, 121, 121, 122, 122, 122, 122, 424, 116, |
| 160037 | /* 100 */ 440, 1149, 119, 119, 119, 119, 118, 118, 117, 117, | 161819 | /* 100 */ 112, 222, 120, 120, 120, 120, 119, 119, 118, 118, |
| 160038 | /* 110 */ 117, 116, 442, 1183, 1149, 116, 442, 1149, 546, 513, | 161820 | /* 110 */ 118, 117, 113, 444, 277, 277, 277, 277, 560, 560, |
| 160039 | /* 120 */ 1548, 1554, 374, 442, 6, 1183, 1154, 522, 1154, 407, | 161821 | /* 120 */ 560, 1558, 376, 1560, 1186, 375, 1157, 563, 1157, 563, |
| 160040 | /* 130 */ 1556, 461, 373, 1554, 535, 99, 463, 332, 121, 121, | 161822 | /* 130 */ 409, 1558, 537, 252, 219, 1553, 99, 141, 449, 6, |
| 160041 | /* 140 */ 121, 121, 119, 119, 119, 119, 118, 118, 117, 117, | 161823 | /* 140 */ 365, 233, 120, 120, 120, 120, 119, 119, 118, 118, |
| 160042 | /* 150 */ 117, 116, 442, 122, 123, 113, 1207, 1207, 1041, 1044, | 161824 | /* 150 */ 118, 117, 113, 444, 123, 124, 114, 1210, 1210, 1044, |
| 160043 | /* 160 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 1257, 1183, | 161825 | /* 160 */ 1047, 1036, 1036, 121, 121, 122, 122, 122, 122, 138, |
| 160044 | /* 170 */ 1184, 1185, 243, 1064, 564, 502, 499, 498, 567, 124, | 161826 | /* 170 */ 289, 1186, 1546, 448, 118, 118, 118, 117, 113, 444, |
| 160045 | /* 180 */ 567, 1183, 1184, 1185, 474, 497, 119, 119, 119, 119, | 161827 | /* 180 */ 125, 1186, 1187, 1188, 144, 465, 334, 566, 150, 127, |
| 160046 | /* 190 */ 118, 118, 117, 117, 117, 116, 442, 70, 70, 407, | 161828 | /* 190 */ 444, 122, 122, 122, 122, 115, 120, 120, 120, 120, |
| 160047 | /* 200 */ 121, 121, 121, 121, 114, 117, 117, 117, 116, 442, | 161829 | /* 200 */ 119, 119, 118, 118, 118, 117, 113, 444, 454, 419, |
| 160048 | /* 210 */ 1409, 1469, 119, 119, 119, 119, 118, 118, 117, 117, | 161830 | /* 210 */ 13, 13, 215, 120, 120, 120, 120, 119, 119, 118, |
| 160049 | /* 220 */ 117, 116, 442, 122, 123, 113, 1207, 1207, 1041, 1044, | 161831 | /* 220 */ 118, 118, 117, 113, 444, 422, 308, 557, 1186, 1187, |
| 160050 | /* 230 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 407, 1031, | 161832 | /* 230 */ 1188, 441, 440, 409, 1271, 122, 122, 122, 122, 120, |
| 160051 | /* 240 */ 1031, 1042, 1045, 81, 382, 541, 378, 80, 119, 119, | 161833 | /* 240 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 113, |
| 160052 | /* 250 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 381, | 161834 | /* 250 */ 444, 1543, 98, 1033, 1033, 1045, 1048, 123, 124, 114, |
| 160053 | /* 260 */ 463, 332, 122, 123, 113, 1207, 1207, 1041, 1044, 1034, | 161835 | /* 260 */ 1210, 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, |
| 160054 | /* 270 */ 1034, 120, 120, 121, 121, 121, 121, 262, 215, 512, | 161836 | /* 270 */ 122, 122, 566, 406, 405, 1186, 566, 409, 1217, 319, |
| 160055 | /* 280 */ 1424, 422, 119, 119, 119, 119, 118, 118, 117, 117, | 161837 | /* 280 */ 1217, 80, 81, 120, 120, 120, 120, 119, 119, 118, |
| 160056 | /* 290 */ 117, 116, 442, 1231, 1, 1, 571, 2, 1235, 1573, | 161838 | /* 290 */ 118, 118, 117, 113, 444, 70, 70, 1186, 1604, 71, |
| 160057 | /* 300 */ 571, 2, 1235, 307, 1149, 141, 1600, 307, 407, 141, | 161839 | /* 300 */ 71, 123, 124, 114, 1210, 1210, 1044, 1047, 1036, 1036, |
| 160058 | /* 310 */ 1183, 361, 1317, 1035, 866, 531, 1317, 1149, 359, 1567, | 161840 | /* 310 */ 121, 121, 122, 122, 122, 122, 120, 120, 120, 120, |
| 160059 | /* 320 */ 1149, 119, 119, 119, 119, 118, 118, 117, 117, 117, | 161841 | /* 320 */ 119, 119, 118, 118, 118, 117, 113, 444, 1037, 210, |
| 160060 | /* 330 */ 116, 442, 122, 123, 113, 1207, 1207, 1041, 1044, 1034, | 161842 | /* 330 */ 1186, 365, 1186, 1187, 1188, 245, 548, 399, 504, 501, |
| 160061 | /* 340 */ 1034, 120, 120, 121, 121, 121, 121, 275, 275, 1001, | 161843 | /* 340 */ 500, 108, 558, 138, 4, 516, 933, 433, 499, 217, |
| 160062 | /* 350 */ 426, 275, 275, 1128, 1627, 1021, 1627, 137, 542, 1541, | 161844 | /* 350 */ 514, 522, 352, 879, 1186, 1187, 1188, 383, 561, 566, |
| 160063 | /* 360 */ 561, 272, 950, 950, 561, 1423, 1183, 1184, 1185, 1594, | 161845 | /* 360 */ 120, 120, 120, 120, 119, 119, 118, 118, 118, 117, |
| 160064 | /* 370 */ 866, 1012, 530, 315, 231, 1011, 468, 1276, 231, 119, | 161846 | /* 370 */ 113, 444, 277, 277, 16, 16, 1598, 441, 440, 153, |
| 160065 | /* 380 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442, | 161847 | /* 380 */ 409, 445, 13, 13, 1279, 563, 1214, 1186, 1187, 1188, |
| 160066 | /* 390 */ 1570, 119, 119, 119, 119, 118, 118, 117, 117, 117, | 161848 | /* 390 */ 1003, 1216, 264, 555, 1574, 186, 566, 427, 138, 1215, |
| 160067 | /* 400 */ 116, 442, 330, 359, 1567, 564, 446, 1011, 1011, 1013, | 161849 | /* 400 */ 308, 557, 472, 138, 123, 124, 114, 1210, 1210, 1044, |
| 160068 | /* 410 */ 446, 207, 564, 306, 555, 407, 363, 1021, 363, 346, | 161850 | /* 410 */ 1047, 1036, 1036, 121, 121, 122, 122, 122, 122, 55, |
| 160069 | /* 420 */ 184, 118, 118, 117, 117, 117, 116, 442, 71, 71, | 161851 | /* 420 */ 55, 413, 1023, 507, 1217, 1186, 1217, 474, 106, 106, |
| 160070 | /* 430 */ 439, 438, 1126, 1012, 472, 71, 71, 1011, 205, 122, | 161852 | /* 430 */ 1312, 1312, 1186, 171, 566, 384, 107, 380, 445, 568, |
| 160071 | /* 440 */ 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120, | 161853 | /* 440 */ 567, 430, 1543, 1013, 332, 549, 565, 263, 280, 360, |
| 160072 | /* 450 */ 121, 121, 121, 121, 219, 219, 472, 1183, 407, 570, | 161854 | /* 450 */ 510, 355, 509, 250, 491, 308, 557, 71, 71, 351, |
| 160073 | /* 460 */ 1183, 1235, 503, 1477, 149, 546, 307, 489, 141, 1011, | 161855 | /* 460 */ 308, 557, 374, 120, 120, 120, 120, 119, 119, 118, |
| 160074 | /* 470 */ 1011, 1013, 546, 140, 545, 1317, 1214, 191, 1214, 950, | 161856 | /* 470 */ 118, 118, 117, 113, 444, 1013, 1013, 1015, 1016, 27, |
| 160075 | /* 480 */ 950, 514, 122, 123, 113, 1207, 1207, 1041, 1044, 1034, | 161857 | /* 480 */ 277, 277, 1186, 1187, 1188, 1152, 566, 528, 409, 1186, |
| 160076 | /* 490 */ 1034, 120, 120, 121, 121, 121, 121, 563, 119, 119, | 161858 | /* 490 */ 1187, 1188, 348, 563, 548, 1260, 533, 517, 1152, 1516, |
| 160077 | /* 500 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 283, | 161859 | /* 500 */ 317, 1152, 285, 550, 485, 569, 566, 569, 482, 51, |
| 160078 | /* 510 */ 275, 275, 415, 1183, 1184, 1185, 1183, 1184, 1185, 372, | 161860 | /* 510 */ 51, 207, 123, 124, 114, 1210, 1210, 1044, 1047, 1036, |
| 160079 | /* 520 */ 1183, 243, 344, 561, 502, 499, 498, 1539, 407, 1540, | 161861 | /* 520 */ 1036, 121, 121, 122, 122, 122, 122, 171, 1412, 13, |
| 160080 | /* 530 */ 1183, 288, 870, 143, 497, 1549, 185, 231, 9, 6, | 161862 | /* 530 */ 13, 409, 277, 277, 1186, 505, 119, 119, 118, 118, |
| 160081 | /* 540 */ 253, 119, 119, 119, 119, 118, 118, 117, 117, 117, | 161863 | /* 540 */ 118, 117, 113, 444, 429, 563, 518, 220, 515, 1552, |
| 160082 | /* 550 */ 116, 442, 122, 123, 113, 1207, 1207, 1041, 1044, 1034, | 161864 | /* 550 */ 365, 546, 1186, 6, 532, 123, 124, 114, 1210, 1210, |
| 160083 | /* 560 */ 1034, 120, 120, 121, 121, 121, 121, 407, 137, 446, | 161865 | /* 560 */ 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, 122, |
| 160084 | /* 570 */ 447, 863, 169, 1183, 397, 1204, 1183, 1184, 1185, 931, | 161866 | /* 570 */ 145, 120, 120, 120, 120, 119, 119, 118, 118, 118, |
| 160085 | /* 580 */ 526, 1001, 98, 339, 564, 342, 1183, 1184, 1185, 306, | 161867 | /* 580 */ 117, 113, 444, 245, 566, 474, 504, 501, 500, 566, |
| 160086 | /* 590 */ 555, 122, 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, | 161868 | /* 590 */ 1481, 1186, 1187, 1188, 1310, 1310, 499, 1186, 149, 425, |
| 160087 | /* 600 */ 120, 120, 121, 121, 121, 121, 452, 71, 71, 275, | 161869 | /* 600 */ 1186, 480, 409, 274, 365, 952, 872, 56, 56, 1186, |
| 160088 | /* 610 */ 275, 119, 119, 119, 119, 118, 118, 117, 117, 117, | 161870 | /* 610 */ 1187, 1188, 71, 71, 120, 120, 120, 120, 119, 119, |
| 160089 | /* 620 */ 116, 442, 561, 417, 306, 555, 1183, 1307, 1307, 1183, | 161871 | /* 620 */ 118, 118, 118, 117, 113, 444, 123, 124, 114, 1210, |
| 160090 | /* 630 */ 1184, 1185, 1204, 1149, 330, 458, 318, 407, 363, 470, | 161872 | /* 630 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, |
| 160091 | /* 640 */ 431, 1167, 32, 541, 527, 350, 1149, 1629, 393, 1149, | 161873 | /* 640 */ 122, 409, 541, 1552, 83, 865, 98, 6, 928, 529, |
| 160092 | /* 650 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116, | 161874 | /* 650 */ 848, 543, 151, 927, 1186, 1187, 1188, 1186, 1187, 1188, |
| 160093 | /* 660 */ 442, 122, 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, | 161875 | /* 660 */ 290, 1543, 187, 1633, 395, 123, 124, 114, 1210, 1210, |
| 160094 | /* 670 */ 120, 120, 121, 121, 121, 121, 407, 199, 472, 1183, | 161876 | /* 670 */ 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, 122, |
| 160095 | /* 680 */ 1022, 472, 1183, 1184, 1185, 386, 151, 539, 1548, 277, | 161877 | /* 680 */ 566, 954, 566, 453, 953, 120, 120, 120, 120, 119, |
| 160096 | /* 690 */ 400, 137, 6, 317, 5, 564, 562, 3, 920, 920, | 161878 | /* 690 */ 119, 118, 118, 118, 117, 113, 444, 1152, 221, 1186, |
| 160097 | /* 700 */ 122, 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, | 161879 | /* 700 */ 331, 453, 452, 13, 13, 13, 13, 1003, 365, 463, |
| 160098 | /* 710 */ 120, 121, 121, 121, 121, 411, 505, 83, 71, 71, | 161880 | /* 710 */ 1152, 193, 409, 1152, 382, 1543, 1170, 32, 297, 474, |
| 160099 | /* 720 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116, | 161881 | /* 720 */ 195, 1527, 5, 952, 120, 120, 120, 120, 119, 119, |
| 160100 | /* 730 */ 442, 1183, 218, 428, 1183, 1183, 1184, 1185, 363, 261, | 161882 | /* 730 */ 118, 118, 118, 117, 113, 444, 123, 124, 114, 1210, |
| 160101 | /* 740 */ 278, 358, 508, 353, 507, 248, 407, 306, 555, 1539, | 161883 | /* 740 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, |
| 160102 | /* 750 */ 1006, 349, 363, 291, 489, 302, 293, 1542, 281, 119, | 161884 | /* 750 */ 122, 409, 1067, 419, 1186, 1024, 1186, 1187, 1188, 1186, |
| 160103 | /* 760 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442, | 161885 | /* 760 */ 419, 332, 460, 320, 544, 1545, 442, 442, 442, 566, |
| 160104 | /* 770 */ 122, 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, | 161886 | /* 770 */ 3, 117, 113, 444, 453, 123, 124, 114, 1210, 1210, |
| 160105 | /* 780 */ 120, 121, 121, 121, 121, 407, 148, 1183, 1184, 1185, | 161887 | /* 780 */ 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, 122, |
| 160106 | /* 790 */ 1183, 1184, 1185, 275, 275, 1304, 1257, 1283, 483, 1476, | 161888 | /* 790 */ 1473, 566, 15, 15, 293, 120, 120, 120, 120, 119, |
| 160107 | /* 800 */ 150, 489, 480, 564, 1187, 1304, 561, 1587, 1255, 122, | 161889 | /* 800 */ 119, 118, 118, 118, 117, 113, 444, 1186, 566, 1486, |
| 160108 | /* 810 */ 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120, | 161890 | /* 810 */ 1412, 1186, 1187, 1188, 13, 13, 1186, 1187, 1188, 1544, |
| 160109 | /* 820 */ 121, 121, 121, 121, 564, 886, 13, 13, 520, 119, | 161891 | /* 820 */ 271, 271, 409, 286, 308, 557, 1008, 1486, 1488, 196, |
| 160110 | /* 830 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 442, | 161892 | /* 830 */ 288, 71, 71, 563, 120, 120, 120, 120, 119, 119, |
| 160111 | /* 840 */ 1183, 420, 417, 564, 269, 269, 1316, 13, 13, 1539, | 161893 | /* 840 */ 118, 118, 118, 117, 113, 444, 123, 124, 114, 1210, |
| 160112 | /* 850 */ 1546, 16, 16, 322, 6, 407, 506, 561, 1089, 1089, | 161894 | /* 850 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, |
| 160113 | /* 860 */ 486, 1187, 425, 1539, 887, 292, 71, 71, 119, 119, | 161895 | /* 860 */ 122, 409, 201, 1087, 1186, 1187, 1188, 1324, 304, 1529, |
| 160114 | /* 870 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 122, | 161896 | /* 870 */ 388, 278, 278, 450, 564, 402, 922, 922, 566, 563, |
| 160115 | /* 880 */ 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120, | 161897 | /* 880 */ 566, 426, 491, 480, 563, 123, 124, 114, 1210, 1210, |
| 160116 | /* 890 */ 121, 121, 121, 121, 564, 12, 1183, 1184, 1185, 407, | 161898 | /* 890 */ 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, 122, |
| 160117 | /* 900 */ 275, 275, 451, 303, 834, 835, 836, 417, 489, 276, | 161899 | /* 900 */ 1486, 71, 71, 13, 13, 120, 120, 120, 120, 119, |
| 160118 | /* 910 */ 276, 1547, 284, 561, 319, 6, 321, 71, 71, 429, | 161900 | /* 910 */ 119, 118, 118, 118, 117, 113, 444, 566, 545, 566, |
| 160119 | /* 920 */ 451, 450, 561, 952, 101, 113, 1207, 1207, 1041, 1044, | 161901 | /* 920 */ 1577, 573, 2, 1238, 1092, 1092, 488, 1480, 309, 1525, |
| 160120 | /* 930 */ 1034, 1034, 120, 120, 121, 121, 121, 121, 119, 119, | 161902 | /* 930 */ 142, 324, 409, 836, 837, 838, 312, 1320, 305, 363, |
| 160121 | /* 940 */ 119, 119, 118, 118, 117, 117, 117, 116, 442, 1105, | 161903 | /* 940 */ 43, 43, 57, 57, 120, 120, 120, 120, 119, 119, |
| 160122 | /* 950 */ 1183, 489, 564, 1312, 437, 455, 478, 564, 246, 245, | 161904 | /* 950 */ 118, 118, 118, 117, 113, 444, 123, 124, 114, 1210, |
| 160123 | /* 960 */ 244, 1409, 1545, 547, 1106, 405, 6, 1544, 196, 1258, | 161905 | /* 960 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, |
| 160124 | /* 970 */ 413, 6, 105, 462, 103, 71, 71, 286, 564, 1107, | 161906 | /* 970 */ 122, 12, 277, 277, 566, 1152, 409, 572, 428, 1238, |
| 160125 | /* 980 */ 13, 13, 119, 119, 119, 119, 118, 118, 117, 117, | 161907 | /* 980 */ 465, 334, 296, 474, 309, 563, 142, 249, 1152, 308, |
| 160126 | /* 990 */ 117, 116, 442, 451, 104, 427, 337, 320, 275, 275, | 161908 | /* 990 */ 557, 1152, 321, 1320, 323, 491, 455, 71, 71, 233, |
| 160127 | /* 1000 */ 906, 13, 13, 564, 1482, 1105, 1183, 1184, 1185, 126, | 161909 | /* 1000 */ 283, 101, 114, 1210, 1210, 1044, 1047, 1036, 1036, 121, |
| 160128 | /* 1010 */ 907, 561, 546, 564, 407, 478, 295, 1321, 253, 200, | 161910 | /* 1010 */ 121, 122, 122, 122, 122, 120, 120, 120, 120, 119, |
| 160129 | /* 1020 */ 1106, 548, 1482, 1484, 280, 1409, 55, 55, 1287, 561, | 161911 | /* 1020 */ 119, 118, 118, 118, 117, 113, 444, 1108, 277, 277, |
| 160130 | /* 1030 */ 478, 380, 423, 951, 407, 1107, 71, 71, 122, 123, | 161912 | /* 1030 */ 1412, 448, 394, 1230, 439, 277, 277, 248, 247, 246, |
| 160131 | /* 1040 */ 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120, 121, | 161913 | /* 1040 */ 1319, 563, 1109, 313, 198, 294, 491, 1318, 563, 464, |
| 160132 | /* 1050 */ 121, 121, 121, 1204, 407, 287, 552, 309, 122, 123, | 161914 | /* 1050 */ 566, 1427, 394, 1130, 1023, 233, 414, 1110, 295, 120, |
| 160133 | /* 1060 */ 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120, 121, | 161915 | /* 1060 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 113, |
| 160134 | /* 1070 */ 121, 121, 121, 441, 1128, 1628, 146, 1628, 122, 111, | 161916 | /* 1070 */ 444, 1014, 104, 71, 71, 1013, 322, 496, 908, 566, |
| 160135 | /* 1080 */ 113, 1207, 1207, 1041, 1044, 1034, 1034, 120, 120, 121, | 161917 | /* 1080 */ 277, 277, 277, 277, 1108, 1261, 415, 448, 909, 361, |
| 160136 | /* 1090 */ 121, 121, 121, 404, 403, 1482, 424, 119, 119, 119, | 161918 | /* 1090 */ 1571, 1315, 409, 563, 952, 563, 9, 202, 255, 1109, |
| 160137 | /* 1100 */ 119, 118, 118, 117, 117, 117, 116, 442, 1183, 564, | 161919 | /* 1100 */ 316, 487, 44, 44, 249, 559, 415, 1013, 1013, 1015, |
| 160138 | /* 1110 */ 1204, 544, 1086, 858, 329, 361, 1086, 119, 119, 119, | 161920 | /* 1110 */ 443, 1231, 409, 1603, 1110, 897, 123, 124, 114, 1210, |
| 160139 | /* 1120 */ 119, 118, 118, 117, 117, 117, 116, 442, 564, 294, | 161921 | /* 1120 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, |
| 160140 | /* 1130 */ 144, 523, 56, 56, 224, 564, 510, 119, 119, 119, | 161922 | /* 1130 */ 122, 1231, 409, 1207, 215, 554, 123, 124, 114, 1210, |
| 160141 | /* 1140 */ 119, 118, 118, 117, 117, 117, 116, 442, 484, 1409, | 161923 | /* 1140 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, |
| 160142 | /* 1150 */ 537, 15, 15, 1126, 434, 439, 438, 407, 13, 13, | 161924 | /* 1150 */ 122, 1131, 1631, 470, 1631, 255, 123, 111, 114, 1210, |
| 160143 | /* 1160 */ 1523, 12, 926, 1211, 1183, 1184, 1185, 925, 1213, 536, | 161925 | /* 1160 */ 1210, 1044, 1047, 1036, 1036, 121, 121, 122, 122, 122, |
| 160144 | /* 1170 */ 858, 557, 413, 193, 1525, 494, 1212, 448, 1160, 1222, | 161926 | /* 1170 */ 122, 1131, 1632, 414, 1632, 120, 120, 120, 120, 119, |
| 160145 | /* 1180 */ 1183, 564, 123, 113, 1207, 1207, 1041, 1044, 1034, 1034, | 161927 | /* 1180 */ 119, 118, 118, 118, 117, 113, 444, 221, 209, 351, |
| 160146 | /* 1190 */ 120, 120, 121, 121, 121, 121, 1521, 1149, 564, 965, | 161928 | /* 1190 */ 1207, 1207, 147, 1426, 491, 120, 120, 120, 120, 119, |
| 160147 | /* 1200 */ 564, 1214, 247, 1214, 13, 13, 1409, 966, 538, 564, | 161929 | /* 1200 */ 119, 118, 118, 118, 117, 113, 444, 1256, 539, 519, |
| 160148 | /* 1210 */ 1149, 108, 556, 1149, 4, 310, 392, 1227, 17, 194, | 161930 | /* 1210 */ 888, 551, 952, 12, 566, 120, 120, 120, 120, 119, |
| 160149 | /* 1220 */ 485, 43, 43, 57, 57, 306, 555, 524, 559, 1160, | 161931 | /* 1220 */ 119, 118, 118, 118, 117, 113, 444, 538, 566, 860, |
| 160150 | /* 1230 */ 464, 564, 44, 44, 392, 1127, 1183, 1184, 1185, 479, | 161932 | /* 1230 */ 1129, 361, 1571, 346, 1356, 409, 1163, 58, 58, 339, |
| 160151 | /* 1240 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116, | 161933 | /* 1240 */ 1355, 508, 277, 277, 277, 277, 277, 277, 1207, 889, |
| 160152 | /* 1250 */ 442, 443, 564, 327, 13, 13, 564, 418, 1315, 414, | 161934 | /* 1250 */ 1129, 59, 59, 459, 363, 563, 566, 563, 96, 563, |
| 160153 | /* 1260 */ 171, 564, 311, 553, 213, 529, 1253, 564, 517, 543, | 161935 | /* 1260 */ 124, 114, 1210, 1210, 1044, 1047, 1036, 1036, 121, 121, |
| 160154 | /* 1270 */ 412, 108, 556, 137, 4, 58, 58, 435, 314, 59, | 161936 | /* 1270 */ 122, 122, 122, 122, 566, 1412, 566, 281, 1186, 60, |
| 160155 | /* 1280 */ 59, 274, 217, 549, 60, 60, 349, 476, 559, 1353, | 161937 | /* 1280 */ 60, 110, 392, 392, 391, 266, 389, 860, 1163, 845, |
| 160156 | /* 1290 */ 61, 61, 1021, 275, 275, 1228, 213, 564, 106, 106, | 161938 | /* 1290 */ 566, 481, 566, 436, 341, 1152, 344, 61, 61, 62, |
| 160157 | /* 1300 */ 8, 275, 275, 275, 275, 107, 561, 443, 566, 565, | 161939 | /* 1300 */ 62, 967, 227, 1550, 315, 431, 540, 6, 1152, 968, |
| 160158 | /* 1310 */ 564, 443, 1011, 1228, 561, 564, 561, 564, 275, 275, | 161940 | /* 1310 */ 566, 1152, 314, 45, 45, 46, 46, 512, 120, 120, |
| 160159 | /* 1320 */ 62, 62, 1352, 553, 247, 456, 564, 98, 110, 306, | 161941 | /* 1320 */ 120, 120, 119, 119, 118, 118, 118, 117, 113, 444, |
| 160160 | /* 1330 */ 555, 561, 564, 45, 45, 405, 1203, 533, 46, 46, | 161942 | /* 1330 */ 416, 173, 1532, 47, 47, 1186, 1187, 1188, 108, 558, |
| 160161 | /* 1340 */ 47, 47, 532, 465, 1011, 1011, 1013, 1014, 27, 49, | 161943 | /* 1340 */ 325, 4, 229, 1551, 928, 566, 437, 6, 566, 927, |
| 160162 | /* 1350 */ 49, 564, 1021, 405, 469, 50, 50, 564, 106, 106, | 161944 | /* 1350 */ 164, 566, 1290, 137, 1190, 561, 566, 1549, 566, 1089, |
| 160163 | /* 1360 */ 305, 564, 84, 204, 405, 107, 564, 443, 566, 565, | 161945 | /* 1360 */ 566, 6, 566, 1089, 531, 566, 868, 8, 49, 49, |
| 160164 | /* 1370 */ 405, 564, 1011, 564, 63, 63, 564, 1599, 564, 895, | 161946 | /* 1370 */ 228, 50, 50, 566, 63, 63, 566, 457, 445, 64, |
| 160165 | /* 1380 */ 64, 64, 457, 477, 65, 65, 147, 96, 38, 14, | 161947 | /* 1380 */ 64, 65, 65, 14, 14, 66, 66, 407, 129, 129, |
| 160166 | /* 1390 */ 14, 1528, 412, 564, 66, 66, 128, 128, 926, 67, | 161948 | /* 1390 */ 555, 566, 458, 566, 1505, 486, 67, 67, 566, 52, |
| 160167 | /* 1400 */ 67, 52, 52, 925, 1011, 1011, 1013, 1014, 27, 1572, | 161949 | /* 1400 */ 52, 546, 407, 467, 535, 410, 226, 1023, 566, 534, |
| 160168 | /* 1410 */ 1171, 445, 208, 1123, 279, 394, 68, 68, 228, 390, | 161950 | /* 1410 */ 308, 557, 1190, 407, 68, 68, 69, 69, 566, 1023, |
| 160169 | /* 1420 */ 390, 389, 264, 387, 1171, 445, 843, 877, 279, 108, | 161951 | /* 1420 */ 566, 53, 53, 868, 1014, 106, 106, 525, 1013, 566, |
| 160170 | /* 1430 */ 556, 453, 4, 390, 390, 389, 264, 387, 564, 225, | 161952 | /* 1430 */ 1504, 159, 159, 107, 451, 445, 568, 567, 471, 307, |
| 160171 | /* 1440 */ 843, 313, 328, 1003, 98, 252, 559, 544, 471, 312, | 161953 | /* 1440 */ 1013, 160, 160, 76, 76, 566, 1548, 466, 407, 407, |
| 160172 | /* 1450 */ 252, 564, 208, 225, 564, 313, 473, 30, 252, 279, | 161954 | /* 1450 */ 6, 1225, 54, 54, 478, 276, 219, 566, 887, 886, |
| 160173 | /* 1460 */ 466, 69, 69, 312, 390, 390, 389, 264, 387, 443, | 161955 | /* 1460 */ 1013, 1013, 1015, 84, 206, 1206, 230, 282, 72, 72, |
| 160174 | /* 1470 */ 333, 843, 98, 564, 53, 53, 323, 157, 157, 227, | 161956 | /* 1470 */ 329, 483, 1013, 1013, 1015, 1016, 27, 1576, 1174, 447, |
| 160175 | /* 1480 */ 495, 553, 249, 289, 225, 564, 313, 162, 31, 1501, | 161957 | /* 1480 */ 130, 130, 281, 148, 105, 38, 103, 392, 392, 391, |
| 160176 | /* 1490 */ 135, 564, 1500, 227, 312, 533, 158, 158, 885, 884, | 161958 | /* 1490 */ 266, 389, 566, 1126, 845, 396, 566, 108, 558, 566, |
| 160177 | /* 1500 */ 534, 162, 873, 301, 135, 564, 481, 226, 76, 76, | 161959 | /* 1500 */ 4, 311, 566, 30, 17, 566, 279, 227, 566, 315, |
| 160178 | /* 1510 */ 1021, 347, 1071, 98, 54, 54, 106, 106, 1067, 564, | 161960 | /* 1510 */ 108, 558, 468, 4, 561, 73, 73, 314, 566, 157, |
| 160179 | /* 1520 */ 249, 226, 519, 107, 227, 443, 566, 565, 72, 72, | 161961 | /* 1520 */ 157, 566, 131, 131, 526, 132, 132, 561, 128, 128, |
| 160180 | /* 1530 */ 1011, 334, 162, 564, 230, 135, 108, 556, 959, 4, | 161962 | /* 1530 */ 566, 158, 158, 566, 31, 291, 566, 445, 330, 521, |
| 160181 | /* 1540 */ 252, 408, 129, 129, 564, 1349, 306, 555, 564, 923, | 161963 | /* 1540 */ 98, 152, 152, 420, 136, 136, 1005, 229, 254, 555, |
| 160182 | /* 1550 */ 564, 110, 226, 559, 564, 408, 73, 73, 564, 873, | 161964 | /* 1550 */ 445, 479, 336, 135, 135, 164, 133, 133, 137, 134, |
| 160183 | /* 1560 */ 306, 555, 1011, 1011, 1013, 1014, 27, 130, 130, 1071, | 161965 | /* 1560 */ 134, 875, 555, 535, 566, 473, 566, 254, 536, 475, |
| 160184 | /* 1570 */ 449, 131, 131, 127, 127, 357, 443, 156, 156, 892, | 161966 | /* 1570 */ 335, 254, 98, 894, 895, 228, 535, 566, 1023, 566, |
| 160185 | /* 1580 */ 893, 155, 155, 338, 449, 356, 408, 564, 553, 968, | 161967 | /* 1580 */ 1074, 534, 210, 232, 106, 106, 1352, 75, 75, 77, |
| 160186 | /* 1590 */ 969, 306, 555, 1015, 341, 564, 108, 556, 564, 4, | 161968 | /* 1590 */ 77, 1023, 107, 340, 445, 568, 567, 106, 106, 1013, |
| 160187 | /* 1600 */ 1132, 1286, 533, 564, 856, 343, 145, 532, 345, 1300, | 161969 | /* 1600 */ 74, 74, 42, 42, 566, 107, 343, 445, 568, 567, |
| 160188 | /* 1610 */ 136, 136, 1083, 559, 1083, 449, 564, 1021, 134, 134, | 161970 | /* 1610 */ 410, 497, 1013, 251, 359, 308, 557, 1135, 349, 875, |
| 160189 | /* 1620 */ 1284, 132, 132, 106, 106, 1285, 133, 133, 564, 352, | 161971 | /* 1620 */ 98, 1070, 345, 251, 358, 1591, 347, 48, 48, 1017, |
| 160190 | /* 1630 */ 107, 564, 443, 566, 565, 1340, 443, 1011, 362, 75, | 161972 | /* 1630 */ 1303, 1013, 1013, 1015, 1016, 27, 1289, 1287, 1074, 451, |
| 160191 | /* 1640 */ 75, 1082, 564, 1082, 564, 924, 1561, 110, 553, 551, | 161973 | /* 1640 */ 961, 925, 254, 110, 1013, 1013, 1015, 1016, 27, 1174, |
| 160192 | /* 1650 */ 1015, 77, 77, 1361, 74, 74, 1408, 1336, 1347, 550, | 161974 | /* 1650 */ 447, 970, 971, 281, 108, 558, 1288, 4, 392, 392, |
| 160193 | /* 1660 */ 1414, 1265, 1256, 1244, 1243, 42, 42, 48, 48, 1011, | 161975 | /* 1660 */ 391, 266, 389, 1343, 1086, 845, 1086, 1085, 858, 1085, |
| 160194 | /* 1670 */ 1011, 1013, 1014, 27, 1245, 1580, 490, 1021, 267, 202, | 161976 | /* 1670 */ 146, 561, 926, 354, 110, 303, 364, 553, 227, 1364, |
| 160195 | /* 1680 */ 1333, 365, 11, 106, 106, 930, 367, 210, 369, 391, | 161977 | /* 1680 */ 315, 108, 558, 1411, 4, 1339, 492, 1017, 314, 1350, |
| 160196 | /* 1690 */ 107, 1395, 443, 566, 565, 223, 1390, 1011, 500, 454, | 161978 | /* 1690 */ 1565, 552, 1417, 1268, 445, 204, 1259, 1247, 561, 1246, |
| 160197 | /* 1700 */ 282, 1400, 285, 108, 556, 214, 4, 325, 1383, 1283, | 161979 | /* 1700 */ 1248, 1584, 269, 1336, 367, 369, 555, 371, 11, 212, |
| 160198 | /* 1710 */ 475, 355, 1473, 1583, 1472, 1399, 371, 1222, 326, 398, | 161980 | /* 1710 */ 393, 225, 1393, 284, 1398, 456, 287, 327, 229, 328, |
| 160199 | /* 1720 */ 559, 290, 331, 197, 100, 556, 209, 4, 198, 1011, | 161981 | /* 1720 */ 292, 445, 1386, 216, 333, 1403, 164, 477, 373, 137, |
| 160200 | /* 1730 */ 1011, 1013, 1014, 27, 385, 256, 1520, 1518, 554, 1219, | 161982 | /* 1730 */ 1402, 400, 502, 555, 1286, 1023, 357, 1477, 199, 1587, |
| 160201 | /* 1740 */ 416, 559, 83, 443, 173, 206, 182, 221, 459, 167, | 161983 | /* 1740 */ 211, 106, 106, 932, 1476, 1225, 228, 556, 175, 107, |
| 160202 | /* 1750 */ 177, 460, 175, 493, 233, 553, 79, 178, 1396, 179, | 161984 | /* 1750 */ 200, 445, 568, 567, 258, 387, 1013, 1524, 1522, 223, |
| 160203 | /* 1760 */ 35, 180, 96, 1402, 443, 396, 36, 467, 1478, 1401, | 161985 | /* 1760 */ 1222, 418, 1023, 83, 208, 79, 82, 184, 106, 106, |
| 160204 | /* 1770 */ 482, 237, 1404, 399, 82, 186, 553, 1467, 89, 488, | 161986 | /* 1770 */ 1482, 169, 177, 461, 179, 462, 107, 1399, 445, 568, |
| 160205 | /* 1780 */ 190, 268, 239, 491, 1021, 340, 240, 401, 1246, 1489, | 161987 | /* 1780 */ 567, 410, 180, 1013, 495, 181, 308, 557, 1013, 1013, |
| 160206 | /* 1790 */ 106, 106, 336, 509, 1294, 241, 1303, 107, 430, 443, | 161988 | /* 1790 */ 1015, 1016, 27, 182, 35, 235, 100, 558, 398, 4, |
| 160207 | /* 1800 */ 566, 565, 1302, 91, 1011, 1021, 1598, 1301, 1273, 215, | 161989 | /* 1800 */ 96, 1405, 1404, 36, 484, 469, 1407, 188, 401, 1471, |
| 160208 | /* 1810 */ 1597, 106, 106, 402, 877, 432, 354, 1272, 107, 1271, | 161990 | /* 1810 */ 451, 89, 1493, 561, 239, 1013, 1013, 1015, 1016, 27, |
| 160209 | /* 1820 */ 443, 566, 565, 1596, 1566, 1011, 1293, 433, 518, 299, | 161991 | /* 1820 */ 490, 338, 270, 241, 192, 342, 493, 242, 403, 1249, |
| 160210 | /* 1830 */ 300, 360, 95, 525, 1344, 364, 1011, 1011, 1013, 1014, | 161992 | /* 1830 */ 243, 511, 432, 1297, 1306, 91, 445, 1305, 1304, 879, |
| 160211 | /* 1840 */ 27, 254, 255, 1552, 436, 1551, 125, 544, 10, 379, | 161993 | /* 1840 */ 217, 434, 435, 1570, 1276, 1602, 520, 1601, 555, 301, |
| 160212 | /* 1850 */ 1326, 1453, 102, 97, 1345, 528, 304, 1011, 1011, 1013, | 161994 | /* 1850 */ 527, 404, 1275, 302, 356, 1274, 1600, 95, 1347, 366, |
| 160213 | /* 1860 */ 1014, 27, 366, 377, 1343, 1342, 368, 370, 1325, 384, | 161995 | /* 1860 */ 1296, 362, 1348, 368, 256, 257, 1556, 1555, 438, 1346, |
| 160214 | /* 1870 */ 201, 383, 34, 1368, 1367, 568, 1177, 266, 263, 265, | 161996 | /* 1870 */ 370, 126, 1345, 10, 1371, 546, 381, 1023, 102, 1457, |
| 160215 | /* 1880 */ 1505, 159, 569, 1241, 1236, 1506, 160, 142, 1504, 1503, | 161997 | /* 1880 */ 97, 530, 34, 106, 106, 570, 1180, 372, 265, 1329, |
| 160216 | /* 1890 */ 297, 211, 830, 161, 212, 78, 444, 203, 308, 222, | 161998 | /* 1890 */ 379, 107, 203, 445, 568, 567, 1328, 385, 1013, 1370, |
| 160217 | /* 1900 */ 1081, 139, 1079, 316, 174, 163, 1203, 229, 176, 909, | 161999 | /* 1900 */ 386, 267, 268, 571, 1244, 161, 1239, 162, 1509, 1510, |
| 160218 | /* 1910 */ 324, 232, 1095, 181, 409, 410, 172, 164, 165, 419, | 162000 | /* 1910 */ 1508, 143, 1507, 299, 832, 213, 214, 78, 446, 205, |
| 160219 | /* 1920 */ 183, 85, 86, 421, 166, 87, 88, 1098, 1094, 234, | 162001 | /* 1920 */ 310, 306, 163, 224, 1084, 140, 1082, 318, 165, 176, |
| 160220 | /* 1930 */ 235, 152, 18, 236, 335, 1087, 1216, 252, 187, 487, | 162002 | /* 1930 */ 1013, 1013, 1015, 1016, 27, 178, 1206, 231, 911, 234, |
| 160221 | /* 1940 */ 238, 188, 37, 845, 492, 356, 242, 496, 351, 501, | 162003 | /* 1940 */ 326, 1098, 183, 421, 166, 167, 411, 185, 85, 423, |
| 160222 | /* 1950 */ 189, 90, 19, 504, 348, 20, 875, 92, 298, 168, | 162004 | /* 1950 */ 412, 86, 174, 87, 168, 88, 1101, 236, 1097, 237, |
| 160223 | /* 1960 */ 888, 153, 93, 511, 94, 1165, 154, 1047, 1134, 39, | 162005 | /* 1960 */ 154, 18, 238, 254, 337, 1219, 489, 1090, 240, 190, |
| 160224 | /* 1970 */ 216, 1133, 271, 273, 958, 192, 953, 110, 1151, 1155, | 162006 | /* 1970 */ 37, 847, 189, 494, 358, 244, 350, 506, 191, 877, |
| 160225 | /* 1980 */ 251, 7, 21, 1159, 1139, 22, 1153, 33, 23, 24, | 162007 | /* 1980 */ 90, 498, 19, 20, 503, 92, 353, 890, 300, 170, |
| 160226 | /* 1990 */ 25, 540, 1158, 195, 98, 1062, 26, 1048, 1046, 1050, | 162008 | /* 1990 */ 155, 93, 513, 94, 1168, 156, 1050, 1137, 39, 218, |
| 160227 | /* 2000 */ 1104, 1051, 1103, 257, 258, 28, 40, 1173, 1016, 857, | 162009 | /* 2000 */ 273, 275, 1136, 960, 194, 955, 110, 1154, 1158, 253, |
| 160228 | /* 2010 */ 109, 29, 560, 388, 138, 1172, 259, 170, 260, 1232, | 162010 | /* 2010 */ 7, 1162, 1156, 21, 22, 1161, 1142, 23, 24, 25, |
| 160229 | /* 2020 */ 1232, 919, 1232, 1232, 1232, 1232, 1232, 1232, 1232, 1232, | 162011 | /* 2020 */ 33, 542, 26, 260, 197, 98, 1065, 1051, 1049, 1053, |
| 160230 | /* 2030 */ 1232, 1232, 1589, 1232, 1232, 1232, 1588, | 162012 | /* 2030 */ 1107, 1054, 1106, 259, 28, 40, 562, 1018, 859, 109, |
| 162013 | /* 2040 */ 29, 921, 390, 1176, 172, 139, 1175, 1235, 261, 1235, | ||
| 162014 | /* 2050 */ 1235, 1235, 1235, 1235, 1235, 1235, 1235, 262, 1235, 1235, | ||
| 162015 | /* 2060 */ 1235, 1235, 1235, 1235, 1235, 1235, 1235, 1235, 1593, 1592, | ||
| 160231 | }; | 162016 | }; |
| 160232 | static const YYCODETYPE yy_lookahead[] = { | 162017 | static const YYCODETYPE yy_lookahead[] = { |
| 160233 | /* 0 */ 192, 273, 274, 275, 192, 192, 273, 274, 275, 192, | 162018 | /* 0 */ 193, 223, 193, 225, 193, 193, 193, 274, 275, 276, |
| 160234 | /* 10 */ 218, 215, 192, 218, 192, 212, 234, 235, 205, 19, | 162019 | /* 10 */ 193, 233, 219, 193, 274, 275, 276, 206, 206, 19, |
| 160235 | /* 20 */ 11, 192, 294, 215, 216, 203, 192, 203, 209, 210, | 162020 | /* 20 */ 193, 219, 216, 216, 217, 216, 217, 193, 295, 216, |
| 160236 | /* 30 */ 211, 31, 215, 216, 205, 215, 216, 215, 216, 39, | 162021 | /* 30 */ 217, 31, 205, 216, 217, 193, 216, 217, 213, 39, |
| 160237 | /* 40 */ 227, 215, 229, 43, 44, 45, 46, 47, 48, 49, | 162022 | /* 40 */ 228, 193, 230, 43, 44, 45, 46, 47, 48, 49, |
| 160238 | /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 192, 19, | 162023 | /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 193, 19, |
| 160239 | /* 60 */ 238, 239, 238, 239, 215, 273, 274, 275, 273, 274, | 162024 | /* 60 */ 185, 186, 187, 188, 189, 190, 253, 274, 275, 276, |
| 160240 | /* 70 */ 275, 237, 21, 251, 252, 251, 273, 274, 275, 255, | 162025 | /* 70 */ 195, 193, 197, 253, 216, 262, 274, 275, 276, 204, |
| 160241 | /* 80 */ 256, 215, 216, 43, 44, 45, 46, 47, 48, 49, | 162026 | /* 80 */ 238, 204, 262, 43, 44, 45, 46, 47, 48, 49, |
| 160242 | /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 209, 210, | 162027 | /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 264, 274, |
| 160243 | /* 100 */ 211, 76, 102, 103, 104, 105, 106, 107, 108, 109, | 162028 | /* 100 */ 275, 276, 102, 103, 104, 105, 106, 107, 108, 109, |
| 160244 | /* 110 */ 110, 111, 112, 59, 89, 111, 112, 92, 252, 307, | 162029 | /* 110 */ 110, 111, 112, 113, 239, 240, 239, 240, 210, 211, |
| 160245 | /* 120 */ 308, 313, 314, 112, 312, 59, 86, 261, 88, 19, | 162030 | /* 120 */ 212, 314, 315, 314, 59, 316, 86, 252, 88, 252, |
| 160246 | /* 130 */ 313, 80, 315, 313, 314, 25, 127, 128, 54, 55, | 162031 | /* 130 */ 19, 314, 315, 256, 257, 309, 25, 72, 296, 313, |
| 160247 | /* 140 */ 56, 57, 102, 103, 104, 105, 106, 107, 108, 109, | 162032 | /* 140 */ 193, 266, 102, 103, 104, 105, 106, 107, 108, 109, |
| 160248 | /* 150 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49, | 162033 | /* 150 */ 110, 111, 112, 113, 43, 44, 45, 46, 47, 48, |
| 160249 | /* 160 */ 50, 51, 52, 53, 54, 55, 56, 57, 192, 115, | 162034 | /* 160 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 81, |
| 160250 | /* 170 */ 116, 117, 118, 122, 192, 121, 122, 123, 202, 69, | 162035 | /* 170 */ 292, 59, 307, 298, 108, 109, 110, 111, 112, 113, |
| 160251 | /* 180 */ 204, 115, 116, 117, 192, 131, 102, 103, 104, 105, | 162036 | /* 180 */ 69, 116, 117, 118, 72, 128, 129, 193, 241, 22, |
| 160252 | /* 190 */ 106, 107, 108, 109, 110, 111, 112, 215, 216, 19, | 162037 | /* 190 */ 113, 54, 55, 56, 57, 58, 102, 103, 104, 105, |
| 160253 | /* 200 */ 54, 55, 56, 57, 58, 108, 109, 110, 111, 112, | 162038 | /* 200 */ 106, 107, 108, 109, 110, 111, 112, 113, 120, 193, |
| 160254 | /* 210 */ 192, 160, 102, 103, 104, 105, 106, 107, 108, 109, | 162039 | /* 210 */ 216, 217, 25, 102, 103, 104, 105, 106, 107, 108, |
| 160255 | /* 220 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49, | 162040 | /* 220 */ 109, 110, 111, 112, 113, 231, 138, 139, 116, 117, |
| 160256 | /* 230 */ 50, 51, 52, 53, 54, 55, 56, 57, 19, 46, | 162041 | /* 230 */ 118, 106, 107, 19, 216, 54, 55, 56, 57, 102, |
| 160257 | /* 240 */ 47, 48, 49, 24, 248, 192, 250, 67, 102, 103, | 162042 | /* 240 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, |
| 160258 | /* 250 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 277, | 162043 | /* 250 */ 113, 304, 25, 46, 47, 48, 49, 43, 44, 45, |
| 160259 | /* 260 */ 127, 128, 43, 44, 45, 46, 47, 48, 49, 50, | 162044 | /* 260 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, |
| 160260 | /* 270 */ 51, 52, 53, 54, 55, 56, 57, 26, 164, 165, | 162045 | /* 270 */ 56, 57, 193, 106, 107, 59, 193, 19, 153, 263, |
| 160261 | /* 280 */ 272, 263, 102, 103, 104, 105, 106, 107, 108, 109, | 162046 | /* 280 */ 155, 67, 24, 102, 103, 104, 105, 106, 107, 108, |
| 160262 | /* 290 */ 110, 111, 112, 184, 185, 186, 187, 188, 189, 186, | 162047 | /* 290 */ 109, 110, 111, 112, 113, 216, 217, 59, 230, 216, |
| 160263 | /* 300 */ 187, 188, 189, 194, 76, 196, 229, 194, 19, 196, | 162048 | /* 300 */ 217, 43, 44, 45, 46, 47, 48, 49, 50, 51, |
| 160264 | /* 310 */ 59, 192, 203, 120, 59, 87, 203, 89, 310, 311, | 162049 | /* 310 */ 52, 53, 54, 55, 56, 57, 102, 103, 104, 105, |
| 160265 | /* 320 */ 92, 102, 103, 104, 105, 106, 107, 108, 109, 110, | 162050 | /* 320 */ 106, 107, 108, 109, 110, 111, 112, 113, 121, 142, |
| 160266 | /* 330 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50, | 162051 | /* 330 */ 59, 193, 116, 117, 118, 119, 253, 204, 122, 123, |
| 160267 | /* 340 */ 51, 52, 53, 54, 55, 56, 57, 238, 239, 73, | 162052 | /* 340 */ 124, 19, 20, 81, 22, 262, 108, 19, 132, 165, |
| 160268 | /* 350 */ 231, 238, 239, 22, 23, 100, 25, 81, 305, 306, | 162053 | /* 350 */ 166, 193, 24, 126, 116, 117, 118, 278, 36, 193, |
| 160269 | /* 360 */ 251, 23, 25, 25, 251, 272, 115, 116, 117, 214, | 162054 | /* 360 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, |
| 160270 | /* 370 */ 115, 116, 144, 192, 265, 120, 114, 222, 265, 102, | 162055 | /* 370 */ 112, 113, 239, 240, 216, 217, 215, 106, 107, 241, |
| 160271 | /* 380 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, | 162056 | /* 380 */ 19, 59, 216, 217, 223, 252, 115, 116, 117, 118, |
| 160272 | /* 390 */ 192, 102, 103, 104, 105, 106, 107, 108, 109, 110, | 162057 | /* 390 */ 73, 120, 26, 71, 193, 22, 193, 231, 81, 128, |
| 160273 | /* 400 */ 111, 112, 126, 310, 311, 192, 297, 152, 153, 154, | 162058 | /* 400 */ 138, 139, 269, 81, 43, 44, 45, 46, 47, 48, |
| 160274 | /* 410 */ 297, 149, 192, 137, 138, 19, 192, 100, 192, 23, | 162059 | /* 410 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 216, |
| 160275 | /* 420 */ 22, 106, 107, 108, 109, 110, 111, 112, 215, 216, | 162060 | /* 420 */ 217, 198, 100, 95, 153, 59, 155, 193, 106, 107, |
| 160276 | /* 430 */ 106, 107, 101, 116, 192, 215, 216, 120, 149, 43, | 162061 | /* 430 */ 235, 236, 59, 193, 193, 249, 114, 251, 116, 117, |
| 160277 | /* 440 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, | 162062 | /* 440 */ 118, 113, 304, 121, 127, 204, 193, 119, 120, 121, |
| 160278 | /* 450 */ 54, 55, 56, 57, 117, 117, 192, 59, 19, 187, | 162063 | /* 450 */ 122, 123, 124, 125, 193, 138, 139, 216, 217, 131, |
| 160279 | /* 460 */ 59, 189, 23, 282, 240, 252, 194, 192, 196, 152, | 162064 | /* 460 */ 138, 139, 193, 102, 103, 104, 105, 106, 107, 108, |
| 160280 | /* 470 */ 153, 154, 252, 72, 261, 203, 152, 25, 154, 142, | 162065 | /* 470 */ 109, 110, 111, 112, 113, 153, 154, 155, 156, 157, |
| 160281 | /* 480 */ 142, 261, 43, 44, 45, 46, 47, 48, 49, 50, | 162066 | /* 480 */ 239, 240, 116, 117, 118, 76, 193, 193, 19, 116, |
| 160282 | /* 490 */ 51, 52, 53, 54, 55, 56, 57, 192, 102, 103, | 162067 | /* 490 */ 117, 118, 23, 252, 253, 193, 87, 204, 89, 238, |
| 160283 | /* 500 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 267, | 162068 | /* 500 */ 193, 92, 268, 262, 281, 203, 193, 205, 285, 216, |
| 160284 | /* 510 */ 238, 239, 237, 115, 116, 117, 115, 116, 117, 192, | 162069 | /* 510 */ 217, 150, 43, 44, 45, 46, 47, 48, 49, 50, |
| 160285 | /* 520 */ 59, 118, 16, 251, 121, 122, 123, 303, 19, 303, | 162070 | /* 520 */ 51, 52, 53, 54, 55, 56, 57, 193, 193, 216, |
| 160286 | /* 530 */ 59, 267, 23, 72, 131, 308, 22, 265, 22, 312, | 162071 | /* 530 */ 217, 19, 239, 240, 59, 23, 106, 107, 108, 109, |
| 160287 | /* 540 */ 24, 102, 103, 104, 105, 106, 107, 108, 109, 110, | 162072 | /* 540 */ 110, 111, 112, 113, 231, 252, 253, 193, 308, 309, |
| 160288 | /* 550 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50, | 162073 | /* 550 */ 193, 145, 59, 313, 145, 43, 44, 45, 46, 47, |
| 160289 | /* 560 */ 51, 52, 53, 54, 55, 56, 57, 19, 81, 297, | 162074 | /* 560 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, |
| 160290 | /* 570 */ 295, 23, 192, 59, 203, 59, 115, 116, 117, 108, | 162075 | /* 570 */ 164, 102, 103, 104, 105, 106, 107, 108, 109, 110, |
| 160291 | /* 580 */ 192, 73, 25, 77, 192, 79, 115, 116, 117, 137, | 162076 | /* 580 */ 111, 112, 113, 119, 193, 193, 122, 123, 124, 193, |
| 160292 | /* 590 */ 138, 43, 44, 45, 46, 47, 48, 49, 50, 51, | 162077 | /* 590 */ 283, 116, 117, 118, 235, 236, 132, 59, 241, 264, |
| 160293 | /* 600 */ 52, 53, 54, 55, 56, 57, 119, 215, 216, 238, | 162078 | /* 600 */ 59, 193, 19, 23, 193, 25, 23, 216, 217, 116, |
| 160294 | /* 610 */ 239, 102, 103, 104, 105, 106, 107, 108, 109, 110, | 162079 | /* 610 */ 117, 118, 216, 217, 102, 103, 104, 105, 106, 107, |
| 160295 | /* 620 */ 111, 112, 251, 192, 137, 138, 59, 234, 235, 115, | 162080 | /* 620 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46, |
| 160296 | /* 630 */ 116, 117, 116, 76, 126, 127, 128, 19, 192, 268, | 162081 | /* 630 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 160297 | /* 640 */ 19, 23, 22, 192, 252, 24, 89, 300, 301, 92, | 162082 | /* 640 */ 57, 19, 308, 309, 151, 23, 25, 313, 135, 253, |
| 160298 | /* 650 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, | 162083 | /* 650 */ 21, 193, 241, 140, 116, 117, 118, 116, 117, 118, |
| 160299 | /* 660 */ 112, 43, 44, 45, 46, 47, 48, 49, 50, 51, | 162084 | /* 660 */ 268, 304, 22, 301, 302, 43, 44, 45, 46, 47, |
| 160300 | /* 670 */ 52, 53, 54, 55, 56, 57, 19, 192, 192, 59, | 162085 | /* 670 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, |
| 160301 | /* 680 */ 23, 192, 115, 116, 117, 200, 240, 307, 308, 22, | 162086 | /* 680 */ 193, 143, 193, 193, 143, 102, 103, 104, 105, 106, |
| 160302 | /* 690 */ 205, 81, 312, 262, 22, 192, 133, 22, 135, 136, | 162087 | /* 690 */ 107, 108, 109, 110, 111, 112, 113, 76, 118, 59, |
| 160303 | /* 700 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, | 162088 | /* 700 */ 292, 211, 212, 216, 217, 216, 217, 73, 193, 80, |
| 160304 | /* 710 */ 53, 54, 55, 56, 57, 197, 95, 150, 215, 216, | 162089 | /* 710 */ 89, 25, 19, 92, 193, 304, 23, 22, 231, 193, |
| 160305 | /* 720 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, | 162090 | /* 720 */ 231, 193, 22, 143, 102, 103, 104, 105, 106, 107, |
| 160306 | /* 730 */ 112, 59, 192, 112, 59, 115, 116, 117, 192, 118, | 162091 | /* 730 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46, |
| 160307 | /* 740 */ 119, 120, 121, 122, 123, 124, 19, 137, 138, 303, | 162092 | /* 740 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 160308 | /* 750 */ 23, 130, 192, 267, 192, 252, 267, 306, 203, 102, | 162093 | /* 750 */ 57, 19, 123, 193, 59, 23, 116, 117, 118, 59, |
| 160309 | /* 760 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, | 162094 | /* 760 */ 193, 127, 128, 129, 306, 307, 210, 211, 212, 193, |
| 160310 | /* 770 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, | 162095 | /* 770 */ 22, 111, 112, 113, 284, 43, 44, 45, 46, 47, |
| 160311 | /* 780 */ 53, 54, 55, 56, 57, 19, 240, 115, 116, 117, | 162096 | /* 780 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, |
| 160312 | /* 790 */ 115, 116, 117, 238, 239, 222, 192, 224, 280, 237, | 162097 | /* 790 */ 161, 193, 216, 217, 268, 102, 103, 104, 105, 106, |
| 160313 | /* 800 */ 240, 192, 284, 192, 59, 232, 251, 140, 204, 43, | 162098 | /* 800 */ 107, 108, 109, 110, 111, 112, 113, 59, 193, 193, |
| 160314 | /* 810 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, | 162099 | /* 810 */ 193, 116, 117, 118, 216, 217, 116, 117, 118, 304, |
| 160315 | /* 820 */ 54, 55, 56, 57, 192, 35, 215, 216, 192, 102, | 162100 | /* 820 */ 239, 240, 19, 263, 138, 139, 23, 211, 212, 231, |
| 160316 | /* 830 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, | 162101 | /* 830 */ 263, 216, 217, 252, 102, 103, 104, 105, 106, 107, |
| 160317 | /* 840 */ 59, 230, 192, 192, 238, 239, 237, 215, 216, 303, | 162102 | /* 840 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46, |
| 160318 | /* 850 */ 308, 215, 216, 16, 312, 19, 66, 251, 126, 127, | 162103 | /* 850 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 160319 | /* 860 */ 128, 116, 230, 303, 74, 203, 215, 216, 102, 103, | 162104 | /* 860 */ 57, 19, 193, 11, 116, 117, 118, 240, 253, 193, |
| 160320 | /* 870 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 43, | 162105 | /* 870 */ 201, 239, 240, 193, 134, 206, 136, 137, 193, 252, |
| 160321 | /* 880 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, | 162106 | /* 880 */ 193, 264, 193, 193, 252, 43, 44, 45, 46, 47, |
| 160322 | /* 890 */ 54, 55, 56, 57, 192, 212, 115, 116, 117, 19, | 162107 | /* 890 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, |
| 160323 | /* 900 */ 238, 239, 192, 252, 7, 8, 9, 192, 192, 238, | 162108 | /* 900 */ 284, 216, 217, 216, 217, 102, 103, 104, 105, 106, |
| 160324 | /* 910 */ 239, 308, 262, 251, 77, 312, 79, 215, 216, 129, | 162109 | /* 910 */ 107, 108, 109, 110, 111, 112, 113, 193, 231, 193, |
| 160325 | /* 920 */ 210, 211, 251, 142, 158, 45, 46, 47, 48, 49, | 162110 | /* 920 */ 187, 188, 189, 190, 127, 128, 129, 238, 195, 193, |
| 160326 | /* 930 */ 50, 51, 52, 53, 54, 55, 56, 57, 102, 103, | 162111 | /* 930 */ 197, 16, 19, 7, 8, 9, 193, 204, 253, 193, |
| 160327 | /* 940 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 12, | 162112 | /* 940 */ 216, 217, 216, 217, 102, 103, 104, 105, 106, 107, |
| 160328 | /* 950 */ 59, 192, 192, 237, 252, 243, 192, 192, 126, 127, | 162113 | /* 950 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46, |
| 160329 | /* 960 */ 128, 192, 308, 203, 27, 253, 312, 308, 285, 207, | 162114 | /* 960 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 160330 | /* 970 */ 208, 312, 157, 290, 159, 215, 216, 262, 192, 42, | 162115 | /* 970 */ 57, 213, 239, 240, 193, 76, 19, 188, 232, 190, |
| 160331 | /* 980 */ 215, 216, 102, 103, 104, 105, 106, 107, 108, 109, | 162116 | /* 980 */ 128, 129, 292, 193, 195, 252, 197, 46, 89, 138, |
| 160332 | /* 990 */ 110, 111, 112, 283, 158, 230, 237, 160, 238, 239, | 162117 | /* 990 */ 139, 92, 77, 204, 79, 193, 269, 216, 217, 266, |
| 160333 | /* 1000 */ 63, 215, 216, 192, 192, 12, 115, 116, 117, 22, | 162118 | /* 1000 */ 204, 159, 45, 46, 47, 48, 49, 50, 51, 52, |
| 160334 | /* 1010 */ 73, 251, 252, 192, 19, 192, 230, 239, 24, 24, | 162119 | /* 1010 */ 53, 54, 55, 56, 57, 102, 103, 104, 105, 106, |
| 160335 | /* 1020 */ 27, 261, 210, 211, 99, 192, 215, 216, 225, 251, | 162120 | /* 1020 */ 107, 108, 109, 110, 111, 112, 113, 12, 239, 240, |
| 160336 | /* 1030 */ 192, 192, 263, 142, 19, 42, 215, 216, 43, 44, | 162121 | /* 1030 */ 193, 298, 22, 23, 253, 239, 240, 127, 128, 129, |
| 160337 | /* 1040 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, | 162122 | /* 1040 */ 238, 252, 27, 193, 286, 204, 193, 204, 252, 291, |
| 160338 | /* 1050 */ 55, 56, 57, 59, 19, 291, 63, 132, 43, 44, | 162123 | /* 1050 */ 193, 273, 22, 23, 100, 266, 115, 42, 268, 102, |
| 160339 | /* 1060 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, | 162124 | /* 1060 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, |
| 160340 | /* 1070 */ 55, 56, 57, 252, 22, 23, 22, 25, 43, 44, | 162125 | /* 1070 */ 113, 117, 159, 216, 217, 121, 161, 19, 63, 193, |
| 160341 | /* 1080 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, | 162126 | /* 1080 */ 239, 240, 239, 240, 12, 208, 209, 298, 73, 311, |
| 160342 | /* 1090 */ 55, 56, 57, 106, 107, 283, 263, 102, 103, 104, | 162127 | /* 1090 */ 312, 238, 19, 252, 25, 252, 22, 24, 24, 27, |
| 160343 | /* 1100 */ 105, 106, 107, 108, 109, 110, 111, 112, 59, 192, | 162128 | /* 1100 */ 193, 264, 216, 217, 46, 208, 209, 153, 154, 155, |
| 160344 | /* 1110 */ 116, 144, 29, 59, 291, 192, 33, 102, 103, 104, | 162129 | /* 1110 */ 253, 101, 19, 23, 42, 25, 43, 44, 45, 46, |
| 160345 | /* 1120 */ 105, 106, 107, 108, 109, 110, 111, 112, 192, 291, | 162130 | /* 1120 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 160346 | /* 1130 */ 163, 19, 215, 216, 15, 192, 108, 102, 103, 104, | 162131 | /* 1130 */ 57, 101, 19, 59, 25, 63, 43, 44, 45, 46, |
| 160347 | /* 1140 */ 105, 106, 107, 108, 109, 110, 111, 112, 65, 192, | 162132 | /* 1140 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 160348 | /* 1150 */ 66, 215, 216, 101, 231, 106, 107, 19, 215, 216, | 162133 | /* 1150 */ 57, 22, 23, 115, 25, 24, 43, 44, 45, 46, |
| 160349 | /* 1160 */ 192, 212, 134, 114, 115, 116, 117, 139, 119, 85, | 162134 | /* 1160 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 160350 | /* 1170 */ 116, 207, 208, 230, 192, 19, 127, 192, 94, 60, | 162135 | /* 1170 */ 57, 22, 23, 115, 25, 102, 103, 104, 105, 106, |
| 160351 | /* 1180 */ 59, 192, 44, 45, 46, 47, 48, 49, 50, 51, | 162136 | /* 1180 */ 107, 108, 109, 110, 111, 112, 113, 118, 150, 131, |
| 160352 | /* 1190 */ 52, 53, 54, 55, 56, 57, 192, 76, 192, 31, | 162137 | /* 1190 */ 59, 117, 22, 273, 193, 102, 103, 104, 105, 106, |
| 160353 | /* 1200 */ 192, 152, 46, 154, 215, 216, 192, 39, 87, 192, | 162138 | /* 1200 */ 107, 108, 109, 110, 111, 112, 113, 204, 66, 204, |
| 160354 | /* 1210 */ 89, 19, 20, 92, 22, 192, 22, 23, 22, 230, | 162139 | /* 1210 */ 35, 204, 143, 213, 193, 102, 103, 104, 105, 106, |
| 160355 | /* 1220 */ 263, 215, 216, 215, 216, 137, 138, 115, 36, 145, | 162140 | /* 1220 */ 107, 108, 109, 110, 111, 112, 113, 85, 193, 59, |
| 160356 | /* 1230 */ 128, 192, 215, 216, 22, 23, 115, 116, 117, 290, | 162141 | /* 1230 */ 101, 311, 312, 16, 193, 19, 94, 216, 217, 238, |
| 160357 | /* 1240 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, | 162142 | /* 1240 */ 193, 66, 239, 240, 239, 240, 239, 240, 117, 74, |
| 160358 | /* 1250 */ 112, 59, 192, 151, 215, 216, 192, 61, 203, 298, | 162143 | /* 1250 */ 101, 216, 217, 193, 193, 252, 193, 252, 149, 252, |
| 160359 | /* 1260 */ 299, 192, 192, 71, 25, 144, 203, 192, 203, 230, | 162144 | /* 1260 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
| 160360 | /* 1270 */ 114, 19, 20, 81, 22, 215, 216, 263, 192, 215, | 162145 | /* 1270 */ 54, 55, 56, 57, 193, 193, 193, 5, 59, 216, |
| 160361 | /* 1280 */ 216, 255, 256, 203, 215, 216, 130, 19, 36, 192, | 162146 | /* 1280 */ 217, 25, 10, 11, 12, 13, 14, 117, 146, 17, |
| 160362 | /* 1290 */ 215, 216, 100, 238, 239, 101, 25, 192, 106, 107, | 162147 | /* 1290 */ 193, 291, 193, 232, 77, 76, 79, 216, 217, 216, |
| 160363 | /* 1300 */ 48, 238, 239, 238, 239, 113, 251, 115, 116, 117, | 162148 | /* 1300 */ 217, 31, 30, 309, 32, 130, 87, 313, 89, 39, |
| 160364 | /* 1310 */ 192, 59, 120, 101, 251, 192, 251, 192, 238, 239, | 162149 | /* 1310 */ 193, 92, 40, 216, 217, 216, 217, 108, 102, 103, |
| 160365 | /* 1320 */ 215, 216, 192, 71, 46, 243, 192, 25, 25, 137, | 162150 | /* 1320 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, |
| 160366 | /* 1330 */ 138, 251, 192, 215, 216, 253, 25, 85, 215, 216, | 162151 | /* 1330 */ 299, 300, 193, 216, 217, 116, 117, 118, 19, 20, |
| 160367 | /* 1340 */ 215, 216, 90, 243, 152, 153, 154, 155, 156, 215, | 162152 | /* 1340 */ 193, 22, 70, 309, 135, 193, 264, 313, 193, 140, |
| 160368 | /* 1350 */ 216, 192, 100, 253, 243, 215, 216, 192, 106, 107, | 162153 | /* 1350 */ 78, 193, 226, 81, 59, 36, 193, 309, 193, 29, |
| 160369 | /* 1360 */ 243, 192, 148, 149, 253, 113, 192, 115, 116, 117, | 162154 | /* 1360 */ 193, 313, 193, 33, 145, 193, 59, 48, 216, 217, |
| 160370 | /* 1370 */ 253, 192, 120, 192, 215, 216, 192, 23, 192, 25, | 162155 | /* 1370 */ 98, 216, 217, 193, 216, 217, 193, 244, 59, 216, |
| 160371 | /* 1380 */ 215, 216, 192, 115, 215, 216, 22, 148, 24, 215, | 162156 | /* 1380 */ 217, 216, 217, 216, 217, 216, 217, 254, 216, 217, |
| 160372 | /* 1390 */ 216, 192, 114, 192, 215, 216, 215, 216, 134, 215, | 162157 | /* 1390 */ 71, 193, 244, 193, 193, 65, 216, 217, 193, 216, |
| 160373 | /* 1400 */ 216, 215, 216, 139, 152, 153, 154, 155, 156, 0, | 162158 | /* 1400 */ 217, 145, 254, 244, 85, 133, 15, 100, 193, 90, |
| 160374 | /* 1410 */ 1, 2, 141, 23, 5, 25, 215, 216, 24, 10, | 162159 | /* 1410 */ 138, 139, 117, 254, 216, 217, 216, 217, 193, 100, |
| 160375 | /* 1420 */ 11, 12, 13, 14, 1, 2, 17, 125, 5, 19, | 162160 | /* 1420 */ 193, 216, 217, 116, 117, 106, 107, 19, 121, 193, |
| 160376 | /* 1430 */ 20, 268, 22, 10, 11, 12, 13, 14, 192, 30, | 162161 | /* 1430 */ 193, 216, 217, 114, 162, 116, 117, 118, 244, 244, |
| 160377 | /* 1440 */ 17, 32, 23, 23, 25, 25, 36, 144, 23, 40, | 162162 | /* 1440 */ 121, 216, 217, 216, 217, 193, 309, 129, 254, 254, |
| 160378 | /* 1450 */ 25, 192, 141, 30, 192, 32, 23, 22, 25, 5, | 162163 | /* 1450 */ 313, 60, 216, 217, 19, 256, 257, 193, 120, 121, |
| 160379 | /* 1460 */ 128, 215, 216, 40, 10, 11, 12, 13, 14, 59, | 162164 | /* 1460 */ 153, 154, 155, 149, 150, 25, 24, 99, 216, 217, |
| 160380 | /* 1470 */ 23, 17, 25, 192, 215, 216, 192, 215, 216, 70, | 162165 | /* 1470 */ 152, 193, 153, 154, 155, 156, 157, 0, 1, 2, |
| 160381 | /* 1480 */ 23, 71, 25, 151, 30, 192, 32, 78, 53, 192, | 162166 | /* 1480 */ 216, 217, 5, 22, 158, 24, 160, 10, 11, 12, |
| 160382 | /* 1490 */ 81, 192, 192, 70, 40, 85, 215, 216, 119, 120, | 162167 | /* 1490 */ 13, 14, 193, 23, 17, 25, 193, 19, 20, 193, |
| 160383 | /* 1500 */ 90, 78, 59, 254, 81, 192, 192, 98, 215, 216, | 162168 | /* 1500 */ 22, 133, 193, 22, 22, 193, 22, 30, 193, 32, |
| 160384 | /* 1510 */ 100, 23, 59, 25, 215, 216, 106, 107, 23, 192, | 162169 | /* 1510 */ 19, 20, 129, 22, 36, 216, 217, 40, 193, 216, |
| 160385 | /* 1520 */ 25, 98, 19, 113, 70, 115, 116, 117, 215, 216, | 162170 | /* 1520 */ 217, 193, 216, 217, 116, 216, 217, 36, 216, 217, |
| 160386 | /* 1530 */ 120, 192, 78, 192, 140, 81, 19, 20, 23, 22, | 162171 | /* 1530 */ 193, 216, 217, 193, 53, 152, 193, 59, 23, 19, |
| 160387 | /* 1540 */ 25, 132, 215, 216, 192, 192, 137, 138, 192, 23, | 162172 | /* 1540 */ 25, 216, 217, 61, 216, 217, 23, 70, 25, 71, |
| 160388 | /* 1550 */ 192, 25, 98, 36, 192, 132, 215, 216, 192, 116, | 162173 | /* 1550 */ 59, 116, 193, 216, 217, 78, 216, 217, 81, 216, |
| 160389 | /* 1560 */ 137, 138, 152, 153, 154, 155, 156, 215, 216, 116, | 162174 | /* 1560 */ 217, 59, 71, 85, 193, 23, 193, 25, 90, 23, |
| 160390 | /* 1570 */ 161, 215, 216, 215, 216, 120, 59, 215, 216, 7, | 162175 | /* 1570 */ 23, 25, 25, 7, 8, 98, 85, 193, 100, 193, |
| 160391 | /* 1580 */ 8, 215, 216, 192, 161, 130, 132, 192, 71, 83, | 162176 | /* 1580 */ 59, 90, 142, 141, 106, 107, 193, 216, 217, 216, |
| 160392 | /* 1590 */ 84, 137, 138, 59, 192, 192, 19, 20, 192, 22, | 162177 | /* 1590 */ 217, 100, 114, 193, 116, 117, 118, 106, 107, 121, |
| 160393 | /* 1600 */ 97, 225, 85, 192, 23, 192, 25, 90, 192, 192, | 162178 | /* 1600 */ 216, 217, 216, 217, 193, 114, 193, 116, 117, 118, |
| 160394 | /* 1610 */ 215, 216, 152, 36, 154, 161, 192, 100, 215, 216, | 162179 | /* 1610 */ 133, 23, 121, 25, 121, 138, 139, 97, 23, 117, |
| 160395 | /* 1620 */ 192, 215, 216, 106, 107, 225, 215, 216, 192, 192, | 162180 | /* 1620 */ 25, 23, 193, 25, 131, 141, 193, 216, 217, 59, |
| 160396 | /* 1630 */ 113, 192, 115, 116, 117, 257, 59, 120, 192, 215, | 162181 | /* 1630 */ 193, 153, 154, 155, 156, 157, 226, 193, 117, 162, |
| 160397 | /* 1640 */ 216, 152, 192, 154, 192, 23, 317, 25, 71, 235, | 162182 | /* 1640 */ 23, 23, 25, 25, 153, 154, 155, 156, 157, 1, |
| 160398 | /* 1650 */ 116, 215, 216, 192, 215, 216, 192, 192, 192, 192, | 162183 | /* 1650 */ 2, 83, 84, 5, 19, 20, 226, 22, 10, 11, |
| 160399 | /* 1660 */ 192, 192, 192, 192, 192, 215, 216, 215, 216, 152, | 162184 | /* 1660 */ 12, 13, 14, 258, 153, 17, 155, 153, 23, 155, |
| 160400 | /* 1670 */ 153, 154, 155, 156, 192, 192, 287, 100, 286, 241, | 162185 | /* 1670 */ 25, 36, 23, 193, 25, 255, 193, 236, 30, 193, |
| 160401 | /* 1680 */ 254, 254, 242, 106, 107, 108, 254, 213, 254, 190, | 162186 | /* 1680 */ 32, 19, 20, 193, 22, 193, 288, 117, 40, 193, |
| 160402 | /* 1690 */ 113, 270, 115, 116, 117, 296, 266, 120, 219, 258, | 162187 | /* 1690 */ 318, 193, 193, 193, 59, 242, 193, 193, 36, 193, |
| 160403 | /* 1700 */ 244, 270, 258, 19, 20, 228, 22, 292, 266, 224, | 162188 | /* 1700 */ 193, 193, 287, 255, 255, 255, 71, 255, 243, 214, |
| 160404 | /* 1710 */ 292, 218, 218, 195, 218, 270, 258, 60, 245, 270, | 162189 | /* 1710 */ 191, 297, 267, 245, 271, 259, 259, 293, 70, 246, |
| 160405 | /* 1720 */ 36, 245, 244, 248, 19, 20, 242, 22, 248, 152, | 162190 | /* 1720 */ 246, 59, 267, 229, 245, 271, 78, 293, 259, 81, |
| 160406 | /* 1730 */ 153, 154, 155, 156, 244, 140, 199, 199, 279, 38, | 162191 | /* 1730 */ 271, 271, 220, 71, 225, 100, 219, 219, 249, 196, |
| 160407 | /* 1740 */ 199, 36, 150, 59, 296, 149, 22, 296, 18, 43, | 162192 | /* 1740 */ 243, 106, 107, 108, 219, 60, 98, 280, 297, 114, |
| 160408 | /* 1750 */ 236, 199, 233, 18, 198, 71, 293, 236, 271, 236, | 162193 | /* 1750 */ 249, 116, 117, 118, 141, 245, 121, 200, 200, 297, |
| 160409 | /* 1760 */ 269, 236, 148, 271, 59, 245, 269, 245, 282, 271, | 162194 | /* 1760 */ 38, 200, 100, 151, 150, 294, 294, 22, 106, 107, |
| 160410 | /* 1770 */ 199, 198, 233, 245, 293, 233, 71, 245, 157, 62, | 162195 | /* 1770 */ 283, 43, 234, 18, 237, 200, 114, 272, 116, 117, |
| 160411 | /* 1780 */ 22, 199, 198, 220, 100, 199, 198, 220, 199, 289, | 162196 | /* 1780 */ 118, 133, 237, 121, 18, 237, 138, 139, 153, 154, |
| 160412 | /* 1790 */ 106, 107, 288, 114, 226, 198, 217, 113, 64, 115, | 162197 | /* 1790 */ 155, 156, 157, 237, 270, 199, 19, 20, 246, 22, |
| 160413 | /* 1800 */ 116, 117, 217, 22, 120, 100, 223, 217, 217, 164, | 162198 | /* 1800 */ 149, 272, 272, 270, 200, 246, 234, 234, 246, 246, |
| 160414 | /* 1810 */ 223, 106, 107, 220, 125, 24, 217, 219, 113, 217, | 162199 | /* 1810 */ 162, 158, 290, 36, 199, 153, 154, 155, 156, 157, |
| 160415 | /* 1820 */ 115, 116, 117, 217, 311, 120, 226, 112, 304, 281, | 162200 | /* 1820 */ 62, 289, 200, 199, 22, 200, 221, 199, 221, 200, |
| 160416 | /* 1830 */ 281, 220, 114, 143, 260, 259, 152, 153, 154, 155, | 162201 | /* 1830 */ 199, 115, 64, 227, 218, 22, 59, 218, 218, 126, |
| 160417 | /* 1840 */ 156, 199, 91, 316, 82, 316, 147, 144, 22, 199, | 162202 | /* 1840 */ 165, 24, 113, 312, 218, 224, 305, 224, 71, 282, |
| 160418 | /* 1850 */ 249, 276, 157, 146, 260, 145, 278, 152, 153, 154, | 162203 | /* 1850 */ 144, 221, 220, 282, 218, 218, 218, 115, 261, 260, |
| 160419 | /* 1860 */ 155, 156, 259, 248, 260, 260, 259, 259, 249, 245, | 162204 | /* 1860 */ 227, 221, 261, 260, 200, 91, 317, 317, 82, 261, |
| 160420 | /* 1870 */ 247, 246, 25, 264, 264, 201, 13, 6, 193, 193, | 162205 | /* 1870 */ 260, 148, 261, 22, 265, 145, 200, 100, 158, 277, |
| 160421 | /* 1880 */ 212, 206, 191, 191, 191, 212, 206, 221, 212, 212, | 162206 | /* 1880 */ 147, 146, 25, 106, 107, 202, 13, 260, 194, 250, |
| 160422 | /* 1890 */ 221, 213, 4, 206, 213, 212, 3, 22, 162, 15, | 162207 | /* 1890 */ 249, 114, 248, 116, 117, 118, 250, 247, 121, 265, |
| 160423 | /* 1900 */ 23, 16, 23, 138, 150, 129, 25, 24, 141, 20, | 162208 | /* 1900 */ 246, 194, 6, 192, 192, 207, 192, 207, 213, 213, |
| 160424 | /* 1910 */ 16, 143, 1, 141, 302, 302, 299, 129, 129, 61, | 162209 | /* 1910 */ 213, 222, 213, 222, 4, 214, 214, 213, 3, 22, |
| 160425 | /* 1920 */ 150, 53, 53, 37, 129, 53, 53, 115, 1, 34, | 162210 | /* 1920 */ 163, 279, 207, 15, 23, 16, 23, 139, 130, 151, |
| 160426 | /* 1930 */ 140, 5, 22, 114, 160, 68, 75, 25, 68, 41, | 162211 | /* 1930 */ 153, 154, 155, 156, 157, 142, 25, 24, 20, 144, |
| 160427 | /* 1940 */ 140, 114, 24, 20, 19, 130, 124, 67, 24, 67, | 162212 | /* 1940 */ 16, 1, 142, 61, 130, 130, 303, 151, 53, 37, |
| 160428 | /* 1950 */ 22, 22, 22, 96, 23, 22, 59, 22, 67, 37, | 162213 | /* 1950 */ 303, 53, 300, 53, 130, 53, 116, 34, 1, 141, |
| 160429 | /* 1960 */ 28, 23, 148, 22, 25, 23, 23, 23, 23, 22, | 162214 | /* 1960 */ 5, 22, 115, 25, 161, 75, 41, 68, 141, 115, |
| 160430 | /* 1970 */ 140, 97, 23, 23, 115, 22, 142, 25, 88, 75, | 162215 | /* 1970 */ 24, 20, 68, 19, 131, 125, 23, 96, 22, 59, |
| 160431 | /* 1980 */ 34, 44, 34, 75, 23, 34, 86, 22, 34, 34, | 162216 | /* 1980 */ 22, 67, 22, 22, 67, 22, 24, 28, 67, 37, |
| 160432 | /* 1990 */ 34, 24, 93, 25, 25, 23, 34, 23, 23, 23, | 162217 | /* 1990 */ 23, 149, 22, 25, 23, 23, 23, 23, 22, 141, |
| 160433 | /* 2000 */ 23, 11, 23, 25, 22, 22, 22, 1, 23, 23, | 162218 | /* 2000 */ 23, 23, 97, 116, 22, 143, 25, 88, 75, 34, |
| 160434 | /* 2010 */ 22, 22, 25, 15, 23, 1, 140, 25, 140, 318, | 162219 | /* 2010 */ 44, 75, 86, 34, 34, 93, 23, 34, 34, 34, |
| 160435 | /* 2020 */ 318, 134, 318, 318, 318, 318, 318, 318, 318, 318, | 162220 | /* 2020 */ 22, 24, 34, 22, 25, 25, 23, 23, 23, 23, |
| 160436 | /* 2030 */ 318, 318, 140, 318, 318, 318, 140, 318, 318, 318, | 162221 | /* 2030 */ 23, 11, 23, 25, 22, 22, 25, 23, 23, 22, |
| 160437 | /* 2040 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162222 | /* 2040 */ 22, 135, 15, 1, 25, 23, 1, 319, 141, 319, |
| 160438 | /* 2050 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162223 | /* 2050 */ 319, 319, 319, 319, 319, 319, 319, 141, 319, 319, |
| 160439 | /* 2060 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162224 | /* 2060 */ 319, 319, 319, 319, 319, 319, 319, 319, 141, 141, |
| 160440 | /* 2070 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162225 | /* 2070 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 160441 | /* 2080 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162226 | /* 2080 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 160442 | /* 2090 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162227 | /* 2090 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 160443 | /* 2100 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162228 | /* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 160444 | /* 2110 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162229 | /* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 160445 | /* 2120 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162230 | /* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 160446 | /* 2130 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162231 | /* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 160447 | /* 2140 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162232 | /* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 160448 | /* 2150 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162233 | /* 2150 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 160449 | /* 2160 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162234 | /* 2160 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 160450 | /* 2170 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162235 | /* 2170 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 160451 | /* 2180 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162236 | /* 2180 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 160452 | /* 2190 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162237 | /* 2190 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 160453 | /* 2200 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162238 | /* 2200 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 160454 | /* 2210 */ 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, | 162239 | /* 2210 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 160455 | /* 2220 */ 318, | 162240 | /* 2220 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 162241 | /* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, | ||
| 162242 | /* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, | ||
| 162243 | /* 2250 */ 319, 319, 319, 319, 319, | ||
| 160456 | }; | 162244 | }; |
| 160457 | #define YY_SHIFT_COUNT (571) | 162245 | #define YY_SHIFT_COUNT (573) |
| 160458 | #define YY_SHIFT_MIN (0) | 162246 | #define YY_SHIFT_MIN (0) |
| 160459 | #define YY_SHIFT_MAX (2014) | 162247 | #define YY_SHIFT_MAX (2045) |
| 160460 | static const unsigned short int yy_shift_ofst[] = { | 162248 | static const unsigned short int yy_shift_ofst[] = { |
| 160461 | /* 0 */ 1423, 1409, 1454, 1192, 1192, 610, 1252, 1410, 1517, 1684, | 162249 | /* 0 */ 1648, 1477, 1272, 322, 322, 262, 1319, 1478, 1491, 1662, |
| 160462 | /* 10 */ 1684, 1684, 276, 0, 0, 180, 1015, 1684, 1684, 1684, | 162250 | /* 10 */ 1662, 1662, 317, 0, 0, 214, 1093, 1662, 1662, 1662, |
| 160463 | /* 20 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, | 162251 | /* 20 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, |
| 160464 | /* 30 */ 1049, 1049, 1121, 1121, 54, 487, 610, 610, 610, 610, | 162252 | /* 30 */ 271, 271, 1219, 1219, 216, 88, 262, 262, 262, 262, |
| 160465 | /* 40 */ 610, 40, 110, 219, 289, 396, 439, 509, 548, 618, | 162253 | /* 40 */ 262, 40, 111, 258, 361, 469, 512, 583, 622, 693, |
| 160466 | /* 50 */ 657, 727, 766, 836, 995, 1015, 1015, 1015, 1015, 1015, | 162254 | /* 50 */ 732, 803, 842, 913, 1073, 1093, 1093, 1093, 1093, 1093, |
| 160467 | /* 60 */ 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, | 162255 | /* 60 */ 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, |
| 160468 | /* 70 */ 1015, 1015, 1015, 1035, 1015, 1138, 880, 880, 1577, 1684, | 162256 | /* 70 */ 1093, 1093, 1093, 1113, 1093, 1216, 957, 957, 1635, 1662, |
| 160469 | /* 80 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, | 162257 | /* 80 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, |
| 160470 | /* 90 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, | 162258 | /* 90 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, |
| 160471 | /* 100 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, | 162259 | /* 100 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, |
| 160472 | /* 110 */ 1684, 1684, 1684, 1705, 1684, 1684, 1684, 1684, 1684, 1684, | 162260 | /* 110 */ 1662, 1662, 1662, 1662, 1777, 1662, 1662, 1662, 1662, 1662, |
| 160473 | /* 120 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 146, 84, 84, | 162261 | /* 120 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 137, 181, |
| 160474 | /* 130 */ 84, 84, 84, 277, 315, 401, 97, 461, 251, 66, | 162262 | /* 130 */ 181, 181, 181, 181, 94, 430, 66, 65, 112, 366, |
| 160475 | /* 140 */ 66, 51, 1156, 66, 66, 324, 324, 66, 452, 452, | 162263 | /* 140 */ 475, 475, 629, 1058, 475, 475, 125, 125, 475, 686, |
| 160476 | /* 150 */ 452, 452, 133, 114, 114, 4, 11, 2037, 2037, 621, | 162264 | /* 150 */ 686, 686, 660, 686, 57, 184, 184, 77, 77, 2070, |
| 160477 | /* 160 */ 621, 621, 567, 398, 398, 398, 398, 937, 937, 228, | 162265 | /* 160 */ 2070, 328, 328, 328, 493, 373, 373, 373, 373, 1015, |
| 160478 | /* 170 */ 251, 331, 1052, 66, 66, 66, 66, 66, 66, 66, | 162266 | /* 170 */ 1015, 409, 366, 1129, 1149, 475, 475, 475, 475, 475, |
| 160479 | /* 180 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, | 162267 | /* 180 */ 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, |
| 160480 | /* 190 */ 66, 66, 66, 557, 557, 66, 9, 25, 25, 745, | 162268 | /* 190 */ 475, 475, 475, 475, 475, 621, 621, 475, 852, 899, |
| 160481 | /* 200 */ 745, 967, 1088, 2037, 2037, 2037, 2037, 2037, 2037, 2037, | 162269 | /* 200 */ 899, 1295, 1295, 406, 851, 2070, 2070, 2070, 2070, 2070, |
| 160482 | /* 210 */ 255, 317, 317, 514, 403, 620, 471, 672, 781, 891, | 162270 | /* 210 */ 2070, 2070, 1307, 954, 954, 640, 464, 695, 238, 700, |
| 160483 | /* 220 */ 675, 66, 66, 66, 66, 66, 66, 66, 66, 66, | 162271 | /* 220 */ 538, 541, 748, 475, 475, 475, 475, 475, 475, 475, |
| 160484 | /* 230 */ 66, 508, 66, 66, 66, 66, 66, 66, 66, 66, | 162272 | /* 230 */ 475, 475, 475, 634, 475, 475, 475, 475, 475, 475, |
| 160485 | /* 240 */ 66, 66, 66, 66, 790, 790, 790, 66, 66, 66, | 162273 | /* 240 */ 475, 475, 475, 475, 475, 475, 1175, 1175, 1175, 475, |
| 160486 | /* 250 */ 338, 66, 66, 66, 516, 1084, 66, 66, 993, 66, | 162274 | /* 250 */ 475, 475, 580, 475, 475, 475, 1074, 1142, 475, 475, |
| 160487 | /* 260 */ 66, 66, 66, 66, 66, 66, 66, 732, 1083, 563, | 162275 | /* 260 */ 1072, 475, 475, 475, 475, 475, 475, 475, 475, 797, |
| 160488 | /* 270 */ 994, 994, 994, 994, 337, 563, 563, 1028, 987, 897, | 162276 | /* 270 */ 1330, 740, 1131, 1131, 1131, 1131, 1069, 740, 740, 1209, |
| 160489 | /* 280 */ 1119, 262, 1214, 1271, 1112, 1214, 1112, 1268, 1239, 262, | 162277 | /* 280 */ 167, 926, 1391, 1038, 1314, 187, 1408, 1314, 1408, 1435, |
| 160490 | /* 290 */ 262, 1239, 262, 1271, 1268, 1302, 1354, 1278, 1168, 1168, | 162278 | /* 290 */ 1109, 1038, 1038, 1109, 1038, 187, 1435, 227, 1090, 941, |
| 160491 | /* 300 */ 1168, 1112, 1303, 1303, 815, 1311, 1264, 1364, 1657, 1657, | 162279 | /* 300 */ 1270, 1270, 1270, 1408, 1256, 1256, 1326, 1440, 513, 1461, |
| 160492 | /* 310 */ 1595, 1595, 1701, 1701, 1595, 1592, 1596, 1724, 1706, 1730, | 162280 | /* 310 */ 1685, 1685, 1613, 1613, 1722, 1722, 1613, 1612, 1614, 1745, |
| 160493 | /* 320 */ 1730, 1730, 1730, 1595, 1735, 1614, 1596, 1596, 1614, 1724, | 162281 | /* 320 */ 1728, 1755, 1755, 1755, 1755, 1613, 1766, 1651, 1614, 1614, |
| 160494 | /* 330 */ 1706, 1614, 1706, 1614, 1595, 1735, 1621, 1717, 1595, 1735, | 162282 | /* 330 */ 1651, 1745, 1728, 1651, 1728, 1651, 1613, 1766, 1653, 1758, |
| 160495 | /* 340 */ 1758, 1595, 1735, 1595, 1735, 1758, 1679, 1679, 1679, 1734, | 162283 | /* 340 */ 1613, 1766, 1802, 1613, 1766, 1613, 1766, 1802, 1716, 1716, |
| 160496 | /* 350 */ 1781, 1781, 1758, 1679, 1689, 1679, 1734, 1679, 1679, 1645, | 162284 | /* 350 */ 1716, 1768, 1813, 1813, 1802, 1716, 1713, 1716, 1768, 1716, |
| 160497 | /* 360 */ 1791, 1715, 1715, 1758, 1690, 1718, 1690, 1718, 1690, 1718, | 162285 | /* 360 */ 1716, 1675, 1817, 1729, 1729, 1802, 1706, 1742, 1706, 1742, |
| 160498 | /* 370 */ 1690, 1718, 1595, 1751, 1751, 1762, 1762, 1699, 1703, 1826, | 162286 | /* 370 */ 1706, 1742, 1706, 1742, 1613, 1774, 1774, 1786, 1786, 1723, |
| 160499 | /* 380 */ 1595, 1695, 1699, 1707, 1710, 1614, 1847, 1863, 1863, 1871, | 162287 | /* 380 */ 1730, 1851, 1613, 1720, 1723, 1733, 1735, 1651, 1857, 1873, |
| 160500 | /* 390 */ 1871, 1871, 2037, 2037, 2037, 2037, 2037, 2037, 2037, 2037, | 162288 | /* 390 */ 1873, 1896, 1896, 1896, 2070, 2070, 2070, 2070, 2070, 2070, |
| 160501 | /* 400 */ 2037, 2037, 2037, 2037, 2037, 2037, 2037, 193, 837, 1194, | 162289 | /* 400 */ 2070, 2070, 2070, 2070, 2070, 2070, 2070, 2070, 2070, 207, |
| 160502 | /* 410 */ 1212, 506, 832, 1054, 1390, 925, 1435, 1394, 1102, 1332, | 162290 | /* 410 */ 915, 1010, 1030, 1217, 910, 1170, 1470, 1368, 1481, 1442, |
| 160503 | /* 420 */ 1419, 1196, 1420, 1425, 1433, 1447, 1457, 1488, 1443, 1379, | 162291 | /* 420 */ 1318, 1383, 1515, 1482, 1523, 1542, 1546, 1547, 1588, 1595, |
| 160504 | /* 430 */ 1572, 1455, 1503, 1453, 1495, 1515, 1506, 1526, 1460, 1489, | 162292 | /* 430 */ 1502, 1338, 1566, 1493, 1520, 1521, 1598, 1617, 1568, 1618, |
| 160505 | /* 440 */ 1581, 1622, 1534, 667, 1888, 1893, 1875, 1736, 1884, 1885, | 162293 | /* 440 */ 1511, 1514, 1645, 1649, 1570, 1484, 1910, 1915, 1897, 1757, |
| 160506 | /* 450 */ 1877, 1879, 1765, 1754, 1776, 1881, 1881, 1883, 1767, 1889, | 162294 | /* 450 */ 1908, 1909, 1901, 1903, 1788, 1778, 1798, 1911, 1911, 1913, |
| 160507 | /* 460 */ 1768, 1894, 1911, 1772, 1788, 1881, 1789, 1858, 1886, 1881, | 162295 | /* 460 */ 1793, 1918, 1795, 1924, 1940, 1800, 1814, 1911, 1815, 1882, |
| 160508 | /* 470 */ 1770, 1868, 1869, 1872, 1873, 1795, 1812, 1895, 1790, 1927, | 162296 | /* 470 */ 1912, 1911, 1796, 1895, 1898, 1900, 1902, 1824, 1840, 1923, |
| 160509 | /* 480 */ 1926, 1910, 1819, 1774, 1867, 1912, 1870, 1861, 1898, 1800, | 162297 | /* 480 */ 1818, 1957, 1955, 1939, 1847, 1803, 1899, 1938, 1904, 1890, |
| 160510 | /* 490 */ 1827, 1918, 1923, 1925, 1815, 1822, 1928, 1880, 1929, 1930, | 162298 | /* 490 */ 1925, 1827, 1854, 1946, 1951, 1954, 1843, 1850, 1956, 1914, |
| 160511 | /* 500 */ 1931, 1933, 1882, 1897, 1924, 1857, 1932, 1935, 1891, 1922, | 162299 | /* 500 */ 1958, 1960, 1953, 1961, 1917, 1920, 1962, 1881, 1959, 1963, |
| 160512 | /* 510 */ 1938, 1814, 1941, 1942, 1943, 1944, 1939, 1945, 1947, 1874, | 162300 | /* 510 */ 1921, 1952, 1967, 1842, 1970, 1971, 1972, 1973, 1968, 1974, |
| 160513 | /* 520 */ 1830, 1949, 1950, 1859, 1946, 1953, 1834, 1952, 1948, 1951, | 162301 | /* 520 */ 1976, 1905, 1858, 1977, 1978, 1887, 1975, 1982, 1862, 1981, |
| 160514 | /* 530 */ 1954, 1955, 1890, 1904, 1900, 1937, 1908, 1899, 1956, 1961, | 162302 | /* 530 */ 1979, 1980, 1983, 1984, 1919, 1933, 1926, 1966, 1936, 1922, |
| 160515 | /* 540 */ 1965, 1967, 1968, 1969, 1962, 1972, 1952, 1974, 1975, 1976, | 162303 | /* 540 */ 1985, 1993, 1998, 1997, 1999, 2000, 1988, 2003, 1981, 2004, |
| 160516 | /* 550 */ 1977, 1978, 1979, 1982, 1990, 1983, 1984, 1985, 1986, 1988, | 162304 | /* 550 */ 2005, 2006, 2007, 2008, 2009, 2001, 2020, 2012, 2013, 2014, |
| 160517 | /* 560 */ 1989, 1987, 1887, 1876, 1878, 1892, 1896, 1992, 1991, 1998, | 162305 | /* 560 */ 2015, 2017, 2018, 2011, 1906, 1907, 1916, 1927, 1928, 2019, |
| 160518 | /* 570 */ 2006, 2014, | 162306 | /* 570 */ 2022, 2027, 2042, 2045, |
| 160519 | }; | 162307 | }; |
| 160520 | #define YY_REDUCE_COUNT (406) | 162308 | #define YY_REDUCE_COUNT (408) |
| 160521 | #define YY_REDUCE_MIN (-272) | 162309 | #define YY_REDUCE_MIN (-267) |
| 160522 | #define YY_REDUCE_MAX (1693) | 162310 | #define YY_REDUCE_MAX (1715) |
| 160523 | static const short yy_reduce_ofst[] = { | 162311 | static const short yy_reduce_ofst[] = { |
| 160524 | /* 0 */ 109, 113, 272, 760, -178, -176, -192, -183, -180, -134, | 162312 | /* 0 */ -125, 733, 789, 241, 293, -123, -193, -191, -183, -187, |
| 160525 | /* 10 */ 213, 220, 371, -208, -205, -272, -197, 611, 632, 765, | 162313 | /* 10 */ -180, 83, 133, -207, -198, -267, -175, -6, 166, 313, |
| 160526 | /* 20 */ 786, 392, 943, 989, 503, 651, 1039, -18, 702, 821, | 162314 | /* 20 */ 487, 396, 489, 598, 615, 685, 687, 79, 781, 857, |
| 160527 | /* 30 */ 710, 812, -188, 380, -187, 555, 662, 1055, 1063, 1065, | 162315 | /* 30 */ 490, 616, 240, 334, -188, 796, 841, 843, 1003, 1005, |
| 160528 | /* 40 */ 1080, -267, -267, -267, -267, -267, -267, -267, -267, -267, | 162316 | /* 40 */ 1007, -260, -260, -260, -260, -260, -260, -260, -260, -260, |
| 160529 | /* 50 */ -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, | 162317 | /* 50 */ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, |
| 160530 | /* 60 */ -267, -267, -267, -267, -267, -267, -267, -267, -267, -267, | 162318 | /* 60 */ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, |
| 160531 | /* 70 */ -267, -267, -267, -267, -267, -267, -267, -267, 636, 811, | 162319 | /* 70 */ -260, -260, -260, -260, -260, -260, -260, -260, 158, 203, |
| 160532 | /* 80 */ 917, 936, 1006, 1008, 1017, 1060, 1064, 1069, 1075, 1105, | 162320 | /* 80 */ 391, 576, 724, 726, 886, 1021, 1035, 1063, 1081, 1083, |
| 160533 | /* 90 */ 1118, 1123, 1125, 1134, 1140, 1159, 1165, 1169, 1174, 1179, | 162321 | /* 90 */ 1097, 1099, 1117, 1152, 1155, 1158, 1163, 1165, 1167, 1169, |
| 160534 | /* 100 */ 1181, 1184, 1186, 1201, 1246, 1259, 1262, 1281, 1293, 1299, | 162322 | /* 100 */ 1172, 1180, 1183, 1198, 1200, 1205, 1215, 1225, 1227, 1236, |
| 160535 | /* 110 */ 1313, 1327, 1341, 1352, 1356, 1358, 1362, 1366, 1395, 1403, | 162323 | /* 110 */ 1252, 1264, 1299, 1303, 1306, 1309, 1312, 1315, 1325, 1328, |
| 160536 | /* 120 */ 1406, 1411, 1424, 1436, 1439, 1450, 1452, -267, -267, -267, | 162324 | /* 120 */ 1337, 1340, 1343, 1371, 1373, 1384, 1386, 1411, -260, -260, |
| 160537 | /* 130 */ -267, -267, -267, -267, -267, 224, -267, 446, -24, 275, | 162325 | /* 130 */ -260, -260, -260, -260, -260, -260, -260, -53, 138, 302, |
| 160538 | /* 140 */ 546, 518, 573, 560, 53, -181, -111, 485, 606, 671, | 162326 | /* 140 */ -158, 357, 223, -222, 411, 458, -92, 556, 669, 581, |
| 160539 | /* 150 */ 606, 671, 683, 8, 93, -267, -267, -267, -267, 155, | 162327 | /* 150 */ 632, 581, -260, 632, 758, 778, 920, -260, -260, -260, |
| 160540 | /* 160 */ 155, 155, 181, 242, 264, 486, 489, -218, 393, 227, | 162328 | /* 160 */ -260, 161, 161, 161, 307, 234, 392, 526, 790, 195, |
| 160541 | /* 170 */ 604, 347, 347, -171, 431, 650, 715, -166, 562, 609, | 162329 | /* 170 */ 359, -174, -173, 362, 362, -189, 16, 560, 567, 261, |
| 160542 | /* 180 */ 716, 764, 18, 823, 769, 833, 838, 957, 759, 119, | 162330 | /* 180 */ 689, 802, 853, -122, -166, 408, 335, 617, 690, 837, |
| 160543 | /* 190 */ 923, 226, 1014, 542, 603, 451, 949, 654, 659, 762, | 162331 | /* 190 */ 1001, 746, 1061, 515, 1082, 994, 1034, -135, 1000, 1048, |
| 160544 | /* 200 */ 964, -4, 778, 961, 712, 1082, 1100, 1111, 1026, 1117, | 162332 | /* 200 */ 1137, 877, 897, 186, 627, 1031, 1133, 1148, 1159, 1194, |
| 160545 | /* 210 */ -204, -174, -151, -8, 77, 198, 305, 327, 388, 540, | 162333 | /* 210 */ 1199, 1195, -194, -142, 18, -152, 68, 201, 253, 269, |
| 160546 | /* 220 */ 839, 968, 982, 985, 1004, 1023, 1070, 1086, 1097, 1130, | 162334 | /* 220 */ 294, 354, 521, 528, 676, 680, 736, 743, 850, 907, |
| 160547 | /* 230 */ 1190, 1163, 1199, 1284, 1297, 1300, 1314, 1339, 1353, 1391, | 162335 | /* 230 */ 1041, 1047, 1060, 727, 1139, 1147, 1201, 1237, 1278, 1359, |
| 160548 | /* 240 */ 1402, 1413, 1416, 1417, 803, 1376, 1400, 1428, 1437, 1446, | 162336 | /* 240 */ 1393, 1400, 1413, 1429, 1433, 1437, 1126, 1410, 1430, 1444, |
| 160549 | /* 250 */ 1378, 1461, 1464, 1465, 1249, 1329, 1466, 1467, 1414, 1468, | 162337 | /* 250 */ 1480, 1483, 1405, 1486, 1490, 1492, 1420, 1372, 1496, 1498, |
| 160550 | /* 260 */ 305, 1469, 1470, 1471, 1472, 1482, 1483, 1389, 1392, 1438, | 162338 | /* 260 */ 1441, 1499, 253, 1500, 1503, 1504, 1506, 1507, 1508, 1398, |
| 160551 | /* 270 */ 1426, 1427, 1432, 1434, 1378, 1438, 1438, 1440, 1474, 1499, | 162339 | /* 270 */ 1415, 1453, 1448, 1449, 1450, 1452, 1405, 1453, 1453, 1465, |
| 160552 | /* 280 */ 1399, 1421, 1430, 1456, 1441, 1442, 1444, 1415, 1473, 1431, | 162340 | /* 280 */ 1495, 1519, 1414, 1443, 1445, 1468, 1456, 1455, 1457, 1424, |
| 160553 | /* 290 */ 1445, 1476, 1449, 1478, 1418, 1479, 1477, 1485, 1493, 1494, | 162341 | /* 290 */ 1473, 1454, 1459, 1474, 1460, 1479, 1434, 1512, 1494, 1509, |
| 160554 | /* 300 */ 1496, 1458, 1475, 1480, 1459, 1490, 1484, 1518, 1448, 1451, | 162342 | /* 300 */ 1517, 1518, 1525, 1469, 1489, 1501, 1467, 1510, 1497, 1543, |
| 160555 | /* 310 */ 1537, 1538, 1463, 1481, 1541, 1486, 1487, 1491, 1519, 1514, | 162343 | /* 310 */ 1451, 1462, 1557, 1558, 1471, 1472, 1561, 1487, 1505, 1524, |
| 160556 | /* 320 */ 1521, 1523, 1525, 1552, 1556, 1520, 1492, 1498, 1522, 1497, | 162344 | /* 320 */ 1538, 1537, 1545, 1548, 1556, 1575, 1596, 1552, 1529, 1530, |
| 160557 | /* 330 */ 1539, 1528, 1542, 1532, 1571, 1573, 1500, 1504, 1582, 1584, | 162345 | /* 330 */ 1559, 1533, 1572, 1562, 1573, 1563, 1604, 1615, 1522, 1532, |
| 160558 | /* 340 */ 1563, 1586, 1588, 1589, 1597, 1567, 1579, 1585, 1590, 1568, | 162346 | /* 340 */ 1622, 1624, 1605, 1625, 1628, 1629, 1631, 1607, 1616, 1619, |
| 160559 | /* 350 */ 1583, 1587, 1593, 1591, 1598, 1599, 1600, 1602, 1606, 1513, | 162347 | /* 350 */ 1620, 1606, 1621, 1623, 1630, 1626, 1632, 1636, 1633, 1637, |
| 160560 | /* 360 */ 1524, 1548, 1549, 1611, 1574, 1576, 1594, 1603, 1604, 1607, | 162348 | /* 360 */ 1638, 1531, 1541, 1567, 1571, 1640, 1597, 1599, 1601, 1603, |
| 160561 | /* 370 */ 1605, 1608, 1642, 1527, 1529, 1609, 1610, 1601, 1615, 1575, | 162349 | /* 370 */ 1608, 1610, 1611, 1627, 1664, 1549, 1550, 1609, 1634, 1639, |
| 160562 | /* 380 */ 1650, 1578, 1619, 1623, 1625, 1624, 1674, 1685, 1686, 1691, | 162350 | /* 380 */ 1641, 1602, 1676, 1642, 1646, 1644, 1650, 1654, 1683, 1694, |
| 160563 | /* 390 */ 1692, 1693, 1612, 1613, 1617, 1675, 1668, 1673, 1676, 1677, | 162351 | /* 390 */ 1707, 1711, 1712, 1714, 1643, 1647, 1652, 1698, 1695, 1696, |
| 160564 | /* 400 */ 1680, 1666, 1669, 1678, 1681, 1683, 1687, | 162352 | /* 400 */ 1697, 1699, 1700, 1689, 1691, 1701, 1702, 1704, 1715, |
| 160565 | }; | 162353 | }; |
| 160566 | static const YYACTIONTYPE yy_default[] = { | 162354 | static const YYACTIONTYPE yy_default[] = { |
| 160567 | /* 0 */ 1633, 1633, 1633, 1462, 1230, 1341, 1230, 1230, 1230, 1462, | 162355 | /* 0 */ 1637, 1637, 1637, 1466, 1233, 1344, 1233, 1233, 1233, 1466, |
| 160568 | /* 10 */ 1462, 1462, 1230, 1371, 1371, 1515, 1263, 1230, 1230, 1230, | 162356 | /* 10 */ 1466, 1466, 1233, 1374, 1374, 1519, 1266, 1233, 1233, 1233, |
| 160569 | /* 20 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1461, 1230, 1230, | 162357 | /* 20 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1465, 1233, 1233, |
| 160570 | /* 30 */ 1230, 1230, 1550, 1550, 1230, 1230, 1230, 1230, 1230, 1230, | 162358 | /* 30 */ 1233, 1233, 1554, 1554, 1233, 1233, 1233, 1233, 1233, 1233, |
| 160571 | /* 40 */ 1230, 1230, 1380, 1230, 1387, 1230, 1230, 1230, 1230, 1230, | 162359 | /* 40 */ 1233, 1233, 1383, 1233, 1390, 1233, 1233, 1233, 1233, 1233, |
| 160572 | /* 50 */ 1463, 1464, 1230, 1230, 1230, 1514, 1516, 1479, 1394, 1393, | 162360 | /* 50 */ 1467, 1468, 1233, 1233, 1233, 1518, 1520, 1483, 1397, 1396, |
| 160573 | /* 60 */ 1392, 1391, 1497, 1358, 1385, 1378, 1382, 1457, 1458, 1456, | 162361 | /* 60 */ 1395, 1394, 1501, 1361, 1388, 1381, 1385, 1461, 1462, 1460, |
| 160574 | /* 70 */ 1460, 1464, 1463, 1230, 1381, 1428, 1442, 1427, 1230, 1230, | 162362 | /* 70 */ 1464, 1468, 1467, 1233, 1384, 1431, 1445, 1430, 1233, 1233, |
| 160575 | /* 80 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, | 162363 | /* 80 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, |
| 160576 | /* 90 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, | 162364 | /* 90 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, |
| 160577 | /* 100 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, | 162365 | /* 100 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, |
| 160578 | /* 110 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, | 162366 | /* 110 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, |
| 160579 | /* 120 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1436, 1441, 1447, | 162367 | /* 120 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1439, 1444, |
| 160580 | /* 130 */ 1440, 1437, 1430, 1429, 1431, 1230, 1432, 1230, 1254, 1230, | 162368 | /* 130 */ 1451, 1443, 1440, 1433, 1432, 1434, 1435, 1233, 1233, 1257, |
| 160581 | /* 140 */ 1230, 1251, 1305, 1230, 1230, 1230, 1230, 1230, 1534, 1533, | 162369 | /* 140 */ 1233, 1233, 1254, 1308, 1233, 1233, 1233, 1233, 1233, 1538, |
| 160582 | /* 150 */ 1230, 1230, 1263, 1422, 1421, 1433, 1434, 1444, 1443, 1522, | 162370 | /* 150 */ 1537, 1233, 1436, 1233, 1266, 1425, 1424, 1448, 1437, 1447, |
| 160583 | /* 160 */ 1586, 1585, 1480, 1230, 1230, 1230, 1230, 1230, 1230, 1550, | 162371 | /* 160 */ 1446, 1526, 1590, 1589, 1484, 1233, 1233, 1233, 1233, 1233, |
| 160584 | /* 170 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, | 162372 | /* 170 */ 1233, 1554, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, |
| 160585 | /* 180 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, | 162373 | /* 180 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, |
| 160586 | /* 190 */ 1230, 1230, 1230, 1550, 1550, 1230, 1263, 1550, 1550, 1259, | 162374 | /* 190 */ 1233, 1233, 1233, 1233, 1233, 1554, 1554, 1233, 1266, 1554, |
| 160587 | /* 200 */ 1259, 1365, 1230, 1529, 1332, 1332, 1332, 1332, 1341, 1332, | 162375 | /* 200 */ 1554, 1262, 1262, 1368, 1233, 1533, 1335, 1335, 1335, 1335, |
| 160588 | /* 210 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, | 162376 | /* 210 */ 1344, 1335, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, |
| 160589 | /* 220 */ 1230, 1230, 1230, 1230, 1230, 1519, 1517, 1230, 1230, 1230, | 162377 | /* 220 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1523, 1521, 1233, |
| 160590 | /* 230 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, | 162378 | /* 230 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, |
| 160591 | /* 240 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, | 162379 | /* 240 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, |
| 160592 | /* 250 */ 1230, 1230, 1230, 1230, 1337, 1230, 1230, 1230, 1230, 1230, | 162380 | /* 250 */ 1233, 1233, 1233, 1233, 1233, 1233, 1340, 1233, 1233, 1233, |
| 160593 | /* 260 */ 1230, 1230, 1230, 1230, 1230, 1230, 1579, 1230, 1492, 1319, | 162381 | /* 260 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1583, 1233, |
| 160594 | /* 270 */ 1337, 1337, 1337, 1337, 1339, 1320, 1318, 1331, 1264, 1237, | 162382 | /* 270 */ 1496, 1322, 1340, 1340, 1340, 1340, 1342, 1323, 1321, 1334, |
| 160595 | /* 280 */ 1625, 1397, 1386, 1338, 1360, 1386, 1360, 1622, 1384, 1397, | 162383 | /* 280 */ 1267, 1240, 1629, 1400, 1389, 1341, 1363, 1389, 1363, 1626, |
| 160596 | /* 290 */ 1397, 1384, 1397, 1338, 1622, 1280, 1602, 1275, 1371, 1371, | 162384 | /* 290 */ 1387, 1400, 1400, 1387, 1400, 1341, 1626, 1283, 1606, 1278, |
| 160597 | /* 300 */ 1371, 1360, 1365, 1365, 1459, 1338, 1331, 1230, 1625, 1625, | 162385 | /* 300 */ 1374, 1374, 1374, 1363, 1368, 1368, 1463, 1341, 1334, 1233, |
| 160598 | /* 310 */ 1346, 1346, 1624, 1624, 1346, 1480, 1609, 1406, 1308, 1314, | 162386 | /* 310 */ 1629, 1629, 1349, 1349, 1628, 1628, 1349, 1484, 1613, 1409, |
| 160599 | /* 320 */ 1314, 1314, 1314, 1346, 1248, 1384, 1609, 1609, 1384, 1406, | 162387 | /* 320 */ 1311, 1317, 1317, 1317, 1317, 1349, 1251, 1387, 1613, 1613, |
| 160600 | /* 330 */ 1308, 1384, 1308, 1384, 1346, 1248, 1496, 1619, 1346, 1248, | 162388 | /* 330 */ 1387, 1409, 1311, 1387, 1311, 1387, 1349, 1251, 1500, 1623, |
| 160601 | /* 340 */ 1470, 1346, 1248, 1346, 1248, 1470, 1306, 1306, 1306, 1295, | 162389 | /* 340 */ 1349, 1251, 1474, 1349, 1251, 1349, 1251, 1474, 1309, 1309, |
| 160602 | /* 350 */ 1230, 1230, 1470, 1306, 1280, 1306, 1295, 1306, 1306, 1568, | 162390 | /* 350 */ 1309, 1298, 1233, 1233, 1474, 1309, 1283, 1309, 1298, 1309, |
| 160603 | /* 360 */ 1230, 1474, 1474, 1470, 1364, 1359, 1364, 1359, 1364, 1359, | 162391 | /* 360 */ 1309, 1572, 1233, 1478, 1478, 1474, 1367, 1362, 1367, 1362, |
| 160604 | /* 370 */ 1364, 1359, 1346, 1560, 1560, 1374, 1374, 1379, 1365, 1465, | 162392 | /* 370 */ 1367, 1362, 1367, 1362, 1349, 1564, 1564, 1377, 1377, 1382, |
| 160605 | /* 380 */ 1346, 1230, 1379, 1377, 1375, 1384, 1298, 1582, 1582, 1578, | 162393 | /* 380 */ 1368, 1469, 1349, 1233, 1382, 1380, 1378, 1387, 1301, 1586, |
| 160606 | /* 390 */ 1578, 1578, 1630, 1630, 1529, 1595, 1263, 1263, 1263, 1263, | 162394 | /* 390 */ 1586, 1582, 1582, 1582, 1634, 1634, 1533, 1599, 1266, 1266, |
| 160607 | /* 400 */ 1595, 1282, 1282, 1264, 1264, 1263, 1595, 1230, 1230, 1230, | 162395 | /* 400 */ 1266, 1266, 1599, 1285, 1285, 1267, 1267, 1266, 1599, 1233, |
| 160608 | /* 410 */ 1230, 1230, 1230, 1590, 1230, 1524, 1481, 1350, 1230, 1230, | 162396 | /* 410 */ 1233, 1233, 1233, 1233, 1233, 1594, 1233, 1528, 1485, 1353, |
| 160609 | /* 420 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, | 162397 | /* 420 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, |
| 160610 | /* 430 */ 1230, 1230, 1535, 1230, 1230, 1230, 1230, 1230, 1230, 1230, | 162398 | /* 430 */ 1233, 1233, 1233, 1233, 1539, 1233, 1233, 1233, 1233, 1233, |
| 160611 | /* 440 */ 1230, 1230, 1230, 1411, 1230, 1233, 1526, 1230, 1230, 1230, | 162399 | /* 440 */ 1233, 1233, 1233, 1233, 1233, 1414, 1233, 1236, 1530, 1233, |
| 160612 | /* 450 */ 1230, 1230, 1230, 1230, 1230, 1388, 1389, 1351, 1230, 1230, | 162400 | /* 450 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1391, 1392, 1354, |
| 160613 | /* 460 */ 1230, 1230, 1230, 1230, 1230, 1403, 1230, 1230, 1230, 1398, | 162401 | /* 460 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1406, 1233, 1233, |
| 160614 | /* 470 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1621, 1230, | 162402 | /* 470 */ 1233, 1401, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, |
| 160615 | /* 480 */ 1230, 1230, 1230, 1230, 1230, 1495, 1494, 1230, 1230, 1348, | 162403 | /* 480 */ 1625, 1233, 1233, 1233, 1233, 1233, 1233, 1499, 1498, 1233, |
| 160616 | /* 490 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, | 162404 | /* 490 */ 1233, 1351, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, |
| 160617 | /* 500 */ 1230, 1230, 1230, 1278, 1230, 1230, 1230, 1230, 1230, 1230, | 162405 | /* 500 */ 1233, 1233, 1233, 1233, 1233, 1281, 1233, 1233, 1233, 1233, |
| 160618 | /* 510 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, | 162406 | /* 510 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, |
| 160619 | /* 520 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1376, 1230, 1230, | 162407 | /* 520 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1379, |
| 160620 | /* 530 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, | 162408 | /* 530 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, |
| 160621 | /* 540 */ 1230, 1230, 1565, 1366, 1230, 1230, 1612, 1230, 1230, 1230, | 162409 | /* 540 */ 1233, 1233, 1233, 1233, 1569, 1369, 1233, 1233, 1616, 1233, |
| 160622 | /* 550 */ 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, 1230, | 162410 | /* 550 */ 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, 1233, |
| 160623 | /* 560 */ 1230, 1606, 1322, 1413, 1230, 1412, 1416, 1252, 1230, 1242, | 162411 | /* 560 */ 1233, 1233, 1233, 1610, 1325, 1416, 1233, 1415, 1419, 1255, |
| 160624 | /* 570 */ 1230, 1230, | 162412 | /* 570 */ 1233, 1245, 1233, 1233, |
| 160625 | }; | 162413 | }; |
| 160626 | /********** End of lemon-generated parsing tables *****************************/ | 162414 | /********** End of lemon-generated parsing tables *****************************/ |
| 160627 | 162415 | ||
| @@ -160753,6 +162541,7 @@ static const YYCODETYPE yyFallback[] = { | |||
| 160753 | 0, /* SLASH => nothing */ | 162541 | 0, /* SLASH => nothing */ |
| 160754 | 0, /* REM => nothing */ | 162542 | 0, /* REM => nothing */ |
| 160755 | 0, /* CONCAT => nothing */ | 162543 | 0, /* CONCAT => nothing */ |
| 162544 | 0, /* PTR => nothing */ | ||
| 160756 | 0, /* COLLATE => nothing */ | 162545 | 0, /* COLLATE => nothing */ |
| 160757 | 0, /* BITNOT => nothing */ | 162546 | 0, /* BITNOT => nothing */ |
| 160758 | 0, /* ON => nothing */ | 162547 | 0, /* ON => nothing */ |
| @@ -161025,212 +162814,213 @@ static const char *const yyTokenName[] = { | |||
| 161025 | /* 109 */ "SLASH", | 162814 | /* 109 */ "SLASH", |
| 161026 | /* 110 */ "REM", | 162815 | /* 110 */ "REM", |
| 161027 | /* 111 */ "CONCAT", | 162816 | /* 111 */ "CONCAT", |
| 161028 | /* 112 */ "COLLATE", | 162817 | /* 112 */ "PTR", |
| 161029 | /* 113 */ "BITNOT", | 162818 | /* 113 */ "COLLATE", |
| 161030 | /* 114 */ "ON", | 162819 | /* 114 */ "BITNOT", |
| 161031 | /* 115 */ "INDEXED", | 162820 | /* 115 */ "ON", |
| 161032 | /* 116 */ "STRING", | 162821 | /* 116 */ "INDEXED", |
| 161033 | /* 117 */ "JOIN_KW", | 162822 | /* 117 */ "STRING", |
| 161034 | /* 118 */ "CONSTRAINT", | 162823 | /* 118 */ "JOIN_KW", |
| 161035 | /* 119 */ "DEFAULT", | 162824 | /* 119 */ "CONSTRAINT", |
| 161036 | /* 120 */ "NULL", | 162825 | /* 120 */ "DEFAULT", |
| 161037 | /* 121 */ "PRIMARY", | 162826 | /* 121 */ "NULL", |
| 161038 | /* 122 */ "UNIQUE", | 162827 | /* 122 */ "PRIMARY", |
| 161039 | /* 123 */ "CHECK", | 162828 | /* 123 */ "UNIQUE", |
| 161040 | /* 124 */ "REFERENCES", | 162829 | /* 124 */ "CHECK", |
| 161041 | /* 125 */ "AUTOINCR", | 162830 | /* 125 */ "REFERENCES", |
| 161042 | /* 126 */ "INSERT", | 162831 | /* 126 */ "AUTOINCR", |
| 161043 | /* 127 */ "DELETE", | 162832 | /* 127 */ "INSERT", |
| 161044 | /* 128 */ "UPDATE", | 162833 | /* 128 */ "DELETE", |
| 161045 | /* 129 */ "SET", | 162834 | /* 129 */ "UPDATE", |
| 161046 | /* 130 */ "DEFERRABLE", | 162835 | /* 130 */ "SET", |
| 161047 | /* 131 */ "FOREIGN", | 162836 | /* 131 */ "DEFERRABLE", |
| 161048 | /* 132 */ "DROP", | 162837 | /* 132 */ "FOREIGN", |
| 161049 | /* 133 */ "UNION", | 162838 | /* 133 */ "DROP", |
| 161050 | /* 134 */ "ALL", | 162839 | /* 134 */ "UNION", |
| 161051 | /* 135 */ "EXCEPT", | 162840 | /* 135 */ "ALL", |
| 161052 | /* 136 */ "INTERSECT", | 162841 | /* 136 */ "EXCEPT", |
| 161053 | /* 137 */ "SELECT", | 162842 | /* 137 */ "INTERSECT", |
| 161054 | /* 138 */ "VALUES", | 162843 | /* 138 */ "SELECT", |
| 161055 | /* 139 */ "DISTINCT", | 162844 | /* 139 */ "VALUES", |
| 161056 | /* 140 */ "DOT", | 162845 | /* 140 */ "DISTINCT", |
| 161057 | /* 141 */ "FROM", | 162846 | /* 141 */ "DOT", |
| 161058 | /* 142 */ "JOIN", | 162847 | /* 142 */ "FROM", |
| 161059 | /* 143 */ "USING", | 162848 | /* 143 */ "JOIN", |
| 161060 | /* 144 */ "ORDER", | 162849 | /* 144 */ "USING", |
| 161061 | /* 145 */ "GROUP", | 162850 | /* 145 */ "ORDER", |
| 161062 | /* 146 */ "HAVING", | 162851 | /* 146 */ "GROUP", |
| 161063 | /* 147 */ "LIMIT", | 162852 | /* 147 */ "HAVING", |
| 161064 | /* 148 */ "WHERE", | 162853 | /* 148 */ "LIMIT", |
| 161065 | /* 149 */ "RETURNING", | 162854 | /* 149 */ "WHERE", |
| 161066 | /* 150 */ "INTO", | 162855 | /* 150 */ "RETURNING", |
| 161067 | /* 151 */ "NOTHING", | 162856 | /* 151 */ "INTO", |
| 161068 | /* 152 */ "FLOAT", | 162857 | /* 152 */ "NOTHING", |
| 161069 | /* 153 */ "BLOB", | 162858 | /* 153 */ "FLOAT", |
| 161070 | /* 154 */ "INTEGER", | 162859 | /* 154 */ "BLOB", |
| 161071 | /* 155 */ "VARIABLE", | 162860 | /* 155 */ "INTEGER", |
| 161072 | /* 156 */ "CASE", | 162861 | /* 156 */ "VARIABLE", |
| 161073 | /* 157 */ "WHEN", | 162862 | /* 157 */ "CASE", |
| 161074 | /* 158 */ "THEN", | 162863 | /* 158 */ "WHEN", |
| 161075 | /* 159 */ "ELSE", | 162864 | /* 159 */ "THEN", |
| 161076 | /* 160 */ "INDEX", | 162865 | /* 160 */ "ELSE", |
| 161077 | /* 161 */ "ALTER", | 162866 | /* 161 */ "INDEX", |
| 161078 | /* 162 */ "ADD", | 162867 | /* 162 */ "ALTER", |
| 161079 | /* 163 */ "WINDOW", | 162868 | /* 163 */ "ADD", |
| 161080 | /* 164 */ "OVER", | 162869 | /* 164 */ "WINDOW", |
| 161081 | /* 165 */ "FILTER", | 162870 | /* 165 */ "OVER", |
| 161082 | /* 166 */ "COLUMN", | 162871 | /* 166 */ "FILTER", |
| 161083 | /* 167 */ "AGG_FUNCTION", | 162872 | /* 167 */ "COLUMN", |
| 161084 | /* 168 */ "AGG_COLUMN", | 162873 | /* 168 */ "AGG_FUNCTION", |
| 161085 | /* 169 */ "TRUEFALSE", | 162874 | /* 169 */ "AGG_COLUMN", |
| 161086 | /* 170 */ "ISNOT", | 162875 | /* 170 */ "TRUEFALSE", |
| 161087 | /* 171 */ "FUNCTION", | 162876 | /* 171 */ "ISNOT", |
| 161088 | /* 172 */ "UMINUS", | 162877 | /* 172 */ "FUNCTION", |
| 161089 | /* 173 */ "UPLUS", | 162878 | /* 173 */ "UMINUS", |
| 161090 | /* 174 */ "TRUTH", | 162879 | /* 174 */ "UPLUS", |
| 161091 | /* 175 */ "REGISTER", | 162880 | /* 175 */ "TRUTH", |
| 161092 | /* 176 */ "VECTOR", | 162881 | /* 176 */ "REGISTER", |
| 161093 | /* 177 */ "SELECT_COLUMN", | 162882 | /* 177 */ "VECTOR", |
| 161094 | /* 178 */ "IF_NULL_ROW", | 162883 | /* 178 */ "SELECT_COLUMN", |
| 161095 | /* 179 */ "ASTERISK", | 162884 | /* 179 */ "IF_NULL_ROW", |
| 161096 | /* 180 */ "SPAN", | 162885 | /* 180 */ "ASTERISK", |
| 161097 | /* 181 */ "ERROR", | 162886 | /* 181 */ "SPAN", |
| 161098 | /* 182 */ "SPACE", | 162887 | /* 182 */ "ERROR", |
| 161099 | /* 183 */ "ILLEGAL", | 162888 | /* 183 */ "SPACE", |
| 161100 | /* 184 */ "input", | 162889 | /* 184 */ "ILLEGAL", |
| 161101 | /* 185 */ "cmdlist", | 162890 | /* 185 */ "input", |
| 161102 | /* 186 */ "ecmd", | 162891 | /* 186 */ "cmdlist", |
| 161103 | /* 187 */ "cmdx", | 162892 | /* 187 */ "ecmd", |
| 161104 | /* 188 */ "explain", | 162893 | /* 188 */ "cmdx", |
| 161105 | /* 189 */ "cmd", | 162894 | /* 189 */ "explain", |
| 161106 | /* 190 */ "transtype", | 162895 | /* 190 */ "cmd", |
| 161107 | /* 191 */ "trans_opt", | 162896 | /* 191 */ "transtype", |
| 161108 | /* 192 */ "nm", | 162897 | /* 192 */ "trans_opt", |
| 161109 | /* 193 */ "savepoint_opt", | 162898 | /* 193 */ "nm", |
| 161110 | /* 194 */ "create_table", | 162899 | /* 194 */ "savepoint_opt", |
| 161111 | /* 195 */ "create_table_args", | 162900 | /* 195 */ "create_table", |
| 161112 | /* 196 */ "createkw", | 162901 | /* 196 */ "create_table_args", |
| 161113 | /* 197 */ "temp", | 162902 | /* 197 */ "createkw", |
| 161114 | /* 198 */ "ifnotexists", | 162903 | /* 198 */ "temp", |
| 161115 | /* 199 */ "dbnm", | 162904 | /* 199 */ "ifnotexists", |
| 161116 | /* 200 */ "columnlist", | 162905 | /* 200 */ "dbnm", |
| 161117 | /* 201 */ "conslist_opt", | 162906 | /* 201 */ "columnlist", |
| 161118 | /* 202 */ "table_option_set", | 162907 | /* 202 */ "conslist_opt", |
| 161119 | /* 203 */ "select", | 162908 | /* 203 */ "table_option_set", |
| 161120 | /* 204 */ "table_option", | 162909 | /* 204 */ "select", |
| 161121 | /* 205 */ "columnname", | 162910 | /* 205 */ "table_option", |
| 161122 | /* 206 */ "carglist", | 162911 | /* 206 */ "columnname", |
| 161123 | /* 207 */ "typetoken", | 162912 | /* 207 */ "carglist", |
| 161124 | /* 208 */ "typename", | 162913 | /* 208 */ "typetoken", |
| 161125 | /* 209 */ "signed", | 162914 | /* 209 */ "typename", |
| 161126 | /* 210 */ "plus_num", | 162915 | /* 210 */ "signed", |
| 161127 | /* 211 */ "minus_num", | 162916 | /* 211 */ "plus_num", |
| 161128 | /* 212 */ "scanpt", | 162917 | /* 212 */ "minus_num", |
| 161129 | /* 213 */ "scantok", | 162918 | /* 213 */ "scanpt", |
| 161130 | /* 214 */ "ccons", | 162919 | /* 214 */ "scantok", |
| 161131 | /* 215 */ "term", | 162920 | /* 215 */ "ccons", |
| 161132 | /* 216 */ "expr", | 162921 | /* 216 */ "term", |
| 161133 | /* 217 */ "onconf", | 162922 | /* 217 */ "expr", |
| 161134 | /* 218 */ "sortorder", | 162923 | /* 218 */ "onconf", |
| 161135 | /* 219 */ "autoinc", | 162924 | /* 219 */ "sortorder", |
| 161136 | /* 220 */ "eidlist_opt", | 162925 | /* 220 */ "autoinc", |
| 161137 | /* 221 */ "refargs", | 162926 | /* 221 */ "eidlist_opt", |
| 161138 | /* 222 */ "defer_subclause", | 162927 | /* 222 */ "refargs", |
| 161139 | /* 223 */ "generated", | 162928 | /* 223 */ "defer_subclause", |
| 161140 | /* 224 */ "refarg", | 162929 | /* 224 */ "generated", |
| 161141 | /* 225 */ "refact", | 162930 | /* 225 */ "refarg", |
| 161142 | /* 226 */ "init_deferred_pred_opt", | 162931 | /* 226 */ "refact", |
| 161143 | /* 227 */ "conslist", | 162932 | /* 227 */ "init_deferred_pred_opt", |
| 161144 | /* 228 */ "tconscomma", | 162933 | /* 228 */ "conslist", |
| 161145 | /* 229 */ "tcons", | 162934 | /* 229 */ "tconscomma", |
| 161146 | /* 230 */ "sortlist", | 162935 | /* 230 */ "tcons", |
| 161147 | /* 231 */ "eidlist", | 162936 | /* 231 */ "sortlist", |
| 161148 | /* 232 */ "defer_subclause_opt", | 162937 | /* 232 */ "eidlist", |
| 161149 | /* 233 */ "orconf", | 162938 | /* 233 */ "defer_subclause_opt", |
| 161150 | /* 234 */ "resolvetype", | 162939 | /* 234 */ "orconf", |
| 161151 | /* 235 */ "raisetype", | 162940 | /* 235 */ "resolvetype", |
| 161152 | /* 236 */ "ifexists", | 162941 | /* 236 */ "raisetype", |
| 161153 | /* 237 */ "fullname", | 162942 | /* 237 */ "ifexists", |
| 161154 | /* 238 */ "selectnowith", | 162943 | /* 238 */ "fullname", |
| 161155 | /* 239 */ "oneselect", | 162944 | /* 239 */ "selectnowith", |
| 161156 | /* 240 */ "wqlist", | 162945 | /* 240 */ "oneselect", |
| 161157 | /* 241 */ "multiselect_op", | 162946 | /* 241 */ "wqlist", |
| 161158 | /* 242 */ "distinct", | 162947 | /* 242 */ "multiselect_op", |
| 161159 | /* 243 */ "selcollist", | 162948 | /* 243 */ "distinct", |
| 161160 | /* 244 */ "from", | 162949 | /* 244 */ "selcollist", |
| 161161 | /* 245 */ "where_opt", | 162950 | /* 245 */ "from", |
| 161162 | /* 246 */ "groupby_opt", | 162951 | /* 246 */ "where_opt", |
| 161163 | /* 247 */ "having_opt", | 162952 | /* 247 */ "groupby_opt", |
| 161164 | /* 248 */ "orderby_opt", | 162953 | /* 248 */ "having_opt", |
| 161165 | /* 249 */ "limit_opt", | 162954 | /* 249 */ "orderby_opt", |
| 161166 | /* 250 */ "window_clause", | 162955 | /* 250 */ "limit_opt", |
| 161167 | /* 251 */ "values", | 162956 | /* 251 */ "window_clause", |
| 161168 | /* 252 */ "nexprlist", | 162957 | /* 252 */ "values", |
| 161169 | /* 253 */ "sclp", | 162958 | /* 253 */ "nexprlist", |
| 161170 | /* 254 */ "as", | 162959 | /* 254 */ "sclp", |
| 161171 | /* 255 */ "seltablist", | 162960 | /* 255 */ "as", |
| 161172 | /* 256 */ "stl_prefix", | 162961 | /* 256 */ "seltablist", |
| 161173 | /* 257 */ "joinop", | 162962 | /* 257 */ "stl_prefix", |
| 161174 | /* 258 */ "indexed_opt", | 162963 | /* 258 */ "joinop", |
| 161175 | /* 259 */ "on_opt", | 162964 | /* 259 */ "indexed_opt", |
| 161176 | /* 260 */ "using_opt", | 162965 | /* 260 */ "on_opt", |
| 161177 | /* 261 */ "exprlist", | 162966 | /* 261 */ "using_opt", |
| 161178 | /* 262 */ "xfullname", | 162967 | /* 262 */ "exprlist", |
| 161179 | /* 263 */ "idlist", | 162968 | /* 263 */ "xfullname", |
| 161180 | /* 264 */ "nulls", | 162969 | /* 264 */ "idlist", |
| 161181 | /* 265 */ "with", | 162970 | /* 265 */ "nulls", |
| 161182 | /* 266 */ "where_opt_ret", | 162971 | /* 266 */ "with", |
| 161183 | /* 267 */ "setlist", | 162972 | /* 267 */ "where_opt_ret", |
| 161184 | /* 268 */ "insert_cmd", | 162973 | /* 268 */ "setlist", |
| 161185 | /* 269 */ "idlist_opt", | 162974 | /* 269 */ "insert_cmd", |
| 161186 | /* 270 */ "upsert", | 162975 | /* 270 */ "idlist_opt", |
| 161187 | /* 271 */ "returning", | 162976 | /* 271 */ "upsert", |
| 161188 | /* 272 */ "filter_over", | 162977 | /* 272 */ "returning", |
| 161189 | /* 273 */ "likeop", | 162978 | /* 273 */ "filter_over", |
| 161190 | /* 274 */ "between_op", | 162979 | /* 274 */ "likeop", |
| 161191 | /* 275 */ "in_op", | 162980 | /* 275 */ "between_op", |
| 161192 | /* 276 */ "paren_exprlist", | 162981 | /* 276 */ "in_op", |
| 161193 | /* 277 */ "case_operand", | 162982 | /* 277 */ "paren_exprlist", |
| 161194 | /* 278 */ "case_exprlist", | 162983 | /* 278 */ "case_operand", |
| 161195 | /* 279 */ "case_else", | 162984 | /* 279 */ "case_exprlist", |
| 161196 | /* 280 */ "uniqueflag", | 162985 | /* 280 */ "case_else", |
| 161197 | /* 281 */ "collate", | 162986 | /* 281 */ "uniqueflag", |
| 161198 | /* 282 */ "vinto", | 162987 | /* 282 */ "collate", |
| 161199 | /* 283 */ "nmnum", | 162988 | /* 283 */ "vinto", |
| 161200 | /* 284 */ "trigger_decl", | 162989 | /* 284 */ "nmnum", |
| 161201 | /* 285 */ "trigger_cmd_list", | 162990 | /* 285 */ "trigger_decl", |
| 161202 | /* 286 */ "trigger_time", | 162991 | /* 286 */ "trigger_cmd_list", |
| 161203 | /* 287 */ "trigger_event", | 162992 | /* 287 */ "trigger_time", |
| 161204 | /* 288 */ "foreach_clause", | 162993 | /* 288 */ "trigger_event", |
| 161205 | /* 289 */ "when_clause", | 162994 | /* 289 */ "foreach_clause", |
| 161206 | /* 290 */ "trigger_cmd", | 162995 | /* 290 */ "when_clause", |
| 161207 | /* 291 */ "trnm", | 162996 | /* 291 */ "trigger_cmd", |
| 161208 | /* 292 */ "tridxby", | 162997 | /* 292 */ "trnm", |
| 161209 | /* 293 */ "database_kw_opt", | 162998 | /* 293 */ "tridxby", |
| 161210 | /* 294 */ "key_opt", | 162999 | /* 294 */ "database_kw_opt", |
| 161211 | /* 295 */ "add_column_fullname", | 163000 | /* 295 */ "key_opt", |
| 161212 | /* 296 */ "kwcolumn_opt", | 163001 | /* 296 */ "add_column_fullname", |
| 161213 | /* 297 */ "create_vtab", | 163002 | /* 297 */ "kwcolumn_opt", |
| 161214 | /* 298 */ "vtabarglist", | 163003 | /* 298 */ "create_vtab", |
| 161215 | /* 299 */ "vtabarg", | 163004 | /* 299 */ "vtabarglist", |
| 161216 | /* 300 */ "vtabargtoken", | 163005 | /* 300 */ "vtabarg", |
| 161217 | /* 301 */ "lp", | 163006 | /* 301 */ "vtabargtoken", |
| 161218 | /* 302 */ "anylist", | 163007 | /* 302 */ "lp", |
| 161219 | /* 303 */ "wqitem", | 163008 | /* 303 */ "anylist", |
| 161220 | /* 304 */ "wqas", | 163009 | /* 304 */ "wqitem", |
| 161221 | /* 305 */ "windowdefn_list", | 163010 | /* 305 */ "wqas", |
| 161222 | /* 306 */ "windowdefn", | 163011 | /* 306 */ "windowdefn_list", |
| 161223 | /* 307 */ "window", | 163012 | /* 307 */ "windowdefn", |
| 161224 | /* 308 */ "frame_opt", | 163013 | /* 308 */ "window", |
| 161225 | /* 309 */ "part_opt", | 163014 | /* 309 */ "frame_opt", |
| 161226 | /* 310 */ "filter_clause", | 163015 | /* 310 */ "part_opt", |
| 161227 | /* 311 */ "over_clause", | 163016 | /* 311 */ "filter_clause", |
| 161228 | /* 312 */ "range_or_rows", | 163017 | /* 312 */ "over_clause", |
| 161229 | /* 313 */ "frame_bound", | 163018 | /* 313 */ "range_or_rows", |
| 161230 | /* 314 */ "frame_bound_s", | 163019 | /* 314 */ "frame_bound", |
| 161231 | /* 315 */ "frame_bound_e", | 163020 | /* 315 */ "frame_bound_s", |
| 161232 | /* 316 */ "frame_exclude_opt", | 163021 | /* 316 */ "frame_bound_e", |
| 161233 | /* 317 */ "frame_exclude", | 163022 | /* 317 */ "frame_exclude_opt", |
| 163023 | /* 318 */ "frame_exclude", | ||
| 161234 | }; | 163024 | }; |
| 161235 | #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ | 163025 | #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ |
| 161236 | 163026 | ||
| @@ -161450,195 +163240,196 @@ static const char *const yyRuleName[] = { | |||
| 161450 | /* 209 */ "expr ::= NOT expr", | 163240 | /* 209 */ "expr ::= NOT expr", |
| 161451 | /* 210 */ "expr ::= BITNOT expr", | 163241 | /* 210 */ "expr ::= BITNOT expr", |
| 161452 | /* 211 */ "expr ::= PLUS|MINUS expr", | 163242 | /* 211 */ "expr ::= PLUS|MINUS expr", |
| 161453 | /* 212 */ "between_op ::= BETWEEN", | 163243 | /* 212 */ "expr ::= expr PTR expr", |
| 161454 | /* 213 */ "between_op ::= NOT BETWEEN", | 163244 | /* 213 */ "between_op ::= BETWEEN", |
| 161455 | /* 214 */ "expr ::= expr between_op expr AND expr", | 163245 | /* 214 */ "between_op ::= NOT BETWEEN", |
| 161456 | /* 215 */ "in_op ::= IN", | 163246 | /* 215 */ "expr ::= expr between_op expr AND expr", |
| 161457 | /* 216 */ "in_op ::= NOT IN", | 163247 | /* 216 */ "in_op ::= IN", |
| 161458 | /* 217 */ "expr ::= expr in_op LP exprlist RP", | 163248 | /* 217 */ "in_op ::= NOT IN", |
| 161459 | /* 218 */ "expr ::= LP select RP", | 163249 | /* 218 */ "expr ::= expr in_op LP exprlist RP", |
| 161460 | /* 219 */ "expr ::= expr in_op LP select RP", | 163250 | /* 219 */ "expr ::= LP select RP", |
| 161461 | /* 220 */ "expr ::= expr in_op nm dbnm paren_exprlist", | 163251 | /* 220 */ "expr ::= expr in_op LP select RP", |
| 161462 | /* 221 */ "expr ::= EXISTS LP select RP", | 163252 | /* 221 */ "expr ::= expr in_op nm dbnm paren_exprlist", |
| 161463 | /* 222 */ "expr ::= CASE case_operand case_exprlist case_else END", | 163253 | /* 222 */ "expr ::= EXISTS LP select RP", |
| 161464 | /* 223 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", | 163254 | /* 223 */ "expr ::= CASE case_operand case_exprlist case_else END", |
| 161465 | /* 224 */ "case_exprlist ::= WHEN expr THEN expr", | 163255 | /* 224 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", |
| 161466 | /* 225 */ "case_else ::= ELSE expr", | 163256 | /* 225 */ "case_exprlist ::= WHEN expr THEN expr", |
| 161467 | /* 226 */ "case_else ::=", | 163257 | /* 226 */ "case_else ::= ELSE expr", |
| 161468 | /* 227 */ "case_operand ::= expr", | 163258 | /* 227 */ "case_else ::=", |
| 161469 | /* 228 */ "case_operand ::=", | 163259 | /* 228 */ "case_operand ::= expr", |
| 161470 | /* 229 */ "exprlist ::=", | 163260 | /* 229 */ "case_operand ::=", |
| 161471 | /* 230 */ "nexprlist ::= nexprlist COMMA expr", | 163261 | /* 230 */ "exprlist ::=", |
| 161472 | /* 231 */ "nexprlist ::= expr", | 163262 | /* 231 */ "nexprlist ::= nexprlist COMMA expr", |
| 161473 | /* 232 */ "paren_exprlist ::=", | 163263 | /* 232 */ "nexprlist ::= expr", |
| 161474 | /* 233 */ "paren_exprlist ::= LP exprlist RP", | 163264 | /* 233 */ "paren_exprlist ::=", |
| 161475 | /* 234 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", | 163265 | /* 234 */ "paren_exprlist ::= LP exprlist RP", |
| 161476 | /* 235 */ "uniqueflag ::= UNIQUE", | 163266 | /* 235 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", |
| 161477 | /* 236 */ "uniqueflag ::=", | 163267 | /* 236 */ "uniqueflag ::= UNIQUE", |
| 161478 | /* 237 */ "eidlist_opt ::=", | 163268 | /* 237 */ "uniqueflag ::=", |
| 161479 | /* 238 */ "eidlist_opt ::= LP eidlist RP", | 163269 | /* 238 */ "eidlist_opt ::=", |
| 161480 | /* 239 */ "eidlist ::= eidlist COMMA nm collate sortorder", | 163270 | /* 239 */ "eidlist_opt ::= LP eidlist RP", |
| 161481 | /* 240 */ "eidlist ::= nm collate sortorder", | 163271 | /* 240 */ "eidlist ::= eidlist COMMA nm collate sortorder", |
| 161482 | /* 241 */ "collate ::=", | 163272 | /* 241 */ "eidlist ::= nm collate sortorder", |
| 161483 | /* 242 */ "collate ::= COLLATE ID|STRING", | 163273 | /* 242 */ "collate ::=", |
| 161484 | /* 243 */ "cmd ::= DROP INDEX ifexists fullname", | 163274 | /* 243 */ "collate ::= COLLATE ID|STRING", |
| 161485 | /* 244 */ "cmd ::= VACUUM vinto", | 163275 | /* 244 */ "cmd ::= DROP INDEX ifexists fullname", |
| 161486 | /* 245 */ "cmd ::= VACUUM nm vinto", | 163276 | /* 245 */ "cmd ::= VACUUM vinto", |
| 161487 | /* 246 */ "vinto ::= INTO expr", | 163277 | /* 246 */ "cmd ::= VACUUM nm vinto", |
| 161488 | /* 247 */ "vinto ::=", | 163278 | /* 247 */ "vinto ::= INTO expr", |
| 161489 | /* 248 */ "cmd ::= PRAGMA nm dbnm", | 163279 | /* 248 */ "vinto ::=", |
| 161490 | /* 249 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", | 163280 | /* 249 */ "cmd ::= PRAGMA nm dbnm", |
| 161491 | /* 250 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", | 163281 | /* 250 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", |
| 161492 | /* 251 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", | 163282 | /* 251 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", |
| 161493 | /* 252 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", | 163283 | /* 252 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", |
| 161494 | /* 253 */ "plus_num ::= PLUS INTEGER|FLOAT", | 163284 | /* 253 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", |
| 161495 | /* 254 */ "minus_num ::= MINUS INTEGER|FLOAT", | 163285 | /* 254 */ "plus_num ::= PLUS INTEGER|FLOAT", |
| 161496 | /* 255 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", | 163286 | /* 255 */ "minus_num ::= MINUS INTEGER|FLOAT", |
| 161497 | /* 256 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", | 163287 | /* 256 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", |
| 161498 | /* 257 */ "trigger_time ::= BEFORE|AFTER", | 163288 | /* 257 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", |
| 161499 | /* 258 */ "trigger_time ::= INSTEAD OF", | 163289 | /* 258 */ "trigger_time ::= BEFORE|AFTER", |
| 161500 | /* 259 */ "trigger_time ::=", | 163290 | /* 259 */ "trigger_time ::= INSTEAD OF", |
| 161501 | /* 260 */ "trigger_event ::= DELETE|INSERT", | 163291 | /* 260 */ "trigger_time ::=", |
| 161502 | /* 261 */ "trigger_event ::= UPDATE", | 163292 | /* 261 */ "trigger_event ::= DELETE|INSERT", |
| 161503 | /* 262 */ "trigger_event ::= UPDATE OF idlist", | 163293 | /* 262 */ "trigger_event ::= UPDATE", |
| 161504 | /* 263 */ "when_clause ::=", | 163294 | /* 263 */ "trigger_event ::= UPDATE OF idlist", |
| 161505 | /* 264 */ "when_clause ::= WHEN expr", | 163295 | /* 264 */ "when_clause ::=", |
| 161506 | /* 265 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", | 163296 | /* 265 */ "when_clause ::= WHEN expr", |
| 161507 | /* 266 */ "trigger_cmd_list ::= trigger_cmd SEMI", | 163297 | /* 266 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", |
| 161508 | /* 267 */ "trnm ::= nm DOT nm", | 163298 | /* 267 */ "trigger_cmd_list ::= trigger_cmd SEMI", |
| 161509 | /* 268 */ "tridxby ::= INDEXED BY nm", | 163299 | /* 268 */ "trnm ::= nm DOT nm", |
| 161510 | /* 269 */ "tridxby ::= NOT INDEXED", | 163300 | /* 269 */ "tridxby ::= INDEXED BY nm", |
| 161511 | /* 270 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt", | 163301 | /* 270 */ "tridxby ::= NOT INDEXED", |
| 161512 | /* 271 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", | 163302 | /* 271 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt", |
| 161513 | /* 272 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", | 163303 | /* 272 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", |
| 161514 | /* 273 */ "trigger_cmd ::= scanpt select scanpt", | 163304 | /* 273 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", |
| 161515 | /* 274 */ "expr ::= RAISE LP IGNORE RP", | 163305 | /* 274 */ "trigger_cmd ::= scanpt select scanpt", |
| 161516 | /* 275 */ "expr ::= RAISE LP raisetype COMMA nm RP", | 163306 | /* 275 */ "expr ::= RAISE LP IGNORE RP", |
| 161517 | /* 276 */ "raisetype ::= ROLLBACK", | 163307 | /* 276 */ "expr ::= RAISE LP raisetype COMMA nm RP", |
| 161518 | /* 277 */ "raisetype ::= ABORT", | 163308 | /* 277 */ "raisetype ::= ROLLBACK", |
| 161519 | /* 278 */ "raisetype ::= FAIL", | 163309 | /* 278 */ "raisetype ::= ABORT", |
| 161520 | /* 279 */ "cmd ::= DROP TRIGGER ifexists fullname", | 163310 | /* 279 */ "raisetype ::= FAIL", |
| 161521 | /* 280 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", | 163311 | /* 280 */ "cmd ::= DROP TRIGGER ifexists fullname", |
| 161522 | /* 281 */ "cmd ::= DETACH database_kw_opt expr", | 163312 | /* 281 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", |
| 161523 | /* 282 */ "key_opt ::=", | 163313 | /* 282 */ "cmd ::= DETACH database_kw_opt expr", |
| 161524 | /* 283 */ "key_opt ::= KEY expr", | 163314 | /* 283 */ "key_opt ::=", |
| 161525 | /* 284 */ "cmd ::= REINDEX", | 163315 | /* 284 */ "key_opt ::= KEY expr", |
| 161526 | /* 285 */ "cmd ::= REINDEX nm dbnm", | 163316 | /* 285 */ "cmd ::= REINDEX", |
| 161527 | /* 286 */ "cmd ::= ANALYZE", | 163317 | /* 286 */ "cmd ::= REINDEX nm dbnm", |
| 161528 | /* 287 */ "cmd ::= ANALYZE nm dbnm", | 163318 | /* 287 */ "cmd ::= ANALYZE", |
| 161529 | /* 288 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", | 163319 | /* 288 */ "cmd ::= ANALYZE nm dbnm", |
| 161530 | /* 289 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", | 163320 | /* 289 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", |
| 161531 | /* 290 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm", | 163321 | /* 290 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", |
| 161532 | /* 291 */ "add_column_fullname ::= fullname", | 163322 | /* 291 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm", |
| 161533 | /* 292 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", | 163323 | /* 292 */ "add_column_fullname ::= fullname", |
| 161534 | /* 293 */ "cmd ::= create_vtab", | 163324 | /* 293 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", |
| 161535 | /* 294 */ "cmd ::= create_vtab LP vtabarglist RP", | 163325 | /* 294 */ "cmd ::= create_vtab", |
| 161536 | /* 295 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", | 163326 | /* 295 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 161537 | /* 296 */ "vtabarg ::=", | 163327 | /* 296 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 161538 | /* 297 */ "vtabargtoken ::= ANY", | 163328 | /* 297 */ "vtabarg ::=", |
| 161539 | /* 298 */ "vtabargtoken ::= lp anylist RP", | 163329 | /* 298 */ "vtabargtoken ::= ANY", |
| 161540 | /* 299 */ "lp ::= LP", | 163330 | /* 299 */ "vtabargtoken ::= lp anylist RP", |
| 161541 | /* 300 */ "with ::= WITH wqlist", | 163331 | /* 300 */ "lp ::= LP", |
| 161542 | /* 301 */ "with ::= WITH RECURSIVE wqlist", | 163332 | /* 301 */ "with ::= WITH wqlist", |
| 161543 | /* 302 */ "wqas ::= AS", | 163333 | /* 302 */ "with ::= WITH RECURSIVE wqlist", |
| 161544 | /* 303 */ "wqas ::= AS MATERIALIZED", | 163334 | /* 303 */ "wqas ::= AS", |
| 161545 | /* 304 */ "wqas ::= AS NOT MATERIALIZED", | 163335 | /* 304 */ "wqas ::= AS MATERIALIZED", |
| 161546 | /* 305 */ "wqitem ::= nm eidlist_opt wqas LP select RP", | 163336 | /* 305 */ "wqas ::= AS NOT MATERIALIZED", |
| 161547 | /* 306 */ "wqlist ::= wqitem", | 163337 | /* 306 */ "wqitem ::= nm eidlist_opt wqas LP select RP", |
| 161548 | /* 307 */ "wqlist ::= wqlist COMMA wqitem", | 163338 | /* 307 */ "wqlist ::= wqitem", |
| 161549 | /* 308 */ "windowdefn_list ::= windowdefn", | 163339 | /* 308 */ "wqlist ::= wqlist COMMA wqitem", |
| 161550 | /* 309 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", | 163340 | /* 309 */ "windowdefn_list ::= windowdefn", |
| 161551 | /* 310 */ "windowdefn ::= nm AS LP window RP", | 163341 | /* 310 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", |
| 161552 | /* 311 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", | 163342 | /* 311 */ "windowdefn ::= nm AS LP window RP", |
| 161553 | /* 312 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", | 163343 | /* 312 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", |
| 161554 | /* 313 */ "window ::= ORDER BY sortlist frame_opt", | 163344 | /* 313 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", |
| 161555 | /* 314 */ "window ::= nm ORDER BY sortlist frame_opt", | 163345 | /* 314 */ "window ::= ORDER BY sortlist frame_opt", |
| 161556 | /* 315 */ "window ::= frame_opt", | 163346 | /* 315 */ "window ::= nm ORDER BY sortlist frame_opt", |
| 161557 | /* 316 */ "window ::= nm frame_opt", | 163347 | /* 316 */ "window ::= frame_opt", |
| 161558 | /* 317 */ "frame_opt ::=", | 163348 | /* 317 */ "window ::= nm frame_opt", |
| 161559 | /* 318 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", | 163349 | /* 318 */ "frame_opt ::=", |
| 161560 | /* 319 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", | 163350 | /* 319 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", |
| 161561 | /* 320 */ "range_or_rows ::= RANGE|ROWS|GROUPS", | 163351 | /* 320 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", |
| 161562 | /* 321 */ "frame_bound_s ::= frame_bound", | 163352 | /* 321 */ "range_or_rows ::= RANGE|ROWS|GROUPS", |
| 161563 | /* 322 */ "frame_bound_s ::= UNBOUNDED PRECEDING", | 163353 | /* 322 */ "frame_bound_s ::= frame_bound", |
| 161564 | /* 323 */ "frame_bound_e ::= frame_bound", | 163354 | /* 323 */ "frame_bound_s ::= UNBOUNDED PRECEDING", |
| 161565 | /* 324 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", | 163355 | /* 324 */ "frame_bound_e ::= frame_bound", |
| 161566 | /* 325 */ "frame_bound ::= expr PRECEDING|FOLLOWING", | 163356 | /* 325 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", |
| 161567 | /* 326 */ "frame_bound ::= CURRENT ROW", | 163357 | /* 326 */ "frame_bound ::= expr PRECEDING|FOLLOWING", |
| 161568 | /* 327 */ "frame_exclude_opt ::=", | 163358 | /* 327 */ "frame_bound ::= CURRENT ROW", |
| 161569 | /* 328 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", | 163359 | /* 328 */ "frame_exclude_opt ::=", |
| 161570 | /* 329 */ "frame_exclude ::= NO OTHERS", | 163360 | /* 329 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", |
| 161571 | /* 330 */ "frame_exclude ::= CURRENT ROW", | 163361 | /* 330 */ "frame_exclude ::= NO OTHERS", |
| 161572 | /* 331 */ "frame_exclude ::= GROUP|TIES", | 163362 | /* 331 */ "frame_exclude ::= CURRENT ROW", |
| 161573 | /* 332 */ "window_clause ::= WINDOW windowdefn_list", | 163363 | /* 332 */ "frame_exclude ::= GROUP|TIES", |
| 161574 | /* 333 */ "filter_over ::= filter_clause over_clause", | 163364 | /* 333 */ "window_clause ::= WINDOW windowdefn_list", |
| 161575 | /* 334 */ "filter_over ::= over_clause", | 163365 | /* 334 */ "filter_over ::= filter_clause over_clause", |
| 161576 | /* 335 */ "filter_over ::= filter_clause", | 163366 | /* 335 */ "filter_over ::= over_clause", |
| 161577 | /* 336 */ "over_clause ::= OVER LP window RP", | 163367 | /* 336 */ "filter_over ::= filter_clause", |
| 161578 | /* 337 */ "over_clause ::= OVER nm", | 163368 | /* 337 */ "over_clause ::= OVER LP window RP", |
| 161579 | /* 338 */ "filter_clause ::= FILTER LP WHERE expr RP", | 163369 | /* 338 */ "over_clause ::= OVER nm", |
| 161580 | /* 339 */ "input ::= cmdlist", | 163370 | /* 339 */ "filter_clause ::= FILTER LP WHERE expr RP", |
| 161581 | /* 340 */ "cmdlist ::= cmdlist ecmd", | 163371 | /* 340 */ "input ::= cmdlist", |
| 161582 | /* 341 */ "cmdlist ::= ecmd", | 163372 | /* 341 */ "cmdlist ::= cmdlist ecmd", |
| 161583 | /* 342 */ "ecmd ::= SEMI", | 163373 | /* 342 */ "cmdlist ::= ecmd", |
| 161584 | /* 343 */ "ecmd ::= cmdx SEMI", | 163374 | /* 343 */ "ecmd ::= SEMI", |
| 161585 | /* 344 */ "ecmd ::= explain cmdx SEMI", | 163375 | /* 344 */ "ecmd ::= cmdx SEMI", |
| 161586 | /* 345 */ "trans_opt ::=", | 163376 | /* 345 */ "ecmd ::= explain cmdx SEMI", |
| 161587 | /* 346 */ "trans_opt ::= TRANSACTION", | 163377 | /* 346 */ "trans_opt ::=", |
| 161588 | /* 347 */ "trans_opt ::= TRANSACTION nm", | 163378 | /* 347 */ "trans_opt ::= TRANSACTION", |
| 161589 | /* 348 */ "savepoint_opt ::= SAVEPOINT", | 163379 | /* 348 */ "trans_opt ::= TRANSACTION nm", |
| 161590 | /* 349 */ "savepoint_opt ::=", | 163380 | /* 349 */ "savepoint_opt ::= SAVEPOINT", |
| 161591 | /* 350 */ "cmd ::= create_table create_table_args", | 163381 | /* 350 */ "savepoint_opt ::=", |
| 161592 | /* 351 */ "table_option_set ::= table_option", | 163382 | /* 351 */ "cmd ::= create_table create_table_args", |
| 161593 | /* 352 */ "columnlist ::= columnlist COMMA columnname carglist", | 163383 | /* 352 */ "table_option_set ::= table_option", |
| 161594 | /* 353 */ "columnlist ::= columnname carglist", | 163384 | /* 353 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 161595 | /* 354 */ "nm ::= ID|INDEXED", | 163385 | /* 354 */ "columnlist ::= columnname carglist", |
| 161596 | /* 355 */ "nm ::= STRING", | 163386 | /* 355 */ "nm ::= ID|INDEXED", |
| 161597 | /* 356 */ "nm ::= JOIN_KW", | 163387 | /* 356 */ "nm ::= STRING", |
| 161598 | /* 357 */ "typetoken ::= typename", | 163388 | /* 357 */ "nm ::= JOIN_KW", |
| 161599 | /* 358 */ "typename ::= ID|STRING", | 163389 | /* 358 */ "typetoken ::= typename", |
| 161600 | /* 359 */ "signed ::= plus_num", | 163390 | /* 359 */ "typename ::= ID|STRING", |
| 161601 | /* 360 */ "signed ::= minus_num", | 163391 | /* 360 */ "signed ::= plus_num", |
| 161602 | /* 361 */ "carglist ::= carglist ccons", | 163392 | /* 361 */ "signed ::= minus_num", |
| 161603 | /* 362 */ "carglist ::=", | 163393 | /* 362 */ "carglist ::= carglist ccons", |
| 161604 | /* 363 */ "ccons ::= NULL onconf", | 163394 | /* 363 */ "carglist ::=", |
| 161605 | /* 364 */ "ccons ::= GENERATED ALWAYS AS generated", | 163395 | /* 364 */ "ccons ::= NULL onconf", |
| 161606 | /* 365 */ "ccons ::= AS generated", | 163396 | /* 365 */ "ccons ::= GENERATED ALWAYS AS generated", |
| 161607 | /* 366 */ "conslist_opt ::= COMMA conslist", | 163397 | /* 366 */ "ccons ::= AS generated", |
| 161608 | /* 367 */ "conslist ::= conslist tconscomma tcons", | 163398 | /* 367 */ "conslist_opt ::= COMMA conslist", |
| 161609 | /* 368 */ "conslist ::= tcons", | 163399 | /* 368 */ "conslist ::= conslist tconscomma tcons", |
| 161610 | /* 369 */ "tconscomma ::=", | 163400 | /* 369 */ "conslist ::= tcons", |
| 161611 | /* 370 */ "defer_subclause_opt ::= defer_subclause", | 163401 | /* 370 */ "tconscomma ::=", |
| 161612 | /* 371 */ "resolvetype ::= raisetype", | 163402 | /* 371 */ "defer_subclause_opt ::= defer_subclause", |
| 161613 | /* 372 */ "selectnowith ::= oneselect", | 163403 | /* 372 */ "resolvetype ::= raisetype", |
| 161614 | /* 373 */ "oneselect ::= values", | 163404 | /* 373 */ "selectnowith ::= oneselect", |
| 161615 | /* 374 */ "sclp ::= selcollist COMMA", | 163405 | /* 374 */ "oneselect ::= values", |
| 161616 | /* 375 */ "as ::= ID|STRING", | 163406 | /* 375 */ "sclp ::= selcollist COMMA", |
| 161617 | /* 376 */ "returning ::=", | 163407 | /* 376 */ "as ::= ID|STRING", |
| 161618 | /* 377 */ "expr ::= term", | 163408 | /* 377 */ "returning ::=", |
| 161619 | /* 378 */ "likeop ::= LIKE_KW|MATCH", | 163409 | /* 378 */ "expr ::= term", |
| 161620 | /* 379 */ "exprlist ::= nexprlist", | 163410 | /* 379 */ "likeop ::= LIKE_KW|MATCH", |
| 161621 | /* 380 */ "nmnum ::= plus_num", | 163411 | /* 380 */ "exprlist ::= nexprlist", |
| 161622 | /* 381 */ "nmnum ::= nm", | 163412 | /* 381 */ "nmnum ::= plus_num", |
| 161623 | /* 382 */ "nmnum ::= ON", | 163413 | /* 382 */ "nmnum ::= nm", |
| 161624 | /* 383 */ "nmnum ::= DELETE", | 163414 | /* 383 */ "nmnum ::= ON", |
| 161625 | /* 384 */ "nmnum ::= DEFAULT", | 163415 | /* 384 */ "nmnum ::= DELETE", |
| 161626 | /* 385 */ "plus_num ::= INTEGER|FLOAT", | 163416 | /* 385 */ "nmnum ::= DEFAULT", |
| 161627 | /* 386 */ "foreach_clause ::=", | 163417 | /* 386 */ "plus_num ::= INTEGER|FLOAT", |
| 161628 | /* 387 */ "foreach_clause ::= FOR EACH ROW", | 163418 | /* 387 */ "foreach_clause ::=", |
| 161629 | /* 388 */ "trnm ::= nm", | 163419 | /* 388 */ "foreach_clause ::= FOR EACH ROW", |
| 161630 | /* 389 */ "tridxby ::=", | 163420 | /* 389 */ "trnm ::= nm", |
| 161631 | /* 390 */ "database_kw_opt ::= DATABASE", | 163421 | /* 390 */ "tridxby ::=", |
| 161632 | /* 391 */ "database_kw_opt ::=", | 163422 | /* 391 */ "database_kw_opt ::= DATABASE", |
| 161633 | /* 392 */ "kwcolumn_opt ::=", | 163423 | /* 392 */ "database_kw_opt ::=", |
| 161634 | /* 393 */ "kwcolumn_opt ::= COLUMNKW", | 163424 | /* 393 */ "kwcolumn_opt ::=", |
| 161635 | /* 394 */ "vtabarglist ::= vtabarg", | 163425 | /* 394 */ "kwcolumn_opt ::= COLUMNKW", |
| 161636 | /* 395 */ "vtabarglist ::= vtabarglist COMMA vtabarg", | 163426 | /* 395 */ "vtabarglist ::= vtabarg", |
| 161637 | /* 396 */ "vtabarg ::= vtabarg vtabargtoken", | 163427 | /* 396 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 161638 | /* 397 */ "anylist ::=", | 163428 | /* 397 */ "vtabarg ::= vtabarg vtabargtoken", |
| 161639 | /* 398 */ "anylist ::= anylist LP anylist RP", | 163429 | /* 398 */ "anylist ::=", |
| 161640 | /* 399 */ "anylist ::= anylist ANY", | 163430 | /* 399 */ "anylist ::= anylist LP anylist RP", |
| 161641 | /* 400 */ "with ::=", | 163431 | /* 400 */ "anylist ::= anylist ANY", |
| 163432 | /* 401 */ "with ::=", | ||
| 161642 | }; | 163433 | }; |
| 161643 | #endif /* NDEBUG */ | 163434 | #endif /* NDEBUG */ |
| 161644 | 163435 | ||
| @@ -161764,99 +163555,99 @@ static void yy_destructor( | |||
| 161764 | ** inside the C code. | 163555 | ** inside the C code. |
| 161765 | */ | 163556 | */ |
| 161766 | /********* Begin destructor definitions ***************************************/ | 163557 | /********* Begin destructor definitions ***************************************/ |
| 161767 | case 203: /* select */ | 163558 | case 204: /* select */ |
| 161768 | case 238: /* selectnowith */ | 163559 | case 239: /* selectnowith */ |
| 161769 | case 239: /* oneselect */ | 163560 | case 240: /* oneselect */ |
| 161770 | case 251: /* values */ | 163561 | case 252: /* values */ |
| 161771 | { | 163562 | { |
| 161772 | sqlite3SelectDelete(pParse->db, (yypminor->yy303)); | 163563 | sqlite3SelectDelete(pParse->db, (yypminor->yy47)); |
| 161773 | } | 163564 | } |
| 161774 | break; | 163565 | break; |
| 161775 | case 215: /* term */ | 163566 | case 216: /* term */ |
| 161776 | case 216: /* expr */ | 163567 | case 217: /* expr */ |
| 161777 | case 245: /* where_opt */ | 163568 | case 246: /* where_opt */ |
| 161778 | case 247: /* having_opt */ | 163569 | case 248: /* having_opt */ |
| 161779 | case 259: /* on_opt */ | 163570 | case 260: /* on_opt */ |
| 161780 | case 266: /* where_opt_ret */ | 163571 | case 267: /* where_opt_ret */ |
| 161781 | case 277: /* case_operand */ | 163572 | case 278: /* case_operand */ |
| 161782 | case 279: /* case_else */ | 163573 | case 280: /* case_else */ |
| 161783 | case 282: /* vinto */ | 163574 | case 283: /* vinto */ |
| 161784 | case 289: /* when_clause */ | 163575 | case 290: /* when_clause */ |
| 161785 | case 294: /* key_opt */ | 163576 | case 295: /* key_opt */ |
| 161786 | case 310: /* filter_clause */ | 163577 | case 311: /* filter_clause */ |
| 161787 | { | 163578 | { |
| 161788 | sqlite3ExprDelete(pParse->db, (yypminor->yy626)); | 163579 | sqlite3ExprDelete(pParse->db, (yypminor->yy528)); |
| 161789 | } | 163580 | } |
| 161790 | break; | 163581 | break; |
| 161791 | case 220: /* eidlist_opt */ | 163582 | case 221: /* eidlist_opt */ |
| 161792 | case 230: /* sortlist */ | 163583 | case 231: /* sortlist */ |
| 161793 | case 231: /* eidlist */ | 163584 | case 232: /* eidlist */ |
| 161794 | case 243: /* selcollist */ | 163585 | case 244: /* selcollist */ |
| 161795 | case 246: /* groupby_opt */ | 163586 | case 247: /* groupby_opt */ |
| 161796 | case 248: /* orderby_opt */ | 163587 | case 249: /* orderby_opt */ |
| 161797 | case 252: /* nexprlist */ | 163588 | case 253: /* nexprlist */ |
| 161798 | case 253: /* sclp */ | 163589 | case 254: /* sclp */ |
| 161799 | case 261: /* exprlist */ | 163590 | case 262: /* exprlist */ |
| 161800 | case 267: /* setlist */ | 163591 | case 268: /* setlist */ |
| 161801 | case 276: /* paren_exprlist */ | 163592 | case 277: /* paren_exprlist */ |
| 161802 | case 278: /* case_exprlist */ | 163593 | case 279: /* case_exprlist */ |
| 161803 | case 309: /* part_opt */ | 163594 | case 310: /* part_opt */ |
| 161804 | { | 163595 | { |
| 161805 | sqlite3ExprListDelete(pParse->db, (yypminor->yy562)); | 163596 | sqlite3ExprListDelete(pParse->db, (yypminor->yy322)); |
| 161806 | } | 163597 | } |
| 161807 | break; | 163598 | break; |
| 161808 | case 237: /* fullname */ | 163599 | case 238: /* fullname */ |
| 161809 | case 244: /* from */ | 163600 | case 245: /* from */ |
| 161810 | case 255: /* seltablist */ | 163601 | case 256: /* seltablist */ |
| 161811 | case 256: /* stl_prefix */ | 163602 | case 257: /* stl_prefix */ |
| 161812 | case 262: /* xfullname */ | 163603 | case 263: /* xfullname */ |
| 161813 | { | 163604 | { |
| 161814 | sqlite3SrcListDelete(pParse->db, (yypminor->yy607)); | 163605 | sqlite3SrcListDelete(pParse->db, (yypminor->yy131)); |
| 161815 | } | 163606 | } |
| 161816 | break; | 163607 | break; |
| 161817 | case 240: /* wqlist */ | 163608 | case 241: /* wqlist */ |
| 161818 | { | 163609 | { |
| 161819 | sqlite3WithDelete(pParse->db, (yypminor->yy43)); | 163610 | sqlite3WithDelete(pParse->db, (yypminor->yy521)); |
| 161820 | } | 163611 | } |
| 161821 | break; | 163612 | break; |
| 161822 | case 250: /* window_clause */ | 163613 | case 251: /* window_clause */ |
| 161823 | case 305: /* windowdefn_list */ | 163614 | case 306: /* windowdefn_list */ |
| 161824 | { | 163615 | { |
| 161825 | sqlite3WindowListDelete(pParse->db, (yypminor->yy375)); | 163616 | sqlite3WindowListDelete(pParse->db, (yypminor->yy41)); |
| 161826 | } | 163617 | } |
| 161827 | break; | 163618 | break; |
| 161828 | case 260: /* using_opt */ | 163619 | case 261: /* using_opt */ |
| 161829 | case 263: /* idlist */ | 163620 | case 264: /* idlist */ |
| 161830 | case 269: /* idlist_opt */ | 163621 | case 270: /* idlist_opt */ |
| 161831 | { | 163622 | { |
| 161832 | sqlite3IdListDelete(pParse->db, (yypminor->yy240)); | 163623 | sqlite3IdListDelete(pParse->db, (yypminor->yy254)); |
| 161833 | } | 163624 | } |
| 161834 | break; | 163625 | break; |
| 161835 | case 272: /* filter_over */ | 163626 | case 273: /* filter_over */ |
| 161836 | case 306: /* windowdefn */ | 163627 | case 307: /* windowdefn */ |
| 161837 | case 307: /* window */ | 163628 | case 308: /* window */ |
| 161838 | case 308: /* frame_opt */ | 163629 | case 309: /* frame_opt */ |
| 161839 | case 311: /* over_clause */ | 163630 | case 312: /* over_clause */ |
| 161840 | { | 163631 | { |
| 161841 | sqlite3WindowDelete(pParse->db, (yypminor->yy375)); | 163632 | sqlite3WindowDelete(pParse->db, (yypminor->yy41)); |
| 161842 | } | 163633 | } |
| 161843 | break; | 163634 | break; |
| 161844 | case 285: /* trigger_cmd_list */ | 163635 | case 286: /* trigger_cmd_list */ |
| 161845 | case 290: /* trigger_cmd */ | 163636 | case 291: /* trigger_cmd */ |
| 161846 | { | 163637 | { |
| 161847 | sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy95)); | 163638 | sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy33)); |
| 161848 | } | 163639 | } |
| 161849 | break; | 163640 | break; |
| 161850 | case 287: /* trigger_event */ | 163641 | case 288: /* trigger_event */ |
| 161851 | { | 163642 | { |
| 161852 | sqlite3IdListDelete(pParse->db, (yypminor->yy570).b); | 163643 | sqlite3IdListDelete(pParse->db, (yypminor->yy180).b); |
| 161853 | } | 163644 | } |
| 161854 | break; | 163645 | break; |
| 161855 | case 313: /* frame_bound */ | 163646 | case 314: /* frame_bound */ |
| 161856 | case 314: /* frame_bound_s */ | 163647 | case 315: /* frame_bound_s */ |
| 161857 | case 315: /* frame_bound_e */ | 163648 | case 316: /* frame_bound_e */ |
| 161858 | { | 163649 | { |
| 161859 | sqlite3ExprDelete(pParse->db, (yypminor->yy81).pExpr); | 163650 | sqlite3ExprDelete(pParse->db, (yypminor->yy595).pExpr); |
| 161860 | } | 163651 | } |
| 161861 | break; | 163652 | break; |
| 161862 | /********* End destructor definitions *****************************************/ | 163653 | /********* End destructor definitions *****************************************/ |
| @@ -162147,407 +163938,408 @@ static void yy_shift( | |||
| 162147 | /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side | 163938 | /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side |
| 162148 | ** of that rule */ | 163939 | ** of that rule */ |
| 162149 | static const YYCODETYPE yyRuleInfoLhs[] = { | 163940 | static const YYCODETYPE yyRuleInfoLhs[] = { |
| 162150 | 188, /* (0) explain ::= EXPLAIN */ | 163941 | 189, /* (0) explain ::= EXPLAIN */ |
| 162151 | 188, /* (1) explain ::= EXPLAIN QUERY PLAN */ | 163942 | 189, /* (1) explain ::= EXPLAIN QUERY PLAN */ |
| 162152 | 187, /* (2) cmdx ::= cmd */ | 163943 | 188, /* (2) cmdx ::= cmd */ |
| 162153 | 189, /* (3) cmd ::= BEGIN transtype trans_opt */ | 163944 | 190, /* (3) cmd ::= BEGIN transtype trans_opt */ |
| 162154 | 190, /* (4) transtype ::= */ | 163945 | 191, /* (4) transtype ::= */ |
| 162155 | 190, /* (5) transtype ::= DEFERRED */ | 163946 | 191, /* (5) transtype ::= DEFERRED */ |
| 162156 | 190, /* (6) transtype ::= IMMEDIATE */ | 163947 | 191, /* (6) transtype ::= IMMEDIATE */ |
| 162157 | 190, /* (7) transtype ::= EXCLUSIVE */ | 163948 | 191, /* (7) transtype ::= EXCLUSIVE */ |
| 162158 | 189, /* (8) cmd ::= COMMIT|END trans_opt */ | 163949 | 190, /* (8) cmd ::= COMMIT|END trans_opt */ |
| 162159 | 189, /* (9) cmd ::= ROLLBACK trans_opt */ | 163950 | 190, /* (9) cmd ::= ROLLBACK trans_opt */ |
| 162160 | 189, /* (10) cmd ::= SAVEPOINT nm */ | 163951 | 190, /* (10) cmd ::= SAVEPOINT nm */ |
| 162161 | 189, /* (11) cmd ::= RELEASE savepoint_opt nm */ | 163952 | 190, /* (11) cmd ::= RELEASE savepoint_opt nm */ |
| 162162 | 189, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ | 163953 | 190, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ |
| 162163 | 194, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */ | 163954 | 195, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */ |
| 162164 | 196, /* (14) createkw ::= CREATE */ | 163955 | 197, /* (14) createkw ::= CREATE */ |
| 162165 | 198, /* (15) ifnotexists ::= */ | 163956 | 199, /* (15) ifnotexists ::= */ |
| 162166 | 198, /* (16) ifnotexists ::= IF NOT EXISTS */ | 163957 | 199, /* (16) ifnotexists ::= IF NOT EXISTS */ |
| 162167 | 197, /* (17) temp ::= TEMP */ | 163958 | 198, /* (17) temp ::= TEMP */ |
| 162168 | 197, /* (18) temp ::= */ | 163959 | 198, /* (18) temp ::= */ |
| 162169 | 195, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_option_set */ | 163960 | 196, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_option_set */ |
| 162170 | 195, /* (20) create_table_args ::= AS select */ | 163961 | 196, /* (20) create_table_args ::= AS select */ |
| 162171 | 202, /* (21) table_option_set ::= */ | 163962 | 203, /* (21) table_option_set ::= */ |
| 162172 | 202, /* (22) table_option_set ::= table_option_set COMMA table_option */ | 163963 | 203, /* (22) table_option_set ::= table_option_set COMMA table_option */ |
| 162173 | 204, /* (23) table_option ::= WITHOUT nm */ | 163964 | 205, /* (23) table_option ::= WITHOUT nm */ |
| 162174 | 204, /* (24) table_option ::= nm */ | 163965 | 205, /* (24) table_option ::= nm */ |
| 162175 | 205, /* (25) columnname ::= nm typetoken */ | 163966 | 206, /* (25) columnname ::= nm typetoken */ |
| 162176 | 207, /* (26) typetoken ::= */ | 163967 | 208, /* (26) typetoken ::= */ |
| 162177 | 207, /* (27) typetoken ::= typename LP signed RP */ | 163968 | 208, /* (27) typetoken ::= typename LP signed RP */ |
| 162178 | 207, /* (28) typetoken ::= typename LP signed COMMA signed RP */ | 163969 | 208, /* (28) typetoken ::= typename LP signed COMMA signed RP */ |
| 162179 | 208, /* (29) typename ::= typename ID|STRING */ | 163970 | 209, /* (29) typename ::= typename ID|STRING */ |
| 162180 | 212, /* (30) scanpt ::= */ | 163971 | 213, /* (30) scanpt ::= */ |
| 162181 | 213, /* (31) scantok ::= */ | 163972 | 214, /* (31) scantok ::= */ |
| 162182 | 214, /* (32) ccons ::= CONSTRAINT nm */ | 163973 | 215, /* (32) ccons ::= CONSTRAINT nm */ |
| 162183 | 214, /* (33) ccons ::= DEFAULT scantok term */ | 163974 | 215, /* (33) ccons ::= DEFAULT scantok term */ |
| 162184 | 214, /* (34) ccons ::= DEFAULT LP expr RP */ | 163975 | 215, /* (34) ccons ::= DEFAULT LP expr RP */ |
| 162185 | 214, /* (35) ccons ::= DEFAULT PLUS scantok term */ | 163976 | 215, /* (35) ccons ::= DEFAULT PLUS scantok term */ |
| 162186 | 214, /* (36) ccons ::= DEFAULT MINUS scantok term */ | 163977 | 215, /* (36) ccons ::= DEFAULT MINUS scantok term */ |
| 162187 | 214, /* (37) ccons ::= DEFAULT scantok ID|INDEXED */ | 163978 | 215, /* (37) ccons ::= DEFAULT scantok ID|INDEXED */ |
| 162188 | 214, /* (38) ccons ::= NOT NULL onconf */ | 163979 | 215, /* (38) ccons ::= NOT NULL onconf */ |
| 162189 | 214, /* (39) ccons ::= PRIMARY KEY sortorder onconf autoinc */ | 163980 | 215, /* (39) ccons ::= PRIMARY KEY sortorder onconf autoinc */ |
| 162190 | 214, /* (40) ccons ::= UNIQUE onconf */ | 163981 | 215, /* (40) ccons ::= UNIQUE onconf */ |
| 162191 | 214, /* (41) ccons ::= CHECK LP expr RP */ | 163982 | 215, /* (41) ccons ::= CHECK LP expr RP */ |
| 162192 | 214, /* (42) ccons ::= REFERENCES nm eidlist_opt refargs */ | 163983 | 215, /* (42) ccons ::= REFERENCES nm eidlist_opt refargs */ |
| 162193 | 214, /* (43) ccons ::= defer_subclause */ | 163984 | 215, /* (43) ccons ::= defer_subclause */ |
| 162194 | 214, /* (44) ccons ::= COLLATE ID|STRING */ | 163985 | 215, /* (44) ccons ::= COLLATE ID|STRING */ |
| 162195 | 223, /* (45) generated ::= LP expr RP */ | 163986 | 224, /* (45) generated ::= LP expr RP */ |
| 162196 | 223, /* (46) generated ::= LP expr RP ID */ | 163987 | 224, /* (46) generated ::= LP expr RP ID */ |
| 162197 | 219, /* (47) autoinc ::= */ | 163988 | 220, /* (47) autoinc ::= */ |
| 162198 | 219, /* (48) autoinc ::= AUTOINCR */ | 163989 | 220, /* (48) autoinc ::= AUTOINCR */ |
| 162199 | 221, /* (49) refargs ::= */ | 163990 | 222, /* (49) refargs ::= */ |
| 162200 | 221, /* (50) refargs ::= refargs refarg */ | 163991 | 222, /* (50) refargs ::= refargs refarg */ |
| 162201 | 224, /* (51) refarg ::= MATCH nm */ | 163992 | 225, /* (51) refarg ::= MATCH nm */ |
| 162202 | 224, /* (52) refarg ::= ON INSERT refact */ | 163993 | 225, /* (52) refarg ::= ON INSERT refact */ |
| 162203 | 224, /* (53) refarg ::= ON DELETE refact */ | 163994 | 225, /* (53) refarg ::= ON DELETE refact */ |
| 162204 | 224, /* (54) refarg ::= ON UPDATE refact */ | 163995 | 225, /* (54) refarg ::= ON UPDATE refact */ |
| 162205 | 225, /* (55) refact ::= SET NULL */ | 163996 | 226, /* (55) refact ::= SET NULL */ |
| 162206 | 225, /* (56) refact ::= SET DEFAULT */ | 163997 | 226, /* (56) refact ::= SET DEFAULT */ |
| 162207 | 225, /* (57) refact ::= CASCADE */ | 163998 | 226, /* (57) refact ::= CASCADE */ |
| 162208 | 225, /* (58) refact ::= RESTRICT */ | 163999 | 226, /* (58) refact ::= RESTRICT */ |
| 162209 | 225, /* (59) refact ::= NO ACTION */ | 164000 | 226, /* (59) refact ::= NO ACTION */ |
| 162210 | 222, /* (60) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ | 164001 | 223, /* (60) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ |
| 162211 | 222, /* (61) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ | 164002 | 223, /* (61) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ |
| 162212 | 226, /* (62) init_deferred_pred_opt ::= */ | 164003 | 227, /* (62) init_deferred_pred_opt ::= */ |
| 162213 | 226, /* (63) init_deferred_pred_opt ::= INITIALLY DEFERRED */ | 164004 | 227, /* (63) init_deferred_pred_opt ::= INITIALLY DEFERRED */ |
| 162214 | 226, /* (64) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ | 164005 | 227, /* (64) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ |
| 162215 | 201, /* (65) conslist_opt ::= */ | 164006 | 202, /* (65) conslist_opt ::= */ |
| 162216 | 228, /* (66) tconscomma ::= COMMA */ | 164007 | 229, /* (66) tconscomma ::= COMMA */ |
| 162217 | 229, /* (67) tcons ::= CONSTRAINT nm */ | 164008 | 230, /* (67) tcons ::= CONSTRAINT nm */ |
| 162218 | 229, /* (68) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ | 164009 | 230, /* (68) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ |
| 162219 | 229, /* (69) tcons ::= UNIQUE LP sortlist RP onconf */ | 164010 | 230, /* (69) tcons ::= UNIQUE LP sortlist RP onconf */ |
| 162220 | 229, /* (70) tcons ::= CHECK LP expr RP onconf */ | 164011 | 230, /* (70) tcons ::= CHECK LP expr RP onconf */ |
| 162221 | 229, /* (71) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ | 164012 | 230, /* (71) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ |
| 162222 | 232, /* (72) defer_subclause_opt ::= */ | 164013 | 233, /* (72) defer_subclause_opt ::= */ |
| 162223 | 217, /* (73) onconf ::= */ | 164014 | 218, /* (73) onconf ::= */ |
| 162224 | 217, /* (74) onconf ::= ON CONFLICT resolvetype */ | 164015 | 218, /* (74) onconf ::= ON CONFLICT resolvetype */ |
| 162225 | 233, /* (75) orconf ::= */ | 164016 | 234, /* (75) orconf ::= */ |
| 162226 | 233, /* (76) orconf ::= OR resolvetype */ | 164017 | 234, /* (76) orconf ::= OR resolvetype */ |
| 162227 | 234, /* (77) resolvetype ::= IGNORE */ | 164018 | 235, /* (77) resolvetype ::= IGNORE */ |
| 162228 | 234, /* (78) resolvetype ::= REPLACE */ | 164019 | 235, /* (78) resolvetype ::= REPLACE */ |
| 162229 | 189, /* (79) cmd ::= DROP TABLE ifexists fullname */ | 164020 | 190, /* (79) cmd ::= DROP TABLE ifexists fullname */ |
| 162230 | 236, /* (80) ifexists ::= IF EXISTS */ | 164021 | 237, /* (80) ifexists ::= IF EXISTS */ |
| 162231 | 236, /* (81) ifexists ::= */ | 164022 | 237, /* (81) ifexists ::= */ |
| 162232 | 189, /* (82) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ | 164023 | 190, /* (82) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ |
| 162233 | 189, /* (83) cmd ::= DROP VIEW ifexists fullname */ | 164024 | 190, /* (83) cmd ::= DROP VIEW ifexists fullname */ |
| 162234 | 189, /* (84) cmd ::= select */ | 164025 | 190, /* (84) cmd ::= select */ |
| 162235 | 203, /* (85) select ::= WITH wqlist selectnowith */ | 164026 | 204, /* (85) select ::= WITH wqlist selectnowith */ |
| 162236 | 203, /* (86) select ::= WITH RECURSIVE wqlist selectnowith */ | 164027 | 204, /* (86) select ::= WITH RECURSIVE wqlist selectnowith */ |
| 162237 | 203, /* (87) select ::= selectnowith */ | 164028 | 204, /* (87) select ::= selectnowith */ |
| 162238 | 238, /* (88) selectnowith ::= selectnowith multiselect_op oneselect */ | 164029 | 239, /* (88) selectnowith ::= selectnowith multiselect_op oneselect */ |
| 162239 | 241, /* (89) multiselect_op ::= UNION */ | 164030 | 242, /* (89) multiselect_op ::= UNION */ |
| 162240 | 241, /* (90) multiselect_op ::= UNION ALL */ | 164031 | 242, /* (90) multiselect_op ::= UNION ALL */ |
| 162241 | 241, /* (91) multiselect_op ::= EXCEPT|INTERSECT */ | 164032 | 242, /* (91) multiselect_op ::= EXCEPT|INTERSECT */ |
| 162242 | 239, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ | 164033 | 240, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ |
| 162243 | 239, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ | 164034 | 240, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ |
| 162244 | 251, /* (94) values ::= VALUES LP nexprlist RP */ | 164035 | 252, /* (94) values ::= VALUES LP nexprlist RP */ |
| 162245 | 251, /* (95) values ::= values COMMA LP nexprlist RP */ | 164036 | 252, /* (95) values ::= values COMMA LP nexprlist RP */ |
| 162246 | 242, /* (96) distinct ::= DISTINCT */ | 164037 | 243, /* (96) distinct ::= DISTINCT */ |
| 162247 | 242, /* (97) distinct ::= ALL */ | 164038 | 243, /* (97) distinct ::= ALL */ |
| 162248 | 242, /* (98) distinct ::= */ | 164039 | 243, /* (98) distinct ::= */ |
| 162249 | 253, /* (99) sclp ::= */ | 164040 | 254, /* (99) sclp ::= */ |
| 162250 | 243, /* (100) selcollist ::= sclp scanpt expr scanpt as */ | 164041 | 244, /* (100) selcollist ::= sclp scanpt expr scanpt as */ |
| 162251 | 243, /* (101) selcollist ::= sclp scanpt STAR */ | 164042 | 244, /* (101) selcollist ::= sclp scanpt STAR */ |
| 162252 | 243, /* (102) selcollist ::= sclp scanpt nm DOT STAR */ | 164043 | 244, /* (102) selcollist ::= sclp scanpt nm DOT STAR */ |
| 162253 | 254, /* (103) as ::= AS nm */ | 164044 | 255, /* (103) as ::= AS nm */ |
| 162254 | 254, /* (104) as ::= */ | 164045 | 255, /* (104) as ::= */ |
| 162255 | 244, /* (105) from ::= */ | 164046 | 245, /* (105) from ::= */ |
| 162256 | 244, /* (106) from ::= FROM seltablist */ | 164047 | 245, /* (106) from ::= FROM seltablist */ |
| 162257 | 256, /* (107) stl_prefix ::= seltablist joinop */ | 164048 | 257, /* (107) stl_prefix ::= seltablist joinop */ |
| 162258 | 256, /* (108) stl_prefix ::= */ | 164049 | 257, /* (108) stl_prefix ::= */ |
| 162259 | 255, /* (109) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ | 164050 | 256, /* (109) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ |
| 162260 | 255, /* (110) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ | 164051 | 256, /* (110) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ |
| 162261 | 255, /* (111) seltablist ::= stl_prefix LP select RP as on_opt using_opt */ | 164052 | 256, /* (111) seltablist ::= stl_prefix LP select RP as on_opt using_opt */ |
| 162262 | 255, /* (112) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ | 164053 | 256, /* (112) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ |
| 162263 | 199, /* (113) dbnm ::= */ | 164054 | 200, /* (113) dbnm ::= */ |
| 162264 | 199, /* (114) dbnm ::= DOT nm */ | 164055 | 200, /* (114) dbnm ::= DOT nm */ |
| 162265 | 237, /* (115) fullname ::= nm */ | 164056 | 238, /* (115) fullname ::= nm */ |
| 162266 | 237, /* (116) fullname ::= nm DOT nm */ | 164057 | 238, /* (116) fullname ::= nm DOT nm */ |
| 162267 | 262, /* (117) xfullname ::= nm */ | 164058 | 263, /* (117) xfullname ::= nm */ |
| 162268 | 262, /* (118) xfullname ::= nm DOT nm */ | 164059 | 263, /* (118) xfullname ::= nm DOT nm */ |
| 162269 | 262, /* (119) xfullname ::= nm DOT nm AS nm */ | 164060 | 263, /* (119) xfullname ::= nm DOT nm AS nm */ |
| 162270 | 262, /* (120) xfullname ::= nm AS nm */ | 164061 | 263, /* (120) xfullname ::= nm AS nm */ |
| 162271 | 257, /* (121) joinop ::= COMMA|JOIN */ | 164062 | 258, /* (121) joinop ::= COMMA|JOIN */ |
| 162272 | 257, /* (122) joinop ::= JOIN_KW JOIN */ | 164063 | 258, /* (122) joinop ::= JOIN_KW JOIN */ |
| 162273 | 257, /* (123) joinop ::= JOIN_KW nm JOIN */ | 164064 | 258, /* (123) joinop ::= JOIN_KW nm JOIN */ |
| 162274 | 257, /* (124) joinop ::= JOIN_KW nm nm JOIN */ | 164065 | 258, /* (124) joinop ::= JOIN_KW nm nm JOIN */ |
| 162275 | 259, /* (125) on_opt ::= ON expr */ | 164066 | 260, /* (125) on_opt ::= ON expr */ |
| 162276 | 259, /* (126) on_opt ::= */ | 164067 | 260, /* (126) on_opt ::= */ |
| 162277 | 258, /* (127) indexed_opt ::= */ | 164068 | 259, /* (127) indexed_opt ::= */ |
| 162278 | 258, /* (128) indexed_opt ::= INDEXED BY nm */ | 164069 | 259, /* (128) indexed_opt ::= INDEXED BY nm */ |
| 162279 | 258, /* (129) indexed_opt ::= NOT INDEXED */ | 164070 | 259, /* (129) indexed_opt ::= NOT INDEXED */ |
| 162280 | 260, /* (130) using_opt ::= USING LP idlist RP */ | 164071 | 261, /* (130) using_opt ::= USING LP idlist RP */ |
| 162281 | 260, /* (131) using_opt ::= */ | 164072 | 261, /* (131) using_opt ::= */ |
| 162282 | 248, /* (132) orderby_opt ::= */ | 164073 | 249, /* (132) orderby_opt ::= */ |
| 162283 | 248, /* (133) orderby_opt ::= ORDER BY sortlist */ | 164074 | 249, /* (133) orderby_opt ::= ORDER BY sortlist */ |
| 162284 | 230, /* (134) sortlist ::= sortlist COMMA expr sortorder nulls */ | 164075 | 231, /* (134) sortlist ::= sortlist COMMA expr sortorder nulls */ |
| 162285 | 230, /* (135) sortlist ::= expr sortorder nulls */ | 164076 | 231, /* (135) sortlist ::= expr sortorder nulls */ |
| 162286 | 218, /* (136) sortorder ::= ASC */ | 164077 | 219, /* (136) sortorder ::= ASC */ |
| 162287 | 218, /* (137) sortorder ::= DESC */ | 164078 | 219, /* (137) sortorder ::= DESC */ |
| 162288 | 218, /* (138) sortorder ::= */ | 164079 | 219, /* (138) sortorder ::= */ |
| 162289 | 264, /* (139) nulls ::= NULLS FIRST */ | 164080 | 265, /* (139) nulls ::= NULLS FIRST */ |
| 162290 | 264, /* (140) nulls ::= NULLS LAST */ | 164081 | 265, /* (140) nulls ::= NULLS LAST */ |
| 162291 | 264, /* (141) nulls ::= */ | 164082 | 265, /* (141) nulls ::= */ |
| 162292 | 246, /* (142) groupby_opt ::= */ | 164083 | 247, /* (142) groupby_opt ::= */ |
| 162293 | 246, /* (143) groupby_opt ::= GROUP BY nexprlist */ | 164084 | 247, /* (143) groupby_opt ::= GROUP BY nexprlist */ |
| 162294 | 247, /* (144) having_opt ::= */ | 164085 | 248, /* (144) having_opt ::= */ |
| 162295 | 247, /* (145) having_opt ::= HAVING expr */ | 164086 | 248, /* (145) having_opt ::= HAVING expr */ |
| 162296 | 249, /* (146) limit_opt ::= */ | 164087 | 250, /* (146) limit_opt ::= */ |
| 162297 | 249, /* (147) limit_opt ::= LIMIT expr */ | 164088 | 250, /* (147) limit_opt ::= LIMIT expr */ |
| 162298 | 249, /* (148) limit_opt ::= LIMIT expr OFFSET expr */ | 164089 | 250, /* (148) limit_opt ::= LIMIT expr OFFSET expr */ |
| 162299 | 249, /* (149) limit_opt ::= LIMIT expr COMMA expr */ | 164090 | 250, /* (149) limit_opt ::= LIMIT expr COMMA expr */ |
| 162300 | 189, /* (150) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ | 164091 | 190, /* (150) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ |
| 162301 | 245, /* (151) where_opt ::= */ | 164092 | 246, /* (151) where_opt ::= */ |
| 162302 | 245, /* (152) where_opt ::= WHERE expr */ | 164093 | 246, /* (152) where_opt ::= WHERE expr */ |
| 162303 | 266, /* (153) where_opt_ret ::= */ | 164094 | 267, /* (153) where_opt_ret ::= */ |
| 162304 | 266, /* (154) where_opt_ret ::= WHERE expr */ | 164095 | 267, /* (154) where_opt_ret ::= WHERE expr */ |
| 162305 | 266, /* (155) where_opt_ret ::= RETURNING selcollist */ | 164096 | 267, /* (155) where_opt_ret ::= RETURNING selcollist */ |
| 162306 | 266, /* (156) where_opt_ret ::= WHERE expr RETURNING selcollist */ | 164097 | 267, /* (156) where_opt_ret ::= WHERE expr RETURNING selcollist */ |
| 162307 | 189, /* (157) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ | 164098 | 190, /* (157) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ |
| 162308 | 267, /* (158) setlist ::= setlist COMMA nm EQ expr */ | 164099 | 268, /* (158) setlist ::= setlist COMMA nm EQ expr */ |
| 162309 | 267, /* (159) setlist ::= setlist COMMA LP idlist RP EQ expr */ | 164100 | 268, /* (159) setlist ::= setlist COMMA LP idlist RP EQ expr */ |
| 162310 | 267, /* (160) setlist ::= nm EQ expr */ | 164101 | 268, /* (160) setlist ::= nm EQ expr */ |
| 162311 | 267, /* (161) setlist ::= LP idlist RP EQ expr */ | 164102 | 268, /* (161) setlist ::= LP idlist RP EQ expr */ |
| 162312 | 189, /* (162) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ | 164103 | 190, /* (162) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ |
| 162313 | 189, /* (163) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ | 164104 | 190, /* (163) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ |
| 162314 | 270, /* (164) upsert ::= */ | 164105 | 271, /* (164) upsert ::= */ |
| 162315 | 270, /* (165) upsert ::= RETURNING selcollist */ | 164106 | 271, /* (165) upsert ::= RETURNING selcollist */ |
| 162316 | 270, /* (166) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ | 164107 | 271, /* (166) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ |
| 162317 | 270, /* (167) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ | 164108 | 271, /* (167) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ |
| 162318 | 270, /* (168) upsert ::= ON CONFLICT DO NOTHING returning */ | 164109 | 271, /* (168) upsert ::= ON CONFLICT DO NOTHING returning */ |
| 162319 | 270, /* (169) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ | 164110 | 271, /* (169) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ |
| 162320 | 271, /* (170) returning ::= RETURNING selcollist */ | 164111 | 272, /* (170) returning ::= RETURNING selcollist */ |
| 162321 | 268, /* (171) insert_cmd ::= INSERT orconf */ | 164112 | 269, /* (171) insert_cmd ::= INSERT orconf */ |
| 162322 | 268, /* (172) insert_cmd ::= REPLACE */ | 164113 | 269, /* (172) insert_cmd ::= REPLACE */ |
| 162323 | 269, /* (173) idlist_opt ::= */ | 164114 | 270, /* (173) idlist_opt ::= */ |
| 162324 | 269, /* (174) idlist_opt ::= LP idlist RP */ | 164115 | 270, /* (174) idlist_opt ::= LP idlist RP */ |
| 162325 | 263, /* (175) idlist ::= idlist COMMA nm */ | 164116 | 264, /* (175) idlist ::= idlist COMMA nm */ |
| 162326 | 263, /* (176) idlist ::= nm */ | 164117 | 264, /* (176) idlist ::= nm */ |
| 162327 | 216, /* (177) expr ::= LP expr RP */ | 164118 | 217, /* (177) expr ::= LP expr RP */ |
| 162328 | 216, /* (178) expr ::= ID|INDEXED */ | 164119 | 217, /* (178) expr ::= ID|INDEXED */ |
| 162329 | 216, /* (179) expr ::= JOIN_KW */ | 164120 | 217, /* (179) expr ::= JOIN_KW */ |
| 162330 | 216, /* (180) expr ::= nm DOT nm */ | 164121 | 217, /* (180) expr ::= nm DOT nm */ |
| 162331 | 216, /* (181) expr ::= nm DOT nm DOT nm */ | 164122 | 217, /* (181) expr ::= nm DOT nm DOT nm */ |
| 162332 | 215, /* (182) term ::= NULL|FLOAT|BLOB */ | 164123 | 216, /* (182) term ::= NULL|FLOAT|BLOB */ |
| 162333 | 215, /* (183) term ::= STRING */ | 164124 | 216, /* (183) term ::= STRING */ |
| 162334 | 215, /* (184) term ::= INTEGER */ | 164125 | 216, /* (184) term ::= INTEGER */ |
| 162335 | 216, /* (185) expr ::= VARIABLE */ | 164126 | 217, /* (185) expr ::= VARIABLE */ |
| 162336 | 216, /* (186) expr ::= expr COLLATE ID|STRING */ | 164127 | 217, /* (186) expr ::= expr COLLATE ID|STRING */ |
| 162337 | 216, /* (187) expr ::= CAST LP expr AS typetoken RP */ | 164128 | 217, /* (187) expr ::= CAST LP expr AS typetoken RP */ |
| 162338 | 216, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */ | 164129 | 217, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 162339 | 216, /* (189) expr ::= ID|INDEXED LP STAR RP */ | 164130 | 217, /* (189) expr ::= ID|INDEXED LP STAR RP */ |
| 162340 | 216, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ | 164131 | 217, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ |
| 162341 | 216, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */ | 164132 | 217, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */ |
| 162342 | 215, /* (192) term ::= CTIME_KW */ | 164133 | 216, /* (192) term ::= CTIME_KW */ |
| 162343 | 216, /* (193) expr ::= LP nexprlist COMMA expr RP */ | 164134 | 217, /* (193) expr ::= LP nexprlist COMMA expr RP */ |
| 162344 | 216, /* (194) expr ::= expr AND expr */ | 164135 | 217, /* (194) expr ::= expr AND expr */ |
| 162345 | 216, /* (195) expr ::= expr OR expr */ | 164136 | 217, /* (195) expr ::= expr OR expr */ |
| 162346 | 216, /* (196) expr ::= expr LT|GT|GE|LE expr */ | 164137 | 217, /* (196) expr ::= expr LT|GT|GE|LE expr */ |
| 162347 | 216, /* (197) expr ::= expr EQ|NE expr */ | 164138 | 217, /* (197) expr ::= expr EQ|NE expr */ |
| 162348 | 216, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ | 164139 | 217, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ |
| 162349 | 216, /* (199) expr ::= expr PLUS|MINUS expr */ | 164140 | 217, /* (199) expr ::= expr PLUS|MINUS expr */ |
| 162350 | 216, /* (200) expr ::= expr STAR|SLASH|REM expr */ | 164141 | 217, /* (200) expr ::= expr STAR|SLASH|REM expr */ |
| 162351 | 216, /* (201) expr ::= expr CONCAT expr */ | 164142 | 217, /* (201) expr ::= expr CONCAT expr */ |
| 162352 | 273, /* (202) likeop ::= NOT LIKE_KW|MATCH */ | 164143 | 274, /* (202) likeop ::= NOT LIKE_KW|MATCH */ |
| 162353 | 216, /* (203) expr ::= expr likeop expr */ | 164144 | 217, /* (203) expr ::= expr likeop expr */ |
| 162354 | 216, /* (204) expr ::= expr likeop expr ESCAPE expr */ | 164145 | 217, /* (204) expr ::= expr likeop expr ESCAPE expr */ |
| 162355 | 216, /* (205) expr ::= expr ISNULL|NOTNULL */ | 164146 | 217, /* (205) expr ::= expr ISNULL|NOTNULL */ |
| 162356 | 216, /* (206) expr ::= expr NOT NULL */ | 164147 | 217, /* (206) expr ::= expr NOT NULL */ |
| 162357 | 216, /* (207) expr ::= expr IS expr */ | 164148 | 217, /* (207) expr ::= expr IS expr */ |
| 162358 | 216, /* (208) expr ::= expr IS NOT expr */ | 164149 | 217, /* (208) expr ::= expr IS NOT expr */ |
| 162359 | 216, /* (209) expr ::= NOT expr */ | 164150 | 217, /* (209) expr ::= NOT expr */ |
| 162360 | 216, /* (210) expr ::= BITNOT expr */ | 164151 | 217, /* (210) expr ::= BITNOT expr */ |
| 162361 | 216, /* (211) expr ::= PLUS|MINUS expr */ | 164152 | 217, /* (211) expr ::= PLUS|MINUS expr */ |
| 162362 | 274, /* (212) between_op ::= BETWEEN */ | 164153 | 217, /* (212) expr ::= expr PTR expr */ |
| 162363 | 274, /* (213) between_op ::= NOT BETWEEN */ | 164154 | 275, /* (213) between_op ::= BETWEEN */ |
| 162364 | 216, /* (214) expr ::= expr between_op expr AND expr */ | 164155 | 275, /* (214) between_op ::= NOT BETWEEN */ |
| 162365 | 275, /* (215) in_op ::= IN */ | 164156 | 217, /* (215) expr ::= expr between_op expr AND expr */ |
| 162366 | 275, /* (216) in_op ::= NOT IN */ | 164157 | 276, /* (216) in_op ::= IN */ |
| 162367 | 216, /* (217) expr ::= expr in_op LP exprlist RP */ | 164158 | 276, /* (217) in_op ::= NOT IN */ |
| 162368 | 216, /* (218) expr ::= LP select RP */ | 164159 | 217, /* (218) expr ::= expr in_op LP exprlist RP */ |
| 162369 | 216, /* (219) expr ::= expr in_op LP select RP */ | 164160 | 217, /* (219) expr ::= LP select RP */ |
| 162370 | 216, /* (220) expr ::= expr in_op nm dbnm paren_exprlist */ | 164161 | 217, /* (220) expr ::= expr in_op LP select RP */ |
| 162371 | 216, /* (221) expr ::= EXISTS LP select RP */ | 164162 | 217, /* (221) expr ::= expr in_op nm dbnm paren_exprlist */ |
| 162372 | 216, /* (222) expr ::= CASE case_operand case_exprlist case_else END */ | 164163 | 217, /* (222) expr ::= EXISTS LP select RP */ |
| 162373 | 278, /* (223) case_exprlist ::= case_exprlist WHEN expr THEN expr */ | 164164 | 217, /* (223) expr ::= CASE case_operand case_exprlist case_else END */ |
| 162374 | 278, /* (224) case_exprlist ::= WHEN expr THEN expr */ | 164165 | 279, /* (224) case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 162375 | 279, /* (225) case_else ::= ELSE expr */ | 164166 | 279, /* (225) case_exprlist ::= WHEN expr THEN expr */ |
| 162376 | 279, /* (226) case_else ::= */ | 164167 | 280, /* (226) case_else ::= ELSE expr */ |
| 162377 | 277, /* (227) case_operand ::= expr */ | 164168 | 280, /* (227) case_else ::= */ |
| 162378 | 277, /* (228) case_operand ::= */ | 164169 | 278, /* (228) case_operand ::= expr */ |
| 162379 | 261, /* (229) exprlist ::= */ | 164170 | 278, /* (229) case_operand ::= */ |
| 162380 | 252, /* (230) nexprlist ::= nexprlist COMMA expr */ | 164171 | 262, /* (230) exprlist ::= */ |
| 162381 | 252, /* (231) nexprlist ::= expr */ | 164172 | 253, /* (231) nexprlist ::= nexprlist COMMA expr */ |
| 162382 | 276, /* (232) paren_exprlist ::= */ | 164173 | 253, /* (232) nexprlist ::= expr */ |
| 162383 | 276, /* (233) paren_exprlist ::= LP exprlist RP */ | 164174 | 277, /* (233) paren_exprlist ::= */ |
| 162384 | 189, /* (234) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ | 164175 | 277, /* (234) paren_exprlist ::= LP exprlist RP */ |
| 162385 | 280, /* (235) uniqueflag ::= UNIQUE */ | 164176 | 190, /* (235) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 162386 | 280, /* (236) uniqueflag ::= */ | 164177 | 281, /* (236) uniqueflag ::= UNIQUE */ |
| 162387 | 220, /* (237) eidlist_opt ::= */ | 164178 | 281, /* (237) uniqueflag ::= */ |
| 162388 | 220, /* (238) eidlist_opt ::= LP eidlist RP */ | 164179 | 221, /* (238) eidlist_opt ::= */ |
| 162389 | 231, /* (239) eidlist ::= eidlist COMMA nm collate sortorder */ | 164180 | 221, /* (239) eidlist_opt ::= LP eidlist RP */ |
| 162390 | 231, /* (240) eidlist ::= nm collate sortorder */ | 164181 | 232, /* (240) eidlist ::= eidlist COMMA nm collate sortorder */ |
| 162391 | 281, /* (241) collate ::= */ | 164182 | 232, /* (241) eidlist ::= nm collate sortorder */ |
| 162392 | 281, /* (242) collate ::= COLLATE ID|STRING */ | 164183 | 282, /* (242) collate ::= */ |
| 162393 | 189, /* (243) cmd ::= DROP INDEX ifexists fullname */ | 164184 | 282, /* (243) collate ::= COLLATE ID|STRING */ |
| 162394 | 189, /* (244) cmd ::= VACUUM vinto */ | 164185 | 190, /* (244) cmd ::= DROP INDEX ifexists fullname */ |
| 162395 | 189, /* (245) cmd ::= VACUUM nm vinto */ | 164186 | 190, /* (245) cmd ::= VACUUM vinto */ |
| 162396 | 282, /* (246) vinto ::= INTO expr */ | 164187 | 190, /* (246) cmd ::= VACUUM nm vinto */ |
| 162397 | 282, /* (247) vinto ::= */ | 164188 | 283, /* (247) vinto ::= INTO expr */ |
| 162398 | 189, /* (248) cmd ::= PRAGMA nm dbnm */ | 164189 | 283, /* (248) vinto ::= */ |
| 162399 | 189, /* (249) cmd ::= PRAGMA nm dbnm EQ nmnum */ | 164190 | 190, /* (249) cmd ::= PRAGMA nm dbnm */ |
| 162400 | 189, /* (250) cmd ::= PRAGMA nm dbnm LP nmnum RP */ | 164191 | 190, /* (250) cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 162401 | 189, /* (251) cmd ::= PRAGMA nm dbnm EQ minus_num */ | 164192 | 190, /* (251) cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 162402 | 189, /* (252) cmd ::= PRAGMA nm dbnm LP minus_num RP */ | 164193 | 190, /* (252) cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 162403 | 210, /* (253) plus_num ::= PLUS INTEGER|FLOAT */ | 164194 | 190, /* (253) cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 162404 | 211, /* (254) minus_num ::= MINUS INTEGER|FLOAT */ | 164195 | 211, /* (254) plus_num ::= PLUS INTEGER|FLOAT */ |
| 162405 | 189, /* (255) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ | 164196 | 212, /* (255) minus_num ::= MINUS INTEGER|FLOAT */ |
| 162406 | 284, /* (256) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ | 164197 | 190, /* (256) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 162407 | 286, /* (257) trigger_time ::= BEFORE|AFTER */ | 164198 | 285, /* (257) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 162408 | 286, /* (258) trigger_time ::= INSTEAD OF */ | 164199 | 287, /* (258) trigger_time ::= BEFORE|AFTER */ |
| 162409 | 286, /* (259) trigger_time ::= */ | 164200 | 287, /* (259) trigger_time ::= INSTEAD OF */ |
| 162410 | 287, /* (260) trigger_event ::= DELETE|INSERT */ | 164201 | 287, /* (260) trigger_time ::= */ |
| 162411 | 287, /* (261) trigger_event ::= UPDATE */ | 164202 | 288, /* (261) trigger_event ::= DELETE|INSERT */ |
| 162412 | 287, /* (262) trigger_event ::= UPDATE OF idlist */ | 164203 | 288, /* (262) trigger_event ::= UPDATE */ |
| 162413 | 289, /* (263) when_clause ::= */ | 164204 | 288, /* (263) trigger_event ::= UPDATE OF idlist */ |
| 162414 | 289, /* (264) when_clause ::= WHEN expr */ | 164205 | 290, /* (264) when_clause ::= */ |
| 162415 | 285, /* (265) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ | 164206 | 290, /* (265) when_clause ::= WHEN expr */ |
| 162416 | 285, /* (266) trigger_cmd_list ::= trigger_cmd SEMI */ | 164207 | 286, /* (266) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 162417 | 291, /* (267) trnm ::= nm DOT nm */ | 164208 | 286, /* (267) trigger_cmd_list ::= trigger_cmd SEMI */ |
| 162418 | 292, /* (268) tridxby ::= INDEXED BY nm */ | 164209 | 292, /* (268) trnm ::= nm DOT nm */ |
| 162419 | 292, /* (269) tridxby ::= NOT INDEXED */ | 164210 | 293, /* (269) tridxby ::= INDEXED BY nm */ |
| 162420 | 290, /* (270) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ | 164211 | 293, /* (270) tridxby ::= NOT INDEXED */ |
| 162421 | 290, /* (271) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ | 164212 | 291, /* (271) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ |
| 162422 | 290, /* (272) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ | 164213 | 291, /* (272) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 162423 | 290, /* (273) trigger_cmd ::= scanpt select scanpt */ | 164214 | 291, /* (273) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 162424 | 216, /* (274) expr ::= RAISE LP IGNORE RP */ | 164215 | 291, /* (274) trigger_cmd ::= scanpt select scanpt */ |
| 162425 | 216, /* (275) expr ::= RAISE LP raisetype COMMA nm RP */ | 164216 | 217, /* (275) expr ::= RAISE LP IGNORE RP */ |
| 162426 | 235, /* (276) raisetype ::= ROLLBACK */ | 164217 | 217, /* (276) expr ::= RAISE LP raisetype COMMA nm RP */ |
| 162427 | 235, /* (277) raisetype ::= ABORT */ | 164218 | 236, /* (277) raisetype ::= ROLLBACK */ |
| 162428 | 235, /* (278) raisetype ::= FAIL */ | 164219 | 236, /* (278) raisetype ::= ABORT */ |
| 162429 | 189, /* (279) cmd ::= DROP TRIGGER ifexists fullname */ | 164220 | 236, /* (279) raisetype ::= FAIL */ |
| 162430 | 189, /* (280) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ | 164221 | 190, /* (280) cmd ::= DROP TRIGGER ifexists fullname */ |
| 162431 | 189, /* (281) cmd ::= DETACH database_kw_opt expr */ | 164222 | 190, /* (281) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 162432 | 294, /* (282) key_opt ::= */ | 164223 | 190, /* (282) cmd ::= DETACH database_kw_opt expr */ |
| 162433 | 294, /* (283) key_opt ::= KEY expr */ | 164224 | 295, /* (283) key_opt ::= */ |
| 162434 | 189, /* (284) cmd ::= REINDEX */ | 164225 | 295, /* (284) key_opt ::= KEY expr */ |
| 162435 | 189, /* (285) cmd ::= REINDEX nm dbnm */ | 164226 | 190, /* (285) cmd ::= REINDEX */ |
| 162436 | 189, /* (286) cmd ::= ANALYZE */ | 164227 | 190, /* (286) cmd ::= REINDEX nm dbnm */ |
| 162437 | 189, /* (287) cmd ::= ANALYZE nm dbnm */ | 164228 | 190, /* (287) cmd ::= ANALYZE */ |
| 162438 | 189, /* (288) cmd ::= ALTER TABLE fullname RENAME TO nm */ | 164229 | 190, /* (288) cmd ::= ANALYZE nm dbnm */ |
| 162439 | 189, /* (289) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ | 164230 | 190, /* (289) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 162440 | 189, /* (290) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ | 164231 | 190, /* (290) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 162441 | 295, /* (291) add_column_fullname ::= fullname */ | 164232 | 190, /* (291) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ |
| 162442 | 189, /* (292) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ | 164233 | 296, /* (292) add_column_fullname ::= fullname */ |
| 162443 | 189, /* (293) cmd ::= create_vtab */ | 164234 | 190, /* (293) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 162444 | 189, /* (294) cmd ::= create_vtab LP vtabarglist RP */ | 164235 | 190, /* (294) cmd ::= create_vtab */ |
| 162445 | 297, /* (295) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ | 164236 | 190, /* (295) cmd ::= create_vtab LP vtabarglist RP */ |
| 162446 | 299, /* (296) vtabarg ::= */ | 164237 | 298, /* (296) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 162447 | 300, /* (297) vtabargtoken ::= ANY */ | 164238 | 300, /* (297) vtabarg ::= */ |
| 162448 | 300, /* (298) vtabargtoken ::= lp anylist RP */ | 164239 | 301, /* (298) vtabargtoken ::= ANY */ |
| 162449 | 301, /* (299) lp ::= LP */ | 164240 | 301, /* (299) vtabargtoken ::= lp anylist RP */ |
| 162450 | 265, /* (300) with ::= WITH wqlist */ | 164241 | 302, /* (300) lp ::= LP */ |
| 162451 | 265, /* (301) with ::= WITH RECURSIVE wqlist */ | 164242 | 266, /* (301) with ::= WITH wqlist */ |
| 162452 | 304, /* (302) wqas ::= AS */ | 164243 | 266, /* (302) with ::= WITH RECURSIVE wqlist */ |
| 162453 | 304, /* (303) wqas ::= AS MATERIALIZED */ | 164244 | 305, /* (303) wqas ::= AS */ |
| 162454 | 304, /* (304) wqas ::= AS NOT MATERIALIZED */ | 164245 | 305, /* (304) wqas ::= AS MATERIALIZED */ |
| 162455 | 303, /* (305) wqitem ::= nm eidlist_opt wqas LP select RP */ | 164246 | 305, /* (305) wqas ::= AS NOT MATERIALIZED */ |
| 162456 | 240, /* (306) wqlist ::= wqitem */ | 164247 | 304, /* (306) wqitem ::= nm eidlist_opt wqas LP select RP */ |
| 162457 | 240, /* (307) wqlist ::= wqlist COMMA wqitem */ | 164248 | 241, /* (307) wqlist ::= wqitem */ |
| 162458 | 305, /* (308) windowdefn_list ::= windowdefn */ | 164249 | 241, /* (308) wqlist ::= wqlist COMMA wqitem */ |
| 162459 | 305, /* (309) windowdefn_list ::= windowdefn_list COMMA windowdefn */ | 164250 | 306, /* (309) windowdefn_list ::= windowdefn */ |
| 162460 | 306, /* (310) windowdefn ::= nm AS LP window RP */ | 164251 | 306, /* (310) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 162461 | 307, /* (311) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ | 164252 | 307, /* (311) windowdefn ::= nm AS LP window RP */ |
| 162462 | 307, /* (312) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ | 164253 | 308, /* (312) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 162463 | 307, /* (313) window ::= ORDER BY sortlist frame_opt */ | 164254 | 308, /* (313) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 162464 | 307, /* (314) window ::= nm ORDER BY sortlist frame_opt */ | 164255 | 308, /* (314) window ::= ORDER BY sortlist frame_opt */ |
| 162465 | 307, /* (315) window ::= frame_opt */ | 164256 | 308, /* (315) window ::= nm ORDER BY sortlist frame_opt */ |
| 162466 | 307, /* (316) window ::= nm frame_opt */ | 164257 | 308, /* (316) window ::= frame_opt */ |
| 162467 | 308, /* (317) frame_opt ::= */ | 164258 | 308, /* (317) window ::= nm frame_opt */ |
| 162468 | 308, /* (318) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ | 164259 | 309, /* (318) frame_opt ::= */ |
| 162469 | 308, /* (319) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ | 164260 | 309, /* (319) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 162470 | 312, /* (320) range_or_rows ::= RANGE|ROWS|GROUPS */ | 164261 | 309, /* (320) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 162471 | 314, /* (321) frame_bound_s ::= frame_bound */ | 164262 | 313, /* (321) range_or_rows ::= RANGE|ROWS|GROUPS */ |
| 162472 | 314, /* (322) frame_bound_s ::= UNBOUNDED PRECEDING */ | 164263 | 315, /* (322) frame_bound_s ::= frame_bound */ |
| 162473 | 315, /* (323) frame_bound_e ::= frame_bound */ | 164264 | 315, /* (323) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 162474 | 315, /* (324) frame_bound_e ::= UNBOUNDED FOLLOWING */ | 164265 | 316, /* (324) frame_bound_e ::= frame_bound */ |
| 162475 | 313, /* (325) frame_bound ::= expr PRECEDING|FOLLOWING */ | 164266 | 316, /* (325) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 162476 | 313, /* (326) frame_bound ::= CURRENT ROW */ | 164267 | 314, /* (326) frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 162477 | 316, /* (327) frame_exclude_opt ::= */ | 164268 | 314, /* (327) frame_bound ::= CURRENT ROW */ |
| 162478 | 316, /* (328) frame_exclude_opt ::= EXCLUDE frame_exclude */ | 164269 | 317, /* (328) frame_exclude_opt ::= */ |
| 162479 | 317, /* (329) frame_exclude ::= NO OTHERS */ | 164270 | 317, /* (329) frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 162480 | 317, /* (330) frame_exclude ::= CURRENT ROW */ | 164271 | 318, /* (330) frame_exclude ::= NO OTHERS */ |
| 162481 | 317, /* (331) frame_exclude ::= GROUP|TIES */ | 164272 | 318, /* (331) frame_exclude ::= CURRENT ROW */ |
| 162482 | 250, /* (332) window_clause ::= WINDOW windowdefn_list */ | 164273 | 318, /* (332) frame_exclude ::= GROUP|TIES */ |
| 162483 | 272, /* (333) filter_over ::= filter_clause over_clause */ | 164274 | 251, /* (333) window_clause ::= WINDOW windowdefn_list */ |
| 162484 | 272, /* (334) filter_over ::= over_clause */ | 164275 | 273, /* (334) filter_over ::= filter_clause over_clause */ |
| 162485 | 272, /* (335) filter_over ::= filter_clause */ | 164276 | 273, /* (335) filter_over ::= over_clause */ |
| 162486 | 311, /* (336) over_clause ::= OVER LP window RP */ | 164277 | 273, /* (336) filter_over ::= filter_clause */ |
| 162487 | 311, /* (337) over_clause ::= OVER nm */ | 164278 | 312, /* (337) over_clause ::= OVER LP window RP */ |
| 162488 | 310, /* (338) filter_clause ::= FILTER LP WHERE expr RP */ | 164279 | 312, /* (338) over_clause ::= OVER nm */ |
| 162489 | 184, /* (339) input ::= cmdlist */ | 164280 | 311, /* (339) filter_clause ::= FILTER LP WHERE expr RP */ |
| 162490 | 185, /* (340) cmdlist ::= cmdlist ecmd */ | 164281 | 185, /* (340) input ::= cmdlist */ |
| 162491 | 185, /* (341) cmdlist ::= ecmd */ | 164282 | 186, /* (341) cmdlist ::= cmdlist ecmd */ |
| 162492 | 186, /* (342) ecmd ::= SEMI */ | 164283 | 186, /* (342) cmdlist ::= ecmd */ |
| 162493 | 186, /* (343) ecmd ::= cmdx SEMI */ | 164284 | 187, /* (343) ecmd ::= SEMI */ |
| 162494 | 186, /* (344) ecmd ::= explain cmdx SEMI */ | 164285 | 187, /* (344) ecmd ::= cmdx SEMI */ |
| 162495 | 191, /* (345) trans_opt ::= */ | 164286 | 187, /* (345) ecmd ::= explain cmdx SEMI */ |
| 162496 | 191, /* (346) trans_opt ::= TRANSACTION */ | 164287 | 192, /* (346) trans_opt ::= */ |
| 162497 | 191, /* (347) trans_opt ::= TRANSACTION nm */ | 164288 | 192, /* (347) trans_opt ::= TRANSACTION */ |
| 162498 | 193, /* (348) savepoint_opt ::= SAVEPOINT */ | 164289 | 192, /* (348) trans_opt ::= TRANSACTION nm */ |
| 162499 | 193, /* (349) savepoint_opt ::= */ | 164290 | 194, /* (349) savepoint_opt ::= SAVEPOINT */ |
| 162500 | 189, /* (350) cmd ::= create_table create_table_args */ | 164291 | 194, /* (350) savepoint_opt ::= */ |
| 162501 | 202, /* (351) table_option_set ::= table_option */ | 164292 | 190, /* (351) cmd ::= create_table create_table_args */ |
| 162502 | 200, /* (352) columnlist ::= columnlist COMMA columnname carglist */ | 164293 | 203, /* (352) table_option_set ::= table_option */ |
| 162503 | 200, /* (353) columnlist ::= columnname carglist */ | 164294 | 201, /* (353) columnlist ::= columnlist COMMA columnname carglist */ |
| 162504 | 192, /* (354) nm ::= ID|INDEXED */ | 164295 | 201, /* (354) columnlist ::= columnname carglist */ |
| 162505 | 192, /* (355) nm ::= STRING */ | 164296 | 193, /* (355) nm ::= ID|INDEXED */ |
| 162506 | 192, /* (356) nm ::= JOIN_KW */ | 164297 | 193, /* (356) nm ::= STRING */ |
| 162507 | 207, /* (357) typetoken ::= typename */ | 164298 | 193, /* (357) nm ::= JOIN_KW */ |
| 162508 | 208, /* (358) typename ::= ID|STRING */ | 164299 | 208, /* (358) typetoken ::= typename */ |
| 162509 | 209, /* (359) signed ::= plus_num */ | 164300 | 209, /* (359) typename ::= ID|STRING */ |
| 162510 | 209, /* (360) signed ::= minus_num */ | 164301 | 210, /* (360) signed ::= plus_num */ |
| 162511 | 206, /* (361) carglist ::= carglist ccons */ | 164302 | 210, /* (361) signed ::= minus_num */ |
| 162512 | 206, /* (362) carglist ::= */ | 164303 | 207, /* (362) carglist ::= carglist ccons */ |
| 162513 | 214, /* (363) ccons ::= NULL onconf */ | 164304 | 207, /* (363) carglist ::= */ |
| 162514 | 214, /* (364) ccons ::= GENERATED ALWAYS AS generated */ | 164305 | 215, /* (364) ccons ::= NULL onconf */ |
| 162515 | 214, /* (365) ccons ::= AS generated */ | 164306 | 215, /* (365) ccons ::= GENERATED ALWAYS AS generated */ |
| 162516 | 201, /* (366) conslist_opt ::= COMMA conslist */ | 164307 | 215, /* (366) ccons ::= AS generated */ |
| 162517 | 227, /* (367) conslist ::= conslist tconscomma tcons */ | 164308 | 202, /* (367) conslist_opt ::= COMMA conslist */ |
| 162518 | 227, /* (368) conslist ::= tcons */ | 164309 | 228, /* (368) conslist ::= conslist tconscomma tcons */ |
| 162519 | 228, /* (369) tconscomma ::= */ | 164310 | 228, /* (369) conslist ::= tcons */ |
| 162520 | 232, /* (370) defer_subclause_opt ::= defer_subclause */ | 164311 | 229, /* (370) tconscomma ::= */ |
| 162521 | 234, /* (371) resolvetype ::= raisetype */ | 164312 | 233, /* (371) defer_subclause_opt ::= defer_subclause */ |
| 162522 | 238, /* (372) selectnowith ::= oneselect */ | 164313 | 235, /* (372) resolvetype ::= raisetype */ |
| 162523 | 239, /* (373) oneselect ::= values */ | 164314 | 239, /* (373) selectnowith ::= oneselect */ |
| 162524 | 253, /* (374) sclp ::= selcollist COMMA */ | 164315 | 240, /* (374) oneselect ::= values */ |
| 162525 | 254, /* (375) as ::= ID|STRING */ | 164316 | 254, /* (375) sclp ::= selcollist COMMA */ |
| 162526 | 271, /* (376) returning ::= */ | 164317 | 255, /* (376) as ::= ID|STRING */ |
| 162527 | 216, /* (377) expr ::= term */ | 164318 | 272, /* (377) returning ::= */ |
| 162528 | 273, /* (378) likeop ::= LIKE_KW|MATCH */ | 164319 | 217, /* (378) expr ::= term */ |
| 162529 | 261, /* (379) exprlist ::= nexprlist */ | 164320 | 274, /* (379) likeop ::= LIKE_KW|MATCH */ |
| 162530 | 283, /* (380) nmnum ::= plus_num */ | 164321 | 262, /* (380) exprlist ::= nexprlist */ |
| 162531 | 283, /* (381) nmnum ::= nm */ | 164322 | 284, /* (381) nmnum ::= plus_num */ |
| 162532 | 283, /* (382) nmnum ::= ON */ | 164323 | 284, /* (382) nmnum ::= nm */ |
| 162533 | 283, /* (383) nmnum ::= DELETE */ | 164324 | 284, /* (383) nmnum ::= ON */ |
| 162534 | 283, /* (384) nmnum ::= DEFAULT */ | 164325 | 284, /* (384) nmnum ::= DELETE */ |
| 162535 | 210, /* (385) plus_num ::= INTEGER|FLOAT */ | 164326 | 284, /* (385) nmnum ::= DEFAULT */ |
| 162536 | 288, /* (386) foreach_clause ::= */ | 164327 | 211, /* (386) plus_num ::= INTEGER|FLOAT */ |
| 162537 | 288, /* (387) foreach_clause ::= FOR EACH ROW */ | 164328 | 289, /* (387) foreach_clause ::= */ |
| 162538 | 291, /* (388) trnm ::= nm */ | 164329 | 289, /* (388) foreach_clause ::= FOR EACH ROW */ |
| 162539 | 292, /* (389) tridxby ::= */ | 164330 | 292, /* (389) trnm ::= nm */ |
| 162540 | 293, /* (390) database_kw_opt ::= DATABASE */ | 164331 | 293, /* (390) tridxby ::= */ |
| 162541 | 293, /* (391) database_kw_opt ::= */ | 164332 | 294, /* (391) database_kw_opt ::= DATABASE */ |
| 162542 | 296, /* (392) kwcolumn_opt ::= */ | 164333 | 294, /* (392) database_kw_opt ::= */ |
| 162543 | 296, /* (393) kwcolumn_opt ::= COLUMNKW */ | 164334 | 297, /* (393) kwcolumn_opt ::= */ |
| 162544 | 298, /* (394) vtabarglist ::= vtabarg */ | 164335 | 297, /* (394) kwcolumn_opt ::= COLUMNKW */ |
| 162545 | 298, /* (395) vtabarglist ::= vtabarglist COMMA vtabarg */ | 164336 | 299, /* (395) vtabarglist ::= vtabarg */ |
| 162546 | 299, /* (396) vtabarg ::= vtabarg vtabargtoken */ | 164337 | 299, /* (396) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 162547 | 302, /* (397) anylist ::= */ | 164338 | 300, /* (397) vtabarg ::= vtabarg vtabargtoken */ |
| 162548 | 302, /* (398) anylist ::= anylist LP anylist RP */ | 164339 | 303, /* (398) anylist ::= */ |
| 162549 | 302, /* (399) anylist ::= anylist ANY */ | 164340 | 303, /* (399) anylist ::= anylist LP anylist RP */ |
| 162550 | 265, /* (400) with ::= */ | 164341 | 303, /* (400) anylist ::= anylist ANY */ |
| 164342 | 266, /* (401) with ::= */ | ||
| 162551 | }; | 164343 | }; |
| 162552 | 164344 | ||
| 162553 | /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number | 164345 | /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number |
| @@ -162765,195 +164557,196 @@ static const signed char yyRuleInfoNRhs[] = { | |||
| 162765 | -2, /* (209) expr ::= NOT expr */ | 164557 | -2, /* (209) expr ::= NOT expr */ |
| 162766 | -2, /* (210) expr ::= BITNOT expr */ | 164558 | -2, /* (210) expr ::= BITNOT expr */ |
| 162767 | -2, /* (211) expr ::= PLUS|MINUS expr */ | 164559 | -2, /* (211) expr ::= PLUS|MINUS expr */ |
| 162768 | -1, /* (212) between_op ::= BETWEEN */ | 164560 | -3, /* (212) expr ::= expr PTR expr */ |
| 162769 | -2, /* (213) between_op ::= NOT BETWEEN */ | 164561 | -1, /* (213) between_op ::= BETWEEN */ |
| 162770 | -5, /* (214) expr ::= expr between_op expr AND expr */ | 164562 | -2, /* (214) between_op ::= NOT BETWEEN */ |
| 162771 | -1, /* (215) in_op ::= IN */ | 164563 | -5, /* (215) expr ::= expr between_op expr AND expr */ |
| 162772 | -2, /* (216) in_op ::= NOT IN */ | 164564 | -1, /* (216) in_op ::= IN */ |
| 162773 | -5, /* (217) expr ::= expr in_op LP exprlist RP */ | 164565 | -2, /* (217) in_op ::= NOT IN */ |
| 162774 | -3, /* (218) expr ::= LP select RP */ | 164566 | -5, /* (218) expr ::= expr in_op LP exprlist RP */ |
| 162775 | -5, /* (219) expr ::= expr in_op LP select RP */ | 164567 | -3, /* (219) expr ::= LP select RP */ |
| 162776 | -5, /* (220) expr ::= expr in_op nm dbnm paren_exprlist */ | 164568 | -5, /* (220) expr ::= expr in_op LP select RP */ |
| 162777 | -4, /* (221) expr ::= EXISTS LP select RP */ | 164569 | -5, /* (221) expr ::= expr in_op nm dbnm paren_exprlist */ |
| 162778 | -5, /* (222) expr ::= CASE case_operand case_exprlist case_else END */ | 164570 | -4, /* (222) expr ::= EXISTS LP select RP */ |
| 162779 | -5, /* (223) case_exprlist ::= case_exprlist WHEN expr THEN expr */ | 164571 | -5, /* (223) expr ::= CASE case_operand case_exprlist case_else END */ |
| 162780 | -4, /* (224) case_exprlist ::= WHEN expr THEN expr */ | 164572 | -5, /* (224) case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 162781 | -2, /* (225) case_else ::= ELSE expr */ | 164573 | -4, /* (225) case_exprlist ::= WHEN expr THEN expr */ |
| 162782 | 0, /* (226) case_else ::= */ | 164574 | -2, /* (226) case_else ::= ELSE expr */ |
| 162783 | -1, /* (227) case_operand ::= expr */ | 164575 | 0, /* (227) case_else ::= */ |
| 162784 | 0, /* (228) case_operand ::= */ | 164576 | -1, /* (228) case_operand ::= expr */ |
| 162785 | 0, /* (229) exprlist ::= */ | 164577 | 0, /* (229) case_operand ::= */ |
| 162786 | -3, /* (230) nexprlist ::= nexprlist COMMA expr */ | 164578 | 0, /* (230) exprlist ::= */ |
| 162787 | -1, /* (231) nexprlist ::= expr */ | 164579 | -3, /* (231) nexprlist ::= nexprlist COMMA expr */ |
| 162788 | 0, /* (232) paren_exprlist ::= */ | 164580 | -1, /* (232) nexprlist ::= expr */ |
| 162789 | -3, /* (233) paren_exprlist ::= LP exprlist RP */ | 164581 | 0, /* (233) paren_exprlist ::= */ |
| 162790 | -12, /* (234) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ | 164582 | -3, /* (234) paren_exprlist ::= LP exprlist RP */ |
| 162791 | -1, /* (235) uniqueflag ::= UNIQUE */ | 164583 | -12, /* (235) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 162792 | 0, /* (236) uniqueflag ::= */ | 164584 | -1, /* (236) uniqueflag ::= UNIQUE */ |
| 162793 | 0, /* (237) eidlist_opt ::= */ | 164585 | 0, /* (237) uniqueflag ::= */ |
| 162794 | -3, /* (238) eidlist_opt ::= LP eidlist RP */ | 164586 | 0, /* (238) eidlist_opt ::= */ |
| 162795 | -5, /* (239) eidlist ::= eidlist COMMA nm collate sortorder */ | 164587 | -3, /* (239) eidlist_opt ::= LP eidlist RP */ |
| 162796 | -3, /* (240) eidlist ::= nm collate sortorder */ | 164588 | -5, /* (240) eidlist ::= eidlist COMMA nm collate sortorder */ |
| 162797 | 0, /* (241) collate ::= */ | 164589 | -3, /* (241) eidlist ::= nm collate sortorder */ |
| 162798 | -2, /* (242) collate ::= COLLATE ID|STRING */ | 164590 | 0, /* (242) collate ::= */ |
| 162799 | -4, /* (243) cmd ::= DROP INDEX ifexists fullname */ | 164591 | -2, /* (243) collate ::= COLLATE ID|STRING */ |
| 162800 | -2, /* (244) cmd ::= VACUUM vinto */ | 164592 | -4, /* (244) cmd ::= DROP INDEX ifexists fullname */ |
| 162801 | -3, /* (245) cmd ::= VACUUM nm vinto */ | 164593 | -2, /* (245) cmd ::= VACUUM vinto */ |
| 162802 | -2, /* (246) vinto ::= INTO expr */ | 164594 | -3, /* (246) cmd ::= VACUUM nm vinto */ |
| 162803 | 0, /* (247) vinto ::= */ | 164595 | -2, /* (247) vinto ::= INTO expr */ |
| 162804 | -3, /* (248) cmd ::= PRAGMA nm dbnm */ | 164596 | 0, /* (248) vinto ::= */ |
| 162805 | -5, /* (249) cmd ::= PRAGMA nm dbnm EQ nmnum */ | 164597 | -3, /* (249) cmd ::= PRAGMA nm dbnm */ |
| 162806 | -6, /* (250) cmd ::= PRAGMA nm dbnm LP nmnum RP */ | 164598 | -5, /* (250) cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 162807 | -5, /* (251) cmd ::= PRAGMA nm dbnm EQ minus_num */ | 164599 | -6, /* (251) cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 162808 | -6, /* (252) cmd ::= PRAGMA nm dbnm LP minus_num RP */ | 164600 | -5, /* (252) cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 162809 | -2, /* (253) plus_num ::= PLUS INTEGER|FLOAT */ | 164601 | -6, /* (253) cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 162810 | -2, /* (254) minus_num ::= MINUS INTEGER|FLOAT */ | 164602 | -2, /* (254) plus_num ::= PLUS INTEGER|FLOAT */ |
| 162811 | -5, /* (255) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ | 164603 | -2, /* (255) minus_num ::= MINUS INTEGER|FLOAT */ |
| 162812 | -11, /* (256) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ | 164604 | -5, /* (256) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 162813 | -1, /* (257) trigger_time ::= BEFORE|AFTER */ | 164605 | -11, /* (257) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 162814 | -2, /* (258) trigger_time ::= INSTEAD OF */ | 164606 | -1, /* (258) trigger_time ::= BEFORE|AFTER */ |
| 162815 | 0, /* (259) trigger_time ::= */ | 164607 | -2, /* (259) trigger_time ::= INSTEAD OF */ |
| 162816 | -1, /* (260) trigger_event ::= DELETE|INSERT */ | 164608 | 0, /* (260) trigger_time ::= */ |
| 162817 | -1, /* (261) trigger_event ::= UPDATE */ | 164609 | -1, /* (261) trigger_event ::= DELETE|INSERT */ |
| 162818 | -3, /* (262) trigger_event ::= UPDATE OF idlist */ | 164610 | -1, /* (262) trigger_event ::= UPDATE */ |
| 162819 | 0, /* (263) when_clause ::= */ | 164611 | -3, /* (263) trigger_event ::= UPDATE OF idlist */ |
| 162820 | -2, /* (264) when_clause ::= WHEN expr */ | 164612 | 0, /* (264) when_clause ::= */ |
| 162821 | -3, /* (265) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ | 164613 | -2, /* (265) when_clause ::= WHEN expr */ |
| 162822 | -2, /* (266) trigger_cmd_list ::= trigger_cmd SEMI */ | 164614 | -3, /* (266) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 162823 | -3, /* (267) trnm ::= nm DOT nm */ | 164615 | -2, /* (267) trigger_cmd_list ::= trigger_cmd SEMI */ |
| 162824 | -3, /* (268) tridxby ::= INDEXED BY nm */ | 164616 | -3, /* (268) trnm ::= nm DOT nm */ |
| 162825 | -2, /* (269) tridxby ::= NOT INDEXED */ | 164617 | -3, /* (269) tridxby ::= INDEXED BY nm */ |
| 162826 | -9, /* (270) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ | 164618 | -2, /* (270) tridxby ::= NOT INDEXED */ |
| 162827 | -8, /* (271) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ | 164619 | -9, /* (271) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ |
| 162828 | -6, /* (272) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ | 164620 | -8, /* (272) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 162829 | -3, /* (273) trigger_cmd ::= scanpt select scanpt */ | 164621 | -6, /* (273) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 162830 | -4, /* (274) expr ::= RAISE LP IGNORE RP */ | 164622 | -3, /* (274) trigger_cmd ::= scanpt select scanpt */ |
| 162831 | -6, /* (275) expr ::= RAISE LP raisetype COMMA nm RP */ | 164623 | -4, /* (275) expr ::= RAISE LP IGNORE RP */ |
| 162832 | -1, /* (276) raisetype ::= ROLLBACK */ | 164624 | -6, /* (276) expr ::= RAISE LP raisetype COMMA nm RP */ |
| 162833 | -1, /* (277) raisetype ::= ABORT */ | 164625 | -1, /* (277) raisetype ::= ROLLBACK */ |
| 162834 | -1, /* (278) raisetype ::= FAIL */ | 164626 | -1, /* (278) raisetype ::= ABORT */ |
| 162835 | -4, /* (279) cmd ::= DROP TRIGGER ifexists fullname */ | 164627 | -1, /* (279) raisetype ::= FAIL */ |
| 162836 | -6, /* (280) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ | 164628 | -4, /* (280) cmd ::= DROP TRIGGER ifexists fullname */ |
| 162837 | -3, /* (281) cmd ::= DETACH database_kw_opt expr */ | 164629 | -6, /* (281) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 162838 | 0, /* (282) key_opt ::= */ | 164630 | -3, /* (282) cmd ::= DETACH database_kw_opt expr */ |
| 162839 | -2, /* (283) key_opt ::= KEY expr */ | 164631 | 0, /* (283) key_opt ::= */ |
| 162840 | -1, /* (284) cmd ::= REINDEX */ | 164632 | -2, /* (284) key_opt ::= KEY expr */ |
| 162841 | -3, /* (285) cmd ::= REINDEX nm dbnm */ | 164633 | -1, /* (285) cmd ::= REINDEX */ |
| 162842 | -1, /* (286) cmd ::= ANALYZE */ | 164634 | -3, /* (286) cmd ::= REINDEX nm dbnm */ |
| 162843 | -3, /* (287) cmd ::= ANALYZE nm dbnm */ | 164635 | -1, /* (287) cmd ::= ANALYZE */ |
| 162844 | -6, /* (288) cmd ::= ALTER TABLE fullname RENAME TO nm */ | 164636 | -3, /* (288) cmd ::= ANALYZE nm dbnm */ |
| 162845 | -7, /* (289) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ | 164637 | -6, /* (289) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 162846 | -6, /* (290) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ | 164638 | -7, /* (290) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 162847 | -1, /* (291) add_column_fullname ::= fullname */ | 164639 | -6, /* (291) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ |
| 162848 | -8, /* (292) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ | 164640 | -1, /* (292) add_column_fullname ::= fullname */ |
| 162849 | -1, /* (293) cmd ::= create_vtab */ | 164641 | -8, /* (293) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 162850 | -4, /* (294) cmd ::= create_vtab LP vtabarglist RP */ | 164642 | -1, /* (294) cmd ::= create_vtab */ |
| 162851 | -8, /* (295) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ | 164643 | -4, /* (295) cmd ::= create_vtab LP vtabarglist RP */ |
| 162852 | 0, /* (296) vtabarg ::= */ | 164644 | -8, /* (296) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 162853 | -1, /* (297) vtabargtoken ::= ANY */ | 164645 | 0, /* (297) vtabarg ::= */ |
| 162854 | -3, /* (298) vtabargtoken ::= lp anylist RP */ | 164646 | -1, /* (298) vtabargtoken ::= ANY */ |
| 162855 | -1, /* (299) lp ::= LP */ | 164647 | -3, /* (299) vtabargtoken ::= lp anylist RP */ |
| 162856 | -2, /* (300) with ::= WITH wqlist */ | 164648 | -1, /* (300) lp ::= LP */ |
| 162857 | -3, /* (301) with ::= WITH RECURSIVE wqlist */ | 164649 | -2, /* (301) with ::= WITH wqlist */ |
| 162858 | -1, /* (302) wqas ::= AS */ | 164650 | -3, /* (302) with ::= WITH RECURSIVE wqlist */ |
| 162859 | -2, /* (303) wqas ::= AS MATERIALIZED */ | 164651 | -1, /* (303) wqas ::= AS */ |
| 162860 | -3, /* (304) wqas ::= AS NOT MATERIALIZED */ | 164652 | -2, /* (304) wqas ::= AS MATERIALIZED */ |
| 162861 | -6, /* (305) wqitem ::= nm eidlist_opt wqas LP select RP */ | 164653 | -3, /* (305) wqas ::= AS NOT MATERIALIZED */ |
| 162862 | -1, /* (306) wqlist ::= wqitem */ | 164654 | -6, /* (306) wqitem ::= nm eidlist_opt wqas LP select RP */ |
| 162863 | -3, /* (307) wqlist ::= wqlist COMMA wqitem */ | 164655 | -1, /* (307) wqlist ::= wqitem */ |
| 162864 | -1, /* (308) windowdefn_list ::= windowdefn */ | 164656 | -3, /* (308) wqlist ::= wqlist COMMA wqitem */ |
| 162865 | -3, /* (309) windowdefn_list ::= windowdefn_list COMMA windowdefn */ | 164657 | -1, /* (309) windowdefn_list ::= windowdefn */ |
| 162866 | -5, /* (310) windowdefn ::= nm AS LP window RP */ | 164658 | -3, /* (310) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 162867 | -5, /* (311) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ | 164659 | -5, /* (311) windowdefn ::= nm AS LP window RP */ |
| 162868 | -6, /* (312) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ | 164660 | -5, /* (312) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 162869 | -4, /* (313) window ::= ORDER BY sortlist frame_opt */ | 164661 | -6, /* (313) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 162870 | -5, /* (314) window ::= nm ORDER BY sortlist frame_opt */ | 164662 | -4, /* (314) window ::= ORDER BY sortlist frame_opt */ |
| 162871 | -1, /* (315) window ::= frame_opt */ | 164663 | -5, /* (315) window ::= nm ORDER BY sortlist frame_opt */ |
| 162872 | -2, /* (316) window ::= nm frame_opt */ | 164664 | -1, /* (316) window ::= frame_opt */ |
| 162873 | 0, /* (317) frame_opt ::= */ | 164665 | -2, /* (317) window ::= nm frame_opt */ |
| 162874 | -3, /* (318) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ | 164666 | 0, /* (318) frame_opt ::= */ |
| 162875 | -6, /* (319) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ | 164667 | -3, /* (319) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 162876 | -1, /* (320) range_or_rows ::= RANGE|ROWS|GROUPS */ | 164668 | -6, /* (320) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 162877 | -1, /* (321) frame_bound_s ::= frame_bound */ | 164669 | -1, /* (321) range_or_rows ::= RANGE|ROWS|GROUPS */ |
| 162878 | -2, /* (322) frame_bound_s ::= UNBOUNDED PRECEDING */ | 164670 | -1, /* (322) frame_bound_s ::= frame_bound */ |
| 162879 | -1, /* (323) frame_bound_e ::= frame_bound */ | 164671 | -2, /* (323) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 162880 | -2, /* (324) frame_bound_e ::= UNBOUNDED FOLLOWING */ | 164672 | -1, /* (324) frame_bound_e ::= frame_bound */ |
| 162881 | -2, /* (325) frame_bound ::= expr PRECEDING|FOLLOWING */ | 164673 | -2, /* (325) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 162882 | -2, /* (326) frame_bound ::= CURRENT ROW */ | 164674 | -2, /* (326) frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 162883 | 0, /* (327) frame_exclude_opt ::= */ | 164675 | -2, /* (327) frame_bound ::= CURRENT ROW */ |
| 162884 | -2, /* (328) frame_exclude_opt ::= EXCLUDE frame_exclude */ | 164676 | 0, /* (328) frame_exclude_opt ::= */ |
| 162885 | -2, /* (329) frame_exclude ::= NO OTHERS */ | 164677 | -2, /* (329) frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 162886 | -2, /* (330) frame_exclude ::= CURRENT ROW */ | 164678 | -2, /* (330) frame_exclude ::= NO OTHERS */ |
| 162887 | -1, /* (331) frame_exclude ::= GROUP|TIES */ | 164679 | -2, /* (331) frame_exclude ::= CURRENT ROW */ |
| 162888 | -2, /* (332) window_clause ::= WINDOW windowdefn_list */ | 164680 | -1, /* (332) frame_exclude ::= GROUP|TIES */ |
| 162889 | -2, /* (333) filter_over ::= filter_clause over_clause */ | 164681 | -2, /* (333) window_clause ::= WINDOW windowdefn_list */ |
| 162890 | -1, /* (334) filter_over ::= over_clause */ | 164682 | -2, /* (334) filter_over ::= filter_clause over_clause */ |
| 162891 | -1, /* (335) filter_over ::= filter_clause */ | 164683 | -1, /* (335) filter_over ::= over_clause */ |
| 162892 | -4, /* (336) over_clause ::= OVER LP window RP */ | 164684 | -1, /* (336) filter_over ::= filter_clause */ |
| 162893 | -2, /* (337) over_clause ::= OVER nm */ | 164685 | -4, /* (337) over_clause ::= OVER LP window RP */ |
| 162894 | -5, /* (338) filter_clause ::= FILTER LP WHERE expr RP */ | 164686 | -2, /* (338) over_clause ::= OVER nm */ |
| 162895 | -1, /* (339) input ::= cmdlist */ | 164687 | -5, /* (339) filter_clause ::= FILTER LP WHERE expr RP */ |
| 162896 | -2, /* (340) cmdlist ::= cmdlist ecmd */ | 164688 | -1, /* (340) input ::= cmdlist */ |
| 162897 | -1, /* (341) cmdlist ::= ecmd */ | 164689 | -2, /* (341) cmdlist ::= cmdlist ecmd */ |
| 162898 | -1, /* (342) ecmd ::= SEMI */ | 164690 | -1, /* (342) cmdlist ::= ecmd */ |
| 162899 | -2, /* (343) ecmd ::= cmdx SEMI */ | 164691 | -1, /* (343) ecmd ::= SEMI */ |
| 162900 | -3, /* (344) ecmd ::= explain cmdx SEMI */ | 164692 | -2, /* (344) ecmd ::= cmdx SEMI */ |
| 162901 | 0, /* (345) trans_opt ::= */ | 164693 | -3, /* (345) ecmd ::= explain cmdx SEMI */ |
| 162902 | -1, /* (346) trans_opt ::= TRANSACTION */ | 164694 | 0, /* (346) trans_opt ::= */ |
| 162903 | -2, /* (347) trans_opt ::= TRANSACTION nm */ | 164695 | -1, /* (347) trans_opt ::= TRANSACTION */ |
| 162904 | -1, /* (348) savepoint_opt ::= SAVEPOINT */ | 164696 | -2, /* (348) trans_opt ::= TRANSACTION nm */ |
| 162905 | 0, /* (349) savepoint_opt ::= */ | 164697 | -1, /* (349) savepoint_opt ::= SAVEPOINT */ |
| 162906 | -2, /* (350) cmd ::= create_table create_table_args */ | 164698 | 0, /* (350) savepoint_opt ::= */ |
| 162907 | -1, /* (351) table_option_set ::= table_option */ | 164699 | -2, /* (351) cmd ::= create_table create_table_args */ |
| 162908 | -4, /* (352) columnlist ::= columnlist COMMA columnname carglist */ | 164700 | -1, /* (352) table_option_set ::= table_option */ |
| 162909 | -2, /* (353) columnlist ::= columnname carglist */ | 164701 | -4, /* (353) columnlist ::= columnlist COMMA columnname carglist */ |
| 162910 | -1, /* (354) nm ::= ID|INDEXED */ | 164702 | -2, /* (354) columnlist ::= columnname carglist */ |
| 162911 | -1, /* (355) nm ::= STRING */ | 164703 | -1, /* (355) nm ::= ID|INDEXED */ |
| 162912 | -1, /* (356) nm ::= JOIN_KW */ | 164704 | -1, /* (356) nm ::= STRING */ |
| 162913 | -1, /* (357) typetoken ::= typename */ | 164705 | -1, /* (357) nm ::= JOIN_KW */ |
| 162914 | -1, /* (358) typename ::= ID|STRING */ | 164706 | -1, /* (358) typetoken ::= typename */ |
| 162915 | -1, /* (359) signed ::= plus_num */ | 164707 | -1, /* (359) typename ::= ID|STRING */ |
| 162916 | -1, /* (360) signed ::= minus_num */ | 164708 | -1, /* (360) signed ::= plus_num */ |
| 162917 | -2, /* (361) carglist ::= carglist ccons */ | 164709 | -1, /* (361) signed ::= minus_num */ |
| 162918 | 0, /* (362) carglist ::= */ | 164710 | -2, /* (362) carglist ::= carglist ccons */ |
| 162919 | -2, /* (363) ccons ::= NULL onconf */ | 164711 | 0, /* (363) carglist ::= */ |
| 162920 | -4, /* (364) ccons ::= GENERATED ALWAYS AS generated */ | 164712 | -2, /* (364) ccons ::= NULL onconf */ |
| 162921 | -2, /* (365) ccons ::= AS generated */ | 164713 | -4, /* (365) ccons ::= GENERATED ALWAYS AS generated */ |
| 162922 | -2, /* (366) conslist_opt ::= COMMA conslist */ | 164714 | -2, /* (366) ccons ::= AS generated */ |
| 162923 | -3, /* (367) conslist ::= conslist tconscomma tcons */ | 164715 | -2, /* (367) conslist_opt ::= COMMA conslist */ |
| 162924 | -1, /* (368) conslist ::= tcons */ | 164716 | -3, /* (368) conslist ::= conslist tconscomma tcons */ |
| 162925 | 0, /* (369) tconscomma ::= */ | 164717 | -1, /* (369) conslist ::= tcons */ |
| 162926 | -1, /* (370) defer_subclause_opt ::= defer_subclause */ | 164718 | 0, /* (370) tconscomma ::= */ |
| 162927 | -1, /* (371) resolvetype ::= raisetype */ | 164719 | -1, /* (371) defer_subclause_opt ::= defer_subclause */ |
| 162928 | -1, /* (372) selectnowith ::= oneselect */ | 164720 | -1, /* (372) resolvetype ::= raisetype */ |
| 162929 | -1, /* (373) oneselect ::= values */ | 164721 | -1, /* (373) selectnowith ::= oneselect */ |
| 162930 | -2, /* (374) sclp ::= selcollist COMMA */ | 164722 | -1, /* (374) oneselect ::= values */ |
| 162931 | -1, /* (375) as ::= ID|STRING */ | 164723 | -2, /* (375) sclp ::= selcollist COMMA */ |
| 162932 | 0, /* (376) returning ::= */ | 164724 | -1, /* (376) as ::= ID|STRING */ |
| 162933 | -1, /* (377) expr ::= term */ | 164725 | 0, /* (377) returning ::= */ |
| 162934 | -1, /* (378) likeop ::= LIKE_KW|MATCH */ | 164726 | -1, /* (378) expr ::= term */ |
| 162935 | -1, /* (379) exprlist ::= nexprlist */ | 164727 | -1, /* (379) likeop ::= LIKE_KW|MATCH */ |
| 162936 | -1, /* (380) nmnum ::= plus_num */ | 164728 | -1, /* (380) exprlist ::= nexprlist */ |
| 162937 | -1, /* (381) nmnum ::= nm */ | 164729 | -1, /* (381) nmnum ::= plus_num */ |
| 162938 | -1, /* (382) nmnum ::= ON */ | 164730 | -1, /* (382) nmnum ::= nm */ |
| 162939 | -1, /* (383) nmnum ::= DELETE */ | 164731 | -1, /* (383) nmnum ::= ON */ |
| 162940 | -1, /* (384) nmnum ::= DEFAULT */ | 164732 | -1, /* (384) nmnum ::= DELETE */ |
| 162941 | -1, /* (385) plus_num ::= INTEGER|FLOAT */ | 164733 | -1, /* (385) nmnum ::= DEFAULT */ |
| 162942 | 0, /* (386) foreach_clause ::= */ | 164734 | -1, /* (386) plus_num ::= INTEGER|FLOAT */ |
| 162943 | -3, /* (387) foreach_clause ::= FOR EACH ROW */ | 164735 | 0, /* (387) foreach_clause ::= */ |
| 162944 | -1, /* (388) trnm ::= nm */ | 164736 | -3, /* (388) foreach_clause ::= FOR EACH ROW */ |
| 162945 | 0, /* (389) tridxby ::= */ | 164737 | -1, /* (389) trnm ::= nm */ |
| 162946 | -1, /* (390) database_kw_opt ::= DATABASE */ | 164738 | 0, /* (390) tridxby ::= */ |
| 162947 | 0, /* (391) database_kw_opt ::= */ | 164739 | -1, /* (391) database_kw_opt ::= DATABASE */ |
| 162948 | 0, /* (392) kwcolumn_opt ::= */ | 164740 | 0, /* (392) database_kw_opt ::= */ |
| 162949 | -1, /* (393) kwcolumn_opt ::= COLUMNKW */ | 164741 | 0, /* (393) kwcolumn_opt ::= */ |
| 162950 | -1, /* (394) vtabarglist ::= vtabarg */ | 164742 | -1, /* (394) kwcolumn_opt ::= COLUMNKW */ |
| 162951 | -3, /* (395) vtabarglist ::= vtabarglist COMMA vtabarg */ | 164743 | -1, /* (395) vtabarglist ::= vtabarg */ |
| 162952 | -2, /* (396) vtabarg ::= vtabarg vtabargtoken */ | 164744 | -3, /* (396) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 162953 | 0, /* (397) anylist ::= */ | 164745 | -2, /* (397) vtabarg ::= vtabarg vtabargtoken */ |
| 162954 | -4, /* (398) anylist ::= anylist LP anylist RP */ | 164746 | 0, /* (398) anylist ::= */ |
| 162955 | -2, /* (399) anylist ::= anylist ANY */ | 164747 | -4, /* (399) anylist ::= anylist LP anylist RP */ |
| 162956 | 0, /* (400) with ::= */ | 164748 | -2, /* (400) anylist ::= anylist ANY */ |
| 164749 | 0, /* (401) with ::= */ | ||
| 162957 | }; | 164750 | }; |
| 162958 | 164751 | ||
| 162959 | static void yy_accept(yyParser*); /* Forward Declaration */ | 164752 | static void yy_accept(yyParser*); /* Forward Declaration */ |
| @@ -163005,16 +164798,16 @@ static YYACTIONTYPE yy_reduce( | |||
| 163005 | { sqlite3FinishCoding(pParse); } | 164798 | { sqlite3FinishCoding(pParse); } |
| 163006 | break; | 164799 | break; |
| 163007 | case 3: /* cmd ::= BEGIN transtype trans_opt */ | 164800 | case 3: /* cmd ::= BEGIN transtype trans_opt */ |
| 163008 | {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy64);} | 164801 | {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy394);} |
| 163009 | break; | 164802 | break; |
| 163010 | case 4: /* transtype ::= */ | 164803 | case 4: /* transtype ::= */ |
| 163011 | {yymsp[1].minor.yy64 = TK_DEFERRED;} | 164804 | {yymsp[1].minor.yy394 = TK_DEFERRED;} |
| 163012 | break; | 164805 | break; |
| 163013 | case 5: /* transtype ::= DEFERRED */ | 164806 | case 5: /* transtype ::= DEFERRED */ |
| 163014 | case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6); | 164807 | case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6); |
| 163015 | case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7); | 164808 | case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7); |
| 163016 | case 320: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==320); | 164809 | case 321: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==321); |
| 163017 | {yymsp[0].minor.yy64 = yymsp[0].major; /*A-overwrites-X*/} | 164810 | {yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/} |
| 163018 | break; | 164811 | break; |
| 163019 | case 8: /* cmd ::= COMMIT|END trans_opt */ | 164812 | case 8: /* cmd ::= COMMIT|END trans_opt */ |
| 163020 | case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9); | 164813 | case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9); |
| @@ -163037,7 +164830,7 @@ static YYACTIONTYPE yy_reduce( | |||
| 163037 | break; | 164830 | break; |
| 163038 | case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ | 164831 | case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ |
| 163039 | { | 164832 | { |
| 163040 | sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy64,0,0,yymsp[-2].minor.yy64); | 164833 | sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy394,0,0,yymsp[-2].minor.yy394); |
| 163041 | } | 164834 | } |
| 163042 | break; | 164835 | break; |
| 163043 | case 14: /* createkw ::= CREATE */ | 164836 | case 14: /* createkw ::= CREATE */ |
| @@ -163050,39 +164843,39 @@ static YYACTIONTYPE yy_reduce( | |||
| 163050 | case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72); | 164843 | case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72); |
| 163051 | case 81: /* ifexists ::= */ yytestcase(yyruleno==81); | 164844 | case 81: /* ifexists ::= */ yytestcase(yyruleno==81); |
| 163052 | case 98: /* distinct ::= */ yytestcase(yyruleno==98); | 164845 | case 98: /* distinct ::= */ yytestcase(yyruleno==98); |
| 163053 | case 241: /* collate ::= */ yytestcase(yyruleno==241); | 164846 | case 242: /* collate ::= */ yytestcase(yyruleno==242); |
| 163054 | {yymsp[1].minor.yy64 = 0;} | 164847 | {yymsp[1].minor.yy394 = 0;} |
| 163055 | break; | 164848 | break; |
| 163056 | case 16: /* ifnotexists ::= IF NOT EXISTS */ | 164849 | case 16: /* ifnotexists ::= IF NOT EXISTS */ |
| 163057 | {yymsp[-2].minor.yy64 = 1;} | 164850 | {yymsp[-2].minor.yy394 = 1;} |
| 163058 | break; | 164851 | break; |
| 163059 | case 17: /* temp ::= TEMP */ | 164852 | case 17: /* temp ::= TEMP */ |
| 163060 | {yymsp[0].minor.yy64 = pParse->db->init.busy==0;} | 164853 | {yymsp[0].minor.yy394 = pParse->db->init.busy==0;} |
| 163061 | break; | 164854 | break; |
| 163062 | case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ | 164855 | case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ |
| 163063 | { | 164856 | { |
| 163064 | sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy51,0); | 164857 | sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy285,0); |
| 163065 | } | 164858 | } |
| 163066 | break; | 164859 | break; |
| 163067 | case 20: /* create_table_args ::= AS select */ | 164860 | case 20: /* create_table_args ::= AS select */ |
| 163068 | { | 164861 | { |
| 163069 | sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy303); | 164862 | sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy47); |
| 163070 | sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy303); | 164863 | sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy47); |
| 163071 | } | 164864 | } |
| 163072 | break; | 164865 | break; |
| 163073 | case 21: /* table_option_set ::= */ | 164866 | case 21: /* table_option_set ::= */ |
| 163074 | {yymsp[1].minor.yy51 = 0;} | 164867 | {yymsp[1].minor.yy285 = 0;} |
| 163075 | break; | 164868 | break; |
| 163076 | case 22: /* table_option_set ::= table_option_set COMMA table_option */ | 164869 | case 22: /* table_option_set ::= table_option_set COMMA table_option */ |
| 163077 | {yylhsminor.yy51 = yymsp[-2].minor.yy51|yymsp[0].minor.yy51;} | 164870 | {yylhsminor.yy285 = yymsp[-2].minor.yy285|yymsp[0].minor.yy285;} |
| 163078 | yymsp[-2].minor.yy51 = yylhsminor.yy51; | 164871 | yymsp[-2].minor.yy285 = yylhsminor.yy285; |
| 163079 | break; | 164872 | break; |
| 163080 | case 23: /* table_option ::= WITHOUT nm */ | 164873 | case 23: /* table_option ::= WITHOUT nm */ |
| 163081 | { | 164874 | { |
| 163082 | if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){ | 164875 | if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){ |
| 163083 | yymsp[-1].minor.yy51 = TF_WithoutRowid | TF_NoVisibleRowid; | 164876 | yymsp[-1].minor.yy285 = TF_WithoutRowid | TF_NoVisibleRowid; |
| 163084 | }else{ | 164877 | }else{ |
| 163085 | yymsp[-1].minor.yy51 = 0; | 164878 | yymsp[-1].minor.yy285 = 0; |
| 163086 | sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); | 164879 | sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); |
| 163087 | } | 164880 | } |
| 163088 | } | 164881 | } |
| @@ -163090,13 +164883,13 @@ static YYACTIONTYPE yy_reduce( | |||
| 163090 | case 24: /* table_option ::= nm */ | 164883 | case 24: /* table_option ::= nm */ |
| 163091 | { | 164884 | { |
| 163092 | if( yymsp[0].minor.yy0.n==6 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"strict",6)==0 ){ | 164885 | if( yymsp[0].minor.yy0.n==6 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"strict",6)==0 ){ |
| 163093 | yylhsminor.yy51 = TF_Strict; | 164886 | yylhsminor.yy285 = TF_Strict; |
| 163094 | }else{ | 164887 | }else{ |
| 163095 | yylhsminor.yy51 = 0; | 164888 | yylhsminor.yy285 = 0; |
| 163096 | sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); | 164889 | sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); |
| 163097 | } | 164890 | } |
| 163098 | } | 164891 | } |
| 163099 | yymsp[0].minor.yy51 = yylhsminor.yy51; | 164892 | yymsp[0].minor.yy285 = yylhsminor.yy285; |
| 163100 | break; | 164893 | break; |
| 163101 | case 25: /* columnname ::= nm typetoken */ | 164894 | case 25: /* columnname ::= nm typetoken */ |
| 163102 | {sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);} | 164895 | {sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);} |
| @@ -163122,7 +164915,7 @@ static YYACTIONTYPE yy_reduce( | |||
| 163122 | case 30: /* scanpt ::= */ | 164915 | case 30: /* scanpt ::= */ |
| 163123 | { | 164916 | { |
| 163124 | assert( yyLookahead!=YYNOCODE ); | 164917 | assert( yyLookahead!=YYNOCODE ); |
| 163125 | yymsp[1].minor.yy600 = yyLookaheadToken.z; | 164918 | yymsp[1].minor.yy522 = yyLookaheadToken.z; |
| 163126 | } | 164919 | } |
| 163127 | break; | 164920 | break; |
| 163128 | case 31: /* scantok ::= */ | 164921 | case 31: /* scantok ::= */ |
| @@ -163136,17 +164929,17 @@ static YYACTIONTYPE yy_reduce( | |||
| 163136 | {pParse->constraintName = yymsp[0].minor.yy0;} | 164929 | {pParse->constraintName = yymsp[0].minor.yy0;} |
| 163137 | break; | 164930 | break; |
| 163138 | case 33: /* ccons ::= DEFAULT scantok term */ | 164931 | case 33: /* ccons ::= DEFAULT scantok term */ |
| 163139 | {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy626,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} | 164932 | {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy528,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} |
| 163140 | break; | 164933 | break; |
| 163141 | case 34: /* ccons ::= DEFAULT LP expr RP */ | 164934 | case 34: /* ccons ::= DEFAULT LP expr RP */ |
| 163142 | {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy626,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);} | 164935 | {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy528,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);} |
| 163143 | break; | 164936 | break; |
| 163144 | case 35: /* ccons ::= DEFAULT PLUS scantok term */ | 164937 | case 35: /* ccons ::= DEFAULT PLUS scantok term */ |
| 163145 | {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy626,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} | 164938 | {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy528,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} |
| 163146 | break; | 164939 | break; |
| 163147 | case 36: /* ccons ::= DEFAULT MINUS scantok term */ | 164940 | case 36: /* ccons ::= DEFAULT MINUS scantok term */ |
| 163148 | { | 164941 | { |
| 163149 | Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy626, 0); | 164942 | Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy528, 0); |
| 163150 | sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]); | 164943 | sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]); |
| 163151 | } | 164944 | } |
| 163152 | break; | 164945 | break; |
| @@ -163161,161 +164954,161 @@ static YYACTIONTYPE yy_reduce( | |||
| 163161 | } | 164954 | } |
| 163162 | break; | 164955 | break; |
| 163163 | case 38: /* ccons ::= NOT NULL onconf */ | 164956 | case 38: /* ccons ::= NOT NULL onconf */ |
| 163164 | {sqlite3AddNotNull(pParse, yymsp[0].minor.yy64);} | 164957 | {sqlite3AddNotNull(pParse, yymsp[0].minor.yy394);} |
| 163165 | break; | 164958 | break; |
| 163166 | case 39: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ | 164959 | case 39: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ |
| 163167 | {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy64,yymsp[0].minor.yy64,yymsp[-2].minor.yy64);} | 164960 | {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy394,yymsp[0].minor.yy394,yymsp[-2].minor.yy394);} |
| 163168 | break; | 164961 | break; |
| 163169 | case 40: /* ccons ::= UNIQUE onconf */ | 164962 | case 40: /* ccons ::= UNIQUE onconf */ |
| 163170 | {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy64,0,0,0,0, | 164963 | {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy394,0,0,0,0, |
| 163171 | SQLITE_IDXTYPE_UNIQUE);} | 164964 | SQLITE_IDXTYPE_UNIQUE);} |
| 163172 | break; | 164965 | break; |
| 163173 | case 41: /* ccons ::= CHECK LP expr RP */ | 164966 | case 41: /* ccons ::= CHECK LP expr RP */ |
| 163174 | {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy626,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);} | 164967 | {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy528,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);} |
| 163175 | break; | 164968 | break; |
| 163176 | case 42: /* ccons ::= REFERENCES nm eidlist_opt refargs */ | 164969 | case 42: /* ccons ::= REFERENCES nm eidlist_opt refargs */ |
| 163177 | {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy562,yymsp[0].minor.yy64);} | 164970 | {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy322,yymsp[0].minor.yy394);} |
| 163178 | break; | 164971 | break; |
| 163179 | case 43: /* ccons ::= defer_subclause */ | 164972 | case 43: /* ccons ::= defer_subclause */ |
| 163180 | {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy64);} | 164973 | {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy394);} |
| 163181 | break; | 164974 | break; |
| 163182 | case 44: /* ccons ::= COLLATE ID|STRING */ | 164975 | case 44: /* ccons ::= COLLATE ID|STRING */ |
| 163183 | {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);} | 164976 | {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);} |
| 163184 | break; | 164977 | break; |
| 163185 | case 45: /* generated ::= LP expr RP */ | 164978 | case 45: /* generated ::= LP expr RP */ |
| 163186 | {sqlite3AddGenerated(pParse,yymsp[-1].minor.yy626,0);} | 164979 | {sqlite3AddGenerated(pParse,yymsp[-1].minor.yy528,0);} |
| 163187 | break; | 164980 | break; |
| 163188 | case 46: /* generated ::= LP expr RP ID */ | 164981 | case 46: /* generated ::= LP expr RP ID */ |
| 163189 | {sqlite3AddGenerated(pParse,yymsp[-2].minor.yy626,&yymsp[0].minor.yy0);} | 164982 | {sqlite3AddGenerated(pParse,yymsp[-2].minor.yy528,&yymsp[0].minor.yy0);} |
| 163190 | break; | 164983 | break; |
| 163191 | case 48: /* autoinc ::= AUTOINCR */ | 164984 | case 48: /* autoinc ::= AUTOINCR */ |
| 163192 | {yymsp[0].minor.yy64 = 1;} | 164985 | {yymsp[0].minor.yy394 = 1;} |
| 163193 | break; | 164986 | break; |
| 163194 | case 49: /* refargs ::= */ | 164987 | case 49: /* refargs ::= */ |
| 163195 | { yymsp[1].minor.yy64 = OE_None*0x0101; /* EV: R-19803-45884 */} | 164988 | { yymsp[1].minor.yy394 = OE_None*0x0101; /* EV: R-19803-45884 */} |
| 163196 | break; | 164989 | break; |
| 163197 | case 50: /* refargs ::= refargs refarg */ | 164990 | case 50: /* refargs ::= refargs refarg */ |
| 163198 | { yymsp[-1].minor.yy64 = (yymsp[-1].minor.yy64 & ~yymsp[0].minor.yy83.mask) | yymsp[0].minor.yy83.value; } | 164991 | { yymsp[-1].minor.yy394 = (yymsp[-1].minor.yy394 & ~yymsp[0].minor.yy231.mask) | yymsp[0].minor.yy231.value; } |
| 163199 | break; | 164992 | break; |
| 163200 | case 51: /* refarg ::= MATCH nm */ | 164993 | case 51: /* refarg ::= MATCH nm */ |
| 163201 | { yymsp[-1].minor.yy83.value = 0; yymsp[-1].minor.yy83.mask = 0x000000; } | 164994 | { yymsp[-1].minor.yy231.value = 0; yymsp[-1].minor.yy231.mask = 0x000000; } |
| 163202 | break; | 164995 | break; |
| 163203 | case 52: /* refarg ::= ON INSERT refact */ | 164996 | case 52: /* refarg ::= ON INSERT refact */ |
| 163204 | { yymsp[-2].minor.yy83.value = 0; yymsp[-2].minor.yy83.mask = 0x000000; } | 164997 | { yymsp[-2].minor.yy231.value = 0; yymsp[-2].minor.yy231.mask = 0x000000; } |
| 163205 | break; | 164998 | break; |
| 163206 | case 53: /* refarg ::= ON DELETE refact */ | 164999 | case 53: /* refarg ::= ON DELETE refact */ |
| 163207 | { yymsp[-2].minor.yy83.value = yymsp[0].minor.yy64; yymsp[-2].minor.yy83.mask = 0x0000ff; } | 165000 | { yymsp[-2].minor.yy231.value = yymsp[0].minor.yy394; yymsp[-2].minor.yy231.mask = 0x0000ff; } |
| 163208 | break; | 165001 | break; |
| 163209 | case 54: /* refarg ::= ON UPDATE refact */ | 165002 | case 54: /* refarg ::= ON UPDATE refact */ |
| 163210 | { yymsp[-2].minor.yy83.value = yymsp[0].minor.yy64<<8; yymsp[-2].minor.yy83.mask = 0x00ff00; } | 165003 | { yymsp[-2].minor.yy231.value = yymsp[0].minor.yy394<<8; yymsp[-2].minor.yy231.mask = 0x00ff00; } |
| 163211 | break; | 165004 | break; |
| 163212 | case 55: /* refact ::= SET NULL */ | 165005 | case 55: /* refact ::= SET NULL */ |
| 163213 | { yymsp[-1].minor.yy64 = OE_SetNull; /* EV: R-33326-45252 */} | 165006 | { yymsp[-1].minor.yy394 = OE_SetNull; /* EV: R-33326-45252 */} |
| 163214 | break; | 165007 | break; |
| 163215 | case 56: /* refact ::= SET DEFAULT */ | 165008 | case 56: /* refact ::= SET DEFAULT */ |
| 163216 | { yymsp[-1].minor.yy64 = OE_SetDflt; /* EV: R-33326-45252 */} | 165009 | { yymsp[-1].minor.yy394 = OE_SetDflt; /* EV: R-33326-45252 */} |
| 163217 | break; | 165010 | break; |
| 163218 | case 57: /* refact ::= CASCADE */ | 165011 | case 57: /* refact ::= CASCADE */ |
| 163219 | { yymsp[0].minor.yy64 = OE_Cascade; /* EV: R-33326-45252 */} | 165012 | { yymsp[0].minor.yy394 = OE_Cascade; /* EV: R-33326-45252 */} |
| 163220 | break; | 165013 | break; |
| 163221 | case 58: /* refact ::= RESTRICT */ | 165014 | case 58: /* refact ::= RESTRICT */ |
| 163222 | { yymsp[0].minor.yy64 = OE_Restrict; /* EV: R-33326-45252 */} | 165015 | { yymsp[0].minor.yy394 = OE_Restrict; /* EV: R-33326-45252 */} |
| 163223 | break; | 165016 | break; |
| 163224 | case 59: /* refact ::= NO ACTION */ | 165017 | case 59: /* refact ::= NO ACTION */ |
| 163225 | { yymsp[-1].minor.yy64 = OE_None; /* EV: R-33326-45252 */} | 165018 | { yymsp[-1].minor.yy394 = OE_None; /* EV: R-33326-45252 */} |
| 163226 | break; | 165019 | break; |
| 163227 | case 60: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ | 165020 | case 60: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ |
| 163228 | {yymsp[-2].minor.yy64 = 0;} | 165021 | {yymsp[-2].minor.yy394 = 0;} |
| 163229 | break; | 165022 | break; |
| 163230 | case 61: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ | 165023 | case 61: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ |
| 163231 | case 76: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==76); | 165024 | case 76: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==76); |
| 163232 | case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171); | 165025 | case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171); |
| 163233 | {yymsp[-1].minor.yy64 = yymsp[0].minor.yy64;} | 165026 | {yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;} |
| 163234 | break; | 165027 | break; |
| 163235 | case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ | 165028 | case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ |
| 163236 | case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80); | 165029 | case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80); |
| 163237 | case 213: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==213); | 165030 | case 214: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==214); |
| 163238 | case 216: /* in_op ::= NOT IN */ yytestcase(yyruleno==216); | 165031 | case 217: /* in_op ::= NOT IN */ yytestcase(yyruleno==217); |
| 163239 | case 242: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==242); | 165032 | case 243: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==243); |
| 163240 | {yymsp[-1].minor.yy64 = 1;} | 165033 | {yymsp[-1].minor.yy394 = 1;} |
| 163241 | break; | 165034 | break; |
| 163242 | case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ | 165035 | case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ |
| 163243 | {yymsp[-1].minor.yy64 = 0;} | 165036 | {yymsp[-1].minor.yy394 = 0;} |
| 163244 | break; | 165037 | break; |
| 163245 | case 66: /* tconscomma ::= COMMA */ | 165038 | case 66: /* tconscomma ::= COMMA */ |
| 163246 | {pParse->constraintName.n = 0;} | 165039 | {pParse->constraintName.n = 0;} |
| 163247 | break; | 165040 | break; |
| 163248 | case 68: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ | 165041 | case 68: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ |
| 163249 | {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy562,yymsp[0].minor.yy64,yymsp[-2].minor.yy64,0);} | 165042 | {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy322,yymsp[0].minor.yy394,yymsp[-2].minor.yy394,0);} |
| 163250 | break; | 165043 | break; |
| 163251 | case 69: /* tcons ::= UNIQUE LP sortlist RP onconf */ | 165044 | case 69: /* tcons ::= UNIQUE LP sortlist RP onconf */ |
| 163252 | {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy562,yymsp[0].minor.yy64,0,0,0,0, | 165045 | {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy322,yymsp[0].minor.yy394,0,0,0,0, |
| 163253 | SQLITE_IDXTYPE_UNIQUE);} | 165046 | SQLITE_IDXTYPE_UNIQUE);} |
| 163254 | break; | 165047 | break; |
| 163255 | case 70: /* tcons ::= CHECK LP expr RP onconf */ | 165048 | case 70: /* tcons ::= CHECK LP expr RP onconf */ |
| 163256 | {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy626,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);} | 165049 | {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy528,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);} |
| 163257 | break; | 165050 | break; |
| 163258 | case 71: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ | 165051 | case 71: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ |
| 163259 | { | 165052 | { |
| 163260 | sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy562, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy562, yymsp[-1].minor.yy64); | 165053 | sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy322, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[-1].minor.yy394); |
| 163261 | sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy64); | 165054 | sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy394); |
| 163262 | } | 165055 | } |
| 163263 | break; | 165056 | break; |
| 163264 | case 73: /* onconf ::= */ | 165057 | case 73: /* onconf ::= */ |
| 163265 | case 75: /* orconf ::= */ yytestcase(yyruleno==75); | 165058 | case 75: /* orconf ::= */ yytestcase(yyruleno==75); |
| 163266 | {yymsp[1].minor.yy64 = OE_Default;} | 165059 | {yymsp[1].minor.yy394 = OE_Default;} |
| 163267 | break; | 165060 | break; |
| 163268 | case 74: /* onconf ::= ON CONFLICT resolvetype */ | 165061 | case 74: /* onconf ::= ON CONFLICT resolvetype */ |
| 163269 | {yymsp[-2].minor.yy64 = yymsp[0].minor.yy64;} | 165062 | {yymsp[-2].minor.yy394 = yymsp[0].minor.yy394;} |
| 163270 | break; | 165063 | break; |
| 163271 | case 77: /* resolvetype ::= IGNORE */ | 165064 | case 77: /* resolvetype ::= IGNORE */ |
| 163272 | {yymsp[0].minor.yy64 = OE_Ignore;} | 165065 | {yymsp[0].minor.yy394 = OE_Ignore;} |
| 163273 | break; | 165066 | break; |
| 163274 | case 78: /* resolvetype ::= REPLACE */ | 165067 | case 78: /* resolvetype ::= REPLACE */ |
| 163275 | case 172: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==172); | 165068 | case 172: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==172); |
| 163276 | {yymsp[0].minor.yy64 = OE_Replace;} | 165069 | {yymsp[0].minor.yy394 = OE_Replace;} |
| 163277 | break; | 165070 | break; |
| 163278 | case 79: /* cmd ::= DROP TABLE ifexists fullname */ | 165071 | case 79: /* cmd ::= DROP TABLE ifexists fullname */ |
| 163279 | { | 165072 | { |
| 163280 | sqlite3DropTable(pParse, yymsp[0].minor.yy607, 0, yymsp[-1].minor.yy64); | 165073 | sqlite3DropTable(pParse, yymsp[0].minor.yy131, 0, yymsp[-1].minor.yy394); |
| 163281 | } | 165074 | } |
| 163282 | break; | 165075 | break; |
| 163283 | case 82: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ | 165076 | case 82: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ |
| 163284 | { | 165077 | { |
| 163285 | sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy562, yymsp[0].minor.yy303, yymsp[-7].minor.yy64, yymsp[-5].minor.yy64); | 165078 | sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[0].minor.yy47, yymsp[-7].minor.yy394, yymsp[-5].minor.yy394); |
| 163286 | } | 165079 | } |
| 163287 | break; | 165080 | break; |
| 163288 | case 83: /* cmd ::= DROP VIEW ifexists fullname */ | 165081 | case 83: /* cmd ::= DROP VIEW ifexists fullname */ |
| 163289 | { | 165082 | { |
| 163290 | sqlite3DropTable(pParse, yymsp[0].minor.yy607, 1, yymsp[-1].minor.yy64); | 165083 | sqlite3DropTable(pParse, yymsp[0].minor.yy131, 1, yymsp[-1].minor.yy394); |
| 163291 | } | 165084 | } |
| 163292 | break; | 165085 | break; |
| 163293 | case 84: /* cmd ::= select */ | 165086 | case 84: /* cmd ::= select */ |
| 163294 | { | 165087 | { |
| 163295 | SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0}; | 165088 | SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0}; |
| 163296 | sqlite3Select(pParse, yymsp[0].minor.yy303, &dest); | 165089 | sqlite3Select(pParse, yymsp[0].minor.yy47, &dest); |
| 163297 | sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy303); | 165090 | sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy47); |
| 163298 | } | 165091 | } |
| 163299 | break; | 165092 | break; |
| 163300 | case 85: /* select ::= WITH wqlist selectnowith */ | 165093 | case 85: /* select ::= WITH wqlist selectnowith */ |
| 163301 | {yymsp[-2].minor.yy303 = attachWithToSelect(pParse,yymsp[0].minor.yy303,yymsp[-1].minor.yy43);} | 165094 | {yymsp[-2].minor.yy47 = attachWithToSelect(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy521);} |
| 163302 | break; | 165095 | break; |
| 163303 | case 86: /* select ::= WITH RECURSIVE wqlist selectnowith */ | 165096 | case 86: /* select ::= WITH RECURSIVE wqlist selectnowith */ |
| 163304 | {yymsp[-3].minor.yy303 = attachWithToSelect(pParse,yymsp[0].minor.yy303,yymsp[-1].minor.yy43);} | 165097 | {yymsp[-3].minor.yy47 = attachWithToSelect(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy521);} |
| 163305 | break; | 165098 | break; |
| 163306 | case 87: /* select ::= selectnowith */ | 165099 | case 87: /* select ::= selectnowith */ |
| 163307 | { | 165100 | { |
| 163308 | Select *p = yymsp[0].minor.yy303; | 165101 | Select *p = yymsp[0].minor.yy47; |
| 163309 | if( p ){ | 165102 | if( p ){ |
| 163310 | parserDoubleLinkSelect(pParse, p); | 165103 | parserDoubleLinkSelect(pParse, p); |
| 163311 | } | 165104 | } |
| 163312 | yymsp[0].minor.yy303 = p; /*A-overwrites-X*/ | 165105 | yymsp[0].minor.yy47 = p; /*A-overwrites-X*/ |
| 163313 | } | 165106 | } |
| 163314 | break; | 165107 | break; |
| 163315 | case 88: /* selectnowith ::= selectnowith multiselect_op oneselect */ | 165108 | case 88: /* selectnowith ::= selectnowith multiselect_op oneselect */ |
| 163316 | { | 165109 | { |
| 163317 | Select *pRhs = yymsp[0].minor.yy303; | 165110 | Select *pRhs = yymsp[0].minor.yy47; |
| 163318 | Select *pLhs = yymsp[-2].minor.yy303; | 165111 | Select *pLhs = yymsp[-2].minor.yy47; |
| 163319 | if( pRhs && pRhs->pPrior ){ | 165112 | if( pRhs && pRhs->pPrior ){ |
| 163320 | SrcList *pFrom; | 165113 | SrcList *pFrom; |
| 163321 | Token x; | 165114 | Token x; |
| @@ -163325,140 +165118,140 @@ static YYACTIONTYPE yy_reduce( | |||
| 163325 | pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0); | 165118 | pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0); |
| 163326 | } | 165119 | } |
| 163327 | if( pRhs ){ | 165120 | if( pRhs ){ |
| 163328 | pRhs->op = (u8)yymsp[-1].minor.yy64; | 165121 | pRhs->op = (u8)yymsp[-1].minor.yy394; |
| 163329 | pRhs->pPrior = pLhs; | 165122 | pRhs->pPrior = pLhs; |
| 163330 | if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue; | 165123 | if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue; |
| 163331 | pRhs->selFlags &= ~SF_MultiValue; | 165124 | pRhs->selFlags &= ~SF_MultiValue; |
| 163332 | if( yymsp[-1].minor.yy64!=TK_ALL ) pParse->hasCompound = 1; | 165125 | if( yymsp[-1].minor.yy394!=TK_ALL ) pParse->hasCompound = 1; |
| 163333 | }else{ | 165126 | }else{ |
| 163334 | sqlite3SelectDelete(pParse->db, pLhs); | 165127 | sqlite3SelectDelete(pParse->db, pLhs); |
| 163335 | } | 165128 | } |
| 163336 | yymsp[-2].minor.yy303 = pRhs; | 165129 | yymsp[-2].minor.yy47 = pRhs; |
| 163337 | } | 165130 | } |
| 163338 | break; | 165131 | break; |
| 163339 | case 89: /* multiselect_op ::= UNION */ | 165132 | case 89: /* multiselect_op ::= UNION */ |
| 163340 | case 91: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==91); | 165133 | case 91: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==91); |
| 163341 | {yymsp[0].minor.yy64 = yymsp[0].major; /*A-overwrites-OP*/} | 165134 | {yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-OP*/} |
| 163342 | break; | 165135 | break; |
| 163343 | case 90: /* multiselect_op ::= UNION ALL */ | 165136 | case 90: /* multiselect_op ::= UNION ALL */ |
| 163344 | {yymsp[-1].minor.yy64 = TK_ALL;} | 165137 | {yymsp[-1].minor.yy394 = TK_ALL;} |
| 163345 | break; | 165138 | break; |
| 163346 | case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ | 165139 | case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ |
| 163347 | { | 165140 | { |
| 163348 | yymsp[-8].minor.yy303 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy562,yymsp[-5].minor.yy607,yymsp[-4].minor.yy626,yymsp[-3].minor.yy562,yymsp[-2].minor.yy626,yymsp[-1].minor.yy562,yymsp[-7].minor.yy64,yymsp[0].minor.yy626); | 165141 | yymsp[-8].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy322,yymsp[-5].minor.yy131,yymsp[-4].minor.yy528,yymsp[-3].minor.yy322,yymsp[-2].minor.yy528,yymsp[-1].minor.yy322,yymsp[-7].minor.yy394,yymsp[0].minor.yy528); |
| 163349 | } | 165142 | } |
| 163350 | break; | 165143 | break; |
| 163351 | case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ | 165144 | case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ |
| 163352 | { | 165145 | { |
| 163353 | yymsp[-9].minor.yy303 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy562,yymsp[-6].minor.yy607,yymsp[-5].minor.yy626,yymsp[-4].minor.yy562,yymsp[-3].minor.yy626,yymsp[-1].minor.yy562,yymsp[-8].minor.yy64,yymsp[0].minor.yy626); | 165146 | yymsp[-9].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy322,yymsp[-6].minor.yy131,yymsp[-5].minor.yy528,yymsp[-4].minor.yy322,yymsp[-3].minor.yy528,yymsp[-1].minor.yy322,yymsp[-8].minor.yy394,yymsp[0].minor.yy528); |
| 163354 | if( yymsp[-9].minor.yy303 ){ | 165147 | if( yymsp[-9].minor.yy47 ){ |
| 163355 | yymsp[-9].minor.yy303->pWinDefn = yymsp[-2].minor.yy375; | 165148 | yymsp[-9].minor.yy47->pWinDefn = yymsp[-2].minor.yy41; |
| 163356 | }else{ | 165149 | }else{ |
| 163357 | sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy375); | 165150 | sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy41); |
| 163358 | } | 165151 | } |
| 163359 | } | 165152 | } |
| 163360 | break; | 165153 | break; |
| 163361 | case 94: /* values ::= VALUES LP nexprlist RP */ | 165154 | case 94: /* values ::= VALUES LP nexprlist RP */ |
| 163362 | { | 165155 | { |
| 163363 | yymsp[-3].minor.yy303 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy562,0,0,0,0,0,SF_Values,0); | 165156 | yymsp[-3].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values,0); |
| 163364 | } | 165157 | } |
| 163365 | break; | 165158 | break; |
| 163366 | case 95: /* values ::= values COMMA LP nexprlist RP */ | 165159 | case 95: /* values ::= values COMMA LP nexprlist RP */ |
| 163367 | { | 165160 | { |
| 163368 | Select *pRight, *pLeft = yymsp[-4].minor.yy303; | 165161 | Select *pRight, *pLeft = yymsp[-4].minor.yy47; |
| 163369 | pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy562,0,0,0,0,0,SF_Values|SF_MultiValue,0); | 165162 | pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values|SF_MultiValue,0); |
| 163370 | if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue; | 165163 | if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue; |
| 163371 | if( pRight ){ | 165164 | if( pRight ){ |
| 163372 | pRight->op = TK_ALL; | 165165 | pRight->op = TK_ALL; |
| 163373 | pRight->pPrior = pLeft; | 165166 | pRight->pPrior = pLeft; |
| 163374 | yymsp[-4].minor.yy303 = pRight; | 165167 | yymsp[-4].minor.yy47 = pRight; |
| 163375 | }else{ | 165168 | }else{ |
| 163376 | yymsp[-4].minor.yy303 = pLeft; | 165169 | yymsp[-4].minor.yy47 = pLeft; |
| 163377 | } | 165170 | } |
| 163378 | } | 165171 | } |
| 163379 | break; | 165172 | break; |
| 163380 | case 96: /* distinct ::= DISTINCT */ | 165173 | case 96: /* distinct ::= DISTINCT */ |
| 163381 | {yymsp[0].minor.yy64 = SF_Distinct;} | 165174 | {yymsp[0].minor.yy394 = SF_Distinct;} |
| 163382 | break; | 165175 | break; |
| 163383 | case 97: /* distinct ::= ALL */ | 165176 | case 97: /* distinct ::= ALL */ |
| 163384 | {yymsp[0].minor.yy64 = SF_All;} | 165177 | {yymsp[0].minor.yy394 = SF_All;} |
| 163385 | break; | 165178 | break; |
| 163386 | case 99: /* sclp ::= */ | 165179 | case 99: /* sclp ::= */ |
| 163387 | case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132); | 165180 | case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132); |
| 163388 | case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142); | 165181 | case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142); |
| 163389 | case 229: /* exprlist ::= */ yytestcase(yyruleno==229); | 165182 | case 230: /* exprlist ::= */ yytestcase(yyruleno==230); |
| 163390 | case 232: /* paren_exprlist ::= */ yytestcase(yyruleno==232); | 165183 | case 233: /* paren_exprlist ::= */ yytestcase(yyruleno==233); |
| 163391 | case 237: /* eidlist_opt ::= */ yytestcase(yyruleno==237); | 165184 | case 238: /* eidlist_opt ::= */ yytestcase(yyruleno==238); |
| 163392 | {yymsp[1].minor.yy562 = 0;} | 165185 | {yymsp[1].minor.yy322 = 0;} |
| 163393 | break; | 165186 | break; |
| 163394 | case 100: /* selcollist ::= sclp scanpt expr scanpt as */ | 165187 | case 100: /* selcollist ::= sclp scanpt expr scanpt as */ |
| 163395 | { | 165188 | { |
| 163396 | yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy562, yymsp[-2].minor.yy626); | 165189 | yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528); |
| 163397 | if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy562, &yymsp[0].minor.yy0, 1); | 165190 | if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[0].minor.yy0, 1); |
| 163398 | sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy562,yymsp[-3].minor.yy600,yymsp[-1].minor.yy600); | 165191 | sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy322,yymsp[-3].minor.yy522,yymsp[-1].minor.yy522); |
| 163399 | } | 165192 | } |
| 163400 | break; | 165193 | break; |
| 163401 | case 101: /* selcollist ::= sclp scanpt STAR */ | 165194 | case 101: /* selcollist ::= sclp scanpt STAR */ |
| 163402 | { | 165195 | { |
| 163403 | Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0); | 165196 | Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0); |
| 163404 | yymsp[-2].minor.yy562 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy562, p); | 165197 | yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy322, p); |
| 163405 | } | 165198 | } |
| 163406 | break; | 165199 | break; |
| 163407 | case 102: /* selcollist ::= sclp scanpt nm DOT STAR */ | 165200 | case 102: /* selcollist ::= sclp scanpt nm DOT STAR */ |
| 163408 | { | 165201 | { |
| 163409 | Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0); | 165202 | Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0); |
| 163410 | Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); | 165203 | Expr *pLeft = tokenExpr(pParse, TK_ID, yymsp[-2].minor.yy0); |
| 163411 | Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight); | 165204 | Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight); |
| 163412 | yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy562, pDot); | 165205 | yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot); |
| 163413 | } | 165206 | } |
| 163414 | break; | 165207 | break; |
| 163415 | case 103: /* as ::= AS nm */ | 165208 | case 103: /* as ::= AS nm */ |
| 163416 | case 114: /* dbnm ::= DOT nm */ yytestcase(yyruleno==114); | 165209 | case 114: /* dbnm ::= DOT nm */ yytestcase(yyruleno==114); |
| 163417 | case 253: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==253); | 165210 | case 254: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==254); |
| 163418 | case 254: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==254); | 165211 | case 255: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==255); |
| 163419 | {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} | 165212 | {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} |
| 163420 | break; | 165213 | break; |
| 163421 | case 105: /* from ::= */ | 165214 | case 105: /* from ::= */ |
| 163422 | case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108); | 165215 | case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108); |
| 163423 | {yymsp[1].minor.yy607 = 0;} | 165216 | {yymsp[1].minor.yy131 = 0;} |
| 163424 | break; | 165217 | break; |
| 163425 | case 106: /* from ::= FROM seltablist */ | 165218 | case 106: /* from ::= FROM seltablist */ |
| 163426 | { | 165219 | { |
| 163427 | yymsp[-1].minor.yy607 = yymsp[0].minor.yy607; | 165220 | yymsp[-1].minor.yy131 = yymsp[0].minor.yy131; |
| 163428 | sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy607); | 165221 | sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy131); |
| 163429 | } | 165222 | } |
| 163430 | break; | 165223 | break; |
| 163431 | case 107: /* stl_prefix ::= seltablist joinop */ | 165224 | case 107: /* stl_prefix ::= seltablist joinop */ |
| 163432 | { | 165225 | { |
| 163433 | if( ALWAYS(yymsp[-1].minor.yy607 && yymsp[-1].minor.yy607->nSrc>0) ) yymsp[-1].minor.yy607->a[yymsp[-1].minor.yy607->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy64; | 165226 | if( ALWAYS(yymsp[-1].minor.yy131 && yymsp[-1].minor.yy131->nSrc>0) ) yymsp[-1].minor.yy131->a[yymsp[-1].minor.yy131->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy394; |
| 163434 | } | 165227 | } |
| 163435 | break; | 165228 | break; |
| 163436 | case 109: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ | 165229 | case 109: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ |
| 163437 | { | 165230 | { |
| 163438 | yymsp[-6].minor.yy607 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy607,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy626,yymsp[0].minor.yy240); | 165231 | yymsp[-6].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy131,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy528,yymsp[0].minor.yy254); |
| 163439 | sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy607, &yymsp[-2].minor.yy0); | 165232 | sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy131, &yymsp[-2].minor.yy0); |
| 163440 | } | 165233 | } |
| 163441 | break; | 165234 | break; |
| 163442 | case 110: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ | 165235 | case 110: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ |
| 163443 | { | 165236 | { |
| 163444 | yymsp[-8].minor.yy607 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy607,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy626,yymsp[0].minor.yy240); | 165237 | yymsp[-8].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy131,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy528,yymsp[0].minor.yy254); |
| 163445 | sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy607, yymsp[-4].minor.yy562); | 165238 | sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy131, yymsp[-4].minor.yy322); |
| 163446 | } | 165239 | } |
| 163447 | break; | 165240 | break; |
| 163448 | case 111: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ | 165241 | case 111: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ |
| 163449 | { | 165242 | { |
| 163450 | yymsp[-6].minor.yy607 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy607,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy303,yymsp[-1].minor.yy626,yymsp[0].minor.yy240); | 165243 | yymsp[-6].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy131,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy47,yymsp[-1].minor.yy528,yymsp[0].minor.yy254); |
| 163451 | } | 165244 | } |
| 163452 | break; | 165245 | break; |
| 163453 | case 112: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ | 165246 | case 112: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ |
| 163454 | { | 165247 | { |
| 163455 | if( yymsp[-6].minor.yy607==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy626==0 && yymsp[0].minor.yy240==0 ){ | 165248 | if( yymsp[-6].minor.yy131==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy528==0 && yymsp[0].minor.yy254==0 ){ |
| 163456 | yymsp[-6].minor.yy607 = yymsp[-4].minor.yy607; | 165249 | yymsp[-6].minor.yy131 = yymsp[-4].minor.yy131; |
| 163457 | }else if( yymsp[-4].minor.yy607->nSrc==1 ){ | 165250 | }else if( yymsp[-4].minor.yy131->nSrc==1 ){ |
| 163458 | yymsp[-6].minor.yy607 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy607,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy626,yymsp[0].minor.yy240); | 165251 | yymsp[-6].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy131,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy528,yymsp[0].minor.yy254); |
| 163459 | if( yymsp[-6].minor.yy607 ){ | 165252 | if( yymsp[-6].minor.yy131 ){ |
| 163460 | SrcItem *pNew = &yymsp[-6].minor.yy607->a[yymsp[-6].minor.yy607->nSrc-1]; | 165253 | SrcItem *pNew = &yymsp[-6].minor.yy131->a[yymsp[-6].minor.yy131->nSrc-1]; |
| 163461 | SrcItem *pOld = yymsp[-4].minor.yy607->a; | 165254 | SrcItem *pOld = yymsp[-4].minor.yy131->a; |
| 163462 | pNew->zName = pOld->zName; | 165255 | pNew->zName = pOld->zName; |
| 163463 | pNew->zDatabase = pOld->zDatabase; | 165256 | pNew->zDatabase = pOld->zDatabase; |
| 163464 | pNew->pSelect = pOld->pSelect; | 165257 | pNew->pSelect = pOld->pSelect; |
| @@ -163471,12 +165264,12 @@ static YYACTIONTYPE yy_reduce( | |||
| 163471 | pOld->zName = pOld->zDatabase = 0; | 165264 | pOld->zName = pOld->zDatabase = 0; |
| 163472 | pOld->pSelect = 0; | 165265 | pOld->pSelect = 0; |
| 163473 | } | 165266 | } |
| 163474 | sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy607); | 165267 | sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy131); |
| 163475 | }else{ | 165268 | }else{ |
| 163476 | Select *pSubquery; | 165269 | Select *pSubquery; |
| 163477 | sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy607); | 165270 | sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy131); |
| 163478 | pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy607,0,0,0,0,SF_NestedFrom,0); | 165271 | pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy131,0,0,0,0,SF_NestedFrom,0); |
| 163479 | yymsp[-6].minor.yy607 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy607,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy626,yymsp[0].minor.yy240); | 165272 | yymsp[-6].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy131,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy528,yymsp[0].minor.yy254); |
| 163480 | } | 165273 | } |
| 163481 | } | 165274 | } |
| 163482 | break; | 165275 | break; |
| @@ -163486,65 +165279,65 @@ static YYACTIONTYPE yy_reduce( | |||
| 163486 | break; | 165279 | break; |
| 163487 | case 115: /* fullname ::= nm */ | 165280 | case 115: /* fullname ::= nm */ |
| 163488 | { | 165281 | { |
| 163489 | yylhsminor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); | 165282 | yylhsminor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); |
| 163490 | if( IN_RENAME_OBJECT && yylhsminor.yy607 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy607->a[0].zName, &yymsp[0].minor.yy0); | 165283 | if( IN_RENAME_OBJECT && yylhsminor.yy131 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy131->a[0].zName, &yymsp[0].minor.yy0); |
| 163491 | } | 165284 | } |
| 163492 | yymsp[0].minor.yy607 = yylhsminor.yy607; | 165285 | yymsp[0].minor.yy131 = yylhsminor.yy131; |
| 163493 | break; | 165286 | break; |
| 163494 | case 116: /* fullname ::= nm DOT nm */ | 165287 | case 116: /* fullname ::= nm DOT nm */ |
| 163495 | { | 165288 | { |
| 163496 | yylhsminor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); | 165289 | yylhsminor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); |
| 163497 | if( IN_RENAME_OBJECT && yylhsminor.yy607 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy607->a[0].zName, &yymsp[0].minor.yy0); | 165290 | if( IN_RENAME_OBJECT && yylhsminor.yy131 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy131->a[0].zName, &yymsp[0].minor.yy0); |
| 163498 | } | 165291 | } |
| 163499 | yymsp[-2].minor.yy607 = yylhsminor.yy607; | 165292 | yymsp[-2].minor.yy131 = yylhsminor.yy131; |
| 163500 | break; | 165293 | break; |
| 163501 | case 117: /* xfullname ::= nm */ | 165294 | case 117: /* xfullname ::= nm */ |
| 163502 | {yymsp[0].minor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} | 165295 | {yymsp[0].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} |
| 163503 | break; | 165296 | break; |
| 163504 | case 118: /* xfullname ::= nm DOT nm */ | 165297 | case 118: /* xfullname ::= nm DOT nm */ |
| 163505 | {yymsp[-2].minor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} | 165298 | {yymsp[-2].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 163506 | break; | 165299 | break; |
| 163507 | case 119: /* xfullname ::= nm DOT nm AS nm */ | 165300 | case 119: /* xfullname ::= nm DOT nm AS nm */ |
| 163508 | { | 165301 | { |
| 163509 | yymsp[-4].minor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ | 165302 | yymsp[-4].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ |
| 163510 | if( yymsp[-4].minor.yy607 ) yymsp[-4].minor.yy607->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); | 165303 | if( yymsp[-4].minor.yy131 ) yymsp[-4].minor.yy131->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); |
| 163511 | } | 165304 | } |
| 163512 | break; | 165305 | break; |
| 163513 | case 120: /* xfullname ::= nm AS nm */ | 165306 | case 120: /* xfullname ::= nm AS nm */ |
| 163514 | { | 165307 | { |
| 163515 | yymsp[-2].minor.yy607 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/ | 165308 | yymsp[-2].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/ |
| 163516 | if( yymsp[-2].minor.yy607 ) yymsp[-2].minor.yy607->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); | 165309 | if( yymsp[-2].minor.yy131 ) yymsp[-2].minor.yy131->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); |
| 163517 | } | 165310 | } |
| 163518 | break; | 165311 | break; |
| 163519 | case 121: /* joinop ::= COMMA|JOIN */ | 165312 | case 121: /* joinop ::= COMMA|JOIN */ |
| 163520 | { yymsp[0].minor.yy64 = JT_INNER; } | 165313 | { yymsp[0].minor.yy394 = JT_INNER; } |
| 163521 | break; | 165314 | break; |
| 163522 | case 122: /* joinop ::= JOIN_KW JOIN */ | 165315 | case 122: /* joinop ::= JOIN_KW JOIN */ |
| 163523 | {yymsp[-1].minor.yy64 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} | 165316 | {yymsp[-1].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} |
| 163524 | break; | 165317 | break; |
| 163525 | case 123: /* joinop ::= JOIN_KW nm JOIN */ | 165318 | case 123: /* joinop ::= JOIN_KW nm JOIN */ |
| 163526 | {yymsp[-2].minor.yy64 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} | 165319 | {yymsp[-2].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} |
| 163527 | break; | 165320 | break; |
| 163528 | case 124: /* joinop ::= JOIN_KW nm nm JOIN */ | 165321 | case 124: /* joinop ::= JOIN_KW nm nm JOIN */ |
| 163529 | {yymsp[-3].minor.yy64 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} | 165322 | {yymsp[-3].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} |
| 163530 | break; | 165323 | break; |
| 163531 | case 125: /* on_opt ::= ON expr */ | 165324 | case 125: /* on_opt ::= ON expr */ |
| 163532 | case 145: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==145); | 165325 | case 145: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==145); |
| 163533 | case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152); | 165326 | case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152); |
| 163534 | case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154); | 165327 | case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154); |
| 163535 | case 225: /* case_else ::= ELSE expr */ yytestcase(yyruleno==225); | 165328 | case 226: /* case_else ::= ELSE expr */ yytestcase(yyruleno==226); |
| 163536 | case 246: /* vinto ::= INTO expr */ yytestcase(yyruleno==246); | 165329 | case 247: /* vinto ::= INTO expr */ yytestcase(yyruleno==247); |
| 163537 | {yymsp[-1].minor.yy626 = yymsp[0].minor.yy626;} | 165330 | {yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;} |
| 163538 | break; | 165331 | break; |
| 163539 | case 126: /* on_opt ::= */ | 165332 | case 126: /* on_opt ::= */ |
| 163540 | case 144: /* having_opt ::= */ yytestcase(yyruleno==144); | 165333 | case 144: /* having_opt ::= */ yytestcase(yyruleno==144); |
| 163541 | case 146: /* limit_opt ::= */ yytestcase(yyruleno==146); | 165334 | case 146: /* limit_opt ::= */ yytestcase(yyruleno==146); |
| 163542 | case 151: /* where_opt ::= */ yytestcase(yyruleno==151); | 165335 | case 151: /* where_opt ::= */ yytestcase(yyruleno==151); |
| 163543 | case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153); | 165336 | case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153); |
| 163544 | case 226: /* case_else ::= */ yytestcase(yyruleno==226); | 165337 | case 227: /* case_else ::= */ yytestcase(yyruleno==227); |
| 163545 | case 228: /* case_operand ::= */ yytestcase(yyruleno==228); | 165338 | case 229: /* case_operand ::= */ yytestcase(yyruleno==229); |
| 163546 | case 247: /* vinto ::= */ yytestcase(yyruleno==247); | 165339 | case 248: /* vinto ::= */ yytestcase(yyruleno==248); |
| 163547 | {yymsp[1].minor.yy626 = 0;} | 165340 | {yymsp[1].minor.yy528 = 0;} |
| 163548 | break; | 165341 | break; |
| 163549 | case 128: /* indexed_opt ::= INDEXED BY nm */ | 165342 | case 128: /* indexed_opt ::= INDEXED BY nm */ |
| 163550 | {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;} | 165343 | {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;} |
| @@ -163553,185 +165346,181 @@ static YYACTIONTYPE yy_reduce( | |||
| 163553 | {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;} | 165346 | {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;} |
| 163554 | break; | 165347 | break; |
| 163555 | case 130: /* using_opt ::= USING LP idlist RP */ | 165348 | case 130: /* using_opt ::= USING LP idlist RP */ |
| 163556 | {yymsp[-3].minor.yy240 = yymsp[-1].minor.yy240;} | 165349 | {yymsp[-3].minor.yy254 = yymsp[-1].minor.yy254;} |
| 163557 | break; | 165350 | break; |
| 163558 | case 131: /* using_opt ::= */ | 165351 | case 131: /* using_opt ::= */ |
| 163559 | case 173: /* idlist_opt ::= */ yytestcase(yyruleno==173); | 165352 | case 173: /* idlist_opt ::= */ yytestcase(yyruleno==173); |
| 163560 | {yymsp[1].minor.yy240 = 0;} | 165353 | {yymsp[1].minor.yy254 = 0;} |
| 163561 | break; | 165354 | break; |
| 163562 | case 133: /* orderby_opt ::= ORDER BY sortlist */ | 165355 | case 133: /* orderby_opt ::= ORDER BY sortlist */ |
| 163563 | case 143: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==143); | 165356 | case 143: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==143); |
| 163564 | {yymsp[-2].minor.yy562 = yymsp[0].minor.yy562;} | 165357 | {yymsp[-2].minor.yy322 = yymsp[0].minor.yy322;} |
| 163565 | break; | 165358 | break; |
| 163566 | case 134: /* sortlist ::= sortlist COMMA expr sortorder nulls */ | 165359 | case 134: /* sortlist ::= sortlist COMMA expr sortorder nulls */ |
| 163567 | { | 165360 | { |
| 163568 | yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy562,yymsp[-2].minor.yy626); | 165361 | yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322,yymsp[-2].minor.yy528); |
| 163569 | sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy562,yymsp[-1].minor.yy64,yymsp[0].minor.yy64); | 165362 | sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy322,yymsp[-1].minor.yy394,yymsp[0].minor.yy394); |
| 163570 | } | 165363 | } |
| 163571 | break; | 165364 | break; |
| 163572 | case 135: /* sortlist ::= expr sortorder nulls */ | 165365 | case 135: /* sortlist ::= expr sortorder nulls */ |
| 163573 | { | 165366 | { |
| 163574 | yymsp[-2].minor.yy562 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy626); /*A-overwrites-Y*/ | 165367 | yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy528); /*A-overwrites-Y*/ |
| 163575 | sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy562,yymsp[-1].minor.yy64,yymsp[0].minor.yy64); | 165368 | sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy322,yymsp[-1].minor.yy394,yymsp[0].minor.yy394); |
| 163576 | } | 165369 | } |
| 163577 | break; | 165370 | break; |
| 163578 | case 136: /* sortorder ::= ASC */ | 165371 | case 136: /* sortorder ::= ASC */ |
| 163579 | {yymsp[0].minor.yy64 = SQLITE_SO_ASC;} | 165372 | {yymsp[0].minor.yy394 = SQLITE_SO_ASC;} |
| 163580 | break; | 165373 | break; |
| 163581 | case 137: /* sortorder ::= DESC */ | 165374 | case 137: /* sortorder ::= DESC */ |
| 163582 | {yymsp[0].minor.yy64 = SQLITE_SO_DESC;} | 165375 | {yymsp[0].minor.yy394 = SQLITE_SO_DESC;} |
| 163583 | break; | 165376 | break; |
| 163584 | case 138: /* sortorder ::= */ | 165377 | case 138: /* sortorder ::= */ |
| 163585 | case 141: /* nulls ::= */ yytestcase(yyruleno==141); | 165378 | case 141: /* nulls ::= */ yytestcase(yyruleno==141); |
| 163586 | {yymsp[1].minor.yy64 = SQLITE_SO_UNDEFINED;} | 165379 | {yymsp[1].minor.yy394 = SQLITE_SO_UNDEFINED;} |
| 163587 | break; | 165380 | break; |
| 163588 | case 139: /* nulls ::= NULLS FIRST */ | 165381 | case 139: /* nulls ::= NULLS FIRST */ |
| 163589 | {yymsp[-1].minor.yy64 = SQLITE_SO_ASC;} | 165382 | {yymsp[-1].minor.yy394 = SQLITE_SO_ASC;} |
| 163590 | break; | 165383 | break; |
| 163591 | case 140: /* nulls ::= NULLS LAST */ | 165384 | case 140: /* nulls ::= NULLS LAST */ |
| 163592 | {yymsp[-1].minor.yy64 = SQLITE_SO_DESC;} | 165385 | {yymsp[-1].minor.yy394 = SQLITE_SO_DESC;} |
| 163593 | break; | 165386 | break; |
| 163594 | case 147: /* limit_opt ::= LIMIT expr */ | 165387 | case 147: /* limit_opt ::= LIMIT expr */ |
| 163595 | {yymsp[-1].minor.yy626 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy626,0);} | 165388 | {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);} |
| 163596 | break; | 165389 | break; |
| 163597 | case 148: /* limit_opt ::= LIMIT expr OFFSET expr */ | 165390 | case 148: /* limit_opt ::= LIMIT expr OFFSET expr */ |
| 163598 | {yymsp[-3].minor.yy626 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy626,yymsp[0].minor.yy626);} | 165391 | {yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);} |
| 163599 | break; | 165392 | break; |
| 163600 | case 149: /* limit_opt ::= LIMIT expr COMMA expr */ | 165393 | case 149: /* limit_opt ::= LIMIT expr COMMA expr */ |
| 163601 | {yymsp[-3].minor.yy626 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy626,yymsp[-2].minor.yy626);} | 165394 | {yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,yymsp[-2].minor.yy528);} |
| 163602 | break; | 165395 | break; |
| 163603 | case 150: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ | 165396 | case 150: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret */ |
| 163604 | { | 165397 | { |
| 163605 | sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy607, &yymsp[-1].minor.yy0); | 165398 | sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy131, &yymsp[-1].minor.yy0); |
| 163606 | sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy607,yymsp[0].minor.yy626,0,0); | 165399 | sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy131,yymsp[0].minor.yy528,0,0); |
| 163607 | } | 165400 | } |
| 163608 | break; | 165401 | break; |
| 163609 | case 155: /* where_opt_ret ::= RETURNING selcollist */ | 165402 | case 155: /* where_opt_ret ::= RETURNING selcollist */ |
| 163610 | {sqlite3AddReturning(pParse,yymsp[0].minor.yy562); yymsp[-1].minor.yy626 = 0;} | 165403 | {sqlite3AddReturning(pParse,yymsp[0].minor.yy322); yymsp[-1].minor.yy528 = 0;} |
| 163611 | break; | 165404 | break; |
| 163612 | case 156: /* where_opt_ret ::= WHERE expr RETURNING selcollist */ | 165405 | case 156: /* where_opt_ret ::= WHERE expr RETURNING selcollist */ |
| 163613 | {sqlite3AddReturning(pParse,yymsp[0].minor.yy562); yymsp[-3].minor.yy626 = yymsp[-2].minor.yy626;} | 165406 | {sqlite3AddReturning(pParse,yymsp[0].minor.yy322); yymsp[-3].minor.yy528 = yymsp[-2].minor.yy528;} |
| 163614 | break; | 165407 | break; |
| 163615 | case 157: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ | 165408 | case 157: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret */ |
| 163616 | { | 165409 | { |
| 163617 | sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy607, &yymsp[-4].minor.yy0); | 165410 | sqlite3SrcListIndexedBy(pParse, yymsp[-5].minor.yy131, &yymsp[-4].minor.yy0); |
| 163618 | sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy562,"set list"); | 165411 | sqlite3ExprListCheckLength(pParse,yymsp[-2].minor.yy322,"set list"); |
| 163619 | yymsp[-5].minor.yy607 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy607, yymsp[-1].minor.yy607); | 165412 | yymsp[-5].minor.yy131 = sqlite3SrcListAppendList(pParse, yymsp[-5].minor.yy131, yymsp[-1].minor.yy131); |
| 163620 | sqlite3Update(pParse,yymsp[-5].minor.yy607,yymsp[-2].minor.yy562,yymsp[0].minor.yy626,yymsp[-6].minor.yy64,0,0,0); | 165413 | sqlite3Update(pParse,yymsp[-5].minor.yy131,yymsp[-2].minor.yy322,yymsp[0].minor.yy528,yymsp[-6].minor.yy394,0,0,0); |
| 163621 | } | 165414 | } |
| 163622 | break; | 165415 | break; |
| 163623 | case 158: /* setlist ::= setlist COMMA nm EQ expr */ | 165416 | case 158: /* setlist ::= setlist COMMA nm EQ expr */ |
| 163624 | { | 165417 | { |
| 163625 | yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy562, yymsp[0].minor.yy626); | 165418 | yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[0].minor.yy528); |
| 163626 | sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy562, &yymsp[-2].minor.yy0, 1); | 165419 | sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, 1); |
| 163627 | } | 165420 | } |
| 163628 | break; | 165421 | break; |
| 163629 | case 159: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ | 165422 | case 159: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ |
| 163630 | { | 165423 | { |
| 163631 | yymsp[-6].minor.yy562 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy562, yymsp[-3].minor.yy240, yymsp[0].minor.yy626); | 165424 | yymsp[-6].minor.yy322 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy322, yymsp[-3].minor.yy254, yymsp[0].minor.yy528); |
| 163632 | } | 165425 | } |
| 163633 | break; | 165426 | break; |
| 163634 | case 160: /* setlist ::= nm EQ expr */ | 165427 | case 160: /* setlist ::= nm EQ expr */ |
| 163635 | { | 165428 | { |
| 163636 | yylhsminor.yy562 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy626); | 165429 | yylhsminor.yy322 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy528); |
| 163637 | sqlite3ExprListSetName(pParse, yylhsminor.yy562, &yymsp[-2].minor.yy0, 1); | 165430 | sqlite3ExprListSetName(pParse, yylhsminor.yy322, &yymsp[-2].minor.yy0, 1); |
| 163638 | } | 165431 | } |
| 163639 | yymsp[-2].minor.yy562 = yylhsminor.yy562; | 165432 | yymsp[-2].minor.yy322 = yylhsminor.yy322; |
| 163640 | break; | 165433 | break; |
| 163641 | case 161: /* setlist ::= LP idlist RP EQ expr */ | 165434 | case 161: /* setlist ::= LP idlist RP EQ expr */ |
| 163642 | { | 165435 | { |
| 163643 | yymsp[-4].minor.yy562 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy240, yymsp[0].minor.yy626); | 165436 | yymsp[-4].minor.yy322 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy254, yymsp[0].minor.yy528); |
| 163644 | } | 165437 | } |
| 163645 | break; | 165438 | break; |
| 163646 | case 162: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ | 165439 | case 162: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ |
| 163647 | { | 165440 | { |
| 163648 | sqlite3Insert(pParse, yymsp[-3].minor.yy607, yymsp[-1].minor.yy303, yymsp[-2].minor.yy240, yymsp[-5].minor.yy64, yymsp[0].minor.yy138); | 165441 | sqlite3Insert(pParse, yymsp[-3].minor.yy131, yymsp[-1].minor.yy47, yymsp[-2].minor.yy254, yymsp[-5].minor.yy394, yymsp[0].minor.yy444); |
| 163649 | } | 165442 | } |
| 163650 | break; | 165443 | break; |
| 163651 | case 163: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ | 165444 | case 163: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ |
| 163652 | { | 165445 | { |
| 163653 | sqlite3Insert(pParse, yymsp[-4].minor.yy607, 0, yymsp[-3].minor.yy240, yymsp[-6].minor.yy64, 0); | 165446 | sqlite3Insert(pParse, yymsp[-4].minor.yy131, 0, yymsp[-3].minor.yy254, yymsp[-6].minor.yy394, 0); |
| 163654 | } | 165447 | } |
| 163655 | break; | 165448 | break; |
| 163656 | case 164: /* upsert ::= */ | 165449 | case 164: /* upsert ::= */ |
| 163657 | { yymsp[1].minor.yy138 = 0; } | 165450 | { yymsp[1].minor.yy444 = 0; } |
| 163658 | break; | 165451 | break; |
| 163659 | case 165: /* upsert ::= RETURNING selcollist */ | 165452 | case 165: /* upsert ::= RETURNING selcollist */ |
| 163660 | { yymsp[-1].minor.yy138 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy562); } | 165453 | { yymsp[-1].minor.yy444 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy322); } |
| 163661 | break; | 165454 | break; |
| 163662 | case 166: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ | 165455 | case 166: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ |
| 163663 | { yymsp[-11].minor.yy138 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy562,yymsp[-6].minor.yy626,yymsp[-2].minor.yy562,yymsp[-1].minor.yy626,yymsp[0].minor.yy138);} | 165456 | { yymsp[-11].minor.yy444 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy322,yymsp[-6].minor.yy528,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528,yymsp[0].minor.yy444);} |
| 163664 | break; | 165457 | break; |
| 163665 | case 167: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ | 165458 | case 167: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ |
| 163666 | { yymsp[-8].minor.yy138 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy562,yymsp[-3].minor.yy626,0,0,yymsp[0].minor.yy138); } | 165459 | { yymsp[-8].minor.yy444 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy322,yymsp[-3].minor.yy528,0,0,yymsp[0].minor.yy444); } |
| 163667 | break; | 165460 | break; |
| 163668 | case 168: /* upsert ::= ON CONFLICT DO NOTHING returning */ | 165461 | case 168: /* upsert ::= ON CONFLICT DO NOTHING returning */ |
| 163669 | { yymsp[-4].minor.yy138 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); } | 165462 | { yymsp[-4].minor.yy444 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); } |
| 163670 | break; | 165463 | break; |
| 163671 | case 169: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ | 165464 | case 169: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ |
| 163672 | { yymsp[-7].minor.yy138 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy562,yymsp[-1].minor.yy626,0);} | 165465 | { yymsp[-7].minor.yy444 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528,0);} |
| 163673 | break; | 165466 | break; |
| 163674 | case 170: /* returning ::= RETURNING selcollist */ | 165467 | case 170: /* returning ::= RETURNING selcollist */ |
| 163675 | {sqlite3AddReturning(pParse,yymsp[0].minor.yy562);} | 165468 | {sqlite3AddReturning(pParse,yymsp[0].minor.yy322);} |
| 163676 | break; | 165469 | break; |
| 163677 | case 174: /* idlist_opt ::= LP idlist RP */ | 165470 | case 174: /* idlist_opt ::= LP idlist RP */ |
| 163678 | {yymsp[-2].minor.yy240 = yymsp[-1].minor.yy240;} | 165471 | {yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;} |
| 163679 | break; | 165472 | break; |
| 163680 | case 175: /* idlist ::= idlist COMMA nm */ | 165473 | case 175: /* idlist ::= idlist COMMA nm */ |
| 163681 | {yymsp[-2].minor.yy240 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy240,&yymsp[0].minor.yy0);} | 165474 | {yymsp[-2].minor.yy254 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);} |
| 163682 | break; | 165475 | break; |
| 163683 | case 176: /* idlist ::= nm */ | 165476 | case 176: /* idlist ::= nm */ |
| 163684 | {yymsp[0].minor.yy240 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} | 165477 | {yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} |
| 163685 | break; | 165478 | break; |
| 163686 | case 177: /* expr ::= LP expr RP */ | 165479 | case 177: /* expr ::= LP expr RP */ |
| 163687 | {yymsp[-2].minor.yy626 = yymsp[-1].minor.yy626;} | 165480 | {yymsp[-2].minor.yy528 = yymsp[-1].minor.yy528;} |
| 163688 | break; | 165481 | break; |
| 163689 | case 178: /* expr ::= ID|INDEXED */ | 165482 | case 178: /* expr ::= ID|INDEXED */ |
| 163690 | case 179: /* expr ::= JOIN_KW */ yytestcase(yyruleno==179); | 165483 | case 179: /* expr ::= JOIN_KW */ yytestcase(yyruleno==179); |
| 163691 | {yymsp[0].minor.yy626=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} | 165484 | {yymsp[0].minor.yy528=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 163692 | break; | 165485 | break; |
| 163693 | case 180: /* expr ::= nm DOT nm */ | 165486 | case 180: /* expr ::= nm DOT nm */ |
| 163694 | { | 165487 | { |
| 163695 | Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); | 165488 | Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0); |
| 163696 | Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); | 165489 | Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); |
| 163697 | if( IN_RENAME_OBJECT ){ | 165490 | yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); |
| 163698 | sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0); | ||
| 163699 | sqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0); | ||
| 163700 | } | ||
| 163701 | yylhsminor.yy626 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); | ||
| 163702 | } | 165491 | } |
| 163703 | yymsp[-2].minor.yy626 = yylhsminor.yy626; | 165492 | yymsp[-2].minor.yy528 = yylhsminor.yy528; |
| 163704 | break; | 165493 | break; |
| 163705 | case 181: /* expr ::= nm DOT nm DOT nm */ | 165494 | case 181: /* expr ::= nm DOT nm DOT nm */ |
| 163706 | { | 165495 | { |
| 163707 | Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1); | 165496 | Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0); |
| 163708 | Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); | 165497 | Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0); |
| 163709 | Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); | 165498 | Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); |
| 163710 | Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3); | 165499 | Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3); |
| 163711 | if( IN_RENAME_OBJECT ){ | 165500 | if( IN_RENAME_OBJECT ){ |
| 163712 | sqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0); | 165501 | sqlite3RenameTokenRemap(pParse, 0, temp1); |
| 163713 | sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0); | ||
| 163714 | } | 165502 | } |
| 163715 | yylhsminor.yy626 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); | 165503 | yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); |
| 163716 | } | 165504 | } |
| 163717 | yymsp[-4].minor.yy626 = yylhsminor.yy626; | 165505 | yymsp[-4].minor.yy528 = yylhsminor.yy528; |
| 163718 | break; | 165506 | break; |
| 163719 | case 182: /* term ::= NULL|FLOAT|BLOB */ | 165507 | case 182: /* term ::= NULL|FLOAT|BLOB */ |
| 163720 | case 183: /* term ::= STRING */ yytestcase(yyruleno==183); | 165508 | case 183: /* term ::= STRING */ yytestcase(yyruleno==183); |
| 163721 | {yymsp[0].minor.yy626=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/} | 165509 | {yymsp[0].minor.yy528=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 163722 | break; | 165510 | break; |
| 163723 | case 184: /* term ::= INTEGER */ | 165511 | case 184: /* term ::= INTEGER */ |
| 163724 | { | 165512 | { |
| 163725 | yylhsminor.yy626 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); | 165513 | yylhsminor.yy528 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); |
| 165514 | if( yylhsminor.yy528 ) yylhsminor.yy528->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail); | ||
| 163726 | } | 165515 | } |
| 163727 | yymsp[0].minor.yy626 = yylhsminor.yy626; | 165516 | yymsp[0].minor.yy528 = yylhsminor.yy528; |
| 163728 | break; | 165517 | break; |
| 163729 | case 185: /* expr ::= VARIABLE */ | 165518 | case 185: /* expr ::= VARIABLE */ |
| 163730 | { | 165519 | { |
| 163731 | if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){ | 165520 | if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){ |
| 163732 | u32 n = yymsp[0].minor.yy0.n; | 165521 | u32 n = yymsp[0].minor.yy0.n; |
| 163733 | yymsp[0].minor.yy626 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0); | 165522 | yymsp[0].minor.yy528 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0); |
| 163734 | sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy626, n); | 165523 | sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy528, n); |
| 163735 | }else{ | 165524 | }else{ |
| 163736 | /* When doing a nested parse, one can include terms in an expression | 165525 | /* When doing a nested parse, one can include terms in an expression |
| 163737 | ** that look like this: #1 #2 ... These terms refer to registers | 165526 | ** that look like this: #1 #2 ... These terms refer to registers |
| @@ -163740,65 +165529,65 @@ static YYACTIONTYPE yy_reduce( | |||
| 163740 | assert( t.n>=2 ); | 165529 | assert( t.n>=2 ); |
| 163741 | if( pParse->nested==0 ){ | 165530 | if( pParse->nested==0 ){ |
| 163742 | sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t); | 165531 | sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t); |
| 163743 | yymsp[0].minor.yy626 = 0; | 165532 | yymsp[0].minor.yy528 = 0; |
| 163744 | }else{ | 165533 | }else{ |
| 163745 | yymsp[0].minor.yy626 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); | 165534 | yymsp[0].minor.yy528 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); |
| 163746 | if( yymsp[0].minor.yy626 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy626->iTable); | 165535 | if( yymsp[0].minor.yy528 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy528->iTable); |
| 163747 | } | 165536 | } |
| 163748 | } | 165537 | } |
| 163749 | } | 165538 | } |
| 163750 | break; | 165539 | break; |
| 163751 | case 186: /* expr ::= expr COLLATE ID|STRING */ | 165540 | case 186: /* expr ::= expr COLLATE ID|STRING */ |
| 163752 | { | 165541 | { |
| 163753 | yymsp[-2].minor.yy626 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy626, &yymsp[0].minor.yy0, 1); | 165542 | yymsp[-2].minor.yy528 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy528, &yymsp[0].minor.yy0, 1); |
| 163754 | } | 165543 | } |
| 163755 | break; | 165544 | break; |
| 163756 | case 187: /* expr ::= CAST LP expr AS typetoken RP */ | 165545 | case 187: /* expr ::= CAST LP expr AS typetoken RP */ |
| 163757 | { | 165546 | { |
| 163758 | yymsp[-5].minor.yy626 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); | 165547 | yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); |
| 163759 | sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy626, yymsp[-3].minor.yy626, 0); | 165548 | sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy528, yymsp[-3].minor.yy528, 0); |
| 163760 | } | 165549 | } |
| 163761 | break; | 165550 | break; |
| 163762 | case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP */ | 165551 | case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 163763 | { | 165552 | { |
| 163764 | yylhsminor.yy626 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy562, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy64); | 165553 | yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy394); |
| 163765 | } | 165554 | } |
| 163766 | yymsp[-4].minor.yy626 = yylhsminor.yy626; | 165555 | yymsp[-4].minor.yy528 = yylhsminor.yy528; |
| 163767 | break; | 165556 | break; |
| 163768 | case 189: /* expr ::= ID|INDEXED LP STAR RP */ | 165557 | case 189: /* expr ::= ID|INDEXED LP STAR RP */ |
| 163769 | { | 165558 | { |
| 163770 | yylhsminor.yy626 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0); | 165559 | yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0); |
| 163771 | } | 165560 | } |
| 163772 | yymsp[-3].minor.yy626 = yylhsminor.yy626; | 165561 | yymsp[-3].minor.yy528 = yylhsminor.yy528; |
| 163773 | break; | 165562 | break; |
| 163774 | case 190: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ | 165563 | case 190: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ |
| 163775 | { | 165564 | { |
| 163776 | yylhsminor.yy626 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy562, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy64); | 165565 | yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy322, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy394); |
| 163777 | sqlite3WindowAttach(pParse, yylhsminor.yy626, yymsp[0].minor.yy375); | 165566 | sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41); |
| 163778 | } | 165567 | } |
| 163779 | yymsp[-5].minor.yy626 = yylhsminor.yy626; | 165568 | yymsp[-5].minor.yy528 = yylhsminor.yy528; |
| 163780 | break; | 165569 | break; |
| 163781 | case 191: /* expr ::= ID|INDEXED LP STAR RP filter_over */ | 165570 | case 191: /* expr ::= ID|INDEXED LP STAR RP filter_over */ |
| 163782 | { | 165571 | { |
| 163783 | yylhsminor.yy626 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0); | 165572 | yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0); |
| 163784 | sqlite3WindowAttach(pParse, yylhsminor.yy626, yymsp[0].minor.yy375); | 165573 | sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41); |
| 163785 | } | 165574 | } |
| 163786 | yymsp[-4].minor.yy626 = yylhsminor.yy626; | 165575 | yymsp[-4].minor.yy528 = yylhsminor.yy528; |
| 163787 | break; | 165576 | break; |
| 163788 | case 192: /* term ::= CTIME_KW */ | 165577 | case 192: /* term ::= CTIME_KW */ |
| 163789 | { | 165578 | { |
| 163790 | yylhsminor.yy626 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0); | 165579 | yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0); |
| 163791 | } | 165580 | } |
| 163792 | yymsp[0].minor.yy626 = yylhsminor.yy626; | 165581 | yymsp[0].minor.yy528 = yylhsminor.yy528; |
| 163793 | break; | 165582 | break; |
| 163794 | case 193: /* expr ::= LP nexprlist COMMA expr RP */ | 165583 | case 193: /* expr ::= LP nexprlist COMMA expr RP */ |
| 163795 | { | 165584 | { |
| 163796 | ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy562, yymsp[-1].minor.yy626); | 165585 | ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528); |
| 163797 | yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); | 165586 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); |
| 163798 | if( yymsp[-4].minor.yy626 ){ | 165587 | if( yymsp[-4].minor.yy528 ){ |
| 163799 | yymsp[-4].minor.yy626->x.pList = pList; | 165588 | yymsp[-4].minor.yy528->x.pList = pList; |
| 163800 | if( ALWAYS(pList->nExpr) ){ | 165589 | if( ALWAYS(pList->nExpr) ){ |
| 163801 | yymsp[-4].minor.yy626->flags |= pList->a[0].pExpr->flags & EP_Propagate; | 165590 | yymsp[-4].minor.yy528->flags |= pList->a[0].pExpr->flags & EP_Propagate; |
| 163802 | } | 165591 | } |
| 163803 | }else{ | 165592 | }else{ |
| 163804 | sqlite3ExprListDelete(pParse->db, pList); | 165593 | sqlite3ExprListDelete(pParse->db, pList); |
| @@ -163806,7 +165595,7 @@ static YYACTIONTYPE yy_reduce( | |||
| 163806 | } | 165595 | } |
| 163807 | break; | 165596 | break; |
| 163808 | case 194: /* expr ::= expr AND expr */ | 165597 | case 194: /* expr ::= expr AND expr */ |
| 163809 | {yymsp[-2].minor.yy626=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy626,yymsp[0].minor.yy626);} | 165598 | {yymsp[-2].minor.yy528=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);} |
| 163810 | break; | 165599 | break; |
| 163811 | case 195: /* expr ::= expr OR expr */ | 165600 | case 195: /* expr ::= expr OR expr */ |
| 163812 | case 196: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==196); | 165601 | case 196: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==196); |
| @@ -163815,7 +165604,7 @@ static YYACTIONTYPE yy_reduce( | |||
| 163815 | case 199: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==199); | 165604 | case 199: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==199); |
| 163816 | case 200: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==200); | 165605 | case 200: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==200); |
| 163817 | case 201: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==201); | 165606 | case 201: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==201); |
| 163818 | {yymsp[-2].minor.yy626=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy626,yymsp[0].minor.yy626);} | 165607 | {yymsp[-2].minor.yy528=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);} |
| 163819 | break; | 165608 | break; |
| 163820 | case 202: /* likeop ::= NOT LIKE_KW|MATCH */ | 165609 | case 202: /* likeop ::= NOT LIKE_KW|MATCH */ |
| 163821 | {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/} | 165610 | {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/} |
| @@ -163825,11 +165614,11 @@ static YYACTIONTYPE yy_reduce( | |||
| 163825 | ExprList *pList; | 165614 | ExprList *pList; |
| 163826 | int bNot = yymsp[-1].minor.yy0.n & 0x80000000; | 165615 | int bNot = yymsp[-1].minor.yy0.n & 0x80000000; |
| 163827 | yymsp[-1].minor.yy0.n &= 0x7fffffff; | 165616 | yymsp[-1].minor.yy0.n &= 0x7fffffff; |
| 163828 | pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy626); | 165617 | pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy528); |
| 163829 | pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy626); | 165618 | pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy528); |
| 163830 | yymsp[-2].minor.yy626 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); | 165619 | yymsp[-2].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); |
| 163831 | if( bNot ) yymsp[-2].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy626, 0); | 165620 | if( bNot ) yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy528, 0); |
| 163832 | if( yymsp[-2].minor.yy626 ) yymsp[-2].minor.yy626->flags |= EP_InfixFunc; | 165621 | if( yymsp[-2].minor.yy528 ) yymsp[-2].minor.yy528->flags |= EP_InfixFunc; |
| 163833 | } | 165622 | } |
| 163834 | break; | 165623 | break; |
| 163835 | case 204: /* expr ::= expr likeop expr ESCAPE expr */ | 165624 | case 204: /* expr ::= expr likeop expr ESCAPE expr */ |
| @@ -163837,62 +165626,70 @@ static YYACTIONTYPE yy_reduce( | |||
| 163837 | ExprList *pList; | 165626 | ExprList *pList; |
| 163838 | int bNot = yymsp[-3].minor.yy0.n & 0x80000000; | 165627 | int bNot = yymsp[-3].minor.yy0.n & 0x80000000; |
| 163839 | yymsp[-3].minor.yy0.n &= 0x7fffffff; | 165628 | yymsp[-3].minor.yy0.n &= 0x7fffffff; |
| 163840 | pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy626); | 165629 | pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); |
| 163841 | pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy626); | 165630 | pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy528); |
| 163842 | pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy626); | 165631 | pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528); |
| 163843 | yymsp[-4].minor.yy626 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0); | 165632 | yymsp[-4].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0); |
| 163844 | if( bNot ) yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy626, 0); | 165633 | if( bNot ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); |
| 163845 | if( yymsp[-4].minor.yy626 ) yymsp[-4].minor.yy626->flags |= EP_InfixFunc; | 165634 | if( yymsp[-4].minor.yy528 ) yymsp[-4].minor.yy528->flags |= EP_InfixFunc; |
| 163846 | } | 165635 | } |
| 163847 | break; | 165636 | break; |
| 163848 | case 205: /* expr ::= expr ISNULL|NOTNULL */ | 165637 | case 205: /* expr ::= expr ISNULL|NOTNULL */ |
| 163849 | {yymsp[-1].minor.yy626 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy626,0);} | 165638 | {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy528,0);} |
| 163850 | break; | 165639 | break; |
| 163851 | case 206: /* expr ::= expr NOT NULL */ | 165640 | case 206: /* expr ::= expr NOT NULL */ |
| 163852 | {yymsp[-2].minor.yy626 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy626,0);} | 165641 | {yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy528,0);} |
| 163853 | break; | 165642 | break; |
| 163854 | case 207: /* expr ::= expr IS expr */ | 165643 | case 207: /* expr ::= expr IS expr */ |
| 163855 | { | 165644 | { |
| 163856 | yymsp[-2].minor.yy626 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy626,yymsp[0].minor.yy626); | 165645 | yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy528,yymsp[0].minor.yy528); |
| 163857 | binaryToUnaryIfNull(pParse, yymsp[0].minor.yy626, yymsp[-2].minor.yy626, TK_ISNULL); | 165646 | binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-2].minor.yy528, TK_ISNULL); |
| 163858 | } | 165647 | } |
| 163859 | break; | 165648 | break; |
| 163860 | case 208: /* expr ::= expr IS NOT expr */ | 165649 | case 208: /* expr ::= expr IS NOT expr */ |
| 163861 | { | 165650 | { |
| 163862 | yymsp[-3].minor.yy626 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy626,yymsp[0].minor.yy626); | 165651 | yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528); |
| 163863 | binaryToUnaryIfNull(pParse, yymsp[0].minor.yy626, yymsp[-3].minor.yy626, TK_NOTNULL); | 165652 | binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL); |
| 163864 | } | 165653 | } |
| 163865 | break; | 165654 | break; |
| 163866 | case 209: /* expr ::= NOT expr */ | 165655 | case 209: /* expr ::= NOT expr */ |
| 163867 | case 210: /* expr ::= BITNOT expr */ yytestcase(yyruleno==210); | 165656 | case 210: /* expr ::= BITNOT expr */ yytestcase(yyruleno==210); |
| 163868 | {yymsp[-1].minor.yy626 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy626, 0);/*A-overwrites-B*/} | 165657 | {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/} |
| 163869 | break; | 165658 | break; |
| 163870 | case 211: /* expr ::= PLUS|MINUS expr */ | 165659 | case 211: /* expr ::= PLUS|MINUS expr */ |
| 163871 | { | 165660 | { |
| 163872 | yymsp[-1].minor.yy626 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy626, 0); | 165661 | yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0); |
| 163873 | /*A-overwrites-B*/ | 165662 | /*A-overwrites-B*/ |
| 163874 | } | 165663 | } |
| 163875 | break; | 165664 | break; |
| 163876 | case 212: /* between_op ::= BETWEEN */ | 165665 | case 212: /* expr ::= expr PTR expr */ |
| 163877 | case 215: /* in_op ::= IN */ yytestcase(yyruleno==215); | 165666 | { |
| 163878 | {yymsp[0].minor.yy64 = 0;} | 165667 | ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528); |
| 165668 | pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528); | ||
| 165669 | yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); | ||
| 165670 | } | ||
| 165671 | yymsp[-2].minor.yy528 = yylhsminor.yy528; | ||
| 165672 | break; | ||
| 165673 | case 213: /* between_op ::= BETWEEN */ | ||
| 165674 | case 216: /* in_op ::= IN */ yytestcase(yyruleno==216); | ||
| 165675 | {yymsp[0].minor.yy394 = 0;} | ||
| 163879 | break; | 165676 | break; |
| 163880 | case 214: /* expr ::= expr between_op expr AND expr */ | 165677 | case 215: /* expr ::= expr between_op expr AND expr */ |
| 163881 | { | 165678 | { |
| 163882 | ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy626); | 165679 | ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); |
| 163883 | pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy626); | 165680 | pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528); |
| 163884 | yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy626, 0); | 165681 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0); |
| 163885 | if( yymsp[-4].minor.yy626 ){ | 165682 | if( yymsp[-4].minor.yy528 ){ |
| 163886 | yymsp[-4].minor.yy626->x.pList = pList; | 165683 | yymsp[-4].minor.yy528->x.pList = pList; |
| 163887 | }else{ | 165684 | }else{ |
| 163888 | sqlite3ExprListDelete(pParse->db, pList); | 165685 | sqlite3ExprListDelete(pParse->db, pList); |
| 163889 | } | 165686 | } |
| 163890 | if( yymsp[-3].minor.yy64 ) yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy626, 0); | 165687 | if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); |
| 163891 | } | 165688 | } |
| 163892 | break; | 165689 | break; |
| 163893 | case 217: /* expr ::= expr in_op LP exprlist RP */ | 165690 | case 218: /* expr ::= expr in_op LP exprlist RP */ |
| 163894 | { | 165691 | { |
| 163895 | if( yymsp[-1].minor.yy562==0 ){ | 165692 | if( yymsp[-1].minor.yy322==0 ){ |
| 163896 | /* Expressions of the form | 165693 | /* Expressions of the form |
| 163897 | ** | 165694 | ** |
| 163898 | ** expr1 IN () | 165695 | ** expr1 IN () |
| @@ -163901,205 +165698,205 @@ static YYACTIONTYPE yy_reduce( | |||
| 163901 | ** simplify to constants 0 (false) and 1 (true), respectively, | 165698 | ** simplify to constants 0 (false) and 1 (true), respectively, |
| 163902 | ** regardless of the value of expr1. | 165699 | ** regardless of the value of expr1. |
| 163903 | */ | 165700 | */ |
| 163904 | sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy626); | 165701 | sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy528); |
| 163905 | yymsp[-4].minor.yy626 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy64 ? "1" : "0"); | 165702 | yymsp[-4].minor.yy528 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy394 ? "1" : "0"); |
| 163906 | }else{ | 165703 | }else{ |
| 163907 | Expr *pRHS = yymsp[-1].minor.yy562->a[0].pExpr; | 165704 | Expr *pRHS = yymsp[-1].minor.yy322->a[0].pExpr; |
| 163908 | if( yymsp[-1].minor.yy562->nExpr==1 && sqlite3ExprIsConstant(pRHS) && yymsp[-4].minor.yy626->op!=TK_VECTOR ){ | 165705 | if( yymsp[-1].minor.yy322->nExpr==1 && sqlite3ExprIsConstant(pRHS) && yymsp[-4].minor.yy528->op!=TK_VECTOR ){ |
| 163909 | yymsp[-1].minor.yy562->a[0].pExpr = 0; | 165706 | yymsp[-1].minor.yy322->a[0].pExpr = 0; |
| 163910 | sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy562); | 165707 | sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322); |
| 163911 | pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0); | 165708 | pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0); |
| 163912 | yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy626, pRHS); | 165709 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy528, pRHS); |
| 163913 | }else{ | 165710 | }else{ |
| 163914 | yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy626, 0); | 165711 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); |
| 163915 | if( yymsp[-4].minor.yy626==0 ){ | 165712 | if( yymsp[-4].minor.yy528==0 ){ |
| 163916 | sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy562); | 165713 | sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322); |
| 163917 | }else if( yymsp[-4].minor.yy626->pLeft->op==TK_VECTOR ){ | 165714 | }else if( yymsp[-4].minor.yy528->pLeft->op==TK_VECTOR ){ |
| 163918 | int nExpr = yymsp[-4].minor.yy626->pLeft->x.pList->nExpr; | 165715 | int nExpr = yymsp[-4].minor.yy528->pLeft->x.pList->nExpr; |
| 163919 | Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy562); | 165716 | Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy322); |
| 163920 | if( pSelectRHS ){ | 165717 | if( pSelectRHS ){ |
| 163921 | parserDoubleLinkSelect(pParse, pSelectRHS); | 165718 | parserDoubleLinkSelect(pParse, pSelectRHS); |
| 163922 | sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy626, pSelectRHS); | 165719 | sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelectRHS); |
| 163923 | } | 165720 | } |
| 163924 | }else{ | 165721 | }else{ |
| 163925 | yymsp[-4].minor.yy626->x.pList = yymsp[-1].minor.yy562; | 165722 | yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy322; |
| 163926 | sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy626); | 165723 | sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528); |
| 163927 | } | 165724 | } |
| 163928 | } | 165725 | } |
| 163929 | if( yymsp[-3].minor.yy64 ) yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy626, 0); | 165726 | if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); |
| 163930 | } | 165727 | } |
| 163931 | } | 165728 | } |
| 163932 | break; | 165729 | break; |
| 163933 | case 218: /* expr ::= LP select RP */ | 165730 | case 219: /* expr ::= LP select RP */ |
| 163934 | { | 165731 | { |
| 163935 | yymsp[-2].minor.yy626 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); | 165732 | yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); |
| 163936 | sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy626, yymsp[-1].minor.yy303); | 165733 | sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47); |
| 163937 | } | 165734 | } |
| 163938 | break; | 165735 | break; |
| 163939 | case 219: /* expr ::= expr in_op LP select RP */ | 165736 | case 220: /* expr ::= expr in_op LP select RP */ |
| 163940 | { | 165737 | { |
| 163941 | yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy626, 0); | 165738 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); |
| 163942 | sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy626, yymsp[-1].minor.yy303); | 165739 | sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47); |
| 163943 | if( yymsp[-3].minor.yy64 ) yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy626, 0); | 165740 | if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); |
| 163944 | } | 165741 | } |
| 163945 | break; | 165742 | break; |
| 163946 | case 220: /* expr ::= expr in_op nm dbnm paren_exprlist */ | 165743 | case 221: /* expr ::= expr in_op nm dbnm paren_exprlist */ |
| 163947 | { | 165744 | { |
| 163948 | SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); | 165745 | SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); |
| 163949 | Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0); | 165746 | Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0); |
| 163950 | if( yymsp[0].minor.yy562 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy562); | 165747 | if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322); |
| 163951 | yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy626, 0); | 165748 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); |
| 163952 | sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy626, pSelect); | 165749 | sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect); |
| 163953 | if( yymsp[-3].minor.yy64 ) yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy626, 0); | 165750 | if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); |
| 163954 | } | 165751 | } |
| 163955 | break; | 165752 | break; |
| 163956 | case 221: /* expr ::= EXISTS LP select RP */ | 165753 | case 222: /* expr ::= EXISTS LP select RP */ |
| 163957 | { | 165754 | { |
| 163958 | Expr *p; | 165755 | Expr *p; |
| 163959 | p = yymsp[-3].minor.yy626 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); | 165756 | p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); |
| 163960 | sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy303); | 165757 | sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47); |
| 163961 | } | 165758 | } |
| 163962 | break; | 165759 | break; |
| 163963 | case 222: /* expr ::= CASE case_operand case_exprlist case_else END */ | 165760 | case 223: /* expr ::= CASE case_operand case_exprlist case_else END */ |
| 163964 | { | 165761 | { |
| 163965 | yymsp[-4].minor.yy626 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy626, 0); | 165762 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0); |
| 163966 | if( yymsp[-4].minor.yy626 ){ | 165763 | if( yymsp[-4].minor.yy528 ){ |
| 163967 | yymsp[-4].minor.yy626->x.pList = yymsp[-1].minor.yy626 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy562,yymsp[-1].minor.yy626) : yymsp[-2].minor.yy562; | 165764 | yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322; |
| 163968 | sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy626); | 165765 | sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528); |
| 163969 | }else{ | 165766 | }else{ |
| 163970 | sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy562); | 165767 | sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322); |
| 163971 | sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy626); | 165768 | sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528); |
| 163972 | } | 165769 | } |
| 163973 | } | 165770 | } |
| 163974 | break; | 165771 | break; |
| 163975 | case 223: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ | 165772 | case 224: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 163976 | { | 165773 | { |
| 163977 | yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy562, yymsp[-2].minor.yy626); | 165774 | yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528); |
| 163978 | yymsp[-4].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy562, yymsp[0].minor.yy626); | 165775 | yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528); |
| 163979 | } | 165776 | } |
| 163980 | break; | 165777 | break; |
| 163981 | case 224: /* case_exprlist ::= WHEN expr THEN expr */ | 165778 | case 225: /* case_exprlist ::= WHEN expr THEN expr */ |
| 163982 | { | 165779 | { |
| 163983 | yymsp[-3].minor.yy562 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy626); | 165780 | yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); |
| 163984 | yymsp[-3].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy562, yymsp[0].minor.yy626); | 165781 | yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528); |
| 163985 | } | 165782 | } |
| 163986 | break; | 165783 | break; |
| 163987 | case 227: /* case_operand ::= expr */ | 165784 | case 228: /* case_operand ::= expr */ |
| 163988 | {yymsp[0].minor.yy626 = yymsp[0].minor.yy626; /*A-overwrites-X*/} | 165785 | {yymsp[0].minor.yy528 = yymsp[0].minor.yy528; /*A-overwrites-X*/} |
| 163989 | break; | 165786 | break; |
| 163990 | case 230: /* nexprlist ::= nexprlist COMMA expr */ | 165787 | case 231: /* nexprlist ::= nexprlist COMMA expr */ |
| 163991 | {yymsp[-2].minor.yy562 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy562,yymsp[0].minor.yy626);} | 165788 | {yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);} |
| 163992 | break; | 165789 | break; |
| 163993 | case 231: /* nexprlist ::= expr */ | 165790 | case 232: /* nexprlist ::= expr */ |
| 163994 | {yymsp[0].minor.yy562 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy626); /*A-overwrites-Y*/} | 165791 | {yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/} |
| 163995 | break; | 165792 | break; |
| 163996 | case 233: /* paren_exprlist ::= LP exprlist RP */ | 165793 | case 234: /* paren_exprlist ::= LP exprlist RP */ |
| 163997 | case 238: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==238); | 165794 | case 239: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==239); |
| 163998 | {yymsp[-2].minor.yy562 = yymsp[-1].minor.yy562;} | 165795 | {yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;} |
| 163999 | break; | 165796 | break; |
| 164000 | case 234: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ | 165797 | case 235: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 164001 | { | 165798 | { |
| 164002 | sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, | 165799 | sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, |
| 164003 | sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy562, yymsp[-10].minor.yy64, | 165800 | sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394, |
| 164004 | &yymsp[-11].minor.yy0, yymsp[0].minor.yy626, SQLITE_SO_ASC, yymsp[-8].minor.yy64, SQLITE_IDXTYPE_APPDEF); | 165801 | &yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF); |
| 164005 | if( IN_RENAME_OBJECT && pParse->pNewIndex ){ | 165802 | if( IN_RENAME_OBJECT && pParse->pNewIndex ){ |
| 164006 | sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0); | 165803 | sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0); |
| 164007 | } | 165804 | } |
| 164008 | } | 165805 | } |
| 164009 | break; | 165806 | break; |
| 164010 | case 235: /* uniqueflag ::= UNIQUE */ | 165807 | case 236: /* uniqueflag ::= UNIQUE */ |
| 164011 | case 277: /* raisetype ::= ABORT */ yytestcase(yyruleno==277); | 165808 | case 278: /* raisetype ::= ABORT */ yytestcase(yyruleno==278); |
| 164012 | {yymsp[0].minor.yy64 = OE_Abort;} | 165809 | {yymsp[0].minor.yy394 = OE_Abort;} |
| 164013 | break; | 165810 | break; |
| 164014 | case 236: /* uniqueflag ::= */ | 165811 | case 237: /* uniqueflag ::= */ |
| 164015 | {yymsp[1].minor.yy64 = OE_None;} | 165812 | {yymsp[1].minor.yy394 = OE_None;} |
| 164016 | break; | 165813 | break; |
| 164017 | case 239: /* eidlist ::= eidlist COMMA nm collate sortorder */ | 165814 | case 240: /* eidlist ::= eidlist COMMA nm collate sortorder */ |
| 164018 | { | 165815 | { |
| 164019 | yymsp[-4].minor.yy562 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy562, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy64, yymsp[0].minor.yy64); | 165816 | yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); |
| 164020 | } | 165817 | } |
| 164021 | break; | 165818 | break; |
| 164022 | case 240: /* eidlist ::= nm collate sortorder */ | 165819 | case 241: /* eidlist ::= nm collate sortorder */ |
| 164023 | { | 165820 | { |
| 164024 | yymsp[-2].minor.yy562 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy64, yymsp[0].minor.yy64); /*A-overwrites-Y*/ | 165821 | yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/ |
| 164025 | } | 165822 | } |
| 164026 | break; | 165823 | break; |
| 164027 | case 243: /* cmd ::= DROP INDEX ifexists fullname */ | 165824 | case 244: /* cmd ::= DROP INDEX ifexists fullname */ |
| 164028 | {sqlite3DropIndex(pParse, yymsp[0].minor.yy607, yymsp[-1].minor.yy64);} | 165825 | {sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);} |
| 164029 | break; | 165826 | break; |
| 164030 | case 244: /* cmd ::= VACUUM vinto */ | 165827 | case 245: /* cmd ::= VACUUM vinto */ |
| 164031 | {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy626);} | 165828 | {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);} |
| 164032 | break; | 165829 | break; |
| 164033 | case 245: /* cmd ::= VACUUM nm vinto */ | 165830 | case 246: /* cmd ::= VACUUM nm vinto */ |
| 164034 | {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy626);} | 165831 | {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);} |
| 164035 | break; | 165832 | break; |
| 164036 | case 248: /* cmd ::= PRAGMA nm dbnm */ | 165833 | case 249: /* cmd ::= PRAGMA nm dbnm */ |
| 164037 | {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} | 165834 | {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} |
| 164038 | break; | 165835 | break; |
| 164039 | case 249: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ | 165836 | case 250: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 164040 | {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} | 165837 | {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} |
| 164041 | break; | 165838 | break; |
| 164042 | case 250: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ | 165839 | case 251: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 164043 | {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} | 165840 | {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} |
| 164044 | break; | 165841 | break; |
| 164045 | case 251: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ | 165842 | case 252: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 164046 | {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} | 165843 | {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} |
| 164047 | break; | 165844 | break; |
| 164048 | case 252: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ | 165845 | case 253: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 164049 | {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);} | 165846 | {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);} |
| 164050 | break; | 165847 | break; |
| 164051 | case 255: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ | 165848 | case 256: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 164052 | { | 165849 | { |
| 164053 | Token all; | 165850 | Token all; |
| 164054 | all.z = yymsp[-3].minor.yy0.z; | 165851 | all.z = yymsp[-3].minor.yy0.z; |
| 164055 | all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n; | 165852 | all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n; |
| 164056 | sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy95, &all); | 165853 | sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all); |
| 164057 | } | 165854 | } |
| 164058 | break; | 165855 | break; |
| 164059 | case 256: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ | 165856 | case 257: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 164060 | { | 165857 | { |
| 164061 | sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy64, yymsp[-4].minor.yy570.a, yymsp[-4].minor.yy570.b, yymsp[-2].minor.yy607, yymsp[0].minor.yy626, yymsp[-10].minor.yy64, yymsp[-8].minor.yy64); | 165858 | sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy394, yymsp[-4].minor.yy180.a, yymsp[-4].minor.yy180.b, yymsp[-2].minor.yy131, yymsp[0].minor.yy528, yymsp[-10].minor.yy394, yymsp[-8].minor.yy394); |
| 164062 | yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ | 165859 | yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ |
| 164063 | } | 165860 | } |
| 164064 | break; | 165861 | break; |
| 164065 | case 257: /* trigger_time ::= BEFORE|AFTER */ | 165862 | case 258: /* trigger_time ::= BEFORE|AFTER */ |
| 164066 | { yymsp[0].minor.yy64 = yymsp[0].major; /*A-overwrites-X*/ } | 165863 | { yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ } |
| 164067 | break; | 165864 | break; |
| 164068 | case 258: /* trigger_time ::= INSTEAD OF */ | 165865 | case 259: /* trigger_time ::= INSTEAD OF */ |
| 164069 | { yymsp[-1].minor.yy64 = TK_INSTEAD;} | 165866 | { yymsp[-1].minor.yy394 = TK_INSTEAD;} |
| 164070 | break; | 165867 | break; |
| 164071 | case 259: /* trigger_time ::= */ | 165868 | case 260: /* trigger_time ::= */ |
| 164072 | { yymsp[1].minor.yy64 = TK_BEFORE; } | 165869 | { yymsp[1].minor.yy394 = TK_BEFORE; } |
| 164073 | break; | 165870 | break; |
| 164074 | case 260: /* trigger_event ::= DELETE|INSERT */ | 165871 | case 261: /* trigger_event ::= DELETE|INSERT */ |
| 164075 | case 261: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==261); | 165872 | case 262: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==262); |
| 164076 | {yymsp[0].minor.yy570.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy570.b = 0;} | 165873 | {yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;} |
| 164077 | break; | 165874 | break; |
| 164078 | case 262: /* trigger_event ::= UPDATE OF idlist */ | 165875 | case 263: /* trigger_event ::= UPDATE OF idlist */ |
| 164079 | {yymsp[-2].minor.yy570.a = TK_UPDATE; yymsp[-2].minor.yy570.b = yymsp[0].minor.yy240;} | 165876 | {yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;} |
| 164080 | break; | 165877 | break; |
| 164081 | case 263: /* when_clause ::= */ | 165878 | case 264: /* when_clause ::= */ |
| 164082 | case 282: /* key_opt ::= */ yytestcase(yyruleno==282); | 165879 | case 283: /* key_opt ::= */ yytestcase(yyruleno==283); |
| 164083 | { yymsp[1].minor.yy626 = 0; } | 165880 | { yymsp[1].minor.yy528 = 0; } |
| 164084 | break; | 165881 | break; |
| 164085 | case 264: /* when_clause ::= WHEN expr */ | 165882 | case 265: /* when_clause ::= WHEN expr */ |
| 164086 | case 283: /* key_opt ::= KEY expr */ yytestcase(yyruleno==283); | 165883 | case 284: /* key_opt ::= KEY expr */ yytestcase(yyruleno==284); |
| 164087 | { yymsp[-1].minor.yy626 = yymsp[0].minor.yy626; } | 165884 | { yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; } |
| 164088 | break; | 165885 | break; |
| 164089 | case 265: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ | 165886 | case 266: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 164090 | { | 165887 | { |
| 164091 | assert( yymsp[-2].minor.yy95!=0 ); | 165888 | assert( yymsp[-2].minor.yy33!=0 ); |
| 164092 | yymsp[-2].minor.yy95->pLast->pNext = yymsp[-1].minor.yy95; | 165889 | yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33; |
| 164093 | yymsp[-2].minor.yy95->pLast = yymsp[-1].minor.yy95; | 165890 | yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33; |
| 164094 | } | 165891 | } |
| 164095 | break; | 165892 | break; |
| 164096 | case 266: /* trigger_cmd_list ::= trigger_cmd SEMI */ | 165893 | case 267: /* trigger_cmd_list ::= trigger_cmd SEMI */ |
| 164097 | { | 165894 | { |
| 164098 | assert( yymsp[-1].minor.yy95!=0 ); | 165895 | assert( yymsp[-1].minor.yy33!=0 ); |
| 164099 | yymsp[-1].minor.yy95->pLast = yymsp[-1].minor.yy95; | 165896 | yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33; |
| 164100 | } | 165897 | } |
| 164101 | break; | 165898 | break; |
| 164102 | case 267: /* trnm ::= nm DOT nm */ | 165899 | case 268: /* trnm ::= nm DOT nm */ |
| 164103 | { | 165900 | { |
| 164104 | yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; | 165901 | yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; |
| 164105 | sqlite3ErrorMsg(pParse, | 165902 | sqlite3ErrorMsg(pParse, |
| @@ -164107,369 +165904,369 @@ static YYACTIONTYPE yy_reduce( | |||
| 164107 | "statements within triggers"); | 165904 | "statements within triggers"); |
| 164108 | } | 165905 | } |
| 164109 | break; | 165906 | break; |
| 164110 | case 268: /* tridxby ::= INDEXED BY nm */ | 165907 | case 269: /* tridxby ::= INDEXED BY nm */ |
| 164111 | { | 165908 | { |
| 164112 | sqlite3ErrorMsg(pParse, | 165909 | sqlite3ErrorMsg(pParse, |
| 164113 | "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " | 165910 | "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " |
| 164114 | "within triggers"); | 165911 | "within triggers"); |
| 164115 | } | 165912 | } |
| 164116 | break; | 165913 | break; |
| 164117 | case 269: /* tridxby ::= NOT INDEXED */ | 165914 | case 270: /* tridxby ::= NOT INDEXED */ |
| 164118 | { | 165915 | { |
| 164119 | sqlite3ErrorMsg(pParse, | 165916 | sqlite3ErrorMsg(pParse, |
| 164120 | "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " | 165917 | "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " |
| 164121 | "within triggers"); | 165918 | "within triggers"); |
| 164122 | } | 165919 | } |
| 164123 | break; | 165920 | break; |
| 164124 | case 270: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ | 165921 | case 271: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ |
| 164125 | {yylhsminor.yy95 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy607, yymsp[-3].minor.yy562, yymsp[-1].minor.yy626, yymsp[-7].minor.yy64, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy600);} | 165922 | {yylhsminor.yy33 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy131, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528, yymsp[-7].minor.yy394, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy522);} |
| 164126 | yymsp[-8].minor.yy95 = yylhsminor.yy95; | 165923 | yymsp[-8].minor.yy33 = yylhsminor.yy33; |
| 164127 | break; | 165924 | break; |
| 164128 | case 271: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ | 165925 | case 272: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 164129 | { | 165926 | { |
| 164130 | yylhsminor.yy95 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy240,yymsp[-2].minor.yy303,yymsp[-6].minor.yy64,yymsp[-1].minor.yy138,yymsp[-7].minor.yy600,yymsp[0].minor.yy600);/*yylhsminor.yy95-overwrites-yymsp[-6].minor.yy64*/ | 165927 | yylhsminor.yy33 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy254,yymsp[-2].minor.yy47,yymsp[-6].minor.yy394,yymsp[-1].minor.yy444,yymsp[-7].minor.yy522,yymsp[0].minor.yy522);/*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/ |
| 164131 | } | 165928 | } |
| 164132 | yymsp[-7].minor.yy95 = yylhsminor.yy95; | 165929 | yymsp[-7].minor.yy33 = yylhsminor.yy33; |
| 164133 | break; | 165930 | break; |
| 164134 | case 272: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ | 165931 | case 273: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 164135 | {yylhsminor.yy95 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy626, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy600);} | 165932 | {yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);} |
| 164136 | yymsp[-5].minor.yy95 = yylhsminor.yy95; | 165933 | yymsp[-5].minor.yy33 = yylhsminor.yy33; |
| 164137 | break; | 165934 | break; |
| 164138 | case 273: /* trigger_cmd ::= scanpt select scanpt */ | 165935 | case 274: /* trigger_cmd ::= scanpt select scanpt */ |
| 164139 | {yylhsminor.yy95 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy303, yymsp[-2].minor.yy600, yymsp[0].minor.yy600); /*yylhsminor.yy95-overwrites-yymsp[-1].minor.yy303*/} | 165936 | {yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/} |
| 164140 | yymsp[-2].minor.yy95 = yylhsminor.yy95; | 165937 | yymsp[-2].minor.yy33 = yylhsminor.yy33; |
| 164141 | break; | 165938 | break; |
| 164142 | case 274: /* expr ::= RAISE LP IGNORE RP */ | 165939 | case 275: /* expr ::= RAISE LP IGNORE RP */ |
| 164143 | { | 165940 | { |
| 164144 | yymsp[-3].minor.yy626 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); | 165941 | yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); |
| 164145 | if( yymsp[-3].minor.yy626 ){ | 165942 | if( yymsp[-3].minor.yy528 ){ |
| 164146 | yymsp[-3].minor.yy626->affExpr = OE_Ignore; | 165943 | yymsp[-3].minor.yy528->affExpr = OE_Ignore; |
| 164147 | } | 165944 | } |
| 164148 | } | 165945 | } |
| 164149 | break; | 165946 | break; |
| 164150 | case 275: /* expr ::= RAISE LP raisetype COMMA nm RP */ | 165947 | case 276: /* expr ::= RAISE LP raisetype COMMA nm RP */ |
| 164151 | { | 165948 | { |
| 164152 | yymsp[-5].minor.yy626 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); | 165949 | yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); |
| 164153 | if( yymsp[-5].minor.yy626 ) { | 165950 | if( yymsp[-5].minor.yy528 ) { |
| 164154 | yymsp[-5].minor.yy626->affExpr = (char)yymsp[-3].minor.yy64; | 165951 | yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394; |
| 164155 | } | 165952 | } |
| 164156 | } | 165953 | } |
| 164157 | break; | 165954 | break; |
| 164158 | case 276: /* raisetype ::= ROLLBACK */ | 165955 | case 277: /* raisetype ::= ROLLBACK */ |
| 164159 | {yymsp[0].minor.yy64 = OE_Rollback;} | 165956 | {yymsp[0].minor.yy394 = OE_Rollback;} |
| 164160 | break; | 165957 | break; |
| 164161 | case 278: /* raisetype ::= FAIL */ | 165958 | case 279: /* raisetype ::= FAIL */ |
| 164162 | {yymsp[0].minor.yy64 = OE_Fail;} | 165959 | {yymsp[0].minor.yy394 = OE_Fail;} |
| 164163 | break; | 165960 | break; |
| 164164 | case 279: /* cmd ::= DROP TRIGGER ifexists fullname */ | 165961 | case 280: /* cmd ::= DROP TRIGGER ifexists fullname */ |
| 164165 | { | 165962 | { |
| 164166 | sqlite3DropTrigger(pParse,yymsp[0].minor.yy607,yymsp[-1].minor.yy64); | 165963 | sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394); |
| 164167 | } | 165964 | } |
| 164168 | break; | 165965 | break; |
| 164169 | case 280: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ | 165966 | case 281: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 164170 | { | 165967 | { |
| 164171 | sqlite3Attach(pParse, yymsp[-3].minor.yy626, yymsp[-1].minor.yy626, yymsp[0].minor.yy626); | 165968 | sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528); |
| 164172 | } | 165969 | } |
| 164173 | break; | 165970 | break; |
| 164174 | case 281: /* cmd ::= DETACH database_kw_opt expr */ | 165971 | case 282: /* cmd ::= DETACH database_kw_opt expr */ |
| 164175 | { | 165972 | { |
| 164176 | sqlite3Detach(pParse, yymsp[0].minor.yy626); | 165973 | sqlite3Detach(pParse, yymsp[0].minor.yy528); |
| 164177 | } | 165974 | } |
| 164178 | break; | 165975 | break; |
| 164179 | case 284: /* cmd ::= REINDEX */ | 165976 | case 285: /* cmd ::= REINDEX */ |
| 164180 | {sqlite3Reindex(pParse, 0, 0);} | 165977 | {sqlite3Reindex(pParse, 0, 0);} |
| 164181 | break; | 165978 | break; |
| 164182 | case 285: /* cmd ::= REINDEX nm dbnm */ | 165979 | case 286: /* cmd ::= REINDEX nm dbnm */ |
| 164183 | {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} | 165980 | {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 164184 | break; | 165981 | break; |
| 164185 | case 286: /* cmd ::= ANALYZE */ | 165982 | case 287: /* cmd ::= ANALYZE */ |
| 164186 | {sqlite3Analyze(pParse, 0, 0);} | 165983 | {sqlite3Analyze(pParse, 0, 0);} |
| 164187 | break; | 165984 | break; |
| 164188 | case 287: /* cmd ::= ANALYZE nm dbnm */ | 165985 | case 288: /* cmd ::= ANALYZE nm dbnm */ |
| 164189 | {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} | 165986 | {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 164190 | break; | 165987 | break; |
| 164191 | case 288: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ | 165988 | case 289: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 164192 | { | 165989 | { |
| 164193 | sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy607,&yymsp[0].minor.yy0); | 165990 | sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0); |
| 164194 | } | 165991 | } |
| 164195 | break; | 165992 | break; |
| 164196 | case 289: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ | 165993 | case 290: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 164197 | { | 165994 | { |
| 164198 | yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; | 165995 | yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; |
| 164199 | sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); | 165996 | sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); |
| 164200 | } | 165997 | } |
| 164201 | break; | 165998 | break; |
| 164202 | case 290: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ | 165999 | case 291: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ |
| 164203 | { | 166000 | { |
| 164204 | sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy607, &yymsp[0].minor.yy0); | 166001 | sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0); |
| 164205 | } | 166002 | } |
| 164206 | break; | 166003 | break; |
| 164207 | case 291: /* add_column_fullname ::= fullname */ | 166004 | case 292: /* add_column_fullname ::= fullname */ |
| 164208 | { | 166005 | { |
| 164209 | disableLookaside(pParse); | 166006 | disableLookaside(pParse); |
| 164210 | sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy607); | 166007 | sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131); |
| 164211 | } | 166008 | } |
| 164212 | break; | 166009 | break; |
| 164213 | case 292: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ | 166010 | case 293: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 164214 | { | 166011 | { |
| 164215 | sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy607, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); | 166012 | sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); |
| 164216 | } | 166013 | } |
| 164217 | break; | 166014 | break; |
| 164218 | case 293: /* cmd ::= create_vtab */ | 166015 | case 294: /* cmd ::= create_vtab */ |
| 164219 | {sqlite3VtabFinishParse(pParse,0);} | 166016 | {sqlite3VtabFinishParse(pParse,0);} |
| 164220 | break; | 166017 | break; |
| 164221 | case 294: /* cmd ::= create_vtab LP vtabarglist RP */ | 166018 | case 295: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 164222 | {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} | 166019 | {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} |
| 164223 | break; | 166020 | break; |
| 164224 | case 295: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ | 166021 | case 296: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 164225 | { | 166022 | { |
| 164226 | sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy64); | 166023 | sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394); |
| 164227 | } | 166024 | } |
| 164228 | break; | 166025 | break; |
| 164229 | case 296: /* vtabarg ::= */ | 166026 | case 297: /* vtabarg ::= */ |
| 164230 | {sqlite3VtabArgInit(pParse);} | 166027 | {sqlite3VtabArgInit(pParse);} |
| 164231 | break; | 166028 | break; |
| 164232 | case 297: /* vtabargtoken ::= ANY */ | 166029 | case 298: /* vtabargtoken ::= ANY */ |
| 164233 | case 298: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==298); | 166030 | case 299: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==299); |
| 164234 | case 299: /* lp ::= LP */ yytestcase(yyruleno==299); | 166031 | case 300: /* lp ::= LP */ yytestcase(yyruleno==300); |
| 164235 | {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} | 166032 | {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} |
| 164236 | break; | 166033 | break; |
| 164237 | case 300: /* with ::= WITH wqlist */ | 166034 | case 301: /* with ::= WITH wqlist */ |
| 164238 | case 301: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==301); | 166035 | case 302: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==302); |
| 164239 | { sqlite3WithPush(pParse, yymsp[0].minor.yy43, 1); } | 166036 | { sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); } |
| 164240 | break; | 166037 | break; |
| 164241 | case 302: /* wqas ::= AS */ | 166038 | case 303: /* wqas ::= AS */ |
| 164242 | {yymsp[0].minor.yy534 = M10d_Any;} | 166039 | {yymsp[0].minor.yy516 = M10d_Any;} |
| 164243 | break; | 166040 | break; |
| 164244 | case 303: /* wqas ::= AS MATERIALIZED */ | 166041 | case 304: /* wqas ::= AS MATERIALIZED */ |
| 164245 | {yymsp[-1].minor.yy534 = M10d_Yes;} | 166042 | {yymsp[-1].minor.yy516 = M10d_Yes;} |
| 164246 | break; | 166043 | break; |
| 164247 | case 304: /* wqas ::= AS NOT MATERIALIZED */ | 166044 | case 305: /* wqas ::= AS NOT MATERIALIZED */ |
| 164248 | {yymsp[-2].minor.yy534 = M10d_No;} | 166045 | {yymsp[-2].minor.yy516 = M10d_No;} |
| 164249 | break; | 166046 | break; |
| 164250 | case 305: /* wqitem ::= nm eidlist_opt wqas LP select RP */ | 166047 | case 306: /* wqitem ::= nm eidlist_opt wqas LP select RP */ |
| 164251 | { | 166048 | { |
| 164252 | yymsp[-5].minor.yy255 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy562, yymsp[-1].minor.yy303, yymsp[-3].minor.yy534); /*A-overwrites-X*/ | 166049 | yymsp[-5].minor.yy385 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy47, yymsp[-3].minor.yy516); /*A-overwrites-X*/ |
| 164253 | } | 166050 | } |
| 164254 | break; | 166051 | break; |
| 164255 | case 306: /* wqlist ::= wqitem */ | 166052 | case 307: /* wqlist ::= wqitem */ |
| 164256 | { | 166053 | { |
| 164257 | yymsp[0].minor.yy43 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy255); /*A-overwrites-X*/ | 166054 | yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/ |
| 164258 | } | 166055 | } |
| 164259 | break; | 166056 | break; |
| 164260 | case 307: /* wqlist ::= wqlist COMMA wqitem */ | 166057 | case 308: /* wqlist ::= wqlist COMMA wqitem */ |
| 164261 | { | 166058 | { |
| 164262 | yymsp[-2].minor.yy43 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy43, yymsp[0].minor.yy255); | 166059 | yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385); |
| 164263 | } | 166060 | } |
| 164264 | break; | 166061 | break; |
| 164265 | case 308: /* windowdefn_list ::= windowdefn */ | 166062 | case 309: /* windowdefn_list ::= windowdefn */ |
| 164266 | { yylhsminor.yy375 = yymsp[0].minor.yy375; } | 166063 | { yylhsminor.yy41 = yymsp[0].minor.yy41; } |
| 164267 | yymsp[0].minor.yy375 = yylhsminor.yy375; | 166064 | yymsp[0].minor.yy41 = yylhsminor.yy41; |
| 164268 | break; | 166065 | break; |
| 164269 | case 309: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ | 166066 | case 310: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 164270 | { | 166067 | { |
| 164271 | assert( yymsp[0].minor.yy375!=0 ); | 166068 | assert( yymsp[0].minor.yy41!=0 ); |
| 164272 | sqlite3WindowChain(pParse, yymsp[0].minor.yy375, yymsp[-2].minor.yy375); | 166069 | sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41); |
| 164273 | yymsp[0].minor.yy375->pNextWin = yymsp[-2].minor.yy375; | 166070 | yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41; |
| 164274 | yylhsminor.yy375 = yymsp[0].minor.yy375; | 166071 | yylhsminor.yy41 = yymsp[0].minor.yy41; |
| 164275 | } | 166072 | } |
| 164276 | yymsp[-2].minor.yy375 = yylhsminor.yy375; | 166073 | yymsp[-2].minor.yy41 = yylhsminor.yy41; |
| 164277 | break; | 166074 | break; |
| 164278 | case 310: /* windowdefn ::= nm AS LP window RP */ | 166075 | case 311: /* windowdefn ::= nm AS LP window RP */ |
| 164279 | { | 166076 | { |
| 164280 | if( ALWAYS(yymsp[-1].minor.yy375) ){ | 166077 | if( ALWAYS(yymsp[-1].minor.yy41) ){ |
| 164281 | yymsp[-1].minor.yy375->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n); | 166078 | yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n); |
| 164282 | } | 166079 | } |
| 164283 | yylhsminor.yy375 = yymsp[-1].minor.yy375; | 166080 | yylhsminor.yy41 = yymsp[-1].minor.yy41; |
| 164284 | } | 166081 | } |
| 164285 | yymsp[-4].minor.yy375 = yylhsminor.yy375; | 166082 | yymsp[-4].minor.yy41 = yylhsminor.yy41; |
| 164286 | break; | 166083 | break; |
| 164287 | case 311: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ | 166084 | case 312: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 164288 | { | 166085 | { |
| 164289 | yymsp[-4].minor.yy375 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy375, yymsp[-2].minor.yy562, yymsp[-1].minor.yy562, 0); | 166086 | yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0); |
| 164290 | } | 166087 | } |
| 164291 | break; | 166088 | break; |
| 164292 | case 312: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ | 166089 | case 313: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 164293 | { | 166090 | { |
| 164294 | yylhsminor.yy375 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy375, yymsp[-2].minor.yy562, yymsp[-1].minor.yy562, &yymsp[-5].minor.yy0); | 166091 | yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0); |
| 164295 | } | 166092 | } |
| 164296 | yymsp[-5].minor.yy375 = yylhsminor.yy375; | 166093 | yymsp[-5].minor.yy41 = yylhsminor.yy41; |
| 164297 | break; | 166094 | break; |
| 164298 | case 313: /* window ::= ORDER BY sortlist frame_opt */ | 166095 | case 314: /* window ::= ORDER BY sortlist frame_opt */ |
| 164299 | { | 166096 | { |
| 164300 | yymsp[-3].minor.yy375 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy375, 0, yymsp[-1].minor.yy562, 0); | 166097 | yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0); |
| 164301 | } | 166098 | } |
| 164302 | break; | 166099 | break; |
| 164303 | case 314: /* window ::= nm ORDER BY sortlist frame_opt */ | 166100 | case 315: /* window ::= nm ORDER BY sortlist frame_opt */ |
| 164304 | { | 166101 | { |
| 164305 | yylhsminor.yy375 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy375, 0, yymsp[-1].minor.yy562, &yymsp[-4].minor.yy0); | 166102 | yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0); |
| 164306 | } | 166103 | } |
| 164307 | yymsp[-4].minor.yy375 = yylhsminor.yy375; | 166104 | yymsp[-4].minor.yy41 = yylhsminor.yy41; |
| 164308 | break; | 166105 | break; |
| 164309 | case 315: /* window ::= frame_opt */ | 166106 | case 316: /* window ::= frame_opt */ |
| 164310 | case 334: /* filter_over ::= over_clause */ yytestcase(yyruleno==334); | 166107 | case 335: /* filter_over ::= over_clause */ yytestcase(yyruleno==335); |
| 164311 | { | 166108 | { |
| 164312 | yylhsminor.yy375 = yymsp[0].minor.yy375; | 166109 | yylhsminor.yy41 = yymsp[0].minor.yy41; |
| 164313 | } | 166110 | } |
| 164314 | yymsp[0].minor.yy375 = yylhsminor.yy375; | 166111 | yymsp[0].minor.yy41 = yylhsminor.yy41; |
| 164315 | break; | 166112 | break; |
| 164316 | case 316: /* window ::= nm frame_opt */ | 166113 | case 317: /* window ::= nm frame_opt */ |
| 164317 | { | 166114 | { |
| 164318 | yylhsminor.yy375 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy375, 0, 0, &yymsp[-1].minor.yy0); | 166115 | yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0); |
| 164319 | } | 166116 | } |
| 164320 | yymsp[-1].minor.yy375 = yylhsminor.yy375; | 166117 | yymsp[-1].minor.yy41 = yylhsminor.yy41; |
| 164321 | break; | 166118 | break; |
| 164322 | case 317: /* frame_opt ::= */ | 166119 | case 318: /* frame_opt ::= */ |
| 164323 | { | 166120 | { |
| 164324 | yymsp[1].minor.yy375 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0); | 166121 | yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0); |
| 164325 | } | 166122 | } |
| 164326 | break; | 166123 | break; |
| 164327 | case 318: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ | 166124 | case 319: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 164328 | { | 166125 | { |
| 164329 | yylhsminor.yy375 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy64, yymsp[-1].minor.yy81.eType, yymsp[-1].minor.yy81.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy534); | 166126 | yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy394, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy516); |
| 164330 | } | 166127 | } |
| 164331 | yymsp[-2].minor.yy375 = yylhsminor.yy375; | 166128 | yymsp[-2].minor.yy41 = yylhsminor.yy41; |
| 164332 | break; | 166129 | break; |
| 164333 | case 319: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ | 166130 | case 320: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 164334 | { | 166131 | { |
| 164335 | yylhsminor.yy375 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy64, yymsp[-3].minor.yy81.eType, yymsp[-3].minor.yy81.pExpr, yymsp[-1].minor.yy81.eType, yymsp[-1].minor.yy81.pExpr, yymsp[0].minor.yy534); | 166132 | yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy394, yymsp[-3].minor.yy595.eType, yymsp[-3].minor.yy595.pExpr, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, yymsp[0].minor.yy516); |
| 164336 | } | 166133 | } |
| 164337 | yymsp[-5].minor.yy375 = yylhsminor.yy375; | 166134 | yymsp[-5].minor.yy41 = yylhsminor.yy41; |
| 164338 | break; | 166135 | break; |
| 164339 | case 321: /* frame_bound_s ::= frame_bound */ | 166136 | case 322: /* frame_bound_s ::= frame_bound */ |
| 164340 | case 323: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==323); | 166137 | case 324: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==324); |
| 164341 | {yylhsminor.yy81 = yymsp[0].minor.yy81;} | 166138 | {yylhsminor.yy595 = yymsp[0].minor.yy595;} |
| 164342 | yymsp[0].minor.yy81 = yylhsminor.yy81; | 166139 | yymsp[0].minor.yy595 = yylhsminor.yy595; |
| 164343 | break; | 166140 | break; |
| 164344 | case 322: /* frame_bound_s ::= UNBOUNDED PRECEDING */ | 166141 | case 323: /* frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 164345 | case 324: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==324); | 166142 | case 325: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==325); |
| 164346 | case 326: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==326); | 166143 | case 327: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==327); |
| 164347 | {yylhsminor.yy81.eType = yymsp[-1].major; yylhsminor.yy81.pExpr = 0;} | 166144 | {yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;} |
| 164348 | yymsp[-1].minor.yy81 = yylhsminor.yy81; | 166145 | yymsp[-1].minor.yy595 = yylhsminor.yy595; |
| 164349 | break; | 166146 | break; |
| 164350 | case 325: /* frame_bound ::= expr PRECEDING|FOLLOWING */ | 166147 | case 326: /* frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 164351 | {yylhsminor.yy81.eType = yymsp[0].major; yylhsminor.yy81.pExpr = yymsp[-1].minor.yy626;} | 166148 | {yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;} |
| 164352 | yymsp[-1].minor.yy81 = yylhsminor.yy81; | 166149 | yymsp[-1].minor.yy595 = yylhsminor.yy595; |
| 164353 | break; | 166150 | break; |
| 164354 | case 327: /* frame_exclude_opt ::= */ | 166151 | case 328: /* frame_exclude_opt ::= */ |
| 164355 | {yymsp[1].minor.yy534 = 0;} | 166152 | {yymsp[1].minor.yy516 = 0;} |
| 164356 | break; | 166153 | break; |
| 164357 | case 328: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ | 166154 | case 329: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 164358 | {yymsp[-1].minor.yy534 = yymsp[0].minor.yy534;} | 166155 | {yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;} |
| 164359 | break; | 166156 | break; |
| 164360 | case 329: /* frame_exclude ::= NO OTHERS */ | 166157 | case 330: /* frame_exclude ::= NO OTHERS */ |
| 164361 | case 330: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==330); | 166158 | case 331: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==331); |
| 164362 | {yymsp[-1].minor.yy534 = yymsp[-1].major; /*A-overwrites-X*/} | 166159 | {yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/} |
| 164363 | break; | 166160 | break; |
| 164364 | case 331: /* frame_exclude ::= GROUP|TIES */ | 166161 | case 332: /* frame_exclude ::= GROUP|TIES */ |
| 164365 | {yymsp[0].minor.yy534 = yymsp[0].major; /*A-overwrites-X*/} | 166162 | {yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/} |
| 164366 | break; | 166163 | break; |
| 164367 | case 332: /* window_clause ::= WINDOW windowdefn_list */ | 166164 | case 333: /* window_clause ::= WINDOW windowdefn_list */ |
| 164368 | { yymsp[-1].minor.yy375 = yymsp[0].minor.yy375; } | 166165 | { yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; } |
| 164369 | break; | 166166 | break; |
| 164370 | case 333: /* filter_over ::= filter_clause over_clause */ | 166167 | case 334: /* filter_over ::= filter_clause over_clause */ |
| 164371 | { | 166168 | { |
| 164372 | if( yymsp[0].minor.yy375 ){ | 166169 | if( yymsp[0].minor.yy41 ){ |
| 164373 | yymsp[0].minor.yy375->pFilter = yymsp[-1].minor.yy626; | 166170 | yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528; |
| 164374 | }else{ | 166171 | }else{ |
| 164375 | sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy626); | 166172 | sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528); |
| 164376 | } | 166173 | } |
| 164377 | yylhsminor.yy375 = yymsp[0].minor.yy375; | 166174 | yylhsminor.yy41 = yymsp[0].minor.yy41; |
| 164378 | } | 166175 | } |
| 164379 | yymsp[-1].minor.yy375 = yylhsminor.yy375; | 166176 | yymsp[-1].minor.yy41 = yylhsminor.yy41; |
| 164380 | break; | 166177 | break; |
| 164381 | case 335: /* filter_over ::= filter_clause */ | 166178 | case 336: /* filter_over ::= filter_clause */ |
| 164382 | { | 166179 | { |
| 164383 | yylhsminor.yy375 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); | 166180 | yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); |
| 164384 | if( yylhsminor.yy375 ){ | 166181 | if( yylhsminor.yy41 ){ |
| 164385 | yylhsminor.yy375->eFrmType = TK_FILTER; | 166182 | yylhsminor.yy41->eFrmType = TK_FILTER; |
| 164386 | yylhsminor.yy375->pFilter = yymsp[0].minor.yy626; | 166183 | yylhsminor.yy41->pFilter = yymsp[0].minor.yy528; |
| 164387 | }else{ | 166184 | }else{ |
| 164388 | sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy626); | 166185 | sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528); |
| 164389 | } | 166186 | } |
| 164390 | } | 166187 | } |
| 164391 | yymsp[0].minor.yy375 = yylhsminor.yy375; | 166188 | yymsp[0].minor.yy41 = yylhsminor.yy41; |
| 164392 | break; | 166189 | break; |
| 164393 | case 336: /* over_clause ::= OVER LP window RP */ | 166190 | case 337: /* over_clause ::= OVER LP window RP */ |
| 164394 | { | 166191 | { |
| 164395 | yymsp[-3].minor.yy375 = yymsp[-1].minor.yy375; | 166192 | yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41; |
| 164396 | assert( yymsp[-3].minor.yy375!=0 ); | 166193 | assert( yymsp[-3].minor.yy41!=0 ); |
| 164397 | } | 166194 | } |
| 164398 | break; | 166195 | break; |
| 164399 | case 337: /* over_clause ::= OVER nm */ | 166196 | case 338: /* over_clause ::= OVER nm */ |
| 164400 | { | 166197 | { |
| 164401 | yymsp[-1].minor.yy375 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); | 166198 | yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); |
| 164402 | if( yymsp[-1].minor.yy375 ){ | 166199 | if( yymsp[-1].minor.yy41 ){ |
| 164403 | yymsp[-1].minor.yy375->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); | 166200 | yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); |
| 164404 | } | 166201 | } |
| 164405 | } | 166202 | } |
| 164406 | break; | 166203 | break; |
| 164407 | case 338: /* filter_clause ::= FILTER LP WHERE expr RP */ | 166204 | case 339: /* filter_clause ::= FILTER LP WHERE expr RP */ |
| 164408 | { yymsp[-4].minor.yy626 = yymsp[-1].minor.yy626; } | 166205 | { yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; } |
| 164409 | break; | 166206 | break; |
| 164410 | default: | 166207 | default: |
| 164411 | /* (339) input ::= cmdlist */ yytestcase(yyruleno==339); | 166208 | /* (340) input ::= cmdlist */ yytestcase(yyruleno==340); |
| 164412 | /* (340) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==340); | 166209 | /* (341) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==341); |
| 164413 | /* (341) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=341); | 166210 | /* (342) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=342); |
| 164414 | /* (342) ecmd ::= SEMI */ yytestcase(yyruleno==342); | 166211 | /* (343) ecmd ::= SEMI */ yytestcase(yyruleno==343); |
| 164415 | /* (343) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==343); | 166212 | /* (344) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==344); |
| 164416 | /* (344) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=344); | 166213 | /* (345) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=345); |
| 164417 | /* (345) trans_opt ::= */ yytestcase(yyruleno==345); | 166214 | /* (346) trans_opt ::= */ yytestcase(yyruleno==346); |
| 164418 | /* (346) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==346); | 166215 | /* (347) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==347); |
| 164419 | /* (347) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==347); | 166216 | /* (348) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==348); |
| 164420 | /* (348) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==348); | 166217 | /* (349) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==349); |
| 164421 | /* (349) savepoint_opt ::= */ yytestcase(yyruleno==349); | 166218 | /* (350) savepoint_opt ::= */ yytestcase(yyruleno==350); |
| 164422 | /* (350) cmd ::= create_table create_table_args */ yytestcase(yyruleno==350); | 166219 | /* (351) cmd ::= create_table create_table_args */ yytestcase(yyruleno==351); |
| 164423 | /* (351) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=351); | 166220 | /* (352) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=352); |
| 164424 | /* (352) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==352); | 166221 | /* (353) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==353); |
| 164425 | /* (353) columnlist ::= columnname carglist */ yytestcase(yyruleno==353); | 166222 | /* (354) columnlist ::= columnname carglist */ yytestcase(yyruleno==354); |
| 164426 | /* (354) nm ::= ID|INDEXED */ yytestcase(yyruleno==354); | 166223 | /* (355) nm ::= ID|INDEXED */ yytestcase(yyruleno==355); |
| 164427 | /* (355) nm ::= STRING */ yytestcase(yyruleno==355); | 166224 | /* (356) nm ::= STRING */ yytestcase(yyruleno==356); |
| 164428 | /* (356) nm ::= JOIN_KW */ yytestcase(yyruleno==356); | 166225 | /* (357) nm ::= JOIN_KW */ yytestcase(yyruleno==357); |
| 164429 | /* (357) typetoken ::= typename */ yytestcase(yyruleno==357); | 166226 | /* (358) typetoken ::= typename */ yytestcase(yyruleno==358); |
| 164430 | /* (358) typename ::= ID|STRING */ yytestcase(yyruleno==358); | 166227 | /* (359) typename ::= ID|STRING */ yytestcase(yyruleno==359); |
| 164431 | /* (359) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=359); | 166228 | /* (360) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=360); |
| 164432 | /* (360) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=360); | 166229 | /* (361) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=361); |
| 164433 | /* (361) carglist ::= carglist ccons */ yytestcase(yyruleno==361); | 166230 | /* (362) carglist ::= carglist ccons */ yytestcase(yyruleno==362); |
| 164434 | /* (362) carglist ::= */ yytestcase(yyruleno==362); | 166231 | /* (363) carglist ::= */ yytestcase(yyruleno==363); |
| 164435 | /* (363) ccons ::= NULL onconf */ yytestcase(yyruleno==363); | 166232 | /* (364) ccons ::= NULL onconf */ yytestcase(yyruleno==364); |
| 164436 | /* (364) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==364); | 166233 | /* (365) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==365); |
| 164437 | /* (365) ccons ::= AS generated */ yytestcase(yyruleno==365); | 166234 | /* (366) ccons ::= AS generated */ yytestcase(yyruleno==366); |
| 164438 | /* (366) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==366); | 166235 | /* (367) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==367); |
| 164439 | /* (367) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==367); | 166236 | /* (368) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==368); |
| 164440 | /* (368) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=368); | 166237 | /* (369) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=369); |
| 164441 | /* (369) tconscomma ::= */ yytestcase(yyruleno==369); | 166238 | /* (370) tconscomma ::= */ yytestcase(yyruleno==370); |
| 164442 | /* (370) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=370); | 166239 | /* (371) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=371); |
| 164443 | /* (371) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=371); | 166240 | /* (372) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=372); |
| 164444 | /* (372) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=372); | 166241 | /* (373) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=373); |
| 164445 | /* (373) oneselect ::= values */ yytestcase(yyruleno==373); | 166242 | /* (374) oneselect ::= values */ yytestcase(yyruleno==374); |
| 164446 | /* (374) sclp ::= selcollist COMMA */ yytestcase(yyruleno==374); | 166243 | /* (375) sclp ::= selcollist COMMA */ yytestcase(yyruleno==375); |
| 164447 | /* (375) as ::= ID|STRING */ yytestcase(yyruleno==375); | 166244 | /* (376) as ::= ID|STRING */ yytestcase(yyruleno==376); |
| 164448 | /* (376) returning ::= */ yytestcase(yyruleno==376); | 166245 | /* (377) returning ::= */ yytestcase(yyruleno==377); |
| 164449 | /* (377) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=377); | 166246 | /* (378) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=378); |
| 164450 | /* (378) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==378); | 166247 | /* (379) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==379); |
| 164451 | /* (379) exprlist ::= nexprlist */ yytestcase(yyruleno==379); | 166248 | /* (380) exprlist ::= nexprlist */ yytestcase(yyruleno==380); |
| 164452 | /* (380) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=380); | 166249 | /* (381) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=381); |
| 164453 | /* (381) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=381); | 166250 | /* (382) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=382); |
| 164454 | /* (382) nmnum ::= ON */ yytestcase(yyruleno==382); | 166251 | /* (383) nmnum ::= ON */ yytestcase(yyruleno==383); |
| 164455 | /* (383) nmnum ::= DELETE */ yytestcase(yyruleno==383); | 166252 | /* (384) nmnum ::= DELETE */ yytestcase(yyruleno==384); |
| 164456 | /* (384) nmnum ::= DEFAULT */ yytestcase(yyruleno==384); | 166253 | /* (385) nmnum ::= DEFAULT */ yytestcase(yyruleno==385); |
| 164457 | /* (385) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==385); | 166254 | /* (386) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==386); |
| 164458 | /* (386) foreach_clause ::= */ yytestcase(yyruleno==386); | 166255 | /* (387) foreach_clause ::= */ yytestcase(yyruleno==387); |
| 164459 | /* (387) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==387); | 166256 | /* (388) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==388); |
| 164460 | /* (388) trnm ::= nm */ yytestcase(yyruleno==388); | 166257 | /* (389) trnm ::= nm */ yytestcase(yyruleno==389); |
| 164461 | /* (389) tridxby ::= */ yytestcase(yyruleno==389); | 166258 | /* (390) tridxby ::= */ yytestcase(yyruleno==390); |
| 164462 | /* (390) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==390); | 166259 | /* (391) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==391); |
| 164463 | /* (391) database_kw_opt ::= */ yytestcase(yyruleno==391); | 166260 | /* (392) database_kw_opt ::= */ yytestcase(yyruleno==392); |
| 164464 | /* (392) kwcolumn_opt ::= */ yytestcase(yyruleno==392); | 166261 | /* (393) kwcolumn_opt ::= */ yytestcase(yyruleno==393); |
| 164465 | /* (393) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==393); | 166262 | /* (394) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==394); |
| 164466 | /* (394) vtabarglist ::= vtabarg */ yytestcase(yyruleno==394); | 166263 | /* (395) vtabarglist ::= vtabarg */ yytestcase(yyruleno==395); |
| 164467 | /* (395) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==395); | 166264 | /* (396) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==396); |
| 164468 | /* (396) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==396); | 166265 | /* (397) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==397); |
| 164469 | /* (397) anylist ::= */ yytestcase(yyruleno==397); | 166266 | /* (398) anylist ::= */ yytestcase(yyruleno==398); |
| 164470 | /* (398) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==398); | 166267 | /* (399) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==399); |
| 164471 | /* (399) anylist ::= anylist ANY */ yytestcase(yyruleno==399); | 166268 | /* (400) anylist ::= anylist ANY */ yytestcase(yyruleno==400); |
| 164472 | /* (400) with ::= */ yytestcase(yyruleno==400); | 166269 | /* (401) with ::= */ yytestcase(yyruleno==401); |
| 164473 | break; | 166270 | break; |
| 164474 | /********** End reduce actions ************************************************/ | 166271 | /********** End reduce actions ************************************************/ |
| 164475 | }; | 166272 | }; |
| @@ -165592,6 +167389,9 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){ | |||
| 165592 | for(i=2; (c=z[i])!=0 && c!='\n'; i++){} | 167389 | for(i=2; (c=z[i])!=0 && c!='\n'; i++){} |
| 165593 | *tokenType = TK_SPACE; /* IMP: R-22934-25134 */ | 167390 | *tokenType = TK_SPACE; /* IMP: R-22934-25134 */ |
| 165594 | return i; | 167391 | return i; |
| 167392 | }else if( z[1]=='>' ){ | ||
| 167393 | *tokenType = TK_PTR; | ||
| 167394 | return 2 + (z[2]=='>'); | ||
| 165595 | } | 167395 | } |
| 165596 | *tokenType = TK_MINUS; | 167396 | *tokenType = TK_MINUS; |
| 165597 | return 1; | 167397 | return 1; |
| @@ -165861,13 +167661,9 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){ | |||
| 165861 | } | 167661 | } |
| 165862 | 167662 | ||
| 165863 | /* | 167663 | /* |
| 165864 | ** Run the parser on the given SQL string. The parser structure is | 167664 | ** Run the parser on the given SQL string. |
| 165865 | ** passed in. An SQLITE_ status code is returned. If an error occurs | ||
| 165866 | ** then an and attempt is made to write an error message into | ||
| 165867 | ** memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that | ||
| 165868 | ** error message. | ||
| 165869 | */ | 167665 | */ |
| 165870 | SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ | 167666 | SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql){ |
| 165871 | int nErr = 0; /* Number of errors encountered */ | 167667 | int nErr = 0; /* Number of errors encountered */ |
| 165872 | void *pEngine; /* The LEMON-generated LALR(1) parser */ | 167668 | void *pEngine; /* The LEMON-generated LALR(1) parser */ |
| 165873 | int n = 0; /* Length of the next token token */ | 167669 | int n = 0; /* Length of the next token token */ |
| @@ -165888,7 +167684,6 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzEr | |||
| 165888 | } | 167684 | } |
| 165889 | pParse->rc = SQLITE_OK; | 167685 | pParse->rc = SQLITE_OK; |
| 165890 | pParse->zTail = zSql; | 167686 | pParse->zTail = zSql; |
| 165891 | assert( pzErrMsg!=0 ); | ||
| 165892 | #ifdef SQLITE_DEBUG | 167687 | #ifdef SQLITE_DEBUG |
| 165893 | if( db->flags & SQLITE_ParserTrace ){ | 167688 | if( db->flags & SQLITE_ParserTrace ){ |
| 165894 | printf("parser: [[[%s]]]\n", zSql); | 167689 | printf("parser: [[[%s]]]\n", zSql); |
| @@ -165931,6 +167726,7 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzEr | |||
| 165931 | #endif /* SQLITE_OMIT_WINDOWFUNC */ | 167726 | #endif /* SQLITE_OMIT_WINDOWFUNC */ |
| 165932 | if( AtomicLoad(&db->u1.isInterrupted) ){ | 167727 | if( AtomicLoad(&db->u1.isInterrupted) ){ |
| 165933 | pParse->rc = SQLITE_INTERRUPT; | 167728 | pParse->rc = SQLITE_INTERRUPT; |
| 167729 | pParse->nErr++; | ||
| 165934 | break; | 167730 | break; |
| 165935 | } | 167731 | } |
| 165936 | if( tokenType==TK_SPACE ){ | 167732 | if( tokenType==TK_SPACE ){ |
| @@ -165960,7 +167756,10 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzEr | |||
| 165960 | tokenType = analyzeFilterKeyword((const u8*)&zSql[6], lastTokenParsed); | 167756 | tokenType = analyzeFilterKeyword((const u8*)&zSql[6], lastTokenParsed); |
| 165961 | #endif /* SQLITE_OMIT_WINDOWFUNC */ | 167757 | #endif /* SQLITE_OMIT_WINDOWFUNC */ |
| 165962 | }else{ | 167758 | }else{ |
| 165963 | sqlite3ErrorMsg(pParse, "unrecognized token: \"%.*s\"", n, zSql); | 167759 | Token x; |
| 167760 | x.z = zSql; | ||
| 167761 | x.n = n; | ||
| 167762 | sqlite3ErrorMsg(pParse, "unrecognized token: \"%T\"", &x); | ||
| 165964 | break; | 167763 | break; |
| 165965 | } | 167764 | } |
| 165966 | } | 167765 | } |
| @@ -165988,41 +167787,26 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzEr | |||
| 165988 | if( db->mallocFailed ){ | 167787 | if( db->mallocFailed ){ |
| 165989 | pParse->rc = SQLITE_NOMEM_BKPT; | 167788 | pParse->rc = SQLITE_NOMEM_BKPT; |
| 165990 | } | 167789 | } |
| 165991 | if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){ | 167790 | if( pParse->zErrMsg || (pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE) ){ |
| 165992 | pParse->zErrMsg = sqlite3MPrintf(db, "%s", sqlite3ErrStr(pParse->rc)); | 167791 | if( pParse->zErrMsg==0 ){ |
| 165993 | } | 167792 | pParse->zErrMsg = sqlite3MPrintf(db, "%s", sqlite3ErrStr(pParse->rc)); |
| 165994 | assert( pzErrMsg!=0 ); | 167793 | } |
| 165995 | if( pParse->zErrMsg ){ | 167794 | sqlite3_log(pParse->rc, "%s in \"%s\"", pParse->zErrMsg, pParse->zTail); |
| 165996 | *pzErrMsg = pParse->zErrMsg; | ||
| 165997 | sqlite3_log(pParse->rc, "%s in \"%s\"", | ||
| 165998 | *pzErrMsg, pParse->zTail); | ||
| 165999 | pParse->zErrMsg = 0; | ||
| 166000 | nErr++; | 167795 | nErr++; |
| 166001 | } | 167796 | } |
| 166002 | pParse->zTail = zSql; | 167797 | pParse->zTail = zSql; |
| 166003 | if( pParse->pVdbe && pParse->nErr>0 && pParse->nested==0 ){ | ||
| 166004 | sqlite3VdbeDelete(pParse->pVdbe); | ||
| 166005 | pParse->pVdbe = 0; | ||
| 166006 | } | ||
| 166007 | #ifndef SQLITE_OMIT_SHARED_CACHE | ||
| 166008 | if( pParse->nested==0 ){ | ||
| 166009 | sqlite3DbFree(db, pParse->aTableLock); | ||
| 166010 | pParse->aTableLock = 0; | ||
| 166011 | pParse->nTableLock = 0; | ||
| 166012 | } | ||
| 166013 | #endif | ||
| 166014 | #ifndef SQLITE_OMIT_VIRTUALTABLE | 167798 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 166015 | sqlite3_free(pParse->apVtabLock); | 167799 | sqlite3_free(pParse->apVtabLock); |
| 166016 | #endif | 167800 | #endif |
| 166017 | 167801 | ||
| 166018 | if( !IN_SPECIAL_PARSE ){ | 167802 | if( pParse->pNewTable && !IN_SPECIAL_PARSE ){ |
| 166019 | /* If the pParse->declareVtab flag is set, do not delete any table | 167803 | /* If the pParse->declareVtab flag is set, do not delete any table |
| 166020 | ** structure built up in pParse->pNewTable. The calling code (see vtab.c) | 167804 | ** structure built up in pParse->pNewTable. The calling code (see vtab.c) |
| 166021 | ** will take responsibility for freeing the Table structure. | 167805 | ** will take responsibility for freeing the Table structure. |
| 166022 | */ | 167806 | */ |
| 166023 | sqlite3DeleteTable(db, pParse->pNewTable); | 167807 | sqlite3DeleteTable(db, pParse->pNewTable); |
| 166024 | } | 167808 | } |
| 166025 | if( !IN_RENAME_OBJECT ){ | 167809 | if( pParse->pNewTrigger && !IN_RENAME_OBJECT ){ |
| 166026 | sqlite3DeleteTrigger(db, pParse->pNewTrigger); | 167810 | sqlite3DeleteTrigger(db, pParse->pNewTrigger); |
| 166027 | } | 167811 | } |
| 166028 | sqlite3DbFree(db, pParse->pVList); | 167812 | sqlite3DbFree(db, pParse->pVList); |
| @@ -166607,9 +168391,6 @@ SQLITE_PRIVATE int sqlite3Fts2Init(sqlite3*); | |||
| 166607 | #ifdef SQLITE_ENABLE_FTS5 | 168391 | #ifdef SQLITE_ENABLE_FTS5 |
| 166608 | SQLITE_PRIVATE int sqlite3Fts5Init(sqlite3*); | 168392 | SQLITE_PRIVATE int sqlite3Fts5Init(sqlite3*); |
| 166609 | #endif | 168393 | #endif |
| 166610 | #ifdef SQLITE_ENABLE_JSON1 | ||
| 166611 | SQLITE_PRIVATE int sqlite3Json1Init(sqlite3*); | ||
| 166612 | #endif | ||
| 166613 | #ifdef SQLITE_ENABLE_STMTVTAB | 168394 | #ifdef SQLITE_ENABLE_STMTVTAB |
| 166614 | SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3*); | 168395 | SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3*); |
| 166615 | #endif | 168396 | #endif |
| @@ -166644,8 +168425,8 @@ static int (*const sqlite3BuiltinExtensions[])(sqlite3*) = { | |||
| 166644 | sqlite3DbstatRegister, | 168425 | sqlite3DbstatRegister, |
| 166645 | #endif | 168426 | #endif |
| 166646 | sqlite3TestExtInit, | 168427 | sqlite3TestExtInit, |
| 166647 | #ifdef SQLITE_ENABLE_JSON1 | 168428 | #if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON) |
| 166648 | sqlite3Json1Init, | 168429 | sqlite3JsonTableFunctions, |
| 166649 | #endif | 168430 | #endif |
| 166650 | #ifdef SQLITE_ENABLE_STMTVTAB | 168431 | #ifdef SQLITE_ENABLE_STMTVTAB |
| 166651 | sqlite3StmtVtabInit, | 168432 | sqlite3StmtVtabInit, |
| @@ -169154,6 +170935,19 @@ SQLITE_API const char *sqlite3_errmsg(sqlite3 *db){ | |||
| 169154 | return z; | 170935 | return z; |
| 169155 | } | 170936 | } |
| 169156 | 170937 | ||
| 170938 | /* | ||
| 170939 | ** Return the byte offset of the most recent error | ||
| 170940 | */ | ||
| 170941 | SQLITE_API int sqlite3_error_offset(sqlite3 *db){ | ||
| 170942 | int iOffset = -1; | ||
| 170943 | if( db && sqlite3SafetyCheckSickOrOk(db) && db->errCode ){ | ||
| 170944 | sqlite3_mutex_enter(db->mutex); | ||
| 170945 | iOffset = db->errByteOffset; | ||
| 170946 | sqlite3_mutex_leave(db->mutex); | ||
| 170947 | } | ||
| 170948 | return iOffset; | ||
| 170949 | } | ||
| 170950 | |||
| 169157 | #ifndef SQLITE_OMIT_UTF16 | 170951 | #ifndef SQLITE_OMIT_UTF16 |
| 169158 | /* | 170952 | /* |
| 169159 | ** Return UTF-16 encoded English language explanation of the most recent | 170953 | ** Return UTF-16 encoded English language explanation of the most recent |
| @@ -170576,12 +172370,16 @@ SQLITE_API int sqlite3_test_control(int op, ...){ | |||
| 170576 | ** sqlite3_test_control(). | 172370 | ** sqlite3_test_control(). |
| 170577 | */ | 172371 | */ |
| 170578 | case SQLITE_TESTCTRL_FAULT_INSTALL: { | 172372 | case SQLITE_TESTCTRL_FAULT_INSTALL: { |
| 170579 | /* MSVC is picky about pulling func ptrs from va lists. | 172373 | /* A bug in MSVC prevents it from understanding pointers to functions |
| 170580 | ** http://support.microsoft.com/kb/47961 | 172374 | ** types in the second argument to va_arg(). Work around the problem |
| 172375 | ** using a typedef. | ||
| 172376 | ** http://support.microsoft.com/kb/47961 <-- dead hyperlink | ||
| 172377 | ** Search at http://web.archive.org/ to find the 2015-03-16 archive | ||
| 172378 | ** of the link above to see the original text. | ||
| 170581 | ** sqlite3GlobalConfig.xTestCallback = va_arg(ap, int(*)(int)); | 172379 | ** sqlite3GlobalConfig.xTestCallback = va_arg(ap, int(*)(int)); |
| 170582 | */ | 172380 | */ |
| 170583 | typedef int(*TESTCALLBACKFUNC_t)(int); | 172381 | typedef int(*sqlite3FaultFuncType)(int); |
| 170584 | sqlite3GlobalConfig.xTestCallback = va_arg(ap, TESTCALLBACKFUNC_t); | 172382 | sqlite3GlobalConfig.xTestCallback = va_arg(ap, sqlite3FaultFuncType); |
| 170585 | rc = sqlite3FaultSim(0); | 172383 | rc = sqlite3FaultSim(0); |
| 170586 | break; | 172384 | break; |
| 170587 | } | 172385 | } |
| @@ -170708,13 +172506,27 @@ SQLITE_API int sqlite3_test_control(int op, ...){ | |||
| 170708 | break; | 172506 | break; |
| 170709 | } | 172507 | } |
| 170710 | 172508 | ||
| 170711 | /* sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff); | 172509 | /* sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, onoff, xAlt); |
| 172510 | ** | ||
| 172511 | ** If parameter onoff is 1, subsequent calls to localtime() fail. | ||
| 172512 | ** If 2, then invoke xAlt() instead of localtime(). If 0, normal | ||
| 172513 | ** processing. | ||
| 172514 | ** | ||
| 172515 | ** xAlt arguments are void pointers, but they really want to be: | ||
| 170712 | ** | 172516 | ** |
| 170713 | ** If parameter onoff is non-zero, subsequent calls to localtime() | 172517 | ** int xAlt(const time_t*, struct tm*); |
| 170714 | ** and its variants fail. If onoff is zero, undo this setting. | 172518 | ** |
| 172519 | ** xAlt should write results in to struct tm object of its 2nd argument | ||
| 172520 | ** and return zero on success, or return non-zero on failure. | ||
| 170715 | */ | 172521 | */ |
| 170716 | case SQLITE_TESTCTRL_LOCALTIME_FAULT: { | 172522 | case SQLITE_TESTCTRL_LOCALTIME_FAULT: { |
| 170717 | sqlite3GlobalConfig.bLocaltimeFault = va_arg(ap, int); | 172523 | sqlite3GlobalConfig.bLocaltimeFault = va_arg(ap, int); |
| 172524 | if( sqlite3GlobalConfig.bLocaltimeFault==2 ){ | ||
| 172525 | typedef int(*sqlite3LocaltimeType)(const void*,void*); | ||
| 172526 | sqlite3GlobalConfig.xAltLocaltime = va_arg(ap, sqlite3LocaltimeType); | ||
| 172527 | }else{ | ||
| 172528 | sqlite3GlobalConfig.xAltLocaltime = 0; | ||
| 172529 | } | ||
| 170718 | break; | 172530 | break; |
| 170719 | } | 172531 | } |
| 170720 | 172532 | ||
| @@ -170904,6 +172716,26 @@ SQLITE_API int sqlite3_test_control(int op, ...){ | |||
| 170904 | break; | 172716 | break; |
| 170905 | } | 172717 | } |
| 170906 | 172718 | ||
| 172719 | /* sqlite3_test_control(SQLITE_TESTCTRL_LOGEST, | ||
| 172720 | ** double fIn, // Input value | ||
| 172721 | ** int *pLogEst, // sqlite3LogEstFromDouble(fIn) | ||
| 172722 | ** u64 *pInt, // sqlite3LogEstToInt(*pLogEst) | ||
| 172723 | ** int *pLogEst2 // sqlite3LogEst(*pInt) | ||
| 172724 | ** ); | ||
| 172725 | ** | ||
| 172726 | ** Test access for the LogEst conversion routines. | ||
| 172727 | */ | ||
| 172728 | case SQLITE_TESTCTRL_LOGEST: { | ||
| 172729 | double rIn = va_arg(ap, double); | ||
| 172730 | LogEst rLogEst = sqlite3LogEstFromDouble(rIn); | ||
| 172731 | u64 iInt = sqlite3LogEstToInt(rLogEst); | ||
| 172732 | va_arg(ap, int*)[0] = rLogEst; | ||
| 172733 | va_arg(ap, u64*)[0] = iInt; | ||
| 172734 | va_arg(ap, int*)[0] = sqlite3LogEst(iInt); | ||
| 172735 | break; | ||
| 172736 | } | ||
| 172737 | |||
| 172738 | |||
| 170907 | #if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_WSD) | 172739 | #if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_WSD) |
| 170908 | /* sqlite3_test_control(SQLITE_TESTCTRL_TUNE, id, *piValue) | 172740 | /* sqlite3_test_control(SQLITE_TESTCTRL_TUNE, id, *piValue) |
| 170909 | ** | 172741 | ** |
| @@ -172884,7 +174716,7 @@ SQLITE_PRIVATE int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *) | |||
| 172884 | SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr); | 174716 | SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr); |
| 172885 | 174717 | ||
| 172886 | /* fts3_tokenize_vtab.c */ | 174718 | /* fts3_tokenize_vtab.c */ |
| 172887 | SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *); | 174719 | SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *, void(*xDestroy)(void*)); |
| 172888 | 174720 | ||
| 172889 | /* fts3_unicode2.c (functions generated by parsing unicode text files) */ | 174721 | /* fts3_unicode2.c (functions generated by parsing unicode text files) */ |
| 172890 | #ifndef SQLITE_DISABLE_FTS3_UNICODE | 174722 | #ifndef SQLITE_DISABLE_FTS3_UNICODE |
| @@ -172917,6 +174749,12 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeIsdiacritic(int); | |||
| 172917 | SQLITE_EXTENSION_INIT1 | 174749 | SQLITE_EXTENSION_INIT1 |
| 172918 | #endif | 174750 | #endif |
| 172919 | 174751 | ||
| 174752 | typedef struct Fts3HashWrapper Fts3HashWrapper; | ||
| 174753 | struct Fts3HashWrapper { | ||
| 174754 | Fts3Hash hash; /* Hash table */ | ||
| 174755 | int nRef; /* Number of pointers to this object */ | ||
| 174756 | }; | ||
| 174757 | |||
| 172920 | static int fts3EvalNext(Fts3Cursor *pCsr); | 174758 | static int fts3EvalNext(Fts3Cursor *pCsr); |
| 172921 | static int fts3EvalStart(Fts3Cursor *pCsr); | 174759 | static int fts3EvalStart(Fts3Cursor *pCsr); |
| 172922 | static int fts3TermSegReaderCursor( | 174760 | static int fts3TermSegReaderCursor( |
| @@ -173781,7 +175619,7 @@ static int fts3InitVtab( | |||
| 173781 | sqlite3_vtab **ppVTab, /* Write the resulting vtab structure here */ | 175619 | sqlite3_vtab **ppVTab, /* Write the resulting vtab structure here */ |
| 173782 | char **pzErr /* Write any error message here */ | 175620 | char **pzErr /* Write any error message here */ |
| 173783 | ){ | 175621 | ){ |
| 173784 | Fts3Hash *pHash = (Fts3Hash *)pAux; | 175622 | Fts3Hash *pHash = &((Fts3HashWrapper*)pAux)->hash; |
| 173785 | Fts3Table *p = 0; /* Pointer to allocated vtab */ | 175623 | Fts3Table *p = 0; /* Pointer to allocated vtab */ |
| 173786 | int rc = SQLITE_OK; /* Return code */ | 175624 | int rc = SQLITE_OK; /* Return code */ |
| 173787 | int i; /* Iterator variable */ | 175625 | int i; /* Iterator variable */ |
| @@ -176616,9 +178454,12 @@ static const sqlite3_module fts3Module = { | |||
| 176616 | ** allocated for the tokenizer hash table. | 178454 | ** allocated for the tokenizer hash table. |
| 176617 | */ | 178455 | */ |
| 176618 | static void hashDestroy(void *p){ | 178456 | static void hashDestroy(void *p){ |
| 176619 | Fts3Hash *pHash = (Fts3Hash *)p; | 178457 | Fts3HashWrapper *pHash = (Fts3HashWrapper *)p; |
| 176620 | sqlite3Fts3HashClear(pHash); | 178458 | pHash->nRef--; |
| 176621 | sqlite3_free(pHash); | 178459 | if( pHash->nRef<=0 ){ |
| 178460 | sqlite3Fts3HashClear(&pHash->hash); | ||
| 178461 | sqlite3_free(pHash); | ||
| 178462 | } | ||
| 176622 | } | 178463 | } |
| 176623 | 178464 | ||
| 176624 | /* | 178465 | /* |
| @@ -176648,7 +178489,7 @@ SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule(sqlite3_tokenizer_module const | |||
| 176648 | */ | 178489 | */ |
| 176649 | SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){ | 178490 | SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){ |
| 176650 | int rc = SQLITE_OK; | 178491 | int rc = SQLITE_OK; |
| 176651 | Fts3Hash *pHash = 0; | 178492 | Fts3HashWrapper *pHash = 0; |
| 176652 | const sqlite3_tokenizer_module *pSimple = 0; | 178493 | const sqlite3_tokenizer_module *pSimple = 0; |
| 176653 | const sqlite3_tokenizer_module *pPorter = 0; | 178494 | const sqlite3_tokenizer_module *pPorter = 0; |
| 176654 | #ifndef SQLITE_DISABLE_FTS3_UNICODE | 178495 | #ifndef SQLITE_DISABLE_FTS3_UNICODE |
| @@ -176676,23 +178517,24 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){ | |||
| 176676 | sqlite3Fts3PorterTokenizerModule(&pPorter); | 178517 | sqlite3Fts3PorterTokenizerModule(&pPorter); |
| 176677 | 178518 | ||
| 176678 | /* Allocate and initialize the hash-table used to store tokenizers. */ | 178519 | /* Allocate and initialize the hash-table used to store tokenizers. */ |
| 176679 | pHash = sqlite3_malloc(sizeof(Fts3Hash)); | 178520 | pHash = sqlite3_malloc(sizeof(Fts3HashWrapper)); |
| 176680 | if( !pHash ){ | 178521 | if( !pHash ){ |
| 176681 | rc = SQLITE_NOMEM; | 178522 | rc = SQLITE_NOMEM; |
| 176682 | }else{ | 178523 | }else{ |
| 176683 | sqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1); | 178524 | sqlite3Fts3HashInit(&pHash->hash, FTS3_HASH_STRING, 1); |
| 178525 | pHash->nRef = 0; | ||
| 176684 | } | 178526 | } |
| 176685 | 178527 | ||
| 176686 | /* Load the built-in tokenizers into the hash table */ | 178528 | /* Load the built-in tokenizers into the hash table */ |
| 176687 | if( rc==SQLITE_OK ){ | 178529 | if( rc==SQLITE_OK ){ |
| 176688 | if( sqlite3Fts3HashInsert(pHash, "simple", 7, (void *)pSimple) | 178530 | if( sqlite3Fts3HashInsert(&pHash->hash, "simple", 7, (void *)pSimple) |
| 176689 | || sqlite3Fts3HashInsert(pHash, "porter", 7, (void *)pPorter) | 178531 | || sqlite3Fts3HashInsert(&pHash->hash, "porter", 7, (void *)pPorter) |
| 176690 | 178532 | ||
| 176691 | #ifndef SQLITE_DISABLE_FTS3_UNICODE | 178533 | #ifndef SQLITE_DISABLE_FTS3_UNICODE |
| 176692 | || sqlite3Fts3HashInsert(pHash, "unicode61", 10, (void *)pUnicode) | 178534 | || sqlite3Fts3HashInsert(&pHash->hash, "unicode61", 10, (void *)pUnicode) |
| 176693 | #endif | 178535 | #endif |
| 176694 | #ifdef SQLITE_ENABLE_ICU | 178536 | #ifdef SQLITE_ENABLE_ICU |
| 176695 | || (pIcu && sqlite3Fts3HashInsert(pHash, "icu", 4, (void *)pIcu)) | 178537 | || (pIcu && sqlite3Fts3HashInsert(&pHash->hash, "icu", 4, (void *)pIcu)) |
| 176696 | #endif | 178538 | #endif |
| 176697 | ){ | 178539 | ){ |
| 176698 | rc = SQLITE_NOMEM; | 178540 | rc = SQLITE_NOMEM; |
| @@ -176701,7 +178543,7 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){ | |||
| 176701 | 178543 | ||
| 176702 | #ifdef SQLITE_TEST | 178544 | #ifdef SQLITE_TEST |
| 176703 | if( rc==SQLITE_OK ){ | 178545 | if( rc==SQLITE_OK ){ |
| 176704 | rc = sqlite3Fts3ExprInitTestInterface(db, pHash); | 178546 | rc = sqlite3Fts3ExprInitTestInterface(db, &pHash->hash); |
| 176705 | } | 178547 | } |
| 176706 | #endif | 178548 | #endif |
| 176707 | 178549 | ||
| @@ -176710,23 +178552,26 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){ | |||
| 176710 | ** module with sqlite. | 178552 | ** module with sqlite. |
| 176711 | */ | 178553 | */ |
| 176712 | if( SQLITE_OK==rc | 178554 | if( SQLITE_OK==rc |
| 176713 | && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer")) | 178555 | && SQLITE_OK==(rc=sqlite3Fts3InitHashTable(db,&pHash->hash,"fts3_tokenizer")) |
| 176714 | && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1)) | 178556 | && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1)) |
| 176715 | && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1)) | 178557 | && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1)) |
| 176716 | && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1)) | 178558 | && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1)) |
| 176717 | && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 2)) | 178559 | && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 2)) |
| 176718 | && SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", 1)) | 178560 | && SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", 1)) |
| 176719 | ){ | 178561 | ){ |
| 178562 | pHash->nRef++; | ||
| 176720 | rc = sqlite3_create_module_v2( | 178563 | rc = sqlite3_create_module_v2( |
| 176721 | db, "fts3", &fts3Module, (void *)pHash, hashDestroy | 178564 | db, "fts3", &fts3Module, (void *)pHash, hashDestroy |
| 176722 | ); | 178565 | ); |
| 176723 | if( rc==SQLITE_OK ){ | 178566 | if( rc==SQLITE_OK ){ |
| 178567 | pHash->nRef++; | ||
| 176724 | rc = sqlite3_create_module_v2( | 178568 | rc = sqlite3_create_module_v2( |
| 176725 | db, "fts4", &fts3Module, (void *)pHash, 0 | 178569 | db, "fts4", &fts3Module, (void *)pHash, hashDestroy |
| 176726 | ); | 178570 | ); |
| 176727 | } | 178571 | } |
| 176728 | if( rc==SQLITE_OK ){ | 178572 | if( rc==SQLITE_OK ){ |
| 176729 | rc = sqlite3Fts3InitTok(db, (void *)pHash); | 178573 | pHash->nRef++; |
| 178574 | rc = sqlite3Fts3InitTok(db, (void *)pHash, hashDestroy); | ||
| 176730 | } | 178575 | } |
| 176731 | return rc; | 178576 | return rc; |
| 176732 | } | 178577 | } |
| @@ -176735,7 +178580,7 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){ | |||
| 176735 | /* An error has occurred. Delete the hash table and return the error code. */ | 178580 | /* An error has occurred. Delete the hash table and return the error code. */ |
| 176736 | assert( rc!=SQLITE_OK ); | 178581 | assert( rc!=SQLITE_OK ); |
| 176737 | if( pHash ){ | 178582 | if( pHash ){ |
| 176738 | sqlite3Fts3HashClear(pHash); | 178583 | sqlite3Fts3HashClear(&pHash->hash); |
| 176739 | sqlite3_free(pHash); | 178584 | sqlite3_free(pHash); |
| 176740 | } | 178585 | } |
| 176741 | return rc; | 178586 | return rc; |
| @@ -182799,7 +184644,7 @@ static int fts3tokRowidMethod( | |||
| 182799 | ** Register the fts3tok module with database connection db. Return SQLITE_OK | 184644 | ** Register the fts3tok module with database connection db. Return SQLITE_OK |
| 182800 | ** if successful or an error code if sqlite3_create_module() fails. | 184645 | ** if successful or an error code if sqlite3_create_module() fails. |
| 182801 | */ | 184646 | */ |
| 182802 | SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash){ | 184647 | SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash, void(*xDestroy)(void*)){ |
| 182803 | static const sqlite3_module fts3tok_module = { | 184648 | static const sqlite3_module fts3tok_module = { |
| 182804 | 0, /* iVersion */ | 184649 | 0, /* iVersion */ |
| 182805 | fts3tokConnectMethod, /* xCreate */ | 184650 | fts3tokConnectMethod, /* xCreate */ |
| @@ -182828,7 +184673,9 @@ SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash){ | |||
| 182828 | }; | 184673 | }; |
| 182829 | int rc; /* Return code */ | 184674 | int rc; /* Return code */ |
| 182830 | 184675 | ||
| 182831 | rc = sqlite3_create_module(db, "fts3tokenize", &fts3tok_module, (void*)pHash); | 184676 | rc = sqlite3_create_module_v2( |
| 184677 | db, "fts3tokenize", &fts3tok_module, (void*)pHash, xDestroy | ||
| 184678 | ); | ||
| 182832 | return rc; | 184679 | return rc; |
| 182833 | } | 184680 | } |
| 182834 | 184681 | ||
| @@ -191187,7 +193034,7 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int c, int eRemoveDiacritic){ | |||
| 191187 | #endif /* !defined(SQLITE_DISABLE_FTS3_UNICODE) */ | 193034 | #endif /* !defined(SQLITE_DISABLE_FTS3_UNICODE) */ |
| 191188 | 193035 | ||
| 191189 | /************** End of fts3_unicode2.c ***************************************/ | 193036 | /************** End of fts3_unicode2.c ***************************************/ |
| 191190 | /************** Begin file json1.c *******************************************/ | 193037 | /************** Begin file json.c ********************************************/ |
| 191191 | /* | 193038 | /* |
| 191192 | ** 2015-08-12 | 193039 | ** 2015-08-12 |
| 191193 | ** | 193040 | ** |
| @@ -191200,10 +193047,10 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int c, int eRemoveDiacritic){ | |||
| 191200 | ** | 193047 | ** |
| 191201 | ****************************************************************************** | 193048 | ****************************************************************************** |
| 191202 | ** | 193049 | ** |
| 191203 | ** This SQLite extension implements JSON functions. The interface is | 193050 | ** This SQLite JSON functions. |
| 191204 | ** modeled after MySQL JSON functions: | ||
| 191205 | ** | 193051 | ** |
| 191206 | ** https://dev.mysql.com/doc/refman/5.7/en/json.html | 193052 | ** This file began as an extension in ext/misc/json1.c in 2015. That |
| 193053 | ** extension proved so useful that it has now been moved into the core. | ||
| 191207 | ** | 193054 | ** |
| 191208 | ** For the time being, all JSON is stored as pure text. (We might add | 193055 | ** For the time being, all JSON is stored as pure text. (We might add |
| 191209 | ** a JSONB type in the future which stores a binary encoding of JSON in | 193056 | ** a JSONB type in the future which stores a binary encoding of JSON in |
| @@ -191211,48 +193058,8 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int c, int eRemoveDiacritic){ | |||
| 191211 | ** This implementation parses JSON text at 250 MB/s, so it is hard to see | 193058 | ** This implementation parses JSON text at 250 MB/s, so it is hard to see |
| 191212 | ** how JSONB might improve on that.) | 193059 | ** how JSONB might improve on that.) |
| 191213 | */ | 193060 | */ |
| 191214 | #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_JSON1) | 193061 | #ifndef SQLITE_OMIT_JSON |
| 191215 | #if !defined(SQLITEINT_H) | 193062 | /* #include "sqliteInt.h" */ |
| 191216 | /* #include "sqlite3ext.h" */ | ||
| 191217 | #endif | ||
| 191218 | SQLITE_EXTENSION_INIT1 | ||
| 191219 | /* #include <assert.h> */ | ||
| 191220 | /* #include <string.h> */ | ||
| 191221 | /* #include <stdlib.h> */ | ||
| 191222 | /* #include <stdarg.h> */ | ||
| 191223 | |||
| 191224 | /* Mark a function parameter as unused, to suppress nuisance compiler | ||
| 191225 | ** warnings. */ | ||
| 191226 | #ifndef UNUSED_PARAM | ||
| 191227 | # define UNUSED_PARAM(X) (void)(X) | ||
| 191228 | #endif | ||
| 191229 | |||
| 191230 | #ifndef LARGEST_INT64 | ||
| 191231 | # define LARGEST_INT64 (0xffffffff|(((sqlite3_int64)0x7fffffff)<<32)) | ||
| 191232 | # define SMALLEST_INT64 (((sqlite3_int64)-1) - LARGEST_INT64) | ||
| 191233 | #endif | ||
| 191234 | |||
| 191235 | #ifndef deliberate_fall_through | ||
| 191236 | # define deliberate_fall_through | ||
| 191237 | #endif | ||
| 191238 | |||
| 191239 | /* | ||
| 191240 | ** Versions of isspace(), isalnum() and isdigit() to which it is safe | ||
| 191241 | ** to pass signed char values. | ||
| 191242 | */ | ||
| 191243 | #ifdef sqlite3Isdigit | ||
| 191244 | /* Use the SQLite core versions if this routine is part of the | ||
| 191245 | ** SQLite amalgamation */ | ||
| 191246 | # define safe_isdigit(x) sqlite3Isdigit(x) | ||
| 191247 | # define safe_isalnum(x) sqlite3Isalnum(x) | ||
| 191248 | # define safe_isxdigit(x) sqlite3Isxdigit(x) | ||
| 191249 | #else | ||
| 191250 | /* Use the standard library for separate compilation */ | ||
| 191251 | #include <ctype.h> /* amalgamator: keep */ | ||
| 191252 | # define safe_isdigit(x) isdigit((unsigned char)(x)) | ||
| 191253 | # define safe_isalnum(x) isalnum((unsigned char)(x)) | ||
| 191254 | # define safe_isxdigit(x) isxdigit((unsigned char)(x)) | ||
| 191255 | #endif | ||
| 191256 | 193063 | ||
| 191257 | /* | 193064 | /* |
| 191258 | ** Growing our own isspace() routine this way is twice as fast as | 193065 | ** Growing our own isspace() routine this way is twice as fast as |
| @@ -191277,44 +193084,14 @@ static const char jsonIsSpace[] = { | |||
| 191277 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 193084 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 191278 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 193085 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 191279 | }; | 193086 | }; |
| 191280 | #define safe_isspace(x) (jsonIsSpace[(unsigned char)x]) | 193087 | #define fast_isspace(x) (jsonIsSpace[(unsigned char)x]) |
| 191281 | 193088 | ||
| 191282 | #ifndef SQLITE_AMALGAMATION | ||
| 191283 | /* Unsigned integer types. These are already defined in the sqliteInt.h, | ||
| 191284 | ** but the definitions need to be repeated for separate compilation. */ | ||
| 191285 | typedef sqlite3_uint64 u64; | ||
| 191286 | typedef unsigned int u32; | ||
| 191287 | typedef unsigned short int u16; | ||
| 191288 | typedef unsigned char u8; | ||
| 191289 | # if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_MUTATION_TEST) | ||
| 191290 | # define SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS 1 | ||
| 191291 | # endif | ||
| 191292 | # if defined(SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS) | ||
| 191293 | # define ALWAYS(X) (1) | ||
| 191294 | # define NEVER(X) (0) | ||
| 191295 | # elif !defined(NDEBUG) | ||
| 191296 | # define ALWAYS(X) ((X)?1:(assert(0),0)) | ||
| 191297 | # define NEVER(X) ((X)?(assert(0),1):0) | ||
| 191298 | # else | ||
| 191299 | # define ALWAYS(X) (X) | ||
| 191300 | # define NEVER(X) (X) | ||
| 191301 | # endif | ||
| 191302 | # define testcase(X) | ||
| 191303 | #endif | ||
| 191304 | #if !defined(SQLITE_DEBUG) && !defined(SQLITE_COVERAGE_TEST) | 193089 | #if !defined(SQLITE_DEBUG) && !defined(SQLITE_COVERAGE_TEST) |
| 191305 | # define VVA(X) | 193090 | # define VVA(X) |
| 191306 | #else | 193091 | #else |
| 191307 | # define VVA(X) X | 193092 | # define VVA(X) X |
| 191308 | #endif | 193093 | #endif |
| 191309 | 193094 | ||
| 191310 | /* | ||
| 191311 | ** Some of the testcase() macros in this file are problematic for gcov | ||
| 191312 | ** in that they generate false-miss errors randomly. This is a gcov problem, | ||
| 191313 | ** not a problem in this case. But to work around it, we disable the | ||
| 191314 | ** problematic test cases for production builds. | ||
| 191315 | */ | ||
| 191316 | #define json_testcase(X) | ||
| 191317 | |||
| 191318 | /* Objects */ | 193095 | /* Objects */ |
| 191319 | typedef struct JsonString JsonString; | 193096 | typedef struct JsonString JsonString; |
| 191320 | typedef struct JsonNode JsonNode; | 193097 | typedef struct JsonNode JsonNode; |
| @@ -191772,10 +193549,10 @@ static u8 jsonHexToInt(int h){ | |||
| 191772 | */ | 193549 | */ |
| 191773 | static u32 jsonHexToInt4(const char *z){ | 193550 | static u32 jsonHexToInt4(const char *z){ |
| 191774 | u32 v; | 193551 | u32 v; |
| 191775 | assert( safe_isxdigit(z[0]) ); | 193552 | assert( sqlite3Isxdigit(z[0]) ); |
| 191776 | assert( safe_isxdigit(z[1]) ); | 193553 | assert( sqlite3Isxdigit(z[1]) ); |
| 191777 | assert( safe_isxdigit(z[2]) ); | 193554 | assert( sqlite3Isxdigit(z[2]) ); |
| 191778 | assert( safe_isxdigit(z[3]) ); | 193555 | assert( sqlite3Isxdigit(z[3]) ); |
| 191779 | v = (jsonHexToInt(z[0])<<12) | 193556 | v = (jsonHexToInt(z[0])<<12) |
| 191780 | + (jsonHexToInt(z[1])<<8) | 193557 | + (jsonHexToInt(z[1])<<8) |
| 191781 | + (jsonHexToInt(z[2])<<4) | 193558 | + (jsonHexToInt(z[2])<<4) |
| @@ -192010,7 +193787,7 @@ static int jsonParseAddNode( | |||
| 192010 | */ | 193787 | */ |
| 192011 | static int jsonIs4Hex(const char *z){ | 193788 | static int jsonIs4Hex(const char *z){ |
| 192012 | int i; | 193789 | int i; |
| 192013 | for(i=0; i<4; i++) if( !safe_isxdigit(z[i]) ) return 0; | 193790 | for(i=0; i<4; i++) if( !sqlite3Isxdigit(z[i]) ) return 0; |
| 192014 | return 1; | 193791 | return 1; |
| 192015 | } | 193792 | } |
| 192016 | 193793 | ||
| @@ -192029,13 +193806,13 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ | |||
| 192029 | int x; | 193806 | int x; |
| 192030 | JsonNode *pNode; | 193807 | JsonNode *pNode; |
| 192031 | const char *z = pParse->zJson; | 193808 | const char *z = pParse->zJson; |
| 192032 | while( safe_isspace(z[i]) ){ i++; } | 193809 | while( fast_isspace(z[i]) ){ i++; } |
| 192033 | if( (c = z[i])=='{' ){ | 193810 | if( (c = z[i])=='{' ){ |
| 192034 | /* Parse object */ | 193811 | /* Parse object */ |
| 192035 | iThis = jsonParseAddNode(pParse, JSON_OBJECT, 0, 0); | 193812 | iThis = jsonParseAddNode(pParse, JSON_OBJECT, 0, 0); |
| 192036 | if( iThis<0 ) return -1; | 193813 | if( iThis<0 ) return -1; |
| 192037 | for(j=i+1;;j++){ | 193814 | for(j=i+1;;j++){ |
| 192038 | while( safe_isspace(z[j]) ){ j++; } | 193815 | while( fast_isspace(z[j]) ){ j++; } |
| 192039 | if( ++pParse->iDepth > JSON_MAX_DEPTH ) return -1; | 193816 | if( ++pParse->iDepth > JSON_MAX_DEPTH ) return -1; |
| 192040 | x = jsonParseValue(pParse, j); | 193817 | x = jsonParseValue(pParse, j); |
| 192041 | if( x<0 ){ | 193818 | if( x<0 ){ |
| @@ -192048,14 +193825,14 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ | |||
| 192048 | if( pNode->eType!=JSON_STRING ) return -1; | 193825 | if( pNode->eType!=JSON_STRING ) return -1; |
| 192049 | pNode->jnFlags |= JNODE_LABEL; | 193826 | pNode->jnFlags |= JNODE_LABEL; |
| 192050 | j = x; | 193827 | j = x; |
| 192051 | while( safe_isspace(z[j]) ){ j++; } | 193828 | while( fast_isspace(z[j]) ){ j++; } |
| 192052 | if( z[j]!=':' ) return -1; | 193829 | if( z[j]!=':' ) return -1; |
| 192053 | j++; | 193830 | j++; |
| 192054 | x = jsonParseValue(pParse, j); | 193831 | x = jsonParseValue(pParse, j); |
| 192055 | pParse->iDepth--; | 193832 | pParse->iDepth--; |
| 192056 | if( x<0 ) return -1; | 193833 | if( x<0 ) return -1; |
| 192057 | j = x; | 193834 | j = x; |
| 192058 | while( safe_isspace(z[j]) ){ j++; } | 193835 | while( fast_isspace(z[j]) ){ j++; } |
| 192059 | c = z[j]; | 193836 | c = z[j]; |
| 192060 | if( c==',' ) continue; | 193837 | if( c==',' ) continue; |
| 192061 | if( c!='}' ) return -1; | 193838 | if( c!='}' ) return -1; |
| @@ -192069,7 +193846,7 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ | |||
| 192069 | if( iThis<0 ) return -1; | 193846 | if( iThis<0 ) return -1; |
| 192070 | memset(&pParse->aNode[iThis].u, 0, sizeof(pParse->aNode[iThis].u)); | 193847 | memset(&pParse->aNode[iThis].u, 0, sizeof(pParse->aNode[iThis].u)); |
| 192071 | for(j=i+1;;j++){ | 193848 | for(j=i+1;;j++){ |
| 192072 | while( safe_isspace(z[j]) ){ j++; } | 193849 | while( fast_isspace(z[j]) ){ j++; } |
| 192073 | if( ++pParse->iDepth > JSON_MAX_DEPTH ) return -1; | 193850 | if( ++pParse->iDepth > JSON_MAX_DEPTH ) return -1; |
| 192074 | x = jsonParseValue(pParse, j); | 193851 | x = jsonParseValue(pParse, j); |
| 192075 | pParse->iDepth--; | 193852 | pParse->iDepth--; |
| @@ -192078,7 +193855,7 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ | |||
| 192078 | return -1; | 193855 | return -1; |
| 192079 | } | 193856 | } |
| 192080 | j = x; | 193857 | j = x; |
| 192081 | while( safe_isspace(z[j]) ){ j++; } | 193858 | while( fast_isspace(z[j]) ){ j++; } |
| 192082 | c = z[j]; | 193859 | c = z[j]; |
| 192083 | if( c==',' ) continue; | 193860 | if( c==',' ) continue; |
| 192084 | if( c!=']' ) return -1; | 193861 | if( c!=']' ) return -1; |
| @@ -192115,17 +193892,17 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ | |||
| 192115 | return j+1; | 193892 | return j+1; |
| 192116 | }else if( c=='n' | 193893 | }else if( c=='n' |
| 192117 | && strncmp(z+i,"null",4)==0 | 193894 | && strncmp(z+i,"null",4)==0 |
| 192118 | && !safe_isalnum(z[i+4]) ){ | 193895 | && !sqlite3Isalnum(z[i+4]) ){ |
| 192119 | jsonParseAddNode(pParse, JSON_NULL, 0, 0); | 193896 | jsonParseAddNode(pParse, JSON_NULL, 0, 0); |
| 192120 | return i+4; | 193897 | return i+4; |
| 192121 | }else if( c=='t' | 193898 | }else if( c=='t' |
| 192122 | && strncmp(z+i,"true",4)==0 | 193899 | && strncmp(z+i,"true",4)==0 |
| 192123 | && !safe_isalnum(z[i+4]) ){ | 193900 | && !sqlite3Isalnum(z[i+4]) ){ |
| 192124 | jsonParseAddNode(pParse, JSON_TRUE, 0, 0); | 193901 | jsonParseAddNode(pParse, JSON_TRUE, 0, 0); |
| 192125 | return i+4; | 193902 | return i+4; |
| 192126 | }else if( c=='f' | 193903 | }else if( c=='f' |
| 192127 | && strncmp(z+i,"false",5)==0 | 193904 | && strncmp(z+i,"false",5)==0 |
| 192128 | && !safe_isalnum(z[i+5]) ){ | 193905 | && !sqlite3Isalnum(z[i+5]) ){ |
| 192129 | jsonParseAddNode(pParse, JSON_FALSE, 0, 0); | 193906 | jsonParseAddNode(pParse, JSON_FALSE, 0, 0); |
| 192130 | return i+5; | 193907 | return i+5; |
| 192131 | }else if( c=='-' || (c>='0' && c<='9') ){ | 193908 | }else if( c=='-' || (c>='0' && c<='9') ){ |
| @@ -192196,7 +193973,7 @@ static int jsonParse( | |||
| 192196 | if( pParse->oom ) i = -1; | 193973 | if( pParse->oom ) i = -1; |
| 192197 | if( i>0 ){ | 193974 | if( i>0 ){ |
| 192198 | assert( pParse->iDepth==0 ); | 193975 | assert( pParse->iDepth==0 ); |
| 192199 | while( safe_isspace(zJson[i]) ) i++; | 193976 | while( fast_isspace(zJson[i]) ) i++; |
| 192200 | if( zJson[i] ) i = -1; | 193977 | if( zJson[i] ) i = -1; |
| 192201 | } | 193978 | } |
| 192202 | if( i<=0 ){ | 193979 | if( i<=0 ){ |
| @@ -192424,7 +194201,7 @@ static JsonNode *jsonLookupStep( | |||
| 192424 | }else if( zPath[0]=='[' ){ | 194201 | }else if( zPath[0]=='[' ){ |
| 192425 | i = 0; | 194202 | i = 0; |
| 192426 | j = 1; | 194203 | j = 1; |
| 192427 | while( safe_isdigit(zPath[j]) ){ | 194204 | while( sqlite3Isdigit(zPath[j]) ){ |
| 192428 | i = i*10 + zPath[j] - '0'; | 194205 | i = i*10 + zPath[j] - '0'; |
| 192429 | j++; | 194206 | j++; |
| 192430 | } | 194207 | } |
| @@ -192445,13 +194222,13 @@ static JsonNode *jsonLookupStep( | |||
| 192445 | j = 1; | 194222 | j = 1; |
| 192446 | } | 194223 | } |
| 192447 | j = 2; | 194224 | j = 2; |
| 192448 | if( zPath[2]=='-' && safe_isdigit(zPath[3]) ){ | 194225 | if( zPath[2]=='-' && sqlite3Isdigit(zPath[3]) ){ |
| 192449 | unsigned int x = 0; | 194226 | unsigned int x = 0; |
| 192450 | j = 3; | 194227 | j = 3; |
| 192451 | do{ | 194228 | do{ |
| 192452 | x = x*10 + zPath[j] - '0'; | 194229 | x = x*10 + zPath[j] - '0'; |
| 192453 | j++; | 194230 | j++; |
| 192454 | }while( safe_isdigit(zPath[j]) ); | 194231 | }while( sqlite3Isdigit(zPath[j]) ); |
| 192455 | if( x>i ) return 0; | 194232 | if( x>i ) return 0; |
| 192456 | i -= x; | 194233 | i -= x; |
| 192457 | } | 194234 | } |
| @@ -192670,7 +194447,7 @@ static void jsonTest1Func( | |||
| 192670 | int argc, | 194447 | int argc, |
| 192671 | sqlite3_value **argv | 194448 | sqlite3_value **argv |
| 192672 | ){ | 194449 | ){ |
| 192673 | UNUSED_PARAM(argc); | 194450 | UNUSED_PARAMETER(argc); |
| 192674 | sqlite3_result_int(ctx, sqlite3_value_subtype(argv[0])==JSON_SUBTYPE); | 194451 | sqlite3_result_int(ctx, sqlite3_value_subtype(argv[0])==JSON_SUBTYPE); |
| 192675 | } | 194452 | } |
| 192676 | #endif /* SQLITE_DEBUG */ | 194453 | #endif /* SQLITE_DEBUG */ |
| @@ -192691,7 +194468,7 @@ static void jsonQuoteFunc( | |||
| 192691 | sqlite3_value **argv | 194468 | sqlite3_value **argv |
| 192692 | ){ | 194469 | ){ |
| 192693 | JsonString jx; | 194470 | JsonString jx; |
| 192694 | UNUSED_PARAM(argc); | 194471 | UNUSED_PARAMETER(argc); |
| 192695 | 194472 | ||
| 192696 | jsonInit(&jx, ctx); | 194473 | jsonInit(&jx, ctx); |
| 192697 | jsonAppendValue(&jx, argv[0]); | 194474 | jsonAppendValue(&jx, argv[0]); |
| @@ -192763,12 +194540,33 @@ static void jsonArrayLengthFunc( | |||
| 192763 | } | 194540 | } |
| 192764 | 194541 | ||
| 192765 | /* | 194542 | /* |
| 194543 | ** Bit values for the flags passed into jsonExtractFunc() or | ||
| 194544 | ** jsonSetFunc() via the user-data value. | ||
| 194545 | */ | ||
| 194546 | #define JSON_JSON 0x01 /* Result is always JSON */ | ||
| 194547 | #define JSON_SQL 0x02 /* Result is always SQL */ | ||
| 194548 | #define JSON_ABPATH 0x03 /* Allow abbreviated JSON path specs */ | ||
| 194549 | #define JSON_ISSET 0x04 /* json_set(), not json_insert() */ | ||
| 194550 | |||
| 194551 | /* | ||
| 192766 | ** json_extract(JSON, PATH, ...) | 194552 | ** json_extract(JSON, PATH, ...) |
| 194553 | ** "->"(JSON,PATH) | ||
| 194554 | ** "->>"(JSON,PATH) | ||
| 194555 | ** | ||
| 194556 | ** Return the element described by PATH. Return NULL if that PATH element | ||
| 194557 | ** is not found. | ||
| 194558 | ** | ||
| 194559 | ** If JSON_JSON is set or if more that one PATH argument is supplied then | ||
| 194560 | ** always return a JSON representation of the result. If JSON_SQL is set, | ||
| 194561 | ** then always return an SQL representation of the result. If neither flag | ||
| 194562 | ** is present and argc==2, then return JSON for objects and arrays and SQL | ||
| 194563 | ** for all other values. | ||
| 194564 | ** | ||
| 194565 | ** When multiple PATH arguments are supplied, the result is a JSON array | ||
| 194566 | ** containing the result of each PATH. | ||
| 192767 | ** | 194567 | ** |
| 192768 | ** Return the element described by PATH. Return NULL if there is no | 194568 | ** Abbreviated JSON path expressions are allows if JSON_ABPATH, for |
| 192769 | ** PATH element. If there are multiple PATHs, then return a JSON array | 194569 | ** compatibility with PG. |
| 192770 | ** with the result from each path. Throw an error if the JSON or any PATH | ||
| 192771 | ** is malformed. | ||
| 192772 | */ | 194570 | */ |
| 192773 | static void jsonExtractFunc( | 194571 | static void jsonExtractFunc( |
| 192774 | sqlite3_context *ctx, | 194572 | sqlite3_context *ctx, |
| @@ -192778,35 +194576,77 @@ static void jsonExtractFunc( | |||
| 192778 | JsonParse *p; /* The parse */ | 194576 | JsonParse *p; /* The parse */ |
| 192779 | JsonNode *pNode; | 194577 | JsonNode *pNode; |
| 192780 | const char *zPath; | 194578 | const char *zPath; |
| 194579 | int flags = SQLITE_PTR_TO_INT(sqlite3_user_data(ctx)); | ||
| 192781 | JsonString jx; | 194580 | JsonString jx; |
| 192782 | int i; | ||
| 192783 | 194581 | ||
| 192784 | if( argc<2 ) return; | 194582 | if( argc<2 ) return; |
| 192785 | p = jsonParseCached(ctx, argv, ctx); | 194583 | p = jsonParseCached(ctx, argv, ctx); |
| 192786 | if( p==0 ) return; | 194584 | if( p==0 ) return; |
| 192787 | jsonInit(&jx, ctx); | 194585 | if( argc==2 ){ |
| 192788 | jsonAppendChar(&jx, '['); | 194586 | /* With a single PATH argument */ |
| 192789 | for(i=1; i<argc; i++){ | 194587 | zPath = (const char*)sqlite3_value_text(argv[1]); |
| 192790 | zPath = (const char*)sqlite3_value_text(argv[i]); | 194588 | if( zPath==0 ) return; |
| 192791 | pNode = jsonLookup(p, zPath, 0, ctx); | 194589 | if( flags & JSON_ABPATH ){ |
| 192792 | if( p->nErr ) break; | 194590 | if( zPath[0]!='$' ){ |
| 192793 | if( argc>2 ){ | 194591 | /* The -> and ->> operators accept abbreviated PATH arguments. This |
| 194592 | ** is mostly for compatibility with PostgreSQL, but also for | ||
| 194593 | ** convenience. | ||
| 194594 | ** | ||
| 194595 | ** NUMBER ==> $[NUMBER] // PG compatible | ||
| 194596 | ** LABEL ==> $.LABEL // PG compatible | ||
| 194597 | ** [NUMBER] ==> $[NUMBER] // Not PG. Purely for convenience | ||
| 194598 | */ | ||
| 194599 | jsonInit(&jx, ctx); | ||
| 194600 | if( sqlite3Isdigit(zPath[0]) ){ | ||
| 194601 | jsonAppendRaw(&jx, "$[", 2); | ||
| 194602 | jsonAppendRaw(&jx, zPath, (int)strlen(zPath)); | ||
| 194603 | jsonAppendRaw(&jx, "]", 2); | ||
| 194604 | }else{ | ||
| 194605 | jsonAppendRaw(&jx, "$.", 1 + (zPath[0]!='[')); | ||
| 194606 | jsonAppendRaw(&jx, zPath, (int)strlen(zPath)); | ||
| 194607 | jsonAppendChar(&jx, 0); | ||
| 194608 | } | ||
| 194609 | pNode = jx.bErr ? 0 : jsonLookup(p, jx.zBuf, 0, ctx); | ||
| 194610 | jsonReset(&jx); | ||
| 194611 | }else{ | ||
| 194612 | pNode = jsonLookup(p, zPath, 0, ctx); | ||
| 194613 | } | ||
| 194614 | if( pNode ){ | ||
| 194615 | if( flags & JSON_JSON ){ | ||
| 194616 | jsonReturnJson(pNode, ctx, 0); | ||
| 194617 | }else{ | ||
| 194618 | jsonReturn(pNode, ctx, 0); | ||
| 194619 | sqlite3_result_subtype(ctx, 0); | ||
| 194620 | } | ||
| 194621 | } | ||
| 194622 | }else{ | ||
| 194623 | pNode = jsonLookup(p, zPath, 0, ctx); | ||
| 194624 | if( p->nErr==0 && pNode ) jsonReturn(pNode, ctx, 0); | ||
| 194625 | } | ||
| 194626 | }else{ | ||
| 194627 | /* Two or more PATH arguments results in a JSON array with each | ||
| 194628 | ** element of the array being the value selected by one of the PATHs */ | ||
| 194629 | int i; | ||
| 194630 | jsonInit(&jx, ctx); | ||
| 194631 | jsonAppendChar(&jx, '['); | ||
| 194632 | for(i=1; i<argc; i++){ | ||
| 194633 | zPath = (const char*)sqlite3_value_text(argv[i]); | ||
| 194634 | pNode = jsonLookup(p, zPath, 0, ctx); | ||
| 194635 | if( p->nErr ) break; | ||
| 192794 | jsonAppendSeparator(&jx); | 194636 | jsonAppendSeparator(&jx); |
| 192795 | if( pNode ){ | 194637 | if( pNode ){ |
| 192796 | jsonRenderNode(pNode, &jx, 0); | 194638 | jsonRenderNode(pNode, &jx, 0); |
| 192797 | }else{ | 194639 | }else{ |
| 192798 | jsonAppendRaw(&jx, "null", 4); | 194640 | jsonAppendRaw(&jx, "null", 4); |
| 192799 | } | 194641 | } |
| 192800 | }else if( pNode ){ | ||
| 192801 | jsonReturn(pNode, ctx, 0); | ||
| 192802 | } | 194642 | } |
| 194643 | if( i==argc ){ | ||
| 194644 | jsonAppendChar(&jx, ']'); | ||
| 194645 | jsonResult(&jx); | ||
| 194646 | sqlite3_result_subtype(ctx, JSON_SUBTYPE); | ||
| 194647 | } | ||
| 194648 | jsonReset(&jx); | ||
| 192803 | } | 194649 | } |
| 192804 | if( argc>2 && i==argc ){ | ||
| 192805 | jsonAppendChar(&jx, ']'); | ||
| 192806 | jsonResult(&jx); | ||
| 192807 | sqlite3_result_subtype(ctx, JSON_SUBTYPE); | ||
| 192808 | } | ||
| 192809 | jsonReset(&jx); | ||
| 192810 | } | 194650 | } |
| 192811 | 194651 | ||
| 192812 | /* This is the RFC 7396 MergePatch algorithm. | 194652 | /* This is the RFC 7396 MergePatch algorithm. |
| @@ -192902,7 +194742,7 @@ static void jsonPatchFunc( | |||
| 192902 | JsonParse y; /* The patch */ | 194742 | JsonParse y; /* The patch */ |
| 192903 | JsonNode *pResult; /* The result of the merge */ | 194743 | JsonNode *pResult; /* The result of the merge */ |
| 192904 | 194744 | ||
| 192905 | UNUSED_PARAM(argc); | 194745 | UNUSED_PARAMETER(argc); |
| 192906 | if( jsonParse(&x, ctx, (const char*)sqlite3_value_text(argv[0])) ) return; | 194746 | if( jsonParse(&x, ctx, (const char*)sqlite3_value_text(argv[0])) ) return; |
| 192907 | if( jsonParse(&y, ctx, (const char*)sqlite3_value_text(argv[1])) ){ | 194747 | if( jsonParse(&y, ctx, (const char*)sqlite3_value_text(argv[1])) ){ |
| 192908 | jsonParseReset(&x); | 194748 | jsonParseReset(&x); |
| @@ -193023,7 +194863,7 @@ static void jsonReplaceFunc( | |||
| 193023 | if( x.nErr ) goto replace_err; | 194863 | if( x.nErr ) goto replace_err; |
| 193024 | if( pNode ){ | 194864 | if( pNode ){ |
| 193025 | assert( pNode->eU==0 || pNode->eU==1 || pNode->eU==4 ); | 194865 | assert( pNode->eU==0 || pNode->eU==1 || pNode->eU==4 ); |
| 193026 | json_testcase( pNode->eU!=0 && pNode->eU!=1 ); | 194866 | testcase( pNode->eU!=0 && pNode->eU!=1 ); |
| 193027 | pNode->jnFlags |= (u8)JNODE_REPLACE; | 194867 | pNode->jnFlags |= (u8)JNODE_REPLACE; |
| 193028 | VVA( pNode->eU = 4 ); | 194868 | VVA( pNode->eU = 4 ); |
| 193029 | pNode->u.iReplace = i + 1; | 194869 | pNode->u.iReplace = i + 1; |
| @@ -193039,6 +194879,7 @@ replace_err: | |||
| 193039 | jsonParseReset(&x); | 194879 | jsonParseReset(&x); |
| 193040 | } | 194880 | } |
| 193041 | 194881 | ||
| 194882 | |||
| 193042 | /* | 194883 | /* |
| 193043 | ** json_set(JSON, PATH, VALUE, ...) | 194884 | ** json_set(JSON, PATH, VALUE, ...) |
| 193044 | ** | 194885 | ** |
| @@ -193061,7 +194902,7 @@ static void jsonSetFunc( | |||
| 193061 | const char *zPath; | 194902 | const char *zPath; |
| 193062 | u32 i; | 194903 | u32 i; |
| 193063 | int bApnd; | 194904 | int bApnd; |
| 193064 | int bIsSet = *(int*)sqlite3_user_data(ctx); | 194905 | int bIsSet = sqlite3_user_data(ctx)!=0; |
| 193065 | 194906 | ||
| 193066 | if( argc<1 ) return; | 194907 | if( argc<1 ) return; |
| 193067 | if( (argc&1)==0 ) { | 194908 | if( (argc&1)==0 ) { |
| @@ -193080,8 +194921,8 @@ static void jsonSetFunc( | |||
| 193080 | }else if( x.nErr ){ | 194921 | }else if( x.nErr ){ |
| 193081 | goto jsonSetDone; | 194922 | goto jsonSetDone; |
| 193082 | }else if( pNode && (bApnd || bIsSet) ){ | 194923 | }else if( pNode && (bApnd || bIsSet) ){ |
| 193083 | json_testcase( pNode->eU!=0 && pNode->eU!=1 && pNode->eU!=4 ); | 194924 | testcase( pNode->eU!=0 && pNode->eU!=1 ); |
| 193084 | assert( pNode->eU!=3 || pNode->eU!=5 ); | 194925 | assert( pNode->eU!=3 && pNode->eU!=5 ); |
| 193085 | VVA( pNode->eU = 4 ); | 194926 | VVA( pNode->eU = 4 ); |
| 193086 | pNode->jnFlags |= (u8)JNODE_REPLACE; | 194927 | pNode->jnFlags |= (u8)JNODE_REPLACE; |
| 193087 | pNode->u.iReplace = i + 1; | 194928 | pNode->u.iReplace = i + 1; |
| @@ -193101,8 +194942,8 @@ jsonSetDone: | |||
| 193101 | ** json_type(JSON) | 194942 | ** json_type(JSON) |
| 193102 | ** json_type(JSON, PATH) | 194943 | ** json_type(JSON, PATH) |
| 193103 | ** | 194944 | ** |
| 193104 | ** Return the top-level "type" of a JSON string. Throw an error if | 194945 | ** Return the top-level "type" of a JSON string. json_type() raises an |
| 193105 | ** either the JSON or PATH inputs are not well-formed. | 194946 | ** error if either the JSON or PATH inputs are not well-formed. |
| 193106 | */ | 194947 | */ |
| 193107 | static void jsonTypeFunc( | 194948 | static void jsonTypeFunc( |
| 193108 | sqlite3_context *ctx, | 194949 | sqlite3_context *ctx, |
| @@ -193138,7 +194979,7 @@ static void jsonValidFunc( | |||
| 193138 | sqlite3_value **argv | 194979 | sqlite3_value **argv |
| 193139 | ){ | 194980 | ){ |
| 193140 | JsonParse *p; /* The parse */ | 194981 | JsonParse *p; /* The parse */ |
| 193141 | UNUSED_PARAM(argc); | 194982 | UNUSED_PARAMETER(argc); |
| 193142 | p = jsonParseCached(ctx, argv, 0); | 194983 | p = jsonParseCached(ctx, argv, 0); |
| 193143 | sqlite3_result_int(ctx, p!=0); | 194984 | sqlite3_result_int(ctx, p!=0); |
| 193144 | } | 194985 | } |
| @@ -193158,7 +194999,7 @@ static void jsonArrayStep( | |||
| 193158 | sqlite3_value **argv | 194999 | sqlite3_value **argv |
| 193159 | ){ | 195000 | ){ |
| 193160 | JsonString *pStr; | 195001 | JsonString *pStr; |
| 193161 | UNUSED_PARAM(argc); | 195002 | UNUSED_PARAMETER(argc); |
| 193162 | pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr)); | 195003 | pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr)); |
| 193163 | if( pStr ){ | 195004 | if( pStr ){ |
| 193164 | if( pStr->zBuf==0 ){ | 195005 | if( pStr->zBuf==0 ){ |
| @@ -193218,8 +195059,8 @@ static void jsonGroupInverse( | |||
| 193218 | char *z; | 195059 | char *z; |
| 193219 | char c; | 195060 | char c; |
| 193220 | JsonString *pStr; | 195061 | JsonString *pStr; |
| 193221 | UNUSED_PARAM(argc); | 195062 | UNUSED_PARAMETER(argc); |
| 193222 | UNUSED_PARAM(argv); | 195063 | UNUSED_PARAMETER(argv); |
| 193223 | pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0); | 195064 | pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0); |
| 193224 | #ifdef NEVER | 195065 | #ifdef NEVER |
| 193225 | /* pStr is always non-NULL since jsonArrayStep() or jsonObjectStep() will | 195066 | /* pStr is always non-NULL since jsonArrayStep() or jsonObjectStep() will |
| @@ -193263,7 +195104,7 @@ static void jsonObjectStep( | |||
| 193263 | JsonString *pStr; | 195104 | JsonString *pStr; |
| 193264 | const char *z; | 195105 | const char *z; |
| 193265 | u32 n; | 195106 | u32 n; |
| 193266 | UNUSED_PARAM(argc); | 195107 | UNUSED_PARAMETER(argc); |
| 193267 | pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr)); | 195108 | pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr)); |
| 193268 | if( pStr ){ | 195109 | if( pStr ){ |
| 193269 | if( pStr->zBuf==0 ){ | 195110 | if( pStr->zBuf==0 ){ |
| @@ -193354,10 +195195,10 @@ static int jsonEachConnect( | |||
| 193354 | #define JEACH_JSON 8 | 195195 | #define JEACH_JSON 8 |
| 193355 | #define JEACH_ROOT 9 | 195196 | #define JEACH_ROOT 9 |
| 193356 | 195197 | ||
| 193357 | UNUSED_PARAM(pzErr); | 195198 | UNUSED_PARAMETER(pzErr); |
| 193358 | UNUSED_PARAM(argv); | 195199 | UNUSED_PARAMETER(argv); |
| 193359 | UNUSED_PARAM(argc); | 195200 | UNUSED_PARAMETER(argc); |
| 193360 | UNUSED_PARAM(pAux); | 195201 | UNUSED_PARAMETER(pAux); |
| 193361 | rc = sqlite3_declare_vtab(db, | 195202 | rc = sqlite3_declare_vtab(db, |
| 193362 | "CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path," | 195203 | "CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path," |
| 193363 | "json HIDDEN,root HIDDEN)"); | 195204 | "json HIDDEN,root HIDDEN)"); |
| @@ -193380,7 +195221,7 @@ static int jsonEachDisconnect(sqlite3_vtab *pVtab){ | |||
| 193380 | static int jsonEachOpenEach(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){ | 195221 | static int jsonEachOpenEach(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){ |
| 193381 | JsonEachCursor *pCur; | 195222 | JsonEachCursor *pCur; |
| 193382 | 195223 | ||
| 193383 | UNUSED_PARAM(p); | 195224 | UNUSED_PARAMETER(p); |
| 193384 | pCur = sqlite3_malloc( sizeof(*pCur) ); | 195225 | pCur = sqlite3_malloc( sizeof(*pCur) ); |
| 193385 | if( pCur==0 ) return SQLITE_NOMEM; | 195226 | if( pCur==0 ) return SQLITE_NOMEM; |
| 193386 | memset(pCur, 0, sizeof(*pCur)); | 195227 | memset(pCur, 0, sizeof(*pCur)); |
| @@ -193440,7 +195281,7 @@ static int jsonEachNext(sqlite3_vtab_cursor *cur){ | |||
| 193440 | p->eType = pUp->eType; | 195281 | p->eType = pUp->eType; |
| 193441 | if( pUp->eType==JSON_ARRAY ){ | 195282 | if( pUp->eType==JSON_ARRAY ){ |
| 193442 | assert( pUp->eU==0 || pUp->eU==3 ); | 195283 | assert( pUp->eU==0 || pUp->eU==3 ); |
| 193443 | json_testcase( pUp->eU==3 ); | 195284 | testcase( pUp->eU==3 ); |
| 193444 | VVA( pUp->eU = 3 ); | 195285 | VVA( pUp->eU = 3 ); |
| 193445 | if( iUp==p->i-1 ){ | 195286 | if( iUp==p->i-1 ){ |
| 193446 | pUp->u.iKey = 0; | 195287 | pUp->u.iKey = 0; |
| @@ -193627,7 +195468,7 @@ static int jsonEachBestIndex( | |||
| 193627 | /* This implementation assumes that JSON and ROOT are the last two | 195468 | /* This implementation assumes that JSON and ROOT are the last two |
| 193628 | ** columns in the table */ | 195469 | ** columns in the table */ |
| 193629 | assert( JEACH_ROOT == JEACH_JSON+1 ); | 195470 | assert( JEACH_ROOT == JEACH_JSON+1 ); |
| 193630 | UNUSED_PARAM(tab); | 195471 | UNUSED_PARAMETER(tab); |
| 193631 | aIdx[0] = aIdx[1] = -1; | 195472 | aIdx[0] = aIdx[1] = -1; |
| 193632 | pConstraint = pIdxInfo->aConstraint; | 195473 | pConstraint = pIdxInfo->aConstraint; |
| 193633 | for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){ | 195474 | for(i=0; i<pIdxInfo->nConstraint; i++, pConstraint++){ |
| @@ -193683,8 +195524,8 @@ static int jsonEachFilter( | |||
| 193683 | const char *zRoot = 0; | 195524 | const char *zRoot = 0; |
| 193684 | sqlite3_int64 n; | 195525 | sqlite3_int64 n; |
| 193685 | 195526 | ||
| 193686 | UNUSED_PARAM(idxStr); | 195527 | UNUSED_PARAMETER(idxStr); |
| 193687 | UNUSED_PARAM(argc); | 195528 | UNUSED_PARAMETER(argc); |
| 193688 | jsonEachCursorReset(p); | 195529 | jsonEachCursorReset(p); |
| 193689 | if( idxNum==0 ) return SQLITE_OK; | 195530 | if( idxNum==0 ) return SQLITE_OK; |
| 193690 | z = (const char*)sqlite3_value_text(argv[0]); | 195531 | z = (const char*)sqlite3_value_text(argv[0]); |
| @@ -193809,108 +195650,68 @@ static sqlite3_module jsonTreeModule = { | |||
| 193809 | 0 /* xShadowName */ | 195650 | 0 /* xShadowName */ |
| 193810 | }; | 195651 | }; |
| 193811 | #endif /* SQLITE_OMIT_VIRTUALTABLE */ | 195652 | #endif /* SQLITE_OMIT_VIRTUALTABLE */ |
| 193812 | 195653 | #endif /* !defined(SQLITE_OMIT_JSON) */ | |
| 193813 | /**************************************************************************** | 195654 | |
| 193814 | ** The following routines are the only publically visible identifiers in this | 195655 | /* |
| 193815 | ** file. Call the following routines in order to register the various SQL | 195656 | ** Register JSON functions. |
| 193816 | ** functions and the virtual table implemented by this file. | 195657 | */ |
| 193817 | ****************************************************************************/ | 195658 | SQLITE_PRIVATE void sqlite3RegisterJsonFunctions(void){ |
| 193818 | 195659 | #ifndef SQLITE_OMIT_JSON | |
| 193819 | SQLITE_PRIVATE int sqlite3Json1Init(sqlite3 *db){ | 195660 | static FuncDef aJsonFunc[] = { |
| 193820 | int rc = SQLITE_OK; | 195661 | JFUNCTION(json, 1, 0, jsonRemoveFunc), |
| 193821 | unsigned int i; | 195662 | JFUNCTION(json_array, -1, 0, jsonArrayFunc), |
| 193822 | static const struct { | 195663 | JFUNCTION(json_array_length, 1, 0, jsonArrayLengthFunc), |
| 193823 | const char *zName; | 195664 | JFUNCTION(json_array_length, 2, 0, jsonArrayLengthFunc), |
| 193824 | int nArg; | 195665 | JFUNCTION(json_extract, -1, 0, jsonExtractFunc), |
| 193825 | int flag; | 195666 | JFUNCTION(->, 2, JSON_JSON, jsonExtractFunc), |
| 193826 | void (*xFunc)(sqlite3_context*,int,sqlite3_value**); | 195667 | JFUNCTION(->>, 2, JSON_SQL, jsonExtractFunc), |
| 193827 | } aFunc[] = { | 195668 | JFUNCTION(json_insert, -1, 0, jsonSetFunc), |
| 193828 | { "json", 1, 0, jsonRemoveFunc }, | 195669 | JFUNCTION(json_object, -1, 0, jsonObjectFunc), |
| 193829 | { "json_array", -1, 0, jsonArrayFunc }, | 195670 | JFUNCTION(json_patch, 2, 0, jsonPatchFunc), |
| 193830 | { "json_array_length", 1, 0, jsonArrayLengthFunc }, | 195671 | JFUNCTION(json_quote, 1, 0, jsonQuoteFunc), |
| 193831 | { "json_array_length", 2, 0, jsonArrayLengthFunc }, | 195672 | JFUNCTION(json_remove, -1, 0, jsonRemoveFunc), |
| 193832 | { "json_extract", -1, 0, jsonExtractFunc }, | 195673 | JFUNCTION(json_replace, -1, 0, jsonReplaceFunc), |
| 193833 | { "json_insert", -1, 0, jsonSetFunc }, | 195674 | JFUNCTION(json_set, -1, JSON_ISSET, jsonSetFunc), |
| 193834 | { "json_object", -1, 0, jsonObjectFunc }, | 195675 | JFUNCTION(json_type, 1, 0, jsonTypeFunc), |
| 193835 | { "json_patch", 2, 0, jsonPatchFunc }, | 195676 | JFUNCTION(json_type, 2, 0, jsonTypeFunc), |
| 193836 | { "json_quote", 1, 0, jsonQuoteFunc }, | 195677 | JFUNCTION(json_valid, 1, 0, jsonValidFunc), |
| 193837 | { "json_remove", -1, 0, jsonRemoveFunc }, | ||
| 193838 | { "json_replace", -1, 0, jsonReplaceFunc }, | ||
| 193839 | { "json_set", -1, 1, jsonSetFunc }, | ||
| 193840 | { "json_type", 1, 0, jsonTypeFunc }, | ||
| 193841 | { "json_type", 2, 0, jsonTypeFunc }, | ||
| 193842 | { "json_valid", 1, 0, jsonValidFunc }, | ||
| 193843 | |||
| 193844 | #if SQLITE_DEBUG | 195678 | #if SQLITE_DEBUG |
| 193845 | /* DEBUG and TESTING functions */ | 195679 | JFUNCTION(json_parse, 1, 0, jsonParseFunc), |
| 193846 | { "json_parse", 1, 0, jsonParseFunc }, | 195680 | JFUNCTION(json_test1, 1, 0, jsonTest1Func), |
| 193847 | { "json_test1", 1, 0, jsonTest1Func }, | 195681 | #endif |
| 193848 | #endif | 195682 | WAGGREGATE(json_group_array, 1, 0, 0, |
| 193849 | }; | 195683 | jsonArrayStep, jsonArrayFinal, jsonArrayValue, jsonGroupInverse, |
| 193850 | static const struct { | 195684 | SQLITE_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS), |
| 193851 | const char *zName; | 195685 | WAGGREGATE(json_group_object, 2, 0, 0, |
| 193852 | int nArg; | 195686 | jsonObjectStep, jsonObjectFinal, jsonObjectValue, jsonGroupInverse, |
| 193853 | void (*xStep)(sqlite3_context*,int,sqlite3_value**); | 195687 | SQLITE_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS) |
| 193854 | void (*xFinal)(sqlite3_context*); | ||
| 193855 | void (*xValue)(sqlite3_context*); | ||
| 193856 | } aAgg[] = { | ||
| 193857 | { "json_group_array", 1, | ||
| 193858 | jsonArrayStep, jsonArrayFinal, jsonArrayValue }, | ||
| 193859 | { "json_group_object", 2, | ||
| 193860 | jsonObjectStep, jsonObjectFinal, jsonObjectValue }, | ||
| 193861 | }; | 195688 | }; |
| 193862 | #ifndef SQLITE_OMIT_VIRTUALTABLE | 195689 | sqlite3InsertBuiltinFuncs(aJsonFunc, ArraySize(aJsonFunc)); |
| 195690 | #endif | ||
| 195691 | } | ||
| 195692 | |||
| 195693 | #if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON) | ||
| 195694 | /* | ||
| 195695 | ** Register the JSON table-valued functions | ||
| 195696 | */ | ||
| 195697 | SQLITE_PRIVATE int sqlite3JsonTableFunctions(sqlite3 *db){ | ||
| 195698 | int rc = SQLITE_OK; | ||
| 193863 | static const struct { | 195699 | static const struct { |
| 193864 | const char *zName; | 195700 | const char *zName; |
| 193865 | sqlite3_module *pModule; | 195701 | sqlite3_module *pModule; |
| 193866 | } aMod[] = { | 195702 | } aMod[] = { |
| 193867 | { "json_each", &jsonEachModule }, | 195703 | { "json_each", &jsonEachModule }, |
| 193868 | { "json_tree", &jsonTreeModule }, | 195704 | { "json_tree", &jsonTreeModule }, |
| 193869 | }; | 195705 | }; |
| 193870 | #endif | 195706 | unsigned int i; |
| 193871 | static const int enc = | ||
| 193872 | SQLITE_UTF8 | | ||
| 193873 | SQLITE_DETERMINISTIC | | ||
| 193874 | SQLITE_INNOCUOUS; | ||
| 193875 | for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){ | ||
| 193876 | rc = sqlite3_create_function(db, aFunc[i].zName, aFunc[i].nArg, enc, | ||
| 193877 | (void*)&aFunc[i].flag, | ||
| 193878 | aFunc[i].xFunc, 0, 0); | ||
| 193879 | } | ||
| 193880 | #ifndef SQLITE_OMIT_WINDOWFUNC | ||
| 193881 | for(i=0; i<sizeof(aAgg)/sizeof(aAgg[0]) && rc==SQLITE_OK; i++){ | ||
| 193882 | rc = sqlite3_create_window_function(db, aAgg[i].zName, aAgg[i].nArg, | ||
| 193883 | SQLITE_SUBTYPE | enc, 0, | ||
| 193884 | aAgg[i].xStep, aAgg[i].xFinal, | ||
| 193885 | aAgg[i].xValue, jsonGroupInverse, 0); | ||
| 193886 | } | ||
| 193887 | #endif | ||
| 193888 | #ifndef SQLITE_OMIT_VIRTUALTABLE | ||
| 193889 | for(i=0; i<sizeof(aMod)/sizeof(aMod[0]) && rc==SQLITE_OK; i++){ | 195707 | for(i=0; i<sizeof(aMod)/sizeof(aMod[0]) && rc==SQLITE_OK; i++){ |
| 193890 | rc = sqlite3_create_module(db, aMod[i].zName, aMod[i].pModule, 0); | 195708 | rc = sqlite3_create_module(db, aMod[i].zName, aMod[i].pModule, 0); |
| 193891 | } | 195709 | } |
| 193892 | #endif | ||
| 193893 | return rc; | 195710 | return rc; |
| 193894 | } | 195711 | } |
| 195712 | #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON) */ | ||
| 193895 | 195713 | ||
| 193896 | 195714 | /************** End of json.c ************************************************/ | |
| 193897 | #ifndef SQLITE_CORE | ||
| 193898 | #ifdef _WIN32 | ||
| 193899 | __declspec(dllexport) | ||
| 193900 | #endif | ||
| 193901 | SQLITE_API int sqlite3_json_init( | ||
| 193902 | sqlite3 *db, | ||
| 193903 | char **pzErrMsg, | ||
| 193904 | const sqlite3_api_routines *pApi | ||
| 193905 | ){ | ||
| 193906 | SQLITE_EXTENSION_INIT2(pApi); | ||
| 193907 | (void)pzErrMsg; /* Unused parameter */ | ||
| 193908 | return sqlite3Json1Init(db); | ||
| 193909 | } | ||
| 193910 | #endif | ||
| 193911 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_JSON1) */ | ||
| 193912 | |||
| 193913 | /************** End of json1.c ***********************************************/ | ||
| 193914 | /************** Begin file rtree.c *******************************************/ | 195715 | /************** Begin file rtree.c *******************************************/ |
| 193915 | /* | 195716 | /* |
| 193916 | ** 2001 September 15 | 195717 | ** 2001 September 15 |
| @@ -198344,11 +200145,7 @@ static void rtreecheck( | |||
| 198344 | # define GEODEBUG(X) | 200145 | # define GEODEBUG(X) |
| 198345 | #endif | 200146 | #endif |
| 198346 | 200147 | ||
| 198347 | #ifndef JSON_NULL /* The following stuff repeats things found in json1 */ | 200148 | /* Character class routines */ |
| 198348 | /* | ||
| 198349 | ** Versions of isspace(), isalnum() and isdigit() to which it is safe | ||
| 198350 | ** to pass signed char values. | ||
| 198351 | */ | ||
| 198352 | #ifdef sqlite3Isdigit | 200149 | #ifdef sqlite3Isdigit |
| 198353 | /* Use the SQLite core versions if this routine is part of the | 200150 | /* Use the SQLite core versions if this routine is part of the |
| 198354 | ** SQLite amalgamation */ | 200151 | ** SQLite amalgamation */ |
| @@ -198363,6 +200160,7 @@ static void rtreecheck( | |||
| 198363 | # define safe_isxdigit(x) isxdigit((unsigned char)(x)) | 200160 | # define safe_isxdigit(x) isxdigit((unsigned char)(x)) |
| 198364 | #endif | 200161 | #endif |
| 198365 | 200162 | ||
| 200163 | #ifndef JSON_NULL /* The following stuff repeats things found in json1 */ | ||
| 198366 | /* | 200164 | /* |
| 198367 | ** Growing our own isspace() routine this way is twice as fast as | 200165 | ** Growing our own isspace() routine this way is twice as fast as |
| 198368 | ** the library isspace() function. | 200166 | ** the library isspace() function. |
| @@ -198385,7 +200183,7 @@ static const char geopolyIsSpace[] = { | |||
| 198385 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 200183 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 198386 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | 200184 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 198387 | }; | 200185 | }; |
| 198388 | #define safe_isspace(x) (geopolyIsSpace[(unsigned char)x]) | 200186 | #define fast_isspace(x) (geopolyIsSpace[(unsigned char)x]) |
| 198389 | #endif /* JSON NULL - back to original code */ | 200187 | #endif /* JSON NULL - back to original code */ |
| 198390 | 200188 | ||
| 198391 | /* Compiler and version */ | 200189 | /* Compiler and version */ |
| @@ -198474,7 +200272,7 @@ static void geopolySwab32(unsigned char *a){ | |||
| 198474 | 200272 | ||
| 198475 | /* Skip whitespace. Return the next non-whitespace character. */ | 200273 | /* Skip whitespace. Return the next non-whitespace character. */ |
| 198476 | static char geopolySkipSpace(GeoParse *p){ | 200274 | static char geopolySkipSpace(GeoParse *p){ |
| 198477 | while( safe_isspace(p->z[0]) ) p->z++; | 200275 | while( fast_isspace(p->z[0]) ) p->z++; |
| 198478 | return p->z[0]; | 200276 | return p->z[0]; |
| 198479 | } | 200277 | } |
| 198480 | 200278 | ||
| @@ -203314,7 +205112,7 @@ static char *rbuVacuumTableStart( | |||
| 203314 | ** the caller has to use an OFFSET clause to extract only the required | 205112 | ** the caller has to use an OFFSET clause to extract only the required |
| 203315 | ** rows from the sourct table, just as it does for an RBU update operation. | 205113 | ** rows from the sourct table, just as it does for an RBU update operation. |
| 203316 | */ | 205114 | */ |
| 203317 | char *rbuVacuumIndexStart( | 205115 | static char *rbuVacuumIndexStart( |
| 203318 | sqlite3rbu *p, /* RBU handle */ | 205116 | sqlite3rbu *p, /* RBU handle */ |
| 203319 | RbuObjIter *pIter /* RBU iterator object */ | 205117 | RbuObjIter *pIter /* RBU iterator object */ |
| 203320 | ){ | 205118 | ){ |
| @@ -228454,7 +230252,7 @@ static int sqlite3Fts5IndexQuery( | |||
| 228454 | if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){ | 230252 | if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){ |
| 228455 | int iIdx = 0; /* Index to search */ | 230253 | int iIdx = 0; /* Index to search */ |
| 228456 | int iPrefixIdx = 0; /* +1 prefix index */ | 230254 | int iPrefixIdx = 0; /* +1 prefix index */ |
| 228457 | if( nToken ) memcpy(&buf.p[1], pToken, nToken); | 230255 | if( nToken>0 ) memcpy(&buf.p[1], pToken, nToken); |
| 228458 | 230256 | ||
| 228459 | /* Figure out which index to search and set iIdx accordingly. If this | 230257 | /* Figure out which index to search and set iIdx accordingly. If this |
| 228460 | ** is a prefix query for which there is no prefix index, set iIdx to | 230258 | ** is a prefix query for which there is no prefix index, set iIdx to |
| @@ -232502,7 +234300,7 @@ static void fts5SourceIdFunc( | |||
| 232502 | ){ | 234300 | ){ |
| 232503 | assert( nArg==0 ); | 234301 | assert( nArg==0 ); |
| 232504 | UNUSED_PARAM2(nArg, apUnused); | 234302 | UNUSED_PARAM2(nArg, apUnused); |
| 232505 | sqlite3_result_text(pCtx, "fts5: 2021-12-30 15:30:28 378629bf2ea546f73eee84063c5358439a12f7300e433f18c9e1bddd948dea62", -1, SQLITE_TRANSIENT); | 234303 | sqlite3_result_text(pCtx, "fts5: 2022-02-22 18:58:40 40fa792d359f84c3b9e9d6623743e1a59826274e221df1bde8f47086968a1bab", -1, SQLITE_TRANSIENT); |
| 232506 | } | 234304 | } |
| 232507 | 234305 | ||
| 232508 | /* | 234306 | /* |
diff --git a/c/sqlite3.h b/c/sqlite3.h index 393e9d2..34636b9 100644 --- a/c/sqlite3.h +++ b/c/sqlite3.h | |||
| @@ -146,9 +146,9 @@ extern "C" { | |||
| 146 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], | 146 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 147 | ** [sqlite_version()] and [sqlite_source_id()]. | 147 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 148 | */ | 148 | */ |
| 149 | #define SQLITE_VERSION "3.37.1" | 149 | #define SQLITE_VERSION "3.38.0" |
| 150 | #define SQLITE_VERSION_NUMBER 3037001 | 150 | #define SQLITE_VERSION_NUMBER 3038000 |
| 151 | #define SQLITE_SOURCE_ID "2021-12-30 15:30:28 378629bf2ea546f73eee84063c5358439a12f7300e433f18c9e1bddd948dea62" | 151 | #define SQLITE_SOURCE_ID "2022-02-22 18:58:40 40fa792d359f84c3b9e9d6623743e1a59826274e221df1bde8f47086968a1bab" |
| 152 | 152 | ||
| 153 | /* | 153 | /* |
| 154 | ** CAPI3REF: Run-Time Library Version Numbers | 154 | ** CAPI3REF: Run-Time Library Version Numbers |
| @@ -566,7 +566,7 @@ SQLITE_API int sqlite3_exec( | |||
| 566 | #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) | 566 | #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) |
| 567 | #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8)) | 567 | #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8)) |
| 568 | #define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8)) | 568 | #define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8)) |
| 569 | #define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8)) | 569 | #define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8)) /* internal use only */ |
| 570 | 570 | ||
| 571 | /* | 571 | /* |
| 572 | ** CAPI3REF: Flags For File Open Operations | 572 | ** CAPI3REF: Flags For File Open Operations |
| @@ -3824,13 +3824,14 @@ SQLITE_API void sqlite3_free_filename(char*); | |||
| 3824 | ** sqlite3_extended_errcode() might change with each API call. | 3824 | ** sqlite3_extended_errcode() might change with each API call. |
| 3825 | ** Except, there are some interfaces that are guaranteed to never | 3825 | ** Except, there are some interfaces that are guaranteed to never |
| 3826 | ** change the value of the error code. The error-code preserving | 3826 | ** change the value of the error code. The error-code preserving |
| 3827 | ** interfaces are: | 3827 | ** interfaces include the following: |
| 3828 | ** | 3828 | ** |
| 3829 | ** <ul> | 3829 | ** <ul> |
| 3830 | ** <li> sqlite3_errcode() | 3830 | ** <li> sqlite3_errcode() |
| 3831 | ** <li> sqlite3_extended_errcode() | 3831 | ** <li> sqlite3_extended_errcode() |
| 3832 | ** <li> sqlite3_errmsg() | 3832 | ** <li> sqlite3_errmsg() |
| 3833 | ** <li> sqlite3_errmsg16() | 3833 | ** <li> sqlite3_errmsg16() |
| 3834 | ** <li> sqlite3_error_offset() | ||
| 3834 | ** </ul> | 3835 | ** </ul> |
| 3835 | ** | 3836 | ** |
| 3836 | ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language | 3837 | ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language |
| @@ -3845,6 +3846,13 @@ SQLITE_API void sqlite3_free_filename(char*); | |||
| 3845 | ** ^(Memory to hold the error message string is managed internally | 3846 | ** ^(Memory to hold the error message string is managed internally |
| 3846 | ** and must not be freed by the application)^. | 3847 | ** and must not be freed by the application)^. |
| 3847 | ** | 3848 | ** |
| 3849 | ** ^If the most recent error references a specific token in the input | ||
| 3850 | ** SQL, the sqlite3_error_offset() interface returns the byte offset | ||
| 3851 | ** of the start of that token. ^The byte offset returned by | ||
| 3852 | ** sqlite3_error_offset() assumes that the input SQL is UTF8. | ||
| 3853 | ** ^If the most recent error does not reference a specific token in the input | ||
| 3854 | ** SQL, then the sqlite3_error_offset() function returns -1. | ||
| 3855 | ** | ||
| 3848 | ** When the serialized [threading mode] is in use, it might be the | 3856 | ** When the serialized [threading mode] is in use, it might be the |
| 3849 | ** case that a second error occurs on a separate thread in between | 3857 | ** case that a second error occurs on a separate thread in between |
| 3850 | ** the time of the first error and the call to these interfaces. | 3858 | ** the time of the first error and the call to these interfaces. |
| @@ -3864,6 +3872,7 @@ SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); | |||
| 3864 | SQLITE_API const char *sqlite3_errmsg(sqlite3*); | 3872 | SQLITE_API const char *sqlite3_errmsg(sqlite3*); |
| 3865 | SQLITE_API const void *sqlite3_errmsg16(sqlite3*); | 3873 | SQLITE_API const void *sqlite3_errmsg16(sqlite3*); |
| 3866 | SQLITE_API const char *sqlite3_errstr(int); | 3874 | SQLITE_API const char *sqlite3_errstr(int); |
| 3875 | SQLITE_API int sqlite3_error_offset(sqlite3 *db); | ||
| 3867 | 3876 | ||
| 3868 | /* | 3877 | /* |
| 3869 | ** CAPI3REF: Prepared Statement Object | 3878 | ** CAPI3REF: Prepared Statement Object |
| @@ -4275,6 +4284,10 @@ SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt); | |||
| 4275 | ** be false. ^Similarly, a CREATE TABLE IF NOT EXISTS statement is a | 4284 | ** be false. ^Similarly, a CREATE TABLE IF NOT EXISTS statement is a |
| 4276 | ** read-only no-op if the table already exists, but | 4285 | ** read-only no-op if the table already exists, but |
| 4277 | ** sqlite3_stmt_readonly() still returns false for such a statement. | 4286 | ** sqlite3_stmt_readonly() still returns false for such a statement. |
| 4287 | ** | ||
| 4288 | ** ^If prepared statement X is an [EXPLAIN] or [EXPLAIN QUERY PLAN] | ||
| 4289 | ** statement, then sqlite3_stmt_readonly(X) returns the same value as | ||
| 4290 | ** if the EXPLAIN or EXPLAIN QUERY PLAN prefix were omitted. | ||
| 4278 | */ | 4291 | */ |
| 4279 | SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); | 4292 | SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); |
| 4280 | 4293 | ||
| @@ -4343,6 +4356,8 @@ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*); | |||
| 4343 | ** | 4356 | ** |
| 4344 | ** ^The sqlite3_value objects that are passed as parameters into the | 4357 | ** ^The sqlite3_value objects that are passed as parameters into the |
| 4345 | ** implementation of [application-defined SQL functions] are protected. | 4358 | ** implementation of [application-defined SQL functions] are protected. |
| 4359 | ** ^The sqlite3_value objects returned by [sqlite3_vtab_rhs_value()] | ||
| 4360 | ** are protected. | ||
| 4346 | ** ^The sqlite3_value object returned by | 4361 | ** ^The sqlite3_value object returned by |
| 4347 | ** [sqlite3_column_value()] is unprotected. | 4362 | ** [sqlite3_column_value()] is unprotected. |
| 4348 | ** Unprotected sqlite3_value objects may only be used as arguments | 4363 | ** Unprotected sqlite3_value objects may only be used as arguments |
| @@ -7122,24 +7137,56 @@ struct sqlite3_index_info { | |||
| 7122 | ** | 7137 | ** |
| 7123 | ** These macros define the allowed values for the | 7138 | ** These macros define the allowed values for the |
| 7124 | ** [sqlite3_index_info].aConstraint[].op field. Each value represents | 7139 | ** [sqlite3_index_info].aConstraint[].op field. Each value represents |
| 7125 | ** an operator that is part of a constraint term in the wHERE clause of | 7140 | ** an operator that is part of a constraint term in the WHERE clause of |
| 7126 | ** a query that uses a [virtual table]. | 7141 | ** a query that uses a [virtual table]. |
| 7127 | */ | 7142 | ** |
| 7128 | #define SQLITE_INDEX_CONSTRAINT_EQ 2 | 7143 | ** ^The left-hand operand of the operator is given by the corresponding |
| 7129 | #define SQLITE_INDEX_CONSTRAINT_GT 4 | 7144 | ** aConstraint[].iColumn field. ^An iColumn of -1 indicates the left-hand |
| 7130 | #define SQLITE_INDEX_CONSTRAINT_LE 8 | 7145 | ** operand is the rowid. |
| 7131 | #define SQLITE_INDEX_CONSTRAINT_LT 16 | 7146 | ** The SQLITE_INDEX_CONSTRAINT_LIMIT and SQLITE_INDEX_CONSTRAINT_OFFSET |
| 7132 | #define SQLITE_INDEX_CONSTRAINT_GE 32 | 7147 | ** operators have no left-hand operand, and so for those operators the |
| 7133 | #define SQLITE_INDEX_CONSTRAINT_MATCH 64 | 7148 | ** corresponding aConstraint[].iColumn is meaningless and should not be |
| 7134 | #define SQLITE_INDEX_CONSTRAINT_LIKE 65 | 7149 | ** used. |
| 7135 | #define SQLITE_INDEX_CONSTRAINT_GLOB 66 | 7150 | ** |
| 7136 | #define SQLITE_INDEX_CONSTRAINT_REGEXP 67 | 7151 | ** All operator values from SQLITE_INDEX_CONSTRAINT_FUNCTION through |
| 7137 | #define SQLITE_INDEX_CONSTRAINT_NE 68 | 7152 | ** value 255 are reserved to represent functions that are overloaded |
| 7138 | #define SQLITE_INDEX_CONSTRAINT_ISNOT 69 | 7153 | ** by the [xFindFunction|xFindFunction method] of the virtual table |
| 7139 | #define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70 | 7154 | ** implementation. |
| 7140 | #define SQLITE_INDEX_CONSTRAINT_ISNULL 71 | 7155 | ** |
| 7141 | #define SQLITE_INDEX_CONSTRAINT_IS 72 | 7156 | ** The right-hand operands for each constraint might be accessible using |
| 7142 | #define SQLITE_INDEX_CONSTRAINT_FUNCTION 150 | 7157 | ** the [sqlite3_vtab_rhs_value()] interface. Usually the right-hand |
| 7158 | ** operand is only available if it appears as a single constant literal | ||
| 7159 | ** in the input SQL. If the right-hand operand is another column or an | ||
| 7160 | ** expression (even a constant expression) or a parameter, then the | ||
| 7161 | ** sqlite3_vtab_rhs_value() probably will not be able to extract it. | ||
| 7162 | ** ^The SQLITE_INDEX_CONSTRAINT_ISNULL and | ||
| 7163 | ** SQLITE_INDEX_CONSTRAINT_ISNOTNULL operators have no right-hand operand | ||
| 7164 | ** and hence calls to sqlite3_vtab_rhs_value() for those operators will | ||
| 7165 | ** always return SQLITE_NOTFOUND. | ||
| 7166 | ** | ||
| 7167 | ** The collating sequence to be used for comparison can be found using | ||
| 7168 | ** the [sqlite3_vtab_collation()] interface. For most real-world virtual | ||
| 7169 | ** tables, the collating sequence of constraints does not matter (for example | ||
| 7170 | ** because the constraints are numeric) and so the sqlite3_vtab_collation() | ||
| 7171 | ** interface is no commonly needed. | ||
| 7172 | */ | ||
| 7173 | #define SQLITE_INDEX_CONSTRAINT_EQ 2 | ||
| 7174 | #define SQLITE_INDEX_CONSTRAINT_GT 4 | ||
| 7175 | #define SQLITE_INDEX_CONSTRAINT_LE 8 | ||
| 7176 | #define SQLITE_INDEX_CONSTRAINT_LT 16 | ||
| 7177 | #define SQLITE_INDEX_CONSTRAINT_GE 32 | ||
| 7178 | #define SQLITE_INDEX_CONSTRAINT_MATCH 64 | ||
| 7179 | #define SQLITE_INDEX_CONSTRAINT_LIKE 65 | ||
| 7180 | #define SQLITE_INDEX_CONSTRAINT_GLOB 66 | ||
| 7181 | #define SQLITE_INDEX_CONSTRAINT_REGEXP 67 | ||
| 7182 | #define SQLITE_INDEX_CONSTRAINT_NE 68 | ||
| 7183 | #define SQLITE_INDEX_CONSTRAINT_ISNOT 69 | ||
| 7184 | #define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70 | ||
| 7185 | #define SQLITE_INDEX_CONSTRAINT_ISNULL 71 | ||
| 7186 | #define SQLITE_INDEX_CONSTRAINT_IS 72 | ||
| 7187 | #define SQLITE_INDEX_CONSTRAINT_LIMIT 73 | ||
| 7188 | #define SQLITE_INDEX_CONSTRAINT_OFFSET 74 | ||
| 7189 | #define SQLITE_INDEX_CONSTRAINT_FUNCTION 150 | ||
| 7143 | 7190 | ||
| 7144 | /* | 7191 | /* |
| 7145 | ** CAPI3REF: Register A Virtual Table Implementation | 7192 | ** CAPI3REF: Register A Virtual Table Implementation |
| @@ -7168,7 +7215,7 @@ struct sqlite3_index_info { | |||
| 7168 | ** destructor. | 7215 | ** destructor. |
| 7169 | ** | 7216 | ** |
| 7170 | ** ^If the third parameter (the pointer to the sqlite3_module object) is | 7217 | ** ^If the third parameter (the pointer to the sqlite3_module object) is |
| 7171 | ** NULL then no new module is create and any existing modules with the | 7218 | ** NULL then no new module is created and any existing modules with the |
| 7172 | ** same name are dropped. | 7219 | ** same name are dropped. |
| 7173 | ** | 7220 | ** |
| 7174 | ** See also: [sqlite3_drop_modules()] | 7221 | ** See also: [sqlite3_drop_modules()] |
| @@ -7944,7 +7991,8 @@ SQLITE_API int sqlite3_test_control(int op, ...); | |||
| 7944 | #define SQLITE_TESTCTRL_SEEK_COUNT 30 | 7991 | #define SQLITE_TESTCTRL_SEEK_COUNT 30 |
| 7945 | #define SQLITE_TESTCTRL_TRACEFLAGS 31 | 7992 | #define SQLITE_TESTCTRL_TRACEFLAGS 31 |
| 7946 | #define SQLITE_TESTCTRL_TUNE 32 | 7993 | #define SQLITE_TESTCTRL_TUNE 32 |
| 7947 | #define SQLITE_TESTCTRL_LAST 32 /* Largest TESTCTRL */ | 7994 | #define SQLITE_TESTCTRL_LOGEST 33 |
| 7995 | #define SQLITE_TESTCTRL_LAST 33 /* Largest TESTCTRL */ | ||
| 7948 | 7996 | ||
| 7949 | /* | 7997 | /* |
| 7950 | ** CAPI3REF: SQL Keyword Checking | 7998 | ** CAPI3REF: SQL Keyword Checking |
| @@ -8467,6 +8515,16 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); | |||
| 8467 | ** The counter is incremented on the first [sqlite3_step()] call of each | 8515 | ** The counter is incremented on the first [sqlite3_step()] call of each |
| 8468 | ** cycle. | 8516 | ** cycle. |
| 8469 | ** | 8517 | ** |
| 8518 | ** [[SQLITE_STMTSTATUS_FILTER_MISS]] | ||
| 8519 | ** [[SQLITE_STMTSTATUS_FILTER HIT]] | ||
| 8520 | ** <dt>SQLITE_STMTSTATUS_FILTER_HIT<br> | ||
| 8521 | ** SQLITE_STMTSTATUS_FILTER_MISS</dt> | ||
| 8522 | ** <dd>^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join | ||
| 8523 | ** step was bypassed because a Bloom filter returned not-found. The | ||
| 8524 | ** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of | ||
| 8525 | ** times that the Bloom filter returned a find, and thus the join step | ||
| 8526 | ** had to be processed as normal. | ||
| 8527 | ** | ||
| 8470 | ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt> | 8528 | ** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt> |
| 8471 | ** <dd>^This is the approximate number of bytes of heap memory | 8529 | ** <dd>^This is the approximate number of bytes of heap memory |
| 8472 | ** used to store the prepared statement. ^This value is not actually | 8530 | ** used to store the prepared statement. ^This value is not actually |
| @@ -8481,6 +8539,8 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); | |||
| 8481 | #define SQLITE_STMTSTATUS_VM_STEP 4 | 8539 | #define SQLITE_STMTSTATUS_VM_STEP 4 |
| 8482 | #define SQLITE_STMTSTATUS_REPREPARE 5 | 8540 | #define SQLITE_STMTSTATUS_REPREPARE 5 |
| 8483 | #define SQLITE_STMTSTATUS_RUN 6 | 8541 | #define SQLITE_STMTSTATUS_RUN 6 |
| 8542 | #define SQLITE_STMTSTATUS_FILTER_MISS 7 | ||
| 8543 | #define SQLITE_STMTSTATUS_FILTER_HIT 8 | ||
| 8484 | #define SQLITE_STMTSTATUS_MEMUSED 99 | 8544 | #define SQLITE_STMTSTATUS_MEMUSED 99 |
| 8485 | 8545 | ||
| 8486 | /* | 8546 | /* |
| @@ -9449,20 +9509,270 @@ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*); | |||
| 9449 | 9509 | ||
| 9450 | /* | 9510 | /* |
| 9451 | ** CAPI3REF: Determine The Collation For a Virtual Table Constraint | 9511 | ** CAPI3REF: Determine The Collation For a Virtual Table Constraint |
| 9512 | ** METHOD: sqlite3_index_info | ||
| 9452 | ** | 9513 | ** |
| 9453 | ** This function may only be called from within a call to the [xBestIndex] | 9514 | ** This function may only be called from within a call to the [xBestIndex] |
| 9454 | ** method of a [virtual table]. | 9515 | ** method of a [virtual table]. This function returns a pointer to a string |
| 9516 | ** that is the name of the appropriate collation sequence to use for text | ||
| 9517 | ** comparisons on the constraint identified by its arguments. | ||
| 9455 | ** | 9518 | ** |
| 9456 | ** The first argument must be the sqlite3_index_info object that is the | 9519 | ** The first argument must be the pointer to the [sqlite3_index_info] object |
| 9457 | ** first parameter to the xBestIndex() method. The second argument must be | 9520 | ** that is the first parameter to the xBestIndex() method. The second argument |
| 9458 | ** an index into the aConstraint[] array belonging to the sqlite3_index_info | 9521 | ** must be an index into the aConstraint[] array belonging to the |
| 9459 | ** structure passed to xBestIndex. This function returns a pointer to a buffer | 9522 | ** sqlite3_index_info structure passed to xBestIndex. |
| 9460 | ** containing the name of the collation sequence for the corresponding | 9523 | ** |
| 9461 | ** constraint. | 9524 | ** Important: |
| 9525 | ** The first parameter must be the same pointer that is passed into the | ||
| 9526 | ** xBestMethod() method. The first parameter may not be a pointer to a | ||
| 9527 | ** different [sqlite3_index_info] object, even an exact copy. | ||
| 9528 | ** | ||
| 9529 | ** The return value is computed as follows: | ||
| 9530 | ** | ||
| 9531 | ** <ol> | ||
| 9532 | ** <li><p> If the constraint comes from a WHERE clause expression that contains | ||
| 9533 | ** a [COLLATE operator], then the name of the collation specified by | ||
| 9534 | ** that COLLATE operator is returned. | ||
| 9535 | ** <li><p> If there is no COLLATE operator, but the column that is the subject | ||
| 9536 | ** of the constraint specifies an alternative collating sequence via | ||
| 9537 | ** a [COLLATE clause] on the column definition within the CREATE TABLE | ||
| 9538 | ** statement that was passed into [sqlite3_declare_vtab()], then the | ||
| 9539 | ** name of that alternative collating sequence is returned. | ||
| 9540 | ** <li><p> Otherwise, "BINARY" is returned. | ||
| 9541 | ** </ol> | ||
| 9462 | */ | 9542 | */ |
| 9463 | SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int); | 9543 | SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int); |
| 9464 | 9544 | ||
| 9465 | /* | 9545 | /* |
| 9546 | ** CAPI3REF: Determine if a virtual table query is DISTINCT | ||
| 9547 | ** METHOD: sqlite3_index_info | ||
| 9548 | ** | ||
| 9549 | ** This API may only be used from within an [xBestIndex|xBestIndex method] | ||
| 9550 | ** of a [virtual table] implementation. The result of calling this | ||
| 9551 | ** interface from outside of xBestIndex() is undefined and probably harmful. | ||
| 9552 | ** | ||
| 9553 | ** ^The sqlite3_vtab_distinct() interface returns an integer that is | ||
| 9554 | ** either 0, 1, or 2. The integer returned by sqlite3_vtab_distinct() | ||
| 9555 | ** gives the virtual table additional information about how the query | ||
| 9556 | ** planner wants the output to be ordered. As long as the virtual table | ||
| 9557 | ** can meet the ordering requirements of the query planner, it may set | ||
| 9558 | ** the "orderByConsumed" flag. | ||
| 9559 | ** | ||
| 9560 | ** <ol><li value="0"><p> | ||
| 9561 | ** ^If the sqlite3_vtab_distinct() interface returns 0, that means | ||
| 9562 | ** that the query planner needs the virtual table to return all rows in the | ||
| 9563 | ** sort order defined by the "nOrderBy" and "aOrderBy" fields of the | ||
| 9564 | ** [sqlite3_index_info] object. This is the default expectation. If the | ||
| 9565 | ** virtual table outputs all rows in sorted order, then it is always safe for | ||
| 9566 | ** the xBestIndex method to set the "orderByConsumed" flag, regardless of | ||
| 9567 | ** the return value from sqlite3_vtab_distinct(). | ||
| 9568 | ** <li value="1"><p> | ||
| 9569 | ** ^(If the sqlite3_vtab_distinct() interface returns 1, that means | ||
| 9570 | ** that the query planner does not need the rows to be returned in sorted order | ||
| 9571 | ** as long as all rows with the same values in all columns identified by the | ||
| 9572 | ** "aOrderBy" field are adjacent.)^ This mode is used when the query planner | ||
| 9573 | ** is doing a GROUP BY. | ||
| 9574 | ** <li value="2"><p> | ||
| 9575 | ** ^(If the sqlite3_vtab_distinct() interface returns 2, that means | ||
| 9576 | ** that the query planner does not need the rows returned in any particular | ||
| 9577 | ** order, as long as rows with the same values in all "aOrderBy" columns | ||
| 9578 | ** are adjacent.)^ ^(Furthermore, only a single row for each particular | ||
| 9579 | ** combination of values in the columns identified by the "aOrderBy" field | ||
| 9580 | ** needs to be returned.)^ ^It is always ok for two or more rows with the same | ||
| 9581 | ** values in all "aOrderBy" columns to be returned, as long as all such rows | ||
| 9582 | ** are adjacent. ^The virtual table may, if it chooses, omit extra rows | ||
| 9583 | ** that have the same value for all columns identified by "aOrderBy". | ||
| 9584 | ** ^However omitting the extra rows is optional. | ||
| 9585 | ** This mode is used for a DISTINCT query. | ||
| 9586 | ** </ol> | ||
| 9587 | ** | ||
| 9588 | ** ^For the purposes of comparing virtual table output values to see if the | ||
| 9589 | ** values are same value for sorting purposes, two NULL values are considered | ||
| 9590 | ** to be the same. In other words, the comparison operator is "IS" | ||
| 9591 | ** (or "IS NOT DISTINCT FROM") and not "==". | ||
| 9592 | ** | ||
| 9593 | ** If a virtual table implementation is unable to meet the requirements | ||
| 9594 | ** specified above, then it must not set the "orderByConsumed" flag in the | ||
| 9595 | ** [sqlite3_index_info] object or an incorrect answer may result. | ||
| 9596 | ** | ||
| 9597 | ** ^A virtual table implementation is always free to return rows in any order | ||
| 9598 | ** it wants, as long as the "orderByConsumed" flag is not set. ^When the | ||
| 9599 | ** the "orderByConsumed" flag is unset, the query planner will add extra | ||
| 9600 | ** [bytecode] to ensure that the final results returned by the SQL query are | ||
| 9601 | ** ordered correctly. The use of the "orderByConsumed" flag and the | ||
| 9602 | ** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful | ||
| 9603 | ** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed" | ||
| 9604 | ** flag might help queries against a virtual table to run faster. Being | ||
| 9605 | ** overly aggressive and setting the "orderByConsumed" flag when it is not | ||
| 9606 | ** valid to do so, on the other hand, might cause SQLite to return incorrect | ||
| 9607 | ** results. | ||
| 9608 | */ | ||
| 9609 | SQLITE_API int sqlite3_vtab_distinct(sqlite3_index_info*); | ||
| 9610 | |||
| 9611 | /* | ||
| 9612 | ** CAPI3REF: Identify and handle IN constraints in xBestIndex | ||
| 9613 | ** | ||
| 9614 | ** This interface may only be used from within an | ||
| 9615 | ** [xBestIndex|xBestIndex() method] of a [virtual table] implementation. | ||
| 9616 | ** The result of invoking this interface from any other context is | ||
| 9617 | ** undefined and probably harmful. | ||
| 9618 | ** | ||
| 9619 | ** ^(A constraint on a virtual table of the form | ||
| 9620 | ** "[IN operator|column IN (...)]" is | ||
| 9621 | ** communicated to the xBestIndex method as a | ||
| 9622 | ** [SQLITE_INDEX_CONSTRAINT_EQ] constraint.)^ If xBestIndex wants to use | ||
| 9623 | ** this constraint, it must set the corresponding | ||
| 9624 | ** aConstraintUsage[].argvIndex to a postive integer. ^(Then, under | ||
| 9625 | ** the usual mode of handling IN operators, SQLite generates [bytecode] | ||
| 9626 | ** that invokes the [xFilter|xFilter() method] once for each value | ||
| 9627 | ** on the right-hand side of the IN operator.)^ Thus the virtual table | ||
| 9628 | ** only sees a single value from the right-hand side of the IN operator | ||
| 9629 | ** at a time. | ||
| 9630 | ** | ||
| 9631 | ** In some cases, however, it would be advantageous for the virtual | ||
| 9632 | ** table to see all values on the right-hand of the IN operator all at | ||
| 9633 | ** once. The sqlite3_vtab_in() interfaces facilitates this in two ways: | ||
| 9634 | ** | ||
| 9635 | ** <ol> | ||
| 9636 | ** <li><p> | ||
| 9637 | ** ^A call to sqlite3_vtab_in(P,N,-1) will return true (non-zero) | ||
| 9638 | ** if and only if the [sqlite3_index_info|P->aConstraint][N] constraint | ||
| 9639 | ** is an [IN operator] that can be processed all at once. ^In other words, | ||
| 9640 | ** sqlite3_vtab_in() with -1 in the third argument is a mechanism | ||
| 9641 | ** by which the virtual table can ask SQLite if all-at-once processing | ||
| 9642 | ** of the IN operator is even possible. | ||
| 9643 | ** | ||
| 9644 | ** <li><p> | ||
| 9645 | ** ^A call to sqlite3_vtab_in(P,N,F) with F==1 or F==0 indicates | ||
| 9646 | ** to SQLite that the virtual table does or does not want to process | ||
| 9647 | ** the IN operator all-at-once, respectively. ^Thus when the third | ||
| 9648 | ** parameter (F) is non-negative, this interface is the mechanism by | ||
| 9649 | ** which the virtual table tells SQLite how it wants to process the | ||
| 9650 | ** IN operator. | ||
| 9651 | ** </ol> | ||
| 9652 | ** | ||
| 9653 | ** ^The sqlite3_vtab_in(P,N,F) interface can be invoked multiple times | ||
| 9654 | ** within the same xBestIndex method call. ^For any given P,N pair, | ||
| 9655 | ** the return value from sqlite3_vtab_in(P,N,F) will always be the same | ||
| 9656 | ** within the same xBestIndex call. ^If the interface returns true | ||
| 9657 | ** (non-zero), that means that the constraint is an IN operator | ||
| 9658 | ** that can be processed all-at-once. ^If the constraint is not an IN | ||
| 9659 | ** operator or cannot be processed all-at-once, then the interface returns | ||
| 9660 | ** false. | ||
| 9661 | ** | ||
| 9662 | ** ^(All-at-once processing of the IN operator is selected if both of the | ||
| 9663 | ** following conditions are met: | ||
| 9664 | ** | ||
| 9665 | ** <ol> | ||
| 9666 | ** <li><p> The P->aConstraintUsage[N].argvIndex value is set to a positive | ||
| 9667 | ** integer. This is how the virtual table tells SQLite that it wants to | ||
| 9668 | ** use the N-th constraint. | ||
| 9669 | ** | ||
| 9670 | ** <li><p> The last call to sqlite3_vtab_in(P,N,F) for which F was | ||
| 9671 | ** non-negative had F>=1. | ||
| 9672 | ** </ol>)^ | ||
| 9673 | ** | ||
| 9674 | ** ^If either or both of the conditions above are false, then SQLite uses | ||
| 9675 | ** the traditional one-at-a-time processing strategy for the IN constraint. | ||
| 9676 | ** ^If both conditions are true, then the argvIndex-th parameter to the | ||
| 9677 | ** xFilter method will be an [sqlite3_value] that appears to be NULL, | ||
| 9678 | ** but which can be passed to [sqlite3_vtab_in_first()] and | ||
| 9679 | ** [sqlite3_vtab_in_next()] to find all values on the right-hand side | ||
| 9680 | ** of the IN constraint. | ||
| 9681 | */ | ||
| 9682 | SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle); | ||
| 9683 | |||
| 9684 | /* | ||
| 9685 | ** CAPI3REF: Find all elements on the right-hand side of an IN constraint. | ||
| 9686 | ** | ||
| 9687 | ** These interfaces are only useful from within the | ||
| 9688 | ** [xFilter|xFilter() method] of a [virtual table] implementation. | ||
| 9689 | ** The result of invoking these interfaces from any other context | ||
| 9690 | ** is undefined and probably harmful. | ||
| 9691 | ** | ||
| 9692 | ** The X parameter in a call to sqlite3_vtab_in_first(X,P) or | ||
| 9693 | ** sqlite3_vtab_in_next(X,P) must be one of the parameters to the | ||
| 9694 | ** xFilter method which invokes these routines, and specifically | ||
| 9695 | ** a parameter that was previously selected for all-at-once IN constraint | ||
| 9696 | ** processing use the [sqlite3_vtab_in()] interface in the | ||
| 9697 | ** [xBestIndex|xBestIndex method]. ^(If the X parameter is not | ||
| 9698 | ** an xFilter argument that was selected for all-at-once IN constraint | ||
| 9699 | ** processing, then these routines return [SQLITE_MISUSE])^ or perhaps | ||
| 9700 | ** exhibit some other undefined or harmful behavior. | ||
| 9701 | ** | ||
| 9702 | ** ^(Use these routines to access all values on the right-hand side | ||
| 9703 | ** of the IN constraint using code like the following: | ||
| 9704 | ** | ||
| 9705 | ** <blockquote><pre> | ||
| 9706 | ** for(rc=sqlite3_vtab_in_first(pList, &pVal); | ||
| 9707 | ** rc==SQLITE_OK && pVal | ||
| 9708 | ** rc=sqlite3_vtab_in_next(pList, &pVal) | ||
| 9709 | ** ){ | ||
| 9710 | ** // do something with pVal | ||
| 9711 | ** } | ||
| 9712 | ** if( rc!=SQLITE_OK ){ | ||
| 9713 | ** // an error has occurred | ||
| 9714 | ** } | ||
| 9715 | ** </pre></blockquote>)^ | ||
| 9716 | ** | ||
| 9717 | ** ^On success, the sqlite3_vtab_in_first(X,P) and sqlite3_vtab_in_next(X,P) | ||
| 9718 | ** routines return SQLITE_OK and set *P to point to the first or next value | ||
| 9719 | ** on the RHS of the IN constraint. ^If there are no more values on the | ||
| 9720 | ** right hand side of the IN constraint, then *P is set to NULL and these | ||
| 9721 | ** routines return [SQLITE_DONE]. ^The return value might be | ||
| 9722 | ** some other value, such as SQLITE_NOMEM, in the event of a malfunction. | ||
| 9723 | ** | ||
| 9724 | ** The *ppOut values returned by these routines are only valid until the | ||
| 9725 | ** next call to either of these routines or until the end of the xFilter | ||
| 9726 | ** method from which these routines were called. If the virtual table | ||
| 9727 | ** implementation needs to retain the *ppOut values for longer, it must make | ||
| 9728 | ** copies. The *ppOut values are [protected sqlite3_value|protected]. | ||
| 9729 | */ | ||
| 9730 | SQLITE_API int sqlite3_vtab_in_first(sqlite3_value *pVal, sqlite3_value **ppOut); | ||
| 9731 | SQLITE_API int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut); | ||
| 9732 | |||
| 9733 | /* | ||
| 9734 | ** CAPI3REF: Constraint values in xBestIndex() | ||
| 9735 | ** METHOD: sqlite3_index_info | ||
| 9736 | ** | ||
| 9737 | ** This API may only be used from within the [xBestIndex|xBestIndex method] | ||
| 9738 | ** of a [virtual table] implementation. The result of calling this interface | ||
| 9739 | ** from outside of an xBestIndex method are undefined and probably harmful. | ||
| 9740 | ** | ||
| 9741 | ** ^When the sqlite3_vtab_rhs_value(P,J,V) interface is invoked from within | ||
| 9742 | ** the [xBestIndex] method of a [virtual table] implementation, with P being | ||
| 9743 | ** a copy of the [sqlite3_index_info] object pointer passed into xBestIndex and | ||
| 9744 | ** J being a 0-based index into P->aConstraint[], then this routine | ||
| 9745 | ** attempts to set *V to the value of the right-hand operand of | ||
| 9746 | ** that constraint if the right-hand operand is known. ^If the | ||
| 9747 | ** right-hand operand is not known, then *V is set to a NULL pointer. | ||
| 9748 | ** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if | ||
| 9749 | ** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V) | ||
| 9750 | ** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th | ||
| 9751 | ** constraint is not available. ^The sqlite3_vtab_rhs_value() interface | ||
| 9752 | ** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if | ||
| 9753 | ** something goes wrong. | ||
| 9754 | ** | ||
| 9755 | ** The sqlite3_vtab_rhs_value() interface is usually only successful if | ||
| 9756 | ** the right-hand operand of a constraint is a literal value in the original | ||
| 9757 | ** SQL statement. If the right-hand operand is an expression or a reference | ||
| 9758 | ** to some other column or a [host parameter], then sqlite3_vtab_rhs_value() | ||
| 9759 | ** will probably return [SQLITE_NOTFOUND]. | ||
| 9760 | ** | ||
| 9761 | ** ^(Some constraints, such as [SQLITE_INDEX_CONSTRAINT_ISNULL] and | ||
| 9762 | ** [SQLITE_INDEX_CONSTRAINT_ISNOTNULL], have no right-hand operand. For such | ||
| 9763 | ** constraints, sqlite3_vtab_rhs_value() always returns SQLITE_NOTFOUND.)^ | ||
| 9764 | ** | ||
| 9765 | ** ^The [sqlite3_value] object returned in *V is a protected sqlite3_value | ||
| 9766 | ** and remains valid for the duration of the xBestIndex method call. | ||
| 9767 | ** ^When xBestIndex returns, the sqlite3_value object returned by | ||
| 9768 | ** sqlite3_vtab_rhs_value() is automatically deallocated. | ||
| 9769 | ** | ||
| 9770 | ** The "_rhs_" in the name of this routine is an appreviation for | ||
| 9771 | ** "Right-Hand Side". | ||
| 9772 | */ | ||
| 9773 | SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **ppVal); | ||
| 9774 | |||
| 9775 | /* | ||
| 9466 | ** CAPI3REF: Conflict resolution modes | 9776 | ** CAPI3REF: Conflict resolution modes |
| 9467 | ** KEYWORDS: {conflict resolution mode} | 9777 | ** KEYWORDS: {conflict resolution mode} |
| 9468 | ** | 9778 | ** |