| | @@ -1,8 +1,8 @@ |
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | | -** version 3.41.1. By combining all the individual C code files into this |
| 3 | +** version 3.42.0. By combining all the individual C code files into this |
| 4 | 4 | ** single large file, the entire code can be compiled as a single translation |
| 5 | 5 | ** unit. This allows many compilers to do optimizations that would not be |
| 6 | 6 | ** possible if the files were compiled separately. Performance improvements |
| 7 | 7 | ** of 5% or more are commonly seen when SQLite is compiled as a single |
| 8 | 8 | ** translation unit. |
| | @@ -450,13 +450,13 @@ |
| 450 | 450 | ** |
| 451 | 451 | ** See also: [sqlite3_libversion()], |
| 452 | 452 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 453 | 453 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 454 | 454 | */ |
| 455 | | -#define SQLITE_VERSION "3.41.1" |
| 456 | | -#define SQLITE_VERSION_NUMBER 3041001 |
| 457 | | -#define SQLITE_SOURCE_ID "2023-03-09 16:04:34 cc8a0ee40cfc83ab42a0ff452de0a53fe17784aefb944ea7ac2cb078a8310730" |
| 455 | +#define SQLITE_VERSION "3.42.0" |
| 456 | +#define SQLITE_VERSION_NUMBER 3042000 |
| 457 | +#define SQLITE_SOURCE_ID "2023-04-10 18:44:00 4c5a3c5fb351cc1c2ce16c33314ce19c53531f09263f87456283d9d756002f9d" |
| 458 | 458 | |
| 459 | 459 | /* |
| 460 | 460 | ** CAPI3REF: Run-Time Library Version Numbers |
| 461 | 461 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 462 | 462 | ** |
| | @@ -1959,23 +1959,26 @@ |
| 1959 | 1959 | ** |
| 1960 | 1960 | ** <b>The sqlite3_config() interface is not threadsafe. The application |
| 1961 | 1961 | ** must ensure that no other SQLite interfaces are invoked by other |
| 1962 | 1962 | ** threads while sqlite3_config() is running.</b> |
| 1963 | 1963 | ** |
| 1964 | | -** The sqlite3_config() interface |
| 1965 | | -** may only be invoked prior to library initialization using |
| 1966 | | -** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()]. |
| 1967 | | -** ^If sqlite3_config() is called after [sqlite3_initialize()] and before |
| 1968 | | -** [sqlite3_shutdown()] then it will return SQLITE_MISUSE. |
| 1969 | | -** Note, however, that ^sqlite3_config() can be called as part of the |
| 1970 | | -** implementation of an application-defined [sqlite3_os_init()]. |
| 1971 | | -** |
| 1972 | 1964 | ** The first argument to sqlite3_config() is an integer |
| 1973 | 1965 | ** [configuration option] that determines |
| 1974 | 1966 | ** what property of SQLite is to be configured. Subsequent arguments |
| 1975 | 1967 | ** vary depending on the [configuration option] |
| 1976 | 1968 | ** in the first argument. |
| 1969 | +** |
| 1970 | +** For most configuration options, the sqlite3_config() interface |
| 1971 | +** may only be invoked prior to library initialization using |
| 1972 | +** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()]. |
| 1973 | +** The exceptional configuration options that may be invoked at any time |
| 1974 | +** are called "anytime configuration options". |
| 1975 | +** ^If sqlite3_config() is called after [sqlite3_initialize()] and before |
| 1976 | +** [sqlite3_shutdown()] with a first argument that is not an anytime |
| 1977 | +** configuration option, then the sqlite3_config() call will return SQLITE_MISUSE. |
| 1978 | +** Note, however, that ^sqlite3_config() can be called as part of the |
| 1979 | +** implementation of an application-defined [sqlite3_os_init()]. |
| 1977 | 1980 | ** |
| 1978 | 1981 | ** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK]. |
| 1979 | 1982 | ** ^If the option is unknown or SQLite is unable to set the option |
| 1980 | 1983 | ** then this routine returns a non-zero [error code]. |
| 1981 | 1984 | */ |
| | @@ -2079,10 +2082,27 @@ |
| 2079 | 2082 | ** CAPI3REF: Configuration Options |
| 2080 | 2083 | ** KEYWORDS: {configuration option} |
| 2081 | 2084 | ** |
| 2082 | 2085 | ** These constants are the available integer configuration options that |
| 2083 | 2086 | ** can be passed as the first argument to the [sqlite3_config()] interface. |
| 2087 | +** |
| 2088 | +** Most of the configuration options for sqlite3_config() |
| 2089 | +** will only work if invoked prior to [sqlite3_initialize()] or after |
| 2090 | +** [sqlite3_shutdown()]. The few exceptions to this rule are called |
| 2091 | +** "anytime configuration options". |
| 2092 | +** ^Calling [sqlite3_config()] with a first argument that is not an |
| 2093 | +** anytime configuration option in between calls to [sqlite3_initialize()] and |
| 2094 | +** [sqlite3_shutdown()] is a no-op that returns SQLITE_MISUSE. |
| 2095 | +** |
| 2096 | +** The set of anytime configuration options can change (by insertions |
| 2097 | +** and/or deletions) from one release of SQLite to the next. |
| 2098 | +** As of SQLite version 3.42.0, the complete set of anytime configuration |
| 2099 | +** options is: |
| 2100 | +** <ul> |
| 2101 | +** <li> SQLITE_CONFIG_LOG |
| 2102 | +** <li> SQLITE_CONFIG_PCACHE_HDRSZ |
| 2103 | +** </ul> |
| 2084 | 2104 | ** |
| 2085 | 2105 | ** New configuration options may be added in future releases of SQLite. |
| 2086 | 2106 | ** Existing configuration options might be discontinued. Applications |
| 2087 | 2107 | ** should check the return code from [sqlite3_config()] to make sure that |
| 2088 | 2108 | ** the call worked. The [sqlite3_config()] interface will return a |
| | @@ -2740,10 +2760,30 @@ |
| 2740 | 2760 | ** the [VACUUM] command will fail with an obscure error when attempting to |
| 2741 | 2761 | ** process a table with generated columns and a descending index. This is |
| 2742 | 2762 | ** not considered a bug since SQLite versions 3.3.0 and earlier do not support |
| 2743 | 2763 | ** either generated columns or decending indexes. |
| 2744 | 2764 | ** </dd> |
| 2765 | +** |
| 2766 | +** [[SQLITE_DBCONFIG_STMT_SCANSTATUS]] |
| 2767 | +** <dt>SQLITE_DBCONFIG_STMT_SCANSTATUS</td> |
| 2768 | +** <dd>The SQLITE_DBCONFIG_STMT_SCANSTATUS option is only useful in |
| 2769 | +** SQLITE_ENABLE_STMT_SCANSTATUS builds. In this case, it sets or clears |
| 2770 | +** a flag that enables collection of the sqlite3_stmt_scanstatus_v2() |
| 2771 | +** statistics. For statistics to be collected, the flag must be set on |
| 2772 | +** the database handle both when the SQL statement is prepared and when it |
| 2773 | +** is stepped. The flag is set (collection of statistics is enabled) |
| 2774 | +** by default.</dd> |
| 2775 | +** |
| 2776 | +** [[SQLITE_DBCONFIG_REVERSE_SCANORDER]] |
| 2777 | +** <dt>SQLITE_DBCONFIG_REVERSE_SCANORDER</td> |
| 2778 | +** <dd>The SQLITE_DBCONFIG_REVERSE_SCANORDER option change the default order |
| 2779 | +** in which tables and indexes are scanned so that the scans start at the end |
| 2780 | +** and work toward the beginning rather than starting at the beginning and |
| 2781 | +** working toward the end. Setting SQLITE_DBCONFIG_REVERSE_SCANORDER is the |
| 2782 | +** same as setting [PRAGMA reverse_unordered_selects]. This configuration option |
| 2783 | +** is useful for application testing.</dd> |
| 2784 | +** |
| 2745 | 2785 | ** </dl> |
| 2746 | 2786 | */ |
| 2747 | 2787 | #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ |
| 2748 | 2788 | #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ |
| 2749 | 2789 | #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ |
| | @@ -2760,11 +2800,13 @@ |
| 2760 | 2800 | #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */ |
| 2761 | 2801 | #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */ |
| 2762 | 2802 | #define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */ |
| 2763 | 2803 | #define SQLITE_DBCONFIG_LEGACY_FILE_FORMAT 1016 /* int int* */ |
| 2764 | 2804 | #define SQLITE_DBCONFIG_TRUSTED_SCHEMA 1017 /* int int* */ |
| 2765 | | -#define SQLITE_DBCONFIG_MAX 1017 /* Largest DBCONFIG */ |
| 2805 | +#define SQLITE_DBCONFIG_STMT_SCANSTATUS 1018 /* int int* */ |
| 2806 | +#define SQLITE_DBCONFIG_REVERSE_SCANORDER 1019 /* int int* */ |
| 2807 | +#define SQLITE_DBCONFIG_MAX 1019 /* Largest DBCONFIG */ |
| 2766 | 2808 | |
| 2767 | 2809 | /* |
| 2768 | 2810 | ** CAPI3REF: Enable Or Disable Extended Result Codes |
| 2769 | 2811 | ** METHOD: sqlite3 |
| 2770 | 2812 | ** |
| | @@ -9868,22 +9910,32 @@ |
| 9868 | 9910 | ** </dd> |
| 9869 | 9911 | ** |
| 9870 | 9912 | ** [[SQLITE_VTAB_INNOCUOUS]]<dt>SQLITE_VTAB_INNOCUOUS</dt> |
| 9871 | 9913 | ** <dd>Calls of the form |
| 9872 | 9914 | ** [sqlite3_vtab_config](db,SQLITE_VTAB_INNOCUOUS) from within the |
| 9873 | | -** the [xConnect] or [xCreate] methods of a [virtual table] implmentation |
| 9915 | +** the [xConnect] or [xCreate] methods of a [virtual table] implementation |
| 9874 | 9916 | ** identify that virtual table as being safe to use from within triggers |
| 9875 | 9917 | ** and views. Conceptually, the SQLITE_VTAB_INNOCUOUS tag means that the |
| 9876 | 9918 | ** virtual table can do no serious harm even if it is controlled by a |
| 9877 | 9919 | ** malicious hacker. Developers should avoid setting the SQLITE_VTAB_INNOCUOUS |
| 9878 | 9920 | ** flag unless absolutely necessary. |
| 9879 | 9921 | ** </dd> |
| 9922 | +** |
| 9923 | +** [[SQLITE_VTAB_USES_ALL_SCHEMAS]]<dt>SQLITE_VTAB_USES_ALL_SCHEMAS</dt> |
| 9924 | +** <dd>Calls of the form |
| 9925 | +** [sqlite3_vtab_config](db,SQLITE_VTAB_USES_ALL_SCHEMA) from within the |
| 9926 | +** the [xConnect] or [xCreate] methods of a [virtual table] implementation |
| 9927 | +** instruct the query planner to begin at least a read transaction on |
| 9928 | +** all schemas ("main", "temp", and any ATTACH-ed databases) whenever the |
| 9929 | +** virtual table is used. |
| 9930 | +** </dd> |
| 9880 | 9931 | ** </dl> |
| 9881 | 9932 | */ |
| 9882 | 9933 | #define SQLITE_VTAB_CONSTRAINT_SUPPORT 1 |
| 9883 | 9934 | #define SQLITE_VTAB_INNOCUOUS 2 |
| 9884 | 9935 | #define SQLITE_VTAB_DIRECTONLY 3 |
| 9936 | +#define SQLITE_VTAB_USES_ALL_SCHEMAS 4 |
| 9885 | 9937 | |
| 9886 | 9938 | /* |
| 9887 | 9939 | ** CAPI3REF: Determine The Virtual Table Conflict Policy |
| 9888 | 9940 | ** |
| 9889 | 9941 | ** This function may only be called from within a call to the [xUpdate] method |
| | @@ -12217,13 +12269,27 @@ |
| 12217 | 12269 | ** |
| 12218 | 12270 | ** <dt>SQLITE_CHANGESETAPPLY_INVERT <dd> |
| 12219 | 12271 | ** Invert the changeset before applying it. This is equivalent to inverting |
| 12220 | 12272 | ** a changeset using sqlite3changeset_invert() before applying it. It is |
| 12221 | 12273 | ** an error to specify this flag with a patchset. |
| 12274 | +** |
| 12275 | +** <dt>SQLITE_CHANGESETAPPLY_IGNORENOOP <dd> |
| 12276 | +** Do not invoke the conflict handler callback for any changes that |
| 12277 | +** would not actually modify the database even if they were applied. |
| 12278 | +** Specifically, this means that the conflict handler is not invoked |
| 12279 | +** for: |
| 12280 | +** <ul> |
| 12281 | +** <li>a delete change if the row being deleted cannot be found, |
| 12282 | +** <li>an update change if the modified fields are already set to |
| 12283 | +** their new values in the conflicting row, or |
| 12284 | +** <li>an insert change if all fields of the conflicting row match |
| 12285 | +** the row being inserted. |
| 12286 | +** </ul> |
| 12222 | 12287 | */ |
| 12223 | 12288 | #define SQLITE_CHANGESETAPPLY_NOSAVEPOINT 0x0001 |
| 12224 | 12289 | #define SQLITE_CHANGESETAPPLY_INVERT 0x0002 |
| 12290 | +#define SQLITE_CHANGESETAPPLY_IGNORENOOP 0x0004 |
| 12225 | 12291 | |
| 12226 | 12292 | /* |
| 12227 | 12293 | ** CAPI3REF: Constants Passed To The Conflict Handler |
| 12228 | 12294 | ** |
| 12229 | 12295 | ** Values that may be passed as the second argument to a conflict-handler. |
| | @@ -13516,12 +13582,12 @@ |
| 13516 | 13582 | #pragma warn -csu /* Comparing signed and unsigned */ |
| 13517 | 13583 | #pragma warn -spa /* Suspicious pointer arithmetic */ |
| 13518 | 13584 | #endif |
| 13519 | 13585 | |
| 13520 | 13586 | /* |
| 13521 | | -** WAL mode depends on atomic aligned 32-bit loads and stores in a few |
| 13522 | | -** places. The following macros try to make this explicit. |
| 13587 | +** A few places in the code require atomic load/store of aligned |
| 13588 | +** integer values. |
| 13523 | 13589 | */ |
| 13524 | 13590 | #ifndef __has_extension |
| 13525 | 13591 | # define __has_extension(x) 0 /* compatibility with non-clang compilers */ |
| 13526 | 13592 | #endif |
| 13527 | 13593 | #if GCC_VERSION>=4007000 || __has_extension(c_atomic) |
| | @@ -13573,19 +13639,26 @@ |
| 13573 | 13639 | # define SQLITE_INT_TO_PTR(X) ((void*)(X)) |
| 13574 | 13640 | # define SQLITE_PTR_TO_INT(X) ((int)(X)) |
| 13575 | 13641 | #endif |
| 13576 | 13642 | |
| 13577 | 13643 | /* |
| 13578 | | -** A macro to hint to the compiler that a function should not be |
| 13644 | +** Macros to hint to the compiler that a function should or should not be |
| 13579 | 13645 | ** inlined. |
| 13580 | 13646 | */ |
| 13581 | 13647 | #if defined(__GNUC__) |
| 13582 | 13648 | # define SQLITE_NOINLINE __attribute__((noinline)) |
| 13649 | +# define SQLITE_INLINE __attribute__((always_inline)) inline |
| 13583 | 13650 | #elif defined(_MSC_VER) && _MSC_VER>=1310 |
| 13584 | 13651 | # define SQLITE_NOINLINE __declspec(noinline) |
| 13652 | +# define SQLITE_INLINE __forceinline |
| 13585 | 13653 | #else |
| 13586 | 13654 | # define SQLITE_NOINLINE |
| 13655 | +# define SQLITE_INLINE |
| 13656 | +#endif |
| 13657 | +#if defined(SQLITE_COVERAGE_TEST) |
| 13658 | +# undef SQLITE_INLINE |
| 13659 | +# define SQLITE_INLINE |
| 13587 | 13660 | #endif |
| 13588 | 13661 | |
| 13589 | 13662 | /* |
| 13590 | 13663 | ** Make sure that the compiler intrinsics we desire are enabled when |
| 13591 | 13664 | ** compiling with an appropriate version of MSVC unless prevented by |
| | @@ -16541,10 +16614,14 @@ |
| 16541 | 16614 | #endif |
| 16542 | 16615 | |
| 16543 | 16616 | #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE) |
| 16544 | 16617 | SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE*, int, VdbeOp*); |
| 16545 | 16618 | #endif |
| 16619 | + |
| 16620 | +#if defined(SQLITE_ENABLE_CURSOR_HINTS) && defined(SQLITE_DEBUG) |
| 16621 | +SQLITE_PRIVATE int sqlite3CursorRangeHintExprCheck(Walker *pWalker, Expr *pExpr); |
| 16622 | +#endif |
| 16546 | 16623 | |
| 16547 | 16624 | #endif /* SQLITE_VDBE_H */ |
| 16548 | 16625 | |
| 16549 | 16626 | /************** End of vdbe.h ************************************************/ |
| 16550 | 16627 | /************** Continuing where we left off in sqliteInt.h ******************/ |
| | @@ -16590,11 +16667,11 @@ |
| 16590 | 16667 | /********************************************************************** |
| 16591 | 16668 | ** Elements above, except pCache, are public. All that follow are |
| 16592 | 16669 | ** private to pcache.c and should not be accessed by other modules. |
| 16593 | 16670 | ** pCache is grouped with the public elements for efficiency. |
| 16594 | 16671 | */ |
| 16595 | | - i16 nRef; /* Number of users of this page */ |
| 16672 | + i64 nRef; /* Number of users of this page */ |
| 16596 | 16673 | PgHdr *pDirtyNext; /* Next element in list of dirty pages */ |
| 16597 | 16674 | PgHdr *pDirtyPrev; /* Previous element in list of dirty pages */ |
| 16598 | 16675 | /* NB: pDirtyNext and pDirtyPrev are undefined if the |
| 16599 | 16676 | ** PgHdr object is not dirty */ |
| 16600 | 16677 | }; |
| | @@ -16671,16 +16748,16 @@ |
| 16671 | 16748 | |
| 16672 | 16749 | /* Discard the contents of the cache */ |
| 16673 | 16750 | SQLITE_PRIVATE void sqlite3PcacheClear(PCache*); |
| 16674 | 16751 | |
| 16675 | 16752 | /* Return the total number of outstanding page references */ |
| 16676 | | -SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache*); |
| 16753 | +SQLITE_PRIVATE i64 sqlite3PcacheRefCount(PCache*); |
| 16677 | 16754 | |
| 16678 | 16755 | /* Increment the reference count of an existing page */ |
| 16679 | 16756 | SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr*); |
| 16680 | 16757 | |
| 16681 | | -SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr*); |
| 16758 | +SQLITE_PRIVATE i64 sqlite3PcachePageRefcount(PgHdr*); |
| 16682 | 16759 | |
| 16683 | 16760 | /* Return the total number of pages stored in the cache */ |
| 16684 | 16761 | SQLITE_PRIVATE int sqlite3PcachePagecount(PCache*); |
| 16685 | 16762 | |
| 16686 | 16763 | #if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG) |
| | @@ -17251,11 +17328,11 @@ |
| 17251 | 17328 | #define SQLITE_TrustedSchema 0x00000080 /* Allow unsafe functions and |
| 17252 | 17329 | ** vtabs in the schema definition */ |
| 17253 | 17330 | #define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */ |
| 17254 | 17331 | /* result set is empty */ |
| 17255 | 17332 | #define SQLITE_IgnoreChecks 0x00000200 /* Do not enforce check constraints */ |
| 17256 | | -#define SQLITE_ReadUncommit 0x00000400 /* READ UNCOMMITTED in shared-cache */ |
| 17333 | +#define SQLITE_StmtScanStatus 0x00000400 /* Enable stmt_scanstats() counters */ |
| 17257 | 17334 | #define SQLITE_NoCkptOnClose 0x00000800 /* No checkpoint on close()/DETACH */ |
| 17258 | 17335 | #define SQLITE_ReverseOrder 0x00001000 /* Reverse unordered SELECTs */ |
| 17259 | 17336 | #define SQLITE_RecTriggers 0x00002000 /* Enable recursive triggers */ |
| 17260 | 17337 | #define SQLITE_ForeignKeys 0x00004000 /* Enforce foreign key constraints */ |
| 17261 | 17338 | #define SQLITE_AutoIndex 0x00008000 /* Enable automatic indexes */ |
| | @@ -17277,10 +17354,11 @@ |
| 17277 | 17354 | #define SQLITE_EnableView 0x80000000 /* Enable the use of views */ |
| 17278 | 17355 | #define SQLITE_CountRows HI(0x00001) /* Count rows changed by INSERT, */ |
| 17279 | 17356 | /* DELETE, or UPDATE and return */ |
| 17280 | 17357 | /* the count using a callback. */ |
| 17281 | 17358 | #define SQLITE_CorruptRdOnly HI(0x00002) /* Prohibit writes due to error */ |
| 17359 | +#define SQLITE_ReadUncommit HI(0x00004) /* READ UNCOMMITTED in shared-cache */ |
| 17282 | 17360 | |
| 17283 | 17361 | /* Flags used only if debugging */ |
| 17284 | 17362 | #ifdef SQLITE_DEBUG |
| 17285 | 17363 | #define SQLITE_SqlTrace HI(0x0100000) /* Debug print SQL as it executes */ |
| 17286 | 17364 | #define SQLITE_VdbeListing HI(0x0200000) /* Debug listings of VDBE progs */ |
| | @@ -17333,10 +17411,11 @@ |
| 17333 | 17411 | #define SQLITE_ReleaseReg 0x00400000 /* Use OP_ReleaseReg for testing */ |
| 17334 | 17412 | #define SQLITE_FlttnUnionAll 0x00800000 /* Disable the UNION ALL flattener */ |
| 17335 | 17413 | /* TH3 expects this value ^^^^^^^^^^ See flatten04.test */ |
| 17336 | 17414 | #define SQLITE_IndexedExpr 0x01000000 /* Pull exprs from index when able */ |
| 17337 | 17415 | #define SQLITE_Coroutines 0x02000000 /* Co-routines for subqueries */ |
| 17416 | +#define SQLITE_NullUnusedCols 0x04000000 /* NULL unused columns in subqueries */ |
| 17338 | 17417 | #define SQLITE_AllOpts 0xffffffff /* All optimizations */ |
| 17339 | 17418 | |
| 17340 | 17419 | /* |
| 17341 | 17420 | ** Macros for testing whether or not optimizations are enabled or disabled. |
| 17342 | 17421 | */ |
| | @@ -17804,10 +17883,11 @@ |
| 17804 | 17883 | sqlite3 *db; /* Database connection associated with this table */ |
| 17805 | 17884 | Module *pMod; /* Pointer to module implementation */ |
| 17806 | 17885 | sqlite3_vtab *pVtab; /* Pointer to vtab instance */ |
| 17807 | 17886 | int nRef; /* Number of pointers to this structure */ |
| 17808 | 17887 | u8 bConstraint; /* True if constraints are supported */ |
| 17888 | + u8 bAllSchemas; /* True if might use any attached schema */ |
| 17809 | 17889 | u8 eVtabRisk; /* Riskiness of allowing hacker access */ |
| 17810 | 17890 | int iSavepoint; /* Depth of the SAVEPOINT stack */ |
| 17811 | 17891 | VTable *pNext; /* Next in linked list (see above) */ |
| 17812 | 17892 | }; |
| 17813 | 17893 | |
| | @@ -18835,11 +18915,11 @@ |
| 18835 | 18915 | #define NC_IsCheck 0x000004 /* True if resolving a CHECK constraint */ |
| 18836 | 18916 | #define NC_GenCol 0x000008 /* True for a GENERATED ALWAYS AS clause */ |
| 18837 | 18917 | #define NC_HasAgg 0x000010 /* One or more aggregate functions seen */ |
| 18838 | 18918 | #define NC_IdxExpr 0x000020 /* True if resolving columns of CREATE INDEX */ |
| 18839 | 18919 | #define NC_SelfRef 0x00002e /* Combo: PartIdx, isCheck, GenCol, and IdxExpr */ |
| 18840 | | -#define NC_VarSelect 0x000040 /* A correlated subquery has been seen */ |
| 18920 | +#define NC_Subquery 0x000040 /* A subquery has been seen */ |
| 18841 | 18921 | #define NC_UEList 0x000080 /* True if uNC.pEList is used */ |
| 18842 | 18922 | #define NC_UAggInfo 0x000100 /* True if uNC.pAggInfo is used */ |
| 18843 | 18923 | #define NC_UUpsert 0x000200 /* True if uNC.pUpsert is used */ |
| 18844 | 18924 | #define NC_UBaseReg 0x000400 /* True if uNC.iBaseReg is used */ |
| 18845 | 18925 | #define NC_MinMaxAgg 0x001000 /* min/max aggregates seen. See note above */ |
| | @@ -19207,10 +19287,13 @@ |
| 19207 | 19287 | u8 prepFlags; /* SQLITE_PREPARE_* flags */ |
| 19208 | 19288 | u8 withinRJSubrtn; /* Nesting level for RIGHT JOIN body subroutines */ |
| 19209 | 19289 | #if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST) |
| 19210 | 19290 | u8 earlyCleanup; /* OOM inside sqlite3ParserAddCleanup() */ |
| 19211 | 19291 | #endif |
| 19292 | +#ifdef SQLITE_DEBUG |
| 19293 | + u8 ifNotExists; /* Might be true if IF NOT EXISTS. Assert()s only */ |
| 19294 | +#endif |
| 19212 | 19295 | int nRangeReg; /* Size of the temporary register block */ |
| 19213 | 19296 | int iRangeReg; /* First register in temporary register block */ |
| 19214 | 19297 | int nErr; /* Number of errors seen */ |
| 19215 | 19298 | int nTab; /* Number of previously allocated VDBE cursors */ |
| 19216 | 19299 | int nMem; /* Number of memory cells used so far */ |
| | @@ -19667,10 +19750,11 @@ |
| 19667 | 19750 | struct RenameCtx *pRename; /* RENAME COLUMN context */ |
| 19668 | 19751 | struct Table *pTab; /* Table of generated column */ |
| 19669 | 19752 | struct CoveringIndexCheck *pCovIdxCk; /* Check for covering index */ |
| 19670 | 19753 | SrcItem *pSrcItem; /* A single FROM clause item */ |
| 19671 | 19754 | DbFixer *pFix; /* See sqlite3FixSelect() */ |
| 19755 | + Mem *aMem; /* See sqlite3BtreeCursorHint() */ |
| 19672 | 19756 | } u; |
| 19673 | 19757 | }; |
| 19674 | 19758 | |
| 19675 | 19759 | /* |
| 19676 | 19760 | ** The following structure contains information used by the sqliteFix... |
| | @@ -20138,10 +20222,14 @@ |
| 20138 | 20222 | SQLITE_PRIVATE int sqlite3GetTempReg(Parse*); |
| 20139 | 20223 | SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int); |
| 20140 | 20224 | SQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int); |
| 20141 | 20225 | SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int); |
| 20142 | 20226 | SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse*); |
| 20227 | +SQLITE_PRIVATE void sqlite3TouchRegister(Parse*,int); |
| 20228 | +#if defined(SQLITE_ENABLE_STAT4) || defined(SQLITE_DEBUG) |
| 20229 | +SQLITE_PRIVATE int sqlite3FirstAvailableRegister(Parse*,int); |
| 20230 | +#endif |
| 20143 | 20231 | #ifdef SQLITE_DEBUG |
| 20144 | 20232 | SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int); |
| 20145 | 20233 | #endif |
| 20146 | 20234 | SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int); |
| 20147 | 20235 | SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*); |
| | @@ -20288,11 +20376,11 @@ |
| 20288 | 20376 | SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*); |
| 20289 | 20377 | SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*, |
| 20290 | 20378 | Expr*,ExprList*,u32,Expr*); |
| 20291 | 20379 | SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*); |
| 20292 | 20380 | SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*); |
| 20293 | | -SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, int); |
| 20381 | +SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, Trigger*); |
| 20294 | 20382 | SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int); |
| 20295 | 20383 | #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) |
| 20296 | 20384 | SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*); |
| 20297 | 20385 | #endif |
| 20298 | 20386 | SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe*,int,const char*); |
| | @@ -20825,14 +20913,11 @@ |
| 20825 | 20913 | SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse*, Table*); |
| 20826 | 20914 | SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3*, int, const char *); |
| 20827 | 20915 | SQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *, VTable *); |
| 20828 | 20916 | |
| 20829 | 20917 | SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*); |
| 20830 | | -#if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) \ |
| 20831 | | - && !defined(SQLITE_OMIT_VIRTUALTABLE) |
| 20832 | | -SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(sqlite3_index_info*); |
| 20833 | | -#endif |
| 20918 | +SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(Parse*); |
| 20834 | 20919 | SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*); |
| 20835 | 20920 | SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int); |
| 20836 | 20921 | SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *); |
| 20837 | 20922 | SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse*,sqlite3*); |
| 20838 | 20923 | SQLITE_PRIVATE void sqlite3ParseObjectReset(Parse*); |
| | @@ -21074,10 +21159,16 @@ |
| 21074 | 21159 | #if defined(VDBE_PROFILE) \ |
| 21075 | 21160 | || defined(SQLITE_PERFORMANCE_TRACE) \ |
| 21076 | 21161 | || defined(SQLITE_ENABLE_STMT_SCANSTATUS) |
| 21077 | 21162 | SQLITE_PRIVATE sqlite3_uint64 sqlite3Hwtime(void); |
| 21078 | 21163 | #endif |
| 21164 | + |
| 21165 | +#ifdef SQLITE_ENABLE_STMT_SCANSTATUS |
| 21166 | +# define IS_STMT_SCANSTATUS(db) (db->flags & SQLITE_StmtScanStatus) |
| 21167 | +#else |
| 21168 | +# define IS_STMT_SCANSTATUS(db) 0 |
| 21169 | +#endif |
| 21079 | 21170 | |
| 21080 | 21171 | #endif /* SQLITEINT_H */ |
| 21081 | 21172 | |
| 21082 | 21173 | /************** End of sqliteInt.h *******************************************/ |
| 21083 | 21174 | /************** Begin file os_common.h ***************************************/ |
| | @@ -22264,11 +22355,11 @@ |
| 22264 | 22355 | 0, /* xAltLocaltime */ |
| 22265 | 22356 | 0x7ffffffe, /* iOnceResetThreshold */ |
| 22266 | 22357 | SQLITE_DEFAULT_SORTERREF_SIZE, /* szSorterRef */ |
| 22267 | 22358 | 0, /* iPrngSeed */ |
| 22268 | 22359 | #ifdef SQLITE_DEBUG |
| 22269 | | - {0,0,0,0,0,0} /* aTune */ |
| 22360 | + {0,0,0,0,0,0}, /* aTune */ |
| 22270 | 22361 | #endif |
| 22271 | 22362 | }; |
| 22272 | 22363 | |
| 22273 | 22364 | /* |
| 22274 | 22365 | ** Hash table for global functions - functions common to all |
| | @@ -30069,10 +30160,24 @@ |
| 30069 | 30160 | *val = (*val - d)*10.0; |
| 30070 | 30161 | return (char)digit; |
| 30071 | 30162 | } |
| 30072 | 30163 | #endif /* SQLITE_OMIT_FLOATING_POINT */ |
| 30073 | 30164 | |
| 30165 | +#ifndef SQLITE_OMIT_FLOATING_POINT |
| 30166 | +/* |
| 30167 | +** "*val" is a u64. *msd is a divisor used to extract the |
| 30168 | +** most significant digit of *val. Extract that most significant |
| 30169 | +** digit and return it. |
| 30170 | +*/ |
| 30171 | +static char et_getdigit_int(u64 *val, u64 *msd){ |
| 30172 | + u64 x = (*val)/(*msd); |
| 30173 | + *val -= x*(*msd); |
| 30174 | + if( *msd>=10 ) *msd /= 10; |
| 30175 | + return '0' + (char)(x & 15); |
| 30176 | +} |
| 30177 | +#endif /* SQLITE_OMIT_FLOATING_POINT */ |
| 30178 | + |
| 30074 | 30179 | /* |
| 30075 | 30180 | ** Set the StrAccum object to an error mode. |
| 30076 | 30181 | */ |
| 30077 | 30182 | SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum *p, u8 eError){ |
| 30078 | 30183 | assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG ); |
| | @@ -30161,10 +30266,12 @@ |
| 30161 | 30266 | etByte xtype = etINVALID; /* Conversion paradigm */ |
| 30162 | 30267 | u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */ |
| 30163 | 30268 | char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */ |
| 30164 | 30269 | sqlite_uint64 longvalue; /* Value for integer types */ |
| 30165 | 30270 | LONGDOUBLE_TYPE realvalue; /* Value for real types */ |
| 30271 | + sqlite_uint64 msd; /* Divisor to get most-significant-digit |
| 30272 | + ** of longvalue */ |
| 30166 | 30273 | const et_info *infop; /* Pointer to the appropriate info structure */ |
| 30167 | 30274 | char *zOut; /* Rendering buffer */ |
| 30168 | 30275 | int nOut; /* Size of the rendering buffer */ |
| 30169 | 30276 | char *zExtra = 0; /* Malloced memory used by some conversion */ |
| 30170 | 30277 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| | @@ -30467,56 +30574,82 @@ |
| 30467 | 30574 | realvalue = -realvalue; |
| 30468 | 30575 | prefix = '-'; |
| 30469 | 30576 | }else{ |
| 30470 | 30577 | prefix = flag_prefix; |
| 30471 | 30578 | } |
| 30579 | + exp = 0; |
| 30472 | 30580 | if( xtype==etGENERIC && precision>0 ) precision--; |
| 30473 | 30581 | testcase( precision>0xfff ); |
| 30474 | | - idx = precision & 0xfff; |
| 30475 | | - rounder = arRound[idx%10]; |
| 30476 | | - while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; } |
| 30477 | | - if( xtype==etFLOAT ){ |
| 30478 | | - double rx = (double)realvalue; |
| 30479 | | - sqlite3_uint64 u; |
| 30480 | | - int ex; |
| 30481 | | - memcpy(&u, &rx, sizeof(u)); |
| 30482 | | - ex = -1023 + (int)((u>>52)&0x7ff); |
| 30483 | | - if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16; |
| 30484 | | - realvalue += rounder; |
| 30485 | | - } |
| 30486 | | - /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */ |
| 30487 | | - exp = 0; |
| 30488 | | - if( sqlite3IsNaN((double)realvalue) ){ |
| 30489 | | - bufpt = "NaN"; |
| 30490 | | - length = 3; |
| 30491 | | - break; |
| 30492 | | - } |
| 30493 | | - if( realvalue>0.0 ){ |
| 30494 | | - LONGDOUBLE_TYPE scale = 1.0; |
| 30495 | | - while( realvalue>=1e100*scale && exp<=350 ){ scale *= 1e100;exp+=100;} |
| 30496 | | - while( realvalue>=1e10*scale && exp<=350 ){ scale *= 1e10; exp+=10; } |
| 30497 | | - while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; } |
| 30498 | | - realvalue /= scale; |
| 30499 | | - while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; } |
| 30500 | | - while( realvalue<1.0 ){ realvalue *= 10.0; exp--; } |
| 30501 | | - if( exp>350 ){ |
| 30502 | | - bufpt = buf; |
| 30503 | | - buf[0] = prefix; |
| 30504 | | - memcpy(buf+(prefix!=0),"Inf",4); |
| 30505 | | - length = 3+(prefix!=0); |
| 30506 | | - break; |
| 30507 | | - } |
| 30508 | | - } |
| 30509 | | - bufpt = buf; |
| 30582 | + if( realvalue<1.0e+16 |
| 30583 | + && realvalue==(LONGDOUBLE_TYPE)(longvalue = (u64)realvalue) |
| 30584 | + ){ |
| 30585 | + /* Number is a pure integer that can be represented as u64 */ |
| 30586 | + for(msd=1; msd*10<=longvalue; msd *= 10, exp++){} |
| 30587 | + if( exp>precision && xtype!=etFLOAT ){ |
| 30588 | + u64 rnd = msd/2; |
| 30589 | + int kk = precision; |
| 30590 | + while( kk-- > 0 ){ rnd /= 10; } |
| 30591 | + longvalue += rnd; |
| 30592 | + } |
| 30593 | + }else{ |
| 30594 | + msd = 0; |
| 30595 | + longvalue = 0; /* To prevent a compiler warning */ |
| 30596 | + idx = precision & 0xfff; |
| 30597 | + rounder = arRound[idx%10]; |
| 30598 | + while( idx>=10 ){ rounder *= 1.0e-10; idx -= 10; } |
| 30599 | + if( xtype==etFLOAT ){ |
| 30600 | + double rx = (double)realvalue; |
| 30601 | + sqlite3_uint64 u; |
| 30602 | + int ex; |
| 30603 | + memcpy(&u, &rx, sizeof(u)); |
| 30604 | + ex = -1023 + (int)((u>>52)&0x7ff); |
| 30605 | + if( precision+(ex/3) < 15 ) rounder += realvalue*3e-16; |
| 30606 | + realvalue += rounder; |
| 30607 | + } |
| 30608 | + if( sqlite3IsNaN((double)realvalue) ){ |
| 30609 | + if( flag_zeropad ){ |
| 30610 | + bufpt = "null"; |
| 30611 | + length = 4; |
| 30612 | + }else{ |
| 30613 | + bufpt = "NaN"; |
| 30614 | + length = 3; |
| 30615 | + } |
| 30616 | + break; |
| 30617 | + } |
| 30618 | + |
| 30619 | + /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */ |
| 30620 | + if( ALWAYS(realvalue>0.0) ){ |
| 30621 | + LONGDOUBLE_TYPE scale = 1.0; |
| 30622 | + while( realvalue>=1e100*scale && exp<=350){ scale*=1e100;exp+=100;} |
| 30623 | + while( realvalue>=1e10*scale && exp<=350 ){ scale*=1e10; exp+=10; } |
| 30624 | + while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; } |
| 30625 | + realvalue /= scale; |
| 30626 | + while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; } |
| 30627 | + while( realvalue<1.0 ){ realvalue *= 10.0; exp--; } |
| 30628 | + if( exp>350 ){ |
| 30629 | + if( flag_zeropad ){ |
| 30630 | + realvalue = 9.0; |
| 30631 | + exp = 999; |
| 30632 | + }else{ |
| 30633 | + bufpt = buf; |
| 30634 | + buf[0] = prefix; |
| 30635 | + memcpy(buf+(prefix!=0),"Inf",4); |
| 30636 | + length = 3+(prefix!=0); |
| 30637 | + break; |
| 30638 | + } |
| 30639 | + } |
| 30640 | + if( xtype!=etFLOAT ){ |
| 30641 | + realvalue += rounder; |
| 30642 | + if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; } |
| 30643 | + } |
| 30644 | + } |
| 30645 | + } |
| 30646 | + |
| 30510 | 30647 | /* |
| 30511 | 30648 | ** If the field type is etGENERIC, then convert to either etEXP |
| 30512 | 30649 | ** or etFLOAT, as appropriate. |
| 30513 | 30650 | */ |
| 30514 | | - if( xtype!=etFLOAT ){ |
| 30515 | | - realvalue += rounder; |
| 30516 | | - if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; } |
| 30517 | | - } |
| 30518 | 30651 | if( xtype==etGENERIC ){ |
| 30519 | 30652 | flag_rtz = !flag_alternateform; |
| 30520 | 30653 | if( exp<-4 || exp>precision ){ |
| 30521 | 30654 | xtype = etEXP; |
| 30522 | 30655 | }else{ |
| | @@ -30529,28 +30662,33 @@ |
| 30529 | 30662 | if( xtype==etEXP ){ |
| 30530 | 30663 | e2 = 0; |
| 30531 | 30664 | }else{ |
| 30532 | 30665 | e2 = exp; |
| 30533 | 30666 | } |
| 30667 | + nsd = 16 + flag_altform2*10; |
| 30668 | + bufpt = buf; |
| 30534 | 30669 | { |
| 30535 | 30670 | i64 szBufNeeded; /* Size of a temporary buffer needed */ |
| 30536 | 30671 | szBufNeeded = MAX(e2,0)+(i64)precision+(i64)width+15; |
| 30537 | 30672 | if( szBufNeeded > etBUFSIZE ){ |
| 30538 | 30673 | bufpt = zExtra = printfTempBuf(pAccum, szBufNeeded); |
| 30539 | 30674 | if( bufpt==0 ) return; |
| 30540 | 30675 | } |
| 30541 | 30676 | } |
| 30542 | 30677 | zOut = bufpt; |
| 30543 | | - nsd = 16 + flag_altform2*10; |
| 30544 | 30678 | flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2; |
| 30545 | 30679 | /* The sign in front of the number */ |
| 30546 | 30680 | if( prefix ){ |
| 30547 | 30681 | *(bufpt++) = prefix; |
| 30548 | 30682 | } |
| 30549 | 30683 | /* Digits prior to the decimal point */ |
| 30550 | 30684 | if( e2<0 ){ |
| 30551 | 30685 | *(bufpt++) = '0'; |
| 30686 | + }else if( msd>0 ){ |
| 30687 | + for(; e2>=0; e2--){ |
| 30688 | + *(bufpt++) = et_getdigit_int(&longvalue,&msd); |
| 30689 | + } |
| 30552 | 30690 | }else{ |
| 30553 | 30691 | for(; e2>=0; e2--){ |
| 30554 | 30692 | *(bufpt++) = et_getdigit(&realvalue,&nsd); |
| 30555 | 30693 | } |
| 30556 | 30694 | } |
| | @@ -30563,12 +30701,18 @@ |
| 30563 | 30701 | for(e2++; e2<0; precision--, e2++){ |
| 30564 | 30702 | assert( precision>0 ); |
| 30565 | 30703 | *(bufpt++) = '0'; |
| 30566 | 30704 | } |
| 30567 | 30705 | /* Significant digits after the decimal point */ |
| 30568 | | - while( (precision--)>0 ){ |
| 30569 | | - *(bufpt++) = et_getdigit(&realvalue,&nsd); |
| 30706 | + if( msd>0 ){ |
| 30707 | + while( (precision--)>0 ){ |
| 30708 | + *(bufpt++) = et_getdigit_int(&longvalue,&msd); |
| 30709 | + } |
| 30710 | + }else{ |
| 30711 | + while( (precision--)>0 ){ |
| 30712 | + *(bufpt++) = et_getdigit(&realvalue,&nsd); |
| 30713 | + } |
| 30570 | 30714 | } |
| 30571 | 30715 | /* Remove trailing zeros and the "." if no digits follow the "." */ |
| 30572 | 30716 | if( flag_rtz && flag_dp ){ |
| 30573 | 30717 | while( bufpt[-1]=='0' ) *(--bufpt) = 0; |
| 30574 | 30718 | assert( bufpt>zOut ); |
| | @@ -31245,16 +31389,26 @@ |
| 31245 | 31389 | sqlite3_str_vappendf(&acc, zFormat, ap); |
| 31246 | 31390 | zBuf[acc.nChar] = 0; |
| 31247 | 31391 | return zBuf; |
| 31248 | 31392 | } |
| 31249 | 31393 | SQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){ |
| 31250 | | - char *z; |
| 31394 | + StrAccum acc; |
| 31251 | 31395 | va_list ap; |
| 31396 | + if( n<=0 ) return zBuf; |
| 31397 | +#ifdef SQLITE_ENABLE_API_ARMOR |
| 31398 | + if( zBuf==0 || zFormat==0 ) { |
| 31399 | + (void)SQLITE_MISUSE_BKPT; |
| 31400 | + if( zBuf ) zBuf[0] = 0; |
| 31401 | + return zBuf; |
| 31402 | + } |
| 31403 | +#endif |
| 31404 | + sqlite3StrAccumInit(&acc, 0, zBuf, n, 0); |
| 31252 | 31405 | va_start(ap,zFormat); |
| 31253 | | - z = sqlite3_vsnprintf(n, zBuf, zFormat, ap); |
| 31406 | + sqlite3_str_vappendf(&acc, zFormat, ap); |
| 31254 | 31407 | va_end(ap); |
| 31255 | | - return z; |
| 31408 | + zBuf[acc.nChar] = 0; |
| 31409 | + return zBuf; |
| 31256 | 31410 | } |
| 31257 | 31411 | |
| 31258 | 31412 | /* |
| 31259 | 31413 | ** This is the routine that actually formats the sqlite3_log() message. |
| 31260 | 31414 | ** We house it in a separate routine from sqlite3_log() to avoid using |
| | @@ -52652,11 +52806,11 @@ |
| 52652 | 52806 | ** pointers). |
| 52653 | 52807 | */ |
| 52654 | 52808 | struct PCache { |
| 52655 | 52809 | PgHdr *pDirty, *pDirtyTail; /* List of dirty pages in LRU order */ |
| 52656 | 52810 | PgHdr *pSynced; /* Last synced page in dirty page list */ |
| 52657 | | - int nRefSum; /* Sum of ref counts over all pages */ |
| 52811 | + i64 nRefSum; /* Sum of ref counts over all pages */ |
| 52658 | 52812 | int szCache; /* Configured cache size */ |
| 52659 | 52813 | int szSpill; /* Size before spilling occurs */ |
| 52660 | 52814 | int szPage; /* Size of every page in this cache */ |
| 52661 | 52815 | int szExtra; /* Size of extra space for each page */ |
| 52662 | 52816 | u8 bPurgeable; /* True if pages are on backing store */ |
| | @@ -52682,11 +52836,11 @@ |
| 52682 | 52836 | static void pcachePageTrace(int i, sqlite3_pcache_page *pLower){ |
| 52683 | 52837 | PgHdr *pPg; |
| 52684 | 52838 | unsigned char *a; |
| 52685 | 52839 | int j; |
| 52686 | 52840 | pPg = (PgHdr*)pLower->pExtra; |
| 52687 | | - printf("%3d: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags); |
| 52841 | + printf("%3lld: nRef %2d flgs %02x data ", i, pPg->nRef, pPg->flags); |
| 52688 | 52842 | a = (unsigned char *)pLower->pBuf; |
| 52689 | 52843 | for(j=0; j<12; j++) printf("%02x", a[j]); |
| 52690 | 52844 | printf(" ptr %p\n", pPg); |
| 52691 | 52845 | } |
| 52692 | 52846 | static void pcacheDump(PCache *pCache){ |
| | @@ -53426,18 +53580,18 @@ |
| 53426 | 53580 | ** Return the total number of references to all pages held by the cache. |
| 53427 | 53581 | ** |
| 53428 | 53582 | ** This is not the total number of pages referenced, but the sum of the |
| 53429 | 53583 | ** reference count for all pages. |
| 53430 | 53584 | */ |
| 53431 | | -SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache *pCache){ |
| 53585 | +SQLITE_PRIVATE i64 sqlite3PcacheRefCount(PCache *pCache){ |
| 53432 | 53586 | return pCache->nRefSum; |
| 53433 | 53587 | } |
| 53434 | 53588 | |
| 53435 | 53589 | /* |
| 53436 | 53590 | ** Return the number of references to the page supplied as an argument. |
| 53437 | 53591 | */ |
| 53438 | | -SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr *p){ |
| 53592 | +SQLITE_PRIVATE i64 sqlite3PcachePageRefcount(PgHdr *p){ |
| 53439 | 53593 | return p->nRef; |
| 53440 | 53594 | } |
| 53441 | 53595 | |
| 53442 | 53596 | /* |
| 53443 | 53597 | ** Return the total number of pages in the cache. |
| | @@ -68091,12 +68245,13 @@ |
| 68091 | 68245 | int mxErr; /* Stop accumulating errors when this reaches zero */ |
| 68092 | 68246 | int nErr; /* Number of messages written to zErrMsg so far */ |
| 68093 | 68247 | int rc; /* SQLITE_OK, SQLITE_NOMEM, or SQLITE_INTERRUPT */ |
| 68094 | 68248 | u32 nStep; /* Number of steps into the integrity_check process */ |
| 68095 | 68249 | const char *zPfx; /* Error message prefix */ |
| 68096 | | - Pgno v1; /* Value for first %u substitution in zPfx */ |
| 68097 | | - int v2; /* Value for second %d substitution in zPfx */ |
| 68250 | + Pgno v0; /* Value for first %u substitution in zPfx (root page) */ |
| 68251 | + Pgno v1; /* Value for second %u substitution in zPfx (current pg) */ |
| 68252 | + int v2; /* Value for third %d substitution in zPfx */ |
| 68098 | 68253 | StrAccum errMsg; /* Accumulate the error message text here */ |
| 68099 | 68254 | u32 *heap; /* Min-heap used for analyzing cell coverage */ |
| 68100 | 68255 | sqlite3 *db; /* Database connection running the check */ |
| 68101 | 68256 | }; |
| 68102 | 68257 | |
| | @@ -68555,12 +68710,12 @@ |
| 68555 | 68710 | */ |
| 68556 | 68711 | #ifdef SQLITE_DEBUG |
| 68557 | 68712 | int corruptPageError(int lineno, MemPage *p){ |
| 68558 | 68713 | char *zMsg; |
| 68559 | 68714 | sqlite3BeginBenignMalloc(); |
| 68560 | | - zMsg = sqlite3_mprintf("database corruption page %d of %s", |
| 68561 | | - (int)p->pgno, sqlite3PagerFilename(p->pBt->pPager, 0) |
| 68715 | + zMsg = sqlite3_mprintf("database corruption page %u of %s", |
| 68716 | + p->pgno, sqlite3PagerFilename(p->pBt->pPager, 0) |
| 68562 | 68717 | ); |
| 68563 | 68718 | sqlite3EndBenignMalloc(); |
| 68564 | 68719 | if( zMsg ){ |
| 68565 | 68720 | sqlite3ReportError(SQLITE_CORRUPT, lineno, zMsg); |
| 68566 | 68721 | } |
| | @@ -69365,12 +69520,29 @@ |
| 69365 | 69520 | ** and number of the varargs parameters) is determined by the eHintType |
| 69366 | 69521 | ** parameter. See the definitions of the BTREE_HINT_* macros for details. |
| 69367 | 69522 | */ |
| 69368 | 69523 | SQLITE_PRIVATE void sqlite3BtreeCursorHint(BtCursor *pCur, int eHintType, ...){ |
| 69369 | 69524 | /* Used only by system that substitute their own storage engine */ |
| 69525 | +#ifdef SQLITE_DEBUG |
| 69526 | + if( ALWAYS(eHintType==BTREE_HINT_RANGE) ){ |
| 69527 | + va_list ap; |
| 69528 | + Expr *pExpr; |
| 69529 | + Walker w; |
| 69530 | + memset(&w, 0, sizeof(w)); |
| 69531 | + w.xExprCallback = sqlite3CursorRangeHintExprCheck; |
| 69532 | + va_start(ap, eHintType); |
| 69533 | + pExpr = va_arg(ap, Expr*); |
| 69534 | + w.u.aMem = va_arg(ap, Mem*); |
| 69535 | + va_end(ap); |
| 69536 | + assert( pExpr!=0 ); |
| 69537 | + assert( w.u.aMem!=0 ); |
| 69538 | + sqlite3WalkExpr(&w, pExpr); |
| 69539 | + } |
| 69540 | +#endif /* SQLITE_DEBUG */ |
| 69370 | 69541 | } |
| 69371 | | -#endif |
| 69542 | +#endif /* SQLITE_ENABLE_CURSOR_HINTS */ |
| 69543 | + |
| 69372 | 69544 | |
| 69373 | 69545 | /* |
| 69374 | 69546 | ** Provide flag hints to the cursor. |
| 69375 | 69547 | */ |
| 69376 | 69548 | SQLITE_PRIVATE void sqlite3BtreeCursorHintFlags(BtCursor *pCur, unsigned x){ |
| | @@ -69451,11 +69623,11 @@ |
| 69451 | 69623 | } |
| 69452 | 69624 | assert( offset <= (int)pBt->usableSize-5 ); |
| 69453 | 69625 | pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage); |
| 69454 | 69626 | |
| 69455 | 69627 | if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){ |
| 69456 | | - TRACE(("PTRMAP_UPDATE: %d->(%d,%d)\n", key, eType, parent)); |
| 69628 | + TRACE(("PTRMAP_UPDATE: %u->(%u,%u)\n", key, eType, parent)); |
| 69457 | 69629 | *pRC= rc = sqlite3PagerWrite(pDbPage); |
| 69458 | 69630 | if( rc==SQLITE_OK ){ |
| 69459 | 69631 | pPtrmap[offset] = eType; |
| 69460 | 69632 | put4byte(&pPtrmap[offset+1], parent); |
| 69461 | 69633 | } |
| | @@ -69650,31 +69822,35 @@ |
| 69650 | 69822 | ** This routine is a high-runner. |
| 69651 | 69823 | */ |
| 69652 | 69824 | iKey = *pIter; |
| 69653 | 69825 | if( iKey>=0x80 ){ |
| 69654 | 69826 | u8 x; |
| 69655 | | - iKey = ((iKey&0x7f)<<7) | ((x = *++pIter) & 0x7f); |
| 69656 | | - if( x>=0x80 ){ |
| 69657 | | - iKey = (iKey<<7) | ((x =*++pIter) & 0x7f); |
| 69658 | | - if( x>=0x80 ){ |
| 69659 | | - iKey = (iKey<<7) | ((x = *++pIter) & 0x7f); |
| 69660 | | - if( x>=0x80 ){ |
| 69661 | | - iKey = (iKey<<7) | ((x = *++pIter) & 0x7f); |
| 69662 | | - if( x>=0x80 ){ |
| 69663 | | - iKey = (iKey<<7) | ((x = *++pIter) & 0x7f); |
| 69664 | | - if( x>=0x80 ){ |
| 69665 | | - iKey = (iKey<<7) | ((x = *++pIter) & 0x7f); |
| 69666 | | - if( x>=0x80 ){ |
| 69667 | | - iKey = (iKey<<7) | ((x = *++pIter) & 0x7f); |
| 69668 | | - if( x>=0x80 ){ |
| 69669 | | - iKey = (iKey<<8) | (*++pIter); |
| 69670 | | - } |
| 69671 | | - } |
| 69672 | | - } |
| 69673 | | - } |
| 69674 | | - } |
| 69675 | | - } |
| 69827 | + iKey = (iKey<<7) ^ (x = *++pIter); |
| 69828 | + if( x>=0x80 ){ |
| 69829 | + iKey = (iKey<<7) ^ (x = *++pIter); |
| 69830 | + if( x>=0x80 ){ |
| 69831 | + iKey = (iKey<<7) ^ 0x10204000 ^ (x = *++pIter); |
| 69832 | + if( x>=0x80 ){ |
| 69833 | + iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter); |
| 69834 | + if( x>=0x80 ){ |
| 69835 | + iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter); |
| 69836 | + if( x>=0x80 ){ |
| 69837 | + iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter); |
| 69838 | + if( x>=0x80 ){ |
| 69839 | + iKey = (iKey<<7) ^ 0x4000 ^ (x = *++pIter); |
| 69840 | + if( x>=0x80 ){ |
| 69841 | + iKey = (iKey<<8) ^ 0x8000 ^ (*++pIter); |
| 69842 | + } |
| 69843 | + } |
| 69844 | + } |
| 69845 | + } |
| 69846 | + } |
| 69847 | + }else{ |
| 69848 | + iKey ^= 0x204000; |
| 69849 | + } |
| 69850 | + }else{ |
| 69851 | + iKey ^= 0x4000; |
| 69676 | 69852 | } |
| 69677 | 69853 | } |
| 69678 | 69854 | pIter++; |
| 69679 | 69855 | |
| 69680 | 69856 | pInfo->nKey = *(i64*)&iKey; |
| | @@ -69747,14 +69923,57 @@ |
| 69747 | 69923 | ** data header and the local payload, but not any overflow page or |
| 69748 | 69924 | ** the space used by the cell pointer. |
| 69749 | 69925 | ** |
| 69750 | 69926 | ** cellSizePtrNoPayload() => table internal nodes |
| 69751 | 69927 | ** cellSizePtrTableLeaf() => table leaf nodes |
| 69752 | | -** cellSizePtr() => all index nodes & table leaf nodes |
| 69928 | +** cellSizePtr() => index internal nodes |
| 69929 | +** cellSizeIdxLeaf() => index leaf nodes |
| 69753 | 69930 | */ |
| 69754 | 69931 | static u16 cellSizePtr(MemPage *pPage, u8 *pCell){ |
| 69755 | | - u8 *pIter = pCell + pPage->childPtrSize; /* For looping over bytes of pCell */ |
| 69932 | + u8 *pIter = pCell + 4; /* For looping over bytes of pCell */ |
| 69933 | + u8 *pEnd; /* End mark for a varint */ |
| 69934 | + u32 nSize; /* Size value to return */ |
| 69935 | + |
| 69936 | +#ifdef SQLITE_DEBUG |
| 69937 | + /* The value returned by this function should always be the same as |
| 69938 | + ** the (CellInfo.nSize) value found by doing a full parse of the |
| 69939 | + ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of |
| 69940 | + ** this function verifies that this invariant is not violated. */ |
| 69941 | + CellInfo debuginfo; |
| 69942 | + pPage->xParseCell(pPage, pCell, &debuginfo); |
| 69943 | +#endif |
| 69944 | + |
| 69945 | + assert( pPage->childPtrSize==4 ); |
| 69946 | + nSize = *pIter; |
| 69947 | + if( nSize>=0x80 ){ |
| 69948 | + pEnd = &pIter[8]; |
| 69949 | + nSize &= 0x7f; |
| 69950 | + do{ |
| 69951 | + nSize = (nSize<<7) | (*++pIter & 0x7f); |
| 69952 | + }while( *(pIter)>=0x80 && pIter<pEnd ); |
| 69953 | + } |
| 69954 | + pIter++; |
| 69955 | + testcase( nSize==pPage->maxLocal ); |
| 69956 | + testcase( nSize==(u32)pPage->maxLocal+1 ); |
| 69957 | + if( nSize<=pPage->maxLocal ){ |
| 69958 | + nSize += (u32)(pIter - pCell); |
| 69959 | + assert( nSize>4 ); |
| 69960 | + }else{ |
| 69961 | + int minLocal = pPage->minLocal; |
| 69962 | + nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4); |
| 69963 | + testcase( nSize==pPage->maxLocal ); |
| 69964 | + testcase( nSize==(u32)pPage->maxLocal+1 ); |
| 69965 | + if( nSize>pPage->maxLocal ){ |
| 69966 | + nSize = minLocal; |
| 69967 | + } |
| 69968 | + nSize += 4 + (u16)(pIter - pCell); |
| 69969 | + } |
| 69970 | + assert( nSize==debuginfo.nSize || CORRUPT_DB ); |
| 69971 | + return (u16)nSize; |
| 69972 | +} |
| 69973 | +static u16 cellSizePtrIdxLeaf(MemPage *pPage, u8 *pCell){ |
| 69974 | + u8 *pIter = pCell; /* For looping over bytes of pCell */ |
| 69756 | 69975 | u8 *pEnd; /* End mark for a varint */ |
| 69757 | 69976 | u32 nSize; /* Size value to return */ |
| 69758 | 69977 | |
| 69759 | 69978 | #ifdef SQLITE_DEBUG |
| 69760 | 69979 | /* The value returned by this function should always be the same as |
| | @@ -69763,10 +69982,11 @@ |
| 69763 | 69982 | ** this function verifies that this invariant is not violated. */ |
| 69764 | 69983 | CellInfo debuginfo; |
| 69765 | 69984 | pPage->xParseCell(pPage, pCell, &debuginfo); |
| 69766 | 69985 | #endif |
| 69767 | 69986 | |
| 69987 | + assert( pPage->childPtrSize==0 ); |
| 69768 | 69988 | nSize = *pIter; |
| 69769 | 69989 | if( nSize>=0x80 ){ |
| 69770 | 69990 | pEnd = &pIter[8]; |
| 69771 | 69991 | nSize &= 0x7f; |
| 69772 | 69992 | do{ |
| | @@ -69999,14 +70219,14 @@ |
| 69999 | 70219 | testcase( pc==iCellFirst ); |
| 70000 | 70220 | testcase( pc==iCellLast ); |
| 70001 | 70221 | /* These conditions have already been verified in btreeInitPage() |
| 70002 | 70222 | ** if PRAGMA cell_size_check=ON. |
| 70003 | 70223 | */ |
| 70004 | | - if( pc<iCellStart || pc>iCellLast ){ |
| 70224 | + if( pc>iCellLast ){ |
| 70005 | 70225 | return SQLITE_CORRUPT_PAGE(pPage); |
| 70006 | 70226 | } |
| 70007 | | - assert( pc>=iCellStart && pc<=iCellLast ); |
| 70227 | + assert( pc>=0 && pc<=iCellLast ); |
| 70008 | 70228 | size = pPage->xCellSize(pPage, &src[pc]); |
| 70009 | 70229 | cbrk -= size; |
| 70010 | 70230 | if( cbrk<iCellStart || pc+size>usableSize ){ |
| 70011 | 70231 | return SQLITE_CORRUPT_PAGE(pPage); |
| 70012 | 70232 | } |
| | @@ -70117,11 +70337,11 @@ |
| 70117 | 70337 | ** all the space together, however. This routine will avoid using |
| 70118 | 70338 | ** the first two bytes past the cell pointer area since presumably this |
| 70119 | 70339 | ** allocation is being made in order to insert a new cell, so we will |
| 70120 | 70340 | ** also end up needing a new cell pointer. |
| 70121 | 70341 | */ |
| 70122 | | -static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){ |
| 70342 | +static SQLITE_INLINE int allocateSpace(MemPage *pPage, int nByte, int *pIdx){ |
| 70123 | 70343 | const int hdr = pPage->hdrOffset; /* Local cache of pPage->hdrOffset */ |
| 70124 | 70344 | u8 * const data = pPage->aData; /* Local cache of pPage->aData */ |
| 70125 | 70345 | int top; /* First byte of cell content area */ |
| 70126 | 70346 | int rc = SQLITE_OK; /* Integer return code */ |
| 70127 | 70347 | u8 *pTmp; /* Temp ptr into data[] */ |
| | @@ -70143,17 +70363,18 @@ |
| 70143 | 70363 | ** then the cell content offset of an empty page wants to be 65536. |
| 70144 | 70364 | ** However, that integer is too large to be stored in a 2-byte unsigned |
| 70145 | 70365 | ** integer, so a value of 0 is used in its place. */ |
| 70146 | 70366 | pTmp = &data[hdr+5]; |
| 70147 | 70367 | top = get2byte(pTmp); |
| 70148 | | - assert( top<=(int)pPage->pBt->usableSize ); /* by btreeComputeFreeSpace() */ |
| 70149 | 70368 | if( gap>top ){ |
| 70150 | 70369 | if( top==0 && pPage->pBt->usableSize==65536 ){ |
| 70151 | 70370 | top = 65536; |
| 70152 | 70371 | }else{ |
| 70153 | 70372 | return SQLITE_CORRUPT_PAGE(pPage); |
| 70154 | 70373 | } |
| 70374 | + }else if( top>(int)pPage->pBt->usableSize ){ |
| 70375 | + return SQLITE_CORRUPT_PAGE(pPage); |
| 70155 | 70376 | } |
| 70156 | 70377 | |
| 70157 | 70378 | /* If there is enough space between gap and top for one more cell pointer, |
| 70158 | 70379 | ** and if the freelist is not empty, then search the |
| 70159 | 70380 | ** freelist looking for a slot big enough to satisfy the request. |
| | @@ -70232,11 +70453,11 @@ |
| 70232 | 70453 | assert( sqlite3PagerIswriteable(pPage->pDbPage) ); |
| 70233 | 70454 | assert( CORRUPT_DB || iStart>=pPage->hdrOffset+6+pPage->childPtrSize ); |
| 70234 | 70455 | assert( CORRUPT_DB || iEnd <= pPage->pBt->usableSize ); |
| 70235 | 70456 | assert( sqlite3_mutex_held(pPage->pBt->mutex) ); |
| 70236 | 70457 | assert( iSize>=4 ); /* Minimum cell size is 4 */ |
| 70237 | | - assert( iStart<=pPage->pBt->usableSize-4 ); |
| 70458 | + assert( CORRUPT_DB || iStart<=pPage->pBt->usableSize-4 ); |
| 70238 | 70459 | |
| 70239 | 70460 | /* The list of freeblocks must be in ascending order. Find the |
| 70240 | 70461 | ** spot on the list where iStart should be inserted. |
| 70241 | 70462 | */ |
| 70242 | 70463 | hdr = pPage->hdrOffset; |
| | @@ -70289,10 +70510,15 @@ |
| 70289 | 70510 | if( nFrag>data[hdr+7] ) return SQLITE_CORRUPT_PAGE(pPage); |
| 70290 | 70511 | data[hdr+7] -= nFrag; |
| 70291 | 70512 | } |
| 70292 | 70513 | pTmp = &data[hdr+5]; |
| 70293 | 70514 | x = get2byte(pTmp); |
| 70515 | + if( pPage->pBt->btsFlags & BTS_FAST_SECURE ){ |
| 70516 | + /* Overwrite deleted information with zeros when the secure_delete |
| 70517 | + ** option is enabled */ |
| 70518 | + memset(&data[iStart], 0, iSize); |
| 70519 | + } |
| 70294 | 70520 | if( iStart<=x ){ |
| 70295 | 70521 | /* The new freeblock is at the beginning of the cell content area, |
| 70296 | 70522 | ** so just extend the cell content area rather than create another |
| 70297 | 70523 | ** freelist entry */ |
| 70298 | 70524 | if( iStart<x ) return SQLITE_CORRUPT_PAGE(pPage); |
| | @@ -70300,18 +70526,13 @@ |
| 70300 | 70526 | put2byte(&data[hdr+1], iFreeBlk); |
| 70301 | 70527 | put2byte(&data[hdr+5], iEnd); |
| 70302 | 70528 | }else{ |
| 70303 | 70529 | /* Insert the new freeblock into the freelist */ |
| 70304 | 70530 | put2byte(&data[iPtr], iStart); |
| 70305 | | - } |
| 70306 | | - if( pPage->pBt->btsFlags & BTS_FAST_SECURE ){ |
| 70307 | | - /* Overwrite deleted information with zeros when the secure_delete |
| 70308 | | - ** option is enabled */ |
| 70309 | | - memset(&data[iStart], 0, iSize); |
| 70310 | | - } |
| 70311 | | - put2byte(&data[iStart], iFreeBlk); |
| 70312 | | - put2byte(&data[iStart+2], iSize); |
| 70531 | + put2byte(&data[iStart], iFreeBlk); |
| 70532 | + put2byte(&data[iStart+2], iSize); |
| 70533 | + } |
| 70313 | 70534 | pPage->nFree += iOrigSize; |
| 70314 | 70535 | return SQLITE_OK; |
| 70315 | 70536 | } |
| 70316 | 70537 | |
| 70317 | 70538 | /* |
| | @@ -70344,18 +70565,18 @@ |
| 70344 | 70565 | pPage->maxLocal = pBt->maxLeaf; |
| 70345 | 70566 | pPage->minLocal = pBt->minLeaf; |
| 70346 | 70567 | }else if( flagByte==(PTF_ZERODATA | PTF_LEAF) ){ |
| 70347 | 70568 | pPage->intKey = 0; |
| 70348 | 70569 | pPage->intKeyLeaf = 0; |
| 70349 | | - pPage->xCellSize = cellSizePtr; |
| 70570 | + pPage->xCellSize = cellSizePtrIdxLeaf; |
| 70350 | 70571 | pPage->xParseCell = btreeParseCellPtrIndex; |
| 70351 | 70572 | pPage->maxLocal = pBt->maxLocal; |
| 70352 | 70573 | pPage->minLocal = pBt->minLocal; |
| 70353 | 70574 | }else{ |
| 70354 | 70575 | pPage->intKey = 0; |
| 70355 | 70576 | pPage->intKeyLeaf = 0; |
| 70356 | | - pPage->xCellSize = cellSizePtr; |
| 70577 | + pPage->xCellSize = cellSizePtrIdxLeaf; |
| 70357 | 70578 | pPage->xParseCell = btreeParseCellPtrIndex; |
| 70358 | 70579 | return SQLITE_CORRUPT_PAGE(pPage); |
| 70359 | 70580 | } |
| 70360 | 70581 | }else{ |
| 70361 | 70582 | pPage->childPtrSize = 4; |
| | @@ -72217,11 +72438,11 @@ |
| 72217 | 72438 | assert( sqlite3_mutex_held(pBt->mutex) ); |
| 72218 | 72439 | assert( pDbPage->pBt==pBt ); |
| 72219 | 72440 | if( iDbPage<3 ) return SQLITE_CORRUPT_BKPT; |
| 72220 | 72441 | |
| 72221 | 72442 | /* Move page iDbPage from its current location to page number iFreePage */ |
| 72222 | | - TRACE(("AUTOVACUUM: Moving %d to free page %d (ptr page %d type %d)\n", |
| 72443 | + TRACE(("AUTOVACUUM: Moving %u to free page %u (ptr page %u type %u)\n", |
| 72223 | 72444 | iDbPage, iFreePage, iPtrPage, eType)); |
| 72224 | 72445 | rc = sqlite3PagerMovepage(pPager, pDbPage->pDbPage, iFreePage, isCommit); |
| 72225 | 72446 | if( rc!=SQLITE_OK ){ |
| 72226 | 72447 | return rc; |
| 72227 | 72448 | } |
| | @@ -74503,11 +74724,12 @@ |
| 74503 | 74724 | } |
| 74504 | 74725 | } |
| 74505 | 74726 | |
| 74506 | 74727 | pPage = pCur->pPage; |
| 74507 | 74728 | idx = ++pCur->ix; |
| 74508 | | - if( NEVER(!pPage->isInit) || sqlite3FaultSim(412) ){ |
| 74729 | + if( sqlite3FaultSim(412) ) pPage->isInit = 0; |
| 74730 | + if( !pPage->isInit ){ |
| 74509 | 74731 | return SQLITE_CORRUPT_BKPT; |
| 74510 | 74732 | } |
| 74511 | 74733 | |
| 74512 | 74734 | if( idx>=pPage->nCell ){ |
| 74513 | 74735 | if( !pPage->leaf ){ |
| | @@ -74766,11 +74988,11 @@ |
| 74766 | 74988 | } |
| 74767 | 74989 | *pPgno = iTrunk; |
| 74768 | 74990 | memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4); |
| 74769 | 74991 | *ppPage = pTrunk; |
| 74770 | 74992 | pTrunk = 0; |
| 74771 | | - TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1)); |
| 74993 | + TRACE(("ALLOCATE: %u trunk - %u free pages left\n", *pPgno, n-1)); |
| 74772 | 74994 | }else if( k>(u32)(pBt->usableSize/4 - 2) ){ |
| 74773 | 74995 | /* Value of k is out of range. Database corruption */ |
| 74774 | 74996 | rc = SQLITE_CORRUPT_PGNO(iTrunk); |
| 74775 | 74997 | goto end_allocate_page; |
| 74776 | 74998 | #ifndef SQLITE_OMIT_AUTOVACUUM |
| | @@ -74832,11 +75054,11 @@ |
| 74832 | 75054 | } |
| 74833 | 75055 | put4byte(&pPrevTrunk->aData[0], iNewTrunk); |
| 74834 | 75056 | } |
| 74835 | 75057 | } |
| 74836 | 75058 | pTrunk = 0; |
| 74837 | | - TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1)); |
| 75059 | + TRACE(("ALLOCATE: %u trunk - %u free pages left\n", *pPgno, n-1)); |
| 74838 | 75060 | #endif |
| 74839 | 75061 | }else if( k>0 ){ |
| 74840 | 75062 | /* Extract a leaf from the trunk */ |
| 74841 | 75063 | u32 closest; |
| 74842 | 75064 | Pgno iPage; |
| | @@ -74877,12 +75099,12 @@ |
| 74877 | 75099 | if( !searchList |
| 74878 | 75100 | || (iPage==nearby || (iPage<nearby && eMode==BTALLOC_LE)) |
| 74879 | 75101 | ){ |
| 74880 | 75102 | int noContent; |
| 74881 | 75103 | *pPgno = iPage; |
| 74882 | | - TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d" |
| 74883 | | - ": %d more free pages\n", |
| 75104 | + TRACE(("ALLOCATE: %u was leaf %u of %u on trunk %u" |
| 75105 | + ": %u more free pages\n", |
| 74884 | 75106 | *pPgno, closest+1, k, pTrunk->pgno, n-1)); |
| 74885 | 75107 | rc = sqlite3PagerWrite(pTrunk->pDbPage); |
| 74886 | 75108 | if( rc ) goto end_allocate_page; |
| 74887 | 75109 | if( closest<k-1 ){ |
| 74888 | 75110 | memcpy(&aData[8+closest*4], &aData[4+k*4], 4); |
| | @@ -74934,11 +75156,11 @@ |
| 74934 | 75156 | /* If *pPgno refers to a pointer-map page, allocate two new pages |
| 74935 | 75157 | ** at the end of the file instead of one. The first allocated page |
| 74936 | 75158 | ** becomes a new pointer-map page, the second is used by the caller. |
| 74937 | 75159 | */ |
| 74938 | 75160 | MemPage *pPg = 0; |
| 74939 | | - TRACE(("ALLOCATE: %d from end of file (pointer-map page)\n", pBt->nPage)); |
| 75161 | + TRACE(("ALLOCATE: %u from end of file (pointer-map page)\n", pBt->nPage)); |
| 74940 | 75162 | assert( pBt->nPage!=PENDING_BYTE_PAGE(pBt) ); |
| 74941 | 75163 | rc = btreeGetUnusedPage(pBt, pBt->nPage, &pPg, bNoContent); |
| 74942 | 75164 | if( rc==SQLITE_OK ){ |
| 74943 | 75165 | rc = sqlite3PagerWrite(pPg->pDbPage); |
| 74944 | 75166 | releasePage(pPg); |
| | @@ -74957,11 +75179,11 @@ |
| 74957 | 75179 | rc = sqlite3PagerWrite((*ppPage)->pDbPage); |
| 74958 | 75180 | if( rc!=SQLITE_OK ){ |
| 74959 | 75181 | releasePage(*ppPage); |
| 74960 | 75182 | *ppPage = 0; |
| 74961 | 75183 | } |
| 74962 | | - TRACE(("ALLOCATE: %d from end of file\n", *pPgno)); |
| 75184 | + TRACE(("ALLOCATE: %u from end of file\n", *pPgno)); |
| 74963 | 75185 | } |
| 74964 | 75186 | |
| 74965 | 75187 | assert( CORRUPT_DB || *pPgno!=PENDING_BYTE_PAGE(pBt) ); |
| 74966 | 75188 | |
| 74967 | 75189 | end_allocate_page: |
| | @@ -75085,11 +75307,11 @@ |
| 75085 | 75307 | if( pPage && (pBt->btsFlags & BTS_SECURE_DELETE)==0 ){ |
| 75086 | 75308 | sqlite3PagerDontWrite(pPage->pDbPage); |
| 75087 | 75309 | } |
| 75088 | 75310 | rc = btreeSetHasContent(pBt, iPage); |
| 75089 | 75311 | } |
| 75090 | | - TRACE(("FREE-PAGE: %d leaf on trunk page %d\n",pPage->pgno,pTrunk->pgno)); |
| 75312 | + TRACE(("FREE-PAGE: %u leaf on trunk page %u\n",pPage->pgno,pTrunk->pgno)); |
| 75091 | 75313 | goto freepage_out; |
| 75092 | 75314 | } |
| 75093 | 75315 | } |
| 75094 | 75316 | |
| 75095 | 75317 | /* If control flows to this point, then it was not possible to add the |
| | @@ -75106,11 +75328,11 @@ |
| 75106 | 75328 | goto freepage_out; |
| 75107 | 75329 | } |
| 75108 | 75330 | put4byte(pPage->aData, iTrunk); |
| 75109 | 75331 | put4byte(&pPage->aData[4], 0); |
| 75110 | 75332 | put4byte(&pPage1->aData[32], iPage); |
| 75111 | | - TRACE(("FREE-PAGE: %d new trunk page replacing %d\n", pPage->pgno, iTrunk)); |
| 75333 | + TRACE(("FREE-PAGE: %u new trunk page replacing %u\n", pPage->pgno, iTrunk)); |
| 75112 | 75334 | |
| 75113 | 75335 | freepage_out: |
| 75114 | 75336 | if( pPage ){ |
| 75115 | 75337 | pPage->isInit = 0; |
| 75116 | 75338 | } |
| | @@ -75465,10 +75687,18 @@ |
| 75465 | 75687 | ** pTemp is not null. Regardless of pTemp, allocate a new entry |
| 75466 | 75688 | ** in pPage->apOvfl[] and make it point to the cell content (either |
| 75467 | 75689 | ** in pTemp or the original pCell) and also record its index. |
| 75468 | 75690 | ** Allocating a new entry in pPage->aCell[] implies that |
| 75469 | 75691 | ** pPage->nOverflow is incremented. |
| 75692 | +** |
| 75693 | +** The insertCellFast() routine below works exactly the same as |
| 75694 | +** insertCell() except that it lacks the pTemp and iChild parameters |
| 75695 | +** which are assumed zero. Other than that, the two routines are the |
| 75696 | +** same. |
| 75697 | +** |
| 75698 | +** Fixes or enhancements to this routine should be reflected in |
| 75699 | +** insertCellFast()! |
| 75470 | 75700 | */ |
| 75471 | 75701 | static int insertCell( |
| 75472 | 75702 | MemPage *pPage, /* Page into which we are copying */ |
| 75473 | 75703 | int i, /* New cell becomes the i-th cell of the page */ |
| 75474 | 75704 | u8 *pCell, /* Content of the new cell */ |
| | @@ -75487,18 +75717,107 @@ |
| 75487 | 75717 | assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) ); |
| 75488 | 75718 | assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) ); |
| 75489 | 75719 | assert( sqlite3_mutex_held(pPage->pBt->mutex) ); |
| 75490 | 75720 | assert( sz==pPage->xCellSize(pPage, pCell) || CORRUPT_DB ); |
| 75491 | 75721 | assert( pPage->nFree>=0 ); |
| 75722 | + assert( iChild>0 ); |
| 75492 | 75723 | if( pPage->nOverflow || sz+2>pPage->nFree ){ |
| 75493 | 75724 | if( pTemp ){ |
| 75494 | 75725 | memcpy(pTemp, pCell, sz); |
| 75495 | 75726 | pCell = pTemp; |
| 75496 | 75727 | } |
| 75497 | | - if( iChild ){ |
| 75498 | | - put4byte(pCell, iChild); |
| 75728 | + put4byte(pCell, iChild); |
| 75729 | + j = pPage->nOverflow++; |
| 75730 | + /* Comparison against ArraySize-1 since we hold back one extra slot |
| 75731 | + ** as a contingency. In other words, never need more than 3 overflow |
| 75732 | + ** slots but 4 are allocated, just to be safe. */ |
| 75733 | + assert( j < ArraySize(pPage->apOvfl)-1 ); |
| 75734 | + pPage->apOvfl[j] = pCell; |
| 75735 | + pPage->aiOvfl[j] = (u16)i; |
| 75736 | + |
| 75737 | + /* When multiple overflows occur, they are always sequential and in |
| 75738 | + ** sorted order. This invariants arise because multiple overflows can |
| 75739 | + ** only occur when inserting divider cells into the parent page during |
| 75740 | + ** balancing, and the dividers are adjacent and sorted. |
| 75741 | + */ |
| 75742 | + assert( j==0 || pPage->aiOvfl[j-1]<(u16)i ); /* Overflows in sorted order */ |
| 75743 | + assert( j==0 || i==pPage->aiOvfl[j-1]+1 ); /* Overflows are sequential */ |
| 75744 | + }else{ |
| 75745 | + int rc = sqlite3PagerWrite(pPage->pDbPage); |
| 75746 | + if( NEVER(rc!=SQLITE_OK) ){ |
| 75747 | + return rc; |
| 75499 | 75748 | } |
| 75749 | + assert( sqlite3PagerIswriteable(pPage->pDbPage) ); |
| 75750 | + data = pPage->aData; |
| 75751 | + assert( &data[pPage->cellOffset]==pPage->aCellIdx ); |
| 75752 | + rc = allocateSpace(pPage, sz, &idx); |
| 75753 | + if( rc ){ return rc; } |
| 75754 | + /* The allocateSpace() routine guarantees the following properties |
| 75755 | + ** if it returns successfully */ |
| 75756 | + assert( idx >= 0 ); |
| 75757 | + assert( idx >= pPage->cellOffset+2*pPage->nCell+2 || CORRUPT_DB ); |
| 75758 | + assert( idx+sz <= (int)pPage->pBt->usableSize ); |
| 75759 | + pPage->nFree -= (u16)(2 + sz); |
| 75760 | + /* In a corrupt database where an entry in the cell index section of |
| 75761 | + ** a btree page has a value of 3 or less, the pCell value might point |
| 75762 | + ** as many as 4 bytes in front of the start of the aData buffer for |
| 75763 | + ** the source page. Make sure this does not cause problems by not |
| 75764 | + ** reading the first 4 bytes */ |
| 75765 | + memcpy(&data[idx+4], pCell+4, sz-4); |
| 75766 | + put4byte(&data[idx], iChild); |
| 75767 | + pIns = pPage->aCellIdx + i*2; |
| 75768 | + memmove(pIns+2, pIns, 2*(pPage->nCell - i)); |
| 75769 | + put2byte(pIns, idx); |
| 75770 | + pPage->nCell++; |
| 75771 | + /* increment the cell count */ |
| 75772 | + if( (++data[pPage->hdrOffset+4])==0 ) data[pPage->hdrOffset+3]++; |
| 75773 | + assert( get2byte(&data[pPage->hdrOffset+3])==pPage->nCell || CORRUPT_DB ); |
| 75774 | +#ifndef SQLITE_OMIT_AUTOVACUUM |
| 75775 | + if( pPage->pBt->autoVacuum ){ |
| 75776 | + int rc2 = SQLITE_OK; |
| 75777 | + /* The cell may contain a pointer to an overflow page. If so, write |
| 75778 | + ** the entry for the overflow page into the pointer map. |
| 75779 | + */ |
| 75780 | + ptrmapPutOvflPtr(pPage, pPage, pCell, &rc2); |
| 75781 | + if( rc2 ) return rc2; |
| 75782 | + } |
| 75783 | +#endif |
| 75784 | + } |
| 75785 | + return SQLITE_OK; |
| 75786 | +} |
| 75787 | + |
| 75788 | +/* |
| 75789 | +** This variant of insertCell() assumes that the pTemp and iChild |
| 75790 | +** parameters are both zero. Use this variant in sqlite3BtreeInsert() |
| 75791 | +** for performance improvement, and also so that this variant is only |
| 75792 | +** called from that one place, and is thus inlined, and thus runs must |
| 75793 | +** faster. |
| 75794 | +** |
| 75795 | +** Fixes or enhancements to this routine should be reflected into |
| 75796 | +** the insertCell() routine. |
| 75797 | +*/ |
| 75798 | +static int insertCellFast( |
| 75799 | + MemPage *pPage, /* Page into which we are copying */ |
| 75800 | + int i, /* New cell becomes the i-th cell of the page */ |
| 75801 | + u8 *pCell, /* Content of the new cell */ |
| 75802 | + int sz /* Bytes of content in pCell */ |
| 75803 | +){ |
| 75804 | + int idx = 0; /* Where to write new cell content in data[] */ |
| 75805 | + int j; /* Loop counter */ |
| 75806 | + u8 *data; /* The content of the whole page */ |
| 75807 | + u8 *pIns; /* The point in pPage->aCellIdx[] where no cell inserted */ |
| 75808 | + |
| 75809 | + assert( i>=0 && i<=pPage->nCell+pPage->nOverflow ); |
| 75810 | + assert( MX_CELL(pPage->pBt)<=10921 ); |
| 75811 | + assert( pPage->nCell<=MX_CELL(pPage->pBt) || CORRUPT_DB ); |
| 75812 | + assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) ); |
| 75813 | + assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) ); |
| 75814 | + assert( sqlite3_mutex_held(pPage->pBt->mutex) ); |
| 75815 | + assert( sz==pPage->xCellSize(pPage, pCell) || CORRUPT_DB ); |
| 75816 | + assert( pPage->nFree>=0 ); |
| 75817 | + assert( pPage->nOverflow==0 ); |
| 75818 | + if( sz+2>pPage->nFree ){ |
| 75500 | 75819 | j = pPage->nOverflow++; |
| 75501 | 75820 | /* Comparison against ArraySize-1 since we hold back one extra slot |
| 75502 | 75821 | ** as a contingency. In other words, never need more than 3 overflow |
| 75503 | 75822 | ** slots but 4 are allocated, just to be safe. */ |
| 75504 | 75823 | assert( j < ArraySize(pPage->apOvfl)-1 ); |
| | @@ -75526,21 +75845,11 @@ |
| 75526 | 75845 | ** if it returns successfully */ |
| 75527 | 75846 | assert( idx >= 0 ); |
| 75528 | 75847 | assert( idx >= pPage->cellOffset+2*pPage->nCell+2 || CORRUPT_DB ); |
| 75529 | 75848 | assert( idx+sz <= (int)pPage->pBt->usableSize ); |
| 75530 | 75849 | pPage->nFree -= (u16)(2 + sz); |
| 75531 | | - if( iChild ){ |
| 75532 | | - /* In a corrupt database where an entry in the cell index section of |
| 75533 | | - ** a btree page has a value of 3 or less, the pCell value might point |
| 75534 | | - ** as many as 4 bytes in front of the start of the aData buffer for |
| 75535 | | - ** the source page. Make sure this does not cause problems by not |
| 75536 | | - ** reading the first 4 bytes */ |
| 75537 | | - memcpy(&data[idx+4], pCell+4, sz-4); |
| 75538 | | - put4byte(&data[idx], iChild); |
| 75539 | | - }else{ |
| 75540 | | - memcpy(&data[idx], pCell, sz); |
| 75541 | | - } |
| 75850 | + memcpy(&data[idx], pCell, sz); |
| 75542 | 75851 | pIns = pPage->aCellIdx + i*2; |
| 75543 | 75852 | memmove(pIns+2, pIns, 2*(pPage->nCell - i)); |
| 75544 | 75853 | put2byte(pIns, idx); |
| 75545 | 75854 | pPage->nCell++; |
| 75546 | 75855 | /* increment the cell count */ |
| | @@ -75721,11 +76030,11 @@ |
| 75721 | 76030 | int k; /* Current slot in pCArray->apEnd[] */ |
| 75722 | 76031 | u8 *pSrcEnd; /* Current pCArray->apEnd[k] value */ |
| 75723 | 76032 | |
| 75724 | 76033 | assert( i<iEnd ); |
| 75725 | 76034 | j = get2byte(&aData[hdr+5]); |
| 75726 | | - if( j>(u32)usableSize ){ j = 0; } |
| 76035 | + if( NEVER(j>(u32)usableSize) ){ j = 0; } |
| 75727 | 76036 | memcpy(&pTmp[j], &aData[j], usableSize - j); |
| 75728 | 76037 | |
| 75729 | 76038 | for(k=0; pCArray->ixNx[k]<=i && ALWAYS(k<NB*2); k++){} |
| 75730 | 76039 | pSrcEnd = pCArray->apEnd[k]; |
| 75731 | 76040 | |
| | @@ -75865,46 +76174,54 @@ |
| 75865 | 76174 | ){ |
| 75866 | 76175 | u8 * const aData = pPg->aData; |
| 75867 | 76176 | u8 * const pEnd = &aData[pPg->pBt->usableSize]; |
| 75868 | 76177 | u8 * const pStart = &aData[pPg->hdrOffset + 8 + pPg->childPtrSize]; |
| 75869 | 76178 | int nRet = 0; |
| 75870 | | - int i; |
| 76179 | + int i, j; |
| 75871 | 76180 | int iEnd = iFirst + nCell; |
| 75872 | | - u8 *pFree = 0; /* \__ Parameters for pending call to */ |
| 75873 | | - int szFree = 0; /* / freeSpace() */ |
| 76181 | + int nFree = 0; |
| 76182 | + int aOfst[10]; |
| 76183 | + int aAfter[10]; |
| 75874 | 76184 | |
| 75875 | 76185 | for(i=iFirst; i<iEnd; i++){ |
| 75876 | 76186 | u8 *pCell = pCArray->apCell[i]; |
| 75877 | 76187 | if( SQLITE_WITHIN(pCell, pStart, pEnd) ){ |
| 75878 | 76188 | int sz; |
| 76189 | + int iAfter; |
| 76190 | + int iOfst; |
| 75879 | 76191 | /* No need to use cachedCellSize() here. The sizes of all cells that |
| 75880 | 76192 | ** are to be freed have already been computing while deciding which |
| 75881 | 76193 | ** cells need freeing */ |
| 75882 | 76194 | sz = pCArray->szCell[i]; assert( sz>0 ); |
| 75883 | | - if( pFree!=(pCell + sz) ){ |
| 75884 | | - if( pFree ){ |
| 75885 | | - assert( pFree>aData && (pFree - aData)<65536 ); |
| 75886 | | - freeSpace(pPg, (u16)(pFree - aData), szFree); |
| 75887 | | - } |
| 75888 | | - pFree = pCell; |
| 75889 | | - szFree = sz; |
| 75890 | | - if( pFree+sz>pEnd ){ |
| 75891 | | - return 0; |
| 75892 | | - } |
| 75893 | | - }else{ |
| 75894 | | - /* The current cell is adjacent to and before the pFree cell. |
| 75895 | | - ** Combine the two regions into one to reduce the number of calls |
| 75896 | | - ** to freeSpace(). */ |
| 75897 | | - pFree = pCell; |
| 75898 | | - szFree += sz; |
| 76195 | + iOfst = (u16)(pCell - aData); |
| 76196 | + iAfter = iOfst+sz; |
| 76197 | + for(j=0; j<nFree; j++){ |
| 76198 | + if( aOfst[j]==iAfter ){ |
| 76199 | + aOfst[j] = iOfst; |
| 76200 | + break; |
| 76201 | + }else if( aAfter[j]==iOfst ){ |
| 76202 | + aAfter[j] = iAfter; |
| 76203 | + break; |
| 76204 | + } |
| 76205 | + } |
| 76206 | + if( j>=nFree ){ |
| 76207 | + if( nFree>=sizeof(aOfst)/sizeof(aOfst[0]) ){ |
| 76208 | + for(j=0; j<nFree; j++){ |
| 76209 | + freeSpace(pPg, aOfst[j], aAfter[j]-aOfst[j]); |
| 76210 | + } |
| 76211 | + nFree = 0; |
| 76212 | + } |
| 76213 | + aOfst[nFree] = iOfst; |
| 76214 | + aAfter[nFree] = iAfter; |
| 76215 | + if( &aData[iAfter]>pEnd ) return 0; |
| 76216 | + nFree++; |
| 75899 | 76217 | } |
| 75900 | 76218 | nRet++; |
| 75901 | 76219 | } |
| 75902 | 76220 | } |
| 75903 | | - if( pFree ){ |
| 75904 | | - assert( pFree>aData && (pFree - aData)<65536 ); |
| 75905 | | - freeSpace(pPg, (u16)(pFree - aData), szFree); |
| 76221 | + for(j=0; j<nFree; j++){ |
| 76222 | + freeSpace(pPg, aOfst[j], aAfter[j]-aOfst[j]); |
| 75906 | 76223 | } |
| 75907 | 76224 | return nRet; |
| 75908 | 76225 | } |
| 75909 | 76226 | |
| 75910 | 76227 | /* |
| | @@ -75955,11 +76272,11 @@ |
| 75955 | 76272 | nCell -= nTail; |
| 75956 | 76273 | } |
| 75957 | 76274 | |
| 75958 | 76275 | pData = &aData[get2byteNotZero(&aData[hdr+5])]; |
| 75959 | 76276 | if( pData<pBegin ) goto editpage_fail; |
| 75960 | | - if( pData>pPg->aDataEnd ) goto editpage_fail; |
| 76277 | + if( NEVER(pData>pPg->aDataEnd) ) goto editpage_fail; |
| 75961 | 76278 | |
| 75962 | 76279 | /* Add cells to the start of the page */ |
| 75963 | 76280 | if( iNew<iOld ){ |
| 75964 | 76281 | int nAdd = MIN(nNew,iOld-iNew); |
| 75965 | 76282 | assert( (iOld-iNew)<nNew || nCell==0 || CORRUPT_DB ); |
| | @@ -76692,11 +77009,11 @@ |
| 76692 | 77009 | ** (2) pPage is a virtual root page. A virtual root page is when |
| 76693 | 77010 | ** the real root page is page 1 and we are the only child of |
| 76694 | 77011 | ** that page. |
| 76695 | 77012 | */ |
| 76696 | 77013 | assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) || CORRUPT_DB); |
| 76697 | | - TRACE(("BALANCE: old: %d(nc=%d) %d(nc=%d) %d(nc=%d)\n", |
| 77014 | + TRACE(("BALANCE: old: %u(nc=%u) %u(nc=%u) %u(nc=%u)\n", |
| 76698 | 77015 | apOld[0]->pgno, apOld[0]->nCell, |
| 76699 | 77016 | nOld>=2 ? apOld[1]->pgno : 0, nOld>=2 ? apOld[1]->nCell : 0, |
| 76700 | 77017 | nOld>=3 ? apOld[2]->pgno : 0, nOld>=3 ? apOld[2]->nCell : 0 |
| 76701 | 77018 | )); |
| 76702 | 77019 | |
| | @@ -76776,12 +77093,12 @@ |
| 76776 | 77093 | apNew[i]->pgno = pgnoB; |
| 76777 | 77094 | apNew[iB]->pgno = pgnoA; |
| 76778 | 77095 | } |
| 76779 | 77096 | } |
| 76780 | 77097 | |
| 76781 | | - TRACE(("BALANCE: new: %d(%d nc=%d) %d(%d nc=%d) %d(%d nc=%d) " |
| 76782 | | - "%d(%d nc=%d) %d(%d nc=%d)\n", |
| 77098 | + TRACE(("BALANCE: new: %u(%u nc=%u) %u(%u nc=%u) %u(%u nc=%u) " |
| 77099 | + "%u(%u nc=%u) %u(%u nc=%u)\n", |
| 76783 | 77100 | apNew[0]->pgno, szNew[0], cntNew[0], |
| 76784 | 77101 | nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0, |
| 76785 | 77102 | nNew>=2 ? cntNew[1] - cntNew[0] - !leafData : 0, |
| 76786 | 77103 | nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0, |
| 76787 | 77104 | nNew>=3 ? cntNew[2] - cntNew[1] - !leafData : 0, |
| | @@ -77022,11 +77339,11 @@ |
| 77022 | 77339 | ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc); |
| 77023 | 77340 | } |
| 77024 | 77341 | } |
| 77025 | 77342 | |
| 77026 | 77343 | assert( pParent->isInit ); |
| 77027 | | - TRACE(("BALANCE: finished: old=%d new=%d cells=%d\n", |
| 77344 | + TRACE(("BALANCE: finished: old=%u new=%u cells=%u\n", |
| 77028 | 77345 | nOld, nNew, b.nCell)); |
| 77029 | 77346 | |
| 77030 | 77347 | /* Free any old pages that were not reused as new pages. |
| 77031 | 77348 | */ |
| 77032 | 77349 | for(i=nNew; i<nOld; i++){ |
| | @@ -77107,11 +77424,11 @@ |
| 77107 | 77424 | } |
| 77108 | 77425 | assert( sqlite3PagerIswriteable(pChild->pDbPage) ); |
| 77109 | 77426 | assert( sqlite3PagerIswriteable(pRoot->pDbPage) ); |
| 77110 | 77427 | assert( pChild->nCell==pRoot->nCell || CORRUPT_DB ); |
| 77111 | 77428 | |
| 77112 | | - TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno)); |
| 77429 | + TRACE(("BALANCE: copy root %u into %u\n", pRoot->pgno, pChild->pgno)); |
| 77113 | 77430 | |
| 77114 | 77431 | /* Copy the overflow cells from pRoot to pChild */ |
| 77115 | 77432 | memcpy(pChild->aiOvfl, pRoot->aiOvfl, |
| 77116 | 77433 | pRoot->nOverflow*sizeof(pRoot->aiOvfl[0])); |
| 77117 | 77434 | memcpy(pChild->apOvfl, pRoot->apOvfl, |
| | @@ -77605,11 +77922,11 @@ |
| 77605 | 77922 | rc = btreeComputeFreeSpace(pPage); |
| 77606 | 77923 | } |
| 77607 | 77924 | if( rc ) return rc; |
| 77608 | 77925 | } |
| 77609 | 77926 | |
| 77610 | | - TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n", |
| 77927 | + TRACE(("INSERT: table=%u nkey=%lld ndata=%u page=%u %s\n", |
| 77611 | 77928 | pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno, |
| 77612 | 77929 | loc==0 ? "overwrite" : "new entry")); |
| 77613 | 77930 | assert( pPage->isInit || CORRUPT_DB ); |
| 77614 | 77931 | newCell = p->pBt->pTmpSpace; |
| 77615 | 77932 | assert( newCell!=0 ); |
| | @@ -77632,10 +77949,11 @@ |
| 77632 | 77949 | if( rc ) goto end_insert; |
| 77633 | 77950 | } |
| 77634 | 77951 | assert( szNew==pPage->xCellSize(pPage, newCell) ); |
| 77635 | 77952 | assert( szNew <= MX_CELL_SIZE(p->pBt) ); |
| 77636 | 77953 | idx = pCur->ix; |
| 77954 | + pCur->info.nSize = 0; |
| 77637 | 77955 | if( loc==0 ){ |
| 77638 | 77956 | CellInfo info; |
| 77639 | 77957 | assert( idx>=0 ); |
| 77640 | 77958 | if( idx>=pPage->nCell ){ |
| 77641 | 77959 | return SQLITE_CORRUPT_BKPT; |
| | @@ -77680,11 +77998,11 @@ |
| 77680 | 77998 | idx = ++pCur->ix; |
| 77681 | 77999 | pCur->curFlags &= ~BTCF_ValidNKey; |
| 77682 | 78000 | }else{ |
| 77683 | 78001 | assert( pPage->leaf ); |
| 77684 | 78002 | } |
| 77685 | | - rc = insertCell(pPage, idx, newCell, szNew, 0, 0); |
| 78003 | + rc = insertCellFast(pPage, idx, newCell, szNew); |
| 77686 | 78004 | assert( pPage->nOverflow==0 || rc==SQLITE_OK ); |
| 77687 | 78005 | assert( rc!=SQLITE_OK || pPage->nCell>0 || pPage->nOverflow>0 ); |
| 77688 | 78006 | |
| 77689 | 78007 | /* If no error has occurred and pPage has an overflow cell, call balance() |
| 77690 | 78008 | ** to redistribute the cells within the tree. Since balance() may move |
| | @@ -77704,11 +78022,10 @@ |
| 77704 | 78022 | ** the b-tree if possible. If the cursor is left pointing to the last |
| 77705 | 78023 | ** entry in the table, and the next row inserted has an integer key |
| 77706 | 78024 | ** larger than the largest existing key, it is possible to insert the |
| 77707 | 78025 | ** row without seeking the cursor. This can be a big performance boost. |
| 77708 | 78026 | */ |
| 77709 | | - pCur->info.nSize = 0; |
| 77710 | 78027 | if( pPage->nOverflow ){ |
| 77711 | 78028 | assert( rc==SQLITE_OK ); |
| 77712 | 78029 | pCur->curFlags &= ~(BTCF_ValidNKey); |
| 77713 | 78030 | rc = balance(pCur); |
| 77714 | 78031 | |
| | @@ -77904,10 +78221,13 @@ |
| 77904 | 78221 | return SQLITE_CORRUPT_BKPT; |
| 77905 | 78222 | } |
| 77906 | 78223 | pCell = findCell(pPage, iCellIdx); |
| 77907 | 78224 | if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ){ |
| 77908 | 78225 | return SQLITE_CORRUPT_BKPT; |
| 78226 | + } |
| 78227 | + if( pCell<&pPage->aCellIdx[pPage->nCell] ){ |
| 78228 | + return SQLITE_CORRUPT_BKPT; |
| 77909 | 78229 | } |
| 77910 | 78230 | |
| 77911 | 78231 | /* If the BTREE_SAVEPOSITION bit is on, then the cursor position must |
| 77912 | 78232 | ** be preserved following this delete operation. If the current delete |
| 77913 | 78233 | ** will cause a b-tree rebalance, then this is done by saving the cursor |
| | @@ -78653,11 +78973,12 @@ |
| 78653 | 78973 | va_start(ap, zFormat); |
| 78654 | 78974 | if( pCheck->errMsg.nChar ){ |
| 78655 | 78975 | sqlite3_str_append(&pCheck->errMsg, "\n", 1); |
| 78656 | 78976 | } |
| 78657 | 78977 | if( pCheck->zPfx ){ |
| 78658 | | - sqlite3_str_appendf(&pCheck->errMsg, pCheck->zPfx, pCheck->v1, pCheck->v2); |
| 78978 | + sqlite3_str_appendf(&pCheck->errMsg, pCheck->zPfx, |
| 78979 | + pCheck->v0, pCheck->v1, pCheck->v2); |
| 78659 | 78980 | } |
| 78660 | 78981 | sqlite3_str_vappendf(&pCheck->errMsg, zFormat, ap); |
| 78661 | 78982 | va_end(ap); |
| 78662 | 78983 | if( pCheck->errMsg.accError==SQLITE_NOMEM ){ |
| 78663 | 78984 | checkOom(pCheck); |
| | @@ -78693,15 +79014,15 @@ |
| 78693 | 79014 | ** |
| 78694 | 79015 | ** Also check that the page number is in bounds. |
| 78695 | 79016 | */ |
| 78696 | 79017 | static int checkRef(IntegrityCk *pCheck, Pgno iPage){ |
| 78697 | 79018 | if( iPage>pCheck->nPage || iPage==0 ){ |
| 78698 | | - checkAppendMsg(pCheck, "invalid page number %d", iPage); |
| 79019 | + checkAppendMsg(pCheck, "invalid page number %u", iPage); |
| 78699 | 79020 | return 1; |
| 78700 | 79021 | } |
| 78701 | 79022 | if( getPageReferenced(pCheck, iPage) ){ |
| 78702 | | - checkAppendMsg(pCheck, "2nd reference to page %d", iPage); |
| 79023 | + checkAppendMsg(pCheck, "2nd reference to page %u", iPage); |
| 78703 | 79024 | return 1; |
| 78704 | 79025 | } |
| 78705 | 79026 | setPageReferenced(pCheck, iPage); |
| 78706 | 79027 | return 0; |
| 78707 | 79028 | } |
| | @@ -78723,17 +79044,17 @@ |
| 78723 | 79044 | Pgno iPtrmapParent; |
| 78724 | 79045 | |
| 78725 | 79046 | rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent); |
| 78726 | 79047 | if( rc!=SQLITE_OK ){ |
| 78727 | 79048 | if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) checkOom(pCheck); |
| 78728 | | - checkAppendMsg(pCheck, "Failed to read ptrmap key=%d", iChild); |
| 79049 | + checkAppendMsg(pCheck, "Failed to read ptrmap key=%u", iChild); |
| 78729 | 79050 | return; |
| 78730 | 79051 | } |
| 78731 | 79052 | |
| 78732 | 79053 | if( ePtrmapType!=eType || iPtrmapParent!=iParent ){ |
| 78733 | 79054 | checkAppendMsg(pCheck, |
| 78734 | | - "Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)", |
| 79055 | + "Bad ptr map entry key=%u expected=(%u,%u) got=(%u,%u)", |
| 78735 | 79056 | iChild, eType, iParent, ePtrmapType, iPtrmapParent); |
| 78736 | 79057 | } |
| 78737 | 79058 | } |
| 78738 | 79059 | #endif |
| 78739 | 79060 | |
| | @@ -78754,11 +79075,11 @@ |
| 78754 | 79075 | DbPage *pOvflPage; |
| 78755 | 79076 | unsigned char *pOvflData; |
| 78756 | 79077 | if( checkRef(pCheck, iPage) ) break; |
| 78757 | 79078 | N--; |
| 78758 | 79079 | if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage, 0) ){ |
| 78759 | | - checkAppendMsg(pCheck, "failed to get page %d", iPage); |
| 79080 | + checkAppendMsg(pCheck, "failed to get page %u", iPage); |
| 78760 | 79081 | break; |
| 78761 | 79082 | } |
| 78762 | 79083 | pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage); |
| 78763 | 79084 | if( isFreeList ){ |
| 78764 | 79085 | u32 n = (u32)get4byte(&pOvflData[4]); |
| | @@ -78767,11 +79088,11 @@ |
| 78767 | 79088 | checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0); |
| 78768 | 79089 | } |
| 78769 | 79090 | #endif |
| 78770 | 79091 | if( n>pCheck->pBt->usableSize/4-2 ){ |
| 78771 | 79092 | checkAppendMsg(pCheck, |
| 78772 | | - "freelist leaf count too big on page %d", iPage); |
| 79093 | + "freelist leaf count too big on page %u", iPage); |
| 78773 | 79094 | N--; |
| 78774 | 79095 | }else{ |
| 78775 | 79096 | for(i=0; i<(int)n; i++){ |
| 78776 | 79097 | Pgno iFreePage = get4byte(&pOvflData[8+i*4]); |
| 78777 | 79098 | #ifndef SQLITE_OMIT_AUTOVACUUM |
| | @@ -78799,11 +79120,11 @@ |
| 78799 | 79120 | iPage = get4byte(pOvflData); |
| 78800 | 79121 | sqlite3PagerUnref(pOvflPage); |
| 78801 | 79122 | } |
| 78802 | 79123 | if( N && nErrAtStart==pCheck->nErr ){ |
| 78803 | 79124 | checkAppendMsg(pCheck, |
| 78804 | | - "%s is %d but should be %d", |
| 79125 | + "%s is %u but should be %u", |
| 78805 | 79126 | isFreeList ? "size" : "overflow list length", |
| 78806 | 79127 | expected-N, expected); |
| 78807 | 79128 | } |
| 78808 | 79129 | } |
| 78809 | 79130 | #endif /* SQLITE_OMIT_INTEGRITY_CHECK */ |
| | @@ -78914,12 +79235,12 @@ |
| 78914 | 79235 | if( pCheck->mxErr==0 ) goto end_of_check; |
| 78915 | 79236 | pBt = pCheck->pBt; |
| 78916 | 79237 | usableSize = pBt->usableSize; |
| 78917 | 79238 | if( iPage==0 ) return 0; |
| 78918 | 79239 | if( checkRef(pCheck, iPage) ) return 0; |
| 78919 | | - pCheck->zPfx = "Page %u: "; |
| 78920 | | - pCheck->v1 = iPage; |
| 79240 | + pCheck->zPfx = "Tree %u page %u: "; |
| 79241 | + pCheck->v0 = pCheck->v1 = iPage; |
| 78921 | 79242 | if( (rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0 ){ |
| 78922 | 79243 | checkAppendMsg(pCheck, |
| 78923 | 79244 | "unable to get the page. error code=%d", rc); |
| 78924 | 79245 | goto end_of_check; |
| 78925 | 79246 | } |
| | @@ -78941,11 +79262,11 @@ |
| 78941 | 79262 | } |
| 78942 | 79263 | data = pPage->aData; |
| 78943 | 79264 | hdr = pPage->hdrOffset; |
| 78944 | 79265 | |
| 78945 | 79266 | /* Set up for cell analysis */ |
| 78946 | | - pCheck->zPfx = "On tree page %u cell %d: "; |
| 79267 | + pCheck->zPfx = "Tree %u page %u cell %u: "; |
| 78947 | 79268 | contentOffset = get2byteNotZero(&data[hdr+5]); |
| 78948 | 79269 | assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */ |
| 78949 | 79270 | |
| 78950 | 79271 | /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the |
| 78951 | 79272 | ** number of cells on the page. */ |
| | @@ -78961,11 +79282,11 @@ |
| 78961 | 79282 | if( !pPage->leaf ){ |
| 78962 | 79283 | /* Analyze the right-child page of internal pages */ |
| 78963 | 79284 | pgno = get4byte(&data[hdr+8]); |
| 78964 | 79285 | #ifndef SQLITE_OMIT_AUTOVACUUM |
| 78965 | 79286 | if( pBt->autoVacuum ){ |
| 78966 | | - pCheck->zPfx = "On page %u at right child: "; |
| 79287 | + pCheck->zPfx = "Tree %u page %u right child: "; |
| 78967 | 79288 | checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage); |
| 78968 | 79289 | } |
| 78969 | 79290 | #endif |
| 78970 | 79291 | depth = checkTreePage(pCheck, pgno, &maxKey, maxKey); |
| 78971 | 79292 | keyCanBeEqual = 0; |
| | @@ -78985,11 +79306,11 @@ |
| 78985 | 79306 | pCheck->v2 = i; |
| 78986 | 79307 | assert( pCellIdx==&data[cellStart + i*2] ); |
| 78987 | 79308 | pc = get2byteAligned(pCellIdx); |
| 78988 | 79309 | pCellIdx -= 2; |
| 78989 | 79310 | if( pc<contentOffset || pc>usableSize-4 ){ |
| 78990 | | - checkAppendMsg(pCheck, "Offset %d out of range %d..%d", |
| 79311 | + checkAppendMsg(pCheck, "Offset %u out of range %u..%u", |
| 78991 | 79312 | pc, contentOffset, usableSize-4); |
| 78992 | 79313 | doCoverageCheck = 0; |
| 78993 | 79314 | continue; |
| 78994 | 79315 | } |
| 78995 | 79316 | pCell = &data[pc]; |
| | @@ -79117,11 +79438,11 @@ |
| 79117 | 79438 | ** EVIDENCE-OF: R-07161-27322 The one-byte integer at offset 7 gives the |
| 79118 | 79439 | ** number of fragmented free bytes within the cell content area. |
| 79119 | 79440 | */ |
| 79120 | 79441 | if( heap[0]==0 && nFrag!=data[hdr+7] ){ |
| 79121 | 79442 | checkAppendMsg(pCheck, |
| 79122 | | - "Fragmentation of %d bytes reported as %d on page %u", |
| 79443 | + "Fragmentation of %u bytes reported as %u on page %u", |
| 79123 | 79444 | nFrag, data[hdr+7], iPage); |
| 79124 | 79445 | } |
| 79125 | 79446 | } |
| 79126 | 79447 | |
| 79127 | 79448 | end_of_check: |
| | @@ -79214,11 +79535,11 @@ |
| 79214 | 79535 | if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i); |
| 79215 | 79536 | |
| 79216 | 79537 | /* Check the integrity of the freelist |
| 79217 | 79538 | */ |
| 79218 | 79539 | if( bCkFreelist ){ |
| 79219 | | - sCheck.zPfx = "Main freelist: "; |
| 79540 | + sCheck.zPfx = "Freelist: "; |
| 79220 | 79541 | checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]), |
| 79221 | 79542 | get4byte(&pBt->pPage1->aData[36])); |
| 79222 | 79543 | sCheck.zPfx = 0; |
| 79223 | 79544 | } |
| 79224 | 79545 | |
| | @@ -79231,11 +79552,11 @@ |
| 79231 | 79552 | Pgno mxInHdr; |
| 79232 | 79553 | for(i=0; (int)i<nRoot; i++) if( mx<aRoot[i] ) mx = aRoot[i]; |
| 79233 | 79554 | mxInHdr = get4byte(&pBt->pPage1->aData[52]); |
| 79234 | 79555 | if( mx!=mxInHdr ){ |
| 79235 | 79556 | checkAppendMsg(&sCheck, |
| 79236 | | - "max rootpage (%d) disagrees with header (%d)", |
| 79557 | + "max rootpage (%u) disagrees with header (%u)", |
| 79237 | 79558 | mx, mxInHdr |
| 79238 | 79559 | ); |
| 79239 | 79560 | } |
| 79240 | 79561 | }else if( get4byte(&pBt->pPage1->aData[64])!=0 ){ |
| 79241 | 79562 | checkAppendMsg(&sCheck, |
| | @@ -79262,23 +79583,23 @@ |
| 79262 | 79583 | */ |
| 79263 | 79584 | if( !bPartial ){ |
| 79264 | 79585 | for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){ |
| 79265 | 79586 | #ifdef SQLITE_OMIT_AUTOVACUUM |
| 79266 | 79587 | if( getPageReferenced(&sCheck, i)==0 ){ |
| 79267 | | - checkAppendMsg(&sCheck, "Page %d is never used", i); |
| 79588 | + checkAppendMsg(&sCheck, "Page %u: never used", i); |
| 79268 | 79589 | } |
| 79269 | 79590 | #else |
| 79270 | 79591 | /* If the database supports auto-vacuum, make sure no tables contain |
| 79271 | 79592 | ** references to pointer-map pages. |
| 79272 | 79593 | */ |
| 79273 | 79594 | if( getPageReferenced(&sCheck, i)==0 && |
| 79274 | 79595 | (PTRMAP_PAGENO(pBt, i)!=i || !pBt->autoVacuum) ){ |
| 79275 | | - checkAppendMsg(&sCheck, "Page %d is never used", i); |
| 79596 | + checkAppendMsg(&sCheck, "Page %u: never used", i); |
| 79276 | 79597 | } |
| 79277 | 79598 | if( getPageReferenced(&sCheck, i)!=0 && |
| 79278 | 79599 | (PTRMAP_PAGENO(pBt, i)==i && pBt->autoVacuum) ){ |
| 79279 | | - checkAppendMsg(&sCheck, "Pointer map page %d is referenced", i); |
| 79600 | + checkAppendMsg(&sCheck, "Page %u: pointer map referenced", i); |
| 79280 | 79601 | } |
| 79281 | 79602 | #endif |
| 79282 | 79603 | } |
| 79283 | 79604 | } |
| 79284 | 79605 | |
| | @@ -80806,11 +81127,11 @@ |
| 80806 | 81127 | return SQLITE_NOMEM_BKPT; |
| 80807 | 81128 | } |
| 80808 | 81129 | |
| 80809 | 81130 | vdbeMemRenderNum(nByte, pMem->z, pMem); |
| 80810 | 81131 | assert( pMem->z!=0 ); |
| 80811 | | - assert( pMem->n==sqlite3Strlen30NN(pMem->z) ); |
| 81132 | + assert( pMem->n==(int)sqlite3Strlen30NN(pMem->z) ); |
| 80812 | 81133 | pMem->enc = SQLITE_UTF8; |
| 80813 | 81134 | pMem->flags |= MEM_Str|MEM_Term; |
| 80814 | 81135 | if( bForce ) pMem->flags &= ~(MEM_Int|MEM_Real|MEM_IntReal); |
| 80815 | 81136 | sqlite3VdbeChangeEncoding(pMem, enc); |
| 80816 | 81137 | return SQLITE_OK; |
| | @@ -81850,10 +82171,13 @@ |
| 81850 | 82171 | assert( ExprUseXList(p) ); |
| 81851 | 82172 | pList = p->x.pList; |
| 81852 | 82173 | if( pList ) nVal = pList->nExpr; |
| 81853 | 82174 | assert( !ExprHasProperty(p, EP_IntValue) ); |
| 81854 | 82175 | pFunc = sqlite3FindFunction(db, p->u.zToken, nVal, enc, 0); |
| 82176 | +#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION |
| 82177 | + if( pFunc==0 ) return SQLITE_OK; |
| 82178 | +#endif |
| 81855 | 82179 | assert( pFunc ); |
| 81856 | 82180 | if( (pFunc->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG))==0 |
| 81857 | 82181 | || (pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL) |
| 81858 | 82182 | ){ |
| 81859 | 82183 | return SQLITE_OK; |
| | @@ -81886,20 +82210,15 @@ |
| 81886 | 82210 | rc = ctx.isError; |
| 81887 | 82211 | sqlite3ErrorMsg(pCtx->pParse, "%s", sqlite3_value_text(pVal)); |
| 81888 | 82212 | }else{ |
| 81889 | 82213 | sqlite3ValueApplyAffinity(pVal, aff, SQLITE_UTF8); |
| 81890 | 82214 | assert( rc==SQLITE_OK ); |
| 81891 | | - assert( enc==pVal->enc |
| 81892 | | - || (pVal->flags & MEM_Str)==0 |
| 81893 | | - || db->mallocFailed ); |
| 81894 | | -#if 0 /* Not reachable except after a prior failure */ |
| 81895 | 82215 | rc = sqlite3VdbeChangeEncoding(pVal, enc); |
| 81896 | | - if( rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal) ){ |
| 82216 | + if( NEVER(rc==SQLITE_OK && sqlite3VdbeMemTooBig(pVal)) ){ |
| 81897 | 82217 | rc = SQLITE_TOOBIG; |
| 81898 | 82218 | pCtx->pParse->nErr++; |
| 81899 | 82219 | } |
| 81900 | | -#endif |
| 81901 | 82220 | } |
| 81902 | 82221 | |
| 81903 | 82222 | value_from_function_out: |
| 81904 | 82223 | if( rc!=SQLITE_OK ){ |
| 81905 | 82224 | pVal = 0; |
| | @@ -81959,10 +82278,17 @@ |
| 81959 | 82278 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 81960 | 82279 | aff = sqlite3AffinityType(pExpr->u.zToken,0); |
| 81961 | 82280 | rc = valueFromExpr(db, pExpr->pLeft, enc, aff, ppVal, pCtx); |
| 81962 | 82281 | testcase( rc!=SQLITE_OK ); |
| 81963 | 82282 | if( *ppVal ){ |
| 82283 | +#ifdef SQLITE_ENABLE_STAT4 |
| 82284 | + rc = ExpandBlob(*ppVal); |
| 82285 | +#else |
| 82286 | + /* zero-blobs only come from functions, not literal values. And |
| 82287 | + ** functions are only processed under STAT4 */ |
| 82288 | + assert( (ppVal[0][0].flags & MEM_Zero)==0 ); |
| 82289 | +#endif |
| 81964 | 82290 | sqlite3VdbeMemCast(*ppVal, aff, enc); |
| 81965 | 82291 | sqlite3ValueApplyAffinity(*ppVal, affinity, enc); |
| 81966 | 82292 | } |
| 81967 | 82293 | return rc; |
| 81968 | 82294 | } |
| | @@ -82805,14 +83131,14 @@ |
| 82805 | 83131 | ** If the bPush flag is true, then make this opcode the parent for |
| 82806 | 83132 | ** subsequent Explains until sqlite3VdbeExplainPop() is called. |
| 82807 | 83133 | */ |
| 82808 | 83134 | SQLITE_PRIVATE int sqlite3VdbeExplain(Parse *pParse, u8 bPush, const char *zFmt, ...){ |
| 82809 | 83135 | int addr = 0; |
| 82810 | | -#if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS) |
| 83136 | +#if !defined(SQLITE_DEBUG) |
| 82811 | 83137 | /* Always include the OP_Explain opcodes if SQLITE_DEBUG is defined. |
| 82812 | 83138 | ** But omit them (for performance) during production builds */ |
| 82813 | | - if( pParse->explain==2 ) |
| 83139 | + if( pParse->explain==2 || IS_STMT_SCANSTATUS(pParse->db) ) |
| 82814 | 83140 | #endif |
| 82815 | 83141 | { |
| 82816 | 83142 | char *zMsg; |
| 82817 | 83143 | Vdbe *v; |
| 82818 | 83144 | va_list ap; |
| | @@ -83484,22 +83810,24 @@ |
| 83484 | 83810 | int addrLoop, /* Address of loop counter */ |
| 83485 | 83811 | int addrVisit, /* Address of rows visited counter */ |
| 83486 | 83812 | LogEst nEst, /* Estimated number of output rows */ |
| 83487 | 83813 | const char *zName /* Name of table or index being scanned */ |
| 83488 | 83814 | ){ |
| 83489 | | - sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus); |
| 83490 | | - ScanStatus *aNew; |
| 83491 | | - aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte); |
| 83492 | | - if( aNew ){ |
| 83493 | | - ScanStatus *pNew = &aNew[p->nScan++]; |
| 83494 | | - memset(pNew, 0, sizeof(ScanStatus)); |
| 83495 | | - pNew->addrExplain = addrExplain; |
| 83496 | | - pNew->addrLoop = addrLoop; |
| 83497 | | - pNew->addrVisit = addrVisit; |
| 83498 | | - pNew->nEst = nEst; |
| 83499 | | - pNew->zName = sqlite3DbStrDup(p->db, zName); |
| 83500 | | - p->aScan = aNew; |
| 83815 | + if( IS_STMT_SCANSTATUS(p->db) ){ |
| 83816 | + sqlite3_int64 nByte = (p->nScan+1) * sizeof(ScanStatus); |
| 83817 | + ScanStatus *aNew; |
| 83818 | + aNew = (ScanStatus*)sqlite3DbRealloc(p->db, p->aScan, nByte); |
| 83819 | + if( aNew ){ |
| 83820 | + ScanStatus *pNew = &aNew[p->nScan++]; |
| 83821 | + memset(pNew, 0, sizeof(ScanStatus)); |
| 83822 | + pNew->addrExplain = addrExplain; |
| 83823 | + pNew->addrLoop = addrLoop; |
| 83824 | + pNew->addrVisit = addrVisit; |
| 83825 | + pNew->nEst = nEst; |
| 83826 | + pNew->zName = sqlite3DbStrDup(p->db, zName); |
| 83827 | + p->aScan = aNew; |
| 83828 | + } |
| 83501 | 83829 | } |
| 83502 | 83830 | } |
| 83503 | 83831 | |
| 83504 | 83832 | /* |
| 83505 | 83833 | ** Add the range of instructions from addrStart to addrEnd (inclusive) to |
| | @@ -83512,24 +83840,26 @@ |
| 83512 | 83840 | Vdbe *p, |
| 83513 | 83841 | int addrExplain, |
| 83514 | 83842 | int addrStart, |
| 83515 | 83843 | int addrEnd |
| 83516 | 83844 | ){ |
| 83517 | | - ScanStatus *pScan = 0; |
| 83518 | | - int ii; |
| 83519 | | - for(ii=p->nScan-1; ii>=0; ii--){ |
| 83520 | | - pScan = &p->aScan[ii]; |
| 83521 | | - if( pScan->addrExplain==addrExplain ) break; |
| 83522 | | - pScan = 0; |
| 83523 | | - } |
| 83524 | | - if( pScan ){ |
| 83525 | | - if( addrEnd<0 ) addrEnd = sqlite3VdbeCurrentAddr(p)-1; |
| 83526 | | - for(ii=0; ii<ArraySize(pScan->aAddrRange); ii+=2){ |
| 83527 | | - if( pScan->aAddrRange[ii]==0 ){ |
| 83528 | | - pScan->aAddrRange[ii] = addrStart; |
| 83529 | | - pScan->aAddrRange[ii+1] = addrEnd; |
| 83530 | | - break; |
| 83845 | + if( IS_STMT_SCANSTATUS(p->db) ){ |
| 83846 | + ScanStatus *pScan = 0; |
| 83847 | + int ii; |
| 83848 | + for(ii=p->nScan-1; ii>=0; ii--){ |
| 83849 | + pScan = &p->aScan[ii]; |
| 83850 | + if( pScan->addrExplain==addrExplain ) break; |
| 83851 | + pScan = 0; |
| 83852 | + } |
| 83853 | + if( pScan ){ |
| 83854 | + if( addrEnd<0 ) addrEnd = sqlite3VdbeCurrentAddr(p)-1; |
| 83855 | + for(ii=0; ii<ArraySize(pScan->aAddrRange); ii+=2){ |
| 83856 | + if( pScan->aAddrRange[ii]==0 ){ |
| 83857 | + pScan->aAddrRange[ii] = addrStart; |
| 83858 | + pScan->aAddrRange[ii+1] = addrEnd; |
| 83859 | + break; |
| 83860 | + } |
| 83531 | 83861 | } |
| 83532 | 83862 | } |
| 83533 | 83863 | } |
| 83534 | 83864 | } |
| 83535 | 83865 | |
| | @@ -83542,23 +83872,25 @@ |
| 83542 | 83872 | Vdbe *p, |
| 83543 | 83873 | int addrExplain, |
| 83544 | 83874 | int addrLoop, |
| 83545 | 83875 | int addrVisit |
| 83546 | 83876 | ){ |
| 83547 | | - ScanStatus *pScan = 0; |
| 83548 | | - int ii; |
| 83549 | | - for(ii=p->nScan-1; ii>=0; ii--){ |
| 83550 | | - pScan = &p->aScan[ii]; |
| 83551 | | - if( pScan->addrExplain==addrExplain ) break; |
| 83552 | | - pScan = 0; |
| 83553 | | - } |
| 83554 | | - if( pScan ){ |
| 83555 | | - pScan->addrLoop = addrLoop; |
| 83556 | | - pScan->addrVisit = addrVisit; |
| 83877 | + if( IS_STMT_SCANSTATUS(p->db) ){ |
| 83878 | + ScanStatus *pScan = 0; |
| 83879 | + int ii; |
| 83880 | + for(ii=p->nScan-1; ii>=0; ii--){ |
| 83881 | + pScan = &p->aScan[ii]; |
| 83882 | + if( pScan->addrExplain==addrExplain ) break; |
| 83883 | + pScan = 0; |
| 83884 | + } |
| 83885 | + if( pScan ){ |
| 83886 | + pScan->addrLoop = addrLoop; |
| 83887 | + pScan->addrVisit = addrVisit; |
| 83888 | + } |
| 83557 | 83889 | } |
| 83558 | 83890 | } |
| 83559 | | -#endif |
| 83891 | +#endif /* defined(SQLITE_ENABLE_STMT_SCANSTATUS) */ |
| 83560 | 83892 | |
| 83561 | 83893 | |
| 83562 | 83894 | /* |
| 83563 | 83895 | ** Change the value of the opcode, or P1, P2, P3, or P5 operands |
| 83564 | 83896 | ** for a specific instruction. |
| | @@ -85682,10 +86014,12 @@ |
| 85682 | 86014 | db->nDeferredCons = 0; |
| 85683 | 86015 | db->nDeferredImmCons = 0; |
| 85684 | 86016 | db->flags &= ~(u64)SQLITE_DeferFKs; |
| 85685 | 86017 | sqlite3CommitInternalChanges(db); |
| 85686 | 86018 | } |
| 86019 | + }else if( p->rc==SQLITE_SCHEMA && db->nVdbeActive>1 ){ |
| 86020 | + p->nChange = 0; |
| 85687 | 86021 | }else{ |
| 85688 | 86022 | sqlite3RollbackAll(db, SQLITE_OK); |
| 85689 | 86023 | p->nChange = 0; |
| 85690 | 86024 | } |
| 85691 | 86025 | db->nStatement = 0; |
| | @@ -86000,13 +86334,13 @@ |
| 86000 | 86334 | vdbeFreeOpArray(db, p->aOp, p->nOp); |
| 86001 | 86335 | if( p->zSql ) sqlite3DbNNFreeNN(db, p->zSql); |
| 86002 | 86336 | #ifdef SQLITE_ENABLE_NORMALIZE |
| 86003 | 86337 | sqlite3DbFree(db, p->zNormSql); |
| 86004 | 86338 | { |
| 86005 | | - DblquoteStr *pThis, *pNext; |
| 86006 | | - for(pThis=p->pDblStr; pThis; pThis=pNext){ |
| 86007 | | - pNext = pThis->pNextStr; |
| 86339 | + DblquoteStr *pThis, *pNxt; |
| 86340 | + for(pThis=p->pDblStr; pThis; pThis=pNxt){ |
| 86341 | + pNxt = pThis->pNextStr; |
| 86008 | 86342 | sqlite3DbFree(db, pThis); |
| 86009 | 86343 | } |
| 86010 | 86344 | } |
| 86011 | 86345 | #endif |
| 86012 | 86346 | #ifdef SQLITE_ENABLE_STMT_SCANSTATUS |
| | @@ -87629,10 +87963,24 @@ |
| 87629 | 87963 | return 0; |
| 87630 | 87964 | } |
| 87631 | 87965 | return 1; |
| 87632 | 87966 | } |
| 87633 | 87967 | |
| 87968 | +#if defined(SQLITE_ENABLE_CURSOR_HINTS) && defined(SQLITE_DEBUG) |
| 87969 | +/* |
| 87970 | +** This Walker callback is used to help verify that calls to |
| 87971 | +** sqlite3BtreeCursorHint() with opcode BTREE_HINT_RANGE have |
| 87972 | +** byte-code register values correctly initialized. |
| 87973 | +*/ |
| 87974 | +SQLITE_PRIVATE int sqlite3CursorRangeHintExprCheck(Walker *pWalker, Expr *pExpr){ |
| 87975 | + if( pExpr->op==TK_REGISTER ){ |
| 87976 | + assert( (pWalker->u.aMem[pExpr->iTable].flags & MEM_Undefined)==0 ); |
| 87977 | + } |
| 87978 | + return WRC_Continue; |
| 87979 | +} |
| 87980 | +#endif /* SQLITE_ENABLE_CURSOR_HINTS && SQLITE_DEBUG */ |
| 87981 | + |
| 87634 | 87982 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 87635 | 87983 | /* |
| 87636 | 87984 | ** Transfer error message text from an sqlite3_vtab.zErrMsg (text stored |
| 87637 | 87985 | ** in memory obtained from sqlite3_malloc) into a Vdbe.zErrMsg (text stored |
| 87638 | 87986 | ** in memory obtained from sqlite3DbMalloc). |
| | @@ -88015,11 +88363,11 @@ |
| 88015 | 88363 | SQLITE_NULL, /* 0x1d (not possible) */ |
| 88016 | 88364 | SQLITE_INTEGER, /* 0x1e (not possible) */ |
| 88017 | 88365 | SQLITE_NULL, /* 0x1f (not possible) */ |
| 88018 | 88366 | SQLITE_FLOAT, /* 0x20 INTREAL */ |
| 88019 | 88367 | SQLITE_NULL, /* 0x21 (not possible) */ |
| 88020 | | - SQLITE_TEXT, /* 0x22 INTREAL + TEXT */ |
| 88368 | + SQLITE_FLOAT, /* 0x22 INTREAL + TEXT */ |
| 88021 | 88369 | SQLITE_NULL, /* 0x23 (not possible) */ |
| 88022 | 88370 | SQLITE_FLOAT, /* 0x24 (not possible) */ |
| 88023 | 88371 | SQLITE_NULL, /* 0x25 (not possible) */ |
| 88024 | 88372 | SQLITE_FLOAT, /* 0x26 (not possible) */ |
| 88025 | 88373 | SQLITE_NULL, /* 0x27 (not possible) */ |
| | @@ -89882,19 +90230,28 @@ |
| 89882 | 90230 | int iScanStatusOp, /* Which metric to return */ |
| 89883 | 90231 | int flags, |
| 89884 | 90232 | void *pOut /* OUT: Write the answer here */ |
| 89885 | 90233 | ){ |
| 89886 | 90234 | Vdbe *p = (Vdbe*)pStmt; |
| 89887 | | - ScanStatus *pScan; |
| 90235 | + VdbeOp *aOp = p->aOp; |
| 90236 | + int nOp = p->nOp; |
| 90237 | + ScanStatus *pScan = 0; |
| 89888 | 90238 | int idx; |
| 90239 | + |
| 90240 | + if( p->pFrame ){ |
| 90241 | + VdbeFrame *pFrame; |
| 90242 | + for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent); |
| 90243 | + aOp = pFrame->aOp; |
| 90244 | + nOp = pFrame->nOp; |
| 90245 | + } |
| 89889 | 90246 | |
| 89890 | 90247 | if( iScan<0 ){ |
| 89891 | 90248 | int ii; |
| 89892 | 90249 | if( iScanStatusOp==SQLITE_SCANSTAT_NCYCLE ){ |
| 89893 | 90250 | i64 res = 0; |
| 89894 | | - for(ii=0; ii<p->nOp; ii++){ |
| 89895 | | - res += p->aOp[ii].nCycle; |
| 90251 | + for(ii=0; ii<nOp; ii++){ |
| 90252 | + res += aOp[ii].nCycle; |
| 89896 | 90253 | } |
| 89897 | 90254 | *(i64*)pOut = res; |
| 89898 | 90255 | return 0; |
| 89899 | 90256 | } |
| 89900 | 90257 | return 1; |
| | @@ -89916,19 +90273,19 @@ |
| 89916 | 90273 | if( idx>=p->nScan ) return 1; |
| 89917 | 90274 | |
| 89918 | 90275 | switch( iScanStatusOp ){ |
| 89919 | 90276 | case SQLITE_SCANSTAT_NLOOP: { |
| 89920 | 90277 | if( pScan->addrLoop>0 ){ |
| 89921 | | - *(sqlite3_int64*)pOut = p->aOp[pScan->addrLoop].nExec; |
| 90278 | + *(sqlite3_int64*)pOut = aOp[pScan->addrLoop].nExec; |
| 89922 | 90279 | }else{ |
| 89923 | 90280 | *(sqlite3_int64*)pOut = -1; |
| 89924 | 90281 | } |
| 89925 | 90282 | break; |
| 89926 | 90283 | } |
| 89927 | 90284 | case SQLITE_SCANSTAT_NVISIT: { |
| 89928 | 90285 | if( pScan->addrVisit>0 ){ |
| 89929 | | - *(sqlite3_int64*)pOut = p->aOp[pScan->addrVisit].nExec; |
| 90286 | + *(sqlite3_int64*)pOut = aOp[pScan->addrVisit].nExec; |
| 89930 | 90287 | }else{ |
| 89931 | 90288 | *(sqlite3_int64*)pOut = -1; |
| 89932 | 90289 | } |
| 89933 | 90290 | break; |
| 89934 | 90291 | } |
| | @@ -89946,27 +90303,27 @@ |
| 89946 | 90303 | *(const char**)pOut = pScan->zName; |
| 89947 | 90304 | break; |
| 89948 | 90305 | } |
| 89949 | 90306 | case SQLITE_SCANSTAT_EXPLAIN: { |
| 89950 | 90307 | if( pScan->addrExplain ){ |
| 89951 | | - *(const char**)pOut = p->aOp[ pScan->addrExplain ].p4.z; |
| 90308 | + *(const char**)pOut = aOp[ pScan->addrExplain ].p4.z; |
| 89952 | 90309 | }else{ |
| 89953 | 90310 | *(const char**)pOut = 0; |
| 89954 | 90311 | } |
| 89955 | 90312 | break; |
| 89956 | 90313 | } |
| 89957 | 90314 | case SQLITE_SCANSTAT_SELECTID: { |
| 89958 | 90315 | if( pScan->addrExplain ){ |
| 89959 | | - *(int*)pOut = p->aOp[ pScan->addrExplain ].p1; |
| 90316 | + *(int*)pOut = aOp[ pScan->addrExplain ].p1; |
| 89960 | 90317 | }else{ |
| 89961 | 90318 | *(int*)pOut = -1; |
| 89962 | 90319 | } |
| 89963 | 90320 | break; |
| 89964 | 90321 | } |
| 89965 | 90322 | case SQLITE_SCANSTAT_PARENTID: { |
| 89966 | 90323 | if( pScan->addrExplain ){ |
| 89967 | | - *(int*)pOut = p->aOp[ pScan->addrExplain ].p2; |
| 90324 | + *(int*)pOut = aOp[ pScan->addrExplain ].p2; |
| 89968 | 90325 | }else{ |
| 89969 | 90326 | *(int*)pOut = -1; |
| 89970 | 90327 | } |
| 89971 | 90328 | break; |
| 89972 | 90329 | } |
| | @@ -89980,22 +90337,22 @@ |
| 89980 | 90337 | int iIns = pScan->aAddrRange[ii]; |
| 89981 | 90338 | int iEnd = pScan->aAddrRange[ii+1]; |
| 89982 | 90339 | if( iIns==0 ) break; |
| 89983 | 90340 | if( iIns>0 ){ |
| 89984 | 90341 | while( iIns<=iEnd ){ |
| 89985 | | - res += p->aOp[iIns].nCycle; |
| 90342 | + res += aOp[iIns].nCycle; |
| 89986 | 90343 | iIns++; |
| 89987 | 90344 | } |
| 89988 | 90345 | }else{ |
| 89989 | 90346 | int iOp; |
| 89990 | | - for(iOp=0; iOp<p->nOp; iOp++){ |
| 89991 | | - Op *pOp = &p->aOp[iOp]; |
| 90347 | + for(iOp=0; iOp<nOp; iOp++){ |
| 90348 | + Op *pOp = &aOp[iOp]; |
| 89992 | 90349 | if( pOp->p1!=iEnd ) continue; |
| 89993 | 90350 | if( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_NCYCLE)==0 ){ |
| 89994 | 90351 | continue; |
| 89995 | 90352 | } |
| 89996 | | - res += p->aOp[iOp].nCycle; |
| 90353 | + res += aOp[iOp].nCycle; |
| 89997 | 90354 | } |
| 89998 | 90355 | } |
| 89999 | 90356 | } |
| 90000 | 90357 | } |
| 90001 | 90358 | *(i64*)pOut = res; |
| | @@ -90914,11 +91271,14 @@ |
| 90914 | 91271 | if( p->flags & (MEM_Int|MEM_IntReal) ){ |
| 90915 | 91272 | h += p->u.i; |
| 90916 | 91273 | }else if( p->flags & MEM_Real ){ |
| 90917 | 91274 | h += sqlite3VdbeIntValue(p); |
| 90918 | 91275 | }else if( p->flags & (MEM_Str|MEM_Blob) ){ |
| 90919 | | - /* no-op */ |
| 91276 | + /* All strings have the same hash and all blobs have the same hash, |
| 91277 | + ** though, at least, those hashes are different from each other and |
| 91278 | + ** from NULL. */ |
| 91279 | + h += 4093 + (p->flags & (MEM_Str|MEM_Blob)); |
| 90920 | 91280 | } |
| 90921 | 91281 | } |
| 90922 | 91282 | return h; |
| 90923 | 91283 | } |
| 90924 | 91284 | |
| | @@ -90964,10 +91324,11 @@ |
| 90964 | 91324 | Mem *pIn2 = 0; /* 2nd input operand */ |
| 90965 | 91325 | Mem *pIn3 = 0; /* 3rd input operand */ |
| 90966 | 91326 | Mem *pOut = 0; /* Output operand */ |
| 90967 | 91327 | #if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE) |
| 90968 | 91328 | u64 *pnCycle = 0; |
| 91329 | + int bStmtScanStatus = IS_STMT_SCANSTATUS(db)!=0; |
| 90969 | 91330 | #endif |
| 90970 | 91331 | /*** INSERT STACK UNION HERE ***/ |
| 90971 | 91332 | |
| 90972 | 91333 | assert( p->eVdbeState==VDBE_RUN_STATE ); /* sqlite3_step() verifies this */ |
| 90973 | 91334 | if( DbMaskNonZero(p->lockMask) ){ |
| | @@ -91028,17 +91389,21 @@ |
| 91028 | 91389 | ** jumps to abort_due_to_error. */ |
| 91029 | 91390 | assert( rc==SQLITE_OK ); |
| 91030 | 91391 | |
| 91031 | 91392 | assert( pOp>=aOp && pOp<&aOp[p->nOp]); |
| 91032 | 91393 | nVmStep++; |
| 91033 | | -#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || defined(VDBE_PROFILE) |
| 91394 | + |
| 91395 | +#if defined(VDBE_PROFILE) |
| 91034 | 91396 | pOp->nExec++; |
| 91035 | 91397 | pnCycle = &pOp->nCycle; |
| 91036 | | -# ifdef VDBE_PROFILE |
| 91037 | | - if( sqlite3NProfileCnt==0 ) |
| 91038 | | -# endif |
| 91398 | + if( sqlite3NProfileCnt==0 ) *pnCycle -= sqlite3Hwtime(); |
| 91399 | +#elif defined(SQLITE_ENABLE_STMT_SCANSTATUS) |
| 91400 | + if( bStmtScanStatus ){ |
| 91401 | + pOp->nExec++; |
| 91402 | + pnCycle = &pOp->nCycle; |
| 91039 | 91403 | *pnCycle -= sqlite3Hwtime(); |
| 91404 | + } |
| 91040 | 91405 | #endif |
| 91041 | 91406 | |
| 91042 | 91407 | /* Only allow tracing if SQLITE_DEBUG is defined. |
| 91043 | 91408 | */ |
| 91044 | 91409 | #ifdef SQLITE_DEBUG |
| | @@ -92848,10 +93213,16 @@ |
| 92848 | 93213 | ** from the value in that register. |
| 92849 | 93214 | ** |
| 92850 | 93215 | ** P5 is a bitmask of data types. SQLITE_INTEGER is the least significant |
| 92851 | 93216 | ** (0x01) bit. SQLITE_FLOAT is the 0x02 bit. SQLITE_TEXT is 0x04. |
| 92852 | 93217 | ** SQLITE_BLOB is 0x08. SQLITE_NULL is 0x10. |
| 93218 | +** |
| 93219 | +** WARNING: This opcode does not reliably distinguish between NULL and REAL |
| 93220 | +** when P1>=0. If the database contains a NaN value, this opcode will think |
| 93221 | +** that the datatype is REAL when it should be NULL. When P1<0 and the value |
| 93222 | +** is already stored in register P3, then this opcode does reliably |
| 93223 | +** distinguish between NULL and REAL. The problem only arises then P1>=0. |
| 92853 | 93224 | ** |
| 92854 | 93225 | ** Take the jump to address P2 if and only if the datatype of the |
| 92855 | 93226 | ** value determined by P1 and P3 corresponds to one of the bits in the |
| 92856 | 93227 | ** P5 bitmask. |
| 92857 | 93228 | ** |
| | @@ -95196,10 +95567,11 @@ |
| 95196 | 95567 | #endif |
| 95197 | 95568 | VdbeBranchTaken(0,3); |
| 95198 | 95569 | break; |
| 95199 | 95570 | } |
| 95200 | 95571 | nStep--; |
| 95572 | + pC->cacheStatus = CACHE_STALE; |
| 95201 | 95573 | rc = sqlite3BtreeNext(pC->uc.pCursor, 0); |
| 95202 | 95574 | if( rc ){ |
| 95203 | 95575 | if( rc==SQLITE_DONE ){ |
| 95204 | 95576 | rc = SQLITE_OK; |
| 95205 | 95577 | goto seekscan_search_fail; |
| | @@ -97848,10 +98220,11 @@ |
| 97848 | 98220 | sqlite3VdbeError(p, "%s", sqlite3_value_text(pMem)); |
| 97849 | 98221 | goto abort_due_to_error; |
| 97850 | 98222 | } |
| 97851 | 98223 | sqlite3VdbeChangeEncoding(pMem, encoding); |
| 97852 | 98224 | UPDATE_MAX_BLOBSIZE(pMem); |
| 98225 | + REGISTER_TRACE((int)(pMem-aMem), pMem); |
| 97853 | 98226 | break; |
| 97854 | 98227 | } |
| 97855 | 98228 | |
| 97856 | 98229 | #ifndef SQLITE_OMIT_WAL |
| 97857 | 98230 | /* Opcode: Checkpoint P1 P2 P3 * * |
| | @@ -98986,12 +99359,14 @@ |
| 98986 | 99359 | |
| 98987 | 99360 | #if defined(VDBE_PROFILE) |
| 98988 | 99361 | *pnCycle += sqlite3NProfileCnt ? sqlite3NProfileCnt : sqlite3Hwtime(); |
| 98989 | 99362 | pnCycle = 0; |
| 98990 | 99363 | #elif defined(SQLITE_ENABLE_STMT_SCANSTATUS) |
| 98991 | | - *pnCycle += sqlite3Hwtime(); |
| 98992 | | - pnCycle = 0; |
| 99364 | + if( pnCycle ){ |
| 99365 | + *pnCycle += sqlite3Hwtime(); |
| 99366 | + pnCycle = 0; |
| 99367 | + } |
| 98993 | 99368 | #endif |
| 98994 | 99369 | |
| 98995 | 99370 | /* The following code adds nothing to the actual functionality |
| 98996 | 99371 | ** of the program. It is only here for testing and debugging. |
| 98997 | 99372 | ** On the other hand, it does burn CPU cycles every time through |
| | @@ -104013,11 +104388,12 @@ |
| 104013 | 104388 | if( pParse->pTriggerTab!=0 ){ |
| 104014 | 104389 | int op = pParse->eTriggerOp; |
| 104015 | 104390 | assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT ); |
| 104016 | 104391 | if( pParse->bReturning ){ |
| 104017 | 104392 | if( (pNC->ncFlags & NC_UBaseReg)!=0 |
| 104018 | | - && (zTab==0 || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0) |
| 104393 | + && ALWAYS(zTab==0 |
| 104394 | + || sqlite3StrICmp(zTab,pParse->pTriggerTab->zName)==0) |
| 104019 | 104395 | ){ |
| 104020 | 104396 | pExpr->iTable = op!=TK_DELETE; |
| 104021 | 104397 | pTab = pParse->pTriggerTab; |
| 104022 | 104398 | } |
| 104023 | 104399 | }else if( op!=TK_DELETE && zTab && sqlite3StrICmp("new",zTab) == 0 ){ |
| | @@ -104798,12 +105174,12 @@ |
| 104798 | 105174 | sqlite3WalkSelect(pWalker, pExpr->x.pSelect); |
| 104799 | 105175 | } |
| 104800 | 105176 | assert( pNC->nRef>=nRef ); |
| 104801 | 105177 | if( nRef!=pNC->nRef ){ |
| 104802 | 105178 | ExprSetProperty(pExpr, EP_VarSelect); |
| 104803 | | - pNC->ncFlags |= NC_VarSelect; |
| 104804 | 105179 | } |
| 105180 | + pNC->ncFlags |= NC_Subquery; |
| 104805 | 105181 | } |
| 104806 | 105182 | break; |
| 104807 | 105183 | } |
| 104808 | 105184 | case TK_VARIABLE: { |
| 104809 | 105185 | testcase( pNC->ncFlags & NC_IsCheck ); |
| | @@ -105987,15 +106363,14 @@ |
| 105987 | 106363 | if( p->pLeft && (p->pLeft->flags & EP_Collate)!=0 ){ |
| 105988 | 106364 | p = p->pLeft; |
| 105989 | 106365 | }else{ |
| 105990 | 106366 | Expr *pNext = p->pRight; |
| 105991 | 106367 | /* The Expr.x union is never used at the same time as Expr.pRight */ |
| 105992 | | - assert( ExprUseXList(p) ); |
| 105993 | | - assert( p->x.pList==0 || p->pRight==0 ); |
| 105994 | | - if( p->x.pList!=0 && !db->mallocFailed ){ |
| 106368 | + assert( !ExprUseXList(p) || p->x.pList==0 || p->pRight==0 ); |
| 106369 | + if( ExprUseXList(p) && p->x.pList!=0 && !db->mallocFailed ){ |
| 105995 | 106370 | int i; |
| 105996 | | - for(i=0; ALWAYS(i<p->x.pList->nExpr); i++){ |
| 106371 | + for(i=0; i<p->x.pList->nExpr; i++){ |
| 105997 | 106372 | if( ExprHasProperty(p->x.pList->a[i].pExpr, EP_Collate) ){ |
| 105998 | 106373 | pNext = p->x.pList->a[i].pExpr; |
| 105999 | 106374 | break; |
| 106000 | 106375 | } |
| 106001 | 106376 | } |
| | @@ -108359,11 +108734,11 @@ |
| 108359 | 108734 | |
| 108360 | 108735 | /* |
| 108361 | 108736 | ** pX is the RHS of an IN operator. If pX is a SELECT statement |
| 108362 | 108737 | ** that can be simplified to a direct table access, then return |
| 108363 | 108738 | ** a pointer to the SELECT statement. If pX is not a SELECT statement, |
| 108364 | | -** or if the SELECT statement needs to be manifested into a transient |
| 108739 | +** or if the SELECT statement needs to be materialized into a transient |
| 108365 | 108740 | ** table, then return NULL. |
| 108366 | 108741 | */ |
| 108367 | 108742 | #ifndef SQLITE_OMIT_SUBQUERY |
| 108368 | 108743 | static Select *isCandidateForInOpt(const Expr *pX){ |
| 108369 | 108744 | Select *p; |
| | @@ -108645,11 +109020,10 @@ |
| 108645 | 109020 | Expr *pLhs = sqlite3VectorFieldSubexpr(pX->pLeft, i); |
| 108646 | 109021 | Expr *pRhs = pEList->a[i].pExpr; |
| 108647 | 109022 | CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs); |
| 108648 | 109023 | int j; |
| 108649 | 109024 | |
| 108650 | | - assert( pReq!=0 || pRhs->iColumn==XN_ROWID || pParse->nErr ); |
| 108651 | 109025 | for(j=0; j<nExpr; j++){ |
| 108652 | 109026 | if( pIdx->aiColumn[j]!=pRhs->iColumn ) continue; |
| 108653 | 109027 | assert( pIdx->azColl[j] ); |
| 108654 | 109028 | if( pReq!=0 && sqlite3StrICmp(pReq->zName, pIdx->azColl[j])!=0 ){ |
| 108655 | 109029 | continue; |
| | @@ -109548,10 +109922,11 @@ |
| 109548 | 109922 | Column *pCol, /* The generated column */ |
| 109549 | 109923 | int regOut /* Put the result in this register */ |
| 109550 | 109924 | ){ |
| 109551 | 109925 | int iAddr; |
| 109552 | 109926 | Vdbe *v = pParse->pVdbe; |
| 109927 | + int nErr = pParse->nErr; |
| 109553 | 109928 | assert( v!=0 ); |
| 109554 | 109929 | assert( pParse->iSelfTab!=0 ); |
| 109555 | 109930 | if( pParse->iSelfTab>0 ){ |
| 109556 | 109931 | iAddr = sqlite3VdbeAddOp3(v, OP_IfNullRow, pParse->iSelfTab-1, 0, regOut); |
| 109557 | 109932 | }else{ |
| | @@ -109560,10 +109935,11 @@ |
| 109560 | 109935 | sqlite3ExprCodeCopy(pParse, sqlite3ColumnExpr(pTab,pCol), regOut); |
| 109561 | 109936 | if( pCol->affinity>=SQLITE_AFF_TEXT ){ |
| 109562 | 109937 | sqlite3VdbeAddOp4(v, OP_Affinity, regOut, 1, 0, &pCol->affinity, 1); |
| 109563 | 109938 | } |
| 109564 | 109939 | if( iAddr ) sqlite3VdbeJumpHere(v, iAddr); |
| 109940 | + if( pParse->nErr>nErr ) pParse->db->errByteOffset = -1; |
| 109565 | 109941 | } |
| 109566 | 109942 | #endif /* SQLITE_OMIT_GENERATED_COLUMNS */ |
| 109567 | 109943 | |
| 109568 | 109944 | /* |
| 109569 | 109945 | ** Generate code to extract the value of the iCol-th column of a table. |
| | @@ -109576,10 +109952,11 @@ |
| 109576 | 109952 | int regOut /* Extract the value into this register */ |
| 109577 | 109953 | ){ |
| 109578 | 109954 | Column *pCol; |
| 109579 | 109955 | assert( v!=0 ); |
| 109580 | 109956 | assert( pTab!=0 ); |
| 109957 | + assert( iCol!=XN_EXPR ); |
| 109581 | 109958 | if( iCol<0 || iCol==pTab->iPKey ){ |
| 109582 | 109959 | sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut); |
| 109583 | 109960 | VdbeComment((v, "%s.rowid", pTab->zName)); |
| 109584 | 109961 | }else{ |
| 109585 | 109962 | int op; |
| | @@ -109928,11 +110305,23 @@ |
| 109928 | 110305 | switch( op ){ |
| 109929 | 110306 | case TK_AGG_COLUMN: { |
| 109930 | 110307 | AggInfo *pAggInfo = pExpr->pAggInfo; |
| 109931 | 110308 | struct AggInfo_col *pCol; |
| 109932 | 110309 | assert( pAggInfo!=0 ); |
| 109933 | | - assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn ); |
| 110310 | + assert( pExpr->iAgg>=0 ); |
| 110311 | + if( pExpr->iAgg>=pAggInfo->nColumn ){ |
| 110312 | + /* Happens when the left table of a RIGHT JOIN is null and |
| 110313 | + ** is using an expression index */ |
| 110314 | + sqlite3VdbeAddOp2(v, OP_Null, 0, target); |
| 110315 | +#ifdef SQLITE_VDBE_COVERAGE |
| 110316 | + /* Verify that the OP_Null above is exercised by tests |
| 110317 | + ** tag-20230325-2 */ |
| 110318 | + sqlite3VdbeAddOp2(v, OP_NotNull, target, 1); |
| 110319 | + VdbeCoverageNeverTaken(v); |
| 110320 | +#endif |
| 110321 | + break; |
| 110322 | + } |
| 109934 | 110323 | pCol = &pAggInfo->aCol[pExpr->iAgg]; |
| 109935 | 110324 | if( !pAggInfo->directMode ){ |
| 109936 | 110325 | return AggInfoColumnReg(pAggInfo, pExpr->iAgg); |
| 109937 | 110326 | }else if( pAggInfo->useSortingIdx ){ |
| 109938 | 110327 | Table *pTab = pCol->pTab; |
| | @@ -110103,15 +110492,12 @@ |
| 110103 | 110492 | return pExpr->iTable; |
| 110104 | 110493 | } |
| 110105 | 110494 | #ifndef SQLITE_OMIT_CAST |
| 110106 | 110495 | case TK_CAST: { |
| 110107 | 110496 | /* Expressions of the form: CAST(pLeft AS token) */ |
| 110108 | | - inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target); |
| 110109 | | - if( inReg!=target ){ |
| 110110 | | - sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target); |
| 110111 | | - inReg = target; |
| 110112 | | - } |
| 110497 | + sqlite3ExprCode(pParse, pExpr->pLeft, target); |
| 110498 | + assert( inReg==target ); |
| 110113 | 110499 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 110114 | 110500 | sqlite3VdbeAddOp2(v, OP_Cast, target, |
| 110115 | 110501 | sqlite3AffinityType(pExpr->u.zToken, 0)); |
| 110116 | 110502 | return inReg; |
| 110117 | 110503 | } |
| | @@ -110446,17 +110832,13 @@ |
| 110446 | 110832 | ** "SOFT-COLLATE" that is added to constraints that are pushed down |
| 110447 | 110833 | ** from outer queries into sub-queries by the push-down optimization. |
| 110448 | 110834 | ** Clear subtypes as subtypes may not cross a subquery boundary. |
| 110449 | 110835 | */ |
| 110450 | 110836 | assert( pExpr->pLeft ); |
| 110451 | | - inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target); |
| 110452 | | - if( inReg!=target ){ |
| 110453 | | - sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target); |
| 110454 | | - inReg = target; |
| 110455 | | - } |
| 110456 | | - sqlite3VdbeAddOp1(v, OP_ClrSubtype, inReg); |
| 110457 | | - return inReg; |
| 110837 | + sqlite3ExprCode(pParse, pExpr->pLeft, target); |
| 110838 | + sqlite3VdbeAddOp1(v, OP_ClrSubtype, target); |
| 110839 | + return target; |
| 110458 | 110840 | }else{ |
| 110459 | 110841 | pExpr = pExpr->pLeft; |
| 110460 | 110842 | goto expr_code_doover; /* 2018-04-28: Prevent deep recursion. */ |
| 110461 | 110843 | } |
| 110462 | 110844 | } |
| | @@ -110562,16 +110944,13 @@ |
| 110562 | 110944 | ** (1) Temporarily disable factoring of constant expressions |
| 110563 | 110945 | ** (2) Make sure the computed value really is stored in register |
| 110564 | 110946 | ** "target" and not someplace else. |
| 110565 | 110947 | */ |
| 110566 | 110948 | pParse->okConstFactor = 0; /* note (1) above */ |
| 110567 | | - inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target); |
| 110949 | + sqlite3ExprCode(pParse, pExpr->pLeft, target); |
| 110950 | + assert( target==inReg ); |
| 110568 | 110951 | pParse->okConstFactor = okConstFactor; |
| 110569 | | - if( inReg!=target ){ /* note (2) above */ |
| 110570 | | - sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target); |
| 110571 | | - inReg = target; |
| 110572 | | - } |
| 110573 | 110952 | sqlite3VdbeJumpHere(v, addrINR); |
| 110574 | 110953 | break; |
| 110575 | 110954 | } |
| 110576 | 110955 | |
| 110577 | 110956 | /* |
| | @@ -110805,11 +111184,13 @@ |
| 110805 | 111184 | assert( pParse->pVdbe!=0 || pParse->db->mallocFailed ); |
| 110806 | 111185 | if( pParse->pVdbe==0 ) return; |
| 110807 | 111186 | inReg = sqlite3ExprCodeTarget(pParse, pExpr, target); |
| 110808 | 111187 | if( inReg!=target ){ |
| 110809 | 111188 | u8 op; |
| 110810 | | - if( ALWAYS(pExpr) && ExprHasProperty(pExpr,EP_Subquery) ){ |
| 111189 | + if( ALWAYS(pExpr) |
| 111190 | + && (ExprHasProperty(pExpr,EP_Subquery) || pExpr->op==TK_REGISTER) |
| 111191 | + ){ |
| 110811 | 111192 | op = OP_Copy; |
| 110812 | 111193 | }else{ |
| 110813 | 111194 | op = OP_SCopy; |
| 110814 | 111195 | } |
| 110815 | 111196 | sqlite3VdbeAddOp2(pParse->pVdbe, op, inReg, target); |
| | @@ -111990,23 +112371,26 @@ |
| 111990 | 112371 | ){ |
| 111991 | 112372 | AggInfo *pAggInfo = pExpr->pAggInfo; |
| 111992 | 112373 | int iAgg = pExpr->iAgg; |
| 111993 | 112374 | Parse *pParse = pWalker->pParse; |
| 111994 | 112375 | sqlite3 *db = pParse->db; |
| 112376 | + assert( iAgg>=0 ); |
| 111995 | 112377 | if( pExpr->op!=TK_AGG_FUNCTION ){ |
| 111996 | | - assert( iAgg>=0 && iAgg<pAggInfo->nColumn ); |
| 111997 | | - if( pAggInfo->aCol[iAgg].pCExpr==pExpr ){ |
| 112378 | + if( ALWAYS(iAgg<pAggInfo->nColumn) |
| 112379 | + && pAggInfo->aCol[iAgg].pCExpr==pExpr |
| 112380 | + ){ |
| 111998 | 112381 | pExpr = sqlite3ExprDup(db, pExpr, 0); |
| 111999 | 112382 | if( pExpr ){ |
| 112000 | 112383 | pAggInfo->aCol[iAgg].pCExpr = pExpr; |
| 112001 | 112384 | sqlite3ExprDeferredDelete(pParse, pExpr); |
| 112002 | 112385 | } |
| 112003 | 112386 | } |
| 112004 | 112387 | }else{ |
| 112005 | 112388 | assert( pExpr->op==TK_AGG_FUNCTION ); |
| 112006 | | - assert( iAgg>=0 && iAgg<pAggInfo->nFunc ); |
| 112007 | | - if( pAggInfo->aFunc[iAgg].pFExpr==pExpr ){ |
| 112389 | + if( ALWAYS(iAgg<pAggInfo->nFunc) |
| 112390 | + && pAggInfo->aFunc[iAgg].pFExpr==pExpr |
| 112391 | + ){ |
| 112008 | 112392 | pExpr = sqlite3ExprDup(db, pExpr, 0); |
| 112009 | 112393 | if( pExpr ){ |
| 112010 | 112394 | pAggInfo->aFunc[iAgg].pFExpr = pExpr; |
| 112011 | 112395 | sqlite3ExprDeferredDelete(pParse, pExpr); |
| 112012 | 112396 | } |
| | @@ -112152,11 +112536,16 @@ |
| 112152 | 112536 | if( iDataCur<0 ) continue; |
| 112153 | 112537 | if( sqlite3ExprCompare(0, pExpr, pIEpr->pExpr, iDataCur)==0 ) break; |
| 112154 | 112538 | } |
| 112155 | 112539 | if( pIEpr==0 ) break; |
| 112156 | 112540 | if( NEVER(!ExprUseYTab(pExpr)) ) break; |
| 112157 | | - if( pExpr->pAggInfo!=0 ) break; /* Already resolved by outer context */ |
| 112541 | + for(i=0; i<pSrcList->nSrc; i++){ |
| 112542 | + if( pSrcList->a[0].iCursor==pIEpr->iDataCur ) break; |
| 112543 | + } |
| 112544 | + if( i>=pSrcList->nSrc ) break; |
| 112545 | + if( NEVER(pExpr->pAggInfo!=0) ) break; /* Resolved by outer context */ |
| 112546 | + if( pParse->nErr ){ return WRC_Abort; } |
| 112158 | 112547 | |
| 112159 | 112548 | /* If we reach this point, it means that expression pExpr can be |
| 112160 | 112549 | ** translated into a reference to an index column as described by |
| 112161 | 112550 | ** pIEpr. |
| 112162 | 112551 | */ |
| | @@ -112163,10 +112552,13 @@ |
| 112163 | 112552 | memset(&tmp, 0, sizeof(tmp)); |
| 112164 | 112553 | tmp.op = TK_AGG_COLUMN; |
| 112165 | 112554 | tmp.iTable = pIEpr->iIdxCur; |
| 112166 | 112555 | tmp.iColumn = pIEpr->iIdxCol; |
| 112167 | 112556 | findOrCreateAggInfoColumn(pParse, pAggInfo, &tmp); |
| 112557 | + if( pParse->nErr ){ return WRC_Abort; } |
| 112558 | + assert( pAggInfo->aCol!=0 ); |
| 112559 | + assert( tmp.iAgg<pAggInfo->nColumn ); |
| 112168 | 112560 | pAggInfo->aCol[tmp.iAgg].pCExpr = pExpr; |
| 112169 | 112561 | pExpr->pAggInfo = pAggInfo; |
| 112170 | 112562 | pExpr->iAgg = tmp.iAgg; |
| 112171 | 112563 | return WRC_Prune; |
| 112172 | 112564 | } |
| | @@ -112339,10 +112731,41 @@ |
| 112339 | 112731 | SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse *pParse){ |
| 112340 | 112732 | pParse->nTempReg = 0; |
| 112341 | 112733 | pParse->nRangeReg = 0; |
| 112342 | 112734 | } |
| 112343 | 112735 | |
| 112736 | +/* |
| 112737 | +** Make sure sufficient registers have been allocated so that |
| 112738 | +** iReg is a valid register number. |
| 112739 | +*/ |
| 112740 | +SQLITE_PRIVATE void sqlite3TouchRegister(Parse *pParse, int iReg){ |
| 112741 | + if( pParse->nMem<iReg ) pParse->nMem = iReg; |
| 112742 | +} |
| 112743 | + |
| 112744 | +#if defined(SQLITE_ENABLE_STAT4) || defined(SQLITE_DEBUG) |
| 112745 | +/* |
| 112746 | +** Return the latest reusable register in the set of all registers. |
| 112747 | +** The value returned is no less than iMin. If any register iMin or |
| 112748 | +** greater is in permanent use, then return one more than that last |
| 112749 | +** permanent register. |
| 112750 | +*/ |
| 112751 | +SQLITE_PRIVATE int sqlite3FirstAvailableRegister(Parse *pParse, int iMin){ |
| 112752 | + const ExprList *pList = pParse->pConstExpr; |
| 112753 | + if( pList ){ |
| 112754 | + int i; |
| 112755 | + for(i=0; i<pList->nExpr; i++){ |
| 112756 | + if( pList->a[i].u.iConstExprReg>=iMin ){ |
| 112757 | + iMin = pList->a[i].u.iConstExprReg + 1; |
| 112758 | + } |
| 112759 | + } |
| 112760 | + } |
| 112761 | + pParse->nTempReg = 0; |
| 112762 | + pParse->nRangeReg = 0; |
| 112763 | + return iMin; |
| 112764 | +} |
| 112765 | +#endif /* SQLITE_ENABLE_STAT4 || SQLITE_DEBUG */ |
| 112766 | + |
| 112344 | 112767 | /* |
| 112345 | 112768 | ** Validate that no temporary register falls within the range of |
| 112346 | 112769 | ** iFirst..iLast, inclusive. This routine is only call from within assert() |
| 112347 | 112770 | ** statements. |
| 112348 | 112771 | */ |
| | @@ -112357,10 +112780,18 @@ |
| 112357 | 112780 | } |
| 112358 | 112781 | for(i=0; i<pParse->nTempReg; i++){ |
| 112359 | 112782 | if( pParse->aTempReg[i]>=iFirst && pParse->aTempReg[i]<=iLast ){ |
| 112360 | 112783 | return 0; |
| 112361 | 112784 | } |
| 112785 | + } |
| 112786 | + if( pParse->pConstExpr ){ |
| 112787 | + ExprList *pList = pParse->pConstExpr; |
| 112788 | + for(i=0; i<pList->nExpr; i++){ |
| 112789 | + int iReg = pList->a[i].u.iConstExprReg; |
| 112790 | + if( iReg==0 ) continue; |
| 112791 | + if( iReg>=iFirst && iReg<=iLast ) return 0; |
| 112792 | + } |
| 112362 | 112793 | } |
| 112363 | 112794 | return 1; |
| 112364 | 112795 | } |
| 112365 | 112796 | #endif /* SQLITE_DEBUG */ |
| 112366 | 112797 | |
| | @@ -115641,15 +116072,19 @@ |
| 115641 | 116072 | int regTemp2 = iMem++; /* Second temporary use register */ |
| 115642 | 116073 | int regTabname = iMem++; /* Register containing table name */ |
| 115643 | 116074 | int regIdxname = iMem++; /* Register containing index name */ |
| 115644 | 116075 | int regStat1 = iMem++; /* Value for the stat column of sqlite_stat1 */ |
| 115645 | 116076 | int regPrev = iMem; /* MUST BE LAST (see below) */ |
| 116077 | +#ifdef SQLITE_ENABLE_STAT4 |
| 116078 | + int doOnce = 1; /* Flag for a one-time computation */ |
| 116079 | +#endif |
| 115646 | 116080 | #ifdef SQLITE_ENABLE_PREUPDATE_HOOK |
| 115647 | 116081 | Table *pStat1 = 0; |
| 115648 | 116082 | #endif |
| 115649 | 116083 | |
| 115650 | | - pParse->nMem = MAX(pParse->nMem, iMem); |
| 116084 | + sqlite3TouchRegister(pParse, iMem); |
| 116085 | + assert( sqlite3NoTempsInRange(pParse, regNewRowid, iMem) ); |
| 115651 | 116086 | v = sqlite3GetVdbe(pParse); |
| 115652 | 116087 | if( v==0 || NEVER(pTab==0) ){ |
| 115653 | 116088 | return; |
| 115654 | 116089 | } |
| 115655 | 116090 | if( !IsOrdinaryTable(pTab) ){ |
| | @@ -115751,11 +116186,11 @@ |
| 115751 | 116186 | |
| 115752 | 116187 | /* Make sure there are enough memory cells allocated to accommodate |
| 115753 | 116188 | ** the regPrev array and a trailing rowid (the rowid slot is required |
| 115754 | 116189 | ** when building a record to insert into the sample column of |
| 115755 | 116190 | ** the sqlite_stat4 table. */ |
| 115756 | | - pParse->nMem = MAX(pParse->nMem, regPrev+nColTest); |
| 116191 | + sqlite3TouchRegister(pParse, regPrev+nColTest); |
| 115757 | 116192 | |
| 115758 | 116193 | /* Open a read-only cursor on the index being analyzed. */ |
| 115759 | 116194 | assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) ); |
| 115760 | 116195 | sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb); |
| 115761 | 116196 | sqlite3VdbeSetP4KeyInfo(pParse, pIdx); |
| | @@ -115923,11 +116358,39 @@ |
| 115923 | 116358 | int regSampleRowid = regCol + nCol; |
| 115924 | 116359 | int addrNext; |
| 115925 | 116360 | int addrIsNull; |
| 115926 | 116361 | u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound; |
| 115927 | 116362 | |
| 115928 | | - pParse->nMem = MAX(pParse->nMem, regCol+nCol); |
| 116363 | + if( doOnce ){ |
| 116364 | + int mxCol = nCol; |
| 116365 | + Index *pX; |
| 116366 | + |
| 116367 | + /* Compute the maximum number of columns in any index */ |
| 116368 | + for(pX=pTab->pIndex; pX; pX=pX->pNext){ |
| 116369 | + int nColX; /* Number of columns in pX */ |
| 116370 | + if( !HasRowid(pTab) && IsPrimaryKeyIndex(pX) ){ |
| 116371 | + nColX = pX->nKeyCol; |
| 116372 | + }else{ |
| 116373 | + nColX = pX->nColumn; |
| 116374 | + } |
| 116375 | + if( nColX>mxCol ) mxCol = nColX; |
| 116376 | + } |
| 116377 | + |
| 116378 | + /* Allocate space to compute results for the largest index */ |
| 116379 | + sqlite3TouchRegister(pParse, regCol+mxCol); |
| 116380 | + doOnce = 0; |
| 116381 | +#ifdef SQLITE_DEBUG |
| 116382 | + /* Verify that the call to sqlite3ClearTempRegCache() below |
| 116383 | + ** really is needed. |
| 116384 | + ** https://sqlite.org/forum/forumpost/83cb4a95a0 (2023-03-25) |
| 116385 | + */ |
| 116386 | + testcase( !sqlite3NoTempsInRange(pParse, regEq, regCol+mxCol) ); |
| 116387 | +#endif |
| 116388 | + sqlite3ClearTempRegCache(pParse); /* tag-20230325-1 */ |
| 116389 | + assert( sqlite3NoTempsInRange(pParse, regEq, regCol+mxCol) ); |
| 116390 | + } |
| 116391 | + assert( sqlite3NoTempsInRange(pParse, regEq, regCol+nCol) ); |
| 115929 | 116392 | |
| 115930 | 116393 | addrNext = sqlite3VdbeCurrentAddr(v); |
| 115931 | 116394 | callStatGet(pParse, regStat, STAT_GET_ROWID, regSampleRowid); |
| 115932 | 116395 | addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regSampleRowid); |
| 115933 | 116396 | VdbeCoverage(v); |
| | @@ -116004,10 +116467,15 @@ |
| 116004 | 116467 | iTab = pParse->nTab; |
| 116005 | 116468 | assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); |
| 116006 | 116469 | for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){ |
| 116007 | 116470 | Table *pTab = (Table*)sqliteHashData(k); |
| 116008 | 116471 | analyzeOneTable(pParse, pTab, 0, iStatCur, iMem, iTab); |
| 116472 | +#ifdef SQLITE_ENABLE_STAT4 |
| 116473 | + iMem = sqlite3FirstAvailableRegister(pParse, iMem); |
| 116474 | +#else |
| 116475 | + assert( iMem==sqlite3FirstAvailableRegister(pParse,iMem) ); |
| 116476 | +#endif |
| 116009 | 116477 | } |
| 116010 | 116478 | loadAnalysis(pParse, iDb); |
| 116011 | 116479 | } |
| 116012 | 116480 | |
| 116013 | 116481 | /* |
| | @@ -118931,11 +119399,11 @@ |
| 118931 | 119399 | Hash *pHash; |
| 118932 | 119400 | sqlite3 *db = pParse->db; |
| 118933 | 119401 | if( pParse->pNewTrigger ){ |
| 118934 | 119402 | sqlite3ErrorMsg(pParse, "cannot use RETURNING in a trigger"); |
| 118935 | 119403 | }else{ |
| 118936 | | - assert( pParse->bReturning==0 ); |
| 119404 | + assert( pParse->bReturning==0 || pParse->ifNotExists ); |
| 118937 | 119405 | } |
| 118938 | 119406 | pParse->bReturning = 1; |
| 118939 | 119407 | pRet = sqlite3DbMallocZero(db, sizeof(*pRet)); |
| 118940 | 119408 | if( pRet==0 ){ |
| 118941 | 119409 | sqlite3ExprListDelete(db, pList); |
| | @@ -118957,11 +119425,12 @@ |
| 118957 | 119425 | pRet->retTrig.step_list = &pRet->retTStep; |
| 118958 | 119426 | pRet->retTStep.op = TK_RETURNING; |
| 118959 | 119427 | pRet->retTStep.pTrig = &pRet->retTrig; |
| 118960 | 119428 | pRet->retTStep.pExprList = pList; |
| 118961 | 119429 | pHash = &(db->aDb[1].pSchema->trigHash); |
| 118962 | | - assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 || pParse->nErr ); |
| 119430 | + assert( sqlite3HashFind(pHash, RETURNING_TRIGGER_NAME)==0 |
| 119431 | + || pParse->nErr || pParse->ifNotExists ); |
| 118963 | 119432 | if( sqlite3HashInsert(pHash, RETURNING_TRIGGER_NAME, &pRet->retTrig) |
| 118964 | 119433 | ==&pRet->retTrig ){ |
| 118965 | 119434 | sqlite3OomFault(db); |
| 118966 | 119435 | } |
| 118967 | 119436 | } |
| | @@ -123830,17 +124299,19 @@ |
| 123830 | 124299 | ** |
| 123831 | 124300 | ** If pTab is not writable -> generate an error message and return 1. |
| 123832 | 124301 | ** If pTab is writable but other errors have occurred -> return 1. |
| 123833 | 124302 | ** If pTab is writable and no prior errors -> return 0; |
| 123834 | 124303 | */ |
| 123835 | | -SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){ |
| 124304 | +SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, Trigger *pTrigger){ |
| 123836 | 124305 | if( tabIsReadOnly(pParse, pTab) ){ |
| 123837 | 124306 | sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName); |
| 123838 | 124307 | return 1; |
| 123839 | 124308 | } |
| 123840 | 124309 | #ifndef SQLITE_OMIT_VIEW |
| 123841 | | - if( !viewOk && IsView(pTab) ){ |
| 124310 | + if( IsView(pTab) |
| 124311 | + && (pTrigger==0 || (pTrigger->bReturning && pTrigger->pNext==0)) |
| 124312 | + ){ |
| 123842 | 124313 | sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName); |
| 123843 | 124314 | return 1; |
| 123844 | 124315 | } |
| 123845 | 124316 | #endif |
| 123846 | 124317 | return 0; |
| | @@ -124090,11 +124561,11 @@ |
| 124090 | 124561 | */ |
| 124091 | 124562 | if( sqlite3ViewGetColumnNames(pParse, pTab) ){ |
| 124092 | 124563 | goto delete_from_cleanup; |
| 124093 | 124564 | } |
| 124094 | 124565 | |
| 124095 | | - if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){ |
| 124566 | + if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){ |
| 124096 | 124567 | goto delete_from_cleanup; |
| 124097 | 124568 | } |
| 124098 | 124569 | iDb = sqlite3SchemaToIndex(db, pTab->pSchema); |
| 124099 | 124570 | assert( iDb<db->nDb ); |
| 124100 | 124571 | rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, |
| | @@ -124199,11 +124670,11 @@ |
| 124199 | 124670 | } |
| 124200 | 124671 | }else |
| 124201 | 124672 | #endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */ |
| 124202 | 124673 | { |
| 124203 | 124674 | u16 wcf = WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK; |
| 124204 | | - if( sNC.ncFlags & NC_VarSelect ) bComplex = 1; |
| 124675 | + if( sNC.ncFlags & NC_Subquery ) bComplex = 1; |
| 124205 | 124676 | wcf |= (bComplex ? 0 : WHERE_ONEPASS_MULTIROW); |
| 124206 | 124677 | if( HasRowid(pTab) ){ |
| 124207 | 124678 | /* For a rowid table, initialize the RowSet to an empty set */ |
| 124208 | 124679 | pPk = 0; |
| 124209 | 124680 | nPk = 1; |
| | @@ -128787,49 +129258,51 @@ |
| 128787 | 129258 | ** |
| 128788 | 129259 | ** Memory for the buffer containing the column index affinity string |
| 128789 | 129260 | ** is managed along with the rest of the Index structure. It will be |
| 128790 | 129261 | ** released when sqlite3DeleteIndex() is called. |
| 128791 | 129262 | */ |
| 128792 | | -SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){ |
| 128793 | | - if( !pIdx->zColAff ){ |
| 128794 | | - /* The first time a column affinity string for a particular index is |
| 128795 | | - ** required, it is allocated and populated here. It is then stored as |
| 128796 | | - ** a member of the Index structure for subsequent use. |
| 128797 | | - ** |
| 128798 | | - ** The column affinity string will eventually be deleted by |
| 128799 | | - ** sqliteDeleteIndex() when the Index structure itself is cleaned |
| 128800 | | - ** up. |
| 128801 | | - */ |
| 128802 | | - int n; |
| 128803 | | - Table *pTab = pIdx->pTable; |
| 128804 | | - pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1); |
| 128805 | | - if( !pIdx->zColAff ){ |
| 128806 | | - sqlite3OomFault(db); |
| 128807 | | - return 0; |
| 128808 | | - } |
| 128809 | | - for(n=0; n<pIdx->nColumn; n++){ |
| 128810 | | - i16 x = pIdx->aiColumn[n]; |
| 128811 | | - char aff; |
| 128812 | | - if( x>=0 ){ |
| 128813 | | - aff = pTab->aCol[x].affinity; |
| 128814 | | - }else if( x==XN_ROWID ){ |
| 128815 | | - aff = SQLITE_AFF_INTEGER; |
| 128816 | | - }else{ |
| 128817 | | - assert( x==XN_EXPR ); |
| 128818 | | - assert( pIdx->bHasExpr ); |
| 128819 | | - assert( pIdx->aColExpr!=0 ); |
| 128820 | | - aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr); |
| 128821 | | - } |
| 128822 | | - if( aff<SQLITE_AFF_BLOB ) aff = SQLITE_AFF_BLOB; |
| 128823 | | - if( aff>SQLITE_AFF_NUMERIC) aff = SQLITE_AFF_NUMERIC; |
| 128824 | | - pIdx->zColAff[n] = aff; |
| 128825 | | - } |
| 128826 | | - pIdx->zColAff[n] = 0; |
| 128827 | | - } |
| 128828 | | - |
| 129263 | +static SQLITE_NOINLINE const char *computeIndexAffStr(sqlite3 *db, Index *pIdx){ |
| 129264 | + /* The first time a column affinity string for a particular index is |
| 129265 | + ** required, it is allocated and populated here. It is then stored as |
| 129266 | + ** a member of the Index structure for subsequent use. |
| 129267 | + ** |
| 129268 | + ** The column affinity string will eventually be deleted by |
| 129269 | + ** sqliteDeleteIndex() when the Index structure itself is cleaned |
| 129270 | + ** up. |
| 129271 | + */ |
| 129272 | + int n; |
| 129273 | + Table *pTab = pIdx->pTable; |
| 129274 | + pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1); |
| 129275 | + if( !pIdx->zColAff ){ |
| 129276 | + sqlite3OomFault(db); |
| 129277 | + return 0; |
| 129278 | + } |
| 129279 | + for(n=0; n<pIdx->nColumn; n++){ |
| 129280 | + i16 x = pIdx->aiColumn[n]; |
| 129281 | + char aff; |
| 129282 | + if( x>=0 ){ |
| 129283 | + aff = pTab->aCol[x].affinity; |
| 129284 | + }else if( x==XN_ROWID ){ |
| 129285 | + aff = SQLITE_AFF_INTEGER; |
| 129286 | + }else{ |
| 129287 | + assert( x==XN_EXPR ); |
| 129288 | + assert( pIdx->bHasExpr ); |
| 129289 | + assert( pIdx->aColExpr!=0 ); |
| 129290 | + aff = sqlite3ExprAffinity(pIdx->aColExpr->a[n].pExpr); |
| 129291 | + } |
| 129292 | + if( aff<SQLITE_AFF_BLOB ) aff = SQLITE_AFF_BLOB; |
| 129293 | + if( aff>SQLITE_AFF_NUMERIC) aff = SQLITE_AFF_NUMERIC; |
| 129294 | + pIdx->zColAff[n] = aff; |
| 129295 | + } |
| 129296 | + pIdx->zColAff[n] = 0; |
| 129297 | + return pIdx->zColAff; |
| 129298 | +} |
| 129299 | +SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){ |
| 129300 | + if( !pIdx->zColAff ) return computeIndexAffStr(db, pIdx); |
| 128829 | 129301 | return pIdx->zColAff; |
| 128830 | 129302 | } |
| 129303 | + |
| 128831 | 129304 | |
| 128832 | 129305 | /* |
| 128833 | 129306 | ** Compute an affinity string for a table. Space is obtained |
| 128834 | 129307 | ** from sqlite3DbMalloc(). The caller is responsible for freeing |
| 128835 | 129308 | ** the space when done. |
| | @@ -129511,11 +129984,11 @@ |
| 129511 | 129984 | goto insert_cleanup; |
| 129512 | 129985 | } |
| 129513 | 129986 | |
| 129514 | 129987 | /* Cannot insert into a read-only table. |
| 129515 | 129988 | */ |
| 129516 | | - if( sqlite3IsReadOnly(pParse, pTab, tmask) ){ |
| 129989 | + if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){ |
| 129517 | 129990 | goto insert_cleanup; |
| 129518 | 129991 | } |
| 129519 | 129992 | |
| 129520 | 129993 | /* Allocate a VDBE |
| 129521 | 129994 | */ |
| | @@ -129958,11 +130431,11 @@ |
| 129958 | 130431 | sqlite3VdbeJumpHere(v, addr1); |
| 129959 | 130432 | sqlite3VdbeAddOp1(v, OP_MustBeInt, regCols); VdbeCoverage(v); |
| 129960 | 130433 | } |
| 129961 | 130434 | |
| 129962 | 130435 | /* Copy the new data already generated. */ |
| 129963 | | - assert( pTab->nNVCol>0 ); |
| 130436 | + assert( pTab->nNVCol>0 || pParse->nErr>0 ); |
| 129964 | 130437 | sqlite3VdbeAddOp3(v, OP_Copy, regRowid+1, regCols+1, pTab->nNVCol-1); |
| 129965 | 130438 | |
| 129966 | 130439 | #ifndef SQLITE_OMIT_GENERATED_COLUMNS |
| 129967 | 130440 | /* Compute the new value for generated columns after all other |
| 129968 | 130441 | ** columns have already been computed. This must be done after |
| | @@ -133321,19 +133794,25 @@ |
| 133321 | 133794 | zEntry = zProc ? zProc : "sqlite3_extension_init"; |
| 133322 | 133795 | |
| 133323 | 133796 | /* tag-20210611-1. Some dlopen() implementations will segfault if given |
| 133324 | 133797 | ** an oversize filename. Most filesystems have a pathname limit of 4K, |
| 133325 | 133798 | ** so limit the extension filename length to about twice that. |
| 133326 | | - ** https://sqlite.org/forum/forumpost/08a0d6d9bf */ |
| 133799 | + ** https://sqlite.org/forum/forumpost/08a0d6d9bf |
| 133800 | + ** |
| 133801 | + ** Later (2023-03-25): Save an extra 6 bytes for the filename suffix. |
| 133802 | + ** See https://sqlite.org/forum/forumpost/24083b579d. |
| 133803 | + */ |
| 133327 | 133804 | if( nMsg>SQLITE_MAX_PATHLEN ) goto extension_not_found; |
| 133328 | 133805 | |
| 133329 | 133806 | handle = sqlite3OsDlOpen(pVfs, zFile); |
| 133330 | 133807 | #if SQLITE_OS_UNIX || SQLITE_OS_WIN |
| 133331 | 133808 | for(ii=0; ii<ArraySize(azEndings) && handle==0; ii++){ |
| 133332 | 133809 | char *zAltFile = sqlite3_mprintf("%s.%s", zFile, azEndings[ii]); |
| 133333 | 133810 | if( zAltFile==0 ) return SQLITE_NOMEM_BKPT; |
| 133334 | | - handle = sqlite3OsDlOpen(pVfs, zAltFile); |
| 133811 | + if( nMsg+strlen(azEndings[ii])+1<=SQLITE_MAX_PATHLEN ){ |
| 133812 | + handle = sqlite3OsDlOpen(pVfs, zAltFile); |
| 133813 | + } |
| 133335 | 133814 | sqlite3_free(zAltFile); |
| 133336 | 133815 | } |
| 133337 | 133816 | #endif |
| 133338 | 133817 | if( handle==0 ) goto extension_not_found; |
| 133339 | 133818 | xInit = (sqlite3_loadext_entry)sqlite3OsDlSym(pVfs, handle, zEntry); |
| | @@ -135824,11 +136303,11 @@ |
| 135824 | 136303 | if( pTab==0 || !IsOrdinaryTable(pTab) || pTab->u.tab.pFKey==0 ) continue; |
| 135825 | 136304 | iDb = sqlite3SchemaToIndex(db, pTab->pSchema); |
| 135826 | 136305 | zDb = db->aDb[iDb].zDbSName; |
| 135827 | 136306 | sqlite3CodeVerifySchema(pParse, iDb); |
| 135828 | 136307 | sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); |
| 135829 | | - if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow; |
| 136308 | + sqlite3TouchRegister(pParse, pTab->nCol+regRow); |
| 135830 | 136309 | sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead); |
| 135831 | 136310 | sqlite3VdbeLoadString(v, regResult, pTab->zName); |
| 135832 | 136311 | assert( IsOrdinaryTable(pTab) ); |
| 135833 | 136312 | for(i=1, pFK=pTab->u.tab.pFKey; pFK; i++, pFK=pFK->pNextFrom){ |
| 135834 | 136313 | pParent = sqlite3FindTable(db, pFK->zTo, zDb); |
| | @@ -135865,11 +136344,11 @@ |
| 135865 | 136344 | |
| 135866 | 136345 | /* Generate code to read the child key values into registers |
| 135867 | 136346 | ** regRow..regRow+n. If any of the child key values are NULL, this |
| 135868 | 136347 | ** row cannot cause an FK violation. Jump directly to addrOk in |
| 135869 | 136348 | ** this case. */ |
| 135870 | | - if( regRow+pFK->nCol>pParse->nMem ) pParse->nMem = regRow+pFK->nCol; |
| 136349 | + sqlite3TouchRegister(pParse, regRow + pFK->nCol); |
| 135871 | 136350 | for(j=0; j<pFK->nCol; j++){ |
| 135872 | 136351 | int iCol = aiCols ? aiCols[j] : pFK->aCol[j].iFrom; |
| 135873 | 136352 | sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, iCol, regRow+j); |
| 135874 | 136353 | sqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk); VdbeCoverage(v); |
| 135875 | 136354 | } |
| | @@ -135994,10 +136473,11 @@ |
| 135994 | 136473 | |
| 135995 | 136474 | if( OMIT_TEMPDB && i==1 ) continue; |
| 135996 | 136475 | if( iDb>=0 && i!=iDb ) continue; |
| 135997 | 136476 | |
| 135998 | 136477 | sqlite3CodeVerifySchema(pParse, i); |
| 136478 | + pParse->okConstFactor = 0; /* tag-20230327-1 */ |
| 135999 | 136479 | |
| 136000 | 136480 | /* Do an integrity check of the B-Tree |
| 136001 | 136481 | ** |
| 136002 | 136482 | ** Begin by finding the root pages numbers |
| 136003 | 136483 | ** for all tables and indices in the database. |
| | @@ -136029,11 +136509,11 @@ |
| 136029 | 136509 | } |
| 136030 | 136510 | } |
| 136031 | 136511 | aRoot[0] = cnt; |
| 136032 | 136512 | |
| 136033 | 136513 | /* Make sure sufficient number of registers have been allocated */ |
| 136034 | | - pParse->nMem = MAX( pParse->nMem, 8+mxIdx ); |
| 136514 | + sqlite3TouchRegister(pParse, 8+mxIdx); |
| 136035 | 136515 | sqlite3ClearTempRegCache(pParse); |
| 136036 | 136516 | |
| 136037 | 136517 | /* Do the b-tree integrity checks */ |
| 136038 | 136518 | sqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY); |
| 136039 | 136519 | sqlite3VdbeChangeP5(v, (u8)i); |
| | @@ -136179,19 +136659,33 @@ |
| 136179 | 136659 | |
| 136180 | 136660 | labelError = sqlite3VdbeMakeLabel(pParse); |
| 136181 | 136661 | labelOk = sqlite3VdbeMakeLabel(pParse); |
| 136182 | 136662 | if( pCol->notNull ){ |
| 136183 | 136663 | /* (1) NOT NULL columns may not contain a NULL */ |
| 136664 | + int jmp3; |
| 136184 | 136665 | int jmp2 = sqlite3VdbeAddOp4Int(v, OP_IsType, p1, labelOk, p3, p4); |
| 136185 | | - sqlite3VdbeChangeP5(v, 0x0f); |
| 136186 | 136666 | VdbeCoverage(v); |
| 136667 | + if( p1<0 ){ |
| 136668 | + sqlite3VdbeChangeP5(v, 0x0f); /* INT, REAL, TEXT, or BLOB */ |
| 136669 | + jmp3 = jmp2; |
| 136670 | + }else{ |
| 136671 | + sqlite3VdbeChangeP5(v, 0x0d); /* INT, TEXT, or BLOB */ |
| 136672 | + /* OP_IsType does not detect NaN values in the database file |
| 136673 | + ** which should be treated as a NULL. So if the header type |
| 136674 | + ** is REAL, we have to load the actual data using OP_Column |
| 136675 | + ** to reliably determine if the value is a NULL. */ |
| 136676 | + sqlite3VdbeAddOp3(v, OP_Column, p1, p3, 3); |
| 136677 | + jmp3 = sqlite3VdbeAddOp2(v, OP_NotNull, 3, labelOk); |
| 136678 | + VdbeCoverage(v); |
| 136679 | + } |
| 136187 | 136680 | zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName, |
| 136188 | 136681 | pCol->zCnName); |
| 136189 | 136682 | sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC); |
| 136190 | 136683 | if( doTypeCheck ){ |
| 136191 | 136684 | sqlite3VdbeGoto(v, labelError); |
| 136192 | 136685 | sqlite3VdbeJumpHere(v, jmp2); |
| 136686 | + sqlite3VdbeJumpHere(v, jmp3); |
| 136193 | 136687 | }else{ |
| 136194 | 136688 | /* VDBE byte code will fall thru */ |
| 136195 | 136689 | } |
| 136196 | 136690 | } |
| 136197 | 136691 | if( bStrict && doTypeCheck ){ |
| | @@ -136295,11 +136789,11 @@ |
| 136295 | 136789 | ** any extra bytes at the end. Verify that this is the case. */ |
| 136296 | 136790 | if( HasRowid(pTab) ){ |
| 136297 | 136791 | int jmp7; |
| 136298 | 136792 | sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur+j, 3); |
| 136299 | 136793 | jmp7 = sqlite3VdbeAddOp3(v, OP_Eq, 3, 0, r1+pIdx->nColumn-1); |
| 136300 | | - VdbeCoverage(v); |
| 136794 | + VdbeCoverageNeverNull(v); |
| 136301 | 136795 | sqlite3VdbeLoadString(v, 3, |
| 136302 | 136796 | "rowid not at end-of-record for row "); |
| 136303 | 136797 | sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3); |
| 136304 | 136798 | sqlite3VdbeLoadString(v, 4, " of index "); |
| 136305 | 136799 | sqlite3VdbeGoto(v, jmp5-1); |
| | @@ -142129,11 +142623,13 @@ |
| 142129 | 142623 | assert( pExpr->pRight==0 ); |
| 142130 | 142624 | if( sqlite3ExprIsVector(pCopy) ){ |
| 142131 | 142625 | sqlite3VectorErrorMsg(pSubst->pParse, pCopy); |
| 142132 | 142626 | }else{ |
| 142133 | 142627 | sqlite3 *db = pSubst->pParse->db; |
| 142134 | | - if( pSubst->isOuterJoin ){ |
| 142628 | + if( pSubst->isOuterJoin |
| 142629 | + && (pCopy->op!=TK_COLUMN || pCopy->iTable!=pSubst->iNewTable) |
| 142630 | + ){ |
| 142135 | 142631 | memset(&ifNullRow, 0, sizeof(ifNullRow)); |
| 142136 | 142632 | ifNullRow.op = TK_IF_NULL_ROW; |
| 142137 | 142633 | ifNullRow.pLeft = pCopy; |
| 142138 | 142634 | ifNullRow.iTable = pSubst->iNewTable; |
| 142139 | 142635 | ifNullRow.iColumn = -99; |
| | @@ -142506,12 +143002,11 @@ |
| 142506 | 143002 | ** (17f) the subquery must not be the RHS of a LEFT JOIN. |
| 142507 | 143003 | ** (17g) either the subquery is the first element of the outer |
| 142508 | 143004 | ** query or there are no RIGHT or FULL JOINs in any arm |
| 142509 | 143005 | ** of the subquery. (This is a duplicate of condition (27b).) |
| 142510 | 143006 | ** (17h) The corresponding result set expressions in all arms of the |
| 142511 | | -** compound must have the same affinity. (See restriction (9) |
| 142512 | | -** on the push-down optimization.) |
| 143007 | +** compound must have the same affinity. |
| 142513 | 143008 | ** |
| 142514 | 143009 | ** The parent and sub-query may contain WHERE clauses. Subject to |
| 142515 | 143010 | ** rules (11), (13) and (14), they may also contain ORDER BY, |
| 142516 | 143011 | ** LIMIT and OFFSET clauses. The subquery cannot use any compound |
| 142517 | 143012 | ** operator other than UNION ALL because all the other compound |
| | @@ -143375,14 +143870,10 @@ |
| 143375 | 143870 | ** |
| 143376 | 143871 | ** (8) If the subquery is a compound that uses UNION, INTERSECT, |
| 143377 | 143872 | ** or EXCEPT, then all of the result set columns for all arms of |
| 143378 | 143873 | ** the compound must use the BINARY collating sequence. |
| 143379 | 143874 | ** |
| 143380 | | -** (9) If the subquery is a compound, then all arms of the compound must |
| 143381 | | -** have the same affinity. (This is the same as restriction (17h) |
| 143382 | | -** for query flattening.) |
| 143383 | | -** |
| 143384 | 143875 | ** |
| 143385 | 143876 | ** Return 0 if no changes are made and non-zero if one or more WHERE clause |
| 143386 | 143877 | ** terms are duplicated into the subquery. |
| 143387 | 143878 | */ |
| 143388 | 143879 | static int pushDownWhereTerms( |
| | @@ -143409,13 +143900,10 @@ |
| 143409 | 143900 | } |
| 143410 | 143901 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 143411 | 143902 | if( pSel->pWin ) return 0; /* restriction (6b) */ |
| 143412 | 143903 | #endif |
| 143413 | 143904 | } |
| 143414 | | - if( compoundHasDifferentAffinities(pSubq) ){ |
| 143415 | | - return 0; /* restriction (9) */ |
| 143416 | | - } |
| 143417 | 143905 | if( notUnionAll ){ |
| 143418 | 143906 | /* If any of the compound arms are connected using UNION, INTERSECT, |
| 143419 | 143907 | ** or EXCEPT, then we must ensure that none of the columns use a |
| 143420 | 143908 | ** non-BINARY collating sequence. */ |
| 143421 | 143909 | for(pSel=pSubq; pSel; pSel=pSel->pPrior){ |
| | @@ -143502,10 +143990,80 @@ |
| 143502 | 143990 | } |
| 143503 | 143991 | } |
| 143504 | 143992 | return nChng; |
| 143505 | 143993 | } |
| 143506 | 143994 | #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */ |
| 143995 | + |
| 143996 | +/* |
| 143997 | +** Check to see if a subquery contains result-set columns that are |
| 143998 | +** never used. If it does, change the value of those result-set columns |
| 143999 | +** to NULL so that they do not cause unnecessary work to compute. |
| 144000 | +** |
| 144001 | +** Return the number of column that were changed to NULL. |
| 144002 | +*/ |
| 144003 | +static int disableUnusedSubqueryResultColumns(SrcItem *pItem){ |
| 144004 | + int nCol; |
| 144005 | + Select *pSub; /* The subquery to be simplified */ |
| 144006 | + Select *pX; /* For looping over compound elements of pSub */ |
| 144007 | + Table *pTab; /* The table that describes the subquery */ |
| 144008 | + int j; /* Column number */ |
| 144009 | + int nChng = 0; /* Number of columns converted to NULL */ |
| 144010 | + Bitmask colUsed; /* Columns that may not be NULLed out */ |
| 144011 | + |
| 144012 | + assert( pItem!=0 ); |
| 144013 | + if( pItem->fg.isCorrelated || pItem->fg.isCte ){ |
| 144014 | + return 0; |
| 144015 | + } |
| 144016 | + assert( pItem->pTab!=0 ); |
| 144017 | + pTab = pItem->pTab; |
| 144018 | + assert( pItem->pSelect!=0 ); |
| 144019 | + pSub = pItem->pSelect; |
| 144020 | + assert( pSub->pEList->nExpr==pTab->nCol ); |
| 144021 | + if( (pSub->selFlags & (SF_Distinct|SF_Aggregate))!=0 ){ |
| 144022 | + testcase( pSub->selFlags & SF_Distinct ); |
| 144023 | + testcase( pSub->selFlags & SF_Aggregate ); |
| 144024 | + return 0; |
| 144025 | + } |
| 144026 | + for(pX=pSub; pX; pX=pX->pPrior){ |
| 144027 | + if( pX->pPrior && pX->op!=TK_ALL ){ |
| 144028 | + /* This optimization does not work for compound subqueries that |
| 144029 | + ** use UNION, INTERSECT, or EXCEPT. Only UNION ALL is allowed. */ |
| 144030 | + return 0; |
| 144031 | + } |
| 144032 | + if( pX->pWin ){ |
| 144033 | + /* This optimization does not work for subqueries that use window |
| 144034 | + ** functions. */ |
| 144035 | + return 0; |
| 144036 | + } |
| 144037 | + } |
| 144038 | + colUsed = pItem->colUsed; |
| 144039 | + if( pSub->pOrderBy ){ |
| 144040 | + ExprList *pList = pSub->pOrderBy; |
| 144041 | + for(j=0; j<pList->nExpr; j++){ |
| 144042 | + u16 iCol = pList->a[j].u.x.iOrderByCol; |
| 144043 | + if( iCol>0 ){ |
| 144044 | + iCol--; |
| 144045 | + colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol); |
| 144046 | + } |
| 144047 | + } |
| 144048 | + } |
| 144049 | + nCol = pTab->nCol; |
| 144050 | + for(j=0; j<nCol; j++){ |
| 144051 | + Bitmask m = j<BMS-1 ? MASKBIT(j) : TOPBIT; |
| 144052 | + if( (m & colUsed)!=0 ) continue; |
| 144053 | + for(pX=pSub; pX; pX=pX->pPrior) { |
| 144054 | + Expr *pY = pX->pEList->a[j].pExpr; |
| 144055 | + if( pY->op==TK_NULL ) continue; |
| 144056 | + pY->op = TK_NULL; |
| 144057 | + ExprClearProperty(pY, EP_Skip|EP_Unlikely); |
| 144058 | + pX->selFlags |= SF_PushDown; |
| 144059 | + nChng++; |
| 144060 | + } |
| 144061 | + } |
| 144062 | + return nChng; |
| 144063 | +} |
| 144064 | + |
| 143507 | 144065 | |
| 143508 | 144066 | /* |
| 143509 | 144067 | ** The pFunc is the only aggregate function in the query. Check to see |
| 143510 | 144068 | ** if the query is a candidate for the min/max optimization. |
| 143511 | 144069 | ** |
| | @@ -144688,15 +145246,17 @@ |
| 144688 | 145246 | if( pExpr->pAggInfo==0 ) return WRC_Continue; |
| 144689 | 145247 | if( pExpr->op==TK_AGG_COLUMN ) return WRC_Continue; |
| 144690 | 145248 | if( pExpr->op==TK_AGG_FUNCTION ) return WRC_Continue; |
| 144691 | 145249 | if( pExpr->op==TK_IF_NULL_ROW ) return WRC_Continue; |
| 144692 | 145250 | pAggInfo = pExpr->pAggInfo; |
| 144693 | | - assert( pExpr->iAgg>=0 && pExpr->iAgg<pAggInfo->nColumn ); |
| 145251 | + if( NEVER(pExpr->iAgg>=pAggInfo->nColumn) ) return WRC_Continue; |
| 145252 | + assert( pExpr->iAgg>=0 ); |
| 144694 | 145253 | pCol = &pAggInfo->aCol[pExpr->iAgg]; |
| 144695 | 145254 | pExpr->op = TK_AGG_COLUMN; |
| 144696 | 145255 | pExpr->iTable = pCol->iTable; |
| 144697 | 145256 | pExpr->iColumn = pCol->iColumn; |
| 145257 | + ExprClearProperty(pExpr, EP_Skip|EP_Collate); |
| 144698 | 145258 | return WRC_Prune; |
| 144699 | 145259 | } |
| 144700 | 145260 | |
| 144701 | 145261 | /* |
| 144702 | 145262 | ** Convert every pAggInfo->aFunc[].pExpr such that any node within |
| | @@ -145046,11 +145606,10 @@ |
| 145046 | 145606 | sqlite3DbFree(db, p->aCol); |
| 145047 | 145607 | sqlite3DbFree(db, p->aFunc); |
| 145048 | 145608 | sqlite3DbFreeNN(db, p); |
| 145049 | 145609 | } |
| 145050 | 145610 | |
| 145051 | | -#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION |
| 145052 | 145611 | /* |
| 145053 | 145612 | ** Attempt to transform a query of the form |
| 145054 | 145613 | ** |
| 145055 | 145614 | ** SELECT count(*) FROM (SELECT x FROM t1 UNION ALL SELECT y FROM t2) |
| 145056 | 145615 | ** |
| | @@ -145074,10 +145633,11 @@ |
| 145074 | 145633 | Expr *pCount; |
| 145075 | 145634 | sqlite3 *db; |
| 145076 | 145635 | if( (p->selFlags & SF_Aggregate)==0 ) return 0; /* This is an aggregate */ |
| 145077 | 145636 | if( p->pEList->nExpr!=1 ) return 0; /* Single result column */ |
| 145078 | 145637 | if( p->pWhere ) return 0; |
| 145638 | + if( p->pHaving ) return 0; |
| 145079 | 145639 | if( p->pGroupBy ) return 0; |
| 145080 | 145640 | if( p->pOrderBy ) return 0; |
| 145081 | 145641 | pExpr = p->pEList->a[0].pExpr; |
| 145082 | 145642 | if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */ |
| 145083 | 145643 | assert( ExprUseUToken(pExpr) ); |
| | @@ -145093,11 +145653,12 @@ |
| 145093 | 145653 | do{ |
| 145094 | 145654 | if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */ |
| 145095 | 145655 | if( pSub->pWhere ) return 0; /* No WHERE clause */ |
| 145096 | 145656 | if( pSub->pLimit ) return 0; /* No LIMIT clause */ |
| 145097 | 145657 | if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */ |
| 145098 | | - pSub = pSub->pPrior; /* Repeat over compound */ |
| 145658 | + assert( pSub->pHaving==0 ); /* Due to the previous */ |
| 145659 | + pSub = pSub->pPrior; /* Repeat over compound */ |
| 145099 | 145660 | }while( pSub ); |
| 145100 | 145661 | |
| 145101 | 145662 | /* If we reach this point then it is OK to perform the transformation */ |
| 145102 | 145663 | |
| 145103 | 145664 | db = pParse->db; |
| | @@ -145136,11 +145697,10 @@ |
| 145136 | 145697 | sqlite3TreeViewSelect(0, p, 0); |
| 145137 | 145698 | } |
| 145138 | 145699 | #endif |
| 145139 | 145700 | return 1; |
| 145140 | 145701 | } |
| 145141 | | -#endif /* SQLITE_COUNTOFVIEW_OPTIMIZATION */ |
| 145142 | 145702 | |
| 145143 | 145703 | /* |
| 145144 | 145704 | ** If any term of pSrc, or any SF_NestedFrom sub-query, is not the same |
| 145145 | 145705 | ** as pSrcItem but has the same alias as p0, then return true. |
| 145146 | 145706 | ** Otherwise return false. |
| | @@ -145525,18 +146085,16 @@ |
| 145525 | 146085 | #endif |
| 145526 | 146086 | }else{ |
| 145527 | 146087 | TREETRACE(0x2000,pParse,p,("Constant propagation not helpful\n")); |
| 145528 | 146088 | } |
| 145529 | 146089 | |
| 145530 | | -#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION |
| 145531 | 146090 | if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView) |
| 145532 | 146091 | && countOfViewOptimization(pParse, p) |
| 145533 | 146092 | ){ |
| 145534 | 146093 | if( db->mallocFailed ) goto select_end; |
| 145535 | 146094 | pTabList = p->pSrc; |
| 145536 | 146095 | } |
| 145537 | | -#endif |
| 145538 | 146096 | |
| 145539 | 146097 | /* For each term in the FROM clause, do two things: |
| 145540 | 146098 | ** (1) Authorized unreferenced tables |
| 145541 | 146099 | ** (2) Generate code for all sub-queries |
| 145542 | 146100 | */ |
| | @@ -145604,10 +146162,26 @@ |
| 145604 | 146162 | #endif |
| 145605 | 146163 | assert( pItem->pSelect && (pItem->pSelect->selFlags & SF_PushDown)!=0 ); |
| 145606 | 146164 | }else{ |
| 145607 | 146165 | TREETRACE(0x4000,pParse,p,("Push-down not possible\n")); |
| 145608 | 146166 | } |
| 146167 | + |
| 146168 | + /* Convert unused result columns of the subquery into simple NULL |
| 146169 | + ** expressions, to avoid unneeded searching and computation. |
| 146170 | + */ |
| 146171 | + if( OptimizationEnabled(db, SQLITE_NullUnusedCols) |
| 146172 | + && disableUnusedSubqueryResultColumns(pItem) |
| 146173 | + ){ |
| 146174 | +#if TREETRACE_ENABLED |
| 146175 | + if( sqlite3TreeTrace & 0x4000 ){ |
| 146176 | + TREETRACE(0x4000,pParse,p, |
| 146177 | + ("Change unused result columns to NULL for subquery %d:\n", |
| 146178 | + pSub->selId)); |
| 146179 | + sqlite3TreeViewSelect(0, p, 0); |
| 146180 | + } |
| 146181 | +#endif |
| 146182 | + } |
| 145609 | 146183 | |
| 145610 | 146184 | zSavedAuthContext = pParse->zAuthContext; |
| 145611 | 146185 | pParse->zAuthContext = pItem->zName; |
| 145612 | 146186 | |
| 145613 | 146187 | /* Generate code to implement the subquery |
| | @@ -146891,10 +147465,11 @@ |
| 146891 | 147465 | if( !noErr ){ |
| 146892 | 147466 | sqlite3ErrorMsg(pParse, "trigger %T already exists", pName); |
| 146893 | 147467 | }else{ |
| 146894 | 147468 | assert( !db->init.busy ); |
| 146895 | 147469 | sqlite3CodeVerifySchema(pParse, iDb); |
| 147470 | + VVA_ONLY( pParse->ifNotExists = 1; ) |
| 146896 | 147471 | } |
| 146897 | 147472 | goto trigger_cleanup; |
| 146898 | 147473 | } |
| 146899 | 147474 | } |
| 146900 | 147475 | |
| | @@ -148141,10 +148716,13 @@ |
| 148141 | 148716 | const int op = pChanges ? TK_UPDATE : TK_DELETE; |
| 148142 | 148717 | u32 mask = 0; |
| 148143 | 148718 | Trigger *p; |
| 148144 | 148719 | |
| 148145 | 148720 | assert( isNew==1 || isNew==0 ); |
| 148721 | + if( IsView(pTab) ){ |
| 148722 | + return 0xffffffff; |
| 148723 | + } |
| 148146 | 148724 | for(p=pTrigger; p; p=p->pNext){ |
| 148147 | 148725 | if( p->op==op |
| 148148 | 148726 | && (tr_tm&p->tr_tm) |
| 148149 | 148727 | && checkColumnOverlap(p->pColumns,pChanges) |
| 148150 | 148728 | ){ |
| | @@ -148575,11 +149153,11 @@ |
| 148575 | 149153 | #endif |
| 148576 | 149154 | |
| 148577 | 149155 | if( sqlite3ViewGetColumnNames(pParse, pTab) ){ |
| 148578 | 149156 | goto update_cleanup; |
| 148579 | 149157 | } |
| 148580 | | - if( sqlite3IsReadOnly(pParse, pTab, tmask) ){ |
| 149158 | + if( sqlite3IsReadOnly(pParse, pTab, pTrigger) ){ |
| 148581 | 149159 | goto update_cleanup; |
| 148582 | 149160 | } |
| 148583 | 149161 | |
| 148584 | 149162 | /* Allocate a cursors for the main database table and for all indices. |
| 148585 | 149163 | ** The index cursors might not be used, but if they are used they |
| | @@ -148894,16 +149472,26 @@ |
| 148894 | 149472 | bFinishSeek = 0; |
| 148895 | 149473 | }else{ |
| 148896 | 149474 | /* Begin the database scan. |
| 148897 | 149475 | ** |
| 148898 | 149476 | ** Do not consider a single-pass strategy for a multi-row update if |
| 148899 | | - ** there are any triggers or foreign keys to process, or rows may |
| 148900 | | - ** be deleted as a result of REPLACE conflict handling. Any of these |
| 148901 | | - ** things might disturb a cursor being used to scan through the table |
| 148902 | | - ** or index, causing a single-pass approach to malfunction. */ |
| 149477 | + ** there is anything that might disrupt the cursor being used to do |
| 149478 | + ** the UPDATE: |
| 149479 | + ** (1) This is a nested UPDATE |
| 149480 | + ** (2) There are triggers |
| 149481 | + ** (3) There are FOREIGN KEY constraints |
| 149482 | + ** (4) There are REPLACE conflict handlers |
| 149483 | + ** (5) There are subqueries in the WHERE clause |
| 149484 | + */ |
| 148903 | 149485 | flags = WHERE_ONEPASS_DESIRED; |
| 148904 | | - if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){ |
| 149486 | + if( !pParse->nested |
| 149487 | + && !pTrigger |
| 149488 | + && !hasFK |
| 149489 | + && !chngKey |
| 149490 | + && !bReplace |
| 149491 | + && (sNC.ncFlags & NC_Subquery)==0 |
| 149492 | + ){ |
| 148905 | 149493 | flags |= WHERE_ONEPASS_MULTIROW; |
| 148906 | 149494 | } |
| 148907 | 149495 | pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere,0,0,0,flags,iIdxCur); |
| 148908 | 149496 | if( pWInfo==0 ) goto update_cleanup; |
| 148909 | 149497 | |
| | @@ -150864,11 +151452,13 @@ |
| 150864 | 151452 | sCtx.pTab = pTab; |
| 150865 | 151453 | sCtx.pVTable = pVTable; |
| 150866 | 151454 | sCtx.pPrior = db->pVtabCtx; |
| 150867 | 151455 | sCtx.bDeclared = 0; |
| 150868 | 151456 | db->pVtabCtx = &sCtx; |
| 151457 | + pTab->nTabRef++; |
| 150869 | 151458 | rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr); |
| 151459 | + sqlite3DeleteTable(db, pTab); |
| 150870 | 151460 | db->pVtabCtx = sCtx.pPrior; |
| 150871 | 151461 | if( rc==SQLITE_NOMEM ) sqlite3OomFault(db); |
| 150872 | 151462 | assert( sCtx.pTab==pTab ); |
| 150873 | 151463 | |
| 150874 | 151464 | if( SQLITE_OK!=rc ){ |
| | @@ -151582,10 +152172,14 @@ |
| 151582 | 152172 | break; |
| 151583 | 152173 | } |
| 151584 | 152174 | case SQLITE_VTAB_DIRECTONLY: { |
| 151585 | 152175 | p->pVTable->eVtabRisk = SQLITE_VTABRISK_High; |
| 151586 | 152176 | break; |
| 152177 | + } |
| 152178 | + case SQLITE_VTAB_USES_ALL_SCHEMAS: { |
| 152179 | + p->pVTable->bAllSchemas = 1; |
| 152180 | + break; |
| 151587 | 152181 | } |
| 151588 | 152182 | default: { |
| 151589 | 152183 | rc = SQLITE_MISUSE_BKPT; |
| 151590 | 152184 | break; |
| 151591 | 152185 | } |
| | @@ -152356,13 +152950,13 @@ |
| 152356 | 152950 | sqlite3_str_append(pStr, ")", 1); |
| 152357 | 152951 | } |
| 152358 | 152952 | |
| 152359 | 152953 | /* |
| 152360 | 152954 | ** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN |
| 152361 | | -** command, or if either SQLITE_DEBUG or SQLITE_ENABLE_STMT_SCANSTATUS was |
| 152362 | | -** defined at compile-time. If it is not a no-op, a single OP_Explain opcode |
| 152363 | | -** is added to the output to describe the table scan strategy in pLevel. |
| 152955 | +** command, or if stmt_scanstatus_v2() stats are enabled, or if SQLITE_DEBUG |
| 152956 | +** was defined at compile-time. If it is not a no-op, a single OP_Explain |
| 152957 | +** opcode is added to the output to describe the table scan strategy in pLevel. |
| 152364 | 152958 | ** |
| 152365 | 152959 | ** If an OP_Explain opcode is added to the VM, its address is returned. |
| 152366 | 152960 | ** Otherwise, if no OP_Explain is coded, zero is returned. |
| 152367 | 152961 | */ |
| 152368 | 152962 | SQLITE_PRIVATE int sqlite3WhereExplainOneScan( |
| | @@ -152370,12 +152964,12 @@ |
| 152370 | 152964 | SrcList *pTabList, /* Table list this loop refers to */ |
| 152371 | 152965 | WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */ |
| 152372 | 152966 | u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */ |
| 152373 | 152967 | ){ |
| 152374 | 152968 | int ret = 0; |
| 152375 | | -#if !defined(SQLITE_DEBUG) && !defined(SQLITE_ENABLE_STMT_SCANSTATUS) |
| 152376 | | - if( sqlite3ParseToplevel(pParse)->explain==2 ) |
| 152969 | +#if !defined(SQLITE_DEBUG) |
| 152970 | + if( sqlite3ParseToplevel(pParse)->explain==2 || IS_STMT_SCANSTATUS(pParse->db) ) |
| 152377 | 152971 | #endif |
| 152378 | 152972 | { |
| 152379 | 152973 | SrcItem *pItem = &pTabList->a[pLevel->iFrom]; |
| 152380 | 152974 | Vdbe *v = pParse->pVdbe; /* VM being constructed */ |
| 152381 | 152975 | sqlite3 *db = pParse->db; /* Database handle */ |
| | @@ -152537,31 +153131,33 @@ |
| 152537 | 153131 | Vdbe *v, /* Vdbe to add scanstatus entry to */ |
| 152538 | 153132 | SrcList *pSrclist, /* FROM clause pLvl reads data from */ |
| 152539 | 153133 | WhereLevel *pLvl, /* Level to add scanstatus() entry for */ |
| 152540 | 153134 | int addrExplain /* Address of OP_Explain (or 0) */ |
| 152541 | 153135 | ){ |
| 152542 | | - const char *zObj = 0; |
| 152543 | | - WhereLoop *pLoop = pLvl->pWLoop; |
| 152544 | | - int wsFlags = pLoop->wsFlags; |
| 152545 | | - int viaCoroutine = 0; |
| 152546 | | - |
| 152547 | | - if( (wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){ |
| 152548 | | - zObj = pLoop->u.btree.pIndex->zName; |
| 152549 | | - }else{ |
| 152550 | | - zObj = pSrclist->a[pLvl->iFrom].zName; |
| 152551 | | - viaCoroutine = pSrclist->a[pLvl->iFrom].fg.viaCoroutine; |
| 152552 | | - } |
| 152553 | | - sqlite3VdbeScanStatus( |
| 152554 | | - v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj |
| 152555 | | - ); |
| 152556 | | - |
| 152557 | | - if( viaCoroutine==0 ){ |
| 152558 | | - if( (wsFlags & (WHERE_MULTI_OR|WHERE_AUTO_INDEX))==0 ){ |
| 152559 | | - sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iTabCur); |
| 152560 | | - } |
| 152561 | | - if( wsFlags & WHERE_INDEXED ){ |
| 152562 | | - sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iIdxCur); |
| 153136 | + if( IS_STMT_SCANSTATUS( sqlite3VdbeDb(v) ) ){ |
| 153137 | + const char *zObj = 0; |
| 153138 | + WhereLoop *pLoop = pLvl->pWLoop; |
| 153139 | + int wsFlags = pLoop->wsFlags; |
| 153140 | + int viaCoroutine = 0; |
| 153141 | + |
| 153142 | + if( (wsFlags & WHERE_VIRTUALTABLE)==0 && pLoop->u.btree.pIndex!=0 ){ |
| 153143 | + zObj = pLoop->u.btree.pIndex->zName; |
| 153144 | + }else{ |
| 153145 | + zObj = pSrclist->a[pLvl->iFrom].zName; |
| 153146 | + viaCoroutine = pSrclist->a[pLvl->iFrom].fg.viaCoroutine; |
| 153147 | + } |
| 153148 | + sqlite3VdbeScanStatus( |
| 153149 | + v, addrExplain, pLvl->addrBody, pLvl->addrVisit, pLoop->nOut, zObj |
| 153150 | + ); |
| 153151 | + |
| 153152 | + if( viaCoroutine==0 ){ |
| 153153 | + if( (wsFlags & (WHERE_MULTI_OR|WHERE_AUTO_INDEX))==0 ){ |
| 153154 | + sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iTabCur); |
| 153155 | + } |
| 153156 | + if( wsFlags & WHERE_INDEXED ){ |
| 153157 | + sqlite3VdbeScanStatusRange(v, addrExplain, -1, pLvl->iIdxCur); |
| 153158 | + } |
| 152563 | 153159 | } |
| 152564 | 153160 | } |
| 152565 | 153161 | } |
| 152566 | 153162 | #endif |
| 152567 | 153163 | |
| | @@ -153254,31 +153850,29 @@ |
| 153254 | 153850 | ** know because CCurHint.pIdx!=0) then transform the TK_COLUMN into |
| 153255 | 153851 | ** an access of the index rather than the original table. |
| 153256 | 153852 | */ |
| 153257 | 153853 | static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){ |
| 153258 | 153854 | int rc = WRC_Continue; |
| 153855 | + int reg; |
| 153259 | 153856 | struct CCurHint *pHint = pWalker->u.pCCurHint; |
| 153260 | 153857 | if( pExpr->op==TK_COLUMN ){ |
| 153261 | 153858 | if( pExpr->iTable!=pHint->iTabCur ){ |
| 153262 | | - int reg = ++pWalker->pParse->nMem; /* Register for column value */ |
| 153263 | | - sqlite3ExprCode(pWalker->pParse, pExpr, reg); |
| 153859 | + reg = ++pWalker->pParse->nMem; /* Register for column value */ |
| 153860 | + reg = sqlite3ExprCodeTarget(pWalker->pParse, pExpr, reg); |
| 153264 | 153861 | pExpr->op = TK_REGISTER; |
| 153265 | 153862 | pExpr->iTable = reg; |
| 153266 | 153863 | }else if( pHint->pIdx!=0 ){ |
| 153267 | 153864 | pExpr->iTable = pHint->iIdxCur; |
| 153268 | 153865 | pExpr->iColumn = sqlite3TableColumnToIndex(pHint->pIdx, pExpr->iColumn); |
| 153269 | 153866 | assert( pExpr->iColumn>=0 ); |
| 153270 | 153867 | } |
| 153271 | | - }else if( pExpr->op==TK_AGG_FUNCTION ){ |
| 153272 | | - /* An aggregate function in the WHERE clause of a query means this must |
| 153273 | | - ** be a correlated sub-query, and expression pExpr is an aggregate from |
| 153274 | | - ** the parent context. Do not walk the function arguments in this case. |
| 153275 | | - ** |
| 153276 | | - ** todo: It should be possible to replace this node with a TK_REGISTER |
| 153277 | | - ** expression, as the result of the expression must be stored in a |
| 153278 | | - ** register at this point. The same holds for TK_AGG_COLUMN nodes. */ |
| 153868 | + }else if( pExpr->pAggInfo ){ |
| 153279 | 153869 | rc = WRC_Prune; |
| 153870 | + reg = ++pWalker->pParse->nMem; /* Register for column value */ |
| 153871 | + reg = sqlite3ExprCodeTarget(pWalker->pParse, pExpr, reg); |
| 153872 | + pExpr->op = TK_REGISTER; |
| 153873 | + pExpr->iTable = reg; |
| 153280 | 153874 | } |
| 153281 | 153875 | return rc; |
| 153282 | 153876 | } |
| 153283 | 153877 | |
| 153284 | 153878 | /* |
| | @@ -154170,11 +154764,11 @@ |
| 154170 | 154764 | ** of entries in the tree, so basing the number of steps to try |
| 154171 | 154765 | ** on the estimated number of rows in the btree seems like a good |
| 154172 | 154766 | ** guess. */ |
| 154173 | 154767 | addrSeekScan = sqlite3VdbeAddOp1(v, OP_SeekScan, |
| 154174 | 154768 | (pIdx->aiRowLogEst[0]+9)/10); |
| 154175 | | - if( pRangeStart ){ |
| 154769 | + if( pRangeStart || pRangeEnd ){ |
| 154176 | 154770 | sqlite3VdbeChangeP5(v, 1); |
| 154177 | 154771 | sqlite3VdbeChangeP2(v, addrSeekScan, sqlite3VdbeCurrentAddr(v)+1); |
| 154178 | 154772 | addrSeekScan = 0; |
| 154179 | 154773 | } |
| 154180 | 154774 | VdbeCoverage(v); |
| | @@ -154211,20 +154805,11 @@ |
| 154211 | 154805 | */ |
| 154212 | 154806 | nConstraint = nEq; |
| 154213 | 154807 | assert( pLevel->p2==0 ); |
| 154214 | 154808 | if( pRangeEnd ){ |
| 154215 | 154809 | Expr *pRight = pRangeEnd->pExpr->pRight; |
| 154216 | | - if( addrSeekScan ){ |
| 154217 | | - /* For a seek-scan that has a range on the lowest term of the index, |
| 154218 | | - ** we have to make the top of the loop be code that sets the end |
| 154219 | | - ** condition of the range. Otherwise, the OP_SeekScan might jump |
| 154220 | | - ** over that initialization, leaving the range-end value set to the |
| 154221 | | - ** range-start value, resulting in a wrong answer. |
| 154222 | | - ** See ticket 5981a8c041a3c2f3 (2021-11-02). |
| 154223 | | - */ |
| 154224 | | - pLevel->p2 = sqlite3VdbeCurrentAddr(v); |
| 154225 | | - } |
| 154810 | + assert( addrSeekScan==0 ); |
| 154226 | 154811 | codeExprOrVector(pParse, pRight, regBase+nEq, nTop); |
| 154227 | 154812 | whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd); |
| 154228 | 154813 | if( (pRangeEnd->wtFlags & TERM_VNULL)==0 |
| 154229 | 154814 | && sqlite3ExprCanBeNull(pRight) |
| 154230 | 154815 | ){ |
| | @@ -154254,11 +154839,11 @@ |
| 154254 | 154839 | } |
| 154255 | 154840 | if( zStartAff ) sqlite3DbNNFreeNN(db, zStartAff); |
| 154256 | 154841 | if( zEndAff ) sqlite3DbNNFreeNN(db, zEndAff); |
| 154257 | 154842 | |
| 154258 | 154843 | /* Top of the loop body */ |
| 154259 | | - if( pLevel->p2==0 ) pLevel->p2 = sqlite3VdbeCurrentAddr(v); |
| 154844 | + pLevel->p2 = sqlite3VdbeCurrentAddr(v); |
| 154260 | 154845 | |
| 154261 | 154846 | /* Check if the index cursor is past the end of the range. */ |
| 154262 | 154847 | if( nConstraint ){ |
| 154263 | 154848 | if( regBignull ){ |
| 154264 | 154849 | /* Except, skip the end-of-range check while doing the NULL-scan */ |
| | @@ -156896,13 +157481,16 @@ |
| 156896 | 157481 | pColRef->y.pTab = pTab; |
| 156897 | 157482 | pItem->colUsed |= sqlite3ExprColUsed(pColRef); |
| 156898 | 157483 | pRhs = sqlite3PExpr(pParse, TK_UPLUS, |
| 156899 | 157484 | sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0); |
| 156900 | 157485 | pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs); |
| 156901 | | - if( pItem->fg.jointype & (JT_LEFT|JT_LTORJ|JT_RIGHT) ){ |
| 157486 | + if( pItem->fg.jointype & (JT_LEFT|JT_RIGHT) ){ |
| 157487 | + testcase( pItem->fg.jointype & JT_LEFT ); /* testtag-20230227a */ |
| 157488 | + testcase( pItem->fg.jointype & JT_RIGHT ); /* testtag-20230227b */ |
| 156902 | 157489 | joinType = EP_OuterON; |
| 156903 | 157490 | }else{ |
| 157491 | + testcase( pItem->fg.jointype & JT_LTORJ ); /* testtag-20230227c */ |
| 156904 | 157492 | joinType = EP_InnerON; |
| 156905 | 157493 | } |
| 156906 | 157494 | sqlite3SetJoinExpr(pTerm, pItem->iCursor, joinType); |
| 156907 | 157495 | whereClauseInsert(pWC, pTerm, TERM_DYNAMIC); |
| 156908 | 157496 | } |
| | @@ -157741,11 +158329,11 @@ |
| 157741 | 158329 | Parse *pParse, |
| 157742 | 158330 | Index *pIdx, /* Automatic index to explain */ |
| 157743 | 158331 | int bPartial, /* True if pIdx is a partial index */ |
| 157744 | 158332 | int *pAddrExplain /* OUT: Address of OP_Explain */ |
| 157745 | 158333 | ){ |
| 157746 | | - if( pParse->explain!=2 ){ |
| 158334 | + if( IS_STMT_SCANSTATUS(pParse->db) && pParse->explain!=2 ){ |
| 157747 | 158335 | Table *pTab = pIdx->pTable; |
| 157748 | 158336 | const char *zSep = ""; |
| 157749 | 158337 | char *zText = 0; |
| 157750 | 158338 | int ii = 0; |
| 157751 | 158339 | sqlite3_str *pStr = sqlite3_str_new(pParse->db); |
| | @@ -157802,11 +158390,12 @@ |
| 157802 | 158390 | CollSeq *pColl; /* Collating sequence to on a column */ |
| 157803 | 158391 | WhereLoop *pLoop; /* The Loop object */ |
| 157804 | 158392 | char *zNotUsed; /* Extra space on the end of pIdx */ |
| 157805 | 158393 | Bitmask idxCols; /* Bitmap of columns used for indexing */ |
| 157806 | 158394 | Bitmask extraCols; /* Bitmap of additional columns */ |
| 157807 | | - u8 sentWarning = 0; /* True if a warnning has been issued */ |
| 158395 | + u8 sentWarning = 0; /* True if a warning has been issued */ |
| 158396 | + u8 useBloomFilter = 0; /* True to also add a Bloom filter */ |
| 157808 | 158397 | Expr *pPartial = 0; /* Partial Index Expression */ |
| 157809 | 158398 | int iContinue = 0; /* Jump here to skip excluded rows */ |
| 157810 | 158399 | SrcItem *pTabItem; /* FROM clause term being indexed */ |
| 157811 | 158400 | int addrCounter = 0; /* Address where integer counter is initialized */ |
| 157812 | 158401 | int regBase; /* Array of registers where record is assembled */ |
| | @@ -157872,11 +158461,15 @@ |
| 157872 | 158461 | ** original table never needs to be accessed. Automatic indices must |
| 157873 | 158462 | ** be a covering index because the index will not be updated if the |
| 157874 | 158463 | ** original table changes and the index and table cannot both be used |
| 157875 | 158464 | ** if they go out of sync. |
| 157876 | 158465 | */ |
| 157877 | | - extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1)); |
| 158466 | + if( IsView(pTable) ){ |
| 158467 | + extraCols = ALLBITS; |
| 158468 | + }else{ |
| 158469 | + extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1)); |
| 158470 | + } |
| 157878 | 158471 | mxBitCol = MIN(BMS-1,pTable->nCol); |
| 157879 | 158472 | testcase( pTable->nCol==BMS-1 ); |
| 157880 | 158473 | testcase( pTable->nCol==BMS-2 ); |
| 157881 | 158474 | for(i=0; i<mxBitCol; i++){ |
| 157882 | 158475 | if( extraCols & MASKBIT(i) ) nKeyCol++; |
| | @@ -157908,10 +158501,20 @@ |
| 157908 | 158501 | pIdx->aiColumn[n] = pTerm->u.x.leftColumn; |
| 157909 | 158502 | pColl = sqlite3ExprCompareCollSeq(pParse, pX); |
| 157910 | 158503 | assert( pColl!=0 || pParse->nErr>0 ); /* TH3 collate01.800 */ |
| 157911 | 158504 | pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY; |
| 157912 | 158505 | n++; |
| 158506 | + if( ALWAYS(pX->pLeft!=0) |
| 158507 | + && sqlite3ExprAffinity(pX->pLeft)!=SQLITE_AFF_TEXT |
| 158508 | + ){ |
| 158509 | + /* TUNING: only use a Bloom filter on an automatic index |
| 158510 | + ** if one or more key columns has the ability to hold numeric |
| 158511 | + ** values, since strings all have the same hash in the Bloom |
| 158512 | + ** filter implementation and hence a Bloom filter on a text column |
| 158513 | + ** is not usually helpful. */ |
| 158514 | + useBloomFilter = 1; |
| 158515 | + } |
| 157913 | 158516 | } |
| 157914 | 158517 | } |
| 157915 | 158518 | } |
| 157916 | 158519 | assert( (u32)n==pLoop->u.btree.nEq ); |
| 157917 | 158520 | |
| | @@ -157940,11 +158543,12 @@ |
| 157940 | 158543 | assert( pLevel->iIdxCur>=0 ); |
| 157941 | 158544 | pLevel->iIdxCur = pParse->nTab++; |
| 157942 | 158545 | sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1); |
| 157943 | 158546 | sqlite3VdbeSetP4KeyInfo(pParse, pIdx); |
| 157944 | 158547 | VdbeComment((v, "for %s", pTable->zName)); |
| 157945 | | - if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) ){ |
| 158548 | + if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) && useBloomFilter ){ |
| 158549 | + sqlite3WhereExplainBloomFilter(pParse, pWC->pWInfo, pLevel); |
| 157946 | 158550 | pLevel->regFilter = ++pParse->nMem; |
| 157947 | 158551 | sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter); |
| 157948 | 158552 | } |
| 157949 | 158553 | |
| 157950 | 158554 | /* Fill the automatic index with content */ |
| | @@ -158033,10 +158637,14 @@ |
| 158033 | 158637 | const WhereTerm *pWCEnd; /* Last WHERE clause term */ |
| 158034 | 158638 | Parse *pParse = pWInfo->pParse; /* Parsing context */ |
| 158035 | 158639 | Vdbe *v = pParse->pVdbe; /* VDBE under construction */ |
| 158036 | 158640 | WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */ |
| 158037 | 158641 | int iCur; /* Cursor for table getting the filter */ |
| 158642 | + IndexedExpr *saved_pIdxEpr; /* saved copy of Parse.pIdxEpr */ |
| 158643 | + |
| 158644 | + saved_pIdxEpr = pParse->pIdxEpr; |
| 158645 | + pParse->pIdxEpr = 0; |
| 158038 | 158646 | |
| 158039 | 158647 | assert( pLoop!=0 ); |
| 158040 | 158648 | assert( v!=0 ); |
| 158041 | 158649 | assert( pLoop->wsFlags & WHERE_BLOOMFILTER ); |
| 158042 | 158650 | |
| | @@ -158089,13 +158697,12 @@ |
| 158089 | 158697 | Index *pIdx = pLoop->u.btree.pIndex; |
| 158090 | 158698 | int n = pLoop->u.btree.nEq; |
| 158091 | 158699 | int r1 = sqlite3GetTempRange(pParse, n); |
| 158092 | 158700 | int jj; |
| 158093 | 158701 | for(jj=0; jj<n; jj++){ |
| 158094 | | - int iCol = pIdx->aiColumn[jj]; |
| 158095 | 158702 | assert( pIdx->pTable==pItem->pTab ); |
| 158096 | | - sqlite3ExprCodeGetColumnOfTable(v, pIdx->pTable, iCur, iCol,r1+jj); |
| 158703 | + sqlite3ExprCodeLoadIndexColumn(pParse, pIdx, iCur, jj, r1+jj); |
| 158097 | 158704 | } |
| 158098 | 158705 | sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, n); |
| 158099 | 158706 | sqlite3ReleaseTempRange(pParse, r1, n); |
| 158100 | 158707 | } |
| 158101 | 158708 | sqlite3VdbeResolveLabel(v, addrCont); |
| | @@ -158122,10 +158729,11 @@ |
| 158122 | 158729 | break; |
| 158123 | 158730 | } |
| 158124 | 158731 | } |
| 158125 | 158732 | }while( iLevel < pWInfo->nLevel ); |
| 158126 | 158733 | sqlite3VdbeJumpHere(v, addrOnce); |
| 158734 | + pParse->pIdxEpr = saved_pIdxEpr; |
| 158127 | 158735 | } |
| 158128 | 158736 | |
| 158129 | 158737 | |
| 158130 | 158738 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 158131 | 158739 | /* |
| | @@ -158377,10 +158985,13 @@ |
| 158377 | 158985 | sqlite3ErrorMsg(pParse, "%s", sqlite3ErrStr(rc)); |
| 158378 | 158986 | }else{ |
| 158379 | 158987 | sqlite3ErrorMsg(pParse, "%s", pVtab->zErrMsg); |
| 158380 | 158988 | } |
| 158381 | 158989 | } |
| 158990 | + if( pTab->u.vtab.p->bAllSchemas ){ |
| 158991 | + sqlite3VtabUsesAllSchemas(pParse); |
| 158992 | + } |
| 158382 | 158993 | sqlite3_free(pVtab->zErrMsg); |
| 158383 | 158994 | pVtab->zErrMsg = 0; |
| 158384 | 158995 | return rc; |
| 158385 | 158996 | } |
| 158386 | 158997 | #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */ |
| | @@ -158420,10 +159031,11 @@ |
| 158420 | 159031 | UNUSED_PARAMETER( pParse ); |
| 158421 | 159032 | #endif |
| 158422 | 159033 | assert( pRec!=0 ); |
| 158423 | 159034 | assert( pIdx->nSample>0 ); |
| 158424 | 159035 | assert( pRec->nField>0 ); |
| 159036 | + |
| 158425 | 159037 | |
| 158426 | 159038 | /* Do a binary search to find the first sample greater than or equal |
| 158427 | 159039 | ** to pRec. If pRec contains a single field, the set of samples to search |
| 158428 | 159040 | ** is simply the aSample[] array. If the samples in aSample[] contain more |
| 158429 | 159041 | ** than one fields, all fields following the first are ignored. |
| | @@ -158465,11 +159077,16 @@ |
| 158465 | 159077 | ** appears that it should be 1 field in size. However, that would make it |
| 158466 | 159078 | ** smaller than sample 1, so the binary search would not work. As a result, |
| 158467 | 159079 | ** it is extended to two fields. The duplicates that this creates do not |
| 158468 | 159080 | ** cause any problems. |
| 158469 | 159081 | */ |
| 158470 | | - nField = MIN(pRec->nField, pIdx->nSample); |
| 159082 | + if( !HasRowid(pIdx->pTable) && IsPrimaryKeyIndex(pIdx) ){ |
| 159083 | + nField = pIdx->nKeyCol; |
| 159084 | + }else{ |
| 159085 | + nField = pIdx->nColumn; |
| 159086 | + } |
| 159087 | + nField = MIN(pRec->nField, nField); |
| 158471 | 159088 | iCol = 0; |
| 158472 | 159089 | iSample = pIdx->nSample * nField; |
| 158473 | 159090 | do{ |
| 158474 | 159091 | int iSamp; /* Index in aSample[] of test sample */ |
| 158475 | 159092 | int n; /* Number of fields in test sample */ |
| | @@ -158901,11 +159518,11 @@ |
| 158901 | 159518 | #else |
| 158902 | 159519 | UNUSED_PARAMETER(pParse); |
| 158903 | 159520 | UNUSED_PARAMETER(pBuilder); |
| 158904 | 159521 | assert( pLower || pUpper ); |
| 158905 | 159522 | #endif |
| 158906 | | - assert( pUpper==0 || (pUpper->wtFlags & TERM_VNULL)==0 ); |
| 159523 | + assert( pUpper==0 || (pUpper->wtFlags & TERM_VNULL)==0 || pParse->nErr>0 ); |
| 158907 | 159524 | nNew = whereRangeAdjust(pLower, nOut); |
| 158908 | 159525 | nNew = whereRangeAdjust(pUpper, nNew); |
| 158909 | 159526 | |
| 158910 | 159527 | /* TUNING: If there is both an upper and lower limit and neither limit |
| 158911 | 159528 | ** has an application-defined likelihood(), assume the range is |
| | @@ -161002,24 +161619,20 @@ |
| 161002 | 161619 | HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; |
| 161003 | 161620 | assert( pHidden->eDistinct>=0 && pHidden->eDistinct<=3 ); |
| 161004 | 161621 | return pHidden->eDistinct; |
| 161005 | 161622 | } |
| 161006 | 161623 | |
| 161007 | | -#if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) \ |
| 161008 | | - && !defined(SQLITE_OMIT_VIRTUALTABLE) |
| 161009 | 161624 | /* |
| 161010 | 161625 | ** Cause the prepared statement that is associated with a call to |
| 161011 | 161626 | ** xBestIndex to potentially use all schemas. If the statement being |
| 161012 | 161627 | ** prepared is read-only, then just start read transactions on all |
| 161013 | 161628 | ** schemas. But if this is a write operation, start writes on all |
| 161014 | 161629 | ** schemas. |
| 161015 | 161630 | ** |
| 161016 | 161631 | ** This is used by the (built-in) sqlite_dbpage virtual table. |
| 161017 | 161632 | */ |
| 161018 | | -SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(sqlite3_index_info *pIdxInfo){ |
| 161019 | | - HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; |
| 161020 | | - Parse *pParse = pHidden->pParse; |
| 161633 | +SQLITE_PRIVATE void sqlite3VtabUsesAllSchemas(Parse *pParse){ |
| 161021 | 161634 | int nDb = pParse->db->nDb; |
| 161022 | 161635 | int i; |
| 161023 | 161636 | for(i=0; i<nDb; i++){ |
| 161024 | 161637 | sqlite3CodeVerifySchema(pParse, i); |
| 161025 | 161638 | } |
| | @@ -161027,11 +161640,10 @@ |
| 161027 | 161640 | for(i=0; i<nDb; i++){ |
| 161028 | 161641 | sqlite3BeginWriteOperation(pParse, 0, i); |
| 161029 | 161642 | } |
| 161030 | 161643 | } |
| 161031 | 161644 | } |
| 161032 | | -#endif |
| 161033 | 161645 | |
| 161034 | 161646 | /* |
| 161035 | 161647 | ** Add all WhereLoop objects for a table of the join identified by |
| 161036 | 161648 | ** pBuilder->pNew->iTab. That table is guaranteed to be a virtual table. |
| 161037 | 161649 | ** |
| | @@ -162193,10 +162805,14 @@ |
| 162193 | 162805 | pWInfo->nOBSat = pFrom->isOrdered; |
| 162194 | 162806 | if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){ |
| 162195 | 162807 | if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){ |
| 162196 | 162808 | pWInfo->eDistinct = WHERE_DISTINCT_ORDERED; |
| 162197 | 162809 | } |
| 162810 | + if( pWInfo->pSelect->pOrderBy |
| 162811 | + && pWInfo->nOBSat > pWInfo->pSelect->pOrderBy->nExpr ){ |
| 162812 | + pWInfo->nOBSat = pWInfo->pSelect->pOrderBy->nExpr; |
| 162813 | + } |
| 162198 | 162814 | }else{ |
| 162199 | 162815 | pWInfo->revMask = pFrom->revLoop; |
| 162200 | 162816 | if( pWInfo->nOBSat<=0 ){ |
| 162201 | 162817 | pWInfo->nOBSat = 0; |
| 162202 | 162818 | if( nLoop>0 ){ |
| | @@ -163122,11 +163738,11 @@ |
| 163122 | 163738 | for(; b; b=b>>1, n++){} |
| 163123 | 163739 | sqlite3VdbeChangeP4(v, -1, SQLITE_INT_TO_PTR(n), P4_INT32); |
| 163124 | 163740 | assert( n<=pTab->nCol ); |
| 163125 | 163741 | } |
| 163126 | 163742 | #ifdef SQLITE_ENABLE_CURSOR_HINTS |
| 163127 | | - if( pLoop->u.btree.pIndex!=0 ){ |
| 163743 | + if( pLoop->u.btree.pIndex!=0 && (pTab->tabFlags & TF_WithoutRowid)==0 ){ |
| 163128 | 163744 | sqlite3VdbeChangeP5(v, OPFLAG_SEEKEQ|bFordelete); |
| 163129 | 163745 | }else |
| 163130 | 163746 | #endif |
| 163131 | 163747 | { |
| 163132 | 163748 | sqlite3VdbeChangeP5(v, bFordelete); |
| | @@ -163580,11 +164196,12 @@ |
| 163580 | 164196 | } |
| 163581 | 164197 | } |
| 163582 | 164198 | k = pLevel->addrBody + 1; |
| 163583 | 164199 | #ifdef SQLITE_DEBUG |
| 163584 | 164200 | if( db->flags & SQLITE_VdbeAddopTrace ){ |
| 163585 | | - printf("TRANSLATE opcodes in range %d..%d\n", k, last-1); |
| 164201 | + printf("TRANSLATE cursor %d->%d in opcode range %d..%d\n", |
| 164202 | + pLevel->iTabCur, pLevel->iIdxCur, k, last-1); |
| 163586 | 164203 | } |
| 163587 | 164204 | /* Proof that the "+1" on the k value above is safe */ |
| 163588 | 164205 | pOp = sqlite3VdbeGetOp(v, k - 1); |
| 163589 | 164206 | assert( pOp->opcode!=OP_Column || pOp->p1!=pLevel->iTabCur ); |
| 163590 | 164207 | assert( pOp->opcode!=OP_Rowid || pOp->p1!=pLevel->iTabCur ); |
| | @@ -167283,22 +167900,22 @@ |
| 167283 | 167900 | #define sqlite3ParserCTX_PDECL ,Parse *pParse |
| 167284 | 167901 | #define sqlite3ParserCTX_PARAM ,pParse |
| 167285 | 167902 | #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; |
| 167286 | 167903 | #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; |
| 167287 | 167904 | #define YYFALLBACK 1 |
| 167288 | | -#define YYNSTATE 576 |
| 167289 | | -#define YYNRULE 405 |
| 167290 | | -#define YYNRULE_WITH_ACTION 342 |
| 167905 | +#define YYNSTATE 575 |
| 167906 | +#define YYNRULE 403 |
| 167907 | +#define YYNRULE_WITH_ACTION 341 |
| 167291 | 167908 | #define YYNTOKEN 185 |
| 167292 | | -#define YY_MAX_SHIFT 575 |
| 167293 | | -#define YY_MIN_SHIFTREDUCE 835 |
| 167294 | | -#define YY_MAX_SHIFTREDUCE 1239 |
| 167295 | | -#define YY_ERROR_ACTION 1240 |
| 167296 | | -#define YY_ACCEPT_ACTION 1241 |
| 167297 | | -#define YY_NO_ACTION 1242 |
| 167298 | | -#define YY_MIN_REDUCE 1243 |
| 167299 | | -#define YY_MAX_REDUCE 1647 |
| 167909 | +#define YY_MAX_SHIFT 574 |
| 167910 | +#define YY_MIN_SHIFTREDUCE 833 |
| 167911 | +#define YY_MAX_SHIFTREDUCE 1235 |
| 167912 | +#define YY_ERROR_ACTION 1236 |
| 167913 | +#define YY_ACCEPT_ACTION 1237 |
| 167914 | +#define YY_NO_ACTION 1238 |
| 167915 | +#define YY_MIN_REDUCE 1239 |
| 167916 | +#define YY_MAX_REDUCE 1641 |
| 167300 | 167917 | /************* End control #defines *******************************************/ |
| 167301 | 167918 | #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) |
| 167302 | 167919 | |
| 167303 | 167920 | /* Define the yytestcase() macro to be a no-op if is not already defined |
| 167304 | 167921 | ** otherwise. |
| | @@ -167361,222 +167978,222 @@ |
| 167361 | 167978 | ** yy_reduce_ofst[] For each state, the offset into yy_action for |
| 167362 | 167979 | ** shifting non-terminals after a reduce. |
| 167363 | 167980 | ** yy_default[] Default action for each state. |
| 167364 | 167981 | ** |
| 167365 | 167982 | *********** Begin parsing tables **********************************************/ |
| 167366 | | -#define YY_ACTTAB_COUNT (2098) |
| 167983 | +#define YY_ACTTAB_COUNT (2096) |
| 167367 | 167984 | static const YYACTIONTYPE yy_action[] = { |
| 167368 | 167985 | /* 0 */ 568, 208, 568, 118, 115, 229, 568, 118, 115, 229, |
| 167369 | | - /* 10 */ 568, 1314, 377, 1293, 408, 562, 562, 562, 568, 409, |
| 167370 | | - /* 20 */ 378, 1314, 1276, 41, 41, 41, 41, 208, 1526, 71, |
| 167371 | | - /* 30 */ 71, 971, 419, 41, 41, 491, 303, 279, 303, 972, |
| 167372 | | - /* 40 */ 397, 71, 71, 125, 126, 80, 1217, 1217, 1050, 1053, |
| 167373 | | - /* 50 */ 1040, 1040, 123, 123, 124, 124, 124, 124, 476, 409, |
| 167374 | | - /* 60 */ 1241, 1, 1, 575, 2, 1245, 550, 118, 115, 229, |
| 167375 | | - /* 70 */ 317, 480, 146, 480, 524, 118, 115, 229, 529, 1327, |
| 167376 | | - /* 80 */ 417, 523, 142, 125, 126, 80, 1217, 1217, 1050, 1053, |
| 167377 | | - /* 90 */ 1040, 1040, 123, 123, 124, 124, 124, 124, 118, 115, |
| 167986 | + /* 10 */ 568, 1310, 377, 1289, 408, 562, 562, 562, 568, 409, |
| 167987 | + /* 20 */ 378, 1310, 1272, 41, 41, 41, 41, 208, 1521, 71, |
| 167988 | + /* 30 */ 71, 969, 419, 41, 41, 491, 303, 279, 303, 970, |
| 167989 | + /* 40 */ 397, 71, 71, 125, 126, 80, 1213, 1213, 1047, 1050, |
| 167990 | + /* 50 */ 1037, 1037, 123, 123, 124, 124, 124, 124, 476, 409, |
| 167991 | + /* 60 */ 1237, 1, 1, 574, 2, 1241, 550, 118, 115, 229, |
| 167992 | + /* 70 */ 317, 480, 146, 480, 524, 118, 115, 229, 529, 1323, |
| 167993 | + /* 80 */ 417, 523, 142, 125, 126, 80, 1213, 1213, 1047, 1050, |
| 167994 | + /* 90 */ 1037, 1037, 123, 123, 124, 124, 124, 124, 118, 115, |
| 167378 | 167995 | /* 100 */ 229, 327, 122, 122, 122, 122, 121, 121, 120, 120, |
| 167379 | 167996 | /* 110 */ 120, 119, 116, 444, 284, 284, 284, 284, 442, 442, |
| 167380 | | - /* 120 */ 442, 1567, 376, 1569, 1192, 375, 1163, 565, 1163, 565, |
| 167381 | | - /* 130 */ 409, 1567, 537, 259, 226, 444, 101, 145, 449, 316, |
| 167997 | + /* 120 */ 442, 1562, 376, 1564, 1189, 375, 1160, 565, 1160, 565, |
| 167998 | + /* 130 */ 409, 1562, 537, 259, 226, 444, 101, 145, 449, 316, |
| 167382 | 167999 | /* 140 */ 559, 240, 122, 122, 122, 122, 121, 121, 120, 120, |
| 167383 | | - /* 150 */ 120, 119, 116, 444, 125, 126, 80, 1217, 1217, 1050, |
| 167384 | | - /* 160 */ 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, 142, |
| 167385 | | - /* 170 */ 294, 1192, 339, 448, 120, 120, 120, 119, 116, 444, |
| 167386 | | - /* 180 */ 127, 1192, 1193, 1194, 148, 441, 440, 568, 119, 116, |
| 168000 | + /* 150 */ 120, 119, 116, 444, 125, 126, 80, 1213, 1213, 1047, |
| 168001 | + /* 160 */ 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, 142, |
| 168002 | + /* 170 */ 294, 1189, 339, 448, 120, 120, 120, 119, 116, 444, |
| 168003 | + /* 180 */ 127, 1189, 1190, 1189, 148, 441, 440, 568, 119, 116, |
| 167387 | 168004 | /* 190 */ 444, 124, 124, 124, 124, 117, 122, 122, 122, 122, |
| 167388 | 168005 | /* 200 */ 121, 121, 120, 120, 120, 119, 116, 444, 454, 113, |
| 167389 | 168006 | /* 210 */ 13, 13, 546, 122, 122, 122, 122, 121, 121, 120, |
| 167390 | | - /* 220 */ 120, 120, 119, 116, 444, 422, 316, 559, 1192, 1193, |
| 167391 | | - /* 230 */ 1194, 149, 1224, 409, 1224, 124, 124, 124, 124, 122, |
| 168007 | + /* 220 */ 120, 120, 119, 116, 444, 422, 316, 559, 1189, 1190, |
| 168008 | + /* 230 */ 1189, 149, 1220, 409, 1220, 124, 124, 124, 124, 122, |
| 167392 | 168009 | /* 240 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116, |
| 167393 | | - /* 250 */ 444, 465, 342, 1037, 1037, 1051, 1054, 125, 126, 80, |
| 167394 | | - /* 260 */ 1217, 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, |
| 167395 | | - /* 270 */ 124, 124, 1279, 522, 222, 1192, 568, 409, 224, 514, |
| 168010 | + /* 250 */ 444, 465, 342, 1034, 1034, 1048, 1051, 125, 126, 80, |
| 168011 | + /* 260 */ 1213, 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, |
| 168012 | + /* 270 */ 124, 124, 1275, 522, 222, 1189, 568, 409, 224, 514, |
| 167396 | 168013 | /* 280 */ 175, 82, 83, 122, 122, 122, 122, 121, 121, 120, |
| 167397 | | - /* 290 */ 120, 120, 119, 116, 444, 1007, 16, 16, 1192, 133, |
| 167398 | | - /* 300 */ 133, 125, 126, 80, 1217, 1217, 1050, 1053, 1040, 1040, |
| 168014 | + /* 290 */ 120, 120, 119, 116, 444, 1005, 16, 16, 1189, 133, |
| 168015 | + /* 300 */ 133, 125, 126, 80, 1213, 1213, 1047, 1050, 1037, 1037, |
| 167399 | 168016 | /* 310 */ 123, 123, 124, 124, 124, 124, 122, 122, 122, 122, |
| 167400 | | - /* 320 */ 121, 121, 120, 120, 120, 119, 116, 444, 1041, 546, |
| 167401 | | - /* 330 */ 1192, 373, 1192, 1193, 1194, 252, 1434, 399, 504, 501, |
| 167402 | | - /* 340 */ 500, 111, 560, 566, 4, 926, 926, 433, 499, 340, |
| 167403 | | - /* 350 */ 460, 328, 360, 394, 1237, 1192, 1193, 1194, 563, 568, |
| 168017 | + /* 320 */ 121, 121, 120, 120, 120, 119, 116, 444, 1038, 546, |
| 168018 | + /* 330 */ 1189, 373, 1189, 1190, 1189, 252, 1429, 399, 504, 501, |
| 168019 | + /* 340 */ 500, 111, 560, 566, 4, 924, 924, 433, 499, 340, |
| 168020 | + /* 350 */ 460, 328, 360, 394, 1233, 1189, 1190, 1189, 563, 568, |
| 167404 | 168021 | /* 360 */ 122, 122, 122, 122, 121, 121, 120, 120, 120, 119, |
| 167405 | | - /* 370 */ 116, 444, 284, 284, 369, 1580, 1607, 441, 440, 154, |
| 167406 | | - /* 380 */ 409, 445, 71, 71, 1286, 565, 1221, 1192, 1193, 1194, |
| 167407 | | - /* 390 */ 85, 1223, 271, 557, 543, 515, 1561, 568, 98, 1222, |
| 167408 | | - /* 400 */ 6, 1278, 472, 142, 125, 126, 80, 1217, 1217, 1050, |
| 167409 | | - /* 410 */ 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, 550, |
| 167410 | | - /* 420 */ 13, 13, 1027, 507, 1224, 1192, 1224, 549, 109, 109, |
| 167411 | | - /* 430 */ 222, 568, 1238, 175, 568, 427, 110, 197, 445, 570, |
| 167412 | | - /* 440 */ 569, 430, 1552, 1017, 325, 551, 1192, 270, 287, 368, |
| 168022 | + /* 370 */ 116, 444, 284, 284, 369, 1575, 1601, 441, 440, 154, |
| 168023 | + /* 380 */ 409, 445, 71, 71, 1282, 565, 1217, 1189, 1190, 1189, |
| 168024 | + /* 390 */ 85, 1219, 271, 557, 543, 515, 1556, 568, 98, 1218, |
| 168025 | + /* 400 */ 6, 1274, 472, 142, 125, 126, 80, 1213, 1213, 1047, |
| 168026 | + /* 410 */ 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, 550, |
| 168027 | + /* 420 */ 13, 13, 1024, 507, 1220, 1189, 1220, 549, 109, 109, |
| 168028 | + /* 430 */ 222, 568, 1234, 175, 568, 427, 110, 197, 445, 569, |
| 168029 | + /* 440 */ 445, 430, 1547, 1014, 325, 551, 1189, 270, 287, 368, |
| 167413 | 168030 | /* 450 */ 510, 363, 509, 257, 71, 71, 543, 71, 71, 359, |
| 167414 | | - /* 460 */ 316, 559, 1613, 122, 122, 122, 122, 121, 121, 120, |
| 167415 | | - /* 470 */ 120, 120, 119, 116, 444, 1017, 1017, 1019, 1020, 27, |
| 167416 | | - /* 480 */ 284, 284, 1192, 1193, 1194, 1158, 568, 1612, 409, 901, |
| 167417 | | - /* 490 */ 190, 550, 356, 565, 550, 937, 533, 517, 1158, 516, |
| 167418 | | - /* 500 */ 413, 1158, 552, 1192, 1193, 1194, 568, 544, 1554, 51, |
| 167419 | | - /* 510 */ 51, 214, 125, 126, 80, 1217, 1217, 1050, 1053, 1040, |
| 167420 | | - /* 520 */ 1040, 123, 123, 124, 124, 124, 124, 1192, 474, 135, |
| 167421 | | - /* 530 */ 135, 409, 284, 284, 1490, 505, 121, 121, 120, 120, |
| 167422 | | - /* 540 */ 120, 119, 116, 444, 1007, 565, 518, 217, 541, 1561, |
| 167423 | | - /* 550 */ 316, 559, 142, 6, 532, 125, 126, 80, 1217, 1217, |
| 167424 | | - /* 560 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, |
| 167425 | | - /* 570 */ 1555, 122, 122, 122, 122, 121, 121, 120, 120, 120, |
| 167426 | | - /* 580 */ 119, 116, 444, 485, 1192, 1193, 1194, 482, 281, 1267, |
| 167427 | | - /* 590 */ 957, 252, 1192, 373, 504, 501, 500, 1192, 340, 571, |
| 167428 | | - /* 600 */ 1192, 571, 409, 292, 499, 957, 876, 191, 480, 316, |
| 168031 | + /* 460 */ 316, 559, 1607, 122, 122, 122, 122, 121, 121, 120, |
| 168032 | + /* 470 */ 120, 120, 119, 116, 444, 1014, 1014, 1016, 1017, 27, |
| 168033 | + /* 480 */ 284, 284, 1189, 1190, 1189, 1155, 568, 1606, 409, 899, |
| 168034 | + /* 490 */ 190, 550, 356, 565, 550, 935, 533, 517, 1155, 516, |
| 168035 | + /* 500 */ 413, 1155, 552, 1189, 1190, 1189, 568, 544, 1549, 51, |
| 168036 | + /* 510 */ 51, 214, 125, 126, 80, 1213, 1213, 1047, 1050, 1037, |
| 168037 | + /* 520 */ 1037, 123, 123, 124, 124, 124, 124, 1189, 474, 135, |
| 168038 | + /* 530 */ 135, 409, 284, 284, 1485, 505, 121, 121, 120, 120, |
| 168039 | + /* 540 */ 120, 119, 116, 444, 1005, 565, 518, 217, 541, 1556, |
| 168040 | + /* 550 */ 316, 559, 142, 6, 532, 125, 126, 80, 1213, 1213, |
| 168041 | + /* 560 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, |
| 168042 | + /* 570 */ 1550, 122, 122, 122, 122, 121, 121, 120, 120, 120, |
| 168043 | + /* 580 */ 119, 116, 444, 485, 1189, 1190, 1189, 482, 281, 1263, |
| 168044 | + /* 590 */ 955, 252, 1189, 373, 504, 501, 500, 1189, 340, 570, |
| 168045 | + /* 600 */ 1189, 570, 409, 292, 499, 955, 874, 191, 480, 316, |
| 167429 | 168046 | /* 610 */ 559, 384, 290, 380, 122, 122, 122, 122, 121, 121, |
| 167430 | | - /* 620 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217, |
| 167431 | | - /* 630 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, |
| 167432 | | - /* 640 */ 124, 409, 394, 1136, 1192, 869, 100, 284, 284, 1192, |
| 167433 | | - /* 650 */ 1193, 1194, 373, 1093, 1192, 1193, 1194, 1192, 1193, 1194, |
| 167434 | | - /* 660 */ 565, 455, 32, 373, 233, 125, 126, 80, 1217, 1217, |
| 167435 | | - /* 670 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, |
| 167436 | | - /* 680 */ 1433, 959, 568, 228, 958, 122, 122, 122, 122, 121, |
| 167437 | | - /* 690 */ 121, 120, 120, 120, 119, 116, 444, 1158, 228, 1192, |
| 167438 | | - /* 700 */ 157, 1192, 1193, 1194, 1553, 13, 13, 301, 957, 1232, |
| 167439 | | - /* 710 */ 1158, 153, 409, 1158, 373, 1583, 1176, 5, 369, 1580, |
| 167440 | | - /* 720 */ 429, 1238, 3, 957, 122, 122, 122, 122, 121, 121, |
| 167441 | | - /* 730 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217, |
| 167442 | | - /* 740 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, |
| 167443 | | - /* 750 */ 124, 409, 208, 567, 1192, 1028, 1192, 1193, 1194, 1192, |
| 167444 | | - /* 760 */ 388, 852, 155, 1552, 286, 402, 1098, 1098, 488, 568, |
| 167445 | | - /* 770 */ 465, 342, 1319, 1319, 1552, 125, 126, 80, 1217, 1217, |
| 167446 | | - /* 780 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, |
| 168047 | + /* 620 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213, |
| 168048 | + /* 630 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, |
| 168049 | + /* 640 */ 124, 409, 394, 1133, 1189, 867, 100, 284, 284, 1189, |
| 168050 | + /* 650 */ 1190, 1189, 373, 1090, 1189, 1190, 1189, 1189, 1190, 1189, |
| 168051 | + /* 660 */ 565, 455, 32, 373, 233, 125, 126, 80, 1213, 1213, |
| 168052 | + /* 670 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, |
| 168053 | + /* 680 */ 1428, 957, 568, 228, 956, 122, 122, 122, 122, 121, |
| 168054 | + /* 690 */ 121, 120, 120, 120, 119, 116, 444, 1155, 228, 1189, |
| 168055 | + /* 700 */ 157, 1189, 1190, 1189, 1548, 13, 13, 301, 955, 1228, |
| 168056 | + /* 710 */ 1155, 153, 409, 1155, 373, 1578, 1173, 5, 369, 1575, |
| 168057 | + /* 720 */ 429, 1234, 3, 955, 122, 122, 122, 122, 121, 121, |
| 168058 | + /* 730 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213, |
| 168059 | + /* 740 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, |
| 168060 | + /* 750 */ 124, 409, 208, 567, 1189, 1025, 1189, 1190, 1189, 1189, |
| 168061 | + /* 760 */ 388, 850, 155, 1547, 286, 402, 1095, 1095, 488, 568, |
| 168062 | + /* 770 */ 465, 342, 1315, 1315, 1547, 125, 126, 80, 1213, 1213, |
| 168063 | + /* 780 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, |
| 167447 | 168064 | /* 790 */ 129, 568, 13, 13, 374, 122, 122, 122, 122, 121, |
| 167448 | 168065 | /* 800 */ 121, 120, 120, 120, 119, 116, 444, 302, 568, 453, |
| 167449 | | - /* 810 */ 528, 1192, 1193, 1194, 13, 13, 1192, 1193, 1194, 1297, |
| 167450 | | - /* 820 */ 463, 1267, 409, 1317, 1317, 1552, 1012, 453, 452, 200, |
| 167451 | | - /* 830 */ 299, 71, 71, 1265, 122, 122, 122, 122, 121, 121, |
| 167452 | | - /* 840 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217, |
| 167453 | | - /* 850 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, |
| 167454 | | - /* 860 */ 124, 409, 227, 1073, 1158, 284, 284, 419, 312, 278, |
| 167455 | | - /* 870 */ 278, 285, 285, 1419, 406, 405, 382, 1158, 565, 568, |
| 167456 | | - /* 880 */ 1158, 1196, 565, 1600, 565, 125, 126, 80, 1217, 1217, |
| 167457 | | - /* 890 */ 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, 124, |
| 167458 | | - /* 900 */ 453, 1482, 13, 13, 1536, 122, 122, 122, 122, 121, |
| 168066 | + /* 810 */ 528, 1189, 1190, 1189, 13, 13, 1189, 1190, 1189, 1293, |
| 168067 | + /* 820 */ 463, 1263, 409, 1313, 1313, 1547, 1010, 453, 452, 200, |
| 168068 | + /* 830 */ 299, 71, 71, 1261, 122, 122, 122, 122, 121, 121, |
| 168069 | + /* 840 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213, |
| 168070 | + /* 850 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, |
| 168071 | + /* 860 */ 124, 409, 227, 1070, 1155, 284, 284, 419, 312, 278, |
| 168072 | + /* 870 */ 278, 285, 285, 1415, 406, 405, 382, 1155, 565, 568, |
| 168073 | + /* 880 */ 1155, 1192, 565, 1595, 565, 125, 126, 80, 1213, 1213, |
| 168074 | + /* 890 */ 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, 124, |
| 168075 | + /* 900 */ 453, 1477, 13, 13, 1531, 122, 122, 122, 122, 121, |
| 167459 | 168076 | /* 910 */ 121, 120, 120, 120, 119, 116, 444, 201, 568, 354, |
| 167460 | | - /* 920 */ 1586, 575, 2, 1245, 840, 841, 842, 1562, 317, 1212, |
| 167461 | | - /* 930 */ 146, 6, 409, 255, 254, 253, 206, 1327, 9, 1196, |
| 168077 | + /* 920 */ 1581, 574, 2, 1241, 838, 839, 840, 1557, 317, 1208, |
| 168078 | + /* 930 */ 146, 6, 409, 255, 254, 253, 206, 1323, 9, 1192, |
| 167462 | 168079 | /* 940 */ 262, 71, 71, 424, 122, 122, 122, 122, 121, 121, |
| 167463 | | - /* 950 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1217, |
| 167464 | | - /* 960 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, |
| 167465 | | - /* 970 */ 124, 568, 284, 284, 568, 1213, 409, 574, 313, 1245, |
| 167466 | | - /* 980 */ 349, 1296, 352, 419, 317, 565, 146, 491, 525, 1643, |
| 167467 | | - /* 990 */ 395, 371, 491, 1327, 70, 70, 1295, 71, 71, 240, |
| 167468 | | - /* 1000 */ 1325, 104, 80, 1217, 1217, 1050, 1053, 1040, 1040, 123, |
| 168080 | + /* 950 */ 120, 120, 120, 119, 116, 444, 125, 126, 80, 1213, |
| 168081 | + /* 960 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, |
| 168082 | + /* 970 */ 124, 568, 284, 284, 568, 1209, 409, 573, 313, 1241, |
| 168083 | + /* 980 */ 349, 1292, 352, 419, 317, 565, 146, 491, 525, 1637, |
| 168084 | + /* 990 */ 395, 371, 491, 1323, 70, 70, 1291, 71, 71, 240, |
| 168085 | + /* 1000 */ 1321, 104, 80, 1213, 1213, 1047, 1050, 1037, 1037, 123, |
| 167469 | 168086 | /* 1010 */ 123, 124, 124, 124, 124, 122, 122, 122, 122, 121, |
| 167470 | | - /* 1020 */ 121, 120, 120, 120, 119, 116, 444, 1114, 284, 284, |
| 167471 | | - /* 1030 */ 428, 448, 1525, 1213, 439, 284, 284, 1489, 1352, 311, |
| 167472 | | - /* 1040 */ 474, 565, 1115, 971, 491, 491, 217, 1263, 565, 1538, |
| 167473 | | - /* 1050 */ 568, 972, 207, 568, 1027, 240, 383, 1116, 519, 122, |
| 168087 | + /* 1020 */ 121, 120, 120, 120, 119, 116, 444, 1111, 284, 284, |
| 168088 | + /* 1030 */ 428, 448, 1520, 1209, 439, 284, 284, 1484, 1348, 311, |
| 168089 | + /* 1040 */ 474, 565, 1112, 969, 491, 491, 217, 1259, 565, 1533, |
| 168090 | + /* 1050 */ 568, 970, 207, 568, 1024, 240, 383, 1113, 519, 122, |
| 167474 | 168091 | /* 1060 */ 122, 122, 122, 121, 121, 120, 120, 120, 119, 116, |
| 167475 | | - /* 1070 */ 444, 1018, 107, 71, 71, 1017, 13, 13, 912, 568, |
| 167476 | | - /* 1080 */ 1495, 568, 284, 284, 97, 526, 491, 448, 913, 1326, |
| 167477 | | - /* 1090 */ 1322, 545, 409, 284, 284, 565, 151, 209, 1495, 1497, |
| 167478 | | - /* 1100 */ 262, 450, 55, 55, 56, 56, 565, 1017, 1017, 1019, |
| 167479 | | - /* 1110 */ 443, 332, 409, 527, 12, 295, 125, 126, 80, 1217, |
| 167480 | | - /* 1120 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, |
| 167481 | | - /* 1130 */ 124, 347, 409, 864, 1534, 1213, 125, 126, 80, 1217, |
| 167482 | | - /* 1140 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, |
| 167483 | | - /* 1150 */ 124, 1137, 1641, 474, 1641, 371, 125, 114, 80, 1217, |
| 167484 | | - /* 1160 */ 1217, 1050, 1053, 1040, 1040, 123, 123, 124, 124, 124, |
| 167485 | | - /* 1170 */ 124, 1495, 329, 474, 331, 122, 122, 122, 122, 121, |
| 167486 | | - /* 1180 */ 121, 120, 120, 120, 119, 116, 444, 203, 1419, 568, |
| 167487 | | - /* 1190 */ 1294, 864, 464, 1213, 436, 122, 122, 122, 122, 121, |
| 167488 | | - /* 1200 */ 121, 120, 120, 120, 119, 116, 444, 553, 1137, 1642, |
| 167489 | | - /* 1210 */ 539, 1642, 15, 15, 892, 122, 122, 122, 122, 121, |
| 168092 | + /* 1070 */ 444, 1015, 107, 71, 71, 1014, 13, 13, 910, 568, |
| 168093 | + /* 1080 */ 1490, 568, 284, 284, 97, 526, 491, 448, 911, 1322, |
| 168094 | + /* 1090 */ 1318, 545, 409, 284, 284, 565, 151, 209, 1490, 1492, |
| 168095 | + /* 1100 */ 262, 450, 55, 55, 56, 56, 565, 1014, 1014, 1016, |
| 168096 | + /* 1110 */ 443, 332, 409, 527, 12, 295, 125, 126, 80, 1213, |
| 168097 | + /* 1120 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, |
| 168098 | + /* 1130 */ 124, 347, 409, 862, 1529, 1209, 125, 126, 80, 1213, |
| 168099 | + /* 1140 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, |
| 168100 | + /* 1150 */ 124, 1134, 1635, 474, 1635, 371, 125, 114, 80, 1213, |
| 168101 | + /* 1160 */ 1213, 1047, 1050, 1037, 1037, 123, 123, 124, 124, 124, |
| 168102 | + /* 1170 */ 124, 1490, 329, 474, 331, 122, 122, 122, 122, 121, |
| 168103 | + /* 1180 */ 121, 120, 120, 120, 119, 116, 444, 203, 1415, 568, |
| 168104 | + /* 1190 */ 1290, 862, 464, 1209, 436, 122, 122, 122, 122, 121, |
| 168105 | + /* 1200 */ 121, 120, 120, 120, 119, 116, 444, 553, 1134, 1636, |
| 168106 | + /* 1210 */ 539, 1636, 15, 15, 890, 122, 122, 122, 122, 121, |
| 167490 | 168107 | /* 1220 */ 121, 120, 120, 120, 119, 116, 444, 568, 298, 538, |
| 167491 | | - /* 1230 */ 1135, 1419, 1559, 1560, 1331, 409, 6, 6, 1169, 1268, |
| 167492 | | - /* 1240 */ 415, 320, 284, 284, 1419, 508, 565, 525, 300, 457, |
| 167493 | | - /* 1250 */ 43, 43, 568, 893, 12, 565, 330, 478, 425, 407, |
| 167494 | | - /* 1260 */ 126, 80, 1217, 1217, 1050, 1053, 1040, 1040, 123, 123, |
| 167495 | | - /* 1270 */ 124, 124, 124, 124, 568, 57, 57, 288, 1192, 1419, |
| 167496 | | - /* 1280 */ 496, 458, 392, 392, 391, 273, 389, 1135, 1558, 849, |
| 167497 | | - /* 1290 */ 1169, 407, 6, 568, 321, 1158, 470, 44, 44, 1557, |
| 167498 | | - /* 1300 */ 1114, 426, 234, 6, 323, 256, 540, 256, 1158, 431, |
| 167499 | | - /* 1310 */ 568, 1158, 322, 17, 487, 1115, 58, 58, 122, 122, |
| 168108 | + /* 1230 */ 1132, 1415, 1554, 1555, 1327, 409, 6, 6, 1166, 1264, |
| 168109 | + /* 1240 */ 415, 320, 284, 284, 1415, 508, 565, 525, 300, 457, |
| 168110 | + /* 1250 */ 43, 43, 568, 891, 12, 565, 330, 478, 425, 407, |
| 168111 | + /* 1260 */ 126, 80, 1213, 1213, 1047, 1050, 1037, 1037, 123, 123, |
| 168112 | + /* 1270 */ 124, 124, 124, 124, 568, 57, 57, 288, 1189, 1415, |
| 168113 | + /* 1280 */ 496, 458, 392, 392, 391, 273, 389, 1132, 1553, 847, |
| 168114 | + /* 1290 */ 1166, 407, 6, 568, 321, 1155, 470, 44, 44, 1552, |
| 168115 | + /* 1300 */ 1111, 426, 234, 6, 323, 256, 540, 256, 1155, 431, |
| 168116 | + /* 1310 */ 568, 1155, 322, 17, 487, 1112, 58, 58, 122, 122, |
| 167500 | 168117 | /* 1320 */ 122, 122, 121, 121, 120, 120, 120, 119, 116, 444, |
| 167501 | | - /* 1330 */ 1116, 216, 481, 59, 59, 1192, 1193, 1194, 111, 560, |
| 168118 | + /* 1330 */ 1113, 216, 481, 59, 59, 1189, 1190, 1189, 111, 560, |
| 167502 | 168119 | /* 1340 */ 324, 4, 236, 456, 526, 568, 237, 456, 568, 437, |
| 167503 | | - /* 1350 */ 168, 556, 420, 141, 479, 563, 568, 293, 568, 1095, |
| 167504 | | - /* 1360 */ 568, 293, 568, 1095, 531, 568, 872, 8, 60, 60, |
| 168120 | + /* 1350 */ 168, 556, 420, 141, 479, 563, 568, 293, 568, 1092, |
| 168121 | + /* 1360 */ 568, 293, 568, 1092, 531, 568, 870, 8, 60, 60, |
| 167505 | 168122 | /* 1370 */ 235, 61, 61, 568, 414, 568, 414, 568, 445, 62, |
| 167506 | 168123 | /* 1380 */ 62, 45, 45, 46, 46, 47, 47, 199, 49, 49, |
| 167507 | 168124 | /* 1390 */ 557, 568, 359, 568, 100, 486, 50, 50, 63, 63, |
| 167508 | | - /* 1400 */ 64, 64, 561, 415, 535, 410, 568, 1027, 568, 534, |
| 167509 | | - /* 1410 */ 316, 559, 316, 559, 65, 65, 14, 14, 568, 1027, |
| 167510 | | - /* 1420 */ 568, 512, 932, 872, 1018, 109, 109, 931, 1017, 66, |
| 167511 | | - /* 1430 */ 66, 131, 131, 110, 451, 445, 570, 569, 416, 177, |
| 167512 | | - /* 1440 */ 1017, 132, 132, 67, 67, 568, 467, 568, 932, 471, |
| 167513 | | - /* 1450 */ 1364, 283, 226, 931, 315, 1363, 407, 568, 459, 407, |
| 167514 | | - /* 1460 */ 1017, 1017, 1019, 239, 407, 86, 213, 1350, 52, 52, |
| 167515 | | - /* 1470 */ 68, 68, 1017, 1017, 1019, 1020, 27, 1585, 1180, 447, |
| 167516 | | - /* 1480 */ 69, 69, 288, 97, 108, 1541, 106, 392, 392, 391, |
| 167517 | | - /* 1490 */ 273, 389, 568, 879, 849, 883, 568, 111, 560, 466, |
| 167518 | | - /* 1500 */ 4, 568, 152, 30, 38, 568, 1132, 234, 396, 323, |
| 168125 | + /* 1400 */ 64, 64, 561, 415, 535, 410, 568, 1024, 568, 534, |
| 168126 | + /* 1410 */ 316, 559, 316, 559, 65, 65, 14, 14, 568, 1024, |
| 168127 | + /* 1420 */ 568, 512, 930, 870, 1015, 109, 109, 929, 1014, 66, |
| 168128 | + /* 1430 */ 66, 131, 131, 110, 451, 445, 569, 445, 416, 177, |
| 168129 | + /* 1440 */ 1014, 132, 132, 67, 67, 568, 467, 568, 930, 471, |
| 168130 | + /* 1450 */ 1360, 283, 226, 929, 315, 1359, 407, 568, 459, 407, |
| 168131 | + /* 1460 */ 1014, 1014, 1016, 239, 407, 86, 213, 1346, 52, 52, |
| 168132 | + /* 1470 */ 68, 68, 1014, 1014, 1016, 1017, 27, 1580, 1177, 447, |
| 168133 | + /* 1480 */ 69, 69, 288, 97, 108, 1536, 106, 392, 392, 391, |
| 168134 | + /* 1490 */ 273, 389, 568, 877, 847, 881, 568, 111, 560, 466, |
| 168135 | + /* 1500 */ 4, 568, 152, 30, 38, 568, 1129, 234, 396, 323, |
| 167519 | 168136 | /* 1510 */ 111, 560, 527, 4, 563, 53, 53, 322, 568, 163, |
| 167520 | 168137 | /* 1520 */ 163, 568, 337, 468, 164, 164, 333, 563, 76, 76, |
| 167521 | | - /* 1530 */ 568, 289, 1514, 568, 31, 1513, 568, 445, 338, 483, |
| 167522 | | - /* 1540 */ 100, 54, 54, 344, 72, 72, 296, 236, 1080, 557, |
| 167523 | | - /* 1550 */ 445, 879, 1360, 134, 134, 168, 73, 73, 141, 161, |
| 167524 | | - /* 1560 */ 161, 1574, 557, 535, 568, 319, 568, 348, 536, 1009, |
| 167525 | | - /* 1570 */ 473, 261, 261, 891, 890, 235, 535, 568, 1027, 568, |
| 168138 | + /* 1530 */ 568, 289, 1509, 568, 31, 1508, 568, 445, 338, 483, |
| 168139 | + /* 1540 */ 100, 54, 54, 344, 72, 72, 296, 236, 1077, 557, |
| 168140 | + /* 1550 */ 445, 877, 1356, 134, 134, 168, 73, 73, 141, 161, |
| 168141 | + /* 1560 */ 161, 1569, 557, 535, 568, 319, 568, 348, 536, 1007, |
| 168142 | + /* 1570 */ 473, 261, 261, 889, 888, 235, 535, 568, 1024, 568, |
| 167526 | 168143 | /* 1580 */ 475, 534, 261, 367, 109, 109, 521, 136, 136, 130, |
| 167527 | | - /* 1590 */ 130, 1027, 110, 366, 445, 570, 569, 109, 109, 1017, |
| 167528 | | - /* 1600 */ 162, 162, 156, 156, 568, 110, 1080, 445, 570, 569, |
| 167529 | | - /* 1610 */ 410, 351, 1017, 568, 353, 316, 559, 568, 343, 568, |
| 167530 | | - /* 1620 */ 100, 497, 357, 258, 100, 898, 899, 140, 140, 355, |
| 167531 | | - /* 1630 */ 1310, 1017, 1017, 1019, 1020, 27, 139, 139, 362, 451, |
| 167532 | | - /* 1640 */ 137, 137, 138, 138, 1017, 1017, 1019, 1020, 27, 1180, |
| 167533 | | - /* 1650 */ 447, 568, 372, 288, 111, 560, 1021, 4, 392, 392, |
| 167534 | | - /* 1660 */ 391, 273, 389, 568, 1141, 849, 568, 1076, 568, 258, |
| 167535 | | - /* 1670 */ 492, 563, 568, 211, 75, 75, 555, 962, 234, 261, |
| 167536 | | - /* 1680 */ 323, 111, 560, 929, 4, 113, 77, 77, 322, 74, |
| 167537 | | - /* 1690 */ 74, 42, 42, 1373, 445, 48, 48, 1418, 563, 974, |
| 167538 | | - /* 1700 */ 975, 1092, 1091, 1092, 1091, 862, 557, 150, 930, 1346, |
| 167539 | | - /* 1710 */ 113, 1358, 554, 1424, 1021, 1275, 1266, 1254, 236, 1253, |
| 167540 | | - /* 1720 */ 1255, 445, 1593, 1343, 308, 276, 168, 309, 11, 141, |
| 167541 | | - /* 1730 */ 393, 310, 232, 557, 1405, 1027, 335, 291, 1400, 219, |
| 167542 | | - /* 1740 */ 336, 109, 109, 936, 297, 1410, 235, 341, 477, 110, |
| 167543 | | - /* 1750 */ 502, 445, 570, 569, 1393, 1409, 1017, 400, 1293, 365, |
| 167544 | | - /* 1760 */ 223, 1486, 1027, 1485, 1355, 1356, 1354, 1353, 109, 109, |
| 167545 | | - /* 1770 */ 204, 1596, 1232, 558, 265, 218, 110, 205, 445, 570, |
| 167546 | | - /* 1780 */ 569, 410, 387, 1017, 1533, 179, 316, 559, 1017, 1017, |
| 167547 | | - /* 1790 */ 1019, 1020, 27, 230, 1531, 1229, 79, 560, 85, 4, |
| 167548 | | - /* 1800 */ 418, 215, 548, 81, 84, 188, 1406, 173, 181, 461, |
| 167549 | | - /* 1810 */ 451, 35, 462, 563, 183, 1017, 1017, 1019, 1020, 27, |
| 167550 | | - /* 1820 */ 184, 1491, 185, 186, 495, 242, 98, 398, 1412, 36, |
| 167551 | | - /* 1830 */ 1411, 484, 91, 469, 401, 1414, 445, 192, 1480, 246, |
| 167552 | | - /* 1840 */ 1502, 490, 346, 277, 248, 196, 493, 511, 557, 350, |
| 167553 | | - /* 1850 */ 1256, 249, 250, 403, 1313, 1312, 111, 560, 432, 4, |
| 167554 | | - /* 1860 */ 1311, 1304, 93, 1611, 883, 1610, 224, 404, 434, 520, |
| 167555 | | - /* 1870 */ 263, 435, 1579, 563, 1283, 1282, 364, 1027, 306, 1281, |
| 167556 | | - /* 1880 */ 264, 1609, 1565, 109, 109, 370, 1303, 307, 1564, 438, |
| 167557 | | - /* 1890 */ 128, 110, 1378, 445, 570, 569, 445, 546, 1017, 10, |
| 167558 | | - /* 1900 */ 1466, 105, 381, 1377, 34, 572, 99, 1336, 557, 314, |
| 167559 | | - /* 1910 */ 1186, 530, 272, 274, 379, 210, 1335, 547, 385, 386, |
| 167560 | | - /* 1920 */ 275, 573, 1251, 1246, 411, 412, 1518, 165, 178, 1519, |
| 167561 | | - /* 1930 */ 1017, 1017, 1019, 1020, 27, 1517, 1516, 1027, 78, 147, |
| 167562 | | - /* 1940 */ 166, 220, 221, 109, 109, 836, 304, 167, 446, 212, |
| 167563 | | - /* 1950 */ 318, 110, 231, 445, 570, 569, 144, 1090, 1017, 1088, |
| 167564 | | - /* 1960 */ 326, 180, 169, 1212, 182, 334, 238, 915, 241, 1104, |
| 168144 | + /* 1590 */ 130, 1024, 110, 366, 445, 569, 445, 109, 109, 1014, |
| 168145 | + /* 1600 */ 162, 162, 156, 156, 568, 110, 1077, 445, 569, 445, |
| 168146 | + /* 1610 */ 410, 351, 1014, 568, 353, 316, 559, 568, 343, 568, |
| 168147 | + /* 1620 */ 100, 497, 357, 258, 100, 896, 897, 140, 140, 355, |
| 168148 | + /* 1630 */ 1306, 1014, 1014, 1016, 1017, 27, 139, 139, 362, 451, |
| 168149 | + /* 1640 */ 137, 137, 138, 138, 1014, 1014, 1016, 1017, 27, 1177, |
| 168150 | + /* 1650 */ 447, 568, 372, 288, 111, 560, 1018, 4, 392, 392, |
| 168151 | + /* 1660 */ 391, 273, 389, 568, 1138, 847, 568, 1073, 568, 258, |
| 168152 | + /* 1670 */ 492, 563, 568, 211, 75, 75, 555, 960, 234, 261, |
| 168153 | + /* 1680 */ 323, 111, 560, 927, 4, 113, 77, 77, 322, 74, |
| 168154 | + /* 1690 */ 74, 42, 42, 1369, 445, 48, 48, 1414, 563, 972, |
| 168155 | + /* 1700 */ 973, 1089, 1088, 1089, 1088, 860, 557, 150, 928, 1342, |
| 168156 | + /* 1710 */ 113, 1354, 554, 1419, 1018, 1271, 1262, 1250, 236, 1249, |
| 168157 | + /* 1720 */ 1251, 445, 1588, 1339, 308, 276, 168, 309, 11, 141, |
| 168158 | + /* 1730 */ 393, 310, 232, 557, 1401, 1024, 335, 291, 1396, 219, |
| 168159 | + /* 1740 */ 336, 109, 109, 934, 297, 1406, 235, 341, 477, 110, |
| 168160 | + /* 1750 */ 502, 445, 569, 445, 1389, 1405, 1014, 400, 1289, 365, |
| 168161 | + /* 1760 */ 223, 1481, 1024, 1480, 1351, 1352, 1350, 1349, 109, 109, |
| 168162 | + /* 1770 */ 204, 1591, 1228, 558, 265, 218, 110, 205, 445, 569, |
| 168163 | + /* 1780 */ 445, 410, 387, 1014, 1528, 179, 316, 559, 1014, 1014, |
| 168164 | + /* 1790 */ 1016, 1017, 27, 230, 1526, 1225, 79, 560, 85, 4, |
| 168165 | + /* 1800 */ 418, 215, 548, 81, 84, 188, 1402, 173, 181, 461, |
| 168166 | + /* 1810 */ 451, 35, 462, 563, 183, 1014, 1014, 1016, 1017, 27, |
| 168167 | + /* 1820 */ 184, 1486, 185, 186, 495, 242, 98, 398, 1408, 36, |
| 168168 | + /* 1830 */ 1407, 484, 91, 469, 401, 1410, 445, 192, 1475, 246, |
| 168169 | + /* 1840 */ 1497, 490, 346, 277, 248, 196, 493, 511, 557, 350, |
| 168170 | + /* 1850 */ 1252, 249, 250, 403, 1309, 1308, 111, 560, 432, 4, |
| 168171 | + /* 1860 */ 1307, 1300, 93, 1605, 881, 1604, 224, 404, 434, 520, |
| 168172 | + /* 1870 */ 263, 435, 1574, 563, 1279, 1278, 364, 1024, 306, 1277, |
| 168173 | + /* 1880 */ 264, 1603, 1560, 109, 109, 370, 1299, 307, 1559, 438, |
| 168174 | + /* 1890 */ 128, 110, 1374, 445, 569, 445, 445, 546, 1014, 10, |
| 168175 | + /* 1900 */ 1461, 105, 381, 1373, 34, 571, 99, 1332, 557, 314, |
| 168176 | + /* 1910 */ 1183, 530, 272, 274, 379, 210, 1331, 547, 385, 386, |
| 168177 | + /* 1920 */ 275, 572, 1247, 1242, 411, 412, 1513, 165, 178, 1514, |
| 168178 | + /* 1930 */ 1014, 1014, 1016, 1017, 27, 1512, 1511, 1024, 78, 147, |
| 168179 | + /* 1940 */ 166, 220, 221, 109, 109, 834, 304, 167, 446, 212, |
| 168180 | + /* 1950 */ 318, 110, 231, 445, 569, 445, 144, 1087, 1014, 1085, |
| 168181 | + /* 1960 */ 326, 180, 169, 1208, 182, 334, 238, 913, 241, 1101, |
| 167565 | 168182 | /* 1970 */ 187, 170, 171, 421, 87, 88, 423, 189, 89, 90, |
| 167566 | | - /* 1980 */ 172, 1107, 243, 1103, 244, 158, 18, 245, 345, 247, |
| 167567 | | - /* 1990 */ 1017, 1017, 1019, 1020, 27, 261, 1096, 193, 1226, 489, |
| 167568 | | - /* 2000 */ 194, 37, 366, 851, 494, 251, 195, 506, 92, 19, |
| 167569 | | - /* 2010 */ 498, 358, 20, 503, 881, 361, 94, 894, 305, 159, |
| 167570 | | - /* 2020 */ 513, 39, 95, 1174, 160, 1056, 966, 1143, 96, 174, |
| 167571 | | - /* 2030 */ 1142, 225, 280, 282, 198, 960, 113, 1164, 1160, 260, |
| 167572 | | - /* 2040 */ 21, 22, 23, 1162, 1168, 1167, 1148, 24, 33, 25, |
| 167573 | | - /* 2050 */ 202, 542, 26, 100, 1071, 102, 1057, 103, 7, 1055, |
| 167574 | | - /* 2060 */ 1059, 1113, 1060, 1112, 266, 267, 28, 40, 390, 1022, |
| 167575 | | - /* 2070 */ 863, 112, 29, 564, 1182, 1181, 268, 176, 143, 925, |
| 167576 | | - /* 2080 */ 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, 1242, |
| 167577 | | - /* 2090 */ 1242, 1242, 1242, 1242, 269, 1602, 1242, 1601, |
| 168183 | + /* 1980 */ 172, 1104, 243, 1100, 244, 158, 18, 245, 345, 247, |
| 168184 | + /* 1990 */ 1014, 1014, 1016, 1017, 27, 261, 1093, 193, 1222, 489, |
| 168185 | + /* 2000 */ 194, 37, 366, 849, 494, 251, 195, 506, 92, 19, |
| 168186 | + /* 2010 */ 498, 358, 20, 503, 879, 361, 94, 892, 305, 159, |
| 168187 | + /* 2020 */ 513, 39, 95, 1171, 160, 1053, 964, 1140, 96, 174, |
| 168188 | + /* 2030 */ 1139, 225, 280, 282, 198, 958, 113, 1161, 1157, 260, |
| 168189 | + /* 2040 */ 21, 22, 23, 1159, 1165, 1164, 1145, 24, 33, 25, |
| 168190 | + /* 2050 */ 202, 542, 26, 100, 1068, 102, 1054, 103, 7, 1052, |
| 168191 | + /* 2060 */ 1056, 1110, 1057, 1109, 266, 267, 28, 40, 390, 1019, |
| 168192 | + /* 2070 */ 861, 112, 29, 564, 1179, 1178, 268, 176, 143, 923, |
| 168193 | + /* 2080 */ 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, 1238, |
| 168194 | + /* 2090 */ 1238, 1238, 1238, 1238, 269, 1596, |
| 167578 | 168195 | }; |
| 167579 | 168196 | static const YYCODETYPE yy_lookahead[] = { |
| 167580 | 168197 | /* 0 */ 193, 193, 193, 274, 275, 276, 193, 274, 275, 276, |
| 167581 | 168198 | /* 10 */ 193, 223, 219, 225, 206, 210, 211, 212, 193, 19, |
| 167582 | 168199 | /* 20 */ 219, 233, 216, 216, 217, 216, 217, 193, 295, 216, |
| | @@ -167784,11 +168401,11 @@ |
| 167784 | 168401 | /* 2040 */ 34, 34, 34, 86, 75, 93, 23, 34, 22, 34, |
| 167785 | 168402 | /* 2050 */ 25, 24, 34, 25, 23, 142, 23, 142, 44, 23, |
| 167786 | 168403 | /* 2060 */ 23, 23, 11, 23, 25, 22, 22, 22, 15, 23, |
| 167787 | 168404 | /* 2070 */ 23, 22, 22, 25, 1, 1, 141, 25, 23, 135, |
| 167788 | 168405 | /* 2080 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 167789 | | - /* 2090 */ 319, 319, 319, 319, 141, 141, 319, 141, 319, 319, |
| 168406 | + /* 2090 */ 319, 319, 319, 319, 141, 141, 319, 319, 319, 319, |
| 167790 | 168407 | /* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 167791 | 168408 | /* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 167792 | 168409 | /* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 167793 | 168410 | /* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 167794 | 168411 | /* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| | @@ -167803,13 +168420,13 @@ |
| 167803 | 168420 | /* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 167804 | 168421 | /* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 167805 | 168422 | /* 2250 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 167806 | 168423 | /* 2260 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 167807 | 168424 | /* 2270 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, |
| 167808 | | - /* 2280 */ 319, 319, 319, |
| 168425 | + /* 2280 */ 319, |
| 167809 | 168426 | }; |
| 167810 | | -#define YY_SHIFT_COUNT (575) |
| 168427 | +#define YY_SHIFT_COUNT (574) |
| 167811 | 168428 | #define YY_SHIFT_MIN (0) |
| 167812 | 168429 | #define YY_SHIFT_MAX (2074) |
| 167813 | 168430 | static const unsigned short int yy_shift_ofst[] = { |
| 167814 | 168431 | /* 0 */ 1648, 1477, 1272, 322, 322, 1, 1319, 1478, 1491, 1837, |
| 167815 | 168432 | /* 10 */ 1837, 1837, 471, 0, 0, 214, 1093, 1837, 1837, 1837, |
| | @@ -167825,16 +168442,16 @@ |
| 167825 | 168442 | /* 110 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, |
| 167826 | 168443 | /* 120 */ 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, 1837, |
| 167827 | 168444 | /* 130 */ 137, 181, 181, 181, 181, 181, 181, 181, 94, 430, |
| 167828 | 168445 | /* 140 */ 66, 65, 112, 366, 533, 533, 740, 1261, 533, 533, |
| 167829 | 168446 | /* 150 */ 79, 79, 533, 412, 412, 412, 77, 412, 123, 113, |
| 167830 | | - /* 160 */ 113, 22, 22, 2098, 2098, 328, 328, 328, 239, 468, |
| 168447 | + /* 160 */ 113, 22, 22, 2096, 2096, 328, 328, 328, 239, 468, |
| 167831 | 168448 | /* 170 */ 468, 468, 468, 1015, 1015, 409, 366, 1129, 1186, 533, |
| 167832 | 168449 | /* 180 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533, |
| 167833 | 168450 | /* 190 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 969, |
| 167834 | 168451 | /* 200 */ 621, 621, 533, 642, 788, 788, 1228, 1228, 822, 822, |
| 167835 | | - /* 210 */ 67, 1274, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 1307, |
| 168452 | + /* 210 */ 67, 1274, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 1307, |
| 167836 | 168453 | /* 220 */ 954, 954, 585, 472, 640, 387, 695, 538, 541, 700, |
| 167837 | 168454 | /* 230 */ 533, 533, 533, 533, 533, 533, 533, 533, 533, 533, |
| 167838 | 168455 | /* 240 */ 222, 533, 533, 533, 533, 533, 533, 533, 533, 533, |
| 167839 | 168456 | /* 250 */ 533, 533, 533, 1179, 1179, 1179, 533, 533, 533, 565, |
| 167840 | 168457 | /* 260 */ 533, 533, 533, 916, 1144, 533, 533, 1288, 533, 533, |
| | @@ -167848,12 +168465,12 @@ |
| 167848 | 168465 | /* 340 */ 1764, 1677, 1764, 1677, 1633, 1806, 1674, 1779, 1633, 1806, |
| 167849 | 168466 | /* 350 */ 1823, 1633, 1806, 1633, 1806, 1823, 1732, 1732, 1732, 1794, |
| 167850 | 168467 | /* 360 */ 1840, 1840, 1823, 1732, 1738, 1732, 1794, 1732, 1732, 1701, |
| 167851 | 168468 | /* 370 */ 1844, 1758, 1758, 1823, 1633, 1789, 1789, 1807, 1807, 1742, |
| 167852 | 168469 | /* 380 */ 1752, 1877, 1633, 1743, 1742, 1759, 1765, 1677, 1879, 1897, |
| 167853 | | - /* 390 */ 1897, 1914, 1914, 1914, 2098, 2098, 2098, 2098, 2098, 2098, |
| 167854 | | - /* 400 */ 2098, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 2098, 207, |
| 168470 | + /* 390 */ 1897, 1914, 1914, 1914, 2096, 2096, 2096, 2096, 2096, 2096, |
| 168471 | + /* 400 */ 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 2096, 207, |
| 167855 | 168472 | /* 410 */ 1095, 331, 620, 903, 806, 1074, 1483, 1432, 1481, 1322, |
| 167856 | 168473 | /* 420 */ 1370, 1394, 1515, 1291, 1546, 1547, 1557, 1595, 1598, 1599, |
| 167857 | 168474 | /* 430 */ 1434, 1453, 1618, 1462, 1567, 1489, 1644, 1654, 1616, 1660, |
| 167858 | 168475 | /* 440 */ 1548, 1549, 1682, 1685, 1597, 742, 1941, 1945, 1927, 1787, |
| 167859 | 168476 | /* 450 */ 1937, 1940, 1934, 1936, 1821, 1810, 1832, 1938, 1938, 1942, |
| | @@ -167866,11 +168483,11 @@ |
| 167866 | 168483 | /* 520 */ 1999, 1933, 1890, 2009, 2010, 1910, 2005, 2012, 1892, 2011, |
| 167867 | 168484 | /* 530 */ 2006, 2007, 2008, 2013, 1950, 1962, 1957, 2014, 1969, 1952, |
| 167868 | 168485 | /* 540 */ 2015, 2023, 2026, 2027, 2025, 2028, 2018, 1913, 1915, 2031, |
| 167869 | 168486 | /* 550 */ 2011, 2033, 2036, 2037, 2038, 2039, 2040, 2043, 2051, 2044, |
| 167870 | 168487 | /* 560 */ 2045, 2046, 2047, 2049, 2050, 2048, 1944, 1935, 1953, 1954, |
| 167871 | | - /* 570 */ 1956, 2052, 2055, 2053, 2073, 2074, |
| 168488 | + /* 570 */ 2052, 2055, 2053, 2073, 2074, |
| 167872 | 168489 | }; |
| 167873 | 168490 | #define YY_REDUCE_COUNT (408) |
| 167874 | 168491 | #define YY_REDUCE_MIN (-271) |
| 167875 | 168492 | #define YY_REDUCE_MAX (1740) |
| 167876 | 168493 | static const short yy_reduce_ofst[] = { |
| | @@ -167915,68 +168532,68 @@ |
| 167915 | 168532 | /* 380 */ 1665, 1623, 1702, 1630, 1666, 1667, 1671, 1673, 1703, 1718, |
| 167916 | 168533 | /* 390 */ 1719, 1729, 1730, 1731, 1621, 1622, 1628, 1720, 1713, 1716, |
| 167917 | 168534 | /* 400 */ 1722, 1723, 1733, 1717, 1724, 1727, 1728, 1725, 1740, |
| 167918 | 168535 | }; |
| 167919 | 168536 | static const YYACTIONTYPE yy_default[] = { |
| 167920 | | - /* 0 */ 1647, 1647, 1647, 1475, 1240, 1351, 1240, 1240, 1240, 1475, |
| 167921 | | - /* 10 */ 1475, 1475, 1240, 1381, 1381, 1528, 1273, 1240, 1240, 1240, |
| 167922 | | - /* 20 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1474, 1240, 1240, |
| 167923 | | - /* 30 */ 1240, 1240, 1563, 1563, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167924 | | - /* 40 */ 1240, 1240, 1390, 1240, 1397, 1240, 1240, 1240, 1240, 1240, |
| 167925 | | - /* 50 */ 1476, 1477, 1240, 1240, 1240, 1527, 1529, 1492, 1404, 1403, |
| 167926 | | - /* 60 */ 1402, 1401, 1510, 1369, 1395, 1388, 1392, 1470, 1471, 1469, |
| 167927 | | - /* 70 */ 1473, 1477, 1476, 1240, 1391, 1438, 1454, 1437, 1240, 1240, |
| 167928 | | - /* 80 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167929 | | - /* 90 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167930 | | - /* 100 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167931 | | - /* 110 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167932 | | - /* 120 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167933 | | - /* 130 */ 1446, 1453, 1452, 1451, 1460, 1450, 1447, 1440, 1439, 1441, |
| 167934 | | - /* 140 */ 1442, 1240, 1240, 1264, 1240, 1240, 1261, 1315, 1240, 1240, |
| 167935 | | - /* 150 */ 1240, 1240, 1240, 1547, 1546, 1240, 1443, 1240, 1273, 1432, |
| 167936 | | - /* 160 */ 1431, 1457, 1444, 1456, 1455, 1535, 1599, 1598, 1493, 1240, |
| 167937 | | - /* 170 */ 1240, 1240, 1240, 1240, 1240, 1563, 1240, 1240, 1240, 1240, |
| 167938 | | - /* 180 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167939 | | - /* 190 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1371, |
| 167940 | | - /* 200 */ 1563, 1563, 1240, 1273, 1563, 1563, 1372, 1372, 1269, 1269, |
| 167941 | | - /* 210 */ 1375, 1240, 1542, 1342, 1342, 1342, 1342, 1351, 1342, 1240, |
| 167942 | | - /* 220 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167943 | | - /* 230 */ 1240, 1240, 1240, 1240, 1532, 1530, 1240, 1240, 1240, 1240, |
| 167944 | | - /* 240 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167945 | | - /* 250 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167946 | | - /* 260 */ 1240, 1240, 1240, 1347, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167947 | | - /* 270 */ 1240, 1240, 1240, 1240, 1240, 1592, 1240, 1505, 1329, 1347, |
| 167948 | | - /* 280 */ 1347, 1347, 1347, 1349, 1330, 1328, 1341, 1274, 1247, 1639, |
| 167949 | | - /* 290 */ 1407, 1396, 1348, 1396, 1636, 1394, 1407, 1407, 1394, 1407, |
| 167950 | | - /* 300 */ 1348, 1636, 1290, 1615, 1285, 1381, 1381, 1381, 1371, 1371, |
| 167951 | | - /* 310 */ 1371, 1371, 1375, 1375, 1472, 1348, 1341, 1240, 1639, 1639, |
| 167952 | | - /* 320 */ 1357, 1357, 1638, 1638, 1357, 1493, 1623, 1416, 1318, 1324, |
| 167953 | | - /* 330 */ 1324, 1324, 1324, 1357, 1258, 1394, 1623, 1623, 1394, 1416, |
| 167954 | | - /* 340 */ 1318, 1394, 1318, 1394, 1357, 1258, 1509, 1633, 1357, 1258, |
| 167955 | | - /* 350 */ 1483, 1357, 1258, 1357, 1258, 1483, 1316, 1316, 1316, 1305, |
| 167956 | | - /* 360 */ 1240, 1240, 1483, 1316, 1290, 1316, 1305, 1316, 1316, 1581, |
| 167957 | | - /* 370 */ 1240, 1487, 1487, 1483, 1357, 1573, 1573, 1384, 1384, 1389, |
| 167958 | | - /* 380 */ 1375, 1478, 1357, 1240, 1389, 1387, 1385, 1394, 1308, 1595, |
| 167959 | | - /* 390 */ 1595, 1591, 1591, 1591, 1644, 1644, 1542, 1608, 1273, 1273, |
| 167960 | | - /* 400 */ 1273, 1273, 1608, 1292, 1292, 1274, 1274, 1273, 1608, 1240, |
| 167961 | | - /* 410 */ 1240, 1240, 1240, 1240, 1240, 1603, 1240, 1537, 1494, 1361, |
| 167962 | | - /* 420 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167963 | | - /* 430 */ 1240, 1240, 1240, 1240, 1548, 1240, 1240, 1240, 1240, 1240, |
| 167964 | | - /* 440 */ 1240, 1240, 1240, 1240, 1240, 1421, 1240, 1243, 1539, 1240, |
| 167965 | | - /* 450 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1398, 1399, 1362, |
| 167966 | | - /* 460 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1413, 1240, 1240, |
| 167967 | | - /* 470 */ 1240, 1408, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167968 | | - /* 480 */ 1635, 1240, 1240, 1240, 1240, 1240, 1240, 1508, 1507, 1240, |
| 167969 | | - /* 490 */ 1240, 1359, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167970 | | - /* 500 */ 1240, 1240, 1240, 1240, 1240, 1288, 1240, 1240, 1240, 1240, |
| 167971 | | - /* 510 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167972 | | - /* 520 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1386, |
| 167973 | | - /* 530 */ 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167974 | | - /* 540 */ 1240, 1240, 1240, 1240, 1578, 1376, 1240, 1240, 1240, 1240, |
| 167975 | | - /* 550 */ 1626, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, 1240, |
| 167976 | | - /* 560 */ 1240, 1240, 1240, 1240, 1240, 1619, 1332, 1423, 1240, 1422, |
| 167977 | | - /* 570 */ 1426, 1262, 1240, 1252, 1240, 1240, |
| 168537 | + /* 0 */ 1641, 1641, 1641, 1470, 1236, 1347, 1236, 1236, 1236, 1470, |
| 168538 | + /* 10 */ 1470, 1470, 1236, 1377, 1377, 1523, 1269, 1236, 1236, 1236, |
| 168539 | + /* 20 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1469, 1236, 1236, |
| 168540 | + /* 30 */ 1236, 1236, 1558, 1558, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168541 | + /* 40 */ 1236, 1236, 1386, 1236, 1393, 1236, 1236, 1236, 1236, 1236, |
| 168542 | + /* 50 */ 1471, 1472, 1236, 1236, 1236, 1522, 1524, 1487, 1400, 1399, |
| 168543 | + /* 60 */ 1398, 1397, 1505, 1365, 1391, 1384, 1388, 1465, 1466, 1464, |
| 168544 | + /* 70 */ 1468, 1472, 1471, 1236, 1387, 1433, 1449, 1432, 1236, 1236, |
| 168545 | + /* 80 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168546 | + /* 90 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168547 | + /* 100 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168548 | + /* 110 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168549 | + /* 120 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168550 | + /* 130 */ 1441, 1448, 1447, 1446, 1455, 1445, 1442, 1435, 1434, 1436, |
| 168551 | + /* 140 */ 1437, 1236, 1236, 1260, 1236, 1236, 1257, 1311, 1236, 1236, |
| 168552 | + /* 150 */ 1236, 1236, 1236, 1542, 1541, 1236, 1438, 1236, 1269, 1427, |
| 168553 | + /* 160 */ 1426, 1452, 1439, 1451, 1450, 1530, 1594, 1593, 1488, 1236, |
| 168554 | + /* 170 */ 1236, 1236, 1236, 1236, 1236, 1558, 1236, 1236, 1236, 1236, |
| 168555 | + /* 180 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168556 | + /* 190 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1367, |
| 168557 | + /* 200 */ 1558, 1558, 1236, 1269, 1558, 1558, 1368, 1368, 1265, 1265, |
| 168558 | + /* 210 */ 1371, 1236, 1537, 1338, 1338, 1338, 1338, 1347, 1338, 1236, |
| 168559 | + /* 220 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168560 | + /* 230 */ 1236, 1236, 1236, 1236, 1527, 1525, 1236, 1236, 1236, 1236, |
| 168561 | + /* 240 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168562 | + /* 250 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168563 | + /* 260 */ 1236, 1236, 1236, 1343, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168564 | + /* 270 */ 1236, 1236, 1236, 1236, 1236, 1587, 1236, 1500, 1325, 1343, |
| 168565 | + /* 280 */ 1343, 1343, 1343, 1345, 1326, 1324, 1337, 1270, 1243, 1633, |
| 168566 | + /* 290 */ 1403, 1392, 1344, 1392, 1630, 1390, 1403, 1403, 1390, 1403, |
| 168567 | + /* 300 */ 1344, 1630, 1286, 1609, 1281, 1377, 1377, 1377, 1367, 1367, |
| 168568 | + /* 310 */ 1367, 1367, 1371, 1371, 1467, 1344, 1337, 1236, 1633, 1633, |
| 168569 | + /* 320 */ 1353, 1353, 1632, 1632, 1353, 1488, 1617, 1412, 1314, 1320, |
| 168570 | + /* 330 */ 1320, 1320, 1320, 1353, 1254, 1390, 1617, 1617, 1390, 1412, |
| 168571 | + /* 340 */ 1314, 1390, 1314, 1390, 1353, 1254, 1504, 1627, 1353, 1254, |
| 168572 | + /* 350 */ 1478, 1353, 1254, 1353, 1254, 1478, 1312, 1312, 1312, 1301, |
| 168573 | + /* 360 */ 1236, 1236, 1478, 1312, 1286, 1312, 1301, 1312, 1312, 1576, |
| 168574 | + /* 370 */ 1236, 1482, 1482, 1478, 1353, 1568, 1568, 1380, 1380, 1385, |
| 168575 | + /* 380 */ 1371, 1473, 1353, 1236, 1385, 1383, 1381, 1390, 1304, 1590, |
| 168576 | + /* 390 */ 1590, 1586, 1586, 1586, 1638, 1638, 1537, 1602, 1269, 1269, |
| 168577 | + /* 400 */ 1269, 1269, 1602, 1288, 1288, 1270, 1270, 1269, 1602, 1236, |
| 168578 | + /* 410 */ 1236, 1236, 1236, 1236, 1236, 1597, 1236, 1532, 1489, 1357, |
| 168579 | + /* 420 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168580 | + /* 430 */ 1236, 1236, 1236, 1236, 1543, 1236, 1236, 1236, 1236, 1236, |
| 168581 | + /* 440 */ 1236, 1236, 1236, 1236, 1236, 1417, 1236, 1239, 1534, 1236, |
| 168582 | + /* 450 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1394, 1395, 1358, |
| 168583 | + /* 460 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1409, 1236, 1236, |
| 168584 | + /* 470 */ 1236, 1404, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168585 | + /* 480 */ 1629, 1236, 1236, 1236, 1236, 1236, 1236, 1503, 1502, 1236, |
| 168586 | + /* 490 */ 1236, 1355, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168587 | + /* 500 */ 1236, 1236, 1236, 1236, 1236, 1284, 1236, 1236, 1236, 1236, |
| 168588 | + /* 510 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168589 | + /* 520 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1382, |
| 168590 | + /* 530 */ 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168591 | + /* 540 */ 1236, 1236, 1236, 1236, 1573, 1372, 1236, 1236, 1236, 1236, |
| 168592 | + /* 550 */ 1620, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, 1236, |
| 168593 | + /* 560 */ 1236, 1236, 1236, 1236, 1236, 1613, 1328, 1418, 1236, 1421, |
| 168594 | + /* 570 */ 1258, 1236, 1248, 1236, 1236, |
| 167978 | 168595 | }; |
| 167979 | 168596 | /********** End of lemon-generated parsing tables *****************************/ |
| 167980 | 168597 | |
| 167981 | 168598 | /* The next table maps tokens (terminal symbols) into fallback tokens. |
| 167982 | 168599 | ** If a construct like the following: |
| | @@ -168769,237 +169386,235 @@ |
| 168769 | 169386 | /* 173 */ "idlist_opt ::=", |
| 168770 | 169387 | /* 174 */ "idlist_opt ::= LP idlist RP", |
| 168771 | 169388 | /* 175 */ "idlist ::= idlist COMMA nm", |
| 168772 | 169389 | /* 176 */ "idlist ::= nm", |
| 168773 | 169390 | /* 177 */ "expr ::= LP expr RP", |
| 168774 | | - /* 178 */ "expr ::= ID|INDEXED", |
| 168775 | | - /* 179 */ "expr ::= JOIN_KW", |
| 168776 | | - /* 180 */ "expr ::= nm DOT nm", |
| 168777 | | - /* 181 */ "expr ::= nm DOT nm DOT nm", |
| 168778 | | - /* 182 */ "term ::= NULL|FLOAT|BLOB", |
| 168779 | | - /* 183 */ "term ::= STRING", |
| 168780 | | - /* 184 */ "term ::= INTEGER", |
| 168781 | | - /* 185 */ "expr ::= VARIABLE", |
| 168782 | | - /* 186 */ "expr ::= expr COLLATE ID|STRING", |
| 168783 | | - /* 187 */ "expr ::= CAST LP expr AS typetoken RP", |
| 168784 | | - /* 188 */ "expr ::= ID|INDEXED LP distinct exprlist RP", |
| 168785 | | - /* 189 */ "expr ::= ID|INDEXED LP STAR RP", |
| 168786 | | - /* 190 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over", |
| 168787 | | - /* 191 */ "expr ::= ID|INDEXED LP STAR RP filter_over", |
| 168788 | | - /* 192 */ "term ::= CTIME_KW", |
| 168789 | | - /* 193 */ "expr ::= LP nexprlist COMMA expr RP", |
| 168790 | | - /* 194 */ "expr ::= expr AND expr", |
| 168791 | | - /* 195 */ "expr ::= expr OR expr", |
| 168792 | | - /* 196 */ "expr ::= expr LT|GT|GE|LE expr", |
| 168793 | | - /* 197 */ "expr ::= expr EQ|NE expr", |
| 168794 | | - /* 198 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", |
| 168795 | | - /* 199 */ "expr ::= expr PLUS|MINUS expr", |
| 168796 | | - /* 200 */ "expr ::= expr STAR|SLASH|REM expr", |
| 168797 | | - /* 201 */ "expr ::= expr CONCAT expr", |
| 168798 | | - /* 202 */ "likeop ::= NOT LIKE_KW|MATCH", |
| 168799 | | - /* 203 */ "expr ::= expr likeop expr", |
| 168800 | | - /* 204 */ "expr ::= expr likeop expr ESCAPE expr", |
| 168801 | | - /* 205 */ "expr ::= expr ISNULL|NOTNULL", |
| 168802 | | - /* 206 */ "expr ::= expr NOT NULL", |
| 168803 | | - /* 207 */ "expr ::= expr IS expr", |
| 168804 | | - /* 208 */ "expr ::= expr IS NOT expr", |
| 168805 | | - /* 209 */ "expr ::= expr IS NOT DISTINCT FROM expr", |
| 168806 | | - /* 210 */ "expr ::= expr IS DISTINCT FROM expr", |
| 168807 | | - /* 211 */ "expr ::= NOT expr", |
| 168808 | | - /* 212 */ "expr ::= BITNOT expr", |
| 168809 | | - /* 213 */ "expr ::= PLUS|MINUS expr", |
| 168810 | | - /* 214 */ "expr ::= expr PTR expr", |
| 168811 | | - /* 215 */ "between_op ::= BETWEEN", |
| 168812 | | - /* 216 */ "between_op ::= NOT BETWEEN", |
| 168813 | | - /* 217 */ "expr ::= expr between_op expr AND expr", |
| 168814 | | - /* 218 */ "in_op ::= IN", |
| 168815 | | - /* 219 */ "in_op ::= NOT IN", |
| 168816 | | - /* 220 */ "expr ::= expr in_op LP exprlist RP", |
| 168817 | | - /* 221 */ "expr ::= LP select RP", |
| 168818 | | - /* 222 */ "expr ::= expr in_op LP select RP", |
| 168819 | | - /* 223 */ "expr ::= expr in_op nm dbnm paren_exprlist", |
| 168820 | | - /* 224 */ "expr ::= EXISTS LP select RP", |
| 168821 | | - /* 225 */ "expr ::= CASE case_operand case_exprlist case_else END", |
| 168822 | | - /* 226 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", |
| 168823 | | - /* 227 */ "case_exprlist ::= WHEN expr THEN expr", |
| 168824 | | - /* 228 */ "case_else ::= ELSE expr", |
| 168825 | | - /* 229 */ "case_else ::=", |
| 168826 | | - /* 230 */ "case_operand ::= expr", |
| 168827 | | - /* 231 */ "case_operand ::=", |
| 168828 | | - /* 232 */ "exprlist ::=", |
| 168829 | | - /* 233 */ "nexprlist ::= nexprlist COMMA expr", |
| 168830 | | - /* 234 */ "nexprlist ::= expr", |
| 168831 | | - /* 235 */ "paren_exprlist ::=", |
| 168832 | | - /* 236 */ "paren_exprlist ::= LP exprlist RP", |
| 168833 | | - /* 237 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", |
| 168834 | | - /* 238 */ "uniqueflag ::= UNIQUE", |
| 168835 | | - /* 239 */ "uniqueflag ::=", |
| 168836 | | - /* 240 */ "eidlist_opt ::=", |
| 168837 | | - /* 241 */ "eidlist_opt ::= LP eidlist RP", |
| 168838 | | - /* 242 */ "eidlist ::= eidlist COMMA nm collate sortorder", |
| 168839 | | - /* 243 */ "eidlist ::= nm collate sortorder", |
| 168840 | | - /* 244 */ "collate ::=", |
| 168841 | | - /* 245 */ "collate ::= COLLATE ID|STRING", |
| 168842 | | - /* 246 */ "cmd ::= DROP INDEX ifexists fullname", |
| 168843 | | - /* 247 */ "cmd ::= VACUUM vinto", |
| 168844 | | - /* 248 */ "cmd ::= VACUUM nm vinto", |
| 168845 | | - /* 249 */ "vinto ::= INTO expr", |
| 168846 | | - /* 250 */ "vinto ::=", |
| 168847 | | - /* 251 */ "cmd ::= PRAGMA nm dbnm", |
| 168848 | | - /* 252 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", |
| 168849 | | - /* 253 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", |
| 168850 | | - /* 254 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", |
| 168851 | | - /* 255 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", |
| 168852 | | - /* 256 */ "plus_num ::= PLUS INTEGER|FLOAT", |
| 168853 | | - /* 257 */ "minus_num ::= MINUS INTEGER|FLOAT", |
| 168854 | | - /* 258 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", |
| 168855 | | - /* 259 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", |
| 168856 | | - /* 260 */ "trigger_time ::= BEFORE|AFTER", |
| 168857 | | - /* 261 */ "trigger_time ::= INSTEAD OF", |
| 168858 | | - /* 262 */ "trigger_time ::=", |
| 168859 | | - /* 263 */ "trigger_event ::= DELETE|INSERT", |
| 168860 | | - /* 264 */ "trigger_event ::= UPDATE", |
| 168861 | | - /* 265 */ "trigger_event ::= UPDATE OF idlist", |
| 168862 | | - /* 266 */ "when_clause ::=", |
| 168863 | | - /* 267 */ "when_clause ::= WHEN expr", |
| 168864 | | - /* 268 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", |
| 168865 | | - /* 269 */ "trigger_cmd_list ::= trigger_cmd SEMI", |
| 168866 | | - /* 270 */ "trnm ::= nm DOT nm", |
| 168867 | | - /* 271 */ "tridxby ::= INDEXED BY nm", |
| 168868 | | - /* 272 */ "tridxby ::= NOT INDEXED", |
| 168869 | | - /* 273 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt", |
| 168870 | | - /* 274 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", |
| 168871 | | - /* 275 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", |
| 168872 | | - /* 276 */ "trigger_cmd ::= scanpt select scanpt", |
| 168873 | | - /* 277 */ "expr ::= RAISE LP IGNORE RP", |
| 168874 | | - /* 278 */ "expr ::= RAISE LP raisetype COMMA nm RP", |
| 168875 | | - /* 279 */ "raisetype ::= ROLLBACK", |
| 168876 | | - /* 280 */ "raisetype ::= ABORT", |
| 168877 | | - /* 281 */ "raisetype ::= FAIL", |
| 168878 | | - /* 282 */ "cmd ::= DROP TRIGGER ifexists fullname", |
| 168879 | | - /* 283 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", |
| 168880 | | - /* 284 */ "cmd ::= DETACH database_kw_opt expr", |
| 168881 | | - /* 285 */ "key_opt ::=", |
| 168882 | | - /* 286 */ "key_opt ::= KEY expr", |
| 168883 | | - /* 287 */ "cmd ::= REINDEX", |
| 168884 | | - /* 288 */ "cmd ::= REINDEX nm dbnm", |
| 168885 | | - /* 289 */ "cmd ::= ANALYZE", |
| 168886 | | - /* 290 */ "cmd ::= ANALYZE nm dbnm", |
| 168887 | | - /* 291 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", |
| 168888 | | - /* 292 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", |
| 168889 | | - /* 293 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm", |
| 168890 | | - /* 294 */ "add_column_fullname ::= fullname", |
| 168891 | | - /* 295 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", |
| 168892 | | - /* 296 */ "cmd ::= create_vtab", |
| 168893 | | - /* 297 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 168894 | | - /* 298 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 168895 | | - /* 299 */ "vtabarg ::=", |
| 168896 | | - /* 300 */ "vtabargtoken ::= ANY", |
| 168897 | | - /* 301 */ "vtabargtoken ::= lp anylist RP", |
| 168898 | | - /* 302 */ "lp ::= LP", |
| 168899 | | - /* 303 */ "with ::= WITH wqlist", |
| 168900 | | - /* 304 */ "with ::= WITH RECURSIVE wqlist", |
| 168901 | | - /* 305 */ "wqas ::= AS", |
| 168902 | | - /* 306 */ "wqas ::= AS MATERIALIZED", |
| 168903 | | - /* 307 */ "wqas ::= AS NOT MATERIALIZED", |
| 168904 | | - /* 308 */ "wqitem ::= nm eidlist_opt wqas LP select RP", |
| 168905 | | - /* 309 */ "wqlist ::= wqitem", |
| 168906 | | - /* 310 */ "wqlist ::= wqlist COMMA wqitem", |
| 168907 | | - /* 311 */ "windowdefn_list ::= windowdefn", |
| 168908 | | - /* 312 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", |
| 168909 | | - /* 313 */ "windowdefn ::= nm AS LP window RP", |
| 168910 | | - /* 314 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", |
| 168911 | | - /* 315 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", |
| 168912 | | - /* 316 */ "window ::= ORDER BY sortlist frame_opt", |
| 168913 | | - /* 317 */ "window ::= nm ORDER BY sortlist frame_opt", |
| 168914 | | - /* 318 */ "window ::= frame_opt", |
| 168915 | | - /* 319 */ "window ::= nm frame_opt", |
| 168916 | | - /* 320 */ "frame_opt ::=", |
| 168917 | | - /* 321 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", |
| 168918 | | - /* 322 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", |
| 168919 | | - /* 323 */ "range_or_rows ::= RANGE|ROWS|GROUPS", |
| 168920 | | - /* 324 */ "frame_bound_s ::= frame_bound", |
| 168921 | | - /* 325 */ "frame_bound_s ::= UNBOUNDED PRECEDING", |
| 168922 | | - /* 326 */ "frame_bound_e ::= frame_bound", |
| 168923 | | - /* 327 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", |
| 168924 | | - /* 328 */ "frame_bound ::= expr PRECEDING|FOLLOWING", |
| 168925 | | - /* 329 */ "frame_bound ::= CURRENT ROW", |
| 168926 | | - /* 330 */ "frame_exclude_opt ::=", |
| 168927 | | - /* 331 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", |
| 168928 | | - /* 332 */ "frame_exclude ::= NO OTHERS", |
| 168929 | | - /* 333 */ "frame_exclude ::= CURRENT ROW", |
| 168930 | | - /* 334 */ "frame_exclude ::= GROUP|TIES", |
| 168931 | | - /* 335 */ "window_clause ::= WINDOW windowdefn_list", |
| 168932 | | - /* 336 */ "filter_over ::= filter_clause over_clause", |
| 168933 | | - /* 337 */ "filter_over ::= over_clause", |
| 168934 | | - /* 338 */ "filter_over ::= filter_clause", |
| 168935 | | - /* 339 */ "over_clause ::= OVER LP window RP", |
| 168936 | | - /* 340 */ "over_clause ::= OVER nm", |
| 168937 | | - /* 341 */ "filter_clause ::= FILTER LP WHERE expr RP", |
| 168938 | | - /* 342 */ "input ::= cmdlist", |
| 168939 | | - /* 343 */ "cmdlist ::= cmdlist ecmd", |
| 168940 | | - /* 344 */ "cmdlist ::= ecmd", |
| 168941 | | - /* 345 */ "ecmd ::= SEMI", |
| 168942 | | - /* 346 */ "ecmd ::= cmdx SEMI", |
| 168943 | | - /* 347 */ "ecmd ::= explain cmdx SEMI", |
| 168944 | | - /* 348 */ "trans_opt ::=", |
| 168945 | | - /* 349 */ "trans_opt ::= TRANSACTION", |
| 168946 | | - /* 350 */ "trans_opt ::= TRANSACTION nm", |
| 168947 | | - /* 351 */ "savepoint_opt ::= SAVEPOINT", |
| 168948 | | - /* 352 */ "savepoint_opt ::=", |
| 168949 | | - /* 353 */ "cmd ::= create_table create_table_args", |
| 168950 | | - /* 354 */ "table_option_set ::= table_option", |
| 168951 | | - /* 355 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 168952 | | - /* 356 */ "columnlist ::= columnname carglist", |
| 168953 | | - /* 357 */ "nm ::= ID|INDEXED", |
| 168954 | | - /* 358 */ "nm ::= STRING", |
| 168955 | | - /* 359 */ "nm ::= JOIN_KW", |
| 168956 | | - /* 360 */ "typetoken ::= typename", |
| 168957 | | - /* 361 */ "typename ::= ID|STRING", |
| 168958 | | - /* 362 */ "signed ::= plus_num", |
| 168959 | | - /* 363 */ "signed ::= minus_num", |
| 168960 | | - /* 364 */ "carglist ::= carglist ccons", |
| 168961 | | - /* 365 */ "carglist ::=", |
| 168962 | | - /* 366 */ "ccons ::= NULL onconf", |
| 168963 | | - /* 367 */ "ccons ::= GENERATED ALWAYS AS generated", |
| 168964 | | - /* 368 */ "ccons ::= AS generated", |
| 168965 | | - /* 369 */ "conslist_opt ::= COMMA conslist", |
| 168966 | | - /* 370 */ "conslist ::= conslist tconscomma tcons", |
| 168967 | | - /* 371 */ "conslist ::= tcons", |
| 168968 | | - /* 372 */ "tconscomma ::=", |
| 168969 | | - /* 373 */ "defer_subclause_opt ::= defer_subclause", |
| 168970 | | - /* 374 */ "resolvetype ::= raisetype", |
| 168971 | | - /* 375 */ "selectnowith ::= oneselect", |
| 168972 | | - /* 376 */ "oneselect ::= values", |
| 168973 | | - /* 377 */ "sclp ::= selcollist COMMA", |
| 168974 | | - /* 378 */ "as ::= ID|STRING", |
| 168975 | | - /* 379 */ "indexed_opt ::= indexed_by", |
| 168976 | | - /* 380 */ "returning ::=", |
| 168977 | | - /* 381 */ "expr ::= term", |
| 168978 | | - /* 382 */ "likeop ::= LIKE_KW|MATCH", |
| 168979 | | - /* 383 */ "exprlist ::= nexprlist", |
| 168980 | | - /* 384 */ "nmnum ::= plus_num", |
| 168981 | | - /* 385 */ "nmnum ::= nm", |
| 168982 | | - /* 386 */ "nmnum ::= ON", |
| 168983 | | - /* 387 */ "nmnum ::= DELETE", |
| 168984 | | - /* 388 */ "nmnum ::= DEFAULT", |
| 168985 | | - /* 389 */ "plus_num ::= INTEGER|FLOAT", |
| 168986 | | - /* 390 */ "foreach_clause ::=", |
| 168987 | | - /* 391 */ "foreach_clause ::= FOR EACH ROW", |
| 168988 | | - /* 392 */ "trnm ::= nm", |
| 168989 | | - /* 393 */ "tridxby ::=", |
| 168990 | | - /* 394 */ "database_kw_opt ::= DATABASE", |
| 168991 | | - /* 395 */ "database_kw_opt ::=", |
| 168992 | | - /* 396 */ "kwcolumn_opt ::=", |
| 168993 | | - /* 397 */ "kwcolumn_opt ::= COLUMNKW", |
| 168994 | | - /* 398 */ "vtabarglist ::= vtabarg", |
| 168995 | | - /* 399 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 168996 | | - /* 400 */ "vtabarg ::= vtabarg vtabargtoken", |
| 168997 | | - /* 401 */ "anylist ::=", |
| 168998 | | - /* 402 */ "anylist ::= anylist LP anylist RP", |
| 168999 | | - /* 403 */ "anylist ::= anylist ANY", |
| 169000 | | - /* 404 */ "with ::=", |
| 169391 | + /* 178 */ "expr ::= ID|INDEXED|JOIN_KW", |
| 169392 | + /* 179 */ "expr ::= nm DOT nm", |
| 169393 | + /* 180 */ "expr ::= nm DOT nm DOT nm", |
| 169394 | + /* 181 */ "term ::= NULL|FLOAT|BLOB", |
| 169395 | + /* 182 */ "term ::= STRING", |
| 169396 | + /* 183 */ "term ::= INTEGER", |
| 169397 | + /* 184 */ "expr ::= VARIABLE", |
| 169398 | + /* 185 */ "expr ::= expr COLLATE ID|STRING", |
| 169399 | + /* 186 */ "expr ::= CAST LP expr AS typetoken RP", |
| 169400 | + /* 187 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP", |
| 169401 | + /* 188 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP", |
| 169402 | + /* 189 */ "expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over", |
| 169403 | + /* 190 */ "expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over", |
| 169404 | + /* 191 */ "term ::= CTIME_KW", |
| 169405 | + /* 192 */ "expr ::= LP nexprlist COMMA expr RP", |
| 169406 | + /* 193 */ "expr ::= expr AND expr", |
| 169407 | + /* 194 */ "expr ::= expr OR expr", |
| 169408 | + /* 195 */ "expr ::= expr LT|GT|GE|LE expr", |
| 169409 | + /* 196 */ "expr ::= expr EQ|NE expr", |
| 169410 | + /* 197 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", |
| 169411 | + /* 198 */ "expr ::= expr PLUS|MINUS expr", |
| 169412 | + /* 199 */ "expr ::= expr STAR|SLASH|REM expr", |
| 169413 | + /* 200 */ "expr ::= expr CONCAT expr", |
| 169414 | + /* 201 */ "likeop ::= NOT LIKE_KW|MATCH", |
| 169415 | + /* 202 */ "expr ::= expr likeop expr", |
| 169416 | + /* 203 */ "expr ::= expr likeop expr ESCAPE expr", |
| 169417 | + /* 204 */ "expr ::= expr ISNULL|NOTNULL", |
| 169418 | + /* 205 */ "expr ::= expr NOT NULL", |
| 169419 | + /* 206 */ "expr ::= expr IS expr", |
| 169420 | + /* 207 */ "expr ::= expr IS NOT expr", |
| 169421 | + /* 208 */ "expr ::= expr IS NOT DISTINCT FROM expr", |
| 169422 | + /* 209 */ "expr ::= expr IS DISTINCT FROM expr", |
| 169423 | + /* 210 */ "expr ::= NOT expr", |
| 169424 | + /* 211 */ "expr ::= BITNOT expr", |
| 169425 | + /* 212 */ "expr ::= PLUS|MINUS expr", |
| 169426 | + /* 213 */ "expr ::= expr PTR expr", |
| 169427 | + /* 214 */ "between_op ::= BETWEEN", |
| 169428 | + /* 215 */ "between_op ::= NOT BETWEEN", |
| 169429 | + /* 216 */ "expr ::= expr between_op expr AND expr", |
| 169430 | + /* 217 */ "in_op ::= IN", |
| 169431 | + /* 218 */ "in_op ::= NOT IN", |
| 169432 | + /* 219 */ "expr ::= expr in_op LP exprlist RP", |
| 169433 | + /* 220 */ "expr ::= LP select RP", |
| 169434 | + /* 221 */ "expr ::= expr in_op LP select RP", |
| 169435 | + /* 222 */ "expr ::= expr in_op nm dbnm paren_exprlist", |
| 169436 | + /* 223 */ "expr ::= EXISTS LP select RP", |
| 169437 | + /* 224 */ "expr ::= CASE case_operand case_exprlist case_else END", |
| 169438 | + /* 225 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", |
| 169439 | + /* 226 */ "case_exprlist ::= WHEN expr THEN expr", |
| 169440 | + /* 227 */ "case_else ::= ELSE expr", |
| 169441 | + /* 228 */ "case_else ::=", |
| 169442 | + /* 229 */ "case_operand ::= expr", |
| 169443 | + /* 230 */ "case_operand ::=", |
| 169444 | + /* 231 */ "exprlist ::=", |
| 169445 | + /* 232 */ "nexprlist ::= nexprlist COMMA expr", |
| 169446 | + /* 233 */ "nexprlist ::= expr", |
| 169447 | + /* 234 */ "paren_exprlist ::=", |
| 169448 | + /* 235 */ "paren_exprlist ::= LP exprlist RP", |
| 169449 | + /* 236 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", |
| 169450 | + /* 237 */ "uniqueflag ::= UNIQUE", |
| 169451 | + /* 238 */ "uniqueflag ::=", |
| 169452 | + /* 239 */ "eidlist_opt ::=", |
| 169453 | + /* 240 */ "eidlist_opt ::= LP eidlist RP", |
| 169454 | + /* 241 */ "eidlist ::= eidlist COMMA nm collate sortorder", |
| 169455 | + /* 242 */ "eidlist ::= nm collate sortorder", |
| 169456 | + /* 243 */ "collate ::=", |
| 169457 | + /* 244 */ "collate ::= COLLATE ID|STRING", |
| 169458 | + /* 245 */ "cmd ::= DROP INDEX ifexists fullname", |
| 169459 | + /* 246 */ "cmd ::= VACUUM vinto", |
| 169460 | + /* 247 */ "cmd ::= VACUUM nm vinto", |
| 169461 | + /* 248 */ "vinto ::= INTO expr", |
| 169462 | + /* 249 */ "vinto ::=", |
| 169463 | + /* 250 */ "cmd ::= PRAGMA nm dbnm", |
| 169464 | + /* 251 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", |
| 169465 | + /* 252 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", |
| 169466 | + /* 253 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", |
| 169467 | + /* 254 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", |
| 169468 | + /* 255 */ "plus_num ::= PLUS INTEGER|FLOAT", |
| 169469 | + /* 256 */ "minus_num ::= MINUS INTEGER|FLOAT", |
| 169470 | + /* 257 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", |
| 169471 | + /* 258 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", |
| 169472 | + /* 259 */ "trigger_time ::= BEFORE|AFTER", |
| 169473 | + /* 260 */ "trigger_time ::= INSTEAD OF", |
| 169474 | + /* 261 */ "trigger_time ::=", |
| 169475 | + /* 262 */ "trigger_event ::= DELETE|INSERT", |
| 169476 | + /* 263 */ "trigger_event ::= UPDATE", |
| 169477 | + /* 264 */ "trigger_event ::= UPDATE OF idlist", |
| 169478 | + /* 265 */ "when_clause ::=", |
| 169479 | + /* 266 */ "when_clause ::= WHEN expr", |
| 169480 | + /* 267 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", |
| 169481 | + /* 268 */ "trigger_cmd_list ::= trigger_cmd SEMI", |
| 169482 | + /* 269 */ "trnm ::= nm DOT nm", |
| 169483 | + /* 270 */ "tridxby ::= INDEXED BY nm", |
| 169484 | + /* 271 */ "tridxby ::= NOT INDEXED", |
| 169485 | + /* 272 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt", |
| 169486 | + /* 273 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", |
| 169487 | + /* 274 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", |
| 169488 | + /* 275 */ "trigger_cmd ::= scanpt select scanpt", |
| 169489 | + /* 276 */ "expr ::= RAISE LP IGNORE RP", |
| 169490 | + /* 277 */ "expr ::= RAISE LP raisetype COMMA nm RP", |
| 169491 | + /* 278 */ "raisetype ::= ROLLBACK", |
| 169492 | + /* 279 */ "raisetype ::= ABORT", |
| 169493 | + /* 280 */ "raisetype ::= FAIL", |
| 169494 | + /* 281 */ "cmd ::= DROP TRIGGER ifexists fullname", |
| 169495 | + /* 282 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", |
| 169496 | + /* 283 */ "cmd ::= DETACH database_kw_opt expr", |
| 169497 | + /* 284 */ "key_opt ::=", |
| 169498 | + /* 285 */ "key_opt ::= KEY expr", |
| 169499 | + /* 286 */ "cmd ::= REINDEX", |
| 169500 | + /* 287 */ "cmd ::= REINDEX nm dbnm", |
| 169501 | + /* 288 */ "cmd ::= ANALYZE", |
| 169502 | + /* 289 */ "cmd ::= ANALYZE nm dbnm", |
| 169503 | + /* 290 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", |
| 169504 | + /* 291 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", |
| 169505 | + /* 292 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm", |
| 169506 | + /* 293 */ "add_column_fullname ::= fullname", |
| 169507 | + /* 294 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", |
| 169508 | + /* 295 */ "cmd ::= create_vtab", |
| 169509 | + /* 296 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 169510 | + /* 297 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 169511 | + /* 298 */ "vtabarg ::=", |
| 169512 | + /* 299 */ "vtabargtoken ::= ANY", |
| 169513 | + /* 300 */ "vtabargtoken ::= lp anylist RP", |
| 169514 | + /* 301 */ "lp ::= LP", |
| 169515 | + /* 302 */ "with ::= WITH wqlist", |
| 169516 | + /* 303 */ "with ::= WITH RECURSIVE wqlist", |
| 169517 | + /* 304 */ "wqas ::= AS", |
| 169518 | + /* 305 */ "wqas ::= AS MATERIALIZED", |
| 169519 | + /* 306 */ "wqas ::= AS NOT MATERIALIZED", |
| 169520 | + /* 307 */ "wqitem ::= nm eidlist_opt wqas LP select RP", |
| 169521 | + /* 308 */ "wqlist ::= wqitem", |
| 169522 | + /* 309 */ "wqlist ::= wqlist COMMA wqitem", |
| 169523 | + /* 310 */ "windowdefn_list ::= windowdefn", |
| 169524 | + /* 311 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", |
| 169525 | + /* 312 */ "windowdefn ::= nm AS LP window RP", |
| 169526 | + /* 313 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", |
| 169527 | + /* 314 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", |
| 169528 | + /* 315 */ "window ::= ORDER BY sortlist frame_opt", |
| 169529 | + /* 316 */ "window ::= nm ORDER BY sortlist frame_opt", |
| 169530 | + /* 317 */ "window ::= frame_opt", |
| 169531 | + /* 318 */ "window ::= nm frame_opt", |
| 169532 | + /* 319 */ "frame_opt ::=", |
| 169533 | + /* 320 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", |
| 169534 | + /* 321 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", |
| 169535 | + /* 322 */ "range_or_rows ::= RANGE|ROWS|GROUPS", |
| 169536 | + /* 323 */ "frame_bound_s ::= frame_bound", |
| 169537 | + /* 324 */ "frame_bound_s ::= UNBOUNDED PRECEDING", |
| 169538 | + /* 325 */ "frame_bound_e ::= frame_bound", |
| 169539 | + /* 326 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", |
| 169540 | + /* 327 */ "frame_bound ::= expr PRECEDING|FOLLOWING", |
| 169541 | + /* 328 */ "frame_bound ::= CURRENT ROW", |
| 169542 | + /* 329 */ "frame_exclude_opt ::=", |
| 169543 | + /* 330 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", |
| 169544 | + /* 331 */ "frame_exclude ::= NO OTHERS", |
| 169545 | + /* 332 */ "frame_exclude ::= CURRENT ROW", |
| 169546 | + /* 333 */ "frame_exclude ::= GROUP|TIES", |
| 169547 | + /* 334 */ "window_clause ::= WINDOW windowdefn_list", |
| 169548 | + /* 335 */ "filter_over ::= filter_clause over_clause", |
| 169549 | + /* 336 */ "filter_over ::= over_clause", |
| 169550 | + /* 337 */ "filter_over ::= filter_clause", |
| 169551 | + /* 338 */ "over_clause ::= OVER LP window RP", |
| 169552 | + /* 339 */ "over_clause ::= OVER nm", |
| 169553 | + /* 340 */ "filter_clause ::= FILTER LP WHERE expr RP", |
| 169554 | + /* 341 */ "input ::= cmdlist", |
| 169555 | + /* 342 */ "cmdlist ::= cmdlist ecmd", |
| 169556 | + /* 343 */ "cmdlist ::= ecmd", |
| 169557 | + /* 344 */ "ecmd ::= SEMI", |
| 169558 | + /* 345 */ "ecmd ::= cmdx SEMI", |
| 169559 | + /* 346 */ "ecmd ::= explain cmdx SEMI", |
| 169560 | + /* 347 */ "trans_opt ::=", |
| 169561 | + /* 348 */ "trans_opt ::= TRANSACTION", |
| 169562 | + /* 349 */ "trans_opt ::= TRANSACTION nm", |
| 169563 | + /* 350 */ "savepoint_opt ::= SAVEPOINT", |
| 169564 | + /* 351 */ "savepoint_opt ::=", |
| 169565 | + /* 352 */ "cmd ::= create_table create_table_args", |
| 169566 | + /* 353 */ "table_option_set ::= table_option", |
| 169567 | + /* 354 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 169568 | + /* 355 */ "columnlist ::= columnname carglist", |
| 169569 | + /* 356 */ "nm ::= ID|INDEXED|JOIN_KW", |
| 169570 | + /* 357 */ "nm ::= STRING", |
| 169571 | + /* 358 */ "typetoken ::= typename", |
| 169572 | + /* 359 */ "typename ::= ID|STRING", |
| 169573 | + /* 360 */ "signed ::= plus_num", |
| 169574 | + /* 361 */ "signed ::= minus_num", |
| 169575 | + /* 362 */ "carglist ::= carglist ccons", |
| 169576 | + /* 363 */ "carglist ::=", |
| 169577 | + /* 364 */ "ccons ::= NULL onconf", |
| 169578 | + /* 365 */ "ccons ::= GENERATED ALWAYS AS generated", |
| 169579 | + /* 366 */ "ccons ::= AS generated", |
| 169580 | + /* 367 */ "conslist_opt ::= COMMA conslist", |
| 169581 | + /* 368 */ "conslist ::= conslist tconscomma tcons", |
| 169582 | + /* 369 */ "conslist ::= tcons", |
| 169583 | + /* 370 */ "tconscomma ::=", |
| 169584 | + /* 371 */ "defer_subclause_opt ::= defer_subclause", |
| 169585 | + /* 372 */ "resolvetype ::= raisetype", |
| 169586 | + /* 373 */ "selectnowith ::= oneselect", |
| 169587 | + /* 374 */ "oneselect ::= values", |
| 169588 | + /* 375 */ "sclp ::= selcollist COMMA", |
| 169589 | + /* 376 */ "as ::= ID|STRING", |
| 169590 | + /* 377 */ "indexed_opt ::= indexed_by", |
| 169591 | + /* 378 */ "returning ::=", |
| 169592 | + /* 379 */ "expr ::= term", |
| 169593 | + /* 380 */ "likeop ::= LIKE_KW|MATCH", |
| 169594 | + /* 381 */ "exprlist ::= nexprlist", |
| 169595 | + /* 382 */ "nmnum ::= plus_num", |
| 169596 | + /* 383 */ "nmnum ::= nm", |
| 169597 | + /* 384 */ "nmnum ::= ON", |
| 169598 | + /* 385 */ "nmnum ::= DELETE", |
| 169599 | + /* 386 */ "nmnum ::= DEFAULT", |
| 169600 | + /* 387 */ "plus_num ::= INTEGER|FLOAT", |
| 169601 | + /* 388 */ "foreach_clause ::=", |
| 169602 | + /* 389 */ "foreach_clause ::= FOR EACH ROW", |
| 169603 | + /* 390 */ "trnm ::= nm", |
| 169604 | + /* 391 */ "tridxby ::=", |
| 169605 | + /* 392 */ "database_kw_opt ::= DATABASE", |
| 169606 | + /* 393 */ "database_kw_opt ::=", |
| 169607 | + /* 394 */ "kwcolumn_opt ::=", |
| 169608 | + /* 395 */ "kwcolumn_opt ::= COLUMNKW", |
| 169609 | + /* 396 */ "vtabarglist ::= vtabarg", |
| 169610 | + /* 397 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 169611 | + /* 398 */ "vtabarg ::= vtabarg vtabargtoken", |
| 169612 | + /* 399 */ "anylist ::=", |
| 169613 | + /* 400 */ "anylist ::= anylist LP anylist RP", |
| 169614 | + /* 401 */ "anylist ::= anylist ANY", |
| 169615 | + /* 402 */ "with ::=", |
| 169001 | 169616 | }; |
| 169002 | 169617 | #endif /* NDEBUG */ |
| 169003 | 169618 | |
| 169004 | 169619 | |
| 169005 | 169620 | #if YYSTACKDEPTH<=0 |
| | @@ -169680,237 +170295,235 @@ |
| 169680 | 170295 | 270, /* (173) idlist_opt ::= */ |
| 169681 | 170296 | 270, /* (174) idlist_opt ::= LP idlist RP */ |
| 169682 | 170297 | 263, /* (175) idlist ::= idlist COMMA nm */ |
| 169683 | 170298 | 263, /* (176) idlist ::= nm */ |
| 169684 | 170299 | 217, /* (177) expr ::= LP expr RP */ |
| 169685 | | - 217, /* (178) expr ::= ID|INDEXED */ |
| 169686 | | - 217, /* (179) expr ::= JOIN_KW */ |
| 169687 | | - 217, /* (180) expr ::= nm DOT nm */ |
| 169688 | | - 217, /* (181) expr ::= nm DOT nm DOT nm */ |
| 169689 | | - 216, /* (182) term ::= NULL|FLOAT|BLOB */ |
| 169690 | | - 216, /* (183) term ::= STRING */ |
| 169691 | | - 216, /* (184) term ::= INTEGER */ |
| 169692 | | - 217, /* (185) expr ::= VARIABLE */ |
| 169693 | | - 217, /* (186) expr ::= expr COLLATE ID|STRING */ |
| 169694 | | - 217, /* (187) expr ::= CAST LP expr AS typetoken RP */ |
| 169695 | | - 217, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 169696 | | - 217, /* (189) expr ::= ID|INDEXED LP STAR RP */ |
| 169697 | | - 217, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ |
| 169698 | | - 217, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */ |
| 169699 | | - 216, /* (192) term ::= CTIME_KW */ |
| 169700 | | - 217, /* (193) expr ::= LP nexprlist COMMA expr RP */ |
| 169701 | | - 217, /* (194) expr ::= expr AND expr */ |
| 169702 | | - 217, /* (195) expr ::= expr OR expr */ |
| 169703 | | - 217, /* (196) expr ::= expr LT|GT|GE|LE expr */ |
| 169704 | | - 217, /* (197) expr ::= expr EQ|NE expr */ |
| 169705 | | - 217, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ |
| 169706 | | - 217, /* (199) expr ::= expr PLUS|MINUS expr */ |
| 169707 | | - 217, /* (200) expr ::= expr STAR|SLASH|REM expr */ |
| 169708 | | - 217, /* (201) expr ::= expr CONCAT expr */ |
| 169709 | | - 274, /* (202) likeop ::= NOT LIKE_KW|MATCH */ |
| 169710 | | - 217, /* (203) expr ::= expr likeop expr */ |
| 169711 | | - 217, /* (204) expr ::= expr likeop expr ESCAPE expr */ |
| 169712 | | - 217, /* (205) expr ::= expr ISNULL|NOTNULL */ |
| 169713 | | - 217, /* (206) expr ::= expr NOT NULL */ |
| 169714 | | - 217, /* (207) expr ::= expr IS expr */ |
| 169715 | | - 217, /* (208) expr ::= expr IS NOT expr */ |
| 169716 | | - 217, /* (209) expr ::= expr IS NOT DISTINCT FROM expr */ |
| 169717 | | - 217, /* (210) expr ::= expr IS DISTINCT FROM expr */ |
| 169718 | | - 217, /* (211) expr ::= NOT expr */ |
| 169719 | | - 217, /* (212) expr ::= BITNOT expr */ |
| 169720 | | - 217, /* (213) expr ::= PLUS|MINUS expr */ |
| 169721 | | - 217, /* (214) expr ::= expr PTR expr */ |
| 169722 | | - 275, /* (215) between_op ::= BETWEEN */ |
| 169723 | | - 275, /* (216) between_op ::= NOT BETWEEN */ |
| 169724 | | - 217, /* (217) expr ::= expr between_op expr AND expr */ |
| 169725 | | - 276, /* (218) in_op ::= IN */ |
| 169726 | | - 276, /* (219) in_op ::= NOT IN */ |
| 169727 | | - 217, /* (220) expr ::= expr in_op LP exprlist RP */ |
| 169728 | | - 217, /* (221) expr ::= LP select RP */ |
| 169729 | | - 217, /* (222) expr ::= expr in_op LP select RP */ |
| 169730 | | - 217, /* (223) expr ::= expr in_op nm dbnm paren_exprlist */ |
| 169731 | | - 217, /* (224) expr ::= EXISTS LP select RP */ |
| 169732 | | - 217, /* (225) expr ::= CASE case_operand case_exprlist case_else END */ |
| 169733 | | - 279, /* (226) case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 169734 | | - 279, /* (227) case_exprlist ::= WHEN expr THEN expr */ |
| 169735 | | - 280, /* (228) case_else ::= ELSE expr */ |
| 169736 | | - 280, /* (229) case_else ::= */ |
| 169737 | | - 278, /* (230) case_operand ::= expr */ |
| 169738 | | - 278, /* (231) case_operand ::= */ |
| 169739 | | - 261, /* (232) exprlist ::= */ |
| 169740 | | - 253, /* (233) nexprlist ::= nexprlist COMMA expr */ |
| 169741 | | - 253, /* (234) nexprlist ::= expr */ |
| 169742 | | - 277, /* (235) paren_exprlist ::= */ |
| 169743 | | - 277, /* (236) paren_exprlist ::= LP exprlist RP */ |
| 169744 | | - 190, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 169745 | | - 281, /* (238) uniqueflag ::= UNIQUE */ |
| 169746 | | - 281, /* (239) uniqueflag ::= */ |
| 169747 | | - 221, /* (240) eidlist_opt ::= */ |
| 169748 | | - 221, /* (241) eidlist_opt ::= LP eidlist RP */ |
| 169749 | | - 232, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */ |
| 169750 | | - 232, /* (243) eidlist ::= nm collate sortorder */ |
| 169751 | | - 282, /* (244) collate ::= */ |
| 169752 | | - 282, /* (245) collate ::= COLLATE ID|STRING */ |
| 169753 | | - 190, /* (246) cmd ::= DROP INDEX ifexists fullname */ |
| 169754 | | - 190, /* (247) cmd ::= VACUUM vinto */ |
| 169755 | | - 190, /* (248) cmd ::= VACUUM nm vinto */ |
| 169756 | | - 283, /* (249) vinto ::= INTO expr */ |
| 169757 | | - 283, /* (250) vinto ::= */ |
| 169758 | | - 190, /* (251) cmd ::= PRAGMA nm dbnm */ |
| 169759 | | - 190, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 169760 | | - 190, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 169761 | | - 190, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 169762 | | - 190, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 169763 | | - 211, /* (256) plus_num ::= PLUS INTEGER|FLOAT */ |
| 169764 | | - 212, /* (257) minus_num ::= MINUS INTEGER|FLOAT */ |
| 169765 | | - 190, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 169766 | | - 285, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 169767 | | - 287, /* (260) trigger_time ::= BEFORE|AFTER */ |
| 169768 | | - 287, /* (261) trigger_time ::= INSTEAD OF */ |
| 169769 | | - 287, /* (262) trigger_time ::= */ |
| 169770 | | - 288, /* (263) trigger_event ::= DELETE|INSERT */ |
| 169771 | | - 288, /* (264) trigger_event ::= UPDATE */ |
| 169772 | | - 288, /* (265) trigger_event ::= UPDATE OF idlist */ |
| 169773 | | - 290, /* (266) when_clause ::= */ |
| 169774 | | - 290, /* (267) when_clause ::= WHEN expr */ |
| 169775 | | - 286, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 169776 | | - 286, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */ |
| 169777 | | - 292, /* (270) trnm ::= nm DOT nm */ |
| 169778 | | - 293, /* (271) tridxby ::= INDEXED BY nm */ |
| 169779 | | - 293, /* (272) tridxby ::= NOT INDEXED */ |
| 169780 | | - 291, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ |
| 169781 | | - 291, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 169782 | | - 291, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 169783 | | - 291, /* (276) trigger_cmd ::= scanpt select scanpt */ |
| 169784 | | - 217, /* (277) expr ::= RAISE LP IGNORE RP */ |
| 169785 | | - 217, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */ |
| 169786 | | - 236, /* (279) raisetype ::= ROLLBACK */ |
| 169787 | | - 236, /* (280) raisetype ::= ABORT */ |
| 169788 | | - 236, /* (281) raisetype ::= FAIL */ |
| 169789 | | - 190, /* (282) cmd ::= DROP TRIGGER ifexists fullname */ |
| 169790 | | - 190, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 169791 | | - 190, /* (284) cmd ::= DETACH database_kw_opt expr */ |
| 169792 | | - 295, /* (285) key_opt ::= */ |
| 169793 | | - 295, /* (286) key_opt ::= KEY expr */ |
| 169794 | | - 190, /* (287) cmd ::= REINDEX */ |
| 169795 | | - 190, /* (288) cmd ::= REINDEX nm dbnm */ |
| 169796 | | - 190, /* (289) cmd ::= ANALYZE */ |
| 169797 | | - 190, /* (290) cmd ::= ANALYZE nm dbnm */ |
| 169798 | | - 190, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 169799 | | - 190, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 169800 | | - 190, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ |
| 169801 | | - 296, /* (294) add_column_fullname ::= fullname */ |
| 169802 | | - 190, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 169803 | | - 190, /* (296) cmd ::= create_vtab */ |
| 169804 | | - 190, /* (297) cmd ::= create_vtab LP vtabarglist RP */ |
| 169805 | | - 298, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 169806 | | - 300, /* (299) vtabarg ::= */ |
| 169807 | | - 301, /* (300) vtabargtoken ::= ANY */ |
| 169808 | | - 301, /* (301) vtabargtoken ::= lp anylist RP */ |
| 169809 | | - 302, /* (302) lp ::= LP */ |
| 169810 | | - 266, /* (303) with ::= WITH wqlist */ |
| 169811 | | - 266, /* (304) with ::= WITH RECURSIVE wqlist */ |
| 169812 | | - 305, /* (305) wqas ::= AS */ |
| 169813 | | - 305, /* (306) wqas ::= AS MATERIALIZED */ |
| 169814 | | - 305, /* (307) wqas ::= AS NOT MATERIALIZED */ |
| 169815 | | - 304, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */ |
| 169816 | | - 241, /* (309) wqlist ::= wqitem */ |
| 169817 | | - 241, /* (310) wqlist ::= wqlist COMMA wqitem */ |
| 169818 | | - 306, /* (311) windowdefn_list ::= windowdefn */ |
| 169819 | | - 306, /* (312) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 169820 | | - 307, /* (313) windowdefn ::= nm AS LP window RP */ |
| 169821 | | - 308, /* (314) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 169822 | | - 308, /* (315) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 169823 | | - 308, /* (316) window ::= ORDER BY sortlist frame_opt */ |
| 169824 | | - 308, /* (317) window ::= nm ORDER BY sortlist frame_opt */ |
| 169825 | | - 308, /* (318) window ::= frame_opt */ |
| 169826 | | - 308, /* (319) window ::= nm frame_opt */ |
| 169827 | | - 309, /* (320) frame_opt ::= */ |
| 169828 | | - 309, /* (321) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 169829 | | - 309, /* (322) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 169830 | | - 313, /* (323) range_or_rows ::= RANGE|ROWS|GROUPS */ |
| 169831 | | - 315, /* (324) frame_bound_s ::= frame_bound */ |
| 169832 | | - 315, /* (325) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 169833 | | - 316, /* (326) frame_bound_e ::= frame_bound */ |
| 169834 | | - 316, /* (327) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 169835 | | - 314, /* (328) frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 169836 | | - 314, /* (329) frame_bound ::= CURRENT ROW */ |
| 169837 | | - 317, /* (330) frame_exclude_opt ::= */ |
| 169838 | | - 317, /* (331) frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 169839 | | - 318, /* (332) frame_exclude ::= NO OTHERS */ |
| 169840 | | - 318, /* (333) frame_exclude ::= CURRENT ROW */ |
| 169841 | | - 318, /* (334) frame_exclude ::= GROUP|TIES */ |
| 169842 | | - 251, /* (335) window_clause ::= WINDOW windowdefn_list */ |
| 169843 | | - 273, /* (336) filter_over ::= filter_clause over_clause */ |
| 169844 | | - 273, /* (337) filter_over ::= over_clause */ |
| 169845 | | - 273, /* (338) filter_over ::= filter_clause */ |
| 169846 | | - 312, /* (339) over_clause ::= OVER LP window RP */ |
| 169847 | | - 312, /* (340) over_clause ::= OVER nm */ |
| 169848 | | - 311, /* (341) filter_clause ::= FILTER LP WHERE expr RP */ |
| 169849 | | - 185, /* (342) input ::= cmdlist */ |
| 169850 | | - 186, /* (343) cmdlist ::= cmdlist ecmd */ |
| 169851 | | - 186, /* (344) cmdlist ::= ecmd */ |
| 169852 | | - 187, /* (345) ecmd ::= SEMI */ |
| 169853 | | - 187, /* (346) ecmd ::= cmdx SEMI */ |
| 169854 | | - 187, /* (347) ecmd ::= explain cmdx SEMI */ |
| 169855 | | - 192, /* (348) trans_opt ::= */ |
| 169856 | | - 192, /* (349) trans_opt ::= TRANSACTION */ |
| 169857 | | - 192, /* (350) trans_opt ::= TRANSACTION nm */ |
| 169858 | | - 194, /* (351) savepoint_opt ::= SAVEPOINT */ |
| 169859 | | - 194, /* (352) savepoint_opt ::= */ |
| 169860 | | - 190, /* (353) cmd ::= create_table create_table_args */ |
| 169861 | | - 203, /* (354) table_option_set ::= table_option */ |
| 169862 | | - 201, /* (355) columnlist ::= columnlist COMMA columnname carglist */ |
| 169863 | | - 201, /* (356) columnlist ::= columnname carglist */ |
| 169864 | | - 193, /* (357) nm ::= ID|INDEXED */ |
| 169865 | | - 193, /* (358) nm ::= STRING */ |
| 169866 | | - 193, /* (359) nm ::= JOIN_KW */ |
| 169867 | | - 208, /* (360) typetoken ::= typename */ |
| 169868 | | - 209, /* (361) typename ::= ID|STRING */ |
| 169869 | | - 210, /* (362) signed ::= plus_num */ |
| 169870 | | - 210, /* (363) signed ::= minus_num */ |
| 169871 | | - 207, /* (364) carglist ::= carglist ccons */ |
| 169872 | | - 207, /* (365) carglist ::= */ |
| 169873 | | - 215, /* (366) ccons ::= NULL onconf */ |
| 169874 | | - 215, /* (367) ccons ::= GENERATED ALWAYS AS generated */ |
| 169875 | | - 215, /* (368) ccons ::= AS generated */ |
| 169876 | | - 202, /* (369) conslist_opt ::= COMMA conslist */ |
| 169877 | | - 228, /* (370) conslist ::= conslist tconscomma tcons */ |
| 169878 | | - 228, /* (371) conslist ::= tcons */ |
| 169879 | | - 229, /* (372) tconscomma ::= */ |
| 169880 | | - 233, /* (373) defer_subclause_opt ::= defer_subclause */ |
| 169881 | | - 235, /* (374) resolvetype ::= raisetype */ |
| 169882 | | - 239, /* (375) selectnowith ::= oneselect */ |
| 169883 | | - 240, /* (376) oneselect ::= values */ |
| 169884 | | - 254, /* (377) sclp ::= selcollist COMMA */ |
| 169885 | | - 255, /* (378) as ::= ID|STRING */ |
| 169886 | | - 264, /* (379) indexed_opt ::= indexed_by */ |
| 169887 | | - 272, /* (380) returning ::= */ |
| 169888 | | - 217, /* (381) expr ::= term */ |
| 169889 | | - 274, /* (382) likeop ::= LIKE_KW|MATCH */ |
| 169890 | | - 261, /* (383) exprlist ::= nexprlist */ |
| 169891 | | - 284, /* (384) nmnum ::= plus_num */ |
| 169892 | | - 284, /* (385) nmnum ::= nm */ |
| 169893 | | - 284, /* (386) nmnum ::= ON */ |
| 169894 | | - 284, /* (387) nmnum ::= DELETE */ |
| 169895 | | - 284, /* (388) nmnum ::= DEFAULT */ |
| 169896 | | - 211, /* (389) plus_num ::= INTEGER|FLOAT */ |
| 169897 | | - 289, /* (390) foreach_clause ::= */ |
| 169898 | | - 289, /* (391) foreach_clause ::= FOR EACH ROW */ |
| 169899 | | - 292, /* (392) trnm ::= nm */ |
| 169900 | | - 293, /* (393) tridxby ::= */ |
| 169901 | | - 294, /* (394) database_kw_opt ::= DATABASE */ |
| 169902 | | - 294, /* (395) database_kw_opt ::= */ |
| 169903 | | - 297, /* (396) kwcolumn_opt ::= */ |
| 169904 | | - 297, /* (397) kwcolumn_opt ::= COLUMNKW */ |
| 169905 | | - 299, /* (398) vtabarglist ::= vtabarg */ |
| 169906 | | - 299, /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 169907 | | - 300, /* (400) vtabarg ::= vtabarg vtabargtoken */ |
| 169908 | | - 303, /* (401) anylist ::= */ |
| 169909 | | - 303, /* (402) anylist ::= anylist LP anylist RP */ |
| 169910 | | - 303, /* (403) anylist ::= anylist ANY */ |
| 169911 | | - 266, /* (404) with ::= */ |
| 170300 | + 217, /* (178) expr ::= ID|INDEXED|JOIN_KW */ |
| 170301 | + 217, /* (179) expr ::= nm DOT nm */ |
| 170302 | + 217, /* (180) expr ::= nm DOT nm DOT nm */ |
| 170303 | + 216, /* (181) term ::= NULL|FLOAT|BLOB */ |
| 170304 | + 216, /* (182) term ::= STRING */ |
| 170305 | + 216, /* (183) term ::= INTEGER */ |
| 170306 | + 217, /* (184) expr ::= VARIABLE */ |
| 170307 | + 217, /* (185) expr ::= expr COLLATE ID|STRING */ |
| 170308 | + 217, /* (186) expr ::= CAST LP expr AS typetoken RP */ |
| 170309 | + 217, /* (187) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ |
| 170310 | + 217, /* (188) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ |
| 170311 | + 217, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ |
| 170312 | + 217, /* (190) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ |
| 170313 | + 216, /* (191) term ::= CTIME_KW */ |
| 170314 | + 217, /* (192) expr ::= LP nexprlist COMMA expr RP */ |
| 170315 | + 217, /* (193) expr ::= expr AND expr */ |
| 170316 | + 217, /* (194) expr ::= expr OR expr */ |
| 170317 | + 217, /* (195) expr ::= expr LT|GT|GE|LE expr */ |
| 170318 | + 217, /* (196) expr ::= expr EQ|NE expr */ |
| 170319 | + 217, /* (197) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ |
| 170320 | + 217, /* (198) expr ::= expr PLUS|MINUS expr */ |
| 170321 | + 217, /* (199) expr ::= expr STAR|SLASH|REM expr */ |
| 170322 | + 217, /* (200) expr ::= expr CONCAT expr */ |
| 170323 | + 274, /* (201) likeop ::= NOT LIKE_KW|MATCH */ |
| 170324 | + 217, /* (202) expr ::= expr likeop expr */ |
| 170325 | + 217, /* (203) expr ::= expr likeop expr ESCAPE expr */ |
| 170326 | + 217, /* (204) expr ::= expr ISNULL|NOTNULL */ |
| 170327 | + 217, /* (205) expr ::= expr NOT NULL */ |
| 170328 | + 217, /* (206) expr ::= expr IS expr */ |
| 170329 | + 217, /* (207) expr ::= expr IS NOT expr */ |
| 170330 | + 217, /* (208) expr ::= expr IS NOT DISTINCT FROM expr */ |
| 170331 | + 217, /* (209) expr ::= expr IS DISTINCT FROM expr */ |
| 170332 | + 217, /* (210) expr ::= NOT expr */ |
| 170333 | + 217, /* (211) expr ::= BITNOT expr */ |
| 170334 | + 217, /* (212) expr ::= PLUS|MINUS expr */ |
| 170335 | + 217, /* (213) expr ::= expr PTR expr */ |
| 170336 | + 275, /* (214) between_op ::= BETWEEN */ |
| 170337 | + 275, /* (215) between_op ::= NOT BETWEEN */ |
| 170338 | + 217, /* (216) expr ::= expr between_op expr AND expr */ |
| 170339 | + 276, /* (217) in_op ::= IN */ |
| 170340 | + 276, /* (218) in_op ::= NOT IN */ |
| 170341 | + 217, /* (219) expr ::= expr in_op LP exprlist RP */ |
| 170342 | + 217, /* (220) expr ::= LP select RP */ |
| 170343 | + 217, /* (221) expr ::= expr in_op LP select RP */ |
| 170344 | + 217, /* (222) expr ::= expr in_op nm dbnm paren_exprlist */ |
| 170345 | + 217, /* (223) expr ::= EXISTS LP select RP */ |
| 170346 | + 217, /* (224) expr ::= CASE case_operand case_exprlist case_else END */ |
| 170347 | + 279, /* (225) case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 170348 | + 279, /* (226) case_exprlist ::= WHEN expr THEN expr */ |
| 170349 | + 280, /* (227) case_else ::= ELSE expr */ |
| 170350 | + 280, /* (228) case_else ::= */ |
| 170351 | + 278, /* (229) case_operand ::= expr */ |
| 170352 | + 278, /* (230) case_operand ::= */ |
| 170353 | + 261, /* (231) exprlist ::= */ |
| 170354 | + 253, /* (232) nexprlist ::= nexprlist COMMA expr */ |
| 170355 | + 253, /* (233) nexprlist ::= expr */ |
| 170356 | + 277, /* (234) paren_exprlist ::= */ |
| 170357 | + 277, /* (235) paren_exprlist ::= LP exprlist RP */ |
| 170358 | + 190, /* (236) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 170359 | + 281, /* (237) uniqueflag ::= UNIQUE */ |
| 170360 | + 281, /* (238) uniqueflag ::= */ |
| 170361 | + 221, /* (239) eidlist_opt ::= */ |
| 170362 | + 221, /* (240) eidlist_opt ::= LP eidlist RP */ |
| 170363 | + 232, /* (241) eidlist ::= eidlist COMMA nm collate sortorder */ |
| 170364 | + 232, /* (242) eidlist ::= nm collate sortorder */ |
| 170365 | + 282, /* (243) collate ::= */ |
| 170366 | + 282, /* (244) collate ::= COLLATE ID|STRING */ |
| 170367 | + 190, /* (245) cmd ::= DROP INDEX ifexists fullname */ |
| 170368 | + 190, /* (246) cmd ::= VACUUM vinto */ |
| 170369 | + 190, /* (247) cmd ::= VACUUM nm vinto */ |
| 170370 | + 283, /* (248) vinto ::= INTO expr */ |
| 170371 | + 283, /* (249) vinto ::= */ |
| 170372 | + 190, /* (250) cmd ::= PRAGMA nm dbnm */ |
| 170373 | + 190, /* (251) cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 170374 | + 190, /* (252) cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 170375 | + 190, /* (253) cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 170376 | + 190, /* (254) cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 170377 | + 211, /* (255) plus_num ::= PLUS INTEGER|FLOAT */ |
| 170378 | + 212, /* (256) minus_num ::= MINUS INTEGER|FLOAT */ |
| 170379 | + 190, /* (257) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 170380 | + 285, /* (258) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 170381 | + 287, /* (259) trigger_time ::= BEFORE|AFTER */ |
| 170382 | + 287, /* (260) trigger_time ::= INSTEAD OF */ |
| 170383 | + 287, /* (261) trigger_time ::= */ |
| 170384 | + 288, /* (262) trigger_event ::= DELETE|INSERT */ |
| 170385 | + 288, /* (263) trigger_event ::= UPDATE */ |
| 170386 | + 288, /* (264) trigger_event ::= UPDATE OF idlist */ |
| 170387 | + 290, /* (265) when_clause ::= */ |
| 170388 | + 290, /* (266) when_clause ::= WHEN expr */ |
| 170389 | + 286, /* (267) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 170390 | + 286, /* (268) trigger_cmd_list ::= trigger_cmd SEMI */ |
| 170391 | + 292, /* (269) trnm ::= nm DOT nm */ |
| 170392 | + 293, /* (270) tridxby ::= INDEXED BY nm */ |
| 170393 | + 293, /* (271) tridxby ::= NOT INDEXED */ |
| 170394 | + 291, /* (272) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ |
| 170395 | + 291, /* (273) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 170396 | + 291, /* (274) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 170397 | + 291, /* (275) trigger_cmd ::= scanpt select scanpt */ |
| 170398 | + 217, /* (276) expr ::= RAISE LP IGNORE RP */ |
| 170399 | + 217, /* (277) expr ::= RAISE LP raisetype COMMA nm RP */ |
| 170400 | + 236, /* (278) raisetype ::= ROLLBACK */ |
| 170401 | + 236, /* (279) raisetype ::= ABORT */ |
| 170402 | + 236, /* (280) raisetype ::= FAIL */ |
| 170403 | + 190, /* (281) cmd ::= DROP TRIGGER ifexists fullname */ |
| 170404 | + 190, /* (282) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 170405 | + 190, /* (283) cmd ::= DETACH database_kw_opt expr */ |
| 170406 | + 295, /* (284) key_opt ::= */ |
| 170407 | + 295, /* (285) key_opt ::= KEY expr */ |
| 170408 | + 190, /* (286) cmd ::= REINDEX */ |
| 170409 | + 190, /* (287) cmd ::= REINDEX nm dbnm */ |
| 170410 | + 190, /* (288) cmd ::= ANALYZE */ |
| 170411 | + 190, /* (289) cmd ::= ANALYZE nm dbnm */ |
| 170412 | + 190, /* (290) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 170413 | + 190, /* (291) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 170414 | + 190, /* (292) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ |
| 170415 | + 296, /* (293) add_column_fullname ::= fullname */ |
| 170416 | + 190, /* (294) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 170417 | + 190, /* (295) cmd ::= create_vtab */ |
| 170418 | + 190, /* (296) cmd ::= create_vtab LP vtabarglist RP */ |
| 170419 | + 298, /* (297) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 170420 | + 300, /* (298) vtabarg ::= */ |
| 170421 | + 301, /* (299) vtabargtoken ::= ANY */ |
| 170422 | + 301, /* (300) vtabargtoken ::= lp anylist RP */ |
| 170423 | + 302, /* (301) lp ::= LP */ |
| 170424 | + 266, /* (302) with ::= WITH wqlist */ |
| 170425 | + 266, /* (303) with ::= WITH RECURSIVE wqlist */ |
| 170426 | + 305, /* (304) wqas ::= AS */ |
| 170427 | + 305, /* (305) wqas ::= AS MATERIALIZED */ |
| 170428 | + 305, /* (306) wqas ::= AS NOT MATERIALIZED */ |
| 170429 | + 304, /* (307) wqitem ::= nm eidlist_opt wqas LP select RP */ |
| 170430 | + 241, /* (308) wqlist ::= wqitem */ |
| 170431 | + 241, /* (309) wqlist ::= wqlist COMMA wqitem */ |
| 170432 | + 306, /* (310) windowdefn_list ::= windowdefn */ |
| 170433 | + 306, /* (311) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 170434 | + 307, /* (312) windowdefn ::= nm AS LP window RP */ |
| 170435 | + 308, /* (313) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 170436 | + 308, /* (314) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 170437 | + 308, /* (315) window ::= ORDER BY sortlist frame_opt */ |
| 170438 | + 308, /* (316) window ::= nm ORDER BY sortlist frame_opt */ |
| 170439 | + 308, /* (317) window ::= frame_opt */ |
| 170440 | + 308, /* (318) window ::= nm frame_opt */ |
| 170441 | + 309, /* (319) frame_opt ::= */ |
| 170442 | + 309, /* (320) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 170443 | + 309, /* (321) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 170444 | + 313, /* (322) range_or_rows ::= RANGE|ROWS|GROUPS */ |
| 170445 | + 315, /* (323) frame_bound_s ::= frame_bound */ |
| 170446 | + 315, /* (324) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 170447 | + 316, /* (325) frame_bound_e ::= frame_bound */ |
| 170448 | + 316, /* (326) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 170449 | + 314, /* (327) frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 170450 | + 314, /* (328) frame_bound ::= CURRENT ROW */ |
| 170451 | + 317, /* (329) frame_exclude_opt ::= */ |
| 170452 | + 317, /* (330) frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 170453 | + 318, /* (331) frame_exclude ::= NO OTHERS */ |
| 170454 | + 318, /* (332) frame_exclude ::= CURRENT ROW */ |
| 170455 | + 318, /* (333) frame_exclude ::= GROUP|TIES */ |
| 170456 | + 251, /* (334) window_clause ::= WINDOW windowdefn_list */ |
| 170457 | + 273, /* (335) filter_over ::= filter_clause over_clause */ |
| 170458 | + 273, /* (336) filter_over ::= over_clause */ |
| 170459 | + 273, /* (337) filter_over ::= filter_clause */ |
| 170460 | + 312, /* (338) over_clause ::= OVER LP window RP */ |
| 170461 | + 312, /* (339) over_clause ::= OVER nm */ |
| 170462 | + 311, /* (340) filter_clause ::= FILTER LP WHERE expr RP */ |
| 170463 | + 185, /* (341) input ::= cmdlist */ |
| 170464 | + 186, /* (342) cmdlist ::= cmdlist ecmd */ |
| 170465 | + 186, /* (343) cmdlist ::= ecmd */ |
| 170466 | + 187, /* (344) ecmd ::= SEMI */ |
| 170467 | + 187, /* (345) ecmd ::= cmdx SEMI */ |
| 170468 | + 187, /* (346) ecmd ::= explain cmdx SEMI */ |
| 170469 | + 192, /* (347) trans_opt ::= */ |
| 170470 | + 192, /* (348) trans_opt ::= TRANSACTION */ |
| 170471 | + 192, /* (349) trans_opt ::= TRANSACTION nm */ |
| 170472 | + 194, /* (350) savepoint_opt ::= SAVEPOINT */ |
| 170473 | + 194, /* (351) savepoint_opt ::= */ |
| 170474 | + 190, /* (352) cmd ::= create_table create_table_args */ |
| 170475 | + 203, /* (353) table_option_set ::= table_option */ |
| 170476 | + 201, /* (354) columnlist ::= columnlist COMMA columnname carglist */ |
| 170477 | + 201, /* (355) columnlist ::= columnname carglist */ |
| 170478 | + 193, /* (356) nm ::= ID|INDEXED|JOIN_KW */ |
| 170479 | + 193, /* (357) nm ::= STRING */ |
| 170480 | + 208, /* (358) typetoken ::= typename */ |
| 170481 | + 209, /* (359) typename ::= ID|STRING */ |
| 170482 | + 210, /* (360) signed ::= plus_num */ |
| 170483 | + 210, /* (361) signed ::= minus_num */ |
| 170484 | + 207, /* (362) carglist ::= carglist ccons */ |
| 170485 | + 207, /* (363) carglist ::= */ |
| 170486 | + 215, /* (364) ccons ::= NULL onconf */ |
| 170487 | + 215, /* (365) ccons ::= GENERATED ALWAYS AS generated */ |
| 170488 | + 215, /* (366) ccons ::= AS generated */ |
| 170489 | + 202, /* (367) conslist_opt ::= COMMA conslist */ |
| 170490 | + 228, /* (368) conslist ::= conslist tconscomma tcons */ |
| 170491 | + 228, /* (369) conslist ::= tcons */ |
| 170492 | + 229, /* (370) tconscomma ::= */ |
| 170493 | + 233, /* (371) defer_subclause_opt ::= defer_subclause */ |
| 170494 | + 235, /* (372) resolvetype ::= raisetype */ |
| 170495 | + 239, /* (373) selectnowith ::= oneselect */ |
| 170496 | + 240, /* (374) oneselect ::= values */ |
| 170497 | + 254, /* (375) sclp ::= selcollist COMMA */ |
| 170498 | + 255, /* (376) as ::= ID|STRING */ |
| 170499 | + 264, /* (377) indexed_opt ::= indexed_by */ |
| 170500 | + 272, /* (378) returning ::= */ |
| 170501 | + 217, /* (379) expr ::= term */ |
| 170502 | + 274, /* (380) likeop ::= LIKE_KW|MATCH */ |
| 170503 | + 261, /* (381) exprlist ::= nexprlist */ |
| 170504 | + 284, /* (382) nmnum ::= plus_num */ |
| 170505 | + 284, /* (383) nmnum ::= nm */ |
| 170506 | + 284, /* (384) nmnum ::= ON */ |
| 170507 | + 284, /* (385) nmnum ::= DELETE */ |
| 170508 | + 284, /* (386) nmnum ::= DEFAULT */ |
| 170509 | + 211, /* (387) plus_num ::= INTEGER|FLOAT */ |
| 170510 | + 289, /* (388) foreach_clause ::= */ |
| 170511 | + 289, /* (389) foreach_clause ::= FOR EACH ROW */ |
| 170512 | + 292, /* (390) trnm ::= nm */ |
| 170513 | + 293, /* (391) tridxby ::= */ |
| 170514 | + 294, /* (392) database_kw_opt ::= DATABASE */ |
| 170515 | + 294, /* (393) database_kw_opt ::= */ |
| 170516 | + 297, /* (394) kwcolumn_opt ::= */ |
| 170517 | + 297, /* (395) kwcolumn_opt ::= COLUMNKW */ |
| 170518 | + 299, /* (396) vtabarglist ::= vtabarg */ |
| 170519 | + 299, /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 170520 | + 300, /* (398) vtabarg ::= vtabarg vtabargtoken */ |
| 170521 | + 303, /* (399) anylist ::= */ |
| 170522 | + 303, /* (400) anylist ::= anylist LP anylist RP */ |
| 170523 | + 303, /* (401) anylist ::= anylist ANY */ |
| 170524 | + 266, /* (402) with ::= */ |
| 169912 | 170525 | }; |
| 169913 | 170526 | |
| 169914 | 170527 | /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number |
| 169915 | 170528 | ** of symbols on the right-hand side of that rule. */ |
| 169916 | 170529 | static const signed char yyRuleInfoNRhs[] = { |
| | @@ -170090,237 +170703,235 @@ |
| 170090 | 170703 | 0, /* (173) idlist_opt ::= */ |
| 170091 | 170704 | -3, /* (174) idlist_opt ::= LP idlist RP */ |
| 170092 | 170705 | -3, /* (175) idlist ::= idlist COMMA nm */ |
| 170093 | 170706 | -1, /* (176) idlist ::= nm */ |
| 170094 | 170707 | -3, /* (177) expr ::= LP expr RP */ |
| 170095 | | - -1, /* (178) expr ::= ID|INDEXED */ |
| 170096 | | - -1, /* (179) expr ::= JOIN_KW */ |
| 170097 | | - -3, /* (180) expr ::= nm DOT nm */ |
| 170098 | | - -5, /* (181) expr ::= nm DOT nm DOT nm */ |
| 170099 | | - -1, /* (182) term ::= NULL|FLOAT|BLOB */ |
| 170100 | | - -1, /* (183) term ::= STRING */ |
| 170101 | | - -1, /* (184) term ::= INTEGER */ |
| 170102 | | - -1, /* (185) expr ::= VARIABLE */ |
| 170103 | | - -3, /* (186) expr ::= expr COLLATE ID|STRING */ |
| 170104 | | - -6, /* (187) expr ::= CAST LP expr AS typetoken RP */ |
| 170105 | | - -5, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 170106 | | - -4, /* (189) expr ::= ID|INDEXED LP STAR RP */ |
| 170107 | | - -6, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ |
| 170108 | | - -5, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */ |
| 170109 | | - -1, /* (192) term ::= CTIME_KW */ |
| 170110 | | - -5, /* (193) expr ::= LP nexprlist COMMA expr RP */ |
| 170111 | | - -3, /* (194) expr ::= expr AND expr */ |
| 170112 | | - -3, /* (195) expr ::= expr OR expr */ |
| 170113 | | - -3, /* (196) expr ::= expr LT|GT|GE|LE expr */ |
| 170114 | | - -3, /* (197) expr ::= expr EQ|NE expr */ |
| 170115 | | - -3, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ |
| 170116 | | - -3, /* (199) expr ::= expr PLUS|MINUS expr */ |
| 170117 | | - -3, /* (200) expr ::= expr STAR|SLASH|REM expr */ |
| 170118 | | - -3, /* (201) expr ::= expr CONCAT expr */ |
| 170119 | | - -2, /* (202) likeop ::= NOT LIKE_KW|MATCH */ |
| 170120 | | - -3, /* (203) expr ::= expr likeop expr */ |
| 170121 | | - -5, /* (204) expr ::= expr likeop expr ESCAPE expr */ |
| 170122 | | - -2, /* (205) expr ::= expr ISNULL|NOTNULL */ |
| 170123 | | - -3, /* (206) expr ::= expr NOT NULL */ |
| 170124 | | - -3, /* (207) expr ::= expr IS expr */ |
| 170125 | | - -4, /* (208) expr ::= expr IS NOT expr */ |
| 170126 | | - -6, /* (209) expr ::= expr IS NOT DISTINCT FROM expr */ |
| 170127 | | - -5, /* (210) expr ::= expr IS DISTINCT FROM expr */ |
| 170128 | | - -2, /* (211) expr ::= NOT expr */ |
| 170129 | | - -2, /* (212) expr ::= BITNOT expr */ |
| 170130 | | - -2, /* (213) expr ::= PLUS|MINUS expr */ |
| 170131 | | - -3, /* (214) expr ::= expr PTR expr */ |
| 170132 | | - -1, /* (215) between_op ::= BETWEEN */ |
| 170133 | | - -2, /* (216) between_op ::= NOT BETWEEN */ |
| 170134 | | - -5, /* (217) expr ::= expr between_op expr AND expr */ |
| 170135 | | - -1, /* (218) in_op ::= IN */ |
| 170136 | | - -2, /* (219) in_op ::= NOT IN */ |
| 170137 | | - -5, /* (220) expr ::= expr in_op LP exprlist RP */ |
| 170138 | | - -3, /* (221) expr ::= LP select RP */ |
| 170139 | | - -5, /* (222) expr ::= expr in_op LP select RP */ |
| 170140 | | - -5, /* (223) expr ::= expr in_op nm dbnm paren_exprlist */ |
| 170141 | | - -4, /* (224) expr ::= EXISTS LP select RP */ |
| 170142 | | - -5, /* (225) expr ::= CASE case_operand case_exprlist case_else END */ |
| 170143 | | - -5, /* (226) case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 170144 | | - -4, /* (227) case_exprlist ::= WHEN expr THEN expr */ |
| 170145 | | - -2, /* (228) case_else ::= ELSE expr */ |
| 170146 | | - 0, /* (229) case_else ::= */ |
| 170147 | | - -1, /* (230) case_operand ::= expr */ |
| 170148 | | - 0, /* (231) case_operand ::= */ |
| 170149 | | - 0, /* (232) exprlist ::= */ |
| 170150 | | - -3, /* (233) nexprlist ::= nexprlist COMMA expr */ |
| 170151 | | - -1, /* (234) nexprlist ::= expr */ |
| 170152 | | - 0, /* (235) paren_exprlist ::= */ |
| 170153 | | - -3, /* (236) paren_exprlist ::= LP exprlist RP */ |
| 170154 | | - -12, /* (237) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 170155 | | - -1, /* (238) uniqueflag ::= UNIQUE */ |
| 170156 | | - 0, /* (239) uniqueflag ::= */ |
| 170157 | | - 0, /* (240) eidlist_opt ::= */ |
| 170158 | | - -3, /* (241) eidlist_opt ::= LP eidlist RP */ |
| 170159 | | - -5, /* (242) eidlist ::= eidlist COMMA nm collate sortorder */ |
| 170160 | | - -3, /* (243) eidlist ::= nm collate sortorder */ |
| 170161 | | - 0, /* (244) collate ::= */ |
| 170162 | | - -2, /* (245) collate ::= COLLATE ID|STRING */ |
| 170163 | | - -4, /* (246) cmd ::= DROP INDEX ifexists fullname */ |
| 170164 | | - -2, /* (247) cmd ::= VACUUM vinto */ |
| 170165 | | - -3, /* (248) cmd ::= VACUUM nm vinto */ |
| 170166 | | - -2, /* (249) vinto ::= INTO expr */ |
| 170167 | | - 0, /* (250) vinto ::= */ |
| 170168 | | - -3, /* (251) cmd ::= PRAGMA nm dbnm */ |
| 170169 | | - -5, /* (252) cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 170170 | | - -6, /* (253) cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 170171 | | - -5, /* (254) cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 170172 | | - -6, /* (255) cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 170173 | | - -2, /* (256) plus_num ::= PLUS INTEGER|FLOAT */ |
| 170174 | | - -2, /* (257) minus_num ::= MINUS INTEGER|FLOAT */ |
| 170175 | | - -5, /* (258) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 170176 | | - -11, /* (259) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 170177 | | - -1, /* (260) trigger_time ::= BEFORE|AFTER */ |
| 170178 | | - -2, /* (261) trigger_time ::= INSTEAD OF */ |
| 170179 | | - 0, /* (262) trigger_time ::= */ |
| 170180 | | - -1, /* (263) trigger_event ::= DELETE|INSERT */ |
| 170181 | | - -1, /* (264) trigger_event ::= UPDATE */ |
| 170182 | | - -3, /* (265) trigger_event ::= UPDATE OF idlist */ |
| 170183 | | - 0, /* (266) when_clause ::= */ |
| 170184 | | - -2, /* (267) when_clause ::= WHEN expr */ |
| 170185 | | - -3, /* (268) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 170186 | | - -2, /* (269) trigger_cmd_list ::= trigger_cmd SEMI */ |
| 170187 | | - -3, /* (270) trnm ::= nm DOT nm */ |
| 170188 | | - -3, /* (271) tridxby ::= INDEXED BY nm */ |
| 170189 | | - -2, /* (272) tridxby ::= NOT INDEXED */ |
| 170190 | | - -9, /* (273) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ |
| 170191 | | - -8, /* (274) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 170192 | | - -6, /* (275) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 170193 | | - -3, /* (276) trigger_cmd ::= scanpt select scanpt */ |
| 170194 | | - -4, /* (277) expr ::= RAISE LP IGNORE RP */ |
| 170195 | | - -6, /* (278) expr ::= RAISE LP raisetype COMMA nm RP */ |
| 170196 | | - -1, /* (279) raisetype ::= ROLLBACK */ |
| 170197 | | - -1, /* (280) raisetype ::= ABORT */ |
| 170198 | | - -1, /* (281) raisetype ::= FAIL */ |
| 170199 | | - -4, /* (282) cmd ::= DROP TRIGGER ifexists fullname */ |
| 170200 | | - -6, /* (283) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 170201 | | - -3, /* (284) cmd ::= DETACH database_kw_opt expr */ |
| 170202 | | - 0, /* (285) key_opt ::= */ |
| 170203 | | - -2, /* (286) key_opt ::= KEY expr */ |
| 170204 | | - -1, /* (287) cmd ::= REINDEX */ |
| 170205 | | - -3, /* (288) cmd ::= REINDEX nm dbnm */ |
| 170206 | | - -1, /* (289) cmd ::= ANALYZE */ |
| 170207 | | - -3, /* (290) cmd ::= ANALYZE nm dbnm */ |
| 170208 | | - -6, /* (291) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 170209 | | - -7, /* (292) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 170210 | | - -6, /* (293) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ |
| 170211 | | - -1, /* (294) add_column_fullname ::= fullname */ |
| 170212 | | - -8, /* (295) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 170213 | | - -1, /* (296) cmd ::= create_vtab */ |
| 170214 | | - -4, /* (297) cmd ::= create_vtab LP vtabarglist RP */ |
| 170215 | | - -8, /* (298) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 170216 | | - 0, /* (299) vtabarg ::= */ |
| 170217 | | - -1, /* (300) vtabargtoken ::= ANY */ |
| 170218 | | - -3, /* (301) vtabargtoken ::= lp anylist RP */ |
| 170219 | | - -1, /* (302) lp ::= LP */ |
| 170220 | | - -2, /* (303) with ::= WITH wqlist */ |
| 170221 | | - -3, /* (304) with ::= WITH RECURSIVE wqlist */ |
| 170222 | | - -1, /* (305) wqas ::= AS */ |
| 170223 | | - -2, /* (306) wqas ::= AS MATERIALIZED */ |
| 170224 | | - -3, /* (307) wqas ::= AS NOT MATERIALIZED */ |
| 170225 | | - -6, /* (308) wqitem ::= nm eidlist_opt wqas LP select RP */ |
| 170226 | | - -1, /* (309) wqlist ::= wqitem */ |
| 170227 | | - -3, /* (310) wqlist ::= wqlist COMMA wqitem */ |
| 170228 | | - -1, /* (311) windowdefn_list ::= windowdefn */ |
| 170229 | | - -3, /* (312) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 170230 | | - -5, /* (313) windowdefn ::= nm AS LP window RP */ |
| 170231 | | - -5, /* (314) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 170232 | | - -6, /* (315) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 170233 | | - -4, /* (316) window ::= ORDER BY sortlist frame_opt */ |
| 170234 | | - -5, /* (317) window ::= nm ORDER BY sortlist frame_opt */ |
| 170235 | | - -1, /* (318) window ::= frame_opt */ |
| 170236 | | - -2, /* (319) window ::= nm frame_opt */ |
| 170237 | | - 0, /* (320) frame_opt ::= */ |
| 170238 | | - -3, /* (321) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 170239 | | - -6, /* (322) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 170240 | | - -1, /* (323) range_or_rows ::= RANGE|ROWS|GROUPS */ |
| 170241 | | - -1, /* (324) frame_bound_s ::= frame_bound */ |
| 170242 | | - -2, /* (325) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 170243 | | - -1, /* (326) frame_bound_e ::= frame_bound */ |
| 170244 | | - -2, /* (327) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 170245 | | - -2, /* (328) frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 170246 | | - -2, /* (329) frame_bound ::= CURRENT ROW */ |
| 170247 | | - 0, /* (330) frame_exclude_opt ::= */ |
| 170248 | | - -2, /* (331) frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 170249 | | - -2, /* (332) frame_exclude ::= NO OTHERS */ |
| 170250 | | - -2, /* (333) frame_exclude ::= CURRENT ROW */ |
| 170251 | | - -1, /* (334) frame_exclude ::= GROUP|TIES */ |
| 170252 | | - -2, /* (335) window_clause ::= WINDOW windowdefn_list */ |
| 170253 | | - -2, /* (336) filter_over ::= filter_clause over_clause */ |
| 170254 | | - -1, /* (337) filter_over ::= over_clause */ |
| 170255 | | - -1, /* (338) filter_over ::= filter_clause */ |
| 170256 | | - -4, /* (339) over_clause ::= OVER LP window RP */ |
| 170257 | | - -2, /* (340) over_clause ::= OVER nm */ |
| 170258 | | - -5, /* (341) filter_clause ::= FILTER LP WHERE expr RP */ |
| 170259 | | - -1, /* (342) input ::= cmdlist */ |
| 170260 | | - -2, /* (343) cmdlist ::= cmdlist ecmd */ |
| 170261 | | - -1, /* (344) cmdlist ::= ecmd */ |
| 170262 | | - -1, /* (345) ecmd ::= SEMI */ |
| 170263 | | - -2, /* (346) ecmd ::= cmdx SEMI */ |
| 170264 | | - -3, /* (347) ecmd ::= explain cmdx SEMI */ |
| 170265 | | - 0, /* (348) trans_opt ::= */ |
| 170266 | | - -1, /* (349) trans_opt ::= TRANSACTION */ |
| 170267 | | - -2, /* (350) trans_opt ::= TRANSACTION nm */ |
| 170268 | | - -1, /* (351) savepoint_opt ::= SAVEPOINT */ |
| 170269 | | - 0, /* (352) savepoint_opt ::= */ |
| 170270 | | - -2, /* (353) cmd ::= create_table create_table_args */ |
| 170271 | | - -1, /* (354) table_option_set ::= table_option */ |
| 170272 | | - -4, /* (355) columnlist ::= columnlist COMMA columnname carglist */ |
| 170273 | | - -2, /* (356) columnlist ::= columnname carglist */ |
| 170274 | | - -1, /* (357) nm ::= ID|INDEXED */ |
| 170275 | | - -1, /* (358) nm ::= STRING */ |
| 170276 | | - -1, /* (359) nm ::= JOIN_KW */ |
| 170277 | | - -1, /* (360) typetoken ::= typename */ |
| 170278 | | - -1, /* (361) typename ::= ID|STRING */ |
| 170279 | | - -1, /* (362) signed ::= plus_num */ |
| 170280 | | - -1, /* (363) signed ::= minus_num */ |
| 170281 | | - -2, /* (364) carglist ::= carglist ccons */ |
| 170282 | | - 0, /* (365) carglist ::= */ |
| 170283 | | - -2, /* (366) ccons ::= NULL onconf */ |
| 170284 | | - -4, /* (367) ccons ::= GENERATED ALWAYS AS generated */ |
| 170285 | | - -2, /* (368) ccons ::= AS generated */ |
| 170286 | | - -2, /* (369) conslist_opt ::= COMMA conslist */ |
| 170287 | | - -3, /* (370) conslist ::= conslist tconscomma tcons */ |
| 170288 | | - -1, /* (371) conslist ::= tcons */ |
| 170289 | | - 0, /* (372) tconscomma ::= */ |
| 170290 | | - -1, /* (373) defer_subclause_opt ::= defer_subclause */ |
| 170291 | | - -1, /* (374) resolvetype ::= raisetype */ |
| 170292 | | - -1, /* (375) selectnowith ::= oneselect */ |
| 170293 | | - -1, /* (376) oneselect ::= values */ |
| 170294 | | - -2, /* (377) sclp ::= selcollist COMMA */ |
| 170295 | | - -1, /* (378) as ::= ID|STRING */ |
| 170296 | | - -1, /* (379) indexed_opt ::= indexed_by */ |
| 170297 | | - 0, /* (380) returning ::= */ |
| 170298 | | - -1, /* (381) expr ::= term */ |
| 170299 | | - -1, /* (382) likeop ::= LIKE_KW|MATCH */ |
| 170300 | | - -1, /* (383) exprlist ::= nexprlist */ |
| 170301 | | - -1, /* (384) nmnum ::= plus_num */ |
| 170302 | | - -1, /* (385) nmnum ::= nm */ |
| 170303 | | - -1, /* (386) nmnum ::= ON */ |
| 170304 | | - -1, /* (387) nmnum ::= DELETE */ |
| 170305 | | - -1, /* (388) nmnum ::= DEFAULT */ |
| 170306 | | - -1, /* (389) plus_num ::= INTEGER|FLOAT */ |
| 170307 | | - 0, /* (390) foreach_clause ::= */ |
| 170308 | | - -3, /* (391) foreach_clause ::= FOR EACH ROW */ |
| 170309 | | - -1, /* (392) trnm ::= nm */ |
| 170310 | | - 0, /* (393) tridxby ::= */ |
| 170311 | | - -1, /* (394) database_kw_opt ::= DATABASE */ |
| 170312 | | - 0, /* (395) database_kw_opt ::= */ |
| 170313 | | - 0, /* (396) kwcolumn_opt ::= */ |
| 170314 | | - -1, /* (397) kwcolumn_opt ::= COLUMNKW */ |
| 170315 | | - -1, /* (398) vtabarglist ::= vtabarg */ |
| 170316 | | - -3, /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 170317 | | - -2, /* (400) vtabarg ::= vtabarg vtabargtoken */ |
| 170318 | | - 0, /* (401) anylist ::= */ |
| 170319 | | - -4, /* (402) anylist ::= anylist LP anylist RP */ |
| 170320 | | - -2, /* (403) anylist ::= anylist ANY */ |
| 170321 | | - 0, /* (404) with ::= */ |
| 170708 | + -1, /* (178) expr ::= ID|INDEXED|JOIN_KW */ |
| 170709 | + -3, /* (179) expr ::= nm DOT nm */ |
| 170710 | + -5, /* (180) expr ::= nm DOT nm DOT nm */ |
| 170711 | + -1, /* (181) term ::= NULL|FLOAT|BLOB */ |
| 170712 | + -1, /* (182) term ::= STRING */ |
| 170713 | + -1, /* (183) term ::= INTEGER */ |
| 170714 | + -1, /* (184) expr ::= VARIABLE */ |
| 170715 | + -3, /* (185) expr ::= expr COLLATE ID|STRING */ |
| 170716 | + -6, /* (186) expr ::= CAST LP expr AS typetoken RP */ |
| 170717 | + -5, /* (187) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ |
| 170718 | + -4, /* (188) expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ |
| 170719 | + -6, /* (189) expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ |
| 170720 | + -5, /* (190) expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ |
| 170721 | + -1, /* (191) term ::= CTIME_KW */ |
| 170722 | + -5, /* (192) expr ::= LP nexprlist COMMA expr RP */ |
| 170723 | + -3, /* (193) expr ::= expr AND expr */ |
| 170724 | + -3, /* (194) expr ::= expr OR expr */ |
| 170725 | + -3, /* (195) expr ::= expr LT|GT|GE|LE expr */ |
| 170726 | + -3, /* (196) expr ::= expr EQ|NE expr */ |
| 170727 | + -3, /* (197) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ |
| 170728 | + -3, /* (198) expr ::= expr PLUS|MINUS expr */ |
| 170729 | + -3, /* (199) expr ::= expr STAR|SLASH|REM expr */ |
| 170730 | + -3, /* (200) expr ::= expr CONCAT expr */ |
| 170731 | + -2, /* (201) likeop ::= NOT LIKE_KW|MATCH */ |
| 170732 | + -3, /* (202) expr ::= expr likeop expr */ |
| 170733 | + -5, /* (203) expr ::= expr likeop expr ESCAPE expr */ |
| 170734 | + -2, /* (204) expr ::= expr ISNULL|NOTNULL */ |
| 170735 | + -3, /* (205) expr ::= expr NOT NULL */ |
| 170736 | + -3, /* (206) expr ::= expr IS expr */ |
| 170737 | + -4, /* (207) expr ::= expr IS NOT expr */ |
| 170738 | + -6, /* (208) expr ::= expr IS NOT DISTINCT FROM expr */ |
| 170739 | + -5, /* (209) expr ::= expr IS DISTINCT FROM expr */ |
| 170740 | + -2, /* (210) expr ::= NOT expr */ |
| 170741 | + -2, /* (211) expr ::= BITNOT expr */ |
| 170742 | + -2, /* (212) expr ::= PLUS|MINUS expr */ |
| 170743 | + -3, /* (213) expr ::= expr PTR expr */ |
| 170744 | + -1, /* (214) between_op ::= BETWEEN */ |
| 170745 | + -2, /* (215) between_op ::= NOT BETWEEN */ |
| 170746 | + -5, /* (216) expr ::= expr between_op expr AND expr */ |
| 170747 | + -1, /* (217) in_op ::= IN */ |
| 170748 | + -2, /* (218) in_op ::= NOT IN */ |
| 170749 | + -5, /* (219) expr ::= expr in_op LP exprlist RP */ |
| 170750 | + -3, /* (220) expr ::= LP select RP */ |
| 170751 | + -5, /* (221) expr ::= expr in_op LP select RP */ |
| 170752 | + -5, /* (222) expr ::= expr in_op nm dbnm paren_exprlist */ |
| 170753 | + -4, /* (223) expr ::= EXISTS LP select RP */ |
| 170754 | + -5, /* (224) expr ::= CASE case_operand case_exprlist case_else END */ |
| 170755 | + -5, /* (225) case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 170756 | + -4, /* (226) case_exprlist ::= WHEN expr THEN expr */ |
| 170757 | + -2, /* (227) case_else ::= ELSE expr */ |
| 170758 | + 0, /* (228) case_else ::= */ |
| 170759 | + -1, /* (229) case_operand ::= expr */ |
| 170760 | + 0, /* (230) case_operand ::= */ |
| 170761 | + 0, /* (231) exprlist ::= */ |
| 170762 | + -3, /* (232) nexprlist ::= nexprlist COMMA expr */ |
| 170763 | + -1, /* (233) nexprlist ::= expr */ |
| 170764 | + 0, /* (234) paren_exprlist ::= */ |
| 170765 | + -3, /* (235) paren_exprlist ::= LP exprlist RP */ |
| 170766 | + -12, /* (236) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 170767 | + -1, /* (237) uniqueflag ::= UNIQUE */ |
| 170768 | + 0, /* (238) uniqueflag ::= */ |
| 170769 | + 0, /* (239) eidlist_opt ::= */ |
| 170770 | + -3, /* (240) eidlist_opt ::= LP eidlist RP */ |
| 170771 | + -5, /* (241) eidlist ::= eidlist COMMA nm collate sortorder */ |
| 170772 | + -3, /* (242) eidlist ::= nm collate sortorder */ |
| 170773 | + 0, /* (243) collate ::= */ |
| 170774 | + -2, /* (244) collate ::= COLLATE ID|STRING */ |
| 170775 | + -4, /* (245) cmd ::= DROP INDEX ifexists fullname */ |
| 170776 | + -2, /* (246) cmd ::= VACUUM vinto */ |
| 170777 | + -3, /* (247) cmd ::= VACUUM nm vinto */ |
| 170778 | + -2, /* (248) vinto ::= INTO expr */ |
| 170779 | + 0, /* (249) vinto ::= */ |
| 170780 | + -3, /* (250) cmd ::= PRAGMA nm dbnm */ |
| 170781 | + -5, /* (251) cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 170782 | + -6, /* (252) cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 170783 | + -5, /* (253) cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 170784 | + -6, /* (254) cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 170785 | + -2, /* (255) plus_num ::= PLUS INTEGER|FLOAT */ |
| 170786 | + -2, /* (256) minus_num ::= MINUS INTEGER|FLOAT */ |
| 170787 | + -5, /* (257) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 170788 | + -11, /* (258) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 170789 | + -1, /* (259) trigger_time ::= BEFORE|AFTER */ |
| 170790 | + -2, /* (260) trigger_time ::= INSTEAD OF */ |
| 170791 | + 0, /* (261) trigger_time ::= */ |
| 170792 | + -1, /* (262) trigger_event ::= DELETE|INSERT */ |
| 170793 | + -1, /* (263) trigger_event ::= UPDATE */ |
| 170794 | + -3, /* (264) trigger_event ::= UPDATE OF idlist */ |
| 170795 | + 0, /* (265) when_clause ::= */ |
| 170796 | + -2, /* (266) when_clause ::= WHEN expr */ |
| 170797 | + -3, /* (267) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 170798 | + -2, /* (268) trigger_cmd_list ::= trigger_cmd SEMI */ |
| 170799 | + -3, /* (269) trnm ::= nm DOT nm */ |
| 170800 | + -3, /* (270) tridxby ::= INDEXED BY nm */ |
| 170801 | + -2, /* (271) tridxby ::= NOT INDEXED */ |
| 170802 | + -9, /* (272) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ |
| 170803 | + -8, /* (273) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 170804 | + -6, /* (274) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 170805 | + -3, /* (275) trigger_cmd ::= scanpt select scanpt */ |
| 170806 | + -4, /* (276) expr ::= RAISE LP IGNORE RP */ |
| 170807 | + -6, /* (277) expr ::= RAISE LP raisetype COMMA nm RP */ |
| 170808 | + -1, /* (278) raisetype ::= ROLLBACK */ |
| 170809 | + -1, /* (279) raisetype ::= ABORT */ |
| 170810 | + -1, /* (280) raisetype ::= FAIL */ |
| 170811 | + -4, /* (281) cmd ::= DROP TRIGGER ifexists fullname */ |
| 170812 | + -6, /* (282) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 170813 | + -3, /* (283) cmd ::= DETACH database_kw_opt expr */ |
| 170814 | + 0, /* (284) key_opt ::= */ |
| 170815 | + -2, /* (285) key_opt ::= KEY expr */ |
| 170816 | + -1, /* (286) cmd ::= REINDEX */ |
| 170817 | + -3, /* (287) cmd ::= REINDEX nm dbnm */ |
| 170818 | + -1, /* (288) cmd ::= ANALYZE */ |
| 170819 | + -3, /* (289) cmd ::= ANALYZE nm dbnm */ |
| 170820 | + -6, /* (290) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 170821 | + -7, /* (291) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 170822 | + -6, /* (292) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ |
| 170823 | + -1, /* (293) add_column_fullname ::= fullname */ |
| 170824 | + -8, /* (294) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 170825 | + -1, /* (295) cmd ::= create_vtab */ |
| 170826 | + -4, /* (296) cmd ::= create_vtab LP vtabarglist RP */ |
| 170827 | + -8, /* (297) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 170828 | + 0, /* (298) vtabarg ::= */ |
| 170829 | + -1, /* (299) vtabargtoken ::= ANY */ |
| 170830 | + -3, /* (300) vtabargtoken ::= lp anylist RP */ |
| 170831 | + -1, /* (301) lp ::= LP */ |
| 170832 | + -2, /* (302) with ::= WITH wqlist */ |
| 170833 | + -3, /* (303) with ::= WITH RECURSIVE wqlist */ |
| 170834 | + -1, /* (304) wqas ::= AS */ |
| 170835 | + -2, /* (305) wqas ::= AS MATERIALIZED */ |
| 170836 | + -3, /* (306) wqas ::= AS NOT MATERIALIZED */ |
| 170837 | + -6, /* (307) wqitem ::= nm eidlist_opt wqas LP select RP */ |
| 170838 | + -1, /* (308) wqlist ::= wqitem */ |
| 170839 | + -3, /* (309) wqlist ::= wqlist COMMA wqitem */ |
| 170840 | + -1, /* (310) windowdefn_list ::= windowdefn */ |
| 170841 | + -3, /* (311) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 170842 | + -5, /* (312) windowdefn ::= nm AS LP window RP */ |
| 170843 | + -5, /* (313) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 170844 | + -6, /* (314) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 170845 | + -4, /* (315) window ::= ORDER BY sortlist frame_opt */ |
| 170846 | + -5, /* (316) window ::= nm ORDER BY sortlist frame_opt */ |
| 170847 | + -1, /* (317) window ::= frame_opt */ |
| 170848 | + -2, /* (318) window ::= nm frame_opt */ |
| 170849 | + 0, /* (319) frame_opt ::= */ |
| 170850 | + -3, /* (320) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 170851 | + -6, /* (321) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 170852 | + -1, /* (322) range_or_rows ::= RANGE|ROWS|GROUPS */ |
| 170853 | + -1, /* (323) frame_bound_s ::= frame_bound */ |
| 170854 | + -2, /* (324) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 170855 | + -1, /* (325) frame_bound_e ::= frame_bound */ |
| 170856 | + -2, /* (326) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 170857 | + -2, /* (327) frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 170858 | + -2, /* (328) frame_bound ::= CURRENT ROW */ |
| 170859 | + 0, /* (329) frame_exclude_opt ::= */ |
| 170860 | + -2, /* (330) frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 170861 | + -2, /* (331) frame_exclude ::= NO OTHERS */ |
| 170862 | + -2, /* (332) frame_exclude ::= CURRENT ROW */ |
| 170863 | + -1, /* (333) frame_exclude ::= GROUP|TIES */ |
| 170864 | + -2, /* (334) window_clause ::= WINDOW windowdefn_list */ |
| 170865 | + -2, /* (335) filter_over ::= filter_clause over_clause */ |
| 170866 | + -1, /* (336) filter_over ::= over_clause */ |
| 170867 | + -1, /* (337) filter_over ::= filter_clause */ |
| 170868 | + -4, /* (338) over_clause ::= OVER LP window RP */ |
| 170869 | + -2, /* (339) over_clause ::= OVER nm */ |
| 170870 | + -5, /* (340) filter_clause ::= FILTER LP WHERE expr RP */ |
| 170871 | + -1, /* (341) input ::= cmdlist */ |
| 170872 | + -2, /* (342) cmdlist ::= cmdlist ecmd */ |
| 170873 | + -1, /* (343) cmdlist ::= ecmd */ |
| 170874 | + -1, /* (344) ecmd ::= SEMI */ |
| 170875 | + -2, /* (345) ecmd ::= cmdx SEMI */ |
| 170876 | + -3, /* (346) ecmd ::= explain cmdx SEMI */ |
| 170877 | + 0, /* (347) trans_opt ::= */ |
| 170878 | + -1, /* (348) trans_opt ::= TRANSACTION */ |
| 170879 | + -2, /* (349) trans_opt ::= TRANSACTION nm */ |
| 170880 | + -1, /* (350) savepoint_opt ::= SAVEPOINT */ |
| 170881 | + 0, /* (351) savepoint_opt ::= */ |
| 170882 | + -2, /* (352) cmd ::= create_table create_table_args */ |
| 170883 | + -1, /* (353) table_option_set ::= table_option */ |
| 170884 | + -4, /* (354) columnlist ::= columnlist COMMA columnname carglist */ |
| 170885 | + -2, /* (355) columnlist ::= columnname carglist */ |
| 170886 | + -1, /* (356) nm ::= ID|INDEXED|JOIN_KW */ |
| 170887 | + -1, /* (357) nm ::= STRING */ |
| 170888 | + -1, /* (358) typetoken ::= typename */ |
| 170889 | + -1, /* (359) typename ::= ID|STRING */ |
| 170890 | + -1, /* (360) signed ::= plus_num */ |
| 170891 | + -1, /* (361) signed ::= minus_num */ |
| 170892 | + -2, /* (362) carglist ::= carglist ccons */ |
| 170893 | + 0, /* (363) carglist ::= */ |
| 170894 | + -2, /* (364) ccons ::= NULL onconf */ |
| 170895 | + -4, /* (365) ccons ::= GENERATED ALWAYS AS generated */ |
| 170896 | + -2, /* (366) ccons ::= AS generated */ |
| 170897 | + -2, /* (367) conslist_opt ::= COMMA conslist */ |
| 170898 | + -3, /* (368) conslist ::= conslist tconscomma tcons */ |
| 170899 | + -1, /* (369) conslist ::= tcons */ |
| 170900 | + 0, /* (370) tconscomma ::= */ |
| 170901 | + -1, /* (371) defer_subclause_opt ::= defer_subclause */ |
| 170902 | + -1, /* (372) resolvetype ::= raisetype */ |
| 170903 | + -1, /* (373) selectnowith ::= oneselect */ |
| 170904 | + -1, /* (374) oneselect ::= values */ |
| 170905 | + -2, /* (375) sclp ::= selcollist COMMA */ |
| 170906 | + -1, /* (376) as ::= ID|STRING */ |
| 170907 | + -1, /* (377) indexed_opt ::= indexed_by */ |
| 170908 | + 0, /* (378) returning ::= */ |
| 170909 | + -1, /* (379) expr ::= term */ |
| 170910 | + -1, /* (380) likeop ::= LIKE_KW|MATCH */ |
| 170911 | + -1, /* (381) exprlist ::= nexprlist */ |
| 170912 | + -1, /* (382) nmnum ::= plus_num */ |
| 170913 | + -1, /* (383) nmnum ::= nm */ |
| 170914 | + -1, /* (384) nmnum ::= ON */ |
| 170915 | + -1, /* (385) nmnum ::= DELETE */ |
| 170916 | + -1, /* (386) nmnum ::= DEFAULT */ |
| 170917 | + -1, /* (387) plus_num ::= INTEGER|FLOAT */ |
| 170918 | + 0, /* (388) foreach_clause ::= */ |
| 170919 | + -3, /* (389) foreach_clause ::= FOR EACH ROW */ |
| 170920 | + -1, /* (390) trnm ::= nm */ |
| 170921 | + 0, /* (391) tridxby ::= */ |
| 170922 | + -1, /* (392) database_kw_opt ::= DATABASE */ |
| 170923 | + 0, /* (393) database_kw_opt ::= */ |
| 170924 | + 0, /* (394) kwcolumn_opt ::= */ |
| 170925 | + -1, /* (395) kwcolumn_opt ::= COLUMNKW */ |
| 170926 | + -1, /* (396) vtabarglist ::= vtabarg */ |
| 170927 | + -3, /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 170928 | + -2, /* (398) vtabarg ::= vtabarg vtabargtoken */ |
| 170929 | + 0, /* (399) anylist ::= */ |
| 170930 | + -4, /* (400) anylist ::= anylist LP anylist RP */ |
| 170931 | + -2, /* (401) anylist ::= anylist ANY */ |
| 170932 | + 0, /* (402) with ::= */ |
| 170322 | 170933 | }; |
| 170323 | 170934 | |
| 170324 | 170935 | static void yy_accept(yyParser*); /* Forward Declaration */ |
| 170325 | 170936 | |
| 170326 | 170937 | /* |
| | @@ -170376,11 +170987,11 @@ |
| 170376 | 170987 | {yymsp[1].minor.yy394 = TK_DEFERRED;} |
| 170377 | 170988 | break; |
| 170378 | 170989 | case 5: /* transtype ::= DEFERRED */ |
| 170379 | 170990 | case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6); |
| 170380 | 170991 | case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7); |
| 170381 | | - case 323: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==323); |
| 170992 | + case 322: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==322); |
| 170382 | 170993 | {yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/} |
| 170383 | 170994 | break; |
| 170384 | 170995 | case 8: /* cmd ::= COMMIT|END trans_opt */ |
| 170385 | 170996 | case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9); |
| 170386 | 170997 | {sqlite3EndTransaction(pParse,yymsp[-1].major);} |
| | @@ -170413,11 +171024,11 @@ |
| 170413 | 171024 | case 47: /* autoinc ::= */ yytestcase(yyruleno==47); |
| 170414 | 171025 | case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62); |
| 170415 | 171026 | case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72); |
| 170416 | 171027 | case 81: /* ifexists ::= */ yytestcase(yyruleno==81); |
| 170417 | 171028 | case 98: /* distinct ::= */ yytestcase(yyruleno==98); |
| 170418 | | - case 244: /* collate ::= */ yytestcase(yyruleno==244); |
| 171029 | + case 243: /* collate ::= */ yytestcase(yyruleno==243); |
| 170419 | 171030 | {yymsp[1].minor.yy394 = 0;} |
| 170420 | 171031 | break; |
| 170421 | 171032 | case 16: /* ifnotexists ::= IF NOT EXISTS */ |
| 170422 | 171033 | {yymsp[-2].minor.yy394 = 1;} |
| 170423 | 171034 | break; |
| | @@ -170597,13 +171208,13 @@ |
| 170597 | 171208 | case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171); |
| 170598 | 171209 | {yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;} |
| 170599 | 171210 | break; |
| 170600 | 171211 | case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ |
| 170601 | 171212 | case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80); |
| 170602 | | - case 216: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==216); |
| 170603 | | - case 219: /* in_op ::= NOT IN */ yytestcase(yyruleno==219); |
| 170604 | | - case 245: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==245); |
| 171213 | + case 215: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==215); |
| 171214 | + case 218: /* in_op ::= NOT IN */ yytestcase(yyruleno==218); |
| 171215 | + case 244: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==244); |
| 170605 | 171216 | {yymsp[-1].minor.yy394 = 1;} |
| 170606 | 171217 | break; |
| 170607 | 171218 | case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ |
| 170608 | 171219 | {yymsp[-1].minor.yy394 = 0;} |
| 170609 | 171220 | break; |
| | @@ -170749,13 +171360,13 @@ |
| 170749 | 171360 | {yymsp[0].minor.yy394 = SF_All;} |
| 170750 | 171361 | break; |
| 170751 | 171362 | case 99: /* sclp ::= */ |
| 170752 | 171363 | case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132); |
| 170753 | 171364 | case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142); |
| 170754 | | - case 232: /* exprlist ::= */ yytestcase(yyruleno==232); |
| 170755 | | - case 235: /* paren_exprlist ::= */ yytestcase(yyruleno==235); |
| 170756 | | - case 240: /* eidlist_opt ::= */ yytestcase(yyruleno==240); |
| 171365 | + case 231: /* exprlist ::= */ yytestcase(yyruleno==231); |
| 171366 | + case 234: /* paren_exprlist ::= */ yytestcase(yyruleno==234); |
| 171367 | + case 239: /* eidlist_opt ::= */ yytestcase(yyruleno==239); |
| 170757 | 171368 | {yymsp[1].minor.yy322 = 0;} |
| 170758 | 171369 | break; |
| 170759 | 171370 | case 100: /* selcollist ::= sclp scanpt expr scanpt as */ |
| 170760 | 171371 | { |
| 170761 | 171372 | yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528); |
| | @@ -170777,12 +171388,12 @@ |
| 170777 | 171388 | yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot); |
| 170778 | 171389 | } |
| 170779 | 171390 | break; |
| 170780 | 171391 | case 103: /* as ::= AS nm */ |
| 170781 | 171392 | case 115: /* dbnm ::= DOT nm */ yytestcase(yyruleno==115); |
| 170782 | | - case 256: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==256); |
| 170783 | | - case 257: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==257); |
| 171393 | + case 255: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==255); |
| 171394 | + case 256: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==256); |
| 170784 | 171395 | {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} |
| 170785 | 171396 | break; |
| 170786 | 171397 | case 105: /* from ::= */ |
| 170787 | 171398 | case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108); |
| 170788 | 171399 | {yymsp[1].minor.yy131 = 0;} |
| | @@ -170950,20 +171561,20 @@ |
| 170950 | 171561 | break; |
| 170951 | 171562 | case 144: /* having_opt ::= */ |
| 170952 | 171563 | case 146: /* limit_opt ::= */ yytestcase(yyruleno==146); |
| 170953 | 171564 | case 151: /* where_opt ::= */ yytestcase(yyruleno==151); |
| 170954 | 171565 | case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153); |
| 170955 | | - case 229: /* case_else ::= */ yytestcase(yyruleno==229); |
| 170956 | | - case 231: /* case_operand ::= */ yytestcase(yyruleno==231); |
| 170957 | | - case 250: /* vinto ::= */ yytestcase(yyruleno==250); |
| 171566 | + case 228: /* case_else ::= */ yytestcase(yyruleno==228); |
| 171567 | + case 230: /* case_operand ::= */ yytestcase(yyruleno==230); |
| 171568 | + case 249: /* vinto ::= */ yytestcase(yyruleno==249); |
| 170958 | 171569 | {yymsp[1].minor.yy528 = 0;} |
| 170959 | 171570 | break; |
| 170960 | 171571 | case 145: /* having_opt ::= HAVING expr */ |
| 170961 | 171572 | case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152); |
| 170962 | 171573 | case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154); |
| 170963 | | - case 228: /* case_else ::= ELSE expr */ yytestcase(yyruleno==228); |
| 170964 | | - case 249: /* vinto ::= INTO expr */ yytestcase(yyruleno==249); |
| 171574 | + case 227: /* case_else ::= ELSE expr */ yytestcase(yyruleno==227); |
| 171575 | + case 248: /* vinto ::= INTO expr */ yytestcase(yyruleno==248); |
| 170965 | 171576 | {yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;} |
| 170966 | 171577 | break; |
| 170967 | 171578 | case 147: /* limit_opt ::= LIMIT expr */ |
| 170968 | 171579 | {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);} |
| 170969 | 171580 | break; |
| | @@ -171071,23 +171682,22 @@ |
| 171071 | 171682 | {yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} |
| 171072 | 171683 | break; |
| 171073 | 171684 | case 177: /* expr ::= LP expr RP */ |
| 171074 | 171685 | {yymsp[-2].minor.yy528 = yymsp[-1].minor.yy528;} |
| 171075 | 171686 | break; |
| 171076 | | - case 178: /* expr ::= ID|INDEXED */ |
| 171077 | | - case 179: /* expr ::= JOIN_KW */ yytestcase(yyruleno==179); |
| 171687 | + case 178: /* expr ::= ID|INDEXED|JOIN_KW */ |
| 171078 | 171688 | {yymsp[0].minor.yy528=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 171079 | 171689 | break; |
| 171080 | | - case 180: /* expr ::= nm DOT nm */ |
| 171690 | + case 179: /* expr ::= nm DOT nm */ |
| 171081 | 171691 | { |
| 171082 | 171692 | Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0); |
| 171083 | 171693 | Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); |
| 171084 | 171694 | yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); |
| 171085 | 171695 | } |
| 171086 | 171696 | yymsp[-2].minor.yy528 = yylhsminor.yy528; |
| 171087 | 171697 | break; |
| 171088 | | - case 181: /* expr ::= nm DOT nm DOT nm */ |
| 171698 | + case 180: /* expr ::= nm DOT nm DOT nm */ |
| 171089 | 171699 | { |
| 171090 | 171700 | Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0); |
| 171091 | 171701 | Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0); |
| 171092 | 171702 | Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); |
| 171093 | 171703 | Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3); |
| | @@ -171096,22 +171706,22 @@ |
| 171096 | 171706 | } |
| 171097 | 171707 | yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); |
| 171098 | 171708 | } |
| 171099 | 171709 | yymsp[-4].minor.yy528 = yylhsminor.yy528; |
| 171100 | 171710 | break; |
| 171101 | | - case 182: /* term ::= NULL|FLOAT|BLOB */ |
| 171102 | | - case 183: /* term ::= STRING */ yytestcase(yyruleno==183); |
| 171711 | + case 181: /* term ::= NULL|FLOAT|BLOB */ |
| 171712 | + case 182: /* term ::= STRING */ yytestcase(yyruleno==182); |
| 171103 | 171713 | {yymsp[0].minor.yy528=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 171104 | 171714 | break; |
| 171105 | | - case 184: /* term ::= INTEGER */ |
| 171715 | + case 183: /* term ::= INTEGER */ |
| 171106 | 171716 | { |
| 171107 | 171717 | yylhsminor.yy528 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); |
| 171108 | 171718 | if( yylhsminor.yy528 ) yylhsminor.yy528->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail); |
| 171109 | 171719 | } |
| 171110 | 171720 | yymsp[0].minor.yy528 = yylhsminor.yy528; |
| 171111 | 171721 | break; |
| 171112 | | - case 185: /* expr ::= VARIABLE */ |
| 171722 | + case 184: /* expr ::= VARIABLE */ |
| 171113 | 171723 | { |
| 171114 | 171724 | if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){ |
| 171115 | 171725 | u32 n = yymsp[0].minor.yy0.n; |
| 171116 | 171726 | yymsp[0].minor.yy528 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0); |
| 171117 | 171727 | sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy528, n); |
| | @@ -171129,54 +171739,54 @@ |
| 171129 | 171739 | if( yymsp[0].minor.yy528 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy528->iTable); |
| 171130 | 171740 | } |
| 171131 | 171741 | } |
| 171132 | 171742 | } |
| 171133 | 171743 | break; |
| 171134 | | - case 186: /* expr ::= expr COLLATE ID|STRING */ |
| 171744 | + case 185: /* expr ::= expr COLLATE ID|STRING */ |
| 171135 | 171745 | { |
| 171136 | 171746 | yymsp[-2].minor.yy528 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy528, &yymsp[0].minor.yy0, 1); |
| 171137 | 171747 | } |
| 171138 | 171748 | break; |
| 171139 | | - case 187: /* expr ::= CAST LP expr AS typetoken RP */ |
| 171749 | + case 186: /* expr ::= CAST LP expr AS typetoken RP */ |
| 171140 | 171750 | { |
| 171141 | 171751 | yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); |
| 171142 | 171752 | sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy528, yymsp[-3].minor.yy528, 0); |
| 171143 | 171753 | } |
| 171144 | 171754 | break; |
| 171145 | | - case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 171755 | + case 187: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP */ |
| 171146 | 171756 | { |
| 171147 | 171757 | yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy394); |
| 171148 | 171758 | } |
| 171149 | 171759 | yymsp[-4].minor.yy528 = yylhsminor.yy528; |
| 171150 | 171760 | break; |
| 171151 | | - case 189: /* expr ::= ID|INDEXED LP STAR RP */ |
| 171761 | + case 188: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP */ |
| 171152 | 171762 | { |
| 171153 | 171763 | yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0); |
| 171154 | 171764 | } |
| 171155 | 171765 | yymsp[-3].minor.yy528 = yylhsminor.yy528; |
| 171156 | 171766 | break; |
| 171157 | | - case 190: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ |
| 171767 | + case 189: /* expr ::= ID|INDEXED|JOIN_KW LP distinct exprlist RP filter_over */ |
| 171158 | 171768 | { |
| 171159 | 171769 | yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy322, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy394); |
| 171160 | 171770 | sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41); |
| 171161 | 171771 | } |
| 171162 | 171772 | yymsp[-5].minor.yy528 = yylhsminor.yy528; |
| 171163 | 171773 | break; |
| 171164 | | - case 191: /* expr ::= ID|INDEXED LP STAR RP filter_over */ |
| 171774 | + case 190: /* expr ::= ID|INDEXED|JOIN_KW LP STAR RP filter_over */ |
| 171165 | 171775 | { |
| 171166 | 171776 | yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0); |
| 171167 | 171777 | sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41); |
| 171168 | 171778 | } |
| 171169 | 171779 | yymsp[-4].minor.yy528 = yylhsminor.yy528; |
| 171170 | 171780 | break; |
| 171171 | | - case 192: /* term ::= CTIME_KW */ |
| 171781 | + case 191: /* term ::= CTIME_KW */ |
| 171172 | 171782 | { |
| 171173 | 171783 | yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0); |
| 171174 | 171784 | } |
| 171175 | 171785 | yymsp[0].minor.yy528 = yylhsminor.yy528; |
| 171176 | 171786 | break; |
| 171177 | | - case 193: /* expr ::= LP nexprlist COMMA expr RP */ |
| 171787 | + case 192: /* expr ::= LP nexprlist COMMA expr RP */ |
| 171178 | 171788 | { |
| 171179 | 171789 | ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528); |
| 171180 | 171790 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); |
| 171181 | 171791 | if( yymsp[-4].minor.yy528 ){ |
| 171182 | 171792 | yymsp[-4].minor.yy528->x.pList = pList; |
| | @@ -171186,26 +171796,26 @@ |
| 171186 | 171796 | }else{ |
| 171187 | 171797 | sqlite3ExprListDelete(pParse->db, pList); |
| 171188 | 171798 | } |
| 171189 | 171799 | } |
| 171190 | 171800 | break; |
| 171191 | | - case 194: /* expr ::= expr AND expr */ |
| 171801 | + case 193: /* expr ::= expr AND expr */ |
| 171192 | 171802 | {yymsp[-2].minor.yy528=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);} |
| 171193 | 171803 | break; |
| 171194 | | - case 195: /* expr ::= expr OR expr */ |
| 171195 | | - case 196: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==196); |
| 171196 | | - case 197: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==197); |
| 171197 | | - case 198: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==198); |
| 171198 | | - case 199: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==199); |
| 171199 | | - case 200: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==200); |
| 171200 | | - case 201: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==201); |
| 171804 | + case 194: /* expr ::= expr OR expr */ |
| 171805 | + case 195: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==195); |
| 171806 | + case 196: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==196); |
| 171807 | + case 197: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==197); |
| 171808 | + case 198: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==198); |
| 171809 | + case 199: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==199); |
| 171810 | + case 200: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==200); |
| 171201 | 171811 | {yymsp[-2].minor.yy528=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);} |
| 171202 | 171812 | break; |
| 171203 | | - case 202: /* likeop ::= NOT LIKE_KW|MATCH */ |
| 171813 | + case 201: /* likeop ::= NOT LIKE_KW|MATCH */ |
| 171204 | 171814 | {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/} |
| 171205 | 171815 | break; |
| 171206 | | - case 203: /* expr ::= expr likeop expr */ |
| 171816 | + case 202: /* expr ::= expr likeop expr */ |
| 171207 | 171817 | { |
| 171208 | 171818 | ExprList *pList; |
| 171209 | 171819 | int bNot = yymsp[-1].minor.yy0.n & 0x80000000; |
| 171210 | 171820 | yymsp[-1].minor.yy0.n &= 0x7fffffff; |
| 171211 | 171821 | pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy528); |
| | @@ -171213,11 +171823,11 @@ |
| 171213 | 171823 | yymsp[-2].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); |
| 171214 | 171824 | if( bNot ) yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy528, 0); |
| 171215 | 171825 | if( yymsp[-2].minor.yy528 ) yymsp[-2].minor.yy528->flags |= EP_InfixFunc; |
| 171216 | 171826 | } |
| 171217 | 171827 | break; |
| 171218 | | - case 204: /* expr ::= expr likeop expr ESCAPE expr */ |
| 171828 | + case 203: /* expr ::= expr likeop expr ESCAPE expr */ |
| 171219 | 171829 | { |
| 171220 | 171830 | ExprList *pList; |
| 171221 | 171831 | int bNot = yymsp[-3].minor.yy0.n & 0x80000000; |
| 171222 | 171832 | yymsp[-3].minor.yy0.n &= 0x7fffffff; |
| 171223 | 171833 | pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); |
| | @@ -171226,63 +171836,63 @@ |
| 171226 | 171836 | yymsp[-4].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0); |
| 171227 | 171837 | if( bNot ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); |
| 171228 | 171838 | if( yymsp[-4].minor.yy528 ) yymsp[-4].minor.yy528->flags |= EP_InfixFunc; |
| 171229 | 171839 | } |
| 171230 | 171840 | break; |
| 171231 | | - case 205: /* expr ::= expr ISNULL|NOTNULL */ |
| 171841 | + case 204: /* expr ::= expr ISNULL|NOTNULL */ |
| 171232 | 171842 | {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy528,0);} |
| 171233 | 171843 | break; |
| 171234 | | - case 206: /* expr ::= expr NOT NULL */ |
| 171844 | + case 205: /* expr ::= expr NOT NULL */ |
| 171235 | 171845 | {yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy528,0);} |
| 171236 | 171846 | break; |
| 171237 | | - case 207: /* expr ::= expr IS expr */ |
| 171847 | + case 206: /* expr ::= expr IS expr */ |
| 171238 | 171848 | { |
| 171239 | 171849 | yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy528,yymsp[0].minor.yy528); |
| 171240 | 171850 | binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-2].minor.yy528, TK_ISNULL); |
| 171241 | 171851 | } |
| 171242 | 171852 | break; |
| 171243 | | - case 208: /* expr ::= expr IS NOT expr */ |
| 171853 | + case 207: /* expr ::= expr IS NOT expr */ |
| 171244 | 171854 | { |
| 171245 | 171855 | yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528); |
| 171246 | 171856 | binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL); |
| 171247 | 171857 | } |
| 171248 | 171858 | break; |
| 171249 | | - case 209: /* expr ::= expr IS NOT DISTINCT FROM expr */ |
| 171859 | + case 208: /* expr ::= expr IS NOT DISTINCT FROM expr */ |
| 171250 | 171860 | { |
| 171251 | 171861 | yymsp[-5].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-5].minor.yy528,yymsp[0].minor.yy528); |
| 171252 | 171862 | binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-5].minor.yy528, TK_ISNULL); |
| 171253 | 171863 | } |
| 171254 | 171864 | break; |
| 171255 | | - case 210: /* expr ::= expr IS DISTINCT FROM expr */ |
| 171865 | + case 209: /* expr ::= expr IS DISTINCT FROM expr */ |
| 171256 | 171866 | { |
| 171257 | 171867 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-4].minor.yy528,yymsp[0].minor.yy528); |
| 171258 | 171868 | binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-4].minor.yy528, TK_NOTNULL); |
| 171259 | 171869 | } |
| 171260 | 171870 | break; |
| 171261 | | - case 211: /* expr ::= NOT expr */ |
| 171262 | | - case 212: /* expr ::= BITNOT expr */ yytestcase(yyruleno==212); |
| 171871 | + case 210: /* expr ::= NOT expr */ |
| 171872 | + case 211: /* expr ::= BITNOT expr */ yytestcase(yyruleno==211); |
| 171263 | 171873 | {yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/} |
| 171264 | 171874 | break; |
| 171265 | | - case 213: /* expr ::= PLUS|MINUS expr */ |
| 171875 | + case 212: /* expr ::= PLUS|MINUS expr */ |
| 171266 | 171876 | { |
| 171267 | 171877 | yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0); |
| 171268 | 171878 | /*A-overwrites-B*/ |
| 171269 | 171879 | } |
| 171270 | 171880 | break; |
| 171271 | | - case 214: /* expr ::= expr PTR expr */ |
| 171881 | + case 213: /* expr ::= expr PTR expr */ |
| 171272 | 171882 | { |
| 171273 | 171883 | ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528); |
| 171274 | 171884 | pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528); |
| 171275 | 171885 | yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); |
| 171276 | 171886 | } |
| 171277 | 171887 | yymsp[-2].minor.yy528 = yylhsminor.yy528; |
| 171278 | 171888 | break; |
| 171279 | | - case 215: /* between_op ::= BETWEEN */ |
| 171280 | | - case 218: /* in_op ::= IN */ yytestcase(yyruleno==218); |
| 171889 | + case 214: /* between_op ::= BETWEEN */ |
| 171890 | + case 217: /* in_op ::= IN */ yytestcase(yyruleno==217); |
| 171281 | 171891 | {yymsp[0].minor.yy394 = 0;} |
| 171282 | 171892 | break; |
| 171283 | | - case 217: /* expr ::= expr between_op expr AND expr */ |
| 171893 | + case 216: /* expr ::= expr between_op expr AND expr */ |
| 171284 | 171894 | { |
| 171285 | 171895 | ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); |
| 171286 | 171896 | pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528); |
| 171287 | 171897 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0); |
| 171288 | 171898 | if( yymsp[-4].minor.yy528 ){ |
| | @@ -171291,11 +171901,11 @@ |
| 171291 | 171901 | sqlite3ExprListDelete(pParse->db, pList); |
| 171292 | 171902 | } |
| 171293 | 171903 | if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); |
| 171294 | 171904 | } |
| 171295 | 171905 | break; |
| 171296 | | - case 220: /* expr ::= expr in_op LP exprlist RP */ |
| 171906 | + case 219: /* expr ::= expr in_op LP exprlist RP */ |
| 171297 | 171907 | { |
| 171298 | 171908 | if( yymsp[-1].minor.yy322==0 ){ |
| 171299 | 171909 | /* Expressions of the form |
| 171300 | 171910 | ** |
| 171301 | 171911 | ** expr1 IN () |
| | @@ -171337,41 +171947,41 @@ |
| 171337 | 171947 | } |
| 171338 | 171948 | if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); |
| 171339 | 171949 | } |
| 171340 | 171950 | } |
| 171341 | 171951 | break; |
| 171342 | | - case 221: /* expr ::= LP select RP */ |
| 171952 | + case 220: /* expr ::= LP select RP */ |
| 171343 | 171953 | { |
| 171344 | 171954 | yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); |
| 171345 | 171955 | sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47); |
| 171346 | 171956 | } |
| 171347 | 171957 | break; |
| 171348 | | - case 222: /* expr ::= expr in_op LP select RP */ |
| 171958 | + case 221: /* expr ::= expr in_op LP select RP */ |
| 171349 | 171959 | { |
| 171350 | 171960 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); |
| 171351 | 171961 | sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47); |
| 171352 | 171962 | if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); |
| 171353 | 171963 | } |
| 171354 | 171964 | break; |
| 171355 | | - case 223: /* expr ::= expr in_op nm dbnm paren_exprlist */ |
| 171965 | + case 222: /* expr ::= expr in_op nm dbnm paren_exprlist */ |
| 171356 | 171966 | { |
| 171357 | 171967 | SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); |
| 171358 | 171968 | Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0); |
| 171359 | 171969 | if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322); |
| 171360 | 171970 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); |
| 171361 | 171971 | sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect); |
| 171362 | 171972 | if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); |
| 171363 | 171973 | } |
| 171364 | 171974 | break; |
| 171365 | | - case 224: /* expr ::= EXISTS LP select RP */ |
| 171975 | + case 223: /* expr ::= EXISTS LP select RP */ |
| 171366 | 171976 | { |
| 171367 | 171977 | Expr *p; |
| 171368 | 171978 | p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); |
| 171369 | 171979 | sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47); |
| 171370 | 171980 | } |
| 171371 | 171981 | break; |
| 171372 | | - case 225: /* expr ::= CASE case_operand case_exprlist case_else END */ |
| 171982 | + case 224: /* expr ::= CASE case_operand case_exprlist case_else END */ |
| 171373 | 171983 | { |
| 171374 | 171984 | yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0); |
| 171375 | 171985 | if( yymsp[-4].minor.yy528 ){ |
| 171376 | 171986 | yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322; |
| 171377 | 171987 | sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528); |
| | @@ -171379,406 +171989,406 @@ |
| 171379 | 171989 | sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322); |
| 171380 | 171990 | sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528); |
| 171381 | 171991 | } |
| 171382 | 171992 | } |
| 171383 | 171993 | break; |
| 171384 | | - case 226: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 171994 | + case 225: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 171385 | 171995 | { |
| 171386 | 171996 | yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528); |
| 171387 | 171997 | yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528); |
| 171388 | 171998 | } |
| 171389 | 171999 | break; |
| 171390 | | - case 227: /* case_exprlist ::= WHEN expr THEN expr */ |
| 172000 | + case 226: /* case_exprlist ::= WHEN expr THEN expr */ |
| 171391 | 172001 | { |
| 171392 | 172002 | yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); |
| 171393 | 172003 | yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528); |
| 171394 | 172004 | } |
| 171395 | 172005 | break; |
| 171396 | | - case 230: /* case_operand ::= expr */ |
| 172006 | + case 229: /* case_operand ::= expr */ |
| 171397 | 172007 | {yymsp[0].minor.yy528 = yymsp[0].minor.yy528; /*A-overwrites-X*/} |
| 171398 | 172008 | break; |
| 171399 | | - case 233: /* nexprlist ::= nexprlist COMMA expr */ |
| 172009 | + case 232: /* nexprlist ::= nexprlist COMMA expr */ |
| 171400 | 172010 | {yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);} |
| 171401 | 172011 | break; |
| 171402 | | - case 234: /* nexprlist ::= expr */ |
| 172012 | + case 233: /* nexprlist ::= expr */ |
| 171403 | 172013 | {yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/} |
| 171404 | 172014 | break; |
| 171405 | | - case 236: /* paren_exprlist ::= LP exprlist RP */ |
| 171406 | | - case 241: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==241); |
| 172015 | + case 235: /* paren_exprlist ::= LP exprlist RP */ |
| 172016 | + case 240: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==240); |
| 171407 | 172017 | {yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;} |
| 171408 | 172018 | break; |
| 171409 | | - case 237: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 172019 | + case 236: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 171410 | 172020 | { |
| 171411 | 172021 | sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, |
| 171412 | 172022 | sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394, |
| 171413 | 172023 | &yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF); |
| 171414 | 172024 | if( IN_RENAME_OBJECT && pParse->pNewIndex ){ |
| 171415 | 172025 | sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0); |
| 171416 | 172026 | } |
| 171417 | 172027 | } |
| 171418 | 172028 | break; |
| 171419 | | - case 238: /* uniqueflag ::= UNIQUE */ |
| 171420 | | - case 280: /* raisetype ::= ABORT */ yytestcase(yyruleno==280); |
| 172029 | + case 237: /* uniqueflag ::= UNIQUE */ |
| 172030 | + case 279: /* raisetype ::= ABORT */ yytestcase(yyruleno==279); |
| 171421 | 172031 | {yymsp[0].minor.yy394 = OE_Abort;} |
| 171422 | 172032 | break; |
| 171423 | | - case 239: /* uniqueflag ::= */ |
| 172033 | + case 238: /* uniqueflag ::= */ |
| 171424 | 172034 | {yymsp[1].minor.yy394 = OE_None;} |
| 171425 | 172035 | break; |
| 171426 | | - case 242: /* eidlist ::= eidlist COMMA nm collate sortorder */ |
| 172036 | + case 241: /* eidlist ::= eidlist COMMA nm collate sortorder */ |
| 171427 | 172037 | { |
| 171428 | 172038 | yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); |
| 171429 | 172039 | } |
| 171430 | 172040 | break; |
| 171431 | | - case 243: /* eidlist ::= nm collate sortorder */ |
| 172041 | + case 242: /* eidlist ::= nm collate sortorder */ |
| 171432 | 172042 | { |
| 171433 | 172043 | yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/ |
| 171434 | 172044 | } |
| 171435 | 172045 | break; |
| 171436 | | - case 246: /* cmd ::= DROP INDEX ifexists fullname */ |
| 172046 | + case 245: /* cmd ::= DROP INDEX ifexists fullname */ |
| 171437 | 172047 | {sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);} |
| 171438 | 172048 | break; |
| 171439 | | - case 247: /* cmd ::= VACUUM vinto */ |
| 172049 | + case 246: /* cmd ::= VACUUM vinto */ |
| 171440 | 172050 | {sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);} |
| 171441 | 172051 | break; |
| 171442 | | - case 248: /* cmd ::= VACUUM nm vinto */ |
| 172052 | + case 247: /* cmd ::= VACUUM nm vinto */ |
| 171443 | 172053 | {sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);} |
| 171444 | 172054 | break; |
| 171445 | | - case 251: /* cmd ::= PRAGMA nm dbnm */ |
| 172055 | + case 250: /* cmd ::= PRAGMA nm dbnm */ |
| 171446 | 172056 | {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} |
| 171447 | 172057 | break; |
| 171448 | | - case 252: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 172058 | + case 251: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 171449 | 172059 | {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} |
| 171450 | 172060 | break; |
| 171451 | | - case 253: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 172061 | + case 252: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 171452 | 172062 | {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} |
| 171453 | 172063 | break; |
| 171454 | | - case 254: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 172064 | + case 253: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 171455 | 172065 | {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} |
| 171456 | 172066 | break; |
| 171457 | | - case 255: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 172067 | + case 254: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 171458 | 172068 | {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);} |
| 171459 | 172069 | break; |
| 171460 | | - case 258: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 172070 | + case 257: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 171461 | 172071 | { |
| 171462 | 172072 | Token all; |
| 171463 | 172073 | all.z = yymsp[-3].minor.yy0.z; |
| 171464 | 172074 | all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n; |
| 171465 | 172075 | sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all); |
| 171466 | 172076 | } |
| 171467 | 172077 | break; |
| 171468 | | - case 259: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 172078 | + case 258: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 171469 | 172079 | { |
| 171470 | 172080 | sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy394, yymsp[-4].minor.yy180.a, yymsp[-4].minor.yy180.b, yymsp[-2].minor.yy131, yymsp[0].minor.yy528, yymsp[-10].minor.yy394, yymsp[-8].minor.yy394); |
| 171471 | 172081 | yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ |
| 171472 | 172082 | } |
| 171473 | 172083 | break; |
| 171474 | | - case 260: /* trigger_time ::= BEFORE|AFTER */ |
| 172084 | + case 259: /* trigger_time ::= BEFORE|AFTER */ |
| 171475 | 172085 | { yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ } |
| 171476 | 172086 | break; |
| 171477 | | - case 261: /* trigger_time ::= INSTEAD OF */ |
| 172087 | + case 260: /* trigger_time ::= INSTEAD OF */ |
| 171478 | 172088 | { yymsp[-1].minor.yy394 = TK_INSTEAD;} |
| 171479 | 172089 | break; |
| 171480 | | - case 262: /* trigger_time ::= */ |
| 172090 | + case 261: /* trigger_time ::= */ |
| 171481 | 172091 | { yymsp[1].minor.yy394 = TK_BEFORE; } |
| 171482 | 172092 | break; |
| 171483 | | - case 263: /* trigger_event ::= DELETE|INSERT */ |
| 171484 | | - case 264: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==264); |
| 172093 | + case 262: /* trigger_event ::= DELETE|INSERT */ |
| 172094 | + case 263: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==263); |
| 171485 | 172095 | {yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;} |
| 171486 | 172096 | break; |
| 171487 | | - case 265: /* trigger_event ::= UPDATE OF idlist */ |
| 172097 | + case 264: /* trigger_event ::= UPDATE OF idlist */ |
| 171488 | 172098 | {yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;} |
| 171489 | 172099 | break; |
| 171490 | | - case 266: /* when_clause ::= */ |
| 171491 | | - case 285: /* key_opt ::= */ yytestcase(yyruleno==285); |
| 172100 | + case 265: /* when_clause ::= */ |
| 172101 | + case 284: /* key_opt ::= */ yytestcase(yyruleno==284); |
| 171492 | 172102 | { yymsp[1].minor.yy528 = 0; } |
| 171493 | 172103 | break; |
| 171494 | | - case 267: /* when_clause ::= WHEN expr */ |
| 171495 | | - case 286: /* key_opt ::= KEY expr */ yytestcase(yyruleno==286); |
| 172104 | + case 266: /* when_clause ::= WHEN expr */ |
| 172105 | + case 285: /* key_opt ::= KEY expr */ yytestcase(yyruleno==285); |
| 171496 | 172106 | { yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; } |
| 171497 | 172107 | break; |
| 171498 | | - case 268: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 172108 | + case 267: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 171499 | 172109 | { |
| 171500 | 172110 | assert( yymsp[-2].minor.yy33!=0 ); |
| 171501 | 172111 | yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33; |
| 171502 | 172112 | yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33; |
| 171503 | 172113 | } |
| 171504 | 172114 | break; |
| 171505 | | - case 269: /* trigger_cmd_list ::= trigger_cmd SEMI */ |
| 172115 | + case 268: /* trigger_cmd_list ::= trigger_cmd SEMI */ |
| 171506 | 172116 | { |
| 171507 | 172117 | assert( yymsp[-1].minor.yy33!=0 ); |
| 171508 | 172118 | yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33; |
| 171509 | 172119 | } |
| 171510 | 172120 | break; |
| 171511 | | - case 270: /* trnm ::= nm DOT nm */ |
| 172121 | + case 269: /* trnm ::= nm DOT nm */ |
| 171512 | 172122 | { |
| 171513 | 172123 | yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; |
| 171514 | 172124 | sqlite3ErrorMsg(pParse, |
| 171515 | 172125 | "qualified table names are not allowed on INSERT, UPDATE, and DELETE " |
| 171516 | 172126 | "statements within triggers"); |
| 171517 | 172127 | } |
| 171518 | 172128 | break; |
| 171519 | | - case 271: /* tridxby ::= INDEXED BY nm */ |
| 172129 | + case 270: /* tridxby ::= INDEXED BY nm */ |
| 171520 | 172130 | { |
| 171521 | 172131 | sqlite3ErrorMsg(pParse, |
| 171522 | 172132 | "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " |
| 171523 | 172133 | "within triggers"); |
| 171524 | 172134 | } |
| 171525 | 172135 | break; |
| 171526 | | - case 272: /* tridxby ::= NOT INDEXED */ |
| 172136 | + case 271: /* tridxby ::= NOT INDEXED */ |
| 171527 | 172137 | { |
| 171528 | 172138 | sqlite3ErrorMsg(pParse, |
| 171529 | 172139 | "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " |
| 171530 | 172140 | "within triggers"); |
| 171531 | 172141 | } |
| 171532 | 172142 | break; |
| 171533 | | - case 273: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ |
| 172143 | + case 272: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ |
| 171534 | 172144 | {yylhsminor.yy33 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy131, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528, yymsp[-7].minor.yy394, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy522);} |
| 171535 | 172145 | yymsp[-8].minor.yy33 = yylhsminor.yy33; |
| 171536 | 172146 | break; |
| 171537 | | - case 274: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 172147 | + case 273: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 171538 | 172148 | { |
| 171539 | 172149 | yylhsminor.yy33 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy254,yymsp[-2].minor.yy47,yymsp[-6].minor.yy394,yymsp[-1].minor.yy444,yymsp[-7].minor.yy522,yymsp[0].minor.yy522);/*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/ |
| 171540 | 172150 | } |
| 171541 | 172151 | yymsp[-7].minor.yy33 = yylhsminor.yy33; |
| 171542 | 172152 | break; |
| 171543 | | - case 275: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 172153 | + case 274: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 171544 | 172154 | {yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);} |
| 171545 | 172155 | yymsp[-5].minor.yy33 = yylhsminor.yy33; |
| 171546 | 172156 | break; |
| 171547 | | - case 276: /* trigger_cmd ::= scanpt select scanpt */ |
| 172157 | + case 275: /* trigger_cmd ::= scanpt select scanpt */ |
| 171548 | 172158 | {yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/} |
| 171549 | 172159 | yymsp[-2].minor.yy33 = yylhsminor.yy33; |
| 171550 | 172160 | break; |
| 171551 | | - case 277: /* expr ::= RAISE LP IGNORE RP */ |
| 172161 | + case 276: /* expr ::= RAISE LP IGNORE RP */ |
| 171552 | 172162 | { |
| 171553 | 172163 | yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); |
| 171554 | 172164 | if( yymsp[-3].minor.yy528 ){ |
| 171555 | 172165 | yymsp[-3].minor.yy528->affExpr = OE_Ignore; |
| 171556 | 172166 | } |
| 171557 | 172167 | } |
| 171558 | 172168 | break; |
| 171559 | | - case 278: /* expr ::= RAISE LP raisetype COMMA nm RP */ |
| 172169 | + case 277: /* expr ::= RAISE LP raisetype COMMA nm RP */ |
| 171560 | 172170 | { |
| 171561 | 172171 | yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); |
| 171562 | 172172 | if( yymsp[-5].minor.yy528 ) { |
| 171563 | 172173 | yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394; |
| 171564 | 172174 | } |
| 171565 | 172175 | } |
| 171566 | 172176 | break; |
| 171567 | | - case 279: /* raisetype ::= ROLLBACK */ |
| 172177 | + case 278: /* raisetype ::= ROLLBACK */ |
| 171568 | 172178 | {yymsp[0].minor.yy394 = OE_Rollback;} |
| 171569 | 172179 | break; |
| 171570 | | - case 281: /* raisetype ::= FAIL */ |
| 172180 | + case 280: /* raisetype ::= FAIL */ |
| 171571 | 172181 | {yymsp[0].minor.yy394 = OE_Fail;} |
| 171572 | 172182 | break; |
| 171573 | | - case 282: /* cmd ::= DROP TRIGGER ifexists fullname */ |
| 172183 | + case 281: /* cmd ::= DROP TRIGGER ifexists fullname */ |
| 171574 | 172184 | { |
| 171575 | 172185 | sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394); |
| 171576 | 172186 | } |
| 171577 | 172187 | break; |
| 171578 | | - case 283: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 172188 | + case 282: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 171579 | 172189 | { |
| 171580 | 172190 | sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528); |
| 171581 | 172191 | } |
| 171582 | 172192 | break; |
| 171583 | | - case 284: /* cmd ::= DETACH database_kw_opt expr */ |
| 172193 | + case 283: /* cmd ::= DETACH database_kw_opt expr */ |
| 171584 | 172194 | { |
| 171585 | 172195 | sqlite3Detach(pParse, yymsp[0].minor.yy528); |
| 171586 | 172196 | } |
| 171587 | 172197 | break; |
| 171588 | | - case 287: /* cmd ::= REINDEX */ |
| 172198 | + case 286: /* cmd ::= REINDEX */ |
| 171589 | 172199 | {sqlite3Reindex(pParse, 0, 0);} |
| 171590 | 172200 | break; |
| 171591 | | - case 288: /* cmd ::= REINDEX nm dbnm */ |
| 172201 | + case 287: /* cmd ::= REINDEX nm dbnm */ |
| 171592 | 172202 | {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 171593 | 172203 | break; |
| 171594 | | - case 289: /* cmd ::= ANALYZE */ |
| 172204 | + case 288: /* cmd ::= ANALYZE */ |
| 171595 | 172205 | {sqlite3Analyze(pParse, 0, 0);} |
| 171596 | 172206 | break; |
| 171597 | | - case 290: /* cmd ::= ANALYZE nm dbnm */ |
| 172207 | + case 289: /* cmd ::= ANALYZE nm dbnm */ |
| 171598 | 172208 | {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 171599 | 172209 | break; |
| 171600 | | - case 291: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 172210 | + case 290: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 171601 | 172211 | { |
| 171602 | 172212 | sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0); |
| 171603 | 172213 | } |
| 171604 | 172214 | break; |
| 171605 | | - case 292: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 172215 | + case 291: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 171606 | 172216 | { |
| 171607 | 172217 | yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; |
| 171608 | 172218 | sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); |
| 171609 | 172219 | } |
| 171610 | 172220 | break; |
| 171611 | | - case 293: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ |
| 172221 | + case 292: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ |
| 171612 | 172222 | { |
| 171613 | 172223 | sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0); |
| 171614 | 172224 | } |
| 171615 | 172225 | break; |
| 171616 | | - case 294: /* add_column_fullname ::= fullname */ |
| 172226 | + case 293: /* add_column_fullname ::= fullname */ |
| 171617 | 172227 | { |
| 171618 | 172228 | disableLookaside(pParse); |
| 171619 | 172229 | sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131); |
| 171620 | 172230 | } |
| 171621 | 172231 | break; |
| 171622 | | - case 295: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 172232 | + case 294: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 171623 | 172233 | { |
| 171624 | 172234 | sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); |
| 171625 | 172235 | } |
| 171626 | 172236 | break; |
| 171627 | | - case 296: /* cmd ::= create_vtab */ |
| 172237 | + case 295: /* cmd ::= create_vtab */ |
| 171628 | 172238 | {sqlite3VtabFinishParse(pParse,0);} |
| 171629 | 172239 | break; |
| 171630 | | - case 297: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 172240 | + case 296: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 171631 | 172241 | {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} |
| 171632 | 172242 | break; |
| 171633 | | - case 298: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 172243 | + case 297: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 171634 | 172244 | { |
| 171635 | 172245 | sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394); |
| 171636 | 172246 | } |
| 171637 | 172247 | break; |
| 171638 | | - case 299: /* vtabarg ::= */ |
| 172248 | + case 298: /* vtabarg ::= */ |
| 171639 | 172249 | {sqlite3VtabArgInit(pParse);} |
| 171640 | 172250 | break; |
| 171641 | | - case 300: /* vtabargtoken ::= ANY */ |
| 171642 | | - case 301: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==301); |
| 171643 | | - case 302: /* lp ::= LP */ yytestcase(yyruleno==302); |
| 172251 | + case 299: /* vtabargtoken ::= ANY */ |
| 172252 | + case 300: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==300); |
| 172253 | + case 301: /* lp ::= LP */ yytestcase(yyruleno==301); |
| 171644 | 172254 | {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} |
| 171645 | 172255 | break; |
| 171646 | | - case 303: /* with ::= WITH wqlist */ |
| 171647 | | - case 304: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==304); |
| 172256 | + case 302: /* with ::= WITH wqlist */ |
| 172257 | + case 303: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==303); |
| 171648 | 172258 | { sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); } |
| 171649 | 172259 | break; |
| 171650 | | - case 305: /* wqas ::= AS */ |
| 172260 | + case 304: /* wqas ::= AS */ |
| 171651 | 172261 | {yymsp[0].minor.yy516 = M10d_Any;} |
| 171652 | 172262 | break; |
| 171653 | | - case 306: /* wqas ::= AS MATERIALIZED */ |
| 172263 | + case 305: /* wqas ::= AS MATERIALIZED */ |
| 171654 | 172264 | {yymsp[-1].minor.yy516 = M10d_Yes;} |
| 171655 | 172265 | break; |
| 171656 | | - case 307: /* wqas ::= AS NOT MATERIALIZED */ |
| 172266 | + case 306: /* wqas ::= AS NOT MATERIALIZED */ |
| 171657 | 172267 | {yymsp[-2].minor.yy516 = M10d_No;} |
| 171658 | 172268 | break; |
| 171659 | | - case 308: /* wqitem ::= nm eidlist_opt wqas LP select RP */ |
| 172269 | + case 307: /* wqitem ::= nm eidlist_opt wqas LP select RP */ |
| 171660 | 172270 | { |
| 171661 | 172271 | yymsp[-5].minor.yy385 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy47, yymsp[-3].minor.yy516); /*A-overwrites-X*/ |
| 171662 | 172272 | } |
| 171663 | 172273 | break; |
| 171664 | | - case 309: /* wqlist ::= wqitem */ |
| 172274 | + case 308: /* wqlist ::= wqitem */ |
| 171665 | 172275 | { |
| 171666 | 172276 | yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/ |
| 171667 | 172277 | } |
| 171668 | 172278 | break; |
| 171669 | | - case 310: /* wqlist ::= wqlist COMMA wqitem */ |
| 172279 | + case 309: /* wqlist ::= wqlist COMMA wqitem */ |
| 171670 | 172280 | { |
| 171671 | 172281 | yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385); |
| 171672 | 172282 | } |
| 171673 | 172283 | break; |
| 171674 | | - case 311: /* windowdefn_list ::= windowdefn */ |
| 172284 | + case 310: /* windowdefn_list ::= windowdefn */ |
| 171675 | 172285 | { yylhsminor.yy41 = yymsp[0].minor.yy41; } |
| 171676 | 172286 | yymsp[0].minor.yy41 = yylhsminor.yy41; |
| 171677 | 172287 | break; |
| 171678 | | - case 312: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 172288 | + case 311: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 171679 | 172289 | { |
| 171680 | 172290 | assert( yymsp[0].minor.yy41!=0 ); |
| 171681 | 172291 | sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41); |
| 171682 | 172292 | yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41; |
| 171683 | 172293 | yylhsminor.yy41 = yymsp[0].minor.yy41; |
| 171684 | 172294 | } |
| 171685 | 172295 | yymsp[-2].minor.yy41 = yylhsminor.yy41; |
| 171686 | 172296 | break; |
| 171687 | | - case 313: /* windowdefn ::= nm AS LP window RP */ |
| 172297 | + case 312: /* windowdefn ::= nm AS LP window RP */ |
| 171688 | 172298 | { |
| 171689 | 172299 | if( ALWAYS(yymsp[-1].minor.yy41) ){ |
| 171690 | 172300 | yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n); |
| 171691 | 172301 | } |
| 171692 | 172302 | yylhsminor.yy41 = yymsp[-1].minor.yy41; |
| 171693 | 172303 | } |
| 171694 | 172304 | yymsp[-4].minor.yy41 = yylhsminor.yy41; |
| 171695 | 172305 | break; |
| 171696 | | - case 314: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 172306 | + case 313: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ |
| 171697 | 172307 | { |
| 171698 | 172308 | yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0); |
| 171699 | 172309 | } |
| 171700 | 172310 | break; |
| 171701 | | - case 315: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 172311 | + case 314: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ |
| 171702 | 172312 | { |
| 171703 | 172313 | yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0); |
| 171704 | 172314 | } |
| 171705 | 172315 | yymsp[-5].minor.yy41 = yylhsminor.yy41; |
| 171706 | 172316 | break; |
| 171707 | | - case 316: /* window ::= ORDER BY sortlist frame_opt */ |
| 172317 | + case 315: /* window ::= ORDER BY sortlist frame_opt */ |
| 171708 | 172318 | { |
| 171709 | 172319 | yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0); |
| 171710 | 172320 | } |
| 171711 | 172321 | break; |
| 171712 | | - case 317: /* window ::= nm ORDER BY sortlist frame_opt */ |
| 172322 | + case 316: /* window ::= nm ORDER BY sortlist frame_opt */ |
| 171713 | 172323 | { |
| 171714 | 172324 | yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0); |
| 171715 | 172325 | } |
| 171716 | 172326 | yymsp[-4].minor.yy41 = yylhsminor.yy41; |
| 171717 | 172327 | break; |
| 171718 | | - case 318: /* window ::= frame_opt */ |
| 171719 | | - case 337: /* filter_over ::= over_clause */ yytestcase(yyruleno==337); |
| 172328 | + case 317: /* window ::= frame_opt */ |
| 172329 | + case 336: /* filter_over ::= over_clause */ yytestcase(yyruleno==336); |
| 171720 | 172330 | { |
| 171721 | 172331 | yylhsminor.yy41 = yymsp[0].minor.yy41; |
| 171722 | 172332 | } |
| 171723 | 172333 | yymsp[0].minor.yy41 = yylhsminor.yy41; |
| 171724 | 172334 | break; |
| 171725 | | - case 319: /* window ::= nm frame_opt */ |
| 172335 | + case 318: /* window ::= nm frame_opt */ |
| 171726 | 172336 | { |
| 171727 | 172337 | yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0); |
| 171728 | 172338 | } |
| 171729 | 172339 | yymsp[-1].minor.yy41 = yylhsminor.yy41; |
| 171730 | 172340 | break; |
| 171731 | | - case 320: /* frame_opt ::= */ |
| 172341 | + case 319: /* frame_opt ::= */ |
| 171732 | 172342 | { |
| 171733 | 172343 | yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0); |
| 171734 | 172344 | } |
| 171735 | 172345 | break; |
| 171736 | | - case 321: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 172346 | + case 320: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ |
| 171737 | 172347 | { |
| 171738 | 172348 | yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy394, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy516); |
| 171739 | 172349 | } |
| 171740 | 172350 | yymsp[-2].minor.yy41 = yylhsminor.yy41; |
| 171741 | 172351 | break; |
| 171742 | | - case 322: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 172352 | + case 321: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ |
| 171743 | 172353 | { |
| 171744 | 172354 | yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy394, yymsp[-3].minor.yy595.eType, yymsp[-3].minor.yy595.pExpr, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, yymsp[0].minor.yy516); |
| 171745 | 172355 | } |
| 171746 | 172356 | yymsp[-5].minor.yy41 = yylhsminor.yy41; |
| 171747 | 172357 | break; |
| 171748 | | - case 324: /* frame_bound_s ::= frame_bound */ |
| 171749 | | - case 326: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==326); |
| 172358 | + case 323: /* frame_bound_s ::= frame_bound */ |
| 172359 | + case 325: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==325); |
| 171750 | 172360 | {yylhsminor.yy595 = yymsp[0].minor.yy595;} |
| 171751 | 172361 | yymsp[0].minor.yy595 = yylhsminor.yy595; |
| 171752 | 172362 | break; |
| 171753 | | - case 325: /* frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 171754 | | - case 327: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==327); |
| 171755 | | - case 329: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==329); |
| 172363 | + case 324: /* frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 172364 | + case 326: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==326); |
| 172365 | + case 328: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==328); |
| 171756 | 172366 | {yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;} |
| 171757 | 172367 | yymsp[-1].minor.yy595 = yylhsminor.yy595; |
| 171758 | 172368 | break; |
| 171759 | | - case 328: /* frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 172369 | + case 327: /* frame_bound ::= expr PRECEDING|FOLLOWING */ |
| 171760 | 172370 | {yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;} |
| 171761 | 172371 | yymsp[-1].minor.yy595 = yylhsminor.yy595; |
| 171762 | 172372 | break; |
| 171763 | | - case 330: /* frame_exclude_opt ::= */ |
| 172373 | + case 329: /* frame_exclude_opt ::= */ |
| 171764 | 172374 | {yymsp[1].minor.yy516 = 0;} |
| 171765 | 172375 | break; |
| 171766 | | - case 331: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 172376 | + case 330: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ |
| 171767 | 172377 | {yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;} |
| 171768 | 172378 | break; |
| 171769 | | - case 332: /* frame_exclude ::= NO OTHERS */ |
| 171770 | | - case 333: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==333); |
| 172379 | + case 331: /* frame_exclude ::= NO OTHERS */ |
| 172380 | + case 332: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==332); |
| 171771 | 172381 | {yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/} |
| 171772 | 172382 | break; |
| 171773 | | - case 334: /* frame_exclude ::= GROUP|TIES */ |
| 172383 | + case 333: /* frame_exclude ::= GROUP|TIES */ |
| 171774 | 172384 | {yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/} |
| 171775 | 172385 | break; |
| 171776 | | - case 335: /* window_clause ::= WINDOW windowdefn_list */ |
| 172386 | + case 334: /* window_clause ::= WINDOW windowdefn_list */ |
| 171777 | 172387 | { yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; } |
| 171778 | 172388 | break; |
| 171779 | | - case 336: /* filter_over ::= filter_clause over_clause */ |
| 172389 | + case 335: /* filter_over ::= filter_clause over_clause */ |
| 171780 | 172390 | { |
| 171781 | 172391 | if( yymsp[0].minor.yy41 ){ |
| 171782 | 172392 | yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528; |
| 171783 | 172393 | }else{ |
| 171784 | 172394 | sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528); |
| | @@ -171785,11 +172395,11 @@ |
| 171785 | 172395 | } |
| 171786 | 172396 | yylhsminor.yy41 = yymsp[0].minor.yy41; |
| 171787 | 172397 | } |
| 171788 | 172398 | yymsp[-1].minor.yy41 = yylhsminor.yy41; |
| 171789 | 172399 | break; |
| 171790 | | - case 338: /* filter_over ::= filter_clause */ |
| 172400 | + case 337: /* filter_over ::= filter_clause */ |
| 171791 | 172401 | { |
| 171792 | 172402 | yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); |
| 171793 | 172403 | if( yylhsminor.yy41 ){ |
| 171794 | 172404 | yylhsminor.yy41->eFrmType = TK_FILTER; |
| 171795 | 172405 | yylhsminor.yy41->pFilter = yymsp[0].minor.yy528; |
| | @@ -171797,91 +172407,90 @@ |
| 171797 | 172407 | sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528); |
| 171798 | 172408 | } |
| 171799 | 172409 | } |
| 171800 | 172410 | yymsp[0].minor.yy41 = yylhsminor.yy41; |
| 171801 | 172411 | break; |
| 171802 | | - case 339: /* over_clause ::= OVER LP window RP */ |
| 172412 | + case 338: /* over_clause ::= OVER LP window RP */ |
| 171803 | 172413 | { |
| 171804 | 172414 | yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41; |
| 171805 | 172415 | assert( yymsp[-3].minor.yy41!=0 ); |
| 171806 | 172416 | } |
| 171807 | 172417 | break; |
| 171808 | | - case 340: /* over_clause ::= OVER nm */ |
| 172418 | + case 339: /* over_clause ::= OVER nm */ |
| 171809 | 172419 | { |
| 171810 | 172420 | yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); |
| 171811 | 172421 | if( yymsp[-1].minor.yy41 ){ |
| 171812 | 172422 | yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); |
| 171813 | 172423 | } |
| 171814 | 172424 | } |
| 171815 | 172425 | break; |
| 171816 | | - case 341: /* filter_clause ::= FILTER LP WHERE expr RP */ |
| 172426 | + case 340: /* filter_clause ::= FILTER LP WHERE expr RP */ |
| 171817 | 172427 | { yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; } |
| 171818 | 172428 | break; |
| 171819 | 172429 | default: |
| 171820 | | - /* (342) input ::= cmdlist */ yytestcase(yyruleno==342); |
| 171821 | | - /* (343) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==343); |
| 171822 | | - /* (344) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=344); |
| 171823 | | - /* (345) ecmd ::= SEMI */ yytestcase(yyruleno==345); |
| 171824 | | - /* (346) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==346); |
| 171825 | | - /* (347) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=347); |
| 171826 | | - /* (348) trans_opt ::= */ yytestcase(yyruleno==348); |
| 171827 | | - /* (349) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==349); |
| 171828 | | - /* (350) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==350); |
| 171829 | | - /* (351) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==351); |
| 171830 | | - /* (352) savepoint_opt ::= */ yytestcase(yyruleno==352); |
| 171831 | | - /* (353) cmd ::= create_table create_table_args */ yytestcase(yyruleno==353); |
| 171832 | | - /* (354) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=354); |
| 171833 | | - /* (355) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==355); |
| 171834 | | - /* (356) columnlist ::= columnname carglist */ yytestcase(yyruleno==356); |
| 171835 | | - /* (357) nm ::= ID|INDEXED */ yytestcase(yyruleno==357); |
| 171836 | | - /* (358) nm ::= STRING */ yytestcase(yyruleno==358); |
| 171837 | | - /* (359) nm ::= JOIN_KW */ yytestcase(yyruleno==359); |
| 171838 | | - /* (360) typetoken ::= typename */ yytestcase(yyruleno==360); |
| 171839 | | - /* (361) typename ::= ID|STRING */ yytestcase(yyruleno==361); |
| 171840 | | - /* (362) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=362); |
| 171841 | | - /* (363) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=363); |
| 171842 | | - /* (364) carglist ::= carglist ccons */ yytestcase(yyruleno==364); |
| 171843 | | - /* (365) carglist ::= */ yytestcase(yyruleno==365); |
| 171844 | | - /* (366) ccons ::= NULL onconf */ yytestcase(yyruleno==366); |
| 171845 | | - /* (367) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==367); |
| 171846 | | - /* (368) ccons ::= AS generated */ yytestcase(yyruleno==368); |
| 171847 | | - /* (369) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==369); |
| 171848 | | - /* (370) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==370); |
| 171849 | | - /* (371) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=371); |
| 171850 | | - /* (372) tconscomma ::= */ yytestcase(yyruleno==372); |
| 171851 | | - /* (373) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=373); |
| 171852 | | - /* (374) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=374); |
| 171853 | | - /* (375) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=375); |
| 171854 | | - /* (376) oneselect ::= values */ yytestcase(yyruleno==376); |
| 171855 | | - /* (377) sclp ::= selcollist COMMA */ yytestcase(yyruleno==377); |
| 171856 | | - /* (378) as ::= ID|STRING */ yytestcase(yyruleno==378); |
| 171857 | | - /* (379) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=379); |
| 171858 | | - /* (380) returning ::= */ yytestcase(yyruleno==380); |
| 171859 | | - /* (381) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=381); |
| 171860 | | - /* (382) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==382); |
| 171861 | | - /* (383) exprlist ::= nexprlist */ yytestcase(yyruleno==383); |
| 171862 | | - /* (384) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=384); |
| 171863 | | - /* (385) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=385); |
| 171864 | | - /* (386) nmnum ::= ON */ yytestcase(yyruleno==386); |
| 171865 | | - /* (387) nmnum ::= DELETE */ yytestcase(yyruleno==387); |
| 171866 | | - /* (388) nmnum ::= DEFAULT */ yytestcase(yyruleno==388); |
| 171867 | | - /* (389) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==389); |
| 171868 | | - /* (390) foreach_clause ::= */ yytestcase(yyruleno==390); |
| 171869 | | - /* (391) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==391); |
| 171870 | | - /* (392) trnm ::= nm */ yytestcase(yyruleno==392); |
| 171871 | | - /* (393) tridxby ::= */ yytestcase(yyruleno==393); |
| 171872 | | - /* (394) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==394); |
| 171873 | | - /* (395) database_kw_opt ::= */ yytestcase(yyruleno==395); |
| 171874 | | - /* (396) kwcolumn_opt ::= */ yytestcase(yyruleno==396); |
| 171875 | | - /* (397) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==397); |
| 171876 | | - /* (398) vtabarglist ::= vtabarg */ yytestcase(yyruleno==398); |
| 171877 | | - /* (399) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==399); |
| 171878 | | - /* (400) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==400); |
| 171879 | | - /* (401) anylist ::= */ yytestcase(yyruleno==401); |
| 171880 | | - /* (402) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==402); |
| 171881 | | - /* (403) anylist ::= anylist ANY */ yytestcase(yyruleno==403); |
| 171882 | | - /* (404) with ::= */ yytestcase(yyruleno==404); |
| 172430 | + /* (341) input ::= cmdlist */ yytestcase(yyruleno==341); |
| 172431 | + /* (342) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==342); |
| 172432 | + /* (343) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=343); |
| 172433 | + /* (344) ecmd ::= SEMI */ yytestcase(yyruleno==344); |
| 172434 | + /* (345) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==345); |
| 172435 | + /* (346) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=346); |
| 172436 | + /* (347) trans_opt ::= */ yytestcase(yyruleno==347); |
| 172437 | + /* (348) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==348); |
| 172438 | + /* (349) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==349); |
| 172439 | + /* (350) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==350); |
| 172440 | + /* (351) savepoint_opt ::= */ yytestcase(yyruleno==351); |
| 172441 | + /* (352) cmd ::= create_table create_table_args */ yytestcase(yyruleno==352); |
| 172442 | + /* (353) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=353); |
| 172443 | + /* (354) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==354); |
| 172444 | + /* (355) columnlist ::= columnname carglist */ yytestcase(yyruleno==355); |
| 172445 | + /* (356) nm ::= ID|INDEXED|JOIN_KW */ yytestcase(yyruleno==356); |
| 172446 | + /* (357) nm ::= STRING */ yytestcase(yyruleno==357); |
| 172447 | + /* (358) typetoken ::= typename */ yytestcase(yyruleno==358); |
| 172448 | + /* (359) typename ::= ID|STRING */ yytestcase(yyruleno==359); |
| 172449 | + /* (360) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=360); |
| 172450 | + /* (361) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=361); |
| 172451 | + /* (362) carglist ::= carglist ccons */ yytestcase(yyruleno==362); |
| 172452 | + /* (363) carglist ::= */ yytestcase(yyruleno==363); |
| 172453 | + /* (364) ccons ::= NULL onconf */ yytestcase(yyruleno==364); |
| 172454 | + /* (365) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==365); |
| 172455 | + /* (366) ccons ::= AS generated */ yytestcase(yyruleno==366); |
| 172456 | + /* (367) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==367); |
| 172457 | + /* (368) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==368); |
| 172458 | + /* (369) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=369); |
| 172459 | + /* (370) tconscomma ::= */ yytestcase(yyruleno==370); |
| 172460 | + /* (371) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=371); |
| 172461 | + /* (372) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=372); |
| 172462 | + /* (373) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=373); |
| 172463 | + /* (374) oneselect ::= values */ yytestcase(yyruleno==374); |
| 172464 | + /* (375) sclp ::= selcollist COMMA */ yytestcase(yyruleno==375); |
| 172465 | + /* (376) as ::= ID|STRING */ yytestcase(yyruleno==376); |
| 172466 | + /* (377) indexed_opt ::= indexed_by (OPTIMIZED OUT) */ assert(yyruleno!=377); |
| 172467 | + /* (378) returning ::= */ yytestcase(yyruleno==378); |
| 172468 | + /* (379) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=379); |
| 172469 | + /* (380) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==380); |
| 172470 | + /* (381) exprlist ::= nexprlist */ yytestcase(yyruleno==381); |
| 172471 | + /* (382) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=382); |
| 172472 | + /* (383) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=383); |
| 172473 | + /* (384) nmnum ::= ON */ yytestcase(yyruleno==384); |
| 172474 | + /* (385) nmnum ::= DELETE */ yytestcase(yyruleno==385); |
| 172475 | + /* (386) nmnum ::= DEFAULT */ yytestcase(yyruleno==386); |
| 172476 | + /* (387) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==387); |
| 172477 | + /* (388) foreach_clause ::= */ yytestcase(yyruleno==388); |
| 172478 | + /* (389) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==389); |
| 172479 | + /* (390) trnm ::= nm */ yytestcase(yyruleno==390); |
| 172480 | + /* (391) tridxby ::= */ yytestcase(yyruleno==391); |
| 172481 | + /* (392) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==392); |
| 172482 | + /* (393) database_kw_opt ::= */ yytestcase(yyruleno==393); |
| 172483 | + /* (394) kwcolumn_opt ::= */ yytestcase(yyruleno==394); |
| 172484 | + /* (395) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==395); |
| 172485 | + /* (396) vtabarglist ::= vtabarg */ yytestcase(yyruleno==396); |
| 172486 | + /* (397) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==397); |
| 172487 | + /* (398) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==398); |
| 172488 | + /* (399) anylist ::= */ yytestcase(yyruleno==399); |
| 172489 | + /* (400) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==400); |
| 172490 | + /* (401) anylist ::= anylist ANY */ yytestcase(yyruleno==401); |
| 172491 | + /* (402) with ::= */ yytestcase(yyruleno==402); |
| 171883 | 172492 | break; |
| 171884 | 172493 | /********** End reduce actions ************************************************/ |
| 171885 | 172494 | }; |
| 171886 | 172495 | assert( yyruleno<sizeof(yyRuleInfoLhs)/sizeof(yyRuleInfoLhs[0]) ); |
| 171887 | 172496 | yygoto = yyRuleInfoLhs[yyruleno]; |
| | @@ -172453,11 +173062,11 @@ |
| 172453 | 173062 | 132, 0, 98, 38, 39, 0, 20, 45, 117, 93, |
| 172454 | 173063 | }; |
| 172455 | 173064 | /* aKWNext[] forms the hash collision chain. If aKWHash[i]==0 |
| 172456 | 173065 | ** then the i-th keyword has no more hash collisions. Otherwise, |
| 172457 | 173066 | ** the next keyword with the same hash is aKWHash[i]-1. */ |
| 172458 | | -static const unsigned char aKWNext[147] = { |
| 173067 | +static const unsigned char aKWNext[148] = {0, |
| 172459 | 173068 | 0, 0, 0, 0, 4, 0, 43, 0, 0, 106, 114, 0, 0, |
| 172460 | 173069 | 0, 2, 0, 0, 143, 0, 0, 0, 13, 0, 0, 0, 0, |
| 172461 | 173070 | 141, 0, 0, 119, 52, 0, 0, 137, 12, 0, 0, 62, 0, |
| 172462 | 173071 | 138, 0, 133, 0, 0, 36, 0, 0, 28, 77, 0, 0, 0, |
| 172463 | 173072 | 0, 59, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| | @@ -172468,11 +173077,11 @@ |
| 172468 | 173077 | 112, 21, 7, 67, 0, 79, 96, 118, 0, 0, 68, 0, 0, |
| 172469 | 173078 | 99, 44, 0, 55, 0, 76, 0, 95, 32, 33, 57, 25, 0, |
| 172470 | 173079 | 102, 0, 0, 87, |
| 172471 | 173080 | }; |
| 172472 | 173081 | /* aKWLen[i] is the length (in bytes) of the i-th keyword */ |
| 172473 | | -static const unsigned char aKWLen[147] = { |
| 173082 | +static const unsigned char aKWLen[148] = {0, |
| 172474 | 173083 | 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6, |
| 172475 | 173084 | 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 7, |
| 172476 | 173085 | 6, 9, 4, 2, 6, 5, 9, 9, 4, 7, 3, 2, 4, |
| 172477 | 173086 | 4, 6, 11, 6, 2, 7, 5, 5, 9, 6, 10, 4, 6, |
| 172478 | 173087 | 2, 3, 7, 5, 9, 6, 6, 4, 5, 5, 10, 6, 5, |
| | @@ -172484,11 +173093,11 @@ |
| 172484 | 173093 | 4, 9, 5, 8, 4, 3, 9, 5, 5, 6, 4, 6, 2, |
| 172485 | 173094 | 2, 9, 3, 7, |
| 172486 | 173095 | }; |
| 172487 | 173096 | /* aKWOffset[i] is the index into zKWText[] of the start of |
| 172488 | 173097 | ** the text for the i-th keyword. */ |
| 172489 | | -static const unsigned short int aKWOffset[147] = { |
| 173098 | +static const unsigned short int aKWOffset[148] = {0, |
| 172490 | 173099 | 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33, |
| 172491 | 173100 | 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81, |
| 172492 | 173101 | 86, 90, 90, 94, 99, 101, 105, 111, 119, 123, 123, 123, 126, |
| 172493 | 173102 | 129, 132, 137, 142, 146, 147, 152, 156, 160, 168, 174, 181, 184, |
| 172494 | 173103 | 184, 187, 189, 195, 198, 206, 211, 216, 219, 222, 226, 236, 239, |
| | @@ -172499,11 +173108,11 @@ |
| 172499 | 173108 | 520, 523, 527, 532, 539, 544, 553, 557, 560, 565, 567, 571, 579, |
| 172500 | 173109 | 585, 588, 597, 602, 610, 610, 614, 623, 628, 633, 639, 642, 645, |
| 172501 | 173110 | 648, 650, 655, 659, |
| 172502 | 173111 | }; |
| 172503 | 173112 | /* aKWCode[i] is the parser symbol code for the i-th keyword */ |
| 172504 | | -static const unsigned char aKWCode[147] = { |
| 173113 | +static const unsigned char aKWCode[148] = {0, |
| 172505 | 173114 | TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE, |
| 172506 | 173115 | TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN, |
| 172507 | 173116 | TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD, |
| 172508 | 173117 | TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE, |
| 172509 | 173118 | TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE, |
| | @@ -172668,11 +173277,11 @@ |
| 172668 | 173277 | static int keywordCode(const char *z, int n, int *pType){ |
| 172669 | 173278 | int i, j; |
| 172670 | 173279 | const char *zKW; |
| 172671 | 173280 | if( n>=2 ){ |
| 172672 | 173281 | i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n*1) % 127; |
| 172673 | | - for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){ |
| 173282 | + for(i=(int)aKWHash[i]; i>0; i=aKWNext[i]){ |
| 172674 | 173283 | if( aKWLen[i]!=n ) continue; |
| 172675 | 173284 | zKW = &zKWText[aKWOffset[i]]; |
| 172676 | 173285 | #ifdef SQLITE_ASCII |
| 172677 | 173286 | if( (z[0]&~0x20)!=zKW[0] ) continue; |
| 172678 | 173287 | if( (z[1]&~0x20)!=zKW[1] ) continue; |
| | @@ -172684,157 +173293,157 @@ |
| 172684 | 173293 | if( toupper(z[1])!=zKW[1] ) continue; |
| 172685 | 173294 | j = 2; |
| 172686 | 173295 | while( j<n && toupper(z[j])==zKW[j] ){ j++; } |
| 172687 | 173296 | #endif |
| 172688 | 173297 | if( j<n ) continue; |
| 172689 | | - testcase( i==0 ); /* REINDEX */ |
| 172690 | | - testcase( i==1 ); /* INDEXED */ |
| 172691 | | - testcase( i==2 ); /* INDEX */ |
| 172692 | | - testcase( i==3 ); /* DESC */ |
| 172693 | | - testcase( i==4 ); /* ESCAPE */ |
| 172694 | | - testcase( i==5 ); /* EACH */ |
| 172695 | | - testcase( i==6 ); /* CHECK */ |
| 172696 | | - testcase( i==7 ); /* KEY */ |
| 172697 | | - testcase( i==8 ); /* BEFORE */ |
| 172698 | | - testcase( i==9 ); /* FOREIGN */ |
| 172699 | | - testcase( i==10 ); /* FOR */ |
| 172700 | | - testcase( i==11 ); /* IGNORE */ |
| 172701 | | - testcase( i==12 ); /* REGEXP */ |
| 172702 | | - testcase( i==13 ); /* EXPLAIN */ |
| 172703 | | - testcase( i==14 ); /* INSTEAD */ |
| 172704 | | - testcase( i==15 ); /* ADD */ |
| 172705 | | - testcase( i==16 ); /* DATABASE */ |
| 172706 | | - testcase( i==17 ); /* AS */ |
| 172707 | | - testcase( i==18 ); /* SELECT */ |
| 172708 | | - testcase( i==19 ); /* TABLE */ |
| 172709 | | - testcase( i==20 ); /* LEFT */ |
| 172710 | | - testcase( i==21 ); /* THEN */ |
| 172711 | | - testcase( i==22 ); /* END */ |
| 172712 | | - testcase( i==23 ); /* DEFERRABLE */ |
| 172713 | | - testcase( i==24 ); /* ELSE */ |
| 172714 | | - testcase( i==25 ); /* EXCLUDE */ |
| 172715 | | - testcase( i==26 ); /* DELETE */ |
| 172716 | | - testcase( i==27 ); /* TEMPORARY */ |
| 172717 | | - testcase( i==28 ); /* TEMP */ |
| 172718 | | - testcase( i==29 ); /* OR */ |
| 172719 | | - testcase( i==30 ); /* ISNULL */ |
| 172720 | | - testcase( i==31 ); /* NULLS */ |
| 172721 | | - testcase( i==32 ); /* SAVEPOINT */ |
| 172722 | | - testcase( i==33 ); /* INTERSECT */ |
| 172723 | | - testcase( i==34 ); /* TIES */ |
| 172724 | | - testcase( i==35 ); /* NOTNULL */ |
| 172725 | | - testcase( i==36 ); /* NOT */ |
| 172726 | | - testcase( i==37 ); /* NO */ |
| 172727 | | - testcase( i==38 ); /* NULL */ |
| 172728 | | - testcase( i==39 ); /* LIKE */ |
| 172729 | | - testcase( i==40 ); /* EXCEPT */ |
| 172730 | | - testcase( i==41 ); /* TRANSACTION */ |
| 172731 | | - testcase( i==42 ); /* ACTION */ |
| 172732 | | - testcase( i==43 ); /* ON */ |
| 172733 | | - testcase( i==44 ); /* NATURAL */ |
| 172734 | | - testcase( i==45 ); /* ALTER */ |
| 172735 | | - testcase( i==46 ); /* RAISE */ |
| 172736 | | - testcase( i==47 ); /* EXCLUSIVE */ |
| 172737 | | - testcase( i==48 ); /* EXISTS */ |
| 172738 | | - testcase( i==49 ); /* CONSTRAINT */ |
| 172739 | | - testcase( i==50 ); /* INTO */ |
| 172740 | | - testcase( i==51 ); /* OFFSET */ |
| 172741 | | - testcase( i==52 ); /* OF */ |
| 172742 | | - testcase( i==53 ); /* SET */ |
| 172743 | | - testcase( i==54 ); /* TRIGGER */ |
| 172744 | | - testcase( i==55 ); /* RANGE */ |
| 172745 | | - testcase( i==56 ); /* GENERATED */ |
| 172746 | | - testcase( i==57 ); /* DETACH */ |
| 172747 | | - testcase( i==58 ); /* HAVING */ |
| 172748 | | - testcase( i==59 ); /* GLOB */ |
| 172749 | | - testcase( i==60 ); /* BEGIN */ |
| 172750 | | - testcase( i==61 ); /* INNER */ |
| 172751 | | - testcase( i==62 ); /* REFERENCES */ |
| 172752 | | - testcase( i==63 ); /* UNIQUE */ |
| 172753 | | - testcase( i==64 ); /* QUERY */ |
| 172754 | | - testcase( i==65 ); /* WITHOUT */ |
| 172755 | | - testcase( i==66 ); /* WITH */ |
| 172756 | | - testcase( i==67 ); /* OUTER */ |
| 172757 | | - testcase( i==68 ); /* RELEASE */ |
| 172758 | | - testcase( i==69 ); /* ATTACH */ |
| 172759 | | - testcase( i==70 ); /* BETWEEN */ |
| 172760 | | - testcase( i==71 ); /* NOTHING */ |
| 172761 | | - testcase( i==72 ); /* GROUPS */ |
| 172762 | | - testcase( i==73 ); /* GROUP */ |
| 172763 | | - testcase( i==74 ); /* CASCADE */ |
| 172764 | | - testcase( i==75 ); /* ASC */ |
| 172765 | | - testcase( i==76 ); /* DEFAULT */ |
| 172766 | | - testcase( i==77 ); /* CASE */ |
| 172767 | | - testcase( i==78 ); /* COLLATE */ |
| 172768 | | - testcase( i==79 ); /* CREATE */ |
| 172769 | | - testcase( i==80 ); /* CURRENT_DATE */ |
| 172770 | | - testcase( i==81 ); /* IMMEDIATE */ |
| 172771 | | - testcase( i==82 ); /* JOIN */ |
| 172772 | | - testcase( i==83 ); /* INSERT */ |
| 172773 | | - testcase( i==84 ); /* MATCH */ |
| 172774 | | - testcase( i==85 ); /* PLAN */ |
| 172775 | | - testcase( i==86 ); /* ANALYZE */ |
| 172776 | | - testcase( i==87 ); /* PRAGMA */ |
| 172777 | | - testcase( i==88 ); /* MATERIALIZED */ |
| 172778 | | - testcase( i==89 ); /* DEFERRED */ |
| 172779 | | - testcase( i==90 ); /* DISTINCT */ |
| 172780 | | - testcase( i==91 ); /* IS */ |
| 172781 | | - testcase( i==92 ); /* UPDATE */ |
| 172782 | | - testcase( i==93 ); /* VALUES */ |
| 172783 | | - testcase( i==94 ); /* VIRTUAL */ |
| 172784 | | - testcase( i==95 ); /* ALWAYS */ |
| 172785 | | - testcase( i==96 ); /* WHEN */ |
| 172786 | | - testcase( i==97 ); /* WHERE */ |
| 172787 | | - testcase( i==98 ); /* RECURSIVE */ |
| 172788 | | - testcase( i==99 ); /* ABORT */ |
| 172789 | | - testcase( i==100 ); /* AFTER */ |
| 172790 | | - testcase( i==101 ); /* RENAME */ |
| 172791 | | - testcase( i==102 ); /* AND */ |
| 172792 | | - testcase( i==103 ); /* DROP */ |
| 172793 | | - testcase( i==104 ); /* PARTITION */ |
| 172794 | | - testcase( i==105 ); /* AUTOINCREMENT */ |
| 172795 | | - testcase( i==106 ); /* TO */ |
| 172796 | | - testcase( i==107 ); /* IN */ |
| 172797 | | - testcase( i==108 ); /* CAST */ |
| 172798 | | - testcase( i==109 ); /* COLUMN */ |
| 172799 | | - testcase( i==110 ); /* COMMIT */ |
| 172800 | | - testcase( i==111 ); /* CONFLICT */ |
| 172801 | | - testcase( i==112 ); /* CROSS */ |
| 172802 | | - testcase( i==113 ); /* CURRENT_TIMESTAMP */ |
| 172803 | | - testcase( i==114 ); /* CURRENT_TIME */ |
| 172804 | | - testcase( i==115 ); /* CURRENT */ |
| 172805 | | - testcase( i==116 ); /* PRECEDING */ |
| 172806 | | - testcase( i==117 ); /* FAIL */ |
| 172807 | | - testcase( i==118 ); /* LAST */ |
| 172808 | | - testcase( i==119 ); /* FILTER */ |
| 172809 | | - testcase( i==120 ); /* REPLACE */ |
| 172810 | | - testcase( i==121 ); /* FIRST */ |
| 172811 | | - testcase( i==122 ); /* FOLLOWING */ |
| 172812 | | - testcase( i==123 ); /* FROM */ |
| 172813 | | - testcase( i==124 ); /* FULL */ |
| 172814 | | - testcase( i==125 ); /* LIMIT */ |
| 172815 | | - testcase( i==126 ); /* IF */ |
| 172816 | | - testcase( i==127 ); /* ORDER */ |
| 172817 | | - testcase( i==128 ); /* RESTRICT */ |
| 172818 | | - testcase( i==129 ); /* OTHERS */ |
| 172819 | | - testcase( i==130 ); /* OVER */ |
| 172820 | | - testcase( i==131 ); /* RETURNING */ |
| 172821 | | - testcase( i==132 ); /* RIGHT */ |
| 172822 | | - testcase( i==133 ); /* ROLLBACK */ |
| 172823 | | - testcase( i==134 ); /* ROWS */ |
| 172824 | | - testcase( i==135 ); /* ROW */ |
| 172825 | | - testcase( i==136 ); /* UNBOUNDED */ |
| 172826 | | - testcase( i==137 ); /* UNION */ |
| 172827 | | - testcase( i==138 ); /* USING */ |
| 172828 | | - testcase( i==139 ); /* VACUUM */ |
| 172829 | | - testcase( i==140 ); /* VIEW */ |
| 172830 | | - testcase( i==141 ); /* WINDOW */ |
| 172831 | | - testcase( i==142 ); /* DO */ |
| 172832 | | - testcase( i==143 ); /* BY */ |
| 172833 | | - testcase( i==144 ); /* INITIALLY */ |
| 172834 | | - testcase( i==145 ); /* ALL */ |
| 172835 | | - testcase( i==146 ); /* PRIMARY */ |
| 173298 | + testcase( i==1 ); /* REINDEX */ |
| 173299 | + testcase( i==2 ); /* INDEXED */ |
| 173300 | + testcase( i==3 ); /* INDEX */ |
| 173301 | + testcase( i==4 ); /* DESC */ |
| 173302 | + testcase( i==5 ); /* ESCAPE */ |
| 173303 | + testcase( i==6 ); /* EACH */ |
| 173304 | + testcase( i==7 ); /* CHECK */ |
| 173305 | + testcase( i==8 ); /* KEY */ |
| 173306 | + testcase( i==9 ); /* BEFORE */ |
| 173307 | + testcase( i==10 ); /* FOREIGN */ |
| 173308 | + testcase( i==11 ); /* FOR */ |
| 173309 | + testcase( i==12 ); /* IGNORE */ |
| 173310 | + testcase( i==13 ); /* REGEXP */ |
| 173311 | + testcase( i==14 ); /* EXPLAIN */ |
| 173312 | + testcase( i==15 ); /* INSTEAD */ |
| 173313 | + testcase( i==16 ); /* ADD */ |
| 173314 | + testcase( i==17 ); /* DATABASE */ |
| 173315 | + testcase( i==18 ); /* AS */ |
| 173316 | + testcase( i==19 ); /* SELECT */ |
| 173317 | + testcase( i==20 ); /* TABLE */ |
| 173318 | + testcase( i==21 ); /* LEFT */ |
| 173319 | + testcase( i==22 ); /* THEN */ |
| 173320 | + testcase( i==23 ); /* END */ |
| 173321 | + testcase( i==24 ); /* DEFERRABLE */ |
| 173322 | + testcase( i==25 ); /* ELSE */ |
| 173323 | + testcase( i==26 ); /* EXCLUDE */ |
| 173324 | + testcase( i==27 ); /* DELETE */ |
| 173325 | + testcase( i==28 ); /* TEMPORARY */ |
| 173326 | + testcase( i==29 ); /* TEMP */ |
| 173327 | + testcase( i==30 ); /* OR */ |
| 173328 | + testcase( i==31 ); /* ISNULL */ |
| 173329 | + testcase( i==32 ); /* NULLS */ |
| 173330 | + testcase( i==33 ); /* SAVEPOINT */ |
| 173331 | + testcase( i==34 ); /* INTERSECT */ |
| 173332 | + testcase( i==35 ); /* TIES */ |
| 173333 | + testcase( i==36 ); /* NOTNULL */ |
| 173334 | + testcase( i==37 ); /* NOT */ |
| 173335 | + testcase( i==38 ); /* NO */ |
| 173336 | + testcase( i==39 ); /* NULL */ |
| 173337 | + testcase( i==40 ); /* LIKE */ |
| 173338 | + testcase( i==41 ); /* EXCEPT */ |
| 173339 | + testcase( i==42 ); /* TRANSACTION */ |
| 173340 | + testcase( i==43 ); /* ACTION */ |
| 173341 | + testcase( i==44 ); /* ON */ |
| 173342 | + testcase( i==45 ); /* NATURAL */ |
| 173343 | + testcase( i==46 ); /* ALTER */ |
| 173344 | + testcase( i==47 ); /* RAISE */ |
| 173345 | + testcase( i==48 ); /* EXCLUSIVE */ |
| 173346 | + testcase( i==49 ); /* EXISTS */ |
| 173347 | + testcase( i==50 ); /* CONSTRAINT */ |
| 173348 | + testcase( i==51 ); /* INTO */ |
| 173349 | + testcase( i==52 ); /* OFFSET */ |
| 173350 | + testcase( i==53 ); /* OF */ |
| 173351 | + testcase( i==54 ); /* SET */ |
| 173352 | + testcase( i==55 ); /* TRIGGER */ |
| 173353 | + testcase( i==56 ); /* RANGE */ |
| 173354 | + testcase( i==57 ); /* GENERATED */ |
| 173355 | + testcase( i==58 ); /* DETACH */ |
| 173356 | + testcase( i==59 ); /* HAVING */ |
| 173357 | + testcase( i==60 ); /* GLOB */ |
| 173358 | + testcase( i==61 ); /* BEGIN */ |
| 173359 | + testcase( i==62 ); /* INNER */ |
| 173360 | + testcase( i==63 ); /* REFERENCES */ |
| 173361 | + testcase( i==64 ); /* UNIQUE */ |
| 173362 | + testcase( i==65 ); /* QUERY */ |
| 173363 | + testcase( i==66 ); /* WITHOUT */ |
| 173364 | + testcase( i==67 ); /* WITH */ |
| 173365 | + testcase( i==68 ); /* OUTER */ |
| 173366 | + testcase( i==69 ); /* RELEASE */ |
| 173367 | + testcase( i==70 ); /* ATTACH */ |
| 173368 | + testcase( i==71 ); /* BETWEEN */ |
| 173369 | + testcase( i==72 ); /* NOTHING */ |
| 173370 | + testcase( i==73 ); /* GROUPS */ |
| 173371 | + testcase( i==74 ); /* GROUP */ |
| 173372 | + testcase( i==75 ); /* CASCADE */ |
| 173373 | + testcase( i==76 ); /* ASC */ |
| 173374 | + testcase( i==77 ); /* DEFAULT */ |
| 173375 | + testcase( i==78 ); /* CASE */ |
| 173376 | + testcase( i==79 ); /* COLLATE */ |
| 173377 | + testcase( i==80 ); /* CREATE */ |
| 173378 | + testcase( i==81 ); /* CURRENT_DATE */ |
| 173379 | + testcase( i==82 ); /* IMMEDIATE */ |
| 173380 | + testcase( i==83 ); /* JOIN */ |
| 173381 | + testcase( i==84 ); /* INSERT */ |
| 173382 | + testcase( i==85 ); /* MATCH */ |
| 173383 | + testcase( i==86 ); /* PLAN */ |
| 173384 | + testcase( i==87 ); /* ANALYZE */ |
| 173385 | + testcase( i==88 ); /* PRAGMA */ |
| 173386 | + testcase( i==89 ); /* MATERIALIZED */ |
| 173387 | + testcase( i==90 ); /* DEFERRED */ |
| 173388 | + testcase( i==91 ); /* DISTINCT */ |
| 173389 | + testcase( i==92 ); /* IS */ |
| 173390 | + testcase( i==93 ); /* UPDATE */ |
| 173391 | + testcase( i==94 ); /* VALUES */ |
| 173392 | + testcase( i==95 ); /* VIRTUAL */ |
| 173393 | + testcase( i==96 ); /* ALWAYS */ |
| 173394 | + testcase( i==97 ); /* WHEN */ |
| 173395 | + testcase( i==98 ); /* WHERE */ |
| 173396 | + testcase( i==99 ); /* RECURSIVE */ |
| 173397 | + testcase( i==100 ); /* ABORT */ |
| 173398 | + testcase( i==101 ); /* AFTER */ |
| 173399 | + testcase( i==102 ); /* RENAME */ |
| 173400 | + testcase( i==103 ); /* AND */ |
| 173401 | + testcase( i==104 ); /* DROP */ |
| 173402 | + testcase( i==105 ); /* PARTITION */ |
| 173403 | + testcase( i==106 ); /* AUTOINCREMENT */ |
| 173404 | + testcase( i==107 ); /* TO */ |
| 173405 | + testcase( i==108 ); /* IN */ |
| 173406 | + testcase( i==109 ); /* CAST */ |
| 173407 | + testcase( i==110 ); /* COLUMN */ |
| 173408 | + testcase( i==111 ); /* COMMIT */ |
| 173409 | + testcase( i==112 ); /* CONFLICT */ |
| 173410 | + testcase( i==113 ); /* CROSS */ |
| 173411 | + testcase( i==114 ); /* CURRENT_TIMESTAMP */ |
| 173412 | + testcase( i==115 ); /* CURRENT_TIME */ |
| 173413 | + testcase( i==116 ); /* CURRENT */ |
| 173414 | + testcase( i==117 ); /* PRECEDING */ |
| 173415 | + testcase( i==118 ); /* FAIL */ |
| 173416 | + testcase( i==119 ); /* LAST */ |
| 173417 | + testcase( i==120 ); /* FILTER */ |
| 173418 | + testcase( i==121 ); /* REPLACE */ |
| 173419 | + testcase( i==122 ); /* FIRST */ |
| 173420 | + testcase( i==123 ); /* FOLLOWING */ |
| 173421 | + testcase( i==124 ); /* FROM */ |
| 173422 | + testcase( i==125 ); /* FULL */ |
| 173423 | + testcase( i==126 ); /* LIMIT */ |
| 173424 | + testcase( i==127 ); /* IF */ |
| 173425 | + testcase( i==128 ); /* ORDER */ |
| 173426 | + testcase( i==129 ); /* RESTRICT */ |
| 173427 | + testcase( i==130 ); /* OTHERS */ |
| 173428 | + testcase( i==131 ); /* OVER */ |
| 173429 | + testcase( i==132 ); /* RETURNING */ |
| 173430 | + testcase( i==133 ); /* RIGHT */ |
| 173431 | + testcase( i==134 ); /* ROLLBACK */ |
| 173432 | + testcase( i==135 ); /* ROWS */ |
| 173433 | + testcase( i==136 ); /* ROW */ |
| 173434 | + testcase( i==137 ); /* UNBOUNDED */ |
| 173435 | + testcase( i==138 ); /* UNION */ |
| 173436 | + testcase( i==139 ); /* USING */ |
| 173437 | + testcase( i==140 ); /* VACUUM */ |
| 173438 | + testcase( i==141 ); /* VIEW */ |
| 173439 | + testcase( i==142 ); /* WINDOW */ |
| 173440 | + testcase( i==143 ); /* DO */ |
| 173441 | + testcase( i==144 ); /* BY */ |
| 173442 | + testcase( i==145 ); /* INITIALLY */ |
| 173443 | + testcase( i==146 ); /* ALL */ |
| 173444 | + testcase( i==147 ); /* PRIMARY */ |
| 172836 | 173445 | *pType = aKWCode[i]; |
| 172837 | 173446 | break; |
| 172838 | 173447 | } |
| 172839 | 173448 | } |
| 172840 | 173449 | return n; |
| | @@ -172845,10 +173454,11 @@ |
| 172845 | 173454 | return id; |
| 172846 | 173455 | } |
| 172847 | 173456 | #define SQLITE_N_KEYWORD 147 |
| 172848 | 173457 | SQLITE_API int sqlite3_keyword_name(int i,const char **pzName,int *pnName){ |
| 172849 | 173458 | if( i<0 || i>=SQLITE_N_KEYWORD ) return SQLITE_ERROR; |
| 173459 | + i++; |
| 172850 | 173460 | *pzName = zKWText + aKWOffset[i]; |
| 172851 | 173461 | *pnName = aKWLen[i]; |
| 172852 | 173462 | return SQLITE_OK; |
| 172853 | 173463 | } |
| 172854 | 173464 | SQLITE_API int sqlite3_keyword_count(void){ return SQLITE_N_KEYWORD; } |
| | @@ -174383,13 +174993,25 @@ |
| 174383 | 174993 | */ |
| 174384 | 174994 | SQLITE_API int sqlite3_config(int op, ...){ |
| 174385 | 174995 | va_list ap; |
| 174386 | 174996 | int rc = SQLITE_OK; |
| 174387 | 174997 | |
| 174388 | | - /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while |
| 174389 | | - ** the SQLite library is in use. */ |
| 174390 | | - if( sqlite3GlobalConfig.isInit ) return SQLITE_MISUSE_BKPT; |
| 174998 | + /* sqlite3_config() normally returns SQLITE_MISUSE if it is invoked while |
| 174999 | + ** the SQLite library is in use. Except, a few selected opcodes |
| 175000 | + ** are allowed. |
| 175001 | + */ |
| 175002 | + if( sqlite3GlobalConfig.isInit ){ |
| 175003 | + static const u64 mAnytimeConfigOption = 0 |
| 175004 | + | MASKBIT64( SQLITE_CONFIG_LOG ) |
| 175005 | + | MASKBIT64( SQLITE_CONFIG_PCACHE_HDRSZ ) |
| 175006 | + ; |
| 175007 | + if( op<0 || op>63 || (MASKBIT64(op) & mAnytimeConfigOption)==0 ){ |
| 175008 | + return SQLITE_MISUSE_BKPT; |
| 175009 | + } |
| 175010 | + testcase( op==SQLITE_CONFIG_LOG ); |
| 175011 | + testcase( op==SQLITE_CONFIG_PCACHE_HDRSZ ); |
| 175012 | + } |
| 174391 | 175013 | |
| 174392 | 175014 | va_start(ap, op); |
| 174393 | 175015 | switch( op ){ |
| 174394 | 175016 | |
| 174395 | 175017 | /* Mutex configuration options are only available in a threadsafe |
| | @@ -174454,10 +175076,11 @@ |
| 174454 | 175076 | if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault(); |
| 174455 | 175077 | *va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m; |
| 174456 | 175078 | break; |
| 174457 | 175079 | } |
| 174458 | 175080 | case SQLITE_CONFIG_MEMSTATUS: { |
| 175081 | + assert( !sqlite3GlobalConfig.isInit ); /* Cannot change at runtime */ |
| 174459 | 175082 | /* EVIDENCE-OF: R-61275-35157 The SQLITE_CONFIG_MEMSTATUS option takes |
| 174460 | 175083 | ** single argument of type int, interpreted as a boolean, which enables |
| 174461 | 175084 | ** or disables the collection of memory allocation statistics. */ |
| 174462 | 175085 | sqlite3GlobalConfig.bMemstat = va_arg(ap, int); |
| 174463 | 175086 | break; |
| | @@ -174577,12 +175200,14 @@ |
| 174577 | 175200 | /* MSVC is picky about pulling func ptrs from va lists. |
| 174578 | 175201 | ** http://support.microsoft.com/kb/47961 |
| 174579 | 175202 | ** sqlite3GlobalConfig.xLog = va_arg(ap, void(*)(void*,int,const char*)); |
| 174580 | 175203 | */ |
| 174581 | 175204 | typedef void(*LOGFUNC_t)(void*,int,const char*); |
| 174582 | | - sqlite3GlobalConfig.xLog = va_arg(ap, LOGFUNC_t); |
| 174583 | | - sqlite3GlobalConfig.pLogArg = va_arg(ap, void*); |
| 175205 | + LOGFUNC_t xLog = va_arg(ap, LOGFUNC_t); |
| 175206 | + void *pLogArg = va_arg(ap, void*); |
| 175207 | + AtomicStore(&sqlite3GlobalConfig.xLog, xLog); |
| 175208 | + AtomicStore(&sqlite3GlobalConfig.pLogArg, pLogArg); |
| 174584 | 175209 | break; |
| 174585 | 175210 | } |
| 174586 | 175211 | |
| 174587 | 175212 | /* EVIDENCE-OF: R-55548-33817 The compile-time setting for URI filenames |
| 174588 | 175213 | ** can be changed at start-time using the |
| | @@ -174592,11 +175217,12 @@ |
| 174592 | 175217 | case SQLITE_CONFIG_URI: { |
| 174593 | 175218 | /* EVIDENCE-OF: R-25451-61125 The SQLITE_CONFIG_URI option takes a single |
| 174594 | 175219 | ** argument of type int. If non-zero, then URI handling is globally |
| 174595 | 175220 | ** enabled. If the parameter is zero, then URI handling is globally |
| 174596 | 175221 | ** disabled. */ |
| 174597 | | - sqlite3GlobalConfig.bOpenUri = va_arg(ap, int); |
| 175222 | + int bOpenUri = va_arg(ap, int); |
| 175223 | + AtomicStore(&sqlite3GlobalConfig.bOpenUri, bOpenUri); |
| 174598 | 175224 | break; |
| 174599 | 175225 | } |
| 174600 | 175226 | |
| 174601 | 175227 | case SQLITE_CONFIG_COVERING_INDEX_SCAN: { |
| 174602 | 175228 | /* EVIDENCE-OF: R-36592-02772 The SQLITE_CONFIG_COVERING_INDEX_SCAN |
| | @@ -174907,10 +175533,12 @@ |
| 174907 | 175533 | { SQLITE_DBCONFIG_LEGACY_ALTER_TABLE, SQLITE_LegacyAlter }, |
| 174908 | 175534 | { SQLITE_DBCONFIG_DQS_DDL, SQLITE_DqsDDL }, |
| 174909 | 175535 | { SQLITE_DBCONFIG_DQS_DML, SQLITE_DqsDML }, |
| 174910 | 175536 | { SQLITE_DBCONFIG_LEGACY_FILE_FORMAT, SQLITE_LegacyFileFmt }, |
| 174911 | 175537 | { SQLITE_DBCONFIG_TRUSTED_SCHEMA, SQLITE_TrustedSchema }, |
| 175538 | + { SQLITE_DBCONFIG_STMT_SCANSTATUS, SQLITE_StmtScanStatus }, |
| 175539 | + { SQLITE_DBCONFIG_REVERSE_SCANORDER, SQLITE_ReverseOrder }, |
| 174912 | 175540 | }; |
| 174913 | 175541 | unsigned int i; |
| 174914 | 175542 | rc = SQLITE_ERROR; /* IMP: R-42790-23372 */ |
| 174915 | 175543 | for(i=0; i<ArraySize(aFlagOp); i++){ |
| 174916 | 175544 | if( aFlagOp[i].op==op ){ |
| | @@ -176892,13 +177520,13 @@ |
| 176892 | 177520 | char c; |
| 176893 | 177521 | int nUri = sqlite3Strlen30(zUri); |
| 176894 | 177522 | |
| 176895 | 177523 | assert( *pzErrMsg==0 ); |
| 176896 | 177524 | |
| 176897 | | - if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */ |
| 176898 | | - || sqlite3GlobalConfig.bOpenUri) /* IMP: R-51689-46548 */ |
| 176899 | | - && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */ |
| 177525 | + if( ((flags & SQLITE_OPEN_URI) /* IMP: R-48725-32206 */ |
| 177526 | + || AtomicLoad(&sqlite3GlobalConfig.bOpenUri)) /* IMP: R-51689-46548 */ |
| 177527 | + && nUri>=5 && memcmp(zUri, "file:", 5)==0 /* IMP: R-57884-37496 */ |
| 176900 | 177528 | ){ |
| 176901 | 177529 | char *zOpt; |
| 176902 | 177530 | int eState; /* Parser state when parsing URI */ |
| 176903 | 177531 | int iIn; /* Input character index */ |
| 176904 | 177532 | int iOut = 0; /* Output character index */ |
| | @@ -177300,10 +177928,13 @@ |
| 177300 | 177928 | #if defined(SQLITE_DEFAULT_DEFENSIVE) |
| 177301 | 177929 | | SQLITE_Defensive |
| 177302 | 177930 | #endif |
| 177303 | 177931 | #if defined(SQLITE_DEFAULT_LEGACY_ALTER_TABLE) |
| 177304 | 177932 | | SQLITE_LegacyAlter |
| 177933 | +#endif |
| 177934 | +#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) |
| 177935 | + | SQLITE_StmtScanStatus |
| 177305 | 177936 | #endif |
| 177306 | 177937 | ; |
| 177307 | 177938 | sqlite3HashInit(&db->aCollSeq); |
| 177308 | 177939 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 177309 | 177940 | sqlite3HashInit(&db->aModule); |
| | @@ -193069,20 +193700,22 @@ |
| 193069 | 193700 | static int fts3MsrBufferData( |
| 193070 | 193701 | Fts3MultiSegReader *pMsr, /* Multi-segment-reader handle */ |
| 193071 | 193702 | char *pList, |
| 193072 | 193703 | i64 nList |
| 193073 | 193704 | ){ |
| 193074 | | - if( nList>pMsr->nBuffer ){ |
| 193705 | + if( (nList+FTS3_NODE_PADDING)>pMsr->nBuffer ){ |
| 193075 | 193706 | char *pNew; |
| 193076 | | - pMsr->nBuffer = nList*2; |
| 193077 | | - pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, pMsr->nBuffer); |
| 193707 | + int nNew = nList*2 + FTS3_NODE_PADDING; |
| 193708 | + pNew = (char *)sqlite3_realloc64(pMsr->aBuffer, nNew); |
| 193078 | 193709 | if( !pNew ) return SQLITE_NOMEM; |
| 193079 | 193710 | pMsr->aBuffer = pNew; |
| 193711 | + pMsr->nBuffer = nNew; |
| 193080 | 193712 | } |
| 193081 | 193713 | |
| 193082 | 193714 | assert( nList>0 ); |
| 193083 | 193715 | memcpy(pMsr->aBuffer, pList, nList); |
| 193716 | + memset(&pMsr->aBuffer[nList], 0, FTS3_NODE_PADDING); |
| 193084 | 193717 | return SQLITE_OK; |
| 193085 | 193718 | } |
| 193086 | 193719 | |
| 193087 | 193720 | SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext( |
| 193088 | 193721 | Fts3Table *p, /* Virtual table handle */ |
| | @@ -199070,12 +199703,15 @@ |
| 199070 | 199703 | switch( sqlite3_value_type(pValue) ){ |
| 199071 | 199704 | case SQLITE_NULL: { |
| 199072 | 199705 | jsonAppendRaw(p, "null", 4); |
| 199073 | 199706 | break; |
| 199074 | 199707 | } |
| 199075 | | - case SQLITE_INTEGER: |
| 199076 | 199708 | case SQLITE_FLOAT: { |
| 199709 | + jsonPrintf(100, p, "%!0.15g", sqlite3_value_double(pValue)); |
| 199710 | + break; |
| 199711 | + } |
| 199712 | + case SQLITE_INTEGER: { |
| 199077 | 199713 | const char *z = (const char*)sqlite3_value_text(pValue); |
| 199078 | 199714 | u32 n = (u32)sqlite3_value_bytes(pValue); |
| 199079 | 199715 | jsonAppendRaw(p, z, n); |
| 199080 | 199716 | break; |
| 199081 | 199717 | } |
| | @@ -199517,10 +200153,31 @@ |
| 199517 | 200153 | int i; |
| 199518 | 200154 | for(i=0; i<4; i++) if( !sqlite3Isxdigit(z[i]) ) return 0; |
| 199519 | 200155 | return 1; |
| 199520 | 200156 | } |
| 199521 | 200157 | |
| 200158 | +#ifdef SQLITE_ENABLE_JSON_NAN_INF |
| 200159 | +/* |
| 200160 | +** Extra floating-point literals to allow in JSON. |
| 200161 | +*/ |
| 200162 | +static const struct NanInfName { |
| 200163 | + char c1; |
| 200164 | + char c2; |
| 200165 | + char n; |
| 200166 | + char eType; |
| 200167 | + char nRepl; |
| 200168 | + char *zMatch; |
| 200169 | + char *zRepl; |
| 200170 | +} aNanInfName[] = { |
| 200171 | + { 'i', 'I', 3, JSON_REAL, 7, "inf", "9.0e999" }, |
| 200172 | + { 'i', 'I', 8, JSON_REAL, 7, "infinity", "9.0e999" }, |
| 200173 | + { 'n', 'N', 3, JSON_NULL, 4, "NaN", "null" }, |
| 200174 | + { 'q', 'Q', 4, JSON_NULL, 4, "QNaN", "null" }, |
| 200175 | + { 's', 'S', 4, JSON_NULL, 4, "SNaN", "null" }, |
| 200176 | +}; |
| 200177 | +#endif /* SQLITE_ENABLE_JSON_NAN_INF */ |
| 200178 | + |
| 199522 | 200179 | /* |
| 199523 | 200180 | ** Parse a single JSON value which begins at pParse->zJson[i]. Return the |
| 199524 | 200181 | ** index of the first character past the end of the value parsed. |
| 199525 | 200182 | ** |
| 199526 | 200183 | ** Return negative for a syntax error. Special cases: return -2 if the |
| | @@ -199662,10 +200319,28 @@ |
| 199662 | 200319 | c = z[j+1]; |
| 199663 | 200320 | } |
| 199664 | 200321 | if( c<'0' || c>'9' ) return -1; |
| 199665 | 200322 | continue; |
| 199666 | 200323 | } |
| 200324 | +#ifdef SQLITE_ENABLE_JSON_NAN_INF |
| 200325 | + /* Non-standard JSON: Allow "-Inf" (in any case) |
| 200326 | + ** to be understood as floating point literals. */ |
| 200327 | + if( (c=='i' || c=='I') |
| 200328 | + && j==i+1 |
| 200329 | + && z[i]=='-' |
| 200330 | + && sqlite3StrNICmp(&z[j], "inf",3)==0 |
| 200331 | + ){ |
| 200332 | + if( !sqlite3Isalnum(z[j+3]) ){ |
| 200333 | + jsonParseAddNode(pParse, JSON_REAL, 8, "-9.0e999"); |
| 200334 | + return i+4; |
| 200335 | + }else if( (sqlite3StrNICmp(&z[j],"infinity",8)==0 && |
| 200336 | + !sqlite3Isalnum(z[j+8])) ){ |
| 200337 | + jsonParseAddNode(pParse, JSON_REAL, 8, "-9.0e999"); |
| 200338 | + return i+9; |
| 200339 | + } |
| 200340 | + } |
| 200341 | +#endif |
| 199667 | 200342 | break; |
| 199668 | 200343 | } |
| 199669 | 200344 | if( z[j-1]<'0' ) return -1; |
| 199670 | 200345 | jsonParseAddNode(pParse, seenDP ? JSON_REAL : JSON_INT, |
| 199671 | 200346 | j - i, &z[i]); |
| | @@ -199675,10 +200350,24 @@ |
| 199675 | 200350 | }else if( c==']' ){ |
| 199676 | 200351 | return -3; /* End of [...] */ |
| 199677 | 200352 | }else if( c==0 ){ |
| 199678 | 200353 | return 0; /* End of file */ |
| 199679 | 200354 | }else{ |
| 200355 | +#ifdef SQLITE_ENABLE_JSON_NAN_INF |
| 200356 | + int k, nn; |
| 200357 | + for(k=0; k<sizeof(aNanInfName)/sizeof(aNanInfName[0]); k++){ |
| 200358 | + if( c!=aNanInfName[k].c1 && c!=aNanInfName[k].c2 ) continue; |
| 200359 | + nn = aNanInfName[k].n; |
| 200360 | + if( sqlite3StrNICmp(&z[i], aNanInfName[k].zMatch, nn)!=0 ){ |
| 200361 | + continue; |
| 200362 | + } |
| 200363 | + if( sqlite3Isalnum(z[i+nn]) ) continue; |
| 200364 | + jsonParseAddNode(pParse, aNanInfName[k].eType, |
| 200365 | + aNanInfName[k].nRepl, aNanInfName[k].zRepl); |
| 200366 | + return i + nn; |
| 200367 | + } |
| 200368 | +#endif |
| 199680 | 200369 | return -1; /* Syntax error */ |
| 199681 | 200370 | } |
| 199682 | 200371 | } |
| 199683 | 200372 | |
| 199684 | 200373 | /* |
| | @@ -212497,19 +213186,28 @@ |
| 212497 | 213186 | |
| 212498 | 213187 | iOff = (i64)(pFrame->iDbPage-1) * p->pgsz; |
| 212499 | 213188 | p->rc = pDb->pMethods->xWrite(pDb, p->aBuf, p->pgsz, iOff); |
| 212500 | 213189 | } |
| 212501 | 213190 | |
| 213191 | +/* |
| 213192 | +** This value is copied from the definition of ZIPVFS_CTRL_FILE_POINTER |
| 213193 | +** in zipvfs.h. |
| 213194 | +*/ |
| 213195 | +#define RBU_ZIPVFS_CTRL_FILE_POINTER 230439 |
| 212502 | 213196 | |
| 212503 | 213197 | /* |
| 212504 | 213198 | ** Take an EXCLUSIVE lock on the database file. Return SQLITE_OK if |
| 212505 | 213199 | ** successful, or an SQLite error code otherwise. |
| 212506 | 213200 | */ |
| 212507 | 213201 | static int rbuLockDatabase(sqlite3 *db){ |
| 212508 | 213202 | int rc = SQLITE_OK; |
| 212509 | 213203 | sqlite3_file *fd = 0; |
| 212510 | | - sqlite3_file_control(db, "main", SQLITE_FCNTL_FILE_POINTER, &fd); |
| 213204 | + |
| 213205 | + sqlite3_file_control(db, "main", RBU_ZIPVFS_CTRL_FILE_POINTER, &fd); |
| 213206 | + if( fd==0 ){ |
| 213207 | + sqlite3_file_control(db, "main", SQLITE_FCNTL_FILE_POINTER, &fd); |
| 213208 | + } |
| 212511 | 213209 | |
| 212512 | 213210 | if( fd->pMethods ){ |
| 212513 | 213211 | rc = fd->pMethods->xLock(fd, SQLITE_LOCK_SHARED); |
| 212514 | 213212 | if( rc==SQLITE_OK ){ |
| 212515 | 213213 | rc = fd->pMethods->xLock(fd, SQLITE_LOCK_EXCLUSIVE); |
| | @@ -215744,10 +216442,11 @@ |
| 215744 | 216442 | (void)argc; |
| 215745 | 216443 | (void)argv; |
| 215746 | 216444 | (void)pzErr; |
| 215747 | 216445 | |
| 215748 | 216446 | sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY); |
| 216447 | + sqlite3_vtab_config(db, SQLITE_VTAB_USES_ALL_SCHEMAS); |
| 215749 | 216448 | rc = sqlite3_declare_vtab(db, |
| 215750 | 216449 | "CREATE TABLE x(pgno INTEGER PRIMARY KEY, data BLOB, schema HIDDEN)"); |
| 215751 | 216450 | if( rc==SQLITE_OK ){ |
| 215752 | 216451 | pTab = (DbpageTable *)sqlite3_malloc64(sizeof(DbpageTable)); |
| 215753 | 216452 | if( pTab==0 ) rc = SQLITE_NOMEM_BKPT; |
| | @@ -215827,11 +216526,10 @@ |
| 215827 | 216526 | && pIdxInfo->aOrderBy[0].iColumn<=0 |
| 215828 | 216527 | && pIdxInfo->aOrderBy[0].desc==0 |
| 215829 | 216528 | ){ |
| 215830 | 216529 | pIdxInfo->orderByConsumed = 1; |
| 215831 | 216530 | } |
| 215832 | | - sqlite3VtabUsesAllSchemas(pIdxInfo); |
| 215833 | 216531 | return SQLITE_OK; |
| 215834 | 216532 | } |
| 215835 | 216533 | |
| 215836 | 216534 | /* |
| 215837 | 216535 | ** Open a new dbpagevfs cursor. |
| | @@ -218216,13 +218914,14 @@ |
| 218216 | 218914 | SessionBuffer *p, |
| 218217 | 218915 | const char *zStr, |
| 218218 | 218916 | int *pRc |
| 218219 | 218917 | ){ |
| 218220 | 218918 | int nStr = sqlite3Strlen30(zStr); |
| 218221 | | - if( 0==sessionBufferGrow(p, nStr, pRc) ){ |
| 218919 | + if( 0==sessionBufferGrow(p, nStr+1, pRc) ){ |
| 218222 | 218920 | memcpy(&p->aBuf[p->nBuf], zStr, nStr); |
| 218223 | 218921 | p->nBuf += nStr; |
| 218922 | + p->aBuf[p->nBuf] = 0x00; |
| 218224 | 218923 | } |
| 218225 | 218924 | } |
| 218226 | 218925 | |
| 218227 | 218926 | /* |
| 218228 | 218927 | ** This function is a no-op if *pRc is other than SQLITE_OK when it is |
| | @@ -218239,10 +218938,31 @@ |
| 218239 | 218938 | ){ |
| 218240 | 218939 | char aBuf[24]; |
| 218241 | 218940 | sqlite3_snprintf(sizeof(aBuf)-1, aBuf, "%d", iVal); |
| 218242 | 218941 | sessionAppendStr(p, aBuf, pRc); |
| 218243 | 218942 | } |
| 218943 | + |
| 218944 | +static void sessionAppendPrintf( |
| 218945 | + SessionBuffer *p, /* Buffer to append to */ |
| 218946 | + int *pRc, |
| 218947 | + const char *zFmt, |
| 218948 | + ... |
| 218949 | +){ |
| 218950 | + if( *pRc==SQLITE_OK ){ |
| 218951 | + char *zApp = 0; |
| 218952 | + va_list ap; |
| 218953 | + va_start(ap, zFmt); |
| 218954 | + zApp = sqlite3_vmprintf(zFmt, ap); |
| 218955 | + if( zApp==0 ){ |
| 218956 | + *pRc = SQLITE_NOMEM; |
| 218957 | + }else{ |
| 218958 | + sessionAppendStr(p, zApp, pRc); |
| 218959 | + } |
| 218960 | + va_end(ap); |
| 218961 | + sqlite3_free(zApp); |
| 218962 | + } |
| 218963 | +} |
| 218244 | 218964 | |
| 218245 | 218965 | /* |
| 218246 | 218966 | ** This function is a no-op if *pRc is other than SQLITE_OK when it is |
| 218247 | 218967 | ** called. Otherwise, append the string zStr enclosed in quotes (") and |
| 218248 | 218968 | ** with any embedded quote characters escaped to the buffer. No |
| | @@ -218254,11 +218974,11 @@ |
| 218254 | 218974 | static void sessionAppendIdent( |
| 218255 | 218975 | SessionBuffer *p, /* Buffer to a append to */ |
| 218256 | 218976 | const char *zStr, /* String to quote, escape and append */ |
| 218257 | 218977 | int *pRc /* IN/OUT: Error code */ |
| 218258 | 218978 | ){ |
| 218259 | | - int nStr = sqlite3Strlen30(zStr)*2 + 2 + 1; |
| 218979 | + int nStr = sqlite3Strlen30(zStr)*2 + 2 + 2; |
| 218260 | 218980 | if( 0==sessionBufferGrow(p, nStr, pRc) ){ |
| 218261 | 218981 | char *zOut = (char *)&p->aBuf[p->nBuf]; |
| 218262 | 218982 | const char *zIn = zStr; |
| 218263 | 218983 | *zOut++ = '"'; |
| 218264 | 218984 | while( *zIn ){ |
| | @@ -218265,10 +218985,11 @@ |
| 218265 | 218985 | if( *zIn=='"' ) *zOut++ = '"'; |
| 218266 | 218986 | *zOut++ = *(zIn++); |
| 218267 | 218987 | } |
| 218268 | 218988 | *zOut++ = '"'; |
| 218269 | 218989 | p->nBuf = (int)((u8 *)zOut - p->aBuf); |
| 218990 | + p->aBuf[p->nBuf] = 0x00; |
| 218270 | 218991 | } |
| 218271 | 218992 | } |
| 218272 | 218993 | |
| 218273 | 218994 | /* |
| 218274 | 218995 | ** This function is a no-op if *pRc is other than SQLITE_OK when it is |
| | @@ -218489,33 +219210,82 @@ |
| 218489 | 219210 | |
| 218490 | 219211 | /* |
| 218491 | 219212 | ** Formulate and prepare a SELECT statement to retrieve a row from table |
| 218492 | 219213 | ** zTab in database zDb based on its primary key. i.e. |
| 218493 | 219214 | ** |
| 218494 | | -** SELECT * FROM zDb.zTab WHERE pk1 = ? AND pk2 = ? AND ... |
| 219215 | +** SELECT *, <noop-test> FROM zDb.zTab WHERE (pk1, pk2,...) IS (?1, ?2,...) |
| 219216 | +** |
| 219217 | +** where <noop-test> is: |
| 219218 | +** |
| 219219 | +** 1 AND (?A OR ?1 IS <column>) AND ... |
| 219220 | +** |
| 219221 | +** for each non-pk <column>. |
| 218495 | 219222 | */ |
| 218496 | 219223 | static int sessionSelectStmt( |
| 218497 | 219224 | sqlite3 *db, /* Database handle */ |
| 219225 | + int bIgnoreNoop, |
| 218498 | 219226 | const char *zDb, /* Database name */ |
| 218499 | 219227 | const char *zTab, /* Table name */ |
| 218500 | 219228 | int nCol, /* Number of columns in table */ |
| 218501 | 219229 | const char **azCol, /* Names of table columns */ |
| 218502 | 219230 | u8 *abPK, /* PRIMARY KEY array */ |
| 218503 | 219231 | sqlite3_stmt **ppStmt /* OUT: Prepared SELECT statement */ |
| 218504 | 219232 | ){ |
| 218505 | 219233 | int rc = SQLITE_OK; |
| 218506 | 219234 | char *zSql = 0; |
| 219235 | + const char *zSep = ""; |
| 219236 | + const char *zCols = "*"; |
| 218507 | 219237 | int nSql = -1; |
| 219238 | + int i; |
| 218508 | 219239 | |
| 219240 | + SessionBuffer nooptest = {0, 0, 0}; |
| 219241 | + SessionBuffer pkfield = {0, 0, 0}; |
| 219242 | + SessionBuffer pkvar = {0, 0, 0}; |
| 219243 | + |
| 219244 | + sessionAppendStr(&nooptest, ", 1", &rc); |
| 219245 | + |
| 219246 | + if( 0==sqlite3_stricmp("sqlite_stat1", zTab) ){ |
| 219247 | + sessionAppendStr(&nooptest, " AND (?6 OR ?3 IS stat)", &rc); |
| 219248 | + sessionAppendStr(&pkfield, "tbl, idx", &rc); |
| 219249 | + sessionAppendStr(&pkvar, |
| 219250 | + "?1, (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", &rc |
| 219251 | + ); |
| 219252 | + zCols = "tbl, ?2, stat"; |
| 219253 | + }else{ |
| 219254 | + for(i=0; i<nCol; i++){ |
| 219255 | + |
| 219256 | + if( abPK[i] ){ |
| 219257 | + sessionAppendStr(&pkfield, zSep, &rc); |
| 219258 | + sessionAppendStr(&pkvar, zSep, &rc); |
| 219259 | + zSep = ", "; |
| 219260 | + sessionAppendIdent(&pkfield, azCol[i], &rc); |
| 219261 | + sessionAppendPrintf(&pkvar, &rc, "?%d", i+1); |
| 219262 | + }else{ |
| 219263 | + sessionAppendPrintf(&nooptest, &rc, |
| 219264 | + " AND (?%d OR ?%d IS %w.%w)", i+1+nCol, i+1, zTab, azCol[i] |
| 219265 | + ); |
| 219266 | + } |
| 219267 | + } |
| 219268 | + } |
| 219269 | + |
| 219270 | + if( rc==SQLITE_OK ){ |
| 219271 | + zSql = sqlite3_mprintf( |
| 219272 | + "SELECT %s%s FROM %Q.%Q WHERE (%s) IS (%s)", |
| 219273 | + zCols, (bIgnoreNoop ? (char*)nooptest.aBuf : ""), |
| 219274 | + zDb, zTab, (char*)pkfield.aBuf, (char*)pkvar.aBuf |
| 219275 | + ); |
| 219276 | + if( zSql==0 ) rc = SQLITE_NOMEM; |
| 219277 | + } |
| 219278 | + |
| 219279 | +#if 0 |
| 218509 | 219280 | if( 0==sqlite3_stricmp("sqlite_stat1", zTab) ){ |
| 218510 | 219281 | zSql = sqlite3_mprintf( |
| 218511 | 219282 | "SELECT tbl, ?2, stat FROM %Q.sqlite_stat1 WHERE tbl IS ?1 AND " |
| 218512 | 219283 | "idx IS (CASE WHEN ?2=X'' THEN NULL ELSE ?2 END)", zDb |
| 218513 | 219284 | ); |
| 218514 | 219285 | if( zSql==0 ) rc = SQLITE_NOMEM; |
| 218515 | 219286 | }else{ |
| 218516 | | - int i; |
| 218517 | 219287 | const char *zSep = ""; |
| 218518 | 219288 | SessionBuffer buf = {0, 0, 0}; |
| 218519 | 219289 | |
| 218520 | 219290 | sessionAppendStr(&buf, "SELECT * FROM ", &rc); |
| 218521 | 219291 | sessionAppendIdent(&buf, zDb, &rc); |
| | @@ -218532,15 +219302,19 @@ |
| 218532 | 219302 | } |
| 218533 | 219303 | } |
| 218534 | 219304 | zSql = (char*)buf.aBuf; |
| 218535 | 219305 | nSql = buf.nBuf; |
| 218536 | 219306 | } |
| 219307 | +#endif |
| 218537 | 219308 | |
| 218538 | 219309 | if( rc==SQLITE_OK ){ |
| 218539 | 219310 | rc = sqlite3_prepare_v2(db, zSql, nSql, ppStmt, 0); |
| 218540 | 219311 | } |
| 218541 | 219312 | sqlite3_free(zSql); |
| 219313 | + sqlite3_free(nooptest.aBuf); |
| 219314 | + sqlite3_free(pkfield.aBuf); |
| 219315 | + sqlite3_free(pkvar.aBuf); |
| 218542 | 219316 | return rc; |
| 218543 | 219317 | } |
| 218544 | 219318 | |
| 218545 | 219319 | /* |
| 218546 | 219320 | ** Bind the PRIMARY KEY values from the change passed in argument pChange |
| | @@ -218696,11 +219470,12 @@ |
| 218696 | 219470 | sessionAppendTableHdr(&buf, bPatchset, pTab, &rc); |
| 218697 | 219471 | |
| 218698 | 219472 | /* Build and compile a statement to execute: */ |
| 218699 | 219473 | if( rc==SQLITE_OK ){ |
| 218700 | 219474 | rc = sessionSelectStmt( |
| 218701 | | - db, pSession->zDb, zName, nCol, azCol, abPK, &pSel); |
| 219475 | + db, 0, pSession->zDb, zName, nCol, azCol, abPK, &pSel |
| 219476 | + ); |
| 218702 | 219477 | } |
| 218703 | 219478 | |
| 218704 | 219479 | nNoop = buf.nBuf; |
| 218705 | 219480 | for(i=0; i<pTab->nChange && rc==SQLITE_OK; i++){ |
| 218706 | 219481 | SessionChange *p; /* Used to iterate through changes */ |
| | @@ -219885,10 +220660,11 @@ |
| 219885 | 220660 | int bInvertConstraints; /* Invert when iterating constraints buffer */ |
| 219886 | 220661 | SessionBuffer constraints; /* Deferred constraints are stored here */ |
| 219887 | 220662 | SessionBuffer rebase; /* Rebase information (if any) here */ |
| 219888 | 220663 | u8 bRebaseStarted; /* If table header is already in rebase */ |
| 219889 | 220664 | u8 bRebase; /* True to collect rebase information */ |
| 220665 | + u8 bIgnoreNoop; /* True to ignore no-op conflicts */ |
| 219890 | 220666 | }; |
| 219891 | 220667 | |
| 219892 | 220668 | /* Number of prepared UPDATE statements to cache. */ |
| 219893 | 220669 | #define SESSION_UPDATE_CACHE_SZ 12 |
| 219894 | 220670 | |
| | @@ -220135,12 +220911,13 @@ |
| 220135 | 220911 | static int sessionSelectRow( |
| 220136 | 220912 | sqlite3 *db, /* Database handle */ |
| 220137 | 220913 | const char *zTab, /* Table name */ |
| 220138 | 220914 | SessionApplyCtx *p /* Session changeset-apply context */ |
| 220139 | 220915 | ){ |
| 220140 | | - return sessionSelectStmt( |
| 220141 | | - db, "main", zTab, p->nCol, p->azCol, p->abPK, &p->pSelect); |
| 220916 | + return sessionSelectStmt(db, p->bIgnoreNoop, |
| 220917 | + "main", zTab, p->nCol, p->azCol, p->abPK, &p->pSelect |
| 220918 | + ); |
| 220142 | 220919 | } |
| 220143 | 220920 | |
| 220144 | 220921 | /* |
| 220145 | 220922 | ** Formulate and prepare an INSERT statement to add a record to table zTab. |
| 220146 | 220923 | ** For example: |
| | @@ -220295,23 +221072,36 @@ |
| 220295 | 221072 | ** new.* record to the SELECT statement. Or, if it points to a DELETE or |
| 220296 | 221073 | ** UPDATE, bind values from the old.* record. |
| 220297 | 221074 | */ |
| 220298 | 221075 | static int sessionSeekToRow( |
| 220299 | 221076 | sqlite3_changeset_iter *pIter, /* Changeset iterator */ |
| 220300 | | - u8 *abPK, /* Primary key flags array */ |
| 220301 | | - sqlite3_stmt *pSelect /* SELECT statement from sessionSelectRow() */ |
| 221077 | + SessionApplyCtx *p |
| 220302 | 221078 | ){ |
| 221079 | + sqlite3_stmt *pSelect = p->pSelect; |
| 220303 | 221080 | int rc; /* Return code */ |
| 220304 | 221081 | int nCol; /* Number of columns in table */ |
| 220305 | 221082 | int op; /* Changset operation (SQLITE_UPDATE etc.) */ |
| 220306 | 221083 | const char *zDummy; /* Unused */ |
| 220307 | 221084 | |
| 221085 | + sqlite3_clear_bindings(pSelect); |
| 220308 | 221086 | sqlite3changeset_op(pIter, &zDummy, &nCol, &op, 0); |
| 220309 | 221087 | rc = sessionBindRow(pIter, |
| 220310 | 221088 | op==SQLITE_INSERT ? sqlite3changeset_new : sqlite3changeset_old, |
| 220311 | | - nCol, abPK, pSelect |
| 221089 | + nCol, p->abPK, pSelect |
| 220312 | 221090 | ); |
| 221091 | + |
| 221092 | + if( op!=SQLITE_DELETE && p->bIgnoreNoop ){ |
| 221093 | + int ii; |
| 221094 | + for(ii=0; rc==SQLITE_OK && ii<nCol; ii++){ |
| 221095 | + if( p->abPK[ii]==0 ){ |
| 221096 | + sqlite3_value *pVal = 0; |
| 221097 | + sqlite3changeset_new(pIter, ii, &pVal); |
| 221098 | + sqlite3_bind_int(pSelect, ii+1+nCol, (pVal==0)); |
| 221099 | + if( pVal ) rc = sessionBindValue(pSelect, ii+1, pVal); |
| 221100 | + } |
| 221101 | + } |
| 221102 | + } |
| 220313 | 221103 | |
| 220314 | 221104 | if( rc==SQLITE_OK ){ |
| 220315 | 221105 | rc = sqlite3_step(pSelect); |
| 220316 | 221106 | if( rc!=SQLITE_ROW ) rc = sqlite3_reset(pSelect); |
| 220317 | 221107 | } |
| | @@ -220423,20 +221213,26 @@ |
| 220423 | 221213 | assert( SQLITE_CHANGESET_CONFLICT+1==SQLITE_CHANGESET_CONSTRAINT ); |
| 220424 | 221214 | assert( SQLITE_CHANGESET_DATA+1==SQLITE_CHANGESET_NOTFOUND ); |
| 220425 | 221215 | |
| 220426 | 221216 | /* Bind the new.* PRIMARY KEY values to the SELECT statement. */ |
| 220427 | 221217 | if( pbReplace ){ |
| 220428 | | - rc = sessionSeekToRow(pIter, p->abPK, p->pSelect); |
| 221218 | + rc = sessionSeekToRow(pIter, p); |
| 220429 | 221219 | }else{ |
| 220430 | 221220 | rc = SQLITE_OK; |
| 220431 | 221221 | } |
| 220432 | 221222 | |
| 220433 | 221223 | if( rc==SQLITE_ROW ){ |
| 220434 | 221224 | /* There exists another row with the new.* primary key. */ |
| 220435 | | - pIter->pConflict = p->pSelect; |
| 220436 | | - res = xConflict(pCtx, eType, pIter); |
| 220437 | | - pIter->pConflict = 0; |
| 221225 | + if( p->bIgnoreNoop |
| 221226 | + && sqlite3_column_int(p->pSelect, sqlite3_column_count(p->pSelect)-1) |
| 221227 | + ){ |
| 221228 | + res = SQLITE_CHANGESET_OMIT; |
| 221229 | + }else{ |
| 221230 | + pIter->pConflict = p->pSelect; |
| 221231 | + res = xConflict(pCtx, eType, pIter); |
| 221232 | + pIter->pConflict = 0; |
| 221233 | + } |
| 220438 | 221234 | rc = sqlite3_reset(p->pSelect); |
| 220439 | 221235 | }else if( rc==SQLITE_OK ){ |
| 220440 | 221236 | if( p->bDeferConstraints && eType==SQLITE_CHANGESET_CONFLICT ){ |
| 220441 | 221237 | /* Instead of invoking the conflict handler, append the change blob |
| 220442 | 221238 | ** to the SessionApplyCtx.constraints buffer. */ |
| | @@ -220540,11 +221336,11 @@ |
| 220540 | 221336 | } |
| 220541 | 221337 | if( rc!=SQLITE_OK ) return rc; |
| 220542 | 221338 | |
| 220543 | 221339 | sqlite3_step(p->pDelete); |
| 220544 | 221340 | rc = sqlite3_reset(p->pDelete); |
| 220545 | | - if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 ){ |
| 221341 | + if( rc==SQLITE_OK && sqlite3_changes(p->db)==0 && p->bIgnoreNoop==0 ){ |
| 220546 | 221342 | rc = sessionConflictHandler( |
| 220547 | 221343 | SQLITE_CHANGESET_DATA, p, pIter, xConflict, pCtx, pbRetry |
| 220548 | 221344 | ); |
| 220549 | 221345 | }else if( (rc&0xff)==SQLITE_CONSTRAINT ){ |
| 220550 | 221346 | rc = sessionConflictHandler( |
| | @@ -220597,11 +221393,11 @@ |
| 220597 | 221393 | assert( op==SQLITE_INSERT ); |
| 220598 | 221394 | if( p->bStat1 ){ |
| 220599 | 221395 | /* Check if there is a conflicting row. For sqlite_stat1, this needs |
| 220600 | 221396 | ** to be done using a SELECT, as there is no PRIMARY KEY in the |
| 220601 | 221397 | ** database schema to throw an exception if a duplicate is inserted. */ |
| 220602 | | - rc = sessionSeekToRow(pIter, p->abPK, p->pSelect); |
| 221398 | + rc = sessionSeekToRow(pIter, p); |
| 220603 | 221399 | if( rc==SQLITE_ROW ){ |
| 220604 | 221400 | rc = SQLITE_CONSTRAINT; |
| 220605 | 221401 | sqlite3_reset(p->pSelect); |
| 220606 | 221402 | } |
| 220607 | 221403 | } |
| | @@ -220774,10 +221570,11 @@ |
| 220774 | 221570 | |
| 220775 | 221571 | pIter->in.bNoDiscard = 1; |
| 220776 | 221572 | memset(&sApply, 0, sizeof(sApply)); |
| 220777 | 221573 | sApply.bRebase = (ppRebase && pnRebase); |
| 220778 | 221574 | sApply.bInvertConstraints = !!(flags & SQLITE_CHANGESETAPPLY_INVERT); |
| 221575 | + sApply.bIgnoreNoop = !!(flags & SQLITE_CHANGESETAPPLY_IGNORENOOP); |
| 220779 | 221576 | sqlite3_mutex_enter(sqlite3_db_mutex(db)); |
| 220780 | 221577 | if( (flags & SQLITE_CHANGESETAPPLY_NOSAVEPOINT)==0 ){ |
| 220781 | 221578 | rc = sqlite3_exec(db, "SAVEPOINT changeset_apply", 0, 0, 0); |
| 220782 | 221579 | } |
| 220783 | 221580 | if( rc==SQLITE_OK ){ |
| | @@ -225030,11 +225827,11 @@ |
| 225030 | 225827 | UNUSED_PARAM2(pToken, nToken); |
| 225031 | 225828 | |
| 225032 | 225829 | if( tflags & FTS5_TOKEN_COLOCATED ) return SQLITE_OK; |
| 225033 | 225830 | iPos = p->iPos++; |
| 225034 | 225831 | |
| 225035 | | - if( p->iRangeEnd>0 ){ |
| 225832 | + if( p->iRangeEnd>=0 ){ |
| 225036 | 225833 | if( iPos<p->iRangeStart || iPos>p->iRangeEnd ) return SQLITE_OK; |
| 225037 | 225834 | if( p->iRangeStart && iPos==p->iRangeStart ) p->iOff = iStartOff; |
| 225038 | 225835 | } |
| 225039 | 225836 | |
| 225040 | 225837 | if( iPos==p->iter.iStart ){ |
| | @@ -225042,11 +225839,11 @@ |
| 225042 | 225839 | fts5HighlightAppend(&rc, p, p->zOpen, -1); |
| 225043 | 225840 | p->iOff = iStartOff; |
| 225044 | 225841 | } |
| 225045 | 225842 | |
| 225046 | 225843 | if( iPos==p->iter.iEnd ){ |
| 225047 | | - if( p->iRangeEnd && p->iter.iStart<p->iRangeStart ){ |
| 225844 | + if( p->iRangeEnd>=0 && p->iter.iStart<p->iRangeStart ){ |
| 225048 | 225845 | fts5HighlightAppend(&rc, p, p->zOpen, -1); |
| 225049 | 225846 | } |
| 225050 | 225847 | fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff); |
| 225051 | 225848 | fts5HighlightAppend(&rc, p, p->zClose, -1); |
| 225052 | 225849 | p->iOff = iEndOff; |
| | @@ -225053,11 +225850,11 @@ |
| 225053 | 225850 | if( rc==SQLITE_OK ){ |
| 225054 | 225851 | rc = fts5CInstIterNext(&p->iter); |
| 225055 | 225852 | } |
| 225056 | 225853 | } |
| 225057 | 225854 | |
| 225058 | | - if( p->iRangeEnd>0 && iPos==p->iRangeEnd ){ |
| 225855 | + if( p->iRangeEnd>=0 && iPos==p->iRangeEnd ){ |
| 225059 | 225856 | fts5HighlightAppend(&rc, p, &p->zIn[p->iOff], iEndOff - p->iOff); |
| 225060 | 225857 | p->iOff = iEndOff; |
| 225061 | 225858 | if( iPos>=p->iter.iStart && iPos<p->iter.iEnd ){ |
| 225062 | 225859 | fts5HighlightAppend(&rc, p, p->zClose, -1); |
| 225063 | 225860 | } |
| | @@ -225088,10 +225885,11 @@ |
| 225088 | 225885 | |
| 225089 | 225886 | iCol = sqlite3_value_int(apVal[0]); |
| 225090 | 225887 | memset(&ctx, 0, sizeof(HighlightContext)); |
| 225091 | 225888 | ctx.zOpen = (const char*)sqlite3_value_text(apVal[1]); |
| 225092 | 225889 | ctx.zClose = (const char*)sqlite3_value_text(apVal[2]); |
| 225890 | + ctx.iRangeEnd = -1; |
| 225093 | 225891 | rc = pApi->xColumnText(pFts, iCol, &ctx.zIn, &ctx.nIn); |
| 225094 | 225892 | |
| 225095 | 225893 | if( ctx.zIn ){ |
| 225096 | 225894 | if( rc==SQLITE_OK ){ |
| 225097 | 225895 | rc = fts5CInstIterInit(pApi, pFts, iCol, &ctx.iter); |
| | @@ -225273,10 +226071,11 @@ |
| 225273 | 226071 | nCol = pApi->xColumnCount(pFts); |
| 225274 | 226072 | memset(&ctx, 0, sizeof(HighlightContext)); |
| 225275 | 226073 | iCol = sqlite3_value_int(apVal[0]); |
| 225276 | 226074 | ctx.zOpen = fts5ValueToText(apVal[1]); |
| 225277 | 226075 | ctx.zClose = fts5ValueToText(apVal[2]); |
| 226076 | + ctx.iRangeEnd = -1; |
| 225278 | 226077 | zEllips = fts5ValueToText(apVal[3]); |
| 225279 | 226078 | nToken = sqlite3_value_int(apVal[4]); |
| 225280 | 226079 | |
| 225281 | 226080 | iBestCol = (iCol>=0 ? iCol : 0); |
| 225282 | 226081 | nPhrase = pApi->xPhraseCount(pFts); |
| | @@ -240222,11 +241021,11 @@ |
| 240222 | 241021 | int nArg, /* Number of args */ |
| 240223 | 241022 | sqlite3_value **apUnused /* Function arguments */ |
| 240224 | 241023 | ){ |
| 240225 | 241024 | assert( nArg==0 ); |
| 240226 | 241025 | UNUSED_PARAM2(nArg, apUnused); |
| 240227 | | - sqlite3_result_text(pCtx, "fts5: 2023-03-09 16:04:34 cc8a0ee40cfc83ab42a0ff452de0a53fe17784aefb944ea7ac2cb078a8310730", -1, SQLITE_TRANSIENT); |
| 241026 | + sqlite3_result_text(pCtx, "fts5: 2023-04-10 13:20:51 49ba030080dd00b4fdf788fd3da057b333e705fa0fe37d653e2461bf96ca3785", -1, SQLITE_TRANSIENT); |
| 240228 | 241027 | } |
| 240229 | 241028 | |
| 240230 | 241029 | /* |
| 240231 | 241030 | ** Return true if zName is the extension on one of the shadow tables used |
| 240232 | 241031 | ** by this module. |
| 240233 | 241032 | |