| | @@ -1,8 +1,8 @@ |
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | | -** version 3.30.0. By combining all the individual C code files into this |
| 3 | +** version 3.31.0. By combining all the individual C code files into this |
| 4 | 4 | ** single large file, the entire code can be compiled as a single translation |
| 5 | 5 | ** unit. This allows many compilers to do optimizations that would not be |
| 6 | 6 | ** possible if the files were compiled separately. Performance improvements |
| 7 | 7 | ** of 5% or more are commonly seen when SQLite is compiled as a single |
| 8 | 8 | ** translation unit. |
| | @@ -1163,13 +1163,13 @@ |
| 1163 | 1163 | ** |
| 1164 | 1164 | ** See also: [sqlite3_libversion()], |
| 1165 | 1165 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 1166 | 1166 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 1167 | 1167 | */ |
| 1168 | | -#define SQLITE_VERSION "3.30.0" |
| 1169 | | -#define SQLITE_VERSION_NUMBER 3030000 |
| 1170 | | -#define SQLITE_SOURCE_ID "2019-10-04 15:03:17 c20a35336432025445f9f7e289d0cc3e4003fb17f45a4ce74c6269c407c6e09f" |
| 1168 | +#define SQLITE_VERSION "3.31.0" |
| 1169 | +#define SQLITE_VERSION_NUMBER 3031000 |
| 1170 | +#define SQLITE_SOURCE_ID "2019-11-20 13:31:52 a0f6d526baecd061a5e2bec5eb698fb5dfb10122ac79c853d7b3f4a48bc9f49b" |
| 1171 | 1171 | |
| 1172 | 1172 | /* |
| 1173 | 1173 | ** CAPI3REF: Run-Time Library Version Numbers |
| 1174 | 1174 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 1175 | 1175 | ** |
| | @@ -1556,10 +1556,11 @@ |
| 1556 | 1556 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 1557 | 1557 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 1558 | 1558 | #define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) |
| 1559 | 1559 | #define SQLITE_CANTOPEN_CONVPATH (SQLITE_CANTOPEN | (4<<8)) |
| 1560 | 1560 | #define SQLITE_CANTOPEN_DIRTYWAL (SQLITE_CANTOPEN | (5<<8)) /* Not Used */ |
| 1561 | +#define SQLITE_CANTOPEN_SYMLINK (SQLITE_CANTOPEN | (6<<8)) |
| 1561 | 1562 | #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) |
| 1562 | 1563 | #define SQLITE_CORRUPT_SEQUENCE (SQLITE_CORRUPT | (2<<8)) |
| 1563 | 1564 | #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
| 1564 | 1565 | #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
| 1565 | 1566 | #define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8)) |
| | @@ -1608,10 +1609,11 @@ |
| 1608 | 1609 | #define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */ |
| 1609 | 1610 | #define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */ |
| 1610 | 1611 | #define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */ |
| 1611 | 1612 | #define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */ |
| 1612 | 1613 | #define SQLITE_OPEN_WAL 0x00080000 /* VFS only */ |
| 1614 | +#define SQLITE_OPEN_NOFOLLOW 0x01000000 /* Ok for sqlite3_open_v2() */ |
| 1613 | 1615 | |
| 1614 | 1616 | /* Reserved: 0x00F00000 */ |
| 1615 | 1617 | |
| 1616 | 1618 | /* |
| 1617 | 1619 | ** CAPI3REF: Device Characteristics |
| | @@ -2446,10 +2448,11 @@ |
| 2446 | 2448 | ** SQLite. |
| 2447 | 2449 | */ |
| 2448 | 2450 | #define SQLITE_ACCESS_EXISTS 0 |
| 2449 | 2451 | #define SQLITE_ACCESS_READWRITE 1 /* Used by PRAGMA temp_store_directory */ |
| 2450 | 2452 | #define SQLITE_ACCESS_READ 2 /* Unused */ |
| 2453 | +#define SQLITE_ACCESS_SYMLINK 3 /* Test if file is symbolic link */ |
| 2451 | 2454 | |
| 2452 | 2455 | /* |
| 2453 | 2456 | ** CAPI3REF: Flags for the xShmLock VFS method |
| 2454 | 2457 | ** |
| 2455 | 2458 | ** These integer constants define the various locking operations |
| | @@ -2782,10 +2785,11 @@ |
| 2782 | 2785 | ** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int, |
| 2783 | 2786 | ** interpreted as a boolean, which enables or disables the collection of |
| 2784 | 2787 | ** memory allocation statistics. ^(When memory allocation statistics are |
| 2785 | 2788 | ** disabled, the following SQLite interfaces become non-operational: |
| 2786 | 2789 | ** <ul> |
| 2790 | +** <li> [sqlite3_hard_heap_limit64()] |
| 2787 | 2791 | ** <li> [sqlite3_memory_used()] |
| 2788 | 2792 | ** <li> [sqlite3_memory_highwater()] |
| 2789 | 2793 | ** <li> [sqlite3_soft_heap_limit64()] |
| 2790 | 2794 | ** <li> [sqlite3_status64()] |
| 2791 | 2795 | ** </ul>)^ |
| | @@ -3299,10 +3303,32 @@ |
| 3299 | 3303 | ** the legacy [double-quoted string literal] misfeature for DDL statements, |
| 3300 | 3304 | ** such as CREATE TABLE and CREATE INDEX. The |
| 3301 | 3305 | ** default value of this setting is determined by the [-DSQLITE_DQS] |
| 3302 | 3306 | ** compile-time option. |
| 3303 | 3307 | ** </dd> |
| 3308 | +** |
| 3309 | +** [[SQLITE_DBCONFIG_LEGACY_FILE_FORMAT]] |
| 3310 | +** <dt>SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</td> |
| 3311 | +** <dd>The SQLITE_DBCONFIG_LEGACY_FILE_FORMAT option activates or deactivates |
| 3312 | +** the legacy file format flag. When activated, this flag causes all newly |
| 3313 | +** created database file to have a schema format version number (the 4-byte |
| 3314 | +** integer found at offset 44 into the database header) of 1. This in turn |
| 3315 | +** means that the resulting database file will be readable and writable by |
| 3316 | +** any SQLite version back to 3.0.0 ([dateof:3.0.0]). Without this setting, |
| 3317 | +** newly created databases are generally not understandable by SQLite versions |
| 3318 | +** prior to 3.3.0 ([dateof:3.3.0]). As these words are written, there |
| 3319 | +** is now scarcely any need to generated database files that are compatible |
| 3320 | +** all the way back to version 3.0.0, and so this setting is of little |
| 3321 | +** practical use, but is provided so that SQLite can continue to claim the |
| 3322 | +** ability to generate new database files that are compatible with version |
| 3323 | +** 3.0.0. |
| 3324 | +** <p>Note that when the SQLITE_DBCONFIG_LEGACY_FILE_FORMAT setting is on, |
| 3325 | +** the [VACUUM] command will fail with an obscure error when attempting to |
| 3326 | +** process a table with generated columns and a descending index. This is |
| 3327 | +** not considered a bug since SQLite versions 3.3.0 and earlier do not support |
| 3328 | +** either generated columns or decending indexes. |
| 3329 | +** </dd> |
| 3304 | 3330 | ** </dl> |
| 3305 | 3331 | */ |
| 3306 | 3332 | #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ |
| 3307 | 3333 | #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ |
| 3308 | 3334 | #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ |
| | @@ -3317,11 +3343,12 @@ |
| 3317 | 3343 | #define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 /* int int* */ |
| 3318 | 3344 | #define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 /* int int* */ |
| 3319 | 3345 | #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */ |
| 3320 | 3346 | #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */ |
| 3321 | 3347 | #define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */ |
| 3322 | | -#define SQLITE_DBCONFIG_MAX 1015 /* Largest DBCONFIG */ |
| 3348 | +#define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */ |
| 3349 | +#define SQLITE_DBCONFIG_MAX 1016 /* Largest DBCONFIG */ |
| 3323 | 3350 | |
| 3324 | 3351 | /* |
| 3325 | 3352 | ** CAPI3REF: Enable Or Disable Extended Result Codes |
| 3326 | 3353 | ** METHOD: sqlite3 |
| 3327 | 3354 | ** |
| | @@ -7155,10 +7182,13 @@ |
| 7155 | 7182 | */ |
| 7156 | 7183 | SQLITE_API int sqlite3_db_release_memory(sqlite3*); |
| 7157 | 7184 | |
| 7158 | 7185 | /* |
| 7159 | 7186 | ** CAPI3REF: Impose A Limit On Heap Size |
| 7187 | +** |
| 7188 | +** These interfaces impose limits on the amount of heap memory that will be |
| 7189 | +** by all database connections within a single process. |
| 7160 | 7190 | ** |
| 7161 | 7191 | ** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the |
| 7162 | 7192 | ** soft limit on the amount of heap memory that may be allocated by SQLite. |
| 7163 | 7193 | ** ^SQLite strives to keep heap memory utilization below the soft heap |
| 7164 | 7194 | ** limit by reducing the number of pages held in the page cache |
| | @@ -7166,24 +7196,45 @@ |
| 7166 | 7196 | ** ^The soft heap limit is "soft" because even though SQLite strives to stay |
| 7167 | 7197 | ** below the limit, it will exceed the limit rather than generate |
| 7168 | 7198 | ** an [SQLITE_NOMEM] error. In other words, the soft heap limit |
| 7169 | 7199 | ** is advisory only. |
| 7170 | 7200 | ** |
| 7171 | | -** ^The return value from sqlite3_soft_heap_limit64() is the size of |
| 7172 | | -** the soft heap limit prior to the call, or negative in the case of an |
| 7201 | +** ^The sqlite3_hard_heap_limit64(N) interface sets a hard upper bound of |
| 7202 | +** N bytes on the amount of memory that will be allocated. ^The |
| 7203 | +** sqlite3_hard_heap_limit64(N) interface is similar to |
| 7204 | +** sqlite3_soft_heap_limit64(N) except that memory allocations will fail |
| 7205 | +** when the hard heap limit is reached. |
| 7206 | +** |
| 7207 | +** ^The return value from both sqlite3_soft_heap_limit64() and |
| 7208 | +** sqlite3_hard_heap_limit64() is the size of |
| 7209 | +** the heap limit prior to the call, or negative in the case of an |
| 7173 | 7210 | ** error. ^If the argument N is negative |
| 7174 | | -** then no change is made to the soft heap limit. Hence, the current |
| 7175 | | -** size of the soft heap limit can be determined by invoking |
| 7176 | | -** sqlite3_soft_heap_limit64() with a negative argument. |
| 7211 | +** then no change is made to the heap limit. Hence, the current |
| 7212 | +** size of heap limits can be determined by invoking |
| 7213 | +** sqlite3_soft_heap_limit64(-1) or sqlite3_hard_heap_limit(-1). |
| 7177 | 7214 | ** |
| 7178 | | -** ^If the argument N is zero then the soft heap limit is disabled. |
| 7215 | +** ^Setting the heap limits to zero disables the heap limiter mechanism. |
| 7179 | 7216 | ** |
| 7180 | | -** ^(The soft heap limit is not enforced in the current implementation |
| 7217 | +** ^The soft heap limit may not be greater than the hard heap limit. |
| 7218 | +** ^If the hard heap limit is enabled and if sqlite3_soft_heap_limit(N) |
| 7219 | +** is invoked with a value of N that is greater than the hard heap limit, |
| 7220 | +** the the soft heap limit is set to the value of the hard heap limit. |
| 7221 | +** ^The soft heap limit is automatically enabled whenever the hard heap |
| 7222 | +** limit is enabled. ^When sqlite3_hard_heap_limit64(N) is invoked and |
| 7223 | +** the soft heap limit is outside the range of 1..N, then the soft heap |
| 7224 | +** limit is set to N. ^Invoking sqlite3_soft_heap_limit64(0) when the |
| 7225 | +** hard heap limit is enabled makes the soft heap limit equal to the |
| 7226 | +** hard heap limit. |
| 7227 | +** |
| 7228 | +** The memory allocation limits can also be adjusted using |
| 7229 | +** [PRAGMA soft_heap_limit] and [PRAGMA hard_heap_limit]. |
| 7230 | +** |
| 7231 | +** ^(The heap limits are not enforced in the current implementation |
| 7181 | 7232 | ** if one or more of following conditions are true: |
| 7182 | 7233 | ** |
| 7183 | 7234 | ** <ul> |
| 7184 | | -** <li> The soft heap limit is set to zero. |
| 7235 | +** <li> The limit value is set to zero. |
| 7185 | 7236 | ** <li> Memory accounting is disabled using a combination of the |
| 7186 | 7237 | ** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and |
| 7187 | 7238 | ** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option. |
| 7188 | 7239 | ** <li> An alternative page cache implementation is specified using |
| 7189 | 7240 | ** [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...). |
| | @@ -7190,25 +7241,15 @@ |
| 7190 | 7241 | ** <li> The page cache allocates from its own memory pool supplied |
| 7191 | 7242 | ** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than |
| 7192 | 7243 | ** from the heap. |
| 7193 | 7244 | ** </ul>)^ |
| 7194 | 7245 | ** |
| 7195 | | -** Beginning with SQLite [version 3.7.3] ([dateof:3.7.3]), |
| 7196 | | -** the soft heap limit is enforced |
| 7197 | | -** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT] |
| 7198 | | -** compile-time option is invoked. With [SQLITE_ENABLE_MEMORY_MANAGEMENT], |
| 7199 | | -** the soft heap limit is enforced on every memory allocation. Without |
| 7200 | | -** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced |
| 7201 | | -** when memory is allocated by the page cache. Testing suggests that because |
| 7202 | | -** the page cache is the predominate memory user in SQLite, most |
| 7203 | | -** applications will achieve adequate soft heap limit enforcement without |
| 7204 | | -** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT]. |
| 7205 | | -** |
| 7206 | | -** The circumstances under which SQLite will enforce the soft heap limit may |
| 7246 | +** The circumstances under which SQLite will enforce the heap limits may |
| 7207 | 7247 | ** changes in future releases of SQLite. |
| 7208 | 7248 | */ |
| 7209 | 7249 | SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N); |
| 7250 | +SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 N); |
| 7210 | 7251 | |
| 7211 | 7252 | /* |
| 7212 | 7253 | ** CAPI3REF: Deprecated Soft Heap Limit Interface |
| 7213 | 7254 | ** DEPRECATED |
| 7214 | 7255 | ** |
| | @@ -13671,94 +13712,96 @@ |
| 13671 | 13712 | #define TK_UNBOUNDED 90 |
| 13672 | 13713 | #define TK_EXCLUDE 91 |
| 13673 | 13714 | #define TK_GROUPS 92 |
| 13674 | 13715 | #define TK_OTHERS 93 |
| 13675 | 13716 | #define TK_TIES 94 |
| 13676 | | -#define TK_REINDEX 95 |
| 13677 | | -#define TK_RENAME 96 |
| 13678 | | -#define TK_CTIME_KW 97 |
| 13679 | | -#define TK_ANY 98 |
| 13680 | | -#define TK_BITAND 99 |
| 13681 | | -#define TK_BITOR 100 |
| 13682 | | -#define TK_LSHIFT 101 |
| 13683 | | -#define TK_RSHIFT 102 |
| 13684 | | -#define TK_PLUS 103 |
| 13685 | | -#define TK_MINUS 104 |
| 13686 | | -#define TK_STAR 105 |
| 13687 | | -#define TK_SLASH 106 |
| 13688 | | -#define TK_REM 107 |
| 13689 | | -#define TK_CONCAT 108 |
| 13690 | | -#define TK_COLLATE 109 |
| 13691 | | -#define TK_BITNOT 110 |
| 13692 | | -#define TK_ON 111 |
| 13693 | | -#define TK_INDEXED 112 |
| 13694 | | -#define TK_STRING 113 |
| 13695 | | -#define TK_JOIN_KW 114 |
| 13696 | | -#define TK_CONSTRAINT 115 |
| 13697 | | -#define TK_DEFAULT 116 |
| 13698 | | -#define TK_NULL 117 |
| 13699 | | -#define TK_PRIMARY 118 |
| 13700 | | -#define TK_UNIQUE 119 |
| 13701 | | -#define TK_CHECK 120 |
| 13702 | | -#define TK_REFERENCES 121 |
| 13703 | | -#define TK_AUTOINCR 122 |
| 13704 | | -#define TK_INSERT 123 |
| 13705 | | -#define TK_DELETE 124 |
| 13706 | | -#define TK_UPDATE 125 |
| 13707 | | -#define TK_SET 126 |
| 13708 | | -#define TK_DEFERRABLE 127 |
| 13709 | | -#define TK_FOREIGN 128 |
| 13710 | | -#define TK_DROP 129 |
| 13711 | | -#define TK_UNION 130 |
| 13712 | | -#define TK_ALL 131 |
| 13713 | | -#define TK_EXCEPT 132 |
| 13714 | | -#define TK_INTERSECT 133 |
| 13715 | | -#define TK_SELECT 134 |
| 13716 | | -#define TK_VALUES 135 |
| 13717 | | -#define TK_DISTINCT 136 |
| 13718 | | -#define TK_DOT 137 |
| 13719 | | -#define TK_FROM 138 |
| 13720 | | -#define TK_JOIN 139 |
| 13721 | | -#define TK_USING 140 |
| 13722 | | -#define TK_ORDER 141 |
| 13723 | | -#define TK_GROUP 142 |
| 13724 | | -#define TK_HAVING 143 |
| 13725 | | -#define TK_LIMIT 144 |
| 13726 | | -#define TK_WHERE 145 |
| 13727 | | -#define TK_INTO 146 |
| 13728 | | -#define TK_NOTHING 147 |
| 13729 | | -#define TK_FLOAT 148 |
| 13730 | | -#define TK_BLOB 149 |
| 13731 | | -#define TK_INTEGER 150 |
| 13732 | | -#define TK_VARIABLE 151 |
| 13733 | | -#define TK_CASE 152 |
| 13734 | | -#define TK_WHEN 153 |
| 13735 | | -#define TK_THEN 154 |
| 13736 | | -#define TK_ELSE 155 |
| 13737 | | -#define TK_INDEX 156 |
| 13738 | | -#define TK_ALTER 157 |
| 13739 | | -#define TK_ADD 158 |
| 13740 | | -#define TK_WINDOW 159 |
| 13741 | | -#define TK_OVER 160 |
| 13742 | | -#define TK_FILTER 161 |
| 13743 | | -#define TK_COLUMN 162 |
| 13744 | | -#define TK_AGG_FUNCTION 163 |
| 13745 | | -#define TK_AGG_COLUMN 164 |
| 13746 | | -#define TK_TRUEFALSE 165 |
| 13747 | | -#define TK_ISNOT 166 |
| 13748 | | -#define TK_FUNCTION 167 |
| 13749 | | -#define TK_UMINUS 168 |
| 13750 | | -#define TK_UPLUS 169 |
| 13751 | | -#define TK_TRUTH 170 |
| 13752 | | -#define TK_REGISTER 171 |
| 13753 | | -#define TK_VECTOR 172 |
| 13754 | | -#define TK_SELECT_COLUMN 173 |
| 13755 | | -#define TK_IF_NULL_ROW 174 |
| 13756 | | -#define TK_ASTERISK 175 |
| 13757 | | -#define TK_SPAN 176 |
| 13758 | | -#define TK_SPACE 177 |
| 13759 | | -#define TK_ILLEGAL 178 |
| 13717 | +#define TK_GENERATED 95 |
| 13718 | +#define TK_ALWAYS 96 |
| 13719 | +#define TK_REINDEX 97 |
| 13720 | +#define TK_RENAME 98 |
| 13721 | +#define TK_CTIME_KW 99 |
| 13722 | +#define TK_ANY 100 |
| 13723 | +#define TK_BITAND 101 |
| 13724 | +#define TK_BITOR 102 |
| 13725 | +#define TK_LSHIFT 103 |
| 13726 | +#define TK_RSHIFT 104 |
| 13727 | +#define TK_PLUS 105 |
| 13728 | +#define TK_MINUS 106 |
| 13729 | +#define TK_STAR 107 |
| 13730 | +#define TK_SLASH 108 |
| 13731 | +#define TK_REM 109 |
| 13732 | +#define TK_CONCAT 110 |
| 13733 | +#define TK_COLLATE 111 |
| 13734 | +#define TK_BITNOT 112 |
| 13735 | +#define TK_ON 113 |
| 13736 | +#define TK_INDEXED 114 |
| 13737 | +#define TK_STRING 115 |
| 13738 | +#define TK_JOIN_KW 116 |
| 13739 | +#define TK_CONSTRAINT 117 |
| 13740 | +#define TK_DEFAULT 118 |
| 13741 | +#define TK_NULL 119 |
| 13742 | +#define TK_PRIMARY 120 |
| 13743 | +#define TK_UNIQUE 121 |
| 13744 | +#define TK_CHECK 122 |
| 13745 | +#define TK_REFERENCES 123 |
| 13746 | +#define TK_AUTOINCR 124 |
| 13747 | +#define TK_INSERT 125 |
| 13748 | +#define TK_DELETE 126 |
| 13749 | +#define TK_UPDATE 127 |
| 13750 | +#define TK_SET 128 |
| 13751 | +#define TK_DEFERRABLE 129 |
| 13752 | +#define TK_FOREIGN 130 |
| 13753 | +#define TK_DROP 131 |
| 13754 | +#define TK_UNION 132 |
| 13755 | +#define TK_ALL 133 |
| 13756 | +#define TK_EXCEPT 134 |
| 13757 | +#define TK_INTERSECT 135 |
| 13758 | +#define TK_SELECT 136 |
| 13759 | +#define TK_VALUES 137 |
| 13760 | +#define TK_DISTINCT 138 |
| 13761 | +#define TK_DOT 139 |
| 13762 | +#define TK_FROM 140 |
| 13763 | +#define TK_JOIN 141 |
| 13764 | +#define TK_USING 142 |
| 13765 | +#define TK_ORDER 143 |
| 13766 | +#define TK_GROUP 144 |
| 13767 | +#define TK_HAVING 145 |
| 13768 | +#define TK_LIMIT 146 |
| 13769 | +#define TK_WHERE 147 |
| 13770 | +#define TK_INTO 148 |
| 13771 | +#define TK_NOTHING 149 |
| 13772 | +#define TK_FLOAT 150 |
| 13773 | +#define TK_BLOB 151 |
| 13774 | +#define TK_INTEGER 152 |
| 13775 | +#define TK_VARIABLE 153 |
| 13776 | +#define TK_CASE 154 |
| 13777 | +#define TK_WHEN 155 |
| 13778 | +#define TK_THEN 156 |
| 13779 | +#define TK_ELSE 157 |
| 13780 | +#define TK_INDEX 158 |
| 13781 | +#define TK_ALTER 159 |
| 13782 | +#define TK_ADD 160 |
| 13783 | +#define TK_WINDOW 161 |
| 13784 | +#define TK_OVER 162 |
| 13785 | +#define TK_FILTER 163 |
| 13786 | +#define TK_COLUMN 164 |
| 13787 | +#define TK_AGG_FUNCTION 165 |
| 13788 | +#define TK_AGG_COLUMN 166 |
| 13789 | +#define TK_TRUEFALSE 167 |
| 13790 | +#define TK_ISNOT 168 |
| 13791 | +#define TK_FUNCTION 169 |
| 13792 | +#define TK_UMINUS 170 |
| 13793 | +#define TK_UPLUS 171 |
| 13794 | +#define TK_TRUTH 172 |
| 13795 | +#define TK_REGISTER 173 |
| 13796 | +#define TK_VECTOR 174 |
| 13797 | +#define TK_SELECT_COLUMN 175 |
| 13798 | +#define TK_IF_NULL_ROW 176 |
| 13799 | +#define TK_ASTERISK 177 |
| 13800 | +#define TK_SPAN 178 |
| 13801 | +#define TK_SPACE 179 |
| 13802 | +#define TK_ILLEGAL 180 |
| 13760 | 13803 | |
| 13761 | 13804 | /************** End of parse.h ***********************************************/ |
| 13762 | 13805 | /************** Continuing where we left off in sqliteInt.h ******************/ |
| 13763 | 13806 | #include <stdio.h> |
| 13764 | 13807 | #include <stdlib.h> |
| | @@ -14686,11 +14729,11 @@ |
| 14686 | 14729 | SQLITE_PRIVATE int sqlite3BtreePayload(BtCursor*, u32 offset, u32 amt, void*); |
| 14687 | 14730 | SQLITE_PRIVATE const void *sqlite3BtreePayloadFetch(BtCursor*, u32 *pAmt); |
| 14688 | 14731 | SQLITE_PRIVATE u32 sqlite3BtreePayloadSize(BtCursor*); |
| 14689 | 14732 | SQLITE_PRIVATE sqlite3_int64 sqlite3BtreeMaxRecordSize(BtCursor*); |
| 14690 | 14733 | |
| 14691 | | -SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*); |
| 14734 | +SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(sqlite3*,Btree*,int*aRoot,int nRoot,int,int*); |
| 14692 | 14735 | SQLITE_PRIVATE struct Pager *sqlite3BtreePager(Btree*); |
| 14693 | 14736 | SQLITE_PRIVATE i64 sqlite3BtreeRowCountEst(BtCursor*); |
| 14694 | 14737 | |
| 14695 | 14738 | #ifndef SQLITE_OMIT_INCRBLOB |
| 14696 | 14739 | SQLITE_PRIVATE int sqlite3BtreePayloadChecked(BtCursor*, u32 offset, u32 amt, void*); |
| | @@ -14707,11 +14750,11 @@ |
| 14707 | 14750 | SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor*); |
| 14708 | 14751 | #endif |
| 14709 | 14752 | SQLITE_PRIVATE int sqlite3BtreeCursorIsValidNN(BtCursor*); |
| 14710 | 14753 | |
| 14711 | 14754 | #ifndef SQLITE_OMIT_BTREECOUNT |
| 14712 | | -SQLITE_PRIVATE int sqlite3BtreeCount(BtCursor *, i64 *); |
| 14755 | +SQLITE_PRIVATE int sqlite3BtreeCount(sqlite3*, BtCursor*, i64*); |
| 14713 | 14756 | #endif |
| 14714 | 14757 | |
| 14715 | 14758 | #ifdef SQLITE_TEST |
| 14716 | 14759 | SQLITE_PRIVATE int sqlite3BtreeCursorInfo(BtCursor*, int*, int); |
| 14717 | 14760 | SQLITE_PRIVATE void sqlite3BtreeCursorList(Btree*); |
| | @@ -15000,121 +15043,119 @@ |
| 15000 | 15043 | #define OP_Ge 57 /* jump, same as TK_GE, synopsis: IF r[P3]>=r[P1] */ |
| 15001 | 15044 | #define OP_ElseNotEq 58 /* jump, same as TK_ESCAPE */ |
| 15002 | 15045 | #define OP_IncrVacuum 59 /* jump */ |
| 15003 | 15046 | #define OP_VNext 60 /* jump */ |
| 15004 | 15047 | #define OP_Init 61 /* jump, synopsis: Start at P2 */ |
| 15005 | | -#define OP_PureFunc0 62 |
| 15006 | | -#define OP_Function0 63 /* synopsis: r[P3]=func(r[P2@P5]) */ |
| 15007 | | -#define OP_PureFunc 64 |
| 15008 | | -#define OP_Function 65 /* synopsis: r[P3]=func(r[P2@P5]) */ |
| 15009 | | -#define OP_Return 66 |
| 15010 | | -#define OP_EndCoroutine 67 |
| 15011 | | -#define OP_HaltIfNull 68 /* synopsis: if r[P3]=null halt */ |
| 15012 | | -#define OP_Halt 69 |
| 15013 | | -#define OP_Integer 70 /* synopsis: r[P2]=P1 */ |
| 15014 | | -#define OP_Int64 71 /* synopsis: r[P2]=P4 */ |
| 15015 | | -#define OP_String 72 /* synopsis: r[P2]='P4' (len=P1) */ |
| 15016 | | -#define OP_Null 73 /* synopsis: r[P2..P3]=NULL */ |
| 15017 | | -#define OP_SoftNull 74 /* synopsis: r[P1]=NULL */ |
| 15018 | | -#define OP_Blob 75 /* synopsis: r[P2]=P4 (len=P1) */ |
| 15019 | | -#define OP_Variable 76 /* synopsis: r[P2]=parameter(P1,P4) */ |
| 15020 | | -#define OP_Move 77 /* synopsis: r[P2@P3]=r[P1@P3] */ |
| 15021 | | -#define OP_Copy 78 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ |
| 15022 | | -#define OP_SCopy 79 /* synopsis: r[P2]=r[P1] */ |
| 15023 | | -#define OP_IntCopy 80 /* synopsis: r[P2]=r[P1] */ |
| 15024 | | -#define OP_ResultRow 81 /* synopsis: output=r[P1@P2] */ |
| 15025 | | -#define OP_CollSeq 82 |
| 15026 | | -#define OP_AddImm 83 /* synopsis: r[P1]=r[P1]+P2 */ |
| 15027 | | -#define OP_RealAffinity 84 |
| 15028 | | -#define OP_Cast 85 /* synopsis: affinity(r[P1]) */ |
| 15029 | | -#define OP_Permutation 86 |
| 15030 | | -#define OP_Compare 87 /* synopsis: r[P1@P3] <-> r[P2@P3] */ |
| 15031 | | -#define OP_IsTrue 88 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */ |
| 15032 | | -#define OP_Offset 89 /* synopsis: r[P3] = sqlite_offset(P1) */ |
| 15033 | | -#define OP_Column 90 /* synopsis: r[P3]=PX */ |
| 15034 | | -#define OP_Affinity 91 /* synopsis: affinity(r[P1@P2]) */ |
| 15035 | | -#define OP_MakeRecord 92 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ |
| 15036 | | -#define OP_Count 93 /* synopsis: r[P2]=count() */ |
| 15037 | | -#define OP_ReadCookie 94 |
| 15038 | | -#define OP_SetCookie 95 |
| 15039 | | -#define OP_ReopenIdx 96 /* synopsis: root=P2 iDb=P3 */ |
| 15040 | | -#define OP_OpenRead 97 /* synopsis: root=P2 iDb=P3 */ |
| 15041 | | -#define OP_OpenWrite 98 /* synopsis: root=P2 iDb=P3 */ |
| 15042 | | -#define OP_BitAnd 99 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */ |
| 15043 | | -#define OP_BitOr 100 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */ |
| 15044 | | -#define OP_ShiftLeft 101 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */ |
| 15045 | | -#define OP_ShiftRight 102 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */ |
| 15046 | | -#define OP_Add 103 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */ |
| 15047 | | -#define OP_Subtract 104 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */ |
| 15048 | | -#define OP_Multiply 105 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */ |
| 15049 | | -#define OP_Divide 106 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */ |
| 15050 | | -#define OP_Remainder 107 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */ |
| 15051 | | -#define OP_Concat 108 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */ |
| 15052 | | -#define OP_OpenDup 109 |
| 15053 | | -#define OP_BitNot 110 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */ |
| 15054 | | -#define OP_OpenAutoindex 111 /* synopsis: nColumn=P2 */ |
| 15055 | | -#define OP_OpenEphemeral 112 /* synopsis: nColumn=P2 */ |
| 15056 | | -#define OP_String8 113 /* same as TK_STRING, synopsis: r[P2]='P4' */ |
| 15057 | | -#define OP_SorterOpen 114 |
| 15058 | | -#define OP_SequenceTest 115 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ |
| 15059 | | -#define OP_OpenPseudo 116 /* synopsis: P3 columns in r[P2] */ |
| 15060 | | -#define OP_Close 117 |
| 15061 | | -#define OP_ColumnsUsed 118 |
| 15062 | | -#define OP_SeekHit 119 /* synopsis: seekHit=P2 */ |
| 15063 | | -#define OP_Sequence 120 /* synopsis: r[P2]=cursor[P1].ctr++ */ |
| 15064 | | -#define OP_NewRowid 121 /* synopsis: r[P2]=rowid */ |
| 15065 | | -#define OP_Insert 122 /* synopsis: intkey=r[P3] data=r[P2] */ |
| 15066 | | -#define OP_Delete 123 |
| 15067 | | -#define OP_ResetCount 124 |
| 15068 | | -#define OP_SorterCompare 125 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ |
| 15069 | | -#define OP_SorterData 126 /* synopsis: r[P2]=data */ |
| 15070 | | -#define OP_RowData 127 /* synopsis: r[P2]=data */ |
| 15071 | | -#define OP_Rowid 128 /* synopsis: r[P2]=rowid */ |
| 15072 | | -#define OP_NullRow 129 |
| 15073 | | -#define OP_SeekEnd 130 |
| 15074 | | -#define OP_SorterInsert 131 /* synopsis: key=r[P2] */ |
| 15075 | | -#define OP_IdxInsert 132 /* synopsis: key=r[P2] */ |
| 15076 | | -#define OP_IdxDelete 133 /* synopsis: key=r[P2@P3] */ |
| 15077 | | -#define OP_DeferredSeek 134 /* synopsis: Move P3 to P1.rowid if needed */ |
| 15078 | | -#define OP_IdxRowid 135 /* synopsis: r[P2]=rowid */ |
| 15079 | | -#define OP_Destroy 136 |
| 15080 | | -#define OP_Clear 137 |
| 15081 | | -#define OP_ResetSorter 138 |
| 15082 | | -#define OP_CreateBtree 139 /* synopsis: r[P2]=root iDb=P1 flags=P3 */ |
| 15083 | | -#define OP_SqlExec 140 |
| 15084 | | -#define OP_ParseSchema 141 |
| 15085 | | -#define OP_LoadAnalysis 142 |
| 15086 | | -#define OP_DropTable 143 |
| 15087 | | -#define OP_DropIndex 144 |
| 15088 | | -#define OP_DropTrigger 145 |
| 15089 | | -#define OP_IntegrityCk 146 |
| 15090 | | -#define OP_RowSetAdd 147 /* synopsis: rowset(P1)=r[P2] */ |
| 15091 | | -#define OP_Real 148 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ |
| 15092 | | -#define OP_Param 149 |
| 15093 | | -#define OP_FkCounter 150 /* synopsis: fkctr[P1]+=P2 */ |
| 15094 | | -#define OP_MemMax 151 /* synopsis: r[P1]=max(r[P1],r[P2]) */ |
| 15095 | | -#define OP_OffsetLimit 152 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ |
| 15096 | | -#define OP_AggInverse 153 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */ |
| 15097 | | -#define OP_AggStep 154 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 15098 | | -#define OP_AggStep1 155 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 15099 | | -#define OP_AggValue 156 /* synopsis: r[P3]=value N=P2 */ |
| 15100 | | -#define OP_AggFinal 157 /* synopsis: accum=r[P1] N=P2 */ |
| 15101 | | -#define OP_Expire 158 |
| 15102 | | -#define OP_TableLock 159 /* synopsis: iDb=P1 root=P2 write=P3 */ |
| 15103 | | -#define OP_VBegin 160 |
| 15104 | | -#define OP_VCreate 161 |
| 15105 | | -#define OP_VDestroy 162 |
| 15106 | | -#define OP_VOpen 163 |
| 15107 | | -#define OP_VColumn 164 /* synopsis: r[P3]=vcolumn(P2) */ |
| 15108 | | -#define OP_VRename 165 |
| 15109 | | -#define OP_Pagecount 166 |
| 15110 | | -#define OP_MaxPgcnt 167 |
| 15111 | | -#define OP_Trace 168 |
| 15112 | | -#define OP_CursorHint 169 |
| 15113 | | -#define OP_Noop 170 |
| 15114 | | -#define OP_Explain 171 |
| 15115 | | -#define OP_Abortable 172 |
| 15048 | +#define OP_PureFunc 62 /* synopsis: r[P3]=func(r[P2@P5]) */ |
| 15049 | +#define OP_Function 63 /* synopsis: r[P3]=func(r[P2@P5]) */ |
| 15050 | +#define OP_Return 64 |
| 15051 | +#define OP_EndCoroutine 65 |
| 15052 | +#define OP_HaltIfNull 66 /* synopsis: if r[P3]=null halt */ |
| 15053 | +#define OP_Halt 67 |
| 15054 | +#define OP_Integer 68 /* synopsis: r[P2]=P1 */ |
| 15055 | +#define OP_Int64 69 /* synopsis: r[P2]=P4 */ |
| 15056 | +#define OP_String 70 /* synopsis: r[P2]='P4' (len=P1) */ |
| 15057 | +#define OP_Null 71 /* synopsis: r[P2..P3]=NULL */ |
| 15058 | +#define OP_SoftNull 72 /* synopsis: r[P1]=NULL */ |
| 15059 | +#define OP_Blob 73 /* synopsis: r[P2]=P4 (len=P1) */ |
| 15060 | +#define OP_Variable 74 /* synopsis: r[P2]=parameter(P1,P4) */ |
| 15061 | +#define OP_Move 75 /* synopsis: r[P2@P3]=r[P1@P3] */ |
| 15062 | +#define OP_Copy 76 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ |
| 15063 | +#define OP_SCopy 77 /* synopsis: r[P2]=r[P1] */ |
| 15064 | +#define OP_IntCopy 78 /* synopsis: r[P2]=r[P1] */ |
| 15065 | +#define OP_ResultRow 79 /* synopsis: output=r[P1@P2] */ |
| 15066 | +#define OP_CollSeq 80 |
| 15067 | +#define OP_AddImm 81 /* synopsis: r[P1]=r[P1]+P2 */ |
| 15068 | +#define OP_RealAffinity 82 |
| 15069 | +#define OP_Cast 83 /* synopsis: affinity(r[P1]) */ |
| 15070 | +#define OP_Permutation 84 |
| 15071 | +#define OP_Compare 85 /* synopsis: r[P1@P3] <-> r[P2@P3] */ |
| 15072 | +#define OP_IsTrue 86 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */ |
| 15073 | +#define OP_Offset 87 /* synopsis: r[P3] = sqlite_offset(P1) */ |
| 15074 | +#define OP_Column 88 /* synopsis: r[P3]=PX */ |
| 15075 | +#define OP_Affinity 89 /* synopsis: affinity(r[P1@P2]) */ |
| 15076 | +#define OP_MakeRecord 90 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ |
| 15077 | +#define OP_Count 91 /* synopsis: r[P2]=count() */ |
| 15078 | +#define OP_ReadCookie 92 |
| 15079 | +#define OP_SetCookie 93 |
| 15080 | +#define OP_ReopenIdx 94 /* synopsis: root=P2 iDb=P3 */ |
| 15081 | +#define OP_OpenRead 95 /* synopsis: root=P2 iDb=P3 */ |
| 15082 | +#define OP_OpenWrite 96 /* synopsis: root=P2 iDb=P3 */ |
| 15083 | +#define OP_OpenDup 97 |
| 15084 | +#define OP_OpenAutoindex 98 /* synopsis: nColumn=P2 */ |
| 15085 | +#define OP_OpenEphemeral 99 /* synopsis: nColumn=P2 */ |
| 15086 | +#define OP_SorterOpen 100 |
| 15087 | +#define OP_BitAnd 101 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */ |
| 15088 | +#define OP_BitOr 102 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */ |
| 15089 | +#define OP_ShiftLeft 103 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */ |
| 15090 | +#define OP_ShiftRight 104 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */ |
| 15091 | +#define OP_Add 105 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */ |
| 15092 | +#define OP_Subtract 106 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */ |
| 15093 | +#define OP_Multiply 107 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */ |
| 15094 | +#define OP_Divide 108 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */ |
| 15095 | +#define OP_Remainder 109 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */ |
| 15096 | +#define OP_Concat 110 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */ |
| 15097 | +#define OP_SequenceTest 111 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ |
| 15098 | +#define OP_BitNot 112 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */ |
| 15099 | +#define OP_OpenPseudo 113 /* synopsis: P3 columns in r[P2] */ |
| 15100 | +#define OP_Close 114 |
| 15101 | +#define OP_String8 115 /* same as TK_STRING, synopsis: r[P2]='P4' */ |
| 15102 | +#define OP_ColumnsUsed 116 |
| 15103 | +#define OP_SeekHit 117 /* synopsis: seekHit=P2 */ |
| 15104 | +#define OP_Sequence 118 /* synopsis: r[P2]=cursor[P1].ctr++ */ |
| 15105 | +#define OP_NewRowid 119 /* synopsis: r[P2]=rowid */ |
| 15106 | +#define OP_Insert 120 /* synopsis: intkey=r[P3] data=r[P2] */ |
| 15107 | +#define OP_Delete 121 |
| 15108 | +#define OP_ResetCount 122 |
| 15109 | +#define OP_SorterCompare 123 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ |
| 15110 | +#define OP_SorterData 124 /* synopsis: r[P2]=data */ |
| 15111 | +#define OP_RowData 125 /* synopsis: r[P2]=data */ |
| 15112 | +#define OP_Rowid 126 /* synopsis: r[P2]=rowid */ |
| 15113 | +#define OP_NullRow 127 |
| 15114 | +#define OP_SeekEnd 128 |
| 15115 | +#define OP_SorterInsert 129 /* synopsis: key=r[P2] */ |
| 15116 | +#define OP_IdxInsert 130 /* synopsis: key=r[P2] */ |
| 15117 | +#define OP_IdxDelete 131 /* synopsis: key=r[P2@P3] */ |
| 15118 | +#define OP_DeferredSeek 132 /* synopsis: Move P3 to P1.rowid if needed */ |
| 15119 | +#define OP_IdxRowid 133 /* synopsis: r[P2]=rowid */ |
| 15120 | +#define OP_Destroy 134 |
| 15121 | +#define OP_Clear 135 |
| 15122 | +#define OP_ResetSorter 136 |
| 15123 | +#define OP_CreateBtree 137 /* synopsis: r[P2]=root iDb=P1 flags=P3 */ |
| 15124 | +#define OP_SqlExec 138 |
| 15125 | +#define OP_ParseSchema 139 |
| 15126 | +#define OP_LoadAnalysis 140 |
| 15127 | +#define OP_DropTable 141 |
| 15128 | +#define OP_DropIndex 142 |
| 15129 | +#define OP_DropTrigger 143 |
| 15130 | +#define OP_IntegrityCk 144 |
| 15131 | +#define OP_RowSetAdd 145 /* synopsis: rowset(P1)=r[P2] */ |
| 15132 | +#define OP_Param 146 |
| 15133 | +#define OP_FkCounter 147 /* synopsis: fkctr[P1]+=P2 */ |
| 15134 | +#define OP_MemMax 148 /* synopsis: r[P1]=max(r[P1],r[P2]) */ |
| 15135 | +#define OP_OffsetLimit 149 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ |
| 15136 | +#define OP_Real 150 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ |
| 15137 | +#define OP_AggInverse 151 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */ |
| 15138 | +#define OP_AggStep 152 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 15139 | +#define OP_AggStep1 153 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 15140 | +#define OP_AggValue 154 /* synopsis: r[P3]=value N=P2 */ |
| 15141 | +#define OP_AggFinal 155 /* synopsis: accum=r[P1] N=P2 */ |
| 15142 | +#define OP_Expire 156 |
| 15143 | +#define OP_TableLock 157 /* synopsis: iDb=P1 root=P2 write=P3 */ |
| 15144 | +#define OP_VBegin 158 |
| 15145 | +#define OP_VCreate 159 |
| 15146 | +#define OP_VDestroy 160 |
| 15147 | +#define OP_VOpen 161 |
| 15148 | +#define OP_VColumn 162 /* synopsis: r[P3]=vcolumn(P2) */ |
| 15149 | +#define OP_VRename 163 |
| 15150 | +#define OP_Pagecount 164 |
| 15151 | +#define OP_MaxPgcnt 165 |
| 15152 | +#define OP_Trace 166 |
| 15153 | +#define OP_CursorHint 167 |
| 15154 | +#define OP_Noop 168 |
| 15155 | +#define OP_Explain 169 |
| 15156 | +#define OP_Abortable 170 |
| 15116 | 15157 | |
| 15117 | 15158 | /* Properties such as "out2" or "jump" that are specified in |
| 15118 | 15159 | ** comments following the "case" for each opcode in the vdbe.c |
| 15119 | 15160 | ** are encoded into bitvectors as follows: |
| 15120 | 15161 | */ |
| | @@ -15131,24 +15172,24 @@ |
| 15131 | 15172 | /* 24 */ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,\ |
| 15132 | 15173 | /* 32 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\ |
| 15133 | 15174 | /* 40 */ 0x01, 0x23, 0x0b, 0x26, 0x26, 0x01, 0x01, 0x03,\ |
| 15134 | 15175 | /* 48 */ 0x03, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ |
| 15135 | 15176 | /* 56 */ 0x0b, 0x0b, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00,\ |
| 15136 | | -/* 64 */ 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10, 0x10,\ |
| 15137 | | -/* 72 */ 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10,\ |
| 15138 | | -/* 80 */ 0x10, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00,\ |
| 15139 | | -/* 88 */ 0x12, 0x20, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\ |
| 15140 | | -/* 96 */ 0x00, 0x00, 0x00, 0x26, 0x26, 0x26, 0x26, 0x26,\ |
| 15141 | | -/* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x00, 0x12, 0x00,\ |
| 15142 | | -/* 112 */ 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15143 | | -/* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15144 | | -/* 128 */ 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x10,\ |
| 15145 | | -/* 136 */ 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\ |
| 15146 | | -/* 144 */ 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x04,\ |
| 15147 | | -/* 152 */ 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15148 | | -/* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,\ |
| 15149 | | -/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00,} |
| 15177 | +/* 64 */ 0x02, 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10,\ |
| 15178 | +/* 72 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00,\ |
| 15179 | +/* 80 */ 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x12, 0x20,\ |
| 15180 | +/* 88 */ 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00,\ |
| 15181 | +/* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26, 0x26,\ |
| 15182 | +/* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00,\ |
| 15183 | +/* 112 */ 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x10,\ |
| 15184 | +/* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\ |
| 15185 | +/* 128 */ 0x00, 0x04, 0x04, 0x00, 0x00, 0x10, 0x10, 0x00,\ |
| 15186 | +/* 136 */ 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15187 | +/* 144 */ 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a, 0x10, 0x00,\ |
| 15188 | +/* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15189 | +/* 160 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ |
| 15190 | +/* 168 */ 0x00, 0x00, 0x00,} |
| 15150 | 15191 | |
| 15151 | 15192 | /* The sqlite3P2Values() routine is able to run faster if it knows |
| 15152 | 15193 | ** the value of the largest JUMP opcode. The smaller the maximum |
| 15153 | 15194 | ** JUMP opcode the better, so the mkopcodeh.tcl script that |
| 15154 | 15195 | ** generated this include file strives to group all JUMP opcodes |
| | @@ -15168,10 +15209,11 @@ |
| 15168 | 15209 | /* |
| 15169 | 15210 | ** Prototypes for the VDBE interface. See comments on the implementation |
| 15170 | 15211 | ** for a description of what each of these routines does. |
| 15171 | 15212 | */ |
| 15172 | 15213 | SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse*); |
| 15214 | +SQLITE_PRIVATE Parse *sqlite3VdbeParser(Vdbe*); |
| 15173 | 15215 | SQLITE_PRIVATE int sqlite3VdbeAddOp0(Vdbe*,int); |
| 15174 | 15216 | SQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe*,int,int); |
| 15175 | 15217 | SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe*,int,int,int); |
| 15176 | 15218 | SQLITE_PRIVATE int sqlite3VdbeGoto(Vdbe*,int); |
| 15177 | 15219 | SQLITE_PRIVATE int sqlite3VdbeLoadString(Vdbe*,int,const char*); |
| | @@ -15178,10 +15220,11 @@ |
| 15178 | 15220 | SQLITE_PRIVATE void sqlite3VdbeMultiLoad(Vdbe*,int,const char*,...); |
| 15179 | 15221 | SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int); |
| 15180 | 15222 | SQLITE_PRIVATE int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int); |
| 15181 | 15223 | SQLITE_PRIVATE int sqlite3VdbeAddOp4Dup8(Vdbe*,int,int,int,int,const u8*,int); |
| 15182 | 15224 | SQLITE_PRIVATE int sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int); |
| 15225 | +SQLITE_PRIVATE int sqlite3VdbeAddFunctionCall(Parse*,int,int,int,int,const FuncDef*,int); |
| 15183 | 15226 | SQLITE_PRIVATE void sqlite3VdbeEndCoroutine(Vdbe*,int); |
| 15184 | 15227 | #if defined(SQLITE_DEBUG) && !defined(SQLITE_TEST_REALLOC_STRESS) |
| 15185 | 15228 | SQLITE_PRIVATE void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N); |
| 15186 | 15229 | SQLITE_PRIVATE void sqlite3VdbeVerifyNoResultRow(Vdbe *p); |
| 15187 | 15230 | #else |
| | @@ -15267,13 +15310,12 @@ |
| 15267 | 15310 | SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(KeyInfo*); |
| 15268 | 15311 | |
| 15269 | 15312 | typedef int (*RecordCompare)(int,const void*,UnpackedRecord*); |
| 15270 | 15313 | SQLITE_PRIVATE RecordCompare sqlite3VdbeFindCompare(UnpackedRecord*); |
| 15271 | 15314 | |
| 15272 | | -#ifndef SQLITE_OMIT_TRIGGER |
| 15273 | 15315 | SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *); |
| 15274 | | -#endif |
| 15316 | +SQLITE_PRIVATE int sqlite3VdbeHasSubProgram(Vdbe*); |
| 15275 | 15317 | |
| 15276 | 15318 | SQLITE_PRIVATE int sqlite3NotPureFunc(sqlite3_context*); |
| 15277 | 15319 | |
| 15278 | 15320 | /* Use SQLITE_ENABLE_COMMENTS to enable generation of extra comments on |
| 15279 | 15321 | ** each VDBE opcode. |
| | @@ -16303,14 +16345,21 @@ |
| 16303 | 16345 | ** with a particular database connection. Hence, schema information cannot |
| 16304 | 16346 | ** be stored in lookaside because in shared cache mode the schema information |
| 16305 | 16347 | ** is shared by multiple database connections. Therefore, while parsing |
| 16306 | 16348 | ** schema information, the Lookaside.bEnabled flag is cleared so that |
| 16307 | 16349 | ** lookaside allocations are not used to construct the schema objects. |
| 16350 | +** |
| 16351 | +** New lookaside allocations are only allowed if bDisable==0. When |
| 16352 | +** bDisable is greater than zero, sz is set to zero which effectively |
| 16353 | +** disables lookaside without adding a new test for the bDisable flag |
| 16354 | +** in a performance-critical path. sz should be set by to szTrue whenever |
| 16355 | +** bDisable changes back to zero. |
| 16308 | 16356 | */ |
| 16309 | 16357 | struct Lookaside { |
| 16310 | 16358 | u32 bDisable; /* Only operate the lookaside when zero */ |
| 16311 | 16359 | u16 sz; /* Size of each buffer in bytes */ |
| 16360 | + u16 szTrue; /* True value of sz, even if disabled */ |
| 16312 | 16361 | u8 bMalloced; /* True if pStart obtained from sqlite3_malloc() */ |
| 16313 | 16362 | u32 nSlot; /* Number of lookaside slots allocated */ |
| 16314 | 16363 | u32 anStat[3]; /* 0: hits. 1: size misses. 2: full misses */ |
| 16315 | 16364 | LookasideSlot *pInit; /* List of buffers not previously used */ |
| 16316 | 16365 | LookasideSlot *pFree; /* List of available buffers */ |
| | @@ -16318,10 +16367,14 @@ |
| 16318 | 16367 | void *pEnd; /* First byte past end of available space */ |
| 16319 | 16368 | }; |
| 16320 | 16369 | struct LookasideSlot { |
| 16321 | 16370 | LookasideSlot *pNext; /* Next buffer in the list of free buffers */ |
| 16322 | 16371 | }; |
| 16372 | + |
| 16373 | +#define DisableLookaside db->lookaside.bDisable++;db->lookaside.sz=0 |
| 16374 | +#define EnableLookaside db->lookaside.bDisable--;\ |
| 16375 | + db->lookaside.sz=db->lookaside.bDisable?0:db->lookaside.szTrue |
| 16323 | 16376 | |
| 16324 | 16377 | /* |
| 16325 | 16378 | ** A hash table for built-in function definitions. (Application-defined |
| 16326 | 16379 | ** functions use a regular table table from hash.h.) |
| 16327 | 16380 | ** |
| | @@ -16839,30 +16892,49 @@ |
| 16839 | 16892 | void (*xDestroy)(void *); /* Module destructor function */ |
| 16840 | 16893 | Table *pEpoTab; /* Eponymous table for this module */ |
| 16841 | 16894 | }; |
| 16842 | 16895 | |
| 16843 | 16896 | /* |
| 16844 | | -** information about each column of an SQL table is held in an instance |
| 16845 | | -** of this structure. |
| 16897 | +** Information about each column of an SQL table is held in an instance |
| 16898 | +** of the Column structure, in the Table.aCol[] array. |
| 16899 | +** |
| 16900 | +** Definitions: |
| 16901 | +** |
| 16902 | +** "table column index" This is the index of the column in the |
| 16903 | +** Table.aCol[] array, and also the index of |
| 16904 | +** the column in the original CREATE TABLE stmt. |
| 16905 | +** |
| 16906 | +** "storage column index" This is the index of the column in the |
| 16907 | +** record BLOB generated by the OP_MakeRecord |
| 16908 | +** opcode. The storage column index is less than |
| 16909 | +** or equal to the table column index. It is |
| 16910 | +** equal if and only if there are no VIRTUAL |
| 16911 | +** columns to the left. |
| 16846 | 16912 | */ |
| 16847 | 16913 | struct Column { |
| 16848 | 16914 | char *zName; /* Name of this column, \000, then the type */ |
| 16849 | | - Expr *pDflt; /* Default value of this column */ |
| 16915 | + Expr *pDflt; /* Default value or GENERATED ALWAYS AS value */ |
| 16850 | 16916 | char *zColl; /* Collating sequence. If NULL, use the default */ |
| 16851 | 16917 | u8 notNull; /* An OE_ code for handling a NOT NULL constraint */ |
| 16852 | 16918 | char affinity; /* One of the SQLITE_AFF_... values */ |
| 16853 | 16919 | u8 szEst; /* Estimated size of value in this column. sizeof(INT)==1 */ |
| 16854 | | - u8 colFlags; /* Boolean properties. See COLFLAG_ defines below */ |
| 16920 | + u16 colFlags; /* Boolean properties. See COLFLAG_ defines below */ |
| 16855 | 16921 | }; |
| 16856 | 16922 | |
| 16857 | 16923 | /* Allowed values for Column.colFlags: |
| 16858 | 16924 | */ |
| 16859 | | -#define COLFLAG_PRIMKEY 0x0001 /* Column is part of the primary key */ |
| 16860 | | -#define COLFLAG_HIDDEN 0x0002 /* A hidden column in a virtual table */ |
| 16861 | | -#define COLFLAG_HASTYPE 0x0004 /* Type name follows column name */ |
| 16862 | | -#define COLFLAG_UNIQUE 0x0008 /* Column def contains "UNIQUE" or "PK" */ |
| 16925 | +#define COLFLAG_PRIMKEY 0x0001 /* Column is part of the primary key */ |
| 16926 | +#define COLFLAG_HIDDEN 0x0002 /* A hidden column in a virtual table */ |
| 16927 | +#define COLFLAG_HASTYPE 0x0004 /* Type name follows column name */ |
| 16928 | +#define COLFLAG_UNIQUE 0x0008 /* Column def contains "UNIQUE" or "PK" */ |
| 16863 | 16929 | #define COLFLAG_SORTERREF 0x0010 /* Use sorter-refs with this column */ |
| 16930 | +#define COLFLAG_VIRTUAL 0x0020 /* GENERATED ALWAYS AS ... VIRTUAL */ |
| 16931 | +#define COLFLAG_STORED 0x0040 /* GENERATED ALWAYS AS ... STORED */ |
| 16932 | +#define COLFLAG_NOTAVAIL 0x0080 /* STORED column not yet calculated */ |
| 16933 | +#define COLFLAG_BUSY 0x0100 /* Blocks recursion on GENERATED columns */ |
| 16934 | +#define COLFLAG_GENERATED 0x0060 /* Combo: _STORED, _VIRTUAL */ |
| 16935 | +#define COLFLAG_NOINSERT 0x0062 /* Combo: _HIDDEN, _STORED, _VIRTUAL */ |
| 16864 | 16936 | |
| 16865 | 16937 | /* |
| 16866 | 16938 | ** A "Collating Sequence" is defined by an instance of the following |
| 16867 | 16939 | ** structure. Conceptually, a collating sequence consists of a name and |
| 16868 | 16940 | ** a comparison routine that defines the order of that sequence. |
| | @@ -16998,10 +17070,11 @@ |
| 16998 | 17070 | int tnum; /* Root BTree page for this table */ |
| 16999 | 17071 | u32 nTabRef; /* Number of pointers to this Table */ |
| 17000 | 17072 | u32 tabFlags; /* Mask of TF_* values */ |
| 17001 | 17073 | i16 iPKey; /* If not negative, use aCol[iPKey] as the rowid */ |
| 17002 | 17074 | i16 nCol; /* Number of columns in this table */ |
| 17075 | + i16 nNVCol; /* Number of columns that are not VIRTUAL */ |
| 17003 | 17076 | LogEst nRowLogEst; /* Estimated rows in table - from sqlite_stat1 table */ |
| 17004 | 17077 | LogEst szTabRow; /* Estimated size of each table row in bytes */ |
| 17005 | 17078 | #ifdef SQLITE_ENABLE_COSTMULT |
| 17006 | 17079 | LogEst costMult; /* Cost multiplier for using this table */ |
| 17007 | 17080 | #endif |
| | @@ -17024,24 +17097,32 @@ |
| 17024 | 17097 | ** |
| 17025 | 17098 | ** TF_OOOHidden applies to tables or view that have hidden columns that are |
| 17026 | 17099 | ** followed by non-hidden columns. Example: "CREATE VIRTUAL TABLE x USING |
| 17027 | 17100 | ** vtab1(a HIDDEN, b);". Since "b" is a non-hidden column but "a" is hidden, |
| 17028 | 17101 | ** the TF_OOOHidden attribute would apply in this case. Such tables require |
| 17029 | | -** special handling during INSERT processing. |
| 17102 | +** special handling during INSERT processing. The "OOO" means "Out Of Order". |
| 17103 | +** |
| 17104 | +** Constraints: |
| 17105 | +** |
| 17106 | +** TF_HasVirtual == COLFLAG_Virtual |
| 17107 | +** TF_HasStored == COLFLAG_Stored |
| 17030 | 17108 | */ |
| 17031 | 17109 | #define TF_Readonly 0x0001 /* Read-only system table */ |
| 17032 | 17110 | #define TF_Ephemeral 0x0002 /* An ephemeral table */ |
| 17033 | 17111 | #define TF_HasPrimaryKey 0x0004 /* Table has a primary key */ |
| 17034 | 17112 | #define TF_Autoincrement 0x0008 /* Integer primary key is autoincrement */ |
| 17035 | 17113 | #define TF_HasStat1 0x0010 /* nRowLogEst set from sqlite_stat1 */ |
| 17036 | | -#define TF_WithoutRowid 0x0020 /* No rowid. PRIMARY KEY is the key */ |
| 17037 | | -#define TF_NoVisibleRowid 0x0040 /* No user-visible "rowid" column */ |
| 17038 | | -#define TF_OOOHidden 0x0080 /* Out-of-Order hidden columns */ |
| 17114 | +#define TF_HasVirtual 0x0020 /* Has one or more VIRTUAL columns */ |
| 17115 | +#define TF_HasStored 0x0040 /* Has one or more STORED columns */ |
| 17116 | +#define TF_HasGenerated 0x0060 /* Combo: HasVirtual + HasStored */ |
| 17117 | +#define TF_WithoutRowid 0x0080 /* No rowid. PRIMARY KEY is the key */ |
| 17039 | 17118 | #define TF_StatsUsed 0x0100 /* Query planner decisions affected by |
| 17040 | 17119 | ** Index.aiRowLogEst[] values */ |
| 17041 | | -#define TF_HasNotNull 0x0200 /* Contains NOT NULL constraints */ |
| 17042 | | -#define TF_Shadow 0x0400 /* True for a shadow table */ |
| 17120 | +#define TF_NoVisibleRowid 0x0200 /* No user-visible "rowid" column */ |
| 17121 | +#define TF_OOOHidden 0x0400 /* Out-of-Order hidden columns */ |
| 17122 | +#define TF_HasNotNull 0x0800 /* Contains NOT NULL constraints */ |
| 17123 | +#define TF_Shadow 0x1000 /* True for a shadow table */ |
| 17043 | 17124 | |
| 17044 | 17125 | /* |
| 17045 | 17126 | ** Test to see whether or not a table is a virtual table. This is |
| 17046 | 17127 | ** done as a macro so that it will be optimized out when virtual |
| 17047 | 17128 | ** table support is omitted from the build. |
| | @@ -17288,10 +17369,11 @@ |
| 17288 | 17369 | unsigned isCovering:1; /* True if this is a covering index */ |
| 17289 | 17370 | unsigned noSkipScan:1; /* Do not try to use skip-scan if true */ |
| 17290 | 17371 | unsigned hasStat1:1; /* aiRowLogEst values come from sqlite_stat1 */ |
| 17291 | 17372 | unsigned bNoQuery:1; /* Do not use this index to optimize queries */ |
| 17292 | 17373 | unsigned bAscKeyBug:1; /* True if the bba7b69f9849b5bf bug applies */ |
| 17374 | + unsigned bHasVCol:1; /* Index references one or more VIRTUAL columns */ |
| 17293 | 17375 | #ifdef SQLITE_ENABLE_STAT4 |
| 17294 | 17376 | int nSample; /* Number of elements in aSample[] */ |
| 17295 | 17377 | int nSampleCol; /* Size of IndexSample.anEq[] and so on */ |
| 17296 | 17378 | tRowcnt *aAvgEq; /* Average nEq values for keys not in aSample */ |
| 17297 | 17379 | IndexSample *aSample; /* Samples of the left-most key */ |
| | @@ -17479,10 +17561,14 @@ |
| 17479 | 17561 | ** allocated, regardless of whether or not EP_Reduced is set. |
| 17480 | 17562 | */ |
| 17481 | 17563 | struct Expr { |
| 17482 | 17564 | u8 op; /* Operation performed by this node */ |
| 17483 | 17565 | char affExpr; /* affinity, or RAISE type */ |
| 17566 | + u8 op2; /* TK_REGISTER/TK_TRUTH: original value of Expr.op |
| 17567 | + ** TK_COLUMN: the value of p5 for OP_Column |
| 17568 | + ** TK_AGG_FUNCTION: nesting depth |
| 17569 | + ** TK_FUNCTION: NC_SelfRef flag if needs OP_PureFunc */ |
| 17484 | 17570 | u32 flags; /* Various flags. EP_* See below */ |
| 17485 | 17571 | union { |
| 17486 | 17572 | char *zToken; /* Token value. Zero terminated and dequoted */ |
| 17487 | 17573 | int iValue; /* Non-negative integer value if EP_IntValue */ |
| 17488 | 17574 | } u; |
| | @@ -17517,13 +17603,10 @@ |
| 17517 | 17603 | ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid. |
| 17518 | 17604 | ** TK_VARIABLE: variable number (always >= 1). |
| 17519 | 17605 | ** TK_SELECT_COLUMN: column of the result vector */ |
| 17520 | 17606 | i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */ |
| 17521 | 17607 | i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */ |
| 17522 | | - u8 op2; /* TK_REGISTER/TK_TRUTH: original value of Expr.op |
| 17523 | | - ** TK_COLUMN: the value of p5 for OP_Column |
| 17524 | | - ** TK_AGG_FUNCTION: nesting depth */ |
| 17525 | 17608 | AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ |
| 17526 | 17609 | union { |
| 17527 | 17610 | Table *pTab; /* TK_COLUMN: Table containing column. Can be NULL |
| 17528 | 17611 | ** for a column of an index on an expression */ |
| 17529 | 17612 | Window *pWin; /* EP_WinFunc: Window/Filter defn for a function */ |
| | @@ -17548,11 +17631,11 @@ |
| 17548 | 17631 | #define EP_Agg 0x000010 /* Contains one or more aggregate functions */ |
| 17549 | 17632 | #define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */ |
| 17550 | 17633 | #define EP_DblQuoted 0x000040 /* token.z was originally in "..." */ |
| 17551 | 17634 | #define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */ |
| 17552 | 17635 | #define EP_Collate 0x000100 /* Tree contains a TK_COLLATE operator */ |
| 17553 | | - /* 0x000200 Available for reuse */ |
| 17636 | +#define EP_Commuted 0x000200 /* Comparison operator has been commuted */ |
| 17554 | 17637 | #define EP_IntValue 0x000400 /* Integer value contained in u.iValue */ |
| 17555 | 17638 | #define EP_xIsSelect 0x000800 /* x.pSelect is valid (otherwise x.pList is) */ |
| 17556 | 17639 | #define EP_Skip 0x001000 /* Operator does not contribute to affinity */ |
| 17557 | 17640 | #define EP_Reduced 0x002000 /* Expr struct EXPR_REDUCEDSIZE bytes only */ |
| 17558 | 17641 | #define EP_TokenOnly 0x004000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */ |
| | @@ -17617,13 +17700,17 @@ |
| 17617 | 17700 | |
| 17618 | 17701 | /* |
| 17619 | 17702 | ** True if the expression passed as an argument was a function with |
| 17620 | 17703 | ** an OVER() clause (a window function). |
| 17621 | 17704 | */ |
| 17622 | | -#define IsWindowFunc(p) ( \ |
| 17705 | +#ifdef SQLITE_OMIT_WINDOWFUNC |
| 17706 | +# define IsWindowFunc(p) 0 |
| 17707 | +#else |
| 17708 | +# define IsWindowFunc(p) ( \ |
| 17623 | 17709 | ExprHasProperty((p), EP_WinFunc) && p->y.pWin->eFrmType!=TK_FILTER \ |
| 17624 | | -) |
| 17710 | + ) |
| 17711 | +#endif |
| 17625 | 17712 | |
| 17626 | 17713 | /* |
| 17627 | 17714 | ** A list of expressions. Each expression may optionally have a |
| 17628 | 17715 | ** name. An expr/name combination can be used in several ways, such |
| 17629 | 17716 | ** as the list of "expr AS ID" fields following a "SELECT" or in the |
| | @@ -17825,25 +17912,27 @@ |
| 17825 | 17912 | ** NC_HasAgg == SF_HasAgg == EP_Agg |
| 17826 | 17913 | ** NC_MinMaxAgg == SF_MinMaxAgg == SQLITE_FUNC_MINMAX |
| 17827 | 17914 | ** NC_HasWin == EP_Win |
| 17828 | 17915 | ** |
| 17829 | 17916 | */ |
| 17830 | | -#define NC_AllowAgg 0x0001 /* Aggregate functions are allowed here */ |
| 17831 | | -#define NC_PartIdx 0x0002 /* True if resolving a partial index WHERE */ |
| 17832 | | -#define NC_IsCheck 0x0004 /* True if resolving names in a CHECK constraint */ |
| 17833 | | -#define NC_InAggFunc 0x0008 /* True if analyzing arguments to an agg func */ |
| 17834 | | -#define NC_HasAgg 0x0010 /* One or more aggregate functions seen */ |
| 17835 | | -#define NC_IdxExpr 0x0020 /* True if resolving columns of CREATE INDEX */ |
| 17836 | | -#define NC_VarSelect 0x0040 /* A correlated subquery has been seen */ |
| 17837 | | -#define NC_UEList 0x0080 /* True if uNC.pEList is used */ |
| 17838 | | -#define NC_UAggInfo 0x0100 /* True if uNC.pAggInfo is used */ |
| 17839 | | -#define NC_UUpsert 0x0200 /* True if uNC.pUpsert is used */ |
| 17840 | | -#define NC_MinMaxAgg 0x1000 /* min/max aggregates seen. See note above */ |
| 17841 | | -#define NC_Complex 0x2000 /* True if a function or subquery seen */ |
| 17842 | | -#define NC_AllowWin 0x4000 /* Window functions are allowed here */ |
| 17843 | | -#define NC_HasWin 0x8000 /* One or more window functions seen */ |
| 17844 | | -#define NC_IsDDL 0x10000 /* Resolving names in a CREATE statement */ |
| 17917 | +#define NC_AllowAgg 0x00001 /* Aggregate functions are allowed here */ |
| 17918 | +#define NC_PartIdx 0x00002 /* True if resolving a partial index WHERE */ |
| 17919 | +#define NC_IsCheck 0x00004 /* True if resolving a CHECK constraint */ |
| 17920 | +#define NC_GenCol 0x00008 /* True for a GENERATED ALWAYS AS clause */ |
| 17921 | +#define NC_HasAgg 0x00010 /* One or more aggregate functions seen */ |
| 17922 | +#define NC_IdxExpr 0x00020 /* True if resolving columns of CREATE INDEX */ |
| 17923 | +#define NC_SelfRef 0x0002e /* Combo: PartIdx, isCheck, GenCol, and IdxExpr */ |
| 17924 | +#define NC_VarSelect 0x00040 /* A correlated subquery has been seen */ |
| 17925 | +#define NC_UEList 0x00080 /* True if uNC.pEList is used */ |
| 17926 | +#define NC_UAggInfo 0x00100 /* True if uNC.pAggInfo is used */ |
| 17927 | +#define NC_UUpsert 0x00200 /* True if uNC.pUpsert is used */ |
| 17928 | +#define NC_MinMaxAgg 0x01000 /* min/max aggregates seen. See note above */ |
| 17929 | +#define NC_Complex 0x02000 /* True if a function or subquery seen */ |
| 17930 | +#define NC_AllowWin 0x04000 /* Window functions are allowed here */ |
| 17931 | +#define NC_HasWin 0x08000 /* One or more window functions seen */ |
| 17932 | +#define NC_IsDDL 0x10000 /* Resolving names in a CREATE statement */ |
| 17933 | +#define NC_InAggFunc 0x20000 /* True if analyzing arguments to an agg func */ |
| 17845 | 17934 | |
| 17846 | 17935 | /* |
| 17847 | 17936 | ** An instance of the following object describes a single ON CONFLICT |
| 17848 | 17937 | ** clause in an upsert. |
| 17849 | 17938 | ** |
| | @@ -17920,30 +18009,31 @@ |
| 17920 | 18009 | ** Value constraints (all checked via assert()) |
| 17921 | 18010 | ** SF_HasAgg == NC_HasAgg |
| 17922 | 18011 | ** SF_MinMaxAgg == NC_MinMaxAgg == SQLITE_FUNC_MINMAX |
| 17923 | 18012 | ** SF_FixedLimit == WHERE_USE_LIMIT |
| 17924 | 18013 | */ |
| 17925 | | -#define SF_Distinct 0x00001 /* Output should be DISTINCT */ |
| 17926 | | -#define SF_All 0x00002 /* Includes the ALL keyword */ |
| 17927 | | -#define SF_Resolved 0x00004 /* Identifiers have been resolved */ |
| 17928 | | -#define SF_Aggregate 0x00008 /* Contains agg functions or a GROUP BY */ |
| 17929 | | -#define SF_HasAgg 0x00010 /* Contains aggregate functions */ |
| 17930 | | -#define SF_UsesEphemeral 0x00020 /* Uses the OpenEphemeral opcode */ |
| 17931 | | -#define SF_Expanded 0x00040 /* sqlite3SelectExpand() called on this */ |
| 17932 | | -#define SF_HasTypeInfo 0x00080 /* FROM subqueries have Table metadata */ |
| 17933 | | -#define SF_Compound 0x00100 /* Part of a compound query */ |
| 17934 | | -#define SF_Values 0x00200 /* Synthesized from VALUES clause */ |
| 17935 | | -#define SF_MultiValue 0x00400 /* Single VALUES term with multiple rows */ |
| 17936 | | -#define SF_NestedFrom 0x00800 /* Part of a parenthesized FROM clause */ |
| 17937 | | -#define SF_MinMaxAgg 0x01000 /* Aggregate containing min() or max() */ |
| 17938 | | -#define SF_Recursive 0x02000 /* The recursive part of a recursive CTE */ |
| 17939 | | -#define SF_FixedLimit 0x04000 /* nSelectRow set by a constant LIMIT */ |
| 17940 | | -#define SF_MaybeConvert 0x08000 /* Need convertCompoundSelectToSubquery() */ |
| 17941 | | -#define SF_Converted 0x10000 /* By convertCompoundSelectToSubquery() */ |
| 17942 | | -#define SF_IncludeHidden 0x20000 /* Include hidden columns in output */ |
| 17943 | | -#define SF_ComplexResult 0x40000 /* Result contains subquery or function */ |
| 17944 | | -#define SF_WhereBegin 0x80000 /* Really a WhereBegin() call. Debug Only */ |
| 18014 | +#define SF_Distinct 0x0000001 /* Output should be DISTINCT */ |
| 18015 | +#define SF_All 0x0000002 /* Includes the ALL keyword */ |
| 18016 | +#define SF_Resolved 0x0000004 /* Identifiers have been resolved */ |
| 18017 | +#define SF_Aggregate 0x0000008 /* Contains agg functions or a GROUP BY */ |
| 18018 | +#define SF_HasAgg 0x0000010 /* Contains aggregate functions */ |
| 18019 | +#define SF_UsesEphemeral 0x0000020 /* Uses the OpenEphemeral opcode */ |
| 18020 | +#define SF_Expanded 0x0000040 /* sqlite3SelectExpand() called on this */ |
| 18021 | +#define SF_HasTypeInfo 0x0000080 /* FROM subqueries have Table metadata */ |
| 18022 | +#define SF_Compound 0x0000100 /* Part of a compound query */ |
| 18023 | +#define SF_Values 0x0000200 /* Synthesized from VALUES clause */ |
| 18024 | +#define SF_MultiValue 0x0000400 /* Single VALUES term with multiple rows */ |
| 18025 | +#define SF_NestedFrom 0x0000800 /* Part of a parenthesized FROM clause */ |
| 18026 | +#define SF_MinMaxAgg 0x0001000 /* Aggregate containing min() or max() */ |
| 18027 | +#define SF_Recursive 0x0002000 /* The recursive part of a recursive CTE */ |
| 18028 | +#define SF_FixedLimit 0x0004000 /* nSelectRow set by a constant LIMIT */ |
| 18029 | +#define SF_MaybeConvert 0x0008000 /* Need convertCompoundSelectToSubquery() */ |
| 18030 | +#define SF_Converted 0x0010000 /* By convertCompoundSelectToSubquery() */ |
| 18031 | +#define SF_IncludeHidden 0x0020000 /* Include hidden columns in output */ |
| 18032 | +#define SF_ComplexResult 0x0040000 /* Result contains subquery or function */ |
| 18033 | +#define SF_WhereBegin 0x0080000 /* Really a WhereBegin() call. Debug Only */ |
| 18034 | +#define SF_WinRewrite 0x0100000 /* Window function rewrite accomplished */ |
| 17945 | 18035 | |
| 17946 | 18036 | /* |
| 17947 | 18037 | ** The results of a SELECT can be distributed in several ways, as defined |
| 17948 | 18038 | ** by one of the following macros. The "SRT" prefix means "SELECT Result |
| 17949 | 18039 | ** Type". |
| | @@ -18531,11 +18621,11 @@ |
| 18531 | 18621 | Parse *pParse; /* Parser context. */ |
| 18532 | 18622 | int (*xExprCallback)(Walker*, Expr*); /* Callback for expressions */ |
| 18533 | 18623 | int (*xSelectCallback)(Walker*,Select*); /* Callback for SELECTs */ |
| 18534 | 18624 | void (*xSelectCallback2)(Walker*,Select*);/* Second callback for SELECTs */ |
| 18535 | 18625 | int walkerDepth; /* Number of subqueries */ |
| 18536 | | - u8 eCode; /* A small processing code */ |
| 18626 | + u16 eCode; /* A small processing code */ |
| 18537 | 18627 | union { /* Extra data for callback */ |
| 18538 | 18628 | NameContext *pNC; /* Naming context */ |
| 18539 | 18629 | int n; /* A counter */ |
| 18540 | 18630 | int iCur; /* A cursor number */ |
| 18541 | 18631 | SrcList *pSrcList; /* FROM clause */ |
| | @@ -18547,10 +18637,11 @@ |
| 18547 | 18637 | ExprList *pGroupBy; /* GROUP BY clause */ |
| 18548 | 18638 | Select *pSelect; /* HAVING to WHERE clause ctx */ |
| 18549 | 18639 | struct WindowRewrite *pRewrite; /* Window rewrite context */ |
| 18550 | 18640 | struct WhereConst *pConst; /* WHERE clause constants */ |
| 18551 | 18641 | struct RenameCtx *pRename; /* RENAME COLUMN context */ |
| 18642 | + struct Table *pTab; /* Table of generated column */ |
| 18552 | 18643 | } u; |
| 18553 | 18644 | }; |
| 18554 | 18645 | |
| 18555 | 18646 | /* Forward declarations */ |
| 18556 | 18647 | SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*); |
| | @@ -18954,11 +19045,18 @@ |
| 18954 | 19045 | SQLITE_PRIVATE int sqlite3ColumnsFromExprList(Parse*,ExprList*,i16*,Column**); |
| 18955 | 19046 | SQLITE_PRIVATE void sqlite3SelectAddColumnTypeAndCollation(Parse*,Table*,Select*,char); |
| 18956 | 19047 | SQLITE_PRIVATE Table *sqlite3ResultSetOfSelect(Parse*,Select*,char); |
| 18957 | 19048 | SQLITE_PRIVATE void sqlite3OpenMasterTable(Parse *, int); |
| 18958 | 19049 | SQLITE_PRIVATE Index *sqlite3PrimaryKeyIndex(Table*); |
| 18959 | | -SQLITE_PRIVATE i16 sqlite3ColumnOfIndex(Index*, i16); |
| 19050 | +SQLITE_PRIVATE i16 sqlite3TableColumnToIndex(Index*, i16); |
| 19051 | +#ifdef SQLITE_OMIT_GENERATED_COLUMNS |
| 19052 | +# define sqlite3TableColumnToStorage(T,X) (X) /* No-op pass-through */ |
| 19053 | +# define sqlite3StorageColumnToTable(T,X) (X) /* No-op pass-through */ |
| 19054 | +#else |
| 19055 | +SQLITE_PRIVATE i16 sqlite3TableColumnToStorage(Table*, i16); |
| 19056 | +SQLITE_PRIVATE i16 sqlite3StorageColumnToTable(Table*, i16); |
| 19057 | +#endif |
| 18960 | 19058 | SQLITE_PRIVATE void sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int); |
| 18961 | 19059 | #if SQLITE_ENABLE_HIDDEN_COLUMNS |
| 18962 | 19060 | SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table*, Column*); |
| 18963 | 19061 | #else |
| 18964 | 19062 | # define sqlite3ColumnPropertiesFromName(T,C) /* no-op */ |
| | @@ -18967,11 +19065,15 @@ |
| 18967 | 19065 | SQLITE_PRIVATE void sqlite3AddNotNull(Parse*, int); |
| 18968 | 19066 | SQLITE_PRIVATE void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int); |
| 18969 | 19067 | SQLITE_PRIVATE void sqlite3AddCheckConstraint(Parse*, Expr*); |
| 18970 | 19068 | SQLITE_PRIVATE void sqlite3AddDefaultValue(Parse*,Expr*,const char*,const char*); |
| 18971 | 19069 | SQLITE_PRIVATE void sqlite3AddCollateType(Parse*, Token*); |
| 19070 | +SQLITE_PRIVATE void sqlite3AddGenerated(Parse*,Expr*,Token*); |
| 18972 | 19071 | SQLITE_PRIVATE void sqlite3EndTable(Parse*,Token*,Token*,u8,Select*); |
| 19072 | +#ifdef SQLITE_DEBUG |
| 19073 | +SQLITE_PRIVATE int sqlite3UriCount(const char*); |
| 19074 | +#endif |
| 18973 | 19075 | SQLITE_PRIVATE int sqlite3ParseUri(const char*,const char*,unsigned int*, |
| 18974 | 19076 | sqlite3_vfs**,char**,char **); |
| 18975 | 19077 | #ifdef SQLITE_HAS_CODEC |
| 18976 | 19078 | SQLITE_PRIVATE int sqlite3CodecQueryParameters(sqlite3*,const char*,const char*); |
| 18977 | 19079 | #else |
| | @@ -19024,10 +19126,13 @@ |
| 19024 | 19126 | #else |
| 19025 | 19127 | # define sqlite3AutoincrementBegin(X) |
| 19026 | 19128 | # define sqlite3AutoincrementEnd(X) |
| 19027 | 19129 | #endif |
| 19028 | 19130 | SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int, Upsert*); |
| 19131 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 19132 | +SQLITE_PRIVATE void sqlite3ComputeGeneratedColumns(Parse*, int, Table*); |
| 19133 | +#endif |
| 19029 | 19134 | SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*); |
| 19030 | 19135 | SQLITE_PRIVATE IdList *sqlite3IdListAppend(Parse*, IdList*, Token*); |
| 19031 | 19136 | SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*); |
| 19032 | 19137 | SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(Parse*, SrcList*, int, int); |
| 19033 | 19138 | SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(Parse*, SrcList*, Token*, Token*); |
| | @@ -19073,16 +19178,18 @@ |
| 19073 | 19178 | SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn(Parse*, Index*, int, int, int); |
| 19074 | 19179 | SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, u8); |
| 19075 | 19180 | SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int); |
| 19076 | 19181 | SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int); |
| 19077 | 19182 | SQLITE_PRIVATE void sqlite3ExprCode(Parse*, Expr*, int); |
| 19183 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 19184 | +SQLITE_PRIVATE void sqlite3ExprCodeGeneratedColumn(Parse*, Column*, int); |
| 19185 | +#endif |
| 19078 | 19186 | SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, Expr*, int); |
| 19079 | 19187 | SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse*, Expr*, int); |
| 19080 | 19188 | SQLITE_PRIVATE int sqlite3ExprCodeAtInit(Parse*, Expr*, int); |
| 19081 | 19189 | SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*); |
| 19082 | 19190 | SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse*, Expr*, int); |
| 19083 | | -SQLITE_PRIVATE void sqlite3ExprCodeAndCache(Parse*, Expr*, int); |
| 19084 | 19191 | SQLITE_PRIVATE int sqlite3ExprCodeExprList(Parse*, ExprList*, int, int, u8); |
| 19085 | 19192 | #define SQLITE_ECEL_DUP 0x01 /* Deep, not shallow copies */ |
| 19086 | 19193 | #define SQLITE_ECEL_FACTOR 0x02 /* Factor out constant terms */ |
| 19087 | 19194 | #define SQLITE_ECEL_REF 0x04 /* Use ExprList.u.x.iOrderByCol */ |
| 19088 | 19195 | #define SQLITE_ECEL_OMITREF 0x08 /* Omit if ExprList.u.x.iOrderByCol */ |
| | @@ -19215,10 +19322,11 @@ |
| 19215 | 19322 | # define sqlite3IsToplevel(p) 1 |
| 19216 | 19323 | # define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0 |
| 19217 | 19324 | #endif |
| 19218 | 19325 | |
| 19219 | 19326 | SQLITE_PRIVATE int sqlite3JoinType(Parse*, Token*, Token*, Token*); |
| 19327 | +SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr*,int); |
| 19220 | 19328 | SQLITE_PRIVATE void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int); |
| 19221 | 19329 | SQLITE_PRIVATE void sqlite3DeferForeignKey(Parse*, int); |
| 19222 | 19330 | #ifndef SQLITE_OMIT_AUTHORIZATION |
| 19223 | 19331 | SQLITE_PRIVATE void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*); |
| 19224 | 19332 | SQLITE_PRIVATE int sqlite3AuthCheck(Parse*,int, const char*, const char*, const char*); |
| | @@ -19512,10 +19620,16 @@ |
| 19512 | 19620 | const sqlite3_module*, |
| 19513 | 19621 | void*, |
| 19514 | 19622 | void(*)(void*) |
| 19515 | 19623 | ); |
| 19516 | 19624 | # define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0) |
| 19625 | +#endif |
| 19626 | +SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db); |
| 19627 | +#ifndef SQLITE_OMIT_VIRTUALTABLE |
| 19628 | +SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName); |
| 19629 | +#else |
| 19630 | +# define sqlite3ShadowTableName(A,B) 0 |
| 19517 | 19631 | #endif |
| 19518 | 19632 | SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse*,Module*); |
| 19519 | 19633 | SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3*,Module*); |
| 19520 | 19634 | SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*); |
| 19521 | 19635 | SQLITE_PRIVATE void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*, int); |
| | @@ -19534,10 +19648,11 @@ |
| 19534 | 19648 | #ifdef SQLITE_ENABLE_NORMALIZE |
| 19535 | 19649 | SQLITE_PRIVATE char *sqlite3Normalize(Vdbe*, const char*); |
| 19536 | 19650 | #endif |
| 19537 | 19651 | SQLITE_PRIVATE int sqlite3Reprepare(Vdbe*); |
| 19538 | 19652 | SQLITE_PRIVATE void sqlite3ExprListCheckLength(Parse*, ExprList*, const char*); |
| 19653 | +SQLITE_PRIVATE CollSeq *sqlite3ExprCompareCollSeq(Parse*,Expr*); |
| 19539 | 19654 | SQLITE_PRIVATE CollSeq *sqlite3BinaryCompareCollSeq(Parse *, Expr *, Expr *); |
| 19540 | 19655 | SQLITE_PRIVATE int sqlite3TempInMemory(const sqlite3*); |
| 19541 | 19656 | SQLITE_PRIVATE const char *sqlite3JournalModename(int); |
| 19542 | 19657 | #ifndef SQLITE_OMIT_WAL |
| 19543 | 19658 | SQLITE_PRIVATE int sqlite3Checkpoint(sqlite3*, int, int, int*, int*); |
| | @@ -20376,11 +20491,12 @@ |
| 20376 | 20491 | |
| 20377 | 20492 | /* |
| 20378 | 20493 | ** True if Mem X is a NULL-nochng type. |
| 20379 | 20494 | */ |
| 20380 | 20495 | #define MemNullNochng(X) \ |
| 20381 | | - ((X)->flags==(MEM_Null|MEM_Zero) && (X)->n==0 && (X)->u.nZero==0) |
| 20496 | + (((X)->flags&MEM_TypeMask)==(MEM_Null|MEM_Zero) \ |
| 20497 | + && (X)->n==0 && (X)->u.nZero==0) |
| 20382 | 20498 | |
| 20383 | 20499 | /* |
| 20384 | 20500 | ** Return true if a memory cell is not marked as invalid. This macro |
| 20385 | 20501 | ** is for use inside assert() statements only. |
| 20386 | 20502 | */ |
| | @@ -26056,11 +26172,11 @@ |
| 26056 | 26172 | ** May you share freely, never taking more than you give. |
| 26057 | 26173 | ** |
| 26058 | 26174 | ****************************************************************************** |
| 26059 | 26175 | ** |
| 26060 | 26176 | ** This file contains inline asm code for retrieving "high-performance" |
| 26061 | | -** counters for x86 class CPUs. |
| 26177 | +** counters for x86 and x86_64 class CPUs. |
| 26062 | 26178 | */ |
| 26063 | 26179 | #ifndef SQLITE_HWTIME_H |
| 26064 | 26180 | #define SQLITE_HWTIME_H |
| 26065 | 26181 | |
| 26066 | 26182 | /* |
| | @@ -26067,12 +26183,13 @@ |
| 26067 | 26183 | ** The following routine only works on pentium-class (or newer) processors. |
| 26068 | 26184 | ** It uses the RDTSC opcode to read the cycle count value out of the |
| 26069 | 26185 | ** processor and returns that value. This can be used for high-res |
| 26070 | 26186 | ** profiling. |
| 26071 | 26187 | */ |
| 26072 | | -#if (defined(__GNUC__) || defined(_MSC_VER)) && \ |
| 26073 | | - (defined(i386) || defined(__i386__) || defined(_M_IX86)) |
| 26188 | +#if !defined(__STRICT_ANSI__) && \ |
| 26189 | + (defined(__GNUC__) || defined(_MSC_VER)) && \ |
| 26190 | + (defined(i386) || defined(__i386__) || defined(_M_IX86)) |
| 26074 | 26191 | |
| 26075 | 26192 | #if defined(__GNUC__) |
| 26076 | 26193 | |
| 26077 | 26194 | __inline__ sqlite_uint64 sqlite3Hwtime(void){ |
| 26078 | 26195 | unsigned int lo, hi; |
| | @@ -26089,19 +26206,19 @@ |
| 26089 | 26206 | } |
| 26090 | 26207 | } |
| 26091 | 26208 | |
| 26092 | 26209 | #endif |
| 26093 | 26210 | |
| 26094 | | -#elif (defined(__GNUC__) && defined(__x86_64__)) |
| 26211 | +#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__x86_64__)) |
| 26095 | 26212 | |
| 26096 | 26213 | __inline__ sqlite_uint64 sqlite3Hwtime(void){ |
| 26097 | 26214 | unsigned long val; |
| 26098 | 26215 | __asm__ __volatile__ ("rdtsc" : "=A" (val)); |
| 26099 | 26216 | return val; |
| 26100 | 26217 | } |
| 26101 | 26218 | |
| 26102 | | -#elif (defined(__GNUC__) && defined(__ppc__)) |
| 26219 | +#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__ppc__)) |
| 26103 | 26220 | |
| 26104 | 26221 | __inline__ sqlite_uint64 sqlite3Hwtime(void){ |
| 26105 | 26222 | unsigned long long retval; |
| 26106 | 26223 | unsigned long junk; |
| 26107 | 26224 | __asm__ __volatile__ ("\n\ |
| | @@ -26114,18 +26231,17 @@ |
| 26114 | 26231 | return retval; |
| 26115 | 26232 | } |
| 26116 | 26233 | |
| 26117 | 26234 | #else |
| 26118 | 26235 | |
| 26119 | | - #error Need implementation of sqlite3Hwtime() for your platform. |
| 26120 | | - |
| 26121 | 26236 | /* |
| 26122 | | - ** To compile without implementing sqlite3Hwtime() for your platform, |
| 26123 | | - ** you can remove the above #error and use the following |
| 26124 | | - ** stub function. You will lose timing support for many |
| 26125 | | - ** of the debugging and testing utilities, but it should at |
| 26126 | | - ** least compile and run. |
| 26237 | + ** asm() is needed for hardware timing support. Without asm(), |
| 26238 | + ** disable the sqlite3Hwtime() routine. |
| 26239 | + ** |
| 26240 | + ** sqlite3Hwtime() is only used for some obscure debugging |
| 26241 | + ** and analysis configurations, not in any deliverable, so this |
| 26242 | + ** should not be a great loss. |
| 26127 | 26243 | */ |
| 26128 | 26244 | SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } |
| 26129 | 26245 | |
| 26130 | 26246 | #endif |
| 26131 | 26247 | |
| | @@ -26705,23 +26821,31 @@ |
| 26705 | 26821 | UNUSED_PARAMETER(n); |
| 26706 | 26822 | return 0; |
| 26707 | 26823 | #endif |
| 26708 | 26824 | } |
| 26709 | 26825 | |
| 26826 | +/* |
| 26827 | +** Default value of the hard heap limit. 0 means "no limit". |
| 26828 | +*/ |
| 26829 | +#ifndef SQLITE_MAX_MEMORY |
| 26830 | +# define SQLITE_MAX_MEMORY 0 |
| 26831 | +#endif |
| 26832 | + |
| 26710 | 26833 | /* |
| 26711 | 26834 | ** State information local to the memory allocation subsystem. |
| 26712 | 26835 | */ |
| 26713 | 26836 | static SQLITE_WSD struct Mem0Global { |
| 26714 | 26837 | sqlite3_mutex *mutex; /* Mutex to serialize access */ |
| 26715 | 26838 | sqlite3_int64 alarmThreshold; /* The soft heap limit */ |
| 26839 | + sqlite3_int64 hardLimit; /* The hard upper bound on memory */ |
| 26716 | 26840 | |
| 26717 | 26841 | /* |
| 26718 | 26842 | ** True if heap is nearly "full" where "full" is defined by the |
| 26719 | 26843 | ** sqlite3_soft_heap_limit() setting. |
| 26720 | 26844 | */ |
| 26721 | 26845 | int nearlyFull; |
| 26722 | | -} mem0 = { 0, 0, 0 }; |
| 26846 | +} mem0 = { 0, SQLITE_MAX_MEMORY, SQLITE_MAX_MEMORY, 0 }; |
| 26723 | 26847 | |
| 26724 | 26848 | #define mem0 GLOBAL(struct Mem0Global, mem0) |
| 26725 | 26849 | |
| 26726 | 26850 | /* |
| 26727 | 26851 | ** Return the memory allocator mutex. sqlite3_status() needs it. |
| | @@ -26747,12 +26871,19 @@ |
| 26747 | 26871 | return SQLITE_OK; |
| 26748 | 26872 | } |
| 26749 | 26873 | #endif |
| 26750 | 26874 | |
| 26751 | 26875 | /* |
| 26752 | | -** Set the soft heap-size limit for the library. Passing a zero or |
| 26753 | | -** negative value indicates no limit. |
| 26876 | +** Set the soft heap-size limit for the library. An argument of |
| 26877 | +** zero disables the limit. A negative argument is a no-op used to |
| 26878 | +** obtain the return value. |
| 26879 | +** |
| 26880 | +** The return value is the value of the heap limit just before this |
| 26881 | +** interface was called. |
| 26882 | +** |
| 26883 | +** If the hard heap limit is enabled, then the soft heap limit cannot |
| 26884 | +** be disabled nor raised above the hard heap limit. |
| 26754 | 26885 | */ |
| 26755 | 26886 | SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 n){ |
| 26756 | 26887 | sqlite3_int64 priorLimit; |
| 26757 | 26888 | sqlite3_int64 excess; |
| 26758 | 26889 | sqlite3_int64 nUsed; |
| | @@ -26763,10 +26894,13 @@ |
| 26763 | 26894 | sqlite3_mutex_enter(mem0.mutex); |
| 26764 | 26895 | priorLimit = mem0.alarmThreshold; |
| 26765 | 26896 | if( n<0 ){ |
| 26766 | 26897 | sqlite3_mutex_leave(mem0.mutex); |
| 26767 | 26898 | return priorLimit; |
| 26899 | + } |
| 26900 | + if( mem0.hardLimit>0 && (n>mem0.hardLimit || n==0) ){ |
| 26901 | + n = mem0.hardLimit; |
| 26768 | 26902 | } |
| 26769 | 26903 | mem0.alarmThreshold = n; |
| 26770 | 26904 | nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED); |
| 26771 | 26905 | mem0.nearlyFull = (n>0 && n<=nUsed); |
| 26772 | 26906 | sqlite3_mutex_leave(mem0.mutex); |
| | @@ -26776,10 +26910,41 @@ |
| 26776 | 26910 | } |
| 26777 | 26911 | SQLITE_API void sqlite3_soft_heap_limit(int n){ |
| 26778 | 26912 | if( n<0 ) n = 0; |
| 26779 | 26913 | sqlite3_soft_heap_limit64(n); |
| 26780 | 26914 | } |
| 26915 | + |
| 26916 | +/* |
| 26917 | +** Set the hard heap-size limit for the library. An argument of zero |
| 26918 | +** disables the hard heap limit. A negative argument is a no-op used |
| 26919 | +** to obtain the return value without affecting the hard heap limit. |
| 26920 | +** |
| 26921 | +** The return value is the value of the hard heap limit just prior to |
| 26922 | +** calling this interface. |
| 26923 | +** |
| 26924 | +** Setting the hard heap limit will also activate the soft heap limit |
| 26925 | +** and constrain the soft heap limit to be no more than the hard heap |
| 26926 | +** limit. |
| 26927 | +*/ |
| 26928 | +SQLITE_API sqlite3_int64 sqlite3_hard_heap_limit64(sqlite3_int64 n){ |
| 26929 | + sqlite3_int64 priorLimit; |
| 26930 | +#ifndef SQLITE_OMIT_AUTOINIT |
| 26931 | + int rc = sqlite3_initialize(); |
| 26932 | + if( rc ) return -1; |
| 26933 | +#endif |
| 26934 | + sqlite3_mutex_enter(mem0.mutex); |
| 26935 | + priorLimit = mem0.hardLimit; |
| 26936 | + if( n>=0 ){ |
| 26937 | + mem0.hardLimit = n; |
| 26938 | + if( n<mem0.alarmThreshold || mem0.alarmThreshold==0 ){ |
| 26939 | + mem0.alarmThreshold = n; |
| 26940 | + } |
| 26941 | + } |
| 26942 | + sqlite3_mutex_leave(mem0.mutex); |
| 26943 | + return priorLimit; |
| 26944 | +} |
| 26945 | + |
| 26781 | 26946 | |
| 26782 | 26947 | /* |
| 26783 | 26948 | ** Initialize the memory allocation subsystem. |
| 26784 | 26949 | */ |
| 26785 | 26950 | SQLITE_PRIVATE int sqlite3MallocInit(void){ |
| | @@ -26863,23 +27028,23 @@ |
| 26863 | 27028 | ** mode and specifically when the DMD "Dark Matter Detector" is enabled |
| 26864 | 27029 | ** or else a crash results. Hence, do not attempt to optimize out the |
| 26865 | 27030 | ** following xRoundup() call. */ |
| 26866 | 27031 | nFull = sqlite3GlobalConfig.m.xRoundup(n); |
| 26867 | 27032 | |
| 26868 | | -#ifdef SQLITE_MAX_MEMORY |
| 26869 | | - if( sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED)+nFull>SQLITE_MAX_MEMORY ){ |
| 26870 | | - *pp = 0; |
| 26871 | | - return; |
| 26872 | | - } |
| 26873 | | -#endif |
| 26874 | | - |
| 26875 | 27033 | sqlite3StatusHighwater(SQLITE_STATUS_MALLOC_SIZE, n); |
| 26876 | 27034 | if( mem0.alarmThreshold>0 ){ |
| 26877 | 27035 | sqlite3_int64 nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED); |
| 26878 | 27036 | if( nUsed >= mem0.alarmThreshold - nFull ){ |
| 26879 | 27037 | mem0.nearlyFull = 1; |
| 26880 | 27038 | sqlite3MallocAlarm(nFull); |
| 27039 | + if( mem0.hardLimit ){ |
| 27040 | + nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED); |
| 27041 | + if( nUsed >= mem0.hardLimit - nFull ){ |
| 27042 | + *pp = 0; |
| 27043 | + return; |
| 27044 | + } |
| 27045 | + } |
| 26881 | 27046 | }else{ |
| 26882 | 27047 | mem0.nearlyFull = 0; |
| 26883 | 27048 | } |
| 26884 | 27049 | } |
| 26885 | 27050 | p = sqlite3GlobalConfig.m.xMalloc(nFull); |
| | @@ -26971,11 +27136,11 @@ |
| 26971 | 27136 | } |
| 26972 | 27137 | #endif |
| 26973 | 27138 | return sqlite3GlobalConfig.m.xSize(p); |
| 26974 | 27139 | }else{ |
| 26975 | 27140 | assert( sqlite3_mutex_held(db->mutex) ); |
| 26976 | | - return db->lookaside.sz; |
| 27141 | + return db->lookaside.szTrue; |
| 26977 | 27142 | } |
| 26978 | 27143 | } |
| 26979 | 27144 | SQLITE_API sqlite3_uint64 sqlite3_msize(void *p){ |
| 26980 | 27145 | assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) ); |
| 26981 | 27146 | assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) ); |
| | @@ -27023,11 +27188,11 @@ |
| 27023 | 27188 | } |
| 27024 | 27189 | if( isLookaside(db, p) ){ |
| 27025 | 27190 | LookasideSlot *pBuf = (LookasideSlot*)p; |
| 27026 | 27191 | #ifdef SQLITE_DEBUG |
| 27027 | 27192 | /* Trash all content in the buffer being freed */ |
| 27028 | | - memset(p, 0xaa, db->lookaside.sz); |
| 27193 | + memset(p, 0xaa, db->lookaside.szTrue); |
| 27029 | 27194 | #endif |
| 27030 | 27195 | pBuf->pNext = db->lookaside.pFree; |
| 27031 | 27196 | db->lookaside.pFree = pBuf; |
| 27032 | 27197 | return; |
| 27033 | 27198 | } |
| | @@ -27183,27 +27348,25 @@ |
| 27183 | 27348 | #ifndef SQLITE_OMIT_LOOKASIDE |
| 27184 | 27349 | LookasideSlot *pBuf; |
| 27185 | 27350 | assert( db!=0 ); |
| 27186 | 27351 | assert( sqlite3_mutex_held(db->mutex) ); |
| 27187 | 27352 | assert( db->pnBytesFreed==0 ); |
| 27188 | | - if( db->lookaside.bDisable==0 ){ |
| 27189 | | - assert( db->mallocFailed==0 ); |
| 27190 | | - if( n>db->lookaside.sz ){ |
| 27191 | | - db->lookaside.anStat[1]++; |
| 27192 | | - }else if( (pBuf = db->lookaside.pFree)!=0 ){ |
| 27193 | | - db->lookaside.pFree = pBuf->pNext; |
| 27194 | | - db->lookaside.anStat[0]++; |
| 27195 | | - return (void*)pBuf; |
| 27196 | | - }else if( (pBuf = db->lookaside.pInit)!=0 ){ |
| 27197 | | - db->lookaside.pInit = pBuf->pNext; |
| 27198 | | - db->lookaside.anStat[0]++; |
| 27199 | | - return (void*)pBuf; |
| 27200 | | - }else{ |
| 27201 | | - db->lookaside.anStat[2]++; |
| 27202 | | - } |
| 27203 | | - }else if( db->mallocFailed ){ |
| 27204 | | - return 0; |
| 27353 | + if( n>db->lookaside.sz ){ |
| 27354 | + if( db->lookaside.bDisable ){ |
| 27355 | + return db->mallocFailed ? 0 : dbMallocRawFinish(db, n); |
| 27356 | + } |
| 27357 | + db->lookaside.anStat[1]++; |
| 27358 | + }else if( (pBuf = db->lookaside.pFree)!=0 ){ |
| 27359 | + db->lookaside.pFree = pBuf->pNext; |
| 27360 | + db->lookaside.anStat[0]++; |
| 27361 | + return (void*)pBuf; |
| 27362 | + }else if( (pBuf = db->lookaside.pInit)!=0 ){ |
| 27363 | + db->lookaside.pInit = pBuf->pNext; |
| 27364 | + db->lookaside.anStat[0]++; |
| 27365 | + return (void*)pBuf; |
| 27366 | + }else{ |
| 27367 | + db->lookaside.anStat[2]++; |
| 27205 | 27368 | } |
| 27206 | 27369 | #else |
| 27207 | 27370 | assert( db!=0 ); |
| 27208 | 27371 | assert( sqlite3_mutex_held(db->mutex) ); |
| 27209 | 27372 | assert( db->pnBytesFreed==0 ); |
| | @@ -27223,11 +27386,11 @@ |
| 27223 | 27386 | */ |
| 27224 | 27387 | SQLITE_PRIVATE void *sqlite3DbRealloc(sqlite3 *db, void *p, u64 n){ |
| 27225 | 27388 | assert( db!=0 ); |
| 27226 | 27389 | if( p==0 ) return sqlite3DbMallocRawNN(db, n); |
| 27227 | 27390 | assert( sqlite3_mutex_held(db->mutex) ); |
| 27228 | | - if( isLookaside(db,p) && n<=db->lookaside.sz ) return p; |
| 27391 | + if( isLookaside(db,p) && n<=db->lookaside.szTrue ) return p; |
| 27229 | 27392 | return dbReallocFinish(db, p, n); |
| 27230 | 27393 | } |
| 27231 | 27394 | static SQLITE_NOINLINE void *dbReallocFinish(sqlite3 *db, void *p, u64 n){ |
| 27232 | 27395 | void *pNew = 0; |
| 27233 | 27396 | assert( db!=0 ); |
| | @@ -27234,11 +27397,11 @@ |
| 27234 | 27397 | assert( p!=0 ); |
| 27235 | 27398 | if( db->mallocFailed==0 ){ |
| 27236 | 27399 | if( isLookaside(db, p) ){ |
| 27237 | 27400 | pNew = sqlite3DbMallocRawNN(db, n); |
| 27238 | 27401 | if( pNew ){ |
| 27239 | | - memcpy(pNew, p, db->lookaside.sz); |
| 27402 | + memcpy(pNew, p, db->lookaside.szTrue); |
| 27240 | 27403 | sqlite3DbFree(db, p); |
| 27241 | 27404 | } |
| 27242 | 27405 | }else{ |
| 27243 | 27406 | assert( sqlite3MemdebugHasType(p, (MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); |
| 27244 | 27407 | assert( sqlite3MemdebugNoType(p, (u8)~(MEMTYPE_LOOKASIDE|MEMTYPE_HEAP)) ); |
| | @@ -27333,11 +27496,11 @@ |
| 27333 | 27496 | if( db->mallocFailed==0 && db->bBenignMalloc==0 ){ |
| 27334 | 27497 | db->mallocFailed = 1; |
| 27335 | 27498 | if( db->nVdbeExec>0 ){ |
| 27336 | 27499 | db->u1.isInterrupted = 1; |
| 27337 | 27500 | } |
| 27338 | | - db->lookaside.bDisable++; |
| 27501 | + DisableLookaside; |
| 27339 | 27502 | if( db->pParse ){ |
| 27340 | 27503 | db->pParse->rc = SQLITE_NOMEM_BKPT; |
| 27341 | 27504 | } |
| 27342 | 27505 | } |
| 27343 | 27506 | } |
| | @@ -27352,11 +27515,11 @@ |
| 27352 | 27515 | SQLITE_PRIVATE void sqlite3OomClear(sqlite3 *db){ |
| 27353 | 27516 | if( db->mallocFailed && db->nVdbeExec==0 ){ |
| 27354 | 27517 | db->mallocFailed = 0; |
| 27355 | 27518 | db->u1.isInterrupted = 0; |
| 27356 | 27519 | assert( db->lookaside.bDisable>0 ); |
| 27357 | | - db->lookaside.bDisable--; |
| 27520 | + EnableLookaside; |
| 27358 | 27521 | } |
| 27359 | 27522 | } |
| 27360 | 27523 | |
| 27361 | 27524 | /* |
| 27362 | 27525 | ** Take actions at the end of an API call to indicate an OOM error |
| | @@ -28760,11 +28923,11 @@ |
| 28760 | 28923 | } |
| 28761 | 28924 | if( zFormat!=0 ){ |
| 28762 | 28925 | va_start(ap, zFormat); |
| 28763 | 28926 | sqlite3_str_vappendf(&acc, zFormat, ap); |
| 28764 | 28927 | va_end(ap); |
| 28765 | | - assert( acc.nChar>0 ); |
| 28928 | + assert( acc.nChar>0 || acc.accError ); |
| 28766 | 28929 | sqlite3_str_append(&acc, "\n", 1); |
| 28767 | 28930 | } |
| 28768 | 28931 | sqlite3StrAccumFinish(&acc); |
| 28769 | 28932 | fprintf(stdout,"%s", zBuf); |
| 28770 | 28933 | fflush(stdout); |
| | @@ -28825,11 +28988,11 @@ |
| 28825 | 28988 | for(i=0; i<pSrc->nSrc; i++){ |
| 28826 | 28989 | const struct SrcList_item *pItem = &pSrc->a[i]; |
| 28827 | 28990 | StrAccum x; |
| 28828 | 28991 | char zLine[100]; |
| 28829 | 28992 | sqlite3StrAccumInit(&x, 0, zLine, sizeof(zLine), 0); |
| 28830 | | - sqlite3_str_appendf(&x, "{%d,*}", pItem->iCursor); |
| 28993 | + sqlite3_str_appendf(&x, "{%d:*}", pItem->iCursor); |
| 28831 | 28994 | if( pItem->zDatabase ){ |
| 28832 | 28995 | sqlite3_str_appendf(&x, " %s.%s", pItem->zDatabase, pItem->zName); |
| 28833 | 28996 | }else if( pItem->zName ){ |
| 28834 | 28997 | sqlite3_str_appendf(&x, " %s", pItem->zName); |
| 28835 | 28998 | } |
| | @@ -29117,11 +29280,18 @@ |
| 29117 | 29280 | break; |
| 29118 | 29281 | } |
| 29119 | 29282 | case TK_COLUMN: { |
| 29120 | 29283 | if( pExpr->iTable<0 ){ |
| 29121 | 29284 | /* This only happens when coding check constraints */ |
| 29122 | | - sqlite3TreeViewLine(pView, "COLUMN(%d)%s", pExpr->iColumn, zFlgs); |
| 29285 | + char zOp2[16]; |
| 29286 | + if( pExpr->op2 ){ |
| 29287 | + sqlite3_snprintf(sizeof(zOp2),zOp2," op2=0x%02x",pExpr->op2); |
| 29288 | + }else{ |
| 29289 | + zOp2[0] = 0; |
| 29290 | + } |
| 29291 | + sqlite3TreeViewLine(pView, "COLUMN(%d)%s%s", |
| 29292 | + pExpr->iColumn, zFlgs, zOp2); |
| 29123 | 29293 | }else{ |
| 29124 | 29294 | sqlite3TreeViewLine(pView, "{%d:%d}%s", |
| 29125 | 29295 | pExpr->iTable, pExpr->iColumn, zFlgs); |
| 29126 | 29296 | } |
| 29127 | 29297 | if( ExprHasProperty(pExpr, EP_FixedCol) ){ |
| | @@ -29260,10 +29430,21 @@ |
| 29260 | 29430 | #endif |
| 29261 | 29431 | } |
| 29262 | 29432 | if( pExpr->op==TK_AGG_FUNCTION ){ |
| 29263 | 29433 | sqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q%s", |
| 29264 | 29434 | pExpr->op2, pExpr->u.zToken, zFlgs); |
| 29435 | + }else if( pExpr->op2!=0 ){ |
| 29436 | + const char *zOp2; |
| 29437 | + char zBuf[8]; |
| 29438 | + sqlite3_snprintf(sizeof(zBuf),zBuf,"0x%02x",pExpr->op2); |
| 29439 | + zOp2 = zBuf; |
| 29440 | + if( pExpr->op2==NC_IsCheck ) zOp2 = "NC_IsCheck"; |
| 29441 | + if( pExpr->op2==NC_IdxExpr ) zOp2 = "NC_IdxExpr"; |
| 29442 | + if( pExpr->op2==NC_PartIdx ) zOp2 = "NC_PartIdx"; |
| 29443 | + if( pExpr->op2==NC_GenCol ) zOp2 = "NC_GenCol"; |
| 29444 | + sqlite3TreeViewLine(pView, "FUNCTION %Q%s op2=%s", |
| 29445 | + pExpr->u.zToken, zFlgs, zOp2); |
| 29265 | 29446 | }else{ |
| 29266 | 29447 | sqlite3TreeViewLine(pView, "FUNCTION %Q%s", pExpr->u.zToken, zFlgs); |
| 29267 | 29448 | } |
| 29268 | 29449 | if( pFarg ){ |
| 29269 | 29450 | sqlite3TreeViewExprList(pView, pFarg, pWin!=0, 0); |
| | @@ -29355,11 +29536,13 @@ |
| 29355 | 29536 | pExpr->iTable, pExpr->iColumn, zFlgs); |
| 29356 | 29537 | sqlite3TreeViewExpr(pView, pExpr->pRight, 0); |
| 29357 | 29538 | break; |
| 29358 | 29539 | } |
| 29359 | 29540 | case TK_VECTOR: { |
| 29360 | | - sqlite3TreeViewBareExprList(pView, pExpr->x.pList, "VECTOR"); |
| 29541 | + char *z = sqlite3_mprintf("VECTOR%s",zFlgs); |
| 29542 | + sqlite3TreeViewBareExprList(pView, pExpr->x.pList, z); |
| 29543 | + sqlite3_free(z); |
| 29361 | 29544 | break; |
| 29362 | 29545 | } |
| 29363 | 29546 | case TK_SELECT_COLUMN: { |
| 29364 | 29547 | sqlite3TreeViewLine(pView, "SELECT-COLUMN %d", pExpr->iColumn); |
| 29365 | 29548 | sqlite3TreeViewSelect(pView, pExpr->pLeft->x.pSelect, 0); |
| | @@ -30581,10 +30764,11 @@ |
| 30581 | 30764 | }else{ |
| 30582 | 30765 | pParse->nErr++; |
| 30583 | 30766 | sqlite3DbFree(db, pParse->zErrMsg); |
| 30584 | 30767 | pParse->zErrMsg = zMsg; |
| 30585 | 30768 | pParse->rc = SQLITE_ERROR; |
| 30769 | + pParse->pWith = 0; |
| 30586 | 30770 | } |
| 30587 | 30771 | } |
| 30588 | 30772 | |
| 30589 | 30773 | /* |
| 30590 | 30774 | ** If database connection db is currently parsing SQL, then transfer |
| | @@ -30771,10 +30955,13 @@ |
| 30771 | 30955 | ** |
| 30772 | 30956 | ** If some prefix of the input string is a valid number, this routine |
| 30773 | 30957 | ** returns FALSE but it still converts the prefix and writes the result |
| 30774 | 30958 | ** into *pResult. |
| 30775 | 30959 | */ |
| 30960 | +#if defined(_MSC_VER) |
| 30961 | +#pragma warning(disable : 4756) |
| 30962 | +#endif |
| 30776 | 30963 | SQLITE_PRIVATE int sqlite3AtoF(const char *z, double *pResult, int length, u8 enc){ |
| 30777 | 30964 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| 30778 | 30965 | int incr; |
| 30779 | 30966 | const char *zEnd = z + length; |
| 30780 | 30967 | /* sign * significand * (10 ^ (esign * exponent)) */ |
| | @@ -30958,10 +31145,13 @@ |
| 30958 | 31145 | } |
| 30959 | 31146 | #else |
| 30960 | 31147 | return !sqlite3Atoi64(z, pResult, length, enc); |
| 30961 | 31148 | #endif /* SQLITE_OMIT_FLOATING_POINT */ |
| 30962 | 31149 | } |
| 31150 | +#if defined(_MSC_VER) |
| 31151 | +#pragma warning(default : 4756) |
| 31152 | +#endif |
| 30963 | 31153 | |
| 30964 | 31154 | /* |
| 30965 | 31155 | ** Compare the 19-character string zNum against the text representation |
| 30966 | 31156 | ** value 2^63: 9223372036854775808. Return negative, zero, or positive |
| 30967 | 31157 | ** if zNum is less than, equal to, or greater than the string. |
| | @@ -32364,121 +32554,119 @@ |
| 32364 | 32554 | /* 57 */ "Ge" OpHelp("IF r[P3]>=r[P1]"), |
| 32365 | 32555 | /* 58 */ "ElseNotEq" OpHelp(""), |
| 32366 | 32556 | /* 59 */ "IncrVacuum" OpHelp(""), |
| 32367 | 32557 | /* 60 */ "VNext" OpHelp(""), |
| 32368 | 32558 | /* 61 */ "Init" OpHelp("Start at P2"), |
| 32369 | | - /* 62 */ "PureFunc0" OpHelp(""), |
| 32370 | | - /* 63 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"), |
| 32371 | | - /* 64 */ "PureFunc" OpHelp(""), |
| 32372 | | - /* 65 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"), |
| 32373 | | - /* 66 */ "Return" OpHelp(""), |
| 32374 | | - /* 67 */ "EndCoroutine" OpHelp(""), |
| 32375 | | - /* 68 */ "HaltIfNull" OpHelp("if r[P3]=null halt"), |
| 32376 | | - /* 69 */ "Halt" OpHelp(""), |
| 32377 | | - /* 70 */ "Integer" OpHelp("r[P2]=P1"), |
| 32378 | | - /* 71 */ "Int64" OpHelp("r[P2]=P4"), |
| 32379 | | - /* 72 */ "String" OpHelp("r[P2]='P4' (len=P1)"), |
| 32380 | | - /* 73 */ "Null" OpHelp("r[P2..P3]=NULL"), |
| 32381 | | - /* 74 */ "SoftNull" OpHelp("r[P1]=NULL"), |
| 32382 | | - /* 75 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), |
| 32383 | | - /* 76 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), |
| 32384 | | - /* 77 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), |
| 32385 | | - /* 78 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), |
| 32386 | | - /* 79 */ "SCopy" OpHelp("r[P2]=r[P1]"), |
| 32387 | | - /* 80 */ "IntCopy" OpHelp("r[P2]=r[P1]"), |
| 32388 | | - /* 81 */ "ResultRow" OpHelp("output=r[P1@P2]"), |
| 32389 | | - /* 82 */ "CollSeq" OpHelp(""), |
| 32390 | | - /* 83 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), |
| 32391 | | - /* 84 */ "RealAffinity" OpHelp(""), |
| 32392 | | - /* 85 */ "Cast" OpHelp("affinity(r[P1])"), |
| 32393 | | - /* 86 */ "Permutation" OpHelp(""), |
| 32394 | | - /* 87 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), |
| 32395 | | - /* 88 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"), |
| 32396 | | - /* 89 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"), |
| 32397 | | - /* 90 */ "Column" OpHelp("r[P3]=PX"), |
| 32398 | | - /* 91 */ "Affinity" OpHelp("affinity(r[P1@P2])"), |
| 32399 | | - /* 92 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), |
| 32400 | | - /* 93 */ "Count" OpHelp("r[P2]=count()"), |
| 32401 | | - /* 94 */ "ReadCookie" OpHelp(""), |
| 32402 | | - /* 95 */ "SetCookie" OpHelp(""), |
| 32403 | | - /* 96 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), |
| 32404 | | - /* 97 */ "OpenRead" OpHelp("root=P2 iDb=P3"), |
| 32405 | | - /* 98 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), |
| 32406 | | - /* 99 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"), |
| 32407 | | - /* 100 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"), |
| 32408 | | - /* 101 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"), |
| 32409 | | - /* 102 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"), |
| 32410 | | - /* 103 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"), |
| 32411 | | - /* 104 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"), |
| 32412 | | - /* 105 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"), |
| 32413 | | - /* 106 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"), |
| 32414 | | - /* 107 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"), |
| 32415 | | - /* 108 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"), |
| 32416 | | - /* 109 */ "OpenDup" OpHelp(""), |
| 32417 | | - /* 110 */ "BitNot" OpHelp("r[P2]= ~r[P1]"), |
| 32418 | | - /* 111 */ "OpenAutoindex" OpHelp("nColumn=P2"), |
| 32419 | | - /* 112 */ "OpenEphemeral" OpHelp("nColumn=P2"), |
| 32420 | | - /* 113 */ "String8" OpHelp("r[P2]='P4'"), |
| 32421 | | - /* 114 */ "SorterOpen" OpHelp(""), |
| 32422 | | - /* 115 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), |
| 32423 | | - /* 116 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"), |
| 32424 | | - /* 117 */ "Close" OpHelp(""), |
| 32425 | | - /* 118 */ "ColumnsUsed" OpHelp(""), |
| 32426 | | - /* 119 */ "SeekHit" OpHelp("seekHit=P2"), |
| 32427 | | - /* 120 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), |
| 32428 | | - /* 121 */ "NewRowid" OpHelp("r[P2]=rowid"), |
| 32429 | | - /* 122 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), |
| 32430 | | - /* 123 */ "Delete" OpHelp(""), |
| 32431 | | - /* 124 */ "ResetCount" OpHelp(""), |
| 32432 | | - /* 125 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), |
| 32433 | | - /* 126 */ "SorterData" OpHelp("r[P2]=data"), |
| 32434 | | - /* 127 */ "RowData" OpHelp("r[P2]=data"), |
| 32435 | | - /* 128 */ "Rowid" OpHelp("r[P2]=rowid"), |
| 32436 | | - /* 129 */ "NullRow" OpHelp(""), |
| 32437 | | - /* 130 */ "SeekEnd" OpHelp(""), |
| 32438 | | - /* 131 */ "SorterInsert" OpHelp("key=r[P2]"), |
| 32439 | | - /* 132 */ "IdxInsert" OpHelp("key=r[P2]"), |
| 32440 | | - /* 133 */ "IdxDelete" OpHelp("key=r[P2@P3]"), |
| 32441 | | - /* 134 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"), |
| 32442 | | - /* 135 */ "IdxRowid" OpHelp("r[P2]=rowid"), |
| 32443 | | - /* 136 */ "Destroy" OpHelp(""), |
| 32444 | | - /* 137 */ "Clear" OpHelp(""), |
| 32445 | | - /* 138 */ "ResetSorter" OpHelp(""), |
| 32446 | | - /* 139 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"), |
| 32447 | | - /* 140 */ "SqlExec" OpHelp(""), |
| 32448 | | - /* 141 */ "ParseSchema" OpHelp(""), |
| 32449 | | - /* 142 */ "LoadAnalysis" OpHelp(""), |
| 32450 | | - /* 143 */ "DropTable" OpHelp(""), |
| 32451 | | - /* 144 */ "DropIndex" OpHelp(""), |
| 32452 | | - /* 145 */ "DropTrigger" OpHelp(""), |
| 32453 | | - /* 146 */ "IntegrityCk" OpHelp(""), |
| 32454 | | - /* 147 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), |
| 32455 | | - /* 148 */ "Real" OpHelp("r[P2]=P4"), |
| 32456 | | - /* 149 */ "Param" OpHelp(""), |
| 32457 | | - /* 150 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), |
| 32458 | | - /* 151 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), |
| 32459 | | - /* 152 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), |
| 32460 | | - /* 153 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"), |
| 32461 | | - /* 154 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 32462 | | - /* 155 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 32463 | | - /* 156 */ "AggValue" OpHelp("r[P3]=value N=P2"), |
| 32464 | | - /* 157 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), |
| 32465 | | - /* 158 */ "Expire" OpHelp(""), |
| 32466 | | - /* 159 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), |
| 32467 | | - /* 160 */ "VBegin" OpHelp(""), |
| 32468 | | - /* 161 */ "VCreate" OpHelp(""), |
| 32469 | | - /* 162 */ "VDestroy" OpHelp(""), |
| 32470 | | - /* 163 */ "VOpen" OpHelp(""), |
| 32471 | | - /* 164 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), |
| 32472 | | - /* 165 */ "VRename" OpHelp(""), |
| 32473 | | - /* 166 */ "Pagecount" OpHelp(""), |
| 32474 | | - /* 167 */ "MaxPgcnt" OpHelp(""), |
| 32475 | | - /* 168 */ "Trace" OpHelp(""), |
| 32476 | | - /* 169 */ "CursorHint" OpHelp(""), |
| 32477 | | - /* 170 */ "Noop" OpHelp(""), |
| 32478 | | - /* 171 */ "Explain" OpHelp(""), |
| 32479 | | - /* 172 */ "Abortable" OpHelp(""), |
| 32559 | + /* 62 */ "PureFunc" OpHelp("r[P3]=func(r[P2@P5])"), |
| 32560 | + /* 63 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"), |
| 32561 | + /* 64 */ "Return" OpHelp(""), |
| 32562 | + /* 65 */ "EndCoroutine" OpHelp(""), |
| 32563 | + /* 66 */ "HaltIfNull" OpHelp("if r[P3]=null halt"), |
| 32564 | + /* 67 */ "Halt" OpHelp(""), |
| 32565 | + /* 68 */ "Integer" OpHelp("r[P2]=P1"), |
| 32566 | + /* 69 */ "Int64" OpHelp("r[P2]=P4"), |
| 32567 | + /* 70 */ "String" OpHelp("r[P2]='P4' (len=P1)"), |
| 32568 | + /* 71 */ "Null" OpHelp("r[P2..P3]=NULL"), |
| 32569 | + /* 72 */ "SoftNull" OpHelp("r[P1]=NULL"), |
| 32570 | + /* 73 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), |
| 32571 | + /* 74 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), |
| 32572 | + /* 75 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), |
| 32573 | + /* 76 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), |
| 32574 | + /* 77 */ "SCopy" OpHelp("r[P2]=r[P1]"), |
| 32575 | + /* 78 */ "IntCopy" OpHelp("r[P2]=r[P1]"), |
| 32576 | + /* 79 */ "ResultRow" OpHelp("output=r[P1@P2]"), |
| 32577 | + /* 80 */ "CollSeq" OpHelp(""), |
| 32578 | + /* 81 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), |
| 32579 | + /* 82 */ "RealAffinity" OpHelp(""), |
| 32580 | + /* 83 */ "Cast" OpHelp("affinity(r[P1])"), |
| 32581 | + /* 84 */ "Permutation" OpHelp(""), |
| 32582 | + /* 85 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), |
| 32583 | + /* 86 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"), |
| 32584 | + /* 87 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"), |
| 32585 | + /* 88 */ "Column" OpHelp("r[P3]=PX"), |
| 32586 | + /* 89 */ "Affinity" OpHelp("affinity(r[P1@P2])"), |
| 32587 | + /* 90 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), |
| 32588 | + /* 91 */ "Count" OpHelp("r[P2]=count()"), |
| 32589 | + /* 92 */ "ReadCookie" OpHelp(""), |
| 32590 | + /* 93 */ "SetCookie" OpHelp(""), |
| 32591 | + /* 94 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), |
| 32592 | + /* 95 */ "OpenRead" OpHelp("root=P2 iDb=P3"), |
| 32593 | + /* 96 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), |
| 32594 | + /* 97 */ "OpenDup" OpHelp(""), |
| 32595 | + /* 98 */ "OpenAutoindex" OpHelp("nColumn=P2"), |
| 32596 | + /* 99 */ "OpenEphemeral" OpHelp("nColumn=P2"), |
| 32597 | + /* 100 */ "SorterOpen" OpHelp(""), |
| 32598 | + /* 101 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"), |
| 32599 | + /* 102 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"), |
| 32600 | + /* 103 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"), |
| 32601 | + /* 104 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"), |
| 32602 | + /* 105 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"), |
| 32603 | + /* 106 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"), |
| 32604 | + /* 107 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"), |
| 32605 | + /* 108 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"), |
| 32606 | + /* 109 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"), |
| 32607 | + /* 110 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"), |
| 32608 | + /* 111 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), |
| 32609 | + /* 112 */ "BitNot" OpHelp("r[P2]= ~r[P1]"), |
| 32610 | + /* 113 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"), |
| 32611 | + /* 114 */ "Close" OpHelp(""), |
| 32612 | + /* 115 */ "String8" OpHelp("r[P2]='P4'"), |
| 32613 | + /* 116 */ "ColumnsUsed" OpHelp(""), |
| 32614 | + /* 117 */ "SeekHit" OpHelp("seekHit=P2"), |
| 32615 | + /* 118 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), |
| 32616 | + /* 119 */ "NewRowid" OpHelp("r[P2]=rowid"), |
| 32617 | + /* 120 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), |
| 32618 | + /* 121 */ "Delete" OpHelp(""), |
| 32619 | + /* 122 */ "ResetCount" OpHelp(""), |
| 32620 | + /* 123 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), |
| 32621 | + /* 124 */ "SorterData" OpHelp("r[P2]=data"), |
| 32622 | + /* 125 */ "RowData" OpHelp("r[P2]=data"), |
| 32623 | + /* 126 */ "Rowid" OpHelp("r[P2]=rowid"), |
| 32624 | + /* 127 */ "NullRow" OpHelp(""), |
| 32625 | + /* 128 */ "SeekEnd" OpHelp(""), |
| 32626 | + /* 129 */ "SorterInsert" OpHelp("key=r[P2]"), |
| 32627 | + /* 130 */ "IdxInsert" OpHelp("key=r[P2]"), |
| 32628 | + /* 131 */ "IdxDelete" OpHelp("key=r[P2@P3]"), |
| 32629 | + /* 132 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"), |
| 32630 | + /* 133 */ "IdxRowid" OpHelp("r[P2]=rowid"), |
| 32631 | + /* 134 */ "Destroy" OpHelp(""), |
| 32632 | + /* 135 */ "Clear" OpHelp(""), |
| 32633 | + /* 136 */ "ResetSorter" OpHelp(""), |
| 32634 | + /* 137 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"), |
| 32635 | + /* 138 */ "SqlExec" OpHelp(""), |
| 32636 | + /* 139 */ "ParseSchema" OpHelp(""), |
| 32637 | + /* 140 */ "LoadAnalysis" OpHelp(""), |
| 32638 | + /* 141 */ "DropTable" OpHelp(""), |
| 32639 | + /* 142 */ "DropIndex" OpHelp(""), |
| 32640 | + /* 143 */ "DropTrigger" OpHelp(""), |
| 32641 | + /* 144 */ "IntegrityCk" OpHelp(""), |
| 32642 | + /* 145 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), |
| 32643 | + /* 146 */ "Param" OpHelp(""), |
| 32644 | + /* 147 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), |
| 32645 | + /* 148 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), |
| 32646 | + /* 149 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), |
| 32647 | + /* 150 */ "Real" OpHelp("r[P2]=P4"), |
| 32648 | + /* 151 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"), |
| 32649 | + /* 152 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 32650 | + /* 153 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 32651 | + /* 154 */ "AggValue" OpHelp("r[P3]=value N=P2"), |
| 32652 | + /* 155 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), |
| 32653 | + /* 156 */ "Expire" OpHelp(""), |
| 32654 | + /* 157 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), |
| 32655 | + /* 158 */ "VBegin" OpHelp(""), |
| 32656 | + /* 159 */ "VCreate" OpHelp(""), |
| 32657 | + /* 160 */ "VDestroy" OpHelp(""), |
| 32658 | + /* 161 */ "VOpen" OpHelp(""), |
| 32659 | + /* 162 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), |
| 32660 | + /* 163 */ "VRename" OpHelp(""), |
| 32661 | + /* 164 */ "Pagecount" OpHelp(""), |
| 32662 | + /* 165 */ "MaxPgcnt" OpHelp(""), |
| 32663 | + /* 166 */ "Trace" OpHelp(""), |
| 32664 | + /* 167 */ "CursorHint" OpHelp(""), |
| 32665 | + /* 168 */ "Noop" OpHelp(""), |
| 32666 | + /* 169 */ "Explain" OpHelp(""), |
| 32667 | + /* 170 */ "Abortable" OpHelp(""), |
| 32480 | 32668 | }; |
| 32481 | 32669 | return azName[i]; |
| 32482 | 32670 | } |
| 32483 | 32671 | #endif |
| 32484 | 32672 | |
| | @@ -32838,11 +33026,11 @@ |
| 32838 | 33026 | ** May you share freely, never taking more than you give. |
| 32839 | 33027 | ** |
| 32840 | 33028 | ****************************************************************************** |
| 32841 | 33029 | ** |
| 32842 | 33030 | ** This file contains inline asm code for retrieving "high-performance" |
| 32843 | | -** counters for x86 class CPUs. |
| 33031 | +** counters for x86 and x86_64 class CPUs. |
| 32844 | 33032 | */ |
| 32845 | 33033 | #ifndef SQLITE_HWTIME_H |
| 32846 | 33034 | #define SQLITE_HWTIME_H |
| 32847 | 33035 | |
| 32848 | 33036 | /* |
| | @@ -32849,12 +33037,13 @@ |
| 32849 | 33037 | ** The following routine only works on pentium-class (or newer) processors. |
| 32850 | 33038 | ** It uses the RDTSC opcode to read the cycle count value out of the |
| 32851 | 33039 | ** processor and returns that value. This can be used for high-res |
| 32852 | 33040 | ** profiling. |
| 32853 | 33041 | */ |
| 32854 | | -#if (defined(__GNUC__) || defined(_MSC_VER)) && \ |
| 32855 | | - (defined(i386) || defined(__i386__) || defined(_M_IX86)) |
| 33042 | +#if !defined(__STRICT_ANSI__) && \ |
| 33043 | + (defined(__GNUC__) || defined(_MSC_VER)) && \ |
| 33044 | + (defined(i386) || defined(__i386__) || defined(_M_IX86)) |
| 32856 | 33045 | |
| 32857 | 33046 | #if defined(__GNUC__) |
| 32858 | 33047 | |
| 32859 | 33048 | __inline__ sqlite_uint64 sqlite3Hwtime(void){ |
| 32860 | 33049 | unsigned int lo, hi; |
| | @@ -32871,19 +33060,19 @@ |
| 32871 | 33060 | } |
| 32872 | 33061 | } |
| 32873 | 33062 | |
| 32874 | 33063 | #endif |
| 32875 | 33064 | |
| 32876 | | -#elif (defined(__GNUC__) && defined(__x86_64__)) |
| 33065 | +#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__x86_64__)) |
| 32877 | 33066 | |
| 32878 | 33067 | __inline__ sqlite_uint64 sqlite3Hwtime(void){ |
| 32879 | 33068 | unsigned long val; |
| 32880 | 33069 | __asm__ __volatile__ ("rdtsc" : "=A" (val)); |
| 32881 | 33070 | return val; |
| 32882 | 33071 | } |
| 32883 | 33072 | |
| 32884 | | -#elif (defined(__GNUC__) && defined(__ppc__)) |
| 33073 | +#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__ppc__)) |
| 32885 | 33074 | |
| 32886 | 33075 | __inline__ sqlite_uint64 sqlite3Hwtime(void){ |
| 32887 | 33076 | unsigned long long retval; |
| 32888 | 33077 | unsigned long junk; |
| 32889 | 33078 | __asm__ __volatile__ ("\n\ |
| | @@ -32896,18 +33085,17 @@ |
| 32896 | 33085 | return retval; |
| 32897 | 33086 | } |
| 32898 | 33087 | |
| 32899 | 33088 | #else |
| 32900 | 33089 | |
| 32901 | | - #error Need implementation of sqlite3Hwtime() for your platform. |
| 32902 | | - |
| 32903 | 33090 | /* |
| 32904 | | - ** To compile without implementing sqlite3Hwtime() for your platform, |
| 32905 | | - ** you can remove the above #error and use the following |
| 32906 | | - ** stub function. You will lose timing support for many |
| 32907 | | - ** of the debugging and testing utilities, but it should at |
| 32908 | | - ** least compile and run. |
| 33091 | + ** asm() is needed for hardware timing support. Without asm(), |
| 33092 | + ** disable the sqlite3Hwtime() routine. |
| 33093 | + ** |
| 33094 | + ** sqlite3Hwtime() is only used for some obscure debugging |
| 33095 | + ** and analysis configurations, not in any deliverable, so this |
| 33096 | + ** should not be a great loss. |
| 32909 | 33097 | */ |
| 32910 | 33098 | SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } |
| 32911 | 33099 | |
| 32912 | 33100 | #endif |
| 32913 | 33101 | |
| | @@ -38933,19 +39121,29 @@ |
| 38933 | 39121 | ){ |
| 38934 | 39122 | UNUSED_PARAMETER(NotUsed); |
| 38935 | 39123 | SimulateIOError( return SQLITE_IOERR_ACCESS; ); |
| 38936 | 39124 | assert( pResOut!=0 ); |
| 38937 | 39125 | |
| 38938 | | - /* The spec says there are three possible values for flags. But only |
| 38939 | | - ** two of them are actually used */ |
| 38940 | | - assert( flags==SQLITE_ACCESS_EXISTS || flags==SQLITE_ACCESS_READWRITE ); |
| 39126 | + /* The spec says there are four possible values for flags. But the |
| 39127 | + ** SQLITE_ACCESS_READ flag is never used */ |
| 39128 | + assert( flags==SQLITE_ACCESS_EXISTS |
| 39129 | + || flags==SQLITE_ACCESS_READWRITE |
| 39130 | + || flags==SQLITE_ACCESS_SYMLINK ); |
| 38941 | 39131 | |
| 38942 | 39132 | if( flags==SQLITE_ACCESS_EXISTS ){ |
| 38943 | 39133 | struct stat buf; |
| 38944 | 39134 | *pResOut = (0==osStat(zPath, &buf) && buf.st_size>0); |
| 38945 | | - }else{ |
| 39135 | + }else if( flags==SQLITE_ACCESS_READWRITE ){ |
| 38946 | 39136 | *pResOut = osAccess(zPath, W_OK|R_OK)==0; |
| 39137 | + }else{ |
| 39138 | +#if !defined(HAVE_LSTAT) |
| 39139 | + *pResOut = 0; |
| 39140 | +#else |
| 39141 | + struct stat buf; |
| 39142 | + *pResOut = (0==osLstat(zPath, &buf) && S_ISLNK(buf.st_mode)); |
| 39143 | +#endif |
| 39144 | + assert( flags==SQLITE_ACCESS_SYMLINK ); |
| 38947 | 39145 | } |
| 38948 | 39146 | return SQLITE_OK; |
| 38949 | 39147 | } |
| 38950 | 39148 | |
| 38951 | 39149 | /* |
| | @@ -40660,11 +40858,11 @@ |
| 40660 | 40858 | ** May you share freely, never taking more than you give. |
| 40661 | 40859 | ** |
| 40662 | 40860 | ****************************************************************************** |
| 40663 | 40861 | ** |
| 40664 | 40862 | ** This file contains inline asm code for retrieving "high-performance" |
| 40665 | | -** counters for x86 class CPUs. |
| 40863 | +** counters for x86 and x86_64 class CPUs. |
| 40666 | 40864 | */ |
| 40667 | 40865 | #ifndef SQLITE_HWTIME_H |
| 40668 | 40866 | #define SQLITE_HWTIME_H |
| 40669 | 40867 | |
| 40670 | 40868 | /* |
| | @@ -40671,12 +40869,13 @@ |
| 40671 | 40869 | ** The following routine only works on pentium-class (or newer) processors. |
| 40672 | 40870 | ** It uses the RDTSC opcode to read the cycle count value out of the |
| 40673 | 40871 | ** processor and returns that value. This can be used for high-res |
| 40674 | 40872 | ** profiling. |
| 40675 | 40873 | */ |
| 40676 | | -#if (defined(__GNUC__) || defined(_MSC_VER)) && \ |
| 40677 | | - (defined(i386) || defined(__i386__) || defined(_M_IX86)) |
| 40874 | +#if !defined(__STRICT_ANSI__) && \ |
| 40875 | + (defined(__GNUC__) || defined(_MSC_VER)) && \ |
| 40876 | + (defined(i386) || defined(__i386__) || defined(_M_IX86)) |
| 40678 | 40877 | |
| 40679 | 40878 | #if defined(__GNUC__) |
| 40680 | 40879 | |
| 40681 | 40880 | __inline__ sqlite_uint64 sqlite3Hwtime(void){ |
| 40682 | 40881 | unsigned int lo, hi; |
| | @@ -40693,19 +40892,19 @@ |
| 40693 | 40892 | } |
| 40694 | 40893 | } |
| 40695 | 40894 | |
| 40696 | 40895 | #endif |
| 40697 | 40896 | |
| 40698 | | -#elif (defined(__GNUC__) && defined(__x86_64__)) |
| 40897 | +#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__x86_64__)) |
| 40699 | 40898 | |
| 40700 | 40899 | __inline__ sqlite_uint64 sqlite3Hwtime(void){ |
| 40701 | 40900 | unsigned long val; |
| 40702 | 40901 | __asm__ __volatile__ ("rdtsc" : "=A" (val)); |
| 40703 | 40902 | return val; |
| 40704 | 40903 | } |
| 40705 | 40904 | |
| 40706 | | -#elif (defined(__GNUC__) && defined(__ppc__)) |
| 40905 | +#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__ppc__)) |
| 40707 | 40906 | |
| 40708 | 40907 | __inline__ sqlite_uint64 sqlite3Hwtime(void){ |
| 40709 | 40908 | unsigned long long retval; |
| 40710 | 40909 | unsigned long junk; |
| 40711 | 40910 | __asm__ __volatile__ ("\n\ |
| | @@ -40718,18 +40917,17 @@ |
| 40718 | 40917 | return retval; |
| 40719 | 40918 | } |
| 40720 | 40919 | |
| 40721 | 40920 | #else |
| 40722 | 40921 | |
| 40723 | | - #error Need implementation of sqlite3Hwtime() for your platform. |
| 40724 | | - |
| 40725 | 40922 | /* |
| 40726 | | - ** To compile without implementing sqlite3Hwtime() for your platform, |
| 40727 | | - ** you can remove the above #error and use the following |
| 40728 | | - ** stub function. You will lose timing support for many |
| 40729 | | - ** of the debugging and testing utilities, but it should at |
| 40730 | | - ** least compile and run. |
| 40923 | + ** asm() is needed for hardware timing support. Without asm(), |
| 40924 | + ** disable the sqlite3Hwtime() routine. |
| 40925 | + ** |
| 40926 | + ** sqlite3Hwtime() is only used for some obscure debugging |
| 40927 | + ** and analysis configurations, not in any deliverable, so this |
| 40928 | + ** should not be a great loss. |
| 40731 | 40929 | */ |
| 40732 | 40930 | SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } |
| 40733 | 40931 | |
| 40734 | 40932 | #endif |
| 40735 | 40933 | |
| | @@ -40862,10 +41060,18 @@ |
| 40862 | 41060 | |
| 40863 | 41061 | #ifndef NTDDI_WINTHRESHOLD |
| 40864 | 41062 | # define NTDDI_WINTHRESHOLD 0x06040000 |
| 40865 | 41063 | #endif |
| 40866 | 41064 | |
| 41065 | +/* |
| 41066 | +** This constant is needed by the winAccess function; therefore, define |
| 41067 | +** it when it is missing from the SDK header files. |
| 41068 | +*/ |
| 41069 | +#ifndef FILE_ATTRIBUTE_REPARSE_POINT |
| 41070 | +# define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 |
| 41071 | +#endif |
| 41072 | + |
| 40867 | 41073 | /* |
| 40868 | 41074 | ** Check to see if the GetVersionEx[AW] functions are deprecated on the |
| 40869 | 41075 | ** target system. GetVersionEx was first deprecated in Win8.1. |
| 40870 | 41076 | */ |
| 40871 | 41077 | #ifndef SQLITE_WIN32_GETVERSIONEX |
| | @@ -46254,10 +46460,14 @@ |
| 46254 | 46460 | break; |
| 46255 | 46461 | case SQLITE_ACCESS_READWRITE: |
| 46256 | 46462 | rc = attr!=INVALID_FILE_ATTRIBUTES && |
| 46257 | 46463 | (attr & FILE_ATTRIBUTE_READONLY)==0; |
| 46258 | 46464 | break; |
| 46465 | + case SQLITE_ACCESS_SYMLINK: |
| 46466 | + rc = attr!=INVALID_FILE_ATTRIBUTES && |
| 46467 | + (attr & FILE_ATTRIBUTE_REPARSE_POINT)!=0; |
| 46468 | + break; |
| 46259 | 46469 | default: |
| 46260 | 46470 | assert(!"Invalid flags argument"); |
| 46261 | 46471 | } |
| 46262 | 46472 | *pResOut = rc; |
| 46263 | 46473 | OSTRACE(("ACCESS name=%s, pResOut=%p, *pResOut=%d, rc=SQLITE_OK\n", |
| | @@ -52141,10 +52351,11 @@ |
| 52141 | 52351 | ** master-journal filename. |
| 52142 | 52352 | */ |
| 52143 | 52353 | len = 0; |
| 52144 | 52354 | } |
| 52145 | 52355 | zMaster[len] = '\0'; |
| 52356 | + zMaster[len+1] = '\0'; |
| 52146 | 52357 | |
| 52147 | 52358 | return SQLITE_OK; |
| 52148 | 52359 | } |
| 52149 | 52360 | |
| 52150 | 52361 | /* |
| | @@ -53377,19 +53588,20 @@ |
| 53377 | 53588 | ** journal files extracted from regular rollback-journals. |
| 53378 | 53589 | */ |
| 53379 | 53590 | rc = sqlite3OsFileSize(pMaster, &nMasterJournal); |
| 53380 | 53591 | if( rc!=SQLITE_OK ) goto delmaster_out; |
| 53381 | 53592 | nMasterPtr = pVfs->mxPathname+1; |
| 53382 | | - zMasterJournal = sqlite3Malloc(nMasterJournal + nMasterPtr + 1); |
| 53593 | + zMasterJournal = sqlite3Malloc(nMasterJournal + nMasterPtr + 2); |
| 53383 | 53594 | if( !zMasterJournal ){ |
| 53384 | 53595 | rc = SQLITE_NOMEM_BKPT; |
| 53385 | 53596 | goto delmaster_out; |
| 53386 | 53597 | } |
| 53387 | | - zMasterPtr = &zMasterJournal[nMasterJournal+1]; |
| 53598 | + zMasterPtr = &zMasterJournal[nMasterJournal+2]; |
| 53388 | 53599 | rc = sqlite3OsRead(pMaster, zMasterJournal, (int)nMasterJournal, 0); |
| 53389 | 53600 | if( rc!=SQLITE_OK ) goto delmaster_out; |
| 53390 | 53601 | zMasterJournal[nMasterJournal] = 0; |
| 53602 | + zMasterJournal[nMasterJournal+1] = 0; |
| 53391 | 53603 | |
| 53392 | 53604 | zJournal = zMasterJournal; |
| 53393 | 53605 | while( (zJournal-zMasterJournal)<nMasterJournal ){ |
| 53394 | 53606 | int exists; |
| 53395 | 53607 | rc = sqlite3OsAccess(pVfs, zJournal, SQLITE_ACCESS_EXISTS, &exists); |
| | @@ -55542,11 +55754,12 @@ |
| 55542 | 55754 | int nPathname = 0; /* Number of bytes in zPathname */ |
| 55543 | 55755 | int useJournal = (flags & PAGER_OMIT_JOURNAL)==0; /* False to omit journal */ |
| 55544 | 55756 | int pcacheSize = sqlite3PcacheSize(); /* Bytes to allocate for PCache */ |
| 55545 | 55757 | u32 szPageDflt = SQLITE_DEFAULT_PAGE_SIZE; /* Default page size */ |
| 55546 | 55758 | const char *zUri = 0; /* URI args to copy */ |
| 55547 | | - int nUri = 0; /* Number of bytes of URI args at *zUri */ |
| 55759 | + int nUriByte = 1; /* Number of bytes of URI args at *zUri */ |
| 55760 | + int nUri = 0; /* Number of URI parameters */ |
| 55548 | 55761 | |
| 55549 | 55762 | /* Figure out how much space is required for each journal file-handle |
| 55550 | 55763 | ** (there are two of them, the main journal and the sub-journal). */ |
| 55551 | 55764 | journalFileSize = ROUND8(sqlite3JournalSize(pVfs)); |
| 55552 | 55765 | |
| | @@ -55569,10 +55782,16 @@ |
| 55569 | 55782 | ** to by zPathname, length nPathname. Or, if this is a temporary file, |
| 55570 | 55783 | ** leave both nPathname and zPathname set to 0. |
| 55571 | 55784 | */ |
| 55572 | 55785 | if( zFilename && zFilename[0] ){ |
| 55573 | 55786 | const char *z; |
| 55787 | + if( (vfsFlags & SQLITE_OPEN_NOFOLLOW)!=0 ){ |
| 55788 | + int isLink = 0; |
| 55789 | + int rc = sqlite3OsAccess(pVfs, zFilename, SQLITE_ACCESS_SYMLINK, &isLink); |
| 55790 | + if( rc==SQLITE_OK && isLink ) rc = SQLITE_CANTOPEN_SYMLINK; |
| 55791 | + if( rc ) return rc; |
| 55792 | + } |
| 55574 | 55793 | nPathname = pVfs->mxPathname+1; |
| 55575 | 55794 | zPathname = sqlite3DbMallocRaw(0, nPathname*2); |
| 55576 | 55795 | if( zPathname==0 ){ |
| 55577 | 55796 | return SQLITE_NOMEM_BKPT; |
| 55578 | 55797 | } |
| | @@ -55579,15 +55798,16 @@ |
| 55579 | 55798 | zPathname[0] = 0; /* Make sure initialized even if FullPathname() fails */ |
| 55580 | 55799 | rc = sqlite3OsFullPathname(pVfs, zFilename, nPathname, zPathname); |
| 55581 | 55800 | nPathname = sqlite3Strlen30(zPathname); |
| 55582 | 55801 | z = zUri = &zFilename[sqlite3Strlen30(zFilename)+1]; |
| 55583 | 55802 | while( *z ){ |
| 55584 | | - z += sqlite3Strlen30(z)+1; |
| 55585 | | - z += sqlite3Strlen30(z)+1; |
| 55803 | + z += strlen(z)+1; |
| 55804 | + z += strlen(z)+1; |
| 55805 | + nUri++; |
| 55586 | 55806 | } |
| 55587 | | - nUri = (int)(&z[1] - zUri); |
| 55588 | | - assert( nUri>=0 ); |
| 55807 | + nUriByte = (int)(&z[2] - zUri); |
| 55808 | + assert( nUriByte>=1 ); |
| 55589 | 55809 | if( rc==SQLITE_OK && nPathname+8>pVfs->mxPathname ){ |
| 55590 | 55810 | /* This branch is taken when the journal path required by |
| 55591 | 55811 | ** the database being opened will be more than pVfs->mxPathname |
| 55592 | 55812 | ** bytes in length. This means the database cannot be opened, |
| 55593 | 55813 | ** as it will not be possible to open the journal file or even |
| | @@ -55616,11 +55836,11 @@ |
| 55616 | 55836 | pPtr = (u8 *)sqlite3MallocZero( |
| 55617 | 55837 | ROUND8(sizeof(*pPager)) + /* Pager structure */ |
| 55618 | 55838 | ROUND8(pcacheSize) + /* PCache object */ |
| 55619 | 55839 | ROUND8(pVfs->szOsFile) + /* The main db file */ |
| 55620 | 55840 | journalFileSize * 2 + /* The two journal files */ |
| 55621 | | - nPathname + 1 + nUri + /* zFilename */ |
| 55841 | + nPathname + 1 + nUriByte + /* zFilename */ |
| 55622 | 55842 | nPathname + 8 + 2 /* zJournal */ |
| 55623 | 55843 | #ifndef SQLITE_OMIT_WAL |
| 55624 | 55844 | + nPathname + 4 + 2 /* zWal */ |
| 55625 | 55845 | #endif |
| 55626 | 55846 | ); |
| | @@ -55638,22 +55858,25 @@ |
| 55638 | 55858 | assert( EIGHT_BYTE_ALIGNMENT(pPager->jfd) ); |
| 55639 | 55859 | |
| 55640 | 55860 | /* Fill in the Pager.zFilename and Pager.zJournal buffers, if required. */ |
| 55641 | 55861 | if( zPathname ){ |
| 55642 | 55862 | assert( nPathname>0 ); |
| 55643 | | - pPager->zJournal = (char*)(pPtr += nPathname + 1 + nUri); |
| 55644 | 55863 | memcpy(pPager->zFilename, zPathname, nPathname); |
| 55645 | | - if( nUri ) memcpy(&pPager->zFilename[nPathname+1], zUri, nUri); |
| 55864 | + if( nUri ) memcpy(&pPager->zFilename[nPathname+1], zUri, nUriByte); |
| 55865 | + pPager->zJournal = (char*)(pPtr += nPathname + 1 + nUriByte); |
| 55646 | 55866 | memcpy(pPager->zJournal, zPathname, nPathname); |
| 55647 | | - memcpy(&pPager->zJournal[nPathname], "-journal\000", 8+2); |
| 55867 | + memcpy(&pPager->zJournal[nPathname], "-journal", 8); |
| 55648 | 55868 | sqlite3FileSuffix3(pPager->zFilename, pPager->zJournal); |
| 55649 | 55869 | #ifndef SQLITE_OMIT_WAL |
| 55650 | | - pPager->zWal = &pPager->zJournal[nPathname+8+1]; |
| 55870 | + pPager->zWal = (char*)(pPtr += nPathname + 8 + 2); |
| 55651 | 55871 | memcpy(pPager->zWal, zPathname, nPathname); |
| 55652 | | - memcpy(&pPager->zWal[nPathname], "-wal\000", 4+1); |
| 55872 | + memcpy(&pPager->zWal[nPathname], "-wal", 4); |
| 55653 | 55873 | sqlite3FileSuffix3(pPager->zFilename, pPager->zWal); |
| 55874 | + assert( sqlite3UriCount(pPager->zWal)==0 ); |
| 55654 | 55875 | #endif |
| 55876 | + assert( sqlite3UriCount(pPager->zFilename)==nUri ); |
| 55877 | + assert( sqlite3UriCount(pPager->zJournal)==0 ); |
| 55655 | 55878 | sqlite3DbFree(0, zPathname); |
| 55656 | 55879 | } |
| 55657 | 55880 | pPager->pVfs = pVfs; |
| 55658 | 55881 | pPager->vfsFlags = vfsFlags; |
| 55659 | 55882 | |
| | @@ -63072,10 +63295,11 @@ |
| 63072 | 63295 | int mallocFailed; /* A memory allocation error has occurred */ |
| 63073 | 63296 | const char *zPfx; /* Error message prefix */ |
| 63074 | 63297 | int v1, v2; /* Values for up to two %d fields in zPfx */ |
| 63075 | 63298 | StrAccum errMsg; /* Accumulate the error message text here */ |
| 63076 | 63299 | u32 *heap; /* Min-heap used for analyzing cell coverage */ |
| 63300 | + sqlite3 *db; /* Database connection running the check */ |
| 63077 | 63301 | }; |
| 63078 | 63302 | |
| 63079 | 63303 | /* |
| 63080 | 63304 | ** Routines to read or write a two- and four-byte big-endian integer values. |
| 63081 | 63305 | */ |
| | @@ -67759,12 +67983,13 @@ |
| 67759 | 67983 | ); |
| 67760 | 67984 | |
| 67761 | 67985 | /* The following assert statements verify that if this is a sharable |
| 67762 | 67986 | ** b-tree database, the connection is holding the required table locks, |
| 67763 | 67987 | ** and that no other connection has any open cursor that conflicts with |
| 67764 | | - ** this lock. */ |
| 67765 | | - assert( hasSharedCacheTableLock(p, iTable, pKeyInfo!=0, (wrFlag?2:1)) ); |
| 67988 | + ** this lock. The iTable<1 term disables the check for corrupt schemas. */ |
| 67989 | + assert( hasSharedCacheTableLock(p, iTable, pKeyInfo!=0, (wrFlag?2:1)) |
| 67990 | + || iTable<1 ); |
| 67766 | 67991 | assert( wrFlag==0 || !hasReadConflicts(p, iTable) ); |
| 67767 | 67992 | |
| 67768 | 67993 | /* Assert that the caller has opened the required transaction. */ |
| 67769 | 67994 | assert( p->inTrans>TRANS_NONE ); |
| 67770 | 67995 | assert( wrFlag==0 || p->inTrans==TRANS_WRITE ); |
| | @@ -67773,13 +67998,17 @@ |
| 67773 | 67998 | |
| 67774 | 67999 | if( wrFlag ){ |
| 67775 | 68000 | allocateTempSpace(pBt); |
| 67776 | 68001 | if( pBt->pTmpSpace==0 ) return SQLITE_NOMEM_BKPT; |
| 67777 | 68002 | } |
| 67778 | | - if( iTable==1 && btreePagecount(pBt)==0 ){ |
| 67779 | | - assert( wrFlag==0 ); |
| 67780 | | - iTable = 0; |
| 68003 | + if( iTable<=1 ){ |
| 68004 | + if( iTable<1 ){ |
| 68005 | + return SQLITE_CORRUPT_BKPT; |
| 68006 | + }else if( btreePagecount(pBt)==0 ){ |
| 68007 | + assert( wrFlag==0 ); |
| 68008 | + iTable = 0; |
| 68009 | + } |
| 67781 | 68010 | } |
| 67782 | 68011 | |
| 67783 | 68012 | /* Now that no other errors can occur, finish filling in the BtCursor |
| 67784 | 68013 | ** variables and link the cursor into the BtShared list. */ |
| 67785 | 68014 | pCur->pgnoRoot = (Pgno)iTable; |
| | @@ -67799,27 +68028,36 @@ |
| 67799 | 68028 | } |
| 67800 | 68029 | pCur->pNext = pBt->pCursor; |
| 67801 | 68030 | pBt->pCursor = pCur; |
| 67802 | 68031 | pCur->eState = CURSOR_INVALID; |
| 67803 | 68032 | return SQLITE_OK; |
| 68033 | +} |
| 68034 | +static int btreeCursorWithLock( |
| 68035 | + Btree *p, /* The btree */ |
| 68036 | + int iTable, /* Root page of table to open */ |
| 68037 | + int wrFlag, /* 1 to write. 0 read-only */ |
| 68038 | + struct KeyInfo *pKeyInfo, /* First arg to comparison function */ |
| 68039 | + BtCursor *pCur /* Space for new cursor */ |
| 68040 | +){ |
| 68041 | + int rc; |
| 68042 | + sqlite3BtreeEnter(p); |
| 68043 | + rc = btreeCursor(p, iTable, wrFlag, pKeyInfo, pCur); |
| 68044 | + sqlite3BtreeLeave(p); |
| 68045 | + return rc; |
| 67804 | 68046 | } |
| 67805 | 68047 | SQLITE_PRIVATE int sqlite3BtreeCursor( |
| 67806 | 68048 | Btree *p, /* The btree */ |
| 67807 | 68049 | int iTable, /* Root page of table to open */ |
| 67808 | 68050 | int wrFlag, /* 1 to write. 0 read-only */ |
| 67809 | 68051 | struct KeyInfo *pKeyInfo, /* First arg to xCompare() */ |
| 67810 | 68052 | BtCursor *pCur /* Write new cursor here */ |
| 67811 | 68053 | ){ |
| 67812 | | - int rc; |
| 67813 | | - if( iTable<1 ){ |
| 67814 | | - rc = SQLITE_CORRUPT_BKPT; |
| 68054 | + if( p->sharable ){ |
| 68055 | + return btreeCursorWithLock(p, iTable, wrFlag, pKeyInfo, pCur); |
| 67815 | 68056 | }else{ |
| 67816 | | - sqlite3BtreeEnter(p); |
| 67817 | | - rc = btreeCursor(p, iTable, wrFlag, pKeyInfo, pCur); |
| 67818 | | - sqlite3BtreeLeave(p); |
| 68057 | + return btreeCursor(p, iTable, wrFlag, pKeyInfo, pCur); |
| 67819 | 68058 | } |
| 67820 | | - return rc; |
| 67821 | 68059 | } |
| 67822 | 68060 | |
| 67823 | 68061 | /* |
| 67824 | 68062 | ** Return the size of a BtCursor object in bytes. |
| 67825 | 68063 | ** |
| | @@ -72853,11 +73091,11 @@ |
| 72853 | 73091 | ** |
| 72854 | 73092 | ** SQLITE_OK is returned if the operation is successfully executed. |
| 72855 | 73093 | ** Otherwise, if an error is encountered (i.e. an IO error or database |
| 72856 | 73094 | ** corruption) an SQLite error code is returned. |
| 72857 | 73095 | */ |
| 72858 | | -SQLITE_PRIVATE int sqlite3BtreeCount(BtCursor *pCur, i64 *pnEntry){ |
| 73096 | +SQLITE_PRIVATE int sqlite3BtreeCount(sqlite3 *db, BtCursor *pCur, i64 *pnEntry){ |
| 72859 | 73097 | i64 nEntry = 0; /* Value to return in *pnEntry */ |
| 72860 | 73098 | int rc; /* Return code */ |
| 72861 | 73099 | |
| 72862 | 73100 | rc = moveToRoot(pCur); |
| 72863 | 73101 | if( rc==SQLITE_EMPTY ){ |
| | @@ -72866,11 +73104,11 @@ |
| 72866 | 73104 | } |
| 72867 | 73105 | |
| 72868 | 73106 | /* Unless an error occurs, the following loop runs one iteration for each |
| 72869 | 73107 | ** page in the B-Tree structure (not including overflow pages). |
| 72870 | 73108 | */ |
| 72871 | | - while( rc==SQLITE_OK ){ |
| 73109 | + while( rc==SQLITE_OK && !db->u1.isInterrupted ){ |
| 72872 | 73110 | int iIdx; /* Index of child node in parent */ |
| 72873 | 73111 | MemPage *pPage; /* Current page of the b-tree */ |
| 72874 | 73112 | |
| 72875 | 73113 | /* If this is a leaf page or the tree is not an int-key tree, then |
| 72876 | 73114 | ** this page contains countable entries. Increment the entry counter |
| | @@ -72992,10 +73230,11 @@ |
| 72992 | 73230 | } |
| 72993 | 73231 | if( getPageReferenced(pCheck, iPage) ){ |
| 72994 | 73232 | checkAppendMsg(pCheck, "2nd reference to page %d", iPage); |
| 72995 | 73233 | return 1; |
| 72996 | 73234 | } |
| 73235 | + if( pCheck->db->u1.isInterrupted ) return 1; |
| 72997 | 73236 | setPageReferenced(pCheck, iPage); |
| 72998 | 73237 | return 0; |
| 72999 | 73238 | } |
| 73000 | 73239 | |
| 73001 | 73240 | #ifndef SQLITE_OMIT_AUTOVACUUM |
| | @@ -73435,10 +73674,11 @@ |
| 73435 | 73674 | ** allocation errors, an error message held in memory obtained from |
| 73436 | 73675 | ** malloc is returned if *pnErr is non-zero. If *pnErr==0 then NULL is |
| 73437 | 73676 | ** returned. If a memory allocation error occurs, NULL is returned. |
| 73438 | 73677 | */ |
| 73439 | 73678 | SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck( |
| 73679 | + sqlite3 *db, /* Database connection that is running the check */ |
| 73440 | 73680 | Btree *p, /* The btree to be checked */ |
| 73441 | 73681 | int *aRoot, /* An array of root pages numbers for individual trees */ |
| 73442 | 73682 | int nRoot, /* Number of entries in aRoot[] */ |
| 73443 | 73683 | int mxErr, /* Stop reporting errors after this many */ |
| 73444 | 73684 | int *pnErr /* Write number of errors seen to this variable */ |
| | @@ -73452,10 +73692,11 @@ |
| 73452 | 73692 | |
| 73453 | 73693 | sqlite3BtreeEnter(p); |
| 73454 | 73694 | assert( p->inTrans>TRANS_NONE && pBt->inTransaction>TRANS_NONE ); |
| 73455 | 73695 | VVA_ONLY( nRef = sqlite3PagerRefcount(pBt->pPager) ); |
| 73456 | 73696 | assert( nRef>=0 ); |
| 73697 | + sCheck.db = db; |
| 73457 | 73698 | sCheck.pBt = pBt; |
| 73458 | 73699 | sCheck.pPager = pBt->pPager; |
| 73459 | 73700 | sCheck.nPage = btreePagecount(sCheck.pBt); |
| 73460 | 73701 | sCheck.mxErr = mxErr; |
| 73461 | 73702 | sCheck.nErr = 0; |
| | @@ -75118,19 +75359,15 @@ |
| 75118 | 75359 | ** otherwise. |
| 75119 | 75360 | */ |
| 75120 | 75361 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 75121 | 75362 | SQLITE_PRIVATE int sqlite3VdbeMemAggValue(Mem *pAccum, Mem *pOut, FuncDef *pFunc){ |
| 75122 | 75363 | sqlite3_context ctx; |
| 75123 | | - Mem t; |
| 75124 | 75364 | assert( pFunc!=0 ); |
| 75125 | 75365 | assert( pFunc->xValue!=0 ); |
| 75126 | 75366 | assert( (pAccum->flags & MEM_Null)!=0 || pFunc==pAccum->u.pDef ); |
| 75127 | 75367 | assert( pAccum->db==0 || sqlite3_mutex_held(pAccum->db->mutex) ); |
| 75128 | 75368 | memset(&ctx, 0, sizeof(ctx)); |
| 75129 | | - memset(&t, 0, sizeof(t)); |
| 75130 | | - t.flags = MEM_Null; |
| 75131 | | - t.db = pAccum->db; |
| 75132 | 75369 | sqlite3VdbeMemSetNull(pOut); |
| 75133 | 75370 | ctx.pOut = pOut; |
| 75134 | 75371 | ctx.pMem = pAccum; |
| 75135 | 75372 | ctx.pFunc = pFunc; |
| 75136 | 75373 | pFunc->xValue(&ctx); |
| | @@ -76565,10 +76802,14 @@ |
| 76565 | 76802 | ** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.) |
| 76566 | 76803 | */ |
| 76567 | 76804 | /* #include "sqliteInt.h" */ |
| 76568 | 76805 | /* #include "vdbeInt.h" */ |
| 76569 | 76806 | |
| 76807 | +/* Forward references */ |
| 76808 | +static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef); |
| 76809 | +static void vdbeFreeOpArray(sqlite3 *, Op *, int); |
| 76810 | + |
| 76570 | 76811 | /* |
| 76571 | 76812 | ** Create a new virtual database engine. |
| 76572 | 76813 | */ |
| 76573 | 76814 | SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){ |
| 76574 | 76815 | sqlite3 *db = pParse->db; |
| | @@ -76591,10 +76832,17 @@ |
| 76591 | 76832 | assert( p->nOpAlloc==0 ); |
| 76592 | 76833 | assert( pParse->szOpAlloc==0 ); |
| 76593 | 76834 | sqlite3VdbeAddOp2(p, OP_Init, 0, 1); |
| 76594 | 76835 | return p; |
| 76595 | 76836 | } |
| 76837 | + |
| 76838 | +/* |
| 76839 | +** Return the Parse object that owns a Vdbe object. |
| 76840 | +*/ |
| 76841 | +SQLITE_PRIVATE Parse *sqlite3VdbeParser(Vdbe *p){ |
| 76842 | + return p->pParse; |
| 76843 | +} |
| 76596 | 76844 | |
| 76597 | 76845 | /* |
| 76598 | 76846 | ** Change the error string stored in Vdbe.zErrMsg |
| 76599 | 76847 | */ |
| 76600 | 76848 | SQLITE_PRIVATE void sqlite3VdbeError(Vdbe *p, const char *zFormat, ...){ |
| | @@ -76672,11 +76920,11 @@ |
| 76672 | 76920 | pA->pPrev = pB->pPrev; |
| 76673 | 76921 | pB->pPrev = pTmp; |
| 76674 | 76922 | zTmp = pA->zSql; |
| 76675 | 76923 | pA->zSql = pB->zSql; |
| 76676 | 76924 | pB->zSql = zTmp; |
| 76677 | | -#if 0 |
| 76925 | +#ifdef SQLITE_ENABLE_NORMALIZE |
| 76678 | 76926 | zTmp = pA->zNormSql; |
| 76679 | 76927 | pA->zNormSql = pB->zNormSql; |
| 76680 | 76928 | pB->zNormSql = zTmp; |
| 76681 | 76929 | #endif |
| 76682 | 76930 | pB->expmask = pA->expmask; |
| | @@ -76870,10 +77118,53 @@ |
| 76870 | 77118 | ){ |
| 76871 | 77119 | int addr = sqlite3VdbeAddOp3(p, op, p1, p2, p3); |
| 76872 | 77120 | sqlite3VdbeChangeP4(p, addr, zP4, p4type); |
| 76873 | 77121 | return addr; |
| 76874 | 77122 | } |
| 77123 | + |
| 77124 | +/* |
| 77125 | +** Add an OP_Function or OP_PureFunc opcode. |
| 77126 | +** |
| 77127 | +** The eCallCtx argument is information (typically taken from Expr.op2) |
| 77128 | +** that describes the calling context of the function. 0 means a general |
| 77129 | +** function call. NC_IsCheck means called by a check constraint, |
| 77130 | +** NC_IdxExpr means called as part of an index expression. NC_PartIdx |
| 77131 | +** means in the WHERE clause of a partial index. NC_GenCol means called |
| 77132 | +** while computing a generated column value. 0 is the usual case. |
| 77133 | +*/ |
| 77134 | +SQLITE_PRIVATE int sqlite3VdbeAddFunctionCall( |
| 77135 | + Parse *pParse, /* Parsing context */ |
| 77136 | + int p1, /* Constant argument mask */ |
| 77137 | + int p2, /* First argument register */ |
| 77138 | + int p3, /* Register into which results are written */ |
| 77139 | + int nArg, /* Number of argument */ |
| 77140 | + const FuncDef *pFunc, /* The function to be invoked */ |
| 77141 | + int eCallCtx /* Calling context */ |
| 77142 | +){ |
| 77143 | + Vdbe *v = pParse->pVdbe; |
| 77144 | + int nByte; |
| 77145 | + int addr; |
| 77146 | + sqlite3_context *pCtx; |
| 77147 | + assert( v ); |
| 77148 | + nByte = sizeof(*pCtx) + (nArg-1)*sizeof(sqlite3_value*); |
| 77149 | + pCtx = sqlite3DbMallocRawNN(pParse->db, nByte); |
| 77150 | + if( pCtx==0 ){ |
| 77151 | + assert( pParse->db->mallocFailed ); |
| 77152 | + freeEphemeralFunction(pParse->db, (FuncDef*)pFunc); |
| 77153 | + return 0; |
| 77154 | + } |
| 77155 | + pCtx->pOut = 0; |
| 77156 | + pCtx->pFunc = (FuncDef*)pFunc; |
| 77157 | + pCtx->pVdbe = 0; |
| 77158 | + pCtx->isError = 0; |
| 77159 | + pCtx->argc = nArg; |
| 77160 | + pCtx->iOp = sqlite3VdbeCurrentAddr(v); |
| 77161 | + addr = sqlite3VdbeAddOp4(v, eCallCtx ? OP_PureFunc : OP_Function, |
| 77162 | + p1, p2, p3, (char*)pCtx, P4_FUNCCTX); |
| 77163 | + sqlite3VdbeChangeP5(v, eCallCtx & NC_SelfRef); |
| 77164 | + return addr; |
| 77165 | +} |
| 76875 | 77166 | |
| 76876 | 77167 | /* |
| 76877 | 77168 | ** Add an opcode that includes the p4 value with a P4_INT64 or |
| 76878 | 77169 | ** P4_REAL type. |
| 76879 | 77170 | */ |
| | @@ -77190,11 +77481,11 @@ |
| 77190 | 77481 | |
| 77191 | 77482 | while( (pOp = opIterNext(&sIter))!=0 ){ |
| 77192 | 77483 | int opcode = pOp->opcode; |
| 77193 | 77484 | if( opcode==OP_Destroy || opcode==OP_VUpdate || opcode==OP_VRename |
| 77194 | 77485 | || opcode==OP_VDestroy |
| 77195 | | - || (opcode==OP_Function0 && pOp->p4.pFunc->funcFlags&SQLITE_FUNC_INTERNAL) |
| 77486 | + || (opcode==OP_ParseSchema && pOp->p4.z==0) |
| 77196 | 77487 | || ((opcode==OP_Halt || opcode==OP_HaltIfNull) |
| 77197 | 77488 | && ((pOp->p1)!=SQLITE_OK && pOp->p2==OE_Abort)) |
| 77198 | 77489 | ){ |
| 77199 | 77490 | hasAbort = 1; |
| 77200 | 77491 | break; |
| | @@ -77563,22 +77854,20 @@ |
| 77563 | 77854 | if( (pDef->funcFlags & SQLITE_FUNC_EPHEM)!=0 ){ |
| 77564 | 77855 | sqlite3DbFreeNN(db, pDef); |
| 77565 | 77856 | } |
| 77566 | 77857 | } |
| 77567 | 77858 | |
| 77568 | | -static void vdbeFreeOpArray(sqlite3 *, Op *, int); |
| 77569 | | - |
| 77570 | 77859 | /* |
| 77571 | 77860 | ** Delete a P4 value if necessary. |
| 77572 | 77861 | */ |
| 77573 | 77862 | static SQLITE_NOINLINE void freeP4Mem(sqlite3 *db, Mem *p){ |
| 77574 | 77863 | if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc); |
| 77575 | 77864 | sqlite3DbFreeNN(db, p); |
| 77576 | 77865 | } |
| 77577 | 77866 | static SQLITE_NOINLINE void freeP4FuncCtx(sqlite3 *db, sqlite3_context *p){ |
| 77578 | 77867 | freeEphemeralFunction(db, p->pFunc); |
| 77579 | | - sqlite3DbFreeNN(db, p); |
| 77868 | + sqlite3DbFreeNN(db, p); |
| 77580 | 77869 | } |
| 77581 | 77870 | static void freeP4(sqlite3 *db, int p4type, void *p4){ |
| 77582 | 77871 | assert( db ); |
| 77583 | 77872 | switch( p4type ){ |
| 77584 | 77873 | case P4_FUNCCTX: { |
| | @@ -77647,10 +77936,17 @@ |
| 77647 | 77936 | */ |
| 77648 | 77937 | SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *pVdbe, SubProgram *p){ |
| 77649 | 77938 | p->pNext = pVdbe->pProgram; |
| 77650 | 77939 | pVdbe->pProgram = p; |
| 77651 | 77940 | } |
| 77941 | + |
| 77942 | +/* |
| 77943 | +** Return true if the given Vdbe has any SubPrograms. |
| 77944 | +*/ |
| 77945 | +SQLITE_PRIVATE int sqlite3VdbeHasSubProgram(Vdbe *pVdbe){ |
| 77946 | + return pVdbe->pProgram!=0; |
| 77947 | +} |
| 77652 | 77948 | |
| 77653 | 77949 | /* |
| 77654 | 77950 | ** Change the opcode at addr into OP_Noop |
| 77655 | 77951 | */ |
| 77656 | 77952 | SQLITE_PRIVATE int sqlite3VdbeChangeToNoop(Vdbe *p, int addr){ |
| | @@ -78073,17 +78369,15 @@ |
| 78073 | 78369 | case P4_FUNCDEF: { |
| 78074 | 78370 | FuncDef *pDef = pOp->p4.pFunc; |
| 78075 | 78371 | sqlite3_str_appendf(&x, "%s(%d)", pDef->zName, pDef->nArg); |
| 78076 | 78372 | break; |
| 78077 | 78373 | } |
| 78078 | | -#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE) |
| 78079 | 78374 | case P4_FUNCCTX: { |
| 78080 | 78375 | FuncDef *pDef = pOp->p4.pCtx->pFunc; |
| 78081 | 78376 | sqlite3_str_appendf(&x, "%s(%d)", pDef->zName, pDef->nArg); |
| 78082 | 78377 | break; |
| 78083 | 78378 | } |
| 78084 | | -#endif |
| 78085 | 78379 | case P4_INT64: { |
| 78086 | 78380 | sqlite3_str_appendf(&x, "%lld", *pOp->p4.pI64); |
| 78087 | 78381 | break; |
| 78088 | 78382 | } |
| 78089 | 78383 | case P4_INT32: { |
| | @@ -78773,12 +79067,30 @@ |
| 78773 | 79067 | assert( x.nFree>=0 ); |
| 78774 | 79068 | assert( EIGHT_BYTE_ALIGNMENT(&x.pSpace[x.nFree]) ); |
| 78775 | 79069 | |
| 78776 | 79070 | resolveP2Values(p, &nArg); |
| 78777 | 79071 | p->usesStmtJournal = (u8)(pParse->isMultiWrite && pParse->mayAbort); |
| 78778 | | - if( pParse->explain && nMem<10 ){ |
| 78779 | | - nMem = 10; |
| 79072 | + if( pParse->explain ){ |
| 79073 | + static const char * const azColName[] = { |
| 79074 | + "addr", "opcode", "p1", "p2", "p3", "p4", "p5", "comment", |
| 79075 | + "id", "parent", "notused", "detail" |
| 79076 | + }; |
| 79077 | + int iFirst, mx, i; |
| 79078 | + if( nMem<10 ) nMem = 10; |
| 79079 | + if( pParse->explain==2 ){ |
| 79080 | + sqlite3VdbeSetNumCols(p, 4); |
| 79081 | + iFirst = 8; |
| 79082 | + mx = 12; |
| 79083 | + }else{ |
| 79084 | + sqlite3VdbeSetNumCols(p, 8); |
| 79085 | + iFirst = 0; |
| 79086 | + mx = 8; |
| 79087 | + } |
| 79088 | + for(i=iFirst; i<mx; i++){ |
| 79089 | + sqlite3VdbeSetColName(p, i-iFirst, COLNAME_NAME, |
| 79090 | + azColName[i], SQLITE_STATIC); |
| 79091 | + } |
| 78780 | 79092 | } |
| 78781 | 79093 | p->expired = 0; |
| 78782 | 79094 | |
| 78783 | 79095 | /* Memory for registers, parameters, cursor, etc, is allocated in one or two |
| 78784 | 79096 | ** passes. On the first pass, we try to reuse unused memory at the |
| | @@ -79124,11 +79436,11 @@ |
| 79124 | 79436 | int retryCount = 0; |
| 79125 | 79437 | int nMainFile; |
| 79126 | 79438 | |
| 79127 | 79439 | /* Select a master journal file name */ |
| 79128 | 79440 | nMainFile = sqlite3Strlen30(zMainFile); |
| 79129 | | - zMaster = sqlite3MPrintf(db, "%s-mjXXXXXX9XXz", zMainFile); |
| 79441 | + zMaster = sqlite3MPrintf(db, "%s-mjXXXXXX9XXz%c%c", zMainFile, 0, 0); |
| 79130 | 79442 | if( zMaster==0 ) return SQLITE_NOMEM_BKPT; |
| 79131 | 79443 | do { |
| 79132 | 79444 | u32 iRandom; |
| 79133 | 79445 | if( retryCount ){ |
| 79134 | 79446 | if( retryCount>100 ){ |
| | @@ -81475,17 +81787,29 @@ |
| 81475 | 81787 | ** throw an error if it is given inputs that would make it non-deterministic. |
| 81476 | 81788 | ** This routine is invoked by date/time functions that use non-deterministic |
| 81477 | 81789 | ** features such as 'now'. |
| 81478 | 81790 | */ |
| 81479 | 81791 | SQLITE_PRIVATE int sqlite3NotPureFunc(sqlite3_context *pCtx){ |
| 81792 | + const VdbeOp *pOp; |
| 81480 | 81793 | #ifdef SQLITE_ENABLE_STAT4 |
| 81481 | 81794 | if( pCtx->pVdbe==0 ) return 1; |
| 81482 | 81795 | #endif |
| 81483 | | - if( pCtx->pVdbe->aOp[pCtx->iOp].opcode==OP_PureFunc ){ |
| 81484 | | - sqlite3_result_error(pCtx, |
| 81485 | | - "non-deterministic function in index expression or CHECK constraint", |
| 81486 | | - -1); |
| 81796 | + pOp = pCtx->pVdbe->aOp + pCtx->iOp; |
| 81797 | + if( pOp->opcode==OP_PureFunc ){ |
| 81798 | + const char *zContext; |
| 81799 | + char *zMsg; |
| 81800 | + if( pOp->p5 & NC_IsCheck ){ |
| 81801 | + zContext = "a CHECK constraint"; |
| 81802 | + }else if( pOp->p5 & NC_GenCol ){ |
| 81803 | + zContext = "a generated column"; |
| 81804 | + }else{ |
| 81805 | + zContext = "an index"; |
| 81806 | + } |
| 81807 | + zMsg = sqlite3_mprintf("non-deterministic use of %s() in %s", |
| 81808 | + pCtx->pFunc->zName, zContext); |
| 81809 | + sqlite3_result_error(pCtx, zMsg, -1); |
| 81810 | + sqlite3_free(zMsg); |
| 81487 | 81811 | return 0; |
| 81488 | 81812 | } |
| 81489 | 81813 | return 1; |
| 81490 | 81814 | } |
| 81491 | 81815 | |
| | @@ -83428,11 +83752,11 @@ |
| 83428 | 83752 | if( !p || p->op==SQLITE_INSERT ){ |
| 83429 | 83753 | rc = SQLITE_MISUSE_BKPT; |
| 83430 | 83754 | goto preupdate_old_out; |
| 83431 | 83755 | } |
| 83432 | 83756 | if( p->pPk ){ |
| 83433 | | - iIdx = sqlite3ColumnOfIndex(p->pPk, iIdx); |
| 83757 | + iIdx = sqlite3TableColumnToIndex(p->pPk, iIdx); |
| 83434 | 83758 | } |
| 83435 | 83759 | if( iIdx>=p->pCsr->nField || iIdx<0 ){ |
| 83436 | 83760 | rc = SQLITE_RANGE; |
| 83437 | 83761 | goto preupdate_old_out; |
| 83438 | 83762 | } |
| | @@ -83518,11 +83842,11 @@ |
| 83518 | 83842 | if( !p || p->op==SQLITE_DELETE ){ |
| 83519 | 83843 | rc = SQLITE_MISUSE_BKPT; |
| 83520 | 83844 | goto preupdate_new_out; |
| 83521 | 83845 | } |
| 83522 | 83846 | if( p->pPk && p->op!=SQLITE_UPDATE ){ |
| 83523 | | - iIdx = sqlite3ColumnOfIndex(p->pPk, iIdx); |
| 83847 | + iIdx = sqlite3TableColumnToIndex(p->pPk, iIdx); |
| 83524 | 83848 | } |
| 83525 | 83849 | if( iIdx>=p->pCsr->nField || iIdx<0 ){ |
| 83526 | 83850 | rc = SQLITE_RANGE; |
| 83527 | 83851 | goto preupdate_new_out; |
| 83528 | 83852 | } |
| | @@ -84450,11 +84774,11 @@ |
| 84450 | 84774 | ** May you share freely, never taking more than you give. |
| 84451 | 84775 | ** |
| 84452 | 84776 | ****************************************************************************** |
| 84453 | 84777 | ** |
| 84454 | 84778 | ** This file contains inline asm code for retrieving "high-performance" |
| 84455 | | -** counters for x86 class CPUs. |
| 84779 | +** counters for x86 and x86_64 class CPUs. |
| 84456 | 84780 | */ |
| 84457 | 84781 | #ifndef SQLITE_HWTIME_H |
| 84458 | 84782 | #define SQLITE_HWTIME_H |
| 84459 | 84783 | |
| 84460 | 84784 | /* |
| | @@ -84461,12 +84785,13 @@ |
| 84461 | 84785 | ** The following routine only works on pentium-class (or newer) processors. |
| 84462 | 84786 | ** It uses the RDTSC opcode to read the cycle count value out of the |
| 84463 | 84787 | ** processor and returns that value. This can be used for high-res |
| 84464 | 84788 | ** profiling. |
| 84465 | 84789 | */ |
| 84466 | | -#if (defined(__GNUC__) || defined(_MSC_VER)) && \ |
| 84467 | | - (defined(i386) || defined(__i386__) || defined(_M_IX86)) |
| 84790 | +#if !defined(__STRICT_ANSI__) && \ |
| 84791 | + (defined(__GNUC__) || defined(_MSC_VER)) && \ |
| 84792 | + (defined(i386) || defined(__i386__) || defined(_M_IX86)) |
| 84468 | 84793 | |
| 84469 | 84794 | #if defined(__GNUC__) |
| 84470 | 84795 | |
| 84471 | 84796 | __inline__ sqlite_uint64 sqlite3Hwtime(void){ |
| 84472 | 84797 | unsigned int lo, hi; |
| | @@ -84483,19 +84808,19 @@ |
| 84483 | 84808 | } |
| 84484 | 84809 | } |
| 84485 | 84810 | |
| 84486 | 84811 | #endif |
| 84487 | 84812 | |
| 84488 | | -#elif (defined(__GNUC__) && defined(__x86_64__)) |
| 84813 | +#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__x86_64__)) |
| 84489 | 84814 | |
| 84490 | 84815 | __inline__ sqlite_uint64 sqlite3Hwtime(void){ |
| 84491 | 84816 | unsigned long val; |
| 84492 | 84817 | __asm__ __volatile__ ("rdtsc" : "=A" (val)); |
| 84493 | 84818 | return val; |
| 84494 | 84819 | } |
| 84495 | 84820 | |
| 84496 | | -#elif (defined(__GNUC__) && defined(__ppc__)) |
| 84821 | +#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__ppc__)) |
| 84497 | 84822 | |
| 84498 | 84823 | __inline__ sqlite_uint64 sqlite3Hwtime(void){ |
| 84499 | 84824 | unsigned long long retval; |
| 84500 | 84825 | unsigned long junk; |
| 84501 | 84826 | __asm__ __volatile__ ("\n\ |
| | @@ -84508,18 +84833,17 @@ |
| 84508 | 84833 | return retval; |
| 84509 | 84834 | } |
| 84510 | 84835 | |
| 84511 | 84836 | #else |
| 84512 | 84837 | |
| 84513 | | - #error Need implementation of sqlite3Hwtime() for your platform. |
| 84514 | | - |
| 84515 | 84838 | /* |
| 84516 | | - ** To compile without implementing sqlite3Hwtime() for your platform, |
| 84517 | | - ** you can remove the above #error and use the following |
| 84518 | | - ** stub function. You will lose timing support for many |
| 84519 | | - ** of the debugging and testing utilities, but it should at |
| 84520 | | - ** least compile and run. |
| 84839 | + ** asm() is needed for hardware timing support. Without asm(), |
| 84840 | + ** disable the sqlite3Hwtime() routine. |
| 84841 | + ** |
| 84842 | + ** sqlite3Hwtime() is only used for some obscure debugging |
| 84843 | + ** and analysis configurations, not in any deliverable, so this |
| 84844 | + ** should not be a great loss. |
| 84521 | 84845 | */ |
| 84522 | 84846 | SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } |
| 84523 | 84847 | |
| 84524 | 84848 | #endif |
| 84525 | 84849 | |
| | @@ -87081,15 +87405,15 @@ |
| 87081 | 87405 | |
| 87082 | 87406 | assert( p->apCsr[pOp->p1]->eCurType==CURTYPE_BTREE ); |
| 87083 | 87407 | pCrsr = p->apCsr[pOp->p1]->uc.pCursor; |
| 87084 | 87408 | assert( pCrsr ); |
| 87085 | 87409 | nEntry = 0; /* Not needed. Only used to silence a warning. */ |
| 87086 | | - rc = sqlite3BtreeCount(pCrsr, &nEntry); |
| 87410 | + rc = sqlite3BtreeCount(db, pCrsr, &nEntry); |
| 87087 | 87411 | if( rc ) goto abort_due_to_error; |
| 87088 | 87412 | pOut = out2Prerelease(p, pOp); |
| 87089 | 87413 | pOut->u.i = nEntry; |
| 87090 | | - break; |
| 87414 | + goto check_for_interrupt; |
| 87091 | 87415 | } |
| 87092 | 87416 | #endif |
| 87093 | 87417 | |
| 87094 | 87418 | /* Opcode: Savepoint P1 * * P4 * |
| 87095 | 87419 | ** |
| | @@ -87313,11 +87637,10 @@ |
| 87313 | 87637 | p->pc = (int)(pOp - aOp); |
| 87314 | 87638 | db->autoCommit = (u8)(1-desiredAutoCommit); |
| 87315 | 87639 | p->rc = rc = SQLITE_BUSY; |
| 87316 | 87640 | goto vdbe_return; |
| 87317 | 87641 | } |
| 87318 | | - assert( db->nStatement==0 ); |
| 87319 | 87642 | sqlite3CloseSavepoints(db); |
| 87320 | 87643 | if( p->rc==SQLITE_OK ){ |
| 87321 | 87644 | rc = SQLITE_DONE; |
| 87322 | 87645 | }else{ |
| 87323 | 87646 | rc = SQLITE_ERROR; |
| | @@ -87394,11 +87717,12 @@ |
| 87394 | 87717 | goto vdbe_return; |
| 87395 | 87718 | } |
| 87396 | 87719 | goto abort_due_to_error; |
| 87397 | 87720 | } |
| 87398 | 87721 | |
| 87399 | | - if( pOp->p2 && p->usesStmtJournal |
| 87722 | + if( p->usesStmtJournal |
| 87723 | + && pOp->p2 |
| 87400 | 87724 | && (db->autoCommit==0 || db->nVdbeRead>1) |
| 87401 | 87725 | ){ |
| 87402 | 87726 | assert( sqlite3BtreeIsInTrans(pBt) ); |
| 87403 | 87727 | if( p->iStatement==0 ){ |
| 87404 | 87728 | assert( db->nStatement>=0 && db->nSavepoint>=0 ); |
| | @@ -88476,27 +88800,31 @@ |
| 88476 | 88800 | u64 iKey; |
| 88477 | 88801 | |
| 88478 | 88802 | pIn3 = &aMem[pOp->p3]; |
| 88479 | 88803 | testcase( pIn3->flags & MEM_Int ); |
| 88480 | 88804 | testcase( pIn3->flags & MEM_IntReal ); |
| 88805 | + testcase( pIn3->flags & MEM_Real ); |
| 88806 | + testcase( (pIn3->flags & (MEM_Str|MEM_Int))==MEM_Str ); |
| 88481 | 88807 | if( (pIn3->flags & (MEM_Int|MEM_IntReal))==0 ){ |
| 88482 | | - /* Make sure pIn3->u.i contains a valid integer representation of |
| 88483 | | - ** the key value, but do not change the datatype of the register, as |
| 88484 | | - ** other parts of the perpared statement might be depending on the |
| 88485 | | - ** current datatype. */ |
| 88486 | | - u16 origFlags = pIn3->flags; |
| 88487 | | - int isNotInt; |
| 88488 | | - applyAffinity(pIn3, SQLITE_AFF_NUMERIC, encoding); |
| 88489 | | - isNotInt = (pIn3->flags & MEM_Int)==0; |
| 88490 | | - pIn3->flags = origFlags; |
| 88491 | | - if( isNotInt ) goto jump_to_p2; |
| 88808 | + /* If pIn3->u.i does not contain an integer, compute iKey as the |
| 88809 | + ** integer value of pIn3. Jump to P2 if pIn3 cannot be converted |
| 88810 | + ** into an integer without loss of information. Take care to avoid |
| 88811 | + ** changing the datatype of pIn3, however, as it is used by other |
| 88812 | + ** parts of the prepared statement. */ |
| 88813 | + Mem x = pIn3[0]; |
| 88814 | + applyAffinity(&x, SQLITE_AFF_NUMERIC, encoding); |
| 88815 | + if( (x.flags & MEM_Int)==0 ) goto jump_to_p2; |
| 88816 | + iKey = x.u.i; |
| 88817 | + goto notExistsWithKey; |
| 88492 | 88818 | } |
| 88493 | 88819 | /* Fall through into OP_NotExists */ |
| 88494 | 88820 | case OP_NotExists: /* jump, in3 */ |
| 88495 | 88821 | pIn3 = &aMem[pOp->p3]; |
| 88496 | 88822 | assert( (pIn3->flags & MEM_Int)!=0 || pOp->opcode==OP_SeekRowid ); |
| 88497 | 88823 | assert( pOp->p1>=0 && pOp->p1<p->nCursor ); |
| 88824 | + iKey = pIn3->u.i; |
| 88825 | +notExistsWithKey: |
| 88498 | 88826 | pC = p->apCsr[pOp->p1]; |
| 88499 | 88827 | assert( pC!=0 ); |
| 88500 | 88828 | #ifdef SQLITE_DEBUG |
| 88501 | 88829 | if( pOp->opcode==OP_SeekRowid ) pC->seekOp = OP_SeekRowid; |
| 88502 | 88830 | #endif |
| | @@ -88503,11 +88831,10 @@ |
| 88503 | 88831 | assert( pC->isTable ); |
| 88504 | 88832 | assert( pC->eCurType==CURTYPE_BTREE ); |
| 88505 | 88833 | pCrsr = pC->uc.pCursor; |
| 88506 | 88834 | assert( pCrsr!=0 ); |
| 88507 | 88835 | res = 0; |
| 88508 | | - iKey = pIn3->u.i; |
| 88509 | 88836 | rc = sqlite3BtreeMovetoUnpacked(pCrsr, 0, iKey, 0, &res); |
| 88510 | 88837 | assert( rc==SQLITE_OK || res==0 ); |
| 88511 | 88838 | pC->movetoTarget = iKey; /* Used by OP_Delete */ |
| 88512 | 88839 | pC->nullRow = 0; |
| 88513 | 88840 | pC->cacheStatus = CACHE_STALE; |
| | @@ -90038,11 +90365,11 @@ |
| 90038 | 90365 | assert( (pnErr->flags & MEM_Int)!=0 ); |
| 90039 | 90366 | assert( (pnErr->flags & (MEM_Str|MEM_Blob))==0 ); |
| 90040 | 90367 | pIn1 = &aMem[pOp->p1]; |
| 90041 | 90368 | assert( pOp->p5<db->nDb ); |
| 90042 | 90369 | assert( DbMaskTest(p->btreeMask, pOp->p5) ); |
| 90043 | | - z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, &aRoot[1], nRoot, |
| 90370 | + z = sqlite3BtreeIntegrityCheck(db, db->aDb[pOp->p5].pBt, &aRoot[1], nRoot, |
| 90044 | 90371 | (int)pnErr->u.i+1, &nErr); |
| 90045 | 90372 | sqlite3VdbeMemSetNull(pIn1); |
| 90046 | 90373 | if( nErr==0 ){ |
| 90047 | 90374 | assert( z==0 ); |
| 90048 | 90375 | }else if( z==0 ){ |
| | @@ -90051,11 +90378,11 @@ |
| 90051 | 90378 | pnErr->u.i -= nErr-1; |
| 90052 | 90379 | sqlite3VdbeMemSetStr(pIn1, z, -1, SQLITE_UTF8, sqlite3_free); |
| 90053 | 90380 | } |
| 90054 | 90381 | UPDATE_MAX_BLOBSIZE(pIn1); |
| 90055 | 90382 | sqlite3VdbeChangeEncoding(pIn1, encoding); |
| 90056 | | - break; |
| 90383 | + goto check_for_interrupt; |
| 90057 | 90384 | } |
| 90058 | 90385 | #endif /* SQLITE_OMIT_INTEGRITY_CHECK */ |
| 90059 | 90386 | |
| 90060 | 90387 | /* Opcode: RowSetAdd P1 P2 * * * |
| 90061 | 90388 | ** Synopsis: rowset(P1)=r[P2] |
| | @@ -91377,76 +91704,56 @@ |
| 91377 | 91704 | pOut->u.i = sqlite3BtreeMaxPageCount(pBt, newMax); |
| 91378 | 91705 | break; |
| 91379 | 91706 | } |
| 91380 | 91707 | #endif |
| 91381 | 91708 | |
| 91382 | | -/* Opcode: Function0 P1 P2 P3 P4 P5 |
| 91709 | +/* Opcode: Function P1 P2 P3 P4 * |
| 91383 | 91710 | ** Synopsis: r[P3]=func(r[P2@P5]) |
| 91384 | 91711 | ** |
| 91385 | | -** Invoke a user function (P4 is a pointer to a FuncDef object that |
| 91386 | | -** defines the function) with P5 arguments taken from register P2 and |
| 91387 | | -** successors. The result of the function is stored in register P3. |
| 91388 | | -** Register P3 must not be one of the function inputs. |
| 91712 | +** Invoke a user function (P4 is a pointer to an sqlite3_context object that |
| 91713 | +** contains a pointer to the function to be run) with arguments taken |
| 91714 | +** from register P2 and successors. The number of arguments is in |
| 91715 | +** the sqlite3_context object that P4 points to. |
| 91716 | +** The result of the function is stored |
| 91717 | +** in register P3. Register P3 must not be one of the function inputs. |
| 91389 | 91718 | ** |
| 91390 | 91719 | ** P1 is a 32-bit bitmask indicating whether or not each argument to the |
| 91391 | 91720 | ** function was determined to be constant at compile time. If the first |
| 91392 | 91721 | ** argument was constant then bit 0 of P1 is set. This is used to determine |
| 91393 | 91722 | ** whether meta data associated with a user function argument using the |
| 91394 | 91723 | ** sqlite3_set_auxdata() API may be safely retained until the next |
| 91395 | 91724 | ** invocation of this opcode. |
| 91396 | 91725 | ** |
| 91397 | | -** See also: Function, AggStep, AggFinal |
| 91726 | +** See also: AggStep, AggFinal, PureFunc |
| 91398 | 91727 | */ |
| 91399 | | -/* Opcode: Function P1 P2 P3 P4 P5 |
| 91728 | +/* Opcode: PureFunc P1 P2 P3 P4 * |
| 91400 | 91729 | ** Synopsis: r[P3]=func(r[P2@P5]) |
| 91401 | 91730 | ** |
| 91402 | 91731 | ** Invoke a user function (P4 is a pointer to an sqlite3_context object that |
| 91403 | | -** contains a pointer to the function to be run) with P5 arguments taken |
| 91404 | | -** from register P2 and successors. The result of the function is stored |
| 91732 | +** contains a pointer to the function to be run) with arguments taken |
| 91733 | +** from register P2 and successors. The number of arguments is in |
| 91734 | +** the sqlite3_context object that P4 points to. |
| 91735 | +** The result of the function is stored |
| 91405 | 91736 | ** in register P3. Register P3 must not be one of the function inputs. |
| 91406 | 91737 | ** |
| 91407 | 91738 | ** P1 is a 32-bit bitmask indicating whether or not each argument to the |
| 91408 | 91739 | ** function was determined to be constant at compile time. If the first |
| 91409 | 91740 | ** argument was constant then bit 0 of P1 is set. This is used to determine |
| 91410 | 91741 | ** whether meta data associated with a user function argument using the |
| 91411 | 91742 | ** sqlite3_set_auxdata() API may be safely retained until the next |
| 91412 | 91743 | ** invocation of this opcode. |
| 91413 | 91744 | ** |
| 91414 | | -** SQL functions are initially coded as OP_Function0 with P4 pointing |
| 91415 | | -** to a FuncDef object. But on first evaluation, the P4 operand is |
| 91416 | | -** automatically converted into an sqlite3_context object and the operation |
| 91417 | | -** changed to this OP_Function opcode. In this way, the initialization of |
| 91418 | | -** the sqlite3_context object occurs only once, rather than once for each |
| 91419 | | -** evaluation of the function. |
| 91745 | +** This opcode works exactly like OP_Function. The only difference is in |
| 91746 | +** its name. This opcode is used in places where the function must be |
| 91747 | +** purely non-deterministic. Some built-in date/time functions can be |
| 91748 | +** either determinitic of non-deterministic, depending on their arguments. |
| 91749 | +** When those function are used in a non-deterministic way, they will check |
| 91750 | +** to see if they were called using OP_PureFunc instead of OP_Function, and |
| 91751 | +** if they were, they throw an error. |
| 91420 | 91752 | ** |
| 91421 | | -** See also: Function0, AggStep, AggFinal |
| 91753 | +** See also: AggStep, AggFinal, Function |
| 91422 | 91754 | */ |
| 91423 | | -case OP_PureFunc0: /* group */ |
| 91424 | | -case OP_Function0: { /* group */ |
| 91425 | | - int n; |
| 91426 | | - sqlite3_context *pCtx; |
| 91427 | | - |
| 91428 | | - assert( pOp->p4type==P4_FUNCDEF ); |
| 91429 | | - n = pOp->p5; |
| 91430 | | - assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) ); |
| 91431 | | - assert( n==0 || (pOp->p2>0 && pOp->p2+n<=(p->nMem+1 - p->nCursor)+1) ); |
| 91432 | | - assert( pOp->p3<pOp->p2 || pOp->p3>=pOp->p2+n ); |
| 91433 | | - pCtx = sqlite3DbMallocRawNN(db, sizeof(*pCtx) + (n-1)*sizeof(sqlite3_value*)); |
| 91434 | | - if( pCtx==0 ) goto no_mem; |
| 91435 | | - pCtx->pOut = 0; |
| 91436 | | - pCtx->pFunc = pOp->p4.pFunc; |
| 91437 | | - pCtx->iOp = (int)(pOp - aOp); |
| 91438 | | - pCtx->pVdbe = p; |
| 91439 | | - pCtx->isError = 0; |
| 91440 | | - pCtx->argc = n; |
| 91441 | | - pOp->p4type = P4_FUNCCTX; |
| 91442 | | - pOp->p4.pCtx = pCtx; |
| 91443 | | - assert( OP_PureFunc == OP_PureFunc0+2 ); |
| 91444 | | - assert( OP_Function == OP_Function0+2 ); |
| 91445 | | - pOp->opcode += 2; |
| 91446 | | - /* Fall through into OP_Function */ |
| 91447 | | -} |
| 91448 | 91755 | case OP_PureFunc: /* group */ |
| 91449 | 91756 | case OP_Function: { /* group */ |
| 91450 | 91757 | int i; |
| 91451 | 91758 | sqlite3_context *pCtx; |
| 91452 | 91759 | |
| | @@ -91457,13 +91764,15 @@ |
| 91457 | 91764 | ** might change from one evaluation to the next. The next block of code |
| 91458 | 91765 | ** checks to see if the register array has changed, and if so it |
| 91459 | 91766 | ** reinitializes the relavant parts of the sqlite3_context object */ |
| 91460 | 91767 | pOut = &aMem[pOp->p3]; |
| 91461 | 91768 | if( pCtx->pOut != pOut ){ |
| 91769 | + pCtx->pVdbe = p; |
| 91462 | 91770 | pCtx->pOut = pOut; |
| 91463 | 91771 | for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i]; |
| 91464 | 91772 | } |
| 91773 | + assert( pCtx->pVdbe==p ); |
| 91465 | 91774 | |
| 91466 | 91775 | memAboutToChange(p, pOut); |
| 91467 | 91776 | #ifdef SQLITE_DEBUG |
| 91468 | 91777 | for(i=0; i<pCtx->argc; i++){ |
| 91469 | 91778 | assert( memIsValid(pCtx->argv[i]) ); |
| | @@ -93668,24 +93977,20 @@ |
| 93668 | 93977 | ** SQLITE_OK if successful, or an SQLite error code (i.e. SQLITE_NOMEM) if |
| 93669 | 93978 | ** an error occurs. |
| 93670 | 93979 | */ |
| 93671 | 93980 | static int vdbeSorterSort(SortSubtask *pTask, SorterList *pList){ |
| 93672 | 93981 | int i; |
| 93673 | | - SorterRecord **aSlot; |
| 93674 | 93982 | SorterRecord *p; |
| 93675 | 93983 | int rc; |
| 93984 | + SorterRecord *aSlot[64]; |
| 93676 | 93985 | |
| 93677 | 93986 | rc = vdbeSortAllocUnpacked(pTask); |
| 93678 | 93987 | if( rc!=SQLITE_OK ) return rc; |
| 93679 | 93988 | |
| 93680 | 93989 | p = pList->pList; |
| 93681 | 93990 | pTask->xCompare = vdbeSorterGetCompare(pTask->pSorter); |
| 93682 | | - |
| 93683 | | - aSlot = (SorterRecord **)sqlite3MallocZero(64 * sizeof(SorterRecord *)); |
| 93684 | | - if( !aSlot ){ |
| 93685 | | - return SQLITE_NOMEM_BKPT; |
| 93686 | | - } |
| 93991 | + memset(aSlot, 0, sizeof(aSlot)); |
| 93687 | 93992 | |
| 93688 | 93993 | while( p ){ |
| 93689 | 93994 | SorterRecord *pNext; |
| 93690 | 93995 | if( pList->aMemory ){ |
| 93691 | 93996 | if( (u8*)p==pList->aMemory ){ |
| | @@ -93706,17 +94011,16 @@ |
| 93706 | 94011 | aSlot[i] = p; |
| 93707 | 94012 | p = pNext; |
| 93708 | 94013 | } |
| 93709 | 94014 | |
| 93710 | 94015 | p = 0; |
| 93711 | | - for(i=0; i<64; i++){ |
| 94016 | + for(i=0; i<ArraySize(aSlot); i++){ |
| 93712 | 94017 | if( aSlot[i]==0 ) continue; |
| 93713 | 94018 | p = p ? vdbeSorterMerge(pTask, p, aSlot[i]) : aSlot[i]; |
| 93714 | 94019 | } |
| 93715 | 94020 | pList->pList = p; |
| 93716 | 94021 | |
| 93717 | | - sqlite3_free(aSlot); |
| 93718 | 94022 | assert( pTask->pUnpacked->errCode==SQLITE_OK |
| 93719 | 94023 | || pTask->pUnpacked->errCode==SQLITE_NOMEM |
| 93720 | 94024 | ); |
| 93721 | 94025 | return pTask->pUnpacked->errCode; |
| 93722 | 94026 | } |
| | @@ -96097,11 +96401,11 @@ |
| 96097 | 96401 | ** Perhaps the name is a reference to the ROWID |
| 96098 | 96402 | */ |
| 96099 | 96403 | if( cnt==0 |
| 96100 | 96404 | && cntTab==1 |
| 96101 | 96405 | && pMatch |
| 96102 | | - && (pNC->ncFlags & NC_IdxExpr)==0 |
| 96406 | + && (pNC->ncFlags & (NC_IdxExpr|NC_GenCol))==0 |
| 96103 | 96407 | && sqlite3IsRowid(zCol) |
| 96104 | 96408 | && VisibleRowid(pMatch->pTab) |
| 96105 | 96409 | ){ |
| 96106 | 96410 | cnt = 1; |
| 96107 | 96411 | pExpr->iColumn = -1; |
| | @@ -96308,17 +96612,20 @@ |
| 96308 | 96612 | Parse *pParse, /* Leave error message here */ |
| 96309 | 96613 | NameContext *pNC, /* The name context */ |
| 96310 | 96614 | const char *zMsg, /* Type of error */ |
| 96311 | 96615 | int validMask /* Set of contexts for which prohibited */ |
| 96312 | 96616 | ){ |
| 96313 | | - assert( (validMask&~(NC_IsCheck|NC_PartIdx|NC_IdxExpr))==0 ); |
| 96617 | + assert( (validMask&~(NC_IsCheck|NC_PartIdx|NC_IdxExpr|NC_GenCol))==0 ); |
| 96314 | 96618 | if( (pNC->ncFlags & validMask)!=0 ){ |
| 96315 | 96619 | const char *zIn = "partial index WHERE clauses"; |
| 96316 | 96620 | if( pNC->ncFlags & NC_IdxExpr ) zIn = "index expressions"; |
| 96317 | 96621 | #ifndef SQLITE_OMIT_CHECK |
| 96318 | 96622 | else if( pNC->ncFlags & NC_IsCheck ) zIn = "CHECK constraints"; |
| 96319 | 96623 | #endif |
| 96624 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 96625 | + else if( pNC->ncFlags & NC_GenCol ) zIn = "generated columns"; |
| 96626 | +#endif |
| 96320 | 96627 | sqlite3ErrorMsg(pParse, "%s prohibited in %s", zMsg, zIn); |
| 96321 | 96628 | } |
| 96322 | 96629 | } |
| 96323 | 96630 | |
| 96324 | 96631 | /* |
| | @@ -96406,11 +96713,11 @@ |
| 96406 | 96713 | zDb = 0; |
| 96407 | 96714 | zTable = 0; |
| 96408 | 96715 | zColumn = pExpr->u.zToken; |
| 96409 | 96716 | }else{ |
| 96410 | 96717 | Expr *pLeft = pExpr->pLeft; |
| 96411 | | - notValid(pParse, pNC, "the \".\" operator", NC_IdxExpr); |
| 96718 | + notValid(pParse, pNC, "the \".\" operator", NC_IdxExpr|NC_GenCol); |
| 96412 | 96719 | pRight = pExpr->pRight; |
| 96413 | 96720 | if( pRight->op==TK_ID ){ |
| 96414 | 96721 | zDb = 0; |
| 96415 | 96722 | }else{ |
| 96416 | 96723 | assert( pRight->op==TK_DOT ); |
| | @@ -96495,19 +96802,22 @@ |
| 96495 | 96802 | } |
| 96496 | 96803 | #endif |
| 96497 | 96804 | if( pDef->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG) ){ |
| 96498 | 96805 | /* For the purposes of the EP_ConstFunc flag, date and time |
| 96499 | 96806 | ** functions and other functions that change slowly are considered |
| 96500 | | - ** constant because they are constant for the duration of one query */ |
| 96807 | + ** constant because they are constant for the duration of one query. |
| 96808 | + ** This allows them to be factored out of inner loops. */ |
| 96501 | 96809 | ExprSetProperty(pExpr,EP_ConstFunc); |
| 96502 | 96810 | } |
| 96503 | 96811 | if( (pDef->funcFlags & SQLITE_FUNC_CONSTANT)==0 ){ |
| 96504 | 96812 | /* Date/time functions that use 'now', and other functions like |
| 96505 | 96813 | ** sqlite_version() that might change over time cannot be used |
| 96506 | 96814 | ** in an index. */ |
| 96507 | | - notValid(pParse, pNC, "non-deterministic functions", |
| 96508 | | - NC_IdxExpr|NC_PartIdx); |
| 96815 | + notValid(pParse, pNC, "non-deterministic functions", NC_SelfRef); |
| 96816 | + }else{ |
| 96817 | + assert( (NC_SelfRef & 0xff)==NC_SelfRef ); /* Must fit in 8 bits */ |
| 96818 | + pExpr->op2 = pNC->ncFlags & NC_SelfRef; |
| 96509 | 96819 | } |
| 96510 | 96820 | if( (pDef->funcFlags & SQLITE_FUNC_INTERNAL)!=0 |
| 96511 | 96821 | && pParse->nested==0 |
| 96512 | 96822 | && sqlite3Config.bInternalFunctions==0 |
| 96513 | 96823 | ){ |
| | @@ -96647,11 +96957,12 @@ |
| 96647 | 96957 | #endif |
| 96648 | 96958 | case TK_IN: { |
| 96649 | 96959 | testcase( pExpr->op==TK_IN ); |
| 96650 | 96960 | if( ExprHasProperty(pExpr, EP_xIsSelect) ){ |
| 96651 | 96961 | int nRef = pNC->nRef; |
| 96652 | | - notValid(pParse, pNC, "subqueries", NC_IsCheck|NC_PartIdx|NC_IdxExpr); |
| 96962 | + notValid(pParse, pNC, "subqueries", |
| 96963 | + NC_IsCheck|NC_PartIdx|NC_IdxExpr|NC_GenCol); |
| 96653 | 96964 | sqlite3WalkSelect(pWalker, pExpr->x.pSelect); |
| 96654 | 96965 | assert( pNC->nRef>=nRef ); |
| 96655 | 96966 | if( nRef!=pNC->nRef ){ |
| 96656 | 96967 | ExprSetProperty(pExpr, EP_VarSelect); |
| 96657 | 96968 | pNC->ncFlags |= NC_VarSelect; |
| | @@ -96658,11 +96969,12 @@ |
| 96658 | 96969 | } |
| 96659 | 96970 | } |
| 96660 | 96971 | break; |
| 96661 | 96972 | } |
| 96662 | 96973 | case TK_VARIABLE: { |
| 96663 | | - notValid(pParse, pNC, "parameters", NC_IsCheck|NC_PartIdx|NC_IdxExpr); |
| 96974 | + notValid(pParse, pNC, "parameters", |
| 96975 | + NC_IsCheck|NC_PartIdx|NC_IdxExpr|NC_GenCol); |
| 96664 | 96976 | break; |
| 96665 | 96977 | } |
| 96666 | 96978 | case TK_IS: |
| 96667 | 96979 | case TK_ISNOT: { |
| 96668 | 96980 | Expr *pRight = sqlite3ExprSkipCollateAndLikely(pExpr->pRight); |
| | @@ -97467,34 +97779,38 @@ |
| 97467 | 97779 | |
| 97468 | 97780 | /* |
| 97469 | 97781 | ** Resolve names in expressions that can only reference a single table |
| 97470 | 97782 | ** or which cannot reference any tables at all. Examples: |
| 97471 | 97783 | ** |
| 97472 | | -** (1) CHECK constraints |
| 97473 | | -** (2) WHERE clauses on partial indices |
| 97474 | | -** (3) Expressions in indexes on expressions |
| 97475 | | -** (4) Expression arguments to VACUUM INTO. |
| 97784 | +** "type" flag |
| 97785 | +** ------------ |
| 97786 | +** (1) CHECK constraints NC_IsCheck |
| 97787 | +** (2) WHERE clauses on partial indices NC_PartIdx |
| 97788 | +** (3) Expressions in indexes on expressions NC_IdxExpr |
| 97789 | +** (4) Expression arguments to VACUUM INTO. 0 |
| 97790 | +** (5) GENERATED ALWAYS as expressions NC_GenCol |
| 97476 | 97791 | ** |
| 97477 | 97792 | ** In all cases except (4), the Expr.iTable value for Expr.op==TK_COLUMN |
| 97478 | 97793 | ** nodes of the expression is set to -1 and the Expr.iColumn value is |
| 97479 | 97794 | ** set to the column number. In case (4), TK_COLUMN nodes cause an error. |
| 97480 | 97795 | ** |
| 97481 | 97796 | ** Any errors cause an error message to be set in pParse. |
| 97482 | 97797 | */ |
| 97483 | 97798 | SQLITE_PRIVATE int sqlite3ResolveSelfReference( |
| 97484 | | - Parse *pParse, /* Parsing context */ |
| 97485 | | - Table *pTab, /* The table being referenced, or NULL */ |
| 97486 | | - int type, /* NC_IsCheck or NC_PartIdx or NC_IdxExpr, or 0 */ |
| 97487 | | - Expr *pExpr, /* Expression to resolve. May be NULL. */ |
| 97488 | | - ExprList *pList /* Expression list to resolve. May be NULL. */ |
| 97799 | + Parse *pParse, /* Parsing context */ |
| 97800 | + Table *pTab, /* The table being referenced, or NULL */ |
| 97801 | + int type, /* NC_IsCheck, NC_PartIdx, NC_IdxExpr, NC_GenCol, or 0 */ |
| 97802 | + Expr *pExpr, /* Expression to resolve. May be NULL. */ |
| 97803 | + ExprList *pList /* Expression list to resolve. May be NULL. */ |
| 97489 | 97804 | ){ |
| 97490 | 97805 | SrcList sSrc; /* Fake SrcList for pParse->pNewTable */ |
| 97491 | 97806 | NameContext sNC; /* Name context for pParse->pNewTable */ |
| 97492 | 97807 | int rc; |
| 97493 | 97808 | |
| 97494 | 97809 | assert( type==0 || pTab!=0 ); |
| 97495 | | - assert( type==NC_IsCheck || type==NC_PartIdx || type==NC_IdxExpr || pTab==0 ); |
| 97810 | + assert( type==NC_IsCheck || type==NC_PartIdx || type==NC_IdxExpr |
| 97811 | + || type==NC_GenCol || pTab==0 ); |
| 97496 | 97812 | memset(&sNC, 0, sizeof(sNC)); |
| 97497 | 97813 | memset(&sSrc, 0, sizeof(sSrc)); |
| 97498 | 97814 | if( pTab ){ |
| 97499 | 97815 | sSrc.nSrc = 1; |
| 97500 | 97816 | sSrc.a[0].zName = pTab->zName; |
| | @@ -97581,10 +97897,13 @@ |
| 97581 | 97897 | assert( pExpr->pLeft->flags&EP_xIsSelect ); |
| 97582 | 97898 | return sqlite3ExprAffinity( |
| 97583 | 97899 | pExpr->pLeft->x.pSelect->pEList->a[pExpr->iColumn].pExpr |
| 97584 | 97900 | ); |
| 97585 | 97901 | } |
| 97902 | + if( op==TK_VECTOR ){ |
| 97903 | + return sqlite3ExprAffinity(pExpr->x.pList->a[0].pExpr); |
| 97904 | + } |
| 97586 | 97905 | return pExpr->affExpr; |
| 97587 | 97906 | } |
| 97588 | 97907 | |
| 97589 | 97908 | /* |
| 97590 | 97909 | ** Set the collating sequence for expression pExpr to be the collating |
| | @@ -97682,10 +98001,14 @@ |
| 97682 | 98001 | break; |
| 97683 | 98002 | } |
| 97684 | 98003 | if( op==TK_CAST || op==TK_UPLUS ){ |
| 97685 | 98004 | p = p->pLeft; |
| 97686 | 98005 | continue; |
| 98006 | + } |
| 98007 | + if( op==TK_VECTOR ){ |
| 98008 | + p = p->x.pList->a[0].pExpr; |
| 98009 | + continue; |
| 97687 | 98010 | } |
| 97688 | 98011 | if( op==TK_COLLATE ){ |
| 97689 | 98012 | pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken); |
| 97690 | 98013 | break; |
| 97691 | 98014 | } |
| | @@ -97694,16 +98017,16 @@ |
| 97694 | 98017 | p = p->pLeft; |
| 97695 | 98018 | }else{ |
| 97696 | 98019 | Expr *pNext = p->pRight; |
| 97697 | 98020 | /* The Expr.x union is never used at the same time as Expr.pRight */ |
| 97698 | 98021 | assert( p->x.pList==0 || p->pRight==0 ); |
| 97699 | | - /* p->flags holds EP_Collate and p->pLeft->flags does not. And |
| 97700 | | - ** p->x.pSelect cannot. So if p->x.pLeft exists, it must hold at |
| 97701 | | - ** least one EP_Collate. Thus the following two ALWAYS. */ |
| 97702 | | - if( p->x.pList!=0 && ALWAYS(!ExprHasProperty(p, EP_xIsSelect)) ){ |
| 98022 | + if( p->x.pList!=0 |
| 98023 | + && !db->mallocFailed |
| 98024 | + && ALWAYS(!ExprHasProperty(p, EP_xIsSelect)) |
| 98025 | + ){ |
| 97703 | 98026 | int i; |
| 97704 | | - for(i=0; ALWAYS(i<p->x.pList->nExpr); i++){ |
| 98027 | + for(i=0; i<p->x.pList->nExpr; i++){ |
| 97705 | 98028 | if( ExprHasProperty(p->x.pList->a[i].pExpr, EP_Collate) ){ |
| 97706 | 98029 | pNext = p->x.pList->a[i].pExpr; |
| 97707 | 98030 | break; |
| 97708 | 98031 | } |
| 97709 | 98032 | } |
| | @@ -97846,10 +98169,26 @@ |
| 97846 | 98169 | pColl = sqlite3ExprCollSeq(pParse, pRight); |
| 97847 | 98170 | } |
| 97848 | 98171 | } |
| 97849 | 98172 | return pColl; |
| 97850 | 98173 | } |
| 98174 | + |
| 98175 | +/* Expresssion p is a comparison operator. Return a collation sequence |
| 98176 | +** appropriate for the comparison operator. |
| 98177 | +** |
| 98178 | +** This is normally just a wrapper around sqlite3BinaryCompareCollSeq(). |
| 98179 | +** However, if the OP_Commuted flag is set, then the order of the operands |
| 98180 | +** is reversed in the sqlite3BinaryCompareCollSeq() call so that the |
| 98181 | +** correct collating sequence is found. |
| 98182 | +*/ |
| 98183 | +SQLITE_PRIVATE CollSeq *sqlite3ExprCompareCollSeq(Parse *pParse, Expr *p){ |
| 98184 | + if( ExprHasProperty(p, EP_Commuted) ){ |
| 98185 | + return sqlite3BinaryCompareCollSeq(pParse, p->pRight, p->pLeft); |
| 98186 | + }else{ |
| 98187 | + return sqlite3BinaryCompareCollSeq(pParse, p->pLeft, p->pRight); |
| 98188 | + } |
| 98189 | +} |
| 97851 | 98190 | |
| 97852 | 98191 | /* |
| 97853 | 98192 | ** Generate code for a comparison operator. |
| 97854 | 98193 | */ |
| 97855 | 98194 | static int codeCompare( |
| | @@ -97857,17 +98196,22 @@ |
| 97857 | 98196 | Expr *pLeft, /* The left operand */ |
| 97858 | 98197 | Expr *pRight, /* The right operand */ |
| 97859 | 98198 | int opcode, /* The comparison opcode */ |
| 97860 | 98199 | int in1, int in2, /* Register holding operands */ |
| 97861 | 98200 | int dest, /* Jump here if true. */ |
| 97862 | | - int jumpIfNull /* If true, jump if either operand is NULL */ |
| 98201 | + int jumpIfNull, /* If true, jump if either operand is NULL */ |
| 98202 | + int isCommuted /* The comparison has been commuted */ |
| 97863 | 98203 | ){ |
| 97864 | 98204 | int p5; |
| 97865 | 98205 | int addr; |
| 97866 | 98206 | CollSeq *p4; |
| 97867 | 98207 | |
| 97868 | | - p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight); |
| 98208 | + if( isCommuted ){ |
| 98209 | + p4 = sqlite3BinaryCompareCollSeq(pParse, pRight, pLeft); |
| 98210 | + }else{ |
| 98211 | + p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight); |
| 98212 | + } |
| 97869 | 98213 | p5 = binaryCompareP5(pLeft, pRight, jumpIfNull); |
| 97870 | 98214 | addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1, |
| 97871 | 98215 | (void*)p4, P4_COLLSEQ); |
| 97872 | 98216 | sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5); |
| 97873 | 98217 | return addr; |
| | @@ -98074,10 +98418,11 @@ |
| 98074 | 98418 | int i; |
| 98075 | 98419 | int regLeft = 0; |
| 98076 | 98420 | int regRight = 0; |
| 98077 | 98421 | u8 opx = op; |
| 98078 | 98422 | int addrDone = sqlite3VdbeMakeLabel(pParse); |
| 98423 | + int isCommuted = ExprHasProperty(pExpr,EP_Commuted); |
| 98079 | 98424 | |
| 98080 | 98425 | if( nLeft!=sqlite3ExprVectorSize(pRight) ){ |
| 98081 | 98426 | sqlite3ErrorMsg(pParse, "row value misused"); |
| 98082 | 98427 | return; |
| 98083 | 98428 | } |
| | @@ -98103,11 +98448,11 @@ |
| 98103 | 98448 | Expr *pL, *pR; |
| 98104 | 98449 | int r1, r2; |
| 98105 | 98450 | assert( i>=0 && i<nLeft ); |
| 98106 | 98451 | r1 = exprVectorRegister(pParse, pLeft, i, regLeft, &pL, ®Free1); |
| 98107 | 98452 | r2 = exprVectorRegister(pParse, pRight, i, regRight, &pR, ®Free2); |
| 98108 | | - codeCompare(pParse, pL, pR, opx, r1, r2, dest, p5); |
| 98453 | + codeCompare(pParse, pL, pR, opx, r1, r2, dest, p5, isCommuted); |
| 98109 | 98454 | testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); |
| 98110 | 98455 | testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le); |
| 98111 | 98456 | testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt); |
| 98112 | 98457 | testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge); |
| 98113 | 98458 | testcase(op==OP_Eq); VdbeCoverageIf(v,op==OP_Eq); |
| | @@ -100878,35 +101223,77 @@ |
| 100878 | 101223 | sqlite3ExprCodeGetColumnOfTable(pParse->pVdbe, pIdx->pTable, iTabCur, |
| 100879 | 101224 | iTabCol, regOut); |
| 100880 | 101225 | } |
| 100881 | 101226 | } |
| 100882 | 101227 | |
| 101228 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 101229 | +/* |
| 101230 | +** Generate code that will compute the value of generated column pCol |
| 101231 | +** and store the result in register regOut |
| 101232 | +*/ |
| 101233 | +SQLITE_PRIVATE void sqlite3ExprCodeGeneratedColumn( |
| 101234 | + Parse *pParse, |
| 101235 | + Column *pCol, |
| 101236 | + int regOut |
| 101237 | +){ |
| 101238 | + sqlite3ExprCode(pParse, pCol->pDflt, regOut); |
| 101239 | + if( pCol->affinity>=SQLITE_AFF_TEXT ){ |
| 101240 | + sqlite3VdbeAddOp4(pParse->pVdbe, OP_Affinity, regOut, 1, 0, |
| 101241 | + &pCol->affinity, 1); |
| 101242 | + } |
| 101243 | +} |
| 101244 | +#endif /* SQLITE_OMIT_GENERATED_COLUMNS */ |
| 101245 | + |
| 100883 | 101246 | /* |
| 100884 | 101247 | ** Generate code to extract the value of the iCol-th column of a table. |
| 100885 | 101248 | */ |
| 100886 | 101249 | SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable( |
| 100887 | | - Vdbe *v, /* The VDBE under construction */ |
| 101250 | + Vdbe *v, /* Parsing context */ |
| 100888 | 101251 | Table *pTab, /* The table containing the value */ |
| 100889 | 101252 | int iTabCur, /* The table cursor. Or the PK cursor for WITHOUT ROWID */ |
| 100890 | 101253 | int iCol, /* Index of the column to extract */ |
| 100891 | 101254 | int regOut /* Extract the value into this register */ |
| 100892 | 101255 | ){ |
| 101256 | + Column *pCol; |
| 101257 | + assert( v!=0 ); |
| 100893 | 101258 | if( pTab==0 ){ |
| 100894 | 101259 | sqlite3VdbeAddOp3(v, OP_Column, iTabCur, iCol, regOut); |
| 100895 | 101260 | return; |
| 100896 | 101261 | } |
| 100897 | 101262 | if( iCol<0 || iCol==pTab->iPKey ){ |
| 100898 | 101263 | sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut); |
| 100899 | 101264 | }else{ |
| 100900 | | - int op = IsVirtual(pTab) ? OP_VColumn : OP_Column; |
| 100901 | | - int x = iCol; |
| 100902 | | - if( !HasRowid(pTab) && !IsVirtual(pTab) ){ |
| 100903 | | - x = sqlite3ColumnOfIndex(sqlite3PrimaryKeyIndex(pTab), iCol); |
| 101265 | + int op; |
| 101266 | + int x; |
| 101267 | + if( IsVirtual(pTab) ){ |
| 101268 | + op = OP_VColumn; |
| 101269 | + x = iCol; |
| 101270 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 101271 | + }else if( (pCol = &pTab->aCol[iCol])->colFlags & COLFLAG_VIRTUAL ){ |
| 101272 | + Parse *pParse = sqlite3VdbeParser(v); |
| 101273 | + if( pCol->colFlags & COLFLAG_BUSY ){ |
| 101274 | + sqlite3ErrorMsg(pParse, "generated column loop on \"%s\"", pCol->zName); |
| 101275 | + }else{ |
| 101276 | + int savedSelfTab = pParse->iSelfTab; |
| 101277 | + pCol->colFlags |= COLFLAG_BUSY; |
| 101278 | + pParse->iSelfTab = iTabCur+1; |
| 101279 | + sqlite3ExprCodeGeneratedColumn(pParse, pCol, regOut); |
| 101280 | + pParse->iSelfTab = savedSelfTab; |
| 101281 | + pCol->colFlags &= ~COLFLAG_BUSY; |
| 101282 | + } |
| 101283 | + return; |
| 101284 | +#endif |
| 101285 | + }else if( !HasRowid(pTab) ){ |
| 101286 | + testcase( iCol!=sqlite3TableColumnToStorage(pTab, iCol) ); |
| 101287 | + x = sqlite3TableColumnToIndex(sqlite3PrimaryKeyIndex(pTab), iCol); |
| 101288 | + op = OP_Column; |
| 101289 | + }else{ |
| 101290 | + x = sqlite3TableColumnToStorage(pTab,iCol); |
| 101291 | + testcase( x!=iCol ); |
| 101292 | + op = OP_Column; |
| 100904 | 101293 | } |
| 100905 | 101294 | sqlite3VdbeAddOp3(v, op, iTabCur, x, regOut); |
| 100906 | | - } |
| 100907 | | - if( iCol>=0 ){ |
| 100908 | 101295 | sqlite3ColumnDefault(v, pTab, iCol, regOut); |
| 100909 | 101296 | } |
| 100910 | 101297 | } |
| 100911 | 101298 | |
| 100912 | 101299 | /* |
| | @@ -100922,15 +101309,14 @@ |
| 100922 | 101309 | int iColumn, /* Index of the table column */ |
| 100923 | 101310 | int iTable, /* The cursor pointing to the table */ |
| 100924 | 101311 | int iReg, /* Store results here */ |
| 100925 | 101312 | u8 p5 /* P5 value for OP_Column + FLAGS */ |
| 100926 | 101313 | ){ |
| 100927 | | - Vdbe *v = pParse->pVdbe; |
| 100928 | | - assert( v!=0 ); |
| 100929 | | - sqlite3ExprCodeGetColumnOfTable(v, pTab, iTable, iColumn, iReg); |
| 101314 | + assert( pParse->pVdbe!=0 ); |
| 101315 | + sqlite3ExprCodeGetColumnOfTable(pParse->pVdbe, pTab, iTable, iColumn, iReg); |
| 100930 | 101316 | if( p5 ){ |
| 100931 | | - sqlite3VdbeChangeP5(v, p5); |
| 101317 | + sqlite3VdbeChangeP5(pParse->pVdbe, p5); |
| 100932 | 101318 | } |
| 100933 | 101319 | return iReg; |
| 100934 | 101320 | } |
| 100935 | 101321 | |
| 100936 | 101322 | /* |
| | @@ -101062,23 +101448,50 @@ |
| 101062 | 101448 | } |
| 101063 | 101449 | return iReg; |
| 101064 | 101450 | } |
| 101065 | 101451 | if( iTab<0 ){ |
| 101066 | 101452 | if( pParse->iSelfTab<0 ){ |
| 101067 | | - /* Generating CHECK constraints or inserting into partial index */ |
| 101068 | | - assert( pExpr->y.pTab!=0 ); |
| 101069 | | - assert( pExpr->iColumn>=XN_ROWID ); |
| 101070 | | - assert( pExpr->iColumn<pExpr->y.pTab->nCol ); |
| 101071 | | - if( pExpr->iColumn>=0 |
| 101072 | | - && pExpr->y.pTab->aCol[pExpr->iColumn].affinity==SQLITE_AFF_REAL |
| 101073 | | - ){ |
| 101074 | | - sqlite3VdbeAddOp2(v, OP_SCopy, pExpr->iColumn - pParse->iSelfTab, |
| 101075 | | - target); |
| 101453 | + /* Other columns in the same row for CHECK constraints or |
| 101454 | + ** generated columns or for inserting into partial index. |
| 101455 | + ** The row is unpacked into registers beginning at |
| 101456 | + ** 0-(pParse->iSelfTab). The rowid (if any) is in a register |
| 101457 | + ** immediately prior to the first column. |
| 101458 | + */ |
| 101459 | + Column *pCol; |
| 101460 | + Table *pTab = pExpr->y.pTab; |
| 101461 | + int iSrc; |
| 101462 | + int iCol = pExpr->iColumn; |
| 101463 | + assert( pTab!=0 ); |
| 101464 | + assert( iCol>=XN_ROWID ); |
| 101465 | + assert( iCol<pExpr->y.pTab->nCol ); |
| 101466 | + if( iCol<0 ){ |
| 101467 | + return -1-pParse->iSelfTab; |
| 101468 | + } |
| 101469 | + pCol = pTab->aCol + iCol; |
| 101470 | + testcase( iCol!=sqlite3TableColumnToStorage(pTab,iCol) ); |
| 101471 | + iSrc = sqlite3TableColumnToStorage(pTab, iCol) - pParse->iSelfTab; |
| 101472 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 101473 | + if( pCol->colFlags & COLFLAG_GENERATED ){ |
| 101474 | + if( pCol->colFlags & COLFLAG_BUSY ){ |
| 101475 | + sqlite3ErrorMsg(pParse, "generated column loop on \"%s\"", |
| 101476 | + pCol->zName); |
| 101477 | + return 0; |
| 101478 | + } |
| 101479 | + pCol->colFlags |= COLFLAG_BUSY; |
| 101480 | + if( pCol->colFlags & COLFLAG_NOTAVAIL ){ |
| 101481 | + sqlite3ExprCodeGeneratedColumn(pParse, pCol, iSrc); |
| 101482 | + } |
| 101483 | + pCol->colFlags &= ~(COLFLAG_BUSY|COLFLAG_NOTAVAIL); |
| 101484 | + return iSrc; |
| 101485 | + }else |
| 101486 | +#endif /* SQLITE_OMIT_GENERATED_COLUMNS */ |
| 101487 | + if( pCol->affinity==SQLITE_AFF_REAL ){ |
| 101488 | + sqlite3VdbeAddOp2(v, OP_SCopy, iSrc, target); |
| 101076 | 101489 | sqlite3VdbeAddOp1(v, OP_RealAffinity, target); |
| 101077 | 101490 | return target; |
| 101078 | 101491 | }else{ |
| 101079 | | - return pExpr->iColumn - pParse->iSelfTab; |
| 101492 | + return iSrc; |
| 101080 | 101493 | } |
| 101081 | 101494 | }else{ |
| 101082 | 101495 | /* Coding an expression that is part of an index where column names |
| 101083 | 101496 | ** in the index refer to the table to which the index belongs */ |
| 101084 | 101497 | iTab = pParse->iSelfTab - 1; |
| | @@ -101173,11 +101586,12 @@ |
| 101173 | 101586 | codeVectorCompare(pParse, pExpr, target, op, p5); |
| 101174 | 101587 | }else{ |
| 101175 | 101588 | r1 = sqlite3ExprCodeTemp(pParse, pLeft, ®Free1); |
| 101176 | 101589 | r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); |
| 101177 | 101590 | codeCompare(pParse, pLeft, pExpr->pRight, op, |
| 101178 | | - r1, r2, inReg, SQLITE_STOREP2 | p5); |
| 101591 | + r1, r2, inReg, SQLITE_STOREP2 | p5, |
| 101592 | + ExprHasProperty(pExpr,EP_Commuted)); |
| 101179 | 101593 | assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); |
| 101180 | 101594 | assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le); |
| 101181 | 101595 | assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt); |
| 101182 | 101596 | assert(TK_GE==OP_Ge); testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge); |
| 101183 | 101597 | assert(TK_EQ==OP_Eq); testcase(op==OP_Eq); VdbeCoverageIf(v,op==OP_Eq); |
| | @@ -101442,13 +101856,12 @@ |
| 101442 | 101856 | sqlite3VdbeAddOp2(v, OP_Null, 0, target); |
| 101443 | 101857 | } |
| 101444 | 101858 | }else |
| 101445 | 101859 | #endif |
| 101446 | 101860 | { |
| 101447 | | - sqlite3VdbeAddOp4(v, pParse->iSelfTab ? OP_PureFunc0 : OP_Function0, |
| 101448 | | - constMask, r1, target, (char*)pDef, P4_FUNCDEF); |
| 101449 | | - sqlite3VdbeChangeP5(v, (u8)nFarg); |
| 101861 | + sqlite3VdbeAddFunctionCall(pParse, constMask, r1, target, nFarg, |
| 101862 | + pDef, pExpr->op2); |
| 101450 | 101863 | } |
| 101451 | 101864 | if( nFarg && constMask==0 ){ |
| 101452 | 101865 | sqlite3ReleaseTempRange(pParse, r1, nFarg); |
| 101453 | 101866 | } |
| 101454 | 101867 | return target; |
| | @@ -101541,32 +101954,32 @@ |
| 101541 | 101954 | ** p1==0 -> old.rowid p1==3 -> new.rowid |
| 101542 | 101955 | ** p1==1 -> old.a p1==4 -> new.a |
| 101543 | 101956 | ** p1==2 -> old.b p1==5 -> new.b |
| 101544 | 101957 | */ |
| 101545 | 101958 | Table *pTab = pExpr->y.pTab; |
| 101546 | | - int p1 = pExpr->iTable * (pTab->nCol+1) + 1 + pExpr->iColumn; |
| 101959 | + int iCol = pExpr->iColumn; |
| 101960 | + int p1 = pExpr->iTable * (pTab->nCol+1) + 1 |
| 101961 | + + (iCol>=0 ? sqlite3TableColumnToStorage(pTab, iCol) : -1); |
| 101547 | 101962 | |
| 101548 | 101963 | assert( pExpr->iTable==0 || pExpr->iTable==1 ); |
| 101549 | | - assert( pExpr->iColumn>=-1 && pExpr->iColumn<pTab->nCol ); |
| 101550 | | - assert( pTab->iPKey<0 || pExpr->iColumn!=pTab->iPKey ); |
| 101964 | + assert( iCol>=-1 && iCol<pTab->nCol ); |
| 101965 | + assert( pTab->iPKey<0 || iCol!=pTab->iPKey ); |
| 101551 | 101966 | assert( p1>=0 && p1<(pTab->nCol*2+2) ); |
| 101552 | 101967 | |
| 101553 | 101968 | sqlite3VdbeAddOp2(v, OP_Param, p1, target); |
| 101554 | 101969 | VdbeComment((v, "r[%d]=%s.%s", target, |
| 101555 | 101970 | (pExpr->iTable ? "new" : "old"), |
| 101556 | | - (pExpr->iColumn<0 ? "rowid" : pExpr->y.pTab->aCol[pExpr->iColumn].zName) |
| 101971 | + (pExpr->iColumn<0 ? "rowid" : pExpr->y.pTab->aCol[iCol].zName) |
| 101557 | 101972 | )); |
| 101558 | 101973 | |
| 101559 | 101974 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| 101560 | 101975 | /* If the column has REAL affinity, it may currently be stored as an |
| 101561 | 101976 | ** integer. Use OP_RealAffinity to make sure it is really real. |
| 101562 | 101977 | ** |
| 101563 | 101978 | ** EVIDENCE-OF: R-60985-57662 SQLite will convert the value back to |
| 101564 | 101979 | ** floating point when extracting it from the record. */ |
| 101565 | | - if( pExpr->iColumn>=0 |
| 101566 | | - && pTab->aCol[pExpr->iColumn].affinity==SQLITE_AFF_REAL |
| 101567 | | - ){ |
| 101980 | + if( iCol>=0 && pTab->aCol[iCol].affinity==SQLITE_AFF_REAL ){ |
| 101568 | 101981 | sqlite3VdbeAddOp1(v, OP_RealAffinity, target); |
| 101569 | 101982 | } |
| 101570 | 101983 | #endif |
| 101571 | 101984 | break; |
| 101572 | 101985 | } |
| | @@ -101795,18 +102208,14 @@ |
| 101795 | 102208 | */ |
| 101796 | 102209 | SQLITE_PRIVATE void sqlite3ExprCode(Parse *pParse, Expr *pExpr, int target){ |
| 101797 | 102210 | int inReg; |
| 101798 | 102211 | |
| 101799 | 102212 | assert( target>0 && target<=pParse->nMem ); |
| 101800 | | - if( pExpr && pExpr->op==TK_REGISTER ){ |
| 101801 | | - sqlite3VdbeAddOp2(pParse->pVdbe, OP_Copy, pExpr->iTable, target); |
| 101802 | | - }else{ |
| 101803 | | - inReg = sqlite3ExprCodeTarget(pParse, pExpr, target); |
| 101804 | | - assert( pParse->pVdbe!=0 || pParse->db->mallocFailed ); |
| 101805 | | - if( inReg!=target && pParse->pVdbe ){ |
| 101806 | | - sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, inReg, target); |
| 101807 | | - } |
| 102213 | + inReg = sqlite3ExprCodeTarget(pParse, pExpr, target); |
| 102214 | + assert( pParse->pVdbe!=0 || pParse->db->mallocFailed ); |
| 102215 | + if( inReg!=target && pParse->pVdbe ){ |
| 102216 | + sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, inReg, target); |
| 101808 | 102217 | } |
| 101809 | 102218 | } |
| 101810 | 102219 | |
| 101811 | 102220 | /* |
| 101812 | 102221 | ** Make a transient copy of expression pExpr and then code it using |
| | @@ -101832,34 +102241,10 @@ |
| 101832 | 102241 | }else{ |
| 101833 | 102242 | sqlite3ExprCode(pParse, pExpr, target); |
| 101834 | 102243 | } |
| 101835 | 102244 | } |
| 101836 | 102245 | |
| 101837 | | -/* |
| 101838 | | -** Generate code that evaluates the given expression and puts the result |
| 101839 | | -** in register target. |
| 101840 | | -** |
| 101841 | | -** Also make a copy of the expression results into another "cache" register |
| 101842 | | -** and modify the expression so that the next time it is evaluated, |
| 101843 | | -** the result is a copy of the cache register. |
| 101844 | | -** |
| 101845 | | -** This routine is used for expressions that are used multiple |
| 101846 | | -** times. They are evaluated once and the results of the expression |
| 101847 | | -** are reused. |
| 101848 | | -*/ |
| 101849 | | -SQLITE_PRIVATE void sqlite3ExprCodeAndCache(Parse *pParse, Expr *pExpr, int target){ |
| 101850 | | - Vdbe *v = pParse->pVdbe; |
| 101851 | | - int iMem; |
| 101852 | | - |
| 101853 | | - assert( target>0 ); |
| 101854 | | - assert( pExpr->op!=TK_REGISTER ); |
| 101855 | | - sqlite3ExprCode(pParse, pExpr, target); |
| 101856 | | - iMem = ++pParse->nMem; |
| 101857 | | - sqlite3VdbeAddOp2(v, OP_Copy, target, iMem); |
| 101858 | | - exprToRegister(pExpr, iMem); |
| 101859 | | -} |
| 101860 | | - |
| 101861 | 102246 | /* |
| 101862 | 102247 | ** Generate code that pushes the value of every element of the given |
| 101863 | 102248 | ** expression list into a sequence of registers beginning at target. |
| 101864 | 102249 | ** |
| 101865 | 102250 | ** Return the number of elements evaluated. The number returned will |
| | @@ -102093,11 +102478,11 @@ |
| 102093 | 102478 | if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr; |
| 102094 | 102479 | testcase( jumpIfNull==0 ); |
| 102095 | 102480 | r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); |
| 102096 | 102481 | r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); |
| 102097 | 102482 | codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, |
| 102098 | | - r1, r2, dest, jumpIfNull); |
| 102483 | + r1, r2, dest, jumpIfNull, ExprHasProperty(pExpr,EP_Commuted)); |
| 102099 | 102484 | assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); |
| 102100 | 102485 | assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le); |
| 102101 | 102486 | assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt); |
| 102102 | 102487 | assert(TK_GE==OP_Ge); testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge); |
| 102103 | 102488 | assert(TK_EQ==OP_Eq); testcase(op==OP_Eq); |
| | @@ -102268,11 +102653,11 @@ |
| 102268 | 102653 | if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr; |
| 102269 | 102654 | testcase( jumpIfNull==0 ); |
| 102270 | 102655 | r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); |
| 102271 | 102656 | r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); |
| 102272 | 102657 | codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, |
| 102273 | | - r1, r2, dest, jumpIfNull); |
| 102658 | + r1, r2, dest, jumpIfNull,ExprHasProperty(pExpr,EP_Commuted)); |
| 102274 | 102659 | assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); |
| 102275 | 102660 | assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le); |
| 102276 | 102661 | assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt); |
| 102277 | 102662 | assert(TK_GE==OP_Ge); testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge); |
| 102278 | 102663 | assert(TK_EQ==OP_Eq); testcase(op==OP_Eq); |
| | @@ -102454,11 +102839,12 @@ |
| 102454 | 102839 | if( sqlite3_stricmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2; |
| 102455 | 102840 | }else if( ALWAYS(pB->u.zToken!=0) && strcmp(pA->u.zToken,pB->u.zToken)!=0 ){ |
| 102456 | 102841 | return 2; |
| 102457 | 102842 | } |
| 102458 | 102843 | } |
| 102459 | | - if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2; |
| 102844 | + if( (pA->flags & (EP_Distinct|EP_Commuted)) |
| 102845 | + != (pB->flags & (EP_Distinct|EP_Commuted)) ) return 2; |
| 102460 | 102846 | if( (combinedFlags & EP_TokenOnly)==0 ){ |
| 102461 | 102847 | if( combinedFlags & EP_xIsSelect ) return 2; |
| 102462 | 102848 | if( (combinedFlags & EP_FixedCol)==0 |
| 102463 | 102849 | && sqlite3ExprCompare(pParse, pA->pLeft, pB->pLeft, iTab) ) return 2; |
| 102464 | 102850 | if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2; |
| | @@ -102466,14 +102852,28 @@ |
| 102466 | 102852 | if( pA->op!=TK_STRING |
| 102467 | 102853 | && pA->op!=TK_TRUEFALSE |
| 102468 | 102854 | && (combinedFlags & EP_Reduced)==0 |
| 102469 | 102855 | ){ |
| 102470 | 102856 | if( pA->iColumn!=pB->iColumn ) return 2; |
| 102471 | | - if( pA->op2!=pB->op2 ) return 2; |
| 102472 | | - if( pA->op!=TK_IN |
| 102473 | | - && pA->iTable!=pB->iTable |
| 102474 | | - && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2; |
| 102857 | + if( pA->op2!=pB->op2 ){ |
| 102858 | + if( pA->op==TK_TRUTH ) return 2; |
| 102859 | + if( pA->op==TK_FUNCTION && iTab<0 ){ |
| 102860 | + /* Ex: CREATE TABLE t1(a CHECK( a<julianday('now') )); |
| 102861 | + ** INSERT INTO t1(a) VALUES(julianday('now')+10); |
| 102862 | + ** Without this test, sqlite3ExprCodeAtInit() will run on the |
| 102863 | + ** the julianday() of INSERT first, and remember that expression. |
| 102864 | + ** Then sqlite3ExprCodeInit() will see the julianday() in the CHECK |
| 102865 | + ** constraint as redundant, reusing the one from the INSERT, even |
| 102866 | + ** though the julianday() in INSERT lacks the critical NC_IsCheck |
| 102867 | + ** flag. See ticket [830277d9db6c3ba1] (2019-10-30) |
| 102868 | + */ |
| 102869 | + return 2; |
| 102870 | + } |
| 102871 | + } |
| 102872 | + if( pA->op!=TK_IN && pA->iTable!=pB->iTable && pA->iTable!=iTab ){ |
| 102873 | + return 2; |
| 102874 | + } |
| 102475 | 102875 | } |
| 102476 | 102876 | } |
| 102477 | 102877 | return 0; |
| 102478 | 102878 | } |
| 102479 | 102879 | |
| | @@ -102636,11 +103036,11 @@ |
| 102636 | 103036 | } |
| 102637 | 103037 | return 0; |
| 102638 | 103038 | } |
| 102639 | 103039 | |
| 102640 | 103040 | /* |
| 102641 | | -** This is the Expr node callback for sqlite3ExprImpliesNotNullRow(). |
| 103041 | +** This is the Expr node callback for sqlite3ExprImpliesNonNullRow(). |
| 102642 | 103042 | ** If the expression node requires that the table at pWalker->iCur |
| 102643 | 103043 | ** have one or more non-NULL column, then set pWalker->eCode to 1 and abort. |
| 102644 | 103044 | ** |
| 102645 | 103045 | ** This routine controls an optimization. False positives (setting |
| 102646 | 103046 | ** pWalker->eCode to 1 when it should not be) are deadly, but false-negatives |
| | @@ -102654,34 +103054,39 @@ |
| 102654 | 103054 | case TK_ISNOT: |
| 102655 | 103055 | case TK_ISNULL: |
| 102656 | 103056 | case TK_NOTNULL: |
| 102657 | 103057 | case TK_IS: |
| 102658 | 103058 | case TK_OR: |
| 103059 | + case TK_VECTOR: |
| 102659 | 103060 | case TK_CASE: |
| 102660 | 103061 | case TK_IN: |
| 102661 | 103062 | case TK_FUNCTION: |
| 103063 | + case TK_TRUTH: |
| 102662 | 103064 | testcase( pExpr->op==TK_ISNOT ); |
| 102663 | 103065 | testcase( pExpr->op==TK_ISNULL ); |
| 102664 | 103066 | testcase( pExpr->op==TK_NOTNULL ); |
| 102665 | 103067 | testcase( pExpr->op==TK_IS ); |
| 102666 | 103068 | testcase( pExpr->op==TK_OR ); |
| 103069 | + testcase( pExpr->op==TK_VECTOR ); |
| 102667 | 103070 | testcase( pExpr->op==TK_CASE ); |
| 102668 | 103071 | testcase( pExpr->op==TK_IN ); |
| 102669 | 103072 | testcase( pExpr->op==TK_FUNCTION ); |
| 103073 | + testcase( pExpr->op==TK_TRUTH ); |
| 102670 | 103074 | return WRC_Prune; |
| 102671 | 103075 | case TK_COLUMN: |
| 102672 | 103076 | if( pWalker->u.iCur==pExpr->iTable ){ |
| 102673 | 103077 | pWalker->eCode = 1; |
| 102674 | 103078 | return WRC_Abort; |
| 102675 | 103079 | } |
| 102676 | 103080 | return WRC_Prune; |
| 102677 | 103081 | |
| 102678 | 103082 | case TK_AND: |
| 102679 | | - if( sqlite3ExprImpliesNonNullRow(pExpr->pLeft, pWalker->u.iCur) |
| 102680 | | - && sqlite3ExprImpliesNonNullRow(pExpr->pRight, pWalker->u.iCur) |
| 102681 | | - ){ |
| 102682 | | - pWalker->eCode = 1; |
| 103083 | + assert( pWalker->eCode==0 ); |
| 103084 | + sqlite3WalkExpr(pWalker, pExpr->pLeft); |
| 103085 | + if( pWalker->eCode ){ |
| 103086 | + pWalker->eCode = 0; |
| 103087 | + sqlite3WalkExpr(pWalker, pExpr->pRight); |
| 102683 | 103088 | } |
| 102684 | 103089 | return WRC_Prune; |
| 102685 | 103090 | |
| 102686 | 103091 | case TK_BETWEEN: |
| 102687 | 103092 | sqlite3WalkExpr(pWalker, pExpr->pLeft); |
| | @@ -102736,18 +103141,17 @@ |
| 102736 | 103141 | ** ordinary join. |
| 102737 | 103142 | */ |
| 102738 | 103143 | SQLITE_PRIVATE int sqlite3ExprImpliesNonNullRow(Expr *p, int iTab){ |
| 102739 | 103144 | Walker w; |
| 102740 | 103145 | p = sqlite3ExprSkipCollateAndLikely(p); |
| 102741 | | - while( p ){ |
| 102742 | | - if( p->op==TK_NOTNULL ){ |
| 102743 | | - p = p->pLeft; |
| 102744 | | - }else if( p->op==TK_AND ){ |
| 103146 | + if( p==0 ) return 0; |
| 103147 | + if( p->op==TK_NOTNULL ){ |
| 103148 | + p = p->pLeft; |
| 103149 | + }else{ |
| 103150 | + while( p->op==TK_AND ){ |
| 102745 | 103151 | if( sqlite3ExprImpliesNonNullRow(p->pLeft, iTab) ) return 1; |
| 102746 | 103152 | p = p->pRight; |
| 102747 | | - }else{ |
| 102748 | | - break; |
| 102749 | 103153 | } |
| 102750 | 103154 | } |
| 102751 | 103155 | w.xExprCallback = impliesNotNullRow; |
| 102752 | 103156 | w.xSelectCallback = 0; |
| 102753 | 103157 | w.xSelectCallback2 = 0; |
| | @@ -102775,11 +103179,11 @@ |
| 102775 | 103179 | ** pWalker->u.pIdxCover->pIdx. |
| 102776 | 103180 | */ |
| 102777 | 103181 | static int exprIdxCover(Walker *pWalker, Expr *pExpr){ |
| 102778 | 103182 | if( pExpr->op==TK_COLUMN |
| 102779 | 103183 | && pExpr->iTable==pWalker->u.pIdxCover->iCur |
| 102780 | | - && sqlite3ColumnOfIndex(pWalker->u.pIdxCover->pIdx, pExpr->iColumn)<0 |
| 103184 | + && sqlite3TableColumnToIndex(pWalker->u.pIdxCover->pIdx, pExpr->iColumn)<0 |
| 102781 | 103185 | ){ |
| 102782 | 103186 | pWalker->eCode = 1; |
| 102783 | 103187 | return WRC_Abort; |
| 102784 | 103188 | } |
| 102785 | 103189 | return WRC_Continue; |
| | @@ -103201,13 +103605,12 @@ |
| 103201 | 103605 | ** Or, if zName is not a system table, zero is returned. |
| 103202 | 103606 | */ |
| 103203 | 103607 | static int isAlterableTable(Parse *pParse, Table *pTab){ |
| 103204 | 103608 | if( 0==sqlite3StrNICmp(pTab->zName, "sqlite_", 7) |
| 103205 | 103609 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 103206 | | - || ( (pTab->tabFlags & TF_Shadow) |
| 103207 | | - && (pParse->db->flags & SQLITE_Defensive) |
| 103208 | | - && pParse->db->nVdbeExec==0 |
| 103610 | + || ( (pTab->tabFlags & TF_Shadow)!=0 |
| 103611 | + && sqlite3ReadOnlyShadowTables(pParse->db) |
| 103209 | 103612 | ) |
| 103210 | 103613 | #endif |
| 103211 | 103614 | ){ |
| 103212 | 103615 | sqlite3ErrorMsg(pParse, "table %s may not be altered", pTab->zName); |
| 103213 | 103616 | return 1; |
| | @@ -103468,18 +103871,10 @@ |
| 103468 | 103871 | if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){ |
| 103469 | 103872 | return; |
| 103470 | 103873 | } |
| 103471 | 103874 | #endif |
| 103472 | 103875 | |
| 103473 | | - /* If the default value for the new column was specified with a |
| 103474 | | - ** literal NULL, then set pDflt to 0. This simplifies checking |
| 103475 | | - ** for an SQL NULL default below. |
| 103476 | | - */ |
| 103477 | | - assert( pDflt==0 || pDflt->op==TK_SPAN ); |
| 103478 | | - if( pDflt && pDflt->pLeft->op==TK_NULL ){ |
| 103479 | | - pDflt = 0; |
| 103480 | | - } |
| 103481 | 103876 | |
| 103482 | 103877 | /* Check that the new column is not specified as PRIMARY KEY or UNIQUE. |
| 103483 | 103878 | ** If there is a NOT NULL constraint, then the default value for the |
| 103484 | 103879 | ** column must not be NULL. |
| 103485 | 103880 | */ |
| | @@ -103489,39 +103884,53 @@ |
| 103489 | 103884 | } |
| 103490 | 103885 | if( pNew->pIndex ){ |
| 103491 | 103886 | sqlite3ErrorMsg(pParse, "Cannot add a UNIQUE column"); |
| 103492 | 103887 | return; |
| 103493 | 103888 | } |
| 103494 | | - if( (db->flags&SQLITE_ForeignKeys) && pNew->pFKey && pDflt ){ |
| 103495 | | - sqlite3ErrorMsg(pParse, |
| 103496 | | - "Cannot add a REFERENCES column with non-NULL default value"); |
| 103497 | | - return; |
| 103498 | | - } |
| 103499 | | - if( pCol->notNull && !pDflt ){ |
| 103500 | | - sqlite3ErrorMsg(pParse, |
| 103501 | | - "Cannot add a NOT NULL column with default value NULL"); |
| 103502 | | - return; |
| 103503 | | - } |
| 103504 | | - |
| 103505 | | - /* Ensure the default expression is something that sqlite3ValueFromExpr() |
| 103506 | | - ** can handle (i.e. not CURRENT_TIME etc.) |
| 103507 | | - */ |
| 103508 | | - if( pDflt ){ |
| 103509 | | - sqlite3_value *pVal = 0; |
| 103510 | | - int rc; |
| 103511 | | - rc = sqlite3ValueFromExpr(db, pDflt, SQLITE_UTF8, SQLITE_AFF_BLOB, &pVal); |
| 103512 | | - assert( rc==SQLITE_OK || rc==SQLITE_NOMEM ); |
| 103513 | | - if( rc!=SQLITE_OK ){ |
| 103514 | | - assert( db->mallocFailed == 1 ); |
| 103515 | | - return; |
| 103516 | | - } |
| 103517 | | - if( !pVal ){ |
| 103518 | | - sqlite3ErrorMsg(pParse, "Cannot add a column with non-constant default"); |
| 103519 | | - return; |
| 103520 | | - } |
| 103521 | | - sqlite3ValueFree(pVal); |
| 103522 | | - } |
| 103889 | + if( (pCol->colFlags & COLFLAG_GENERATED)==0 ){ |
| 103890 | + /* If the default value for the new column was specified with a |
| 103891 | + ** literal NULL, then set pDflt to 0. This simplifies checking |
| 103892 | + ** for an SQL NULL default below. |
| 103893 | + */ |
| 103894 | + assert( pDflt==0 || pDflt->op==TK_SPAN ); |
| 103895 | + if( pDflt && pDflt->pLeft->op==TK_NULL ){ |
| 103896 | + pDflt = 0; |
| 103897 | + } |
| 103898 | + if( (db->flags&SQLITE_ForeignKeys) && pNew->pFKey && pDflt ){ |
| 103899 | + sqlite3ErrorMsg(pParse, |
| 103900 | + "Cannot add a REFERENCES column with non-NULL default value"); |
| 103901 | + return; |
| 103902 | + } |
| 103903 | + if( pCol->notNull && !pDflt ){ |
| 103904 | + sqlite3ErrorMsg(pParse, |
| 103905 | + "Cannot add a NOT NULL column with default value NULL"); |
| 103906 | + return; |
| 103907 | + } |
| 103908 | + |
| 103909 | + /* Ensure the default expression is something that sqlite3ValueFromExpr() |
| 103910 | + ** can handle (i.e. not CURRENT_TIME etc.) |
| 103911 | + */ |
| 103912 | + if( pDflt ){ |
| 103913 | + sqlite3_value *pVal = 0; |
| 103914 | + int rc; |
| 103915 | + rc = sqlite3ValueFromExpr(db, pDflt, SQLITE_UTF8, SQLITE_AFF_BLOB, &pVal); |
| 103916 | + assert( rc==SQLITE_OK || rc==SQLITE_NOMEM ); |
| 103917 | + if( rc!=SQLITE_OK ){ |
| 103918 | + assert( db->mallocFailed == 1 ); |
| 103919 | + return; |
| 103920 | + } |
| 103921 | + if( !pVal ){ |
| 103922 | + sqlite3ErrorMsg(pParse,"Cannot add a column with non-constant default"); |
| 103923 | + return; |
| 103924 | + } |
| 103925 | + sqlite3ValueFree(pVal); |
| 103926 | + } |
| 103927 | + }else if( pCol->colFlags & COLFLAG_STORED ){ |
| 103928 | + sqlite3ErrorMsg(pParse, "cannot add a STORED column"); |
| 103929 | + return; |
| 103930 | + } |
| 103931 | + |
| 103523 | 103932 | |
| 103524 | 103933 | /* Modify the CREATE TABLE statement. */ |
| 103525 | 103934 | zCol = sqlite3DbStrNDup(db, (char*)pColDef->z, pColDef->n); |
| 103526 | 103935 | if( zCol ){ |
| 103527 | 103936 | char *zEnd = &zCol[pColDef->n-1]; |
| | @@ -103605,10 +104014,11 @@ |
| 103605 | 104014 | } |
| 103606 | 104015 | if( SQLITE_OK!=isAlterableTable(pParse, pTab) ){ |
| 103607 | 104016 | goto exit_begin_add_column; |
| 103608 | 104017 | } |
| 103609 | 104018 | |
| 104019 | + sqlite3MayAbort(pParse); |
| 103610 | 104020 | assert( pTab->addColOffset>0 ); |
| 103611 | 104021 | iDb = sqlite3SchemaToIndex(db, pTab->pSchema); |
| 103612 | 104022 | |
| 103613 | 104023 | /* Put a copy of the Table struct in Parse.pNewTable for the |
| 103614 | 104024 | ** sqlite3AddColumn() function and friends to modify. But modify |
| | @@ -104500,10 +104910,15 @@ |
| 104500 | 104910 | } |
| 104501 | 104911 | for(pIdx=sParse.pNewIndex; pIdx; pIdx=pIdx->pNext){ |
| 104502 | 104912 | sqlite3WalkExprList(&sWalker, pIdx->aColExpr); |
| 104503 | 104913 | } |
| 104504 | 104914 | } |
| 104915 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 104916 | + for(i=0; i<sParse.pNewTable->nCol; i++){ |
| 104917 | + sqlite3WalkExpr(&sWalker, sParse.pNewTable->aCol[i].pDflt); |
| 104918 | + } |
| 104919 | +#endif |
| 104505 | 104920 | |
| 104506 | 104921 | for(pFKey=sParse.pNewTable->pFKey; pFKey; pFKey=pFKey->pNextFrom){ |
| 104507 | 104922 | for(i=0; i<pFKey->nCol; i++){ |
| 104508 | 104923 | if( bFKOnly==0 && pFKey->aCol[i].iFrom==iCol ){ |
| 104509 | 104924 | renameTokenFind(&sParse, &sCtx, (void*)&pFKey->aCol[i]); |
| | @@ -105757,22 +106172,21 @@ |
| 105757 | 106172 | 0, 0, /* xValue, xInverse */ |
| 105758 | 106173 | "stat_get", /* zName */ |
| 105759 | 106174 | {0} |
| 105760 | 106175 | }; |
| 105761 | 106176 | |
| 105762 | | -static void callStatGet(Vdbe *v, int regStat4, int iParam, int regOut){ |
| 105763 | | - assert( regOut!=regStat4 && regOut!=regStat4+1 ); |
| 106177 | +static void callStatGet(Parse *pParse, int regStat4, int iParam, int regOut){ |
| 105764 | 106178 | #ifdef SQLITE_ENABLE_STAT4 |
| 105765 | | - sqlite3VdbeAddOp2(v, OP_Integer, iParam, regStat4+1); |
| 106179 | + sqlite3VdbeAddOp2(pParse->pVdbe, OP_Integer, iParam, regStat4+1); |
| 105766 | 106180 | #elif SQLITE_DEBUG |
| 105767 | 106181 | assert( iParam==STAT_GET_STAT1 ); |
| 105768 | 106182 | #else |
| 105769 | 106183 | UNUSED_PARAMETER( iParam ); |
| 105770 | 106184 | #endif |
| 105771 | | - sqlite3VdbeAddOp4(v, OP_Function0, 0, regStat4, regOut, |
| 105772 | | - (char*)&statGetFuncdef, P4_FUNCDEF); |
| 105773 | | - sqlite3VdbeChangeP5(v, 1 + IsStat4); |
| 106185 | + assert( regOut!=regStat4 && regOut!=regStat4+1 ); |
| 106186 | + sqlite3VdbeAddFunctionCall(pParse, 0, regStat4, regOut, 1+IsStat4, |
| 106187 | + &statGetFuncdef, 0); |
| 105774 | 106188 | } |
| 105775 | 106189 | |
| 105776 | 106190 | /* |
| 105777 | 106191 | ** Generate code to do an analysis of all indices associated with |
| 105778 | 106192 | ** a single table. |
| | @@ -105936,13 +106350,12 @@ |
| 105936 | 106350 | #ifdef SQLITE_ENABLE_STAT4 |
| 105937 | 106351 | sqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regStat4+3); |
| 105938 | 106352 | #endif |
| 105939 | 106353 | sqlite3VdbeAddOp2(v, OP_Integer, nCol, regStat4+1); |
| 105940 | 106354 | sqlite3VdbeAddOp2(v, OP_Integer, pIdx->nKeyCol, regStat4+2); |
| 105941 | | - sqlite3VdbeAddOp4(v, OP_Function0, 0, regStat4+1, regStat4, |
| 105942 | | - (char*)&statInitFuncdef, P4_FUNCDEF); |
| 105943 | | - sqlite3VdbeChangeP5(v, 2+IsStat4); |
| 106355 | + sqlite3VdbeAddFunctionCall(pParse, 0, regStat4+1, regStat4, 2+IsStat4, |
| 106356 | + &statInitFuncdef, 0); |
| 105944 | 106357 | |
| 105945 | 106358 | /* Implementation of the following: |
| 105946 | 106359 | ** |
| 105947 | 106360 | ** Rewind csr |
| 105948 | 106361 | ** if eof(csr) goto end_of_scan; |
| | @@ -106023,27 +106436,26 @@ |
| 106023 | 106436 | }else{ |
| 106024 | 106437 | Index *pPk = sqlite3PrimaryKeyIndex(pIdx->pTable); |
| 106025 | 106438 | int j, k, regKey; |
| 106026 | 106439 | regKey = sqlite3GetTempRange(pParse, pPk->nKeyCol); |
| 106027 | 106440 | for(j=0; j<pPk->nKeyCol; j++){ |
| 106028 | | - k = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[j]); |
| 106441 | + k = sqlite3TableColumnToIndex(pIdx, pPk->aiColumn[j]); |
| 106029 | 106442 | assert( k>=0 && k<pIdx->nColumn ); |
| 106030 | 106443 | sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, k, regKey+j); |
| 106031 | 106444 | VdbeComment((v, "%s", pTab->aCol[pPk->aiColumn[j]].zName)); |
| 106032 | 106445 | } |
| 106033 | 106446 | sqlite3VdbeAddOp3(v, OP_MakeRecord, regKey, pPk->nKeyCol, regRowid); |
| 106034 | 106447 | sqlite3ReleaseTempRange(pParse, regKey, pPk->nKeyCol); |
| 106035 | 106448 | } |
| 106036 | 106449 | #endif |
| 106037 | 106450 | assert( regChng==(regStat4+1) ); |
| 106038 | | - sqlite3VdbeAddOp4(v, OP_Function0, 1, regStat4, regTemp, |
| 106039 | | - (char*)&statPushFuncdef, P4_FUNCDEF); |
| 106040 | | - sqlite3VdbeChangeP5(v, 2+IsStat4); |
| 106451 | + sqlite3VdbeAddFunctionCall(pParse, 1, regStat4, regTemp, 2+IsStat4, |
| 106452 | + &statPushFuncdef, 0); |
| 106041 | 106453 | sqlite3VdbeAddOp2(v, OP_Next, iIdxCur, addrNextRow); VdbeCoverage(v); |
| 106042 | 106454 | |
| 106043 | 106455 | /* Add the entry to the stat1 table. */ |
| 106044 | | - callStatGet(v, regStat4, STAT_GET_STAT1, regStat1); |
| 106456 | + callStatGet(pParse, regStat4, STAT_GET_STAT1, regStat1); |
| 106045 | 106457 | assert( "BBB"[0]==SQLITE_AFF_TEXT ); |
| 106046 | 106458 | sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regTemp, "BBB", 0); |
| 106047 | 106459 | sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regNewRowid); |
| 106048 | 106460 | sqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regTemp, regNewRowid); |
| 106049 | 106461 | #ifdef SQLITE_ENABLE_PREUPDATE_HOOK |
| | @@ -106065,16 +106477,16 @@ |
| 106065 | 106477 | u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound; |
| 106066 | 106478 | |
| 106067 | 106479 | pParse->nMem = MAX(pParse->nMem, regCol+nCol); |
| 106068 | 106480 | |
| 106069 | 106481 | addrNext = sqlite3VdbeCurrentAddr(v); |
| 106070 | | - callStatGet(v, regStat4, STAT_GET_ROWID, regSampleRowid); |
| 106482 | + callStatGet(pParse, regStat4, STAT_GET_ROWID, regSampleRowid); |
| 106071 | 106483 | addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regSampleRowid); |
| 106072 | 106484 | VdbeCoverage(v); |
| 106073 | | - callStatGet(v, regStat4, STAT_GET_NEQ, regEq); |
| 106074 | | - callStatGet(v, regStat4, STAT_GET_NLT, regLt); |
| 106075 | | - callStatGet(v, regStat4, STAT_GET_NDLT, regDLt); |
| 106485 | + callStatGet(pParse, regStat4, STAT_GET_NEQ, regEq); |
| 106486 | + callStatGet(pParse, regStat4, STAT_GET_NLT, regLt); |
| 106487 | + callStatGet(pParse, regStat4, STAT_GET_NDLT, regDLt); |
| 106076 | 106488 | sqlite3VdbeAddOp4Int(v, seekOp, iTabCur, addrNext, regSampleRowid, 0); |
| 106077 | 106489 | VdbeCoverage(v); |
| 106078 | 106490 | for(i=0; i<nCol; i++){ |
| 106079 | 106491 | sqlite3ExprCodeLoadIndexColumn(pParse, pIdx, iTabCur, i, regCol+i); |
| 106080 | 106492 | } |
| | @@ -106695,13 +107107,13 @@ |
| 106695 | 107107 | } |
| 106696 | 107108 | |
| 106697 | 107109 | /* Load the statistics from the sqlite_stat4 table. */ |
| 106698 | 107110 | #ifdef SQLITE_ENABLE_STAT4 |
| 106699 | 107111 | if( rc==SQLITE_OK ){ |
| 106700 | | - db->lookaside.bDisable++; |
| 107112 | + DisableLookaside; |
| 106701 | 107113 | rc = loadStat4(db, sInfo.zDatabase); |
| 106702 | | - db->lookaside.bDisable--; |
| 107114 | + EnableLookaside; |
| 106703 | 107115 | } |
| 106704 | 107116 | for(i=sqliteHashFirst(&pSchema->idxHash); i; i=sqliteHashNext(i)){ |
| 106705 | 107117 | Index *pIdx = sqliteHashData(i); |
| 106706 | 107118 | sqlite3_free(pIdx->aiRowEst); |
| 106707 | 107119 | pIdx->aiRowEst = 0; |
| | @@ -107120,15 +107532,12 @@ |
| 107120 | 107532 | sqlite3ExprCode(pParse, pDbname, regArgs+1); |
| 107121 | 107533 | sqlite3ExprCode(pParse, pKey, regArgs+2); |
| 107122 | 107534 | |
| 107123 | 107535 | assert( v || db->mallocFailed ); |
| 107124 | 107536 | if( v ){ |
| 107125 | | - sqlite3VdbeAddOp4(v, OP_Function0, 0, regArgs+3-pFunc->nArg, regArgs+3, |
| 107126 | | - (char *)pFunc, P4_FUNCDEF); |
| 107127 | | - assert( pFunc->nArg==-1 || (pFunc->nArg&0xff)==pFunc->nArg ); |
| 107128 | | - sqlite3VdbeChangeP5(v, (u8)(pFunc->nArg)); |
| 107129 | | - |
| 107537 | + sqlite3VdbeAddFunctionCall(pParse, 0, regArgs+3-pFunc->nArg, regArgs+3, |
| 107538 | + pFunc->nArg, pFunc, 0); |
| 107130 | 107539 | /* Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this |
| 107131 | 107540 | ** statement only). For DETACH, set it to false (expire all existing |
| 107132 | 107541 | ** statements). |
| 107133 | 107542 | */ |
| 107134 | 107543 | sqlite3VdbeAddOp1(v, OP_Expire, (type==SQLITE_ATTACH)); |
| | @@ -108499,17 +108908,18 @@ |
| 108499 | 108908 | sqlite3ErrorMsg(pParse, ""); /* corruptSchema() will supply the error */ |
| 108500 | 108909 | return SQLITE_ERROR; |
| 108501 | 108910 | } |
| 108502 | 108911 | } |
| 108503 | 108912 | }else{ |
| 108504 | | - if( pParse->nested==0 |
| 108505 | | - && 0==sqlite3StrNICmp(zName, "sqlite_", 7) |
| 108913 | + if( (pParse->nested==0 && 0==sqlite3StrNICmp(zName, "sqlite_", 7)) |
| 108914 | + || (sqlite3ReadOnlyShadowTables(db) && sqlite3ShadowTableName(db, zName)) |
| 108506 | 108915 | ){ |
| 108507 | 108916 | sqlite3ErrorMsg(pParse, "object name reserved for internal use: %s", |
| 108508 | 108917 | zName); |
| 108509 | 108918 | return SQLITE_ERROR; |
| 108510 | 108919 | } |
| 108920 | + |
| 108511 | 108921 | } |
| 108512 | 108922 | return SQLITE_OK; |
| 108513 | 108923 | } |
| 108514 | 108924 | |
| 108515 | 108925 | /* |
| | @@ -108520,20 +108930,98 @@ |
| 108520 | 108930 | for(p=pTab->pIndex; p && !IsPrimaryKeyIndex(p); p=p->pNext){} |
| 108521 | 108931 | return p; |
| 108522 | 108932 | } |
| 108523 | 108933 | |
| 108524 | 108934 | /* |
| 108525 | | -** Return the column of index pIdx that corresponds to table |
| 108526 | | -** column iCol. Return -1 if not found. |
| 108935 | +** Convert an table column number into a index column number. That is, |
| 108936 | +** for the column iCol in the table (as defined by the CREATE TABLE statement) |
| 108937 | +** find the (first) offset of that column in index pIdx. Or return -1 |
| 108938 | +** if column iCol is not used in index pIdx. |
| 108527 | 108939 | */ |
| 108528 | | -SQLITE_PRIVATE i16 sqlite3ColumnOfIndex(Index *pIdx, i16 iCol){ |
| 108940 | +SQLITE_PRIVATE i16 sqlite3TableColumnToIndex(Index *pIdx, i16 iCol){ |
| 108529 | 108941 | int i; |
| 108530 | 108942 | for(i=0; i<pIdx->nColumn; i++){ |
| 108531 | 108943 | if( iCol==pIdx->aiColumn[i] ) return i; |
| 108532 | 108944 | } |
| 108533 | 108945 | return -1; |
| 108534 | 108946 | } |
| 108947 | + |
| 108948 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 108949 | +/* Convert a storage column number into a table column number. |
| 108950 | +** |
| 108951 | +** The storage column number (0,1,2,....) is the index of the value |
| 108952 | +** as it appears in the record on disk. The true column number |
| 108953 | +** is the index (0,1,2,...) of the column in the CREATE TABLE statement. |
| 108954 | +** |
| 108955 | +** The storage column number is less than the table column number if |
| 108956 | +** and only there are VIRTUAL columns to the left. |
| 108957 | +** |
| 108958 | +** If SQLITE_OMIT_GENERATED_COLUMNS, this routine is a no-op macro. |
| 108959 | +*/ |
| 108960 | +SQLITE_PRIVATE i16 sqlite3StorageColumnToTable(Table *pTab, i16 iCol){ |
| 108961 | + if( pTab->tabFlags & TF_HasVirtual ){ |
| 108962 | + int i; |
| 108963 | + for(i=0; i<=iCol; i++){ |
| 108964 | + if( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL ) iCol++; |
| 108965 | + } |
| 108966 | + } |
| 108967 | + return iCol; |
| 108968 | +} |
| 108969 | +#endif |
| 108970 | + |
| 108971 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 108972 | +/* Convert a table column number into a storage column number. |
| 108973 | +** |
| 108974 | +** The storage column number (0,1,2,....) is the index of the value |
| 108975 | +** as it appears in the record on disk. Or, if the input column is |
| 108976 | +** the N-th virtual column (zero-based) then the storage number is |
| 108977 | +** the number of non-virtual columns in the table plus N. |
| 108978 | +** |
| 108979 | +** The true column number is the index (0,1,2,...) of the column in |
| 108980 | +** the CREATE TABLE statement. |
| 108981 | +** |
| 108982 | +** If the input column is a VIRTUAL column, then it should not appear |
| 108983 | +** in storage. But the value sometimes is cached in registers that |
| 108984 | +** follow the range of registers used to construct storage. This |
| 108985 | +** avoids computing the same VIRTUAL column multiple times, and provides |
| 108986 | +** values for use by OP_Param opcodes in triggers. Hence, if the |
| 108987 | +** input column is a VIRTUAL table, put it after all the other columns. |
| 108988 | +** |
| 108989 | +** In the following, N means "normal column", S means STORED, and |
| 108990 | +** V means VIRTUAL. Suppose the CREATE TABLE has columns like this: |
| 108991 | +** |
| 108992 | +** CREATE TABLE ex(N,S,V,N,S,V,N,S,V); |
| 108993 | +** -- 0 1 2 3 4 5 6 7 8 |
| 108994 | +** |
| 108995 | +** Then the mapping from this function is as follows: |
| 108996 | +** |
| 108997 | +** INPUTS: 0 1 2 3 4 5 6 7 8 |
| 108998 | +** OUTPUTS: 0 1 6 2 3 7 4 5 8 |
| 108999 | +** |
| 109000 | +** So, in other words, this routine shifts all the virtual columns to |
| 109001 | +** the end. |
| 109002 | +** |
| 109003 | +** If SQLITE_OMIT_GENERATED_COLUMNS then there are no virtual columns and |
| 109004 | +** this routine is a no-op macro. |
| 109005 | +*/ |
| 109006 | +SQLITE_PRIVATE i16 sqlite3TableColumnToStorage(Table *pTab, i16 iCol){ |
| 109007 | + int i; |
| 109008 | + i16 n; |
| 109009 | + assert( iCol<pTab->nCol ); |
| 109010 | + if( (pTab->tabFlags & TF_HasVirtual)==0 ) return iCol; |
| 109011 | + for(i=0, n=0; i<iCol; i++){ |
| 109012 | + if( (pTab->aCol[i].colFlags & COLFLAG_VIRTUAL)==0 ) n++; |
| 109013 | + } |
| 109014 | + if( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL ){ |
| 109015 | + /* iCol is a virtual column itself */ |
| 109016 | + return pTab->nNVCol + i - n; |
| 109017 | + }else{ |
| 109018 | + /* iCol is a normal or stored column */ |
| 109019 | + return n; |
| 109020 | + } |
| 109021 | +} |
| 109022 | +#endif |
| 108535 | 109023 | |
| 108536 | 109024 | /* |
| 108537 | 109025 | ** Begin constructing a new table representation in memory. This is |
| 108538 | 109026 | ** the first of several action routines that get called in response |
| 108539 | 109027 | ** to a CREATE TABLE statement. In particular, this routine is called |
| | @@ -108821,10 +109309,11 @@ |
| 108821 | 109309 | sqlite3Dequote(zType); |
| 108822 | 109310 | pCol->affinity = sqlite3AffinityType(zType, pCol); |
| 108823 | 109311 | pCol->colFlags |= COLFLAG_HASTYPE; |
| 108824 | 109312 | } |
| 108825 | 109313 | p->nCol++; |
| 109314 | + p->nNVCol++; |
| 108826 | 109315 | pParse->constraintName.n = 0; |
| 108827 | 109316 | } |
| 108828 | 109317 | |
| 108829 | 109318 | /* |
| 108830 | 109319 | ** This routine is called by the parser while in the middle of |
| | @@ -108969,10 +109458,16 @@ |
| 108969 | 109458 | if( p!=0 ){ |
| 108970 | 109459 | pCol = &(p->aCol[p->nCol-1]); |
| 108971 | 109460 | if( !sqlite3ExprIsConstantOrFunction(pExpr, db->init.busy) ){ |
| 108972 | 109461 | sqlite3ErrorMsg(pParse, "default value of column [%s] is not constant", |
| 108973 | 109462 | pCol->zName); |
| 109463 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 109464 | + }else if( pCol->colFlags & COLFLAG_GENERATED ){ |
| 109465 | + testcase( pCol->colFlags & COLFLAG_VIRTUAL ); |
| 109466 | + testcase( pCol->colFlags & COLFLAG_STORED ); |
| 109467 | + sqlite3ErrorMsg(pParse, "cannot use DEFAULT on a generated column"); |
| 109468 | +#endif |
| 108974 | 109469 | }else{ |
| 108975 | 109470 | /* A copy of pExpr is used instead of the original, as pExpr contains |
| 108976 | 109471 | ** tokens that point to volatile memory. |
| 108977 | 109472 | */ |
| 108978 | 109473 | Expr x; |
| | @@ -109013,10 +109508,25 @@ |
| 109013 | 109508 | p->op = TK_ID; |
| 109014 | 109509 | }else if( p->op==TK_COLLATE && p->pLeft->op==TK_STRING ){ |
| 109015 | 109510 | p->pLeft->op = TK_ID; |
| 109016 | 109511 | } |
| 109017 | 109512 | } |
| 109513 | + |
| 109514 | +/* |
| 109515 | +** Tag the given column as being part of the PRIMARY KEY |
| 109516 | +*/ |
| 109517 | +static void makeColumnPartOfPrimaryKey(Parse *pParse, Column *pCol){ |
| 109518 | + pCol->colFlags |= COLFLAG_PRIMKEY; |
| 109519 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 109520 | + if( pCol->colFlags & COLFLAG_GENERATED ){ |
| 109521 | + testcase( pCol->colFlags & COLFLAG_VIRTUAL ); |
| 109522 | + testcase( pCol->colFlags & COLFLAG_STORED ); |
| 109523 | + sqlite3ErrorMsg(pParse, |
| 109524 | + "generated columns cannot be part of the PRIMARY KEY"); |
| 109525 | + } |
| 109526 | +#endif |
| 109527 | +} |
| 109018 | 109528 | |
| 109019 | 109529 | /* |
| 109020 | 109530 | ** Designate the PRIMARY KEY for the table. pList is a list of names |
| 109021 | 109531 | ** of columns that form the primary key. If pList is NULL, then the |
| 109022 | 109532 | ** most recently added column of the table is the primary key. |
| | @@ -109053,11 +109563,11 @@ |
| 109053 | 109563 | } |
| 109054 | 109564 | pTab->tabFlags |= TF_HasPrimaryKey; |
| 109055 | 109565 | if( pList==0 ){ |
| 109056 | 109566 | iCol = pTab->nCol - 1; |
| 109057 | 109567 | pCol = &pTab->aCol[iCol]; |
| 109058 | | - pCol->colFlags |= COLFLAG_PRIMKEY; |
| 109568 | + makeColumnPartOfPrimaryKey(pParse, pCol); |
| 109059 | 109569 | nTerm = 1; |
| 109060 | 109570 | }else{ |
| 109061 | 109571 | nTerm = pList->nExpr; |
| 109062 | 109572 | for(i=0; i<nTerm; i++){ |
| 109063 | 109573 | Expr *pCExpr = sqlite3ExprSkipCollate(pList->a[i].pExpr); |
| | @@ -109066,11 +109576,11 @@ |
| 109066 | 109576 | if( pCExpr->op==TK_ID ){ |
| 109067 | 109577 | const char *zCName = pCExpr->u.zToken; |
| 109068 | 109578 | for(iCol=0; iCol<pTab->nCol; iCol++){ |
| 109069 | 109579 | if( sqlite3StrICmp(zCName, pTab->aCol[iCol].zName)==0 ){ |
| 109070 | 109580 | pCol = &pTab->aCol[iCol]; |
| 109071 | | - pCol->colFlags |= COLFLAG_PRIMKEY; |
| 109581 | + makeColumnPartOfPrimaryKey(pParse, pCol); |
| 109072 | 109582 | break; |
| 109073 | 109583 | } |
| 109074 | 109584 | } |
| 109075 | 109585 | } |
| 109076 | 109586 | } |
| | @@ -109163,44 +109673,58 @@ |
| 109163 | 109673 | }else{ |
| 109164 | 109674 | sqlite3DbFree(db, zColl); |
| 109165 | 109675 | } |
| 109166 | 109676 | } |
| 109167 | 109677 | |
| 109168 | | -/* |
| 109169 | | -** This function returns the collation sequence for database native text |
| 109170 | | -** encoding identified by the string zName, length nName. |
| 109171 | | -** |
| 109172 | | -** If the requested collation sequence is not available, or not available |
| 109173 | | -** in the database native encoding, the collation factory is invoked to |
| 109174 | | -** request it. If the collation factory does not supply such a sequence, |
| 109175 | | -** and the sequence is available in another text encoding, then that is |
| 109176 | | -** returned instead. |
| 109177 | | -** |
| 109178 | | -** If no versions of the requested collations sequence are available, or |
| 109179 | | -** another error occurs, NULL is returned and an error message written into |
| 109180 | | -** pParse. |
| 109181 | | -** |
| 109182 | | -** This routine is a wrapper around sqlite3FindCollSeq(). This routine |
| 109183 | | -** invokes the collation factory if the named collation cannot be found |
| 109184 | | -** and generates an error message. |
| 109185 | | -** |
| 109186 | | -** See also: sqlite3FindCollSeq(), sqlite3GetCollSeq() |
| 109678 | +/* Change the most recently parsed column to be a GENERATED ALWAYS AS |
| 109679 | +** column. |
| 109187 | 109680 | */ |
| 109188 | | -SQLITE_PRIVATE CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char *zName){ |
| 109189 | | - sqlite3 *db = pParse->db; |
| 109190 | | - u8 enc = ENC(db); |
| 109191 | | - u8 initbusy = db->init.busy; |
| 109192 | | - CollSeq *pColl; |
| 109193 | | - |
| 109194 | | - pColl = sqlite3FindCollSeq(db, enc, zName, initbusy); |
| 109195 | | - if( !initbusy && (!pColl || !pColl->xCmp) ){ |
| 109196 | | - pColl = sqlite3GetCollSeq(pParse, enc, pColl, zName); |
| 109197 | | - } |
| 109198 | | - |
| 109199 | | - return pColl; |
| 109200 | | -} |
| 109201 | | - |
| 109681 | +SQLITE_PRIVATE void sqlite3AddGenerated(Parse *pParse, Expr *pExpr, Token *pType){ |
| 109682 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 109683 | + u8 eType = COLFLAG_VIRTUAL; |
| 109684 | + Table *pTab = pParse->pNewTable; |
| 109685 | + Column *pCol; |
| 109686 | + if( NEVER(pTab==0) ) goto generated_done; |
| 109687 | + pCol = &(pTab->aCol[pTab->nCol-1]); |
| 109688 | + if( IN_DECLARE_VTAB ){ |
| 109689 | + sqlite3ErrorMsg(pParse, "virtual tables cannot use computed columns"); |
| 109690 | + goto generated_done; |
| 109691 | + } |
| 109692 | + if( pCol->pDflt ) goto generated_error; |
| 109693 | + if( pType ){ |
| 109694 | + if( pType->n==7 && sqlite3StrNICmp("virtual",pType->z,7)==0 ){ |
| 109695 | + /* no-op */ |
| 109696 | + }else if( pType->n==6 && sqlite3StrNICmp("stored",pType->z,6)==0 ){ |
| 109697 | + eType = COLFLAG_STORED; |
| 109698 | + }else{ |
| 109699 | + goto generated_error; |
| 109700 | + } |
| 109701 | + } |
| 109702 | + if( eType==COLFLAG_VIRTUAL ) pTab->nNVCol--; |
| 109703 | + pCol->colFlags |= eType; |
| 109704 | + assert( TF_HasVirtual==COLFLAG_VIRTUAL ); |
| 109705 | + assert( TF_HasStored==COLFLAG_STORED ); |
| 109706 | + pTab->tabFlags |= eType; |
| 109707 | + if( pCol->colFlags & COLFLAG_PRIMKEY ){ |
| 109708 | + makeColumnPartOfPrimaryKey(pParse, pCol); /* For the error message */ |
| 109709 | + } |
| 109710 | + pCol->pDflt = pExpr; |
| 109711 | + pExpr = 0; |
| 109712 | + goto generated_done; |
| 109713 | + |
| 109714 | +generated_error: |
| 109715 | + sqlite3ErrorMsg(pParse, "error in generated column \"%s\"", |
| 109716 | + pCol->zName); |
| 109717 | +generated_done: |
| 109718 | + sqlite3ExprDelete(pParse->db, pExpr); |
| 109719 | +#else |
| 109720 | + /* Throw and error for the GENERATED ALWAYS AS clause if the |
| 109721 | + ** SQLITE_OMIT_GENERATED_COLUMNS compile-time option is used. */ |
| 109722 | + sqlite3ErrorMsg(pParse, "generated columns not supported"); |
| 109723 | + sqlite3ExprDelete(pParse->db, pExpr); |
| 109724 | +#endif |
| 109725 | +} |
| 109202 | 109726 | |
| 109203 | 109727 | /* |
| 109204 | 109728 | ** Generate code that will increment the schema cookie. |
| 109205 | 109729 | ** |
| 109206 | 109730 | ** The schema cookie is used to determine when the schema for the |
| | @@ -109454,20 +109978,29 @@ |
| 109454 | 109978 | ** |
| 109455 | 109979 | ** colNotIdxed is a bitmask that has a 0 bit representing each indexed |
| 109456 | 109980 | ** columns that are within the first 63 columns of the table. The |
| 109457 | 109981 | ** high-order bit of colNotIdxed is always 1. All unindexed columns |
| 109458 | 109982 | ** of the table have a 1. |
| 109983 | +** |
| 109984 | +** 2019-10-24: For the purpose of this computation, virtual columns are |
| 109985 | +** not considered to be covered by the index, even if they are in the |
| 109986 | +** index, because we do not trust the logic in whereIndexExprTrans() to be |
| 109987 | +** able to find all instances of a reference to the indexed table column |
| 109988 | +** and convert them into references to the index. Hence we always want |
| 109989 | +** the actual table at hand in order to recompute the virtual column, if |
| 109990 | +** necessary. |
| 109459 | 109991 | ** |
| 109460 | 109992 | ** The colNotIdxed mask is AND-ed with the SrcList.a[].colUsed mask |
| 109461 | 109993 | ** to determine if the index is covering index. |
| 109462 | 109994 | */ |
| 109463 | 109995 | static void recomputeColumnsNotIndexed(Index *pIdx){ |
| 109464 | 109996 | Bitmask m = 0; |
| 109465 | 109997 | int j; |
| 109998 | + Table *pTab = pIdx->pTable; |
| 109466 | 109999 | for(j=pIdx->nColumn-1; j>=0; j--){ |
| 109467 | 110000 | int x = pIdx->aiColumn[j]; |
| 109468 | | - if( x>=0 ){ |
| 110001 | + if( x>=0 && (pTab->aCol[x].colFlags & COLFLAG_VIRTUAL)==0 ){ |
| 109469 | 110002 | testcase( x==BMS-1 ); |
| 109470 | 110003 | testcase( x==BMS-2 ); |
| 109471 | 110004 | if( x<BMS-1 ) m |= MASKBIT(x); |
| 109472 | 110005 | } |
| 109473 | 110006 | } |
| | @@ -109514,10 +110047,11 @@ |
| 109514 | 110047 | for(i=0; i<pTab->nCol; i++){ |
| 109515 | 110048 | if( (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0 ){ |
| 109516 | 110049 | pTab->aCol[i].notNull = OE_Abort; |
| 109517 | 110050 | } |
| 109518 | 110051 | } |
| 110052 | + pTab->tabFlags |= TF_HasNotNull; |
| 109519 | 110053 | } |
| 109520 | 110054 | |
| 109521 | 110055 | /* Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY |
| 109522 | 110056 | ** into BTREE_BLOBKEY. |
| 109523 | 110057 | */ |
| | @@ -109621,23 +110155,26 @@ |
| 109621 | 110155 | |
| 109622 | 110156 | /* Add all table columns to the PRIMARY KEY index |
| 109623 | 110157 | */ |
| 109624 | 110158 | nExtra = 0; |
| 109625 | 110159 | for(i=0; i<pTab->nCol; i++){ |
| 109626 | | - if( !hasColumn(pPk->aiColumn, nPk, i) ) nExtra++; |
| 110160 | + if( !hasColumn(pPk->aiColumn, nPk, i) |
| 110161 | + && (pTab->aCol[i].colFlags & COLFLAG_VIRTUAL)==0 ) nExtra++; |
| 109627 | 110162 | } |
| 109628 | 110163 | if( resizeIndexObject(db, pPk, nPk+nExtra) ) return; |
| 109629 | 110164 | for(i=0, j=nPk; i<pTab->nCol; i++){ |
| 109630 | | - if( !hasColumn(pPk->aiColumn, j, i) ){ |
| 110165 | + if( !hasColumn(pPk->aiColumn, j, i) |
| 110166 | + && (pTab->aCol[i].colFlags & COLFLAG_VIRTUAL)==0 |
| 110167 | + ){ |
| 109631 | 110168 | assert( j<pPk->nColumn ); |
| 109632 | 110169 | pPk->aiColumn[j] = i; |
| 109633 | 110170 | pPk->azColl[j] = sqlite3StrBINARY; |
| 109634 | 110171 | j++; |
| 109635 | 110172 | } |
| 109636 | 110173 | } |
| 109637 | 110174 | assert( pPk->nColumn==j ); |
| 109638 | | - assert( pTab->nCol<=j ); |
| 110175 | + assert( pTab->nNVCol<=j ); |
| 109639 | 110176 | recomputeColumnsNotIndexed(pPk); |
| 109640 | 110177 | } |
| 109641 | 110178 | |
| 109642 | 110179 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 109643 | 110180 | /* |
| | @@ -109645,11 +110182,11 @@ |
| 109645 | 110182 | ** connection. |
| 109646 | 110183 | ** |
| 109647 | 110184 | ** zName is temporarily modified while this routine is running, but is |
| 109648 | 110185 | ** restored to its original value prior to this routine returning. |
| 109649 | 110186 | */ |
| 109650 | | -static int isShadowTableName(sqlite3 *db, char *zName){ |
| 110187 | +SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName){ |
| 109651 | 110188 | char *zTail; /* Pointer to the last "_" in zName */ |
| 109652 | 110189 | Table *pTab; /* Table that zName is a shadow of */ |
| 109653 | 110190 | Module *pMod; /* Module for the virtual table */ |
| 109654 | 110191 | |
| 109655 | 110192 | zTail = strrchr(zName, '_'); |
| | @@ -109663,12 +110200,10 @@ |
| 109663 | 110200 | if( pMod==0 ) return 0; |
| 109664 | 110201 | if( pMod->pModule->iVersion<3 ) return 0; |
| 109665 | 110202 | if( pMod->pModule->xShadowName==0 ) return 0; |
| 109666 | 110203 | return pMod->pModule->xShadowName(zTail+1); |
| 109667 | 110204 | } |
| 109668 | | -#else |
| 109669 | | -# define isShadowTableName(x,y) 0 |
| 109670 | 110205 | #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */ |
| 109671 | 110206 | |
| 109672 | 110207 | /* |
| 109673 | 110208 | ** This routine is called to report the final ")" that terminates |
| 109674 | 110209 | ** a CREATE TABLE statement. |
| | @@ -109706,11 +110241,11 @@ |
| 109706 | 110241 | } |
| 109707 | 110242 | assert( !db->mallocFailed ); |
| 109708 | 110243 | p = pParse->pNewTable; |
| 109709 | 110244 | if( p==0 ) return; |
| 109710 | 110245 | |
| 109711 | | - if( pSelect==0 && isShadowTableName(db, p->zName) ){ |
| 110246 | + if( pSelect==0 && sqlite3ShadowTableName(db, p->zName) ){ |
| 109712 | 110247 | p->tabFlags |= TF_Shadow; |
| 109713 | 110248 | } |
| 109714 | 110249 | |
| 109715 | 110250 | /* If the db->init.busy is 1 it means we are reading the SQL off the |
| 109716 | 110251 | ** "sqlite_master" or "sqlite_temp_master" table on the disk. |
| | @@ -109742,25 +110277,46 @@ |
| 109742 | 110277 | "AUTOINCREMENT not allowed on WITHOUT ROWID tables"); |
| 109743 | 110278 | return; |
| 109744 | 110279 | } |
| 109745 | 110280 | if( (p->tabFlags & TF_HasPrimaryKey)==0 ){ |
| 109746 | 110281 | sqlite3ErrorMsg(pParse, "PRIMARY KEY missing on table %s", p->zName); |
| 109747 | | - }else{ |
| 109748 | | - p->tabFlags |= TF_WithoutRowid | TF_NoVisibleRowid; |
| 109749 | | - convertToWithoutRowidTable(pParse, p); |
| 110282 | + return; |
| 109750 | 110283 | } |
| 110284 | + p->tabFlags |= TF_WithoutRowid | TF_NoVisibleRowid; |
| 110285 | + convertToWithoutRowidTable(pParse, p); |
| 109751 | 110286 | } |
| 109752 | | - |
| 109753 | 110287 | iDb = sqlite3SchemaToIndex(db, p->pSchema); |
| 109754 | 110288 | |
| 109755 | 110289 | #ifndef SQLITE_OMIT_CHECK |
| 109756 | 110290 | /* Resolve names in all CHECK constraint expressions. |
| 109757 | 110291 | */ |
| 109758 | 110292 | if( p->pCheck ){ |
| 109759 | 110293 | sqlite3ResolveSelfReference(pParse, p, NC_IsCheck, 0, p->pCheck); |
| 109760 | 110294 | } |
| 109761 | 110295 | #endif /* !defined(SQLITE_OMIT_CHECK) */ |
| 110296 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 110297 | + if( p->tabFlags & TF_HasGenerated ){ |
| 110298 | + int ii, nNG = 0; |
| 110299 | + testcase( p->tabFlags & TF_HasVirtual ); |
| 110300 | + testcase( p->tabFlags & TF_HasStored ); |
| 110301 | + for(ii=0; ii<p->nCol; ii++){ |
| 110302 | + u32 colFlags = p->aCol[ii].colFlags; |
| 110303 | + if( (colFlags & COLFLAG_GENERATED)!=0 ){ |
| 110304 | + testcase( colFlags & COLFLAG_VIRTUAL ); |
| 110305 | + testcase( colFlags & COLFLAG_STORED ); |
| 110306 | + sqlite3ResolveSelfReference(pParse, p, NC_GenCol, |
| 110307 | + p->aCol[ii].pDflt, 0); |
| 110308 | + }else{ |
| 110309 | + nNG++; |
| 110310 | + } |
| 110311 | + } |
| 110312 | + if( nNG==0 ){ |
| 110313 | + sqlite3ErrorMsg(pParse, "must have at least one non-generated column"); |
| 110314 | + return; |
| 110315 | + } |
| 110316 | + } |
| 110317 | +#endif |
| 109762 | 110318 | |
| 109763 | 110319 | /* Estimate the average row size for the table and for all implied indices */ |
| 109764 | 110320 | estimateTableWidth(p); |
| 109765 | 110321 | for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){ |
| 109766 | 110322 | estimateIndexWidth(pIdx); |
| | @@ -109833,11 +110389,11 @@ |
| 109833 | 110389 | sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, addrTop); |
| 109834 | 110390 | if( pParse->nErr ) return; |
| 109835 | 110391 | pSelTab = sqlite3ResultSetOfSelect(pParse, pSelect, SQLITE_AFF_BLOB); |
| 109836 | 110392 | if( pSelTab==0 ) return; |
| 109837 | 110393 | assert( p->aCol==0 ); |
| 109838 | | - p->nCol = pSelTab->nCol; |
| 110394 | + p->nCol = p->nNVCol = pSelTab->nCol; |
| 109839 | 110395 | p->aCol = pSelTab->aCol; |
| 109840 | 110396 | pSelTab->nCol = 0; |
| 109841 | 110397 | pSelTab->aCol = 0; |
| 109842 | 110398 | sqlite3DeleteTable(db, pSelTab); |
| 109843 | 110399 | sqlite3SelectDestInit(&dest, SRT_Coroutine, regYield); |
| | @@ -109905,11 +110461,10 @@ |
| 109905 | 110461 | |
| 109906 | 110462 | /* Reparse everything to update our internal data structures */ |
| 109907 | 110463 | sqlite3VdbeAddParseSchemaOp(v, iDb, |
| 109908 | 110464 | sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName)); |
| 109909 | 110465 | } |
| 109910 | | - |
| 109911 | 110466 | |
| 109912 | 110467 | /* Add the table to the in-memory representation of the database. |
| 109913 | 110468 | */ |
| 109914 | 110469 | if( db->init.busy ){ |
| 109915 | 110470 | Table *pOld; |
| | @@ -110090,11 +110645,11 @@ |
| 110090 | 110645 | pParse->eParseMode = PARSE_MODE_NORMAL; |
| 110091 | 110646 | #endif |
| 110092 | 110647 | n = pParse->nTab; |
| 110093 | 110648 | sqlite3SrcListAssignCursors(pParse, pSel->pSrc); |
| 110094 | 110649 | pTable->nCol = -1; |
| 110095 | | - db->lookaside.bDisable++; |
| 110650 | + DisableLookaside; |
| 110096 | 110651 | #ifndef SQLITE_OMIT_AUTHORIZATION |
| 110097 | 110652 | xAuth = db->xAuth; |
| 110098 | 110653 | db->xAuth = 0; |
| 110099 | 110654 | pSelTab = sqlite3ResultSetOfSelect(pParse, pSel, SQLITE_AFF_NONE); |
| 110100 | 110655 | db->xAuth = xAuth; |
| | @@ -110130,13 +110685,14 @@ |
| 110130 | 110685 | assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) ); |
| 110131 | 110686 | }else{ |
| 110132 | 110687 | pTable->nCol = 0; |
| 110133 | 110688 | nErr++; |
| 110134 | 110689 | } |
| 110690 | + pTable->nNVCol = pTable->nCol; |
| 110135 | 110691 | sqlite3DeleteTable(db, pSelTab); |
| 110136 | 110692 | sqlite3SelectDelete(db, pSel); |
| 110137 | | - db->lookaside.bDisable--; |
| 110693 | + EnableLookaside; |
| 110138 | 110694 | #ifndef SQLITE_OMIT_ALTERTABLE |
| 110139 | 110695 | pParse->eParseMode = eParseMode; |
| 110140 | 110696 | #endif |
| 110141 | 110697 | } else { |
| 110142 | 110698 | nErr++; |
| | @@ -110388,10 +110944,41 @@ |
| 110388 | 110944 | } |
| 110389 | 110945 | sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0); |
| 110390 | 110946 | sqlite3ChangeCookie(pParse, iDb); |
| 110391 | 110947 | sqliteViewResetAll(db, iDb); |
| 110392 | 110948 | } |
| 110949 | + |
| 110950 | +/* |
| 110951 | +** Return TRUE if shadow tables should be read-only in the current |
| 110952 | +** context. |
| 110953 | +*/ |
| 110954 | +SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db){ |
| 110955 | +#ifndef SQLITE_OMIT_VIRTUALTABLE |
| 110956 | + if( (db->flags & SQLITE_Defensive)!=0 |
| 110957 | + && db->pVtabCtx==0 |
| 110958 | + && db->nVdbeExec==0 |
| 110959 | + ){ |
| 110960 | + return 1; |
| 110961 | + } |
| 110962 | +#endif |
| 110963 | + return 0; |
| 110964 | +} |
| 110965 | + |
| 110966 | +/* |
| 110967 | +** Return true if it is not allowed to drop the given table |
| 110968 | +*/ |
| 110969 | +static int tableMayNotBeDropped(sqlite3 *db, Table *pTab){ |
| 110970 | + if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){ |
| 110971 | + if( sqlite3StrNICmp(pTab->zName+7, "stat", 4)==0 ) return 0; |
| 110972 | + if( sqlite3StrNICmp(pTab->zName+7, "parameters", 10)==0 ) return 0; |
| 110973 | + return 1; |
| 110974 | + } |
| 110975 | + if( (pTab->tabFlags & TF_Shadow)!=0 && sqlite3ReadOnlyShadowTables(db) ){ |
| 110976 | + return 1; |
| 110977 | + } |
| 110978 | + return 0; |
| 110979 | +} |
| 110393 | 110980 | |
| 110394 | 110981 | /* |
| 110395 | 110982 | ** This routine is called to do the work of a DROP TABLE statement. |
| 110396 | 110983 | ** pName is the name of the table to be dropped. |
| 110397 | 110984 | */ |
| | @@ -110458,13 +111045,11 @@ |
| 110458 | 111045 | if( sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb) ){ |
| 110459 | 111046 | goto exit_drop_table; |
| 110460 | 111047 | } |
| 110461 | 111048 | } |
| 110462 | 111049 | #endif |
| 110463 | | - if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 |
| 110464 | | - && sqlite3StrNICmp(pTab->zName+7, "stat", 4)!=0 |
| 110465 | | - && sqlite3StrNICmp(pTab->zName+7, "parameters", 10)!=0 ){ |
| 111050 | + if( tableMayNotBeDropped(db, pTab) ){ |
| 110466 | 111051 | sqlite3ErrorMsg(pParse, "table %s may not be dropped", pTab->zName); |
| 110467 | 111052 | goto exit_drop_table; |
| 110468 | 111053 | } |
| 110469 | 111054 | |
| 110470 | 111055 | #ifndef SQLITE_OMIT_VIEW |
| | @@ -111131,12 +111716,17 @@ |
| 111131 | 111716 | }else{ |
| 111132 | 111717 | j = pCExpr->iColumn; |
| 111133 | 111718 | assert( j<=0x7fff ); |
| 111134 | 111719 | if( j<0 ){ |
| 111135 | 111720 | j = pTab->iPKey; |
| 111136 | | - }else if( pTab->aCol[j].notNull==0 ){ |
| 111137 | | - pIndex->uniqNotNull = 0; |
| 111721 | + }else{ |
| 111722 | + if( pTab->aCol[j].notNull==0 ){ |
| 111723 | + pIndex->uniqNotNull = 0; |
| 111724 | + } |
| 111725 | + if( pTab->aCol[j].colFlags & COLFLAG_VIRTUAL ){ |
| 111726 | + pIndex->bHasVCol = 1; |
| 111727 | + } |
| 111138 | 111728 | } |
| 111139 | 111729 | pIndex->aiColumn[i] = (i16)j; |
| 111140 | 111730 | } |
| 111141 | 111731 | zColl = 0; |
| 111142 | 111732 | if( pListItem->pExpr->op==TK_COLLATE ){ |
| | @@ -111187,17 +111777,17 @@ |
| 111187 | 111777 | if( pParse->pNewTable==0 ) estimateIndexWidth(pIndex); |
| 111188 | 111778 | |
| 111189 | 111779 | /* If this index contains every column of its table, then mark |
| 111190 | 111780 | ** it as a covering index */ |
| 111191 | 111781 | assert( HasRowid(pTab) |
| 111192 | | - || pTab->iPKey<0 || sqlite3ColumnOfIndex(pIndex, pTab->iPKey)>=0 ); |
| 111782 | + || pTab->iPKey<0 || sqlite3TableColumnToIndex(pIndex, pTab->iPKey)>=0 ); |
| 111193 | 111783 | recomputeColumnsNotIndexed(pIndex); |
| 111194 | 111784 | if( pTblName!=0 && pIndex->nColumn>=pTab->nCol ){ |
| 111195 | 111785 | pIndex->isCovering = 1; |
| 111196 | 111786 | for(j=0; j<pTab->nCol; j++){ |
| 111197 | 111787 | if( j==pTab->iPKey ) continue; |
| 111198 | | - if( sqlite3ColumnOfIndex(pIndex,j)>=0 ) continue; |
| 111788 | + if( sqlite3TableColumnToIndex(pIndex,j)>=0 ) continue; |
| 111199 | 111789 | pIndex->isCovering = 0; |
| 111200 | 111790 | break; |
| 111201 | 111791 | } |
| 111202 | 111792 | } |
| 111203 | 111793 | |
| | @@ -112533,55 +113123,10 @@ |
| 112533 | 113123 | } |
| 112534 | 113124 | } |
| 112535 | 113125 | return SQLITE_ERROR; |
| 112536 | 113126 | } |
| 112537 | 113127 | |
| 112538 | | -/* |
| 112539 | | -** This function is responsible for invoking the collation factory callback |
| 112540 | | -** or substituting a collation sequence of a different encoding when the |
| 112541 | | -** requested collation sequence is not available in the desired encoding. |
| 112542 | | -** |
| 112543 | | -** If it is not NULL, then pColl must point to the database native encoding |
| 112544 | | -** collation sequence with name zName, length nName. |
| 112545 | | -** |
| 112546 | | -** The return value is either the collation sequence to be used in database |
| 112547 | | -** db for collation type name zName, length nName, or NULL, if no collation |
| 112548 | | -** sequence can be found. If no collation is found, leave an error message. |
| 112549 | | -** |
| 112550 | | -** See also: sqlite3LocateCollSeq(), sqlite3FindCollSeq() |
| 112551 | | -*/ |
| 112552 | | -SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq( |
| 112553 | | - Parse *pParse, /* Parsing context */ |
| 112554 | | - u8 enc, /* The desired encoding for the collating sequence */ |
| 112555 | | - CollSeq *pColl, /* Collating sequence with native encoding, or NULL */ |
| 112556 | | - const char *zName /* Collating sequence name */ |
| 112557 | | -){ |
| 112558 | | - CollSeq *p; |
| 112559 | | - sqlite3 *db = pParse->db; |
| 112560 | | - |
| 112561 | | - p = pColl; |
| 112562 | | - if( !p ){ |
| 112563 | | - p = sqlite3FindCollSeq(db, enc, zName, 0); |
| 112564 | | - } |
| 112565 | | - if( !p || !p->xCmp ){ |
| 112566 | | - /* No collation sequence of this type for this encoding is registered. |
| 112567 | | - ** Call the collation factory to see if it can supply us with one. |
| 112568 | | - */ |
| 112569 | | - callCollNeeded(db, enc, zName); |
| 112570 | | - p = sqlite3FindCollSeq(db, enc, zName, 0); |
| 112571 | | - } |
| 112572 | | - if( p && !p->xCmp && synthCollSeq(db, p) ){ |
| 112573 | | - p = 0; |
| 112574 | | - } |
| 112575 | | - assert( !p || p->xCmp ); |
| 112576 | | - if( p==0 ){ |
| 112577 | | - sqlite3ErrorMsg(pParse, "no such collation sequence: %s", zName); |
| 112578 | | - pParse->rc = SQLITE_ERROR_MISSING_COLLSEQ; |
| 112579 | | - } |
| 112580 | | - return p; |
| 112581 | | -} |
| 112582 | | - |
| 112583 | 113128 | /* |
| 112584 | 113129 | ** This routine is called on a collation sequence before it is used to |
| 112585 | 113130 | ** check that it is defined. An undefined collation sequence exists when |
| 112586 | 113131 | ** a database is loaded that contains references to collation sequences |
| 112587 | 113132 | ** that have not been defined by sqlite3_create_collation() etc. |
| | @@ -112670,14 +113215,14 @@ |
| 112670 | 113215 | ** cannot be found. |
| 112671 | 113216 | ** |
| 112672 | 113217 | ** See also: sqlite3LocateCollSeq(), sqlite3GetCollSeq() |
| 112673 | 113218 | */ |
| 112674 | 113219 | SQLITE_PRIVATE CollSeq *sqlite3FindCollSeq( |
| 112675 | | - sqlite3 *db, |
| 112676 | | - u8 enc, |
| 112677 | | - const char *zName, |
| 112678 | | - int create |
| 113220 | + sqlite3 *db, /* Database connection to search */ |
| 113221 | + u8 enc, /* Desired text encoding */ |
| 113222 | + const char *zName, /* Name of the collating sequence. Might be NULL */ |
| 113223 | + int create /* True to create CollSeq if doesn't already exist */ |
| 112679 | 113224 | ){ |
| 112680 | 113225 | CollSeq *pColl; |
| 112681 | 113226 | if( zName ){ |
| 112682 | 113227 | pColl = findCollSeqEntry(db, zName, create); |
| 112683 | 113228 | }else{ |
| | @@ -112684,10 +113229,89 @@ |
| 112684 | 113229 | pColl = db->pDfltColl; |
| 112685 | 113230 | } |
| 112686 | 113231 | assert( SQLITE_UTF8==1 && SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 ); |
| 112687 | 113232 | assert( enc>=SQLITE_UTF8 && enc<=SQLITE_UTF16BE ); |
| 112688 | 113233 | if( pColl ) pColl += enc-1; |
| 113234 | + return pColl; |
| 113235 | +} |
| 113236 | + |
| 113237 | +/* |
| 113238 | +** This function is responsible for invoking the collation factory callback |
| 113239 | +** or substituting a collation sequence of a different encoding when the |
| 113240 | +** requested collation sequence is not available in the desired encoding. |
| 113241 | +** |
| 113242 | +** If it is not NULL, then pColl must point to the database native encoding |
| 113243 | +** collation sequence with name zName, length nName. |
| 113244 | +** |
| 113245 | +** The return value is either the collation sequence to be used in database |
| 113246 | +** db for collation type name zName, length nName, or NULL, if no collation |
| 113247 | +** sequence can be found. If no collation is found, leave an error message. |
| 113248 | +** |
| 113249 | +** See also: sqlite3LocateCollSeq(), sqlite3FindCollSeq() |
| 113250 | +*/ |
| 113251 | +SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq( |
| 113252 | + Parse *pParse, /* Parsing context */ |
| 113253 | + u8 enc, /* The desired encoding for the collating sequence */ |
| 113254 | + CollSeq *pColl, /* Collating sequence with native encoding, or NULL */ |
| 113255 | + const char *zName /* Collating sequence name */ |
| 113256 | +){ |
| 113257 | + CollSeq *p; |
| 113258 | + sqlite3 *db = pParse->db; |
| 113259 | + |
| 113260 | + p = pColl; |
| 113261 | + if( !p ){ |
| 113262 | + p = sqlite3FindCollSeq(db, enc, zName, 0); |
| 113263 | + } |
| 113264 | + if( !p || !p->xCmp ){ |
| 113265 | + /* No collation sequence of this type for this encoding is registered. |
| 113266 | + ** Call the collation factory to see if it can supply us with one. |
| 113267 | + */ |
| 113268 | + callCollNeeded(db, enc, zName); |
| 113269 | + p = sqlite3FindCollSeq(db, enc, zName, 0); |
| 113270 | + } |
| 113271 | + if( p && !p->xCmp && synthCollSeq(db, p) ){ |
| 113272 | + p = 0; |
| 113273 | + } |
| 113274 | + assert( !p || p->xCmp ); |
| 113275 | + if( p==0 ){ |
| 113276 | + sqlite3ErrorMsg(pParse, "no such collation sequence: %s", zName); |
| 113277 | + pParse->rc = SQLITE_ERROR_MISSING_COLLSEQ; |
| 113278 | + } |
| 113279 | + return p; |
| 113280 | +} |
| 113281 | + |
| 113282 | +/* |
| 113283 | +** This function returns the collation sequence for database native text |
| 113284 | +** encoding identified by the string zName. |
| 113285 | +** |
| 113286 | +** If the requested collation sequence is not available, or not available |
| 113287 | +** in the database native encoding, the collation factory is invoked to |
| 113288 | +** request it. If the collation factory does not supply such a sequence, |
| 113289 | +** and the sequence is available in another text encoding, then that is |
| 113290 | +** returned instead. |
| 113291 | +** |
| 113292 | +** If no versions of the requested collations sequence are available, or |
| 113293 | +** another error occurs, NULL is returned and an error message written into |
| 113294 | +** pParse. |
| 113295 | +** |
| 113296 | +** This routine is a wrapper around sqlite3FindCollSeq(). This routine |
| 113297 | +** invokes the collation factory if the named collation cannot be found |
| 113298 | +** and generates an error message. |
| 113299 | +** |
| 113300 | +** See also: sqlite3FindCollSeq(), sqlite3GetCollSeq() |
| 113301 | +*/ |
| 113302 | +SQLITE_PRIVATE CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char *zName){ |
| 113303 | + sqlite3 *db = pParse->db; |
| 113304 | + u8 enc = ENC(db); |
| 113305 | + u8 initbusy = db->init.busy; |
| 113306 | + CollSeq *pColl; |
| 113307 | + |
| 113308 | + pColl = sqlite3FindCollSeq(db, enc, zName, initbusy); |
| 113309 | + if( !initbusy && (!pColl || !pColl->xCmp) ){ |
| 113310 | + pColl = sqlite3GetCollSeq(pParse, enc, pColl, zName); |
| 113311 | + } |
| 113312 | + |
| 112689 | 113313 | return pColl; |
| 112690 | 113314 | } |
| 112691 | 113315 | |
| 112692 | 113316 | /* During the search for the best function definition, this procedure |
| 112693 | 113317 | ** is called to test how well the function passed as the first argument |
| | @@ -113029,15 +113653,11 @@ |
| 113029 | 113653 | db = pParse->db; |
| 113030 | 113654 | if( (pTab->tabFlags & TF_Readonly)!=0 ){ |
| 113031 | 113655 | return sqlite3WritableSchema(db)==0 && pParse->nested==0; |
| 113032 | 113656 | } |
| 113033 | 113657 | assert( pTab->tabFlags & TF_Shadow ); |
| 113034 | | - return (db->flags & SQLITE_Defensive)!=0 |
| 113035 | | -#ifndef SQLITE_OMIT_VIRTUALTABLE |
| 113036 | | - && db->pVtabCtx==0 |
| 113037 | | -#endif |
| 113038 | | - && db->nVdbeExec==0; |
| 113658 | + return sqlite3ReadOnlyShadowTables(db); |
| 113039 | 113659 | } |
| 113040 | 113660 | |
| 113041 | 113661 | /* |
| 113042 | 113662 | ** Check to make sure the given table is writable. If it is not |
| 113043 | 113663 | ** writable, generate an error message and return 1. If it is |
| | @@ -113696,11 +114316,12 @@ |
| 113696 | 114316 | sqlite3VdbeAddOp2(v, OP_Copy, iPk, iOld); |
| 113697 | 114317 | for(iCol=0; iCol<pTab->nCol; iCol++){ |
| 113698 | 114318 | testcase( mask!=0xffffffff && iCol==31 ); |
| 113699 | 114319 | testcase( mask!=0xffffffff && iCol==32 ); |
| 113700 | 114320 | if( mask==0xffffffff || (iCol<=31 && (mask & MASKBIT32(iCol))!=0) ){ |
| 113701 | | - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, iCol, iOld+iCol+1); |
| 114321 | + int kk = sqlite3TableColumnToStorage(pTab, iCol); |
| 114322 | + sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, iCol, iOld+kk+1); |
| 113702 | 114323 | } |
| 113703 | 114324 | } |
| 113704 | 114325 | |
| 113705 | 114326 | /* Invoke BEFORE DELETE trigger programs. */ |
| 113706 | 114327 | addrStart = sqlite3VdbeCurrentAddr(v); |
| | @@ -113876,10 +114497,12 @@ |
| 113876 | 114497 | *piPartIdxLabel = sqlite3VdbeMakeLabel(pParse); |
| 113877 | 114498 | pParse->iSelfTab = iDataCur + 1; |
| 113878 | 114499 | sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, *piPartIdxLabel, |
| 113879 | 114500 | SQLITE_JUMPIFNULL); |
| 113880 | 114501 | pParse->iSelfTab = 0; |
| 114502 | + pPrior = 0; /* Ticket a9efb42811fa41ee 2019-11-02; |
| 114503 | + ** pPartIdxWhere may have corrupted regPrior registers */ |
| 113881 | 114504 | }else{ |
| 113882 | 114505 | *piPartIdxLabel = 0; |
| 113883 | 114506 | } |
| 113884 | 114507 | } |
| 113885 | 114508 | nCol = (prefixOnly && pIdx->uniqNotNull) ? pIdx->nKeyCol : pIdx->nColumn; |
| | @@ -116304,11 +116927,11 @@ |
| 116304 | 116927 | if( nIncr<0 ){ |
| 116305 | 116928 | sqlite3VdbeAddOp2(v, OP_FkIfZero, pFKey->isDeferred, iOk); |
| 116306 | 116929 | VdbeCoverage(v); |
| 116307 | 116930 | } |
| 116308 | 116931 | for(i=0; i<pFKey->nCol; i++){ |
| 116309 | | - int iReg = aiCol[i] + regData + 1; |
| 116932 | + int iReg = sqlite3TableColumnToStorage(pFKey->pFrom,aiCol[i]) + regData + 1; |
| 116310 | 116933 | sqlite3VdbeAddOp2(v, OP_IsNull, iReg, iOk); VdbeCoverage(v); |
| 116311 | 116934 | } |
| 116312 | 116935 | |
| 116313 | 116936 | if( isIgnore==0 ){ |
| 116314 | 116937 | if( pIdx==0 ){ |
| | @@ -116320,11 +116943,12 @@ |
| 116320 | 116943 | /* Invoke MustBeInt to coerce the child key value to an integer (i.e. |
| 116321 | 116944 | ** apply the affinity of the parent key). If this fails, then there |
| 116322 | 116945 | ** is no matching parent key. Before using MustBeInt, make a copy of |
| 116323 | 116946 | ** the value. Otherwise, the value inserted into the child key column |
| 116324 | 116947 | ** will have INTEGER affinity applied to it, which may not be correct. */ |
| 116325 | | - sqlite3VdbeAddOp2(v, OP_SCopy, aiCol[0]+1+regData, regTemp); |
| 116948 | + sqlite3VdbeAddOp2(v, OP_SCopy, |
| 116949 | + sqlite3TableColumnToStorage(pFKey->pFrom,aiCol[0])+1+regData, regTemp); |
| 116326 | 116950 | iMustBeInt = sqlite3VdbeAddOp2(v, OP_MustBeInt, regTemp, 0); |
| 116327 | 116951 | VdbeCoverage(v); |
| 116328 | 116952 | |
| 116329 | 116953 | /* If the parent table is the same as the child table, and we are about |
| 116330 | 116954 | ** to increment the constraint-counter (i.e. this is an INSERT operation), |
| | @@ -116347,11 +116971,13 @@ |
| 116347 | 116971 | int regRec = sqlite3GetTempReg(pParse); |
| 116348 | 116972 | |
| 116349 | 116973 | sqlite3VdbeAddOp3(v, OP_OpenRead, iCur, pIdx->tnum, iDb); |
| 116350 | 116974 | sqlite3VdbeSetP4KeyInfo(pParse, pIdx); |
| 116351 | 116975 | for(i=0; i<nCol; i++){ |
| 116352 | | - sqlite3VdbeAddOp2(v, OP_Copy, aiCol[i]+1+regData, regTemp+i); |
| 116976 | + sqlite3VdbeAddOp2(v, OP_Copy, |
| 116977 | + sqlite3TableColumnToStorage(pFKey->pFrom, aiCol[i])+1+regData, |
| 116978 | + regTemp+i); |
| 116353 | 116979 | } |
| 116354 | 116980 | |
| 116355 | 116981 | /* If the parent table is the same as the child table, and we are about |
| 116356 | 116982 | ** to increment the constraint-counter (i.e. this is an INSERT operation), |
| 116357 | 116983 | ** then check if the row being inserted matches itself. If so, do not |
| | @@ -116363,12 +116989,15 @@ |
| 116363 | 116989 | ** none of the child key values are). |
| 116364 | 116990 | */ |
| 116365 | 116991 | if( pTab==pFKey->pFrom && nIncr==1 ){ |
| 116366 | 116992 | int iJump = sqlite3VdbeCurrentAddr(v) + nCol + 1; |
| 116367 | 116993 | for(i=0; i<nCol; i++){ |
| 116368 | | - int iChild = aiCol[i]+1+regData; |
| 116369 | | - int iParent = pIdx->aiColumn[i]+1+regData; |
| 116994 | + int iChild = sqlite3TableColumnToStorage(pFKey->pFrom,aiCol[i]) |
| 116995 | + +1+regData; |
| 116996 | + int iParent = 1+regData; |
| 116997 | + iParent += sqlite3TableColumnToStorage(pIdx->pTable, |
| 116998 | + pIdx->aiColumn[i]); |
| 116370 | 116999 | assert( pIdx->aiColumn[i]>=0 ); |
| 116371 | 117000 | assert( aiCol[i]!=pTab->iPKey ); |
| 116372 | 117001 | if( pIdx->aiColumn[i]==pTab->iPKey ){ |
| 116373 | 117002 | /* The parent key is a composite key that includes the IPK column */ |
| 116374 | 117003 | iParent = regData; |
| | @@ -116432,11 +117061,11 @@ |
| 116432 | 117061 | |
| 116433 | 117062 | pExpr = sqlite3Expr(db, TK_REGISTER, 0); |
| 116434 | 117063 | if( pExpr ){ |
| 116435 | 117064 | if( iCol>=0 && iCol!=pTab->iPKey ){ |
| 116436 | 117065 | pCol = &pTab->aCol[iCol]; |
| 116437 | | - pExpr->iTable = regBase + iCol + 1; |
| 117066 | + pExpr->iTable = regBase + sqlite3TableColumnToStorage(pTab,iCol) + 1; |
| 116438 | 117067 | pExpr->affExpr = pCol->affinity; |
| 116439 | 117068 | zColl = pCol->zColl; |
| 116440 | 117069 | if( zColl==0 ) zColl = db->pDfltColl->zName; |
| 116441 | 117070 | pExpr = sqlite3ExprAddCollateString(pParse, pExpr, zColl); |
| 116442 | 117071 | }else{ |
| | @@ -116881,11 +117510,13 @@ |
| 116881 | 117510 | ** FK counter for each row of the current table with non-NULL keys. |
| 116882 | 117511 | */ |
| 116883 | 117512 | Vdbe *v = sqlite3GetVdbe(pParse); |
| 116884 | 117513 | int iJump = sqlite3VdbeCurrentAddr(v) + pFKey->nCol + 1; |
| 116885 | 117514 | for(i=0; i<pFKey->nCol; i++){ |
| 116886 | | - int iReg = pFKey->aCol[i].iFrom + regOld + 1; |
| 117515 | + int iFromCol, iReg; |
| 117516 | + iFromCol = pFKey->aCol[i].iFrom; |
| 117517 | + iReg = sqlite3TableColumnToStorage(pFKey->pFrom,iFromCol) + regOld+1; |
| 116887 | 117518 | sqlite3VdbeAddOp2(v, OP_IsNull, iReg, iJump); VdbeCoverage(v); |
| 116888 | 117519 | } |
| 116889 | 117520 | sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, -1); |
| 116890 | 117521 | } |
| 116891 | 117522 | continue; |
| | @@ -117216,11 +117847,19 @@ |
| 117216 | 117847 | if( action==OE_Cascade ){ |
| 117217 | 117848 | pNew = sqlite3PExpr(pParse, TK_DOT, |
| 117218 | 117849 | sqlite3ExprAlloc(db, TK_ID, &tNew, 0), |
| 117219 | 117850 | sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)); |
| 117220 | 117851 | }else if( action==OE_SetDflt ){ |
| 117221 | | - Expr *pDflt = pFKey->pFrom->aCol[iFromCol].pDflt; |
| 117852 | + Column *pCol = pFKey->pFrom->aCol + iFromCol; |
| 117853 | + Expr *pDflt; |
| 117854 | + if( pCol->colFlags & COLFLAG_GENERATED ){ |
| 117855 | + testcase( pCol->colFlags & COLFLAG_VIRTUAL ); |
| 117856 | + testcase( pCol->colFlags & COLFLAG_STORED ); |
| 117857 | + pDflt = 0; |
| 117858 | + }else{ |
| 117859 | + pDflt = pCol->pDflt; |
| 117860 | + } |
| 117222 | 117861 | if( pDflt ){ |
| 117223 | 117862 | pNew = sqlite3ExprDup(db, pDflt, 0); |
| 117224 | 117863 | }else{ |
| 117225 | 117864 | pNew = sqlite3ExprAlloc(db, TK_NULL, 0, 0); |
| 117226 | 117865 | } |
| | @@ -117254,11 +117893,11 @@ |
| 117254 | 117893 | ); |
| 117255 | 117894 | pWhere = 0; |
| 117256 | 117895 | } |
| 117257 | 117896 | |
| 117258 | 117897 | /* Disable lookaside memory allocation */ |
| 117259 | | - db->lookaside.bDisable++; |
| 117898 | + DisableLookaside; |
| 117260 | 117899 | |
| 117261 | 117900 | pTrigger = (Trigger *)sqlite3DbMallocZero(db, |
| 117262 | 117901 | sizeof(Trigger) + /* struct Trigger */ |
| 117263 | 117902 | sizeof(TriggerStep) + /* Single step in trigger program */ |
| 117264 | 117903 | nFrom + 1 /* Space for pStep->zTarget */ |
| | @@ -117276,11 +117915,11 @@ |
| 117276 | 117915 | pTrigger->pWhen = sqlite3ExprDup(db, pWhen, EXPRDUP_REDUCE); |
| 117277 | 117916 | } |
| 117278 | 117917 | } |
| 117279 | 117918 | |
| 117280 | 117919 | /* Re-enable the lookaside buffer, if it was disabled earlier. */ |
| 117281 | | - db->lookaside.bDisable--; |
| 117920 | + EnableLookaside; |
| 117282 | 117921 | |
| 117283 | 117922 | sqlite3ExprDelete(db, pWhere); |
| 117284 | 117923 | sqlite3ExprDelete(db, pWhen); |
| 117285 | 117924 | sqlite3ExprListDelete(db, pList); |
| 117286 | 117925 | sqlite3SelectDelete(db, pSelect); |
| | @@ -117427,11 +118066,11 @@ |
| 117427 | 118066 | v = sqlite3GetVdbe(pParse); |
| 117428 | 118067 | assert( opcode==OP_OpenWrite || opcode==OP_OpenRead ); |
| 117429 | 118068 | sqlite3TableLock(pParse, iDb, pTab->tnum, |
| 117430 | 118069 | (opcode==OP_OpenWrite)?1:0, pTab->zName); |
| 117431 | 118070 | if( HasRowid(pTab) ){ |
| 117432 | | - sqlite3VdbeAddOp4Int(v, opcode, iCur, pTab->tnum, iDb, pTab->nCol); |
| 118071 | + sqlite3VdbeAddOp4Int(v, opcode, iCur, pTab->tnum, iDb, pTab->nNVCol); |
| 117433 | 118072 | VdbeComment((v, "%s", pTab->zName)); |
| 117434 | 118073 | }else{ |
| 117435 | 118074 | Index *pPk = sqlite3PrimaryKeyIndex(pTab); |
| 117436 | 118075 | assert( pPk!=0 ); |
| 117437 | 118076 | assert( pPk->tnum==pTab->tnum ); |
| | @@ -117519,27 +118158,29 @@ |
| 117519 | 118158 | ** 'C' NUMERIC |
| 117520 | 118159 | ** 'D' INTEGER |
| 117521 | 118160 | ** 'E' REAL |
| 117522 | 118161 | */ |
| 117523 | 118162 | SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe *v, Table *pTab, int iReg){ |
| 117524 | | - int i; |
| 118163 | + int i, j; |
| 117525 | 118164 | char *zColAff = pTab->zColAff; |
| 117526 | 118165 | if( zColAff==0 ){ |
| 117527 | 118166 | sqlite3 *db = sqlite3VdbeDb(v); |
| 117528 | 118167 | zColAff = (char *)sqlite3DbMallocRaw(0, pTab->nCol+1); |
| 117529 | 118168 | if( !zColAff ){ |
| 117530 | 118169 | sqlite3OomFault(db); |
| 117531 | 118170 | return; |
| 117532 | 118171 | } |
| 117533 | 118172 | |
| 117534 | | - for(i=0; i<pTab->nCol; i++){ |
| 118173 | + for(i=j=0; i<pTab->nCol; i++){ |
| 117535 | 118174 | assert( pTab->aCol[i].affinity!=0 ); |
| 117536 | | - zColAff[i] = pTab->aCol[i].affinity; |
| 118175 | + if( (pTab->aCol[i].colFlags & COLFLAG_VIRTUAL)==0 ){ |
| 118176 | + zColAff[j++] = pTab->aCol[i].affinity; |
| 118177 | + } |
| 117537 | 118178 | } |
| 117538 | 118179 | do{ |
| 117539 | | - zColAff[i--] = 0; |
| 117540 | | - }while( i>=0 && zColAff[i]<=SQLITE_AFF_BLOB ); |
| 118180 | + zColAff[j--] = 0; |
| 118181 | + }while( j>=0 && zColAff[j]<=SQLITE_AFF_BLOB ); |
| 117541 | 118182 | pTab->zColAff = zColAff; |
| 117542 | 118183 | } |
| 117543 | 118184 | assert( zColAff!=0 ); |
| 117544 | 118185 | i = sqlite3Strlen30NN(zColAff); |
| 117545 | 118186 | if( i ){ |
| | @@ -117588,10 +118229,92 @@ |
| 117588 | 118229 | } |
| 117589 | 118230 | #endif |
| 117590 | 118231 | } |
| 117591 | 118232 | return 0; |
| 117592 | 118233 | } |
| 118234 | + |
| 118235 | +/* This walker callback will compute the union of colFlags flags for all |
| 118236 | +** references columns in a CHECK constraint or generated column expression. |
| 118237 | +*/ |
| 118238 | +static int exprColumnFlagUnion(Walker *pWalker, Expr *pExpr){ |
| 118239 | + if( pExpr->op==TK_COLUMN ){ |
| 118240 | + pWalker->eCode |= pWalker->u.pTab->aCol[pExpr->iColumn].colFlags; |
| 118241 | + } |
| 118242 | + return WRC_Continue; |
| 118243 | +} |
| 118244 | + |
| 118245 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 118246 | +/* |
| 118247 | +** All regular columns for table pTab have been puts into registers |
| 118248 | +** starting with iRegStore. The registers that correspond to STORED |
| 118249 | +** or VIRTUAL columns have not yet been initialized. This routine goes |
| 118250 | +** back and computes the values for those columns based on the previously |
| 118251 | +** computed normal columns. |
| 118252 | +*/ |
| 118253 | +SQLITE_PRIVATE void sqlite3ComputeGeneratedColumns( |
| 118254 | + Parse *pParse, /* Parsing context */ |
| 118255 | + int iRegStore, /* Register holding the first column */ |
| 118256 | + Table *pTab /* The table */ |
| 118257 | +){ |
| 118258 | + int i; |
| 118259 | + Walker w; |
| 118260 | + Column *pRedo; |
| 118261 | + int eProgress; |
| 118262 | + |
| 118263 | + /* Because there can be multiple generated columns that refer to one another, |
| 118264 | + ** this is a two-pass algorithm. On the first pass, mark all generated |
| 118265 | + ** columns as "not available". |
| 118266 | + */ |
| 118267 | + for(i=0; i<pTab->nCol; i++){ |
| 118268 | + if( pTab->aCol[i].colFlags & COLFLAG_GENERATED ){ |
| 118269 | + testcase( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL ); |
| 118270 | + testcase( pTab->aCol[i].colFlags & COLFLAG_STORED ); |
| 118271 | + pTab->aCol[i].colFlags |= COLFLAG_NOTAVAIL; |
| 118272 | + } |
| 118273 | + } |
| 118274 | + |
| 118275 | + w.u.pTab = pTab; |
| 118276 | + w.xExprCallback = exprColumnFlagUnion; |
| 118277 | + w.xSelectCallback = 0; |
| 118278 | + w.xSelectCallback2 = 0; |
| 118279 | + |
| 118280 | + /* On the second pass, compute the value of each NOT-AVAILABLE column. |
| 118281 | + ** Companion code in the TK_COLUMN case of sqlite3ExprCodeTarget() will |
| 118282 | + ** compute dependencies and mark remove the COLSPAN_NOTAVAIL mark, as |
| 118283 | + ** they are needed. |
| 118284 | + */ |
| 118285 | + pParse->iSelfTab = -iRegStore; |
| 118286 | + do{ |
| 118287 | + eProgress = 0; |
| 118288 | + pRedo = 0; |
| 118289 | + for(i=0; i<pTab->nCol; i++){ |
| 118290 | + Column *pCol = pTab->aCol + i; |
| 118291 | + if( (pCol->colFlags & COLFLAG_NOTAVAIL)!=0 ){ |
| 118292 | + int x; |
| 118293 | + pCol->colFlags |= COLFLAG_BUSY; |
| 118294 | + w.eCode = 0; |
| 118295 | + sqlite3WalkExpr(&w, pCol->pDflt); |
| 118296 | + pCol->colFlags &= ~COLFLAG_BUSY; |
| 118297 | + if( w.eCode & COLFLAG_NOTAVAIL ){ |
| 118298 | + pRedo = pCol; |
| 118299 | + continue; |
| 118300 | + } |
| 118301 | + eProgress = 1; |
| 118302 | + assert( pCol->colFlags & COLFLAG_GENERATED ); |
| 118303 | + x = sqlite3TableColumnToStorage(pTab, i) + iRegStore; |
| 118304 | + sqlite3ExprCodeGeneratedColumn(pParse, pCol, x); |
| 118305 | + pCol->colFlags &= ~COLFLAG_NOTAVAIL; |
| 118306 | + } |
| 118307 | + } |
| 118308 | + }while( pRedo && eProgress ); |
| 118309 | + if( pRedo ){ |
| 118310 | + sqlite3ErrorMsg(pParse, "generated column loop on \"%s\"", pRedo->zName); |
| 118311 | + } |
| 118312 | + pParse->iSelfTab = 0; |
| 118313 | +} |
| 118314 | +#endif /* SQLITE_OMIT_GENERATED_COLUMNS */ |
| 118315 | + |
| 117593 | 118316 | |
| 117594 | 118317 | #ifndef SQLITE_OMIT_AUTOINCREMENT |
| 117595 | 118318 | /* |
| 117596 | 118319 | ** Locate or create an AutoincInfo structure associated with table pTab |
| 117597 | 118320 | ** which is in database iDb. Return the register number for the register |
| | @@ -117896,11 +118619,11 @@ |
| 117896 | 118619 | */ |
| 117897 | 118620 | SQLITE_PRIVATE void sqlite3Insert( |
| 117898 | 118621 | Parse *pParse, /* Parser context */ |
| 117899 | 118622 | SrcList *pTabList, /* Name of table into which we are inserting */ |
| 117900 | 118623 | Select *pSelect, /* A SELECT statement to use as the data source */ |
| 117901 | | - IdList *pColumn, /* Column names corresponding to IDLIST. */ |
| 118624 | + IdList *pColumn, /* Column names corresponding to IDLIST, or NULL. */ |
| 117902 | 118625 | int onError, /* How to handle constraint errors */ |
| 117903 | 118626 | Upsert *pUpsert /* ON CONFLICT clauses for upsert, or NULL */ |
| 117904 | 118627 | ){ |
| 117905 | 118628 | sqlite3 *db; /* The main database structure */ |
| 117906 | 118629 | Table *pTab; /* The table to insert into. aka TABLE */ |
| | @@ -117921,10 +118644,11 @@ |
| 117921 | 118644 | u8 useTempTable = 0; /* Store SELECT results in intermediate table */ |
| 117922 | 118645 | u8 appendFlag = 0; /* True if the insert is likely to be an append */ |
| 117923 | 118646 | u8 withoutRowid; /* 0 for normal table. 1 for WITHOUT ROWID table */ |
| 117924 | 118647 | u8 bIdListInOrder; /* True if IDLIST is in table order */ |
| 117925 | 118648 | ExprList *pList = 0; /* List of VALUES() to be inserted */ |
| 118649 | + int iRegStore; /* Register in which to store next column */ |
| 117926 | 118650 | |
| 117927 | 118651 | /* Register allocations */ |
| 117928 | 118652 | int regFromSelect = 0;/* Base register for data coming from SELECT */ |
| 117929 | 118653 | int regAutoinc = 0; /* Register holding the AUTOINCREMENT counter */ |
| 117930 | 118654 | int regRowCount = 0; /* Memory cell used for the row counter */ |
| | @@ -118028,12 +118752,12 @@ |
| 118028 | 118752 | /* If this is an AUTOINCREMENT table, look up the sequence number in the |
| 118029 | 118753 | ** sqlite_sequence table and store it in memory cell regAutoinc. |
| 118030 | 118754 | */ |
| 118031 | 118755 | regAutoinc = autoIncBegin(pParse, iDb, pTab); |
| 118032 | 118756 | |
| 118033 | | - /* Allocate registers for holding the rowid of the new row, |
| 118034 | | - ** the content of the new row, and the assembled row record. |
| 118757 | + /* Allocate a block registers to hold the rowid and the values |
| 118758 | + ** for all columns of the new row. |
| 118035 | 118759 | */ |
| 118036 | 118760 | regRowid = regIns = pParse->nMem+1; |
| 118037 | 118761 | pParse->nMem += pTab->nCol + 1; |
| 118038 | 118762 | if( IsVirtual(pTab) ){ |
| 118039 | 118763 | regRowid++; |
| | @@ -118048,13 +118772,21 @@ |
| 118048 | 118772 | ** If the table has an INTEGER PRIMARY KEY column and that column |
| 118049 | 118773 | ** is named in the IDLIST, then record in the ipkColumn variable |
| 118050 | 118774 | ** the index into IDLIST of the primary key column. ipkColumn is |
| 118051 | 118775 | ** the index of the primary key as it appears in IDLIST, not as |
| 118052 | 118776 | ** is appears in the original table. (The index of the INTEGER |
| 118053 | | - ** PRIMARY KEY in the original table is pTab->iPKey.) |
| 118777 | + ** PRIMARY KEY in the original table is pTab->iPKey.) After this |
| 118778 | + ** loop, if ipkColumn==(-1), that means that integer primary key |
| 118779 | + ** is unspecified, and hence the table is either WITHOUT ROWID or |
| 118780 | + ** it will automatically generated an integer primary key. |
| 118781 | + ** |
| 118782 | + ** bIdListInOrder is true if the columns in IDLIST are in storage |
| 118783 | + ** order. This enables an optimization that avoids shuffling the |
| 118784 | + ** columns into storage order. False negatives are harmless, |
| 118785 | + ** but false positives will cause database corruption. |
| 118054 | 118786 | */ |
| 118055 | | - bIdListInOrder = (pTab->tabFlags & TF_OOOHidden)==0; |
| 118787 | + bIdListInOrder = (pTab->tabFlags & (TF_OOOHidden|TF_HasStored))==0; |
| 118056 | 118788 | if( pColumn ){ |
| 118057 | 118789 | for(i=0; i<pColumn->nId; i++){ |
| 118058 | 118790 | pColumn->a[i].idx = -1; |
| 118059 | 118791 | } |
| 118060 | 118792 | for(i=0; i<pColumn->nId; i++){ |
| | @@ -118063,10 +118795,18 @@ |
| 118063 | 118795 | pColumn->a[i].idx = j; |
| 118064 | 118796 | if( i!=j ) bIdListInOrder = 0; |
| 118065 | 118797 | if( j==pTab->iPKey ){ |
| 118066 | 118798 | ipkColumn = i; assert( !withoutRowid ); |
| 118067 | 118799 | } |
| 118800 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 118801 | + if( pTab->aCol[j].colFlags & (COLFLAG_STORED|COLFLAG_VIRTUAL) ){ |
| 118802 | + sqlite3ErrorMsg(pParse, |
| 118803 | + "cannot INSERT into generated column \"%s\"", |
| 118804 | + pTab->aCol[j].zName); |
| 118805 | + goto insert_cleanup; |
| 118806 | + } |
| 118807 | +#endif |
| 118068 | 118808 | break; |
| 118069 | 118809 | } |
| 118070 | 118810 | } |
| 118071 | 118811 | if( j>=pTab->nCol ){ |
| 118072 | 118812 | if( sqlite3IsRowid(pColumn->a[i].zName) && !withoutRowid ){ |
| | @@ -118172,17 +118912,30 @@ |
| 118172 | 118912 | ** key, the set the ipkColumn variable to the integer primary key |
| 118173 | 118913 | ** column index in the original table definition. |
| 118174 | 118914 | */ |
| 118175 | 118915 | if( pColumn==0 && nColumn>0 ){ |
| 118176 | 118916 | ipkColumn = pTab->iPKey; |
| 118917 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 118918 | + if( ipkColumn>=0 && (pTab->tabFlags & TF_HasGenerated)!=0 ){ |
| 118919 | + testcase( pTab->tabFlags & TF_HasVirtual ); |
| 118920 | + testcase( pTab->tabFlags & TF_HasStored ); |
| 118921 | + for(i=ipkColumn-1; i>=0; i--){ |
| 118922 | + if( pTab->aCol[i].colFlags & COLFLAG_GENERATED ){ |
| 118923 | + testcase( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL ); |
| 118924 | + testcase( pTab->aCol[i].colFlags & COLFLAG_STORED ); |
| 118925 | + ipkColumn--; |
| 118926 | + } |
| 118927 | + } |
| 118928 | + } |
| 118929 | +#endif |
| 118177 | 118930 | } |
| 118178 | 118931 | |
| 118179 | 118932 | /* Make sure the number of columns in the source data matches the number |
| 118180 | 118933 | ** of columns to be inserted into the table. |
| 118181 | 118934 | */ |
| 118182 | 118935 | for(i=0; i<pTab->nCol; i++){ |
| 118183 | | - nHidden += (IsHiddenColumn(&pTab->aCol[i]) ? 1 : 0); |
| 118936 | + if( pTab->aCol[i].colFlags & COLFLAG_NOINSERT ) nHidden++; |
| 118184 | 118937 | } |
| 118185 | 118938 | if( pColumn==0 && nColumn && nColumn!=(pTab->nCol-nHidden) ){ |
| 118186 | 118939 | sqlite3ErrorMsg(pParse, |
| 118187 | 118940 | "table %S has %d columns but %d values were supplied", |
| 118188 | 118941 | pTabList, 0, pTab->nCol-nHidden, nColumn); |
| | @@ -118263,11 +119016,91 @@ |
| 118263 | 119016 | ** goto C |
| 118264 | 119017 | ** D: ... |
| 118265 | 119018 | */ |
| 118266 | 119019 | addrInsTop = addrCont = sqlite3VdbeAddOp1(v, OP_Yield, dest.iSDParm); |
| 118267 | 119020 | VdbeCoverage(v); |
| 119021 | + if( ipkColumn>=0 ){ |
| 119022 | + /* tag-20191021-001: If the INTEGER PRIMARY KEY is being generated by the |
| 119023 | + ** SELECT, go ahead and copy the value into the rowid slot now, so that |
| 119024 | + ** the value does not get overwritten by a NULL at tag-20191021-002. */ |
| 119025 | + sqlite3VdbeAddOp2(v, OP_Copy, regFromSelect+ipkColumn, regRowid); |
| 119026 | + } |
| 118268 | 119027 | } |
| 119028 | + |
| 119029 | + /* Compute data for ordinary columns of the new entry. Values |
| 119030 | + ** are written in storage order into registers starting with regData. |
| 119031 | + ** Only ordinary columns are computed in this loop. The rowid |
| 119032 | + ** (if there is one) is computed later and generated columns are |
| 119033 | + ** computed after the rowid since they might depend on the value |
| 119034 | + ** of the rowid. |
| 119035 | + */ |
| 119036 | + nHidden = 0; |
| 119037 | + iRegStore = regData; assert( regData==regRowid+1 ); |
| 119038 | + for(i=0; i<pTab->nCol; i++, iRegStore++){ |
| 119039 | + int k; |
| 119040 | + u32 colFlags; |
| 119041 | + assert( i>=nHidden ); |
| 119042 | + if( i==pTab->iPKey ){ |
| 119043 | + /* tag-20191021-002: References to the INTEGER PRIMARY KEY are filled |
| 119044 | + ** using the rowid. So put a NULL in the IPK slot of the record to avoid |
| 119045 | + ** using excess space. The file format definition requires this extra |
| 119046 | + ** NULL - we cannot optimize further by skipping the column completely */ |
| 119047 | + sqlite3VdbeAddOp1(v, OP_SoftNull, iRegStore); |
| 119048 | + continue; |
| 119049 | + } |
| 119050 | + if( ((colFlags = pTab->aCol[i].colFlags) & COLFLAG_NOINSERT)!=0 ){ |
| 119051 | + nHidden++; |
| 119052 | + if( (colFlags & COLFLAG_VIRTUAL)!=0 ){ |
| 119053 | + /* Virtual columns do not participate in OP_MakeRecord. So back up |
| 119054 | + ** iRegStore by one slot to compensate for the iRegStore++ in the |
| 119055 | + ** outer for() loop */ |
| 119056 | + iRegStore--; |
| 119057 | + continue; |
| 119058 | + }else if( (colFlags & COLFLAG_STORED)!=0 ){ |
| 119059 | + /* Stored columns are computed later. But if there are BEFORE |
| 119060 | + ** triggers, the slots used for stored columns will be OP_Copy-ed |
| 119061 | + ** to a second block of registers, so the register needs to be |
| 119062 | + ** initialized to NULL to avoid an uninitialized register read */ |
| 119063 | + if( tmask & TRIGGER_BEFORE ){ |
| 119064 | + sqlite3VdbeAddOp1(v, OP_SoftNull, iRegStore); |
| 119065 | + } |
| 119066 | + continue; |
| 119067 | + }else if( pColumn==0 ){ |
| 119068 | + /* Hidden columns that are not explicitly named in the INSERT |
| 119069 | + ** get there default value */ |
| 119070 | + sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore); |
| 119071 | + continue; |
| 119072 | + } |
| 119073 | + } |
| 119074 | + if( pColumn ){ |
| 119075 | + for(j=0; j<pColumn->nId && pColumn->a[j].idx!=i; j++){} |
| 119076 | + if( j>=pColumn->nId ){ |
| 119077 | + /* A column not named in the insert column list gets its |
| 119078 | + ** default value */ |
| 119079 | + sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore); |
| 119080 | + continue; |
| 119081 | + } |
| 119082 | + k = j; |
| 119083 | + }else if( nColumn==0 ){ |
| 119084 | + /* This is INSERT INTO ... DEFAULT VALUES. Load the default value. */ |
| 119085 | + sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore); |
| 119086 | + continue; |
| 119087 | + }else{ |
| 119088 | + k = i - nHidden; |
| 119089 | + } |
| 119090 | + |
| 119091 | + if( useTempTable ){ |
| 119092 | + sqlite3VdbeAddOp3(v, OP_Column, srcTab, k, iRegStore); |
| 119093 | + }else if( pSelect ){ |
| 119094 | + if( regFromSelect!=regData ){ |
| 119095 | + sqlite3VdbeAddOp2(v, OP_SCopy, regFromSelect+k, iRegStore); |
| 119096 | + } |
| 119097 | + }else{ |
| 119098 | + sqlite3ExprCode(pParse, pList->a[k].pExpr, iRegStore); |
| 119099 | + } |
| 119100 | + } |
| 119101 | + |
| 118269 | 119102 | |
| 118270 | 119103 | /* Run the BEFORE and INSTEAD OF triggers, if there are any |
| 118271 | 119104 | */ |
| 118272 | 119105 | endOfLoop = sqlite3VdbeMakeLabel(pParse); |
| 118273 | 119106 | if( tmask & TRIGGER_BEFORE ){ |
| | @@ -118299,29 +119132,25 @@ |
| 118299 | 119132 | /* Cannot have triggers on a virtual table. If it were possible, |
| 118300 | 119133 | ** this block would have to account for hidden column. |
| 118301 | 119134 | */ |
| 118302 | 119135 | assert( !IsVirtual(pTab) ); |
| 118303 | 119136 | |
| 118304 | | - /* Create the new column data |
| 118305 | | - */ |
| 118306 | | - for(i=j=0; i<pTab->nCol; i++){ |
| 118307 | | - if( pColumn ){ |
| 118308 | | - for(j=0; j<pColumn->nId; j++){ |
| 118309 | | - if( pColumn->a[j].idx==i ) break; |
| 118310 | | - } |
| 118311 | | - } |
| 118312 | | - if( (!useTempTable && !pList) || (pColumn && j>=pColumn->nId) |
| 118313 | | - || (pColumn==0 && IsOrdinaryHiddenColumn(&pTab->aCol[i])) ){ |
| 118314 | | - sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regCols+i+1); |
| 118315 | | - }else if( useTempTable ){ |
| 118316 | | - sqlite3VdbeAddOp3(v, OP_Column, srcTab, j, regCols+i+1); |
| 118317 | | - }else{ |
| 118318 | | - assert( pSelect==0 ); /* Otherwise useTempTable is true */ |
| 118319 | | - sqlite3ExprCodeAndCache(pParse, pList->a[j].pExpr, regCols+i+1); |
| 118320 | | - } |
| 118321 | | - if( pColumn==0 && !IsOrdinaryHiddenColumn(&pTab->aCol[i]) ) j++; |
| 118322 | | - } |
| 119137 | + /* Copy the new data already generated. */ |
| 119138 | + assert( pTab->nNVCol>0 ); |
| 119139 | + sqlite3VdbeAddOp3(v, OP_Copy, regRowid+1, regCols+1, pTab->nNVCol-1); |
| 119140 | + |
| 119141 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 119142 | + /* Compute the new value for generated columns after all other |
| 119143 | + ** columns have already been computed. This must be done after |
| 119144 | + ** computing the ROWID in case one of the generated columns |
| 119145 | + ** refers to the ROWID. */ |
| 119146 | + if( pTab->tabFlags & TF_HasGenerated ){ |
| 119147 | + testcase( pTab->tabFlags & TF_HasVirtual ); |
| 119148 | + testcase( pTab->tabFlags & TF_HasStored ); |
| 119149 | + sqlite3ComputeGeneratedColumns(pParse, regCols+1, pTab); |
| 119150 | + } |
| 119151 | +#endif |
| 118323 | 119152 | |
| 118324 | 119153 | /* If this is an INSERT on a view with an INSTEAD OF INSERT trigger, |
| 118325 | 119154 | ** do not attempt any conversions before assembling the record. |
| 118326 | 119155 | ** If this is a real table, attempt conversions as required by the |
| 118327 | 119156 | ** table column affinities. |
| | @@ -118335,23 +119164,21 @@ |
| 118335 | 119164 | pTab, regCols-pTab->nCol-1, onError, endOfLoop); |
| 118336 | 119165 | |
| 118337 | 119166 | sqlite3ReleaseTempRange(pParse, regCols, pTab->nCol+1); |
| 118338 | 119167 | } |
| 118339 | 119168 | |
| 118340 | | - /* Compute the content of the next row to insert into a range of |
| 118341 | | - ** registers beginning at regIns. |
| 118342 | | - */ |
| 118343 | 119169 | if( !isView ){ |
| 118344 | 119170 | if( IsVirtual(pTab) ){ |
| 118345 | 119171 | /* The row that the VUpdate opcode will delete: none */ |
| 118346 | 119172 | sqlite3VdbeAddOp2(v, OP_Null, 0, regIns); |
| 118347 | 119173 | } |
| 118348 | 119174 | if( ipkColumn>=0 ){ |
| 119175 | + /* Compute the new rowid */ |
| 118349 | 119176 | if( useTempTable ){ |
| 118350 | 119177 | sqlite3VdbeAddOp3(v, OP_Column, srcTab, ipkColumn, regRowid); |
| 118351 | 119178 | }else if( pSelect ){ |
| 118352 | | - sqlite3VdbeAddOp2(v, OP_Copy, regFromSelect+ipkColumn, regRowid); |
| 119179 | + /* Rowid already initialized at tag-20191021-001 */ |
| 118353 | 119180 | }else{ |
| 118354 | 119181 | Expr *pIpk = pList->a[ipkColumn].pExpr; |
| 118355 | 119182 | if( pIpk->op==TK_NULL && !IsVirtual(pTab) ){ |
| 118356 | 119183 | sqlite3VdbeAddOp3(v, OP_NewRowid, iDataCur, regRowid, regAutoinc); |
| 118357 | 119184 | appendFlag = 1; |
| | @@ -118380,49 +119207,21 @@ |
| 118380 | 119207 | sqlite3VdbeAddOp3(v, OP_NewRowid, iDataCur, regRowid, regAutoinc); |
| 118381 | 119208 | appendFlag = 1; |
| 118382 | 119209 | } |
| 118383 | 119210 | autoIncStep(pParse, regAutoinc, regRowid); |
| 118384 | 119211 | |
| 118385 | | - /* Compute data for all columns of the new entry, beginning |
| 118386 | | - ** with the first column. |
| 118387 | | - */ |
| 118388 | | - nHidden = 0; |
| 118389 | | - for(i=0; i<pTab->nCol; i++){ |
| 118390 | | - int iRegStore = regRowid+1+i; |
| 118391 | | - if( i==pTab->iPKey ){ |
| 118392 | | - /* The value of the INTEGER PRIMARY KEY column is always a NULL. |
| 118393 | | - ** Whenever this column is read, the rowid will be substituted |
| 118394 | | - ** in its place. Hence, fill this column with a NULL to avoid |
| 118395 | | - ** taking up data space with information that will never be used. |
| 118396 | | - ** As there may be shallow copies of this value, make it a soft-NULL */ |
| 118397 | | - sqlite3VdbeAddOp1(v, OP_SoftNull, iRegStore); |
| 118398 | | - continue; |
| 118399 | | - } |
| 118400 | | - if( pColumn==0 ){ |
| 118401 | | - if( IsHiddenColumn(&pTab->aCol[i]) ){ |
| 118402 | | - j = -1; |
| 118403 | | - nHidden++; |
| 118404 | | - }else{ |
| 118405 | | - j = i - nHidden; |
| 118406 | | - } |
| 118407 | | - }else{ |
| 118408 | | - for(j=0; j<pColumn->nId; j++){ |
| 118409 | | - if( pColumn->a[j].idx==i ) break; |
| 118410 | | - } |
| 118411 | | - } |
| 118412 | | - if( j<0 || nColumn==0 || (pColumn && j>=pColumn->nId) ){ |
| 118413 | | - sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore); |
| 118414 | | - }else if( useTempTable ){ |
| 118415 | | - sqlite3VdbeAddOp3(v, OP_Column, srcTab, j, iRegStore); |
| 118416 | | - }else if( pSelect ){ |
| 118417 | | - if( regFromSelect!=regData ){ |
| 118418 | | - sqlite3VdbeAddOp2(v, OP_SCopy, regFromSelect+j, iRegStore); |
| 118419 | | - } |
| 118420 | | - }else{ |
| 118421 | | - sqlite3ExprCode(pParse, pList->a[j].pExpr, iRegStore); |
| 118422 | | - } |
| 118423 | | - } |
| 119212 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 119213 | + /* Compute the new value for generated columns after all other |
| 119214 | + ** columns have already been computed. This must be done after |
| 119215 | + ** computing the ROWID in case one of the generated columns |
| 119216 | + ** refers to the ROWID. */ |
| 119217 | + if( pTab->tabFlags & TF_HasGenerated ){ |
| 119218 | + testcase( pTab->tabFlags & TF_HasVirtual ); |
| 119219 | + testcase( pTab->tabFlags & TF_HasStored ); |
| 119220 | + sqlite3ComputeGeneratedColumns(pParse, regRowid+1, pTab); |
| 119221 | + } |
| 119222 | +#endif |
| 118424 | 119223 | |
| 118425 | 119224 | /* Generate code to check constraints and generate index keys and |
| 118426 | 119225 | ** do the insertion. |
| 118427 | 119226 | */ |
| 118428 | 119227 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| | @@ -118448,13 +119247,11 @@ |
| 118448 | 119247 | ** flag in the second case as if any REPLACE constraint is hit, an |
| 118449 | 119248 | ** OP_Delete or OP_IdxDelete instruction will be executed on each |
| 118450 | 119249 | ** cursor that is disturbed. And these instructions both clear the |
| 118451 | 119250 | ** VdbeCursor.seekResult variable, disabling the OPFLAG_USESEEKRESULT |
| 118452 | 119251 | ** functionality. */ |
| 118453 | | - bUseSeek = (isReplace==0 || (pTrigger==0 && |
| 118454 | | - ((db->flags & SQLITE_ForeignKeys)==0 || sqlite3FkReferences(pTab)==0) |
| 118455 | | - )); |
| 119252 | + bUseSeek = (isReplace==0 || !sqlite3VdbeHasSubProgram(v)); |
| 118456 | 119253 | sqlite3CompleteInsertion(pParse, pTab, iDataCur, iIdxCur, |
| 118457 | 119254 | regIns, aRegIdx, 0, appendFlag, bUseSeek |
| 118458 | 119255 | ); |
| 118459 | 119256 | } |
| 118460 | 119257 | } |
| | @@ -118711,10 +119508,17 @@ |
| 118711 | 119508 | u8 bAffinityDone = 0; /* True if the OP_Affinity operation has been run */ |
| 118712 | 119509 | int upsertBypass = 0; /* Address of Goto to bypass upsert subroutine */ |
| 118713 | 119510 | int upsertJump = 0; /* Address of Goto that jumps into upsert subroutine */ |
| 118714 | 119511 | int ipkTop = 0; /* Top of the IPK uniqueness check */ |
| 118715 | 119512 | int ipkBottom = 0; /* OP_Goto at the end of the IPK uniqueness check */ |
| 119513 | + /* Variables associated with retesting uniqueness constraints after |
| 119514 | + ** replace triggers fire have run */ |
| 119515 | + int regTrigCnt; /* Register used to count replace trigger invocations */ |
| 119516 | + int addrRecheck = 0; /* Jump here to recheck all uniqueness constraints */ |
| 119517 | + int lblRecheckOk = 0; /* Each recheck jumps to this label if it passes */ |
| 119518 | + Trigger *pTrigger; /* List of DELETE triggers on the table pTab */ |
| 119519 | + int nReplaceTrig = 0; /* Number of replace triggers coded */ |
| 118716 | 119520 | |
| 118717 | 119521 | isUpdate = regOldData!=0; |
| 118718 | 119522 | db = pParse->db; |
| 118719 | 119523 | v = sqlite3GetVdbe(pParse); |
| 118720 | 119524 | assert( v!=0 ); |
| | @@ -118737,64 +119541,73 @@ |
| 118737 | 119541 | VdbeModuleComment((v, "BEGIN: GenCnstCks(%d,%d,%d,%d,%d)", |
| 118738 | 119542 | iDataCur, iIdxCur, regNewData, regOldData, pkChng)); |
| 118739 | 119543 | |
| 118740 | 119544 | /* Test all NOT NULL constraints. |
| 118741 | 119545 | */ |
| 118742 | | - for(i=0; i<nCol; i++){ |
| 118743 | | - if( i==pTab->iPKey ){ |
| 118744 | | - continue; /* ROWID is never NULL */ |
| 118745 | | - } |
| 118746 | | - if( aiChng && aiChng[i]<0 ){ |
| 118747 | | - /* Don't bother checking for NOT NULL on columns that do not change */ |
| 118748 | | - continue; |
| 118749 | | - } |
| 118750 | | - onError = pTab->aCol[i].notNull; |
| 118751 | | - if( onError==OE_None ) continue; /* This column is allowed to be NULL */ |
| 118752 | | - if( overrideError!=OE_Default ){ |
| 118753 | | - onError = overrideError; |
| 118754 | | - }else if( onError==OE_Default ){ |
| 118755 | | - onError = OE_Abort; |
| 118756 | | - } |
| 118757 | | - if( onError==OE_Replace && pTab->aCol[i].pDflt==0 ){ |
| 118758 | | - onError = OE_Abort; |
| 118759 | | - } |
| 118760 | | - assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail |
| 118761 | | - || onError==OE_Ignore || onError==OE_Replace ); |
| 118762 | | - addr1 = 0; |
| 118763 | | - switch( onError ){ |
| 118764 | | - case OE_Replace: { |
| 118765 | | - assert( onError==OE_Replace ); |
| 118766 | | - addr1 = sqlite3VdbeMakeLabel(pParse); |
| 118767 | | - sqlite3VdbeAddOp2(v, OP_NotNull, regNewData+1+i, addr1); |
| 118768 | | - VdbeCoverage(v); |
| 118769 | | - sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regNewData+1+i); |
| 118770 | | - sqlite3VdbeAddOp2(v, OP_NotNull, regNewData+1+i, addr1); |
| 118771 | | - VdbeCoverage(v); |
| 118772 | | - onError = OE_Abort; |
| 118773 | | - /* Fall through into the OE_Abort case to generate code that runs |
| 118774 | | - ** if both the input and the default value are NULL */ |
| 118775 | | - } |
| 118776 | | - case OE_Abort: |
| 118777 | | - sqlite3MayAbort(pParse); |
| 118778 | | - /* Fall through */ |
| 118779 | | - case OE_Rollback: |
| 118780 | | - case OE_Fail: { |
| 118781 | | - char *zMsg = sqlite3MPrintf(db, "%s.%s", pTab->zName, |
| 118782 | | - pTab->aCol[i].zName); |
| 118783 | | - sqlite3VdbeAddOp3(v, OP_HaltIfNull, SQLITE_CONSTRAINT_NOTNULL, onError, |
| 118784 | | - regNewData+1+i); |
| 118785 | | - sqlite3VdbeAppendP4(v, zMsg, P4_DYNAMIC); |
| 118786 | | - sqlite3VdbeChangeP5(v, P5_ConstraintNotNull); |
| 118787 | | - VdbeCoverage(v); |
| 118788 | | - if( addr1 ) sqlite3VdbeResolveLabel(v, addr1); |
| 118789 | | - break; |
| 118790 | | - } |
| 118791 | | - default: { |
| 118792 | | - assert( onError==OE_Ignore ); |
| 118793 | | - sqlite3VdbeAddOp2(v, OP_IsNull, regNewData+1+i, ignoreDest); |
| 118794 | | - VdbeCoverage(v); |
| 118795 | | - break; |
| 119546 | + if( pTab->tabFlags & TF_HasNotNull ){ |
| 119547 | + for(i=0; i<nCol; i++){ |
| 119548 | + int iReg; |
| 119549 | + onError = pTab->aCol[i].notNull; |
| 119550 | + if( onError==OE_None ) continue; /* No NOT NULL on this column */ |
| 119551 | + if( i==pTab->iPKey ){ |
| 119552 | + continue; /* ROWID is never NULL */ |
| 119553 | + } |
| 119554 | + if( aiChng && aiChng[i]<0 ){ |
| 119555 | + /* Don't bother checking for NOT NULL on columns that do not change */ |
| 119556 | + continue; |
| 119557 | + } |
| 119558 | + if( overrideError!=OE_Default ){ |
| 119559 | + onError = overrideError; |
| 119560 | + }else if( onError==OE_Default ){ |
| 119561 | + onError = OE_Abort; |
| 119562 | + } |
| 119563 | + if( onError==OE_Replace && pTab->aCol[i].pDflt==0 ){ |
| 119564 | + onError = OE_Abort; |
| 119565 | + } |
| 119566 | + assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail |
| 119567 | + || onError==OE_Ignore || onError==OE_Replace ); |
| 119568 | + addr1 = 0; |
| 119569 | + testcase( i!=sqlite3TableColumnToStorage(pTab, i) ); |
| 119570 | + testcase( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL ); |
| 119571 | + testcase( pTab->aCol[i].colFlags & COLFLAG_STORED ); |
| 119572 | + iReg = sqlite3TableColumnToStorage(pTab, i) + regNewData + 1; |
| 119573 | + switch( onError ){ |
| 119574 | + case OE_Replace: { |
| 119575 | + assert( onError==OE_Replace ); |
| 119576 | + addr1 = sqlite3VdbeMakeLabel(pParse); |
| 119577 | + sqlite3VdbeAddOp2(v, OP_NotNull, iReg, addr1); |
| 119578 | + VdbeCoverage(v); |
| 119579 | + if( (pTab->aCol[i].colFlags & COLFLAG_GENERATED)==0 ){ |
| 119580 | + sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regNewData+1+i); |
| 119581 | + sqlite3VdbeAddOp2(v, OP_NotNull, iReg, addr1); |
| 119582 | + VdbeCoverage(v); |
| 119583 | + } |
| 119584 | + onError = OE_Abort; |
| 119585 | + /* Fall through into the OE_Abort case to generate code that runs |
| 119586 | + ** if both the input and the default value are NULL */ |
| 119587 | + } |
| 119588 | + case OE_Abort: |
| 119589 | + sqlite3MayAbort(pParse); |
| 119590 | + /* Fall through */ |
| 119591 | + case OE_Rollback: |
| 119592 | + case OE_Fail: { |
| 119593 | + char *zMsg = sqlite3MPrintf(db, "%s.%s", pTab->zName, |
| 119594 | + pTab->aCol[i].zName); |
| 119595 | + sqlite3VdbeAddOp3(v, OP_HaltIfNull, SQLITE_CONSTRAINT_NOTNULL, |
| 119596 | + onError, iReg); |
| 119597 | + sqlite3VdbeAppendP4(v, zMsg, P4_DYNAMIC); |
| 119598 | + sqlite3VdbeChangeP5(v, P5_ConstraintNotNull); |
| 119599 | + VdbeCoverage(v); |
| 119600 | + if( addr1 ) sqlite3VdbeResolveLabel(v, addr1); |
| 119601 | + break; |
| 119602 | + } |
| 119603 | + default: { |
| 119604 | + assert( onError==OE_Ignore ); |
| 119605 | + sqlite3VdbeAddOp2(v, OP_IsNull, iReg, ignoreDest); |
| 119606 | + VdbeCoverage(v); |
| 119607 | + break; |
| 119608 | + } |
| 118796 | 119609 | } |
| 118797 | 119610 | } |
| 118798 | 119611 | } |
| 118799 | 119612 | |
| 118800 | 119613 | /* Test all CHECK constraints |
| | @@ -118874,10 +119687,54 @@ |
| 118874 | 119687 | ** Jump to that uniqueness check now */ |
| 118875 | 119688 | upsertJump = sqlite3VdbeAddOp0(v, OP_Goto); |
| 118876 | 119689 | VdbeComment((v, "UPSERT constraint goes first")); |
| 118877 | 119690 | } |
| 118878 | 119691 | } |
| 119692 | + |
| 119693 | + /* Determine if it is possible that triggers (either explicitly coded |
| 119694 | + ** triggers or FK resolution actions) might run as a result of deletes |
| 119695 | + ** that happen when OE_Replace conflict resolution occurs. (Call these |
| 119696 | + ** "replace triggers".) If any replace triggers run, we will need to |
| 119697 | + ** recheck all of the uniqueness constraints after they have all run. |
| 119698 | + ** But on the recheck, the resolution is OE_Abort instead of OE_Replace. |
| 119699 | + ** |
| 119700 | + ** If replace triggers are a possibility, then |
| 119701 | + ** |
| 119702 | + ** (1) Allocate register regTrigCnt and initialize it to zero. |
| 119703 | + ** That register will count the number of replace triggers that |
| 119704 | + ** fire. Constraint recheck only occurs if the number is positive. |
| 119705 | + ** (2) Initialize pTrigger to the list of all DELETE triggers on pTab. |
| 119706 | + ** (3) Initialize addrRecheck and lblRecheckOk |
| 119707 | + ** |
| 119708 | + ** The uniqueness rechecking code will create a series of tests to run |
| 119709 | + ** in a second pass. The addrRecheck and lblRecheckOk variables are |
| 119710 | + ** used to link together these tests which are separated from each other |
| 119711 | + ** in the generate bytecode. |
| 119712 | + */ |
| 119713 | + if( (db->flags & (SQLITE_RecTriggers|SQLITE_ForeignKeys))==0 ){ |
| 119714 | + /* There are not DELETE triggers nor FK constraints. No constraint |
| 119715 | + ** rechecks are needed. */ |
| 119716 | + pTrigger = 0; |
| 119717 | + regTrigCnt = 0; |
| 119718 | + }else{ |
| 119719 | + if( db->flags&SQLITE_RecTriggers ){ |
| 119720 | + pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0); |
| 119721 | + regTrigCnt = pTrigger!=0 || sqlite3FkRequired(pParse, pTab, 0, 0); |
| 119722 | + }else{ |
| 119723 | + pTrigger = 0; |
| 119724 | + regTrigCnt = sqlite3FkRequired(pParse, pTab, 0, 0); |
| 119725 | + } |
| 119726 | + if( regTrigCnt ){ |
| 119727 | + /* Replace triggers might exist. Allocate the counter and |
| 119728 | + ** initialize it to zero. */ |
| 119729 | + regTrigCnt = ++pParse->nMem; |
| 119730 | + sqlite3VdbeAddOp2(v, OP_Integer, 0, regTrigCnt); |
| 119731 | + VdbeComment((v, "trigger count")); |
| 119732 | + lblRecheckOk = sqlite3VdbeMakeLabel(pParse); |
| 119733 | + addrRecheck = lblRecheckOk; |
| 119734 | + } |
| 119735 | + } |
| 118879 | 119736 | |
| 118880 | 119737 | /* If rowid is changing, make sure the new rowid does not previously |
| 118881 | 119738 | ** exist in the table. |
| 118882 | 119739 | */ |
| 118883 | 119740 | if( pkChng && pPk==0 ){ |
| | @@ -118964,18 +119821,16 @@ |
| 118964 | 119821 | ** REPLACE INTO t(rowid) VALUES($newrowid) |
| 118965 | 119822 | ** |
| 118966 | 119823 | ** to run without a statement journal if there are no indexes on the |
| 118967 | 119824 | ** table. |
| 118968 | 119825 | */ |
| 118969 | | - Trigger *pTrigger = 0; |
| 118970 | | - if( db->flags&SQLITE_RecTriggers ){ |
| 118971 | | - pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0); |
| 118972 | | - } |
| 118973 | | - if( pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0) ){ |
| 119826 | + if( regTrigCnt ){ |
| 118974 | 119827 | sqlite3MultiWrite(pParse); |
| 118975 | 119828 | sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur, |
| 118976 | 119829 | regNewData, 1, 0, OE_Replace, 1, -1); |
| 119830 | + sqlite3VdbeAddOp2(v, OP_AddImm, regTrigCnt, 1); /* incr trigger cnt */ |
| 119831 | + nReplaceTrig++; |
| 118977 | 119832 | }else{ |
| 118978 | 119833 | #ifdef SQLITE_ENABLE_PREUPDATE_HOOK |
| 118979 | 119834 | assert( HasRowid(pTab) ); |
| 118980 | 119835 | /* This OP_Delete opcode fires the pre-update-hook only. It does |
| 118981 | 119836 | ** not modify the b-tree. It is more efficient to let the coming |
| | @@ -119021,10 +119876,11 @@ |
| 119021 | 119876 | for(ix=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, ix++){ |
| 119022 | 119877 | int regIdx; /* Range of registers hold conent for pIdx */ |
| 119023 | 119878 | int regR; /* Range of registers holding conflicting PK */ |
| 119024 | 119879 | int iThisCur; /* Cursor for this UNIQUE index */ |
| 119025 | 119880 | int addrUniqueOk; /* Jump here if the UNIQUE constraint is satisfied */ |
| 119881 | + int addrConflictCk; /* First opcode in the conflict check logic */ |
| 119026 | 119882 | |
| 119027 | 119883 | if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */ |
| 119028 | 119884 | if( pUpIdx==pIdx ){ |
| 119029 | 119885 | addrUniqueOk = upsertJump+1; |
| 119030 | 119886 | upsertBypass = sqlite3VdbeGoto(v, 0); |
| | @@ -119060,18 +119916,19 @@ |
| 119060 | 119916 | if( iField==XN_EXPR ){ |
| 119061 | 119917 | pParse->iSelfTab = -(regNewData+1); |
| 119062 | 119918 | sqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[i].pExpr, regIdx+i); |
| 119063 | 119919 | pParse->iSelfTab = 0; |
| 119064 | 119920 | VdbeComment((v, "%s column %d", pIdx->zName, i)); |
| 119065 | | - }else{ |
| 119066 | | - if( iField==XN_ROWID || iField==pTab->iPKey ){ |
| 119067 | | - x = regNewData; |
| 119068 | | - }else{ |
| 119069 | | - x = iField + regNewData + 1; |
| 119070 | | - } |
| 119071 | | - sqlite3VdbeAddOp2(v, iField<0 ? OP_IntCopy : OP_SCopy, x, regIdx+i); |
| 119072 | | - VdbeComment((v, "%s", iField<0 ? "rowid" : pTab->aCol[iField].zName)); |
| 119921 | + }else if( iField==XN_ROWID || iField==pTab->iPKey ){ |
| 119922 | + x = regNewData; |
| 119923 | + sqlite3VdbeAddOp2(v, OP_IntCopy, x, regIdx+i); |
| 119924 | + VdbeComment((v, "rowid")); |
| 119925 | + }else{ |
| 119926 | + testcase( sqlite3TableColumnToStorage(pTab, iField)!=iField ); |
| 119927 | + x = sqlite3TableColumnToStorage(pTab, iField) + regNewData + 1; |
| 119928 | + sqlite3VdbeAddOp2(v, OP_SCopy, x, regIdx+i); |
| 119929 | + VdbeComment((v, "%s", pTab->aCol[iField].zName)); |
| 119073 | 119930 | } |
| 119074 | 119931 | } |
| 119075 | 119932 | sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]); |
| 119076 | 119933 | VdbeComment((v, "for %s", pIdx->zName)); |
| 119077 | 119934 | #ifdef SQLITE_ENABLE_NULL_TRIM |
| | @@ -119134,12 +119991,13 @@ |
| 119134 | 119991 | } |
| 119135 | 119992 | #endif /* ifndef SQLITE_ENABLE_PREUPDATE_HOOK */ |
| 119136 | 119993 | |
| 119137 | 119994 | /* Check to see if the new index entry will be unique */ |
| 119138 | 119995 | sqlite3VdbeVerifyAbortable(v, onError); |
| 119139 | | - sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk, |
| 119140 | | - regIdx, pIdx->nKeyCol); VdbeCoverage(v); |
| 119996 | + addrConflictCk = |
| 119997 | + sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk, |
| 119998 | + regIdx, pIdx->nKeyCol); VdbeCoverage(v); |
| 119141 | 119999 | |
| 119142 | 120000 | /* Generate code to handle collisions */ |
| 119143 | 120001 | regR = (pIdx==pPk) ? regIdx : sqlite3GetTempRange(pParse, nPkField); |
| 119144 | 120002 | if( isUpdate || onError==OE_Replace ){ |
| 119145 | 120003 | if( HasRowid(pTab) ){ |
| | @@ -119156,11 +120014,11 @@ |
| 119156 | 120014 | /* Extract the PRIMARY KEY from the end of the index entry and |
| 119157 | 120015 | ** store it in registers regR..regR+nPk-1 */ |
| 119158 | 120016 | if( pIdx!=pPk ){ |
| 119159 | 120017 | for(i=0; i<pPk->nKeyCol; i++){ |
| 119160 | 120018 | assert( pPk->aiColumn[i]>=0 ); |
| 119161 | | - x = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[i]); |
| 120019 | + x = sqlite3TableColumnToIndex(pIdx, pPk->aiColumn[i]); |
| 119162 | 120020 | sqlite3VdbeAddOp3(v, OP_Column, iThisCur, x, regR+i); |
| 119163 | 120021 | VdbeComment((v, "%s.%s", pTab->zName, |
| 119164 | 120022 | pTab->aCol[pPk->aiColumn[i]].zName)); |
| 119165 | 120023 | } |
| 119166 | 120024 | } |
| | @@ -119182,10 +120040,11 @@ |
| 119182 | 120040 | assert( x>=0 ); |
| 119183 | 120041 | if( i==(pPk->nKeyCol-1) ){ |
| 119184 | 120042 | addrJump = addrUniqueOk; |
| 119185 | 120043 | op = OP_Eq; |
| 119186 | 120044 | } |
| 120045 | + x = sqlite3TableColumnToStorage(pTab, x); |
| 119187 | 120046 | sqlite3VdbeAddOp4(v, op, |
| 119188 | 120047 | regOldData+1+x, addrJump, regCmp+i, p4, P4_COLLSEQ |
| 119189 | 120048 | ); |
| 119190 | 120049 | sqlite3VdbeChangeP5(v, SQLITE_NOTNULL); |
| 119191 | 120050 | VdbeCoverageIf(v, op==OP_Eq); |
| | @@ -119218,21 +120077,69 @@ |
| 119218 | 120077 | testcase( onError==OE_Ignore ); |
| 119219 | 120078 | sqlite3VdbeGoto(v, ignoreDest); |
| 119220 | 120079 | break; |
| 119221 | 120080 | } |
| 119222 | 120081 | default: { |
| 119223 | | - Trigger *pTrigger = 0; |
| 120082 | + int nConflictCk; /* Number of opcodes in conflict check logic */ |
| 120083 | + |
| 119224 | 120084 | assert( onError==OE_Replace ); |
| 119225 | | - if( db->flags&SQLITE_RecTriggers ){ |
| 119226 | | - pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0); |
| 119227 | | - } |
| 119228 | | - if( pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0) ){ |
| 120085 | + nConflictCk = sqlite3VdbeCurrentAddr(v) - addrConflictCk; |
| 120086 | + assert( nConflictCk>0 ); |
| 120087 | + testcase( nConflictCk>1 ); |
| 120088 | + if( regTrigCnt ){ |
| 119229 | 120089 | sqlite3MultiWrite(pParse); |
| 120090 | + nReplaceTrig++; |
| 119230 | 120091 | } |
| 119231 | 120092 | sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur, |
| 119232 | 120093 | regR, nPkField, 0, OE_Replace, |
| 119233 | 120094 | (pIdx==pPk ? ONEPASS_SINGLE : ONEPASS_OFF), iThisCur); |
| 120095 | + if( regTrigCnt ){ |
| 120096 | + int addrBypass; /* Jump destination to bypass recheck logic */ |
| 120097 | + |
| 120098 | + sqlite3VdbeAddOp2(v, OP_AddImm, regTrigCnt, 1); /* incr trigger cnt */ |
| 120099 | + addrBypass = sqlite3VdbeAddOp0(v, OP_Goto); /* Bypass recheck */ |
| 120100 | + VdbeComment((v, "bypass recheck")); |
| 120101 | + |
| 120102 | + /* Here we insert code that will be invoked after all constraint |
| 120103 | + ** checks have run, if and only if one or more replace triggers |
| 120104 | + ** fired. */ |
| 120105 | + sqlite3VdbeResolveLabel(v, lblRecheckOk); |
| 120106 | + lblRecheckOk = sqlite3VdbeMakeLabel(pParse); |
| 120107 | + if( pIdx->pPartIdxWhere ){ |
| 120108 | + /* Bypass the recheck if this partial index is not defined |
| 120109 | + ** for the current row */ |
| 120110 | + sqlite3VdbeAddOp2(v, OP_IsNull, regIdx-1, lblRecheckOk); |
| 120111 | + VdbeCoverage(v); |
| 120112 | + } |
| 120113 | + /* Copy the constraint check code from above, except change |
| 120114 | + ** the constraint-ok jump destination to be the address of |
| 120115 | + ** the next retest block */ |
| 120116 | + while( nConflictCk>0 ){ |
| 120117 | + VdbeOp x; /* Conflict check opcode to copy */ |
| 120118 | + /* The sqlite3VdbeAddOp4() call might reallocate the opcode array. |
| 120119 | + ** Hence, make a complete copy of the opcode, rather than using |
| 120120 | + ** a pointer to the opcode. */ |
| 120121 | + x = *sqlite3VdbeGetOp(v, addrConflictCk); |
| 120122 | + if( x.opcode!=OP_IdxRowid ){ |
| 120123 | + int p2; /* New P2 value for copied conflict check opcode */ |
| 120124 | + if( sqlite3OpcodeProperty[x.opcode]&OPFLG_JUMP ){ |
| 120125 | + p2 = lblRecheckOk; |
| 120126 | + }else{ |
| 120127 | + p2 = x.p2; |
| 120128 | + } |
| 120129 | + sqlite3VdbeAddOp4(v, x.opcode, x.p1, p2, x.p3, x.p4.z, x.p4type); |
| 120130 | + sqlite3VdbeChangeP5(v, x.p5); |
| 120131 | + VdbeCoverageIf(v, p2!=x.p2); |
| 120132 | + } |
| 120133 | + nConflictCk--; |
| 120134 | + addrConflictCk++; |
| 120135 | + } |
| 120136 | + /* If the retest fails, issue an abort */ |
| 120137 | + sqlite3UniqueConstraint(pParse, OE_Abort, pIdx); |
| 120138 | + |
| 120139 | + sqlite3VdbeJumpHere(v, addrBypass); /* Terminate the recheck bypass */ |
| 120140 | + } |
| 119234 | 120141 | seenReplace = 1; |
| 119235 | 120142 | break; |
| 119236 | 120143 | } |
| 119237 | 120144 | } |
| 119238 | 120145 | if( pUpIdx==pIdx ){ |
| | @@ -119248,15 +120155,35 @@ |
| 119248 | 120155 | if( ipkTop ){ |
| 119249 | 120156 | sqlite3VdbeGoto(v, ipkTop); |
| 119250 | 120157 | VdbeComment((v, "Do IPK REPLACE")); |
| 119251 | 120158 | sqlite3VdbeJumpHere(v, ipkBottom); |
| 119252 | 120159 | } |
| 120160 | + |
| 120161 | + /* Recheck all uniqueness constraints after replace triggers have run */ |
| 120162 | + testcase( regTrigCnt!=0 && nReplaceTrig==0 ); |
| 120163 | + assert( regTrigCnt!=0 || nReplaceTrig==0 ); |
| 120164 | + if( nReplaceTrig ){ |
| 120165 | + sqlite3VdbeAddOp2(v, OP_IfNot, regTrigCnt, lblRecheckOk);VdbeCoverage(v); |
| 120166 | + if( !pPk ){ |
| 120167 | + if( isUpdate ){ |
| 120168 | + sqlite3VdbeAddOp3(v, OP_Eq, regNewData, addrRecheck, regOldData); |
| 120169 | + sqlite3VdbeChangeP5(v, SQLITE_NOTNULL); |
| 120170 | + VdbeCoverage(v); |
| 120171 | + } |
| 120172 | + sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRecheck, regNewData); |
| 120173 | + VdbeCoverage(v); |
| 120174 | + sqlite3RowidConstraint(pParse, OE_Abort, pTab); |
| 120175 | + }else{ |
| 120176 | + sqlite3VdbeGoto(v, addrRecheck); |
| 120177 | + } |
| 120178 | + sqlite3VdbeResolveLabel(v, lblRecheckOk); |
| 120179 | + } |
| 119253 | 120180 | |
| 119254 | 120181 | /* Generate the table record */ |
| 119255 | 120182 | if( HasRowid(pTab) ){ |
| 119256 | 120183 | int regRec = aRegIdx[ix]; |
| 119257 | | - sqlite3VdbeAddOp3(v, OP_MakeRecord, regNewData+1, pTab->nCol, regRec); |
| 120184 | + sqlite3VdbeAddOp3(v, OP_MakeRecord, regNewData+1, pTab->nNVCol, regRec); |
| 119258 | 120185 | sqlite3SetMakeRecordP5(v, pTab); |
| 119259 | 120186 | if( !bAffinityDone ){ |
| 119260 | 120187 | sqlite3TableAffinity(v, pTab, 0); |
| 119261 | 120188 | } |
| 119262 | 120189 | } |
| | @@ -119469,11 +120396,11 @@ |
| 119469 | 120396 | */ |
| 119470 | 120397 | static int xferCompatibleIndex(Index *pDest, Index *pSrc){ |
| 119471 | 120398 | int i; |
| 119472 | 120399 | assert( pDest && pSrc ); |
| 119473 | 120400 | assert( pDest->pTable!=pSrc->pTable ); |
| 119474 | | - if( pDest->nKeyCol!=pSrc->nKeyCol ){ |
| 120401 | + if( pDest->nKeyCol!=pSrc->nKeyCol || pDest->nColumn!=pSrc->nColumn ){ |
| 119475 | 120402 | return 0; /* Different number of columns */ |
| 119476 | 120403 | } |
| 119477 | 120404 | if( pDest->onError!=pSrc->onError ){ |
| 119478 | 120405 | return 0; /* Different conflict resolution strategies */ |
| 119479 | 120406 | } |
| | @@ -119646,10 +120573,43 @@ |
| 119646 | 120573 | if( (db->mDbFlags & DBFLAG_Vacuum)==0 |
| 119647 | 120574 | && (pDestCol->colFlags | pSrcCol->colFlags) & COLFLAG_HIDDEN |
| 119648 | 120575 | ){ |
| 119649 | 120576 | return 0; /* Neither table may have __hidden__ columns */ |
| 119650 | 120577 | } |
| 120578 | +#endif |
| 120579 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 120580 | + /* Even if tables t1 and t2 have identical schemas, if they contain |
| 120581 | + ** generated columns, then this statement is semantically incorrect: |
| 120582 | + ** |
| 120583 | + ** INSERT INTO t2 SELECT * FROM t1; |
| 120584 | + ** |
| 120585 | + ** The reason is that generated column values are returned by the |
| 120586 | + ** the SELECT statement on the right but the INSERT statement on the |
| 120587 | + ** left wants them to be omitted. |
| 120588 | + ** |
| 120589 | + ** Nevertheless, this is a useful notational shorthand to tell SQLite |
| 120590 | + ** to do a bulk transfer all of the content from t1 over to t2. |
| 120591 | + ** |
| 120592 | + ** We could, in theory, disable this (except for internal use by the |
| 120593 | + ** VACUUM command where it is actually needed). But why do that? It |
| 120594 | + ** seems harmless enough, and provides a useful service. |
| 120595 | + */ |
| 120596 | + if( (pDestCol->colFlags & COLFLAG_GENERATED) != |
| 120597 | + (pSrcCol->colFlags & COLFLAG_GENERATED) ){ |
| 120598 | + return 0; /* Both columns have the same generated-column type */ |
| 120599 | + } |
| 120600 | + /* But the transfer is only allowed if both the source and destination |
| 120601 | + ** tables have the exact same expressions for generated columns. |
| 120602 | + ** This requirement could be relaxed for VIRTUAL columns, I suppose. |
| 120603 | + */ |
| 120604 | + if( (pDestCol->colFlags & COLFLAG_GENERATED)!=0 ){ |
| 120605 | + if( sqlite3ExprCompare(0, pSrcCol->pDflt, pDestCol->pDflt, -1)!=0 ){ |
| 120606 | + testcase( pDestCol->colFlags & COLFLAG_VIRTUAL ); |
| 120607 | + testcase( pDestCol->colFlags & COLFLAG_STORED ); |
| 120608 | + return 0; /* Different generator expressions */ |
| 120609 | + } |
| 120610 | + } |
| 119651 | 120611 | #endif |
| 119652 | 120612 | if( pDestCol->affinity!=pSrcCol->affinity ){ |
| 119653 | 120613 | return 0; /* Affinity must be the same on all columns */ |
| 119654 | 120614 | } |
| 119655 | 120615 | if( sqlite3_stricmp(pDestCol->zColl, pSrcCol->zColl)!=0 ){ |
| | @@ -119657,11 +120617,11 @@ |
| 119657 | 120617 | } |
| 119658 | 120618 | if( pDestCol->notNull && !pSrcCol->notNull ){ |
| 119659 | 120619 | return 0; /* tab2 must be NOT NULL if tab1 is */ |
| 119660 | 120620 | } |
| 119661 | 120621 | /* Default values for second and subsequent columns need to match. */ |
| 119662 | | - if( i>0 ){ |
| 120622 | + if( (pDestCol->colFlags & COLFLAG_GENERATED)==0 && i>0 ){ |
| 119663 | 120623 | assert( pDestCol->pDflt==0 || pDestCol->pDflt->op==TK_SPAN ); |
| 119664 | 120624 | assert( pSrcCol->pDflt==0 || pSrcCol->pDflt->op==TK_SPAN ); |
| 119665 | 120625 | if( (pDestCol->pDflt==0)!=(pSrcCol->pDflt==0) |
| 119666 | 120626 | || (pDestCol->pDflt && strcmp(pDestCol->pDflt->u.zToken, |
| 119667 | 120627 | pSrcCol->pDflt->u.zToken)!=0) |
| | @@ -120342,10 +121302,11 @@ |
| 120342 | 121302 | /* Version 3.28.0 and later */ |
| 120343 | 121303 | int (*stmt_isexplain)(sqlite3_stmt*); |
| 120344 | 121304 | int (*value_frombind)(sqlite3_value*); |
| 120345 | 121305 | /* Version 3.30.0 and later */ |
| 120346 | 121306 | int (*drop_modules)(sqlite3*,const char**); |
| 121307 | + sqlite3_int64 (*hard_heap_limit64)(sqlite3_int64); |
| 120347 | 121308 | }; |
| 120348 | 121309 | |
| 120349 | 121310 | /* |
| 120350 | 121311 | ** This is the function signature used for all extension entry points. It |
| 120351 | 121312 | ** is also defined in the file "loadext.c". |
| | @@ -120636,10 +121597,11 @@ |
| 120636 | 121597 | /* Version 3.28.0 and later */ |
| 120637 | 121598 | #define sqlite3_stmt_isexplain sqlite3_api->isexplain |
| 120638 | 121599 | #define sqlite3_value_frombind sqlite3_api->frombind |
| 120639 | 121600 | /* Version 3.30.0 and later */ |
| 120640 | 121601 | #define sqlite3_drop_modules sqlite3_api->drop_modules |
| 121602 | +#define sqlite3_hard_heap_limit64 sqlite3_api->hard_heap_limit64 |
| 120641 | 121603 | #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ |
| 120642 | 121604 | |
| 120643 | 121605 | #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) |
| 120644 | 121606 | /* This case when the file really is being compiled as a loadable |
| 120645 | 121607 | ** extension */ |
| | @@ -121108,10 +122070,12 @@ |
| 121108 | 122070 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 121109 | 122071 | sqlite3_drop_modules, |
| 121110 | 122072 | #else |
| 121111 | 122073 | 0, |
| 121112 | 122074 | #endif |
| 122075 | + /* Version 3.31.0 and later */ |
| 122076 | + sqlite3_hard_heap_limit64, |
| 121113 | 122077 | }; |
| 121114 | 122078 | |
| 121115 | 122079 | /* |
| 121116 | 122080 | ** Attempt to load an SQLite extension library contained in the file |
| 121117 | 122081 | ** zFile. The entry point is zProc. zProc may be 0 in which case a |
| | @@ -121530,38 +122494,39 @@ |
| 121530 | 122494 | #define PragTyp_DEFAULT_CACHE_SIZE 11 |
| 121531 | 122495 | #define PragTyp_ENCODING 12 |
| 121532 | 122496 | #define PragTyp_FOREIGN_KEY_CHECK 13 |
| 121533 | 122497 | #define PragTyp_FOREIGN_KEY_LIST 14 |
| 121534 | 122498 | #define PragTyp_FUNCTION_LIST 15 |
| 121535 | | -#define PragTyp_INCREMENTAL_VACUUM 16 |
| 121536 | | -#define PragTyp_INDEX_INFO 17 |
| 121537 | | -#define PragTyp_INDEX_LIST 18 |
| 121538 | | -#define PragTyp_INTEGRITY_CHECK 19 |
| 121539 | | -#define PragTyp_JOURNAL_MODE 20 |
| 121540 | | -#define PragTyp_JOURNAL_SIZE_LIMIT 21 |
| 121541 | | -#define PragTyp_LOCK_PROXY_FILE 22 |
| 121542 | | -#define PragTyp_LOCKING_MODE 23 |
| 121543 | | -#define PragTyp_PAGE_COUNT 24 |
| 121544 | | -#define PragTyp_MMAP_SIZE 25 |
| 121545 | | -#define PragTyp_MODULE_LIST 26 |
| 121546 | | -#define PragTyp_OPTIMIZE 27 |
| 121547 | | -#define PragTyp_PAGE_SIZE 28 |
| 121548 | | -#define PragTyp_PRAGMA_LIST 29 |
| 121549 | | -#define PragTyp_SECURE_DELETE 30 |
| 121550 | | -#define PragTyp_SHRINK_MEMORY 31 |
| 121551 | | -#define PragTyp_SOFT_HEAP_LIMIT 32 |
| 121552 | | -#define PragTyp_SYNCHRONOUS 33 |
| 121553 | | -#define PragTyp_TABLE_INFO 34 |
| 121554 | | -#define PragTyp_TEMP_STORE 35 |
| 121555 | | -#define PragTyp_TEMP_STORE_DIRECTORY 36 |
| 121556 | | -#define PragTyp_THREADS 37 |
| 121557 | | -#define PragTyp_WAL_AUTOCHECKPOINT 38 |
| 121558 | | -#define PragTyp_WAL_CHECKPOINT 39 |
| 121559 | | -#define PragTyp_ACTIVATE_EXTENSIONS 40 |
| 121560 | | -#define PragTyp_KEY 41 |
| 121561 | | -#define PragTyp_LOCK_STATUS 42 |
| 121562 | | -#define PragTyp_STATS 43 |
| 122499 | +#define PragTyp_HARD_HEAP_LIMIT 16 |
| 122500 | +#define PragTyp_INCREMENTAL_VACUUM 17 |
| 122501 | +#define PragTyp_INDEX_INFO 18 |
| 122502 | +#define PragTyp_INDEX_LIST 19 |
| 122503 | +#define PragTyp_INTEGRITY_CHECK 20 |
| 122504 | +#define PragTyp_JOURNAL_MODE 21 |
| 122505 | +#define PragTyp_JOURNAL_SIZE_LIMIT 22 |
| 122506 | +#define PragTyp_LOCK_PROXY_FILE 23 |
| 122507 | +#define PragTyp_LOCKING_MODE 24 |
| 122508 | +#define PragTyp_PAGE_COUNT 25 |
| 122509 | +#define PragTyp_MMAP_SIZE 26 |
| 122510 | +#define PragTyp_MODULE_LIST 27 |
| 122511 | +#define PragTyp_OPTIMIZE 28 |
| 122512 | +#define PragTyp_PAGE_SIZE 29 |
| 122513 | +#define PragTyp_PRAGMA_LIST 30 |
| 122514 | +#define PragTyp_SECURE_DELETE 31 |
| 122515 | +#define PragTyp_SHRINK_MEMORY 32 |
| 122516 | +#define PragTyp_SOFT_HEAP_LIMIT 33 |
| 122517 | +#define PragTyp_SYNCHRONOUS 34 |
| 122518 | +#define PragTyp_TABLE_INFO 35 |
| 122519 | +#define PragTyp_TEMP_STORE 36 |
| 122520 | +#define PragTyp_TEMP_STORE_DIRECTORY 37 |
| 122521 | +#define PragTyp_THREADS 38 |
| 122522 | +#define PragTyp_WAL_AUTOCHECKPOINT 39 |
| 122523 | +#define PragTyp_WAL_CHECKPOINT 40 |
| 122524 | +#define PragTyp_ACTIVATE_EXTENSIONS 41 |
| 122525 | +#define PragTyp_KEY 42 |
| 122526 | +#define PragTyp_LOCK_STATUS 43 |
| 122527 | +#define PragTyp_STATS 44 |
| 121563 | 122528 | |
| 121564 | 122529 | /* Property flags associated with various pragma. */ |
| 121565 | 122530 | #define PragFlg_NeedSchema 0x01 /* Force schema load before running */ |
| 121566 | 122531 | #define PragFlg_NoColumns 0x02 /* OP_ResultRow called with zero columns */ |
| 121567 | 122532 | #define PragFlg_NoColumns1 0x04 /* zero columns if RHS argument is present */ |
| | @@ -121828,10 +122793,15 @@ |
| 121828 | 122793 | /* ePragFlg: */ PragFlg_Result0, |
| 121829 | 122794 | /* ColNames: */ 41, 2, |
| 121830 | 122795 | /* iArg: */ 0 }, |
| 121831 | 122796 | #endif |
| 121832 | 122797 | #endif |
| 122798 | + {/* zName: */ "hard_heap_limit", |
| 122799 | + /* ePragTyp: */ PragTyp_HARD_HEAP_LIMIT, |
| 122800 | + /* ePragFlg: */ PragFlg_Result0, |
| 122801 | + /* ColNames: */ 0, 0, |
| 122802 | + /* iArg: */ 0 }, |
| 121833 | 122803 | #if defined(SQLITE_HAS_CODEC) |
| 121834 | 122804 | {/* zName: */ "hexkey", |
| 121835 | 122805 | /* ePragTyp: */ PragTyp_KEY, |
| 121836 | 122806 | /* ePragFlg: */ 0, |
| 121837 | 122807 | /* ColNames: */ 0, 0, |
| | @@ -121905,15 +122875,10 @@ |
| 121905 | 122875 | {/* zName: */ "legacy_alter_table", |
| 121906 | 122876 | /* ePragTyp: */ PragTyp_FLAG, |
| 121907 | 122877 | /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, |
| 121908 | 122878 | /* ColNames: */ 0, 0, |
| 121909 | 122879 | /* iArg: */ SQLITE_LegacyAlter }, |
| 121910 | | - {/* zName: */ "legacy_file_format", |
| 121911 | | - /* ePragTyp: */ PragTyp_FLAG, |
| 121912 | | - /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, |
| 121913 | | - /* ColNames: */ 0, 0, |
| 121914 | | - /* iArg: */ SQLITE_LegacyFileFmt }, |
| 121915 | 122880 | #endif |
| 121916 | 122881 | #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_ENABLE_LOCKING_STYLE |
| 121917 | 122882 | {/* zName: */ "lock_proxy_file", |
| 121918 | 122883 | /* ePragTyp: */ PragTyp_LOCK_PROXY_FILE, |
| 121919 | 122884 | /* ePragFlg: */ PragFlg_NoColumns1, |
| | @@ -123252,29 +124217,38 @@ |
| 123252 | 124217 | Index *pPk = sqlite3PrimaryKeyIndex(pTab); |
| 123253 | 124218 | pParse->nMem = 7; |
| 123254 | 124219 | sqlite3CodeVerifySchema(pParse, iTabDb); |
| 123255 | 124220 | sqlite3ViewGetColumnNames(pParse, pTab); |
| 123256 | 124221 | for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){ |
| 123257 | | - int isHidden = IsHiddenColumn(pCol); |
| 123258 | | - if( isHidden && pPragma->iArg==0 ){ |
| 123259 | | - nHidden++; |
| 123260 | | - continue; |
| 124222 | + int isHidden = 0; |
| 124223 | + if( pCol->colFlags & COLFLAG_NOINSERT ){ |
| 124224 | + if( pPragma->iArg==0 ){ |
| 124225 | + nHidden++; |
| 124226 | + continue; |
| 124227 | + } |
| 124228 | + if( pCol->colFlags & COLFLAG_VIRTUAL ){ |
| 124229 | + isHidden = 2; /* GENERATED ALWAYS AS ... VIRTUAL */ |
| 124230 | + }else if( pCol->colFlags & COLFLAG_STORED ){ |
| 124231 | + isHidden = 3; /* GENERATED ALWAYS AS ... STORED */ |
| 124232 | + }else{ assert( pCol->colFlags & COLFLAG_HIDDEN ); |
| 124233 | + isHidden = 1; /* HIDDEN */ |
| 124234 | + } |
| 123261 | 124235 | } |
| 123262 | 124236 | if( (pCol->colFlags & COLFLAG_PRIMKEY)==0 ){ |
| 123263 | 124237 | k = 0; |
| 123264 | 124238 | }else if( pPk==0 ){ |
| 123265 | 124239 | k = 1; |
| 123266 | 124240 | }else{ |
| 123267 | 124241 | for(k=1; k<=pTab->nCol && pPk->aiColumn[k-1]!=i; k++){} |
| 123268 | 124242 | } |
| 123269 | | - assert( pCol->pDflt==0 || pCol->pDflt->op==TK_SPAN ); |
| 124243 | + assert( pCol->pDflt==0 || pCol->pDflt->op==TK_SPAN || isHidden>=2 ); |
| 123270 | 124244 | sqlite3VdbeMultiLoad(v, 1, pPragma->iArg ? "issisii" : "issisi", |
| 123271 | 124245 | i-nHidden, |
| 123272 | 124246 | pCol->zName, |
| 123273 | 124247 | sqlite3ColumnType(pCol,""), |
| 123274 | 124248 | pCol->notNull ? 1 : 0, |
| 123275 | | - pCol->pDflt ? pCol->pDflt->u.zToken : 0, |
| 124249 | + pCol->pDflt && isHidden<2 ? pCol->pDflt->u.zToken : 0, |
| 123276 | 124250 | k, |
| 123277 | 124251 | isHidden); |
| 123278 | 124252 | } |
| 123279 | 124253 | } |
| 123280 | 124254 | } |
| | @@ -123729,11 +124703,11 @@ |
| 123729 | 124703 | assert( sqlite3NoTempsInRange(pParse,1,7+j) ); |
| 123730 | 124704 | sqlite3VdbeAddOp2(v, OP_Rewind, iDataCur, 0); VdbeCoverage(v); |
| 123731 | 124705 | loopTop = sqlite3VdbeAddOp2(v, OP_AddImm, 7, 1); |
| 123732 | 124706 | if( !isQuick ){ |
| 123733 | 124707 | /* Sanity check on record header decoding */ |
| 123734 | | - sqlite3VdbeAddOp3(v, OP_Column, iDataCur, pTab->nCol-1, 3); |
| 124708 | + sqlite3VdbeAddOp3(v, OP_Column, iDataCur, pTab->nNVCol-1,3); |
| 123735 | 124709 | sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG); |
| 123736 | 124710 | } |
| 123737 | 124711 | /* Verify that all NOT NULL columns really are NOT NULL */ |
| 123738 | 124712 | for(j=0; j<pTab->nCol; j++){ |
| 123739 | 124713 | char *zErr; |
| | @@ -124231,10 +125205,31 @@ |
| 124231 | 125205 | sqlite3_soft_heap_limit64(N); |
| 124232 | 125206 | } |
| 124233 | 125207 | returnSingleInt(v, sqlite3_soft_heap_limit64(-1)); |
| 124234 | 125208 | break; |
| 124235 | 125209 | } |
| 125210 | + |
| 125211 | + /* |
| 125212 | + ** PRAGMA hard_heap_limit |
| 125213 | + ** PRAGMA hard_heap_limit = N |
| 125214 | + ** |
| 125215 | + ** Invoke sqlite3_hard_heap_limit64() to query or set the hard heap |
| 125216 | + ** limit. The hard heap limit can be activated or lowered by this |
| 125217 | + ** pragma, but not raised or deactivated. Only the |
| 125218 | + ** sqlite3_hard_heap_limit64() C-language API can raise or deactivate |
| 125219 | + ** the hard heap limit. This allows an application to set a heap limit |
| 125220 | + ** constraint that cannot be relaxed by an untrusted SQL script. |
| 125221 | + */ |
| 125222 | + case PragTyp_HARD_HEAP_LIMIT: { |
| 125223 | + sqlite3_int64 N; |
| 125224 | + if( zRight && sqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK ){ |
| 125225 | + sqlite3_int64 iPrior = sqlite3_hard_heap_limit64(-1); |
| 125226 | + if( N>0 && (iPrior==0 || iPrior>N) ) sqlite3_hard_heap_limit64(N); |
| 125227 | + } |
| 125228 | + returnSingleInt(v, sqlite3_hard_heap_limit64(-1)); |
| 125229 | + break; |
| 125230 | + } |
| 124236 | 125231 | |
| 124237 | 125232 | /* |
| 124238 | 125233 | ** PRAGMA threads |
| 124239 | 125234 | ** PRAGMA threads = N |
| 124240 | 125235 | ** |
| | @@ -124724,10 +125719,22 @@ |
| 124724 | 125719 | for(p=pIndex->pTable->pIndex; p; p=p->pNext){ |
| 124725 | 125720 | if( p->tnum==pIndex->tnum && p!=pIndex ) return 1; |
| 124726 | 125721 | } |
| 124727 | 125722 | return 0; |
| 124728 | 125723 | } |
| 125724 | + |
| 125725 | +/* forward declaration */ |
| 125726 | +static int sqlite3Prepare( |
| 125727 | + sqlite3 *db, /* Database handle. */ |
| 125728 | + const char *zSql, /* UTF-8 encoded SQL statement. */ |
| 125729 | + int nBytes, /* Length of zSql in bytes. */ |
| 125730 | + u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ |
| 125731 | + Vdbe *pReprepare, /* VM being reprepared */ |
| 125732 | + sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ |
| 125733 | + const char **pzTail /* OUT: End of parsed string */ |
| 125734 | +); |
| 125735 | + |
| 124729 | 125736 | |
| 124730 | 125737 | /* |
| 124731 | 125738 | ** This is the callback routine for the code that initializes the |
| 124732 | 125739 | ** database. See sqlite3Init() below for additional information. |
| 124733 | 125740 | ** This routine is also called from the OP_ParseSchema opcode of the VDBE. |
| | @@ -124774,11 +125781,12 @@ |
| 124774 | 125781 | assert( db->init.busy ); |
| 124775 | 125782 | db->init.iDb = iDb; |
| 124776 | 125783 | db->init.newTnum = sqlite3Atoi(argv[3]); |
| 124777 | 125784 | db->init.orphanTrigger = 0; |
| 124778 | 125785 | db->init.azInit = argv; |
| 124779 | | - TESTONLY(rcp = ) sqlite3_prepare(db, argv[4], -1, &pStmt, 0); |
| 125786 | + pStmt = 0; |
| 125787 | + TESTONLY(rcp = ) sqlite3Prepare(db, argv[4], -1, 0, 0, &pStmt, 0); |
| 124780 | 125788 | rc = db->errCode; |
| 124781 | 125789 | assert( (rc&0xFF)==(rcp&0xFF) ); |
| 124782 | 125790 | db->init.iDb = saved_iDb; |
| 124783 | 125791 | /* assert( saved_iDb==0 || (db->mDbFlags & DBFLAG_Vacuum)!=0 ); */ |
| 124784 | 125792 | if( SQLITE_OK!=rc ){ |
| | @@ -125195,10 +126203,11 @@ |
| 125195 | 126203 | sqlite3DbFree(db, pParse->aLabel); |
| 125196 | 126204 | sqlite3ExprListDelete(db, pParse->pConstExpr); |
| 125197 | 126205 | if( db ){ |
| 125198 | 126206 | assert( db->lookaside.bDisable >= pParse->disableLookaside ); |
| 125199 | 126207 | db->lookaside.bDisable -= pParse->disableLookaside; |
| 126208 | + db->lookaside.sz = db->lookaside.bDisable ? 0 : db->lookaside.szTrue; |
| 125200 | 126209 | } |
| 125201 | 126210 | pParse->disableLookaside = 0; |
| 125202 | 126211 | } |
| 125203 | 126212 | |
| 125204 | 126213 | /* |
| | @@ -125228,11 +126237,11 @@ |
| 125228 | 126237 | /* For a long-term use prepared statement avoid the use of |
| 125229 | 126238 | ** lookaside memory. |
| 125230 | 126239 | */ |
| 125231 | 126240 | if( prepFlags & SQLITE_PREPARE_PERSISTENT ){ |
| 125232 | 126241 | sParse.disableLookaside++; |
| 125233 | | - db->lookaside.bDisable++; |
| 126242 | + DisableLookaside; |
| 125234 | 126243 | } |
| 125235 | 126244 | sParse.disableVtab = (prepFlags & SQLITE_PREPARE_NO_VTAB)!=0; |
| 125236 | 126245 | |
| 125237 | 126246 | /* Check to verify that it is possible to get a read lock on all |
| 125238 | 126247 | ** database schemas. The inability to get a read lock indicates that |
| | @@ -125255,20 +126264,22 @@ |
| 125255 | 126264 | ** |
| 125256 | 126265 | ** Note that setting READ_UNCOMMITTED overrides most lock detection, |
| 125257 | 126266 | ** but it does *not* override schema lock detection, so this all still |
| 125258 | 126267 | ** works even if READ_UNCOMMITTED is set. |
| 125259 | 126268 | */ |
| 125260 | | - for(i=0; i<db->nDb; i++) { |
| 125261 | | - Btree *pBt = db->aDb[i].pBt; |
| 125262 | | - if( pBt ){ |
| 125263 | | - assert( sqlite3BtreeHoldsMutex(pBt) ); |
| 125264 | | - rc = sqlite3BtreeSchemaLocked(pBt); |
| 125265 | | - if( rc ){ |
| 125266 | | - const char *zDb = db->aDb[i].zDbSName; |
| 125267 | | - sqlite3ErrorWithMsg(db, rc, "database schema is locked: %s", zDb); |
| 125268 | | - testcase( db->flags & SQLITE_ReadUncommit ); |
| 125269 | | - goto end_prepare; |
| 126269 | + if( !db->noSharedCache ){ |
| 126270 | + for(i=0; i<db->nDb; i++) { |
| 126271 | + Btree *pBt = db->aDb[i].pBt; |
| 126272 | + if( pBt ){ |
| 126273 | + assert( sqlite3BtreeHoldsMutex(pBt) ); |
| 126274 | + rc = sqlite3BtreeSchemaLocked(pBt); |
| 126275 | + if( rc ){ |
| 126276 | + const char *zDb = db->aDb[i].zDbSName; |
| 126277 | + sqlite3ErrorWithMsg(db, rc, "database schema is locked: %s", zDb); |
| 126278 | + testcase( db->flags & SQLITE_ReadUncommit ); |
| 126279 | + goto end_prepare; |
| 126280 | + } |
| 125270 | 126281 | } |
| 125271 | 126282 | } |
| 125272 | 126283 | } |
| 125273 | 126284 | |
| 125274 | 126285 | sqlite3VtabUnlockList(db); |
| | @@ -125295,52 +126306,28 @@ |
| 125295 | 126306 | }else{ |
| 125296 | 126307 | sqlite3RunParser(&sParse, zSql, &zErrMsg); |
| 125297 | 126308 | } |
| 125298 | 126309 | assert( 0==sParse.nQueryLoop ); |
| 125299 | 126310 | |
| 125300 | | - if( sParse.rc==SQLITE_DONE ) sParse.rc = SQLITE_OK; |
| 126311 | + if( sParse.rc==SQLITE_DONE ){ |
| 126312 | + sParse.rc = SQLITE_OK; |
| 126313 | + } |
| 125301 | 126314 | if( sParse.checkSchema ){ |
| 125302 | 126315 | schemaIsValid(&sParse); |
| 125303 | 126316 | } |
| 125304 | | - if( db->mallocFailed ){ |
| 125305 | | - sParse.rc = SQLITE_NOMEM_BKPT; |
| 125306 | | - } |
| 125307 | 126317 | if( pzTail ){ |
| 125308 | 126318 | *pzTail = sParse.zTail; |
| 125309 | 126319 | } |
| 125310 | | - rc = sParse.rc; |
| 125311 | | - |
| 125312 | | -#ifndef SQLITE_OMIT_EXPLAIN |
| 125313 | | - /* Justification for the ALWAYS(): The only way for rc to be SQLITE_OK and |
| 125314 | | - ** sParse.pVdbe to be NULL is if the input SQL is an empty string, but in |
| 125315 | | - ** that case, sParse.explain will be false. */ |
| 125316 | | - if( sParse.explain && rc==SQLITE_OK && ALWAYS(sParse.pVdbe) ){ |
| 125317 | | - static const char * const azColName[] = { |
| 125318 | | - "addr", "opcode", "p1", "p2", "p3", "p4", "p5", "comment", |
| 125319 | | - "id", "parent", "notused", "detail" |
| 125320 | | - }; |
| 125321 | | - int iFirst, mx; |
| 125322 | | - if( sParse.explain==2 ){ |
| 125323 | | - sqlite3VdbeSetNumCols(sParse.pVdbe, 4); |
| 125324 | | - iFirst = 8; |
| 125325 | | - mx = 12; |
| 125326 | | - }else{ |
| 125327 | | - sqlite3VdbeSetNumCols(sParse.pVdbe, 8); |
| 125328 | | - iFirst = 0; |
| 125329 | | - mx = 8; |
| 125330 | | - } |
| 125331 | | - for(i=iFirst; i<mx; i++){ |
| 125332 | | - sqlite3VdbeSetColName(sParse.pVdbe, i-iFirst, COLNAME_NAME, |
| 125333 | | - azColName[i], SQLITE_STATIC); |
| 125334 | | - } |
| 125335 | | - } |
| 125336 | | -#endif |
| 125337 | 126320 | |
| 125338 | 126321 | if( db->init.busy==0 ){ |
| 125339 | 126322 | sqlite3VdbeSetSql(sParse.pVdbe, zSql, (int)(sParse.zTail-zSql), prepFlags); |
| 125340 | 126323 | } |
| 125341 | | - if( rc!=SQLITE_OK || db->mallocFailed ){ |
| 126324 | + if( db->mallocFailed ){ |
| 126325 | + sParse.rc = SQLITE_NOMEM_BKPT; |
| 126326 | + } |
| 126327 | + rc = sParse.rc; |
| 126328 | + if( rc!=SQLITE_OK ){ |
| 125342 | 126329 | if( sParse.pVdbe ) sqlite3VdbeFinalize(sParse.pVdbe); |
| 125343 | 126330 | assert(!(*ppStmt)); |
| 125344 | 126331 | }else{ |
| 125345 | 126332 | *ppStmt = (sqlite3_stmt*)sParse.pVdbe; |
| 125346 | 126333 | } |
| | @@ -125708,13 +126695,13 @@ |
| 125708 | 126695 | sqlite3ExprDelete(db, p->pLimit); |
| 125709 | 126696 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 125710 | 126697 | if( OK_IF_ALWAYS_TRUE(p->pWinDefn) ){ |
| 125711 | 126698 | sqlite3WindowListDelete(db, p->pWinDefn); |
| 125712 | 126699 | } |
| 125713 | | -#endif |
| 125714 | | - if( OK_IF_ALWAYS_TRUE(p->pWith) ) sqlite3WithDelete(db, p->pWith); |
| 125715 | 126700 | assert( p->pWin==0 ); |
| 126701 | +#endif |
| 126702 | + if( OK_IF_ALWAYS_TRUE(p->pWith) ) sqlite3WithDelete(db, p->pWith); |
| 125716 | 126703 | if( bFree ) sqlite3DbFreeNN(db, p); |
| 125717 | 126704 | p = pPrior; |
| 125718 | 126705 | bFree = 1; |
| 125719 | 126706 | } |
| 125720 | 126707 | } |
| | @@ -125993,28 +126980,28 @@ |
| 125993 | 126980 | ** NULL t2 row will be inserted whenever t1.x!=5. If we do not |
| 125994 | 126981 | ** defer the handling of t1.x=5, it will be processed immediately |
| 125995 | 126982 | ** after the t1 loop and rows with t1.x!=5 will never appear in |
| 125996 | 126983 | ** the output, which is incorrect. |
| 125997 | 126984 | */ |
| 125998 | | -static void setJoinExpr(Expr *p, int iTable){ |
| 126985 | +SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr *p, int iTable){ |
| 125999 | 126986 | while( p ){ |
| 126000 | 126987 | ExprSetProperty(p, EP_FromJoin); |
| 126001 | 126988 | assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) ); |
| 126002 | 126989 | ExprSetVVAProperty(p, EP_NoReduce); |
| 126003 | 126990 | p->iRightJoinTable = (i16)iTable; |
| 126004 | 126991 | if( p->op==TK_FUNCTION && p->x.pList ){ |
| 126005 | 126992 | int i; |
| 126006 | 126993 | for(i=0; i<p->x.pList->nExpr; i++){ |
| 126007 | | - setJoinExpr(p->x.pList->a[i].pExpr, iTable); |
| 126994 | + sqlite3SetJoinExpr(p->x.pList->a[i].pExpr, iTable); |
| 126008 | 126995 | } |
| 126009 | 126996 | } |
| 126010 | | - setJoinExpr(p->pLeft, iTable); |
| 126997 | + sqlite3SetJoinExpr(p->pLeft, iTable); |
| 126011 | 126998 | p = p->pRight; |
| 126012 | 126999 | } |
| 126013 | 127000 | } |
| 126014 | 127001 | |
| 126015 | | -/* Undo the work of setJoinExpr(). In the expression tree p, convert every |
| 127002 | +/* Undo the work of sqlite3SetJoinExpr(). In the expression p, convert every |
| 126016 | 127003 | ** term that is marked with EP_FromJoin and iRightJoinTable==iTable into |
| 126017 | 127004 | ** an ordinary term that omits the EP_FromJoin mark. |
| 126018 | 127005 | ** |
| 126019 | 127006 | ** This happens when a LEFT JOIN is simplified into an ordinary JOIN. |
| 126020 | 127007 | */ |
| | @@ -126097,11 +127084,11 @@ |
| 126097 | 127084 | |
| 126098 | 127085 | /* Add the ON clause to the end of the WHERE clause, connected by |
| 126099 | 127086 | ** an AND operator. |
| 126100 | 127087 | */ |
| 126101 | 127088 | if( pRight->pOn ){ |
| 126102 | | - if( isOuter ) setJoinExpr(pRight->pOn, pRight->iCursor); |
| 127089 | + if( isOuter ) sqlite3SetJoinExpr(pRight->pOn, pRight->iCursor); |
| 126103 | 127090 | p->pWhere = sqlite3ExprAnd(pParse, p->pWhere, pRight->pOn); |
| 126104 | 127091 | pRight->pOn = 0; |
| 126105 | 127092 | } |
| 126106 | 127093 | |
| 126107 | 127094 | /* Create extra terms on the WHERE clause for each column named |
| | @@ -126277,10 +127264,11 @@ |
| 126277 | 127264 | memset(pKI->aSortFlags, 0, pKI->nKeyField); /* Makes OP_Jump testable */ |
| 126278 | 127265 | sqlite3VdbeChangeP4(v, -1, (char*)pKI, P4_KEYINFO); |
| 126279 | 127266 | testcase( pKI->nAllField > pKI->nKeyField+2 ); |
| 126280 | 127267 | pOp->p4.pKeyInfo = sqlite3KeyInfoFromExprList(pParse,pSort->pOrderBy,nOBSat, |
| 126281 | 127268 | pKI->nAllField-pKI->nKeyField-1); |
| 127269 | + pOp = 0; /* Ensure pOp not used after sqltie3VdbeAddOp3() */ |
| 126282 | 127270 | addrJmp = sqlite3VdbeCurrentAddr(v); |
| 126283 | 127271 | sqlite3VdbeAddOp3(v, OP_Jump, addrJmp+1, 0, addrJmp+1); VdbeCoverage(v); |
| 126284 | 127272 | pSort->labelBkOut = sqlite3VdbeMakeLabel(pParse); |
| 126285 | 127273 | pSort->regReturn = ++pParse->nMem; |
| 126286 | 127274 | sqlite3VdbeAddOp2(v, OP_Gosub, pSort->regReturn, pSort->labelBkOut); |
| | @@ -126639,10 +127627,11 @@ |
| 126639 | 127627 | sqlite3VdbeChangeToNoop(v, pDistinct->addrTnct); |
| 126640 | 127628 | pOp = sqlite3VdbeGetOp(v, pDistinct->addrTnct); |
| 126641 | 127629 | pOp->opcode = OP_Null; |
| 126642 | 127630 | pOp->p1 = 1; |
| 126643 | 127631 | pOp->p2 = regPrev; |
| 127632 | + pOp = 0; /* Ensure pOp is not used after sqlite3VdbeAddOp() */ |
| 126644 | 127633 | |
| 126645 | 127634 | iJump = sqlite3VdbeCurrentAddr(v) + nResultCol; |
| 126646 | 127635 | for(i=0; i<nResultCol; i++){ |
| 126647 | 127636 | CollSeq *pColl = sqlite3ExprCollSeq(pParse, p->pEList->a[i].pExpr); |
| 126648 | 127637 | if( i<nResultCol-1 ){ |
| | @@ -129111,10 +130100,18 @@ |
| 129111 | 130100 | if( ExprHasProperty(pExpr, EP_xIsSelect) ){ |
| 129112 | 130101 | substSelect(pSubst, pExpr->x.pSelect, 1); |
| 129113 | 130102 | }else{ |
| 129114 | 130103 | substExprList(pSubst, pExpr->x.pList); |
| 129115 | 130104 | } |
| 130105 | +#ifndef SQLITE_OMIT_WINDOWFUNC |
| 130106 | + if( ExprHasProperty(pExpr, EP_WinFunc) ){ |
| 130107 | + Window *pWin = pExpr->y.pWin; |
| 130108 | + pWin->pFilter = substExpr(pSubst, pWin->pFilter); |
| 130109 | + substExprList(pSubst, pWin->pPartition); |
| 130110 | + substExprList(pSubst, pWin->pOrderBy); |
| 130111 | + } |
| 130112 | +#endif |
| 129116 | 130113 | } |
| 129117 | 130114 | return pExpr; |
| 129118 | 130115 | } |
| 129119 | 130116 | static void substExprList( |
| 129120 | 130117 | SubstContext *pSubst, /* Description of the substitution */ |
| | @@ -129653,11 +130650,11 @@ |
| 129653 | 130650 | pSub->pOrderBy = 0; |
| 129654 | 130651 | } |
| 129655 | 130652 | pWhere = pSub->pWhere; |
| 129656 | 130653 | pSub->pWhere = 0; |
| 129657 | 130654 | if( isLeftJoin>0 ){ |
| 129658 | | - setJoinExpr(pWhere, iNewParent); |
| 130655 | + sqlite3SetJoinExpr(pWhere, iNewParent); |
| 129659 | 130656 | } |
| 129660 | 130657 | pParent->pWhere = sqlite3ExprAnd(pParse, pWhere, pParent->pWhere); |
| 129661 | 130658 | if( db->mallocFailed==0 ){ |
| 129662 | 130659 | SubstContext x; |
| 129663 | 130660 | x.pParse = pParse; |
| | @@ -129770,18 +130767,18 @@ |
| 129770 | 130767 | assert( pRight!=0 ); |
| 129771 | 130768 | assert( pLeft!=0 ); |
| 129772 | 130769 | if( pRight->op==TK_COLUMN |
| 129773 | 130770 | && !ExprHasProperty(pRight, EP_FixedCol) |
| 129774 | 130771 | && sqlite3ExprIsConstant(pLeft) |
| 129775 | | - && sqlite3IsBinary(sqlite3BinaryCompareCollSeq(pConst->pParse,pLeft,pRight)) |
| 130772 | + && sqlite3IsBinary(sqlite3ExprCompareCollSeq(pConst->pParse,pExpr)) |
| 129776 | 130773 | ){ |
| 129777 | 130774 | constInsert(pConst, pRight, pLeft); |
| 129778 | 130775 | }else |
| 129779 | 130776 | if( pLeft->op==TK_COLUMN |
| 129780 | 130777 | && !ExprHasProperty(pLeft, EP_FixedCol) |
| 129781 | 130778 | && sqlite3ExprIsConstant(pRight) |
| 129782 | | - && sqlite3IsBinary(sqlite3BinaryCompareCollSeq(pConst->pParse,pLeft,pRight)) |
| 130779 | + && sqlite3IsBinary(sqlite3ExprCompareCollSeq(pConst->pParse,pExpr)) |
| 129783 | 130780 | ){ |
| 129784 | 130781 | constInsert(pConst, pLeft, pRight); |
| 129785 | 130782 | } |
| 129786 | 130783 | } |
| 129787 | 130784 | |
| | @@ -130266,10 +131263,13 @@ |
| 130266 | 131263 | sqlite3 *db = pParse->db; |
| 130267 | 131264 | struct Cte *pCte; /* Matched CTE (or NULL if no match) */ |
| 130268 | 131265 | With *pWith; /* WITH clause that pCte belongs to */ |
| 130269 | 131266 | |
| 130270 | 131267 | assert( pFrom->pTab==0 ); |
| 131268 | + if( pParse->nErr ){ |
| 131269 | + return SQLITE_ERROR; |
| 131270 | + } |
| 130271 | 131271 | |
| 130272 | 131272 | pCte = searchWith(pParse->pWith, pFrom, &pWith); |
| 130273 | 131273 | if( pCte ){ |
| 130274 | 131274 | Table *pTab; |
| 130275 | 131275 | ExprList *pEList; |
| | @@ -131327,11 +132327,11 @@ |
| 131327 | 132327 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 131328 | 132328 | if( sqlite3WindowRewrite(pParse, p) ){ |
| 131329 | 132329 | goto select_end; |
| 131330 | 132330 | } |
| 131331 | 132331 | #if SELECTTRACE_ENABLED |
| 131332 | | - if( sqlite3SelectTrace & 0x108 ){ |
| 132332 | + if( p->pWin && (sqlite3SelectTrace & 0x108)!=0 ){ |
| 131333 | 132333 | SELECTTRACE(0x104,pParse,p, ("after window rewrite:\n")); |
| 131334 | 132334 | sqlite3TreeViewSelect(0, p, 0); |
| 131335 | 132335 | } |
| 131336 | 132336 | #endif |
| 131337 | 132337 | #endif /* SQLITE_OMIT_WINDOWFUNC */ |
| | @@ -133864,11 +134864,11 @@ |
| 133864 | 134864 | int onError, /* How to handle constraint errors */ |
| 133865 | 134865 | ExprList *pOrderBy, /* ORDER BY clause. May be null */ |
| 133866 | 134866 | Expr *pLimit, /* LIMIT clause. May be null */ |
| 133867 | 134867 | Upsert *pUpsert /* ON CONFLICT clause, or null */ |
| 133868 | 134868 | ){ |
| 133869 | | - int i, j; /* Loop counters */ |
| 134869 | + int i, j, k; /* Loop counters */ |
| 133870 | 134870 | Table *pTab; /* The table to be updated */ |
| 133871 | 134871 | int addrTop = 0; /* VDBE instruction address of the start of the loop */ |
| 133872 | 134872 | WhereInfo *pWInfo; /* Information about the WHERE clause */ |
| 133873 | 134873 | Vdbe *v; /* The virtual database engine */ |
| 133874 | 134874 | Index *pIdx; /* For looping over indices */ |
| | @@ -134006,10 +135006,14 @@ |
| 134006 | 135006 | sNC.pParse = pParse; |
| 134007 | 135007 | sNC.pSrcList = pTabList; |
| 134008 | 135008 | sNC.uNC.pUpsert = pUpsert; |
| 134009 | 135009 | sNC.ncFlags = NC_UUpsert; |
| 134010 | 135010 | |
| 135011 | + /* Begin generating code. */ |
| 135012 | + v = sqlite3GetVdbe(pParse); |
| 135013 | + if( v==0 ) goto update_cleanup; |
| 135014 | + |
| 134011 | 135015 | /* Resolve the column names in all the expressions of the |
| 134012 | 135016 | ** of the UPDATE statement. Also find the column index |
| 134013 | 135017 | ** for each column to be updated in the pChanges array. For each |
| 134014 | 135018 | ** column to be updated, make sure we have authorization to change |
| 134015 | 135019 | ** that column. |
| | @@ -134025,10 +135029,20 @@ |
| 134025 | 135029 | chngRowid = 1; |
| 134026 | 135030 | pRowidExpr = pChanges->a[i].pExpr; |
| 134027 | 135031 | }else if( pPk && (pTab->aCol[j].colFlags & COLFLAG_PRIMKEY)!=0 ){ |
| 134028 | 135032 | chngPk = 1; |
| 134029 | 135033 | } |
| 135034 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 135035 | + else if( pTab->aCol[j].colFlags & COLFLAG_GENERATED ){ |
| 135036 | + testcase( pTab->aCol[j].colFlags & COLFLAG_VIRTUAL ); |
| 135037 | + testcase( pTab->aCol[j].colFlags & COLFLAG_STORED ); |
| 135038 | + sqlite3ErrorMsg(pParse, |
| 135039 | + "cannot UPDATE generated column \"%s\"", |
| 135040 | + pTab->aCol[j].zName); |
| 135041 | + goto update_cleanup; |
| 135042 | + } |
| 135043 | +#endif |
| 134030 | 135044 | aXRef[j] = i; |
| 134031 | 135045 | break; |
| 134032 | 135046 | } |
| 134033 | 135047 | } |
| 134034 | 135048 | if( j>=pTab->nCol ){ |
| | @@ -134058,10 +135072,37 @@ |
| 134058 | 135072 | } |
| 134059 | 135073 | assert( (chngRowid & chngPk)==0 ); |
| 134060 | 135074 | assert( chngRowid==0 || chngRowid==1 ); |
| 134061 | 135075 | assert( chngPk==0 || chngPk==1 ); |
| 134062 | 135076 | chngKey = chngRowid + chngPk; |
| 135077 | + |
| 135078 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 135079 | + /* Mark generated columns as changing if their generator expressions |
| 135080 | + ** reference any changing column. The actual aXRef[] value for |
| 135081 | + ** generated expressions is not used, other than to check to see that it |
| 135082 | + ** is non-negative, so the value of aXRef[] for generated columns can be |
| 135083 | + ** set to any non-negative number. We use 99999 so that the value is |
| 135084 | + ** obvious when looking at aXRef[] in a symbolic debugger. |
| 135085 | + */ |
| 135086 | + if( pTab->tabFlags & TF_HasGenerated ){ |
| 135087 | + int bProgress; |
| 135088 | + testcase( pTab->tabFlags & TF_HasVirtual ); |
| 135089 | + testcase( pTab->tabFlags & TF_HasStored ); |
| 135090 | + do{ |
| 135091 | + bProgress = 0; |
| 135092 | + for(i=0; i<pTab->nCol; i++){ |
| 135093 | + if( aXRef[i]>=0 ) continue; |
| 135094 | + if( (pTab->aCol[i].colFlags & COLFLAG_GENERATED)==0 ) continue; |
| 135095 | + if( sqlite3ExprReferencesUpdatedColumn(pTab->aCol[i].pDflt, |
| 135096 | + aXRef, chngRowid) ){ |
| 135097 | + aXRef[i] = 99999; |
| 135098 | + bProgress = 1; |
| 135099 | + } |
| 135100 | + } |
| 135101 | + }while( bProgress ); |
| 135102 | + } |
| 135103 | +#endif |
| 134063 | 135104 | |
| 134064 | 135105 | /* The SET expressions are not actually used inside the WHERE loop. |
| 134065 | 135106 | ** So reset the colUsed mask. Unless this is a virtual table. In that |
| 134066 | 135107 | ** case, set all bits of the colUsed mask (to ensure that the virtual |
| 134067 | 135108 | ** table implementation makes all columns available). |
| | @@ -134103,13 +135144,10 @@ |
| 134103 | 135144 | /* If REPLACE conflict resolution might be invoked, open cursors on all |
| 134104 | 135145 | ** indexes in case they are needed to delete records. */ |
| 134105 | 135146 | memset(aToOpen, 1, nIdx+1); |
| 134106 | 135147 | } |
| 134107 | 135148 | |
| 134108 | | - /* Begin generating code. */ |
| 134109 | | - v = sqlite3GetVdbe(pParse); |
| 134110 | | - if( v==0 ) goto update_cleanup; |
| 134111 | 135149 | if( pParse->nested==0 ) sqlite3VdbeCountChanges(v); |
| 134112 | 135150 | sqlite3BeginWriteOperation(pParse, pTrigger || hasFK, iDb); |
| 134113 | 135151 | |
| 134114 | 135152 | /* Allocate required registers. */ |
| 134115 | 135153 | if( !IsVirtual(pTab) ){ |
| | @@ -134259,11 +135297,12 @@ |
| 134259 | 135297 | ** the ephemeral table. Or, in ONEPASS_SINGLE or MULTI mode, change |
| 134260 | 135298 | ** the OP_OpenEphemeral instruction to a Noop (the ephemeral table |
| 134261 | 135299 | ** is not required) and leave the PK fields in the array of registers. */ |
| 134262 | 135300 | for(i=0; i<nPk; i++){ |
| 134263 | 135301 | assert( pPk->aiColumn[i]>=0 ); |
| 134264 | | - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur,pPk->aiColumn[i],iPk+i); |
| 135302 | + sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, |
| 135303 | + pPk->aiColumn[i], iPk+i); |
| 134265 | 135304 | } |
| 134266 | 135305 | if( eOnePass ){ |
| 134267 | 135306 | if( addrOpen ) sqlite3VdbeChangeToNoop(v, addrOpen); |
| 134268 | 135307 | nKey = nPk; |
| 134269 | 135308 | regKey = iPk; |
| | @@ -134340,18 +135379,20 @@ |
| 134340 | 135379 | u32 oldmask = (hasFK ? sqlite3FkOldmask(pParse, pTab) : 0); |
| 134341 | 135380 | oldmask |= sqlite3TriggerColmask(pParse, |
| 134342 | 135381 | pTrigger, pChanges, 0, TRIGGER_BEFORE|TRIGGER_AFTER, pTab, onError |
| 134343 | 135382 | ); |
| 134344 | 135383 | for(i=0; i<pTab->nCol; i++){ |
| 135384 | + u32 colFlags = pTab->aCol[i].colFlags; |
| 135385 | + k = sqlite3TableColumnToStorage(pTab, i) + regOld; |
| 134345 | 135386 | if( oldmask==0xffffffff |
| 134346 | 135387 | || (i<32 && (oldmask & MASKBIT32(i))!=0) |
| 134347 | | - || (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0 |
| 135388 | + || (colFlags & COLFLAG_PRIMKEY)!=0 |
| 134348 | 135389 | ){ |
| 134349 | 135390 | testcase( oldmask!=0xffffffff && i==31 ); |
| 134350 | | - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regOld+i); |
| 135391 | + sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, k); |
| 134351 | 135392 | }else{ |
| 134352 | | - sqlite3VdbeAddOp2(v, OP_Null, 0, regOld+i); |
| 135393 | + sqlite3VdbeAddOp2(v, OP_Null, 0, k); |
| 134353 | 135394 | } |
| 134354 | 135395 | } |
| 134355 | 135396 | if( chngRowid==0 && pPk==0 ){ |
| 134356 | 135397 | sqlite3VdbeAddOp2(v, OP_Copy, regOldRowid, regNewRowid); |
| 134357 | 135398 | } |
| | @@ -134371,31 +135412,40 @@ |
| 134371 | 135412 | ** be used eliminates some redundant opcodes. |
| 134372 | 135413 | */ |
| 134373 | 135414 | newmask = sqlite3TriggerColmask( |
| 134374 | 135415 | pParse, pTrigger, pChanges, 1, TRIGGER_BEFORE, pTab, onError |
| 134375 | 135416 | ); |
| 134376 | | - for(i=0; i<pTab->nCol; i++){ |
| 135417 | + for(i=0, k=regNew; i<pTab->nCol; i++, k++){ |
| 134377 | 135418 | if( i==pTab->iPKey ){ |
| 134378 | | - sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i); |
| 135419 | + sqlite3VdbeAddOp2(v, OP_Null, 0, k); |
| 135420 | + }else if( (pTab->aCol[i].colFlags & COLFLAG_GENERATED)!=0 ){ |
| 135421 | + if( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL ) k--; |
| 134379 | 135422 | }else{ |
| 134380 | 135423 | j = aXRef[i]; |
| 134381 | 135424 | if( j>=0 ){ |
| 134382 | | - sqlite3ExprCode(pParse, pChanges->a[j].pExpr, regNew+i); |
| 135425 | + sqlite3ExprCode(pParse, pChanges->a[j].pExpr, k); |
| 134383 | 135426 | }else if( 0==(tmask&TRIGGER_BEFORE) || i>31 || (newmask & MASKBIT32(i)) ){ |
| 134384 | 135427 | /* This branch loads the value of a column that will not be changed |
| 134385 | 135428 | ** into a register. This is done if there are no BEFORE triggers, or |
| 134386 | 135429 | ** if there are one or more BEFORE triggers that use this value via |
| 134387 | 135430 | ** a new.* reference in a trigger program. |
| 134388 | 135431 | */ |
| 134389 | 135432 | testcase( i==31 ); |
| 134390 | 135433 | testcase( i==32 ); |
| 134391 | | - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i); |
| 135434 | + sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, k); |
| 134392 | 135435 | }else{ |
| 134393 | | - sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i); |
| 135436 | + sqlite3VdbeAddOp2(v, OP_Null, 0, k); |
| 134394 | 135437 | } |
| 134395 | 135438 | } |
| 134396 | 135439 | } |
| 135440 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 135441 | + if( pTab->tabFlags & TF_HasGenerated ){ |
| 135442 | + testcase( pTab->tabFlags & TF_HasVirtual ); |
| 135443 | + testcase( pTab->tabFlags & TF_HasStored ); |
| 135444 | + sqlite3ComputeGeneratedColumns(pParse, regNew, pTab); |
| 135445 | + } |
| 135446 | +#endif |
| 134397 | 135447 | |
| 134398 | 135448 | /* Fire any BEFORE UPDATE triggers. This happens before constraints are |
| 134399 | 135449 | ** verified. One could argue that this is wrong. |
| 134400 | 135450 | */ |
| 134401 | 135451 | if( tmask&TRIGGER_BEFORE ){ |
| | @@ -134424,15 +135474,24 @@ |
| 134424 | 135474 | ** in case this has happened. Only unmodified columns are reloaded. |
| 134425 | 135475 | ** The values computed for modified columns use the values before the |
| 134426 | 135476 | ** BEFORE trigger runs. See test case trigger1-18.0 (added 2018-04-26) |
| 134427 | 135477 | ** for an example. |
| 134428 | 135478 | */ |
| 134429 | | - for(i=0; i<pTab->nCol; i++){ |
| 134430 | | - if( aXRef[i]<0 && i!=pTab->iPKey ){ |
| 134431 | | - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i); |
| 135479 | + for(i=0, k=regNew; i<pTab->nCol; i++, k++){ |
| 135480 | + if( pTab->aCol[i].colFlags & COLFLAG_GENERATED ){ |
| 135481 | + if( pTab->aCol[i].colFlags & COLFLAG_VIRTUAL ) k--; |
| 135482 | + }else if( aXRef[i]<0 && i!=pTab->iPKey ){ |
| 135483 | + sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, k); |
| 134432 | 135484 | } |
| 134433 | 135485 | } |
| 135486 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 135487 | + if( pTab->tabFlags & TF_HasGenerated ){ |
| 135488 | + testcase( pTab->tabFlags & TF_HasVirtual ); |
| 135489 | + testcase( pTab->tabFlags & TF_HasStored ); |
| 135490 | + sqlite3ComputeGeneratedColumns(pParse, regNew, pTab); |
| 135491 | + } |
| 135492 | +#endif |
| 134434 | 135493 | } |
| 134435 | 135494 | |
| 134436 | 135495 | if( !isView ){ |
| 134437 | 135496 | /* Do constraint checks. */ |
| 134438 | 135497 | assert( regOldRowid>0 ); |
| | @@ -134634,10 +135693,11 @@ |
| 134634 | 135693 | pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0,0,WHERE_ONEPASS_DESIRED,0); |
| 134635 | 135694 | if( pWInfo==0 ) return; |
| 134636 | 135695 | |
| 134637 | 135696 | /* Populate the argument registers. */ |
| 134638 | 135697 | for(i=0; i<pTab->nCol; i++){ |
| 135698 | + assert( (pTab->aCol[i].colFlags & COLFLAG_GENERATED)==0 ); |
| 134639 | 135699 | if( aXRef[i]>=0 ){ |
| 134640 | 135700 | sqlite3ExprCode(pParse, pChanges->a[aXRef[i]].pExpr, regArg+2+i); |
| 134641 | 135701 | }else{ |
| 134642 | 135702 | sqlite3VdbeAddOp3(v, OP_VColumn, iCsr, i, regArg+2+i); |
| 134643 | 135703 | sqlite3VdbeChangeP5(v, OPFLAG_NOCHNG);/* Enable sqlite3_vtab_nochange() */ |
| | @@ -134944,11 +136004,11 @@ |
| 134944 | 136004 | int iPk = pParse->nMem+1; |
| 134945 | 136005 | pParse->nMem += nPk; |
| 134946 | 136006 | for(i=0; i<nPk; i++){ |
| 134947 | 136007 | int k; |
| 134948 | 136008 | assert( pPk->aiColumn[i]>=0 ); |
| 134949 | | - k = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[i]); |
| 136009 | + k = sqlite3TableColumnToIndex(pIdx, pPk->aiColumn[i]); |
| 134950 | 136010 | sqlite3VdbeAddOp3(v, OP_Column, iCur, k, iPk+i); |
| 134951 | 136011 | VdbeComment((v, "%s.%s", pIdx->zName, |
| 134952 | 136012 | pTab->aCol[pPk->aiColumn[i]].zName)); |
| 134953 | 136013 | } |
| 134954 | 136014 | sqlite3VdbeVerifyAbortable(v, OE_Abort); |
| | @@ -135702,16 +136762,16 @@ |
| 135702 | 136762 | ** As a result, a sqlite3.pDisconnect cannot be accessed simultaneously |
| 135703 | 136763 | ** by multiple threads. It is thread-safe. |
| 135704 | 136764 | */ |
| 135705 | 136765 | SQLITE_PRIVATE void sqlite3VtabUnlockList(sqlite3 *db){ |
| 135706 | 136766 | VTable *p = db->pDisconnect; |
| 135707 | | - db->pDisconnect = 0; |
| 135708 | 136767 | |
| 135709 | 136768 | assert( sqlite3BtreeHoldsAllMutexes(db) ); |
| 135710 | 136769 | assert( sqlite3_mutex_held(db->mutex) ); |
| 135711 | 136770 | |
| 135712 | 136771 | if( p ){ |
| 136772 | + db->pDisconnect = 0; |
| 135713 | 136773 | sqlite3ExpirePreparedStatements(db, 0); |
| 135714 | 136774 | do { |
| 135715 | 136775 | VTable *pNext = p->pNext; |
| 135716 | 136776 | sqlite3VtabUnlock(p); |
| 135717 | 136777 | p = pNext; |
| | @@ -136021,11 +137081,11 @@ |
| 136021 | 137081 | *pzErr = sqlite3MPrintf(db, zFormat, pTab->zName); |
| 136022 | 137082 | sqlite3VtabUnlock(pVTable); |
| 136023 | 137083 | rc = SQLITE_ERROR; |
| 136024 | 137084 | }else{ |
| 136025 | 137085 | int iCol; |
| 136026 | | - u8 oooHidden = 0; |
| 137086 | + u16 oooHidden = 0; |
| 136027 | 137087 | /* If everything went according to plan, link the new VTable structure |
| 136028 | 137088 | ** into the linked list headed by pTab->pVTable. Then loop through the |
| 136029 | 137089 | ** columns of the table to see if any of them contain the token "hidden". |
| 136030 | 137090 | ** If so, set the Column COLFLAG_HIDDEN flag and remove the token from |
| 136031 | 137091 | ** the type string. */ |
| | @@ -137017,11 +138077,10 @@ |
| 137017 | 138077 | #define TERM_LIKEOPT 0x100 /* Virtual terms from the LIKE optimization */ |
| 137018 | 138078 | #define TERM_LIKECOND 0x200 /* Conditionally this LIKE operator term */ |
| 137019 | 138079 | #define TERM_LIKE 0x400 /* The original LIKE operator */ |
| 137020 | 138080 | #define TERM_IS 0x800 /* Term.pExpr is an IS operator */ |
| 137021 | 138081 | #define TERM_VARSELECT 0x1000 /* Term.pExpr contains a correlated sub-query */ |
| 137022 | | -#define TERM_NOPARTIDX 0x2000 /* Not for use to enable a partial index */ |
| 137023 | 138082 | |
| 137024 | 138083 | /* |
| 137025 | 138084 | ** An instance of the WhereScan object is used as an iterator for locating |
| 137026 | 138085 | ** terms in the WHERE clause that are useful to the query planner. |
| 137027 | 138086 | */ |
| | @@ -138125,11 +139184,11 @@ |
| 138125 | 139184 | static int codeCursorHintCheckExpr(Walker *pWalker, Expr *pExpr){ |
| 138126 | 139185 | struct CCurHint *pHint = pWalker->u.pCCurHint; |
| 138127 | 139186 | assert( pHint->pIdx!=0 ); |
| 138128 | 139187 | if( pExpr->op==TK_COLUMN |
| 138129 | 139188 | && pExpr->iTable==pHint->iTabCur |
| 138130 | | - && sqlite3ColumnOfIndex(pHint->pIdx, pExpr->iColumn)<0 |
| 139189 | + && sqlite3TableColumnToIndex(pHint->pIdx, pExpr->iColumn)<0 |
| 138131 | 139190 | ){ |
| 138132 | 139191 | pWalker->eCode = 1; |
| 138133 | 139192 | } |
| 138134 | 139193 | return WRC_Continue; |
| 138135 | 139194 | } |
| | @@ -138193,11 +139252,11 @@ |
| 138193 | 139252 | sqlite3ExprCode(pWalker->pParse, pExpr, reg); |
| 138194 | 139253 | pExpr->op = TK_REGISTER; |
| 138195 | 139254 | pExpr->iTable = reg; |
| 138196 | 139255 | }else if( pHint->pIdx!=0 ){ |
| 138197 | 139256 | pExpr->iTable = pHint->iIdxCur; |
| 138198 | | - pExpr->iColumn = sqlite3ColumnOfIndex(pHint->pIdx, pExpr->iColumn); |
| 139257 | + pExpr->iColumn = sqlite3TableColumnToIndex(pHint->pIdx, pExpr->iColumn); |
| 138199 | 139258 | assert( pExpr->iColumn>=0 ); |
| 138200 | 139259 | } |
| 138201 | 139260 | }else if( pExpr->op==TK_AGG_FUNCTION ){ |
| 138202 | 139261 | /* An aggregate function in the WHERE clause of a query means this must |
| 138203 | 139262 | ** be a correlated sub-query, and expression pExpr is an aggregate from |
| | @@ -138356,12 +139415,16 @@ |
| 138356 | 139415 | Table *pTab = pIdx->pTable; |
| 138357 | 139416 | int *ai = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*(pTab->nCol+1)); |
| 138358 | 139417 | if( ai ){ |
| 138359 | 139418 | ai[0] = pTab->nCol; |
| 138360 | 139419 | for(i=0; i<pIdx->nColumn-1; i++){ |
| 139420 | + int x1, x2; |
| 138361 | 139421 | assert( pIdx->aiColumn[i]<pTab->nCol ); |
| 138362 | | - if( pIdx->aiColumn[i]>=0 ) ai[pIdx->aiColumn[i]+1] = i+1; |
| 139422 | + x1 = pIdx->aiColumn[i]; |
| 139423 | + x2 = sqlite3TableColumnToStorage(pTab, x1); |
| 139424 | + testcase( x1!=x2 ); |
| 139425 | + if( x1>=0 ) ai[x2+1] = i+1; |
| 138363 | 139426 | } |
| 138364 | 139427 | sqlite3VdbeChangeP4(v, -1, (char*)ai, P4_INTARRAY); |
| 138365 | 139428 | } |
| 138366 | 139429 | } |
| 138367 | 139430 | } |
| | @@ -138408,10 +139471,11 @@ |
| 138408 | 139471 | typedef struct IdxExprTrans { |
| 138409 | 139472 | Expr *pIdxExpr; /* The index expression */ |
| 138410 | 139473 | int iTabCur; /* The cursor of the corresponding table */ |
| 138411 | 139474 | int iIdxCur; /* The cursor for the index */ |
| 138412 | 139475 | int iIdxCol; /* The column for the index */ |
| 139476 | + int iTabCol; /* The column for the table */ |
| 138413 | 139477 | } IdxExprTrans; |
| 138414 | 139478 | |
| 138415 | 139479 | /* The walker node callback used to transform matching expressions into |
| 138416 | 139480 | ** a reference to an index column for an index on an expression. |
| 138417 | 139481 | ** |
| | @@ -138430,37 +139494,73 @@ |
| 138430 | 139494 | }else{ |
| 138431 | 139495 | return WRC_Continue; |
| 138432 | 139496 | } |
| 138433 | 139497 | } |
| 138434 | 139498 | |
| 139499 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 139500 | +/* A walker node callback that translates a column reference to a table |
| 139501 | +** into a corresponding column reference of an index. |
| 139502 | +*/ |
| 139503 | +static int whereIndexExprTransColumn(Walker *p, Expr *pExpr){ |
| 139504 | + if( pExpr->op==TK_COLUMN ){ |
| 139505 | + IdxExprTrans *pX = p->u.pIdxTrans; |
| 139506 | + if( pExpr->iTable==pX->iTabCur && pExpr->iColumn==pX->iTabCol ){ |
| 139507 | + pExpr->iTable = pX->iIdxCur; |
| 139508 | + pExpr->iColumn = pX->iIdxCol; |
| 139509 | + pExpr->y.pTab = 0; |
| 139510 | + } |
| 139511 | + } |
| 139512 | + return WRC_Continue; |
| 139513 | +} |
| 139514 | +#endif /* SQLITE_OMIT_GENERATED_COLUMNS */ |
| 139515 | + |
| 138435 | 139516 | /* |
| 138436 | 139517 | ** For an indexes on expression X, locate every instance of expression X |
| 138437 | 139518 | ** in pExpr and change that subexpression into a reference to the appropriate |
| 138438 | 139519 | ** column of the index. |
| 139520 | +** |
| 139521 | +** 2019-10-24: Updated to also translate references to a VIRTUAL column in |
| 139522 | +** the table into references to the corresponding (stored) column of the |
| 139523 | +** index. |
| 138439 | 139524 | */ |
| 138440 | 139525 | static void whereIndexExprTrans( |
| 138441 | 139526 | Index *pIdx, /* The Index */ |
| 138442 | 139527 | int iTabCur, /* Cursor of the table that is being indexed */ |
| 138443 | 139528 | int iIdxCur, /* Cursor of the index itself */ |
| 138444 | 139529 | WhereInfo *pWInfo /* Transform expressions in this WHERE clause */ |
| 138445 | 139530 | ){ |
| 138446 | 139531 | int iIdxCol; /* Column number of the index */ |
| 138447 | 139532 | ExprList *aColExpr; /* Expressions that are indexed */ |
| 139533 | + Table *pTab; |
| 138448 | 139534 | Walker w; |
| 138449 | 139535 | IdxExprTrans x; |
| 138450 | 139536 | aColExpr = pIdx->aColExpr; |
| 138451 | | - if( aColExpr==0 ) return; /* Not an index on expressions */ |
| 139537 | + if( aColExpr==0 && !pIdx->bHasVCol ){ |
| 139538 | + /* The index does not reference any expressions or virtual columns |
| 139539 | + ** so no translations are needed. */ |
| 139540 | + return; |
| 139541 | + } |
| 139542 | + pTab = pIdx->pTable; |
| 138452 | 139543 | memset(&w, 0, sizeof(w)); |
| 138453 | | - w.xExprCallback = whereIndexExprTransNode; |
| 138454 | 139544 | w.u.pIdxTrans = &x; |
| 138455 | 139545 | x.iTabCur = iTabCur; |
| 138456 | 139546 | x.iIdxCur = iIdxCur; |
| 138457 | | - for(iIdxCol=0; iIdxCol<aColExpr->nExpr; iIdxCol++){ |
| 138458 | | - if( pIdx->aiColumn[iIdxCol]!=XN_EXPR ) continue; |
| 138459 | | - assert( aColExpr->a[iIdxCol].pExpr!=0 ); |
| 139547 | + for(iIdxCol=0; iIdxCol<pIdx->nColumn; iIdxCol++){ |
| 139548 | + i16 iRef = pIdx->aiColumn[iIdxCol]; |
| 139549 | + if( iRef==XN_EXPR ){ |
| 139550 | + assert( aColExpr->a[iIdxCol].pExpr!=0 ); |
| 139551 | + x.pIdxExpr = aColExpr->a[iIdxCol].pExpr; |
| 139552 | + w.xExprCallback = whereIndexExprTransNode; |
| 139553 | +#ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 139554 | + }else if( iRef>=0 && (pTab->aCol[iRef].colFlags & COLFLAG_VIRTUAL)!=0 ){ |
| 139555 | + x.iTabCol = iRef; |
| 139556 | + w.xExprCallback = whereIndexExprTransColumn; |
| 139557 | +#endif /* SQLITE_OMIT_GENERATED_COLUMNS */ |
| 139558 | + }else{ |
| 139559 | + continue; |
| 139560 | + } |
| 138460 | 139561 | x.iIdxCol = iIdxCol; |
| 138461 | | - x.pIdxExpr = aColExpr->a[iIdxCol].pExpr; |
| 138462 | 139562 | sqlite3WalkExpr(&w, pWInfo->pWhere); |
| 138463 | 139563 | sqlite3WalkExprList(&w, pWInfo->pOrderBy); |
| 138464 | 139564 | sqlite3WalkExprList(&w, pWInfo->pResultSet); |
| 138465 | 139565 | } |
| 138466 | 139566 | } |
| | @@ -138607,13 +139707,16 @@ |
| 138607 | 139707 | pLevel->op = pWInfo->eOnePass ? OP_Noop : OP_VNext; |
| 138608 | 139708 | pLevel->p2 = sqlite3VdbeCurrentAddr(v); |
| 138609 | 139709 | iIn = pLevel->u.in.nIn; |
| 138610 | 139710 | for(j=nConstraint-1; j>=0; j--){ |
| 138611 | 139711 | pTerm = pLoop->aLTerm[j]; |
| 139712 | + if( (pTerm->eOperator & WO_IN)!=0 ) iIn--; |
| 138612 | 139713 | if( j<16 && (pLoop->u.vtab.omitMask>>j)&1 ){ |
| 138613 | 139714 | disableTerm(pLevel, pTerm); |
| 138614 | | - }else if( (pTerm->eOperator & WO_IN)!=0 ){ |
| 139715 | + }else if( (pTerm->eOperator & WO_IN)!=0 |
| 139716 | + && sqlite3ExprVectorSize(pTerm->pExpr->pLeft)==1 |
| 139717 | + ){ |
| 138615 | 139718 | Expr *pCompare; /* The comparison operator */ |
| 138616 | 139719 | Expr *pRight; /* RHS of the comparison */ |
| 138617 | 139720 | VdbeOp *pOp; /* Opcode to access the value of the IN constraint */ |
| 138618 | 139721 | |
| 138619 | 139722 | /* Reload the constraint value into reg[iReg+j+2]. The same value |
| | @@ -138620,12 +139723,12 @@ |
| 138620 | 139723 | ** was loaded into the same register prior to the OP_VFilter, but |
| 138621 | 139724 | ** the xFilter implementation might have changed the datatype or |
| 138622 | 139725 | ** encoding of the value in the register, so it *must* be reloaded. */ |
| 138623 | 139726 | assert( pLevel->u.in.aInLoop!=0 || db->mallocFailed ); |
| 138624 | 139727 | if( !db->mallocFailed ){ |
| 138625 | | - assert( iIn>0 ); |
| 138626 | | - pOp = sqlite3VdbeGetOp(v, pLevel->u.in.aInLoop[--iIn].addrInTop); |
| 139728 | + assert( iIn>=0 && iIn<pLevel->u.in.nIn ); |
| 139729 | + pOp = sqlite3VdbeGetOp(v, pLevel->u.in.aInLoop[iIn].addrInTop); |
| 138627 | 139730 | assert( pOp->opcode==OP_Column || pOp->opcode==OP_Rowid ); |
| 138628 | 139731 | assert( pOp->opcode!=OP_Column || pOp->p3==iReg+j+2 ); |
| 138629 | 139732 | assert( pOp->opcode!=OP_Rowid || pOp->p2==iReg+j+2 ); |
| 138630 | 139733 | testcase( pOp->opcode==OP_Rowid ); |
| 138631 | 139734 | sqlite3VdbeAddOp3(v, pOp->opcode, pOp->p1, pOp->p2, pOp->p3); |
| | @@ -138645,10 +139748,11 @@ |
| 138645 | 139748 | pCompare->pLeft = 0; |
| 138646 | 139749 | sqlite3ExprDelete(db, pCompare); |
| 138647 | 139750 | } |
| 138648 | 139751 | } |
| 138649 | 139752 | } |
| 139753 | + assert( iIn==0 || db->mallocFailed ); |
| 138650 | 139754 | /* These registers need to be preserved in case there is an IN operator |
| 138651 | 139755 | ** loop. So we could deallocate the registers here (and potentially |
| 138652 | 139756 | ** reuse them later) if (pLoop->wsFlags & WHERE_IN_ABLE)==0. But it seems |
| 138653 | 139757 | ** simpler and safer to simply not reuse the registers. |
| 138654 | 139758 | ** |
| | @@ -139124,44 +140228,57 @@ |
| 139124 | 140228 | } |
| 139125 | 140229 | }else if( iCur!=iIdxCur ){ |
| 139126 | 140230 | Index *pPk = sqlite3PrimaryKeyIndex(pIdx->pTable); |
| 139127 | 140231 | iRowidReg = sqlite3GetTempRange(pParse, pPk->nKeyCol); |
| 139128 | 140232 | for(j=0; j<pPk->nKeyCol; j++){ |
| 139129 | | - k = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[j]); |
| 140233 | + k = sqlite3TableColumnToIndex(pIdx, pPk->aiColumn[j]); |
| 139130 | 140234 | sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, k, iRowidReg+j); |
| 139131 | 140235 | } |
| 139132 | 140236 | sqlite3VdbeAddOp4Int(v, OP_NotFound, iCur, addrCont, |
| 139133 | 140237 | iRowidReg, pPk->nKeyCol); VdbeCoverage(v); |
| 139134 | 140238 | } |
| 139135 | 140239 | |
| 139136 | | - /* If pIdx is an index on one or more expressions, then look through |
| 139137 | | - ** all the expressions in pWInfo and try to transform matching expressions |
| 139138 | | - ** into reference to index columns. |
| 139139 | | - ** |
| 139140 | | - ** Do not do this for the RHS of a LEFT JOIN. This is because the |
| 139141 | | - ** expression may be evaluated after OP_NullRow has been executed on |
| 139142 | | - ** the cursor. In this case it is important to do the full evaluation, |
| 139143 | | - ** as the result of the expression may not be NULL, even if all table |
| 139144 | | - ** column values are. https://www.sqlite.org/src/info/7fa8049685b50b5a |
| 139145 | | - ** |
| 139146 | | - ** Also, do not do this when processing one index an a multi-index |
| 139147 | | - ** OR clause, since the transformation will become invalid once we |
| 139148 | | - ** move forward to the next index. |
| 139149 | | - ** https://sqlite.org/src/info/4e8e4857d32d401f |
| 139150 | | - */ |
| 139151 | | - if( pLevel->iLeftJoin==0 && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0 ){ |
| 139152 | | - whereIndexExprTrans(pIdx, iCur, iIdxCur, pWInfo); |
| 139153 | | - } |
| 139154 | | - |
| 139155 | | - /* If a partial index is driving the loop, try to eliminate WHERE clause |
| 139156 | | - ** terms from the query that must be true due to the WHERE clause of |
| 139157 | | - ** the partial index |
| 139158 | | - */ |
| 139159 | | - if( pIdx->pPartIdxWhere ){ |
| 139160 | | - whereApplyPartialIndexConstraints(pIdx->pPartIdxWhere, iCur, pWC); |
| 139161 | | - } |
| 139162 | | - |
| 140240 | + if( pLevel->iLeftJoin==0 ){ |
| 140241 | + /* If pIdx is an index on one or more expressions, then look through |
| 140242 | + ** all the expressions in pWInfo and try to transform matching expressions |
| 140243 | + ** into reference to index columns. Also attempt to translate references |
| 140244 | + ** to virtual columns in the table into references to (stored) columns |
| 140245 | + ** of the index. |
| 140246 | + ** |
| 140247 | + ** Do not do this for the RHS of a LEFT JOIN. This is because the |
| 140248 | + ** expression may be evaluated after OP_NullRow has been executed on |
| 140249 | + ** the cursor. In this case it is important to do the full evaluation, |
| 140250 | + ** as the result of the expression may not be NULL, even if all table |
| 140251 | + ** column values are. https://www.sqlite.org/src/info/7fa8049685b50b5a |
| 140252 | + ** |
| 140253 | + ** Also, do not do this when processing one index an a multi-index |
| 140254 | + ** OR clause, since the transformation will become invalid once we |
| 140255 | + ** move forward to the next index. |
| 140256 | + ** https://sqlite.org/src/info/4e8e4857d32d401f |
| 140257 | + */ |
| 140258 | + if( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0 ){ |
| 140259 | + whereIndexExprTrans(pIdx, iCur, iIdxCur, pWInfo); |
| 140260 | + } |
| 140261 | + |
| 140262 | + /* If a partial index is driving the loop, try to eliminate WHERE clause |
| 140263 | + ** terms from the query that must be true due to the WHERE clause of |
| 140264 | + ** the partial index. |
| 140265 | + ** |
| 140266 | + ** 2019-11-02 ticket 623eff57e76d45f6: This optimization does not work |
| 140267 | + ** for a LEFT JOIN. |
| 140268 | + */ |
| 140269 | + if( pIdx->pPartIdxWhere ){ |
| 140270 | + whereApplyPartialIndexConstraints(pIdx->pPartIdxWhere, iCur, pWC); |
| 140271 | + } |
| 140272 | + }else{ |
| 140273 | + testcase( pIdx->pPartIdxWhere ); |
| 140274 | + /* The following assert() is not a requirement, merely an observation: |
| 140275 | + ** The OR-optimization doesn't work for the right hand table of |
| 140276 | + ** a LEFT JOIN: */ |
| 140277 | + assert( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0 ); |
| 140278 | + } |
| 140279 | + |
| 139163 | 140280 | /* Record the instruction used to terminate the loop. */ |
| 139164 | 140281 | if( pLoop->wsFlags & WHERE_ONEROW ){ |
| 139165 | 140282 | pLevel->op = OP_Noop; |
| 139166 | 140283 | }else if( bRev ){ |
| 139167 | 140284 | pLevel->op = OP_Prev; |
| | @@ -139384,11 +140501,11 @@ |
| 139384 | 140501 | |
| 139385 | 140502 | /* Read the PK into an array of temp registers. */ |
| 139386 | 140503 | r = sqlite3GetTempRange(pParse, nPk); |
| 139387 | 140504 | for(iPk=0; iPk<nPk; iPk++){ |
| 139388 | 140505 | int iCol = pPk->aiColumn[iPk]; |
| 139389 | | - sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, iCol, r+iPk); |
| 140506 | + sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, iCol,r+iPk); |
| 139390 | 140507 | } |
| 139391 | 140508 | |
| 139392 | 140509 | /* Check if the temp table already contains this key. If so, |
| 139393 | 140510 | ** the row has already been included in the result set and |
| 139394 | 140511 | ** can be ignored (by jumping past the Gosub below). Otherwise, |
| | @@ -139749,43 +140866,18 @@ |
| 139749 | 140866 | } |
| 139750 | 140867 | |
| 139751 | 140868 | /* |
| 139752 | 140869 | ** Commute a comparison operator. Expressions of the form "X op Y" |
| 139753 | 140870 | ** are converted into "Y op X". |
| 139754 | | -** |
| 139755 | | -** If left/right precedence rules come into play when determining the |
| 139756 | | -** collating sequence, then COLLATE operators are adjusted to ensure |
| 139757 | | -** that the collating sequence does not change. For example: |
| 139758 | | -** "Y collate NOCASE op X" becomes "X op Y" because any collation sequence on |
| 139759 | | -** the left hand side of a comparison overrides any collation sequence |
| 139760 | | -** attached to the right. For the same reason the EP_Collate flag |
| 139761 | | -** is not commuted. |
| 139762 | | -** |
| 139763 | | -** The return value is extra flags that are added to the WhereTerm object |
| 139764 | | -** after it is commuted. The only extra flag ever added is TERM_NOPARTIDX |
| 139765 | | -** which prevents the term from being used to enable a partial index if |
| 139766 | | -** COLLATE changes have been made. |
| 139767 | 140871 | */ |
| 139768 | 140872 | static u16 exprCommute(Parse *pParse, Expr *pExpr){ |
| 139769 | | - u16 expRight = (pExpr->pRight->flags & EP_Collate); |
| 139770 | | - u16 expLeft = (pExpr->pLeft->flags & EP_Collate); |
| 139771 | | - u16 wtFlags = 0; |
| 139772 | | - assert( allowedOp(pExpr->op) && pExpr->op!=TK_IN ); |
| 139773 | | - if( expRight==expLeft ){ |
| 139774 | | - /* Either X and Y both have COLLATE operator or neither do */ |
| 139775 | | - if( expRight ){ |
| 139776 | | - /* Both X and Y have COLLATE operators. Make sure X is always |
| 139777 | | - ** used by clearing the EP_Collate flag from Y. */ |
| 139778 | | - pExpr->pRight->flags &= ~EP_Collate; |
| 139779 | | - wtFlags |= TERM_NOPARTIDX; |
| 139780 | | - }else if( sqlite3ExprCollSeq(pParse, pExpr->pLeft)!=0 ){ |
| 139781 | | - /* Neither X nor Y have COLLATE operators, but X has a non-default |
| 139782 | | - ** collating sequence. So add the EP_Collate marker on X to cause |
| 139783 | | - ** it to be searched first. */ |
| 139784 | | - pExpr->pLeft->flags |= EP_Collate; |
| 139785 | | - wtFlags |= TERM_NOPARTIDX; |
| 139786 | | - } |
| 140873 | + if( pExpr->pLeft->op==TK_VECTOR |
| 140874 | + || pExpr->pRight->op==TK_VECTOR |
| 140875 | + || sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight) != |
| 140876 | + sqlite3BinaryCompareCollSeq(pParse, pExpr->pRight, pExpr->pLeft) |
| 140877 | + ){ |
| 140878 | + pExpr->flags ^= EP_Commuted; |
| 139787 | 140879 | } |
| 139788 | 140880 | SWAP(Expr*,pExpr->pRight,pExpr->pLeft); |
| 139789 | 140881 | if( pExpr->op>=TK_GT ){ |
| 139790 | 140882 | assert( TK_LT==TK_GT+2 ); |
| 139791 | 140883 | assert( TK_GE==TK_LE+2 ); |
| | @@ -139792,11 +140884,11 @@ |
| 139792 | 140884 | assert( TK_GT>TK_EQ ); |
| 139793 | 140885 | assert( TK_GT<TK_LE ); |
| 139794 | 140886 | assert( pExpr->op>=TK_GT && pExpr->op<=TK_GE ); |
| 139795 | 140887 | pExpr->op = ((pExpr->op-TK_GT)^2)+TK_GT; |
| 139796 | 140888 | } |
| 139797 | | - return wtFlags; |
| 140889 | + return 0; |
| 139798 | 140890 | } |
| 139799 | 140891 | |
| 139800 | 140892 | /* |
| 139801 | 140893 | ** Translate from TK_xx operator to WO_xx bitmask. |
| 139802 | 140894 | */ |
| | @@ -140570,11 +141662,11 @@ |
| 140570 | 141662 | if( aff1!=aff2 |
| 140571 | 141663 | && (!sqlite3IsNumericAffinity(aff1) || !sqlite3IsNumericAffinity(aff2)) |
| 140572 | 141664 | ){ |
| 140573 | 141665 | return 0; |
| 140574 | 141666 | } |
| 140575 | | - pColl = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight); |
| 141667 | + pColl = sqlite3ExprCompareCollSeq(pParse, pExpr); |
| 140576 | 141668 | if( sqlite3IsBinary(pColl) ) return 1; |
| 140577 | 141669 | return sqlite3ExprCollSeqMatch(pParse, pExpr->pLeft, pExpr->pRight); |
| 140578 | 141670 | } |
| 140579 | 141671 | |
| 140580 | 141672 | /* |
| | @@ -141259,10 +142351,13 @@ |
| 141259 | 142351 | pColRef->iColumn = k++; |
| 141260 | 142352 | pColRef->y.pTab = pTab; |
| 141261 | 142353 | pRhs = sqlite3PExpr(pParse, TK_UPLUS, |
| 141262 | 142354 | sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0); |
| 141263 | 142355 | pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs); |
| 142356 | + if( pItem->fg.jointype & JT_LEFT ){ |
| 142357 | + sqlite3SetJoinExpr(pTerm, pItem->iCursor); |
| 142358 | + } |
| 141264 | 142359 | whereClauseInsert(pWC, pTerm, TERM_DYNAMIC); |
| 141265 | 142360 | } |
| 141266 | 142361 | } |
| 141267 | 142362 | |
| 141268 | 142363 | /************** End of whereexpr.c *******************************************/ |
| | @@ -141546,12 +142641,11 @@ |
| 141546 | 142641 | pX = pTerm->pExpr; |
| 141547 | 142642 | if( !sqlite3IndexAffinityOk(pX, pScan->idxaff) ){ |
| 141548 | 142643 | continue; |
| 141549 | 142644 | } |
| 141550 | 142645 | assert(pX->pLeft); |
| 141551 | | - pColl = sqlite3BinaryCompareCollSeq(pParse, |
| 141552 | | - pX->pLeft, pX->pRight); |
| 142646 | + pColl = sqlite3ExprCompareCollSeq(pParse, pX); |
| 141553 | 142647 | if( pColl==0 ) pColl = pParse->db->pDfltColl; |
| 141554 | 142648 | if( sqlite3StrICmp(pColl->zName, pScan->zCollName) ){ |
| 141555 | 142649 | continue; |
| 141556 | 142650 | } |
| 141557 | 142651 | } |
| | @@ -142068,12 +143162,12 @@ |
| 142068 | 143162 | testcase( iCol==BMS ); |
| 142069 | 143163 | if( (idxCols & cMask)==0 ){ |
| 142070 | 143164 | Expr *pX = pTerm->pExpr; |
| 142071 | 143165 | idxCols |= cMask; |
| 142072 | 143166 | pIdx->aiColumn[n] = pTerm->u.leftColumn; |
| 142073 | | - pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight); |
| 142074 | | - pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY; |
| 143167 | + pColl = sqlite3ExprCompareCollSeq(pParse, pX); |
| 143168 | + pIdx->azColl[n] = ALWAYS(pColl) ? pColl->zName : sqlite3StrBINARY; |
| 142075 | 143169 | n++; |
| 142076 | 143170 | } |
| 142077 | 143171 | } |
| 142078 | 143172 | } |
| 142079 | 143173 | assert( (u32)n==pLoop->u.btree.nEq ); |
| | @@ -144069,11 +145163,10 @@ |
| 144069 | 145163 | pWhere = pWhere->pRight; |
| 144070 | 145164 | } |
| 144071 | 145165 | if( pParse->db->flags & SQLITE_EnableQPSG ) pParse = 0; |
| 144072 | 145166 | for(i=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ |
| 144073 | 145167 | Expr *pExpr; |
| 144074 | | - if( pTerm->wtFlags & TERM_NOPARTIDX ) continue; |
| 144075 | 145168 | pExpr = pTerm->pExpr; |
| 144076 | 145169 | if( (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->iRightJoinTable==iTab) |
| 144077 | 145170 | && sqlite3ExprImpliesExpr(pParse, pExpr, pWhere, iTab) |
| 144078 | 145171 | ){ |
| 144079 | 145172 | return 1; |
| | @@ -144532,11 +145625,11 @@ |
| 144532 | 145625 | if( iCons>=0 && iCons<pIdxInfo->nConstraint ){ |
| 144533 | 145626 | CollSeq *pC = 0; |
| 144534 | 145627 | int iTerm = pIdxInfo->aConstraint[iCons].iTermOffset; |
| 144535 | 145628 | Expr *pX = pHidden->pWC->a[iTerm].pExpr; |
| 144536 | 145629 | if( pX->pLeft ){ |
| 144537 | | - pC = sqlite3BinaryCompareCollSeq(pHidden->pParse, pX->pLeft, pX->pRight); |
| 145630 | + pC = sqlite3ExprCompareCollSeq(pHidden->pParse, pX); |
| 144538 | 145631 | } |
| 144539 | 145632 | zRet = (pC ? pC->zName : sqlite3StrBINARY); |
| 144540 | 145633 | } |
| 144541 | 145634 | return zRet; |
| 144542 | 145635 | } |
| | @@ -144965,11 +146058,13 @@ |
| 144965 | 146058 | if( wctrlFlags & WHERE_ORDERBY_LIMIT ) continue; |
| 144966 | 146059 | }else{ |
| 144967 | 146060 | pLoop = pLast; |
| 144968 | 146061 | } |
| 144969 | 146062 | if( pLoop->wsFlags & WHERE_VIRTUALTABLE ){ |
| 144970 | | - if( pLoop->u.vtab.isOrdered ) obSat = obDone; |
| 146063 | + if( pLoop->u.vtab.isOrdered && (wctrlFlags & WHERE_DISTINCTBY)==0 ){ |
| 146064 | + obSat = obDone; |
| 146065 | + } |
| 144971 | 146066 | break; |
| 144972 | 146067 | }else if( wctrlFlags & WHERE_DISTINCTBY ){ |
| 144973 | 146068 | pLoop->u.btree.nDistinctCol = 0; |
| 144974 | 146069 | } |
| 144975 | 146070 | iCur = pWInfo->pTabList->a[pLoop->iTab].iCursor; |
| | @@ -146283,11 +147378,17 @@ |
| 146283 | 147378 | }; |
| 146284 | 147379 | sqlite3OpenTable(pParse, pTabItem->iCursor, iDb, pTab, op); |
| 146285 | 147380 | assert( pTabItem->iCursor==pLevel->iTabCur ); |
| 146286 | 147381 | testcase( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol==BMS-1 ); |
| 146287 | 147382 | testcase( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol==BMS ); |
| 146288 | | - if( pWInfo->eOnePass==ONEPASS_OFF && pTab->nCol<BMS && HasRowid(pTab) ){ |
| 147383 | + if( pWInfo->eOnePass==ONEPASS_OFF |
| 147384 | + && pTab->nCol<BMS |
| 147385 | + && (pTab->tabFlags & (TF_HasGenerated|TF_WithoutRowid))==0 |
| 147386 | + ){ |
| 147387 | + /* If we know that only a prefix of the record will be used, |
| 147388 | + ** it is advantageous to reduce the "column count" field in |
| 147389 | + ** the P4 operand of the OP_OpenRead/Write opcode. */ |
| 146289 | 147390 | Bitmask b = pTabItem->colUsed; |
| 146290 | 147391 | int n = 0; |
| 146291 | 147392 | for(; b; b=b>>1, n++){} |
| 146292 | 147393 | sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(n), P4_INT32); |
| 146293 | 147394 | assert( n<=pTab->nCol ); |
| | @@ -146645,12 +147746,15 @@ |
| 146645 | 147746 | assert( pIdx->pTable==pTab ); |
| 146646 | 147747 | if( !HasRowid(pTab) ){ |
| 146647 | 147748 | Index *pPk = sqlite3PrimaryKeyIndex(pTab); |
| 146648 | 147749 | x = pPk->aiColumn[x]; |
| 146649 | 147750 | assert( x>=0 ); |
| 147751 | + }else{ |
| 147752 | + testcase( x!=sqlite3StorageColumnToTable(pTab,x) ); |
| 147753 | + x = sqlite3StorageColumnToTable(pTab,x); |
| 146650 | 147754 | } |
| 146651 | | - x = sqlite3ColumnOfIndex(pIdx, x); |
| 147755 | + x = sqlite3TableColumnToIndex(pIdx, x); |
| 146652 | 147756 | if( x>=0 ){ |
| 146653 | 147757 | pOp->p2 = x; |
| 146654 | 147758 | pOp->p1 = pLevel->iIdxCur; |
| 146655 | 147759 | OpcodeRewriteTrace(db, k, pOp); |
| 146656 | 147760 | } |
| | @@ -147583,11 +148687,11 @@ |
| 147583 | 148687 | ** are invoked in the correct order as described under "SELECT REWRITING" |
| 147584 | 148688 | ** at the top of this file. |
| 147585 | 148689 | */ |
| 147586 | 148690 | SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){ |
| 147587 | 148691 | int rc = SQLITE_OK; |
| 147588 | | - if( p->pWin && p->pPrior==0 ){ |
| 148692 | + if( p->pWin && p->pPrior==0 && (p->selFlags & SF_WinRewrite)==0 ){ |
| 147589 | 148693 | Vdbe *v = sqlite3GetVdbe(pParse); |
| 147590 | 148694 | sqlite3 *db = pParse->db; |
| 147591 | 148695 | Select *pSub = 0; /* The subquery */ |
| 147592 | 148696 | SrcList *pSrc = p->pSrc; |
| 147593 | 148697 | Expr *pWhere = p->pWhere; |
| | @@ -147608,10 +148712,11 @@ |
| 147608 | 148712 | p->pSrc = 0; |
| 147609 | 148713 | p->pWhere = 0; |
| 147610 | 148714 | p->pGroupBy = 0; |
| 147611 | 148715 | p->pHaving = 0; |
| 147612 | 148716 | p->selFlags &= ~SF_Aggregate; |
| 148717 | + p->selFlags |= SF_WinRewrite; |
| 147613 | 148718 | |
| 147614 | 148719 | /* Create the ORDER BY clause for the sub-select. This is the concatenation |
| 147615 | 148720 | ** of the window PARTITION and ORDER BY clauses. Then, if this makes it |
| 147616 | 148721 | ** redundant, remove the ORDER BY from the parent SELECT. */ |
| 147617 | 148722 | pSort = sqlite3ExprListDup(db, pMWin->pPartition, 0); |
| | @@ -147923,12 +149028,12 @@ |
| 147923 | 149028 | ** to be processed as part of SELECT statement pSel). The window is linked |
| 147924 | 149029 | ** in if either (a) there are no other windows already linked to this |
| 147925 | 149030 | ** SELECT, or (b) the windows already linked use a compatible window frame. |
| 147926 | 149031 | */ |
| 147927 | 149032 | SQLITE_PRIVATE void sqlite3WindowLink(Select *pSel, Window *pWin){ |
| 147928 | | - if( 0==pSel->pWin |
| 147929 | | - || 0==sqlite3WindowCompare(0, pSel->pWin, pWin, 0) |
| 149033 | + if( pSel!=0 |
| 149034 | + && (0==pSel->pWin || 0==sqlite3WindowCompare(0, pSel->pWin, pWin, 0)) |
| 147930 | 149035 | ){ |
| 147931 | 149036 | pWin->pNextWin = pSel->pWin; |
| 147932 | 149037 | if( pSel->pWin ){ |
| 147933 | 149038 | pSel->pWin->ppThis = &pWin->pNextWin; |
| 147934 | 149039 | } |
| | @@ -149725,12 +150830,13 @@ |
| 149725 | 150830 | /* |
| 149726 | 150831 | ** Disable lookaside memory allocation for objects that might be |
| 149727 | 150832 | ** shared across database connections. |
| 149728 | 150833 | */ |
| 149729 | 150834 | static void disableLookaside(Parse *pParse){ |
| 150835 | + sqlite3 *db = pParse->db; |
| 149730 | 150836 | pParse->disableLookaside++; |
| 149731 | | - pParse->db->lookaside.bDisable++; |
| 150837 | + DisableLookaside; |
| 149732 | 150838 | } |
| 149733 | 150839 | |
| 149734 | 150840 | |
| 149735 | 150841 | /* |
| 149736 | 150842 | ** For a compound SELECT statement, make sure p->pPrior->pNext==p for |
| | @@ -149890,32 +150996,32 @@ |
| 149890 | 150996 | #ifndef INTERFACE |
| 149891 | 150997 | # define INTERFACE 1 |
| 149892 | 150998 | #endif |
| 149893 | 150999 | /************* Begin control #defines *****************************************/ |
| 149894 | 151000 | #define YYCODETYPE unsigned short int |
| 149895 | | -#define YYNOCODE 307 |
| 151001 | +#define YYNOCODE 310 |
| 149896 | 151002 | #define YYACTIONTYPE unsigned short int |
| 149897 | | -#define YYWILDCARD 98 |
| 151003 | +#define YYWILDCARD 100 |
| 149898 | 151004 | #define sqlite3ParserTOKENTYPE Token |
| 149899 | 151005 | typedef union { |
| 149900 | 151006 | int yyinit; |
| 149901 | 151007 | sqlite3ParserTOKENTYPE yy0; |
| 149902 | | - const char* yy8; |
| 149903 | | - Select* yy25; |
| 149904 | | - int yy32; |
| 149905 | | - Expr* yy46; |
| 149906 | | - struct FrameBound yy57; |
| 149907 | | - u8 yy118; |
| 149908 | | - ExprList* yy138; |
| 149909 | | - Upsert* yy288; |
| 149910 | | - With* yy297; |
| 149911 | | - IdList* yy406; |
| 149912 | | - Window* yy455; |
| 149913 | | - struct {int value; int mask;} yy495; |
| 149914 | | - TriggerStep* yy527; |
| 149915 | | - struct TrigEvent yy572; |
| 149916 | | - SrcList* yy609; |
| 151008 | + SrcList* yy47; |
| 151009 | + u8 yy58; |
| 151010 | + struct FrameBound yy77; |
| 151011 | + With* yy131; |
| 151012 | + int yy192; |
| 151013 | + Expr* yy202; |
| 151014 | + struct {int value; int mask;} yy207; |
| 151015 | + struct TrigEvent yy230; |
| 151016 | + ExprList* yy242; |
| 151017 | + Window* yy303; |
| 151018 | + Upsert* yy318; |
| 151019 | + const char* yy436; |
| 151020 | + TriggerStep* yy447; |
| 151021 | + Select* yy539; |
| 151022 | + IdList* yy600; |
| 149917 | 151023 | } YYMINORTYPE; |
| 149918 | 151024 | #ifndef YYSTACKDEPTH |
| 149919 | 151025 | #define YYSTACKDEPTH 100 |
| 149920 | 151026 | #endif |
| 149921 | 151027 | #define sqlite3ParserARG_SDECL |
| | @@ -149927,21 +151033,21 @@ |
| 149927 | 151033 | #define sqlite3ParserCTX_PDECL ,Parse *pParse |
| 149928 | 151034 | #define sqlite3ParserCTX_PARAM ,pParse |
| 149929 | 151035 | #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; |
| 149930 | 151036 | #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; |
| 149931 | 151037 | #define YYFALLBACK 1 |
| 149932 | | -#define YYNSTATE 543 |
| 149933 | | -#define YYNRULE 381 |
| 149934 | | -#define YYNTOKEN 179 |
| 149935 | | -#define YY_MAX_SHIFT 542 |
| 149936 | | -#define YY_MIN_SHIFTREDUCE 790 |
| 149937 | | -#define YY_MAX_SHIFTREDUCE 1170 |
| 149938 | | -#define YY_ERROR_ACTION 1171 |
| 149939 | | -#define YY_ACCEPT_ACTION 1172 |
| 149940 | | -#define YY_NO_ACTION 1173 |
| 149941 | | -#define YY_MIN_REDUCE 1174 |
| 149942 | | -#define YY_MAX_REDUCE 1554 |
| 151038 | +#define YYNSTATE 550 |
| 151039 | +#define YYNRULE 385 |
| 151040 | +#define YYNTOKEN 181 |
| 151041 | +#define YY_MAX_SHIFT 549 |
| 151042 | +#define YY_MIN_SHIFTREDUCE 800 |
| 151043 | +#define YY_MAX_SHIFTREDUCE 1184 |
| 151044 | +#define YY_ERROR_ACTION 1185 |
| 151045 | +#define YY_ACCEPT_ACTION 1186 |
| 151046 | +#define YY_NO_ACTION 1187 |
| 151047 | +#define YY_MIN_REDUCE 1188 |
| 151048 | +#define YY_MAX_REDUCE 1572 |
| 149943 | 151049 | /************* End control #defines *******************************************/ |
| 149944 | 151050 | #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) |
| 149945 | 151051 | |
| 149946 | 151052 | /* Define the yytestcase() macro to be a no-op if is not already defined |
| 149947 | 151053 | ** otherwise. |
| | @@ -150004,577 +151110,585 @@ |
| 150004 | 151110 | ** yy_reduce_ofst[] For each state, the offset into yy_action for |
| 150005 | 151111 | ** shifting non-terminals after a reduce. |
| 150006 | 151112 | ** yy_default[] Default action for each state. |
| 150007 | 151113 | ** |
| 150008 | 151114 | *********** Begin parsing tables **********************************************/ |
| 150009 | | -#define YY_ACTTAB_COUNT (1913) |
| 151115 | +#define YY_ACTTAB_COUNT (1958) |
| 150010 | 151116 | static const YYACTIONTYPE yy_action[] = { |
| 150011 | | - /* 0 */ 537, 339, 537, 1241, 1220, 537, 12, 537, 112, 109, |
| 150012 | | - /* 10 */ 209, 537, 1241, 537, 1205, 462, 112, 109, 209, 386, |
| 150013 | | - /* 20 */ 338, 462, 42, 42, 42, 42, 445, 42, 42, 70, |
| 150014 | | - /* 30 */ 70, 922, 1208, 70, 70, 70, 70, 1443, 403, 923, |
| 150015 | | - /* 40 */ 531, 531, 531, 119, 120, 110, 1148, 1148, 991, 994, |
| 150016 | | - /* 50 */ 984, 984, 117, 117, 118, 118, 118, 118, 425, 386, |
| 150017 | | - /* 60 */ 1498, 542, 2, 1176, 1442, 519, 141, 1518, 289, 519, |
| 150018 | | - /* 70 */ 134, 519, 95, 259, 495, 1215, 189, 1254, 518, 494, |
| 150019 | | - /* 80 */ 484, 437, 296, 119, 120, 110, 1148, 1148, 991, 994, |
| 150020 | | - /* 90 */ 984, 984, 117, 117, 118, 118, 118, 118, 270, 116, |
| 150021 | | - /* 100 */ 116, 116, 116, 115, 115, 114, 114, 114, 113, 418, |
| 150022 | | - /* 110 */ 264, 264, 264, 264, 423, 1479, 352, 1481, 123, 351, |
| 150023 | | - /* 120 */ 1479, 508, 1094, 534, 1034, 534, 1099, 386, 1099, 239, |
| 150024 | | - /* 130 */ 206, 112, 109, 209, 96, 1094, 376, 219, 1094, 116, |
| 150025 | | - /* 140 */ 116, 116, 116, 115, 115, 114, 114, 114, 113, 418, |
| 150026 | | - /* 150 */ 480, 119, 120, 110, 1148, 1148, 991, 994, 984, 984, |
| 150027 | | - /* 160 */ 117, 117, 118, 118, 118, 118, 353, 422, 1407, 264, |
| 150028 | | - /* 170 */ 264, 114, 114, 114, 113, 418, 883, 121, 416, 416, |
| 150029 | | - /* 180 */ 416, 882, 534, 116, 116, 116, 116, 115, 115, 114, |
| 150030 | | - /* 190 */ 114, 114, 113, 418, 212, 415, 414, 386, 443, 383, |
| 150031 | | - /* 200 */ 382, 118, 118, 118, 118, 111, 177, 116, 116, 116, |
| 150032 | | - /* 210 */ 116, 115, 115, 114, 114, 114, 113, 418, 112, 109, |
| 150033 | | - /* 220 */ 209, 119, 120, 110, 1148, 1148, 991, 994, 984, 984, |
| 150034 | | - /* 230 */ 117, 117, 118, 118, 118, 118, 386, 438, 312, 1163, |
| 150035 | | - /* 240 */ 1155, 80, 1155, 1127, 514, 79, 116, 116, 116, 116, |
| 150036 | | - /* 250 */ 115, 115, 114, 114, 114, 113, 418, 514, 428, 418, |
| 150037 | | - /* 260 */ 119, 120, 110, 1148, 1148, 991, 994, 984, 984, 117, |
| 150038 | | - /* 270 */ 117, 118, 118, 118, 118, 428, 427, 116, 116, 116, |
| 150039 | | - /* 280 */ 116, 115, 115, 114, 114, 114, 113, 418, 115, 115, |
| 150040 | | - /* 290 */ 114, 114, 114, 113, 418, 1127, 1127, 1128, 1129, 1094, |
| 150041 | | - /* 300 */ 258, 258, 192, 386, 408, 371, 1168, 326, 118, 118, |
| 150042 | | - /* 310 */ 118, 118, 1094, 534, 374, 1094, 116, 116, 116, 116, |
| 150043 | | - /* 320 */ 115, 115, 114, 114, 114, 113, 418, 119, 120, 110, |
| 150044 | | - /* 330 */ 1148, 1148, 991, 994, 984, 984, 117, 117, 118, 118, |
| 150045 | | - /* 340 */ 118, 118, 386, 354, 445, 428, 829, 238, 1127, 1128, |
| 150046 | | - /* 350 */ 1129, 515, 1466, 116, 116, 116, 116, 115, 115, 114, |
| 150047 | | - /* 360 */ 114, 114, 113, 418, 1127, 1467, 119, 120, 110, 1148, |
| 150048 | | - /* 370 */ 1148, 991, 994, 984, 984, 117, 117, 118, 118, 118, |
| 150049 | | - /* 380 */ 118, 1169, 82, 116, 116, 116, 116, 115, 115, 114, |
| 150050 | | - /* 390 */ 114, 114, 113, 418, 405, 112, 109, 209, 161, 445, |
| 150051 | | - /* 400 */ 250, 267, 336, 478, 331, 477, 236, 951, 1127, 386, |
| 150052 | | - /* 410 */ 888, 1521, 329, 822, 852, 162, 274, 1127, 1128, 1129, |
| 150053 | | - /* 420 */ 338, 169, 116, 116, 116, 116, 115, 115, 114, 114, |
| 150054 | | - /* 430 */ 114, 113, 418, 119, 120, 110, 1148, 1148, 991, 994, |
| 150055 | | - /* 440 */ 984, 984, 117, 117, 118, 118, 118, 118, 386, 438, |
| 150056 | | - /* 450 */ 312, 1502, 1112, 1176, 161, 288, 528, 311, 289, 883, |
| 150057 | | - /* 460 */ 134, 1127, 1128, 1129, 882, 537, 143, 1254, 288, 528, |
| 150058 | | - /* 470 */ 297, 275, 119, 120, 110, 1148, 1148, 991, 994, 984, |
| 150059 | | - /* 480 */ 984, 117, 117, 118, 118, 118, 118, 70, 70, 116, |
| 150060 | | - /* 490 */ 116, 116, 116, 115, 115, 114, 114, 114, 113, 418, |
| 150061 | | - /* 500 */ 264, 264, 12, 264, 264, 395, 1127, 483, 1473, 1094, |
| 150062 | | - /* 510 */ 204, 482, 6, 534, 1258, 386, 534, 1474, 825, 972, |
| 150063 | | - /* 520 */ 504, 6, 1094, 500, 95, 1094, 534, 219, 116, 116, |
| 150064 | | - /* 530 */ 116, 116, 115, 115, 114, 114, 114, 113, 418, 119, |
| 150065 | | - /* 540 */ 120, 110, 1148, 1148, 991, 994, 984, 984, 117, 117, |
| 150066 | | - /* 550 */ 118, 118, 118, 118, 386, 1339, 971, 422, 956, 1127, |
| 150067 | | - /* 560 */ 1128, 1129, 231, 512, 1473, 475, 472, 471, 6, 113, |
| 150068 | | - /* 570 */ 418, 825, 962, 298, 503, 470, 961, 452, 119, 120, |
| 150069 | | - /* 580 */ 110, 1148, 1148, 991, 994, 984, 984, 117, 117, 118, |
| 150070 | | - /* 590 */ 118, 118, 118, 395, 537, 116, 116, 116, 116, 115, |
| 150071 | | - /* 600 */ 115, 114, 114, 114, 113, 418, 202, 961, 961, 963, |
| 150072 | | - /* 610 */ 231, 971, 1127, 475, 472, 471, 13, 13, 951, 1127, |
| 150073 | | - /* 620 */ 834, 386, 1207, 470, 399, 183, 447, 962, 462, 162, |
| 150074 | | - /* 630 */ 397, 961, 1246, 1246, 116, 116, 116, 116, 115, 115, |
| 150075 | | - /* 640 */ 114, 114, 114, 113, 418, 119, 120, 110, 1148, 1148, |
| 150076 | | - /* 650 */ 991, 994, 984, 984, 117, 117, 118, 118, 118, 118, |
| 150077 | | - /* 660 */ 386, 271, 961, 961, 963, 1127, 1128, 1129, 311, 433, |
| 150078 | | - /* 670 */ 299, 1406, 1127, 1128, 1129, 178, 1471, 138, 162, 32, |
| 150079 | | - /* 680 */ 6, 1127, 288, 528, 119, 120, 110, 1148, 1148, 991, |
| 150080 | | - /* 690 */ 994, 984, 984, 117, 117, 118, 118, 118, 118, 909, |
| 150081 | | - /* 700 */ 390, 116, 116, 116, 116, 115, 115, 114, 114, 114, |
| 150082 | | - /* 710 */ 113, 418, 1127, 429, 817, 537, 1127, 265, 265, 981, |
| 150083 | | - /* 720 */ 981, 992, 995, 324, 1055, 93, 520, 5, 338, 537, |
| 150084 | | - /* 730 */ 534, 288, 528, 1522, 1127, 1128, 1129, 70, 70, 1056, |
| 150085 | | - /* 740 */ 116, 116, 116, 116, 115, 115, 114, 114, 114, 113, |
| 150086 | | - /* 750 */ 418, 70, 70, 1495, 1057, 537, 98, 1244, 1244, 264, |
| 150087 | | - /* 760 */ 264, 908, 371, 1076, 1127, 1127, 1128, 1129, 817, 1127, |
| 150088 | | - /* 770 */ 1128, 1129, 534, 519, 140, 863, 386, 13, 13, 456, |
| 150089 | | - /* 780 */ 192, 193, 521, 453, 319, 864, 322, 284, 365, 430, |
| 150090 | | - /* 790 */ 985, 402, 379, 1077, 1548, 101, 386, 1548, 3, 395, |
| 150091 | | - /* 800 */ 119, 120, 110, 1148, 1148, 991, 994, 984, 984, 117, |
| 150092 | | - /* 810 */ 117, 118, 118, 118, 118, 386, 451, 1127, 1128, 1129, |
| 150093 | | - /* 820 */ 119, 120, 110, 1148, 1148, 991, 994, 984, 984, 117, |
| 150094 | | - /* 830 */ 117, 118, 118, 118, 118, 1127, 1354, 1412, 1169, 119, |
| 150095 | | - /* 840 */ 108, 110, 1148, 1148, 991, 994, 984, 984, 117, 117, |
| 150096 | | - /* 850 */ 118, 118, 118, 118, 1412, 1414, 116, 116, 116, 116, |
| 150097 | | - /* 860 */ 115, 115, 114, 114, 114, 113, 418, 272, 535, 1075, |
| 150098 | | - /* 870 */ 877, 877, 337, 1492, 309, 462, 116, 116, 116, 116, |
| 150099 | | - /* 880 */ 115, 115, 114, 114, 114, 113, 418, 537, 1127, 1128, |
| 150100 | | - /* 890 */ 1129, 537, 360, 537, 356, 116, 116, 116, 116, 115, |
| 150101 | | - /* 900 */ 115, 114, 114, 114, 113, 418, 386, 264, 264, 13, |
| 150102 | | - /* 910 */ 13, 273, 1127, 13, 13, 13, 13, 304, 1253, 386, |
| 150103 | | - /* 920 */ 534, 1077, 1549, 404, 1412, 1549, 496, 277, 451, 186, |
| 150104 | | - /* 930 */ 1252, 120, 110, 1148, 1148, 991, 994, 984, 984, 117, |
| 150105 | | - /* 940 */ 117, 118, 118, 118, 118, 110, 1148, 1148, 991, 994, |
| 150106 | | - /* 950 */ 984, 984, 117, 117, 118, 118, 118, 118, 105, 529, |
| 150107 | | - /* 960 */ 537, 4, 1339, 264, 264, 1127, 1128, 1129, 1039, 1039, |
| 150108 | | - /* 970 */ 459, 795, 796, 797, 536, 532, 534, 242, 301, 807, |
| 150109 | | - /* 980 */ 303, 462, 69, 69, 451, 1353, 116, 116, 116, 116, |
| 150110 | | - /* 990 */ 115, 115, 114, 114, 114, 113, 418, 1075, 419, 116, |
| 150111 | | - /* 1000 */ 116, 116, 116, 115, 115, 114, 114, 114, 113, 418, |
| 150112 | | - /* 1010 */ 526, 537, 1146, 192, 350, 105, 529, 537, 4, 497, |
| 150113 | | - /* 1020 */ 162, 337, 1492, 310, 1249, 385, 1550, 372, 9, 462, |
| 150114 | | - /* 1030 */ 242, 400, 532, 13, 13, 499, 971, 843, 436, 70, |
| 150115 | | - /* 1040 */ 70, 359, 103, 103, 8, 339, 278, 187, 278, 104, |
| 150116 | | - /* 1050 */ 1127, 419, 539, 538, 1339, 419, 961, 302, 1339, 1172, |
| 150117 | | - /* 1060 */ 1, 1, 542, 2, 1176, 1146, 1146, 526, 476, 289, |
| 150118 | | - /* 1070 */ 30, 134, 317, 288, 528, 285, 844, 1014, 1254, 276, |
| 150119 | | - /* 1080 */ 1472, 506, 410, 1194, 6, 207, 505, 961, 961, 963, |
| 150120 | | - /* 1090 */ 964, 27, 449, 971, 415, 414, 234, 233, 232, 103, |
| 150121 | | - /* 1100 */ 103, 31, 1152, 1127, 1128, 1129, 104, 1154, 419, 539, |
| 150122 | | - /* 1110 */ 538, 264, 264, 961, 1399, 1153, 264, 264, 1470, 1146, |
| 150123 | | - /* 1120 */ 537, 216, 6, 401, 534, 1197, 392, 458, 406, 534, |
| 150124 | | - /* 1130 */ 537, 485, 358, 537, 261, 537, 1339, 907, 219, 1155, |
| 150125 | | - /* 1140 */ 467, 1155, 50, 50, 961, 961, 963, 964, 27, 1497, |
| 150126 | | - /* 1150 */ 1116, 421, 70, 70, 268, 70, 70, 13, 13, 369, |
| 150127 | | - /* 1160 */ 369, 368, 253, 366, 264, 264, 804, 235, 422, 105, |
| 150128 | | - /* 1170 */ 529, 516, 4, 287, 487, 510, 493, 534, 486, 213, |
| 150129 | | - /* 1180 */ 1055, 294, 490, 384, 1127, 450, 532, 338, 413, 293, |
| 150130 | | - /* 1190 */ 522, 417, 335, 1036, 509, 1056, 107, 1036, 16, 16, |
| 150131 | | - /* 1200 */ 1469, 1094, 334, 1105, 6, 411, 1145, 264, 264, 419, |
| 150132 | | - /* 1210 */ 1057, 102, 511, 100, 1094, 264, 264, 1094, 922, 215, |
| 150133 | | - /* 1220 */ 534, 526, 907, 264, 264, 208, 923, 154, 534, 457, |
| 150134 | | - /* 1230 */ 156, 525, 391, 142, 218, 506, 534, 1127, 1128, 1129, |
| 150135 | | - /* 1240 */ 507, 139, 1131, 38, 214, 530, 392, 971, 329, 1454, |
| 150136 | | - /* 1250 */ 907, 1105, 537, 103, 103, 105, 529, 537, 4, 537, |
| 150137 | | - /* 1260 */ 104, 424, 419, 539, 538, 537, 502, 961, 517, 537, |
| 150138 | | - /* 1270 */ 1072, 537, 532, 373, 54, 54, 288, 528, 387, 55, |
| 150139 | | - /* 1280 */ 55, 15, 15, 288, 528, 17, 136, 44, 44, 1451, |
| 150140 | | - /* 1290 */ 537, 56, 56, 57, 57, 419, 1131, 291, 961, 961, |
| 150141 | | - /* 1300 */ 963, 964, 27, 393, 163, 537, 426, 526, 263, 206, |
| 150142 | | - /* 1310 */ 208, 517, 58, 58, 235, 440, 842, 841, 197, 105, |
| 150143 | | - /* 1320 */ 529, 506, 4, 1033, 439, 1033, 505, 59, 59, 308, |
| 150144 | | - /* 1330 */ 849, 850, 95, 971, 537, 907, 532, 948, 832, 103, |
| 150145 | | - /* 1340 */ 103, 105, 529, 537, 4, 1021, 104, 537, 419, 539, |
| 150146 | | - /* 1350 */ 538, 1116, 421, 961, 537, 268, 60, 60, 532, 419, |
| 150147 | | - /* 1360 */ 369, 369, 368, 253, 366, 61, 61, 804, 965, 45, |
| 150148 | | - /* 1370 */ 45, 526, 537, 1032, 1277, 1032, 46, 46, 537, 391, |
| 150149 | | - /* 1380 */ 213, 419, 294, 266, 961, 961, 963, 964, 27, 292, |
| 150150 | | - /* 1390 */ 293, 295, 832, 526, 48, 48, 1290, 971, 1289, 1021, |
| 150151 | | - /* 1400 */ 49, 49, 432, 103, 103, 887, 953, 537, 1457, 241, |
| 150152 | | - /* 1410 */ 104, 305, 419, 539, 538, 925, 926, 961, 444, 971, |
| 150153 | | - /* 1420 */ 215, 241, 965, 1224, 537, 103, 103, 1431, 154, 62, |
| 150154 | | - /* 1430 */ 62, 156, 104, 1430, 419, 539, 538, 97, 529, 961, |
| 150155 | | - /* 1440 */ 4, 537, 454, 537, 314, 214, 63, 63, 961, 961, |
| 150156 | | - /* 1450 */ 963, 964, 27, 537, 532, 446, 1286, 318, 241, 537, |
| 150157 | | - /* 1460 */ 321, 323, 325, 64, 64, 14, 14, 1237, 537, 1223, |
| 150158 | | - /* 1470 */ 961, 961, 963, 964, 27, 65, 65, 419, 537, 387, |
| 150159 | | - /* 1480 */ 537, 125, 125, 537, 288, 528, 537, 1486, 537, 526, |
| 150160 | | - /* 1490 */ 66, 66, 313, 524, 537, 95, 468, 1221, 1511, 237, |
| 150161 | | - /* 1500 */ 51, 51, 67, 67, 330, 68, 68, 426, 52, 52, |
| 150162 | | - /* 1510 */ 149, 149, 1222, 340, 341, 971, 150, 150, 1298, 463, |
| 150163 | | - /* 1520 */ 327, 103, 103, 95, 537, 1338, 1273, 537, 104, 537, |
| 150164 | | - /* 1530 */ 419, 539, 538, 1284, 537, 961, 268, 283, 523, 1344, |
| 150165 | | - /* 1540 */ 1204, 369, 369, 368, 253, 366, 75, 75, 804, 53, |
| 150166 | | - /* 1550 */ 53, 71, 71, 537, 1196, 537, 126, 126, 537, 1017, |
| 150167 | | - /* 1560 */ 537, 213, 237, 294, 537, 1185, 961, 961, 963, 964, |
| 150168 | | - /* 1570 */ 27, 293, 537, 1184, 537, 72, 72, 127, 127, 1186, |
| 150169 | | - /* 1580 */ 128, 128, 124, 124, 1505, 537, 148, 148, 537, 256, |
| 150170 | | - /* 1590 */ 195, 537, 1270, 537, 147, 147, 132, 132, 537, 11, |
| 150171 | | - /* 1600 */ 537, 215, 537, 199, 343, 345, 347, 131, 131, 154, |
| 150172 | | - /* 1610 */ 129, 129, 156, 130, 130, 74, 74, 537, 370, 1323, |
| 150173 | | - /* 1620 */ 76, 76, 73, 73, 43, 43, 214, 431, 211, 1331, |
| 150174 | | - /* 1630 */ 300, 916, 880, 815, 241, 107, 137, 307, 881, 47, |
| 150175 | | - /* 1640 */ 47, 107, 473, 378, 203, 448, 333, 1403, 1220, 1402, |
| 150176 | | - /* 1650 */ 349, 190, 527, 191, 363, 198, 1508, 1163, 245, 165, |
| 150177 | | - /* 1660 */ 387, 1450, 1448, 1160, 78, 288, 528, 1408, 81, 394, |
| 150178 | | - /* 1670 */ 82, 442, 175, 159, 167, 93, 1328, 35, 1320, 434, |
| 150179 | | - /* 1680 */ 170, 171, 172, 173, 435, 466, 221, 375, 426, 377, |
| 150180 | | - /* 1690 */ 1334, 179, 455, 441, 1397, 225, 87, 36, 461, 1419, |
| 150181 | | - /* 1700 */ 316, 257, 227, 184, 320, 464, 228, 479, 1187, 229, |
| 150182 | | - /* 1710 */ 380, 1240, 1239, 407, 1238, 1212, 834, 332, 1231, 381, |
| 150183 | | - /* 1720 */ 409, 1211, 204, 1210, 1491, 498, 1520, 1281, 92, 281, |
| 150184 | | - /* 1730 */ 1230, 489, 282, 492, 342, 243, 1282, 344, 244, 1280, |
| 150185 | | - /* 1740 */ 346, 412, 1279, 1477, 348, 122, 1476, 517, 10, 357, |
| 150186 | | - /* 1750 */ 286, 1305, 1304, 99, 1383, 94, 501, 251, 1193, 34, |
| 150187 | | - /* 1760 */ 1263, 355, 540, 194, 1262, 361, 362, 1122, 252, 254, |
| 150188 | | - /* 1770 */ 255, 388, 541, 1182, 1177, 151, 1435, 389, 1436, 1434, |
| 150189 | | - /* 1780 */ 1433, 791, 152, 135, 279, 200, 201, 420, 196, 77, |
| 150190 | | - /* 1790 */ 153, 290, 269, 210, 1031, 133, 1029, 945, 166, 155, |
| 150191 | | - /* 1800 */ 217, 168, 866, 306, 220, 1045, 174, 949, 157, 396, |
| 150192 | | - /* 1810 */ 83, 398, 176, 84, 85, 164, 86, 158, 1048, 222, |
| 150193 | | - /* 1820 */ 223, 1044, 144, 18, 224, 315, 1037, 180, 241, 460, |
| 150194 | | - /* 1830 */ 1157, 226, 181, 37, 806, 465, 334, 230, 328, 469, |
| 150195 | | - /* 1840 */ 182, 88, 474, 19, 20, 160, 89, 280, 145, 90, |
| 150196 | | - /* 1850 */ 481, 845, 1110, 146, 997, 205, 1080, 39, 91, 40, |
| 150197 | | - /* 1860 */ 488, 1081, 915, 491, 260, 262, 185, 910, 240, 107, |
| 150198 | | - /* 1870 */ 1100, 1096, 1098, 1104, 21, 1084, 33, 513, 247, 22, |
| 150199 | | - /* 1880 */ 23, 24, 1103, 25, 188, 95, 1012, 998, 996, 26, |
| 150200 | | - /* 1890 */ 1000, 1054, 7, 1053, 1001, 246, 28, 41, 533, 966, |
| 150201 | | - /* 1900 */ 816, 106, 29, 367, 248, 249, 1513, 1512, 364, 1117, |
| 150202 | | - /* 1910 */ 1173, 1173, 876, |
| 151117 | + /* 0 */ 544, 1219, 544, 449, 1257, 544, 1236, 544, 114, 111, |
| 151118 | + /* 10 */ 211, 544, 1534, 544, 1257, 521, 114, 111, 211, 390, |
| 151119 | + /* 20 */ 1229, 342, 42, 42, 42, 42, 1222, 42, 42, 71, |
| 151120 | + /* 30 */ 71, 934, 1221, 71, 71, 71, 71, 1459, 1490, 935, |
| 151121 | + /* 40 */ 817, 451, 6, 121, 122, 112, 1162, 1162, 1003, 1006, |
| 151122 | + /* 50 */ 996, 996, 119, 119, 120, 120, 120, 120, 1540, 390, |
| 151123 | + /* 60 */ 1355, 1514, 549, 2, 1190, 194, 526, 434, 143, 291, |
| 151124 | + /* 70 */ 526, 136, 526, 369, 261, 502, 272, 383, 1270, 525, |
| 151125 | + /* 80 */ 501, 491, 164, 121, 122, 112, 1162, 1162, 1003, 1006, |
| 151126 | + /* 90 */ 996, 996, 119, 119, 120, 120, 120, 120, 1355, 440, |
| 151127 | + /* 100 */ 1511, 118, 118, 118, 118, 117, 117, 116, 116, 116, |
| 151128 | + /* 110 */ 115, 422, 266, 266, 266, 266, 1495, 356, 1497, 433, |
| 151129 | + /* 120 */ 355, 1495, 515, 522, 1482, 541, 1111, 541, 1111, 390, |
| 151130 | + /* 130 */ 403, 241, 208, 114, 111, 211, 98, 290, 535, 221, |
| 151131 | + /* 140 */ 1026, 118, 118, 118, 118, 117, 117, 116, 116, 116, |
| 151132 | + /* 150 */ 115, 422, 1139, 121, 122, 112, 1162, 1162, 1003, 1006, |
| 151133 | + /* 160 */ 996, 996, 119, 119, 120, 120, 120, 120, 404, 426, |
| 151134 | + /* 170 */ 117, 117, 116, 116, 116, 115, 422, 1415, 466, 123, |
| 151135 | + /* 180 */ 118, 118, 118, 118, 117, 117, 116, 116, 116, 115, |
| 151136 | + /* 190 */ 422, 116, 116, 116, 115, 422, 538, 538, 538, 390, |
| 151137 | + /* 200 */ 503, 120, 120, 120, 120, 113, 1048, 1139, 1140, 1141, |
| 151138 | + /* 210 */ 1048, 118, 118, 118, 118, 117, 117, 116, 116, 116, |
| 151139 | + /* 220 */ 115, 422, 1458, 121, 122, 112, 1162, 1162, 1003, 1006, |
| 151140 | + /* 230 */ 996, 996, 119, 119, 120, 120, 120, 120, 390, 442, |
| 151141 | + /* 240 */ 314, 83, 461, 81, 357, 380, 1139, 80, 118, 118, |
| 151142 | + /* 250 */ 118, 118, 117, 117, 116, 116, 116, 115, 422, 179, |
| 151143 | + /* 260 */ 432, 422, 121, 122, 112, 1162, 1162, 1003, 1006, 996, |
| 151144 | + /* 270 */ 996, 119, 119, 120, 120, 120, 120, 432, 431, 266, |
| 151145 | + /* 280 */ 266, 118, 118, 118, 118, 117, 117, 116, 116, 116, |
| 151146 | + /* 290 */ 115, 422, 541, 1106, 900, 504, 1139, 114, 111, 211, |
| 151147 | + /* 300 */ 1428, 1139, 1140, 1141, 206, 489, 1106, 390, 447, 1106, |
| 151148 | + /* 310 */ 543, 328, 120, 120, 120, 120, 298, 1428, 1430, 17, |
| 151149 | + /* 320 */ 118, 118, 118, 118, 117, 117, 116, 116, 116, 115, |
| 151150 | + /* 330 */ 422, 121, 122, 112, 1162, 1162, 1003, 1006, 996, 996, |
| 151151 | + /* 340 */ 119, 119, 120, 120, 120, 120, 390, 1355, 432, 1139, |
| 151152 | + /* 350 */ 480, 1139, 1140, 1141, 993, 993, 1004, 1007, 443, 118, |
| 151153 | + /* 360 */ 118, 118, 118, 117, 117, 116, 116, 116, 115, 422, |
| 151154 | + /* 370 */ 121, 122, 112, 1162, 1162, 1003, 1006, 996, 996, 119, |
| 151155 | + /* 380 */ 119, 120, 120, 120, 120, 1051, 1051, 463, 1428, 118, |
| 151156 | + /* 390 */ 118, 118, 118, 117, 117, 116, 116, 116, 115, 422, |
| 151157 | + /* 400 */ 1139, 449, 544, 1423, 1139, 1140, 1141, 233, 963, 1139, |
| 151158 | + /* 410 */ 479, 476, 475, 171, 358, 390, 164, 405, 412, 839, |
| 151159 | + /* 420 */ 474, 164, 185, 332, 71, 71, 1240, 997, 118, 118, |
| 151160 | + /* 430 */ 118, 118, 117, 117, 116, 116, 116, 115, 422, 121, |
| 151161 | + /* 440 */ 122, 112, 1162, 1162, 1003, 1006, 996, 996, 119, 119, |
| 151162 | + /* 450 */ 120, 120, 120, 120, 390, 1139, 1140, 1141, 832, 12, |
| 151163 | + /* 460 */ 313, 507, 163, 354, 1139, 1140, 1141, 114, 111, 211, |
| 151164 | + /* 470 */ 506, 290, 535, 544, 276, 180, 290, 535, 121, 122, |
| 151165 | + /* 480 */ 112, 1162, 1162, 1003, 1006, 996, 996, 119, 119, 120, |
| 151166 | + /* 490 */ 120, 120, 120, 343, 482, 71, 71, 118, 118, 118, |
| 151167 | + /* 500 */ 118, 117, 117, 116, 116, 116, 115, 422, 1139, 209, |
| 151168 | + /* 510 */ 409, 521, 1139, 1106, 1568, 376, 252, 269, 340, 485, |
| 151169 | + /* 520 */ 335, 484, 238, 390, 511, 362, 1106, 1124, 331, 1106, |
| 151170 | + /* 530 */ 191, 407, 286, 32, 455, 441, 118, 118, 118, 118, |
| 151171 | + /* 540 */ 117, 117, 116, 116, 116, 115, 422, 121, 122, 112, |
| 151172 | + /* 550 */ 1162, 1162, 1003, 1006, 996, 996, 119, 119, 120, 120, |
| 151173 | + /* 560 */ 120, 120, 390, 1139, 1140, 1141, 984, 1139, 1140, 1141, |
| 151174 | + /* 570 */ 1139, 233, 490, 1489, 479, 476, 475, 6, 163, 544, |
| 151175 | + /* 580 */ 510, 544, 115, 422, 474, 5, 121, 122, 112, 1162, |
| 151176 | + /* 590 */ 1162, 1003, 1006, 996, 996, 119, 119, 120, 120, 120, |
| 151177 | + /* 600 */ 120, 13, 13, 13, 13, 118, 118, 118, 118, 117, |
| 151178 | + /* 610 */ 117, 116, 116, 116, 115, 422, 401, 500, 406, 544, |
| 151179 | + /* 620 */ 1483, 542, 1139, 889, 889, 1139, 1140, 1141, 1470, 1139, |
| 151180 | + /* 630 */ 275, 390, 805, 806, 807, 968, 420, 420, 420, 16, |
| 151181 | + /* 640 */ 16, 55, 55, 1239, 118, 118, 118, 118, 117, 117, |
| 151182 | + /* 650 */ 116, 116, 116, 115, 422, 121, 122, 112, 1162, 1162, |
| 151183 | + /* 660 */ 1003, 1006, 996, 996, 119, 119, 120, 120, 120, 120, |
| 151184 | + /* 670 */ 390, 1186, 1, 1, 549, 2, 1190, 1139, 1140, 1141, |
| 151185 | + /* 680 */ 194, 291, 895, 136, 1139, 1140, 1141, 894, 519, 1489, |
| 151186 | + /* 690 */ 1270, 3, 378, 6, 121, 122, 112, 1162, 1162, 1003, |
| 151187 | + /* 700 */ 1006, 996, 996, 119, 119, 120, 120, 120, 120, 855, |
| 151188 | + /* 710 */ 544, 921, 544, 118, 118, 118, 118, 117, 117, 116, |
| 151189 | + /* 720 */ 116, 116, 115, 422, 266, 266, 1089, 1566, 1139, 1518, |
| 151190 | + /* 730 */ 1566, 1190, 13, 13, 13, 13, 291, 541, 136, 390, |
| 151191 | + /* 740 */ 483, 419, 418, 963, 342, 1270, 466, 408, 856, 279, |
| 151192 | + /* 750 */ 140, 221, 118, 118, 118, 118, 117, 117, 116, 116, |
| 151193 | + /* 760 */ 116, 115, 422, 121, 122, 112, 1162, 1162, 1003, 1006, |
| 151194 | + /* 770 */ 996, 996, 119, 119, 120, 120, 120, 120, 544, 266, |
| 151195 | + /* 780 */ 266, 426, 390, 1139, 1140, 1141, 1169, 827, 1169, 466, |
| 151196 | + /* 790 */ 429, 145, 541, 1143, 399, 313, 437, 301, 835, 1487, |
| 151197 | + /* 800 */ 71, 71, 410, 6, 1087, 471, 221, 100, 112, 1162, |
| 151198 | + /* 810 */ 1162, 1003, 1006, 996, 996, 119, 119, 120, 120, 120, |
| 151199 | + /* 820 */ 120, 118, 118, 118, 118, 117, 117, 116, 116, 116, |
| 151200 | + /* 830 */ 115, 422, 237, 1422, 544, 449, 426, 287, 983, 544, |
| 151201 | + /* 840 */ 236, 235, 234, 827, 97, 527, 427, 1262, 1262, 1143, |
| 151202 | + /* 850 */ 492, 306, 428, 835, 974, 544, 71, 71, 973, 1238, |
| 151203 | + /* 860 */ 544, 51, 51, 300, 118, 118, 118, 118, 117, 117, |
| 151204 | + /* 870 */ 116, 116, 116, 115, 422, 194, 103, 70, 70, 266, |
| 151205 | + /* 880 */ 266, 544, 71, 71, 266, 266, 30, 389, 342, 973, |
| 151206 | + /* 890 */ 973, 975, 541, 526, 1106, 326, 390, 541, 493, 395, |
| 151207 | + /* 900 */ 1467, 195, 528, 13, 13, 1355, 240, 1106, 277, 280, |
| 151208 | + /* 910 */ 1106, 280, 303, 455, 305, 331, 390, 31, 188, 417, |
| 151209 | + /* 920 */ 121, 122, 112, 1162, 1162, 1003, 1006, 996, 996, 119, |
| 151210 | + /* 930 */ 119, 120, 120, 120, 120, 142, 390, 363, 455, 983, |
| 151211 | + /* 940 */ 121, 122, 112, 1162, 1162, 1003, 1006, 996, 996, 119, |
| 151212 | + /* 950 */ 119, 120, 120, 120, 120, 974, 321, 1139, 324, 973, |
| 151213 | + /* 960 */ 121, 110, 112, 1162, 1162, 1003, 1006, 996, 996, 119, |
| 151214 | + /* 970 */ 119, 120, 120, 120, 120, 462, 375, 1182, 118, 118, |
| 151215 | + /* 980 */ 118, 118, 117, 117, 116, 116, 116, 115, 422, 1139, |
| 151216 | + /* 990 */ 973, 973, 975, 304, 9, 364, 244, 360, 118, 118, |
| 151217 | + /* 1000 */ 118, 118, 117, 117, 116, 116, 116, 115, 422, 312, |
| 151218 | + /* 1010 */ 544, 342, 1139, 1140, 1141, 299, 290, 535, 118, 118, |
| 151219 | + /* 1020 */ 118, 118, 117, 117, 116, 116, 116, 115, 422, 1260, |
| 151220 | + /* 1030 */ 1260, 1160, 13, 13, 278, 419, 418, 466, 390, 920, |
| 151221 | + /* 1040 */ 260, 260, 289, 1166, 1139, 1140, 1141, 189, 1168, 266, |
| 151222 | + /* 1050 */ 266, 466, 388, 541, 1183, 544, 1167, 263, 144, 487, |
| 151223 | + /* 1060 */ 919, 544, 541, 122, 112, 1162, 1162, 1003, 1006, 996, |
| 151224 | + /* 1070 */ 996, 119, 119, 120, 120, 120, 120, 71, 71, 1139, |
| 151225 | + /* 1080 */ 1169, 1269, 1169, 13, 13, 895, 1067, 1160, 544, 466, |
| 151226 | + /* 1090 */ 894, 107, 536, 1488, 4, 1265, 1106, 6, 523, 1046, |
| 151227 | + /* 1100 */ 12, 1068, 1089, 1567, 311, 453, 1567, 518, 539, 1106, |
| 151228 | + /* 1110 */ 56, 56, 1106, 1486, 421, 1355, 1069, 6, 343, 285, |
| 151229 | + /* 1120 */ 118, 118, 118, 118, 117, 117, 116, 116, 116, 115, |
| 151230 | + /* 1130 */ 422, 423, 1268, 319, 1139, 1140, 1141, 875, 266, 266, |
| 151231 | + /* 1140 */ 1274, 107, 536, 533, 4, 1485, 293, 876, 1208, 6, |
| 151232 | + /* 1150 */ 210, 541, 541, 164, 1539, 494, 414, 864, 539, 267, |
| 151233 | + /* 1160 */ 267, 1211, 396, 509, 497, 204, 266, 266, 394, 529, |
| 151234 | + /* 1170 */ 8, 983, 541, 517, 544, 919, 456, 105, 105, 541, |
| 151235 | + /* 1180 */ 1087, 423, 266, 266, 106, 415, 423, 546, 545, 266, |
| 151236 | + /* 1190 */ 266, 973, 516, 533, 1370, 541, 15, 15, 266, 266, |
| 151237 | + /* 1200 */ 454, 1117, 541, 266, 266, 1067, 1369, 513, 290, 535, |
| 151238 | + /* 1210 */ 544, 541, 512, 97, 442, 314, 541, 544, 919, 125, |
| 151239 | + /* 1220 */ 1068, 983, 973, 973, 975, 976, 27, 105, 105, 399, |
| 151240 | + /* 1230 */ 341, 1508, 44, 44, 106, 1069, 423, 546, 545, 57, |
| 151241 | + /* 1240 */ 57, 973, 341, 1508, 107, 536, 544, 4, 460, 399, |
| 151242 | + /* 1250 */ 214, 1117, 457, 294, 375, 1088, 532, 297, 544, 537, |
| 151243 | + /* 1260 */ 396, 539, 290, 535, 104, 244, 102, 524, 58, 58, |
| 151244 | + /* 1270 */ 544, 109, 973, 973, 975, 976, 27, 1513, 1128, 425, |
| 151245 | + /* 1280 */ 59, 59, 270, 237, 423, 138, 95, 373, 373, 372, |
| 151246 | + /* 1290 */ 255, 370, 60, 60, 814, 1177, 533, 544, 273, 544, |
| 151247 | + /* 1300 */ 1160, 842, 387, 386, 544, 1306, 544, 215, 210, 296, |
| 151248 | + /* 1310 */ 513, 846, 544, 265, 208, 514, 1305, 295, 274, 61, |
| 151249 | + /* 1320 */ 61, 62, 62, 436, 983, 1159, 45, 45, 46, 46, |
| 151250 | + /* 1330 */ 105, 105, 1183, 919, 47, 47, 1473, 106, 544, 423, |
| 151251 | + /* 1340 */ 546, 545, 218, 544, 973, 934, 1084, 217, 544, 377, |
| 151252 | + /* 1350 */ 395, 107, 536, 935, 4, 156, 1160, 842, 158, 544, |
| 151253 | + /* 1360 */ 49, 49, 141, 544, 38, 50, 50, 544, 539, 307, |
| 151254 | + /* 1370 */ 63, 63, 544, 1447, 216, 973, 973, 975, 976, 27, |
| 151255 | + /* 1380 */ 444, 64, 64, 544, 1446, 65, 65, 544, 524, 14, |
| 151256 | + /* 1390 */ 14, 423, 458, 544, 66, 66, 310, 544, 316, 97, |
| 151257 | + /* 1400 */ 1033, 544, 960, 533, 268, 127, 127, 544, 391, 67, |
| 151258 | + /* 1410 */ 67, 544, 977, 290, 535, 52, 52, 513, 544, 68, |
| 151259 | + /* 1420 */ 68, 1293, 512, 69, 69, 397, 165, 854, 853, 53, |
| 151260 | + /* 1430 */ 53, 983, 965, 151, 151, 243, 430, 105, 105, 199, |
| 151261 | + /* 1440 */ 152, 152, 448, 1302, 106, 243, 423, 546, 545, 1128, |
| 151262 | + /* 1450 */ 425, 973, 320, 270, 861, 862, 1033, 220, 373, 373, |
| 151263 | + /* 1460 */ 372, 255, 370, 450, 323, 814, 243, 544, 977, 544, |
| 151264 | + /* 1470 */ 107, 536, 544, 4, 544, 937, 938, 325, 215, 1045, |
| 151265 | + /* 1480 */ 296, 1045, 973, 973, 975, 976, 27, 539, 295, 76, |
| 151266 | + /* 1490 */ 76, 54, 54, 327, 72, 72, 128, 128, 1502, 1253, |
| 151267 | + /* 1500 */ 107, 536, 544, 4, 1044, 544, 1044, 531, 1237, 544, |
| 151268 | + /* 1510 */ 423, 544, 315, 334, 544, 97, 544, 539, 217, 544, |
| 151269 | + /* 1520 */ 472, 1527, 533, 239, 73, 73, 156, 129, 129, 158, |
| 151270 | + /* 1530 */ 467, 130, 130, 126, 126, 344, 150, 150, 149, 149, |
| 151271 | + /* 1540 */ 423, 134, 134, 329, 1029, 216, 97, 239, 928, 345, |
| 151272 | + /* 1550 */ 983, 243, 533, 1314, 339, 544, 105, 105, 899, 1354, |
| 151273 | + /* 1560 */ 544, 1289, 258, 106, 338, 423, 546, 545, 544, 1300, |
| 151274 | + /* 1570 */ 973, 892, 99, 536, 109, 4, 544, 133, 133, 391, |
| 151275 | + /* 1580 */ 983, 197, 131, 131, 290, 535, 105, 105, 530, 539, |
| 151276 | + /* 1590 */ 132, 132, 1360, 106, 1218, 423, 546, 545, 75, 75, |
| 151277 | + /* 1600 */ 973, 973, 973, 975, 976, 27, 544, 430, 825, 1210, |
| 151278 | + /* 1610 */ 893, 139, 423, 109, 544, 1199, 1198, 1200, 1521, 544, |
| 151279 | + /* 1620 */ 201, 544, 11, 374, 533, 1286, 347, 349, 77, 77, |
| 151280 | + /* 1630 */ 1339, 973, 973, 975, 976, 27, 74, 74, 351, 213, |
| 151281 | + /* 1640 */ 435, 43, 43, 48, 48, 302, 477, 309, 1347, 382, |
| 151282 | + /* 1650 */ 353, 452, 983, 337, 1236, 1419, 1418, 205, 105, 105, |
| 151283 | + /* 1660 */ 192, 367, 193, 534, 1524, 106, 1177, 423, 546, 545, |
| 151284 | + /* 1670 */ 247, 167, 973, 270, 1466, 200, 1464, 1174, 373, 373, |
| 151285 | + /* 1680 */ 372, 255, 370, 398, 79, 814, 83, 82, 1424, 446, |
| 151286 | + /* 1690 */ 161, 177, 169, 95, 1336, 438, 172, 173, 215, 174, |
| 151287 | + /* 1700 */ 296, 175, 35, 973, 973, 975, 976, 27, 295, 1344, |
| 151288 | + /* 1710 */ 439, 470, 223, 36, 379, 445, 1413, 381, 459, 1350, |
| 151289 | + /* 1720 */ 181, 227, 88, 465, 259, 229, 1435, 318, 186, 468, |
| 151290 | + /* 1730 */ 322, 230, 384, 1201, 231, 486, 1256, 1255, 217, 411, |
| 151291 | + /* 1740 */ 1254, 1247, 90, 846, 206, 413, 156, 505, 1538, 158, |
| 151292 | + /* 1750 */ 1225, 1537, 283, 1507, 1226, 336, 385, 284, 1224, 496, |
| 151293 | + /* 1760 */ 1536, 1297, 94, 346, 348, 216, 1246, 499, 1298, 245, |
| 151294 | + /* 1770 */ 246, 1296, 416, 350, 1493, 124, 1492, 10, 524, 361, |
| 151295 | + /* 1780 */ 1399, 101, 96, 288, 508, 253, 1134, 1207, 34, 1295, |
| 151296 | + /* 1790 */ 547, 254, 256, 257, 392, 548, 1196, 1191, 359, 391, |
| 151297 | + /* 1800 */ 1279, 1278, 196, 365, 290, 535, 366, 352, 1451, 1321, |
| 151298 | + /* 1810 */ 1320, 1452, 153, 137, 281, 154, 801, 424, 155, 1450, |
| 151299 | + /* 1820 */ 1449, 198, 292, 202, 203, 78, 212, 430, 271, 135, |
| 151300 | + /* 1830 */ 1043, 1041, 957, 168, 219, 157, 170, 878, 308, 222, |
| 151301 | + /* 1840 */ 1057, 176, 159, 961, 400, 84, 402, 178, 85, 86, |
| 151302 | + /* 1850 */ 87, 166, 160, 393, 1060, 224, 225, 1056, 146, 18, |
| 151303 | + /* 1860 */ 226, 317, 1049, 1171, 243, 464, 182, 228, 37, 183, |
| 151304 | + /* 1870 */ 816, 469, 338, 232, 330, 481, 184, 89, 844, 19, |
| 151305 | + /* 1880 */ 20, 92, 473, 478, 333, 91, 162, 857, 147, 488, |
| 151306 | + /* 1890 */ 282, 1122, 148, 1009, 927, 1092, 39, 93, 40, 495, |
| 151307 | + /* 1900 */ 1093, 187, 498, 207, 262, 264, 922, 242, 1108, 109, |
| 151308 | + /* 1910 */ 1112, 1110, 1096, 33, 21, 1116, 520, 1024, 22, 23, |
| 151309 | + /* 1920 */ 24, 1115, 25, 190, 97, 1010, 1008, 26, 1012, 1066, |
| 151310 | + /* 1930 */ 248, 7, 1065, 249, 1013, 28, 41, 888, 978, 826, |
| 151311 | + /* 1940 */ 108, 29, 250, 540, 251, 1529, 371, 368, 1129, 1187, |
| 151312 | + /* 1950 */ 1187, 1187, 1187, 1187, 1187, 1187, 1187, 1528, |
| 150203 | 151313 | }; |
| 150204 | 151314 | static const YYCODETYPE yy_lookahead[] = { |
| 150205 | | - /* 0 */ 187, 187, 187, 216, 217, 187, 206, 187, 264, 265, |
| 150206 | | - /* 10 */ 266, 187, 225, 187, 209, 187, 264, 265, 266, 19, |
| 150207 | | - /* 20 */ 187, 187, 209, 210, 209, 210, 187, 209, 210, 209, |
| 150208 | | - /* 30 */ 210, 31, 209, 209, 210, 209, 210, 285, 224, 39, |
| 150209 | | - /* 40 */ 203, 204, 205, 43, 44, 45, 46, 47, 48, 49, |
| 150210 | | - /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 230, 19, |
| 150211 | | - /* 60 */ 181, 182, 183, 184, 230, 245, 233, 208, 189, 245, |
| 150212 | | - /* 70 */ 191, 245, 26, 206, 254, 216, 276, 198, 254, 198, |
| 150213 | | - /* 80 */ 254, 281, 187, 43, 44, 45, 46, 47, 48, 49, |
| 150214 | | - /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 259, 99, |
| 150215 | | - /* 100 */ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, |
| 150216 | | - /* 110 */ 231, 232, 231, 232, 286, 302, 303, 302, 22, 304, |
| 150217 | | - /* 120 */ 302, 303, 76, 244, 11, 244, 86, 19, 88, 248, |
| 150218 | | - /* 130 */ 249, 264, 265, 266, 26, 89, 198, 258, 92, 99, |
| 150219 | | - /* 140 */ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, |
| 150220 | | - /* 150 */ 105, 43, 44, 45, 46, 47, 48, 49, 50, 51, |
| 150221 | | - /* 160 */ 52, 53, 54, 55, 56, 57, 212, 288, 273, 231, |
| 150222 | | - /* 170 */ 232, 105, 106, 107, 108, 109, 131, 69, 203, 204, |
| 150223 | | - /* 180 */ 205, 136, 244, 99, 100, 101, 102, 103, 104, 105, |
| 150224 | | - /* 190 */ 106, 107, 108, 109, 15, 103, 104, 19, 260, 103, |
| 150225 | | - /* 200 */ 104, 54, 55, 56, 57, 58, 22, 99, 100, 101, |
| 150226 | | - /* 210 */ 102, 103, 104, 105, 106, 107, 108, 109, 264, 265, |
| 150227 | | - /* 220 */ 266, 43, 44, 45, 46, 47, 48, 49, 50, 51, |
| 150228 | | - /* 230 */ 52, 53, 54, 55, 56, 57, 19, 124, 125, 60, |
| 150229 | | - /* 240 */ 148, 24, 150, 59, 187, 67, 99, 100, 101, 102, |
| 150230 | | - /* 250 */ 103, 104, 105, 106, 107, 108, 109, 187, 187, 109, |
| 150231 | | - /* 260 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 150232 | | - /* 270 */ 53, 54, 55, 56, 57, 204, 205, 99, 100, 101, |
| 150233 | | - /* 280 */ 102, 103, 104, 105, 106, 107, 108, 109, 103, 104, |
| 150234 | | - /* 290 */ 105, 106, 107, 108, 109, 59, 112, 113, 114, 76, |
| 150235 | | - /* 300 */ 231, 232, 187, 19, 19, 22, 23, 23, 54, 55, |
| 150236 | | - /* 310 */ 56, 57, 89, 244, 199, 92, 99, 100, 101, 102, |
| 150237 | | - /* 320 */ 103, 104, 105, 106, 107, 108, 109, 43, 44, 45, |
| 150238 | | - /* 330 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, |
| 150239 | | - /* 340 */ 56, 57, 19, 212, 187, 274, 23, 26, 112, 113, |
| 150240 | | - /* 350 */ 114, 294, 295, 99, 100, 101, 102, 103, 104, 105, |
| 150241 | | - /* 360 */ 106, 107, 108, 109, 59, 295, 43, 44, 45, 46, |
| 150242 | | - /* 370 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 150243 | | - /* 380 */ 57, 98, 146, 99, 100, 101, 102, 103, 104, 105, |
| 150244 | | - /* 390 */ 106, 107, 108, 109, 109, 264, 265, 266, 187, 187, |
| 150245 | | - /* 400 */ 115, 116, 117, 118, 119, 120, 121, 73, 59, 19, |
| 150246 | | - /* 410 */ 105, 23, 127, 23, 26, 81, 259, 112, 113, 114, |
| 150247 | | - /* 420 */ 187, 72, 99, 100, 101, 102, 103, 104, 105, 106, |
| 150248 | | - /* 430 */ 107, 108, 109, 43, 44, 45, 46, 47, 48, 49, |
| 150249 | | - /* 440 */ 50, 51, 52, 53, 54, 55, 56, 57, 19, 124, |
| 150250 | | - /* 450 */ 125, 182, 23, 184, 187, 134, 135, 123, 189, 131, |
| 150251 | | - /* 460 */ 191, 112, 113, 114, 136, 187, 233, 198, 134, 135, |
| 150252 | | - /* 470 */ 198, 259, 43, 44, 45, 46, 47, 48, 49, 50, |
| 150253 | | - /* 480 */ 51, 52, 53, 54, 55, 56, 57, 209, 210, 99, |
| 150254 | | - /* 490 */ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, |
| 150255 | | - /* 500 */ 231, 232, 206, 231, 232, 187, 59, 296, 297, 76, |
| 150256 | | - /* 510 */ 160, 161, 301, 244, 232, 19, 244, 297, 59, 23, |
| 150257 | | - /* 520 */ 87, 301, 89, 245, 26, 92, 244, 258, 99, 100, |
| 150258 | | - /* 530 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 43, |
| 150259 | | - /* 540 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
| 150260 | | - /* 550 */ 54, 55, 56, 57, 19, 187, 97, 288, 23, 112, |
| 150261 | | - /* 560 */ 113, 114, 115, 296, 297, 118, 119, 120, 301, 108, |
| 150262 | | - /* 570 */ 109, 112, 113, 255, 141, 128, 117, 281, 43, 44, |
| 150263 | | - /* 580 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 150264 | | - /* 590 */ 55, 56, 57, 187, 187, 99, 100, 101, 102, 103, |
| 150265 | | - /* 600 */ 104, 105, 106, 107, 108, 109, 26, 148, 149, 150, |
| 150266 | | - /* 610 */ 115, 97, 59, 118, 119, 120, 209, 210, 73, 59, |
| 150267 | | - /* 620 */ 122, 19, 209, 128, 256, 72, 187, 113, 187, 81, |
| 150268 | | - /* 630 */ 223, 117, 227, 228, 99, 100, 101, 102, 103, 104, |
| 150269 | | - /* 640 */ 105, 106, 107, 108, 109, 43, 44, 45, 46, 47, |
| 150270 | | - /* 650 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, |
| 150271 | | - /* 660 */ 19, 255, 148, 149, 150, 112, 113, 114, 123, 124, |
| 150272 | | - /* 670 */ 125, 230, 112, 113, 114, 22, 297, 22, 81, 22, |
| 150273 | | - /* 680 */ 301, 59, 134, 135, 43, 44, 45, 46, 47, 48, |
| 150274 | | - /* 690 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 139, |
| 150275 | | - /* 700 */ 192, 99, 100, 101, 102, 103, 104, 105, 106, 107, |
| 150276 | | - /* 710 */ 108, 109, 59, 116, 59, 187, 59, 231, 232, 46, |
| 150277 | | - /* 720 */ 47, 48, 49, 16, 12, 145, 198, 22, 187, 187, |
| 150278 | | - /* 730 */ 244, 134, 135, 222, 112, 113, 114, 209, 210, 27, |
| 150279 | | - /* 740 */ 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, |
| 150280 | | - /* 750 */ 109, 209, 210, 187, 42, 187, 154, 227, 228, 231, |
| 150281 | | - /* 760 */ 232, 139, 22, 23, 59, 112, 113, 114, 113, 112, |
| 150282 | | - /* 770 */ 113, 114, 244, 245, 233, 63, 19, 209, 210, 271, |
| 150283 | | - /* 780 */ 187, 24, 254, 275, 77, 73, 79, 245, 195, 260, |
| 150284 | | - /* 790 */ 117, 223, 199, 22, 23, 154, 19, 26, 22, 187, |
| 150285 | | - /* 800 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 150286 | | - /* 810 */ 53, 54, 55, 56, 57, 19, 187, 112, 113, 114, |
| 150287 | | - /* 820 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 150288 | | - /* 830 */ 53, 54, 55, 56, 57, 59, 263, 187, 98, 43, |
| 150289 | | - /* 840 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
| 150290 | | - /* 850 */ 54, 55, 56, 57, 204, 205, 99, 100, 101, 102, |
| 150291 | | - /* 860 */ 103, 104, 105, 106, 107, 108, 109, 255, 130, 98, |
| 150292 | | - /* 870 */ 132, 133, 299, 300, 198, 187, 99, 100, 101, 102, |
| 150293 | | - /* 880 */ 103, 104, 105, 106, 107, 108, 109, 187, 112, 113, |
| 150294 | | - /* 890 */ 114, 187, 241, 187, 243, 99, 100, 101, 102, 103, |
| 150295 | | - /* 900 */ 104, 105, 106, 107, 108, 109, 19, 231, 232, 209, |
| 150296 | | - /* 910 */ 210, 282, 59, 209, 210, 209, 210, 16, 230, 19, |
| 150297 | | - /* 920 */ 244, 22, 23, 223, 274, 26, 19, 223, 187, 223, |
| 150298 | | - /* 930 */ 198, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 150299 | | - /* 940 */ 53, 54, 55, 56, 57, 45, 46, 47, 48, 49, |
| 150300 | | - /* 950 */ 50, 51, 52, 53, 54, 55, 56, 57, 19, 20, |
| 150301 | | - /* 960 */ 187, 22, 187, 231, 232, 112, 113, 114, 123, 124, |
| 150302 | | - /* 970 */ 125, 7, 8, 9, 187, 36, 244, 24, 77, 21, |
| 150303 | | - /* 980 */ 79, 187, 209, 210, 187, 263, 99, 100, 101, 102, |
| 150304 | | - /* 990 */ 103, 104, 105, 106, 107, 108, 109, 98, 59, 99, |
| 150305 | | - /* 1000 */ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, |
| 150306 | | - /* 1010 */ 71, 187, 59, 187, 187, 19, 20, 187, 22, 112, |
| 150307 | | - /* 1020 */ 81, 299, 300, 282, 230, 199, 291, 292, 22, 187, |
| 150308 | | - /* 1030 */ 24, 256, 36, 209, 210, 187, 97, 35, 80, 209, |
| 150309 | | - /* 1040 */ 210, 268, 103, 104, 48, 187, 220, 223, 222, 110, |
| 150310 | | - /* 1050 */ 59, 112, 113, 114, 187, 59, 117, 156, 187, 179, |
| 150311 | | - /* 1060 */ 180, 181, 182, 183, 184, 59, 113, 71, 66, 189, |
| 150312 | | - /* 1070 */ 22, 191, 230, 134, 135, 245, 74, 119, 198, 282, |
| 150313 | | - /* 1080 */ 297, 85, 224, 198, 301, 187, 90, 148, 149, 150, |
| 150314 | | - /* 1090 */ 151, 152, 19, 97, 103, 104, 123, 124, 125, 103, |
| 150315 | | - /* 1100 */ 104, 53, 111, 112, 113, 114, 110, 116, 112, 113, |
| 150316 | | - /* 1110 */ 114, 231, 232, 117, 156, 124, 231, 232, 297, 113, |
| 150317 | | - /* 1120 */ 187, 24, 301, 256, 244, 201, 202, 256, 126, 244, |
| 150318 | | - /* 1130 */ 187, 198, 187, 187, 23, 187, 187, 26, 258, 148, |
| 150319 | | - /* 1140 */ 19, 150, 209, 210, 148, 149, 150, 151, 152, 0, |
| 150320 | | - /* 1150 */ 1, 2, 209, 210, 5, 209, 210, 209, 210, 10, |
| 150321 | | - /* 1160 */ 11, 12, 13, 14, 231, 232, 17, 46, 288, 19, |
| 150322 | | - /* 1170 */ 20, 223, 22, 236, 198, 66, 187, 244, 245, 30, |
| 150323 | | - /* 1180 */ 12, 32, 198, 246, 59, 112, 36, 187, 245, 40, |
| 150324 | | - /* 1190 */ 198, 245, 117, 29, 85, 27, 26, 33, 209, 210, |
| 150325 | | - /* 1200 */ 297, 76, 127, 94, 301, 256, 26, 231, 232, 59, |
| 150326 | | - /* 1210 */ 42, 153, 87, 155, 89, 231, 232, 92, 31, 70, |
| 150327 | | - /* 1220 */ 244, 71, 26, 231, 232, 114, 39, 78, 244, 65, |
| 150328 | | - /* 1230 */ 81, 63, 111, 233, 137, 85, 244, 112, 113, 114, |
| 150329 | | - /* 1240 */ 90, 22, 59, 24, 95, 201, 202, 97, 127, 187, |
| 150330 | | - /* 1250 */ 139, 142, 187, 103, 104, 19, 20, 187, 22, 187, |
| 150331 | | - /* 1260 */ 110, 187, 112, 113, 114, 187, 141, 117, 141, 187, |
| 150332 | | - /* 1270 */ 23, 187, 36, 26, 209, 210, 134, 135, 129, 209, |
| 150333 | | - /* 1280 */ 210, 209, 210, 134, 135, 22, 159, 209, 210, 187, |
| 150334 | | - /* 1290 */ 187, 209, 210, 209, 210, 59, 113, 187, 148, 149, |
| 150335 | | - /* 1300 */ 150, 151, 152, 289, 290, 187, 157, 71, 248, 249, |
| 150336 | | - /* 1310 */ 114, 141, 209, 210, 46, 125, 116, 117, 138, 19, |
| 150337 | | - /* 1320 */ 20, 85, 22, 148, 61, 150, 90, 209, 210, 23, |
| 150338 | | - /* 1330 */ 7, 8, 26, 97, 187, 139, 36, 147, 59, 103, |
| 150339 | | - /* 1340 */ 104, 19, 20, 187, 22, 59, 110, 187, 112, 113, |
| 150340 | | - /* 1350 */ 114, 1, 2, 117, 187, 5, 209, 210, 36, 59, |
| 150341 | | - /* 1360 */ 10, 11, 12, 13, 14, 209, 210, 17, 59, 209, |
| 150342 | | - /* 1370 */ 210, 71, 187, 148, 250, 150, 209, 210, 187, 111, |
| 150343 | | - /* 1380 */ 30, 59, 32, 22, 148, 149, 150, 151, 152, 187, |
| 150344 | | - /* 1390 */ 40, 187, 113, 71, 209, 210, 187, 97, 187, 113, |
| 150345 | | - /* 1400 */ 209, 210, 187, 103, 104, 105, 23, 187, 187, 26, |
| 150346 | | - /* 1410 */ 110, 187, 112, 113, 114, 83, 84, 117, 23, 97, |
| 150347 | | - /* 1420 */ 70, 26, 113, 218, 187, 103, 104, 187, 78, 209, |
| 150348 | | - /* 1430 */ 210, 81, 110, 187, 112, 113, 114, 19, 20, 117, |
| 150349 | | - /* 1440 */ 22, 187, 187, 187, 187, 95, 209, 210, 148, 149, |
| 150350 | | - /* 1450 */ 150, 151, 152, 187, 36, 23, 187, 187, 26, 187, |
| 150351 | | - /* 1460 */ 187, 187, 187, 209, 210, 209, 210, 187, 187, 218, |
| 150352 | | - /* 1470 */ 148, 149, 150, 151, 152, 209, 210, 59, 187, 129, |
| 150353 | | - /* 1480 */ 187, 209, 210, 187, 134, 135, 187, 306, 187, 71, |
| 150354 | | - /* 1490 */ 209, 210, 23, 228, 187, 26, 23, 187, 137, 26, |
| 150355 | | - /* 1500 */ 209, 210, 209, 210, 187, 209, 210, 157, 209, 210, |
| 150356 | | - /* 1510 */ 209, 210, 218, 187, 187, 97, 209, 210, 187, 278, |
| 150357 | | - /* 1520 */ 23, 103, 104, 26, 187, 187, 187, 187, 110, 187, |
| 150358 | | - /* 1530 */ 112, 113, 114, 187, 187, 117, 5, 247, 187, 187, |
| 150359 | | - /* 1540 */ 187, 10, 11, 12, 13, 14, 209, 210, 17, 209, |
| 150360 | | - /* 1550 */ 210, 209, 210, 187, 187, 187, 209, 210, 187, 23, |
| 150361 | | - /* 1560 */ 187, 30, 26, 32, 187, 187, 148, 149, 150, 151, |
| 150362 | | - /* 1570 */ 152, 40, 187, 187, 187, 209, 210, 209, 210, 187, |
| 150363 | | - /* 1580 */ 209, 210, 209, 210, 187, 187, 209, 210, 187, 277, |
| 150364 | | - /* 1590 */ 234, 187, 247, 187, 209, 210, 209, 210, 187, 235, |
| 150365 | | - /* 1600 */ 187, 70, 187, 207, 247, 247, 247, 209, 210, 78, |
| 150366 | | - /* 1610 */ 209, 210, 81, 209, 210, 209, 210, 187, 185, 238, |
| 150367 | | - /* 1620 */ 209, 210, 209, 210, 209, 210, 95, 251, 287, 238, |
| 150368 | | - /* 1630 */ 251, 23, 23, 23, 26, 26, 26, 283, 23, 209, |
| 150369 | | - /* 1640 */ 210, 26, 213, 238, 221, 283, 212, 212, 217, 212, |
| 150370 | | - /* 1650 */ 251, 241, 270, 241, 237, 235, 190, 60, 137, 287, |
| 150371 | | - /* 1660 */ 129, 194, 194, 38, 284, 134, 135, 273, 284, 194, |
| 150372 | | - /* 1670 */ 146, 111, 22, 43, 226, 145, 262, 261, 238, 18, |
| 150373 | | - /* 1680 */ 229, 229, 229, 229, 194, 18, 193, 238, 157, 262, |
| 150374 | | - /* 1690 */ 226, 226, 194, 238, 238, 193, 153, 261, 62, 280, |
| 150375 | | - /* 1700 */ 279, 194, 193, 22, 194, 214, 193, 111, 194, 193, |
| 150376 | | - /* 1710 */ 214, 211, 211, 64, 211, 211, 122, 211, 219, 214, |
| 150377 | | - /* 1720 */ 109, 213, 160, 211, 300, 140, 211, 253, 111, 272, |
| 150378 | | - /* 1730 */ 219, 214, 272, 214, 252, 194, 253, 252, 91, 253, |
| 150379 | | - /* 1740 */ 252, 82, 253, 305, 252, 144, 305, 141, 22, 194, |
| 150380 | | - /* 1750 */ 269, 257, 257, 153, 267, 143, 142, 25, 197, 26, |
| 150381 | | - /* 1760 */ 242, 241, 196, 240, 242, 239, 238, 13, 188, 188, |
| 150382 | | - /* 1770 */ 6, 293, 186, 186, 186, 200, 206, 293, 206, 206, |
| 150383 | | - /* 1780 */ 206, 4, 200, 215, 215, 207, 207, 3, 22, 206, |
| 150384 | | - /* 1790 */ 200, 158, 96, 15, 23, 16, 23, 135, 146, 126, |
| 150385 | | - /* 1800 */ 24, 138, 20, 16, 140, 1, 138, 147, 126, 61, |
| 150386 | | - /* 1810 */ 53, 37, 146, 53, 53, 290, 53, 126, 112, 34, |
| 150387 | | - /* 1820 */ 137, 1, 5, 22, 111, 156, 68, 68, 26, 41, |
| 150388 | | - /* 1830 */ 75, 137, 111, 24, 20, 19, 127, 121, 23, 67, |
| 150389 | | - /* 1840 */ 22, 22, 67, 22, 22, 37, 22, 67, 23, 145, |
| 150390 | | - /* 1850 */ 22, 28, 23, 23, 23, 137, 23, 22, 26, 22, |
| 150391 | | - /* 1860 */ 24, 23, 112, 24, 23, 23, 22, 139, 34, 26, |
| 150392 | | - /* 1870 */ 75, 88, 86, 75, 34, 23, 22, 24, 22, 34, |
| 150393 | | - /* 1880 */ 34, 34, 93, 34, 26, 26, 23, 23, 23, 34, |
| 150394 | | - /* 1890 */ 23, 23, 44, 23, 11, 26, 22, 22, 26, 23, |
| 150395 | | - /* 1900 */ 23, 22, 22, 15, 137, 137, 137, 137, 23, 1, |
| 150396 | | - /* 1910 */ 307, 307, 131, 307, 307, 307, 307, 307, 307, 307, |
| 150397 | | - /* 1920 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150398 | | - /* 1930 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150399 | | - /* 1940 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150400 | | - /* 1950 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150401 | | - /* 1960 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150402 | | - /* 1970 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150403 | | - /* 1980 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150404 | | - /* 1990 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150405 | | - /* 2000 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150406 | | - /* 2010 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150407 | | - /* 2020 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150408 | | - /* 2030 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150409 | | - /* 2040 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150410 | | - /* 2050 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150411 | | - /* 2060 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150412 | | - /* 2070 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150413 | | - /* 2080 */ 307, 307, 307, 307, 307, 307, 307, 307, 307, 307, |
| 150414 | | - /* 2090 */ 307, 307, |
| 150415 | | -}; |
| 150416 | | -#define YY_SHIFT_COUNT (542) |
| 151315 | + /* 0 */ 189, 211, 189, 189, 218, 189, 220, 189, 267, 268, |
| 151316 | + /* 10 */ 269, 189, 210, 189, 228, 189, 267, 268, 269, 19, |
| 151317 | + /* 20 */ 218, 189, 211, 212, 211, 212, 211, 211, 212, 211, |
| 151318 | + /* 30 */ 212, 31, 211, 211, 212, 211, 212, 288, 300, 39, |
| 151319 | + /* 40 */ 21, 189, 304, 43, 44, 45, 46, 47, 48, 49, |
| 151320 | + /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 225, 19, |
| 151321 | + /* 60 */ 189, 183, 184, 185, 186, 189, 248, 263, 236, 191, |
| 151322 | + /* 70 */ 248, 193, 248, 197, 208, 257, 262, 201, 200, 257, |
| 151323 | + /* 80 */ 200, 257, 81, 43, 44, 45, 46, 47, 48, 49, |
| 151324 | + /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 189, 80, |
| 151325 | + /* 100 */ 189, 101, 102, 103, 104, 105, 106, 107, 108, 109, |
| 151326 | + /* 110 */ 110, 111, 234, 235, 234, 235, 305, 306, 305, 118, |
| 151327 | + /* 120 */ 307, 305, 306, 297, 298, 247, 86, 247, 88, 19, |
| 151328 | + /* 130 */ 259, 251, 252, 267, 268, 269, 26, 136, 137, 261, |
| 151329 | + /* 140 */ 121, 101, 102, 103, 104, 105, 106, 107, 108, 109, |
| 151330 | + /* 150 */ 110, 111, 59, 43, 44, 45, 46, 47, 48, 49, |
| 151331 | + /* 160 */ 50, 51, 52, 53, 54, 55, 56, 57, 259, 291, |
| 151332 | + /* 170 */ 105, 106, 107, 108, 109, 110, 111, 158, 189, 69, |
| 151333 | + /* 180 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, |
| 151334 | + /* 190 */ 111, 107, 108, 109, 110, 111, 205, 206, 207, 19, |
| 151335 | + /* 200 */ 19, 54, 55, 56, 57, 58, 29, 114, 115, 116, |
| 151336 | + /* 210 */ 33, 101, 102, 103, 104, 105, 106, 107, 108, 109, |
| 151337 | + /* 220 */ 110, 111, 233, 43, 44, 45, 46, 47, 48, 49, |
| 151338 | + /* 230 */ 50, 51, 52, 53, 54, 55, 56, 57, 19, 126, |
| 151339 | + /* 240 */ 127, 148, 65, 24, 214, 200, 59, 67, 101, 102, |
| 151340 | + /* 250 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 22, |
| 151341 | + /* 260 */ 189, 111, 43, 44, 45, 46, 47, 48, 49, 50, |
| 151342 | + /* 270 */ 51, 52, 53, 54, 55, 56, 57, 206, 207, 234, |
| 151343 | + /* 280 */ 235, 101, 102, 103, 104, 105, 106, 107, 108, 109, |
| 151344 | + /* 290 */ 110, 111, 247, 76, 107, 114, 59, 267, 268, 269, |
| 151345 | + /* 300 */ 189, 114, 115, 116, 162, 163, 89, 19, 263, 92, |
| 151346 | + /* 310 */ 189, 23, 54, 55, 56, 57, 189, 206, 207, 22, |
| 151347 | + /* 320 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, |
| 151348 | + /* 330 */ 111, 43, 44, 45, 46, 47, 48, 49, 50, 51, |
| 151349 | + /* 340 */ 52, 53, 54, 55, 56, 57, 19, 189, 277, 59, |
| 151350 | + /* 350 */ 23, 114, 115, 116, 46, 47, 48, 49, 61, 101, |
| 151351 | + /* 360 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, |
| 151352 | + /* 370 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 151353 | + /* 380 */ 53, 54, 55, 56, 57, 125, 126, 127, 277, 101, |
| 151354 | + /* 390 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, |
| 151355 | + /* 400 */ 59, 189, 189, 276, 114, 115, 116, 117, 73, 59, |
| 151356 | + /* 410 */ 120, 121, 122, 72, 214, 19, 81, 259, 19, 23, |
| 151357 | + /* 420 */ 130, 81, 72, 24, 211, 212, 221, 119, 101, 102, |
| 151358 | + /* 430 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 43, |
| 151359 | + /* 440 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
| 151360 | + /* 450 */ 54, 55, 56, 57, 19, 114, 115, 116, 23, 208, |
| 151361 | + /* 460 */ 125, 248, 189, 189, 114, 115, 116, 267, 268, 269, |
| 151362 | + /* 470 */ 189, 136, 137, 189, 262, 22, 136, 137, 43, 44, |
| 151363 | + /* 480 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 151364 | + /* 490 */ 55, 56, 57, 189, 95, 211, 212, 101, 102, 103, |
| 151365 | + /* 500 */ 104, 105, 106, 107, 108, 109, 110, 111, 59, 189, |
| 151366 | + /* 510 */ 111, 189, 59, 76, 294, 295, 117, 118, 119, 120, |
| 151367 | + /* 520 */ 121, 122, 123, 19, 87, 189, 89, 23, 129, 92, |
| 151368 | + /* 530 */ 279, 227, 248, 22, 189, 284, 101, 102, 103, 104, |
| 151369 | + /* 540 */ 105, 106, 107, 108, 109, 110, 111, 43, 44, 45, |
| 151370 | + /* 550 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, |
| 151371 | + /* 560 */ 56, 57, 19, 114, 115, 116, 23, 114, 115, 116, |
| 151372 | + /* 570 */ 59, 117, 299, 300, 120, 121, 122, 304, 189, 189, |
| 151373 | + /* 580 */ 143, 189, 110, 111, 130, 22, 43, 44, 45, 46, |
| 151374 | + /* 590 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 151375 | + /* 600 */ 57, 211, 212, 211, 212, 101, 102, 103, 104, 105, |
| 151376 | + /* 610 */ 106, 107, 108, 109, 110, 111, 226, 189, 226, 189, |
| 151377 | + /* 620 */ 298, 132, 59, 134, 135, 114, 115, 116, 189, 59, |
| 151378 | + /* 630 */ 285, 19, 7, 8, 9, 23, 205, 206, 207, 211, |
| 151379 | + /* 640 */ 212, 211, 212, 221, 101, 102, 103, 104, 105, 106, |
| 151380 | + /* 650 */ 107, 108, 109, 110, 111, 43, 44, 45, 46, 47, |
| 151381 | + /* 660 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, |
| 151382 | + /* 670 */ 19, 181, 182, 183, 184, 185, 186, 114, 115, 116, |
| 151383 | + /* 680 */ 189, 191, 133, 193, 114, 115, 116, 138, 299, 300, |
| 151384 | + /* 690 */ 200, 22, 201, 304, 43, 44, 45, 46, 47, 48, |
| 151385 | + /* 700 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 35, |
| 151386 | + /* 710 */ 189, 141, 189, 101, 102, 103, 104, 105, 106, 107, |
| 151387 | + /* 720 */ 108, 109, 110, 111, 234, 235, 22, 23, 59, 184, |
| 151388 | + /* 730 */ 26, 186, 211, 212, 211, 212, 191, 247, 193, 19, |
| 151389 | + /* 740 */ 66, 105, 106, 73, 189, 200, 189, 226, 74, 226, |
| 151390 | + /* 750 */ 22, 261, 101, 102, 103, 104, 105, 106, 107, 108, |
| 151391 | + /* 760 */ 109, 110, 111, 43, 44, 45, 46, 47, 48, 49, |
| 151392 | + /* 770 */ 50, 51, 52, 53, 54, 55, 56, 57, 189, 234, |
| 151393 | + /* 780 */ 235, 291, 19, 114, 115, 116, 150, 59, 152, 189, |
| 151394 | + /* 790 */ 233, 236, 247, 59, 189, 125, 126, 127, 59, 300, |
| 151395 | + /* 800 */ 211, 212, 128, 304, 100, 19, 261, 156, 45, 46, |
| 151396 | + /* 810 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 151397 | + /* 820 */ 57, 101, 102, 103, 104, 105, 106, 107, 108, 109, |
| 151398 | + /* 830 */ 110, 111, 46, 233, 189, 189, 291, 248, 99, 189, |
| 151399 | + /* 840 */ 125, 126, 127, 115, 26, 200, 289, 230, 231, 115, |
| 151400 | + /* 850 */ 200, 16, 189, 114, 115, 189, 211, 212, 119, 221, |
| 151401 | + /* 860 */ 189, 211, 212, 258, 101, 102, 103, 104, 105, 106, |
| 151402 | + /* 870 */ 107, 108, 109, 110, 111, 189, 156, 211, 212, 234, |
| 151403 | + /* 880 */ 235, 189, 211, 212, 234, 235, 22, 201, 189, 150, |
| 151404 | + /* 890 */ 151, 152, 247, 248, 76, 16, 19, 247, 248, 113, |
| 151405 | + /* 900 */ 189, 24, 257, 211, 212, 189, 26, 89, 262, 223, |
| 151406 | + /* 910 */ 92, 225, 77, 189, 79, 129, 19, 53, 226, 248, |
| 151407 | + /* 920 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 151408 | + /* 930 */ 53, 54, 55, 56, 57, 236, 19, 271, 189, 99, |
| 151409 | + /* 940 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 151410 | + /* 950 */ 53, 54, 55, 56, 57, 115, 77, 59, 79, 119, |
| 151411 | + /* 960 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 151412 | + /* 970 */ 53, 54, 55, 56, 57, 259, 22, 23, 101, 102, |
| 151413 | + /* 980 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 59, |
| 151414 | + /* 990 */ 150, 151, 152, 158, 22, 244, 24, 246, 101, 102, |
| 151415 | + /* 1000 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 285, |
| 151416 | + /* 1010 */ 189, 189, 114, 115, 116, 200, 136, 137, 101, 102, |
| 151417 | + /* 1020 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 230, |
| 151418 | + /* 1030 */ 231, 59, 211, 212, 285, 105, 106, 189, 19, 141, |
| 151419 | + /* 1040 */ 234, 235, 239, 113, 114, 115, 116, 226, 118, 234, |
| 151420 | + /* 1050 */ 235, 189, 249, 247, 100, 189, 126, 23, 236, 107, |
| 151421 | + /* 1060 */ 26, 189, 247, 44, 45, 46, 47, 48, 49, 50, |
| 151422 | + /* 1070 */ 51, 52, 53, 54, 55, 56, 57, 211, 212, 59, |
| 151423 | + /* 1080 */ 150, 233, 152, 211, 212, 133, 12, 115, 189, 189, |
| 151424 | + /* 1090 */ 138, 19, 20, 300, 22, 233, 76, 304, 226, 11, |
| 151425 | + /* 1100 */ 208, 27, 22, 23, 200, 19, 26, 87, 36, 89, |
| 151426 | + /* 1110 */ 211, 212, 92, 300, 248, 189, 42, 304, 189, 250, |
| 151427 | + /* 1120 */ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, |
| 151428 | + /* 1130 */ 111, 59, 200, 233, 114, 115, 116, 63, 234, 235, |
| 151429 | + /* 1140 */ 235, 19, 20, 71, 22, 300, 189, 73, 200, 304, |
| 151430 | + /* 1150 */ 116, 247, 247, 81, 23, 200, 227, 26, 36, 234, |
| 151431 | + /* 1160 */ 235, 203, 204, 143, 200, 26, 234, 235, 194, 200, |
| 151432 | + /* 1170 */ 48, 99, 247, 66, 189, 141, 284, 105, 106, 247, |
| 151433 | + /* 1180 */ 100, 59, 234, 235, 112, 259, 114, 115, 116, 234, |
| 151434 | + /* 1190 */ 235, 119, 85, 71, 266, 247, 211, 212, 234, 235, |
| 151435 | + /* 1200 */ 114, 94, 247, 234, 235, 12, 266, 85, 136, 137, |
| 151436 | + /* 1210 */ 189, 247, 90, 26, 126, 127, 247, 189, 26, 22, |
| 151437 | + /* 1220 */ 27, 99, 150, 151, 152, 153, 154, 105, 106, 189, |
| 151438 | + /* 1230 */ 302, 303, 211, 212, 112, 42, 114, 115, 116, 211, |
| 151439 | + /* 1240 */ 212, 119, 302, 303, 19, 20, 189, 22, 274, 189, |
| 151440 | + /* 1250 */ 15, 144, 278, 189, 22, 23, 63, 189, 189, 203, |
| 151441 | + /* 1260 */ 204, 36, 136, 137, 155, 24, 157, 143, 211, 212, |
| 151442 | + /* 1270 */ 189, 26, 150, 151, 152, 153, 154, 0, 1, 2, |
| 151443 | + /* 1280 */ 211, 212, 5, 46, 59, 161, 147, 10, 11, 12, |
| 151444 | + /* 1290 */ 13, 14, 211, 212, 17, 60, 71, 189, 258, 189, |
| 151445 | + /* 1300 */ 59, 59, 105, 106, 189, 189, 189, 30, 116, 32, |
| 151446 | + /* 1310 */ 85, 124, 189, 251, 252, 90, 189, 40, 258, 211, |
| 151447 | + /* 1320 */ 212, 211, 212, 189, 99, 26, 211, 212, 211, 212, |
| 151448 | + /* 1330 */ 105, 106, 100, 141, 211, 212, 189, 112, 189, 114, |
| 151449 | + /* 1340 */ 115, 116, 24, 189, 119, 31, 23, 70, 189, 26, |
| 151450 | + /* 1350 */ 113, 19, 20, 39, 22, 78, 115, 115, 81, 189, |
| 151451 | + /* 1360 */ 211, 212, 22, 189, 24, 211, 212, 189, 36, 189, |
| 151452 | + /* 1370 */ 211, 212, 189, 189, 97, 150, 151, 152, 153, 154, |
| 151453 | + /* 1380 */ 127, 211, 212, 189, 189, 211, 212, 189, 143, 211, |
| 151454 | + /* 1390 */ 212, 59, 189, 189, 211, 212, 23, 189, 189, 26, |
| 151455 | + /* 1400 */ 59, 189, 149, 71, 22, 211, 212, 189, 131, 211, |
| 151456 | + /* 1410 */ 212, 189, 59, 136, 137, 211, 212, 85, 189, 211, |
| 151457 | + /* 1420 */ 212, 253, 90, 211, 212, 292, 293, 118, 119, 211, |
| 151458 | + /* 1430 */ 212, 99, 23, 211, 212, 26, 159, 105, 106, 140, |
| 151459 | + /* 1440 */ 211, 212, 23, 189, 112, 26, 114, 115, 116, 1, |
| 151460 | + /* 1450 */ 2, 119, 189, 5, 7, 8, 115, 139, 10, 11, |
| 151461 | + /* 1460 */ 12, 13, 14, 23, 189, 17, 26, 189, 115, 189, |
| 151462 | + /* 1470 */ 19, 20, 189, 22, 189, 83, 84, 189, 30, 150, |
| 151463 | + /* 1480 */ 32, 152, 150, 151, 152, 153, 154, 36, 40, 211, |
| 151464 | + /* 1490 */ 212, 211, 212, 189, 211, 212, 211, 212, 309, 189, |
| 151465 | + /* 1500 */ 19, 20, 189, 22, 150, 189, 152, 231, 189, 189, |
| 151466 | + /* 1510 */ 59, 189, 23, 189, 189, 26, 189, 36, 70, 189, |
| 151467 | + /* 1520 */ 23, 139, 71, 26, 211, 212, 78, 211, 212, 81, |
| 151468 | + /* 1530 */ 281, 211, 212, 211, 212, 189, 211, 212, 211, 212, |
| 151469 | + /* 1540 */ 59, 211, 212, 23, 23, 97, 26, 26, 23, 189, |
| 151470 | + /* 1550 */ 99, 26, 71, 189, 119, 189, 105, 106, 107, 189, |
| 151471 | + /* 1560 */ 189, 189, 280, 112, 129, 114, 115, 116, 189, 189, |
| 151472 | + /* 1570 */ 119, 23, 19, 20, 26, 22, 189, 211, 212, 131, |
| 151473 | + /* 1580 */ 99, 237, 211, 212, 136, 137, 105, 106, 189, 36, |
| 151474 | + /* 1590 */ 211, 212, 189, 112, 189, 114, 115, 116, 211, 212, |
| 151475 | + /* 1600 */ 119, 150, 151, 152, 153, 154, 189, 159, 23, 189, |
| 151476 | + /* 1610 */ 23, 26, 59, 26, 189, 189, 189, 189, 189, 189, |
| 151477 | + /* 1620 */ 209, 189, 238, 187, 71, 250, 250, 250, 211, 212, |
| 151478 | + /* 1630 */ 241, 150, 151, 152, 153, 154, 211, 212, 250, 290, |
| 151479 | + /* 1640 */ 254, 211, 212, 211, 212, 254, 215, 286, 241, 241, |
| 151480 | + /* 1650 */ 254, 286, 99, 214, 220, 214, 214, 224, 105, 106, |
| 151481 | + /* 1660 */ 244, 240, 244, 273, 192, 112, 60, 114, 115, 116, |
| 151482 | + /* 1670 */ 139, 290, 119, 5, 196, 238, 196, 38, 10, 11, |
| 151483 | + /* 1680 */ 12, 13, 14, 196, 287, 17, 148, 287, 276, 113, |
| 151484 | + /* 1690 */ 43, 22, 229, 147, 241, 18, 232, 232, 30, 232, |
| 151485 | + /* 1700 */ 32, 232, 264, 150, 151, 152, 153, 154, 40, 265, |
| 151486 | + /* 1710 */ 196, 18, 195, 264, 241, 241, 241, 265, 196, 229, |
| 151487 | + /* 1720 */ 229, 195, 155, 62, 196, 195, 283, 282, 22, 216, |
| 151488 | + /* 1730 */ 196, 195, 216, 196, 195, 113, 213, 213, 70, 64, |
| 151489 | + /* 1740 */ 213, 222, 22, 124, 162, 111, 78, 142, 219, 81, |
| 151490 | + /* 1750 */ 215, 219, 275, 303, 213, 213, 216, 275, 213, 216, |
| 151491 | + /* 1760 */ 213, 256, 113, 255, 255, 97, 222, 216, 256, 196, |
| 151492 | + /* 1770 */ 91, 256, 82, 255, 308, 146, 308, 22, 143, 196, |
| 151493 | + /* 1780 */ 270, 155, 145, 272, 144, 25, 13, 199, 26, 256, |
| 151494 | + /* 1790 */ 198, 190, 190, 6, 296, 188, 188, 188, 244, 131, |
| 151495 | + /* 1800 */ 245, 245, 243, 242, 136, 137, 241, 255, 208, 260, |
| 151496 | + /* 1810 */ 260, 208, 202, 217, 217, 202, 4, 3, 202, 208, |
| 151497 | + /* 1820 */ 208, 22, 160, 209, 209, 208, 15, 159, 98, 16, |
| 151498 | + /* 1830 */ 23, 23, 137, 148, 24, 128, 140, 20, 16, 142, |
| 151499 | + /* 1840 */ 1, 140, 128, 149, 61, 53, 37, 148, 53, 53, |
| 151500 | + /* 1850 */ 53, 293, 128, 296, 114, 34, 139, 1, 5, 22, |
| 151501 | + /* 1860 */ 113, 158, 68, 75, 26, 41, 68, 139, 24, 113, |
| 151502 | + /* 1870 */ 20, 19, 129, 123, 23, 96, 22, 22, 59, 22, |
| 151503 | + /* 1880 */ 22, 147, 67, 67, 24, 22, 37, 28, 23, 22, |
| 151504 | + /* 1890 */ 67, 23, 23, 23, 114, 23, 22, 26, 22, 24, |
| 151505 | + /* 1900 */ 23, 22, 24, 139, 23, 23, 141, 34, 88, 26, |
| 151506 | + /* 1910 */ 75, 86, 23, 22, 34, 75, 24, 23, 34, 34, |
| 151507 | + /* 1920 */ 34, 93, 34, 26, 26, 23, 23, 34, 23, 23, |
| 151508 | + /* 1930 */ 26, 44, 23, 22, 11, 22, 22, 133, 23, 23, |
| 151509 | + /* 1940 */ 22, 22, 139, 26, 139, 139, 15, 23, 1, 310, |
| 151510 | + /* 1950 */ 310, 310, 310, 310, 310, 310, 310, 139, 310, 310, |
| 151511 | + /* 1960 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151512 | + /* 1970 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151513 | + /* 1980 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151514 | + /* 1990 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151515 | + /* 2000 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151516 | + /* 2010 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151517 | + /* 2020 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151518 | + /* 2030 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151519 | + /* 2040 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151520 | + /* 2050 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151521 | + /* 2060 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151522 | + /* 2070 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151523 | + /* 2080 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151524 | + /* 2090 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151525 | + /* 2100 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151526 | + /* 2110 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151527 | + /* 2120 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151528 | + /* 2130 */ 310, 310, 310, 310, 310, 310, 310, 310, 310, |
| 151529 | +}; |
| 151530 | +#define YY_SHIFT_COUNT (549) |
| 150417 | 151531 | #define YY_SHIFT_MIN (0) |
| 150418 | | -#define YY_SHIFT_MAX (1908) |
| 151532 | +#define YY_SHIFT_MAX (1947) |
| 150419 | 151533 | static const unsigned short int yy_shift_ofst[] = { |
| 150420 | | - /* 0 */ 1350, 1149, 1531, 939, 939, 548, 996, 1150, 1236, 1322, |
| 150421 | | - /* 10 */ 1322, 1322, 334, 0, 0, 178, 777, 1322, 1322, 1322, |
| 150422 | | - /* 20 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, |
| 150423 | | - /* 30 */ 991, 991, 1125, 1125, 447, 597, 548, 548, 548, 548, |
| 150424 | | - /* 40 */ 548, 548, 40, 108, 217, 284, 323, 390, 429, 496, |
| 150425 | | - /* 50 */ 535, 602, 641, 757, 777, 777, 777, 777, 777, 777, |
| 150426 | | - /* 60 */ 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, |
| 150427 | | - /* 70 */ 777, 777, 796, 777, 887, 900, 900, 1300, 1322, 1322, |
| 150428 | | - /* 80 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, |
| 150429 | | - /* 90 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, |
| 150430 | | - /* 100 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, |
| 150431 | | - /* 110 */ 1418, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, |
| 150432 | | - /* 120 */ 1322, 1322, 1322, 1322, 147, 254, 254, 254, 254, 254, |
| 150433 | | - /* 130 */ 84, 185, 66, 853, 958, 1121, 853, 92, 92, 853, |
| 150434 | | - /* 140 */ 321, 321, 321, 321, 325, 350, 350, 461, 150, 1913, |
| 150435 | | - /* 150 */ 1913, 285, 285, 285, 236, 184, 349, 184, 184, 712, |
| 150436 | | - /* 160 */ 712, 433, 553, 771, 899, 853, 853, 853, 853, 853, |
| 150437 | | - /* 170 */ 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, |
| 150438 | | - /* 180 */ 853, 853, 853, 853, 853, 853, 46, 46, 853, 113, |
| 150439 | | - /* 190 */ 223, 223, 1183, 1183, 1127, 1142, 1913, 1913, 1913, 459, |
| 150440 | | - /* 200 */ 514, 514, 653, 495, 657, 305, 705, 560, 622, 776, |
| 150441 | | - /* 210 */ 853, 853, 853, 853, 853, 853, 853, 853, 853, 545, |
| 150442 | | - /* 220 */ 853, 853, 853, 853, 853, 853, 853, 853, 853, 853, |
| 150443 | | - /* 230 */ 853, 853, 1002, 1002, 1002, 853, 853, 853, 853, 1111, |
| 150444 | | - /* 240 */ 853, 853, 853, 1006, 1109, 853, 853, 1168, 853, 853, |
| 150445 | | - /* 250 */ 853, 853, 853, 853, 853, 853, 845, 1164, 738, 953, |
| 150446 | | - /* 260 */ 953, 953, 953, 1196, 738, 738, 45, 96, 964, 179, |
| 150447 | | - /* 270 */ 580, 907, 907, 1073, 580, 580, 1073, 498, 388, 1268, |
| 150448 | | - /* 280 */ 1187, 1187, 1187, 907, 1170, 1170, 1058, 1180, 328, 1219, |
| 150449 | | - /* 290 */ 1597, 1521, 1521, 1625, 1625, 1521, 1524, 1560, 1650, 1630, |
| 150450 | | - /* 300 */ 1530, 1661, 1661, 1661, 1661, 1521, 1667, 1530, 1530, 1560, |
| 150451 | | - /* 310 */ 1650, 1630, 1630, 1530, 1521, 1667, 1543, 1636, 1521, 1667, |
| 150452 | | - /* 320 */ 1681, 1521, 1667, 1521, 1667, 1681, 1596, 1596, 1596, 1649, |
| 150453 | | - /* 330 */ 1681, 1596, 1594, 1596, 1649, 1596, 1596, 1562, 1681, 1611, |
| 150454 | | - /* 340 */ 1611, 1681, 1585, 1617, 1585, 1617, 1585, 1617, 1585, 1617, |
| 150455 | | - /* 350 */ 1521, 1647, 1647, 1659, 1659, 1601, 1606, 1726, 1521, 1600, |
| 150456 | | - /* 360 */ 1601, 1612, 1614, 1530, 1732, 1733, 1754, 1754, 1764, 1764, |
| 150457 | | - /* 370 */ 1764, 1913, 1913, 1913, 1913, 1913, 1913, 1913, 1913, 1913, |
| 150458 | | - /* 380 */ 1913, 1913, 1913, 1913, 1913, 1913, 673, 901, 283, 740, |
| 150459 | | - /* 390 */ 707, 973, 655, 1247, 1048, 1097, 1190, 1306, 1263, 1383, |
| 150460 | | - /* 400 */ 1395, 1432, 1469, 1473, 1497, 1279, 1200, 1323, 1075, 1286, |
| 150461 | | - /* 410 */ 1536, 1608, 1332, 1609, 1175, 1225, 1610, 1615, 1309, 1361, |
| 150462 | | - /* 420 */ 1777, 1784, 1766, 1633, 1778, 1696, 1779, 1771, 1773, 1662, |
| 150463 | | - /* 430 */ 1652, 1673, 1776, 1663, 1782, 1664, 1787, 1804, 1668, 1660, |
| 150464 | | - /* 440 */ 1682, 1748, 1774, 1666, 1757, 1760, 1761, 1763, 1691, 1706, |
| 150465 | | - /* 450 */ 1785, 1683, 1820, 1817, 1801, 1713, 1669, 1758, 1802, 1759, |
| 150466 | | - /* 460 */ 1755, 1788, 1694, 1721, 1809, 1814, 1816, 1709, 1716, 1818, |
| 150467 | | - /* 470 */ 1772, 1819, 1821, 1815, 1822, 1775, 1823, 1824, 1780, 1808, |
| 150468 | | - /* 480 */ 1825, 1704, 1828, 1829, 1830, 1831, 1832, 1833, 1835, 1836, |
| 150469 | | - /* 490 */ 1838, 1837, 1839, 1718, 1841, 1842, 1750, 1834, 1844, 1728, |
| 150470 | | - /* 500 */ 1843, 1840, 1845, 1846, 1847, 1783, 1795, 1786, 1848, 1798, |
| 150471 | | - /* 510 */ 1789, 1849, 1852, 1854, 1853, 1858, 1859, 1855, 1863, 1843, |
| 150472 | | - /* 520 */ 1864, 1865, 1867, 1868, 1869, 1870, 1856, 1883, 1874, 1875, |
| 150473 | | - /* 530 */ 1876, 1877, 1879, 1880, 1872, 1781, 1767, 1768, 1769, 1770, |
| 150474 | | - /* 540 */ 1885, 1888, 1908, |
| 150475 | | -}; |
| 150476 | | -#define YY_REDUCE_COUNT (385) |
| 150477 | | -#define YY_REDUCE_MIN (-256) |
| 150478 | | -#define YY_REDUCE_MAX (1590) |
| 151534 | + /* 0 */ 1448, 1277, 1668, 1072, 1072, 340, 1122, 1225, 1332, 1481, |
| 151535 | + /* 10 */ 1481, 1481, 335, 0, 0, 180, 897, 1481, 1481, 1481, |
| 151536 | + /* 20 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, |
| 151537 | + /* 30 */ 930, 930, 1020, 1020, 290, 1, 340, 340, 340, 340, |
| 151538 | + /* 40 */ 340, 340, 40, 110, 219, 288, 327, 396, 435, 504, |
| 151539 | + /* 50 */ 543, 612, 651, 720, 877, 897, 897, 897, 897, 897, |
| 151540 | + /* 60 */ 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, |
| 151541 | + /* 70 */ 897, 897, 897, 917, 897, 1019, 763, 763, 1451, 1481, |
| 151542 | + /* 80 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, |
| 151543 | + /* 90 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, |
| 151544 | + /* 100 */ 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, 1481, |
| 151545 | + /* 110 */ 1481, 1481, 1553, 1481, 1481, 1481, 1481, 1481, 1481, 1481, |
| 151546 | + /* 120 */ 1481, 1481, 1481, 1481, 1481, 1481, 147, 258, 258, 258, |
| 151547 | + /* 130 */ 258, 258, 79, 65, 84, 449, 19, 786, 449, 636, |
| 151548 | + /* 140 */ 636, 449, 880, 880, 880, 880, 113, 142, 142, 472, |
| 151549 | + /* 150 */ 150, 1958, 1958, 399, 399, 399, 93, 237, 341, 237, |
| 151550 | + /* 160 */ 237, 1074, 1074, 437, 350, 704, 1080, 449, 449, 449, |
| 151551 | + /* 170 */ 449, 449, 449, 449, 449, 449, 449, 449, 449, 449, |
| 151552 | + /* 180 */ 449, 449, 449, 449, 449, 449, 449, 449, 818, 818, |
| 151553 | + /* 190 */ 449, 1088, 217, 217, 734, 734, 1124, 1126, 1958, 1958, |
| 151554 | + /* 200 */ 1958, 739, 840, 840, 453, 454, 511, 187, 563, 570, |
| 151555 | + /* 210 */ 898, 669, 449, 449, 449, 449, 449, 449, 449, 449, |
| 151556 | + /* 220 */ 449, 670, 449, 449, 449, 449, 449, 449, 449, 449, |
| 151557 | + /* 230 */ 449, 449, 449, 449, 674, 674, 674, 449, 449, 449, |
| 151558 | + /* 240 */ 449, 1034, 449, 449, 449, 972, 1107, 449, 449, 1193, |
| 151559 | + /* 250 */ 449, 449, 449, 449, 449, 449, 449, 449, 260, 177, |
| 151560 | + /* 260 */ 489, 1241, 1241, 1241, 1241, 1192, 489, 489, 952, 1197, |
| 151561 | + /* 270 */ 625, 1235, 1139, 181, 181, 1086, 1139, 1139, 1086, 1187, |
| 151562 | + /* 280 */ 1131, 1237, 1314, 1314, 1314, 181, 1245, 1245, 1109, 1299, |
| 151563 | + /* 290 */ 549, 1340, 1606, 1531, 1531, 1639, 1639, 1531, 1538, 1576, |
| 151564 | + /* 300 */ 1669, 1647, 1546, 1677, 1677, 1677, 1677, 1531, 1693, 1546, |
| 151565 | + /* 310 */ 1546, 1576, 1669, 1647, 1647, 1546, 1531, 1693, 1567, 1661, |
| 151566 | + /* 320 */ 1531, 1693, 1706, 1531, 1693, 1531, 1693, 1706, 1622, 1622, |
| 151567 | + /* 330 */ 1622, 1675, 1720, 1720, 1706, 1622, 1619, 1622, 1675, 1622, |
| 151568 | + /* 340 */ 1622, 1582, 1706, 1634, 1634, 1706, 1605, 1649, 1605, 1649, |
| 151569 | + /* 350 */ 1605, 1649, 1605, 1649, 1531, 1679, 1679, 1690, 1690, 1629, |
| 151570 | + /* 360 */ 1635, 1755, 1531, 1626, 1629, 1637, 1640, 1546, 1760, 1762, |
| 151571 | + /* 370 */ 1773, 1773, 1787, 1787, 1787, 1958, 1958, 1958, 1958, 1958, |
| 151572 | + /* 380 */ 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, 1958, |
| 151573 | + /* 390 */ 308, 835, 954, 1232, 879, 715, 728, 1323, 864, 1318, |
| 151574 | + /* 400 */ 1253, 1373, 297, 1409, 1419, 1440, 1489, 1497, 1520, 1242, |
| 151575 | + /* 410 */ 1309, 1447, 1435, 1341, 1521, 1525, 1392, 1548, 1329, 1354, |
| 151576 | + /* 420 */ 1585, 1587, 1353, 1382, 1812, 1814, 1799, 1662, 1811, 1730, |
| 151577 | + /* 430 */ 1813, 1807, 1808, 1695, 1685, 1707, 1810, 1696, 1817, 1697, |
| 151578 | + /* 440 */ 1822, 1839, 1701, 1694, 1714, 1783, 1809, 1699, 1792, 1795, |
| 151579 | + /* 450 */ 1796, 1797, 1724, 1740, 1821, 1717, 1856, 1853, 1837, 1747, |
| 151580 | + /* 460 */ 1703, 1794, 1838, 1798, 1788, 1824, 1728, 1756, 1844, 1850, |
| 151581 | + /* 470 */ 1852, 1743, 1750, 1854, 1815, 1855, 1857, 1851, 1858, 1816, |
| 151582 | + /* 480 */ 1819, 1860, 1779, 1859, 1863, 1823, 1849, 1865, 1734, 1867, |
| 151583 | + /* 490 */ 1868, 1869, 1870, 1871, 1872, 1874, 1875, 1877, 1876, 1878, |
| 151584 | + /* 500 */ 1764, 1881, 1882, 1780, 1873, 1879, 1765, 1883, 1880, 1884, |
| 151585 | + /* 510 */ 1885, 1886, 1820, 1835, 1825, 1887, 1840, 1828, 1888, 1889, |
| 151586 | + /* 520 */ 1891, 1892, 1897, 1898, 1893, 1894, 1883, 1902, 1903, 1905, |
| 151587 | + /* 530 */ 1906, 1904, 1909, 1911, 1923, 1913, 1914, 1915, 1916, 1918, |
| 151588 | + /* 540 */ 1919, 1917, 1804, 1803, 1805, 1806, 1818, 1924, 1931, 1947, |
| 151589 | +}; |
| 151590 | +#define YY_REDUCE_COUNT (389) |
| 151591 | +#define YY_REDUCE_MIN (-262) |
| 151592 | +#define YY_REDUCE_MAX (1617) |
| 150479 | 151593 | static const short yy_reduce_ofst[] = { |
| 150480 | | - /* 0 */ 880, -121, 269, 528, 933, -119, -187, -185, -182, -180, |
| 150481 | | - /* 10 */ -176, -174, -62, -46, 131, -248, -133, 407, 568, 700, |
| 150482 | | - /* 20 */ 704, 278, 706, 824, 542, 830, 948, 773, 943, 946, |
| 150483 | | - /* 30 */ 71, 650, 211, 267, 826, 272, 676, 732, 885, 976, |
| 150484 | | - /* 40 */ 984, 992, -256, -256, -256, -256, -256, -256, -256, -256, |
| 150485 | | - /* 50 */ -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, |
| 150486 | | - /* 60 */ -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, |
| 150487 | | - /* 70 */ -256, -256, -256, -256, -256, -256, -256, 989, 1065, 1070, |
| 150488 | | - /* 80 */ 1072, 1078, 1082, 1084, 1103, 1118, 1147, 1156, 1160, 1167, |
| 150489 | | - /* 90 */ 1185, 1191, 1220, 1237, 1254, 1256, 1266, 1272, 1281, 1291, |
| 150490 | | - /* 100 */ 1293, 1296, 1299, 1301, 1307, 1337, 1340, 1342, 1347, 1366, |
| 150491 | | - /* 110 */ 1368, 1371, 1373, 1377, 1385, 1387, 1398, 1401, 1404, 1406, |
| 150492 | | - /* 120 */ 1411, 1413, 1415, 1430, -256, -256, -256, -256, -256, -256, |
| 150493 | | - /* 130 */ -256, -256, -256, -172, 508, -213, 57, -163, -25, 593, |
| 150494 | | - /* 140 */ 69, 486, 69, 486, -200, 573, 722, -256, -256, -256, |
| 150495 | | - /* 150 */ -256, -141, -141, -141, -105, -161, -167, 157, 212, 405, |
| 150496 | | - /* 160 */ 530, 220, 233, 735, 735, 115, 318, 406, 612, 541, |
| 150497 | | - /* 170 */ -166, 441, 688, 794, 629, 368, 741, 775, 867, 797, |
| 150498 | | - /* 180 */ 871, 842, -186, 1000, 858, 949, 379, 783, 70, 296, |
| 150499 | | - /* 190 */ 821, 903, 924, 1044, 651, 282, 1014, 1060, 937, -195, |
| 150500 | | - /* 200 */ -177, 413, 439, 511, 566, 787, 827, 848, 898, 945, |
| 150501 | | - /* 210 */ 1062, 1074, 1102, 1110, 1202, 1204, 1209, 1211, 1215, 529, |
| 150502 | | - /* 220 */ 1221, 1224, 1240, 1246, 1255, 1257, 1269, 1270, 1273, 1274, |
| 150503 | | - /* 230 */ 1275, 1280, 1205, 1251, 1294, 1310, 1317, 1326, 1327, 1124, |
| 150504 | | - /* 240 */ 1331, 1338, 1339, 1290, 1181, 1346, 1351, 1265, 1352, 787, |
| 150505 | | - /* 250 */ 1353, 1367, 1378, 1386, 1392, 1397, 1241, 1312, 1356, 1345, |
| 150506 | | - /* 260 */ 1357, 1358, 1359, 1124, 1356, 1356, 1364, 1396, 1433, 1341, |
| 150507 | | - /* 270 */ 1381, 1376, 1379, 1354, 1391, 1405, 1362, 1429, 1423, 1431, |
| 150508 | | - /* 280 */ 1434, 1435, 1437, 1399, 1410, 1412, 1382, 1417, 1420, 1466, |
| 150509 | | - /* 290 */ 1372, 1467, 1468, 1380, 1384, 1475, 1394, 1414, 1416, 1448, |
| 150510 | | - /* 300 */ 1440, 1451, 1452, 1453, 1454, 1490, 1493, 1449, 1455, 1427, |
| 150511 | | - /* 310 */ 1436, 1464, 1465, 1456, 1498, 1502, 1419, 1421, 1507, 1509, |
| 150512 | | - /* 320 */ 1491, 1510, 1513, 1514, 1516, 1496, 1500, 1501, 1503, 1499, |
| 150513 | | - /* 330 */ 1505, 1504, 1508, 1506, 1511, 1512, 1515, 1424, 1517, 1457, |
| 150514 | | - /* 340 */ 1460, 1519, 1474, 1482, 1483, 1485, 1486, 1488, 1489, 1492, |
| 150515 | | - /* 350 */ 1541, 1438, 1441, 1494, 1495, 1518, 1520, 1487, 1555, 1481, |
| 150516 | | - /* 360 */ 1522, 1523, 1526, 1528, 1561, 1566, 1580, 1581, 1586, 1587, |
| 150517 | | - /* 370 */ 1588, 1478, 1484, 1525, 1575, 1570, 1572, 1573, 1574, 1582, |
| 150518 | | - /* 380 */ 1568, 1569, 1578, 1579, 1583, 1590, |
| 151594 | + /* 0 */ 490, -122, 545, 645, 650, -120, -189, -187, -184, -182, |
| 151595 | + /* 10 */ -178, -176, 45, 30, 200, -251, -134, 390, 392, 521, |
| 151596 | + /* 20 */ 523, 213, 692, 821, 284, 589, 872, 666, 671, 866, |
| 151597 | + /* 30 */ 71, 111, 273, 389, 686, 815, 904, 932, 948, 955, |
| 151598 | + /* 40 */ 964, 969, -259, -259, -259, -259, -259, -259, -259, -259, |
| 151599 | + /* 50 */ -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, |
| 151600 | + /* 60 */ -259, -259, -259, -259, -259, -259, -259, -259, -259, -259, |
| 151601 | + /* 70 */ -259, -259, -259, -259, -259, -259, -259, -259, 428, 430, |
| 151602 | + /* 80 */ 899, 985, 1021, 1028, 1057, 1069, 1081, 1108, 1110, 1115, |
| 151603 | + /* 90 */ 1117, 1123, 1149, 1154, 1159, 1170, 1174, 1178, 1183, 1194, |
| 151604 | + /* 100 */ 1198, 1204, 1208, 1212, 1218, 1222, 1229, 1278, 1280, 1283, |
| 151605 | + /* 110 */ 1285, 1313, 1316, 1320, 1322, 1325, 1327, 1330, 1366, 1371, |
| 151606 | + /* 120 */ 1379, 1387, 1417, 1425, 1430, 1432, -259, -259, -259, -259, |
| 151607 | + /* 130 */ -259, -259, -259, -259, -259, 557, 974, -214, -174, -9, |
| 151608 | + /* 140 */ 431, -124, 806, 925, 806, 925, 251, 928, 940, -259, |
| 151609 | + /* 150 */ -259, -259, -259, -198, -198, -198, 127, -186, -168, 212, |
| 151610 | + /* 160 */ 646, 617, 799, -262, 555, 220, 220, 491, 605, 1040, |
| 151611 | + /* 170 */ 1060, 699, -11, 600, 848, 862, 345, -129, 724, -91, |
| 151612 | + /* 180 */ 158, 749, 716, 900, 304, 822, 929, 926, 499, 793, |
| 151613 | + /* 190 */ 322, 892, 813, 845, 958, 1056, 751, 905, 1133, 1062, |
| 151614 | + /* 200 */ 803, -210, -185, -179, -148, -167, -89, 121, 274, 281, |
| 151615 | + /* 210 */ 320, 336, 439, 663, 711, 957, 1064, 1068, 1116, 1127, |
| 151616 | + /* 220 */ 1134, -196, 1147, 1180, 1184, 1195, 1203, 1209, 1254, 1263, |
| 151617 | + /* 230 */ 1275, 1288, 1304, 1310, 205, 422, 638, 1319, 1324, 1346, |
| 151618 | + /* 240 */ 1360, 1168, 1364, 1370, 1372, 869, 1189, 1380, 1399, 1276, |
| 151619 | + /* 250 */ 1403, 121, 1405, 1420, 1426, 1427, 1428, 1429, 1249, 1282, |
| 151620 | + /* 260 */ 1344, 1375, 1376, 1377, 1388, 1168, 1344, 1344, 1384, 1411, |
| 151621 | + /* 270 */ 1436, 1349, 1389, 1386, 1391, 1361, 1407, 1408, 1365, 1431, |
| 151622 | + /* 280 */ 1433, 1434, 1439, 1441, 1442, 1396, 1416, 1418, 1390, 1421, |
| 151623 | + /* 290 */ 1437, 1472, 1381, 1478, 1480, 1397, 1400, 1487, 1412, 1444, |
| 151624 | + /* 300 */ 1438, 1463, 1453, 1464, 1465, 1467, 1469, 1514, 1517, 1473, |
| 151625 | + /* 310 */ 1474, 1452, 1449, 1490, 1491, 1475, 1522, 1526, 1443, 1445, |
| 151626 | + /* 320 */ 1528, 1530, 1513, 1534, 1536, 1537, 1539, 1516, 1523, 1524, |
| 151627 | + /* 330 */ 1527, 1519, 1529, 1532, 1540, 1541, 1535, 1542, 1544, 1545, |
| 151628 | + /* 340 */ 1547, 1450, 1543, 1477, 1482, 1551, 1505, 1508, 1512, 1509, |
| 151629 | + /* 350 */ 1515, 1518, 1533, 1552, 1573, 1466, 1468, 1549, 1550, 1555, |
| 151630 | + /* 360 */ 1554, 1510, 1583, 1511, 1556, 1559, 1561, 1565, 1588, 1592, |
| 151631 | + /* 370 */ 1601, 1602, 1607, 1608, 1609, 1498, 1557, 1558, 1610, 1600, |
| 151632 | + /* 380 */ 1603, 1611, 1612, 1613, 1596, 1597, 1614, 1615, 1617, 1616, |
| 150519 | 151633 | }; |
| 150520 | 151634 | static const YYACTIONTYPE yy_default[] = { |
| 150521 | | - /* 0 */ 1554, 1554, 1554, 1392, 1171, 1278, 1171, 1171, 1171, 1392, |
| 150522 | | - /* 10 */ 1392, 1392, 1171, 1308, 1308, 1445, 1202, 1171, 1171, 1171, |
| 150523 | | - /* 20 */ 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1391, 1171, 1171, |
| 150524 | | - /* 30 */ 1171, 1171, 1475, 1475, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150525 | | - /* 40 */ 1171, 1171, 1171, 1317, 1171, 1171, 1171, 1171, 1171, 1393, |
| 150526 | | - /* 50 */ 1394, 1171, 1171, 1171, 1444, 1446, 1409, 1327, 1326, 1325, |
| 150527 | | - /* 60 */ 1324, 1427, 1295, 1322, 1315, 1319, 1387, 1388, 1386, 1390, |
| 150528 | | - /* 70 */ 1394, 1393, 1171, 1318, 1358, 1372, 1357, 1171, 1171, 1171, |
| 150529 | | - /* 80 */ 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150530 | | - /* 90 */ 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150531 | | - /* 100 */ 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150532 | | - /* 110 */ 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150533 | | - /* 120 */ 1171, 1171, 1171, 1171, 1366, 1371, 1377, 1370, 1367, 1360, |
| 150534 | | - /* 130 */ 1359, 1361, 1362, 1171, 1192, 1242, 1171, 1171, 1171, 1171, |
| 150535 | | - /* 140 */ 1463, 1462, 1171, 1171, 1202, 1352, 1351, 1363, 1364, 1374, |
| 150536 | | - /* 150 */ 1373, 1452, 1510, 1509, 1410, 1171, 1171, 1171, 1171, 1171, |
| 150537 | | - /* 160 */ 1171, 1475, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150538 | | - /* 170 */ 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150539 | | - /* 180 */ 1171, 1171, 1171, 1171, 1171, 1171, 1475, 1475, 1171, 1202, |
| 150540 | | - /* 190 */ 1475, 1475, 1198, 1198, 1302, 1171, 1458, 1278, 1269, 1171, |
| 150541 | | - /* 200 */ 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150542 | | - /* 210 */ 1171, 1171, 1171, 1449, 1447, 1171, 1171, 1171, 1171, 1171, |
| 150543 | | - /* 220 */ 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150544 | | - /* 230 */ 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150545 | | - /* 240 */ 1171, 1171, 1171, 1274, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150546 | | - /* 250 */ 1171, 1171, 1171, 1171, 1171, 1504, 1171, 1422, 1256, 1274, |
| 150547 | | - /* 260 */ 1274, 1274, 1274, 1276, 1257, 1255, 1268, 1203, 1178, 1546, |
| 150548 | | - /* 270 */ 1321, 1297, 1297, 1543, 1321, 1321, 1543, 1217, 1524, 1214, |
| 150549 | | - /* 280 */ 1308, 1308, 1308, 1297, 1302, 1302, 1389, 1275, 1268, 1171, |
| 150550 | | - /* 290 */ 1546, 1283, 1283, 1545, 1545, 1283, 1410, 1330, 1336, 1245, |
| 150551 | | - /* 300 */ 1321, 1251, 1251, 1251, 1251, 1283, 1189, 1321, 1321, 1330, |
| 150552 | | - /* 310 */ 1336, 1245, 1245, 1321, 1283, 1189, 1426, 1540, 1283, 1189, |
| 150553 | | - /* 320 */ 1400, 1283, 1189, 1283, 1189, 1400, 1243, 1243, 1243, 1232, |
| 150554 | | - /* 330 */ 1400, 1243, 1217, 1243, 1232, 1243, 1243, 1493, 1400, 1404, |
| 150555 | | - /* 340 */ 1404, 1400, 1301, 1296, 1301, 1296, 1301, 1296, 1301, 1296, |
| 150556 | | - /* 350 */ 1283, 1485, 1485, 1311, 1311, 1316, 1302, 1395, 1283, 1171, |
| 150557 | | - /* 360 */ 1316, 1314, 1312, 1321, 1195, 1235, 1507, 1507, 1503, 1503, |
| 150558 | | - /* 370 */ 1503, 1551, 1551, 1458, 1519, 1202, 1202, 1202, 1202, 1519, |
| 150559 | | - /* 380 */ 1219, 1219, 1203, 1203, 1202, 1519, 1171, 1171, 1171, 1171, |
| 150560 | | - /* 390 */ 1171, 1171, 1514, 1171, 1411, 1287, 1171, 1171, 1171, 1171, |
| 150561 | | - /* 400 */ 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150562 | | - /* 410 */ 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1341, |
| 150563 | | - /* 420 */ 1171, 1174, 1455, 1171, 1171, 1453, 1171, 1171, 1171, 1171, |
| 150564 | | - /* 430 */ 1171, 1171, 1288, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150565 | | - /* 440 */ 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150566 | | - /* 450 */ 1171, 1542, 1171, 1171, 1171, 1171, 1171, 1171, 1425, 1424, |
| 150567 | | - /* 460 */ 1171, 1171, 1285, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150568 | | - /* 470 */ 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150569 | | - /* 480 */ 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150570 | | - /* 490 */ 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150571 | | - /* 500 */ 1313, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150572 | | - /* 510 */ 1171, 1171, 1171, 1171, 1171, 1490, 1303, 1171, 1171, 1533, |
| 150573 | | - /* 520 */ 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, |
| 150574 | | - /* 530 */ 1171, 1171, 1171, 1171, 1528, 1259, 1343, 1171, 1342, 1346, |
| 150575 | | - /* 540 */ 1171, 1183, 1171, |
| 151635 | + /* 0 */ 1572, 1572, 1572, 1408, 1185, 1294, 1185, 1185, 1185, 1408, |
| 151636 | + /* 10 */ 1408, 1408, 1185, 1324, 1324, 1461, 1216, 1185, 1185, 1185, |
| 151637 | + /* 20 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1407, 1185, 1185, |
| 151638 | + /* 30 */ 1185, 1185, 1491, 1491, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151639 | + /* 40 */ 1185, 1185, 1185, 1333, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151640 | + /* 50 */ 1409, 1410, 1185, 1185, 1185, 1460, 1462, 1425, 1343, 1342, |
| 151641 | + /* 60 */ 1341, 1340, 1443, 1311, 1338, 1331, 1335, 1403, 1404, 1402, |
| 151642 | + /* 70 */ 1406, 1410, 1409, 1185, 1334, 1374, 1388, 1373, 1185, 1185, |
| 151643 | + /* 80 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151644 | + /* 90 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151645 | + /* 100 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151646 | + /* 110 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151647 | + /* 120 */ 1185, 1185, 1185, 1185, 1185, 1185, 1382, 1387, 1393, 1386, |
| 151648 | + /* 130 */ 1383, 1376, 1375, 1377, 1378, 1185, 1206, 1258, 1185, 1185, |
| 151649 | + /* 140 */ 1185, 1185, 1479, 1478, 1185, 1185, 1216, 1368, 1367, 1379, |
| 151650 | + /* 150 */ 1380, 1390, 1389, 1468, 1526, 1525, 1426, 1185, 1185, 1185, |
| 151651 | + /* 160 */ 1185, 1185, 1185, 1491, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151652 | + /* 170 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151653 | + /* 180 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1491, 1491, |
| 151654 | + /* 190 */ 1185, 1216, 1491, 1491, 1212, 1212, 1318, 1185, 1474, 1294, |
| 151655 | + /* 200 */ 1285, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151656 | + /* 210 */ 1185, 1185, 1185, 1185, 1185, 1465, 1463, 1185, 1185, 1185, |
| 151657 | + /* 220 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151658 | + /* 230 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151659 | + /* 240 */ 1185, 1185, 1185, 1185, 1185, 1290, 1185, 1185, 1185, 1185, |
| 151660 | + /* 250 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1520, 1185, 1438, |
| 151661 | + /* 260 */ 1272, 1290, 1290, 1290, 1290, 1292, 1273, 1271, 1284, 1217, |
| 151662 | + /* 270 */ 1192, 1564, 1337, 1313, 1313, 1561, 1337, 1337, 1561, 1233, |
| 151663 | + /* 280 */ 1542, 1228, 1324, 1324, 1324, 1313, 1318, 1318, 1405, 1291, |
| 151664 | + /* 290 */ 1284, 1185, 1564, 1299, 1299, 1563, 1563, 1299, 1426, 1346, |
| 151665 | + /* 300 */ 1352, 1261, 1337, 1267, 1267, 1267, 1267, 1299, 1203, 1337, |
| 151666 | + /* 310 */ 1337, 1346, 1352, 1261, 1261, 1337, 1299, 1203, 1442, 1558, |
| 151667 | + /* 320 */ 1299, 1203, 1416, 1299, 1203, 1299, 1203, 1416, 1259, 1259, |
| 151668 | + /* 330 */ 1259, 1248, 1185, 1185, 1416, 1259, 1233, 1259, 1248, 1259, |
| 151669 | + /* 340 */ 1259, 1509, 1416, 1420, 1420, 1416, 1317, 1312, 1317, 1312, |
| 151670 | + /* 350 */ 1317, 1312, 1317, 1312, 1299, 1501, 1501, 1327, 1327, 1332, |
| 151671 | + /* 360 */ 1318, 1411, 1299, 1185, 1332, 1330, 1328, 1337, 1209, 1251, |
| 151672 | + /* 370 */ 1523, 1523, 1519, 1519, 1519, 1569, 1569, 1474, 1535, 1216, |
| 151673 | + /* 380 */ 1216, 1216, 1216, 1535, 1235, 1235, 1217, 1217, 1216, 1535, |
| 151674 | + /* 390 */ 1185, 1185, 1185, 1185, 1185, 1185, 1530, 1185, 1427, 1303, |
| 151675 | + /* 400 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151676 | + /* 410 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151677 | + /* 420 */ 1185, 1185, 1185, 1357, 1185, 1188, 1471, 1185, 1185, 1469, |
| 151678 | + /* 430 */ 1185, 1185, 1185, 1185, 1185, 1185, 1304, 1185, 1185, 1185, |
| 151679 | + /* 440 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151680 | + /* 450 */ 1185, 1185, 1185, 1185, 1185, 1560, 1185, 1185, 1185, 1185, |
| 151681 | + /* 460 */ 1185, 1185, 1441, 1440, 1185, 1185, 1301, 1185, 1185, 1185, |
| 151682 | + /* 470 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151683 | + /* 480 */ 1231, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151684 | + /* 490 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151685 | + /* 500 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1329, 1185, 1185, |
| 151686 | + /* 510 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151687 | + /* 520 */ 1185, 1185, 1506, 1319, 1185, 1185, 1551, 1185, 1185, 1185, |
| 151688 | + /* 530 */ 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, 1185, |
| 151689 | + /* 540 */ 1185, 1546, 1275, 1359, 1185, 1358, 1362, 1185, 1197, 1185, |
| 150576 | 151690 | }; |
| 150577 | 151691 | /********** End of lemon-generated parsing tables *****************************/ |
| 150578 | 151692 | |
| 150579 | 151693 | /* The next table maps tokens (terminal symbols) into fallback tokens. |
| 150580 | 151694 | ** If a construct like the following: |
| | @@ -150685,10 +151799,12 @@ |
| 150685 | 151799 | 59, /* UNBOUNDED => ID */ |
| 150686 | 151800 | 59, /* EXCLUDE => ID */ |
| 150687 | 151801 | 59, /* GROUPS => ID */ |
| 150688 | 151802 | 59, /* OTHERS => ID */ |
| 150689 | 151803 | 59, /* TIES => ID */ |
| 151804 | + 59, /* GENERATED => ID */ |
| 151805 | + 59, /* ALWAYS => ID */ |
| 150690 | 151806 | 59, /* REINDEX => ID */ |
| 150691 | 151807 | 59, /* RENAME => ID */ |
| 150692 | 151808 | 59, /* CTIME_KW => ID */ |
| 150693 | 151809 | 0, /* ANY => nothing */ |
| 150694 | 151810 | 0, /* BITAND => nothing */ |
| | @@ -150951,222 +152067,225 @@ |
| 150951 | 152067 | /* 90 */ "UNBOUNDED", |
| 150952 | 152068 | /* 91 */ "EXCLUDE", |
| 150953 | 152069 | /* 92 */ "GROUPS", |
| 150954 | 152070 | /* 93 */ "OTHERS", |
| 150955 | 152071 | /* 94 */ "TIES", |
| 150956 | | - /* 95 */ "REINDEX", |
| 150957 | | - /* 96 */ "RENAME", |
| 150958 | | - /* 97 */ "CTIME_KW", |
| 150959 | | - /* 98 */ "ANY", |
| 150960 | | - /* 99 */ "BITAND", |
| 150961 | | - /* 100 */ "BITOR", |
| 150962 | | - /* 101 */ "LSHIFT", |
| 150963 | | - /* 102 */ "RSHIFT", |
| 150964 | | - /* 103 */ "PLUS", |
| 150965 | | - /* 104 */ "MINUS", |
| 150966 | | - /* 105 */ "STAR", |
| 150967 | | - /* 106 */ "SLASH", |
| 150968 | | - /* 107 */ "REM", |
| 150969 | | - /* 108 */ "CONCAT", |
| 150970 | | - /* 109 */ "COLLATE", |
| 150971 | | - /* 110 */ "BITNOT", |
| 150972 | | - /* 111 */ "ON", |
| 150973 | | - /* 112 */ "INDEXED", |
| 150974 | | - /* 113 */ "STRING", |
| 150975 | | - /* 114 */ "JOIN_KW", |
| 150976 | | - /* 115 */ "CONSTRAINT", |
| 150977 | | - /* 116 */ "DEFAULT", |
| 150978 | | - /* 117 */ "NULL", |
| 150979 | | - /* 118 */ "PRIMARY", |
| 150980 | | - /* 119 */ "UNIQUE", |
| 150981 | | - /* 120 */ "CHECK", |
| 150982 | | - /* 121 */ "REFERENCES", |
| 150983 | | - /* 122 */ "AUTOINCR", |
| 150984 | | - /* 123 */ "INSERT", |
| 150985 | | - /* 124 */ "DELETE", |
| 150986 | | - /* 125 */ "UPDATE", |
| 150987 | | - /* 126 */ "SET", |
| 150988 | | - /* 127 */ "DEFERRABLE", |
| 150989 | | - /* 128 */ "FOREIGN", |
| 150990 | | - /* 129 */ "DROP", |
| 150991 | | - /* 130 */ "UNION", |
| 150992 | | - /* 131 */ "ALL", |
| 150993 | | - /* 132 */ "EXCEPT", |
| 150994 | | - /* 133 */ "INTERSECT", |
| 150995 | | - /* 134 */ "SELECT", |
| 150996 | | - /* 135 */ "VALUES", |
| 150997 | | - /* 136 */ "DISTINCT", |
| 150998 | | - /* 137 */ "DOT", |
| 150999 | | - /* 138 */ "FROM", |
| 151000 | | - /* 139 */ "JOIN", |
| 151001 | | - /* 140 */ "USING", |
| 151002 | | - /* 141 */ "ORDER", |
| 151003 | | - /* 142 */ "GROUP", |
| 151004 | | - /* 143 */ "HAVING", |
| 151005 | | - /* 144 */ "LIMIT", |
| 151006 | | - /* 145 */ "WHERE", |
| 151007 | | - /* 146 */ "INTO", |
| 151008 | | - /* 147 */ "NOTHING", |
| 151009 | | - /* 148 */ "FLOAT", |
| 151010 | | - /* 149 */ "BLOB", |
| 151011 | | - /* 150 */ "INTEGER", |
| 151012 | | - /* 151 */ "VARIABLE", |
| 151013 | | - /* 152 */ "CASE", |
| 151014 | | - /* 153 */ "WHEN", |
| 151015 | | - /* 154 */ "THEN", |
| 151016 | | - /* 155 */ "ELSE", |
| 151017 | | - /* 156 */ "INDEX", |
| 151018 | | - /* 157 */ "ALTER", |
| 151019 | | - /* 158 */ "ADD", |
| 151020 | | - /* 159 */ "WINDOW", |
| 151021 | | - /* 160 */ "OVER", |
| 151022 | | - /* 161 */ "FILTER", |
| 151023 | | - /* 162 */ "COLUMN", |
| 151024 | | - /* 163 */ "AGG_FUNCTION", |
| 151025 | | - /* 164 */ "AGG_COLUMN", |
| 151026 | | - /* 165 */ "TRUEFALSE", |
| 151027 | | - /* 166 */ "ISNOT", |
| 151028 | | - /* 167 */ "FUNCTION", |
| 151029 | | - /* 168 */ "UMINUS", |
| 151030 | | - /* 169 */ "UPLUS", |
| 151031 | | - /* 170 */ "TRUTH", |
| 151032 | | - /* 171 */ "REGISTER", |
| 151033 | | - /* 172 */ "VECTOR", |
| 151034 | | - /* 173 */ "SELECT_COLUMN", |
| 151035 | | - /* 174 */ "IF_NULL_ROW", |
| 151036 | | - /* 175 */ "ASTERISK", |
| 151037 | | - /* 176 */ "SPAN", |
| 151038 | | - /* 177 */ "SPACE", |
| 151039 | | - /* 178 */ "ILLEGAL", |
| 151040 | | - /* 179 */ "input", |
| 151041 | | - /* 180 */ "cmdlist", |
| 151042 | | - /* 181 */ "ecmd", |
| 151043 | | - /* 182 */ "cmdx", |
| 151044 | | - /* 183 */ "explain", |
| 151045 | | - /* 184 */ "cmd", |
| 151046 | | - /* 185 */ "transtype", |
| 151047 | | - /* 186 */ "trans_opt", |
| 151048 | | - /* 187 */ "nm", |
| 151049 | | - /* 188 */ "savepoint_opt", |
| 151050 | | - /* 189 */ "create_table", |
| 151051 | | - /* 190 */ "create_table_args", |
| 151052 | | - /* 191 */ "createkw", |
| 151053 | | - /* 192 */ "temp", |
| 151054 | | - /* 193 */ "ifnotexists", |
| 151055 | | - /* 194 */ "dbnm", |
| 151056 | | - /* 195 */ "columnlist", |
| 151057 | | - /* 196 */ "conslist_opt", |
| 151058 | | - /* 197 */ "table_options", |
| 151059 | | - /* 198 */ "select", |
| 151060 | | - /* 199 */ "columnname", |
| 151061 | | - /* 200 */ "carglist", |
| 151062 | | - /* 201 */ "typetoken", |
| 151063 | | - /* 202 */ "typename", |
| 151064 | | - /* 203 */ "signed", |
| 151065 | | - /* 204 */ "plus_num", |
| 151066 | | - /* 205 */ "minus_num", |
| 151067 | | - /* 206 */ "scanpt", |
| 151068 | | - /* 207 */ "scantok", |
| 151069 | | - /* 208 */ "ccons", |
| 151070 | | - /* 209 */ "term", |
| 151071 | | - /* 210 */ "expr", |
| 151072 | | - /* 211 */ "onconf", |
| 151073 | | - /* 212 */ "sortorder", |
| 151074 | | - /* 213 */ "autoinc", |
| 151075 | | - /* 214 */ "eidlist_opt", |
| 151076 | | - /* 215 */ "refargs", |
| 151077 | | - /* 216 */ "defer_subclause", |
| 151078 | | - /* 217 */ "refarg", |
| 151079 | | - /* 218 */ "refact", |
| 151080 | | - /* 219 */ "init_deferred_pred_opt", |
| 151081 | | - /* 220 */ "conslist", |
| 151082 | | - /* 221 */ "tconscomma", |
| 151083 | | - /* 222 */ "tcons", |
| 151084 | | - /* 223 */ "sortlist", |
| 151085 | | - /* 224 */ "eidlist", |
| 151086 | | - /* 225 */ "defer_subclause_opt", |
| 151087 | | - /* 226 */ "orconf", |
| 151088 | | - /* 227 */ "resolvetype", |
| 151089 | | - /* 228 */ "raisetype", |
| 151090 | | - /* 229 */ "ifexists", |
| 151091 | | - /* 230 */ "fullname", |
| 151092 | | - /* 231 */ "selectnowith", |
| 151093 | | - /* 232 */ "oneselect", |
| 151094 | | - /* 233 */ "wqlist", |
| 151095 | | - /* 234 */ "multiselect_op", |
| 151096 | | - /* 235 */ "distinct", |
| 151097 | | - /* 236 */ "selcollist", |
| 151098 | | - /* 237 */ "from", |
| 151099 | | - /* 238 */ "where_opt", |
| 151100 | | - /* 239 */ "groupby_opt", |
| 151101 | | - /* 240 */ "having_opt", |
| 151102 | | - /* 241 */ "orderby_opt", |
| 151103 | | - /* 242 */ "limit_opt", |
| 151104 | | - /* 243 */ "window_clause", |
| 151105 | | - /* 244 */ "values", |
| 151106 | | - /* 245 */ "nexprlist", |
| 151107 | | - /* 246 */ "sclp", |
| 151108 | | - /* 247 */ "as", |
| 151109 | | - /* 248 */ "seltablist", |
| 151110 | | - /* 249 */ "stl_prefix", |
| 151111 | | - /* 250 */ "joinop", |
| 151112 | | - /* 251 */ "indexed_opt", |
| 151113 | | - /* 252 */ "on_opt", |
| 151114 | | - /* 253 */ "using_opt", |
| 151115 | | - /* 254 */ "exprlist", |
| 151116 | | - /* 255 */ "xfullname", |
| 151117 | | - /* 256 */ "idlist", |
| 151118 | | - /* 257 */ "nulls", |
| 151119 | | - /* 258 */ "with", |
| 151120 | | - /* 259 */ "setlist", |
| 151121 | | - /* 260 */ "insert_cmd", |
| 151122 | | - /* 261 */ "idlist_opt", |
| 151123 | | - /* 262 */ "upsert", |
| 151124 | | - /* 263 */ "filter_over", |
| 151125 | | - /* 264 */ "likeop", |
| 151126 | | - /* 265 */ "between_op", |
| 151127 | | - /* 266 */ "in_op", |
| 151128 | | - /* 267 */ "paren_exprlist", |
| 151129 | | - /* 268 */ "case_operand", |
| 151130 | | - /* 269 */ "case_exprlist", |
| 151131 | | - /* 270 */ "case_else", |
| 151132 | | - /* 271 */ "uniqueflag", |
| 151133 | | - /* 272 */ "collate", |
| 151134 | | - /* 273 */ "vinto", |
| 151135 | | - /* 274 */ "nmnum", |
| 151136 | | - /* 275 */ "trigger_decl", |
| 151137 | | - /* 276 */ "trigger_cmd_list", |
| 151138 | | - /* 277 */ "trigger_time", |
| 151139 | | - /* 278 */ "trigger_event", |
| 151140 | | - /* 279 */ "foreach_clause", |
| 151141 | | - /* 280 */ "when_clause", |
| 151142 | | - /* 281 */ "trigger_cmd", |
| 151143 | | - /* 282 */ "trnm", |
| 151144 | | - /* 283 */ "tridxby", |
| 151145 | | - /* 284 */ "database_kw_opt", |
| 151146 | | - /* 285 */ "key_opt", |
| 151147 | | - /* 286 */ "add_column_fullname", |
| 151148 | | - /* 287 */ "kwcolumn_opt", |
| 151149 | | - /* 288 */ "create_vtab", |
| 151150 | | - /* 289 */ "vtabarglist", |
| 151151 | | - /* 290 */ "vtabarg", |
| 151152 | | - /* 291 */ "vtabargtoken", |
| 151153 | | - /* 292 */ "lp", |
| 151154 | | - /* 293 */ "anylist", |
| 151155 | | - /* 294 */ "windowdefn_list", |
| 151156 | | - /* 295 */ "windowdefn", |
| 151157 | | - /* 296 */ "window", |
| 151158 | | - /* 297 */ "frame_opt", |
| 151159 | | - /* 298 */ "part_opt", |
| 151160 | | - /* 299 */ "filter_clause", |
| 151161 | | - /* 300 */ "over_clause", |
| 151162 | | - /* 301 */ "range_or_rows", |
| 151163 | | - /* 302 */ "frame_bound", |
| 151164 | | - /* 303 */ "frame_bound_s", |
| 151165 | | - /* 304 */ "frame_bound_e", |
| 151166 | | - /* 305 */ "frame_exclude_opt", |
| 151167 | | - /* 306 */ "frame_exclude", |
| 152072 | + /* 95 */ "GENERATED", |
| 152073 | + /* 96 */ "ALWAYS", |
| 152074 | + /* 97 */ "REINDEX", |
| 152075 | + /* 98 */ "RENAME", |
| 152076 | + /* 99 */ "CTIME_KW", |
| 152077 | + /* 100 */ "ANY", |
| 152078 | + /* 101 */ "BITAND", |
| 152079 | + /* 102 */ "BITOR", |
| 152080 | + /* 103 */ "LSHIFT", |
| 152081 | + /* 104 */ "RSHIFT", |
| 152082 | + /* 105 */ "PLUS", |
| 152083 | + /* 106 */ "MINUS", |
| 152084 | + /* 107 */ "STAR", |
| 152085 | + /* 108 */ "SLASH", |
| 152086 | + /* 109 */ "REM", |
| 152087 | + /* 110 */ "CONCAT", |
| 152088 | + /* 111 */ "COLLATE", |
| 152089 | + /* 112 */ "BITNOT", |
| 152090 | + /* 113 */ "ON", |
| 152091 | + /* 114 */ "INDEXED", |
| 152092 | + /* 115 */ "STRING", |
| 152093 | + /* 116 */ "JOIN_KW", |
| 152094 | + /* 117 */ "CONSTRAINT", |
| 152095 | + /* 118 */ "DEFAULT", |
| 152096 | + /* 119 */ "NULL", |
| 152097 | + /* 120 */ "PRIMARY", |
| 152098 | + /* 121 */ "UNIQUE", |
| 152099 | + /* 122 */ "CHECK", |
| 152100 | + /* 123 */ "REFERENCES", |
| 152101 | + /* 124 */ "AUTOINCR", |
| 152102 | + /* 125 */ "INSERT", |
| 152103 | + /* 126 */ "DELETE", |
| 152104 | + /* 127 */ "UPDATE", |
| 152105 | + /* 128 */ "SET", |
| 152106 | + /* 129 */ "DEFERRABLE", |
| 152107 | + /* 130 */ "FOREIGN", |
| 152108 | + /* 131 */ "DROP", |
| 152109 | + /* 132 */ "UNION", |
| 152110 | + /* 133 */ "ALL", |
| 152111 | + /* 134 */ "EXCEPT", |
| 152112 | + /* 135 */ "INTERSECT", |
| 152113 | + /* 136 */ "SELECT", |
| 152114 | + /* 137 */ "VALUES", |
| 152115 | + /* 138 */ "DISTINCT", |
| 152116 | + /* 139 */ "DOT", |
| 152117 | + /* 140 */ "FROM", |
| 152118 | + /* 141 */ "JOIN", |
| 152119 | + /* 142 */ "USING", |
| 152120 | + /* 143 */ "ORDER", |
| 152121 | + /* 144 */ "GROUP", |
| 152122 | + /* 145 */ "HAVING", |
| 152123 | + /* 146 */ "LIMIT", |
| 152124 | + /* 147 */ "WHERE", |
| 152125 | + /* 148 */ "INTO", |
| 152126 | + /* 149 */ "NOTHING", |
| 152127 | + /* 150 */ "FLOAT", |
| 152128 | + /* 151 */ "BLOB", |
| 152129 | + /* 152 */ "INTEGER", |
| 152130 | + /* 153 */ "VARIABLE", |
| 152131 | + /* 154 */ "CASE", |
| 152132 | + /* 155 */ "WHEN", |
| 152133 | + /* 156 */ "THEN", |
| 152134 | + /* 157 */ "ELSE", |
| 152135 | + /* 158 */ "INDEX", |
| 152136 | + /* 159 */ "ALTER", |
| 152137 | + /* 160 */ "ADD", |
| 152138 | + /* 161 */ "WINDOW", |
| 152139 | + /* 162 */ "OVER", |
| 152140 | + /* 163 */ "FILTER", |
| 152141 | + /* 164 */ "COLUMN", |
| 152142 | + /* 165 */ "AGG_FUNCTION", |
| 152143 | + /* 166 */ "AGG_COLUMN", |
| 152144 | + /* 167 */ "TRUEFALSE", |
| 152145 | + /* 168 */ "ISNOT", |
| 152146 | + /* 169 */ "FUNCTION", |
| 152147 | + /* 170 */ "UMINUS", |
| 152148 | + /* 171 */ "UPLUS", |
| 152149 | + /* 172 */ "TRUTH", |
| 152150 | + /* 173 */ "REGISTER", |
| 152151 | + /* 174 */ "VECTOR", |
| 152152 | + /* 175 */ "SELECT_COLUMN", |
| 152153 | + /* 176 */ "IF_NULL_ROW", |
| 152154 | + /* 177 */ "ASTERISK", |
| 152155 | + /* 178 */ "SPAN", |
| 152156 | + /* 179 */ "SPACE", |
| 152157 | + /* 180 */ "ILLEGAL", |
| 152158 | + /* 181 */ "input", |
| 152159 | + /* 182 */ "cmdlist", |
| 152160 | + /* 183 */ "ecmd", |
| 152161 | + /* 184 */ "cmdx", |
| 152162 | + /* 185 */ "explain", |
| 152163 | + /* 186 */ "cmd", |
| 152164 | + /* 187 */ "transtype", |
| 152165 | + /* 188 */ "trans_opt", |
| 152166 | + /* 189 */ "nm", |
| 152167 | + /* 190 */ "savepoint_opt", |
| 152168 | + /* 191 */ "create_table", |
| 152169 | + /* 192 */ "create_table_args", |
| 152170 | + /* 193 */ "createkw", |
| 152171 | + /* 194 */ "temp", |
| 152172 | + /* 195 */ "ifnotexists", |
| 152173 | + /* 196 */ "dbnm", |
| 152174 | + /* 197 */ "columnlist", |
| 152175 | + /* 198 */ "conslist_opt", |
| 152176 | + /* 199 */ "table_options", |
| 152177 | + /* 200 */ "select", |
| 152178 | + /* 201 */ "columnname", |
| 152179 | + /* 202 */ "carglist", |
| 152180 | + /* 203 */ "typetoken", |
| 152181 | + /* 204 */ "typename", |
| 152182 | + /* 205 */ "signed", |
| 152183 | + /* 206 */ "plus_num", |
| 152184 | + /* 207 */ "minus_num", |
| 152185 | + /* 208 */ "scanpt", |
| 152186 | + /* 209 */ "scantok", |
| 152187 | + /* 210 */ "ccons", |
| 152188 | + /* 211 */ "term", |
| 152189 | + /* 212 */ "expr", |
| 152190 | + /* 213 */ "onconf", |
| 152191 | + /* 214 */ "sortorder", |
| 152192 | + /* 215 */ "autoinc", |
| 152193 | + /* 216 */ "eidlist_opt", |
| 152194 | + /* 217 */ "refargs", |
| 152195 | + /* 218 */ "defer_subclause", |
| 152196 | + /* 219 */ "generated", |
| 152197 | + /* 220 */ "refarg", |
| 152198 | + /* 221 */ "refact", |
| 152199 | + /* 222 */ "init_deferred_pred_opt", |
| 152200 | + /* 223 */ "conslist", |
| 152201 | + /* 224 */ "tconscomma", |
| 152202 | + /* 225 */ "tcons", |
| 152203 | + /* 226 */ "sortlist", |
| 152204 | + /* 227 */ "eidlist", |
| 152205 | + /* 228 */ "defer_subclause_opt", |
| 152206 | + /* 229 */ "orconf", |
| 152207 | + /* 230 */ "resolvetype", |
| 152208 | + /* 231 */ "raisetype", |
| 152209 | + /* 232 */ "ifexists", |
| 152210 | + /* 233 */ "fullname", |
| 152211 | + /* 234 */ "selectnowith", |
| 152212 | + /* 235 */ "oneselect", |
| 152213 | + /* 236 */ "wqlist", |
| 152214 | + /* 237 */ "multiselect_op", |
| 152215 | + /* 238 */ "distinct", |
| 152216 | + /* 239 */ "selcollist", |
| 152217 | + /* 240 */ "from", |
| 152218 | + /* 241 */ "where_opt", |
| 152219 | + /* 242 */ "groupby_opt", |
| 152220 | + /* 243 */ "having_opt", |
| 152221 | + /* 244 */ "orderby_opt", |
| 152222 | + /* 245 */ "limit_opt", |
| 152223 | + /* 246 */ "window_clause", |
| 152224 | + /* 247 */ "values", |
| 152225 | + /* 248 */ "nexprlist", |
| 152226 | + /* 249 */ "sclp", |
| 152227 | + /* 250 */ "as", |
| 152228 | + /* 251 */ "seltablist", |
| 152229 | + /* 252 */ "stl_prefix", |
| 152230 | + /* 253 */ "joinop", |
| 152231 | + /* 254 */ "indexed_opt", |
| 152232 | + /* 255 */ "on_opt", |
| 152233 | + /* 256 */ "using_opt", |
| 152234 | + /* 257 */ "exprlist", |
| 152235 | + /* 258 */ "xfullname", |
| 152236 | + /* 259 */ "idlist", |
| 152237 | + /* 260 */ "nulls", |
| 152238 | + /* 261 */ "with", |
| 152239 | + /* 262 */ "setlist", |
| 152240 | + /* 263 */ "insert_cmd", |
| 152241 | + /* 264 */ "idlist_opt", |
| 152242 | + /* 265 */ "upsert", |
| 152243 | + /* 266 */ "filter_over", |
| 152244 | + /* 267 */ "likeop", |
| 152245 | + /* 268 */ "between_op", |
| 152246 | + /* 269 */ "in_op", |
| 152247 | + /* 270 */ "paren_exprlist", |
| 152248 | + /* 271 */ "case_operand", |
| 152249 | + /* 272 */ "case_exprlist", |
| 152250 | + /* 273 */ "case_else", |
| 152251 | + /* 274 */ "uniqueflag", |
| 152252 | + /* 275 */ "collate", |
| 152253 | + /* 276 */ "vinto", |
| 152254 | + /* 277 */ "nmnum", |
| 152255 | + /* 278 */ "trigger_decl", |
| 152256 | + /* 279 */ "trigger_cmd_list", |
| 152257 | + /* 280 */ "trigger_time", |
| 152258 | + /* 281 */ "trigger_event", |
| 152259 | + /* 282 */ "foreach_clause", |
| 152260 | + /* 283 */ "when_clause", |
| 152261 | + /* 284 */ "trigger_cmd", |
| 152262 | + /* 285 */ "trnm", |
| 152263 | + /* 286 */ "tridxby", |
| 152264 | + /* 287 */ "database_kw_opt", |
| 152265 | + /* 288 */ "key_opt", |
| 152266 | + /* 289 */ "add_column_fullname", |
| 152267 | + /* 290 */ "kwcolumn_opt", |
| 152268 | + /* 291 */ "create_vtab", |
| 152269 | + /* 292 */ "vtabarglist", |
| 152270 | + /* 293 */ "vtabarg", |
| 152271 | + /* 294 */ "vtabargtoken", |
| 152272 | + /* 295 */ "lp", |
| 152273 | + /* 296 */ "anylist", |
| 152274 | + /* 297 */ "windowdefn_list", |
| 152275 | + /* 298 */ "windowdefn", |
| 152276 | + /* 299 */ "window", |
| 152277 | + /* 300 */ "frame_opt", |
| 152278 | + /* 301 */ "part_opt", |
| 152279 | + /* 302 */ "filter_clause", |
| 152280 | + /* 303 */ "over_clause", |
| 152281 | + /* 304 */ "range_or_rows", |
| 152282 | + /* 305 */ "frame_bound", |
| 152283 | + /* 306 */ "frame_bound_s", |
| 152284 | + /* 307 */ "frame_bound_e", |
| 152285 | + /* 308 */ "frame_exclude_opt", |
| 152286 | + /* 309 */ "frame_exclude", |
| 151168 | 152287 | }; |
| 151169 | 152288 | #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ |
| 151170 | 152289 | |
| 151171 | 152290 | #ifndef NDEBUG |
| 151172 | 152291 | /* For tracing reduce actions, the names of all rules are required. |
| | @@ -151213,348 +152332,352 @@ |
| 151213 | 152332 | /* 38 */ "ccons ::= UNIQUE onconf", |
| 151214 | 152333 | /* 39 */ "ccons ::= CHECK LP expr RP", |
| 151215 | 152334 | /* 40 */ "ccons ::= REFERENCES nm eidlist_opt refargs", |
| 151216 | 152335 | /* 41 */ "ccons ::= defer_subclause", |
| 151217 | 152336 | /* 42 */ "ccons ::= COLLATE ID|STRING", |
| 151218 | | - /* 43 */ "autoinc ::=", |
| 151219 | | - /* 44 */ "autoinc ::= AUTOINCR", |
| 151220 | | - /* 45 */ "refargs ::=", |
| 151221 | | - /* 46 */ "refargs ::= refargs refarg", |
| 151222 | | - /* 47 */ "refarg ::= MATCH nm", |
| 151223 | | - /* 48 */ "refarg ::= ON INSERT refact", |
| 151224 | | - /* 49 */ "refarg ::= ON DELETE refact", |
| 151225 | | - /* 50 */ "refarg ::= ON UPDATE refact", |
| 151226 | | - /* 51 */ "refact ::= SET NULL", |
| 151227 | | - /* 52 */ "refact ::= SET DEFAULT", |
| 151228 | | - /* 53 */ "refact ::= CASCADE", |
| 151229 | | - /* 54 */ "refact ::= RESTRICT", |
| 151230 | | - /* 55 */ "refact ::= NO ACTION", |
| 151231 | | - /* 56 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt", |
| 151232 | | - /* 57 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt", |
| 151233 | | - /* 58 */ "init_deferred_pred_opt ::=", |
| 151234 | | - /* 59 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED", |
| 151235 | | - /* 60 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE", |
| 151236 | | - /* 61 */ "conslist_opt ::=", |
| 151237 | | - /* 62 */ "tconscomma ::= COMMA", |
| 151238 | | - /* 63 */ "tcons ::= CONSTRAINT nm", |
| 151239 | | - /* 64 */ "tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf", |
| 151240 | | - /* 65 */ "tcons ::= UNIQUE LP sortlist RP onconf", |
| 151241 | | - /* 66 */ "tcons ::= CHECK LP expr RP onconf", |
| 151242 | | - /* 67 */ "tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt", |
| 151243 | | - /* 68 */ "defer_subclause_opt ::=", |
| 151244 | | - /* 69 */ "onconf ::=", |
| 151245 | | - /* 70 */ "onconf ::= ON CONFLICT resolvetype", |
| 151246 | | - /* 71 */ "orconf ::=", |
| 151247 | | - /* 72 */ "orconf ::= OR resolvetype", |
| 151248 | | - /* 73 */ "resolvetype ::= IGNORE", |
| 151249 | | - /* 74 */ "resolvetype ::= REPLACE", |
| 151250 | | - /* 75 */ "cmd ::= DROP TABLE ifexists fullname", |
| 151251 | | - /* 76 */ "ifexists ::= IF EXISTS", |
| 151252 | | - /* 77 */ "ifexists ::=", |
| 151253 | | - /* 78 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select", |
| 151254 | | - /* 79 */ "cmd ::= DROP VIEW ifexists fullname", |
| 151255 | | - /* 80 */ "cmd ::= select", |
| 151256 | | - /* 81 */ "select ::= WITH wqlist selectnowith", |
| 151257 | | - /* 82 */ "select ::= WITH RECURSIVE wqlist selectnowith", |
| 151258 | | - /* 83 */ "select ::= selectnowith", |
| 151259 | | - /* 84 */ "selectnowith ::= selectnowith multiselect_op oneselect", |
| 151260 | | - /* 85 */ "multiselect_op ::= UNION", |
| 151261 | | - /* 86 */ "multiselect_op ::= UNION ALL", |
| 151262 | | - /* 87 */ "multiselect_op ::= EXCEPT|INTERSECT", |
| 151263 | | - /* 88 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt", |
| 151264 | | - /* 89 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt", |
| 151265 | | - /* 90 */ "values ::= VALUES LP nexprlist RP", |
| 151266 | | - /* 91 */ "values ::= values COMMA LP nexprlist RP", |
| 151267 | | - /* 92 */ "distinct ::= DISTINCT", |
| 151268 | | - /* 93 */ "distinct ::= ALL", |
| 151269 | | - /* 94 */ "distinct ::=", |
| 151270 | | - /* 95 */ "sclp ::=", |
| 151271 | | - /* 96 */ "selcollist ::= sclp scanpt expr scanpt as", |
| 151272 | | - /* 97 */ "selcollist ::= sclp scanpt STAR", |
| 151273 | | - /* 98 */ "selcollist ::= sclp scanpt nm DOT STAR", |
| 151274 | | - /* 99 */ "as ::= AS nm", |
| 151275 | | - /* 100 */ "as ::=", |
| 151276 | | - /* 101 */ "from ::=", |
| 151277 | | - /* 102 */ "from ::= FROM seltablist", |
| 151278 | | - /* 103 */ "stl_prefix ::= seltablist joinop", |
| 151279 | | - /* 104 */ "stl_prefix ::=", |
| 151280 | | - /* 105 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt", |
| 151281 | | - /* 106 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt", |
| 151282 | | - /* 107 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt", |
| 151283 | | - /* 108 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt", |
| 151284 | | - /* 109 */ "dbnm ::=", |
| 151285 | | - /* 110 */ "dbnm ::= DOT nm", |
| 151286 | | - /* 111 */ "fullname ::= nm", |
| 151287 | | - /* 112 */ "fullname ::= nm DOT nm", |
| 151288 | | - /* 113 */ "xfullname ::= nm", |
| 151289 | | - /* 114 */ "xfullname ::= nm DOT nm", |
| 151290 | | - /* 115 */ "xfullname ::= nm DOT nm AS nm", |
| 151291 | | - /* 116 */ "xfullname ::= nm AS nm", |
| 151292 | | - /* 117 */ "joinop ::= COMMA|JOIN", |
| 151293 | | - /* 118 */ "joinop ::= JOIN_KW JOIN", |
| 151294 | | - /* 119 */ "joinop ::= JOIN_KW nm JOIN", |
| 151295 | | - /* 120 */ "joinop ::= JOIN_KW nm nm JOIN", |
| 151296 | | - /* 121 */ "on_opt ::= ON expr", |
| 151297 | | - /* 122 */ "on_opt ::=", |
| 151298 | | - /* 123 */ "indexed_opt ::=", |
| 151299 | | - /* 124 */ "indexed_opt ::= INDEXED BY nm", |
| 151300 | | - /* 125 */ "indexed_opt ::= NOT INDEXED", |
| 151301 | | - /* 126 */ "using_opt ::= USING LP idlist RP", |
| 151302 | | - /* 127 */ "using_opt ::=", |
| 151303 | | - /* 128 */ "orderby_opt ::=", |
| 151304 | | - /* 129 */ "orderby_opt ::= ORDER BY sortlist", |
| 151305 | | - /* 130 */ "sortlist ::= sortlist COMMA expr sortorder nulls", |
| 151306 | | - /* 131 */ "sortlist ::= expr sortorder nulls", |
| 151307 | | - /* 132 */ "sortorder ::= ASC", |
| 151308 | | - /* 133 */ "sortorder ::= DESC", |
| 151309 | | - /* 134 */ "sortorder ::=", |
| 151310 | | - /* 135 */ "nulls ::= NULLS FIRST", |
| 151311 | | - /* 136 */ "nulls ::= NULLS LAST", |
| 151312 | | - /* 137 */ "nulls ::=", |
| 151313 | | - /* 138 */ "groupby_opt ::=", |
| 151314 | | - /* 139 */ "groupby_opt ::= GROUP BY nexprlist", |
| 151315 | | - /* 140 */ "having_opt ::=", |
| 151316 | | - /* 141 */ "having_opt ::= HAVING expr", |
| 151317 | | - /* 142 */ "limit_opt ::=", |
| 151318 | | - /* 143 */ "limit_opt ::= LIMIT expr", |
| 151319 | | - /* 144 */ "limit_opt ::= LIMIT expr OFFSET expr", |
| 151320 | | - /* 145 */ "limit_opt ::= LIMIT expr COMMA expr", |
| 151321 | | - /* 146 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt", |
| 151322 | | - /* 147 */ "where_opt ::=", |
| 151323 | | - /* 148 */ "where_opt ::= WHERE expr", |
| 151324 | | - /* 149 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt", |
| 151325 | | - /* 150 */ "setlist ::= setlist COMMA nm EQ expr", |
| 151326 | | - /* 151 */ "setlist ::= setlist COMMA LP idlist RP EQ expr", |
| 151327 | | - /* 152 */ "setlist ::= nm EQ expr", |
| 151328 | | - /* 153 */ "setlist ::= LP idlist RP EQ expr", |
| 151329 | | - /* 154 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert", |
| 151330 | | - /* 155 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES", |
| 151331 | | - /* 156 */ "upsert ::=", |
| 151332 | | - /* 157 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt", |
| 151333 | | - /* 158 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING", |
| 151334 | | - /* 159 */ "upsert ::= ON CONFLICT DO NOTHING", |
| 151335 | | - /* 160 */ "insert_cmd ::= INSERT orconf", |
| 151336 | | - /* 161 */ "insert_cmd ::= REPLACE", |
| 151337 | | - /* 162 */ "idlist_opt ::=", |
| 151338 | | - /* 163 */ "idlist_opt ::= LP idlist RP", |
| 151339 | | - /* 164 */ "idlist ::= idlist COMMA nm", |
| 151340 | | - /* 165 */ "idlist ::= nm", |
| 151341 | | - /* 166 */ "expr ::= LP expr RP", |
| 151342 | | - /* 167 */ "expr ::= ID|INDEXED", |
| 151343 | | - /* 168 */ "expr ::= JOIN_KW", |
| 151344 | | - /* 169 */ "expr ::= nm DOT nm", |
| 151345 | | - /* 170 */ "expr ::= nm DOT nm DOT nm", |
| 151346 | | - /* 171 */ "term ::= NULL|FLOAT|BLOB", |
| 151347 | | - /* 172 */ "term ::= STRING", |
| 151348 | | - /* 173 */ "term ::= INTEGER", |
| 151349 | | - /* 174 */ "expr ::= VARIABLE", |
| 151350 | | - /* 175 */ "expr ::= expr COLLATE ID|STRING", |
| 151351 | | - /* 176 */ "expr ::= CAST LP expr AS typetoken RP", |
| 151352 | | - /* 177 */ "expr ::= ID|INDEXED LP distinct exprlist RP", |
| 151353 | | - /* 178 */ "expr ::= ID|INDEXED LP STAR RP", |
| 151354 | | - /* 179 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over", |
| 151355 | | - /* 180 */ "expr ::= ID|INDEXED LP STAR RP filter_over", |
| 151356 | | - /* 181 */ "term ::= CTIME_KW", |
| 151357 | | - /* 182 */ "expr ::= LP nexprlist COMMA expr RP", |
| 151358 | | - /* 183 */ "expr ::= expr AND expr", |
| 151359 | | - /* 184 */ "expr ::= expr OR expr", |
| 151360 | | - /* 185 */ "expr ::= expr LT|GT|GE|LE expr", |
| 151361 | | - /* 186 */ "expr ::= expr EQ|NE expr", |
| 151362 | | - /* 187 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", |
| 151363 | | - /* 188 */ "expr ::= expr PLUS|MINUS expr", |
| 151364 | | - /* 189 */ "expr ::= expr STAR|SLASH|REM expr", |
| 151365 | | - /* 190 */ "expr ::= expr CONCAT expr", |
| 151366 | | - /* 191 */ "likeop ::= NOT LIKE_KW|MATCH", |
| 151367 | | - /* 192 */ "expr ::= expr likeop expr", |
| 151368 | | - /* 193 */ "expr ::= expr likeop expr ESCAPE expr", |
| 151369 | | - /* 194 */ "expr ::= expr ISNULL|NOTNULL", |
| 151370 | | - /* 195 */ "expr ::= expr NOT NULL", |
| 151371 | | - /* 196 */ "expr ::= expr IS expr", |
| 151372 | | - /* 197 */ "expr ::= expr IS NOT expr", |
| 151373 | | - /* 198 */ "expr ::= NOT expr", |
| 151374 | | - /* 199 */ "expr ::= BITNOT expr", |
| 151375 | | - /* 200 */ "expr ::= PLUS|MINUS expr", |
| 151376 | | - /* 201 */ "between_op ::= BETWEEN", |
| 151377 | | - /* 202 */ "between_op ::= NOT BETWEEN", |
| 151378 | | - /* 203 */ "expr ::= expr between_op expr AND expr", |
| 151379 | | - /* 204 */ "in_op ::= IN", |
| 151380 | | - /* 205 */ "in_op ::= NOT IN", |
| 151381 | | - /* 206 */ "expr ::= expr in_op LP exprlist RP", |
| 151382 | | - /* 207 */ "expr ::= LP select RP", |
| 151383 | | - /* 208 */ "expr ::= expr in_op LP select RP", |
| 151384 | | - /* 209 */ "expr ::= expr in_op nm dbnm paren_exprlist", |
| 151385 | | - /* 210 */ "expr ::= EXISTS LP select RP", |
| 151386 | | - /* 211 */ "expr ::= CASE case_operand case_exprlist case_else END", |
| 151387 | | - /* 212 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", |
| 151388 | | - /* 213 */ "case_exprlist ::= WHEN expr THEN expr", |
| 151389 | | - /* 214 */ "case_else ::= ELSE expr", |
| 151390 | | - /* 215 */ "case_else ::=", |
| 151391 | | - /* 216 */ "case_operand ::= expr", |
| 151392 | | - /* 217 */ "case_operand ::=", |
| 151393 | | - /* 218 */ "exprlist ::=", |
| 151394 | | - /* 219 */ "nexprlist ::= nexprlist COMMA expr", |
| 151395 | | - /* 220 */ "nexprlist ::= expr", |
| 151396 | | - /* 221 */ "paren_exprlist ::=", |
| 151397 | | - /* 222 */ "paren_exprlist ::= LP exprlist RP", |
| 151398 | | - /* 223 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", |
| 151399 | | - /* 224 */ "uniqueflag ::= UNIQUE", |
| 151400 | | - /* 225 */ "uniqueflag ::=", |
| 151401 | | - /* 226 */ "eidlist_opt ::=", |
| 151402 | | - /* 227 */ "eidlist_opt ::= LP eidlist RP", |
| 151403 | | - /* 228 */ "eidlist ::= eidlist COMMA nm collate sortorder", |
| 151404 | | - /* 229 */ "eidlist ::= nm collate sortorder", |
| 151405 | | - /* 230 */ "collate ::=", |
| 151406 | | - /* 231 */ "collate ::= COLLATE ID|STRING", |
| 151407 | | - /* 232 */ "cmd ::= DROP INDEX ifexists fullname", |
| 151408 | | - /* 233 */ "cmd ::= VACUUM vinto", |
| 151409 | | - /* 234 */ "cmd ::= VACUUM nm vinto", |
| 151410 | | - /* 235 */ "vinto ::= INTO expr", |
| 151411 | | - /* 236 */ "vinto ::=", |
| 151412 | | - /* 237 */ "cmd ::= PRAGMA nm dbnm", |
| 151413 | | - /* 238 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", |
| 151414 | | - /* 239 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", |
| 151415 | | - /* 240 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", |
| 151416 | | - /* 241 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", |
| 151417 | | - /* 242 */ "plus_num ::= PLUS INTEGER|FLOAT", |
| 151418 | | - /* 243 */ "minus_num ::= MINUS INTEGER|FLOAT", |
| 151419 | | - /* 244 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", |
| 151420 | | - /* 245 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", |
| 151421 | | - /* 246 */ "trigger_time ::= BEFORE|AFTER", |
| 151422 | | - /* 247 */ "trigger_time ::= INSTEAD OF", |
| 151423 | | - /* 248 */ "trigger_time ::=", |
| 151424 | | - /* 249 */ "trigger_event ::= DELETE|INSERT", |
| 151425 | | - /* 250 */ "trigger_event ::= UPDATE", |
| 151426 | | - /* 251 */ "trigger_event ::= UPDATE OF idlist", |
| 151427 | | - /* 252 */ "when_clause ::=", |
| 151428 | | - /* 253 */ "when_clause ::= WHEN expr", |
| 151429 | | - /* 254 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", |
| 151430 | | - /* 255 */ "trigger_cmd_list ::= trigger_cmd SEMI", |
| 151431 | | - /* 256 */ "trnm ::= nm DOT nm", |
| 151432 | | - /* 257 */ "tridxby ::= INDEXED BY nm", |
| 151433 | | - /* 258 */ "tridxby ::= NOT INDEXED", |
| 151434 | | - /* 259 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt", |
| 151435 | | - /* 260 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", |
| 151436 | | - /* 261 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", |
| 151437 | | - /* 262 */ "trigger_cmd ::= scanpt select scanpt", |
| 151438 | | - /* 263 */ "expr ::= RAISE LP IGNORE RP", |
| 151439 | | - /* 264 */ "expr ::= RAISE LP raisetype COMMA nm RP", |
| 151440 | | - /* 265 */ "raisetype ::= ROLLBACK", |
| 151441 | | - /* 266 */ "raisetype ::= ABORT", |
| 151442 | | - /* 267 */ "raisetype ::= FAIL", |
| 151443 | | - /* 268 */ "cmd ::= DROP TRIGGER ifexists fullname", |
| 151444 | | - /* 269 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", |
| 151445 | | - /* 270 */ "cmd ::= DETACH database_kw_opt expr", |
| 151446 | | - /* 271 */ "key_opt ::=", |
| 151447 | | - /* 272 */ "key_opt ::= KEY expr", |
| 151448 | | - /* 273 */ "cmd ::= REINDEX", |
| 151449 | | - /* 274 */ "cmd ::= REINDEX nm dbnm", |
| 151450 | | - /* 275 */ "cmd ::= ANALYZE", |
| 151451 | | - /* 276 */ "cmd ::= ANALYZE nm dbnm", |
| 151452 | | - /* 277 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", |
| 151453 | | - /* 278 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", |
| 151454 | | - /* 279 */ "add_column_fullname ::= fullname", |
| 151455 | | - /* 280 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", |
| 151456 | | - /* 281 */ "cmd ::= create_vtab", |
| 151457 | | - /* 282 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 151458 | | - /* 283 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 151459 | | - /* 284 */ "vtabarg ::=", |
| 151460 | | - /* 285 */ "vtabargtoken ::= ANY", |
| 151461 | | - /* 286 */ "vtabargtoken ::= lp anylist RP", |
| 151462 | | - /* 287 */ "lp ::= LP", |
| 151463 | | - /* 288 */ "with ::= WITH wqlist", |
| 151464 | | - /* 289 */ "with ::= WITH RECURSIVE wqlist", |
| 151465 | | - /* 290 */ "wqlist ::= nm eidlist_opt AS LP select RP", |
| 151466 | | - /* 291 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", |
| 151467 | | - /* 292 */ "windowdefn_list ::= windowdefn", |
| 151468 | | - /* 293 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", |
| 151469 | | - /* 294 */ "windowdefn ::= nm AS LP window RP", |
| 151470 | | - /* 295 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", |
| 151471 | | - /* 296 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", |
| 151472 | | - /* 297 */ "window ::= ORDER BY sortlist frame_opt", |
| 151473 | | - /* 298 */ "window ::= nm ORDER BY sortlist frame_opt", |
| 151474 | | - /* 299 */ "window ::= frame_opt", |
| 151475 | | - /* 300 */ "window ::= nm frame_opt", |
| 151476 | | - /* 301 */ "frame_opt ::=", |
| 151477 | | - /* 302 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", |
| 151478 | | - /* 303 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", |
| 151479 | | - /* 304 */ "range_or_rows ::= RANGE|ROWS|GROUPS", |
| 151480 | | - /* 305 */ "frame_bound_s ::= frame_bound", |
| 151481 | | - /* 306 */ "frame_bound_s ::= UNBOUNDED PRECEDING", |
| 151482 | | - /* 307 */ "frame_bound_e ::= frame_bound", |
| 151483 | | - /* 308 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", |
| 151484 | | - /* 309 */ "frame_bound ::= expr PRECEDING|FOLLOWING", |
| 151485 | | - /* 310 */ "frame_bound ::= CURRENT ROW", |
| 151486 | | - /* 311 */ "frame_exclude_opt ::=", |
| 151487 | | - /* 312 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", |
| 151488 | | - /* 313 */ "frame_exclude ::= NO OTHERS", |
| 151489 | | - /* 314 */ "frame_exclude ::= CURRENT ROW", |
| 151490 | | - /* 315 */ "frame_exclude ::= GROUP|TIES", |
| 151491 | | - /* 316 */ "window_clause ::= WINDOW windowdefn_list", |
| 151492 | | - /* 317 */ "filter_over ::= filter_clause over_clause", |
| 151493 | | - /* 318 */ "filter_over ::= over_clause", |
| 151494 | | - /* 319 */ "filter_over ::= filter_clause", |
| 151495 | | - /* 320 */ "over_clause ::= OVER LP window RP", |
| 151496 | | - /* 321 */ "over_clause ::= OVER nm", |
| 151497 | | - /* 322 */ "filter_clause ::= FILTER LP WHERE expr RP", |
| 151498 | | - /* 323 */ "input ::= cmdlist", |
| 151499 | | - /* 324 */ "cmdlist ::= cmdlist ecmd", |
| 151500 | | - /* 325 */ "cmdlist ::= ecmd", |
| 151501 | | - /* 326 */ "ecmd ::= SEMI", |
| 151502 | | - /* 327 */ "ecmd ::= cmdx SEMI", |
| 151503 | | - /* 328 */ "ecmd ::= explain cmdx", |
| 151504 | | - /* 329 */ "trans_opt ::=", |
| 151505 | | - /* 330 */ "trans_opt ::= TRANSACTION", |
| 151506 | | - /* 331 */ "trans_opt ::= TRANSACTION nm", |
| 151507 | | - /* 332 */ "savepoint_opt ::= SAVEPOINT", |
| 151508 | | - /* 333 */ "savepoint_opt ::=", |
| 151509 | | - /* 334 */ "cmd ::= create_table create_table_args", |
| 151510 | | - /* 335 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 151511 | | - /* 336 */ "columnlist ::= columnname carglist", |
| 151512 | | - /* 337 */ "nm ::= ID|INDEXED", |
| 151513 | | - /* 338 */ "nm ::= STRING", |
| 151514 | | - /* 339 */ "nm ::= JOIN_KW", |
| 151515 | | - /* 340 */ "typetoken ::= typename", |
| 151516 | | - /* 341 */ "typename ::= ID|STRING", |
| 151517 | | - /* 342 */ "signed ::= plus_num", |
| 151518 | | - /* 343 */ "signed ::= minus_num", |
| 151519 | | - /* 344 */ "carglist ::= carglist ccons", |
| 151520 | | - /* 345 */ "carglist ::=", |
| 151521 | | - /* 346 */ "ccons ::= NULL onconf", |
| 151522 | | - /* 347 */ "conslist_opt ::= COMMA conslist", |
| 151523 | | - /* 348 */ "conslist ::= conslist tconscomma tcons", |
| 151524 | | - /* 349 */ "conslist ::= tcons", |
| 151525 | | - /* 350 */ "tconscomma ::=", |
| 151526 | | - /* 351 */ "defer_subclause_opt ::= defer_subclause", |
| 151527 | | - /* 352 */ "resolvetype ::= raisetype", |
| 151528 | | - /* 353 */ "selectnowith ::= oneselect", |
| 151529 | | - /* 354 */ "oneselect ::= values", |
| 151530 | | - /* 355 */ "sclp ::= selcollist COMMA", |
| 151531 | | - /* 356 */ "as ::= ID|STRING", |
| 151532 | | - /* 357 */ "expr ::= term", |
| 151533 | | - /* 358 */ "likeop ::= LIKE_KW|MATCH", |
| 151534 | | - /* 359 */ "exprlist ::= nexprlist", |
| 151535 | | - /* 360 */ "nmnum ::= plus_num", |
| 151536 | | - /* 361 */ "nmnum ::= nm", |
| 151537 | | - /* 362 */ "nmnum ::= ON", |
| 151538 | | - /* 363 */ "nmnum ::= DELETE", |
| 151539 | | - /* 364 */ "nmnum ::= DEFAULT", |
| 151540 | | - /* 365 */ "plus_num ::= INTEGER|FLOAT", |
| 151541 | | - /* 366 */ "foreach_clause ::=", |
| 151542 | | - /* 367 */ "foreach_clause ::= FOR EACH ROW", |
| 151543 | | - /* 368 */ "trnm ::= nm", |
| 151544 | | - /* 369 */ "tridxby ::=", |
| 151545 | | - /* 370 */ "database_kw_opt ::= DATABASE", |
| 151546 | | - /* 371 */ "database_kw_opt ::=", |
| 151547 | | - /* 372 */ "kwcolumn_opt ::=", |
| 151548 | | - /* 373 */ "kwcolumn_opt ::= COLUMNKW", |
| 151549 | | - /* 374 */ "vtabarglist ::= vtabarg", |
| 151550 | | - /* 375 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 151551 | | - /* 376 */ "vtabarg ::= vtabarg vtabargtoken", |
| 151552 | | - /* 377 */ "anylist ::=", |
| 151553 | | - /* 378 */ "anylist ::= anylist LP anylist RP", |
| 151554 | | - /* 379 */ "anylist ::= anylist ANY", |
| 151555 | | - /* 380 */ "with ::=", |
| 152337 | + /* 43 */ "generated ::= LP expr RP", |
| 152338 | + /* 44 */ "generated ::= LP expr RP ID", |
| 152339 | + /* 45 */ "autoinc ::=", |
| 152340 | + /* 46 */ "autoinc ::= AUTOINCR", |
| 152341 | + /* 47 */ "refargs ::=", |
| 152342 | + /* 48 */ "refargs ::= refargs refarg", |
| 152343 | + /* 49 */ "refarg ::= MATCH nm", |
| 152344 | + /* 50 */ "refarg ::= ON INSERT refact", |
| 152345 | + /* 51 */ "refarg ::= ON DELETE refact", |
| 152346 | + /* 52 */ "refarg ::= ON UPDATE refact", |
| 152347 | + /* 53 */ "refact ::= SET NULL", |
| 152348 | + /* 54 */ "refact ::= SET DEFAULT", |
| 152349 | + /* 55 */ "refact ::= CASCADE", |
| 152350 | + /* 56 */ "refact ::= RESTRICT", |
| 152351 | + /* 57 */ "refact ::= NO ACTION", |
| 152352 | + /* 58 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt", |
| 152353 | + /* 59 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt", |
| 152354 | + /* 60 */ "init_deferred_pred_opt ::=", |
| 152355 | + /* 61 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED", |
| 152356 | + /* 62 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE", |
| 152357 | + /* 63 */ "conslist_opt ::=", |
| 152358 | + /* 64 */ "tconscomma ::= COMMA", |
| 152359 | + /* 65 */ "tcons ::= CONSTRAINT nm", |
| 152360 | + /* 66 */ "tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf", |
| 152361 | + /* 67 */ "tcons ::= UNIQUE LP sortlist RP onconf", |
| 152362 | + /* 68 */ "tcons ::= CHECK LP expr RP onconf", |
| 152363 | + /* 69 */ "tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt", |
| 152364 | + /* 70 */ "defer_subclause_opt ::=", |
| 152365 | + /* 71 */ "onconf ::=", |
| 152366 | + /* 72 */ "onconf ::= ON CONFLICT resolvetype", |
| 152367 | + /* 73 */ "orconf ::=", |
| 152368 | + /* 74 */ "orconf ::= OR resolvetype", |
| 152369 | + /* 75 */ "resolvetype ::= IGNORE", |
| 152370 | + /* 76 */ "resolvetype ::= REPLACE", |
| 152371 | + /* 77 */ "cmd ::= DROP TABLE ifexists fullname", |
| 152372 | + /* 78 */ "ifexists ::= IF EXISTS", |
| 152373 | + /* 79 */ "ifexists ::=", |
| 152374 | + /* 80 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select", |
| 152375 | + /* 81 */ "cmd ::= DROP VIEW ifexists fullname", |
| 152376 | + /* 82 */ "cmd ::= select", |
| 152377 | + /* 83 */ "select ::= WITH wqlist selectnowith", |
| 152378 | + /* 84 */ "select ::= WITH RECURSIVE wqlist selectnowith", |
| 152379 | + /* 85 */ "select ::= selectnowith", |
| 152380 | + /* 86 */ "selectnowith ::= selectnowith multiselect_op oneselect", |
| 152381 | + /* 87 */ "multiselect_op ::= UNION", |
| 152382 | + /* 88 */ "multiselect_op ::= UNION ALL", |
| 152383 | + /* 89 */ "multiselect_op ::= EXCEPT|INTERSECT", |
| 152384 | + /* 90 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt", |
| 152385 | + /* 91 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt", |
| 152386 | + /* 92 */ "values ::= VALUES LP nexprlist RP", |
| 152387 | + /* 93 */ "values ::= values COMMA LP nexprlist RP", |
| 152388 | + /* 94 */ "distinct ::= DISTINCT", |
| 152389 | + /* 95 */ "distinct ::= ALL", |
| 152390 | + /* 96 */ "distinct ::=", |
| 152391 | + /* 97 */ "sclp ::=", |
| 152392 | + /* 98 */ "selcollist ::= sclp scanpt expr scanpt as", |
| 152393 | + /* 99 */ "selcollist ::= sclp scanpt STAR", |
| 152394 | + /* 100 */ "selcollist ::= sclp scanpt nm DOT STAR", |
| 152395 | + /* 101 */ "as ::= AS nm", |
| 152396 | + /* 102 */ "as ::=", |
| 152397 | + /* 103 */ "from ::=", |
| 152398 | + /* 104 */ "from ::= FROM seltablist", |
| 152399 | + /* 105 */ "stl_prefix ::= seltablist joinop", |
| 152400 | + /* 106 */ "stl_prefix ::=", |
| 152401 | + /* 107 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt", |
| 152402 | + /* 108 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt", |
| 152403 | + /* 109 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt", |
| 152404 | + /* 110 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt", |
| 152405 | + /* 111 */ "dbnm ::=", |
| 152406 | + /* 112 */ "dbnm ::= DOT nm", |
| 152407 | + /* 113 */ "fullname ::= nm", |
| 152408 | + /* 114 */ "fullname ::= nm DOT nm", |
| 152409 | + /* 115 */ "xfullname ::= nm", |
| 152410 | + /* 116 */ "xfullname ::= nm DOT nm", |
| 152411 | + /* 117 */ "xfullname ::= nm DOT nm AS nm", |
| 152412 | + /* 118 */ "xfullname ::= nm AS nm", |
| 152413 | + /* 119 */ "joinop ::= COMMA|JOIN", |
| 152414 | + /* 120 */ "joinop ::= JOIN_KW JOIN", |
| 152415 | + /* 121 */ "joinop ::= JOIN_KW nm JOIN", |
| 152416 | + /* 122 */ "joinop ::= JOIN_KW nm nm JOIN", |
| 152417 | + /* 123 */ "on_opt ::= ON expr", |
| 152418 | + /* 124 */ "on_opt ::=", |
| 152419 | + /* 125 */ "indexed_opt ::=", |
| 152420 | + /* 126 */ "indexed_opt ::= INDEXED BY nm", |
| 152421 | + /* 127 */ "indexed_opt ::= NOT INDEXED", |
| 152422 | + /* 128 */ "using_opt ::= USING LP idlist RP", |
| 152423 | + /* 129 */ "using_opt ::=", |
| 152424 | + /* 130 */ "orderby_opt ::=", |
| 152425 | + /* 131 */ "orderby_opt ::= ORDER BY sortlist", |
| 152426 | + /* 132 */ "sortlist ::= sortlist COMMA expr sortorder nulls", |
| 152427 | + /* 133 */ "sortlist ::= expr sortorder nulls", |
| 152428 | + /* 134 */ "sortorder ::= ASC", |
| 152429 | + /* 135 */ "sortorder ::= DESC", |
| 152430 | + /* 136 */ "sortorder ::=", |
| 152431 | + /* 137 */ "nulls ::= NULLS FIRST", |
| 152432 | + /* 138 */ "nulls ::= NULLS LAST", |
| 152433 | + /* 139 */ "nulls ::=", |
| 152434 | + /* 140 */ "groupby_opt ::=", |
| 152435 | + /* 141 */ "groupby_opt ::= GROUP BY nexprlist", |
| 152436 | + /* 142 */ "having_opt ::=", |
| 152437 | + /* 143 */ "having_opt ::= HAVING expr", |
| 152438 | + /* 144 */ "limit_opt ::=", |
| 152439 | + /* 145 */ "limit_opt ::= LIMIT expr", |
| 152440 | + /* 146 */ "limit_opt ::= LIMIT expr OFFSET expr", |
| 152441 | + /* 147 */ "limit_opt ::= LIMIT expr COMMA expr", |
| 152442 | + /* 148 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt", |
| 152443 | + /* 149 */ "where_opt ::=", |
| 152444 | + /* 150 */ "where_opt ::= WHERE expr", |
| 152445 | + /* 151 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt", |
| 152446 | + /* 152 */ "setlist ::= setlist COMMA nm EQ expr", |
| 152447 | + /* 153 */ "setlist ::= setlist COMMA LP idlist RP EQ expr", |
| 152448 | + /* 154 */ "setlist ::= nm EQ expr", |
| 152449 | + /* 155 */ "setlist ::= LP idlist RP EQ expr", |
| 152450 | + /* 156 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert", |
| 152451 | + /* 157 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES", |
| 152452 | + /* 158 */ "upsert ::=", |
| 152453 | + /* 159 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt", |
| 152454 | + /* 160 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING", |
| 152455 | + /* 161 */ "upsert ::= ON CONFLICT DO NOTHING", |
| 152456 | + /* 162 */ "insert_cmd ::= INSERT orconf", |
| 152457 | + /* 163 */ "insert_cmd ::= REPLACE", |
| 152458 | + /* 164 */ "idlist_opt ::=", |
| 152459 | + /* 165 */ "idlist_opt ::= LP idlist RP", |
| 152460 | + /* 166 */ "idlist ::= idlist COMMA nm", |
| 152461 | + /* 167 */ "idlist ::= nm", |
| 152462 | + /* 168 */ "expr ::= LP expr RP", |
| 152463 | + /* 169 */ "expr ::= ID|INDEXED", |
| 152464 | + /* 170 */ "expr ::= JOIN_KW", |
| 152465 | + /* 171 */ "expr ::= nm DOT nm", |
| 152466 | + /* 172 */ "expr ::= nm DOT nm DOT nm", |
| 152467 | + /* 173 */ "term ::= NULL|FLOAT|BLOB", |
| 152468 | + /* 174 */ "term ::= STRING", |
| 152469 | + /* 175 */ "term ::= INTEGER", |
| 152470 | + /* 176 */ "expr ::= VARIABLE", |
| 152471 | + /* 177 */ "expr ::= expr COLLATE ID|STRING", |
| 152472 | + /* 178 */ "expr ::= CAST LP expr AS typetoken RP", |
| 152473 | + /* 179 */ "expr ::= ID|INDEXED LP distinct exprlist RP", |
| 152474 | + /* 180 */ "expr ::= ID|INDEXED LP STAR RP", |
| 152475 | + /* 181 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over", |
| 152476 | + /* 182 */ "expr ::= ID|INDEXED LP STAR RP filter_over", |
| 152477 | + /* 183 */ "term ::= CTIME_KW", |
| 152478 | + /* 184 */ "expr ::= LP nexprlist COMMA expr RP", |
| 152479 | + /* 185 */ "expr ::= expr AND expr", |
| 152480 | + /* 186 */ "expr ::= expr OR expr", |
| 152481 | + /* 187 */ "expr ::= expr LT|GT|GE|LE expr", |
| 152482 | + /* 188 */ "expr ::= expr EQ|NE expr", |
| 152483 | + /* 189 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", |
| 152484 | + /* 190 */ "expr ::= expr PLUS|MINUS expr", |
| 152485 | + /* 191 */ "expr ::= expr STAR|SLASH|REM expr", |
| 152486 | + /* 192 */ "expr ::= expr CONCAT expr", |
| 152487 | + /* 193 */ "likeop ::= NOT LIKE_KW|MATCH", |
| 152488 | + /* 194 */ "expr ::= expr likeop expr", |
| 152489 | + /* 195 */ "expr ::= expr likeop expr ESCAPE expr", |
| 152490 | + /* 196 */ "expr ::= expr ISNULL|NOTNULL", |
| 152491 | + /* 197 */ "expr ::= expr NOT NULL", |
| 152492 | + /* 198 */ "expr ::= expr IS expr", |
| 152493 | + /* 199 */ "expr ::= expr IS NOT expr", |
| 152494 | + /* 200 */ "expr ::= NOT expr", |
| 152495 | + /* 201 */ "expr ::= BITNOT expr", |
| 152496 | + /* 202 */ "expr ::= PLUS|MINUS expr", |
| 152497 | + /* 203 */ "between_op ::= BETWEEN", |
| 152498 | + /* 204 */ "between_op ::= NOT BETWEEN", |
| 152499 | + /* 205 */ "expr ::= expr between_op expr AND expr", |
| 152500 | + /* 206 */ "in_op ::= IN", |
| 152501 | + /* 207 */ "in_op ::= NOT IN", |
| 152502 | + /* 208 */ "expr ::= expr in_op LP exprlist RP", |
| 152503 | + /* 209 */ "expr ::= LP select RP", |
| 152504 | + /* 210 */ "expr ::= expr in_op LP select RP", |
| 152505 | + /* 211 */ "expr ::= expr in_op nm dbnm paren_exprlist", |
| 152506 | + /* 212 */ "expr ::= EXISTS LP select RP", |
| 152507 | + /* 213 */ "expr ::= CASE case_operand case_exprlist case_else END", |
| 152508 | + /* 214 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", |
| 152509 | + /* 215 */ "case_exprlist ::= WHEN expr THEN expr", |
| 152510 | + /* 216 */ "case_else ::= ELSE expr", |
| 152511 | + /* 217 */ "case_else ::=", |
| 152512 | + /* 218 */ "case_operand ::= expr", |
| 152513 | + /* 219 */ "case_operand ::=", |
| 152514 | + /* 220 */ "exprlist ::=", |
| 152515 | + /* 221 */ "nexprlist ::= nexprlist COMMA expr", |
| 152516 | + /* 222 */ "nexprlist ::= expr", |
| 152517 | + /* 223 */ "paren_exprlist ::=", |
| 152518 | + /* 224 */ "paren_exprlist ::= LP exprlist RP", |
| 152519 | + /* 225 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", |
| 152520 | + /* 226 */ "uniqueflag ::= UNIQUE", |
| 152521 | + /* 227 */ "uniqueflag ::=", |
| 152522 | + /* 228 */ "eidlist_opt ::=", |
| 152523 | + /* 229 */ "eidlist_opt ::= LP eidlist RP", |
| 152524 | + /* 230 */ "eidlist ::= eidlist COMMA nm collate sortorder", |
| 152525 | + /* 231 */ "eidlist ::= nm collate sortorder", |
| 152526 | + /* 232 */ "collate ::=", |
| 152527 | + /* 233 */ "collate ::= COLLATE ID|STRING", |
| 152528 | + /* 234 */ "cmd ::= DROP INDEX ifexists fullname", |
| 152529 | + /* 235 */ "cmd ::= VACUUM vinto", |
| 152530 | + /* 236 */ "cmd ::= VACUUM nm vinto", |
| 152531 | + /* 237 */ "vinto ::= INTO expr", |
| 152532 | + /* 238 */ "vinto ::=", |
| 152533 | + /* 239 */ "cmd ::= PRAGMA nm dbnm", |
| 152534 | + /* 240 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", |
| 152535 | + /* 241 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", |
| 152536 | + /* 242 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", |
| 152537 | + /* 243 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", |
| 152538 | + /* 244 */ "plus_num ::= PLUS INTEGER|FLOAT", |
| 152539 | + /* 245 */ "minus_num ::= MINUS INTEGER|FLOAT", |
| 152540 | + /* 246 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", |
| 152541 | + /* 247 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", |
| 152542 | + /* 248 */ "trigger_time ::= BEFORE|AFTER", |
| 152543 | + /* 249 */ "trigger_time ::= INSTEAD OF", |
| 152544 | + /* 250 */ "trigger_time ::=", |
| 152545 | + /* 251 */ "trigger_event ::= DELETE|INSERT", |
| 152546 | + /* 252 */ "trigger_event ::= UPDATE", |
| 152547 | + /* 253 */ "trigger_event ::= UPDATE OF idlist", |
| 152548 | + /* 254 */ "when_clause ::=", |
| 152549 | + /* 255 */ "when_clause ::= WHEN expr", |
| 152550 | + /* 256 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", |
| 152551 | + /* 257 */ "trigger_cmd_list ::= trigger_cmd SEMI", |
| 152552 | + /* 258 */ "trnm ::= nm DOT nm", |
| 152553 | + /* 259 */ "tridxby ::= INDEXED BY nm", |
| 152554 | + /* 260 */ "tridxby ::= NOT INDEXED", |
| 152555 | + /* 261 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt", |
| 152556 | + /* 262 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", |
| 152557 | + /* 263 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", |
| 152558 | + /* 264 */ "trigger_cmd ::= scanpt select scanpt", |
| 152559 | + /* 265 */ "expr ::= RAISE LP IGNORE RP", |
| 152560 | + /* 266 */ "expr ::= RAISE LP raisetype COMMA nm RP", |
| 152561 | + /* 267 */ "raisetype ::= ROLLBACK", |
| 152562 | + /* 268 */ "raisetype ::= ABORT", |
| 152563 | + /* 269 */ "raisetype ::= FAIL", |
| 152564 | + /* 270 */ "cmd ::= DROP TRIGGER ifexists fullname", |
| 152565 | + /* 271 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", |
| 152566 | + /* 272 */ "cmd ::= DETACH database_kw_opt expr", |
| 152567 | + /* 273 */ "key_opt ::=", |
| 152568 | + /* 274 */ "key_opt ::= KEY expr", |
| 152569 | + /* 275 */ "cmd ::= REINDEX", |
| 152570 | + /* 276 */ "cmd ::= REINDEX nm dbnm", |
| 152571 | + /* 277 */ "cmd ::= ANALYZE", |
| 152572 | + /* 278 */ "cmd ::= ANALYZE nm dbnm", |
| 152573 | + /* 279 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", |
| 152574 | + /* 280 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", |
| 152575 | + /* 281 */ "add_column_fullname ::= fullname", |
| 152576 | + /* 282 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", |
| 152577 | + /* 283 */ "cmd ::= create_vtab", |
| 152578 | + /* 284 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 152579 | + /* 285 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 152580 | + /* 286 */ "vtabarg ::=", |
| 152581 | + /* 287 */ "vtabargtoken ::= ANY", |
| 152582 | + /* 288 */ "vtabargtoken ::= lp anylist RP", |
| 152583 | + /* 289 */ "lp ::= LP", |
| 152584 | + /* 290 */ "with ::= WITH wqlist", |
| 152585 | + /* 291 */ "with ::= WITH RECURSIVE wqlist", |
| 152586 | + /* 292 */ "wqlist ::= nm eidlist_opt AS LP select RP", |
| 152587 | + /* 293 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", |
| 152588 | + /* 294 */ "windowdefn_list ::= windowdefn", |
| 152589 | + /* 295 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", |
| 152590 | + /* 296 */ "windowdefn ::= nm AS LP window RP", |
| 152591 | + /* 297 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", |
| 152592 | + /* 298 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", |
| 152593 | + /* 299 */ "window ::= ORDER BY sortlist frame_opt", |
| 152594 | + /* 300 */ "window ::= nm ORDER BY sortlist frame_opt", |
| 152595 | + /* 301 */ "window ::= frame_opt", |
| 152596 | + /* 302 */ "window ::= nm frame_opt", |
| 152597 | + /* 303 */ "frame_opt ::=", |
| 152598 | + /* 304 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", |
| 152599 | + /* 305 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", |
| 152600 | + /* 306 */ "range_or_rows ::= RANGE|ROWS|GROUPS", |
| 152601 | + /* 307 */ "frame_bound_s ::= frame_bound", |
| 152602 | + /* 308 */ "frame_bound_s ::= UNBOUNDED PRECEDING", |
| 152603 | + /* 309 */ "frame_bound_e ::= frame_bound", |
| 152604 | + /* 310 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", |
| 152605 | + /* 311 */ "frame_bound ::= expr PRECEDING|FOLLOWING", |
| 152606 | + /* 312 */ "frame_bound ::= CURRENT ROW", |
| 152607 | + /* 313 */ "frame_exclude_opt ::=", |
| 152608 | + /* 314 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", |
| 152609 | + /* 315 */ "frame_exclude ::= NO OTHERS", |
| 152610 | + /* 316 */ "frame_exclude ::= CURRENT ROW", |
| 152611 | + /* 317 */ "frame_exclude ::= GROUP|TIES", |
| 152612 | + /* 318 */ "window_clause ::= WINDOW windowdefn_list", |
| 152613 | + /* 319 */ "filter_over ::= filter_clause over_clause", |
| 152614 | + /* 320 */ "filter_over ::= over_clause", |
| 152615 | + /* 321 */ "filter_over ::= filter_clause", |
| 152616 | + /* 322 */ "over_clause ::= OVER LP window RP", |
| 152617 | + /* 323 */ "over_clause ::= OVER nm", |
| 152618 | + /* 324 */ "filter_clause ::= FILTER LP WHERE expr RP", |
| 152619 | + /* 325 */ "input ::= cmdlist", |
| 152620 | + /* 326 */ "cmdlist ::= cmdlist ecmd", |
| 152621 | + /* 327 */ "cmdlist ::= ecmd", |
| 152622 | + /* 328 */ "ecmd ::= SEMI", |
| 152623 | + /* 329 */ "ecmd ::= cmdx SEMI", |
| 152624 | + /* 330 */ "ecmd ::= explain cmdx", |
| 152625 | + /* 331 */ "trans_opt ::=", |
| 152626 | + /* 332 */ "trans_opt ::= TRANSACTION", |
| 152627 | + /* 333 */ "trans_opt ::= TRANSACTION nm", |
| 152628 | + /* 334 */ "savepoint_opt ::= SAVEPOINT", |
| 152629 | + /* 335 */ "savepoint_opt ::=", |
| 152630 | + /* 336 */ "cmd ::= create_table create_table_args", |
| 152631 | + /* 337 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 152632 | + /* 338 */ "columnlist ::= columnname carglist", |
| 152633 | + /* 339 */ "nm ::= ID|INDEXED", |
| 152634 | + /* 340 */ "nm ::= STRING", |
| 152635 | + /* 341 */ "nm ::= JOIN_KW", |
| 152636 | + /* 342 */ "typetoken ::= typename", |
| 152637 | + /* 343 */ "typename ::= ID|STRING", |
| 152638 | + /* 344 */ "signed ::= plus_num", |
| 152639 | + /* 345 */ "signed ::= minus_num", |
| 152640 | + /* 346 */ "carglist ::= carglist ccons", |
| 152641 | + /* 347 */ "carglist ::=", |
| 152642 | + /* 348 */ "ccons ::= NULL onconf", |
| 152643 | + /* 349 */ "ccons ::= GENERATED ALWAYS AS generated", |
| 152644 | + /* 350 */ "ccons ::= AS generated", |
| 152645 | + /* 351 */ "conslist_opt ::= COMMA conslist", |
| 152646 | + /* 352 */ "conslist ::= conslist tconscomma tcons", |
| 152647 | + /* 353 */ "conslist ::= tcons", |
| 152648 | + /* 354 */ "tconscomma ::=", |
| 152649 | + /* 355 */ "defer_subclause_opt ::= defer_subclause", |
| 152650 | + /* 356 */ "resolvetype ::= raisetype", |
| 152651 | + /* 357 */ "selectnowith ::= oneselect", |
| 152652 | + /* 358 */ "oneselect ::= values", |
| 152653 | + /* 359 */ "sclp ::= selcollist COMMA", |
| 152654 | + /* 360 */ "as ::= ID|STRING", |
| 152655 | + /* 361 */ "expr ::= term", |
| 152656 | + /* 362 */ "likeop ::= LIKE_KW|MATCH", |
| 152657 | + /* 363 */ "exprlist ::= nexprlist", |
| 152658 | + /* 364 */ "nmnum ::= plus_num", |
| 152659 | + /* 365 */ "nmnum ::= nm", |
| 152660 | + /* 366 */ "nmnum ::= ON", |
| 152661 | + /* 367 */ "nmnum ::= DELETE", |
| 152662 | + /* 368 */ "nmnum ::= DEFAULT", |
| 152663 | + /* 369 */ "plus_num ::= INTEGER|FLOAT", |
| 152664 | + /* 370 */ "foreach_clause ::=", |
| 152665 | + /* 371 */ "foreach_clause ::= FOR EACH ROW", |
| 152666 | + /* 372 */ "trnm ::= nm", |
| 152667 | + /* 373 */ "tridxby ::=", |
| 152668 | + /* 374 */ "database_kw_opt ::= DATABASE", |
| 152669 | + /* 375 */ "database_kw_opt ::=", |
| 152670 | + /* 376 */ "kwcolumn_opt ::=", |
| 152671 | + /* 377 */ "kwcolumn_opt ::= COLUMNKW", |
| 152672 | + /* 378 */ "vtabarglist ::= vtabarg", |
| 152673 | + /* 379 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 152674 | + /* 380 */ "vtabarg ::= vtabarg vtabargtoken", |
| 152675 | + /* 381 */ "anylist ::=", |
| 152676 | + /* 382 */ "anylist ::= anylist LP anylist RP", |
| 152677 | + /* 383 */ "anylist ::= anylist ANY", |
| 152678 | + /* 384 */ "with ::=", |
| 151556 | 152679 | }; |
| 151557 | 152680 | #endif /* NDEBUG */ |
| 151558 | 152681 | |
| 151559 | 152682 | |
| 151560 | 152683 | #if YYSTACKDEPTH<=0 |
| | @@ -151676,102 +152799,102 @@ |
| 151676 | 152799 | ** Note: during a reduce, the only symbols destroyed are those |
| 151677 | 152800 | ** which appear on the RHS of the rule, but which are *not* used |
| 151678 | 152801 | ** inside the C code. |
| 151679 | 152802 | */ |
| 151680 | 152803 | /********* Begin destructor definitions ***************************************/ |
| 151681 | | - case 198: /* select */ |
| 151682 | | - case 231: /* selectnowith */ |
| 151683 | | - case 232: /* oneselect */ |
| 151684 | | - case 244: /* values */ |
| 151685 | | -{ |
| 151686 | | -sqlite3SelectDelete(pParse->db, (yypminor->yy25)); |
| 151687 | | -} |
| 151688 | | - break; |
| 151689 | | - case 209: /* term */ |
| 151690 | | - case 210: /* expr */ |
| 151691 | | - case 238: /* where_opt */ |
| 151692 | | - case 240: /* having_opt */ |
| 151693 | | - case 252: /* on_opt */ |
| 151694 | | - case 268: /* case_operand */ |
| 151695 | | - case 270: /* case_else */ |
| 151696 | | - case 273: /* vinto */ |
| 151697 | | - case 280: /* when_clause */ |
| 151698 | | - case 285: /* key_opt */ |
| 151699 | | - case 299: /* filter_clause */ |
| 151700 | | -{ |
| 151701 | | -sqlite3ExprDelete(pParse->db, (yypminor->yy46)); |
| 151702 | | -} |
| 151703 | | - break; |
| 151704 | | - case 214: /* eidlist_opt */ |
| 151705 | | - case 223: /* sortlist */ |
| 151706 | | - case 224: /* eidlist */ |
| 151707 | | - case 236: /* selcollist */ |
| 151708 | | - case 239: /* groupby_opt */ |
| 151709 | | - case 241: /* orderby_opt */ |
| 151710 | | - case 245: /* nexprlist */ |
| 151711 | | - case 246: /* sclp */ |
| 151712 | | - case 254: /* exprlist */ |
| 151713 | | - case 259: /* setlist */ |
| 151714 | | - case 267: /* paren_exprlist */ |
| 151715 | | - case 269: /* case_exprlist */ |
| 151716 | | - case 298: /* part_opt */ |
| 151717 | | -{ |
| 151718 | | -sqlite3ExprListDelete(pParse->db, (yypminor->yy138)); |
| 151719 | | -} |
| 151720 | | - break; |
| 151721 | | - case 230: /* fullname */ |
| 151722 | | - case 237: /* from */ |
| 151723 | | - case 248: /* seltablist */ |
| 151724 | | - case 249: /* stl_prefix */ |
| 151725 | | - case 255: /* xfullname */ |
| 151726 | | -{ |
| 151727 | | -sqlite3SrcListDelete(pParse->db, (yypminor->yy609)); |
| 151728 | | -} |
| 151729 | | - break; |
| 151730 | | - case 233: /* wqlist */ |
| 151731 | | -{ |
| 151732 | | -sqlite3WithDelete(pParse->db, (yypminor->yy297)); |
| 151733 | | -} |
| 151734 | | - break; |
| 151735 | | - case 243: /* window_clause */ |
| 151736 | | - case 294: /* windowdefn_list */ |
| 151737 | | -{ |
| 151738 | | -sqlite3WindowListDelete(pParse->db, (yypminor->yy455)); |
| 151739 | | -} |
| 151740 | | - break; |
| 151741 | | - case 253: /* using_opt */ |
| 151742 | | - case 256: /* idlist */ |
| 151743 | | - case 261: /* idlist_opt */ |
| 151744 | | -{ |
| 151745 | | -sqlite3IdListDelete(pParse->db, (yypminor->yy406)); |
| 151746 | | -} |
| 151747 | | - break; |
| 151748 | | - case 263: /* filter_over */ |
| 151749 | | - case 295: /* windowdefn */ |
| 151750 | | - case 296: /* window */ |
| 151751 | | - case 297: /* frame_opt */ |
| 151752 | | - case 300: /* over_clause */ |
| 151753 | | -{ |
| 151754 | | -sqlite3WindowDelete(pParse->db, (yypminor->yy455)); |
| 151755 | | -} |
| 151756 | | - break; |
| 151757 | | - case 276: /* trigger_cmd_list */ |
| 151758 | | - case 281: /* trigger_cmd */ |
| 151759 | | -{ |
| 151760 | | -sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy527)); |
| 151761 | | -} |
| 151762 | | - break; |
| 151763 | | - case 278: /* trigger_event */ |
| 151764 | | -{ |
| 151765 | | -sqlite3IdListDelete(pParse->db, (yypminor->yy572).b); |
| 151766 | | -} |
| 151767 | | - break; |
| 151768 | | - case 302: /* frame_bound */ |
| 151769 | | - case 303: /* frame_bound_s */ |
| 151770 | | - case 304: /* frame_bound_e */ |
| 151771 | | -{ |
| 151772 | | -sqlite3ExprDelete(pParse->db, (yypminor->yy57).pExpr); |
| 152804 | + case 200: /* select */ |
| 152805 | + case 234: /* selectnowith */ |
| 152806 | + case 235: /* oneselect */ |
| 152807 | + case 247: /* values */ |
| 152808 | +{ |
| 152809 | +sqlite3SelectDelete(pParse->db, (yypminor->yy539)); |
| 152810 | +} |
| 152811 | + break; |
| 152812 | + case 211: /* term */ |
| 152813 | + case 212: /* expr */ |
| 152814 | + case 241: /* where_opt */ |
| 152815 | + case 243: /* having_opt */ |
| 152816 | + case 255: /* on_opt */ |
| 152817 | + case 271: /* case_operand */ |
| 152818 | + case 273: /* case_else */ |
| 152819 | + case 276: /* vinto */ |
| 152820 | + case 283: /* when_clause */ |
| 152821 | + case 288: /* key_opt */ |
| 152822 | + case 302: /* filter_clause */ |
| 152823 | +{ |
| 152824 | +sqlite3ExprDelete(pParse->db, (yypminor->yy202)); |
| 152825 | +} |
| 152826 | + break; |
| 152827 | + case 216: /* eidlist_opt */ |
| 152828 | + case 226: /* sortlist */ |
| 152829 | + case 227: /* eidlist */ |
| 152830 | + case 239: /* selcollist */ |
| 152831 | + case 242: /* groupby_opt */ |
| 152832 | + case 244: /* orderby_opt */ |
| 152833 | + case 248: /* nexprlist */ |
| 152834 | + case 249: /* sclp */ |
| 152835 | + case 257: /* exprlist */ |
| 152836 | + case 262: /* setlist */ |
| 152837 | + case 270: /* paren_exprlist */ |
| 152838 | + case 272: /* case_exprlist */ |
| 152839 | + case 301: /* part_opt */ |
| 152840 | +{ |
| 152841 | +sqlite3ExprListDelete(pParse->db, (yypminor->yy242)); |
| 152842 | +} |
| 152843 | + break; |
| 152844 | + case 233: /* fullname */ |
| 152845 | + case 240: /* from */ |
| 152846 | + case 251: /* seltablist */ |
| 152847 | + case 252: /* stl_prefix */ |
| 152848 | + case 258: /* xfullname */ |
| 152849 | +{ |
| 152850 | +sqlite3SrcListDelete(pParse->db, (yypminor->yy47)); |
| 152851 | +} |
| 152852 | + break; |
| 152853 | + case 236: /* wqlist */ |
| 152854 | +{ |
| 152855 | +sqlite3WithDelete(pParse->db, (yypminor->yy131)); |
| 152856 | +} |
| 152857 | + break; |
| 152858 | + case 246: /* window_clause */ |
| 152859 | + case 297: /* windowdefn_list */ |
| 152860 | +{ |
| 152861 | +sqlite3WindowListDelete(pParse->db, (yypminor->yy303)); |
| 152862 | +} |
| 152863 | + break; |
| 152864 | + case 256: /* using_opt */ |
| 152865 | + case 259: /* idlist */ |
| 152866 | + case 264: /* idlist_opt */ |
| 152867 | +{ |
| 152868 | +sqlite3IdListDelete(pParse->db, (yypminor->yy600)); |
| 152869 | +} |
| 152870 | + break; |
| 152871 | + case 266: /* filter_over */ |
| 152872 | + case 298: /* windowdefn */ |
| 152873 | + case 299: /* window */ |
| 152874 | + case 300: /* frame_opt */ |
| 152875 | + case 303: /* over_clause */ |
| 152876 | +{ |
| 152877 | +sqlite3WindowDelete(pParse->db, (yypminor->yy303)); |
| 152878 | +} |
| 152879 | + break; |
| 152880 | + case 279: /* trigger_cmd_list */ |
| 152881 | + case 284: /* trigger_cmd */ |
| 152882 | +{ |
| 152883 | +sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy447)); |
| 152884 | +} |
| 152885 | + break; |
| 152886 | + case 281: /* trigger_event */ |
| 152887 | +{ |
| 152888 | +sqlite3IdListDelete(pParse->db, (yypminor->yy230).b); |
| 152889 | +} |
| 152890 | + break; |
| 152891 | + case 305: /* frame_bound */ |
| 152892 | + case 306: /* frame_bound_s */ |
| 152893 | + case 307: /* frame_bound_e */ |
| 152894 | +{ |
| 152895 | +sqlite3ExprDelete(pParse->db, (yypminor->yy77).pExpr); |
| 151773 | 152896 | } |
| 151774 | 152897 | break; |
| 151775 | 152898 | /********* End destructor definitions *****************************************/ |
| 151776 | 152899 | default: break; /* If no destructor action specified: do nothing */ |
| 151777 | 152900 | } |
| | @@ -152058,391 +153181,395 @@ |
| 152058 | 153181 | } |
| 152059 | 153182 | |
| 152060 | 153183 | /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side |
| 152061 | 153184 | ** of that rule */ |
| 152062 | 153185 | static const YYCODETYPE yyRuleInfoLhs[] = { |
| 152063 | | - 183, /* (0) explain ::= EXPLAIN */ |
| 152064 | | - 183, /* (1) explain ::= EXPLAIN QUERY PLAN */ |
| 152065 | | - 182, /* (2) cmdx ::= cmd */ |
| 152066 | | - 184, /* (3) cmd ::= BEGIN transtype trans_opt */ |
| 152067 | | - 185, /* (4) transtype ::= */ |
| 152068 | | - 185, /* (5) transtype ::= DEFERRED */ |
| 152069 | | - 185, /* (6) transtype ::= IMMEDIATE */ |
| 152070 | | - 185, /* (7) transtype ::= EXCLUSIVE */ |
| 152071 | | - 184, /* (8) cmd ::= COMMIT|END trans_opt */ |
| 152072 | | - 184, /* (9) cmd ::= ROLLBACK trans_opt */ |
| 152073 | | - 184, /* (10) cmd ::= SAVEPOINT nm */ |
| 152074 | | - 184, /* (11) cmd ::= RELEASE savepoint_opt nm */ |
| 152075 | | - 184, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ |
| 152076 | | - 189, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */ |
| 152077 | | - 191, /* (14) createkw ::= CREATE */ |
| 152078 | | - 193, /* (15) ifnotexists ::= */ |
| 152079 | | - 193, /* (16) ifnotexists ::= IF NOT EXISTS */ |
| 152080 | | - 192, /* (17) temp ::= TEMP */ |
| 152081 | | - 192, /* (18) temp ::= */ |
| 152082 | | - 190, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_options */ |
| 152083 | | - 190, /* (20) create_table_args ::= AS select */ |
| 152084 | | - 197, /* (21) table_options ::= */ |
| 152085 | | - 197, /* (22) table_options ::= WITHOUT nm */ |
| 152086 | | - 199, /* (23) columnname ::= nm typetoken */ |
| 152087 | | - 201, /* (24) typetoken ::= */ |
| 152088 | | - 201, /* (25) typetoken ::= typename LP signed RP */ |
| 152089 | | - 201, /* (26) typetoken ::= typename LP signed COMMA signed RP */ |
| 152090 | | - 202, /* (27) typename ::= typename ID|STRING */ |
| 152091 | | - 206, /* (28) scanpt ::= */ |
| 152092 | | - 207, /* (29) scantok ::= */ |
| 152093 | | - 208, /* (30) ccons ::= CONSTRAINT nm */ |
| 152094 | | - 208, /* (31) ccons ::= DEFAULT scantok term */ |
| 152095 | | - 208, /* (32) ccons ::= DEFAULT LP expr RP */ |
| 152096 | | - 208, /* (33) ccons ::= DEFAULT PLUS scantok term */ |
| 152097 | | - 208, /* (34) ccons ::= DEFAULT MINUS scantok term */ |
| 152098 | | - 208, /* (35) ccons ::= DEFAULT scantok ID|INDEXED */ |
| 152099 | | - 208, /* (36) ccons ::= NOT NULL onconf */ |
| 152100 | | - 208, /* (37) ccons ::= PRIMARY KEY sortorder onconf autoinc */ |
| 152101 | | - 208, /* (38) ccons ::= UNIQUE onconf */ |
| 152102 | | - 208, /* (39) ccons ::= CHECK LP expr RP */ |
| 152103 | | - 208, /* (40) ccons ::= REFERENCES nm eidlist_opt refargs */ |
| 152104 | | - 208, /* (41) ccons ::= defer_subclause */ |
| 152105 | | - 208, /* (42) ccons ::= COLLATE ID|STRING */ |
| 152106 | | - 213, /* (43) autoinc ::= */ |
| 152107 | | - 213, /* (44) autoinc ::= AUTOINCR */ |
| 152108 | | - 215, /* (45) refargs ::= */ |
| 152109 | | - 215, /* (46) refargs ::= refargs refarg */ |
| 152110 | | - 217, /* (47) refarg ::= MATCH nm */ |
| 152111 | | - 217, /* (48) refarg ::= ON INSERT refact */ |
| 152112 | | - 217, /* (49) refarg ::= ON DELETE refact */ |
| 152113 | | - 217, /* (50) refarg ::= ON UPDATE refact */ |
| 152114 | | - 218, /* (51) refact ::= SET NULL */ |
| 152115 | | - 218, /* (52) refact ::= SET DEFAULT */ |
| 152116 | | - 218, /* (53) refact ::= CASCADE */ |
| 152117 | | - 218, /* (54) refact ::= RESTRICT */ |
| 152118 | | - 218, /* (55) refact ::= NO ACTION */ |
| 152119 | | - 216, /* (56) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ |
| 152120 | | - 216, /* (57) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ |
| 152121 | | - 219, /* (58) init_deferred_pred_opt ::= */ |
| 152122 | | - 219, /* (59) init_deferred_pred_opt ::= INITIALLY DEFERRED */ |
| 152123 | | - 219, /* (60) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ |
| 152124 | | - 196, /* (61) conslist_opt ::= */ |
| 152125 | | - 221, /* (62) tconscomma ::= COMMA */ |
| 152126 | | - 222, /* (63) tcons ::= CONSTRAINT nm */ |
| 152127 | | - 222, /* (64) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ |
| 152128 | | - 222, /* (65) tcons ::= UNIQUE LP sortlist RP onconf */ |
| 152129 | | - 222, /* (66) tcons ::= CHECK LP expr RP onconf */ |
| 152130 | | - 222, /* (67) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ |
| 152131 | | - 225, /* (68) defer_subclause_opt ::= */ |
| 152132 | | - 211, /* (69) onconf ::= */ |
| 152133 | | - 211, /* (70) onconf ::= ON CONFLICT resolvetype */ |
| 152134 | | - 226, /* (71) orconf ::= */ |
| 152135 | | - 226, /* (72) orconf ::= OR resolvetype */ |
| 152136 | | - 227, /* (73) resolvetype ::= IGNORE */ |
| 152137 | | - 227, /* (74) resolvetype ::= REPLACE */ |
| 152138 | | - 184, /* (75) cmd ::= DROP TABLE ifexists fullname */ |
| 152139 | | - 229, /* (76) ifexists ::= IF EXISTS */ |
| 152140 | | - 229, /* (77) ifexists ::= */ |
| 152141 | | - 184, /* (78) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ |
| 152142 | | - 184, /* (79) cmd ::= DROP VIEW ifexists fullname */ |
| 152143 | | - 184, /* (80) cmd ::= select */ |
| 152144 | | - 198, /* (81) select ::= WITH wqlist selectnowith */ |
| 152145 | | - 198, /* (82) select ::= WITH RECURSIVE wqlist selectnowith */ |
| 152146 | | - 198, /* (83) select ::= selectnowith */ |
| 152147 | | - 231, /* (84) selectnowith ::= selectnowith multiselect_op oneselect */ |
| 152148 | | - 234, /* (85) multiselect_op ::= UNION */ |
| 152149 | | - 234, /* (86) multiselect_op ::= UNION ALL */ |
| 152150 | | - 234, /* (87) multiselect_op ::= EXCEPT|INTERSECT */ |
| 152151 | | - 232, /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ |
| 152152 | | - 232, /* (89) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ |
| 152153 | | - 244, /* (90) values ::= VALUES LP nexprlist RP */ |
| 152154 | | - 244, /* (91) values ::= values COMMA LP nexprlist RP */ |
| 152155 | | - 235, /* (92) distinct ::= DISTINCT */ |
| 152156 | | - 235, /* (93) distinct ::= ALL */ |
| 152157 | | - 235, /* (94) distinct ::= */ |
| 152158 | | - 246, /* (95) sclp ::= */ |
| 152159 | | - 236, /* (96) selcollist ::= sclp scanpt expr scanpt as */ |
| 152160 | | - 236, /* (97) selcollist ::= sclp scanpt STAR */ |
| 152161 | | - 236, /* (98) selcollist ::= sclp scanpt nm DOT STAR */ |
| 152162 | | - 247, /* (99) as ::= AS nm */ |
| 152163 | | - 247, /* (100) as ::= */ |
| 152164 | | - 237, /* (101) from ::= */ |
| 152165 | | - 237, /* (102) from ::= FROM seltablist */ |
| 152166 | | - 249, /* (103) stl_prefix ::= seltablist joinop */ |
| 152167 | | - 249, /* (104) stl_prefix ::= */ |
| 152168 | | - 248, /* (105) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ |
| 152169 | | - 248, /* (106) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ |
| 152170 | | - 248, /* (107) seltablist ::= stl_prefix LP select RP as on_opt using_opt */ |
| 152171 | | - 248, /* (108) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ |
| 152172 | | - 194, /* (109) dbnm ::= */ |
| 152173 | | - 194, /* (110) dbnm ::= DOT nm */ |
| 152174 | | - 230, /* (111) fullname ::= nm */ |
| 152175 | | - 230, /* (112) fullname ::= nm DOT nm */ |
| 152176 | | - 255, /* (113) xfullname ::= nm */ |
| 152177 | | - 255, /* (114) xfullname ::= nm DOT nm */ |
| 152178 | | - 255, /* (115) xfullname ::= nm DOT nm AS nm */ |
| 152179 | | - 255, /* (116) xfullname ::= nm AS nm */ |
| 152180 | | - 250, /* (117) joinop ::= COMMA|JOIN */ |
| 152181 | | - 250, /* (118) joinop ::= JOIN_KW JOIN */ |
| 152182 | | - 250, /* (119) joinop ::= JOIN_KW nm JOIN */ |
| 152183 | | - 250, /* (120) joinop ::= JOIN_KW nm nm JOIN */ |
| 152184 | | - 252, /* (121) on_opt ::= ON expr */ |
| 152185 | | - 252, /* (122) on_opt ::= */ |
| 152186 | | - 251, /* (123) indexed_opt ::= */ |
| 152187 | | - 251, /* (124) indexed_opt ::= INDEXED BY nm */ |
| 152188 | | - 251, /* (125) indexed_opt ::= NOT INDEXED */ |
| 152189 | | - 253, /* (126) using_opt ::= USING LP idlist RP */ |
| 152190 | | - 253, /* (127) using_opt ::= */ |
| 152191 | | - 241, /* (128) orderby_opt ::= */ |
| 152192 | | - 241, /* (129) orderby_opt ::= ORDER BY sortlist */ |
| 152193 | | - 223, /* (130) sortlist ::= sortlist COMMA expr sortorder nulls */ |
| 152194 | | - 223, /* (131) sortlist ::= expr sortorder nulls */ |
| 152195 | | - 212, /* (132) sortorder ::= ASC */ |
| 152196 | | - 212, /* (133) sortorder ::= DESC */ |
| 152197 | | - 212, /* (134) sortorder ::= */ |
| 152198 | | - 257, /* (135) nulls ::= NULLS FIRST */ |
| 152199 | | - 257, /* (136) nulls ::= NULLS LAST */ |
| 152200 | | - 257, /* (137) nulls ::= */ |
| 152201 | | - 239, /* (138) groupby_opt ::= */ |
| 152202 | | - 239, /* (139) groupby_opt ::= GROUP BY nexprlist */ |
| 152203 | | - 240, /* (140) having_opt ::= */ |
| 152204 | | - 240, /* (141) having_opt ::= HAVING expr */ |
| 152205 | | - 242, /* (142) limit_opt ::= */ |
| 152206 | | - 242, /* (143) limit_opt ::= LIMIT expr */ |
| 152207 | | - 242, /* (144) limit_opt ::= LIMIT expr OFFSET expr */ |
| 152208 | | - 242, /* (145) limit_opt ::= LIMIT expr COMMA expr */ |
| 152209 | | - 184, /* (146) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */ |
| 152210 | | - 238, /* (147) where_opt ::= */ |
| 152211 | | - 238, /* (148) where_opt ::= WHERE expr */ |
| 152212 | | - 184, /* (149) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */ |
| 152213 | | - 259, /* (150) setlist ::= setlist COMMA nm EQ expr */ |
| 152214 | | - 259, /* (151) setlist ::= setlist COMMA LP idlist RP EQ expr */ |
| 152215 | | - 259, /* (152) setlist ::= nm EQ expr */ |
| 152216 | | - 259, /* (153) setlist ::= LP idlist RP EQ expr */ |
| 152217 | | - 184, /* (154) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ |
| 152218 | | - 184, /* (155) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */ |
| 152219 | | - 262, /* (156) upsert ::= */ |
| 152220 | | - 262, /* (157) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */ |
| 152221 | | - 262, /* (158) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */ |
| 152222 | | - 262, /* (159) upsert ::= ON CONFLICT DO NOTHING */ |
| 152223 | | - 260, /* (160) insert_cmd ::= INSERT orconf */ |
| 152224 | | - 260, /* (161) insert_cmd ::= REPLACE */ |
| 152225 | | - 261, /* (162) idlist_opt ::= */ |
| 152226 | | - 261, /* (163) idlist_opt ::= LP idlist RP */ |
| 152227 | | - 256, /* (164) idlist ::= idlist COMMA nm */ |
| 152228 | | - 256, /* (165) idlist ::= nm */ |
| 152229 | | - 210, /* (166) expr ::= LP expr RP */ |
| 152230 | | - 210, /* (167) expr ::= ID|INDEXED */ |
| 152231 | | - 210, /* (168) expr ::= JOIN_KW */ |
| 152232 | | - 210, /* (169) expr ::= nm DOT nm */ |
| 152233 | | - 210, /* (170) expr ::= nm DOT nm DOT nm */ |
| 152234 | | - 209, /* (171) term ::= NULL|FLOAT|BLOB */ |
| 152235 | | - 209, /* (172) term ::= STRING */ |
| 152236 | | - 209, /* (173) term ::= INTEGER */ |
| 152237 | | - 210, /* (174) expr ::= VARIABLE */ |
| 152238 | | - 210, /* (175) expr ::= expr COLLATE ID|STRING */ |
| 152239 | | - 210, /* (176) expr ::= CAST LP expr AS typetoken RP */ |
| 152240 | | - 210, /* (177) expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 152241 | | - 210, /* (178) expr ::= ID|INDEXED LP STAR RP */ |
| 152242 | | - 210, /* (179) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ |
| 152243 | | - 210, /* (180) expr ::= ID|INDEXED LP STAR RP filter_over */ |
| 152244 | | - 209, /* (181) term ::= CTIME_KW */ |
| 152245 | | - 210, /* (182) expr ::= LP nexprlist COMMA expr RP */ |
| 152246 | | - 210, /* (183) expr ::= expr AND expr */ |
| 152247 | | - 210, /* (184) expr ::= expr OR expr */ |
| 152248 | | - 210, /* (185) expr ::= expr LT|GT|GE|LE expr */ |
| 152249 | | - 210, /* (186) expr ::= expr EQ|NE expr */ |
| 152250 | | - 210, /* (187) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ |
| 152251 | | - 210, /* (188) expr ::= expr PLUS|MINUS expr */ |
| 152252 | | - 210, /* (189) expr ::= expr STAR|SLASH|REM expr */ |
| 152253 | | - 210, /* (190) expr ::= expr CONCAT expr */ |
| 152254 | | - 264, /* (191) likeop ::= NOT LIKE_KW|MATCH */ |
| 152255 | | - 210, /* (192) expr ::= expr likeop expr */ |
| 152256 | | - 210, /* (193) expr ::= expr likeop expr ESCAPE expr */ |
| 152257 | | - 210, /* (194) expr ::= expr ISNULL|NOTNULL */ |
| 152258 | | - 210, /* (195) expr ::= expr NOT NULL */ |
| 152259 | | - 210, /* (196) expr ::= expr IS expr */ |
| 152260 | | - 210, /* (197) expr ::= expr IS NOT expr */ |
| 152261 | | - 210, /* (198) expr ::= NOT expr */ |
| 152262 | | - 210, /* (199) expr ::= BITNOT expr */ |
| 152263 | | - 210, /* (200) expr ::= PLUS|MINUS expr */ |
| 152264 | | - 265, /* (201) between_op ::= BETWEEN */ |
| 152265 | | - 265, /* (202) between_op ::= NOT BETWEEN */ |
| 152266 | | - 210, /* (203) expr ::= expr between_op expr AND expr */ |
| 152267 | | - 266, /* (204) in_op ::= IN */ |
| 152268 | | - 266, /* (205) in_op ::= NOT IN */ |
| 152269 | | - 210, /* (206) expr ::= expr in_op LP exprlist RP */ |
| 152270 | | - 210, /* (207) expr ::= LP select RP */ |
| 152271 | | - 210, /* (208) expr ::= expr in_op LP select RP */ |
| 152272 | | - 210, /* (209) expr ::= expr in_op nm dbnm paren_exprlist */ |
| 152273 | | - 210, /* (210) expr ::= EXISTS LP select RP */ |
| 152274 | | - 210, /* (211) expr ::= CASE case_operand case_exprlist case_else END */ |
| 152275 | | - 269, /* (212) case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 152276 | | - 269, /* (213) case_exprlist ::= WHEN expr THEN expr */ |
| 152277 | | - 270, /* (214) case_else ::= ELSE expr */ |
| 152278 | | - 270, /* (215) case_else ::= */ |
| 152279 | | - 268, /* (216) case_operand ::= expr */ |
| 152280 | | - 268, /* (217) case_operand ::= */ |
| 152281 | | - 254, /* (218) exprlist ::= */ |
| 152282 | | - 245, /* (219) nexprlist ::= nexprlist COMMA expr */ |
| 152283 | | - 245, /* (220) nexprlist ::= expr */ |
| 152284 | | - 267, /* (221) paren_exprlist ::= */ |
| 152285 | | - 267, /* (222) paren_exprlist ::= LP exprlist RP */ |
| 152286 | | - 184, /* (223) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 152287 | | - 271, /* (224) uniqueflag ::= UNIQUE */ |
| 152288 | | - 271, /* (225) uniqueflag ::= */ |
| 152289 | | - 214, /* (226) eidlist_opt ::= */ |
| 152290 | | - 214, /* (227) eidlist_opt ::= LP eidlist RP */ |
| 152291 | | - 224, /* (228) eidlist ::= eidlist COMMA nm collate sortorder */ |
| 152292 | | - 224, /* (229) eidlist ::= nm collate sortorder */ |
| 152293 | | - 272, /* (230) collate ::= */ |
| 152294 | | - 272, /* (231) collate ::= COLLATE ID|STRING */ |
| 152295 | | - 184, /* (232) cmd ::= DROP INDEX ifexists fullname */ |
| 152296 | | - 184, /* (233) cmd ::= VACUUM vinto */ |
| 152297 | | - 184, /* (234) cmd ::= VACUUM nm vinto */ |
| 152298 | | - 273, /* (235) vinto ::= INTO expr */ |
| 152299 | | - 273, /* (236) vinto ::= */ |
| 152300 | | - 184, /* (237) cmd ::= PRAGMA nm dbnm */ |
| 152301 | | - 184, /* (238) cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 152302 | | - 184, /* (239) cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 152303 | | - 184, /* (240) cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 152304 | | - 184, /* (241) cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 152305 | | - 204, /* (242) plus_num ::= PLUS INTEGER|FLOAT */ |
| 152306 | | - 205, /* (243) minus_num ::= MINUS INTEGER|FLOAT */ |
| 152307 | | - 184, /* (244) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 152308 | | - 275, /* (245) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 152309 | | - 277, /* (246) trigger_time ::= BEFORE|AFTER */ |
| 152310 | | - 277, /* (247) trigger_time ::= INSTEAD OF */ |
| 152311 | | - 277, /* (248) trigger_time ::= */ |
| 152312 | | - 278, /* (249) trigger_event ::= DELETE|INSERT */ |
| 152313 | | - 278, /* (250) trigger_event ::= UPDATE */ |
| 152314 | | - 278, /* (251) trigger_event ::= UPDATE OF idlist */ |
| 152315 | | - 280, /* (252) when_clause ::= */ |
| 152316 | | - 280, /* (253) when_clause ::= WHEN expr */ |
| 152317 | | - 276, /* (254) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 152318 | | - 276, /* (255) trigger_cmd_list ::= trigger_cmd SEMI */ |
| 152319 | | - 282, /* (256) trnm ::= nm DOT nm */ |
| 152320 | | - 283, /* (257) tridxby ::= INDEXED BY nm */ |
| 152321 | | - 283, /* (258) tridxby ::= NOT INDEXED */ |
| 152322 | | - 281, /* (259) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ |
| 152323 | | - 281, /* (260) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 152324 | | - 281, /* (261) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 152325 | | - 281, /* (262) trigger_cmd ::= scanpt select scanpt */ |
| 152326 | | - 210, /* (263) expr ::= RAISE LP IGNORE RP */ |
| 152327 | | - 210, /* (264) expr ::= RAISE LP raisetype COMMA nm RP */ |
| 152328 | | - 228, /* (265) raisetype ::= ROLLBACK */ |
| 152329 | | - 228, /* (266) raisetype ::= ABORT */ |
| 152330 | | - 228, /* (267) raisetype ::= FAIL */ |
| 152331 | | - 184, /* (268) cmd ::= DROP TRIGGER ifexists fullname */ |
| 152332 | | - 184, /* (269) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 152333 | | - 184, /* (270) cmd ::= DETACH database_kw_opt expr */ |
| 152334 | | - 285, /* (271) key_opt ::= */ |
| 152335 | | - 285, /* (272) key_opt ::= KEY expr */ |
| 152336 | | - 184, /* (273) cmd ::= REINDEX */ |
| 152337 | | - 184, /* (274) cmd ::= REINDEX nm dbnm */ |
| 152338 | | - 184, /* (275) cmd ::= ANALYZE */ |
| 152339 | | - 184, /* (276) cmd ::= ANALYZE nm dbnm */ |
| 152340 | | - 184, /* (277) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 152341 | | - 184, /* (278) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 152342 | | - 286, /* (279) add_column_fullname ::= fullname */ |
| 152343 | | - 184, /* (280) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 152344 | | - 184, /* (281) cmd ::= create_vtab */ |
| 152345 | | - 184, /* (282) cmd ::= create_vtab LP vtabarglist RP */ |
| 152346 | | - 288, /* (283) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 152347 | | - 290, /* (284) vtabarg ::= */ |
| 152348 | | - 291, /* (285) vtabargtoken ::= ANY */ |
| 152349 | | - 291, /* (286) vtabargtoken ::= lp anylist RP */ |
| 152350 | | - 292, /* (287) lp ::= LP */ |
| 152351 | | - 258, /* (288) with ::= WITH wqlist */ |
| 152352 | | - 258, /* (289) with ::= WITH RECURSIVE wqlist */ |
| 152353 | | - 233, /* (290) wqlist ::= nm eidlist_opt AS LP select RP */ |
| 152354 | | - 233, /* (291) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 152355 | | - 294, /* (292) windowdefn_list ::= windowdefn */ |
| 152356 | | - 294, /* (293) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 152357 | | - 295, /* (294) windowdefn ::= nm AS LP window RP */ |
| 152358 | | - 296, /* (295) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 152359 | | - 296, /* (296) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 152360 | | - 296, /* (297) window ::= ORDER BY sortlist frame_opt */ |
| 152361 | | - 296, /* (298) window ::= nm ORDER BY sortlist frame_opt */ |
| 152362 | | - 296, /* (299) window ::= frame_opt */ |
| 152363 | | - 296, /* (300) window ::= nm frame_opt */ |
| 152364 | | - 297, /* (301) frame_opt ::= */ |
| 152365 | | - 297, /* (302) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 152366 | | - 297, /* (303) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 152367 | | - 301, /* (304) range_or_rows ::= RANGE|ROWS|GROUPS */ |
| 152368 | | - 303, /* (305) frame_bound_s ::= frame_bound */ |
| 152369 | | - 303, /* (306) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 152370 | | - 304, /* (307) frame_bound_e ::= frame_bound */ |
| 152371 | | - 304, /* (308) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 152372 | | - 302, /* (309) frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 152373 | | - 302, /* (310) frame_bound ::= CURRENT ROW */ |
| 152374 | | - 305, /* (311) frame_exclude_opt ::= */ |
| 152375 | | - 305, /* (312) frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 152376 | | - 306, /* (313) frame_exclude ::= NO OTHERS */ |
| 152377 | | - 306, /* (314) frame_exclude ::= CURRENT ROW */ |
| 152378 | | - 306, /* (315) frame_exclude ::= GROUP|TIES */ |
| 152379 | | - 243, /* (316) window_clause ::= WINDOW windowdefn_list */ |
| 152380 | | - 263, /* (317) filter_over ::= filter_clause over_clause */ |
| 152381 | | - 263, /* (318) filter_over ::= over_clause */ |
| 152382 | | - 263, /* (319) filter_over ::= filter_clause */ |
| 152383 | | - 300, /* (320) over_clause ::= OVER LP window RP */ |
| 152384 | | - 300, /* (321) over_clause ::= OVER nm */ |
| 152385 | | - 299, /* (322) filter_clause ::= FILTER LP WHERE expr RP */ |
| 152386 | | - 179, /* (323) input ::= cmdlist */ |
| 152387 | | - 180, /* (324) cmdlist ::= cmdlist ecmd */ |
| 152388 | | - 180, /* (325) cmdlist ::= ecmd */ |
| 152389 | | - 181, /* (326) ecmd ::= SEMI */ |
| 152390 | | - 181, /* (327) ecmd ::= cmdx SEMI */ |
| 152391 | | - 181, /* (328) ecmd ::= explain cmdx */ |
| 152392 | | - 186, /* (329) trans_opt ::= */ |
| 152393 | | - 186, /* (330) trans_opt ::= TRANSACTION */ |
| 152394 | | - 186, /* (331) trans_opt ::= TRANSACTION nm */ |
| 152395 | | - 188, /* (332) savepoint_opt ::= SAVEPOINT */ |
| 152396 | | - 188, /* (333) savepoint_opt ::= */ |
| 152397 | | - 184, /* (334) cmd ::= create_table create_table_args */ |
| 152398 | | - 195, /* (335) columnlist ::= columnlist COMMA columnname carglist */ |
| 152399 | | - 195, /* (336) columnlist ::= columnname carglist */ |
| 152400 | | - 187, /* (337) nm ::= ID|INDEXED */ |
| 152401 | | - 187, /* (338) nm ::= STRING */ |
| 152402 | | - 187, /* (339) nm ::= JOIN_KW */ |
| 152403 | | - 201, /* (340) typetoken ::= typename */ |
| 152404 | | - 202, /* (341) typename ::= ID|STRING */ |
| 152405 | | - 203, /* (342) signed ::= plus_num */ |
| 152406 | | - 203, /* (343) signed ::= minus_num */ |
| 152407 | | - 200, /* (344) carglist ::= carglist ccons */ |
| 152408 | | - 200, /* (345) carglist ::= */ |
| 152409 | | - 208, /* (346) ccons ::= NULL onconf */ |
| 152410 | | - 196, /* (347) conslist_opt ::= COMMA conslist */ |
| 152411 | | - 220, /* (348) conslist ::= conslist tconscomma tcons */ |
| 152412 | | - 220, /* (349) conslist ::= tcons */ |
| 152413 | | - 221, /* (350) tconscomma ::= */ |
| 152414 | | - 225, /* (351) defer_subclause_opt ::= defer_subclause */ |
| 152415 | | - 227, /* (352) resolvetype ::= raisetype */ |
| 152416 | | - 231, /* (353) selectnowith ::= oneselect */ |
| 152417 | | - 232, /* (354) oneselect ::= values */ |
| 152418 | | - 246, /* (355) sclp ::= selcollist COMMA */ |
| 152419 | | - 247, /* (356) as ::= ID|STRING */ |
| 152420 | | - 210, /* (357) expr ::= term */ |
| 152421 | | - 264, /* (358) likeop ::= LIKE_KW|MATCH */ |
| 152422 | | - 254, /* (359) exprlist ::= nexprlist */ |
| 152423 | | - 274, /* (360) nmnum ::= plus_num */ |
| 152424 | | - 274, /* (361) nmnum ::= nm */ |
| 152425 | | - 274, /* (362) nmnum ::= ON */ |
| 152426 | | - 274, /* (363) nmnum ::= DELETE */ |
| 152427 | | - 274, /* (364) nmnum ::= DEFAULT */ |
| 152428 | | - 204, /* (365) plus_num ::= INTEGER|FLOAT */ |
| 152429 | | - 279, /* (366) foreach_clause ::= */ |
| 152430 | | - 279, /* (367) foreach_clause ::= FOR EACH ROW */ |
| 152431 | | - 282, /* (368) trnm ::= nm */ |
| 152432 | | - 283, /* (369) tridxby ::= */ |
| 152433 | | - 284, /* (370) database_kw_opt ::= DATABASE */ |
| 152434 | | - 284, /* (371) database_kw_opt ::= */ |
| 152435 | | - 287, /* (372) kwcolumn_opt ::= */ |
| 152436 | | - 287, /* (373) kwcolumn_opt ::= COLUMNKW */ |
| 152437 | | - 289, /* (374) vtabarglist ::= vtabarg */ |
| 152438 | | - 289, /* (375) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 152439 | | - 290, /* (376) vtabarg ::= vtabarg vtabargtoken */ |
| 152440 | | - 293, /* (377) anylist ::= */ |
| 152441 | | - 293, /* (378) anylist ::= anylist LP anylist RP */ |
| 152442 | | - 293, /* (379) anylist ::= anylist ANY */ |
| 152443 | | - 258, /* (380) with ::= */ |
| 153186 | + 185, /* (0) explain ::= EXPLAIN */ |
| 153187 | + 185, /* (1) explain ::= EXPLAIN QUERY PLAN */ |
| 153188 | + 184, /* (2) cmdx ::= cmd */ |
| 153189 | + 186, /* (3) cmd ::= BEGIN transtype trans_opt */ |
| 153190 | + 187, /* (4) transtype ::= */ |
| 153191 | + 187, /* (5) transtype ::= DEFERRED */ |
| 153192 | + 187, /* (6) transtype ::= IMMEDIATE */ |
| 153193 | + 187, /* (7) transtype ::= EXCLUSIVE */ |
| 153194 | + 186, /* (8) cmd ::= COMMIT|END trans_opt */ |
| 153195 | + 186, /* (9) cmd ::= ROLLBACK trans_opt */ |
| 153196 | + 186, /* (10) cmd ::= SAVEPOINT nm */ |
| 153197 | + 186, /* (11) cmd ::= RELEASE savepoint_opt nm */ |
| 153198 | + 186, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ |
| 153199 | + 191, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */ |
| 153200 | + 193, /* (14) createkw ::= CREATE */ |
| 153201 | + 195, /* (15) ifnotexists ::= */ |
| 153202 | + 195, /* (16) ifnotexists ::= IF NOT EXISTS */ |
| 153203 | + 194, /* (17) temp ::= TEMP */ |
| 153204 | + 194, /* (18) temp ::= */ |
| 153205 | + 192, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_options */ |
| 153206 | + 192, /* (20) create_table_args ::= AS select */ |
| 153207 | + 199, /* (21) table_options ::= */ |
| 153208 | + 199, /* (22) table_options ::= WITHOUT nm */ |
| 153209 | + 201, /* (23) columnname ::= nm typetoken */ |
| 153210 | + 203, /* (24) typetoken ::= */ |
| 153211 | + 203, /* (25) typetoken ::= typename LP signed RP */ |
| 153212 | + 203, /* (26) typetoken ::= typename LP signed COMMA signed RP */ |
| 153213 | + 204, /* (27) typename ::= typename ID|STRING */ |
| 153214 | + 208, /* (28) scanpt ::= */ |
| 153215 | + 209, /* (29) scantok ::= */ |
| 153216 | + 210, /* (30) ccons ::= CONSTRAINT nm */ |
| 153217 | + 210, /* (31) ccons ::= DEFAULT scantok term */ |
| 153218 | + 210, /* (32) ccons ::= DEFAULT LP expr RP */ |
| 153219 | + 210, /* (33) ccons ::= DEFAULT PLUS scantok term */ |
| 153220 | + 210, /* (34) ccons ::= DEFAULT MINUS scantok term */ |
| 153221 | + 210, /* (35) ccons ::= DEFAULT scantok ID|INDEXED */ |
| 153222 | + 210, /* (36) ccons ::= NOT NULL onconf */ |
| 153223 | + 210, /* (37) ccons ::= PRIMARY KEY sortorder onconf autoinc */ |
| 153224 | + 210, /* (38) ccons ::= UNIQUE onconf */ |
| 153225 | + 210, /* (39) ccons ::= CHECK LP expr RP */ |
| 153226 | + 210, /* (40) ccons ::= REFERENCES nm eidlist_opt refargs */ |
| 153227 | + 210, /* (41) ccons ::= defer_subclause */ |
| 153228 | + 210, /* (42) ccons ::= COLLATE ID|STRING */ |
| 153229 | + 219, /* (43) generated ::= LP expr RP */ |
| 153230 | + 219, /* (44) generated ::= LP expr RP ID */ |
| 153231 | + 215, /* (45) autoinc ::= */ |
| 153232 | + 215, /* (46) autoinc ::= AUTOINCR */ |
| 153233 | + 217, /* (47) refargs ::= */ |
| 153234 | + 217, /* (48) refargs ::= refargs refarg */ |
| 153235 | + 220, /* (49) refarg ::= MATCH nm */ |
| 153236 | + 220, /* (50) refarg ::= ON INSERT refact */ |
| 153237 | + 220, /* (51) refarg ::= ON DELETE refact */ |
| 153238 | + 220, /* (52) refarg ::= ON UPDATE refact */ |
| 153239 | + 221, /* (53) refact ::= SET NULL */ |
| 153240 | + 221, /* (54) refact ::= SET DEFAULT */ |
| 153241 | + 221, /* (55) refact ::= CASCADE */ |
| 153242 | + 221, /* (56) refact ::= RESTRICT */ |
| 153243 | + 221, /* (57) refact ::= NO ACTION */ |
| 153244 | + 218, /* (58) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ |
| 153245 | + 218, /* (59) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ |
| 153246 | + 222, /* (60) init_deferred_pred_opt ::= */ |
| 153247 | + 222, /* (61) init_deferred_pred_opt ::= INITIALLY DEFERRED */ |
| 153248 | + 222, /* (62) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ |
| 153249 | + 198, /* (63) conslist_opt ::= */ |
| 153250 | + 224, /* (64) tconscomma ::= COMMA */ |
| 153251 | + 225, /* (65) tcons ::= CONSTRAINT nm */ |
| 153252 | + 225, /* (66) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ |
| 153253 | + 225, /* (67) tcons ::= UNIQUE LP sortlist RP onconf */ |
| 153254 | + 225, /* (68) tcons ::= CHECK LP expr RP onconf */ |
| 153255 | + 225, /* (69) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ |
| 153256 | + 228, /* (70) defer_subclause_opt ::= */ |
| 153257 | + 213, /* (71) onconf ::= */ |
| 153258 | + 213, /* (72) onconf ::= ON CONFLICT resolvetype */ |
| 153259 | + 229, /* (73) orconf ::= */ |
| 153260 | + 229, /* (74) orconf ::= OR resolvetype */ |
| 153261 | + 230, /* (75) resolvetype ::= IGNORE */ |
| 153262 | + 230, /* (76) resolvetype ::= REPLACE */ |
| 153263 | + 186, /* (77) cmd ::= DROP TABLE ifexists fullname */ |
| 153264 | + 232, /* (78) ifexists ::= IF EXISTS */ |
| 153265 | + 232, /* (79) ifexists ::= */ |
| 153266 | + 186, /* (80) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ |
| 153267 | + 186, /* (81) cmd ::= DROP VIEW ifexists fullname */ |
| 153268 | + 186, /* (82) cmd ::= select */ |
| 153269 | + 200, /* (83) select ::= WITH wqlist selectnowith */ |
| 153270 | + 200, /* (84) select ::= WITH RECURSIVE wqlist selectnowith */ |
| 153271 | + 200, /* (85) select ::= selectnowith */ |
| 153272 | + 234, /* (86) selectnowith ::= selectnowith multiselect_op oneselect */ |
| 153273 | + 237, /* (87) multiselect_op ::= UNION */ |
| 153274 | + 237, /* (88) multiselect_op ::= UNION ALL */ |
| 153275 | + 237, /* (89) multiselect_op ::= EXCEPT|INTERSECT */ |
| 153276 | + 235, /* (90) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ |
| 153277 | + 235, /* (91) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ |
| 153278 | + 247, /* (92) values ::= VALUES LP nexprlist RP */ |
| 153279 | + 247, /* (93) values ::= values COMMA LP nexprlist RP */ |
| 153280 | + 238, /* (94) distinct ::= DISTINCT */ |
| 153281 | + 238, /* (95) distinct ::= ALL */ |
| 153282 | + 238, /* (96) distinct ::= */ |
| 153283 | + 249, /* (97) sclp ::= */ |
| 153284 | + 239, /* (98) selcollist ::= sclp scanpt expr scanpt as */ |
| 153285 | + 239, /* (99) selcollist ::= sclp scanpt STAR */ |
| 153286 | + 239, /* (100) selcollist ::= sclp scanpt nm DOT STAR */ |
| 153287 | + 250, /* (101) as ::= AS nm */ |
| 153288 | + 250, /* (102) as ::= */ |
| 153289 | + 240, /* (103) from ::= */ |
| 153290 | + 240, /* (104) from ::= FROM seltablist */ |
| 153291 | + 252, /* (105) stl_prefix ::= seltablist joinop */ |
| 153292 | + 252, /* (106) stl_prefix ::= */ |
| 153293 | + 251, /* (107) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ |
| 153294 | + 251, /* (108) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ |
| 153295 | + 251, /* (109) seltablist ::= stl_prefix LP select RP as on_opt using_opt */ |
| 153296 | + 251, /* (110) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ |
| 153297 | + 196, /* (111) dbnm ::= */ |
| 153298 | + 196, /* (112) dbnm ::= DOT nm */ |
| 153299 | + 233, /* (113) fullname ::= nm */ |
| 153300 | + 233, /* (114) fullname ::= nm DOT nm */ |
| 153301 | + 258, /* (115) xfullname ::= nm */ |
| 153302 | + 258, /* (116) xfullname ::= nm DOT nm */ |
| 153303 | + 258, /* (117) xfullname ::= nm DOT nm AS nm */ |
| 153304 | + 258, /* (118) xfullname ::= nm AS nm */ |
| 153305 | + 253, /* (119) joinop ::= COMMA|JOIN */ |
| 153306 | + 253, /* (120) joinop ::= JOIN_KW JOIN */ |
| 153307 | + 253, /* (121) joinop ::= JOIN_KW nm JOIN */ |
| 153308 | + 253, /* (122) joinop ::= JOIN_KW nm nm JOIN */ |
| 153309 | + 255, /* (123) on_opt ::= ON expr */ |
| 153310 | + 255, /* (124) on_opt ::= */ |
| 153311 | + 254, /* (125) indexed_opt ::= */ |
| 153312 | + 254, /* (126) indexed_opt ::= INDEXED BY nm */ |
| 153313 | + 254, /* (127) indexed_opt ::= NOT INDEXED */ |
| 153314 | + 256, /* (128) using_opt ::= USING LP idlist RP */ |
| 153315 | + 256, /* (129) using_opt ::= */ |
| 153316 | + 244, /* (130) orderby_opt ::= */ |
| 153317 | + 244, /* (131) orderby_opt ::= ORDER BY sortlist */ |
| 153318 | + 226, /* (132) sortlist ::= sortlist COMMA expr sortorder nulls */ |
| 153319 | + 226, /* (133) sortlist ::= expr sortorder nulls */ |
| 153320 | + 214, /* (134) sortorder ::= ASC */ |
| 153321 | + 214, /* (135) sortorder ::= DESC */ |
| 153322 | + 214, /* (136) sortorder ::= */ |
| 153323 | + 260, /* (137) nulls ::= NULLS FIRST */ |
| 153324 | + 260, /* (138) nulls ::= NULLS LAST */ |
| 153325 | + 260, /* (139) nulls ::= */ |
| 153326 | + 242, /* (140) groupby_opt ::= */ |
| 153327 | + 242, /* (141) groupby_opt ::= GROUP BY nexprlist */ |
| 153328 | + 243, /* (142) having_opt ::= */ |
| 153329 | + 243, /* (143) having_opt ::= HAVING expr */ |
| 153330 | + 245, /* (144) limit_opt ::= */ |
| 153331 | + 245, /* (145) limit_opt ::= LIMIT expr */ |
| 153332 | + 245, /* (146) limit_opt ::= LIMIT expr OFFSET expr */ |
| 153333 | + 245, /* (147) limit_opt ::= LIMIT expr COMMA expr */ |
| 153334 | + 186, /* (148) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */ |
| 153335 | + 241, /* (149) where_opt ::= */ |
| 153336 | + 241, /* (150) where_opt ::= WHERE expr */ |
| 153337 | + 186, /* (151) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */ |
| 153338 | + 262, /* (152) setlist ::= setlist COMMA nm EQ expr */ |
| 153339 | + 262, /* (153) setlist ::= setlist COMMA LP idlist RP EQ expr */ |
| 153340 | + 262, /* (154) setlist ::= nm EQ expr */ |
| 153341 | + 262, /* (155) setlist ::= LP idlist RP EQ expr */ |
| 153342 | + 186, /* (156) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ |
| 153343 | + 186, /* (157) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */ |
| 153344 | + 265, /* (158) upsert ::= */ |
| 153345 | + 265, /* (159) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */ |
| 153346 | + 265, /* (160) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */ |
| 153347 | + 265, /* (161) upsert ::= ON CONFLICT DO NOTHING */ |
| 153348 | + 263, /* (162) insert_cmd ::= INSERT orconf */ |
| 153349 | + 263, /* (163) insert_cmd ::= REPLACE */ |
| 153350 | + 264, /* (164) idlist_opt ::= */ |
| 153351 | + 264, /* (165) idlist_opt ::= LP idlist RP */ |
| 153352 | + 259, /* (166) idlist ::= idlist COMMA nm */ |
| 153353 | + 259, /* (167) idlist ::= nm */ |
| 153354 | + 212, /* (168) expr ::= LP expr RP */ |
| 153355 | + 212, /* (169) expr ::= ID|INDEXED */ |
| 153356 | + 212, /* (170) expr ::= JOIN_KW */ |
| 153357 | + 212, /* (171) expr ::= nm DOT nm */ |
| 153358 | + 212, /* (172) expr ::= nm DOT nm DOT nm */ |
| 153359 | + 211, /* (173) term ::= NULL|FLOAT|BLOB */ |
| 153360 | + 211, /* (174) term ::= STRING */ |
| 153361 | + 211, /* (175) term ::= INTEGER */ |
| 153362 | + 212, /* (176) expr ::= VARIABLE */ |
| 153363 | + 212, /* (177) expr ::= expr COLLATE ID|STRING */ |
| 153364 | + 212, /* (178) expr ::= CAST LP expr AS typetoken RP */ |
| 153365 | + 212, /* (179) expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 153366 | + 212, /* (180) expr ::= ID|INDEXED LP STAR RP */ |
| 153367 | + 212, /* (181) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ |
| 153368 | + 212, /* (182) expr ::= ID|INDEXED LP STAR RP filter_over */ |
| 153369 | + 211, /* (183) term ::= CTIME_KW */ |
| 153370 | + 212, /* (184) expr ::= LP nexprlist COMMA expr RP */ |
| 153371 | + 212, /* (185) expr ::= expr AND expr */ |
| 153372 | + 212, /* (186) expr ::= expr OR expr */ |
| 153373 | + 212, /* (187) expr ::= expr LT|GT|GE|LE expr */ |
| 153374 | + 212, /* (188) expr ::= expr EQ|NE expr */ |
| 153375 | + 212, /* (189) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ |
| 153376 | + 212, /* (190) expr ::= expr PLUS|MINUS expr */ |
| 153377 | + 212, /* (191) expr ::= expr STAR|SLASH|REM expr */ |
| 153378 | + 212, /* (192) expr ::= expr CONCAT expr */ |
| 153379 | + 267, /* (193) likeop ::= NOT LIKE_KW|MATCH */ |
| 153380 | + 212, /* (194) expr ::= expr likeop expr */ |
| 153381 | + 212, /* (195) expr ::= expr likeop expr ESCAPE expr */ |
| 153382 | + 212, /* (196) expr ::= expr ISNULL|NOTNULL */ |
| 153383 | + 212, /* (197) expr ::= expr NOT NULL */ |
| 153384 | + 212, /* (198) expr ::= expr IS expr */ |
| 153385 | + 212, /* (199) expr ::= expr IS NOT expr */ |
| 153386 | + 212, /* (200) expr ::= NOT expr */ |
| 153387 | + 212, /* (201) expr ::= BITNOT expr */ |
| 153388 | + 212, /* (202) expr ::= PLUS|MINUS expr */ |
| 153389 | + 268, /* (203) between_op ::= BETWEEN */ |
| 153390 | + 268, /* (204) between_op ::= NOT BETWEEN */ |
| 153391 | + 212, /* (205) expr ::= expr between_op expr AND expr */ |
| 153392 | + 269, /* (206) in_op ::= IN */ |
| 153393 | + 269, /* (207) in_op ::= NOT IN */ |
| 153394 | + 212, /* (208) expr ::= expr in_op LP exprlist RP */ |
| 153395 | + 212, /* (209) expr ::= LP select RP */ |
| 153396 | + 212, /* (210) expr ::= expr in_op LP select RP */ |
| 153397 | + 212, /* (211) expr ::= expr in_op nm dbnm paren_exprlist */ |
| 153398 | + 212, /* (212) expr ::= EXISTS LP select RP */ |
| 153399 | + 212, /* (213) expr ::= CASE case_operand case_exprlist case_else END */ |
| 153400 | + 272, /* (214) case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 153401 | + 272, /* (215) case_exprlist ::= WHEN expr THEN expr */ |
| 153402 | + 273, /* (216) case_else ::= ELSE expr */ |
| 153403 | + 273, /* (217) case_else ::= */ |
| 153404 | + 271, /* (218) case_operand ::= expr */ |
| 153405 | + 271, /* (219) case_operand ::= */ |
| 153406 | + 257, /* (220) exprlist ::= */ |
| 153407 | + 248, /* (221) nexprlist ::= nexprlist COMMA expr */ |
| 153408 | + 248, /* (222) nexprlist ::= expr */ |
| 153409 | + 270, /* (223) paren_exprlist ::= */ |
| 153410 | + 270, /* (224) paren_exprlist ::= LP exprlist RP */ |
| 153411 | + 186, /* (225) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 153412 | + 274, /* (226) uniqueflag ::= UNIQUE */ |
| 153413 | + 274, /* (227) uniqueflag ::= */ |
| 153414 | + 216, /* (228) eidlist_opt ::= */ |
| 153415 | + 216, /* (229) eidlist_opt ::= LP eidlist RP */ |
| 153416 | + 227, /* (230) eidlist ::= eidlist COMMA nm collate sortorder */ |
| 153417 | + 227, /* (231) eidlist ::= nm collate sortorder */ |
| 153418 | + 275, /* (232) collate ::= */ |
| 153419 | + 275, /* (233) collate ::= COLLATE ID|STRING */ |
| 153420 | + 186, /* (234) cmd ::= DROP INDEX ifexists fullname */ |
| 153421 | + 186, /* (235) cmd ::= VACUUM vinto */ |
| 153422 | + 186, /* (236) cmd ::= VACUUM nm vinto */ |
| 153423 | + 276, /* (237) vinto ::= INTO expr */ |
| 153424 | + 276, /* (238) vinto ::= */ |
| 153425 | + 186, /* (239) cmd ::= PRAGMA nm dbnm */ |
| 153426 | + 186, /* (240) cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 153427 | + 186, /* (241) cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 153428 | + 186, /* (242) cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 153429 | + 186, /* (243) cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 153430 | + 206, /* (244) plus_num ::= PLUS INTEGER|FLOAT */ |
| 153431 | + 207, /* (245) minus_num ::= MINUS INTEGER|FLOAT */ |
| 153432 | + 186, /* (246) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 153433 | + 278, /* (247) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 153434 | + 280, /* (248) trigger_time ::= BEFORE|AFTER */ |
| 153435 | + 280, /* (249) trigger_time ::= INSTEAD OF */ |
| 153436 | + 280, /* (250) trigger_time ::= */ |
| 153437 | + 281, /* (251) trigger_event ::= DELETE|INSERT */ |
| 153438 | + 281, /* (252) trigger_event ::= UPDATE */ |
| 153439 | + 281, /* (253) trigger_event ::= UPDATE OF idlist */ |
| 153440 | + 283, /* (254) when_clause ::= */ |
| 153441 | + 283, /* (255) when_clause ::= WHEN expr */ |
| 153442 | + 279, /* (256) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 153443 | + 279, /* (257) trigger_cmd_list ::= trigger_cmd SEMI */ |
| 153444 | + 285, /* (258) trnm ::= nm DOT nm */ |
| 153445 | + 286, /* (259) tridxby ::= INDEXED BY nm */ |
| 153446 | + 286, /* (260) tridxby ::= NOT INDEXED */ |
| 153447 | + 284, /* (261) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ |
| 153448 | + 284, /* (262) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 153449 | + 284, /* (263) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 153450 | + 284, /* (264) trigger_cmd ::= scanpt select scanpt */ |
| 153451 | + 212, /* (265) expr ::= RAISE LP IGNORE RP */ |
| 153452 | + 212, /* (266) expr ::= RAISE LP raisetype COMMA nm RP */ |
| 153453 | + 231, /* (267) raisetype ::= ROLLBACK */ |
| 153454 | + 231, /* (268) raisetype ::= ABORT */ |
| 153455 | + 231, /* (269) raisetype ::= FAIL */ |
| 153456 | + 186, /* (270) cmd ::= DROP TRIGGER ifexists fullname */ |
| 153457 | + 186, /* (271) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 153458 | + 186, /* (272) cmd ::= DETACH database_kw_opt expr */ |
| 153459 | + 288, /* (273) key_opt ::= */ |
| 153460 | + 288, /* (274) key_opt ::= KEY expr */ |
| 153461 | + 186, /* (275) cmd ::= REINDEX */ |
| 153462 | + 186, /* (276) cmd ::= REINDEX nm dbnm */ |
| 153463 | + 186, /* (277) cmd ::= ANALYZE */ |
| 153464 | + 186, /* (278) cmd ::= ANALYZE nm dbnm */ |
| 153465 | + 186, /* (279) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 153466 | + 186, /* (280) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 153467 | + 289, /* (281) add_column_fullname ::= fullname */ |
| 153468 | + 186, /* (282) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 153469 | + 186, /* (283) cmd ::= create_vtab */ |
| 153470 | + 186, /* (284) cmd ::= create_vtab LP vtabarglist RP */ |
| 153471 | + 291, /* (285) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 153472 | + 293, /* (286) vtabarg ::= */ |
| 153473 | + 294, /* (287) vtabargtoken ::= ANY */ |
| 153474 | + 294, /* (288) vtabargtoken ::= lp anylist RP */ |
| 153475 | + 295, /* (289) lp ::= LP */ |
| 153476 | + 261, /* (290) with ::= WITH wqlist */ |
| 153477 | + 261, /* (291) with ::= WITH RECURSIVE wqlist */ |
| 153478 | + 236, /* (292) wqlist ::= nm eidlist_opt AS LP select RP */ |
| 153479 | + 236, /* (293) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 153480 | + 297, /* (294) windowdefn_list ::= windowdefn */ |
| 153481 | + 297, /* (295) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 153482 | + 298, /* (296) windowdefn ::= nm AS LP window RP */ |
| 153483 | + 299, /* (297) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 153484 | + 299, /* (298) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 153485 | + 299, /* (299) window ::= ORDER BY sortlist frame_opt */ |
| 153486 | + 299, /* (300) window ::= nm ORDER BY sortlist frame_opt */ |
| 153487 | + 299, /* (301) window ::= frame_opt */ |
| 153488 | + 299, /* (302) window ::= nm frame_opt */ |
| 153489 | + 300, /* (303) frame_opt ::= */ |
| 153490 | + 300, /* (304) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 153491 | + 300, /* (305) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 153492 | + 304, /* (306) range_or_rows ::= RANGE|ROWS|GROUPS */ |
| 153493 | + 306, /* (307) frame_bound_s ::= frame_bound */ |
| 153494 | + 306, /* (308) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 153495 | + 307, /* (309) frame_bound_e ::= frame_bound */ |
| 153496 | + 307, /* (310) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 153497 | + 305, /* (311) frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 153498 | + 305, /* (312) frame_bound ::= CURRENT ROW */ |
| 153499 | + 308, /* (313) frame_exclude_opt ::= */ |
| 153500 | + 308, /* (314) frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 153501 | + 309, /* (315) frame_exclude ::= NO OTHERS */ |
| 153502 | + 309, /* (316) frame_exclude ::= CURRENT ROW */ |
| 153503 | + 309, /* (317) frame_exclude ::= GROUP|TIES */ |
| 153504 | + 246, /* (318) window_clause ::= WINDOW windowdefn_list */ |
| 153505 | + 266, /* (319) filter_over ::= filter_clause over_clause */ |
| 153506 | + 266, /* (320) filter_over ::= over_clause */ |
| 153507 | + 266, /* (321) filter_over ::= filter_clause */ |
| 153508 | + 303, /* (322) over_clause ::= OVER LP window RP */ |
| 153509 | + 303, /* (323) over_clause ::= OVER nm */ |
| 153510 | + 302, /* (324) filter_clause ::= FILTER LP WHERE expr RP */ |
| 153511 | + 181, /* (325) input ::= cmdlist */ |
| 153512 | + 182, /* (326) cmdlist ::= cmdlist ecmd */ |
| 153513 | + 182, /* (327) cmdlist ::= ecmd */ |
| 153514 | + 183, /* (328) ecmd ::= SEMI */ |
| 153515 | + 183, /* (329) ecmd ::= cmdx SEMI */ |
| 153516 | + 183, /* (330) ecmd ::= explain cmdx */ |
| 153517 | + 188, /* (331) trans_opt ::= */ |
| 153518 | + 188, /* (332) trans_opt ::= TRANSACTION */ |
| 153519 | + 188, /* (333) trans_opt ::= TRANSACTION nm */ |
| 153520 | + 190, /* (334) savepoint_opt ::= SAVEPOINT */ |
| 153521 | + 190, /* (335) savepoint_opt ::= */ |
| 153522 | + 186, /* (336) cmd ::= create_table create_table_args */ |
| 153523 | + 197, /* (337) columnlist ::= columnlist COMMA columnname carglist */ |
| 153524 | + 197, /* (338) columnlist ::= columnname carglist */ |
| 153525 | + 189, /* (339) nm ::= ID|INDEXED */ |
| 153526 | + 189, /* (340) nm ::= STRING */ |
| 153527 | + 189, /* (341) nm ::= JOIN_KW */ |
| 153528 | + 203, /* (342) typetoken ::= typename */ |
| 153529 | + 204, /* (343) typename ::= ID|STRING */ |
| 153530 | + 205, /* (344) signed ::= plus_num */ |
| 153531 | + 205, /* (345) signed ::= minus_num */ |
| 153532 | + 202, /* (346) carglist ::= carglist ccons */ |
| 153533 | + 202, /* (347) carglist ::= */ |
| 153534 | + 210, /* (348) ccons ::= NULL onconf */ |
| 153535 | + 210, /* (349) ccons ::= GENERATED ALWAYS AS generated */ |
| 153536 | + 210, /* (350) ccons ::= AS generated */ |
| 153537 | + 198, /* (351) conslist_opt ::= COMMA conslist */ |
| 153538 | + 223, /* (352) conslist ::= conslist tconscomma tcons */ |
| 153539 | + 223, /* (353) conslist ::= tcons */ |
| 153540 | + 224, /* (354) tconscomma ::= */ |
| 153541 | + 228, /* (355) defer_subclause_opt ::= defer_subclause */ |
| 153542 | + 230, /* (356) resolvetype ::= raisetype */ |
| 153543 | + 234, /* (357) selectnowith ::= oneselect */ |
| 153544 | + 235, /* (358) oneselect ::= values */ |
| 153545 | + 249, /* (359) sclp ::= selcollist COMMA */ |
| 153546 | + 250, /* (360) as ::= ID|STRING */ |
| 153547 | + 212, /* (361) expr ::= term */ |
| 153548 | + 267, /* (362) likeop ::= LIKE_KW|MATCH */ |
| 153549 | + 257, /* (363) exprlist ::= nexprlist */ |
| 153550 | + 277, /* (364) nmnum ::= plus_num */ |
| 153551 | + 277, /* (365) nmnum ::= nm */ |
| 153552 | + 277, /* (366) nmnum ::= ON */ |
| 153553 | + 277, /* (367) nmnum ::= DELETE */ |
| 153554 | + 277, /* (368) nmnum ::= DEFAULT */ |
| 153555 | + 206, /* (369) plus_num ::= INTEGER|FLOAT */ |
| 153556 | + 282, /* (370) foreach_clause ::= */ |
| 153557 | + 282, /* (371) foreach_clause ::= FOR EACH ROW */ |
| 153558 | + 285, /* (372) trnm ::= nm */ |
| 153559 | + 286, /* (373) tridxby ::= */ |
| 153560 | + 287, /* (374) database_kw_opt ::= DATABASE */ |
| 153561 | + 287, /* (375) database_kw_opt ::= */ |
| 153562 | + 290, /* (376) kwcolumn_opt ::= */ |
| 153563 | + 290, /* (377) kwcolumn_opt ::= COLUMNKW */ |
| 153564 | + 292, /* (378) vtabarglist ::= vtabarg */ |
| 153565 | + 292, /* (379) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 153566 | + 293, /* (380) vtabarg ::= vtabarg vtabargtoken */ |
| 153567 | + 296, /* (381) anylist ::= */ |
| 153568 | + 296, /* (382) anylist ::= anylist LP anylist RP */ |
| 153569 | + 296, /* (383) anylist ::= anylist ANY */ |
| 153570 | + 261, /* (384) with ::= */ |
| 152444 | 153571 | }; |
| 152445 | 153572 | |
| 152446 | 153573 | /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number |
| 152447 | 153574 | ** of symbols on the right-hand side of that rule. */ |
| 152448 | 153575 | static const signed char yyRuleInfoNRhs[] = { |
| | @@ -152487,348 +153614,352 @@ |
| 152487 | 153614 | -2, /* (38) ccons ::= UNIQUE onconf */ |
| 152488 | 153615 | -4, /* (39) ccons ::= CHECK LP expr RP */ |
| 152489 | 153616 | -4, /* (40) ccons ::= REFERENCES nm eidlist_opt refargs */ |
| 152490 | 153617 | -1, /* (41) ccons ::= defer_subclause */ |
| 152491 | 153618 | -2, /* (42) ccons ::= COLLATE ID|STRING */ |
| 152492 | | - 0, /* (43) autoinc ::= */ |
| 152493 | | - -1, /* (44) autoinc ::= AUTOINCR */ |
| 152494 | | - 0, /* (45) refargs ::= */ |
| 152495 | | - -2, /* (46) refargs ::= refargs refarg */ |
| 152496 | | - -2, /* (47) refarg ::= MATCH nm */ |
| 152497 | | - -3, /* (48) refarg ::= ON INSERT refact */ |
| 152498 | | - -3, /* (49) refarg ::= ON DELETE refact */ |
| 152499 | | - -3, /* (50) refarg ::= ON UPDATE refact */ |
| 152500 | | - -2, /* (51) refact ::= SET NULL */ |
| 152501 | | - -2, /* (52) refact ::= SET DEFAULT */ |
| 152502 | | - -1, /* (53) refact ::= CASCADE */ |
| 152503 | | - -1, /* (54) refact ::= RESTRICT */ |
| 152504 | | - -2, /* (55) refact ::= NO ACTION */ |
| 152505 | | - -3, /* (56) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ |
| 152506 | | - -2, /* (57) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ |
| 152507 | | - 0, /* (58) init_deferred_pred_opt ::= */ |
| 152508 | | - -2, /* (59) init_deferred_pred_opt ::= INITIALLY DEFERRED */ |
| 152509 | | - -2, /* (60) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ |
| 152510 | | - 0, /* (61) conslist_opt ::= */ |
| 152511 | | - -1, /* (62) tconscomma ::= COMMA */ |
| 152512 | | - -2, /* (63) tcons ::= CONSTRAINT nm */ |
| 152513 | | - -7, /* (64) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ |
| 152514 | | - -5, /* (65) tcons ::= UNIQUE LP sortlist RP onconf */ |
| 152515 | | - -5, /* (66) tcons ::= CHECK LP expr RP onconf */ |
| 152516 | | - -10, /* (67) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ |
| 152517 | | - 0, /* (68) defer_subclause_opt ::= */ |
| 152518 | | - 0, /* (69) onconf ::= */ |
| 152519 | | - -3, /* (70) onconf ::= ON CONFLICT resolvetype */ |
| 152520 | | - 0, /* (71) orconf ::= */ |
| 152521 | | - -2, /* (72) orconf ::= OR resolvetype */ |
| 152522 | | - -1, /* (73) resolvetype ::= IGNORE */ |
| 152523 | | - -1, /* (74) resolvetype ::= REPLACE */ |
| 152524 | | - -4, /* (75) cmd ::= DROP TABLE ifexists fullname */ |
| 152525 | | - -2, /* (76) ifexists ::= IF EXISTS */ |
| 152526 | | - 0, /* (77) ifexists ::= */ |
| 152527 | | - -9, /* (78) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ |
| 152528 | | - -4, /* (79) cmd ::= DROP VIEW ifexists fullname */ |
| 152529 | | - -1, /* (80) cmd ::= select */ |
| 152530 | | - -3, /* (81) select ::= WITH wqlist selectnowith */ |
| 152531 | | - -4, /* (82) select ::= WITH RECURSIVE wqlist selectnowith */ |
| 152532 | | - -1, /* (83) select ::= selectnowith */ |
| 152533 | | - -3, /* (84) selectnowith ::= selectnowith multiselect_op oneselect */ |
| 152534 | | - -1, /* (85) multiselect_op ::= UNION */ |
| 152535 | | - -2, /* (86) multiselect_op ::= UNION ALL */ |
| 152536 | | - -1, /* (87) multiselect_op ::= EXCEPT|INTERSECT */ |
| 152537 | | - -9, /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ |
| 152538 | | - -10, /* (89) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ |
| 152539 | | - -4, /* (90) values ::= VALUES LP nexprlist RP */ |
| 152540 | | - -5, /* (91) values ::= values COMMA LP nexprlist RP */ |
| 152541 | | - -1, /* (92) distinct ::= DISTINCT */ |
| 152542 | | - -1, /* (93) distinct ::= ALL */ |
| 152543 | | - 0, /* (94) distinct ::= */ |
| 152544 | | - 0, /* (95) sclp ::= */ |
| 152545 | | - -5, /* (96) selcollist ::= sclp scanpt expr scanpt as */ |
| 152546 | | - -3, /* (97) selcollist ::= sclp scanpt STAR */ |
| 152547 | | - -5, /* (98) selcollist ::= sclp scanpt nm DOT STAR */ |
| 152548 | | - -2, /* (99) as ::= AS nm */ |
| 152549 | | - 0, /* (100) as ::= */ |
| 152550 | | - 0, /* (101) from ::= */ |
| 152551 | | - -2, /* (102) from ::= FROM seltablist */ |
| 152552 | | - -2, /* (103) stl_prefix ::= seltablist joinop */ |
| 152553 | | - 0, /* (104) stl_prefix ::= */ |
| 152554 | | - -7, /* (105) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ |
| 152555 | | - -9, /* (106) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ |
| 152556 | | - -7, /* (107) seltablist ::= stl_prefix LP select RP as on_opt using_opt */ |
| 152557 | | - -7, /* (108) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ |
| 152558 | | - 0, /* (109) dbnm ::= */ |
| 152559 | | - -2, /* (110) dbnm ::= DOT nm */ |
| 152560 | | - -1, /* (111) fullname ::= nm */ |
| 152561 | | - -3, /* (112) fullname ::= nm DOT nm */ |
| 152562 | | - -1, /* (113) xfullname ::= nm */ |
| 152563 | | - -3, /* (114) xfullname ::= nm DOT nm */ |
| 152564 | | - -5, /* (115) xfullname ::= nm DOT nm AS nm */ |
| 152565 | | - -3, /* (116) xfullname ::= nm AS nm */ |
| 152566 | | - -1, /* (117) joinop ::= COMMA|JOIN */ |
| 152567 | | - -2, /* (118) joinop ::= JOIN_KW JOIN */ |
| 152568 | | - -3, /* (119) joinop ::= JOIN_KW nm JOIN */ |
| 152569 | | - -4, /* (120) joinop ::= JOIN_KW nm nm JOIN */ |
| 152570 | | - -2, /* (121) on_opt ::= ON expr */ |
| 152571 | | - 0, /* (122) on_opt ::= */ |
| 152572 | | - 0, /* (123) indexed_opt ::= */ |
| 152573 | | - -3, /* (124) indexed_opt ::= INDEXED BY nm */ |
| 152574 | | - -2, /* (125) indexed_opt ::= NOT INDEXED */ |
| 152575 | | - -4, /* (126) using_opt ::= USING LP idlist RP */ |
| 152576 | | - 0, /* (127) using_opt ::= */ |
| 152577 | | - 0, /* (128) orderby_opt ::= */ |
| 152578 | | - -3, /* (129) orderby_opt ::= ORDER BY sortlist */ |
| 152579 | | - -5, /* (130) sortlist ::= sortlist COMMA expr sortorder nulls */ |
| 152580 | | - -3, /* (131) sortlist ::= expr sortorder nulls */ |
| 152581 | | - -1, /* (132) sortorder ::= ASC */ |
| 152582 | | - -1, /* (133) sortorder ::= DESC */ |
| 152583 | | - 0, /* (134) sortorder ::= */ |
| 152584 | | - -2, /* (135) nulls ::= NULLS FIRST */ |
| 152585 | | - -2, /* (136) nulls ::= NULLS LAST */ |
| 152586 | | - 0, /* (137) nulls ::= */ |
| 152587 | | - 0, /* (138) groupby_opt ::= */ |
| 152588 | | - -3, /* (139) groupby_opt ::= GROUP BY nexprlist */ |
| 152589 | | - 0, /* (140) having_opt ::= */ |
| 152590 | | - -2, /* (141) having_opt ::= HAVING expr */ |
| 152591 | | - 0, /* (142) limit_opt ::= */ |
| 152592 | | - -2, /* (143) limit_opt ::= LIMIT expr */ |
| 152593 | | - -4, /* (144) limit_opt ::= LIMIT expr OFFSET expr */ |
| 152594 | | - -4, /* (145) limit_opt ::= LIMIT expr COMMA expr */ |
| 152595 | | - -6, /* (146) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */ |
| 152596 | | - 0, /* (147) where_opt ::= */ |
| 152597 | | - -2, /* (148) where_opt ::= WHERE expr */ |
| 152598 | | - -8, /* (149) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */ |
| 152599 | | - -5, /* (150) setlist ::= setlist COMMA nm EQ expr */ |
| 152600 | | - -7, /* (151) setlist ::= setlist COMMA LP idlist RP EQ expr */ |
| 152601 | | - -3, /* (152) setlist ::= nm EQ expr */ |
| 152602 | | - -5, /* (153) setlist ::= LP idlist RP EQ expr */ |
| 152603 | | - -7, /* (154) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ |
| 152604 | | - -7, /* (155) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */ |
| 152605 | | - 0, /* (156) upsert ::= */ |
| 152606 | | - -11, /* (157) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */ |
| 152607 | | - -8, /* (158) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */ |
| 152608 | | - -4, /* (159) upsert ::= ON CONFLICT DO NOTHING */ |
| 152609 | | - -2, /* (160) insert_cmd ::= INSERT orconf */ |
| 152610 | | - -1, /* (161) insert_cmd ::= REPLACE */ |
| 152611 | | - 0, /* (162) idlist_opt ::= */ |
| 152612 | | - -3, /* (163) idlist_opt ::= LP idlist RP */ |
| 152613 | | - -3, /* (164) idlist ::= idlist COMMA nm */ |
| 152614 | | - -1, /* (165) idlist ::= nm */ |
| 152615 | | - -3, /* (166) expr ::= LP expr RP */ |
| 152616 | | - -1, /* (167) expr ::= ID|INDEXED */ |
| 152617 | | - -1, /* (168) expr ::= JOIN_KW */ |
| 152618 | | - -3, /* (169) expr ::= nm DOT nm */ |
| 152619 | | - -5, /* (170) expr ::= nm DOT nm DOT nm */ |
| 152620 | | - -1, /* (171) term ::= NULL|FLOAT|BLOB */ |
| 152621 | | - -1, /* (172) term ::= STRING */ |
| 152622 | | - -1, /* (173) term ::= INTEGER */ |
| 152623 | | - -1, /* (174) expr ::= VARIABLE */ |
| 152624 | | - -3, /* (175) expr ::= expr COLLATE ID|STRING */ |
| 152625 | | - -6, /* (176) expr ::= CAST LP expr AS typetoken RP */ |
| 152626 | | - -5, /* (177) expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 152627 | | - -4, /* (178) expr ::= ID|INDEXED LP STAR RP */ |
| 152628 | | - -6, /* (179) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ |
| 152629 | | - -5, /* (180) expr ::= ID|INDEXED LP STAR RP filter_over */ |
| 152630 | | - -1, /* (181) term ::= CTIME_KW */ |
| 152631 | | - -5, /* (182) expr ::= LP nexprlist COMMA expr RP */ |
| 152632 | | - -3, /* (183) expr ::= expr AND expr */ |
| 152633 | | - -3, /* (184) expr ::= expr OR expr */ |
| 152634 | | - -3, /* (185) expr ::= expr LT|GT|GE|LE expr */ |
| 152635 | | - -3, /* (186) expr ::= expr EQ|NE expr */ |
| 152636 | | - -3, /* (187) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ |
| 152637 | | - -3, /* (188) expr ::= expr PLUS|MINUS expr */ |
| 152638 | | - -3, /* (189) expr ::= expr STAR|SLASH|REM expr */ |
| 152639 | | - -3, /* (190) expr ::= expr CONCAT expr */ |
| 152640 | | - -2, /* (191) likeop ::= NOT LIKE_KW|MATCH */ |
| 152641 | | - -3, /* (192) expr ::= expr likeop expr */ |
| 152642 | | - -5, /* (193) expr ::= expr likeop expr ESCAPE expr */ |
| 152643 | | - -2, /* (194) expr ::= expr ISNULL|NOTNULL */ |
| 152644 | | - -3, /* (195) expr ::= expr NOT NULL */ |
| 152645 | | - -3, /* (196) expr ::= expr IS expr */ |
| 152646 | | - -4, /* (197) expr ::= expr IS NOT expr */ |
| 152647 | | - -2, /* (198) expr ::= NOT expr */ |
| 152648 | | - -2, /* (199) expr ::= BITNOT expr */ |
| 152649 | | - -2, /* (200) expr ::= PLUS|MINUS expr */ |
| 152650 | | - -1, /* (201) between_op ::= BETWEEN */ |
| 152651 | | - -2, /* (202) between_op ::= NOT BETWEEN */ |
| 152652 | | - -5, /* (203) expr ::= expr between_op expr AND expr */ |
| 152653 | | - -1, /* (204) in_op ::= IN */ |
| 152654 | | - -2, /* (205) in_op ::= NOT IN */ |
| 152655 | | - -5, /* (206) expr ::= expr in_op LP exprlist RP */ |
| 152656 | | - -3, /* (207) expr ::= LP select RP */ |
| 152657 | | - -5, /* (208) expr ::= expr in_op LP select RP */ |
| 152658 | | - -5, /* (209) expr ::= expr in_op nm dbnm paren_exprlist */ |
| 152659 | | - -4, /* (210) expr ::= EXISTS LP select RP */ |
| 152660 | | - -5, /* (211) expr ::= CASE case_operand case_exprlist case_else END */ |
| 152661 | | - -5, /* (212) case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 152662 | | - -4, /* (213) case_exprlist ::= WHEN expr THEN expr */ |
| 152663 | | - -2, /* (214) case_else ::= ELSE expr */ |
| 152664 | | - 0, /* (215) case_else ::= */ |
| 152665 | | - -1, /* (216) case_operand ::= expr */ |
| 152666 | | - 0, /* (217) case_operand ::= */ |
| 152667 | | - 0, /* (218) exprlist ::= */ |
| 152668 | | - -3, /* (219) nexprlist ::= nexprlist COMMA expr */ |
| 152669 | | - -1, /* (220) nexprlist ::= expr */ |
| 152670 | | - 0, /* (221) paren_exprlist ::= */ |
| 152671 | | - -3, /* (222) paren_exprlist ::= LP exprlist RP */ |
| 152672 | | - -12, /* (223) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 152673 | | - -1, /* (224) uniqueflag ::= UNIQUE */ |
| 152674 | | - 0, /* (225) uniqueflag ::= */ |
| 152675 | | - 0, /* (226) eidlist_opt ::= */ |
| 152676 | | - -3, /* (227) eidlist_opt ::= LP eidlist RP */ |
| 152677 | | - -5, /* (228) eidlist ::= eidlist COMMA nm collate sortorder */ |
| 152678 | | - -3, /* (229) eidlist ::= nm collate sortorder */ |
| 152679 | | - 0, /* (230) collate ::= */ |
| 152680 | | - -2, /* (231) collate ::= COLLATE ID|STRING */ |
| 152681 | | - -4, /* (232) cmd ::= DROP INDEX ifexists fullname */ |
| 152682 | | - -2, /* (233) cmd ::= VACUUM vinto */ |
| 152683 | | - -3, /* (234) cmd ::= VACUUM nm vinto */ |
| 152684 | | - -2, /* (235) vinto ::= INTO expr */ |
| 152685 | | - 0, /* (236) vinto ::= */ |
| 152686 | | - -3, /* (237) cmd ::= PRAGMA nm dbnm */ |
| 152687 | | - -5, /* (238) cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 152688 | | - -6, /* (239) cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 152689 | | - -5, /* (240) cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 152690 | | - -6, /* (241) cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 152691 | | - -2, /* (242) plus_num ::= PLUS INTEGER|FLOAT */ |
| 152692 | | - -2, /* (243) minus_num ::= MINUS INTEGER|FLOAT */ |
| 152693 | | - -5, /* (244) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 152694 | | - -11, /* (245) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 152695 | | - -1, /* (246) trigger_time ::= BEFORE|AFTER */ |
| 152696 | | - -2, /* (247) trigger_time ::= INSTEAD OF */ |
| 152697 | | - 0, /* (248) trigger_time ::= */ |
| 152698 | | - -1, /* (249) trigger_event ::= DELETE|INSERT */ |
| 152699 | | - -1, /* (250) trigger_event ::= UPDATE */ |
| 152700 | | - -3, /* (251) trigger_event ::= UPDATE OF idlist */ |
| 152701 | | - 0, /* (252) when_clause ::= */ |
| 152702 | | - -2, /* (253) when_clause ::= WHEN expr */ |
| 152703 | | - -3, /* (254) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 152704 | | - -2, /* (255) trigger_cmd_list ::= trigger_cmd SEMI */ |
| 152705 | | - -3, /* (256) trnm ::= nm DOT nm */ |
| 152706 | | - -3, /* (257) tridxby ::= INDEXED BY nm */ |
| 152707 | | - -2, /* (258) tridxby ::= NOT INDEXED */ |
| 152708 | | - -8, /* (259) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ |
| 152709 | | - -8, /* (260) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 152710 | | - -6, /* (261) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 152711 | | - -3, /* (262) trigger_cmd ::= scanpt select scanpt */ |
| 152712 | | - -4, /* (263) expr ::= RAISE LP IGNORE RP */ |
| 152713 | | - -6, /* (264) expr ::= RAISE LP raisetype COMMA nm RP */ |
| 152714 | | - -1, /* (265) raisetype ::= ROLLBACK */ |
| 152715 | | - -1, /* (266) raisetype ::= ABORT */ |
| 152716 | | - -1, /* (267) raisetype ::= FAIL */ |
| 152717 | | - -4, /* (268) cmd ::= DROP TRIGGER ifexists fullname */ |
| 152718 | | - -6, /* (269) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 152719 | | - -3, /* (270) cmd ::= DETACH database_kw_opt expr */ |
| 152720 | | - 0, /* (271) key_opt ::= */ |
| 152721 | | - -2, /* (272) key_opt ::= KEY expr */ |
| 152722 | | - -1, /* (273) cmd ::= REINDEX */ |
| 152723 | | - -3, /* (274) cmd ::= REINDEX nm dbnm */ |
| 152724 | | - -1, /* (275) cmd ::= ANALYZE */ |
| 152725 | | - -3, /* (276) cmd ::= ANALYZE nm dbnm */ |
| 152726 | | - -6, /* (277) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 152727 | | - -7, /* (278) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 152728 | | - -1, /* (279) add_column_fullname ::= fullname */ |
| 152729 | | - -8, /* (280) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 152730 | | - -1, /* (281) cmd ::= create_vtab */ |
| 152731 | | - -4, /* (282) cmd ::= create_vtab LP vtabarglist RP */ |
| 152732 | | - -8, /* (283) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 152733 | | - 0, /* (284) vtabarg ::= */ |
| 152734 | | - -1, /* (285) vtabargtoken ::= ANY */ |
| 152735 | | - -3, /* (286) vtabargtoken ::= lp anylist RP */ |
| 152736 | | - -1, /* (287) lp ::= LP */ |
| 152737 | | - -2, /* (288) with ::= WITH wqlist */ |
| 152738 | | - -3, /* (289) with ::= WITH RECURSIVE wqlist */ |
| 152739 | | - -6, /* (290) wqlist ::= nm eidlist_opt AS LP select RP */ |
| 152740 | | - -8, /* (291) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 152741 | | - -1, /* (292) windowdefn_list ::= windowdefn */ |
| 152742 | | - -3, /* (293) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 152743 | | - -5, /* (294) windowdefn ::= nm AS LP window RP */ |
| 152744 | | - -5, /* (295) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 152745 | | - -6, /* (296) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 152746 | | - -4, /* (297) window ::= ORDER BY sortlist frame_opt */ |
| 152747 | | - -5, /* (298) window ::= nm ORDER BY sortlist frame_opt */ |
| 152748 | | - -1, /* (299) window ::= frame_opt */ |
| 152749 | | - -2, /* (300) window ::= nm frame_opt */ |
| 152750 | | - 0, /* (301) frame_opt ::= */ |
| 152751 | | - -3, /* (302) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 152752 | | - -6, /* (303) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 152753 | | - -1, /* (304) range_or_rows ::= RANGE|ROWS|GROUPS */ |
| 152754 | | - -1, /* (305) frame_bound_s ::= frame_bound */ |
| 152755 | | - -2, /* (306) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 152756 | | - -1, /* (307) frame_bound_e ::= frame_bound */ |
| 152757 | | - -2, /* (308) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 152758 | | - -2, /* (309) frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 152759 | | - -2, /* (310) frame_bound ::= CURRENT ROW */ |
| 152760 | | - 0, /* (311) frame_exclude_opt ::= */ |
| 152761 | | - -2, /* (312) frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 152762 | | - -2, /* (313) frame_exclude ::= NO OTHERS */ |
| 152763 | | - -2, /* (314) frame_exclude ::= CURRENT ROW */ |
| 152764 | | - -1, /* (315) frame_exclude ::= GROUP|TIES */ |
| 152765 | | - -2, /* (316) window_clause ::= WINDOW windowdefn_list */ |
| 152766 | | - -2, /* (317) filter_over ::= filter_clause over_clause */ |
| 152767 | | - -1, /* (318) filter_over ::= over_clause */ |
| 152768 | | - -1, /* (319) filter_over ::= filter_clause */ |
| 152769 | | - -4, /* (320) over_clause ::= OVER LP window RP */ |
| 152770 | | - -2, /* (321) over_clause ::= OVER nm */ |
| 152771 | | - -5, /* (322) filter_clause ::= FILTER LP WHERE expr RP */ |
| 152772 | | - -1, /* (323) input ::= cmdlist */ |
| 152773 | | - -2, /* (324) cmdlist ::= cmdlist ecmd */ |
| 152774 | | - -1, /* (325) cmdlist ::= ecmd */ |
| 152775 | | - -1, /* (326) ecmd ::= SEMI */ |
| 152776 | | - -2, /* (327) ecmd ::= cmdx SEMI */ |
| 152777 | | - -2, /* (328) ecmd ::= explain cmdx */ |
| 152778 | | - 0, /* (329) trans_opt ::= */ |
| 152779 | | - -1, /* (330) trans_opt ::= TRANSACTION */ |
| 152780 | | - -2, /* (331) trans_opt ::= TRANSACTION nm */ |
| 152781 | | - -1, /* (332) savepoint_opt ::= SAVEPOINT */ |
| 152782 | | - 0, /* (333) savepoint_opt ::= */ |
| 152783 | | - -2, /* (334) cmd ::= create_table create_table_args */ |
| 152784 | | - -4, /* (335) columnlist ::= columnlist COMMA columnname carglist */ |
| 152785 | | - -2, /* (336) columnlist ::= columnname carglist */ |
| 152786 | | - -1, /* (337) nm ::= ID|INDEXED */ |
| 152787 | | - -1, /* (338) nm ::= STRING */ |
| 152788 | | - -1, /* (339) nm ::= JOIN_KW */ |
| 152789 | | - -1, /* (340) typetoken ::= typename */ |
| 152790 | | - -1, /* (341) typename ::= ID|STRING */ |
| 152791 | | - -1, /* (342) signed ::= plus_num */ |
| 152792 | | - -1, /* (343) signed ::= minus_num */ |
| 152793 | | - -2, /* (344) carglist ::= carglist ccons */ |
| 152794 | | - 0, /* (345) carglist ::= */ |
| 152795 | | - -2, /* (346) ccons ::= NULL onconf */ |
| 152796 | | - -2, /* (347) conslist_opt ::= COMMA conslist */ |
| 152797 | | - -3, /* (348) conslist ::= conslist tconscomma tcons */ |
| 152798 | | - -1, /* (349) conslist ::= tcons */ |
| 152799 | | - 0, /* (350) tconscomma ::= */ |
| 152800 | | - -1, /* (351) defer_subclause_opt ::= defer_subclause */ |
| 152801 | | - -1, /* (352) resolvetype ::= raisetype */ |
| 152802 | | - -1, /* (353) selectnowith ::= oneselect */ |
| 152803 | | - -1, /* (354) oneselect ::= values */ |
| 152804 | | - -2, /* (355) sclp ::= selcollist COMMA */ |
| 152805 | | - -1, /* (356) as ::= ID|STRING */ |
| 152806 | | - -1, /* (357) expr ::= term */ |
| 152807 | | - -1, /* (358) likeop ::= LIKE_KW|MATCH */ |
| 152808 | | - -1, /* (359) exprlist ::= nexprlist */ |
| 152809 | | - -1, /* (360) nmnum ::= plus_num */ |
| 152810 | | - -1, /* (361) nmnum ::= nm */ |
| 152811 | | - -1, /* (362) nmnum ::= ON */ |
| 152812 | | - -1, /* (363) nmnum ::= DELETE */ |
| 152813 | | - -1, /* (364) nmnum ::= DEFAULT */ |
| 152814 | | - -1, /* (365) plus_num ::= INTEGER|FLOAT */ |
| 152815 | | - 0, /* (366) foreach_clause ::= */ |
| 152816 | | - -3, /* (367) foreach_clause ::= FOR EACH ROW */ |
| 152817 | | - -1, /* (368) trnm ::= nm */ |
| 152818 | | - 0, /* (369) tridxby ::= */ |
| 152819 | | - -1, /* (370) database_kw_opt ::= DATABASE */ |
| 152820 | | - 0, /* (371) database_kw_opt ::= */ |
| 152821 | | - 0, /* (372) kwcolumn_opt ::= */ |
| 152822 | | - -1, /* (373) kwcolumn_opt ::= COLUMNKW */ |
| 152823 | | - -1, /* (374) vtabarglist ::= vtabarg */ |
| 152824 | | - -3, /* (375) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 152825 | | - -2, /* (376) vtabarg ::= vtabarg vtabargtoken */ |
| 152826 | | - 0, /* (377) anylist ::= */ |
| 152827 | | - -4, /* (378) anylist ::= anylist LP anylist RP */ |
| 152828 | | - -2, /* (379) anylist ::= anylist ANY */ |
| 152829 | | - 0, /* (380) with ::= */ |
| 153619 | + -3, /* (43) generated ::= LP expr RP */ |
| 153620 | + -4, /* (44) generated ::= LP expr RP ID */ |
| 153621 | + 0, /* (45) autoinc ::= */ |
| 153622 | + -1, /* (46) autoinc ::= AUTOINCR */ |
| 153623 | + 0, /* (47) refargs ::= */ |
| 153624 | + -2, /* (48) refargs ::= refargs refarg */ |
| 153625 | + -2, /* (49) refarg ::= MATCH nm */ |
| 153626 | + -3, /* (50) refarg ::= ON INSERT refact */ |
| 153627 | + -3, /* (51) refarg ::= ON DELETE refact */ |
| 153628 | + -3, /* (52) refarg ::= ON UPDATE refact */ |
| 153629 | + -2, /* (53) refact ::= SET NULL */ |
| 153630 | + -2, /* (54) refact ::= SET DEFAULT */ |
| 153631 | + -1, /* (55) refact ::= CASCADE */ |
| 153632 | + -1, /* (56) refact ::= RESTRICT */ |
| 153633 | + -2, /* (57) refact ::= NO ACTION */ |
| 153634 | + -3, /* (58) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ |
| 153635 | + -2, /* (59) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ |
| 153636 | + 0, /* (60) init_deferred_pred_opt ::= */ |
| 153637 | + -2, /* (61) init_deferred_pred_opt ::= INITIALLY DEFERRED */ |
| 153638 | + -2, /* (62) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ |
| 153639 | + 0, /* (63) conslist_opt ::= */ |
| 153640 | + -1, /* (64) tconscomma ::= COMMA */ |
| 153641 | + -2, /* (65) tcons ::= CONSTRAINT nm */ |
| 153642 | + -7, /* (66) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ |
| 153643 | + -5, /* (67) tcons ::= UNIQUE LP sortlist RP onconf */ |
| 153644 | + -5, /* (68) tcons ::= CHECK LP expr RP onconf */ |
| 153645 | + -10, /* (69) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ |
| 153646 | + 0, /* (70) defer_subclause_opt ::= */ |
| 153647 | + 0, /* (71) onconf ::= */ |
| 153648 | + -3, /* (72) onconf ::= ON CONFLICT resolvetype */ |
| 153649 | + 0, /* (73) orconf ::= */ |
| 153650 | + -2, /* (74) orconf ::= OR resolvetype */ |
| 153651 | + -1, /* (75) resolvetype ::= IGNORE */ |
| 153652 | + -1, /* (76) resolvetype ::= REPLACE */ |
| 153653 | + -4, /* (77) cmd ::= DROP TABLE ifexists fullname */ |
| 153654 | + -2, /* (78) ifexists ::= IF EXISTS */ |
| 153655 | + 0, /* (79) ifexists ::= */ |
| 153656 | + -9, /* (80) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ |
| 153657 | + -4, /* (81) cmd ::= DROP VIEW ifexists fullname */ |
| 153658 | + -1, /* (82) cmd ::= select */ |
| 153659 | + -3, /* (83) select ::= WITH wqlist selectnowith */ |
| 153660 | + -4, /* (84) select ::= WITH RECURSIVE wqlist selectnowith */ |
| 153661 | + -1, /* (85) select ::= selectnowith */ |
| 153662 | + -3, /* (86) selectnowith ::= selectnowith multiselect_op oneselect */ |
| 153663 | + -1, /* (87) multiselect_op ::= UNION */ |
| 153664 | + -2, /* (88) multiselect_op ::= UNION ALL */ |
| 153665 | + -1, /* (89) multiselect_op ::= EXCEPT|INTERSECT */ |
| 153666 | + -9, /* (90) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ |
| 153667 | + -10, /* (91) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ |
| 153668 | + -4, /* (92) values ::= VALUES LP nexprlist RP */ |
| 153669 | + -5, /* (93) values ::= values COMMA LP nexprlist RP */ |
| 153670 | + -1, /* (94) distinct ::= DISTINCT */ |
| 153671 | + -1, /* (95) distinct ::= ALL */ |
| 153672 | + 0, /* (96) distinct ::= */ |
| 153673 | + 0, /* (97) sclp ::= */ |
| 153674 | + -5, /* (98) selcollist ::= sclp scanpt expr scanpt as */ |
| 153675 | + -3, /* (99) selcollist ::= sclp scanpt STAR */ |
| 153676 | + -5, /* (100) selcollist ::= sclp scanpt nm DOT STAR */ |
| 153677 | + -2, /* (101) as ::= AS nm */ |
| 153678 | + 0, /* (102) as ::= */ |
| 153679 | + 0, /* (103) from ::= */ |
| 153680 | + -2, /* (104) from ::= FROM seltablist */ |
| 153681 | + -2, /* (105) stl_prefix ::= seltablist joinop */ |
| 153682 | + 0, /* (106) stl_prefix ::= */ |
| 153683 | + -7, /* (107) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ |
| 153684 | + -9, /* (108) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ |
| 153685 | + -7, /* (109) seltablist ::= stl_prefix LP select RP as on_opt using_opt */ |
| 153686 | + -7, /* (110) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ |
| 153687 | + 0, /* (111) dbnm ::= */ |
| 153688 | + -2, /* (112) dbnm ::= DOT nm */ |
| 153689 | + -1, /* (113) fullname ::= nm */ |
| 153690 | + -3, /* (114) fullname ::= nm DOT nm */ |
| 153691 | + -1, /* (115) xfullname ::= nm */ |
| 153692 | + -3, /* (116) xfullname ::= nm DOT nm */ |
| 153693 | + -5, /* (117) xfullname ::= nm DOT nm AS nm */ |
| 153694 | + -3, /* (118) xfullname ::= nm AS nm */ |
| 153695 | + -1, /* (119) joinop ::= COMMA|JOIN */ |
| 153696 | + -2, /* (120) joinop ::= JOIN_KW JOIN */ |
| 153697 | + -3, /* (121) joinop ::= JOIN_KW nm JOIN */ |
| 153698 | + -4, /* (122) joinop ::= JOIN_KW nm nm JOIN */ |
| 153699 | + -2, /* (123) on_opt ::= ON expr */ |
| 153700 | + 0, /* (124) on_opt ::= */ |
| 153701 | + 0, /* (125) indexed_opt ::= */ |
| 153702 | + -3, /* (126) indexed_opt ::= INDEXED BY nm */ |
| 153703 | + -2, /* (127) indexed_opt ::= NOT INDEXED */ |
| 153704 | + -4, /* (128) using_opt ::= USING LP idlist RP */ |
| 153705 | + 0, /* (129) using_opt ::= */ |
| 153706 | + 0, /* (130) orderby_opt ::= */ |
| 153707 | + -3, /* (131) orderby_opt ::= ORDER BY sortlist */ |
| 153708 | + -5, /* (132) sortlist ::= sortlist COMMA expr sortorder nulls */ |
| 153709 | + -3, /* (133) sortlist ::= expr sortorder nulls */ |
| 153710 | + -1, /* (134) sortorder ::= ASC */ |
| 153711 | + -1, /* (135) sortorder ::= DESC */ |
| 153712 | + 0, /* (136) sortorder ::= */ |
| 153713 | + -2, /* (137) nulls ::= NULLS FIRST */ |
| 153714 | + -2, /* (138) nulls ::= NULLS LAST */ |
| 153715 | + 0, /* (139) nulls ::= */ |
| 153716 | + 0, /* (140) groupby_opt ::= */ |
| 153717 | + -3, /* (141) groupby_opt ::= GROUP BY nexprlist */ |
| 153718 | + 0, /* (142) having_opt ::= */ |
| 153719 | + -2, /* (143) having_opt ::= HAVING expr */ |
| 153720 | + 0, /* (144) limit_opt ::= */ |
| 153721 | + -2, /* (145) limit_opt ::= LIMIT expr */ |
| 153722 | + -4, /* (146) limit_opt ::= LIMIT expr OFFSET expr */ |
| 153723 | + -4, /* (147) limit_opt ::= LIMIT expr COMMA expr */ |
| 153724 | + -6, /* (148) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */ |
| 153725 | + 0, /* (149) where_opt ::= */ |
| 153726 | + -2, /* (150) where_opt ::= WHERE expr */ |
| 153727 | + -8, /* (151) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */ |
| 153728 | + -5, /* (152) setlist ::= setlist COMMA nm EQ expr */ |
| 153729 | + -7, /* (153) setlist ::= setlist COMMA LP idlist RP EQ expr */ |
| 153730 | + -3, /* (154) setlist ::= nm EQ expr */ |
| 153731 | + -5, /* (155) setlist ::= LP idlist RP EQ expr */ |
| 153732 | + -7, /* (156) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ |
| 153733 | + -7, /* (157) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */ |
| 153734 | + 0, /* (158) upsert ::= */ |
| 153735 | + -11, /* (159) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */ |
| 153736 | + -8, /* (160) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */ |
| 153737 | + -4, /* (161) upsert ::= ON CONFLICT DO NOTHING */ |
| 153738 | + -2, /* (162) insert_cmd ::= INSERT orconf */ |
| 153739 | + -1, /* (163) insert_cmd ::= REPLACE */ |
| 153740 | + 0, /* (164) idlist_opt ::= */ |
| 153741 | + -3, /* (165) idlist_opt ::= LP idlist RP */ |
| 153742 | + -3, /* (166) idlist ::= idlist COMMA nm */ |
| 153743 | + -1, /* (167) idlist ::= nm */ |
| 153744 | + -3, /* (168) expr ::= LP expr RP */ |
| 153745 | + -1, /* (169) expr ::= ID|INDEXED */ |
| 153746 | + -1, /* (170) expr ::= JOIN_KW */ |
| 153747 | + -3, /* (171) expr ::= nm DOT nm */ |
| 153748 | + -5, /* (172) expr ::= nm DOT nm DOT nm */ |
| 153749 | + -1, /* (173) term ::= NULL|FLOAT|BLOB */ |
| 153750 | + -1, /* (174) term ::= STRING */ |
| 153751 | + -1, /* (175) term ::= INTEGER */ |
| 153752 | + -1, /* (176) expr ::= VARIABLE */ |
| 153753 | + -3, /* (177) expr ::= expr COLLATE ID|STRING */ |
| 153754 | + -6, /* (178) expr ::= CAST LP expr AS typetoken RP */ |
| 153755 | + -5, /* (179) expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 153756 | + -4, /* (180) expr ::= ID|INDEXED LP STAR RP */ |
| 153757 | + -6, /* (181) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ |
| 153758 | + -5, /* (182) expr ::= ID|INDEXED LP STAR RP filter_over */ |
| 153759 | + -1, /* (183) term ::= CTIME_KW */ |
| 153760 | + -5, /* (184) expr ::= LP nexprlist COMMA expr RP */ |
| 153761 | + -3, /* (185) expr ::= expr AND expr */ |
| 153762 | + -3, /* (186) expr ::= expr OR expr */ |
| 153763 | + -3, /* (187) expr ::= expr LT|GT|GE|LE expr */ |
| 153764 | + -3, /* (188) expr ::= expr EQ|NE expr */ |
| 153765 | + -3, /* (189) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ |
| 153766 | + -3, /* (190) expr ::= expr PLUS|MINUS expr */ |
| 153767 | + -3, /* (191) expr ::= expr STAR|SLASH|REM expr */ |
| 153768 | + -3, /* (192) expr ::= expr CONCAT expr */ |
| 153769 | + -2, /* (193) likeop ::= NOT LIKE_KW|MATCH */ |
| 153770 | + -3, /* (194) expr ::= expr likeop expr */ |
| 153771 | + -5, /* (195) expr ::= expr likeop expr ESCAPE expr */ |
| 153772 | + -2, /* (196) expr ::= expr ISNULL|NOTNULL */ |
| 153773 | + -3, /* (197) expr ::= expr NOT NULL */ |
| 153774 | + -3, /* (198) expr ::= expr IS expr */ |
| 153775 | + -4, /* (199) expr ::= expr IS NOT expr */ |
| 153776 | + -2, /* (200) expr ::= NOT expr */ |
| 153777 | + -2, /* (201) expr ::= BITNOT expr */ |
| 153778 | + -2, /* (202) expr ::= PLUS|MINUS expr */ |
| 153779 | + -1, /* (203) between_op ::= BETWEEN */ |
| 153780 | + -2, /* (204) between_op ::= NOT BETWEEN */ |
| 153781 | + -5, /* (205) expr ::= expr between_op expr AND expr */ |
| 153782 | + -1, /* (206) in_op ::= IN */ |
| 153783 | + -2, /* (207) in_op ::= NOT IN */ |
| 153784 | + -5, /* (208) expr ::= expr in_op LP exprlist RP */ |
| 153785 | + -3, /* (209) expr ::= LP select RP */ |
| 153786 | + -5, /* (210) expr ::= expr in_op LP select RP */ |
| 153787 | + -5, /* (211) expr ::= expr in_op nm dbnm paren_exprlist */ |
| 153788 | + -4, /* (212) expr ::= EXISTS LP select RP */ |
| 153789 | + -5, /* (213) expr ::= CASE case_operand case_exprlist case_else END */ |
| 153790 | + -5, /* (214) case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 153791 | + -4, /* (215) case_exprlist ::= WHEN expr THEN expr */ |
| 153792 | + -2, /* (216) case_else ::= ELSE expr */ |
| 153793 | + 0, /* (217) case_else ::= */ |
| 153794 | + -1, /* (218) case_operand ::= expr */ |
| 153795 | + 0, /* (219) case_operand ::= */ |
| 153796 | + 0, /* (220) exprlist ::= */ |
| 153797 | + -3, /* (221) nexprlist ::= nexprlist COMMA expr */ |
| 153798 | + -1, /* (222) nexprlist ::= expr */ |
| 153799 | + 0, /* (223) paren_exprlist ::= */ |
| 153800 | + -3, /* (224) paren_exprlist ::= LP exprlist RP */ |
| 153801 | + -12, /* (225) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 153802 | + -1, /* (226) uniqueflag ::= UNIQUE */ |
| 153803 | + 0, /* (227) uniqueflag ::= */ |
| 153804 | + 0, /* (228) eidlist_opt ::= */ |
| 153805 | + -3, /* (229) eidlist_opt ::= LP eidlist RP */ |
| 153806 | + -5, /* (230) eidlist ::= eidlist COMMA nm collate sortorder */ |
| 153807 | + -3, /* (231) eidlist ::= nm collate sortorder */ |
| 153808 | + 0, /* (232) collate ::= */ |
| 153809 | + -2, /* (233) collate ::= COLLATE ID|STRING */ |
| 153810 | + -4, /* (234) cmd ::= DROP INDEX ifexists fullname */ |
| 153811 | + -2, /* (235) cmd ::= VACUUM vinto */ |
| 153812 | + -3, /* (236) cmd ::= VACUUM nm vinto */ |
| 153813 | + -2, /* (237) vinto ::= INTO expr */ |
| 153814 | + 0, /* (238) vinto ::= */ |
| 153815 | + -3, /* (239) cmd ::= PRAGMA nm dbnm */ |
| 153816 | + -5, /* (240) cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 153817 | + -6, /* (241) cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 153818 | + -5, /* (242) cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 153819 | + -6, /* (243) cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 153820 | + -2, /* (244) plus_num ::= PLUS INTEGER|FLOAT */ |
| 153821 | + -2, /* (245) minus_num ::= MINUS INTEGER|FLOAT */ |
| 153822 | + -5, /* (246) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 153823 | + -11, /* (247) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 153824 | + -1, /* (248) trigger_time ::= BEFORE|AFTER */ |
| 153825 | + -2, /* (249) trigger_time ::= INSTEAD OF */ |
| 153826 | + 0, /* (250) trigger_time ::= */ |
| 153827 | + -1, /* (251) trigger_event ::= DELETE|INSERT */ |
| 153828 | + -1, /* (252) trigger_event ::= UPDATE */ |
| 153829 | + -3, /* (253) trigger_event ::= UPDATE OF idlist */ |
| 153830 | + 0, /* (254) when_clause ::= */ |
| 153831 | + -2, /* (255) when_clause ::= WHEN expr */ |
| 153832 | + -3, /* (256) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 153833 | + -2, /* (257) trigger_cmd_list ::= trigger_cmd SEMI */ |
| 153834 | + -3, /* (258) trnm ::= nm DOT nm */ |
| 153835 | + -3, /* (259) tridxby ::= INDEXED BY nm */ |
| 153836 | + -2, /* (260) tridxby ::= NOT INDEXED */ |
| 153837 | + -8, /* (261) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ |
| 153838 | + -8, /* (262) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 153839 | + -6, /* (263) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 153840 | + -3, /* (264) trigger_cmd ::= scanpt select scanpt */ |
| 153841 | + -4, /* (265) expr ::= RAISE LP IGNORE RP */ |
| 153842 | + -6, /* (266) expr ::= RAISE LP raisetype COMMA nm RP */ |
| 153843 | + -1, /* (267) raisetype ::= ROLLBACK */ |
| 153844 | + -1, /* (268) raisetype ::= ABORT */ |
| 153845 | + -1, /* (269) raisetype ::= FAIL */ |
| 153846 | + -4, /* (270) cmd ::= DROP TRIGGER ifexists fullname */ |
| 153847 | + -6, /* (271) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 153848 | + -3, /* (272) cmd ::= DETACH database_kw_opt expr */ |
| 153849 | + 0, /* (273) key_opt ::= */ |
| 153850 | + -2, /* (274) key_opt ::= KEY expr */ |
| 153851 | + -1, /* (275) cmd ::= REINDEX */ |
| 153852 | + -3, /* (276) cmd ::= REINDEX nm dbnm */ |
| 153853 | + -1, /* (277) cmd ::= ANALYZE */ |
| 153854 | + -3, /* (278) cmd ::= ANALYZE nm dbnm */ |
| 153855 | + -6, /* (279) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 153856 | + -7, /* (280) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 153857 | + -1, /* (281) add_column_fullname ::= fullname */ |
| 153858 | + -8, /* (282) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 153859 | + -1, /* (283) cmd ::= create_vtab */ |
| 153860 | + -4, /* (284) cmd ::= create_vtab LP vtabarglist RP */ |
| 153861 | + -8, /* (285) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 153862 | + 0, /* (286) vtabarg ::= */ |
| 153863 | + -1, /* (287) vtabargtoken ::= ANY */ |
| 153864 | + -3, /* (288) vtabargtoken ::= lp anylist RP */ |
| 153865 | + -1, /* (289) lp ::= LP */ |
| 153866 | + -2, /* (290) with ::= WITH wqlist */ |
| 153867 | + -3, /* (291) with ::= WITH RECURSIVE wqlist */ |
| 153868 | + -6, /* (292) wqlist ::= nm eidlist_opt AS LP select RP */ |
| 153869 | + -8, /* (293) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 153870 | + -1, /* (294) windowdefn_list ::= windowdefn */ |
| 153871 | + -3, /* (295) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 153872 | + -5, /* (296) windowdefn ::= nm AS LP window RP */ |
| 153873 | + -5, /* (297) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 153874 | + -6, /* (298) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 153875 | + -4, /* (299) window ::= ORDER BY sortlist frame_opt */ |
| 153876 | + -5, /* (300) window ::= nm ORDER BY sortlist frame_opt */ |
| 153877 | + -1, /* (301) window ::= frame_opt */ |
| 153878 | + -2, /* (302) window ::= nm frame_opt */ |
| 153879 | + 0, /* (303) frame_opt ::= */ |
| 153880 | + -3, /* (304) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 153881 | + -6, /* (305) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 153882 | + -1, /* (306) range_or_rows ::= RANGE|ROWS|GROUPS */ |
| 153883 | + -1, /* (307) frame_bound_s ::= frame_bound */ |
| 153884 | + -2, /* (308) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 153885 | + -1, /* (309) frame_bound_e ::= frame_bound */ |
| 153886 | + -2, /* (310) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 153887 | + -2, /* (311) frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 153888 | + -2, /* (312) frame_bound ::= CURRENT ROW */ |
| 153889 | + 0, /* (313) frame_exclude_opt ::= */ |
| 153890 | + -2, /* (314) frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 153891 | + -2, /* (315) frame_exclude ::= NO OTHERS */ |
| 153892 | + -2, /* (316) frame_exclude ::= CURRENT ROW */ |
| 153893 | + -1, /* (317) frame_exclude ::= GROUP|TIES */ |
| 153894 | + -2, /* (318) window_clause ::= WINDOW windowdefn_list */ |
| 153895 | + -2, /* (319) filter_over ::= filter_clause over_clause */ |
| 153896 | + -1, /* (320) filter_over ::= over_clause */ |
| 153897 | + -1, /* (321) filter_over ::= filter_clause */ |
| 153898 | + -4, /* (322) over_clause ::= OVER LP window RP */ |
| 153899 | + -2, /* (323) over_clause ::= OVER nm */ |
| 153900 | + -5, /* (324) filter_clause ::= FILTER LP WHERE expr RP */ |
| 153901 | + -1, /* (325) input ::= cmdlist */ |
| 153902 | + -2, /* (326) cmdlist ::= cmdlist ecmd */ |
| 153903 | + -1, /* (327) cmdlist ::= ecmd */ |
| 153904 | + -1, /* (328) ecmd ::= SEMI */ |
| 153905 | + -2, /* (329) ecmd ::= cmdx SEMI */ |
| 153906 | + -2, /* (330) ecmd ::= explain cmdx */ |
| 153907 | + 0, /* (331) trans_opt ::= */ |
| 153908 | + -1, /* (332) trans_opt ::= TRANSACTION */ |
| 153909 | + -2, /* (333) trans_opt ::= TRANSACTION nm */ |
| 153910 | + -1, /* (334) savepoint_opt ::= SAVEPOINT */ |
| 153911 | + 0, /* (335) savepoint_opt ::= */ |
| 153912 | + -2, /* (336) cmd ::= create_table create_table_args */ |
| 153913 | + -4, /* (337) columnlist ::= columnlist COMMA columnname carglist */ |
| 153914 | + -2, /* (338) columnlist ::= columnname carglist */ |
| 153915 | + -1, /* (339) nm ::= ID|INDEXED */ |
| 153916 | + -1, /* (340) nm ::= STRING */ |
| 153917 | + -1, /* (341) nm ::= JOIN_KW */ |
| 153918 | + -1, /* (342) typetoken ::= typename */ |
| 153919 | + -1, /* (343) typename ::= ID|STRING */ |
| 153920 | + -1, /* (344) signed ::= plus_num */ |
| 153921 | + -1, /* (345) signed ::= minus_num */ |
| 153922 | + -2, /* (346) carglist ::= carglist ccons */ |
| 153923 | + 0, /* (347) carglist ::= */ |
| 153924 | + -2, /* (348) ccons ::= NULL onconf */ |
| 153925 | + -4, /* (349) ccons ::= GENERATED ALWAYS AS generated */ |
| 153926 | + -2, /* (350) ccons ::= AS generated */ |
| 153927 | + -2, /* (351) conslist_opt ::= COMMA conslist */ |
| 153928 | + -3, /* (352) conslist ::= conslist tconscomma tcons */ |
| 153929 | + -1, /* (353) conslist ::= tcons */ |
| 153930 | + 0, /* (354) tconscomma ::= */ |
| 153931 | + -1, /* (355) defer_subclause_opt ::= defer_subclause */ |
| 153932 | + -1, /* (356) resolvetype ::= raisetype */ |
| 153933 | + -1, /* (357) selectnowith ::= oneselect */ |
| 153934 | + -1, /* (358) oneselect ::= values */ |
| 153935 | + -2, /* (359) sclp ::= selcollist COMMA */ |
| 153936 | + -1, /* (360) as ::= ID|STRING */ |
| 153937 | + -1, /* (361) expr ::= term */ |
| 153938 | + -1, /* (362) likeop ::= LIKE_KW|MATCH */ |
| 153939 | + -1, /* (363) exprlist ::= nexprlist */ |
| 153940 | + -1, /* (364) nmnum ::= plus_num */ |
| 153941 | + -1, /* (365) nmnum ::= nm */ |
| 153942 | + -1, /* (366) nmnum ::= ON */ |
| 153943 | + -1, /* (367) nmnum ::= DELETE */ |
| 153944 | + -1, /* (368) nmnum ::= DEFAULT */ |
| 153945 | + -1, /* (369) plus_num ::= INTEGER|FLOAT */ |
| 153946 | + 0, /* (370) foreach_clause ::= */ |
| 153947 | + -3, /* (371) foreach_clause ::= FOR EACH ROW */ |
| 153948 | + -1, /* (372) trnm ::= nm */ |
| 153949 | + 0, /* (373) tridxby ::= */ |
| 153950 | + -1, /* (374) database_kw_opt ::= DATABASE */ |
| 153951 | + 0, /* (375) database_kw_opt ::= */ |
| 153952 | + 0, /* (376) kwcolumn_opt ::= */ |
| 153953 | + -1, /* (377) kwcolumn_opt ::= COLUMNKW */ |
| 153954 | + -1, /* (378) vtabarglist ::= vtabarg */ |
| 153955 | + -3, /* (379) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 153956 | + -2, /* (380) vtabarg ::= vtabarg vtabargtoken */ |
| 153957 | + 0, /* (381) anylist ::= */ |
| 153958 | + -4, /* (382) anylist ::= anylist LP anylist RP */ |
| 153959 | + -2, /* (383) anylist ::= anylist ANY */ |
| 153960 | + 0, /* (384) with ::= */ |
| 152830 | 153961 | }; |
| 152831 | 153962 | |
| 152832 | 153963 | static void yy_accept(yyParser*); /* Forward Declaration */ |
| 152833 | 153964 | |
| 152834 | 153965 | /* |
| | @@ -152921,20 +154052,20 @@ |
| 152921 | 154052 | break; |
| 152922 | 154053 | case 2: /* cmdx ::= cmd */ |
| 152923 | 154054 | { sqlite3FinishCoding(pParse); } |
| 152924 | 154055 | break; |
| 152925 | 154056 | case 3: /* cmd ::= BEGIN transtype trans_opt */ |
| 152926 | | -{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy32);} |
| 154057 | +{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy192);} |
| 152927 | 154058 | break; |
| 152928 | 154059 | case 4: /* transtype ::= */ |
| 152929 | | -{yymsp[1].minor.yy32 = TK_DEFERRED;} |
| 154060 | +{yymsp[1].minor.yy192 = TK_DEFERRED;} |
| 152930 | 154061 | break; |
| 152931 | 154062 | case 5: /* transtype ::= DEFERRED */ |
| 152932 | 154063 | case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6); |
| 152933 | 154064 | case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7); |
| 152934 | | - case 304: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==304); |
| 152935 | | -{yymsp[0].minor.yy32 = yymsp[0].major; /*A-overwrites-X*/} |
| 154065 | + case 306: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==306); |
| 154066 | +{yymsp[0].minor.yy192 = yymsp[0].major; /*A-overwrites-X*/} |
| 152936 | 154067 | break; |
| 152937 | 154068 | case 8: /* cmd ::= COMMIT|END trans_opt */ |
| 152938 | 154069 | case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9); |
| 152939 | 154070 | {sqlite3EndTransaction(pParse,yymsp[-1].major);} |
| 152940 | 154071 | break; |
| | @@ -152953,61 +154084,61 @@ |
| 152953 | 154084 | sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0); |
| 152954 | 154085 | } |
| 152955 | 154086 | break; |
| 152956 | 154087 | case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ |
| 152957 | 154088 | { |
| 152958 | | - sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy32,0,0,yymsp[-2].minor.yy32); |
| 154089 | + sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy192,0,0,yymsp[-2].minor.yy192); |
| 152959 | 154090 | } |
| 152960 | 154091 | break; |
| 152961 | 154092 | case 14: /* createkw ::= CREATE */ |
| 152962 | 154093 | {disableLookaside(pParse);} |
| 152963 | 154094 | break; |
| 152964 | 154095 | case 15: /* ifnotexists ::= */ |
| 152965 | 154096 | case 18: /* temp ::= */ yytestcase(yyruleno==18); |
| 152966 | 154097 | case 21: /* table_options ::= */ yytestcase(yyruleno==21); |
| 152967 | | - case 43: /* autoinc ::= */ yytestcase(yyruleno==43); |
| 152968 | | - case 58: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==58); |
| 152969 | | - case 68: /* defer_subclause_opt ::= */ yytestcase(yyruleno==68); |
| 152970 | | - case 77: /* ifexists ::= */ yytestcase(yyruleno==77); |
| 152971 | | - case 94: /* distinct ::= */ yytestcase(yyruleno==94); |
| 152972 | | - case 230: /* collate ::= */ yytestcase(yyruleno==230); |
| 152973 | | -{yymsp[1].minor.yy32 = 0;} |
| 154098 | + case 45: /* autoinc ::= */ yytestcase(yyruleno==45); |
| 154099 | + case 60: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==60); |
| 154100 | + case 70: /* defer_subclause_opt ::= */ yytestcase(yyruleno==70); |
| 154101 | + case 79: /* ifexists ::= */ yytestcase(yyruleno==79); |
| 154102 | + case 96: /* distinct ::= */ yytestcase(yyruleno==96); |
| 154103 | + case 232: /* collate ::= */ yytestcase(yyruleno==232); |
| 154104 | +{yymsp[1].minor.yy192 = 0;} |
| 152974 | 154105 | break; |
| 152975 | 154106 | case 16: /* ifnotexists ::= IF NOT EXISTS */ |
| 152976 | | -{yymsp[-2].minor.yy32 = 1;} |
| 154107 | +{yymsp[-2].minor.yy192 = 1;} |
| 152977 | 154108 | break; |
| 152978 | 154109 | case 17: /* temp ::= TEMP */ |
| 152979 | | - case 44: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==44); |
| 152980 | | -{yymsp[0].minor.yy32 = 1;} |
| 154110 | + case 46: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==46); |
| 154111 | +{yymsp[0].minor.yy192 = 1;} |
| 152981 | 154112 | break; |
| 152982 | 154113 | case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */ |
| 152983 | 154114 | { |
| 152984 | | - sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy32,0); |
| 154115 | + sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy192,0); |
| 152985 | 154116 | } |
| 152986 | 154117 | break; |
| 152987 | 154118 | case 20: /* create_table_args ::= AS select */ |
| 152988 | 154119 | { |
| 152989 | | - sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy25); |
| 152990 | | - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy25); |
| 154120 | + sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy539); |
| 154121 | + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy539); |
| 152991 | 154122 | } |
| 152992 | 154123 | break; |
| 152993 | 154124 | case 22: /* table_options ::= WITHOUT nm */ |
| 152994 | 154125 | { |
| 152995 | 154126 | if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){ |
| 152996 | | - yymsp[-1].minor.yy32 = TF_WithoutRowid | TF_NoVisibleRowid; |
| 154127 | + yymsp[-1].minor.yy192 = TF_WithoutRowid | TF_NoVisibleRowid; |
| 152997 | 154128 | }else{ |
| 152998 | | - yymsp[-1].minor.yy32 = 0; |
| 154129 | + yymsp[-1].minor.yy192 = 0; |
| 152999 | 154130 | sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); |
| 153000 | 154131 | } |
| 153001 | 154132 | } |
| 153002 | 154133 | break; |
| 153003 | 154134 | case 23: /* columnname ::= nm typetoken */ |
| 153004 | 154135 | {sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);} |
| 153005 | 154136 | break; |
| 153006 | 154137 | case 24: /* typetoken ::= */ |
| 153007 | | - case 61: /* conslist_opt ::= */ yytestcase(yyruleno==61); |
| 153008 | | - case 100: /* as ::= */ yytestcase(yyruleno==100); |
| 154138 | + case 63: /* conslist_opt ::= */ yytestcase(yyruleno==63); |
| 154139 | + case 102: /* as ::= */ yytestcase(yyruleno==102); |
| 153009 | 154140 | {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;} |
| 153010 | 154141 | break; |
| 153011 | 154142 | case 25: /* typetoken ::= typename LP signed RP */ |
| 153012 | 154143 | { |
| 153013 | 154144 | yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z); |
| | @@ -153022,35 +154153,35 @@ |
| 153022 | 154153 | {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);} |
| 153023 | 154154 | break; |
| 153024 | 154155 | case 28: /* scanpt ::= */ |
| 153025 | 154156 | { |
| 153026 | 154157 | assert( yyLookahead!=YYNOCODE ); |
| 153027 | | - yymsp[1].minor.yy8 = yyLookaheadToken.z; |
| 154158 | + yymsp[1].minor.yy436 = yyLookaheadToken.z; |
| 153028 | 154159 | } |
| 153029 | 154160 | break; |
| 153030 | 154161 | case 29: /* scantok ::= */ |
| 153031 | 154162 | { |
| 153032 | 154163 | assert( yyLookahead!=YYNOCODE ); |
| 153033 | 154164 | yymsp[1].minor.yy0 = yyLookaheadToken; |
| 153034 | 154165 | } |
| 153035 | 154166 | break; |
| 153036 | 154167 | case 30: /* ccons ::= CONSTRAINT nm */ |
| 153037 | | - case 63: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==63); |
| 154168 | + case 65: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==65); |
| 153038 | 154169 | {pParse->constraintName = yymsp[0].minor.yy0;} |
| 153039 | 154170 | break; |
| 153040 | 154171 | case 31: /* ccons ::= DEFAULT scantok term */ |
| 153041 | | -{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy46,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} |
| 154172 | +{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy202,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} |
| 153042 | 154173 | break; |
| 153043 | 154174 | case 32: /* ccons ::= DEFAULT LP expr RP */ |
| 153044 | | -{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy46,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);} |
| 154175 | +{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy202,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);} |
| 153045 | 154176 | break; |
| 153046 | 154177 | case 33: /* ccons ::= DEFAULT PLUS scantok term */ |
| 153047 | | -{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy46,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} |
| 154178 | +{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy202,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} |
| 153048 | 154179 | break; |
| 153049 | 154180 | case 34: /* ccons ::= DEFAULT MINUS scantok term */ |
| 153050 | 154181 | { |
| 153051 | | - Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy46, 0); |
| 154182 | + Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy202, 0); |
| 153052 | 154183 | sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]); |
| 153053 | 154184 | } |
| 153054 | 154185 | break; |
| 153055 | 154186 | case 35: /* ccons ::= DEFAULT scantok ID|INDEXED */ |
| 153056 | 154187 | { |
| | @@ -153061,319 +154192,325 @@ |
| 153061 | 154192 | } |
| 153062 | 154193 | sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n); |
| 153063 | 154194 | } |
| 153064 | 154195 | break; |
| 153065 | 154196 | case 36: /* ccons ::= NOT NULL onconf */ |
| 153066 | | -{sqlite3AddNotNull(pParse, yymsp[0].minor.yy32);} |
| 154197 | +{sqlite3AddNotNull(pParse, yymsp[0].minor.yy192);} |
| 153067 | 154198 | break; |
| 153068 | 154199 | case 37: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ |
| 153069 | | -{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy32,yymsp[0].minor.yy32,yymsp[-2].minor.yy32);} |
| 154200 | +{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy192,yymsp[0].minor.yy192,yymsp[-2].minor.yy192);} |
| 153070 | 154201 | break; |
| 153071 | 154202 | case 38: /* ccons ::= UNIQUE onconf */ |
| 153072 | | -{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy32,0,0,0,0, |
| 154203 | +{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy192,0,0,0,0, |
| 153073 | 154204 | SQLITE_IDXTYPE_UNIQUE);} |
| 153074 | 154205 | break; |
| 153075 | 154206 | case 39: /* ccons ::= CHECK LP expr RP */ |
| 153076 | | -{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy46);} |
| 154207 | +{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy202);} |
| 153077 | 154208 | break; |
| 153078 | 154209 | case 40: /* ccons ::= REFERENCES nm eidlist_opt refargs */ |
| 153079 | | -{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy138,yymsp[0].minor.yy32);} |
| 154210 | +{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy242,yymsp[0].minor.yy192);} |
| 153080 | 154211 | break; |
| 153081 | 154212 | case 41: /* ccons ::= defer_subclause */ |
| 153082 | | -{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy32);} |
| 154213 | +{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy192);} |
| 153083 | 154214 | break; |
| 153084 | 154215 | case 42: /* ccons ::= COLLATE ID|STRING */ |
| 153085 | 154216 | {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);} |
| 153086 | 154217 | break; |
| 153087 | | - case 45: /* refargs ::= */ |
| 153088 | | -{ yymsp[1].minor.yy32 = OE_None*0x0101; /* EV: R-19803-45884 */} |
| 153089 | | - break; |
| 153090 | | - case 46: /* refargs ::= refargs refarg */ |
| 153091 | | -{ yymsp[-1].minor.yy32 = (yymsp[-1].minor.yy32 & ~yymsp[0].minor.yy495.mask) | yymsp[0].minor.yy495.value; } |
| 153092 | | - break; |
| 153093 | | - case 47: /* refarg ::= MATCH nm */ |
| 153094 | | -{ yymsp[-1].minor.yy495.value = 0; yymsp[-1].minor.yy495.mask = 0x000000; } |
| 153095 | | - break; |
| 153096 | | - case 48: /* refarg ::= ON INSERT refact */ |
| 153097 | | -{ yymsp[-2].minor.yy495.value = 0; yymsp[-2].minor.yy495.mask = 0x000000; } |
| 153098 | | - break; |
| 153099 | | - case 49: /* refarg ::= ON DELETE refact */ |
| 153100 | | -{ yymsp[-2].minor.yy495.value = yymsp[0].minor.yy32; yymsp[-2].minor.yy495.mask = 0x0000ff; } |
| 153101 | | - break; |
| 153102 | | - case 50: /* refarg ::= ON UPDATE refact */ |
| 153103 | | -{ yymsp[-2].minor.yy495.value = yymsp[0].minor.yy32<<8; yymsp[-2].minor.yy495.mask = 0x00ff00; } |
| 153104 | | - break; |
| 153105 | | - case 51: /* refact ::= SET NULL */ |
| 153106 | | -{ yymsp[-1].minor.yy32 = OE_SetNull; /* EV: R-33326-45252 */} |
| 153107 | | - break; |
| 153108 | | - case 52: /* refact ::= SET DEFAULT */ |
| 153109 | | -{ yymsp[-1].minor.yy32 = OE_SetDflt; /* EV: R-33326-45252 */} |
| 153110 | | - break; |
| 153111 | | - case 53: /* refact ::= CASCADE */ |
| 153112 | | -{ yymsp[0].minor.yy32 = OE_Cascade; /* EV: R-33326-45252 */} |
| 153113 | | - break; |
| 153114 | | - case 54: /* refact ::= RESTRICT */ |
| 153115 | | -{ yymsp[0].minor.yy32 = OE_Restrict; /* EV: R-33326-45252 */} |
| 153116 | | - break; |
| 153117 | | - case 55: /* refact ::= NO ACTION */ |
| 153118 | | -{ yymsp[-1].minor.yy32 = OE_None; /* EV: R-33326-45252 */} |
| 153119 | | - break; |
| 153120 | | - case 56: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ |
| 153121 | | -{yymsp[-2].minor.yy32 = 0;} |
| 153122 | | - break; |
| 153123 | | - case 57: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ |
| 153124 | | - case 72: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==72); |
| 153125 | | - case 160: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==160); |
| 153126 | | -{yymsp[-1].minor.yy32 = yymsp[0].minor.yy32;} |
| 153127 | | - break; |
| 153128 | | - case 59: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ |
| 153129 | | - case 76: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==76); |
| 153130 | | - case 202: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==202); |
| 153131 | | - case 205: /* in_op ::= NOT IN */ yytestcase(yyruleno==205); |
| 153132 | | - case 231: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==231); |
| 153133 | | -{yymsp[-1].minor.yy32 = 1;} |
| 153134 | | - break; |
| 153135 | | - case 60: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ |
| 153136 | | -{yymsp[-1].minor.yy32 = 0;} |
| 153137 | | - break; |
| 153138 | | - case 62: /* tconscomma ::= COMMA */ |
| 153139 | | -{pParse->constraintName.n = 0;} |
| 153140 | | - break; |
| 153141 | | - case 64: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ |
| 153142 | | -{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy138,yymsp[0].minor.yy32,yymsp[-2].minor.yy32,0);} |
| 153143 | | - break; |
| 153144 | | - case 65: /* tcons ::= UNIQUE LP sortlist RP onconf */ |
| 153145 | | -{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy138,yymsp[0].minor.yy32,0,0,0,0, |
| 153146 | | - SQLITE_IDXTYPE_UNIQUE);} |
| 153147 | | - break; |
| 153148 | | - case 66: /* tcons ::= CHECK LP expr RP onconf */ |
| 153149 | | -{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy46);} |
| 153150 | | - break; |
| 153151 | | - case 67: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ |
| 153152 | | -{ |
| 153153 | | - sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy138, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy138, yymsp[-1].minor.yy32); |
| 153154 | | - sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy32); |
| 153155 | | -} |
| 153156 | | - break; |
| 153157 | | - case 69: /* onconf ::= */ |
| 153158 | | - case 71: /* orconf ::= */ yytestcase(yyruleno==71); |
| 153159 | | -{yymsp[1].minor.yy32 = OE_Default;} |
| 153160 | | - break; |
| 153161 | | - case 70: /* onconf ::= ON CONFLICT resolvetype */ |
| 153162 | | -{yymsp[-2].minor.yy32 = yymsp[0].minor.yy32;} |
| 153163 | | - break; |
| 153164 | | - case 73: /* resolvetype ::= IGNORE */ |
| 153165 | | -{yymsp[0].minor.yy32 = OE_Ignore;} |
| 153166 | | - break; |
| 153167 | | - case 74: /* resolvetype ::= REPLACE */ |
| 153168 | | - case 161: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==161); |
| 153169 | | -{yymsp[0].minor.yy32 = OE_Replace;} |
| 153170 | | - break; |
| 153171 | | - case 75: /* cmd ::= DROP TABLE ifexists fullname */ |
| 153172 | | -{ |
| 153173 | | - sqlite3DropTable(pParse, yymsp[0].minor.yy609, 0, yymsp[-1].minor.yy32); |
| 153174 | | -} |
| 153175 | | - break; |
| 153176 | | - case 78: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ |
| 153177 | | -{ |
| 153178 | | - sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy138, yymsp[0].minor.yy25, yymsp[-7].minor.yy32, yymsp[-5].minor.yy32); |
| 153179 | | -} |
| 153180 | | - break; |
| 153181 | | - case 79: /* cmd ::= DROP VIEW ifexists fullname */ |
| 153182 | | -{ |
| 153183 | | - sqlite3DropTable(pParse, yymsp[0].minor.yy609, 1, yymsp[-1].minor.yy32); |
| 153184 | | -} |
| 153185 | | - break; |
| 153186 | | - case 80: /* cmd ::= select */ |
| 153187 | | -{ |
| 153188 | | - SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0}; |
| 153189 | | - sqlite3Select(pParse, yymsp[0].minor.yy25, &dest); |
| 153190 | | - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy25); |
| 153191 | | -} |
| 153192 | | - break; |
| 153193 | | - case 81: /* select ::= WITH wqlist selectnowith */ |
| 153194 | | -{ |
| 153195 | | - Select *p = yymsp[0].minor.yy25; |
| 153196 | | - if( p ){ |
| 153197 | | - p->pWith = yymsp[-1].minor.yy297; |
| 153198 | | - parserDoubleLinkSelect(pParse, p); |
| 153199 | | - }else{ |
| 153200 | | - sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy297); |
| 153201 | | - } |
| 153202 | | - yymsp[-2].minor.yy25 = p; |
| 153203 | | -} |
| 153204 | | - break; |
| 153205 | | - case 82: /* select ::= WITH RECURSIVE wqlist selectnowith */ |
| 153206 | | -{ |
| 153207 | | - Select *p = yymsp[0].minor.yy25; |
| 153208 | | - if( p ){ |
| 153209 | | - p->pWith = yymsp[-1].minor.yy297; |
| 153210 | | - parserDoubleLinkSelect(pParse, p); |
| 153211 | | - }else{ |
| 153212 | | - sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy297); |
| 153213 | | - } |
| 153214 | | - yymsp[-3].minor.yy25 = p; |
| 153215 | | -} |
| 153216 | | - break; |
| 153217 | | - case 83: /* select ::= selectnowith */ |
| 153218 | | -{ |
| 153219 | | - Select *p = yymsp[0].minor.yy25; |
| 153220 | | - if( p ){ |
| 153221 | | - parserDoubleLinkSelect(pParse, p); |
| 153222 | | - } |
| 153223 | | - yymsp[0].minor.yy25 = p; /*A-overwrites-X*/ |
| 153224 | | -} |
| 153225 | | - break; |
| 153226 | | - case 84: /* selectnowith ::= selectnowith multiselect_op oneselect */ |
| 153227 | | -{ |
| 153228 | | - Select *pRhs = yymsp[0].minor.yy25; |
| 153229 | | - Select *pLhs = yymsp[-2].minor.yy25; |
| 154218 | + case 43: /* generated ::= LP expr RP */ |
| 154219 | +{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy202,0);} |
| 154220 | + break; |
| 154221 | + case 44: /* generated ::= LP expr RP ID */ |
| 154222 | +{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy202,&yymsp[0].minor.yy0);} |
| 154223 | + break; |
| 154224 | + case 47: /* refargs ::= */ |
| 154225 | +{ yymsp[1].minor.yy192 = OE_None*0x0101; /* EV: R-19803-45884 */} |
| 154226 | + break; |
| 154227 | + case 48: /* refargs ::= refargs refarg */ |
| 154228 | +{ yymsp[-1].minor.yy192 = (yymsp[-1].minor.yy192 & ~yymsp[0].minor.yy207.mask) | yymsp[0].minor.yy207.value; } |
| 154229 | + break; |
| 154230 | + case 49: /* refarg ::= MATCH nm */ |
| 154231 | +{ yymsp[-1].minor.yy207.value = 0; yymsp[-1].minor.yy207.mask = 0x000000; } |
| 154232 | + break; |
| 154233 | + case 50: /* refarg ::= ON INSERT refact */ |
| 154234 | +{ yymsp[-2].minor.yy207.value = 0; yymsp[-2].minor.yy207.mask = 0x000000; } |
| 154235 | + break; |
| 154236 | + case 51: /* refarg ::= ON DELETE refact */ |
| 154237 | +{ yymsp[-2].minor.yy207.value = yymsp[0].minor.yy192; yymsp[-2].minor.yy207.mask = 0x0000ff; } |
| 154238 | + break; |
| 154239 | + case 52: /* refarg ::= ON UPDATE refact */ |
| 154240 | +{ yymsp[-2].minor.yy207.value = yymsp[0].minor.yy192<<8; yymsp[-2].minor.yy207.mask = 0x00ff00; } |
| 154241 | + break; |
| 154242 | + case 53: /* refact ::= SET NULL */ |
| 154243 | +{ yymsp[-1].minor.yy192 = OE_SetNull; /* EV: R-33326-45252 */} |
| 154244 | + break; |
| 154245 | + case 54: /* refact ::= SET DEFAULT */ |
| 154246 | +{ yymsp[-1].minor.yy192 = OE_SetDflt; /* EV: R-33326-45252 */} |
| 154247 | + break; |
| 154248 | + case 55: /* refact ::= CASCADE */ |
| 154249 | +{ yymsp[0].minor.yy192 = OE_Cascade; /* EV: R-33326-45252 */} |
| 154250 | + break; |
| 154251 | + case 56: /* refact ::= RESTRICT */ |
| 154252 | +{ yymsp[0].minor.yy192 = OE_Restrict; /* EV: R-33326-45252 */} |
| 154253 | + break; |
| 154254 | + case 57: /* refact ::= NO ACTION */ |
| 154255 | +{ yymsp[-1].minor.yy192 = OE_None; /* EV: R-33326-45252 */} |
| 154256 | + break; |
| 154257 | + case 58: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ |
| 154258 | +{yymsp[-2].minor.yy192 = 0;} |
| 154259 | + break; |
| 154260 | + case 59: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ |
| 154261 | + case 74: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==74); |
| 154262 | + case 162: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==162); |
| 154263 | +{yymsp[-1].minor.yy192 = yymsp[0].minor.yy192;} |
| 154264 | + break; |
| 154265 | + case 61: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ |
| 154266 | + case 78: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==78); |
| 154267 | + case 204: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==204); |
| 154268 | + case 207: /* in_op ::= NOT IN */ yytestcase(yyruleno==207); |
| 154269 | + case 233: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==233); |
| 154270 | +{yymsp[-1].minor.yy192 = 1;} |
| 154271 | + break; |
| 154272 | + case 62: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ |
| 154273 | +{yymsp[-1].minor.yy192 = 0;} |
| 154274 | + break; |
| 154275 | + case 64: /* tconscomma ::= COMMA */ |
| 154276 | +{pParse->constraintName.n = 0;} |
| 154277 | + break; |
| 154278 | + case 66: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ |
| 154279 | +{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy242,yymsp[0].minor.yy192,yymsp[-2].minor.yy192,0);} |
| 154280 | + break; |
| 154281 | + case 67: /* tcons ::= UNIQUE LP sortlist RP onconf */ |
| 154282 | +{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy242,yymsp[0].minor.yy192,0,0,0,0, |
| 154283 | + SQLITE_IDXTYPE_UNIQUE);} |
| 154284 | + break; |
| 154285 | + case 68: /* tcons ::= CHECK LP expr RP onconf */ |
| 154286 | +{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy202);} |
| 154287 | + break; |
| 154288 | + case 69: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ |
| 154289 | +{ |
| 154290 | + sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy242, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy242, yymsp[-1].minor.yy192); |
| 154291 | + sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy192); |
| 154292 | +} |
| 154293 | + break; |
| 154294 | + case 71: /* onconf ::= */ |
| 154295 | + case 73: /* orconf ::= */ yytestcase(yyruleno==73); |
| 154296 | +{yymsp[1].minor.yy192 = OE_Default;} |
| 154297 | + break; |
| 154298 | + case 72: /* onconf ::= ON CONFLICT resolvetype */ |
| 154299 | +{yymsp[-2].minor.yy192 = yymsp[0].minor.yy192;} |
| 154300 | + break; |
| 154301 | + case 75: /* resolvetype ::= IGNORE */ |
| 154302 | +{yymsp[0].minor.yy192 = OE_Ignore;} |
| 154303 | + break; |
| 154304 | + case 76: /* resolvetype ::= REPLACE */ |
| 154305 | + case 163: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==163); |
| 154306 | +{yymsp[0].minor.yy192 = OE_Replace;} |
| 154307 | + break; |
| 154308 | + case 77: /* cmd ::= DROP TABLE ifexists fullname */ |
| 154309 | +{ |
| 154310 | + sqlite3DropTable(pParse, yymsp[0].minor.yy47, 0, yymsp[-1].minor.yy192); |
| 154311 | +} |
| 154312 | + break; |
| 154313 | + case 80: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ |
| 154314 | +{ |
| 154315 | + sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy242, yymsp[0].minor.yy539, yymsp[-7].minor.yy192, yymsp[-5].minor.yy192); |
| 154316 | +} |
| 154317 | + break; |
| 154318 | + case 81: /* cmd ::= DROP VIEW ifexists fullname */ |
| 154319 | +{ |
| 154320 | + sqlite3DropTable(pParse, yymsp[0].minor.yy47, 1, yymsp[-1].minor.yy192); |
| 154321 | +} |
| 154322 | + break; |
| 154323 | + case 82: /* cmd ::= select */ |
| 154324 | +{ |
| 154325 | + SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0}; |
| 154326 | + sqlite3Select(pParse, yymsp[0].minor.yy539, &dest); |
| 154327 | + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy539); |
| 154328 | +} |
| 154329 | + break; |
| 154330 | + case 83: /* select ::= WITH wqlist selectnowith */ |
| 154331 | +{ |
| 154332 | + Select *p = yymsp[0].minor.yy539; |
| 154333 | + if( p ){ |
| 154334 | + p->pWith = yymsp[-1].minor.yy131; |
| 154335 | + parserDoubleLinkSelect(pParse, p); |
| 154336 | + }else{ |
| 154337 | + sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy131); |
| 154338 | + } |
| 154339 | + yymsp[-2].minor.yy539 = p; |
| 154340 | +} |
| 154341 | + break; |
| 154342 | + case 84: /* select ::= WITH RECURSIVE wqlist selectnowith */ |
| 154343 | +{ |
| 154344 | + Select *p = yymsp[0].minor.yy539; |
| 154345 | + if( p ){ |
| 154346 | + p->pWith = yymsp[-1].minor.yy131; |
| 154347 | + parserDoubleLinkSelect(pParse, p); |
| 154348 | + }else{ |
| 154349 | + sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy131); |
| 154350 | + } |
| 154351 | + yymsp[-3].minor.yy539 = p; |
| 154352 | +} |
| 154353 | + break; |
| 154354 | + case 85: /* select ::= selectnowith */ |
| 154355 | +{ |
| 154356 | + Select *p = yymsp[0].minor.yy539; |
| 154357 | + if( p ){ |
| 154358 | + parserDoubleLinkSelect(pParse, p); |
| 154359 | + } |
| 154360 | + yymsp[0].minor.yy539 = p; /*A-overwrites-X*/ |
| 154361 | +} |
| 154362 | + break; |
| 154363 | + case 86: /* selectnowith ::= selectnowith multiselect_op oneselect */ |
| 154364 | +{ |
| 154365 | + Select *pRhs = yymsp[0].minor.yy539; |
| 154366 | + Select *pLhs = yymsp[-2].minor.yy539; |
| 153230 | 154367 | if( pRhs && pRhs->pPrior ){ |
| 153231 | 154368 | SrcList *pFrom; |
| 153232 | 154369 | Token x; |
| 153233 | 154370 | x.n = 0; |
| 153234 | 154371 | parserDoubleLinkSelect(pParse, pRhs); |
| 153235 | 154372 | pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0); |
| 153236 | 154373 | pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0); |
| 153237 | 154374 | } |
| 153238 | 154375 | if( pRhs ){ |
| 153239 | | - pRhs->op = (u8)yymsp[-1].minor.yy32; |
| 154376 | + pRhs->op = (u8)yymsp[-1].minor.yy192; |
| 153240 | 154377 | pRhs->pPrior = pLhs; |
| 153241 | 154378 | if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue; |
| 153242 | 154379 | pRhs->selFlags &= ~SF_MultiValue; |
| 153243 | | - if( yymsp[-1].minor.yy32!=TK_ALL ) pParse->hasCompound = 1; |
| 154380 | + if( yymsp[-1].minor.yy192!=TK_ALL ) pParse->hasCompound = 1; |
| 153244 | 154381 | }else{ |
| 153245 | 154382 | sqlite3SelectDelete(pParse->db, pLhs); |
| 153246 | 154383 | } |
| 153247 | | - yymsp[-2].minor.yy25 = pRhs; |
| 153248 | | -} |
| 153249 | | - break; |
| 153250 | | - case 85: /* multiselect_op ::= UNION */ |
| 153251 | | - case 87: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==87); |
| 153252 | | -{yymsp[0].minor.yy32 = yymsp[0].major; /*A-overwrites-OP*/} |
| 153253 | | - break; |
| 153254 | | - case 86: /* multiselect_op ::= UNION ALL */ |
| 153255 | | -{yymsp[-1].minor.yy32 = TK_ALL;} |
| 153256 | | - break; |
| 153257 | | - case 88: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ |
| 153258 | | -{ |
| 153259 | | - yymsp[-8].minor.yy25 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy138,yymsp[-5].minor.yy609,yymsp[-4].minor.yy46,yymsp[-3].minor.yy138,yymsp[-2].minor.yy46,yymsp[-1].minor.yy138,yymsp[-7].minor.yy32,yymsp[0].minor.yy46); |
| 153260 | | -} |
| 153261 | | - break; |
| 153262 | | - case 89: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ |
| 153263 | | -{ |
| 153264 | | - yymsp[-9].minor.yy25 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy138,yymsp[-6].minor.yy609,yymsp[-5].minor.yy46,yymsp[-4].minor.yy138,yymsp[-3].minor.yy46,yymsp[-1].minor.yy138,yymsp[-8].minor.yy32,yymsp[0].minor.yy46); |
| 153265 | | - if( yymsp[-9].minor.yy25 ){ |
| 153266 | | - yymsp[-9].minor.yy25->pWinDefn = yymsp[-2].minor.yy455; |
| 153267 | | - }else{ |
| 153268 | | - sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy455); |
| 153269 | | - } |
| 153270 | | -} |
| 153271 | | - break; |
| 153272 | | - case 90: /* values ::= VALUES LP nexprlist RP */ |
| 153273 | | -{ |
| 153274 | | - yymsp[-3].minor.yy25 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy138,0,0,0,0,0,SF_Values,0); |
| 153275 | | -} |
| 153276 | | - break; |
| 153277 | | - case 91: /* values ::= values COMMA LP nexprlist RP */ |
| 153278 | | -{ |
| 153279 | | - Select *pRight, *pLeft = yymsp[-4].minor.yy25; |
| 153280 | | - pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy138,0,0,0,0,0,SF_Values|SF_MultiValue,0); |
| 154384 | + yymsp[-2].minor.yy539 = pRhs; |
| 154385 | +} |
| 154386 | + break; |
| 154387 | + case 87: /* multiselect_op ::= UNION */ |
| 154388 | + case 89: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==89); |
| 154389 | +{yymsp[0].minor.yy192 = yymsp[0].major; /*A-overwrites-OP*/} |
| 154390 | + break; |
| 154391 | + case 88: /* multiselect_op ::= UNION ALL */ |
| 154392 | +{yymsp[-1].minor.yy192 = TK_ALL;} |
| 154393 | + break; |
| 154394 | + case 90: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ |
| 154395 | +{ |
| 154396 | + yymsp[-8].minor.yy539 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy242,yymsp[-5].minor.yy47,yymsp[-4].minor.yy202,yymsp[-3].minor.yy242,yymsp[-2].minor.yy202,yymsp[-1].minor.yy242,yymsp[-7].minor.yy192,yymsp[0].minor.yy202); |
| 154397 | +} |
| 154398 | + break; |
| 154399 | + case 91: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ |
| 154400 | +{ |
| 154401 | + yymsp[-9].minor.yy539 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy242,yymsp[-6].minor.yy47,yymsp[-5].minor.yy202,yymsp[-4].minor.yy242,yymsp[-3].minor.yy202,yymsp[-1].minor.yy242,yymsp[-8].minor.yy192,yymsp[0].minor.yy202); |
| 154402 | + if( yymsp[-9].minor.yy539 ){ |
| 154403 | + yymsp[-9].minor.yy539->pWinDefn = yymsp[-2].minor.yy303; |
| 154404 | + }else{ |
| 154405 | + sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy303); |
| 154406 | + } |
| 154407 | +} |
| 154408 | + break; |
| 154409 | + case 92: /* values ::= VALUES LP nexprlist RP */ |
| 154410 | +{ |
| 154411 | + yymsp[-3].minor.yy539 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy242,0,0,0,0,0,SF_Values,0); |
| 154412 | +} |
| 154413 | + break; |
| 154414 | + case 93: /* values ::= values COMMA LP nexprlist RP */ |
| 154415 | +{ |
| 154416 | + Select *pRight, *pLeft = yymsp[-4].minor.yy539; |
| 154417 | + pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy242,0,0,0,0,0,SF_Values|SF_MultiValue,0); |
| 153281 | 154418 | if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue; |
| 153282 | 154419 | if( pRight ){ |
| 153283 | 154420 | pRight->op = TK_ALL; |
| 153284 | 154421 | pRight->pPrior = pLeft; |
| 153285 | | - yymsp[-4].minor.yy25 = pRight; |
| 153286 | | - }else{ |
| 153287 | | - yymsp[-4].minor.yy25 = pLeft; |
| 153288 | | - } |
| 153289 | | -} |
| 153290 | | - break; |
| 153291 | | - case 92: /* distinct ::= DISTINCT */ |
| 153292 | | -{yymsp[0].minor.yy32 = SF_Distinct;} |
| 153293 | | - break; |
| 153294 | | - case 93: /* distinct ::= ALL */ |
| 153295 | | -{yymsp[0].minor.yy32 = SF_All;} |
| 153296 | | - break; |
| 153297 | | - case 95: /* sclp ::= */ |
| 153298 | | - case 128: /* orderby_opt ::= */ yytestcase(yyruleno==128); |
| 153299 | | - case 138: /* groupby_opt ::= */ yytestcase(yyruleno==138); |
| 153300 | | - case 218: /* exprlist ::= */ yytestcase(yyruleno==218); |
| 153301 | | - case 221: /* paren_exprlist ::= */ yytestcase(yyruleno==221); |
| 153302 | | - case 226: /* eidlist_opt ::= */ yytestcase(yyruleno==226); |
| 153303 | | -{yymsp[1].minor.yy138 = 0;} |
| 153304 | | - break; |
| 153305 | | - case 96: /* selcollist ::= sclp scanpt expr scanpt as */ |
| 153306 | | -{ |
| 153307 | | - yymsp[-4].minor.yy138 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy138, yymsp[-2].minor.yy46); |
| 153308 | | - if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy138, &yymsp[0].minor.yy0, 1); |
| 153309 | | - sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy138,yymsp[-3].minor.yy8,yymsp[-1].minor.yy8); |
| 153310 | | -} |
| 153311 | | - break; |
| 153312 | | - case 97: /* selcollist ::= sclp scanpt STAR */ |
| 154422 | + yymsp[-4].minor.yy539 = pRight; |
| 154423 | + }else{ |
| 154424 | + yymsp[-4].minor.yy539 = pLeft; |
| 154425 | + } |
| 154426 | +} |
| 154427 | + break; |
| 154428 | + case 94: /* distinct ::= DISTINCT */ |
| 154429 | +{yymsp[0].minor.yy192 = SF_Distinct;} |
| 154430 | + break; |
| 154431 | + case 95: /* distinct ::= ALL */ |
| 154432 | +{yymsp[0].minor.yy192 = SF_All;} |
| 154433 | + break; |
| 154434 | + case 97: /* sclp ::= */ |
| 154435 | + case 130: /* orderby_opt ::= */ yytestcase(yyruleno==130); |
| 154436 | + case 140: /* groupby_opt ::= */ yytestcase(yyruleno==140); |
| 154437 | + case 220: /* exprlist ::= */ yytestcase(yyruleno==220); |
| 154438 | + case 223: /* paren_exprlist ::= */ yytestcase(yyruleno==223); |
| 154439 | + case 228: /* eidlist_opt ::= */ yytestcase(yyruleno==228); |
| 154440 | +{yymsp[1].minor.yy242 = 0;} |
| 154441 | + break; |
| 154442 | + case 98: /* selcollist ::= sclp scanpt expr scanpt as */ |
| 154443 | +{ |
| 154444 | + yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy242, yymsp[-2].minor.yy202); |
| 154445 | + if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy242, &yymsp[0].minor.yy0, 1); |
| 154446 | + sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy242,yymsp[-3].minor.yy436,yymsp[-1].minor.yy436); |
| 154447 | +} |
| 154448 | + break; |
| 154449 | + case 99: /* selcollist ::= sclp scanpt STAR */ |
| 153313 | 154450 | { |
| 153314 | 154451 | Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0); |
| 153315 | | - yymsp[-2].minor.yy138 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy138, p); |
| 154452 | + yymsp[-2].minor.yy242 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy242, p); |
| 153316 | 154453 | } |
| 153317 | 154454 | break; |
| 153318 | | - case 98: /* selcollist ::= sclp scanpt nm DOT STAR */ |
| 154455 | + case 100: /* selcollist ::= sclp scanpt nm DOT STAR */ |
| 153319 | 154456 | { |
| 153320 | 154457 | Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0); |
| 153321 | 154458 | Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); |
| 153322 | 154459 | Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight); |
| 153323 | | - yymsp[-4].minor.yy138 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy138, pDot); |
| 154460 | + yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, pDot); |
| 153324 | 154461 | } |
| 153325 | 154462 | break; |
| 153326 | | - case 99: /* as ::= AS nm */ |
| 153327 | | - case 110: /* dbnm ::= DOT nm */ yytestcase(yyruleno==110); |
| 153328 | | - case 242: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==242); |
| 153329 | | - case 243: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==243); |
| 154463 | + case 101: /* as ::= AS nm */ |
| 154464 | + case 112: /* dbnm ::= DOT nm */ yytestcase(yyruleno==112); |
| 154465 | + case 244: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==244); |
| 154466 | + case 245: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==245); |
| 153330 | 154467 | {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} |
| 153331 | 154468 | break; |
| 153332 | | - case 101: /* from ::= */ |
| 153333 | | -{yymsp[1].minor.yy609 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy609));} |
| 153334 | | - break; |
| 153335 | | - case 102: /* from ::= FROM seltablist */ |
| 153336 | | -{ |
| 153337 | | - yymsp[-1].minor.yy609 = yymsp[0].minor.yy609; |
| 153338 | | - sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy609); |
| 153339 | | -} |
| 153340 | | - break; |
| 153341 | | - case 103: /* stl_prefix ::= seltablist joinop */ |
| 153342 | | -{ |
| 153343 | | - if( ALWAYS(yymsp[-1].minor.yy609 && yymsp[-1].minor.yy609->nSrc>0) ) yymsp[-1].minor.yy609->a[yymsp[-1].minor.yy609->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy32; |
| 153344 | | -} |
| 153345 | | - break; |
| 153346 | | - case 104: /* stl_prefix ::= */ |
| 153347 | | -{yymsp[1].minor.yy609 = 0;} |
| 153348 | | - break; |
| 153349 | | - case 105: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ |
| 153350 | | -{ |
| 153351 | | - yymsp[-6].minor.yy609 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy609,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy46,yymsp[0].minor.yy406); |
| 153352 | | - sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy609, &yymsp[-2].minor.yy0); |
| 153353 | | -} |
| 153354 | | - break; |
| 153355 | | - case 106: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ |
| 153356 | | -{ |
| 153357 | | - yymsp[-8].minor.yy609 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy609,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy46,yymsp[0].minor.yy406); |
| 153358 | | - sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy609, yymsp[-4].minor.yy138); |
| 153359 | | -} |
| 153360 | | - break; |
| 153361 | | - case 107: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ |
| 153362 | | -{ |
| 153363 | | - yymsp[-6].minor.yy609 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy609,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy25,yymsp[-1].minor.yy46,yymsp[0].minor.yy406); |
| 153364 | | - } |
| 153365 | | - break; |
| 153366 | | - case 108: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ |
| 153367 | | -{ |
| 153368 | | - if( yymsp[-6].minor.yy609==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy46==0 && yymsp[0].minor.yy406==0 ){ |
| 153369 | | - yymsp[-6].minor.yy609 = yymsp[-4].minor.yy609; |
| 153370 | | - }else if( yymsp[-4].minor.yy609->nSrc==1 ){ |
| 153371 | | - yymsp[-6].minor.yy609 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy609,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy46,yymsp[0].minor.yy406); |
| 153372 | | - if( yymsp[-6].minor.yy609 ){ |
| 153373 | | - struct SrcList_item *pNew = &yymsp[-6].minor.yy609->a[yymsp[-6].minor.yy609->nSrc-1]; |
| 153374 | | - struct SrcList_item *pOld = yymsp[-4].minor.yy609->a; |
| 154469 | + case 103: /* from ::= */ |
| 154470 | +{yymsp[1].minor.yy47 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy47));} |
| 154471 | + break; |
| 154472 | + case 104: /* from ::= FROM seltablist */ |
| 154473 | +{ |
| 154474 | + yymsp[-1].minor.yy47 = yymsp[0].minor.yy47; |
| 154475 | + sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy47); |
| 154476 | +} |
| 154477 | + break; |
| 154478 | + case 105: /* stl_prefix ::= seltablist joinop */ |
| 154479 | +{ |
| 154480 | + if( ALWAYS(yymsp[-1].minor.yy47 && yymsp[-1].minor.yy47->nSrc>0) ) yymsp[-1].minor.yy47->a[yymsp[-1].minor.yy47->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy192; |
| 154481 | +} |
| 154482 | + break; |
| 154483 | + case 106: /* stl_prefix ::= */ |
| 154484 | +{yymsp[1].minor.yy47 = 0;} |
| 154485 | + break; |
| 154486 | + case 107: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ |
| 154487 | +{ |
| 154488 | + yymsp[-6].minor.yy47 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy47,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy202,yymsp[0].minor.yy600); |
| 154489 | + sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy47, &yymsp[-2].minor.yy0); |
| 154490 | +} |
| 154491 | + break; |
| 154492 | + case 108: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ |
| 154493 | +{ |
| 154494 | + yymsp[-8].minor.yy47 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy47,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy202,yymsp[0].minor.yy600); |
| 154495 | + sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy47, yymsp[-4].minor.yy242); |
| 154496 | +} |
| 154497 | + break; |
| 154498 | + case 109: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ |
| 154499 | +{ |
| 154500 | + yymsp[-6].minor.yy47 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy47,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy539,yymsp[-1].minor.yy202,yymsp[0].minor.yy600); |
| 154501 | + } |
| 154502 | + break; |
| 154503 | + case 110: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ |
| 154504 | +{ |
| 154505 | + if( yymsp[-6].minor.yy47==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy202==0 && yymsp[0].minor.yy600==0 ){ |
| 154506 | + yymsp[-6].minor.yy47 = yymsp[-4].minor.yy47; |
| 154507 | + }else if( yymsp[-4].minor.yy47->nSrc==1 ){ |
| 154508 | + yymsp[-6].minor.yy47 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy47,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy202,yymsp[0].minor.yy600); |
| 154509 | + if( yymsp[-6].minor.yy47 ){ |
| 154510 | + struct SrcList_item *pNew = &yymsp[-6].minor.yy47->a[yymsp[-6].minor.yy47->nSrc-1]; |
| 154511 | + struct SrcList_item *pOld = yymsp[-4].minor.yy47->a; |
| 153375 | 154512 | pNew->zName = pOld->zName; |
| 153376 | 154513 | pNew->zDatabase = pOld->zDatabase; |
| 153377 | 154514 | pNew->pSelect = pOld->pSelect; |
| 153378 | 154515 | if( pOld->fg.isTabFunc ){ |
| 153379 | 154516 | pNew->u1.pFuncArg = pOld->u1.pFuncArg; |
| | @@ -153382,946 +154519,951 @@ |
| 153382 | 154519 | pNew->fg.isTabFunc = 1; |
| 153383 | 154520 | } |
| 153384 | 154521 | pOld->zName = pOld->zDatabase = 0; |
| 153385 | 154522 | pOld->pSelect = 0; |
| 153386 | 154523 | } |
| 153387 | | - sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy609); |
| 154524 | + sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy47); |
| 153388 | 154525 | }else{ |
| 153389 | 154526 | Select *pSubquery; |
| 153390 | | - sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy609); |
| 153391 | | - pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy609,0,0,0,0,SF_NestedFrom,0); |
| 153392 | | - yymsp[-6].minor.yy609 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy609,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy46,yymsp[0].minor.yy406); |
| 154527 | + sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy47); |
| 154528 | + pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy47,0,0,0,0,SF_NestedFrom,0); |
| 154529 | + yymsp[-6].minor.yy47 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy47,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy202,yymsp[0].minor.yy600); |
| 153393 | 154530 | } |
| 153394 | 154531 | } |
| 153395 | 154532 | break; |
| 153396 | | - case 109: /* dbnm ::= */ |
| 153397 | | - case 123: /* indexed_opt ::= */ yytestcase(yyruleno==123); |
| 154533 | + case 111: /* dbnm ::= */ |
| 154534 | + case 125: /* indexed_opt ::= */ yytestcase(yyruleno==125); |
| 153398 | 154535 | {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;} |
| 153399 | 154536 | break; |
| 153400 | | - case 111: /* fullname ::= nm */ |
| 153401 | | -{ |
| 153402 | | - yylhsminor.yy609 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); |
| 153403 | | - if( IN_RENAME_OBJECT && yylhsminor.yy609 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy609->a[0].zName, &yymsp[0].minor.yy0); |
| 153404 | | -} |
| 153405 | | - yymsp[0].minor.yy609 = yylhsminor.yy609; |
| 153406 | | - break; |
| 153407 | | - case 112: /* fullname ::= nm DOT nm */ |
| 153408 | | -{ |
| 153409 | | - yylhsminor.yy609 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); |
| 153410 | | - if( IN_RENAME_OBJECT && yylhsminor.yy609 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy609->a[0].zName, &yymsp[0].minor.yy0); |
| 153411 | | -} |
| 153412 | | - yymsp[-2].minor.yy609 = yylhsminor.yy609; |
| 153413 | | - break; |
| 153414 | | - case 113: /* xfullname ::= nm */ |
| 153415 | | -{yymsp[0].minor.yy609 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} |
| 153416 | | - break; |
| 153417 | | - case 114: /* xfullname ::= nm DOT nm */ |
| 153418 | | -{yymsp[-2].minor.yy609 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 153419 | | - break; |
| 153420 | | - case 115: /* xfullname ::= nm DOT nm AS nm */ |
| 153421 | | -{ |
| 153422 | | - yymsp[-4].minor.yy609 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ |
| 153423 | | - if( yymsp[-4].minor.yy609 ) yymsp[-4].minor.yy609->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); |
| 153424 | | -} |
| 153425 | | - break; |
| 153426 | | - case 116: /* xfullname ::= nm AS nm */ |
| 153427 | | -{ |
| 153428 | | - yymsp[-2].minor.yy609 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/ |
| 153429 | | - if( yymsp[-2].minor.yy609 ) yymsp[-2].minor.yy609->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); |
| 153430 | | -} |
| 153431 | | - break; |
| 153432 | | - case 117: /* joinop ::= COMMA|JOIN */ |
| 153433 | | -{ yymsp[0].minor.yy32 = JT_INNER; } |
| 153434 | | - break; |
| 153435 | | - case 118: /* joinop ::= JOIN_KW JOIN */ |
| 153436 | | -{yymsp[-1].minor.yy32 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} |
| 153437 | | - break; |
| 153438 | | - case 119: /* joinop ::= JOIN_KW nm JOIN */ |
| 153439 | | -{yymsp[-2].minor.yy32 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} |
| 153440 | | - break; |
| 153441 | | - case 120: /* joinop ::= JOIN_KW nm nm JOIN */ |
| 153442 | | -{yymsp[-3].minor.yy32 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} |
| 153443 | | - break; |
| 153444 | | - case 121: /* on_opt ::= ON expr */ |
| 153445 | | - case 141: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==141); |
| 153446 | | - case 148: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==148); |
| 153447 | | - case 214: /* case_else ::= ELSE expr */ yytestcase(yyruleno==214); |
| 153448 | | - case 235: /* vinto ::= INTO expr */ yytestcase(yyruleno==235); |
| 153449 | | -{yymsp[-1].minor.yy46 = yymsp[0].minor.yy46;} |
| 153450 | | - break; |
| 153451 | | - case 122: /* on_opt ::= */ |
| 153452 | | - case 140: /* having_opt ::= */ yytestcase(yyruleno==140); |
| 153453 | | - case 142: /* limit_opt ::= */ yytestcase(yyruleno==142); |
| 153454 | | - case 147: /* where_opt ::= */ yytestcase(yyruleno==147); |
| 153455 | | - case 215: /* case_else ::= */ yytestcase(yyruleno==215); |
| 153456 | | - case 217: /* case_operand ::= */ yytestcase(yyruleno==217); |
| 153457 | | - case 236: /* vinto ::= */ yytestcase(yyruleno==236); |
| 153458 | | -{yymsp[1].minor.yy46 = 0;} |
| 153459 | | - break; |
| 153460 | | - case 124: /* indexed_opt ::= INDEXED BY nm */ |
| 154537 | + case 113: /* fullname ::= nm */ |
| 154538 | +{ |
| 154539 | + yylhsminor.yy47 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); |
| 154540 | + if( IN_RENAME_OBJECT && yylhsminor.yy47 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy47->a[0].zName, &yymsp[0].minor.yy0); |
| 154541 | +} |
| 154542 | + yymsp[0].minor.yy47 = yylhsminor.yy47; |
| 154543 | + break; |
| 154544 | + case 114: /* fullname ::= nm DOT nm */ |
| 154545 | +{ |
| 154546 | + yylhsminor.yy47 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); |
| 154547 | + if( IN_RENAME_OBJECT && yylhsminor.yy47 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy47->a[0].zName, &yymsp[0].minor.yy0); |
| 154548 | +} |
| 154549 | + yymsp[-2].minor.yy47 = yylhsminor.yy47; |
| 154550 | + break; |
| 154551 | + case 115: /* xfullname ::= nm */ |
| 154552 | +{yymsp[0].minor.yy47 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} |
| 154553 | + break; |
| 154554 | + case 116: /* xfullname ::= nm DOT nm */ |
| 154555 | +{yymsp[-2].minor.yy47 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 154556 | + break; |
| 154557 | + case 117: /* xfullname ::= nm DOT nm AS nm */ |
| 154558 | +{ |
| 154559 | + yymsp[-4].minor.yy47 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ |
| 154560 | + if( yymsp[-4].minor.yy47 ) yymsp[-4].minor.yy47->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); |
| 154561 | +} |
| 154562 | + break; |
| 154563 | + case 118: /* xfullname ::= nm AS nm */ |
| 154564 | +{ |
| 154565 | + yymsp[-2].minor.yy47 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/ |
| 154566 | + if( yymsp[-2].minor.yy47 ) yymsp[-2].minor.yy47->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); |
| 154567 | +} |
| 154568 | + break; |
| 154569 | + case 119: /* joinop ::= COMMA|JOIN */ |
| 154570 | +{ yymsp[0].minor.yy192 = JT_INNER; } |
| 154571 | + break; |
| 154572 | + case 120: /* joinop ::= JOIN_KW JOIN */ |
| 154573 | +{yymsp[-1].minor.yy192 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} |
| 154574 | + break; |
| 154575 | + case 121: /* joinop ::= JOIN_KW nm JOIN */ |
| 154576 | +{yymsp[-2].minor.yy192 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} |
| 154577 | + break; |
| 154578 | + case 122: /* joinop ::= JOIN_KW nm nm JOIN */ |
| 154579 | +{yymsp[-3].minor.yy192 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} |
| 154580 | + break; |
| 154581 | + case 123: /* on_opt ::= ON expr */ |
| 154582 | + case 143: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==143); |
| 154583 | + case 150: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==150); |
| 154584 | + case 216: /* case_else ::= ELSE expr */ yytestcase(yyruleno==216); |
| 154585 | + case 237: /* vinto ::= INTO expr */ yytestcase(yyruleno==237); |
| 154586 | +{yymsp[-1].minor.yy202 = yymsp[0].minor.yy202;} |
| 154587 | + break; |
| 154588 | + case 124: /* on_opt ::= */ |
| 154589 | + case 142: /* having_opt ::= */ yytestcase(yyruleno==142); |
| 154590 | + case 144: /* limit_opt ::= */ yytestcase(yyruleno==144); |
| 154591 | + case 149: /* where_opt ::= */ yytestcase(yyruleno==149); |
| 154592 | + case 217: /* case_else ::= */ yytestcase(yyruleno==217); |
| 154593 | + case 219: /* case_operand ::= */ yytestcase(yyruleno==219); |
| 154594 | + case 238: /* vinto ::= */ yytestcase(yyruleno==238); |
| 154595 | +{yymsp[1].minor.yy202 = 0;} |
| 154596 | + break; |
| 154597 | + case 126: /* indexed_opt ::= INDEXED BY nm */ |
| 153461 | 154598 | {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;} |
| 153462 | 154599 | break; |
| 153463 | | - case 125: /* indexed_opt ::= NOT INDEXED */ |
| 154600 | + case 127: /* indexed_opt ::= NOT INDEXED */ |
| 153464 | 154601 | {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;} |
| 153465 | 154602 | break; |
| 153466 | | - case 126: /* using_opt ::= USING LP idlist RP */ |
| 153467 | | -{yymsp[-3].minor.yy406 = yymsp[-1].minor.yy406;} |
| 153468 | | - break; |
| 153469 | | - case 127: /* using_opt ::= */ |
| 153470 | | - case 162: /* idlist_opt ::= */ yytestcase(yyruleno==162); |
| 153471 | | -{yymsp[1].minor.yy406 = 0;} |
| 153472 | | - break; |
| 153473 | | - case 129: /* orderby_opt ::= ORDER BY sortlist */ |
| 153474 | | - case 139: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==139); |
| 153475 | | -{yymsp[-2].minor.yy138 = yymsp[0].minor.yy138;} |
| 153476 | | - break; |
| 153477 | | - case 130: /* sortlist ::= sortlist COMMA expr sortorder nulls */ |
| 153478 | | -{ |
| 153479 | | - yymsp[-4].minor.yy138 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy138,yymsp[-2].minor.yy46); |
| 153480 | | - sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy138,yymsp[-1].minor.yy32,yymsp[0].minor.yy32); |
| 153481 | | -} |
| 153482 | | - break; |
| 153483 | | - case 131: /* sortlist ::= expr sortorder nulls */ |
| 153484 | | -{ |
| 153485 | | - yymsp[-2].minor.yy138 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy46); /*A-overwrites-Y*/ |
| 153486 | | - sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy138,yymsp[-1].minor.yy32,yymsp[0].minor.yy32); |
| 153487 | | -} |
| 153488 | | - break; |
| 153489 | | - case 132: /* sortorder ::= ASC */ |
| 153490 | | -{yymsp[0].minor.yy32 = SQLITE_SO_ASC;} |
| 153491 | | - break; |
| 153492 | | - case 133: /* sortorder ::= DESC */ |
| 153493 | | -{yymsp[0].minor.yy32 = SQLITE_SO_DESC;} |
| 153494 | | - break; |
| 153495 | | - case 134: /* sortorder ::= */ |
| 153496 | | - case 137: /* nulls ::= */ yytestcase(yyruleno==137); |
| 153497 | | -{yymsp[1].minor.yy32 = SQLITE_SO_UNDEFINED;} |
| 153498 | | - break; |
| 153499 | | - case 135: /* nulls ::= NULLS FIRST */ |
| 153500 | | -{yymsp[-1].minor.yy32 = SQLITE_SO_ASC;} |
| 153501 | | - break; |
| 153502 | | - case 136: /* nulls ::= NULLS LAST */ |
| 153503 | | -{yymsp[-1].minor.yy32 = SQLITE_SO_DESC;} |
| 153504 | | - break; |
| 153505 | | - case 143: /* limit_opt ::= LIMIT expr */ |
| 153506 | | -{yymsp[-1].minor.yy46 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy46,0);} |
| 153507 | | - break; |
| 153508 | | - case 144: /* limit_opt ::= LIMIT expr OFFSET expr */ |
| 153509 | | -{yymsp[-3].minor.yy46 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy46,yymsp[0].minor.yy46);} |
| 153510 | | - break; |
| 153511 | | - case 145: /* limit_opt ::= LIMIT expr COMMA expr */ |
| 153512 | | -{yymsp[-3].minor.yy46 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy46,yymsp[-2].minor.yy46);} |
| 153513 | | - break; |
| 153514 | | - case 146: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt */ |
| 153515 | | -{ |
| 153516 | | - sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy609, &yymsp[-1].minor.yy0); |
| 153517 | | - sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy609,yymsp[0].minor.yy46,0,0); |
| 153518 | | -} |
| 153519 | | - break; |
| 153520 | | - case 149: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */ |
| 153521 | | -{ |
| 153522 | | - sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy609, &yymsp[-3].minor.yy0); |
| 153523 | | - sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy138,"set list"); |
| 153524 | | - sqlite3Update(pParse,yymsp[-4].minor.yy609,yymsp[-1].minor.yy138,yymsp[0].minor.yy46,yymsp[-5].minor.yy32,0,0,0); |
| 153525 | | -} |
| 153526 | | - break; |
| 153527 | | - case 150: /* setlist ::= setlist COMMA nm EQ expr */ |
| 153528 | | -{ |
| 153529 | | - yymsp[-4].minor.yy138 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy138, yymsp[0].minor.yy46); |
| 153530 | | - sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy138, &yymsp[-2].minor.yy0, 1); |
| 153531 | | -} |
| 153532 | | - break; |
| 153533 | | - case 151: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ |
| 153534 | | -{ |
| 153535 | | - yymsp[-6].minor.yy138 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy138, yymsp[-3].minor.yy406, yymsp[0].minor.yy46); |
| 153536 | | -} |
| 153537 | | - break; |
| 153538 | | - case 152: /* setlist ::= nm EQ expr */ |
| 153539 | | -{ |
| 153540 | | - yylhsminor.yy138 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy46); |
| 153541 | | - sqlite3ExprListSetName(pParse, yylhsminor.yy138, &yymsp[-2].minor.yy0, 1); |
| 153542 | | -} |
| 153543 | | - yymsp[-2].minor.yy138 = yylhsminor.yy138; |
| 153544 | | - break; |
| 153545 | | - case 153: /* setlist ::= LP idlist RP EQ expr */ |
| 153546 | | -{ |
| 153547 | | - yymsp[-4].minor.yy138 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy406, yymsp[0].minor.yy46); |
| 153548 | | -} |
| 153549 | | - break; |
| 153550 | | - case 154: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ |
| 153551 | | -{ |
| 153552 | | - sqlite3Insert(pParse, yymsp[-3].minor.yy609, yymsp[-1].minor.yy25, yymsp[-2].minor.yy406, yymsp[-5].minor.yy32, yymsp[0].minor.yy288); |
| 153553 | | -} |
| 153554 | | - break; |
| 153555 | | - case 155: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */ |
| 153556 | | -{ |
| 153557 | | - sqlite3Insert(pParse, yymsp[-3].minor.yy609, 0, yymsp[-2].minor.yy406, yymsp[-5].minor.yy32, 0); |
| 153558 | | -} |
| 153559 | | - break; |
| 153560 | | - case 156: /* upsert ::= */ |
| 153561 | | -{ yymsp[1].minor.yy288 = 0; } |
| 153562 | | - break; |
| 153563 | | - case 157: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */ |
| 153564 | | -{ yymsp[-10].minor.yy288 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy138,yymsp[-5].minor.yy46,yymsp[-1].minor.yy138,yymsp[0].minor.yy46);} |
| 153565 | | - break; |
| 153566 | | - case 158: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */ |
| 153567 | | -{ yymsp[-7].minor.yy288 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy138,yymsp[-2].minor.yy46,0,0); } |
| 153568 | | - break; |
| 153569 | | - case 159: /* upsert ::= ON CONFLICT DO NOTHING */ |
| 153570 | | -{ yymsp[-3].minor.yy288 = sqlite3UpsertNew(pParse->db,0,0,0,0); } |
| 153571 | | - break; |
| 153572 | | - case 163: /* idlist_opt ::= LP idlist RP */ |
| 153573 | | -{yymsp[-2].minor.yy406 = yymsp[-1].minor.yy406;} |
| 153574 | | - break; |
| 153575 | | - case 164: /* idlist ::= idlist COMMA nm */ |
| 153576 | | -{yymsp[-2].minor.yy406 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy406,&yymsp[0].minor.yy0);} |
| 153577 | | - break; |
| 153578 | | - case 165: /* idlist ::= nm */ |
| 153579 | | -{yymsp[0].minor.yy406 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} |
| 153580 | | - break; |
| 153581 | | - case 166: /* expr ::= LP expr RP */ |
| 153582 | | -{yymsp[-2].minor.yy46 = yymsp[-1].minor.yy46;} |
| 153583 | | - break; |
| 153584 | | - case 167: /* expr ::= ID|INDEXED */ |
| 153585 | | - case 168: /* expr ::= JOIN_KW */ yytestcase(yyruleno==168); |
| 153586 | | -{yymsp[0].minor.yy46=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 153587 | | - break; |
| 153588 | | - case 169: /* expr ::= nm DOT nm */ |
| 154603 | + case 128: /* using_opt ::= USING LP idlist RP */ |
| 154604 | +{yymsp[-3].minor.yy600 = yymsp[-1].minor.yy600;} |
| 154605 | + break; |
| 154606 | + case 129: /* using_opt ::= */ |
| 154607 | + case 164: /* idlist_opt ::= */ yytestcase(yyruleno==164); |
| 154608 | +{yymsp[1].minor.yy600 = 0;} |
| 154609 | + break; |
| 154610 | + case 131: /* orderby_opt ::= ORDER BY sortlist */ |
| 154611 | + case 141: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==141); |
| 154612 | +{yymsp[-2].minor.yy242 = yymsp[0].minor.yy242;} |
| 154613 | + break; |
| 154614 | + case 132: /* sortlist ::= sortlist COMMA expr sortorder nulls */ |
| 154615 | +{ |
| 154616 | + yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242,yymsp[-2].minor.yy202); |
| 154617 | + sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy242,yymsp[-1].minor.yy192,yymsp[0].minor.yy192); |
| 154618 | +} |
| 154619 | + break; |
| 154620 | + case 133: /* sortlist ::= expr sortorder nulls */ |
| 154621 | +{ |
| 154622 | + yymsp[-2].minor.yy242 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy202); /*A-overwrites-Y*/ |
| 154623 | + sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy242,yymsp[-1].minor.yy192,yymsp[0].minor.yy192); |
| 154624 | +} |
| 154625 | + break; |
| 154626 | + case 134: /* sortorder ::= ASC */ |
| 154627 | +{yymsp[0].minor.yy192 = SQLITE_SO_ASC;} |
| 154628 | + break; |
| 154629 | + case 135: /* sortorder ::= DESC */ |
| 154630 | +{yymsp[0].minor.yy192 = SQLITE_SO_DESC;} |
| 154631 | + break; |
| 154632 | + case 136: /* sortorder ::= */ |
| 154633 | + case 139: /* nulls ::= */ yytestcase(yyruleno==139); |
| 154634 | +{yymsp[1].minor.yy192 = SQLITE_SO_UNDEFINED;} |
| 154635 | + break; |
| 154636 | + case 137: /* nulls ::= NULLS FIRST */ |
| 154637 | +{yymsp[-1].minor.yy192 = SQLITE_SO_ASC;} |
| 154638 | + break; |
| 154639 | + case 138: /* nulls ::= NULLS LAST */ |
| 154640 | +{yymsp[-1].minor.yy192 = SQLITE_SO_DESC;} |
| 154641 | + break; |
| 154642 | + case 145: /* limit_opt ::= LIMIT expr */ |
| 154643 | +{yymsp[-1].minor.yy202 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy202,0);} |
| 154644 | + break; |
| 154645 | + case 146: /* limit_opt ::= LIMIT expr OFFSET expr */ |
| 154646 | +{yymsp[-3].minor.yy202 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);} |
| 154647 | + break; |
| 154648 | + case 147: /* limit_opt ::= LIMIT expr COMMA expr */ |
| 154649 | +{yymsp[-3].minor.yy202 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy202,yymsp[-2].minor.yy202);} |
| 154650 | + break; |
| 154651 | + case 148: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt */ |
| 154652 | +{ |
| 154653 | + sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy47, &yymsp[-1].minor.yy0); |
| 154654 | + sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy47,yymsp[0].minor.yy202,0,0); |
| 154655 | +} |
| 154656 | + break; |
| 154657 | + case 151: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */ |
| 154658 | +{ |
| 154659 | + sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy47, &yymsp[-3].minor.yy0); |
| 154660 | + sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy242,"set list"); |
| 154661 | + sqlite3Update(pParse,yymsp[-4].minor.yy47,yymsp[-1].minor.yy242,yymsp[0].minor.yy202,yymsp[-5].minor.yy192,0,0,0); |
| 154662 | +} |
| 154663 | + break; |
| 154664 | + case 152: /* setlist ::= setlist COMMA nm EQ expr */ |
| 154665 | +{ |
| 154666 | + yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy242, yymsp[0].minor.yy202); |
| 154667 | + sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy242, &yymsp[-2].minor.yy0, 1); |
| 154668 | +} |
| 154669 | + break; |
| 154670 | + case 153: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ |
| 154671 | +{ |
| 154672 | + yymsp[-6].minor.yy242 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy242, yymsp[-3].minor.yy600, yymsp[0].minor.yy202); |
| 154673 | +} |
| 154674 | + break; |
| 154675 | + case 154: /* setlist ::= nm EQ expr */ |
| 154676 | +{ |
| 154677 | + yylhsminor.yy242 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy202); |
| 154678 | + sqlite3ExprListSetName(pParse, yylhsminor.yy242, &yymsp[-2].minor.yy0, 1); |
| 154679 | +} |
| 154680 | + yymsp[-2].minor.yy242 = yylhsminor.yy242; |
| 154681 | + break; |
| 154682 | + case 155: /* setlist ::= LP idlist RP EQ expr */ |
| 154683 | +{ |
| 154684 | + yymsp[-4].minor.yy242 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy600, yymsp[0].minor.yy202); |
| 154685 | +} |
| 154686 | + break; |
| 154687 | + case 156: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ |
| 154688 | +{ |
| 154689 | + sqlite3Insert(pParse, yymsp[-3].minor.yy47, yymsp[-1].minor.yy539, yymsp[-2].minor.yy600, yymsp[-5].minor.yy192, yymsp[0].minor.yy318); |
| 154690 | +} |
| 154691 | + break; |
| 154692 | + case 157: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */ |
| 154693 | +{ |
| 154694 | + sqlite3Insert(pParse, yymsp[-3].minor.yy47, 0, yymsp[-2].minor.yy600, yymsp[-5].minor.yy192, 0); |
| 154695 | +} |
| 154696 | + break; |
| 154697 | + case 158: /* upsert ::= */ |
| 154698 | +{ yymsp[1].minor.yy318 = 0; } |
| 154699 | + break; |
| 154700 | + case 159: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */ |
| 154701 | +{ yymsp[-10].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy242,yymsp[-5].minor.yy202,yymsp[-1].minor.yy242,yymsp[0].minor.yy202);} |
| 154702 | + break; |
| 154703 | + case 160: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */ |
| 154704 | +{ yymsp[-7].minor.yy318 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy242,yymsp[-2].minor.yy202,0,0); } |
| 154705 | + break; |
| 154706 | + case 161: /* upsert ::= ON CONFLICT DO NOTHING */ |
| 154707 | +{ yymsp[-3].minor.yy318 = sqlite3UpsertNew(pParse->db,0,0,0,0); } |
| 154708 | + break; |
| 154709 | + case 165: /* idlist_opt ::= LP idlist RP */ |
| 154710 | +{yymsp[-2].minor.yy600 = yymsp[-1].minor.yy600;} |
| 154711 | + break; |
| 154712 | + case 166: /* idlist ::= idlist COMMA nm */ |
| 154713 | +{yymsp[-2].minor.yy600 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy600,&yymsp[0].minor.yy0);} |
| 154714 | + break; |
| 154715 | + case 167: /* idlist ::= nm */ |
| 154716 | +{yymsp[0].minor.yy600 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} |
| 154717 | + break; |
| 154718 | + case 168: /* expr ::= LP expr RP */ |
| 154719 | +{yymsp[-2].minor.yy202 = yymsp[-1].minor.yy202;} |
| 154720 | + break; |
| 154721 | + case 169: /* expr ::= ID|INDEXED */ |
| 154722 | + case 170: /* expr ::= JOIN_KW */ yytestcase(yyruleno==170); |
| 154723 | +{yymsp[0].minor.yy202=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 154724 | + break; |
| 154725 | + case 171: /* expr ::= nm DOT nm */ |
| 153589 | 154726 | { |
| 153590 | 154727 | Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); |
| 153591 | 154728 | Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); |
| 153592 | 154729 | if( IN_RENAME_OBJECT ){ |
| 153593 | 154730 | sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0); |
| 153594 | 154731 | sqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0); |
| 153595 | 154732 | } |
| 153596 | | - yylhsminor.yy46 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); |
| 154733 | + yylhsminor.yy202 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); |
| 153597 | 154734 | } |
| 153598 | | - yymsp[-2].minor.yy46 = yylhsminor.yy46; |
| 154735 | + yymsp[-2].minor.yy202 = yylhsminor.yy202; |
| 153599 | 154736 | break; |
| 153600 | | - case 170: /* expr ::= nm DOT nm DOT nm */ |
| 154737 | + case 172: /* expr ::= nm DOT nm DOT nm */ |
| 153601 | 154738 | { |
| 153602 | 154739 | Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1); |
| 153603 | 154740 | Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); |
| 153604 | 154741 | Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); |
| 153605 | 154742 | Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3); |
| 153606 | 154743 | if( IN_RENAME_OBJECT ){ |
| 153607 | 154744 | sqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0); |
| 153608 | 154745 | sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0); |
| 153609 | 154746 | } |
| 153610 | | - yylhsminor.yy46 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); |
| 153611 | | -} |
| 153612 | | - yymsp[-4].minor.yy46 = yylhsminor.yy46; |
| 153613 | | - break; |
| 153614 | | - case 171: /* term ::= NULL|FLOAT|BLOB */ |
| 153615 | | - case 172: /* term ::= STRING */ yytestcase(yyruleno==172); |
| 153616 | | -{yymsp[0].minor.yy46=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 153617 | | - break; |
| 153618 | | - case 173: /* term ::= INTEGER */ |
| 153619 | | -{ |
| 153620 | | - yylhsminor.yy46 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); |
| 153621 | | -} |
| 153622 | | - yymsp[0].minor.yy46 = yylhsminor.yy46; |
| 153623 | | - break; |
| 153624 | | - case 174: /* expr ::= VARIABLE */ |
| 154747 | + yylhsminor.yy202 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); |
| 154748 | +} |
| 154749 | + yymsp[-4].minor.yy202 = yylhsminor.yy202; |
| 154750 | + break; |
| 154751 | + case 173: /* term ::= NULL|FLOAT|BLOB */ |
| 154752 | + case 174: /* term ::= STRING */ yytestcase(yyruleno==174); |
| 154753 | +{yymsp[0].minor.yy202=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 154754 | + break; |
| 154755 | + case 175: /* term ::= INTEGER */ |
| 154756 | +{ |
| 154757 | + yylhsminor.yy202 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); |
| 154758 | +} |
| 154759 | + yymsp[0].minor.yy202 = yylhsminor.yy202; |
| 154760 | + break; |
| 154761 | + case 176: /* expr ::= VARIABLE */ |
| 153625 | 154762 | { |
| 153626 | 154763 | if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){ |
| 153627 | 154764 | u32 n = yymsp[0].minor.yy0.n; |
| 153628 | | - yymsp[0].minor.yy46 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0); |
| 153629 | | - sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy46, n); |
| 154765 | + yymsp[0].minor.yy202 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0); |
| 154766 | + sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy202, n); |
| 153630 | 154767 | }else{ |
| 153631 | 154768 | /* When doing a nested parse, one can include terms in an expression |
| 153632 | 154769 | ** that look like this: #1 #2 ... These terms refer to registers |
| 153633 | 154770 | ** in the virtual machine. #N is the N-th register. */ |
| 153634 | 154771 | Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/ |
| 153635 | 154772 | assert( t.n>=2 ); |
| 153636 | 154773 | if( pParse->nested==0 ){ |
| 153637 | 154774 | sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t); |
| 153638 | | - yymsp[0].minor.yy46 = 0; |
| 153639 | | - }else{ |
| 153640 | | - yymsp[0].minor.yy46 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); |
| 153641 | | - if( yymsp[0].minor.yy46 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy46->iTable); |
| 153642 | | - } |
| 153643 | | - } |
| 153644 | | -} |
| 153645 | | - break; |
| 153646 | | - case 175: /* expr ::= expr COLLATE ID|STRING */ |
| 153647 | | -{ |
| 153648 | | - yymsp[-2].minor.yy46 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy46, &yymsp[0].minor.yy0, 1); |
| 153649 | | -} |
| 153650 | | - break; |
| 153651 | | - case 176: /* expr ::= CAST LP expr AS typetoken RP */ |
| 153652 | | -{ |
| 153653 | | - yymsp[-5].minor.yy46 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); |
| 153654 | | - sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy46, yymsp[-3].minor.yy46, 0); |
| 153655 | | -} |
| 153656 | | - break; |
| 153657 | | - case 177: /* expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 153658 | | -{ |
| 153659 | | - yylhsminor.yy46 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy138, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy32); |
| 153660 | | -} |
| 153661 | | - yymsp[-4].minor.yy46 = yylhsminor.yy46; |
| 153662 | | - break; |
| 153663 | | - case 178: /* expr ::= ID|INDEXED LP STAR RP */ |
| 153664 | | -{ |
| 153665 | | - yylhsminor.yy46 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0); |
| 153666 | | -} |
| 153667 | | - yymsp[-3].minor.yy46 = yylhsminor.yy46; |
| 153668 | | - break; |
| 153669 | | - case 179: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ |
| 153670 | | -{ |
| 153671 | | - yylhsminor.yy46 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy138, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy32); |
| 153672 | | - sqlite3WindowAttach(pParse, yylhsminor.yy46, yymsp[0].minor.yy455); |
| 153673 | | -} |
| 153674 | | - yymsp[-5].minor.yy46 = yylhsminor.yy46; |
| 153675 | | - break; |
| 153676 | | - case 180: /* expr ::= ID|INDEXED LP STAR RP filter_over */ |
| 153677 | | -{ |
| 153678 | | - yylhsminor.yy46 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0); |
| 153679 | | - sqlite3WindowAttach(pParse, yylhsminor.yy46, yymsp[0].minor.yy455); |
| 153680 | | -} |
| 153681 | | - yymsp[-4].minor.yy46 = yylhsminor.yy46; |
| 153682 | | - break; |
| 153683 | | - case 181: /* term ::= CTIME_KW */ |
| 153684 | | -{ |
| 153685 | | - yylhsminor.yy46 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0); |
| 153686 | | -} |
| 153687 | | - yymsp[0].minor.yy46 = yylhsminor.yy46; |
| 153688 | | - break; |
| 153689 | | - case 182: /* expr ::= LP nexprlist COMMA expr RP */ |
| 153690 | | -{ |
| 153691 | | - ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy138, yymsp[-1].minor.yy46); |
| 153692 | | - yymsp[-4].minor.yy46 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); |
| 153693 | | - if( yymsp[-4].minor.yy46 ){ |
| 153694 | | - yymsp[-4].minor.yy46->x.pList = pList; |
| 154775 | + yymsp[0].minor.yy202 = 0; |
| 154776 | + }else{ |
| 154777 | + yymsp[0].minor.yy202 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); |
| 154778 | + if( yymsp[0].minor.yy202 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy202->iTable); |
| 154779 | + } |
| 154780 | + } |
| 154781 | +} |
| 154782 | + break; |
| 154783 | + case 177: /* expr ::= expr COLLATE ID|STRING */ |
| 154784 | +{ |
| 154785 | + yymsp[-2].minor.yy202 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy202, &yymsp[0].minor.yy0, 1); |
| 154786 | +} |
| 154787 | + break; |
| 154788 | + case 178: /* expr ::= CAST LP expr AS typetoken RP */ |
| 154789 | +{ |
| 154790 | + yymsp[-5].minor.yy202 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); |
| 154791 | + sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy202, yymsp[-3].minor.yy202, 0); |
| 154792 | +} |
| 154793 | + break; |
| 154794 | + case 179: /* expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 154795 | +{ |
| 154796 | + yylhsminor.yy202 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy192); |
| 154797 | +} |
| 154798 | + yymsp[-4].minor.yy202 = yylhsminor.yy202; |
| 154799 | + break; |
| 154800 | + case 180: /* expr ::= ID|INDEXED LP STAR RP */ |
| 154801 | +{ |
| 154802 | + yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0); |
| 154803 | +} |
| 154804 | + yymsp[-3].minor.yy202 = yylhsminor.yy202; |
| 154805 | + break; |
| 154806 | + case 181: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ |
| 154807 | +{ |
| 154808 | + yylhsminor.yy202 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy242, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy192); |
| 154809 | + sqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303); |
| 154810 | +} |
| 154811 | + yymsp[-5].minor.yy202 = yylhsminor.yy202; |
| 154812 | + break; |
| 154813 | + case 182: /* expr ::= ID|INDEXED LP STAR RP filter_over */ |
| 154814 | +{ |
| 154815 | + yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0); |
| 154816 | + sqlite3WindowAttach(pParse, yylhsminor.yy202, yymsp[0].minor.yy303); |
| 154817 | +} |
| 154818 | + yymsp[-4].minor.yy202 = yylhsminor.yy202; |
| 154819 | + break; |
| 154820 | + case 183: /* term ::= CTIME_KW */ |
| 154821 | +{ |
| 154822 | + yylhsminor.yy202 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0); |
| 154823 | +} |
| 154824 | + yymsp[0].minor.yy202 = yylhsminor.yy202; |
| 154825 | + break; |
| 154826 | + case 184: /* expr ::= LP nexprlist COMMA expr RP */ |
| 154827 | +{ |
| 154828 | + ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy242, yymsp[-1].minor.yy202); |
| 154829 | + yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); |
| 154830 | + if( yymsp[-4].minor.yy202 ){ |
| 154831 | + yymsp[-4].minor.yy202->x.pList = pList; |
| 154832 | + if( ALWAYS(pList->nExpr) ){ |
| 154833 | + yymsp[-4].minor.yy202->flags |= pList->a[0].pExpr->flags & EP_Propagate; |
| 154834 | + } |
| 153695 | 154835 | }else{ |
| 153696 | 154836 | sqlite3ExprListDelete(pParse->db, pList); |
| 153697 | 154837 | } |
| 153698 | 154838 | } |
| 153699 | 154839 | break; |
| 153700 | | - case 183: /* expr ::= expr AND expr */ |
| 153701 | | -{yymsp[-2].minor.yy46=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy46,yymsp[0].minor.yy46);} |
| 153702 | | - break; |
| 153703 | | - case 184: /* expr ::= expr OR expr */ |
| 153704 | | - case 185: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==185); |
| 153705 | | - case 186: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==186); |
| 153706 | | - case 187: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==187); |
| 153707 | | - case 188: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==188); |
| 153708 | | - case 189: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==189); |
| 153709 | | - case 190: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==190); |
| 153710 | | -{yymsp[-2].minor.yy46=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy46,yymsp[0].minor.yy46);} |
| 153711 | | - break; |
| 153712 | | - case 191: /* likeop ::= NOT LIKE_KW|MATCH */ |
| 154840 | + case 185: /* expr ::= expr AND expr */ |
| 154841 | +{yymsp[-2].minor.yy202=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);} |
| 154842 | + break; |
| 154843 | + case 186: /* expr ::= expr OR expr */ |
| 154844 | + case 187: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==187); |
| 154845 | + case 188: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==188); |
| 154846 | + case 189: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==189); |
| 154847 | + case 190: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==190); |
| 154848 | + case 191: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==191); |
| 154849 | + case 192: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==192); |
| 154850 | +{yymsp[-2].minor.yy202=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy202,yymsp[0].minor.yy202);} |
| 154851 | + break; |
| 154852 | + case 193: /* likeop ::= NOT LIKE_KW|MATCH */ |
| 153713 | 154853 | {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/} |
| 153714 | 154854 | break; |
| 153715 | | - case 192: /* expr ::= expr likeop expr */ |
| 154855 | + case 194: /* expr ::= expr likeop expr */ |
| 153716 | 154856 | { |
| 153717 | 154857 | ExprList *pList; |
| 153718 | 154858 | int bNot = yymsp[-1].minor.yy0.n & 0x80000000; |
| 153719 | 154859 | yymsp[-1].minor.yy0.n &= 0x7fffffff; |
| 153720 | | - pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy46); |
| 153721 | | - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy46); |
| 153722 | | - yymsp[-2].minor.yy46 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); |
| 153723 | | - if( bNot ) yymsp[-2].minor.yy46 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy46, 0); |
| 153724 | | - if( yymsp[-2].minor.yy46 ) yymsp[-2].minor.yy46->flags |= EP_InfixFunc; |
| 154860 | + pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy202); |
| 154861 | + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy202); |
| 154862 | + yymsp[-2].minor.yy202 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); |
| 154863 | + if( bNot ) yymsp[-2].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy202, 0); |
| 154864 | + if( yymsp[-2].minor.yy202 ) yymsp[-2].minor.yy202->flags |= EP_InfixFunc; |
| 153725 | 154865 | } |
| 153726 | 154866 | break; |
| 153727 | | - case 193: /* expr ::= expr likeop expr ESCAPE expr */ |
| 154867 | + case 195: /* expr ::= expr likeop expr ESCAPE expr */ |
| 153728 | 154868 | { |
| 153729 | 154869 | ExprList *pList; |
| 153730 | 154870 | int bNot = yymsp[-3].minor.yy0.n & 0x80000000; |
| 153731 | 154871 | yymsp[-3].minor.yy0.n &= 0x7fffffff; |
| 153732 | | - pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy46); |
| 153733 | | - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy46); |
| 153734 | | - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy46); |
| 153735 | | - yymsp[-4].minor.yy46 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0); |
| 153736 | | - if( bNot ) yymsp[-4].minor.yy46 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy46, 0); |
| 153737 | | - if( yymsp[-4].minor.yy46 ) yymsp[-4].minor.yy46->flags |= EP_InfixFunc; |
| 153738 | | -} |
| 153739 | | - break; |
| 153740 | | - case 194: /* expr ::= expr ISNULL|NOTNULL */ |
| 153741 | | -{yymsp[-1].minor.yy46 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy46,0);} |
| 153742 | | - break; |
| 153743 | | - case 195: /* expr ::= expr NOT NULL */ |
| 153744 | | -{yymsp[-2].minor.yy46 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy46,0);} |
| 153745 | | - break; |
| 153746 | | - case 196: /* expr ::= expr IS expr */ |
| 153747 | | -{ |
| 153748 | | - yymsp[-2].minor.yy46 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy46,yymsp[0].minor.yy46); |
| 153749 | | - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy46, yymsp[-2].minor.yy46, TK_ISNULL); |
| 153750 | | -} |
| 153751 | | - break; |
| 153752 | | - case 197: /* expr ::= expr IS NOT expr */ |
| 153753 | | -{ |
| 153754 | | - yymsp[-3].minor.yy46 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy46,yymsp[0].minor.yy46); |
| 153755 | | - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy46, yymsp[-3].minor.yy46, TK_NOTNULL); |
| 153756 | | -} |
| 153757 | | - break; |
| 153758 | | - case 198: /* expr ::= NOT expr */ |
| 153759 | | - case 199: /* expr ::= BITNOT expr */ yytestcase(yyruleno==199); |
| 153760 | | -{yymsp[-1].minor.yy46 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy46, 0);/*A-overwrites-B*/} |
| 153761 | | - break; |
| 153762 | | - case 200: /* expr ::= PLUS|MINUS expr */ |
| 153763 | | -{ |
| 153764 | | - yymsp[-1].minor.yy46 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy46, 0); |
| 154872 | + pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202); |
| 154873 | + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy202); |
| 154874 | + pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy202); |
| 154875 | + yymsp[-4].minor.yy202 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0); |
| 154876 | + if( bNot ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0); |
| 154877 | + if( yymsp[-4].minor.yy202 ) yymsp[-4].minor.yy202->flags |= EP_InfixFunc; |
| 154878 | +} |
| 154879 | + break; |
| 154880 | + case 196: /* expr ::= expr ISNULL|NOTNULL */ |
| 154881 | +{yymsp[-1].minor.yy202 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy202,0);} |
| 154882 | + break; |
| 154883 | + case 197: /* expr ::= expr NOT NULL */ |
| 154884 | +{yymsp[-2].minor.yy202 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy202,0);} |
| 154885 | + break; |
| 154886 | + case 198: /* expr ::= expr IS expr */ |
| 154887 | +{ |
| 154888 | + yymsp[-2].minor.yy202 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy202,yymsp[0].minor.yy202); |
| 154889 | + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy202, yymsp[-2].minor.yy202, TK_ISNULL); |
| 154890 | +} |
| 154891 | + break; |
| 154892 | + case 199: /* expr ::= expr IS NOT expr */ |
| 154893 | +{ |
| 154894 | + yymsp[-3].minor.yy202 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy202,yymsp[0].minor.yy202); |
| 154895 | + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy202, yymsp[-3].minor.yy202, TK_NOTNULL); |
| 154896 | +} |
| 154897 | + break; |
| 154898 | + case 200: /* expr ::= NOT expr */ |
| 154899 | + case 201: /* expr ::= BITNOT expr */ yytestcase(yyruleno==201); |
| 154900 | +{yymsp[-1].minor.yy202 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy202, 0);/*A-overwrites-B*/} |
| 154901 | + break; |
| 154902 | + case 202: /* expr ::= PLUS|MINUS expr */ |
| 154903 | +{ |
| 154904 | + yymsp[-1].minor.yy202 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy202, 0); |
| 153765 | 154905 | /*A-overwrites-B*/ |
| 153766 | 154906 | } |
| 153767 | 154907 | break; |
| 153768 | | - case 201: /* between_op ::= BETWEEN */ |
| 153769 | | - case 204: /* in_op ::= IN */ yytestcase(yyruleno==204); |
| 153770 | | -{yymsp[0].minor.yy32 = 0;} |
| 153771 | | - break; |
| 153772 | | - case 203: /* expr ::= expr between_op expr AND expr */ |
| 153773 | | -{ |
| 153774 | | - ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy46); |
| 153775 | | - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy46); |
| 153776 | | - yymsp[-4].minor.yy46 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy46, 0); |
| 153777 | | - if( yymsp[-4].minor.yy46 ){ |
| 153778 | | - yymsp[-4].minor.yy46->x.pList = pList; |
| 154908 | + case 203: /* between_op ::= BETWEEN */ |
| 154909 | + case 206: /* in_op ::= IN */ yytestcase(yyruleno==206); |
| 154910 | +{yymsp[0].minor.yy192 = 0;} |
| 154911 | + break; |
| 154912 | + case 205: /* expr ::= expr between_op expr AND expr */ |
| 154913 | +{ |
| 154914 | + ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202); |
| 154915 | + pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy202); |
| 154916 | + yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy202, 0); |
| 154917 | + if( yymsp[-4].minor.yy202 ){ |
| 154918 | + yymsp[-4].minor.yy202->x.pList = pList; |
| 153779 | 154919 | }else{ |
| 153780 | 154920 | sqlite3ExprListDelete(pParse->db, pList); |
| 153781 | 154921 | } |
| 153782 | | - if( yymsp[-3].minor.yy32 ) yymsp[-4].minor.yy46 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy46, 0); |
| 154922 | + if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0); |
| 153783 | 154923 | } |
| 153784 | 154924 | break; |
| 153785 | | - case 206: /* expr ::= expr in_op LP exprlist RP */ |
| 154925 | + case 208: /* expr ::= expr in_op LP exprlist RP */ |
| 153786 | 154926 | { |
| 153787 | | - if( yymsp[-1].minor.yy138==0 ){ |
| 154927 | + if( yymsp[-1].minor.yy242==0 ){ |
| 153788 | 154928 | /* Expressions of the form |
| 153789 | 154929 | ** |
| 153790 | 154930 | ** expr1 IN () |
| 153791 | 154931 | ** expr1 NOT IN () |
| 153792 | 154932 | ** |
| 153793 | 154933 | ** simplify to constants 0 (false) and 1 (true), respectively, |
| 153794 | 154934 | ** regardless of the value of expr1. |
| 153795 | 154935 | */ |
| 153796 | | - sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy46); |
| 153797 | | - yymsp[-4].minor.yy46 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy32 ? "1" : "0"); |
| 153798 | | - }else{ |
| 153799 | | - yymsp[-4].minor.yy46 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy46, 0); |
| 153800 | | - if( yymsp[-4].minor.yy46 ){ |
| 153801 | | - yymsp[-4].minor.yy46->x.pList = yymsp[-1].minor.yy138; |
| 153802 | | - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy46); |
| 153803 | | - }else{ |
| 153804 | | - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy138); |
| 153805 | | - } |
| 153806 | | - if( yymsp[-3].minor.yy32 ) yymsp[-4].minor.yy46 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy46, 0); |
| 153807 | | - } |
| 153808 | | - } |
| 153809 | | - break; |
| 153810 | | - case 207: /* expr ::= LP select RP */ |
| 153811 | | -{ |
| 153812 | | - yymsp[-2].minor.yy46 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); |
| 153813 | | - sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy46, yymsp[-1].minor.yy25); |
| 153814 | | - } |
| 153815 | | - break; |
| 153816 | | - case 208: /* expr ::= expr in_op LP select RP */ |
| 153817 | | -{ |
| 153818 | | - yymsp[-4].minor.yy46 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy46, 0); |
| 153819 | | - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy46, yymsp[-1].minor.yy25); |
| 153820 | | - if( yymsp[-3].minor.yy32 ) yymsp[-4].minor.yy46 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy46, 0); |
| 153821 | | - } |
| 153822 | | - break; |
| 153823 | | - case 209: /* expr ::= expr in_op nm dbnm paren_exprlist */ |
| 154936 | + sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy202); |
| 154937 | + yymsp[-4].minor.yy202 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy192 ? "1" : "0"); |
| 154938 | + }else{ |
| 154939 | + yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0); |
| 154940 | + if( yymsp[-4].minor.yy202 ){ |
| 154941 | + yymsp[-4].minor.yy202->x.pList = yymsp[-1].minor.yy242; |
| 154942 | + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy202); |
| 154943 | + }else{ |
| 154944 | + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy242); |
| 154945 | + } |
| 154946 | + if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0); |
| 154947 | + } |
| 154948 | + } |
| 154949 | + break; |
| 154950 | + case 209: /* expr ::= LP select RP */ |
| 154951 | +{ |
| 154952 | + yymsp[-2].minor.yy202 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); |
| 154953 | + sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy202, yymsp[-1].minor.yy539); |
| 154954 | + } |
| 154955 | + break; |
| 154956 | + case 210: /* expr ::= expr in_op LP select RP */ |
| 154957 | +{ |
| 154958 | + yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0); |
| 154959 | + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, yymsp[-1].minor.yy539); |
| 154960 | + if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0); |
| 154961 | + } |
| 154962 | + break; |
| 154963 | + case 211: /* expr ::= expr in_op nm dbnm paren_exprlist */ |
| 153824 | 154964 | { |
| 153825 | 154965 | SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); |
| 153826 | 154966 | Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0); |
| 153827 | | - if( yymsp[0].minor.yy138 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy138); |
| 153828 | | - yymsp[-4].minor.yy46 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy46, 0); |
| 153829 | | - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy46, pSelect); |
| 153830 | | - if( yymsp[-3].minor.yy32 ) yymsp[-4].minor.yy46 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy46, 0); |
| 154967 | + if( yymsp[0].minor.yy242 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy242); |
| 154968 | + yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy202, 0); |
| 154969 | + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy202, pSelect); |
| 154970 | + if( yymsp[-3].minor.yy192 ) yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy202, 0); |
| 153831 | 154971 | } |
| 153832 | 154972 | break; |
| 153833 | | - case 210: /* expr ::= EXISTS LP select RP */ |
| 154973 | + case 212: /* expr ::= EXISTS LP select RP */ |
| 153834 | 154974 | { |
| 153835 | 154975 | Expr *p; |
| 153836 | | - p = yymsp[-3].minor.yy46 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); |
| 153837 | | - sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy25); |
| 153838 | | - } |
| 153839 | | - break; |
| 153840 | | - case 211: /* expr ::= CASE case_operand case_exprlist case_else END */ |
| 153841 | | -{ |
| 153842 | | - yymsp[-4].minor.yy46 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy46, 0); |
| 153843 | | - if( yymsp[-4].minor.yy46 ){ |
| 153844 | | - yymsp[-4].minor.yy46->x.pList = yymsp[-1].minor.yy46 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy138,yymsp[-1].minor.yy46) : yymsp[-2].minor.yy138; |
| 153845 | | - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy46); |
| 153846 | | - }else{ |
| 153847 | | - sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy138); |
| 153848 | | - sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy46); |
| 153849 | | - } |
| 153850 | | -} |
| 153851 | | - break; |
| 153852 | | - case 212: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 153853 | | -{ |
| 153854 | | - yymsp[-4].minor.yy138 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy138, yymsp[-2].minor.yy46); |
| 153855 | | - yymsp[-4].minor.yy138 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy138, yymsp[0].minor.yy46); |
| 153856 | | -} |
| 153857 | | - break; |
| 153858 | | - case 213: /* case_exprlist ::= WHEN expr THEN expr */ |
| 153859 | | -{ |
| 153860 | | - yymsp[-3].minor.yy138 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy46); |
| 153861 | | - yymsp[-3].minor.yy138 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy138, yymsp[0].minor.yy46); |
| 153862 | | -} |
| 153863 | | - break; |
| 153864 | | - case 216: /* case_operand ::= expr */ |
| 153865 | | -{yymsp[0].minor.yy46 = yymsp[0].minor.yy46; /*A-overwrites-X*/} |
| 153866 | | - break; |
| 153867 | | - case 219: /* nexprlist ::= nexprlist COMMA expr */ |
| 153868 | | -{yymsp[-2].minor.yy138 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy138,yymsp[0].minor.yy46);} |
| 153869 | | - break; |
| 153870 | | - case 220: /* nexprlist ::= expr */ |
| 153871 | | -{yymsp[0].minor.yy138 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy46); /*A-overwrites-Y*/} |
| 153872 | | - break; |
| 153873 | | - case 222: /* paren_exprlist ::= LP exprlist RP */ |
| 153874 | | - case 227: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==227); |
| 153875 | | -{yymsp[-2].minor.yy138 = yymsp[-1].minor.yy138;} |
| 153876 | | - break; |
| 153877 | | - case 223: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 154976 | + p = yymsp[-3].minor.yy202 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); |
| 154977 | + sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy539); |
| 154978 | + } |
| 154979 | + break; |
| 154980 | + case 213: /* expr ::= CASE case_operand case_exprlist case_else END */ |
| 154981 | +{ |
| 154982 | + yymsp[-4].minor.yy202 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy202, 0); |
| 154983 | + if( yymsp[-4].minor.yy202 ){ |
| 154984 | + yymsp[-4].minor.yy202->x.pList = yymsp[-1].minor.yy202 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[-1].minor.yy202) : yymsp[-2].minor.yy242; |
| 154985 | + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy202); |
| 154986 | + }else{ |
| 154987 | + sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy242); |
| 154988 | + sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy202); |
| 154989 | + } |
| 154990 | +} |
| 154991 | + break; |
| 154992 | + case 214: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 154993 | +{ |
| 154994 | + yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[-2].minor.yy202); |
| 154995 | + yymsp[-4].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy242, yymsp[0].minor.yy202); |
| 154996 | +} |
| 154997 | + break; |
| 154998 | + case 215: /* case_exprlist ::= WHEN expr THEN expr */ |
| 154999 | +{ |
| 155000 | + yymsp[-3].minor.yy242 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy202); |
| 155001 | + yymsp[-3].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy242, yymsp[0].minor.yy202); |
| 155002 | +} |
| 155003 | + break; |
| 155004 | + case 218: /* case_operand ::= expr */ |
| 155005 | +{yymsp[0].minor.yy202 = yymsp[0].minor.yy202; /*A-overwrites-X*/} |
| 155006 | + break; |
| 155007 | + case 221: /* nexprlist ::= nexprlist COMMA expr */ |
| 155008 | +{yymsp[-2].minor.yy242 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy242,yymsp[0].minor.yy202);} |
| 155009 | + break; |
| 155010 | + case 222: /* nexprlist ::= expr */ |
| 155011 | +{yymsp[0].minor.yy242 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy202); /*A-overwrites-Y*/} |
| 155012 | + break; |
| 155013 | + case 224: /* paren_exprlist ::= LP exprlist RP */ |
| 155014 | + case 229: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==229); |
| 155015 | +{yymsp[-2].minor.yy242 = yymsp[-1].minor.yy242;} |
| 155016 | + break; |
| 155017 | + case 225: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 153878 | 155018 | { |
| 153879 | 155019 | sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, |
| 153880 | | - sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy138, yymsp[-10].minor.yy32, |
| 153881 | | - &yymsp[-11].minor.yy0, yymsp[0].minor.yy46, SQLITE_SO_ASC, yymsp[-8].minor.yy32, SQLITE_IDXTYPE_APPDEF); |
| 155020 | + sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy242, yymsp[-10].minor.yy192, |
| 155021 | + &yymsp[-11].minor.yy0, yymsp[0].minor.yy202, SQLITE_SO_ASC, yymsp[-8].minor.yy192, SQLITE_IDXTYPE_APPDEF); |
| 153882 | 155022 | if( IN_RENAME_OBJECT && pParse->pNewIndex ){ |
| 153883 | 155023 | sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0); |
| 153884 | 155024 | } |
| 153885 | 155025 | } |
| 153886 | 155026 | break; |
| 153887 | | - case 224: /* uniqueflag ::= UNIQUE */ |
| 153888 | | - case 266: /* raisetype ::= ABORT */ yytestcase(yyruleno==266); |
| 153889 | | -{yymsp[0].minor.yy32 = OE_Abort;} |
| 153890 | | - break; |
| 153891 | | - case 225: /* uniqueflag ::= */ |
| 153892 | | -{yymsp[1].minor.yy32 = OE_None;} |
| 153893 | | - break; |
| 153894 | | - case 228: /* eidlist ::= eidlist COMMA nm collate sortorder */ |
| 153895 | | -{ |
| 153896 | | - yymsp[-4].minor.yy138 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy138, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy32, yymsp[0].minor.yy32); |
| 153897 | | -} |
| 153898 | | - break; |
| 153899 | | - case 229: /* eidlist ::= nm collate sortorder */ |
| 153900 | | -{ |
| 153901 | | - yymsp[-2].minor.yy138 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy32, yymsp[0].minor.yy32); /*A-overwrites-Y*/ |
| 153902 | | -} |
| 153903 | | - break; |
| 153904 | | - case 232: /* cmd ::= DROP INDEX ifexists fullname */ |
| 153905 | | -{sqlite3DropIndex(pParse, yymsp[0].minor.yy609, yymsp[-1].minor.yy32);} |
| 153906 | | - break; |
| 153907 | | - case 233: /* cmd ::= VACUUM vinto */ |
| 153908 | | -{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy46);} |
| 153909 | | - break; |
| 153910 | | - case 234: /* cmd ::= VACUUM nm vinto */ |
| 153911 | | -{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy46);} |
| 153912 | | - break; |
| 153913 | | - case 237: /* cmd ::= PRAGMA nm dbnm */ |
| 155027 | + case 226: /* uniqueflag ::= UNIQUE */ |
| 155028 | + case 268: /* raisetype ::= ABORT */ yytestcase(yyruleno==268); |
| 155029 | +{yymsp[0].minor.yy192 = OE_Abort;} |
| 155030 | + break; |
| 155031 | + case 227: /* uniqueflag ::= */ |
| 155032 | +{yymsp[1].minor.yy192 = OE_None;} |
| 155033 | + break; |
| 155034 | + case 230: /* eidlist ::= eidlist COMMA nm collate sortorder */ |
| 155035 | +{ |
| 155036 | + yymsp[-4].minor.yy242 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy242, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy192, yymsp[0].minor.yy192); |
| 155037 | +} |
| 155038 | + break; |
| 155039 | + case 231: /* eidlist ::= nm collate sortorder */ |
| 155040 | +{ |
| 155041 | + yymsp[-2].minor.yy242 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy192, yymsp[0].minor.yy192); /*A-overwrites-Y*/ |
| 155042 | +} |
| 155043 | + break; |
| 155044 | + case 234: /* cmd ::= DROP INDEX ifexists fullname */ |
| 155045 | +{sqlite3DropIndex(pParse, yymsp[0].minor.yy47, yymsp[-1].minor.yy192);} |
| 155046 | + break; |
| 155047 | + case 235: /* cmd ::= VACUUM vinto */ |
| 155048 | +{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy202);} |
| 155049 | + break; |
| 155050 | + case 236: /* cmd ::= VACUUM nm vinto */ |
| 155051 | +{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy202);} |
| 155052 | + break; |
| 155053 | + case 239: /* cmd ::= PRAGMA nm dbnm */ |
| 153914 | 155054 | {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} |
| 153915 | 155055 | break; |
| 153916 | | - case 238: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 155056 | + case 240: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 153917 | 155057 | {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} |
| 153918 | 155058 | break; |
| 153919 | | - case 239: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 155059 | + case 241: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 153920 | 155060 | {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} |
| 153921 | 155061 | break; |
| 153922 | | - case 240: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 155062 | + case 242: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 153923 | 155063 | {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} |
| 153924 | 155064 | break; |
| 153925 | | - case 241: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 155065 | + case 243: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 153926 | 155066 | {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);} |
| 153927 | 155067 | break; |
| 153928 | | - case 244: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 155068 | + case 246: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 153929 | 155069 | { |
| 153930 | 155070 | Token all; |
| 153931 | 155071 | all.z = yymsp[-3].minor.yy0.z; |
| 153932 | 155072 | all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n; |
| 153933 | | - sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy527, &all); |
| 155073 | + sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy447, &all); |
| 153934 | 155074 | } |
| 153935 | 155075 | break; |
| 153936 | | - case 245: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 155076 | + case 247: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 153937 | 155077 | { |
| 153938 | | - sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy32, yymsp[-4].minor.yy572.a, yymsp[-4].minor.yy572.b, yymsp[-2].minor.yy609, yymsp[0].minor.yy46, yymsp[-10].minor.yy32, yymsp[-8].minor.yy32); |
| 155078 | + sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy192, yymsp[-4].minor.yy230.a, yymsp[-4].minor.yy230.b, yymsp[-2].minor.yy47, yymsp[0].minor.yy202, yymsp[-10].minor.yy192, yymsp[-8].minor.yy192); |
| 153939 | 155079 | yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ |
| 153940 | 155080 | } |
| 153941 | 155081 | break; |
| 153942 | | - case 246: /* trigger_time ::= BEFORE|AFTER */ |
| 153943 | | -{ yymsp[0].minor.yy32 = yymsp[0].major; /*A-overwrites-X*/ } |
| 153944 | | - break; |
| 153945 | | - case 247: /* trigger_time ::= INSTEAD OF */ |
| 153946 | | -{ yymsp[-1].minor.yy32 = TK_INSTEAD;} |
| 153947 | | - break; |
| 153948 | | - case 248: /* trigger_time ::= */ |
| 153949 | | -{ yymsp[1].minor.yy32 = TK_BEFORE; } |
| 153950 | | - break; |
| 153951 | | - case 249: /* trigger_event ::= DELETE|INSERT */ |
| 153952 | | - case 250: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==250); |
| 153953 | | -{yymsp[0].minor.yy572.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy572.b = 0;} |
| 153954 | | - break; |
| 153955 | | - case 251: /* trigger_event ::= UPDATE OF idlist */ |
| 153956 | | -{yymsp[-2].minor.yy572.a = TK_UPDATE; yymsp[-2].minor.yy572.b = yymsp[0].minor.yy406;} |
| 153957 | | - break; |
| 153958 | | - case 252: /* when_clause ::= */ |
| 153959 | | - case 271: /* key_opt ::= */ yytestcase(yyruleno==271); |
| 153960 | | -{ yymsp[1].minor.yy46 = 0; } |
| 153961 | | - break; |
| 153962 | | - case 253: /* when_clause ::= WHEN expr */ |
| 153963 | | - case 272: /* key_opt ::= KEY expr */ yytestcase(yyruleno==272); |
| 153964 | | -{ yymsp[-1].minor.yy46 = yymsp[0].minor.yy46; } |
| 153965 | | - break; |
| 153966 | | - case 254: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 153967 | | -{ |
| 153968 | | - assert( yymsp[-2].minor.yy527!=0 ); |
| 153969 | | - yymsp[-2].minor.yy527->pLast->pNext = yymsp[-1].minor.yy527; |
| 153970 | | - yymsp[-2].minor.yy527->pLast = yymsp[-1].minor.yy527; |
| 153971 | | -} |
| 153972 | | - break; |
| 153973 | | - case 255: /* trigger_cmd_list ::= trigger_cmd SEMI */ |
| 153974 | | -{ |
| 153975 | | - assert( yymsp[-1].minor.yy527!=0 ); |
| 153976 | | - yymsp[-1].minor.yy527->pLast = yymsp[-1].minor.yy527; |
| 153977 | | -} |
| 153978 | | - break; |
| 153979 | | - case 256: /* trnm ::= nm DOT nm */ |
| 155082 | + case 248: /* trigger_time ::= BEFORE|AFTER */ |
| 155083 | +{ yymsp[0].minor.yy192 = yymsp[0].major; /*A-overwrites-X*/ } |
| 155084 | + break; |
| 155085 | + case 249: /* trigger_time ::= INSTEAD OF */ |
| 155086 | +{ yymsp[-1].minor.yy192 = TK_INSTEAD;} |
| 155087 | + break; |
| 155088 | + case 250: /* trigger_time ::= */ |
| 155089 | +{ yymsp[1].minor.yy192 = TK_BEFORE; } |
| 155090 | + break; |
| 155091 | + case 251: /* trigger_event ::= DELETE|INSERT */ |
| 155092 | + case 252: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==252); |
| 155093 | +{yymsp[0].minor.yy230.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy230.b = 0;} |
| 155094 | + break; |
| 155095 | + case 253: /* trigger_event ::= UPDATE OF idlist */ |
| 155096 | +{yymsp[-2].minor.yy230.a = TK_UPDATE; yymsp[-2].minor.yy230.b = yymsp[0].minor.yy600;} |
| 155097 | + break; |
| 155098 | + case 254: /* when_clause ::= */ |
| 155099 | + case 273: /* key_opt ::= */ yytestcase(yyruleno==273); |
| 155100 | +{ yymsp[1].minor.yy202 = 0; } |
| 155101 | + break; |
| 155102 | + case 255: /* when_clause ::= WHEN expr */ |
| 155103 | + case 274: /* key_opt ::= KEY expr */ yytestcase(yyruleno==274); |
| 155104 | +{ yymsp[-1].minor.yy202 = yymsp[0].minor.yy202; } |
| 155105 | + break; |
| 155106 | + case 256: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 155107 | +{ |
| 155108 | + assert( yymsp[-2].minor.yy447!=0 ); |
| 155109 | + yymsp[-2].minor.yy447->pLast->pNext = yymsp[-1].minor.yy447; |
| 155110 | + yymsp[-2].minor.yy447->pLast = yymsp[-1].minor.yy447; |
| 155111 | +} |
| 155112 | + break; |
| 155113 | + case 257: /* trigger_cmd_list ::= trigger_cmd SEMI */ |
| 155114 | +{ |
| 155115 | + assert( yymsp[-1].minor.yy447!=0 ); |
| 155116 | + yymsp[-1].minor.yy447->pLast = yymsp[-1].minor.yy447; |
| 155117 | +} |
| 155118 | + break; |
| 155119 | + case 258: /* trnm ::= nm DOT nm */ |
| 153980 | 155120 | { |
| 153981 | 155121 | yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; |
| 153982 | 155122 | sqlite3ErrorMsg(pParse, |
| 153983 | 155123 | "qualified table names are not allowed on INSERT, UPDATE, and DELETE " |
| 153984 | 155124 | "statements within triggers"); |
| 153985 | 155125 | } |
| 153986 | 155126 | break; |
| 153987 | | - case 257: /* tridxby ::= INDEXED BY nm */ |
| 155127 | + case 259: /* tridxby ::= INDEXED BY nm */ |
| 153988 | 155128 | { |
| 153989 | 155129 | sqlite3ErrorMsg(pParse, |
| 153990 | 155130 | "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " |
| 153991 | 155131 | "within triggers"); |
| 153992 | 155132 | } |
| 153993 | 155133 | break; |
| 153994 | | - case 258: /* tridxby ::= NOT INDEXED */ |
| 155134 | + case 260: /* tridxby ::= NOT INDEXED */ |
| 153995 | 155135 | { |
| 153996 | 155136 | sqlite3ErrorMsg(pParse, |
| 153997 | 155137 | "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " |
| 153998 | 155138 | "within triggers"); |
| 153999 | 155139 | } |
| 154000 | 155140 | break; |
| 154001 | | - case 259: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ |
| 154002 | | -{yylhsminor.yy527 = sqlite3TriggerUpdateStep(pParse, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy138, yymsp[-1].minor.yy46, yymsp[-6].minor.yy32, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy8);} |
| 154003 | | - yymsp[-7].minor.yy527 = yylhsminor.yy527; |
| 154004 | | - break; |
| 154005 | | - case 260: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 154006 | | -{ |
| 154007 | | - yylhsminor.yy527 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy406,yymsp[-2].minor.yy25,yymsp[-6].minor.yy32,yymsp[-1].minor.yy288,yymsp[-7].minor.yy8,yymsp[0].minor.yy8);/*yylhsminor.yy527-overwrites-yymsp[-6].minor.yy32*/ |
| 154008 | | -} |
| 154009 | | - yymsp[-7].minor.yy527 = yylhsminor.yy527; |
| 154010 | | - break; |
| 154011 | | - case 261: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 154012 | | -{yylhsminor.yy527 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy46, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy8);} |
| 154013 | | - yymsp[-5].minor.yy527 = yylhsminor.yy527; |
| 154014 | | - break; |
| 154015 | | - case 262: /* trigger_cmd ::= scanpt select scanpt */ |
| 154016 | | -{yylhsminor.yy527 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy25, yymsp[-2].minor.yy8, yymsp[0].minor.yy8); /*yylhsminor.yy527-overwrites-yymsp[-1].minor.yy25*/} |
| 154017 | | - yymsp[-2].minor.yy527 = yylhsminor.yy527; |
| 154018 | | - break; |
| 154019 | | - case 263: /* expr ::= RAISE LP IGNORE RP */ |
| 154020 | | -{ |
| 154021 | | - yymsp[-3].minor.yy46 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); |
| 154022 | | - if( yymsp[-3].minor.yy46 ){ |
| 154023 | | - yymsp[-3].minor.yy46->affExpr = OE_Ignore; |
| 154024 | | - } |
| 154025 | | -} |
| 154026 | | - break; |
| 154027 | | - case 264: /* expr ::= RAISE LP raisetype COMMA nm RP */ |
| 154028 | | -{ |
| 154029 | | - yymsp[-5].minor.yy46 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); |
| 154030 | | - if( yymsp[-5].minor.yy46 ) { |
| 154031 | | - yymsp[-5].minor.yy46->affExpr = (char)yymsp[-3].minor.yy32; |
| 154032 | | - } |
| 154033 | | -} |
| 154034 | | - break; |
| 154035 | | - case 265: /* raisetype ::= ROLLBACK */ |
| 154036 | | -{yymsp[0].minor.yy32 = OE_Rollback;} |
| 154037 | | - break; |
| 154038 | | - case 267: /* raisetype ::= FAIL */ |
| 154039 | | -{yymsp[0].minor.yy32 = OE_Fail;} |
| 154040 | | - break; |
| 154041 | | - case 268: /* cmd ::= DROP TRIGGER ifexists fullname */ |
| 154042 | | -{ |
| 154043 | | - sqlite3DropTrigger(pParse,yymsp[0].minor.yy609,yymsp[-1].minor.yy32); |
| 154044 | | -} |
| 154045 | | - break; |
| 154046 | | - case 269: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 154047 | | -{ |
| 154048 | | - sqlite3Attach(pParse, yymsp[-3].minor.yy46, yymsp[-1].minor.yy46, yymsp[0].minor.yy46); |
| 154049 | | -} |
| 154050 | | - break; |
| 154051 | | - case 270: /* cmd ::= DETACH database_kw_opt expr */ |
| 154052 | | -{ |
| 154053 | | - sqlite3Detach(pParse, yymsp[0].minor.yy46); |
| 154054 | | -} |
| 154055 | | - break; |
| 154056 | | - case 273: /* cmd ::= REINDEX */ |
| 155141 | + case 261: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ |
| 155142 | +{yylhsminor.yy447 = sqlite3TriggerUpdateStep(pParse, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy242, yymsp[-1].minor.yy202, yymsp[-6].minor.yy192, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy436);} |
| 155143 | + yymsp[-7].minor.yy447 = yylhsminor.yy447; |
| 155144 | + break; |
| 155145 | + case 262: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 155146 | +{ |
| 155147 | + yylhsminor.yy447 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy600,yymsp[-2].minor.yy539,yymsp[-6].minor.yy192,yymsp[-1].minor.yy318,yymsp[-7].minor.yy436,yymsp[0].minor.yy436);/*yylhsminor.yy447-overwrites-yymsp[-6].minor.yy192*/ |
| 155148 | +} |
| 155149 | + yymsp[-7].minor.yy447 = yylhsminor.yy447; |
| 155150 | + break; |
| 155151 | + case 263: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 155152 | +{yylhsminor.yy447 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy202, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy436);} |
| 155153 | + yymsp[-5].minor.yy447 = yylhsminor.yy447; |
| 155154 | + break; |
| 155155 | + case 264: /* trigger_cmd ::= scanpt select scanpt */ |
| 155156 | +{yylhsminor.yy447 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy539, yymsp[-2].minor.yy436, yymsp[0].minor.yy436); /*yylhsminor.yy447-overwrites-yymsp[-1].minor.yy539*/} |
| 155157 | + yymsp[-2].minor.yy447 = yylhsminor.yy447; |
| 155158 | + break; |
| 155159 | + case 265: /* expr ::= RAISE LP IGNORE RP */ |
| 155160 | +{ |
| 155161 | + yymsp[-3].minor.yy202 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); |
| 155162 | + if( yymsp[-3].minor.yy202 ){ |
| 155163 | + yymsp[-3].minor.yy202->affExpr = OE_Ignore; |
| 155164 | + } |
| 155165 | +} |
| 155166 | + break; |
| 155167 | + case 266: /* expr ::= RAISE LP raisetype COMMA nm RP */ |
| 155168 | +{ |
| 155169 | + yymsp[-5].minor.yy202 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); |
| 155170 | + if( yymsp[-5].minor.yy202 ) { |
| 155171 | + yymsp[-5].minor.yy202->affExpr = (char)yymsp[-3].minor.yy192; |
| 155172 | + } |
| 155173 | +} |
| 155174 | + break; |
| 155175 | + case 267: /* raisetype ::= ROLLBACK */ |
| 155176 | +{yymsp[0].minor.yy192 = OE_Rollback;} |
| 155177 | + break; |
| 155178 | + case 269: /* raisetype ::= FAIL */ |
| 155179 | +{yymsp[0].minor.yy192 = OE_Fail;} |
| 155180 | + break; |
| 155181 | + case 270: /* cmd ::= DROP TRIGGER ifexists fullname */ |
| 155182 | +{ |
| 155183 | + sqlite3DropTrigger(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy192); |
| 155184 | +} |
| 155185 | + break; |
| 155186 | + case 271: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 155187 | +{ |
| 155188 | + sqlite3Attach(pParse, yymsp[-3].minor.yy202, yymsp[-1].minor.yy202, yymsp[0].minor.yy202); |
| 155189 | +} |
| 155190 | + break; |
| 155191 | + case 272: /* cmd ::= DETACH database_kw_opt expr */ |
| 155192 | +{ |
| 155193 | + sqlite3Detach(pParse, yymsp[0].minor.yy202); |
| 155194 | +} |
| 155195 | + break; |
| 155196 | + case 275: /* cmd ::= REINDEX */ |
| 154057 | 155197 | {sqlite3Reindex(pParse, 0, 0);} |
| 154058 | 155198 | break; |
| 154059 | | - case 274: /* cmd ::= REINDEX nm dbnm */ |
| 155199 | + case 276: /* cmd ::= REINDEX nm dbnm */ |
| 154060 | 155200 | {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 154061 | 155201 | break; |
| 154062 | | - case 275: /* cmd ::= ANALYZE */ |
| 155202 | + case 277: /* cmd ::= ANALYZE */ |
| 154063 | 155203 | {sqlite3Analyze(pParse, 0, 0);} |
| 154064 | 155204 | break; |
| 154065 | | - case 276: /* cmd ::= ANALYZE nm dbnm */ |
| 155205 | + case 278: /* cmd ::= ANALYZE nm dbnm */ |
| 154066 | 155206 | {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 154067 | 155207 | break; |
| 154068 | | - case 277: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 155208 | + case 279: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 154069 | 155209 | { |
| 154070 | | - sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy609,&yymsp[0].minor.yy0); |
| 155210 | + sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy47,&yymsp[0].minor.yy0); |
| 154071 | 155211 | } |
| 154072 | 155212 | break; |
| 154073 | | - case 278: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 155213 | + case 280: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 154074 | 155214 | { |
| 154075 | 155215 | yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; |
| 154076 | 155216 | sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); |
| 154077 | 155217 | } |
| 154078 | 155218 | break; |
| 154079 | | - case 279: /* add_column_fullname ::= fullname */ |
| 155219 | + case 281: /* add_column_fullname ::= fullname */ |
| 154080 | 155220 | { |
| 154081 | 155221 | disableLookaside(pParse); |
| 154082 | | - sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy609); |
| 154083 | | -} |
| 154084 | | - break; |
| 154085 | | - case 280: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 154086 | | -{ |
| 154087 | | - sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy609, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); |
| 154088 | | -} |
| 154089 | | - break; |
| 154090 | | - case 281: /* cmd ::= create_vtab */ |
| 155222 | + sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy47); |
| 155223 | +} |
| 155224 | + break; |
| 155225 | + case 282: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 155226 | +{ |
| 155227 | + sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy47, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); |
| 155228 | +} |
| 155229 | + break; |
| 155230 | + case 283: /* cmd ::= create_vtab */ |
| 154091 | 155231 | {sqlite3VtabFinishParse(pParse,0);} |
| 154092 | 155232 | break; |
| 154093 | | - case 282: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 155233 | + case 284: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 154094 | 155234 | {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} |
| 154095 | 155235 | break; |
| 154096 | | - case 283: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 155236 | + case 285: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 154097 | 155237 | { |
| 154098 | | - sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy32); |
| 155238 | + sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy192); |
| 154099 | 155239 | } |
| 154100 | 155240 | break; |
| 154101 | | - case 284: /* vtabarg ::= */ |
| 155241 | + case 286: /* vtabarg ::= */ |
| 154102 | 155242 | {sqlite3VtabArgInit(pParse);} |
| 154103 | 155243 | break; |
| 154104 | | - case 285: /* vtabargtoken ::= ANY */ |
| 154105 | | - case 286: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==286); |
| 154106 | | - case 287: /* lp ::= LP */ yytestcase(yyruleno==287); |
| 155244 | + case 287: /* vtabargtoken ::= ANY */ |
| 155245 | + case 288: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==288); |
| 155246 | + case 289: /* lp ::= LP */ yytestcase(yyruleno==289); |
| 154107 | 155247 | {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} |
| 154108 | 155248 | break; |
| 154109 | | - case 288: /* with ::= WITH wqlist */ |
| 154110 | | - case 289: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==289); |
| 154111 | | -{ sqlite3WithPush(pParse, yymsp[0].minor.yy297, 1); } |
| 154112 | | - break; |
| 154113 | | - case 290: /* wqlist ::= nm eidlist_opt AS LP select RP */ |
| 154114 | | -{ |
| 154115 | | - yymsp[-5].minor.yy297 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy138, yymsp[-1].minor.yy25); /*A-overwrites-X*/ |
| 154116 | | -} |
| 154117 | | - break; |
| 154118 | | - case 291: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 154119 | | -{ |
| 154120 | | - yymsp[-7].minor.yy297 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy297, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy138, yymsp[-1].minor.yy25); |
| 154121 | | -} |
| 154122 | | - break; |
| 154123 | | - case 292: /* windowdefn_list ::= windowdefn */ |
| 154124 | | -{ yylhsminor.yy455 = yymsp[0].minor.yy455; } |
| 154125 | | - yymsp[0].minor.yy455 = yylhsminor.yy455; |
| 154126 | | - break; |
| 154127 | | - case 293: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 154128 | | -{ |
| 154129 | | - assert( yymsp[0].minor.yy455!=0 ); |
| 154130 | | - sqlite3WindowChain(pParse, yymsp[0].minor.yy455, yymsp[-2].minor.yy455); |
| 154131 | | - yymsp[0].minor.yy455->pNextWin = yymsp[-2].minor.yy455; |
| 154132 | | - yylhsminor.yy455 = yymsp[0].minor.yy455; |
| 154133 | | -} |
| 154134 | | - yymsp[-2].minor.yy455 = yylhsminor.yy455; |
| 154135 | | - break; |
| 154136 | | - case 294: /* windowdefn ::= nm AS LP window RP */ |
| 154137 | | -{ |
| 154138 | | - if( ALWAYS(yymsp[-1].minor.yy455) ){ |
| 154139 | | - yymsp[-1].minor.yy455->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n); |
| 154140 | | - } |
| 154141 | | - yylhsminor.yy455 = yymsp[-1].minor.yy455; |
| 154142 | | -} |
| 154143 | | - yymsp[-4].minor.yy455 = yylhsminor.yy455; |
| 154144 | | - break; |
| 154145 | | - case 295: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 154146 | | -{ |
| 154147 | | - yymsp[-4].minor.yy455 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy455, yymsp[-2].minor.yy138, yymsp[-1].minor.yy138, 0); |
| 154148 | | -} |
| 154149 | | - break; |
| 154150 | | - case 296: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 154151 | | -{ |
| 154152 | | - yylhsminor.yy455 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy455, yymsp[-2].minor.yy138, yymsp[-1].minor.yy138, &yymsp[-5].minor.yy0); |
| 154153 | | -} |
| 154154 | | - yymsp[-5].minor.yy455 = yylhsminor.yy455; |
| 154155 | | - break; |
| 154156 | | - case 297: /* window ::= ORDER BY sortlist frame_opt */ |
| 154157 | | -{ |
| 154158 | | - yymsp[-3].minor.yy455 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy455, 0, yymsp[-1].minor.yy138, 0); |
| 154159 | | -} |
| 154160 | | - break; |
| 154161 | | - case 298: /* window ::= nm ORDER BY sortlist frame_opt */ |
| 154162 | | -{ |
| 154163 | | - yylhsminor.yy455 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy455, 0, yymsp[-1].minor.yy138, &yymsp[-4].minor.yy0); |
| 154164 | | -} |
| 154165 | | - yymsp[-4].minor.yy455 = yylhsminor.yy455; |
| 154166 | | - break; |
| 154167 | | - case 299: /* window ::= frame_opt */ |
| 154168 | | - case 318: /* filter_over ::= over_clause */ yytestcase(yyruleno==318); |
| 154169 | | -{ |
| 154170 | | - yylhsminor.yy455 = yymsp[0].minor.yy455; |
| 154171 | | -} |
| 154172 | | - yymsp[0].minor.yy455 = yylhsminor.yy455; |
| 154173 | | - break; |
| 154174 | | - case 300: /* window ::= nm frame_opt */ |
| 154175 | | -{ |
| 154176 | | - yylhsminor.yy455 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy455, 0, 0, &yymsp[-1].minor.yy0); |
| 154177 | | -} |
| 154178 | | - yymsp[-1].minor.yy455 = yylhsminor.yy455; |
| 154179 | | - break; |
| 154180 | | - case 301: /* frame_opt ::= */ |
| 154181 | | -{ |
| 154182 | | - yymsp[1].minor.yy455 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0); |
| 154183 | | -} |
| 154184 | | - break; |
| 154185 | | - case 302: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 154186 | | -{ |
| 154187 | | - yylhsminor.yy455 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy32, yymsp[-1].minor.yy57.eType, yymsp[-1].minor.yy57.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy118); |
| 154188 | | -} |
| 154189 | | - yymsp[-2].minor.yy455 = yylhsminor.yy455; |
| 154190 | | - break; |
| 154191 | | - case 303: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 154192 | | -{ |
| 154193 | | - yylhsminor.yy455 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy32, yymsp[-3].minor.yy57.eType, yymsp[-3].minor.yy57.pExpr, yymsp[-1].minor.yy57.eType, yymsp[-1].minor.yy57.pExpr, yymsp[0].minor.yy118); |
| 154194 | | -} |
| 154195 | | - yymsp[-5].minor.yy455 = yylhsminor.yy455; |
| 154196 | | - break; |
| 154197 | | - case 305: /* frame_bound_s ::= frame_bound */ |
| 154198 | | - case 307: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==307); |
| 154199 | | -{yylhsminor.yy57 = yymsp[0].minor.yy57;} |
| 154200 | | - yymsp[0].minor.yy57 = yylhsminor.yy57; |
| 154201 | | - break; |
| 154202 | | - case 306: /* frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 154203 | | - case 308: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==308); |
| 154204 | | - case 310: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==310); |
| 154205 | | -{yylhsminor.yy57.eType = yymsp[-1].major; yylhsminor.yy57.pExpr = 0;} |
| 154206 | | - yymsp[-1].minor.yy57 = yylhsminor.yy57; |
| 154207 | | - break; |
| 154208 | | - case 309: /* frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 154209 | | -{yylhsminor.yy57.eType = yymsp[0].major; yylhsminor.yy57.pExpr = yymsp[-1].minor.yy46;} |
| 154210 | | - yymsp[-1].minor.yy57 = yylhsminor.yy57; |
| 154211 | | - break; |
| 154212 | | - case 311: /* frame_exclude_opt ::= */ |
| 154213 | | -{yymsp[1].minor.yy118 = 0;} |
| 154214 | | - break; |
| 154215 | | - case 312: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 154216 | | -{yymsp[-1].minor.yy118 = yymsp[0].minor.yy118;} |
| 154217 | | - break; |
| 154218 | | - case 313: /* frame_exclude ::= NO OTHERS */ |
| 154219 | | - case 314: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==314); |
| 154220 | | -{yymsp[-1].minor.yy118 = yymsp[-1].major; /*A-overwrites-X*/} |
| 154221 | | - break; |
| 154222 | | - case 315: /* frame_exclude ::= GROUP|TIES */ |
| 154223 | | -{yymsp[0].minor.yy118 = yymsp[0].major; /*A-overwrites-X*/} |
| 154224 | | - break; |
| 154225 | | - case 316: /* window_clause ::= WINDOW windowdefn_list */ |
| 154226 | | -{ yymsp[-1].minor.yy455 = yymsp[0].minor.yy455; } |
| 154227 | | - break; |
| 154228 | | - case 317: /* filter_over ::= filter_clause over_clause */ |
| 154229 | | -{ |
| 154230 | | - yymsp[0].minor.yy455->pFilter = yymsp[-1].minor.yy46; |
| 154231 | | - yylhsminor.yy455 = yymsp[0].minor.yy455; |
| 154232 | | -} |
| 154233 | | - yymsp[-1].minor.yy455 = yylhsminor.yy455; |
| 154234 | | - break; |
| 154235 | | - case 319: /* filter_over ::= filter_clause */ |
| 154236 | | -{ |
| 154237 | | - yylhsminor.yy455 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); |
| 154238 | | - if( yylhsminor.yy455 ){ |
| 154239 | | - yylhsminor.yy455->eFrmType = TK_FILTER; |
| 154240 | | - yylhsminor.yy455->pFilter = yymsp[0].minor.yy46; |
| 154241 | | - }else{ |
| 154242 | | - sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy46); |
| 154243 | | - } |
| 154244 | | -} |
| 154245 | | - yymsp[0].minor.yy455 = yylhsminor.yy455; |
| 154246 | | - break; |
| 154247 | | - case 320: /* over_clause ::= OVER LP window RP */ |
| 154248 | | -{ |
| 154249 | | - yymsp[-3].minor.yy455 = yymsp[-1].minor.yy455; |
| 154250 | | - assert( yymsp[-3].minor.yy455!=0 ); |
| 154251 | | -} |
| 154252 | | - break; |
| 154253 | | - case 321: /* over_clause ::= OVER nm */ |
| 154254 | | -{ |
| 154255 | | - yymsp[-1].minor.yy455 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); |
| 154256 | | - if( yymsp[-1].minor.yy455 ){ |
| 154257 | | - yymsp[-1].minor.yy455->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); |
| 154258 | | - } |
| 154259 | | -} |
| 154260 | | - break; |
| 154261 | | - case 322: /* filter_clause ::= FILTER LP WHERE expr RP */ |
| 154262 | | -{ yymsp[-4].minor.yy46 = yymsp[-1].minor.yy46; } |
| 155249 | + case 290: /* with ::= WITH wqlist */ |
| 155250 | + case 291: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==291); |
| 155251 | +{ sqlite3WithPush(pParse, yymsp[0].minor.yy131, 1); } |
| 155252 | + break; |
| 155253 | + case 292: /* wqlist ::= nm eidlist_opt AS LP select RP */ |
| 155254 | +{ |
| 155255 | + yymsp[-5].minor.yy131 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539); /*A-overwrites-X*/ |
| 155256 | +} |
| 155257 | + break; |
| 155258 | + case 293: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 155259 | +{ |
| 155260 | + yymsp[-7].minor.yy131 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy131, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy242, yymsp[-1].minor.yy539); |
| 155261 | +} |
| 155262 | + break; |
| 155263 | + case 294: /* windowdefn_list ::= windowdefn */ |
| 155264 | +{ yylhsminor.yy303 = yymsp[0].minor.yy303; } |
| 155265 | + yymsp[0].minor.yy303 = yylhsminor.yy303; |
| 155266 | + break; |
| 155267 | + case 295: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 155268 | +{ |
| 155269 | + assert( yymsp[0].minor.yy303!=0 ); |
| 155270 | + sqlite3WindowChain(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy303); |
| 155271 | + yymsp[0].minor.yy303->pNextWin = yymsp[-2].minor.yy303; |
| 155272 | + yylhsminor.yy303 = yymsp[0].minor.yy303; |
| 155273 | +} |
| 155274 | + yymsp[-2].minor.yy303 = yylhsminor.yy303; |
| 155275 | + break; |
| 155276 | + case 296: /* windowdefn ::= nm AS LP window RP */ |
| 155277 | +{ |
| 155278 | + if( ALWAYS(yymsp[-1].minor.yy303) ){ |
| 155279 | + yymsp[-1].minor.yy303->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n); |
| 155280 | + } |
| 155281 | + yylhsminor.yy303 = yymsp[-1].minor.yy303; |
| 155282 | +} |
| 155283 | + yymsp[-4].minor.yy303 = yylhsminor.yy303; |
| 155284 | + break; |
| 155285 | + case 297: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 155286 | +{ |
| 155287 | + yymsp[-4].minor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, 0); |
| 155288 | +} |
| 155289 | + break; |
| 155290 | + case 298: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 155291 | +{ |
| 155292 | + yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, yymsp[-2].minor.yy242, yymsp[-1].minor.yy242, &yymsp[-5].minor.yy0); |
| 155293 | +} |
| 155294 | + yymsp[-5].minor.yy303 = yylhsminor.yy303; |
| 155295 | + break; |
| 155296 | + case 299: /* window ::= ORDER BY sortlist frame_opt */ |
| 155297 | +{ |
| 155298 | + yymsp[-3].minor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, 0); |
| 155299 | +} |
| 155300 | + break; |
| 155301 | + case 300: /* window ::= nm ORDER BY sortlist frame_opt */ |
| 155302 | +{ |
| 155303 | + yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, yymsp[-1].minor.yy242, &yymsp[-4].minor.yy0); |
| 155304 | +} |
| 155305 | + yymsp[-4].minor.yy303 = yylhsminor.yy303; |
| 155306 | + break; |
| 155307 | + case 301: /* window ::= frame_opt */ |
| 155308 | + case 320: /* filter_over ::= over_clause */ yytestcase(yyruleno==320); |
| 155309 | +{ |
| 155310 | + yylhsminor.yy303 = yymsp[0].minor.yy303; |
| 155311 | +} |
| 155312 | + yymsp[0].minor.yy303 = yylhsminor.yy303; |
| 155313 | + break; |
| 155314 | + case 302: /* window ::= nm frame_opt */ |
| 155315 | +{ |
| 155316 | + yylhsminor.yy303 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy303, 0, 0, &yymsp[-1].minor.yy0); |
| 155317 | +} |
| 155318 | + yymsp[-1].minor.yy303 = yylhsminor.yy303; |
| 155319 | + break; |
| 155320 | + case 303: /* frame_opt ::= */ |
| 155321 | +{ |
| 155322 | + yymsp[1].minor.yy303 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0); |
| 155323 | +} |
| 155324 | + break; |
| 155325 | + case 304: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 155326 | +{ |
| 155327 | + yylhsminor.yy303 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy192, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy58); |
| 155328 | +} |
| 155329 | + yymsp[-2].minor.yy303 = yylhsminor.yy303; |
| 155330 | + break; |
| 155331 | + case 305: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 155332 | +{ |
| 155333 | + yylhsminor.yy303 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy192, yymsp[-3].minor.yy77.eType, yymsp[-3].minor.yy77.pExpr, yymsp[-1].minor.yy77.eType, yymsp[-1].minor.yy77.pExpr, yymsp[0].minor.yy58); |
| 155334 | +} |
| 155335 | + yymsp[-5].minor.yy303 = yylhsminor.yy303; |
| 155336 | + break; |
| 155337 | + case 307: /* frame_bound_s ::= frame_bound */ |
| 155338 | + case 309: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==309); |
| 155339 | +{yylhsminor.yy77 = yymsp[0].minor.yy77;} |
| 155340 | + yymsp[0].minor.yy77 = yylhsminor.yy77; |
| 155341 | + break; |
| 155342 | + case 308: /* frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 155343 | + case 310: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==310); |
| 155344 | + case 312: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==312); |
| 155345 | +{yylhsminor.yy77.eType = yymsp[-1].major; yylhsminor.yy77.pExpr = 0;} |
| 155346 | + yymsp[-1].minor.yy77 = yylhsminor.yy77; |
| 155347 | + break; |
| 155348 | + case 311: /* frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 155349 | +{yylhsminor.yy77.eType = yymsp[0].major; yylhsminor.yy77.pExpr = yymsp[-1].minor.yy202;} |
| 155350 | + yymsp[-1].minor.yy77 = yylhsminor.yy77; |
| 155351 | + break; |
| 155352 | + case 313: /* frame_exclude_opt ::= */ |
| 155353 | +{yymsp[1].minor.yy58 = 0;} |
| 155354 | + break; |
| 155355 | + case 314: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 155356 | +{yymsp[-1].minor.yy58 = yymsp[0].minor.yy58;} |
| 155357 | + break; |
| 155358 | + case 315: /* frame_exclude ::= NO OTHERS */ |
| 155359 | + case 316: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==316); |
| 155360 | +{yymsp[-1].minor.yy58 = yymsp[-1].major; /*A-overwrites-X*/} |
| 155361 | + break; |
| 155362 | + case 317: /* frame_exclude ::= GROUP|TIES */ |
| 155363 | +{yymsp[0].minor.yy58 = yymsp[0].major; /*A-overwrites-X*/} |
| 155364 | + break; |
| 155365 | + case 318: /* window_clause ::= WINDOW windowdefn_list */ |
| 155366 | +{ yymsp[-1].minor.yy303 = yymsp[0].minor.yy303; } |
| 155367 | + break; |
| 155368 | + case 319: /* filter_over ::= filter_clause over_clause */ |
| 155369 | +{ |
| 155370 | + yymsp[0].minor.yy303->pFilter = yymsp[-1].minor.yy202; |
| 155371 | + yylhsminor.yy303 = yymsp[0].minor.yy303; |
| 155372 | +} |
| 155373 | + yymsp[-1].minor.yy303 = yylhsminor.yy303; |
| 155374 | + break; |
| 155375 | + case 321: /* filter_over ::= filter_clause */ |
| 155376 | +{ |
| 155377 | + yylhsminor.yy303 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); |
| 155378 | + if( yylhsminor.yy303 ){ |
| 155379 | + yylhsminor.yy303->eFrmType = TK_FILTER; |
| 155380 | + yylhsminor.yy303->pFilter = yymsp[0].minor.yy202; |
| 155381 | + }else{ |
| 155382 | + sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy202); |
| 155383 | + } |
| 155384 | +} |
| 155385 | + yymsp[0].minor.yy303 = yylhsminor.yy303; |
| 155386 | + break; |
| 155387 | + case 322: /* over_clause ::= OVER LP window RP */ |
| 155388 | +{ |
| 155389 | + yymsp[-3].minor.yy303 = yymsp[-1].minor.yy303; |
| 155390 | + assert( yymsp[-3].minor.yy303!=0 ); |
| 155391 | +} |
| 155392 | + break; |
| 155393 | + case 323: /* over_clause ::= OVER nm */ |
| 155394 | +{ |
| 155395 | + yymsp[-1].minor.yy303 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); |
| 155396 | + if( yymsp[-1].minor.yy303 ){ |
| 155397 | + yymsp[-1].minor.yy303->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); |
| 155398 | + } |
| 155399 | +} |
| 155400 | + break; |
| 155401 | + case 324: /* filter_clause ::= FILTER LP WHERE expr RP */ |
| 155402 | +{ yymsp[-4].minor.yy202 = yymsp[-1].minor.yy202; } |
| 154263 | 155403 | break; |
| 154264 | 155404 | default: |
| 154265 | | - /* (323) input ::= cmdlist */ yytestcase(yyruleno==323); |
| 154266 | | - /* (324) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==324); |
| 154267 | | - /* (325) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=325); |
| 154268 | | - /* (326) ecmd ::= SEMI */ yytestcase(yyruleno==326); |
| 154269 | | - /* (327) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==327); |
| 154270 | | - /* (328) ecmd ::= explain cmdx */ yytestcase(yyruleno==328); |
| 154271 | | - /* (329) trans_opt ::= */ yytestcase(yyruleno==329); |
| 154272 | | - /* (330) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==330); |
| 154273 | | - /* (331) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==331); |
| 154274 | | - /* (332) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==332); |
| 154275 | | - /* (333) savepoint_opt ::= */ yytestcase(yyruleno==333); |
| 154276 | | - /* (334) cmd ::= create_table create_table_args */ yytestcase(yyruleno==334); |
| 154277 | | - /* (335) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==335); |
| 154278 | | - /* (336) columnlist ::= columnname carglist */ yytestcase(yyruleno==336); |
| 154279 | | - /* (337) nm ::= ID|INDEXED */ yytestcase(yyruleno==337); |
| 154280 | | - /* (338) nm ::= STRING */ yytestcase(yyruleno==338); |
| 154281 | | - /* (339) nm ::= JOIN_KW */ yytestcase(yyruleno==339); |
| 154282 | | - /* (340) typetoken ::= typename */ yytestcase(yyruleno==340); |
| 154283 | | - /* (341) typename ::= ID|STRING */ yytestcase(yyruleno==341); |
| 154284 | | - /* (342) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=342); |
| 154285 | | - /* (343) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=343); |
| 154286 | | - /* (344) carglist ::= carglist ccons */ yytestcase(yyruleno==344); |
| 154287 | | - /* (345) carglist ::= */ yytestcase(yyruleno==345); |
| 154288 | | - /* (346) ccons ::= NULL onconf */ yytestcase(yyruleno==346); |
| 154289 | | - /* (347) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==347); |
| 154290 | | - /* (348) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==348); |
| 154291 | | - /* (349) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=349); |
| 154292 | | - /* (350) tconscomma ::= */ yytestcase(yyruleno==350); |
| 154293 | | - /* (351) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=351); |
| 154294 | | - /* (352) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=352); |
| 154295 | | - /* (353) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=353); |
| 154296 | | - /* (354) oneselect ::= values */ yytestcase(yyruleno==354); |
| 154297 | | - /* (355) sclp ::= selcollist COMMA */ yytestcase(yyruleno==355); |
| 154298 | | - /* (356) as ::= ID|STRING */ yytestcase(yyruleno==356); |
| 154299 | | - /* (357) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=357); |
| 154300 | | - /* (358) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==358); |
| 154301 | | - /* (359) exprlist ::= nexprlist */ yytestcase(yyruleno==359); |
| 154302 | | - /* (360) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=360); |
| 154303 | | - /* (361) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=361); |
| 154304 | | - /* (362) nmnum ::= ON */ yytestcase(yyruleno==362); |
| 154305 | | - /* (363) nmnum ::= DELETE */ yytestcase(yyruleno==363); |
| 154306 | | - /* (364) nmnum ::= DEFAULT */ yytestcase(yyruleno==364); |
| 154307 | | - /* (365) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==365); |
| 154308 | | - /* (366) foreach_clause ::= */ yytestcase(yyruleno==366); |
| 154309 | | - /* (367) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==367); |
| 154310 | | - /* (368) trnm ::= nm */ yytestcase(yyruleno==368); |
| 154311 | | - /* (369) tridxby ::= */ yytestcase(yyruleno==369); |
| 154312 | | - /* (370) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==370); |
| 154313 | | - /* (371) database_kw_opt ::= */ yytestcase(yyruleno==371); |
| 154314 | | - /* (372) kwcolumn_opt ::= */ yytestcase(yyruleno==372); |
| 154315 | | - /* (373) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==373); |
| 154316 | | - /* (374) vtabarglist ::= vtabarg */ yytestcase(yyruleno==374); |
| 154317 | | - /* (375) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==375); |
| 154318 | | - /* (376) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==376); |
| 154319 | | - /* (377) anylist ::= */ yytestcase(yyruleno==377); |
| 154320 | | - /* (378) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==378); |
| 154321 | | - /* (379) anylist ::= anylist ANY */ yytestcase(yyruleno==379); |
| 154322 | | - /* (380) with ::= */ yytestcase(yyruleno==380); |
| 155405 | + /* (325) input ::= cmdlist */ yytestcase(yyruleno==325); |
| 155406 | + /* (326) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==326); |
| 155407 | + /* (327) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=327); |
| 155408 | + /* (328) ecmd ::= SEMI */ yytestcase(yyruleno==328); |
| 155409 | + /* (329) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==329); |
| 155410 | + /* (330) ecmd ::= explain cmdx */ yytestcase(yyruleno==330); |
| 155411 | + /* (331) trans_opt ::= */ yytestcase(yyruleno==331); |
| 155412 | + /* (332) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==332); |
| 155413 | + /* (333) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==333); |
| 155414 | + /* (334) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==334); |
| 155415 | + /* (335) savepoint_opt ::= */ yytestcase(yyruleno==335); |
| 155416 | + /* (336) cmd ::= create_table create_table_args */ yytestcase(yyruleno==336); |
| 155417 | + /* (337) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==337); |
| 155418 | + /* (338) columnlist ::= columnname carglist */ yytestcase(yyruleno==338); |
| 155419 | + /* (339) nm ::= ID|INDEXED */ yytestcase(yyruleno==339); |
| 155420 | + /* (340) nm ::= STRING */ yytestcase(yyruleno==340); |
| 155421 | + /* (341) nm ::= JOIN_KW */ yytestcase(yyruleno==341); |
| 155422 | + /* (342) typetoken ::= typename */ yytestcase(yyruleno==342); |
| 155423 | + /* (343) typename ::= ID|STRING */ yytestcase(yyruleno==343); |
| 155424 | + /* (344) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=344); |
| 155425 | + /* (345) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=345); |
| 155426 | + /* (346) carglist ::= carglist ccons */ yytestcase(yyruleno==346); |
| 155427 | + /* (347) carglist ::= */ yytestcase(yyruleno==347); |
| 155428 | + /* (348) ccons ::= NULL onconf */ yytestcase(yyruleno==348); |
| 155429 | + /* (349) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==349); |
| 155430 | + /* (350) ccons ::= AS generated */ yytestcase(yyruleno==350); |
| 155431 | + /* (351) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==351); |
| 155432 | + /* (352) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==352); |
| 155433 | + /* (353) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=353); |
| 155434 | + /* (354) tconscomma ::= */ yytestcase(yyruleno==354); |
| 155435 | + /* (355) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=355); |
| 155436 | + /* (356) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=356); |
| 155437 | + /* (357) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=357); |
| 155438 | + /* (358) oneselect ::= values */ yytestcase(yyruleno==358); |
| 155439 | + /* (359) sclp ::= selcollist COMMA */ yytestcase(yyruleno==359); |
| 155440 | + /* (360) as ::= ID|STRING */ yytestcase(yyruleno==360); |
| 155441 | + /* (361) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=361); |
| 155442 | + /* (362) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==362); |
| 155443 | + /* (363) exprlist ::= nexprlist */ yytestcase(yyruleno==363); |
| 155444 | + /* (364) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=364); |
| 155445 | + /* (365) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=365); |
| 155446 | + /* (366) nmnum ::= ON */ yytestcase(yyruleno==366); |
| 155447 | + /* (367) nmnum ::= DELETE */ yytestcase(yyruleno==367); |
| 155448 | + /* (368) nmnum ::= DEFAULT */ yytestcase(yyruleno==368); |
| 155449 | + /* (369) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==369); |
| 155450 | + /* (370) foreach_clause ::= */ yytestcase(yyruleno==370); |
| 155451 | + /* (371) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==371); |
| 155452 | + /* (372) trnm ::= nm */ yytestcase(yyruleno==372); |
| 155453 | + /* (373) tridxby ::= */ yytestcase(yyruleno==373); |
| 155454 | + /* (374) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==374); |
| 155455 | + /* (375) database_kw_opt ::= */ yytestcase(yyruleno==375); |
| 155456 | + /* (376) kwcolumn_opt ::= */ yytestcase(yyruleno==376); |
| 155457 | + /* (377) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==377); |
| 155458 | + /* (378) vtabarglist ::= vtabarg */ yytestcase(yyruleno==378); |
| 155459 | + /* (379) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==379); |
| 155460 | + /* (380) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==380); |
| 155461 | + /* (381) anylist ::= */ yytestcase(yyruleno==381); |
| 155462 | + /* (382) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==382); |
| 155463 | + /* (383) anylist ::= anylist ANY */ yytestcase(yyruleno==383); |
| 155464 | + /* (384) with ::= */ yytestcase(yyruleno==384); |
| 154323 | 155465 | break; |
| 154324 | 155466 | /********** End reduce actions ************************************************/ |
| 154325 | 155467 | }; |
| 154326 | 155468 | assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) ); |
| 154327 | 155469 | yygoto = yyRuleInfoLhs[yyruleno]; |
| | @@ -154613,12 +155755,12 @@ |
| 154613 | 155755 | #ifdef YYFALLBACK |
| 154614 | 155756 | assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ); |
| 154615 | 155757 | return yyFallback[iToken]; |
| 154616 | 155758 | #else |
| 154617 | 155759 | (void)iToken; |
| 154618 | | -#endif |
| 154619 | 155760 | return 0; |
| 155761 | +#endif |
| 154620 | 155762 | } |
| 154621 | 155763 | |
| 154622 | 155764 | /************** End of parse.c ***********************************************/ |
| 154623 | 155765 | /************** Begin file tokenize.c ****************************************/ |
| 154624 | 155766 | /* |
| | @@ -154779,24 +155921,24 @@ |
| 154779 | 155921 | ** might be implemented more directly using a hand-written hash table. |
| 154780 | 155922 | ** But by using this automatically generated code, the size of the code |
| 154781 | 155923 | ** is substantially reduced. This is important for embedded applications |
| 154782 | 155924 | ** on platforms with limited memory. |
| 154783 | 155925 | */ |
| 154784 | | -/* Hash score: 221 */ |
| 154785 | | -/* zKWText[] encodes 967 bytes of keyword text in 638 bytes */ |
| 155926 | +/* Hash score: 227 */ |
| 155927 | +/* zKWText[] encodes 984 bytes of keyword text in 648 bytes */ |
| 154786 | 155928 | /* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */ |
| 154787 | 155929 | /* ABLEFTHENDEFERRABLELSEXCLUDELETEMPORARYISNULLSAVEPOINTERSECT */ |
| 154788 | 155930 | /* IESNOTNULLIKEXCEPTRANSACTIONATURALTERAISEXCLUSIVEXISTS */ |
| 154789 | | -/* CONSTRAINTOFFSETRIGGEREFERENCESUNIQUERYWITHOUTERELEASEATTACH */ |
| 154790 | | -/* AVINGLOBEGINNERANGEBETWEENOTHINGROUPSCASCADETACHCASECOLLATE */ |
| 154791 | | -/* CREATECURRENT_DATEIMMEDIATEJOINSERTMATCHPLANALYZEPRAGMABORT */ |
| 154792 | | -/* UPDATEVALUESVIRTUALASTWHENWHERECURSIVEAFTERENAMEANDEFAULT */ |
| 154793 | | -/* AUTOINCREMENTCASTCOLUMNCOMMITCONFLICTCROSSCURRENT_TIMESTAMP */ |
| 154794 | | -/* ARTITIONDEFERREDISTINCTDROPRECEDINGFAILIMITFILTEREPLACEFIRST */ |
| 154795 | | -/* FOLLOWINGFROMFULLIFORDERESTRICTOTHERSOVERIGHTROLLBACKROWS */ |
| 155931 | +/* CONSTRAINTOFFSETRIGGERANGENERATEDETACHAVINGLOBEGINNEREFERENCES */ |
| 155932 | +/* UNIQUERYWITHOUTERELEASEATTACHBETWEENOTHINGROUPSCASCADEFAULT */ |
| 155933 | +/* CASECOLLATECREATECURRENT_DATEIMMEDIATEJOINSERTMATCHPLANALYZE */ |
| 155934 | +/* PRAGMABORTUPDATEVALUESVIRTUALWAYSWHENWHERECURSIVEAFTERENAMEAND */ |
| 155935 | +/* EFERREDISTINCTAUTOINCREMENTCASTCOLUMNCOMMITCONFLICTCROSS */ |
| 155936 | +/* CURRENT_TIMESTAMPARTITIONDROPRECEDINGFAILASTFILTEREPLACEFIRST */ |
| 155937 | +/* FOLLOWINGFROMFULLIMITIFORDERESTRICTOTHERSOVERIGHTROLLBACKROWS */ |
| 154796 | 155938 | /* UNBOUNDEDUNIONUSINGVACUUMVIEWINDOWBYINITIALLYPRIMARY */ |
| 154797 | | -static const char zKWText[637] = { |
| 155939 | +static const char zKWText[647] = { |
| 154798 | 155940 | 'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H', |
| 154799 | 155941 | 'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G', |
| 154800 | 155942 | 'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A', |
| 154801 | 155943 | 'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F', |
| 154802 | 155944 | 'E','R','R','A','B','L','E','L','S','E','X','C','L','U','D','E','L','E', |
| | @@ -154803,97 +155945,100 @@ |
| 154803 | 155945 | 'T','E','M','P','O','R','A','R','Y','I','S','N','U','L','L','S','A','V', |
| 154804 | 155946 | 'E','P','O','I','N','T','E','R','S','E','C','T','I','E','S','N','O','T', |
| 154805 | 155947 | 'N','U','L','L','I','K','E','X','C','E','P','T','R','A','N','S','A','C', |
| 154806 | 155948 | 'T','I','O','N','A','T','U','R','A','L','T','E','R','A','I','S','E','X', |
| 154807 | 155949 | 'C','L','U','S','I','V','E','X','I','S','T','S','C','O','N','S','T','R', |
| 154808 | | - 'A','I','N','T','O','F','F','S','E','T','R','I','G','G','E','R','E','F', |
| 154809 | | - 'E','R','E','N','C','E','S','U','N','I','Q','U','E','R','Y','W','I','T', |
| 154810 | | - 'H','O','U','T','E','R','E','L','E','A','S','E','A','T','T','A','C','H', |
| 154811 | | - 'A','V','I','N','G','L','O','B','E','G','I','N','N','E','R','A','N','G', |
| 154812 | | - 'E','B','E','T','W','E','E','N','O','T','H','I','N','G','R','O','U','P', |
| 154813 | | - 'S','C','A','S','C','A','D','E','T','A','C','H','C','A','S','E','C','O', |
| 154814 | | - 'L','L','A','T','E','C','R','E','A','T','E','C','U','R','R','E','N','T', |
| 154815 | | - '_','D','A','T','E','I','M','M','E','D','I','A','T','E','J','O','I','N', |
| 154816 | | - 'S','E','R','T','M','A','T','C','H','P','L','A','N','A','L','Y','Z','E', |
| 154817 | | - 'P','R','A','G','M','A','B','O','R','T','U','P','D','A','T','E','V','A', |
| 154818 | | - 'L','U','E','S','V','I','R','T','U','A','L','A','S','T','W','H','E','N', |
| 154819 | | - 'W','H','E','R','E','C','U','R','S','I','V','E','A','F','T','E','R','E', |
| 154820 | | - 'N','A','M','E','A','N','D','E','F','A','U','L','T','A','U','T','O','I', |
| 154821 | | - 'N','C','R','E','M','E','N','T','C','A','S','T','C','O','L','U','M','N', |
| 154822 | | - 'C','O','M','M','I','T','C','O','N','F','L','I','C','T','C','R','O','S', |
| 154823 | | - 'S','C','U','R','R','E','N','T','_','T','I','M','E','S','T','A','M','P', |
| 154824 | | - 'A','R','T','I','T','I','O','N','D','E','F','E','R','R','E','D','I','S', |
| 154825 | | - 'T','I','N','C','T','D','R','O','P','R','E','C','E','D','I','N','G','F', |
| 154826 | | - 'A','I','L','I','M','I','T','F','I','L','T','E','R','E','P','L','A','C', |
| 154827 | | - 'E','F','I','R','S','T','F','O','L','L','O','W','I','N','G','F','R','O', |
| 154828 | | - 'M','F','U','L','L','I','F','O','R','D','E','R','E','S','T','R','I','C', |
| 154829 | | - 'T','O','T','H','E','R','S','O','V','E','R','I','G','H','T','R','O','L', |
| 154830 | | - 'L','B','A','C','K','R','O','W','S','U','N','B','O','U','N','D','E','D', |
| 154831 | | - 'U','N','I','O','N','U','S','I','N','G','V','A','C','U','U','M','V','I', |
| 154832 | | - 'E','W','I','N','D','O','W','B','Y','I','N','I','T','I','A','L','L','Y', |
| 154833 | | - 'P','R','I','M','A','R','Y', |
| 155950 | + 'A','I','N','T','O','F','F','S','E','T','R','I','G','G','E','R','A','N', |
| 155951 | + 'G','E','N','E','R','A','T','E','D','E','T','A','C','H','A','V','I','N', |
| 155952 | + 'G','L','O','B','E','G','I','N','N','E','R','E','F','E','R','E','N','C', |
| 155953 | + 'E','S','U','N','I','Q','U','E','R','Y','W','I','T','H','O','U','T','E', |
| 155954 | + 'R','E','L','E','A','S','E','A','T','T','A','C','H','B','E','T','W','E', |
| 155955 | + 'E','N','O','T','H','I','N','G','R','O','U','P','S','C','A','S','C','A', |
| 155956 | + 'D','E','F','A','U','L','T','C','A','S','E','C','O','L','L','A','T','E', |
| 155957 | + 'C','R','E','A','T','E','C','U','R','R','E','N','T','_','D','A','T','E', |
| 155958 | + 'I','M','M','E','D','I','A','T','E','J','O','I','N','S','E','R','T','M', |
| 155959 | + 'A','T','C','H','P','L','A','N','A','L','Y','Z','E','P','R','A','G','M', |
| 155960 | + 'A','B','O','R','T','U','P','D','A','T','E','V','A','L','U','E','S','V', |
| 155961 | + 'I','R','T','U','A','L','W','A','Y','S','W','H','E','N','W','H','E','R', |
| 155962 | + 'E','C','U','R','S','I','V','E','A','F','T','E','R','E','N','A','M','E', |
| 155963 | + 'A','N','D','E','F','E','R','R','E','D','I','S','T','I','N','C','T','A', |
| 155964 | + 'U','T','O','I','N','C','R','E','M','E','N','T','C','A','S','T','C','O', |
| 155965 | + 'L','U','M','N','C','O','M','M','I','T','C','O','N','F','L','I','C','T', |
| 155966 | + 'C','R','O','S','S','C','U','R','R','E','N','T','_','T','I','M','E','S', |
| 155967 | + 'T','A','M','P','A','R','T','I','T','I','O','N','D','R','O','P','R','E', |
| 155968 | + 'C','E','D','I','N','G','F','A','I','L','A','S','T','F','I','L','T','E', |
| 155969 | + 'R','E','P','L','A','C','E','F','I','R','S','T','F','O','L','L','O','W', |
| 155970 | + 'I','N','G','F','R','O','M','F','U','L','L','I','M','I','T','I','F','O', |
| 155971 | + 'R','D','E','R','E','S','T','R','I','C','T','O','T','H','E','R','S','O', |
| 155972 | + 'V','E','R','I','G','H','T','R','O','L','L','B','A','C','K','R','O','W', |
| 155973 | + 'S','U','N','B','O','U','N','D','E','D','U','N','I','O','N','U','S','I', |
| 155974 | + 'N','G','V','A','C','U','U','M','V','I','E','W','I','N','D','O','W','B', |
| 155975 | + 'Y','I','N','I','T','I','A','L','L','Y','P','R','I','M','A','R','Y', |
| 154834 | 155976 | }; |
| 154835 | 155977 | /* aKWHash[i] is the hash value for the i-th keyword */ |
| 154836 | 155978 | static const unsigned char aKWHash[127] = { |
| 154837 | | - 82, 113, 130, 80, 110, 29, 0, 0, 89, 0, 83, 70, 0, |
| 154838 | | - 53, 35, 84, 15, 0, 129, 92, 64, 124, 131, 19, 0, 0, |
| 154839 | | - 136, 0, 134, 126, 0, 22, 100, 0, 9, 0, 0, 121, 78, |
| 154840 | | - 0, 76, 6, 0, 58, 97, 143, 0, 132, 108, 0, 0, 48, |
| 154841 | | - 0, 111, 24, 0, 17, 0, 137, 63, 23, 26, 5, 65, 138, |
| 154842 | | - 103, 120, 0, 142, 114, 69, 141, 66, 118, 72, 0, 98, 0, |
| 154843 | | - 107, 41, 0, 106, 0, 0, 0, 102, 99, 104, 109, 123, 14, |
| 154844 | | - 50, 122, 0, 87, 0, 139, 119, 140, 68, 127, 135, 86, 81, |
| 154845 | | - 37, 91, 117, 0, 0, 101, 51, 128, 125, 0, 133, 0, 0, |
| 154846 | | - 44, 0, 93, 67, 39, 0, 20, 45, 115, 88, |
| 155979 | + 84, 102, 132, 82, 114, 29, 0, 0, 91, 0, 85, 72, 0, |
| 155980 | + 53, 35, 86, 15, 0, 42, 94, 54, 126, 133, 19, 0, 0, |
| 155981 | + 138, 0, 40, 128, 0, 22, 104, 0, 9, 0, 0, 122, 80, |
| 155982 | + 0, 78, 6, 0, 65, 99, 145, 0, 134, 112, 0, 0, 48, |
| 155983 | + 0, 100, 24, 0, 17, 0, 27, 70, 23, 26, 5, 60, 140, |
| 155984 | + 107, 121, 0, 73, 101, 71, 143, 61, 119, 74, 0, 49, 0, |
| 155985 | + 11, 41, 0, 110, 0, 0, 0, 106, 10, 108, 113, 124, 14, |
| 155986 | + 50, 123, 0, 89, 0, 18, 120, 142, 56, 129, 137, 88, 83, |
| 155987 | + 37, 30, 125, 0, 0, 105, 51, 130, 127, 0, 34, 0, 0, |
| 155988 | + 44, 0, 95, 38, 39, 0, 20, 45, 116, 90, |
| 154847 | 155989 | }; |
| 154848 | 155990 | /* aKWNext[] forms the hash collision chain. If aKWHash[i]==0 |
| 154849 | 155991 | ** then the i-th keyword has no more hash collisions. Otherwise, |
| 154850 | 155992 | ** the next keyword with the same hash is aKWHash[i]-1. */ |
| 154851 | | -static const unsigned char aKWNext[143] = { |
| 154852 | | - 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, |
| 154853 | | - 0, 2, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, |
| 154854 | | - 0, 0, 0, 21, 0, 0, 0, 0, 12, 0, 0, 0, 0, |
| 154855 | | - 0, 0, 0, 7, 0, 36, 0, 0, 28, 0, 0, 0, 31, |
| 154856 | | - 0, 0, 0, 40, 0, 0, 0, 0, 0, 60, 0, 54, 0, |
| 154857 | | - 0, 38, 47, 0, 0, 0, 3, 0, 0, 74, 1, 73, 0, |
| 154858 | | - 0, 0, 52, 0, 0, 0, 0, 0, 0, 57, 59, 56, 30, |
| 154859 | | - 0, 0, 0, 46, 0, 16, 49, 10, 0, 0, 0, 0, 0, |
| 154860 | | - 0, 0, 11, 79, 95, 0, 0, 8, 0, 112, 0, 105, 0, |
| 154861 | | - 43, 62, 0, 77, 0, 116, 0, 61, 0, 0, 94, 42, 55, |
| 154862 | | - 0, 75, 34, 90, 32, 33, 27, 25, 18, 96, 0, 71, 85, |
| 155993 | +static const unsigned char aKWNext[145] = { |
| 155994 | + 0, 0, 0, 0, 4, 0, 43, 0, 0, 103, 111, 0, 0, |
| 155995 | + 0, 2, 0, 0, 141, 0, 0, 0, 13, 0, 0, 0, 0, |
| 155996 | + 139, 0, 0, 118, 52, 0, 0, 135, 12, 0, 0, 62, 0, |
| 155997 | + 136, 0, 131, 0, 0, 36, 0, 0, 28, 77, 0, 0, 0, |
| 155998 | + 0, 59, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 155999 | + 0, 69, 0, 0, 0, 0, 0, 144, 3, 0, 58, 0, 1, |
| 156000 | + 75, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 64, 66, |
| 156001 | + 63, 0, 0, 0, 0, 46, 0, 16, 0, 115, 0, 0, 0, |
| 156002 | + 0, 0, 0, 0, 0, 0, 0, 81, 97, 0, 8, 0, 109, |
| 156003 | + 21, 7, 67, 0, 79, 93, 117, 0, 0, 68, 0, 0, 96, |
| 156004 | + 0, 55, 0, 76, 0, 92, 32, 33, 57, 25, 0, 98, 0, |
| 156005 | + 0, 87, |
| 154863 | 156006 | }; |
| 154864 | 156007 | /* aKWLen[i] is the length (in bytes) of the i-th keyword */ |
| 154865 | | -static const unsigned char aKWLen[143] = { |
| 156008 | +static const unsigned char aKWLen[145] = { |
| 154866 | 156009 | 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6, |
| 154867 | 156010 | 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 7, |
| 154868 | 156011 | 6, 9, 4, 2, 6, 5, 9, 9, 4, 7, 3, 2, 4, |
| 154869 | 156012 | 4, 6, 11, 6, 2, 7, 5, 5, 9, 6, 10, 4, 6, |
| 154870 | | - 2, 3, 7, 10, 6, 5, 7, 4, 5, 7, 6, 6, 4, |
| 154871 | | - 5, 5, 5, 7, 7, 6, 5, 7, 3, 6, 4, 7, 6, |
| 154872 | | - 12, 9, 4, 6, 5, 4, 7, 6, 5, 6, 6, 7, 4, |
| 154873 | | - 4, 5, 9, 5, 6, 3, 7, 13, 2, 2, 4, 6, 6, |
| 154874 | | - 8, 5, 17, 12, 7, 9, 8, 8, 2, 4, 9, 4, 5, |
| 154875 | | - 6, 7, 5, 9, 4, 4, 2, 5, 8, 6, 4, 5, 8, |
| 154876 | | - 4, 3, 9, 5, 5, 6, 4, 6, 2, 2, 9, 3, 7, |
| 156013 | + 2, 3, 7, 5, 9, 6, 6, 4, 5, 5, 10, 6, 5, |
| 156014 | + 7, 4, 5, 7, 6, 7, 7, 6, 5, 7, 3, 7, 4, |
| 156015 | + 7, 6, 12, 9, 4, 6, 5, 4, 7, 6, 5, 6, 6, |
| 156016 | + 7, 6, 4, 5, 9, 5, 6, 3, 8, 8, 2, 13, 2, |
| 156017 | + 2, 4, 6, 6, 8, 5, 17, 12, 7, 9, 4, 9, 4, |
| 156018 | + 4, 6, 7, 5, 9, 4, 4, 5, 2, 5, 8, 6, 4, |
| 156019 | + 5, 8, 4, 3, 9, 5, 5, 6, 4, 6, 2, 2, 9, |
| 156020 | + 3, 7, |
| 154877 | 156021 | }; |
| 154878 | 156022 | /* aKWOffset[i] is the index into zKWText[] of the start of |
| 154879 | 156023 | ** the text for the i-th keyword. */ |
| 154880 | | -static const unsigned short int aKWOffset[143] = { |
| 156024 | +static const unsigned short int aKWOffset[145] = { |
| 154881 | 156025 | 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33, |
| 154882 | 156026 | 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81, |
| 154883 | 156027 | 86, 90, 90, 94, 99, 101, 105, 111, 119, 123, 123, 123, 126, |
| 154884 | 156028 | 129, 132, 137, 142, 146, 147, 152, 156, 160, 168, 174, 181, 184, |
| 154885 | | - 184, 187, 189, 195, 205, 208, 213, 213, 217, 221, 228, 233, 238, |
| 154886 | | - 241, 244, 248, 253, 259, 265, 265, 271, 272, 276, 282, 286, 293, |
| 154887 | | - 299, 311, 320, 322, 328, 333, 335, 342, 347, 352, 358, 364, 370, |
| 154888 | | - 374, 378, 381, 390, 394, 400, 402, 409, 411, 413, 422, 426, 432, |
| 154889 | | - 438, 446, 451, 451, 451, 467, 476, 483, 484, 491, 494, 503, 506, |
| 154890 | | - 511, 516, 523, 528, 537, 541, 545, 547, 551, 559, 565, 568, 573, |
| 154891 | | - 581, 581, 585, 594, 599, 604, 610, 613, 616, 619, 621, 626, 630, |
| 156029 | + 184, 187, 189, 195, 198, 206, 211, 216, 219, 222, 226, 236, 239, |
| 156030 | + 244, 244, 248, 252, 259, 265, 271, 277, 277, 283, 284, 288, 295, |
| 156031 | + 299, 306, 312, 324, 333, 335, 341, 346, 348, 355, 360, 365, 371, |
| 156032 | + 377, 382, 388, 392, 395, 404, 408, 414, 416, 423, 424, 431, 433, |
| 156033 | + 435, 444, 448, 454, 460, 468, 473, 473, 473, 489, 498, 501, 510, |
| 156034 | + 513, 517, 522, 529, 534, 543, 547, 550, 555, 557, 561, 569, 575, |
| 156035 | + 578, 583, 591, 591, 595, 604, 609, 614, 620, 623, 626, 629, 631, |
| 156036 | + 636, 640, |
| 154892 | 156037 | }; |
| 154893 | 156038 | /* aKWCode[i] is the parser symbol code for the i-th keyword */ |
| 154894 | | -static const unsigned char aKWCode[143] = { |
| 156039 | +static const unsigned char aKWCode[145] = { |
| 154895 | 156040 | TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE, |
| 154896 | 156041 | TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN, |
| 154897 | 156042 | TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD, |
| 154898 | 156043 | TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE, |
| 154899 | 156044 | TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE, |
| | @@ -154901,29 +156046,158 @@ |
| 154901 | 156046 | TK_ISNULL, TK_NULLS, TK_SAVEPOINT, TK_INTERSECT, TK_TIES, |
| 154902 | 156047 | TK_NOTNULL, TK_NOT, TK_NO, TK_NULL, TK_LIKE_KW, |
| 154903 | 156048 | TK_EXCEPT, TK_TRANSACTION,TK_ACTION, TK_ON, TK_JOIN_KW, |
| 154904 | 156049 | TK_ALTER, TK_RAISE, TK_EXCLUSIVE, TK_EXISTS, TK_CONSTRAINT, |
| 154905 | 156050 | TK_INTO, TK_OFFSET, TK_OF, TK_SET, TK_TRIGGER, |
| 154906 | | - TK_REFERENCES, TK_UNIQUE, TK_QUERY, TK_WITHOUT, TK_WITH, |
| 154907 | | - TK_JOIN_KW, TK_RELEASE, TK_ATTACH, TK_HAVING, TK_LIKE_KW, |
| 154908 | | - TK_BEGIN, TK_JOIN_KW, TK_RANGE, TK_BETWEEN, TK_NOTHING, |
| 154909 | | - TK_GROUPS, TK_GROUP, TK_CASCADE, TK_ASC, TK_DETACH, |
| 154910 | | - TK_CASE, TK_COLLATE, TK_CREATE, TK_CTIME_KW, TK_IMMEDIATE, |
| 154911 | | - TK_JOIN, TK_INSERT, TK_MATCH, TK_PLAN, TK_ANALYZE, |
| 154912 | | - TK_PRAGMA, TK_ABORT, TK_UPDATE, TK_VALUES, TK_VIRTUAL, |
| 154913 | | - TK_LAST, TK_WHEN, TK_WHERE, TK_RECURSIVE, TK_AFTER, |
| 154914 | | - TK_RENAME, TK_AND, TK_DEFAULT, TK_AUTOINCR, TK_TO, |
| 154915 | | - TK_IN, TK_CAST, TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, |
| 154916 | | - TK_JOIN_KW, TK_CTIME_KW, TK_CTIME_KW, TK_CURRENT, TK_PARTITION, |
| 154917 | | - TK_DEFERRED, TK_DISTINCT, TK_IS, TK_DROP, TK_PRECEDING, |
| 154918 | | - TK_FAIL, TK_LIMIT, TK_FILTER, TK_REPLACE, TK_FIRST, |
| 154919 | | - TK_FOLLOWING, TK_FROM, TK_JOIN_KW, TK_IF, TK_ORDER, |
| 154920 | | - TK_RESTRICT, TK_OTHERS, TK_OVER, TK_JOIN_KW, TK_ROLLBACK, |
| 154921 | | - TK_ROWS, TK_ROW, TK_UNBOUNDED, TK_UNION, TK_USING, |
| 154922 | | - TK_VACUUM, TK_VIEW, TK_WINDOW, TK_DO, TK_BY, |
| 154923 | | - TK_INITIALLY, TK_ALL, TK_PRIMARY, |
| 154924 | | -}; |
| 156051 | + TK_RANGE, TK_GENERATED, TK_DETACH, TK_HAVING, TK_LIKE_KW, |
| 156052 | + TK_BEGIN, TK_JOIN_KW, TK_REFERENCES, TK_UNIQUE, TK_QUERY, |
| 156053 | + TK_WITHOUT, TK_WITH, TK_JOIN_KW, TK_RELEASE, TK_ATTACH, |
| 156054 | + TK_BETWEEN, TK_NOTHING, TK_GROUPS, TK_GROUP, TK_CASCADE, |
| 156055 | + TK_ASC, TK_DEFAULT, TK_CASE, TK_COLLATE, TK_CREATE, |
| 156056 | + TK_CTIME_KW, TK_IMMEDIATE, TK_JOIN, TK_INSERT, TK_MATCH, |
| 156057 | + TK_PLAN, TK_ANALYZE, TK_PRAGMA, TK_ABORT, TK_UPDATE, |
| 156058 | + TK_VALUES, TK_VIRTUAL, TK_ALWAYS, TK_WHEN, TK_WHERE, |
| 156059 | + TK_RECURSIVE, TK_AFTER, TK_RENAME, TK_AND, TK_DEFERRED, |
| 156060 | + TK_DISTINCT, TK_IS, TK_AUTOINCR, TK_TO, TK_IN, |
| 156061 | + TK_CAST, TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, |
| 156062 | + TK_CTIME_KW, TK_CTIME_KW, TK_CURRENT, TK_PARTITION, TK_DROP, |
| 156063 | + TK_PRECEDING, TK_FAIL, TK_LAST, TK_FILTER, TK_REPLACE, |
| 156064 | + TK_FIRST, TK_FOLLOWING, TK_FROM, TK_JOIN_KW, TK_LIMIT, |
| 156065 | + TK_IF, TK_ORDER, TK_RESTRICT, TK_OTHERS, TK_OVER, |
| 156066 | + TK_JOIN_KW, TK_ROLLBACK, TK_ROWS, TK_ROW, TK_UNBOUNDED, |
| 156067 | + TK_UNION, TK_USING, TK_VACUUM, TK_VIEW, TK_WINDOW, |
| 156068 | + TK_DO, TK_BY, TK_INITIALLY, TK_ALL, TK_PRIMARY, |
| 156069 | +}; |
| 156070 | +/* Hash table decoded: |
| 156071 | +** 0: INSERT |
| 156072 | +** 1: IS |
| 156073 | +** 2: ROLLBACK TRIGGER |
| 156074 | +** 3: IMMEDIATE |
| 156075 | +** 4: PARTITION |
| 156076 | +** 5: TEMP |
| 156077 | +** 6: |
| 156078 | +** 7: |
| 156079 | +** 8: VALUES WITHOUT |
| 156080 | +** 9: |
| 156081 | +** 10: MATCH |
| 156082 | +** 11: NOTHING |
| 156083 | +** 12: |
| 156084 | +** 13: OF |
| 156085 | +** 14: TIES IGNORE |
| 156086 | +** 15: PLAN |
| 156087 | +** 16: INSTEAD INDEXED |
| 156088 | +** 17: |
| 156089 | +** 18: TRANSACTION RIGHT |
| 156090 | +** 19: WHEN |
| 156091 | +** 20: SET HAVING |
| 156092 | +** 21: IF |
| 156093 | +** 22: ROWS |
| 156094 | +** 23: SELECT |
| 156095 | +** 24: |
| 156096 | +** 25: |
| 156097 | +** 26: VACUUM SAVEPOINT |
| 156098 | +** 27: |
| 156099 | +** 28: LIKE UNION VIRTUAL REFERENCES |
| 156100 | +** 29: RESTRICT |
| 156101 | +** 30: |
| 156102 | +** 31: THEN REGEXP |
| 156103 | +** 32: TO |
| 156104 | +** 33: |
| 156105 | +** 34: BEFORE |
| 156106 | +** 35: |
| 156107 | +** 36: |
| 156108 | +** 37: FOLLOWING COLLATE CASCADE |
| 156109 | +** 38: CREATE |
| 156110 | +** 39: |
| 156111 | +** 40: CASE REINDEX |
| 156112 | +** 41: EACH |
| 156113 | +** 42: |
| 156114 | +** 43: QUERY |
| 156115 | +** 44: AND ADD |
| 156116 | +** 45: PRIMARY ANALYZE |
| 156117 | +** 46: |
| 156118 | +** 47: ROW ASC DETACH |
| 156119 | +** 48: CURRENT_TIME CURRENT_DATE |
| 156120 | +** 49: |
| 156121 | +** 50: |
| 156122 | +** 51: EXCLUSIVE TEMPORARY |
| 156123 | +** 52: |
| 156124 | +** 53: DEFERRED |
| 156125 | +** 54: DEFERRABLE |
| 156126 | +** 55: |
| 156127 | +** 56: DATABASE |
| 156128 | +** 57: |
| 156129 | +** 58: DELETE VIEW GENERATED |
| 156130 | +** 59: ATTACH |
| 156131 | +** 60: END |
| 156132 | +** 61: EXCLUDE |
| 156133 | +** 62: ESCAPE DESC |
| 156134 | +** 63: GLOB |
| 156135 | +** 64: WINDOW ELSE |
| 156136 | +** 65: COLUMN |
| 156137 | +** 66: FIRST |
| 156138 | +** 67: |
| 156139 | +** 68: GROUPS ALL |
| 156140 | +** 69: DISTINCT DROP KEY |
| 156141 | +** 70: BETWEEN |
| 156142 | +** 71: INITIALLY |
| 156143 | +** 72: BEGIN |
| 156144 | +** 73: FILTER CHECK ACTION |
| 156145 | +** 74: GROUP INDEX |
| 156146 | +** 75: |
| 156147 | +** 76: EXISTS DEFAULT |
| 156148 | +** 77: |
| 156149 | +** 78: FOR CURRENT_TIMESTAMP |
| 156150 | +** 79: EXCEPT |
| 156151 | +** 80: |
| 156152 | +** 81: CROSS |
| 156153 | +** 82: |
| 156154 | +** 83: |
| 156155 | +** 84: |
| 156156 | +** 85: CAST |
| 156157 | +** 86: FOREIGN AUTOINCREMENT |
| 156158 | +** 87: COMMIT |
| 156159 | +** 88: CURRENT AFTER ALTER |
| 156160 | +** 89: FULL FAIL CONFLICT |
| 156161 | +** 90: EXPLAIN |
| 156162 | +** 91: CONSTRAINT |
| 156163 | +** 92: FROM ALWAYS |
| 156164 | +** 93: |
| 156165 | +** 94: ABORT |
| 156166 | +** 95: |
| 156167 | +** 96: AS DO |
| 156168 | +** 97: REPLACE WITH RELEASE |
| 156169 | +** 98: BY RENAME |
| 156170 | +** 99: RANGE RAISE |
| 156171 | +** 100: OTHERS |
| 156172 | +** 101: USING NULLS |
| 156173 | +** 102: PRAGMA |
| 156174 | +** 103: JOIN ISNULL OFFSET |
| 156175 | +** 104: NOT |
| 156176 | +** 105: OR LAST LEFT |
| 156177 | +** 106: LIMIT |
| 156178 | +** 107: |
| 156179 | +** 108: |
| 156180 | +** 109: IN |
| 156181 | +** 110: INTO |
| 156182 | +** 111: OVER RECURSIVE |
| 156183 | +** 112: ORDER OUTER |
| 156184 | +** 113: |
| 156185 | +** 114: INTERSECT UNBOUNDED |
| 156186 | +** 115: |
| 156187 | +** 116: |
| 156188 | +** 117: ON |
| 156189 | +** 118: |
| 156190 | +** 119: WHERE |
| 156191 | +** 120: NO INNER |
| 156192 | +** 121: NULL |
| 156193 | +** 122: |
| 156194 | +** 123: TABLE |
| 156195 | +** 124: NATURAL NOTNULL |
| 156196 | +** 125: PRECEDING |
| 156197 | +** 126: UPDATE UNIQUE |
| 156198 | +*/ |
| 154925 | 156199 | /* Check to see if z[0..n-1] is a keyword. If it is, write the |
| 154926 | 156200 | ** parser symbol code for that keyword into *pType. Always |
| 154927 | 156201 | ** return the integer n (the length of the token). */ |
| 154928 | 156202 | static int keywordCode(const char *z, int n, int *pType){ |
| 154929 | 156203 | int i, j; |
| | @@ -154994,98 +156268,100 @@ |
| 154994 | 156268 | testcase( i==50 ); /* INTO */ |
| 154995 | 156269 | testcase( i==51 ); /* OFFSET */ |
| 154996 | 156270 | testcase( i==52 ); /* OF */ |
| 154997 | 156271 | testcase( i==53 ); /* SET */ |
| 154998 | 156272 | testcase( i==54 ); /* TRIGGER */ |
| 154999 | | - testcase( i==55 ); /* REFERENCES */ |
| 155000 | | - testcase( i==56 ); /* UNIQUE */ |
| 155001 | | - testcase( i==57 ); /* QUERY */ |
| 155002 | | - testcase( i==58 ); /* WITHOUT */ |
| 155003 | | - testcase( i==59 ); /* WITH */ |
| 155004 | | - testcase( i==60 ); /* OUTER */ |
| 155005 | | - testcase( i==61 ); /* RELEASE */ |
| 155006 | | - testcase( i==62 ); /* ATTACH */ |
| 155007 | | - testcase( i==63 ); /* HAVING */ |
| 155008 | | - testcase( i==64 ); /* GLOB */ |
| 155009 | | - testcase( i==65 ); /* BEGIN */ |
| 155010 | | - testcase( i==66 ); /* INNER */ |
| 155011 | | - testcase( i==67 ); /* RANGE */ |
| 155012 | | - testcase( i==68 ); /* BETWEEN */ |
| 155013 | | - testcase( i==69 ); /* NOTHING */ |
| 155014 | | - testcase( i==70 ); /* GROUPS */ |
| 155015 | | - testcase( i==71 ); /* GROUP */ |
| 155016 | | - testcase( i==72 ); /* CASCADE */ |
| 155017 | | - testcase( i==73 ); /* ASC */ |
| 155018 | | - testcase( i==74 ); /* DETACH */ |
| 155019 | | - testcase( i==75 ); /* CASE */ |
| 155020 | | - testcase( i==76 ); /* COLLATE */ |
| 155021 | | - testcase( i==77 ); /* CREATE */ |
| 155022 | | - testcase( i==78 ); /* CURRENT_DATE */ |
| 155023 | | - testcase( i==79 ); /* IMMEDIATE */ |
| 155024 | | - testcase( i==80 ); /* JOIN */ |
| 155025 | | - testcase( i==81 ); /* INSERT */ |
| 155026 | | - testcase( i==82 ); /* MATCH */ |
| 155027 | | - testcase( i==83 ); /* PLAN */ |
| 155028 | | - testcase( i==84 ); /* ANALYZE */ |
| 155029 | | - testcase( i==85 ); /* PRAGMA */ |
| 155030 | | - testcase( i==86 ); /* ABORT */ |
| 155031 | | - testcase( i==87 ); /* UPDATE */ |
| 155032 | | - testcase( i==88 ); /* VALUES */ |
| 155033 | | - testcase( i==89 ); /* VIRTUAL */ |
| 155034 | | - testcase( i==90 ); /* LAST */ |
| 155035 | | - testcase( i==91 ); /* WHEN */ |
| 155036 | | - testcase( i==92 ); /* WHERE */ |
| 155037 | | - testcase( i==93 ); /* RECURSIVE */ |
| 155038 | | - testcase( i==94 ); /* AFTER */ |
| 155039 | | - testcase( i==95 ); /* RENAME */ |
| 155040 | | - testcase( i==96 ); /* AND */ |
| 155041 | | - testcase( i==97 ); /* DEFAULT */ |
| 155042 | | - testcase( i==98 ); /* AUTOINCREMENT */ |
| 155043 | | - testcase( i==99 ); /* TO */ |
| 155044 | | - testcase( i==100 ); /* IN */ |
| 155045 | | - testcase( i==101 ); /* CAST */ |
| 155046 | | - testcase( i==102 ); /* COLUMN */ |
| 155047 | | - testcase( i==103 ); /* COMMIT */ |
| 155048 | | - testcase( i==104 ); /* CONFLICT */ |
| 155049 | | - testcase( i==105 ); /* CROSS */ |
| 155050 | | - testcase( i==106 ); /* CURRENT_TIMESTAMP */ |
| 155051 | | - testcase( i==107 ); /* CURRENT_TIME */ |
| 155052 | | - testcase( i==108 ); /* CURRENT */ |
| 155053 | | - testcase( i==109 ); /* PARTITION */ |
| 155054 | | - testcase( i==110 ); /* DEFERRED */ |
| 155055 | | - testcase( i==111 ); /* DISTINCT */ |
| 155056 | | - testcase( i==112 ); /* IS */ |
| 155057 | | - testcase( i==113 ); /* DROP */ |
| 155058 | | - testcase( i==114 ); /* PRECEDING */ |
| 155059 | | - testcase( i==115 ); /* FAIL */ |
| 155060 | | - testcase( i==116 ); /* LIMIT */ |
| 155061 | | - testcase( i==117 ); /* FILTER */ |
| 155062 | | - testcase( i==118 ); /* REPLACE */ |
| 155063 | | - testcase( i==119 ); /* FIRST */ |
| 155064 | | - testcase( i==120 ); /* FOLLOWING */ |
| 155065 | | - testcase( i==121 ); /* FROM */ |
| 155066 | | - testcase( i==122 ); /* FULL */ |
| 155067 | | - testcase( i==123 ); /* IF */ |
| 155068 | | - testcase( i==124 ); /* ORDER */ |
| 155069 | | - testcase( i==125 ); /* RESTRICT */ |
| 155070 | | - testcase( i==126 ); /* OTHERS */ |
| 155071 | | - testcase( i==127 ); /* OVER */ |
| 155072 | | - testcase( i==128 ); /* RIGHT */ |
| 155073 | | - testcase( i==129 ); /* ROLLBACK */ |
| 155074 | | - testcase( i==130 ); /* ROWS */ |
| 155075 | | - testcase( i==131 ); /* ROW */ |
| 155076 | | - testcase( i==132 ); /* UNBOUNDED */ |
| 155077 | | - testcase( i==133 ); /* UNION */ |
| 155078 | | - testcase( i==134 ); /* USING */ |
| 155079 | | - testcase( i==135 ); /* VACUUM */ |
| 155080 | | - testcase( i==136 ); /* VIEW */ |
| 155081 | | - testcase( i==137 ); /* WINDOW */ |
| 155082 | | - testcase( i==138 ); /* DO */ |
| 155083 | | - testcase( i==139 ); /* BY */ |
| 155084 | | - testcase( i==140 ); /* INITIALLY */ |
| 155085 | | - testcase( i==141 ); /* ALL */ |
| 155086 | | - testcase( i==142 ); /* PRIMARY */ |
| 156273 | + testcase( i==55 ); /* RANGE */ |
| 156274 | + testcase( i==56 ); /* GENERATED */ |
| 156275 | + testcase( i==57 ); /* DETACH */ |
| 156276 | + testcase( i==58 ); /* HAVING */ |
| 156277 | + testcase( i==59 ); /* GLOB */ |
| 156278 | + testcase( i==60 ); /* BEGIN */ |
| 156279 | + testcase( i==61 ); /* INNER */ |
| 156280 | + testcase( i==62 ); /* REFERENCES */ |
| 156281 | + testcase( i==63 ); /* UNIQUE */ |
| 156282 | + testcase( i==64 ); /* QUERY */ |
| 156283 | + testcase( i==65 ); /* WITHOUT */ |
| 156284 | + testcase( i==66 ); /* WITH */ |
| 156285 | + testcase( i==67 ); /* OUTER */ |
| 156286 | + testcase( i==68 ); /* RELEASE */ |
| 156287 | + testcase( i==69 ); /* ATTACH */ |
| 156288 | + testcase( i==70 ); /* BETWEEN */ |
| 156289 | + testcase( i==71 ); /* NOTHING */ |
| 156290 | + testcase( i==72 ); /* GROUPS */ |
| 156291 | + testcase( i==73 ); /* GROUP */ |
| 156292 | + testcase( i==74 ); /* CASCADE */ |
| 156293 | + testcase( i==75 ); /* ASC */ |
| 156294 | + testcase( i==76 ); /* DEFAULT */ |
| 156295 | + testcase( i==77 ); /* CASE */ |
| 156296 | + testcase( i==78 ); /* COLLATE */ |
| 156297 | + testcase( i==79 ); /* CREATE */ |
| 156298 | + testcase( i==80 ); /* CURRENT_DATE */ |
| 156299 | + testcase( i==81 ); /* IMMEDIATE */ |
| 156300 | + testcase( i==82 ); /* JOIN */ |
| 156301 | + testcase( i==83 ); /* INSERT */ |
| 156302 | + testcase( i==84 ); /* MATCH */ |
| 156303 | + testcase( i==85 ); /* PLAN */ |
| 156304 | + testcase( i==86 ); /* ANALYZE */ |
| 156305 | + testcase( i==87 ); /* PRAGMA */ |
| 156306 | + testcase( i==88 ); /* ABORT */ |
| 156307 | + testcase( i==89 ); /* UPDATE */ |
| 156308 | + testcase( i==90 ); /* VALUES */ |
| 156309 | + testcase( i==91 ); /* VIRTUAL */ |
| 156310 | + testcase( i==92 ); /* ALWAYS */ |
| 156311 | + testcase( i==93 ); /* WHEN */ |
| 156312 | + testcase( i==94 ); /* WHERE */ |
| 156313 | + testcase( i==95 ); /* RECURSIVE */ |
| 156314 | + testcase( i==96 ); /* AFTER */ |
| 156315 | + testcase( i==97 ); /* RENAME */ |
| 156316 | + testcase( i==98 ); /* AND */ |
| 156317 | + testcase( i==99 ); /* DEFERRED */ |
| 156318 | + testcase( i==100 ); /* DISTINCT */ |
| 156319 | + testcase( i==101 ); /* IS */ |
| 156320 | + testcase( i==102 ); /* AUTOINCREMENT */ |
| 156321 | + testcase( i==103 ); /* TO */ |
| 156322 | + testcase( i==104 ); /* IN */ |
| 156323 | + testcase( i==105 ); /* CAST */ |
| 156324 | + testcase( i==106 ); /* COLUMN */ |
| 156325 | + testcase( i==107 ); /* COMMIT */ |
| 156326 | + testcase( i==108 ); /* CONFLICT */ |
| 156327 | + testcase( i==109 ); /* CROSS */ |
| 156328 | + testcase( i==110 ); /* CURRENT_TIMESTAMP */ |
| 156329 | + testcase( i==111 ); /* CURRENT_TIME */ |
| 156330 | + testcase( i==112 ); /* CURRENT */ |
| 156331 | + testcase( i==113 ); /* PARTITION */ |
| 156332 | + testcase( i==114 ); /* DROP */ |
| 156333 | + testcase( i==115 ); /* PRECEDING */ |
| 156334 | + testcase( i==116 ); /* FAIL */ |
| 156335 | + testcase( i==117 ); /* LAST */ |
| 156336 | + testcase( i==118 ); /* FILTER */ |
| 156337 | + testcase( i==119 ); /* REPLACE */ |
| 156338 | + testcase( i==120 ); /* FIRST */ |
| 156339 | + testcase( i==121 ); /* FOLLOWING */ |
| 156340 | + testcase( i==122 ); /* FROM */ |
| 156341 | + testcase( i==123 ); /* FULL */ |
| 156342 | + testcase( i==124 ); /* LIMIT */ |
| 156343 | + testcase( i==125 ); /* IF */ |
| 156344 | + testcase( i==126 ); /* ORDER */ |
| 156345 | + testcase( i==127 ); /* RESTRICT */ |
| 156346 | + testcase( i==128 ); /* OTHERS */ |
| 156347 | + testcase( i==129 ); /* OVER */ |
| 156348 | + testcase( i==130 ); /* RIGHT */ |
| 156349 | + testcase( i==131 ); /* ROLLBACK */ |
| 156350 | + testcase( i==132 ); /* ROWS */ |
| 156351 | + testcase( i==133 ); /* ROW */ |
| 156352 | + testcase( i==134 ); /* UNBOUNDED */ |
| 156353 | + testcase( i==135 ); /* UNION */ |
| 156354 | + testcase( i==136 ); /* USING */ |
| 156355 | + testcase( i==137 ); /* VACUUM */ |
| 156356 | + testcase( i==138 ); /* VIEW */ |
| 156357 | + testcase( i==139 ); /* WINDOW */ |
| 156358 | + testcase( i==140 ); /* DO */ |
| 156359 | + testcase( i==141 ); /* BY */ |
| 156360 | + testcase( i==142 ); /* INITIALLY */ |
| 156361 | + testcase( i==143 ); /* ALL */ |
| 156362 | + testcase( i==144 ); /* PRIMARY */ |
| 155087 | 156363 | *pType = aKWCode[i]; |
| 155088 | 156364 | break; |
| 155089 | 156365 | } |
| 155090 | 156366 | } |
| 155091 | 156367 | return n; |
| | @@ -155093,11 +156369,11 @@ |
| 155093 | 156369 | SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char *z, int n){ |
| 155094 | 156370 | int id = TK_ID; |
| 155095 | 156371 | keywordCode((char*)z, n, &id); |
| 155096 | 156372 | return id; |
| 155097 | 156373 | } |
| 155098 | | -#define SQLITE_N_KEYWORD 143 |
| 156374 | +#define SQLITE_N_KEYWORD 145 |
| 155099 | 156375 | SQLITE_API int sqlite3_keyword_name(int i,const char **pzName,int *pnName){ |
| 155100 | 156376 | if( i<0 || i>=SQLITE_N_KEYWORD ) return SQLITE_ERROR; |
| 155101 | 156377 | *pzName = zKWText + aKWOffset[i]; |
| 155102 | 156378 | *pnName = aKWLen[i]; |
| 155103 | 156379 | return SQLITE_OK; |
| | @@ -155720,11 +156996,11 @@ |
| 155720 | 156996 | int tokenType; /* type of current token */ |
| 155721 | 156997 | int prevType = 0; /* Previous non-whitespace token */ |
| 155722 | 156998 | int nParen; /* Number of nested levels of parentheses */ |
| 155723 | 156999 | int iStartIN; /* Start of RHS of IN operator in z[] */ |
| 155724 | 157000 | int nParenAtIN; /* Value of nParent at start of RHS of IN operator */ |
| 155725 | | - int j; /* Bytes of normalized SQL generated so far */ |
| 157001 | + u32 j; /* Bytes of normalized SQL generated so far */ |
| 155726 | 157002 | sqlite3_str *pStr; /* The normalized SQL string under construction */ |
| 155727 | 157003 | |
| 155728 | 157004 | db = sqlite3VdbeDb(pVdbe); |
| 155729 | 157005 | tokenType = -1; |
| 155730 | 157006 | nParen = iStartIN = nParenAtIN = 0; |
| | @@ -155764,11 +157040,11 @@ |
| 155764 | 157040 | sqlite3_str_append(pStr, "(", 1); |
| 155765 | 157041 | break; |
| 155766 | 157042 | } |
| 155767 | 157043 | case TK_RP: { |
| 155768 | 157044 | if( iStartIN>0 && nParen==nParenAtIN ){ |
| 155769 | | - assert( pStr->nChar>=iStartIN ); |
| 157045 | + assert( pStr->nChar>=(u32)iStartIN ); |
| 155770 | 157046 | pStr->nChar = iStartIN+1; |
| 155771 | 157047 | sqlite3_str_append(pStr, "?,?,?", 5); |
| 155772 | 157048 | iStartIN = 0; |
| 155773 | 157049 | } |
| 155774 | 157050 | nParen--; |
| | @@ -156933,10 +158209,11 @@ |
| 156933 | 158209 | } |
| 156934 | 158210 | db->lookaside.pStart = pStart; |
| 156935 | 158211 | db->lookaside.pInit = 0; |
| 156936 | 158212 | db->lookaside.pFree = 0; |
| 156937 | 158213 | db->lookaside.sz = (u16)sz; |
| 158214 | + db->lookaside.szTrue = (u16)sz; |
| 156938 | 158215 | if( pStart ){ |
| 156939 | 158216 | int i; |
| 156940 | 158217 | LookasideSlot *p; |
| 156941 | 158218 | assert( sz > (int)sizeof(LookasideSlot*) ); |
| 156942 | 158219 | db->lookaside.nSlot = cnt; |
| | @@ -156951,10 +158228,11 @@ |
| 156951 | 158228 | db->lookaside.bMalloced = pBuf==0 ?1:0; |
| 156952 | 158229 | }else{ |
| 156953 | 158230 | db->lookaside.pStart = db; |
| 156954 | 158231 | db->lookaside.pEnd = db; |
| 156955 | 158232 | db->lookaside.bDisable = 1; |
| 158233 | + db->lookaside.sz = 0; |
| 156956 | 158234 | db->lookaside.bMalloced = 0; |
| 156957 | 158235 | db->lookaside.nSlot = 0; |
| 156958 | 158236 | } |
| 156959 | 158237 | #endif /* SQLITE_OMIT_LOOKASIDE */ |
| 156960 | 158238 | return SQLITE_OK; |
| | @@ -157067,10 +158345,11 @@ |
| 157067 | 158345 | { SQLITE_DBCONFIG_WRITABLE_SCHEMA, SQLITE_WriteSchema| |
| 157068 | 158346 | SQLITE_NoSchemaError }, |
| 157069 | 158347 | { SQLITE_DBCONFIG_LEGACY_ALTER_TABLE, SQLITE_LegacyAlter }, |
| 157070 | 158348 | { SQLITE_DBCONFIG_DQS_DDL, SQLITE_DqsDDL }, |
| 157071 | 158349 | { SQLITE_DBCONFIG_DQS_DML, SQLITE_DqsDML }, |
| 158350 | + { SQLITE_DBCONFIG_LEGACY_FILE_FORMAT, SQLITE_LegacyFileFmt }, |
| 157072 | 158351 | }; |
| 157073 | 158352 | unsigned int i; |
| 157074 | 158353 | rc = SQLITE_ERROR; /* IMP: R-42790-23372 */ |
| 157075 | 158354 | for(i=0; i<ArraySize(aFlagOp); i++){ |
| 157076 | 158355 | if( aFlagOp[i].op==op ){ |
| | @@ -157605,10 +158884,11 @@ |
| 157605 | 158884 | case SQLITE_CANTOPEN: zName = "SQLITE_CANTOPEN"; break; |
| 157606 | 158885 | case SQLITE_CANTOPEN_NOTEMPDIR: zName = "SQLITE_CANTOPEN_NOTEMPDIR";break; |
| 157607 | 158886 | case SQLITE_CANTOPEN_ISDIR: zName = "SQLITE_CANTOPEN_ISDIR"; break; |
| 157608 | 158887 | case SQLITE_CANTOPEN_FULLPATH: zName = "SQLITE_CANTOPEN_FULLPATH"; break; |
| 157609 | 158888 | case SQLITE_CANTOPEN_CONVPATH: zName = "SQLITE_CANTOPEN_CONVPATH"; break; |
| 158889 | + case SQLITE_CANTOPEN_SYMLINK: zName = "SQLITE_CANTOPEN_SYMLINK"; break; |
| 157610 | 158890 | case SQLITE_PROTOCOL: zName = "SQLITE_PROTOCOL"; break; |
| 157611 | 158891 | case SQLITE_EMPTY: zName = "SQLITE_EMPTY"; break; |
| 157612 | 158892 | case SQLITE_SCHEMA: zName = "SQLITE_SCHEMA"; break; |
| 157613 | 158893 | case SQLITE_TOOBIG: zName = "SQLITE_TOOBIG"; break; |
| 157614 | 158894 | case SQLITE_CONSTRAINT: zName = "SQLITE_CONSTRAINT"; break; |
| | @@ -159282,10 +160562,11 @@ |
| 159282 | 160562 | db->errMask = 0xff; |
| 159283 | 160563 | db->nDb = 2; |
| 159284 | 160564 | db->magic = SQLITE_MAGIC_BUSY; |
| 159285 | 160565 | db->aDb = db->aDbStatic; |
| 159286 | 160566 | db->lookaside.bDisable = 1; |
| 160567 | + db->lookaside.sz = 0; |
| 159287 | 160568 | |
| 159288 | 160569 | assert( sizeof(db->aLimit)==sizeof(aHardLimit) ); |
| 159289 | 160570 | memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit)); |
| 159290 | 160571 | db->aLimit[SQLITE_LIMIT_WORKER_THREADS] = SQLITE_DEFAULT_WORKER_THREADS; |
| 159291 | 160572 | db->autoCommit = 1; |
| | @@ -160401,10 +161682,29 @@ |
| 160401 | 161682 | va_end(ap); |
| 160402 | 161683 | #endif /* SQLITE_UNTESTABLE */ |
| 160403 | 161684 | return rc; |
| 160404 | 161685 | } |
| 160405 | 161686 | |
| 161687 | +#ifdef SQLITE_DEBUG |
| 161688 | +/* |
| 161689 | +** This routine appears inside assert() statements only. |
| 161690 | +** |
| 161691 | +** Return the number of URI parameters that follow the filename. |
| 161692 | +*/ |
| 161693 | +SQLITE_PRIVATE int sqlite3UriCount(const char *z){ |
| 161694 | + int n = 0; |
| 161695 | + if( z==0 ) return 0; |
| 161696 | + z += strlen(z)+1; |
| 161697 | + while( z[0] ){ |
| 161698 | + z += strlen(z)+1; |
| 161699 | + z += strlen(z)+1; |
| 161700 | + n++; |
| 161701 | + } |
| 161702 | + return n; |
| 161703 | +} |
| 161704 | +#endif /* SQLITE_DEBUG */ |
| 161705 | + |
| 160406 | 161706 | /* |
| 160407 | 161707 | ** This is a utility routine, useful to VFS implementations, that checks |
| 160408 | 161708 | ** to see if a database file was a URI that contained a specific query |
| 160409 | 161709 | ** parameter, and if so obtains the value of the query parameter. |
| 160410 | 161710 | ** |
| | @@ -161883,16 +163183,26 @@ |
| 161883 | 163183 | */ |
| 161884 | 163184 | int inTransaction; /* True after xBegin but before xCommit/xRollback */ |
| 161885 | 163185 | int mxSavepoint; /* Largest valid xSavepoint integer */ |
| 161886 | 163186 | #endif |
| 161887 | 163187 | |
| 161888 | | -#ifdef SQLITE_TEST |
| 163188 | +#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) |
| 161889 | 163189 | /* True to disable the incremental doclist optimization. This is controled |
| 161890 | 163190 | ** by special insert command 'test-no-incr-doclist'. */ |
| 161891 | 163191 | int bNoIncrDoclist; |
| 163192 | + |
| 163193 | + /* Number of segments in a level */ |
| 163194 | + int nMergeCount; |
| 161892 | 163195 | #endif |
| 161893 | 163196 | }; |
| 163197 | + |
| 163198 | +/* Macro to find the number of segments to merge */ |
| 163199 | +#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) |
| 163200 | +# define MergeCount(P) ((P)->nMergeCount) |
| 163201 | +#else |
| 163202 | +# define MergeCount(P) FTS3_MERGE_COUNT |
| 163203 | +#endif |
| 161894 | 163204 | |
| 161895 | 163205 | /* |
| 161896 | 163206 | ** When the core wants to read from the virtual table, it creates a |
| 161897 | 163207 | ** virtual table cursor (an instance of the following structure) using |
| 161898 | 163208 | ** the xOpen method. Cursors are destroyed using the xClose method. |
| | @@ -162153,10 +163463,11 @@ |
| 162153 | 163463 | |
| 162154 | 163464 | /* fts3.c */ |
| 162155 | 163465 | SQLITE_PRIVATE void sqlite3Fts3ErrMsg(char**,const char*,...); |
| 162156 | 163466 | SQLITE_PRIVATE int sqlite3Fts3PutVarint(char *, sqlite3_int64); |
| 162157 | 163467 | SQLITE_PRIVATE int sqlite3Fts3GetVarint(const char *, sqlite_int64 *); |
| 163468 | +SQLITE_PRIVATE int sqlite3Fts3GetVarintBounded(const char*,const char*,sqlite3_int64*); |
| 162158 | 163469 | SQLITE_PRIVATE int sqlite3Fts3GetVarint32(const char *, int *); |
| 162159 | 163470 | SQLITE_PRIVATE int sqlite3Fts3VarintLen(sqlite3_uint64); |
| 162160 | 163471 | SQLITE_PRIVATE void sqlite3Fts3Dequote(char *); |
| 162161 | 163472 | SQLITE_PRIVATE void sqlite3Fts3DoclistPrev(int,char*,int,char**,sqlite3_int64*,int*,u8*); |
| 162162 | 163473 | SQLITE_PRIVATE int sqlite3Fts3EvalPhraseStats(Fts3Cursor *, Fts3Expr *, u32 *); |
| | @@ -162315,10 +163626,36 @@ |
| 162315 | 163626 | GETVARINT_STEP(a, p, 21, 0x1FFFFF, 0x10000000, *v, 4); |
| 162316 | 163627 | b = (a & 0x0FFFFFFF ); |
| 162317 | 163628 | |
| 162318 | 163629 | for(shift=28; shift<=63; shift+=7){ |
| 162319 | 163630 | u64 c = *p++; |
| 163631 | + b += (c&0x7F) << shift; |
| 163632 | + if( (c & 0x80)==0 ) break; |
| 163633 | + } |
| 163634 | + *v = b; |
| 163635 | + return (int)(p - pStart); |
| 163636 | +} |
| 163637 | + |
| 163638 | +/* |
| 163639 | +** Read a 64-bit variable-length integer from memory starting at p[0] and |
| 163640 | +** not extending past pEnd[-1]. |
| 163641 | +** Return the number of bytes read, or 0 on error. |
| 163642 | +** The value is stored in *v. |
| 163643 | +*/ |
| 163644 | +SQLITE_PRIVATE int sqlite3Fts3GetVarintBounded( |
| 163645 | + const char *pBuf, |
| 163646 | + const char *pEnd, |
| 163647 | + sqlite_int64 *v |
| 163648 | +){ |
| 163649 | + const unsigned char *p = (const unsigned char*)pBuf; |
| 163650 | + const unsigned char *pStart = p; |
| 163651 | + const unsigned char *pX = (const unsigned char*)pEnd; |
| 163652 | + u64 b = 0; |
| 163653 | + int shift; |
| 163654 | + for(shift=0; shift<=63; shift+=7){ |
| 163655 | + u64 c = p<pX ? *p : 0; |
| 163656 | + p++; |
| 162320 | 163657 | b += (c&0x7F) << shift; |
| 162321 | 163658 | if( (c & 0x80)==0 ) break; |
| 162322 | 163659 | } |
| 162323 | 163660 | *v = b; |
| 162324 | 163661 | return (int)(p - pStart); |
| | @@ -163416,10 +164753,14 @@ |
| 163416 | 164753 | |
| 163417 | 164754 | /* Figure out the page-size for the database. This is required in order to |
| 163418 | 164755 | ** estimate the cost of loading large doclists from the database. */ |
| 163419 | 164756 | fts3DatabasePageSize(&rc, p); |
| 163420 | 164757 | p->nNodeSize = p->nPgsz-35; |
| 164758 | + |
| 164759 | +#if defined(SQLITE_DEBUG)||defined(SQLITE_TEST) |
| 164760 | + p->nMergeCount = FTS3_MERGE_COUNT; |
| 164761 | +#endif |
| 163421 | 164762 | |
| 163422 | 164763 | /* Declare the table schema to SQLite. */ |
| 163423 | 164764 | fts3DeclareVtab(&rc, p); |
| 163424 | 164765 | |
| 163425 | 164766 | fts3_init_out: |
| | @@ -163924,11 +165265,17 @@ |
| 163924 | 165265 | |
| 163925 | 165266 | if( rc==SQLITE_OK ){ |
| 163926 | 165267 | rc = sqlite3Fts3ReadBlock(p, piLeaf?*piLeaf:*piLeaf2, &zBlob, &nBlob, 0); |
| 163927 | 165268 | } |
| 163928 | 165269 | if( rc==SQLITE_OK ){ |
| 163929 | | - rc = fts3SelectLeaf(p, zTerm, nTerm, zBlob, nBlob, piLeaf, piLeaf2); |
| 165270 | + int iNewHeight = 0; |
| 165271 | + fts3GetVarint32(zBlob, &iNewHeight); |
| 165272 | + if( iNewHeight>=iHeight ){ |
| 165273 | + rc = FTS_CORRUPT_VTAB; |
| 165274 | + }else{ |
| 165275 | + rc = fts3SelectLeaf(p, zTerm, nTerm, zBlob, nBlob, piLeaf, piLeaf2); |
| 165276 | + } |
| 163930 | 165277 | } |
| 163931 | 165278 | sqlite3_free(zBlob); |
| 163932 | 165279 | } |
| 163933 | 165280 | |
| 163934 | 165281 | return rc; |
| | @@ -164411,19 +165758,20 @@ |
| 164411 | 165758 | int bDescIdx, /* True for descending docids */ |
| 164412 | 165759 | sqlite3_int64 *piPrev, /* IN/OUT: Previous value written to list */ |
| 164413 | 165760 | int *pbFirst, /* IN/OUT: True after first int written */ |
| 164414 | 165761 | sqlite3_int64 iVal /* Write this value to the list */ |
| 164415 | 165762 | ){ |
| 164416 | | - sqlite3_int64 iWrite; |
| 165763 | + sqlite3_uint64 iWrite; |
| 164417 | 165764 | if( bDescIdx==0 || *pbFirst==0 ){ |
| 165765 | + assert_fts3_nc( *pbFirst==0 || iVal>=*piPrev ); |
| 164418 | 165766 | iWrite = iVal - *piPrev; |
| 164419 | 165767 | }else{ |
| 165768 | + assert_fts3_nc( *piPrev>=iVal ); |
| 164420 | 165769 | iWrite = *piPrev - iVal; |
| 164421 | 165770 | } |
| 164422 | 165771 | assert( *pbFirst || *piPrev==0 ); |
| 164423 | 165772 | assert_fts3_nc( *pbFirst==0 || iWrite>0 ); |
| 164424 | | - assert( *pbFirst==0 || iWrite>=0 ); |
| 164425 | 165773 | *pp += sqlite3Fts3PutVarint(*pp, iWrite); |
| 164426 | 165774 | *piPrev = iVal; |
| 164427 | 165775 | *pbFirst = 1; |
| 164428 | 165776 | } |
| 164429 | 165777 | |
| | @@ -166267,11 +167615,11 @@ |
| 166267 | 167615 | ** tokens or prefix tokens that cannot use a prefix-index. */ |
| 166268 | 167616 | int bHaveIncr = 0; |
| 166269 | 167617 | int bIncrOk = (bOptOk |
| 166270 | 167618 | && pCsr->bDesc==pTab->bDescIdx |
| 166271 | 167619 | && p->nToken<=MAX_INCR_PHRASE_TOKENS && p->nToken>0 |
| 166272 | | -#ifdef SQLITE_TEST |
| 167620 | +#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) |
| 166273 | 167621 | && pTab->bNoIncrDoclist==0 |
| 166274 | 167622 | #endif |
| 166275 | 167623 | ); |
| 166276 | 167624 | for(i=0; bIncrOk==1 && i<p->nToken; i++){ |
| 166277 | 167625 | Fts3PhraseToken *pToken = &p->aToken[i]; |
| | @@ -166789,16 +168137,17 @@ |
| 166789 | 168137 | const char *a; |
| 166790 | 168138 | |
| 166791 | 168139 | rc = sqlite3Fts3SelectDoctotal(p, &pStmt); |
| 166792 | 168140 | if( rc!=SQLITE_OK ) return rc; |
| 166793 | 168141 | a = sqlite3_column_blob(pStmt, 0); |
| 166794 | | - assert( a ); |
| 166795 | | - |
| 166796 | | - pEnd = &a[sqlite3_column_bytes(pStmt, 0)]; |
| 166797 | | - a += sqlite3Fts3GetVarint(a, &nDoc); |
| 166798 | | - while( a<pEnd ){ |
| 166799 | | - a += sqlite3Fts3GetVarint(a, &nByte); |
| 168142 | + testcase( a==0 ); /* If %_stat.value set to X'' */ |
| 168143 | + if( a ){ |
| 168144 | + pEnd = &a[sqlite3_column_bytes(pStmt, 0)]; |
| 168145 | + a += sqlite3Fts3GetVarintBounded(a, pEnd, &nDoc); |
| 168146 | + while( a<pEnd ){ |
| 168147 | + a += sqlite3Fts3GetVarintBounded(a, pEnd, &nByte); |
| 168148 | + } |
| 166800 | 168149 | } |
| 166801 | 168150 | if( nDoc==0 || nByte==0 ){ |
| 166802 | 168151 | sqlite3_reset(pStmt); |
| 166803 | 168152 | return FTS_CORRUPT_VTAB; |
| 166804 | 168153 | } |
| | @@ -171232,11 +172581,13 @@ |
| 171232 | 172581 | return rc; |
| 171233 | 172582 | } |
| 171234 | 172583 | |
| 171235 | 172584 | sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC); |
| 171236 | 172585 | if( SQLITE_ROW==sqlite3_step(pStmt) ){ |
| 171237 | | - if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB ){ |
| 172586 | + if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB |
| 172587 | + && sqlite3_column_bytes(pStmt, 0)==sizeof(*pp) |
| 172588 | + ){ |
| 171238 | 172589 | memcpy((void *)pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp)); |
| 171239 | 172590 | } |
| 171240 | 172591 | } |
| 171241 | 172592 | |
| 171242 | 172593 | return sqlite3_finalize(pStmt); |
| | @@ -172081,11 +173432,11 @@ |
| 172081 | 173432 | #if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) |
| 172082 | 173433 | |
| 172083 | 173434 | /* #include <string.h> */ |
| 172084 | 173435 | /* #include <assert.h> */ |
| 172085 | 173436 | /* #include <stdlib.h> */ |
| 172086 | | - |
| 173437 | +/* #include <stdio.h> */ |
| 172087 | 173438 | |
| 172088 | 173439 | #define FTS_MAX_APPENDABLE_HEIGHT 16 |
| 172089 | 173440 | |
| 172090 | 173441 | /* |
| 172091 | 173442 | ** When full-text index nodes are loaded from disk, the buffer that they |
| | @@ -172125,11 +173476,11 @@ |
| 172125 | 173476 | # define FTS3_NODE_CHUNKSIZE (4*1024) |
| 172126 | 173477 | # define FTS3_NODE_CHUNK_THRESHOLD (FTS3_NODE_CHUNKSIZE*4) |
| 172127 | 173478 | #endif |
| 172128 | 173479 | |
| 172129 | 173480 | /* |
| 172130 | | -** The two values that may be meaningfully bound to the :1 parameter in |
| 173481 | +** The values that may be meaningfully bound to the :1 parameter in |
| 172131 | 173482 | ** statements SQL_REPLACE_STAT and SQL_SELECT_STAT. |
| 172132 | 173483 | */ |
| 172133 | 173484 | #define FTS_STAT_DOCTOTAL 0 |
| 172134 | 173485 | #define FTS_STAT_INCRMERGEHINT 1 |
| 172135 | 173486 | #define FTS_STAT_AUTOINCRMERGE 2 |
| | @@ -173211,11 +174562,11 @@ |
| 173211 | 174562 | /* If iNext is FTS3_MERGE_COUNT, indicating that level iLevel is already |
| 173212 | 174563 | ** full, merge all segments in level iLevel into a single iLevel+1 |
| 173213 | 174564 | ** segment and allocate (newly freed) index 0 at level iLevel. Otherwise, |
| 173214 | 174565 | ** if iNext is less than FTS3_MERGE_COUNT, allocate index iNext. |
| 173215 | 174566 | */ |
| 173216 | | - if( iNext>=FTS3_MERGE_COUNT ){ |
| 174567 | + if( iNext>=MergeCount(p) ){ |
| 173217 | 174568 | fts3LogMerge(16, getAbsoluteLevel(p, iLangid, iIndex, iLevel)); |
| 173218 | 174569 | rc = fts3SegmentMerge(p, iLangid, iIndex, iLevel); |
| 173219 | 174570 | *piIdx = 0; |
| 173220 | 174571 | }else{ |
| 173221 | 174572 | *piIdx = iNext; |
| | @@ -173437,11 +174788,11 @@ |
| 173437 | 174788 | ** safe (no risk of overread) even if the node data is corrupted. */ |
| 173438 | 174789 | pNext += fts3GetVarint32(pNext, &nPrefix); |
| 173439 | 174790 | pNext += fts3GetVarint32(pNext, &nSuffix); |
| 173440 | 174791 | if( nSuffix<=0 |
| 173441 | 174792 | || (&pReader->aNode[pReader->nNode] - pNext)<nSuffix |
| 173442 | | - || nPrefix>pReader->nTermAlloc |
| 174793 | + || nPrefix>pReader->nTerm |
| 173443 | 174794 | ){ |
| 173444 | 174795 | return FTS_CORRUPT_VTAB; |
| 173445 | 174796 | } |
| 173446 | 174797 | |
| 173447 | 174798 | /* Both nPrefix and nSuffix were read by fts3GetVarint32() and so are |
| | @@ -174087,10 +175438,15 @@ |
| 174087 | 175438 | int nPrefix; /* Number of bytes of prefix compression */ |
| 174088 | 175439 | int nSuffix; /* Suffix length */ |
| 174089 | 175440 | |
| 174090 | 175441 | nPrefix = fts3PrefixCompress(pTree->zTerm, pTree->nTerm, zTerm, nTerm); |
| 174091 | 175442 | nSuffix = nTerm-nPrefix; |
| 175443 | + |
| 175444 | + /* If nSuffix is zero or less, then zTerm/nTerm must be a prefix of |
| 175445 | + ** pWriter->zTerm/pWriter->nTerm. i.e. must be equal to or less than when |
| 175446 | + ** compared with BINARY collation. This indicates corruption. */ |
| 175447 | + if( nSuffix<=0 ) return FTS_CORRUPT_VTAB; |
| 174092 | 175448 | |
| 174093 | 175449 | nReq += sqlite3Fts3VarintLen(nPrefix)+sqlite3Fts3VarintLen(nSuffix)+nSuffix; |
| 174094 | 175450 | if( nReq<=p->nNodeSize || !pTree->zTerm ){ |
| 174095 | 175451 | |
| 174096 | 175452 | if( nReq>p->nNodeSize ){ |
| | @@ -174381,13 +175737,15 @@ |
| 174381 | 175737 | assert( nData+nReq<=pWriter->nSize ); |
| 174382 | 175738 | |
| 174383 | 175739 | /* Append the prefix-compressed term and doclist to the buffer. */ |
| 174384 | 175740 | nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nPrefix); |
| 174385 | 175741 | nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nSuffix); |
| 175742 | + assert( nSuffix>0 ); |
| 174386 | 175743 | memcpy(&pWriter->aData[nData], &zTerm[nPrefix], nSuffix); |
| 174387 | 175744 | nData += nSuffix; |
| 174388 | 175745 | nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nDoclist); |
| 175746 | + assert( nDoclist>0 ); |
| 174389 | 175747 | memcpy(&pWriter->aData[nData], aDoclist, nDoclist); |
| 174390 | 175748 | pWriter->nData = nData + nDoclist; |
| 174391 | 175749 | |
| 174392 | 175750 | /* Save the current term so that it can be used to prefix-compress the next. |
| 174393 | 175751 | ** If the isCopyTerm parameter is true, then the buffer pointed to by |
| | @@ -174403,10 +175761,11 @@ |
| 174403 | 175761 | pWriter->nMalloc = nTerm*2; |
| 174404 | 175762 | pWriter->zMalloc = zNew; |
| 174405 | 175763 | pWriter->zTerm = zNew; |
| 174406 | 175764 | } |
| 174407 | 175765 | assert( pWriter->zTerm==pWriter->zMalloc ); |
| 175766 | + assert( nTerm>0 ); |
| 174408 | 175767 | memcpy(pWriter->zTerm, zTerm, nTerm); |
| 174409 | 175768 | }else{ |
| 174410 | 175769 | pWriter->zTerm = (char *)zTerm; |
| 174411 | 175770 | } |
| 174412 | 175771 | pWriter->nTerm = nTerm; |
| | @@ -174711,10 +176070,11 @@ |
| 174711 | 176070 | pNew = (char *)sqlite3_realloc(pMsr->aBuffer, pMsr->nBuffer); |
| 174712 | 176071 | if( !pNew ) return SQLITE_NOMEM; |
| 174713 | 176072 | pMsr->aBuffer = pNew; |
| 174714 | 176073 | } |
| 174715 | 176074 | |
| 176075 | + assert( nList>0 ); |
| 174716 | 176076 | memcpy(pMsr->aBuffer, pList, nList); |
| 174717 | 176077 | return SQLITE_OK; |
| 174718 | 176078 | } |
| 174719 | 176079 | |
| 174720 | 176080 | SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext( |
| | @@ -175024,18 +176384,16 @@ |
| 175024 | 176384 | |
| 175025 | 176385 | /* Calculate the 'docid' delta value to write into the merged |
| 175026 | 176386 | ** doclist. */ |
| 175027 | 176387 | sqlite3_int64 iDelta; |
| 175028 | 176388 | if( p->bDescIdx && nDoclist>0 ){ |
| 176389 | + if( iPrev<=iDocid ) return FTS_CORRUPT_VTAB; |
| 175029 | 176390 | iDelta = iPrev - iDocid; |
| 175030 | 176391 | }else{ |
| 176392 | + if( nDoclist>0 && iPrev>=iDocid ) return FTS_CORRUPT_VTAB; |
| 175031 | 176393 | iDelta = iDocid - iPrev; |
| 175032 | 176394 | } |
| 175033 | | - if( iDelta<=0 && (nDoclist>0 || iDelta!=iDocid) ){ |
| 175034 | | - return FTS_CORRUPT_VTAB; |
| 175035 | | - } |
| 175036 | | - assert( nDoclist>0 || iDelta==iDocid ); |
| 175037 | 176395 | |
| 175038 | 176396 | nByte = sqlite3Fts3VarintLen(iDelta) + (isRequirePos?nList+1:0); |
| 175039 | 176397 | if( nDoclist+nByte>pCsr->nBuffer ){ |
| 175040 | 176398 | char *aNew; |
| 175041 | 176399 | pCsr->nBuffer = (nDoclist+nByte)*2; |
| | @@ -175540,11 +176898,14 @@ |
| 175540 | 176898 | static int fts3DoOptimize(Fts3Table *p, int bReturnDone){ |
| 175541 | 176899 | int bSeenDone = 0; |
| 175542 | 176900 | int rc; |
| 175543 | 176901 | sqlite3_stmt *pAllLangid = 0; |
| 175544 | 176902 | |
| 175545 | | - rc = fts3SqlStmt(p, SQL_SELECT_ALL_LANGID, &pAllLangid, 0); |
| 176903 | + rc = sqlite3Fts3PendingTermsFlush(p); |
| 176904 | + if( rc==SQLITE_OK ){ |
| 176905 | + rc = fts3SqlStmt(p, SQL_SELECT_ALL_LANGID, &pAllLangid, 0); |
| 176906 | + } |
| 175546 | 176907 | if( rc==SQLITE_OK ){ |
| 175547 | 176908 | int rc2; |
| 175548 | 176909 | sqlite3_bind_int(pAllLangid, 1, p->iPrevLangid); |
| 175549 | 176910 | sqlite3_bind_int(pAllLangid, 2, p->nIndex); |
| 175550 | 176911 | while( sqlite3_step(pAllLangid)==SQLITE_ROW ){ |
| | @@ -175561,11 +176922,10 @@ |
| 175561 | 176922 | rc2 = sqlite3_reset(pAllLangid); |
| 175562 | 176923 | if( rc==SQLITE_OK ) rc = rc2; |
| 175563 | 176924 | } |
| 175564 | 176925 | |
| 175565 | 176926 | sqlite3Fts3SegmentsClose(p); |
| 175566 | | - sqlite3Fts3PendingTermsClear(p); |
| 175567 | 176927 | |
| 175568 | 176928 | return (rc==SQLITE_OK && bReturnDone && bSeenDone) ? SQLITE_DONE : rc; |
| 175569 | 176929 | } |
| 175570 | 176930 | |
| 175571 | 176931 | /* |
| | @@ -175899,10 +177259,11 @@ |
| 175899 | 177259 | ** the current node of layer iLayer. Due to the prefix compression, |
| 175900 | 177260 | ** the space required changes depending on which node the key is to |
| 175901 | 177261 | ** be added to. */ |
| 175902 | 177262 | nPrefix = fts3PrefixCompress(pNode->key.a, pNode->key.n, zTerm, nTerm); |
| 175903 | 177263 | nSuffix = nTerm - nPrefix; |
| 177264 | + if(nSuffix<=0 ) return FTS_CORRUPT_VTAB; |
| 175904 | 177265 | nSpace = sqlite3Fts3VarintLen(nPrefix); |
| 175905 | 177266 | nSpace += sqlite3Fts3VarintLen(nSuffix) + nSuffix; |
| 175906 | 177267 | |
| 175907 | 177268 | if( pNode->key.n==0 || (pNode->block.n + nSpace)<=p->nNodeSize ){ |
| 175908 | 177269 | /* If the current node of layer iLayer contains zero keys, or if adding |
| | @@ -176293,10 +177654,14 @@ |
| 176293 | 177654 | pWriter->nLeafData = pWriter->nLeafData * -1; |
| 176294 | 177655 | } |
| 176295 | 177656 | pWriter->bNoLeafData = (pWriter->nLeafData==0); |
| 176296 | 177657 | nRoot = sqlite3_column_bytes(pSelect, 4); |
| 176297 | 177658 | aRoot = sqlite3_column_blob(pSelect, 4); |
| 177659 | + if( aRoot==0 ){ |
| 177660 | + sqlite3_reset(pSelect); |
| 177661 | + return nRoot ? SQLITE_NOMEM : FTS_CORRUPT_VTAB; |
| 177662 | + } |
| 176298 | 177663 | }else{ |
| 176299 | 177664 | return sqlite3_reset(pSelect); |
| 176300 | 177665 | } |
| 176301 | 177666 | |
| 176302 | 177667 | /* Check for the zero-length marker in the %_segments table */ |
| | @@ -176328,10 +177693,14 @@ |
| 176328 | 177693 | /* It is possible to append to this segment. Set up the IncrmergeWriter |
| 176329 | 177694 | ** object to do so. */ |
| 176330 | 177695 | int i; |
| 176331 | 177696 | int nHeight = (int)aRoot[0]; |
| 176332 | 177697 | NodeWriter *pNode; |
| 177698 | + if( nHeight<1 || nHeight>FTS_MAX_APPENDABLE_HEIGHT ){ |
| 177699 | + sqlite3_reset(pSelect); |
| 177700 | + return FTS_CORRUPT_VTAB; |
| 177701 | + } |
| 176333 | 177702 | |
| 176334 | 177703 | pWriter->nLeafEst = (int)((iEnd - iStart) + 1)/FTS_MAX_APPENDABLE_HEIGHT; |
| 176335 | 177704 | pWriter->iStart = iStart; |
| 176336 | 177705 | pWriter->iEnd = iEnd; |
| 176337 | 177706 | pWriter->iAbsLevel = iAbsLevel; |
| | @@ -177006,12 +178375,19 @@ |
| 177006 | 178375 | if( rc==SQLITE_OK ){ |
| 177007 | 178376 | rc = fts3IncrmergeCsr(p, iAbsLevel, nSeg, pCsr); |
| 177008 | 178377 | } |
| 177009 | 178378 | if( SQLITE_OK==rc && pCsr->nSegment==nSeg |
| 177010 | 178379 | && SQLITE_OK==(rc = sqlite3Fts3SegReaderStart(p, pCsr, pFilter)) |
| 177011 | | - && SQLITE_ROW==(rc = sqlite3Fts3SegReaderStep(p, pCsr)) |
| 177012 | 178380 | ){ |
| 178381 | + int bEmpty = 0; |
| 178382 | + rc = sqlite3Fts3SegReaderStep(p, pCsr); |
| 178383 | + if( rc==SQLITE_OK ){ |
| 178384 | + bEmpty = 1; |
| 178385 | + }else if( rc!=SQLITE_ROW ){ |
| 178386 | + sqlite3Fts3SegReaderFinish(pCsr); |
| 178387 | + break; |
| 178388 | + } |
| 177013 | 178389 | if( bUseHint && iIdx>0 ){ |
| 177014 | 178390 | const char *zKey = pCsr->zTerm; |
| 177015 | 178391 | int nKey = pCsr->nTerm; |
| 177016 | 178392 | rc = fts3IncrmergeLoad(p, iAbsLevel, iIdx-1, zKey, nKey, pWriter); |
| 177017 | 178393 | }else{ |
| | @@ -177018,15 +178394,17 @@ |
| 177018 | 178394 | rc = fts3IncrmergeWriter(p, iAbsLevel, iIdx, pCsr, pWriter); |
| 177019 | 178395 | } |
| 177020 | 178396 | |
| 177021 | 178397 | if( rc==SQLITE_OK && pWriter->nLeafEst ){ |
| 177022 | 178398 | fts3LogMerge(nSeg, iAbsLevel); |
| 177023 | | - do { |
| 177024 | | - rc = fts3IncrmergeAppend(p, pWriter, pCsr); |
| 177025 | | - if( rc==SQLITE_OK ) rc = sqlite3Fts3SegReaderStep(p, pCsr); |
| 177026 | | - if( pWriter->nWork>=nRem && rc==SQLITE_ROW ) rc = SQLITE_OK; |
| 177027 | | - }while( rc==SQLITE_ROW ); |
| 178399 | + if( bEmpty==0 ){ |
| 178400 | + do { |
| 178401 | + rc = fts3IncrmergeAppend(p, pWriter, pCsr); |
| 178402 | + if( rc==SQLITE_OK ) rc = sqlite3Fts3SegReaderStep(p, pCsr); |
| 178403 | + if( pWriter->nWork>=nRem && rc==SQLITE_ROW ) rc = SQLITE_OK; |
| 178404 | + }while( rc==SQLITE_ROW ); |
| 178405 | + } |
| 177028 | 178406 | |
| 177029 | 178407 | /* Update or delete the input segments */ |
| 177030 | 178408 | if( rc==SQLITE_OK ){ |
| 177031 | 178409 | nRem -= (1 + pWriter->nWork); |
| 177032 | 178410 | rc = fts3IncrmergeChomp(p, iAbsLevel, pCsr, &nSeg); |
| | @@ -177087,11 +178465,11 @@ |
| 177087 | 178465 | static int fts3DoIncrmerge( |
| 177088 | 178466 | Fts3Table *p, /* FTS3 table handle */ |
| 177089 | 178467 | const char *zParam /* Nul-terminated string containing "A,B" */ |
| 177090 | 178468 | ){ |
| 177091 | 178469 | int rc; |
| 177092 | | - int nMin = (FTS3_MERGE_COUNT / 2); |
| 178470 | + int nMin = (MergeCount(p) / 2); |
| 177093 | 178471 | int nMerge = 0; |
| 177094 | 178472 | const char *z = zParam; |
| 177095 | 178473 | |
| 177096 | 178474 | /* Read the first integer value */ |
| 177097 | 178475 | nMerge = fts3Getint(&z); |
| | @@ -177132,11 +178510,11 @@ |
| 177132 | 178510 | const char *zParam /* Nul-terminated string containing boolean */ |
| 177133 | 178511 | ){ |
| 177134 | 178512 | int rc = SQLITE_OK; |
| 177135 | 178513 | sqlite3_stmt *pStmt = 0; |
| 177136 | 178514 | p->nAutoincrmerge = fts3Getint(&zParam); |
| 177137 | | - if( p->nAutoincrmerge==1 || p->nAutoincrmerge>FTS3_MERGE_COUNT ){ |
| 178515 | + if( p->nAutoincrmerge==1 || p->nAutoincrmerge>MergeCount(p) ){ |
| 177138 | 178516 | p->nAutoincrmerge = 8; |
| 177139 | 178517 | } |
| 177140 | 178518 | if( !p->bHasStat ){ |
| 177141 | 178519 | assert( p->bFts4==0 ); |
| 177142 | 178520 | sqlite3Fts3CreateStatTable(&rc, p); |
| | @@ -177229,11 +178607,15 @@ |
| 177229 | 178607 | iPos = 0; |
| 177230 | 178608 | if( iVal ){ |
| 177231 | 178609 | pCsr += sqlite3Fts3GetVarint(pCsr, &iCol); |
| 177232 | 178610 | }else{ |
| 177233 | 178611 | pCsr += sqlite3Fts3GetVarint(pCsr, &iVal); |
| 177234 | | - iDocid += iVal; |
| 178612 | + if( p->bDescIdx ){ |
| 178613 | + iDocid -= iVal; |
| 178614 | + }else{ |
| 178615 | + iDocid += iVal; |
| 178616 | + } |
| 177235 | 178617 | } |
| 177236 | 178618 | }else{ |
| 177237 | 178619 | iPos += (iVal - 2); |
| 177238 | 178620 | cksum = cksum ^ fts3ChecksumEntry( |
| 177239 | 178621 | csr.zTerm, csr.nTerm, iLangid, iIndex, iDocid, |
| | @@ -177302,14 +178684,13 @@ |
| 177302 | 178684 | int iCol; |
| 177303 | 178685 | |
| 177304 | 178686 | for(iCol=0; rc==SQLITE_OK && iCol<p->nColumn; iCol++){ |
| 177305 | 178687 | if( p->abNotindexed[iCol]==0 ){ |
| 177306 | 178688 | const char *zText = (const char *)sqlite3_column_text(pStmt, iCol+1); |
| 177307 | | - int nText = sqlite3_column_bytes(pStmt, iCol+1); |
| 177308 | 178689 | sqlite3_tokenizer_cursor *pT = 0; |
| 177309 | 178690 | |
| 177310 | | - rc = sqlite3Fts3OpenTokenizer(p->pTokenizer, iLang, zText, nText,&pT); |
| 178691 | + rc = sqlite3Fts3OpenTokenizer(p->pTokenizer, iLang, zText, -1, &pT); |
| 177311 | 178692 | while( rc==SQLITE_OK ){ |
| 177312 | 178693 | char const *zToken; /* Buffer containing token */ |
| 177313 | 178694 | int nToken = 0; /* Number of bytes in token */ |
| 177314 | 178695 | int iDum1 = 0, iDum2 = 0; /* Dummy variables */ |
| 177315 | 178696 | int iPos = 0; /* Position of token in zText */ |
| | @@ -177390,11 +178771,11 @@ |
| 177390 | 178771 | ** |
| 177391 | 178772 | ** Argument pVal contains the result of <expr>. Currently the only |
| 177392 | 178773 | ** meaningful value to insert is the text 'optimize'. |
| 177393 | 178774 | */ |
| 177394 | 178775 | static int fts3SpecialInsert(Fts3Table *p, sqlite3_value *pVal){ |
| 177395 | | - int rc; /* Return Code */ |
| 178776 | + int rc = SQLITE_ERROR; /* Return Code */ |
| 177396 | 178777 | const char *zVal = (const char *)sqlite3_value_text(pVal); |
| 177397 | 178778 | int nVal = sqlite3_value_bytes(pVal); |
| 177398 | 178779 | |
| 177399 | 178780 | if( !zVal ){ |
| 177400 | 178781 | return SQLITE_NOMEM; |
| | @@ -177406,25 +178787,31 @@ |
| 177406 | 178787 | rc = fts3DoIntegrityCheck(p); |
| 177407 | 178788 | }else if( nVal>6 && 0==sqlite3_strnicmp(zVal, "merge=", 6) ){ |
| 177408 | 178789 | rc = fts3DoIncrmerge(p, &zVal[6]); |
| 177409 | 178790 | }else if( nVal>10 && 0==sqlite3_strnicmp(zVal, "automerge=", 10) ){ |
| 177410 | 178791 | rc = fts3DoAutoincrmerge(p, &zVal[10]); |
| 177411 | | -#ifdef SQLITE_TEST |
| 177412 | | - }else if( nVal>9 && 0==sqlite3_strnicmp(zVal, "nodesize=", 9) ){ |
| 177413 | | - p->nNodeSize = atoi(&zVal[9]); |
| 177414 | | - rc = SQLITE_OK; |
| 177415 | | - }else if( nVal>11 && 0==sqlite3_strnicmp(zVal, "maxpending=", 9) ){ |
| 177416 | | - p->nMaxPendingData = atoi(&zVal[11]); |
| 177417 | | - rc = SQLITE_OK; |
| 177418 | | - }else if( nVal>21 && 0==sqlite3_strnicmp(zVal, "test-no-incr-doclist=", 21) ){ |
| 177419 | | - p->bNoIncrDoclist = atoi(&zVal[21]); |
| 177420 | | - rc = SQLITE_OK; |
| 178792 | +#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) |
| 178793 | + }else{ |
| 178794 | + int v; |
| 178795 | + if( nVal>9 && 0==sqlite3_strnicmp(zVal, "nodesize=", 9) ){ |
| 178796 | + v = atoi(&zVal[9]); |
| 178797 | + if( v>=24 && v<=p->nPgsz-35 ) p->nNodeSize = v; |
| 178798 | + rc = SQLITE_OK; |
| 178799 | + }else if( nVal>11 && 0==sqlite3_strnicmp(zVal, "maxpending=", 9) ){ |
| 178800 | + v = atoi(&zVal[11]); |
| 178801 | + if( v>=64 && v<=FTS3_MAX_PENDING_DATA ) p->nMaxPendingData = v; |
| 178802 | + rc = SQLITE_OK; |
| 178803 | + }else if( nVal>21 && 0==sqlite3_strnicmp(zVal,"test-no-incr-doclist=",21) ){ |
| 178804 | + p->bNoIncrDoclist = atoi(&zVal[21]); |
| 178805 | + rc = SQLITE_OK; |
| 178806 | + }else if( nVal>11 && 0==sqlite3_strnicmp(zVal,"mergecount=",11) ){ |
| 178807 | + v = atoi(&zVal[11]); |
| 178808 | + if( v>=4 && v<=FTS3_MERGE_COUNT && (v&1)==0 ) p->nMergeCount = v; |
| 178809 | + rc = SQLITE_OK; |
| 178810 | + } |
| 177421 | 178811 | #endif |
| 177422 | | - }else{ |
| 177423 | | - rc = SQLITE_ERROR; |
| 177424 | 178812 | } |
| 177425 | | - |
| 177426 | 178813 | return rc; |
| 177427 | 178814 | } |
| 177428 | 178815 | |
| 177429 | 178816 | #ifndef SQLITE_DISABLE_FTS4_DEFERRED |
| 177430 | 178817 | /* |
| | @@ -178825,29 +180212,41 @@ |
| 178825 | 180212 | |
| 178826 | 180213 | static int fts3MatchinfoSelectDoctotal( |
| 178827 | 180214 | Fts3Table *pTab, |
| 178828 | 180215 | sqlite3_stmt **ppStmt, |
| 178829 | 180216 | sqlite3_int64 *pnDoc, |
| 178830 | | - const char **paLen |
| 180217 | + const char **paLen, |
| 180218 | + const char **ppEnd |
| 178831 | 180219 | ){ |
| 178832 | 180220 | sqlite3_stmt *pStmt; |
| 178833 | 180221 | const char *a; |
| 180222 | + const char *pEnd; |
| 178834 | 180223 | sqlite3_int64 nDoc; |
| 180224 | + int n; |
| 180225 | + |
| 178835 | 180226 | |
| 178836 | 180227 | if( !*ppStmt ){ |
| 178837 | 180228 | int rc = sqlite3Fts3SelectDoctotal(pTab, ppStmt); |
| 178838 | 180229 | if( rc!=SQLITE_OK ) return rc; |
| 178839 | 180230 | } |
| 178840 | 180231 | pStmt = *ppStmt; |
| 178841 | 180232 | assert( sqlite3_data_count(pStmt)==1 ); |
| 178842 | 180233 | |
| 180234 | + n = sqlite3_column_bytes(pStmt, 0); |
| 178843 | 180235 | a = sqlite3_column_blob(pStmt, 0); |
| 178844 | | - a += sqlite3Fts3GetVarint(a, &nDoc); |
| 178845 | | - if( nDoc==0 ) return FTS_CORRUPT_VTAB; |
| 178846 | | - *pnDoc = (u32)nDoc; |
| 180236 | + if( a==0 ){ |
| 180237 | + return FTS_CORRUPT_VTAB; |
| 180238 | + } |
| 180239 | + pEnd = a + n; |
| 180240 | + a += sqlite3Fts3GetVarintBounded(a, pEnd, &nDoc); |
| 180241 | + if( nDoc<=0 || a>pEnd ){ |
| 180242 | + return FTS_CORRUPT_VTAB; |
| 180243 | + } |
| 180244 | + *pnDoc = nDoc; |
| 178847 | 180245 | |
| 178848 | 180246 | if( paLen ) *paLen = a; |
| 180247 | + if( ppEnd ) *ppEnd = pEnd; |
| 178849 | 180248 | return SQLITE_OK; |
| 178850 | 180249 | } |
| 178851 | 180250 | |
| 178852 | 180251 | /* |
| 178853 | 180252 | ** An instance of the following structure is used to store state while |
| | @@ -179024,27 +180423,32 @@ |
| 179024 | 180423 | break; |
| 179025 | 180424 | |
| 179026 | 180425 | case FTS3_MATCHINFO_NDOC: |
| 179027 | 180426 | if( bGlobal ){ |
| 179028 | 180427 | sqlite3_int64 nDoc = 0; |
| 179029 | | - rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, 0); |
| 180428 | + rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, 0, 0); |
| 179030 | 180429 | pInfo->aMatchinfo[0] = (u32)nDoc; |
| 179031 | 180430 | } |
| 179032 | 180431 | break; |
| 179033 | 180432 | |
| 179034 | 180433 | case FTS3_MATCHINFO_AVGLENGTH: |
| 179035 | 180434 | if( bGlobal ){ |
| 179036 | 180435 | sqlite3_int64 nDoc; /* Number of rows in table */ |
| 179037 | 180436 | const char *a; /* Aggregate column length array */ |
| 180437 | + const char *pEnd; /* First byte past end of length array */ |
| 179038 | 180438 | |
| 179039 | | - rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, &a); |
| 180439 | + rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, &a, &pEnd); |
| 179040 | 180440 | if( rc==SQLITE_OK ){ |
| 179041 | 180441 | int iCol; |
| 179042 | 180442 | for(iCol=0; iCol<pInfo->nCol; iCol++){ |
| 179043 | 180443 | u32 iVal; |
| 179044 | 180444 | sqlite3_int64 nToken; |
| 179045 | 180445 | a += sqlite3Fts3GetVarint(a, &nToken); |
| 180446 | + if( a>pEnd ){ |
| 180447 | + rc = SQLITE_CORRUPT_VTAB; |
| 180448 | + break; |
| 180449 | + } |
| 179046 | 180450 | iVal = (u32)(((u32)(nToken&0xffffffff)+nDoc/2)/nDoc); |
| 179047 | 180451 | pInfo->aMatchinfo[iCol] = iVal; |
| 179048 | 180452 | } |
| 179049 | 180453 | } |
| 179050 | 180454 | } |
| | @@ -179054,13 +180458,18 @@ |
| 179054 | 180458 | sqlite3_stmt *pSelectDocsize = 0; |
| 179055 | 180459 | rc = sqlite3Fts3SelectDocsize(pTab, pCsr->iPrevId, &pSelectDocsize); |
| 179056 | 180460 | if( rc==SQLITE_OK ){ |
| 179057 | 180461 | int iCol; |
| 179058 | 180462 | const char *a = sqlite3_column_blob(pSelectDocsize, 0); |
| 180463 | + const char *pEnd = a + sqlite3_column_bytes(pSelectDocsize, 0); |
| 179059 | 180464 | for(iCol=0; iCol<pInfo->nCol; iCol++){ |
| 179060 | 180465 | sqlite3_int64 nToken; |
| 179061 | | - a += sqlite3Fts3GetVarint(a, &nToken); |
| 180466 | + a += sqlite3Fts3GetVarintBounded(a, pEnd, &nToken); |
| 180467 | + if( a>pEnd ){ |
| 180468 | + rc = SQLITE_CORRUPT_VTAB; |
| 180469 | + break; |
| 180470 | + } |
| 179062 | 180471 | pInfo->aMatchinfo[iCol] = (u32)nToken; |
| 179063 | 180472 | } |
| 179064 | 180473 | } |
| 179065 | 180474 | sqlite3_reset(pSelectDocsize); |
| 179066 | 180475 | break; |
| | @@ -179087,11 +180496,11 @@ |
| 179087 | 180496 | pExpr = pCsr->pExpr; |
| 179088 | 180497 | rc = fts3ExprLoadDoclists(pCsr, 0, 0); |
| 179089 | 180498 | if( rc!=SQLITE_OK ) break; |
| 179090 | 180499 | if( bGlobal ){ |
| 179091 | 180500 | if( pCsr->pDeferred ){ |
| 179092 | | - rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &pInfo->nDoc, 0); |
| 180501 | + rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &pInfo->nDoc,0,0); |
| 179093 | 180502 | if( rc!=SQLITE_OK ) break; |
| 179094 | 180503 | } |
| 179095 | 180504 | rc = fts3ExprIterate(pExpr, fts3ExprGlobalHitsCb,(void*)pInfo); |
| 179096 | 180505 | sqlite3Fts3EvalTestDeferred(pCsr, &rc); |
| 179097 | 180506 | if( rc!=SQLITE_OK ) break; |
| | @@ -180822,10 +182231,41 @@ |
| 180822 | 182231 | jsonInit(&s, pCtx); |
| 180823 | 182232 | jsonRenderNode(pNode, &s, aReplace); |
| 180824 | 182233 | jsonResult(&s); |
| 180825 | 182234 | sqlite3_result_subtype(pCtx, JSON_SUBTYPE); |
| 180826 | 182235 | } |
| 182236 | + |
| 182237 | +/* |
| 182238 | +** Translate a single byte of Hex into an integer. |
| 182239 | +** This routine only works if h really is a valid hexadecimal |
| 182240 | +** character: 0..9a..fA..F |
| 182241 | +*/ |
| 182242 | +static u8 jsonHexToInt(int h){ |
| 182243 | + assert( (h>='0' && h<='9') || (h>='a' && h<='f') || (h>='A' && h<='F') ); |
| 182244 | +#ifdef SQLITE_EBCDIC |
| 182245 | + h += 9*(1&~(h>>4)); |
| 182246 | +#else |
| 182247 | + h += 9*(1&(h>>6)); |
| 182248 | +#endif |
| 182249 | + return (u8)(h & 0xf); |
| 182250 | +} |
| 182251 | + |
| 182252 | +/* |
| 182253 | +** Convert a 4-byte hex string into an integer |
| 182254 | +*/ |
| 182255 | +static u32 jsonHexToInt4(const char *z){ |
| 182256 | + u32 v; |
| 182257 | + assert( safe_isxdigit(z[0]) ); |
| 182258 | + assert( safe_isxdigit(z[1]) ); |
| 182259 | + assert( safe_isxdigit(z[2]) ); |
| 182260 | + assert( safe_isxdigit(z[3]) ); |
| 182261 | + v = (jsonHexToInt(z[0])<<12) |
| 182262 | + + (jsonHexToInt(z[1])<<8) |
| 182263 | + + (jsonHexToInt(z[2])<<4) |
| 182264 | + + jsonHexToInt(z[3]); |
| 182265 | + return v; |
| 182266 | +} |
| 180827 | 182267 | |
| 180828 | 182268 | /* |
| 180829 | 182269 | ** Make the JsonNode the return value of the function. |
| 180830 | 182270 | */ |
| 180831 | 182271 | static void jsonReturn( |
| | @@ -180916,29 +182356,38 @@ |
| 180916 | 182356 | if( c!='\\' ){ |
| 180917 | 182357 | zOut[j++] = c; |
| 180918 | 182358 | }else{ |
| 180919 | 182359 | c = z[++i]; |
| 180920 | 182360 | if( c=='u' ){ |
| 180921 | | - u32 v = 0, k; |
| 180922 | | - for(k=0; k<4; i++, k++){ |
| 180923 | | - assert( i<n-2 ); |
| 180924 | | - c = z[i+1]; |
| 180925 | | - assert( safe_isxdigit(c) ); |
| 180926 | | - if( c<='9' ) v = v*16 + c - '0'; |
| 180927 | | - else if( c<='F' ) v = v*16 + c - 'A' + 10; |
| 180928 | | - else v = v*16 + c - 'a' + 10; |
| 180929 | | - } |
| 182361 | + u32 v = jsonHexToInt4(z+i+1); |
| 182362 | + i += 4; |
| 180930 | 182363 | if( v==0 ) break; |
| 180931 | 182364 | if( v<=0x7f ){ |
| 180932 | 182365 | zOut[j++] = (char)v; |
| 180933 | 182366 | }else if( v<=0x7ff ){ |
| 180934 | 182367 | zOut[j++] = (char)(0xc0 | (v>>6)); |
| 180935 | 182368 | zOut[j++] = 0x80 | (v&0x3f); |
| 180936 | 182369 | }else{ |
| 180937 | | - zOut[j++] = (char)(0xe0 | (v>>12)); |
| 180938 | | - zOut[j++] = 0x80 | ((v>>6)&0x3f); |
| 180939 | | - zOut[j++] = 0x80 | (v&0x3f); |
| 182370 | + u32 vlo; |
| 182371 | + if( (v&0xfc00)==0xd800 |
| 182372 | + && i<n-6 |
| 182373 | + && z[i+1]=='\\' |
| 182374 | + && z[i+2]=='u' |
| 182375 | + && ((vlo = jsonHexToInt4(z+i+3))&0xfc00)==0xdc00 |
| 182376 | + ){ |
| 182377 | + /* We have a surrogate pair */ |
| 182378 | + v = ((v&0x3ff)<<10) + (vlo&0x3ff) + 0x10000; |
| 182379 | + i += 6; |
| 182380 | + zOut[j++] = 0xf0 | (v>>18); |
| 182381 | + zOut[j++] = 0x80 | ((v>>12)&0x3f); |
| 182382 | + zOut[j++] = 0x80 | ((v>>6)&0x3f); |
| 182383 | + zOut[j++] = 0x80 | (v&0x3f); |
| 182384 | + }else{ |
| 182385 | + zOut[j++] = 0xe0 | (v>>12); |
| 182386 | + zOut[j++] = 0x80 | ((v>>6)&0x3f); |
| 182387 | + zOut[j++] = 0x80 | (v&0x3f); |
| 182388 | + } |
| 180940 | 182389 | } |
| 180941 | 182390 | }else{ |
| 180942 | 182391 | if( c=='b' ){ |
| 180943 | 182392 | c = '\b'; |
| 180944 | 182393 | }else if( c=='f' ){ |
| | @@ -195928,11 +197377,11 @@ |
| 195928 | 197377 | ** |
| 195929 | 197378 | ****************************************************************************** |
| 195930 | 197379 | ** |
| 195931 | 197380 | ** This file contains an implementation of the "dbstat" virtual table. |
| 195932 | 197381 | ** |
| 195933 | | -** The dbstat virtual table is used to extract low-level formatting |
| 197382 | +** The dbstat virtual table is used to extract low-level storage |
| 195934 | 197383 | ** information from an SQLite database in order to implement the |
| 195935 | 197384 | ** "sqlite3_analyzer" utility. See the ../tool/spaceanal.tcl script |
| 195936 | 197385 | ** for an example implementation. |
| 195937 | 197386 | ** |
| 195938 | 197387 | ** Additional information is available on the "dbstat.html" page of the |
| | @@ -195972,90 +197421,98 @@ |
| 195972 | 197421 | ** the overflow pages associated with a cell will appear earlier in the |
| 195973 | 197422 | ** sort-order than its child page: |
| 195974 | 197423 | ** |
| 195975 | 197424 | ** '/1c2/000/' // Left-most child of 451st child of root |
| 195976 | 197425 | */ |
| 195977 | | -#define VTAB_SCHEMA \ |
| 195978 | | - "CREATE TABLE xx( " \ |
| 195979 | | - " name TEXT, /* Name of table or index */" \ |
| 195980 | | - " path TEXT, /* Path to page from root */" \ |
| 195981 | | - " pageno INTEGER, /* Page number */" \ |
| 195982 | | - " pagetype TEXT, /* 'internal', 'leaf' or 'overflow' */" \ |
| 195983 | | - " ncell INTEGER, /* Cells on page (0 for overflow) */" \ |
| 195984 | | - " payload INTEGER, /* Bytes of payload on this page */" \ |
| 195985 | | - " unused INTEGER, /* Bytes of unused space on this page */" \ |
| 195986 | | - " mx_payload INTEGER, /* Largest payload size of all cells */" \ |
| 195987 | | - " pgoffset INTEGER, /* Offset of page in file */" \ |
| 195988 | | - " pgsize INTEGER, /* Size of the page */" \ |
| 195989 | | - " schema TEXT HIDDEN /* Database schema being analyzed */" \ |
| 195990 | | - ");" |
| 195991 | | - |
| 195992 | | - |
| 197426 | +static const char zDbstatSchema[] = |
| 197427 | + "CREATE TABLE x(" |
| 197428 | + " name TEXT," /* 0 Name of table or index */ |
| 197429 | + " path TEXT," /* 1 Path to page from root (NULL for agg) */ |
| 197430 | + " pageno INTEGER," /* 2 Page number (page count for aggregates) */ |
| 197431 | + " pagetype TEXT," /* 3 'internal', 'leaf', 'overflow', or NULL */ |
| 197432 | + " ncell INTEGER," /* 4 Cells on page (0 for overflow) */ |
| 197433 | + " payload INTEGER," /* 5 Bytes of payload on this page */ |
| 197434 | + " unused INTEGER," /* 6 Bytes of unused space on this page */ |
| 197435 | + " mx_payload INTEGER," /* 7 Largest payload size of all cells */ |
| 197436 | + " pgoffset INTEGER," /* 8 Offset of page in file (NULL for agg) */ |
| 197437 | + " pgsize INTEGER," /* 9 Size of the page (sum for aggregate) */ |
| 197438 | + " schema TEXT HIDDEN," /* 10 Database schema being analyzed */ |
| 197439 | + " aggregate BOOLEAN HIDDEN" /* 11 aggregate info for each table */ |
| 197440 | + ")" |
| 197441 | +; |
| 197442 | + |
| 197443 | +/* Forward reference to data structured used in this module */ |
| 195993 | 197444 | typedef struct StatTable StatTable; |
| 195994 | 197445 | typedef struct StatCursor StatCursor; |
| 195995 | 197446 | typedef struct StatPage StatPage; |
| 195996 | 197447 | typedef struct StatCell StatCell; |
| 195997 | 197448 | |
| 197449 | +/* Size information for a single cell within a btree page */ |
| 195998 | 197450 | struct StatCell { |
| 195999 | 197451 | int nLocal; /* Bytes of local payload */ |
| 196000 | 197452 | u32 iChildPg; /* Child node (or 0 if this is a leaf) */ |
| 196001 | 197453 | int nOvfl; /* Entries in aOvfl[] */ |
| 196002 | 197454 | u32 *aOvfl; /* Array of overflow page numbers */ |
| 196003 | 197455 | int nLastOvfl; /* Bytes of payload on final overflow page */ |
| 196004 | 197456 | int iOvfl; /* Iterates through aOvfl[] */ |
| 196005 | 197457 | }; |
| 196006 | 197458 | |
| 197459 | +/* Size information for a single btree page */ |
| 196007 | 197460 | struct StatPage { |
| 196008 | | - u32 iPgno; |
| 196009 | | - DbPage *pPg; |
| 196010 | | - int iCell; |
| 197461 | + u32 iPgno; /* Page number */ |
| 197462 | + DbPage *pPg; /* Page content */ |
| 197463 | + int iCell; /* Current cell */ |
| 196011 | 197464 | |
| 196012 | 197465 | char *zPath; /* Path to this page */ |
| 196013 | 197466 | |
| 196014 | 197467 | /* Variables populated by statDecodePage(): */ |
| 196015 | 197468 | u8 flags; /* Copy of flags byte */ |
| 196016 | 197469 | int nCell; /* Number of cells on page */ |
| 196017 | 197470 | int nUnused; /* Number of unused bytes on page */ |
| 196018 | 197471 | StatCell *aCell; /* Array of parsed cells */ |
| 196019 | 197472 | u32 iRightChildPg; /* Right-child page number (or 0) */ |
| 196020 | | - int nMxPayload; /* Largest payload of any cell on this page */ |
| 197473 | + int nMxPayload; /* Largest payload of any cell on the page */ |
| 196021 | 197474 | }; |
| 196022 | 197475 | |
| 197476 | +/* The cursor for scanning the dbstat virtual table */ |
| 196023 | 197477 | struct StatCursor { |
| 196024 | | - sqlite3_vtab_cursor base; |
| 197478 | + sqlite3_vtab_cursor base; /* base class. MUST BE FIRST! */ |
| 196025 | 197479 | sqlite3_stmt *pStmt; /* Iterates through set of root pages */ |
| 196026 | | - int isEof; /* After pStmt has returned SQLITE_DONE */ |
| 197480 | + u8 isEof; /* After pStmt has returned SQLITE_DONE */ |
| 197481 | + u8 isAgg; /* Aggregate results for each table */ |
| 196027 | 197482 | int iDb; /* Schema used for this query */ |
| 196028 | 197483 | |
| 196029 | | - StatPage aPage[32]; |
| 197484 | + StatPage aPage[32]; /* Pages in path to current page */ |
| 196030 | 197485 | int iPage; /* Current entry in aPage[] */ |
| 196031 | 197486 | |
| 196032 | 197487 | /* Values to return. */ |
| 197488 | + u32 iPageno; /* Value of 'pageno' column */ |
| 196033 | 197489 | char *zName; /* Value of 'name' column */ |
| 196034 | 197490 | char *zPath; /* Value of 'path' column */ |
| 196035 | | - u32 iPageno; /* Value of 'pageno' column */ |
| 196036 | 197491 | char *zPagetype; /* Value of 'pagetype' column */ |
| 197492 | + int nPage; /* Number of pages in current btree */ |
| 196037 | 197493 | int nCell; /* Value of 'ncell' column */ |
| 196038 | | - int nPayload; /* Value of 'payload' column */ |
| 196039 | | - int nUnused; /* Value of 'unused' column */ |
| 196040 | 197494 | int nMxPayload; /* Value of 'mx_payload' column */ |
| 197495 | + i64 nUnused; /* Value of 'unused' column */ |
| 197496 | + i64 nPayload; /* Value of 'payload' column */ |
| 196041 | 197497 | i64 iOffset; /* Value of 'pgOffset' column */ |
| 196042 | | - int szPage; /* Value of 'pgSize' column */ |
| 197498 | + i64 szPage; /* Value of 'pgSize' column */ |
| 196043 | 197499 | }; |
| 196044 | 197500 | |
| 197501 | +/* An instance of the DBSTAT virtual table */ |
| 196045 | 197502 | struct StatTable { |
| 196046 | | - sqlite3_vtab base; |
| 196047 | | - sqlite3 *db; |
| 197503 | + sqlite3_vtab base; /* base class. MUST BE FIRST! */ |
| 197504 | + sqlite3 *db; /* Database connection that owns this vtab */ |
| 196048 | 197505 | int iDb; /* Index of database to analyze */ |
| 196049 | 197506 | }; |
| 196050 | 197507 | |
| 196051 | 197508 | #ifndef get2byte |
| 196052 | 197509 | # define get2byte(x) ((x)[0]<<8 | (x)[1]) |
| 196053 | 197510 | #endif |
| 196054 | 197511 | |
| 196055 | 197512 | /* |
| 196056 | | -** Connect to or create a statvfs virtual table. |
| 197513 | +** Connect to or create a new DBSTAT virtual table. |
| 196057 | 197514 | */ |
| 196058 | 197515 | static int statConnect( |
| 196059 | 197516 | sqlite3 *db, |
| 196060 | 197517 | void *pAux, |
| 196061 | 197518 | int argc, const char *const*argv, |
| | @@ -196075,11 +197532,11 @@ |
| 196075 | 197532 | return SQLITE_ERROR; |
| 196076 | 197533 | } |
| 196077 | 197534 | }else{ |
| 196078 | 197535 | iDb = 0; |
| 196079 | 197536 | } |
| 196080 | | - rc = sqlite3_declare_vtab(db, VTAB_SCHEMA); |
| 197537 | + rc = sqlite3_declare_vtab(db, zDbstatSchema); |
| 196081 | 197538 | if( rc==SQLITE_OK ){ |
| 196082 | 197539 | pTab = (StatTable *)sqlite3_malloc64(sizeof(StatTable)); |
| 196083 | 197540 | if( pTab==0 ) rc = SQLITE_NOMEM_BKPT; |
| 196084 | 197541 | } |
| 196085 | 197542 | |
| | @@ -196093,43 +197550,76 @@ |
| 196093 | 197550 | *ppVtab = (sqlite3_vtab*)pTab; |
| 196094 | 197551 | return rc; |
| 196095 | 197552 | } |
| 196096 | 197553 | |
| 196097 | 197554 | /* |
| 196098 | | -** Disconnect from or destroy a statvfs virtual table. |
| 197555 | +** Disconnect from or destroy the DBSTAT virtual table. |
| 196099 | 197556 | */ |
| 196100 | 197557 | static int statDisconnect(sqlite3_vtab *pVtab){ |
| 196101 | 197558 | sqlite3_free(pVtab); |
| 196102 | 197559 | return SQLITE_OK; |
| 196103 | 197560 | } |
| 196104 | 197561 | |
| 196105 | 197562 | /* |
| 196106 | | -** There is no "best-index". This virtual table always does a linear |
| 196107 | | -** scan. However, a schema=? constraint should cause this table to |
| 196108 | | -** operate on a different database schema, so check for it. |
| 197563 | +** Compute the best query strategy and return the result in idxNum. |
| 196109 | 197564 | ** |
| 196110 | | -** idxNum is normally 0, but will be 1 if a schema=? constraint exists. |
| 197565 | +** idxNum-Bit Meaning |
| 197566 | +** ---------- ---------------------------------------------- |
| 197567 | +** 0x01 There is a schema=? term in the WHERE clause |
| 197568 | +** 0x02 There is a name=? term in the WHERE clause |
| 197569 | +** 0x04 There is an aggregate=? term in the WHERE clause |
| 197570 | +** 0x08 Output should be ordered by name and path |
| 196111 | 197571 | */ |
| 196112 | 197572 | static int statBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ |
| 196113 | 197573 | int i; |
| 197574 | + int iSchema = -1; |
| 197575 | + int iName = -1; |
| 197576 | + int iAgg = -1; |
| 196114 | 197577 | |
| 196115 | 197578 | /* Look for a valid schema=? constraint. If found, change the idxNum to |
| 196116 | 197579 | ** 1 and request the value of that constraint be sent to xFilter. And |
| 196117 | 197580 | ** lower the cost estimate to encourage the constrained version to be |
| 196118 | 197581 | ** used. |
| 196119 | 197582 | */ |
| 196120 | 197583 | for(i=0; i<pIdxInfo->nConstraint; i++){ |
| 196121 | | - if( pIdxInfo->aConstraint[i].iColumn!=10 ) continue; |
| 196122 | | - if( pIdxInfo->aConstraint[i].usable==0 ) return SQLITE_CONSTRAINT; |
| 196123 | 197584 | if( pIdxInfo->aConstraint[i].op!=SQLITE_INDEX_CONSTRAINT_EQ ) continue; |
| 196124 | | - pIdxInfo->idxNum = 1; |
| 196125 | | - pIdxInfo->estimatedCost = 1.0; |
| 196126 | | - pIdxInfo->aConstraintUsage[i].argvIndex = 1; |
| 196127 | | - pIdxInfo->aConstraintUsage[i].omit = 1; |
| 196128 | | - break; |
| 197585 | + if( pIdxInfo->aConstraint[i].usable==0 ){ |
| 197586 | + /* Force DBSTAT table should always be the right-most table in a join */ |
| 197587 | + return SQLITE_CONSTRAINT; |
| 197588 | + } |
| 197589 | + switch( pIdxInfo->aConstraint[i].iColumn ){ |
| 197590 | + case 0: { /* name */ |
| 197591 | + iName = i; |
| 197592 | + break; |
| 197593 | + } |
| 197594 | + case 10: { /* schema */ |
| 197595 | + iSchema = i; |
| 197596 | + break; |
| 197597 | + } |
| 197598 | + case 11: { /* aggregate */ |
| 197599 | + iAgg = i; |
| 197600 | + break; |
| 197601 | + } |
| 197602 | + } |
| 196129 | 197603 | } |
| 196130 | | - |
| 197604 | + i = 0; |
| 197605 | + if( iSchema>=0 ){ |
| 197606 | + pIdxInfo->aConstraintUsage[iSchema].argvIndex = ++i; |
| 197607 | + pIdxInfo->aConstraintUsage[iSchema].omit = 1; |
| 197608 | + pIdxInfo->idxNum |= 0x01; |
| 197609 | + } |
| 197610 | + if( iName>=0 ){ |
| 197611 | + pIdxInfo->aConstraintUsage[iName].argvIndex = ++i; |
| 197612 | + pIdxInfo->aConstraintUsage[iName].omit = 1; |
| 197613 | + pIdxInfo->idxNum |= 0x02; |
| 197614 | + } |
| 197615 | + if( iAgg>=0 ){ |
| 197616 | + pIdxInfo->aConstraintUsage[iAgg].argvIndex = ++i; |
| 197617 | + pIdxInfo->aConstraintUsage[iAgg].omit = 1; |
| 197618 | + pIdxInfo->idxNum |= 0x04; |
| 197619 | + } |
| 197620 | + pIdxInfo->estimatedCost = 1.0; |
| 196131 | 197621 | |
| 196132 | 197622 | /* Records are always returned in ascending order of (name, path). |
| 196133 | 197623 | ** If this will satisfy the client, set the orderByConsumed flag so that |
| 196134 | 197624 | ** SQLite does not do an external sort. |
| 196135 | 197625 | */ |
| | @@ -196143,17 +197633,18 @@ |
| 196143 | 197633 | && pIdxInfo->aOrderBy[1].iColumn==1 |
| 196144 | 197634 | && pIdxInfo->aOrderBy[1].desc==0 |
| 196145 | 197635 | ) |
| 196146 | 197636 | ){ |
| 196147 | 197637 | pIdxInfo->orderByConsumed = 1; |
| 197638 | + pIdxInfo->idxNum |= 0x08; |
| 196148 | 197639 | } |
| 196149 | 197640 | |
| 196150 | 197641 | return SQLITE_OK; |
| 196151 | 197642 | } |
| 196152 | 197643 | |
| 196153 | 197644 | /* |
| 196154 | | -** Open a new statvfs cursor. |
| 197645 | +** Open a new DBSTAT cursor. |
| 196155 | 197646 | */ |
| 196156 | 197647 | static int statOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ |
| 196157 | 197648 | StatTable *pTab = (StatTable *)pVTab; |
| 196158 | 197649 | StatCursor *pCsr; |
| 196159 | 197650 | |
| | @@ -196198,27 +197689,41 @@ |
| 196198 | 197689 | pCsr->iPage = 0; |
| 196199 | 197690 | sqlite3_free(pCsr->zPath); |
| 196200 | 197691 | pCsr->zPath = 0; |
| 196201 | 197692 | pCsr->isEof = 0; |
| 196202 | 197693 | } |
| 197694 | + |
| 197695 | +/* Resize the space-used counters inside of the cursor */ |
| 197696 | +static void statResetCounts(StatCursor *pCsr){ |
| 197697 | + pCsr->nCell = 0; |
| 197698 | + pCsr->nMxPayload = 0; |
| 197699 | + pCsr->nUnused = 0; |
| 197700 | + pCsr->nPayload = 0; |
| 197701 | + pCsr->szPage = 0; |
| 197702 | + pCsr->nPage = 0; |
| 197703 | +} |
| 196203 | 197704 | |
| 196204 | 197705 | /* |
| 196205 | | -** Close a statvfs cursor. |
| 197706 | +** Close a DBSTAT cursor. |
| 196206 | 197707 | */ |
| 196207 | 197708 | static int statClose(sqlite3_vtab_cursor *pCursor){ |
| 196208 | 197709 | StatCursor *pCsr = (StatCursor *)pCursor; |
| 196209 | 197710 | statResetCsr(pCsr); |
| 196210 | 197711 | sqlite3_finalize(pCsr->pStmt); |
| 196211 | 197712 | sqlite3_free(pCsr); |
| 196212 | 197713 | return SQLITE_OK; |
| 196213 | 197714 | } |
| 196214 | 197715 | |
| 196215 | | -static void getLocalPayload( |
| 197716 | +/* |
| 197717 | +** For a single cell on a btree page, compute the number of bytes of |
| 197718 | +** content (payload) stored on that page. That is to say, compute the |
| 197719 | +** number of bytes of content not found on overflow pages. |
| 197720 | +*/ |
| 197721 | +static int getLocalPayload( |
| 196216 | 197722 | int nUsable, /* Usable bytes per page */ |
| 196217 | 197723 | u8 flags, /* Page flags */ |
| 196218 | | - int nTotal, /* Total record (payload) size */ |
| 196219 | | - int *pnLocal /* OUT: Bytes stored locally */ |
| 197724 | + int nTotal /* Total record (payload) size */ |
| 196220 | 197725 | ){ |
| 196221 | 197726 | int nLocal; |
| 196222 | 197727 | int nMinLocal; |
| 196223 | 197728 | int nMaxLocal; |
| 196224 | 197729 | |
| | @@ -196230,13 +197735,16 @@ |
| 196230 | 197735 | nMaxLocal = (nUsable - 12) * 64 / 255 - 23; |
| 196231 | 197736 | } |
| 196232 | 197737 | |
| 196233 | 197738 | nLocal = nMinLocal + (nTotal - nMinLocal) % (nUsable - 4); |
| 196234 | 197739 | if( nLocal>nMaxLocal ) nLocal = nMinLocal; |
| 196235 | | - *pnLocal = nLocal; |
| 197740 | + return nLocal; |
| 196236 | 197741 | } |
| 196237 | 197742 | |
| 197743 | +/* Populate the StatPage object with information about the all |
| 197744 | +** cells found on the page currently under analysis. |
| 197745 | +*/ |
| 196238 | 197746 | static int statDecodePage(Btree *pBt, StatPage *p){ |
| 196239 | 197747 | int nUnused; |
| 196240 | 197748 | int iOff; |
| 196241 | 197749 | int nHdr; |
| 196242 | 197750 | int isLeaf; |
| | @@ -196303,11 +197811,11 @@ |
| 196303 | 197811 | if( p->flags==0x0D ){ |
| 196304 | 197812 | u64 dummy; |
| 196305 | 197813 | iOff += sqlite3GetVarint(&aData[iOff], &dummy); |
| 196306 | 197814 | } |
| 196307 | 197815 | if( nPayload>(u32)p->nMxPayload ) p->nMxPayload = nPayload; |
| 196308 | | - getLocalPayload(nUsable, p->flags, nPayload, &nLocal); |
| 197816 | + nLocal = getLocalPayload(nUsable, p->flags, nPayload); |
| 196309 | 197817 | if( nLocal<0 ) goto statPageIsCorrupt; |
| 196310 | 197818 | pCell->nLocal = nLocal; |
| 196311 | 197819 | assert( nPayload>=(u32)nLocal ); |
| 196312 | 197820 | assert( nLocal<=(nUsable-35) ); |
| 196313 | 197821 | if( nPayload>(u32)nLocal ){ |
| | @@ -196353,27 +197861,29 @@ |
| 196353 | 197861 | Btree *pBt = pTab->db->aDb[pTab->iDb].pBt; |
| 196354 | 197862 | Pager *pPager = sqlite3BtreePager(pBt); |
| 196355 | 197863 | sqlite3_file *fd; |
| 196356 | 197864 | sqlite3_int64 x[2]; |
| 196357 | 197865 | |
| 196358 | | - /* The default page size and offset */ |
| 196359 | | - pCsr->szPage = sqlite3BtreeGetPageSize(pBt); |
| 196360 | | - pCsr->iOffset = (i64)pCsr->szPage * (pCsr->iPageno - 1); |
| 196361 | | - |
| 196362 | | - /* If connected to a ZIPVFS backend, override the page size and |
| 196363 | | - ** offset with actual values obtained from ZIPVFS. |
| 197866 | + /* If connected to a ZIPVFS backend, find the page size and |
| 197867 | + ** offset from ZIPVFS. |
| 196364 | 197868 | */ |
| 196365 | 197869 | fd = sqlite3PagerFile(pPager); |
| 196366 | 197870 | x[0] = pCsr->iPageno; |
| 196367 | 197871 | if( sqlite3OsFileControl(fd, 230440, &x)==SQLITE_OK ){ |
| 196368 | 197872 | pCsr->iOffset = x[0]; |
| 196369 | | - pCsr->szPage = (int)x[1]; |
| 197873 | + pCsr->szPage += x[1]; |
| 197874 | + }else{ |
| 197875 | + /* Not ZIPVFS: The default page size and offset */ |
| 197876 | + pCsr->szPage += sqlite3BtreeGetPageSize(pBt); |
| 197877 | + pCsr->iOffset = (i64)pCsr->szPage * (pCsr->iPageno - 1); |
| 196370 | 197878 | } |
| 196371 | 197879 | } |
| 196372 | 197880 | |
| 196373 | 197881 | /* |
| 196374 | | -** Move a statvfs cursor to the next entry in the file. |
| 197882 | +** Move a DBSTAT cursor to the next entry. Normally, the next |
| 197883 | +** entry will be the next page, but in aggregated mode (pCsr->isAgg!=0), |
| 197884 | +** the next entry is the next btree. |
| 196375 | 197885 | */ |
| 196376 | 197886 | static int statNext(sqlite3_vtab_cursor *pCursor){ |
| 196377 | 197887 | int rc; |
| 196378 | 197888 | int nPayload; |
| 196379 | 197889 | char *z; |
| | @@ -196385,10 +197895,12 @@ |
| 196385 | 197895 | sqlite3_free(pCsr->zPath); |
| 196386 | 197896 | pCsr->zPath = 0; |
| 196387 | 197897 | |
| 196388 | 197898 | statNextRestart: |
| 196389 | 197899 | if( pCsr->aPage[0].pPg==0 ){ |
| 197900 | + /* Start measuring space on the next btree */ |
| 197901 | + statResetCounts(pCsr); |
| 196390 | 197902 | rc = sqlite3_step(pCsr->pStmt); |
| 196391 | 197903 | if( rc==SQLITE_ROW ){ |
| 196392 | 197904 | int nPage; |
| 196393 | 197905 | u32 iRoot = (u32)sqlite3_column_int64(pCsr->pStmt, 1); |
| 196394 | 197906 | sqlite3PagerPagecount(pPager, &nPage); |
| | @@ -196397,57 +197909,65 @@ |
| 196397 | 197909 | return sqlite3_reset(pCsr->pStmt); |
| 196398 | 197910 | } |
| 196399 | 197911 | rc = sqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg, 0); |
| 196400 | 197912 | pCsr->aPage[0].iPgno = iRoot; |
| 196401 | 197913 | pCsr->aPage[0].iCell = 0; |
| 196402 | | - pCsr->aPage[0].zPath = z = sqlite3_mprintf("/"); |
| 197914 | + if( !pCsr->isAgg ){ |
| 197915 | + pCsr->aPage[0].zPath = z = sqlite3_mprintf("/"); |
| 197916 | + if( z==0 ) rc = SQLITE_NOMEM_BKPT; |
| 197917 | + } |
| 196403 | 197918 | pCsr->iPage = 0; |
| 196404 | | - if( z==0 ) rc = SQLITE_NOMEM_BKPT; |
| 197919 | + pCsr->nPage = 1; |
| 196405 | 197920 | }else{ |
| 196406 | 197921 | pCsr->isEof = 1; |
| 196407 | 197922 | return sqlite3_reset(pCsr->pStmt); |
| 196408 | 197923 | } |
| 196409 | 197924 | }else{ |
| 196410 | | - |
| 196411 | | - /* Page p itself has already been visited. */ |
| 197925 | + /* Continue analyzing the btree previously started */ |
| 196412 | 197926 | StatPage *p = &pCsr->aPage[pCsr->iPage]; |
| 196413 | | - |
| 197927 | + if( !pCsr->isAgg ) statResetCounts(pCsr); |
| 196414 | 197928 | while( p->iCell<p->nCell ){ |
| 196415 | 197929 | StatCell *pCell = &p->aCell[p->iCell]; |
| 196416 | | - if( pCell->iOvfl<pCell->nOvfl ){ |
| 196417 | | - int nUsable; |
| 197930 | + while( pCell->iOvfl<pCell->nOvfl ){ |
| 197931 | + int nUsable, iOvfl; |
| 196418 | 197932 | sqlite3BtreeEnter(pBt); |
| 196419 | 197933 | nUsable = sqlite3BtreeGetPageSize(pBt) - |
| 196420 | 197934 | sqlite3BtreeGetReserveNoMutex(pBt); |
| 196421 | 197935 | sqlite3BtreeLeave(pBt); |
| 196422 | | - pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0); |
| 196423 | | - pCsr->iPageno = pCell->aOvfl[pCell->iOvfl]; |
| 196424 | | - pCsr->zPagetype = "overflow"; |
| 196425 | | - pCsr->nCell = 0; |
| 196426 | | - pCsr->nMxPayload = 0; |
| 196427 | | - pCsr->zPath = z = sqlite3_mprintf( |
| 196428 | | - "%s%.3x+%.6x", p->zPath, p->iCell, pCell->iOvfl |
| 196429 | | - ); |
| 197936 | + pCsr->nPage++; |
| 197937 | + statSizeAndOffset(pCsr); |
| 196430 | 197938 | if( pCell->iOvfl<pCell->nOvfl-1 ){ |
| 196431 | | - pCsr->nUnused = 0; |
| 196432 | | - pCsr->nPayload = nUsable - 4; |
| 197939 | + pCsr->nPayload += nUsable - 4; |
| 196433 | 197940 | }else{ |
| 196434 | | - pCsr->nPayload = pCell->nLastOvfl; |
| 196435 | | - pCsr->nUnused = nUsable - 4 - pCsr->nPayload; |
| 197941 | + pCsr->nPayload += pCell->nLastOvfl; |
| 197942 | + pCsr->nUnused += nUsable - 4 - pCell->nLastOvfl; |
| 196436 | 197943 | } |
| 197944 | + iOvfl = pCell->iOvfl; |
| 196437 | 197945 | pCell->iOvfl++; |
| 196438 | | - statSizeAndOffset(pCsr); |
| 196439 | | - return z==0 ? SQLITE_NOMEM_BKPT : SQLITE_OK; |
| 197946 | + if( !pCsr->isAgg ){ |
| 197947 | + pCsr->zName = (char *)sqlite3_column_text(pCsr->pStmt, 0); |
| 197948 | + pCsr->iPageno = pCell->aOvfl[iOvfl]; |
| 197949 | + pCsr->zPagetype = "overflow"; |
| 197950 | + pCsr->zPath = z = sqlite3_mprintf( |
| 197951 | + "%s%.3x+%.6x", p->zPath, p->iCell, iOvfl |
| 197952 | + ); |
| 197953 | + return z==0 ? SQLITE_NOMEM_BKPT : SQLITE_OK; |
| 197954 | + } |
| 196440 | 197955 | } |
| 196441 | 197956 | if( p->iRightChildPg ) break; |
| 196442 | 197957 | p->iCell++; |
| 196443 | 197958 | } |
| 196444 | 197959 | |
| 196445 | 197960 | if( !p->iRightChildPg || p->iCell>p->nCell ){ |
| 196446 | 197961 | statClearPage(p); |
| 196447 | | - if( pCsr->iPage==0 ) return statNext(pCursor); |
| 196448 | | - pCsr->iPage--; |
| 197962 | + if( pCsr->iPage>0 ){ |
| 197963 | + pCsr->iPage--; |
| 197964 | + }else if( pCsr->isAgg ){ |
| 197965 | + /* label-statNext-done: When computing aggregate space usage over |
| 197966 | + ** an entire btree, this is the exit point from this function */ |
| 197967 | + return SQLITE_OK; |
| 197968 | + } |
| 196449 | 197969 | goto statNextRestart; /* Tail recursion */ |
| 196450 | 197970 | } |
| 196451 | 197971 | pCsr->iPage++; |
| 196452 | 197972 | if( pCsr->iPage>=ArraySize(pCsr->aPage) ){ |
| 196453 | 197973 | statResetCsr(pCsr); |
| | @@ -196459,14 +197979,17 @@ |
| 196459 | 197979 | p[1].iPgno = p->iRightChildPg; |
| 196460 | 197980 | }else{ |
| 196461 | 197981 | p[1].iPgno = p->aCell[p->iCell].iChildPg; |
| 196462 | 197982 | } |
| 196463 | 197983 | rc = sqlite3PagerGet(pPager, p[1].iPgno, &p[1].pPg, 0); |
| 197984 | + pCsr->nPage++; |
| 196464 | 197985 | p[1].iCell = 0; |
| 196465 | | - p[1].zPath = z = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell); |
| 197986 | + if( !pCsr->isAgg ){ |
| 197987 | + p[1].zPath = z = sqlite3_mprintf("%s%.3x/", p->zPath, p->iCell); |
| 197988 | + if( z==0 ) rc = SQLITE_NOMEM_BKPT; |
| 197989 | + } |
| 196466 | 197990 | p->iCell++; |
| 196467 | | - if( z==0 ) rc = SQLITE_NOMEM_BKPT; |
| 196468 | 197991 | } |
| 196469 | 197992 | |
| 196470 | 197993 | |
| 196471 | 197994 | /* Populate the StatCursor fields with the values to be returned |
| 196472 | 197995 | ** by the xColumn() and xRowid() methods. |
| | @@ -196492,20 +198015,27 @@ |
| 196492 | 198015 | break; |
| 196493 | 198016 | default: |
| 196494 | 198017 | pCsr->zPagetype = "corrupted"; |
| 196495 | 198018 | break; |
| 196496 | 198019 | } |
| 196497 | | - pCsr->nCell = p->nCell; |
| 196498 | | - pCsr->nUnused = p->nUnused; |
| 196499 | | - pCsr->nMxPayload = p->nMxPayload; |
| 196500 | | - pCsr->zPath = z = sqlite3_mprintf("%s", p->zPath); |
| 196501 | | - if( z==0 ) rc = SQLITE_NOMEM_BKPT; |
| 198020 | + pCsr->nCell += p->nCell; |
| 198021 | + pCsr->nUnused += p->nUnused; |
| 198022 | + if( p->nMxPayload>pCsr->nMxPayload ) pCsr->nMxPayload = p->nMxPayload; |
| 198023 | + if( !pCsr->isAgg ){ |
| 198024 | + pCsr->zPath = z = sqlite3_mprintf("%s", p->zPath); |
| 198025 | + if( z==0 ) rc = SQLITE_NOMEM_BKPT; |
| 198026 | + } |
| 196502 | 198027 | nPayload = 0; |
| 196503 | 198028 | for(i=0; i<p->nCell; i++){ |
| 196504 | 198029 | nPayload += p->aCell[i].nLocal; |
| 196505 | 198030 | } |
| 196506 | | - pCsr->nPayload = nPayload; |
| 198031 | + pCsr->nPayload += nPayload; |
| 198032 | + |
| 198033 | + /* If computing aggregate space usage by btree, continue with the |
| 198034 | + ** next page. The loop will exit via the return at label-statNext-done |
| 198035 | + */ |
| 198036 | + if( pCsr->isAgg ) goto statNextRestart; |
| 196507 | 198037 | } |
| 196508 | 198038 | } |
| 196509 | 198039 | |
| 196510 | 198040 | return rc; |
| 196511 | 198041 | } |
| | @@ -196513,40 +198043,67 @@ |
| 196513 | 198043 | static int statEof(sqlite3_vtab_cursor *pCursor){ |
| 196514 | 198044 | StatCursor *pCsr = (StatCursor *)pCursor; |
| 196515 | 198045 | return pCsr->isEof; |
| 196516 | 198046 | } |
| 196517 | 198047 | |
| 198048 | +/* Initialize a cursor according to the query plan idxNum using the |
| 198049 | +** arguments in argv[0]. See statBestIndex() for a description of the |
| 198050 | +** meaning of the bits in idxNum. |
| 198051 | +*/ |
| 196518 | 198052 | static int statFilter( |
| 196519 | 198053 | sqlite3_vtab_cursor *pCursor, |
| 196520 | 198054 | int idxNum, const char *idxStr, |
| 196521 | 198055 | int argc, sqlite3_value **argv |
| 196522 | 198056 | ){ |
| 196523 | 198057 | StatCursor *pCsr = (StatCursor *)pCursor; |
| 196524 | 198058 | StatTable *pTab = (StatTable*)(pCursor->pVtab); |
| 196525 | | - char *zSql; |
| 196526 | | - int rc = SQLITE_OK; |
| 198059 | + sqlite3_str *pSql; /* Query of btrees to analyze */ |
| 198060 | + char *zSql; /* String value of pSql */ |
| 198061 | + int iArg = 0; /* Count of argv[] parameters used so far */ |
| 198062 | + int rc = SQLITE_OK; /* Result of this operation */ |
| 198063 | + const char *zName = 0; /* Only provide analysis of this table */ |
| 196527 | 198064 | |
| 196528 | | - if( idxNum==1 ){ |
| 196529 | | - const char *zDbase = (const char*)sqlite3_value_text(argv[0]); |
| 198065 | + statResetCsr(pCsr); |
| 198066 | + sqlite3_finalize(pCsr->pStmt); |
| 198067 | + pCsr->pStmt = 0; |
| 198068 | + if( idxNum & 0x01 ){ |
| 198069 | + /* schema=? constraint is present. Get its value */ |
| 198070 | + const char *zDbase = (const char*)sqlite3_value_text(argv[iArg++]); |
| 196530 | 198071 | pCsr->iDb = sqlite3FindDbName(pTab->db, zDbase); |
| 196531 | 198072 | if( pCsr->iDb<0 ){ |
| 196532 | 198073 | sqlite3_free(pCursor->pVtab->zErrMsg); |
| 196533 | 198074 | pCursor->pVtab->zErrMsg = sqlite3_mprintf("no such schema: %s", zDbase); |
| 196534 | 198075 | return pCursor->pVtab->zErrMsg ? SQLITE_ERROR : SQLITE_NOMEM_BKPT; |
| 196535 | 198076 | } |
| 196536 | 198077 | }else{ |
| 196537 | 198078 | pCsr->iDb = pTab->iDb; |
| 196538 | 198079 | } |
| 196539 | | - statResetCsr(pCsr); |
| 196540 | | - sqlite3_finalize(pCsr->pStmt); |
| 196541 | | - pCsr->pStmt = 0; |
| 196542 | | - zSql = sqlite3_mprintf( |
| 196543 | | - "SELECT 'sqlite_master' AS name, 1 AS rootpage, 'table' AS type" |
| 196544 | | - " UNION ALL " |
| 196545 | | - "SELECT name, rootpage, type" |
| 196546 | | - " FROM \"%w\".sqlite_master WHERE rootpage!=0" |
| 196547 | | - " ORDER BY name", pTab->db->aDb[pCsr->iDb].zDbSName); |
| 198080 | + if( idxNum & 0x02 ){ |
| 198081 | + /* name=? constraint is present */ |
| 198082 | + zName = (const char*)sqlite3_value_text(argv[iArg++]); |
| 198083 | + } |
| 198084 | + if( idxNum & 0x04 ){ |
| 198085 | + /* aggregate=? constraint is present */ |
| 198086 | + pCsr->isAgg = sqlite3_value_double(argv[iArg++])!=0.0; |
| 198087 | + }else{ |
| 198088 | + pCsr->isAgg = 0; |
| 198089 | + } |
| 198090 | + pSql = sqlite3_str_new(pTab->db); |
| 198091 | + sqlite3_str_appendf(pSql, |
| 198092 | + "SELECT * FROM (" |
| 198093 | + "SELECT 'sqlite_master' AS name,1 AS rootpage,'table' AS type" |
| 198094 | + " UNION ALL " |
| 198095 | + "SELECT name,rootpage,type" |
| 198096 | + " FROM \"%w\".sqlite_master WHERE rootpage!=0)", |
| 198097 | + pTab->db->aDb[pCsr->iDb].zDbSName); |
| 198098 | + if( zName ){ |
| 198099 | + sqlite3_str_appendf(pSql, "WHERE name=%Q", zName); |
| 198100 | + } |
| 198101 | + if( idxNum & 0x08 ){ |
| 198102 | + sqlite3_str_appendf(pSql, " ORDER BY name"); |
| 198103 | + } |
| 198104 | + zSql = sqlite3_str_finish(pSql); |
| 196548 | 198105 | if( zSql==0 ){ |
| 196549 | 198106 | return SQLITE_NOMEM_BKPT; |
| 196550 | 198107 | }else{ |
| 196551 | 198108 | rc = sqlite3_prepare_v2(pTab->db, zSql, -1, &pCsr->pStmt, 0); |
| 196552 | 198109 | sqlite3_free(zSql); |
| | @@ -196567,17 +198124,25 @@ |
| 196567 | 198124 | switch( i ){ |
| 196568 | 198125 | case 0: /* name */ |
| 196569 | 198126 | sqlite3_result_text(ctx, pCsr->zName, -1, SQLITE_TRANSIENT); |
| 196570 | 198127 | break; |
| 196571 | 198128 | case 1: /* path */ |
| 196572 | | - sqlite3_result_text(ctx, pCsr->zPath, -1, SQLITE_TRANSIENT); |
| 198129 | + if( !pCsr->isAgg ){ |
| 198130 | + sqlite3_result_text(ctx, pCsr->zPath, -1, SQLITE_TRANSIENT); |
| 198131 | + } |
| 196573 | 198132 | break; |
| 196574 | 198133 | case 2: /* pageno */ |
| 196575 | | - sqlite3_result_int64(ctx, pCsr->iPageno); |
| 198134 | + if( pCsr->isAgg ){ |
| 198135 | + sqlite3_result_int64(ctx, pCsr->nPage); |
| 198136 | + }else{ |
| 198137 | + sqlite3_result_int64(ctx, pCsr->iPageno); |
| 198138 | + } |
| 196576 | 198139 | break; |
| 196577 | 198140 | case 3: /* pagetype */ |
| 196578 | | - sqlite3_result_text(ctx, pCsr->zPagetype, -1, SQLITE_STATIC); |
| 198141 | + if( !pCsr->isAgg ){ |
| 198142 | + sqlite3_result_text(ctx, pCsr->zPagetype, -1, SQLITE_STATIC); |
| 198143 | + } |
| 196579 | 198144 | break; |
| 196580 | 198145 | case 4: /* ncell */ |
| 196581 | 198146 | sqlite3_result_int(ctx, pCsr->nCell); |
| 196582 | 198147 | break; |
| 196583 | 198148 | case 5: /* payload */ |
| | @@ -196588,20 +198153,26 @@ |
| 196588 | 198153 | break; |
| 196589 | 198154 | case 7: /* mx_payload */ |
| 196590 | 198155 | sqlite3_result_int(ctx, pCsr->nMxPayload); |
| 196591 | 198156 | break; |
| 196592 | 198157 | case 8: /* pgoffset */ |
| 196593 | | - sqlite3_result_int64(ctx, pCsr->iOffset); |
| 198158 | + if( !pCsr->isAgg ){ |
| 198159 | + sqlite3_result_int64(ctx, pCsr->iOffset); |
| 198160 | + } |
| 196594 | 198161 | break; |
| 196595 | 198162 | case 9: /* pgsize */ |
| 196596 | 198163 | sqlite3_result_int(ctx, pCsr->szPage); |
| 196597 | 198164 | break; |
| 196598 | | - default: { /* schema */ |
| 198165 | + case 10: { /* schema */ |
| 196599 | 198166 | sqlite3 *db = sqlite3_context_db_handle(ctx); |
| 196600 | 198167 | int iDb = pCsr->iDb; |
| 196601 | 198168 | sqlite3_result_text(ctx, db->aDb[iDb].zDbSName, -1, SQLITE_STATIC); |
| 196602 | 198169 | break; |
| 198170 | + } |
| 198171 | + default: { /* aggregate */ |
| 198172 | + sqlite3_result_int(ctx, pCsr->isAgg); |
| 198173 | + break; |
| 196603 | 198174 | } |
| 196604 | 198175 | } |
| 196605 | 198176 | return SQLITE_OK; |
| 196606 | 198177 | } |
| 196607 | 198178 | |
| | @@ -203188,10 +204759,15 @@ |
| 203188 | 204759 | ** less than 32. If it is set to anything large than that, an #error |
| 203189 | 204760 | ** directive in fts5_index.c will cause the build to fail. |
| 203190 | 204761 | */ |
| 203191 | 204762 | #define FTS5_MAX_PREFIX_INDEXES 31 |
| 203192 | 204763 | |
| 204764 | +/* |
| 204765 | +** Maximum segments permitted in a single index |
| 204766 | +*/ |
| 204767 | +#define FTS5_MAX_SEGMENT 2000 |
| 204768 | + |
| 203193 | 204769 | #define FTS5_DEFAULT_NEARDIST 10 |
| 203194 | 204770 | #define FTS5_DEFAULT_RANK "bm25" |
| 203195 | 204771 | |
| 203196 | 204772 | /* Name of rank and rowid columns */ |
| 203197 | 204773 | #define FTS5_RANK_NAME "rank" |
| | @@ -203544,10 +205120,15 @@ |
| 203544 | 205120 | /* |
| 203545 | 205121 | ** Close an iterator opened by sqlite3Fts5IndexQuery(). |
| 203546 | 205122 | */ |
| 203547 | 205123 | static void sqlite3Fts5IterClose(Fts5IndexIter*); |
| 203548 | 205124 | |
| 205125 | +/* |
| 205126 | +** Close the reader blob handle, if it is open. |
| 205127 | +*/ |
| 205128 | +static void sqlite3Fts5IndexCloseReader(Fts5Index*); |
| 205129 | + |
| 203549 | 205130 | /* |
| 203550 | 205131 | ** This interface is used by the fts5vocab module. |
| 203551 | 205132 | */ |
| 203552 | 205133 | static const char *sqlite3Fts5IterTerm(Fts5IndexIter*, int*); |
| 203553 | 205134 | static int sqlite3Fts5IterNextScan(Fts5IndexIter*); |
| | @@ -205420,12 +207001,12 @@ |
| 205420 | 207001 | #ifdef fts5YYFALLBACK |
| 205421 | 207002 | assert( iToken<(int)(sizeof(fts5yyFallback)/sizeof(fts5yyFallback[0])) ); |
| 205422 | 207003 | return fts5yyFallback[iToken]; |
| 205423 | 207004 | #else |
| 205424 | 207005 | (void)iToken; |
| 205425 | | -#endif |
| 205426 | 207006 | return 0; |
| 207007 | +#endif |
| 205427 | 207008 | } |
| 205428 | 207009 | |
| 205429 | 207010 | /* |
| 205430 | 207011 | ** 2014 May 31 |
| 205431 | 207012 | ** |
| | @@ -206570,11 +208151,11 @@ |
| 206570 | 208151 | #define FTS5_DEFAULT_USERMERGE 4 |
| 206571 | 208152 | #define FTS5_DEFAULT_CRISISMERGE 16 |
| 206572 | 208153 | #define FTS5_DEFAULT_HASHSIZE (1024*1024) |
| 206573 | 208154 | |
| 206574 | 208155 | /* Maximum allowed page size */ |
| 206575 | | -#define FTS5_MAX_PAGE_SIZE (128*1024) |
| 208156 | +#define FTS5_MAX_PAGE_SIZE (64*1024) |
| 206576 | 208157 | |
| 206577 | 208158 | static int fts5_iswhitespace(char x){ |
| 206578 | 208159 | return (x==' '); |
| 206579 | 208160 | } |
| 206580 | 208161 | |
| | @@ -207375,11 +208956,11 @@ |
| 207375 | 208956 | if( 0==sqlite3_stricmp(zKey, "pgsz") ){ |
| 207376 | 208957 | int pgsz = 0; |
| 207377 | 208958 | if( SQLITE_INTEGER==sqlite3_value_numeric_type(pVal) ){ |
| 207378 | 208959 | pgsz = sqlite3_value_int(pVal); |
| 207379 | 208960 | } |
| 207380 | | - if( pgsz<=0 || pgsz>FTS5_MAX_PAGE_SIZE ){ |
| 208961 | + if( pgsz<32 || pgsz>FTS5_MAX_PAGE_SIZE ){ |
| 207381 | 208962 | *pbBadkey = 1; |
| 207382 | 208963 | }else{ |
| 207383 | 208964 | pConfig->pgsz = pgsz; |
| 207384 | 208965 | } |
| 207385 | 208966 | } |
| | @@ -207428,10 +209009,11 @@ |
| 207428 | 209009 | } |
| 207429 | 209010 | if( nCrisisMerge<0 ){ |
| 207430 | 209011 | *pbBadkey = 1; |
| 207431 | 209012 | }else{ |
| 207432 | 209013 | if( nCrisisMerge<=1 ) nCrisisMerge = FTS5_DEFAULT_CRISISMERGE; |
| 209014 | + if( nCrisisMerge>=FTS5_MAX_SEGMENT ) nCrisisMerge = FTS5_MAX_SEGMENT-1; |
| 207433 | 209015 | pConfig->nCrisisMerge = nCrisisMerge; |
| 207434 | 209016 | } |
| 207435 | 209017 | } |
| 207436 | 209018 | |
| 207437 | 209019 | else if( 0==sqlite3_stricmp(zKey, "rank") ){ |
| | @@ -211199,15 +212781,10 @@ |
| 211199 | 212781 | ) |
| 211200 | 212782 | |
| 211201 | 212783 | #define FTS5_SEGMENT_ROWID(segid, pgno) fts5_dri(segid, 0, 0, pgno) |
| 211202 | 212784 | #define FTS5_DLIDX_ROWID(segid, height, pgno) fts5_dri(segid, 1, height, pgno) |
| 211203 | 212785 | |
| 211204 | | -/* |
| 211205 | | -** Maximum segments permitted in a single index |
| 211206 | | -*/ |
| 211207 | | -#define FTS5_MAX_SEGMENT 2000 |
| 211208 | | - |
| 211209 | 212786 | #ifdef SQLITE_DEBUG |
| 211210 | 212787 | static int sqlite3Fts5Corrupt() { return SQLITE_CORRUPT_VTAB; } |
| 211211 | 212788 | #endif |
| 211212 | 212789 | |
| 211213 | 212790 | |
| | @@ -211579,11 +213156,11 @@ |
| 211579 | 213156 | } |
| 211580 | 213157 | |
| 211581 | 213158 | /* |
| 211582 | 213159 | ** Close the read-only blob handle, if it is open. |
| 211583 | 213160 | */ |
| 211584 | | -static void fts5CloseReader(Fts5Index *p){ |
| 213161 | +static void sqlite3Fts5IndexCloseReader(Fts5Index *p){ |
| 211585 | 213162 | if( p->pReader ){ |
| 211586 | 213163 | sqlite3_blob *pReader = p->pReader; |
| 211587 | 213164 | p->pReader = 0; |
| 211588 | 213165 | sqlite3_blob_close(pReader); |
| 211589 | 213166 | } |
| | @@ -211608,11 +213185,11 @@ |
| 211608 | 213185 | p->pReader = 0; |
| 211609 | 213186 | rc = sqlite3_blob_reopen(pBlob, iRowid); |
| 211610 | 213187 | assert( p->pReader==0 ); |
| 211611 | 213188 | p->pReader = pBlob; |
| 211612 | 213189 | if( rc!=SQLITE_OK ){ |
| 211613 | | - fts5CloseReader(p); |
| 213190 | + sqlite3Fts5IndexCloseReader(p); |
| 211614 | 213191 | } |
| 211615 | 213192 | if( rc==SQLITE_ABORT ) rc = SQLITE_OK; |
| 211616 | 213193 | } |
| 211617 | 213194 | |
| 211618 | 213195 | /* If the blob handle is not open at this point, open it and seek |
| | @@ -216169,11 +217746,11 @@ |
| 216169 | 217746 | ** Commit data to disk. |
| 216170 | 217747 | */ |
| 216171 | 217748 | static int sqlite3Fts5IndexSync(Fts5Index *p){ |
| 216172 | 217749 | assert( p->rc==SQLITE_OK ); |
| 216173 | 217750 | fts5IndexFlush(p); |
| 216174 | | - fts5CloseReader(p); |
| 217751 | + sqlite3Fts5IndexCloseReader(p); |
| 216175 | 217752 | return fts5IndexReturn(p); |
| 216176 | 217753 | } |
| 216177 | 217754 | |
| 216178 | 217755 | /* |
| 216179 | 217756 | ** Discard any data stored in the in-memory hash tables. Do not write it |
| | @@ -216180,11 +217757,11 @@ |
| 216180 | 217757 | ** to the database. Additionally, assume that the contents of the %_data |
| 216181 | 217758 | ** table may have changed on disk. So any in-memory caches of %_data |
| 216182 | 217759 | ** records must be invalidated. |
| 216183 | 217760 | */ |
| 216184 | 217761 | static int sqlite3Fts5IndexRollback(Fts5Index *p){ |
| 216185 | | - fts5CloseReader(p); |
| 217762 | + sqlite3Fts5IndexCloseReader(p); |
| 216186 | 217763 | fts5IndexDiscardData(p); |
| 216187 | 217764 | fts5StructureInvalidate(p); |
| 216188 | 217765 | /* assert( p->rc==SQLITE_OK ); */ |
| 216189 | 217766 | return SQLITE_OK; |
| 216190 | 217767 | } |
| | @@ -216195,10 +217772,11 @@ |
| 216195 | 217772 | ** and the initial version of the "averages" record (a zero-byte blob). |
| 216196 | 217773 | */ |
| 216197 | 217774 | static int sqlite3Fts5IndexReinit(Fts5Index *p){ |
| 216198 | 217775 | Fts5Structure s; |
| 216199 | 217776 | fts5StructureInvalidate(p); |
| 217777 | + fts5IndexDiscardData(p); |
| 216200 | 217778 | memset(&s, 0, sizeof(Fts5Structure)); |
| 216201 | 217779 | fts5DataWrite(p, FTS5_AVERAGES_ROWID, (const u8*)"", 0); |
| 216202 | 217780 | fts5StructureWrite(p, &s); |
| 216203 | 217781 | return fts5IndexReturn(p); |
| 216204 | 217782 | } |
| | @@ -216282,10 +217860,11 @@ |
| 216282 | 217860 | int n = 0; |
| 216283 | 217861 | int i; |
| 216284 | 217862 | for(i=0; i<nChar; i++){ |
| 216285 | 217863 | if( n>=nByte ) return 0; /* Input contains fewer than nChar chars */ |
| 216286 | 217864 | if( (unsigned char)p[n++]>=0xc0 ){ |
| 217865 | + if( n>=nByte ) break; |
| 216287 | 217866 | while( (p[n] & 0xc0)==0x80 ){ |
| 216288 | 217867 | n++; |
| 216289 | 217868 | if( n>=nByte ) break; |
| 216290 | 217869 | } |
| 216291 | 217870 | } |
| | @@ -216420,11 +217999,11 @@ |
| 216420 | 217999 | } |
| 216421 | 218000 | |
| 216422 | 218001 | if( p->rc ){ |
| 216423 | 218002 | sqlite3Fts5IterClose((Fts5IndexIter*)pRet); |
| 216424 | 218003 | pRet = 0; |
| 216425 | | - fts5CloseReader(p); |
| 218004 | + sqlite3Fts5IndexCloseReader(p); |
| 216426 | 218005 | } |
| 216427 | 218006 | |
| 216428 | 218007 | *ppIter = (Fts5IndexIter*)pRet; |
| 216429 | 218008 | sqlite3Fts5BufferFree(&buf); |
| 216430 | 218009 | } |
| | @@ -216493,11 +218072,11 @@ |
| 216493 | 218072 | static void sqlite3Fts5IterClose(Fts5IndexIter *pIndexIter){ |
| 216494 | 218073 | if( pIndexIter ){ |
| 216495 | 218074 | Fts5Iter *pIter = (Fts5Iter*)pIndexIter; |
| 216496 | 218075 | Fts5Index *pIndex = pIter->pIndex; |
| 216497 | 218076 | fts5MultiIterFree(pIter); |
| 216498 | | - fts5CloseReader(pIndex); |
| 218077 | + sqlite3Fts5IndexCloseReader(pIndex); |
| 216499 | 218078 | } |
| 216500 | 218079 | } |
| 216501 | 218080 | |
| 216502 | 218081 | /* |
| 216503 | 218082 | ** Read and decode the "averages" record from the database. |
| | @@ -216850,11 +218429,12 @@ |
| 216850 | 218429 | int iDlidxPrevLeaf = pSeg->pgnoLast; |
| 216851 | 218430 | |
| 216852 | 218431 | if( pSeg->pgnoFirst==0 ) return; |
| 216853 | 218432 | |
| 216854 | 218433 | fts5IndexPrepareStmt(p, &pStmt, sqlite3_mprintf( |
| 216855 | | - "SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d", |
| 218434 | + "SELECT segid, term, (pgno>>1), (pgno&1) FROM %Q.'%q_idx' WHERE segid=%d " |
| 218435 | + "ORDER BY 1, 2", |
| 216856 | 218436 | pConfig->zDb, pConfig->zName, pSeg->iSegid |
| 216857 | 218437 | )); |
| 216858 | 218438 | |
| 216859 | 218439 | /* Iterate through the b-tree hierarchy. */ |
| 216860 | 218440 | while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ |
| | @@ -218296,10 +219876,11 @@ |
| 218296 | 219876 | if( CsrFlagTest(pCsr, FTS5CSR_FREE_ZRANK) ){ |
| 218297 | 219877 | sqlite3_free(pCsr->zRank); |
| 218298 | 219878 | sqlite3_free(pCsr->zRankArgs); |
| 218299 | 219879 | } |
| 218300 | 219880 | |
| 219881 | + sqlite3Fts5IndexCloseReader(pTab->p.pIndex); |
| 218301 | 219882 | memset(&pCsr->ePlan, 0, sizeof(Fts5Cursor) - ((u8*)&pCsr->ePlan - (u8*)pCsr)); |
| 218302 | 219883 | } |
| 218303 | 219884 | |
| 218304 | 219885 | |
| 218305 | 219886 | /* |
| | @@ -220265,11 +221846,11 @@ |
| 220265 | 221846 | int nArg, /* Number of args */ |
| 220266 | 221847 | sqlite3_value **apUnused /* Function arguments */ |
| 220267 | 221848 | ){ |
| 220268 | 221849 | assert( nArg==0 ); |
| 220269 | 221850 | UNUSED_PARAM2(nArg, apUnused); |
| 220270 | | - sqlite3_result_text(pCtx, "fts5: 2019-10-04 15:03:17 c20a35336432025445f9f7e289d0cc3e4003fb17f45a4ce74c6269c407c6e09f", -1, SQLITE_TRANSIENT); |
| 221851 | + sqlite3_result_text(pCtx, "fts5: 2019-11-20 12:07:40 2575a68c3965e72f2ab211d933012442755afe6a9b7de9e9e50cdd2155fd1ec8", -1, SQLITE_TRANSIENT); |
| 220271 | 221852 | } |
| 220272 | 221853 | |
| 220273 | 221854 | /* |
| 220274 | 221855 | ** Return true if zName is the extension on one of the shadow tables used |
| 220275 | 221856 | ** by this module. |
| | @@ -220958,10 +222539,12 @@ |
| 220958 | 222539 | ** Delete all entries in the FTS5 index. |
| 220959 | 222540 | */ |
| 220960 | 222541 | static int sqlite3Fts5StorageDeleteAll(Fts5Storage *p){ |
| 220961 | 222542 | Fts5Config *pConfig = p->pConfig; |
| 220962 | 222543 | int rc; |
| 222544 | + |
| 222545 | + p->bTotalsValid = 0; |
| 220963 | 222546 | |
| 220964 | 222547 | /* Delete the contents of the %_data and %_docsize tables. */ |
| 220965 | 222548 | rc = fts5ExecPrintf(pConfig->db, 0, |
| 220966 | 222549 | "DELETE FROM %Q.'%q_data';" |
| 220967 | 222550 | "DELETE FROM %Q.'%q_idx';", |
| | @@ -225033,12 +226616,12 @@ |
| 225033 | 226616 | } |
| 225034 | 226617 | #endif /* SQLITE_CORE */ |
| 225035 | 226618 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ |
| 225036 | 226619 | |
| 225037 | 226620 | /************** End of stmt.c ************************************************/ |
| 225038 | | -#if __LINE__!=225038 |
| 226621 | +#if __LINE__!=226621 |
| 225039 | 226622 | #undef SQLITE_SOURCE_ID |
| 225040 | | -#define SQLITE_SOURCE_ID "2019-10-04 15:03:17 c20a35336432025445f9f7e289d0cc3e4003fb17f45a4ce74c6269c407c6alt2" |
| 226623 | +#define SQLITE_SOURCE_ID "2019-11-20 13:31:52 a0f6d526baecd061a5e2bec5eb698fb5dfb10122ac79c853d7b3f4a48bc9alt2" |
| 225041 | 226624 | #endif |
| 225042 | 226625 | /* Return the source-id for this library */ |
| 225043 | 226626 | SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } |
| 225044 | 226627 | /************************** End of sqlite3.c ******************************/ |
| 225045 | 226628 | |