| | @@ -1162,11 +1162,11 @@ |
| 1162 | 1162 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 1163 | 1163 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 1164 | 1164 | */ |
| 1165 | 1165 | #define SQLITE_VERSION "3.28.0" |
| 1166 | 1166 | #define SQLITE_VERSION_NUMBER 3028000 |
| 1167 | | -#define SQLITE_SOURCE_ID "2019-03-17 23:59:02 cc5ab96715ebb1089b4e9aa647badd2510aaa056f26004718f921f4ac07e2f93" |
| 1167 | +#define SQLITE_SOURCE_ID "2019-04-03 17:48:10 8d3af2010f4f652865f5c0d18e3bc793de05f8e75e75cc77786f61004b2ad28f" |
| 1168 | 1168 | |
| 1169 | 1169 | /* |
| 1170 | 1170 | ** CAPI3REF: Run-Time Library Version Numbers |
| 1171 | 1171 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 1172 | 1172 | ** |
| | @@ -1226,10 +1226,13 @@ |
| 1226 | 1226 | ** [sqlite_compileoption_get()] and the [compile_options pragma]. |
| 1227 | 1227 | */ |
| 1228 | 1228 | #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS |
| 1229 | 1229 | SQLITE_API int sqlite3_compileoption_used(const char *zOptName); |
| 1230 | 1230 | SQLITE_API const char *sqlite3_compileoption_get(int N); |
| 1231 | +#else |
| 1232 | +# define sqlite3_compileoption_used(X) 0 |
| 1233 | +# define sqlite3_compileoption_get(X) ((void*)0) |
| 1231 | 1234 | #endif |
| 1232 | 1235 | |
| 1233 | 1236 | /* |
| 1234 | 1237 | ** CAPI3REF: Test To See If The Library Is Threadsafe |
| 1235 | 1238 | ** |
| | @@ -3236,10 +3239,21 @@ |
| 3236 | 3239 | ** <li> The [PRAGMA writable_schema=ON] statement. |
| 3237 | 3240 | ** <li> Writes to the [sqlite_dbpage] virtual table. |
| 3238 | 3241 | ** <li> Direct writes to [shadow tables]. |
| 3239 | 3242 | ** </ul> |
| 3240 | 3243 | ** </dd> |
| 3244 | +** |
| 3245 | +** [[SQLITE_DBCONFIG_WRITABLE_SCHEMA]] <dt>SQLITE_DBCONFIG_WRITABLE_SCHEMA</dt> |
| 3246 | +** <dd>The SQLITE_DBCONFIG_WRITABLE_SCHEMA option activates or deactivates the |
| 3247 | +** "writable_schema" flag. This has the same effect and is logically equivalent |
| 3248 | +** to setting [PRAGMA writable_schema=ON] or [PRAGMA writable_schema=OFF]. |
| 3249 | +** The first argument to this setting is an integer which is 0 to disable |
| 3250 | +** the writable_schema, positive to enable writable_schema, or negative to |
| 3251 | +** leave the setting unchanged. The second parameter is a pointer to an |
| 3252 | +** integer into which is written 0 or 1 to indicate whether the writable_schema |
| 3253 | +** is enabled or disabled following this call. |
| 3254 | +** </dd> |
| 3241 | 3255 | ** </dl> |
| 3242 | 3256 | */ |
| 3243 | 3257 | #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ |
| 3244 | 3258 | #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ |
| 3245 | 3259 | #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ |
| | @@ -3249,11 +3263,12 @@ |
| 3249 | 3263 | #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */ |
| 3250 | 3264 | #define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */ |
| 3251 | 3265 | #define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */ |
| 3252 | 3266 | #define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */ |
| 3253 | 3267 | #define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */ |
| 3254 | | -#define SQLITE_DBCONFIG_MAX 1010 /* Largest DBCONFIG */ |
| 3268 | +#define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 /* int int* */ |
| 3269 | +#define SQLITE_DBCONFIG_MAX 1011 /* Largest DBCONFIG */ |
| 3255 | 3270 | |
| 3256 | 3271 | /* |
| 3257 | 3272 | ** CAPI3REF: Enable Or Disable Extended Result Codes |
| 3258 | 3273 | ** METHOD: sqlite3 |
| 3259 | 3274 | ** |
| | @@ -6001,10 +6016,12 @@ |
| 6001 | 6016 | ** <tr><td><b>sqlite3_value_numeric_type </b> |
| 6002 | 6017 | ** <td>→ <td>Best numeric datatype of the value |
| 6003 | 6018 | ** <tr><td><b>sqlite3_value_nochange </b> |
| 6004 | 6019 | ** <td>→ <td>True if the column is unchanged in an UPDATE |
| 6005 | 6020 | ** against a virtual table. |
| 6021 | +** <tr><td><b>sqlite3_value_frombind </b> |
| 6022 | +** <td>→ <td>True if value originated a bound parameter |
| 6006 | 6023 | ** </table></blockquote> |
| 6007 | 6024 | ** |
| 6008 | 6025 | ** <b>Details:</b> |
| 6009 | 6026 | ** |
| 6010 | 6027 | ** These routines extract type, size, and content information from |
| | @@ -6061,10 +6078,15 @@ |
| 6061 | 6078 | ** was unchanging). ^Within an [xUpdate] method, any value for which |
| 6062 | 6079 | ** sqlite3_value_nochange(X) is true will in all other respects appear |
| 6063 | 6080 | ** to be a NULL value. If sqlite3_value_nochange(X) is invoked anywhere other |
| 6064 | 6081 | ** than within an [xUpdate] method call for an UPDATE statement, then |
| 6065 | 6082 | ** the return value is arbitrary and meaningless. |
| 6083 | +** |
| 6084 | +** ^The sqlite3_value_frombind(X) interface returns non-zero if the |
| 6085 | +** value X originated from one of the [sqlite3_bind_int|sqlite3_bind()] |
| 6086 | +** interfaces. ^If X comes from an SQL literal value, or a table column, |
| 6087 | +** and expression, then sqlite3_value_frombind(X) returns zero. |
| 6066 | 6088 | ** |
| 6067 | 6089 | ** Please pay particular attention to the fact that the pointer returned |
| 6068 | 6090 | ** from [sqlite3_value_blob()], [sqlite3_value_text()], or |
| 6069 | 6091 | ** [sqlite3_value_text16()] can be invalidated by a subsequent call to |
| 6070 | 6092 | ** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()], |
| | @@ -6107,10 +6129,11 @@ |
| 6107 | 6129 | SQLITE_API int sqlite3_value_bytes(sqlite3_value*); |
| 6108 | 6130 | SQLITE_API int sqlite3_value_bytes16(sqlite3_value*); |
| 6109 | 6131 | SQLITE_API int sqlite3_value_type(sqlite3_value*); |
| 6110 | 6132 | SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); |
| 6111 | 6133 | SQLITE_API int sqlite3_value_nochange(sqlite3_value*); |
| 6134 | +SQLITE_API int sqlite3_value_frombind(sqlite3_value*); |
| 6112 | 6135 | |
| 6113 | 6136 | /* |
| 6114 | 6137 | ** CAPI3REF: Finding The Subtype Of SQL Values |
| 6115 | 6138 | ** METHOD: sqlite3_value |
| 6116 | 6139 | ** |
| | @@ -11943,11 +11966,11 @@ |
| 11943 | 11966 | ** |
| 11944 | 11967 | ** Argument pIn must point to a buffer containing a changeset nIn bytes |
| 11945 | 11968 | ** in size. This function allocates and populates a buffer with a copy |
| 11946 | 11969 | ** of the changeset rebased rebased according to the configuration of the |
| 11947 | 11970 | ** rebaser object passed as the first argument. If successful, (*ppOut) |
| 11948 | | -** is set to point to the new buffer containing the rebased changset and |
| 11971 | +** is set to point to the new buffer containing the rebased changeset and |
| 11949 | 11972 | ** (*pnOut) to its size in bytes and SQLITE_OK returned. It is the |
| 11950 | 11973 | ** responsibility of the caller to eventually free the new buffer using |
| 11951 | 11974 | ** sqlite3_free(). Otherwise, if an error occurs, (*ppOut) and (*pnOut) |
| 11952 | 11975 | ** are set to zero and an SQLite error code returned. |
| 11953 | 11976 | */ |
| | @@ -13534,96 +13557,100 @@ |
| 13534 | 13557 | #define TK_FOLLOWING 83 |
| 13535 | 13558 | #define TK_PARTITION 84 |
| 13536 | 13559 | #define TK_PRECEDING 85 |
| 13537 | 13560 | #define TK_RANGE 86 |
| 13538 | 13561 | #define TK_UNBOUNDED 87 |
| 13539 | | -#define TK_REINDEX 88 |
| 13540 | | -#define TK_RENAME 89 |
| 13541 | | -#define TK_CTIME_KW 90 |
| 13542 | | -#define TK_ANY 91 |
| 13543 | | -#define TK_BITAND 92 |
| 13544 | | -#define TK_BITOR 93 |
| 13545 | | -#define TK_LSHIFT 94 |
| 13546 | | -#define TK_RSHIFT 95 |
| 13547 | | -#define TK_PLUS 96 |
| 13548 | | -#define TK_MINUS 97 |
| 13549 | | -#define TK_STAR 98 |
| 13550 | | -#define TK_SLASH 99 |
| 13551 | | -#define TK_REM 100 |
| 13552 | | -#define TK_CONCAT 101 |
| 13553 | | -#define TK_COLLATE 102 |
| 13554 | | -#define TK_BITNOT 103 |
| 13555 | | -#define TK_ON 104 |
| 13556 | | -#define TK_INDEXED 105 |
| 13557 | | -#define TK_STRING 106 |
| 13558 | | -#define TK_JOIN_KW 107 |
| 13559 | | -#define TK_CONSTRAINT 108 |
| 13560 | | -#define TK_DEFAULT 109 |
| 13561 | | -#define TK_NULL 110 |
| 13562 | | -#define TK_PRIMARY 111 |
| 13563 | | -#define TK_UNIQUE 112 |
| 13564 | | -#define TK_CHECK 113 |
| 13565 | | -#define TK_REFERENCES 114 |
| 13566 | | -#define TK_AUTOINCR 115 |
| 13567 | | -#define TK_INSERT 116 |
| 13568 | | -#define TK_DELETE 117 |
| 13569 | | -#define TK_UPDATE 118 |
| 13570 | | -#define TK_SET 119 |
| 13571 | | -#define TK_DEFERRABLE 120 |
| 13572 | | -#define TK_FOREIGN 121 |
| 13573 | | -#define TK_DROP 122 |
| 13574 | | -#define TK_UNION 123 |
| 13575 | | -#define TK_ALL 124 |
| 13576 | | -#define TK_EXCEPT 125 |
| 13577 | | -#define TK_INTERSECT 126 |
| 13578 | | -#define TK_SELECT 127 |
| 13579 | | -#define TK_VALUES 128 |
| 13580 | | -#define TK_DISTINCT 129 |
| 13581 | | -#define TK_DOT 130 |
| 13582 | | -#define TK_FROM 131 |
| 13583 | | -#define TK_JOIN 132 |
| 13584 | | -#define TK_USING 133 |
| 13585 | | -#define TK_ORDER 134 |
| 13586 | | -#define TK_GROUP 135 |
| 13587 | | -#define TK_HAVING 136 |
| 13588 | | -#define TK_LIMIT 137 |
| 13589 | | -#define TK_WHERE 138 |
| 13590 | | -#define TK_INTO 139 |
| 13591 | | -#define TK_NOTHING 140 |
| 13592 | | -#define TK_FLOAT 141 |
| 13593 | | -#define TK_BLOB 142 |
| 13594 | | -#define TK_INTEGER 143 |
| 13595 | | -#define TK_VARIABLE 144 |
| 13596 | | -#define TK_CASE 145 |
| 13597 | | -#define TK_WHEN 146 |
| 13598 | | -#define TK_THEN 147 |
| 13599 | | -#define TK_ELSE 148 |
| 13600 | | -#define TK_INDEX 149 |
| 13601 | | -#define TK_ALTER 150 |
| 13602 | | -#define TK_ADD 151 |
| 13603 | | -#define TK_WINDOW 152 |
| 13604 | | -#define TK_OVER 153 |
| 13605 | | -#define TK_FILTER 154 |
| 13606 | | -#define TK_TRUEFALSE 155 |
| 13607 | | -#define TK_ISNOT 156 |
| 13608 | | -#define TK_FUNCTION 157 |
| 13609 | | -#define TK_COLUMN 158 |
| 13610 | | -#define TK_AGG_FUNCTION 159 |
| 13611 | | -#define TK_AGG_COLUMN 160 |
| 13612 | | -#define TK_UMINUS 161 |
| 13613 | | -#define TK_UPLUS 162 |
| 13614 | | -#define TK_TRUTH 163 |
| 13615 | | -#define TK_REGISTER 164 |
| 13616 | | -#define TK_VECTOR 165 |
| 13617 | | -#define TK_SELECT_COLUMN 166 |
| 13618 | | -#define TK_IF_NULL_ROW 167 |
| 13619 | | -#define TK_ASTERISK 168 |
| 13620 | | -#define TK_SPAN 169 |
| 13621 | | -#define TK_END_OF_FILE 170 |
| 13622 | | -#define TK_UNCLOSED_STRING 171 |
| 13623 | | -#define TK_SPACE 172 |
| 13624 | | -#define TK_ILLEGAL 173 |
| 13562 | +#define TK_EXCLUDE 88 |
| 13563 | +#define TK_GROUPS 89 |
| 13564 | +#define TK_OTHERS 90 |
| 13565 | +#define TK_TIES 91 |
| 13566 | +#define TK_REINDEX 92 |
| 13567 | +#define TK_RENAME 93 |
| 13568 | +#define TK_CTIME_KW 94 |
| 13569 | +#define TK_ANY 95 |
| 13570 | +#define TK_BITAND 96 |
| 13571 | +#define TK_BITOR 97 |
| 13572 | +#define TK_LSHIFT 98 |
| 13573 | +#define TK_RSHIFT 99 |
| 13574 | +#define TK_PLUS 100 |
| 13575 | +#define TK_MINUS 101 |
| 13576 | +#define TK_STAR 102 |
| 13577 | +#define TK_SLASH 103 |
| 13578 | +#define TK_REM 104 |
| 13579 | +#define TK_CONCAT 105 |
| 13580 | +#define TK_COLLATE 106 |
| 13581 | +#define TK_BITNOT 107 |
| 13582 | +#define TK_ON 108 |
| 13583 | +#define TK_INDEXED 109 |
| 13584 | +#define TK_STRING 110 |
| 13585 | +#define TK_JOIN_KW 111 |
| 13586 | +#define TK_CONSTRAINT 112 |
| 13587 | +#define TK_DEFAULT 113 |
| 13588 | +#define TK_NULL 114 |
| 13589 | +#define TK_PRIMARY 115 |
| 13590 | +#define TK_UNIQUE 116 |
| 13591 | +#define TK_CHECK 117 |
| 13592 | +#define TK_REFERENCES 118 |
| 13593 | +#define TK_AUTOINCR 119 |
| 13594 | +#define TK_INSERT 120 |
| 13595 | +#define TK_DELETE 121 |
| 13596 | +#define TK_UPDATE 122 |
| 13597 | +#define TK_SET 123 |
| 13598 | +#define TK_DEFERRABLE 124 |
| 13599 | +#define TK_FOREIGN 125 |
| 13600 | +#define TK_DROP 126 |
| 13601 | +#define TK_UNION 127 |
| 13602 | +#define TK_ALL 128 |
| 13603 | +#define TK_EXCEPT 129 |
| 13604 | +#define TK_INTERSECT 130 |
| 13605 | +#define TK_SELECT 131 |
| 13606 | +#define TK_VALUES 132 |
| 13607 | +#define TK_DISTINCT 133 |
| 13608 | +#define TK_DOT 134 |
| 13609 | +#define TK_FROM 135 |
| 13610 | +#define TK_JOIN 136 |
| 13611 | +#define TK_USING 137 |
| 13612 | +#define TK_ORDER 138 |
| 13613 | +#define TK_GROUP 139 |
| 13614 | +#define TK_HAVING 140 |
| 13615 | +#define TK_LIMIT 141 |
| 13616 | +#define TK_WHERE 142 |
| 13617 | +#define TK_INTO 143 |
| 13618 | +#define TK_NOTHING 144 |
| 13619 | +#define TK_FLOAT 145 |
| 13620 | +#define TK_BLOB 146 |
| 13621 | +#define TK_INTEGER 147 |
| 13622 | +#define TK_VARIABLE 148 |
| 13623 | +#define TK_CASE 149 |
| 13624 | +#define TK_WHEN 150 |
| 13625 | +#define TK_THEN 151 |
| 13626 | +#define TK_ELSE 152 |
| 13627 | +#define TK_INDEX 153 |
| 13628 | +#define TK_ALTER 154 |
| 13629 | +#define TK_ADD 155 |
| 13630 | +#define TK_WINDOW 156 |
| 13631 | +#define TK_OVER 157 |
| 13632 | +#define TK_FILTER 158 |
| 13633 | +#define TK_TRUEFALSE 159 |
| 13634 | +#define TK_ISNOT 160 |
| 13635 | +#define TK_FUNCTION 161 |
| 13636 | +#define TK_COLUMN 162 |
| 13637 | +#define TK_AGG_FUNCTION 163 |
| 13638 | +#define TK_AGG_COLUMN 164 |
| 13639 | +#define TK_UMINUS 165 |
| 13640 | +#define TK_UPLUS 166 |
| 13641 | +#define TK_TRUTH 167 |
| 13642 | +#define TK_REGISTER 168 |
| 13643 | +#define TK_VECTOR 169 |
| 13644 | +#define TK_SELECT_COLUMN 170 |
| 13645 | +#define TK_IF_NULL_ROW 171 |
| 13646 | +#define TK_ASTERISK 172 |
| 13647 | +#define TK_SPAN 173 |
| 13648 | +#define TK_END_OF_FILE 174 |
| 13649 | +#define TK_UNCLOSED_STRING 175 |
| 13650 | +#define TK_SPACE 176 |
| 13651 | +#define TK_ILLEGAL 177 |
| 13625 | 13652 | |
| 13626 | 13653 | /* The token codes above must all fit in 8 bits */ |
| 13627 | 13654 | #define TKFLG_MASK 0xff |
| 13628 | 13655 | |
| 13629 | 13656 | /* Flags that can be added to a token code when it is not |
| | @@ -14558,13 +14585,10 @@ |
| 14558 | 14585 | }; |
| 14559 | 14586 | |
| 14560 | 14587 | SQLITE_PRIVATE int sqlite3BtreeInsert(BtCursor*, const BtreePayload *pPayload, |
| 14561 | 14588 | int flags, int seekResult); |
| 14562 | 14589 | SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor*, int *pRes); |
| 14563 | | -#ifndef SQLITE_OMIT_WINDOWFUNC |
| 14564 | | -SQLITE_PRIVATE void sqlite3BtreeSkipNext(BtCursor*); |
| 14565 | | -#endif |
| 14566 | 14590 | SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor*, int *pRes); |
| 14567 | 14591 | SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor*, int flags); |
| 14568 | 14592 | SQLITE_PRIVATE int sqlite3BtreeEof(BtCursor*); |
| 14569 | 14593 | SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor*, int flags); |
| 14570 | 14594 | SQLITE_PRIVATE i64 sqlite3BtreeIntegerKey(BtCursor*); |
| | @@ -14918,29 +14942,29 @@ |
| 14918 | 14942 | #define OP_Compare 87 /* synopsis: r[P1@P3] <-> r[P2@P3] */ |
| 14919 | 14943 | #define OP_IsTrue 88 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */ |
| 14920 | 14944 | #define OP_Offset 89 /* synopsis: r[P3] = sqlite_offset(P1) */ |
| 14921 | 14945 | #define OP_Column 90 /* synopsis: r[P3]=PX */ |
| 14922 | 14946 | #define OP_Affinity 91 /* synopsis: affinity(r[P1@P2]) */ |
| 14923 | | -#define OP_BitAnd 92 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */ |
| 14924 | | -#define OP_BitOr 93 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */ |
| 14925 | | -#define OP_ShiftLeft 94 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */ |
| 14926 | | -#define OP_ShiftRight 95 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */ |
| 14927 | | -#define OP_Add 96 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */ |
| 14928 | | -#define OP_Subtract 97 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */ |
| 14929 | | -#define OP_Multiply 98 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */ |
| 14930 | | -#define OP_Divide 99 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */ |
| 14931 | | -#define OP_Remainder 100 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */ |
| 14932 | | -#define OP_Concat 101 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */ |
| 14933 | | -#define OP_MakeRecord 102 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ |
| 14934 | | -#define OP_BitNot 103 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */ |
| 14935 | | -#define OP_Count 104 /* synopsis: r[P2]=count() */ |
| 14936 | | -#define OP_ReadCookie 105 |
| 14937 | | -#define OP_String8 106 /* same as TK_STRING, synopsis: r[P2]='P4' */ |
| 14938 | | -#define OP_SetCookie 107 |
| 14939 | | -#define OP_ReopenIdx 108 /* synopsis: root=P2 iDb=P3 */ |
| 14940 | | -#define OP_OpenRead 109 /* synopsis: root=P2 iDb=P3 */ |
| 14941 | | -#define OP_OpenWrite 110 /* synopsis: root=P2 iDb=P3 */ |
| 14947 | +#define OP_MakeRecord 92 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ |
| 14948 | +#define OP_Count 93 /* synopsis: r[P2]=count() */ |
| 14949 | +#define OP_ReadCookie 94 |
| 14950 | +#define OP_SetCookie 95 |
| 14951 | +#define OP_BitAnd 96 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */ |
| 14952 | +#define OP_BitOr 97 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */ |
| 14953 | +#define OP_ShiftLeft 98 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */ |
| 14954 | +#define OP_ShiftRight 99 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */ |
| 14955 | +#define OP_Add 100 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */ |
| 14956 | +#define OP_Subtract 101 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */ |
| 14957 | +#define OP_Multiply 102 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */ |
| 14958 | +#define OP_Divide 103 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */ |
| 14959 | +#define OP_Remainder 104 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */ |
| 14960 | +#define OP_Concat 105 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */ |
| 14961 | +#define OP_ReopenIdx 106 /* synopsis: root=P2 iDb=P3 */ |
| 14962 | +#define OP_BitNot 107 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */ |
| 14963 | +#define OP_OpenRead 108 /* synopsis: root=P2 iDb=P3 */ |
| 14964 | +#define OP_OpenWrite 109 /* synopsis: root=P2 iDb=P3 */ |
| 14965 | +#define OP_String8 110 /* same as TK_STRING, synopsis: r[P2]='P4' */ |
| 14942 | 14966 | #define OP_OpenDup 111 |
| 14943 | 14967 | #define OP_OpenAutoindex 112 /* synopsis: nColumn=P2 */ |
| 14944 | 14968 | #define OP_OpenEphemeral 113 /* synopsis: nColumn=P2 */ |
| 14945 | 14969 | #define OP_SorterOpen 114 |
| 14946 | 14970 | #define OP_SequenceTest 115 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ |
| | @@ -14967,15 +14991,15 @@ |
| 14967 | 14991 | #define OP_Destroy 136 |
| 14968 | 14992 | #define OP_Clear 137 |
| 14969 | 14993 | #define OP_ResetSorter 138 |
| 14970 | 14994 | #define OP_CreateBtree 139 /* synopsis: r[P2]=root iDb=P1 flags=P3 */ |
| 14971 | 14995 | #define OP_SqlExec 140 |
| 14972 | | -#define OP_Real 141 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ |
| 14973 | | -#define OP_ParseSchema 142 |
| 14974 | | -#define OP_LoadAnalysis 143 |
| 14975 | | -#define OP_DropTable 144 |
| 14976 | | -#define OP_DropIndex 145 |
| 14996 | +#define OP_ParseSchema 141 |
| 14997 | +#define OP_LoadAnalysis 142 |
| 14998 | +#define OP_DropTable 143 |
| 14999 | +#define OP_DropIndex 144 |
| 15000 | +#define OP_Real 145 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ |
| 14977 | 15001 | #define OP_DropTrigger 146 |
| 14978 | 15002 | #define OP_IntegrityCk 147 |
| 14979 | 15003 | #define OP_RowSetAdd 148 /* synopsis: rowset(P1)=r[P2] */ |
| 14980 | 15004 | #define OP_Param 149 |
| 14981 | 15005 | #define OP_FkCounter 150 /* synopsis: fkctr[P1]+=P2 */ |
| | @@ -15022,18 +15046,18 @@ |
| 15022 | 15046 | /* 48 */ 0x03, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ |
| 15023 | 15047 | /* 56 */ 0x0b, 0x0b, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00,\ |
| 15024 | 15048 | /* 64 */ 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10, 0x10,\ |
| 15025 | 15049 | /* 72 */ 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10,\ |
| 15026 | 15050 | /* 80 */ 0x10, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00,\ |
| 15027 | | -/* 88 */ 0x12, 0x20, 0x00, 0x00, 0x26, 0x26, 0x26, 0x26,\ |
| 15028 | | -/* 96 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00, 0x12,\ |
| 15029 | | -/* 104 */ 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15051 | +/* 88 */ 0x12, 0x20, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\ |
| 15052 | +/* 96 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\ |
| 15053 | +/* 104 */ 0x26, 0x26, 0x00, 0x12, 0x00, 0x00, 0x10, 0x00,\ |
| 15030 | 15054 | /* 112 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15031 | 15055 | /* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15032 | 15056 | /* 128 */ 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x10,\ |
| 15033 | | -/* 136 */ 0x10, 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00,\ |
| 15034 | | -/* 144 */ 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04,\ |
| 15057 | +/* 136 */ 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\ |
| 15058 | +/* 144 */ 0x00, 0x10, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04,\ |
| 15035 | 15059 | /* 152 */ 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15036 | 15060 | /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,\ |
| 15037 | 15061 | /* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00,} |
| 15038 | 15062 | |
| 15039 | 15063 | /* The sqlite3P2Values() routine is able to run faster if it knows |
| | @@ -16479,11 +16503,11 @@ |
| 16479 | 16503 | ** Bits of the sqlite3.dbOptFlags field that are used by the |
| 16480 | 16504 | ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to |
| 16481 | 16505 | ** selectively disable various optimizations. |
| 16482 | 16506 | */ |
| 16483 | 16507 | #define SQLITE_QueryFlattener 0x0001 /* Query flattening */ |
| 16484 | | - /* 0x0002 available for reuse */ |
| 16508 | +#define SQLITE_WindowFunc 0x0002 /* Use xInverse for window functions */ |
| 16485 | 16509 | #define SQLITE_GroupByOrder 0x0004 /* GROUPBY cover of ORDERBY */ |
| 16486 | 16510 | #define SQLITE_FactorOutConst 0x0008 /* Constant factoring */ |
| 16487 | 16511 | #define SQLITE_DistinctOpt 0x0010 /* DISTINCT using indexes */ |
| 16488 | 16512 | #define SQLITE_CoverIdxScan 0x0020 /* Covering index scans */ |
| 16489 | 16513 | #define SQLITE_OrderByIdxJoin 0x0040 /* ORDER BY of joins via index */ |
| | @@ -16597,11 +16621,10 @@ |
| 16597 | 16621 | #define SQLITE_FUNC_SLOCHNG 0x2000 /* "Slow Change". Value constant during a |
| 16598 | 16622 | ** single query - might change over time */ |
| 16599 | 16623 | #define SQLITE_FUNC_AFFINITY 0x4000 /* Built-in affinity() function */ |
| 16600 | 16624 | #define SQLITE_FUNC_OFFSET 0x8000 /* Built-in sqlite_offset() function */ |
| 16601 | 16625 | #define SQLITE_FUNC_WINDOW 0x00010000 /* Built-in window-only function */ |
| 16602 | | -#define SQLITE_FUNC_WINDOW_SIZE 0x20000 /* Requires partition size as arg. */ |
| 16603 | 16626 | #define SQLITE_FUNC_INTERNAL 0x00040000 /* For use by NestedParse() only */ |
| 16604 | 16627 | |
| 16605 | 16628 | /* |
| 16606 | 16629 | ** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are |
| 16607 | 16630 | ** used to create the initializers for the FuncDef structures. |
| | @@ -17403,16 +17426,20 @@ |
| 17403 | 17426 | } y; |
| 17404 | 17427 | }; |
| 17405 | 17428 | |
| 17406 | 17429 | /* |
| 17407 | 17430 | ** The following are the meanings of bits in the Expr.flags field. |
| 17431 | +** Value restrictions: |
| 17432 | +** |
| 17433 | +** EP_Agg == NC_HasAgg == SF_HasAgg |
| 17434 | +** EP_Win == NC_HasWin |
| 17408 | 17435 | */ |
| 17409 | 17436 | #define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */ |
| 17410 | | -#define EP_Agg 0x000002 /* Contains one or more aggregate functions */ |
| 17437 | +#define EP_Distinct 0x000002 /* Aggregate function with DISTINCT keyword */ |
| 17411 | 17438 | #define EP_HasFunc 0x000004 /* Contains one or more functions of any kind */ |
| 17412 | 17439 | #define EP_FixedCol 0x000008 /* TK_Column with a known fixed value */ |
| 17413 | | -#define EP_Distinct 0x000010 /* Aggregate function with DISTINCT keyword */ |
| 17440 | +#define EP_Agg 0x000010 /* Contains one or more aggregate functions */ |
| 17414 | 17441 | #define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */ |
| 17415 | 17442 | #define EP_DblQuoted 0x000040 /* token.z was originally in "..." */ |
| 17416 | 17443 | #define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */ |
| 17417 | 17444 | #define EP_Collate 0x000100 /* Tree contains a TK_COLLATE operator */ |
| 17418 | 17445 | #define EP_Generic 0x000200 /* Ignore COLLATE or affinity on this tree */ |
| | @@ -17419,11 +17446,11 @@ |
| 17419 | 17446 | #define EP_IntValue 0x000400 /* Integer value contained in u.iValue */ |
| 17420 | 17447 | #define EP_xIsSelect 0x000800 /* x.pSelect is valid (otherwise x.pList is) */ |
| 17421 | 17448 | #define EP_Skip 0x001000 /* COLLATE, AS, or UNLIKELY */ |
| 17422 | 17449 | #define EP_Reduced 0x002000 /* Expr struct EXPR_REDUCEDSIZE bytes only */ |
| 17423 | 17450 | #define EP_TokenOnly 0x004000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */ |
| 17424 | | -#define EP_Static 0x008000 /* Held in memory not obtained from malloc() */ |
| 17451 | +#define EP_Win 0x008000 /* Contains window functions */ |
| 17425 | 17452 | #define EP_MemToken 0x010000 /* Need to sqlite3DbFree() Expr.zToken */ |
| 17426 | 17453 | #define EP_NoReduce 0x020000 /* Cannot EXPRDUP_REDUCE this Expr */ |
| 17427 | 17454 | #define EP_Unlikely 0x040000 /* unlikely() or likelihood() function */ |
| 17428 | 17455 | #define EP_ConstFunc 0x080000 /* A SQLITE_FUNC_CONSTANT or _SLOCHNG function */ |
| 17429 | 17456 | #define EP_CanBeNull 0x100000 /* Can be null despite NOT NULL constraint */ |
| | @@ -17431,10 +17458,11 @@ |
| 17431 | 17458 | #define EP_Alias 0x400000 /* Is an alias for a result set column */ |
| 17432 | 17459 | #define EP_Leaf 0x800000 /* Expr.pLeft, .pRight, .u.pSelect all NULL */ |
| 17433 | 17460 | #define EP_WinFunc 0x1000000 /* TK_FUNCTION with Expr.y.pWin set */ |
| 17434 | 17461 | #define EP_Subrtn 0x2000000 /* Uses Expr.y.sub. TK_IN, _SELECT, or _EXISTS */ |
| 17435 | 17462 | #define EP_Quoted 0x4000000 /* TK_ID was originally quoted */ |
| 17463 | +#define EP_Static 0x8000000 /* Held in memory not obtained from malloc() */ |
| 17436 | 17464 | |
| 17437 | 17465 | /* |
| 17438 | 17466 | ** The EP_Propagate mask is a set of properties that automatically propagate |
| 17439 | 17467 | ** upwards into parent nodes. |
| 17440 | 17468 | */ |
| | @@ -17670,12 +17698,13 @@ |
| 17670 | 17698 | |
| 17671 | 17699 | /* |
| 17672 | 17700 | ** Allowed values for the NameContext, ncFlags field. |
| 17673 | 17701 | ** |
| 17674 | 17702 | ** Value constraints (all checked via assert()): |
| 17675 | | -** NC_HasAgg == SF_HasAgg |
| 17703 | +** NC_HasAgg == SF_HasAgg == EP_Agg |
| 17676 | 17704 | ** NC_MinMaxAgg == SF_MinMaxAgg == SQLITE_FUNC_MINMAX |
| 17705 | +** NC_HasWin == EP_Win |
| 17677 | 17706 | ** |
| 17678 | 17707 | */ |
| 17679 | 17708 | #define NC_AllowAgg 0x0001 /* Aggregate functions are allowed here */ |
| 17680 | 17709 | #define NC_PartIdx 0x0002 /* True if resolving a partial index WHERE */ |
| 17681 | 17710 | #define NC_IsCheck 0x0004 /* True if resolving names in a CHECK constraint */ |
| | @@ -17687,10 +17716,11 @@ |
| 17687 | 17716 | #define NC_UAggInfo 0x0100 /* True if uNC.pAggInfo is used */ |
| 17688 | 17717 | #define NC_UUpsert 0x0200 /* True if uNC.pUpsert is used */ |
| 17689 | 17718 | #define NC_MinMaxAgg 0x1000 /* min/max aggregates seen. See note above */ |
| 17690 | 17719 | #define NC_Complex 0x2000 /* True if a function or subquery seen */ |
| 17691 | 17720 | #define NC_AllowWin 0x4000 /* Window functions are allowed here */ |
| 17721 | +#define NC_HasWin 0x8000 /* One or more window functions seen */ |
| 17692 | 17722 | |
| 17693 | 17723 | /* |
| 17694 | 17724 | ** An instance of the following object describes a single ON CONFLICT |
| 17695 | 17725 | ** clause in an upsert. |
| 17696 | 17726 | ** |
| | @@ -18442,11 +18472,11 @@ |
| 18442 | 18472 | u8 bLine[100]; /* Draw vertical in column i if bLine[i] is true */ |
| 18443 | 18473 | }; |
| 18444 | 18474 | #endif /* SQLITE_DEBUG */ |
| 18445 | 18475 | |
| 18446 | 18476 | /* |
| 18447 | | -** This object is used in varioius ways, all related to window functions |
| 18477 | +** This object is used in various ways, all related to window functions |
| 18448 | 18478 | ** |
| 18449 | 18479 | ** (1) A single instance of this structure is attached to the |
| 18450 | 18480 | ** the Expr.pWin field for each window function in an expression tree. |
| 18451 | 18481 | ** This object holds the information contained in the OVER clause, |
| 18452 | 18482 | ** plus additional fields used during code generation. |
| | @@ -18457,19 +18487,22 @@ |
| 18457 | 18487 | ** |
| 18458 | 18488 | ** (3) The terms of the WINDOW clause of a SELECT are instances of this |
| 18459 | 18489 | ** object on a linked list attached to Select.pWinDefn. |
| 18460 | 18490 | ** |
| 18461 | 18491 | ** The uses (1) and (2) are really the same Window object that just happens |
| 18462 | | -** to be accessible in two different ways. Use (3) is are separate objects. |
| 18492 | +** to be accessible in two different ways. Use case (3) are separate objects. |
| 18463 | 18493 | */ |
| 18464 | 18494 | struct Window { |
| 18465 | 18495 | char *zName; /* Name of window (may be NULL) */ |
| 18496 | + char *zBase; /* Name of base window for chaining (may be NULL) */ |
| 18466 | 18497 | ExprList *pPartition; /* PARTITION BY clause */ |
| 18467 | 18498 | ExprList *pOrderBy; /* ORDER BY clause */ |
| 18468 | | - u8 eType; /* TK_RANGE or TK_ROWS */ |
| 18499 | + u8 eFrmType; /* TK_RANGE, TK_GROUPS, TK_ROWS, or 0 */ |
| 18469 | 18500 | u8 eStart; /* UNBOUNDED, CURRENT, PRECEDING or FOLLOWING */ |
| 18470 | 18501 | u8 eEnd; /* UNBOUNDED, CURRENT, PRECEDING or FOLLOWING */ |
| 18502 | + u8 bImplicitFrame; /* True if frame was implicitly specified */ |
| 18503 | + u8 eExclude; /* TK_NO, TK_CURRENT, TK_TIES, TK_GROUP, or 0 */ |
| 18471 | 18504 | Expr *pStart; /* Expression for "<expr> PRECEDING" */ |
| 18472 | 18505 | Expr *pEnd; /* Expression for "<expr> FOLLOWING" */ |
| 18473 | 18506 | Window *pNextWin; /* Next window function belonging to this SELECT */ |
| 18474 | 18507 | Expr *pFilter; /* The FILTER expression */ |
| 18475 | 18508 | FuncDef *pFunc; /* The function */ |
| | @@ -18476,21 +18509,23 @@ |
| 18476 | 18509 | int iEphCsr; /* Partition buffer or Peer buffer */ |
| 18477 | 18510 | int regAccum; |
| 18478 | 18511 | int regResult; |
| 18479 | 18512 | int csrApp; /* Function cursor (used by min/max) */ |
| 18480 | 18513 | int regApp; /* Function register (also used by min/max) */ |
| 18481 | | - int regPart; /* First in a set of registers holding PARTITION BY |
| 18482 | | - ** and ORDER BY values for the window */ |
| 18514 | + int regPart; /* Array of registers for PARTITION BY values */ |
| 18483 | 18515 | Expr *pOwner; /* Expression object this window is attached to */ |
| 18484 | 18516 | int nBufferCol; /* Number of columns in buffer table */ |
| 18485 | 18517 | int iArgCol; /* Offset of first argument for this function */ |
| 18518 | + int regOne; /* Register containing constant value 1 */ |
| 18519 | + int regStartRowid; |
| 18520 | + int regEndRowid; |
| 18486 | 18521 | }; |
| 18487 | 18522 | |
| 18488 | 18523 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 18489 | 18524 | SQLITE_PRIVATE void sqlite3WindowDelete(sqlite3*, Window*); |
| 18490 | 18525 | SQLITE_PRIVATE void sqlite3WindowListDelete(sqlite3 *db, Window *p); |
| 18491 | | -SQLITE_PRIVATE Window *sqlite3WindowAlloc(Parse*, int, int, Expr*, int , Expr*); |
| 18526 | +SQLITE_PRIVATE Window *sqlite3WindowAlloc(Parse*, int, int, Expr*, int , Expr*, u8); |
| 18492 | 18527 | SQLITE_PRIVATE void sqlite3WindowAttach(Parse*, Expr*, Window*); |
| 18493 | 18528 | SQLITE_PRIVATE int sqlite3WindowCompare(Parse*, Window*, Window*); |
| 18494 | 18529 | SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse*, Window*); |
| 18495 | 18530 | SQLITE_PRIVATE void sqlite3WindowCodeStep(Parse*, Select*, WhereInfo*, int, int); |
| 18496 | 18531 | SQLITE_PRIVATE int sqlite3WindowRewrite(Parse*, Select*); |
| | @@ -18497,10 +18532,12 @@ |
| 18497 | 18532 | SQLITE_PRIVATE int sqlite3ExpandSubquery(Parse*, struct SrcList_item*); |
| 18498 | 18533 | SQLITE_PRIVATE void sqlite3WindowUpdate(Parse*, Window*, Window*, FuncDef*); |
| 18499 | 18534 | SQLITE_PRIVATE Window *sqlite3WindowDup(sqlite3 *db, Expr *pOwner, Window *p); |
| 18500 | 18535 | SQLITE_PRIVATE Window *sqlite3WindowListDup(sqlite3 *db, Window *p); |
| 18501 | 18536 | SQLITE_PRIVATE void sqlite3WindowFunctions(void); |
| 18537 | +SQLITE_PRIVATE void sqlite3WindowChain(Parse*, Window*, Window*); |
| 18538 | +SQLITE_PRIVATE Window *sqlite3WindowAssemble(Parse*, Window*, ExprList*, ExprList*, Token*); |
| 18502 | 18539 | #else |
| 18503 | 18540 | # define sqlite3WindowDelete(a,b) |
| 18504 | 18541 | # define sqlite3WindowFunctions() |
| 18505 | 18542 | # define sqlite3WindowAttach(a,b,c) |
| 18506 | 18543 | #endif |
| | @@ -20149,15 +20186,15 @@ |
| 20149 | 20186 | #define MEM_Str 0x0002 /* Value is a string */ |
| 20150 | 20187 | #define MEM_Int 0x0004 /* Value is an integer */ |
| 20151 | 20188 | #define MEM_Real 0x0008 /* Value is a real number */ |
| 20152 | 20189 | #define MEM_Blob 0x0010 /* Value is a BLOB */ |
| 20153 | 20190 | #define MEM_AffMask 0x001f /* Mask of affinity bits */ |
| 20154 | | -/* Available 0x0020 */ |
| 20191 | +#define MEM_FromBind 0x0020 /* Value originates from sqlite3_bind() */ |
| 20155 | 20192 | /* Available 0x0040 */ |
| 20156 | 20193 | #define MEM_Undefined 0x0080 /* Value is undefined */ |
| 20157 | 20194 | #define MEM_Cleared 0x0100 /* NULL set by OP_Null, not from data */ |
| 20158 | | -#define MEM_TypeMask 0xc1ff /* Mask of type bits */ |
| 20195 | +#define MEM_TypeMask 0xc1df /* Mask of type bits */ |
| 20159 | 20196 | |
| 20160 | 20197 | |
| 20161 | 20198 | /* Whenever Mem contains a valid string or blob representation, one of |
| 20162 | 20199 | ** the following flags must be set to determine the memory management |
| 20163 | 20200 | ** policy for Mem.z. The MEM_Term flag tells us whether or not the |
| | @@ -28786,28 +28823,66 @@ |
| 28786 | 28823 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 28787 | 28824 | /* |
| 28788 | 28825 | ** Generate a human-readable explanation for a Window object |
| 28789 | 28826 | */ |
| 28790 | 28827 | SQLITE_PRIVATE void sqlite3TreeViewWindow(TreeView *pView, const Window *pWin, u8 more){ |
| 28828 | + int nElement = 0; |
| 28829 | + if( pWin->pFilter ){ |
| 28830 | + sqlite3TreeViewItem(pView, "FILTER", 1); |
| 28831 | + sqlite3TreeViewExpr(pView, pWin->pFilter, 0); |
| 28832 | + sqlite3TreeViewPop(pView); |
| 28833 | + } |
| 28791 | 28834 | pView = sqlite3TreeViewPush(pView, more); |
| 28792 | 28835 | if( pWin->zName ){ |
| 28793 | | - sqlite3TreeViewLine(pView, "OVER %s", pWin->zName); |
| 28836 | + sqlite3TreeViewLine(pView, "OVER %s (%p)", pWin->zName, pWin); |
| 28794 | 28837 | }else{ |
| 28795 | | - sqlite3TreeViewLine(pView, "OVER"); |
| 28838 | + sqlite3TreeViewLine(pView, "OVER (%p)", pWin); |
| 28839 | + } |
| 28840 | + if( pWin->zBase ) nElement++; |
| 28841 | + if( pWin->pOrderBy ) nElement++; |
| 28842 | + if( pWin->eFrmType ) nElement++; |
| 28843 | + if( pWin->eExclude ) nElement++; |
| 28844 | + if( pWin->zBase ){ |
| 28845 | + sqlite3TreeViewPush(pView, (--nElement)>0); |
| 28846 | + sqlite3TreeViewLine(pView, "window: %s", pWin->zBase); |
| 28847 | + sqlite3TreeViewPop(pView); |
| 28796 | 28848 | } |
| 28797 | 28849 | if( pWin->pPartition ){ |
| 28798 | | - sqlite3TreeViewExprList(pView, pWin->pPartition, 1, "PARTITION-BY"); |
| 28850 | + sqlite3TreeViewExprList(pView, pWin->pPartition, nElement>0,"PARTITION-BY"); |
| 28799 | 28851 | } |
| 28800 | 28852 | if( pWin->pOrderBy ){ |
| 28801 | | - sqlite3TreeViewExprList(pView, pWin->pOrderBy, 1, "ORDER-BY"); |
| 28853 | + sqlite3TreeViewExprList(pView, pWin->pOrderBy, (--nElement)>0, "ORDER-BY"); |
| 28802 | 28854 | } |
| 28803 | | - if( pWin->eType ){ |
| 28804 | | - sqlite3TreeViewItem(pView, pWin->eType==TK_RANGE ? "RANGE" : "ROWS", 0); |
| 28855 | + if( pWin->eFrmType ){ |
| 28856 | + char zBuf[30]; |
| 28857 | + const char *zFrmType = "ROWS"; |
| 28858 | + if( pWin->eFrmType==TK_RANGE ) zFrmType = "RANGE"; |
| 28859 | + if( pWin->eFrmType==TK_GROUPS ) zFrmType = "GROUPS"; |
| 28860 | + sqlite3_snprintf(sizeof(zBuf),zBuf,"%s%s",zFrmType, |
| 28861 | + pWin->bImplicitFrame ? " (implied)" : ""); |
| 28862 | + sqlite3TreeViewItem(pView, zBuf, (--nElement)>0); |
| 28805 | 28863 | sqlite3TreeViewBound(pView, pWin->eStart, pWin->pStart, 1); |
| 28806 | 28864 | sqlite3TreeViewBound(pView, pWin->eEnd, pWin->pEnd, 0); |
| 28807 | 28865 | sqlite3TreeViewPop(pView); |
| 28808 | 28866 | } |
| 28867 | + if( pWin->eExclude ){ |
| 28868 | + char zBuf[30]; |
| 28869 | + const char *zExclude; |
| 28870 | + switch( pWin->eExclude ){ |
| 28871 | + case TK_NO: zExclude = "NO OTHERS"; break; |
| 28872 | + case TK_CURRENT: zExclude = "CURRENT ROW"; break; |
| 28873 | + case TK_GROUP: zExclude = "GROUP"; break; |
| 28874 | + case TK_TIES: zExclude = "TIES"; break; |
| 28875 | + default: |
| 28876 | + sqlite3_snprintf(sizeof(zBuf),zBuf,"invalid(%d)", pWin->eExclude); |
| 28877 | + zExclude = zBuf; |
| 28878 | + break; |
| 28879 | + } |
| 28880 | + sqlite3TreeViewPush(pView, 0); |
| 28881 | + sqlite3TreeViewLine(pView, "EXCLUDE %s", zExclude); |
| 28882 | + sqlite3TreeViewPop(pView); |
| 28883 | + } |
| 28809 | 28884 | sqlite3TreeViewPop(pView); |
| 28810 | 28885 | } |
| 28811 | 28886 | #endif /* SQLITE_OMIT_WINDOWFUNC */ |
| 28812 | 28887 | |
| 28813 | 28888 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| | @@ -32124,29 +32199,29 @@ |
| 32124 | 32199 | /* 87 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), |
| 32125 | 32200 | /* 88 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"), |
| 32126 | 32201 | /* 89 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"), |
| 32127 | 32202 | /* 90 */ "Column" OpHelp("r[P3]=PX"), |
| 32128 | 32203 | /* 91 */ "Affinity" OpHelp("affinity(r[P1@P2])"), |
| 32129 | | - /* 92 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"), |
| 32130 | | - /* 93 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"), |
| 32131 | | - /* 94 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"), |
| 32132 | | - /* 95 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"), |
| 32133 | | - /* 96 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"), |
| 32134 | | - /* 97 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"), |
| 32135 | | - /* 98 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"), |
| 32136 | | - /* 99 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"), |
| 32137 | | - /* 100 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"), |
| 32138 | | - /* 101 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"), |
| 32139 | | - /* 102 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), |
| 32140 | | - /* 103 */ "BitNot" OpHelp("r[P2]= ~r[P1]"), |
| 32141 | | - /* 104 */ "Count" OpHelp("r[P2]=count()"), |
| 32142 | | - /* 105 */ "ReadCookie" OpHelp(""), |
| 32143 | | - /* 106 */ "String8" OpHelp("r[P2]='P4'"), |
| 32144 | | - /* 107 */ "SetCookie" OpHelp(""), |
| 32145 | | - /* 108 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), |
| 32146 | | - /* 109 */ "OpenRead" OpHelp("root=P2 iDb=P3"), |
| 32147 | | - /* 110 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), |
| 32204 | + /* 92 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), |
| 32205 | + /* 93 */ "Count" OpHelp("r[P2]=count()"), |
| 32206 | + /* 94 */ "ReadCookie" OpHelp(""), |
| 32207 | + /* 95 */ "SetCookie" OpHelp(""), |
| 32208 | + /* 96 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"), |
| 32209 | + /* 97 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"), |
| 32210 | + /* 98 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"), |
| 32211 | + /* 99 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"), |
| 32212 | + /* 100 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"), |
| 32213 | + /* 101 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"), |
| 32214 | + /* 102 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"), |
| 32215 | + /* 103 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"), |
| 32216 | + /* 104 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"), |
| 32217 | + /* 105 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"), |
| 32218 | + /* 106 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), |
| 32219 | + /* 107 */ "BitNot" OpHelp("r[P2]= ~r[P1]"), |
| 32220 | + /* 108 */ "OpenRead" OpHelp("root=P2 iDb=P3"), |
| 32221 | + /* 109 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), |
| 32222 | + /* 110 */ "String8" OpHelp("r[P2]='P4'"), |
| 32148 | 32223 | /* 111 */ "OpenDup" OpHelp(""), |
| 32149 | 32224 | /* 112 */ "OpenAutoindex" OpHelp("nColumn=P2"), |
| 32150 | 32225 | /* 113 */ "OpenEphemeral" OpHelp("nColumn=P2"), |
| 32151 | 32226 | /* 114 */ "SorterOpen" OpHelp(""), |
| 32152 | 32227 | /* 115 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), |
| | @@ -32173,15 +32248,15 @@ |
| 32173 | 32248 | /* 136 */ "Destroy" OpHelp(""), |
| 32174 | 32249 | /* 137 */ "Clear" OpHelp(""), |
| 32175 | 32250 | /* 138 */ "ResetSorter" OpHelp(""), |
| 32176 | 32251 | /* 139 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"), |
| 32177 | 32252 | /* 140 */ "SqlExec" OpHelp(""), |
| 32178 | | - /* 141 */ "Real" OpHelp("r[P2]=P4"), |
| 32179 | | - /* 142 */ "ParseSchema" OpHelp(""), |
| 32180 | | - /* 143 */ "LoadAnalysis" OpHelp(""), |
| 32181 | | - /* 144 */ "DropTable" OpHelp(""), |
| 32182 | | - /* 145 */ "DropIndex" OpHelp(""), |
| 32253 | + /* 141 */ "ParseSchema" OpHelp(""), |
| 32254 | + /* 142 */ "LoadAnalysis" OpHelp(""), |
| 32255 | + /* 143 */ "DropTable" OpHelp(""), |
| 32256 | + /* 144 */ "DropIndex" OpHelp(""), |
| 32257 | + /* 145 */ "Real" OpHelp("r[P2]=P4"), |
| 32183 | 32258 | /* 146 */ "DropTrigger" OpHelp(""), |
| 32184 | 32259 | /* 147 */ "IntegrityCk" OpHelp(""), |
| 32185 | 32260 | /* 148 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), |
| 32186 | 32261 | /* 149 */ "Param" OpHelp(""), |
| 32187 | 32262 | /* 150 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), |
| | @@ -59204,10 +59279,11 @@ |
| 59204 | 59279 | static void walCleanupHash(Wal *pWal){ |
| 59205 | 59280 | WalHashLoc sLoc; /* Hash table location */ |
| 59206 | 59281 | int iLimit = 0; /* Zero values greater than this */ |
| 59207 | 59282 | int nByte; /* Number of bytes to zero in aPgno[] */ |
| 59208 | 59283 | int i; /* Used to iterate through aHash[] */ |
| 59284 | + int rc; /* Return code form walHashGet() */ |
| 59209 | 59285 | |
| 59210 | 59286 | assert( pWal->writeLock ); |
| 59211 | 59287 | testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE-1 ); |
| 59212 | 59288 | testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE ); |
| 59213 | 59289 | testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE+1 ); |
| | @@ -59214,15 +59290,16 @@ |
| 59214 | 59290 | |
| 59215 | 59291 | if( pWal->hdr.mxFrame==0 ) return; |
| 59216 | 59292 | |
| 59217 | 59293 | /* Obtain pointers to the hash-table and page-number array containing |
| 59218 | 59294 | ** the entry that corresponds to frame pWal->hdr.mxFrame. It is guaranteed |
| 59219 | | - ** that the page said hash-table and array reside on is already mapped. |
| 59295 | + ** that the page said hash-table and array reside on is already mapped.(1) |
| 59220 | 59296 | */ |
| 59221 | 59297 | assert( pWal->nWiData>walFramePage(pWal->hdr.mxFrame) ); |
| 59222 | 59298 | assert( pWal->apWiData[walFramePage(pWal->hdr.mxFrame)] ); |
| 59223 | | - walHashGet(pWal, walFramePage(pWal->hdr.mxFrame), &sLoc); |
| 59299 | + rc = walHashGet(pWal, walFramePage(pWal->hdr.mxFrame), &sLoc); |
| 59300 | + if( NEVER(rc) ) return; /* Defense-in-depth, in case (1) above is wrong */ |
| 59224 | 59301 | |
| 59225 | 59302 | /* Zero all hash-table entries that correspond to frame numbers greater |
| 59226 | 59303 | ** than pWal->hdr.mxFrame. |
| 59227 | 59304 | */ |
| 59228 | 59305 | iLimit = pWal->hdr.mxFrame - sLoc.iZero; |
| | @@ -63922,18 +63999,22 @@ |
| 63922 | 63999 | ** at most one effective restoreCursorPosition() call after each |
| 63923 | 64000 | ** saveCursorPosition(). |
| 63924 | 64001 | */ |
| 63925 | 64002 | static int btreeRestoreCursorPosition(BtCursor *pCur){ |
| 63926 | 64003 | int rc; |
| 63927 | | - int skipNext; |
| 64004 | + int skipNext = 0; |
| 63928 | 64005 | assert( cursorOwnsBtShared(pCur) ); |
| 63929 | 64006 | assert( pCur->eState>=CURSOR_REQUIRESEEK ); |
| 63930 | 64007 | if( pCur->eState==CURSOR_FAULT ){ |
| 63931 | 64008 | return pCur->skipNext; |
| 63932 | 64009 | } |
| 63933 | 64010 | pCur->eState = CURSOR_INVALID; |
| 63934 | | - rc = btreeMoveto(pCur, pCur->pKey, pCur->nKey, 0, &skipNext); |
| 64011 | + if( sqlite3FaultSim(410) ){ |
| 64012 | + rc = SQLITE_IOERR; |
| 64013 | + }else{ |
| 64014 | + rc = btreeMoveto(pCur, pCur->pKey, pCur->nKey, 0, &skipNext); |
| 64015 | + } |
| 63935 | 64016 | if( rc==SQLITE_OK ){ |
| 63936 | 64017 | sqlite3_free(pCur->pKey); |
| 63937 | 64018 | pCur->pKey = 0; |
| 63938 | 64019 | assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_INVALID ); |
| 63939 | 64020 | if( skipNext ) pCur->skipNext = skipNext; |
| | @@ -64521,15 +64602,11 @@ |
| 64521 | 64602 | ** two (or one) blocks of cells using memmove() and add the required |
| 64522 | 64603 | ** offsets to each pointer in the cell-pointer array than it is to |
| 64523 | 64604 | ** reconstruct the entire page. */ |
| 64524 | 64605 | if( (int)data[hdr+7]<=nMaxFrag ){ |
| 64525 | 64606 | int iFree = get2byte(&data[hdr+1]); |
| 64526 | | - |
| 64527 | | - /* If the initial freeblock offset were out of bounds, that would have |
| 64528 | | - ** been detected by btreeComputeFreeSpace() when it was computing the |
| 64529 | | - ** number of free bytes on the page. */ |
| 64530 | | - assert( iFree<=usableSize-4 ); |
| 64607 | + if( iFree>usableSize-4 ) return SQLITE_CORRUPT_PAGE(pPage); |
| 64531 | 64608 | if( iFree ){ |
| 64532 | 64609 | int iFree2 = get2byte(&data[iFree]); |
| 64533 | 64610 | if( iFree2>usableSize-4 ) return SQLITE_CORRUPT_PAGE(pPage); |
| 64534 | 64611 | if( 0==iFree2 || (data[iFree2]==0 && data[iFree2+1]==0) ){ |
| 64535 | 64612 | u8 *pEnd = &data[cellOffset + nCell*2]; |
| | @@ -64544,11 +64621,14 @@ |
| 64544 | 64621 | if( iFree+sz>iFree2 ) return SQLITE_CORRUPT_PAGE(pPage); |
| 64545 | 64622 | sz2 = get2byte(&data[iFree2+2]); |
| 64546 | 64623 | if( iFree2+sz2 > usableSize ) return SQLITE_CORRUPT_PAGE(pPage); |
| 64547 | 64624 | memmove(&data[iFree+sz+sz2], &data[iFree+sz], iFree2-(iFree+sz)); |
| 64548 | 64625 | sz += sz2; |
| 64626 | + }else if( iFree+sz>usableSize ){ |
| 64627 | + return SQLITE_CORRUPT_PAGE(pPage); |
| 64549 | 64628 | } |
| 64629 | + |
| 64550 | 64630 | cbrk = top+sz; |
| 64551 | 64631 | assert( cbrk+(iFree-top) <= usableSize ); |
| 64552 | 64632 | memmove(&data[cbrk], &data[top], iFree-top); |
| 64553 | 64633 | for(pAddr=&data[cellOffset]; pAddr<pEnd; pAddr+=2){ |
| 64554 | 64634 | pc = get2byte(pAddr); |
| | @@ -65102,11 +65182,11 @@ |
| 65102 | 65182 | /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only |
| 65103 | 65183 | ** possible for a root page of a table that contains no rows) then the |
| 65104 | 65184 | ** offset to the cell content area will equal the page size minus the |
| 65105 | 65185 | ** bytes of reserved space. */ |
| 65106 | 65186 | assert( pPage->nCell>0 |
| 65107 | | - || get2byteNotZero(&data[5])==pBt->usableSize |
| 65187 | + || get2byteNotZero(&data[5])==(int)pBt->usableSize |
| 65108 | 65188 | || CORRUPT_DB ); |
| 65109 | 65189 | pPage->nFree = -1; /* Indicate that this value is yet uncomputed */ |
| 65110 | 65190 | pPage->isInit = 1; |
| 65111 | 65191 | if( pBt->db->flags & SQLITE_CellSizeCk ){ |
| 65112 | 65192 | return btreeCellSizeCheck(pPage); |
| | @@ -68359,27 +68439,10 @@ |
| 68359 | 68439 | rc = SQLITE_OK; |
| 68360 | 68440 | } |
| 68361 | 68441 | return rc; |
| 68362 | 68442 | } |
| 68363 | 68443 | |
| 68364 | | -/* |
| 68365 | | -** This function is a no-op if cursor pCur does not point to a valid row. |
| 68366 | | -** Otherwise, if pCur is valid, configure it so that the next call to |
| 68367 | | -** sqlite3BtreeNext() is a no-op. |
| 68368 | | -*/ |
| 68369 | | -#ifndef SQLITE_OMIT_WINDOWFUNC |
| 68370 | | -SQLITE_PRIVATE void sqlite3BtreeSkipNext(BtCursor *pCur){ |
| 68371 | | - /* We believe that the cursor must always be in the valid state when |
| 68372 | | - ** this routine is called, but the proof is difficult, so we add an |
| 68373 | | - ** ALWaYS() test just in case we are wrong. */ |
| 68374 | | - if( ALWAYS(pCur->eState==CURSOR_VALID) ){ |
| 68375 | | - pCur->eState = CURSOR_SKIPNEXT; |
| 68376 | | - pCur->skipNext = 1; |
| 68377 | | - } |
| 68378 | | -} |
| 68379 | | -#endif /* SQLITE_OMIT_WINDOWFUNC */ |
| 68380 | | - |
| 68381 | 68444 | /* Move the cursor to the last entry in the table. Return SQLITE_OK |
| 68382 | 68445 | ** on success. Set *pRes to 0 if the cursor actually points to something |
| 68383 | 68446 | ** or set *pRes to 1 if the table is empty. |
| 68384 | 68447 | */ |
| 68385 | 68448 | SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor *pCur, int *pRes){ |
| | @@ -69279,11 +69342,13 @@ |
| 69279 | 69342 | |
| 69280 | 69343 | assert( sqlite3_mutex_held(pBt->mutex) ); |
| 69281 | 69344 | assert( CORRUPT_DB || iPage>1 ); |
| 69282 | 69345 | assert( !pMemPage || pMemPage->pgno==iPage ); |
| 69283 | 69346 | |
| 69284 | | - if( iPage<2 ) return SQLITE_CORRUPT_BKPT; |
| 69347 | + if( iPage<2 || iPage>pBt->nPage ){ |
| 69348 | + return SQLITE_CORRUPT_BKPT; |
| 69349 | + } |
| 69285 | 69350 | if( pMemPage ){ |
| 69286 | 69351 | pPage = pMemPage; |
| 69287 | 69352 | sqlite3PagerRef(pPage->pDbPage); |
| 69288 | 69353 | }else{ |
| 69289 | 69354 | pPage = btreePageLookup(pBt, iPage); |
| | @@ -70648,11 +70713,10 @@ |
| 70648 | 70713 | if( rc ){ |
| 70649 | 70714 | memset(apOld, 0, (i)*sizeof(MemPage*)); |
| 70650 | 70715 | goto balance_cleanup; |
| 70651 | 70716 | } |
| 70652 | 70717 | } |
| 70653 | | - nMaxCells += 1+apOld[i]->nCell+apOld[i]->nOverflow; |
| 70654 | 70718 | if( (i--)==0 ) break; |
| 70655 | 70719 | |
| 70656 | 70720 | if( pParent->nOverflow && i+nxDiv==pParent->aiOvfl[0] ){ |
| 70657 | 70721 | apDiv[i] = pParent->apOvfl[0]; |
| 70658 | 70722 | pgno = get4byte(apDiv[i]); |
| | @@ -70692,10 +70756,11 @@ |
| 70692 | 70756 | } |
| 70693 | 70757 | } |
| 70694 | 70758 | |
| 70695 | 70759 | /* Make nMaxCells a multiple of 4 in order to preserve 8-byte |
| 70696 | 70760 | ** alignment */ |
| 70761 | + nMaxCells = nOld*(MX_CELL(pBt) + ArraySize(pParent->apOvfl)); |
| 70697 | 70762 | nMaxCells = (nMaxCells + 3)&~3; |
| 70698 | 70763 | |
| 70699 | 70764 | /* |
| 70700 | 70765 | ** Allocate space for memory structures |
| 70701 | 70766 | */ |
| | @@ -70702,11 +70767,11 @@ |
| 70702 | 70767 | szScratch = |
| 70703 | 70768 | nMaxCells*sizeof(u8*) /* b.apCell */ |
| 70704 | 70769 | + nMaxCells*sizeof(u16) /* b.szCell */ |
| 70705 | 70770 | + pBt->pageSize; /* aSpace1 */ |
| 70706 | 70771 | |
| 70707 | | - assert( szScratch<=6*(int)pBt->pageSize ); |
| 70772 | + assert( szScratch<=7*(int)pBt->pageSize ); |
| 70708 | 70773 | b.apCell = sqlite3StackAllocRaw(0, szScratch ); |
| 70709 | 70774 | if( b.apCell==0 ){ |
| 70710 | 70775 | rc = SQLITE_NOMEM_BKPT; |
| 70711 | 70776 | goto balance_cleanup; |
| 70712 | 70777 | } |
| | @@ -71252,11 +71317,12 @@ |
| 71252 | 71317 | */ |
| 71253 | 71318 | assert( nNew==1 || CORRUPT_DB ); |
| 71254 | 71319 | rc = defragmentPage(apNew[0], -1); |
| 71255 | 71320 | testcase( rc!=SQLITE_OK ); |
| 71256 | 71321 | assert( apNew[0]->nFree == |
| 71257 | | - (get2byte(&apNew[0]->aData[5])-apNew[0]->cellOffset-apNew[0]->nCell*2) |
| 71322 | + (get2byteNotZero(&apNew[0]->aData[5]) - apNew[0]->cellOffset |
| 71323 | + - apNew[0]->nCell*2) |
| 71258 | 71324 | || rc!=SQLITE_OK |
| 71259 | 71325 | ); |
| 71260 | 71326 | copyNodeContent(apNew[0], pParent, &rc); |
| 71261 | 71327 | freePage(apNew[0], &rc); |
| 71262 | 71328 | }else if( ISAUTOVACUUM && !leafCorrection ){ |
| | @@ -71917,13 +71983,16 @@ |
| 71917 | 71983 | assert( pBt->inTransaction==TRANS_WRITE ); |
| 71918 | 71984 | assert( (pBt->btsFlags & BTS_READ_ONLY)==0 ); |
| 71919 | 71985 | assert( pCur->curFlags & BTCF_WriteFlag ); |
| 71920 | 71986 | assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) ); |
| 71921 | 71987 | assert( !hasReadConflicts(p, pCur->pgnoRoot) ); |
| 71922 | | - assert( pCur->ix<pCur->pPage->nCell ); |
| 71923 | | - assert( pCur->eState==CURSOR_VALID ); |
| 71924 | 71988 | assert( (flags & ~(BTREE_SAVEPOSITION | BTREE_AUXDELETE))==0 ); |
| 71989 | + if( pCur->eState==CURSOR_REQUIRESEEK ){ |
| 71990 | + rc = btreeRestoreCursorPosition(pCur); |
| 71991 | + if( rc ) return rc; |
| 71992 | + } |
| 71993 | + assert( pCur->eState==CURSOR_VALID ); |
| 71925 | 71994 | |
| 71926 | 71995 | iCellDepth = pCur->iPage; |
| 71927 | 71996 | iCellIdx = pCur->ix; |
| 71928 | 71997 | pPage = pCur->pPage; |
| 71929 | 71998 | pCell = findCell(pPage, iCellIdx); |
| | @@ -74387,11 +74456,11 @@ |
| 74387 | 74456 | assert( ((p->flags&MEM_Dyn)!=0 ? 1 : 0) + |
| 74388 | 74457 | ((p->flags&MEM_Ephem)!=0 ? 1 : 0) + |
| 74389 | 74458 | ((p->flags&MEM_Static)!=0 ? 1 : 0) <= 1 ); |
| 74390 | 74459 | |
| 74391 | 74460 | /* No other bits set */ |
| 74392 | | - assert( (p->flags & ~(MEM_Null|MEM_Term|MEM_Subtype |
| 74461 | + assert( (p->flags & ~(MEM_Null|MEM_Term|MEM_Subtype|MEM_FromBind |
| 74393 | 74462 | |MEM_Dyn|MEM_Ephem|MEM_Static))==0 ); |
| 74394 | 74463 | }else{ |
| 74395 | 74464 | /* A pure NULL might have other flags, such as MEM_Static, MEM_Dyn, |
| 74396 | 74465 | ** MEM_Ephem, MEM_Cleared, or MEM_Subtype */ |
| 74397 | 74466 | } |
| | @@ -81474,10 +81543,15 @@ |
| 81474 | 81543 | |
| 81475 | 81544 | /* Return true if a parameter to xUpdate represents an unchanged column */ |
| 81476 | 81545 | SQLITE_API int sqlite3_value_nochange(sqlite3_value *pVal){ |
| 81477 | 81546 | return (pVal->flags&(MEM_Null|MEM_Zero))==(MEM_Null|MEM_Zero); |
| 81478 | 81547 | } |
| 81548 | + |
| 81549 | +/* Return true if a parameter value originated from an sqlite3_bind() */ |
| 81550 | +SQLITE_API int sqlite3_value_frombind(sqlite3_value *pVal){ |
| 81551 | + return (pVal->flags&MEM_FromBind)!=0; |
| 81552 | +} |
| 81479 | 81553 | |
| 81480 | 81554 | /* Make a copy of an sqlite3_value object |
| 81481 | 81555 | */ |
| 81482 | 81556 | SQLITE_API sqlite3_value *sqlite3_value_dup(const sqlite3_value *pOrig){ |
| 81483 | 81557 | sqlite3_value *pNew; |
| | @@ -83505,16 +83579,24 @@ |
| 83505 | 83579 | /* |
| 83506 | 83580 | ** Invoke the VDBE coverage callback, if that callback is defined. This |
| 83507 | 83581 | ** feature is used for test suite validation only and does not appear an |
| 83508 | 83582 | ** production builds. |
| 83509 | 83583 | ** |
| 83510 | | -** M is an integer between 2 and 4. 2 indicates a ordinary two-way |
| 83511 | | -** branch (I=0 means fall through and I=1 means taken). 3 indicates |
| 83512 | | -** a 3-way branch where the third way is when one of the operands is |
| 83513 | | -** NULL. 4 indicates the OP_Jump instruction which has three destinations |
| 83514 | | -** depending on whether the first operand is less than, equal to, or greater |
| 83515 | | -** than the second. |
| 83584 | +** M is the type of branch. I is the direction taken for this instance of |
| 83585 | +** the branch. |
| 83586 | +** |
| 83587 | +** M: 2 - two-way branch (I=0: fall-thru 1: jump ) |
| 83588 | +** 3 - two-way + NULL (I=0: fall-thru 1: jump 2: NULL ) |
| 83589 | +** 4 - OP_Jump (I=0: jump p1 1: jump p2 2: jump p3) |
| 83590 | +** |
| 83591 | +** In other words, if M is 2, then I is either 0 (for fall-through) or |
| 83592 | +** 1 (for when the branch is taken). If M is 3, the I is 0 for an |
| 83593 | +** ordinary fall-through, I is 1 if the branch was taken, and I is 2 |
| 83594 | +** if the result of comparison is NULL. For M=3, I=2 the jump may or |
| 83595 | +** may not be taken, depending on the SQLITE_JUMPIFNULL flags in p5. |
| 83596 | +** When M is 4, that means that an OP_Jump is being run. I is 0, 1, or 2 |
| 83597 | +** depending on if the operands are less than, equal, or greater than. |
| 83516 | 83598 | ** |
| 83517 | 83599 | ** iSrcLine is the source code line (from the __LINE__ macro) that |
| 83518 | 83600 | ** generated the VDBE instruction combined with flag bits. The source |
| 83519 | 83601 | ** code line number is in the lower 24 bits of iSrcLine and the upper |
| 83520 | 83602 | ** 8 bytes are flags. The lower three bits of the flags indicate |
| | @@ -83521,13 +83603,13 @@ |
| 83521 | 83603 | ** values for I that should never occur. For example, if the branch is |
| 83522 | 83604 | ** always taken, the flags should be 0x05 since the fall-through and |
| 83523 | 83605 | ** alternate branch are never taken. If a branch is never taken then |
| 83524 | 83606 | ** flags should be 0x06 since only the fall-through approach is allowed. |
| 83525 | 83607 | ** |
| 83526 | | -** Bit 0x04 of the flags indicates an OP_Jump opcode that is only |
| 83608 | +** Bit 0x08 of the flags indicates an OP_Jump opcode that is only |
| 83527 | 83609 | ** interested in equal or not-equal. In other words, I==0 and I==2 |
| 83528 | | -** should be treated the same. |
| 83610 | +** should be treated as equivalent |
| 83529 | 83611 | ** |
| 83530 | 83612 | ** Since only a line number is retained, not the filename, this macro |
| 83531 | 83613 | ** only works for amalgamation builds. But that is ok, since these macros |
| 83532 | 83614 | ** should be no-ops except for special builds used to measure test coverage. |
| 83533 | 83615 | */ |
| | @@ -83547,10 +83629,22 @@ |
| 83547 | 83629 | ** a branch really does go in one of those directions, assert right |
| 83548 | 83630 | ** away. */ |
| 83549 | 83631 | mNever = iSrcLine >> 24; |
| 83550 | 83632 | assert( (I & mNever)==0 ); |
| 83551 | 83633 | if( sqlite3GlobalConfig.xVdbeBranch==0 ) return; /*NO_TEST*/ |
| 83634 | + /* Invoke the branch coverage callback with three arguments: |
| 83635 | + ** iSrcLine - the line number of the VdbeCoverage() macro, with |
| 83636 | + ** flags removed. |
| 83637 | + ** I - Mask of bits 0x07 indicating which cases are are |
| 83638 | + ** fulfilled by this instance of the jump. 0x01 means |
| 83639 | + ** fall-thru, 0x02 means taken, 0x04 means NULL. Any |
| 83640 | + ** impossible cases (ex: if the comparison is never NULL) |
| 83641 | + ** are filled in automatically so that the coverage |
| 83642 | + ** measurement logic does not flag those impossible cases |
| 83643 | + ** as missed coverage. |
| 83644 | + ** M - Type of jump. Same as M argument above |
| 83645 | + */ |
| 83552 | 83646 | I |= mNever; |
| 83553 | 83647 | if( M==2 ) I |= 0x04; |
| 83554 | 83648 | if( M==4 ){ |
| 83555 | 83649 | I |= 0x08; |
| 83556 | 83650 | if( (mNever&0x08)!=0 && (I&0x05)!=0) I |= 0x05; /*NO_TEST*/ |
| | @@ -84708,11 +84802,14 @@ |
| 84708 | 84802 | pVar = &p->aVar[pOp->p1 - 1]; |
| 84709 | 84803 | if( sqlite3VdbeMemTooBig(pVar) ){ |
| 84710 | 84804 | goto too_big; |
| 84711 | 84805 | } |
| 84712 | 84806 | pOut = &aMem[pOp->p2]; |
| 84713 | | - sqlite3VdbeMemShallowCopy(pOut, pVar, MEM_Static); |
| 84807 | + if( VdbeMemDynamic(pOut) ) sqlite3VdbeMemSetNull(pOut); |
| 84808 | + memcpy(pOut, pVar, MEMCELLSIZE); |
| 84809 | + pOut->flags &= ~(MEM_Dyn|MEM_Ephem); |
| 84810 | + pOut->flags |= MEM_Static|MEM_FromBind; |
| 84714 | 84811 | UPDATE_MAX_BLOBSIZE(pOut); |
| 84715 | 84812 | break; |
| 84716 | 84813 | } |
| 84717 | 84814 | |
| 84718 | 84815 | /* Opcode: Move P1 P2 P3 * * |
| | @@ -85206,20 +85303,21 @@ |
| 85206 | 85303 | */ |
| 85207 | 85304 | case OP_MustBeInt: { /* jump, in1 */ |
| 85208 | 85305 | pIn1 = &aMem[pOp->p1]; |
| 85209 | 85306 | if( (pIn1->flags & MEM_Int)==0 ){ |
| 85210 | 85307 | applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding); |
| 85211 | | - VdbeBranchTaken((pIn1->flags&MEM_Int)==0, 2); |
| 85212 | 85308 | if( (pIn1->flags & MEM_Int)==0 ){ |
| 85309 | + VdbeBranchTaken(1, 2); |
| 85213 | 85310 | if( pOp->p2==0 ){ |
| 85214 | 85311 | rc = SQLITE_MISMATCH; |
| 85215 | 85312 | goto abort_due_to_error; |
| 85216 | 85313 | }else{ |
| 85217 | 85314 | goto jump_to_p2; |
| 85218 | 85315 | } |
| 85219 | 85316 | } |
| 85220 | 85317 | } |
| 85318 | + VdbeBranchTaken(0, 2); |
| 85221 | 85319 | MemSetTypeFlag(pIn1, MEM_Int); |
| 85222 | 85320 | break; |
| 85223 | 85321 | } |
| 85224 | 85322 | |
| 85225 | 85323 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| | @@ -85390,20 +85488,19 @@ |
| 85390 | 85488 | if( pOp->p5 & SQLITE_NULLEQ ){ |
| 85391 | 85489 | /* If SQLITE_NULLEQ is set (which will only happen if the operator is |
| 85392 | 85490 | ** OP_Eq or OP_Ne) then take the jump or not depending on whether |
| 85393 | 85491 | ** or not both operands are null. |
| 85394 | 85492 | */ |
| 85395 | | - assert( pOp->opcode==OP_Eq || pOp->opcode==OP_Ne ); |
| 85396 | 85493 | assert( (flags1 & MEM_Cleared)==0 ); |
| 85397 | 85494 | assert( (pOp->p5 & SQLITE_JUMPIFNULL)==0 || CORRUPT_DB ); |
| 85398 | 85495 | testcase( (pOp->p5 & SQLITE_JUMPIFNULL)!=0 ); |
| 85399 | 85496 | if( (flags1&flags3&MEM_Null)!=0 |
| 85400 | 85497 | && (flags3&MEM_Cleared)==0 |
| 85401 | 85498 | ){ |
| 85402 | 85499 | res = 0; /* Operands are equal */ |
| 85403 | 85500 | }else{ |
| 85404 | | - res = 1; /* Operands are not equal */ |
| 85501 | + res = ((flags3 & MEM_Null) ? -1 : +1); /* Operands are not equal */ |
| 85405 | 85502 | } |
| 85406 | 85503 | }else{ |
| 85407 | 85504 | /* SQLITE_NULLEQ is clear and at least one operand is NULL, |
| 85408 | 85505 | ** then the result is always NULL. |
| 85409 | 85506 | ** The jump is taken if the SQLITE_JUMPIFNULL bit is set. |
| | @@ -85517,11 +85614,11 @@ |
| 85517 | 85614 | memAboutToChange(p, pOut); |
| 85518 | 85615 | MemSetTypeFlag(pOut, MEM_Int); |
| 85519 | 85616 | pOut->u.i = res2; |
| 85520 | 85617 | REGISTER_TRACE(pOp->p2, pOut); |
| 85521 | 85618 | }else{ |
| 85522 | | - VdbeBranchTaken(res!=0, (pOp->p5 & SQLITE_NULLEQ)?2:3); |
| 85619 | + VdbeBranchTaken(res2!=0, (pOp->p5 & SQLITE_NULLEQ)?2:3); |
| 85523 | 85620 | if( res2 ){ |
| 85524 | 85621 | goto jump_to_p2; |
| 85525 | 85622 | } |
| 85526 | 85623 | } |
| 85527 | 85624 | break; |
| | @@ -87078,10 +87175,11 @@ |
| 87078 | 87175 | pCx->nullRow = 1; |
| 87079 | 87176 | pCx->isEphemeral = 1; |
| 87080 | 87177 | pCx->pKeyInfo = pOrig->pKeyInfo; |
| 87081 | 87178 | pCx->isTable = pOrig->isTable; |
| 87082 | 87179 | pCx->pgnoRoot = pOrig->pgnoRoot; |
| 87180 | + pCx->isOrdered = pOrig->isOrdered; |
| 87083 | 87181 | rc = sqlite3BtreeCursor(pOrig->pBtx, pCx->pgnoRoot, BTREE_WRCSR, |
| 87084 | 87182 | pCx->pKeyInfo, pCx->uc.pCursor); |
| 87085 | 87183 | /* The sqlite3BtreeCursor() routine can only fail for the first cursor |
| 87086 | 87184 | ** opened for a database. Since there is already an open cursor when this |
| 87087 | 87185 | ** opcode is run, the sqlite3BtreeCursor() cannot fail */ |
| | @@ -88586,22 +88684,18 @@ |
| 88586 | 88684 | sqlite3_search_count--; |
| 88587 | 88685 | #endif |
| 88588 | 88686 | p->aCounter[SQLITE_STMTSTATUS_SORT]++; |
| 88589 | 88687 | /* Fall through into OP_Rewind */ |
| 88590 | 88688 | } |
| 88591 | | -/* Opcode: Rewind P1 P2 * * P5 |
| 88689 | +/* Opcode: Rewind P1 P2 * * * |
| 88592 | 88690 | ** |
| 88593 | 88691 | ** The next use of the Rowid or Column or Next instruction for P1 |
| 88594 | 88692 | ** will refer to the first entry in the database table or index. |
| 88595 | 88693 | ** If the table or index is empty, jump immediately to P2. |
| 88596 | 88694 | ** If the table or index is not empty, fall through to the following |
| 88597 | 88695 | ** instruction. |
| 88598 | 88696 | ** |
| 88599 | | -** If P5 is non-zero and the table is not empty, then the "skip-next" |
| 88600 | | -** flag is set on the cursor so that the next OP_Next instruction |
| 88601 | | -** executed on it is a no-op. |
| 88602 | | -** |
| 88603 | 88697 | ** This opcode leaves the cursor configured to move in forward order, |
| 88604 | 88698 | ** from the beginning toward the end. In other words, the cursor is |
| 88605 | 88699 | ** configured to use Next, not Prev. |
| 88606 | 88700 | */ |
| 88607 | 88701 | case OP_Rewind: { /* jump */ |
| | @@ -88608,10 +88702,11 @@ |
| 88608 | 88702 | VdbeCursor *pC; |
| 88609 | 88703 | BtCursor *pCrsr; |
| 88610 | 88704 | int res; |
| 88611 | 88705 | |
| 88612 | 88706 | assert( pOp->p1>=0 && pOp->p1<p->nCursor ); |
| 88707 | + assert( pOp->p5==0 ); |
| 88613 | 88708 | pC = p->apCsr[pOp->p1]; |
| 88614 | 88709 | assert( pC!=0 ); |
| 88615 | 88710 | assert( isSorter(pC)==(pOp->opcode==OP_SorterSort) ); |
| 88616 | 88711 | res = 1; |
| 88617 | 88712 | #ifdef SQLITE_DEBUG |
| | @@ -88622,13 +88717,10 @@ |
| 88622 | 88717 | }else{ |
| 88623 | 88718 | assert( pC->eCurType==CURTYPE_BTREE ); |
| 88624 | 88719 | pCrsr = pC->uc.pCursor; |
| 88625 | 88720 | assert( pCrsr ); |
| 88626 | 88721 | rc = sqlite3BtreeFirst(pCrsr, &res); |
| 88627 | | -#ifndef SQLITE_OMIT_WINDOWFUNC |
| 88628 | | - if( pOp->p5 ) sqlite3BtreeSkipNext(pCrsr); |
| 88629 | | -#endif |
| 88630 | 88722 | pC->deferredMoveto = 0; |
| 88631 | 88723 | pC->cacheStatus = CACHE_STALE; |
| 88632 | 88724 | } |
| 88633 | 88725 | if( rc ) goto abort_due_to_error; |
| 88634 | 88726 | pC->nullRow = (u8)res; |
| | @@ -90006,10 +90098,11 @@ |
| 90006 | 90098 | assert( pOp->p3==0 || pOp->opcode==OP_AggValue ); |
| 90007 | 90099 | pMem = &aMem[pOp->p1]; |
| 90008 | 90100 | assert( (pMem->flags & ~(MEM_Null|MEM_Agg))==0 ); |
| 90009 | 90101 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 90010 | 90102 | if( pOp->p3 ){ |
| 90103 | + memAboutToChange(p, &aMem[pOp->p3]); |
| 90011 | 90104 | rc = sqlite3VdbeMemAggValue(pMem, &aMem[pOp->p3], pOp->p4.pFunc); |
| 90012 | 90105 | pMem = &aMem[pOp->p3]; |
| 90013 | 90106 | }else |
| 90014 | 90107 | #endif |
| 90015 | 90108 | { |
| | @@ -95424,10 +95517,14 @@ |
| 95424 | 95517 | assert( pExpr->x.pSelect==0 ); |
| 95425 | 95518 | pOrig = pEList->a[j].pExpr; |
| 95426 | 95519 | if( (pNC->ncFlags&NC_AllowAgg)==0 && ExprHasProperty(pOrig, EP_Agg) ){ |
| 95427 | 95520 | sqlite3ErrorMsg(pParse, "misuse of aliased aggregate %s", zAs); |
| 95428 | 95521 | return WRC_Abort; |
| 95522 | + } |
| 95523 | + if( (pNC->ncFlags&NC_AllowWin)==0 && ExprHasProperty(pOrig, EP_Win) ){ |
| 95524 | + sqlite3ErrorMsg(pParse, "misuse of aliased window function %s",zAs); |
| 95525 | + return WRC_Abort; |
| 95429 | 95526 | } |
| 95430 | 95527 | if( sqlite3ExprVectorSize(pOrig)!=1 ){ |
| 95431 | 95528 | sqlite3ErrorMsg(pParse, "row value misused"); |
| 95432 | 95529 | return WRC_Abort; |
| 95433 | 95530 | } |
| | @@ -95715,10 +95812,11 @@ |
| 95715 | 95812 | int is_agg = 0; /* True if is an aggregate function */ |
| 95716 | 95813 | int nId; /* Number of characters in function name */ |
| 95717 | 95814 | const char *zId; /* The function name. */ |
| 95718 | 95815 | FuncDef *pDef; /* Information about the function */ |
| 95719 | 95816 | u8 enc = ENC(pParse->db); /* The database encoding */ |
| 95817 | + int savedAllowFlags = (pNC->ncFlags & (NC_AllowAgg | NC_AllowWin)); |
| 95720 | 95818 | |
| 95721 | 95819 | assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); |
| 95722 | 95820 | zId = pExpr->u.zToken; |
| 95723 | 95821 | nId = sqlite3Strlen30(zId); |
| 95724 | 95822 | pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0); |
| | @@ -95836,12 +95934,15 @@ |
| 95836 | 95934 | sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()", |
| 95837 | 95935 | nId, zId); |
| 95838 | 95936 | pNC->nErr++; |
| 95839 | 95937 | } |
| 95840 | 95938 | if( is_agg ){ |
| 95939 | + /* Window functions may not be arguments of aggregate functions. |
| 95940 | + ** Or arguments of other window functions. But aggregate functions |
| 95941 | + ** may be arguments for window functions. */ |
| 95841 | 95942 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 95842 | | - pNC->ncFlags &= ~(pExpr->y.pWin ? NC_AllowWin : NC_AllowAgg); |
| 95943 | + pNC->ncFlags &= ~(NC_AllowWin | (!pExpr->y.pWin ? NC_AllowAgg : 0)); |
| 95843 | 95944 | #else |
| 95844 | 95945 | pNC->ncFlags &= ~NC_AllowAgg; |
| 95845 | 95946 | #endif |
| 95846 | 95947 | } |
| 95847 | 95948 | } |
| | @@ -95858,11 +95959,11 @@ |
| 95858 | 95959 | || 0==sqlite3WindowCompare(pParse, pSel->pWin, pExpr->y.pWin) |
| 95859 | 95960 | ){ |
| 95860 | 95961 | pExpr->y.pWin->pNextWin = pSel->pWin; |
| 95861 | 95962 | pSel->pWin = pExpr->y.pWin; |
| 95862 | 95963 | } |
| 95863 | | - pNC->ncFlags |= NC_AllowWin; |
| 95964 | + pNC->ncFlags |= NC_HasWin; |
| 95864 | 95965 | }else |
| 95865 | 95966 | #endif /* SQLITE_OMIT_WINDOWFUNC */ |
| 95866 | 95967 | { |
| 95867 | 95968 | NameContext *pNC2 = pNC; |
| 95868 | 95969 | pExpr->op = TK_AGG_FUNCTION; |
| | @@ -95876,12 +95977,12 @@ |
| 95876 | 95977 | assert( SQLITE_FUNC_MINMAX==NC_MinMaxAgg ); |
| 95877 | 95978 | testcase( (pDef->funcFlags & SQLITE_FUNC_MINMAX)!=0 ); |
| 95878 | 95979 | pNC2->ncFlags |= NC_HasAgg | (pDef->funcFlags & SQLITE_FUNC_MINMAX); |
| 95879 | 95980 | |
| 95880 | 95981 | } |
| 95881 | | - pNC->ncFlags |= NC_AllowAgg; |
| 95882 | 95982 | } |
| 95983 | + pNC->ncFlags |= savedAllowFlags; |
| 95883 | 95984 | } |
| 95884 | 95985 | /* FIX ME: Compute pExpr->affinity based on the expected return |
| 95885 | 95986 | ** type of the function |
| 95886 | 95987 | */ |
| 95887 | 95988 | return WRC_Prune; |
| | @@ -96414,11 +96515,11 @@ |
| 96414 | 96515 | |
| 96415 | 96516 | /* Recursively resolve names in all subqueries |
| 96416 | 96517 | */ |
| 96417 | 96518 | for(i=0; i<p->pSrc->nSrc; i++){ |
| 96418 | 96519 | struct SrcList_item *pItem = &p->pSrc->a[i]; |
| 96419 | | - if( pItem->pSelect ){ |
| 96520 | + if( pItem->pSelect && (pItem->pSelect->selFlags & SF_Resolved)==0 ){ |
| 96420 | 96521 | NameContext *pNC; /* Used to iterate name contexts */ |
| 96421 | 96522 | int nRef = 0; /* Refcount for pOuterNC and outer contexts */ |
| 96422 | 96523 | const char *zSavedContext = pParse->zAuthContext; |
| 96423 | 96524 | |
| 96424 | 96525 | /* Count the total number of references to pOuterNC and all of its |
| | @@ -96638,12 +96739,12 @@ |
| 96638 | 96739 | ){ |
| 96639 | 96740 | u16 savedHasAgg; |
| 96640 | 96741 | Walker w; |
| 96641 | 96742 | |
| 96642 | 96743 | if( pExpr==0 ) return SQLITE_OK; |
| 96643 | | - savedHasAgg = pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg); |
| 96644 | | - pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg); |
| 96744 | + savedHasAgg = pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg|NC_HasWin); |
| 96745 | + pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg|NC_HasWin); |
| 96645 | 96746 | w.pParse = pNC->pParse; |
| 96646 | 96747 | w.xExprCallback = resolveExprStep; |
| 96647 | 96748 | w.xSelectCallback = resolveSelectStep; |
| 96648 | 96749 | w.xSelectCallback2 = 0; |
| 96649 | 96750 | w.u.pNC = pNC; |
| | @@ -96655,13 +96756,15 @@ |
| 96655 | 96756 | #endif |
| 96656 | 96757 | sqlite3WalkExpr(&w, pExpr); |
| 96657 | 96758 | #if SQLITE_MAX_EXPR_DEPTH>0 |
| 96658 | 96759 | w.pParse->nHeight -= pExpr->nHeight; |
| 96659 | 96760 | #endif |
| 96660 | | - if( pNC->ncFlags & NC_HasAgg ){ |
| 96661 | | - ExprSetProperty(pExpr, EP_Agg); |
| 96662 | | - } |
| 96761 | + assert( EP_Agg==NC_HasAgg ); |
| 96762 | + assert( EP_Win==NC_HasWin ); |
| 96763 | + testcase( pNC->ncFlags & NC_HasAgg ); |
| 96764 | + testcase( pNC->ncFlags & NC_HasWin ); |
| 96765 | + ExprSetProperty(pExpr, pNC->ncFlags & (NC_HasAgg|NC_HasWin) ); |
| 96663 | 96766 | pNC->ncFlags |= savedHasAgg; |
| 96664 | 96767 | return pNC->nErr>0 || w.pParse->nErr>0; |
| 96665 | 96768 | } |
| 96666 | 96769 | |
| 96667 | 96770 | /* |
| | @@ -101788,10 +101891,21 @@ |
| 101788 | 101891 | ** be non-NULL, then the LEFT JOIN can be safely converted into an |
| 101789 | 101892 | ** ordinary join. |
| 101790 | 101893 | */ |
| 101791 | 101894 | SQLITE_PRIVATE int sqlite3ExprImpliesNonNullRow(Expr *p, int iTab){ |
| 101792 | 101895 | Walker w; |
| 101896 | + p = sqlite3ExprSkipCollate(p); |
| 101897 | + while( p ){ |
| 101898 | + if( p->op==TK_NOTNULL ){ |
| 101899 | + p = p->pLeft; |
| 101900 | + }else if( p->op==TK_AND ){ |
| 101901 | + if( sqlite3ExprImpliesNonNullRow(p->pLeft, iTab) ) return 1; |
| 101902 | + p = p->pRight; |
| 101903 | + }else{ |
| 101904 | + break; |
| 101905 | + } |
| 101906 | + } |
| 101793 | 101907 | w.xExprCallback = impliesNotNullRow; |
| 101794 | 101908 | w.xSelectCallback = 0; |
| 101795 | 101909 | w.xSelectCallback2 = 0; |
| 101796 | 101910 | w.eCode = 0; |
| 101797 | 101911 | w.u.iCur = iTab; |
| | @@ -106961,10 +107075,11 @@ |
| 106961 | 107075 | if( zSql==0 ){ |
| 106962 | 107076 | /* This can result either from an OOM or because the formatted string |
| 106963 | 107077 | ** exceeds SQLITE_LIMIT_LENGTH. In the latter case, we need to set |
| 106964 | 107078 | ** an error */ |
| 106965 | 107079 | if( !db->mallocFailed ) pParse->rc = SQLITE_TOOBIG; |
| 107080 | + pParse->nErr++; |
| 106966 | 107081 | return; |
| 106967 | 107082 | } |
| 106968 | 107083 | pParse->nested++; |
| 106969 | 107084 | memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ); |
| 106970 | 107085 | memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ); |
| | @@ -108101,11 +108216,12 @@ |
| 108101 | 108216 | && pCol |
| 108102 | 108217 | && sqlite3StrICmp(sqlite3ColumnType(pCol,""), "INTEGER")==0 |
| 108103 | 108218 | && sortOrder!=SQLITE_SO_DESC |
| 108104 | 108219 | ){ |
| 108105 | 108220 | if( IN_RENAME_OBJECT && pList ){ |
| 108106 | | - sqlite3RenameTokenRemap(pParse, &pTab->iPKey, pList->a[0].pExpr); |
| 108221 | + Expr *pCExpr = sqlite3ExprSkipCollate(pList->a[0].pExpr); |
| 108222 | + sqlite3RenameTokenRemap(pParse, &pTab->iPKey, pCExpr); |
| 108107 | 108223 | } |
| 108108 | 108224 | pTab->iPKey = iCol; |
| 108109 | 108225 | pTab->keyConf = (u8)onError; |
| 108110 | 108226 | assert( autoInc==0 || autoInc==1 ); |
| 108111 | 108227 | pTab->tabFlags |= autoInc*TF_Autoincrement; |
| | @@ -109850,17 +109966,17 @@ |
| 109850 | 109966 | |
| 109851 | 109967 | assert( pTab!=0 ); |
| 109852 | 109968 | assert( pParse->nErr==0 ); |
| 109853 | 109969 | if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 |
| 109854 | 109970 | && db->init.busy==0 |
| 109971 | + && pTblName!=0 |
| 109855 | 109972 | #if SQLITE_USER_AUTHENTICATION |
| 109856 | 109973 | && sqlite3UserAuthTable(pTab->zName)==0 |
| 109857 | 109974 | #endif |
| 109858 | 109975 | #ifdef SQLITE_ALLOW_SQLITE_MASTER_INDEX |
| 109859 | 109976 | && sqlite3StrICmp(&pTab->zName[7],"master")!=0 |
| 109860 | 109977 | #endif |
| 109861 | | - && sqlite3StrNICmp(&pTab->zName[7],"altertab_",9)!=0 |
| 109862 | 109978 | ){ |
| 109863 | 109979 | sqlite3ErrorMsg(pParse, "table %s may not be indexed", pTab->zName); |
| 109864 | 109980 | goto exit_create_index; |
| 109865 | 109981 | } |
| 109866 | 109982 | #ifndef SQLITE_OMIT_VIEW |
| | @@ -109960,10 +110076,11 @@ |
| 109960 | 110076 | if( pList==0 ) goto exit_create_index; |
| 109961 | 110077 | assert( pList->nExpr==1 ); |
| 109962 | 110078 | sqlite3ExprListSetSortOrder(pList, sortOrder); |
| 109963 | 110079 | }else{ |
| 109964 | 110080 | sqlite3ExprListCheckLength(pParse, pList, "index"); |
| 110081 | + if( pParse->nErr ) goto exit_create_index; |
| 109965 | 110082 | } |
| 109966 | 110083 | |
| 109967 | 110084 | /* Figure out how many bytes of space are required to store explicitly |
| 109968 | 110085 | ** specified collation sequence names. |
| 109969 | 110086 | */ |
| | @@ -109978,10 +110095,11 @@ |
| 109978 | 110095 | /* |
| 109979 | 110096 | ** Allocate the index structure. |
| 109980 | 110097 | */ |
| 109981 | 110098 | nName = sqlite3Strlen30(zName); |
| 109982 | 110099 | nExtraCol = pPk ? pPk->nKeyCol : 1; |
| 110100 | + assert( pList->nExpr + nExtraCol <= 32767 /* Fits in i16 */ ); |
| 109983 | 110101 | pIndex = sqlite3AllocateIndexObject(db, pList->nExpr + nExtraCol, |
| 109984 | 110102 | nName + nExtra + 1, &zExtra); |
| 109985 | 110103 | if( db->mallocFailed ){ |
| 109986 | 110104 | goto exit_create_index; |
| 109987 | 110105 | } |
| | @@ -119232,10 +119350,13 @@ |
| 119232 | 119350 | void (*xValue)(sqlite3_context*), |
| 119233 | 119351 | void (*xInv)(sqlite3_context*,int,sqlite3_value**), |
| 119234 | 119352 | void(*xDestroy)(void*)); |
| 119235 | 119353 | /* Version 3.26.0 and later */ |
| 119236 | 119354 | const char *(*normalized_sql)(sqlite3_stmt*); |
| 119355 | + /* Version 3.28.0 and later */ |
| 119356 | + int (*stmt_isexplain)(sqlite3_stmt*); |
| 119357 | + int (*value_frombind)(sqlite3_value*); |
| 119237 | 119358 | }; |
| 119238 | 119359 | |
| 119239 | 119360 | /* |
| 119240 | 119361 | ** This is the function signature used for all extension entry points. It |
| 119241 | 119362 | ** is also defined in the file "loadext.c". |
| | @@ -119521,10 +119642,13 @@ |
| 119521 | 119642 | #define sqlite3_str_value sqlite3_api->str_value |
| 119522 | 119643 | /* Version 3.25.0 and later */ |
| 119523 | 119644 | #define sqlite3_create_window_function sqlite3_api->create_window_function |
| 119524 | 119645 | /* Version 3.26.0 and later */ |
| 119525 | 119646 | #define sqlite3_normalized_sql sqlite3_api->normalized_sql |
| 119647 | +/* Version 3.28.0 and later */ |
| 119648 | +#define sqlite3_stmt_isexplain sqlite3_api->isexplain |
| 119649 | +#define sqlite3_value_frombind sqlite3_api->frombind |
| 119526 | 119650 | #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ |
| 119527 | 119651 | |
| 119528 | 119652 | #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) |
| 119529 | 119653 | /* This case when the file really is being compiled as a loadable |
| 119530 | 119654 | ** extension */ |
| | @@ -133859,19 +133983,20 @@ |
| 133859 | 133983 | */ |
| 133860 | 133984 | SQLITE_PRIVATE int sqlite3RunVacuum( |
| 133861 | 133985 | char **pzErrMsg, /* Write error message here */ |
| 133862 | 133986 | sqlite3 *db, /* Database connection */ |
| 133863 | 133987 | int iDb, /* Which attached DB to vacuum */ |
| 133864 | | - sqlite3_value *pOut /* Write results here, if not NULL */ |
| 133988 | + sqlite3_value *pOut /* Write results here, if not NULL. VACUUM INTO */ |
| 133865 | 133989 | ){ |
| 133866 | 133990 | int rc = SQLITE_OK; /* Return code from service routines */ |
| 133867 | 133991 | Btree *pMain; /* The database being vacuumed */ |
| 133868 | 133992 | Btree *pTemp; /* The temporary database we vacuum into */ |
| 133869 | 133993 | u32 saved_mDbFlags; /* Saved value of db->mDbFlags */ |
| 133870 | 133994 | u64 saved_flags; /* Saved value of db->flags */ |
| 133871 | 133995 | int saved_nChange; /* Saved value of db->nChange */ |
| 133872 | 133996 | int saved_nTotalChange; /* Saved value of db->nTotalChange */ |
| 133997 | + u32 saved_openFlags; /* Saved value of db->openFlags */ |
| 133873 | 133998 | u8 saved_mTrace; /* Saved trace settings */ |
| 133874 | 133999 | Db *pDb = 0; /* Database to detach at end of vacuum */ |
| 133875 | 134000 | int isMemDb; /* True if vacuuming a :memory: database */ |
| 133876 | 134001 | int nRes; /* Bytes of reserved space at the end of each page */ |
| 133877 | 134002 | int nDb; /* Number of attached databases */ |
| | @@ -133884,16 +134009,19 @@ |
| 133884 | 134009 | } |
| 133885 | 134010 | if( db->nVdbeActive>1 ){ |
| 133886 | 134011 | sqlite3SetString(pzErrMsg, db,"cannot VACUUM - SQL statements in progress"); |
| 133887 | 134012 | return SQLITE_ERROR; |
| 133888 | 134013 | } |
| 134014 | + saved_openFlags = db->openFlags; |
| 133889 | 134015 | if( pOut ){ |
| 133890 | 134016 | if( sqlite3_value_type(pOut)!=SQLITE_TEXT ){ |
| 133891 | 134017 | sqlite3SetString(pzErrMsg, db, "non-text filename"); |
| 133892 | 134018 | return SQLITE_ERROR; |
| 133893 | 134019 | } |
| 133894 | 134020 | zOut = (const char*)sqlite3_value_text(pOut); |
| 134021 | + db->openFlags &= ~SQLITE_OPEN_READONLY; |
| 134022 | + db->openFlags |= SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE; |
| 133895 | 134023 | }else{ |
| 133896 | 134024 | zOut = ""; |
| 133897 | 134025 | } |
| 133898 | 134026 | |
| 133899 | 134027 | /* Save the current value of the database flags so that it can be |
| | @@ -133928,10 +134056,11 @@ |
| 133928 | 134056 | ** time to parse and run the PRAGMA to turn journalling off than it does |
| 133929 | 134057 | ** to write the journal header file. |
| 133930 | 134058 | */ |
| 133931 | 134059 | nDb = db->nDb; |
| 133932 | 134060 | rc = execSqlF(db, pzErrMsg, "ATTACH %Q AS vacuum_db", zOut); |
| 134061 | + db->openFlags = saved_openFlags; |
| 133933 | 134062 | if( rc!=SQLITE_OK ) goto end_of_vacuum; |
| 133934 | 134063 | assert( (db->nDb-1)==nDb ); |
| 133935 | 134064 | pDb = &db->aDb[nDb]; |
| 133936 | 134065 | assert( strcmp(pDb->zDbSName,"vacuum_db")==0 ); |
| 133937 | 134066 | pTemp = pDb->pBt; |
| | @@ -138164,12 +138293,13 @@ |
| 138164 | 138293 | continue; |
| 138165 | 138294 | #else |
| 138166 | 138295 | u32 x = pLevel->iLikeRepCntr; |
| 138167 | 138296 | if( x>0 ){ |
| 138168 | 138297 | skipLikeAddr = sqlite3VdbeAddOp1(v, (x&1)?OP_IfNot:OP_If,(int)(x>>1)); |
| 138298 | + VdbeCoverageIf(v, (x&1)==1); |
| 138299 | + VdbeCoverageIf(v, (x&1)==0); |
| 138169 | 138300 | } |
| 138170 | | - VdbeCoverage(v); |
| 138171 | 138301 | #endif |
| 138172 | 138302 | } |
| 138173 | 138303 | #ifdef WHERETRACE_ENABLED /* 0xffff */ |
| 138174 | 138304 | if( sqlite3WhereTrace ){ |
| 138175 | 138305 | VdbeNoopComment((v, "WhereTerm[%d] (%p) priority=%d", |
| | @@ -143189,15 +143319,15 @@ |
| 143189 | 143319 | WHERETRACE(0x800, ("BEGIN %s.addVirtual()\n", pSrc->pTab->zName)); |
| 143190 | 143320 | WHERETRACE(0x40, (" VirtualOne: all usable\n")); |
| 143191 | 143321 | rc = whereLoopAddVirtualOne(pBuilder, mPrereq, ALLBITS, 0, p, mNoOmit, &bIn); |
| 143192 | 143322 | |
| 143193 | 143323 | /* If the call to xBestIndex() with all terms enabled produced a plan |
| 143194 | | - ** that does not require any source tables (IOW: a plan with mBest==0), |
| 143195 | | - ** then there is no point in making any further calls to xBestIndex() |
| 143196 | | - ** since they will all return the same result (if the xBestIndex() |
| 143197 | | - ** implementation is sane). */ |
| 143198 | | - if( rc==SQLITE_OK && (mBest = (pNew->prereq & ~mPrereq))!=0 ){ |
| 143324 | + ** that does not require any source tables (IOW: a plan with mBest==0) |
| 143325 | + ** and does not use an IN(...) operator, then there is no point in making |
| 143326 | + ** any further calls to xBestIndex() since they will all return the same |
| 143327 | + ** result (if the xBestIndex() implementation is sane). */ |
| 143328 | + if( rc==SQLITE_OK && ((mBest = (pNew->prereq & ~mPrereq))!=0 || bIn) ){ |
| 143199 | 143329 | int seenZero = 0; /* True if a plan with no prereqs seen */ |
| 143200 | 143330 | int seenZeroNoIN = 0; /* Plan with no prereqs and no IN(...) seen */ |
| 143201 | 143331 | Bitmask mPrev = 0; |
| 143202 | 143332 | Bitmask mBestNoIn = 0; |
| 143203 | 143333 | |
| | @@ -145426,10 +145556,100 @@ |
| 145426 | 145556 | } |
| 145427 | 145557 | sqlite3_result_int64(pCtx, p->nValue); |
| 145428 | 145558 | } |
| 145429 | 145559 | } |
| 145430 | 145560 | |
| 145561 | +/* |
| 145562 | +** Implementation of built-in window function nth_value(). This |
| 145563 | +** implementation is used in "slow mode" only - when the EXCLUDE clause |
| 145564 | +** is not set to the default value "NO OTHERS". |
| 145565 | +*/ |
| 145566 | +struct NthValueCtx { |
| 145567 | + i64 nStep; |
| 145568 | + sqlite3_value *pValue; |
| 145569 | +}; |
| 145570 | +static void nth_valueStepFunc( |
| 145571 | + sqlite3_context *pCtx, |
| 145572 | + int nArg, |
| 145573 | + sqlite3_value **apArg |
| 145574 | +){ |
| 145575 | + struct NthValueCtx *p; |
| 145576 | + p = (struct NthValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); |
| 145577 | + if( p ){ |
| 145578 | + i64 iVal; |
| 145579 | + switch( sqlite3_value_numeric_type(apArg[1]) ){ |
| 145580 | + case SQLITE_INTEGER: |
| 145581 | + iVal = sqlite3_value_int64(apArg[1]); |
| 145582 | + break; |
| 145583 | + case SQLITE_FLOAT: { |
| 145584 | + double fVal = sqlite3_value_double(apArg[1]); |
| 145585 | + if( ((i64)fVal)!=fVal ) goto error_out; |
| 145586 | + iVal = (i64)fVal; |
| 145587 | + break; |
| 145588 | + } |
| 145589 | + default: |
| 145590 | + goto error_out; |
| 145591 | + } |
| 145592 | + if( iVal<=0 ) goto error_out; |
| 145593 | + |
| 145594 | + p->nStep++; |
| 145595 | + if( iVal==p->nStep ){ |
| 145596 | + p->pValue = sqlite3_value_dup(apArg[0]); |
| 145597 | + if( !p->pValue ){ |
| 145598 | + sqlite3_result_error_nomem(pCtx); |
| 145599 | + } |
| 145600 | + } |
| 145601 | + } |
| 145602 | + UNUSED_PARAMETER(nArg); |
| 145603 | + UNUSED_PARAMETER(apArg); |
| 145604 | + return; |
| 145605 | + |
| 145606 | + error_out: |
| 145607 | + sqlite3_result_error( |
| 145608 | + pCtx, "second argument to nth_value must be a positive integer", -1 |
| 145609 | + ); |
| 145610 | +} |
| 145611 | +static void nth_valueFinalizeFunc(sqlite3_context *pCtx){ |
| 145612 | + struct NthValueCtx *p; |
| 145613 | + p = (struct NthValueCtx*)sqlite3_aggregate_context(pCtx, 0); |
| 145614 | + if( p && p->pValue ){ |
| 145615 | + sqlite3_result_value(pCtx, p->pValue); |
| 145616 | + sqlite3_value_free(p->pValue); |
| 145617 | + p->pValue = 0; |
| 145618 | + } |
| 145619 | +} |
| 145620 | +#define nth_valueInvFunc noopStepFunc |
| 145621 | +#define nth_valueValueFunc noopValueFunc |
| 145622 | + |
| 145623 | +static void first_valueStepFunc( |
| 145624 | + sqlite3_context *pCtx, |
| 145625 | + int nArg, |
| 145626 | + sqlite3_value **apArg |
| 145627 | +){ |
| 145628 | + struct NthValueCtx *p; |
| 145629 | + p = (struct NthValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); |
| 145630 | + if( p && p->pValue==0 ){ |
| 145631 | + p->pValue = sqlite3_value_dup(apArg[0]); |
| 145632 | + if( !p->pValue ){ |
| 145633 | + sqlite3_result_error_nomem(pCtx); |
| 145634 | + } |
| 145635 | + } |
| 145636 | + UNUSED_PARAMETER(nArg); |
| 145637 | + UNUSED_PARAMETER(apArg); |
| 145638 | +} |
| 145639 | +static void first_valueFinalizeFunc(sqlite3_context *pCtx){ |
| 145640 | + struct NthValueCtx *p; |
| 145641 | + p = (struct NthValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); |
| 145642 | + if( p && p->pValue ){ |
| 145643 | + sqlite3_result_value(pCtx, p->pValue); |
| 145644 | + sqlite3_value_free(p->pValue); |
| 145645 | + p->pValue = 0; |
| 145646 | + } |
| 145647 | +} |
| 145648 | +#define first_valueInvFunc noopStepFunc |
| 145649 | +#define first_valueValueFunc noopValueFunc |
| 145650 | + |
| 145431 | 145651 | /* |
| 145432 | 145652 | ** Implementation of built-in window function rank(). Assumes that |
| 145433 | 145653 | ** the window frame has been set to: |
| 145434 | 145654 | ** |
| 145435 | 145655 | ** RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW |
| | @@ -145461,75 +145681,90 @@ |
| 145461 | 145681 | |
| 145462 | 145682 | /* |
| 145463 | 145683 | ** Implementation of built-in window function percent_rank(). Assumes that |
| 145464 | 145684 | ** the window frame has been set to: |
| 145465 | 145685 | ** |
| 145466 | | -** RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW |
| 145686 | +** GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING |
| 145467 | 145687 | */ |
| 145468 | 145688 | static void percent_rankStepFunc( |
| 145469 | 145689 | sqlite3_context *pCtx, |
| 145470 | 145690 | int nArg, |
| 145471 | 145691 | sqlite3_value **apArg |
| 145472 | 145692 | ){ |
| 145473 | 145693 | struct CallCount *p; |
| 145474 | | - UNUSED_PARAMETER(nArg); assert( nArg==1 ); |
| 145475 | | - |
| 145694 | + UNUSED_PARAMETER(nArg); assert( nArg==0 ); |
| 145695 | + UNUSED_PARAMETER(apArg); |
| 145696 | + p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); |
| 145697 | + if( p ){ |
| 145698 | + p->nTotal++; |
| 145699 | + } |
| 145700 | +} |
| 145701 | +static void percent_rankInvFunc( |
| 145702 | + sqlite3_context *pCtx, |
| 145703 | + int nArg, |
| 145704 | + sqlite3_value **apArg |
| 145705 | +){ |
| 145706 | + struct CallCount *p; |
| 145707 | + UNUSED_PARAMETER(nArg); assert( nArg==0 ); |
| 145708 | + UNUSED_PARAMETER(apArg); |
| 145476 | 145709 | p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); |
| 145477 | | - if( p ){ |
| 145478 | | - if( p->nTotal==0 ){ |
| 145479 | | - p->nTotal = sqlite3_value_int64(apArg[0]); |
| 145480 | | - } |
| 145481 | | - p->nStep++; |
| 145482 | | - if( p->nValue==0 ){ |
| 145483 | | - p->nValue = p->nStep; |
| 145484 | | - } |
| 145485 | | - } |
| 145710 | + p->nStep++; |
| 145486 | 145711 | } |
| 145487 | 145712 | static void percent_rankValueFunc(sqlite3_context *pCtx){ |
| 145488 | 145713 | struct CallCount *p; |
| 145489 | 145714 | p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); |
| 145490 | 145715 | if( p ){ |
| 145716 | + p->nValue = p->nStep; |
| 145491 | 145717 | if( p->nTotal>1 ){ |
| 145492 | | - double r = (double)(p->nValue-1) / (double)(p->nTotal-1); |
| 145718 | + double r = (double)p->nValue / (double)(p->nTotal-1); |
| 145493 | 145719 | sqlite3_result_double(pCtx, r); |
| 145494 | 145720 | }else{ |
| 145495 | 145721 | sqlite3_result_double(pCtx, 0.0); |
| 145496 | 145722 | } |
| 145497 | | - p->nValue = 0; |
| 145498 | 145723 | } |
| 145499 | 145724 | } |
| 145725 | +#define percent_rankFinalizeFunc percent_rankValueFunc |
| 145500 | 145726 | |
| 145501 | 145727 | /* |
| 145502 | 145728 | ** Implementation of built-in window function cume_dist(). Assumes that |
| 145503 | 145729 | ** the window frame has been set to: |
| 145504 | 145730 | ** |
| 145505 | | -** RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW |
| 145731 | +** GROUPS BETWEEN 1 FOLLOWING AND UNBOUNDED FOLLOWING |
| 145506 | 145732 | */ |
| 145507 | 145733 | static void cume_distStepFunc( |
| 145508 | 145734 | sqlite3_context *pCtx, |
| 145509 | 145735 | int nArg, |
| 145510 | 145736 | sqlite3_value **apArg |
| 145511 | 145737 | ){ |
| 145512 | 145738 | struct CallCount *p; |
| 145513 | | - assert( nArg==1 ); UNUSED_PARAMETER(nArg); |
| 145514 | | - |
| 145739 | + UNUSED_PARAMETER(nArg); assert( nArg==0 ); |
| 145740 | + UNUSED_PARAMETER(apArg); |
| 145741 | + p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); |
| 145742 | + if( p ){ |
| 145743 | + p->nTotal++; |
| 145744 | + } |
| 145745 | +} |
| 145746 | +static void cume_distInvFunc( |
| 145747 | + sqlite3_context *pCtx, |
| 145748 | + int nArg, |
| 145749 | + sqlite3_value **apArg |
| 145750 | +){ |
| 145751 | + struct CallCount *p; |
| 145752 | + UNUSED_PARAMETER(nArg); assert( nArg==0 ); |
| 145753 | + UNUSED_PARAMETER(apArg); |
| 145515 | 145754 | p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); |
| 145516 | | - if( p ){ |
| 145517 | | - if( p->nTotal==0 ){ |
| 145518 | | - p->nTotal = sqlite3_value_int64(apArg[0]); |
| 145519 | | - } |
| 145520 | | - p->nStep++; |
| 145521 | | - } |
| 145755 | + p->nStep++; |
| 145522 | 145756 | } |
| 145523 | 145757 | static void cume_distValueFunc(sqlite3_context *pCtx){ |
| 145524 | 145758 | struct CallCount *p; |
| 145525 | | - p = (struct CallCount*)sqlite3_aggregate_context(pCtx, sizeof(*p)); |
| 145526 | | - if( p && p->nTotal ){ |
| 145759 | + p = (struct CallCount*)sqlite3_aggregate_context(pCtx, 0); |
| 145760 | + if( p ){ |
| 145527 | 145761 | double r = (double)(p->nStep) / (double)(p->nTotal); |
| 145528 | 145762 | sqlite3_result_double(pCtx, r); |
| 145529 | 145763 | } |
| 145530 | 145764 | } |
| 145765 | +#define cume_distFinalizeFunc cume_distValueFunc |
| 145531 | 145766 | |
| 145532 | 145767 | /* |
| 145533 | 145768 | ** Context object for ntile() window function. |
| 145534 | 145769 | */ |
| 145535 | 145770 | struct NtileCtx { |
| | @@ -145540,44 +145775,54 @@ |
| 145540 | 145775 | |
| 145541 | 145776 | /* |
| 145542 | 145777 | ** Implementation of ntile(). This assumes that the window frame has |
| 145543 | 145778 | ** been coerced to: |
| 145544 | 145779 | ** |
| 145545 | | -** ROWS UNBOUNDED PRECEDING AND CURRENT ROW |
| 145780 | +** ROWS CURRENT ROW AND UNBOUNDED FOLLOWING |
| 145546 | 145781 | */ |
| 145547 | 145782 | static void ntileStepFunc( |
| 145548 | 145783 | sqlite3_context *pCtx, |
| 145549 | 145784 | int nArg, |
| 145550 | 145785 | sqlite3_value **apArg |
| 145551 | 145786 | ){ |
| 145552 | 145787 | struct NtileCtx *p; |
| 145553 | | - assert( nArg==2 ); UNUSED_PARAMETER(nArg); |
| 145788 | + assert( nArg==1 ); UNUSED_PARAMETER(nArg); |
| 145554 | 145789 | p = (struct NtileCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); |
| 145555 | 145790 | if( p ){ |
| 145556 | 145791 | if( p->nTotal==0 ){ |
| 145557 | 145792 | p->nParam = sqlite3_value_int64(apArg[0]); |
| 145558 | | - p->nTotal = sqlite3_value_int64(apArg[1]); |
| 145559 | 145793 | if( p->nParam<=0 ){ |
| 145560 | 145794 | sqlite3_result_error( |
| 145561 | 145795 | pCtx, "argument of ntile must be a positive integer", -1 |
| 145562 | 145796 | ); |
| 145563 | 145797 | } |
| 145564 | 145798 | } |
| 145565 | | - p->iRow++; |
| 145799 | + p->nTotal++; |
| 145566 | 145800 | } |
| 145801 | +} |
| 145802 | +static void ntileInvFunc( |
| 145803 | + sqlite3_context *pCtx, |
| 145804 | + int nArg, |
| 145805 | + sqlite3_value **apArg |
| 145806 | +){ |
| 145807 | + struct NtileCtx *p; |
| 145808 | + assert( nArg==1 ); UNUSED_PARAMETER(nArg); |
| 145809 | + UNUSED_PARAMETER(apArg); |
| 145810 | + p = (struct NtileCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); |
| 145811 | + p->iRow++; |
| 145567 | 145812 | } |
| 145568 | 145813 | static void ntileValueFunc(sqlite3_context *pCtx){ |
| 145569 | 145814 | struct NtileCtx *p; |
| 145570 | 145815 | p = (struct NtileCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); |
| 145571 | 145816 | if( p && p->nParam>0 ){ |
| 145572 | 145817 | int nSize = (p->nTotal / p->nParam); |
| 145573 | 145818 | if( nSize==0 ){ |
| 145574 | | - sqlite3_result_int64(pCtx, p->iRow); |
| 145819 | + sqlite3_result_int64(pCtx, p->iRow+1); |
| 145575 | 145820 | }else{ |
| 145576 | 145821 | i64 nLarge = p->nTotal - p->nParam*nSize; |
| 145577 | 145822 | i64 iSmall = nLarge*(nSize+1); |
| 145578 | | - i64 iRow = p->iRow-1; |
| 145823 | + i64 iRow = p->iRow; |
| 145579 | 145824 | |
| 145580 | 145825 | assert( (nLarge*(nSize+1) + (p->nParam-nLarge)*nSize)==p->nTotal ); |
| 145581 | 145826 | |
| 145582 | 145827 | if( iRow<iSmall ){ |
| 145583 | 145828 | sqlite3_result_int64(pCtx, 1 + iRow/(nSize+1)); |
| | @@ -145585,10 +145830,11 @@ |
| 145585 | 145830 | sqlite3_result_int64(pCtx, 1 + nLarge + (iRow-iSmall)/nSize); |
| 145586 | 145831 | } |
| 145587 | 145832 | } |
| 145588 | 145833 | } |
| 145589 | 145834 | } |
| 145835 | +#define ntileFinalizeFunc ntileValueFunc |
| 145590 | 145836 | |
| 145591 | 145837 | /* |
| 145592 | 145838 | ** Context object for last_value() window function. |
| 145593 | 145839 | */ |
| 145594 | 145840 | struct LastValueCtx { |
| | @@ -145634,11 +145880,11 @@ |
| 145634 | 145880 | } |
| 145635 | 145881 | } |
| 145636 | 145882 | } |
| 145637 | 145883 | static void last_valueValueFunc(sqlite3_context *pCtx){ |
| 145638 | 145884 | struct LastValueCtx *p; |
| 145639 | | - p = (struct LastValueCtx*)sqlite3_aggregate_context(pCtx, sizeof(*p)); |
| 145885 | + p = (struct LastValueCtx*)sqlite3_aggregate_context(pCtx, 0); |
| 145640 | 145886 | if( p && p->pVal ){ |
| 145641 | 145887 | sqlite3_result_value(pCtx, p->pVal); |
| 145642 | 145888 | } |
| 145643 | 145889 | } |
| 145644 | 145890 | static void last_valueFinalizeFunc(sqlite3_context *pCtx){ |
| | @@ -145724,25 +145970,36 @@ |
| 145724 | 145970 | SQLITE_PRIVATE void sqlite3WindowFunctions(void){ |
| 145725 | 145971 | static FuncDef aWindowFuncs[] = { |
| 145726 | 145972 | WINDOWFUNCX(row_number, 0, 0), |
| 145727 | 145973 | WINDOWFUNCX(dense_rank, 0, 0), |
| 145728 | 145974 | WINDOWFUNCX(rank, 0, 0), |
| 145729 | | - WINDOWFUNCX(percent_rank, 0, SQLITE_FUNC_WINDOW_SIZE), |
| 145730 | | - WINDOWFUNCX(cume_dist, 0, SQLITE_FUNC_WINDOW_SIZE), |
| 145731 | | - WINDOWFUNCX(ntile, 1, SQLITE_FUNC_WINDOW_SIZE), |
| 145975 | + WINDOWFUNCALL(percent_rank, 0, 0), |
| 145976 | + WINDOWFUNCALL(cume_dist, 0, 0), |
| 145977 | + WINDOWFUNCALL(ntile, 1, 0), |
| 145732 | 145978 | WINDOWFUNCALL(last_value, 1, 0), |
| 145733 | | - WINDOWFUNCNOOP(nth_value, 2, 0), |
| 145734 | | - WINDOWFUNCNOOP(first_value, 1, 0), |
| 145979 | + WINDOWFUNCALL(nth_value, 2, 0), |
| 145980 | + WINDOWFUNCALL(first_value, 1, 0), |
| 145735 | 145981 | WINDOWFUNCNOOP(lead, 1, 0), |
| 145736 | 145982 | WINDOWFUNCNOOP(lead, 2, 0), |
| 145737 | 145983 | WINDOWFUNCNOOP(lead, 3, 0), |
| 145738 | 145984 | WINDOWFUNCNOOP(lag, 1, 0), |
| 145739 | 145985 | WINDOWFUNCNOOP(lag, 2, 0), |
| 145740 | 145986 | WINDOWFUNCNOOP(lag, 3, 0), |
| 145741 | 145987 | }; |
| 145742 | 145988 | sqlite3InsertBuiltinFuncs(aWindowFuncs, ArraySize(aWindowFuncs)); |
| 145743 | 145989 | } |
| 145990 | + |
| 145991 | +static Window *windowFind(Parse *pParse, Window *pList, const char *zName){ |
| 145992 | + Window *p; |
| 145993 | + for(p=pList; p; p=p->pNextWin){ |
| 145994 | + if( sqlite3StrICmp(p->zName, zName)==0 ) break; |
| 145995 | + } |
| 145996 | + if( p==0 ){ |
| 145997 | + sqlite3ErrorMsg(pParse, "no such window: %s", zName); |
| 145998 | + } |
| 145999 | + return p; |
| 146000 | +} |
| 145744 | 146001 | |
| 145745 | 146002 | /* |
| 145746 | 146003 | ** This function is called immediately after resolving the function name |
| 145747 | 146004 | ** for a window function within a SELECT statement. Argument pList is a |
| 145748 | 146005 | ** linked list of WINDOW definitions for the current SELECT statement. |
| | @@ -145763,52 +146020,70 @@ |
| 145763 | 146020 | Parse *pParse, |
| 145764 | 146021 | Window *pList, /* List of named windows for this SELECT */ |
| 145765 | 146022 | Window *pWin, /* Window frame to update */ |
| 145766 | 146023 | FuncDef *pFunc /* Window function definition */ |
| 145767 | 146024 | ){ |
| 145768 | | - if( pWin->zName && pWin->eType==0 ){ |
| 145769 | | - Window *p; |
| 145770 | | - for(p=pList; p; p=p->pNextWin){ |
| 145771 | | - if( sqlite3StrICmp(p->zName, pWin->zName)==0 ) break; |
| 145772 | | - } |
| 145773 | | - if( p==0 ){ |
| 145774 | | - sqlite3ErrorMsg(pParse, "no such window: %s", pWin->zName); |
| 145775 | | - return; |
| 145776 | | - } |
| 146025 | + if( pWin->zName && pWin->eFrmType==0 ){ |
| 146026 | + Window *p = windowFind(pParse, pList, pWin->zName); |
| 146027 | + if( p==0 ) return; |
| 145777 | 146028 | pWin->pPartition = sqlite3ExprListDup(pParse->db, p->pPartition, 0); |
| 145778 | 146029 | pWin->pOrderBy = sqlite3ExprListDup(pParse->db, p->pOrderBy, 0); |
| 145779 | 146030 | pWin->pStart = sqlite3ExprDup(pParse->db, p->pStart, 0); |
| 145780 | 146031 | pWin->pEnd = sqlite3ExprDup(pParse->db, p->pEnd, 0); |
| 145781 | 146032 | pWin->eStart = p->eStart; |
| 145782 | 146033 | pWin->eEnd = p->eEnd; |
| 145783 | | - pWin->eType = p->eType; |
| 146034 | + pWin->eFrmType = p->eFrmType; |
| 146035 | + pWin->eExclude = p->eExclude; |
| 146036 | + }else{ |
| 146037 | + sqlite3WindowChain(pParse, pWin, pList); |
| 145784 | 146038 | } |
| 146039 | + if( (pWin->eFrmType==TK_RANGE) |
| 146040 | + && (pWin->pStart || pWin->pEnd) |
| 146041 | + && (pWin->pOrderBy==0 || pWin->pOrderBy->nExpr!=1) |
| 146042 | + ){ |
| 146043 | + sqlite3ErrorMsg(pParse, |
| 146044 | + "RANGE with offset PRECEDING/FOLLOWING requires one ORDER BY expression" |
| 146045 | + ); |
| 146046 | + }else |
| 145785 | 146047 | if( pFunc->funcFlags & SQLITE_FUNC_WINDOW ){ |
| 145786 | 146048 | sqlite3 *db = pParse->db; |
| 145787 | 146049 | if( pWin->pFilter ){ |
| 145788 | 146050 | sqlite3ErrorMsg(pParse, |
| 145789 | 146051 | "FILTER clause may only be used with aggregate window functions" |
| 145790 | 146052 | ); |
| 145791 | | - }else |
| 145792 | | - if( pFunc->zName==row_numberName || pFunc->zName==ntileName ){ |
| 145793 | | - sqlite3ExprDelete(db, pWin->pStart); |
| 145794 | | - sqlite3ExprDelete(db, pWin->pEnd); |
| 145795 | | - pWin->pStart = pWin->pEnd = 0; |
| 145796 | | - pWin->eType = TK_ROWS; |
| 145797 | | - pWin->eStart = TK_UNBOUNDED; |
| 145798 | | - pWin->eEnd = TK_CURRENT; |
| 145799 | | - }else |
| 145800 | | - |
| 145801 | | - if( pFunc->zName==dense_rankName || pFunc->zName==rankName |
| 145802 | | - || pFunc->zName==percent_rankName || pFunc->zName==cume_distName |
| 145803 | | - ){ |
| 145804 | | - sqlite3ExprDelete(db, pWin->pStart); |
| 145805 | | - sqlite3ExprDelete(db, pWin->pEnd); |
| 145806 | | - pWin->pStart = pWin->pEnd = 0; |
| 145807 | | - pWin->eType = TK_RANGE; |
| 145808 | | - pWin->eStart = TK_UNBOUNDED; |
| 145809 | | - pWin->eEnd = TK_CURRENT; |
| 146053 | + }else{ |
| 146054 | + struct WindowUpdate { |
| 146055 | + const char *zFunc; |
| 146056 | + int eFrmType; |
| 146057 | + int eStart; |
| 146058 | + int eEnd; |
| 146059 | + } aUp[] = { |
| 146060 | + { row_numberName, TK_ROWS, TK_UNBOUNDED, TK_CURRENT }, |
| 146061 | + { dense_rankName, TK_RANGE, TK_UNBOUNDED, TK_CURRENT }, |
| 146062 | + { rankName, TK_RANGE, TK_UNBOUNDED, TK_CURRENT }, |
| 146063 | + { percent_rankName, TK_GROUPS, TK_CURRENT, TK_UNBOUNDED }, |
| 146064 | + { cume_distName, TK_GROUPS, TK_FOLLOWING, TK_UNBOUNDED }, |
| 146065 | + { ntileName, TK_ROWS, TK_CURRENT, TK_UNBOUNDED }, |
| 146066 | + { leadName, TK_ROWS, TK_UNBOUNDED, TK_UNBOUNDED }, |
| 146067 | + { lagName, TK_ROWS, TK_UNBOUNDED, TK_CURRENT }, |
| 146068 | + }; |
| 146069 | + int i; |
| 146070 | + for(i=0; i<ArraySize(aUp); i++){ |
| 146071 | + if( pFunc->zName==aUp[i].zFunc ){ |
| 146072 | + sqlite3ExprDelete(db, pWin->pStart); |
| 146073 | + sqlite3ExprDelete(db, pWin->pEnd); |
| 146074 | + pWin->pEnd = pWin->pStart = 0; |
| 146075 | + pWin->eFrmType = aUp[i].eFrmType; |
| 146076 | + pWin->eStart = aUp[i].eStart; |
| 146077 | + pWin->eEnd = aUp[i].eEnd; |
| 146078 | + pWin->eExclude = 0; |
| 146079 | + if( pWin->eStart==TK_FOLLOWING ){ |
| 146080 | + pWin->pStart = sqlite3Expr(db, TK_INTEGER, "1"); |
| 146081 | + } |
| 146082 | + break; |
| 146083 | + } |
| 146084 | + } |
| 145810 | 146085 | } |
| 145811 | 146086 | } |
| 145812 | 146087 | pWin->pFunc = pFunc; |
| 145813 | 146088 | } |
| 145814 | 146089 | |
| | @@ -146009,10 +146284,11 @@ |
| 146009 | 146284 | |
| 146010 | 146285 | /* Assign a cursor number for the ephemeral table used to buffer rows. |
| 146011 | 146286 | ** The OpenEphemeral instruction is coded later, after it is known how |
| 146012 | 146287 | ** many columns the table will have. */ |
| 146013 | 146288 | pMWin->iEphCsr = pParse->nTab++; |
| 146289 | + pParse->nTab += 3; |
| 146014 | 146290 | |
| 146015 | 146291 | selectWindowRewriteEList(pParse, pMWin, pSrc, p->pEList, &pSublist); |
| 146016 | 146292 | selectWindowRewriteEList(pParse, pMWin, pSrc, p->pOrderBy, &pSublist); |
| 146017 | 146293 | pMWin->nBufferCol = (pSublist ? pSublist->nExpr : 0); |
| 146018 | 146294 | |
| | @@ -146064,10 +146340,13 @@ |
| 146064 | 146340 | p->selFlags &= ~SF_Aggregate; |
| 146065 | 146341 | sqlite3SelectPrep(pParse, pSub, 0); |
| 146066 | 146342 | } |
| 146067 | 146343 | |
| 146068 | 146344 | sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pMWin->iEphCsr, pSublist->nExpr); |
| 146345 | + sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+1, pMWin->iEphCsr); |
| 146346 | + sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+2, pMWin->iEphCsr); |
| 146347 | + sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->iEphCsr+3, pMWin->iEphCsr); |
| 146069 | 146348 | }else{ |
| 146070 | 146349 | sqlite3SelectDelete(db, pSub); |
| 146071 | 146350 | } |
| 146072 | 146351 | if( db->mallocFailed ) rc = SQLITE_NOMEM; |
| 146073 | 146352 | } |
| | @@ -146084,10 +146363,11 @@ |
| 146084 | 146363 | sqlite3ExprListDelete(db, p->pPartition); |
| 146085 | 146364 | sqlite3ExprListDelete(db, p->pOrderBy); |
| 146086 | 146365 | sqlite3ExprDelete(db, p->pEnd); |
| 146087 | 146366 | sqlite3ExprDelete(db, p->pStart); |
| 146088 | 146367 | sqlite3DbFree(db, p->zName); |
| 146368 | + sqlite3DbFree(db, p->zBase); |
| 146089 | 146369 | sqlite3DbFree(db, p); |
| 146090 | 146370 | } |
| 146091 | 146371 | } |
| 146092 | 146372 | |
| 146093 | 146373 | /* |
| | @@ -146120,34 +146400,32 @@ |
| 146120 | 146400 | /* |
| 146121 | 146401 | ** Allocate and return a new Window object describing a Window Definition. |
| 146122 | 146402 | */ |
| 146123 | 146403 | SQLITE_PRIVATE Window *sqlite3WindowAlloc( |
| 146124 | 146404 | Parse *pParse, /* Parsing context */ |
| 146125 | | - int eType, /* Frame type. TK_RANGE or TK_ROWS */ |
| 146405 | + int eType, /* Frame type. TK_RANGE, TK_ROWS, TK_GROUPS, or 0 */ |
| 146126 | 146406 | int eStart, /* Start type: CURRENT, PRECEDING, FOLLOWING, UNBOUNDED */ |
| 146127 | 146407 | Expr *pStart, /* Start window size if TK_PRECEDING or FOLLOWING */ |
| 146128 | 146408 | int eEnd, /* End type: CURRENT, FOLLOWING, TK_UNBOUNDED, PRECEDING */ |
| 146129 | | - Expr *pEnd /* End window size if TK_FOLLOWING or PRECEDING */ |
| 146409 | + Expr *pEnd, /* End window size if TK_FOLLOWING or PRECEDING */ |
| 146410 | + u8 eExclude /* EXCLUDE clause */ |
| 146130 | 146411 | ){ |
| 146131 | 146412 | Window *pWin = 0; |
| 146413 | + int bImplicitFrame = 0; |
| 146132 | 146414 | |
| 146133 | 146415 | /* Parser assures the following: */ |
| 146134 | | - assert( eType==TK_RANGE || eType==TK_ROWS ); |
| 146416 | + assert( eType==0 || eType==TK_RANGE || eType==TK_ROWS || eType==TK_GROUPS ); |
| 146135 | 146417 | assert( eStart==TK_CURRENT || eStart==TK_PRECEDING |
| 146136 | 146418 | || eStart==TK_UNBOUNDED || eStart==TK_FOLLOWING ); |
| 146137 | 146419 | assert( eEnd==TK_CURRENT || eEnd==TK_FOLLOWING |
| 146138 | 146420 | || eEnd==TK_UNBOUNDED || eEnd==TK_PRECEDING ); |
| 146139 | 146421 | assert( (eStart==TK_PRECEDING || eStart==TK_FOLLOWING)==(pStart!=0) ); |
| 146140 | 146422 | assert( (eEnd==TK_FOLLOWING || eEnd==TK_PRECEDING)==(pEnd!=0) ); |
| 146141 | 146423 | |
| 146142 | | - |
| 146143 | | - /* If a frame is declared "RANGE" (not "ROWS"), then it may not use |
| 146144 | | - ** either "<expr> PRECEDING" or "<expr> FOLLOWING". |
| 146145 | | - */ |
| 146146 | | - if( eType==TK_RANGE && (pStart!=0 || pEnd!=0) ){ |
| 146147 | | - sqlite3ErrorMsg(pParse, "RANGE must use only UNBOUNDED or CURRENT ROW"); |
| 146148 | | - goto windowAllocErr; |
| 146424 | + if( eType==0 ){ |
| 146425 | + bImplicitFrame = 1; |
| 146426 | + eType = TK_RANGE; |
| 146149 | 146427 | } |
| 146150 | 146428 | |
| 146151 | 146429 | /* Additionally, the |
| 146152 | 146430 | ** starting boundary type may not occur earlier in the following list than |
| 146153 | 146431 | ** the ending boundary type: |
| | @@ -146163,28 +146441,96 @@ |
| 146163 | 146441 | ** frame boundary. |
| 146164 | 146442 | */ |
| 146165 | 146443 | if( (eStart==TK_CURRENT && eEnd==TK_PRECEDING) |
| 146166 | 146444 | || (eStart==TK_FOLLOWING && (eEnd==TK_PRECEDING || eEnd==TK_CURRENT)) |
| 146167 | 146445 | ){ |
| 146168 | | - sqlite3ErrorMsg(pParse, "unsupported frame delimiter for ROWS"); |
| 146446 | + sqlite3ErrorMsg(pParse, "unsupported frame specification"); |
| 146169 | 146447 | goto windowAllocErr; |
| 146170 | 146448 | } |
| 146171 | 146449 | |
| 146172 | 146450 | pWin = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); |
| 146173 | 146451 | if( pWin==0 ) goto windowAllocErr; |
| 146174 | | - pWin->eType = eType; |
| 146452 | + pWin->eFrmType = eType; |
| 146175 | 146453 | pWin->eStart = eStart; |
| 146176 | 146454 | pWin->eEnd = eEnd; |
| 146455 | + if( eExclude==0 && OptimizationDisabled(pParse->db, SQLITE_WindowFunc) ){ |
| 146456 | + eExclude = TK_NO; |
| 146457 | + } |
| 146458 | + pWin->eExclude = eExclude; |
| 146459 | + pWin->bImplicitFrame = bImplicitFrame; |
| 146177 | 146460 | pWin->pEnd = sqlite3WindowOffsetExpr(pParse, pEnd); |
| 146178 | 146461 | pWin->pStart = sqlite3WindowOffsetExpr(pParse, pStart); |
| 146179 | 146462 | return pWin; |
| 146180 | 146463 | |
| 146181 | 146464 | windowAllocErr: |
| 146182 | 146465 | sqlite3ExprDelete(pParse->db, pEnd); |
| 146183 | 146466 | sqlite3ExprDelete(pParse->db, pStart); |
| 146184 | 146467 | return 0; |
| 146185 | 146468 | } |
| 146469 | + |
| 146470 | +/* |
| 146471 | +** Attach PARTITION and ORDER BY clauses pPartition and pOrderBy to window |
| 146472 | +** pWin. Also, if parameter pBase is not NULL, set pWin->zBase to the |
| 146473 | +** equivalent nul-terminated string. |
| 146474 | +*/ |
| 146475 | +SQLITE_PRIVATE Window *sqlite3WindowAssemble( |
| 146476 | + Parse *pParse, |
| 146477 | + Window *pWin, |
| 146478 | + ExprList *pPartition, |
| 146479 | + ExprList *pOrderBy, |
| 146480 | + Token *pBase |
| 146481 | +){ |
| 146482 | + if( pWin ){ |
| 146483 | + pWin->pPartition = pPartition; |
| 146484 | + pWin->pOrderBy = pOrderBy; |
| 146485 | + if( pBase ){ |
| 146486 | + pWin->zBase = sqlite3DbStrNDup(pParse->db, pBase->z, pBase->n); |
| 146487 | + } |
| 146488 | + }else{ |
| 146489 | + sqlite3ExprListDelete(pParse->db, pPartition); |
| 146490 | + sqlite3ExprListDelete(pParse->db, pOrderBy); |
| 146491 | + } |
| 146492 | + return pWin; |
| 146493 | +} |
| 146494 | + |
| 146495 | +/* |
| 146496 | +** Window *pWin has just been created from a WINDOW clause. Tokne pBase |
| 146497 | +** is the base window. Earlier windows from the same WINDOW clause are |
| 146498 | +** stored in the linked list starting at pWin->pNextWin. This function |
| 146499 | +** either updates *pWin according to the base specification, or else |
| 146500 | +** leaves an error in pParse. |
| 146501 | +*/ |
| 146502 | +SQLITE_PRIVATE void sqlite3WindowChain(Parse *pParse, Window *pWin, Window *pList){ |
| 146503 | + if( pWin->zBase ){ |
| 146504 | + sqlite3 *db = pParse->db; |
| 146505 | + Window *pExist = windowFind(pParse, pList, pWin->zBase); |
| 146506 | + if( pExist ){ |
| 146507 | + const char *zErr = 0; |
| 146508 | + /* Check for errors */ |
| 146509 | + if( pWin->pPartition ){ |
| 146510 | + zErr = "PARTITION clause"; |
| 146511 | + }else if( pExist->pOrderBy && pWin->pOrderBy ){ |
| 146512 | + zErr = "ORDER BY clause"; |
| 146513 | + }else if( pExist->bImplicitFrame==0 ){ |
| 146514 | + zErr = "frame specification"; |
| 146515 | + } |
| 146516 | + if( zErr ){ |
| 146517 | + sqlite3ErrorMsg(pParse, |
| 146518 | + "cannot override %s of window: %s", zErr, pWin->zBase |
| 146519 | + ); |
| 146520 | + }else{ |
| 146521 | + pWin->pPartition = sqlite3ExprListDup(db, pExist->pPartition, 0); |
| 146522 | + if( pExist->pOrderBy ){ |
| 146523 | + assert( pWin->pOrderBy==0 ); |
| 146524 | + pWin->pOrderBy = sqlite3ExprListDup(db, pExist->pOrderBy, 0); |
| 146525 | + } |
| 146526 | + sqlite3DbFree(db, pWin->zBase); |
| 146527 | + pWin->zBase = 0; |
| 146528 | + } |
| 146529 | + } |
| 146530 | + } |
| 146531 | +} |
| 146186 | 146532 | |
| 146187 | 146533 | /* |
| 146188 | 146534 | ** Attach window object pWin to expression p. |
| 146189 | 146535 | */ |
| 146190 | 146536 | SQLITE_PRIVATE void sqlite3WindowAttach(Parse *pParse, Expr *p, Window *pWin){ |
| | @@ -146210,13 +146556,14 @@ |
| 146210 | 146556 | /* |
| 146211 | 146557 | ** Return 0 if the two window objects are identical, or non-zero otherwise. |
| 146212 | 146558 | ** Identical window objects can be processed in a single scan. |
| 146213 | 146559 | */ |
| 146214 | 146560 | SQLITE_PRIVATE int sqlite3WindowCompare(Parse *pParse, Window *p1, Window *p2){ |
| 146215 | | - if( p1->eType!=p2->eType ) return 1; |
| 146561 | + if( p1->eFrmType!=p2->eFrmType ) return 1; |
| 146216 | 146562 | if( p1->eStart!=p2->eStart ) return 1; |
| 146217 | 146563 | if( p1->eEnd!=p2->eEnd ) return 1; |
| 146564 | + if( p1->eExclude!=p2->eExclude ) return 1; |
| 146218 | 146565 | if( sqlite3ExprCompare(pParse, p1->pStart, p2->pStart, -1) ) return 1; |
| 146219 | 146566 | if( sqlite3ExprCompare(pParse, p1->pEnd, p2->pEnd, -1) ) return 1; |
| 146220 | 146567 | if( sqlite3ExprListCompare(p1->pPartition, p2->pPartition, -1) ) return 1; |
| 146221 | 146568 | if( sqlite3ExprListCompare(p1->pOrderBy, p2->pOrderBy, -1) ) return 1; |
| 146222 | 146569 | return 0; |
| | @@ -146229,16 +146576,31 @@ |
| 146229 | 146576 | ** and initialize registers and cursors used by sqlite3WindowCodeStep(). |
| 146230 | 146577 | */ |
| 146231 | 146578 | SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse *pParse, Window *pMWin){ |
| 146232 | 146579 | Window *pWin; |
| 146233 | 146580 | Vdbe *v = sqlite3GetVdbe(pParse); |
| 146234 | | - int nPart = (pMWin->pPartition ? pMWin->pPartition->nExpr : 0); |
| 146235 | | - nPart += (pMWin->pOrderBy ? pMWin->pOrderBy->nExpr : 0); |
| 146236 | | - if( nPart ){ |
| 146581 | + |
| 146582 | + /* Allocate registers to use for PARTITION BY values, if any. Initialize |
| 146583 | + ** said registers to NULL. */ |
| 146584 | + if( pMWin->pPartition ){ |
| 146585 | + int nExpr = pMWin->pPartition->nExpr; |
| 146237 | 146586 | pMWin->regPart = pParse->nMem+1; |
| 146238 | | - pParse->nMem += nPart; |
| 146239 | | - sqlite3VdbeAddOp3(v, OP_Null, 0, pMWin->regPart, pMWin->regPart+nPart-1); |
| 146587 | + pParse->nMem += nExpr; |
| 146588 | + sqlite3VdbeAddOp3(v, OP_Null, 0, pMWin->regPart, pMWin->regPart+nExpr-1); |
| 146589 | + } |
| 146590 | + |
| 146591 | + pMWin->regOne = ++pParse->nMem; |
| 146592 | + sqlite3VdbeAddOp2(v, OP_Integer, 1, pMWin->regOne); |
| 146593 | + |
| 146594 | + if( pMWin->eExclude ){ |
| 146595 | + pMWin->regStartRowid = ++pParse->nMem; |
| 146596 | + pMWin->regEndRowid = ++pParse->nMem; |
| 146597 | + pMWin->csrApp = pParse->nTab++; |
| 146598 | + sqlite3VdbeAddOp2(v, OP_Integer, 1, pMWin->regStartRowid); |
| 146599 | + sqlite3VdbeAddOp2(v, OP_Integer, 0, pMWin->regEndRowid); |
| 146600 | + sqlite3VdbeAddOp2(v, OP_OpenDup, pMWin->csrApp, pMWin->iEphCsr); |
| 146601 | + return; |
| 146240 | 146602 | } |
| 146241 | 146603 | |
| 146242 | 146604 | for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ |
| 146243 | 146605 | FuncDef *p = pWin->pFunc; |
| 146244 | 146606 | if( (p->funcFlags & SQLITE_FUNC_MINMAX) && pWin->eStart!=TK_UNBOUNDED ){ |
| | @@ -146263,50 +146625,71 @@ |
| 146263 | 146625 | sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp+1); |
| 146264 | 146626 | } |
| 146265 | 146627 | else if( p->zName==nth_valueName || p->zName==first_valueName ){ |
| 146266 | 146628 | /* Allocate two registers at pWin->regApp. These will be used to |
| 146267 | 146629 | ** store the start and end index of the current frame. */ |
| 146268 | | - assert( pMWin->iEphCsr ); |
| 146269 | 146630 | pWin->regApp = pParse->nMem+1; |
| 146270 | 146631 | pWin->csrApp = pParse->nTab++; |
| 146271 | 146632 | pParse->nMem += 2; |
| 146272 | 146633 | sqlite3VdbeAddOp2(v, OP_OpenDup, pWin->csrApp, pMWin->iEphCsr); |
| 146273 | 146634 | } |
| 146274 | 146635 | else if( p->zName==leadName || p->zName==lagName ){ |
| 146275 | | - assert( pMWin->iEphCsr ); |
| 146276 | 146636 | pWin->csrApp = pParse->nTab++; |
| 146277 | 146637 | sqlite3VdbeAddOp2(v, OP_OpenDup, pWin->csrApp, pMWin->iEphCsr); |
| 146278 | 146638 | } |
| 146279 | 146639 | } |
| 146280 | 146640 | } |
| 146641 | + |
| 146642 | +#define WINDOW_STARTING_INT 0 |
| 146643 | +#define WINDOW_ENDING_INT 1 |
| 146644 | +#define WINDOW_NTH_VALUE_INT 2 |
| 146645 | +#define WINDOW_STARTING_NUM 3 |
| 146646 | +#define WINDOW_ENDING_NUM 4 |
| 146281 | 146647 | |
| 146282 | 146648 | /* |
| 146283 | 146649 | ** A "PRECEDING <expr>" (eCond==0) or "FOLLOWING <expr>" (eCond==1) or the |
| 146284 | 146650 | ** value of the second argument to nth_value() (eCond==2) has just been |
| 146285 | 146651 | ** evaluated and the result left in register reg. This function generates VM |
| 146286 | 146652 | ** code to check that the value is a non-negative integer and throws an |
| 146287 | 146653 | ** exception if it is not. |
| 146288 | 146654 | */ |
| 146289 | | -static void windowCheckIntValue(Parse *pParse, int reg, int eCond){ |
| 146655 | +static void windowCheckValue(Parse *pParse, int reg, int eCond){ |
| 146290 | 146656 | static const char *azErr[] = { |
| 146291 | 146657 | "frame starting offset must be a non-negative integer", |
| 146292 | 146658 | "frame ending offset must be a non-negative integer", |
| 146293 | | - "second argument to nth_value must be a positive integer" |
| 146659 | + "second argument to nth_value must be a positive integer", |
| 146660 | + "frame starting offset must be a non-negative number", |
| 146661 | + "frame ending offset must be a non-negative number", |
| 146294 | 146662 | }; |
| 146295 | | - static int aOp[] = { OP_Ge, OP_Ge, OP_Gt }; |
| 146663 | + static int aOp[] = { OP_Ge, OP_Ge, OP_Gt, OP_Ge, OP_Ge }; |
| 146296 | 146664 | Vdbe *v = sqlite3GetVdbe(pParse); |
| 146297 | 146665 | int regZero = sqlite3GetTempReg(pParse); |
| 146298 | | - assert( eCond==0 || eCond==1 || eCond==2 ); |
| 146666 | + assert( eCond>=0 && eCond<ArraySize(azErr) ); |
| 146299 | 146667 | sqlite3VdbeAddOp2(v, OP_Integer, 0, regZero); |
| 146300 | | - sqlite3VdbeAddOp2(v, OP_MustBeInt, reg, sqlite3VdbeCurrentAddr(v)+2); |
| 146301 | | - VdbeCoverageIf(v, eCond==0); |
| 146302 | | - VdbeCoverageIf(v, eCond==1); |
| 146303 | | - VdbeCoverageIf(v, eCond==2); |
| 146668 | + if( eCond>=WINDOW_STARTING_NUM ){ |
| 146669 | + int regString = sqlite3GetTempReg(pParse); |
| 146670 | + sqlite3VdbeAddOp4(v, OP_String8, 0, regString, 0, "", P4_STATIC); |
| 146671 | + sqlite3VdbeAddOp3(v, OP_Ge, regString, sqlite3VdbeCurrentAddr(v)+2, reg); |
| 146672 | + sqlite3VdbeChangeP5(v, SQLITE_AFF_NUMERIC|SQLITE_JUMPIFNULL); |
| 146673 | + VdbeCoverage(v); |
| 146674 | + assert( eCond==3 || eCond==4 ); |
| 146675 | + VdbeCoverageIf(v, eCond==3); |
| 146676 | + VdbeCoverageIf(v, eCond==4); |
| 146677 | + }else{ |
| 146678 | + sqlite3VdbeAddOp2(v, OP_MustBeInt, reg, sqlite3VdbeCurrentAddr(v)+2); |
| 146679 | + VdbeCoverage(v); |
| 146680 | + assert( eCond==0 || eCond==1 || eCond==2 ); |
| 146681 | + VdbeCoverageIf(v, eCond==0); |
| 146682 | + VdbeCoverageIf(v, eCond==1); |
| 146683 | + VdbeCoverageIf(v, eCond==2); |
| 146684 | + } |
| 146304 | 146685 | sqlite3VdbeAddOp3(v, aOp[eCond], regZero, sqlite3VdbeCurrentAddr(v)+2, reg); |
| 146305 | | - VdbeCoverageNeverNullIf(v, eCond==0); |
| 146306 | | - VdbeCoverageNeverNullIf(v, eCond==1); |
| 146686 | + VdbeCoverageNeverNullIf(v, eCond==0); /* NULL case captured by */ |
| 146687 | + VdbeCoverageNeverNullIf(v, eCond==1); /* the OP_MustBeInt */ |
| 146307 | 146688 | VdbeCoverageNeverNullIf(v, eCond==2); |
| 146689 | + VdbeCoverageNeverNullIf(v, eCond==3); /* NULL case caught by */ |
| 146690 | + VdbeCoverageNeverNullIf(v, eCond==4); /* the OP_Ge */ |
| 146308 | 146691 | sqlite3MayAbort(pParse); |
| 146309 | 146692 | sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_ERROR, OE_Abort); |
| 146310 | 146693 | sqlite3VdbeAppendP4(v, (void*)azErr[eCond], P4_STATIC); |
| 146311 | 146694 | sqlite3ReleaseTempReg(pParse, regZero); |
| 146312 | 146695 | } |
| | @@ -146342,41 +146725,32 @@ |
| 146342 | 146725 | static void windowAggStep( |
| 146343 | 146726 | Parse *pParse, |
| 146344 | 146727 | Window *pMWin, /* Linked list of window functions */ |
| 146345 | 146728 | int csr, /* Read arguments from this cursor */ |
| 146346 | 146729 | int bInverse, /* True to invoke xInverse instead of xStep */ |
| 146347 | | - int reg, /* Array of registers */ |
| 146348 | | - int regPartSize /* Register containing size of partition */ |
| 146730 | + int reg /* Array of registers */ |
| 146349 | 146731 | ){ |
| 146350 | 146732 | Vdbe *v = sqlite3GetVdbe(pParse); |
| 146351 | 146733 | Window *pWin; |
| 146352 | 146734 | for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ |
| 146353 | | - int flags = pWin->pFunc->funcFlags; |
| 146735 | + FuncDef *pFunc = pWin->pFunc; |
| 146354 | 146736 | int regArg; |
| 146355 | 146737 | int nArg = windowArgCount(pWin); |
| 146738 | + int i; |
| 146356 | 146739 | |
| 146357 | | - if( csr>=0 ){ |
| 146358 | | - int i; |
| 146359 | | - for(i=0; i<nArg; i++){ |
| 146740 | + for(i=0; i<nArg; i++){ |
| 146741 | + if( i!=1 || pFunc->zName!=nth_valueName ){ |
| 146360 | 146742 | sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol+i, reg+i); |
| 146361 | | - } |
| 146362 | | - regArg = reg; |
| 146363 | | - if( flags & SQLITE_FUNC_WINDOW_SIZE ){ |
| 146364 | | - if( nArg==0 ){ |
| 146365 | | - regArg = regPartSize; |
| 146366 | | - }else{ |
| 146367 | | - sqlite3VdbeAddOp2(v, OP_SCopy, regPartSize, reg+nArg); |
| 146368 | | - } |
| 146369 | | - nArg++; |
| 146370 | | - } |
| 146371 | | - }else{ |
| 146372 | | - assert( !(flags & SQLITE_FUNC_WINDOW_SIZE) ); |
| 146373 | | - regArg = reg + pWin->iArgCol; |
| 146374 | | - } |
| 146375 | | - |
| 146376 | | - if( (pWin->pFunc->funcFlags & SQLITE_FUNC_MINMAX) |
| 146377 | | - && pWin->eStart!=TK_UNBOUNDED |
| 146743 | + }else{ |
| 146744 | + sqlite3VdbeAddOp3(v, OP_Column, pMWin->iEphCsr, pWin->iArgCol+i, reg+i); |
| 146745 | + } |
| 146746 | + } |
| 146747 | + regArg = reg; |
| 146748 | + |
| 146749 | + if( pMWin->regStartRowid==0 |
| 146750 | + && (pFunc->funcFlags & SQLITE_FUNC_MINMAX) |
| 146751 | + && (pWin->eStart!=TK_UNBOUNDED) |
| 146378 | 146752 | ){ |
| 146379 | 146753 | int addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regArg); |
| 146380 | 146754 | VdbeCoverage(v); |
| 146381 | 146755 | if( bInverse==0 ){ |
| 146382 | 146756 | sqlite3VdbeAddOp2(v, OP_AddImm, pWin->regApp+1, 1); |
| | @@ -146389,151 +146763,223 @@ |
| 146389 | 146763 | sqlite3VdbeAddOp1(v, OP_Delete, pWin->csrApp); |
| 146390 | 146764 | sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2); |
| 146391 | 146765 | } |
| 146392 | 146766 | sqlite3VdbeJumpHere(v, addrIsNull); |
| 146393 | 146767 | }else if( pWin->regApp ){ |
| 146394 | | - assert( pWin->pFunc->zName==nth_valueName |
| 146395 | | - || pWin->pFunc->zName==first_valueName |
| 146768 | + assert( pFunc->zName==nth_valueName |
| 146769 | + || pFunc->zName==first_valueName |
| 146396 | 146770 | ); |
| 146397 | 146771 | assert( bInverse==0 || bInverse==1 ); |
| 146398 | 146772 | sqlite3VdbeAddOp2(v, OP_AddImm, pWin->regApp+1-bInverse, 1); |
| 146399 | | - }else if( pWin->pFunc->zName==leadName |
| 146400 | | - || pWin->pFunc->zName==lagName |
| 146401 | | - ){ |
| 146402 | | - /* no-op */ |
| 146403 | | - }else{ |
| 146773 | + }else if( pFunc->xSFunc!=noopStepFunc ){ |
| 146404 | 146774 | int addrIf = 0; |
| 146405 | 146775 | if( pWin->pFilter ){ |
| 146406 | 146776 | int regTmp; |
| 146407 | 146777 | assert( nArg==0 || nArg==pWin->pOwner->x.pList->nExpr ); |
| 146408 | 146778 | assert( nArg || pWin->pOwner->x.pList==0 ); |
| 146409 | | - if( csr>0 ){ |
| 146410 | | - regTmp = sqlite3GetTempReg(pParse); |
| 146411 | | - sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol+nArg,regTmp); |
| 146412 | | - }else{ |
| 146413 | | - regTmp = regArg + nArg; |
| 146414 | | - } |
| 146779 | + regTmp = sqlite3GetTempReg(pParse); |
| 146780 | + sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol+nArg,regTmp); |
| 146415 | 146781 | addrIf = sqlite3VdbeAddOp3(v, OP_IfNot, regTmp, 0, 1); |
| 146416 | 146782 | VdbeCoverage(v); |
| 146417 | | - if( csr>0 ){ |
| 146418 | | - sqlite3ReleaseTempReg(pParse, regTmp); |
| 146419 | | - } |
| 146783 | + sqlite3ReleaseTempReg(pParse, regTmp); |
| 146420 | 146784 | } |
| 146421 | | - if( pWin->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){ |
| 146785 | + if( pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){ |
| 146422 | 146786 | CollSeq *pColl; |
| 146423 | 146787 | assert( nArg>0 ); |
| 146424 | 146788 | pColl = sqlite3ExprNNCollSeq(pParse, pWin->pOwner->x.pList->a[0].pExpr); |
| 146425 | 146789 | sqlite3VdbeAddOp4(v, OP_CollSeq, 0,0,0, (const char*)pColl, P4_COLLSEQ); |
| 146426 | 146790 | } |
| 146427 | 146791 | sqlite3VdbeAddOp3(v, bInverse? OP_AggInverse : OP_AggStep, |
| 146428 | 146792 | bInverse, regArg, pWin->regAccum); |
| 146429 | | - sqlite3VdbeAppendP4(v, pWin->pFunc, P4_FUNCDEF); |
| 146793 | + sqlite3VdbeAppendP4(v, pFunc, P4_FUNCDEF); |
| 146430 | 146794 | sqlite3VdbeChangeP5(v, (u8)nArg); |
| 146431 | 146795 | if( addrIf ) sqlite3VdbeJumpHere(v, addrIf); |
| 146432 | 146796 | } |
| 146433 | 146797 | } |
| 146434 | 146798 | } |
| 146435 | 146799 | |
| 146800 | +typedef struct WindowCodeArg WindowCodeArg; |
| 146801 | +typedef struct WindowCsrAndReg WindowCsrAndReg; |
| 146802 | +struct WindowCsrAndReg { |
| 146803 | + int csr; |
| 146804 | + int reg; |
| 146805 | +}; |
| 146806 | + |
| 146807 | +struct WindowCodeArg { |
| 146808 | + Parse *pParse; |
| 146809 | + Window *pMWin; |
| 146810 | + Vdbe *pVdbe; |
| 146811 | + int regGosub; |
| 146812 | + int addrGosub; |
| 146813 | + int regArg; |
| 146814 | + int eDelete; |
| 146815 | + |
| 146816 | + WindowCsrAndReg start; |
| 146817 | + WindowCsrAndReg current; |
| 146818 | + WindowCsrAndReg end; |
| 146819 | +}; |
| 146820 | + |
| 146436 | 146821 | /* |
| 146437 | | -** Generate VM code to invoke either xValue() (bFinal==0) or xFinalize() |
| 146438 | | -** (bFinal==1) for each window function in the linked list starting at |
| 146822 | +** Values that may be passed as the second argument to windowCodeOp(). |
| 146823 | +*/ |
| 146824 | +#define WINDOW_RETURN_ROW 1 |
| 146825 | +#define WINDOW_AGGINVERSE 2 |
| 146826 | +#define WINDOW_AGGSTEP 3 |
| 146827 | + |
| 146828 | +/* |
| 146829 | +** Generate VM code to read the window frames peer values from cursor csr into |
| 146830 | +** an array of registers starting at reg. |
| 146831 | +*/ |
| 146832 | +static void windowReadPeerValues( |
| 146833 | + WindowCodeArg *p, |
| 146834 | + int csr, |
| 146835 | + int reg |
| 146836 | +){ |
| 146837 | + Window *pMWin = p->pMWin; |
| 146838 | + ExprList *pOrderBy = pMWin->pOrderBy; |
| 146839 | + if( pOrderBy ){ |
| 146840 | + Vdbe *v = sqlite3GetVdbe(p->pParse); |
| 146841 | + ExprList *pPart = pMWin->pPartition; |
| 146842 | + int iColOff = pMWin->nBufferCol + (pPart ? pPart->nExpr : 0); |
| 146843 | + int i; |
| 146844 | + for(i=0; i<pOrderBy->nExpr; i++){ |
| 146845 | + sqlite3VdbeAddOp3(v, OP_Column, csr, iColOff+i, reg+i); |
| 146846 | + } |
| 146847 | + } |
| 146848 | +} |
| 146849 | + |
| 146850 | +/* |
| 146851 | +** Generate VM code to invoke either xValue() (bFin==0) or xFinalize() |
| 146852 | +** (bFin==1) for each window function in the linked list starting at |
| 146439 | 146853 | ** pMWin. Or, for built-in window-functions that do not use the standard |
| 146440 | 146854 | ** API, generate the equivalent VM code. |
| 146441 | 146855 | */ |
| 146442 | | -static void windowAggFinal(Parse *pParse, Window *pMWin, int bFinal){ |
| 146856 | +static void windowAggFinal(WindowCodeArg *p, int bFin){ |
| 146857 | + Parse *pParse = p->pParse; |
| 146858 | + Window *pMWin = p->pMWin; |
| 146443 | 146859 | Vdbe *v = sqlite3GetVdbe(pParse); |
| 146444 | 146860 | Window *pWin; |
| 146445 | 146861 | |
| 146446 | 146862 | for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ |
| 146447 | | - if( (pWin->pFunc->funcFlags & SQLITE_FUNC_MINMAX) |
| 146448 | | - && pWin->eStart!=TK_UNBOUNDED |
| 146863 | + if( pMWin->regStartRowid==0 |
| 146864 | + && (pWin->pFunc->funcFlags & SQLITE_FUNC_MINMAX) |
| 146865 | + && (pWin->eStart!=TK_UNBOUNDED) |
| 146449 | 146866 | ){ |
| 146450 | 146867 | sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult); |
| 146451 | 146868 | sqlite3VdbeAddOp1(v, OP_Last, pWin->csrApp); |
| 146452 | 146869 | VdbeCoverage(v); |
| 146453 | 146870 | sqlite3VdbeAddOp3(v, OP_Column, pWin->csrApp, 0, pWin->regResult); |
| 146454 | 146871 | sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2); |
| 146455 | | - if( bFinal ){ |
| 146456 | | - sqlite3VdbeAddOp1(v, OP_ResetSorter, pWin->csrApp); |
| 146457 | | - } |
| 146458 | 146872 | }else if( pWin->regApp ){ |
| 146873 | + assert( pMWin->regStartRowid==0 ); |
| 146459 | 146874 | }else{ |
| 146460 | | - if( bFinal ){ |
| 146461 | | - sqlite3VdbeAddOp2(v, OP_AggFinal, pWin->regAccum, windowArgCount(pWin)); |
| 146875 | + int nArg = windowArgCount(pWin); |
| 146876 | + if( bFin ){ |
| 146877 | + sqlite3VdbeAddOp2(v, OP_AggFinal, pWin->regAccum, nArg); |
| 146462 | 146878 | sqlite3VdbeAppendP4(v, pWin->pFunc, P4_FUNCDEF); |
| 146463 | 146879 | sqlite3VdbeAddOp2(v, OP_Copy, pWin->regAccum, pWin->regResult); |
| 146464 | 146880 | sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum); |
| 146465 | 146881 | }else{ |
| 146466 | | - sqlite3VdbeAddOp3(v, OP_AggValue, pWin->regAccum, windowArgCount(pWin), |
| 146467 | | - pWin->regResult); |
| 146882 | + sqlite3VdbeAddOp3(v, OP_AggValue,pWin->regAccum,nArg,pWin->regResult); |
| 146468 | 146883 | sqlite3VdbeAppendP4(v, pWin->pFunc, P4_FUNCDEF); |
| 146469 | 146884 | } |
| 146470 | 146885 | } |
| 146471 | 146886 | } |
| 146472 | 146887 | } |
| 146473 | 146888 | |
| 146474 | 146889 | /* |
| 146475 | | -** This function generates VM code to invoke the sub-routine at address |
| 146476 | | -** lblFlushPart once for each partition with the entire partition cached in |
| 146477 | | -** the Window.iEphCsr temp table. |
| 146890 | +** Generate code to calculate the current values of all window functions in the |
| 146891 | +** p->pMWin list by doing a full scan of the current window frame. Store the |
| 146892 | +** results in the Window.regResult registers, ready to return the upper |
| 146893 | +** layer. |
| 146478 | 146894 | */ |
| 146479 | | -static void windowPartitionCache( |
| 146480 | | - Parse *pParse, |
| 146481 | | - Select *p, /* The rewritten SELECT statement */ |
| 146482 | | - WhereInfo *pWInfo, /* WhereInfo to call WhereEnd() on */ |
| 146483 | | - int regFlushPart, /* Register to use with Gosub lblFlushPart */ |
| 146484 | | - int lblFlushPart, /* Subroutine to Gosub to */ |
| 146485 | | - int *pRegSize /* OUT: Register containing partition size */ |
| 146486 | | -){ |
| 146487 | | - Window *pMWin = p->pWin; |
| 146488 | | - Vdbe *v = sqlite3GetVdbe(pParse); |
| 146489 | | - int iSubCsr = p->pSrc->a[0].iCursor; |
| 146490 | | - int nSub = p->pSrc->a[0].pTab->nCol; |
| 146491 | | - int k; |
| 146492 | | - |
| 146493 | | - int reg = pParse->nMem+1; |
| 146494 | | - int regRecord = reg+nSub; |
| 146495 | | - int regRowid = regRecord+1; |
| 146496 | | - |
| 146497 | | - *pRegSize = regRowid; |
| 146498 | | - pParse->nMem += nSub + 2; |
| 146499 | | - |
| 146500 | | - /* Load the column values for the row returned by the sub-select |
| 146501 | | - ** into an array of registers starting at reg. */ |
| 146502 | | - for(k=0; k<nSub; k++){ |
| 146503 | | - sqlite3VdbeAddOp3(v, OP_Column, iSubCsr, k, reg+k); |
| 146504 | | - } |
| 146505 | | - sqlite3VdbeAddOp3(v, OP_MakeRecord, reg, nSub, regRecord); |
| 146506 | | - |
| 146507 | | - /* Check if this is the start of a new partition. If so, call the |
| 146508 | | - ** flush_partition sub-routine. */ |
| 146509 | | - if( pMWin->pPartition ){ |
| 146895 | +static void windowFullScan(WindowCodeArg *p){ |
| 146896 | + Window *pWin; |
| 146897 | + Parse *pParse = p->pParse; |
| 146898 | + Window *pMWin = p->pMWin; |
| 146899 | + Vdbe *v = p->pVdbe; |
| 146900 | + |
| 146901 | + int regCRowid = 0; /* Current rowid value */ |
| 146902 | + int regCPeer = 0; /* Current peer values */ |
| 146903 | + int regRowid = 0; /* AggStep rowid value */ |
| 146904 | + int regPeer = 0; /* AggStep peer values */ |
| 146905 | + |
| 146906 | + int nPeer; |
| 146907 | + int lblNext; |
| 146908 | + int lblBrk; |
| 146909 | + int addrNext; |
| 146910 | + int csr = pMWin->csrApp; |
| 146911 | + |
| 146912 | + nPeer = (pMWin->pOrderBy ? pMWin->pOrderBy->nExpr : 0); |
| 146913 | + |
| 146914 | + lblNext = sqlite3VdbeMakeLabel(pParse); |
| 146915 | + lblBrk = sqlite3VdbeMakeLabel(pParse); |
| 146916 | + |
| 146917 | + regCRowid = sqlite3GetTempReg(pParse); |
| 146918 | + regRowid = sqlite3GetTempReg(pParse); |
| 146919 | + if( nPeer ){ |
| 146920 | + regCPeer = sqlite3GetTempRange(pParse, nPeer); |
| 146921 | + regPeer = sqlite3GetTempRange(pParse, nPeer); |
| 146922 | + } |
| 146923 | + |
| 146924 | + sqlite3VdbeAddOp2(v, OP_Rowid, pMWin->iEphCsr, regCRowid); |
| 146925 | + windowReadPeerValues(p, pMWin->iEphCsr, regCPeer); |
| 146926 | + |
| 146927 | + for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ |
| 146928 | + sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum); |
| 146929 | + } |
| 146930 | + |
| 146931 | + sqlite3VdbeAddOp3(v, OP_SeekGE, csr, lblBrk, pMWin->regStartRowid); |
| 146932 | + VdbeCoverage(v); |
| 146933 | + addrNext = sqlite3VdbeCurrentAddr(v); |
| 146934 | + sqlite3VdbeAddOp2(v, OP_Rowid, csr, regRowid); |
| 146935 | + sqlite3VdbeAddOp3(v, OP_Gt, pMWin->regEndRowid, lblBrk, regRowid); |
| 146936 | + VdbeCoverageNeverNull(v); |
| 146937 | + |
| 146938 | + if( pMWin->eExclude==TK_CURRENT ){ |
| 146939 | + sqlite3VdbeAddOp3(v, OP_Eq, regCRowid, lblNext, regRowid); |
| 146940 | + VdbeCoverageNeverNull(v); |
| 146941 | + }else if( pMWin->eExclude!=TK_NO ){ |
| 146510 | 146942 | int addr; |
| 146511 | | - ExprList *pPart = pMWin->pPartition; |
| 146512 | | - int nPart = pPart->nExpr; |
| 146513 | | - int regNewPart = reg + pMWin->nBufferCol; |
| 146514 | | - KeyInfo *pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pPart, 0, 0); |
| 146515 | | - |
| 146516 | | - addr = sqlite3VdbeAddOp3(v, OP_Compare, regNewPart, pMWin->regPart,nPart); |
| 146517 | | - sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO); |
| 146518 | | - sqlite3VdbeAddOp3(v, OP_Jump, addr+2, addr+4, addr+2); |
| 146519 | | - VdbeCoverageEqNe(v); |
| 146520 | | - sqlite3VdbeAddOp3(v, OP_Copy, regNewPart, pMWin->regPart, nPart-1); |
| 146521 | | - sqlite3VdbeAddOp2(v, OP_Gosub, regFlushPart, lblFlushPart); |
| 146522 | | - VdbeComment((v, "call flush_partition")); |
| 146523 | | - } |
| 146524 | | - |
| 146525 | | - /* Buffer the current row in the ephemeral table. */ |
| 146526 | | - sqlite3VdbeAddOp2(v, OP_NewRowid, pMWin->iEphCsr, regRowid); |
| 146527 | | - sqlite3VdbeAddOp3(v, OP_Insert, pMWin->iEphCsr, regRecord, regRowid); |
| 146528 | | - |
| 146529 | | - /* End of the input loop */ |
| 146530 | | - sqlite3WhereEnd(pWInfo); |
| 146531 | | - |
| 146532 | | - /* Invoke "flush_partition" to deal with the final (or only) partition */ |
| 146533 | | - sqlite3VdbeAddOp2(v, OP_Gosub, regFlushPart, lblFlushPart); |
| 146534 | | - VdbeComment((v, "call flush_partition")); |
| 146943 | + int addrEq = 0; |
| 146944 | + KeyInfo *pKeyInfo = 0; |
| 146945 | + |
| 146946 | + if( pMWin->pOrderBy ){ |
| 146947 | + pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pMWin->pOrderBy, 0, 0); |
| 146948 | + } |
| 146949 | + if( pMWin->eExclude==TK_TIES ){ |
| 146950 | + addrEq = sqlite3VdbeAddOp3(v, OP_Eq, regCRowid, 0, regRowid); |
| 146951 | + VdbeCoverageNeverNull(v); |
| 146952 | + } |
| 146953 | + if( pKeyInfo ){ |
| 146954 | + windowReadPeerValues(p, csr, regPeer); |
| 146955 | + sqlite3VdbeAddOp3(v, OP_Compare, regPeer, regCPeer, nPeer); |
| 146956 | + sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO); |
| 146957 | + addr = sqlite3VdbeCurrentAddr(v)+1; |
| 146958 | + sqlite3VdbeAddOp3(v, OP_Jump, addr, lblNext, addr); |
| 146959 | + VdbeCoverageEqNe(v); |
| 146960 | + }else{ |
| 146961 | + sqlite3VdbeAddOp2(v, OP_Goto, 0, lblNext); |
| 146962 | + } |
| 146963 | + if( addrEq ) sqlite3VdbeJumpHere(v, addrEq); |
| 146964 | + } |
| 146965 | + |
| 146966 | + windowAggStep(pParse, pMWin, csr, 0, p->regArg); |
| 146967 | + |
| 146968 | + sqlite3VdbeResolveLabel(v, lblNext); |
| 146969 | + sqlite3VdbeAddOp2(v, OP_Next, csr, addrNext); |
| 146970 | + VdbeCoverage(v); |
| 146971 | + sqlite3VdbeJumpHere(v, addrNext-1); |
| 146972 | + sqlite3VdbeJumpHere(v, addrNext+1); |
| 146973 | + sqlite3ReleaseTempReg(pParse, regRowid); |
| 146974 | + sqlite3ReleaseTempReg(pParse, regCRowid); |
| 146975 | + if( nPeer ){ |
| 146976 | + sqlite3ReleaseTempRange(pParse, regPeer, nPeer); |
| 146977 | + sqlite3ReleaseTempRange(pParse, regCPeer, nPeer); |
| 146978 | + } |
| 146979 | + |
| 146980 | + windowAggFinal(p, 1); |
| 146535 | 146981 | } |
| 146536 | 146982 | |
| 146537 | 146983 | /* |
| 146538 | 146984 | ** Invoke the sub-routine at regGosub (generated by code in select.c) to |
| 146539 | 146985 | ** return the current row of Window.iEphCsr. If all window functions are |
| | @@ -146545,114 +146991,78 @@ |
| 146545 | 146991 | ** nth_value() |
| 146546 | 146992 | ** first_value() |
| 146547 | 146993 | ** lag() |
| 146548 | 146994 | ** lead() |
| 146549 | 146995 | */ |
| 146550 | | -static void windowReturnOneRow( |
| 146551 | | - Parse *pParse, |
| 146552 | | - Window *pMWin, |
| 146553 | | - int regGosub, |
| 146554 | | - int addrGosub |
| 146555 | | -){ |
| 146556 | | - Vdbe *v = sqlite3GetVdbe(pParse); |
| 146557 | | - Window *pWin; |
| 146558 | | - for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ |
| 146559 | | - FuncDef *pFunc = pWin->pFunc; |
| 146560 | | - if( pFunc->zName==nth_valueName |
| 146561 | | - || pFunc->zName==first_valueName |
| 146562 | | - ){ |
| 146563 | | - int csr = pWin->csrApp; |
| 146564 | | - int lbl = sqlite3VdbeMakeLabel(pParse); |
| 146565 | | - int tmpReg = sqlite3GetTempReg(pParse); |
| 146566 | | - sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult); |
| 146567 | | - |
| 146568 | | - if( pFunc->zName==nth_valueName ){ |
| 146569 | | - sqlite3VdbeAddOp3(v, OP_Column, pMWin->iEphCsr, pWin->iArgCol+1,tmpReg); |
| 146570 | | - windowCheckIntValue(pParse, tmpReg, 2); |
| 146571 | | - }else{ |
| 146572 | | - sqlite3VdbeAddOp2(v, OP_Integer, 1, tmpReg); |
| 146573 | | - } |
| 146574 | | - sqlite3VdbeAddOp3(v, OP_Add, tmpReg, pWin->regApp, tmpReg); |
| 146575 | | - sqlite3VdbeAddOp3(v, OP_Gt, pWin->regApp+1, lbl, tmpReg); |
| 146576 | | - VdbeCoverageNeverNull(v); |
| 146577 | | - sqlite3VdbeAddOp3(v, OP_SeekRowid, csr, 0, tmpReg); |
| 146578 | | - VdbeCoverageNeverTaken(v); |
| 146579 | | - sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol, pWin->regResult); |
| 146580 | | - sqlite3VdbeResolveLabel(v, lbl); |
| 146581 | | - sqlite3ReleaseTempReg(pParse, tmpReg); |
| 146582 | | - } |
| 146583 | | - else if( pFunc->zName==leadName || pFunc->zName==lagName ){ |
| 146584 | | - int nArg = pWin->pOwner->x.pList->nExpr; |
| 146585 | | - int iEph = pMWin->iEphCsr; |
| 146586 | | - int csr = pWin->csrApp; |
| 146587 | | - int lbl = sqlite3VdbeMakeLabel(pParse); |
| 146588 | | - int tmpReg = sqlite3GetTempReg(pParse); |
| 146589 | | - |
| 146590 | | - if( nArg<3 ){ |
| 146591 | | - sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult); |
| 146592 | | - }else{ |
| 146593 | | - sqlite3VdbeAddOp3(v, OP_Column, iEph, pWin->iArgCol+2, pWin->regResult); |
| 146594 | | - } |
| 146595 | | - sqlite3VdbeAddOp2(v, OP_Rowid, iEph, tmpReg); |
| 146596 | | - if( nArg<2 ){ |
| 146597 | | - int val = (pFunc->zName==leadName ? 1 : -1); |
| 146598 | | - sqlite3VdbeAddOp2(v, OP_AddImm, tmpReg, val); |
| 146599 | | - }else{ |
| 146600 | | - int op = (pFunc->zName==leadName ? OP_Add : OP_Subtract); |
| 146601 | | - int tmpReg2 = sqlite3GetTempReg(pParse); |
| 146602 | | - sqlite3VdbeAddOp3(v, OP_Column, iEph, pWin->iArgCol+1, tmpReg2); |
| 146603 | | - sqlite3VdbeAddOp3(v, op, tmpReg2, tmpReg, tmpReg); |
| 146604 | | - sqlite3ReleaseTempReg(pParse, tmpReg2); |
| 146605 | | - } |
| 146606 | | - |
| 146607 | | - sqlite3VdbeAddOp3(v, OP_SeekRowid, csr, lbl, tmpReg); |
| 146608 | | - VdbeCoverage(v); |
| 146609 | | - sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol, pWin->regResult); |
| 146610 | | - sqlite3VdbeResolveLabel(v, lbl); |
| 146611 | | - sqlite3ReleaseTempReg(pParse, tmpReg); |
| 146612 | | - } |
| 146613 | | - } |
| 146614 | | - sqlite3VdbeAddOp2(v, OP_Gosub, regGosub, addrGosub); |
| 146615 | | -} |
| 146616 | | - |
| 146617 | | -/* |
| 146618 | | -** Invoke the code generated by windowReturnOneRow() and, optionally, the |
| 146619 | | -** xInverse() function for each window function, for one or more rows |
| 146620 | | -** from the Window.iEphCsr temp table. This routine generates VM code |
| 146621 | | -** similar to: |
| 146622 | | -** |
| 146623 | | -** while( regCtr>0 ){ |
| 146624 | | -** regCtr--; |
| 146625 | | -** windowReturnOneRow() |
| 146626 | | -** if( bInverse ){ |
| 146627 | | -** AggInverse |
| 146628 | | -** } |
| 146629 | | -** Next (Window.iEphCsr) |
| 146630 | | -** } |
| 146631 | | -*/ |
| 146632 | | -static void windowReturnRows( |
| 146633 | | - Parse *pParse, |
| 146634 | | - Window *pMWin, /* List of window functions */ |
| 146635 | | - int regCtr, /* Register containing number of rows */ |
| 146636 | | - int regGosub, /* Register for Gosub addrGosub */ |
| 146637 | | - int addrGosub, /* Address of sub-routine for ReturnOneRow */ |
| 146638 | | - int regInvArg, /* Array of registers for xInverse args */ |
| 146639 | | - int regInvSize /* Register containing size of partition */ |
| 146640 | | -){ |
| 146641 | | - int addr; |
| 146642 | | - Vdbe *v = sqlite3GetVdbe(pParse); |
| 146643 | | - windowAggFinal(pParse, pMWin, 0); |
| 146644 | | - addr = sqlite3VdbeAddOp3(v, OP_IfPos, regCtr, sqlite3VdbeCurrentAddr(v)+2 ,1); |
| 146645 | | - VdbeCoverage(v); |
| 146646 | | - sqlite3VdbeAddOp2(v, OP_Goto, 0, 0); |
| 146647 | | - windowReturnOneRow(pParse, pMWin, regGosub, addrGosub); |
| 146648 | | - if( regInvArg ){ |
| 146649 | | - windowAggStep(pParse, pMWin, pMWin->iEphCsr, 1, regInvArg, regInvSize); |
| 146650 | | - } |
| 146651 | | - sqlite3VdbeAddOp2(v, OP_Next, pMWin->iEphCsr, addr); |
| 146652 | | - VdbeCoverage(v); |
| 146653 | | - sqlite3VdbeJumpHere(v, addr+1); /* The OP_Goto */ |
| 146996 | +static void windowReturnOneRow(WindowCodeArg *p){ |
| 146997 | + Window *pMWin = p->pMWin; |
| 146998 | + Vdbe *v = p->pVdbe; |
| 146999 | + |
| 147000 | + if( pMWin->regStartRowid ){ |
| 147001 | + windowFullScan(p); |
| 147002 | + }else{ |
| 147003 | + Parse *pParse = p->pParse; |
| 147004 | + Window *pWin; |
| 147005 | + |
| 147006 | + for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ |
| 147007 | + FuncDef *pFunc = pWin->pFunc; |
| 147008 | + if( pFunc->zName==nth_valueName |
| 147009 | + || pFunc->zName==first_valueName |
| 147010 | + ){ |
| 147011 | + int csr = pWin->csrApp; |
| 147012 | + int lbl = sqlite3VdbeMakeLabel(pParse); |
| 147013 | + int tmpReg = sqlite3GetTempReg(pParse); |
| 147014 | + sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult); |
| 147015 | + |
| 147016 | + if( pFunc->zName==nth_valueName ){ |
| 147017 | + sqlite3VdbeAddOp3(v, OP_Column,pMWin->iEphCsr,pWin->iArgCol+1,tmpReg); |
| 147018 | + windowCheckValue(pParse, tmpReg, 2); |
| 147019 | + }else{ |
| 147020 | + sqlite3VdbeAddOp2(v, OP_Integer, 1, tmpReg); |
| 147021 | + } |
| 147022 | + sqlite3VdbeAddOp3(v, OP_Add, tmpReg, pWin->regApp, tmpReg); |
| 147023 | + sqlite3VdbeAddOp3(v, OP_Gt, pWin->regApp+1, lbl, tmpReg); |
| 147024 | + VdbeCoverageNeverNull(v); |
| 147025 | + sqlite3VdbeAddOp3(v, OP_SeekRowid, csr, 0, tmpReg); |
| 147026 | + VdbeCoverageNeverTaken(v); |
| 147027 | + sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol, pWin->regResult); |
| 147028 | + sqlite3VdbeResolveLabel(v, lbl); |
| 147029 | + sqlite3ReleaseTempReg(pParse, tmpReg); |
| 147030 | + } |
| 147031 | + else if( pFunc->zName==leadName || pFunc->zName==lagName ){ |
| 147032 | + int nArg = pWin->pOwner->x.pList->nExpr; |
| 147033 | + int csr = pWin->csrApp; |
| 147034 | + int lbl = sqlite3VdbeMakeLabel(pParse); |
| 147035 | + int tmpReg = sqlite3GetTempReg(pParse); |
| 147036 | + int iEph = pMWin->iEphCsr; |
| 147037 | + |
| 147038 | + if( nArg<3 ){ |
| 147039 | + sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regResult); |
| 147040 | + }else{ |
| 147041 | + sqlite3VdbeAddOp3(v, OP_Column, iEph,pWin->iArgCol+2,pWin->regResult); |
| 147042 | + } |
| 147043 | + sqlite3VdbeAddOp2(v, OP_Rowid, iEph, tmpReg); |
| 147044 | + if( nArg<2 ){ |
| 147045 | + int val = (pFunc->zName==leadName ? 1 : -1); |
| 147046 | + sqlite3VdbeAddOp2(v, OP_AddImm, tmpReg, val); |
| 147047 | + }else{ |
| 147048 | + int op = (pFunc->zName==leadName ? OP_Add : OP_Subtract); |
| 147049 | + int tmpReg2 = sqlite3GetTempReg(pParse); |
| 147050 | + sqlite3VdbeAddOp3(v, OP_Column, iEph, pWin->iArgCol+1, tmpReg2); |
| 147051 | + sqlite3VdbeAddOp3(v, op, tmpReg2, tmpReg, tmpReg); |
| 147052 | + sqlite3ReleaseTempReg(pParse, tmpReg2); |
| 147053 | + } |
| 147054 | + |
| 147055 | + sqlite3VdbeAddOp3(v, OP_SeekRowid, csr, lbl, tmpReg); |
| 147056 | + VdbeCoverage(v); |
| 147057 | + sqlite3VdbeAddOp3(v, OP_Column, csr, pWin->iArgCol, pWin->regResult); |
| 147058 | + sqlite3VdbeResolveLabel(v, lbl); |
| 147059 | + sqlite3ReleaseTempReg(pParse, tmpReg); |
| 147060 | + } |
| 147061 | + } |
| 147062 | + } |
| 147063 | + sqlite3VdbeAddOp2(v, OP_Gosub, p->regGosub, p->addrGosub); |
| 146654 | 147064 | } |
| 146655 | 147065 | |
| 146656 | 147066 | /* |
| 146657 | 147067 | ** Generate code to set the accumulator register for each window function |
| 146658 | 147068 | ** in the linked list passed as the second argument to NULL. And perform |
| | @@ -146666,693 +147076,269 @@ |
| 146666 | 147076 | Window *pWin; |
| 146667 | 147077 | for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ |
| 146668 | 147078 | FuncDef *pFunc = pWin->pFunc; |
| 146669 | 147079 | sqlite3VdbeAddOp2(v, OP_Null, 0, pWin->regAccum); |
| 146670 | 147080 | nArg = MAX(nArg, windowArgCount(pWin)); |
| 146671 | | - if( pFunc->zName==nth_valueName |
| 146672 | | - || pFunc->zName==first_valueName |
| 146673 | | - ){ |
| 146674 | | - sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp); |
| 146675 | | - sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp+1); |
| 146676 | | - } |
| 146677 | | - |
| 146678 | | - if( (pFunc->funcFlags & SQLITE_FUNC_MINMAX) && pWin->csrApp ){ |
| 146679 | | - assert( pWin->eStart!=TK_UNBOUNDED ); |
| 146680 | | - sqlite3VdbeAddOp1(v, OP_ResetSorter, pWin->csrApp); |
| 146681 | | - sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp+1); |
| 147081 | + if( pMWin->regStartRowid==0 ){ |
| 147082 | + if( pFunc->zName==nth_valueName || pFunc->zName==first_valueName ){ |
| 147083 | + sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp); |
| 147084 | + sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp+1); |
| 147085 | + } |
| 147086 | + |
| 147087 | + if( (pFunc->funcFlags & SQLITE_FUNC_MINMAX) && pWin->csrApp ){ |
| 147088 | + assert( pWin->eStart!=TK_UNBOUNDED ); |
| 147089 | + sqlite3VdbeAddOp1(v, OP_ResetSorter, pWin->csrApp); |
| 147090 | + sqlite3VdbeAddOp2(v, OP_Integer, 0, pWin->regApp+1); |
| 147091 | + } |
| 146682 | 147092 | } |
| 146683 | 147093 | } |
| 146684 | 147094 | regArg = pParse->nMem+1; |
| 146685 | 147095 | pParse->nMem += nArg; |
| 146686 | 147096 | return regArg; |
| 146687 | 147097 | } |
| 146688 | 147098 | |
| 146689 | | - |
| 146690 | | -/* |
| 146691 | | -** This function does the work of sqlite3WindowCodeStep() for all "ROWS" |
| 146692 | | -** window frame types except for "BETWEEN UNBOUNDED PRECEDING AND CURRENT |
| 146693 | | -** ROW". Pseudo-code for each follows. |
| 146694 | | -** |
| 146695 | | -** ROWS BETWEEN <expr1> PRECEDING AND <expr2> FOLLOWING |
| 146696 | | -** |
| 146697 | | -** ... |
| 146698 | | -** if( new partition ){ |
| 146699 | | -** Gosub flush_partition |
| 146700 | | -** } |
| 146701 | | -** Insert (record in eph-table) |
| 146702 | | -** sqlite3WhereEnd() |
| 146703 | | -** Gosub flush_partition |
| 146704 | | -** |
| 146705 | | -** flush_partition: |
| 146706 | | -** Once { |
| 146707 | | -** OpenDup (iEphCsr -> csrStart) |
| 146708 | | -** OpenDup (iEphCsr -> csrEnd) |
| 146709 | | -** } |
| 146710 | | -** regStart = <expr1> // PRECEDING expression |
| 146711 | | -** regEnd = <expr2> // FOLLOWING expression |
| 146712 | | -** if( regStart<0 || regEnd<0 ){ error! } |
| 146713 | | -** Rewind (csr,csrStart,csrEnd) // if EOF goto flush_partition_done |
| 146714 | | -** Next(csrEnd) // if EOF skip Aggstep |
| 146715 | | -** Aggstep (csrEnd) |
| 146716 | | -** if( (regEnd--)<=0 ){ |
| 146717 | | -** AggFinal (xValue) |
| 146718 | | -** Gosub addrGosub |
| 146719 | | -** Next(csr) // if EOF goto flush_partition_done |
| 146720 | | -** if( (regStart--)<=0 ){ |
| 146721 | | -** AggInverse (csrStart) |
| 146722 | | -** Next(csrStart) |
| 146723 | | -** } |
| 146724 | | -** } |
| 146725 | | -** flush_partition_done: |
| 146726 | | -** ResetSorter (csr) |
| 146727 | | -** Return |
| 146728 | | -** |
| 146729 | | -** ROWS BETWEEN <expr> PRECEDING AND CURRENT ROW |
| 146730 | | -** ROWS BETWEEN CURRENT ROW AND <expr> FOLLOWING |
| 146731 | | -** ROWS BETWEEN UNBOUNDED PRECEDING AND <expr> FOLLOWING |
| 146732 | | -** |
| 146733 | | -** These are similar to the above. For "CURRENT ROW", intialize the |
| 146734 | | -** register to 0. For "UNBOUNDED PRECEDING" to infinity. |
| 146735 | | -** |
| 146736 | | -** ROWS BETWEEN <expr> PRECEDING AND UNBOUNDED FOLLOWING |
| 146737 | | -** ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING |
| 146738 | | -** |
| 146739 | | -** Rewind (csr,csrStart,csrEnd) // if EOF goto flush_partition_done |
| 146740 | | -** while( 1 ){ |
| 146741 | | -** Next(csrEnd) // Exit while(1) at EOF |
| 146742 | | -** Aggstep (csrEnd) |
| 146743 | | -** } |
| 146744 | | -** while( 1 ){ |
| 146745 | | -** AggFinal (xValue) |
| 146746 | | -** Gosub addrGosub |
| 146747 | | -** Next(csr) // if EOF goto flush_partition_done |
| 146748 | | -** if( (regStart--)<=0 ){ |
| 146749 | | -** AggInverse (csrStart) |
| 146750 | | -** Next(csrStart) |
| 146751 | | -** } |
| 146752 | | -** } |
| 146753 | | -** |
| 146754 | | -** For the "CURRENT ROW AND UNBOUNDED FOLLOWING" case, the final if() |
| 146755 | | -** condition is always true (as if regStart were initialized to 0). |
| 146756 | | -** |
| 146757 | | -** RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING |
| 146758 | | -** |
| 146759 | | -** This is the only RANGE case handled by this routine. It modifies the |
| 146760 | | -** second while( 1 ) loop in "ROWS BETWEEN CURRENT ... UNBOUNDED..." to |
| 146761 | | -** be: |
| 146762 | | -** |
| 146763 | | -** while( 1 ){ |
| 146764 | | -** AggFinal (xValue) |
| 146765 | | -** while( 1 ){ |
| 146766 | | -** regPeer++ |
| 146767 | | -** Gosub addrGosub |
| 146768 | | -** Next(csr) // if EOF goto flush_partition_done |
| 146769 | | -** if( new peer ) break; |
| 146770 | | -** } |
| 146771 | | -** while( (regPeer--)>0 ){ |
| 146772 | | -** AggInverse (csrStart) |
| 146773 | | -** Next(csrStart) |
| 146774 | | -** } |
| 146775 | | -** } |
| 146776 | | -** |
| 146777 | | -** ROWS BETWEEN <expr> FOLLOWING AND <expr> FOLLOWING |
| 146778 | | -** |
| 146779 | | -** regEnd = regEnd - regStart |
| 146780 | | -** Rewind (csr,csrStart,csrEnd) // if EOF goto flush_partition_done |
| 146781 | | -** Aggstep (csrEnd) |
| 146782 | | -** Next(csrEnd) // if EOF fall-through |
| 146783 | | -** if( (regEnd--)<=0 ){ |
| 146784 | | -** if( (regStart--)<=0 ){ |
| 146785 | | -** AggFinal (xValue) |
| 146786 | | -** Gosub addrGosub |
| 146787 | | -** Next(csr) // if EOF goto flush_partition_done |
| 146788 | | -** } |
| 146789 | | -** AggInverse (csrStart) |
| 146790 | | -** Next (csrStart) |
| 146791 | | -** } |
| 146792 | | -** |
| 146793 | | -** ROWS BETWEEN <expr> PRECEDING AND <expr> PRECEDING |
| 146794 | | -** |
| 146795 | | -** Replace the bit after "Rewind" in the above with: |
| 146796 | | -** |
| 146797 | | -** if( (regEnd--)<=0 ){ |
| 146798 | | -** AggStep (csrEnd) |
| 146799 | | -** Next (csrEnd) |
| 146800 | | -** } |
| 146801 | | -** AggFinal (xValue) |
| 146802 | | -** Gosub addrGosub |
| 146803 | | -** Next(csr) // if EOF goto flush_partition_done |
| 146804 | | -** if( (regStart--)<=0 ){ |
| 146805 | | -** AggInverse (csr2) |
| 146806 | | -** Next (csr2) |
| 146807 | | -** } |
| 146808 | | -** |
| 146809 | | -*/ |
| 146810 | | -static void windowCodeRowExprStep( |
| 146811 | | - Parse *pParse, |
| 146812 | | - Select *p, |
| 146813 | | - WhereInfo *pWInfo, |
| 146814 | | - int regGosub, |
| 146815 | | - int addrGosub |
| 146816 | | -){ |
| 146817 | | - Window *pMWin = p->pWin; |
| 146818 | | - Vdbe *v = sqlite3GetVdbe(pParse); |
| 146819 | | - int regFlushPart; /* Register for "Gosub flush_partition" */ |
| 146820 | | - int lblFlushPart; /* Label for "Gosub flush_partition" */ |
| 146821 | | - int lblFlushDone; /* Label for "Gosub flush_partition_done" */ |
| 146822 | | - |
| 146823 | | - int regArg; |
| 146824 | | - int addr; |
| 146825 | | - int csrStart = pParse->nTab++; |
| 146826 | | - int csrEnd = pParse->nTab++; |
| 146827 | | - int regStart; /* Value of <expr> PRECEDING */ |
| 146828 | | - int regEnd; /* Value of <expr> FOLLOWING */ |
| 146829 | | - int addrGoto; |
| 146830 | | - int addrTop; |
| 146831 | | - int addrIfPos1 = 0; |
| 146832 | | - int addrIfPos2 = 0; |
| 146833 | | - int regSize = 0; |
| 146834 | | - |
| 146835 | | - assert( pMWin->eStart==TK_PRECEDING |
| 146836 | | - || pMWin->eStart==TK_CURRENT |
| 146837 | | - || pMWin->eStart==TK_FOLLOWING |
| 146838 | | - || pMWin->eStart==TK_UNBOUNDED |
| 146839 | | - ); |
| 146840 | | - assert( pMWin->eEnd==TK_FOLLOWING |
| 146841 | | - || pMWin->eEnd==TK_CURRENT |
| 146842 | | - || pMWin->eEnd==TK_UNBOUNDED |
| 146843 | | - || pMWin->eEnd==TK_PRECEDING |
| 146844 | | - ); |
| 146845 | | - |
| 146846 | | - /* Allocate register and label for the "flush_partition" sub-routine. */ |
| 146847 | | - regFlushPart = ++pParse->nMem; |
| 146848 | | - lblFlushPart = sqlite3VdbeMakeLabel(pParse); |
| 146849 | | - lblFlushDone = sqlite3VdbeMakeLabel(pParse); |
| 146850 | | - |
| 146851 | | - regStart = ++pParse->nMem; |
| 146852 | | - regEnd = ++pParse->nMem; |
| 146853 | | - |
| 146854 | | - windowPartitionCache(pParse, p, pWInfo, regFlushPart, lblFlushPart, ®Size); |
| 146855 | | - |
| 146856 | | - addrGoto = sqlite3VdbeAddOp0(v, OP_Goto); |
| 146857 | | - |
| 146858 | | - /* Start of "flush_partition" */ |
| 146859 | | - sqlite3VdbeResolveLabel(v, lblFlushPart); |
| 146860 | | - sqlite3VdbeAddOp2(v, OP_Once, 0, sqlite3VdbeCurrentAddr(v)+3); |
| 146861 | | - VdbeCoverage(v); |
| 146862 | | - VdbeComment((v, "Flush_partition subroutine")); |
| 146863 | | - sqlite3VdbeAddOp2(v, OP_OpenDup, csrStart, pMWin->iEphCsr); |
| 146864 | | - sqlite3VdbeAddOp2(v, OP_OpenDup, csrEnd, pMWin->iEphCsr); |
| 146865 | | - |
| 146866 | | - /* If either regStart or regEnd are not non-negative integers, throw |
| 146867 | | - ** an exception. */ |
| 146868 | | - if( pMWin->pStart ){ |
| 146869 | | - sqlite3ExprCode(pParse, pMWin->pStart, regStart); |
| 146870 | | - windowCheckIntValue(pParse, regStart, 0); |
| 146871 | | - } |
| 146872 | | - if( pMWin->pEnd ){ |
| 146873 | | - sqlite3ExprCode(pParse, pMWin->pEnd, regEnd); |
| 146874 | | - windowCheckIntValue(pParse, regEnd, 1); |
| 146875 | | - } |
| 146876 | | - |
| 146877 | | - /* If this is "ROWS <expr1> FOLLOWING AND ROWS <expr2> FOLLOWING", do: |
| 146878 | | - ** |
| 146879 | | - ** if( regEnd<regStart ){ |
| 146880 | | - ** // The frame always consists of 0 rows |
| 146881 | | - ** regStart = regSize; |
| 146882 | | - ** } |
| 146883 | | - ** regEnd = regEnd - regStart; |
| 146884 | | - */ |
| 146885 | | - if( pMWin->pEnd && pMWin->eStart==TK_FOLLOWING ){ |
| 146886 | | - assert( pMWin->pStart!=0 ); |
| 146887 | | - assert( pMWin->eEnd==TK_FOLLOWING ); |
| 146888 | | - sqlite3VdbeAddOp3(v, OP_Ge, regStart, sqlite3VdbeCurrentAddr(v)+2, regEnd); |
| 146889 | | - VdbeCoverageNeverNull(v); |
| 146890 | | - sqlite3VdbeAddOp2(v, OP_Copy, regSize, regStart); |
| 146891 | | - sqlite3VdbeAddOp3(v, OP_Subtract, regStart, regEnd, regEnd); |
| 146892 | | - } |
| 146893 | | - |
| 146894 | | - if( pMWin->pStart && pMWin->eEnd==TK_PRECEDING ){ |
| 146895 | | - assert( pMWin->pEnd!=0 ); |
| 146896 | | - assert( pMWin->eStart==TK_PRECEDING ); |
| 146897 | | - sqlite3VdbeAddOp3(v, OP_Le, regStart, sqlite3VdbeCurrentAddr(v)+3, regEnd); |
| 146898 | | - VdbeCoverageNeverNull(v); |
| 146899 | | - sqlite3VdbeAddOp2(v, OP_Copy, regSize, regStart); |
| 146900 | | - sqlite3VdbeAddOp2(v, OP_Copy, regSize, regEnd); |
| 146901 | | - } |
| 146902 | | - |
| 146903 | | - /* Initialize the accumulator register for each window function to NULL */ |
| 146904 | | - regArg = windowInitAccum(pParse, pMWin); |
| 146905 | | - |
| 146906 | | - sqlite3VdbeAddOp2(v, OP_Rewind, pMWin->iEphCsr, lblFlushDone); |
| 146907 | | - VdbeCoverage(v); |
| 146908 | | - sqlite3VdbeAddOp2(v, OP_Rewind, csrStart, lblFlushDone); |
| 146909 | | - VdbeCoverageNeverTaken(v); |
| 146910 | | - sqlite3VdbeChangeP5(v, 1); |
| 146911 | | - sqlite3VdbeAddOp2(v, OP_Rewind, csrEnd, lblFlushDone); |
| 146912 | | - VdbeCoverageNeverTaken(v); |
| 146913 | | - sqlite3VdbeChangeP5(v, 1); |
| 146914 | | - |
| 146915 | | - /* Invoke AggStep function for each window function using the row that |
| 146916 | | - ** csrEnd currently points to. Or, if csrEnd is already at EOF, |
| 146917 | | - ** do nothing. */ |
| 146918 | | - addrTop = sqlite3VdbeCurrentAddr(v); |
| 146919 | | - if( pMWin->eEnd==TK_PRECEDING ){ |
| 146920 | | - addrIfPos1 = sqlite3VdbeAddOp3(v, OP_IfPos, regEnd, 0 , 1); |
| 146921 | | - VdbeCoverage(v); |
| 146922 | | - } |
| 146923 | | - sqlite3VdbeAddOp2(v, OP_Next, csrEnd, sqlite3VdbeCurrentAddr(v)+2); |
| 146924 | | - VdbeCoverage(v); |
| 146925 | | - addr = sqlite3VdbeAddOp0(v, OP_Goto); |
| 146926 | | - windowAggStep(pParse, pMWin, csrEnd, 0, regArg, regSize); |
| 146927 | | - if( pMWin->eEnd==TK_UNBOUNDED ){ |
| 146928 | | - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrTop); |
| 146929 | | - sqlite3VdbeJumpHere(v, addr); |
| 146930 | | - addrTop = sqlite3VdbeCurrentAddr(v); |
| 146931 | | - }else{ |
| 146932 | | - sqlite3VdbeJumpHere(v, addr); |
| 146933 | | - if( pMWin->eEnd==TK_PRECEDING ){ |
| 146934 | | - sqlite3VdbeJumpHere(v, addrIfPos1); |
| 146935 | | - } |
| 146936 | | - } |
| 146937 | | - |
| 146938 | | - if( pMWin->eEnd==TK_FOLLOWING ){ |
| 146939 | | - addrIfPos1 = sqlite3VdbeAddOp3(v, OP_IfPos, regEnd, 0 , 1); |
| 146940 | | - VdbeCoverage(v); |
| 146941 | | - } |
| 146942 | | - if( pMWin->eStart==TK_FOLLOWING ){ |
| 146943 | | - addrIfPos2 = sqlite3VdbeAddOp3(v, OP_IfPos, regStart, 0 , 1); |
| 146944 | | - VdbeCoverage(v); |
| 146945 | | - } |
| 146946 | | - windowAggFinal(pParse, pMWin, 0); |
| 146947 | | - windowReturnOneRow(pParse, pMWin, regGosub, addrGosub); |
| 146948 | | - sqlite3VdbeAddOp2(v, OP_Next, pMWin->iEphCsr, sqlite3VdbeCurrentAddr(v)+2); |
| 146949 | | - VdbeCoverage(v); |
| 146950 | | - sqlite3VdbeAddOp2(v, OP_Goto, 0, lblFlushDone); |
| 146951 | | - if( pMWin->eStart==TK_FOLLOWING ){ |
| 146952 | | - sqlite3VdbeJumpHere(v, addrIfPos2); |
| 146953 | | - } |
| 146954 | | - |
| 146955 | | - if( pMWin->eStart==TK_CURRENT |
| 146956 | | - || pMWin->eStart==TK_PRECEDING |
| 146957 | | - || pMWin->eStart==TK_FOLLOWING |
| 146958 | | - ){ |
| 146959 | | - int lblSkipInverse = sqlite3VdbeMakeLabel(pParse);; |
| 146960 | | - if( pMWin->eStart==TK_PRECEDING ){ |
| 146961 | | - sqlite3VdbeAddOp3(v, OP_IfPos, regStart, lblSkipInverse, 1); |
| 146962 | | - VdbeCoverage(v); |
| 146963 | | - } |
| 146964 | | - if( pMWin->eStart==TK_FOLLOWING ){ |
| 146965 | | - sqlite3VdbeAddOp2(v, OP_Next, csrStart, sqlite3VdbeCurrentAddr(v)+2); |
| 146966 | | - VdbeCoverage(v); |
| 146967 | | - sqlite3VdbeAddOp2(v, OP_Goto, 0, lblSkipInverse); |
| 146968 | | - }else{ |
| 146969 | | - sqlite3VdbeAddOp2(v, OP_Next, csrStart, sqlite3VdbeCurrentAddr(v)+1); |
| 146970 | | - VdbeCoverageAlwaysTaken(v); |
| 146971 | | - } |
| 146972 | | - windowAggStep(pParse, pMWin, csrStart, 1, regArg, regSize); |
| 146973 | | - sqlite3VdbeResolveLabel(v, lblSkipInverse); |
| 146974 | | - } |
| 146975 | | - if( pMWin->eEnd==TK_FOLLOWING ){ |
| 146976 | | - sqlite3VdbeJumpHere(v, addrIfPos1); |
| 146977 | | - } |
| 146978 | | - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrTop); |
| 146979 | | - |
| 146980 | | - /* flush_partition_done: */ |
| 146981 | | - sqlite3VdbeResolveLabel(v, lblFlushDone); |
| 146982 | | - sqlite3VdbeAddOp1(v, OP_ResetSorter, pMWin->iEphCsr); |
| 146983 | | - sqlite3VdbeAddOp1(v, OP_Return, regFlushPart); |
| 146984 | | - VdbeComment((v, "end flush_partition subroutine")); |
| 146985 | | - |
| 146986 | | - /* Jump to here to skip over flush_partition */ |
| 146987 | | - sqlite3VdbeJumpHere(v, addrGoto); |
| 146988 | | -} |
| 146989 | | - |
| 146990 | | -/* |
| 146991 | | -** This function does the work of sqlite3WindowCodeStep() for cases that |
| 146992 | | -** would normally be handled by windowCodeDefaultStep() when there are |
| 146993 | | -** one or more built-in window-functions that require the entire partition |
| 146994 | | -** to be cached in a temp table before any rows can be returned. Additionally. |
| 146995 | | -** "RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING" is always handled by |
| 146996 | | -** this function. |
| 146997 | | -** |
| 146998 | | -** Pseudo-code corresponding to the VM code generated by this function |
| 146999 | | -** for each type of window follows. |
| 147000 | | -** |
| 147001 | | -** RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW |
| 147002 | | -** |
| 147003 | | -** flush_partition: |
| 147004 | | -** Once { |
| 147005 | | -** OpenDup (iEphCsr -> csrLead) |
| 147006 | | -** } |
| 147007 | | -** Integer ctr 0 |
| 147008 | | -** foreach row (csrLead){ |
| 147009 | | -** if( new peer ){ |
| 147010 | | -** AggFinal (xValue) |
| 147011 | | -** for(i=0; i<ctr; i++){ |
| 147012 | | -** Gosub addrGosub |
| 147013 | | -** Next iEphCsr |
| 147014 | | -** } |
| 147015 | | -** Integer ctr 0 |
| 147016 | | -** } |
| 147017 | | -** AggStep (csrLead) |
| 147018 | | -** Incr ctr |
| 147019 | | -** } |
| 147020 | | -** |
| 147021 | | -** AggFinal (xFinalize) |
| 147022 | | -** for(i=0; i<ctr; i++){ |
| 147023 | | -** Gosub addrGosub |
| 147024 | | -** Next iEphCsr |
| 147025 | | -** } |
| 147026 | | -** |
| 147027 | | -** ResetSorter (csr) |
| 147028 | | -** Return |
| 147029 | | -** |
| 147030 | | -** ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW |
| 147031 | | -** |
| 147032 | | -** As above, except that the "if( new peer )" branch is always taken. |
| 147033 | | -** |
| 147034 | | -** RANGE BETWEEN CURRENT ROW AND CURRENT ROW |
| 147035 | | -** |
| 147036 | | -** As above, except that each of the for() loops becomes: |
| 147037 | | -** |
| 147038 | | -** for(i=0; i<ctr; i++){ |
| 147039 | | -** Gosub addrGosub |
| 147040 | | -** AggInverse (iEphCsr) |
| 147041 | | -** Next iEphCsr |
| 147042 | | -** } |
| 147043 | | -** |
| 147044 | | -** RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING |
| 147045 | | -** |
| 147046 | | -** flush_partition: |
| 147047 | | -** Once { |
| 147048 | | -** OpenDup (iEphCsr -> csrLead) |
| 147049 | | -** } |
| 147050 | | -** foreach row (csrLead) { |
| 147051 | | -** AggStep (csrLead) |
| 147052 | | -** } |
| 147053 | | -** foreach row (iEphCsr) { |
| 147054 | | -** Gosub addrGosub |
| 147055 | | -** } |
| 147056 | | -** |
| 147057 | | -** RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING |
| 147058 | | -** |
| 147059 | | -** flush_partition: |
| 147060 | | -** Once { |
| 147061 | | -** OpenDup (iEphCsr -> csrLead) |
| 147062 | | -** } |
| 147063 | | -** foreach row (csrLead){ |
| 147064 | | -** AggStep (csrLead) |
| 147065 | | -** } |
| 147066 | | -** Rewind (csrLead) |
| 147067 | | -** Integer ctr 0 |
| 147068 | | -** foreach row (csrLead){ |
| 147069 | | -** if( new peer ){ |
| 147070 | | -** AggFinal (xValue) |
| 147071 | | -** for(i=0; i<ctr; i++){ |
| 147072 | | -** Gosub addrGosub |
| 147073 | | -** AggInverse (iEphCsr) |
| 147074 | | -** Next iEphCsr |
| 147075 | | -** } |
| 147076 | | -** Integer ctr 0 |
| 147077 | | -** } |
| 147078 | | -** Incr ctr |
| 147079 | | -** } |
| 147080 | | -** |
| 147081 | | -** AggFinal (xFinalize) |
| 147082 | | -** for(i=0; i<ctr; i++){ |
| 147083 | | -** Gosub addrGosub |
| 147084 | | -** Next iEphCsr |
| 147085 | | -** } |
| 147086 | | -** |
| 147087 | | -** ResetSorter (csr) |
| 147088 | | -** Return |
| 147089 | | -*/ |
| 147090 | | -static void windowCodeCacheStep( |
| 147091 | | - Parse *pParse, |
| 147092 | | - Select *p, |
| 147093 | | - WhereInfo *pWInfo, |
| 147094 | | - int regGosub, |
| 147095 | | - int addrGosub |
| 147096 | | -){ |
| 147097 | | - Window *pMWin = p->pWin; |
| 147098 | | - Vdbe *v = sqlite3GetVdbe(pParse); |
| 147099 | | - int k; |
| 147100 | | - int addr; |
| 147101 | | - ExprList *pPart = pMWin->pPartition; |
| 147102 | | - ExprList *pOrderBy = pMWin->pOrderBy; |
| 147103 | | - int nPeer = pOrderBy ? pOrderBy->nExpr : 0; |
| 147104 | | - int regNewPeer; |
| 147105 | | - |
| 147106 | | - int addrGoto; /* Address of Goto used to jump flush_par.. */ |
| 147107 | | - int addrNext; /* Jump here for next iteration of loop */ |
| 147108 | | - int regFlushPart; |
| 147109 | | - int lblFlushPart; |
| 147110 | | - int csrLead; |
| 147111 | | - int regCtr; |
| 147112 | | - int regArg; /* Register array to martial function args */ |
| 147113 | | - int regSize; |
| 147114 | | - int lblEmpty; |
| 147115 | | - int bReverse = pMWin->pOrderBy && pMWin->eStart==TK_CURRENT |
| 147116 | | - && pMWin->eEnd==TK_UNBOUNDED; |
| 147117 | | - |
| 147118 | | - assert( (pMWin->eStart==TK_UNBOUNDED && pMWin->eEnd==TK_CURRENT) |
| 147119 | | - || (pMWin->eStart==TK_UNBOUNDED && pMWin->eEnd==TK_UNBOUNDED) |
| 147120 | | - || (pMWin->eStart==TK_CURRENT && pMWin->eEnd==TK_CURRENT) |
| 147121 | | - || (pMWin->eStart==TK_CURRENT && pMWin->eEnd==TK_UNBOUNDED) |
| 147122 | | - ); |
| 147123 | | - |
| 147124 | | - lblEmpty = sqlite3VdbeMakeLabel(pParse); |
| 147125 | | - regNewPeer = pParse->nMem+1; |
| 147126 | | - pParse->nMem += nPeer; |
| 147127 | | - |
| 147128 | | - /* Allocate register and label for the "flush_partition" sub-routine. */ |
| 147129 | | - regFlushPart = ++pParse->nMem; |
| 147130 | | - lblFlushPart = sqlite3VdbeMakeLabel(pParse); |
| 147131 | | - |
| 147132 | | - csrLead = pParse->nTab++; |
| 147133 | | - regCtr = ++pParse->nMem; |
| 147134 | | - |
| 147135 | | - windowPartitionCache(pParse, p, pWInfo, regFlushPart, lblFlushPart, ®Size); |
| 147136 | | - addrGoto = sqlite3VdbeAddOp0(v, OP_Goto); |
| 147137 | | - |
| 147138 | | - /* Start of "flush_partition" */ |
| 147139 | | - sqlite3VdbeResolveLabel(v, lblFlushPart); |
| 147140 | | - sqlite3VdbeAddOp2(v, OP_Once, 0, sqlite3VdbeCurrentAddr(v)+2); |
| 147141 | | - VdbeCoverage(v); |
| 147142 | | - sqlite3VdbeAddOp2(v, OP_OpenDup, csrLead, pMWin->iEphCsr); |
| 147143 | | - |
| 147144 | | - /* Initialize the accumulator register for each window function to NULL */ |
| 147145 | | - regArg = windowInitAccum(pParse, pMWin); |
| 147146 | | - |
| 147147 | | - sqlite3VdbeAddOp2(v, OP_Integer, 0, regCtr); |
| 147148 | | - sqlite3VdbeAddOp2(v, OP_Rewind, csrLead, lblEmpty); |
| 147149 | | - VdbeCoverage(v); |
| 147150 | | - sqlite3VdbeAddOp2(v, OP_Rewind, pMWin->iEphCsr, lblEmpty); |
| 147151 | | - VdbeCoverageNeverTaken(v); |
| 147152 | | - |
| 147153 | | - if( bReverse ){ |
| 147154 | | - int addr2 = sqlite3VdbeCurrentAddr(v); |
| 147155 | | - windowAggStep(pParse, pMWin, csrLead, 0, regArg, regSize); |
| 147156 | | - sqlite3VdbeAddOp2(v, OP_Next, csrLead, addr2); |
| 147157 | | - VdbeCoverage(v); |
| 147158 | | - sqlite3VdbeAddOp2(v, OP_Rewind, csrLead, lblEmpty); |
| 147159 | | - VdbeCoverageNeverTaken(v); |
| 147160 | | - } |
| 147161 | | - addrNext = sqlite3VdbeCurrentAddr(v); |
| 147162 | | - |
| 147163 | | - if( pOrderBy && (pMWin->eEnd==TK_CURRENT || pMWin->eStart==TK_CURRENT) ){ |
| 147164 | | - int bCurrent = (pMWin->eStart==TK_CURRENT); |
| 147165 | | - int addrJump = 0; /* Address of OP_Jump below */ |
| 147166 | | - if( pMWin->eType==TK_RANGE ){ |
| 147167 | | - int iOff = pMWin->nBufferCol + (pPart ? pPart->nExpr : 0); |
| 147168 | | - int regPeer = pMWin->regPart + (pPart ? pPart->nExpr : 0); |
| 147169 | | - KeyInfo *pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pOrderBy, 0, 0); |
| 147170 | | - for(k=0; k<nPeer; k++){ |
| 147171 | | - sqlite3VdbeAddOp3(v, OP_Column, csrLead, iOff+k, regNewPeer+k); |
| 147172 | | - } |
| 147173 | | - addr = sqlite3VdbeAddOp3(v, OP_Compare, regNewPeer, regPeer, nPeer); |
| 147174 | | - sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO); |
| 147175 | | - addrJump = sqlite3VdbeAddOp3(v, OP_Jump, addr+2, 0, addr+2); |
| 147176 | | - VdbeCoverage(v); |
| 147177 | | - sqlite3VdbeAddOp3(v, OP_Copy, regNewPeer, regPeer, nPeer-1); |
| 147178 | | - } |
| 147179 | | - |
| 147180 | | - windowReturnRows(pParse, pMWin, regCtr, regGosub, addrGosub, |
| 147181 | | - (bCurrent ? regArg : 0), (bCurrent ? regSize : 0) |
| 147182 | | - ); |
| 147183 | | - if( addrJump ) sqlite3VdbeJumpHere(v, addrJump); |
| 147184 | | - } |
| 147185 | | - |
| 147186 | | - if( bReverse==0 ){ |
| 147187 | | - windowAggStep(pParse, pMWin, csrLead, 0, regArg, regSize); |
| 147188 | | - } |
| 147189 | | - sqlite3VdbeAddOp2(v, OP_AddImm, regCtr, 1); |
| 147190 | | - sqlite3VdbeAddOp2(v, OP_Next, csrLead, addrNext); |
| 147191 | | - VdbeCoverage(v); |
| 147192 | | - |
| 147193 | | - windowReturnRows(pParse, pMWin, regCtr, regGosub, addrGosub, 0, 0); |
| 147194 | | - |
| 147195 | | - sqlite3VdbeResolveLabel(v, lblEmpty); |
| 147196 | | - sqlite3VdbeAddOp1(v, OP_ResetSorter, pMWin->iEphCsr); |
| 147197 | | - sqlite3VdbeAddOp1(v, OP_Return, regFlushPart); |
| 147198 | | - |
| 147199 | | - /* Jump to here to skip over flush_partition */ |
| 147200 | | - sqlite3VdbeJumpHere(v, addrGoto); |
| 147201 | | -} |
| 147202 | | - |
| 147203 | | - |
| 147204 | | -/* |
| 147205 | | -** RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW |
| 147206 | | -** |
| 147207 | | -** ... |
| 147208 | | -** if( new partition ){ |
| 147209 | | -** AggFinal (xFinalize) |
| 147210 | | -** Gosub addrGosub |
| 147211 | | -** ResetSorter eph-table |
| 147212 | | -** } |
| 147213 | | -** else if( new peer ){ |
| 147214 | | -** AggFinal (xValue) |
| 147215 | | -** Gosub addrGosub |
| 147216 | | -** ResetSorter eph-table |
| 147217 | | -** } |
| 147218 | | -** AggStep |
| 147219 | | -** Insert (record into eph-table) |
| 147220 | | -** sqlite3WhereEnd() |
| 147221 | | -** AggFinal (xFinalize) |
| 147222 | | -** Gosub addrGosub |
| 147223 | | -** |
| 147224 | | -** RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING |
| 147225 | | -** |
| 147226 | | -** As above, except take no action for a "new peer". Invoke |
| 147227 | | -** the sub-routine once only for each partition. |
| 147228 | | -** |
| 147229 | | -** RANGE BETWEEN CURRENT ROW AND CURRENT ROW |
| 147230 | | -** |
| 147231 | | -** As above, except that the "new peer" condition is handled in the |
| 147232 | | -** same way as "new partition" (so there is no "else if" block). |
| 147233 | | -** |
| 147234 | | -** ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW |
| 147235 | | -** |
| 147236 | | -** As above, except assume every row is a "new peer". |
| 147237 | | -*/ |
| 147238 | | -static void windowCodeDefaultStep( |
| 147239 | | - Parse *pParse, |
| 147240 | | - Select *p, |
| 147241 | | - WhereInfo *pWInfo, |
| 147242 | | - int regGosub, |
| 147243 | | - int addrGosub |
| 147244 | | -){ |
| 147245 | | - Window *pMWin = p->pWin; |
| 147246 | | - Vdbe *v = sqlite3GetVdbe(pParse); |
| 147247 | | - int k; |
| 147248 | | - int iSubCsr = p->pSrc->a[0].iCursor; |
| 147249 | | - int nSub = p->pSrc->a[0].pTab->nCol; |
| 147250 | | - int reg = pParse->nMem+1; |
| 147251 | | - int regRecord = reg+nSub; |
| 147252 | | - int regRowid = regRecord+1; |
| 147253 | | - int addr; |
| 147254 | | - ExprList *pPart = pMWin->pPartition; |
| 147255 | | - ExprList *pOrderBy = pMWin->pOrderBy; |
| 147256 | | - |
| 147257 | | - assert( pMWin->eType==TK_RANGE |
| 147258 | | - || (pMWin->eStart==TK_UNBOUNDED && pMWin->eEnd==TK_CURRENT) |
| 147259 | | - ); |
| 147260 | | - |
| 147261 | | - assert( (pMWin->eStart==TK_UNBOUNDED && pMWin->eEnd==TK_CURRENT) |
| 147262 | | - || (pMWin->eStart==TK_UNBOUNDED && pMWin->eEnd==TK_UNBOUNDED) |
| 147263 | | - || (pMWin->eStart==TK_CURRENT && pMWin->eEnd==TK_CURRENT) |
| 147264 | | - || (pMWin->eStart==TK_CURRENT && pMWin->eEnd==TK_UNBOUNDED && !pOrderBy) |
| 147265 | | - ); |
| 147266 | | - |
| 147267 | | - if( pMWin->eEnd==TK_UNBOUNDED ){ |
| 147268 | | - pOrderBy = 0; |
| 147269 | | - } |
| 147270 | | - |
| 147271 | | - pParse->nMem += nSub + 2; |
| 147272 | | - |
| 147273 | | - /* Load the individual column values of the row returned by |
| 147274 | | - ** the sub-select into an array of registers. */ |
| 147275 | | - for(k=0; k<nSub; k++){ |
| 147276 | | - sqlite3VdbeAddOp3(v, OP_Column, iSubCsr, k, reg+k); |
| 147277 | | - } |
| 147278 | | - |
| 147279 | | - /* Check if this is the start of a new partition or peer group. */ |
| 147280 | | - if( pPart || pOrderBy ){ |
| 147281 | | - int nPart = (pPart ? pPart->nExpr : 0); |
| 147282 | | - int addrGoto = 0; |
| 147283 | | - int addrJump = 0; |
| 147284 | | - int nPeer = (pOrderBy ? pOrderBy->nExpr : 0); |
| 147285 | | - |
| 147286 | | - if( pPart ){ |
| 147287 | | - int regNewPart = reg + pMWin->nBufferCol; |
| 147288 | | - KeyInfo *pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pPart, 0, 0); |
| 147289 | | - addr = sqlite3VdbeAddOp3(v, OP_Compare, regNewPart, pMWin->regPart,nPart); |
| 147290 | | - sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO); |
| 147291 | | - addrJump = sqlite3VdbeAddOp3(v, OP_Jump, addr+2, 0, addr+2); |
| 147292 | | - VdbeCoverageEqNe(v); |
| 147293 | | - windowAggFinal(pParse, pMWin, 1); |
| 147294 | | - if( pOrderBy ){ |
| 147295 | | - addrGoto = sqlite3VdbeAddOp0(v, OP_Goto); |
| 147296 | | - } |
| 147297 | | - } |
| 147298 | | - |
| 147299 | | - if( pOrderBy ){ |
| 147300 | | - int regNewPeer = reg + pMWin->nBufferCol + nPart; |
| 147301 | | - int regPeer = pMWin->regPart + nPart; |
| 147302 | | - |
| 147303 | | - if( addrJump ) sqlite3VdbeJumpHere(v, addrJump); |
| 147304 | | - if( pMWin->eType==TK_RANGE ){ |
| 147305 | | - KeyInfo *pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pOrderBy, 0, 0); |
| 147306 | | - addr = sqlite3VdbeAddOp3(v, OP_Compare, regNewPeer, regPeer, nPeer); |
| 147307 | | - sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO); |
| 147308 | | - addrJump = sqlite3VdbeAddOp3(v, OP_Jump, addr+2, 0, addr+2); |
| 147309 | | - VdbeCoverage(v); |
| 147310 | | - }else{ |
| 147311 | | - addrJump = 0; |
| 147312 | | - } |
| 147313 | | - windowAggFinal(pParse, pMWin, pMWin->eStart==TK_CURRENT); |
| 147314 | | - if( addrGoto ) sqlite3VdbeJumpHere(v, addrGoto); |
| 147315 | | - } |
| 147316 | | - |
| 147317 | | - sqlite3VdbeAddOp2(v, OP_Rewind, pMWin->iEphCsr,sqlite3VdbeCurrentAddr(v)+3); |
| 147318 | | - VdbeCoverage(v); |
| 147319 | | - sqlite3VdbeAddOp2(v, OP_Gosub, regGosub, addrGosub); |
| 147320 | | - sqlite3VdbeAddOp2(v, OP_Next, pMWin->iEphCsr, sqlite3VdbeCurrentAddr(v)-1); |
| 147321 | | - VdbeCoverage(v); |
| 147322 | | - |
| 147323 | | - sqlite3VdbeAddOp1(v, OP_ResetSorter, pMWin->iEphCsr); |
| 147324 | | - sqlite3VdbeAddOp3( |
| 147325 | | - v, OP_Copy, reg+pMWin->nBufferCol, pMWin->regPart, nPart+nPeer-1 |
| 147326 | | - ); |
| 147327 | | - |
| 147328 | | - if( addrJump ) sqlite3VdbeJumpHere(v, addrJump); |
| 147329 | | - } |
| 147330 | | - |
| 147331 | | - /* Invoke step function for window functions */ |
| 147332 | | - windowAggStep(pParse, pMWin, -1, 0, reg, 0); |
| 147333 | | - |
| 147334 | | - /* Buffer the current row in the ephemeral table. */ |
| 147335 | | - if( pMWin->nBufferCol>0 ){ |
| 147336 | | - sqlite3VdbeAddOp3(v, OP_MakeRecord, reg, pMWin->nBufferCol, regRecord); |
| 147337 | | - }else{ |
| 147338 | | - sqlite3VdbeAddOp2(v, OP_Blob, 0, regRecord); |
| 147339 | | - sqlite3VdbeAppendP4(v, (void*)"", 0); |
| 147340 | | - } |
| 147341 | | - sqlite3VdbeAddOp2(v, OP_NewRowid, pMWin->iEphCsr, regRowid); |
| 147342 | | - sqlite3VdbeAddOp3(v, OP_Insert, pMWin->iEphCsr, regRecord, regRowid); |
| 147343 | | - |
| 147344 | | - /* End the database scan loop. */ |
| 147345 | | - sqlite3WhereEnd(pWInfo); |
| 147346 | | - |
| 147347 | | - windowAggFinal(pParse, pMWin, 1); |
| 147348 | | - sqlite3VdbeAddOp2(v, OP_Rewind, pMWin->iEphCsr,sqlite3VdbeCurrentAddr(v)+3); |
| 147349 | | - VdbeCoverage(v); |
| 147350 | | - sqlite3VdbeAddOp2(v, OP_Gosub, regGosub, addrGosub); |
| 147351 | | - sqlite3VdbeAddOp2(v, OP_Next, pMWin->iEphCsr, sqlite3VdbeCurrentAddr(v)-1); |
| 147352 | | - VdbeCoverage(v); |
| 147353 | | -} |
| 147099 | +/* |
| 147100 | +** Return true if the current frame should be cached in the ephemeral table, |
| 147101 | +** even if there are no xInverse() calls required. |
| 147102 | +*/ |
| 147103 | +static int windowCacheFrame(Window *pMWin){ |
| 147104 | + Window *pWin; |
| 147105 | + if( pMWin->regStartRowid ) return 1; |
| 147106 | + for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ |
| 147107 | + FuncDef *pFunc = pWin->pFunc; |
| 147108 | + if( (pFunc->zName==nth_valueName) |
| 147109 | + || (pFunc->zName==first_valueName) |
| 147110 | + || (pFunc->zName==leadName) |
| 147111 | + || (pFunc->zName==lagName) |
| 147112 | + ){ |
| 147113 | + return 1; |
| 147114 | + } |
| 147115 | + } |
| 147116 | + return 0; |
| 147117 | +} |
| 147118 | + |
| 147119 | +/* |
| 147120 | +** regOld and regNew are each the first register in an array of size |
| 147121 | +** pOrderBy->nExpr. This function generates code to compare the two |
| 147122 | +** arrays of registers using the collation sequences and other comparison |
| 147123 | +** parameters specified by pOrderBy. |
| 147124 | +** |
| 147125 | +** If the two arrays are not equal, the contents of regNew is copied to |
| 147126 | +** regOld and control falls through. Otherwise, if the contents of the arrays |
| 147127 | +** are equal, an OP_Goto is executed. The address of the OP_Goto is returned. |
| 147128 | +*/ |
| 147129 | +static void windowIfNewPeer( |
| 147130 | + Parse *pParse, |
| 147131 | + ExprList *pOrderBy, |
| 147132 | + int regNew, /* First in array of new values */ |
| 147133 | + int regOld, /* First in array of old values */ |
| 147134 | + int addr /* Jump here */ |
| 147135 | +){ |
| 147136 | + Vdbe *v = sqlite3GetVdbe(pParse); |
| 147137 | + if( pOrderBy ){ |
| 147138 | + int nVal = pOrderBy->nExpr; |
| 147139 | + KeyInfo *pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pOrderBy, 0, 0); |
| 147140 | + sqlite3VdbeAddOp3(v, OP_Compare, regOld, regNew, nVal); |
| 147141 | + sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO); |
| 147142 | + sqlite3VdbeAddOp3(v, OP_Jump, |
| 147143 | + sqlite3VdbeCurrentAddr(v)+1, addr, sqlite3VdbeCurrentAddr(v)+1 |
| 147144 | + ); |
| 147145 | + VdbeCoverageEqNe(v); |
| 147146 | + sqlite3VdbeAddOp3(v, OP_Copy, regNew, regOld, nVal-1); |
| 147147 | + }else{ |
| 147148 | + sqlite3VdbeAddOp2(v, OP_Goto, 0, addr); |
| 147149 | + } |
| 147150 | +} |
| 147151 | + |
| 147152 | +/* |
| 147153 | +** This function is called as part of generating VM programs for RANGE |
| 147154 | +** offset PRECEDING/FOLLOWING frame boundaries. Assuming "ASC" order for |
| 147155 | +** the ORDER BY term in the window, it generates code equivalent to: |
| 147156 | +** |
| 147157 | +** if( csr1.peerVal + regVal >= csr2.peerVal ) goto lbl; |
| 147158 | +** |
| 147159 | +** A special type of arithmetic is used such that if csr.peerVal is not |
| 147160 | +** a numeric type (real or integer), then the result of the addition is |
| 147161 | +** a copy of csr1.peerVal. |
| 147162 | +*/ |
| 147163 | +static void windowCodeRangeTest( |
| 147164 | + WindowCodeArg *p, |
| 147165 | + int op, /* OP_Ge or OP_Gt */ |
| 147166 | + int csr1, |
| 147167 | + int regVal, |
| 147168 | + int csr2, |
| 147169 | + int lbl |
| 147170 | +){ |
| 147171 | + Parse *pParse = p->pParse; |
| 147172 | + Vdbe *v = sqlite3GetVdbe(pParse); |
| 147173 | + int reg1 = sqlite3GetTempReg(pParse); |
| 147174 | + int reg2 = sqlite3GetTempReg(pParse); |
| 147175 | + int arith = OP_Add; |
| 147176 | + int addrGe; |
| 147177 | + |
| 147178 | + int regString = ++pParse->nMem; |
| 147179 | + |
| 147180 | + assert( op==OP_Ge || op==OP_Gt || op==OP_Le ); |
| 147181 | + assert( p->pMWin->pOrderBy && p->pMWin->pOrderBy->nExpr==1 ); |
| 147182 | + if( p->pMWin->pOrderBy->a[0].sortOrder ){ |
| 147183 | + switch( op ){ |
| 147184 | + case OP_Ge: op = OP_Le; break; |
| 147185 | + case OP_Gt: op = OP_Lt; break; |
| 147186 | + default: assert( op==OP_Le ); op = OP_Ge; break; |
| 147187 | + } |
| 147188 | + arith = OP_Subtract; |
| 147189 | + } |
| 147190 | + |
| 147191 | + windowReadPeerValues(p, csr1, reg1); |
| 147192 | + windowReadPeerValues(p, csr2, reg2); |
| 147193 | + |
| 147194 | + /* Check if the peer value for csr1 value is a text or blob by comparing |
| 147195 | + ** it to the smallest possible string - ''. If it is, jump over the |
| 147196 | + ** OP_Add or OP_Subtract operation and proceed directly to the comparison. */ |
| 147197 | + sqlite3VdbeAddOp4(v, OP_String8, 0, regString, 0, "", P4_STATIC); |
| 147198 | + addrGe = sqlite3VdbeAddOp3(v, OP_Ge, regString, 0, reg1); |
| 147199 | + VdbeCoverage(v); |
| 147200 | + sqlite3VdbeAddOp3(v, arith, regVal, reg1, reg1); |
| 147201 | + sqlite3VdbeJumpHere(v, addrGe); |
| 147202 | + sqlite3VdbeAddOp3(v, op, reg2, lbl, reg1); VdbeCoverage(v); |
| 147203 | + sqlite3VdbeChangeP5(v, SQLITE_NULLEQ); |
| 147204 | + assert( op==OP_Ge || op==OP_Gt || op==OP_Lt || op==OP_Le ); |
| 147205 | + testcase(op==OP_Ge); VdbeCoverageIf(v, op==OP_Ge); |
| 147206 | + testcase(op==OP_Lt); VdbeCoverageIf(v, op==OP_Lt); |
| 147207 | + testcase(op==OP_Le); VdbeCoverageIf(v, op==OP_Le); |
| 147208 | + testcase(op==OP_Gt); VdbeCoverageIf(v, op==OP_Gt); |
| 147209 | + |
| 147210 | + sqlite3ReleaseTempReg(pParse, reg1); |
| 147211 | + sqlite3ReleaseTempReg(pParse, reg2); |
| 147212 | +} |
| 147213 | + |
| 147214 | +/* |
| 147215 | +** Helper function for sqlite3WindowCodeStep(). Each call to this function |
| 147216 | +** generates VM code for a single RETURN_ROW, AGGSTEP or AGGINVERSE |
| 147217 | +** operation. Refer to the header comment for sqlite3WindowCodeStep() for |
| 147218 | +** details. |
| 147219 | +*/ |
| 147220 | +static int windowCodeOp( |
| 147221 | + WindowCodeArg *p, /* Context object */ |
| 147222 | + int op, /* WINDOW_RETURN_ROW, AGGSTEP or AGGINVERSE */ |
| 147223 | + int regCountdown, /* Register for OP_IfPos countdown */ |
| 147224 | + int jumpOnEof /* Jump here if stepped cursor reaches EOF */ |
| 147225 | +){ |
| 147226 | + int csr, reg; |
| 147227 | + Parse *pParse = p->pParse; |
| 147228 | + Window *pMWin = p->pMWin; |
| 147229 | + int ret = 0; |
| 147230 | + Vdbe *v = p->pVdbe; |
| 147231 | + int addrIf = 0; |
| 147232 | + int addrContinue = 0; |
| 147233 | + int addrGoto = 0; |
| 147234 | + int bPeer = (pMWin->eFrmType!=TK_ROWS); |
| 147235 | + |
| 147236 | + int lblDone = sqlite3VdbeMakeLabel(pParse); |
| 147237 | + int addrNextRange = 0; |
| 147238 | + |
| 147239 | + /* Special case - WINDOW_AGGINVERSE is always a no-op if the frame |
| 147240 | + ** starts with UNBOUNDED PRECEDING. */ |
| 147241 | + if( op==WINDOW_AGGINVERSE && pMWin->eStart==TK_UNBOUNDED ){ |
| 147242 | + assert( regCountdown==0 && jumpOnEof==0 ); |
| 147243 | + return 0; |
| 147244 | + } |
| 147245 | + |
| 147246 | + if( regCountdown>0 ){ |
| 147247 | + if( pMWin->eFrmType==TK_RANGE ){ |
| 147248 | + addrNextRange = sqlite3VdbeCurrentAddr(v); |
| 147249 | + assert( op==WINDOW_AGGINVERSE || op==WINDOW_AGGSTEP ); |
| 147250 | + if( op==WINDOW_AGGINVERSE ){ |
| 147251 | + if( pMWin->eStart==TK_FOLLOWING ){ |
| 147252 | + windowCodeRangeTest( |
| 147253 | + p, OP_Le, p->current.csr, regCountdown, p->start.csr, lblDone |
| 147254 | + ); |
| 147255 | + }else{ |
| 147256 | + windowCodeRangeTest( |
| 147257 | + p, OP_Ge, p->start.csr, regCountdown, p->current.csr, lblDone |
| 147258 | + ); |
| 147259 | + } |
| 147260 | + }else{ |
| 147261 | + windowCodeRangeTest( |
| 147262 | + p, OP_Gt, p->end.csr, regCountdown, p->current.csr, lblDone |
| 147263 | + ); |
| 147264 | + } |
| 147265 | + }else{ |
| 147266 | + addrIf = sqlite3VdbeAddOp3(v, OP_IfPos, regCountdown, 0, 1); |
| 147267 | + VdbeCoverage(v); |
| 147268 | + } |
| 147269 | + } |
| 147270 | + |
| 147271 | + if( op==WINDOW_RETURN_ROW && pMWin->regStartRowid==0 ){ |
| 147272 | + windowAggFinal(p, 0); |
| 147273 | + } |
| 147274 | + addrContinue = sqlite3VdbeCurrentAddr(v); |
| 147275 | + switch( op ){ |
| 147276 | + case WINDOW_RETURN_ROW: |
| 147277 | + csr = p->current.csr; |
| 147278 | + reg = p->current.reg; |
| 147279 | + windowReturnOneRow(p); |
| 147280 | + break; |
| 147281 | + |
| 147282 | + case WINDOW_AGGINVERSE: |
| 147283 | + csr = p->start.csr; |
| 147284 | + reg = p->start.reg; |
| 147285 | + if( pMWin->regStartRowid ){ |
| 147286 | + assert( pMWin->regEndRowid ); |
| 147287 | + sqlite3VdbeAddOp2(v, OP_AddImm, pMWin->regStartRowid, 1); |
| 147288 | + }else{ |
| 147289 | + windowAggStep(pParse, pMWin, csr, 1, p->regArg); |
| 147290 | + } |
| 147291 | + break; |
| 147292 | + |
| 147293 | + default: |
| 147294 | + assert( op==WINDOW_AGGSTEP ); |
| 147295 | + csr = p->end.csr; |
| 147296 | + reg = p->end.reg; |
| 147297 | + if( pMWin->regStartRowid ){ |
| 147298 | + assert( pMWin->regEndRowid ); |
| 147299 | + sqlite3VdbeAddOp2(v, OP_AddImm, pMWin->regEndRowid, 1); |
| 147300 | + }else{ |
| 147301 | + windowAggStep(pParse, pMWin, csr, 0, p->regArg); |
| 147302 | + } |
| 147303 | + break; |
| 147304 | + } |
| 147305 | + |
| 147306 | + if( op==p->eDelete ){ |
| 147307 | + sqlite3VdbeAddOp1(v, OP_Delete, csr); |
| 147308 | + sqlite3VdbeChangeP5(v, OPFLAG_SAVEPOSITION); |
| 147309 | + } |
| 147310 | + |
| 147311 | + if( jumpOnEof ){ |
| 147312 | + sqlite3VdbeAddOp2(v, OP_Next, csr, sqlite3VdbeCurrentAddr(v)+2); |
| 147313 | + VdbeCoverage(v); |
| 147314 | + ret = sqlite3VdbeAddOp0(v, OP_Goto); |
| 147315 | + }else{ |
| 147316 | + sqlite3VdbeAddOp2(v, OP_Next, csr, sqlite3VdbeCurrentAddr(v)+1+bPeer); |
| 147317 | + VdbeCoverage(v); |
| 147318 | + if( bPeer ){ |
| 147319 | + addrGoto = sqlite3VdbeAddOp0(v, OP_Goto); |
| 147320 | + } |
| 147321 | + } |
| 147322 | + |
| 147323 | + if( bPeer ){ |
| 147324 | + int nReg = (pMWin->pOrderBy ? pMWin->pOrderBy->nExpr : 0); |
| 147325 | + int regTmp = (nReg ? sqlite3GetTempRange(pParse, nReg) : 0); |
| 147326 | + windowReadPeerValues(p, csr, regTmp); |
| 147327 | + windowIfNewPeer(pParse, pMWin->pOrderBy, regTmp, reg, addrContinue); |
| 147328 | + sqlite3ReleaseTempRange(pParse, regTmp, nReg); |
| 147329 | + } |
| 147330 | + |
| 147331 | + if( addrNextRange ){ |
| 147332 | + sqlite3VdbeAddOp2(v, OP_Goto, 0, addrNextRange); |
| 147333 | + } |
| 147334 | + sqlite3VdbeResolveLabel(v, lblDone); |
| 147335 | + if( addrGoto ) sqlite3VdbeJumpHere(v, addrGoto); |
| 147336 | + if( addrIf ) sqlite3VdbeJumpHere(v, addrIf); |
| 147337 | + return ret; |
| 147338 | +} |
| 147339 | + |
| 147354 | 147340 | |
| 147355 | 147341 | /* |
| 147356 | 147342 | ** Allocate and return a duplicate of the Window object indicated by the |
| 147357 | 147343 | ** third argument. Set the Window.pOwner field of the new object to |
| 147358 | 147344 | ** pOwner. |
| | @@ -147365,13 +147351,14 @@ |
| 147365 | 147351 | pNew->zName = sqlite3DbStrDup(db, p->zName); |
| 147366 | 147352 | pNew->pFilter = sqlite3ExprDup(db, p->pFilter, 0); |
| 147367 | 147353 | pNew->pFunc = p->pFunc; |
| 147368 | 147354 | pNew->pPartition = sqlite3ExprListDup(db, p->pPartition, 0); |
| 147369 | 147355 | pNew->pOrderBy = sqlite3ExprListDup(db, p->pOrderBy, 0); |
| 147370 | | - pNew->eType = p->eType; |
| 147356 | + pNew->eFrmType = p->eFrmType; |
| 147371 | 147357 | pNew->eEnd = p->eEnd; |
| 147372 | 147358 | pNew->eStart = p->eStart; |
| 147359 | + pNew->eExclude = p->eExclude; |
| 147373 | 147360 | pNew->pStart = sqlite3ExprDup(db, p->pStart, 0); |
| 147374 | 147361 | pNew->pEnd = sqlite3ExprDup(db, p->pEnd, 0); |
| 147375 | 147362 | pNew->pOwner = pOwner; |
| 147376 | 147363 | } |
| 147377 | 147364 | } |
| | @@ -147393,95 +147380,689 @@ |
| 147393 | 147380 | pp = &((*pp)->pNextWin); |
| 147394 | 147381 | } |
| 147395 | 147382 | |
| 147396 | 147383 | return pRet; |
| 147397 | 147384 | } |
| 147385 | + |
| 147386 | +/* |
| 147387 | +** Return true if it can be determined at compile time that expression |
| 147388 | +** pExpr evaluates to a value that, when cast to an integer, is greater |
| 147389 | +** than zero. False otherwise. |
| 147390 | +** |
| 147391 | +** If an OOM error occurs, this function sets the Parse.db.mallocFailed |
| 147392 | +** flag and returns zero. |
| 147393 | +*/ |
| 147394 | +static int windowExprGtZero(Parse *pParse, Expr *pExpr){ |
| 147395 | + int ret = 0; |
| 147396 | + sqlite3 *db = pParse->db; |
| 147397 | + sqlite3_value *pVal = 0; |
| 147398 | + sqlite3ValueFromExpr(db, pExpr, db->enc, SQLITE_AFF_NUMERIC, &pVal); |
| 147399 | + if( pVal && sqlite3_value_int(pVal)>0 ){ |
| 147400 | + ret = 1; |
| 147401 | + } |
| 147402 | + sqlite3ValueFree(pVal); |
| 147403 | + return ret; |
| 147404 | +} |
| 147398 | 147405 | |
| 147399 | 147406 | /* |
| 147400 | 147407 | ** sqlite3WhereBegin() has already been called for the SELECT statement |
| 147401 | 147408 | ** passed as the second argument when this function is invoked. It generates |
| 147402 | | -** code to populate the Window.regResult register for each window function and |
| 147403 | | -** invoke the sub-routine at instruction addrGosub once for each row. |
| 147404 | | -** This function calls sqlite3WhereEnd() before returning. |
| 147409 | +** code to populate the Window.regResult register for each window function |
| 147410 | +** and invoke the sub-routine at instruction addrGosub once for each row. |
| 147411 | +** sqlite3WhereEnd() is always called before returning. |
| 147412 | +** |
| 147413 | +** This function handles several different types of window frames, which |
| 147414 | +** require slightly different processing. The following pseudo code is |
| 147415 | +** used to implement window frames of the form: |
| 147416 | +** |
| 147417 | +** ROWS BETWEEN <expr1> PRECEDING AND <expr2> FOLLOWING |
| 147418 | +** |
| 147419 | +** Other window frame types use variants of the following: |
| 147420 | +** |
| 147421 | +** ... loop started by sqlite3WhereBegin() ... |
| 147422 | +** if( new partition ){ |
| 147423 | +** Gosub flush |
| 147424 | +** } |
| 147425 | +** Insert new row into eph table. |
| 147426 | +** |
| 147427 | +** if( first row of partition ){ |
| 147428 | +** // Rewind three cursors, all open on the eph table. |
| 147429 | +** Rewind(csrEnd); |
| 147430 | +** Rewind(csrStart); |
| 147431 | +** Rewind(csrCurrent); |
| 147432 | +** |
| 147433 | +** regEnd = <expr2> // FOLLOWING expression |
| 147434 | +** regStart = <expr1> // PRECEDING expression |
| 147435 | +** }else{ |
| 147436 | +** // First time this branch is taken, the eph table contains two |
| 147437 | +** // rows. The first row in the partition, which all three cursors |
| 147438 | +** // currently point to, and the following row. |
| 147439 | +** AGGSTEP |
| 147440 | +** if( (regEnd--)<=0 ){ |
| 147441 | +** RETURN_ROW |
| 147442 | +** if( (regStart--)<=0 ){ |
| 147443 | +** AGGINVERSE |
| 147444 | +** } |
| 147445 | +** } |
| 147446 | +** } |
| 147447 | +** } |
| 147448 | +** flush: |
| 147449 | +** AGGSTEP |
| 147450 | +** while( 1 ){ |
| 147451 | +** RETURN ROW |
| 147452 | +** if( csrCurrent is EOF ) break; |
| 147453 | +** if( (regStart--)<=0 ){ |
| 147454 | +** AggInverse(csrStart) |
| 147455 | +** Next(csrStart) |
| 147456 | +** } |
| 147457 | +** } |
| 147458 | +** |
| 147459 | +** The pseudo-code above uses the following shorthand: |
| 147460 | +** |
| 147461 | +** AGGSTEP: invoke the aggregate xStep() function for each window function |
| 147462 | +** with arguments read from the current row of cursor csrEnd, then |
| 147463 | +** step cursor csrEnd forward one row (i.e. sqlite3BtreeNext()). |
| 147464 | +** |
| 147465 | +** RETURN_ROW: return a row to the caller based on the contents of the |
| 147466 | +** current row of csrCurrent and the current state of all |
| 147467 | +** aggregates. Then step cursor csrCurrent forward one row. |
| 147468 | +** |
| 147469 | +** AGGINVERSE: invoke the aggregate xInverse() function for each window |
| 147470 | +** functions with arguments read from the current row of cursor |
| 147471 | +** csrStart. Then step csrStart forward one row. |
| 147472 | +** |
| 147473 | +** There are two other ROWS window frames that are handled significantly |
| 147474 | +** differently from the above - "BETWEEN <expr> PRECEDING AND <expr> PRECEDING" |
| 147475 | +** and "BETWEEN <expr> FOLLOWING AND <expr> FOLLOWING". These are special |
| 147476 | +** cases because they change the order in which the three cursors (csrStart, |
| 147477 | +** csrCurrent and csrEnd) iterate through the ephemeral table. Cases that |
| 147478 | +** use UNBOUNDED or CURRENT ROW are much simpler variations on one of these |
| 147479 | +** three. |
| 147480 | +** |
| 147481 | +** ROWS BETWEEN <expr1> PRECEDING AND <expr2> PRECEDING |
| 147482 | +** |
| 147483 | +** ... loop started by sqlite3WhereBegin() ... |
| 147484 | +** if( new partition ){ |
| 147485 | +** Gosub flush |
| 147486 | +** } |
| 147487 | +** Insert new row into eph table. |
| 147488 | +** if( first row of partition ){ |
| 147489 | +** Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) |
| 147490 | +** regEnd = <expr2> |
| 147491 | +** regStart = <expr1> |
| 147492 | +** }else{ |
| 147493 | +** if( (regEnd--)<=0 ){ |
| 147494 | +** AGGSTEP |
| 147495 | +** } |
| 147496 | +** RETURN_ROW |
| 147497 | +** if( (regStart--)<=0 ){ |
| 147498 | +** AGGINVERSE |
| 147499 | +** } |
| 147500 | +** } |
| 147501 | +** } |
| 147502 | +** flush: |
| 147503 | +** if( (regEnd--)<=0 ){ |
| 147504 | +** AGGSTEP |
| 147505 | +** } |
| 147506 | +** RETURN_ROW |
| 147507 | +** |
| 147508 | +** |
| 147509 | +** ROWS BETWEEN <expr1> FOLLOWING AND <expr2> FOLLOWING |
| 147510 | +** |
| 147511 | +** ... loop started by sqlite3WhereBegin() ... |
| 147512 | +** if( new partition ){ |
| 147513 | +** Gosub flush |
| 147514 | +** } |
| 147515 | +** Insert new row into eph table. |
| 147516 | +** if( first row of partition ){ |
| 147517 | +** Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) |
| 147518 | +** regEnd = <expr2> |
| 147519 | +** regStart = regEnd - <expr1> |
| 147520 | +** }else{ |
| 147521 | +** AGGSTEP |
| 147522 | +** if( (regEnd--)<=0 ){ |
| 147523 | +** RETURN_ROW |
| 147524 | +** } |
| 147525 | +** if( (regStart--)<=0 ){ |
| 147526 | +** AGGINVERSE |
| 147527 | +** } |
| 147528 | +** } |
| 147529 | +** } |
| 147530 | +** flush: |
| 147531 | +** AGGSTEP |
| 147532 | +** while( 1 ){ |
| 147533 | +** if( (regEnd--)<=0 ){ |
| 147534 | +** RETURN_ROW |
| 147535 | +** if( eof ) break; |
| 147536 | +** } |
| 147537 | +** if( (regStart--)<=0 ){ |
| 147538 | +** AGGINVERSE |
| 147539 | +** if( eof ) break |
| 147540 | +** } |
| 147541 | +** } |
| 147542 | +** while( !eof csrCurrent ){ |
| 147543 | +** RETURN_ROW |
| 147544 | +** } |
| 147545 | +** |
| 147546 | +** For the most part, the patterns above are adapted to support UNBOUNDED by |
| 147547 | +** assuming that it is equivalent to "infinity PRECEDING/FOLLOWING" and |
| 147548 | +** CURRENT ROW by assuming that it is equivilent to "0 PRECEDING/FOLLOWING". |
| 147549 | +** This is optimized of course - branches that will never be taken and |
| 147550 | +** conditions that are always true are omitted from the VM code. The only |
| 147551 | +** exceptional case is: |
| 147552 | +** |
| 147553 | +** ROWS BETWEEN <expr1> FOLLOWING AND UNBOUNDED FOLLOWING |
| 147554 | +** |
| 147555 | +** ... loop started by sqlite3WhereBegin() ... |
| 147556 | +** if( new partition ){ |
| 147557 | +** Gosub flush |
| 147558 | +** } |
| 147559 | +** Insert new row into eph table. |
| 147560 | +** if( first row of partition ){ |
| 147561 | +** Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) |
| 147562 | +** regStart = <expr1> |
| 147563 | +** }else{ |
| 147564 | +** AGGSTEP |
| 147565 | +** } |
| 147566 | +** } |
| 147567 | +** flush: |
| 147568 | +** AGGSTEP |
| 147569 | +** while( 1 ){ |
| 147570 | +** if( (regStart--)<=0 ){ |
| 147571 | +** AGGINVERSE |
| 147572 | +** if( eof ) break |
| 147573 | +** } |
| 147574 | +** RETURN_ROW |
| 147575 | +** } |
| 147576 | +** while( !eof csrCurrent ){ |
| 147577 | +** RETURN_ROW |
| 147578 | +** } |
| 147579 | +** |
| 147580 | +** Also requiring special handling are the cases: |
| 147581 | +** |
| 147582 | +** ROWS BETWEEN <expr1> PRECEDING AND <expr2> PRECEDING |
| 147583 | +** ROWS BETWEEN <expr1> FOLLOWING AND <expr2> FOLLOWING |
| 147584 | +** |
| 147585 | +** when (expr1 < expr2). This is detected at runtime, not by this function. |
| 147586 | +** To handle this case, the pseudo-code programs depicted above are modified |
| 147587 | +** slightly to be: |
| 147588 | +** |
| 147589 | +** ... loop started by sqlite3WhereBegin() ... |
| 147590 | +** if( new partition ){ |
| 147591 | +** Gosub flush |
| 147592 | +** } |
| 147593 | +** Insert new row into eph table. |
| 147594 | +** if( first row of partition ){ |
| 147595 | +** Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) |
| 147596 | +** regEnd = <expr2> |
| 147597 | +** regStart = <expr1> |
| 147598 | +** if( regEnd < regStart ){ |
| 147599 | +** RETURN_ROW |
| 147600 | +** delete eph table contents |
| 147601 | +** continue |
| 147602 | +** } |
| 147603 | +** ... |
| 147604 | +** |
| 147605 | +** The new "continue" statement in the above jumps to the next iteration |
| 147606 | +** of the outer loop - the one started by sqlite3WhereBegin(). |
| 147607 | +** |
| 147608 | +** The various GROUPS cases are implemented using the same patterns as |
| 147609 | +** ROWS. The VM code is modified slightly so that: |
| 147610 | +** |
| 147611 | +** 1. The else branch in the main loop is only taken if the row just |
| 147612 | +** added to the ephemeral table is the start of a new group. In |
| 147613 | +** other words, it becomes: |
| 147614 | +** |
| 147615 | +** ... loop started by sqlite3WhereBegin() ... |
| 147616 | +** if( new partition ){ |
| 147617 | +** Gosub flush |
| 147618 | +** } |
| 147619 | +** Insert new row into eph table. |
| 147620 | +** if( first row of partition ){ |
| 147621 | +** Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) |
| 147622 | +** regEnd = <expr2> |
| 147623 | +** regStart = <expr1> |
| 147624 | +** }else if( new group ){ |
| 147625 | +** ... |
| 147626 | +** } |
| 147627 | +** } |
| 147628 | +** |
| 147629 | +** 2. Instead of processing a single row, each RETURN_ROW, AGGSTEP or |
| 147630 | +** AGGINVERSE step processes the current row of the relevant cursor and |
| 147631 | +** all subsequent rows belonging to the same group. |
| 147632 | +** |
| 147633 | +** RANGE window frames are a little different again. As for GROUPS, the |
| 147634 | +** main loop runs once per group only. And RETURN_ROW, AGGSTEP and AGGINVERSE |
| 147635 | +** deal in groups instead of rows. As for ROWS and GROUPS, there are three |
| 147636 | +** basic cases: |
| 147637 | +** |
| 147638 | +** RANGE BETWEEN <expr1> PRECEDING AND <expr2> FOLLOWING |
| 147639 | +** |
| 147640 | +** ... loop started by sqlite3WhereBegin() ... |
| 147641 | +** if( new partition ){ |
| 147642 | +** Gosub flush |
| 147643 | +** } |
| 147644 | +** Insert new row into eph table. |
| 147645 | +** if( first row of partition ){ |
| 147646 | +** Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) |
| 147647 | +** regEnd = <expr2> |
| 147648 | +** regStart = <expr1> |
| 147649 | +** }else{ |
| 147650 | +** AGGSTEP |
| 147651 | +** while( (csrCurrent.key + regEnd) < csrEnd.key ){ |
| 147652 | +** RETURN_ROW |
| 147653 | +** while( csrStart.key + regStart) < csrCurrent.key ){ |
| 147654 | +** AGGINVERSE |
| 147655 | +** } |
| 147656 | +** } |
| 147657 | +** } |
| 147658 | +** } |
| 147659 | +** flush: |
| 147660 | +** AGGSTEP |
| 147661 | +** while( 1 ){ |
| 147662 | +** RETURN ROW |
| 147663 | +** if( csrCurrent is EOF ) break; |
| 147664 | +** while( csrStart.key + regStart) < csrCurrent.key ){ |
| 147665 | +** AGGINVERSE |
| 147666 | +** } |
| 147667 | +** } |
| 147668 | +** } |
| 147669 | +** |
| 147670 | +** In the above notation, "csr.key" means the current value of the ORDER BY |
| 147671 | +** expression (there is only ever 1 for a RANGE that uses an <expr> FOLLOWING |
| 147672 | +** or <expr PRECEDING) read from cursor csr. |
| 147673 | +** |
| 147674 | +** RANGE BETWEEN <expr1> PRECEDING AND <expr2> PRECEDING |
| 147675 | +** |
| 147676 | +** ... loop started by sqlite3WhereBegin() ... |
| 147677 | +** if( new partition ){ |
| 147678 | +** Gosub flush |
| 147679 | +** } |
| 147680 | +** Insert new row into eph table. |
| 147681 | +** if( first row of partition ){ |
| 147682 | +** Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) |
| 147683 | +** regEnd = <expr2> |
| 147684 | +** regStart = <expr1> |
| 147685 | +** }else{ |
| 147686 | +** if( (csrEnd.key + regEnd) <= csrCurrent.key ){ |
| 147687 | +** AGGSTEP |
| 147688 | +** } |
| 147689 | +** while( (csrStart.key + regStart) < csrCurrent.key ){ |
| 147690 | +** AGGINVERSE |
| 147691 | +** } |
| 147692 | +** RETURN_ROW |
| 147693 | +** } |
| 147694 | +** } |
| 147695 | +** flush: |
| 147696 | +** while( (csrEnd.key + regEnd) <= csrCurrent.key ){ |
| 147697 | +** AGGSTEP |
| 147698 | +** } |
| 147699 | +** while( (csrStart.key + regStart) < csrCurrent.key ){ |
| 147700 | +** AGGINVERSE |
| 147701 | +** } |
| 147702 | +** RETURN_ROW |
| 147703 | +** |
| 147704 | +** RANGE BETWEEN <expr1> FOLLOWING AND <expr2> FOLLOWING |
| 147705 | +** |
| 147706 | +** ... loop started by sqlite3WhereBegin() ... |
| 147707 | +** if( new partition ){ |
| 147708 | +** Gosub flush |
| 147709 | +** } |
| 147710 | +** Insert new row into eph table. |
| 147711 | +** if( first row of partition ){ |
| 147712 | +** Rewind(csrEnd) ; Rewind(csrStart) ; Rewind(csrCurrent) |
| 147713 | +** regEnd = <expr2> |
| 147714 | +** regStart = <expr1> |
| 147715 | +** }else{ |
| 147716 | +** AGGSTEP |
| 147717 | +** while( (csrCurrent.key + regEnd) < csrEnd.key ){ |
| 147718 | +** while( (csrCurrent.key + regStart) > csrStart.key ){ |
| 147719 | +** AGGINVERSE |
| 147720 | +** } |
| 147721 | +** RETURN_ROW |
| 147722 | +** } |
| 147723 | +** } |
| 147724 | +** } |
| 147725 | +** flush: |
| 147726 | +** AGGSTEP |
| 147727 | +** while( 1 ){ |
| 147728 | +** while( (csrCurrent.key + regStart) > csrStart.key ){ |
| 147729 | +** AGGINVERSE |
| 147730 | +** if( eof ) break "while( 1 )" loop. |
| 147731 | +** } |
| 147732 | +** RETURN_ROW |
| 147733 | +** } |
| 147734 | +** while( !eof csrCurrent ){ |
| 147735 | +** RETURN_ROW |
| 147736 | +** } |
| 147737 | +** |
| 147738 | +** The text above leaves out many details. Refer to the code and comments |
| 147739 | +** below for a more complete picture. |
| 147405 | 147740 | */ |
| 147406 | 147741 | SQLITE_PRIVATE void sqlite3WindowCodeStep( |
| 147407 | 147742 | Parse *pParse, /* Parse context */ |
| 147408 | 147743 | Select *p, /* Rewritten SELECT statement */ |
| 147409 | 147744 | WhereInfo *pWInfo, /* Context returned by sqlite3WhereBegin() */ |
| 147410 | 147745 | int regGosub, /* Register for OP_Gosub */ |
| 147411 | 147746 | int addrGosub /* OP_Gosub here to return each row */ |
| 147412 | 147747 | ){ |
| 147413 | 147748 | Window *pMWin = p->pWin; |
| 147414 | | - |
| 147415 | | - /* There are three different functions that may be used to do the work |
| 147416 | | - ** of this one, depending on the window frame and the specific built-in |
| 147417 | | - ** window functions used (if any). |
| 147418 | | - ** |
| 147419 | | - ** windowCodeRowExprStep() handles all "ROWS" window frames, except for: |
| 147420 | | - ** |
| 147421 | | - ** ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW |
| 147422 | | - ** |
| 147423 | | - ** The exception is because windowCodeRowExprStep() implements all window |
| 147424 | | - ** frame types by caching the entire partition in a temp table, and |
| 147425 | | - ** "ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW" is easy enough to |
| 147426 | | - ** implement without such a cache. |
| 147427 | | - ** |
| 147428 | | - ** windowCodeCacheStep() is used for: |
| 147429 | | - ** |
| 147430 | | - ** RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING |
| 147431 | | - ** |
| 147432 | | - ** It is also used for anything not handled by windowCodeRowExprStep() |
| 147433 | | - ** that invokes a built-in window function that requires the entire |
| 147434 | | - ** partition to be cached in a temp table before any rows are returned |
| 147435 | | - ** (e.g. nth_value() or percent_rank()). |
| 147436 | | - ** |
| 147437 | | - ** Finally, assuming there is no built-in window function that requires |
| 147438 | | - ** the partition to be cached, windowCodeDefaultStep() is used for: |
| 147439 | | - ** |
| 147440 | | - ** RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW |
| 147441 | | - ** RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING |
| 147442 | | - ** RANGE BETWEEN CURRENT ROW AND CURRENT ROW |
| 147443 | | - ** ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW |
| 147444 | | - ** |
| 147445 | | - ** windowCodeDefaultStep() is the only one of the three functions that |
| 147446 | | - ** does not cache each partition in a temp table before beginning to |
| 147447 | | - ** return rows. |
| 147448 | | - */ |
| 147449 | | - if( pMWin->eType==TK_ROWS |
| 147450 | | - && (pMWin->eStart!=TK_UNBOUNDED||pMWin->eEnd!=TK_CURRENT||!pMWin->pOrderBy) |
| 147451 | | - ){ |
| 147452 | | - VdbeModuleComment((pParse->pVdbe, "Begin RowExprStep()")); |
| 147453 | | - windowCodeRowExprStep(pParse, p, pWInfo, regGosub, addrGosub); |
| 147454 | | - }else{ |
| 147455 | | - Window *pWin; |
| 147456 | | - int bCache = 0; /* True to use CacheStep() */ |
| 147457 | | - |
| 147458 | | - if( pMWin->eStart==TK_CURRENT && pMWin->eEnd==TK_UNBOUNDED ){ |
| 147459 | | - bCache = 1; |
| 147460 | | - }else{ |
| 147461 | | - for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ |
| 147462 | | - FuncDef *pFunc = pWin->pFunc; |
| 147463 | | - if( (pFunc->funcFlags & SQLITE_FUNC_WINDOW_SIZE) |
| 147464 | | - || (pFunc->zName==nth_valueName) |
| 147465 | | - || (pFunc->zName==first_valueName) |
| 147466 | | - || (pFunc->zName==leadName) |
| 147467 | | - || (pFunc->zName==lagName) |
| 147468 | | - ){ |
| 147469 | | - bCache = 1; |
| 147470 | | - break; |
| 147471 | | - } |
| 147472 | | - } |
| 147473 | | - } |
| 147474 | | - |
| 147475 | | - /* Otherwise, call windowCodeDefaultStep(). */ |
| 147476 | | - if( bCache ){ |
| 147477 | | - VdbeModuleComment((pParse->pVdbe, "Begin CacheStep()")); |
| 147478 | | - windowCodeCacheStep(pParse, p, pWInfo, regGosub, addrGosub); |
| 147479 | | - }else{ |
| 147480 | | - VdbeModuleComment((pParse->pVdbe, "Begin DefaultStep()")); |
| 147481 | | - windowCodeDefaultStep(pParse, p, pWInfo, regGosub, addrGosub); |
| 147482 | | - } |
| 147749 | + ExprList *pOrderBy = pMWin->pOrderBy; |
| 147750 | + Vdbe *v = sqlite3GetVdbe(pParse); |
| 147751 | + int csrWrite; /* Cursor used to write to eph. table */ |
| 147752 | + int csrInput = p->pSrc->a[0].iCursor; /* Cursor of sub-select */ |
| 147753 | + int nInput = p->pSrc->a[0].pTab->nCol; /* Number of cols returned by sub */ |
| 147754 | + int iInput; /* To iterate through sub cols */ |
| 147755 | + int addrNe; /* Address of OP_Ne */ |
| 147756 | + int addrGosubFlush = 0; /* Address of OP_Gosub to flush: */ |
| 147757 | + int addrInteger = 0; /* Address of OP_Integer */ |
| 147758 | + int addrEmpty; /* Address of OP_Rewind in flush: */ |
| 147759 | + int regStart = 0; /* Value of <expr> PRECEDING */ |
| 147760 | + int regEnd = 0; /* Value of <expr> FOLLOWING */ |
| 147761 | + int regNew; /* Array of registers holding new input row */ |
| 147762 | + int regRecord; /* regNew array in record form */ |
| 147763 | + int regRowid; /* Rowid for regRecord in eph table */ |
| 147764 | + int regNewPeer = 0; /* Peer values for new row (part of regNew) */ |
| 147765 | + int regPeer = 0; /* Peer values for current row */ |
| 147766 | + int regFlushPart = 0; /* Register for "Gosub flush_partition" */ |
| 147767 | + WindowCodeArg s; /* Context object for sub-routines */ |
| 147768 | + int lblWhereEnd; /* Label just before sqlite3WhereEnd() code */ |
| 147769 | + |
| 147770 | + assert( pMWin->eStart==TK_PRECEDING || pMWin->eStart==TK_CURRENT |
| 147771 | + || pMWin->eStart==TK_FOLLOWING || pMWin->eStart==TK_UNBOUNDED |
| 147772 | + ); |
| 147773 | + assert( pMWin->eEnd==TK_FOLLOWING || pMWin->eEnd==TK_CURRENT |
| 147774 | + || pMWin->eEnd==TK_UNBOUNDED || pMWin->eEnd==TK_PRECEDING |
| 147775 | + ); |
| 147776 | + assert( pMWin->eExclude==0 || pMWin->eExclude==TK_CURRENT |
| 147777 | + || pMWin->eExclude==TK_GROUP || pMWin->eExclude==TK_TIES |
| 147778 | + || pMWin->eExclude==TK_NO |
| 147779 | + ); |
| 147780 | + |
| 147781 | + lblWhereEnd = sqlite3VdbeMakeLabel(pParse); |
| 147782 | + |
| 147783 | + /* Fill in the context object */ |
| 147784 | + memset(&s, 0, sizeof(WindowCodeArg)); |
| 147785 | + s.pParse = pParse; |
| 147786 | + s.pMWin = pMWin; |
| 147787 | + s.pVdbe = v; |
| 147788 | + s.regGosub = regGosub; |
| 147789 | + s.addrGosub = addrGosub; |
| 147790 | + s.current.csr = pMWin->iEphCsr; |
| 147791 | + csrWrite = s.current.csr+1; |
| 147792 | + s.start.csr = s.current.csr+2; |
| 147793 | + s.end.csr = s.current.csr+3; |
| 147794 | + |
| 147795 | + /* Figure out when rows may be deleted from the ephemeral table. There |
| 147796 | + ** are four options - they may never be deleted (eDelete==0), they may |
| 147797 | + ** be deleted as soon as they are no longer part of the window frame |
| 147798 | + ** (eDelete==WINDOW_AGGINVERSE), they may be deleted as after the row |
| 147799 | + ** has been returned to the caller (WINDOW_RETURN_ROW), or they may |
| 147800 | + ** be deleted after they enter the frame (WINDOW_AGGSTEP). */ |
| 147801 | + switch( pMWin->eStart ){ |
| 147802 | + case TK_FOLLOWING: |
| 147803 | + if( pMWin->eFrmType!=TK_RANGE |
| 147804 | + && windowExprGtZero(pParse, pMWin->pStart) |
| 147805 | + ){ |
| 147806 | + s.eDelete = WINDOW_RETURN_ROW; |
| 147807 | + } |
| 147808 | + break; |
| 147809 | + case TK_UNBOUNDED: |
| 147810 | + if( windowCacheFrame(pMWin)==0 ){ |
| 147811 | + if( pMWin->eEnd==TK_PRECEDING ){ |
| 147812 | + if( pMWin->eFrmType!=TK_RANGE |
| 147813 | + && windowExprGtZero(pParse, pMWin->pEnd) |
| 147814 | + ){ |
| 147815 | + s.eDelete = WINDOW_AGGSTEP; |
| 147816 | + } |
| 147817 | + }else{ |
| 147818 | + s.eDelete = WINDOW_RETURN_ROW; |
| 147819 | + } |
| 147820 | + } |
| 147821 | + break; |
| 147822 | + default: |
| 147823 | + s.eDelete = WINDOW_AGGINVERSE; |
| 147824 | + break; |
| 147825 | + } |
| 147826 | + |
| 147827 | + /* Allocate registers for the array of values from the sub-query, the |
| 147828 | + ** samve values in record form, and the rowid used to insert said record |
| 147829 | + ** into the ephemeral table. */ |
| 147830 | + regNew = pParse->nMem+1; |
| 147831 | + pParse->nMem += nInput; |
| 147832 | + regRecord = ++pParse->nMem; |
| 147833 | + regRowid = ++pParse->nMem; |
| 147834 | + |
| 147835 | + /* If the window frame contains an "<expr> PRECEDING" or "<expr> FOLLOWING" |
| 147836 | + ** clause, allocate registers to store the results of evaluating each |
| 147837 | + ** <expr>. */ |
| 147838 | + if( pMWin->eStart==TK_PRECEDING || pMWin->eStart==TK_FOLLOWING ){ |
| 147839 | + regStart = ++pParse->nMem; |
| 147840 | + } |
| 147841 | + if( pMWin->eEnd==TK_PRECEDING || pMWin->eEnd==TK_FOLLOWING ){ |
| 147842 | + regEnd = ++pParse->nMem; |
| 147843 | + } |
| 147844 | + |
| 147845 | + /* If this is not a "ROWS BETWEEN ..." frame, then allocate arrays of |
| 147846 | + ** registers to store copies of the ORDER BY expressions (peer values) |
| 147847 | + ** for the main loop, and for each cursor (start, current and end). */ |
| 147848 | + if( pMWin->eFrmType!=TK_ROWS ){ |
| 147849 | + int nPeer = (pOrderBy ? pOrderBy->nExpr : 0); |
| 147850 | + regNewPeer = regNew + pMWin->nBufferCol; |
| 147851 | + if( pMWin->pPartition ) regNewPeer += pMWin->pPartition->nExpr; |
| 147852 | + regPeer = pParse->nMem+1; pParse->nMem += nPeer; |
| 147853 | + s.start.reg = pParse->nMem+1; pParse->nMem += nPeer; |
| 147854 | + s.current.reg = pParse->nMem+1; pParse->nMem += nPeer; |
| 147855 | + s.end.reg = pParse->nMem+1; pParse->nMem += nPeer; |
| 147856 | + } |
| 147857 | + |
| 147858 | + /* Load the column values for the row returned by the sub-select |
| 147859 | + ** into an array of registers starting at regNew. Assemble them into |
| 147860 | + ** a record in register regRecord. */ |
| 147861 | + for(iInput=0; iInput<nInput; iInput++){ |
| 147862 | + sqlite3VdbeAddOp3(v, OP_Column, csrInput, iInput, regNew+iInput); |
| 147863 | + } |
| 147864 | + sqlite3VdbeAddOp3(v, OP_MakeRecord, regNew, nInput, regRecord); |
| 147865 | + |
| 147866 | + /* An input row has just been read into an array of registers starting |
| 147867 | + ** at regNew. If the window has a PARTITION clause, this block generates |
| 147868 | + ** VM code to check if the input row is the start of a new partition. |
| 147869 | + ** If so, it does an OP_Gosub to an address to be filled in later. The |
| 147870 | + ** address of the OP_Gosub is stored in local variable addrGosubFlush. */ |
| 147871 | + if( pMWin->pPartition ){ |
| 147872 | + int addr; |
| 147873 | + ExprList *pPart = pMWin->pPartition; |
| 147874 | + int nPart = pPart->nExpr; |
| 147875 | + int regNewPart = regNew + pMWin->nBufferCol; |
| 147876 | + KeyInfo *pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pPart, 0, 0); |
| 147877 | + |
| 147878 | + regFlushPart = ++pParse->nMem; |
| 147879 | + addr = sqlite3VdbeAddOp3(v, OP_Compare, regNewPart, pMWin->regPart, nPart); |
| 147880 | + sqlite3VdbeAppendP4(v, (void*)pKeyInfo, P4_KEYINFO); |
| 147881 | + sqlite3VdbeAddOp3(v, OP_Jump, addr+2, addr+4, addr+2); |
| 147882 | + VdbeCoverageEqNe(v); |
| 147883 | + addrGosubFlush = sqlite3VdbeAddOp1(v, OP_Gosub, regFlushPart); |
| 147884 | + VdbeComment((v, "call flush_partition")); |
| 147885 | + sqlite3VdbeAddOp3(v, OP_Copy, regNewPart, pMWin->regPart, nPart-1); |
| 147886 | + } |
| 147887 | + |
| 147888 | + /* Insert the new row into the ephemeral table */ |
| 147889 | + sqlite3VdbeAddOp2(v, OP_NewRowid, csrWrite, regRowid); |
| 147890 | + sqlite3VdbeAddOp3(v, OP_Insert, csrWrite, regRecord, regRowid); |
| 147891 | + addrNe = sqlite3VdbeAddOp3(v, OP_Ne, pMWin->regOne, 0, regRowid); |
| 147892 | + VdbeCoverageNeverNull(v); |
| 147893 | + |
| 147894 | + /* This block is run for the first row of each partition */ |
| 147895 | + s.regArg = windowInitAccum(pParse, pMWin); |
| 147896 | + |
| 147897 | + if( regStart ){ |
| 147898 | + sqlite3ExprCode(pParse, pMWin->pStart, regStart); |
| 147899 | + windowCheckValue(pParse, regStart, 0 + (pMWin->eFrmType==TK_RANGE ? 3 : 0)); |
| 147900 | + } |
| 147901 | + if( regEnd ){ |
| 147902 | + sqlite3ExprCode(pParse, pMWin->pEnd, regEnd); |
| 147903 | + windowCheckValue(pParse, regEnd, 1 + (pMWin->eFrmType==TK_RANGE ? 3 : 0)); |
| 147904 | + } |
| 147905 | + |
| 147906 | + if( pMWin->eStart==pMWin->eEnd && regStart ){ |
| 147907 | + int op = ((pMWin->eStart==TK_FOLLOWING) ? OP_Ge : OP_Le); |
| 147908 | + int addrGe = sqlite3VdbeAddOp3(v, op, regStart, 0, regEnd); |
| 147909 | + VdbeCoverageNeverNullIf(v, op==OP_Ge); /* NeverNull because bound <expr> */ |
| 147910 | + VdbeCoverageNeverNullIf(v, op==OP_Le); /* values previously checked */ |
| 147911 | + windowAggFinal(&s, 0); |
| 147912 | + sqlite3VdbeAddOp2(v, OP_Rewind, s.current.csr, 1); |
| 147913 | + VdbeCoverageNeverTaken(v); |
| 147914 | + windowReturnOneRow(&s); |
| 147915 | + sqlite3VdbeAddOp1(v, OP_ResetSorter, s.current.csr); |
| 147916 | + sqlite3VdbeAddOp2(v, OP_Goto, 0, lblWhereEnd); |
| 147917 | + sqlite3VdbeJumpHere(v, addrGe); |
| 147918 | + } |
| 147919 | + if( pMWin->eStart==TK_FOLLOWING && pMWin->eFrmType!=TK_RANGE && regEnd ){ |
| 147920 | + assert( pMWin->eEnd==TK_FOLLOWING ); |
| 147921 | + sqlite3VdbeAddOp3(v, OP_Subtract, regStart, regEnd, regStart); |
| 147922 | + } |
| 147923 | + |
| 147924 | + if( pMWin->eStart!=TK_UNBOUNDED ){ |
| 147925 | + sqlite3VdbeAddOp2(v, OP_Rewind, s.start.csr, 1); |
| 147926 | + VdbeCoverageNeverTaken(v); |
| 147927 | + } |
| 147928 | + sqlite3VdbeAddOp2(v, OP_Rewind, s.current.csr, 1); |
| 147929 | + VdbeCoverageNeverTaken(v); |
| 147930 | + sqlite3VdbeAddOp2(v, OP_Rewind, s.end.csr, 1); |
| 147931 | + VdbeCoverageNeverTaken(v); |
| 147932 | + if( regPeer && pOrderBy ){ |
| 147933 | + sqlite3VdbeAddOp3(v, OP_Copy, regNewPeer, regPeer, pOrderBy->nExpr-1); |
| 147934 | + sqlite3VdbeAddOp3(v, OP_Copy, regPeer, s.start.reg, pOrderBy->nExpr-1); |
| 147935 | + sqlite3VdbeAddOp3(v, OP_Copy, regPeer, s.current.reg, pOrderBy->nExpr-1); |
| 147936 | + sqlite3VdbeAddOp3(v, OP_Copy, regPeer, s.end.reg, pOrderBy->nExpr-1); |
| 147937 | + } |
| 147938 | + |
| 147939 | + sqlite3VdbeAddOp2(v, OP_Goto, 0, lblWhereEnd); |
| 147940 | + |
| 147941 | + sqlite3VdbeJumpHere(v, addrNe); |
| 147942 | + |
| 147943 | + /* Beginning of the block executed for the second and subsequent rows. */ |
| 147944 | + if( regPeer ){ |
| 147945 | + windowIfNewPeer(pParse, pOrderBy, regNewPeer, regPeer, lblWhereEnd); |
| 147946 | + } |
| 147947 | + if( pMWin->eStart==TK_FOLLOWING ){ |
| 147948 | + windowCodeOp(&s, WINDOW_AGGSTEP, 0, 0); |
| 147949 | + if( pMWin->eEnd!=TK_UNBOUNDED ){ |
| 147950 | + if( pMWin->eFrmType==TK_RANGE ){ |
| 147951 | + int lbl = sqlite3VdbeMakeLabel(pParse); |
| 147952 | + int addrNext = sqlite3VdbeCurrentAddr(v); |
| 147953 | + windowCodeRangeTest(&s, OP_Ge, s.current.csr, regEnd, s.end.csr, lbl); |
| 147954 | + windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 0); |
| 147955 | + windowCodeOp(&s, WINDOW_RETURN_ROW, 0, 0); |
| 147956 | + sqlite3VdbeAddOp2(v, OP_Goto, 0, addrNext); |
| 147957 | + sqlite3VdbeResolveLabel(v, lbl); |
| 147958 | + }else{ |
| 147959 | + windowCodeOp(&s, WINDOW_RETURN_ROW, regEnd, 0); |
| 147960 | + windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 0); |
| 147961 | + } |
| 147962 | + } |
| 147963 | + }else |
| 147964 | + if( pMWin->eEnd==TK_PRECEDING ){ |
| 147965 | + int bRPS = (pMWin->eStart==TK_PRECEDING && pMWin->eFrmType==TK_RANGE); |
| 147966 | + windowCodeOp(&s, WINDOW_AGGSTEP, regEnd, 0); |
| 147967 | + if( bRPS ) windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 0); |
| 147968 | + windowCodeOp(&s, WINDOW_RETURN_ROW, 0, 0); |
| 147969 | + if( !bRPS ) windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 0); |
| 147970 | + }else{ |
| 147971 | + int addr = 0; |
| 147972 | + windowCodeOp(&s, WINDOW_AGGSTEP, 0, 0); |
| 147973 | + if( pMWin->eEnd!=TK_UNBOUNDED ){ |
| 147974 | + if( pMWin->eFrmType==TK_RANGE ){ |
| 147975 | + int lbl = 0; |
| 147976 | + addr = sqlite3VdbeCurrentAddr(v); |
| 147977 | + if( regEnd ){ |
| 147978 | + lbl = sqlite3VdbeMakeLabel(pParse); |
| 147979 | + windowCodeRangeTest(&s, OP_Ge, s.current.csr, regEnd, s.end.csr, lbl); |
| 147980 | + } |
| 147981 | + windowCodeOp(&s, WINDOW_RETURN_ROW, 0, 0); |
| 147982 | + windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 0); |
| 147983 | + if( regEnd ){ |
| 147984 | + sqlite3VdbeAddOp2(v, OP_Goto, 0, addr); |
| 147985 | + sqlite3VdbeResolveLabel(v, lbl); |
| 147986 | + } |
| 147987 | + }else{ |
| 147988 | + if( regEnd ){ |
| 147989 | + addr = sqlite3VdbeAddOp3(v, OP_IfPos, regEnd, 0, 1); |
| 147990 | + VdbeCoverage(v); |
| 147991 | + } |
| 147992 | + windowCodeOp(&s, WINDOW_RETURN_ROW, 0, 0); |
| 147993 | + windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 0); |
| 147994 | + if( regEnd ) sqlite3VdbeJumpHere(v, addr); |
| 147995 | + } |
| 147996 | + } |
| 147997 | + } |
| 147998 | + |
| 147999 | + /* End of the main input loop */ |
| 148000 | + sqlite3VdbeResolveLabel(v, lblWhereEnd); |
| 148001 | + sqlite3WhereEnd(pWInfo); |
| 148002 | + |
| 148003 | + /* Fall through */ |
| 148004 | + if( pMWin->pPartition ){ |
| 148005 | + addrInteger = sqlite3VdbeAddOp2(v, OP_Integer, 0, regFlushPart); |
| 148006 | + sqlite3VdbeJumpHere(v, addrGosubFlush); |
| 148007 | + } |
| 148008 | + |
| 148009 | + addrEmpty = sqlite3VdbeAddOp1(v, OP_Rewind, csrWrite); |
| 148010 | + VdbeCoverage(v); |
| 148011 | + if( pMWin->eEnd==TK_PRECEDING ){ |
| 148012 | + int bRPS = (pMWin->eStart==TK_PRECEDING && pMWin->eFrmType==TK_RANGE); |
| 148013 | + windowCodeOp(&s, WINDOW_AGGSTEP, regEnd, 0); |
| 148014 | + if( bRPS ) windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 0); |
| 148015 | + windowCodeOp(&s, WINDOW_RETURN_ROW, 0, 0); |
| 148016 | + }else if( pMWin->eStart==TK_FOLLOWING ){ |
| 148017 | + int addrStart; |
| 148018 | + int addrBreak1; |
| 148019 | + int addrBreak2; |
| 148020 | + int addrBreak3; |
| 148021 | + windowCodeOp(&s, WINDOW_AGGSTEP, 0, 0); |
| 148022 | + if( pMWin->eFrmType==TK_RANGE ){ |
| 148023 | + addrStart = sqlite3VdbeCurrentAddr(v); |
| 148024 | + addrBreak2 = windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 1); |
| 148025 | + addrBreak1 = windowCodeOp(&s, WINDOW_RETURN_ROW, 0, 1); |
| 148026 | + }else |
| 148027 | + if( pMWin->eEnd==TK_UNBOUNDED ){ |
| 148028 | + addrStart = sqlite3VdbeCurrentAddr(v); |
| 148029 | + addrBreak1 = windowCodeOp(&s, WINDOW_RETURN_ROW, regStart, 1); |
| 148030 | + addrBreak2 = windowCodeOp(&s, WINDOW_AGGINVERSE, 0, 1); |
| 148031 | + }else{ |
| 148032 | + assert( pMWin->eEnd==TK_FOLLOWING ); |
| 148033 | + addrStart = sqlite3VdbeCurrentAddr(v); |
| 148034 | + addrBreak1 = windowCodeOp(&s, WINDOW_RETURN_ROW, regEnd, 1); |
| 148035 | + addrBreak2 = windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 1); |
| 148036 | + } |
| 148037 | + sqlite3VdbeAddOp2(v, OP_Goto, 0, addrStart); |
| 148038 | + sqlite3VdbeJumpHere(v, addrBreak2); |
| 148039 | + addrStart = sqlite3VdbeCurrentAddr(v); |
| 148040 | + addrBreak3 = windowCodeOp(&s, WINDOW_RETURN_ROW, 0, 1); |
| 148041 | + sqlite3VdbeAddOp2(v, OP_Goto, 0, addrStart); |
| 148042 | + sqlite3VdbeJumpHere(v, addrBreak1); |
| 148043 | + sqlite3VdbeJumpHere(v, addrBreak3); |
| 148044 | + }else{ |
| 148045 | + int addrBreak; |
| 148046 | + int addrStart; |
| 148047 | + windowCodeOp(&s, WINDOW_AGGSTEP, 0, 0); |
| 148048 | + addrStart = sqlite3VdbeCurrentAddr(v); |
| 148049 | + addrBreak = windowCodeOp(&s, WINDOW_RETURN_ROW, 0, 1); |
| 148050 | + windowCodeOp(&s, WINDOW_AGGINVERSE, regStart, 0); |
| 148051 | + sqlite3VdbeAddOp2(v, OP_Goto, 0, addrStart); |
| 148052 | + sqlite3VdbeJumpHere(v, addrBreak); |
| 148053 | + } |
| 148054 | + sqlite3VdbeJumpHere(v, addrEmpty); |
| 148055 | + |
| 148056 | + sqlite3VdbeAddOp1(v, OP_ResetSorter, s.current.csr); |
| 148057 | + if( pMWin->pPartition ){ |
| 148058 | + if( pMWin->regStartRowid ){ |
| 148059 | + sqlite3VdbeAddOp2(v, OP_Integer, 1, pMWin->regStartRowid); |
| 148060 | + sqlite3VdbeAddOp2(v, OP_Integer, 0, pMWin->regEndRowid); |
| 148061 | + } |
| 148062 | + sqlite3VdbeChangeP1(v, addrInteger, sqlite3VdbeCurrentAddr(v)); |
| 148063 | + sqlite3VdbeAddOp1(v, OP_Return, regFlushPart); |
| 147483 | 148064 | } |
| 147484 | 148065 | } |
| 147485 | 148066 | |
| 147486 | 148067 | #endif /* SQLITE_OMIT_WINDOWFUNC */ |
| 147487 | 148068 | |
| | @@ -147729,31 +148310,32 @@ |
| 147729 | 148310 | #ifndef INTERFACE |
| 147730 | 148311 | # define INTERFACE 1 |
| 147731 | 148312 | #endif |
| 147732 | 148313 | /************* Begin control #defines *****************************************/ |
| 147733 | 148314 | #define YYCODETYPE unsigned short int |
| 147734 | | -#define YYNOCODE 278 |
| 148315 | +#define YYNOCODE 284 |
| 147735 | 148316 | #define YYACTIONTYPE unsigned short int |
| 147736 | | -#define YYWILDCARD 91 |
| 148317 | +#define YYWILDCARD 95 |
| 147737 | 148318 | #define sqlite3ParserTOKENTYPE Token |
| 147738 | 148319 | typedef union { |
| 147739 | 148320 | int yyinit; |
| 147740 | 148321 | sqlite3ParserTOKENTYPE yy0; |
| 147741 | | - ExprList* yy42; |
| 147742 | | - int yy96; |
| 147743 | | - TriggerStep* yy119; |
| 147744 | | - Window* yy147; |
| 147745 | | - SrcList* yy167; |
| 147746 | | - Upsert* yy266; |
| 147747 | | - struct FrameBound yy317; |
| 147748 | | - IdList* yy336; |
| 147749 | | - struct TrigEvent yy350; |
| 147750 | | - struct {int value; int mask;} yy367; |
| 147751 | | - Select* yy423; |
| 147752 | | - const char* yy464; |
| 147753 | | - Expr* yy490; |
| 147754 | | - With* yy499; |
| 148322 | + u8 yy10; |
| 148323 | + const char* yy104; |
| 148324 | + Expr* yy130; |
| 148325 | + SrcList* yy147; |
| 148326 | + IdList* yy200; |
| 148327 | + struct FrameBound yy273; |
| 148328 | + Window* yy395; |
| 148329 | + int yy420; |
| 148330 | + Upsert* yy426; |
| 148331 | + ExprList* yy442; |
| 148332 | + Select* yy491; |
| 148333 | + struct TrigEvent yy498; |
| 148334 | + With* yy523; |
| 148335 | + TriggerStep* yy524; |
| 148336 | + struct {int value; int mask;} yy527; |
| 147755 | 148337 | } YYMINORTYPE; |
| 147756 | 148338 | #ifndef YYSTACKDEPTH |
| 147757 | 148339 | #define YYSTACKDEPTH 100 |
| 147758 | 148340 | #endif |
| 147759 | 148341 | #define sqlite3ParserARG_SDECL |
| | @@ -147765,21 +148347,21 @@ |
| 147765 | 148347 | #define sqlite3ParserCTX_PDECL ,Parse *pParse |
| 147766 | 148348 | #define sqlite3ParserCTX_PARAM ,pParse |
| 147767 | 148349 | #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; |
| 147768 | 148350 | #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; |
| 147769 | 148351 | #define YYFALLBACK 1 |
| 147770 | | -#define YYNSTATE 524 |
| 147771 | | -#define YYNRULE 369 |
| 147772 | | -#define YYNTOKEN 155 |
| 147773 | | -#define YY_MAX_SHIFT 523 |
| 147774 | | -#define YY_MIN_SHIFTREDUCE 760 |
| 147775 | | -#define YY_MAX_SHIFTREDUCE 1128 |
| 147776 | | -#define YY_ERROR_ACTION 1129 |
| 147777 | | -#define YY_ACCEPT_ACTION 1130 |
| 147778 | | -#define YY_NO_ACTION 1131 |
| 147779 | | -#define YY_MIN_REDUCE 1132 |
| 147780 | | -#define YY_MAX_REDUCE 1500 |
| 148352 | +#define YYNSTATE 541 |
| 148353 | +#define YYNRULE 375 |
| 148354 | +#define YYNTOKEN 159 |
| 148355 | +#define YY_MAX_SHIFT 540 |
| 148356 | +#define YY_MIN_SHIFTREDUCE 784 |
| 148357 | +#define YY_MAX_SHIFTREDUCE 1158 |
| 148358 | +#define YY_ERROR_ACTION 1159 |
| 148359 | +#define YY_ACCEPT_ACTION 1160 |
| 148360 | +#define YY_NO_ACTION 1161 |
| 148361 | +#define YY_MIN_REDUCE 1162 |
| 148362 | +#define YY_MAX_REDUCE 1536 |
| 147781 | 148363 | /************* End control #defines *******************************************/ |
| 147782 | 148364 | #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) |
| 147783 | 148365 | |
| 147784 | 148366 | /* Define the yytestcase() macro to be a no-op if is not already defined |
| 147785 | 148367 | ** otherwise. |
| | @@ -147842,573 +148424,606 @@ |
| 147842 | 148424 | ** yy_reduce_ofst[] For each state, the offset into yy_action for |
| 147843 | 148425 | ** shifting non-terminals after a reduce. |
| 147844 | 148426 | ** yy_default[] Default action for each state. |
| 147845 | 148427 | ** |
| 147846 | 148428 | *********** Begin parsing tables **********************************************/ |
| 147847 | | -#define YY_ACTTAB_COUNT (2009) |
| 148429 | +#define YY_ACTTAB_COUNT (2142) |
| 147848 | 148430 | static const YYACTIONTYPE yy_action[] = { |
| 147849 | | - /* 0 */ 377, 518, 371, 107, 104, 200, 1293, 518, 1130, 1, |
| 147850 | | - /* 10 */ 1, 523, 2, 1134, 518, 1203, 1203, 1262, 277, 373, |
| 147851 | | - /* 20 */ 129, 495, 37, 37, 1397, 1201, 1201, 1211, 65, 65, |
| 147852 | | - /* 30 */ 480, 891, 107, 104, 200, 37, 37, 1043, 1494, 892, |
| 147853 | | - /* 40 */ 346, 1494, 342, 114, 115, 105, 1106, 1106, 957, 960, |
| 147854 | | - /* 50 */ 950, 950, 112, 112, 113, 113, 113, 113, 285, 254, |
| 147855 | | - /* 60 */ 254, 518, 254, 254, 500, 518, 495, 518, 107, 104, |
| 147856 | | - /* 70 */ 200, 1085, 515, 481, 386, 515, 1464, 442, 501, 230, |
| 147857 | | - /* 80 */ 197, 439, 37, 37, 1172, 210, 65, 65, 65, 65, |
| 147858 | | - /* 90 */ 254, 254, 111, 111, 111, 111, 110, 110, 109, 109, |
| 147859 | | - /* 100 */ 109, 108, 404, 515, 404, 155, 1041, 431, 401, 400, |
| 147860 | | - /* 110 */ 254, 254, 373, 1431, 1427, 408, 1110, 1085, 1086, 1087, |
| 147861 | | - /* 120 */ 284, 1112, 500, 515, 500, 368, 1433, 1421, 1428, 1111, |
| 147862 | | - /* 130 */ 1261, 499, 373, 502, 108, 404, 114, 115, 105, 1106, |
| 147863 | | - /* 140 */ 1106, 957, 960, 950, 950, 112, 112, 113, 113, 113, |
| 147864 | | - /* 150 */ 113, 276, 509, 1113, 369, 1113, 114, 115, 105, 1106, |
| 147865 | | - /* 160 */ 1106, 957, 960, 950, 950, 112, 112, 113, 113, 113, |
| 147866 | | - /* 170 */ 113, 496, 1420, 1431, 493, 1468, 1065, 260, 1063, 433, |
| 147867 | | - /* 180 */ 74, 107, 104, 200, 498, 111, 111, 111, 111, 110, |
| 147868 | | - /* 190 */ 110, 109, 109, 109, 108, 404, 373, 113, 113, 113, |
| 147869 | | - /* 200 */ 113, 106, 131, 91, 1361, 111, 111, 111, 111, 110, |
| 147870 | | - /* 210 */ 110, 109, 109, 109, 108, 404, 113, 113, 113, 113, |
| 147871 | | - /* 220 */ 114, 115, 105, 1106, 1106, 957, 960, 950, 950, 112, |
| 147872 | | - /* 230 */ 112, 113, 113, 113, 113, 111, 111, 111, 111, 110, |
| 147873 | | - /* 240 */ 110, 109, 109, 109, 108, 404, 116, 110, 110, 109, |
| 147874 | | - /* 250 */ 109, 109, 108, 404, 111, 111, 111, 111, 110, 110, |
| 147875 | | - /* 260 */ 109, 109, 109, 108, 404, 917, 512, 512, 512, 111, |
| 147876 | | - /* 270 */ 111, 111, 111, 110, 110, 109, 109, 109, 108, 404, |
| 147877 | | - /* 280 */ 517, 1198, 1177, 181, 109, 109, 109, 108, 404, 373, |
| 147878 | | - /* 290 */ 1198, 402, 402, 402, 75, 360, 111, 111, 111, 111, |
| 147879 | | - /* 300 */ 110, 110, 109, 109, 109, 108, 404, 382, 299, 419, |
| 147880 | | - /* 310 */ 287, 170, 518, 114, 115, 105, 1106, 1106, 957, 960, |
| 147881 | | - /* 320 */ 950, 950, 112, 112, 113, 113, 113, 113, 1444, 523, |
| 147882 | | - /* 330 */ 2, 1134, 518, 13, 13, 337, 277, 1085, 129, 226, |
| 147883 | | - /* 340 */ 937, 1058, 1000, 471, 917, 1211, 453, 384, 1085, 395, |
| 147884 | | - /* 350 */ 162, 1057, 155, 45, 45, 416, 928, 401, 400, 479, |
| 147885 | | - /* 360 */ 927, 12, 111, 111, 111, 111, 110, 110, 109, 109, |
| 147886 | | - /* 370 */ 109, 108, 404, 226, 286, 254, 254, 254, 254, 518, |
| 147887 | | - /* 380 */ 16, 16, 373, 1085, 1086, 1087, 314, 299, 515, 472, |
| 147888 | | - /* 390 */ 515, 927, 927, 929, 1085, 1086, 1087, 378, 276, 509, |
| 147889 | | - /* 400 */ 65, 65, 1113, 210, 1113, 1085, 114, 115, 105, 1106, |
| 147890 | | - /* 410 */ 1106, 957, 960, 950, 950, 112, 112, 113, 113, 113, |
| 147891 | | - /* 420 */ 113, 1448, 222, 1134, 1089, 461, 458, 457, 277, 180, |
| 147892 | | - /* 430 */ 129, 378, 392, 408, 423, 456, 500, 1211, 240, 257, |
| 147893 | | - /* 440 */ 324, 464, 319, 463, 227, 470, 12, 317, 424, 300, |
| 147894 | | - /* 450 */ 317, 1085, 1086, 1087, 485, 111, 111, 111, 111, 110, |
| 147895 | | - /* 460 */ 110, 109, 109, 109, 108, 404, 181, 118, 1085, 254, |
| 147896 | | - /* 470 */ 254, 1089, 518, 90, 351, 373, 518, 1181, 365, 798, |
| 147897 | | - /* 480 */ 1440, 339, 515, 248, 248, 77, 325, 133, 1085, 249, |
| 147898 | | - /* 490 */ 424, 300, 794, 49, 49, 210, 515, 65, 65, 114, |
| 147899 | | - /* 500 */ 115, 105, 1106, 1106, 957, 960, 950, 950, 112, 112, |
| 147900 | | - /* 510 */ 113, 113, 113, 113, 1085, 1086, 1087, 222, 1085, 438, |
| 147901 | | - /* 520 */ 461, 458, 457, 937, 787, 408, 171, 857, 362, 1021, |
| 147902 | | - /* 530 */ 456, 136, 198, 486, 1085, 1086, 1087, 448, 794, 928, |
| 147903 | | - /* 540 */ 5, 193, 192, 927, 1022, 107, 104, 200, 111, 111, |
| 147904 | | - /* 550 */ 111, 111, 110, 110, 109, 109, 109, 108, 404, 1023, |
| 147905 | | - /* 560 */ 254, 254, 803, 1085, 1085, 1086, 1087, 437, 373, 1085, |
| 147906 | | - /* 570 */ 344, 787, 791, 515, 927, 927, 929, 1085, 1408, 1396, |
| 147907 | | - /* 580 */ 832, 1085, 176, 3, 852, 1085, 518, 1439, 429, 851, |
| 147908 | | - /* 590 */ 833, 518, 114, 115, 105, 1106, 1106, 957, 960, 950, |
| 147909 | | - /* 600 */ 950, 112, 112, 113, 113, 113, 113, 13, 13, 1085, |
| 147910 | | - /* 610 */ 1086, 1087, 13, 13, 518, 1085, 1086, 1087, 1496, 358, |
| 147911 | | - /* 620 */ 1085, 389, 1234, 1085, 1086, 1087, 391, 1085, 1086, 1087, |
| 147912 | | - /* 630 */ 448, 1085, 1086, 1087, 518, 65, 65, 947, 947, 958, |
| 147913 | | - /* 640 */ 961, 111, 111, 111, 111, 110, 110, 109, 109, 109, |
| 147914 | | - /* 650 */ 108, 404, 518, 382, 878, 13, 13, 518, 877, 518, |
| 147915 | | - /* 660 */ 263, 373, 518, 431, 448, 1070, 1085, 1086, 1087, 267, |
| 147916 | | - /* 670 */ 448, 488, 1360, 64, 64, 431, 812, 155, 50, 50, |
| 147917 | | - /* 680 */ 65, 65, 518, 65, 65, 114, 115, 105, 1106, 1106, |
| 147918 | | - /* 690 */ 957, 960, 950, 950, 112, 112, 113, 113, 113, 113, |
| 147919 | | - /* 700 */ 518, 951, 382, 13, 13, 415, 411, 462, 414, 1085, |
| 147920 | | - /* 710 */ 1366, 777, 1210, 292, 297, 813, 399, 497, 181, 403, |
| 147921 | | - /* 720 */ 261, 15, 15, 276, 509, 414, 413, 1366, 1368, 410, |
| 147922 | | - /* 730 */ 372, 345, 1209, 264, 111, 111, 111, 111, 110, 110, |
| 147923 | | - /* 740 */ 109, 109, 109, 108, 404, 265, 254, 254, 229, 1405, |
| 147924 | | - /* 750 */ 268, 1215, 268, 1103, 373, 1085, 1086, 1087, 938, 515, |
| 147925 | | - /* 760 */ 393, 409, 876, 515, 254, 254, 1152, 482, 473, 262, |
| 147926 | | - /* 770 */ 422, 476, 325, 503, 289, 518, 291, 515, 114, 115, |
| 147927 | | - /* 780 */ 105, 1106, 1106, 957, 960, 950, 950, 112, 112, 113, |
| 147928 | | - /* 790 */ 113, 113, 113, 414, 1021, 1366, 39, 39, 254, 254, |
| 147929 | | - /* 800 */ 254, 254, 980, 254, 254, 254, 254, 255, 255, 1022, |
| 147930 | | - /* 810 */ 279, 515, 516, 515, 846, 846, 515, 138, 515, 518, |
| 147931 | | - /* 820 */ 515, 1043, 1495, 251, 1023, 1495, 876, 111, 111, 111, |
| 147932 | | - /* 830 */ 111, 110, 110, 109, 109, 109, 108, 404, 518, 1353, |
| 147933 | | - /* 840 */ 51, 51, 518, 199, 518, 506, 290, 373, 518, 276, |
| 147934 | | - /* 850 */ 509, 922, 9, 483, 233, 1005, 1005, 445, 189, 52, |
| 147935 | | - /* 860 */ 52, 325, 280, 53, 53, 54, 54, 373, 876, 55, |
| 147936 | | - /* 870 */ 55, 114, 115, 105, 1106, 1106, 957, 960, 950, 950, |
| 147937 | | - /* 880 */ 112, 112, 113, 113, 113, 113, 97, 518, 95, 1104, |
| 147938 | | - /* 890 */ 1041, 114, 115, 105, 1106, 1106, 957, 960, 950, 950, |
| 147939 | | - /* 900 */ 112, 112, 113, 113, 113, 113, 135, 199, 56, 56, |
| 147940 | | - /* 910 */ 765, 766, 767, 225, 224, 223, 518, 283, 437, 233, |
| 147941 | | - /* 920 */ 111, 111, 111, 111, 110, 110, 109, 109, 109, 108, |
| 147942 | | - /* 930 */ 404, 1002, 876, 326, 518, 1002, 1104, 40, 40, 518, |
| 147943 | | - /* 940 */ 111, 111, 111, 111, 110, 110, 109, 109, 109, 108, |
| 147944 | | - /* 950 */ 404, 518, 448, 518, 1104, 41, 41, 518, 17, 518, |
| 147945 | | - /* 960 */ 43, 43, 1155, 379, 518, 448, 518, 443, 518, 390, |
| 147946 | | - /* 970 */ 518, 194, 44, 44, 57, 57, 1247, 518, 58, 58, |
| 147947 | | - /* 980 */ 59, 59, 518, 466, 326, 14, 14, 60, 60, 120, |
| 147948 | | - /* 990 */ 120, 61, 61, 449, 1206, 93, 518, 425, 46, 46, |
| 147949 | | - /* 1000 */ 518, 1104, 518, 62, 62, 518, 437, 305, 518, 852, |
| 147950 | | - /* 1010 */ 518, 298, 518, 1246, 851, 373, 518, 63, 63, 1293, |
| 147951 | | - /* 1020 */ 397, 47, 47, 142, 142, 1467, 143, 143, 821, 70, |
| 147952 | | - /* 1030 */ 70, 48, 48, 66, 66, 373, 518, 121, 121, 114, |
| 147953 | | - /* 1040 */ 115, 105, 1106, 1106, 957, 960, 950, 950, 112, 112, |
| 147954 | | - /* 1050 */ 113, 113, 113, 113, 518, 418, 518, 67, 67, 114, |
| 147955 | | - /* 1060 */ 115, 105, 1106, 1106, 957, 960, 950, 950, 112, 112, |
| 147956 | | - /* 1070 */ 113, 113, 113, 113, 312, 122, 122, 123, 123, 1293, |
| 147957 | | - /* 1080 */ 518, 357, 1126, 88, 518, 435, 325, 387, 111, 111, |
| 147958 | | - /* 1090 */ 111, 111, 110, 110, 109, 109, 109, 108, 404, 266, |
| 147959 | | - /* 1100 */ 518, 119, 119, 518, 1293, 141, 141, 518, 111, 111, |
| 147960 | | - /* 1110 */ 111, 111, 110, 110, 109, 109, 109, 108, 404, 518, |
| 147961 | | - /* 1120 */ 801, 140, 140, 518, 127, 127, 511, 379, 126, 126, |
| 147962 | | - /* 1130 */ 518, 137, 518, 1308, 518, 307, 518, 310, 518, 203, |
| 147963 | | - /* 1140 */ 124, 124, 1307, 96, 125, 125, 207, 388, 1441, 468, |
| 147964 | | - /* 1150 */ 1127, 69, 69, 71, 71, 68, 68, 38, 38, 42, |
| 147965 | | - /* 1160 */ 42, 357, 1042, 373, 1293, 276, 509, 801, 185, 469, |
| 147966 | | - /* 1170 */ 494, 436, 444, 6, 380, 156, 253, 197, 469, 134, |
| 147967 | | - /* 1180 */ 426, 33, 1038, 373, 1121, 359, 1411, 114, 115, 105, |
| 147968 | | - /* 1190 */ 1106, 1106, 957, 960, 950, 950, 112, 112, 113, 113, |
| 147969 | | - /* 1200 */ 113, 113, 914, 296, 27, 293, 90, 114, 103, 105, |
| 147970 | | - /* 1210 */ 1106, 1106, 957, 960, 950, 950, 112, 112, 113, 113, |
| 147971 | | - /* 1220 */ 113, 113, 919, 275, 430, 232, 891, 232, 432, 256, |
| 147972 | | - /* 1230 */ 1127, 232, 398, 370, 892, 28, 111, 111, 111, 111, |
| 147973 | | - /* 1240 */ 110, 110, 109, 109, 109, 108, 404, 301, 454, 1385, |
| 147974 | | - /* 1250 */ 90, 228, 209, 987, 811, 810, 111, 111, 111, 111, |
| 147975 | | - /* 1260 */ 110, 110, 109, 109, 109, 108, 404, 315, 818, 819, |
| 147976 | | - /* 1270 */ 90, 323, 983, 931, 885, 228, 373, 232, 999, 849, |
| 147977 | | - /* 1280 */ 999, 322, 102, 998, 1384, 998, 785, 850, 440, 132, |
| 147978 | | - /* 1290 */ 102, 302, 1243, 306, 309, 311, 373, 313, 1194, 1180, |
| 147979 | | - /* 1300 */ 987, 115, 105, 1106, 1106, 957, 960, 950, 950, 112, |
| 147980 | | - /* 1310 */ 112, 113, 113, 113, 113, 1178, 1179, 318, 327, 328, |
| 147981 | | - /* 1320 */ 931, 1255, 105, 1106, 1106, 957, 960, 950, 950, 112, |
| 147982 | | - /* 1330 */ 112, 113, 113, 113, 113, 1292, 1230, 1457, 273, 1241, |
| 147983 | | - /* 1340 */ 504, 505, 1298, 100, 510, 246, 4, 1161, 1154, 111, |
| 147984 | | - /* 1350 */ 111, 111, 111, 110, 110, 109, 109, 109, 108, 404, |
| 147985 | | - /* 1360 */ 513, 1143, 187, 1142, 202, 1144, 1451, 356, 1227, 111, |
| 147986 | | - /* 1370 */ 111, 111, 111, 110, 110, 109, 109, 109, 108, 404, |
| 147987 | | - /* 1380 */ 11, 1277, 330, 405, 332, 334, 191, 1285, 364, 195, |
| 147988 | | - /* 1390 */ 295, 417, 288, 100, 510, 507, 4, 434, 459, 321, |
| 147989 | | - /* 1400 */ 1177, 349, 1357, 1356, 336, 155, 190, 1454, 1121, 158, |
| 147990 | | - /* 1410 */ 513, 508, 235, 1404, 937, 1402, 1118, 381, 77, 428, |
| 147991 | | - /* 1420 */ 98, 98, 8, 1282, 168, 30, 152, 99, 160, 405, |
| 147992 | | - /* 1430 */ 520, 519, 88, 405, 927, 1362, 1274, 420, 163, 73, |
| 147993 | | - /* 1440 */ 164, 76, 165, 166, 421, 507, 452, 212, 361, 363, |
| 147994 | | - /* 1450 */ 427, 276, 509, 31, 1288, 172, 491, 441, 216, 1351, |
| 147995 | | - /* 1460 */ 82, 490, 447, 1373, 937, 927, 927, 929, 930, 24, |
| 147996 | | - /* 1470 */ 98, 98, 304, 247, 218, 177, 308, 99, 219, 405, |
| 147997 | | - /* 1480 */ 520, 519, 450, 1145, 927, 220, 366, 1197, 100, 510, |
| 147998 | | - /* 1490 */ 465, 4, 1188, 1196, 1195, 394, 803, 1169, 1187, 367, |
| 147999 | | - /* 1500 */ 1168, 396, 484, 320, 1167, 513, 1466, 87, 475, 100, |
| 148000 | | - /* 1510 */ 510, 271, 4, 272, 478, 927, 927, 929, 930, 24, |
| 148001 | | - /* 1520 */ 1443, 1074, 407, 1238, 1239, 258, 513, 329, 405, 331, |
| 148002 | | - /* 1530 */ 355, 355, 354, 243, 352, 234, 489, 774, 498, 184, |
| 148003 | | - /* 1540 */ 507, 338, 1422, 339, 117, 1220, 10, 341, 333, 405, |
| 148004 | | - /* 1550 */ 204, 491, 282, 1219, 1237, 1236, 492, 335, 343, 937, |
| 148005 | | - /* 1560 */ 281, 507, 94, 1337, 186, 98, 98, 347, 89, 487, |
| 148006 | | - /* 1570 */ 348, 241, 99, 29, 405, 520, 519, 274, 1151, 927, |
| 148007 | | - /* 1580 */ 937, 521, 1080, 245, 242, 244, 98, 98, 856, 522, |
| 148008 | | - /* 1590 */ 206, 1140, 1135, 99, 144, 405, 520, 519, 147, 375, |
| 148009 | | - /* 1600 */ 927, 149, 376, 157, 1389, 1390, 1388, 1387, 205, 145, |
| 148010 | | - /* 1610 */ 927, 927, 929, 930, 24, 146, 130, 761, 1165, 1164, |
| 148011 | | - /* 1620 */ 72, 100, 510, 1162, 4, 269, 406, 188, 278, 201, |
| 148012 | | - /* 1630 */ 259, 927, 927, 929, 930, 24, 128, 911, 513, 997, |
| 148013 | | - /* 1640 */ 995, 159, 374, 208, 148, 161, 835, 276, 509, 211, |
| 148014 | | - /* 1650 */ 294, 1011, 915, 167, 150, 383, 169, 78, 385, 79, |
| 148015 | | - /* 1660 */ 80, 405, 81, 151, 1014, 213, 214, 1010, 139, 18, |
| 148016 | | - /* 1670 */ 412, 215, 303, 507, 232, 1115, 1003, 446, 173, 217, |
| 148017 | | - /* 1680 */ 174, 32, 776, 451, 491, 322, 221, 175, 814, 490, |
| 148018 | | - /* 1690 */ 83, 455, 937, 19, 460, 316, 20, 84, 98, 98, |
| 148019 | | - /* 1700 */ 270, 182, 85, 467, 153, 99, 154, 405, 520, 519, |
| 148020 | | - /* 1710 */ 1074, 407, 927, 183, 258, 963, 1046, 86, 34, 355, |
| 148021 | | - /* 1720 */ 355, 354, 243, 352, 474, 1047, 774, 35, 477, 196, |
| 148022 | | - /* 1730 */ 250, 100, 510, 252, 4, 884, 178, 231, 1060, 204, |
| 148023 | | - /* 1740 */ 21, 282, 102, 927, 927, 929, 930, 24, 513, 281, |
| 148024 | | - /* 1750 */ 879, 22, 1064, 1062, 1051, 7, 340, 23, 978, 179, |
| 148025 | | - /* 1760 */ 90, 92, 510, 964, 4, 236, 962, 966, 1020, 1019, |
| 148026 | | - /* 1770 */ 237, 405, 967, 25, 36, 514, 932, 786, 513, 206, |
| 148027 | | - /* 1780 */ 101, 26, 845, 507, 238, 239, 1459, 147, 350, 1458, |
| 148028 | | - /* 1790 */ 149, 353, 1075, 1131, 1131, 1131, 1131, 205, 1131, 1131, |
| 148029 | | - /* 1800 */ 1131, 405, 937, 1131, 1131, 1131, 1131, 1131, 98, 98, |
| 148030 | | - /* 1810 */ 1131, 1131, 1131, 507, 1131, 99, 1131, 405, 520, 519, |
| 148031 | | - /* 1820 */ 1131, 1131, 927, 1131, 1131, 1131, 1131, 1131, 1131, 1131, |
| 148032 | | - /* 1830 */ 1131, 374, 937, 1131, 1131, 1131, 276, 509, 98, 98, |
| 148033 | | - /* 1840 */ 1131, 1131, 1131, 1131, 1131, 99, 1131, 405, 520, 519, |
| 148034 | | - /* 1850 */ 1131, 1131, 927, 927, 927, 929, 930, 24, 1131, 412, |
| 148035 | | - /* 1860 */ 1131, 1131, 1131, 258, 1131, 1131, 1131, 1131, 355, 355, |
| 148036 | | - /* 1870 */ 354, 243, 352, 1131, 1131, 774, 1131, 1131, 1131, 1131, |
| 148037 | | - /* 1880 */ 1131, 1131, 1131, 927, 927, 929, 930, 24, 204, 1131, |
| 148038 | | - /* 1890 */ 282, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 281, 1131, |
| 148039 | | - /* 1900 */ 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, |
| 148040 | | - /* 1910 */ 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, |
| 148041 | | - /* 1920 */ 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 206, 1131, |
| 148042 | | - /* 1930 */ 1131, 1131, 1131, 1131, 1131, 1131, 147, 1131, 1131, 149, |
| 148043 | | - /* 1940 */ 1131, 1131, 1131, 1131, 1131, 1131, 205, 1131, 1131, 1131, |
| 148044 | | - /* 1950 */ 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, |
| 148045 | | - /* 1960 */ 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, |
| 148046 | | - /* 1970 */ 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, |
| 148047 | | - /* 1980 */ 374, 1131, 1131, 1131, 1131, 276, 509, 1131, 1131, 1131, |
| 148048 | | - /* 1990 */ 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, |
| 148049 | | - /* 2000 */ 1131, 1131, 1131, 1131, 1131, 1131, 1131, 1131, 412, |
| 148431 | + /* 0 */ 388, 112, 109, 209, 535, 190, 442, 259, 1160, 1, |
| 148432 | + /* 10 */ 1, 540, 2, 1164, 535, 1292, 1500, 371, 289, 384, |
| 148433 | + /* 20 */ 134, 1484, 1427, 1164, 1202, 69, 69, 1241, 289, 492, |
| 148434 | + /* 30 */ 134, 915, 382, 296, 175, 42, 42, 1241, 242, 916, |
| 148435 | + /* 40 */ 112, 109, 209, 119, 120, 110, 1136, 1136, 981, 984, |
| 148436 | + /* 50 */ 974, 974, 117, 117, 118, 118, 118, 118, 1291, 264, |
| 148437 | + /* 60 */ 264, 264, 264, 112, 109, 209, 112, 109, 209, 264, |
| 148438 | + /* 70 */ 264, 1115, 532, 1134, 532, 176, 270, 453, 239, 206, |
| 148439 | + /* 80 */ 379, 450, 532, 356, 380, 219, 118, 118, 118, 118, |
| 148440 | + /* 90 */ 111, 444, 535, 1233, 1233, 219, 116, 116, 116, 116, |
| 148441 | + /* 100 */ 115, 115, 114, 114, 114, 113, 415, 258, 258, 112, |
| 148442 | + /* 110 */ 109, 209, 1115, 42, 42, 419, 384, 1391, 1504, 1115, |
| 148443 | + /* 120 */ 532, 1115, 1116, 1117, 1134, 419, 1463, 351, 116, 116, |
| 148444 | + /* 130 */ 116, 116, 115, 115, 114, 114, 114, 113, 415, 961, |
| 148445 | + /* 140 */ 119, 120, 110, 1136, 1136, 981, 984, 974, 974, 117, |
| 148446 | + /* 150 */ 117, 118, 118, 118, 118, 952, 1228, 1207, 1115, 951, |
| 148447 | + /* 160 */ 412, 411, 1115, 1116, 1117, 1228, 535, 876, 1140, 1115, |
| 148448 | + /* 170 */ 1116, 1117, 875, 1142, 941, 114, 114, 114, 113, 415, |
| 148449 | + /* 180 */ 1089, 1141, 1089, 118, 118, 118, 118, 42, 42, 202, |
| 148450 | + /* 190 */ 951, 951, 953, 116, 116, 116, 116, 115, 115, 114, |
| 148451 | + /* 200 */ 114, 114, 113, 415, 1465, 1143, 350, 1143, 1115, 1116, |
| 148452 | + /* 210 */ 1117, 231, 415, 384, 472, 469, 468, 412, 411, 442, |
| 148453 | + /* 220 */ 96, 311, 430, 299, 467, 116, 116, 116, 116, 115, |
| 148454 | + /* 230 */ 115, 114, 114, 114, 113, 415, 160, 119, 120, 110, |
| 148455 | + /* 240 */ 1136, 1136, 981, 984, 974, 974, 117, 117, 118, 118, |
| 148456 | + /* 250 */ 118, 118, 115, 115, 114, 114, 114, 113, 415, 529, |
| 148457 | + /* 260 */ 529, 529, 1143, 121, 1143, 116, 116, 116, 116, 115, |
| 148458 | + /* 270 */ 115, 114, 114, 114, 113, 415, 941, 337, 1463, 506, |
| 148459 | + /* 280 */ 491, 1067, 1530, 384, 160, 1530, 288, 526, 1115, 274, |
| 148460 | + /* 290 */ 116, 116, 116, 116, 115, 115, 114, 114, 114, 113, |
| 148461 | + /* 300 */ 415, 16, 16, 406, 535, 93, 512, 119, 120, 110, |
| 148462 | + /* 310 */ 1136, 1136, 981, 984, 974, 974, 117, 117, 118, 118, |
| 148463 | + /* 320 */ 118, 118, 141, 311, 231, 54, 54, 472, 469, 468, |
| 148464 | + /* 330 */ 427, 79, 368, 1156, 288, 526, 32, 467, 1115, 1116, |
| 148465 | + /* 340 */ 1117, 1323, 1480, 540, 2, 1164, 971, 971, 982, 985, |
| 148466 | + /* 350 */ 289, 384, 134, 459, 1065, 533, 80, 870, 870, 1241, |
| 148467 | + /* 360 */ 116, 116, 116, 116, 115, 115, 114, 114, 114, 113, |
| 148468 | + /* 370 */ 415, 818, 82, 1115, 1476, 119, 120, 110, 1136, 1136, |
| 148469 | + /* 380 */ 981, 984, 974, 974, 117, 117, 118, 118, 118, 118, |
| 148470 | + /* 390 */ 403, 264, 264, 238, 535, 1426, 250, 267, 336, 475, |
| 148471 | + /* 400 */ 331, 474, 236, 459, 532, 1157, 961, 459, 329, 397, |
| 148472 | + /* 410 */ 373, 513, 1450, 159, 975, 70, 70, 219, 413, 413, |
| 148473 | + /* 420 */ 413, 818, 952, 1115, 1116, 1117, 951, 534, 116, 116, |
| 148474 | + /* 430 */ 116, 116, 115, 115, 114, 114, 114, 113, 415, 1115, |
| 148475 | + /* 440 */ 535, 442, 264, 264, 1115, 1390, 535, 419, 384, 422, |
| 148476 | + /* 450 */ 1115, 517, 326, 1245, 304, 532, 1084, 951, 951, 953, |
| 148477 | + /* 460 */ 493, 70, 70, 167, 509, 532, 1084, 70, 70, 1084, |
| 148478 | + /* 470 */ 440, 535, 119, 120, 110, 1136, 1136, 981, 984, 974, |
| 148479 | + /* 480 */ 974, 117, 117, 118, 118, 118, 118, 881, 535, 1115, |
| 148480 | + /* 490 */ 1116, 1117, 55, 55, 1115, 1116, 1117, 517, 288, 526, |
| 148481 | + /* 500 */ 1115, 1116, 1117, 517, 420, 494, 516, 113, 415, 13, |
| 148482 | + /* 510 */ 13, 275, 482, 836, 349, 301, 535, 303, 500, 5, |
| 148483 | + /* 520 */ 480, 1457, 138, 395, 6, 116, 116, 116, 116, 115, |
| 148484 | + /* 530 */ 115, 114, 114, 114, 113, 415, 1458, 13, 13, 6, |
| 148485 | + /* 540 */ 535, 1024, 1115, 535, 473, 384, 535, 435, 312, 822, |
| 148486 | + /* 550 */ 1084, 400, 837, 159, 518, 181, 1115, 483, 502, 811, |
| 148487 | + /* 560 */ 1084, 70, 70, 1084, 70, 70, 1115, 50, 50, 119, |
| 148488 | + /* 570 */ 120, 110, 1136, 1136, 981, 984, 974, 974, 117, 117, |
| 148489 | + /* 580 */ 118, 118, 118, 118, 95, 338, 264, 264, 1115, 264, |
| 148490 | + /* 590 */ 264, 302, 1115, 1116, 1117, 495, 3, 498, 535, 532, |
| 148491 | + /* 600 */ 517, 404, 532, 484, 801, 287, 1115, 1116, 1117, 519, |
| 148492 | + /* 610 */ 811, 337, 501, 12, 535, 381, 1115, 1116, 1117, 70, |
| 148493 | + /* 620 */ 70, 401, 116, 116, 116, 116, 115, 115, 114, 114, |
| 148494 | + /* 630 */ 114, 113, 415, 1115, 1084, 13, 13, 535, 1115, 1116, |
| 148495 | + /* 640 */ 1117, 1115, 384, 902, 1084, 1211, 815, 1084, 393, 402, |
| 148496 | + /* 650 */ 160, 435, 312, 1532, 369, 284, 143, 297, 70, 70, |
| 148497 | + /* 660 */ 510, 1457, 337, 433, 6, 901, 119, 120, 110, 1136, |
| 148498 | + /* 670 */ 1136, 981, 984, 974, 974, 117, 117, 118, 118, 118, |
| 148499 | + /* 680 */ 118, 1045, 426, 1115, 1116, 1117, 449, 535, 12, 264, |
| 148500 | + /* 690 */ 264, 1115, 1116, 1117, 285, 535, 1046, 265, 265, 1004, |
| 148501 | + /* 700 */ 288, 526, 532, 789, 790, 791, 190, 140, 70, 70, |
| 148502 | + /* 710 */ 532, 1047, 1323, 535, 309, 298, 13, 13, 383, 116, |
| 148503 | + /* 720 */ 116, 116, 116, 115, 115, 114, 114, 114, 113, 415, |
| 148504 | + /* 730 */ 277, 535, 856, 190, 13, 13, 1383, 497, 278, 384, |
| 148505 | + /* 740 */ 278, 362, 857, 1100, 410, 376, 264, 264, 184, 900, |
| 148506 | + /* 750 */ 1210, 1239, 70, 70, 1182, 1455, 187, 535, 6, 532, |
| 148507 | + /* 760 */ 535, 434, 207, 119, 120, 110, 1136, 1136, 981, 984, |
| 148508 | + /* 770 */ 974, 974, 117, 117, 118, 118, 118, 118, 13, 13, |
| 148509 | + /* 780 */ 398, 13, 13, 264, 264, 393, 264, 264, 414, 1185, |
| 148510 | + /* 790 */ 390, 425, 185, 1396, 1084, 514, 532, 485, 9, 532, |
| 148511 | + /* 800 */ 242, 464, 1067, 1531, 1084, 488, 1531, 1084, 425, 424, |
| 148512 | + /* 810 */ 1396, 1398, 520, 1029, 1029, 456, 116, 116, 116, 116, |
| 148513 | + /* 820 */ 115, 115, 114, 114, 114, 113, 415, 535, 235, 264, |
| 148514 | + /* 830 */ 264, 508, 535, 393, 208, 1134, 384, 264, 264, 448, |
| 148515 | + /* 840 */ 962, 448, 532, 261, 264, 264, 900, 507, 15, 15, |
| 148516 | + /* 850 */ 532, 1026, 271, 44, 44, 1026, 1095, 532, 535, 900, |
| 148517 | + /* 860 */ 119, 120, 110, 1136, 1136, 981, 984, 974, 974, 117, |
| 148518 | + /* 870 */ 117, 118, 118, 118, 118, 1065, 425, 1045, 1396, 56, |
| 148519 | + /* 880 */ 56, 535, 368, 1066, 1231, 1231, 1134, 454, 535, 324, |
| 148520 | + /* 890 */ 389, 355, 1046, 234, 233, 232, 512, 459, 459, 459, |
| 148521 | + /* 900 */ 272, 448, 57, 57, 1095, 1438, 329, 1047, 535, 58, |
| 148522 | + /* 910 */ 58, 421, 477, 116, 116, 116, 116, 115, 115, 114, |
| 148523 | + /* 920 */ 114, 114, 113, 415, 1323, 535, 515, 535, 523, 59, |
| 148524 | + /* 930 */ 59, 208, 273, 384, 310, 1435, 1323, 946, 876, 1240, |
| 148525 | + /* 940 */ 1236, 317, 1456, 875, 136, 6, 60, 60, 61, 61, |
| 148526 | + /* 950 */ 319, 535, 322, 384, 535, 1157, 900, 119, 120, 110, |
| 148527 | + /* 960 */ 1136, 1136, 981, 984, 974, 974, 117, 117, 118, 118, |
| 148528 | + /* 970 */ 118, 118, 45, 45, 535, 46, 46, 119, 120, 110, |
| 148529 | + /* 980 */ 1136, 1136, 981, 984, 974, 974, 117, 117, 118, 118, |
| 148530 | + /* 990 */ 118, 118, 399, 338, 276, 48, 48, 337, 1477, 479, |
| 148531 | + /* 1000 */ 535, 107, 1451, 535, 455, 535, 1119, 95, 1338, 235, |
| 148532 | + /* 1010 */ 116, 116, 116, 116, 115, 115, 114, 114, 114, 113, |
| 148533 | + /* 1020 */ 415, 49, 49, 123, 62, 62, 63, 63, 535, 408, |
| 148534 | + /* 1030 */ 116, 116, 116, 116, 115, 115, 114, 114, 114, 113, |
| 148535 | + /* 1040 */ 415, 535, 142, 535, 481, 535, 1323, 535, 1503, 64, |
| 148536 | + /* 1050 */ 64, 845, 1454, 1337, 535, 6, 535, 1119, 535, 357, |
| 148537 | + /* 1060 */ 535, 353, 14, 14, 65, 65, 125, 125, 66, 66, |
| 148538 | + /* 1070 */ 535, 389, 535, 291, 535, 51, 51, 67, 67, 68, |
| 148539 | + /* 1080 */ 68, 52, 52, 292, 1453, 98, 535, 6, 535, 481, |
| 148540 | + /* 1090 */ 535, 147, 147, 148, 148, 75, 75, 535, 915, 535, |
| 148541 | + /* 1100 */ 827, 201, 200, 528, 390, 384, 916, 53, 53, 71, |
| 148542 | + /* 1110 */ 71, 126, 126, 515, 409, 288, 526, 216, 72, 72, |
| 148543 | + /* 1120 */ 127, 127, 391, 161, 535, 384, 535, 263, 206, 119, |
| 148544 | + /* 1130 */ 120, 110, 1136, 1136, 981, 984, 974, 974, 117, 117, |
| 148545 | + /* 1140 */ 118, 118, 118, 118, 535, 128, 128, 124, 124, 119, |
| 148546 | + /* 1150 */ 120, 110, 1136, 1136, 981, 984, 974, 974, 117, 117, |
| 148547 | + /* 1160 */ 118, 118, 118, 118, 446, 146, 146, 102, 1209, 100, |
| 148548 | + /* 1170 */ 1133, 212, 139, 535, 38, 437, 1062, 308, 535, 370, |
| 148549 | + /* 1180 */ 95, 295, 116, 116, 116, 116, 115, 115, 114, 114, |
| 148550 | + /* 1190 */ 114, 113, 415, 535, 145, 145, 535, 938, 535, 132, |
| 148551 | + /* 1200 */ 132, 535, 116, 116, 116, 116, 115, 115, 114, 114, |
| 148552 | + /* 1210 */ 114, 113, 415, 535, 131, 131, 1151, 129, 129, 130, |
| 148553 | + /* 1220 */ 130, 30, 74, 74, 535, 17, 535, 218, 535, 943, |
| 148554 | + /* 1230 */ 441, 1277, 241, 241, 76, 76, 443, 101, 313, 241, |
| 148555 | + /* 1240 */ 465, 95, 1023, 237, 1023, 73, 73, 43, 43, 47, |
| 148556 | + /* 1250 */ 47, 335, 31, 327, 447, 266, 95, 384, 1276, 835, |
| 148557 | + /* 1260 */ 834, 334, 193, 1007, 436, 429, 237, 825, 842, 843, |
| 148558 | + /* 1270 */ 1011, 909, 873, 955, 241, 107, 1022, 384, 1022, 197, |
| 148559 | + /* 1280 */ 1441, 119, 120, 110, 1136, 1136, 981, 984, 974, 974, |
| 148560 | + /* 1290 */ 117, 117, 118, 118, 118, 118, 809, 305, 1264, 137, |
| 148561 | + /* 1300 */ 1415, 119, 108, 110, 1136, 1136, 981, 984, 974, 974, |
| 148562 | + /* 1310 */ 117, 117, 118, 118, 118, 118, 874, 522, 825, 107, |
| 148563 | + /* 1320 */ 283, 1011, 1414, 1470, 955, 451, 314, 1273, 318, 321, |
| 148564 | + /* 1330 */ 323, 325, 1224, 1208, 116, 116, 116, 116, 115, 115, |
| 148565 | + /* 1340 */ 114, 114, 114, 113, 415, 330, 339, 340, 1285, 1322, |
| 148566 | + /* 1350 */ 1260, 1271, 521, 1328, 116, 116, 116, 116, 115, 115, |
| 148567 | + /* 1360 */ 114, 114, 114, 113, 415, 1191, 256, 1493, 1184, 1173, |
| 148568 | + /* 1370 */ 460, 1172, 1174, 1257, 384, 342, 1487, 344, 346, 199, |
| 148569 | + /* 1380 */ 195, 367, 11, 211, 307, 445, 1307, 428, 1315, 375, |
| 148570 | + /* 1390 */ 203, 1207, 470, 188, 384, 189, 525, 1490, 1151, 120, |
| 148571 | + /* 1400 */ 110, 1136, 1136, 981, 984, 974, 974, 117, 117, 118, |
| 148572 | + /* 1410 */ 118, 118, 118, 333, 1387, 1386, 245, 300, 348, 1434, |
| 148573 | + /* 1420 */ 110, 1136, 1136, 981, 984, 974, 974, 117, 117, 118, |
| 148574 | + /* 1430 */ 118, 118, 118, 198, 360, 163, 1432, 1148, 78, 81, |
| 148575 | + /* 1440 */ 392, 82, 1392, 439, 173, 105, 527, 157, 4, 165, |
| 148576 | + /* 1450 */ 1312, 116, 116, 116, 116, 115, 115, 114, 114, 114, |
| 148577 | + /* 1460 */ 113, 415, 530, 93, 35, 431, 432, 1304, 168, 463, |
| 148578 | + /* 1470 */ 221, 116, 116, 116, 116, 115, 115, 114, 114, 114, |
| 148579 | + /* 1480 */ 113, 415, 169, 170, 171, 416, 372, 438, 1318, 177, |
| 148580 | + /* 1490 */ 452, 374, 36, 225, 1381, 87, 458, 524, 257, 1403, |
| 148581 | + /* 1500 */ 316, 105, 527, 227, 4, 182, 461, 160, 320, 228, |
| 148582 | + /* 1510 */ 377, 1175, 229, 476, 405, 1227, 1226, 1225, 530, 827, |
| 148583 | + /* 1520 */ 961, 1218, 378, 1199, 1198, 407, 103, 103, 281, 1217, |
| 148584 | + /* 1530 */ 8, 332, 1197, 104, 1502, 416, 537, 536, 282, 487, |
| 148585 | + /* 1540 */ 951, 416, 490, 496, 1268, 92, 341, 243, 244, 1461, |
| 148586 | + /* 1550 */ 1269, 1267, 122, 524, 1266, 515, 10, 288, 526, 343, |
| 148587 | + /* 1560 */ 352, 1460, 354, 99, 504, 94, 499, 251, 1181, 503, |
| 148588 | + /* 1570 */ 194, 951, 951, 953, 954, 27, 961, 1250, 345, 347, |
| 148589 | + /* 1580 */ 1249, 358, 103, 103, 359, 34, 538, 1110, 1367, 104, |
| 148590 | + /* 1590 */ 255, 416, 537, 536, 539, 1170, 951, 286, 252, 254, |
| 148591 | + /* 1600 */ 149, 1165, 1419, 135, 1420, 785, 279, 1418, 417, 1417, |
| 148592 | + /* 1610 */ 1195, 196, 150, 290, 210, 269, 151, 1021, 133, 1194, |
| 148593 | + /* 1620 */ 1019, 935, 162, 386, 387, 77, 1192, 951, 951, 953, |
| 148594 | + /* 1630 */ 954, 27, 1479, 1104, 418, 164, 153, 268, 217, 166, |
| 148595 | + /* 1640 */ 859, 306, 366, 366, 365, 253, 363, 220, 1035, 798, |
| 148596 | + /* 1650 */ 172, 939, 105, 527, 155, 4, 394, 174, 396, 83, |
| 148597 | + /* 1660 */ 84, 85, 213, 86, 294, 1038, 156, 223, 222, 530, |
| 148598 | + /* 1670 */ 1034, 144, 293, 18, 224, 241, 315, 1027, 1145, 178, |
| 148599 | + /* 1680 */ 457, 226, 37, 179, 800, 334, 462, 230, 328, 466, |
| 148600 | + /* 1690 */ 180, 471, 416, 88, 19, 20, 89, 280, 838, 158, |
| 148601 | + /* 1700 */ 191, 478, 215, 1097, 524, 90, 204, 192, 987, 91, |
| 148602 | + /* 1710 */ 152, 1070, 39, 154, 1071, 504, 486, 40, 489, 205, |
| 148603 | + /* 1720 */ 505, 260, 105, 527, 214, 4, 908, 961, 262, 183, |
| 148604 | + /* 1730 */ 240, 21, 903, 103, 103, 107, 22, 1086, 23, 530, |
| 148605 | + /* 1740 */ 104, 1074, 416, 537, 536, 24, 1088, 951, 25, 1093, |
| 148606 | + /* 1750 */ 1090, 1094, 7, 33, 511, 186, 26, 1002, 385, 95, |
| 148607 | + /* 1760 */ 988, 986, 416, 288, 526, 990, 1044, 246, 1043, 247, |
| 148608 | + /* 1770 */ 991, 28, 41, 106, 524, 956, 810, 29, 951, 951, |
| 148609 | + /* 1780 */ 953, 954, 27, 531, 869, 504, 423, 248, 249, 1495, |
| 148610 | + /* 1790 */ 503, 1494, 361, 364, 1105, 1161, 1161, 961, 1161, 1161, |
| 148611 | + /* 1800 */ 1161, 1161, 1161, 103, 103, 1161, 1161, 1161, 1161, 1161, |
| 148612 | + /* 1810 */ 104, 1161, 416, 537, 536, 1104, 418, 951, 1161, 268, |
| 148613 | + /* 1820 */ 1161, 1161, 1161, 1161, 366, 366, 365, 253, 363, 1161, |
| 148614 | + /* 1830 */ 1161, 798, 1161, 1161, 1161, 1161, 105, 527, 1161, 4, |
| 148615 | + /* 1840 */ 1161, 1161, 1161, 1161, 213, 1161, 294, 1161, 951, 951, |
| 148616 | + /* 1850 */ 953, 954, 27, 530, 293, 1161, 1161, 1161, 1161, 1161, |
| 148617 | + /* 1860 */ 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, |
| 148618 | + /* 1870 */ 1161, 1161, 1161, 1161, 1161, 1161, 416, 1161, 1161, 1161, |
| 148619 | + /* 1880 */ 1161, 1161, 1161, 1161, 215, 1161, 1161, 1161, 524, 1161, |
| 148620 | + /* 1890 */ 1161, 1161, 152, 1161, 1161, 154, 105, 527, 1161, 4, |
| 148621 | + /* 1900 */ 1161, 1161, 1161, 1161, 1161, 1161, 214, 1161, 1161, 1161, |
| 148622 | + /* 1910 */ 1161, 961, 1161, 530, 1161, 1161, 1161, 103, 103, 880, |
| 148623 | + /* 1920 */ 1161, 1161, 1161, 1161, 104, 1161, 416, 537, 536, 1161, |
| 148624 | + /* 1930 */ 1161, 951, 1161, 1161, 1161, 1161, 416, 1161, 1161, 1161, |
| 148625 | + /* 1940 */ 385, 1161, 1161, 1161, 1161, 288, 526, 1161, 524, 1161, |
| 148626 | + /* 1950 */ 1161, 1161, 1161, 1161, 1161, 1161, 97, 527, 1161, 4, |
| 148627 | + /* 1960 */ 1161, 1161, 951, 951, 953, 954, 27, 1161, 423, 1161, |
| 148628 | + /* 1970 */ 1161, 961, 1161, 530, 1161, 1161, 1161, 103, 103, 1161, |
| 148629 | + /* 1980 */ 1161, 1161, 1161, 1161, 104, 1161, 416, 537, 536, 1161, |
| 148630 | + /* 1990 */ 1161, 951, 268, 1161, 1161, 1161, 416, 366, 366, 365, |
| 148631 | + /* 2000 */ 253, 363, 1161, 1161, 798, 1161, 1161, 1161, 524, 1161, |
| 148632 | + /* 2010 */ 1161, 1161, 1161, 1161, 1161, 1161, 1161, 213, 1161, 294, |
| 148633 | + /* 2020 */ 1161, 1161, 951, 951, 953, 954, 27, 293, 1161, 1161, |
| 148634 | + /* 2030 */ 1161, 961, 1161, 1161, 1161, 1161, 1161, 103, 103, 1161, |
| 148635 | + /* 2040 */ 1161, 1161, 1161, 1161, 104, 1161, 416, 537, 536, 1161, |
| 148636 | + /* 2050 */ 1161, 951, 1161, 1161, 1161, 1161, 1161, 215, 1161, 1161, |
| 148637 | + /* 2060 */ 1161, 1161, 1161, 1161, 1161, 152, 1161, 1161, 154, 1161, |
| 148638 | + /* 2070 */ 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 214, |
| 148639 | + /* 2080 */ 1161, 1161, 951, 951, 953, 954, 27, 1161, 1161, 1161, |
| 148640 | + /* 2090 */ 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, |
| 148641 | + /* 2100 */ 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, |
| 148642 | + /* 2110 */ 1161, 1161, 1161, 385, 1161, 1161, 1161, 1161, 288, 526, |
| 148643 | + /* 2120 */ 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, |
| 148644 | + /* 2130 */ 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, 1161, |
| 148645 | + /* 2140 */ 1161, 423, |
| 148050 | 148646 | }; |
| 148051 | 148647 | static const YYCODETYPE yy_lookahead[] = { |
| 148052 | | - /* 0 */ 168, 163, 184, 238, 239, 240, 163, 163, 155, 156, |
| 148053 | | - /* 10 */ 157, 158, 159, 160, 163, 202, 203, 187, 165, 19, |
| 148054 | | - /* 20 */ 167, 163, 184, 185, 259, 202, 203, 174, 184, 185, |
| 148055 | | - /* 30 */ 174, 31, 238, 239, 240, 184, 185, 22, 23, 39, |
| 148056 | | - /* 40 */ 216, 26, 218, 43, 44, 45, 46, 47, 48, 49, |
| 148057 | | - /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 174, 206, |
| 148058 | | - /* 60 */ 207, 163, 206, 207, 220, 163, 163, 163, 238, 239, |
| 148059 | | - /* 70 */ 240, 59, 219, 229, 231, 219, 183, 245, 174, 223, |
| 148060 | | - /* 80 */ 224, 249, 184, 185, 191, 232, 184, 185, 184, 185, |
| 148061 | | - /* 90 */ 206, 207, 92, 93, 94, 95, 96, 97, 98, 99, |
| 148062 | | - /* 100 */ 100, 101, 102, 219, 102, 81, 91, 163, 96, 97, |
| 148063 | | - /* 110 */ 206, 207, 19, 275, 276, 262, 104, 105, 106, 107, |
| 148064 | | - /* 120 */ 163, 109, 220, 219, 220, 184, 275, 269, 277, 117, |
| 148065 | | - /* 130 */ 187, 229, 19, 229, 101, 102, 43, 44, 45, 46, |
| 148066 | | - /* 140 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 148067 | | - /* 150 */ 57, 127, 128, 141, 184, 143, 43, 44, 45, 46, |
| 148068 | | - /* 160 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 148069 | | - /* 170 */ 57, 268, 269, 275, 276, 197, 83, 233, 85, 163, |
| 148070 | | - /* 180 */ 67, 238, 239, 240, 134, 92, 93, 94, 95, 96, |
| 148071 | | - /* 190 */ 97, 98, 99, 100, 101, 102, 19, 54, 55, 56, |
| 148072 | | - /* 200 */ 57, 58, 152, 26, 247, 92, 93, 94, 95, 96, |
| 148073 | | - /* 210 */ 97, 98, 99, 100, 101, 102, 54, 55, 56, 57, |
| 148074 | | - /* 220 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 148075 | | - /* 230 */ 53, 54, 55, 56, 57, 92, 93, 94, 95, 96, |
| 148076 | | - /* 240 */ 97, 98, 99, 100, 101, 102, 69, 96, 97, 98, |
| 148077 | | - /* 250 */ 99, 100, 101, 102, 92, 93, 94, 95, 96, 97, |
| 148078 | | - /* 260 */ 98, 99, 100, 101, 102, 73, 179, 180, 181, 92, |
| 148079 | | - /* 270 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, |
| 148080 | | - /* 280 */ 163, 191, 192, 163, 98, 99, 100, 101, 102, 19, |
| 148081 | | - /* 290 */ 200, 179, 180, 181, 24, 175, 92, 93, 94, 95, |
| 148082 | | - /* 300 */ 96, 97, 98, 99, 100, 101, 102, 163, 116, 117, |
| 148083 | | - /* 310 */ 118, 22, 163, 43, 44, 45, 46, 47, 48, 49, |
| 148084 | | - /* 320 */ 50, 51, 52, 53, 54, 55, 56, 57, 157, 158, |
| 148085 | | - /* 330 */ 159, 160, 163, 184, 185, 163, 165, 59, 167, 46, |
| 148086 | | - /* 340 */ 90, 76, 11, 174, 73, 174, 19, 198, 59, 19, |
| 148087 | | - /* 350 */ 72, 86, 81, 184, 185, 234, 106, 96, 97, 163, |
| 148088 | | - /* 360 */ 110, 182, 92, 93, 94, 95, 96, 97, 98, 99, |
| 148089 | | - /* 370 */ 100, 101, 102, 46, 230, 206, 207, 206, 207, 163, |
| 148090 | | - /* 380 */ 184, 185, 19, 105, 106, 107, 23, 116, 219, 220, |
| 148091 | | - /* 390 */ 219, 141, 142, 143, 105, 106, 107, 104, 127, 128, |
| 148092 | | - /* 400 */ 184, 185, 141, 232, 143, 59, 43, 44, 45, 46, |
| 148093 | | - /* 410 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 148094 | | - /* 420 */ 57, 158, 108, 160, 59, 111, 112, 113, 165, 250, |
| 148095 | | - /* 430 */ 167, 104, 102, 262, 255, 121, 220, 174, 108, 109, |
| 148096 | | - /* 440 */ 110, 111, 112, 113, 114, 229, 182, 120, 117, 118, |
| 148097 | | - /* 450 */ 120, 105, 106, 107, 163, 92, 93, 94, 95, 96, |
| 148098 | | - /* 460 */ 97, 98, 99, 100, 101, 102, 163, 22, 59, 206, |
| 148099 | | - /* 470 */ 207, 106, 163, 26, 171, 19, 163, 193, 175, 23, |
| 148100 | | - /* 480 */ 163, 22, 219, 206, 207, 139, 163, 22, 59, 182, |
| 148101 | | - /* 490 */ 117, 118, 59, 184, 185, 232, 219, 184, 185, 43, |
| 148102 | | - /* 500 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
| 148103 | | - /* 510 */ 54, 55, 56, 57, 105, 106, 107, 108, 59, 255, |
| 148104 | | - /* 520 */ 111, 112, 113, 90, 59, 262, 22, 98, 174, 12, |
| 148105 | | - /* 530 */ 121, 208, 163, 220, 105, 106, 107, 163, 105, 106, |
| 148106 | | - /* 540 */ 22, 96, 97, 110, 27, 238, 239, 240, 92, 93, |
| 148107 | | - /* 550 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 42, |
| 148108 | | - /* 560 */ 206, 207, 115, 59, 105, 106, 107, 163, 19, 59, |
| 148109 | | - /* 570 */ 163, 106, 23, 219, 141, 142, 143, 59, 163, 205, |
| 148110 | | - /* 580 */ 63, 59, 72, 22, 124, 59, 163, 270, 234, 129, |
| 148111 | | - /* 590 */ 73, 163, 43, 44, 45, 46, 47, 48, 49, 50, |
| 148112 | | - /* 600 */ 51, 52, 53, 54, 55, 56, 57, 184, 185, 105, |
| 148113 | | - /* 610 */ 106, 107, 184, 185, 163, 105, 106, 107, 265, 266, |
| 148114 | | - /* 620 */ 59, 198, 225, 105, 106, 107, 198, 105, 106, 107, |
| 148115 | | - /* 630 */ 163, 105, 106, 107, 163, 184, 185, 46, 47, 48, |
| 148116 | | - /* 640 */ 49, 92, 93, 94, 95, 96, 97, 98, 99, 100, |
| 148117 | | - /* 650 */ 101, 102, 163, 163, 132, 184, 185, 163, 132, 163, |
| 148118 | | - /* 660 */ 256, 19, 163, 163, 163, 23, 105, 106, 107, 198, |
| 148119 | | - /* 670 */ 163, 220, 205, 184, 185, 163, 35, 81, 184, 185, |
| 148120 | | - /* 680 */ 184, 185, 163, 184, 185, 43, 44, 45, 46, 47, |
| 148121 | | - /* 690 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, |
| 148122 | | - /* 700 */ 163, 110, 163, 184, 185, 109, 205, 66, 163, 59, |
| 148123 | | - /* 710 */ 163, 21, 205, 16, 174, 74, 220, 198, 163, 220, |
| 148124 | | - /* 720 */ 230, 184, 185, 127, 128, 180, 181, 180, 181, 163, |
| 148125 | | - /* 730 */ 175, 242, 174, 233, 92, 93, 94, 95, 96, 97, |
| 148126 | | - /* 740 */ 98, 99, 100, 101, 102, 233, 206, 207, 26, 163, |
| 148127 | | - /* 750 */ 195, 207, 197, 26, 19, 105, 106, 107, 23, 219, |
| 148128 | | - /* 760 */ 119, 260, 26, 219, 206, 207, 174, 19, 174, 230, |
| 148129 | | - /* 770 */ 80, 174, 163, 174, 77, 163, 79, 219, 43, 44, |
| 148130 | | - /* 780 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 148131 | | - /* 790 */ 55, 56, 57, 248, 12, 248, 184, 185, 206, 207, |
| 148132 | | - /* 800 */ 206, 207, 112, 206, 207, 206, 207, 206, 207, 27, |
| 148133 | | - /* 810 */ 163, 219, 123, 219, 125, 126, 219, 208, 219, 163, |
| 148134 | | - /* 820 */ 219, 22, 23, 23, 42, 26, 26, 92, 93, 94, |
| 148135 | | - /* 830 */ 95, 96, 97, 98, 99, 100, 101, 102, 163, 149, |
| 148136 | | - /* 840 */ 184, 185, 163, 107, 163, 63, 149, 19, 163, 127, |
| 148137 | | - /* 850 */ 128, 23, 22, 105, 24, 116, 117, 118, 131, 184, |
| 148138 | | - /* 860 */ 185, 163, 163, 184, 185, 184, 185, 19, 132, 184, |
| 148139 | | - /* 870 */ 185, 43, 44, 45, 46, 47, 48, 49, 50, 51, |
| 148140 | | - /* 880 */ 52, 53, 54, 55, 56, 57, 146, 163, 148, 59, |
| 148141 | | - /* 890 */ 91, 43, 44, 45, 46, 47, 48, 49, 50, 51, |
| 148142 | | - /* 900 */ 52, 53, 54, 55, 56, 57, 208, 107, 184, 185, |
| 148143 | | - /* 910 */ 7, 8, 9, 116, 117, 118, 163, 163, 163, 24, |
| 148144 | | - /* 920 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, |
| 148145 | | - /* 930 */ 102, 29, 132, 163, 163, 33, 106, 184, 185, 163, |
| 148146 | | - /* 940 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, |
| 148147 | | - /* 950 */ 102, 163, 163, 163, 59, 184, 185, 163, 22, 163, |
| 148148 | | - /* 960 */ 184, 185, 177, 178, 163, 163, 163, 65, 163, 199, |
| 148149 | | - /* 970 */ 163, 26, 184, 185, 184, 185, 163, 163, 184, 185, |
| 148150 | | - /* 980 */ 184, 185, 163, 98, 163, 184, 185, 184, 185, 184, |
| 148151 | | - /* 990 */ 185, 184, 185, 252, 205, 147, 163, 61, 184, 185, |
| 148152 | | - /* 1000 */ 163, 106, 163, 184, 185, 163, 163, 205, 163, 124, |
| 148153 | | - /* 1010 */ 163, 256, 163, 163, 129, 19, 163, 184, 185, 163, |
| 148154 | | - /* 1020 */ 199, 184, 185, 184, 185, 23, 184, 185, 26, 184, |
| 148155 | | - /* 1030 */ 185, 184, 185, 184, 185, 19, 163, 184, 185, 43, |
| 148156 | | - /* 1040 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
| 148157 | | - /* 1050 */ 54, 55, 56, 57, 163, 163, 163, 184, 185, 43, |
| 148158 | | - /* 1060 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
| 148159 | | - /* 1070 */ 54, 55, 56, 57, 16, 184, 185, 184, 185, 163, |
| 148160 | | - /* 1080 */ 163, 22, 23, 138, 163, 19, 163, 231, 92, 93, |
| 148161 | | - /* 1090 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 256, |
| 148162 | | - /* 1100 */ 163, 184, 185, 163, 163, 184, 185, 163, 92, 93, |
| 148163 | | - /* 1110 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 163, |
| 148164 | | - /* 1120 */ 59, 184, 185, 163, 184, 185, 177, 178, 184, 185, |
| 148165 | | - /* 1130 */ 163, 208, 163, 237, 163, 77, 163, 79, 163, 15, |
| 148166 | | - /* 1140 */ 184, 185, 237, 147, 184, 185, 24, 231, 153, 154, |
| 148167 | | - /* 1150 */ 91, 184, 185, 184, 185, 184, 185, 184, 185, 184, |
| 148168 | | - /* 1160 */ 185, 22, 23, 19, 163, 127, 128, 106, 24, 273, |
| 148169 | | - /* 1170 */ 271, 105, 231, 274, 263, 264, 223, 224, 273, 22, |
| 148170 | | - /* 1180 */ 118, 24, 23, 19, 60, 26, 163, 43, 44, 45, |
| 148171 | | - /* 1190 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, |
| 148172 | | - /* 1200 */ 56, 57, 140, 23, 22, 163, 26, 43, 44, 45, |
| 148173 | | - /* 1210 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, |
| 148174 | | - /* 1220 */ 56, 57, 23, 211, 23, 26, 31, 26, 23, 22, |
| 148175 | | - /* 1230 */ 91, 26, 231, 221, 39, 53, 92, 93, 94, 95, |
| 148176 | | - /* 1240 */ 96, 97, 98, 99, 100, 101, 102, 23, 23, 163, |
| 148177 | | - /* 1250 */ 26, 26, 130, 59, 109, 110, 92, 93, 94, 95, |
| 148178 | | - /* 1260 */ 96, 97, 98, 99, 100, 101, 102, 23, 7, 8, |
| 148179 | | - /* 1270 */ 26, 110, 23, 59, 23, 26, 19, 26, 141, 23, |
| 148180 | | - /* 1280 */ 143, 120, 26, 141, 163, 143, 23, 23, 163, 26, |
| 148181 | | - /* 1290 */ 26, 163, 163, 163, 163, 163, 19, 163, 163, 193, |
| 148182 | | - /* 1300 */ 106, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 148183 | | - /* 1310 */ 53, 54, 55, 56, 57, 163, 193, 163, 163, 163, |
| 148184 | | - /* 1320 */ 106, 163, 45, 46, 47, 48, 49, 50, 51, 52, |
| 148185 | | - /* 1330 */ 53, 54, 55, 56, 57, 163, 163, 130, 222, 163, |
| 148186 | | - /* 1340 */ 163, 203, 163, 19, 20, 251, 22, 163, 163, 92, |
| 148187 | | - /* 1350 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, |
| 148188 | | - /* 1360 */ 36, 163, 209, 163, 261, 163, 163, 161, 222, 92, |
| 148189 | | - /* 1370 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, |
| 148190 | | - /* 1380 */ 210, 213, 222, 59, 222, 222, 182, 213, 213, 196, |
| 148191 | | - /* 1390 */ 257, 226, 226, 19, 20, 71, 22, 257, 188, 187, |
| 148192 | | - /* 1400 */ 192, 212, 187, 187, 226, 81, 210, 166, 60, 261, |
| 148193 | | - /* 1410 */ 36, 244, 130, 170, 90, 170, 38, 170, 139, 104, |
| 148194 | | - /* 1420 */ 96, 97, 48, 236, 22, 235, 43, 103, 201, 105, |
| 148195 | | - /* 1430 */ 106, 107, 138, 59, 110, 247, 213, 18, 204, 258, |
| 148196 | | - /* 1440 */ 204, 258, 204, 204, 170, 71, 18, 169, 213, 236, |
| 148197 | | - /* 1450 */ 213, 127, 128, 235, 201, 201, 82, 170, 169, 213, |
| 148198 | | - /* 1460 */ 146, 87, 62, 254, 90, 141, 142, 143, 144, 145, |
| 148199 | | - /* 1470 */ 96, 97, 253, 170, 169, 22, 170, 103, 169, 105, |
| 148200 | | - /* 1480 */ 106, 107, 189, 170, 110, 169, 189, 186, 19, 20, |
| 148201 | | - /* 1490 */ 104, 22, 194, 186, 186, 64, 115, 186, 194, 189, |
| 148202 | | - /* 1500 */ 188, 102, 133, 186, 186, 36, 186, 104, 189, 19, |
| 148203 | | - /* 1510 */ 20, 246, 22, 246, 189, 141, 142, 143, 144, 145, |
| 148204 | | - /* 1520 */ 0, 1, 2, 228, 228, 5, 36, 227, 59, 227, |
| 148205 | | - /* 1530 */ 10, 11, 12, 13, 14, 170, 84, 17, 134, 216, |
| 148206 | | - /* 1540 */ 71, 272, 270, 22, 137, 217, 22, 216, 227, 59, |
| 148207 | | - /* 1550 */ 30, 82, 32, 217, 228, 228, 87, 227, 170, 90, |
| 148208 | | - /* 1560 */ 40, 71, 146, 241, 215, 96, 97, 214, 136, 135, |
| 148209 | | - /* 1570 */ 213, 25, 103, 26, 105, 106, 107, 243, 173, 110, |
| 148210 | | - /* 1580 */ 90, 172, 13, 6, 164, 164, 96, 97, 98, 162, |
| 148211 | | - /* 1590 */ 70, 162, 162, 103, 176, 105, 106, 107, 78, 267, |
| 148212 | | - /* 1600 */ 110, 81, 267, 264, 182, 182, 182, 182, 88, 176, |
| 148213 | | - /* 1610 */ 141, 142, 143, 144, 145, 176, 190, 4, 182, 182, |
| 148214 | | - /* 1620 */ 182, 19, 20, 182, 22, 190, 3, 22, 151, 15, |
| 148215 | | - /* 1630 */ 89, 141, 142, 143, 144, 145, 16, 128, 36, 23, |
| 148216 | | - /* 1640 */ 23, 139, 122, 24, 119, 131, 20, 127, 128, 133, |
| 148217 | | - /* 1650 */ 16, 1, 140, 131, 119, 61, 139, 53, 37, 53, |
| 148218 | | - /* 1660 */ 53, 59, 53, 119, 105, 34, 130, 1, 5, 22, |
| 148219 | | - /* 1670 */ 150, 104, 149, 71, 26, 75, 68, 41, 68, 130, |
| 148220 | | - /* 1680 */ 104, 24, 20, 19, 82, 120, 114, 22, 28, 87, |
| 148221 | | - /* 1690 */ 22, 67, 90, 22, 67, 23, 22, 22, 96, 97, |
| 148222 | | - /* 1700 */ 67, 23, 138, 22, 37, 103, 153, 105, 106, 107, |
| 148223 | | - /* 1710 */ 1, 2, 110, 23, 5, 23, 23, 26, 22, 10, |
| 148224 | | - /* 1720 */ 11, 12, 13, 14, 24, 23, 17, 22, 24, 130, |
| 148225 | | - /* 1730 */ 23, 19, 20, 23, 22, 105, 22, 34, 85, 30, |
| 148226 | | - /* 1740 */ 34, 32, 26, 141, 142, 143, 144, 145, 36, 40, |
| 148227 | | - /* 1750 */ 132, 34, 75, 83, 23, 44, 24, 34, 23, 26, |
| 148228 | | - /* 1760 */ 26, 19, 20, 23, 22, 26, 23, 23, 23, 23, |
| 148229 | | - /* 1770 */ 22, 59, 11, 22, 22, 26, 23, 23, 36, 70, |
| 148230 | | - /* 1780 */ 22, 22, 124, 71, 130, 130, 130, 78, 23, 130, |
| 148231 | | - /* 1790 */ 81, 15, 1, 278, 278, 278, 278, 88, 278, 278, |
| 148232 | | - /* 1800 */ 278, 59, 90, 278, 278, 278, 278, 278, 96, 97, |
| 148233 | | - /* 1810 */ 278, 278, 278, 71, 278, 103, 278, 105, 106, 107, |
| 148234 | | - /* 1820 */ 278, 278, 110, 278, 278, 278, 278, 278, 278, 278, |
| 148235 | | - /* 1830 */ 278, 122, 90, 278, 278, 278, 127, 128, 96, 97, |
| 148236 | | - /* 1840 */ 278, 278, 278, 278, 278, 103, 278, 105, 106, 107, |
| 148237 | | - /* 1850 */ 278, 278, 110, 141, 142, 143, 144, 145, 278, 150, |
| 148238 | | - /* 1860 */ 278, 278, 278, 5, 278, 278, 278, 278, 10, 11, |
| 148239 | | - /* 1870 */ 12, 13, 14, 278, 278, 17, 278, 278, 278, 278, |
| 148240 | | - /* 1880 */ 278, 278, 278, 141, 142, 143, 144, 145, 30, 278, |
| 148241 | | - /* 1890 */ 32, 278, 278, 278, 278, 278, 278, 278, 40, 278, |
| 148242 | | - /* 1900 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, |
| 148243 | | - /* 1910 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, |
| 148244 | | - /* 1920 */ 278, 278, 278, 278, 278, 278, 278, 278, 70, 278, |
| 148245 | | - /* 1930 */ 278, 278, 278, 278, 278, 278, 78, 278, 278, 81, |
| 148246 | | - /* 1940 */ 278, 278, 278, 278, 278, 278, 88, 278, 278, 278, |
| 148247 | | - /* 1950 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, |
| 148248 | | - /* 1960 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, |
| 148249 | | - /* 1970 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, |
| 148250 | | - /* 1980 */ 122, 278, 278, 278, 278, 127, 128, 278, 278, 278, |
| 148251 | | - /* 1990 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, |
| 148252 | | - /* 2000 */ 278, 278, 278, 278, 278, 278, 278, 278, 150, 278, |
| 148253 | | - /* 2010 */ 278, 278, 278, 278, 278, 278, 278, 278, 278, |
| 148254 | | -}; |
| 148255 | | -#define YY_SHIFT_COUNT (523) |
| 148648 | + /* 0 */ 172, 242, 243, 244, 167, 167, 167, 186, 159, 160, |
| 148649 | + /* 10 */ 161, 162, 163, 164, 167, 191, 187, 179, 169, 19, |
| 148650 | + /* 20 */ 171, 162, 263, 164, 195, 188, 189, 178, 169, 178, |
| 148651 | + /* 30 */ 171, 31, 188, 167, 22, 188, 189, 178, 24, 39, |
| 148652 | + /* 40 */ 242, 243, 244, 43, 44, 45, 46, 47, 48, 49, |
| 148653 | + /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 191, 210, |
| 148654 | + /* 60 */ 211, 210, 211, 242, 243, 244, 242, 243, 244, 210, |
| 148655 | + /* 70 */ 211, 59, 223, 59, 223, 22, 237, 249, 227, 228, |
| 148656 | + /* 80 */ 188, 253, 223, 246, 188, 236, 54, 55, 56, 57, |
| 148657 | + /* 90 */ 58, 167, 167, 206, 207, 236, 96, 97, 98, 99, |
| 148658 | + /* 100 */ 100, 101, 102, 103, 104, 105, 106, 210, 211, 242, |
| 148659 | + /* 110 */ 243, 244, 59, 188, 189, 266, 19, 251, 201, 59, |
| 148660 | + /* 120 */ 223, 109, 110, 111, 110, 266, 279, 280, 96, 97, |
| 148661 | + /* 130 */ 98, 99, 100, 101, 102, 103, 104, 105, 106, 94, |
| 148662 | + /* 140 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 148663 | + /* 150 */ 53, 54, 55, 56, 57, 110, 195, 196, 59, 114, |
| 148664 | + /* 160 */ 100, 101, 109, 110, 111, 204, 167, 128, 108, 109, |
| 148665 | + /* 170 */ 110, 111, 133, 113, 73, 102, 103, 104, 105, 106, |
| 148666 | + /* 180 */ 83, 121, 85, 54, 55, 56, 57, 188, 189, 26, |
| 148667 | + /* 190 */ 145, 146, 147, 96, 97, 98, 99, 100, 101, 102, |
| 148668 | + /* 200 */ 103, 104, 105, 106, 279, 145, 281, 147, 109, 110, |
| 148669 | + /* 210 */ 111, 112, 106, 19, 115, 116, 117, 100, 101, 167, |
| 148670 | + /* 220 */ 26, 120, 121, 122, 125, 96, 97, 98, 99, 100, |
| 148671 | + /* 230 */ 101, 102, 103, 104, 105, 106, 81, 43, 44, 45, |
| 148672 | + /* 240 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, |
| 148673 | + /* 250 */ 56, 57, 100, 101, 102, 103, 104, 105, 106, 183, |
| 148674 | + /* 260 */ 184, 185, 145, 69, 147, 96, 97, 98, 99, 100, |
| 148675 | + /* 270 */ 101, 102, 103, 104, 105, 106, 73, 167, 279, 280, |
| 148676 | + /* 280 */ 167, 22, 23, 19, 81, 26, 131, 132, 59, 237, |
| 148677 | + /* 290 */ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, |
| 148678 | + /* 300 */ 106, 188, 189, 19, 167, 142, 167, 43, 44, 45, |
| 148679 | + /* 310 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, |
| 148680 | + /* 320 */ 56, 57, 212, 120, 112, 188, 189, 115, 116, 117, |
| 148681 | + /* 330 */ 238, 67, 22, 23, 131, 132, 22, 125, 109, 110, |
| 148682 | + /* 340 */ 111, 167, 161, 162, 163, 164, 46, 47, 48, 49, |
| 148683 | + /* 350 */ 169, 19, 171, 167, 95, 127, 24, 129, 130, 178, |
| 148684 | + /* 360 */ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, |
| 148685 | + /* 370 */ 106, 59, 143, 59, 167, 43, 44, 45, 46, 47, |
| 148686 | + /* 380 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, |
| 148687 | + /* 390 */ 106, 210, 211, 26, 167, 209, 112, 113, 114, 115, |
| 148688 | + /* 400 */ 116, 117, 118, 167, 223, 95, 94, 167, 124, 235, |
| 148689 | + /* 410 */ 178, 272, 273, 167, 114, 188, 189, 236, 183, 184, |
| 148690 | + /* 420 */ 185, 109, 110, 109, 110, 111, 114, 167, 96, 97, |
| 148691 | + /* 430 */ 98, 99, 100, 101, 102, 103, 104, 105, 106, 59, |
| 148692 | + /* 440 */ 167, 167, 210, 211, 59, 209, 167, 266, 19, 209, |
| 148693 | + /* 450 */ 59, 224, 23, 211, 16, 223, 76, 145, 146, 147, |
| 148694 | + /* 460 */ 233, 188, 189, 72, 84, 223, 86, 188, 189, 89, |
| 148695 | + /* 470 */ 238, 167, 43, 44, 45, 46, 47, 48, 49, 50, |
| 148696 | + /* 480 */ 51, 52, 53, 54, 55, 56, 57, 102, 167, 109, |
| 148697 | + /* 490 */ 110, 111, 188, 189, 109, 110, 111, 224, 131, 132, |
| 148698 | + /* 500 */ 109, 110, 111, 224, 264, 19, 233, 105, 106, 188, |
| 148699 | + /* 510 */ 189, 237, 233, 35, 167, 77, 167, 79, 138, 22, |
| 148700 | + /* 520 */ 274, 275, 22, 202, 278, 96, 97, 98, 99, 100, |
| 148701 | + /* 530 */ 101, 102, 103, 104, 105, 106, 275, 188, 189, 278, |
| 148702 | + /* 540 */ 167, 11, 59, 167, 66, 19, 167, 121, 122, 23, |
| 148703 | + /* 550 */ 76, 202, 74, 167, 178, 72, 59, 178, 84, 59, |
| 148704 | + /* 560 */ 86, 188, 189, 89, 188, 189, 59, 188, 189, 43, |
| 148705 | + /* 570 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
| 148706 | + /* 580 */ 54, 55, 56, 57, 26, 167, 210, 211, 59, 210, |
| 148707 | + /* 590 */ 211, 153, 109, 110, 111, 109, 22, 224, 167, 223, |
| 148708 | + /* 600 */ 224, 123, 223, 224, 21, 215, 109, 110, 111, 233, |
| 148709 | + /* 610 */ 110, 167, 138, 186, 167, 225, 109, 110, 111, 188, |
| 148710 | + /* 620 */ 189, 203, 96, 97, 98, 99, 100, 101, 102, 103, |
| 148711 | + /* 630 */ 104, 105, 106, 59, 76, 188, 189, 167, 109, 110, |
| 148712 | + /* 640 */ 111, 59, 19, 136, 86, 197, 23, 89, 167, 202, |
| 148713 | + /* 650 */ 81, 121, 122, 269, 270, 224, 212, 178, 188, 189, |
| 148714 | + /* 660 */ 274, 275, 167, 80, 278, 136, 43, 44, 45, 46, |
| 148715 | + /* 670 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, |
| 148716 | + /* 680 */ 57, 12, 113, 109, 110, 111, 259, 167, 186, 210, |
| 148717 | + /* 690 */ 211, 109, 110, 111, 224, 167, 27, 210, 211, 116, |
| 148718 | + /* 700 */ 131, 132, 223, 7, 8, 9, 167, 212, 188, 189, |
| 148719 | + /* 710 */ 223, 42, 167, 167, 178, 234, 188, 189, 179, 96, |
| 148720 | + /* 720 */ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, |
| 148721 | + /* 730 */ 202, 167, 63, 167, 188, 189, 153, 167, 199, 19, |
| 148722 | + /* 740 */ 201, 175, 73, 23, 224, 179, 210, 211, 202, 26, |
| 148723 | + /* 750 */ 197, 178, 188, 189, 178, 275, 254, 167, 278, 223, |
| 148724 | + /* 760 */ 167, 259, 167, 43, 44, 45, 46, 47, 48, 49, |
| 148725 | + /* 770 */ 50, 51, 52, 53, 54, 55, 56, 57, 188, 189, |
| 148726 | + /* 780 */ 235, 188, 189, 210, 211, 167, 210, 211, 224, 181, |
| 148727 | + /* 790 */ 182, 167, 202, 167, 76, 202, 223, 178, 22, 223, |
| 148728 | + /* 800 */ 24, 19, 22, 23, 86, 178, 26, 89, 184, 185, |
| 148729 | + /* 810 */ 184, 185, 178, 120, 121, 122, 96, 97, 98, 99, |
| 148730 | + /* 820 */ 100, 101, 102, 103, 104, 105, 106, 167, 46, 210, |
| 148731 | + /* 830 */ 211, 66, 167, 167, 111, 59, 19, 210, 211, 167, |
| 148732 | + /* 840 */ 23, 167, 223, 23, 210, 211, 26, 82, 188, 189, |
| 148733 | + /* 850 */ 223, 29, 234, 188, 189, 33, 91, 223, 167, 136, |
| 148734 | + /* 860 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 148735 | + /* 870 */ 53, 54, 55, 56, 57, 95, 252, 12, 252, 188, |
| 148736 | + /* 880 */ 189, 167, 22, 23, 206, 207, 110, 65, 167, 16, |
| 148737 | + /* 890 */ 108, 167, 27, 120, 121, 122, 167, 167, 167, 167, |
| 148738 | + /* 900 */ 234, 167, 188, 189, 139, 167, 124, 42, 167, 188, |
| 148739 | + /* 910 */ 189, 167, 102, 96, 97, 98, 99, 100, 101, 102, |
| 148740 | + /* 920 */ 103, 104, 105, 106, 167, 167, 138, 167, 63, 188, |
| 148741 | + /* 930 */ 189, 111, 260, 19, 260, 167, 167, 23, 128, 209, |
| 148742 | + /* 940 */ 209, 209, 275, 133, 156, 278, 188, 189, 188, 189, |
| 148743 | + /* 950 */ 77, 167, 79, 19, 167, 95, 136, 43, 44, 45, |
| 148744 | + /* 960 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, |
| 148745 | + /* 970 */ 56, 57, 188, 189, 167, 188, 189, 43, 44, 45, |
| 148746 | + /* 980 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, |
| 148747 | + /* 990 */ 56, 57, 235, 167, 260, 188, 189, 167, 157, 158, |
| 148748 | + /* 1000 */ 167, 26, 273, 167, 235, 167, 59, 26, 241, 46, |
| 148749 | + /* 1010 */ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, |
| 148750 | + /* 1020 */ 106, 188, 189, 22, 188, 189, 188, 189, 167, 203, |
| 148751 | + /* 1030 */ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, |
| 148752 | + /* 1040 */ 106, 167, 212, 167, 277, 167, 167, 167, 23, 188, |
| 148753 | + /* 1050 */ 189, 26, 275, 241, 167, 278, 167, 110, 167, 220, |
| 148754 | + /* 1060 */ 167, 222, 188, 189, 188, 189, 188, 189, 188, 189, |
| 148755 | + /* 1070 */ 167, 108, 167, 167, 167, 188, 189, 188, 189, 188, |
| 148756 | + /* 1080 */ 189, 188, 189, 167, 275, 151, 167, 278, 167, 277, |
| 148757 | + /* 1090 */ 167, 188, 189, 188, 189, 188, 189, 167, 31, 167, |
| 148758 | + /* 1100 */ 119, 100, 101, 181, 182, 19, 39, 188, 189, 188, |
| 148759 | + /* 1110 */ 189, 188, 189, 138, 235, 131, 132, 24, 188, 189, |
| 148760 | + /* 1120 */ 188, 189, 267, 268, 167, 19, 167, 227, 228, 43, |
| 148761 | + /* 1130 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
| 148762 | + /* 1140 */ 54, 55, 56, 57, 167, 188, 189, 188, 189, 43, |
| 148763 | + /* 1150 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
| 148764 | + /* 1160 */ 54, 55, 56, 57, 19, 188, 189, 150, 197, 152, |
| 148765 | + /* 1170 */ 26, 15, 22, 167, 24, 122, 23, 23, 167, 26, |
| 148766 | + /* 1180 */ 26, 167, 96, 97, 98, 99, 100, 101, 102, 103, |
| 148767 | + /* 1190 */ 104, 105, 106, 167, 188, 189, 167, 144, 167, 188, |
| 148768 | + /* 1200 */ 189, 167, 96, 97, 98, 99, 100, 101, 102, 103, |
| 148769 | + /* 1210 */ 104, 105, 106, 167, 188, 189, 60, 188, 189, 188, |
| 148770 | + /* 1220 */ 189, 22, 188, 189, 167, 22, 167, 134, 167, 23, |
| 148771 | + /* 1230 */ 23, 167, 26, 26, 188, 189, 23, 151, 23, 26, |
| 148772 | + /* 1240 */ 23, 26, 145, 26, 147, 188, 189, 188, 189, 188, |
| 148773 | + /* 1250 */ 189, 114, 53, 23, 109, 22, 26, 19, 167, 113, |
| 148774 | + /* 1260 */ 114, 124, 24, 23, 61, 167, 26, 59, 7, 8, |
| 148775 | + /* 1270 */ 59, 23, 23, 59, 26, 26, 145, 19, 147, 135, |
| 148776 | + /* 1280 */ 167, 43, 44, 45, 46, 47, 48, 49, 50, 51, |
| 148777 | + /* 1290 */ 52, 53, 54, 55, 56, 57, 23, 167, 229, 26, |
| 148778 | + /* 1300 */ 167, 43, 44, 45, 46, 47, 48, 49, 50, 51, |
| 148779 | + /* 1310 */ 52, 53, 54, 55, 56, 57, 23, 207, 110, 26, |
| 148780 | + /* 1320 */ 226, 110, 167, 283, 110, 167, 167, 167, 167, 167, |
| 148781 | + /* 1330 */ 167, 167, 167, 167, 96, 97, 98, 99, 100, 101, |
| 148782 | + /* 1340 */ 102, 103, 104, 105, 106, 167, 167, 167, 167, 167, |
| 148783 | + /* 1350 */ 167, 167, 167, 167, 96, 97, 98, 99, 100, 101, |
| 148784 | + /* 1360 */ 102, 103, 104, 105, 106, 167, 255, 134, 167, 167, |
| 148785 | + /* 1370 */ 256, 167, 167, 226, 19, 226, 167, 226, 226, 186, |
| 148786 | + /* 1380 */ 213, 165, 214, 265, 261, 261, 217, 230, 217, 217, |
| 148787 | + /* 1390 */ 200, 196, 192, 220, 19, 220, 248, 170, 60, 44, |
| 148788 | + /* 1400 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 148789 | + /* 1410 */ 55, 56, 57, 191, 191, 191, 134, 230, 230, 174, |
| 148790 | + /* 1420 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, |
| 148791 | + /* 1430 */ 55, 56, 57, 214, 216, 265, 174, 38, 262, 262, |
| 148792 | + /* 1440 */ 174, 143, 251, 108, 22, 19, 20, 43, 22, 205, |
| 148793 | + /* 1450 */ 240, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 148794 | + /* 1460 */ 105, 106, 36, 142, 239, 18, 174, 217, 208, 18, |
| 148795 | + /* 1470 */ 173, 96, 97, 98, 99, 100, 101, 102, 103, 104, |
| 148796 | + /* 1480 */ 105, 106, 208, 208, 208, 59, 217, 217, 205, 205, |
| 148797 | + /* 1490 */ 174, 240, 239, 173, 217, 150, 62, 71, 174, 258, |
| 148798 | + /* 1500 */ 257, 19, 20, 173, 22, 22, 193, 81, 174, 173, |
| 148799 | + /* 1510 */ 193, 174, 173, 108, 64, 190, 190, 190, 36, 119, |
| 148800 | + /* 1520 */ 94, 198, 193, 190, 192, 106, 100, 101, 250, 198, |
| 148801 | + /* 1530 */ 48, 190, 190, 107, 190, 109, 110, 111, 250, 193, |
| 148802 | + /* 1540 */ 114, 59, 193, 137, 232, 108, 231, 174, 88, 282, |
| 148803 | + /* 1550 */ 232, 232, 141, 71, 232, 138, 22, 131, 132, 231, |
| 148804 | + /* 1560 */ 220, 282, 174, 150, 82, 140, 139, 25, 177, 87, |
| 148805 | + /* 1570 */ 219, 145, 146, 147, 148, 149, 94, 221, 231, 231, |
| 148806 | + /* 1580 */ 221, 218, 100, 101, 217, 26, 176, 13, 245, 107, |
| 148807 | + /* 1590 */ 6, 109, 110, 111, 166, 166, 114, 247, 168, 168, |
| 148808 | + /* 1600 */ 180, 166, 186, 194, 186, 4, 194, 186, 3, 186, |
| 148809 | + /* 1610 */ 186, 22, 180, 155, 15, 93, 180, 23, 16, 186, |
| 148810 | + /* 1620 */ 23, 132, 268, 271, 271, 186, 186, 145, 146, 147, |
| 148811 | + /* 1630 */ 148, 149, 0, 1, 2, 143, 123, 5, 24, 135, |
| 148812 | + /* 1640 */ 20, 16, 10, 11, 12, 13, 14, 137, 1, 17, |
| 148813 | + /* 1650 */ 135, 144, 19, 20, 123, 22, 61, 143, 37, 53, |
| 148814 | + /* 1660 */ 53, 53, 30, 53, 32, 109, 123, 134, 34, 36, |
| 148815 | + /* 1670 */ 1, 5, 40, 22, 108, 26, 153, 68, 75, 68, |
| 148816 | + /* 1680 */ 41, 134, 24, 108, 20, 124, 19, 118, 23, 67, |
| 148817 | + /* 1690 */ 22, 67, 59, 22, 22, 22, 22, 67, 28, 37, |
| 148818 | + /* 1700 */ 23, 22, 70, 23, 71, 142, 157, 23, 23, 26, |
| 148819 | + /* 1710 */ 78, 23, 22, 81, 23, 82, 24, 22, 24, 134, |
| 148820 | + /* 1720 */ 87, 23, 19, 20, 92, 22, 109, 94, 23, 22, |
| 148821 | + /* 1730 */ 34, 34, 136, 100, 101, 26, 34, 85, 34, 36, |
| 148822 | + /* 1740 */ 107, 23, 109, 110, 111, 34, 83, 114, 34, 90, |
| 148823 | + /* 1750 */ 75, 75, 44, 22, 24, 26, 34, 23, 126, 26, |
| 148824 | + /* 1760 */ 23, 23, 59, 131, 132, 23, 23, 26, 23, 22, |
| 148825 | + /* 1770 */ 11, 22, 22, 22, 71, 23, 23, 22, 145, 146, |
| 148826 | + /* 1780 */ 147, 148, 149, 26, 128, 82, 154, 134, 134, 134, |
| 148827 | + /* 1790 */ 87, 134, 23, 15, 1, 284, 284, 94, 284, 284, |
| 148828 | + /* 1800 */ 284, 284, 284, 100, 101, 284, 284, 284, 284, 284, |
| 148829 | + /* 1810 */ 107, 284, 109, 110, 111, 1, 2, 114, 284, 5, |
| 148830 | + /* 1820 */ 284, 284, 284, 284, 10, 11, 12, 13, 14, 284, |
| 148831 | + /* 1830 */ 284, 17, 284, 284, 284, 284, 19, 20, 284, 22, |
| 148832 | + /* 1840 */ 284, 284, 284, 284, 30, 284, 32, 284, 145, 146, |
| 148833 | + /* 1850 */ 147, 148, 149, 36, 40, 284, 284, 284, 284, 284, |
| 148834 | + /* 1860 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, |
| 148835 | + /* 1870 */ 284, 284, 284, 284, 284, 284, 59, 284, 284, 284, |
| 148836 | + /* 1880 */ 284, 284, 284, 284, 70, 284, 284, 284, 71, 284, |
| 148837 | + /* 1890 */ 284, 284, 78, 284, 284, 81, 19, 20, 284, 22, |
| 148838 | + /* 1900 */ 284, 284, 284, 284, 284, 284, 92, 284, 284, 284, |
| 148839 | + /* 1910 */ 284, 94, 284, 36, 284, 284, 284, 100, 101, 102, |
| 148840 | + /* 1920 */ 284, 284, 284, 284, 107, 284, 109, 110, 111, 284, |
| 148841 | + /* 1930 */ 284, 114, 284, 284, 284, 284, 59, 284, 284, 284, |
| 148842 | + /* 1940 */ 126, 284, 284, 284, 284, 131, 132, 284, 71, 284, |
| 148843 | + /* 1950 */ 284, 284, 284, 284, 284, 284, 19, 20, 284, 22, |
| 148844 | + /* 1960 */ 284, 284, 145, 146, 147, 148, 149, 284, 154, 284, |
| 148845 | + /* 1970 */ 284, 94, 284, 36, 284, 284, 284, 100, 101, 284, |
| 148846 | + /* 1980 */ 284, 284, 284, 284, 107, 284, 109, 110, 111, 284, |
| 148847 | + /* 1990 */ 284, 114, 5, 284, 284, 284, 59, 10, 11, 12, |
| 148848 | + /* 2000 */ 13, 14, 284, 284, 17, 284, 284, 284, 71, 284, |
| 148849 | + /* 2010 */ 284, 284, 284, 284, 284, 284, 284, 30, 284, 32, |
| 148850 | + /* 2020 */ 284, 284, 145, 146, 147, 148, 149, 40, 284, 284, |
| 148851 | + /* 2030 */ 284, 94, 284, 284, 284, 284, 284, 100, 101, 284, |
| 148852 | + /* 2040 */ 284, 284, 284, 284, 107, 284, 109, 110, 111, 284, |
| 148853 | + /* 2050 */ 284, 114, 284, 284, 284, 284, 284, 70, 284, 284, |
| 148854 | + /* 2060 */ 284, 284, 284, 284, 284, 78, 284, 284, 81, 284, |
| 148855 | + /* 2070 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 92, |
| 148856 | + /* 2080 */ 284, 284, 145, 146, 147, 148, 149, 284, 284, 284, |
| 148857 | + /* 2090 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, |
| 148858 | + /* 2100 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, |
| 148859 | + /* 2110 */ 284, 284, 284, 126, 284, 284, 284, 284, 131, 132, |
| 148860 | + /* 2120 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, |
| 148861 | + /* 2130 */ 284, 284, 284, 284, 284, 284, 284, 284, 284, 284, |
| 148862 | + /* 2140 */ 284, 154, 284, 284, 284, 284, 284, 284, 284, 284, |
| 148863 | + /* 2150 */ 284, 284, |
| 148864 | +}; |
| 148865 | +#define YY_SHIFT_COUNT (540) |
| 148256 | 148866 | #define YY_SHIFT_MIN (0) |
| 148257 | | -#define YY_SHIFT_MAX (1858) |
| 148867 | +#define YY_SHIFT_MAX (1987) |
| 148258 | 148868 | static const unsigned short int yy_shift_ofst[] = { |
| 148259 | | - /* 0 */ 1709, 1520, 1858, 1324, 1324, 24, 1374, 1469, 1602, 1712, |
| 148260 | | - /* 10 */ 1712, 1712, 271, 0, 0, 113, 1016, 1712, 1712, 1712, |
| 148261 | | - /* 20 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 12, 12, 409, |
| 148262 | | - /* 30 */ 596, 24, 24, 24, 24, 24, 24, 93, 177, 270, |
| 148263 | | - /* 40 */ 363, 456, 549, 642, 735, 828, 848, 996, 1144, 1016, |
| 148264 | | - /* 50 */ 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, |
| 148265 | | - /* 60 */ 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1164, 1016, 1257, |
| 148266 | | - /* 70 */ 1277, 1277, 1490, 1712, 1712, 1712, 1712, 1712, 1712, 1712, |
| 148267 | | - /* 80 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, |
| 148268 | | - /* 90 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, |
| 148269 | | - /* 100 */ 1712, 1712, 1712, 1712, 1712, 1742, 1712, 1712, 1712, 1712, |
| 148270 | | - /* 110 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 143, |
| 148271 | | - /* 120 */ 162, 162, 162, 162, 162, 204, 151, 186, 650, 690, |
| 148272 | | - /* 130 */ 327, 650, 261, 261, 650, 722, 722, 722, 722, 373, |
| 148273 | | - /* 140 */ 33, 2, 2009, 2009, 330, 330, 330, 346, 289, 278, |
| 148274 | | - /* 150 */ 289, 289, 517, 517, 459, 510, 15, 799, 650, 650, |
| 148275 | | - /* 160 */ 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, |
| 148276 | | - /* 170 */ 650, 650, 650, 650, 650, 650, 650, 650, 650, 650, |
| 148277 | | - /* 180 */ 331, 365, 995, 995, 265, 365, 50, 1038, 2009, 2009, |
| 148278 | | - /* 190 */ 2009, 433, 250, 250, 504, 314, 429, 518, 522, 526, |
| 148279 | | - /* 200 */ 561, 650, 650, 650, 650, 650, 650, 650, 650, 650, |
| 148280 | | - /* 210 */ 192, 650, 650, 650, 650, 650, 650, 650, 650, 650, |
| 148281 | | - /* 220 */ 650, 650, 650, 641, 641, 641, 650, 650, 650, 650, |
| 148282 | | - /* 230 */ 800, 650, 650, 650, 830, 650, 650, 782, 650, 650, |
| 148283 | | - /* 240 */ 650, 650, 650, 650, 650, 650, 739, 902, 689, 895, |
| 148284 | | - /* 250 */ 895, 895, 895, 736, 689, 689, 885, 445, 903, 1124, |
| 148285 | | - /* 260 */ 945, 748, 748, 1066, 945, 945, 1066, 447, 1002, 293, |
| 148286 | | - /* 270 */ 1195, 1195, 1195, 748, 740, 727, 460, 1157, 1348, 1282, |
| 148287 | | - /* 280 */ 1282, 1378, 1378, 1282, 1279, 1315, 1402, 1383, 1294, 1419, |
| 148288 | | - /* 290 */ 1419, 1419, 1419, 1282, 1428, 1294, 1294, 1315, 1402, 1383, |
| 148289 | | - /* 300 */ 1383, 1294, 1282, 1428, 1314, 1400, 1282, 1428, 1453, 1282, |
| 148290 | | - /* 310 */ 1428, 1282, 1428, 1453, 1386, 1386, 1386, 1431, 1453, 1386, |
| 148291 | | - /* 320 */ 1381, 1386, 1431, 1386, 1386, 1453, 1399, 1399, 1453, 1369, |
| 148292 | | - /* 330 */ 1403, 1369, 1403, 1369, 1403, 1369, 1403, 1282, 1404, 1452, |
| 148293 | | - /* 340 */ 1521, 1407, 1404, 1524, 1282, 1416, 1407, 1432, 1434, 1294, |
| 148294 | | - /* 350 */ 1546, 1547, 1569, 1569, 1577, 1577, 1577, 2009, 2009, 2009, |
| 148295 | | - /* 360 */ 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, |
| 148296 | | - /* 370 */ 2009, 2009, 2009, 591, 697, 1059, 1139, 1058, 797, 465, |
| 148297 | | - /* 380 */ 1159, 1182, 1122, 1062, 1180, 936, 1199, 1201, 1205, 1224, |
| 148298 | | - /* 390 */ 1225, 1244, 1061, 1145, 1261, 1161, 1194, 1249, 1251, 1256, |
| 148299 | | - /* 400 */ 1137, 1142, 1263, 1264, 1214, 1207, 1613, 1623, 1605, 1477, |
| 148300 | | - /* 410 */ 1614, 1541, 1620, 1616, 1617, 1509, 1502, 1525, 1619, 1514, |
| 148301 | | - /* 420 */ 1626, 1516, 1634, 1650, 1522, 1512, 1535, 1594, 1621, 1517, |
| 148302 | | - /* 430 */ 1604, 1606, 1607, 1609, 1544, 1559, 1631, 1536, 1666, 1663, |
| 148303 | | - /* 440 */ 1647, 1567, 1523, 1608, 1648, 1610, 1600, 1636, 1549, 1576, |
| 148304 | | - /* 450 */ 1657, 1662, 1664, 1565, 1572, 1665, 1624, 1668, 1671, 1672, |
| 148305 | | - /* 460 */ 1674, 1627, 1660, 1675, 1633, 1667, 1678, 1564, 1681, 1553, |
| 148306 | | - /* 470 */ 1690, 1692, 1691, 1693, 1696, 1700, 1702, 1705, 1704, 1599, |
| 148307 | | - /* 480 */ 1707, 1710, 1630, 1703, 1714, 1618, 1716, 1706, 1716, 1717, |
| 148308 | | - /* 490 */ 1653, 1677, 1670, 1711, 1731, 1732, 1733, 1734, 1723, 1735, |
| 148309 | | - /* 500 */ 1716, 1740, 1743, 1744, 1745, 1739, 1746, 1748, 1761, 1751, |
| 148310 | | - /* 510 */ 1752, 1753, 1754, 1758, 1759, 1749, 1658, 1654, 1655, 1656, |
| 148311 | | - /* 520 */ 1659, 1765, 1776, 1791, |
| 148312 | | -}; |
| 148313 | | -#define YY_REDUCE_COUNT (372) |
| 148314 | | -#define YY_REDUCE_MIN (-235) |
| 148315 | | -#define YY_REDUCE_MAX (1441) |
| 148869 | + /* 0 */ 1814, 1632, 1987, 1426, 1426, 155, 1482, 1633, 1703, 1877, |
| 148870 | + /* 10 */ 1877, 1877, 203, 0, 0, 264, 1106, 1877, 1877, 1877, |
| 148871 | + /* 20 */ 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, |
| 148872 | + /* 30 */ 60, 60, 380, 380, 99, 569, 155, 155, 155, 155, |
| 148873 | + /* 40 */ 155, 155, 97, 194, 332, 429, 526, 623, 720, 817, |
| 148874 | + /* 50 */ 914, 934, 1086, 1238, 1106, 1106, 1106, 1106, 1106, 1106, |
| 148875 | + /* 60 */ 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, 1106, |
| 148876 | + /* 70 */ 1106, 1106, 1258, 1106, 1355, 1375, 1375, 1817, 1877, 1877, |
| 148877 | + /* 80 */ 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, |
| 148878 | + /* 90 */ 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, |
| 148879 | + /* 100 */ 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, |
| 148880 | + /* 110 */ 1937, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, 1877, |
| 148881 | + /* 120 */ 1877, 1877, 1877, 1877, 32, 129, 129, 129, 129, 129, |
| 148882 | + /* 130 */ 169, 152, 73, 582, 583, 782, 582, 117, 117, 582, |
| 148883 | + /* 140 */ 367, 367, 367, 367, 426, 402, 106, 2142, 2142, 284, |
| 148884 | + /* 150 */ 284, 284, 229, 12, 391, 12, 12, 669, 669, 474, |
| 148885 | + /* 160 */ 483, 259, 780, 582, 582, 582, 582, 582, 582, 582, |
| 148886 | + /* 170 */ 582, 582, 582, 582, 582, 582, 582, 582, 582, 582, |
| 148887 | + /* 180 */ 582, 582, 582, 582, 558, 558, 582, 530, 718, 718, |
| 148888 | + /* 190 */ 947, 841, 841, 947, 788, 984, 2142, 2142, 2142, 312, |
| 148889 | + /* 200 */ 45, 45, 53, 212, 314, 385, 497, 507, 529, 574, |
| 148890 | + /* 210 */ 582, 582, 582, 582, 582, 582, 582, 582, 582, 101, |
| 148891 | + /* 220 */ 582, 582, 582, 582, 582, 582, 582, 582, 582, 582, |
| 148892 | + /* 230 */ 582, 582, 478, 478, 478, 582, 582, 582, 582, 820, |
| 148893 | + /* 240 */ 582, 582, 582, 776, 765, 582, 582, 865, 582, 582, |
| 148894 | + /* 250 */ 582, 582, 582, 582, 582, 582, 693, 822, 228, 14, |
| 148895 | + /* 260 */ 14, 14, 14, 723, 228, 228, 810, 1001, 696, 1156, |
| 148896 | + /* 270 */ 163, 486, 486, 1145, 163, 163, 1145, 981, 1025, 963, |
| 148897 | + /* 280 */ 1067, 1067, 1067, 486, 975, 975, 1017, 1144, 39, 1150, |
| 148898 | + /* 290 */ 1338, 1282, 1282, 1399, 1399, 1282, 1298, 1335, 1422, 1404, |
| 148899 | + /* 300 */ 1321, 1447, 1447, 1447, 1447, 1282, 1451, 1321, 1321, 1335, |
| 148900 | + /* 310 */ 1422, 1404, 1404, 1321, 1282, 1451, 1345, 1434, 1282, 1451, |
| 148901 | + /* 320 */ 1483, 1282, 1451, 1282, 1451, 1483, 1405, 1405, 1405, 1450, |
| 148902 | + /* 330 */ 1483, 1405, 1400, 1405, 1450, 1405, 1405, 1483, 1419, 1419, |
| 148903 | + /* 340 */ 1483, 1406, 1437, 1406, 1437, 1406, 1437, 1406, 1437, 1282, |
| 148904 | + /* 350 */ 1460, 1460, 1411, 1417, 1534, 1282, 1413, 1411, 1425, 1427, |
| 148905 | + /* 360 */ 1321, 1542, 1559, 1574, 1574, 1584, 1584, 1584, 2142, 2142, |
| 148906 | + /* 370 */ 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, 2142, |
| 148907 | + /* 380 */ 2142, 2142, 2142, 2142, 300, 438, 310, 860, 873, 773, |
| 148908 | + /* 390 */ 500, 1153, 1199, 1093, 1053, 1154, 1203, 1206, 1207, 1213, |
| 148909 | + /* 400 */ 1215, 1217, 1230, 1208, 1146, 1261, 1137, 1211, 1240, 1248, |
| 148910 | + /* 410 */ 1249, 1097, 1131, 1273, 1293, 1214, 1233, 1601, 1605, 1589, |
| 148911 | + /* 420 */ 1458, 1599, 1522, 1602, 1594, 1597, 1489, 1492, 1513, 1614, |
| 148912 | + /* 430 */ 1504, 1620, 1510, 1625, 1647, 1515, 1507, 1531, 1595, 1621, |
| 148913 | + /* 440 */ 1514, 1606, 1607, 1608, 1610, 1543, 1556, 1634, 1533, 1669, |
| 148914 | + /* 450 */ 1666, 1651, 1566, 1523, 1609, 1649, 1611, 1603, 1639, 1547, |
| 148915 | + /* 460 */ 1575, 1658, 1664, 1667, 1561, 1569, 1668, 1622, 1671, 1672, |
| 148916 | + /* 470 */ 1665, 1673, 1624, 1670, 1674, 1630, 1662, 1677, 1563, 1679, |
| 148917 | + /* 480 */ 1680, 1549, 1684, 1685, 1683, 1688, 1690, 1692, 1691, 1695, |
| 148918 | + /* 490 */ 1694, 1585, 1698, 1705, 1617, 1696, 1707, 1596, 1709, 1697, |
| 148919 | + /* 500 */ 1702, 1704, 1711, 1652, 1675, 1663, 1708, 1676, 1659, 1714, |
| 148920 | + /* 510 */ 1718, 1731, 1730, 1729, 1733, 1722, 1734, 1709, 1737, 1738, |
| 148921 | + /* 520 */ 1742, 1743, 1741, 1745, 1747, 1759, 1749, 1750, 1752, 1753, |
| 148922 | + /* 530 */ 1751, 1755, 1757, 1656, 1653, 1654, 1655, 1657, 1769, 1778, |
| 148923 | + /* 540 */ 1793, |
| 148924 | +}; |
| 148925 | +#define YY_REDUCE_COUNT (383) |
| 148926 | +#define YY_REDUCE_MIN (-241) |
| 148927 | +#define YY_REDUCE_MAX (1440) |
| 148316 | 148928 | static const short yy_reduce_ofst[] = { |
| 148317 | | - /* 0 */ -147, 171, 263, -96, 169, -144, -162, -149, -102, -156, |
| 148318 | | - /* 10 */ -98, 216, 354, -170, -57, -235, 307, 149, 423, 428, |
| 148319 | | - /* 20 */ 471, 313, 451, 519, 489, 496, 499, 545, 547, 555, |
| 148320 | | - /* 30 */ -116, 540, 558, 592, 594, 597, 599, -206, -206, -206, |
| 148321 | | - /* 40 */ -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, |
| 148322 | | - /* 50 */ -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, |
| 148323 | | - /* 60 */ -206, -206, -206, -206, -206, -206, -206, -206, -206, -206, |
| 148324 | | - /* 70 */ -206, -206, 196, 309, 494, 537, 612, 656, 675, 679, |
| 148325 | | - /* 80 */ 681, 685, 724, 753, 771, 776, 788, 790, 794, 796, |
| 148326 | | - /* 90 */ 801, 803, 805, 807, 814, 819, 833, 837, 839, 842, |
| 148327 | | - /* 100 */ 845, 847, 849, 853, 873, 891, 893, 917, 921, 937, |
| 148328 | | - /* 110 */ 940, 944, 956, 960, 967, 969, 971, 973, 975, -206, |
| 148329 | | - /* 120 */ -206, -206, -206, -206, -206, -206, -206, -206, 501, -168, |
| 148330 | | - /* 130 */ 90, -97, 87, 112, 303, 277, 601, 277, 601, 179, |
| 148331 | | - /* 140 */ -206, -206, -206, -206, -107, -107, -107, -43, -56, 323, |
| 148332 | | - /* 150 */ 500, 512, -187, -177, 317, 609, 353, 353, 120, 144, |
| 148333 | | - /* 160 */ 490, 539, 698, 374, 467, 507, 789, 404, -157, 755, |
| 148334 | | - /* 170 */ 856, 916, 843, 941, 802, 770, 923, 821, 1001, -142, |
| 148335 | | - /* 180 */ 264, 785, 896, 905, 899, 949, -176, 544, 911, 953, |
| 148336 | | - /* 190 */ 1012, -182, -59, -30, 16, -22, 117, 172, 291, 369, |
| 148337 | | - /* 200 */ 407, 415, 566, 586, 647, 699, 754, 813, 850, 892, |
| 148338 | | - /* 210 */ 121, 1023, 1042, 1086, 1121, 1125, 1128, 1129, 1130, 1131, |
| 148339 | | - /* 220 */ 1132, 1134, 1135, 284, 1106, 1123, 1152, 1154, 1155, 1156, |
| 148340 | | - /* 230 */ 397, 1158, 1172, 1173, 1116, 1176, 1177, 1138, 1179, 117, |
| 148341 | | - /* 240 */ 1184, 1185, 1198, 1200, 1202, 1203, 741, 1094, 1153, 1146, |
| 148342 | | - /* 250 */ 1160, 1162, 1163, 397, 1153, 1153, 1170, 1204, 1206, 1103, |
| 148343 | | - /* 260 */ 1168, 1165, 1166, 1133, 1174, 1175, 1140, 1210, 1193, 1208, |
| 148344 | | - /* 270 */ 1212, 1215, 1216, 1178, 1167, 1189, 1196, 1241, 1148, 1243, |
| 148345 | | - /* 280 */ 1245, 1181, 1183, 1247, 1188, 1187, 1190, 1227, 1223, 1234, |
| 148346 | | - /* 290 */ 1236, 1238, 1239, 1274, 1278, 1235, 1237, 1213, 1218, 1253, |
| 148347 | | - /* 300 */ 1254, 1246, 1287, 1289, 1209, 1219, 1303, 1305, 1293, 1306, |
| 148348 | | - /* 310 */ 1309, 1313, 1316, 1297, 1301, 1307, 1308, 1298, 1310, 1311, |
| 148349 | | - /* 320 */ 1312, 1317, 1304, 1318, 1320, 1319, 1265, 1267, 1325, 1295, |
| 148350 | | - /* 330 */ 1300, 1296, 1302, 1326, 1321, 1327, 1330, 1365, 1323, 1269, |
| 148351 | | - /* 340 */ 1272, 1328, 1331, 1322, 1388, 1334, 1336, 1349, 1353, 1357, |
| 148352 | | - /* 350 */ 1405, 1409, 1420, 1421, 1427, 1429, 1430, 1332, 1335, 1339, |
| 148353 | | - /* 360 */ 1418, 1422, 1423, 1424, 1425, 1433, 1426, 1435, 1436, 1437, |
| 148354 | | - /* 370 */ 1438, 1441, 1439, |
| 148929 | + /* 0 */ -151, 181, -141, 376, 379, -149, -153, -75, -1, 227, |
| 148930 | + /* 10 */ 273, 279, 232, -176, -133, -241, -179, 321, 349, 447, |
| 148931 | + /* 20 */ 528, 373, 546, 590, 431, 470, 593, -163, 520, 564, |
| 148932 | + /* 30 */ 624, 626, 246, 386, 539, 479, 536, 573, 576, 619, |
| 148933 | + /* 40 */ 627, 634, -202, -202, -202, -202, -202, -202, -202, -202, |
| 148934 | + /* 50 */ -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, |
| 148935 | + /* 60 */ -202, -202, -202, -202, -202, -202, -202, -202, -202, -202, |
| 148936 | + /* 70 */ -202, -202, -202, -202, -202, -202, -202, 113, 137, 304, |
| 148937 | + /* 80 */ 660, 665, 691, 714, 721, 741, 758, 760, 784, 787, |
| 148938 | + /* 90 */ 807, 833, 836, 838, 861, 874, 876, 878, 880, 887, |
| 148939 | + /* 100 */ 889, 891, 893, 903, 905, 907, 919, 921, 923, 930, |
| 148940 | + /* 110 */ 932, 957, 959, 977, 1006, 1011, 1026, 1029, 1031, 1034, |
| 148941 | + /* 120 */ 1046, 1057, 1059, 1061, -202, -202, -202, -202, -202, -202, |
| 148942 | + /* 130 */ -202, -202, -202, 240, -172, -39, 139, 76, 235, 566, |
| 148943 | + /* 140 */ -103, 487, -103, 487, 502, -202, -202, -202, -202, -171, |
| 148944 | + /* 150 */ -171, -171, -134, -161, 110, 52, 274, -113, 678, 261, |
| 148945 | + /* 160 */ 444, 384, 384, -162, 481, 618, 666, 495, 186, 236, |
| 148946 | + /* 170 */ 730, 731, 672, 174, 674, 545, 757, 734, 769, 732, |
| 148947 | + /* 180 */ 418, 830, 826, 879, 480, 667, 729, 427, 777, 809, |
| 148948 | + /* 190 */ 608, 767, 812, 922, 839, 242, 855, 900, 390, -156, |
| 148949 | + /* 200 */ -108, -104, -76, -83, 207, 260, 347, 570, 595, 724, |
| 148950 | + /* 210 */ 738, 744, 768, 906, 916, 1014, 1064, 1091, 1098, 92, |
| 148951 | + /* 220 */ 1113, 1130, 1133, 1155, 1158, 1159, 1160, 1161, 1162, 1163, |
| 148952 | + /* 230 */ 1164, 1165, 448, 553, 971, 1166, 1178, 1179, 1180, 1069, |
| 148953 | + /* 240 */ 1181, 1182, 1183, 1094, 1040, 1184, 1185, 1110, 1186, 260, |
| 148954 | + /* 250 */ 1198, 1201, 1202, 1204, 1205, 1209, 1114, 1111, 1167, 1147, |
| 148955 | + /* 260 */ 1149, 1151, 1152, 1069, 1167, 1167, 1168, 1193, 1216, 1118, |
| 148956 | + /* 270 */ 1169, 1157, 1187, 1123, 1171, 1172, 1124, 1200, 1190, 1195, |
| 148957 | + /* 280 */ 1222, 1223, 1224, 1188, 1173, 1175, 1148, 1218, 1219, 1227, |
| 148958 | + /* 290 */ 1170, 1245, 1262, 1176, 1177, 1266, 1191, 1210, 1225, 1244, |
| 148959 | + /* 300 */ 1250, 1260, 1274, 1275, 1276, 1292, 1297, 1269, 1270, 1251, |
| 148960 | + /* 310 */ 1253, 1283, 1284, 1277, 1316, 1320, 1241, 1243, 1324, 1330, |
| 148961 | + /* 320 */ 1313, 1334, 1336, 1337, 1339, 1317, 1325, 1326, 1327, 1323, |
| 148962 | + /* 330 */ 1329, 1333, 1332, 1341, 1331, 1342, 1344, 1346, 1278, 1288, |
| 148963 | + /* 340 */ 1349, 1312, 1315, 1318, 1328, 1319, 1347, 1322, 1348, 1373, |
| 148964 | + /* 350 */ 1267, 1279, 1356, 1340, 1343, 1388, 1350, 1359, 1351, 1363, |
| 148965 | + /* 360 */ 1367, 1391, 1410, 1430, 1431, 1428, 1429, 1435, 1352, 1353, |
| 148966 | + /* 370 */ 1354, 1420, 1416, 1418, 1421, 1423, 1432, 1409, 1412, 1424, |
| 148967 | + /* 380 */ 1433, 1439, 1440, 1436, |
| 148355 | 148968 | }; |
| 148356 | 148969 | static const YYACTIONTYPE yy_default[] = { |
| 148357 | | - /* 0 */ 1500, 1500, 1500, 1346, 1129, 1235, 1129, 1129, 1129, 1346, |
| 148358 | | - /* 10 */ 1346, 1346, 1129, 1265, 1265, 1399, 1160, 1129, 1129, 1129, |
| 148359 | | - /* 20 */ 1129, 1129, 1129, 1129, 1345, 1129, 1129, 1129, 1129, 1129, |
| 148360 | | - /* 30 */ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1271, 1129, |
| 148361 | | - /* 40 */ 1129, 1129, 1129, 1129, 1347, 1348, 1129, 1129, 1129, 1398, |
| 148362 | | - /* 50 */ 1400, 1363, 1281, 1280, 1279, 1278, 1381, 1252, 1276, 1269, |
| 148363 | | - /* 60 */ 1273, 1341, 1342, 1340, 1344, 1348, 1347, 1129, 1272, 1312, |
| 148364 | | - /* 70 */ 1326, 1311, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148365 | | - /* 80 */ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148366 | | - /* 90 */ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148367 | | - /* 100 */ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148368 | | - /* 110 */ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1320, |
| 148369 | | - /* 120 */ 1325, 1331, 1324, 1321, 1314, 1313, 1315, 1316, 1129, 1150, |
| 148370 | | - /* 130 */ 1199, 1129, 1129, 1129, 1129, 1417, 1416, 1129, 1129, 1160, |
| 148371 | | - /* 140 */ 1317, 1318, 1328, 1327, 1406, 1456, 1455, 1364, 1129, 1129, |
| 148372 | | - /* 150 */ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148373 | | - /* 160 */ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148374 | | - /* 170 */ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148375 | | - /* 180 */ 1160, 1156, 1306, 1305, 1426, 1156, 1259, 1129, 1412, 1235, |
| 148376 | | - /* 190 */ 1226, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148377 | | - /* 200 */ 1129, 1129, 1129, 1129, 1403, 1401, 1129, 1129, 1129, 1129, |
| 148378 | | - /* 210 */ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148379 | | - /* 220 */ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148380 | | - /* 230 */ 1129, 1129, 1129, 1129, 1231, 1129, 1129, 1129, 1129, 1129, |
| 148381 | | - /* 240 */ 1129, 1129, 1129, 1129, 1129, 1450, 1129, 1376, 1213, 1231, |
| 148382 | | - /* 250 */ 1231, 1231, 1231, 1233, 1214, 1212, 1225, 1160, 1136, 1492, |
| 148383 | | - /* 260 */ 1275, 1254, 1254, 1489, 1275, 1275, 1489, 1174, 1470, 1171, |
| 148384 | | - /* 270 */ 1265, 1265, 1265, 1254, 1343, 1232, 1225, 1129, 1492, 1240, |
| 148385 | | - /* 280 */ 1240, 1491, 1491, 1240, 1364, 1284, 1290, 1202, 1275, 1208, |
| 148386 | | - /* 290 */ 1208, 1208, 1208, 1240, 1147, 1275, 1275, 1284, 1290, 1202, |
| 148387 | | - /* 300 */ 1202, 1275, 1240, 1147, 1380, 1486, 1240, 1147, 1354, 1240, |
| 148388 | | - /* 310 */ 1147, 1240, 1147, 1354, 1200, 1200, 1200, 1189, 1354, 1200, |
| 148389 | | - /* 320 */ 1174, 1200, 1189, 1200, 1200, 1354, 1358, 1358, 1354, 1258, |
| 148390 | | - /* 330 */ 1253, 1258, 1253, 1258, 1253, 1258, 1253, 1240, 1259, 1425, |
| 148391 | | - /* 340 */ 1129, 1270, 1259, 1349, 1240, 1129, 1270, 1268, 1266, 1275, |
| 148392 | | - /* 350 */ 1153, 1192, 1453, 1453, 1449, 1449, 1449, 1497, 1497, 1412, |
| 148393 | | - /* 360 */ 1465, 1160, 1160, 1160, 1160, 1465, 1176, 1176, 1160, 1160, |
| 148394 | | - /* 370 */ 1160, 1160, 1465, 1129, 1129, 1129, 1129, 1129, 1129, 1460, |
| 148395 | | - /* 380 */ 1129, 1365, 1244, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148396 | | - /* 390 */ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148397 | | - /* 400 */ 1129, 1129, 1129, 1129, 1129, 1295, 1129, 1132, 1409, 1129, |
| 148398 | | - /* 410 */ 1129, 1407, 1129, 1129, 1129, 1129, 1129, 1129, 1245, 1129, |
| 148399 | | - /* 420 */ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148400 | | - /* 430 */ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1488, 1129, 1129, |
| 148401 | | - /* 440 */ 1129, 1129, 1129, 1129, 1379, 1378, 1129, 1129, 1242, 1129, |
| 148402 | | - /* 450 */ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148403 | | - /* 460 */ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148404 | | - /* 470 */ 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148405 | | - /* 480 */ 1129, 1129, 1129, 1129, 1129, 1129, 1267, 1129, 1424, 1129, |
| 148406 | | - /* 490 */ 1129, 1129, 1129, 1129, 1129, 1129, 1438, 1260, 1129, 1129, |
| 148407 | | - /* 500 */ 1479, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, 1129, |
| 148408 | | - /* 510 */ 1129, 1129, 1129, 1129, 1129, 1474, 1216, 1297, 1129, 1296, |
| 148409 | | - /* 520 */ 1300, 1129, 1141, 1129, |
| 148970 | + /* 0 */ 1536, 1536, 1536, 1376, 1159, 1265, 1159, 1159, 1159, 1376, |
| 148971 | + /* 10 */ 1376, 1376, 1159, 1295, 1295, 1429, 1190, 1159, 1159, 1159, |
| 148972 | + /* 20 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1375, 1159, 1159, |
| 148973 | + /* 30 */ 1159, 1159, 1459, 1459, 1159, 1159, 1159, 1159, 1159, 1159, |
| 148974 | + /* 40 */ 1159, 1159, 1159, 1301, 1159, 1159, 1159, 1159, 1159, 1377, |
| 148975 | + /* 50 */ 1378, 1159, 1159, 1159, 1428, 1430, 1393, 1311, 1310, 1309, |
| 148976 | + /* 60 */ 1308, 1411, 1282, 1306, 1299, 1303, 1371, 1372, 1370, 1374, |
| 148977 | + /* 70 */ 1378, 1377, 1159, 1302, 1342, 1356, 1341, 1159, 1159, 1159, |
| 148978 | + /* 80 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, |
| 148979 | + /* 90 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, |
| 148980 | + /* 100 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, |
| 148981 | + /* 110 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, |
| 148982 | + /* 120 */ 1159, 1159, 1159, 1159, 1350, 1355, 1361, 1354, 1351, 1344, |
| 148983 | + /* 130 */ 1343, 1345, 1346, 1159, 1180, 1229, 1159, 1159, 1159, 1159, |
| 148984 | + /* 140 */ 1447, 1446, 1159, 1159, 1190, 1347, 1348, 1358, 1357, 1436, |
| 148985 | + /* 150 */ 1492, 1491, 1394, 1159, 1159, 1159, 1159, 1159, 1159, 1459, |
| 148986 | + /* 160 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, |
| 148987 | + /* 170 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, |
| 148988 | + /* 180 */ 1159, 1159, 1159, 1159, 1459, 1459, 1159, 1190, 1459, 1459, |
| 148989 | + /* 190 */ 1186, 1336, 1335, 1186, 1289, 1159, 1442, 1265, 1256, 1159, |
| 148990 | + /* 200 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, |
| 148991 | + /* 210 */ 1159, 1159, 1159, 1433, 1431, 1159, 1159, 1159, 1159, 1159, |
| 148992 | + /* 220 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, |
| 148993 | + /* 230 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, |
| 148994 | + /* 240 */ 1159, 1159, 1159, 1261, 1159, 1159, 1159, 1159, 1159, 1159, |
| 148995 | + /* 250 */ 1159, 1159, 1159, 1159, 1159, 1486, 1159, 1406, 1243, 1261, |
| 148996 | + /* 260 */ 1261, 1261, 1261, 1263, 1244, 1242, 1255, 1190, 1166, 1528, |
| 148997 | + /* 270 */ 1305, 1284, 1284, 1525, 1305, 1305, 1525, 1204, 1506, 1201, |
| 148998 | + /* 280 */ 1295, 1295, 1295, 1284, 1289, 1289, 1373, 1262, 1255, 1159, |
| 148999 | + /* 290 */ 1528, 1270, 1270, 1527, 1527, 1270, 1394, 1314, 1320, 1232, |
| 149000 | + /* 300 */ 1305, 1238, 1238, 1238, 1238, 1270, 1177, 1305, 1305, 1314, |
| 149001 | + /* 310 */ 1320, 1232, 1232, 1305, 1270, 1177, 1410, 1522, 1270, 1177, |
| 149002 | + /* 320 */ 1384, 1270, 1177, 1270, 1177, 1384, 1230, 1230, 1230, 1219, |
| 149003 | + /* 330 */ 1384, 1230, 1204, 1230, 1219, 1230, 1230, 1384, 1388, 1388, |
| 149004 | + /* 340 */ 1384, 1288, 1283, 1288, 1283, 1288, 1283, 1288, 1283, 1270, |
| 149005 | + /* 350 */ 1469, 1469, 1300, 1289, 1379, 1270, 1159, 1300, 1298, 1296, |
| 149006 | + /* 360 */ 1305, 1183, 1222, 1489, 1489, 1485, 1485, 1485, 1533, 1533, |
| 149007 | + /* 370 */ 1442, 1501, 1190, 1190, 1190, 1190, 1501, 1206, 1206, 1190, |
| 149008 | + /* 380 */ 1190, 1190, 1190, 1501, 1159, 1159, 1159, 1159, 1159, 1159, |
| 149009 | + /* 390 */ 1496, 1159, 1395, 1274, 1159, 1159, 1159, 1159, 1159, 1159, |
| 149010 | + /* 400 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, |
| 149011 | + /* 410 */ 1159, 1159, 1159, 1159, 1159, 1159, 1325, 1159, 1162, 1439, |
| 149012 | + /* 420 */ 1159, 1159, 1437, 1159, 1159, 1159, 1159, 1159, 1159, 1275, |
| 149013 | + /* 430 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, |
| 149014 | + /* 440 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1524, 1159, |
| 149015 | + /* 450 */ 1159, 1159, 1159, 1159, 1159, 1409, 1408, 1159, 1159, 1272, |
| 149016 | + /* 460 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, |
| 149017 | + /* 470 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, |
| 149018 | + /* 480 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, |
| 149019 | + /* 490 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1297, 1159, |
| 149020 | + /* 500 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, |
| 149021 | + /* 510 */ 1159, 1159, 1159, 1474, 1290, 1159, 1159, 1515, 1159, 1159, |
| 149022 | + /* 520 */ 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, 1159, |
| 149023 | + /* 530 */ 1159, 1159, 1510, 1246, 1327, 1159, 1326, 1330, 1159, 1171, |
| 149024 | + /* 540 */ 1159, |
| 148410 | 149025 | }; |
| 148411 | 149026 | /********** End of lemon-generated parsing tables *****************************/ |
| 148412 | 149027 | |
| 148413 | 149028 | /* The next table maps tokens (terminal symbols) into fallback tokens. |
| 148414 | 149029 | ** If a construct like the following: |
| | @@ -148512,10 +149127,14 @@ |
| 148512 | 149127 | 59, /* FOLLOWING => ID */ |
| 148513 | 149128 | 59, /* PARTITION => ID */ |
| 148514 | 149129 | 59, /* PRECEDING => ID */ |
| 148515 | 149130 | 59, /* RANGE => ID */ |
| 148516 | 149131 | 59, /* UNBOUNDED => ID */ |
| 149132 | + 59, /* EXCLUDE => ID */ |
| 149133 | + 59, /* GROUPS => ID */ |
| 149134 | + 59, /* OTHERS => ID */ |
| 149135 | + 59, /* TIES => ID */ |
| 148517 | 149136 | 59, /* REINDEX => ID */ |
| 148518 | 149137 | 59, /* RENAME => ID */ |
| 148519 | 149138 | 59, /* CTIME_KW => ID */ |
| 148520 | 149139 | }; |
| 148521 | 149140 | #endif /* YYFALLBACK */ |
| | @@ -148690,200 +149309,206 @@ |
| 148690 | 149309 | /* 83 */ "FOLLOWING", |
| 148691 | 149310 | /* 84 */ "PARTITION", |
| 148692 | 149311 | /* 85 */ "PRECEDING", |
| 148693 | 149312 | /* 86 */ "RANGE", |
| 148694 | 149313 | /* 87 */ "UNBOUNDED", |
| 148695 | | - /* 88 */ "REINDEX", |
| 148696 | | - /* 89 */ "RENAME", |
| 148697 | | - /* 90 */ "CTIME_KW", |
| 148698 | | - /* 91 */ "ANY", |
| 148699 | | - /* 92 */ "BITAND", |
| 148700 | | - /* 93 */ "BITOR", |
| 148701 | | - /* 94 */ "LSHIFT", |
| 148702 | | - /* 95 */ "RSHIFT", |
| 148703 | | - /* 96 */ "PLUS", |
| 148704 | | - /* 97 */ "MINUS", |
| 148705 | | - /* 98 */ "STAR", |
| 148706 | | - /* 99 */ "SLASH", |
| 148707 | | - /* 100 */ "REM", |
| 148708 | | - /* 101 */ "CONCAT", |
| 148709 | | - /* 102 */ "COLLATE", |
| 148710 | | - /* 103 */ "BITNOT", |
| 148711 | | - /* 104 */ "ON", |
| 148712 | | - /* 105 */ "INDEXED", |
| 148713 | | - /* 106 */ "STRING", |
| 148714 | | - /* 107 */ "JOIN_KW", |
| 148715 | | - /* 108 */ "CONSTRAINT", |
| 148716 | | - /* 109 */ "DEFAULT", |
| 148717 | | - /* 110 */ "NULL", |
| 148718 | | - /* 111 */ "PRIMARY", |
| 148719 | | - /* 112 */ "UNIQUE", |
| 148720 | | - /* 113 */ "CHECK", |
| 148721 | | - /* 114 */ "REFERENCES", |
| 148722 | | - /* 115 */ "AUTOINCR", |
| 148723 | | - /* 116 */ "INSERT", |
| 148724 | | - /* 117 */ "DELETE", |
| 148725 | | - /* 118 */ "UPDATE", |
| 148726 | | - /* 119 */ "SET", |
| 148727 | | - /* 120 */ "DEFERRABLE", |
| 148728 | | - /* 121 */ "FOREIGN", |
| 148729 | | - /* 122 */ "DROP", |
| 148730 | | - /* 123 */ "UNION", |
| 148731 | | - /* 124 */ "ALL", |
| 148732 | | - /* 125 */ "EXCEPT", |
| 148733 | | - /* 126 */ "INTERSECT", |
| 148734 | | - /* 127 */ "SELECT", |
| 148735 | | - /* 128 */ "VALUES", |
| 148736 | | - /* 129 */ "DISTINCT", |
| 148737 | | - /* 130 */ "DOT", |
| 148738 | | - /* 131 */ "FROM", |
| 148739 | | - /* 132 */ "JOIN", |
| 148740 | | - /* 133 */ "USING", |
| 148741 | | - /* 134 */ "ORDER", |
| 148742 | | - /* 135 */ "GROUP", |
| 148743 | | - /* 136 */ "HAVING", |
| 148744 | | - /* 137 */ "LIMIT", |
| 148745 | | - /* 138 */ "WHERE", |
| 148746 | | - /* 139 */ "INTO", |
| 148747 | | - /* 140 */ "NOTHING", |
| 148748 | | - /* 141 */ "FLOAT", |
| 148749 | | - /* 142 */ "BLOB", |
| 148750 | | - /* 143 */ "INTEGER", |
| 148751 | | - /* 144 */ "VARIABLE", |
| 148752 | | - /* 145 */ "CASE", |
| 148753 | | - /* 146 */ "WHEN", |
| 148754 | | - /* 147 */ "THEN", |
| 148755 | | - /* 148 */ "ELSE", |
| 148756 | | - /* 149 */ "INDEX", |
| 148757 | | - /* 150 */ "ALTER", |
| 148758 | | - /* 151 */ "ADD", |
| 148759 | | - /* 152 */ "WINDOW", |
| 148760 | | - /* 153 */ "OVER", |
| 148761 | | - /* 154 */ "FILTER", |
| 148762 | | - /* 155 */ "input", |
| 148763 | | - /* 156 */ "cmdlist", |
| 148764 | | - /* 157 */ "ecmd", |
| 148765 | | - /* 158 */ "cmdx", |
| 148766 | | - /* 159 */ "explain", |
| 148767 | | - /* 160 */ "cmd", |
| 148768 | | - /* 161 */ "transtype", |
| 148769 | | - /* 162 */ "trans_opt", |
| 148770 | | - /* 163 */ "nm", |
| 148771 | | - /* 164 */ "savepoint_opt", |
| 148772 | | - /* 165 */ "create_table", |
| 148773 | | - /* 166 */ "create_table_args", |
| 148774 | | - /* 167 */ "createkw", |
| 148775 | | - /* 168 */ "temp", |
| 148776 | | - /* 169 */ "ifnotexists", |
| 148777 | | - /* 170 */ "dbnm", |
| 148778 | | - /* 171 */ "columnlist", |
| 148779 | | - /* 172 */ "conslist_opt", |
| 148780 | | - /* 173 */ "table_options", |
| 148781 | | - /* 174 */ "select", |
| 148782 | | - /* 175 */ "columnname", |
| 148783 | | - /* 176 */ "carglist", |
| 148784 | | - /* 177 */ "typetoken", |
| 148785 | | - /* 178 */ "typename", |
| 148786 | | - /* 179 */ "signed", |
| 148787 | | - /* 180 */ "plus_num", |
| 148788 | | - /* 181 */ "minus_num", |
| 148789 | | - /* 182 */ "scanpt", |
| 148790 | | - /* 183 */ "ccons", |
| 148791 | | - /* 184 */ "term", |
| 148792 | | - /* 185 */ "expr", |
| 148793 | | - /* 186 */ "onconf", |
| 148794 | | - /* 187 */ "sortorder", |
| 148795 | | - /* 188 */ "autoinc", |
| 148796 | | - /* 189 */ "eidlist_opt", |
| 148797 | | - /* 190 */ "refargs", |
| 148798 | | - /* 191 */ "defer_subclause", |
| 148799 | | - /* 192 */ "refarg", |
| 148800 | | - /* 193 */ "refact", |
| 148801 | | - /* 194 */ "init_deferred_pred_opt", |
| 148802 | | - /* 195 */ "conslist", |
| 148803 | | - /* 196 */ "tconscomma", |
| 148804 | | - /* 197 */ "tcons", |
| 148805 | | - /* 198 */ "sortlist", |
| 148806 | | - /* 199 */ "eidlist", |
| 148807 | | - /* 200 */ "defer_subclause_opt", |
| 148808 | | - /* 201 */ "orconf", |
| 148809 | | - /* 202 */ "resolvetype", |
| 148810 | | - /* 203 */ "raisetype", |
| 148811 | | - /* 204 */ "ifexists", |
| 148812 | | - /* 205 */ "fullname", |
| 148813 | | - /* 206 */ "selectnowith", |
| 148814 | | - /* 207 */ "oneselect", |
| 148815 | | - /* 208 */ "wqlist", |
| 148816 | | - /* 209 */ "multiselect_op", |
| 148817 | | - /* 210 */ "distinct", |
| 148818 | | - /* 211 */ "selcollist", |
| 148819 | | - /* 212 */ "from", |
| 148820 | | - /* 213 */ "where_opt", |
| 148821 | | - /* 214 */ "groupby_opt", |
| 148822 | | - /* 215 */ "having_opt", |
| 148823 | | - /* 216 */ "orderby_opt", |
| 148824 | | - /* 217 */ "limit_opt", |
| 148825 | | - /* 218 */ "window_clause", |
| 148826 | | - /* 219 */ "values", |
| 148827 | | - /* 220 */ "nexprlist", |
| 148828 | | - /* 221 */ "sclp", |
| 148829 | | - /* 222 */ "as", |
| 148830 | | - /* 223 */ "seltablist", |
| 148831 | | - /* 224 */ "stl_prefix", |
| 148832 | | - /* 225 */ "joinop", |
| 148833 | | - /* 226 */ "indexed_opt", |
| 148834 | | - /* 227 */ "on_opt", |
| 148835 | | - /* 228 */ "using_opt", |
| 148836 | | - /* 229 */ "exprlist", |
| 148837 | | - /* 230 */ "xfullname", |
| 148838 | | - /* 231 */ "idlist", |
| 148839 | | - /* 232 */ "with", |
| 148840 | | - /* 233 */ "setlist", |
| 148841 | | - /* 234 */ "insert_cmd", |
| 148842 | | - /* 235 */ "idlist_opt", |
| 148843 | | - /* 236 */ "upsert", |
| 148844 | | - /* 237 */ "over_clause", |
| 148845 | | - /* 238 */ "likeop", |
| 148846 | | - /* 239 */ "between_op", |
| 148847 | | - /* 240 */ "in_op", |
| 148848 | | - /* 241 */ "paren_exprlist", |
| 148849 | | - /* 242 */ "case_operand", |
| 148850 | | - /* 243 */ "case_exprlist", |
| 148851 | | - /* 244 */ "case_else", |
| 148852 | | - /* 245 */ "uniqueflag", |
| 148853 | | - /* 246 */ "collate", |
| 148854 | | - /* 247 */ "vinto", |
| 148855 | | - /* 248 */ "nmnum", |
| 148856 | | - /* 249 */ "trigger_decl", |
| 148857 | | - /* 250 */ "trigger_cmd_list", |
| 148858 | | - /* 251 */ "trigger_time", |
| 148859 | | - /* 252 */ "trigger_event", |
| 148860 | | - /* 253 */ "foreach_clause", |
| 148861 | | - /* 254 */ "when_clause", |
| 148862 | | - /* 255 */ "trigger_cmd", |
| 148863 | | - /* 256 */ "trnm", |
| 148864 | | - /* 257 */ "tridxby", |
| 148865 | | - /* 258 */ "database_kw_opt", |
| 148866 | | - /* 259 */ "key_opt", |
| 148867 | | - /* 260 */ "add_column_fullname", |
| 148868 | | - /* 261 */ "kwcolumn_opt", |
| 148869 | | - /* 262 */ "create_vtab", |
| 148870 | | - /* 263 */ "vtabarglist", |
| 148871 | | - /* 264 */ "vtabarg", |
| 148872 | | - /* 265 */ "vtabargtoken", |
| 148873 | | - /* 266 */ "lp", |
| 148874 | | - /* 267 */ "anylist", |
| 148875 | | - /* 268 */ "windowdefn_list", |
| 148876 | | - /* 269 */ "windowdefn", |
| 148877 | | - /* 270 */ "window", |
| 148878 | | - /* 271 */ "frame_opt", |
| 148879 | | - /* 272 */ "part_opt", |
| 148880 | | - /* 273 */ "filter_opt", |
| 148881 | | - /* 274 */ "range_or_rows", |
| 148882 | | - /* 275 */ "frame_bound", |
| 148883 | | - /* 276 */ "frame_bound_s", |
| 148884 | | - /* 277 */ "frame_bound_e", |
| 149314 | + /* 88 */ "EXCLUDE", |
| 149315 | + /* 89 */ "GROUPS", |
| 149316 | + /* 90 */ "OTHERS", |
| 149317 | + /* 91 */ "TIES", |
| 149318 | + /* 92 */ "REINDEX", |
| 149319 | + /* 93 */ "RENAME", |
| 149320 | + /* 94 */ "CTIME_KW", |
| 149321 | + /* 95 */ "ANY", |
| 149322 | + /* 96 */ "BITAND", |
| 149323 | + /* 97 */ "BITOR", |
| 149324 | + /* 98 */ "LSHIFT", |
| 149325 | + /* 99 */ "RSHIFT", |
| 149326 | + /* 100 */ "PLUS", |
| 149327 | + /* 101 */ "MINUS", |
| 149328 | + /* 102 */ "STAR", |
| 149329 | + /* 103 */ "SLASH", |
| 149330 | + /* 104 */ "REM", |
| 149331 | + /* 105 */ "CONCAT", |
| 149332 | + /* 106 */ "COLLATE", |
| 149333 | + /* 107 */ "BITNOT", |
| 149334 | + /* 108 */ "ON", |
| 149335 | + /* 109 */ "INDEXED", |
| 149336 | + /* 110 */ "STRING", |
| 149337 | + /* 111 */ "JOIN_KW", |
| 149338 | + /* 112 */ "CONSTRAINT", |
| 149339 | + /* 113 */ "DEFAULT", |
| 149340 | + /* 114 */ "NULL", |
| 149341 | + /* 115 */ "PRIMARY", |
| 149342 | + /* 116 */ "UNIQUE", |
| 149343 | + /* 117 */ "CHECK", |
| 149344 | + /* 118 */ "REFERENCES", |
| 149345 | + /* 119 */ "AUTOINCR", |
| 149346 | + /* 120 */ "INSERT", |
| 149347 | + /* 121 */ "DELETE", |
| 149348 | + /* 122 */ "UPDATE", |
| 149349 | + /* 123 */ "SET", |
| 149350 | + /* 124 */ "DEFERRABLE", |
| 149351 | + /* 125 */ "FOREIGN", |
| 149352 | + /* 126 */ "DROP", |
| 149353 | + /* 127 */ "UNION", |
| 149354 | + /* 128 */ "ALL", |
| 149355 | + /* 129 */ "EXCEPT", |
| 149356 | + /* 130 */ "INTERSECT", |
| 149357 | + /* 131 */ "SELECT", |
| 149358 | + /* 132 */ "VALUES", |
| 149359 | + /* 133 */ "DISTINCT", |
| 149360 | + /* 134 */ "DOT", |
| 149361 | + /* 135 */ "FROM", |
| 149362 | + /* 136 */ "JOIN", |
| 149363 | + /* 137 */ "USING", |
| 149364 | + /* 138 */ "ORDER", |
| 149365 | + /* 139 */ "GROUP", |
| 149366 | + /* 140 */ "HAVING", |
| 149367 | + /* 141 */ "LIMIT", |
| 149368 | + /* 142 */ "WHERE", |
| 149369 | + /* 143 */ "INTO", |
| 149370 | + /* 144 */ "NOTHING", |
| 149371 | + /* 145 */ "FLOAT", |
| 149372 | + /* 146 */ "BLOB", |
| 149373 | + /* 147 */ "INTEGER", |
| 149374 | + /* 148 */ "VARIABLE", |
| 149375 | + /* 149 */ "CASE", |
| 149376 | + /* 150 */ "WHEN", |
| 149377 | + /* 151 */ "THEN", |
| 149378 | + /* 152 */ "ELSE", |
| 149379 | + /* 153 */ "INDEX", |
| 149380 | + /* 154 */ "ALTER", |
| 149381 | + /* 155 */ "ADD", |
| 149382 | + /* 156 */ "WINDOW", |
| 149383 | + /* 157 */ "OVER", |
| 149384 | + /* 158 */ "FILTER", |
| 149385 | + /* 159 */ "input", |
| 149386 | + /* 160 */ "cmdlist", |
| 149387 | + /* 161 */ "ecmd", |
| 149388 | + /* 162 */ "cmdx", |
| 149389 | + /* 163 */ "explain", |
| 149390 | + /* 164 */ "cmd", |
| 149391 | + /* 165 */ "transtype", |
| 149392 | + /* 166 */ "trans_opt", |
| 149393 | + /* 167 */ "nm", |
| 149394 | + /* 168 */ "savepoint_opt", |
| 149395 | + /* 169 */ "create_table", |
| 149396 | + /* 170 */ "create_table_args", |
| 149397 | + /* 171 */ "createkw", |
| 149398 | + /* 172 */ "temp", |
| 149399 | + /* 173 */ "ifnotexists", |
| 149400 | + /* 174 */ "dbnm", |
| 149401 | + /* 175 */ "columnlist", |
| 149402 | + /* 176 */ "conslist_opt", |
| 149403 | + /* 177 */ "table_options", |
| 149404 | + /* 178 */ "select", |
| 149405 | + /* 179 */ "columnname", |
| 149406 | + /* 180 */ "carglist", |
| 149407 | + /* 181 */ "typetoken", |
| 149408 | + /* 182 */ "typename", |
| 149409 | + /* 183 */ "signed", |
| 149410 | + /* 184 */ "plus_num", |
| 149411 | + /* 185 */ "minus_num", |
| 149412 | + /* 186 */ "scanpt", |
| 149413 | + /* 187 */ "ccons", |
| 149414 | + /* 188 */ "term", |
| 149415 | + /* 189 */ "expr", |
| 149416 | + /* 190 */ "onconf", |
| 149417 | + /* 191 */ "sortorder", |
| 149418 | + /* 192 */ "autoinc", |
| 149419 | + /* 193 */ "eidlist_opt", |
| 149420 | + /* 194 */ "refargs", |
| 149421 | + /* 195 */ "defer_subclause", |
| 149422 | + /* 196 */ "refarg", |
| 149423 | + /* 197 */ "refact", |
| 149424 | + /* 198 */ "init_deferred_pred_opt", |
| 149425 | + /* 199 */ "conslist", |
| 149426 | + /* 200 */ "tconscomma", |
| 149427 | + /* 201 */ "tcons", |
| 149428 | + /* 202 */ "sortlist", |
| 149429 | + /* 203 */ "eidlist", |
| 149430 | + /* 204 */ "defer_subclause_opt", |
| 149431 | + /* 205 */ "orconf", |
| 149432 | + /* 206 */ "resolvetype", |
| 149433 | + /* 207 */ "raisetype", |
| 149434 | + /* 208 */ "ifexists", |
| 149435 | + /* 209 */ "fullname", |
| 149436 | + /* 210 */ "selectnowith", |
| 149437 | + /* 211 */ "oneselect", |
| 149438 | + /* 212 */ "wqlist", |
| 149439 | + /* 213 */ "multiselect_op", |
| 149440 | + /* 214 */ "distinct", |
| 149441 | + /* 215 */ "selcollist", |
| 149442 | + /* 216 */ "from", |
| 149443 | + /* 217 */ "where_opt", |
| 149444 | + /* 218 */ "groupby_opt", |
| 149445 | + /* 219 */ "having_opt", |
| 149446 | + /* 220 */ "orderby_opt", |
| 149447 | + /* 221 */ "limit_opt", |
| 149448 | + /* 222 */ "window_clause", |
| 149449 | + /* 223 */ "values", |
| 149450 | + /* 224 */ "nexprlist", |
| 149451 | + /* 225 */ "sclp", |
| 149452 | + /* 226 */ "as", |
| 149453 | + /* 227 */ "seltablist", |
| 149454 | + /* 228 */ "stl_prefix", |
| 149455 | + /* 229 */ "joinop", |
| 149456 | + /* 230 */ "indexed_opt", |
| 149457 | + /* 231 */ "on_opt", |
| 149458 | + /* 232 */ "using_opt", |
| 149459 | + /* 233 */ "exprlist", |
| 149460 | + /* 234 */ "xfullname", |
| 149461 | + /* 235 */ "idlist", |
| 149462 | + /* 236 */ "with", |
| 149463 | + /* 237 */ "setlist", |
| 149464 | + /* 238 */ "insert_cmd", |
| 149465 | + /* 239 */ "idlist_opt", |
| 149466 | + /* 240 */ "upsert", |
| 149467 | + /* 241 */ "over_clause", |
| 149468 | + /* 242 */ "likeop", |
| 149469 | + /* 243 */ "between_op", |
| 149470 | + /* 244 */ "in_op", |
| 149471 | + /* 245 */ "paren_exprlist", |
| 149472 | + /* 246 */ "case_operand", |
| 149473 | + /* 247 */ "case_exprlist", |
| 149474 | + /* 248 */ "case_else", |
| 149475 | + /* 249 */ "uniqueflag", |
| 149476 | + /* 250 */ "collate", |
| 149477 | + /* 251 */ "vinto", |
| 149478 | + /* 252 */ "nmnum", |
| 149479 | + /* 253 */ "trigger_decl", |
| 149480 | + /* 254 */ "trigger_cmd_list", |
| 149481 | + /* 255 */ "trigger_time", |
| 149482 | + /* 256 */ "trigger_event", |
| 149483 | + /* 257 */ "foreach_clause", |
| 149484 | + /* 258 */ "when_clause", |
| 149485 | + /* 259 */ "trigger_cmd", |
| 149486 | + /* 260 */ "trnm", |
| 149487 | + /* 261 */ "tridxby", |
| 149488 | + /* 262 */ "database_kw_opt", |
| 149489 | + /* 263 */ "key_opt", |
| 149490 | + /* 264 */ "add_column_fullname", |
| 149491 | + /* 265 */ "kwcolumn_opt", |
| 149492 | + /* 266 */ "create_vtab", |
| 149493 | + /* 267 */ "vtabarglist", |
| 149494 | + /* 268 */ "vtabarg", |
| 149495 | + /* 269 */ "vtabargtoken", |
| 149496 | + /* 270 */ "lp", |
| 149497 | + /* 271 */ "anylist", |
| 149498 | + /* 272 */ "windowdefn_list", |
| 149499 | + /* 273 */ "windowdefn", |
| 149500 | + /* 274 */ "window", |
| 149501 | + /* 275 */ "frame_opt", |
| 149502 | + /* 276 */ "part_opt", |
| 149503 | + /* 277 */ "filter_opt", |
| 149504 | + /* 278 */ "range_or_rows", |
| 149505 | + /* 279 */ "frame_bound", |
| 149506 | + /* 280 */ "frame_bound_s", |
| 149507 | + /* 281 */ "frame_bound_e", |
| 149508 | + /* 282 */ "frame_exclude_opt", |
| 149509 | + /* 283 */ "frame_exclude", |
| 148885 | 149510 | }; |
| 148886 | 149511 | #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ |
| 148887 | 149512 | |
| 148888 | 149513 | #ifndef NDEBUG |
| 148889 | 149514 | /* For tracing reduce actions, the names of all rules are required. |
| | @@ -149177,89 +149802,95 @@ |
| 149177 | 149802 | /* 285 */ "with ::= WITH RECURSIVE wqlist", |
| 149178 | 149803 | /* 286 */ "wqlist ::= nm eidlist_opt AS LP select RP", |
| 149179 | 149804 | /* 287 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", |
| 149180 | 149805 | /* 288 */ "windowdefn_list ::= windowdefn", |
| 149181 | 149806 | /* 289 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", |
| 149182 | | - /* 290 */ "windowdefn ::= nm AS window", |
| 149183 | | - /* 291 */ "window ::= LP part_opt orderby_opt frame_opt RP", |
| 149184 | | - /* 292 */ "part_opt ::= PARTITION BY nexprlist", |
| 149185 | | - /* 293 */ "part_opt ::=", |
| 149186 | | - /* 294 */ "frame_opt ::=", |
| 149187 | | - /* 295 */ "frame_opt ::= range_or_rows frame_bound_s", |
| 149188 | | - /* 296 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e", |
| 149189 | | - /* 297 */ "range_or_rows ::= RANGE", |
| 149190 | | - /* 298 */ "range_or_rows ::= ROWS", |
| 149191 | | - /* 299 */ "frame_bound_s ::= frame_bound", |
| 149192 | | - /* 300 */ "frame_bound_s ::= UNBOUNDED PRECEDING", |
| 149193 | | - /* 301 */ "frame_bound_e ::= frame_bound", |
| 149194 | | - /* 302 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", |
| 149195 | | - /* 303 */ "frame_bound ::= expr PRECEDING", |
| 149196 | | - /* 304 */ "frame_bound ::= CURRENT ROW", |
| 149197 | | - /* 305 */ "frame_bound ::= expr FOLLOWING", |
| 149198 | | - /* 306 */ "window_clause ::= WINDOW windowdefn_list", |
| 149199 | | - /* 307 */ "over_clause ::= filter_opt OVER window", |
| 149200 | | - /* 308 */ "over_clause ::= filter_opt OVER nm", |
| 149201 | | - /* 309 */ "filter_opt ::=", |
| 149202 | | - /* 310 */ "filter_opt ::= FILTER LP WHERE expr RP", |
| 149203 | | - /* 311 */ "input ::= cmdlist", |
| 149204 | | - /* 312 */ "cmdlist ::= cmdlist ecmd", |
| 149205 | | - /* 313 */ "cmdlist ::= ecmd", |
| 149206 | | - /* 314 */ "ecmd ::= SEMI", |
| 149207 | | - /* 315 */ "ecmd ::= cmdx SEMI", |
| 149208 | | - /* 316 */ "ecmd ::= explain cmdx", |
| 149209 | | - /* 317 */ "trans_opt ::=", |
| 149210 | | - /* 318 */ "trans_opt ::= TRANSACTION", |
| 149211 | | - /* 319 */ "trans_opt ::= TRANSACTION nm", |
| 149212 | | - /* 320 */ "savepoint_opt ::= SAVEPOINT", |
| 149213 | | - /* 321 */ "savepoint_opt ::=", |
| 149214 | | - /* 322 */ "cmd ::= create_table create_table_args", |
| 149215 | | - /* 323 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 149216 | | - /* 324 */ "columnlist ::= columnname carglist", |
| 149217 | | - /* 325 */ "nm ::= ID|INDEXED", |
| 149218 | | - /* 326 */ "nm ::= STRING", |
| 149219 | | - /* 327 */ "nm ::= JOIN_KW", |
| 149220 | | - /* 328 */ "typetoken ::= typename", |
| 149221 | | - /* 329 */ "typename ::= ID|STRING", |
| 149222 | | - /* 330 */ "signed ::= plus_num", |
| 149223 | | - /* 331 */ "signed ::= minus_num", |
| 149224 | | - /* 332 */ "carglist ::= carglist ccons", |
| 149225 | | - /* 333 */ "carglist ::=", |
| 149226 | | - /* 334 */ "ccons ::= NULL onconf", |
| 149227 | | - /* 335 */ "conslist_opt ::= COMMA conslist", |
| 149228 | | - /* 336 */ "conslist ::= conslist tconscomma tcons", |
| 149229 | | - /* 337 */ "conslist ::= tcons", |
| 149230 | | - /* 338 */ "tconscomma ::=", |
| 149231 | | - /* 339 */ "defer_subclause_opt ::= defer_subclause", |
| 149232 | | - /* 340 */ "resolvetype ::= raisetype", |
| 149233 | | - /* 341 */ "selectnowith ::= oneselect", |
| 149234 | | - /* 342 */ "oneselect ::= values", |
| 149235 | | - /* 343 */ "sclp ::= selcollist COMMA", |
| 149236 | | - /* 344 */ "as ::= ID|STRING", |
| 149237 | | - /* 345 */ "expr ::= term", |
| 149238 | | - /* 346 */ "likeop ::= LIKE_KW|MATCH", |
| 149239 | | - /* 347 */ "exprlist ::= nexprlist", |
| 149240 | | - /* 348 */ "nmnum ::= plus_num", |
| 149241 | | - /* 349 */ "nmnum ::= nm", |
| 149242 | | - /* 350 */ "nmnum ::= ON", |
| 149243 | | - /* 351 */ "nmnum ::= DELETE", |
| 149244 | | - /* 352 */ "nmnum ::= DEFAULT", |
| 149245 | | - /* 353 */ "plus_num ::= INTEGER|FLOAT", |
| 149246 | | - /* 354 */ "foreach_clause ::=", |
| 149247 | | - /* 355 */ "foreach_clause ::= FOR EACH ROW", |
| 149248 | | - /* 356 */ "trnm ::= nm", |
| 149249 | | - /* 357 */ "tridxby ::=", |
| 149250 | | - /* 358 */ "database_kw_opt ::= DATABASE", |
| 149251 | | - /* 359 */ "database_kw_opt ::=", |
| 149252 | | - /* 360 */ "kwcolumn_opt ::=", |
| 149253 | | - /* 361 */ "kwcolumn_opt ::= COLUMNKW", |
| 149254 | | - /* 362 */ "vtabarglist ::= vtabarg", |
| 149255 | | - /* 363 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 149256 | | - /* 364 */ "vtabarg ::= vtabarg vtabargtoken", |
| 149257 | | - /* 365 */ "anylist ::=", |
| 149258 | | - /* 366 */ "anylist ::= anylist LP anylist RP", |
| 149259 | | - /* 367 */ "anylist ::= anylist ANY", |
| 149260 | | - /* 368 */ "with ::=", |
| 149807 | + /* 290 */ "windowdefn ::= nm AS LP window RP", |
| 149808 | + /* 291 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", |
| 149809 | + /* 292 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", |
| 149810 | + /* 293 */ "window ::= ORDER BY sortlist frame_opt", |
| 149811 | + /* 294 */ "window ::= nm ORDER BY sortlist frame_opt", |
| 149812 | + /* 295 */ "window ::= frame_opt", |
| 149813 | + /* 296 */ "window ::= nm frame_opt", |
| 149814 | + /* 297 */ "frame_opt ::=", |
| 149815 | + /* 298 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", |
| 149816 | + /* 299 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", |
| 149817 | + /* 300 */ "range_or_rows ::= RANGE|ROWS|GROUPS", |
| 149818 | + /* 301 */ "frame_bound_s ::= frame_bound", |
| 149819 | + /* 302 */ "frame_bound_s ::= UNBOUNDED PRECEDING", |
| 149820 | + /* 303 */ "frame_bound_e ::= frame_bound", |
| 149821 | + /* 304 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", |
| 149822 | + /* 305 */ "frame_bound ::= expr PRECEDING|FOLLOWING", |
| 149823 | + /* 306 */ "frame_bound ::= CURRENT ROW", |
| 149824 | + /* 307 */ "frame_exclude_opt ::=", |
| 149825 | + /* 308 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", |
| 149826 | + /* 309 */ "frame_exclude ::= NO OTHERS", |
| 149827 | + /* 310 */ "frame_exclude ::= CURRENT ROW", |
| 149828 | + /* 311 */ "frame_exclude ::= GROUP|TIES", |
| 149829 | + /* 312 */ "window_clause ::= WINDOW windowdefn_list", |
| 149830 | + /* 313 */ "over_clause ::= filter_opt OVER LP window RP", |
| 149831 | + /* 314 */ "over_clause ::= filter_opt OVER nm", |
| 149832 | + /* 315 */ "filter_opt ::=", |
| 149833 | + /* 316 */ "filter_opt ::= FILTER LP WHERE expr RP", |
| 149834 | + /* 317 */ "input ::= cmdlist", |
| 149835 | + /* 318 */ "cmdlist ::= cmdlist ecmd", |
| 149836 | + /* 319 */ "cmdlist ::= ecmd", |
| 149837 | + /* 320 */ "ecmd ::= SEMI", |
| 149838 | + /* 321 */ "ecmd ::= cmdx SEMI", |
| 149839 | + /* 322 */ "ecmd ::= explain cmdx", |
| 149840 | + /* 323 */ "trans_opt ::=", |
| 149841 | + /* 324 */ "trans_opt ::= TRANSACTION", |
| 149842 | + /* 325 */ "trans_opt ::= TRANSACTION nm", |
| 149843 | + /* 326 */ "savepoint_opt ::= SAVEPOINT", |
| 149844 | + /* 327 */ "savepoint_opt ::=", |
| 149845 | + /* 328 */ "cmd ::= create_table create_table_args", |
| 149846 | + /* 329 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 149847 | + /* 330 */ "columnlist ::= columnname carglist", |
| 149848 | + /* 331 */ "nm ::= ID|INDEXED", |
| 149849 | + /* 332 */ "nm ::= STRING", |
| 149850 | + /* 333 */ "nm ::= JOIN_KW", |
| 149851 | + /* 334 */ "typetoken ::= typename", |
| 149852 | + /* 335 */ "typename ::= ID|STRING", |
| 149853 | + /* 336 */ "signed ::= plus_num", |
| 149854 | + /* 337 */ "signed ::= minus_num", |
| 149855 | + /* 338 */ "carglist ::= carglist ccons", |
| 149856 | + /* 339 */ "carglist ::=", |
| 149857 | + /* 340 */ "ccons ::= NULL onconf", |
| 149858 | + /* 341 */ "conslist_opt ::= COMMA conslist", |
| 149859 | + /* 342 */ "conslist ::= conslist tconscomma tcons", |
| 149860 | + /* 343 */ "conslist ::= tcons", |
| 149861 | + /* 344 */ "tconscomma ::=", |
| 149862 | + /* 345 */ "defer_subclause_opt ::= defer_subclause", |
| 149863 | + /* 346 */ "resolvetype ::= raisetype", |
| 149864 | + /* 347 */ "selectnowith ::= oneselect", |
| 149865 | + /* 348 */ "oneselect ::= values", |
| 149866 | + /* 349 */ "sclp ::= selcollist COMMA", |
| 149867 | + /* 350 */ "as ::= ID|STRING", |
| 149868 | + /* 351 */ "expr ::= term", |
| 149869 | + /* 352 */ "likeop ::= LIKE_KW|MATCH", |
| 149870 | + /* 353 */ "exprlist ::= nexprlist", |
| 149871 | + /* 354 */ "nmnum ::= plus_num", |
| 149872 | + /* 355 */ "nmnum ::= nm", |
| 149873 | + /* 356 */ "nmnum ::= ON", |
| 149874 | + /* 357 */ "nmnum ::= DELETE", |
| 149875 | + /* 358 */ "nmnum ::= DEFAULT", |
| 149876 | + /* 359 */ "plus_num ::= INTEGER|FLOAT", |
| 149877 | + /* 360 */ "foreach_clause ::=", |
| 149878 | + /* 361 */ "foreach_clause ::= FOR EACH ROW", |
| 149879 | + /* 362 */ "trnm ::= nm", |
| 149880 | + /* 363 */ "tridxby ::=", |
| 149881 | + /* 364 */ "database_kw_opt ::= DATABASE", |
| 149882 | + /* 365 */ "database_kw_opt ::=", |
| 149883 | + /* 366 */ "kwcolumn_opt ::=", |
| 149884 | + /* 367 */ "kwcolumn_opt ::= COLUMNKW", |
| 149885 | + /* 368 */ "vtabarglist ::= vtabarg", |
| 149886 | + /* 369 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 149887 | + /* 370 */ "vtabarg ::= vtabarg vtabargtoken", |
| 149888 | + /* 371 */ "anylist ::=", |
| 149889 | + /* 372 */ "anylist ::= anylist LP anylist RP", |
| 149890 | + /* 373 */ "anylist ::= anylist ANY", |
| 149891 | + /* 374 */ "with ::=", |
| 149261 | 149892 | }; |
| 149262 | 149893 | #endif /* NDEBUG */ |
| 149263 | 149894 | |
| 149264 | 149895 | |
| 149265 | 149896 | #if YYSTACKDEPTH<=0 |
| | @@ -149381,101 +150012,101 @@ |
| 149381 | 150012 | ** Note: during a reduce, the only symbols destroyed are those |
| 149382 | 150013 | ** which appear on the RHS of the rule, but which are *not* used |
| 149383 | 150014 | ** inside the C code. |
| 149384 | 150015 | */ |
| 149385 | 150016 | /********* Begin destructor definitions ***************************************/ |
| 149386 | | - case 174: /* select */ |
| 149387 | | - case 206: /* selectnowith */ |
| 149388 | | - case 207: /* oneselect */ |
| 149389 | | - case 219: /* values */ |
| 149390 | | -{ |
| 149391 | | -sqlite3SelectDelete(pParse->db, (yypminor->yy423)); |
| 149392 | | -} |
| 149393 | | - break; |
| 149394 | | - case 184: /* term */ |
| 149395 | | - case 185: /* expr */ |
| 149396 | | - case 213: /* where_opt */ |
| 149397 | | - case 215: /* having_opt */ |
| 149398 | | - case 227: /* on_opt */ |
| 149399 | | - case 242: /* case_operand */ |
| 149400 | | - case 244: /* case_else */ |
| 149401 | | - case 247: /* vinto */ |
| 149402 | | - case 254: /* when_clause */ |
| 149403 | | - case 259: /* key_opt */ |
| 149404 | | - case 273: /* filter_opt */ |
| 149405 | | -{ |
| 149406 | | -sqlite3ExprDelete(pParse->db, (yypminor->yy490)); |
| 149407 | | -} |
| 149408 | | - break; |
| 149409 | | - case 189: /* eidlist_opt */ |
| 149410 | | - case 198: /* sortlist */ |
| 149411 | | - case 199: /* eidlist */ |
| 149412 | | - case 211: /* selcollist */ |
| 149413 | | - case 214: /* groupby_opt */ |
| 149414 | | - case 216: /* orderby_opt */ |
| 149415 | | - case 220: /* nexprlist */ |
| 149416 | | - case 221: /* sclp */ |
| 149417 | | - case 229: /* exprlist */ |
| 149418 | | - case 233: /* setlist */ |
| 149419 | | - case 241: /* paren_exprlist */ |
| 149420 | | - case 243: /* case_exprlist */ |
| 149421 | | - case 272: /* part_opt */ |
| 149422 | | -{ |
| 149423 | | -sqlite3ExprListDelete(pParse->db, (yypminor->yy42)); |
| 149424 | | -} |
| 149425 | | - break; |
| 149426 | | - case 205: /* fullname */ |
| 149427 | | - case 212: /* from */ |
| 149428 | | - case 223: /* seltablist */ |
| 149429 | | - case 224: /* stl_prefix */ |
| 149430 | | - case 230: /* xfullname */ |
| 149431 | | -{ |
| 149432 | | -sqlite3SrcListDelete(pParse->db, (yypminor->yy167)); |
| 149433 | | -} |
| 149434 | | - break; |
| 149435 | | - case 208: /* wqlist */ |
| 149436 | | -{ |
| 149437 | | -sqlite3WithDelete(pParse->db, (yypminor->yy499)); |
| 149438 | | -} |
| 149439 | | - break; |
| 149440 | | - case 218: /* window_clause */ |
| 149441 | | - case 268: /* windowdefn_list */ |
| 149442 | | -{ |
| 149443 | | -sqlite3WindowListDelete(pParse->db, (yypminor->yy147)); |
| 149444 | | -} |
| 149445 | | - break; |
| 149446 | | - case 228: /* using_opt */ |
| 149447 | | - case 231: /* idlist */ |
| 149448 | | - case 235: /* idlist_opt */ |
| 149449 | | -{ |
| 149450 | | -sqlite3IdListDelete(pParse->db, (yypminor->yy336)); |
| 149451 | | -} |
| 149452 | | - break; |
| 149453 | | - case 237: /* over_clause */ |
| 149454 | | - case 269: /* windowdefn */ |
| 149455 | | - case 270: /* window */ |
| 149456 | | - case 271: /* frame_opt */ |
| 149457 | | -{ |
| 149458 | | -sqlite3WindowDelete(pParse->db, (yypminor->yy147)); |
| 149459 | | -} |
| 149460 | | - break; |
| 149461 | | - case 250: /* trigger_cmd_list */ |
| 149462 | | - case 255: /* trigger_cmd */ |
| 149463 | | -{ |
| 149464 | | -sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy119)); |
| 149465 | | -} |
| 149466 | | - break; |
| 149467 | | - case 252: /* trigger_event */ |
| 149468 | | -{ |
| 149469 | | -sqlite3IdListDelete(pParse->db, (yypminor->yy350).b); |
| 149470 | | -} |
| 149471 | | - break; |
| 149472 | | - case 275: /* frame_bound */ |
| 149473 | | - case 276: /* frame_bound_s */ |
| 149474 | | - case 277: /* frame_bound_e */ |
| 149475 | | -{ |
| 149476 | | -sqlite3ExprDelete(pParse->db, (yypminor->yy317).pExpr); |
| 150017 | + case 178: /* select */ |
| 150018 | + case 210: /* selectnowith */ |
| 150019 | + case 211: /* oneselect */ |
| 150020 | + case 223: /* values */ |
| 150021 | +{ |
| 150022 | +sqlite3SelectDelete(pParse->db, (yypminor->yy491)); |
| 150023 | +} |
| 150024 | + break; |
| 150025 | + case 188: /* term */ |
| 150026 | + case 189: /* expr */ |
| 150027 | + case 217: /* where_opt */ |
| 150028 | + case 219: /* having_opt */ |
| 150029 | + case 231: /* on_opt */ |
| 150030 | + case 246: /* case_operand */ |
| 150031 | + case 248: /* case_else */ |
| 150032 | + case 251: /* vinto */ |
| 150033 | + case 258: /* when_clause */ |
| 150034 | + case 263: /* key_opt */ |
| 150035 | + case 277: /* filter_opt */ |
| 150036 | +{ |
| 150037 | +sqlite3ExprDelete(pParse->db, (yypminor->yy130)); |
| 150038 | +} |
| 150039 | + break; |
| 150040 | + case 193: /* eidlist_opt */ |
| 150041 | + case 202: /* sortlist */ |
| 150042 | + case 203: /* eidlist */ |
| 150043 | + case 215: /* selcollist */ |
| 150044 | + case 218: /* groupby_opt */ |
| 150045 | + case 220: /* orderby_opt */ |
| 150046 | + case 224: /* nexprlist */ |
| 150047 | + case 225: /* sclp */ |
| 150048 | + case 233: /* exprlist */ |
| 150049 | + case 237: /* setlist */ |
| 150050 | + case 245: /* paren_exprlist */ |
| 150051 | + case 247: /* case_exprlist */ |
| 150052 | + case 276: /* part_opt */ |
| 150053 | +{ |
| 150054 | +sqlite3ExprListDelete(pParse->db, (yypminor->yy442)); |
| 150055 | +} |
| 150056 | + break; |
| 150057 | + case 209: /* fullname */ |
| 150058 | + case 216: /* from */ |
| 150059 | + case 227: /* seltablist */ |
| 150060 | + case 228: /* stl_prefix */ |
| 150061 | + case 234: /* xfullname */ |
| 150062 | +{ |
| 150063 | +sqlite3SrcListDelete(pParse->db, (yypminor->yy147)); |
| 150064 | +} |
| 150065 | + break; |
| 150066 | + case 212: /* wqlist */ |
| 150067 | +{ |
| 150068 | +sqlite3WithDelete(pParse->db, (yypminor->yy523)); |
| 150069 | +} |
| 150070 | + break; |
| 150071 | + case 222: /* window_clause */ |
| 150072 | + case 272: /* windowdefn_list */ |
| 150073 | +{ |
| 150074 | +sqlite3WindowListDelete(pParse->db, (yypminor->yy395)); |
| 150075 | +} |
| 150076 | + break; |
| 150077 | + case 232: /* using_opt */ |
| 150078 | + case 235: /* idlist */ |
| 150079 | + case 239: /* idlist_opt */ |
| 150080 | +{ |
| 150081 | +sqlite3IdListDelete(pParse->db, (yypminor->yy200)); |
| 150082 | +} |
| 150083 | + break; |
| 150084 | + case 241: /* over_clause */ |
| 150085 | + case 273: /* windowdefn */ |
| 150086 | + case 274: /* window */ |
| 150087 | + case 275: /* frame_opt */ |
| 150088 | +{ |
| 150089 | +sqlite3WindowDelete(pParse->db, (yypminor->yy395)); |
| 150090 | +} |
| 150091 | + break; |
| 150092 | + case 254: /* trigger_cmd_list */ |
| 150093 | + case 259: /* trigger_cmd */ |
| 150094 | +{ |
| 150095 | +sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy524)); |
| 150096 | +} |
| 150097 | + break; |
| 150098 | + case 256: /* trigger_event */ |
| 150099 | +{ |
| 150100 | +sqlite3IdListDelete(pParse->db, (yypminor->yy498).b); |
| 150101 | +} |
| 150102 | + break; |
| 150103 | + case 279: /* frame_bound */ |
| 150104 | + case 280: /* frame_bound_s */ |
| 150105 | + case 281: /* frame_bound_e */ |
| 150106 | +{ |
| 150107 | +sqlite3ExprDelete(pParse->db, (yypminor->yy273).pExpr); |
| 149477 | 150108 | } |
| 149478 | 150109 | break; |
| 149479 | 150110 | /********* End destructor definitions *****************************************/ |
| 149480 | 150111 | default: break; /* If no destructor action specified: do nothing */ |
| 149481 | 150112 | } |
| | @@ -149766,379 +150397,385 @@ |
| 149766 | 150397 | } |
| 149767 | 150398 | |
| 149768 | 150399 | /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side |
| 149769 | 150400 | ** of that rule */ |
| 149770 | 150401 | static const YYCODETYPE yyRuleInfoLhs[] = { |
| 149771 | | - 159, /* (0) explain ::= EXPLAIN */ |
| 149772 | | - 159, /* (1) explain ::= EXPLAIN QUERY PLAN */ |
| 149773 | | - 158, /* (2) cmdx ::= cmd */ |
| 149774 | | - 160, /* (3) cmd ::= BEGIN transtype trans_opt */ |
| 149775 | | - 161, /* (4) transtype ::= */ |
| 149776 | | - 161, /* (5) transtype ::= DEFERRED */ |
| 149777 | | - 161, /* (6) transtype ::= IMMEDIATE */ |
| 149778 | | - 161, /* (7) transtype ::= EXCLUSIVE */ |
| 149779 | | - 160, /* (8) cmd ::= COMMIT|END trans_opt */ |
| 149780 | | - 160, /* (9) cmd ::= ROLLBACK trans_opt */ |
| 149781 | | - 160, /* (10) cmd ::= SAVEPOINT nm */ |
| 149782 | | - 160, /* (11) cmd ::= RELEASE savepoint_opt nm */ |
| 149783 | | - 160, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ |
| 149784 | | - 165, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */ |
| 149785 | | - 167, /* (14) createkw ::= CREATE */ |
| 149786 | | - 169, /* (15) ifnotexists ::= */ |
| 149787 | | - 169, /* (16) ifnotexists ::= IF NOT EXISTS */ |
| 149788 | | - 168, /* (17) temp ::= TEMP */ |
| 149789 | | - 168, /* (18) temp ::= */ |
| 149790 | | - 166, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_options */ |
| 149791 | | - 166, /* (20) create_table_args ::= AS select */ |
| 149792 | | - 173, /* (21) table_options ::= */ |
| 149793 | | - 173, /* (22) table_options ::= WITHOUT nm */ |
| 149794 | | - 175, /* (23) columnname ::= nm typetoken */ |
| 149795 | | - 177, /* (24) typetoken ::= */ |
| 149796 | | - 177, /* (25) typetoken ::= typename LP signed RP */ |
| 149797 | | - 177, /* (26) typetoken ::= typename LP signed COMMA signed RP */ |
| 149798 | | - 178, /* (27) typename ::= typename ID|STRING */ |
| 149799 | | - 182, /* (28) scanpt ::= */ |
| 149800 | | - 183, /* (29) ccons ::= CONSTRAINT nm */ |
| 149801 | | - 183, /* (30) ccons ::= DEFAULT scanpt term scanpt */ |
| 149802 | | - 183, /* (31) ccons ::= DEFAULT LP expr RP */ |
| 149803 | | - 183, /* (32) ccons ::= DEFAULT PLUS term scanpt */ |
| 149804 | | - 183, /* (33) ccons ::= DEFAULT MINUS term scanpt */ |
| 149805 | | - 183, /* (34) ccons ::= DEFAULT scanpt ID|INDEXED */ |
| 149806 | | - 183, /* (35) ccons ::= NOT NULL onconf */ |
| 149807 | | - 183, /* (36) ccons ::= PRIMARY KEY sortorder onconf autoinc */ |
| 149808 | | - 183, /* (37) ccons ::= UNIQUE onconf */ |
| 149809 | | - 183, /* (38) ccons ::= CHECK LP expr RP */ |
| 149810 | | - 183, /* (39) ccons ::= REFERENCES nm eidlist_opt refargs */ |
| 149811 | | - 183, /* (40) ccons ::= defer_subclause */ |
| 149812 | | - 183, /* (41) ccons ::= COLLATE ID|STRING */ |
| 149813 | | - 188, /* (42) autoinc ::= */ |
| 149814 | | - 188, /* (43) autoinc ::= AUTOINCR */ |
| 149815 | | - 190, /* (44) refargs ::= */ |
| 149816 | | - 190, /* (45) refargs ::= refargs refarg */ |
| 149817 | | - 192, /* (46) refarg ::= MATCH nm */ |
| 149818 | | - 192, /* (47) refarg ::= ON INSERT refact */ |
| 149819 | | - 192, /* (48) refarg ::= ON DELETE refact */ |
| 149820 | | - 192, /* (49) refarg ::= ON UPDATE refact */ |
| 149821 | | - 193, /* (50) refact ::= SET NULL */ |
| 149822 | | - 193, /* (51) refact ::= SET DEFAULT */ |
| 149823 | | - 193, /* (52) refact ::= CASCADE */ |
| 149824 | | - 193, /* (53) refact ::= RESTRICT */ |
| 149825 | | - 193, /* (54) refact ::= NO ACTION */ |
| 149826 | | - 191, /* (55) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ |
| 149827 | | - 191, /* (56) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ |
| 149828 | | - 194, /* (57) init_deferred_pred_opt ::= */ |
| 149829 | | - 194, /* (58) init_deferred_pred_opt ::= INITIALLY DEFERRED */ |
| 149830 | | - 194, /* (59) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ |
| 149831 | | - 172, /* (60) conslist_opt ::= */ |
| 149832 | | - 196, /* (61) tconscomma ::= COMMA */ |
| 149833 | | - 197, /* (62) tcons ::= CONSTRAINT nm */ |
| 149834 | | - 197, /* (63) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ |
| 149835 | | - 197, /* (64) tcons ::= UNIQUE LP sortlist RP onconf */ |
| 149836 | | - 197, /* (65) tcons ::= CHECK LP expr RP onconf */ |
| 149837 | | - 197, /* (66) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ |
| 149838 | | - 200, /* (67) defer_subclause_opt ::= */ |
| 149839 | | - 186, /* (68) onconf ::= */ |
| 149840 | | - 186, /* (69) onconf ::= ON CONFLICT resolvetype */ |
| 149841 | | - 201, /* (70) orconf ::= */ |
| 149842 | | - 201, /* (71) orconf ::= OR resolvetype */ |
| 149843 | | - 202, /* (72) resolvetype ::= IGNORE */ |
| 149844 | | - 202, /* (73) resolvetype ::= REPLACE */ |
| 149845 | | - 160, /* (74) cmd ::= DROP TABLE ifexists fullname */ |
| 149846 | | - 204, /* (75) ifexists ::= IF EXISTS */ |
| 149847 | | - 204, /* (76) ifexists ::= */ |
| 149848 | | - 160, /* (77) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ |
| 149849 | | - 160, /* (78) cmd ::= DROP VIEW ifexists fullname */ |
| 149850 | | - 160, /* (79) cmd ::= select */ |
| 149851 | | - 174, /* (80) select ::= WITH wqlist selectnowith */ |
| 149852 | | - 174, /* (81) select ::= WITH RECURSIVE wqlist selectnowith */ |
| 149853 | | - 174, /* (82) select ::= selectnowith */ |
| 149854 | | - 206, /* (83) selectnowith ::= selectnowith multiselect_op oneselect */ |
| 149855 | | - 209, /* (84) multiselect_op ::= UNION */ |
| 149856 | | - 209, /* (85) multiselect_op ::= UNION ALL */ |
| 149857 | | - 209, /* (86) multiselect_op ::= EXCEPT|INTERSECT */ |
| 149858 | | - 207, /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ |
| 149859 | | - 207, /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ |
| 149860 | | - 219, /* (89) values ::= VALUES LP nexprlist RP */ |
| 149861 | | - 219, /* (90) values ::= values COMMA LP nexprlist RP */ |
| 149862 | | - 210, /* (91) distinct ::= DISTINCT */ |
| 149863 | | - 210, /* (92) distinct ::= ALL */ |
| 149864 | | - 210, /* (93) distinct ::= */ |
| 149865 | | - 221, /* (94) sclp ::= */ |
| 149866 | | - 211, /* (95) selcollist ::= sclp scanpt expr scanpt as */ |
| 149867 | | - 211, /* (96) selcollist ::= sclp scanpt STAR */ |
| 149868 | | - 211, /* (97) selcollist ::= sclp scanpt nm DOT STAR */ |
| 149869 | | - 222, /* (98) as ::= AS nm */ |
| 149870 | | - 222, /* (99) as ::= */ |
| 149871 | | - 212, /* (100) from ::= */ |
| 149872 | | - 212, /* (101) from ::= FROM seltablist */ |
| 149873 | | - 224, /* (102) stl_prefix ::= seltablist joinop */ |
| 149874 | | - 224, /* (103) stl_prefix ::= */ |
| 149875 | | - 223, /* (104) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ |
| 149876 | | - 223, /* (105) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ |
| 149877 | | - 223, /* (106) seltablist ::= stl_prefix LP select RP as on_opt using_opt */ |
| 149878 | | - 223, /* (107) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ |
| 149879 | | - 170, /* (108) dbnm ::= */ |
| 149880 | | - 170, /* (109) dbnm ::= DOT nm */ |
| 149881 | | - 205, /* (110) fullname ::= nm */ |
| 149882 | | - 205, /* (111) fullname ::= nm DOT nm */ |
| 149883 | | - 230, /* (112) xfullname ::= nm */ |
| 149884 | | - 230, /* (113) xfullname ::= nm DOT nm */ |
| 149885 | | - 230, /* (114) xfullname ::= nm DOT nm AS nm */ |
| 149886 | | - 230, /* (115) xfullname ::= nm AS nm */ |
| 149887 | | - 225, /* (116) joinop ::= COMMA|JOIN */ |
| 149888 | | - 225, /* (117) joinop ::= JOIN_KW JOIN */ |
| 149889 | | - 225, /* (118) joinop ::= JOIN_KW nm JOIN */ |
| 149890 | | - 225, /* (119) joinop ::= JOIN_KW nm nm JOIN */ |
| 149891 | | - 227, /* (120) on_opt ::= ON expr */ |
| 149892 | | - 227, /* (121) on_opt ::= */ |
| 149893 | | - 226, /* (122) indexed_opt ::= */ |
| 149894 | | - 226, /* (123) indexed_opt ::= INDEXED BY nm */ |
| 149895 | | - 226, /* (124) indexed_opt ::= NOT INDEXED */ |
| 149896 | | - 228, /* (125) using_opt ::= USING LP idlist RP */ |
| 149897 | | - 228, /* (126) using_opt ::= */ |
| 149898 | | - 216, /* (127) orderby_opt ::= */ |
| 149899 | | - 216, /* (128) orderby_opt ::= ORDER BY sortlist */ |
| 149900 | | - 198, /* (129) sortlist ::= sortlist COMMA expr sortorder */ |
| 149901 | | - 198, /* (130) sortlist ::= expr sortorder */ |
| 149902 | | - 187, /* (131) sortorder ::= ASC */ |
| 149903 | | - 187, /* (132) sortorder ::= DESC */ |
| 149904 | | - 187, /* (133) sortorder ::= */ |
| 149905 | | - 214, /* (134) groupby_opt ::= */ |
| 149906 | | - 214, /* (135) groupby_opt ::= GROUP BY nexprlist */ |
| 149907 | | - 215, /* (136) having_opt ::= */ |
| 149908 | | - 215, /* (137) having_opt ::= HAVING expr */ |
| 149909 | | - 217, /* (138) limit_opt ::= */ |
| 149910 | | - 217, /* (139) limit_opt ::= LIMIT expr */ |
| 149911 | | - 217, /* (140) limit_opt ::= LIMIT expr OFFSET expr */ |
| 149912 | | - 217, /* (141) limit_opt ::= LIMIT expr COMMA expr */ |
| 149913 | | - 160, /* (142) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */ |
| 149914 | | - 213, /* (143) where_opt ::= */ |
| 149915 | | - 213, /* (144) where_opt ::= WHERE expr */ |
| 149916 | | - 160, /* (145) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */ |
| 149917 | | - 233, /* (146) setlist ::= setlist COMMA nm EQ expr */ |
| 149918 | | - 233, /* (147) setlist ::= setlist COMMA LP idlist RP EQ expr */ |
| 149919 | | - 233, /* (148) setlist ::= nm EQ expr */ |
| 149920 | | - 233, /* (149) setlist ::= LP idlist RP EQ expr */ |
| 149921 | | - 160, /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ |
| 149922 | | - 160, /* (151) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */ |
| 149923 | | - 236, /* (152) upsert ::= */ |
| 149924 | | - 236, /* (153) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */ |
| 149925 | | - 236, /* (154) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */ |
| 149926 | | - 236, /* (155) upsert ::= ON CONFLICT DO NOTHING */ |
| 149927 | | - 234, /* (156) insert_cmd ::= INSERT orconf */ |
| 149928 | | - 234, /* (157) insert_cmd ::= REPLACE */ |
| 149929 | | - 235, /* (158) idlist_opt ::= */ |
| 149930 | | - 235, /* (159) idlist_opt ::= LP idlist RP */ |
| 149931 | | - 231, /* (160) idlist ::= idlist COMMA nm */ |
| 149932 | | - 231, /* (161) idlist ::= nm */ |
| 149933 | | - 185, /* (162) expr ::= LP expr RP */ |
| 149934 | | - 185, /* (163) expr ::= ID|INDEXED */ |
| 149935 | | - 185, /* (164) expr ::= JOIN_KW */ |
| 149936 | | - 185, /* (165) expr ::= nm DOT nm */ |
| 149937 | | - 185, /* (166) expr ::= nm DOT nm DOT nm */ |
| 149938 | | - 184, /* (167) term ::= NULL|FLOAT|BLOB */ |
| 149939 | | - 184, /* (168) term ::= STRING */ |
| 149940 | | - 184, /* (169) term ::= INTEGER */ |
| 149941 | | - 185, /* (170) expr ::= VARIABLE */ |
| 149942 | | - 185, /* (171) expr ::= expr COLLATE ID|STRING */ |
| 149943 | | - 185, /* (172) expr ::= CAST LP expr AS typetoken RP */ |
| 149944 | | - 185, /* (173) expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 149945 | | - 185, /* (174) expr ::= ID|INDEXED LP STAR RP */ |
| 149946 | | - 185, /* (175) expr ::= ID|INDEXED LP distinct exprlist RP over_clause */ |
| 149947 | | - 185, /* (176) expr ::= ID|INDEXED LP STAR RP over_clause */ |
| 149948 | | - 184, /* (177) term ::= CTIME_KW */ |
| 149949 | | - 185, /* (178) expr ::= LP nexprlist COMMA expr RP */ |
| 149950 | | - 185, /* (179) expr ::= expr AND expr */ |
| 149951 | | - 185, /* (180) expr ::= expr OR expr */ |
| 149952 | | - 185, /* (181) expr ::= expr LT|GT|GE|LE expr */ |
| 149953 | | - 185, /* (182) expr ::= expr EQ|NE expr */ |
| 149954 | | - 185, /* (183) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ |
| 149955 | | - 185, /* (184) expr ::= expr PLUS|MINUS expr */ |
| 149956 | | - 185, /* (185) expr ::= expr STAR|SLASH|REM expr */ |
| 149957 | | - 185, /* (186) expr ::= expr CONCAT expr */ |
| 149958 | | - 238, /* (187) likeop ::= NOT LIKE_KW|MATCH */ |
| 149959 | | - 185, /* (188) expr ::= expr likeop expr */ |
| 149960 | | - 185, /* (189) expr ::= expr likeop expr ESCAPE expr */ |
| 149961 | | - 185, /* (190) expr ::= expr ISNULL|NOTNULL */ |
| 149962 | | - 185, /* (191) expr ::= expr NOT NULL */ |
| 149963 | | - 185, /* (192) expr ::= expr IS expr */ |
| 149964 | | - 185, /* (193) expr ::= expr IS NOT expr */ |
| 149965 | | - 185, /* (194) expr ::= NOT expr */ |
| 149966 | | - 185, /* (195) expr ::= BITNOT expr */ |
| 149967 | | - 185, /* (196) expr ::= PLUS|MINUS expr */ |
| 149968 | | - 239, /* (197) between_op ::= BETWEEN */ |
| 149969 | | - 239, /* (198) between_op ::= NOT BETWEEN */ |
| 149970 | | - 185, /* (199) expr ::= expr between_op expr AND expr */ |
| 149971 | | - 240, /* (200) in_op ::= IN */ |
| 149972 | | - 240, /* (201) in_op ::= NOT IN */ |
| 149973 | | - 185, /* (202) expr ::= expr in_op LP exprlist RP */ |
| 149974 | | - 185, /* (203) expr ::= LP select RP */ |
| 149975 | | - 185, /* (204) expr ::= expr in_op LP select RP */ |
| 149976 | | - 185, /* (205) expr ::= expr in_op nm dbnm paren_exprlist */ |
| 149977 | | - 185, /* (206) expr ::= EXISTS LP select RP */ |
| 149978 | | - 185, /* (207) expr ::= CASE case_operand case_exprlist case_else END */ |
| 149979 | | - 243, /* (208) case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 149980 | | - 243, /* (209) case_exprlist ::= WHEN expr THEN expr */ |
| 149981 | | - 244, /* (210) case_else ::= ELSE expr */ |
| 149982 | | - 244, /* (211) case_else ::= */ |
| 149983 | | - 242, /* (212) case_operand ::= expr */ |
| 149984 | | - 242, /* (213) case_operand ::= */ |
| 149985 | | - 229, /* (214) exprlist ::= */ |
| 149986 | | - 220, /* (215) nexprlist ::= nexprlist COMMA expr */ |
| 149987 | | - 220, /* (216) nexprlist ::= expr */ |
| 149988 | | - 241, /* (217) paren_exprlist ::= */ |
| 149989 | | - 241, /* (218) paren_exprlist ::= LP exprlist RP */ |
| 149990 | | - 160, /* (219) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 149991 | | - 245, /* (220) uniqueflag ::= UNIQUE */ |
| 149992 | | - 245, /* (221) uniqueflag ::= */ |
| 149993 | | - 189, /* (222) eidlist_opt ::= */ |
| 149994 | | - 189, /* (223) eidlist_opt ::= LP eidlist RP */ |
| 149995 | | - 199, /* (224) eidlist ::= eidlist COMMA nm collate sortorder */ |
| 149996 | | - 199, /* (225) eidlist ::= nm collate sortorder */ |
| 149997 | | - 246, /* (226) collate ::= */ |
| 149998 | | - 246, /* (227) collate ::= COLLATE ID|STRING */ |
| 149999 | | - 160, /* (228) cmd ::= DROP INDEX ifexists fullname */ |
| 150000 | | - 160, /* (229) cmd ::= VACUUM vinto */ |
| 150001 | | - 160, /* (230) cmd ::= VACUUM nm vinto */ |
| 150002 | | - 247, /* (231) vinto ::= INTO expr */ |
| 150003 | | - 247, /* (232) vinto ::= */ |
| 150004 | | - 160, /* (233) cmd ::= PRAGMA nm dbnm */ |
| 150005 | | - 160, /* (234) cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 150006 | | - 160, /* (235) cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 150007 | | - 160, /* (236) cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 150008 | | - 160, /* (237) cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 150009 | | - 180, /* (238) plus_num ::= PLUS INTEGER|FLOAT */ |
| 150010 | | - 181, /* (239) minus_num ::= MINUS INTEGER|FLOAT */ |
| 150011 | | - 160, /* (240) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 150012 | | - 249, /* (241) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 150013 | | - 251, /* (242) trigger_time ::= BEFORE|AFTER */ |
| 150014 | | - 251, /* (243) trigger_time ::= INSTEAD OF */ |
| 150015 | | - 251, /* (244) trigger_time ::= */ |
| 150016 | | - 252, /* (245) trigger_event ::= DELETE|INSERT */ |
| 150017 | | - 252, /* (246) trigger_event ::= UPDATE */ |
| 150018 | | - 252, /* (247) trigger_event ::= UPDATE OF idlist */ |
| 150019 | | - 254, /* (248) when_clause ::= */ |
| 150020 | | - 254, /* (249) when_clause ::= WHEN expr */ |
| 150021 | | - 250, /* (250) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 150022 | | - 250, /* (251) trigger_cmd_list ::= trigger_cmd SEMI */ |
| 150023 | | - 256, /* (252) trnm ::= nm DOT nm */ |
| 150024 | | - 257, /* (253) tridxby ::= INDEXED BY nm */ |
| 150025 | | - 257, /* (254) tridxby ::= NOT INDEXED */ |
| 150026 | | - 255, /* (255) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ |
| 150027 | | - 255, /* (256) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 150028 | | - 255, /* (257) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 150029 | | - 255, /* (258) trigger_cmd ::= scanpt select scanpt */ |
| 150030 | | - 185, /* (259) expr ::= RAISE LP IGNORE RP */ |
| 150031 | | - 185, /* (260) expr ::= RAISE LP raisetype COMMA nm RP */ |
| 150032 | | - 203, /* (261) raisetype ::= ROLLBACK */ |
| 150033 | | - 203, /* (262) raisetype ::= ABORT */ |
| 150034 | | - 203, /* (263) raisetype ::= FAIL */ |
| 150035 | | - 160, /* (264) cmd ::= DROP TRIGGER ifexists fullname */ |
| 150036 | | - 160, /* (265) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 150037 | | - 160, /* (266) cmd ::= DETACH database_kw_opt expr */ |
| 150038 | | - 259, /* (267) key_opt ::= */ |
| 150039 | | - 259, /* (268) key_opt ::= KEY expr */ |
| 150040 | | - 160, /* (269) cmd ::= REINDEX */ |
| 150041 | | - 160, /* (270) cmd ::= REINDEX nm dbnm */ |
| 150042 | | - 160, /* (271) cmd ::= ANALYZE */ |
| 150043 | | - 160, /* (272) cmd ::= ANALYZE nm dbnm */ |
| 150044 | | - 160, /* (273) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 150045 | | - 160, /* (274) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 150046 | | - 260, /* (275) add_column_fullname ::= fullname */ |
| 150047 | | - 160, /* (276) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 150048 | | - 160, /* (277) cmd ::= create_vtab */ |
| 150049 | | - 160, /* (278) cmd ::= create_vtab LP vtabarglist RP */ |
| 150050 | | - 262, /* (279) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 150051 | | - 264, /* (280) vtabarg ::= */ |
| 150052 | | - 265, /* (281) vtabargtoken ::= ANY */ |
| 150053 | | - 265, /* (282) vtabargtoken ::= lp anylist RP */ |
| 150054 | | - 266, /* (283) lp ::= LP */ |
| 150055 | | - 232, /* (284) with ::= WITH wqlist */ |
| 150056 | | - 232, /* (285) with ::= WITH RECURSIVE wqlist */ |
| 150057 | | - 208, /* (286) wqlist ::= nm eidlist_opt AS LP select RP */ |
| 150058 | | - 208, /* (287) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 150059 | | - 268, /* (288) windowdefn_list ::= windowdefn */ |
| 150060 | | - 268, /* (289) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 150061 | | - 269, /* (290) windowdefn ::= nm AS window */ |
| 150062 | | - 270, /* (291) window ::= LP part_opt orderby_opt frame_opt RP */ |
| 150063 | | - 272, /* (292) part_opt ::= PARTITION BY nexprlist */ |
| 150064 | | - 272, /* (293) part_opt ::= */ |
| 150065 | | - 271, /* (294) frame_opt ::= */ |
| 150066 | | - 271, /* (295) frame_opt ::= range_or_rows frame_bound_s */ |
| 150067 | | - 271, /* (296) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */ |
| 150068 | | - 274, /* (297) range_or_rows ::= RANGE */ |
| 150069 | | - 274, /* (298) range_or_rows ::= ROWS */ |
| 150070 | | - 276, /* (299) frame_bound_s ::= frame_bound */ |
| 150071 | | - 276, /* (300) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 150072 | | - 277, /* (301) frame_bound_e ::= frame_bound */ |
| 150073 | | - 277, /* (302) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 150074 | | - 275, /* (303) frame_bound ::= expr PRECEDING */ |
| 150075 | | - 275, /* (304) frame_bound ::= CURRENT ROW */ |
| 150076 | | - 275, /* (305) frame_bound ::= expr FOLLOWING */ |
| 150077 | | - 218, /* (306) window_clause ::= WINDOW windowdefn_list */ |
| 150078 | | - 237, /* (307) over_clause ::= filter_opt OVER window */ |
| 150079 | | - 237, /* (308) over_clause ::= filter_opt OVER nm */ |
| 150080 | | - 273, /* (309) filter_opt ::= */ |
| 150081 | | - 273, /* (310) filter_opt ::= FILTER LP WHERE expr RP */ |
| 150082 | | - 155, /* (311) input ::= cmdlist */ |
| 150083 | | - 156, /* (312) cmdlist ::= cmdlist ecmd */ |
| 150084 | | - 156, /* (313) cmdlist ::= ecmd */ |
| 150085 | | - 157, /* (314) ecmd ::= SEMI */ |
| 150086 | | - 157, /* (315) ecmd ::= cmdx SEMI */ |
| 150087 | | - 157, /* (316) ecmd ::= explain cmdx */ |
| 150088 | | - 162, /* (317) trans_opt ::= */ |
| 150089 | | - 162, /* (318) trans_opt ::= TRANSACTION */ |
| 150090 | | - 162, /* (319) trans_opt ::= TRANSACTION nm */ |
| 150091 | | - 164, /* (320) savepoint_opt ::= SAVEPOINT */ |
| 150092 | | - 164, /* (321) savepoint_opt ::= */ |
| 150093 | | - 160, /* (322) cmd ::= create_table create_table_args */ |
| 150094 | | - 171, /* (323) columnlist ::= columnlist COMMA columnname carglist */ |
| 150095 | | - 171, /* (324) columnlist ::= columnname carglist */ |
| 150096 | | - 163, /* (325) nm ::= ID|INDEXED */ |
| 150097 | | - 163, /* (326) nm ::= STRING */ |
| 150098 | | - 163, /* (327) nm ::= JOIN_KW */ |
| 150099 | | - 177, /* (328) typetoken ::= typename */ |
| 150100 | | - 178, /* (329) typename ::= ID|STRING */ |
| 150101 | | - 179, /* (330) signed ::= plus_num */ |
| 150102 | | - 179, /* (331) signed ::= minus_num */ |
| 150103 | | - 176, /* (332) carglist ::= carglist ccons */ |
| 150104 | | - 176, /* (333) carglist ::= */ |
| 150105 | | - 183, /* (334) ccons ::= NULL onconf */ |
| 150106 | | - 172, /* (335) conslist_opt ::= COMMA conslist */ |
| 150107 | | - 195, /* (336) conslist ::= conslist tconscomma tcons */ |
| 150108 | | - 195, /* (337) conslist ::= tcons */ |
| 150109 | | - 196, /* (338) tconscomma ::= */ |
| 150110 | | - 200, /* (339) defer_subclause_opt ::= defer_subclause */ |
| 150111 | | - 202, /* (340) resolvetype ::= raisetype */ |
| 150112 | | - 206, /* (341) selectnowith ::= oneselect */ |
| 150113 | | - 207, /* (342) oneselect ::= values */ |
| 150114 | | - 221, /* (343) sclp ::= selcollist COMMA */ |
| 150115 | | - 222, /* (344) as ::= ID|STRING */ |
| 150116 | | - 185, /* (345) expr ::= term */ |
| 150117 | | - 238, /* (346) likeop ::= LIKE_KW|MATCH */ |
| 150118 | | - 229, /* (347) exprlist ::= nexprlist */ |
| 150119 | | - 248, /* (348) nmnum ::= plus_num */ |
| 150120 | | - 248, /* (349) nmnum ::= nm */ |
| 150121 | | - 248, /* (350) nmnum ::= ON */ |
| 150122 | | - 248, /* (351) nmnum ::= DELETE */ |
| 150123 | | - 248, /* (352) nmnum ::= DEFAULT */ |
| 150124 | | - 180, /* (353) plus_num ::= INTEGER|FLOAT */ |
| 150125 | | - 253, /* (354) foreach_clause ::= */ |
| 150126 | | - 253, /* (355) foreach_clause ::= FOR EACH ROW */ |
| 150127 | | - 256, /* (356) trnm ::= nm */ |
| 150128 | | - 257, /* (357) tridxby ::= */ |
| 150129 | | - 258, /* (358) database_kw_opt ::= DATABASE */ |
| 150130 | | - 258, /* (359) database_kw_opt ::= */ |
| 150131 | | - 261, /* (360) kwcolumn_opt ::= */ |
| 150132 | | - 261, /* (361) kwcolumn_opt ::= COLUMNKW */ |
| 150133 | | - 263, /* (362) vtabarglist ::= vtabarg */ |
| 150134 | | - 263, /* (363) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 150135 | | - 264, /* (364) vtabarg ::= vtabarg vtabargtoken */ |
| 150136 | | - 267, /* (365) anylist ::= */ |
| 150137 | | - 267, /* (366) anylist ::= anylist LP anylist RP */ |
| 150138 | | - 267, /* (367) anylist ::= anylist ANY */ |
| 150139 | | - 232, /* (368) with ::= */ |
| 150402 | + 163, /* (0) explain ::= EXPLAIN */ |
| 150403 | + 163, /* (1) explain ::= EXPLAIN QUERY PLAN */ |
| 150404 | + 162, /* (2) cmdx ::= cmd */ |
| 150405 | + 164, /* (3) cmd ::= BEGIN transtype trans_opt */ |
| 150406 | + 165, /* (4) transtype ::= */ |
| 150407 | + 165, /* (5) transtype ::= DEFERRED */ |
| 150408 | + 165, /* (6) transtype ::= IMMEDIATE */ |
| 150409 | + 165, /* (7) transtype ::= EXCLUSIVE */ |
| 150410 | + 164, /* (8) cmd ::= COMMIT|END trans_opt */ |
| 150411 | + 164, /* (9) cmd ::= ROLLBACK trans_opt */ |
| 150412 | + 164, /* (10) cmd ::= SAVEPOINT nm */ |
| 150413 | + 164, /* (11) cmd ::= RELEASE savepoint_opt nm */ |
| 150414 | + 164, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ |
| 150415 | + 169, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */ |
| 150416 | + 171, /* (14) createkw ::= CREATE */ |
| 150417 | + 173, /* (15) ifnotexists ::= */ |
| 150418 | + 173, /* (16) ifnotexists ::= IF NOT EXISTS */ |
| 150419 | + 172, /* (17) temp ::= TEMP */ |
| 150420 | + 172, /* (18) temp ::= */ |
| 150421 | + 170, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_options */ |
| 150422 | + 170, /* (20) create_table_args ::= AS select */ |
| 150423 | + 177, /* (21) table_options ::= */ |
| 150424 | + 177, /* (22) table_options ::= WITHOUT nm */ |
| 150425 | + 179, /* (23) columnname ::= nm typetoken */ |
| 150426 | + 181, /* (24) typetoken ::= */ |
| 150427 | + 181, /* (25) typetoken ::= typename LP signed RP */ |
| 150428 | + 181, /* (26) typetoken ::= typename LP signed COMMA signed RP */ |
| 150429 | + 182, /* (27) typename ::= typename ID|STRING */ |
| 150430 | + 186, /* (28) scanpt ::= */ |
| 150431 | + 187, /* (29) ccons ::= CONSTRAINT nm */ |
| 150432 | + 187, /* (30) ccons ::= DEFAULT scanpt term scanpt */ |
| 150433 | + 187, /* (31) ccons ::= DEFAULT LP expr RP */ |
| 150434 | + 187, /* (32) ccons ::= DEFAULT PLUS term scanpt */ |
| 150435 | + 187, /* (33) ccons ::= DEFAULT MINUS term scanpt */ |
| 150436 | + 187, /* (34) ccons ::= DEFAULT scanpt ID|INDEXED */ |
| 150437 | + 187, /* (35) ccons ::= NOT NULL onconf */ |
| 150438 | + 187, /* (36) ccons ::= PRIMARY KEY sortorder onconf autoinc */ |
| 150439 | + 187, /* (37) ccons ::= UNIQUE onconf */ |
| 150440 | + 187, /* (38) ccons ::= CHECK LP expr RP */ |
| 150441 | + 187, /* (39) ccons ::= REFERENCES nm eidlist_opt refargs */ |
| 150442 | + 187, /* (40) ccons ::= defer_subclause */ |
| 150443 | + 187, /* (41) ccons ::= COLLATE ID|STRING */ |
| 150444 | + 192, /* (42) autoinc ::= */ |
| 150445 | + 192, /* (43) autoinc ::= AUTOINCR */ |
| 150446 | + 194, /* (44) refargs ::= */ |
| 150447 | + 194, /* (45) refargs ::= refargs refarg */ |
| 150448 | + 196, /* (46) refarg ::= MATCH nm */ |
| 150449 | + 196, /* (47) refarg ::= ON INSERT refact */ |
| 150450 | + 196, /* (48) refarg ::= ON DELETE refact */ |
| 150451 | + 196, /* (49) refarg ::= ON UPDATE refact */ |
| 150452 | + 197, /* (50) refact ::= SET NULL */ |
| 150453 | + 197, /* (51) refact ::= SET DEFAULT */ |
| 150454 | + 197, /* (52) refact ::= CASCADE */ |
| 150455 | + 197, /* (53) refact ::= RESTRICT */ |
| 150456 | + 197, /* (54) refact ::= NO ACTION */ |
| 150457 | + 195, /* (55) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ |
| 150458 | + 195, /* (56) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ |
| 150459 | + 198, /* (57) init_deferred_pred_opt ::= */ |
| 150460 | + 198, /* (58) init_deferred_pred_opt ::= INITIALLY DEFERRED */ |
| 150461 | + 198, /* (59) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ |
| 150462 | + 176, /* (60) conslist_opt ::= */ |
| 150463 | + 200, /* (61) tconscomma ::= COMMA */ |
| 150464 | + 201, /* (62) tcons ::= CONSTRAINT nm */ |
| 150465 | + 201, /* (63) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ |
| 150466 | + 201, /* (64) tcons ::= UNIQUE LP sortlist RP onconf */ |
| 150467 | + 201, /* (65) tcons ::= CHECK LP expr RP onconf */ |
| 150468 | + 201, /* (66) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ |
| 150469 | + 204, /* (67) defer_subclause_opt ::= */ |
| 150470 | + 190, /* (68) onconf ::= */ |
| 150471 | + 190, /* (69) onconf ::= ON CONFLICT resolvetype */ |
| 150472 | + 205, /* (70) orconf ::= */ |
| 150473 | + 205, /* (71) orconf ::= OR resolvetype */ |
| 150474 | + 206, /* (72) resolvetype ::= IGNORE */ |
| 150475 | + 206, /* (73) resolvetype ::= REPLACE */ |
| 150476 | + 164, /* (74) cmd ::= DROP TABLE ifexists fullname */ |
| 150477 | + 208, /* (75) ifexists ::= IF EXISTS */ |
| 150478 | + 208, /* (76) ifexists ::= */ |
| 150479 | + 164, /* (77) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ |
| 150480 | + 164, /* (78) cmd ::= DROP VIEW ifexists fullname */ |
| 150481 | + 164, /* (79) cmd ::= select */ |
| 150482 | + 178, /* (80) select ::= WITH wqlist selectnowith */ |
| 150483 | + 178, /* (81) select ::= WITH RECURSIVE wqlist selectnowith */ |
| 150484 | + 178, /* (82) select ::= selectnowith */ |
| 150485 | + 210, /* (83) selectnowith ::= selectnowith multiselect_op oneselect */ |
| 150486 | + 213, /* (84) multiselect_op ::= UNION */ |
| 150487 | + 213, /* (85) multiselect_op ::= UNION ALL */ |
| 150488 | + 213, /* (86) multiselect_op ::= EXCEPT|INTERSECT */ |
| 150489 | + 211, /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ |
| 150490 | + 211, /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ |
| 150491 | + 223, /* (89) values ::= VALUES LP nexprlist RP */ |
| 150492 | + 223, /* (90) values ::= values COMMA LP nexprlist RP */ |
| 150493 | + 214, /* (91) distinct ::= DISTINCT */ |
| 150494 | + 214, /* (92) distinct ::= ALL */ |
| 150495 | + 214, /* (93) distinct ::= */ |
| 150496 | + 225, /* (94) sclp ::= */ |
| 150497 | + 215, /* (95) selcollist ::= sclp scanpt expr scanpt as */ |
| 150498 | + 215, /* (96) selcollist ::= sclp scanpt STAR */ |
| 150499 | + 215, /* (97) selcollist ::= sclp scanpt nm DOT STAR */ |
| 150500 | + 226, /* (98) as ::= AS nm */ |
| 150501 | + 226, /* (99) as ::= */ |
| 150502 | + 216, /* (100) from ::= */ |
| 150503 | + 216, /* (101) from ::= FROM seltablist */ |
| 150504 | + 228, /* (102) stl_prefix ::= seltablist joinop */ |
| 150505 | + 228, /* (103) stl_prefix ::= */ |
| 150506 | + 227, /* (104) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ |
| 150507 | + 227, /* (105) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ |
| 150508 | + 227, /* (106) seltablist ::= stl_prefix LP select RP as on_opt using_opt */ |
| 150509 | + 227, /* (107) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ |
| 150510 | + 174, /* (108) dbnm ::= */ |
| 150511 | + 174, /* (109) dbnm ::= DOT nm */ |
| 150512 | + 209, /* (110) fullname ::= nm */ |
| 150513 | + 209, /* (111) fullname ::= nm DOT nm */ |
| 150514 | + 234, /* (112) xfullname ::= nm */ |
| 150515 | + 234, /* (113) xfullname ::= nm DOT nm */ |
| 150516 | + 234, /* (114) xfullname ::= nm DOT nm AS nm */ |
| 150517 | + 234, /* (115) xfullname ::= nm AS nm */ |
| 150518 | + 229, /* (116) joinop ::= COMMA|JOIN */ |
| 150519 | + 229, /* (117) joinop ::= JOIN_KW JOIN */ |
| 150520 | + 229, /* (118) joinop ::= JOIN_KW nm JOIN */ |
| 150521 | + 229, /* (119) joinop ::= JOIN_KW nm nm JOIN */ |
| 150522 | + 231, /* (120) on_opt ::= ON expr */ |
| 150523 | + 231, /* (121) on_opt ::= */ |
| 150524 | + 230, /* (122) indexed_opt ::= */ |
| 150525 | + 230, /* (123) indexed_opt ::= INDEXED BY nm */ |
| 150526 | + 230, /* (124) indexed_opt ::= NOT INDEXED */ |
| 150527 | + 232, /* (125) using_opt ::= USING LP idlist RP */ |
| 150528 | + 232, /* (126) using_opt ::= */ |
| 150529 | + 220, /* (127) orderby_opt ::= */ |
| 150530 | + 220, /* (128) orderby_opt ::= ORDER BY sortlist */ |
| 150531 | + 202, /* (129) sortlist ::= sortlist COMMA expr sortorder */ |
| 150532 | + 202, /* (130) sortlist ::= expr sortorder */ |
| 150533 | + 191, /* (131) sortorder ::= ASC */ |
| 150534 | + 191, /* (132) sortorder ::= DESC */ |
| 150535 | + 191, /* (133) sortorder ::= */ |
| 150536 | + 218, /* (134) groupby_opt ::= */ |
| 150537 | + 218, /* (135) groupby_opt ::= GROUP BY nexprlist */ |
| 150538 | + 219, /* (136) having_opt ::= */ |
| 150539 | + 219, /* (137) having_opt ::= HAVING expr */ |
| 150540 | + 221, /* (138) limit_opt ::= */ |
| 150541 | + 221, /* (139) limit_opt ::= LIMIT expr */ |
| 150542 | + 221, /* (140) limit_opt ::= LIMIT expr OFFSET expr */ |
| 150543 | + 221, /* (141) limit_opt ::= LIMIT expr COMMA expr */ |
| 150544 | + 164, /* (142) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */ |
| 150545 | + 217, /* (143) where_opt ::= */ |
| 150546 | + 217, /* (144) where_opt ::= WHERE expr */ |
| 150547 | + 164, /* (145) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */ |
| 150548 | + 237, /* (146) setlist ::= setlist COMMA nm EQ expr */ |
| 150549 | + 237, /* (147) setlist ::= setlist COMMA LP idlist RP EQ expr */ |
| 150550 | + 237, /* (148) setlist ::= nm EQ expr */ |
| 150551 | + 237, /* (149) setlist ::= LP idlist RP EQ expr */ |
| 150552 | + 164, /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ |
| 150553 | + 164, /* (151) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */ |
| 150554 | + 240, /* (152) upsert ::= */ |
| 150555 | + 240, /* (153) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */ |
| 150556 | + 240, /* (154) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */ |
| 150557 | + 240, /* (155) upsert ::= ON CONFLICT DO NOTHING */ |
| 150558 | + 238, /* (156) insert_cmd ::= INSERT orconf */ |
| 150559 | + 238, /* (157) insert_cmd ::= REPLACE */ |
| 150560 | + 239, /* (158) idlist_opt ::= */ |
| 150561 | + 239, /* (159) idlist_opt ::= LP idlist RP */ |
| 150562 | + 235, /* (160) idlist ::= idlist COMMA nm */ |
| 150563 | + 235, /* (161) idlist ::= nm */ |
| 150564 | + 189, /* (162) expr ::= LP expr RP */ |
| 150565 | + 189, /* (163) expr ::= ID|INDEXED */ |
| 150566 | + 189, /* (164) expr ::= JOIN_KW */ |
| 150567 | + 189, /* (165) expr ::= nm DOT nm */ |
| 150568 | + 189, /* (166) expr ::= nm DOT nm DOT nm */ |
| 150569 | + 188, /* (167) term ::= NULL|FLOAT|BLOB */ |
| 150570 | + 188, /* (168) term ::= STRING */ |
| 150571 | + 188, /* (169) term ::= INTEGER */ |
| 150572 | + 189, /* (170) expr ::= VARIABLE */ |
| 150573 | + 189, /* (171) expr ::= expr COLLATE ID|STRING */ |
| 150574 | + 189, /* (172) expr ::= CAST LP expr AS typetoken RP */ |
| 150575 | + 189, /* (173) expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 150576 | + 189, /* (174) expr ::= ID|INDEXED LP STAR RP */ |
| 150577 | + 189, /* (175) expr ::= ID|INDEXED LP distinct exprlist RP over_clause */ |
| 150578 | + 189, /* (176) expr ::= ID|INDEXED LP STAR RP over_clause */ |
| 150579 | + 188, /* (177) term ::= CTIME_KW */ |
| 150580 | + 189, /* (178) expr ::= LP nexprlist COMMA expr RP */ |
| 150581 | + 189, /* (179) expr ::= expr AND expr */ |
| 150582 | + 189, /* (180) expr ::= expr OR expr */ |
| 150583 | + 189, /* (181) expr ::= expr LT|GT|GE|LE expr */ |
| 150584 | + 189, /* (182) expr ::= expr EQ|NE expr */ |
| 150585 | + 189, /* (183) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ |
| 150586 | + 189, /* (184) expr ::= expr PLUS|MINUS expr */ |
| 150587 | + 189, /* (185) expr ::= expr STAR|SLASH|REM expr */ |
| 150588 | + 189, /* (186) expr ::= expr CONCAT expr */ |
| 150589 | + 242, /* (187) likeop ::= NOT LIKE_KW|MATCH */ |
| 150590 | + 189, /* (188) expr ::= expr likeop expr */ |
| 150591 | + 189, /* (189) expr ::= expr likeop expr ESCAPE expr */ |
| 150592 | + 189, /* (190) expr ::= expr ISNULL|NOTNULL */ |
| 150593 | + 189, /* (191) expr ::= expr NOT NULL */ |
| 150594 | + 189, /* (192) expr ::= expr IS expr */ |
| 150595 | + 189, /* (193) expr ::= expr IS NOT expr */ |
| 150596 | + 189, /* (194) expr ::= NOT expr */ |
| 150597 | + 189, /* (195) expr ::= BITNOT expr */ |
| 150598 | + 189, /* (196) expr ::= PLUS|MINUS expr */ |
| 150599 | + 243, /* (197) between_op ::= BETWEEN */ |
| 150600 | + 243, /* (198) between_op ::= NOT BETWEEN */ |
| 150601 | + 189, /* (199) expr ::= expr between_op expr AND expr */ |
| 150602 | + 244, /* (200) in_op ::= IN */ |
| 150603 | + 244, /* (201) in_op ::= NOT IN */ |
| 150604 | + 189, /* (202) expr ::= expr in_op LP exprlist RP */ |
| 150605 | + 189, /* (203) expr ::= LP select RP */ |
| 150606 | + 189, /* (204) expr ::= expr in_op LP select RP */ |
| 150607 | + 189, /* (205) expr ::= expr in_op nm dbnm paren_exprlist */ |
| 150608 | + 189, /* (206) expr ::= EXISTS LP select RP */ |
| 150609 | + 189, /* (207) expr ::= CASE case_operand case_exprlist case_else END */ |
| 150610 | + 247, /* (208) case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 150611 | + 247, /* (209) case_exprlist ::= WHEN expr THEN expr */ |
| 150612 | + 248, /* (210) case_else ::= ELSE expr */ |
| 150613 | + 248, /* (211) case_else ::= */ |
| 150614 | + 246, /* (212) case_operand ::= expr */ |
| 150615 | + 246, /* (213) case_operand ::= */ |
| 150616 | + 233, /* (214) exprlist ::= */ |
| 150617 | + 224, /* (215) nexprlist ::= nexprlist COMMA expr */ |
| 150618 | + 224, /* (216) nexprlist ::= expr */ |
| 150619 | + 245, /* (217) paren_exprlist ::= */ |
| 150620 | + 245, /* (218) paren_exprlist ::= LP exprlist RP */ |
| 150621 | + 164, /* (219) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 150622 | + 249, /* (220) uniqueflag ::= UNIQUE */ |
| 150623 | + 249, /* (221) uniqueflag ::= */ |
| 150624 | + 193, /* (222) eidlist_opt ::= */ |
| 150625 | + 193, /* (223) eidlist_opt ::= LP eidlist RP */ |
| 150626 | + 203, /* (224) eidlist ::= eidlist COMMA nm collate sortorder */ |
| 150627 | + 203, /* (225) eidlist ::= nm collate sortorder */ |
| 150628 | + 250, /* (226) collate ::= */ |
| 150629 | + 250, /* (227) collate ::= COLLATE ID|STRING */ |
| 150630 | + 164, /* (228) cmd ::= DROP INDEX ifexists fullname */ |
| 150631 | + 164, /* (229) cmd ::= VACUUM vinto */ |
| 150632 | + 164, /* (230) cmd ::= VACUUM nm vinto */ |
| 150633 | + 251, /* (231) vinto ::= INTO expr */ |
| 150634 | + 251, /* (232) vinto ::= */ |
| 150635 | + 164, /* (233) cmd ::= PRAGMA nm dbnm */ |
| 150636 | + 164, /* (234) cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 150637 | + 164, /* (235) cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 150638 | + 164, /* (236) cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 150639 | + 164, /* (237) cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 150640 | + 184, /* (238) plus_num ::= PLUS INTEGER|FLOAT */ |
| 150641 | + 185, /* (239) minus_num ::= MINUS INTEGER|FLOAT */ |
| 150642 | + 164, /* (240) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 150643 | + 253, /* (241) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 150644 | + 255, /* (242) trigger_time ::= BEFORE|AFTER */ |
| 150645 | + 255, /* (243) trigger_time ::= INSTEAD OF */ |
| 150646 | + 255, /* (244) trigger_time ::= */ |
| 150647 | + 256, /* (245) trigger_event ::= DELETE|INSERT */ |
| 150648 | + 256, /* (246) trigger_event ::= UPDATE */ |
| 150649 | + 256, /* (247) trigger_event ::= UPDATE OF idlist */ |
| 150650 | + 258, /* (248) when_clause ::= */ |
| 150651 | + 258, /* (249) when_clause ::= WHEN expr */ |
| 150652 | + 254, /* (250) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 150653 | + 254, /* (251) trigger_cmd_list ::= trigger_cmd SEMI */ |
| 150654 | + 260, /* (252) trnm ::= nm DOT nm */ |
| 150655 | + 261, /* (253) tridxby ::= INDEXED BY nm */ |
| 150656 | + 261, /* (254) tridxby ::= NOT INDEXED */ |
| 150657 | + 259, /* (255) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ |
| 150658 | + 259, /* (256) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 150659 | + 259, /* (257) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 150660 | + 259, /* (258) trigger_cmd ::= scanpt select scanpt */ |
| 150661 | + 189, /* (259) expr ::= RAISE LP IGNORE RP */ |
| 150662 | + 189, /* (260) expr ::= RAISE LP raisetype COMMA nm RP */ |
| 150663 | + 207, /* (261) raisetype ::= ROLLBACK */ |
| 150664 | + 207, /* (262) raisetype ::= ABORT */ |
| 150665 | + 207, /* (263) raisetype ::= FAIL */ |
| 150666 | + 164, /* (264) cmd ::= DROP TRIGGER ifexists fullname */ |
| 150667 | + 164, /* (265) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 150668 | + 164, /* (266) cmd ::= DETACH database_kw_opt expr */ |
| 150669 | + 263, /* (267) key_opt ::= */ |
| 150670 | + 263, /* (268) key_opt ::= KEY expr */ |
| 150671 | + 164, /* (269) cmd ::= REINDEX */ |
| 150672 | + 164, /* (270) cmd ::= REINDEX nm dbnm */ |
| 150673 | + 164, /* (271) cmd ::= ANALYZE */ |
| 150674 | + 164, /* (272) cmd ::= ANALYZE nm dbnm */ |
| 150675 | + 164, /* (273) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 150676 | + 164, /* (274) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 150677 | + 264, /* (275) add_column_fullname ::= fullname */ |
| 150678 | + 164, /* (276) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 150679 | + 164, /* (277) cmd ::= create_vtab */ |
| 150680 | + 164, /* (278) cmd ::= create_vtab LP vtabarglist RP */ |
| 150681 | + 266, /* (279) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 150682 | + 268, /* (280) vtabarg ::= */ |
| 150683 | + 269, /* (281) vtabargtoken ::= ANY */ |
| 150684 | + 269, /* (282) vtabargtoken ::= lp anylist RP */ |
| 150685 | + 270, /* (283) lp ::= LP */ |
| 150686 | + 236, /* (284) with ::= WITH wqlist */ |
| 150687 | + 236, /* (285) with ::= WITH RECURSIVE wqlist */ |
| 150688 | + 212, /* (286) wqlist ::= nm eidlist_opt AS LP select RP */ |
| 150689 | + 212, /* (287) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 150690 | + 272, /* (288) windowdefn_list ::= windowdefn */ |
| 150691 | + 272, /* (289) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 150692 | + 273, /* (290) windowdefn ::= nm AS LP window RP */ |
| 150693 | + 274, /* (291) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 150694 | + 274, /* (292) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 150695 | + 274, /* (293) window ::= ORDER BY sortlist frame_opt */ |
| 150696 | + 274, /* (294) window ::= nm ORDER BY sortlist frame_opt */ |
| 150697 | + 274, /* (295) window ::= frame_opt */ |
| 150698 | + 274, /* (296) window ::= nm frame_opt */ |
| 150699 | + 275, /* (297) frame_opt ::= */ |
| 150700 | + 275, /* (298) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 150701 | + 275, /* (299) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 150702 | + 278, /* (300) range_or_rows ::= RANGE|ROWS|GROUPS */ |
| 150703 | + 280, /* (301) frame_bound_s ::= frame_bound */ |
| 150704 | + 280, /* (302) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 150705 | + 281, /* (303) frame_bound_e ::= frame_bound */ |
| 150706 | + 281, /* (304) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 150707 | + 279, /* (305) frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 150708 | + 279, /* (306) frame_bound ::= CURRENT ROW */ |
| 150709 | + 282, /* (307) frame_exclude_opt ::= */ |
| 150710 | + 282, /* (308) frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 150711 | + 283, /* (309) frame_exclude ::= NO OTHERS */ |
| 150712 | + 283, /* (310) frame_exclude ::= CURRENT ROW */ |
| 150713 | + 283, /* (311) frame_exclude ::= GROUP|TIES */ |
| 150714 | + 222, /* (312) window_clause ::= WINDOW windowdefn_list */ |
| 150715 | + 241, /* (313) over_clause ::= filter_opt OVER LP window RP */ |
| 150716 | + 241, /* (314) over_clause ::= filter_opt OVER nm */ |
| 150717 | + 277, /* (315) filter_opt ::= */ |
| 150718 | + 277, /* (316) filter_opt ::= FILTER LP WHERE expr RP */ |
| 150719 | + 159, /* (317) input ::= cmdlist */ |
| 150720 | + 160, /* (318) cmdlist ::= cmdlist ecmd */ |
| 150721 | + 160, /* (319) cmdlist ::= ecmd */ |
| 150722 | + 161, /* (320) ecmd ::= SEMI */ |
| 150723 | + 161, /* (321) ecmd ::= cmdx SEMI */ |
| 150724 | + 161, /* (322) ecmd ::= explain cmdx */ |
| 150725 | + 166, /* (323) trans_opt ::= */ |
| 150726 | + 166, /* (324) trans_opt ::= TRANSACTION */ |
| 150727 | + 166, /* (325) trans_opt ::= TRANSACTION nm */ |
| 150728 | + 168, /* (326) savepoint_opt ::= SAVEPOINT */ |
| 150729 | + 168, /* (327) savepoint_opt ::= */ |
| 150730 | + 164, /* (328) cmd ::= create_table create_table_args */ |
| 150731 | + 175, /* (329) columnlist ::= columnlist COMMA columnname carglist */ |
| 150732 | + 175, /* (330) columnlist ::= columnname carglist */ |
| 150733 | + 167, /* (331) nm ::= ID|INDEXED */ |
| 150734 | + 167, /* (332) nm ::= STRING */ |
| 150735 | + 167, /* (333) nm ::= JOIN_KW */ |
| 150736 | + 181, /* (334) typetoken ::= typename */ |
| 150737 | + 182, /* (335) typename ::= ID|STRING */ |
| 150738 | + 183, /* (336) signed ::= plus_num */ |
| 150739 | + 183, /* (337) signed ::= minus_num */ |
| 150740 | + 180, /* (338) carglist ::= carglist ccons */ |
| 150741 | + 180, /* (339) carglist ::= */ |
| 150742 | + 187, /* (340) ccons ::= NULL onconf */ |
| 150743 | + 176, /* (341) conslist_opt ::= COMMA conslist */ |
| 150744 | + 199, /* (342) conslist ::= conslist tconscomma tcons */ |
| 150745 | + 199, /* (343) conslist ::= tcons */ |
| 150746 | + 200, /* (344) tconscomma ::= */ |
| 150747 | + 204, /* (345) defer_subclause_opt ::= defer_subclause */ |
| 150748 | + 206, /* (346) resolvetype ::= raisetype */ |
| 150749 | + 210, /* (347) selectnowith ::= oneselect */ |
| 150750 | + 211, /* (348) oneselect ::= values */ |
| 150751 | + 225, /* (349) sclp ::= selcollist COMMA */ |
| 150752 | + 226, /* (350) as ::= ID|STRING */ |
| 150753 | + 189, /* (351) expr ::= term */ |
| 150754 | + 242, /* (352) likeop ::= LIKE_KW|MATCH */ |
| 150755 | + 233, /* (353) exprlist ::= nexprlist */ |
| 150756 | + 252, /* (354) nmnum ::= plus_num */ |
| 150757 | + 252, /* (355) nmnum ::= nm */ |
| 150758 | + 252, /* (356) nmnum ::= ON */ |
| 150759 | + 252, /* (357) nmnum ::= DELETE */ |
| 150760 | + 252, /* (358) nmnum ::= DEFAULT */ |
| 150761 | + 184, /* (359) plus_num ::= INTEGER|FLOAT */ |
| 150762 | + 257, /* (360) foreach_clause ::= */ |
| 150763 | + 257, /* (361) foreach_clause ::= FOR EACH ROW */ |
| 150764 | + 260, /* (362) trnm ::= nm */ |
| 150765 | + 261, /* (363) tridxby ::= */ |
| 150766 | + 262, /* (364) database_kw_opt ::= DATABASE */ |
| 150767 | + 262, /* (365) database_kw_opt ::= */ |
| 150768 | + 265, /* (366) kwcolumn_opt ::= */ |
| 150769 | + 265, /* (367) kwcolumn_opt ::= COLUMNKW */ |
| 150770 | + 267, /* (368) vtabarglist ::= vtabarg */ |
| 150771 | + 267, /* (369) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 150772 | + 268, /* (370) vtabarg ::= vtabarg vtabargtoken */ |
| 150773 | + 271, /* (371) anylist ::= */ |
| 150774 | + 271, /* (372) anylist ::= anylist LP anylist RP */ |
| 150775 | + 271, /* (373) anylist ::= anylist ANY */ |
| 150776 | + 236, /* (374) with ::= */ |
| 150140 | 150777 | }; |
| 150141 | 150778 | |
| 150142 | 150779 | /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number |
| 150143 | 150780 | ** of symbols on the right-hand side of that rule. */ |
| 150144 | 150781 | static const signed char yyRuleInfoNRhs[] = { |
| | @@ -150430,89 +151067,95 @@ |
| 150430 | 151067 | -3, /* (285) with ::= WITH RECURSIVE wqlist */ |
| 150431 | 151068 | -6, /* (286) wqlist ::= nm eidlist_opt AS LP select RP */ |
| 150432 | 151069 | -8, /* (287) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 150433 | 151070 | -1, /* (288) windowdefn_list ::= windowdefn */ |
| 150434 | 151071 | -3, /* (289) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 150435 | | - -3, /* (290) windowdefn ::= nm AS window */ |
| 150436 | | - -5, /* (291) window ::= LP part_opt orderby_opt frame_opt RP */ |
| 150437 | | - -3, /* (292) part_opt ::= PARTITION BY nexprlist */ |
| 150438 | | - 0, /* (293) part_opt ::= */ |
| 150439 | | - 0, /* (294) frame_opt ::= */ |
| 150440 | | - -2, /* (295) frame_opt ::= range_or_rows frame_bound_s */ |
| 150441 | | - -5, /* (296) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */ |
| 150442 | | - -1, /* (297) range_or_rows ::= RANGE */ |
| 150443 | | - -1, /* (298) range_or_rows ::= ROWS */ |
| 150444 | | - -1, /* (299) frame_bound_s ::= frame_bound */ |
| 150445 | | - -2, /* (300) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 150446 | | - -1, /* (301) frame_bound_e ::= frame_bound */ |
| 150447 | | - -2, /* (302) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 150448 | | - -2, /* (303) frame_bound ::= expr PRECEDING */ |
| 150449 | | - -2, /* (304) frame_bound ::= CURRENT ROW */ |
| 150450 | | - -2, /* (305) frame_bound ::= expr FOLLOWING */ |
| 150451 | | - -2, /* (306) window_clause ::= WINDOW windowdefn_list */ |
| 150452 | | - -3, /* (307) over_clause ::= filter_opt OVER window */ |
| 150453 | | - -3, /* (308) over_clause ::= filter_opt OVER nm */ |
| 150454 | | - 0, /* (309) filter_opt ::= */ |
| 150455 | | - -5, /* (310) filter_opt ::= FILTER LP WHERE expr RP */ |
| 150456 | | - -1, /* (311) input ::= cmdlist */ |
| 150457 | | - -2, /* (312) cmdlist ::= cmdlist ecmd */ |
| 150458 | | - -1, /* (313) cmdlist ::= ecmd */ |
| 150459 | | - -1, /* (314) ecmd ::= SEMI */ |
| 150460 | | - -2, /* (315) ecmd ::= cmdx SEMI */ |
| 150461 | | - -2, /* (316) ecmd ::= explain cmdx */ |
| 150462 | | - 0, /* (317) trans_opt ::= */ |
| 150463 | | - -1, /* (318) trans_opt ::= TRANSACTION */ |
| 150464 | | - -2, /* (319) trans_opt ::= TRANSACTION nm */ |
| 150465 | | - -1, /* (320) savepoint_opt ::= SAVEPOINT */ |
| 150466 | | - 0, /* (321) savepoint_opt ::= */ |
| 150467 | | - -2, /* (322) cmd ::= create_table create_table_args */ |
| 150468 | | - -4, /* (323) columnlist ::= columnlist COMMA columnname carglist */ |
| 150469 | | - -2, /* (324) columnlist ::= columnname carglist */ |
| 150470 | | - -1, /* (325) nm ::= ID|INDEXED */ |
| 150471 | | - -1, /* (326) nm ::= STRING */ |
| 150472 | | - -1, /* (327) nm ::= JOIN_KW */ |
| 150473 | | - -1, /* (328) typetoken ::= typename */ |
| 150474 | | - -1, /* (329) typename ::= ID|STRING */ |
| 150475 | | - -1, /* (330) signed ::= plus_num */ |
| 150476 | | - -1, /* (331) signed ::= minus_num */ |
| 150477 | | - -2, /* (332) carglist ::= carglist ccons */ |
| 150478 | | - 0, /* (333) carglist ::= */ |
| 150479 | | - -2, /* (334) ccons ::= NULL onconf */ |
| 150480 | | - -2, /* (335) conslist_opt ::= COMMA conslist */ |
| 150481 | | - -3, /* (336) conslist ::= conslist tconscomma tcons */ |
| 150482 | | - -1, /* (337) conslist ::= tcons */ |
| 150483 | | - 0, /* (338) tconscomma ::= */ |
| 150484 | | - -1, /* (339) defer_subclause_opt ::= defer_subclause */ |
| 150485 | | - -1, /* (340) resolvetype ::= raisetype */ |
| 150486 | | - -1, /* (341) selectnowith ::= oneselect */ |
| 150487 | | - -1, /* (342) oneselect ::= values */ |
| 150488 | | - -2, /* (343) sclp ::= selcollist COMMA */ |
| 150489 | | - -1, /* (344) as ::= ID|STRING */ |
| 150490 | | - -1, /* (345) expr ::= term */ |
| 150491 | | - -1, /* (346) likeop ::= LIKE_KW|MATCH */ |
| 150492 | | - -1, /* (347) exprlist ::= nexprlist */ |
| 150493 | | - -1, /* (348) nmnum ::= plus_num */ |
| 150494 | | - -1, /* (349) nmnum ::= nm */ |
| 150495 | | - -1, /* (350) nmnum ::= ON */ |
| 150496 | | - -1, /* (351) nmnum ::= DELETE */ |
| 150497 | | - -1, /* (352) nmnum ::= DEFAULT */ |
| 150498 | | - -1, /* (353) plus_num ::= INTEGER|FLOAT */ |
| 150499 | | - 0, /* (354) foreach_clause ::= */ |
| 150500 | | - -3, /* (355) foreach_clause ::= FOR EACH ROW */ |
| 150501 | | - -1, /* (356) trnm ::= nm */ |
| 150502 | | - 0, /* (357) tridxby ::= */ |
| 150503 | | - -1, /* (358) database_kw_opt ::= DATABASE */ |
| 150504 | | - 0, /* (359) database_kw_opt ::= */ |
| 150505 | | - 0, /* (360) kwcolumn_opt ::= */ |
| 150506 | | - -1, /* (361) kwcolumn_opt ::= COLUMNKW */ |
| 150507 | | - -1, /* (362) vtabarglist ::= vtabarg */ |
| 150508 | | - -3, /* (363) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 150509 | | - -2, /* (364) vtabarg ::= vtabarg vtabargtoken */ |
| 150510 | | - 0, /* (365) anylist ::= */ |
| 150511 | | - -4, /* (366) anylist ::= anylist LP anylist RP */ |
| 150512 | | - -2, /* (367) anylist ::= anylist ANY */ |
| 150513 | | - 0, /* (368) with ::= */ |
| 151072 | + -5, /* (290) windowdefn ::= nm AS LP window RP */ |
| 151073 | + -5, /* (291) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 151074 | + -6, /* (292) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 151075 | + -4, /* (293) window ::= ORDER BY sortlist frame_opt */ |
| 151076 | + -5, /* (294) window ::= nm ORDER BY sortlist frame_opt */ |
| 151077 | + -1, /* (295) window ::= frame_opt */ |
| 151078 | + -2, /* (296) window ::= nm frame_opt */ |
| 151079 | + 0, /* (297) frame_opt ::= */ |
| 151080 | + -3, /* (298) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 151081 | + -6, /* (299) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 151082 | + -1, /* (300) range_or_rows ::= RANGE|ROWS|GROUPS */ |
| 151083 | + -1, /* (301) frame_bound_s ::= frame_bound */ |
| 151084 | + -2, /* (302) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 151085 | + -1, /* (303) frame_bound_e ::= frame_bound */ |
| 151086 | + -2, /* (304) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 151087 | + -2, /* (305) frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 151088 | + -2, /* (306) frame_bound ::= CURRENT ROW */ |
| 151089 | + 0, /* (307) frame_exclude_opt ::= */ |
| 151090 | + -2, /* (308) frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 151091 | + -2, /* (309) frame_exclude ::= NO OTHERS */ |
| 151092 | + -2, /* (310) frame_exclude ::= CURRENT ROW */ |
| 151093 | + -1, /* (311) frame_exclude ::= GROUP|TIES */ |
| 151094 | + -2, /* (312) window_clause ::= WINDOW windowdefn_list */ |
| 151095 | + -5, /* (313) over_clause ::= filter_opt OVER LP window RP */ |
| 151096 | + -3, /* (314) over_clause ::= filter_opt OVER nm */ |
| 151097 | + 0, /* (315) filter_opt ::= */ |
| 151098 | + -5, /* (316) filter_opt ::= FILTER LP WHERE expr RP */ |
| 151099 | + -1, /* (317) input ::= cmdlist */ |
| 151100 | + -2, /* (318) cmdlist ::= cmdlist ecmd */ |
| 151101 | + -1, /* (319) cmdlist ::= ecmd */ |
| 151102 | + -1, /* (320) ecmd ::= SEMI */ |
| 151103 | + -2, /* (321) ecmd ::= cmdx SEMI */ |
| 151104 | + -2, /* (322) ecmd ::= explain cmdx */ |
| 151105 | + 0, /* (323) trans_opt ::= */ |
| 151106 | + -1, /* (324) trans_opt ::= TRANSACTION */ |
| 151107 | + -2, /* (325) trans_opt ::= TRANSACTION nm */ |
| 151108 | + -1, /* (326) savepoint_opt ::= SAVEPOINT */ |
| 151109 | + 0, /* (327) savepoint_opt ::= */ |
| 151110 | + -2, /* (328) cmd ::= create_table create_table_args */ |
| 151111 | + -4, /* (329) columnlist ::= columnlist COMMA columnname carglist */ |
| 151112 | + -2, /* (330) columnlist ::= columnname carglist */ |
| 151113 | + -1, /* (331) nm ::= ID|INDEXED */ |
| 151114 | + -1, /* (332) nm ::= STRING */ |
| 151115 | + -1, /* (333) nm ::= JOIN_KW */ |
| 151116 | + -1, /* (334) typetoken ::= typename */ |
| 151117 | + -1, /* (335) typename ::= ID|STRING */ |
| 151118 | + -1, /* (336) signed ::= plus_num */ |
| 151119 | + -1, /* (337) signed ::= minus_num */ |
| 151120 | + -2, /* (338) carglist ::= carglist ccons */ |
| 151121 | + 0, /* (339) carglist ::= */ |
| 151122 | + -2, /* (340) ccons ::= NULL onconf */ |
| 151123 | + -2, /* (341) conslist_opt ::= COMMA conslist */ |
| 151124 | + -3, /* (342) conslist ::= conslist tconscomma tcons */ |
| 151125 | + -1, /* (343) conslist ::= tcons */ |
| 151126 | + 0, /* (344) tconscomma ::= */ |
| 151127 | + -1, /* (345) defer_subclause_opt ::= defer_subclause */ |
| 151128 | + -1, /* (346) resolvetype ::= raisetype */ |
| 151129 | + -1, /* (347) selectnowith ::= oneselect */ |
| 151130 | + -1, /* (348) oneselect ::= values */ |
| 151131 | + -2, /* (349) sclp ::= selcollist COMMA */ |
| 151132 | + -1, /* (350) as ::= ID|STRING */ |
| 151133 | + -1, /* (351) expr ::= term */ |
| 151134 | + -1, /* (352) likeop ::= LIKE_KW|MATCH */ |
| 151135 | + -1, /* (353) exprlist ::= nexprlist */ |
| 151136 | + -1, /* (354) nmnum ::= plus_num */ |
| 151137 | + -1, /* (355) nmnum ::= nm */ |
| 151138 | + -1, /* (356) nmnum ::= ON */ |
| 151139 | + -1, /* (357) nmnum ::= DELETE */ |
| 151140 | + -1, /* (358) nmnum ::= DEFAULT */ |
| 151141 | + -1, /* (359) plus_num ::= INTEGER|FLOAT */ |
| 151142 | + 0, /* (360) foreach_clause ::= */ |
| 151143 | + -3, /* (361) foreach_clause ::= FOR EACH ROW */ |
| 151144 | + -1, /* (362) trnm ::= nm */ |
| 151145 | + 0, /* (363) tridxby ::= */ |
| 151146 | + -1, /* (364) database_kw_opt ::= DATABASE */ |
| 151147 | + 0, /* (365) database_kw_opt ::= */ |
| 151148 | + 0, /* (366) kwcolumn_opt ::= */ |
| 151149 | + -1, /* (367) kwcolumn_opt ::= COLUMNKW */ |
| 151150 | + -1, /* (368) vtabarglist ::= vtabarg */ |
| 151151 | + -3, /* (369) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 151152 | + -2, /* (370) vtabarg ::= vtabarg vtabargtoken */ |
| 151153 | + 0, /* (371) anylist ::= */ |
| 151154 | + -4, /* (372) anylist ::= anylist LP anylist RP */ |
| 151155 | + -2, /* (373) anylist ::= anylist ANY */ |
| 151156 | + 0, /* (374) with ::= */ |
| 150514 | 151157 | }; |
| 150515 | 151158 | |
| 150516 | 151159 | static void yy_accept(yyParser*); /* Forward Declaration */ |
| 150517 | 151160 | |
| 150518 | 151161 | /* |
| | @@ -150605,19 +151248,20 @@ |
| 150605 | 151248 | break; |
| 150606 | 151249 | case 2: /* cmdx ::= cmd */ |
| 150607 | 151250 | { sqlite3FinishCoding(pParse); } |
| 150608 | 151251 | break; |
| 150609 | 151252 | case 3: /* cmd ::= BEGIN transtype trans_opt */ |
| 150610 | | -{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy96);} |
| 151253 | +{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy420);} |
| 150611 | 151254 | break; |
| 150612 | 151255 | case 4: /* transtype ::= */ |
| 150613 | | -{yymsp[1].minor.yy96 = TK_DEFERRED;} |
| 151256 | +{yymsp[1].minor.yy420 = TK_DEFERRED;} |
| 150614 | 151257 | break; |
| 150615 | 151258 | case 5: /* transtype ::= DEFERRED */ |
| 150616 | 151259 | case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6); |
| 150617 | 151260 | case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7); |
| 150618 | | -{yymsp[0].minor.yy96 = yymsp[0].major; /*A-overwrites-X*/} |
| 151261 | + case 300: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==300); |
| 151262 | +{yymsp[0].minor.yy420 = yymsp[0].major; /*A-overwrites-X*/} |
| 150619 | 151263 | break; |
| 150620 | 151264 | case 8: /* cmd ::= COMMIT|END trans_opt */ |
| 150621 | 151265 | case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9); |
| 150622 | 151266 | {sqlite3EndTransaction(pParse,yymsp[-1].major);} |
| 150623 | 151267 | break; |
| | @@ -150636,11 +151280,11 @@ |
| 150636 | 151280 | sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0); |
| 150637 | 151281 | } |
| 150638 | 151282 | break; |
| 150639 | 151283 | case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ |
| 150640 | 151284 | { |
| 150641 | | - sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy96,0,0,yymsp[-2].minor.yy96); |
| 151285 | + sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy420,0,0,yymsp[-2].minor.yy420); |
| 150642 | 151286 | } |
| 150643 | 151287 | break; |
| 150644 | 151288 | case 14: /* createkw ::= CREATE */ |
| 150645 | 151289 | {disableLookaside(pParse);} |
| 150646 | 151290 | break; |
| | @@ -150651,36 +151295,36 @@ |
| 150651 | 151295 | case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57); |
| 150652 | 151296 | case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67); |
| 150653 | 151297 | case 76: /* ifexists ::= */ yytestcase(yyruleno==76); |
| 150654 | 151298 | case 93: /* distinct ::= */ yytestcase(yyruleno==93); |
| 150655 | 151299 | case 226: /* collate ::= */ yytestcase(yyruleno==226); |
| 150656 | | -{yymsp[1].minor.yy96 = 0;} |
| 151300 | +{yymsp[1].minor.yy420 = 0;} |
| 150657 | 151301 | break; |
| 150658 | 151302 | case 16: /* ifnotexists ::= IF NOT EXISTS */ |
| 150659 | | -{yymsp[-2].minor.yy96 = 1;} |
| 151303 | +{yymsp[-2].minor.yy420 = 1;} |
| 150660 | 151304 | break; |
| 150661 | 151305 | case 17: /* temp ::= TEMP */ |
| 150662 | 151306 | case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43); |
| 150663 | | -{yymsp[0].minor.yy96 = 1;} |
| 151307 | +{yymsp[0].minor.yy420 = 1;} |
| 150664 | 151308 | break; |
| 150665 | 151309 | case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */ |
| 150666 | 151310 | { |
| 150667 | | - sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy96,0); |
| 151311 | + sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy420,0); |
| 150668 | 151312 | } |
| 150669 | 151313 | break; |
| 150670 | 151314 | case 20: /* create_table_args ::= AS select */ |
| 150671 | 151315 | { |
| 150672 | | - sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy423); |
| 150673 | | - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy423); |
| 151316 | + sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy491); |
| 151317 | + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy491); |
| 150674 | 151318 | } |
| 150675 | 151319 | break; |
| 150676 | 151320 | case 22: /* table_options ::= WITHOUT nm */ |
| 150677 | 151321 | { |
| 150678 | 151322 | if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){ |
| 150679 | | - yymsp[-1].minor.yy96 = TF_WithoutRowid | TF_NoVisibleRowid; |
| 151323 | + yymsp[-1].minor.yy420 = TF_WithoutRowid | TF_NoVisibleRowid; |
| 150680 | 151324 | }else{ |
| 150681 | | - yymsp[-1].minor.yy96 = 0; |
| 151325 | + yymsp[-1].minor.yy420 = 0; |
| 150682 | 151326 | sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); |
| 150683 | 151327 | } |
| 150684 | 151328 | } |
| 150685 | 151329 | break; |
| 150686 | 151330 | case 23: /* columnname ::= nm typetoken */ |
| | @@ -150705,30 +151349,30 @@ |
| 150705 | 151349 | {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);} |
| 150706 | 151350 | break; |
| 150707 | 151351 | case 28: /* scanpt ::= */ |
| 150708 | 151352 | { |
| 150709 | 151353 | assert( yyLookahead!=YYNOCODE ); |
| 150710 | | - yymsp[1].minor.yy464 = yyLookaheadToken.z; |
| 151354 | + yymsp[1].minor.yy104 = yyLookaheadToken.z; |
| 150711 | 151355 | } |
| 150712 | 151356 | break; |
| 150713 | 151357 | case 29: /* ccons ::= CONSTRAINT nm */ |
| 150714 | 151358 | case 62: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==62); |
| 150715 | 151359 | {pParse->constraintName = yymsp[0].minor.yy0;} |
| 150716 | 151360 | break; |
| 150717 | 151361 | case 30: /* ccons ::= DEFAULT scanpt term scanpt */ |
| 150718 | | -{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy490,yymsp[-2].minor.yy464,yymsp[0].minor.yy464);} |
| 151362 | +{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy130,yymsp[-2].minor.yy104,yymsp[0].minor.yy104);} |
| 150719 | 151363 | break; |
| 150720 | 151364 | case 31: /* ccons ::= DEFAULT LP expr RP */ |
| 150721 | | -{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy490,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);} |
| 151365 | +{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy130,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);} |
| 150722 | 151366 | break; |
| 150723 | 151367 | case 32: /* ccons ::= DEFAULT PLUS term scanpt */ |
| 150724 | | -{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy490,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy464);} |
| 151368 | +{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy130,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy104);} |
| 150725 | 151369 | break; |
| 150726 | 151370 | case 33: /* ccons ::= DEFAULT MINUS term scanpt */ |
| 150727 | 151371 | { |
| 150728 | | - Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[-1].minor.yy490, 0); |
| 150729 | | - sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy464); |
| 151372 | + Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[-1].minor.yy130, 0); |
| 151373 | + sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy104); |
| 150730 | 151374 | } |
| 150731 | 151375 | break; |
| 150732 | 151376 | case 34: /* ccons ::= DEFAULT scanpt ID|INDEXED */ |
| 150733 | 151377 | { |
| 150734 | 151378 | Expr *p = tokenExpr(pParse, TK_STRING, yymsp[0].minor.yy0); |
| | @@ -150738,319 +151382,319 @@ |
| 150738 | 151382 | } |
| 150739 | 151383 | sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n); |
| 150740 | 151384 | } |
| 150741 | 151385 | break; |
| 150742 | 151386 | case 35: /* ccons ::= NOT NULL onconf */ |
| 150743 | | -{sqlite3AddNotNull(pParse, yymsp[0].minor.yy96);} |
| 151387 | +{sqlite3AddNotNull(pParse, yymsp[0].minor.yy420);} |
| 150744 | 151388 | break; |
| 150745 | 151389 | case 36: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ |
| 150746 | | -{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy96,yymsp[0].minor.yy96,yymsp[-2].minor.yy96);} |
| 151390 | +{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy420,yymsp[0].minor.yy420,yymsp[-2].minor.yy420);} |
| 150747 | 151391 | break; |
| 150748 | 151392 | case 37: /* ccons ::= UNIQUE onconf */ |
| 150749 | | -{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy96,0,0,0,0, |
| 151393 | +{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy420,0,0,0,0, |
| 150750 | 151394 | SQLITE_IDXTYPE_UNIQUE);} |
| 150751 | 151395 | break; |
| 150752 | 151396 | case 38: /* ccons ::= CHECK LP expr RP */ |
| 150753 | | -{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy490);} |
| 151397 | +{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy130);} |
| 150754 | 151398 | break; |
| 150755 | 151399 | case 39: /* ccons ::= REFERENCES nm eidlist_opt refargs */ |
| 150756 | | -{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy42,yymsp[0].minor.yy96);} |
| 151400 | +{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy442,yymsp[0].minor.yy420);} |
| 150757 | 151401 | break; |
| 150758 | 151402 | case 40: /* ccons ::= defer_subclause */ |
| 150759 | | -{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy96);} |
| 151403 | +{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy420);} |
| 150760 | 151404 | break; |
| 150761 | 151405 | case 41: /* ccons ::= COLLATE ID|STRING */ |
| 150762 | 151406 | {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);} |
| 150763 | 151407 | break; |
| 150764 | 151408 | case 44: /* refargs ::= */ |
| 150765 | | -{ yymsp[1].minor.yy96 = OE_None*0x0101; /* EV: R-19803-45884 */} |
| 151409 | +{ yymsp[1].minor.yy420 = OE_None*0x0101; /* EV: R-19803-45884 */} |
| 150766 | 151410 | break; |
| 150767 | 151411 | case 45: /* refargs ::= refargs refarg */ |
| 150768 | | -{ yymsp[-1].minor.yy96 = (yymsp[-1].minor.yy96 & ~yymsp[0].minor.yy367.mask) | yymsp[0].minor.yy367.value; } |
| 151412 | +{ yymsp[-1].minor.yy420 = (yymsp[-1].minor.yy420 & ~yymsp[0].minor.yy527.mask) | yymsp[0].minor.yy527.value; } |
| 150769 | 151413 | break; |
| 150770 | 151414 | case 46: /* refarg ::= MATCH nm */ |
| 150771 | | -{ yymsp[-1].minor.yy367.value = 0; yymsp[-1].minor.yy367.mask = 0x000000; } |
| 151415 | +{ yymsp[-1].minor.yy527.value = 0; yymsp[-1].minor.yy527.mask = 0x000000; } |
| 150772 | 151416 | break; |
| 150773 | 151417 | case 47: /* refarg ::= ON INSERT refact */ |
| 150774 | | -{ yymsp[-2].minor.yy367.value = 0; yymsp[-2].minor.yy367.mask = 0x000000; } |
| 151418 | +{ yymsp[-2].minor.yy527.value = 0; yymsp[-2].minor.yy527.mask = 0x000000; } |
| 150775 | 151419 | break; |
| 150776 | 151420 | case 48: /* refarg ::= ON DELETE refact */ |
| 150777 | | -{ yymsp[-2].minor.yy367.value = yymsp[0].minor.yy96; yymsp[-2].minor.yy367.mask = 0x0000ff; } |
| 151421 | +{ yymsp[-2].minor.yy527.value = yymsp[0].minor.yy420; yymsp[-2].minor.yy527.mask = 0x0000ff; } |
| 150778 | 151422 | break; |
| 150779 | 151423 | case 49: /* refarg ::= ON UPDATE refact */ |
| 150780 | | -{ yymsp[-2].minor.yy367.value = yymsp[0].minor.yy96<<8; yymsp[-2].minor.yy367.mask = 0x00ff00; } |
| 151424 | +{ yymsp[-2].minor.yy527.value = yymsp[0].minor.yy420<<8; yymsp[-2].minor.yy527.mask = 0x00ff00; } |
| 150781 | 151425 | break; |
| 150782 | 151426 | case 50: /* refact ::= SET NULL */ |
| 150783 | | -{ yymsp[-1].minor.yy96 = OE_SetNull; /* EV: R-33326-45252 */} |
| 151427 | +{ yymsp[-1].minor.yy420 = OE_SetNull; /* EV: R-33326-45252 */} |
| 150784 | 151428 | break; |
| 150785 | 151429 | case 51: /* refact ::= SET DEFAULT */ |
| 150786 | | -{ yymsp[-1].minor.yy96 = OE_SetDflt; /* EV: R-33326-45252 */} |
| 151430 | +{ yymsp[-1].minor.yy420 = OE_SetDflt; /* EV: R-33326-45252 */} |
| 150787 | 151431 | break; |
| 150788 | 151432 | case 52: /* refact ::= CASCADE */ |
| 150789 | | -{ yymsp[0].minor.yy96 = OE_Cascade; /* EV: R-33326-45252 */} |
| 151433 | +{ yymsp[0].minor.yy420 = OE_Cascade; /* EV: R-33326-45252 */} |
| 150790 | 151434 | break; |
| 150791 | 151435 | case 53: /* refact ::= RESTRICT */ |
| 150792 | | -{ yymsp[0].minor.yy96 = OE_Restrict; /* EV: R-33326-45252 */} |
| 151436 | +{ yymsp[0].minor.yy420 = OE_Restrict; /* EV: R-33326-45252 */} |
| 150793 | 151437 | break; |
| 150794 | 151438 | case 54: /* refact ::= NO ACTION */ |
| 150795 | | -{ yymsp[-1].minor.yy96 = OE_None; /* EV: R-33326-45252 */} |
| 151439 | +{ yymsp[-1].minor.yy420 = OE_None; /* EV: R-33326-45252 */} |
| 150796 | 151440 | break; |
| 150797 | 151441 | case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ |
| 150798 | | -{yymsp[-2].minor.yy96 = 0;} |
| 151442 | +{yymsp[-2].minor.yy420 = 0;} |
| 150799 | 151443 | break; |
| 150800 | 151444 | case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ |
| 150801 | 151445 | case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71); |
| 150802 | 151446 | case 156: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==156); |
| 150803 | | -{yymsp[-1].minor.yy96 = yymsp[0].minor.yy96;} |
| 151447 | +{yymsp[-1].minor.yy420 = yymsp[0].minor.yy420;} |
| 150804 | 151448 | break; |
| 150805 | 151449 | case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ |
| 150806 | 151450 | case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75); |
| 150807 | 151451 | case 198: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==198); |
| 150808 | 151452 | case 201: /* in_op ::= NOT IN */ yytestcase(yyruleno==201); |
| 150809 | 151453 | case 227: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==227); |
| 150810 | | -{yymsp[-1].minor.yy96 = 1;} |
| 151454 | +{yymsp[-1].minor.yy420 = 1;} |
| 150811 | 151455 | break; |
| 150812 | 151456 | case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ |
| 150813 | | -{yymsp[-1].minor.yy96 = 0;} |
| 151457 | +{yymsp[-1].minor.yy420 = 0;} |
| 150814 | 151458 | break; |
| 150815 | 151459 | case 61: /* tconscomma ::= COMMA */ |
| 150816 | 151460 | {pParse->constraintName.n = 0;} |
| 150817 | 151461 | break; |
| 150818 | 151462 | case 63: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ |
| 150819 | | -{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy42,yymsp[0].minor.yy96,yymsp[-2].minor.yy96,0);} |
| 151463 | +{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy442,yymsp[0].minor.yy420,yymsp[-2].minor.yy420,0);} |
| 150820 | 151464 | break; |
| 150821 | 151465 | case 64: /* tcons ::= UNIQUE LP sortlist RP onconf */ |
| 150822 | | -{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy42,yymsp[0].minor.yy96,0,0,0,0, |
| 151466 | +{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy442,yymsp[0].minor.yy420,0,0,0,0, |
| 150823 | 151467 | SQLITE_IDXTYPE_UNIQUE);} |
| 150824 | 151468 | break; |
| 150825 | 151469 | case 65: /* tcons ::= CHECK LP expr RP onconf */ |
| 150826 | | -{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy490);} |
| 151470 | +{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy130);} |
| 150827 | 151471 | break; |
| 150828 | 151472 | case 66: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ |
| 150829 | 151473 | { |
| 150830 | | - sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy42, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy42, yymsp[-1].minor.yy96); |
| 150831 | | - sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy96); |
| 151474 | + sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy442, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy442, yymsp[-1].minor.yy420); |
| 151475 | + sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy420); |
| 150832 | 151476 | } |
| 150833 | 151477 | break; |
| 150834 | 151478 | case 68: /* onconf ::= */ |
| 150835 | 151479 | case 70: /* orconf ::= */ yytestcase(yyruleno==70); |
| 150836 | | -{yymsp[1].minor.yy96 = OE_Default;} |
| 151480 | +{yymsp[1].minor.yy420 = OE_Default;} |
| 150837 | 151481 | break; |
| 150838 | 151482 | case 69: /* onconf ::= ON CONFLICT resolvetype */ |
| 150839 | | -{yymsp[-2].minor.yy96 = yymsp[0].minor.yy96;} |
| 151483 | +{yymsp[-2].minor.yy420 = yymsp[0].minor.yy420;} |
| 150840 | 151484 | break; |
| 150841 | 151485 | case 72: /* resolvetype ::= IGNORE */ |
| 150842 | | -{yymsp[0].minor.yy96 = OE_Ignore;} |
| 151486 | +{yymsp[0].minor.yy420 = OE_Ignore;} |
| 150843 | 151487 | break; |
| 150844 | 151488 | case 73: /* resolvetype ::= REPLACE */ |
| 150845 | 151489 | case 157: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==157); |
| 150846 | | -{yymsp[0].minor.yy96 = OE_Replace;} |
| 151490 | +{yymsp[0].minor.yy420 = OE_Replace;} |
| 150847 | 151491 | break; |
| 150848 | 151492 | case 74: /* cmd ::= DROP TABLE ifexists fullname */ |
| 150849 | 151493 | { |
| 150850 | | - sqlite3DropTable(pParse, yymsp[0].minor.yy167, 0, yymsp[-1].minor.yy96); |
| 151494 | + sqlite3DropTable(pParse, yymsp[0].minor.yy147, 0, yymsp[-1].minor.yy420); |
| 150851 | 151495 | } |
| 150852 | 151496 | break; |
| 150853 | 151497 | case 77: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ |
| 150854 | 151498 | { |
| 150855 | | - sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy42, yymsp[0].minor.yy423, yymsp[-7].minor.yy96, yymsp[-5].minor.yy96); |
| 151499 | + sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy442, yymsp[0].minor.yy491, yymsp[-7].minor.yy420, yymsp[-5].minor.yy420); |
| 150856 | 151500 | } |
| 150857 | 151501 | break; |
| 150858 | 151502 | case 78: /* cmd ::= DROP VIEW ifexists fullname */ |
| 150859 | 151503 | { |
| 150860 | | - sqlite3DropTable(pParse, yymsp[0].minor.yy167, 1, yymsp[-1].minor.yy96); |
| 151504 | + sqlite3DropTable(pParse, yymsp[0].minor.yy147, 1, yymsp[-1].minor.yy420); |
| 150861 | 151505 | } |
| 150862 | 151506 | break; |
| 150863 | 151507 | case 79: /* cmd ::= select */ |
| 150864 | 151508 | { |
| 150865 | 151509 | SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0}; |
| 150866 | | - sqlite3Select(pParse, yymsp[0].minor.yy423, &dest); |
| 150867 | | - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy423); |
| 151510 | + sqlite3Select(pParse, yymsp[0].minor.yy491, &dest); |
| 151511 | + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy491); |
| 150868 | 151512 | } |
| 150869 | 151513 | break; |
| 150870 | 151514 | case 80: /* select ::= WITH wqlist selectnowith */ |
| 150871 | 151515 | { |
| 150872 | | - Select *p = yymsp[0].minor.yy423; |
| 151516 | + Select *p = yymsp[0].minor.yy491; |
| 150873 | 151517 | if( p ){ |
| 150874 | | - p->pWith = yymsp[-1].minor.yy499; |
| 151518 | + p->pWith = yymsp[-1].minor.yy523; |
| 150875 | 151519 | parserDoubleLinkSelect(pParse, p); |
| 150876 | 151520 | }else{ |
| 150877 | | - sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy499); |
| 151521 | + sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy523); |
| 150878 | 151522 | } |
| 150879 | | - yymsp[-2].minor.yy423 = p; |
| 151523 | + yymsp[-2].minor.yy491 = p; |
| 150880 | 151524 | } |
| 150881 | 151525 | break; |
| 150882 | 151526 | case 81: /* select ::= WITH RECURSIVE wqlist selectnowith */ |
| 150883 | 151527 | { |
| 150884 | | - Select *p = yymsp[0].minor.yy423; |
| 151528 | + Select *p = yymsp[0].minor.yy491; |
| 150885 | 151529 | if( p ){ |
| 150886 | | - p->pWith = yymsp[-1].minor.yy499; |
| 151530 | + p->pWith = yymsp[-1].minor.yy523; |
| 150887 | 151531 | parserDoubleLinkSelect(pParse, p); |
| 150888 | 151532 | }else{ |
| 150889 | | - sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy499); |
| 151533 | + sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy523); |
| 150890 | 151534 | } |
| 150891 | | - yymsp[-3].minor.yy423 = p; |
| 151535 | + yymsp[-3].minor.yy491 = p; |
| 150892 | 151536 | } |
| 150893 | 151537 | break; |
| 150894 | 151538 | case 82: /* select ::= selectnowith */ |
| 150895 | 151539 | { |
| 150896 | | - Select *p = yymsp[0].minor.yy423; |
| 151540 | + Select *p = yymsp[0].minor.yy491; |
| 150897 | 151541 | if( p ){ |
| 150898 | 151542 | parserDoubleLinkSelect(pParse, p); |
| 150899 | 151543 | } |
| 150900 | | - yymsp[0].minor.yy423 = p; /*A-overwrites-X*/ |
| 151544 | + yymsp[0].minor.yy491 = p; /*A-overwrites-X*/ |
| 150901 | 151545 | } |
| 150902 | 151546 | break; |
| 150903 | 151547 | case 83: /* selectnowith ::= selectnowith multiselect_op oneselect */ |
| 150904 | 151548 | { |
| 150905 | | - Select *pRhs = yymsp[0].minor.yy423; |
| 150906 | | - Select *pLhs = yymsp[-2].minor.yy423; |
| 151549 | + Select *pRhs = yymsp[0].minor.yy491; |
| 151550 | + Select *pLhs = yymsp[-2].minor.yy491; |
| 150907 | 151551 | if( pRhs && pRhs->pPrior ){ |
| 150908 | 151552 | SrcList *pFrom; |
| 150909 | 151553 | Token x; |
| 150910 | 151554 | x.n = 0; |
| 150911 | 151555 | parserDoubleLinkSelect(pParse, pRhs); |
| 150912 | 151556 | pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0); |
| 150913 | 151557 | pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0); |
| 150914 | 151558 | } |
| 150915 | 151559 | if( pRhs ){ |
| 150916 | | - pRhs->op = (u8)yymsp[-1].minor.yy96; |
| 151560 | + pRhs->op = (u8)yymsp[-1].minor.yy420; |
| 150917 | 151561 | pRhs->pPrior = pLhs; |
| 150918 | 151562 | if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue; |
| 150919 | 151563 | pRhs->selFlags &= ~SF_MultiValue; |
| 150920 | | - if( yymsp[-1].minor.yy96!=TK_ALL ) pParse->hasCompound = 1; |
| 151564 | + if( yymsp[-1].minor.yy420!=TK_ALL ) pParse->hasCompound = 1; |
| 150921 | 151565 | }else{ |
| 150922 | 151566 | sqlite3SelectDelete(pParse->db, pLhs); |
| 150923 | 151567 | } |
| 150924 | | - yymsp[-2].minor.yy423 = pRhs; |
| 151568 | + yymsp[-2].minor.yy491 = pRhs; |
| 150925 | 151569 | } |
| 150926 | 151570 | break; |
| 150927 | 151571 | case 84: /* multiselect_op ::= UNION */ |
| 150928 | 151572 | case 86: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==86); |
| 150929 | | -{yymsp[0].minor.yy96 = yymsp[0].major; /*A-overwrites-OP*/} |
| 151573 | +{yymsp[0].minor.yy420 = yymsp[0].major; /*A-overwrites-OP*/} |
| 150930 | 151574 | break; |
| 150931 | 151575 | case 85: /* multiselect_op ::= UNION ALL */ |
| 150932 | | -{yymsp[-1].minor.yy96 = TK_ALL;} |
| 151576 | +{yymsp[-1].minor.yy420 = TK_ALL;} |
| 150933 | 151577 | break; |
| 150934 | 151578 | case 87: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ |
| 150935 | 151579 | { |
| 150936 | | - yymsp[-8].minor.yy423 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy42,yymsp[-5].minor.yy167,yymsp[-4].minor.yy490,yymsp[-3].minor.yy42,yymsp[-2].minor.yy490,yymsp[-1].minor.yy42,yymsp[-7].minor.yy96,yymsp[0].minor.yy490); |
| 151580 | + yymsp[-8].minor.yy491 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy442,yymsp[-5].minor.yy147,yymsp[-4].minor.yy130,yymsp[-3].minor.yy442,yymsp[-2].minor.yy130,yymsp[-1].minor.yy442,yymsp[-7].minor.yy420,yymsp[0].minor.yy130); |
| 150937 | 151581 | } |
| 150938 | 151582 | break; |
| 150939 | 151583 | case 88: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ |
| 150940 | 151584 | { |
| 150941 | | - yymsp[-9].minor.yy423 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy42,yymsp[-6].minor.yy167,yymsp[-5].minor.yy490,yymsp[-4].minor.yy42,yymsp[-3].minor.yy490,yymsp[-1].minor.yy42,yymsp[-8].minor.yy96,yymsp[0].minor.yy490); |
| 150942 | | - if( yymsp[-9].minor.yy423 ){ |
| 150943 | | - yymsp[-9].minor.yy423->pWinDefn = yymsp[-2].minor.yy147; |
| 151585 | + yymsp[-9].minor.yy491 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy442,yymsp[-6].minor.yy147,yymsp[-5].minor.yy130,yymsp[-4].minor.yy442,yymsp[-3].minor.yy130,yymsp[-1].minor.yy442,yymsp[-8].minor.yy420,yymsp[0].minor.yy130); |
| 151586 | + if( yymsp[-9].minor.yy491 ){ |
| 151587 | + yymsp[-9].minor.yy491->pWinDefn = yymsp[-2].minor.yy395; |
| 150944 | 151588 | }else{ |
| 150945 | | - sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy147); |
| 151589 | + sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy395); |
| 150946 | 151590 | } |
| 150947 | 151591 | } |
| 150948 | 151592 | break; |
| 150949 | 151593 | case 89: /* values ::= VALUES LP nexprlist RP */ |
| 150950 | 151594 | { |
| 150951 | | - yymsp[-3].minor.yy423 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy42,0,0,0,0,0,SF_Values,0); |
| 151595 | + yymsp[-3].minor.yy491 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy442,0,0,0,0,0,SF_Values,0); |
| 150952 | 151596 | } |
| 150953 | 151597 | break; |
| 150954 | 151598 | case 90: /* values ::= values COMMA LP nexprlist RP */ |
| 150955 | 151599 | { |
| 150956 | | - Select *pRight, *pLeft = yymsp[-4].minor.yy423; |
| 150957 | | - pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy42,0,0,0,0,0,SF_Values|SF_MultiValue,0); |
| 151600 | + Select *pRight, *pLeft = yymsp[-4].minor.yy491; |
| 151601 | + pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy442,0,0,0,0,0,SF_Values|SF_MultiValue,0); |
| 150958 | 151602 | if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue; |
| 150959 | 151603 | if( pRight ){ |
| 150960 | 151604 | pRight->op = TK_ALL; |
| 150961 | 151605 | pRight->pPrior = pLeft; |
| 150962 | | - yymsp[-4].minor.yy423 = pRight; |
| 151606 | + yymsp[-4].minor.yy491 = pRight; |
| 150963 | 151607 | }else{ |
| 150964 | | - yymsp[-4].minor.yy423 = pLeft; |
| 151608 | + yymsp[-4].minor.yy491 = pLeft; |
| 150965 | 151609 | } |
| 150966 | 151610 | } |
| 150967 | 151611 | break; |
| 150968 | 151612 | case 91: /* distinct ::= DISTINCT */ |
| 150969 | | -{yymsp[0].minor.yy96 = SF_Distinct;} |
| 151613 | +{yymsp[0].minor.yy420 = SF_Distinct;} |
| 150970 | 151614 | break; |
| 150971 | 151615 | case 92: /* distinct ::= ALL */ |
| 150972 | | -{yymsp[0].minor.yy96 = SF_All;} |
| 151616 | +{yymsp[0].minor.yy420 = SF_All;} |
| 150973 | 151617 | break; |
| 150974 | 151618 | case 94: /* sclp ::= */ |
| 150975 | 151619 | case 127: /* orderby_opt ::= */ yytestcase(yyruleno==127); |
| 150976 | 151620 | case 134: /* groupby_opt ::= */ yytestcase(yyruleno==134); |
| 150977 | 151621 | case 214: /* exprlist ::= */ yytestcase(yyruleno==214); |
| 150978 | 151622 | case 217: /* paren_exprlist ::= */ yytestcase(yyruleno==217); |
| 150979 | 151623 | case 222: /* eidlist_opt ::= */ yytestcase(yyruleno==222); |
| 150980 | | -{yymsp[1].minor.yy42 = 0;} |
| 151624 | +{yymsp[1].minor.yy442 = 0;} |
| 150981 | 151625 | break; |
| 150982 | 151626 | case 95: /* selcollist ::= sclp scanpt expr scanpt as */ |
| 150983 | 151627 | { |
| 150984 | | - yymsp[-4].minor.yy42 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy42, yymsp[-2].minor.yy490); |
| 150985 | | - if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy42, &yymsp[0].minor.yy0, 1); |
| 150986 | | - sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy42,yymsp[-3].minor.yy464,yymsp[-1].minor.yy464); |
| 151628 | + yymsp[-4].minor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy442, yymsp[-2].minor.yy130); |
| 151629 | + if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy442, &yymsp[0].minor.yy0, 1); |
| 151630 | + sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy442,yymsp[-3].minor.yy104,yymsp[-1].minor.yy104); |
| 150987 | 151631 | } |
| 150988 | 151632 | break; |
| 150989 | 151633 | case 96: /* selcollist ::= sclp scanpt STAR */ |
| 150990 | 151634 | { |
| 150991 | 151635 | Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0); |
| 150992 | | - yymsp[-2].minor.yy42 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy42, p); |
| 151636 | + yymsp[-2].minor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy442, p); |
| 150993 | 151637 | } |
| 150994 | 151638 | break; |
| 150995 | 151639 | case 97: /* selcollist ::= sclp scanpt nm DOT STAR */ |
| 150996 | 151640 | { |
| 150997 | 151641 | Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0); |
| 150998 | 151642 | Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); |
| 150999 | 151643 | Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight); |
| 151000 | | - yymsp[-4].minor.yy42 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy42, pDot); |
| 151644 | + yymsp[-4].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, pDot); |
| 151001 | 151645 | } |
| 151002 | 151646 | break; |
| 151003 | 151647 | case 98: /* as ::= AS nm */ |
| 151004 | 151648 | case 109: /* dbnm ::= DOT nm */ yytestcase(yyruleno==109); |
| 151005 | 151649 | case 238: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==238); |
| 151006 | 151650 | case 239: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==239); |
| 151007 | 151651 | {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} |
| 151008 | 151652 | break; |
| 151009 | 151653 | case 100: /* from ::= */ |
| 151010 | | -{yymsp[1].minor.yy167 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy167));} |
| 151654 | +{yymsp[1].minor.yy147 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy147));} |
| 151011 | 151655 | break; |
| 151012 | 151656 | case 101: /* from ::= FROM seltablist */ |
| 151013 | 151657 | { |
| 151014 | | - yymsp[-1].minor.yy167 = yymsp[0].minor.yy167; |
| 151015 | | - sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy167); |
| 151658 | + yymsp[-1].minor.yy147 = yymsp[0].minor.yy147; |
| 151659 | + sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy147); |
| 151016 | 151660 | } |
| 151017 | 151661 | break; |
| 151018 | 151662 | case 102: /* stl_prefix ::= seltablist joinop */ |
| 151019 | 151663 | { |
| 151020 | | - if( ALWAYS(yymsp[-1].minor.yy167 && yymsp[-1].minor.yy167->nSrc>0) ) yymsp[-1].minor.yy167->a[yymsp[-1].minor.yy167->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy96; |
| 151664 | + if( ALWAYS(yymsp[-1].minor.yy147 && yymsp[-1].minor.yy147->nSrc>0) ) yymsp[-1].minor.yy147->a[yymsp[-1].minor.yy147->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy420; |
| 151021 | 151665 | } |
| 151022 | 151666 | break; |
| 151023 | 151667 | case 103: /* stl_prefix ::= */ |
| 151024 | | -{yymsp[1].minor.yy167 = 0;} |
| 151668 | +{yymsp[1].minor.yy147 = 0;} |
| 151025 | 151669 | break; |
| 151026 | 151670 | case 104: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ |
| 151027 | 151671 | { |
| 151028 | | - yymsp[-6].minor.yy167 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy167,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy490,yymsp[0].minor.yy336); |
| 151029 | | - sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy167, &yymsp[-2].minor.yy0); |
| 151672 | + yymsp[-6].minor.yy147 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy147,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy130,yymsp[0].minor.yy200); |
| 151673 | + sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy147, &yymsp[-2].minor.yy0); |
| 151030 | 151674 | } |
| 151031 | 151675 | break; |
| 151032 | 151676 | case 105: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ |
| 151033 | 151677 | { |
| 151034 | | - yymsp[-8].minor.yy167 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy167,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy490,yymsp[0].minor.yy336); |
| 151035 | | - sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy167, yymsp[-4].minor.yy42); |
| 151678 | + yymsp[-8].minor.yy147 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy147,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy130,yymsp[0].minor.yy200); |
| 151679 | + sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy147, yymsp[-4].minor.yy442); |
| 151036 | 151680 | } |
| 151037 | 151681 | break; |
| 151038 | 151682 | case 106: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ |
| 151039 | 151683 | { |
| 151040 | | - yymsp[-6].minor.yy167 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy167,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy423,yymsp[-1].minor.yy490,yymsp[0].minor.yy336); |
| 151684 | + yymsp[-6].minor.yy147 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy147,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy491,yymsp[-1].minor.yy130,yymsp[0].minor.yy200); |
| 151041 | 151685 | } |
| 151042 | 151686 | break; |
| 151043 | 151687 | case 107: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ |
| 151044 | 151688 | { |
| 151045 | | - if( yymsp[-6].minor.yy167==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy490==0 && yymsp[0].minor.yy336==0 ){ |
| 151046 | | - yymsp[-6].minor.yy167 = yymsp[-4].minor.yy167; |
| 151047 | | - }else if( yymsp[-4].minor.yy167->nSrc==1 ){ |
| 151048 | | - yymsp[-6].minor.yy167 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy167,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy490,yymsp[0].minor.yy336); |
| 151049 | | - if( yymsp[-6].minor.yy167 ){ |
| 151050 | | - struct SrcList_item *pNew = &yymsp[-6].minor.yy167->a[yymsp[-6].minor.yy167->nSrc-1]; |
| 151051 | | - struct SrcList_item *pOld = yymsp[-4].minor.yy167->a; |
| 151689 | + if( yymsp[-6].minor.yy147==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy130==0 && yymsp[0].minor.yy200==0 ){ |
| 151690 | + yymsp[-6].minor.yy147 = yymsp[-4].minor.yy147; |
| 151691 | + }else if( yymsp[-4].minor.yy147->nSrc==1 ){ |
| 151692 | + yymsp[-6].minor.yy147 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy147,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy130,yymsp[0].minor.yy200); |
| 151693 | + if( yymsp[-6].minor.yy147 ){ |
| 151694 | + struct SrcList_item *pNew = &yymsp[-6].minor.yy147->a[yymsp[-6].minor.yy147->nSrc-1]; |
| 151695 | + struct SrcList_item *pOld = yymsp[-4].minor.yy147->a; |
| 151052 | 151696 | pNew->zName = pOld->zName; |
| 151053 | 151697 | pNew->zDatabase = pOld->zDatabase; |
| 151054 | 151698 | pNew->pSelect = pOld->pSelect; |
| 151055 | 151699 | if( pOld->fg.isTabFunc ){ |
| 151056 | 151700 | pNew->u1.pFuncArg = pOld->u1.pFuncArg; |
| | @@ -151059,215 +151703,215 @@ |
| 151059 | 151703 | pNew->fg.isTabFunc = 1; |
| 151060 | 151704 | } |
| 151061 | 151705 | pOld->zName = pOld->zDatabase = 0; |
| 151062 | 151706 | pOld->pSelect = 0; |
| 151063 | 151707 | } |
| 151064 | | - sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy167); |
| 151708 | + sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy147); |
| 151065 | 151709 | }else{ |
| 151066 | 151710 | Select *pSubquery; |
| 151067 | | - sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy167); |
| 151068 | | - pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy167,0,0,0,0,SF_NestedFrom,0); |
| 151069 | | - yymsp[-6].minor.yy167 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy167,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy490,yymsp[0].minor.yy336); |
| 151711 | + sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy147); |
| 151712 | + pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy147,0,0,0,0,SF_NestedFrom,0); |
| 151713 | + yymsp[-6].minor.yy147 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy147,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy130,yymsp[0].minor.yy200); |
| 151070 | 151714 | } |
| 151071 | 151715 | } |
| 151072 | 151716 | break; |
| 151073 | 151717 | case 108: /* dbnm ::= */ |
| 151074 | 151718 | case 122: /* indexed_opt ::= */ yytestcase(yyruleno==122); |
| 151075 | 151719 | {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;} |
| 151076 | 151720 | break; |
| 151077 | 151721 | case 110: /* fullname ::= nm */ |
| 151078 | 151722 | { |
| 151079 | | - yylhsminor.yy167 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); |
| 151080 | | - if( IN_RENAME_OBJECT && yylhsminor.yy167 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy167->a[0].zName, &yymsp[0].minor.yy0); |
| 151723 | + yylhsminor.yy147 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); |
| 151724 | + if( IN_RENAME_OBJECT && yylhsminor.yy147 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy147->a[0].zName, &yymsp[0].minor.yy0); |
| 151081 | 151725 | } |
| 151082 | | - yymsp[0].minor.yy167 = yylhsminor.yy167; |
| 151726 | + yymsp[0].minor.yy147 = yylhsminor.yy147; |
| 151083 | 151727 | break; |
| 151084 | 151728 | case 111: /* fullname ::= nm DOT nm */ |
| 151085 | 151729 | { |
| 151086 | | - yylhsminor.yy167 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); |
| 151087 | | - if( IN_RENAME_OBJECT && yylhsminor.yy167 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy167->a[0].zName, &yymsp[0].minor.yy0); |
| 151730 | + yylhsminor.yy147 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); |
| 151731 | + if( IN_RENAME_OBJECT && yylhsminor.yy147 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy147->a[0].zName, &yymsp[0].minor.yy0); |
| 151088 | 151732 | } |
| 151089 | | - yymsp[-2].minor.yy167 = yylhsminor.yy167; |
| 151733 | + yymsp[-2].minor.yy147 = yylhsminor.yy147; |
| 151090 | 151734 | break; |
| 151091 | 151735 | case 112: /* xfullname ::= nm */ |
| 151092 | | -{yymsp[0].minor.yy167 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} |
| 151736 | +{yymsp[0].minor.yy147 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} |
| 151093 | 151737 | break; |
| 151094 | 151738 | case 113: /* xfullname ::= nm DOT nm */ |
| 151095 | | -{yymsp[-2].minor.yy167 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 151739 | +{yymsp[-2].minor.yy147 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 151096 | 151740 | break; |
| 151097 | 151741 | case 114: /* xfullname ::= nm DOT nm AS nm */ |
| 151098 | 151742 | { |
| 151099 | | - yymsp[-4].minor.yy167 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ |
| 151100 | | - if( yymsp[-4].minor.yy167 ) yymsp[-4].minor.yy167->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); |
| 151743 | + yymsp[-4].minor.yy147 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ |
| 151744 | + if( yymsp[-4].minor.yy147 ) yymsp[-4].minor.yy147->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); |
| 151101 | 151745 | } |
| 151102 | 151746 | break; |
| 151103 | 151747 | case 115: /* xfullname ::= nm AS nm */ |
| 151104 | 151748 | { |
| 151105 | | - yymsp[-2].minor.yy167 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/ |
| 151106 | | - if( yymsp[-2].minor.yy167 ) yymsp[-2].minor.yy167->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); |
| 151749 | + yymsp[-2].minor.yy147 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/ |
| 151750 | + if( yymsp[-2].minor.yy147 ) yymsp[-2].minor.yy147->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); |
| 151107 | 151751 | } |
| 151108 | 151752 | break; |
| 151109 | 151753 | case 116: /* joinop ::= COMMA|JOIN */ |
| 151110 | | -{ yymsp[0].minor.yy96 = JT_INNER; } |
| 151754 | +{ yymsp[0].minor.yy420 = JT_INNER; } |
| 151111 | 151755 | break; |
| 151112 | 151756 | case 117: /* joinop ::= JOIN_KW JOIN */ |
| 151113 | | -{yymsp[-1].minor.yy96 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} |
| 151757 | +{yymsp[-1].minor.yy420 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} |
| 151114 | 151758 | break; |
| 151115 | 151759 | case 118: /* joinop ::= JOIN_KW nm JOIN */ |
| 151116 | | -{yymsp[-2].minor.yy96 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} |
| 151760 | +{yymsp[-2].minor.yy420 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} |
| 151117 | 151761 | break; |
| 151118 | 151762 | case 119: /* joinop ::= JOIN_KW nm nm JOIN */ |
| 151119 | | -{yymsp[-3].minor.yy96 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} |
| 151763 | +{yymsp[-3].minor.yy420 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} |
| 151120 | 151764 | break; |
| 151121 | 151765 | case 120: /* on_opt ::= ON expr */ |
| 151122 | 151766 | case 137: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==137); |
| 151123 | 151767 | case 144: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==144); |
| 151124 | 151768 | case 210: /* case_else ::= ELSE expr */ yytestcase(yyruleno==210); |
| 151125 | 151769 | case 231: /* vinto ::= INTO expr */ yytestcase(yyruleno==231); |
| 151126 | | -{yymsp[-1].minor.yy490 = yymsp[0].minor.yy490;} |
| 151770 | +{yymsp[-1].minor.yy130 = yymsp[0].minor.yy130;} |
| 151127 | 151771 | break; |
| 151128 | 151772 | case 121: /* on_opt ::= */ |
| 151129 | 151773 | case 136: /* having_opt ::= */ yytestcase(yyruleno==136); |
| 151130 | 151774 | case 138: /* limit_opt ::= */ yytestcase(yyruleno==138); |
| 151131 | 151775 | case 143: /* where_opt ::= */ yytestcase(yyruleno==143); |
| 151132 | 151776 | case 211: /* case_else ::= */ yytestcase(yyruleno==211); |
| 151133 | 151777 | case 213: /* case_operand ::= */ yytestcase(yyruleno==213); |
| 151134 | 151778 | case 232: /* vinto ::= */ yytestcase(yyruleno==232); |
| 151135 | | -{yymsp[1].minor.yy490 = 0;} |
| 151779 | +{yymsp[1].minor.yy130 = 0;} |
| 151136 | 151780 | break; |
| 151137 | 151781 | case 123: /* indexed_opt ::= INDEXED BY nm */ |
| 151138 | 151782 | {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;} |
| 151139 | 151783 | break; |
| 151140 | 151784 | case 124: /* indexed_opt ::= NOT INDEXED */ |
| 151141 | 151785 | {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;} |
| 151142 | 151786 | break; |
| 151143 | 151787 | case 125: /* using_opt ::= USING LP idlist RP */ |
| 151144 | | -{yymsp[-3].minor.yy336 = yymsp[-1].minor.yy336;} |
| 151788 | +{yymsp[-3].minor.yy200 = yymsp[-1].minor.yy200;} |
| 151145 | 151789 | break; |
| 151146 | 151790 | case 126: /* using_opt ::= */ |
| 151147 | 151791 | case 158: /* idlist_opt ::= */ yytestcase(yyruleno==158); |
| 151148 | | -{yymsp[1].minor.yy336 = 0;} |
| 151792 | +{yymsp[1].minor.yy200 = 0;} |
| 151149 | 151793 | break; |
| 151150 | 151794 | case 128: /* orderby_opt ::= ORDER BY sortlist */ |
| 151151 | 151795 | case 135: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==135); |
| 151152 | | -{yymsp[-2].minor.yy42 = yymsp[0].minor.yy42;} |
| 151796 | +{yymsp[-2].minor.yy442 = yymsp[0].minor.yy442;} |
| 151153 | 151797 | break; |
| 151154 | 151798 | case 129: /* sortlist ::= sortlist COMMA expr sortorder */ |
| 151155 | 151799 | { |
| 151156 | | - yymsp[-3].minor.yy42 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy42,yymsp[-1].minor.yy490); |
| 151157 | | - sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy42,yymsp[0].minor.yy96); |
| 151800 | + yymsp[-3].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442,yymsp[-1].minor.yy130); |
| 151801 | + sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy442,yymsp[0].minor.yy420); |
| 151158 | 151802 | } |
| 151159 | 151803 | break; |
| 151160 | 151804 | case 130: /* sortlist ::= expr sortorder */ |
| 151161 | 151805 | { |
| 151162 | | - yymsp[-1].minor.yy42 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy490); /*A-overwrites-Y*/ |
| 151163 | | - sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy42,yymsp[0].minor.yy96); |
| 151806 | + yymsp[-1].minor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy130); /*A-overwrites-Y*/ |
| 151807 | + sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy442,yymsp[0].minor.yy420); |
| 151164 | 151808 | } |
| 151165 | 151809 | break; |
| 151166 | 151810 | case 131: /* sortorder ::= ASC */ |
| 151167 | | -{yymsp[0].minor.yy96 = SQLITE_SO_ASC;} |
| 151811 | +{yymsp[0].minor.yy420 = SQLITE_SO_ASC;} |
| 151168 | 151812 | break; |
| 151169 | 151813 | case 132: /* sortorder ::= DESC */ |
| 151170 | | -{yymsp[0].minor.yy96 = SQLITE_SO_DESC;} |
| 151814 | +{yymsp[0].minor.yy420 = SQLITE_SO_DESC;} |
| 151171 | 151815 | break; |
| 151172 | 151816 | case 133: /* sortorder ::= */ |
| 151173 | | -{yymsp[1].minor.yy96 = SQLITE_SO_UNDEFINED;} |
| 151817 | +{yymsp[1].minor.yy420 = SQLITE_SO_UNDEFINED;} |
| 151174 | 151818 | break; |
| 151175 | 151819 | case 139: /* limit_opt ::= LIMIT expr */ |
| 151176 | | -{yymsp[-1].minor.yy490 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy490,0);} |
| 151820 | +{yymsp[-1].minor.yy130 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy130,0);} |
| 151177 | 151821 | break; |
| 151178 | 151822 | case 140: /* limit_opt ::= LIMIT expr OFFSET expr */ |
| 151179 | | -{yymsp[-3].minor.yy490 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy490,yymsp[0].minor.yy490);} |
| 151823 | +{yymsp[-3].minor.yy130 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy130,yymsp[0].minor.yy130);} |
| 151180 | 151824 | break; |
| 151181 | 151825 | case 141: /* limit_opt ::= LIMIT expr COMMA expr */ |
| 151182 | | -{yymsp[-3].minor.yy490 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy490,yymsp[-2].minor.yy490);} |
| 151826 | +{yymsp[-3].minor.yy130 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy130,yymsp[-2].minor.yy130);} |
| 151183 | 151827 | break; |
| 151184 | 151828 | case 142: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt */ |
| 151185 | 151829 | { |
| 151186 | | - sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy167, &yymsp[-1].minor.yy0); |
| 151187 | | - sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy167,yymsp[0].minor.yy490,0,0); |
| 151830 | + sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy147, &yymsp[-1].minor.yy0); |
| 151831 | + sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy147,yymsp[0].minor.yy130,0,0); |
| 151188 | 151832 | } |
| 151189 | 151833 | break; |
| 151190 | 151834 | case 145: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */ |
| 151191 | 151835 | { |
| 151192 | | - sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy167, &yymsp[-3].minor.yy0); |
| 151193 | | - sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy42,"set list"); |
| 151194 | | - sqlite3Update(pParse,yymsp[-4].minor.yy167,yymsp[-1].minor.yy42,yymsp[0].minor.yy490,yymsp[-5].minor.yy96,0,0,0); |
| 151836 | + sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy147, &yymsp[-3].minor.yy0); |
| 151837 | + sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy442,"set list"); |
| 151838 | + sqlite3Update(pParse,yymsp[-4].minor.yy147,yymsp[-1].minor.yy442,yymsp[0].minor.yy130,yymsp[-5].minor.yy420,0,0,0); |
| 151195 | 151839 | } |
| 151196 | 151840 | break; |
| 151197 | 151841 | case 146: /* setlist ::= setlist COMMA nm EQ expr */ |
| 151198 | 151842 | { |
| 151199 | | - yymsp[-4].minor.yy42 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy42, yymsp[0].minor.yy490); |
| 151200 | | - sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy42, &yymsp[-2].minor.yy0, 1); |
| 151843 | + yymsp[-4].minor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy442, yymsp[0].minor.yy130); |
| 151844 | + sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy442, &yymsp[-2].minor.yy0, 1); |
| 151201 | 151845 | } |
| 151202 | 151846 | break; |
| 151203 | 151847 | case 147: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ |
| 151204 | 151848 | { |
| 151205 | | - yymsp[-6].minor.yy42 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy42, yymsp[-3].minor.yy336, yymsp[0].minor.yy490); |
| 151849 | + yymsp[-6].minor.yy442 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy442, yymsp[-3].minor.yy200, yymsp[0].minor.yy130); |
| 151206 | 151850 | } |
| 151207 | 151851 | break; |
| 151208 | 151852 | case 148: /* setlist ::= nm EQ expr */ |
| 151209 | 151853 | { |
| 151210 | | - yylhsminor.yy42 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy490); |
| 151211 | | - sqlite3ExprListSetName(pParse, yylhsminor.yy42, &yymsp[-2].minor.yy0, 1); |
| 151854 | + yylhsminor.yy442 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy130); |
| 151855 | + sqlite3ExprListSetName(pParse, yylhsminor.yy442, &yymsp[-2].minor.yy0, 1); |
| 151212 | 151856 | } |
| 151213 | | - yymsp[-2].minor.yy42 = yylhsminor.yy42; |
| 151857 | + yymsp[-2].minor.yy442 = yylhsminor.yy442; |
| 151214 | 151858 | break; |
| 151215 | 151859 | case 149: /* setlist ::= LP idlist RP EQ expr */ |
| 151216 | 151860 | { |
| 151217 | | - yymsp[-4].minor.yy42 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy336, yymsp[0].minor.yy490); |
| 151861 | + yymsp[-4].minor.yy442 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy200, yymsp[0].minor.yy130); |
| 151218 | 151862 | } |
| 151219 | 151863 | break; |
| 151220 | 151864 | case 150: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ |
| 151221 | 151865 | { |
| 151222 | | - sqlite3Insert(pParse, yymsp[-3].minor.yy167, yymsp[-1].minor.yy423, yymsp[-2].minor.yy336, yymsp[-5].minor.yy96, yymsp[0].minor.yy266); |
| 151866 | + sqlite3Insert(pParse, yymsp[-3].minor.yy147, yymsp[-1].minor.yy491, yymsp[-2].minor.yy200, yymsp[-5].minor.yy420, yymsp[0].minor.yy426); |
| 151223 | 151867 | } |
| 151224 | 151868 | break; |
| 151225 | 151869 | case 151: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */ |
| 151226 | 151870 | { |
| 151227 | | - sqlite3Insert(pParse, yymsp[-3].minor.yy167, 0, yymsp[-2].minor.yy336, yymsp[-5].minor.yy96, 0); |
| 151871 | + sqlite3Insert(pParse, yymsp[-3].minor.yy147, 0, yymsp[-2].minor.yy200, yymsp[-5].minor.yy420, 0); |
| 151228 | 151872 | } |
| 151229 | 151873 | break; |
| 151230 | 151874 | case 152: /* upsert ::= */ |
| 151231 | | -{ yymsp[1].minor.yy266 = 0; } |
| 151875 | +{ yymsp[1].minor.yy426 = 0; } |
| 151232 | 151876 | break; |
| 151233 | 151877 | case 153: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */ |
| 151234 | | -{ yymsp[-10].minor.yy266 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy42,yymsp[-5].minor.yy490,yymsp[-1].minor.yy42,yymsp[0].minor.yy490);} |
| 151878 | +{ yymsp[-10].minor.yy426 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy442,yymsp[-5].minor.yy130,yymsp[-1].minor.yy442,yymsp[0].minor.yy130);} |
| 151235 | 151879 | break; |
| 151236 | 151880 | case 154: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */ |
| 151237 | | -{ yymsp[-7].minor.yy266 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy42,yymsp[-2].minor.yy490,0,0); } |
| 151881 | +{ yymsp[-7].minor.yy426 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy442,yymsp[-2].minor.yy130,0,0); } |
| 151238 | 151882 | break; |
| 151239 | 151883 | case 155: /* upsert ::= ON CONFLICT DO NOTHING */ |
| 151240 | | -{ yymsp[-3].minor.yy266 = sqlite3UpsertNew(pParse->db,0,0,0,0); } |
| 151884 | +{ yymsp[-3].minor.yy426 = sqlite3UpsertNew(pParse->db,0,0,0,0); } |
| 151241 | 151885 | break; |
| 151242 | 151886 | case 159: /* idlist_opt ::= LP idlist RP */ |
| 151243 | | -{yymsp[-2].minor.yy336 = yymsp[-1].minor.yy336;} |
| 151887 | +{yymsp[-2].minor.yy200 = yymsp[-1].minor.yy200;} |
| 151244 | 151888 | break; |
| 151245 | 151889 | case 160: /* idlist ::= idlist COMMA nm */ |
| 151246 | | -{yymsp[-2].minor.yy336 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy336,&yymsp[0].minor.yy0);} |
| 151890 | +{yymsp[-2].minor.yy200 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy200,&yymsp[0].minor.yy0);} |
| 151247 | 151891 | break; |
| 151248 | 151892 | case 161: /* idlist ::= nm */ |
| 151249 | | -{yymsp[0].minor.yy336 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} |
| 151893 | +{yymsp[0].minor.yy200 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} |
| 151250 | 151894 | break; |
| 151251 | 151895 | case 162: /* expr ::= LP expr RP */ |
| 151252 | | -{yymsp[-2].minor.yy490 = yymsp[-1].minor.yy490;} |
| 151896 | +{yymsp[-2].minor.yy130 = yymsp[-1].minor.yy130;} |
| 151253 | 151897 | break; |
| 151254 | 151898 | case 163: /* expr ::= ID|INDEXED */ |
| 151255 | 151899 | case 164: /* expr ::= JOIN_KW */ yytestcase(yyruleno==164); |
| 151256 | | -{yymsp[0].minor.yy490=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 151900 | +{yymsp[0].minor.yy130=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 151257 | 151901 | break; |
| 151258 | 151902 | case 165: /* expr ::= nm DOT nm */ |
| 151259 | 151903 | { |
| 151260 | 151904 | Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); |
| 151261 | 151905 | Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); |
| 151262 | 151906 | if( IN_RENAME_OBJECT ){ |
| 151263 | 151907 | sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0); |
| 151264 | 151908 | sqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0); |
| 151265 | 151909 | } |
| 151266 | | - yylhsminor.yy490 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); |
| 151910 | + yylhsminor.yy130 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); |
| 151267 | 151911 | } |
| 151268 | | - yymsp[-2].minor.yy490 = yylhsminor.yy490; |
| 151912 | + yymsp[-2].minor.yy130 = yylhsminor.yy130; |
| 151269 | 151913 | break; |
| 151270 | 151914 | case 166: /* expr ::= nm DOT nm DOT nm */ |
| 151271 | 151915 | { |
| 151272 | 151916 | Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1); |
| 151273 | 151917 | Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); |
| | @@ -151275,95 +151919,95 @@ |
| 151275 | 151919 | Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3); |
| 151276 | 151920 | if( IN_RENAME_OBJECT ){ |
| 151277 | 151921 | sqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0); |
| 151278 | 151922 | sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0); |
| 151279 | 151923 | } |
| 151280 | | - yylhsminor.yy490 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); |
| 151924 | + yylhsminor.yy130 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); |
| 151281 | 151925 | } |
| 151282 | | - yymsp[-4].minor.yy490 = yylhsminor.yy490; |
| 151926 | + yymsp[-4].minor.yy130 = yylhsminor.yy130; |
| 151283 | 151927 | break; |
| 151284 | 151928 | case 167: /* term ::= NULL|FLOAT|BLOB */ |
| 151285 | 151929 | case 168: /* term ::= STRING */ yytestcase(yyruleno==168); |
| 151286 | | -{yymsp[0].minor.yy490=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 151930 | +{yymsp[0].minor.yy130=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 151287 | 151931 | break; |
| 151288 | 151932 | case 169: /* term ::= INTEGER */ |
| 151289 | 151933 | { |
| 151290 | | - yylhsminor.yy490 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); |
| 151934 | + yylhsminor.yy130 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); |
| 151291 | 151935 | } |
| 151292 | | - yymsp[0].minor.yy490 = yylhsminor.yy490; |
| 151936 | + yymsp[0].minor.yy130 = yylhsminor.yy130; |
| 151293 | 151937 | break; |
| 151294 | 151938 | case 170: /* expr ::= VARIABLE */ |
| 151295 | 151939 | { |
| 151296 | 151940 | if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){ |
| 151297 | 151941 | u32 n = yymsp[0].minor.yy0.n; |
| 151298 | | - yymsp[0].minor.yy490 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0); |
| 151299 | | - sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy490, n); |
| 151942 | + yymsp[0].minor.yy130 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0); |
| 151943 | + sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy130, n); |
| 151300 | 151944 | }else{ |
| 151301 | 151945 | /* When doing a nested parse, one can include terms in an expression |
| 151302 | 151946 | ** that look like this: #1 #2 ... These terms refer to registers |
| 151303 | 151947 | ** in the virtual machine. #N is the N-th register. */ |
| 151304 | 151948 | Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/ |
| 151305 | 151949 | assert( t.n>=2 ); |
| 151306 | 151950 | if( pParse->nested==0 ){ |
| 151307 | 151951 | sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t); |
| 151308 | | - yymsp[0].minor.yy490 = 0; |
| 151952 | + yymsp[0].minor.yy130 = 0; |
| 151309 | 151953 | }else{ |
| 151310 | | - yymsp[0].minor.yy490 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); |
| 151311 | | - if( yymsp[0].minor.yy490 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy490->iTable); |
| 151954 | + yymsp[0].minor.yy130 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); |
| 151955 | + if( yymsp[0].minor.yy130 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy130->iTable); |
| 151312 | 151956 | } |
| 151313 | 151957 | } |
| 151314 | 151958 | } |
| 151315 | 151959 | break; |
| 151316 | 151960 | case 171: /* expr ::= expr COLLATE ID|STRING */ |
| 151317 | 151961 | { |
| 151318 | | - yymsp[-2].minor.yy490 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy490, &yymsp[0].minor.yy0, 1); |
| 151962 | + yymsp[-2].minor.yy130 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy130, &yymsp[0].minor.yy0, 1); |
| 151319 | 151963 | } |
| 151320 | 151964 | break; |
| 151321 | 151965 | case 172: /* expr ::= CAST LP expr AS typetoken RP */ |
| 151322 | 151966 | { |
| 151323 | | - yymsp[-5].minor.yy490 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); |
| 151324 | | - sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy490, yymsp[-3].minor.yy490, 0); |
| 151967 | + yymsp[-5].minor.yy130 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); |
| 151968 | + sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy130, yymsp[-3].minor.yy130, 0); |
| 151325 | 151969 | } |
| 151326 | 151970 | break; |
| 151327 | 151971 | case 173: /* expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 151328 | 151972 | { |
| 151329 | | - yylhsminor.yy490 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy42, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy96); |
| 151973 | + yylhsminor.yy130 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy442, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy420); |
| 151330 | 151974 | } |
| 151331 | | - yymsp[-4].minor.yy490 = yylhsminor.yy490; |
| 151975 | + yymsp[-4].minor.yy130 = yylhsminor.yy130; |
| 151332 | 151976 | break; |
| 151333 | 151977 | case 174: /* expr ::= ID|INDEXED LP STAR RP */ |
| 151334 | 151978 | { |
| 151335 | | - yylhsminor.yy490 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0); |
| 151979 | + yylhsminor.yy130 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0); |
| 151336 | 151980 | } |
| 151337 | | - yymsp[-3].minor.yy490 = yylhsminor.yy490; |
| 151981 | + yymsp[-3].minor.yy130 = yylhsminor.yy130; |
| 151338 | 151982 | break; |
| 151339 | 151983 | case 175: /* expr ::= ID|INDEXED LP distinct exprlist RP over_clause */ |
| 151340 | 151984 | { |
| 151341 | | - yylhsminor.yy490 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy42, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy96); |
| 151342 | | - sqlite3WindowAttach(pParse, yylhsminor.yy490, yymsp[0].minor.yy147); |
| 151985 | + yylhsminor.yy130 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy442, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy420); |
| 151986 | + sqlite3WindowAttach(pParse, yylhsminor.yy130, yymsp[0].minor.yy395); |
| 151343 | 151987 | } |
| 151344 | | - yymsp[-5].minor.yy490 = yylhsminor.yy490; |
| 151988 | + yymsp[-5].minor.yy130 = yylhsminor.yy130; |
| 151345 | 151989 | break; |
| 151346 | 151990 | case 176: /* expr ::= ID|INDEXED LP STAR RP over_clause */ |
| 151347 | 151991 | { |
| 151348 | | - yylhsminor.yy490 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0); |
| 151349 | | - sqlite3WindowAttach(pParse, yylhsminor.yy490, yymsp[0].minor.yy147); |
| 151992 | + yylhsminor.yy130 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0); |
| 151993 | + sqlite3WindowAttach(pParse, yylhsminor.yy130, yymsp[0].minor.yy395); |
| 151350 | 151994 | } |
| 151351 | | - yymsp[-4].minor.yy490 = yylhsminor.yy490; |
| 151995 | + yymsp[-4].minor.yy130 = yylhsminor.yy130; |
| 151352 | 151996 | break; |
| 151353 | 151997 | case 177: /* term ::= CTIME_KW */ |
| 151354 | 151998 | { |
| 151355 | | - yylhsminor.yy490 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0); |
| 151999 | + yylhsminor.yy130 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0); |
| 151356 | 152000 | } |
| 151357 | | - yymsp[0].minor.yy490 = yylhsminor.yy490; |
| 152001 | + yymsp[0].minor.yy130 = yylhsminor.yy130; |
| 151358 | 152002 | break; |
| 151359 | 152003 | case 178: /* expr ::= LP nexprlist COMMA expr RP */ |
| 151360 | 152004 | { |
| 151361 | | - ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy42, yymsp[-1].minor.yy490); |
| 151362 | | - yymsp[-4].minor.yy490 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); |
| 151363 | | - if( yymsp[-4].minor.yy490 ){ |
| 151364 | | - yymsp[-4].minor.yy490->x.pList = pList; |
| 152005 | + ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy442, yymsp[-1].minor.yy130); |
| 152006 | + yymsp[-4].minor.yy130 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); |
| 152007 | + if( yymsp[-4].minor.yy130 ){ |
| 152008 | + yymsp[-4].minor.yy130->x.pList = pList; |
| 151365 | 152009 | }else{ |
| 151366 | 152010 | sqlite3ExprListDelete(pParse->db, pList); |
| 151367 | 152011 | } |
| 151368 | 152012 | } |
| 151369 | 152013 | break; |
| | @@ -151373,101 +152017,101 @@ |
| 151373 | 152017 | case 182: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==182); |
| 151374 | 152018 | case 183: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==183); |
| 151375 | 152019 | case 184: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==184); |
| 151376 | 152020 | case 185: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==185); |
| 151377 | 152021 | case 186: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==186); |
| 151378 | | -{yymsp[-2].minor.yy490=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy490,yymsp[0].minor.yy490);} |
| 152022 | +{yymsp[-2].minor.yy130=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy130,yymsp[0].minor.yy130);} |
| 151379 | 152023 | break; |
| 151380 | 152024 | case 187: /* likeop ::= NOT LIKE_KW|MATCH */ |
| 151381 | 152025 | {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/} |
| 151382 | 152026 | break; |
| 151383 | 152027 | case 188: /* expr ::= expr likeop expr */ |
| 151384 | 152028 | { |
| 151385 | 152029 | ExprList *pList; |
| 151386 | 152030 | int bNot = yymsp[-1].minor.yy0.n & 0x80000000; |
| 151387 | 152031 | yymsp[-1].minor.yy0.n &= 0x7fffffff; |
| 151388 | | - pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy490); |
| 151389 | | - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy490); |
| 151390 | | - yymsp[-2].minor.yy490 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); |
| 151391 | | - if( bNot ) yymsp[-2].minor.yy490 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy490, 0); |
| 151392 | | - if( yymsp[-2].minor.yy490 ) yymsp[-2].minor.yy490->flags |= EP_InfixFunc; |
| 152032 | + pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy130); |
| 152033 | + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy130); |
| 152034 | + yymsp[-2].minor.yy130 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); |
| 152035 | + if( bNot ) yymsp[-2].minor.yy130 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy130, 0); |
| 152036 | + if( yymsp[-2].minor.yy130 ) yymsp[-2].minor.yy130->flags |= EP_InfixFunc; |
| 151393 | 152037 | } |
| 151394 | 152038 | break; |
| 151395 | 152039 | case 189: /* expr ::= expr likeop expr ESCAPE expr */ |
| 151396 | 152040 | { |
| 151397 | 152041 | ExprList *pList; |
| 151398 | 152042 | int bNot = yymsp[-3].minor.yy0.n & 0x80000000; |
| 151399 | 152043 | yymsp[-3].minor.yy0.n &= 0x7fffffff; |
| 151400 | | - pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy490); |
| 151401 | | - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy490); |
| 151402 | | - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy490); |
| 151403 | | - yymsp[-4].minor.yy490 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0); |
| 151404 | | - if( bNot ) yymsp[-4].minor.yy490 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy490, 0); |
| 151405 | | - if( yymsp[-4].minor.yy490 ) yymsp[-4].minor.yy490->flags |= EP_InfixFunc; |
| 152044 | + pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy130); |
| 152045 | + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy130); |
| 152046 | + pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy130); |
| 152047 | + yymsp[-4].minor.yy130 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0); |
| 152048 | + if( bNot ) yymsp[-4].minor.yy130 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy130, 0); |
| 152049 | + if( yymsp[-4].minor.yy130 ) yymsp[-4].minor.yy130->flags |= EP_InfixFunc; |
| 151406 | 152050 | } |
| 151407 | 152051 | break; |
| 151408 | 152052 | case 190: /* expr ::= expr ISNULL|NOTNULL */ |
| 151409 | | -{yymsp[-1].minor.yy490 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy490,0);} |
| 152053 | +{yymsp[-1].minor.yy130 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy130,0);} |
| 151410 | 152054 | break; |
| 151411 | 152055 | case 191: /* expr ::= expr NOT NULL */ |
| 151412 | | -{yymsp[-2].minor.yy490 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy490,0);} |
| 152056 | +{yymsp[-2].minor.yy130 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy130,0);} |
| 151413 | 152057 | break; |
| 151414 | 152058 | case 192: /* expr ::= expr IS expr */ |
| 151415 | 152059 | { |
| 151416 | | - yymsp[-2].minor.yy490 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy490,yymsp[0].minor.yy490); |
| 151417 | | - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy490, yymsp[-2].minor.yy490, TK_ISNULL); |
| 152060 | + yymsp[-2].minor.yy130 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy130,yymsp[0].minor.yy130); |
| 152061 | + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy130, yymsp[-2].minor.yy130, TK_ISNULL); |
| 151418 | 152062 | } |
| 151419 | 152063 | break; |
| 151420 | 152064 | case 193: /* expr ::= expr IS NOT expr */ |
| 151421 | 152065 | { |
| 151422 | | - yymsp[-3].minor.yy490 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy490,yymsp[0].minor.yy490); |
| 151423 | | - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy490, yymsp[-3].minor.yy490, TK_NOTNULL); |
| 152066 | + yymsp[-3].minor.yy130 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy130,yymsp[0].minor.yy130); |
| 152067 | + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy130, yymsp[-3].minor.yy130, TK_NOTNULL); |
| 151424 | 152068 | } |
| 151425 | 152069 | break; |
| 151426 | 152070 | case 194: /* expr ::= NOT expr */ |
| 151427 | 152071 | case 195: /* expr ::= BITNOT expr */ yytestcase(yyruleno==195); |
| 151428 | | -{yymsp[-1].minor.yy490 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy490, 0);/*A-overwrites-B*/} |
| 152072 | +{yymsp[-1].minor.yy130 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy130, 0);/*A-overwrites-B*/} |
| 151429 | 152073 | break; |
| 151430 | 152074 | case 196: /* expr ::= PLUS|MINUS expr */ |
| 151431 | 152075 | { |
| 151432 | | - yymsp[-1].minor.yy490 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy490, 0); |
| 152076 | + yymsp[-1].minor.yy130 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy130, 0); |
| 151433 | 152077 | /*A-overwrites-B*/ |
| 151434 | 152078 | } |
| 151435 | 152079 | break; |
| 151436 | 152080 | case 197: /* between_op ::= BETWEEN */ |
| 151437 | 152081 | case 200: /* in_op ::= IN */ yytestcase(yyruleno==200); |
| 151438 | | -{yymsp[0].minor.yy96 = 0;} |
| 152082 | +{yymsp[0].minor.yy420 = 0;} |
| 151439 | 152083 | break; |
| 151440 | 152084 | case 199: /* expr ::= expr between_op expr AND expr */ |
| 151441 | 152085 | { |
| 151442 | | - ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy490); |
| 151443 | | - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy490); |
| 151444 | | - yymsp[-4].minor.yy490 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy490, 0); |
| 151445 | | - if( yymsp[-4].minor.yy490 ){ |
| 151446 | | - yymsp[-4].minor.yy490->x.pList = pList; |
| 152086 | + ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy130); |
| 152087 | + pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy130); |
| 152088 | + yymsp[-4].minor.yy130 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy130, 0); |
| 152089 | + if( yymsp[-4].minor.yy130 ){ |
| 152090 | + yymsp[-4].minor.yy130->x.pList = pList; |
| 151447 | 152091 | }else{ |
| 151448 | 152092 | sqlite3ExprListDelete(pParse->db, pList); |
| 151449 | 152093 | } |
| 151450 | | - if( yymsp[-3].minor.yy96 ) yymsp[-4].minor.yy490 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy490, 0); |
| 152094 | + if( yymsp[-3].minor.yy420 ) yymsp[-4].minor.yy130 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy130, 0); |
| 151451 | 152095 | } |
| 151452 | 152096 | break; |
| 151453 | 152097 | case 202: /* expr ::= expr in_op LP exprlist RP */ |
| 151454 | 152098 | { |
| 151455 | | - if( yymsp[-1].minor.yy42==0 ){ |
| 152099 | + if( yymsp[-1].minor.yy442==0 ){ |
| 151456 | 152100 | /* Expressions of the form |
| 151457 | 152101 | ** |
| 151458 | 152102 | ** expr1 IN () |
| 151459 | 152103 | ** expr1 NOT IN () |
| 151460 | 152104 | ** |
| 151461 | 152105 | ** simplify to constants 0 (false) and 1 (true), respectively, |
| 151462 | 152106 | ** regardless of the value of expr1. |
| 151463 | 152107 | */ |
| 151464 | 152108 | if( IN_RENAME_OBJECT==0 ){ |
| 151465 | | - sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy490); |
| 151466 | | - yymsp[-4].minor.yy490 = sqlite3ExprAlloc(pParse->db, TK_INTEGER,&sqlite3IntTokens[yymsp[-3].minor.yy96],1); |
| 152109 | + sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy130); |
| 152110 | + yymsp[-4].minor.yy130 = sqlite3ExprAlloc(pParse->db, TK_INTEGER,&sqlite3IntTokens[yymsp[-3].minor.yy420],1); |
| 151467 | 152111 | } |
| 151468 | | - }else if( yymsp[-1].minor.yy42->nExpr==1 ){ |
| 152112 | + }else if( yymsp[-1].minor.yy442->nExpr==1 ){ |
| 151469 | 152113 | /* Expressions of the form: |
| 151470 | 152114 | ** |
| 151471 | 152115 | ** expr1 IN (?1) |
| 151472 | 152116 | ** expr1 NOT IN (?2) |
| 151473 | 152117 | ** |
| | @@ -151480,134 +152124,134 @@ |
| 151480 | 152124 | ** But, the RHS of the == or <> is marked with the EP_Generic flag |
| 151481 | 152125 | ** so that it may not contribute to the computation of comparison |
| 151482 | 152126 | ** affinity or the collating sequence to use for comparison. Otherwise, |
| 151483 | 152127 | ** the semantics would be subtly different from IN or NOT IN. |
| 151484 | 152128 | */ |
| 151485 | | - Expr *pRHS = yymsp[-1].minor.yy42->a[0].pExpr; |
| 151486 | | - yymsp[-1].minor.yy42->a[0].pExpr = 0; |
| 151487 | | - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy42); |
| 152129 | + Expr *pRHS = yymsp[-1].minor.yy442->a[0].pExpr; |
| 152130 | + yymsp[-1].minor.yy442->a[0].pExpr = 0; |
| 152131 | + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy442); |
| 151488 | 152132 | /* pRHS cannot be NULL because a malloc error would have been detected |
| 151489 | 152133 | ** before now and control would have never reached this point */ |
| 151490 | 152134 | if( ALWAYS(pRHS) ){ |
| 151491 | 152135 | pRHS->flags &= ~EP_Collate; |
| 151492 | 152136 | pRHS->flags |= EP_Generic; |
| 151493 | 152137 | } |
| 151494 | | - yymsp[-4].minor.yy490 = sqlite3PExpr(pParse, yymsp[-3].minor.yy96 ? TK_NE : TK_EQ, yymsp[-4].minor.yy490, pRHS); |
| 151495 | | - }else{ |
| 151496 | | - yymsp[-4].minor.yy490 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy490, 0); |
| 151497 | | - if( yymsp[-4].minor.yy490 ){ |
| 151498 | | - yymsp[-4].minor.yy490->x.pList = yymsp[-1].minor.yy42; |
| 151499 | | - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy490); |
| 151500 | | - }else{ |
| 151501 | | - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy42); |
| 151502 | | - } |
| 151503 | | - if( yymsp[-3].minor.yy96 ) yymsp[-4].minor.yy490 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy490, 0); |
| 152138 | + yymsp[-4].minor.yy130 = sqlite3PExpr(pParse, yymsp[-3].minor.yy420 ? TK_NE : TK_EQ, yymsp[-4].minor.yy130, pRHS); |
| 152139 | + }else{ |
| 152140 | + yymsp[-4].minor.yy130 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy130, 0); |
| 152141 | + if( yymsp[-4].minor.yy130 ){ |
| 152142 | + yymsp[-4].minor.yy130->x.pList = yymsp[-1].minor.yy442; |
| 152143 | + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy130); |
| 152144 | + }else{ |
| 152145 | + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy442); |
| 152146 | + } |
| 152147 | + if( yymsp[-3].minor.yy420 ) yymsp[-4].minor.yy130 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy130, 0); |
| 151504 | 152148 | } |
| 151505 | 152149 | } |
| 151506 | 152150 | break; |
| 151507 | 152151 | case 203: /* expr ::= LP select RP */ |
| 151508 | 152152 | { |
| 151509 | | - yymsp[-2].minor.yy490 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); |
| 151510 | | - sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy490, yymsp[-1].minor.yy423); |
| 152153 | + yymsp[-2].minor.yy130 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); |
| 152154 | + sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy130, yymsp[-1].minor.yy491); |
| 151511 | 152155 | } |
| 151512 | 152156 | break; |
| 151513 | 152157 | case 204: /* expr ::= expr in_op LP select RP */ |
| 151514 | 152158 | { |
| 151515 | | - yymsp[-4].minor.yy490 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy490, 0); |
| 151516 | | - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy490, yymsp[-1].minor.yy423); |
| 151517 | | - if( yymsp[-3].minor.yy96 ) yymsp[-4].minor.yy490 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy490, 0); |
| 152159 | + yymsp[-4].minor.yy130 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy130, 0); |
| 152160 | + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy130, yymsp[-1].minor.yy491); |
| 152161 | + if( yymsp[-3].minor.yy420 ) yymsp[-4].minor.yy130 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy130, 0); |
| 151518 | 152162 | } |
| 151519 | 152163 | break; |
| 151520 | 152164 | case 205: /* expr ::= expr in_op nm dbnm paren_exprlist */ |
| 151521 | 152165 | { |
| 151522 | 152166 | SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); |
| 151523 | 152167 | Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0); |
| 151524 | | - if( yymsp[0].minor.yy42 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy42); |
| 151525 | | - yymsp[-4].minor.yy490 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy490, 0); |
| 151526 | | - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy490, pSelect); |
| 151527 | | - if( yymsp[-3].minor.yy96 ) yymsp[-4].minor.yy490 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy490, 0); |
| 152168 | + if( yymsp[0].minor.yy442 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy442); |
| 152169 | + yymsp[-4].minor.yy130 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy130, 0); |
| 152170 | + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy130, pSelect); |
| 152171 | + if( yymsp[-3].minor.yy420 ) yymsp[-4].minor.yy130 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy130, 0); |
| 151528 | 152172 | } |
| 151529 | 152173 | break; |
| 151530 | 152174 | case 206: /* expr ::= EXISTS LP select RP */ |
| 151531 | 152175 | { |
| 151532 | 152176 | Expr *p; |
| 151533 | | - p = yymsp[-3].minor.yy490 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); |
| 151534 | | - sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy423); |
| 152177 | + p = yymsp[-3].minor.yy130 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); |
| 152178 | + sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy491); |
| 151535 | 152179 | } |
| 151536 | 152180 | break; |
| 151537 | 152181 | case 207: /* expr ::= CASE case_operand case_exprlist case_else END */ |
| 151538 | 152182 | { |
| 151539 | | - yymsp[-4].minor.yy490 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy490, 0); |
| 151540 | | - if( yymsp[-4].minor.yy490 ){ |
| 151541 | | - yymsp[-4].minor.yy490->x.pList = yymsp[-1].minor.yy490 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy42,yymsp[-1].minor.yy490) : yymsp[-2].minor.yy42; |
| 151542 | | - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy490); |
| 152183 | + yymsp[-4].minor.yy130 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy130, 0); |
| 152184 | + if( yymsp[-4].minor.yy130 ){ |
| 152185 | + yymsp[-4].minor.yy130->x.pList = yymsp[-1].minor.yy130 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy442,yymsp[-1].minor.yy130) : yymsp[-2].minor.yy442; |
| 152186 | + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy130); |
| 151543 | 152187 | }else{ |
| 151544 | | - sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy42); |
| 151545 | | - sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy490); |
| 152188 | + sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy442); |
| 152189 | + sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy130); |
| 151546 | 152190 | } |
| 151547 | 152191 | } |
| 151548 | 152192 | break; |
| 151549 | 152193 | case 208: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 151550 | 152194 | { |
| 151551 | | - yymsp[-4].minor.yy42 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy42, yymsp[-2].minor.yy490); |
| 151552 | | - yymsp[-4].minor.yy42 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy42, yymsp[0].minor.yy490); |
| 152195 | + yymsp[-4].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, yymsp[-2].minor.yy130); |
| 152196 | + yymsp[-4].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, yymsp[0].minor.yy130); |
| 151553 | 152197 | } |
| 151554 | 152198 | break; |
| 151555 | 152199 | case 209: /* case_exprlist ::= WHEN expr THEN expr */ |
| 151556 | 152200 | { |
| 151557 | | - yymsp[-3].minor.yy42 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy490); |
| 151558 | | - yymsp[-3].minor.yy42 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy42, yymsp[0].minor.yy490); |
| 152201 | + yymsp[-3].minor.yy442 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy130); |
| 152202 | + yymsp[-3].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442, yymsp[0].minor.yy130); |
| 151559 | 152203 | } |
| 151560 | 152204 | break; |
| 151561 | 152205 | case 212: /* case_operand ::= expr */ |
| 151562 | | -{yymsp[0].minor.yy490 = yymsp[0].minor.yy490; /*A-overwrites-X*/} |
| 152206 | +{yymsp[0].minor.yy130 = yymsp[0].minor.yy130; /*A-overwrites-X*/} |
| 151563 | 152207 | break; |
| 151564 | 152208 | case 215: /* nexprlist ::= nexprlist COMMA expr */ |
| 151565 | | -{yymsp[-2].minor.yy42 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy42,yymsp[0].minor.yy490);} |
| 152209 | +{yymsp[-2].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy442,yymsp[0].minor.yy130);} |
| 151566 | 152210 | break; |
| 151567 | 152211 | case 216: /* nexprlist ::= expr */ |
| 151568 | | -{yymsp[0].minor.yy42 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy490); /*A-overwrites-Y*/} |
| 152212 | +{yymsp[0].minor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy130); /*A-overwrites-Y*/} |
| 151569 | 152213 | break; |
| 151570 | 152214 | case 218: /* paren_exprlist ::= LP exprlist RP */ |
| 151571 | 152215 | case 223: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==223); |
| 151572 | | -{yymsp[-2].minor.yy42 = yymsp[-1].minor.yy42;} |
| 152216 | +{yymsp[-2].minor.yy442 = yymsp[-1].minor.yy442;} |
| 151573 | 152217 | break; |
| 151574 | 152218 | case 219: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 151575 | 152219 | { |
| 151576 | 152220 | sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, |
| 151577 | | - sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy42, yymsp[-10].minor.yy96, |
| 151578 | | - &yymsp[-11].minor.yy0, yymsp[0].minor.yy490, SQLITE_SO_ASC, yymsp[-8].minor.yy96, SQLITE_IDXTYPE_APPDEF); |
| 152221 | + sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy442, yymsp[-10].minor.yy420, |
| 152222 | + &yymsp[-11].minor.yy0, yymsp[0].minor.yy130, SQLITE_SO_ASC, yymsp[-8].minor.yy420, SQLITE_IDXTYPE_APPDEF); |
| 151579 | 152223 | if( IN_RENAME_OBJECT && pParse->pNewIndex ){ |
| 151580 | 152224 | sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0); |
| 151581 | 152225 | } |
| 151582 | 152226 | } |
| 151583 | 152227 | break; |
| 151584 | 152228 | case 220: /* uniqueflag ::= UNIQUE */ |
| 151585 | 152229 | case 262: /* raisetype ::= ABORT */ yytestcase(yyruleno==262); |
| 151586 | | -{yymsp[0].minor.yy96 = OE_Abort;} |
| 152230 | +{yymsp[0].minor.yy420 = OE_Abort;} |
| 151587 | 152231 | break; |
| 151588 | 152232 | case 221: /* uniqueflag ::= */ |
| 151589 | | -{yymsp[1].minor.yy96 = OE_None;} |
| 152233 | +{yymsp[1].minor.yy420 = OE_None;} |
| 151590 | 152234 | break; |
| 151591 | 152235 | case 224: /* eidlist ::= eidlist COMMA nm collate sortorder */ |
| 151592 | 152236 | { |
| 151593 | | - yymsp[-4].minor.yy42 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy42, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy96, yymsp[0].minor.yy96); |
| 152237 | + yymsp[-4].minor.yy442 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy442, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy420, yymsp[0].minor.yy420); |
| 151594 | 152238 | } |
| 151595 | 152239 | break; |
| 151596 | 152240 | case 225: /* eidlist ::= nm collate sortorder */ |
| 151597 | 152241 | { |
| 151598 | | - yymsp[-2].minor.yy42 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy96, yymsp[0].minor.yy96); /*A-overwrites-Y*/ |
| 152242 | + yymsp[-2].minor.yy442 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy420, yymsp[0].minor.yy420); /*A-overwrites-Y*/ |
| 151599 | 152243 | } |
| 151600 | 152244 | break; |
| 151601 | 152245 | case 228: /* cmd ::= DROP INDEX ifexists fullname */ |
| 151602 | | -{sqlite3DropIndex(pParse, yymsp[0].minor.yy167, yymsp[-1].minor.yy96);} |
| 152246 | +{sqlite3DropIndex(pParse, yymsp[0].minor.yy147, yymsp[-1].minor.yy420);} |
| 151603 | 152247 | break; |
| 151604 | 152248 | case 229: /* cmd ::= VACUUM vinto */ |
| 151605 | | -{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy490);} |
| 152249 | +{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy130);} |
| 151606 | 152250 | break; |
| 151607 | 152251 | case 230: /* cmd ::= VACUUM nm vinto */ |
| 151608 | | -{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy490);} |
| 152252 | +{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy130);} |
| 151609 | 152253 | break; |
| 151610 | 152254 | case 233: /* cmd ::= PRAGMA nm dbnm */ |
| 151611 | 152255 | {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} |
| 151612 | 152256 | break; |
| 151613 | 152257 | case 234: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| | @@ -151625,55 +152269,55 @@ |
| 151625 | 152269 | case 240: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 151626 | 152270 | { |
| 151627 | 152271 | Token all; |
| 151628 | 152272 | all.z = yymsp[-3].minor.yy0.z; |
| 151629 | 152273 | all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n; |
| 151630 | | - sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy119, &all); |
| 152274 | + sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy524, &all); |
| 151631 | 152275 | } |
| 151632 | 152276 | break; |
| 151633 | 152277 | case 241: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 151634 | 152278 | { |
| 151635 | | - sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy96, yymsp[-4].minor.yy350.a, yymsp[-4].minor.yy350.b, yymsp[-2].minor.yy167, yymsp[0].minor.yy490, yymsp[-10].minor.yy96, yymsp[-8].minor.yy96); |
| 152279 | + sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy420, yymsp[-4].minor.yy498.a, yymsp[-4].minor.yy498.b, yymsp[-2].minor.yy147, yymsp[0].minor.yy130, yymsp[-10].minor.yy420, yymsp[-8].minor.yy420); |
| 151636 | 152280 | yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ |
| 151637 | 152281 | } |
| 151638 | 152282 | break; |
| 151639 | 152283 | case 242: /* trigger_time ::= BEFORE|AFTER */ |
| 151640 | | -{ yymsp[0].minor.yy96 = yymsp[0].major; /*A-overwrites-X*/ } |
| 152284 | +{ yymsp[0].minor.yy420 = yymsp[0].major; /*A-overwrites-X*/ } |
| 151641 | 152285 | break; |
| 151642 | 152286 | case 243: /* trigger_time ::= INSTEAD OF */ |
| 151643 | | -{ yymsp[-1].minor.yy96 = TK_INSTEAD;} |
| 152287 | +{ yymsp[-1].minor.yy420 = TK_INSTEAD;} |
| 151644 | 152288 | break; |
| 151645 | 152289 | case 244: /* trigger_time ::= */ |
| 151646 | | -{ yymsp[1].minor.yy96 = TK_BEFORE; } |
| 152290 | +{ yymsp[1].minor.yy420 = TK_BEFORE; } |
| 151647 | 152291 | break; |
| 151648 | 152292 | case 245: /* trigger_event ::= DELETE|INSERT */ |
| 151649 | 152293 | case 246: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==246); |
| 151650 | | -{yymsp[0].minor.yy350.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy350.b = 0;} |
| 152294 | +{yymsp[0].minor.yy498.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy498.b = 0;} |
| 151651 | 152295 | break; |
| 151652 | 152296 | case 247: /* trigger_event ::= UPDATE OF idlist */ |
| 151653 | | -{yymsp[-2].minor.yy350.a = TK_UPDATE; yymsp[-2].minor.yy350.b = yymsp[0].minor.yy336;} |
| 152297 | +{yymsp[-2].minor.yy498.a = TK_UPDATE; yymsp[-2].minor.yy498.b = yymsp[0].minor.yy200;} |
| 151654 | 152298 | break; |
| 151655 | 152299 | case 248: /* when_clause ::= */ |
| 151656 | 152300 | case 267: /* key_opt ::= */ yytestcase(yyruleno==267); |
| 151657 | | - case 309: /* filter_opt ::= */ yytestcase(yyruleno==309); |
| 151658 | | -{ yymsp[1].minor.yy490 = 0; } |
| 152301 | + case 315: /* filter_opt ::= */ yytestcase(yyruleno==315); |
| 152302 | +{ yymsp[1].minor.yy130 = 0; } |
| 151659 | 152303 | break; |
| 151660 | 152304 | case 249: /* when_clause ::= WHEN expr */ |
| 151661 | 152305 | case 268: /* key_opt ::= KEY expr */ yytestcase(yyruleno==268); |
| 151662 | | -{ yymsp[-1].minor.yy490 = yymsp[0].minor.yy490; } |
| 152306 | +{ yymsp[-1].minor.yy130 = yymsp[0].minor.yy130; } |
| 151663 | 152307 | break; |
| 151664 | 152308 | case 250: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 151665 | 152309 | { |
| 151666 | | - assert( yymsp[-2].minor.yy119!=0 ); |
| 151667 | | - yymsp[-2].minor.yy119->pLast->pNext = yymsp[-1].minor.yy119; |
| 151668 | | - yymsp[-2].minor.yy119->pLast = yymsp[-1].minor.yy119; |
| 152310 | + assert( yymsp[-2].minor.yy524!=0 ); |
| 152311 | + yymsp[-2].minor.yy524->pLast->pNext = yymsp[-1].minor.yy524; |
| 152312 | + yymsp[-2].minor.yy524->pLast = yymsp[-1].minor.yy524; |
| 151669 | 152313 | } |
| 151670 | 152314 | break; |
| 151671 | 152315 | case 251: /* trigger_cmd_list ::= trigger_cmd SEMI */ |
| 151672 | 152316 | { |
| 151673 | | - assert( yymsp[-1].minor.yy119!=0 ); |
| 151674 | | - yymsp[-1].minor.yy119->pLast = yymsp[-1].minor.yy119; |
| 152317 | + assert( yymsp[-1].minor.yy524!=0 ); |
| 152318 | + yymsp[-1].minor.yy524->pLast = yymsp[-1].minor.yy524; |
| 151675 | 152319 | } |
| 151676 | 152320 | break; |
| 151677 | 152321 | case 252: /* trnm ::= nm DOT nm */ |
| 151678 | 152322 | { |
| 151679 | 152323 | yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; |
| | @@ -151695,62 +152339,62 @@ |
| 151695 | 152339 | "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " |
| 151696 | 152340 | "within triggers"); |
| 151697 | 152341 | } |
| 151698 | 152342 | break; |
| 151699 | 152343 | case 255: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ |
| 151700 | | -{yylhsminor.yy119 = sqlite3TriggerUpdateStep(pParse, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy42, yymsp[-1].minor.yy490, yymsp[-6].minor.yy96, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy464);} |
| 151701 | | - yymsp[-7].minor.yy119 = yylhsminor.yy119; |
| 152344 | +{yylhsminor.yy524 = sqlite3TriggerUpdateStep(pParse, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy442, yymsp[-1].minor.yy130, yymsp[-6].minor.yy420, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy104);} |
| 152345 | + yymsp[-7].minor.yy524 = yylhsminor.yy524; |
| 151702 | 152346 | break; |
| 151703 | 152347 | case 256: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 151704 | 152348 | { |
| 151705 | | - yylhsminor.yy119 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy336,yymsp[-2].minor.yy423,yymsp[-6].minor.yy96,yymsp[-1].minor.yy266,yymsp[-7].minor.yy464,yymsp[0].minor.yy464);/*yylhsminor.yy119-overwrites-yymsp[-6].minor.yy96*/ |
| 152349 | + yylhsminor.yy524 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy200,yymsp[-2].minor.yy491,yymsp[-6].minor.yy420,yymsp[-1].minor.yy426,yymsp[-7].minor.yy104,yymsp[0].minor.yy104);/*yylhsminor.yy524-overwrites-yymsp[-6].minor.yy420*/ |
| 151706 | 152350 | } |
| 151707 | | - yymsp[-7].minor.yy119 = yylhsminor.yy119; |
| 152351 | + yymsp[-7].minor.yy524 = yylhsminor.yy524; |
| 151708 | 152352 | break; |
| 151709 | 152353 | case 257: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 151710 | | -{yylhsminor.yy119 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy490, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy464);} |
| 151711 | | - yymsp[-5].minor.yy119 = yylhsminor.yy119; |
| 152354 | +{yylhsminor.yy524 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy130, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy104);} |
| 152355 | + yymsp[-5].minor.yy524 = yylhsminor.yy524; |
| 151712 | 152356 | break; |
| 151713 | 152357 | case 258: /* trigger_cmd ::= scanpt select scanpt */ |
| 151714 | | -{yylhsminor.yy119 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy423, yymsp[-2].minor.yy464, yymsp[0].minor.yy464); /*yylhsminor.yy119-overwrites-yymsp[-1].minor.yy423*/} |
| 151715 | | - yymsp[-2].minor.yy119 = yylhsminor.yy119; |
| 152358 | +{yylhsminor.yy524 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy491, yymsp[-2].minor.yy104, yymsp[0].minor.yy104); /*yylhsminor.yy524-overwrites-yymsp[-1].minor.yy491*/} |
| 152359 | + yymsp[-2].minor.yy524 = yylhsminor.yy524; |
| 151716 | 152360 | break; |
| 151717 | 152361 | case 259: /* expr ::= RAISE LP IGNORE RP */ |
| 151718 | 152362 | { |
| 151719 | | - yymsp[-3].minor.yy490 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); |
| 151720 | | - if( yymsp[-3].minor.yy490 ){ |
| 151721 | | - yymsp[-3].minor.yy490->affinity = OE_Ignore; |
| 152363 | + yymsp[-3].minor.yy130 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); |
| 152364 | + if( yymsp[-3].minor.yy130 ){ |
| 152365 | + yymsp[-3].minor.yy130->affinity = OE_Ignore; |
| 151722 | 152366 | } |
| 151723 | 152367 | } |
| 151724 | 152368 | break; |
| 151725 | 152369 | case 260: /* expr ::= RAISE LP raisetype COMMA nm RP */ |
| 151726 | 152370 | { |
| 151727 | | - yymsp[-5].minor.yy490 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); |
| 151728 | | - if( yymsp[-5].minor.yy490 ) { |
| 151729 | | - yymsp[-5].minor.yy490->affinity = (char)yymsp[-3].minor.yy96; |
| 152371 | + yymsp[-5].minor.yy130 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); |
| 152372 | + if( yymsp[-5].minor.yy130 ) { |
| 152373 | + yymsp[-5].minor.yy130->affinity = (char)yymsp[-3].minor.yy420; |
| 151730 | 152374 | } |
| 151731 | 152375 | } |
| 151732 | 152376 | break; |
| 151733 | 152377 | case 261: /* raisetype ::= ROLLBACK */ |
| 151734 | | -{yymsp[0].minor.yy96 = OE_Rollback;} |
| 152378 | +{yymsp[0].minor.yy420 = OE_Rollback;} |
| 151735 | 152379 | break; |
| 151736 | 152380 | case 263: /* raisetype ::= FAIL */ |
| 151737 | | -{yymsp[0].minor.yy96 = OE_Fail;} |
| 152381 | +{yymsp[0].minor.yy420 = OE_Fail;} |
| 151738 | 152382 | break; |
| 151739 | 152383 | case 264: /* cmd ::= DROP TRIGGER ifexists fullname */ |
| 151740 | 152384 | { |
| 151741 | | - sqlite3DropTrigger(pParse,yymsp[0].minor.yy167,yymsp[-1].minor.yy96); |
| 152385 | + sqlite3DropTrigger(pParse,yymsp[0].minor.yy147,yymsp[-1].minor.yy420); |
| 151742 | 152386 | } |
| 151743 | 152387 | break; |
| 151744 | 152388 | case 265: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 151745 | 152389 | { |
| 151746 | | - sqlite3Attach(pParse, yymsp[-3].minor.yy490, yymsp[-1].minor.yy490, yymsp[0].minor.yy490); |
| 152390 | + sqlite3Attach(pParse, yymsp[-3].minor.yy130, yymsp[-1].minor.yy130, yymsp[0].minor.yy130); |
| 151747 | 152391 | } |
| 151748 | 152392 | break; |
| 151749 | 152393 | case 266: /* cmd ::= DETACH database_kw_opt expr */ |
| 151750 | 152394 | { |
| 151751 | | - sqlite3Detach(pParse, yymsp[0].minor.yy490); |
| 152395 | + sqlite3Detach(pParse, yymsp[0].minor.yy130); |
| 151752 | 152396 | } |
| 151753 | 152397 | break; |
| 151754 | 152398 | case 269: /* cmd ::= REINDEX */ |
| 151755 | 152399 | {sqlite3Reindex(pParse, 0, 0);} |
| 151756 | 152400 | break; |
| | @@ -151763,11 +152407,11 @@ |
| 151763 | 152407 | case 272: /* cmd ::= ANALYZE nm dbnm */ |
| 151764 | 152408 | {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 151765 | 152409 | break; |
| 151766 | 152410 | case 273: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 151767 | 152411 | { |
| 151768 | | - sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy167,&yymsp[0].minor.yy0); |
| 152412 | + sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy147,&yymsp[0].minor.yy0); |
| 151769 | 152413 | } |
| 151770 | 152414 | break; |
| 151771 | 152415 | case 274: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 151772 | 152416 | { |
| 151773 | 152417 | yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; |
| | @@ -151775,16 +152419,16 @@ |
| 151775 | 152419 | } |
| 151776 | 152420 | break; |
| 151777 | 152421 | case 275: /* add_column_fullname ::= fullname */ |
| 151778 | 152422 | { |
| 151779 | 152423 | disableLookaside(pParse); |
| 151780 | | - sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy167); |
| 152424 | + sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy147); |
| 151781 | 152425 | } |
| 151782 | 152426 | break; |
| 151783 | 152427 | case 276: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 151784 | 152428 | { |
| 151785 | | - sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy167, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); |
| 152429 | + sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy147, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); |
| 151786 | 152430 | } |
| 151787 | 152431 | break; |
| 151788 | 152432 | case 277: /* cmd ::= create_vtab */ |
| 151789 | 152433 | {sqlite3VtabFinishParse(pParse,0);} |
| 151790 | 152434 | break; |
| | @@ -151791,11 +152435,11 @@ |
| 151791 | 152435 | case 278: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 151792 | 152436 | {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} |
| 151793 | 152437 | break; |
| 151794 | 152438 | case 279: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 151795 | 152439 | { |
| 151796 | | - sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy96); |
| 152440 | + sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy420); |
| 151797 | 152441 | } |
| 151798 | 152442 | break; |
| 151799 | 152443 | case 280: /* vtabarg ::= */ |
| 151800 | 152444 | {sqlite3VtabArgInit(pParse);} |
| 151801 | 152445 | break; |
| | @@ -151804,186 +152448,208 @@ |
| 151804 | 152448 | case 283: /* lp ::= LP */ yytestcase(yyruleno==283); |
| 151805 | 152449 | {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} |
| 151806 | 152450 | break; |
| 151807 | 152451 | case 284: /* with ::= WITH wqlist */ |
| 151808 | 152452 | case 285: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==285); |
| 151809 | | -{ sqlite3WithPush(pParse, yymsp[0].minor.yy499, 1); } |
| 152453 | +{ sqlite3WithPush(pParse, yymsp[0].minor.yy523, 1); } |
| 151810 | 152454 | break; |
| 151811 | 152455 | case 286: /* wqlist ::= nm eidlist_opt AS LP select RP */ |
| 151812 | 152456 | { |
| 151813 | | - yymsp[-5].minor.yy499 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy42, yymsp[-1].minor.yy423); /*A-overwrites-X*/ |
| 152457 | + yymsp[-5].minor.yy523 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy442, yymsp[-1].minor.yy491); /*A-overwrites-X*/ |
| 151814 | 152458 | } |
| 151815 | 152459 | break; |
| 151816 | 152460 | case 287: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 151817 | 152461 | { |
| 151818 | | - yymsp[-7].minor.yy499 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy499, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy42, yymsp[-1].minor.yy423); |
| 152462 | + yymsp[-7].minor.yy523 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy523, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy442, yymsp[-1].minor.yy491); |
| 151819 | 152463 | } |
| 151820 | 152464 | break; |
| 151821 | 152465 | case 288: /* windowdefn_list ::= windowdefn */ |
| 151822 | | -{ yylhsminor.yy147 = yymsp[0].minor.yy147; } |
| 151823 | | - yymsp[0].minor.yy147 = yylhsminor.yy147; |
| 152466 | +{ yylhsminor.yy395 = yymsp[0].minor.yy395; } |
| 152467 | + yymsp[0].minor.yy395 = yylhsminor.yy395; |
| 151824 | 152468 | break; |
| 151825 | 152469 | case 289: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 151826 | 152470 | { |
| 151827 | | - assert( yymsp[0].minor.yy147!=0 ); |
| 151828 | | - yymsp[0].minor.yy147->pNextWin = yymsp[-2].minor.yy147; |
| 151829 | | - yylhsminor.yy147 = yymsp[0].minor.yy147; |
| 151830 | | -} |
| 151831 | | - yymsp[-2].minor.yy147 = yylhsminor.yy147; |
| 151832 | | - break; |
| 151833 | | - case 290: /* windowdefn ::= nm AS window */ |
| 151834 | | -{ |
| 151835 | | - if( ALWAYS(yymsp[0].minor.yy147) ){ |
| 151836 | | - yymsp[0].minor.yy147->zName = sqlite3DbStrNDup(pParse->db, yymsp[-2].minor.yy0.z, yymsp[-2].minor.yy0.n); |
| 151837 | | - } |
| 151838 | | - yylhsminor.yy147 = yymsp[0].minor.yy147; |
| 151839 | | -} |
| 151840 | | - yymsp[-2].minor.yy147 = yylhsminor.yy147; |
| 151841 | | - break; |
| 151842 | | - case 291: /* window ::= LP part_opt orderby_opt frame_opt RP */ |
| 151843 | | -{ |
| 151844 | | - yymsp[-4].minor.yy147 = yymsp[-1].minor.yy147; |
| 151845 | | - if( ALWAYS(yymsp[-4].minor.yy147) ){ |
| 151846 | | - yymsp[-4].minor.yy147->pPartition = yymsp[-3].minor.yy42; |
| 151847 | | - yymsp[-4].minor.yy147->pOrderBy = yymsp[-2].minor.yy42; |
| 151848 | | - } |
| 151849 | | -} |
| 151850 | | - break; |
| 151851 | | - case 292: /* part_opt ::= PARTITION BY nexprlist */ |
| 151852 | | -{ yymsp[-2].minor.yy42 = yymsp[0].minor.yy42; } |
| 151853 | | - break; |
| 151854 | | - case 293: /* part_opt ::= */ |
| 151855 | | -{ yymsp[1].minor.yy42 = 0; } |
| 151856 | | - break; |
| 151857 | | - case 294: /* frame_opt ::= */ |
| 151858 | | -{ |
| 151859 | | - yymsp[1].minor.yy147 = sqlite3WindowAlloc(pParse, TK_RANGE, TK_UNBOUNDED, 0, TK_CURRENT, 0); |
| 151860 | | -} |
| 151861 | | - break; |
| 151862 | | - case 295: /* frame_opt ::= range_or_rows frame_bound_s */ |
| 151863 | | -{ |
| 151864 | | - yylhsminor.yy147 = sqlite3WindowAlloc(pParse, yymsp[-1].minor.yy96, yymsp[0].minor.yy317.eType, yymsp[0].minor.yy317.pExpr, TK_CURRENT, 0); |
| 151865 | | -} |
| 151866 | | - yymsp[-1].minor.yy147 = yylhsminor.yy147; |
| 151867 | | - break; |
| 151868 | | - case 296: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */ |
| 151869 | | -{ |
| 151870 | | - yylhsminor.yy147 = sqlite3WindowAlloc(pParse, yymsp[-4].minor.yy96, yymsp[-2].minor.yy317.eType, yymsp[-2].minor.yy317.pExpr, yymsp[0].minor.yy317.eType, yymsp[0].minor.yy317.pExpr); |
| 151871 | | -} |
| 151872 | | - yymsp[-4].minor.yy147 = yylhsminor.yy147; |
| 151873 | | - break; |
| 151874 | | - case 297: /* range_or_rows ::= RANGE */ |
| 151875 | | -{ yymsp[0].minor.yy96 = TK_RANGE; } |
| 151876 | | - break; |
| 151877 | | - case 298: /* range_or_rows ::= ROWS */ |
| 151878 | | -{ yymsp[0].minor.yy96 = TK_ROWS; } |
| 151879 | | - break; |
| 151880 | | - case 299: /* frame_bound_s ::= frame_bound */ |
| 151881 | | - case 301: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==301); |
| 151882 | | -{ yylhsminor.yy317 = yymsp[0].minor.yy317; } |
| 151883 | | - yymsp[0].minor.yy317 = yylhsminor.yy317; |
| 151884 | | - break; |
| 151885 | | - case 300: /* frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 151886 | | - case 302: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==302); |
| 151887 | | -{yymsp[-1].minor.yy317.eType = TK_UNBOUNDED; yymsp[-1].minor.yy317.pExpr = 0;} |
| 151888 | | - break; |
| 151889 | | - case 303: /* frame_bound ::= expr PRECEDING */ |
| 151890 | | -{ yylhsminor.yy317.eType = TK_PRECEDING; yylhsminor.yy317.pExpr = yymsp[-1].minor.yy490; } |
| 151891 | | - yymsp[-1].minor.yy317 = yylhsminor.yy317; |
| 151892 | | - break; |
| 151893 | | - case 304: /* frame_bound ::= CURRENT ROW */ |
| 151894 | | -{ yymsp[-1].minor.yy317.eType = TK_CURRENT ; yymsp[-1].minor.yy317.pExpr = 0; } |
| 151895 | | - break; |
| 151896 | | - case 305: /* frame_bound ::= expr FOLLOWING */ |
| 151897 | | -{ yylhsminor.yy317.eType = TK_FOLLOWING; yylhsminor.yy317.pExpr = yymsp[-1].minor.yy490; } |
| 151898 | | - yymsp[-1].minor.yy317 = yylhsminor.yy317; |
| 151899 | | - break; |
| 151900 | | - case 306: /* window_clause ::= WINDOW windowdefn_list */ |
| 151901 | | -{ yymsp[-1].minor.yy147 = yymsp[0].minor.yy147; } |
| 151902 | | - break; |
| 151903 | | - case 307: /* over_clause ::= filter_opt OVER window */ |
| 151904 | | -{ |
| 151905 | | - yylhsminor.yy147 = yymsp[0].minor.yy147; |
| 151906 | | - assert( yylhsminor.yy147!=0 ); |
| 151907 | | - yylhsminor.yy147->pFilter = yymsp[-2].minor.yy490; |
| 151908 | | -} |
| 151909 | | - yymsp[-2].minor.yy147 = yylhsminor.yy147; |
| 151910 | | - break; |
| 151911 | | - case 308: /* over_clause ::= filter_opt OVER nm */ |
| 151912 | | -{ |
| 151913 | | - yylhsminor.yy147 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); |
| 151914 | | - if( yylhsminor.yy147 ){ |
| 151915 | | - yylhsminor.yy147->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); |
| 151916 | | - yylhsminor.yy147->pFilter = yymsp[-2].minor.yy490; |
| 151917 | | - }else{ |
| 151918 | | - sqlite3ExprDelete(pParse->db, yymsp[-2].minor.yy490); |
| 151919 | | - } |
| 151920 | | -} |
| 151921 | | - yymsp[-2].minor.yy147 = yylhsminor.yy147; |
| 151922 | | - break; |
| 151923 | | - case 310: /* filter_opt ::= FILTER LP WHERE expr RP */ |
| 151924 | | -{ yymsp[-4].minor.yy490 = yymsp[-1].minor.yy490; } |
| 152471 | + assert( yymsp[0].minor.yy395!=0 ); |
| 152472 | + sqlite3WindowChain(pParse, yymsp[0].minor.yy395, yymsp[-2].minor.yy395); |
| 152473 | + yymsp[0].minor.yy395->pNextWin = yymsp[-2].minor.yy395; |
| 152474 | + yylhsminor.yy395 = yymsp[0].minor.yy395; |
| 152475 | +} |
| 152476 | + yymsp[-2].minor.yy395 = yylhsminor.yy395; |
| 152477 | + break; |
| 152478 | + case 290: /* windowdefn ::= nm AS LP window RP */ |
| 152479 | +{ |
| 152480 | + if( ALWAYS(yymsp[-1].minor.yy395) ){ |
| 152481 | + yymsp[-1].minor.yy395->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n); |
| 152482 | + } |
| 152483 | + yylhsminor.yy395 = yymsp[-1].minor.yy395; |
| 152484 | +} |
| 152485 | + yymsp[-4].minor.yy395 = yylhsminor.yy395; |
| 152486 | + break; |
| 152487 | + case 291: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 152488 | +{ |
| 152489 | + yymsp[-4].minor.yy395 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy395, yymsp[-2].minor.yy442, yymsp[-1].minor.yy442, 0); |
| 152490 | +} |
| 152491 | + break; |
| 152492 | + case 292: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 152493 | +{ |
| 152494 | + yylhsminor.yy395 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy395, yymsp[-2].minor.yy442, yymsp[-1].minor.yy442, &yymsp[-5].minor.yy0); |
| 152495 | +} |
| 152496 | + yymsp[-5].minor.yy395 = yylhsminor.yy395; |
| 152497 | + break; |
| 152498 | + case 293: /* window ::= ORDER BY sortlist frame_opt */ |
| 152499 | +{ |
| 152500 | + yymsp[-3].minor.yy395 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy395, 0, yymsp[-1].minor.yy442, 0); |
| 152501 | +} |
| 152502 | + break; |
| 152503 | + case 294: /* window ::= nm ORDER BY sortlist frame_opt */ |
| 152504 | +{ |
| 152505 | + yylhsminor.yy395 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy395, 0, yymsp[-1].minor.yy442, &yymsp[-4].minor.yy0); |
| 152506 | +} |
| 152507 | + yymsp[-4].minor.yy395 = yylhsminor.yy395; |
| 152508 | + break; |
| 152509 | + case 295: /* window ::= frame_opt */ |
| 152510 | +{ |
| 152511 | + yylhsminor.yy395 = yymsp[0].minor.yy395; |
| 152512 | +} |
| 152513 | + yymsp[0].minor.yy395 = yylhsminor.yy395; |
| 152514 | + break; |
| 152515 | + case 296: /* window ::= nm frame_opt */ |
| 152516 | +{ |
| 152517 | + yylhsminor.yy395 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy395, 0, 0, &yymsp[-1].minor.yy0); |
| 152518 | +} |
| 152519 | + yymsp[-1].minor.yy395 = yylhsminor.yy395; |
| 152520 | + break; |
| 152521 | + case 297: /* frame_opt ::= */ |
| 152522 | +{ |
| 152523 | + yymsp[1].minor.yy395 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0); |
| 152524 | +} |
| 152525 | + break; |
| 152526 | + case 298: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 152527 | +{ |
| 152528 | + yylhsminor.yy395 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy420, yymsp[-1].minor.yy273.eType, yymsp[-1].minor.yy273.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy10); |
| 152529 | +} |
| 152530 | + yymsp[-2].minor.yy395 = yylhsminor.yy395; |
| 152531 | + break; |
| 152532 | + case 299: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 152533 | +{ |
| 152534 | + yylhsminor.yy395 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy420, yymsp[-3].minor.yy273.eType, yymsp[-3].minor.yy273.pExpr, yymsp[-1].minor.yy273.eType, yymsp[-1].minor.yy273.pExpr, yymsp[0].minor.yy10); |
| 152535 | +} |
| 152536 | + yymsp[-5].minor.yy395 = yylhsminor.yy395; |
| 152537 | + break; |
| 152538 | + case 301: /* frame_bound_s ::= frame_bound */ |
| 152539 | + case 303: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==303); |
| 152540 | +{yylhsminor.yy273 = yymsp[0].minor.yy273;} |
| 152541 | + yymsp[0].minor.yy273 = yylhsminor.yy273; |
| 152542 | + break; |
| 152543 | + case 302: /* frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 152544 | + case 304: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==304); |
| 152545 | + case 306: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==306); |
| 152546 | +{yylhsminor.yy273.eType = yymsp[-1].major; yylhsminor.yy273.pExpr = 0;} |
| 152547 | + yymsp[-1].minor.yy273 = yylhsminor.yy273; |
| 152548 | + break; |
| 152549 | + case 305: /* frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 152550 | +{yylhsminor.yy273.eType = yymsp[0].major; yylhsminor.yy273.pExpr = yymsp[-1].minor.yy130;} |
| 152551 | + yymsp[-1].minor.yy273 = yylhsminor.yy273; |
| 152552 | + break; |
| 152553 | + case 307: /* frame_exclude_opt ::= */ |
| 152554 | +{yymsp[1].minor.yy10 = 0;} |
| 152555 | + break; |
| 152556 | + case 308: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 152557 | +{yymsp[-1].minor.yy10 = yymsp[0].minor.yy10;} |
| 152558 | + break; |
| 152559 | + case 309: /* frame_exclude ::= NO OTHERS */ |
| 152560 | + case 310: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==310); |
| 152561 | +{yymsp[-1].minor.yy10 = yymsp[-1].major; /*A-overwrites-X*/} |
| 152562 | + break; |
| 152563 | + case 311: /* frame_exclude ::= GROUP|TIES */ |
| 152564 | +{yymsp[0].minor.yy10 = yymsp[0].major; /*A-overwrites-X*/} |
| 152565 | + break; |
| 152566 | + case 312: /* window_clause ::= WINDOW windowdefn_list */ |
| 152567 | +{ yymsp[-1].minor.yy395 = yymsp[0].minor.yy395; } |
| 152568 | + break; |
| 152569 | + case 313: /* over_clause ::= filter_opt OVER LP window RP */ |
| 152570 | +{ |
| 152571 | + yylhsminor.yy395 = yymsp[-1].minor.yy395; |
| 152572 | + assert( yylhsminor.yy395!=0 ); |
| 152573 | + yylhsminor.yy395->pFilter = yymsp[-4].minor.yy130; |
| 152574 | +} |
| 152575 | + yymsp[-4].minor.yy395 = yylhsminor.yy395; |
| 152576 | + break; |
| 152577 | + case 314: /* over_clause ::= filter_opt OVER nm */ |
| 152578 | +{ |
| 152579 | + yylhsminor.yy395 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); |
| 152580 | + if( yylhsminor.yy395 ){ |
| 152581 | + yylhsminor.yy395->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); |
| 152582 | + yylhsminor.yy395->pFilter = yymsp[-2].minor.yy130; |
| 152583 | + }else{ |
| 152584 | + sqlite3ExprDelete(pParse->db, yymsp[-2].minor.yy130); |
| 152585 | + } |
| 152586 | +} |
| 152587 | + yymsp[-2].minor.yy395 = yylhsminor.yy395; |
| 152588 | + break; |
| 152589 | + case 316: /* filter_opt ::= FILTER LP WHERE expr RP */ |
| 152590 | +{ yymsp[-4].minor.yy130 = yymsp[-1].minor.yy130; } |
| 151925 | 152591 | break; |
| 151926 | 152592 | default: |
| 151927 | | - /* (311) input ::= cmdlist */ yytestcase(yyruleno==311); |
| 151928 | | - /* (312) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==312); |
| 151929 | | - /* (313) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=313); |
| 151930 | | - /* (314) ecmd ::= SEMI */ yytestcase(yyruleno==314); |
| 151931 | | - /* (315) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==315); |
| 151932 | | - /* (316) ecmd ::= explain cmdx */ yytestcase(yyruleno==316); |
| 151933 | | - /* (317) trans_opt ::= */ yytestcase(yyruleno==317); |
| 151934 | | - /* (318) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==318); |
| 151935 | | - /* (319) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==319); |
| 151936 | | - /* (320) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==320); |
| 151937 | | - /* (321) savepoint_opt ::= */ yytestcase(yyruleno==321); |
| 151938 | | - /* (322) cmd ::= create_table create_table_args */ yytestcase(yyruleno==322); |
| 151939 | | - /* (323) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==323); |
| 151940 | | - /* (324) columnlist ::= columnname carglist */ yytestcase(yyruleno==324); |
| 151941 | | - /* (325) nm ::= ID|INDEXED */ yytestcase(yyruleno==325); |
| 151942 | | - /* (326) nm ::= STRING */ yytestcase(yyruleno==326); |
| 151943 | | - /* (327) nm ::= JOIN_KW */ yytestcase(yyruleno==327); |
| 151944 | | - /* (328) typetoken ::= typename */ yytestcase(yyruleno==328); |
| 151945 | | - /* (329) typename ::= ID|STRING */ yytestcase(yyruleno==329); |
| 151946 | | - /* (330) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=330); |
| 151947 | | - /* (331) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=331); |
| 151948 | | - /* (332) carglist ::= carglist ccons */ yytestcase(yyruleno==332); |
| 151949 | | - /* (333) carglist ::= */ yytestcase(yyruleno==333); |
| 151950 | | - /* (334) ccons ::= NULL onconf */ yytestcase(yyruleno==334); |
| 151951 | | - /* (335) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==335); |
| 151952 | | - /* (336) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==336); |
| 151953 | | - /* (337) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=337); |
| 151954 | | - /* (338) tconscomma ::= */ yytestcase(yyruleno==338); |
| 151955 | | - /* (339) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=339); |
| 151956 | | - /* (340) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=340); |
| 151957 | | - /* (341) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=341); |
| 151958 | | - /* (342) oneselect ::= values */ yytestcase(yyruleno==342); |
| 151959 | | - /* (343) sclp ::= selcollist COMMA */ yytestcase(yyruleno==343); |
| 151960 | | - /* (344) as ::= ID|STRING */ yytestcase(yyruleno==344); |
| 151961 | | - /* (345) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=345); |
| 151962 | | - /* (346) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==346); |
| 151963 | | - /* (347) exprlist ::= nexprlist */ yytestcase(yyruleno==347); |
| 151964 | | - /* (348) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=348); |
| 151965 | | - /* (349) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=349); |
| 151966 | | - /* (350) nmnum ::= ON */ yytestcase(yyruleno==350); |
| 151967 | | - /* (351) nmnum ::= DELETE */ yytestcase(yyruleno==351); |
| 151968 | | - /* (352) nmnum ::= DEFAULT */ yytestcase(yyruleno==352); |
| 151969 | | - /* (353) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==353); |
| 151970 | | - /* (354) foreach_clause ::= */ yytestcase(yyruleno==354); |
| 151971 | | - /* (355) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==355); |
| 151972 | | - /* (356) trnm ::= nm */ yytestcase(yyruleno==356); |
| 151973 | | - /* (357) tridxby ::= */ yytestcase(yyruleno==357); |
| 151974 | | - /* (358) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==358); |
| 151975 | | - /* (359) database_kw_opt ::= */ yytestcase(yyruleno==359); |
| 151976 | | - /* (360) kwcolumn_opt ::= */ yytestcase(yyruleno==360); |
| 151977 | | - /* (361) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==361); |
| 151978 | | - /* (362) vtabarglist ::= vtabarg */ yytestcase(yyruleno==362); |
| 151979 | | - /* (363) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==363); |
| 151980 | | - /* (364) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==364); |
| 151981 | | - /* (365) anylist ::= */ yytestcase(yyruleno==365); |
| 151982 | | - /* (366) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==366); |
| 151983 | | - /* (367) anylist ::= anylist ANY */ yytestcase(yyruleno==367); |
| 151984 | | - /* (368) with ::= */ yytestcase(yyruleno==368); |
| 152593 | + /* (317) input ::= cmdlist */ yytestcase(yyruleno==317); |
| 152594 | + /* (318) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==318); |
| 152595 | + /* (319) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=319); |
| 152596 | + /* (320) ecmd ::= SEMI */ yytestcase(yyruleno==320); |
| 152597 | + /* (321) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==321); |
| 152598 | + /* (322) ecmd ::= explain cmdx */ yytestcase(yyruleno==322); |
| 152599 | + /* (323) trans_opt ::= */ yytestcase(yyruleno==323); |
| 152600 | + /* (324) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==324); |
| 152601 | + /* (325) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==325); |
| 152602 | + /* (326) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==326); |
| 152603 | + /* (327) savepoint_opt ::= */ yytestcase(yyruleno==327); |
| 152604 | + /* (328) cmd ::= create_table create_table_args */ yytestcase(yyruleno==328); |
| 152605 | + /* (329) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==329); |
| 152606 | + /* (330) columnlist ::= columnname carglist */ yytestcase(yyruleno==330); |
| 152607 | + /* (331) nm ::= ID|INDEXED */ yytestcase(yyruleno==331); |
| 152608 | + /* (332) nm ::= STRING */ yytestcase(yyruleno==332); |
| 152609 | + /* (333) nm ::= JOIN_KW */ yytestcase(yyruleno==333); |
| 152610 | + /* (334) typetoken ::= typename */ yytestcase(yyruleno==334); |
| 152611 | + /* (335) typename ::= ID|STRING */ yytestcase(yyruleno==335); |
| 152612 | + /* (336) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=336); |
| 152613 | + /* (337) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=337); |
| 152614 | + /* (338) carglist ::= carglist ccons */ yytestcase(yyruleno==338); |
| 152615 | + /* (339) carglist ::= */ yytestcase(yyruleno==339); |
| 152616 | + /* (340) ccons ::= NULL onconf */ yytestcase(yyruleno==340); |
| 152617 | + /* (341) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==341); |
| 152618 | + /* (342) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==342); |
| 152619 | + /* (343) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=343); |
| 152620 | + /* (344) tconscomma ::= */ yytestcase(yyruleno==344); |
| 152621 | + /* (345) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=345); |
| 152622 | + /* (346) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=346); |
| 152623 | + /* (347) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=347); |
| 152624 | + /* (348) oneselect ::= values */ yytestcase(yyruleno==348); |
| 152625 | + /* (349) sclp ::= selcollist COMMA */ yytestcase(yyruleno==349); |
| 152626 | + /* (350) as ::= ID|STRING */ yytestcase(yyruleno==350); |
| 152627 | + /* (351) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=351); |
| 152628 | + /* (352) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==352); |
| 152629 | + /* (353) exprlist ::= nexprlist */ yytestcase(yyruleno==353); |
| 152630 | + /* (354) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=354); |
| 152631 | + /* (355) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=355); |
| 152632 | + /* (356) nmnum ::= ON */ yytestcase(yyruleno==356); |
| 152633 | + /* (357) nmnum ::= DELETE */ yytestcase(yyruleno==357); |
| 152634 | + /* (358) nmnum ::= DEFAULT */ yytestcase(yyruleno==358); |
| 152635 | + /* (359) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==359); |
| 152636 | + /* (360) foreach_clause ::= */ yytestcase(yyruleno==360); |
| 152637 | + /* (361) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==361); |
| 152638 | + /* (362) trnm ::= nm */ yytestcase(yyruleno==362); |
| 152639 | + /* (363) tridxby ::= */ yytestcase(yyruleno==363); |
| 152640 | + /* (364) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==364); |
| 152641 | + /* (365) database_kw_opt ::= */ yytestcase(yyruleno==365); |
| 152642 | + /* (366) kwcolumn_opt ::= */ yytestcase(yyruleno==366); |
| 152643 | + /* (367) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==367); |
| 152644 | + /* (368) vtabarglist ::= vtabarg */ yytestcase(yyruleno==368); |
| 152645 | + /* (369) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==369); |
| 152646 | + /* (370) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==370); |
| 152647 | + /* (371) anylist ::= */ yytestcase(yyruleno==371); |
| 152648 | + /* (372) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==372); |
| 152649 | + /* (373) anylist ::= anylist ANY */ yytestcase(yyruleno==373); |
| 152650 | + /* (374) with ::= */ yytestcase(yyruleno==374); |
| 151985 | 152651 | break; |
| 151986 | 152652 | /********** End reduce actions ************************************************/ |
| 151987 | 152653 | }; |
| 151988 | 152654 | assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) ); |
| 151989 | 152655 | yygoto = yyRuleInfoLhs[yyruleno]; |
| | @@ -152442,148 +153108,148 @@ |
| 152442 | 153108 | ** might be implemented more directly using a hand-written hash table. |
| 152443 | 153109 | ** But by using this automatically generated code, the size of the code |
| 152444 | 153110 | ** is substantially reduced. This is important for embedded applications |
| 152445 | 153111 | ** on platforms with limited memory. |
| 152446 | 153112 | */ |
| 152447 | | -/* Hash score: 208 */ |
| 152448 | | -/* zKWText[] encodes 923 bytes of keyword text in 614 bytes */ |
| 153113 | +/* Hash score: 214 */ |
| 153114 | +/* zKWText[] encodes 950 bytes of keyword text in 629 bytes */ |
| 152449 | 153115 | /* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */ |
| 152450 | | -/* ABLEFTHENDEFERRABLELSEXCEPTRANSACTIONATURALTERAISEXCLUSIVE */ |
| 152451 | | -/* XISTSAVEPOINTERSECTRIGGEREFERENCESCONSTRAINTOFFSETEMPORARY */ |
| 152452 | | -/* UNIQUERYWITHOUTERELEASEATTACHAVINGROUPDATEBEGINNERANGEBETWEEN */ |
| 152453 | | -/* OTHINGLOBYCASCADELETECASECOLLATECREATECURRENT_DATEDETACH */ |
| 152454 | | -/* IMMEDIATEJOINSERTLIKEMATCHPLANALYZEPRAGMABORTVALUESVIRTUALIMIT */ |
| 152455 | | -/* WHENOTNULLWHERECURSIVEAFTERENAMEANDEFAULTAUTOINCREMENTCAST */ |
| 152456 | | -/* COLUMNCOMMITCONFLICTCROSSCURRENT_TIMESTAMPARTITIONDEFERRED */ |
| 152457 | | -/* ISTINCTDROPRECEDINGFAILFILTEREPLACEFOLLOWINGFROMFULLIFISNULL */ |
| 152458 | | -/* ORDERESTRICTOVERIGHTROLLBACKROWSUNBOUNDEDUNIONUSINGVACUUMVIEW */ |
| 152459 | | -/* INDOWINITIALLYPRIMARY */ |
| 152460 | | -static const char zKWText[613] = { |
| 153116 | +/* ABLEFTHENDEFERRABLELSEXCLUDELETEMPORARYCONSTRAINTERSECTIES */ |
| 153117 | +/* AVEPOINTOFFSETRANSACTIONATURALTERAISEXCEPTRIGGEREFERENCES */ |
| 153118 | +/* UNIQUERYWITHOUTERELEASEXCLUSIVEXISTSATTACHAVINGLOBEGINNERANGE */ |
| 153119 | +/* BETWEENOTHINGROUPSCASCADETACHCASECOLLATECREATECURRENT_DATE */ |
| 153120 | +/* IMMEDIATEJOINSERTLIKEMATCHPLANALYZEPRAGMABORTUPDATEVALUES */ |
| 153121 | +/* VIRTUALIMITWHENOTNULLWHERECURSIVEAFTERENAMEANDEFAULT */ |
| 153122 | +/* AUTOINCREMENTCASTCOLUMNCOMMITCONFLICTCROSSCURRENT_TIMESTAMP */ |
| 153123 | +/* ARTITIONDEFERREDISTINCTDROPRECEDINGFAILFILTEREPLACEFOLLOWING */ |
| 153124 | +/* FROMFULLIFISNULLORDERESTRICTOTHERSOVERIGHTROLLBACKROWS */ |
| 153125 | +/* UNBOUNDEDUNIONUSINGVACUUMVIEWINDOWBYINITIALLYPRIMARY */ |
| 153126 | +static const char zKWText[628] = { |
| 152461 | 153127 | 'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H', |
| 152462 | 153128 | 'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G', |
| 152463 | 153129 | 'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A', |
| 152464 | 153130 | 'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F', |
| 152465 | | - 'E','R','R','A','B','L','E','L','S','E','X','C','E','P','T','R','A','N', |
| 152466 | | - 'S','A','C','T','I','O','N','A','T','U','R','A','L','T','E','R','A','I', |
| 152467 | | - 'S','E','X','C','L','U','S','I','V','E','X','I','S','T','S','A','V','E', |
| 152468 | | - 'P','O','I','N','T','E','R','S','E','C','T','R','I','G','G','E','R','E', |
| 152469 | | - 'F','E','R','E','N','C','E','S','C','O','N','S','T','R','A','I','N','T', |
| 152470 | | - 'O','F','F','S','E','T','E','M','P','O','R','A','R','Y','U','N','I','Q', |
| 152471 | | - 'U','E','R','Y','W','I','T','H','O','U','T','E','R','E','L','E','A','S', |
| 152472 | | - 'E','A','T','T','A','C','H','A','V','I','N','G','R','O','U','P','D','A', |
| 152473 | | - 'T','E','B','E','G','I','N','N','E','R','A','N','G','E','B','E','T','W', |
| 152474 | | - 'E','E','N','O','T','H','I','N','G','L','O','B','Y','C','A','S','C','A', |
| 152475 | | - 'D','E','L','E','T','E','C','A','S','E','C','O','L','L','A','T','E','C', |
| 152476 | | - 'R','E','A','T','E','C','U','R','R','E','N','T','_','D','A','T','E','D', |
| 152477 | | - 'E','T','A','C','H','I','M','M','E','D','I','A','T','E','J','O','I','N', |
| 152478 | | - 'S','E','R','T','L','I','K','E','M','A','T','C','H','P','L','A','N','A', |
| 152479 | | - 'L','Y','Z','E','P','R','A','G','M','A','B','O','R','T','V','A','L','U', |
| 152480 | | - 'E','S','V','I','R','T','U','A','L','I','M','I','T','W','H','E','N','O', |
| 152481 | | - 'T','N','U','L','L','W','H','E','R','E','C','U','R','S','I','V','E','A', |
| 152482 | | - 'F','T','E','R','E','N','A','M','E','A','N','D','E','F','A','U','L','T', |
| 152483 | | - 'A','U','T','O','I','N','C','R','E','M','E','N','T','C','A','S','T','C', |
| 152484 | | - 'O','L','U','M','N','C','O','M','M','I','T','C','O','N','F','L','I','C', |
| 152485 | | - 'T','C','R','O','S','S','C','U','R','R','E','N','T','_','T','I','M','E', |
| 152486 | | - 'S','T','A','M','P','A','R','T','I','T','I','O','N','D','E','F','E','R', |
| 152487 | | - 'R','E','D','I','S','T','I','N','C','T','D','R','O','P','R','E','C','E', |
| 152488 | | - 'D','I','N','G','F','A','I','L','F','I','L','T','E','R','E','P','L','A', |
| 152489 | | - 'C','E','F','O','L','L','O','W','I','N','G','F','R','O','M','F','U','L', |
| 152490 | | - 'L','I','F','I','S','N','U','L','L','O','R','D','E','R','E','S','T','R', |
| 152491 | | - 'I','C','T','O','V','E','R','I','G','H','T','R','O','L','L','B','A','C', |
| 152492 | | - 'K','R','O','W','S','U','N','B','O','U','N','D','E','D','U','N','I','O', |
| 152493 | | - 'N','U','S','I','N','G','V','A','C','U','U','M','V','I','E','W','I','N', |
| 152494 | | - 'D','O','W','I','N','I','T','I','A','L','L','Y','P','R','I','M','A','R', |
| 152495 | | - 'Y', |
| 153131 | + 'E','R','R','A','B','L','E','L','S','E','X','C','L','U','D','E','L','E', |
| 153132 | + 'T','E','M','P','O','R','A','R','Y','C','O','N','S','T','R','A','I','N', |
| 153133 | + 'T','E','R','S','E','C','T','I','E','S','A','V','E','P','O','I','N','T', |
| 153134 | + 'O','F','F','S','E','T','R','A','N','S','A','C','T','I','O','N','A','T', |
| 153135 | + 'U','R','A','L','T','E','R','A','I','S','E','X','C','E','P','T','R','I', |
| 153136 | + 'G','G','E','R','E','F','E','R','E','N','C','E','S','U','N','I','Q','U', |
| 153137 | + 'E','R','Y','W','I','T','H','O','U','T','E','R','E','L','E','A','S','E', |
| 153138 | + 'X','C','L','U','S','I','V','E','X','I','S','T','S','A','T','T','A','C', |
| 153139 | + 'H','A','V','I','N','G','L','O','B','E','G','I','N','N','E','R','A','N', |
| 153140 | + 'G','E','B','E','T','W','E','E','N','O','T','H','I','N','G','R','O','U', |
| 153141 | + 'P','S','C','A','S','C','A','D','E','T','A','C','H','C','A','S','E','C', |
| 153142 | + 'O','L','L','A','T','E','C','R','E','A','T','E','C','U','R','R','E','N', |
| 153143 | + 'T','_','D','A','T','E','I','M','M','E','D','I','A','T','E','J','O','I', |
| 153144 | + 'N','S','E','R','T','L','I','K','E','M','A','T','C','H','P','L','A','N', |
| 153145 | + 'A','L','Y','Z','E','P','R','A','G','M','A','B','O','R','T','U','P','D', |
| 153146 | + 'A','T','E','V','A','L','U','E','S','V','I','R','T','U','A','L','I','M', |
| 153147 | + 'I','T','W','H','E','N','O','T','N','U','L','L','W','H','E','R','E','C', |
| 153148 | + 'U','R','S','I','V','E','A','F','T','E','R','E','N','A','M','E','A','N', |
| 153149 | + 'D','E','F','A','U','L','T','A','U','T','O','I','N','C','R','E','M','E', |
| 153150 | + 'N','T','C','A','S','T','C','O','L','U','M','N','C','O','M','M','I','T', |
| 153151 | + 'C','O','N','F','L','I','C','T','C','R','O','S','S','C','U','R','R','E', |
| 153152 | + 'N','T','_','T','I','M','E','S','T','A','M','P','A','R','T','I','T','I', |
| 153153 | + 'O','N','D','E','F','E','R','R','E','D','I','S','T','I','N','C','T','D', |
| 153154 | + 'R','O','P','R','E','C','E','D','I','N','G','F','A','I','L','F','I','L', |
| 153155 | + 'T','E','R','E','P','L','A','C','E','F','O','L','L','O','W','I','N','G', |
| 153156 | + 'F','R','O','M','F','U','L','L','I','F','I','S','N','U','L','L','O','R', |
| 153157 | + 'D','E','R','E','S','T','R','I','C','T','O','T','H','E','R','S','O','V', |
| 153158 | + 'E','R','I','G','H','T','R','O','L','L','B','A','C','K','R','O','W','S', |
| 153159 | + 'U','N','B','O','U','N','D','E','D','U','N','I','O','N','U','S','I','N', |
| 153160 | + 'G','V','A','C','U','U','M','V','I','E','W','I','N','D','O','W','B','Y', |
| 153161 | + 'I','N','I','T','I','A','L','L','Y','P','R','I','M','A','R','Y', |
| 152496 | 153162 | }; |
| 152497 | 153163 | /* aKWHash[i] is the hash value for the i-th keyword */ |
| 152498 | 153164 | static const unsigned char aKWHash[127] = { |
| 152499 | | - 74, 109, 124, 72, 106, 45, 0, 0, 81, 0, 76, 61, 0, |
| 152500 | | - 42, 12, 77, 15, 0, 123, 84, 54, 118, 125, 19, 0, 0, |
| 152501 | | - 130, 0, 128, 121, 0, 22, 96, 0, 9, 0, 0, 115, 69, |
| 152502 | | - 0, 67, 6, 0, 48, 93, 136, 0, 126, 104, 0, 0, 44, |
| 152503 | | - 0, 107, 24, 0, 17, 0, 131, 53, 23, 0, 5, 62, 132, |
| 152504 | | - 99, 0, 0, 135, 110, 60, 134, 57, 113, 55, 0, 94, 0, |
| 152505 | | - 103, 26, 0, 102, 0, 0, 0, 98, 95, 100, 105, 117, 14, |
| 152506 | | - 39, 116, 0, 80, 0, 133, 114, 92, 59, 0, 129, 79, 119, |
| 152507 | | - 86, 46, 83, 0, 0, 97, 40, 122, 120, 0, 127, 0, 0, |
| 152508 | | - 29, 0, 89, 87, 88, 0, 20, 85, 111, 56, |
| 153165 | + 75, 111, 127, 73, 108, 29, 0, 0, 83, 0, 77, 63, 0, |
| 153166 | + 37, 33, 78, 15, 0, 126, 86, 57, 120, 128, 19, 0, 0, |
| 153167 | + 133, 0, 131, 123, 0, 22, 98, 0, 9, 0, 0, 117, 71, |
| 153168 | + 0, 69, 6, 0, 49, 95, 140, 0, 129, 106, 0, 0, 54, |
| 153169 | + 0, 109, 24, 0, 17, 0, 134, 56, 23, 26, 5, 58, 135, |
| 153170 | + 101, 0, 0, 139, 112, 62, 138, 59, 115, 65, 0, 96, 0, |
| 153171 | + 105, 45, 0, 104, 0, 0, 0, 100, 97, 102, 107, 119, 14, |
| 153172 | + 31, 118, 0, 81, 0, 136, 116, 137, 61, 124, 132, 80, 121, |
| 153173 | + 88, 30, 85, 0, 0, 99, 35, 125, 122, 0, 130, 0, 0, |
| 153174 | + 41, 0, 91, 89, 90, 0, 20, 87, 113, 82, |
| 152509 | 153175 | }; |
| 152510 | 153176 | /* aKWNext[] forms the hash collision chain. If aKWHash[i]==0 |
| 152511 | 153177 | ** then the i-th keyword has no more hash collisions. Otherwise, |
| 152512 | 153178 | ** the next keyword with the same hash is aKWHash[i]-1. */ |
| 152513 | | -static const unsigned char aKWNext[136] = { |
| 153179 | +static const unsigned char aKWNext[140] = { |
| 152514 | 153180 | 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, |
| 152515 | 153181 | 0, 2, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, |
| 152516 | | - 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 152517 | | - 0, 0, 0, 0, 33, 0, 21, 0, 0, 0, 0, 0, 50, |
| 152518 | | - 0, 43, 3, 47, 0, 0, 32, 0, 0, 0, 0, 0, 0, |
| 152519 | | - 0, 1, 64, 0, 0, 65, 0, 41, 0, 38, 0, 0, 0, |
| 152520 | | - 0, 0, 49, 75, 0, 0, 30, 0, 58, 0, 0, 0, 31, |
| 152521 | | - 63, 16, 34, 10, 0, 0, 0, 0, 0, 0, 0, 11, 70, |
| 152522 | | - 91, 0, 0, 8, 0, 108, 0, 101, 28, 52, 68, 0, 112, |
| 152523 | | - 0, 73, 51, 0, 90, 27, 37, 0, 71, 36, 82, 0, 35, |
| 152524 | | - 66, 25, 18, 0, 0, 78, |
| 153182 | + 0, 0, 0, 21, 0, 0, 12, 0, 0, 0, 0, 0, 0, |
| 153183 | + 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 153184 | + 51, 28, 0, 0, 38, 0, 0, 0, 44, 0, 0, 0, 3, |
| 153185 | + 0, 0, 67, 1, 66, 0, 0, 0, 36, 0, 47, 0, 0, |
| 153186 | + 0, 0, 0, 48, 50, 76, 0, 0, 42, 0, 60, 0, 0, |
| 153187 | + 0, 43, 0, 16, 55, 10, 0, 0, 0, 0, 0, 0, 0, |
| 153188 | + 11, 72, 93, 0, 0, 8, 0, 110, 0, 103, 40, 53, 70, |
| 153189 | + 0, 114, 0, 74, 52, 0, 0, 92, 39, 46, 0, 68, 32, |
| 153190 | + 84, 0, 34, 27, 25, 18, 94, 0, 64, 79, |
| 152525 | 153191 | }; |
| 152526 | 153192 | /* aKWLen[i] is the length (in bytes) of the i-th keyword */ |
| 152527 | | -static const unsigned char aKWLen[136] = { |
| 153193 | +static const unsigned char aKWLen[140] = { |
| 152528 | 153194 | 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6, |
| 152529 | | - 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 6, |
| 152530 | | - 11, 6, 2, 7, 5, 5, 9, 6, 9, 9, 7, 10, 10, |
| 152531 | | - 4, 6, 2, 3, 9, 4, 2, 6, 5, 7, 4, 5, 7, |
| 152532 | | - 6, 6, 5, 6, 5, 5, 5, 7, 7, 4, 2, 7, 3, |
| 152533 | | - 6, 4, 7, 6, 12, 6, 9, 4, 6, 4, 5, 4, 7, |
| 152534 | | - 6, 5, 6, 7, 5, 4, 7, 3, 2, 4, 5, 9, 5, |
| 152535 | | - 6, 3, 7, 13, 2, 2, 4, 6, 6, 8, 5, 17, 12, |
| 152536 | | - 7, 9, 8, 8, 2, 4, 9, 4, 6, 7, 9, 4, 4, |
| 152537 | | - 2, 6, 5, 8, 4, 5, 8, 4, 3, 9, 5, 5, 6, |
| 152538 | | - 4, 6, 2, 9, 3, 7, |
| 153195 | + 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 7, |
| 153196 | + 6, 9, 4, 2, 10, 9, 4, 9, 4, 6, 2, 3, 11, |
| 153197 | + 6, 2, 7, 5, 5, 6, 7, 10, 6, 5, 7, 4, 5, |
| 153198 | + 7, 9, 6, 6, 6, 4, 5, 5, 5, 7, 7, 6, 5, |
| 153199 | + 7, 3, 6, 4, 7, 6, 12, 9, 4, 6, 4, 5, 4, |
| 153200 | + 7, 6, 5, 6, 6, 7, 5, 4, 7, 3, 2, 4, 5, |
| 153201 | + 9, 5, 6, 3, 7, 13, 2, 2, 4, 6, 6, 8, 5, |
| 153202 | + 17, 12, 7, 9, 8, 8, 2, 4, 9, 4, 6, 7, 9, |
| 153203 | + 4, 4, 2, 6, 5, 8, 6, 4, 5, 8, 4, 3, 9, |
| 153204 | + 5, 5, 6, 4, 6, 2, 2, 9, 3, 7, |
| 152539 | 153205 | }; |
| 152540 | 153206 | /* aKWOffset[i] is the index into zKWText[] of the start of |
| 152541 | 153207 | ** the text for the i-th keyword. */ |
| 152542 | | -static const unsigned short int aKWOffset[136] = { |
| 153208 | +static const unsigned short int aKWOffset[140] = { |
| 152543 | 153209 | 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33, |
| 152544 | 153210 | 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81, |
| 152545 | | - 86, 91, 95, 96, 101, 105, 109, 117, 122, 128, 136, 142, 152, |
| 152546 | | - 159, 162, 162, 165, 167, 167, 171, 176, 179, 184, 184, 188, 192, |
| 152547 | | - 199, 204, 209, 212, 218, 221, 225, 230, 236, 242, 245, 247, 248, |
| 152548 | | - 252, 258, 262, 269, 275, 287, 293, 302, 304, 310, 314, 319, 321, |
| 152549 | | - 328, 333, 338, 344, 350, 355, 358, 358, 358, 361, 365, 368, 377, |
| 152550 | | - 381, 387, 389, 396, 398, 400, 409, 413, 419, 425, 433, 438, 438, |
| 152551 | | - 438, 454, 463, 470, 471, 478, 481, 490, 494, 499, 506, 515, 519, |
| 152552 | | - 523, 525, 531, 535, 543, 546, 551, 559, 559, 563, 572, 577, 582, |
| 152553 | | - 588, 591, 594, 597, 602, 606, |
| 153211 | + 86, 90, 90, 94, 99, 106, 114, 117, 123, 126, 126, 129, 131, |
| 153212 | + 136, 140, 141, 146, 150, 154, 159, 165, 175, 178, 183, 183, 187, |
| 153213 | + 191, 197, 205, 211, 216, 221, 224, 227, 231, 236, 242, 248, 248, |
| 153214 | + 254, 255, 259, 265, 269, 276, 282, 294, 303, 305, 311, 315, 320, |
| 153215 | + 322, 329, 334, 339, 345, 351, 357, 362, 365, 365, 365, 368, 372, |
| 153216 | + 375, 384, 388, 394, 396, 403, 405, 407, 416, 420, 426, 432, 440, |
| 153217 | + 445, 445, 445, 461, 470, 477, 478, 485, 488, 497, 501, 506, 513, |
| 153218 | + 522, 526, 530, 532, 538, 542, 550, 556, 559, 564, 572, 572, 576, |
| 153219 | + 585, 590, 595, 601, 604, 607, 610, 612, 617, 621, |
| 152554 | 153220 | }; |
| 152555 | 153221 | /* aKWCode[i] is the parser symbol code for the i-th keyword */ |
| 152556 | | -static const unsigned char aKWCode[136] = { |
| 153222 | +static const unsigned char aKWCode[140] = { |
| 152557 | 153223 | TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE, |
| 152558 | 153224 | TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN, |
| 152559 | 153225 | TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD, |
| 152560 | 153226 | TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE, |
| 152561 | 153227 | TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE, |
| 152562 | | - TK_EXCEPT, TK_TRANSACTION,TK_ACTION, TK_ON, TK_JOIN_KW, |
| 152563 | | - TK_ALTER, TK_RAISE, TK_EXCLUSIVE, TK_EXISTS, TK_SAVEPOINT, |
| 152564 | | - TK_INTERSECT, TK_TRIGGER, TK_REFERENCES, TK_CONSTRAINT, TK_INTO, |
| 152565 | | - TK_OFFSET, TK_OF, TK_SET, TK_TEMP, TK_TEMP, |
| 152566 | | - TK_OR, TK_UNIQUE, TK_QUERY, TK_WITHOUT, TK_WITH, |
| 152567 | | - TK_JOIN_KW, TK_RELEASE, TK_ATTACH, TK_HAVING, TK_GROUP, |
| 152568 | | - TK_UPDATE, TK_BEGIN, TK_JOIN_KW, TK_RANGE, TK_BETWEEN, |
| 152569 | | - TK_NOTHING, TK_LIKE_KW, TK_BY, TK_CASCADE, TK_ASC, |
| 152570 | | - TK_DELETE, TK_CASE, TK_COLLATE, TK_CREATE, TK_CTIME_KW, |
| 152571 | | - TK_DETACH, TK_IMMEDIATE, TK_JOIN, TK_INSERT, TK_LIKE_KW, |
| 152572 | | - TK_MATCH, TK_PLAN, TK_ANALYZE, TK_PRAGMA, TK_ABORT, |
| 152573 | | - TK_VALUES, TK_VIRTUAL, TK_LIMIT, TK_WHEN, TK_NOTNULL, |
| 152574 | | - TK_NOT, TK_NO, TK_NULL, TK_WHERE, TK_RECURSIVE, |
| 152575 | | - TK_AFTER, TK_RENAME, TK_AND, TK_DEFAULT, TK_AUTOINCR, |
| 152576 | | - TK_TO, TK_IN, TK_CAST, TK_COLUMNKW, TK_COMMIT, |
| 152577 | | - TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW, TK_CTIME_KW, TK_CURRENT, |
| 152578 | | - TK_PARTITION, TK_DEFERRED, TK_DISTINCT, TK_IS, TK_DROP, |
| 152579 | | - TK_PRECEDING, TK_FAIL, TK_FILTER, TK_REPLACE, TK_FOLLOWING, |
| 152580 | | - TK_FROM, TK_JOIN_KW, TK_IF, TK_ISNULL, TK_ORDER, |
| 152581 | | - TK_RESTRICT, TK_OVER, TK_JOIN_KW, TK_ROLLBACK, TK_ROWS, |
| 152582 | | - TK_ROW, TK_UNBOUNDED, TK_UNION, TK_USING, TK_VACUUM, |
| 152583 | | - TK_VIEW, TK_WINDOW, TK_DO, TK_INITIALLY, TK_ALL, |
| 152584 | | - TK_PRIMARY, |
| 153228 | + TK_EXCLUDE, TK_DELETE, TK_TEMP, TK_TEMP, TK_OR, |
| 153229 | + TK_CONSTRAINT, TK_INTERSECT, TK_TIES, TK_SAVEPOINT, TK_INTO, |
| 153230 | + TK_OFFSET, TK_OF, TK_SET, TK_TRANSACTION,TK_ACTION, |
| 153231 | + TK_ON, TK_JOIN_KW, TK_ALTER, TK_RAISE, TK_EXCEPT, |
| 153232 | + TK_TRIGGER, TK_REFERENCES, TK_UNIQUE, TK_QUERY, TK_WITHOUT, |
| 153233 | + TK_WITH, TK_JOIN_KW, TK_RELEASE, TK_EXCLUSIVE, TK_EXISTS, |
| 153234 | + TK_ATTACH, TK_HAVING, TK_LIKE_KW, TK_BEGIN, TK_JOIN_KW, |
| 153235 | + TK_RANGE, TK_BETWEEN, TK_NOTHING, TK_GROUPS, TK_GROUP, |
| 153236 | + TK_CASCADE, TK_ASC, TK_DETACH, TK_CASE, TK_COLLATE, |
| 153237 | + TK_CREATE, TK_CTIME_KW, TK_IMMEDIATE, TK_JOIN, TK_INSERT, |
| 153238 | + TK_LIKE_KW, TK_MATCH, TK_PLAN, TK_ANALYZE, TK_PRAGMA, |
| 153239 | + TK_ABORT, TK_UPDATE, TK_VALUES, TK_VIRTUAL, TK_LIMIT, |
| 153240 | + TK_WHEN, TK_NOTNULL, TK_NOT, TK_NO, TK_NULL, |
| 153241 | + TK_WHERE, TK_RECURSIVE, TK_AFTER, TK_RENAME, TK_AND, |
| 153242 | + TK_DEFAULT, TK_AUTOINCR, TK_TO, TK_IN, TK_CAST, |
| 153243 | + TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW, |
| 153244 | + TK_CTIME_KW, TK_CURRENT, TK_PARTITION, TK_DEFERRED, TK_DISTINCT, |
| 153245 | + TK_IS, TK_DROP, TK_PRECEDING, TK_FAIL, TK_FILTER, |
| 153246 | + TK_REPLACE, TK_FOLLOWING, TK_FROM, TK_JOIN_KW, TK_IF, |
| 153247 | + TK_ISNULL, TK_ORDER, TK_RESTRICT, TK_OTHERS, TK_OVER, |
| 153248 | + TK_JOIN_KW, TK_ROLLBACK, TK_ROWS, TK_ROW, TK_UNBOUNDED, |
| 153249 | + TK_UNION, TK_USING, TK_VACUUM, TK_VIEW, TK_WINDOW, |
| 153250 | + TK_DO, TK_BY, TK_INITIALLY, TK_ALL, TK_PRIMARY, |
| 152585 | 153251 | }; |
| 152586 | 153252 | /* Check to see if z[0..n-1] is a keyword. If it is, write the |
| 152587 | 153253 | ** parser symbol code for that keyword into *pType. Always |
| 152588 | 153254 | ** return the integer n (the length of the token). */ |
| 152589 | 153255 | static int keywordCode(const char *z, int n, int *pType){ |
| | @@ -152625,121 +153291,125 @@ |
| 152625 | 153291 | testcase( i==20 ); /* LEFT */ |
| 152626 | 153292 | testcase( i==21 ); /* THEN */ |
| 152627 | 153293 | testcase( i==22 ); /* END */ |
| 152628 | 153294 | testcase( i==23 ); /* DEFERRABLE */ |
| 152629 | 153295 | testcase( i==24 ); /* ELSE */ |
| 152630 | | - testcase( i==25 ); /* EXCEPT */ |
| 152631 | | - testcase( i==26 ); /* TRANSACTION */ |
| 152632 | | - testcase( i==27 ); /* ACTION */ |
| 152633 | | - testcase( i==28 ); /* ON */ |
| 152634 | | - testcase( i==29 ); /* NATURAL */ |
| 152635 | | - testcase( i==30 ); /* ALTER */ |
| 152636 | | - testcase( i==31 ); /* RAISE */ |
| 152637 | | - testcase( i==32 ); /* EXCLUSIVE */ |
| 152638 | | - testcase( i==33 ); /* EXISTS */ |
| 152639 | | - testcase( i==34 ); /* SAVEPOINT */ |
| 152640 | | - testcase( i==35 ); /* INTERSECT */ |
| 152641 | | - testcase( i==36 ); /* TRIGGER */ |
| 152642 | | - testcase( i==37 ); /* REFERENCES */ |
| 152643 | | - testcase( i==38 ); /* CONSTRAINT */ |
| 152644 | | - testcase( i==39 ); /* INTO */ |
| 152645 | | - testcase( i==40 ); /* OFFSET */ |
| 152646 | | - testcase( i==41 ); /* OF */ |
| 152647 | | - testcase( i==42 ); /* SET */ |
| 152648 | | - testcase( i==43 ); /* TEMPORARY */ |
| 152649 | | - testcase( i==44 ); /* TEMP */ |
| 152650 | | - testcase( i==45 ); /* OR */ |
| 152651 | | - testcase( i==46 ); /* UNIQUE */ |
| 152652 | | - testcase( i==47 ); /* QUERY */ |
| 152653 | | - testcase( i==48 ); /* WITHOUT */ |
| 152654 | | - testcase( i==49 ); /* WITH */ |
| 152655 | | - testcase( i==50 ); /* OUTER */ |
| 152656 | | - testcase( i==51 ); /* RELEASE */ |
| 152657 | | - testcase( i==52 ); /* ATTACH */ |
| 152658 | | - testcase( i==53 ); /* HAVING */ |
| 152659 | | - testcase( i==54 ); /* GROUP */ |
| 152660 | | - testcase( i==55 ); /* UPDATE */ |
| 152661 | | - testcase( i==56 ); /* BEGIN */ |
| 152662 | | - testcase( i==57 ); /* INNER */ |
| 152663 | | - testcase( i==58 ); /* RANGE */ |
| 152664 | | - testcase( i==59 ); /* BETWEEN */ |
| 152665 | | - testcase( i==60 ); /* NOTHING */ |
| 152666 | | - testcase( i==61 ); /* GLOB */ |
| 152667 | | - testcase( i==62 ); /* BY */ |
| 152668 | | - testcase( i==63 ); /* CASCADE */ |
| 152669 | | - testcase( i==64 ); /* ASC */ |
| 152670 | | - testcase( i==65 ); /* DELETE */ |
| 152671 | | - testcase( i==66 ); /* CASE */ |
| 152672 | | - testcase( i==67 ); /* COLLATE */ |
| 152673 | | - testcase( i==68 ); /* CREATE */ |
| 152674 | | - testcase( i==69 ); /* CURRENT_DATE */ |
| 152675 | | - testcase( i==70 ); /* DETACH */ |
| 152676 | | - testcase( i==71 ); /* IMMEDIATE */ |
| 152677 | | - testcase( i==72 ); /* JOIN */ |
| 152678 | | - testcase( i==73 ); /* INSERT */ |
| 152679 | | - testcase( i==74 ); /* LIKE */ |
| 152680 | | - testcase( i==75 ); /* MATCH */ |
| 152681 | | - testcase( i==76 ); /* PLAN */ |
| 152682 | | - testcase( i==77 ); /* ANALYZE */ |
| 152683 | | - testcase( i==78 ); /* PRAGMA */ |
| 152684 | | - testcase( i==79 ); /* ABORT */ |
| 152685 | | - testcase( i==80 ); /* VALUES */ |
| 152686 | | - testcase( i==81 ); /* VIRTUAL */ |
| 152687 | | - testcase( i==82 ); /* LIMIT */ |
| 152688 | | - testcase( i==83 ); /* WHEN */ |
| 152689 | | - testcase( i==84 ); /* NOTNULL */ |
| 152690 | | - testcase( i==85 ); /* NOT */ |
| 152691 | | - testcase( i==86 ); /* NO */ |
| 152692 | | - testcase( i==87 ); /* NULL */ |
| 152693 | | - testcase( i==88 ); /* WHERE */ |
| 152694 | | - testcase( i==89 ); /* RECURSIVE */ |
| 152695 | | - testcase( i==90 ); /* AFTER */ |
| 152696 | | - testcase( i==91 ); /* RENAME */ |
| 152697 | | - testcase( i==92 ); /* AND */ |
| 152698 | | - testcase( i==93 ); /* DEFAULT */ |
| 152699 | | - testcase( i==94 ); /* AUTOINCREMENT */ |
| 152700 | | - testcase( i==95 ); /* TO */ |
| 152701 | | - testcase( i==96 ); /* IN */ |
| 152702 | | - testcase( i==97 ); /* CAST */ |
| 152703 | | - testcase( i==98 ); /* COLUMN */ |
| 152704 | | - testcase( i==99 ); /* COMMIT */ |
| 152705 | | - testcase( i==100 ); /* CONFLICT */ |
| 152706 | | - testcase( i==101 ); /* CROSS */ |
| 152707 | | - testcase( i==102 ); /* CURRENT_TIMESTAMP */ |
| 152708 | | - testcase( i==103 ); /* CURRENT_TIME */ |
| 152709 | | - testcase( i==104 ); /* CURRENT */ |
| 152710 | | - testcase( i==105 ); /* PARTITION */ |
| 152711 | | - testcase( i==106 ); /* DEFERRED */ |
| 152712 | | - testcase( i==107 ); /* DISTINCT */ |
| 152713 | | - testcase( i==108 ); /* IS */ |
| 152714 | | - testcase( i==109 ); /* DROP */ |
| 152715 | | - testcase( i==110 ); /* PRECEDING */ |
| 152716 | | - testcase( i==111 ); /* FAIL */ |
| 152717 | | - testcase( i==112 ); /* FILTER */ |
| 152718 | | - testcase( i==113 ); /* REPLACE */ |
| 152719 | | - testcase( i==114 ); /* FOLLOWING */ |
| 152720 | | - testcase( i==115 ); /* FROM */ |
| 152721 | | - testcase( i==116 ); /* FULL */ |
| 152722 | | - testcase( i==117 ); /* IF */ |
| 152723 | | - testcase( i==118 ); /* ISNULL */ |
| 152724 | | - testcase( i==119 ); /* ORDER */ |
| 152725 | | - testcase( i==120 ); /* RESTRICT */ |
| 152726 | | - testcase( i==121 ); /* OVER */ |
| 152727 | | - testcase( i==122 ); /* RIGHT */ |
| 152728 | | - testcase( i==123 ); /* ROLLBACK */ |
| 152729 | | - testcase( i==124 ); /* ROWS */ |
| 152730 | | - testcase( i==125 ); /* ROW */ |
| 152731 | | - testcase( i==126 ); /* UNBOUNDED */ |
| 152732 | | - testcase( i==127 ); /* UNION */ |
| 152733 | | - testcase( i==128 ); /* USING */ |
| 152734 | | - testcase( i==129 ); /* VACUUM */ |
| 152735 | | - testcase( i==130 ); /* VIEW */ |
| 152736 | | - testcase( i==131 ); /* WINDOW */ |
| 152737 | | - testcase( i==132 ); /* DO */ |
| 152738 | | - testcase( i==133 ); /* INITIALLY */ |
| 152739 | | - testcase( i==134 ); /* ALL */ |
| 152740 | | - testcase( i==135 ); /* PRIMARY */ |
| 153296 | + testcase( i==25 ); /* EXCLUDE */ |
| 153297 | + testcase( i==26 ); /* DELETE */ |
| 153298 | + testcase( i==27 ); /* TEMPORARY */ |
| 153299 | + testcase( i==28 ); /* TEMP */ |
| 153300 | + testcase( i==29 ); /* OR */ |
| 153301 | + testcase( i==30 ); /* CONSTRAINT */ |
| 153302 | + testcase( i==31 ); /* INTERSECT */ |
| 153303 | + testcase( i==32 ); /* TIES */ |
| 153304 | + testcase( i==33 ); /* SAVEPOINT */ |
| 153305 | + testcase( i==34 ); /* INTO */ |
| 153306 | + testcase( i==35 ); /* OFFSET */ |
| 153307 | + testcase( i==36 ); /* OF */ |
| 153308 | + testcase( i==37 ); /* SET */ |
| 153309 | + testcase( i==38 ); /* TRANSACTION */ |
| 153310 | + testcase( i==39 ); /* ACTION */ |
| 153311 | + testcase( i==40 ); /* ON */ |
| 153312 | + testcase( i==41 ); /* NATURAL */ |
| 153313 | + testcase( i==42 ); /* ALTER */ |
| 153314 | + testcase( i==43 ); /* RAISE */ |
| 153315 | + testcase( i==44 ); /* EXCEPT */ |
| 153316 | + testcase( i==45 ); /* TRIGGER */ |
| 153317 | + testcase( i==46 ); /* REFERENCES */ |
| 153318 | + testcase( i==47 ); /* UNIQUE */ |
| 153319 | + testcase( i==48 ); /* QUERY */ |
| 153320 | + testcase( i==49 ); /* WITHOUT */ |
| 153321 | + testcase( i==50 ); /* WITH */ |
| 153322 | + testcase( i==51 ); /* OUTER */ |
| 153323 | + testcase( i==52 ); /* RELEASE */ |
| 153324 | + testcase( i==53 ); /* EXCLUSIVE */ |
| 153325 | + testcase( i==54 ); /* EXISTS */ |
| 153326 | + testcase( i==55 ); /* ATTACH */ |
| 153327 | + testcase( i==56 ); /* HAVING */ |
| 153328 | + testcase( i==57 ); /* GLOB */ |
| 153329 | + testcase( i==58 ); /* BEGIN */ |
| 153330 | + testcase( i==59 ); /* INNER */ |
| 153331 | + testcase( i==60 ); /* RANGE */ |
| 153332 | + testcase( i==61 ); /* BETWEEN */ |
| 153333 | + testcase( i==62 ); /* NOTHING */ |
| 153334 | + testcase( i==63 ); /* GROUPS */ |
| 153335 | + testcase( i==64 ); /* GROUP */ |
| 153336 | + testcase( i==65 ); /* CASCADE */ |
| 153337 | + testcase( i==66 ); /* ASC */ |
| 153338 | + testcase( i==67 ); /* DETACH */ |
| 153339 | + testcase( i==68 ); /* CASE */ |
| 153340 | + testcase( i==69 ); /* COLLATE */ |
| 153341 | + testcase( i==70 ); /* CREATE */ |
| 153342 | + testcase( i==71 ); /* CURRENT_DATE */ |
| 153343 | + testcase( i==72 ); /* IMMEDIATE */ |
| 153344 | + testcase( i==73 ); /* JOIN */ |
| 153345 | + testcase( i==74 ); /* INSERT */ |
| 153346 | + testcase( i==75 ); /* LIKE */ |
| 153347 | + testcase( i==76 ); /* MATCH */ |
| 153348 | + testcase( i==77 ); /* PLAN */ |
| 153349 | + testcase( i==78 ); /* ANALYZE */ |
| 153350 | + testcase( i==79 ); /* PRAGMA */ |
| 153351 | + testcase( i==80 ); /* ABORT */ |
| 153352 | + testcase( i==81 ); /* UPDATE */ |
| 153353 | + testcase( i==82 ); /* VALUES */ |
| 153354 | + testcase( i==83 ); /* VIRTUAL */ |
| 153355 | + testcase( i==84 ); /* LIMIT */ |
| 153356 | + testcase( i==85 ); /* WHEN */ |
| 153357 | + testcase( i==86 ); /* NOTNULL */ |
| 153358 | + testcase( i==87 ); /* NOT */ |
| 153359 | + testcase( i==88 ); /* NO */ |
| 153360 | + testcase( i==89 ); /* NULL */ |
| 153361 | + testcase( i==90 ); /* WHERE */ |
| 153362 | + testcase( i==91 ); /* RECURSIVE */ |
| 153363 | + testcase( i==92 ); /* AFTER */ |
| 153364 | + testcase( i==93 ); /* RENAME */ |
| 153365 | + testcase( i==94 ); /* AND */ |
| 153366 | + testcase( i==95 ); /* DEFAULT */ |
| 153367 | + testcase( i==96 ); /* AUTOINCREMENT */ |
| 153368 | + testcase( i==97 ); /* TO */ |
| 153369 | + testcase( i==98 ); /* IN */ |
| 153370 | + testcase( i==99 ); /* CAST */ |
| 153371 | + testcase( i==100 ); /* COLUMN */ |
| 153372 | + testcase( i==101 ); /* COMMIT */ |
| 153373 | + testcase( i==102 ); /* CONFLICT */ |
| 153374 | + testcase( i==103 ); /* CROSS */ |
| 153375 | + testcase( i==104 ); /* CURRENT_TIMESTAMP */ |
| 153376 | + testcase( i==105 ); /* CURRENT_TIME */ |
| 153377 | + testcase( i==106 ); /* CURRENT */ |
| 153378 | + testcase( i==107 ); /* PARTITION */ |
| 153379 | + testcase( i==108 ); /* DEFERRED */ |
| 153380 | + testcase( i==109 ); /* DISTINCT */ |
| 153381 | + testcase( i==110 ); /* IS */ |
| 153382 | + testcase( i==111 ); /* DROP */ |
| 153383 | + testcase( i==112 ); /* PRECEDING */ |
| 153384 | + testcase( i==113 ); /* FAIL */ |
| 153385 | + testcase( i==114 ); /* FILTER */ |
| 153386 | + testcase( i==115 ); /* REPLACE */ |
| 153387 | + testcase( i==116 ); /* FOLLOWING */ |
| 153388 | + testcase( i==117 ); /* FROM */ |
| 153389 | + testcase( i==118 ); /* FULL */ |
| 153390 | + testcase( i==119 ); /* IF */ |
| 153391 | + testcase( i==120 ); /* ISNULL */ |
| 153392 | + testcase( i==121 ); /* ORDER */ |
| 153393 | + testcase( i==122 ); /* RESTRICT */ |
| 153394 | + testcase( i==123 ); /* OTHERS */ |
| 153395 | + testcase( i==124 ); /* OVER */ |
| 153396 | + testcase( i==125 ); /* RIGHT */ |
| 153397 | + testcase( i==126 ); /* ROLLBACK */ |
| 153398 | + testcase( i==127 ); /* ROWS */ |
| 153399 | + testcase( i==128 ); /* ROW */ |
| 153400 | + testcase( i==129 ); /* UNBOUNDED */ |
| 153401 | + testcase( i==130 ); /* UNION */ |
| 153402 | + testcase( i==131 ); /* USING */ |
| 153403 | + testcase( i==132 ); /* VACUUM */ |
| 153404 | + testcase( i==133 ); /* VIEW */ |
| 153405 | + testcase( i==134 ); /* WINDOW */ |
| 153406 | + testcase( i==135 ); /* DO */ |
| 153407 | + testcase( i==136 ); /* BY */ |
| 153408 | + testcase( i==137 ); /* INITIALLY */ |
| 153409 | + testcase( i==138 ); /* ALL */ |
| 153410 | + testcase( i==139 ); /* PRIMARY */ |
| 152741 | 153411 | *pType = aKWCode[i]; |
| 152742 | 153412 | break; |
| 152743 | 153413 | } |
| 152744 | 153414 | } |
| 152745 | 153415 | return n; |
| | @@ -152747,11 +153417,11 @@ |
| 152747 | 153417 | SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char *z, int n){ |
| 152748 | 153418 | int id = TK_ID; |
| 152749 | 153419 | keywordCode((char*)z, n, &id); |
| 152750 | 153420 | return id; |
| 152751 | 153421 | } |
| 152752 | | -#define SQLITE_N_KEYWORD 136 |
| 153422 | +#define SQLITE_N_KEYWORD 140 |
| 152753 | 153423 | SQLITE_API int sqlite3_keyword_name(int i,const char **pzName,int *pnName){ |
| 152754 | 153424 | if( i<0 || i>=SQLITE_N_KEYWORD ) return SQLITE_ERROR; |
| 152755 | 153425 | *pzName = zKWText + aKWOffset[i]; |
| 152756 | 153426 | *pnName = aKWLen[i]; |
| 152757 | 153427 | return SQLITE_OK; |
| | @@ -154715,10 +155385,12 @@ |
| 154715 | 155385 | { SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE, SQLITE_NoCkptOnClose }, |
| 154716 | 155386 | { SQLITE_DBCONFIG_ENABLE_QPSG, SQLITE_EnableQPSG }, |
| 154717 | 155387 | { SQLITE_DBCONFIG_TRIGGER_EQP, SQLITE_TriggerEQP }, |
| 154718 | 155388 | { SQLITE_DBCONFIG_RESET_DATABASE, SQLITE_ResetDatabase }, |
| 154719 | 155389 | { SQLITE_DBCONFIG_DEFENSIVE, SQLITE_Defensive }, |
| 155390 | + { SQLITE_DBCONFIG_WRITABLE_SCHEMA, SQLITE_WriteSchema| |
| 155391 | + SQLITE_NoSchemaError }, |
| 154720 | 155392 | }; |
| 154721 | 155393 | unsigned int i; |
| 154722 | 155394 | rc = SQLITE_ERROR; /* IMP: R-42790-23372 */ |
| 154723 | 155395 | for(i=0; i<ArraySize(aFlagOp); i++){ |
| 154724 | 155396 | if( aFlagOp[i].op==op ){ |
| | @@ -168496,11 +169168,11 @@ |
| 168496 | 169168 | |
| 168497 | 169169 | zName = sqlite3_value_text(argv[0]); |
| 168498 | 169170 | nName = sqlite3_value_bytes(argv[0])+1; |
| 168499 | 169171 | |
| 168500 | 169172 | if( argc==2 ){ |
| 168501 | | - if( fts3TokenizerEnabled(context) ){ |
| 169173 | + if( fts3TokenizerEnabled(context) || sqlite3_value_frombind(argv[1]) ){ |
| 168502 | 169174 | void *pOld; |
| 168503 | 169175 | int n = sqlite3_value_bytes(argv[1]); |
| 168504 | 169176 | if( zName==0 || n!=sizeof(pPtr) ){ |
| 168505 | 169177 | sqlite3_result_error(context, "argument type mismatch", -1); |
| 168506 | 169178 | return; |
| | @@ -168523,11 +169195,11 @@ |
| 168523 | 169195 | sqlite3_result_error(context, zErr, -1); |
| 168524 | 169196 | sqlite3_free(zErr); |
| 168525 | 169197 | return; |
| 168526 | 169198 | } |
| 168527 | 169199 | } |
| 168528 | | - if( fts3TokenizerEnabled(context) ){ |
| 169200 | + if( fts3TokenizerEnabled(context) || sqlite3_value_frombind(argv[0]) ){ |
| 168529 | 169201 | sqlite3_result_blob(context, (void *)&pPtr, sizeof(pPtr), SQLITE_TRANSIENT); |
| 168530 | 169202 | } |
| 168531 | 169203 | } |
| 168532 | 169204 | |
| 168533 | 169205 | SQLITE_PRIVATE int sqlite3Fts3IsIdChar(char c){ |
| | @@ -184160,53 +184832,49 @@ |
| 184160 | 184832 | ** entry for each cell in the r-tree node. Each entry is itself a |
| 184161 | 184833 | ** list, containing the 8-byte rowid/pageno followed by the |
| 184162 | 184834 | ** <num-dimension>*2 coordinates. |
| 184163 | 184835 | */ |
| 184164 | 184836 | static void rtreenode(sqlite3_context *ctx, int nArg, sqlite3_value **apArg){ |
| 184165 | | - char *zText = 0; |
| 184166 | 184837 | RtreeNode node; |
| 184167 | 184838 | Rtree tree; |
| 184168 | 184839 | int ii; |
| 184840 | + int nData; |
| 184841 | + int errCode; |
| 184842 | + sqlite3_str *pOut; |
| 184169 | 184843 | |
| 184170 | 184844 | UNUSED_PARAMETER(nArg); |
| 184171 | 184845 | memset(&node, 0, sizeof(RtreeNode)); |
| 184172 | 184846 | memset(&tree, 0, sizeof(Rtree)); |
| 184173 | 184847 | tree.nDim = (u8)sqlite3_value_int(apArg[0]); |
| 184848 | + if( tree.nDim<1 || tree.nDim>5 ) return; |
| 184174 | 184849 | tree.nDim2 = tree.nDim*2; |
| 184175 | 184850 | tree.nBytesPerCell = 8 + 8 * tree.nDim; |
| 184176 | 184851 | node.zData = (u8 *)sqlite3_value_blob(apArg[1]); |
| 184852 | + nData = sqlite3_value_bytes(apArg[1]); |
| 184853 | + if( nData<4 ) return; |
| 184854 | + if( nData<NCELL(&node)*tree.nBytesPerCell ) return; |
| 184177 | 184855 | |
| 184856 | + pOut = sqlite3_str_new(0); |
| 184178 | 184857 | for(ii=0; ii<NCELL(&node); ii++){ |
| 184179 | | - char zCell[512]; |
| 184180 | | - int nCell = 0; |
| 184181 | 184858 | RtreeCell cell; |
| 184182 | 184859 | int jj; |
| 184183 | 184860 | |
| 184184 | 184861 | nodeGetCell(&tree, &node, ii, &cell); |
| 184185 | | - sqlite3_snprintf(512-nCell,&zCell[nCell],"%lld", cell.iRowid); |
| 184186 | | - nCell = (int)strlen(zCell); |
| 184862 | + if( ii>0 ) sqlite3_str_append(pOut, " ", 1); |
| 184863 | + sqlite3_str_appendf(pOut, "{%lld", cell.iRowid); |
| 184187 | 184864 | for(jj=0; jj<tree.nDim2; jj++){ |
| 184188 | 184865 | #ifndef SQLITE_RTREE_INT_ONLY |
| 184189 | | - sqlite3_snprintf(512-nCell,&zCell[nCell], " %g", |
| 184190 | | - (double)cell.aCoord[jj].f); |
| 184866 | + sqlite3_str_appendf(pOut, " %g", (double)cell.aCoord[jj].f); |
| 184191 | 184867 | #else |
| 184192 | | - sqlite3_snprintf(512-nCell,&zCell[nCell], " %d", |
| 184193 | | - cell.aCoord[jj].i); |
| 184868 | + sqlite3_str_appendf(pOut, " %d", cell.aCoord[jj].i); |
| 184194 | 184869 | #endif |
| 184195 | | - nCell = (int)strlen(zCell); |
| 184196 | | - } |
| 184197 | | - |
| 184198 | | - if( zText ){ |
| 184199 | | - char *zTextNew = sqlite3_mprintf("%s {%s}", zText, zCell); |
| 184200 | | - sqlite3_free(zText); |
| 184201 | | - zText = zTextNew; |
| 184202 | | - }else{ |
| 184203 | | - zText = sqlite3_mprintf("{%s}", zCell); |
| 184204 | | - } |
| 184205 | | - } |
| 184206 | | - |
| 184207 | | - sqlite3_result_text(ctx, zText, -1, sqlite3_free); |
| 184870 | + } |
| 184871 | + sqlite3_str_append(pOut, "}", 1); |
| 184872 | + } |
| 184873 | + errCode = sqlite3_str_errcode(pOut); |
| 184874 | + sqlite3_result_text(ctx, sqlite3_str_finish(pOut), -1, sqlite3_free); |
| 184875 | + sqlite3_result_error_code(ctx, errCode); |
| 184208 | 184876 | } |
| 184209 | 184877 | |
| 184210 | 184878 | /* This routine implements an SQL function that returns the "depth" parameter |
| 184211 | 184879 | ** from the front of a blob that is an r-tree node. For example: |
| 184212 | 184880 | ** |
| | @@ -198080,11 +198748,11 @@ |
| 198080 | 198748 | |
| 198081 | 198749 | return rc; |
| 198082 | 198750 | } |
| 198083 | 198751 | |
| 198084 | 198752 | /* |
| 198085 | | -** This function is called from within sqlite3changset_apply_v2() when |
| 198753 | +** This function is called from within sqlite3changeset_apply_v2() when |
| 198086 | 198754 | ** a conflict is encountered and resolved using conflict resolution |
| 198087 | 198755 | ** mode eType (either SQLITE_CHANGESET_OMIT or SQLITE_CHANGESET_REPLACE).. |
| 198088 | 198756 | ** It adds a conflict resolution record to the buffer in |
| 198089 | 198757 | ** SessionApplyCtx.rebase, which will eventually be returned to the caller |
| 198090 | 198758 | ** of apply_v2() as the "rebase" buffer. |
| | @@ -200859,12 +201527,13 @@ |
| 200859 | 201527 | */ |
| 200860 | 201528 | static void sqlite3Fts5HashClear(Fts5Hash*); |
| 200861 | 201529 | |
| 200862 | 201530 | static int sqlite3Fts5HashQuery( |
| 200863 | 201531 | Fts5Hash*, /* Hash table to query */ |
| 201532 | + int nPre, |
| 200864 | 201533 | const char *pTerm, int nTerm, /* Query term */ |
| 200865 | | - const u8 **ppDoclist, /* OUT: Pointer to doclist for pTerm */ |
| 201534 | + void **ppObj, /* OUT: Pointer to doclist for pTerm */ |
| 200866 | 201535 | int *pnDoclist /* OUT: Size of doclist in bytes */ |
| 200867 | 201536 | ); |
| 200868 | 201537 | |
| 200869 | 201538 | static int sqlite3Fts5HashScanInit( |
| 200870 | 201539 | Fts5Hash*, /* Hash table to query */ |
| | @@ -202930,11 +203599,11 @@ |
| 202930 | 203599 | *pnScore = nScore; |
| 202931 | 203600 | if( piPos ){ |
| 202932 | 203601 | sqlite3_int64 iAdj = iFirst - (nToken - (iLast-iFirst)) / 2; |
| 202933 | 203602 | if( (iAdj+nToken)>nDocsize ) iAdj = nDocsize - nToken; |
| 202934 | 203603 | if( iAdj<0 ) iAdj = 0; |
| 202935 | | - *piPos = iAdj; |
| 203604 | + *piPos = (int)iAdj; |
| 202936 | 203605 | } |
| 202937 | 203606 | |
| 202938 | 203607 | return rc; |
| 202939 | 203608 | } |
| 202940 | 203609 | |
| | @@ -203158,11 +203827,11 @@ |
| 203158 | 203827 | nByte = sizeof(Fts5Bm25Data) + nPhrase*2*sizeof(double); |
| 203159 | 203828 | p = (Fts5Bm25Data*)sqlite3_malloc64(nByte); |
| 203160 | 203829 | if( p==0 ){ |
| 203161 | 203830 | rc = SQLITE_NOMEM; |
| 203162 | 203831 | }else{ |
| 203163 | | - memset(p, 0, nByte); |
| 203832 | + memset(p, 0, (size_t)nByte); |
| 203164 | 203833 | p->nPhrase = nPhrase; |
| 203165 | 203834 | p->aIDF = (double*)&p[1]; |
| 203166 | 203835 | p->aFreq = &p->aIDF[nPhrase]; |
| 203167 | 203836 | } |
| 203168 | 203837 | |
| | @@ -203321,11 +203990,11 @@ |
| 203321 | 203990 | pNew = sqlite3_realloc64(pBuf->p, nNew); |
| 203322 | 203991 | if( pNew==0 ){ |
| 203323 | 203992 | *pRc = SQLITE_NOMEM; |
| 203324 | 203993 | return 1; |
| 203325 | 203994 | }else{ |
| 203326 | | - pBuf->nSpace = nNew; |
| 203995 | + pBuf->nSpace = (int)nNew; |
| 203327 | 203996 | pBuf->p = pNew; |
| 203328 | 203997 | } |
| 203329 | 203998 | } |
| 203330 | 203999 | return 0; |
| 203331 | 204000 | } |
| | @@ -203545,11 +204214,11 @@ |
| 203545 | 204214 | if( *pRc==SQLITE_OK ){ |
| 203546 | 204215 | pRet = sqlite3_malloc64(nByte); |
| 203547 | 204216 | if( pRet==0 ){ |
| 203548 | 204217 | if( nByte>0 ) *pRc = SQLITE_NOMEM; |
| 203549 | 204218 | }else{ |
| 203550 | | - memset(pRet, 0, nByte); |
| 204219 | + memset(pRet, 0, (size_t)nByte); |
| 203551 | 204220 | } |
| 203552 | 204221 | } |
| 203553 | 204222 | return pRet; |
| 203554 | 204223 | } |
| 203555 | 204224 | |
| | @@ -204014,11 +204683,11 @@ |
| 204014 | 204683 | if( p==0 ){ |
| 204015 | 204684 | *pzErr = sqlite3_mprintf("parse error in tokenize directive"); |
| 204016 | 204685 | rc = SQLITE_ERROR; |
| 204017 | 204686 | }else{ |
| 204018 | 204687 | rc = sqlite3Fts5GetTokenizer(pGlobal, |
| 204019 | | - (const char**)azArg, nArg, &pConfig->pTok, &pConfig->pTokApi, |
| 204688 | + (const char**)azArg, (int)nArg, &pConfig->pTok, &pConfig->pTokApi, |
| 204020 | 204689 | pzErr |
| 204021 | 204690 | ); |
| 204022 | 204691 | } |
| 204023 | 204692 | } |
| 204024 | 204693 | } |
| | @@ -204124,11 +204793,11 @@ |
| 204124 | 204793 | *pzOut = 0; |
| 204125 | 204794 | |
| 204126 | 204795 | if( zOut==0 ){ |
| 204127 | 204796 | *pRc = SQLITE_NOMEM; |
| 204128 | 204797 | }else{ |
| 204129 | | - memcpy(zOut, zIn, nIn+1); |
| 204798 | + memcpy(zOut, zIn, (size_t)(nIn+1)); |
| 204130 | 204799 | if( fts5_isopenquote(zOut[0]) ){ |
| 204131 | 204800 | int ii = fts5Dequote(zOut); |
| 204132 | 204801 | zRet = &zIn[ii]; |
| 204133 | 204802 | *pbQuoted = 1; |
| 204134 | 204803 | }else{ |
| | @@ -206138,11 +206807,11 @@ |
| 206138 | 206807 | nByte = sizeof(Fts5ExprNearset) + SZALLOC * sizeof(Fts5ExprPhrase*); |
| 206139 | 206808 | pRet = sqlite3_malloc64(nByte); |
| 206140 | 206809 | if( pRet==0 ){ |
| 206141 | 206810 | pParse->rc = SQLITE_NOMEM; |
| 206142 | 206811 | }else{ |
| 206143 | | - memset(pRet, 0, nByte); |
| 206812 | + memset(pRet, 0, (size_t)nByte); |
| 206144 | 206813 | } |
| 206145 | 206814 | }else if( (pNear->nPhrase % SZALLOC)==0 ){ |
| 206146 | 206815 | int nNew = pNear->nPhrase + SZALLOC; |
| 206147 | 206816 | sqlite3_int64 nByte; |
| 206148 | 206817 | |
| | @@ -206214,11 +206883,11 @@ |
| 206214 | 206883 | sqlite3_int64 nByte = sizeof(Fts5ExprTerm) + sizeof(Fts5Buffer) + nToken+1; |
| 206215 | 206884 | pSyn = (Fts5ExprTerm*)sqlite3_malloc64(nByte); |
| 206216 | 206885 | if( pSyn==0 ){ |
| 206217 | 206886 | rc = SQLITE_NOMEM; |
| 206218 | 206887 | }else{ |
| 206219 | | - memset(pSyn, 0, nByte); |
| 206888 | + memset(pSyn, 0, (size_t)nByte); |
| 206220 | 206889 | pSyn->zTerm = ((char*)pSyn) + sizeof(Fts5ExprTerm) + sizeof(Fts5Buffer); |
| 206221 | 206890 | memcpy(pSyn->zTerm, pToken, nToken); |
| 206222 | 206891 | pSyn->pSynonym = pPhrase->aTerm[pPhrase->nTerm-1].pSynonym; |
| 206223 | 206892 | pPhrase->aTerm[pPhrase->nTerm-1].pSynonym = pSyn; |
| 206224 | 206893 | } |
| | @@ -206374,11 +207043,11 @@ |
| 206374 | 207043 | sqlite3_int64 nByte; |
| 206375 | 207044 | Fts5Colset *pColset; |
| 206376 | 207045 | nByte = sizeof(Fts5Colset) + (pColsetOrig->nCol-1) * sizeof(int); |
| 206377 | 207046 | pColset = (Fts5Colset*)sqlite3Fts5MallocZero(&rc, nByte); |
| 206378 | 207047 | if( pColset ){ |
| 206379 | | - memcpy(pColset, pColsetOrig, nByte); |
| 207048 | + memcpy(pColset, pColsetOrig, (size_t)nByte); |
| 206380 | 207049 | } |
| 206381 | 207050 | pNew->pRoot->pNear->pColset = pColset; |
| 206382 | 207051 | } |
| 206383 | 207052 | } |
| 206384 | 207053 | |
| | @@ -206591,11 +207260,11 @@ |
| 206591 | 207260 | Fts5Colset *pRet; |
| 206592 | 207261 | if( pOrig ){ |
| 206593 | 207262 | sqlite3_int64 nByte = sizeof(Fts5Colset) + (pOrig->nCol-1) * sizeof(int); |
| 206594 | 207263 | pRet = (Fts5Colset*)sqlite3Fts5MallocZero(pRc, nByte); |
| 206595 | 207264 | if( pRet ){ |
| 206596 | | - memcpy(pRet, pOrig, nByte); |
| 207265 | + memcpy(pRet, pOrig, (size_t)nByte); |
| 206597 | 207266 | } |
| 206598 | 207267 | }else{ |
| 206599 | 207268 | pRet = 0; |
| 206600 | 207269 | } |
| 206601 | 207270 | return pRet; |
| | @@ -207608,11 +208277,11 @@ |
| 207608 | 208277 | if( pNew->aSlot==0 ){ |
| 207609 | 208278 | sqlite3_free(pNew); |
| 207610 | 208279 | *ppNew = 0; |
| 207611 | 208280 | rc = SQLITE_NOMEM; |
| 207612 | 208281 | }else{ |
| 207613 | | - memset(pNew->aSlot, 0, nByte); |
| 208282 | + memset(pNew->aSlot, 0, (size_t)nByte); |
| 207614 | 208283 | } |
| 207615 | 208284 | } |
| 207616 | 208285 | return rc; |
| 207617 | 208286 | } |
| 207618 | 208287 | |
| | @@ -207692,40 +208361,51 @@ |
| 207692 | 208361 | pHash->nSlot = nNew; |
| 207693 | 208362 | pHash->aSlot = apNew; |
| 207694 | 208363 | return SQLITE_OK; |
| 207695 | 208364 | } |
| 207696 | 208365 | |
| 207697 | | -static void fts5HashAddPoslistSize(Fts5Hash *pHash, Fts5HashEntry *p){ |
| 208366 | +static int fts5HashAddPoslistSize( |
| 208367 | + Fts5Hash *pHash, |
| 208368 | + Fts5HashEntry *p, |
| 208369 | + Fts5HashEntry *p2 |
| 208370 | +){ |
| 208371 | + int nRet = 0; |
| 207698 | 208372 | if( p->iSzPoslist ){ |
| 207699 | | - u8 *pPtr = (u8*)p; |
| 208373 | + u8 *pPtr = p2 ? (u8*)p2 : (u8*)p; |
| 208374 | + int nData = p->nData; |
| 207700 | 208375 | if( pHash->eDetail==FTS5_DETAIL_NONE ){ |
| 207701 | | - assert( p->nData==p->iSzPoslist ); |
| 208376 | + assert( nData==p->iSzPoslist ); |
| 207702 | 208377 | if( p->bDel ){ |
| 207703 | | - pPtr[p->nData++] = 0x00; |
| 208378 | + pPtr[nData++] = 0x00; |
| 207704 | 208379 | if( p->bContent ){ |
| 207705 | | - pPtr[p->nData++] = 0x00; |
| 208380 | + pPtr[nData++] = 0x00; |
| 207706 | 208381 | } |
| 207707 | 208382 | } |
| 207708 | 208383 | }else{ |
| 207709 | | - int nSz = (p->nData - p->iSzPoslist - 1); /* Size in bytes */ |
| 208384 | + int nSz = (nData - p->iSzPoslist - 1); /* Size in bytes */ |
| 207710 | 208385 | int nPos = nSz*2 + p->bDel; /* Value of nPos field */ |
| 207711 | 208386 | |
| 207712 | 208387 | assert( p->bDel==0 || p->bDel==1 ); |
| 207713 | 208388 | if( nPos<=127 ){ |
| 207714 | 208389 | pPtr[p->iSzPoslist] = (u8)nPos; |
| 207715 | 208390 | }else{ |
| 207716 | 208391 | int nByte = sqlite3Fts5GetVarintLen((u32)nPos); |
| 207717 | 208392 | memmove(&pPtr[p->iSzPoslist + nByte], &pPtr[p->iSzPoslist + 1], nSz); |
| 207718 | 208393 | sqlite3Fts5PutVarint(&pPtr[p->iSzPoslist], nPos); |
| 207719 | | - p->nData += (nByte-1); |
| 208394 | + nData += (nByte-1); |
| 207720 | 208395 | } |
| 207721 | 208396 | } |
| 207722 | 208397 | |
| 207723 | | - p->iSzPoslist = 0; |
| 207724 | | - p->bDel = 0; |
| 207725 | | - p->bContent = 0; |
| 208398 | + nRet = nData - p->nData; |
| 208399 | + if( p2==0 ){ |
| 208400 | + p->iSzPoslist = 0; |
| 208401 | + p->bDel = 0; |
| 208402 | + p->bContent = 0; |
| 208403 | + p->nData = nData; |
| 208404 | + } |
| 207726 | 208405 | } |
| 208406 | + return nRet; |
| 207727 | 208407 | } |
| 207728 | 208408 | |
| 207729 | 208409 | /* |
| 207730 | 208410 | ** Add an entry to the in-memory hash table. The key is the concatenation |
| 207731 | 208411 | ** of bByte and (pToken/nToken). The value is (iRowid/iCol/iPos). |
| | @@ -207778,11 +208458,11 @@ |
| 207778 | 208458 | |
| 207779 | 208459 | /* Allocate new Fts5HashEntry and add it to the hash table. */ |
| 207780 | 208460 | p = (Fts5HashEntry*)sqlite3_malloc64(nByte); |
| 207781 | 208461 | if( !p ) return SQLITE_NOMEM; |
| 207782 | 208462 | memset(p, 0, sizeof(Fts5HashEntry)); |
| 207783 | | - p->nAlloc = nByte; |
| 208463 | + p->nAlloc = (int)nByte; |
| 207784 | 208464 | zKey = fts5EntryKey(p); |
| 207785 | 208465 | zKey[0] = bByte; |
| 207786 | 208466 | memcpy(&zKey[1], pToken, nToken); |
| 207787 | 208467 | assert( iHash==fts5HashKey(pHash->nSlot, (u8*)zKey, nToken+1) ); |
| 207788 | 208468 | p->nKey = nToken; |
| | @@ -207833,11 +208513,11 @@ |
| 207833 | 208513 | pPtr = (u8*)p; |
| 207834 | 208514 | |
| 207835 | 208515 | /* If this is a new rowid, append the 4-byte size field for the previous |
| 207836 | 208516 | ** entry, and the new rowid for this entry. */ |
| 207837 | 208517 | if( iRowid!=p->iRowid ){ |
| 207838 | | - fts5HashAddPoslistSize(pHash, p); |
| 208518 | + fts5HashAddPoslistSize(pHash, p, 0); |
| 207839 | 208519 | p->nData += sqlite3Fts5PutVarint(&pPtr[p->nData], iRowid - p->iRowid); |
| 207840 | 208520 | p->iRowid = iRowid; |
| 207841 | 208521 | bNew = 1; |
| 207842 | 208522 | p->iSzPoslist = p->nData; |
| 207843 | 208523 | if( pHash->eDetail!=FTS5_DETAIL_NONE ){ |
| | @@ -207950,11 +208630,13 @@ |
| 207950 | 208630 | memset(ap, 0, sizeof(Fts5HashEntry*) * nMergeSlot); |
| 207951 | 208631 | |
| 207952 | 208632 | for(iSlot=0; iSlot<pHash->nSlot; iSlot++){ |
| 207953 | 208633 | Fts5HashEntry *pIter; |
| 207954 | 208634 | for(pIter=pHash->aSlot[iSlot]; pIter; pIter=pIter->pHashNext){ |
| 207955 | | - if( pTerm==0 || 0==memcmp(fts5EntryKey(pIter), pTerm, nTerm) ){ |
| 208635 | + if( pTerm==0 |
| 208636 | + || (pIter->nKey+1>=nTerm && 0==memcmp(fts5EntryKey(pIter), pTerm, nTerm)) |
| 208637 | + ){ |
| 207956 | 208638 | Fts5HashEntry *pEntry = pIter; |
| 207957 | 208639 | pEntry->pScanNext = 0; |
| 207958 | 208640 | for(i=0; ap[i]; i++){ |
| 207959 | 208641 | pEntry = fts5HashEntryMerge(pEntry, ap[i]); |
| 207960 | 208642 | ap[i] = 0; |
| | @@ -207978,12 +208660,13 @@ |
| 207978 | 208660 | /* |
| 207979 | 208661 | ** Query the hash table for a doclist associated with term pTerm/nTerm. |
| 207980 | 208662 | */ |
| 207981 | 208663 | static int sqlite3Fts5HashQuery( |
| 207982 | 208664 | Fts5Hash *pHash, /* Hash table to query */ |
| 208665 | + int nPre, |
| 207983 | 208666 | const char *pTerm, int nTerm, /* Query term */ |
| 207984 | | - const u8 **ppDoclist, /* OUT: Pointer to doclist for pTerm */ |
| 208667 | + void **ppOut, /* OUT: Pointer to new object */ |
| 207985 | 208668 | int *pnDoclist /* OUT: Size of doclist in bytes */ |
| 207986 | 208669 | ){ |
| 207987 | 208670 | unsigned int iHash = fts5HashKey(pHash->nSlot, (const u8*)pTerm, nTerm); |
| 207988 | 208671 | char *zKey = 0; |
| 207989 | 208672 | Fts5HashEntry *p; |
| | @@ -207993,15 +208676,24 @@ |
| 207993 | 208676 | assert( p->nKey+1==(int)strlen(zKey) ); |
| 207994 | 208677 | if( nTerm==p->nKey+1 && memcmp(zKey, pTerm, nTerm)==0 ) break; |
| 207995 | 208678 | } |
| 207996 | 208679 | |
| 207997 | 208680 | if( p ){ |
| 207998 | | - fts5HashAddPoslistSize(pHash, p); |
| 207999 | | - *ppDoclist = (const u8*)&zKey[nTerm+1]; |
| 208000 | | - *pnDoclist = p->nData - (sizeof(Fts5HashEntry) + nTerm + 1); |
| 208681 | + int nHashPre = sizeof(Fts5HashEntry) + nTerm + 1; |
| 208682 | + int nList = p->nData - nHashPre; |
| 208683 | + u8 *pRet = (u8*)(*ppOut = sqlite3_malloc64(nPre + nList + 10)); |
| 208684 | + if( pRet ){ |
| 208685 | + Fts5HashEntry *pFaux = (Fts5HashEntry*)&pRet[nPre-nHashPre]; |
| 208686 | + memcpy(&pRet[nPre], &((u8*)p)[nHashPre], nList); |
| 208687 | + nList += fts5HashAddPoslistSize(pHash, p, pFaux); |
| 208688 | + *pnDoclist = nList; |
| 208689 | + }else{ |
| 208690 | + *pnDoclist = 0; |
| 208691 | + return SQLITE_NOMEM; |
| 208692 | + } |
| 208001 | 208693 | }else{ |
| 208002 | | - *ppDoclist = 0; |
| 208694 | + *ppOut = 0; |
| 208003 | 208695 | *pnDoclist = 0; |
| 208004 | 208696 | } |
| 208005 | 208697 | |
| 208006 | 208698 | return SQLITE_OK; |
| 208007 | 208699 | } |
| | @@ -208030,11 +208722,11 @@ |
| 208030 | 208722 | ){ |
| 208031 | 208723 | Fts5HashEntry *p; |
| 208032 | 208724 | if( (p = pHash->pScan) ){ |
| 208033 | 208725 | char *zKey = fts5EntryKey(p); |
| 208034 | 208726 | int nTerm = (int)strlen(zKey); |
| 208035 | | - fts5HashAddPoslistSize(pHash, p); |
| 208727 | + fts5HashAddPoslistSize(pHash, p, 0); |
| 208036 | 208728 | *pzTerm = zKey; |
| 208037 | 208729 | *ppDoclist = (const u8*)&zKey[nTerm+1]; |
| 208038 | 208730 | *pnDoclist = p->nData - (sizeof(Fts5HashEntry) + nTerm + 1); |
| 208039 | 208731 | }else{ |
| 208040 | 208732 | *pzTerm = 0; |
| | @@ -210500,35 +211192,44 @@ |
| 210500 | 211192 | Fts5Index *p, /* FTS5 backend */ |
| 210501 | 211193 | const u8 *pTerm, int nTerm, /* Term to seek to */ |
| 210502 | 211194 | int flags, /* Mask of FTS5INDEX_XXX flags */ |
| 210503 | 211195 | Fts5SegIter *pIter /* Object to populate */ |
| 210504 | 211196 | ){ |
| 210505 | | - const u8 *pList = 0; |
| 210506 | 211197 | int nList = 0; |
| 210507 | 211198 | const u8 *z = 0; |
| 210508 | 211199 | int n = 0; |
| 211200 | + Fts5Data *pLeaf = 0; |
| 210509 | 211201 | |
| 210510 | 211202 | assert( p->pHash ); |
| 210511 | 211203 | assert( p->rc==SQLITE_OK ); |
| 210512 | 211204 | |
| 210513 | 211205 | if( pTerm==0 || (flags & FTS5INDEX_QUERY_SCAN) ){ |
| 211206 | + const u8 *pList = 0; |
| 211207 | + |
| 210514 | 211208 | p->rc = sqlite3Fts5HashScanInit(p->pHash, (const char*)pTerm, nTerm); |
| 210515 | 211209 | sqlite3Fts5HashScanEntry(p->pHash, (const char**)&z, &pList, &nList); |
| 210516 | 211210 | n = (z ? (int)strlen((const char*)z) : 0); |
| 211211 | + if( pList ){ |
| 211212 | + pLeaf = fts5IdxMalloc(p, sizeof(Fts5Data)); |
| 211213 | + if( pLeaf ){ |
| 211214 | + pLeaf->p = (u8*)pList; |
| 211215 | + } |
| 211216 | + } |
| 210517 | 211217 | }else{ |
| 210518 | | - pIter->flags |= FTS5_SEGITER_ONETERM; |
| 210519 | | - sqlite3Fts5HashQuery(p->pHash, (const char*)pTerm, nTerm, &pList, &nList); |
| 211218 | + p->rc = sqlite3Fts5HashQuery(p->pHash, sizeof(Fts5Data), |
| 211219 | + (const char*)pTerm, nTerm, (void**)&pLeaf, &nList |
| 211220 | + ); |
| 211221 | + if( pLeaf ){ |
| 211222 | + pLeaf->p = (u8*)&pLeaf[1]; |
| 211223 | + } |
| 210520 | 211224 | z = pTerm; |
| 210521 | 211225 | n = nTerm; |
| 211226 | + pIter->flags |= FTS5_SEGITER_ONETERM; |
| 210522 | 211227 | } |
| 210523 | 211228 | |
| 210524 | | - if( pList ){ |
| 210525 | | - Fts5Data *pLeaf; |
| 211229 | + if( pLeaf ){ |
| 210526 | 211230 | sqlite3Fts5BufferSet(&p->rc, &pIter->term, n, z); |
| 210527 | | - pLeaf = fts5IdxMalloc(p, sizeof(Fts5Data)); |
| 210528 | | - if( pLeaf==0 ) return; |
| 210529 | | - pLeaf->p = (u8*)pList; |
| 210530 | 211231 | pLeaf->nn = pLeaf->szLeaf = nList; |
| 210531 | 211232 | pIter->pLeaf = pLeaf; |
| 210532 | 211233 | pIter->iLeafOffset = fts5GetVarint(pLeaf->p, (u64*)&pIter->iRowid); |
| 210533 | 211234 | pIter->iEndofDoclist = pLeaf->nn; |
| 210534 | 211235 | |
| | @@ -215241,11 +215942,11 @@ |
| 215241 | 215942 | if( rc==SQLITE_OK ){ |
| 215242 | 215943 | nByte = sizeof(Fts5Cursor) + pConfig->nCol * sizeof(int); |
| 215243 | 215944 | pCsr = (Fts5Cursor*)sqlite3_malloc64(nByte); |
| 215244 | 215945 | if( pCsr ){ |
| 215245 | 215946 | Fts5Global *pGlobal = pTab->pGlobal; |
| 215246 | | - memset(pCsr, 0, nByte); |
| 215947 | + memset(pCsr, 0, (size_t)nByte); |
| 215247 | 215948 | pCsr->aColumnSize = (int*)&pCsr[1]; |
| 215248 | 215949 | pCsr->pNext = pGlobal->pCsr; |
| 215249 | 215950 | pGlobal->pCsr = pCsr; |
| 215250 | 215951 | pCsr->iCsrId = ++pGlobal->iNextId; |
| 215251 | 215952 | }else{ |
| | @@ -215522,11 +216223,11 @@ |
| 215522 | 216223 | |
| 215523 | 216224 | nPhrase = sqlite3Fts5ExprPhraseCount(pCsr->pExpr); |
| 215524 | 216225 | nByte = sizeof(Fts5Sorter) + sizeof(int) * (nPhrase-1); |
| 215525 | 216226 | pSorter = (Fts5Sorter*)sqlite3_malloc64(nByte); |
| 215526 | 216227 | if( pSorter==0 ) return SQLITE_NOMEM; |
| 215527 | | - memset(pSorter, 0, nByte); |
| 216228 | + memset(pSorter, 0, (size_t)nByte); |
| 215528 | 216229 | pSorter->nIdx = nPhrase; |
| 215529 | 216230 | |
| 215530 | 216231 | /* TODO: It would be better to have some system for reusing statement |
| 215531 | 216232 | ** handles here, rather than preparing a new one for each query. But that |
| 215532 | 216233 | ** is not possible as SQLite reference counts the virtual table objects. |
| | @@ -217256,11 +217957,11 @@ |
| 217256 | 217957 | int nArg, /* Number of args */ |
| 217257 | 217958 | sqlite3_value **apUnused /* Function arguments */ |
| 217258 | 217959 | ){ |
| 217259 | 217960 | assert( nArg==0 ); |
| 217260 | 217961 | UNUSED_PARAM2(nArg, apUnused); |
| 217261 | | - sqlite3_result_text(pCtx, "fts5: 2019-03-15 16:17:32 0f2129f59f7df929106e2af876c2976dea6528c1dc1850d64cddb256f20e121a", -1, SQLITE_TRANSIENT); |
| 217962 | + sqlite3_result_text(pCtx, "fts5: 2019-04-03 17:48:10 8d3af2010f4f652865f5c0d18e3bc793de05f8e75e75cc77786f61004b2ad28f", -1, SQLITE_TRANSIENT); |
| 217262 | 217963 | } |
| 217263 | 217964 | |
| 217264 | 217965 | /* |
| 217265 | 217966 | ** Return true if zName is the extension on one of the shadow tables used |
| 217266 | 217967 | ** by this module. |
| | @@ -217679,11 +218380,11 @@ |
| 217679 | 218380 | nByte = sizeof(Fts5Storage) /* Fts5Storage object */ |
| 217680 | 218381 | + pConfig->nCol * sizeof(i64); /* Fts5Storage.aTotalSize[] */ |
| 217681 | 218382 | *pp = p = (Fts5Storage*)sqlite3_malloc64(nByte); |
| 217682 | 218383 | if( !p ) return SQLITE_NOMEM; |
| 217683 | 218384 | |
| 217684 | | - memset(p, 0, nByte); |
| 218385 | + memset(p, 0, (size_t)nByte); |
| 217685 | 218386 | p->aTotalSize = (i64*)&p[1]; |
| 217686 | 218387 | p->pConfig = pConfig; |
| 217687 | 218388 | p->pIndex = pIndex; |
| 217688 | 218389 | |
| 217689 | 218390 | if( bCreate ){ |
| | @@ -220589,11 +221290,11 @@ |
| 220589 | 221290 | int iTbl = 0; |
| 220590 | 221291 | while( i<128 ){ |
| 220591 | 221292 | int bToken = aArray[ aFts5UnicodeData[iTbl] & 0x1F ]; |
| 220592 | 221293 | int n = (aFts5UnicodeData[iTbl] >> 5) + i; |
| 220593 | 221294 | for(; i<128 && i<n; i++){ |
| 220594 | | - aAscii[i] = bToken; |
| 221295 | + aAscii[i] = (u8)bToken; |
| 220595 | 221296 | } |
| 220596 | 221297 | iTbl++; |
| 220597 | 221298 | } |
| 220598 | 221299 | } |
| 220599 | 221300 | |
| | @@ -222020,12 +222721,12 @@ |
| 222020 | 222721 | } |
| 222021 | 222722 | #endif /* SQLITE_CORE */ |
| 222022 | 222723 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ |
| 222023 | 222724 | |
| 222024 | 222725 | /************** End of stmt.c ************************************************/ |
| 222025 | | -#if __LINE__!=222025 |
| 222726 | +#if __LINE__!=222726 |
| 222026 | 222727 | #undef SQLITE_SOURCE_ID |
| 222027 | | -#define SQLITE_SOURCE_ID "2019-03-17 23:59:02 cc5ab96715ebb1089b4e9aa647badd2510aaa056f26004718f921f4ac07ealt2" |
| 222728 | +#define SQLITE_SOURCE_ID "2019-04-03 17:48:10 8d3af2010f4f652865f5c0d18e3bc793de05f8e75e75cc77786f61004b2aalt2" |
| 222028 | 222729 | #endif |
| 222029 | 222730 | /* Return the source-id for this library */ |
| 222030 | 222731 | SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } |
| 222031 | 222732 | /************************** End of sqlite3.c ******************************/ |
| 222032 | 222733 | |