| | @@ -1,8 +1,8 @@ |
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | | -** version 3.13.0. By combining all the individual C code files into this |
| 3 | +** version 3.14.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. |
| | @@ -35,12 +35,12 @@ |
| 35 | 35 | ** |
| 36 | 36 | ************************************************************************* |
| 37 | 37 | ** Internal interface definitions for SQLite. |
| 38 | 38 | ** |
| 39 | 39 | */ |
| 40 | | -#ifndef _SQLITEINT_H_ |
| 41 | | -#define _SQLITEINT_H_ |
| 40 | +#ifndef SQLITEINT_H |
| 41 | +#define SQLITEINT_H |
| 42 | 42 | |
| 43 | 43 | /* Special Comments: |
| 44 | 44 | ** |
| 45 | 45 | ** Some comments have special meaning to the tools that measure test |
| 46 | 46 | ** coverage: |
| | @@ -95,12 +95,12 @@ |
| 95 | 95 | ** |
| 96 | 96 | ****************************************************************************** |
| 97 | 97 | ** |
| 98 | 98 | ** This file contains code that is specific to MSVC. |
| 99 | 99 | */ |
| 100 | | -#ifndef _MSVC_H_ |
| 101 | | -#define _MSVC_H_ |
| 100 | +#ifndef SQLITE_MSVC_H |
| 101 | +#define SQLITE_MSVC_H |
| 102 | 102 | |
| 103 | 103 | #if defined(_MSC_VER) |
| 104 | 104 | #pragma warning(disable : 4054) |
| 105 | 105 | #pragma warning(disable : 4055) |
| 106 | 106 | #pragma warning(disable : 4100) |
| | @@ -116,11 +116,11 @@ |
| 116 | 116 | #pragma warning(disable : 4306) |
| 117 | 117 | #pragma warning(disable : 4702) |
| 118 | 118 | #pragma warning(disable : 4706) |
| 119 | 119 | #endif /* defined(_MSC_VER) */ |
| 120 | 120 | |
| 121 | | -#endif /* _MSVC_H_ */ |
| 121 | +#endif /* SQLITE_MSVC_H */ |
| 122 | 122 | |
| 123 | 123 | /************** End of msvc.h ************************************************/ |
| 124 | 124 | /************** Continuing where we left off in sqliteInt.h ******************/ |
| 125 | 125 | |
| 126 | 126 | /* |
| | @@ -280,12 +280,12 @@ |
| 280 | 280 | ** The name of this file under configuration management is "sqlite.h.in". |
| 281 | 281 | ** The makefile makes some minor changes to this file (such as inserting |
| 282 | 282 | ** the version number) and changes its name to "sqlite3.h" as |
| 283 | 283 | ** part of the build process. |
| 284 | 284 | */ |
| 285 | | -#ifndef _SQLITE3_H_ |
| 286 | | -#define _SQLITE3_H_ |
| 285 | +#ifndef SQLITE3_H |
| 286 | +#define SQLITE3_H |
| 287 | 287 | #include <stdarg.h> /* Needed for the definition of va_list */ |
| 288 | 288 | |
| 289 | 289 | /* |
| 290 | 290 | ** Make sure we can call this stuff from C++. |
| 291 | 291 | */ |
| | @@ -361,13 +361,13 @@ |
| 361 | 361 | ** |
| 362 | 362 | ** See also: [sqlite3_libversion()], |
| 363 | 363 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 364 | 364 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 365 | 365 | */ |
| 366 | | -#define SQLITE_VERSION "3.13.0" |
| 367 | | -#define SQLITE_VERSION_NUMBER 3013000 |
| 368 | | -#define SQLITE_SOURCE_ID "2016-05-18 10:57:30 fc49f556e48970561d7ab6a2f24fdd7d9eb81ff2" |
| 366 | +#define SQLITE_VERSION "3.14.0" |
| 367 | +#define SQLITE_VERSION_NUMBER 3014000 |
| 368 | +#define SQLITE_SOURCE_ID "2016-07-23 20:27:41 c8e0539b970585cbb3619461a53abb0c3b308a17" |
| 369 | 369 | |
| 370 | 370 | /* |
| 371 | 371 | ** CAPI3REF: Run-Time Library Version Numbers |
| 372 | 372 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 373 | 373 | ** |
| | @@ -756,10 +756,11 @@ |
| 756 | 756 | #define SQLITE_CONSTRAINT_ROWID (SQLITE_CONSTRAINT |(10<<8)) |
| 757 | 757 | #define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8)) |
| 758 | 758 | #define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8)) |
| 759 | 759 | #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) |
| 760 | 760 | #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8)) |
| 761 | +#define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8)) |
| 761 | 762 | |
| 762 | 763 | /* |
| 763 | 764 | ** CAPI3REF: Flags For File Open Operations |
| 764 | 765 | ** |
| 765 | 766 | ** These bit values are intended for use in the |
| | @@ -3003,10 +3004,13 @@ |
| 3003 | 3004 | #define SQLITE_RECURSIVE 33 /* NULL NULL */ |
| 3004 | 3005 | |
| 3005 | 3006 | /* |
| 3006 | 3007 | ** CAPI3REF: Tracing And Profiling Functions |
| 3007 | 3008 | ** METHOD: sqlite3 |
| 3009 | +** |
| 3010 | +** These routines are deprecated. Use the [sqlite3_trace_v2()] interface |
| 3011 | +** instead of the routines described here. |
| 3008 | 3012 | ** |
| 3009 | 3013 | ** These routines register callback functions that can be used for |
| 3010 | 3014 | ** tracing and profiling the execution of SQL statements. |
| 3011 | 3015 | ** |
| 3012 | 3016 | ** ^The callback function registered by sqlite3_trace() is invoked at |
| | @@ -3029,13 +3033,104 @@ |
| 3029 | 3033 | ** digits in the time are meaningless. Future versions of SQLite |
| 3030 | 3034 | ** might provide greater resolution on the profiler callback. The |
| 3031 | 3035 | ** sqlite3_profile() function is considered experimental and is |
| 3032 | 3036 | ** subject to change in future versions of SQLite. |
| 3033 | 3037 | */ |
| 3034 | | -SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); |
| 3035 | | -SQLITE_API SQLITE_EXPERIMENTAL void *SQLITE_STDCALL sqlite3_profile(sqlite3*, |
| 3038 | +SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_trace(sqlite3*, |
| 3039 | + void(*xTrace)(void*,const char*), void*); |
| 3040 | +SQLITE_API SQLITE_DEPRECATED void *SQLITE_STDCALL sqlite3_profile(sqlite3*, |
| 3036 | 3041 | void(*xProfile)(void*,const char*,sqlite3_uint64), void*); |
| 3042 | + |
| 3043 | +/* |
| 3044 | +** CAPI3REF: SQL Trace Event Codes |
| 3045 | +** KEYWORDS: SQLITE_TRACE |
| 3046 | +** |
| 3047 | +** These constants identify classes of events that can be monitored |
| 3048 | +** using the [sqlite3_trace_v2()] tracing logic. The third argument |
| 3049 | +** to [sqlite3_trace_v2()] is an OR-ed combination of one or more of |
| 3050 | +** the following constants. ^The first argument to the trace callback |
| 3051 | +** is one of the following constants. |
| 3052 | +** |
| 3053 | +** New tracing constants may be added in future releases. |
| 3054 | +** |
| 3055 | +** ^A trace callback has four arguments: xCallback(T,C,P,X). |
| 3056 | +** ^The T argument is one of the integer type codes above. |
| 3057 | +** ^The C argument is a copy of the context pointer passed in as the |
| 3058 | +** fourth argument to [sqlite3_trace_v2()]. |
| 3059 | +** The P and X arguments are pointers whose meanings depend on T. |
| 3060 | +** |
| 3061 | +** <dl> |
| 3062 | +** [[SQLITE_TRACE_STMT]] <dt>SQLITE_TRACE_STMT</dt> |
| 3063 | +** <dd>^An SQLITE_TRACE_STMT callback is invoked when a prepared statement |
| 3064 | +** first begins running and possibly at other times during the |
| 3065 | +** execution of the prepared statement, such as at the start of each |
| 3066 | +** trigger subprogram. ^The P argument is a pointer to the |
| 3067 | +** [prepared statement]. ^The X argument is a pointer to a string which |
| 3068 | +** is the expanded SQL text of the prepared statement or a comment that |
| 3069 | +** indicates the invocation of a trigger. |
| 3070 | +** |
| 3071 | +** [[SQLITE_TRACE_PROFILE]] <dt>SQLITE_TRACE_PROFILE</dt> |
| 3072 | +** <dd>^An SQLITE_TRACE_PROFILE callback provides approximately the same |
| 3073 | +** information as is provided by the [sqlite3_profile()] callback. |
| 3074 | +** ^The P argument is a pointer to the [prepared statement] and the |
| 3075 | +** X argument points to a 64-bit integer which is the estimated of |
| 3076 | +** the number of nanosecond that the prepared statement took to run. |
| 3077 | +** ^The SQLITE_TRACE_PROFILE callback is invoked when the statement finishes. |
| 3078 | +** |
| 3079 | +** [[SQLITE_TRACE_ROW]] <dt>SQLITE_TRACE_ROW</dt> |
| 3080 | +** <dd>^An SQLITE_TRACE_ROW callback is invoked whenever a prepared |
| 3081 | +** statement generates a single row of result. |
| 3082 | +** ^The P argument is a pointer to the [prepared statement] and the |
| 3083 | +** X argument is unused. |
| 3084 | +** |
| 3085 | +** [[SQLITE_TRACE_CLOSE]] <dt>SQLITE_TRACE_CLOSE</dt> |
| 3086 | +** <dd>^An SQLITE_TRACE_CLOSE callback is invoked when a database |
| 3087 | +** connection closes. |
| 3088 | +** ^The P argument is a pointer to the [database connection] object |
| 3089 | +** and the X argument is unused. |
| 3090 | +** </dl> |
| 3091 | +*/ |
| 3092 | +#define SQLITE_TRACE_STMT 0x01 |
| 3093 | +#define SQLITE_TRACE_PROFILE 0x02 |
| 3094 | +#define SQLITE_TRACE_ROW 0x04 |
| 3095 | +#define SQLITE_TRACE_CLOSE 0x08 |
| 3096 | + |
| 3097 | +/* |
| 3098 | +** CAPI3REF: SQL Trace Hook |
| 3099 | +** METHOD: sqlite3 |
| 3100 | +** |
| 3101 | +** ^The sqlite3_trace_v2(D,M,X,P) interface registers a trace callback |
| 3102 | +** function X against [database connection] D, using property mask M |
| 3103 | +** and context pointer P. ^If the X callback is |
| 3104 | +** NULL or if the M mask is zero, then tracing is disabled. The |
| 3105 | +** M argument should be the bitwise OR-ed combination of |
| 3106 | +** zero or more [SQLITE_TRACE] constants. |
| 3107 | +** |
| 3108 | +** ^Each call to either sqlite3_trace() or sqlite3_trace_v2() overrides |
| 3109 | +** (cancels) any prior calls to sqlite3_trace() or sqlite3_trace_v2(). |
| 3110 | +** |
| 3111 | +** ^The X callback is invoked whenever any of the events identified by |
| 3112 | +** mask M occur. ^The integer return value from the callback is currently |
| 3113 | +** ignored, though this may change in future releases. Callback |
| 3114 | +** implementations should return zero to ensure future compatibility. |
| 3115 | +** |
| 3116 | +** ^A trace callback is invoked with four arguments: callback(T,C,P,X). |
| 3117 | +** ^The T argument is one of the [SQLITE_TRACE] |
| 3118 | +** constants to indicate why the callback was invoked. |
| 3119 | +** ^The C argument is a copy of the context pointer. |
| 3120 | +** The P and X arguments are pointers whose meanings depend on T. |
| 3121 | +** |
| 3122 | +** The sqlite3_trace_v2() interface is intended to replace the legacy |
| 3123 | +** interfaces [sqlite3_trace()] and [sqlite3_profile()], both of which |
| 3124 | +** are deprecated. |
| 3125 | +*/ |
| 3126 | +SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2( |
| 3127 | + sqlite3*, |
| 3128 | + unsigned uMask, |
| 3129 | + int(*xCallback)(unsigned,void*,void*,void*), |
| 3130 | + void *pCtx |
| 3131 | +); |
| 3037 | 3132 | |
| 3038 | 3133 | /* |
| 3039 | 3134 | ** CAPI3REF: Query Progress Callbacks |
| 3040 | 3135 | ** METHOD: sqlite3 |
| 3041 | 3136 | ** |
| | @@ -3651,15 +3746,39 @@ |
| 3651 | 3746 | |
| 3652 | 3747 | /* |
| 3653 | 3748 | ** CAPI3REF: Retrieving Statement SQL |
| 3654 | 3749 | ** METHOD: sqlite3_stmt |
| 3655 | 3750 | ** |
| 3656 | | -** ^This interface can be used to retrieve a saved copy of the original |
| 3657 | | -** SQL text used to create a [prepared statement] if that statement was |
| 3658 | | -** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. |
| 3751 | +** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8 |
| 3752 | +** SQL text used to create [prepared statement] P if P was |
| 3753 | +** created by either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. |
| 3754 | +** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8 |
| 3755 | +** string containing the SQL text of prepared statement P with |
| 3756 | +** [bound parameters] expanded. |
| 3757 | +** |
| 3758 | +** ^(For example, if a prepared statement is created using the SQL |
| 3759 | +** text "SELECT $abc,:xyz" and if parameter $abc is bound to integer 2345 |
| 3760 | +** and parameter :xyz is unbound, then sqlite3_sql() will return |
| 3761 | +** the original string, "SELECT $abc,:xyz" but sqlite3_expanded_sql() |
| 3762 | +** will return "SELECT 2345,NULL".)^ |
| 3763 | +** |
| 3764 | +** ^The sqlite3_expanded_sql() interface returns NULL if insufficient memory |
| 3765 | +** is available to hold the result, or if the result would exceed the |
| 3766 | +** the maximum string length determined by the [SQLITE_LIMIT_LENGTH]. |
| 3767 | +** |
| 3768 | +** ^The [SQLITE_TRACE_SIZE_LIMIT] compile-time option limits the size of |
| 3769 | +** bound parameter expansions. ^The [SQLITE_OMIT_TRACE] compile-time |
| 3770 | +** option causes sqlite3_expanded_sql() to always return NULL. |
| 3771 | +** |
| 3772 | +** ^The string returned by sqlite3_sql(P) is managed by SQLite and is |
| 3773 | +** automatically freed when the prepared statement is finalized. |
| 3774 | +** ^The string returned by sqlite3_expanded_sql(P), on the other hand, |
| 3775 | +** is obtained from [sqlite3_malloc()] and must be free by the application |
| 3776 | +** by passing it to [sqlite3_free()]. |
| 3659 | 3777 | */ |
| 3660 | 3778 | SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt); |
| 3779 | +SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt); |
| 3661 | 3780 | |
| 3662 | 3781 | /* |
| 3663 | 3782 | ** CAPI3REF: Determine If An SQL Statement Writes The Database |
| 3664 | 3783 | ** METHOD: sqlite3_stmt |
| 3665 | 3784 | ** |
| | @@ -7014,10 +7133,22 @@ |
| 7014 | 7133 | ** [[SQLITE_DBSTATUS_CACHE_USED]] ^(<dt>SQLITE_DBSTATUS_CACHE_USED</dt> |
| 7015 | 7134 | ** <dd>This parameter returns the approximate number of bytes of heap |
| 7016 | 7135 | ** memory used by all pager caches associated with the database connection.)^ |
| 7017 | 7136 | ** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0. |
| 7018 | 7137 | ** |
| 7138 | +** [[SQLITE_DBSTATUS_CACHE_USED_SHARED]] |
| 7139 | +** ^(<dt>SQLITE_DBSTATUS_CACHE_USED_SHARED</dt> |
| 7140 | +** <dd>This parameter is similar to DBSTATUS_CACHE_USED, except that if a |
| 7141 | +** pager cache is shared between two or more connections the bytes of heap |
| 7142 | +** memory used by that pager cache is divided evenly between the attached |
| 7143 | +** connections.)^ In other words, if none of the pager caches associated |
| 7144 | +** with the database connection are shared, this request returns the same |
| 7145 | +** value as DBSTATUS_CACHE_USED. Or, if one or more or the pager caches are |
| 7146 | +** shared, the value returned by this call will be smaller than that returned |
| 7147 | +** by DBSTATUS_CACHE_USED. ^The highwater mark associated with |
| 7148 | +** SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0. |
| 7149 | +** |
| 7019 | 7150 | ** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(<dt>SQLITE_DBSTATUS_SCHEMA_USED</dt> |
| 7020 | 7151 | ** <dd>This parameter returns the approximate number of bytes of heap |
| 7021 | 7152 | ** memory used to store the schema for all databases associated |
| 7022 | 7153 | ** with the connection - main, temp, and any [ATTACH]-ed databases.)^ |
| 7023 | 7154 | ** ^The full amount of memory used by the schemas is reported, even if the |
| | @@ -7071,11 +7202,12 @@ |
| 7071 | 7202 | #define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6 |
| 7072 | 7203 | #define SQLITE_DBSTATUS_CACHE_HIT 7 |
| 7073 | 7204 | #define SQLITE_DBSTATUS_CACHE_MISS 8 |
| 7074 | 7205 | #define SQLITE_DBSTATUS_CACHE_WRITE 9 |
| 7075 | 7206 | #define SQLITE_DBSTATUS_DEFERRED_FKS 10 |
| 7076 | | -#define SQLITE_DBSTATUS_MAX 10 /* Largest defined DBSTATUS */ |
| 7207 | +#define SQLITE_DBSTATUS_CACHE_USED_SHARED 11 |
| 7208 | +#define SQLITE_DBSTATUS_MAX 11 /* Largest defined DBSTATUS */ |
| 7077 | 7209 | |
| 7078 | 7210 | |
| 7079 | 7211 | /* |
| 7080 | 7212 | ** CAPI3REF: Prepared Statement Status |
| 7081 | 7213 | ** METHOD: sqlite3_stmt |
| | @@ -8454,11 +8586,11 @@ |
| 8454 | 8586 | #endif |
| 8455 | 8587 | |
| 8456 | 8588 | #if 0 |
| 8457 | 8589 | } /* End of the 'extern "C"' block */ |
| 8458 | 8590 | #endif |
| 8459 | | -#endif /* _SQLITE3_H_ */ |
| 8591 | +#endif /* SQLITE3_H */ |
| 8460 | 8592 | |
| 8461 | 8593 | /******** Begin file sqlite3rtree.h *********/ |
| 8462 | 8594 | /* |
| 8463 | 8595 | ** 2010 August 30 |
| 8464 | 8596 | ** |
| | @@ -11009,12 +11141,12 @@ |
| 11009 | 11141 | ** |
| 11010 | 11142 | ************************************************************************* |
| 11011 | 11143 | ** This is the header file for the generic hash-table implementation |
| 11012 | 11144 | ** used in SQLite. |
| 11013 | 11145 | */ |
| 11014 | | -#ifndef _SQLITE_HASH_H_ |
| 11015 | | -#define _SQLITE_HASH_H_ |
| 11146 | +#ifndef SQLITE_HASH_H |
| 11147 | +#define SQLITE_HASH_H |
| 11016 | 11148 | |
| 11017 | 11149 | /* Forward declarations of structures. */ |
| 11018 | 11150 | typedef struct Hash Hash; |
| 11019 | 11151 | typedef struct HashElem HashElem; |
| 11020 | 11152 | |
| | @@ -11090,11 +11222,11 @@ |
| 11090 | 11222 | /* |
| 11091 | 11223 | ** Number of entries in a hash table |
| 11092 | 11224 | */ |
| 11093 | 11225 | /* #define sqliteHashCount(H) ((H)->count) // NOT USED */ |
| 11094 | 11226 | |
| 11095 | | -#endif /* _SQLITE_HASH_H_ */ |
| 11227 | +#endif /* SQLITE_HASH_H */ |
| 11096 | 11228 | |
| 11097 | 11229 | /************** End of hash.h ************************************************/ |
| 11098 | 11230 | /************** Continuing where we left off in sqliteInt.h ******************/ |
| 11099 | 11231 | /************** Include parse.h in the middle of sqliteInt.h *****************/ |
| 11100 | 11232 | /************** Begin file parse.h *******************************************/ |
| | @@ -11838,12 +11970,12 @@ |
| 11838 | 11970 | ************************************************************************* |
| 11839 | 11971 | ** This header file defines the interface that the sqlite B-Tree file |
| 11840 | 11972 | ** subsystem. See comments in the source code for a detailed description |
| 11841 | 11973 | ** of what each interface routine does. |
| 11842 | 11974 | */ |
| 11843 | | -#ifndef _BTREE_H_ |
| 11844 | | -#define _BTREE_H_ |
| 11975 | +#ifndef SQLITE_BTREE_H |
| 11976 | +#define SQLITE_BTREE_H |
| 11845 | 11977 | |
| 11846 | 11978 | /* TODO: This definition is just included so other modules compile. It |
| 11847 | 11979 | ** needs to be revisited. |
| 11848 | 11980 | */ |
| 11849 | 11981 | #define SQLITE_N_BTREE_META 16 |
| | @@ -11864,10 +11996,11 @@ |
| 11864 | 11996 | ** Forward declarations of structure |
| 11865 | 11997 | */ |
| 11866 | 11998 | typedef struct Btree Btree; |
| 11867 | 11999 | typedef struct BtCursor BtCursor; |
| 11868 | 12000 | typedef struct BtShared BtShared; |
| 12001 | +typedef struct BtreePayload BtreePayload; |
| 11869 | 12002 | |
| 11870 | 12003 | |
| 11871 | 12004 | SQLITE_PRIVATE int sqlite3BtreeOpen( |
| 11872 | 12005 | sqlite3_vfs *pVfs, /* VFS to use with this b-tree */ |
| 11873 | 12006 | const char *zFilename, /* Name of database file to open */ |
| | @@ -12075,23 +12208,47 @@ |
| 12075 | 12208 | |
| 12076 | 12209 | /* Allowed flags for the 2nd argument to sqlite3BtreeDelete() */ |
| 12077 | 12210 | #define BTREE_SAVEPOSITION 0x02 /* Leave cursor pointing at NEXT or PREV */ |
| 12078 | 12211 | #define BTREE_AUXDELETE 0x04 /* not the primary delete operation */ |
| 12079 | 12212 | |
| 12080 | | -SQLITE_PRIVATE int sqlite3BtreeInsert(BtCursor*, const void *pKey, i64 nKey, |
| 12081 | | - const void *pData, int nData, |
| 12082 | | - int nZero, int bias, int seekResult); |
| 12213 | +/* An instance of the BtreePayload object describes the content of a single |
| 12214 | +** entry in either an index or table btree. |
| 12215 | +** |
| 12216 | +** Index btrees (used for indexes and also WITHOUT ROWID tables) contain |
| 12217 | +** an arbitrary key and no data. These btrees have pKey,nKey set to their |
| 12218 | +** key and pData,nData,nZero set to zero. |
| 12219 | +** |
| 12220 | +** Table btrees (used for rowid tables) contain an integer rowid used as |
| 12221 | +** the key and passed in the nKey field. The pKey field is zero. |
| 12222 | +** pData,nData hold the content of the new entry. nZero extra zero bytes |
| 12223 | +** are appended to the end of the content when constructing the entry. |
| 12224 | +** |
| 12225 | +** This object is used to pass information into sqlite3BtreeInsert(). The |
| 12226 | +** same information used to be passed as five separate parameters. But placing |
| 12227 | +** the information into this object helps to keep the interface more |
| 12228 | +** organized and understandable, and it also helps the resulting code to |
| 12229 | +** run a little faster by using fewer registers for parameter passing. |
| 12230 | +*/ |
| 12231 | +struct BtreePayload { |
| 12232 | + const void *pKey; /* Key content for indexes. NULL for tables */ |
| 12233 | + sqlite3_int64 nKey; /* Size of pKey for indexes. PRIMARY KEY for tabs */ |
| 12234 | + const void *pData; /* Data for tables. NULL for indexes */ |
| 12235 | + int nData; /* Size of pData. 0 if none. */ |
| 12236 | + int nZero; /* Extra zero data appended after pData,nData */ |
| 12237 | +}; |
| 12238 | + |
| 12239 | +SQLITE_PRIVATE int sqlite3BtreeInsert(BtCursor*, const BtreePayload *pPayload, |
| 12240 | + int bias, int seekResult); |
| 12083 | 12241 | SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor*, int *pRes); |
| 12084 | 12242 | SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor*, int *pRes); |
| 12085 | 12243 | SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor*, int *pRes); |
| 12086 | 12244 | SQLITE_PRIVATE int sqlite3BtreeEof(BtCursor*); |
| 12087 | 12245 | SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor*, int *pRes); |
| 12088 | | -SQLITE_PRIVATE int sqlite3BtreeKeySize(BtCursor*, i64 *pSize); |
| 12246 | +SQLITE_PRIVATE i64 sqlite3BtreeIntegerKey(BtCursor*); |
| 12089 | 12247 | SQLITE_PRIVATE int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*); |
| 12090 | | -SQLITE_PRIVATE const void *sqlite3BtreeKeyFetch(BtCursor*, u32 *pAmt); |
| 12091 | | -SQLITE_PRIVATE const void *sqlite3BtreeDataFetch(BtCursor*, u32 *pAmt); |
| 12092 | | -SQLITE_PRIVATE int sqlite3BtreeDataSize(BtCursor*, u32 *pSize); |
| 12248 | +SQLITE_PRIVATE const void *sqlite3BtreePayloadFetch(BtCursor*, u32 *pAmt); |
| 12249 | +SQLITE_PRIVATE u32 sqlite3BtreePayloadSize(BtCursor*); |
| 12093 | 12250 | SQLITE_PRIVATE int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*); |
| 12094 | 12251 | |
| 12095 | 12252 | SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*); |
| 12096 | 12253 | SQLITE_PRIVATE struct Pager *sqlite3BtreePager(Btree*); |
| 12097 | 12254 | |
| | @@ -12128,15 +12285,17 @@ |
| 12128 | 12285 | #ifndef SQLITE_OMIT_SHARED_CACHE |
| 12129 | 12286 | SQLITE_PRIVATE void sqlite3BtreeEnter(Btree*); |
| 12130 | 12287 | SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3*); |
| 12131 | 12288 | SQLITE_PRIVATE int sqlite3BtreeSharable(Btree*); |
| 12132 | 12289 | SQLITE_PRIVATE void sqlite3BtreeEnterCursor(BtCursor*); |
| 12290 | +SQLITE_PRIVATE int sqlite3BtreeConnectionCount(Btree*); |
| 12133 | 12291 | #else |
| 12134 | 12292 | # define sqlite3BtreeEnter(X) |
| 12135 | 12293 | # define sqlite3BtreeEnterAll(X) |
| 12136 | 12294 | # define sqlite3BtreeSharable(X) 0 |
| 12137 | 12295 | # define sqlite3BtreeEnterCursor(X) |
| 12296 | +# define sqlite3BtreeConnectionCount(X) 1 |
| 12138 | 12297 | #endif |
| 12139 | 12298 | |
| 12140 | 12299 | #if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE |
| 12141 | 12300 | SQLITE_PRIVATE void sqlite3BtreeLeave(Btree*); |
| 12142 | 12301 | SQLITE_PRIVATE void sqlite3BtreeLeaveCursor(BtCursor*); |
| | @@ -12157,11 +12316,11 @@ |
| 12157 | 12316 | # define sqlite3BtreeHoldsAllMutexes(X) 1 |
| 12158 | 12317 | # define sqlite3SchemaMutexHeld(X,Y,Z) 1 |
| 12159 | 12318 | #endif |
| 12160 | 12319 | |
| 12161 | 12320 | |
| 12162 | | -#endif /* _BTREE_H_ */ |
| 12321 | +#endif /* SQLITE_BTREE_H */ |
| 12163 | 12322 | |
| 12164 | 12323 | /************** End of btree.h ***********************************************/ |
| 12165 | 12324 | /************** Continuing where we left off in sqliteInt.h ******************/ |
| 12166 | 12325 | /************** Include vdbe.h in the middle of sqliteInt.h ******************/ |
| 12167 | 12326 | /************** Begin file vdbe.h ********************************************/ |
| | @@ -12180,12 +12339,12 @@ |
| 12180 | 12339 | ** |
| 12181 | 12340 | ** This header defines the interface to the virtual database engine |
| 12182 | 12341 | ** or VDBE. The VDBE implements an abstract machine that runs a |
| 12183 | 12342 | ** simple program to access and modify the underlying database. |
| 12184 | 12343 | */ |
| 12185 | | -#ifndef _SQLITE_VDBE_H_ |
| 12186 | | -#define _SQLITE_VDBE_H_ |
| 12344 | +#ifndef SQLITE_VDBE_H |
| 12345 | +#define SQLITE_VDBE_H |
| 12187 | 12346 | /* #include <stdio.h> */ |
| 12188 | 12347 | |
| 12189 | 12348 | /* |
| 12190 | 12349 | ** A single VDBE is an opaque structure named "Vdbe". Only routines |
| 12191 | 12350 | ** in the source file sqliteVdbe.c are allowed to see the insides |
| | @@ -12366,21 +12525,21 @@ |
| 12366 | 12525 | #define OP_Or 27 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */ |
| 12367 | 12526 | #define OP_And 28 /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */ |
| 12368 | 12527 | #define OP_NoConflict 29 /* synopsis: key=r[P3@P4] */ |
| 12369 | 12528 | #define OP_NotFound 30 /* synopsis: key=r[P3@P4] */ |
| 12370 | 12529 | #define OP_Found 31 /* synopsis: key=r[P3@P4] */ |
| 12371 | | -#define OP_NotExists 32 /* synopsis: intkey=r[P3] */ |
| 12372 | | -#define OP_Last 33 |
| 12530 | +#define OP_SeekRowid 32 /* synopsis: intkey=r[P3] */ |
| 12531 | +#define OP_NotExists 33 /* synopsis: intkey=r[P3] */ |
| 12373 | 12532 | #define OP_IsNull 34 /* same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */ |
| 12374 | 12533 | #define OP_NotNull 35 /* same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */ |
| 12375 | 12534 | #define OP_Ne 36 /* same as TK_NE, synopsis: if r[P1]!=r[P3] goto P2 */ |
| 12376 | 12535 | #define OP_Eq 37 /* same as TK_EQ, synopsis: if r[P1]==r[P3] goto P2 */ |
| 12377 | 12536 | #define OP_Gt 38 /* same as TK_GT, synopsis: if r[P1]>r[P3] goto P2 */ |
| 12378 | 12537 | #define OP_Le 39 /* same as TK_LE, synopsis: if r[P1]<=r[P3] goto P2 */ |
| 12379 | 12538 | #define OP_Lt 40 /* same as TK_LT, synopsis: if r[P1]<r[P3] goto P2 */ |
| 12380 | 12539 | #define OP_Ge 41 /* same as TK_GE, synopsis: if r[P1]>=r[P3] goto P2 */ |
| 12381 | | -#define OP_SorterSort 42 |
| 12540 | +#define OP_Last 42 |
| 12382 | 12541 | #define OP_BitAnd 43 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */ |
| 12383 | 12542 | #define OP_BitOr 44 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */ |
| 12384 | 12543 | #define OP_ShiftLeft 45 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */ |
| 12385 | 12544 | #define OP_ShiftRight 46 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */ |
| 12386 | 12545 | #define OP_Add 47 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */ |
| | @@ -12387,118 +12546,119 @@ |
| 12387 | 12546 | #define OP_Subtract 48 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */ |
| 12388 | 12547 | #define OP_Multiply 49 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */ |
| 12389 | 12548 | #define OP_Divide 50 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */ |
| 12390 | 12549 | #define OP_Remainder 51 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */ |
| 12391 | 12550 | #define OP_Concat 52 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */ |
| 12392 | | -#define OP_Sort 53 |
| 12551 | +#define OP_SorterSort 53 |
| 12393 | 12552 | #define OP_BitNot 54 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */ |
| 12394 | | -#define OP_Rewind 55 |
| 12395 | | -#define OP_IdxLE 56 /* synopsis: key=r[P3@P4] */ |
| 12396 | | -#define OP_IdxGT 57 /* synopsis: key=r[P3@P4] */ |
| 12397 | | -#define OP_IdxLT 58 /* synopsis: key=r[P3@P4] */ |
| 12398 | | -#define OP_IdxGE 59 /* synopsis: key=r[P3@P4] */ |
| 12399 | | -#define OP_RowSetRead 60 /* synopsis: r[P3]=rowset(P1) */ |
| 12400 | | -#define OP_RowSetTest 61 /* synopsis: if r[P3] in rowset(P1) goto P2 */ |
| 12401 | | -#define OP_Program 62 |
| 12402 | | -#define OP_FkIfZero 63 /* synopsis: if fkctr[P1]==0 goto P2 */ |
| 12403 | | -#define OP_IfPos 64 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */ |
| 12404 | | -#define OP_IfNotZero 65 /* synopsis: if r[P1]!=0 then r[P1]-=P3, goto P2 */ |
| 12405 | | -#define OP_DecrJumpZero 66 /* synopsis: if (--r[P1])==0 goto P2 */ |
| 12406 | | -#define OP_IncrVacuum 67 |
| 12407 | | -#define OP_VNext 68 |
| 12408 | | -#define OP_Init 69 /* synopsis: Start at P2 */ |
| 12409 | | -#define OP_Return 70 |
| 12410 | | -#define OP_EndCoroutine 71 |
| 12411 | | -#define OP_HaltIfNull 72 /* synopsis: if r[P3]=null halt */ |
| 12412 | | -#define OP_Halt 73 |
| 12413 | | -#define OP_Integer 74 /* synopsis: r[P2]=P1 */ |
| 12414 | | -#define OP_Int64 75 /* synopsis: r[P2]=P4 */ |
| 12415 | | -#define OP_String 76 /* synopsis: r[P2]='P4' (len=P1) */ |
| 12416 | | -#define OP_Null 77 /* synopsis: r[P2..P3]=NULL */ |
| 12417 | | -#define OP_SoftNull 78 /* synopsis: r[P1]=NULL */ |
| 12418 | | -#define OP_Blob 79 /* synopsis: r[P2]=P4 (len=P1) */ |
| 12419 | | -#define OP_Variable 80 /* synopsis: r[P2]=parameter(P1,P4) */ |
| 12420 | | -#define OP_Move 81 /* synopsis: r[P2@P3]=r[P1@P3] */ |
| 12421 | | -#define OP_Copy 82 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ |
| 12422 | | -#define OP_SCopy 83 /* synopsis: r[P2]=r[P1] */ |
| 12423 | | -#define OP_IntCopy 84 /* synopsis: r[P2]=r[P1] */ |
| 12424 | | -#define OP_ResultRow 85 /* synopsis: output=r[P1@P2] */ |
| 12425 | | -#define OP_CollSeq 86 |
| 12426 | | -#define OP_Function0 87 /* synopsis: r[P3]=func(r[P2@P5]) */ |
| 12427 | | -#define OP_Function 88 /* synopsis: r[P3]=func(r[P2@P5]) */ |
| 12428 | | -#define OP_AddImm 89 /* synopsis: r[P1]=r[P1]+P2 */ |
| 12429 | | -#define OP_RealAffinity 90 |
| 12430 | | -#define OP_Cast 91 /* synopsis: affinity(r[P1]) */ |
| 12431 | | -#define OP_Permutation 92 |
| 12432 | | -#define OP_Compare 93 /* synopsis: r[P1@P3] <-> r[P2@P3] */ |
| 12433 | | -#define OP_Column 94 /* synopsis: r[P3]=PX */ |
| 12434 | | -#define OP_Affinity 95 /* synopsis: affinity(r[P1@P2]) */ |
| 12435 | | -#define OP_MakeRecord 96 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ |
| 12553 | +#define OP_Sort 55 |
| 12554 | +#define OP_Rewind 56 |
| 12555 | +#define OP_IdxLE 57 /* synopsis: key=r[P3@P4] */ |
| 12556 | +#define OP_IdxGT 58 /* synopsis: key=r[P3@P4] */ |
| 12557 | +#define OP_IdxLT 59 /* synopsis: key=r[P3@P4] */ |
| 12558 | +#define OP_IdxGE 60 /* synopsis: key=r[P3@P4] */ |
| 12559 | +#define OP_RowSetRead 61 /* synopsis: r[P3]=rowset(P1) */ |
| 12560 | +#define OP_RowSetTest 62 /* synopsis: if r[P3] in rowset(P1) goto P2 */ |
| 12561 | +#define OP_Program 63 |
| 12562 | +#define OP_FkIfZero 64 /* synopsis: if fkctr[P1]==0 goto P2 */ |
| 12563 | +#define OP_IfPos 65 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */ |
| 12564 | +#define OP_IfNotZero 66 /* synopsis: if r[P1]!=0 then r[P1]-=P3, goto P2 */ |
| 12565 | +#define OP_DecrJumpZero 67 /* synopsis: if (--r[P1])==0 goto P2 */ |
| 12566 | +#define OP_IncrVacuum 68 |
| 12567 | +#define OP_VNext 69 |
| 12568 | +#define OP_Init 70 /* synopsis: Start at P2 */ |
| 12569 | +#define OP_Return 71 |
| 12570 | +#define OP_EndCoroutine 72 |
| 12571 | +#define OP_HaltIfNull 73 /* synopsis: if r[P3]=null halt */ |
| 12572 | +#define OP_Halt 74 |
| 12573 | +#define OP_Integer 75 /* synopsis: r[P2]=P1 */ |
| 12574 | +#define OP_Int64 76 /* synopsis: r[P2]=P4 */ |
| 12575 | +#define OP_String 77 /* synopsis: r[P2]='P4' (len=P1) */ |
| 12576 | +#define OP_Null 78 /* synopsis: r[P2..P3]=NULL */ |
| 12577 | +#define OP_SoftNull 79 /* synopsis: r[P1]=NULL */ |
| 12578 | +#define OP_Blob 80 /* synopsis: r[P2]=P4 (len=P1) */ |
| 12579 | +#define OP_Variable 81 /* synopsis: r[P2]=parameter(P1,P4) */ |
| 12580 | +#define OP_Move 82 /* synopsis: r[P2@P3]=r[P1@P3] */ |
| 12581 | +#define OP_Copy 83 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ |
| 12582 | +#define OP_SCopy 84 /* synopsis: r[P2]=r[P1] */ |
| 12583 | +#define OP_IntCopy 85 /* synopsis: r[P2]=r[P1] */ |
| 12584 | +#define OP_ResultRow 86 /* synopsis: output=r[P1@P2] */ |
| 12585 | +#define OP_CollSeq 87 |
| 12586 | +#define OP_Function0 88 /* synopsis: r[P3]=func(r[P2@P5]) */ |
| 12587 | +#define OP_Function 89 /* synopsis: r[P3]=func(r[P2@P5]) */ |
| 12588 | +#define OP_AddImm 90 /* synopsis: r[P1]=r[P1]+P2 */ |
| 12589 | +#define OP_RealAffinity 91 |
| 12590 | +#define OP_Cast 92 /* synopsis: affinity(r[P1]) */ |
| 12591 | +#define OP_Permutation 93 |
| 12592 | +#define OP_Compare 94 /* synopsis: r[P1@P3] <-> r[P2@P3] */ |
| 12593 | +#define OP_Column 95 /* synopsis: r[P3]=PX */ |
| 12594 | +#define OP_Affinity 96 /* synopsis: affinity(r[P1@P2]) */ |
| 12436 | 12595 | #define OP_String8 97 /* same as TK_STRING, synopsis: r[P2]='P4' */ |
| 12437 | | -#define OP_Count 98 /* synopsis: r[P2]=count() */ |
| 12438 | | -#define OP_ReadCookie 99 |
| 12439 | | -#define OP_SetCookie 100 |
| 12440 | | -#define OP_ReopenIdx 101 /* synopsis: root=P2 iDb=P3 */ |
| 12441 | | -#define OP_OpenRead 102 /* synopsis: root=P2 iDb=P3 */ |
| 12442 | | -#define OP_OpenWrite 103 /* synopsis: root=P2 iDb=P3 */ |
| 12443 | | -#define OP_OpenAutoindex 104 /* synopsis: nColumn=P2 */ |
| 12444 | | -#define OP_OpenEphemeral 105 /* synopsis: nColumn=P2 */ |
| 12445 | | -#define OP_SorterOpen 106 |
| 12446 | | -#define OP_SequenceTest 107 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ |
| 12447 | | -#define OP_OpenPseudo 108 /* synopsis: P3 columns in r[P2] */ |
| 12448 | | -#define OP_Close 109 |
| 12449 | | -#define OP_ColumnsUsed 110 |
| 12450 | | -#define OP_Sequence 111 /* synopsis: r[P2]=cursor[P1].ctr++ */ |
| 12451 | | -#define OP_NewRowid 112 /* synopsis: r[P2]=rowid */ |
| 12452 | | -#define OP_Insert 113 /* synopsis: intkey=r[P3] data=r[P2] */ |
| 12453 | | -#define OP_InsertInt 114 /* synopsis: intkey=P3 data=r[P2] */ |
| 12454 | | -#define OP_Delete 115 |
| 12455 | | -#define OP_ResetCount 116 |
| 12456 | | -#define OP_SorterCompare 117 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ |
| 12457 | | -#define OP_SorterData 118 /* synopsis: r[P2]=data */ |
| 12458 | | -#define OP_RowKey 119 /* synopsis: r[P2]=key */ |
| 12459 | | -#define OP_RowData 120 /* synopsis: r[P2]=data */ |
| 12460 | | -#define OP_Rowid 121 /* synopsis: r[P2]=rowid */ |
| 12461 | | -#define OP_NullRow 122 |
| 12462 | | -#define OP_SorterInsert 123 |
| 12463 | | -#define OP_IdxInsert 124 /* synopsis: key=r[P2] */ |
| 12464 | | -#define OP_IdxDelete 125 /* synopsis: key=r[P2@P3] */ |
| 12465 | | -#define OP_Seek 126 /* synopsis: Move P3 to P1.rowid */ |
| 12466 | | -#define OP_IdxRowid 127 /* synopsis: r[P2]=rowid */ |
| 12467 | | -#define OP_Destroy 128 |
| 12468 | | -#define OP_Clear 129 |
| 12469 | | -#define OP_ResetSorter 130 |
| 12470 | | -#define OP_CreateIndex 131 /* synopsis: r[P2]=root iDb=P1 */ |
| 12471 | | -#define OP_CreateTable 132 /* synopsis: r[P2]=root iDb=P1 */ |
| 12596 | +#define OP_MakeRecord 98 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ |
| 12597 | +#define OP_Count 99 /* synopsis: r[P2]=count() */ |
| 12598 | +#define OP_ReadCookie 100 |
| 12599 | +#define OP_SetCookie 101 |
| 12600 | +#define OP_ReopenIdx 102 /* synopsis: root=P2 iDb=P3 */ |
| 12601 | +#define OP_OpenRead 103 /* synopsis: root=P2 iDb=P3 */ |
| 12602 | +#define OP_OpenWrite 104 /* synopsis: root=P2 iDb=P3 */ |
| 12603 | +#define OP_OpenAutoindex 105 /* synopsis: nColumn=P2 */ |
| 12604 | +#define OP_OpenEphemeral 106 /* synopsis: nColumn=P2 */ |
| 12605 | +#define OP_SorterOpen 107 |
| 12606 | +#define OP_SequenceTest 108 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ |
| 12607 | +#define OP_OpenPseudo 109 /* synopsis: P3 columns in r[P2] */ |
| 12608 | +#define OP_Close 110 |
| 12609 | +#define OP_ColumnsUsed 111 |
| 12610 | +#define OP_Sequence 112 /* synopsis: r[P2]=cursor[P1].ctr++ */ |
| 12611 | +#define OP_NewRowid 113 /* synopsis: r[P2]=rowid */ |
| 12612 | +#define OP_Insert 114 /* synopsis: intkey=r[P3] data=r[P2] */ |
| 12613 | +#define OP_InsertInt 115 /* synopsis: intkey=P3 data=r[P2] */ |
| 12614 | +#define OP_Delete 116 |
| 12615 | +#define OP_ResetCount 117 |
| 12616 | +#define OP_SorterCompare 118 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ |
| 12617 | +#define OP_SorterData 119 /* synopsis: r[P2]=data */ |
| 12618 | +#define OP_RowKey 120 /* synopsis: r[P2]=key */ |
| 12619 | +#define OP_RowData 121 /* synopsis: r[P2]=data */ |
| 12620 | +#define OP_Rowid 122 /* synopsis: r[P2]=rowid */ |
| 12621 | +#define OP_NullRow 123 |
| 12622 | +#define OP_SorterInsert 124 |
| 12623 | +#define OP_IdxInsert 125 /* synopsis: key=r[P2] */ |
| 12624 | +#define OP_IdxDelete 126 /* synopsis: key=r[P2@P3] */ |
| 12625 | +#define OP_Seek 127 /* synopsis: Move P3 to P1.rowid */ |
| 12626 | +#define OP_IdxRowid 128 /* synopsis: r[P2]=rowid */ |
| 12627 | +#define OP_Destroy 129 |
| 12628 | +#define OP_Clear 130 |
| 12629 | +#define OP_ResetSorter 131 |
| 12630 | +#define OP_CreateIndex 132 /* synopsis: r[P2]=root iDb=P1 */ |
| 12472 | 12631 | #define OP_Real 133 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ |
| 12473 | | -#define OP_ParseSchema 134 |
| 12474 | | -#define OP_LoadAnalysis 135 |
| 12475 | | -#define OP_DropTable 136 |
| 12476 | | -#define OP_DropIndex 137 |
| 12477 | | -#define OP_DropTrigger 138 |
| 12478 | | -#define OP_IntegrityCk 139 |
| 12479 | | -#define OP_RowSetAdd 140 /* synopsis: rowset(P1)=r[P2] */ |
| 12480 | | -#define OP_Param 141 |
| 12481 | | -#define OP_FkCounter 142 /* synopsis: fkctr[P1]+=P2 */ |
| 12482 | | -#define OP_MemMax 143 /* synopsis: r[P1]=max(r[P1],r[P2]) */ |
| 12483 | | -#define OP_OffsetLimit 144 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ |
| 12484 | | -#define OP_AggStep0 145 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 12485 | | -#define OP_AggStep 146 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 12486 | | -#define OP_AggFinal 147 /* synopsis: accum=r[P1] N=P2 */ |
| 12487 | | -#define OP_Expire 148 |
| 12488 | | -#define OP_TableLock 149 /* synopsis: iDb=P1 root=P2 write=P3 */ |
| 12489 | | -#define OP_VBegin 150 |
| 12490 | | -#define OP_VCreate 151 |
| 12491 | | -#define OP_VDestroy 152 |
| 12492 | | -#define OP_VOpen 153 |
| 12493 | | -#define OP_VColumn 154 /* synopsis: r[P3]=vcolumn(P2) */ |
| 12494 | | -#define OP_VRename 155 |
| 12495 | | -#define OP_Pagecount 156 |
| 12496 | | -#define OP_MaxPgcnt 157 |
| 12497 | | -#define OP_CursorHint 158 |
| 12498 | | -#define OP_Noop 159 |
| 12499 | | -#define OP_Explain 160 |
| 12632 | +#define OP_CreateTable 134 /* synopsis: r[P2]=root iDb=P1 */ |
| 12633 | +#define OP_ParseSchema 135 |
| 12634 | +#define OP_LoadAnalysis 136 |
| 12635 | +#define OP_DropTable 137 |
| 12636 | +#define OP_DropIndex 138 |
| 12637 | +#define OP_DropTrigger 139 |
| 12638 | +#define OP_IntegrityCk 140 |
| 12639 | +#define OP_RowSetAdd 141 /* synopsis: rowset(P1)=r[P2] */ |
| 12640 | +#define OP_Param 142 |
| 12641 | +#define OP_FkCounter 143 /* synopsis: fkctr[P1]+=P2 */ |
| 12642 | +#define OP_MemMax 144 /* synopsis: r[P1]=max(r[P1],r[P2]) */ |
| 12643 | +#define OP_OffsetLimit 145 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ |
| 12644 | +#define OP_AggStep0 146 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 12645 | +#define OP_AggStep 147 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 12646 | +#define OP_AggFinal 148 /* synopsis: accum=r[P1] N=P2 */ |
| 12647 | +#define OP_Expire 149 |
| 12648 | +#define OP_TableLock 150 /* synopsis: iDb=P1 root=P2 write=P3 */ |
| 12649 | +#define OP_VBegin 151 |
| 12650 | +#define OP_VCreate 152 |
| 12651 | +#define OP_VDestroy 153 |
| 12652 | +#define OP_VOpen 154 |
| 12653 | +#define OP_VColumn 155 /* synopsis: r[P3]=vcolumn(P2) */ |
| 12654 | +#define OP_VRename 156 |
| 12655 | +#define OP_Pagecount 157 |
| 12656 | +#define OP_MaxPgcnt 158 |
| 12657 | +#define OP_CursorHint 159 |
| 12658 | +#define OP_Noop 160 |
| 12659 | +#define OP_Explain 161 |
| 12500 | 12660 | |
| 12501 | 12661 | /* Properties such as "out2" or "jump" that are specified in |
| 12502 | 12662 | ** comments following the "case" for each opcode in the vdbe.c |
| 12503 | 12663 | ** are encoded into bitvectors as follows: |
| 12504 | 12664 | */ |
| | @@ -12511,35 +12671,35 @@ |
| 12511 | 12671 | #define OPFLG_INITIALIZER {\ |
| 12512 | 12672 | /* 0 */ 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01,\ |
| 12513 | 12673 | /* 8 */ 0x00, 0x10, 0x00, 0x01, 0x00, 0x01, 0x01, 0x01,\ |
| 12514 | 12674 | /* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0x03, 0x03, 0x09,\ |
| 12515 | 12675 | /* 24 */ 0x09, 0x09, 0x09, 0x26, 0x26, 0x09, 0x09, 0x09,\ |
| 12516 | | -/* 32 */ 0x09, 0x01, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ |
| 12676 | +/* 32 */ 0x09, 0x09, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ |
| 12517 | 12677 | /* 40 */ 0x0b, 0x0b, 0x01, 0x26, 0x26, 0x26, 0x26, 0x26,\ |
| 12518 | 12678 | /* 48 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x01, 0x12, 0x01,\ |
| 12519 | | -/* 56 */ 0x01, 0x01, 0x01, 0x01, 0x23, 0x0b, 0x01, 0x01,\ |
| 12520 | | -/* 64 */ 0x03, 0x03, 0x03, 0x01, 0x01, 0x01, 0x02, 0x02,\ |
| 12521 | | -/* 72 */ 0x08, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10,\ |
| 12522 | | -/* 80 */ 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00,\ |
| 12523 | | -/* 88 */ 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00,\ |
| 12524 | | -/* 96 */ 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,\ |
| 12525 | | -/* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\ |
| 12526 | | -/* 112 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 12527 | | -/* 120 */ 0x00, 0x10, 0x00, 0x04, 0x04, 0x00, 0x00, 0x10,\ |
| 12528 | | -/* 128 */ 0x10, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00,\ |
| 12529 | | -/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04,\ |
| 12530 | | -/* 144 */ 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 12531 | | -/* 152 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ |
| 12532 | | -/* 160 */ 0x00,} |
| 12679 | +/* 56 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x23, 0x0b, 0x01,\ |
| 12680 | +/* 64 */ 0x01, 0x03, 0x03, 0x03, 0x01, 0x01, 0x01, 0x02,\ |
| 12681 | +/* 72 */ 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00,\ |
| 12682 | +/* 80 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ |
| 12683 | +/* 88 */ 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00,\ |
| 12684 | +/* 96 */ 0x00, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00,\ |
| 12685 | +/* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 12686 | +/* 112 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 12687 | +/* 120 */ 0x00, 0x00, 0x10, 0x00, 0x04, 0x04, 0x00, 0x00,\ |
| 12688 | +/* 128 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00,\ |
| 12689 | +/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00,\ |
| 12690 | +/* 144 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 12691 | +/* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\ |
| 12692 | +/* 160 */ 0x00, 0x00,} |
| 12533 | 12693 | |
| 12534 | 12694 | /* The sqlite3P2Values() routine is able to run faster if it knows |
| 12535 | 12695 | ** the value of the largest JUMP opcode. The smaller the maximum |
| 12536 | 12696 | ** JUMP opcode the better, so the mkopcodeh.tcl script that |
| 12537 | 12697 | ** generated this include file strives to group all JUMP opcodes |
| 12538 | 12698 | ** together near the beginning of the list. |
| 12539 | 12699 | */ |
| 12540 | | -#define SQLITE_MX_JUMP_OPCODE 69 /* Maximum JUMP opcode */ |
| 12700 | +#define SQLITE_MX_JUMP_OPCODE 70 /* Maximum JUMP opcode */ |
| 12541 | 12701 | |
| 12542 | 12702 | /************** End of opcodes.h *********************************************/ |
| 12543 | 12703 | /************** Continuing where we left off in vdbe.h ***********************/ |
| 12544 | 12704 | |
| 12545 | 12705 | /* |
| | @@ -12682,11 +12842,11 @@ |
| 12682 | 12842 | SQLITE_PRIVATE void sqlite3VdbeScanStatus(Vdbe*, int, int, int, LogEst, const char*); |
| 12683 | 12843 | #else |
| 12684 | 12844 | # define sqlite3VdbeScanStatus(a,b,c,d,e) |
| 12685 | 12845 | #endif |
| 12686 | 12846 | |
| 12687 | | -#endif |
| 12847 | +#endif /* SQLITE_VDBE_H */ |
| 12688 | 12848 | |
| 12689 | 12849 | /************** End of vdbe.h ************************************************/ |
| 12690 | 12850 | /************** Continuing where we left off in sqliteInt.h ******************/ |
| 12691 | 12851 | /************** Include pager.h in the middle of sqliteInt.h *****************/ |
| 12692 | 12852 | /************** Begin file pager.h *******************************************/ |
| | @@ -12704,12 +12864,12 @@ |
| 12704 | 12864 | ** This header file defines the interface that the sqlite page cache |
| 12705 | 12865 | ** subsystem. The page cache subsystem reads and writes a file a page |
| 12706 | 12866 | ** at a time and provides a journal for rollback. |
| 12707 | 12867 | */ |
| 12708 | 12868 | |
| 12709 | | -#ifndef _PAGER_H_ |
| 12710 | | -#define _PAGER_H_ |
| 12869 | +#ifndef SQLITE_PAGER_H |
| 12870 | +#define SQLITE_PAGER_H |
| 12711 | 12871 | |
| 12712 | 12872 | /* |
| 12713 | 12873 | ** Default maximum size for persistent journal files. A negative |
| 12714 | 12874 | ** value means no limit. This value may be overridden using the |
| 12715 | 12875 | ** sqlite3PagerJournalSizeLimit() API. See also "PRAGMA journal_size_limit". |
| | @@ -12893,11 +13053,10 @@ |
| 12893 | 13053 | SQLITE_PRIVATE sqlite3_file *sqlite3PagerJrnlFile(Pager*); |
| 12894 | 13054 | SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager*); |
| 12895 | 13055 | SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*); |
| 12896 | 13056 | SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager*); |
| 12897 | 13057 | SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *, int, int, int *); |
| 12898 | | -SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *); |
| 12899 | 13058 | SQLITE_PRIVATE int sqlite3SectorSize(sqlite3_file *); |
| 12900 | 13059 | |
| 12901 | 13060 | /* Functions used to truncate the database file. */ |
| 12902 | 13061 | SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno); |
| 12903 | 13062 | |
| | @@ -12920,11 +13079,11 @@ |
| 12920 | 13079 | #else |
| 12921 | 13080 | # define disable_simulated_io_errors() |
| 12922 | 13081 | # define enable_simulated_io_errors() |
| 12923 | 13082 | #endif |
| 12924 | 13083 | |
| 12925 | | -#endif /* _PAGER_H_ */ |
| 13084 | +#endif /* SQLITE_PAGER_H */ |
| 12926 | 13085 | |
| 12927 | 13086 | /************** End of pager.h ***********************************************/ |
| 12928 | 13087 | /************** Continuing where we left off in sqliteInt.h ******************/ |
| 12929 | 13088 | /************** Include pcache.h in the middle of sqliteInt.h ****************/ |
| 12930 | 13089 | /************** Begin file pcache.h ******************************************/ |
| | @@ -13158,12 +13317,12 @@ |
| 13158 | 13317 | ****************************************************************************** |
| 13159 | 13318 | ** |
| 13160 | 13319 | ** This file contains pre-processor directives related to operating system |
| 13161 | 13320 | ** detection and/or setup. |
| 13162 | 13321 | */ |
| 13163 | | -#ifndef _OS_SETUP_H_ |
| 13164 | | -#define _OS_SETUP_H_ |
| 13322 | +#ifndef SQLITE_OS_SETUP_H |
| 13323 | +#define SQLITE_OS_SETUP_H |
| 13165 | 13324 | |
| 13166 | 13325 | /* |
| 13167 | 13326 | ** Figure out if we are dealing with Unix, Windows, or some other operating |
| 13168 | 13327 | ** system. |
| 13169 | 13328 | ** |
| | @@ -13199,11 +13358,11 @@ |
| 13199 | 13358 | # ifndef SQLITE_OS_WIN |
| 13200 | 13359 | # define SQLITE_OS_WIN 0 |
| 13201 | 13360 | # endif |
| 13202 | 13361 | #endif |
| 13203 | 13362 | |
| 13204 | | -#endif /* _OS_SETUP_H_ */ |
| 13363 | +#endif /* SQLITE_OS_SETUP_H */ |
| 13205 | 13364 | |
| 13206 | 13365 | /************** End of os_setup.h ********************************************/ |
| 13207 | 13366 | /************** Continuing where we left off in os.h *************************/ |
| 13208 | 13367 | |
| 13209 | 13368 | /* If the SET_FULLSYNC macro is not defined above, then make it |
| | @@ -13656,10 +13815,19 @@ |
| 13656 | 13815 | #else |
| 13657 | 13816 | typedef int (*sqlite3_xauth)(void*,int,const char*,const char*,const char*, |
| 13658 | 13817 | const char*); |
| 13659 | 13818 | #endif |
| 13660 | 13819 | |
| 13820 | +#ifndef SQLITE_OMIT_DEPRECATED |
| 13821 | +/* This is an extra SQLITE_TRACE macro that indicates "legacy" tracing |
| 13822 | +** in the style of sqlite3_trace() |
| 13823 | +*/ |
| 13824 | +#define SQLITE_TRACE_LEGACY 0x80 |
| 13825 | +#else |
| 13826 | +#define SQLITE_TRACE_LEGACY 0 |
| 13827 | +#endif /* SQLITE_OMIT_DEPRECATED */ |
| 13828 | + |
| 13661 | 13829 | |
| 13662 | 13830 | /* |
| 13663 | 13831 | ** Each database connection is an instance of the following structure. |
| 13664 | 13832 | */ |
| 13665 | 13833 | struct sqlite3 { |
| | @@ -13685,10 +13853,11 @@ |
| 13685 | 13853 | u8 dfltLockMode; /* Default locking-mode for attached dbs */ |
| 13686 | 13854 | signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */ |
| 13687 | 13855 | u8 suppressErr; /* Do not issue error messages if true */ |
| 13688 | 13856 | u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */ |
| 13689 | 13857 | u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */ |
| 13858 | + u8 mTrace; /* zero or more SQLITE_TRACE flags */ |
| 13690 | 13859 | int nextPagesize; /* Pagesize after VACUUM if >0 */ |
| 13691 | 13860 | u32 magic; /* Magic number for detect library misuse */ |
| 13692 | 13861 | int nChange; /* Value returned by sqlite3_changes() */ |
| 13693 | 13862 | int nTotalChange; /* Value returned by sqlite3_total_changes() */ |
| 13694 | 13863 | int aLimit[SQLITE_N_LIMIT]; /* Limits */ |
| | @@ -13705,11 +13874,11 @@ |
| 13705 | 13874 | int nVdbeWrite; /* Number of active VDBEs that read and write */ |
| 13706 | 13875 | int nVdbeExec; /* Number of nested calls to VdbeExec() */ |
| 13707 | 13876 | int nVDestroy; /* Number of active OP_VDestroy operations */ |
| 13708 | 13877 | int nExtension; /* Number of loaded extensions */ |
| 13709 | 13878 | void **aExtension; /* Array of shared library handles */ |
| 13710 | | - void (*xTrace)(void*,const char*); /* Trace function */ |
| 13879 | + int (*xTrace)(u32,void*,void*,void*); /* Trace function */ |
| 13711 | 13880 | void *pTraceArg; /* Argument to the trace function */ |
| 13712 | 13881 | void (*xProfile)(void*,const char*,u64); /* Profiling function */ |
| 13713 | 13882 | void *pProfileArg; /* Argument to profile function */ |
| 13714 | 13883 | void *pCommitArg; /* Argument to xCommitCallback() */ |
| 13715 | 13884 | int (*xCommitCallback)(void*); /* Invoked at every commit. */ |
| | @@ -14900,11 +15069,11 @@ |
| 14900 | 15069 | Select *pSelect; /* A SELECT statement used in place of a table name */ |
| 14901 | 15070 | int addrFillSub; /* Address of subroutine to manifest a subquery */ |
| 14902 | 15071 | int regReturn; /* Register holding return address of addrFillSub */ |
| 14903 | 15072 | int regResult; /* Registers holding results of a co-routine */ |
| 14904 | 15073 | struct { |
| 14905 | | - u8 jointype; /* Type of join between this able and the previous */ |
| 15074 | + u8 jointype; /* Type of join between this table and the previous */ |
| 14906 | 15075 | unsigned notIndexed :1; /* True if there is a NOT INDEXED clause */ |
| 14907 | 15076 | unsigned isIndexedBy :1; /* True if there is an INDEXED BY clause */ |
| 14908 | 15077 | unsigned isTabFunc :1; /* True if table-valued-function syntax */ |
| 14909 | 15078 | unsigned isCorrelated :1; /* True if sub-query is correlated */ |
| 14910 | 15079 | unsigned viaCoroutine :1; /* Implemented as a co-routine */ |
| | @@ -14946,23 +15115,24 @@ |
| 14946 | 15115 | */ |
| 14947 | 15116 | #define WHERE_ORDERBY_NORMAL 0x0000 /* No-op */ |
| 14948 | 15117 | #define WHERE_ORDERBY_MIN 0x0001 /* ORDER BY processing for min() func */ |
| 14949 | 15118 | #define WHERE_ORDERBY_MAX 0x0002 /* ORDER BY processing for max() func */ |
| 14950 | 15119 | #define WHERE_ONEPASS_DESIRED 0x0004 /* Want to do one-pass UPDATE/DELETE */ |
| 14951 | | -#define WHERE_DUPLICATES_OK 0x0008 /* Ok to return a row more than once */ |
| 14952 | | -#define WHERE_OMIT_OPEN_CLOSE 0x0010 /* Table cursors are already open */ |
| 14953 | | -#define WHERE_FORCE_TABLE 0x0020 /* Do not use an index-only search */ |
| 14954 | | -#define WHERE_ONETABLE_ONLY 0x0040 /* Only code the 1st table in pTabList */ |
| 14955 | | -#define WHERE_NO_AUTOINDEX 0x0080 /* Disallow automatic indexes */ |
| 14956 | | -#define WHERE_GROUPBY 0x0100 /* pOrderBy is really a GROUP BY */ |
| 14957 | | -#define WHERE_DISTINCTBY 0x0200 /* pOrderby is really a DISTINCT clause */ |
| 14958 | | -#define WHERE_WANT_DISTINCT 0x0400 /* All output needs to be distinct */ |
| 14959 | | -#define WHERE_SORTBYGROUP 0x0800 /* Support sqlite3WhereIsSorted() */ |
| 14960 | | -#define WHERE_REOPEN_IDX 0x1000 /* Try to use OP_ReopenIdx */ |
| 14961 | | -#define WHERE_ONEPASS_MULTIROW 0x2000 /* ONEPASS is ok with multiple rows */ |
| 14962 | | -#define WHERE_USE_LIMIT 0x4000 /* There is a constant LIMIT clause */ |
| 14963 | | -#define WHERE_SEEK_TABLE 0x8000 /* Do not defer seeks on main table */ |
| 15120 | +#define WHERE_ONEPASS_MULTIROW 0x0008 /* ONEPASS is ok with multiple rows */ |
| 15121 | +#define WHERE_DUPLICATES_OK 0x0010 /* Ok to return a row more than once */ |
| 15122 | +#define WHERE_OR_SUBCLAUSE 0x0020 /* Processing a sub-WHERE as part of |
| 15123 | + ** the OR optimization */ |
| 15124 | +#define WHERE_GROUPBY 0x0040 /* pOrderBy is really a GROUP BY */ |
| 15125 | +#define WHERE_DISTINCTBY 0x0080 /* pOrderby is really a DISTINCT clause */ |
| 15126 | +#define WHERE_WANT_DISTINCT 0x0100 /* All output needs to be distinct */ |
| 15127 | +#define WHERE_SORTBYGROUP 0x0200 /* Support sqlite3WhereIsSorted() */ |
| 15128 | +#define WHERE_SEEK_TABLE 0x0400 /* Do not defer seeks on main table */ |
| 15129 | +#define WHERE_ORDERBY_LIMIT 0x0800 /* ORDERBY+LIMIT on the inner loop */ |
| 15130 | + /* 0x1000 not currently used */ |
| 15131 | + /* 0x2000 not currently used */ |
| 15132 | +#define WHERE_USE_LIMIT 0x4000 /* Use the LIMIT in cost estimates */ |
| 15133 | + /* 0x8000 not currently used */ |
| 14964 | 15134 | |
| 14965 | 15135 | /* Allowed return values from sqlite3WhereIsDistinct() |
| 14966 | 15136 | */ |
| 14967 | 15137 | #define WHERE_DISTINCT_NOOP 0 /* DISTINCT keyword not used */ |
| 14968 | 15138 | #define WHERE_DISTINCT_UNIQUE 1 /* No duplicates */ |
| | @@ -16031,12 +16201,12 @@ |
| 16031 | 16201 | SQLITE_PRIVATE void sqlite3SrcListShiftJoinType(SrcList*); |
| 16032 | 16202 | SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse*, SrcList*); |
| 16033 | 16203 | SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3*, IdList*); |
| 16034 | 16204 | SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3*, SrcList*); |
| 16035 | 16205 | SQLITE_PRIVATE Index *sqlite3AllocateIndexObject(sqlite3*,i16,int,char**); |
| 16036 | | -SQLITE_PRIVATE Index *sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*, |
| 16037 | | - Expr*, int, int); |
| 16206 | +SQLITE_PRIVATE void sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*, |
| 16207 | + Expr*, int, int, u8); |
| 16038 | 16208 | SQLITE_PRIVATE void sqlite3DropIndex(Parse*, SrcList*, int); |
| 16039 | 16209 | SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*); |
| 16040 | 16210 | SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*, |
| 16041 | 16211 | Expr*,ExprList*,u32,Expr*,Expr*); |
| 16042 | 16212 | SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*); |
| | @@ -16051,10 +16221,11 @@ |
| 16051 | 16221 | SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int); |
| 16052 | 16222 | SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*); |
| 16053 | 16223 | SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo*); |
| 16054 | 16224 | SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*); |
| 16055 | 16225 | SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo*); |
| 16226 | +SQLITE_PRIVATE int sqlite3WhereOrderedInnerLoop(WhereInfo*); |
| 16056 | 16227 | SQLITE_PRIVATE int sqlite3WhereIsSorted(WhereInfo*); |
| 16057 | 16228 | SQLITE_PRIVATE int sqlite3WhereContinueLabel(WhereInfo*); |
| 16058 | 16229 | SQLITE_PRIVATE int sqlite3WhereBreakLabel(WhereInfo*); |
| 16059 | 16230 | SQLITE_PRIVATE int sqlite3WhereOkOnePass(WhereInfo*, int*); |
| 16060 | 16231 | #define ONEPASS_OFF 0 /* Use of ONEPASS not allowed */ |
| | @@ -16084,12 +16255,14 @@ |
| 16084 | 16255 | #define SQLITE_ECEL_REF 0x04 /* Use ExprList.u.x.iOrderByCol */ |
| 16085 | 16256 | SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse*, Expr*, int, int); |
| 16086 | 16257 | SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse*, Expr*, int, int); |
| 16087 | 16258 | SQLITE_PRIVATE void sqlite3ExprIfFalseDup(Parse*, Expr*, int, int); |
| 16088 | 16259 | SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3*,const char*, const char*); |
| 16089 | | -SQLITE_PRIVATE Table *sqlite3LocateTable(Parse*,int isView,const char*, const char*); |
| 16090 | | -SQLITE_PRIVATE Table *sqlite3LocateTableItem(Parse*,int isView,struct SrcList_item *); |
| 16260 | +#define LOCATE_VIEW 0x01 |
| 16261 | +#define LOCATE_NOERR 0x02 |
| 16262 | +SQLITE_PRIVATE Table *sqlite3LocateTable(Parse*,u32 flags,const char*, const char*); |
| 16263 | +SQLITE_PRIVATE Table *sqlite3LocateTableItem(Parse*,u32 flags,struct SrcList_item *); |
| 16091 | 16264 | SQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3*,const char*, const char*); |
| 16092 | 16265 | SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*); |
| 16093 | 16266 | SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*); |
| 16094 | 16267 | SQLITE_PRIVATE void sqlite3Vacuum(Parse*); |
| 16095 | 16268 | SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*); |
| | @@ -16648,11 +16821,11 @@ |
| 16648 | 16821 | |
| 16649 | 16822 | #if defined(SQLITE_ENABLE_DBSTAT_VTAB) || defined(SQLITE_TEST) |
| 16650 | 16823 | SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3*); |
| 16651 | 16824 | #endif |
| 16652 | 16825 | |
| 16653 | | -#endif /* _SQLITEINT_H_ */ |
| 16826 | +#endif /* SQLITEINT_H */ |
| 16654 | 16827 | |
| 16655 | 16828 | /************** End of sqliteInt.h *******************************************/ |
| 16656 | 16829 | /************** Begin file global.c ******************************************/ |
| 16657 | 16830 | /* |
| 16658 | 16831 | ** 2008 June 13 |
| | @@ -16983,10 +17156,17 @@ |
| 16983 | 17156 | "CASE_SENSITIVE_LIKE", |
| 16984 | 17157 | #endif |
| 16985 | 17158 | #if SQLITE_CHECK_PAGES |
| 16986 | 17159 | "CHECK_PAGES", |
| 16987 | 17160 | #endif |
| 17161 | +#if defined(__clang__) && defined(__clang_version__) |
| 17162 | + "COMPILER=clang-" __clang_version__, |
| 17163 | +#elif defined(_MSC_VER) |
| 17164 | + "COMPILER=msvc-" CTIMEOPT_VAL(_MSC_VER), |
| 17165 | +#elif defined(__GNUC__) && defined(__VERSION__) |
| 17166 | + "COMPILER=gcc-" __VERSION__, |
| 17167 | +#endif |
| 16988 | 17168 | #if SQLITE_COVERAGE_TEST |
| 16989 | 17169 | "COVERAGE_TEST", |
| 16990 | 17170 | #endif |
| 16991 | 17171 | #if SQLITE_DEBUG |
| 16992 | 17172 | "DEBUG", |
| | @@ -17002,11 +17182,11 @@ |
| 17002 | 17182 | #endif |
| 17003 | 17183 | #if SQLITE_DISABLE_LFS |
| 17004 | 17184 | "DISABLE_LFS", |
| 17005 | 17185 | #endif |
| 17006 | 17186 | #if SQLITE_ENABLE_8_3_NAMES |
| 17007 | | - "ENABLE_8_3_NAMES", |
| 17187 | + "ENABLE_8_3_NAMES=" CTIMEOPT_VAL(SQLITE_ENABLE_8_3_NAMES), |
| 17008 | 17188 | #endif |
| 17009 | 17189 | #if SQLITE_ENABLE_API_ARMOR |
| 17010 | 17190 | "ENABLE_API_ARMOR", |
| 17011 | 17191 | #endif |
| 17012 | 17192 | #if SQLITE_ENABLE_ATOMIC_WRITE |
| | @@ -17416,12 +17596,12 @@ |
| 17416 | 17596 | ** VDBE. This information used to all be at the top of the single |
| 17417 | 17597 | ** source code file "vdbe.c". When that file became too big (over |
| 17418 | 17598 | ** 6000 lines long) it was split up into several smaller files and |
| 17419 | 17599 | ** this header information was factored out. |
| 17420 | 17600 | */ |
| 17421 | | -#ifndef _VDBEINT_H_ |
| 17422 | | -#define _VDBEINT_H_ |
| 17601 | +#ifndef SQLITE_VDBEINT_H |
| 17602 | +#define SQLITE_VDBEINT_H |
| 17423 | 17603 | |
| 17424 | 17604 | /* |
| 17425 | 17605 | ** The maximum number of times that a statement will try to reparse |
| 17426 | 17606 | ** itself before giving up and returning SQLITE_SCHEMA. |
| 17427 | 17607 | */ |
| | @@ -17959,11 +18139,11 @@ |
| 17959 | 18139 | #else |
| 17960 | 18140 | #define sqlite3VdbeMemExpandBlob(x) SQLITE_OK |
| 17961 | 18141 | #define ExpandBlob(P) SQLITE_OK |
| 17962 | 18142 | #endif |
| 17963 | 18143 | |
| 17964 | | -#endif /* !defined(_VDBEINT_H_) */ |
| 18144 | +#endif /* !defined(SQLITE_VDBEINT_H) */ |
| 17965 | 18145 | |
| 17966 | 18146 | /************** End of vdbeInt.h *********************************************/ |
| 17967 | 18147 | /************** Continuing where we left off in status.c *********************/ |
| 17968 | 18148 | |
| 17969 | 18149 | /* |
| | @@ -18167,19 +18347,24 @@ |
| 18167 | 18347 | /* |
| 18168 | 18348 | ** Return an approximation for the amount of memory currently used |
| 18169 | 18349 | ** by all pagers associated with the given database connection. The |
| 18170 | 18350 | ** highwater mark is meaningless and is returned as zero. |
| 18171 | 18351 | */ |
| 18352 | + case SQLITE_DBSTATUS_CACHE_USED_SHARED: |
| 18172 | 18353 | case SQLITE_DBSTATUS_CACHE_USED: { |
| 18173 | 18354 | int totalUsed = 0; |
| 18174 | 18355 | int i; |
| 18175 | 18356 | sqlite3BtreeEnterAll(db); |
| 18176 | 18357 | for(i=0; i<db->nDb; i++){ |
| 18177 | 18358 | Btree *pBt = db->aDb[i].pBt; |
| 18178 | 18359 | if( pBt ){ |
| 18179 | 18360 | Pager *pPager = sqlite3BtreePager(pBt); |
| 18180 | | - totalUsed += sqlite3PagerMemUsed(pPager); |
| 18361 | + int nByte = sqlite3PagerMemUsed(pPager); |
| 18362 | + if( op==SQLITE_DBSTATUS_CACHE_USED_SHARED ){ |
| 18363 | + nByte = nByte / sqlite3BtreeConnectionCount(pBt); |
| 18364 | + } |
| 18365 | + totalUsed += nByte; |
| 18181 | 18366 | } |
| 18182 | 18367 | } |
| 18183 | 18368 | sqlite3BtreeLeaveAll(db); |
| 18184 | 18369 | *pCurrent = totalUsed; |
| 18185 | 18370 | *pHighwater = 0; |
| | @@ -19478,13 +19663,11 @@ |
| 19478 | 19663 | ****************************************************************************** |
| 19479 | 19664 | ** |
| 19480 | 19665 | ** This file contains OS interface code that is common to all |
| 19481 | 19666 | ** architectures. |
| 19482 | 19667 | */ |
| 19483 | | -#define _SQLITE_OS_C_ 1 |
| 19484 | 19668 | /* #include "sqliteInt.h" */ |
| 19485 | | -#undef _SQLITE_OS_C_ |
| 19486 | 19669 | |
| 19487 | 19670 | /* |
| 19488 | 19671 | ** If we compile with the SQLITE_TEST macro set, then the following block |
| 19489 | 19672 | ** of code will give us the ability to simulate a disk I/O error. This |
| 19490 | 19673 | ** is used for testing the I/O recovery logic. |
| | @@ -22993,12 +23176,12 @@ |
| 22993 | 23176 | ****************************************************************************** |
| 22994 | 23177 | ** |
| 22995 | 23178 | ** This file contains inline asm code for retrieving "high-performance" |
| 22996 | 23179 | ** counters for x86 class CPUs. |
| 22997 | 23180 | */ |
| 22998 | | -#ifndef _HWTIME_H_ |
| 22999 | | -#define _HWTIME_H_ |
| 23181 | +#ifndef SQLITE_HWTIME_H |
| 23182 | +#define SQLITE_HWTIME_H |
| 23000 | 23183 | |
| 23001 | 23184 | /* |
| 23002 | 23185 | ** The following routine only works on pentium-class (or newer) processors. |
| 23003 | 23186 | ** It uses the RDTSC opcode to read the cycle count value out of the |
| 23004 | 23187 | ** processor and returns that value. This can be used for high-res |
| | @@ -23062,11 +23245,11 @@ |
| 23062 | 23245 | */ |
| 23063 | 23246 | SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } |
| 23064 | 23247 | |
| 23065 | 23248 | #endif |
| 23066 | 23249 | |
| 23067 | | -#endif /* !defined(_HWTIME_H_) */ |
| 23250 | +#endif /* !defined(SQLITE_HWTIME_H) */ |
| 23068 | 23251 | |
| 23069 | 23252 | /************** End of hwtime.h **********************************************/ |
| 23070 | 23253 | /************** Continuing where we left off in os_common.h ******************/ |
| 23071 | 23254 | |
| 23072 | 23255 | static sqlite_uint64 g_start; |
| | @@ -23152,12 +23335,12 @@ |
| 23152 | 23335 | ** |
| 23153 | 23336 | ****************************************************************************** |
| 23154 | 23337 | ** |
| 23155 | 23338 | ** This file contains code that is specific to Windows. |
| 23156 | 23339 | */ |
| 23157 | | -#ifndef _OS_WIN_H_ |
| 23158 | | -#define _OS_WIN_H_ |
| 23340 | +#ifndef SQLITE_OS_WIN_H |
| 23341 | +#define SQLITE_OS_WIN_H |
| 23159 | 23342 | |
| 23160 | 23343 | /* |
| 23161 | 23344 | ** Include the primary Windows SDK header file. |
| 23162 | 23345 | */ |
| 23163 | 23346 | #include "windows.h" |
| | @@ -23225,11 +23408,11 @@ |
| 23225 | 23408 | # define SQLITE_OS_WIN_THREADS 1 |
| 23226 | 23409 | #else |
| 23227 | 23410 | # define SQLITE_OS_WIN_THREADS 0 |
| 23228 | 23411 | #endif |
| 23229 | 23412 | |
| 23230 | | -#endif /* _OS_WIN_H_ */ |
| 23413 | +#endif /* SQLITE_OS_WIN_H */ |
| 23231 | 23414 | |
| 23232 | 23415 | /************** End of os_win.h **********************************************/ |
| 23233 | 23416 | /************** Continuing where we left off in mutex_w32.c ******************/ |
| 23234 | 23417 | #endif |
| 23235 | 23418 | |
| | @@ -25976,10 +26159,16 @@ |
| 25976 | 26159 | } |
| 25977 | 26160 | sqlite3TreeViewLine(pView, "RAISE %s(%Q)", zType, pExpr->u.zToken); |
| 25978 | 26161 | break; |
| 25979 | 26162 | } |
| 25980 | 26163 | #endif |
| 26164 | + case TK_MATCH: { |
| 26165 | + sqlite3TreeViewLine(pView, "MATCH {%d:%d}%s", |
| 26166 | + pExpr->iTable, pExpr->iColumn, zFlgs); |
| 26167 | + sqlite3TreeViewExpr(pView, pExpr->pRight, 0); |
| 26168 | + break; |
| 26169 | + } |
| 25981 | 26170 | default: { |
| 25982 | 26171 | sqlite3TreeViewLine(pView, "op=%d", pExpr->op); |
| 25983 | 26172 | break; |
| 25984 | 26173 | } |
| 25985 | 26174 | } |
| | @@ -28759,21 +28948,21 @@ |
| 28759 | 28948 | /* 27 */ "Or" OpHelp("r[P3]=(r[P1] || r[P2])"), |
| 28760 | 28949 | /* 28 */ "And" OpHelp("r[P3]=(r[P1] && r[P2])"), |
| 28761 | 28950 | /* 29 */ "NoConflict" OpHelp("key=r[P3@P4]"), |
| 28762 | 28951 | /* 30 */ "NotFound" OpHelp("key=r[P3@P4]"), |
| 28763 | 28952 | /* 31 */ "Found" OpHelp("key=r[P3@P4]"), |
| 28764 | | - /* 32 */ "NotExists" OpHelp("intkey=r[P3]"), |
| 28765 | | - /* 33 */ "Last" OpHelp(""), |
| 28953 | + /* 32 */ "SeekRowid" OpHelp("intkey=r[P3]"), |
| 28954 | + /* 33 */ "NotExists" OpHelp("intkey=r[P3]"), |
| 28766 | 28955 | /* 34 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"), |
| 28767 | 28956 | /* 35 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"), |
| 28768 | 28957 | /* 36 */ "Ne" OpHelp("if r[P1]!=r[P3] goto P2"), |
| 28769 | 28958 | /* 37 */ "Eq" OpHelp("if r[P1]==r[P3] goto P2"), |
| 28770 | 28959 | /* 38 */ "Gt" OpHelp("if r[P1]>r[P3] goto P2"), |
| 28771 | 28960 | /* 39 */ "Le" OpHelp("if r[P1]<=r[P3] goto P2"), |
| 28772 | 28961 | /* 40 */ "Lt" OpHelp("if r[P1]<r[P3] goto P2"), |
| 28773 | 28962 | /* 41 */ "Ge" OpHelp("if r[P1]>=r[P3] goto P2"), |
| 28774 | | - /* 42 */ "SorterSort" OpHelp(""), |
| 28963 | + /* 42 */ "Last" OpHelp(""), |
| 28775 | 28964 | /* 43 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"), |
| 28776 | 28965 | /* 44 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"), |
| 28777 | 28966 | /* 45 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"), |
| 28778 | 28967 | /* 46 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"), |
| 28779 | 28968 | /* 47 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"), |
| | @@ -28780,118 +28969,119 @@ |
| 28780 | 28969 | /* 48 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"), |
| 28781 | 28970 | /* 49 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"), |
| 28782 | 28971 | /* 50 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"), |
| 28783 | 28972 | /* 51 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"), |
| 28784 | 28973 | /* 52 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"), |
| 28785 | | - /* 53 */ "Sort" OpHelp(""), |
| 28974 | + /* 53 */ "SorterSort" OpHelp(""), |
| 28786 | 28975 | /* 54 */ "BitNot" OpHelp("r[P1]= ~r[P1]"), |
| 28787 | | - /* 55 */ "Rewind" OpHelp(""), |
| 28788 | | - /* 56 */ "IdxLE" OpHelp("key=r[P3@P4]"), |
| 28789 | | - /* 57 */ "IdxGT" OpHelp("key=r[P3@P4]"), |
| 28790 | | - /* 58 */ "IdxLT" OpHelp("key=r[P3@P4]"), |
| 28791 | | - /* 59 */ "IdxGE" OpHelp("key=r[P3@P4]"), |
| 28792 | | - /* 60 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"), |
| 28793 | | - /* 61 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"), |
| 28794 | | - /* 62 */ "Program" OpHelp(""), |
| 28795 | | - /* 63 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"), |
| 28796 | | - /* 64 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"), |
| 28797 | | - /* 65 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]-=P3, goto P2"), |
| 28798 | | - /* 66 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"), |
| 28799 | | - /* 67 */ "IncrVacuum" OpHelp(""), |
| 28800 | | - /* 68 */ "VNext" OpHelp(""), |
| 28801 | | - /* 69 */ "Init" OpHelp("Start at P2"), |
| 28802 | | - /* 70 */ "Return" OpHelp(""), |
| 28803 | | - /* 71 */ "EndCoroutine" OpHelp(""), |
| 28804 | | - /* 72 */ "HaltIfNull" OpHelp("if r[P3]=null halt"), |
| 28805 | | - /* 73 */ "Halt" OpHelp(""), |
| 28806 | | - /* 74 */ "Integer" OpHelp("r[P2]=P1"), |
| 28807 | | - /* 75 */ "Int64" OpHelp("r[P2]=P4"), |
| 28808 | | - /* 76 */ "String" OpHelp("r[P2]='P4' (len=P1)"), |
| 28809 | | - /* 77 */ "Null" OpHelp("r[P2..P3]=NULL"), |
| 28810 | | - /* 78 */ "SoftNull" OpHelp("r[P1]=NULL"), |
| 28811 | | - /* 79 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), |
| 28812 | | - /* 80 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), |
| 28813 | | - /* 81 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), |
| 28814 | | - /* 82 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), |
| 28815 | | - /* 83 */ "SCopy" OpHelp("r[P2]=r[P1]"), |
| 28816 | | - /* 84 */ "IntCopy" OpHelp("r[P2]=r[P1]"), |
| 28817 | | - /* 85 */ "ResultRow" OpHelp("output=r[P1@P2]"), |
| 28818 | | - /* 86 */ "CollSeq" OpHelp(""), |
| 28819 | | - /* 87 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"), |
| 28820 | | - /* 88 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"), |
| 28821 | | - /* 89 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), |
| 28822 | | - /* 90 */ "RealAffinity" OpHelp(""), |
| 28823 | | - /* 91 */ "Cast" OpHelp("affinity(r[P1])"), |
| 28824 | | - /* 92 */ "Permutation" OpHelp(""), |
| 28825 | | - /* 93 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), |
| 28826 | | - /* 94 */ "Column" OpHelp("r[P3]=PX"), |
| 28827 | | - /* 95 */ "Affinity" OpHelp("affinity(r[P1@P2])"), |
| 28828 | | - /* 96 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), |
| 28976 | + /* 55 */ "Sort" OpHelp(""), |
| 28977 | + /* 56 */ "Rewind" OpHelp(""), |
| 28978 | + /* 57 */ "IdxLE" OpHelp("key=r[P3@P4]"), |
| 28979 | + /* 58 */ "IdxGT" OpHelp("key=r[P3@P4]"), |
| 28980 | + /* 59 */ "IdxLT" OpHelp("key=r[P3@P4]"), |
| 28981 | + /* 60 */ "IdxGE" OpHelp("key=r[P3@P4]"), |
| 28982 | + /* 61 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"), |
| 28983 | + /* 62 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"), |
| 28984 | + /* 63 */ "Program" OpHelp(""), |
| 28985 | + /* 64 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"), |
| 28986 | + /* 65 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"), |
| 28987 | + /* 66 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]-=P3, goto P2"), |
| 28988 | + /* 67 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"), |
| 28989 | + /* 68 */ "IncrVacuum" OpHelp(""), |
| 28990 | + /* 69 */ "VNext" OpHelp(""), |
| 28991 | + /* 70 */ "Init" OpHelp("Start at P2"), |
| 28992 | + /* 71 */ "Return" OpHelp(""), |
| 28993 | + /* 72 */ "EndCoroutine" OpHelp(""), |
| 28994 | + /* 73 */ "HaltIfNull" OpHelp("if r[P3]=null halt"), |
| 28995 | + /* 74 */ "Halt" OpHelp(""), |
| 28996 | + /* 75 */ "Integer" OpHelp("r[P2]=P1"), |
| 28997 | + /* 76 */ "Int64" OpHelp("r[P2]=P4"), |
| 28998 | + /* 77 */ "String" OpHelp("r[P2]='P4' (len=P1)"), |
| 28999 | + /* 78 */ "Null" OpHelp("r[P2..P3]=NULL"), |
| 29000 | + /* 79 */ "SoftNull" OpHelp("r[P1]=NULL"), |
| 29001 | + /* 80 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), |
| 29002 | + /* 81 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), |
| 29003 | + /* 82 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), |
| 29004 | + /* 83 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), |
| 29005 | + /* 84 */ "SCopy" OpHelp("r[P2]=r[P1]"), |
| 29006 | + /* 85 */ "IntCopy" OpHelp("r[P2]=r[P1]"), |
| 29007 | + /* 86 */ "ResultRow" OpHelp("output=r[P1@P2]"), |
| 29008 | + /* 87 */ "CollSeq" OpHelp(""), |
| 29009 | + /* 88 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"), |
| 29010 | + /* 89 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"), |
| 29011 | + /* 90 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), |
| 29012 | + /* 91 */ "RealAffinity" OpHelp(""), |
| 29013 | + /* 92 */ "Cast" OpHelp("affinity(r[P1])"), |
| 29014 | + /* 93 */ "Permutation" OpHelp(""), |
| 29015 | + /* 94 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), |
| 29016 | + /* 95 */ "Column" OpHelp("r[P3]=PX"), |
| 29017 | + /* 96 */ "Affinity" OpHelp("affinity(r[P1@P2])"), |
| 28829 | 29018 | /* 97 */ "String8" OpHelp("r[P2]='P4'"), |
| 28830 | | - /* 98 */ "Count" OpHelp("r[P2]=count()"), |
| 28831 | | - /* 99 */ "ReadCookie" OpHelp(""), |
| 28832 | | - /* 100 */ "SetCookie" OpHelp(""), |
| 28833 | | - /* 101 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), |
| 28834 | | - /* 102 */ "OpenRead" OpHelp("root=P2 iDb=P3"), |
| 28835 | | - /* 103 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), |
| 28836 | | - /* 104 */ "OpenAutoindex" OpHelp("nColumn=P2"), |
| 28837 | | - /* 105 */ "OpenEphemeral" OpHelp("nColumn=P2"), |
| 28838 | | - /* 106 */ "SorterOpen" OpHelp(""), |
| 28839 | | - /* 107 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), |
| 28840 | | - /* 108 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"), |
| 28841 | | - /* 109 */ "Close" OpHelp(""), |
| 28842 | | - /* 110 */ "ColumnsUsed" OpHelp(""), |
| 28843 | | - /* 111 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), |
| 28844 | | - /* 112 */ "NewRowid" OpHelp("r[P2]=rowid"), |
| 28845 | | - /* 113 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), |
| 28846 | | - /* 114 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"), |
| 28847 | | - /* 115 */ "Delete" OpHelp(""), |
| 28848 | | - /* 116 */ "ResetCount" OpHelp(""), |
| 28849 | | - /* 117 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), |
| 28850 | | - /* 118 */ "SorterData" OpHelp("r[P2]=data"), |
| 28851 | | - /* 119 */ "RowKey" OpHelp("r[P2]=key"), |
| 28852 | | - /* 120 */ "RowData" OpHelp("r[P2]=data"), |
| 28853 | | - /* 121 */ "Rowid" OpHelp("r[P2]=rowid"), |
| 28854 | | - /* 122 */ "NullRow" OpHelp(""), |
| 28855 | | - /* 123 */ "SorterInsert" OpHelp(""), |
| 28856 | | - /* 124 */ "IdxInsert" OpHelp("key=r[P2]"), |
| 28857 | | - /* 125 */ "IdxDelete" OpHelp("key=r[P2@P3]"), |
| 28858 | | - /* 126 */ "Seek" OpHelp("Move P3 to P1.rowid"), |
| 28859 | | - /* 127 */ "IdxRowid" OpHelp("r[P2]=rowid"), |
| 28860 | | - /* 128 */ "Destroy" OpHelp(""), |
| 28861 | | - /* 129 */ "Clear" OpHelp(""), |
| 28862 | | - /* 130 */ "ResetSorter" OpHelp(""), |
| 28863 | | - /* 131 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"), |
| 28864 | | - /* 132 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"), |
| 29019 | + /* 98 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), |
| 29020 | + /* 99 */ "Count" OpHelp("r[P2]=count()"), |
| 29021 | + /* 100 */ "ReadCookie" OpHelp(""), |
| 29022 | + /* 101 */ "SetCookie" OpHelp(""), |
| 29023 | + /* 102 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), |
| 29024 | + /* 103 */ "OpenRead" OpHelp("root=P2 iDb=P3"), |
| 29025 | + /* 104 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), |
| 29026 | + /* 105 */ "OpenAutoindex" OpHelp("nColumn=P2"), |
| 29027 | + /* 106 */ "OpenEphemeral" OpHelp("nColumn=P2"), |
| 29028 | + /* 107 */ "SorterOpen" OpHelp(""), |
| 29029 | + /* 108 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), |
| 29030 | + /* 109 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"), |
| 29031 | + /* 110 */ "Close" OpHelp(""), |
| 29032 | + /* 111 */ "ColumnsUsed" OpHelp(""), |
| 29033 | + /* 112 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), |
| 29034 | + /* 113 */ "NewRowid" OpHelp("r[P2]=rowid"), |
| 29035 | + /* 114 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), |
| 29036 | + /* 115 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"), |
| 29037 | + /* 116 */ "Delete" OpHelp(""), |
| 29038 | + /* 117 */ "ResetCount" OpHelp(""), |
| 29039 | + /* 118 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), |
| 29040 | + /* 119 */ "SorterData" OpHelp("r[P2]=data"), |
| 29041 | + /* 120 */ "RowKey" OpHelp("r[P2]=key"), |
| 29042 | + /* 121 */ "RowData" OpHelp("r[P2]=data"), |
| 29043 | + /* 122 */ "Rowid" OpHelp("r[P2]=rowid"), |
| 29044 | + /* 123 */ "NullRow" OpHelp(""), |
| 29045 | + /* 124 */ "SorterInsert" OpHelp(""), |
| 29046 | + /* 125 */ "IdxInsert" OpHelp("key=r[P2]"), |
| 29047 | + /* 126 */ "IdxDelete" OpHelp("key=r[P2@P3]"), |
| 29048 | + /* 127 */ "Seek" OpHelp("Move P3 to P1.rowid"), |
| 29049 | + /* 128 */ "IdxRowid" OpHelp("r[P2]=rowid"), |
| 29050 | + /* 129 */ "Destroy" OpHelp(""), |
| 29051 | + /* 130 */ "Clear" OpHelp(""), |
| 29052 | + /* 131 */ "ResetSorter" OpHelp(""), |
| 29053 | + /* 132 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"), |
| 28865 | 29054 | /* 133 */ "Real" OpHelp("r[P2]=P4"), |
| 28866 | | - /* 134 */ "ParseSchema" OpHelp(""), |
| 28867 | | - /* 135 */ "LoadAnalysis" OpHelp(""), |
| 28868 | | - /* 136 */ "DropTable" OpHelp(""), |
| 28869 | | - /* 137 */ "DropIndex" OpHelp(""), |
| 28870 | | - /* 138 */ "DropTrigger" OpHelp(""), |
| 28871 | | - /* 139 */ "IntegrityCk" OpHelp(""), |
| 28872 | | - /* 140 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), |
| 28873 | | - /* 141 */ "Param" OpHelp(""), |
| 28874 | | - /* 142 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), |
| 28875 | | - /* 143 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), |
| 28876 | | - /* 144 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), |
| 28877 | | - /* 145 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 28878 | | - /* 146 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 28879 | | - /* 147 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), |
| 28880 | | - /* 148 */ "Expire" OpHelp(""), |
| 28881 | | - /* 149 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), |
| 28882 | | - /* 150 */ "VBegin" OpHelp(""), |
| 28883 | | - /* 151 */ "VCreate" OpHelp(""), |
| 28884 | | - /* 152 */ "VDestroy" OpHelp(""), |
| 28885 | | - /* 153 */ "VOpen" OpHelp(""), |
| 28886 | | - /* 154 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), |
| 28887 | | - /* 155 */ "VRename" OpHelp(""), |
| 28888 | | - /* 156 */ "Pagecount" OpHelp(""), |
| 28889 | | - /* 157 */ "MaxPgcnt" OpHelp(""), |
| 28890 | | - /* 158 */ "CursorHint" OpHelp(""), |
| 28891 | | - /* 159 */ "Noop" OpHelp(""), |
| 28892 | | - /* 160 */ "Explain" OpHelp(""), |
| 29055 | + /* 134 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"), |
| 29056 | + /* 135 */ "ParseSchema" OpHelp(""), |
| 29057 | + /* 136 */ "LoadAnalysis" OpHelp(""), |
| 29058 | + /* 137 */ "DropTable" OpHelp(""), |
| 29059 | + /* 138 */ "DropIndex" OpHelp(""), |
| 29060 | + /* 139 */ "DropTrigger" OpHelp(""), |
| 29061 | + /* 140 */ "IntegrityCk" OpHelp(""), |
| 29062 | + /* 141 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), |
| 29063 | + /* 142 */ "Param" OpHelp(""), |
| 29064 | + /* 143 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), |
| 29065 | + /* 144 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), |
| 29066 | + /* 145 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), |
| 29067 | + /* 146 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 29068 | + /* 147 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 29069 | + /* 148 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), |
| 29070 | + /* 149 */ "Expire" OpHelp(""), |
| 29071 | + /* 150 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), |
| 29072 | + /* 151 */ "VBegin" OpHelp(""), |
| 29073 | + /* 152 */ "VCreate" OpHelp(""), |
| 29074 | + /* 153 */ "VDestroy" OpHelp(""), |
| 29075 | + /* 154 */ "VOpen" OpHelp(""), |
| 29076 | + /* 155 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), |
| 29077 | + /* 156 */ "VRename" OpHelp(""), |
| 29078 | + /* 157 */ "Pagecount" OpHelp(""), |
| 29079 | + /* 158 */ "MaxPgcnt" OpHelp(""), |
| 29080 | + /* 159 */ "CursorHint" OpHelp(""), |
| 29081 | + /* 160 */ "Noop" OpHelp(""), |
| 29082 | + /* 161 */ "Explain" OpHelp(""), |
| 28893 | 29083 | }; |
| 28894 | 29084 | return azName[i]; |
| 28895 | 29085 | } |
| 28896 | 29086 | #endif |
| 28897 | 29087 | |
| | @@ -29237,12 +29427,12 @@ |
| 29237 | 29427 | ****************************************************************************** |
| 29238 | 29428 | ** |
| 29239 | 29429 | ** This file contains inline asm code for retrieving "high-performance" |
| 29240 | 29430 | ** counters for x86 class CPUs. |
| 29241 | 29431 | */ |
| 29242 | | -#ifndef _HWTIME_H_ |
| 29243 | | -#define _HWTIME_H_ |
| 29432 | +#ifndef SQLITE_HWTIME_H |
| 29433 | +#define SQLITE_HWTIME_H |
| 29244 | 29434 | |
| 29245 | 29435 | /* |
| 29246 | 29436 | ** The following routine only works on pentium-class (or newer) processors. |
| 29247 | 29437 | ** It uses the RDTSC opcode to read the cycle count value out of the |
| 29248 | 29438 | ** processor and returns that value. This can be used for high-res |
| | @@ -29306,11 +29496,11 @@ |
| 29306 | 29496 | */ |
| 29307 | 29497 | SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } |
| 29308 | 29498 | |
| 29309 | 29499 | #endif |
| 29310 | 29500 | |
| 29311 | | -#endif /* !defined(_HWTIME_H_) */ |
| 29501 | +#endif /* !defined(SQLITE_HWTIME_H) */ |
| 29312 | 29502 | |
| 29313 | 29503 | /************** End of hwtime.h **********************************************/ |
| 29314 | 29504 | /************** Continuing where we left off in os_common.h ******************/ |
| 29315 | 29505 | |
| 29316 | 29506 | static sqlite_uint64 g_start; |
| | @@ -36766,12 +36956,12 @@ |
| 36766 | 36956 | ****************************************************************************** |
| 36767 | 36957 | ** |
| 36768 | 36958 | ** This file contains inline asm code for retrieving "high-performance" |
| 36769 | 36959 | ** counters for x86 class CPUs. |
| 36770 | 36960 | */ |
| 36771 | | -#ifndef _HWTIME_H_ |
| 36772 | | -#define _HWTIME_H_ |
| 36961 | +#ifndef SQLITE_HWTIME_H |
| 36962 | +#define SQLITE_HWTIME_H |
| 36773 | 36963 | |
| 36774 | 36964 | /* |
| 36775 | 36965 | ** The following routine only works on pentium-class (or newer) processors. |
| 36776 | 36966 | ** It uses the RDTSC opcode to read the cycle count value out of the |
| 36777 | 36967 | ** processor and returns that value. This can be used for high-res |
| | @@ -36835,11 +37025,11 @@ |
| 36835 | 37025 | */ |
| 36836 | 37026 | SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } |
| 36837 | 37027 | |
| 36838 | 37028 | #endif |
| 36839 | 37029 | |
| 36840 | | -#endif /* !defined(_HWTIME_H_) */ |
| 37030 | +#endif /* !defined(SQLITE_HWTIME_H) */ |
| 36841 | 37031 | |
| 36842 | 37032 | /************** End of hwtime.h **********************************************/ |
| 36843 | 37033 | /************** Continuing where we left off in os_common.h ******************/ |
| 36844 | 37034 | |
| 36845 | 37035 | static sqlite_uint64 g_start; |
| | @@ -37175,10 +37365,21 @@ |
| 37175 | 37365 | sqlite3_int64 mmapSize; /* Usable size of mapped region */ |
| 37176 | 37366 | sqlite3_int64 mmapSizeActual; /* Actual size of mapped region */ |
| 37177 | 37367 | sqlite3_int64 mmapSizeMax; /* Configured FCNTL_MMAP_SIZE value */ |
| 37178 | 37368 | #endif |
| 37179 | 37369 | }; |
| 37370 | + |
| 37371 | +/* |
| 37372 | +** The winVfsAppData structure is used for the pAppData member for all of the |
| 37373 | +** Win32 VFS variants. |
| 37374 | +*/ |
| 37375 | +typedef struct winVfsAppData winVfsAppData; |
| 37376 | +struct winVfsAppData { |
| 37377 | + const sqlite3_io_methods *pMethod; /* The file I/O methods to use. */ |
| 37378 | + void *pAppData; /* The extra pAppData, if any. */ |
| 37379 | + BOOL bNoLock; /* Non-zero if locking is disabled. */ |
| 37380 | +}; |
| 37180 | 37381 | |
| 37181 | 37382 | /* |
| 37182 | 37383 | ** Allowed values for winFile.ctrlFlags |
| 37183 | 37384 | */ |
| 37184 | 37385 | #define WINFILE_RDONLY 0x02 /* Connection is read only */ |
| | @@ -39497,11 +39698,16 @@ |
| 39497 | 39698 | rc = osCloseHandle(pFile->h); |
| 39498 | 39699 | /* SimulateIOError( rc=0; cnt=MX_CLOSE_ATTEMPT; ); */ |
| 39499 | 39700 | }while( rc==0 && ++cnt < MX_CLOSE_ATTEMPT && (sqlite3_win32_sleep(100), 1) ); |
| 39500 | 39701 | #if SQLITE_OS_WINCE |
| 39501 | 39702 | #define WINCE_DELETION_ATTEMPTS 3 |
| 39502 | | - winceDestroyLock(pFile); |
| 39703 | + { |
| 39704 | + winVfsAppData *pAppData = (winVfsAppData*)pFile->pVfs->pAppData; |
| 39705 | + if( pAppData==NULL || !pAppData->bNoLock ){ |
| 39706 | + winceDestroyLock(pFile); |
| 39707 | + } |
| 39708 | + } |
| 39503 | 39709 | if( pFile->zDeleteOnClose ){ |
| 39504 | 39710 | int cnt = 0; |
| 39505 | 39711 | while( |
| 39506 | 39712 | osDeleteFileW(pFile->zDeleteOnClose)==0 |
| 39507 | 39713 | && osGetFileAttributesW(pFile->zDeleteOnClose)!=0xffffffff |
| | @@ -40229,10 +40435,48 @@ |
| 40229 | 40435 | OSTRACE(("UNLOCK file=%p, lock=%d, rc=%s\n", |
| 40230 | 40436 | pFile->h, pFile->locktype, sqlite3ErrName(rc))); |
| 40231 | 40437 | return rc; |
| 40232 | 40438 | } |
| 40233 | 40439 | |
| 40440 | +/****************************************************************************** |
| 40441 | +****************************** No-op Locking ********************************** |
| 40442 | +** |
| 40443 | +** Of the various locking implementations available, this is by far the |
| 40444 | +** simplest: locking is ignored. No attempt is made to lock the database |
| 40445 | +** file for reading or writing. |
| 40446 | +** |
| 40447 | +** This locking mode is appropriate for use on read-only databases |
| 40448 | +** (ex: databases that are burned into CD-ROM, for example.) It can |
| 40449 | +** also be used if the application employs some external mechanism to |
| 40450 | +** prevent simultaneous access of the same database by two or more |
| 40451 | +** database connections. But there is a serious risk of database |
| 40452 | +** corruption if this locking mode is used in situations where multiple |
| 40453 | +** database connections are accessing the same database file at the same |
| 40454 | +** time and one or more of those connections are writing. |
| 40455 | +*/ |
| 40456 | + |
| 40457 | +static int winNolockLock(sqlite3_file *id, int locktype){ |
| 40458 | + UNUSED_PARAMETER(id); |
| 40459 | + UNUSED_PARAMETER(locktype); |
| 40460 | + return SQLITE_OK; |
| 40461 | +} |
| 40462 | + |
| 40463 | +static int winNolockCheckReservedLock(sqlite3_file *id, int *pResOut){ |
| 40464 | + UNUSED_PARAMETER(id); |
| 40465 | + UNUSED_PARAMETER(pResOut); |
| 40466 | + return SQLITE_OK; |
| 40467 | +} |
| 40468 | + |
| 40469 | +static int winNolockUnlock(sqlite3_file *id, int locktype){ |
| 40470 | + UNUSED_PARAMETER(id); |
| 40471 | + UNUSED_PARAMETER(locktype); |
| 40472 | + return SQLITE_OK; |
| 40473 | +} |
| 40474 | + |
| 40475 | +/******************* End of the no-op lock implementation ********************* |
| 40476 | +******************************************************************************/ |
| 40477 | + |
| 40234 | 40478 | /* |
| 40235 | 40479 | ** If *pArg is initially negative then this is a query. Set *pArg to |
| 40236 | 40480 | ** 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set. |
| 40237 | 40481 | ** |
| 40238 | 40482 | ** If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags. |
| | @@ -40507,16 +40751,16 @@ |
| 40507 | 40751 | #define WIN_SHM_DMS (WIN_SHM_BASE+SQLITE_SHM_NLOCK) /* deadman switch */ |
| 40508 | 40752 | |
| 40509 | 40753 | /* |
| 40510 | 40754 | ** Apply advisory locks for all n bytes beginning at ofst. |
| 40511 | 40755 | */ |
| 40512 | | -#define _SHM_UNLCK 1 |
| 40513 | | -#define _SHM_RDLCK 2 |
| 40514 | | -#define _SHM_WRLCK 3 |
| 40756 | +#define WINSHM_UNLCK 1 |
| 40757 | +#define WINSHM_RDLCK 2 |
| 40758 | +#define WINSHM_WRLCK 3 |
| 40515 | 40759 | static int winShmSystemLock( |
| 40516 | 40760 | winShmNode *pFile, /* Apply locks to this open shared-memory segment */ |
| 40517 | | - int lockType, /* _SHM_UNLCK, _SHM_RDLCK, or _SHM_WRLCK */ |
| 40761 | + int lockType, /* WINSHM_UNLCK, WINSHM_RDLCK, or WINSHM_WRLCK */ |
| 40518 | 40762 | int ofst, /* Offset to first byte to be locked/unlocked */ |
| 40519 | 40763 | int nByte /* Number of bytes to lock or unlock */ |
| 40520 | 40764 | ){ |
| 40521 | 40765 | int rc = 0; /* Result code form Lock/UnlockFileEx() */ |
| 40522 | 40766 | |
| | @@ -40525,16 +40769,16 @@ |
| 40525 | 40769 | |
| 40526 | 40770 | OSTRACE(("SHM-LOCK file=%p, lock=%d, offset=%d, size=%d\n", |
| 40527 | 40771 | pFile->hFile.h, lockType, ofst, nByte)); |
| 40528 | 40772 | |
| 40529 | 40773 | /* Release/Acquire the system-level lock */ |
| 40530 | | - if( lockType==_SHM_UNLCK ){ |
| 40774 | + if( lockType==WINSHM_UNLCK ){ |
| 40531 | 40775 | rc = winUnlockFile(&pFile->hFile.h, ofst, 0, nByte, 0); |
| 40532 | 40776 | }else{ |
| 40533 | 40777 | /* Initialize the locking parameters */ |
| 40534 | 40778 | DWORD dwFlags = LOCKFILE_FAIL_IMMEDIATELY; |
| 40535 | | - if( lockType == _SHM_WRLCK ) dwFlags |= LOCKFILE_EXCLUSIVE_LOCK; |
| 40779 | + if( lockType == WINSHM_WRLCK ) dwFlags |= LOCKFILE_EXCLUSIVE_LOCK; |
| 40536 | 40780 | rc = winLockFile(&pFile->hFile.h, dwFlags, ofst, 0, nByte, 0); |
| 40537 | 40781 | } |
| 40538 | 40782 | |
| 40539 | 40783 | if( rc!= 0 ){ |
| 40540 | 40784 | rc = SQLITE_OK; |
| | @@ -40542,11 +40786,11 @@ |
| 40542 | 40786 | pFile->lastErrno = osGetLastError(); |
| 40543 | 40787 | rc = SQLITE_BUSY; |
| 40544 | 40788 | } |
| 40545 | 40789 | |
| 40546 | 40790 | OSTRACE(("SHM-LOCK file=%p, func=%s, errno=%lu, rc=%s\n", |
| 40547 | | - pFile->hFile.h, (lockType == _SHM_UNLCK) ? "winUnlockFile" : |
| 40791 | + pFile->hFile.h, (lockType == WINSHM_UNLCK) ? "winUnlockFile" : |
| 40548 | 40792 | "winLockFile", pFile->lastErrno, sqlite3ErrName(rc))); |
| 40549 | 40793 | |
| 40550 | 40794 | return rc; |
| 40551 | 40795 | } |
| 40552 | 40796 | |
| | @@ -40670,20 +40914,20 @@ |
| 40670 | 40914 | } |
| 40671 | 40915 | |
| 40672 | 40916 | /* Check to see if another process is holding the dead-man switch. |
| 40673 | 40917 | ** If not, truncate the file to zero length. |
| 40674 | 40918 | */ |
| 40675 | | - if( winShmSystemLock(pShmNode, _SHM_WRLCK, WIN_SHM_DMS, 1)==SQLITE_OK ){ |
| 40919 | + if( winShmSystemLock(pShmNode, WINSHM_WRLCK, WIN_SHM_DMS, 1)==SQLITE_OK ){ |
| 40676 | 40920 | rc = winTruncate((sqlite3_file *)&pShmNode->hFile, 0); |
| 40677 | 40921 | if( rc!=SQLITE_OK ){ |
| 40678 | 40922 | rc = winLogError(SQLITE_IOERR_SHMOPEN, osGetLastError(), |
| 40679 | 40923 | "winOpenShm", pDbFd->zPath); |
| 40680 | 40924 | } |
| 40681 | 40925 | } |
| 40682 | 40926 | if( rc==SQLITE_OK ){ |
| 40683 | | - winShmSystemLock(pShmNode, _SHM_UNLCK, WIN_SHM_DMS, 1); |
| 40684 | | - rc = winShmSystemLock(pShmNode, _SHM_RDLCK, WIN_SHM_DMS, 1); |
| 40927 | + winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1); |
| 40928 | + rc = winShmSystemLock(pShmNode, WINSHM_RDLCK, WIN_SHM_DMS, 1); |
| 40685 | 40929 | } |
| 40686 | 40930 | if( rc ) goto shm_open_err; |
| 40687 | 40931 | } |
| 40688 | 40932 | |
| 40689 | 40933 | /* Make the new connection a child of the winShmNode */ |
| | @@ -40708,11 +40952,11 @@ |
| 40708 | 40952 | sqlite3_mutex_leave(pShmNode->mutex); |
| 40709 | 40953 | return SQLITE_OK; |
| 40710 | 40954 | |
| 40711 | 40955 | /* Jump here on any error */ |
| 40712 | 40956 | shm_open_err: |
| 40713 | | - winShmSystemLock(pShmNode, _SHM_UNLCK, WIN_SHM_DMS, 1); |
| 40957 | + winShmSystemLock(pShmNode, WINSHM_UNLCK, WIN_SHM_DMS, 1); |
| 40714 | 40958 | winShmPurge(pDbFd->pVfs, 0); /* This call frees pShmNode if required */ |
| 40715 | 40959 | sqlite3_free(p); |
| 40716 | 40960 | sqlite3_free(pNew); |
| 40717 | 40961 | winShmLeaveMutex(); |
| 40718 | 40962 | return rc; |
| | @@ -40797,11 +41041,11 @@ |
| 40797 | 41041 | allMask |= pX->sharedMask; |
| 40798 | 41042 | } |
| 40799 | 41043 | |
| 40800 | 41044 | /* Unlock the system-level locks */ |
| 40801 | 41045 | if( (mask & allMask)==0 ){ |
| 40802 | | - rc = winShmSystemLock(pShmNode, _SHM_UNLCK, ofst+WIN_SHM_BASE, n); |
| 41046 | + rc = winShmSystemLock(pShmNode, WINSHM_UNLCK, ofst+WIN_SHM_BASE, n); |
| 40803 | 41047 | }else{ |
| 40804 | 41048 | rc = SQLITE_OK; |
| 40805 | 41049 | } |
| 40806 | 41050 | |
| 40807 | 41051 | /* Undo the local locks */ |
| | @@ -40825,11 +41069,11 @@ |
| 40825 | 41069 | } |
| 40826 | 41070 | |
| 40827 | 41071 | /* Get shared locks at the system level, if necessary */ |
| 40828 | 41072 | if( rc==SQLITE_OK ){ |
| 40829 | 41073 | if( (allShared & mask)==0 ){ |
| 40830 | | - rc = winShmSystemLock(pShmNode, _SHM_RDLCK, ofst+WIN_SHM_BASE, n); |
| 41074 | + rc = winShmSystemLock(pShmNode, WINSHM_RDLCK, ofst+WIN_SHM_BASE, n); |
| 40831 | 41075 | }else{ |
| 40832 | 41076 | rc = SQLITE_OK; |
| 40833 | 41077 | } |
| 40834 | 41078 | } |
| 40835 | 41079 | |
| | @@ -40850,11 +41094,11 @@ |
| 40850 | 41094 | |
| 40851 | 41095 | /* Get the exclusive locks at the system level. Then if successful |
| 40852 | 41096 | ** also mark the local connection as being locked. |
| 40853 | 41097 | */ |
| 40854 | 41098 | if( rc==SQLITE_OK ){ |
| 40855 | | - rc = winShmSystemLock(pShmNode, _SHM_WRLCK, ofst+WIN_SHM_BASE, n); |
| 41099 | + rc = winShmSystemLock(pShmNode, WINSHM_WRLCK, ofst+WIN_SHM_BASE, n); |
| 40856 | 41100 | if( rc==SQLITE_OK ){ |
| 40857 | 41101 | assert( (p->sharedMask & mask)==0 ); |
| 40858 | 41102 | p->exclMask |= mask; |
| 40859 | 41103 | } |
| 40860 | 41104 | } |
| | @@ -41292,10 +41536,48 @@ |
| 41292 | 41536 | winShmBarrier, /* xShmBarrier */ |
| 41293 | 41537 | winShmUnmap, /* xShmUnmap */ |
| 41294 | 41538 | winFetch, /* xFetch */ |
| 41295 | 41539 | winUnfetch /* xUnfetch */ |
| 41296 | 41540 | }; |
| 41541 | + |
| 41542 | +/* |
| 41543 | +** This vector defines all the methods that can operate on an |
| 41544 | +** sqlite3_file for win32 without performing any locking. |
| 41545 | +*/ |
| 41546 | +static const sqlite3_io_methods winIoNolockMethod = { |
| 41547 | + 3, /* iVersion */ |
| 41548 | + winClose, /* xClose */ |
| 41549 | + winRead, /* xRead */ |
| 41550 | + winWrite, /* xWrite */ |
| 41551 | + winTruncate, /* xTruncate */ |
| 41552 | + winSync, /* xSync */ |
| 41553 | + winFileSize, /* xFileSize */ |
| 41554 | + winNolockLock, /* xLock */ |
| 41555 | + winNolockUnlock, /* xUnlock */ |
| 41556 | + winNolockCheckReservedLock, /* xCheckReservedLock */ |
| 41557 | + winFileControl, /* xFileControl */ |
| 41558 | + winSectorSize, /* xSectorSize */ |
| 41559 | + winDeviceCharacteristics, /* xDeviceCharacteristics */ |
| 41560 | + winShmMap, /* xShmMap */ |
| 41561 | + winShmLock, /* xShmLock */ |
| 41562 | + winShmBarrier, /* xShmBarrier */ |
| 41563 | + winShmUnmap, /* xShmUnmap */ |
| 41564 | + winFetch, /* xFetch */ |
| 41565 | + winUnfetch /* xUnfetch */ |
| 41566 | +}; |
| 41567 | + |
| 41568 | +static winVfsAppData winAppData = { |
| 41569 | + &winIoMethod, /* pMethod */ |
| 41570 | + 0, /* pAppData */ |
| 41571 | + 0 /* bNoLock */ |
| 41572 | +}; |
| 41573 | + |
| 41574 | +static winVfsAppData winNolockAppData = { |
| 41575 | + &winIoNolockMethod, /* pMethod */ |
| 41576 | + 0, /* pAppData */ |
| 41577 | + 1 /* bNoLock */ |
| 41578 | +}; |
| 41297 | 41579 | |
| 41298 | 41580 | /**************************************************************************** |
| 41299 | 41581 | **************************** sqlite3_vfs methods **************************** |
| 41300 | 41582 | ** |
| 41301 | 41583 | ** This division contains the implementation of methods on the |
| | @@ -41625,11 +41907,11 @@ |
| 41625 | 41907 | |
| 41626 | 41908 | /* |
| 41627 | 41909 | ** Open a file. |
| 41628 | 41910 | */ |
| 41629 | 41911 | static int winOpen( |
| 41630 | | - sqlite3_vfs *pVfs, /* Used to get maximum path name length */ |
| 41912 | + sqlite3_vfs *pVfs, /* Used to get maximum path length and AppData */ |
| 41631 | 41913 | const char *zName, /* Name of the file (UTF-8) */ |
| 41632 | 41914 | sqlite3_file *id, /* Write the SQLite file handle here */ |
| 41633 | 41915 | int flags, /* Open mode flags */ |
| 41634 | 41916 | int *pOutFlags /* Status return flags */ |
| 41635 | 41917 | ){ |
| | @@ -41640,10 +41922,11 @@ |
| 41640 | 41922 | DWORD dwCreationDisposition; |
| 41641 | 41923 | DWORD dwFlagsAndAttributes = 0; |
| 41642 | 41924 | #if SQLITE_OS_WINCE |
| 41643 | 41925 | int isTemp = 0; |
| 41644 | 41926 | #endif |
| 41927 | + winVfsAppData *pAppData; |
| 41645 | 41928 | winFile *pFile = (winFile*)id; |
| 41646 | 41929 | void *zConverted; /* Filename in OS encoding */ |
| 41647 | 41930 | const char *zUtf8Name = zName; /* Filename in UTF-8 encoding */ |
| 41648 | 41931 | int cnt = 0; |
| 41649 | 41932 | |
| | @@ -41861,19 +42144,24 @@ |
| 41861 | 42144 | |
| 41862 | 42145 | OSTRACE(("OPEN file=%p, name=%s, access=%lx, pOutFlags=%p, *pOutFlags=%d, " |
| 41863 | 42146 | "rc=%s\n", h, zUtf8Name, dwDesiredAccess, pOutFlags, pOutFlags ? |
| 41864 | 42147 | *pOutFlags : 0, (h==INVALID_HANDLE_VALUE) ? "failed" : "ok")); |
| 41865 | 42148 | |
| 42149 | + pAppData = (winVfsAppData*)pVfs->pAppData; |
| 42150 | + |
| 41866 | 42151 | #if SQLITE_OS_WINCE |
| 41867 | | - if( isReadWrite && eType==SQLITE_OPEN_MAIN_DB |
| 41868 | | - && (rc = winceCreateLock(zName, pFile))!=SQLITE_OK |
| 41869 | | - ){ |
| 41870 | | - osCloseHandle(h); |
| 41871 | | - sqlite3_free(zConverted); |
| 41872 | | - sqlite3_free(zTmpname); |
| 41873 | | - OSTRACE(("OPEN-CE-LOCK name=%s, rc=%s\n", zName, sqlite3ErrName(rc))); |
| 41874 | | - return rc; |
| 42152 | + { |
| 42153 | + if( isReadWrite && eType==SQLITE_OPEN_MAIN_DB |
| 42154 | + && ((pAppData==NULL) || !pAppData->bNoLock) |
| 42155 | + && (rc = winceCreateLock(zName, pFile))!=SQLITE_OK |
| 42156 | + ){ |
| 42157 | + osCloseHandle(h); |
| 42158 | + sqlite3_free(zConverted); |
| 42159 | + sqlite3_free(zTmpname); |
| 42160 | + OSTRACE(("OPEN-CE-LOCK name=%s, rc=%s\n", zName, sqlite3ErrName(rc))); |
| 42161 | + return rc; |
| 42162 | + } |
| 41875 | 42163 | } |
| 41876 | 42164 | if( isTemp ){ |
| 41877 | 42165 | pFile->zDeleteOnClose = zConverted; |
| 41878 | 42166 | }else |
| 41879 | 42167 | #endif |
| | @@ -41880,11 +42168,11 @@ |
| 41880 | 42168 | { |
| 41881 | 42169 | sqlite3_free(zConverted); |
| 41882 | 42170 | } |
| 41883 | 42171 | |
| 41884 | 42172 | sqlite3_free(zTmpname); |
| 41885 | | - pFile->pMethod = &winIoMethod; |
| 42173 | + pFile->pMethod = pAppData ? pAppData->pMethod : &winIoMethod; |
| 41886 | 42174 | pFile->pVfs = pVfs; |
| 41887 | 42175 | pFile->h = h; |
| 41888 | 42176 | if( isReadonly ){ |
| 41889 | 42177 | pFile->ctrlFlags |= WINFILE_RDONLY; |
| 41890 | 42178 | } |
| | @@ -42155,10 +42443,22 @@ |
| 42155 | 42443 | sqlite3_vfs *pVfs, /* Pointer to vfs object */ |
| 42156 | 42444 | const char *zRelative, /* Possibly relative input path */ |
| 42157 | 42445 | int nFull, /* Size of output buffer in bytes */ |
| 42158 | 42446 | char *zFull /* Output buffer */ |
| 42159 | 42447 | ){ |
| 42448 | +#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__) |
| 42449 | + DWORD nByte; |
| 42450 | + void *zConverted; |
| 42451 | + char *zOut; |
| 42452 | +#endif |
| 42453 | + |
| 42454 | + /* If this path name begins with "/X:", where "X" is any alphabetic |
| 42455 | + ** character, discard the initial "/" from the pathname. |
| 42456 | + */ |
| 42457 | + if( zRelative[0]=='/' && winIsDriveLetterAndColon(zRelative+1) ){ |
| 42458 | + zRelative++; |
| 42459 | + } |
| 42160 | 42460 | |
| 42161 | 42461 | #if defined(__CYGWIN__) |
| 42162 | 42462 | SimulateIOError( return SQLITE_ERROR ); |
| 42163 | 42463 | UNUSED_PARAMETER(nFull); |
| 42164 | 42464 | assert( nFull>=pVfs->mxPathname ); |
| | @@ -42233,21 +42533,10 @@ |
| 42233 | 42533 | } |
| 42234 | 42534 | return SQLITE_OK; |
| 42235 | 42535 | #endif |
| 42236 | 42536 | |
| 42237 | 42537 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__) |
| 42238 | | - DWORD nByte; |
| 42239 | | - void *zConverted; |
| 42240 | | - char *zOut; |
| 42241 | | - |
| 42242 | | - /* If this path name begins with "/X:", where "X" is any alphabetic |
| 42243 | | - ** character, discard the initial "/" from the pathname. |
| 42244 | | - */ |
| 42245 | | - if( zRelative[0]=='/' && winIsDriveLetterAndColon(zRelative+1) ){ |
| 42246 | | - zRelative++; |
| 42247 | | - } |
| 42248 | | - |
| 42249 | 42538 | /* It's odd to simulate an io-error here, but really this is just |
| 42250 | 42539 | ** using the io-error infrastructure to test that SQLite handles this |
| 42251 | 42540 | ** function failing. This function could fail if, for example, the |
| 42252 | 42541 | ** current working directory has been unlinked. |
| 42253 | 42542 | */ |
| | @@ -42602,57 +42891,107 @@ |
| 42602 | 42891 | /* |
| 42603 | 42892 | ** Initialize and deinitialize the operating system interface. |
| 42604 | 42893 | */ |
| 42605 | 42894 | SQLITE_API int SQLITE_STDCALL sqlite3_os_init(void){ |
| 42606 | 42895 | static sqlite3_vfs winVfs = { |
| 42607 | | - 3, /* iVersion */ |
| 42608 | | - sizeof(winFile), /* szOsFile */ |
| 42896 | + 3, /* iVersion */ |
| 42897 | + sizeof(winFile), /* szOsFile */ |
| 42609 | 42898 | SQLITE_WIN32_MAX_PATH_BYTES, /* mxPathname */ |
| 42610 | | - 0, /* pNext */ |
| 42611 | | - "win32", /* zName */ |
| 42612 | | - 0, /* pAppData */ |
| 42613 | | - winOpen, /* xOpen */ |
| 42614 | | - winDelete, /* xDelete */ |
| 42615 | | - winAccess, /* xAccess */ |
| 42616 | | - winFullPathname, /* xFullPathname */ |
| 42617 | | - winDlOpen, /* xDlOpen */ |
| 42618 | | - winDlError, /* xDlError */ |
| 42619 | | - winDlSym, /* xDlSym */ |
| 42620 | | - winDlClose, /* xDlClose */ |
| 42621 | | - winRandomness, /* xRandomness */ |
| 42622 | | - winSleep, /* xSleep */ |
| 42623 | | - winCurrentTime, /* xCurrentTime */ |
| 42624 | | - winGetLastError, /* xGetLastError */ |
| 42625 | | - winCurrentTimeInt64, /* xCurrentTimeInt64 */ |
| 42626 | | - winSetSystemCall, /* xSetSystemCall */ |
| 42627 | | - winGetSystemCall, /* xGetSystemCall */ |
| 42628 | | - winNextSystemCall, /* xNextSystemCall */ |
| 42899 | + 0, /* pNext */ |
| 42900 | + "win32", /* zName */ |
| 42901 | + &winAppData, /* pAppData */ |
| 42902 | + winOpen, /* xOpen */ |
| 42903 | + winDelete, /* xDelete */ |
| 42904 | + winAccess, /* xAccess */ |
| 42905 | + winFullPathname, /* xFullPathname */ |
| 42906 | + winDlOpen, /* xDlOpen */ |
| 42907 | + winDlError, /* xDlError */ |
| 42908 | + winDlSym, /* xDlSym */ |
| 42909 | + winDlClose, /* xDlClose */ |
| 42910 | + winRandomness, /* xRandomness */ |
| 42911 | + winSleep, /* xSleep */ |
| 42912 | + winCurrentTime, /* xCurrentTime */ |
| 42913 | + winGetLastError, /* xGetLastError */ |
| 42914 | + winCurrentTimeInt64, /* xCurrentTimeInt64 */ |
| 42915 | + winSetSystemCall, /* xSetSystemCall */ |
| 42916 | + winGetSystemCall, /* xGetSystemCall */ |
| 42917 | + winNextSystemCall, /* xNextSystemCall */ |
| 42629 | 42918 | }; |
| 42630 | 42919 | #if defined(SQLITE_WIN32_HAS_WIDE) |
| 42631 | 42920 | static sqlite3_vfs winLongPathVfs = { |
| 42632 | | - 3, /* iVersion */ |
| 42633 | | - sizeof(winFile), /* szOsFile */ |
| 42921 | + 3, /* iVersion */ |
| 42922 | + sizeof(winFile), /* szOsFile */ |
| 42923 | + SQLITE_WINNT_MAX_PATH_BYTES, /* mxPathname */ |
| 42924 | + 0, /* pNext */ |
| 42925 | + "win32-longpath", /* zName */ |
| 42926 | + &winAppData, /* pAppData */ |
| 42927 | + winOpen, /* xOpen */ |
| 42928 | + winDelete, /* xDelete */ |
| 42929 | + winAccess, /* xAccess */ |
| 42930 | + winFullPathname, /* xFullPathname */ |
| 42931 | + winDlOpen, /* xDlOpen */ |
| 42932 | + winDlError, /* xDlError */ |
| 42933 | + winDlSym, /* xDlSym */ |
| 42934 | + winDlClose, /* xDlClose */ |
| 42935 | + winRandomness, /* xRandomness */ |
| 42936 | + winSleep, /* xSleep */ |
| 42937 | + winCurrentTime, /* xCurrentTime */ |
| 42938 | + winGetLastError, /* xGetLastError */ |
| 42939 | + winCurrentTimeInt64, /* xCurrentTimeInt64 */ |
| 42940 | + winSetSystemCall, /* xSetSystemCall */ |
| 42941 | + winGetSystemCall, /* xGetSystemCall */ |
| 42942 | + winNextSystemCall, /* xNextSystemCall */ |
| 42943 | + }; |
| 42944 | +#endif |
| 42945 | + static sqlite3_vfs winNolockVfs = { |
| 42946 | + 3, /* iVersion */ |
| 42947 | + sizeof(winFile), /* szOsFile */ |
| 42948 | + SQLITE_WIN32_MAX_PATH_BYTES, /* mxPathname */ |
| 42949 | + 0, /* pNext */ |
| 42950 | + "win32-none", /* zName */ |
| 42951 | + &winNolockAppData, /* pAppData */ |
| 42952 | + winOpen, /* xOpen */ |
| 42953 | + winDelete, /* xDelete */ |
| 42954 | + winAccess, /* xAccess */ |
| 42955 | + winFullPathname, /* xFullPathname */ |
| 42956 | + winDlOpen, /* xDlOpen */ |
| 42957 | + winDlError, /* xDlError */ |
| 42958 | + winDlSym, /* xDlSym */ |
| 42959 | + winDlClose, /* xDlClose */ |
| 42960 | + winRandomness, /* xRandomness */ |
| 42961 | + winSleep, /* xSleep */ |
| 42962 | + winCurrentTime, /* xCurrentTime */ |
| 42963 | + winGetLastError, /* xGetLastError */ |
| 42964 | + winCurrentTimeInt64, /* xCurrentTimeInt64 */ |
| 42965 | + winSetSystemCall, /* xSetSystemCall */ |
| 42966 | + winGetSystemCall, /* xGetSystemCall */ |
| 42967 | + winNextSystemCall, /* xNextSystemCall */ |
| 42968 | + }; |
| 42969 | +#if defined(SQLITE_WIN32_HAS_WIDE) |
| 42970 | + static sqlite3_vfs winLongPathNolockVfs = { |
| 42971 | + 3, /* iVersion */ |
| 42972 | + sizeof(winFile), /* szOsFile */ |
| 42634 | 42973 | SQLITE_WINNT_MAX_PATH_BYTES, /* mxPathname */ |
| 42635 | | - 0, /* pNext */ |
| 42636 | | - "win32-longpath", /* zName */ |
| 42637 | | - 0, /* pAppData */ |
| 42638 | | - winOpen, /* xOpen */ |
| 42639 | | - winDelete, /* xDelete */ |
| 42640 | | - winAccess, /* xAccess */ |
| 42641 | | - winFullPathname, /* xFullPathname */ |
| 42642 | | - winDlOpen, /* xDlOpen */ |
| 42643 | | - winDlError, /* xDlError */ |
| 42644 | | - winDlSym, /* xDlSym */ |
| 42645 | | - winDlClose, /* xDlClose */ |
| 42646 | | - winRandomness, /* xRandomness */ |
| 42647 | | - winSleep, /* xSleep */ |
| 42648 | | - winCurrentTime, /* xCurrentTime */ |
| 42649 | | - winGetLastError, /* xGetLastError */ |
| 42650 | | - winCurrentTimeInt64, /* xCurrentTimeInt64 */ |
| 42651 | | - winSetSystemCall, /* xSetSystemCall */ |
| 42652 | | - winGetSystemCall, /* xGetSystemCall */ |
| 42653 | | - winNextSystemCall, /* xNextSystemCall */ |
| 42974 | + 0, /* pNext */ |
| 42975 | + "win32-longpath-none", /* zName */ |
| 42976 | + &winNolockAppData, /* pAppData */ |
| 42977 | + winOpen, /* xOpen */ |
| 42978 | + winDelete, /* xDelete */ |
| 42979 | + winAccess, /* xAccess */ |
| 42980 | + winFullPathname, /* xFullPathname */ |
| 42981 | + winDlOpen, /* xDlOpen */ |
| 42982 | + winDlError, /* xDlError */ |
| 42983 | + winDlSym, /* xDlSym */ |
| 42984 | + winDlClose, /* xDlClose */ |
| 42985 | + winRandomness, /* xRandomness */ |
| 42986 | + winSleep, /* xSleep */ |
| 42987 | + winCurrentTime, /* xCurrentTime */ |
| 42988 | + winGetLastError, /* xGetLastError */ |
| 42989 | + winCurrentTimeInt64, /* xCurrentTimeInt64 */ |
| 42990 | + winSetSystemCall, /* xSetSystemCall */ |
| 42991 | + winGetSystemCall, /* xGetSystemCall */ |
| 42992 | + winNextSystemCall, /* xNextSystemCall */ |
| 42654 | 42993 | }; |
| 42655 | 42994 | #endif |
| 42656 | 42995 | |
| 42657 | 42996 | /* Double-check that the aSyscall[] array has been constructed |
| 42658 | 42997 | ** correctly. See ticket [bb3a86e890c8e96ab] */ |
| | @@ -42671,10 +43010,16 @@ |
| 42671 | 43010 | sqlite3_vfs_register(&winVfs, 1); |
| 42672 | 43011 | |
| 42673 | 43012 | #if defined(SQLITE_WIN32_HAS_WIDE) |
| 42674 | 43013 | sqlite3_vfs_register(&winLongPathVfs, 0); |
| 42675 | 43014 | #endif |
| 43015 | + |
| 43016 | + sqlite3_vfs_register(&winNolockVfs, 0); |
| 43017 | + |
| 43018 | +#if defined(SQLITE_WIN32_HAS_WIDE) |
| 43019 | + sqlite3_vfs_register(&winLongPathNolockVfs, 0); |
| 43020 | +#endif |
| 42676 | 43021 | |
| 42677 | 43022 | return SQLITE_OK; |
| 42678 | 43023 | } |
| 42679 | 43024 | |
| 42680 | 43025 | SQLITE_API int SQLITE_STDCALL sqlite3_os_end(void){ |
| | @@ -43792,32 +44137,34 @@ |
| 43792 | 44137 | sqlite3PcacheTruncate(pCache, 0); |
| 43793 | 44138 | } |
| 43794 | 44139 | |
| 43795 | 44140 | /* |
| 43796 | 44141 | ** Merge two lists of pages connected by pDirty and in pgno order. |
| 43797 | | -** Do not both fixing the pDirtyPrev pointers. |
| 44142 | +** Do not bother fixing the pDirtyPrev pointers. |
| 43798 | 44143 | */ |
| 43799 | 44144 | static PgHdr *pcacheMergeDirtyList(PgHdr *pA, PgHdr *pB){ |
| 43800 | 44145 | PgHdr result, *pTail; |
| 43801 | 44146 | pTail = &result; |
| 43802 | | - while( pA && pB ){ |
| 44147 | + assert( pA!=0 && pB!=0 ); |
| 44148 | + for(;;){ |
| 43803 | 44149 | if( pA->pgno<pB->pgno ){ |
| 43804 | 44150 | pTail->pDirty = pA; |
| 43805 | 44151 | pTail = pA; |
| 43806 | 44152 | pA = pA->pDirty; |
| 44153 | + if( pA==0 ){ |
| 44154 | + pTail->pDirty = pB; |
| 44155 | + break; |
| 44156 | + } |
| 43807 | 44157 | }else{ |
| 43808 | 44158 | pTail->pDirty = pB; |
| 43809 | 44159 | pTail = pB; |
| 43810 | 44160 | pB = pB->pDirty; |
| 43811 | | - } |
| 43812 | | - } |
| 43813 | | - if( pA ){ |
| 43814 | | - pTail->pDirty = pA; |
| 43815 | | - }else if( pB ){ |
| 43816 | | - pTail->pDirty = pB; |
| 43817 | | - }else{ |
| 43818 | | - pTail->pDirty = 0; |
| 44161 | + if( pB==0 ){ |
| 44162 | + pTail->pDirty = pA; |
| 44163 | + break; |
| 44164 | + } |
| 44165 | + } |
| 43819 | 44166 | } |
| 43820 | 44167 | return result.pDirty; |
| 43821 | 44168 | } |
| 43822 | 44169 | |
| 43823 | 44170 | /* |
| | @@ -43855,11 +44202,12 @@ |
| 43855 | 44202 | a[i] = pcacheMergeDirtyList(a[i], p); |
| 43856 | 44203 | } |
| 43857 | 44204 | } |
| 43858 | 44205 | p = a[0]; |
| 43859 | 44206 | for(i=1; i<N_SORT_BUCKET; i++){ |
| 43860 | | - p = pcacheMergeDirtyList(p, a[i]); |
| 44207 | + if( a[i]==0 ) continue; |
| 44208 | + p = p ? pcacheMergeDirtyList(p, a[i]) : a[i]; |
| 43861 | 44209 | } |
| 43862 | 44210 | return p; |
| 43863 | 44211 | } |
| 43864 | 44212 | |
| 43865 | 44213 | /* |
| | @@ -45460,31 +45808,29 @@ |
| 45460 | 45808 | ){ |
| 45461 | 45809 | struct RowSetEntry head; |
| 45462 | 45810 | struct RowSetEntry *pTail; |
| 45463 | 45811 | |
| 45464 | 45812 | pTail = &head; |
| 45465 | | - while( pA && pB ){ |
| 45813 | + assert( pA!=0 && pB!=0 ); |
| 45814 | + for(;;){ |
| 45466 | 45815 | assert( pA->pRight==0 || pA->v<=pA->pRight->v ); |
| 45467 | 45816 | assert( pB->pRight==0 || pB->v<=pB->pRight->v ); |
| 45468 | | - if( pA->v<pB->v ){ |
| 45469 | | - pTail->pRight = pA; |
| 45817 | + if( pA->v<=pB->v ){ |
| 45818 | + if( pA->v<pB->v ) pTail = pTail->pRight = pA; |
| 45470 | 45819 | pA = pA->pRight; |
| 45471 | | - pTail = pTail->pRight; |
| 45472 | | - }else if( pB->v<pA->v ){ |
| 45473 | | - pTail->pRight = pB; |
| 45820 | + if( pA==0 ){ |
| 45821 | + pTail->pRight = pB; |
| 45822 | + break; |
| 45823 | + } |
| 45824 | + }else{ |
| 45825 | + pTail = pTail->pRight = pB; |
| 45474 | 45826 | pB = pB->pRight; |
| 45475 | | - pTail = pTail->pRight; |
| 45476 | | - }else{ |
| 45477 | | - pA = pA->pRight; |
| 45478 | | - } |
| 45479 | | - } |
| 45480 | | - if( pA ){ |
| 45481 | | - assert( pA->pRight==0 || pA->v<=pA->pRight->v ); |
| 45482 | | - pTail->pRight = pA; |
| 45483 | | - }else{ |
| 45484 | | - assert( pB==0 || pB->pRight==0 || pB->v<=pB->pRight->v ); |
| 45485 | | - pTail->pRight = pB; |
| 45827 | + if( pB==0 ){ |
| 45828 | + pTail->pRight = pA; |
| 45829 | + break; |
| 45830 | + } |
| 45831 | + } |
| 45486 | 45832 | } |
| 45487 | 45833 | return head.pRight; |
| 45488 | 45834 | } |
| 45489 | 45835 | |
| 45490 | 45836 | /* |
| | @@ -45504,13 +45850,14 @@ |
| 45504 | 45850 | aBucket[i] = 0; |
| 45505 | 45851 | } |
| 45506 | 45852 | aBucket[i] = pIn; |
| 45507 | 45853 | pIn = pNext; |
| 45508 | 45854 | } |
| 45509 | | - pIn = 0; |
| 45510 | | - for(i=0; i<sizeof(aBucket)/sizeof(aBucket[0]); i++){ |
| 45511 | | - pIn = rowSetEntryMerge(pIn, aBucket[i]); |
| 45855 | + pIn = aBucket[0]; |
| 45856 | + for(i=1; i<sizeof(aBucket)/sizeof(aBucket[0]); i++){ |
| 45857 | + if( aBucket[i]==0 ) continue; |
| 45858 | + pIn = pIn ? rowSetEntryMerge(pIn, aBucket[i]) : aBucket[i]; |
| 45512 | 45859 | } |
| 45513 | 45860 | return pIn; |
| 45514 | 45861 | } |
| 45515 | 45862 | |
| 45516 | 45863 | |
| | @@ -45758,12 +46105,12 @@ |
| 45758 | 46105 | ** This header file defines the interface to the write-ahead logging |
| 45759 | 46106 | ** system. Refer to the comments below and the header comment attached to |
| 45760 | 46107 | ** the implementation of each function in log.c for further details. |
| 45761 | 46108 | */ |
| 45762 | 46109 | |
| 45763 | | -#ifndef _WAL_H_ |
| 45764 | | -#define _WAL_H_ |
| 46110 | +#ifndef SQLITE_WAL_H |
| 46111 | +#define SQLITE_WAL_H |
| 45765 | 46112 | |
| 45766 | 46113 | /* #include "sqliteInt.h" */ |
| 45767 | 46114 | |
| 45768 | 46115 | /* Additional values that can be added to the sync_flags argument of |
| 45769 | 46116 | ** sqlite3WalFrames(): |
| | @@ -45887,11 +46234,11 @@ |
| 45887 | 46234 | |
| 45888 | 46235 | /* Return the sqlite3_file object for the WAL file */ |
| 45889 | 46236 | SQLITE_PRIVATE sqlite3_file *sqlite3WalFile(Wal *pWal); |
| 45890 | 46237 | |
| 45891 | 46238 | #endif /* ifndef SQLITE_OMIT_WAL */ |
| 45892 | | -#endif /* _WAL_H_ */ |
| 46239 | +#endif /* SQLITE_WAL_H */ |
| 45893 | 46240 | |
| 45894 | 46241 | /************** End of wal.h *************************************************/ |
| 45895 | 46242 | /************** Continuing where we left off in pager.c **********************/ |
| 45896 | 46243 | |
| 45897 | 46244 | |
| | @@ -53027,20 +53374,10 @@ |
| 53027 | 53374 | */ |
| 53028 | 53375 | SQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager *pPager){ |
| 53029 | 53376 | return &pPager->pBackup; |
| 53030 | 53377 | } |
| 53031 | 53378 | |
| 53032 | | -#ifndef SQLITE_OMIT_VACUUM |
| 53033 | | -/* |
| 53034 | | -** Unless this is an in-memory or temporary database, clear the pager cache. |
| 53035 | | -*/ |
| 53036 | | -SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *pPager){ |
| 53037 | | - assert( MEMDB==0 || pPager->tempFile ); |
| 53038 | | - if( pPager->tempFile==0 ) pager_reset(pPager); |
| 53039 | | -} |
| 53040 | | -#endif |
| 53041 | | - |
| 53042 | 53379 | #ifndef SQLITE_OMIT_WAL |
| 53043 | 53380 | /* |
| 53044 | 53381 | ** This function is called when the user invokes "PRAGMA wal_checkpoint", |
| 53045 | 53382 | ** "PRAGMA wal_blocking_checkpoint" or calls the sqlite3_wal_checkpoint() |
| 53046 | 53383 | ** or wal_blocking_checkpoint() API functions. |
| | @@ -56378,20 +56715,25 @@ |
| 56378 | 56715 | ** boundary is crossed. Only the part of the WAL prior to the last |
| 56379 | 56716 | ** sector boundary is synced; the part of the last frame that extends |
| 56380 | 56717 | ** past the sector boundary is written after the sync. |
| 56381 | 56718 | */ |
| 56382 | 56719 | if( isCommit && (sync_flags & WAL_SYNC_TRANSACTIONS)!=0 ){ |
| 56720 | + int bSync = 1; |
| 56383 | 56721 | if( pWal->padToSectorBoundary ){ |
| 56384 | 56722 | int sectorSize = sqlite3SectorSize(pWal->pWalFd); |
| 56385 | 56723 | w.iSyncPoint = ((iOffset+sectorSize-1)/sectorSize)*sectorSize; |
| 56724 | + bSync = (w.iSyncPoint==iOffset); |
| 56725 | + testcase( bSync ); |
| 56386 | 56726 | while( iOffset<w.iSyncPoint ){ |
| 56387 | 56727 | rc = walWriteOneFrame(&w, pLast, nTruncate, iOffset); |
| 56388 | 56728 | if( rc ) return rc; |
| 56389 | 56729 | iOffset += szFrame; |
| 56390 | 56730 | nExtra++; |
| 56391 | 56731 | } |
| 56392 | | - }else{ |
| 56732 | + } |
| 56733 | + if( bSync ){ |
| 56734 | + assert( rc==SQLITE_OK ); |
| 56393 | 56735 | rc = sqlite3OsSync(w.pFd, sync_flags & SQLITE_SYNC_MASK); |
| 56394 | 56736 | } |
| 56395 | 56737 | } |
| 56396 | 56738 | |
| 56397 | 56739 | /* If this frame set completes the first transaction in the WAL and |
| | @@ -58174,10 +58516,19 @@ |
| 58174 | 58516 | */ |
| 58175 | 58517 | #ifdef SQLITE_DEBUG |
| 58176 | 58518 | static int cursorHoldsMutex(BtCursor *p){ |
| 58177 | 58519 | return sqlite3_mutex_held(p->pBt->mutex); |
| 58178 | 58520 | } |
| 58521 | + |
| 58522 | +/* Verify that the cursor and the BtShared agree about what is the current |
| 58523 | +** database connetion. This is important in shared-cache mode. If the database |
| 58524 | +** connection pointers get out-of-sync, it is possible for routines like |
| 58525 | +** btreeInitPage() to reference an stale connection pointer that references a |
| 58526 | +** a connection that has already closed. This routine is used inside assert() |
| 58527 | +** statements only and for the purpose of double-checking that the btree code |
| 58528 | +** does keep the database connection pointers up-to-date. |
| 58529 | +*/ |
| 58179 | 58530 | static int cursorOwnsBtShared(BtCursor *p){ |
| 58180 | 58531 | assert( cursorHoldsMutex(p) ); |
| 58181 | 58532 | return (p->pBtree->db==p->pBt->db); |
| 58182 | 58533 | } |
| 58183 | 58534 | #endif |
| | @@ -58333,25 +58684,23 @@ |
| 58333 | 58684 | ** NULL. If the cursor is open on a non-intkey table, then pCur->pKey is |
| 58334 | 58685 | ** set to point to a malloced buffer pCur->nKey bytes in size containing |
| 58335 | 58686 | ** the key. |
| 58336 | 58687 | */ |
| 58337 | 58688 | static int saveCursorKey(BtCursor *pCur){ |
| 58338 | | - int rc; |
| 58689 | + int rc = SQLITE_OK; |
| 58339 | 58690 | assert( CURSOR_VALID==pCur->eState ); |
| 58340 | 58691 | assert( 0==pCur->pKey ); |
| 58341 | 58692 | assert( cursorHoldsMutex(pCur) ); |
| 58342 | 58693 | |
| 58343 | | - rc = sqlite3BtreeKeySize(pCur, &pCur->nKey); |
| 58344 | | - assert( rc==SQLITE_OK ); /* KeySize() cannot fail */ |
| 58345 | | - |
| 58346 | | - /* If this is an intKey table, then the above call to BtreeKeySize() |
| 58347 | | - ** stores the integer key in pCur->nKey. In this case this value is |
| 58348 | | - ** all that is required. Otherwise, if pCur is not open on an intKey |
| 58349 | | - ** table, then malloc space for and store the pCur->nKey bytes of key |
| 58350 | | - ** data. */ |
| 58351 | | - if( 0==pCur->curIntKey ){ |
| 58352 | | - void *pKey = sqlite3Malloc( pCur->nKey ); |
| 58694 | + if( pCur->curIntKey ){ |
| 58695 | + /* Only the rowid is required for a table btree */ |
| 58696 | + pCur->nKey = sqlite3BtreeIntegerKey(pCur); |
| 58697 | + }else{ |
| 58698 | + /* For an index btree, save the complete key content */ |
| 58699 | + void *pKey; |
| 58700 | + pCur->nKey = sqlite3BtreePayloadSize(pCur); |
| 58701 | + pKey = sqlite3Malloc( pCur->nKey ); |
| 58353 | 58702 | if( pKey ){ |
| 58354 | 58703 | rc = sqlite3BtreeKey(pCur, 0, (int)pCur->nKey, pKey); |
| 58355 | 58704 | if( rc==SQLITE_OK ){ |
| 58356 | 58705 | pCur->pKey = pKey; |
| 58357 | 58706 | }else{ |
| | @@ -60054,13 +60403,13 @@ |
| 60054 | 60403 | assert( (pBt->pageSize & 7)==0 ); /* 8-byte alignment of pageSize */ |
| 60055 | 60404 | |
| 60056 | 60405 | #if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO) |
| 60057 | 60406 | /* Add the new BtShared object to the linked list sharable BtShareds. |
| 60058 | 60407 | */ |
| 60408 | + pBt->nRef = 1; |
| 60059 | 60409 | if( p->sharable ){ |
| 60060 | 60410 | MUTEX_LOGIC( sqlite3_mutex *mutexShared; ) |
| 60061 | | - pBt->nRef = 1; |
| 60062 | 60411 | MUTEX_LOGIC( mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);) |
| 60063 | 60412 | if( SQLITE_THREADSAFE && sqlite3GlobalConfig.bCoreMutex ){ |
| 60064 | 60413 | pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST); |
| 60065 | 60414 | if( pBt->mutex==0 ){ |
| 60066 | 60415 | rc = SQLITE_NOMEM_BKPT; |
| | @@ -60127,10 +60476,11 @@ |
| 60127 | 60476 | } |
| 60128 | 60477 | if( mutexOpen ){ |
| 60129 | 60478 | assert( sqlite3_mutex_held(mutexOpen) ); |
| 60130 | 60479 | sqlite3_mutex_leave(mutexOpen); |
| 60131 | 60480 | } |
| 60481 | + assert( rc!=SQLITE_OK || sqlite3BtreeConnectionCount(*ppBtree)>0 ); |
| 60132 | 60482 | return rc; |
| 60133 | 60483 | } |
| 60134 | 60484 | |
| 60135 | 60485 | /* |
| 60136 | 60486 | ** Decrement the BtShared.nRef counter. When it reaches zero, |
| | @@ -61986,50 +62336,37 @@ |
| 61986 | 62336 | return pCur && pCur->eState==CURSOR_VALID; |
| 61987 | 62337 | } |
| 61988 | 62338 | #endif /* NDEBUG */ |
| 61989 | 62339 | |
| 61990 | 62340 | /* |
| 61991 | | -** Set *pSize to the size of the buffer needed to hold the value of |
| 61992 | | -** the key for the current entry. If the cursor is not pointing |
| 61993 | | -** to a valid entry, *pSize is set to 0. |
| 61994 | | -** |
| 61995 | | -** For a table with the INTKEY flag set, this routine returns the key |
| 61996 | | -** itself, not the number of bytes in the key. |
| 61997 | | -** |
| 61998 | | -** The caller must position the cursor prior to invoking this routine. |
| 61999 | | -** |
| 62000 | | -** This routine cannot fail. It always returns SQLITE_OK. |
| 62341 | +** Return the value of the integer key or "rowid" for a table btree. |
| 62342 | +** This routine is only valid for a cursor that is pointing into a |
| 62343 | +** ordinary table btree. If the cursor points to an index btree or |
| 62344 | +** is invalid, the result of this routine is undefined. |
| 62001 | 62345 | */ |
| 62002 | | -SQLITE_PRIVATE int sqlite3BtreeKeySize(BtCursor *pCur, i64 *pSize){ |
| 62346 | +SQLITE_PRIVATE i64 sqlite3BtreeIntegerKey(BtCursor *pCur){ |
| 62003 | 62347 | assert( cursorHoldsMutex(pCur) ); |
| 62004 | 62348 | assert( pCur->eState==CURSOR_VALID ); |
| 62349 | + assert( pCur->curIntKey ); |
| 62005 | 62350 | getCellInfo(pCur); |
| 62006 | | - *pSize = pCur->info.nKey; |
| 62007 | | - return SQLITE_OK; |
| 62351 | + return pCur->info.nKey; |
| 62008 | 62352 | } |
| 62009 | 62353 | |
| 62010 | 62354 | /* |
| 62011 | | -** Set *pSize to the number of bytes of data in the entry the |
| 62012 | | -** cursor currently points to. |
| 62355 | +** Return the number of bytes of payload for the entry that pCur is |
| 62356 | +** currently pointing to. For table btrees, this will be the amount |
| 62357 | +** of data. For index btrees, this will be the size of the key. |
| 62013 | 62358 | ** |
| 62014 | 62359 | ** The caller must guarantee that the cursor is pointing to a non-NULL |
| 62015 | 62360 | ** valid entry. In other words, the calling procedure must guarantee |
| 62016 | 62361 | ** that the cursor has Cursor.eState==CURSOR_VALID. |
| 62017 | | -** |
| 62018 | | -** Failure is not possible. This function always returns SQLITE_OK. |
| 62019 | | -** It might just as well be a procedure (returning void) but we continue |
| 62020 | | -** to return an integer result code for historical reasons. |
| 62021 | 62362 | */ |
| 62022 | | -SQLITE_PRIVATE int sqlite3BtreeDataSize(BtCursor *pCur, u32 *pSize){ |
| 62023 | | - assert( cursorOwnsBtShared(pCur) ); |
| 62363 | +SQLITE_PRIVATE u32 sqlite3BtreePayloadSize(BtCursor *pCur){ |
| 62364 | + assert( cursorHoldsMutex(pCur) ); |
| 62024 | 62365 | assert( pCur->eState==CURSOR_VALID ); |
| 62025 | | - assert( pCur->iPage>=0 ); |
| 62026 | | - assert( pCur->iPage<BTCURSOR_MAX_DEPTH ); |
| 62027 | | - assert( pCur->apPage[pCur->iPage]->intKeyLeaf==1 ); |
| 62028 | 62366 | getCellInfo(pCur); |
| 62029 | | - *pSize = pCur->info.nPayload; |
| 62030 | | - return SQLITE_OK; |
| 62367 | + return pCur->info.nPayload; |
| 62031 | 62368 | } |
| 62032 | 62369 | |
| 62033 | 62370 | /* |
| 62034 | 62371 | ** Given the page number of an overflow page in the database (parameter |
| 62035 | 62372 | ** ovfl), this function finds the page number of the next page in the |
| | @@ -62467,14 +62804,11 @@ |
| 62467 | 62804 | ** this routine. |
| 62468 | 62805 | ** |
| 62469 | 62806 | ** These routines is used to get quick access to key and data |
| 62470 | 62807 | ** in the common case where no overflow pages are used. |
| 62471 | 62808 | */ |
| 62472 | | -SQLITE_PRIVATE const void *sqlite3BtreeKeyFetch(BtCursor *pCur, u32 *pAmt){ |
| 62473 | | - return fetchPayload(pCur, pAmt); |
| 62474 | | -} |
| 62475 | | -SQLITE_PRIVATE const void *sqlite3BtreeDataFetch(BtCursor *pCur, u32 *pAmt){ |
| 62809 | +SQLITE_PRIVATE const void *sqlite3BtreePayloadFetch(BtCursor *pCur, u32 *pAmt){ |
| 62476 | 62810 | return fetchPayload(pCur, pAmt); |
| 62477 | 62811 | } |
| 62478 | 62812 | |
| 62479 | 62813 | |
| 62480 | 62814 | /* |
| | @@ -62803,15 +63137,16 @@ |
| 62803 | 63137 | |
| 62804 | 63138 | assert( cursorOwnsBtShared(pCur) ); |
| 62805 | 63139 | assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); |
| 62806 | 63140 | assert( pRes ); |
| 62807 | 63141 | assert( (pIdxKey==0)==(pCur->pKeyInfo==0) ); |
| 63142 | + assert( pCur->eState!=CURSOR_VALID || (pIdxKey==0)==(pCur->curIntKey!=0) ); |
| 62808 | 63143 | |
| 62809 | 63144 | /* If the cursor is already positioned at the point we are trying |
| 62810 | 63145 | ** to move to, then just return without doing any work */ |
| 62811 | | - if( pCur->eState==CURSOR_VALID && (pCur->curFlags & BTCF_ValidNKey)!=0 |
| 62812 | | - && pCur->curIntKey |
| 63146 | + if( pIdxKey==0 |
| 63147 | + && pCur->eState==CURSOR_VALID && (pCur->curFlags & BTCF_ValidNKey)!=0 |
| 62813 | 63148 | ){ |
| 62814 | 63149 | if( pCur->info.nKey==intKey ){ |
| 62815 | 63150 | *pRes = 0; |
| 62816 | 63151 | return SQLITE_OK; |
| 62817 | 63152 | } |
| | @@ -63796,13 +64131,11 @@ |
| 63796 | 64131 | ** later. |
| 63797 | 64132 | */ |
| 63798 | 64133 | static int fillInCell( |
| 63799 | 64134 | MemPage *pPage, /* The page that contains the cell */ |
| 63800 | 64135 | unsigned char *pCell, /* Complete text of the cell */ |
| 63801 | | - const void *pKey, i64 nKey, /* The key */ |
| 63802 | | - const void *pData,int nData, /* The data */ |
| 63803 | | - int nZero, /* Extra zero bytes to append to pData */ |
| 64136 | + const BtreePayload *pX, /* Payload with which to construct the cell */ |
| 63804 | 64137 | int *pnSize /* Write cell size here */ |
| 63805 | 64138 | ){ |
| 63806 | 64139 | int nPayload; |
| 63807 | 64140 | const u8 *pSrc; |
| 63808 | 64141 | int nSrc, n, rc; |
| | @@ -63822,30 +64155,27 @@ |
| 63822 | 64155 | assert( pCell<pPage->aData || pCell>=&pPage->aData[pBt->pageSize] |
| 63823 | 64156 | || sqlite3PagerIswriteable(pPage->pDbPage) ); |
| 63824 | 64157 | |
| 63825 | 64158 | /* Fill in the header. */ |
| 63826 | 64159 | nHeader = pPage->childPtrSize; |
| 63827 | | - nPayload = nData + nZero; |
| 63828 | | - if( pPage->intKeyLeaf ){ |
| 63829 | | - nHeader += putVarint32(&pCell[nHeader], nPayload); |
| 63830 | | - }else{ |
| 63831 | | - assert( nData==0 ); |
| 63832 | | - assert( nZero==0 ); |
| 63833 | | - } |
| 63834 | | - nHeader += putVarint(&pCell[nHeader], *(u64*)&nKey); |
| 63835 | | - |
| 63836 | | - /* Fill in the payload size */ |
| 63837 | 64160 | if( pPage->intKey ){ |
| 63838 | | - pSrc = pData; |
| 63839 | | - nSrc = nData; |
| 63840 | | - nData = 0; |
| 63841 | | - }else{ |
| 63842 | | - assert( nKey<=0x7fffffff && pKey!=0 ); |
| 63843 | | - nPayload = (int)nKey; |
| 63844 | | - pSrc = pKey; |
| 63845 | | - nSrc = (int)nKey; |
| 63846 | | - } |
| 64161 | + nPayload = pX->nData + pX->nZero; |
| 64162 | + pSrc = pX->pData; |
| 64163 | + nSrc = pX->nData; |
| 64164 | + assert( pPage->intKeyLeaf ); /* fillInCell() only called for leaves */ |
| 64165 | + nHeader += putVarint32(&pCell[nHeader], nPayload); |
| 64166 | + nHeader += putVarint(&pCell[nHeader], *(u64*)&pX->nKey); |
| 64167 | + }else{ |
| 64168 | + assert( pX->nData==0 ); |
| 64169 | + assert( pX->nZero==0 ); |
| 64170 | + assert( pX->nKey<=0x7fffffff && pX->pKey!=0 ); |
| 64171 | + nSrc = nPayload = (int)pX->nKey; |
| 64172 | + pSrc = pX->pKey; |
| 64173 | + nHeader += putVarint32(&pCell[nHeader], nPayload); |
| 64174 | + } |
| 64175 | + |
| 64176 | + /* Fill in the payload */ |
| 63847 | 64177 | if( nPayload<=pPage->maxLocal ){ |
| 63848 | 64178 | n = nHeader + nPayload; |
| 63849 | 64179 | testcase( n==3 ); |
| 63850 | 64180 | testcase( n==4 ); |
| 63851 | 64181 | if( n<4 ) n = 4; |
| | @@ -63879,11 +64209,11 @@ |
| 63879 | 64209 | #if SQLITE_DEBUG |
| 63880 | 64210 | { |
| 63881 | 64211 | CellInfo info; |
| 63882 | 64212 | pPage->xParseCell(pPage, pCell, &info); |
| 63883 | 64213 | assert( nHeader==(int)(info.pPayload - pCell) ); |
| 63884 | | - assert( info.nKey==nKey ); |
| 64214 | + assert( info.nKey==pX->nKey ); |
| 63885 | 64215 | assert( *pnSize == info.nSize ); |
| 63886 | 64216 | assert( spaceLeft == info.nLocal ); |
| 63887 | 64217 | } |
| 63888 | 64218 | #endif |
| 63889 | 64219 | |
| | @@ -63964,14 +64294,10 @@ |
| 63964 | 64294 | nPayload -= n; |
| 63965 | 64295 | pPayload += n; |
| 63966 | 64296 | pSrc += n; |
| 63967 | 64297 | nSrc -= n; |
| 63968 | 64298 | spaceLeft -= n; |
| 63969 | | - if( nSrc==0 ){ |
| 63970 | | - nSrc = nData; |
| 63971 | | - pSrc = pData; |
| 63972 | | - } |
| 63973 | 64299 | } |
| 63974 | 64300 | releasePage(pToRelease); |
| 63975 | 64301 | return SQLITE_OK; |
| 63976 | 64302 | } |
| 63977 | 64303 | |
| | @@ -64034,10 +64360,12 @@ |
| 64034 | 64360 | ** pTemp is not null. Regardless of pTemp, allocate a new entry |
| 64035 | 64361 | ** in pPage->apOvfl[] and make it point to the cell content (either |
| 64036 | 64362 | ** in pTemp or the original pCell) and also record its index. |
| 64037 | 64363 | ** Allocating a new entry in pPage->aCell[] implies that |
| 64038 | 64364 | ** pPage->nOverflow is incremented. |
| 64365 | +** |
| 64366 | +** *pRC must be SQLITE_OK when this routine is called. |
| 64039 | 64367 | */ |
| 64040 | 64368 | static void insertCell( |
| 64041 | 64369 | MemPage *pPage, /* Page into which we are copying */ |
| 64042 | 64370 | int i, /* New cell becomes the i-th cell of the page */ |
| 64043 | 64371 | u8 *pCell, /* Content of the new cell */ |
| | @@ -64049,12 +64377,11 @@ |
| 64049 | 64377 | int idx = 0; /* Where to write new cell content in data[] */ |
| 64050 | 64378 | int j; /* Loop counter */ |
| 64051 | 64379 | u8 *data; /* The content of the whole page */ |
| 64052 | 64380 | u8 *pIns; /* The point in pPage->aCellIdx[] where no cell inserted */ |
| 64053 | 64381 | |
| 64054 | | - if( *pRC ) return; |
| 64055 | | - |
| 64382 | + assert( *pRC==SQLITE_OK ); |
| 64056 | 64383 | assert( i>=0 && i<=pPage->nCell+pPage->nOverflow ); |
| 64057 | 64384 | assert( MX_CELL(pPage->pBt)<=10921 ); |
| 64058 | 64385 | assert( pPage->nCell<=MX_CELL(pPage->pBt) || CORRUPT_DB ); |
| 64059 | 64386 | assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) ); |
| 64060 | 64387 | assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) ); |
| | @@ -64556,12 +64883,14 @@ |
| 64556 | 64883 | while( (*(pCell++)&0x80) && pCell<pStop ); |
| 64557 | 64884 | pStop = &pCell[9]; |
| 64558 | 64885 | while( ((*(pOut++) = *(pCell++))&0x80) && pCell<pStop ); |
| 64559 | 64886 | |
| 64560 | 64887 | /* Insert the new divider cell into pParent. */ |
| 64561 | | - insertCell(pParent, pParent->nCell, pSpace, (int)(pOut-pSpace), |
| 64562 | | - 0, pPage->pgno, &rc); |
| 64888 | + if( rc==SQLITE_OK ){ |
| 64889 | + insertCell(pParent, pParent->nCell, pSpace, (int)(pOut-pSpace), |
| 64890 | + 0, pPage->pgno, &rc); |
| 64891 | + } |
| 64563 | 64892 | |
| 64564 | 64893 | /* Set the right-child pointer of pParent to point to the new page. */ |
| 64565 | 64894 | put4byte(&pParent->aData[pParent->hdrOffset+8], pgnoNew); |
| 64566 | 64895 | |
| 64567 | 64896 | /* Release the reference to the new page. */ |
| | @@ -65077,11 +65406,11 @@ |
| 65077 | 65406 | do{ |
| 65078 | 65407 | assert( d<nMaxCells ); |
| 65079 | 65408 | assert( r<nMaxCells ); |
| 65080 | 65409 | (void)cachedCellSize(&b, r); |
| 65081 | 65410 | if( szRight!=0 |
| 65082 | | - && (bBulk || szRight+b.szCell[d]+2 > szLeft-(b.szCell[r]+2)) ){ |
| 65411 | + && (bBulk || szRight+b.szCell[d]+2 > szLeft-(b.szCell[r]+(i==k-1?0:2)))){ |
| 65083 | 65412 | break; |
| 65084 | 65413 | } |
| 65085 | 65414 | szRight += b.szCell[d] + 2; |
| 65086 | 65415 | szLeft -= b.szCell[r] + 2; |
| 65087 | 65416 | cntNew[i-1] = r; |
| | @@ -65649,17 +65978,23 @@ |
| 65649 | 65978 | return rc; |
| 65650 | 65979 | } |
| 65651 | 65980 | |
| 65652 | 65981 | |
| 65653 | 65982 | /* |
| 65654 | | -** Insert a new record into the BTree. The key is given by (pKey,nKey) |
| 65655 | | -** and the data is given by (pData,nData). The cursor is used only to |
| 65656 | | -** define what table the record should be inserted into. The cursor |
| 65657 | | -** is left pointing at a random location. |
| 65983 | +** Insert a new record into the BTree. The content of the new record |
| 65984 | +** is described by the pX object. The pCur cursor is used only to |
| 65985 | +** define what table the record should be inserted into, and is left |
| 65986 | +** pointing at a random location. |
| 65658 | 65987 | ** |
| 65659 | | -** For an INTKEY table, only the nKey value of the key is used. pKey is |
| 65660 | | -** ignored. For a ZERODATA table, the pData and nData are both ignored. |
| 65988 | +** For a table btree (used for rowid tables), only the pX.nKey value of |
| 65989 | +** the key is used. The pX.pKey value must be NULL. The pX.nKey is the |
| 65990 | +** rowid or INTEGER PRIMARY KEY of the row. The pX.nData,pData,nZero fields |
| 65991 | +** hold the content of the row. |
| 65992 | +** |
| 65993 | +** For an index btree (used for indexes and WITHOUT ROWID tables), the |
| 65994 | +** key is an arbitrary byte sequence stored in pX.pKey,nKey. The |
| 65995 | +** pX.pData,nData,nZero fields must be zero. |
| 65661 | 65996 | ** |
| 65662 | 65997 | ** If the seekResult parameter is non-zero, then a successful call to |
| 65663 | 65998 | ** MovetoUnpacked() to seek cursor pCur to (pKey, nKey) has already |
| 65664 | 65999 | ** been performed. seekResult is the search result returned (a negative |
| 65665 | 66000 | ** number if pCur points at an entry that is smaller than (pKey, nKey), or |
| | @@ -65672,13 +66007,11 @@ |
| 65672 | 66007 | ** point to any entry or to no entry at all and so this function has to seek |
| 65673 | 66008 | ** the cursor before the new key can be inserted. |
| 65674 | 66009 | */ |
| 65675 | 66010 | SQLITE_PRIVATE int sqlite3BtreeInsert( |
| 65676 | 66011 | BtCursor *pCur, /* Insert data into the table of this cursor */ |
| 65677 | | - const void *pKey, i64 nKey, /* The key of the new record */ |
| 65678 | | - const void *pData, int nData, /* The data of the new record */ |
| 65679 | | - int nZero, /* Number of extra 0 bytes to append to data */ |
| 66012 | + const BtreePayload *pX, /* Content of the row to be inserted */ |
| 65680 | 66013 | int appendBias, /* True if this is likely an append */ |
| 65681 | 66014 | int seekResult /* Result of prior MovetoUnpacked() call */ |
| 65682 | 66015 | ){ |
| 65683 | 66016 | int rc; |
| 65684 | 66017 | int loc = seekResult; /* -1: before desired location +1: after */ |
| | @@ -65704,11 +66037,11 @@ |
| 65704 | 66037 | /* Assert that the caller has been consistent. If this cursor was opened |
| 65705 | 66038 | ** expecting an index b-tree, then the caller should be inserting blob |
| 65706 | 66039 | ** keys with no associated data. If the cursor was opened expecting an |
| 65707 | 66040 | ** intkey table, the caller should be inserting integer keys with a |
| 65708 | 66041 | ** blob of associated data. */ |
| 65709 | | - assert( (pKey==0)==(pCur->pKeyInfo==0) ); |
| 66042 | + assert( (pX->pKey==0)==(pCur->pKeyInfo==0) ); |
| 65710 | 66043 | |
| 65711 | 66044 | /* Save the positions of any other cursors open on this table. |
| 65712 | 66045 | ** |
| 65713 | 66046 | ** In some cases, the call to btreeMoveto() below is a no-op. For |
| 65714 | 66047 | ** example, when inserting data into a table with auto-generated integer |
| | @@ -65723,42 +66056,42 @@ |
| 65723 | 66056 | rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur); |
| 65724 | 66057 | if( rc ) return rc; |
| 65725 | 66058 | } |
| 65726 | 66059 | |
| 65727 | 66060 | if( pCur->pKeyInfo==0 ){ |
| 65728 | | - assert( pKey==0 ); |
| 66061 | + assert( pX->pKey==0 ); |
| 65729 | 66062 | /* If this is an insert into a table b-tree, invalidate any incrblob |
| 65730 | 66063 | ** cursors open on the row being replaced */ |
| 65731 | | - invalidateIncrblobCursors(p, nKey, 0); |
| 66064 | + invalidateIncrblobCursors(p, pX->nKey, 0); |
| 65732 | 66065 | |
| 65733 | 66066 | /* If the cursor is currently on the last row and we are appending a |
| 65734 | 66067 | ** new row onto the end, set the "loc" to avoid an unnecessary |
| 65735 | 66068 | ** btreeMoveto() call */ |
| 65736 | | - if( (pCur->curFlags&BTCF_ValidNKey)!=0 && nKey>0 |
| 65737 | | - && pCur->info.nKey==nKey-1 ){ |
| 66069 | + if( (pCur->curFlags&BTCF_ValidNKey)!=0 && pX->nKey>0 |
| 66070 | + && pCur->info.nKey==pX->nKey-1 ){ |
| 65738 | 66071 | loc = -1; |
| 65739 | 66072 | }else if( loc==0 ){ |
| 65740 | | - rc = sqlite3BtreeMovetoUnpacked(pCur, 0, nKey, appendBias, &loc); |
| 66073 | + rc = sqlite3BtreeMovetoUnpacked(pCur, 0, pX->nKey, appendBias, &loc); |
| 65741 | 66074 | if( rc ) return rc; |
| 65742 | 66075 | } |
| 65743 | 66076 | }else if( loc==0 ){ |
| 65744 | | - rc = btreeMoveto(pCur, pKey, nKey, appendBias, &loc); |
| 66077 | + rc = btreeMoveto(pCur, pX->pKey, pX->nKey, appendBias, &loc); |
| 65745 | 66078 | if( rc ) return rc; |
| 65746 | 66079 | } |
| 65747 | 66080 | assert( pCur->eState==CURSOR_VALID || (pCur->eState==CURSOR_INVALID && loc) ); |
| 65748 | 66081 | |
| 65749 | 66082 | pPage = pCur->apPage[pCur->iPage]; |
| 65750 | | - assert( pPage->intKey || nKey>=0 ); |
| 66083 | + assert( pPage->intKey || pX->nKey>=0 ); |
| 65751 | 66084 | assert( pPage->leaf || !pPage->intKey ); |
| 65752 | 66085 | |
| 65753 | 66086 | TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n", |
| 65754 | | - pCur->pgnoRoot, nKey, nData, pPage->pgno, |
| 66087 | + pCur->pgnoRoot, pX->nKey, pX->nData, pPage->pgno, |
| 65755 | 66088 | loc==0 ? "overwrite" : "new entry")); |
| 65756 | 66089 | assert( pPage->isInit ); |
| 65757 | 66090 | newCell = pBt->pTmpSpace; |
| 65758 | 66091 | assert( newCell!=0 ); |
| 65759 | | - rc = fillInCell(pPage, newCell, pKey, nKey, pData, nData, nZero, &szNew); |
| 66092 | + rc = fillInCell(pPage, newCell, pX, &szNew); |
| 65760 | 66093 | if( rc ) goto end_insert; |
| 65761 | 66094 | assert( szNew==pPage->xCellSize(pPage, newCell) ); |
| 65762 | 66095 | assert( szNew <= MX_CELL_SIZE(pBt) ); |
| 65763 | 66096 | idx = pCur->aiIdx[pCur->iPage]; |
| 65764 | 66097 | if( loc==0 ){ |
| | @@ -65780,10 +66113,11 @@ |
| 65780 | 66113 | idx = ++pCur->aiIdx[pCur->iPage]; |
| 65781 | 66114 | }else{ |
| 65782 | 66115 | assert( pPage->leaf ); |
| 65783 | 66116 | } |
| 65784 | 66117 | insertCell(pPage, idx, newCell, szNew, 0, 0, &rc); |
| 66118 | + assert( pPage->nOverflow==0 || rc==SQLITE_OK ); |
| 65785 | 66119 | assert( rc!=SQLITE_OK || pPage->nCell>0 || pPage->nOverflow>0 ); |
| 65786 | 66120 | |
| 65787 | 66121 | /* If no error has occurred and pPage has an overflow cell, call balance() |
| 65788 | 66122 | ** to redistribute the cells within the tree. Since balance() may move |
| 65789 | 66123 | ** the cursor, zero the BtCursor.info.nSize and BTCF_ValidNKey |
| | @@ -65803,11 +66137,12 @@ |
| 65803 | 66137 | ** entry in the table, and the next row inserted has an integer key |
| 65804 | 66138 | ** larger than the largest existing key, it is possible to insert the |
| 65805 | 66139 | ** row without seeking the cursor. This can be a big performance boost. |
| 65806 | 66140 | */ |
| 65807 | 66141 | pCur->info.nSize = 0; |
| 65808 | | - if( rc==SQLITE_OK && pPage->nOverflow ){ |
| 66142 | + if( pPage->nOverflow ){ |
| 66143 | + assert( rc==SQLITE_OK ); |
| 65809 | 66144 | pCur->curFlags &= ~(BTCF_ValidNKey); |
| 65810 | 66145 | rc = balance(pCur); |
| 65811 | 66146 | |
| 65812 | 66147 | /* Must make sure nOverflow is reset to zero even if the balance() |
| 65813 | 66148 | ** fails. Internal data structure corruption will result otherwise. |
| | @@ -65939,11 +66274,13 @@ |
| 65939 | 66274 | nCell = pLeaf->xCellSize(pLeaf, pCell); |
| 65940 | 66275 | assert( MX_CELL_SIZE(pBt) >= nCell ); |
| 65941 | 66276 | pTmp = pBt->pTmpSpace; |
| 65942 | 66277 | assert( pTmp!=0 ); |
| 65943 | 66278 | rc = sqlite3PagerWrite(pLeaf->pDbPage); |
| 65944 | | - insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n, &rc); |
| 66279 | + if( rc==SQLITE_OK ){ |
| 66280 | + insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n, &rc); |
| 66281 | + } |
| 65945 | 66282 | dropCell(pLeaf, pLeaf->nCell-1, nCell, &rc); |
| 65946 | 66283 | if( rc ) return rc; |
| 65947 | 66284 | } |
| 65948 | 66285 | |
| 65949 | 66286 | /* Balance the tree. If the entry deleted was located on a leaf page, |
| | @@ -67428,10 +67765,20 @@ |
| 67428 | 67765 | ** Return true if the Btree passed as the only argument is sharable. |
| 67429 | 67766 | */ |
| 67430 | 67767 | SQLITE_PRIVATE int sqlite3BtreeSharable(Btree *p){ |
| 67431 | 67768 | return p->sharable; |
| 67432 | 67769 | } |
| 67770 | + |
| 67771 | +/* |
| 67772 | +** Return the number of connections to the BtShared object accessed by |
| 67773 | +** the Btree handle passed as the only argument. For private caches |
| 67774 | +** this is always 1. For shared caches it may be 1 or greater. |
| 67775 | +*/ |
| 67776 | +SQLITE_PRIVATE int sqlite3BtreeConnectionCount(Btree *p){ |
| 67777 | + testcase( p->sharable ); |
| 67778 | + return p->pBt->nRef; |
| 67779 | +} |
| 67433 | 67780 | #endif |
| 67434 | 67781 | |
| 67435 | 67782 | /************** End of btree.c ***********************************************/ |
| 67436 | 67783 | /************** Begin file backup.c ******************************************/ |
| 67437 | 67784 | /* |
| | @@ -68218,12 +68565,10 @@ |
| 68218 | 68565 | sqlite3_backup_step(&b, 0x7FFFFFFF); |
| 68219 | 68566 | assert( b.rc!=SQLITE_OK ); |
| 68220 | 68567 | rc = sqlite3_backup_finish(&b); |
| 68221 | 68568 | if( rc==SQLITE_OK ){ |
| 68222 | 68569 | pTo->pBt->btsFlags &= ~BTS_PAGESIZE_FIXED; |
| 68223 | | - }else{ |
| 68224 | | - sqlite3PagerClearCache(sqlite3BtreePager(b.pDest)); |
| 68225 | 68570 | } |
| 68226 | 68571 | |
| 68227 | 68572 | assert( sqlite3BtreeIsInTrans(pTo)==0 ); |
| 68228 | 68573 | copy_finished: |
| 68229 | 68574 | sqlite3BtreeLeave(pFrom); |
| | @@ -69225,15 +69570,11 @@ |
| 69225 | 69570 | assert( !VdbeMemDynamic(pMem) ); |
| 69226 | 69571 | |
| 69227 | 69572 | /* Note: the calls to BtreeKeyFetch() and DataFetch() below assert() |
| 69228 | 69573 | ** that both the BtShared and database handle mutexes are held. */ |
| 69229 | 69574 | assert( (pMem->flags & MEM_RowSet)==0 ); |
| 69230 | | - if( key ){ |
| 69231 | | - zData = (char *)sqlite3BtreeKeyFetch(pCur, &available); |
| 69232 | | - }else{ |
| 69233 | | - zData = (char *)sqlite3BtreeDataFetch(pCur, &available); |
| 69234 | | - } |
| 69575 | + zData = (char *)sqlite3BtreePayloadFetch(pCur, &available); |
| 69235 | 69576 | assert( zData!=0 ); |
| 69236 | 69577 | |
| 69237 | 69578 | if( offset+amt<=available ){ |
| 69238 | 69579 | pMem->z = &zData[offset]; |
| 69239 | 69580 | pMem->flags = MEM_Blob|MEM_Ephem; |
| | @@ -70009,18 +70350,10 @@ |
| 70009 | 70350 | assert( p->zSql==0 ); |
| 70010 | 70351 | p->zSql = sqlite3DbStrNDup(p->db, z, n); |
| 70011 | 70352 | p->isPrepareV2 = (u8)isPrepareV2; |
| 70012 | 70353 | } |
| 70013 | 70354 | |
| 70014 | | -/* |
| 70015 | | -** Return the SQL associated with a prepared statement |
| 70016 | | -*/ |
| 70017 | | -SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt){ |
| 70018 | | - Vdbe *p = (Vdbe *)pStmt; |
| 70019 | | - return p ? p->zSql : 0; |
| 70020 | | -} |
| 70021 | | - |
| 70022 | 70355 | /* |
| 70023 | 70356 | ** Swap all content between two VDBE structures. |
| 70024 | 70357 | */ |
| 70025 | 70358 | SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){ |
| 70026 | 70359 | Vdbe tmp, *pTmp; |
| | @@ -70736,26 +71069,34 @@ |
| 70736 | 71069 | /* |
| 70737 | 71070 | ** If the input FuncDef structure is ephemeral, then free it. If |
| 70738 | 71071 | ** the FuncDef is not ephermal, then do nothing. |
| 70739 | 71072 | */ |
| 70740 | 71073 | static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef){ |
| 70741 | | - if( ALWAYS(pDef) && (pDef->funcFlags & SQLITE_FUNC_EPHEM)!=0 ){ |
| 71074 | + if( (pDef->funcFlags & SQLITE_FUNC_EPHEM)!=0 ){ |
| 70742 | 71075 | sqlite3DbFree(db, pDef); |
| 70743 | 71076 | } |
| 70744 | 71077 | } |
| 70745 | 71078 | |
| 70746 | 71079 | static void vdbeFreeOpArray(sqlite3 *, Op *, int); |
| 70747 | 71080 | |
| 70748 | 71081 | /* |
| 70749 | 71082 | ** Delete a P4 value if necessary. |
| 70750 | 71083 | */ |
| 71084 | +static SQLITE_NOINLINE void freeP4Mem(sqlite3 *db, Mem *p){ |
| 71085 | + if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc); |
| 71086 | + sqlite3DbFree(db, p); |
| 71087 | +} |
| 71088 | +static SQLITE_NOINLINE void freeP4FuncCtx(sqlite3 *db, sqlite3_context *p){ |
| 71089 | + freeEphemeralFunction(db, p->pFunc); |
| 71090 | + sqlite3DbFree(db, p); |
| 71091 | +} |
| 70751 | 71092 | static void freeP4(sqlite3 *db, int p4type, void *p4){ |
| 70752 | 71093 | assert( db ); |
| 70753 | 71094 | switch( p4type ){ |
| 70754 | 71095 | case P4_FUNCCTX: { |
| 70755 | | - freeEphemeralFunction(db, ((sqlite3_context*)p4)->pFunc); |
| 70756 | | - /* Fall through into the next case */ |
| 71096 | + freeP4FuncCtx(db, (sqlite3_context*)p4); |
| 71097 | + break; |
| 70757 | 71098 | } |
| 70758 | 71099 | case P4_REAL: |
| 70759 | 71100 | case P4_INT64: |
| 70760 | 71101 | case P4_DYNAMIC: |
| 70761 | 71102 | case P4_INTARRAY: { |
| | @@ -70782,13 +71123,11 @@ |
| 70782 | 71123 | } |
| 70783 | 71124 | case P4_MEM: { |
| 70784 | 71125 | if( db->pnBytesFreed==0 ){ |
| 70785 | 71126 | sqlite3ValueFree((sqlite3_value*)p4); |
| 70786 | 71127 | }else{ |
| 70787 | | - Mem *p = (Mem*)p4; |
| 70788 | | - if( p->szMalloc ) sqlite3DbFree(db, p->zMalloc); |
| 70789 | | - sqlite3DbFree(db, p); |
| 71128 | + freeP4Mem(db, (Mem*)p4); |
| 70790 | 71129 | } |
| 70791 | 71130 | break; |
| 70792 | 71131 | } |
| 70793 | 71132 | case P4_VTAB : { |
| 70794 | 71133 | if( db->pnBytesFreed==0 ) sqlite3VtabUnlock((VTable *)p4); |
| | @@ -74254,12 +74593,11 @@ |
| 74254 | 74593 | ** than 2GiB are support - anything large must be database corruption. |
| 74255 | 74594 | ** Any corruption is detected in sqlite3BtreeParseCellPtr(), though, so |
| 74256 | 74595 | ** this code can safely assume that nCellKey is 32-bits |
| 74257 | 74596 | */ |
| 74258 | 74597 | assert( sqlite3BtreeCursorIsValid(pCur) ); |
| 74259 | | - VVA_ONLY(rc =) sqlite3BtreeKeySize(pCur, &nCellKey); |
| 74260 | | - assert( rc==SQLITE_OK ); /* pCur is always valid so KeySize cannot fail */ |
| 74598 | + nCellKey = sqlite3BtreePayloadSize(pCur); |
| 74261 | 74599 | assert( (nCellKey & SQLITE_MAX_U32)==(u64)nCellKey ); |
| 74262 | 74600 | |
| 74263 | 74601 | /* Read in the complete content of the index entry */ |
| 74264 | 74602 | sqlite3VdbeMemInit(&m, db, 0); |
| 74265 | 74603 | rc = sqlite3VdbeMemFromBtree(pCur, 0, (u32)nCellKey, 1, &m); |
| | @@ -74332,12 +74670,11 @@ |
| 74332 | 74670 | Mem m; |
| 74333 | 74671 | |
| 74334 | 74672 | assert( pC->eCurType==CURTYPE_BTREE ); |
| 74335 | 74673 | pCur = pC->uc.pCursor; |
| 74336 | 74674 | assert( sqlite3BtreeCursorIsValid(pCur) ); |
| 74337 | | - VVA_ONLY(rc =) sqlite3BtreeKeySize(pCur, &nCellKey); |
| 74338 | | - assert( rc==SQLITE_OK ); /* pCur is always valid so KeySize cannot fail */ |
| 74675 | + nCellKey = sqlite3BtreePayloadSize(pCur); |
| 74339 | 74676 | /* nCellKey will always be between 0 and 0xffffffff because of the way |
| 74340 | 74677 | ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */ |
| 74341 | 74678 | if( nCellKey<=0 || nCellKey>0x7fffffff ){ |
| 74342 | 74679 | *res = 0; |
| 74343 | 74680 | return SQLITE_CORRUPT_BKPT; |
| | @@ -74595,16 +74932,23 @@ |
| 74595 | 74932 | ** Invoke the profile callback. This routine is only called if we already |
| 74596 | 74933 | ** know that the profile callback is defined and needs to be invoked. |
| 74597 | 74934 | */ |
| 74598 | 74935 | static SQLITE_NOINLINE void invokeProfileCallback(sqlite3 *db, Vdbe *p){ |
| 74599 | 74936 | sqlite3_int64 iNow; |
| 74937 | + sqlite3_int64 iElapse; |
| 74600 | 74938 | assert( p->startTime>0 ); |
| 74601 | | - assert( db->xProfile!=0 ); |
| 74939 | + assert( db->xProfile!=0 || (db->mTrace & SQLITE_TRACE_PROFILE)!=0 ); |
| 74602 | 74940 | assert( db->init.busy==0 ); |
| 74603 | 74941 | assert( p->zSql!=0 ); |
| 74604 | 74942 | sqlite3OsCurrentTimeInt64(db->pVfs, &iNow); |
| 74605 | | - db->xProfile(db->pProfileArg, p->zSql, (iNow - p->startTime)*1000000); |
| 74943 | + iElapse = (iNow - p->startTime)*1000000; |
| 74944 | + if( db->xProfile ){ |
| 74945 | + db->xProfile(db->pProfileArg, p->zSql, iElapse); |
| 74946 | + } |
| 74947 | + if( db->mTrace & SQLITE_TRACE_PROFILE ){ |
| 74948 | + db->xTrace(SQLITE_TRACE_PROFILE, db->pTraceArg, p, (void*)&iElapse); |
| 74949 | + } |
| 74606 | 74950 | p->startTime = 0; |
| 74607 | 74951 | } |
| 74608 | 74952 | /* |
| 74609 | 74953 | ** The checkProfileCallback(DB,P) macro checks to see if a profile callback |
| 74610 | 74954 | ** is needed, and it invokes the callback if it is needed. |
| | @@ -75104,11 +75448,12 @@ |
| 75104 | 75448 | assert( db->nVdbeWrite>0 || db->autoCommit==0 |
| 75105 | 75449 | || (db->nDeferredCons==0 && db->nDeferredImmCons==0) |
| 75106 | 75450 | ); |
| 75107 | 75451 | |
| 75108 | 75452 | #ifndef SQLITE_OMIT_TRACE |
| 75109 | | - if( db->xProfile && !db->init.busy && p->zSql ){ |
| 75453 | + if( (db->xProfile || (db->mTrace & SQLITE_TRACE_PROFILE)!=0) |
| 75454 | + && !db->init.busy && p->zSql ){ |
| 75110 | 75455 | sqlite3OsCurrentTimeInt64(db->pVfs, &p->startTime); |
| 75111 | 75456 | }else{ |
| 75112 | 75457 | assert( p->startTime==0 ); |
| 75113 | 75458 | } |
| 75114 | 75459 | #endif |
| | @@ -76138,10 +76483,43 @@ |
| 76138 | 76483 | #endif |
| 76139 | 76484 | v = pVdbe->aCounter[op]; |
| 76140 | 76485 | if( resetFlag ) pVdbe->aCounter[op] = 0; |
| 76141 | 76486 | return (int)v; |
| 76142 | 76487 | } |
| 76488 | + |
| 76489 | +/* |
| 76490 | +** Return the SQL associated with a prepared statement |
| 76491 | +*/ |
| 76492 | +SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt){ |
| 76493 | + Vdbe *p = (Vdbe *)pStmt; |
| 76494 | + return p ? p->zSql : 0; |
| 76495 | +} |
| 76496 | + |
| 76497 | +/* |
| 76498 | +** Return the SQL associated with a prepared statement with |
| 76499 | +** bound parameters expanded. Space to hold the returned string is |
| 76500 | +** obtained from sqlite3_malloc(). The caller is responsible for |
| 76501 | +** freeing the returned string by passing it to sqlite3_free(). |
| 76502 | +** |
| 76503 | +** The SQLITE_TRACE_SIZE_LIMIT puts an upper bound on the size of |
| 76504 | +** expanded bound parameters. |
| 76505 | +*/ |
| 76506 | +SQLITE_API char *SQLITE_STDCALL sqlite3_expanded_sql(sqlite3_stmt *pStmt){ |
| 76507 | +#ifdef SQLITE_OMIT_TRACE |
| 76508 | + return 0; |
| 76509 | +#else |
| 76510 | + char *z = 0; |
| 76511 | + const char *zSql = sqlite3_sql(pStmt); |
| 76512 | + if( zSql ){ |
| 76513 | + Vdbe *p = (Vdbe *)pStmt; |
| 76514 | + sqlite3_mutex_enter(p->db->mutex); |
| 76515 | + z = sqlite3VdbeExpandSql(p, zSql); |
| 76516 | + sqlite3_mutex_leave(p->db->mutex); |
| 76517 | + } |
| 76518 | + return z; |
| 76519 | +#endif |
| 76520 | +} |
| 76143 | 76521 | |
| 76144 | 76522 | #ifdef SQLITE_ENABLE_PREUPDATE_HOOK |
| 76145 | 76523 | /* |
| 76146 | 76524 | ** Allocate and populate an UnpackedRecord structure based on the serialized |
| 76147 | 76525 | ** record in nKey/pKey. Return a pointer to the new UnpackedRecord structure |
| | @@ -76185,12 +76563,11 @@ |
| 76185 | 76563 | /* If the old.* record has not yet been loaded into memory, do so now. */ |
| 76186 | 76564 | if( p->pUnpacked==0 ){ |
| 76187 | 76565 | u32 nRec; |
| 76188 | 76566 | u8 *aRec; |
| 76189 | 76567 | |
| 76190 | | - rc = sqlite3BtreeDataSize(p->pCsr->uc.pCursor, &nRec); |
| 76191 | | - if( rc!=SQLITE_OK ) goto preupdate_old_out; |
| 76568 | + nRec = sqlite3BtreePayloadSize(p->pCsr->uc.pCursor); |
| 76192 | 76569 | aRec = sqlite3DbMallocRaw(db, nRec); |
| 76193 | 76570 | if( !aRec ) goto preupdate_old_out; |
| 76194 | 76571 | rc = sqlite3BtreeData(p->pCsr->uc.pCursor, 0, nRec, aRec); |
| 76195 | 76572 | if( rc==SQLITE_OK ){ |
| 76196 | 76573 | p->pUnpacked = vdbeUnpackRecord(&p->keyinfo, nRec, aRec); |
| | @@ -76474,14 +76851,17 @@ |
| 76474 | 76851 | int n; /* Length of a token prefix */ |
| 76475 | 76852 | int nToken; /* Length of the parameter token */ |
| 76476 | 76853 | int i; /* Loop counter */ |
| 76477 | 76854 | Mem *pVar; /* Value of a host parameter */ |
| 76478 | 76855 | StrAccum out; /* Accumulate the output here */ |
| 76856 | +#ifndef SQLITE_OMIT_UTF16 |
| 76857 | + Mem utf8; /* Used to convert UTF16 parameters into UTF8 for display */ |
| 76858 | +#endif |
| 76479 | 76859 | char zBase[100]; /* Initial working space */ |
| 76480 | 76860 | |
| 76481 | 76861 | db = p->db; |
| 76482 | | - sqlite3StrAccumInit(&out, db, zBase, sizeof(zBase), |
| 76862 | + sqlite3StrAccumInit(&out, 0, zBase, sizeof(zBase), |
| 76483 | 76863 | db->aLimit[SQLITE_LIMIT_LENGTH]); |
| 76484 | 76864 | if( db->nVdbeExec>1 ){ |
| 76485 | 76865 | while( *zRawSql ){ |
| 76486 | 76866 | const char *zStart = zRawSql; |
| 76487 | 76867 | while( *(zRawSql++)!='\n' && *zRawSql ); |
| | @@ -76528,16 +76908,18 @@ |
| 76528 | 76908 | sqlite3XPrintf(&out, "%!.15g", pVar->u.r); |
| 76529 | 76909 | }else if( pVar->flags & MEM_Str ){ |
| 76530 | 76910 | int nOut; /* Number of bytes of the string text to include in output */ |
| 76531 | 76911 | #ifndef SQLITE_OMIT_UTF16 |
| 76532 | 76912 | u8 enc = ENC(db); |
| 76533 | | - Mem utf8; |
| 76534 | 76913 | if( enc!=SQLITE_UTF8 ){ |
| 76535 | 76914 | memset(&utf8, 0, sizeof(utf8)); |
| 76536 | 76915 | utf8.db = db; |
| 76537 | 76916 | sqlite3VdbeMemSetStr(&utf8, pVar->z, pVar->n, enc, SQLITE_STATIC); |
| 76538 | | - sqlite3VdbeChangeEncoding(&utf8, SQLITE_UTF8); |
| 76917 | + if( SQLITE_NOMEM==sqlite3VdbeChangeEncoding(&utf8, SQLITE_UTF8) ){ |
| 76918 | + out.accError = STRACCUM_NOMEM; |
| 76919 | + out.nAlloc = 0; |
| 76920 | + } |
| 76539 | 76921 | pVar = &utf8; |
| 76540 | 76922 | } |
| 76541 | 76923 | #endif |
| 76542 | 76924 | nOut = pVar->n; |
| 76543 | 76925 | #ifdef SQLITE_TRACE_SIZE_LIMIT |
| | @@ -76575,10 +76957,11 @@ |
| 76575 | 76957 | } |
| 76576 | 76958 | #endif |
| 76577 | 76959 | } |
| 76578 | 76960 | } |
| 76579 | 76961 | } |
| 76962 | + if( out.accError ) sqlite3StrAccumReset(&out); |
| 76580 | 76963 | return sqlite3StrAccumFinish(&out); |
| 76581 | 76964 | } |
| 76582 | 76965 | |
| 76583 | 76966 | #endif /* #ifndef SQLITE_OMIT_TRACE */ |
| 76584 | 76967 | |
| | @@ -77107,12 +77490,12 @@ |
| 77107 | 77490 | ****************************************************************************** |
| 77108 | 77491 | ** |
| 77109 | 77492 | ** This file contains inline asm code for retrieving "high-performance" |
| 77110 | 77493 | ** counters for x86 class CPUs. |
| 77111 | 77494 | */ |
| 77112 | | -#ifndef _HWTIME_H_ |
| 77113 | | -#define _HWTIME_H_ |
| 77495 | +#ifndef SQLITE_HWTIME_H |
| 77496 | +#define SQLITE_HWTIME_H |
| 77114 | 77497 | |
| 77115 | 77498 | /* |
| 77116 | 77499 | ** The following routine only works on pentium-class (or newer) processors. |
| 77117 | 77500 | ** It uses the RDTSC opcode to read the cycle count value out of the |
| 77118 | 77501 | ** processor and returns that value. This can be used for high-res |
| | @@ -77176,11 +77559,11 @@ |
| 77176 | 77559 | */ |
| 77177 | 77560 | SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } |
| 77178 | 77561 | |
| 77179 | 77562 | #endif |
| 77180 | 77563 | |
| 77181 | | -#endif /* !defined(_HWTIME_H_) */ |
| 77564 | +#endif /* !defined(SQLITE_HWTIME_H) */ |
| 77182 | 77565 | |
| 77183 | 77566 | /************** End of hwtime.h **********************************************/ |
| 77184 | 77567 | /************** Continuing where we left off in vdbe.c ***********************/ |
| 77185 | 77568 | |
| 77186 | 77569 | #endif |
| | @@ -78055,10 +78438,14 @@ |
| 78055 | 78438 | || (pMem[i].flags & (MEM_Str|MEM_Blob))==0 ); |
| 78056 | 78439 | sqlite3VdbeMemNulTerminate(&pMem[i]); |
| 78057 | 78440 | REGISTER_TRACE(pOp->p1+i, &pMem[i]); |
| 78058 | 78441 | } |
| 78059 | 78442 | if( db->mallocFailed ) goto no_mem; |
| 78443 | + |
| 78444 | + if( db->mTrace & SQLITE_TRACE_ROW ){ |
| 78445 | + db->xTrace(SQLITE_TRACE_ROW, db->pTraceArg, p, 0); |
| 78446 | + } |
| 78060 | 78447 | |
| 78061 | 78448 | /* Return SQLITE_ROW |
| 78062 | 78449 | */ |
| 78063 | 78450 | p->pc = (int)(pOp - aOp) + 1; |
| 78064 | 78451 | rc = SQLITE_ROW; |
| | @@ -78689,10 +79076,11 @@ |
| 78689 | 79076 | affinity = pOp->p5 & SQLITE_AFF_MASK; |
| 78690 | 79077 | if( affinity>=SQLITE_AFF_NUMERIC ){ |
| 78691 | 79078 | if( (flags1 | flags3)&MEM_Str ){ |
| 78692 | 79079 | if( (flags1 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){ |
| 78693 | 79080 | applyNumericAffinity(pIn1,0); |
| 79081 | + flags3 = pIn3->flags; |
| 78694 | 79082 | } |
| 78695 | 79083 | if( (flags3 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){ |
| 78696 | 79084 | applyNumericAffinity(pIn3,0); |
| 78697 | 79085 | } |
| 78698 | 79086 | } |
| | @@ -78701,10 +79089,11 @@ |
| 78701 | 79089 | testcase( pIn1->flags & MEM_Int ); |
| 78702 | 79090 | testcase( pIn1->flags & MEM_Real ); |
| 78703 | 79091 | sqlite3VdbeMemStringify(pIn1, encoding, 1); |
| 78704 | 79092 | testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) ); |
| 78705 | 79093 | flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask); |
| 79094 | + flags3 = pIn3->flags; |
| 78706 | 79095 | } |
| 78707 | 79096 | if( (flags3 & MEM_Str)==0 && (flags3 & (MEM_Int|MEM_Real))!=0 ){ |
| 78708 | 79097 | testcase( pIn3->flags & MEM_Int ); |
| 78709 | 79098 | testcase( pIn3->flags & MEM_Real ); |
| 78710 | 79099 | sqlite3VdbeMemStringify(pIn3, encoding, 1); |
| | @@ -79053,11 +79442,10 @@ |
| 79053 | 79442 | ** the result is guaranteed to only be used as the argument of a length() |
| 79054 | 79443 | ** or typeof() function, respectively. The loading of large blobs can be |
| 79055 | 79444 | ** skipped for length() and all content loading can be skipped for typeof(). |
| 79056 | 79445 | */ |
| 79057 | 79446 | case OP_Column: { |
| 79058 | | - i64 payloadSize64; /* Number of bytes in the record */ |
| 79059 | 79447 | int p2; /* column number to retrieve */ |
| 79060 | 79448 | VdbeCursor *pC; /* The VDBE cursor */ |
| 79061 | 79449 | BtCursor *pCrsr; /* The BTree cursor */ |
| 79062 | 79450 | u32 *aOffset; /* aOffset[i] is offset to start of data for i-th column */ |
| 79063 | 79451 | int len; /* The length of the serialized data for the column */ |
| | @@ -79076,10 +79464,11 @@ |
| 79076 | 79464 | pC = p->apCsr[pOp->p1]; |
| 79077 | 79465 | p2 = pOp->p2; |
| 79078 | 79466 | |
| 79079 | 79467 | /* If the cursor cache is stale, bring it up-to-date */ |
| 79080 | 79468 | rc = sqlite3VdbeCursorMoveto(&pC, &p2); |
| 79469 | + if( rc ) goto abort_due_to_error; |
| 79081 | 79470 | |
| 79082 | 79471 | assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) ); |
| 79083 | 79472 | pDest = &aMem[pOp->p3]; |
| 79084 | 79473 | memAboutToChange(p, pDest); |
| 79085 | 79474 | assert( pOp->p1>=0 && pOp->p1<p->nCursor ); |
| | @@ -79089,12 +79478,11 @@ |
| 79089 | 79478 | assert( pC->eCurType!=CURTYPE_VTAB ); |
| 79090 | 79479 | assert( pC->eCurType!=CURTYPE_PSEUDO || pC->nullRow ); |
| 79091 | 79480 | assert( pC->eCurType!=CURTYPE_SORTER ); |
| 79092 | 79481 | pCrsr = pC->uc.pCursor; |
| 79093 | 79482 | |
| 79094 | | - if( rc ) goto abort_due_to_error; |
| 79095 | | - if( pC->cacheStatus!=p->cacheCtr ){ |
| 79483 | + if( pC->cacheStatus!=p->cacheCtr ){ /*OPTIMIZATION-IF-FALSE*/ |
| 79096 | 79484 | if( pC->nullRow ){ |
| 79097 | 79485 | if( pC->eCurType==CURTYPE_PSEUDO ){ |
| 79098 | 79486 | assert( pC->uc.pseudoTableReg>0 ); |
| 79099 | 79487 | pReg = &aMem[pC->uc.pseudoTableReg]; |
| 79100 | 79488 | assert( pReg->flags & MEM_Blob ); |
| | @@ -79106,26 +79494,13 @@ |
| 79106 | 79494 | goto op_column_out; |
| 79107 | 79495 | } |
| 79108 | 79496 | }else{ |
| 79109 | 79497 | assert( pC->eCurType==CURTYPE_BTREE ); |
| 79110 | 79498 | assert( pCrsr ); |
| 79111 | | - if( pC->isTable==0 ){ |
| 79112 | | - assert( sqlite3BtreeCursorIsValid(pCrsr) ); |
| 79113 | | - VVA_ONLY(rc =) sqlite3BtreeKeySize(pCrsr, &payloadSize64); |
| 79114 | | - assert( rc==SQLITE_OK ); /* True because of CursorMoveto() call above */ |
| 79115 | | - /* sqlite3BtreeParseCellPtr() uses getVarint32() to extract the |
| 79116 | | - ** payload size, so it is impossible for payloadSize64 to be |
| 79117 | | - ** larger than 32 bits. */ |
| 79118 | | - assert( (payloadSize64 & SQLITE_MAX_U32)==(u64)payloadSize64 ); |
| 79119 | | - pC->aRow = sqlite3BtreeKeyFetch(pCrsr, &avail); |
| 79120 | | - pC->payloadSize = (u32)payloadSize64; |
| 79121 | | - }else{ |
| 79122 | | - assert( sqlite3BtreeCursorIsValid(pCrsr) ); |
| 79123 | | - VVA_ONLY(rc =) sqlite3BtreeDataSize(pCrsr, &pC->payloadSize); |
| 79124 | | - assert( rc==SQLITE_OK ); /* DataSize() cannot fail */ |
| 79125 | | - pC->aRow = sqlite3BtreeDataFetch(pCrsr, &avail); |
| 79126 | | - } |
| 79499 | + assert( sqlite3BtreeCursorIsValid(pCrsr) ); |
| 79500 | + pC->payloadSize = sqlite3BtreePayloadSize(pCrsr); |
| 79501 | + pC->aRow = sqlite3BtreePayloadFetch(pCrsr, &avail); |
| 79127 | 79502 | assert( avail<=65536 ); /* Maximum page size is 64KiB */ |
| 79128 | 79503 | if( pC->payloadSize <= (u32)avail ){ |
| 79129 | 79504 | pC->szRow = pC->payloadSize; |
| 79130 | 79505 | }else if( pC->payloadSize > (u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){ |
| 79131 | 79506 | goto too_big; |
| | @@ -79137,11 +79512,11 @@ |
| 79137 | 79512 | pC->iHdrOffset = getVarint32(pC->aRow, offset); |
| 79138 | 79513 | pC->nHdrParsed = 0; |
| 79139 | 79514 | aOffset[0] = offset; |
| 79140 | 79515 | |
| 79141 | 79516 | |
| 79142 | | - if( avail<offset ){ |
| 79517 | + if( avail<offset ){ /*OPTIMIZATION-IF-FALSE*/ |
| 79143 | 79518 | /* pC->aRow does not have to hold the entire row, but it does at least |
| 79144 | 79519 | ** need to cover the header of the record. If pC->aRow does not contain |
| 79145 | 79520 | ** the complete header, then set it to zero, forcing the header to be |
| 79146 | 79521 | ** dynamically allocated. */ |
| 79147 | 79522 | pC->aRow = 0; |
| | @@ -79158,28 +79533,28 @@ |
| 79158 | 79533 | */ |
| 79159 | 79534 | if( offset > 98307 || offset > pC->payloadSize ){ |
| 79160 | 79535 | rc = SQLITE_CORRUPT_BKPT; |
| 79161 | 79536 | goto abort_due_to_error; |
| 79162 | 79537 | } |
| 79163 | | - } |
| 79164 | | - |
| 79165 | | - /* The following goto is an optimization. It can be omitted and |
| 79166 | | - ** everything will still work. But OP_Column is measurably faster |
| 79167 | | - ** by skipping the subsequent conditional, which is always true. |
| 79168 | | - */ |
| 79169 | | - assert( pC->nHdrParsed<=p2 ); /* Conditional skipped */ |
| 79170 | | - goto op_column_read_header; |
| 79538 | + }else if( offset>0 ){ /*OPTIMIZATION-IF-TRUE*/ |
| 79539 | + /* The following goto is an optimization. It can be omitted and |
| 79540 | + ** everything will still work. But OP_Column is measurably faster |
| 79541 | + ** by skipping the subsequent conditional, which is always true. |
| 79542 | + */ |
| 79543 | + zData = pC->aRow; |
| 79544 | + assert( pC->nHdrParsed<=p2 ); /* Conditional skipped */ |
| 79545 | + goto op_column_read_header; |
| 79546 | + } |
| 79171 | 79547 | } |
| 79172 | 79548 | |
| 79173 | 79549 | /* Make sure at least the first p2+1 entries of the header have been |
| 79174 | 79550 | ** parsed and valid information is in aOffset[] and pC->aType[]. |
| 79175 | 79551 | */ |
| 79176 | 79552 | if( pC->nHdrParsed<=p2 ){ |
| 79177 | 79553 | /* If there is more header available for parsing in the record, try |
| 79178 | 79554 | ** to extract additional fields up through the p2+1-th field |
| 79179 | 79555 | */ |
| 79180 | | - op_column_read_header: |
| 79181 | 79556 | if( pC->iHdrOffset<aOffset[0] ){ |
| 79182 | 79557 | /* Make sure zData points to enough of the record to cover the header. */ |
| 79183 | 79558 | if( pC->aRow==0 ){ |
| 79184 | 79559 | memset(&sMem, 0, sizeof(sMem)); |
| 79185 | 79560 | rc = sqlite3VdbeMemFromBtree(pCrsr, 0, aOffset[0], !pC->isTable, &sMem); |
| | @@ -79188,15 +79563,15 @@ |
| 79188 | 79563 | }else{ |
| 79189 | 79564 | zData = pC->aRow; |
| 79190 | 79565 | } |
| 79191 | 79566 | |
| 79192 | 79567 | /* Fill in pC->aType[i] and aOffset[i] values through the p2-th field. */ |
| 79568 | + op_column_read_header: |
| 79193 | 79569 | i = pC->nHdrParsed; |
| 79194 | 79570 | offset64 = aOffset[i]; |
| 79195 | 79571 | zHdr = zData + pC->iHdrOffset; |
| 79196 | 79572 | zEndHdr = zData + aOffset[0]; |
| 79197 | | - assert( i<=p2 && zHdr<zEndHdr ); |
| 79198 | 79573 | do{ |
| 79199 | 79574 | if( (t = zHdr[0])<0x80 ){ |
| 79200 | 79575 | zHdr++; |
| 79201 | 79576 | offset64 += sqlite3VdbeOneByteSerialTypeLen(t); |
| 79202 | 79577 | }else{ |
| | @@ -79204,13 +79579,11 @@ |
| 79204 | 79579 | offset64 += sqlite3VdbeSerialTypeLen(t); |
| 79205 | 79580 | } |
| 79206 | 79581 | pC->aType[i++] = t; |
| 79207 | 79582 | aOffset[i] = (u32)(offset64 & 0xffffffff); |
| 79208 | 79583 | }while( i<=p2 && zHdr<zEndHdr ); |
| 79209 | | - pC->nHdrParsed = i; |
| 79210 | | - pC->iHdrOffset = (u32)(zHdr - zData); |
| 79211 | | - |
| 79584 | + |
| 79212 | 79585 | /* The record is corrupt if any of the following are true: |
| 79213 | 79586 | ** (1) the bytes of the header extend past the declared header size |
| 79214 | 79587 | ** (2) the entire header was used but not all data was used |
| 79215 | 79588 | ** (3) the end of the data extends beyond the end of the record. |
| 79216 | 79589 | */ |
| | @@ -79219,12 +79592,14 @@ |
| 79219 | 79592 | ){ |
| 79220 | 79593 | if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem); |
| 79221 | 79594 | rc = SQLITE_CORRUPT_BKPT; |
| 79222 | 79595 | goto abort_due_to_error; |
| 79223 | 79596 | } |
| 79597 | + |
| 79598 | + pC->nHdrParsed = i; |
| 79599 | + pC->iHdrOffset = (u32)(zHdr - zData); |
| 79224 | 79600 | if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem); |
| 79225 | | - |
| 79226 | 79601 | }else{ |
| 79227 | 79602 | t = 0; |
| 79228 | 79603 | } |
| 79229 | 79604 | |
| 79230 | 79605 | /* If after trying to extract new entries from the header, nHdrParsed is |
| | @@ -79248,13 +79623,14 @@ |
| 79248 | 79623 | ** all valid. |
| 79249 | 79624 | */ |
| 79250 | 79625 | assert( p2<pC->nHdrParsed ); |
| 79251 | 79626 | assert( rc==SQLITE_OK ); |
| 79252 | 79627 | assert( sqlite3VdbeCheckMemInvariants(pDest) ); |
| 79253 | | - if( VdbeMemDynamic(pDest) ) sqlite3VdbeMemSetNull(pDest); |
| 79628 | + if( VdbeMemDynamic(pDest) ){ |
| 79629 | + sqlite3VdbeMemSetNull(pDest); |
| 79630 | + } |
| 79254 | 79631 | assert( t==pC->aType[p2] ); |
| 79255 | | - pDest->enc = encoding; |
| 79256 | 79632 | if( pC->szRow>=aOffset[p2+1] ){ |
| 79257 | 79633 | /* This is the common case where the desired content fits on the original |
| 79258 | 79634 | ** page - where the content is not on an overflow page */ |
| 79259 | 79635 | zData = pC->aRow + aOffset[p2]; |
| 79260 | 79636 | if( t<12 ){ |
| | @@ -79264,10 +79640,11 @@ |
| 79264 | 79640 | ** a MEM_Ephem value. This branch is a fast short-cut that is equivalent |
| 79265 | 79641 | ** to calling sqlite3VdbeSerialGet() and sqlite3VdbeDeephemeralize(). |
| 79266 | 79642 | */ |
| 79267 | 79643 | static const u16 aFlag[] = { MEM_Blob, MEM_Str|MEM_Term }; |
| 79268 | 79644 | pDest->n = len = (t-12)/2; |
| 79645 | + pDest->enc = encoding; |
| 79269 | 79646 | if( pDest->szMalloc < len+2 ){ |
| 79270 | 79647 | pDest->flags = MEM_Null; |
| 79271 | 79648 | if( sqlite3VdbeMemGrow(pDest, len+2, 0) ) goto no_mem; |
| 79272 | 79649 | }else{ |
| 79273 | 79650 | pDest->z = pDest->zMalloc; |
| | @@ -79276,10 +79653,11 @@ |
| 79276 | 79653 | pDest->z[len] = 0; |
| 79277 | 79654 | pDest->z[len+1] = 0; |
| 79278 | 79655 | pDest->flags = aFlag[t&1]; |
| 79279 | 79656 | } |
| 79280 | 79657 | }else{ |
| 79658 | + pDest->enc = encoding; |
| 79281 | 79659 | /* This branch happens only when content is on overflow pages */ |
| 79282 | 79660 | if( ((pOp->p5 & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG))!=0 |
| 79283 | 79661 | && ((t>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0)) |
| 79284 | 79662 | || (len = sqlite3VdbeSerialTypeLen(t))==0 |
| 79285 | 79663 | ){ |
| | @@ -80693,10 +81071,34 @@ |
| 80693 | 81071 | if( takeJump || !alreadyExists ) goto jump_to_p2; |
| 80694 | 81072 | } |
| 80695 | 81073 | break; |
| 80696 | 81074 | } |
| 80697 | 81075 | |
| 81076 | +/* Opcode: SeekRowid P1 P2 P3 * * |
| 81077 | +** Synopsis: intkey=r[P3] |
| 81078 | +** |
| 81079 | +** P1 is the index of a cursor open on an SQL table btree (with integer |
| 81080 | +** keys). If register P3 does not contain an integer or if P1 does not |
| 81081 | +** contain a record with rowid P3 then jump immediately to P2. |
| 81082 | +** Or, if P2 is 0, raise an SQLITE_CORRUPT error. If P1 does contain |
| 81083 | +** a record with rowid P3 then |
| 81084 | +** leave the cursor pointing at that record and fall through to the next |
| 81085 | +** instruction. |
| 81086 | +** |
| 81087 | +** The OP_NotExists opcode performs the same operation, but with OP_NotExists |
| 81088 | +** the P3 register must be guaranteed to contain an integer value. With this |
| 81089 | +** opcode, register P3 might not contain an integer. |
| 81090 | +** |
| 81091 | +** The OP_NotFound opcode performs the same operation on index btrees |
| 81092 | +** (with arbitrary multi-value keys). |
| 81093 | +** |
| 81094 | +** This opcode leaves the cursor in a state where it cannot be advanced |
| 81095 | +** in either direction. In other words, the Next and Prev opcodes will |
| 81096 | +** not work following this opcode. |
| 81097 | +** |
| 81098 | +** See also: Found, NotFound, NoConflict, SeekRowid |
| 81099 | +*/ |
| 80698 | 81100 | /* Opcode: NotExists P1 P2 P3 * * |
| 80699 | 81101 | ** Synopsis: intkey=r[P3] |
| 80700 | 81102 | ** |
| 80701 | 81103 | ** P1 is the index of a cursor open on an SQL table btree (with integer |
| 80702 | 81104 | ** keys). P3 is an integer rowid. If P1 does not contain a record with |
| | @@ -80703,26 +81105,37 @@ |
| 80703 | 81105 | ** rowid P3 then jump immediately to P2. Or, if P2 is 0, raise an |
| 80704 | 81106 | ** SQLITE_CORRUPT error. If P1 does contain a record with rowid P3 then |
| 80705 | 81107 | ** leave the cursor pointing at that record and fall through to the next |
| 80706 | 81108 | ** instruction. |
| 80707 | 81109 | ** |
| 81110 | +** The OP_SeekRowid opcode performs the same operation but also allows the |
| 81111 | +** P3 register to contain a non-integer value, in which case the jump is |
| 81112 | +** always taken. This opcode requires that P3 always contain an integer. |
| 81113 | +** |
| 80708 | 81114 | ** The OP_NotFound opcode performs the same operation on index btrees |
| 80709 | 81115 | ** (with arbitrary multi-value keys). |
| 80710 | 81116 | ** |
| 80711 | 81117 | ** This opcode leaves the cursor in a state where it cannot be advanced |
| 80712 | 81118 | ** in either direction. In other words, the Next and Prev opcodes will |
| 80713 | 81119 | ** not work following this opcode. |
| 80714 | 81120 | ** |
| 80715 | | -** See also: Found, NotFound, NoConflict |
| 81121 | +** See also: Found, NotFound, NoConflict, SeekRowid |
| 80716 | 81122 | */ |
| 80717 | | -case OP_NotExists: { /* jump, in3 */ |
| 81123 | +case OP_SeekRowid: { /* jump, in3 */ |
| 80718 | 81124 | VdbeCursor *pC; |
| 80719 | 81125 | BtCursor *pCrsr; |
| 80720 | 81126 | int res; |
| 80721 | 81127 | u64 iKey; |
| 80722 | 81128 | |
| 80723 | 81129 | pIn3 = &aMem[pOp->p3]; |
| 81130 | + if( (pIn3->flags & MEM_Int)==0 ){ |
| 81131 | + applyAffinity(pIn3, SQLITE_AFF_NUMERIC, encoding); |
| 81132 | + if( (pIn3->flags & MEM_Int)==0 ) goto jump_to_p2; |
| 81133 | + } |
| 81134 | + /* Fall through into OP_NotExists */ |
| 81135 | +case OP_NotExists: /* jump, in3 */ |
| 81136 | + pIn3 = &aMem[pOp->p3]; |
| 80724 | 81137 | assert( pIn3->flags & MEM_Int ); |
| 80725 | 81138 | assert( pOp->p1>=0 && pOp->p1<p->nCursor ); |
| 80726 | 81139 | pC = p->apCsr[pOp->p1]; |
| 80727 | 81140 | assert( pC!=0 ); |
| 80728 | 81141 | #ifdef SQLITE_DEBUG |
| | @@ -80836,12 +81249,11 @@ |
| 80836 | 81249 | } |
| 80837 | 81250 | if( res ){ |
| 80838 | 81251 | v = 1; /* IMP: R-61914-48074 */ |
| 80839 | 81252 | }else{ |
| 80840 | 81253 | assert( sqlite3BtreeCursorIsValid(pC->uc.pCursor) ); |
| 80841 | | - rc = sqlite3BtreeKeySize(pC->uc.pCursor, &v); |
| 80842 | | - assert( rc==SQLITE_OK ); /* Cannot fail following BtreeLast() */ |
| 81254 | + v = sqlite3BtreeIntegerKey(pC->uc.pCursor); |
| 80843 | 81255 | if( v>=MAX_ROWID ){ |
| 80844 | 81256 | pC->useRandomRowid = 1; |
| 80845 | 81257 | }else{ |
| 80846 | 81258 | v++; /* IMP: R-29538-34987 */ |
| 80847 | 81259 | } |
| | @@ -80920,14 +81332,16 @@ |
| 80920 | 81332 | ** incremented (otherwise not). If the OPFLAG_LASTROWID flag of P5 is set, |
| 80921 | 81333 | ** then rowid is stored for subsequent return by the |
| 80922 | 81334 | ** sqlite3_last_insert_rowid() function (otherwise it is unmodified). |
| 80923 | 81335 | ** |
| 80924 | 81336 | ** If the OPFLAG_USESEEKRESULT flag of P5 is set and if the result of |
| 80925 | | -** the last seek operation (OP_NotExists) was a success, then this |
| 81337 | +** the last seek operation (OP_NotExists or OP_SeekRowid) was a success, |
| 81338 | +** then this |
| 80926 | 81339 | ** operation will not attempt to find the appropriate row before doing |
| 80927 | 81340 | ** the insert but will instead overwrite the row that the cursor is |
| 80928 | | -** currently pointing to. Presumably, the prior OP_NotExists opcode |
| 81341 | +** currently pointing to. Presumably, the prior OP_NotExists or |
| 81342 | +** OP_SeekRowid opcode |
| 80929 | 81343 | ** has already positioned the cursor correctly. This is an optimization |
| 80930 | 81344 | ** that boosts performance by avoiding redundant seeks. |
| 80931 | 81345 | ** |
| 80932 | 81346 | ** If the OPFLAG_ISUPDATE flag is set, then this opcode is part of an |
| 80933 | 81347 | ** UPDATE operation. Otherwise (if the flag is clear) then this opcode |
| | @@ -80955,17 +81369,16 @@ |
| 80955 | 81369 | */ |
| 80956 | 81370 | case OP_Insert: |
| 80957 | 81371 | case OP_InsertInt: { |
| 80958 | 81372 | Mem *pData; /* MEM cell holding data for the record to be inserted */ |
| 80959 | 81373 | Mem *pKey; /* MEM cell holding key for the record */ |
| 80960 | | - i64 iKey; /* The integer ROWID or key for the record to be inserted */ |
| 80961 | 81374 | VdbeCursor *pC; /* Cursor to table into which insert is written */ |
| 80962 | | - int nZero; /* Number of zero-bytes to append */ |
| 80963 | 81375 | int seekResult; /* Result of prior seek or 0 if no USESEEKRESULT flag */ |
| 80964 | 81376 | const char *zDb; /* database name - used by the update hook */ |
| 80965 | 81377 | Table *pTab; /* Table structure - used by update and pre-update hooks */ |
| 80966 | 81378 | int op; /* Opcode for update hook: SQLITE_UPDATE or SQLITE_INSERT */ |
| 81379 | + BtreePayload x; /* Payload to be inserted */ |
| 80967 | 81380 | |
| 80968 | 81381 | op = 0; |
| 80969 | 81382 | pData = &aMem[pOp->p2]; |
| 80970 | 81383 | assert( pOp->p1>=0 && pOp->p1<p->nCursor ); |
| 80971 | 81384 | assert( memIsValid(pData) ); |
| | @@ -80980,14 +81393,14 @@ |
| 80980 | 81393 | if( pOp->opcode==OP_Insert ){ |
| 80981 | 81394 | pKey = &aMem[pOp->p3]; |
| 80982 | 81395 | assert( pKey->flags & MEM_Int ); |
| 80983 | 81396 | assert( memIsValid(pKey) ); |
| 80984 | 81397 | REGISTER_TRACE(pOp->p3, pKey); |
| 80985 | | - iKey = pKey->u.i; |
| 81398 | + x.nKey = pKey->u.i; |
| 80986 | 81399 | }else{ |
| 80987 | 81400 | assert( pOp->opcode==OP_InsertInt ); |
| 80988 | | - iKey = pOp->p3; |
| 81401 | + x.nKey = pOp->p3; |
| 80989 | 81402 | } |
| 80990 | 81403 | |
| 80991 | 81404 | if( pOp->p4type==P4_TABLE && HAS_UPDATE_HOOK(db) ){ |
| 80992 | 81405 | assert( pC->isTable ); |
| 80993 | 81406 | assert( pC->iDb>=0 ); |
| | @@ -81004,39 +81417,41 @@ |
| 81004 | 81417 | /* Invoke the pre-update hook, if any */ |
| 81005 | 81418 | if( db->xPreUpdateCallback |
| 81006 | 81419 | && pOp->p4type==P4_TABLE |
| 81007 | 81420 | && !(pOp->p5 & OPFLAG_ISUPDATE) |
| 81008 | 81421 | ){ |
| 81009 | | - sqlite3VdbePreUpdateHook(p, pC, SQLITE_INSERT, zDb, pTab, iKey, pOp->p2); |
| 81422 | + sqlite3VdbePreUpdateHook(p, pC, SQLITE_INSERT, zDb, pTab, x.nKey, pOp->p2); |
| 81010 | 81423 | } |
| 81011 | 81424 | #endif |
| 81012 | 81425 | |
| 81013 | 81426 | if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++; |
| 81014 | | - if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = lastRowid = iKey; |
| 81427 | + if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = lastRowid = x.nKey; |
| 81015 | 81428 | if( pData->flags & MEM_Null ){ |
| 81016 | | - pData->z = 0; |
| 81017 | | - pData->n = 0; |
| 81429 | + x.pData = 0; |
| 81430 | + x.nData = 0; |
| 81018 | 81431 | }else{ |
| 81019 | 81432 | assert( pData->flags & (MEM_Blob|MEM_Str) ); |
| 81433 | + x.pData = pData->z; |
| 81434 | + x.nData = pData->n; |
| 81020 | 81435 | } |
| 81021 | 81436 | seekResult = ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0); |
| 81022 | 81437 | if( pData->flags & MEM_Zero ){ |
| 81023 | | - nZero = pData->u.nZero; |
| 81438 | + x.nZero = pData->u.nZero; |
| 81024 | 81439 | }else{ |
| 81025 | | - nZero = 0; |
| 81440 | + x.nZero = 0; |
| 81026 | 81441 | } |
| 81027 | | - rc = sqlite3BtreeInsert(pC->uc.pCursor, 0, iKey, |
| 81028 | | - pData->z, pData->n, nZero, |
| 81442 | + x.pKey = 0; |
| 81443 | + rc = sqlite3BtreeInsert(pC->uc.pCursor, &x, |
| 81029 | 81444 | (pOp->p5 & OPFLAG_APPEND)!=0, seekResult |
| 81030 | 81445 | ); |
| 81031 | 81446 | pC->deferredMoveto = 0; |
| 81032 | 81447 | pC->cacheStatus = CACHE_STALE; |
| 81033 | 81448 | |
| 81034 | 81449 | /* Invoke the update-hook if required. */ |
| 81035 | 81450 | if( rc ) goto abort_due_to_error; |
| 81036 | 81451 | if( db->xUpdateCallback && op ){ |
| 81037 | | - db->xUpdateCallback(db->pUpdateArg, op, zDb, pTab->zName, iKey); |
| 81452 | + db->xUpdateCallback(db->pUpdateArg, op, zDb, pTab->zName, x.nKey); |
| 81038 | 81453 | } |
| 81039 | 81454 | break; |
| 81040 | 81455 | } |
| 81041 | 81456 | |
| 81042 | 81457 | /* Opcode: Delete P1 P2 P3 P4 P5 |
| | @@ -81091,12 +81506,11 @@ |
| 81091 | 81506 | #ifdef SQLITE_DEBUG |
| 81092 | 81507 | if( pOp->p4type==P4_TABLE && HasRowid(pOp->p4.pTab) && pOp->p5==0 ){ |
| 81093 | 81508 | /* If p5 is zero, the seek operation that positioned the cursor prior to |
| 81094 | 81509 | ** OP_Delete will have also set the pC->movetoTarget field to the rowid of |
| 81095 | 81510 | ** the row that is being deleted */ |
| 81096 | | - i64 iKey = 0; |
| 81097 | | - sqlite3BtreeKeySize(pC->uc.pCursor, &iKey); |
| 81511 | + i64 iKey = sqlite3BtreeIntegerKey(pC->uc.pCursor); |
| 81098 | 81512 | assert( pC->movetoTarget==iKey ); |
| 81099 | 81513 | } |
| 81100 | 81514 | #endif |
| 81101 | 81515 | |
| 81102 | 81516 | /* If the update-hook or pre-update-hook will be invoked, set zDb to |
| | @@ -81108,11 +81522,11 @@ |
| 81108 | 81522 | assert( pC->iDb>=0 ); |
| 81109 | 81523 | assert( pOp->p4.pTab!=0 ); |
| 81110 | 81524 | zDb = db->aDb[pC->iDb].zName; |
| 81111 | 81525 | pTab = pOp->p4.pTab; |
| 81112 | 81526 | if( (pOp->p5 & OPFLAG_SAVEPOSITION)!=0 && pC->isTable ){ |
| 81113 | | - sqlite3BtreeKeySize(pC->uc.pCursor, &pC->movetoTarget); |
| 81527 | + pC->movetoTarget = sqlite3BtreeIntegerKey(pC->uc.pCursor); |
| 81114 | 81528 | } |
| 81115 | 81529 | }else{ |
| 81116 | 81530 | zDb = 0; /* Not needed. Silence a compiler warning. */ |
| 81117 | 81531 | pTab = 0; /* Not needed. Silence a compiler warning. */ |
| 81118 | 81532 | } |
| | @@ -81262,11 +81676,10 @@ |
| 81262 | 81676 | case OP_RowKey: |
| 81263 | 81677 | case OP_RowData: { |
| 81264 | 81678 | VdbeCursor *pC; |
| 81265 | 81679 | BtCursor *pCrsr; |
| 81266 | 81680 | u32 n; |
| 81267 | | - i64 n64; |
| 81268 | 81681 | |
| 81269 | 81682 | pOut = &aMem[pOp->p2]; |
| 81270 | 81683 | memAboutToChange(p, pOut); |
| 81271 | 81684 | |
| 81272 | 81685 | /* Note that RowKey and RowData are really exactly the same instruction */ |
| | @@ -81280,12 +81693,13 @@ |
| 81280 | 81693 | assert( pC->nullRow==0 ); |
| 81281 | 81694 | assert( pC->uc.pCursor!=0 ); |
| 81282 | 81695 | pCrsr = pC->uc.pCursor; |
| 81283 | 81696 | |
| 81284 | 81697 | /* The OP_RowKey and OP_RowData opcodes always follow OP_NotExists or |
| 81285 | | - ** OP_Rewind/Op_Next with no intervening instructions that might invalidate |
| 81286 | | - ** the cursor. If this where not the case, on of the following assert()s |
| 81698 | + ** OP_SeekRowid or OP_Rewind/Op_Next with no intervening instructions |
| 81699 | + ** that might invalidate the cursor. |
| 81700 | + ** If this where not the case, on of the following assert()s |
| 81287 | 81701 | ** would fail. Should this ever change (because of changes in the code |
| 81288 | 81702 | ** generator) then the fix would be to insert a call to |
| 81289 | 81703 | ** sqlite3VdbeCursorMoveto(). |
| 81290 | 81704 | */ |
| 81291 | 81705 | assert( pC->deferredMoveto==0 ); |
| | @@ -81293,24 +81707,13 @@ |
| 81293 | 81707 | #if 0 /* Not required due to the previous to assert() statements */ |
| 81294 | 81708 | rc = sqlite3VdbeCursorMoveto(pC); |
| 81295 | 81709 | if( rc!=SQLITE_OK ) goto abort_due_to_error; |
| 81296 | 81710 | #endif |
| 81297 | 81711 | |
| 81298 | | - if( pC->isTable==0 ){ |
| 81299 | | - assert( !pC->isTable ); |
| 81300 | | - VVA_ONLY(rc =) sqlite3BtreeKeySize(pCrsr, &n64); |
| 81301 | | - assert( rc==SQLITE_OK ); /* True because of CursorMoveto() call above */ |
| 81302 | | - if( n64>db->aLimit[SQLITE_LIMIT_LENGTH] ){ |
| 81303 | | - goto too_big; |
| 81304 | | - } |
| 81305 | | - n = (u32)n64; |
| 81306 | | - }else{ |
| 81307 | | - VVA_ONLY(rc =) sqlite3BtreeDataSize(pCrsr, &n); |
| 81308 | | - assert( rc==SQLITE_OK ); /* DataSize() cannot fail */ |
| 81309 | | - if( n>(u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){ |
| 81310 | | - goto too_big; |
| 81311 | | - } |
| 81712 | + n = sqlite3BtreePayloadSize(pCrsr); |
| 81713 | + if( n>(u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){ |
| 81714 | + goto too_big; |
| 81312 | 81715 | } |
| 81313 | 81716 | testcase( n==0 ); |
| 81314 | 81717 | if( sqlite3VdbeMemClearAndResize(pOut, MAX(n,32)) ){ |
| 81315 | 81718 | goto no_mem; |
| 81316 | 81719 | } |
| | @@ -81371,12 +81774,11 @@ |
| 81371 | 81774 | if( rc ) goto abort_due_to_error; |
| 81372 | 81775 | if( pC->nullRow ){ |
| 81373 | 81776 | pOut->flags = MEM_Null; |
| 81374 | 81777 | break; |
| 81375 | 81778 | } |
| 81376 | | - rc = sqlite3BtreeKeySize(pC->uc.pCursor, &v); |
| 81377 | | - assert( rc==SQLITE_OK ); /* Always so because of CursorRestore() above */ |
| 81779 | + v = sqlite3BtreeIntegerKey(pC->uc.pCursor); |
| 81378 | 81780 | } |
| 81379 | 81781 | pOut->u.i = v; |
| 81380 | 81782 | break; |
| 81381 | 81783 | } |
| 81382 | 81784 | |
| | @@ -81647,12 +82049,11 @@ |
| 81647 | 82049 | ** for tables is OP_Insert. |
| 81648 | 82050 | */ |
| 81649 | 82051 | case OP_SorterInsert: /* in2 */ |
| 81650 | 82052 | case OP_IdxInsert: { /* in2 */ |
| 81651 | 82053 | VdbeCursor *pC; |
| 81652 | | - int nKey; |
| 81653 | | - const char *zKey; |
| 82054 | + BtreePayload x; |
| 81654 | 82055 | |
| 81655 | 82056 | assert( pOp->p1>=0 && pOp->p1<p->nCursor ); |
| 81656 | 82057 | pC = p->apCsr[pOp->p1]; |
| 81657 | 82058 | assert( pC!=0 ); |
| 81658 | 82059 | assert( isSorter(pC)==(pOp->opcode==OP_SorterInsert) ); |
| | @@ -81664,13 +82065,16 @@ |
| 81664 | 82065 | rc = ExpandBlob(pIn2); |
| 81665 | 82066 | if( rc ) goto abort_due_to_error; |
| 81666 | 82067 | if( pOp->opcode==OP_SorterInsert ){ |
| 81667 | 82068 | rc = sqlite3VdbeSorterWrite(pC, pIn2); |
| 81668 | 82069 | }else{ |
| 81669 | | - nKey = pIn2->n; |
| 81670 | | - zKey = pIn2->z; |
| 81671 | | - rc = sqlite3BtreeInsert(pC->uc.pCursor, zKey, nKey, "", 0, 0, pOp->p3, |
| 82070 | + x.nKey = pIn2->n; |
| 82071 | + x.pKey = pIn2->z; |
| 82072 | + x.nData = 0; |
| 82073 | + x.nZero = 0; |
| 82074 | + x.pData = 0; |
| 82075 | + rc = sqlite3BtreeInsert(pC->uc.pCursor, &x, pOp->p3, |
| 81672 | 82076 | ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0) |
| 81673 | 82077 | ); |
| 81674 | 82078 | assert( pC->deferredMoveto==0 ); |
| 81675 | 82079 | pC->cacheStatus = CACHE_STALE; |
| 81676 | 82080 | } |
| | @@ -83437,17 +83841,25 @@ |
| 83437 | 83841 | case OP_Init: { /* jump */ |
| 83438 | 83842 | char *zTrace; |
| 83439 | 83843 | char *z; |
| 83440 | 83844 | |
| 83441 | 83845 | #ifndef SQLITE_OMIT_TRACE |
| 83442 | | - if( db->xTrace |
| 83846 | + if( (db->mTrace & (SQLITE_TRACE_STMT|SQLITE_TRACE_LEGACY))!=0 |
| 83443 | 83847 | && !p->doingRerun |
| 83444 | 83848 | && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0 |
| 83445 | 83849 | ){ |
| 83446 | 83850 | z = sqlite3VdbeExpandSql(p, zTrace); |
| 83447 | | - db->xTrace(db->pTraceArg, z); |
| 83448 | | - sqlite3DbFree(db, z); |
| 83851 | +#ifndef SQLITE_OMIT_DEPRECATED |
| 83852 | + if( db->mTrace & SQLITE_TRACE_LEGACY ){ |
| 83853 | + void (*x)(void*,const char*) = (void(*)(void*,const char*))db->xTrace; |
| 83854 | + x(db->pTraceArg, z); |
| 83855 | + }else |
| 83856 | +#endif |
| 83857 | + { |
| 83858 | + (void)db->xTrace(SQLITE_TRACE_STMT,db->pTraceArg,p,z); |
| 83859 | + } |
| 83860 | + sqlite3_free(z); |
| 83449 | 83861 | } |
| 83450 | 83862 | #ifdef SQLITE_USE_FCNTL_TRACE |
| 83451 | 83863 | zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql); |
| 83452 | 83864 | if( zTrace ){ |
| 83453 | 83865 | int i; |
| | @@ -84026,11 +84438,11 @@ |
| 84026 | 84438 | ** slightly more efficient). Since you cannot write to a PK column |
| 84027 | 84439 | ** using the incremental-blob API, this works. For the sessions module |
| 84028 | 84440 | ** anyhow. |
| 84029 | 84441 | */ |
| 84030 | 84442 | sqlite3_int64 iKey; |
| 84031 | | - sqlite3BtreeKeySize(p->pCsr, &iKey); |
| 84443 | + iKey = sqlite3BtreeIntegerKey(p->pCsr); |
| 84032 | 84444 | sqlite3VdbePreUpdateHook( |
| 84033 | 84445 | v, v->apCsr[0], SQLITE_DELETE, p->zDb, p->pTab, iKey, -1 |
| 84034 | 84446 | ); |
| 84035 | 84447 | } |
| 84036 | 84448 | #endif |
| | @@ -85461,41 +85873,47 @@ |
| 85461 | 85873 | } |
| 85462 | 85874 | |
| 85463 | 85875 | |
| 85464 | 85876 | /* |
| 85465 | 85877 | ** Merge the two sorted lists p1 and p2 into a single list. |
| 85466 | | -** Set *ppOut to the head of the new list. |
| 85467 | 85878 | */ |
| 85468 | | -static void vdbeSorterMerge( |
| 85879 | +static SorterRecord *vdbeSorterMerge( |
| 85469 | 85880 | SortSubtask *pTask, /* Calling thread context */ |
| 85470 | 85881 | SorterRecord *p1, /* First list to merge */ |
| 85471 | | - SorterRecord *p2, /* Second list to merge */ |
| 85472 | | - SorterRecord **ppOut /* OUT: Head of merged list */ |
| 85882 | + SorterRecord *p2 /* Second list to merge */ |
| 85473 | 85883 | ){ |
| 85474 | 85884 | SorterRecord *pFinal = 0; |
| 85475 | 85885 | SorterRecord **pp = &pFinal; |
| 85476 | 85886 | int bCached = 0; |
| 85477 | 85887 | |
| 85478 | | - while( p1 && p2 ){ |
| 85888 | + assert( p1!=0 && p2!=0 ); |
| 85889 | + for(;;){ |
| 85479 | 85890 | int res; |
| 85480 | 85891 | res = pTask->xCompare( |
| 85481 | 85892 | pTask, &bCached, SRVAL(p1), p1->nVal, SRVAL(p2), p2->nVal |
| 85482 | 85893 | ); |
| 85483 | 85894 | |
| 85484 | 85895 | if( res<=0 ){ |
| 85485 | 85896 | *pp = p1; |
| 85486 | 85897 | pp = &p1->u.pNext; |
| 85487 | 85898 | p1 = p1->u.pNext; |
| 85899 | + if( p1==0 ){ |
| 85900 | + *pp = p2; |
| 85901 | + break; |
| 85902 | + } |
| 85488 | 85903 | }else{ |
| 85489 | 85904 | *pp = p2; |
| 85490 | 85905 | pp = &p2->u.pNext; |
| 85491 | 85906 | p2 = p2->u.pNext; |
| 85492 | 85907 | bCached = 0; |
| 85908 | + if( p2==0 ){ |
| 85909 | + *pp = p1; |
| 85910 | + break; |
| 85911 | + } |
| 85493 | 85912 | } |
| 85494 | 85913 | } |
| 85495 | | - *pp = p1 ? p1 : p2; |
| 85496 | | - *ppOut = pFinal; |
| 85914 | + return pFinal; |
| 85497 | 85915 | } |
| 85498 | 85916 | |
| 85499 | 85917 | /* |
| 85500 | 85918 | ** Return the SorterCompare function to compare values collected by the |
| 85501 | 85919 | ** sorter object passed as the only argument. |
| | @@ -85544,20 +85962,21 @@ |
| 85544 | 85962 | pNext = p->u.pNext; |
| 85545 | 85963 | } |
| 85546 | 85964 | |
| 85547 | 85965 | p->u.pNext = 0; |
| 85548 | 85966 | for(i=0; aSlot[i]; i++){ |
| 85549 | | - vdbeSorterMerge(pTask, p, aSlot[i], &p); |
| 85967 | + p = vdbeSorterMerge(pTask, p, aSlot[i]); |
| 85550 | 85968 | aSlot[i] = 0; |
| 85551 | 85969 | } |
| 85552 | 85970 | aSlot[i] = p; |
| 85553 | 85971 | p = pNext; |
| 85554 | 85972 | } |
| 85555 | 85973 | |
| 85556 | 85974 | p = 0; |
| 85557 | 85975 | for(i=0; i<64; i++){ |
| 85558 | | - vdbeSorterMerge(pTask, p, aSlot[i], &p); |
| 85976 | + if( aSlot[i]==0 ) continue; |
| 85977 | + p = p ? vdbeSorterMerge(pTask, p, aSlot[i]) : aSlot[i]; |
| 85559 | 85978 | } |
| 85560 | 85979 | pList->pList = p; |
| 85561 | 85980 | |
| 85562 | 85981 | sqlite3_free(aSlot); |
| 85563 | 85982 | assert( pTask->pUnpacked->errCode==SQLITE_OK |
| | @@ -90773,10 +91192,15 @@ |
| 90773 | 91192 | VdbeComment((v, "%s", pIdx->zName)); |
| 90774 | 91193 | assert( IN_INDEX_INDEX_DESC == IN_INDEX_INDEX_ASC+1 ); |
| 90775 | 91194 | eType = IN_INDEX_INDEX_ASC + pIdx->aSortOrder[0]; |
| 90776 | 91195 | |
| 90777 | 91196 | if( prRhsHasNull && !pTab->aCol[iCol].notNull ){ |
| 91197 | +#ifdef SQLITE_ENABLE_COLUMN_USED_MASK |
| 91198 | + const i64 sOne = 1; |
| 91199 | + sqlite3VdbeAddOp4Dup8(v, OP_ColumnsUsed, |
| 91200 | + iTab, 0, 0, (u8*)&sOne, P4_INT64); |
| 91201 | +#endif |
| 90778 | 91202 | *prRhsHasNull = ++pParse->nMem; |
| 90779 | 91203 | sqlite3SetHasNullFlag(v, iTab, *prRhsHasNull); |
| 90780 | 91204 | } |
| 90781 | 91205 | sqlite3VdbeJumpHere(v, iAddr); |
| 90782 | 91206 | } |
| | @@ -90785,11 +91209,11 @@ |
| 90785 | 91209 | } |
| 90786 | 91210 | |
| 90787 | 91211 | /* If no preexisting index is available for the IN clause |
| 90788 | 91212 | ** and IN_INDEX_NOOP is an allowed reply |
| 90789 | 91213 | ** and the RHS of the IN operator is a list, not a subquery |
| 90790 | | - ** and the RHS is not contant or has two or fewer terms, |
| 91214 | + ** and the RHS is not constant or has two or fewer terms, |
| 90791 | 91215 | ** then it is not worth creating an ephemeral table to evaluate |
| 90792 | 91216 | ** the IN operator so return IN_INDEX_NOOP. |
| 90793 | 91217 | */ |
| 90794 | 91218 | if( eType==0 |
| 90795 | 91219 | && (inFlags & IN_INDEX_NOOP_OK) |
| | @@ -91177,12 +91601,11 @@ |
| 91177 | 91601 | } |
| 91178 | 91602 | |
| 91179 | 91603 | if( eType==IN_INDEX_ROWID ){ |
| 91180 | 91604 | /* In this case, the RHS is the ROWID of table b-tree |
| 91181 | 91605 | */ |
| 91182 | | - sqlite3VdbeAddOp2(v, OP_MustBeInt, r1, destIfFalse); VdbeCoverage(v); |
| 91183 | | - sqlite3VdbeAddOp3(v, OP_NotExists, pExpr->iTable, destIfFalse, r1); |
| 91606 | + sqlite3VdbeAddOp3(v, OP_SeekRowid, pExpr->iTable, destIfFalse, r1); |
| 91184 | 91607 | VdbeCoverage(v); |
| 91185 | 91608 | }else{ |
| 91186 | 91609 | /* In this case, the RHS is an index b-tree. |
| 91187 | 91610 | */ |
| 91188 | 91611 | sqlite3VdbeAddOp4(v, OP_Affinity, r1, 1, 0, &affinity, 1); |
| | @@ -91491,11 +91914,11 @@ |
| 91491 | 91914 | if( iCol<0 || iCol==pTab->iPKey ){ |
| 91492 | 91915 | sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut); |
| 91493 | 91916 | }else{ |
| 91494 | 91917 | int op = IsVirtual(pTab) ? OP_VColumn : OP_Column; |
| 91495 | 91918 | int x = iCol; |
| 91496 | | - if( !HasRowid(pTab) ){ |
| 91919 | + if( !HasRowid(pTab) && !IsVirtual(pTab) ){ |
| 91497 | 91920 | x = sqlite3ColumnOfIndex(sqlite3PrimaryKeyIndex(pTab), iCol); |
| 91498 | 91921 | } |
| 91499 | 91922 | sqlite3VdbeAddOp3(v, op, iTabCur, x, regOut); |
| 91500 | 91923 | } |
| 91501 | 91924 | if( iCol>=0 ){ |
| | @@ -93870,10 +94293,11 @@ |
| 93870 | 94293 | char *zCol; /* Null-terminated column definition */ |
| 93871 | 94294 | Column *pCol; /* The new column */ |
| 93872 | 94295 | Expr *pDflt; /* Default value for the new column */ |
| 93873 | 94296 | sqlite3 *db; /* The database connection; */ |
| 93874 | 94297 | Vdbe *v = pParse->pVdbe; /* The prepared statement under construction */ |
| 94298 | + int r1; /* Temporary registers */ |
| 93875 | 94299 | |
| 93876 | 94300 | db = pParse->db; |
| 93877 | 94301 | if( pParse->nErr || db->mallocFailed ) return; |
| 93878 | 94302 | assert( v!=0 ); |
| 93879 | 94303 | pNew = pParse->pNewTable; |
| | @@ -93964,20 +94388,22 @@ |
| 93964 | 94388 | ); |
| 93965 | 94389 | sqlite3DbFree(db, zCol); |
| 93966 | 94390 | db->flags = savedDbFlags; |
| 93967 | 94391 | } |
| 93968 | 94392 | |
| 93969 | | - /* If the default value of the new column is NULL, then the file |
| 93970 | | - ** format to 2. If the default value of the new column is not NULL, |
| 93971 | | - ** the file format be 3. Back when this feature was first added |
| 93972 | | - ** in 2006, we went to the trouble to upgrade the file format to the |
| 93973 | | - ** minimum support values. But 10-years on, we can assume that all |
| 93974 | | - ** extent versions of SQLite support file-format 4, so we always and |
| 93975 | | - ** unconditionally upgrade to 4. |
| 94393 | + /* Make sure the schema version is at least 3. But do not upgrade |
| 94394 | + ** from less than 3 to 4, as that will corrupt any preexisting DESC |
| 94395 | + ** index. |
| 93976 | 94396 | */ |
| 93977 | | - sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, |
| 93978 | | - SQLITE_MAX_FILE_FORMAT); |
| 94397 | + r1 = sqlite3GetTempReg(pParse); |
| 94398 | + sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, r1, BTREE_FILE_FORMAT); |
| 94399 | + sqlite3VdbeUsesBtree(v, iDb); |
| 94400 | + sqlite3VdbeAddOp2(v, OP_AddImm, r1, -2); |
| 94401 | + sqlite3VdbeAddOp2(v, OP_IfPos, r1, sqlite3VdbeCurrentAddr(v)+2); |
| 94402 | + VdbeCoverage(v); |
| 94403 | + sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3); |
| 94404 | + sqlite3ReleaseTempReg(pParse, r1); |
| 93979 | 94405 | |
| 93980 | 94406 | /* Reload the schema of the modified table. */ |
| 93981 | 94407 | reloadTableSchema(pParse, pTab, pTab->zName); |
| 93982 | 94408 | } |
| 93983 | 94409 | |
| | @@ -97152,11 +97578,11 @@ |
| 97152 | 97578 | ** routine leaves an error message in pParse->zErrMsg where |
| 97153 | 97579 | ** sqlite3FindTable() does not. |
| 97154 | 97580 | */ |
| 97155 | 97581 | SQLITE_PRIVATE Table *sqlite3LocateTable( |
| 97156 | 97582 | Parse *pParse, /* context in which to report errors */ |
| 97157 | | - int isView, /* True if looking for a VIEW rather than a TABLE */ |
| 97583 | + u32 flags, /* LOCATE_VIEW or LOCATE_NOERR */ |
| 97158 | 97584 | const char *zName, /* Name of the table we are looking for */ |
| 97159 | 97585 | const char *zDbase /* Name of the database. Might be NULL */ |
| 97160 | 97586 | ){ |
| 97161 | 97587 | Table *p; |
| 97162 | 97588 | |
| | @@ -97166,11 +97592,11 @@ |
| 97166 | 97592 | return 0; |
| 97167 | 97593 | } |
| 97168 | 97594 | |
| 97169 | 97595 | p = sqlite3FindTable(pParse->db, zName, zDbase); |
| 97170 | 97596 | if( p==0 ){ |
| 97171 | | - const char *zMsg = isView ? "no such view" : "no such table"; |
| 97597 | + const char *zMsg = flags & LOCATE_VIEW ? "no such view" : "no such table"; |
| 97172 | 97598 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 97173 | 97599 | if( sqlite3FindDbName(pParse->db, zDbase)<1 ){ |
| 97174 | 97600 | /* If zName is the not the name of a table in the schema created using |
| 97175 | 97601 | ** CREATE, then check to see if it is the name of an virtual table that |
| 97176 | 97602 | ** can be an eponymous virtual table. */ |
| | @@ -97178,16 +97604,18 @@ |
| 97178 | 97604 | if( pMod && sqlite3VtabEponymousTableInit(pParse, pMod) ){ |
| 97179 | 97605 | return pMod->pEpoTab; |
| 97180 | 97606 | } |
| 97181 | 97607 | } |
| 97182 | 97608 | #endif |
| 97183 | | - if( zDbase ){ |
| 97184 | | - sqlite3ErrorMsg(pParse, "%s: %s.%s", zMsg, zDbase, zName); |
| 97185 | | - }else{ |
| 97186 | | - sqlite3ErrorMsg(pParse, "%s: %s", zMsg, zName); |
| 97609 | + if( (flags & LOCATE_NOERR)==0 ){ |
| 97610 | + if( zDbase ){ |
| 97611 | + sqlite3ErrorMsg(pParse, "%s: %s.%s", zMsg, zDbase, zName); |
| 97612 | + }else{ |
| 97613 | + sqlite3ErrorMsg(pParse, "%s: %s", zMsg, zName); |
| 97614 | + } |
| 97615 | + pParse->checkSchema = 1; |
| 97187 | 97616 | } |
| 97188 | | - pParse->checkSchema = 1; |
| 97189 | 97617 | } |
| 97190 | 97618 | |
| 97191 | 97619 | return p; |
| 97192 | 97620 | } |
| 97193 | 97621 | |
| | @@ -97200,11 +97628,11 @@ |
| 97200 | 97628 | ** non-NULL if it is part of a view or trigger program definition. See |
| 97201 | 97629 | ** sqlite3FixSrcList() for details. |
| 97202 | 97630 | */ |
| 97203 | 97631 | SQLITE_PRIVATE Table *sqlite3LocateTableItem( |
| 97204 | 97632 | Parse *pParse, |
| 97205 | | - int isView, |
| 97633 | + u32 flags, |
| 97206 | 97634 | struct SrcList_item *p |
| 97207 | 97635 | ){ |
| 97208 | 97636 | const char *zDb; |
| 97209 | 97637 | assert( p->pSchema==0 || p->zDatabase==0 ); |
| 97210 | 97638 | if( p->pSchema ){ |
| | @@ -97211,11 +97639,11 @@ |
| 97211 | 97639 | int iDb = sqlite3SchemaToIndex(pParse->db, p->pSchema); |
| 97212 | 97640 | zDb = pParse->db->aDb[iDb].zName; |
| 97213 | 97641 | }else{ |
| 97214 | 97642 | zDb = p->zDatabase; |
| 97215 | 97643 | } |
| 97216 | | - return sqlite3LocateTable(pParse, isView, p->zName, zDb); |
| 97644 | + return sqlite3LocateTable(pParse, flags, p->zName, zDb); |
| 97217 | 97645 | } |
| 97218 | 97646 | |
| 97219 | 97647 | /* |
| 97220 | 97648 | ** Locate the in-memory structure that describes |
| 97221 | 97649 | ** a particular index given the name of that index |
| | @@ -97419,12 +97847,13 @@ |
| 97419 | 97847 | db->lookaside.nOut : 0 ); |
| 97420 | 97848 | |
| 97421 | 97849 | /* Delete all indices associated with this table. */ |
| 97422 | 97850 | for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){ |
| 97423 | 97851 | pNext = pIndex->pNext; |
| 97424 | | - assert( pIndex->pSchema==pTable->pSchema ); |
| 97425 | | - if( !db || db->pnBytesFreed==0 ){ |
| 97852 | + assert( pIndex->pSchema==pTable->pSchema |
| 97853 | + || (IsVirtual(pTable) && pIndex->idxType!=SQLITE_IDXTYPE_APPDEF) ); |
| 97854 | + if( (db==0 || db->pnBytesFreed==0) && !IsVirtual(pTable) ){ |
| 97426 | 97855 | char *zName = pIndex->zName; |
| 97427 | 97856 | TESTONLY ( Index *pOld = ) sqlite3HashInsert( |
| 97428 | 97857 | &pIndex->pSchema->idxHash, zName, 0 |
| 97429 | 97858 | ); |
| 97430 | 97859 | assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); |
| | @@ -98102,11 +98531,11 @@ |
| 98102 | 98531 | ){ |
| 98103 | 98532 | Table *pTab = pParse->pNewTable; |
| 98104 | 98533 | Column *pCol = 0; |
| 98105 | 98534 | int iCol = -1, i; |
| 98106 | 98535 | int nTerm; |
| 98107 | | - if( pTab==0 || IN_DECLARE_VTAB ) goto primary_key_exit; |
| 98536 | + if( pTab==0 ) goto primary_key_exit; |
| 98108 | 98537 | if( pTab->tabFlags & TF_HasPrimaryKey ){ |
| 98109 | 98538 | sqlite3ErrorMsg(pParse, |
| 98110 | 98539 | "table \"%s\" has more than one primary key", pTab->zName); |
| 98111 | 98540 | goto primary_key_exit; |
| 98112 | 98541 | } |
| | @@ -98148,16 +98577,12 @@ |
| 98148 | 98577 | #ifndef SQLITE_OMIT_AUTOINCREMENT |
| 98149 | 98578 | sqlite3ErrorMsg(pParse, "AUTOINCREMENT is only allowed on an " |
| 98150 | 98579 | "INTEGER PRIMARY KEY"); |
| 98151 | 98580 | #endif |
| 98152 | 98581 | }else{ |
| 98153 | | - Index *p; |
| 98154 | | - p = sqlite3CreateIndex(pParse, 0, 0, 0, pList, onError, 0, |
| 98155 | | - 0, sortOrder, 0); |
| 98156 | | - if( p ){ |
| 98157 | | - p->idxType = SQLITE_IDXTYPE_PRIMARYKEY; |
| 98158 | | - } |
| 98582 | + sqlite3CreateIndex(pParse, 0, 0, 0, pList, onError, 0, |
| 98583 | + 0, sortOrder, 0, SQLITE_IDXTYPE_PRIMARYKEY); |
| 98159 | 98584 | pList = 0; |
| 98160 | 98585 | } |
| 98161 | 98586 | |
| 98162 | 98587 | primary_key_exit: |
| 98163 | 98588 | sqlite3ExprListDelete(pParse->db, pList); |
| | @@ -98470,33 +98895,49 @@ |
| 98470 | 98895 | ** has a WITHOUT ROWID clause. The job of this routine is to convert both |
| 98471 | 98896 | ** internal schema data structures and the generated VDBE code so that they |
| 98472 | 98897 | ** are appropriate for a WITHOUT ROWID table instead of a rowid table. |
| 98473 | 98898 | ** Changes include: |
| 98474 | 98899 | ** |
| 98475 | | -** (1) Convert the OP_CreateTable into an OP_CreateIndex. There is |
| 98900 | +** (1) Set all columns of the PRIMARY KEY schema object to be NOT NULL. |
| 98901 | +** (2) Convert the OP_CreateTable into an OP_CreateIndex. There is |
| 98476 | 98902 | ** no rowid btree for a WITHOUT ROWID. Instead, the canonical |
| 98477 | 98903 | ** data storage is a covering index btree. |
| 98478 | | -** (2) Bypass the creation of the sqlite_master table entry |
| 98904 | +** (3) Bypass the creation of the sqlite_master table entry |
| 98479 | 98905 | ** for the PRIMARY KEY as the primary key index is now |
| 98480 | 98906 | ** identified by the sqlite_master table entry of the table itself. |
| 98481 | | -** (3) Set the Index.tnum of the PRIMARY KEY Index object in the |
| 98907 | +** (4) Set the Index.tnum of the PRIMARY KEY Index object in the |
| 98482 | 98908 | ** schema to the rootpage from the main table. |
| 98483 | | -** (4) Set all columns of the PRIMARY KEY schema object to be NOT NULL. |
| 98484 | 98909 | ** (5) Add all table columns to the PRIMARY KEY Index object |
| 98485 | 98910 | ** so that the PRIMARY KEY is a covering index. The surplus |
| 98486 | 98911 | ** columns are part of KeyInfo.nXField and are not used for |
| 98487 | 98912 | ** sorting or lookup or uniqueness checks. |
| 98488 | 98913 | ** (6) Replace the rowid tail on all automatically generated UNIQUE |
| 98489 | 98914 | ** indices with the PRIMARY KEY columns. |
| 98915 | +** |
| 98916 | +** For virtual tables, only (1) is performed. |
| 98490 | 98917 | */ |
| 98491 | 98918 | static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ |
| 98492 | 98919 | Index *pIdx; |
| 98493 | 98920 | Index *pPk; |
| 98494 | 98921 | int nPk; |
| 98495 | 98922 | int i, j; |
| 98496 | 98923 | sqlite3 *db = pParse->db; |
| 98497 | 98924 | Vdbe *v = pParse->pVdbe; |
| 98925 | + |
| 98926 | + /* Mark every PRIMARY KEY column as NOT NULL (except for imposter tables) |
| 98927 | + */ |
| 98928 | + if( !db->init.imposterTable ){ |
| 98929 | + for(i=0; i<pTab->nCol; i++){ |
| 98930 | + if( (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0 ){ |
| 98931 | + pTab->aCol[i].notNull = OE_Abort; |
| 98932 | + } |
| 98933 | + } |
| 98934 | + } |
| 98935 | + |
| 98936 | + /* The remaining transformations only apply to b-tree tables, not to |
| 98937 | + ** virtual tables */ |
| 98938 | + if( IN_DECLARE_VTAB ) return; |
| 98498 | 98939 | |
| 98499 | 98940 | /* Convert the OP_CreateTable opcode that would normally create the |
| 98500 | 98941 | ** root-page for the table into an OP_CreateIndex opcode. The index |
| 98501 | 98942 | ** created will become the PRIMARY KEY index. |
| 98502 | 98943 | */ |
| | @@ -98515,13 +98956,14 @@ |
| 98515 | 98956 | pList = sqlite3ExprListAppend(pParse, 0, |
| 98516 | 98957 | sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0)); |
| 98517 | 98958 | if( pList==0 ) return; |
| 98518 | 98959 | pList->a[0].sortOrder = pParse->iPkSortOrder; |
| 98519 | 98960 | assert( pParse->pNewTable==pTab ); |
| 98520 | | - pPk = sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0); |
| 98521 | | - if( pPk==0 ) return; |
| 98522 | | - pPk->idxType = SQLITE_IDXTYPE_PRIMARYKEY; |
| 98961 | + sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, |
| 98962 | + SQLITE_IDXTYPE_PRIMARYKEY); |
| 98963 | + if( db->mallocFailed ) return; |
| 98964 | + pPk = sqlite3PrimaryKeyIndex(pTab); |
| 98523 | 98965 | pTab->iPKey = -1; |
| 98524 | 98966 | }else{ |
| 98525 | 98967 | pPk = sqlite3PrimaryKeyIndex(pTab); |
| 98526 | 98968 | |
| 98527 | 98969 | /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master |
| | @@ -98545,23 +98987,15 @@ |
| 98545 | 98987 | pPk->aiColumn[j++] = pPk->aiColumn[i]; |
| 98546 | 98988 | } |
| 98547 | 98989 | } |
| 98548 | 98990 | pPk->nKeyCol = j; |
| 98549 | 98991 | } |
| 98550 | | - pPk->isCovering = 1; |
| 98551 | 98992 | assert( pPk!=0 ); |
| 98993 | + pPk->isCovering = 1; |
| 98994 | + if( !db->init.imposterTable ) pPk->uniqNotNull = 1; |
| 98552 | 98995 | nPk = pPk->nKeyCol; |
| 98553 | 98996 | |
| 98554 | | - /* Make sure every column of the PRIMARY KEY is NOT NULL. (Except, |
| 98555 | | - ** do not enforce this for imposter tables.) */ |
| 98556 | | - if( !db->init.imposterTable ){ |
| 98557 | | - for(i=0; i<nPk; i++){ |
| 98558 | | - pTab->aCol[pPk->aiColumn[i]].notNull = OE_Abort; |
| 98559 | | - } |
| 98560 | | - pPk->uniqNotNull = 1; |
| 98561 | | - } |
| 98562 | | - |
| 98563 | 98997 | /* The root page of the PRIMARY KEY is the table root page */ |
| 98564 | 98998 | pPk->tnum = pTab->tnum; |
| 98565 | 98999 | |
| 98566 | 99000 | /* Update the in-memory representation of all UNIQUE indices by converting |
| 98567 | 99001 | ** the final rowid column into one or more columns of the PRIMARY KEY. |
| | @@ -99312,10 +99746,11 @@ |
| 99312 | 99746 | } |
| 99313 | 99747 | assert( pParse->nErr==0 ); |
| 99314 | 99748 | assert( pName->nSrc==1 ); |
| 99315 | 99749 | if( sqlite3ReadSchema(pParse) ) goto exit_drop_table; |
| 99316 | 99750 | if( noErr ) db->suppressErr++; |
| 99751 | + assert( isView==0 || isView==LOCATE_VIEW ); |
| 99317 | 99752 | pTab = sqlite3LocateTableItem(pParse, isView, &pName->a[0]); |
| 99318 | 99753 | if( noErr ) db->suppressErr--; |
| 99319 | 99754 | |
| 99320 | 99755 | if( pTab==0 ){ |
| 99321 | 99756 | if( noErr ) sqlite3CodeVerifyNamedSchema(pParse, pName->a[0].zDatabase); |
| | @@ -99682,28 +100117,24 @@ |
| 99682 | 100117 | ** currently being constructed by a CREATE TABLE statement. |
| 99683 | 100118 | ** |
| 99684 | 100119 | ** pList is a list of columns to be indexed. pList will be NULL if this |
| 99685 | 100120 | ** is a primary key or unique-constraint on the most recent column added |
| 99686 | 100121 | ** to the table currently under construction. |
| 99687 | | -** |
| 99688 | | -** If the index is created successfully, return a pointer to the new Index |
| 99689 | | -** structure. This is used by sqlite3AddPrimaryKey() to mark the index |
| 99690 | | -** as the tables primary key (Index.idxType==SQLITE_IDXTYPE_PRIMARYKEY) |
| 99691 | 100122 | */ |
| 99692 | | -SQLITE_PRIVATE Index *sqlite3CreateIndex( |
| 100123 | +SQLITE_PRIVATE void sqlite3CreateIndex( |
| 99693 | 100124 | Parse *pParse, /* All information about this parse */ |
| 99694 | 100125 | Token *pName1, /* First part of index name. May be NULL */ |
| 99695 | 100126 | Token *pName2, /* Second part of index name. May be NULL */ |
| 99696 | 100127 | SrcList *pTblName, /* Table to index. Use pParse->pNewTable if 0 */ |
| 99697 | 100128 | ExprList *pList, /* A list of columns to be indexed */ |
| 99698 | 100129 | int onError, /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */ |
| 99699 | 100130 | Token *pStart, /* The CREATE token that begins this statement */ |
| 99700 | 100131 | Expr *pPIWhere, /* WHERE clause for partial indices */ |
| 99701 | 100132 | int sortOrder, /* Sort order of primary key when pList==NULL */ |
| 99702 | | - int ifNotExist /* Omit error if index already exists */ |
| 100133 | + int ifNotExist, /* Omit error if index already exists */ |
| 100134 | + u8 idxType /* The index type */ |
| 99703 | 100135 | ){ |
| 99704 | | - Index *pRet = 0; /* Pointer to return */ |
| 99705 | 100136 | Table *pTab = 0; /* Table to be indexed */ |
| 99706 | 100137 | Index *pIndex = 0; /* The index to be created */ |
| 99707 | 100138 | char *zName = 0; /* Name of the index */ |
| 99708 | 100139 | int nName; /* Number of characters in zName */ |
| 99709 | 100140 | int i, j; |
| | @@ -99717,11 +100148,14 @@ |
| 99717 | 100148 | int nExtra = 0; /* Space allocated for zExtra[] */ |
| 99718 | 100149 | int nExtraCol; /* Number of extra columns needed */ |
| 99719 | 100150 | char *zExtra = 0; /* Extra space after the Index object */ |
| 99720 | 100151 | Index *pPk = 0; /* PRIMARY KEY index for WITHOUT ROWID tables */ |
| 99721 | 100152 | |
| 99722 | | - if( db->mallocFailed || IN_DECLARE_VTAB || pParse->nErr>0 ){ |
| 100153 | + if( db->mallocFailed || pParse->nErr>0 ){ |
| 100154 | + goto exit_create_index; |
| 100155 | + } |
| 100156 | + if( IN_DECLARE_VTAB && idxType!=SQLITE_IDXTYPE_PRIMARYKEY ){ |
| 99723 | 100157 | goto exit_create_index; |
| 99724 | 100158 | } |
| 99725 | 100159 | if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ |
| 99726 | 100160 | goto exit_create_index; |
| 99727 | 100161 | } |
| | @@ -99906,11 +100340,11 @@ |
| 99906 | 100340 | zExtra += nName + 1; |
| 99907 | 100341 | memcpy(pIndex->zName, zName, nName+1); |
| 99908 | 100342 | pIndex->pTable = pTab; |
| 99909 | 100343 | pIndex->onError = (u8)onError; |
| 99910 | 100344 | pIndex->uniqNotNull = onError!=OE_None; |
| 99911 | | - pIndex->idxType = pName ? SQLITE_IDXTYPE_APPDEF : SQLITE_IDXTYPE_UNIQUE; |
| 100345 | + pIndex->idxType = idxType; |
| 99912 | 100346 | pIndex->pSchema = db->aDb[iDb].pSchema; |
| 99913 | 100347 | pIndex->nKeyCol = pList->nExpr; |
| 99914 | 100348 | if( pPIWhere ){ |
| 99915 | 100349 | sqlite3ResolveSelfReference(pParse, pTab, NC_PartIdx, pPIWhere, 0); |
| 99916 | 100350 | pIndex->pPartIdxWhere = pPIWhere; |
| | @@ -100086,11 +100520,11 @@ |
| 100086 | 100520 | } |
| 100087 | 100521 | if( pIdx->onError==OE_Default ){ |
| 100088 | 100522 | pIdx->onError = pIndex->onError; |
| 100089 | 100523 | } |
| 100090 | 100524 | } |
| 100091 | | - pRet = pIdx; |
| 100525 | + if( idxType==SQLITE_IDXTYPE_PRIMARYKEY ) pIdx->idxType = idxType; |
| 100092 | 100526 | goto exit_create_index; |
| 100093 | 100527 | } |
| 100094 | 100528 | } |
| 100095 | 100529 | } |
| 100096 | 100530 | |
| | @@ -100098,10 +100532,11 @@ |
| 100098 | 100532 | ** in-memory database structures. |
| 100099 | 100533 | */ |
| 100100 | 100534 | assert( pParse->nErr==0 ); |
| 100101 | 100535 | if( db->init.busy ){ |
| 100102 | 100536 | Index *p; |
| 100537 | + assert( !IN_DECLARE_VTAB ); |
| 100103 | 100538 | assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); |
| 100104 | 100539 | p = sqlite3HashInsert(&pIndex->pSchema->idxHash, |
| 100105 | 100540 | pIndex->zName, pIndex); |
| 100106 | 100541 | if( p ){ |
| 100107 | 100542 | assert( p==pIndex ); /* Malloc must have failed */ |
| | @@ -100179,11 +100614,11 @@ |
| 100179 | 100614 | if( pTblName ){ |
| 100180 | 100615 | sqlite3RefillIndex(pParse, pIndex, iMem); |
| 100181 | 100616 | sqlite3ChangeCookie(pParse, iDb); |
| 100182 | 100617 | sqlite3VdbeAddParseSchemaOp(v, iDb, |
| 100183 | 100618 | sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName)); |
| 100184 | | - sqlite3VdbeAddOp1(v, OP_Expire, 0); |
| 100619 | + sqlite3VdbeAddOp0(v, OP_Expire); |
| 100185 | 100620 | } |
| 100186 | 100621 | |
| 100187 | 100622 | sqlite3VdbeJumpHere(v, pIndex->tnum); |
| 100188 | 100623 | } |
| 100189 | 100624 | |
| | @@ -100204,11 +100639,10 @@ |
| 100204 | 100639 | pOther = pOther->pNext; |
| 100205 | 100640 | } |
| 100206 | 100641 | pIndex->pNext = pOther->pNext; |
| 100207 | 100642 | pOther->pNext = pIndex; |
| 100208 | 100643 | } |
| 100209 | | - pRet = pIndex; |
| 100210 | 100644 | pIndex = 0; |
| 100211 | 100645 | } |
| 100212 | 100646 | |
| 100213 | 100647 | /* Clean up before exiting */ |
| 100214 | 100648 | exit_create_index: |
| | @@ -100215,11 +100649,10 @@ |
| 100215 | 100649 | if( pIndex ) freeIndex(db, pIndex); |
| 100216 | 100650 | sqlite3ExprDelete(db, pPIWhere); |
| 100217 | 100651 | sqlite3ExprListDelete(db, pList); |
| 100218 | 100652 | sqlite3SrcListDelete(db, pTblName); |
| 100219 | 100653 | sqlite3DbFree(db, zName); |
| 100220 | | - return pRet; |
| 100221 | 100654 | } |
| 100222 | 100655 | |
| 100223 | 100656 | /* |
| 100224 | 100657 | ** Fill the Index.aiRowEst[] array with default information - information |
| 100225 | 100658 | ** to be used when we have not run the ANALYZE command. |
| | @@ -100244,14 +100677,15 @@ |
| 100244 | 100677 | LogEst *a = pIdx->aiRowLogEst; |
| 100245 | 100678 | int nCopy = MIN(ArraySize(aVal), pIdx->nKeyCol); |
| 100246 | 100679 | int i; |
| 100247 | 100680 | |
| 100248 | 100681 | /* Set the first entry (number of rows in the index) to the estimated |
| 100249 | | - ** number of rows in the table. Or 10, if the estimated number of rows |
| 100250 | | - ** in the table is less than that. */ |
| 100682 | + ** number of rows in the table, or half the number of rows in the table |
| 100683 | + ** for a partial index. But do not let the estimate drop below 10. */ |
| 100251 | 100684 | a[0] = pIdx->pTable->nRowLogEst; |
| 100252 | | - if( a[0]<33 ) a[0] = 33; assert( 33==sqlite3LogEst(10) ); |
| 100685 | + if( pIdx->pPartIdxWhere!=0 ) a[0] -= 10; assert( 10==sqlite3LogEst(2) ); |
| 100686 | + if( a[0]<33 ) a[0] = 33; assert( 33==sqlite3LogEst(10) ); |
| 100253 | 100687 | |
| 100254 | 100688 | /* Estimate that a[1] is 10, a[2] is 9, a[3] is 8, a[4] is 7, a[5] is |
| 100255 | 100689 | ** 6 and each subsequent value (if any) is 5. */ |
| 100256 | 100690 | memcpy(&a[1], aVal, nCopy*sizeof(LogEst)); |
| 100257 | 100691 | for(i=nCopy+1; i<=pIdx->nKeyCol; i++){ |
| | @@ -101129,14 +101563,10 @@ |
| 101129 | 101563 | #endif |
| 101130 | 101564 | |
| 101131 | 101565 | /* |
| 101132 | 101566 | ** Return a KeyInfo structure that is appropriate for the given Index. |
| 101133 | 101567 | ** |
| 101134 | | -** The KeyInfo structure for an index is cached in the Index object. |
| 101135 | | -** So there might be multiple references to the returned pointer. The |
| 101136 | | -** caller should not try to modify the KeyInfo object. |
| 101137 | | -** |
| 101138 | 101568 | ** The caller should invoke sqlite3KeyInfoUnref() on the returned object |
| 101139 | 101569 | ** when it has finished using it. |
| 101140 | 101570 | */ |
| 101141 | 101571 | SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoOfIndex(Parse *pParse, Index *pIdx){ |
| 101142 | 101572 | int i; |
| | @@ -103364,11 +103794,11 @@ |
| 103364 | 103794 | continue; |
| 103365 | 103795 | } |
| 103366 | 103796 | } |
| 103367 | 103797 | c2 = Utf8Read(zString); |
| 103368 | 103798 | if( c==c2 ) continue; |
| 103369 | | - if( noCase && c<0x80 && c2<0x80 && sqlite3Tolower(c)==sqlite3Tolower(c2) ){ |
| 103799 | + if( noCase && sqlite3Tolower(c)==sqlite3Tolower(c2) && c<0x80 && c2<0x80 ){ |
| 103370 | 103800 | continue; |
| 103371 | 103801 | } |
| 103372 | 103802 | if( c==matchOne && zPattern!=zEscaped && c2!=0 ) continue; |
| 103373 | 103803 | return 0; |
| 103374 | 103804 | } |
| | @@ -105823,11 +106253,12 @@ |
| 105823 | 106253 | */ |
| 105824 | 106254 | SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *db, Table *pTab){ |
| 105825 | 106255 | FKey *pFKey; /* Iterator variable */ |
| 105826 | 106256 | FKey *pNext; /* Copy of pFKey->pNextFrom */ |
| 105827 | 106257 | |
| 105828 | | - assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) ); |
| 106258 | + assert( db==0 || IsVirtual(pTab) |
| 106259 | + || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) ); |
| 105829 | 106260 | for(pFKey=pTab->pFKey; pFKey; pFKey=pNext){ |
| 105830 | 106261 | |
| 105831 | 106262 | /* Remove the FK from the fkeyHash hash table. */ |
| 105832 | 106263 | if( !db || db->pnBytesFreed==0 ){ |
| 105833 | 106264 | if( pFKey->pPrevTo ){ |
| | @@ -108233,12 +108664,12 @@ |
| 108233 | 108664 | ** shared libraries that want to be imported as extensions into |
| 108234 | 108665 | ** an SQLite instance. Shared libraries that intend to be loaded |
| 108235 | 108666 | ** as extensions by SQLite should #include this file instead of |
| 108236 | 108667 | ** sqlite3.h. |
| 108237 | 108668 | */ |
| 108238 | | -#ifndef _SQLITE3EXT_H_ |
| 108239 | | -#define _SQLITE3EXT_H_ |
| 108669 | +#ifndef SQLITE3EXT_H |
| 108670 | +#define SQLITE3EXT_H |
| 108240 | 108671 | /* #include "sqlite3.h" */ |
| 108241 | 108672 | |
| 108242 | 108673 | typedef struct sqlite3_api_routines sqlite3_api_routines; |
| 108243 | 108674 | |
| 108244 | 108675 | /* |
| | @@ -108499,10 +108930,13 @@ |
| 108499 | 108930 | int (*status64)(int,sqlite3_int64*,sqlite3_int64*,int); |
| 108500 | 108931 | int (*strlike)(const char*,const char*,unsigned int); |
| 108501 | 108932 | int (*db_cacheflush)(sqlite3*); |
| 108502 | 108933 | /* Version 3.12.0 and later */ |
| 108503 | 108934 | int (*system_errno)(sqlite3*); |
| 108935 | + /* Version 3.14.0 and later */ |
| 108936 | + int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*); |
| 108937 | + char *(*expanded_sql)(sqlite3_stmt*); |
| 108504 | 108938 | }; |
| 108505 | 108939 | |
| 108506 | 108940 | /* |
| 108507 | 108941 | ** The following macros redefine the API routines so that they are |
| 108508 | 108942 | ** redirected through the global sqlite3_api structure. |
| | @@ -108744,10 +109178,13 @@ |
| 108744 | 109178 | #define sqlite3_status64 sqlite3_api->status64 |
| 108745 | 109179 | #define sqlite3_strlike sqlite3_api->strlike |
| 108746 | 109180 | #define sqlite3_db_cacheflush sqlite3_api->db_cacheflush |
| 108747 | 109181 | /* Version 3.12.0 and later */ |
| 108748 | 109182 | #define sqlite3_system_errno sqlite3_api->system_errno |
| 109183 | +/* Version 3.14.0 and later */ |
| 109184 | +#define sqlite3_trace_v2 sqlite3_api->trace_v2 |
| 109185 | +#define sqlite3_expanded_sql sqlite3_api->expanded_sql |
| 108749 | 109186 | #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ |
| 108750 | 109187 | |
| 108751 | 109188 | #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) |
| 108752 | 109189 | /* This case when the file really is being compiled as a loadable |
| 108753 | 109190 | ** extension */ |
| | @@ -108761,11 +109198,11 @@ |
| 108761 | 109198 | # define SQLITE_EXTENSION_INIT1 /*no-op*/ |
| 108762 | 109199 | # define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */ |
| 108763 | 109200 | # define SQLITE_EXTENSION_INIT3 /*no-op*/ |
| 108764 | 109201 | #endif |
| 108765 | 109202 | |
| 108766 | | -#endif /* _SQLITE3EXT_H_ */ |
| 109203 | +#endif /* SQLITE3EXT_H */ |
| 108767 | 109204 | |
| 108768 | 109205 | /************** End of sqlite3ext.h ******************************************/ |
| 108769 | 109206 | /************** Continuing where we left off in loadext.c ********************/ |
| 108770 | 109207 | /* #include "sqliteInt.h" */ |
| 108771 | 109208 | /* #include <string.h> */ |
| | @@ -109194,10 +109631,11 @@ |
| 109194 | 109631 | const char *zEntry; |
| 109195 | 109632 | char *zAltEntry = 0; |
| 109196 | 109633 | void **aHandle; |
| 109197 | 109634 | u64 nMsg = 300 + sqlite3Strlen30(zFile); |
| 109198 | 109635 | int ii; |
| 109636 | + int rc; |
| 109199 | 109637 | |
| 109200 | 109638 | /* Shared library endings to try if zFile cannot be loaded as written */ |
| 109201 | 109639 | static const char *azEndings[] = { |
| 109202 | 109640 | #if SQLITE_OS_WIN |
| 109203 | 109641 | "dll" |
| | @@ -109296,11 +109734,13 @@ |
| 109296 | 109734 | sqlite3OsDlClose(pVfs, handle); |
| 109297 | 109735 | sqlite3_free(zAltEntry); |
| 109298 | 109736 | return SQLITE_ERROR; |
| 109299 | 109737 | } |
| 109300 | 109738 | sqlite3_free(zAltEntry); |
| 109301 | | - if( xInit(db, &zErrmsg, &sqlite3Apis) ){ |
| 109739 | + rc = xInit(db, &zErrmsg, &sqlite3Apis); |
| 109740 | + if( rc ){ |
| 109741 | + if( rc==SQLITE_OK_LOAD_PERMANENTLY ) return SQLITE_OK; |
| 109302 | 109742 | if( pzErrMsg ){ |
| 109303 | 109743 | *pzErrMsg = sqlite3_mprintf("error during initialization: %s", zErrmsg); |
| 109304 | 109744 | } |
| 109305 | 109745 | sqlite3_free(zErrmsg); |
| 109306 | 109746 | sqlite3OsDlClose(pVfs, handle); |
| | @@ -111034,11 +111474,11 @@ |
| 111034 | 111474 | |
| 111035 | 111475 | /* Many of the flag-pragmas modify the code generated by the SQL |
| 111036 | 111476 | ** compiler (eg. count_changes). So add an opcode to expire all |
| 111037 | 111477 | ** compiled SQL statements after modifying a pragma value. |
| 111038 | 111478 | */ |
| 111039 | | - sqlite3VdbeAddOp2(v, OP_Expire, 0, 0); |
| 111479 | + sqlite3VdbeAddOp0(v, OP_Expire); |
| 111040 | 111480 | setAllPagerFlags(db); |
| 111041 | 111481 | } |
| 111042 | 111482 | break; |
| 111043 | 111483 | } |
| 111044 | 111484 | #endif /* SQLITE_OMIT_FLAG_PRAGMAS */ |
| | @@ -111056,11 +111496,11 @@ |
| 111056 | 111496 | ** notnull: True if 'NOT NULL' is part of column declaration |
| 111057 | 111497 | ** dflt_value: The default value for the column, if any. |
| 111058 | 111498 | */ |
| 111059 | 111499 | case PragTyp_TABLE_INFO: if( zRight ){ |
| 111060 | 111500 | Table *pTab; |
| 111061 | | - pTab = sqlite3FindTable(db, zRight, zDb); |
| 111501 | + pTab = sqlite3LocateTable(pParse, LOCATE_NOERR, zRight, zDb); |
| 111062 | 111502 | if( pTab ){ |
| 111063 | 111503 | static const char *azCol[] = { |
| 111064 | 111504 | "cid", "name", "type", "notnull", "dflt_value", "pk" |
| 111065 | 111505 | }; |
| 111066 | 111506 | int i, k; |
| | @@ -111338,16 +111778,14 @@ |
| 111338 | 111778 | assert( iKey>=0 && iKey<pTab->nCol ); |
| 111339 | 111779 | if( iKey!=pTab->iPKey ){ |
| 111340 | 111780 | sqlite3VdbeAddOp3(v, OP_Column, 0, iKey, regRow); |
| 111341 | 111781 | sqlite3ColumnDefault(v, pTab, iKey, regRow); |
| 111342 | 111782 | sqlite3VdbeAddOp2(v, OP_IsNull, regRow, addrOk); VdbeCoverage(v); |
| 111343 | | - sqlite3VdbeAddOp2(v, OP_MustBeInt, regRow, |
| 111344 | | - sqlite3VdbeCurrentAddr(v)+3); VdbeCoverage(v); |
| 111345 | 111783 | }else{ |
| 111346 | 111784 | sqlite3VdbeAddOp2(v, OP_Rowid, 0, regRow); |
| 111347 | 111785 | } |
| 111348 | | - sqlite3VdbeAddOp3(v, OP_NotExists, i, 0, regRow); VdbeCoverage(v); |
| 111786 | + sqlite3VdbeAddOp3(v, OP_SeekRowid, i, 0, regRow); VdbeCoverage(v); |
| 111349 | 111787 | sqlite3VdbeGoto(v, addrOk); |
| 111350 | 111788 | sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2); |
| 111351 | 111789 | }else{ |
| 111352 | 111790 | for(j=0; j<pFK->nCol; j++){ |
| 111353 | 111791 | sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, |
| | @@ -112914,10 +113352,11 @@ |
| 112914 | 113352 | int regReturn; /* Register holding block-output return address */ |
| 112915 | 113353 | int labelBkOut; /* Start label for the block-output subroutine */ |
| 112916 | 113354 | int addrSortIndex; /* Address of the OP_SorterOpen or OP_OpenEphemeral */ |
| 112917 | 113355 | int labelDone; /* Jump here when done, ex: LIMIT reached */ |
| 112918 | 113356 | u8 sortFlags; /* Zero or more SORTFLAG_* bits */ |
| 113357 | + u8 bOrderedInnerLoop; /* ORDER BY correctly sorts the inner loop */ |
| 112919 | 113358 | }; |
| 112920 | 113359 | #define SORTFLAG_UseSorter 0x01 /* Use SorterOpen instead of OpenEphemeral */ |
| 112921 | 113360 | |
| 112922 | 113361 | /* |
| 112923 | 113362 | ** Delete all the content of a Select structure. Deallocate the structure |
| | @@ -113447,13 +113886,34 @@ |
| 113447 | 113886 | op = OP_IdxInsert; |
| 113448 | 113887 | } |
| 113449 | 113888 | sqlite3VdbeAddOp2(v, op, pSort->iECursor, regRecord); |
| 113450 | 113889 | if( iLimit ){ |
| 113451 | 113890 | int addr; |
| 113891 | + int r1 = 0; |
| 113892 | + /* Fill the sorter until it contains LIMIT+OFFSET entries. (The iLimit |
| 113893 | + ** register is initialized with value of LIMIT+OFFSET.) After the sorter |
| 113894 | + ** fills up, delete the least entry in the sorter after each insert. |
| 113895 | + ** Thus we never hold more than the LIMIT+OFFSET rows in memory at once */ |
| 113452 | 113896 | addr = sqlite3VdbeAddOp3(v, OP_IfNotZero, iLimit, 0, 1); VdbeCoverage(v); |
| 113453 | 113897 | sqlite3VdbeAddOp1(v, OP_Last, pSort->iECursor); |
| 113898 | + if( pSort->bOrderedInnerLoop ){ |
| 113899 | + r1 = ++pParse->nMem; |
| 113900 | + sqlite3VdbeAddOp3(v, OP_Column, pSort->iECursor, nExpr, r1); |
| 113901 | + VdbeComment((v, "seq")); |
| 113902 | + } |
| 113454 | 113903 | sqlite3VdbeAddOp1(v, OP_Delete, pSort->iECursor); |
| 113904 | + if( pSort->bOrderedInnerLoop ){ |
| 113905 | + /* If the inner loop is driven by an index such that values from |
| 113906 | + ** the same iteration of the inner loop are in sorted order, then |
| 113907 | + ** immediately jump to the next iteration of an inner loop if the |
| 113908 | + ** entry from the current iteration does not fit into the top |
| 113909 | + ** LIMIT+OFFSET entries of the sorter. */ |
| 113910 | + int iBrk = sqlite3VdbeCurrentAddr(v) + 2; |
| 113911 | + sqlite3VdbeAddOp3(v, OP_Eq, regBase+nExpr, iBrk, r1); |
| 113912 | + sqlite3VdbeChangeP5(v, SQLITE_NULLEQ); |
| 113913 | + VdbeCoverage(v); |
| 113914 | + } |
| 113455 | 113915 | sqlite3VdbeJumpHere(v, addr); |
| 113456 | 113916 | } |
| 113457 | 113917 | } |
| 113458 | 113918 | |
| 113459 | 113919 | /* |
| | @@ -113864,11 +114324,11 @@ |
| 113864 | 114324 | ** Allocate a KeyInfo object sufficient for an index of N key columns and |
| 113865 | 114325 | ** X extra columns. |
| 113866 | 114326 | */ |
| 113867 | 114327 | SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){ |
| 113868 | 114328 | int nExtra = (N+X)*(sizeof(CollSeq*)+1); |
| 113869 | | - KeyInfo *p = sqlite3Malloc(sizeof(KeyInfo) + nExtra); |
| 114329 | + KeyInfo *p = sqlite3DbMallocRaw(db, sizeof(KeyInfo) + nExtra); |
| 113870 | 114330 | if( p ){ |
| 113871 | 114331 | p->aSortOrder = (u8*)&p->aColl[N+X]; |
| 113872 | 114332 | p->nField = (u16)N; |
| 113873 | 114333 | p->nXField = (u16)X; |
| 113874 | 114334 | p->enc = ENC(db); |
| | @@ -113886,11 +114346,11 @@ |
| 113886 | 114346 | */ |
| 113887 | 114347 | SQLITE_PRIVATE void sqlite3KeyInfoUnref(KeyInfo *p){ |
| 113888 | 114348 | if( p ){ |
| 113889 | 114349 | assert( p->nRef>0 ); |
| 113890 | 114350 | p->nRef--; |
| 113891 | | - if( p->nRef==0 ) sqlite3DbFree(0, p); |
| 114351 | + if( p->nRef==0 ) sqlite3DbFree(p->db, p); |
| 113892 | 114352 | } |
| 113893 | 114353 | } |
| 113894 | 114354 | |
| 113895 | 114355 | /* |
| 113896 | 114356 | ** Make a new pointer to a KeyInfo object |
| | @@ -118034,10 +118494,11 @@ |
| 118034 | 118494 | if( sDistinct.isTnct && sqlite3WhereIsDistinct(pWInfo) ){ |
| 118035 | 118495 | sDistinct.eTnctType = sqlite3WhereIsDistinct(pWInfo); |
| 118036 | 118496 | } |
| 118037 | 118497 | if( sSort.pOrderBy ){ |
| 118038 | 118498 | sSort.nOBSat = sqlite3WhereIsOrdered(pWInfo); |
| 118499 | + sSort.bOrderedInnerLoop = sqlite3WhereOrderedInnerLoop(pWInfo); |
| 118039 | 118500 | if( sSort.nOBSat==sSort.pOrderBy->nExpr ){ |
| 118040 | 118501 | sSort.pOrderBy = 0; |
| 118041 | 118502 | } |
| 118042 | 118503 | } |
| 118043 | 118504 | |
| | @@ -120803,11 +121264,11 @@ |
| 120803 | 121264 | Btree *pTemp; /* The temporary database we vacuum into */ |
| 120804 | 121265 | char *zSql = 0; /* SQL statements */ |
| 120805 | 121266 | int saved_flags; /* Saved value of the db->flags */ |
| 120806 | 121267 | int saved_nChange; /* Saved value of db->nChange */ |
| 120807 | 121268 | int saved_nTotalChange; /* Saved value of db->nTotalChange */ |
| 120808 | | - void (*saved_xTrace)(void*,const char*); /* Saved db->xTrace */ |
| 121269 | + u8 saved_mTrace; /* Saved trace settings */ |
| 120809 | 121270 | Db *pDb = 0; /* Database to detach at end of vacuum */ |
| 120810 | 121271 | int isMemDb; /* True if vacuuming a :memory: database */ |
| 120811 | 121272 | int nRes; /* Bytes of reserved space at the end of each page */ |
| 120812 | 121273 | int nDb; /* Number of attached databases */ |
| 120813 | 121274 | |
| | @@ -120824,14 +121285,14 @@ |
| 120824 | 121285 | ** restored before returning. Then set the writable-schema flag, and |
| 120825 | 121286 | ** disable CHECK and foreign key constraints. */ |
| 120826 | 121287 | saved_flags = db->flags; |
| 120827 | 121288 | saved_nChange = db->nChange; |
| 120828 | 121289 | saved_nTotalChange = db->nTotalChange; |
| 120829 | | - saved_xTrace = db->xTrace; |
| 121290 | + saved_mTrace = db->mTrace; |
| 120830 | 121291 | db->flags |= SQLITE_WriteSchema | SQLITE_IgnoreChecks | SQLITE_PreferBuiltin; |
| 120831 | 121292 | db->flags &= ~(SQLITE_ForeignKeys | SQLITE_ReverseOrder); |
| 120832 | | - db->xTrace = 0; |
| 121293 | + db->mTrace = 0; |
| 120833 | 121294 | |
| 120834 | 121295 | pMain = db->aDb[0].pBt; |
| 120835 | 121296 | isMemDb = sqlite3PagerIsMemdb(sqlite3BtreePager(pMain)); |
| 120836 | 121297 | |
| 120837 | 121298 | /* Attach the temporary database as 'vacuum_db'. The synchronous pragma |
| | @@ -121027,11 +121488,11 @@ |
| 121027 | 121488 | end_of_vacuum: |
| 121028 | 121489 | /* Restore the original value of db->flags */ |
| 121029 | 121490 | db->flags = saved_flags; |
| 121030 | 121491 | db->nChange = saved_nChange; |
| 121031 | 121492 | db->nTotalChange = saved_nTotalChange; |
| 121032 | | - db->xTrace = saved_xTrace; |
| 121493 | + db->mTrace = saved_mTrace; |
| 121033 | 121494 | sqlite3BtreeSetPageSize(pMain, -1, -1, 1); |
| 121034 | 121495 | |
| 121035 | 121496 | /* Currently there is an SQL level transaction open on the vacuum |
| 121036 | 121497 | ** database. No locks are held on any other files (since the main file |
| 121037 | 121498 | ** was committed at the btree level). So it safe to end the transaction |
| | @@ -121476,11 +121937,11 @@ |
| 121476 | 121937 | ); |
| 121477 | 121938 | sqlite3DbFree(db, zStmt); |
| 121478 | 121939 | v = sqlite3GetVdbe(pParse); |
| 121479 | 121940 | sqlite3ChangeCookie(pParse, iDb); |
| 121480 | 121941 | |
| 121481 | | - sqlite3VdbeAddOp2(v, OP_Expire, 0, 0); |
| 121942 | + sqlite3VdbeAddOp0(v, OP_Expire); |
| 121482 | 121943 | zWhere = sqlite3MPrintf(db, "name='%q' AND type='table'", pTab->zName); |
| 121483 | 121944 | sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere); |
| 121484 | 121945 | |
| 121485 | 121946 | iReg = ++pParse->nMem; |
| 121486 | 121947 | sqlite3VdbeLoadString(v, iReg, pTab->zName); |
| | @@ -121812,14 +122273,28 @@ |
| 121812 | 122273 | && !db->mallocFailed |
| 121813 | 122274 | && !pParse->pNewTable->pSelect |
| 121814 | 122275 | && (pParse->pNewTable->tabFlags & TF_Virtual)==0 |
| 121815 | 122276 | ){ |
| 121816 | 122277 | if( !pTab->aCol ){ |
| 121817 | | - pTab->aCol = pParse->pNewTable->aCol; |
| 121818 | | - pTab->nCol = pParse->pNewTable->nCol; |
| 121819 | | - pParse->pNewTable->nCol = 0; |
| 121820 | | - pParse->pNewTable->aCol = 0; |
| 122278 | + Table *pNew = pParse->pNewTable; |
| 122279 | + Index *pIdx; |
| 122280 | + pTab->aCol = pNew->aCol; |
| 122281 | + pTab->nCol = pNew->nCol; |
| 122282 | + pTab->tabFlags |= pNew->tabFlags & (TF_WithoutRowid|TF_NoVisibleRowid); |
| 122283 | + pNew->nCol = 0; |
| 122284 | + pNew->aCol = 0; |
| 122285 | + assert( pTab->pIndex==0 ); |
| 122286 | + if( !HasRowid(pNew) && pCtx->pVTable->pMod->pModule->xUpdate!=0 ){ |
| 122287 | + rc = SQLITE_ERROR; |
| 122288 | + } |
| 122289 | + pIdx = pNew->pIndex; |
| 122290 | + if( pIdx ){ |
| 122291 | + assert( pIdx->pNext==0 ); |
| 122292 | + pTab->pIndex = pIdx; |
| 122293 | + pNew->pIndex = 0; |
| 122294 | + pIdx->pTable = pTab; |
| 122295 | + } |
| 121821 | 122296 | } |
| 121822 | 122297 | pCtx->bDeclared = 1; |
| 121823 | 122298 | }else{ |
| 121824 | 122299 | sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr); |
| 121825 | 122300 | sqlite3DbFree(db, zErr); |
| | @@ -122145,11 +122620,11 @@ |
| 122145 | 122620 | sqlite3OomFault(pToplevel->db); |
| 122146 | 122621 | } |
| 122147 | 122622 | } |
| 122148 | 122623 | |
| 122149 | 122624 | /* |
| 122150 | | -** Check to see if virtual tale module pMod can be have an eponymous |
| 122625 | +** Check to see if virtual table module pMod can be have an eponymous |
| 122151 | 122626 | ** virtual table instance. If it can, create one if one does not already |
| 122152 | 122627 | ** exist. Return non-zero if the eponymous virtual table instance exists |
| 122153 | 122628 | ** when this routine returns, and return zero if it does not exist. |
| 122154 | 122629 | ** |
| 122155 | 122630 | ** An eponymous virtual table instance is one that is named after its |
| | @@ -122162,21 +122637,22 @@ |
| 122162 | 122637 | */ |
| 122163 | 122638 | SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){ |
| 122164 | 122639 | const sqlite3_module *pModule = pMod->pModule; |
| 122165 | 122640 | Table *pTab; |
| 122166 | 122641 | char *zErr = 0; |
| 122167 | | - int nName; |
| 122168 | 122642 | int rc; |
| 122169 | 122643 | sqlite3 *db = pParse->db; |
| 122170 | 122644 | if( pMod->pEpoTab ) return 1; |
| 122171 | 122645 | if( pModule->xCreate!=0 && pModule->xCreate!=pModule->xConnect ) return 0; |
| 122172 | | - nName = sqlite3Strlen30(pMod->zName) + 1; |
| 122173 | | - pTab = sqlite3DbMallocZero(db, sizeof(Table) + nName); |
| 122646 | + pTab = sqlite3DbMallocZero(db, sizeof(Table)); |
| 122174 | 122647 | if( pTab==0 ) return 0; |
| 122648 | + pTab->zName = sqlite3DbStrDup(db, pMod->zName); |
| 122649 | + if( pTab->zName==0 ){ |
| 122650 | + sqlite3DbFree(db, pTab); |
| 122651 | + return 0; |
| 122652 | + } |
| 122175 | 122653 | pMod->pEpoTab = pTab; |
| 122176 | | - pTab->zName = (char*)&pTab[1]; |
| 122177 | | - memcpy(pTab->zName, pMod->zName, nName); |
| 122178 | 122654 | pTab->nRef = 1; |
| 122179 | 122655 | pTab->pSchema = db->aDb[0].pSchema; |
| 122180 | 122656 | pTab->tabFlags |= TF_Virtual; |
| 122181 | 122657 | pTab->nModuleArg = 0; |
| 122182 | 122658 | pTab->iPKey = -1; |
| | @@ -122198,13 +122674,15 @@ |
| 122198 | 122674 | ** virtual table module pMod, if it exists. |
| 122199 | 122675 | */ |
| 122200 | 122676 | SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3 *db, Module *pMod){ |
| 122201 | 122677 | Table *pTab = pMod->pEpoTab; |
| 122202 | 122678 | if( pTab!=0 ){ |
| 122203 | | - sqlite3DeleteColumnNames(db, pTab); |
| 122204 | | - sqlite3VtabClear(db, pTab); |
| 122205 | | - sqlite3DbFree(db, pTab); |
| 122679 | + /* Mark the table as Ephemeral prior to deleting it, so that the |
| 122680 | + ** sqlite3DeleteTable() routine will know that it is not stored in |
| 122681 | + ** the schema. */ |
| 122682 | + pTab->tabFlags |= TF_Ephemeral; |
| 122683 | + sqlite3DeleteTable(db, pTab); |
| 122206 | 122684 | pMod->pEpoTab = 0; |
| 122207 | 122685 | } |
| 122208 | 122686 | } |
| 122209 | 122687 | |
| 122210 | 122688 | /* |
| | @@ -122707,12 +123185,13 @@ |
| 122707 | 123185 | u16 wctrlFlags; /* Flags originally passed to sqlite3WhereBegin() */ |
| 122708 | 123186 | i8 nOBSat; /* Number of ORDER BY terms satisfied by indices */ |
| 122709 | 123187 | u8 sorted; /* True if really sorted (not just grouped) */ |
| 122710 | 123188 | u8 eOnePass; /* ONEPASS_OFF, or _SINGLE, or _MULTI */ |
| 122711 | 123189 | u8 untestedTerms; /* Not all WHERE terms resolved by outer loop */ |
| 122712 | | - u8 eDistinct; /* One of the WHERE_DISTINCT_* values below */ |
| 123190 | + u8 eDistinct; /* One of the WHERE_DISTINCT_* values */ |
| 122713 | 123191 | u8 nLevel; /* Number of nested loop */ |
| 123192 | + u8 bOrderedInnerLoop; /* True if only the inner-most loop is ordered */ |
| 122714 | 123193 | int iTop; /* The very beginning of the WHERE loop */ |
| 122715 | 123194 | int iContinue; /* Jump here to continue with next record */ |
| 122716 | 123195 | int iBreak; /* Jump here to break out of the loop */ |
| 122717 | 123196 | int savedNQueryLoop; /* pParse->nQueryLoop outside the WHERE loop */ |
| 122718 | 123197 | int aiCurOnePass[2]; /* OP_OpenWrite cursors for the ONEPASS opt */ |
| | @@ -122725,10 +123204,13 @@ |
| 122725 | 123204 | ** Private interfaces - callable only by other where.c routines. |
| 122726 | 123205 | ** |
| 122727 | 123206 | ** where.c: |
| 122728 | 123207 | */ |
| 122729 | 123208 | SQLITE_PRIVATE Bitmask sqlite3WhereGetMask(WhereMaskSet*,int); |
| 123209 | +#ifdef WHERETRACE_ENABLED |
| 123210 | +SQLITE_PRIVATE void sqlite3WhereClausePrint(WhereClause *pWC); |
| 123211 | +#endif |
| 122730 | 123212 | SQLITE_PRIVATE WhereTerm *sqlite3WhereFindTerm( |
| 122731 | 123213 | WhereClause *pWC, /* The WHERE clause to be searched */ |
| 122732 | 123214 | int iCur, /* Cursor number of LHS */ |
| 122733 | 123215 | int iColumn, /* Column number of LHS */ |
| 122734 | 123216 | Bitmask notReady, /* RHS must not overlap with this mask */ |
| | @@ -122941,11 +123423,11 @@ |
| 122941 | 123423 | StrAccum str; /* EQP output string */ |
| 122942 | 123424 | char zBuf[100]; /* Initial space for EQP output string */ |
| 122943 | 123425 | |
| 122944 | 123426 | pLoop = pLevel->pWLoop; |
| 122945 | 123427 | flags = pLoop->wsFlags; |
| 122946 | | - if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_ONETABLE_ONLY) ) return 0; |
| 123428 | + if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_OR_SUBCLAUSE) ) return 0; |
| 122947 | 123429 | |
| 122948 | 123430 | isSearch = (flags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0 |
| 122949 | 123431 | || ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0)) |
| 122950 | 123432 | || (wctrlFlags&(WHERE_ORDERBY_MIN|WHERE_ORDERBY_MAX)); |
| 122951 | 123433 | |
| | @@ -123384,11 +123866,11 @@ |
| 123384 | 123866 | ** |
| 123385 | 123867 | ** The LIKE optimization trys to evaluate "x LIKE 'abc%'" as a range |
| 123386 | 123868 | ** expression: "x>='ABC' AND x<'abd'". But this requires that the range |
| 123387 | 123869 | ** scan loop run twice, once for strings and a second time for BLOBs. |
| 123388 | 123870 | ** The OP_String opcodes on the second pass convert the upper and lower |
| 123389 | | -** bound string contants to blobs. This routine makes the necessary changes |
| 123871 | +** bound string constants to blobs. This routine makes the necessary changes |
| 123390 | 123872 | ** to the OP_String opcodes for that to happen. |
| 123391 | 123873 | ** |
| 123392 | 123874 | ** Except, of course, if SQLITE_LIKE_DOESNT_MATCH_BLOBS is defined, then |
| 123393 | 123875 | ** only the one pass through the string space is required, so this routine |
| 123394 | 123876 | ** becomes a no-op. |
| | @@ -123441,10 +123923,42 @@ |
| 123441 | 123923 | pWalker->eCode = 1; |
| 123442 | 123924 | } |
| 123443 | 123925 | return WRC_Continue; |
| 123444 | 123926 | } |
| 123445 | 123927 | |
| 123928 | +/* |
| 123929 | +** Test whether or not expression pExpr, which was part of a WHERE clause, |
| 123930 | +** should be included in the cursor-hint for a table that is on the rhs |
| 123931 | +** of a LEFT JOIN. Set Walker.eCode to non-zero before returning if the |
| 123932 | +** expression is not suitable. |
| 123933 | +** |
| 123934 | +** An expression is unsuitable if it might evaluate to non NULL even if |
| 123935 | +** a TK_COLUMN node that does affect the value of the expression is set |
| 123936 | +** to NULL. For example: |
| 123937 | +** |
| 123938 | +** col IS NULL |
| 123939 | +** col IS NOT NULL |
| 123940 | +** coalesce(col, 1) |
| 123941 | +** CASE WHEN col THEN 0 ELSE 1 END |
| 123942 | +*/ |
| 123943 | +static int codeCursorHintIsOrFunction(Walker *pWalker, Expr *pExpr){ |
| 123944 | + if( pExpr->op==TK_IS |
| 123945 | + || pExpr->op==TK_ISNULL || pExpr->op==TK_ISNOT |
| 123946 | + || pExpr->op==TK_NOTNULL || pExpr->op==TK_CASE |
| 123947 | + ){ |
| 123948 | + pWalker->eCode = 1; |
| 123949 | + }else if( pExpr->op==TK_FUNCTION ){ |
| 123950 | + int d1; |
| 123951 | + char d2[3]; |
| 123952 | + if( 0==sqlite3IsLikeFunction(pWalker->pParse->db, pExpr, &d1, d2) ){ |
| 123953 | + pWalker->eCode = 1; |
| 123954 | + } |
| 123955 | + } |
| 123956 | + |
| 123957 | + return WRC_Continue; |
| 123958 | +} |
| 123959 | + |
| 123446 | 123960 | |
| 123447 | 123961 | /* |
| 123448 | 123962 | ** This function is called on every node of an expression tree used as an |
| 123449 | 123963 | ** argument to the OP_CursorHint instruction. If the node is a TK_COLUMN |
| 123450 | 123964 | ** that accesses any table other than the one identified by |
| | @@ -123493,10 +124007,11 @@ |
| 123493 | 124007 | |
| 123494 | 124008 | /* |
| 123495 | 124009 | ** Insert an OP_CursorHint instruction if it is appropriate to do so. |
| 123496 | 124010 | */ |
| 123497 | 124011 | static void codeCursorHint( |
| 124012 | + struct SrcList_item *pTabItem, /* FROM clause item */ |
| 123498 | 124013 | WhereInfo *pWInfo, /* The where clause */ |
| 123499 | 124014 | WhereLevel *pLevel, /* Which loop to provide hints for */ |
| 123500 | 124015 | WhereTerm *pEndRange /* Hint this end-of-scan boundary term if not NULL */ |
| 123501 | 124016 | ){ |
| 123502 | 124017 | Parse *pParse = pWInfo->pParse; |
| | @@ -123523,11 +124038,46 @@ |
| 123523 | 124038 | pWC = &pWInfo->sWC; |
| 123524 | 124039 | for(i=0; i<pWC->nTerm; i++){ |
| 123525 | 124040 | pTerm = &pWC->a[i]; |
| 123526 | 124041 | if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; |
| 123527 | 124042 | if( pTerm->prereqAll & pLevel->notReady ) continue; |
| 123528 | | - if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) continue; |
| 124043 | + |
| 124044 | + /* Any terms specified as part of the ON(...) clause for any LEFT |
| 124045 | + ** JOIN for which the current table is not the rhs are omitted |
| 124046 | + ** from the cursor-hint. |
| 124047 | + ** |
| 124048 | + ** If this table is the rhs of a LEFT JOIN, "IS" or "IS NULL" terms |
| 124049 | + ** that were specified as part of the WHERE clause must be excluded. |
| 124050 | + ** This is to address the following: |
| 124051 | + ** |
| 124052 | + ** SELECT ... t1 LEFT JOIN t2 ON (t1.a=t2.b) WHERE t2.c IS NULL; |
| 124053 | + ** |
| 124054 | + ** Say there is a single row in t2 that matches (t1.a=t2.b), but its |
| 124055 | + ** t2.c values is not NULL. If the (t2.c IS NULL) constraint is |
| 124056 | + ** pushed down to the cursor, this row is filtered out, causing |
| 124057 | + ** SQLite to synthesize a row of NULL values. Which does match the |
| 124058 | + ** WHERE clause, and so the query returns a row. Which is incorrect. |
| 124059 | + ** |
| 124060 | + ** For the same reason, WHERE terms such as: |
| 124061 | + ** |
| 124062 | + ** WHERE 1 = (t2.c IS NULL) |
| 124063 | + ** |
| 124064 | + ** are also excluded. See codeCursorHintIsOrFunction() for details. |
| 124065 | + */ |
| 124066 | + if( pTabItem->fg.jointype & JT_LEFT ){ |
| 124067 | + Expr *pExpr = pTerm->pExpr; |
| 124068 | + if( !ExprHasProperty(pExpr, EP_FromJoin) |
| 124069 | + || pExpr->iRightJoinTable!=pTabItem->iCursor |
| 124070 | + ){ |
| 124071 | + sWalker.eCode = 0; |
| 124072 | + sWalker.xExprCallback = codeCursorHintIsOrFunction; |
| 124073 | + sqlite3WalkExpr(&sWalker, pTerm->pExpr); |
| 124074 | + if( sWalker.eCode ) continue; |
| 124075 | + } |
| 124076 | + }else{ |
| 124077 | + if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) continue; |
| 124078 | + } |
| 123529 | 124079 | |
| 123530 | 124080 | /* All terms in pWLoop->aLTerm[] except pEndRange are used to initialize |
| 123531 | 124081 | ** the cursor. These terms are not needed as hints for a pure range |
| 123532 | 124082 | ** scan (that has no == terms) so omit them. */ |
| 123533 | 124083 | if( pLoop->u.btree.nEq==0 && pTerm!=pEndRange ){ |
| | @@ -123557,11 +124107,11 @@ |
| 123557 | 124107 | (sHint.pIdx ? sHint.iIdxCur : sHint.iTabCur), 0, 0, |
| 123558 | 124108 | (const char*)pExpr, P4_EXPR); |
| 123559 | 124109 | } |
| 123560 | 124110 | } |
| 123561 | 124111 | #else |
| 123562 | | -# define codeCursorHint(A,B,C) /* No-op */ |
| 124112 | +# define codeCursorHint(A,B,C,D) /* No-op */ |
| 123563 | 124113 | #endif /* SQLITE_ENABLE_CURSOR_HINTS */ |
| 123564 | 124114 | |
| 123565 | 124115 | /* |
| 123566 | 124116 | ** Cursor iCur is open on an intkey b-tree (a table). Register iRowid contains |
| 123567 | 124117 | ** a rowid value just read from cursor iIdxCur, open on index pIdx. This |
| | @@ -123591,11 +124141,11 @@ |
| 123591 | 124141 | |
| 123592 | 124142 | assert( iIdxCur>0 ); |
| 123593 | 124143 | assert( pIdx->aiColumn[pIdx->nColumn-1]==-1 ); |
| 123594 | 124144 | |
| 123595 | 124145 | sqlite3VdbeAddOp3(v, OP_Seek, iIdxCur, 0, iCur); |
| 123596 | | - if( (pWInfo->wctrlFlags & WHERE_FORCE_TABLE) |
| 124146 | + if( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE) |
| 123597 | 124147 | && DbMaskAllZero(sqlite3ParseToplevel(pParse)->writeMask) |
| 123598 | 124148 | ){ |
| 123599 | 124149 | int i; |
| 123600 | 124150 | Table *pTab = pIdx->pTable; |
| 123601 | 124151 | int *ai = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*(pTab->nCol+1)); |
| | @@ -123646,11 +124196,11 @@ |
| 123646 | 124196 | pTabItem = &pWInfo->pTabList->a[pLevel->iFrom]; |
| 123647 | 124197 | iCur = pTabItem->iCursor; |
| 123648 | 124198 | pLevel->notReady = notReady & ~sqlite3WhereGetMask(&pWInfo->sMaskSet, iCur); |
| 123649 | 124199 | bRev = (pWInfo->revMask>>iLevel)&1; |
| 123650 | 124200 | omitTable = (pLoop->wsFlags & WHERE_IDX_ONLY)!=0 |
| 123651 | | - && (pWInfo->wctrlFlags & WHERE_FORCE_TABLE)==0; |
| 124201 | + && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0; |
| 123652 | 124202 | VdbeModuleComment((v, "Begin WHERE-loop%d: %s",iLevel,pTabItem->pTab->zName)); |
| 123653 | 124203 | |
| 123654 | 124204 | /* Create labels for the "break" and "continue" instructions |
| 123655 | 124205 | ** for the current loop. Jump to addrBrk to break out of a loop. |
| 123656 | 124206 | ** Jump to cont to go immediately to the next iteration of the |
| | @@ -123786,12 +124336,11 @@ |
| 123786 | 124336 | testcase( pTerm->wtFlags & TERM_VIRTUAL ); |
| 123787 | 124337 | iReleaseReg = ++pParse->nMem; |
| 123788 | 124338 | iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg); |
| 123789 | 124339 | if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg); |
| 123790 | 124340 | addrNxt = pLevel->addrNxt; |
| 123791 | | - sqlite3VdbeAddOp2(v, OP_MustBeInt, iRowidReg, addrNxt); VdbeCoverage(v); |
| 123792 | | - sqlite3VdbeAddOp3(v, OP_NotExists, iCur, addrNxt, iRowidReg); |
| 124341 | + sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg); |
| 123793 | 124342 | VdbeCoverage(v); |
| 123794 | 124343 | sqlite3ExprCacheAffinityChange(pParse, iRowidReg, 1); |
| 123795 | 124344 | sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg); |
| 123796 | 124345 | VdbeComment((v, "pk")); |
| 123797 | 124346 | pLevel->op = OP_Noop; |
| | @@ -123814,11 +124363,11 @@ |
| 123814 | 124363 | if( bRev ){ |
| 123815 | 124364 | pTerm = pStart; |
| 123816 | 124365 | pStart = pEnd; |
| 123817 | 124366 | pEnd = pTerm; |
| 123818 | 124367 | } |
| 123819 | | - codeCursorHint(pWInfo, pLevel, pEnd); |
| 124368 | + codeCursorHint(pTabItem, pWInfo, pLevel, pEnd); |
| 123820 | 124369 | if( pStart ){ |
| 123821 | 124370 | Expr *pX; /* The expression that defines the start bound */ |
| 123822 | 124371 | int r1, rTemp; /* Registers for holding the start boundary */ |
| 123823 | 124372 | |
| 123824 | 124373 | /* The following constant maps TK_xx codes into corresponding |
| | @@ -124028,11 +124577,11 @@ |
| 124028 | 124577 | |
| 124029 | 124578 | /* Generate code to evaluate all constraint terms using == or IN |
| 124030 | 124579 | ** and store the values of those terms in an array of registers |
| 124031 | 124580 | ** starting at regBase. |
| 124032 | 124581 | */ |
| 124033 | | - codeCursorHint(pWInfo, pLevel, pRangeEnd); |
| 124582 | + codeCursorHint(pTabItem, pWInfo, pLevel, pRangeEnd); |
| 124034 | 124583 | regBase = codeAllEqualityTerms(pParse,pLevel,bRev,nExtraReg,&zStartAff); |
| 124035 | 124584 | assert( zStartAff==0 || sqlite3Strlen30(zStartAff)>=nEq ); |
| 124036 | 124585 | if( zStartAff ) cEndAff = zStartAff[nEq]; |
| 124037 | 124586 | addrNxt = pLevel->addrNxt; |
| 124038 | 124587 | |
| | @@ -124332,15 +124881,11 @@ |
| 124332 | 124881 | |
| 124333 | 124882 | /* Run a separate WHERE clause for each term of the OR clause. After |
| 124334 | 124883 | ** eliminating duplicates from other WHERE clauses, the action for each |
| 124335 | 124884 | ** sub-WHERE clause is to to invoke the main loop body as a subroutine. |
| 124336 | 124885 | */ |
| 124337 | | - wctrlFlags = WHERE_OMIT_OPEN_CLOSE |
| 124338 | | - | WHERE_FORCE_TABLE |
| 124339 | | - | WHERE_ONETABLE_ONLY |
| 124340 | | - | WHERE_NO_AUTOINDEX |
| 124341 | | - | (pWInfo->wctrlFlags & WHERE_SEEK_TABLE); |
| 124886 | + wctrlFlags = WHERE_OR_SUBCLAUSE | (pWInfo->wctrlFlags & WHERE_SEEK_TABLE); |
| 124342 | 124887 | for(ii=0; ii<pOrWc->nTerm; ii++){ |
| 124343 | 124888 | WhereTerm *pOrTerm = &pOrWc->a[ii]; |
| 124344 | 124889 | if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){ |
| 124345 | 124890 | WhereInfo *pSubWInfo; /* Info for single OR-term scan */ |
| 124346 | 124891 | Expr *pOrExpr = pOrTerm->pExpr; /* Current OR clause term */ |
| | @@ -124444,11 +124989,10 @@ |
| 124444 | 124989 | && (ii==0 || pSubLoop->u.btree.pIndex==pCov) |
| 124445 | 124990 | && (HasRowid(pTab) || !IsPrimaryKeyIndex(pSubLoop->u.btree.pIndex)) |
| 124446 | 124991 | ){ |
| 124447 | 124992 | assert( pSubWInfo->a[0].iIdxCur==iCovCur ); |
| 124448 | 124993 | pCov = pSubLoop->u.btree.pIndex; |
| 124449 | | - wctrlFlags |= WHERE_REOPEN_IDX; |
| 124450 | 124994 | }else{ |
| 124451 | 124995 | pCov = 0; |
| 124452 | 124996 | } |
| 124453 | 124997 | |
| 124454 | 124998 | /* Finish the loop through table entries that match term pOrTerm. */ |
| | @@ -124481,11 +125025,11 @@ |
| 124481 | 125025 | if( pTabItem->fg.isRecursive ){ |
| 124482 | 125026 | /* Tables marked isRecursive have only a single row that is stored in |
| 124483 | 125027 | ** a pseudo-cursor. No need to Rewind or Next such cursors. */ |
| 124484 | 125028 | pLevel->op = OP_Noop; |
| 124485 | 125029 | }else{ |
| 124486 | | - codeCursorHint(pWInfo, pLevel, 0); |
| 125030 | + codeCursorHint(pTabItem, pWInfo, pLevel, 0); |
| 124487 | 125031 | pLevel->op = aStep[bRev]; |
| 124488 | 125032 | pLevel->p1 = iCur; |
| 124489 | 125033 | pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, aStart[bRev], iCur, addrBrk); |
| 124490 | 125034 | VdbeCoverageIf(v, bRev==0); |
| 124491 | 125035 | VdbeCoverageIf(v, bRev!=0); |
| | @@ -124506,11 +125050,11 @@ |
| 124506 | 125050 | testcase( pTerm->wtFlags & TERM_VIRTUAL ); |
| 124507 | 125051 | testcase( pTerm->wtFlags & TERM_CODED ); |
| 124508 | 125052 | if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; |
| 124509 | 125053 | if( (pTerm->prereqAll & pLevel->notReady)!=0 ){ |
| 124510 | 125054 | testcase( pWInfo->untestedTerms==0 |
| 124511 | | - && (pWInfo->wctrlFlags & WHERE_ONETABLE_ONLY)!=0 ); |
| 125055 | + && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)!=0 ); |
| 124512 | 125056 | pWInfo->untestedTerms = 1; |
| 124513 | 125057 | continue; |
| 124514 | 125058 | } |
| 124515 | 125059 | pE = pTerm->pExpr; |
| 124516 | 125060 | assert( pE!=0 ); |
| | @@ -125168,11 +125712,13 @@ |
| 125168 | 125712 | sqlite3WhereExprAnalyze(pSrc, pAndWC); |
| 125169 | 125713 | pAndWC->pOuter = pWC; |
| 125170 | 125714 | if( !db->mallocFailed ){ |
| 125171 | 125715 | for(j=0, pAndTerm=pAndWC->a; j<pAndWC->nTerm; j++, pAndTerm++){ |
| 125172 | 125716 | assert( pAndTerm->pExpr ); |
| 125173 | | - if( allowedOp(pAndTerm->pExpr->op) ){ |
| 125717 | + if( allowedOp(pAndTerm->pExpr->op) |
| 125718 | + || pAndTerm->eOperator==WO_MATCH |
| 125719 | + ){ |
| 125174 | 125720 | b |= sqlite3WhereGetMask(&pWInfo->sMaskSet, pAndTerm->leftCursor); |
| 125175 | 125721 | } |
| 125176 | 125722 | } |
| 125177 | 125723 | } |
| 125178 | 125724 | indexable &= b; |
| | @@ -125383,16 +125929,14 @@ |
| 125383 | 125929 | return 0; |
| 125384 | 125930 | } |
| 125385 | 125931 | pColl = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight); |
| 125386 | 125932 | if( pColl==0 || sqlite3StrICmp(pColl->zName, "BINARY")==0 ) return 1; |
| 125387 | 125933 | pColl = sqlite3ExprCollSeq(pParse, pExpr->pLeft); |
| 125388 | | - /* Since pLeft and pRight are both a column references, their collating |
| 125389 | | - ** sequence should always be defined. */ |
| 125390 | | - zColl1 = ALWAYS(pColl) ? pColl->zName : 0; |
| 125934 | + zColl1 = pColl ? pColl->zName : 0; |
| 125391 | 125935 | pColl = sqlite3ExprCollSeq(pParse, pExpr->pRight); |
| 125392 | | - zColl2 = ALWAYS(pColl) ? pColl->zName : 0; |
| 125393 | | - return sqlite3StrICmp(zColl1, zColl2)==0; |
| 125936 | + zColl2 = pColl ? pColl->zName : 0; |
| 125937 | + return sqlite3_stricmp(zColl1, zColl2)==0; |
| 125394 | 125938 | } |
| 125395 | 125939 | |
| 125396 | 125940 | /* |
| 125397 | 125941 | ** Recursively walk the expressions of a SELECT statement and generate |
| 125398 | 125942 | ** a bitmask indicating which tables are used in that expression |
| | @@ -125722,11 +126266,11 @@ |
| 125722 | 126266 | ** current expression is of the form: column MATCH expr. |
| 125723 | 126267 | ** This information is used by the xBestIndex methods of |
| 125724 | 126268 | ** virtual tables. The native query optimizer does not attempt |
| 125725 | 126269 | ** to do anything with MATCH functions. |
| 125726 | 126270 | */ |
| 125727 | | - if( isMatchOfColumn(pExpr, &eOp2) ){ |
| 126271 | + if( pWC->op==TK_AND && isMatchOfColumn(pExpr, &eOp2) ){ |
| 125728 | 126272 | int idxNew; |
| 125729 | 126273 | Expr *pRight, *pLeft; |
| 125730 | 126274 | WhereTerm *pNewTerm; |
| 125731 | 126275 | Bitmask prereqColumn, prereqExpr; |
| 125732 | 126276 | |
| | @@ -126014,10 +126558,22 @@ |
| 126014 | 126558 | ** Return FALSE if the output needs to be sorted. |
| 126015 | 126559 | */ |
| 126016 | 126560 | SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo *pWInfo){ |
| 126017 | 126561 | return pWInfo->nOBSat; |
| 126018 | 126562 | } |
| 126563 | + |
| 126564 | +/* |
| 126565 | +** Return TRUE if the innermost loop of the WHERE clause implementation |
| 126566 | +** returns rows in ORDER BY order for complete run of the inner loop. |
| 126567 | +** |
| 126568 | +** Across multiple iterations of outer loops, the output rows need not be |
| 126569 | +** sorted. As long as rows are sorted for just the innermost loop, this |
| 126570 | +** routine can return TRUE. |
| 126571 | +*/ |
| 126572 | +SQLITE_PRIVATE int sqlite3WhereOrderedInnerLoop(WhereInfo *pWInfo){ |
| 126573 | + return pWInfo->bOrderedInnerLoop; |
| 126574 | +} |
| 126019 | 126575 | |
| 126020 | 126576 | /* |
| 126021 | 126577 | ** Return the VDBE address or label to jump to in order to continue |
| 126022 | 126578 | ** immediately with the next row of a WHERE clause. |
| 126023 | 126579 | */ |
| | @@ -127600,20 +128156,42 @@ |
| 127600 | 128156 | static void whereTermPrint(WhereTerm *pTerm, int iTerm){ |
| 127601 | 128157 | if( pTerm==0 ){ |
| 127602 | 128158 | sqlite3DebugPrintf("TERM-%-3d NULL\n", iTerm); |
| 127603 | 128159 | }else{ |
| 127604 | 128160 | char zType[4]; |
| 128161 | + char zLeft[50]; |
| 127605 | 128162 | memcpy(zType, "...", 4); |
| 127606 | 128163 | if( pTerm->wtFlags & TERM_VIRTUAL ) zType[0] = 'V'; |
| 127607 | 128164 | if( pTerm->eOperator & WO_EQUIV ) zType[1] = 'E'; |
| 127608 | 128165 | if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) zType[2] = 'L'; |
| 128166 | + if( pTerm->eOperator & WO_SINGLE ){ |
| 128167 | + sqlite3_snprintf(sizeof(zLeft),zLeft,"left={%d:%d}", |
| 128168 | + pTerm->leftCursor, pTerm->u.leftColumn); |
| 128169 | + }else if( (pTerm->eOperator & WO_OR)!=0 && pTerm->u.pOrInfo!=0 ){ |
| 128170 | + sqlite3_snprintf(sizeof(zLeft),zLeft,"indexable=0x%lld", |
| 128171 | + pTerm->u.pOrInfo->indexable); |
| 128172 | + }else{ |
| 128173 | + sqlite3_snprintf(sizeof(zLeft),zLeft,"left=%d", pTerm->leftCursor); |
| 128174 | + } |
| 127609 | 128175 | sqlite3DebugPrintf( |
| 127610 | | - "TERM-%-3d %p %s cursor=%-3d prob=%-3d op=0x%03x wtFlags=0x%04x\n", |
| 127611 | | - iTerm, pTerm, zType, pTerm->leftCursor, pTerm->truthProb, |
| 128176 | + "TERM-%-3d %p %s %-12s prob=%-3d op=0x%03x wtFlags=0x%04x\n", |
| 128177 | + iTerm, pTerm, zType, zLeft, pTerm->truthProb, |
| 127612 | 128178 | pTerm->eOperator, pTerm->wtFlags); |
| 127613 | 128179 | sqlite3TreeViewExpr(0, pTerm->pExpr, 0); |
| 127614 | 128180 | } |
| 128181 | +} |
| 128182 | +#endif |
| 128183 | + |
| 128184 | +#ifdef WHERETRACE_ENABLED |
| 128185 | +/* |
| 128186 | +** Show the complete content of a WhereClause |
| 128187 | +*/ |
| 128188 | +SQLITE_PRIVATE void sqlite3WhereClausePrint(WhereClause *pWC){ |
| 128189 | + int i; |
| 128190 | + for(i=0; i<pWC->nTerm; i++){ |
| 128191 | + whereTermPrint(&pWC->a[i], i); |
| 128192 | + } |
| 127615 | 128193 | } |
| 127616 | 128194 | #endif |
| 127617 | 128195 | |
| 127618 | 128196 | #ifdef WHERETRACE_ENABLED |
| 127619 | 128197 | /* |
| | @@ -128599,11 +129177,11 @@ |
| 128599 | 129177 | rLogSize = estLog(rSize); |
| 128600 | 129178 | |
| 128601 | 129179 | #ifndef SQLITE_OMIT_AUTOMATIC_INDEX |
| 128602 | 129180 | /* Automatic indexes */ |
| 128603 | 129181 | if( !pBuilder->pOrSet /* Not part of an OR optimization */ |
| 128604 | | - && (pWInfo->wctrlFlags & WHERE_NO_AUTOINDEX)==0 |
| 129182 | + && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0 |
| 128605 | 129183 | && (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0 |
| 128606 | 129184 | && pSrc->pIBIndex==0 /* Has no INDEXED BY clause */ |
| 128607 | 129185 | && !pSrc->fg.notIndexed /* Has no NOT INDEXED clause */ |
| 128608 | 129186 | && HasRowid(pTab) /* Not WITHOUT ROWID table. (FIXME: Why not?) */ |
| 128609 | 129187 | && !pSrc->fg.isCorrelated /* Not a correlated subquery */ |
| | @@ -128631,10 +129209,11 @@ |
| 128631 | 129209 | pNew->rSetup = rLogSize + rSize + 4; |
| 128632 | 129210 | if( pTab->pSelect==0 && (pTab->tabFlags & TF_Ephemeral)==0 ){ |
| 128633 | 129211 | pNew->rSetup += 24; |
| 128634 | 129212 | } |
| 128635 | 129213 | ApplyCostMultiplier(pNew->rSetup, pTab->costMult); |
| 129214 | + if( pNew->rSetup<0 ) pNew->rSetup = 0; |
| 128636 | 129215 | /* TUNING: Each index lookup yields 20 rows in the table. This |
| 128637 | 129216 | ** is more than the usual guess of 10 rows, since we have no way |
| 128638 | 129217 | ** of knowing how selective the index will ultimately be. It would |
| 128639 | 129218 | ** not be unreasonable to make this value much larger. */ |
| 128640 | 129219 | pNew->nOut = 43; assert( 43==sqlite3LogEst(20) ); |
| | @@ -128691,10 +129270,11 @@ |
| 128691 | 129270 | } |
| 128692 | 129271 | |
| 128693 | 129272 | /* Full scan via index */ |
| 128694 | 129273 | if( b |
| 128695 | 129274 | || !HasRowid(pTab) |
| 129275 | + || pProbe->pPartIdxWhere!=0 |
| 128696 | 129276 | || ( m==0 |
| 128697 | 129277 | && pProbe->bUnordered==0 |
| 128698 | 129278 | && (pProbe->szIdxRow<pTab->szTabRow) |
| 128699 | 129279 | && (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 |
| 128700 | 129280 | && sqlite3GlobalConfig.bUseCis |
| | @@ -129076,13 +129656,11 @@ |
| 129076 | 129656 | sCur.n = 0; |
| 129077 | 129657 | #ifdef WHERETRACE_ENABLED |
| 129078 | 129658 | WHERETRACE(0x200, ("OR-term %d of %p has %d subterms:\n", |
| 129079 | 129659 | (int)(pOrTerm-pOrWC->a), pTerm, sSubBuild.pWC->nTerm)); |
| 129080 | 129660 | if( sqlite3WhereTrace & 0x400 ){ |
| 129081 | | - for(i=0; i<sSubBuild.pWC->nTerm; i++){ |
| 129082 | | - whereTermPrint(&sSubBuild.pWC->a[i], i); |
| 129083 | | - } |
| 129661 | + sqlite3WhereClausePrint(sSubBuild.pWC); |
| 129084 | 129662 | } |
| 129085 | 129663 | #endif |
| 129086 | 129664 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 129087 | 129665 | if( IsVirtual(pItem->pTab) ){ |
| 129088 | 129666 | rc = whereLoopAddVirtual(&sSubBuild, mPrereq, mUnusable); |
| | @@ -129171,19 +129749,22 @@ |
| 129171 | 129749 | /* This condition is true when pItem is the FROM clause term on the |
| 129172 | 129750 | ** right-hand-side of a LEFT or CROSS JOIN. */ |
| 129173 | 129751 | mPrereq = mPrior; |
| 129174 | 129752 | } |
| 129175 | 129753 | priorJointype = pItem->fg.jointype; |
| 129754 | +#ifndef SQLITE_OMIT_VIRTUALTABLE |
| 129176 | 129755 | if( IsVirtual(pItem->pTab) ){ |
| 129177 | 129756 | struct SrcList_item *p; |
| 129178 | 129757 | for(p=&pItem[1]; p<pEnd; p++){ |
| 129179 | 129758 | if( mUnusable || (p->fg.jointype & (JT_LEFT|JT_CROSS)) ){ |
| 129180 | 129759 | mUnusable |= sqlite3WhereGetMask(&pWInfo->sMaskSet, p->iCursor); |
| 129181 | 129760 | } |
| 129182 | 129761 | } |
| 129183 | 129762 | rc = whereLoopAddVirtual(pBuilder, mPrereq, mUnusable); |
| 129184 | | - }else{ |
| 129763 | + }else |
| 129764 | +#endif /* SQLITE_OMIT_VIRTUALTABLE */ |
| 129765 | + { |
| 129185 | 129766 | rc = whereLoopAddBtree(pBuilder, mPrereq); |
| 129186 | 129767 | } |
| 129187 | 129768 | if( rc==SQLITE_OK ){ |
| 129188 | 129769 | rc = whereLoopAddOr(pBuilder, mPrereq, mUnusable); |
| 129189 | 129770 | } |
| | @@ -129214,11 +129795,11 @@ |
| 129214 | 129795 | */ |
| 129215 | 129796 | static i8 wherePathSatisfiesOrderBy( |
| 129216 | 129797 | WhereInfo *pWInfo, /* The WHERE clause */ |
| 129217 | 129798 | ExprList *pOrderBy, /* ORDER BY or GROUP BY or DISTINCT clause to check */ |
| 129218 | 129799 | WherePath *pPath, /* The WherePath to check */ |
| 129219 | | - u16 wctrlFlags, /* Might contain WHERE_GROUPBY or WHERE_DISTINCTBY */ |
| 129800 | + u16 wctrlFlags, /* WHERE_GROUPBY or _DISTINCTBY or _ORDERBY_LIMIT */ |
| 129220 | 129801 | u16 nLoop, /* Number of entries in pPath->aLoop[] */ |
| 129221 | 129802 | WhereLoop *pLast, /* Add this WhereLoop to the end of pPath->aLoop[] */ |
| 129222 | 129803 | Bitmask *pRevMask /* OUT: Mask of WhereLoops to run in reverse order */ |
| 129223 | 129804 | ){ |
| 129224 | 129805 | u8 revSet; /* True if rev is known */ |
| | @@ -129225,10 +129806,11 @@ |
| 129225 | 129806 | u8 rev; /* Composite sort order */ |
| 129226 | 129807 | u8 revIdx; /* Index sort order */ |
| 129227 | 129808 | u8 isOrderDistinct; /* All prior WhereLoops are order-distinct */ |
| 129228 | 129809 | u8 distinctColumns; /* True if the loop has UNIQUE NOT NULL columns */ |
| 129229 | 129810 | u8 isMatch; /* iColumn matches a term of the ORDER BY clause */ |
| 129811 | + u16 eqOpMask; /* Allowed equality operators */ |
| 129230 | 129812 | u16 nKeyCol; /* Number of key columns in pIndex */ |
| 129231 | 129813 | u16 nColumn; /* Total number of ordered columns in the index */ |
| 129232 | 129814 | u16 nOrderBy; /* Number terms in the ORDER BY clause */ |
| 129233 | 129815 | int iLoop; /* Index of WhereLoop in pPath being processed */ |
| 129234 | 129816 | int i, j; /* Loop counters */ |
| | @@ -129275,13 +129857,20 @@ |
| 129275 | 129857 | if( nOrderBy>BMS-1 ) return 0; /* Cannot optimize overly large ORDER BYs */ |
| 129276 | 129858 | isOrderDistinct = 1; |
| 129277 | 129859 | obDone = MASKBIT(nOrderBy)-1; |
| 129278 | 129860 | orderDistinctMask = 0; |
| 129279 | 129861 | ready = 0; |
| 129862 | + eqOpMask = WO_EQ | WO_IS | WO_ISNULL; |
| 129863 | + if( wctrlFlags & WHERE_ORDERBY_LIMIT ) eqOpMask |= WO_IN; |
| 129280 | 129864 | for(iLoop=0; isOrderDistinct && obSat<obDone && iLoop<=nLoop; iLoop++){ |
| 129281 | 129865 | if( iLoop>0 ) ready |= pLoop->maskSelf; |
| 129282 | | - pLoop = iLoop<nLoop ? pPath->aLoop[iLoop] : pLast; |
| 129866 | + if( iLoop<nLoop ){ |
| 129867 | + pLoop = pPath->aLoop[iLoop]; |
| 129868 | + if( wctrlFlags & WHERE_ORDERBY_LIMIT ) continue; |
| 129869 | + }else{ |
| 129870 | + pLoop = pLast; |
| 129871 | + } |
| 129283 | 129872 | if( pLoop->wsFlags & WHERE_VIRTUALTABLE ){ |
| 129284 | 129873 | if( pLoop->u.vtab.isOrdered ) obSat = obDone; |
| 129285 | 129874 | break; |
| 129286 | 129875 | } |
| 129287 | 129876 | iCur = pWInfo->pTabList->a[pLoop->iTab].iCursor; |
| | @@ -129295,11 +129884,11 @@ |
| 129295 | 129884 | if( MASKBIT(i) & obSat ) continue; |
| 129296 | 129885 | pOBExpr = sqlite3ExprSkipCollate(pOrderBy->a[i].pExpr); |
| 129297 | 129886 | if( pOBExpr->op!=TK_COLUMN ) continue; |
| 129298 | 129887 | if( pOBExpr->iTable!=iCur ) continue; |
| 129299 | 129888 | pTerm = sqlite3WhereFindTerm(&pWInfo->sWC, iCur, pOBExpr->iColumn, |
| 129300 | | - ~ready, WO_EQ|WO_ISNULL|WO_IS, 0); |
| 129889 | + ~ready, eqOpMask, 0); |
| 129301 | 129890 | if( pTerm==0 ) continue; |
| 129302 | 129891 | if( (pTerm->eOperator&(WO_EQ|WO_IS))!=0 && pOBExpr->iColumn>=0 ){ |
| 129303 | 129892 | const char *z1, *z2; |
| 129304 | 129893 | pColl = sqlite3ExprCollSeq(pWInfo->pParse, pOrderBy->a[i].pExpr); |
| 129305 | 129894 | if( !pColl ) pColl = db->pDfltColl; |
| | @@ -129335,14 +129924,16 @@ |
| 129335 | 129924 | rev = revSet = 0; |
| 129336 | 129925 | distinctColumns = 0; |
| 129337 | 129926 | for(j=0; j<nColumn; j++){ |
| 129338 | 129927 | u8 bOnce; /* True to run the ORDER BY search loop */ |
| 129339 | 129928 | |
| 129340 | | - /* Skip over == and IS NULL terms */ |
| 129929 | + /* Skip over == and IS and ISNULL terms. |
| 129930 | + ** (Also skip IN terms when doing WHERE_ORDERBY_LIMIT processing) |
| 129931 | + */ |
| 129341 | 129932 | if( j<pLoop->u.btree.nEq |
| 129342 | 129933 | && pLoop->nSkip==0 |
| 129343 | | - && ((i = pLoop->aLTerm[j]->eOperator) & (WO_EQ|WO_ISNULL|WO_IS))!=0 |
| 129934 | + && ((i = pLoop->aLTerm[j]->eOperator) & eqOpMask)!=0 |
| 129344 | 129935 | ){ |
| 129345 | 129936 | if( i & WO_ISNULL ){ |
| 129346 | 129937 | testcase( isOrderDistinct ); |
| 129347 | 129938 | isOrderDistinct = 0; |
| 129348 | 129939 | } |
| | @@ -129862,12 +130453,23 @@ |
| 129862 | 130453 | if( pFrom->isOrdered==pWInfo->pOrderBy->nExpr ){ |
| 129863 | 130454 | pWInfo->eDistinct = WHERE_DISTINCT_ORDERED; |
| 129864 | 130455 | } |
| 129865 | 130456 | }else{ |
| 129866 | 130457 | pWInfo->nOBSat = pFrom->isOrdered; |
| 129867 | | - if( pWInfo->nOBSat<0 ) pWInfo->nOBSat = 0; |
| 129868 | 130458 | pWInfo->revMask = pFrom->revLoop; |
| 130459 | + if( pWInfo->nOBSat<=0 ){ |
| 130460 | + pWInfo->nOBSat = 0; |
| 130461 | + if( nLoop>0 ){ |
| 130462 | + Bitmask m; |
| 130463 | + int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pOrderBy, pFrom, |
| 130464 | + WHERE_ORDERBY_LIMIT, nLoop-1, pFrom->aLoop[nLoop-1], &m); |
| 130465 | + if( rc==pWInfo->pOrderBy->nExpr ){ |
| 130466 | + pWInfo->bOrderedInnerLoop = 1; |
| 130467 | + pWInfo->revMask = m; |
| 130468 | + } |
| 130469 | + } |
| 130470 | + } |
| 129869 | 130471 | } |
| 129870 | 130472 | if( (pWInfo->wctrlFlags & WHERE_SORTBYGROUP) |
| 129871 | 130473 | && pWInfo->nOBSat==pWInfo->pOrderBy->nExpr && nLoop>0 |
| 129872 | 130474 | ){ |
| 129873 | 130475 | Bitmask revMask = 0; |
| | @@ -129911,11 +130513,11 @@ |
| 129911 | 130513 | int j; |
| 129912 | 130514 | Table *pTab; |
| 129913 | 130515 | Index *pIdx; |
| 129914 | 130516 | |
| 129915 | 130517 | pWInfo = pBuilder->pWInfo; |
| 129916 | | - if( pWInfo->wctrlFlags & WHERE_FORCE_TABLE ) return 0; |
| 130518 | + if( pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE ) return 0; |
| 129917 | 130519 | assert( pWInfo->pTabList->nSrc>=1 ); |
| 129918 | 130520 | pItem = pWInfo->pTabList->a; |
| 129919 | 130521 | pTab = pItem->pTab; |
| 129920 | 130522 | if( IsVirtual(pTab) ) return 0; |
| 129921 | 130523 | if( pItem->fg.isIndexedBy ) return 0; |
| | @@ -130058,11 +130660,11 @@ |
| 130058 | 130660 | ** if the WHERE_GROUPBY flag is set in wctrlFlags) of a SELECT statement |
| 130059 | 130661 | ** if there is one. If there is no ORDER BY clause or if this routine |
| 130060 | 130662 | ** is called from an UPDATE or DELETE statement, then pOrderBy is NULL. |
| 130061 | 130663 | ** |
| 130062 | 130664 | ** The iIdxCur parameter is the cursor number of an index. If |
| 130063 | | -** WHERE_ONETABLE_ONLY is set, iIdxCur is the cursor number of an index |
| 130665 | +** WHERE_OR_SUBCLAUSE is set, iIdxCur is the cursor number of an index |
| 130064 | 130666 | ** to use for OR clause processing. The WHERE clause should use this |
| 130065 | 130667 | ** specific cursor. If WHERE_ONEPASS_DESIRED is set, then iIdxCur is |
| 130066 | 130668 | ** the first cursor in an array of cursors for all indices. iIdxCur should |
| 130067 | 130669 | ** be used to compute the appropriate cursor depending on which index is |
| 130068 | 130670 | ** used. |
| | @@ -130072,11 +130674,11 @@ |
| 130072 | 130674 | SrcList *pTabList, /* FROM clause: A list of all tables to be scanned */ |
| 130073 | 130675 | Expr *pWhere, /* The WHERE clause */ |
| 130074 | 130676 | ExprList *pOrderBy, /* An ORDER BY (or GROUP BY) clause, or NULL */ |
| 130075 | 130677 | ExprList *pDistinctSet, /* Try not to output two rows that duplicate these */ |
| 130076 | 130678 | u16 wctrlFlags, /* The WHERE_* flags defined in sqliteInt.h */ |
| 130077 | | - int iAuxArg /* If WHERE_ONETABLE_ONLY is set, index cursor number |
| 130679 | + int iAuxArg /* If WHERE_OR_SUBCLAUSE is set, index cursor number |
| 130078 | 130680 | ** If WHERE_USE_LIMIT, then the limit amount */ |
| 130079 | 130681 | ){ |
| 130080 | 130682 | int nByteWInfo; /* Num. bytes allocated for WhereInfo struct */ |
| 130081 | 130683 | int nTabList; /* Number of elements in pTabList */ |
| 130082 | 130684 | WhereInfo *pWInfo; /* Will become the return value of this function */ |
| | @@ -130091,15 +130693,15 @@ |
| 130091 | 130693 | int rc; /* Return code */ |
| 130092 | 130694 | u8 bFordelete = 0; /* OPFLAG_FORDELETE or zero, as appropriate */ |
| 130093 | 130695 | |
| 130094 | 130696 | assert( (wctrlFlags & WHERE_ONEPASS_MULTIROW)==0 || ( |
| 130095 | 130697 | (wctrlFlags & WHERE_ONEPASS_DESIRED)!=0 |
| 130096 | | - && (wctrlFlags & WHERE_OMIT_OPEN_CLOSE)==0 |
| 130698 | + && (wctrlFlags & WHERE_OR_SUBCLAUSE)==0 |
| 130097 | 130699 | )); |
| 130098 | 130700 | |
| 130099 | | - /* Only one of WHERE_ONETABLE_ONLY or WHERE_USE_LIMIT */ |
| 130100 | | - assert( (wctrlFlags & WHERE_ONETABLE_ONLY)==0 |
| 130701 | + /* Only one of WHERE_OR_SUBCLAUSE or WHERE_USE_LIMIT */ |
| 130702 | + assert( (wctrlFlags & WHERE_OR_SUBCLAUSE)==0 |
| 130101 | 130703 | || (wctrlFlags & WHERE_USE_LIMIT)==0 ); |
| 130102 | 130704 | |
| 130103 | 130705 | /* Variable initialization */ |
| 130104 | 130706 | db = pParse->db; |
| 130105 | 130707 | memset(&sWLB, 0, sizeof(sWLB)); |
| | @@ -130123,15 +130725,15 @@ |
| 130123 | 130725 | sqlite3ErrorMsg(pParse, "at most %d tables in a join", BMS); |
| 130124 | 130726 | return 0; |
| 130125 | 130727 | } |
| 130126 | 130728 | |
| 130127 | 130729 | /* This function normally generates a nested loop for all tables in |
| 130128 | | - ** pTabList. But if the WHERE_ONETABLE_ONLY flag is set, then we should |
| 130730 | + ** pTabList. But if the WHERE_OR_SUBCLAUSE flag is set, then we should |
| 130129 | 130731 | ** only generate code for the first table in pTabList and assume that |
| 130130 | 130732 | ** any cursors associated with subsequent tables are uninitialized. |
| 130131 | 130733 | */ |
| 130132 | | - nTabList = (wctrlFlags & WHERE_ONETABLE_ONLY) ? 1 : pTabList->nSrc; |
| 130734 | + nTabList = (wctrlFlags & WHERE_OR_SUBCLAUSE) ? 1 : pTabList->nSrc; |
| 130133 | 130735 | |
| 130134 | 130736 | /* Allocate and initialize the WhereInfo structure that will become the |
| 130135 | 130737 | ** return value. A single allocation is used to store the WhereInfo |
| 130136 | 130738 | ** struct, the contents of WhereInfo.a[], the WhereClause structure |
| 130137 | 130739 | ** and the WhereMaskSet structure. Since WhereClause contains an 8-byte |
| | @@ -130203,11 +130805,11 @@ |
| 130203 | 130805 | ** important. Ticket #3015. |
| 130204 | 130806 | ** |
| 130205 | 130807 | ** Note that bitmasks are created for all pTabList->nSrc tables in |
| 130206 | 130808 | ** pTabList, not just the first nTabList tables. nTabList is normally |
| 130207 | 130809 | ** equal to pTabList->nSrc but might be shortened to 1 if the |
| 130208 | | - ** WHERE_ONETABLE_ONLY flag is set. |
| 130810 | + ** WHERE_OR_SUBCLAUSE flag is set. |
| 130209 | 130811 | */ |
| 130210 | 130812 | for(ii=0; ii<pTabList->nSrc; ii++){ |
| 130211 | 130813 | createMask(pMaskSet, pTabList->a[ii].iCursor); |
| 130212 | 130814 | sqlite3WhereTabFuncArgs(pParse, &pTabList->a[ii], &pWInfo->sWC); |
| 130213 | 130815 | } |
| | @@ -130241,14 +130843,11 @@ |
| 130241 | 130843 | sqlite3DebugPrintf(", limit: %d", iAuxArg); |
| 130242 | 130844 | } |
| 130243 | 130845 | sqlite3DebugPrintf(")\n"); |
| 130244 | 130846 | } |
| 130245 | 130847 | if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */ |
| 130246 | | - int i; |
| 130247 | | - for(i=0; i<sWLB.pWC->nTerm; i++){ |
| 130248 | | - whereTermPrint(&sWLB.pWC->a[i], i); |
| 130249 | | - } |
| 130848 | + sqlite3WhereClausePrint(sWLB.pWC); |
| 130250 | 130849 | } |
| 130251 | 130850 | #endif |
| 130252 | 130851 | |
| 130253 | 130852 | if( nTabList!=1 || whereShortCut(&sWLB)==0 ){ |
| 130254 | 130853 | rc = whereLoopAddAll(&sWLB); |
| | @@ -130386,11 +130985,11 @@ |
| 130386 | 130985 | }else if( IsVirtual(pTab) ){ |
| 130387 | 130986 | /* noop */ |
| 130388 | 130987 | }else |
| 130389 | 130988 | #endif |
| 130390 | 130989 | if( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 |
| 130391 | | - && (wctrlFlags & WHERE_OMIT_OPEN_CLOSE)==0 ){ |
| 130990 | + && (wctrlFlags & WHERE_OR_SUBCLAUSE)==0 ){ |
| 130392 | 130991 | int op = OP_OpenRead; |
| 130393 | 130992 | if( pWInfo->eOnePass!=ONEPASS_OFF ){ |
| 130394 | 130993 | op = OP_OpenWrite; |
| 130395 | 130994 | pWInfo->aiCurOnePass[0] = pTabItem->iCursor; |
| 130396 | 130995 | }; |
| | @@ -130425,11 +131024,11 @@ |
| 130425 | 131024 | int iIndexCur; |
| 130426 | 131025 | int op = OP_OpenRead; |
| 130427 | 131026 | /* iAuxArg is always set if to a positive value if ONEPASS is possible */ |
| 130428 | 131027 | assert( iAuxArg!=0 || (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 ); |
| 130429 | 131028 | if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIx) |
| 130430 | | - && (wctrlFlags & WHERE_ONETABLE_ONLY)!=0 |
| 131029 | + && (wctrlFlags & WHERE_OR_SUBCLAUSE)!=0 |
| 130431 | 131030 | ){ |
| 130432 | 131031 | /* This is one term of an OR-optimization using the PRIMARY KEY of a |
| 130433 | 131032 | ** WITHOUT ROWID table. No need for a separate index */ |
| 130434 | 131033 | iIndexCur = pLevel->iTabCur; |
| 130435 | 131034 | op = 0; |
| | @@ -130441,13 +131040,13 @@ |
| 130441 | 131040 | iIndexCur++; |
| 130442 | 131041 | pJ = pJ->pNext; |
| 130443 | 131042 | } |
| 130444 | 131043 | op = OP_OpenWrite; |
| 130445 | 131044 | pWInfo->aiCurOnePass[1] = iIndexCur; |
| 130446 | | - }else if( iAuxArg && (wctrlFlags & WHERE_ONETABLE_ONLY)!=0 ){ |
| 131045 | + }else if( iAuxArg && (wctrlFlags & WHERE_OR_SUBCLAUSE)!=0 ){ |
| 130447 | 131046 | iIndexCur = iAuxArg; |
| 130448 | | - if( wctrlFlags & WHERE_REOPEN_IDX ) op = OP_ReopenIdx; |
| 131047 | + op = OP_ReopenIdx; |
| 130449 | 131048 | }else{ |
| 130450 | 131049 | iIndexCur = pParse->nTab++; |
| 130451 | 131050 | } |
| 130452 | 131051 | pLevel->iIdxCur = iIndexCur; |
| 130453 | 131052 | assert( pIx->pSchema==pTab->pSchema ); |
| | @@ -130505,11 +131104,11 @@ |
| 130505 | 131104 | pParse, pTabList, pLevel, ii, pLevel->iFrom, wctrlFlags |
| 130506 | 131105 | ); |
| 130507 | 131106 | pLevel->addrBody = sqlite3VdbeCurrentAddr(v); |
| 130508 | 131107 | notReady = sqlite3WhereCodeOneLoopStart(pWInfo, ii, notReady); |
| 130509 | 131108 | pWInfo->iContinue = pLevel->addrCont; |
| 130510 | | - if( (wsFlags&WHERE_MULTI_OR)==0 && (wctrlFlags&WHERE_ONETABLE_ONLY)==0 ){ |
| 131109 | + if( (wsFlags&WHERE_MULTI_OR)==0 && (wctrlFlags&WHERE_OR_SUBCLAUSE)==0 ){ |
| 130511 | 131110 | sqlite3WhereAddScanStatus(v, pTabList, pLevel, addrExplain); |
| 130512 | 131111 | } |
| 130513 | 131112 | } |
| 130514 | 131113 | |
| 130515 | 131114 | /* Done. */ |
| | @@ -130628,16 +131227,16 @@ |
| 130628 | 131227 | continue; |
| 130629 | 131228 | } |
| 130630 | 131229 | |
| 130631 | 131230 | /* Close all of the cursors that were opened by sqlite3WhereBegin. |
| 130632 | 131231 | ** Except, do not close cursors that will be reused by the OR optimization |
| 130633 | | - ** (WHERE_OMIT_OPEN_CLOSE). And do not close the OP_OpenWrite cursors |
| 131232 | + ** (WHERE_OR_SUBCLAUSE). And do not close the OP_OpenWrite cursors |
| 130634 | 131233 | ** created for the ONEPASS optimization. |
| 130635 | 131234 | */ |
| 130636 | 131235 | if( (pTab->tabFlags & TF_Ephemeral)==0 |
| 130637 | 131236 | && pTab->pSelect==0 |
| 130638 | | - && (pWInfo->wctrlFlags & WHERE_OMIT_OPEN_CLOSE)==0 |
| 131237 | + && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0 |
| 130639 | 131238 | ){ |
| 130640 | 131239 | int ws = pLoop->wsFlags; |
| 130641 | 131240 | if( pWInfo->eOnePass==ONEPASS_OFF && (ws & WHERE_IDX_ONLY)==0 ){ |
| 130642 | 131241 | sqlite3VdbeAddOp1(v, OP_Close, pTabItem->iCursor); |
| 130643 | 131242 | } |
| | @@ -130980,49 +131579,49 @@ |
| 130980 | 131579 | #ifndef INTERFACE |
| 130981 | 131580 | # define INTERFACE 1 |
| 130982 | 131581 | #endif |
| 130983 | 131582 | /************* Begin control #defines *****************************************/ |
| 130984 | 131583 | #define YYCODETYPE unsigned char |
| 130985 | | -#define YYNOCODE 251 |
| 131584 | +#define YYNOCODE 252 |
| 130986 | 131585 | #define YYACTIONTYPE unsigned short int |
| 130987 | 131586 | #define YYWILDCARD 96 |
| 130988 | 131587 | #define sqlite3ParserTOKENTYPE Token |
| 130989 | 131588 | typedef union { |
| 130990 | 131589 | int yyinit; |
| 130991 | 131590 | sqlite3ParserTOKENTYPE yy0; |
| 130992 | | - struct LimitVal yy64; |
| 130993 | | - Expr* yy122; |
| 130994 | | - Select* yy159; |
| 130995 | | - IdList* yy180; |
| 130996 | | - struct {int value; int mask;} yy207; |
| 130997 | | - struct LikeOp yy318; |
| 130998 | | - TriggerStep* yy327; |
| 130999 | | - With* yy331; |
| 131000 | | - ExprSpan yy342; |
| 131001 | | - SrcList* yy347; |
| 131002 | | - int yy392; |
| 131003 | | - struct TrigEvent yy410; |
| 131004 | | - ExprList* yy442; |
| 131591 | + Expr* yy72; |
| 131592 | + TriggerStep* yy145; |
| 131593 | + ExprList* yy148; |
| 131594 | + SrcList* yy185; |
| 131595 | + ExprSpan yy190; |
| 131596 | + int yy194; |
| 131597 | + Select* yy243; |
| 131598 | + IdList* yy254; |
| 131599 | + With* yy285; |
| 131600 | + struct TrigEvent yy332; |
| 131601 | + struct LimitVal yy354; |
| 131602 | + struct LikeOp yy392; |
| 131603 | + struct {int value; int mask;} yy497; |
| 131005 | 131604 | } YYMINORTYPE; |
| 131006 | 131605 | #ifndef YYSTACKDEPTH |
| 131007 | 131606 | #define YYSTACKDEPTH 100 |
| 131008 | 131607 | #endif |
| 131009 | 131608 | #define sqlite3ParserARG_SDECL Parse *pParse; |
| 131010 | 131609 | #define sqlite3ParserARG_PDECL ,Parse *pParse |
| 131011 | 131610 | #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse |
| 131012 | 131611 | #define sqlite3ParserARG_STORE yypParser->pParse = pParse |
| 131013 | 131612 | #define YYFALLBACK 1 |
| 131014 | | -#define YYNSTATE 440 |
| 131015 | | -#define YYNRULE 326 |
| 131016 | | -#define YY_MAX_SHIFT 439 |
| 131017 | | -#define YY_MIN_SHIFTREDUCE 649 |
| 131018 | | -#define YY_MAX_SHIFTREDUCE 974 |
| 131019 | | -#define YY_MIN_REDUCE 975 |
| 131020 | | -#define YY_MAX_REDUCE 1300 |
| 131021 | | -#define YY_ERROR_ACTION 1301 |
| 131022 | | -#define YY_ACCEPT_ACTION 1302 |
| 131023 | | -#define YY_NO_ACTION 1303 |
| 131613 | +#define YYNSTATE 443 |
| 131614 | +#define YYNRULE 328 |
| 131615 | +#define YY_MAX_SHIFT 442 |
| 131616 | +#define YY_MIN_SHIFTREDUCE 653 |
| 131617 | +#define YY_MAX_SHIFTREDUCE 980 |
| 131618 | +#define YY_MIN_REDUCE 981 |
| 131619 | +#define YY_MAX_REDUCE 1308 |
| 131620 | +#define YY_ERROR_ACTION 1309 |
| 131621 | +#define YY_ACCEPT_ACTION 1310 |
| 131622 | +#define YY_NO_ACTION 1311 |
| 131024 | 131623 | /************* End control #defines *******************************************/ |
| 131025 | 131624 | |
| 131026 | 131625 | /* Define the yytestcase() macro to be a no-op if is not already defined |
| 131027 | 131626 | ** otherwise. |
| 131028 | 131627 | ** |
| | @@ -131086,450 +131685,452 @@ |
| 131086 | 131685 | ** yy_reduce_ofst[] For each state, the offset into yy_action for |
| 131087 | 131686 | ** shifting non-terminals after a reduce. |
| 131088 | 131687 | ** yy_default[] Default action for each state. |
| 131089 | 131688 | ** |
| 131090 | 131689 | *********** Begin parsing tables **********************************************/ |
| 131091 | | -#define YY_ACTTAB_COUNT (1501) |
| 131690 | +#define YY_ACTTAB_COUNT (1507) |
| 131092 | 131691 | static const YYACTIONTYPE yy_action[] = { |
| 131093 | | - /* 0 */ 315, 810, 339, 804, 5, 194, 194, 798, 92, 93, |
| 131094 | | - /* 10 */ 83, 819, 819, 831, 834, 823, 823, 90, 90, 91, |
| 131095 | | - /* 20 */ 91, 91, 91, 290, 89, 89, 89, 89, 88, 88, |
| 131096 | | - /* 30 */ 87, 87, 87, 86, 339, 315, 952, 952, 803, 803, |
| 131097 | | - /* 40 */ 803, 922, 342, 92, 93, 83, 819, 819, 831, 834, |
| 131098 | | - /* 50 */ 823, 823, 90, 90, 91, 91, 91, 91, 123, 89, |
| 131099 | | - /* 60 */ 89, 89, 89, 88, 88, 87, 87, 87, 86, 339, |
| 131100 | | - /* 70 */ 88, 88, 87, 87, 87, 86, 339, 772, 952, 952, |
| 131101 | | - /* 80 */ 315, 87, 87, 87, 86, 339, 773, 68, 92, 93, |
| 131102 | | - /* 90 */ 83, 819, 819, 831, 834, 823, 823, 90, 90, 91, |
| 131103 | | - /* 100 */ 91, 91, 91, 434, 89, 89, 89, 89, 88, 88, |
| 131104 | | - /* 110 */ 87, 87, 87, 86, 339, 1302, 146, 921, 2, 315, |
| 131105 | | - /* 120 */ 427, 24, 679, 953, 48, 86, 339, 92, 93, 83, |
| 131106 | | - /* 130 */ 819, 819, 831, 834, 823, 823, 90, 90, 91, 91, |
| 131107 | | - /* 140 */ 91, 91, 94, 89, 89, 89, 89, 88, 88, 87, |
| 131108 | | - /* 150 */ 87, 87, 86, 339, 933, 933, 315, 259, 412, 398, |
| 131109 | | - /* 160 */ 396, 57, 733, 733, 92, 93, 83, 819, 819, 831, |
| 131110 | | - /* 170 */ 834, 823, 823, 90, 90, 91, 91, 91, 91, 56, |
| 131111 | | - /* 180 */ 89, 89, 89, 89, 88, 88, 87, 87, 87, 86, |
| 131112 | | - /* 190 */ 339, 315, 1245, 922, 342, 268, 934, 935, 241, 92, |
| 131113 | | - /* 200 */ 93, 83, 819, 819, 831, 834, 823, 823, 90, 90, |
| 131114 | | - /* 210 */ 91, 91, 91, 91, 291, 89, 89, 89, 89, 88, |
| 131115 | | - /* 220 */ 88, 87, 87, 87, 86, 339, 315, 913, 1295, 682, |
| 131116 | | - /* 230 */ 687, 1295, 233, 397, 92, 93, 83, 819, 819, 831, |
| 131117 | | - /* 240 */ 834, 823, 823, 90, 90, 91, 91, 91, 91, 326, |
| 131118 | | - /* 250 */ 89, 89, 89, 89, 88, 88, 87, 87, 87, 86, |
| 131119 | | - /* 260 */ 339, 315, 85, 82, 168, 680, 431, 938, 939, 92, |
| 131120 | | - /* 270 */ 93, 83, 819, 819, 831, 834, 823, 823, 90, 90, |
| 131121 | | - /* 280 */ 91, 91, 91, 91, 291, 89, 89, 89, 89, 88, |
| 131122 | | - /* 290 */ 88, 87, 87, 87, 86, 339, 315, 319, 913, 1296, |
| 131123 | | - /* 300 */ 797, 911, 1296, 681, 92, 93, 83, 819, 819, 831, |
| 131124 | | - /* 310 */ 834, 823, 823, 90, 90, 91, 91, 91, 91, 335, |
| 131125 | | - /* 320 */ 89, 89, 89, 89, 88, 88, 87, 87, 87, 86, |
| 131126 | | - /* 330 */ 339, 315, 876, 876, 373, 85, 82, 168, 944, 92, |
| 131127 | | - /* 340 */ 93, 83, 819, 819, 831, 834, 823, 823, 90, 90, |
| 131128 | | - /* 350 */ 91, 91, 91, 91, 896, 89, 89, 89, 89, 88, |
| 131129 | | - /* 360 */ 88, 87, 87, 87, 86, 339, 315, 370, 307, 973, |
| 131130 | | - /* 370 */ 367, 1, 911, 433, 92, 93, 83, 819, 819, 831, |
| 131131 | | - /* 380 */ 834, 823, 823, 90, 90, 91, 91, 91, 91, 189, |
| 131132 | | - /* 390 */ 89, 89, 89, 89, 88, 88, 87, 87, 87, 86, |
| 131133 | | - /* 400 */ 339, 315, 720, 948, 933, 933, 149, 718, 948, 92, |
| 131134 | | - /* 410 */ 93, 83, 819, 819, 831, 834, 823, 823, 90, 90, |
| 131135 | | - /* 420 */ 91, 91, 91, 91, 434, 89, 89, 89, 89, 88, |
| 131136 | | - /* 430 */ 88, 87, 87, 87, 86, 339, 338, 938, 939, 947, |
| 131137 | | - /* 440 */ 694, 940, 974, 315, 953, 48, 934, 935, 715, 689, |
| 131138 | | - /* 450 */ 71, 92, 93, 83, 819, 819, 831, 834, 823, 823, |
| 131139 | | - /* 460 */ 90, 90, 91, 91, 91, 91, 320, 89, 89, 89, |
| 131140 | | - /* 470 */ 89, 88, 88, 87, 87, 87, 86, 339, 315, 412, |
| 131141 | | - /* 480 */ 403, 820, 820, 832, 835, 74, 92, 81, 83, 819, |
| 131142 | | - /* 490 */ 819, 831, 834, 823, 823, 90, 90, 91, 91, 91, |
| 131143 | | - /* 500 */ 91, 698, 89, 89, 89, 89, 88, 88, 87, 87, |
| 131144 | | - /* 510 */ 87, 86, 339, 315, 259, 654, 655, 656, 393, 111, |
| 131145 | | - /* 520 */ 331, 153, 93, 83, 819, 819, 831, 834, 823, 823, |
| 131146 | | - /* 530 */ 90, 90, 91, 91, 91, 91, 434, 89, 89, 89, |
| 131147 | | - /* 540 */ 89, 88, 88, 87, 87, 87, 86, 339, 315, 188, |
| 131148 | | - /* 550 */ 187, 186, 824, 937, 328, 219, 953, 48, 83, 819, |
| 131149 | | - /* 560 */ 819, 831, 834, 823, 823, 90, 90, 91, 91, 91, |
| 131150 | | - /* 570 */ 91, 956, 89, 89, 89, 89, 88, 88, 87, 87, |
| 131151 | | - /* 580 */ 87, 86, 339, 79, 429, 738, 3, 1174, 955, 348, |
| 131152 | | - /* 590 */ 737, 332, 792, 933, 933, 937, 79, 429, 730, 3, |
| 131153 | | - /* 600 */ 203, 160, 278, 391, 273, 390, 190, 892, 434, 400, |
| 131154 | | - /* 610 */ 741, 76, 77, 271, 287, 253, 353, 242, 78, 340, |
| 131155 | | - /* 620 */ 340, 85, 82, 168, 76, 77, 233, 397, 953, 48, |
| 131156 | | - /* 630 */ 432, 78, 340, 340, 277, 934, 935, 185, 439, 651, |
| 131157 | | - /* 640 */ 388, 385, 384, 432, 234, 276, 107, 418, 349, 337, |
| 131158 | | - /* 650 */ 336, 383, 893, 728, 215, 949, 123, 971, 308, 810, |
| 131159 | | - /* 660 */ 418, 436, 435, 412, 394, 798, 400, 873, 894, 123, |
| 131160 | | - /* 670 */ 721, 872, 810, 889, 436, 435, 215, 949, 798, 351, |
| 131161 | | - /* 680 */ 722, 697, 380, 434, 771, 371, 22, 434, 400, 79, |
| 131162 | | - /* 690 */ 429, 232, 3, 189, 413, 870, 803, 803, 803, 805, |
| 131163 | | - /* 700 */ 18, 54, 148, 953, 48, 956, 113, 953, 9, 803, |
| 131164 | | - /* 710 */ 803, 803, 805, 18, 310, 123, 748, 76, 77, 742, |
| 131165 | | - /* 720 */ 123, 325, 955, 866, 78, 340, 340, 113, 350, 359, |
| 131166 | | - /* 730 */ 85, 82, 168, 343, 960, 960, 432, 770, 412, 414, |
| 131167 | | - /* 740 */ 407, 23, 1240, 1240, 79, 429, 357, 3, 166, 91, |
| 131168 | | - /* 750 */ 91, 91, 91, 418, 89, 89, 89, 89, 88, 88, |
| 131169 | | - /* 760 */ 87, 87, 87, 86, 339, 810, 434, 436, 435, 792, |
| 131170 | | - /* 770 */ 320, 798, 76, 77, 789, 271, 123, 434, 360, 78, |
| 131171 | | - /* 780 */ 340, 340, 864, 85, 82, 168, 953, 9, 395, 743, |
| 131172 | | - /* 790 */ 360, 432, 253, 358, 252, 933, 933, 953, 30, 889, |
| 131173 | | - /* 800 */ 327, 216, 803, 803, 803, 805, 18, 113, 418, 89, |
| 131174 | | - /* 810 */ 89, 89, 89, 88, 88, 87, 87, 87, 86, 339, |
| 131175 | | - /* 820 */ 810, 113, 436, 435, 792, 185, 798, 288, 388, 385, |
| 131176 | | - /* 830 */ 384, 123, 113, 920, 2, 796, 696, 934, 935, 383, |
| 131177 | | - /* 840 */ 69, 429, 434, 3, 218, 110, 738, 253, 358, 252, |
| 131178 | | - /* 850 */ 434, 737, 933, 933, 892, 359, 222, 803, 803, 803, |
| 131179 | | - /* 860 */ 805, 18, 953, 47, 933, 933, 933, 933, 76, 77, |
| 131180 | | - /* 870 */ 953, 9, 366, 904, 217, 78, 340, 340, 677, 305, |
| 131181 | | - /* 880 */ 304, 303, 206, 301, 224, 259, 664, 432, 337, 336, |
| 131182 | | - /* 890 */ 434, 228, 247, 144, 934, 935, 933, 933, 667, 893, |
| 131183 | | - /* 900 */ 324, 1259, 96, 434, 418, 796, 934, 935, 934, 935, |
| 131184 | | - /* 910 */ 953, 48, 401, 148, 289, 894, 810, 417, 436, 435, |
| 131185 | | - /* 920 */ 677, 759, 798, 953, 9, 314, 220, 162, 161, 170, |
| 131186 | | - /* 930 */ 402, 239, 953, 8, 194, 683, 683, 410, 934, 935, |
| 131187 | | - /* 940 */ 238, 959, 933, 933, 225, 408, 945, 365, 957, 212, |
| 131188 | | - /* 950 */ 958, 172, 757, 803, 803, 803, 805, 18, 173, 365, |
| 131189 | | - /* 960 */ 176, 123, 171, 113, 244, 952, 246, 434, 356, 796, |
| 131190 | | - /* 970 */ 372, 365, 236, 960, 960, 810, 290, 804, 191, 165, |
| 131191 | | - /* 980 */ 852, 798, 259, 316, 934, 935, 237, 953, 34, 404, |
| 131192 | | - /* 990 */ 91, 91, 91, 91, 84, 89, 89, 89, 89, 88, |
| 131193 | | - /* 1000 */ 88, 87, 87, 87, 86, 339, 701, 952, 434, 240, |
| 131194 | | - /* 1010 */ 347, 758, 803, 803, 803, 434, 245, 1179, 434, 389, |
| 131195 | | - /* 1020 */ 434, 376, 434, 895, 167, 434, 405, 702, 953, 35, |
| 131196 | | - /* 1030 */ 673, 321, 221, 434, 333, 953, 11, 434, 953, 26, |
| 131197 | | - /* 1040 */ 953, 36, 953, 37, 251, 953, 38, 434, 259, 434, |
| 131198 | | - /* 1050 */ 757, 434, 329, 953, 27, 434, 223, 953, 28, 434, |
| 131199 | | - /* 1060 */ 690, 434, 67, 434, 65, 434, 862, 953, 39, 953, |
| 131200 | | - /* 1070 */ 40, 953, 41, 423, 434, 953, 10, 434, 772, 953, |
| 131201 | | - /* 1080 */ 42, 953, 98, 953, 43, 953, 44, 773, 434, 346, |
| 131202 | | - /* 1090 */ 434, 75, 434, 73, 953, 31, 434, 953, 45, 434, |
| 131203 | | - /* 1100 */ 259, 434, 690, 434, 757, 434, 887, 434, 953, 46, |
| 131204 | | - /* 1110 */ 953, 32, 953, 115, 434, 266, 953, 116, 951, 953, |
| 131205 | | - /* 1120 */ 117, 953, 52, 953, 33, 953, 99, 953, 49, 726, |
| 131206 | | - /* 1130 */ 434, 909, 434, 19, 953, 100, 434, 344, 434, 113, |
| 131207 | | - /* 1140 */ 434, 258, 692, 434, 259, 434, 670, 434, 20, 434, |
| 131208 | | - /* 1150 */ 953, 101, 953, 97, 434, 259, 953, 114, 953, 112, |
| 131209 | | - /* 1160 */ 953, 105, 113, 953, 104, 953, 102, 953, 103, 953, |
| 131210 | | - /* 1170 */ 51, 434, 148, 434, 953, 53, 167, 434, 259, 113, |
| 131211 | | - /* 1180 */ 300, 307, 912, 363, 311, 860, 248, 261, 209, 264, |
| 131212 | | - /* 1190 */ 416, 953, 50, 953, 25, 420, 727, 953, 29, 430, |
| 131213 | | - /* 1200 */ 321, 424, 757, 428, 322, 124, 1269, 214, 165, 710, |
| 131214 | | - /* 1210 */ 859, 908, 806, 794, 309, 158, 193, 361, 254, 723, |
| 131215 | | - /* 1220 */ 364, 67, 381, 269, 735, 199, 67, 70, 113, 700, |
| 131216 | | - /* 1230 */ 699, 707, 708, 884, 113, 766, 113, 855, 193, 883, |
| 131217 | | - /* 1240 */ 199, 869, 869, 675, 868, 868, 109, 368, 255, 260, |
| 131218 | | - /* 1250 */ 263, 280, 859, 265, 806, 974, 267, 711, 695, 272, |
| 131219 | | - /* 1260 */ 764, 282, 795, 284, 150, 744, 755, 415, 292, 293, |
| 131220 | | - /* 1270 */ 802, 678, 672, 661, 660, 662, 927, 6, 306, 386, |
| 131221 | | - /* 1280 */ 352, 786, 243, 250, 886, 362, 163, 286, 419, 298, |
| 131222 | | - /* 1290 */ 930, 159, 968, 196, 126, 903, 901, 965, 55, 58, |
| 131223 | | - /* 1300 */ 323, 275, 857, 136, 147, 694, 856, 121, 65, 354, |
| 131224 | | - /* 1310 */ 355, 379, 175, 61, 151, 369, 180, 871, 375, 129, |
| 131225 | | - /* 1320 */ 257, 756, 210, 181, 145, 131, 132, 377, 262, 663, |
| 131226 | | - /* 1330 */ 133, 134, 139, 783, 791, 182, 392, 183, 312, 330, |
| 131227 | | - /* 1340 */ 714, 888, 713, 851, 692, 195, 712, 406, 686, 705, |
| 131228 | | - /* 1350 */ 313, 685, 64, 839, 274, 72, 684, 334, 942, 95, |
| 131229 | | - /* 1360 */ 752, 279, 281, 704, 753, 751, 422, 283, 411, 750, |
| 131230 | | - /* 1370 */ 426, 66, 204, 409, 21, 285, 928, 669, 437, 205, |
| 131231 | | - /* 1380 */ 207, 208, 438, 658, 657, 652, 118, 108, 119, 226, |
| 131232 | | - /* 1390 */ 650, 341, 157, 235, 169, 345, 106, 734, 790, 296, |
| 131233 | | - /* 1400 */ 294, 295, 120, 297, 867, 865, 127, 128, 130, 724, |
| 131234 | | - /* 1410 */ 229, 174, 249, 882, 137, 230, 138, 135, 885, 231, |
| 131235 | | - /* 1420 */ 59, 60, 177, 881, 7, 178, 12, 179, 256, 874, |
| 131236 | | - /* 1430 */ 140, 193, 962, 374, 141, 152, 666, 378, 276, 184, |
| 131237 | | - /* 1440 */ 270, 122, 142, 382, 387, 62, 13, 14, 703, 63, |
| 131238 | | - /* 1450 */ 125, 317, 318, 227, 809, 808, 837, 732, 15, 164, |
| 131239 | | - /* 1460 */ 736, 4, 765, 211, 399, 213, 192, 143, 760, 70, |
| 131240 | | - /* 1470 */ 67, 16, 17, 838, 836, 891, 841, 890, 198, 197, |
| 131241 | | - /* 1480 */ 917, 154, 421, 923, 918, 155, 200, 977, 425, 840, |
| 131242 | | - /* 1490 */ 156, 201, 807, 676, 80, 302, 299, 977, 202, 1261, |
| 131243 | | - /* 1500 */ 1260, |
| 131692 | + /* 0 */ 317, 814, 341, 808, 5, 195, 195, 802, 93, 94, |
| 131693 | + /* 10 */ 84, 823, 823, 835, 838, 827, 827, 91, 91, 92, |
| 131694 | + /* 20 */ 92, 92, 92, 293, 90, 90, 90, 90, 89, 89, |
| 131695 | + /* 30 */ 88, 88, 88, 87, 341, 317, 958, 958, 807, 807, |
| 131696 | + /* 40 */ 807, 928, 344, 93, 94, 84, 823, 823, 835, 838, |
| 131697 | + /* 50 */ 827, 827, 91, 91, 92, 92, 92, 92, 328, 90, |
| 131698 | + /* 60 */ 90, 90, 90, 89, 89, 88, 88, 88, 87, 341, |
| 131699 | + /* 70 */ 89, 89, 88, 88, 88, 87, 341, 776, 958, 958, |
| 131700 | + /* 80 */ 317, 88, 88, 88, 87, 341, 777, 69, 93, 94, |
| 131701 | + /* 90 */ 84, 823, 823, 835, 838, 827, 827, 91, 91, 92, |
| 131702 | + /* 100 */ 92, 92, 92, 437, 90, 90, 90, 90, 89, 89, |
| 131703 | + /* 110 */ 88, 88, 88, 87, 341, 1310, 147, 147, 2, 317, |
| 131704 | + /* 120 */ 76, 25, 74, 49, 49, 87, 341, 93, 94, 84, |
| 131705 | + /* 130 */ 823, 823, 835, 838, 827, 827, 91, 91, 92, 92, |
| 131706 | + /* 140 */ 92, 92, 95, 90, 90, 90, 90, 89, 89, 88, |
| 131707 | + /* 150 */ 88, 88, 87, 341, 939, 939, 317, 260, 415, 400, |
| 131708 | + /* 160 */ 398, 58, 737, 737, 93, 94, 84, 823, 823, 835, |
| 131709 | + /* 170 */ 838, 827, 827, 91, 91, 92, 92, 92, 92, 57, |
| 131710 | + /* 180 */ 90, 90, 90, 90, 89, 89, 88, 88, 88, 87, |
| 131711 | + /* 190 */ 341, 317, 1253, 928, 344, 269, 940, 941, 242, 93, |
| 131712 | + /* 200 */ 94, 84, 823, 823, 835, 838, 827, 827, 91, 91, |
| 131713 | + /* 210 */ 92, 92, 92, 92, 293, 90, 90, 90, 90, 89, |
| 131714 | + /* 220 */ 89, 88, 88, 88, 87, 341, 317, 919, 1303, 793, |
| 131715 | + /* 230 */ 691, 1303, 724, 724, 93, 94, 84, 823, 823, 835, |
| 131716 | + /* 240 */ 838, 827, 827, 91, 91, 92, 92, 92, 92, 337, |
| 131717 | + /* 250 */ 90, 90, 90, 90, 89, 89, 88, 88, 88, 87, |
| 131718 | + /* 260 */ 341, 317, 114, 919, 1304, 684, 395, 1304, 124, 93, |
| 131719 | + /* 270 */ 94, 84, 823, 823, 835, 838, 827, 827, 91, 91, |
| 131720 | + /* 280 */ 92, 92, 92, 92, 683, 90, 90, 90, 90, 89, |
| 131721 | + /* 290 */ 89, 88, 88, 88, 87, 341, 317, 86, 83, 169, |
| 131722 | + /* 300 */ 801, 917, 234, 399, 93, 94, 84, 823, 823, 835, |
| 131723 | + /* 310 */ 838, 827, 827, 91, 91, 92, 92, 92, 92, 686, |
| 131724 | + /* 320 */ 90, 90, 90, 90, 89, 89, 88, 88, 88, 87, |
| 131725 | + /* 330 */ 341, 317, 436, 742, 86, 83, 169, 917, 741, 93, |
| 131726 | + /* 340 */ 94, 84, 823, 823, 835, 838, 827, 827, 91, 91, |
| 131727 | + /* 350 */ 92, 92, 92, 92, 902, 90, 90, 90, 90, 89, |
| 131728 | + /* 360 */ 89, 88, 88, 88, 87, 341, 317, 321, 434, 434, |
| 131729 | + /* 370 */ 434, 1, 722, 722, 93, 94, 84, 823, 823, 835, |
| 131730 | + /* 380 */ 838, 827, 827, 91, 91, 92, 92, 92, 92, 190, |
| 131731 | + /* 390 */ 90, 90, 90, 90, 89, 89, 88, 88, 88, 87, |
| 131732 | + /* 400 */ 341, 317, 685, 292, 939, 939, 150, 977, 310, 93, |
| 131733 | + /* 410 */ 94, 84, 823, 823, 835, 838, 827, 827, 91, 91, |
| 131734 | + /* 420 */ 92, 92, 92, 92, 437, 90, 90, 90, 90, 89, |
| 131735 | + /* 430 */ 89, 88, 88, 88, 87, 341, 926, 2, 372, 719, |
| 131736 | + /* 440 */ 698, 369, 950, 317, 49, 49, 940, 941, 719, 177, |
| 131737 | + /* 450 */ 72, 93, 94, 84, 823, 823, 835, 838, 827, 827, |
| 131738 | + /* 460 */ 91, 91, 92, 92, 92, 92, 322, 90, 90, 90, |
| 131739 | + /* 470 */ 90, 89, 89, 88, 88, 88, 87, 341, 317, 415, |
| 131740 | + /* 480 */ 405, 824, 824, 836, 839, 75, 93, 82, 84, 823, |
| 131741 | + /* 490 */ 823, 835, 838, 827, 827, 91, 91, 92, 92, 92, |
| 131742 | + /* 500 */ 92, 430, 90, 90, 90, 90, 89, 89, 88, 88, |
| 131743 | + /* 510 */ 88, 87, 341, 317, 340, 340, 340, 658, 659, 660, |
| 131744 | + /* 520 */ 333, 288, 94, 84, 823, 823, 835, 838, 827, 827, |
| 131745 | + /* 530 */ 91, 91, 92, 92, 92, 92, 437, 90, 90, 90, |
| 131746 | + /* 540 */ 90, 89, 89, 88, 88, 88, 87, 341, 317, 882, |
| 131747 | + /* 550 */ 882, 375, 828, 66, 330, 409, 49, 49, 84, 823, |
| 131748 | + /* 560 */ 823, 835, 838, 827, 827, 91, 91, 92, 92, 92, |
| 131749 | + /* 570 */ 92, 351, 90, 90, 90, 90, 89, 89, 88, 88, |
| 131750 | + /* 580 */ 88, 87, 341, 80, 432, 742, 3, 1180, 351, 350, |
| 131751 | + /* 590 */ 741, 334, 796, 939, 939, 761, 80, 432, 278, 3, |
| 131752 | + /* 600 */ 204, 161, 279, 393, 274, 392, 191, 362, 437, 277, |
| 131753 | + /* 610 */ 745, 77, 78, 272, 800, 254, 355, 243, 79, 342, |
| 131754 | + /* 620 */ 342, 86, 83, 169, 77, 78, 234, 399, 49, 49, |
| 131755 | + /* 630 */ 435, 79, 342, 342, 437, 940, 941, 186, 442, 655, |
| 131756 | + /* 640 */ 390, 387, 386, 435, 235, 213, 108, 421, 761, 351, |
| 131757 | + /* 650 */ 437, 385, 167, 732, 10, 10, 124, 124, 671, 814, |
| 131758 | + /* 660 */ 421, 439, 438, 415, 414, 802, 362, 168, 327, 124, |
| 131759 | + /* 670 */ 49, 49, 814, 219, 439, 438, 800, 186, 802, 326, |
| 131760 | + /* 680 */ 390, 387, 386, 437, 1248, 1248, 23, 939, 939, 80, |
| 131761 | + /* 690 */ 432, 385, 3, 761, 416, 876, 807, 807, 807, 809, |
| 131762 | + /* 700 */ 19, 290, 149, 49, 49, 415, 396, 260, 910, 807, |
| 131763 | + /* 710 */ 807, 807, 809, 19, 312, 237, 145, 77, 78, 746, |
| 131764 | + /* 720 */ 168, 702, 437, 149, 79, 342, 342, 114, 358, 940, |
| 131765 | + /* 730 */ 941, 302, 223, 397, 345, 313, 435, 260, 415, 417, |
| 131766 | + /* 740 */ 858, 374, 31, 31, 80, 432, 761, 3, 348, 92, |
| 131767 | + /* 750 */ 92, 92, 92, 421, 90, 90, 90, 90, 89, 89, |
| 131768 | + /* 760 */ 88, 88, 88, 87, 341, 814, 114, 439, 438, 796, |
| 131769 | + /* 770 */ 367, 802, 77, 78, 701, 796, 124, 1187, 220, 79, |
| 131770 | + /* 780 */ 342, 342, 124, 747, 734, 939, 939, 775, 404, 939, |
| 131771 | + /* 790 */ 939, 435, 254, 360, 253, 402, 895, 346, 254, 360, |
| 131772 | + /* 800 */ 253, 774, 807, 807, 807, 809, 19, 800, 421, 90, |
| 131773 | + /* 810 */ 90, 90, 90, 89, 89, 88, 88, 88, 87, 341, |
| 131774 | + /* 820 */ 814, 114, 439, 438, 939, 939, 802, 940, 941, 114, |
| 131775 | + /* 830 */ 437, 940, 941, 86, 83, 169, 192, 166, 309, 979, |
| 131776 | + /* 840 */ 70, 432, 700, 3, 382, 870, 238, 86, 83, 169, |
| 131777 | + /* 850 */ 10, 10, 361, 406, 763, 190, 222, 807, 807, 807, |
| 131778 | + /* 860 */ 809, 19, 870, 872, 329, 24, 940, 941, 77, 78, |
| 131779 | + /* 870 */ 359, 437, 335, 260, 218, 79, 342, 342, 437, 307, |
| 131780 | + /* 880 */ 306, 305, 207, 303, 339, 338, 668, 435, 339, 338, |
| 131781 | + /* 890 */ 407, 10, 10, 762, 216, 216, 939, 939, 49, 49, |
| 131782 | + /* 900 */ 437, 260, 97, 241, 421, 225, 402, 189, 188, 187, |
| 131783 | + /* 910 */ 309, 918, 980, 149, 221, 898, 814, 868, 439, 438, |
| 131784 | + /* 920 */ 10, 10, 802, 870, 915, 316, 898, 163, 162, 171, |
| 131785 | + /* 930 */ 249, 240, 322, 410, 412, 687, 687, 272, 940, 941, |
| 131786 | + /* 940 */ 239, 965, 901, 437, 226, 403, 226, 437, 963, 367, |
| 131787 | + /* 950 */ 964, 173, 248, 807, 807, 807, 809, 19, 174, 367, |
| 131788 | + /* 960 */ 899, 124, 172, 48, 48, 9, 9, 35, 35, 966, |
| 131789 | + /* 970 */ 966, 899, 363, 966, 966, 814, 900, 808, 725, 939, |
| 131790 | + /* 980 */ 939, 802, 895, 318, 980, 324, 125, 900, 726, 420, |
| 131791 | + /* 990 */ 92, 92, 92, 92, 85, 90, 90, 90, 90, 89, |
| 131792 | + /* 1000 */ 89, 88, 88, 88, 87, 341, 216, 216, 437, 946, |
| 131793 | + /* 1010 */ 349, 292, 807, 807, 807, 114, 291, 693, 402, 705, |
| 131794 | + /* 1020 */ 890, 940, 941, 437, 245, 889, 247, 437, 36, 36, |
| 131795 | + /* 1030 */ 437, 353, 391, 437, 260, 252, 260, 437, 361, 437, |
| 131796 | + /* 1040 */ 706, 437, 370, 12, 12, 224, 437, 27, 27, 437, |
| 131797 | + /* 1050 */ 37, 37, 437, 38, 38, 752, 368, 39, 39, 28, |
| 131798 | + /* 1060 */ 28, 29, 29, 215, 166, 331, 40, 40, 437, 41, |
| 131799 | + /* 1070 */ 41, 437, 42, 42, 437, 866, 246, 731, 437, 879, |
| 131800 | + /* 1080 */ 437, 256, 437, 878, 437, 267, 437, 261, 11, 11, |
| 131801 | + /* 1090 */ 437, 43, 43, 437, 99, 99, 437, 373, 44, 44, |
| 131802 | + /* 1100 */ 45, 45, 32, 32, 46, 46, 47, 47, 437, 426, |
| 131803 | + /* 1110 */ 33, 33, 776, 116, 116, 437, 117, 117, 437, 124, |
| 131804 | + /* 1120 */ 437, 777, 437, 260, 437, 957, 437, 352, 118, 118, |
| 131805 | + /* 1130 */ 437, 195, 437, 111, 437, 53, 53, 264, 34, 34, |
| 131806 | + /* 1140 */ 100, 100, 50, 50, 101, 101, 102, 102, 437, 260, |
| 131807 | + /* 1150 */ 98, 98, 115, 115, 113, 113, 437, 262, 437, 265, |
| 131808 | + /* 1160 */ 437, 943, 958, 437, 727, 437, 681, 437, 106, 106, |
| 131809 | + /* 1170 */ 68, 437, 893, 730, 437, 365, 105, 105, 103, 103, |
| 131810 | + /* 1180 */ 104, 104, 217, 52, 52, 54, 54, 51, 51, 694, |
| 131811 | + /* 1190 */ 259, 26, 26, 266, 30, 30, 677, 323, 433, 323, |
| 131812 | + /* 1200 */ 674, 423, 427, 943, 958, 114, 114, 431, 681, 865, |
| 131813 | + /* 1210 */ 1277, 233, 366, 714, 112, 20, 154, 704, 703, 810, |
| 131814 | + /* 1220 */ 914, 55, 159, 311, 798, 255, 383, 194, 68, 200, |
| 131815 | + /* 1230 */ 21, 694, 268, 114, 114, 114, 270, 711, 712, 68, |
| 131816 | + /* 1240 */ 114, 739, 770, 715, 71, 194, 861, 875, 875, 200, |
| 131817 | + /* 1250 */ 696, 865, 874, 874, 679, 699, 273, 110, 229, 419, |
| 131818 | + /* 1260 */ 768, 810, 799, 378, 748, 759, 418, 210, 294, 281, |
| 131819 | + /* 1270 */ 295, 806, 283, 682, 676, 665, 664, 666, 933, 151, |
| 131820 | + /* 1280 */ 285, 7, 1267, 308, 251, 790, 354, 244, 892, 364, |
| 131821 | + /* 1290 */ 287, 422, 300, 164, 160, 936, 974, 127, 197, 137, |
| 131822 | + /* 1300 */ 909, 907, 971, 388, 276, 863, 862, 56, 698, 325, |
| 131823 | + /* 1310 */ 148, 59, 122, 66, 356, 381, 357, 176, 152, 62, |
| 131824 | + /* 1320 */ 371, 130, 877, 181, 377, 760, 211, 182, 132, 133, |
| 131825 | + /* 1330 */ 134, 135, 258, 146, 140, 795, 787, 263, 183, 379, |
| 131826 | + /* 1340 */ 667, 394, 184, 332, 894, 314, 718, 717, 857, 716, |
| 131827 | + /* 1350 */ 696, 315, 709, 690, 65, 196, 6, 408, 289, 708, |
| 131828 | + /* 1360 */ 275, 689, 688, 948, 756, 757, 280, 282, 425, 755, |
| 131829 | + /* 1370 */ 284, 336, 73, 67, 754, 429, 411, 96, 286, 413, |
| 131830 | + /* 1380 */ 205, 934, 673, 22, 209, 440, 119, 120, 109, 206, |
| 131831 | + /* 1390 */ 208, 441, 662, 661, 656, 843, 654, 343, 158, 236, |
| 131832 | + /* 1400 */ 170, 347, 107, 227, 121, 738, 873, 298, 296, 297, |
| 131833 | + /* 1410 */ 299, 871, 794, 128, 129, 728, 230, 131, 175, 250, |
| 131834 | + /* 1420 */ 888, 136, 138, 231, 232, 139, 60, 61, 891, 178, |
| 131835 | + /* 1430 */ 179, 887, 8, 13, 180, 257, 880, 968, 194, 141, |
| 131836 | + /* 1440 */ 142, 376, 153, 670, 380, 185, 143, 277, 63, 384, |
| 131837 | + /* 1450 */ 14, 707, 271, 15, 389, 64, 319, 320, 126, 228, |
| 131838 | + /* 1460 */ 813, 812, 841, 736, 123, 16, 401, 740, 4, 769, |
| 131839 | + /* 1470 */ 165, 212, 214, 193, 144, 764, 71, 68, 17, 18, |
| 131840 | + /* 1480 */ 856, 842, 840, 897, 845, 896, 199, 198, 923, 155, |
| 131841 | + /* 1490 */ 424, 929, 924, 156, 201, 202, 428, 844, 157, 203, |
| 131842 | + /* 1500 */ 811, 680, 81, 1269, 1268, 301, 304, |
| 131244 | 131843 | }; |
| 131245 | 131844 | static const YYCODETYPE yy_lookahead[] = { |
| 131246 | 131845 | /* 0 */ 19, 95, 53, 97, 22, 24, 24, 101, 27, 28, |
| 131247 | 131846 | /* 10 */ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, |
| 131248 | 131847 | /* 20 */ 39, 40, 41, 152, 43, 44, 45, 46, 47, 48, |
| 131249 | 131848 | /* 30 */ 49, 50, 51, 52, 53, 19, 55, 55, 132, 133, |
| 131250 | 131849 | /* 40 */ 134, 1, 2, 27, 28, 29, 30, 31, 32, 33, |
| 131251 | | - /* 50 */ 34, 35, 36, 37, 38, 39, 40, 41, 92, 43, |
| 131850 | + /* 50 */ 34, 35, 36, 37, 38, 39, 40, 41, 187, 43, |
| 131252 | 131851 | /* 60 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
| 131253 | 131852 | /* 70 */ 47, 48, 49, 50, 51, 52, 53, 61, 97, 97, |
| 131254 | 131853 | /* 80 */ 19, 49, 50, 51, 52, 53, 70, 26, 27, 28, |
| 131255 | 131854 | /* 90 */ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, |
| 131256 | 131855 | /* 100 */ 39, 40, 41, 152, 43, 44, 45, 46, 47, 48, |
| 131257 | 131856 | /* 110 */ 49, 50, 51, 52, 53, 144, 145, 146, 147, 19, |
| 131258 | | - /* 120 */ 249, 22, 172, 172, 173, 52, 53, 27, 28, 29, |
| 131857 | + /* 120 */ 137, 22, 139, 172, 173, 52, 53, 27, 28, 29, |
| 131259 | 131858 | /* 130 */ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, |
| 131260 | 131859 | /* 140 */ 40, 41, 81, 43, 44, 45, 46, 47, 48, 49, |
| 131261 | 131860 | /* 150 */ 50, 51, 52, 53, 55, 56, 19, 152, 207, 208, |
| 131262 | 131861 | /* 160 */ 115, 24, 117, 118, 27, 28, 29, 30, 31, 32, |
| 131263 | 131862 | /* 170 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 79, |
| 131264 | 131863 | /* 180 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 131265 | 131864 | /* 190 */ 53, 19, 0, 1, 2, 23, 97, 98, 193, 27, |
| 131266 | 131865 | /* 200 */ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, |
| 131267 | 131866 | /* 210 */ 38, 39, 40, 41, 152, 43, 44, 45, 46, 47, |
| 131268 | | - /* 220 */ 48, 49, 50, 51, 52, 53, 19, 22, 23, 172, |
| 131269 | | - /* 230 */ 23, 26, 119, 120, 27, 28, 29, 30, 31, 32, |
| 131867 | + /* 220 */ 48, 49, 50, 51, 52, 53, 19, 22, 23, 163, |
| 131868 | + /* 230 */ 23, 26, 190, 191, 27, 28, 29, 30, 31, 32, |
| 131270 | 131869 | /* 240 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 187, |
| 131271 | 131870 | /* 250 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 131272 | | - /* 260 */ 53, 19, 221, 222, 223, 23, 168, 169, 170, 27, |
| 131871 | + /* 260 */ 53, 19, 196, 22, 23, 23, 49, 26, 92, 27, |
| 131273 | 131872 | /* 270 */ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, |
| 131274 | | - /* 280 */ 38, 39, 40, 41, 152, 43, 44, 45, 46, 47, |
| 131275 | | - /* 290 */ 48, 49, 50, 51, 52, 53, 19, 157, 22, 23, |
| 131276 | | - /* 300 */ 23, 96, 26, 172, 27, 28, 29, 30, 31, 32, |
| 131277 | | - /* 310 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 187, |
| 131873 | + /* 280 */ 38, 39, 40, 41, 172, 43, 44, 45, 46, 47, |
| 131874 | + /* 290 */ 48, 49, 50, 51, 52, 53, 19, 221, 222, 223, |
| 131875 | + /* 300 */ 23, 96, 119, 120, 27, 28, 29, 30, 31, 32, |
| 131876 | + /* 310 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 172, |
| 131278 | 131877 | /* 320 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 131279 | | - /* 330 */ 53, 19, 108, 109, 110, 221, 222, 223, 185, 27, |
| 131878 | + /* 330 */ 53, 19, 152, 116, 221, 222, 223, 96, 121, 27, |
| 131280 | 131879 | /* 340 */ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, |
| 131281 | | - /* 350 */ 38, 39, 40, 41, 240, 43, 44, 45, 46, 47, |
| 131282 | | - /* 360 */ 48, 49, 50, 51, 52, 53, 19, 227, 22, 23, |
| 131283 | | - /* 370 */ 230, 22, 96, 152, 27, 28, 29, 30, 31, 32, |
| 131880 | + /* 350 */ 38, 39, 40, 41, 241, 43, 44, 45, 46, 47, |
| 131881 | + /* 360 */ 48, 49, 50, 51, 52, 53, 19, 157, 168, 169, |
| 131882 | + /* 370 */ 170, 22, 190, 191, 27, 28, 29, 30, 31, 32, |
| 131284 | 131883 | /* 380 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 30, |
| 131285 | 131884 | /* 390 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 131286 | | - /* 400 */ 53, 19, 190, 191, 55, 56, 24, 190, 191, 27, |
| 131885 | + /* 400 */ 53, 19, 172, 152, 55, 56, 24, 247, 248, 27, |
| 131287 | 131886 | /* 410 */ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, |
| 131288 | 131887 | /* 420 */ 38, 39, 40, 41, 152, 43, 44, 45, 46, 47, |
| 131289 | | - /* 430 */ 48, 49, 50, 51, 52, 53, 168, 169, 170, 179, |
| 131290 | | - /* 440 */ 180, 171, 96, 19, 172, 173, 97, 98, 188, 179, |
| 131888 | + /* 430 */ 48, 49, 50, 51, 52, 53, 146, 147, 228, 179, |
| 131889 | + /* 440 */ 180, 231, 185, 19, 172, 173, 97, 98, 188, 26, |
| 131291 | 131890 | /* 450 */ 138, 27, 28, 29, 30, 31, 32, 33, 34, 35, |
| 131292 | 131891 | /* 460 */ 36, 37, 38, 39, 40, 41, 107, 43, 44, 45, |
| 131293 | 131892 | /* 470 */ 46, 47, 48, 49, 50, 51, 52, 53, 19, 207, |
| 131294 | 131893 | /* 480 */ 208, 30, 31, 32, 33, 138, 27, 28, 29, 30, |
| 131295 | 131894 | /* 490 */ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, |
| 131296 | | - /* 500 */ 41, 181, 43, 44, 45, 46, 47, 48, 49, 50, |
| 131297 | | - /* 510 */ 51, 52, 53, 19, 152, 7, 8, 9, 49, 22, |
| 131298 | | - /* 520 */ 19, 24, 28, 29, 30, 31, 32, 33, 34, 35, |
| 131895 | + /* 500 */ 41, 250, 43, 44, 45, 46, 47, 48, 49, 50, |
| 131896 | + /* 510 */ 51, 52, 53, 19, 168, 169, 170, 7, 8, 9, |
| 131897 | + /* 520 */ 19, 152, 28, 29, 30, 31, 32, 33, 34, 35, |
| 131299 | 131898 | /* 530 */ 36, 37, 38, 39, 40, 41, 152, 43, 44, 45, |
| 131300 | 131899 | /* 540 */ 46, 47, 48, 49, 50, 51, 52, 53, 19, 108, |
| 131301 | | - /* 550 */ 109, 110, 101, 55, 53, 193, 172, 173, 29, 30, |
| 131900 | + /* 550 */ 109, 110, 101, 130, 53, 152, 172, 173, 29, 30, |
| 131302 | 131901 | /* 560 */ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, |
| 131303 | 131902 | /* 570 */ 41, 152, 43, 44, 45, 46, 47, 48, 49, 50, |
| 131304 | 131903 | /* 580 */ 51, 52, 53, 19, 20, 116, 22, 23, 169, 170, |
| 131305 | | - /* 590 */ 121, 207, 85, 55, 56, 97, 19, 20, 195, 22, |
| 131306 | | - /* 600 */ 99, 100, 101, 102, 103, 104, 105, 12, 152, 206, |
| 131904 | + /* 590 */ 121, 207, 85, 55, 56, 26, 19, 20, 101, 22, |
| 131905 | + /* 600 */ 99, 100, 101, 102, 103, 104, 105, 152, 152, 112, |
| 131307 | 131906 | /* 610 */ 210, 47, 48, 112, 152, 108, 109, 110, 54, 55, |
| 131308 | 131907 | /* 620 */ 56, 221, 222, 223, 47, 48, 119, 120, 172, 173, |
| 131309 | | - /* 630 */ 66, 54, 55, 56, 101, 97, 98, 99, 148, 149, |
| 131310 | | - /* 640 */ 102, 103, 104, 66, 154, 112, 156, 83, 229, 47, |
| 131311 | | - /* 650 */ 48, 113, 57, 163, 194, 195, 92, 246, 247, 95, |
| 131312 | | - /* 660 */ 83, 97, 98, 207, 208, 101, 206, 59, 73, 92, |
| 131313 | | - /* 670 */ 75, 63, 95, 163, 97, 98, 194, 195, 101, 219, |
| 131314 | | - /* 680 */ 85, 181, 19, 152, 175, 77, 196, 152, 206, 19, |
| 131315 | | - /* 690 */ 20, 199, 22, 30, 163, 11, 132, 133, 134, 135, |
| 131316 | | - /* 700 */ 136, 209, 152, 172, 173, 152, 196, 172, 173, 132, |
| 131317 | | - /* 710 */ 133, 134, 135, 136, 164, 92, 213, 47, 48, 49, |
| 131318 | | - /* 720 */ 92, 186, 169, 170, 54, 55, 56, 196, 100, 219, |
| 131319 | | - /* 730 */ 221, 222, 223, 243, 132, 133, 66, 175, 207, 208, |
| 131320 | | - /* 740 */ 152, 231, 119, 120, 19, 20, 236, 22, 152, 38, |
| 131908 | + /* 630 */ 66, 54, 55, 56, 152, 97, 98, 99, 148, 149, |
| 131909 | + /* 640 */ 102, 103, 104, 66, 154, 23, 156, 83, 26, 230, |
| 131910 | + /* 650 */ 152, 113, 152, 163, 172, 173, 92, 92, 21, 95, |
| 131911 | + /* 660 */ 83, 97, 98, 207, 208, 101, 152, 98, 186, 92, |
| 131912 | + /* 670 */ 172, 173, 95, 218, 97, 98, 152, 99, 101, 217, |
| 131913 | + /* 680 */ 102, 103, 104, 152, 119, 120, 196, 55, 56, 19, |
| 131914 | + /* 690 */ 20, 113, 22, 124, 163, 11, 132, 133, 134, 135, |
| 131915 | + /* 700 */ 136, 152, 152, 172, 173, 207, 208, 152, 152, 132, |
| 131916 | + /* 710 */ 133, 134, 135, 136, 164, 152, 84, 47, 48, 49, |
| 131917 | + /* 720 */ 98, 181, 152, 152, 54, 55, 56, 196, 91, 97, |
| 131918 | + /* 730 */ 98, 160, 218, 163, 244, 164, 66, 152, 207, 208, |
| 131919 | + /* 740 */ 103, 217, 172, 173, 19, 20, 124, 22, 193, 38, |
| 131321 | 131920 | /* 750 */ 39, 40, 41, 83, 43, 44, 45, 46, 47, 48, |
| 131322 | | - /* 760 */ 49, 50, 51, 52, 53, 95, 152, 97, 98, 85, |
| 131323 | | - /* 770 */ 107, 101, 47, 48, 163, 112, 92, 152, 152, 54, |
| 131324 | | - /* 780 */ 55, 56, 229, 221, 222, 223, 172, 173, 163, 49, |
| 131325 | | - /* 790 */ 152, 66, 108, 109, 110, 55, 56, 172, 173, 163, |
| 131326 | | - /* 800 */ 186, 22, 132, 133, 134, 135, 136, 196, 83, 43, |
| 131921 | + /* 760 */ 49, 50, 51, 52, 53, 95, 196, 97, 98, 85, |
| 131922 | + /* 770 */ 152, 101, 47, 48, 181, 85, 92, 140, 193, 54, |
| 131923 | + /* 780 */ 55, 56, 92, 49, 195, 55, 56, 175, 163, 55, |
| 131924 | + /* 790 */ 56, 66, 108, 109, 110, 206, 163, 242, 108, 109, |
| 131925 | + /* 800 */ 110, 175, 132, 133, 134, 135, 136, 152, 83, 43, |
| 131327 | 131926 | /* 810 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
| 131328 | | - /* 820 */ 95, 196, 97, 98, 85, 99, 101, 152, 102, 103, |
| 131329 | | - /* 830 */ 104, 92, 196, 146, 147, 152, 181, 97, 98, 113, |
| 131330 | | - /* 840 */ 19, 20, 152, 22, 218, 22, 116, 108, 109, 110, |
| 131331 | | - /* 850 */ 152, 121, 55, 56, 12, 219, 218, 132, 133, 134, |
| 131332 | | - /* 860 */ 135, 136, 172, 173, 55, 56, 55, 56, 47, 48, |
| 131333 | | - /* 870 */ 172, 173, 236, 152, 5, 54, 55, 56, 55, 10, |
| 131334 | | - /* 880 */ 11, 12, 13, 14, 186, 152, 17, 66, 47, 48, |
| 131335 | | - /* 890 */ 152, 210, 16, 84, 97, 98, 55, 56, 21, 57, |
| 131336 | | - /* 900 */ 217, 122, 22, 152, 83, 152, 97, 98, 97, 98, |
| 131337 | | - /* 910 */ 172, 173, 152, 152, 224, 73, 95, 75, 97, 98, |
| 131338 | | - /* 920 */ 97, 124, 101, 172, 173, 164, 193, 47, 48, 60, |
| 131339 | | - /* 930 */ 163, 62, 172, 173, 24, 55, 56, 186, 97, 98, |
| 131340 | | - /* 940 */ 71, 100, 55, 56, 183, 207, 185, 152, 107, 23, |
| 131341 | | - /* 950 */ 109, 82, 26, 132, 133, 134, 135, 136, 89, 152, |
| 131342 | | - /* 960 */ 26, 92, 93, 196, 88, 55, 90, 152, 91, 152, |
| 131343 | | - /* 970 */ 217, 152, 152, 132, 133, 95, 152, 97, 211, 212, |
| 131344 | | - /* 980 */ 103, 101, 152, 114, 97, 98, 152, 172, 173, 19, |
| 131927 | + /* 820 */ 95, 196, 97, 98, 55, 56, 101, 97, 98, 196, |
| 131928 | + /* 830 */ 152, 97, 98, 221, 222, 223, 211, 212, 22, 23, |
| 131929 | + /* 840 */ 19, 20, 181, 22, 19, 152, 152, 221, 222, 223, |
| 131930 | + /* 850 */ 172, 173, 219, 19, 124, 30, 238, 132, 133, 134, |
| 131931 | + /* 860 */ 135, 136, 169, 170, 186, 232, 97, 98, 47, 48, |
| 131932 | + /* 870 */ 237, 152, 217, 152, 5, 54, 55, 56, 152, 10, |
| 131933 | + /* 880 */ 11, 12, 13, 14, 47, 48, 17, 66, 47, 48, |
| 131934 | + /* 890 */ 56, 172, 173, 124, 194, 195, 55, 56, 172, 173, |
| 131935 | + /* 900 */ 152, 152, 22, 152, 83, 186, 206, 108, 109, 110, |
| 131936 | + /* 910 */ 22, 23, 96, 152, 193, 12, 95, 152, 97, 98, |
| 131937 | + /* 920 */ 172, 173, 101, 230, 152, 164, 12, 47, 48, 60, |
| 131938 | + /* 930 */ 152, 62, 107, 207, 186, 55, 56, 112, 97, 98, |
| 131939 | + /* 940 */ 71, 100, 193, 152, 183, 152, 185, 152, 107, 152, |
| 131940 | + /* 950 */ 109, 82, 16, 132, 133, 134, 135, 136, 89, 152, |
| 131941 | + /* 960 */ 57, 92, 93, 172, 173, 172, 173, 172, 173, 132, |
| 131942 | + /* 970 */ 133, 57, 152, 132, 133, 95, 73, 97, 75, 55, |
| 131943 | + /* 980 */ 56, 101, 163, 114, 96, 245, 246, 73, 85, 75, |
| 131345 | 131944 | /* 990 */ 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, |
| 131346 | | - /* 1000 */ 48, 49, 50, 51, 52, 53, 65, 97, 152, 152, |
| 131347 | | - /* 1010 */ 141, 124, 132, 133, 134, 152, 140, 140, 152, 78, |
| 131348 | | - /* 1020 */ 152, 233, 152, 193, 98, 152, 56, 86, 172, 173, |
| 131349 | | - /* 1030 */ 166, 167, 237, 152, 217, 172, 173, 152, 172, 173, |
| 131350 | | - /* 1040 */ 172, 173, 172, 173, 237, 172, 173, 152, 152, 152, |
| 131351 | | - /* 1050 */ 124, 152, 111, 172, 173, 152, 237, 172, 173, 152, |
| 131352 | | - /* 1060 */ 55, 152, 26, 152, 130, 152, 152, 172, 173, 172, |
| 131353 | | - /* 1070 */ 173, 172, 173, 249, 152, 172, 173, 152, 61, 172, |
| 131354 | | - /* 1080 */ 173, 172, 173, 172, 173, 172, 173, 70, 152, 193, |
| 131355 | | - /* 1090 */ 152, 137, 152, 139, 172, 173, 152, 172, 173, 152, |
| 131356 | | - /* 1100 */ 152, 152, 97, 152, 26, 152, 163, 152, 172, 173, |
| 131357 | | - /* 1110 */ 172, 173, 172, 173, 152, 16, 172, 173, 26, 172, |
| 131358 | | - /* 1120 */ 173, 172, 173, 172, 173, 172, 173, 172, 173, 163, |
| 131359 | | - /* 1130 */ 152, 152, 152, 22, 172, 173, 152, 241, 152, 196, |
| 131360 | | - /* 1140 */ 152, 193, 106, 152, 152, 152, 163, 152, 37, 152, |
| 131361 | | - /* 1150 */ 172, 173, 172, 173, 152, 152, 172, 173, 172, 173, |
| 131362 | | - /* 1160 */ 172, 173, 196, 172, 173, 172, 173, 172, 173, 172, |
| 131363 | | - /* 1170 */ 173, 152, 152, 152, 172, 173, 98, 152, 152, 196, |
| 131364 | | - /* 1180 */ 160, 22, 23, 19, 164, 193, 152, 88, 232, 90, |
| 131365 | | - /* 1190 */ 191, 172, 173, 172, 173, 163, 193, 172, 173, 166, |
| 131366 | | - /* 1200 */ 167, 163, 124, 163, 244, 245, 23, 211, 212, 26, |
| 131367 | | - /* 1210 */ 55, 23, 55, 23, 26, 123, 26, 152, 23, 193, |
| 131368 | | - /* 1220 */ 56, 26, 23, 23, 23, 26, 26, 26, 196, 100, |
| 131369 | | - /* 1230 */ 101, 7, 8, 152, 196, 23, 196, 23, 26, 152, |
| 131370 | | - /* 1240 */ 26, 132, 133, 23, 132, 133, 26, 152, 152, 152, |
| 131371 | | - /* 1250 */ 152, 210, 97, 152, 97, 96, 152, 152, 152, 152, |
| 131372 | | - /* 1260 */ 152, 210, 152, 210, 197, 152, 152, 152, 152, 152, |
| 131373 | | - /* 1270 */ 152, 152, 152, 152, 152, 152, 152, 198, 150, 176, |
| 131374 | | - /* 1280 */ 214, 201, 214, 238, 201, 238, 184, 214, 226, 200, |
| 131375 | | - /* 1290 */ 155, 198, 67, 122, 242, 159, 159, 69, 239, 239, |
| 131376 | | - /* 1300 */ 159, 175, 175, 22, 220, 180, 175, 27, 130, 18, |
| 131377 | | - /* 1310 */ 159, 18, 158, 137, 220, 159, 158, 235, 74, 189, |
| 131378 | | - /* 1320 */ 234, 159, 159, 158, 22, 192, 192, 177, 159, 159, |
| 131379 | | - /* 1330 */ 192, 192, 189, 201, 189, 158, 107, 158, 177, 76, |
| 131380 | | - /* 1340 */ 174, 201, 174, 201, 106, 159, 174, 125, 174, 182, |
| 131381 | | - /* 1350 */ 177, 176, 107, 159, 174, 137, 174, 53, 174, 129, |
| 131382 | | - /* 1360 */ 216, 215, 215, 182, 216, 216, 177, 215, 126, 216, |
| 131383 | | - /* 1370 */ 177, 128, 25, 127, 26, 215, 13, 162, 161, 153, |
| 131384 | | - /* 1380 */ 153, 6, 151, 151, 151, 151, 165, 178, 165, 178, |
| 131385 | | - /* 1390 */ 4, 3, 22, 142, 15, 94, 16, 205, 120, 202, |
| 131386 | | - /* 1400 */ 204, 203, 165, 201, 23, 23, 131, 111, 123, 20, |
| 131387 | | - /* 1410 */ 225, 125, 16, 1, 131, 228, 111, 123, 56, 228, |
| 131388 | | - /* 1420 */ 37, 37, 64, 1, 5, 122, 22, 107, 140, 80, |
| 131389 | | - /* 1430 */ 80, 26, 87, 72, 107, 24, 20, 19, 112, 105, |
| 131390 | | - /* 1440 */ 23, 68, 22, 79, 79, 22, 22, 22, 58, 22, |
| 131391 | | - /* 1450 */ 245, 248, 248, 79, 23, 23, 23, 116, 22, 122, |
| 131392 | | - /* 1460 */ 23, 22, 56, 23, 26, 23, 64, 22, 124, 26, |
| 131393 | | - /* 1470 */ 26, 64, 64, 23, 23, 23, 11, 23, 22, 26, |
| 131394 | | - /* 1480 */ 23, 22, 24, 1, 23, 22, 26, 250, 24, 23, |
| 131395 | | - /* 1490 */ 22, 122, 23, 23, 22, 15, 23, 250, 122, 122, |
| 131396 | | - /* 1500 */ 122, |
| 131945 | + /* 1000 */ 48, 49, 50, 51, 52, 53, 194, 195, 152, 171, |
| 131946 | + /* 1010 */ 141, 152, 132, 133, 134, 196, 225, 179, 206, 65, |
| 131947 | + /* 1020 */ 152, 97, 98, 152, 88, 152, 90, 152, 172, 173, |
| 131948 | + /* 1030 */ 152, 219, 78, 152, 152, 238, 152, 152, 219, 152, |
| 131949 | + /* 1040 */ 86, 152, 152, 172, 173, 238, 152, 172, 173, 152, |
| 131950 | + /* 1050 */ 172, 173, 152, 172, 173, 213, 237, 172, 173, 172, |
| 131951 | + /* 1060 */ 173, 172, 173, 211, 212, 111, 172, 173, 152, 172, |
| 131952 | + /* 1070 */ 173, 152, 172, 173, 152, 193, 140, 193, 152, 59, |
| 131953 | + /* 1080 */ 152, 152, 152, 63, 152, 16, 152, 152, 172, 173, |
| 131954 | + /* 1090 */ 152, 172, 173, 152, 172, 173, 152, 77, 172, 173, |
| 131955 | + /* 1100 */ 172, 173, 172, 173, 172, 173, 172, 173, 152, 250, |
| 131956 | + /* 1110 */ 172, 173, 61, 172, 173, 152, 172, 173, 152, 92, |
| 131957 | + /* 1120 */ 152, 70, 152, 152, 152, 26, 152, 100, 172, 173, |
| 131958 | + /* 1130 */ 152, 24, 152, 22, 152, 172, 173, 152, 172, 173, |
| 131959 | + /* 1140 */ 172, 173, 172, 173, 172, 173, 172, 173, 152, 152, |
| 131960 | + /* 1150 */ 172, 173, 172, 173, 172, 173, 152, 88, 152, 90, |
| 131961 | + /* 1160 */ 152, 55, 55, 152, 193, 152, 55, 152, 172, 173, |
| 131962 | + /* 1170 */ 26, 152, 163, 163, 152, 19, 172, 173, 172, 173, |
| 131963 | + /* 1180 */ 172, 173, 22, 172, 173, 172, 173, 172, 173, 55, |
| 131964 | + /* 1190 */ 193, 172, 173, 152, 172, 173, 166, 167, 166, 167, |
| 131965 | + /* 1200 */ 163, 163, 163, 97, 97, 196, 196, 163, 97, 55, |
| 131966 | + /* 1210 */ 23, 199, 56, 26, 22, 22, 24, 100, 101, 55, |
| 131967 | + /* 1220 */ 23, 209, 123, 26, 23, 23, 23, 26, 26, 26, |
| 131968 | + /* 1230 */ 37, 97, 152, 196, 196, 196, 23, 7, 8, 26, |
| 131969 | + /* 1240 */ 196, 23, 23, 152, 26, 26, 23, 132, 133, 26, |
| 131970 | + /* 1250 */ 106, 97, 132, 133, 23, 152, 152, 26, 210, 191, |
| 131971 | + /* 1260 */ 152, 97, 152, 234, 152, 152, 152, 233, 152, 210, |
| 131972 | + /* 1270 */ 152, 152, 210, 152, 152, 152, 152, 152, 152, 197, |
| 131973 | + /* 1280 */ 210, 198, 122, 150, 239, 201, 214, 214, 201, 239, |
| 131974 | + /* 1290 */ 214, 227, 200, 184, 198, 155, 67, 243, 122, 22, |
| 131975 | + /* 1300 */ 159, 159, 69, 176, 175, 175, 175, 240, 180, 159, |
| 131976 | + /* 1310 */ 220, 240, 27, 130, 18, 18, 159, 158, 220, 137, |
| 131977 | + /* 1320 */ 159, 189, 236, 158, 74, 159, 159, 158, 192, 192, |
| 131978 | + /* 1330 */ 192, 192, 235, 22, 189, 189, 201, 159, 158, 177, |
| 131979 | + /* 1340 */ 159, 107, 158, 76, 201, 177, 174, 174, 201, 174, |
| 131980 | + /* 1350 */ 106, 177, 182, 174, 107, 159, 22, 125, 159, 182, |
| 131981 | + /* 1360 */ 174, 176, 174, 174, 216, 216, 215, 215, 177, 216, |
| 131982 | + /* 1370 */ 215, 53, 137, 128, 216, 177, 127, 129, 215, 126, |
| 131983 | + /* 1380 */ 25, 13, 162, 26, 6, 161, 165, 165, 178, 153, |
| 131984 | + /* 1390 */ 153, 151, 151, 151, 151, 224, 4, 3, 22, 142, |
| 131985 | + /* 1400 */ 15, 94, 16, 178, 165, 205, 23, 202, 204, 203, |
| 131986 | + /* 1410 */ 201, 23, 120, 131, 111, 20, 226, 123, 125, 16, |
| 131987 | + /* 1420 */ 1, 123, 131, 229, 229, 111, 37, 37, 56, 64, |
| 131988 | + /* 1430 */ 122, 1, 5, 22, 107, 140, 80, 87, 26, 80, |
| 131989 | + /* 1440 */ 107, 72, 24, 20, 19, 105, 22, 112, 22, 79, |
| 131990 | + /* 1450 */ 22, 58, 23, 22, 79, 22, 249, 249, 246, 79, |
| 131991 | + /* 1460 */ 23, 23, 23, 116, 68, 22, 26, 23, 22, 56, |
| 131992 | + /* 1470 */ 122, 23, 23, 64, 22, 124, 26, 26, 64, 64, |
| 131993 | + /* 1480 */ 23, 23, 23, 23, 11, 23, 22, 26, 23, 22, |
| 131994 | + /* 1490 */ 24, 1, 23, 22, 26, 122, 24, 23, 22, 122, |
| 131995 | + /* 1500 */ 23, 23, 22, 122, 122, 23, 15, |
| 131397 | 131996 | }; |
| 131398 | 131997 | #define YY_SHIFT_USE_DFLT (-95) |
| 131399 | | -#define YY_SHIFT_COUNT (439) |
| 131998 | +#define YY_SHIFT_COUNT (442) |
| 131400 | 131999 | #define YY_SHIFT_MIN (-94) |
| 131401 | | -#define YY_SHIFT_MAX (1482) |
| 132000 | +#define YY_SHIFT_MAX (1491) |
| 131402 | 132001 | static const short yy_shift_ofst[] = { |
| 131403 | | - /* 0 */ 40, 564, 869, 577, 725, 725, 725, 739, -19, 16, |
| 131404 | | - /* 10 */ 16, 100, 725, 725, 725, 725, 725, 725, 725, 841, |
| 131405 | | - /* 20 */ 841, 538, 507, 684, 623, 61, 137, 172, 207, 242, |
| 131406 | | - /* 30 */ 277, 312, 347, 382, 424, 424, 424, 424, 424, 424, |
| 131407 | | - /* 40 */ 424, 424, 424, 424, 424, 424, 424, 424, 424, 459, |
| 131408 | | - /* 50 */ 424, 494, 529, 529, 670, 725, 725, 725, 725, 725, |
| 132002 | + /* 0 */ 40, 564, 869, 577, 725, 725, 725, 725, 690, -19, |
| 132003 | + /* 10 */ 16, 16, 100, 725, 725, 725, 725, 725, 725, 725, |
| 132004 | + /* 20 */ 841, 841, 538, 507, 684, 565, 61, 137, 172, 207, |
| 132005 | + /* 30 */ 242, 277, 312, 347, 382, 424, 424, 424, 424, 424, |
| 132006 | + /* 40 */ 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, |
| 132007 | + /* 50 */ 459, 424, 494, 529, 529, 670, 725, 725, 725, 725, |
| 131409 | 132008 | /* 60 */ 725, 725, 725, 725, 725, 725, 725, 725, 725, 725, |
| 131410 | 132009 | /* 70 */ 725, 725, 725, 725, 725, 725, 725, 725, 725, 725, |
| 131411 | | - /* 80 */ 725, 725, 725, 821, 725, 725, 725, 725, 725, 725, |
| 131412 | | - /* 90 */ 725, 725, 725, 725, 725, 725, 725, 952, 711, 711, |
| 131413 | | - /* 100 */ 711, 711, 711, 766, 23, 32, 811, 877, 663, 602, |
| 131414 | | - /* 110 */ 602, 811, 73, 113, -51, -95, -95, -95, 501, 501, |
| 131415 | | - /* 120 */ 501, 595, 595, 809, 205, 276, 811, 811, 811, 811, |
| 131416 | | - /* 130 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, |
| 131417 | | - /* 140 */ 811, 811, 811, 811, 811, 811, 192, 628, 498, 498, |
| 131418 | | - /* 150 */ 113, -34, -34, -34, -34, -34, -34, -95, -95, -95, |
| 131419 | | - /* 160 */ 880, -94, -94, 726, 740, 99, 797, 887, 349, 811, |
| 131420 | | - /* 170 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 811, |
| 131421 | | - /* 180 */ 811, 811, 811, 811, 811, 811, 941, 941, 941, 811, |
| 131422 | | - /* 190 */ 811, 926, 811, 811, 811, -18, 811, 811, 842, 811, |
| 131423 | | - /* 200 */ 811, 811, 811, 811, 811, 811, 811, 811, 811, 224, |
| 131424 | | - /* 210 */ 608, 910, 910, 910, 1078, 45, 469, 508, 934, 970, |
| 131425 | | - /* 220 */ 970, 1164, 934, 1164, 1036, 1183, 359, 1017, 970, 954, |
| 131426 | | - /* 230 */ 1017, 1017, 1092, 730, 497, 1225, 1171, 1171, 1228, 1228, |
| 131427 | | - /* 240 */ 1171, 1281, 1280, 1178, 1291, 1291, 1291, 1291, 1171, 1293, |
| 131428 | | - /* 250 */ 1178, 1281, 1280, 1280, 1178, 1171, 1293, 1176, 1244, 1171, |
| 131429 | | - /* 260 */ 1171, 1293, 1302, 1171, 1293, 1171, 1293, 1302, 1229, 1229, |
| 131430 | | - /* 270 */ 1229, 1263, 1302, 1229, 1238, 1229, 1263, 1229, 1229, 1222, |
| 131431 | | - /* 280 */ 1245, 1222, 1245, 1222, 1245, 1222, 1245, 1171, 1171, 1218, |
| 131432 | | - /* 290 */ 1302, 1304, 1304, 1302, 1230, 1242, 1243, 1246, 1178, 1347, |
| 131433 | | - /* 300 */ 1348, 1363, 1363, 1375, 1375, 1375, 1375, -95, -95, -95, |
| 131434 | | - /* 310 */ -95, -95, -95, -95, -95, 451, 876, 346, 1159, 1099, |
| 131435 | | - /* 320 */ 441, 823, 1188, 1111, 1190, 1195, 1199, 1200, 1005, 1129, |
| 131436 | | - /* 330 */ 1224, 533, 1201, 1212, 1155, 1214, 1109, 1112, 1220, 1157, |
| 131437 | | - /* 340 */ 779, 1386, 1388, 1370, 1251, 1379, 1301, 1380, 1381, 1382, |
| 131438 | | - /* 350 */ 1278, 1275, 1296, 1285, 1389, 1286, 1396, 1412, 1294, 1283, |
| 131439 | | - /* 360 */ 1383, 1384, 1305, 1362, 1358, 1303, 1422, 1419, 1404, 1320, |
| 131440 | | - /* 370 */ 1288, 1349, 1405, 1350, 1345, 1361, 1327, 1411, 1416, 1418, |
| 131441 | | - /* 380 */ 1326, 1334, 1420, 1364, 1423, 1424, 1417, 1425, 1365, 1390, |
| 131442 | | - /* 390 */ 1427, 1374, 1373, 1431, 1432, 1433, 1341, 1436, 1437, 1439, |
| 131443 | | - /* 400 */ 1438, 1337, 1440, 1442, 1406, 1402, 1445, 1344, 1443, 1407, |
| 131444 | | - /* 410 */ 1444, 1408, 1443, 1450, 1451, 1452, 1453, 1454, 1456, 1465, |
| 131445 | | - /* 420 */ 1457, 1459, 1458, 1460, 1461, 1463, 1464, 1460, 1466, 1468, |
| 131446 | | - /* 430 */ 1469, 1470, 1472, 1369, 1376, 1377, 1378, 1473, 1480, 1482, |
| 132010 | + /* 80 */ 725, 725, 725, 725, 821, 725, 725, 725, 725, 725, |
| 132011 | + /* 90 */ 725, 725, 725, 725, 725, 725, 725, 725, 952, 711, |
| 132012 | + /* 100 */ 711, 711, 711, 711, 766, 23, 32, 924, 637, 825, |
| 132013 | + /* 110 */ 837, 837, 924, 73, 183, -51, -95, -95, -95, 501, |
| 132014 | + /* 120 */ 501, 501, 903, 903, 632, 205, 241, 924, 924, 924, |
| 132015 | + /* 130 */ 924, 924, 924, 924, 924, 924, 924, 924, 924, 924, |
| 132016 | + /* 140 */ 924, 924, 924, 924, 924, 924, 924, 192, 1027, 1106, |
| 132017 | + /* 150 */ 1106, 183, 176, 176, 176, 176, 176, 176, -95, -95, |
| 132018 | + /* 160 */ -95, 880, -94, -94, 578, 734, 99, 730, 769, 349, |
| 132019 | + /* 170 */ 924, 924, 924, 924, 924, 924, 924, 924, 924, 924, |
| 132020 | + /* 180 */ 924, 924, 924, 924, 924, 924, 924, 954, 954, 954, |
| 132021 | + /* 190 */ 924, 924, 622, 924, 924, 924, -18, 924, 924, 914, |
| 132022 | + /* 200 */ 924, 924, 924, 924, 924, 924, 924, 924, 924, 924, |
| 132023 | + /* 210 */ 441, 1020, 1107, 1107, 1107, 569, 45, 217, 510, 423, |
| 132024 | + /* 220 */ 834, 834, 1156, 423, 1156, 1144, 1187, 359, 1051, 834, |
| 132025 | + /* 230 */ -17, 1051, 1051, 1099, 469, 1192, 1229, 1176, 1176, 1233, |
| 132026 | + /* 240 */ 1233, 1176, 1277, 1285, 1183, 1296, 1296, 1296, 1296, 1176, |
| 132027 | + /* 250 */ 1297, 1183, 1277, 1285, 1285, 1183, 1176, 1297, 1182, 1250, |
| 132028 | + /* 260 */ 1176, 1176, 1297, 1311, 1176, 1297, 1176, 1297, 1311, 1234, |
| 132029 | + /* 270 */ 1234, 1234, 1267, 1311, 1234, 1244, 1234, 1267, 1234, 1234, |
| 132030 | + /* 280 */ 1232, 1247, 1232, 1247, 1232, 1247, 1232, 1247, 1176, 1334, |
| 132031 | + /* 290 */ 1176, 1235, 1311, 1318, 1318, 1311, 1248, 1253, 1245, 1249, |
| 132032 | + /* 300 */ 1183, 1355, 1357, 1368, 1368, 1378, 1378, 1378, 1378, -95, |
| 132033 | + /* 310 */ -95, -95, -95, -95, -95, -95, -95, 451, 936, 816, |
| 132034 | + /* 320 */ 888, 1069, 799, 1111, 1197, 1193, 1201, 1202, 1203, 1213, |
| 132035 | + /* 330 */ 1134, 1117, 1230, 497, 1218, 1219, 1154, 1223, 1115, 1120, |
| 132036 | + /* 340 */ 1231, 1164, 1160, 1392, 1394, 1376, 1257, 1385, 1307, 1386, |
| 132037 | + /* 350 */ 1383, 1388, 1292, 1282, 1303, 1294, 1395, 1293, 1403, 1419, |
| 132038 | + /* 360 */ 1298, 1291, 1389, 1390, 1314, 1372, 1365, 1308, 1430, 1427, |
| 132039 | + /* 370 */ 1411, 1327, 1295, 1356, 1412, 1359, 1350, 1369, 1333, 1418, |
| 132040 | + /* 380 */ 1423, 1425, 1335, 1340, 1424, 1370, 1426, 1428, 1429, 1431, |
| 132041 | + /* 390 */ 1375, 1393, 1433, 1380, 1396, 1437, 1438, 1439, 1347, 1443, |
| 132042 | + /* 400 */ 1444, 1446, 1440, 1348, 1448, 1449, 1413, 1409, 1452, 1351, |
| 132043 | + /* 410 */ 1450, 1414, 1451, 1415, 1457, 1450, 1458, 1459, 1460, 1461, |
| 132044 | + /* 420 */ 1462, 1464, 1473, 1465, 1467, 1466, 1468, 1469, 1471, 1472, |
| 132045 | + /* 430 */ 1468, 1474, 1476, 1477, 1478, 1480, 1373, 1377, 1381, 1382, |
| 132046 | + /* 440 */ 1482, 1491, 1490, |
| 131447 | 132047 | }; |
| 131448 | 132048 | #define YY_REDUCE_USE_DFLT (-130) |
| 131449 | | -#define YY_REDUCE_COUNT (314) |
| 132049 | +#define YY_REDUCE_COUNT (316) |
| 131450 | 132050 | #define YY_REDUCE_MIN (-129) |
| 131451 | | -#define YY_REDUCE_MAX (1237) |
| 132051 | +#define YY_REDUCE_MAX (1243) |
| 131452 | 132052 | static const short yy_reduce_ofst[] = { |
| 131453 | | - /* 0 */ -29, 531, 490, 625, -49, 272, 456, 510, 400, 509, |
| 131454 | | - /* 10 */ 562, 114, 535, 614, 698, 384, 738, 751, 690, 419, |
| 131455 | | - /* 20 */ 553, 761, 460, 636, 767, 41, 41, 41, 41, 41, |
| 131456 | | - /* 30 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, |
| 131457 | | - /* 40 */ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, |
| 131458 | | - /* 50 */ 41, 41, 41, 41, 760, 815, 856, 863, 866, 868, |
| 131459 | | - /* 60 */ 870, 873, 881, 885, 895, 897, 899, 903, 907, 909, |
| 131460 | | - /* 70 */ 911, 913, 922, 925, 936, 938, 940, 944, 947, 949, |
| 131461 | | - /* 80 */ 951, 953, 955, 962, 978, 980, 984, 986, 988, 991, |
| 131462 | | - /* 90 */ 993, 995, 997, 1002, 1019, 1021, 1025, 41, 41, 41, |
| 131463 | | - /* 100 */ 41, 41, 41, 41, 41, 41, 896, 140, 260, 98, |
| 131464 | | - /* 110 */ 268, 1020, 41, 482, 41, 41, 41, 41, 270, 270, |
| 131465 | | - /* 120 */ 270, 212, 217, -129, 411, 411, 550, 5, 626, 362, |
| 131466 | | - /* 130 */ 733, 830, 992, 1003, 1026, 795, 683, 807, 638, 819, |
| 131467 | | - /* 140 */ 753, 948, 62, 817, 824, 132, 687, 611, 864, 1033, |
| 131468 | | - /* 150 */ 403, 943, 966, 983, 1032, 1038, 1040, 960, 996, 492, |
| 131469 | | - /* 160 */ -50, 57, 131, 153, 221, 462, 588, 596, 675, 721, |
| 131470 | | - /* 170 */ 820, 834, 857, 914, 979, 1034, 1065, 1081, 1087, 1095, |
| 131471 | | - /* 180 */ 1096, 1097, 1098, 1101, 1104, 1105, 320, 500, 655, 1106, |
| 131472 | | - /* 190 */ 1107, 503, 1108, 1110, 1113, 681, 1114, 1115, 999, 1116, |
| 131473 | | - /* 200 */ 1117, 1118, 221, 1119, 1120, 1121, 1122, 1123, 1124, 788, |
| 131474 | | - /* 210 */ 956, 1041, 1051, 1053, 503, 1067, 1079, 1128, 1080, 1066, |
| 131475 | | - /* 220 */ 1068, 1045, 1083, 1047, 1103, 1102, 1125, 1126, 1073, 1062, |
| 131476 | | - /* 230 */ 1127, 1131, 1089, 1093, 1135, 1052, 1136, 1137, 1059, 1060, |
| 131477 | | - /* 240 */ 1141, 1084, 1130, 1132, 1133, 1134, 1138, 1139, 1151, 1154, |
| 131478 | | - /* 250 */ 1140, 1094, 1143, 1145, 1142, 1156, 1158, 1082, 1086, 1162, |
| 131479 | | - /* 260 */ 1163, 1165, 1150, 1169, 1177, 1170, 1179, 1161, 1166, 1168, |
| 131480 | | - /* 270 */ 1172, 1167, 1173, 1174, 1175, 1180, 1181, 1182, 1184, 1144, |
| 131481 | | - /* 280 */ 1146, 1148, 1147, 1149, 1152, 1153, 1160, 1186, 1194, 1185, |
| 131482 | | - /* 290 */ 1189, 1187, 1191, 1193, 1192, 1196, 1198, 1197, 1202, 1215, |
| 131483 | | - /* 300 */ 1217, 1226, 1227, 1231, 1232, 1233, 1234, 1203, 1204, 1205, |
| 131484 | | - /* 310 */ 1221, 1223, 1209, 1211, 1237, |
| 132053 | + /* 0 */ -29, 531, 490, 570, -49, 272, 456, 498, 633, 400, |
| 132054 | + /* 10 */ 612, 626, 113, 482, 678, 719, 384, 726, 748, 791, |
| 132055 | + /* 20 */ 419, 693, 761, 812, 819, 625, 76, 76, 76, 76, |
| 132056 | + /* 30 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, |
| 132057 | + /* 40 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, |
| 132058 | + /* 50 */ 76, 76, 76, 76, 76, 793, 795, 856, 871, 875, |
| 132059 | + /* 60 */ 878, 881, 885, 887, 889, 894, 897, 900, 916, 919, |
| 132060 | + /* 70 */ 922, 926, 928, 930, 932, 934, 938, 941, 944, 956, |
| 132061 | + /* 80 */ 963, 966, 968, 970, 972, 974, 978, 980, 982, 996, |
| 132062 | + /* 90 */ 1004, 1006, 1008, 1011, 1013, 1015, 1019, 1022, 76, 76, |
| 132063 | + /* 100 */ 76, 76, 76, 76, 76, 76, 76, 555, 210, 260, |
| 132064 | + /* 110 */ 200, 346, 571, 76, 700, 76, 76, 76, 76, 838, |
| 132065 | + /* 120 */ 838, 838, 42, 182, 251, 160, 160, 550, 5, 455, |
| 132066 | + /* 130 */ 585, 721, 749, 882, 884, 971, 618, 462, 797, 514, |
| 132067 | + /* 140 */ 807, 524, 997, -129, 655, 859, 62, 290, 66, 1030, |
| 132068 | + /* 150 */ 1032, 589, 1009, 1010, 1037, 1038, 1039, 1044, 740, 852, |
| 132069 | + /* 160 */ 1012, 112, 147, 230, 257, 180, 369, 403, 500, 549, |
| 132070 | + /* 170 */ 556, 563, 694, 751, 765, 772, 778, 820, 868, 873, |
| 132071 | + /* 180 */ 890, 929, 935, 985, 1041, 1080, 1091, 540, 593, 661, |
| 132072 | + /* 190 */ 1103, 1104, 842, 1108, 1110, 1112, 1048, 1113, 1114, 1068, |
| 132073 | + /* 200 */ 1116, 1118, 1119, 180, 1121, 1122, 1123, 1124, 1125, 1126, |
| 132074 | + /* 210 */ 1029, 1034, 1059, 1062, 1070, 842, 1082, 1083, 1133, 1084, |
| 132075 | + /* 220 */ 1072, 1073, 1045, 1087, 1050, 1127, 1109, 1128, 1129, 1076, |
| 132076 | + /* 230 */ 1064, 1130, 1131, 1092, 1096, 1140, 1054, 1141, 1142, 1067, |
| 132077 | + /* 240 */ 1071, 1150, 1090, 1132, 1135, 1136, 1137, 1138, 1139, 1157, |
| 132078 | + /* 250 */ 1159, 1143, 1098, 1145, 1146, 1147, 1161, 1165, 1086, 1097, |
| 132079 | + /* 260 */ 1166, 1167, 1169, 1162, 1178, 1180, 1181, 1184, 1168, 1172, |
| 132080 | + /* 270 */ 1173, 1175, 1170, 1174, 1179, 1185, 1186, 1177, 1188, 1189, |
| 132081 | + /* 280 */ 1148, 1151, 1149, 1152, 1153, 1155, 1158, 1163, 1196, 1171, |
| 132082 | + /* 290 */ 1199, 1190, 1191, 1194, 1195, 1198, 1200, 1204, 1206, 1205, |
| 132083 | + /* 300 */ 1209, 1220, 1224, 1236, 1237, 1240, 1241, 1242, 1243, 1207, |
| 132084 | + /* 310 */ 1208, 1212, 1221, 1222, 1210, 1225, 1239, |
| 131485 | 132085 | }; |
| 131486 | 132086 | static const YYACTIONTYPE yy_default[] = { |
| 131487 | | - /* 0 */ 1250, 1240, 1240, 1240, 1174, 1174, 1174, 1240, 1071, 1100, |
| 131488 | | - /* 10 */ 1100, 1224, 1301, 1301, 1301, 1301, 1301, 1301, 1173, 1301, |
| 131489 | | - /* 20 */ 1301, 1301, 1301, 1240, 1075, 1106, 1301, 1301, 1301, 1301, |
| 131490 | | - /* 30 */ 1301, 1301, 1301, 1301, 1223, 1225, 1114, 1113, 1206, 1087, |
| 131491 | | - /* 40 */ 1111, 1104, 1108, 1175, 1169, 1170, 1168, 1172, 1176, 1301, |
| 131492 | | - /* 50 */ 1107, 1138, 1153, 1137, 1301, 1301, 1301, 1301, 1301, 1301, |
| 131493 | | - /* 60 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, |
| 131494 | | - /* 70 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, |
| 131495 | | - /* 80 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, |
| 131496 | | - /* 90 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1147, 1152, 1159, |
| 131497 | | - /* 100 */ 1151, 1148, 1140, 1139, 1141, 1142, 1301, 994, 1042, 1301, |
| 131498 | | - /* 110 */ 1301, 1301, 1143, 1301, 1144, 1156, 1155, 1154, 1231, 1258, |
| 131499 | | - /* 120 */ 1257, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, |
| 131500 | | - /* 130 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, |
| 131501 | | - /* 140 */ 1301, 1301, 1301, 1301, 1301, 1301, 1250, 1240, 1000, 1000, |
| 131502 | | - /* 150 */ 1301, 1240, 1240, 1240, 1240, 1240, 1240, 1236, 1075, 1066, |
| 131503 | | - /* 160 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, |
| 131504 | | - /* 170 */ 1228, 1226, 1301, 1187, 1301, 1301, 1301, 1301, 1301, 1301, |
| 131505 | | - /* 180 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, |
| 131506 | | - /* 190 */ 1301, 1301, 1301, 1301, 1301, 1071, 1301, 1301, 1301, 1301, |
| 131507 | | - /* 200 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1252, 1301, |
| 131508 | | - /* 210 */ 1201, 1071, 1071, 1071, 1073, 1055, 1065, 979, 1110, 1089, |
| 131509 | | - /* 220 */ 1089, 1290, 1110, 1290, 1017, 1272, 1014, 1100, 1089, 1171, |
| 131510 | | - /* 230 */ 1100, 1100, 1072, 1065, 1301, 1293, 1080, 1080, 1292, 1292, |
| 131511 | | - /* 240 */ 1080, 1119, 1045, 1110, 1051, 1051, 1051, 1051, 1080, 991, |
| 131512 | | - /* 250 */ 1110, 1119, 1045, 1045, 1110, 1080, 991, 1205, 1287, 1080, |
| 131513 | | - /* 260 */ 1080, 991, 1180, 1080, 991, 1080, 991, 1180, 1043, 1043, |
| 131514 | | - /* 270 */ 1043, 1032, 1180, 1043, 1017, 1043, 1032, 1043, 1043, 1093, |
| 131515 | | - /* 280 */ 1088, 1093, 1088, 1093, 1088, 1093, 1088, 1080, 1080, 1301, |
| 131516 | | - /* 290 */ 1180, 1184, 1184, 1180, 1105, 1094, 1103, 1101, 1110, 997, |
| 131517 | | - /* 300 */ 1035, 1255, 1255, 1251, 1251, 1251, 1251, 1298, 1298, 1236, |
| 131518 | | - /* 310 */ 1267, 1267, 1019, 1019, 1267, 1301, 1301, 1301, 1301, 1301, |
| 131519 | | - /* 320 */ 1301, 1262, 1301, 1189, 1301, 1301, 1301, 1301, 1301, 1301, |
| 131520 | | - /* 330 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, |
| 131521 | | - /* 340 */ 1125, 1301, 975, 1233, 1301, 1301, 1232, 1301, 1301, 1301, |
| 131522 | | - /* 350 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, |
| 131523 | | - /* 360 */ 1301, 1301, 1301, 1301, 1301, 1289, 1301, 1301, 1301, 1301, |
| 131524 | | - /* 370 */ 1301, 1301, 1204, 1203, 1301, 1301, 1301, 1301, 1301, 1301, |
| 131525 | | - /* 380 */ 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1301, |
| 131526 | | - /* 390 */ 1301, 1301, 1301, 1301, 1301, 1301, 1057, 1301, 1301, 1301, |
| 131527 | | - /* 400 */ 1276, 1301, 1301, 1301, 1301, 1301, 1301, 1301, 1102, 1301, |
| 131528 | | - /* 410 */ 1095, 1301, 1280, 1301, 1301, 1301, 1301, 1301, 1301, 1301, |
| 131529 | | - /* 420 */ 1301, 1301, 1301, 1242, 1301, 1301, 1301, 1241, 1301, 1301, |
| 131530 | | - /* 430 */ 1301, 1301, 1301, 1127, 1301, 1126, 1130, 1301, 985, 1301, |
| 132087 | + /* 0 */ 1258, 1248, 1248, 1248, 1180, 1180, 1180, 1180, 1248, 1077, |
| 132088 | + /* 10 */ 1106, 1106, 1232, 1309, 1309, 1309, 1309, 1309, 1309, 1179, |
| 132089 | + /* 20 */ 1309, 1309, 1309, 1309, 1248, 1081, 1112, 1309, 1309, 1309, |
| 132090 | + /* 30 */ 1309, 1309, 1309, 1309, 1309, 1231, 1233, 1120, 1119, 1214, |
| 132091 | + /* 40 */ 1093, 1117, 1110, 1114, 1181, 1175, 1176, 1174, 1178, 1182, |
| 132092 | + /* 50 */ 1309, 1113, 1144, 1159, 1143, 1309, 1309, 1309, 1309, 1309, |
| 132093 | + /* 60 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132094 | + /* 70 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132095 | + /* 80 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132096 | + /* 90 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1153, 1158, |
| 132097 | + /* 100 */ 1165, 1157, 1154, 1146, 1145, 1147, 1148, 1309, 1000, 1048, |
| 132098 | + /* 110 */ 1309, 1309, 1309, 1149, 1309, 1150, 1162, 1161, 1160, 1239, |
| 132099 | + /* 120 */ 1266, 1265, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132100 | + /* 130 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132101 | + /* 140 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1258, 1248, 1006, |
| 132102 | + /* 150 */ 1006, 1309, 1248, 1248, 1248, 1248, 1248, 1248, 1244, 1081, |
| 132103 | + /* 160 */ 1072, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132104 | + /* 170 */ 1309, 1236, 1234, 1309, 1195, 1309, 1309, 1309, 1309, 1309, |
| 132105 | + /* 180 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132106 | + /* 190 */ 1309, 1309, 1309, 1309, 1309, 1309, 1077, 1309, 1309, 1309, |
| 132107 | + /* 200 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1260, |
| 132108 | + /* 210 */ 1309, 1209, 1077, 1077, 1077, 1079, 1061, 1071, 985, 1116, |
| 132109 | + /* 220 */ 1095, 1095, 1298, 1116, 1298, 1023, 1280, 1020, 1106, 1095, |
| 132110 | + /* 230 */ 1177, 1106, 1106, 1078, 1071, 1309, 1301, 1086, 1086, 1300, |
| 132111 | + /* 240 */ 1300, 1086, 1125, 1051, 1116, 1057, 1057, 1057, 1057, 1086, |
| 132112 | + /* 250 */ 997, 1116, 1125, 1051, 1051, 1116, 1086, 997, 1213, 1295, |
| 132113 | + /* 260 */ 1086, 1086, 997, 1188, 1086, 997, 1086, 997, 1188, 1049, |
| 132114 | + /* 270 */ 1049, 1049, 1038, 1188, 1049, 1023, 1049, 1038, 1049, 1049, |
| 132115 | + /* 280 */ 1099, 1094, 1099, 1094, 1099, 1094, 1099, 1094, 1086, 1183, |
| 132116 | + /* 290 */ 1086, 1309, 1188, 1192, 1192, 1188, 1111, 1100, 1109, 1107, |
| 132117 | + /* 300 */ 1116, 1003, 1041, 1263, 1263, 1259, 1259, 1259, 1259, 1306, |
| 132118 | + /* 310 */ 1306, 1244, 1275, 1275, 1025, 1025, 1275, 1309, 1309, 1309, |
| 132119 | + /* 320 */ 1309, 1309, 1309, 1270, 1309, 1197, 1309, 1309, 1309, 1309, |
| 132120 | + /* 330 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132121 | + /* 340 */ 1309, 1309, 1131, 1309, 981, 1241, 1309, 1309, 1240, 1309, |
| 132122 | + /* 350 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132123 | + /* 360 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1297, 1309, 1309, |
| 132124 | + /* 370 */ 1309, 1309, 1309, 1309, 1212, 1211, 1309, 1309, 1309, 1309, |
| 132125 | + /* 380 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132126 | + /* 390 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1063, 1309, |
| 132127 | + /* 400 */ 1309, 1309, 1284, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132128 | + /* 410 */ 1108, 1309, 1101, 1309, 1309, 1288, 1309, 1309, 1309, 1309, |
| 132129 | + /* 420 */ 1309, 1309, 1309, 1309, 1309, 1309, 1250, 1309, 1309, 1309, |
| 132130 | + /* 430 */ 1249, 1309, 1309, 1309, 1309, 1309, 1133, 1309, 1132, 1136, |
| 132131 | + /* 440 */ 1309, 991, 1309, |
| 131531 | 132132 | }; |
| 131532 | 132133 | /********** End of lemon-generated parsing tables *****************************/ |
| 131533 | 132134 | |
| 131534 | 132135 | /* The next table maps tokens (terminal symbols) into fallback tokens. |
| 131535 | 132136 | ** If a construct like the following: |
| | @@ -131672,21 +132273,22 @@ |
| 131672 | 132273 | typedef struct yyStackEntry yyStackEntry; |
| 131673 | 132274 | |
| 131674 | 132275 | /* The state of the parser is completely contained in an instance of |
| 131675 | 132276 | ** the following structure */ |
| 131676 | 132277 | struct yyParser { |
| 131677 | | - int yyidx; /* Index of top element in stack */ |
| 132278 | + yyStackEntry *yytos; /* Pointer to top element of the stack */ |
| 131678 | 132279 | #ifdef YYTRACKMAXSTACKDEPTH |
| 131679 | | - int yyidxMax; /* Maximum value of yyidx */ |
| 132280 | + int yyhwm; /* High-water mark of the stack */ |
| 131680 | 132281 | #endif |
| 131681 | 132282 | #ifndef YYNOERRORRECOVERY |
| 131682 | 132283 | int yyerrcnt; /* Shifts left before out of the error */ |
| 131683 | 132284 | #endif |
| 131684 | 132285 | sqlite3ParserARG_SDECL /* A place to hold %extra_argument */ |
| 131685 | 132286 | #if YYSTACKDEPTH<=0 |
| 131686 | 132287 | int yystksz; /* Current side of the stack */ |
| 131687 | 132288 | yyStackEntry *yystack; /* The parser's stack */ |
| 132289 | + yyStackEntry yystk0; /* First stack entry */ |
| 131688 | 132290 | #else |
| 131689 | 132291 | yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ |
| 131690 | 132292 | #endif |
| 131691 | 132293 | }; |
| 131692 | 132294 | typedef struct yyParser yyParser; |
| | @@ -131781,17 +132383,17 @@ |
| 131781 | 132383 | "orderby_opt", "limit_opt", "values", "nexprlist", |
| 131782 | 132384 | "exprlist", "sclp", "as", "seltablist", |
| 131783 | 132385 | "stl_prefix", "joinop", "indexed_opt", "on_opt", |
| 131784 | 132386 | "using_opt", "idlist", "setlist", "insert_cmd", |
| 131785 | 132387 | "idlist_opt", "likeop", "between_op", "in_op", |
| 131786 | | - "case_operand", "case_exprlist", "case_else", "uniqueflag", |
| 131787 | | - "collate", "nmnum", "trigger_decl", "trigger_cmd_list", |
| 131788 | | - "trigger_time", "trigger_event", "foreach_clause", "when_clause", |
| 131789 | | - "trigger_cmd", "trnm", "tridxby", "database_kw_opt", |
| 131790 | | - "key_opt", "add_column_fullname", "kwcolumn_opt", "create_vtab", |
| 131791 | | - "vtabarglist", "vtabarg", "vtabargtoken", "lp", |
| 131792 | | - "anylist", "wqlist", |
| 132388 | + "paren_exprlist", "case_operand", "case_exprlist", "case_else", |
| 132389 | + "uniqueflag", "collate", "nmnum", "trigger_decl", |
| 132390 | + "trigger_cmd_list", "trigger_time", "trigger_event", "foreach_clause", |
| 132391 | + "when_clause", "trigger_cmd", "trnm", "tridxby", |
| 132392 | + "database_kw_opt", "key_opt", "add_column_fullname", "kwcolumn_opt", |
| 132393 | + "create_vtab", "vtabarglist", "vtabarg", "vtabargtoken", |
| 132394 | + "lp", "anylist", "wqlist", |
| 131793 | 132395 | }; |
| 131794 | 132396 | #endif /* NDEBUG */ |
| 131795 | 132397 | |
| 131796 | 132398 | #ifndef NDEBUG |
| 131797 | 132399 | /* For tracing reduce actions, the names of all rules are required. |
| | @@ -131985,11 +132587,11 @@ |
| 131985 | 132587 | /* 185 */ "in_op ::= IN", |
| 131986 | 132588 | /* 186 */ "in_op ::= NOT IN", |
| 131987 | 132589 | /* 187 */ "expr ::= expr in_op LP exprlist RP", |
| 131988 | 132590 | /* 188 */ "expr ::= LP select RP", |
| 131989 | 132591 | /* 189 */ "expr ::= expr in_op LP select RP", |
| 131990 | | - /* 190 */ "expr ::= expr in_op nm dbnm", |
| 132592 | + /* 190 */ "expr ::= expr in_op nm dbnm paren_exprlist", |
| 131991 | 132593 | /* 191 */ "expr ::= EXISTS LP select RP", |
| 131992 | 132594 | /* 192 */ "expr ::= CASE case_operand case_exprlist case_else END", |
| 131993 | 132595 | /* 193 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", |
| 131994 | 132596 | /* 194 */ "case_exprlist ::= WHEN expr THEN expr", |
| 131995 | 132597 | /* 195 */ "case_else ::= ELSE expr", |
| | @@ -131997,158 +132599,170 @@ |
| 131997 | 132599 | /* 197 */ "case_operand ::= expr", |
| 131998 | 132600 | /* 198 */ "case_operand ::=", |
| 131999 | 132601 | /* 199 */ "exprlist ::=", |
| 132000 | 132602 | /* 200 */ "nexprlist ::= nexprlist COMMA expr", |
| 132001 | 132603 | /* 201 */ "nexprlist ::= expr", |
| 132002 | | - /* 202 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", |
| 132003 | | - /* 203 */ "uniqueflag ::= UNIQUE", |
| 132004 | | - /* 204 */ "uniqueflag ::=", |
| 132005 | | - /* 205 */ "eidlist_opt ::=", |
| 132006 | | - /* 206 */ "eidlist_opt ::= LP eidlist RP", |
| 132007 | | - /* 207 */ "eidlist ::= eidlist COMMA nm collate sortorder", |
| 132008 | | - /* 208 */ "eidlist ::= nm collate sortorder", |
| 132009 | | - /* 209 */ "collate ::=", |
| 132010 | | - /* 210 */ "collate ::= COLLATE ID|STRING", |
| 132011 | | - /* 211 */ "cmd ::= DROP INDEX ifexists fullname", |
| 132012 | | - /* 212 */ "cmd ::= VACUUM", |
| 132013 | | - /* 213 */ "cmd ::= VACUUM nm", |
| 132014 | | - /* 214 */ "cmd ::= PRAGMA nm dbnm", |
| 132015 | | - /* 215 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", |
| 132016 | | - /* 216 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", |
| 132017 | | - /* 217 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", |
| 132018 | | - /* 218 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", |
| 132019 | | - /* 219 */ "plus_num ::= PLUS INTEGER|FLOAT", |
| 132020 | | - /* 220 */ "minus_num ::= MINUS INTEGER|FLOAT", |
| 132021 | | - /* 221 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", |
| 132022 | | - /* 222 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", |
| 132023 | | - /* 223 */ "trigger_time ::= BEFORE", |
| 132024 | | - /* 224 */ "trigger_time ::= AFTER", |
| 132025 | | - /* 225 */ "trigger_time ::= INSTEAD OF", |
| 132026 | | - /* 226 */ "trigger_time ::=", |
| 132027 | | - /* 227 */ "trigger_event ::= DELETE|INSERT", |
| 132028 | | - /* 228 */ "trigger_event ::= UPDATE", |
| 132029 | | - /* 229 */ "trigger_event ::= UPDATE OF idlist", |
| 132030 | | - /* 230 */ "when_clause ::=", |
| 132031 | | - /* 231 */ "when_clause ::= WHEN expr", |
| 132032 | | - /* 232 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", |
| 132033 | | - /* 233 */ "trigger_cmd_list ::= trigger_cmd SEMI", |
| 132034 | | - /* 234 */ "trnm ::= nm DOT nm", |
| 132035 | | - /* 235 */ "tridxby ::= INDEXED BY nm", |
| 132036 | | - /* 236 */ "tridxby ::= NOT INDEXED", |
| 132037 | | - /* 237 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt", |
| 132038 | | - /* 238 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select", |
| 132039 | | - /* 239 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt", |
| 132040 | | - /* 240 */ "trigger_cmd ::= select", |
| 132041 | | - /* 241 */ "expr ::= RAISE LP IGNORE RP", |
| 132042 | | - /* 242 */ "expr ::= RAISE LP raisetype COMMA nm RP", |
| 132043 | | - /* 243 */ "raisetype ::= ROLLBACK", |
| 132044 | | - /* 244 */ "raisetype ::= ABORT", |
| 132045 | | - /* 245 */ "raisetype ::= FAIL", |
| 132046 | | - /* 246 */ "cmd ::= DROP TRIGGER ifexists fullname", |
| 132047 | | - /* 247 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", |
| 132048 | | - /* 248 */ "cmd ::= DETACH database_kw_opt expr", |
| 132049 | | - /* 249 */ "key_opt ::=", |
| 132050 | | - /* 250 */ "key_opt ::= KEY expr", |
| 132051 | | - /* 251 */ "cmd ::= REINDEX", |
| 132052 | | - /* 252 */ "cmd ::= REINDEX nm dbnm", |
| 132053 | | - /* 253 */ "cmd ::= ANALYZE", |
| 132054 | | - /* 254 */ "cmd ::= ANALYZE nm dbnm", |
| 132055 | | - /* 255 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", |
| 132056 | | - /* 256 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", |
| 132057 | | - /* 257 */ "add_column_fullname ::= fullname", |
| 132058 | | - /* 258 */ "cmd ::= create_vtab", |
| 132059 | | - /* 259 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 132060 | | - /* 260 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 132061 | | - /* 261 */ "vtabarg ::=", |
| 132062 | | - /* 262 */ "vtabargtoken ::= ANY", |
| 132063 | | - /* 263 */ "vtabargtoken ::= lp anylist RP", |
| 132064 | | - /* 264 */ "lp ::= LP", |
| 132065 | | - /* 265 */ "with ::=", |
| 132066 | | - /* 266 */ "with ::= WITH wqlist", |
| 132067 | | - /* 267 */ "with ::= WITH RECURSIVE wqlist", |
| 132068 | | - /* 268 */ "wqlist ::= nm eidlist_opt AS LP select RP", |
| 132069 | | - /* 269 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", |
| 132070 | | - /* 270 */ "input ::= cmdlist", |
| 132071 | | - /* 271 */ "cmdlist ::= cmdlist ecmd", |
| 132072 | | - /* 272 */ "cmdlist ::= ecmd", |
| 132073 | | - /* 273 */ "ecmd ::= SEMI", |
| 132074 | | - /* 274 */ "ecmd ::= explain cmdx SEMI", |
| 132075 | | - /* 275 */ "explain ::=", |
| 132076 | | - /* 276 */ "trans_opt ::=", |
| 132077 | | - /* 277 */ "trans_opt ::= TRANSACTION", |
| 132078 | | - /* 278 */ "trans_opt ::= TRANSACTION nm", |
| 132079 | | - /* 279 */ "savepoint_opt ::= SAVEPOINT", |
| 132080 | | - /* 280 */ "savepoint_opt ::=", |
| 132081 | | - /* 281 */ "cmd ::= create_table create_table_args", |
| 132082 | | - /* 282 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 132083 | | - /* 283 */ "columnlist ::= columnname carglist", |
| 132084 | | - /* 284 */ "nm ::= ID|INDEXED", |
| 132085 | | - /* 285 */ "nm ::= STRING", |
| 132086 | | - /* 286 */ "nm ::= JOIN_KW", |
| 132087 | | - /* 287 */ "typetoken ::= typename", |
| 132088 | | - /* 288 */ "typename ::= ID|STRING", |
| 132089 | | - /* 289 */ "signed ::= plus_num", |
| 132090 | | - /* 290 */ "signed ::= minus_num", |
| 132091 | | - /* 291 */ "carglist ::= carglist ccons", |
| 132092 | | - /* 292 */ "carglist ::=", |
| 132093 | | - /* 293 */ "ccons ::= NULL onconf", |
| 132094 | | - /* 294 */ "conslist_opt ::= COMMA conslist", |
| 132095 | | - /* 295 */ "conslist ::= conslist tconscomma tcons", |
| 132096 | | - /* 296 */ "conslist ::= tcons", |
| 132097 | | - /* 297 */ "tconscomma ::=", |
| 132098 | | - /* 298 */ "defer_subclause_opt ::= defer_subclause", |
| 132099 | | - /* 299 */ "resolvetype ::= raisetype", |
| 132100 | | - /* 300 */ "selectnowith ::= oneselect", |
| 132101 | | - /* 301 */ "oneselect ::= values", |
| 132102 | | - /* 302 */ "sclp ::= selcollist COMMA", |
| 132103 | | - /* 303 */ "as ::= ID|STRING", |
| 132104 | | - /* 304 */ "expr ::= term", |
| 132105 | | - /* 305 */ "exprlist ::= nexprlist", |
| 132106 | | - /* 306 */ "nmnum ::= plus_num", |
| 132107 | | - /* 307 */ "nmnum ::= nm", |
| 132108 | | - /* 308 */ "nmnum ::= ON", |
| 132109 | | - /* 309 */ "nmnum ::= DELETE", |
| 132110 | | - /* 310 */ "nmnum ::= DEFAULT", |
| 132111 | | - /* 311 */ "plus_num ::= INTEGER|FLOAT", |
| 132112 | | - /* 312 */ "foreach_clause ::=", |
| 132113 | | - /* 313 */ "foreach_clause ::= FOR EACH ROW", |
| 132114 | | - /* 314 */ "trnm ::= nm", |
| 132115 | | - /* 315 */ "tridxby ::=", |
| 132116 | | - /* 316 */ "database_kw_opt ::= DATABASE", |
| 132117 | | - /* 317 */ "database_kw_opt ::=", |
| 132118 | | - /* 318 */ "kwcolumn_opt ::=", |
| 132119 | | - /* 319 */ "kwcolumn_opt ::= COLUMNKW", |
| 132120 | | - /* 320 */ "vtabarglist ::= vtabarg", |
| 132121 | | - /* 321 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 132122 | | - /* 322 */ "vtabarg ::= vtabarg vtabargtoken", |
| 132123 | | - /* 323 */ "anylist ::=", |
| 132124 | | - /* 324 */ "anylist ::= anylist LP anylist RP", |
| 132125 | | - /* 325 */ "anylist ::= anylist ANY", |
| 132604 | + /* 202 */ "paren_exprlist ::=", |
| 132605 | + /* 203 */ "paren_exprlist ::= LP exprlist RP", |
| 132606 | + /* 204 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", |
| 132607 | + /* 205 */ "uniqueflag ::= UNIQUE", |
| 132608 | + /* 206 */ "uniqueflag ::=", |
| 132609 | + /* 207 */ "eidlist_opt ::=", |
| 132610 | + /* 208 */ "eidlist_opt ::= LP eidlist RP", |
| 132611 | + /* 209 */ "eidlist ::= eidlist COMMA nm collate sortorder", |
| 132612 | + /* 210 */ "eidlist ::= nm collate sortorder", |
| 132613 | + /* 211 */ "collate ::=", |
| 132614 | + /* 212 */ "collate ::= COLLATE ID|STRING", |
| 132615 | + /* 213 */ "cmd ::= DROP INDEX ifexists fullname", |
| 132616 | + /* 214 */ "cmd ::= VACUUM", |
| 132617 | + /* 215 */ "cmd ::= VACUUM nm", |
| 132618 | + /* 216 */ "cmd ::= PRAGMA nm dbnm", |
| 132619 | + /* 217 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", |
| 132620 | + /* 218 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", |
| 132621 | + /* 219 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", |
| 132622 | + /* 220 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", |
| 132623 | + /* 221 */ "plus_num ::= PLUS INTEGER|FLOAT", |
| 132624 | + /* 222 */ "minus_num ::= MINUS INTEGER|FLOAT", |
| 132625 | + /* 223 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", |
| 132626 | + /* 224 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", |
| 132627 | + /* 225 */ "trigger_time ::= BEFORE", |
| 132628 | + /* 226 */ "trigger_time ::= AFTER", |
| 132629 | + /* 227 */ "trigger_time ::= INSTEAD OF", |
| 132630 | + /* 228 */ "trigger_time ::=", |
| 132631 | + /* 229 */ "trigger_event ::= DELETE|INSERT", |
| 132632 | + /* 230 */ "trigger_event ::= UPDATE", |
| 132633 | + /* 231 */ "trigger_event ::= UPDATE OF idlist", |
| 132634 | + /* 232 */ "when_clause ::=", |
| 132635 | + /* 233 */ "when_clause ::= WHEN expr", |
| 132636 | + /* 234 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", |
| 132637 | + /* 235 */ "trigger_cmd_list ::= trigger_cmd SEMI", |
| 132638 | + /* 236 */ "trnm ::= nm DOT nm", |
| 132639 | + /* 237 */ "tridxby ::= INDEXED BY nm", |
| 132640 | + /* 238 */ "tridxby ::= NOT INDEXED", |
| 132641 | + /* 239 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt", |
| 132642 | + /* 240 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select", |
| 132643 | + /* 241 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt", |
| 132644 | + /* 242 */ "trigger_cmd ::= select", |
| 132645 | + /* 243 */ "expr ::= RAISE LP IGNORE RP", |
| 132646 | + /* 244 */ "expr ::= RAISE LP raisetype COMMA nm RP", |
| 132647 | + /* 245 */ "raisetype ::= ROLLBACK", |
| 132648 | + /* 246 */ "raisetype ::= ABORT", |
| 132649 | + /* 247 */ "raisetype ::= FAIL", |
| 132650 | + /* 248 */ "cmd ::= DROP TRIGGER ifexists fullname", |
| 132651 | + /* 249 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", |
| 132652 | + /* 250 */ "cmd ::= DETACH database_kw_opt expr", |
| 132653 | + /* 251 */ "key_opt ::=", |
| 132654 | + /* 252 */ "key_opt ::= KEY expr", |
| 132655 | + /* 253 */ "cmd ::= REINDEX", |
| 132656 | + /* 254 */ "cmd ::= REINDEX nm dbnm", |
| 132657 | + /* 255 */ "cmd ::= ANALYZE", |
| 132658 | + /* 256 */ "cmd ::= ANALYZE nm dbnm", |
| 132659 | + /* 257 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", |
| 132660 | + /* 258 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", |
| 132661 | + /* 259 */ "add_column_fullname ::= fullname", |
| 132662 | + /* 260 */ "cmd ::= create_vtab", |
| 132663 | + /* 261 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 132664 | + /* 262 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 132665 | + /* 263 */ "vtabarg ::=", |
| 132666 | + /* 264 */ "vtabargtoken ::= ANY", |
| 132667 | + /* 265 */ "vtabargtoken ::= lp anylist RP", |
| 132668 | + /* 266 */ "lp ::= LP", |
| 132669 | + /* 267 */ "with ::=", |
| 132670 | + /* 268 */ "with ::= WITH wqlist", |
| 132671 | + /* 269 */ "with ::= WITH RECURSIVE wqlist", |
| 132672 | + /* 270 */ "wqlist ::= nm eidlist_opt AS LP select RP", |
| 132673 | + /* 271 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", |
| 132674 | + /* 272 */ "input ::= cmdlist", |
| 132675 | + /* 273 */ "cmdlist ::= cmdlist ecmd", |
| 132676 | + /* 274 */ "cmdlist ::= ecmd", |
| 132677 | + /* 275 */ "ecmd ::= SEMI", |
| 132678 | + /* 276 */ "ecmd ::= explain cmdx SEMI", |
| 132679 | + /* 277 */ "explain ::=", |
| 132680 | + /* 278 */ "trans_opt ::=", |
| 132681 | + /* 279 */ "trans_opt ::= TRANSACTION", |
| 132682 | + /* 280 */ "trans_opt ::= TRANSACTION nm", |
| 132683 | + /* 281 */ "savepoint_opt ::= SAVEPOINT", |
| 132684 | + /* 282 */ "savepoint_opt ::=", |
| 132685 | + /* 283 */ "cmd ::= create_table create_table_args", |
| 132686 | + /* 284 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 132687 | + /* 285 */ "columnlist ::= columnname carglist", |
| 132688 | + /* 286 */ "nm ::= ID|INDEXED", |
| 132689 | + /* 287 */ "nm ::= STRING", |
| 132690 | + /* 288 */ "nm ::= JOIN_KW", |
| 132691 | + /* 289 */ "typetoken ::= typename", |
| 132692 | + /* 290 */ "typename ::= ID|STRING", |
| 132693 | + /* 291 */ "signed ::= plus_num", |
| 132694 | + /* 292 */ "signed ::= minus_num", |
| 132695 | + /* 293 */ "carglist ::= carglist ccons", |
| 132696 | + /* 294 */ "carglist ::=", |
| 132697 | + /* 295 */ "ccons ::= NULL onconf", |
| 132698 | + /* 296 */ "conslist_opt ::= COMMA conslist", |
| 132699 | + /* 297 */ "conslist ::= conslist tconscomma tcons", |
| 132700 | + /* 298 */ "conslist ::= tcons", |
| 132701 | + /* 299 */ "tconscomma ::=", |
| 132702 | + /* 300 */ "defer_subclause_opt ::= defer_subclause", |
| 132703 | + /* 301 */ "resolvetype ::= raisetype", |
| 132704 | + /* 302 */ "selectnowith ::= oneselect", |
| 132705 | + /* 303 */ "oneselect ::= values", |
| 132706 | + /* 304 */ "sclp ::= selcollist COMMA", |
| 132707 | + /* 305 */ "as ::= ID|STRING", |
| 132708 | + /* 306 */ "expr ::= term", |
| 132709 | + /* 307 */ "exprlist ::= nexprlist", |
| 132710 | + /* 308 */ "nmnum ::= plus_num", |
| 132711 | + /* 309 */ "nmnum ::= nm", |
| 132712 | + /* 310 */ "nmnum ::= ON", |
| 132713 | + /* 311 */ "nmnum ::= DELETE", |
| 132714 | + /* 312 */ "nmnum ::= DEFAULT", |
| 132715 | + /* 313 */ "plus_num ::= INTEGER|FLOAT", |
| 132716 | + /* 314 */ "foreach_clause ::=", |
| 132717 | + /* 315 */ "foreach_clause ::= FOR EACH ROW", |
| 132718 | + /* 316 */ "trnm ::= nm", |
| 132719 | + /* 317 */ "tridxby ::=", |
| 132720 | + /* 318 */ "database_kw_opt ::= DATABASE", |
| 132721 | + /* 319 */ "database_kw_opt ::=", |
| 132722 | + /* 320 */ "kwcolumn_opt ::=", |
| 132723 | + /* 321 */ "kwcolumn_opt ::= COLUMNKW", |
| 132724 | + /* 322 */ "vtabarglist ::= vtabarg", |
| 132725 | + /* 323 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 132726 | + /* 324 */ "vtabarg ::= vtabarg vtabargtoken", |
| 132727 | + /* 325 */ "anylist ::=", |
| 132728 | + /* 326 */ "anylist ::= anylist LP anylist RP", |
| 132729 | + /* 327 */ "anylist ::= anylist ANY", |
| 132126 | 132730 | }; |
| 132127 | 132731 | #endif /* NDEBUG */ |
| 132128 | 132732 | |
| 132129 | 132733 | |
| 132130 | 132734 | #if YYSTACKDEPTH<=0 |
| 132131 | 132735 | /* |
| 132132 | | -** Try to increase the size of the parser stack. |
| 132736 | +** Try to increase the size of the parser stack. Return the number |
| 132737 | +** of errors. Return 0 on success. |
| 132133 | 132738 | */ |
| 132134 | | -static void yyGrowStack(yyParser *p){ |
| 132739 | +static int yyGrowStack(yyParser *p){ |
| 132135 | 132740 | int newSize; |
| 132741 | + int idx; |
| 132136 | 132742 | yyStackEntry *pNew; |
| 132137 | 132743 | |
| 132138 | 132744 | newSize = p->yystksz*2 + 100; |
| 132139 | | - pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); |
| 132745 | + idx = p->yytos ? (int)(p->yytos - p->yystack) : 0; |
| 132746 | + if( p->yystack==&p->yystk0 ){ |
| 132747 | + pNew = malloc(newSize*sizeof(pNew[0])); |
| 132748 | + if( pNew ) pNew[0] = p->yystk0; |
| 132749 | + }else{ |
| 132750 | + pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); |
| 132751 | + } |
| 132140 | 132752 | if( pNew ){ |
| 132141 | 132753 | p->yystack = pNew; |
| 132142 | | - p->yystksz = newSize; |
| 132754 | + p->yytos = &p->yystack[idx]; |
| 132143 | 132755 | #ifndef NDEBUG |
| 132144 | 132756 | if( yyTraceFILE ){ |
| 132145 | | - fprintf(yyTraceFILE,"%sStack grows to %d entries!\n", |
| 132146 | | - yyTracePrompt, p->yystksz); |
| 132757 | + fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n", |
| 132758 | + yyTracePrompt, p->yystksz, newSize); |
| 132147 | 132759 | } |
| 132148 | 132760 | #endif |
| 132761 | + p->yystksz = newSize; |
| 132149 | 132762 | } |
| 132763 | + return pNew==0; |
| 132150 | 132764 | } |
| 132151 | 132765 | #endif |
| 132152 | 132766 | |
| 132153 | 132767 | /* Datatype of the argument to the memory allocated passed as the |
| 132154 | 132768 | ** second argument to sqlite3ParserAlloc() below. This can be changed by |
| | @@ -132173,19 +132787,28 @@ |
| 132173 | 132787 | */ |
| 132174 | 132788 | SQLITE_PRIVATE void *sqlite3ParserAlloc(void *(*mallocProc)(YYMALLOCARGTYPE)){ |
| 132175 | 132789 | yyParser *pParser; |
| 132176 | 132790 | pParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); |
| 132177 | 132791 | if( pParser ){ |
| 132178 | | - pParser->yyidx = -1; |
| 132179 | 132792 | #ifdef YYTRACKMAXSTACKDEPTH |
| 132180 | | - pParser->yyidxMax = 0; |
| 132793 | + pParser->yyhwm = 0; |
| 132181 | 132794 | #endif |
| 132182 | 132795 | #if YYSTACKDEPTH<=0 |
| 132796 | + pParser->yytos = NULL; |
| 132183 | 132797 | pParser->yystack = NULL; |
| 132184 | 132798 | pParser->yystksz = 0; |
| 132185 | | - yyGrowStack(pParser); |
| 132799 | + if( yyGrowStack(pParser) ){ |
| 132800 | + pParser->yystack = &pParser->yystk0; |
| 132801 | + pParser->yystksz = 1; |
| 132802 | + } |
| 132186 | 132803 | #endif |
| 132804 | +#ifndef YYNOERRORRECOVERY |
| 132805 | + pParser->yyerrcnt = -1; |
| 132806 | +#endif |
| 132807 | + pParser->yytos = pParser->yystack; |
| 132808 | + pParser->yystack[0].stateno = 0; |
| 132809 | + pParser->yystack[0].major = 0; |
| 132187 | 132810 | } |
| 132188 | 132811 | return pParser; |
| 132189 | 132812 | } |
| 132190 | 132813 | |
| 132191 | 132814 | /* The following function deletes the "minor type" or semantic value |
| | @@ -132216,17 +132839,17 @@ |
| 132216 | 132839 | case 163: /* select */ |
| 132217 | 132840 | case 194: /* selectnowith */ |
| 132218 | 132841 | case 195: /* oneselect */ |
| 132219 | 132842 | case 206: /* values */ |
| 132220 | 132843 | { |
| 132221 | | -sqlite3SelectDelete(pParse->db, (yypminor->yy159)); |
| 132844 | +sqlite3SelectDelete(pParse->db, (yypminor->yy243)); |
| 132222 | 132845 | } |
| 132223 | 132846 | break; |
| 132224 | 132847 | case 172: /* term */ |
| 132225 | 132848 | case 173: /* expr */ |
| 132226 | 132849 | { |
| 132227 | | -sqlite3ExprDelete(pParse->db, (yypminor->yy342).pExpr); |
| 132850 | +sqlite3ExprDelete(pParse->db, (yypminor->yy190).pExpr); |
| 132228 | 132851 | } |
| 132229 | 132852 | break; |
| 132230 | 132853 | case 177: /* eidlist_opt */ |
| 132231 | 132854 | case 186: /* sortlist */ |
| 132232 | 132855 | case 187: /* eidlist */ |
| | @@ -132235,56 +132858,57 @@ |
| 132235 | 132858 | case 204: /* orderby_opt */ |
| 132236 | 132859 | case 207: /* nexprlist */ |
| 132237 | 132860 | case 208: /* exprlist */ |
| 132238 | 132861 | case 209: /* sclp */ |
| 132239 | 132862 | case 218: /* setlist */ |
| 132240 | | - case 225: /* case_exprlist */ |
| 132863 | + case 224: /* paren_exprlist */ |
| 132864 | + case 226: /* case_exprlist */ |
| 132241 | 132865 | { |
| 132242 | | -sqlite3ExprListDelete(pParse->db, (yypminor->yy442)); |
| 132866 | +sqlite3ExprListDelete(pParse->db, (yypminor->yy148)); |
| 132243 | 132867 | } |
| 132244 | 132868 | break; |
| 132245 | 132869 | case 193: /* fullname */ |
| 132246 | 132870 | case 200: /* from */ |
| 132247 | 132871 | case 211: /* seltablist */ |
| 132248 | 132872 | case 212: /* stl_prefix */ |
| 132249 | 132873 | { |
| 132250 | | -sqlite3SrcListDelete(pParse->db, (yypminor->yy347)); |
| 132874 | +sqlite3SrcListDelete(pParse->db, (yypminor->yy185)); |
| 132251 | 132875 | } |
| 132252 | 132876 | break; |
| 132253 | 132877 | case 196: /* with */ |
| 132254 | | - case 249: /* wqlist */ |
| 132878 | + case 250: /* wqlist */ |
| 132255 | 132879 | { |
| 132256 | | -sqlite3WithDelete(pParse->db, (yypminor->yy331)); |
| 132880 | +sqlite3WithDelete(pParse->db, (yypminor->yy285)); |
| 132257 | 132881 | } |
| 132258 | 132882 | break; |
| 132259 | 132883 | case 201: /* where_opt */ |
| 132260 | 132884 | case 203: /* having_opt */ |
| 132261 | 132885 | case 215: /* on_opt */ |
| 132262 | | - case 224: /* case_operand */ |
| 132263 | | - case 226: /* case_else */ |
| 132264 | | - case 235: /* when_clause */ |
| 132265 | | - case 240: /* key_opt */ |
| 132886 | + case 225: /* case_operand */ |
| 132887 | + case 227: /* case_else */ |
| 132888 | + case 236: /* when_clause */ |
| 132889 | + case 241: /* key_opt */ |
| 132266 | 132890 | { |
| 132267 | | -sqlite3ExprDelete(pParse->db, (yypminor->yy122)); |
| 132891 | +sqlite3ExprDelete(pParse->db, (yypminor->yy72)); |
| 132268 | 132892 | } |
| 132269 | 132893 | break; |
| 132270 | 132894 | case 216: /* using_opt */ |
| 132271 | 132895 | case 217: /* idlist */ |
| 132272 | 132896 | case 220: /* idlist_opt */ |
| 132273 | 132897 | { |
| 132274 | | -sqlite3IdListDelete(pParse->db, (yypminor->yy180)); |
| 132898 | +sqlite3IdListDelete(pParse->db, (yypminor->yy254)); |
| 132275 | 132899 | } |
| 132276 | 132900 | break; |
| 132277 | | - case 231: /* trigger_cmd_list */ |
| 132278 | | - case 236: /* trigger_cmd */ |
| 132901 | + case 232: /* trigger_cmd_list */ |
| 132902 | + case 237: /* trigger_cmd */ |
| 132279 | 132903 | { |
| 132280 | | -sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy327)); |
| 132904 | +sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy145)); |
| 132281 | 132905 | } |
| 132282 | 132906 | break; |
| 132283 | | - case 233: /* trigger_event */ |
| 132907 | + case 234: /* trigger_event */ |
| 132284 | 132908 | { |
| 132285 | | -sqlite3IdListDelete(pParse->db, (yypminor->yy410).b); |
| 132909 | +sqlite3IdListDelete(pParse->db, (yypminor->yy332).b); |
| 132286 | 132910 | } |
| 132287 | 132911 | break; |
| 132288 | 132912 | /********* End destructor definitions *****************************************/ |
| 132289 | 132913 | default: break; /* If no destructor action specified: do nothing */ |
| 132290 | 132914 | } |
| | @@ -132296,12 +132920,13 @@ |
| 132296 | 132920 | ** If there is a destructor routine associated with the token which |
| 132297 | 132921 | ** is popped from the stack, then call it. |
| 132298 | 132922 | */ |
| 132299 | 132923 | static void yy_pop_parser_stack(yyParser *pParser){ |
| 132300 | 132924 | yyStackEntry *yytos; |
| 132301 | | - assert( pParser->yyidx>=0 ); |
| 132302 | | - yytos = &pParser->yystack[pParser->yyidx--]; |
| 132925 | + assert( pParser->yytos!=0 ); |
| 132926 | + assert( pParser->yytos > pParser->yystack ); |
| 132927 | + yytos = pParser->yytos--; |
| 132303 | 132928 | #ifndef NDEBUG |
| 132304 | 132929 | if( yyTraceFILE ){ |
| 132305 | 132930 | fprintf(yyTraceFILE,"%sPopping %s\n", |
| 132306 | 132931 | yyTracePrompt, |
| 132307 | 132932 | yyTokenName[yytos->major]); |
| | @@ -132324,13 +132949,13 @@ |
| 132324 | 132949 | ){ |
| 132325 | 132950 | yyParser *pParser = (yyParser*)p; |
| 132326 | 132951 | #ifndef YYPARSEFREENEVERNULL |
| 132327 | 132952 | if( pParser==0 ) return; |
| 132328 | 132953 | #endif |
| 132329 | | - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); |
| 132954 | + while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser); |
| 132330 | 132955 | #if YYSTACKDEPTH<=0 |
| 132331 | | - free(pParser->yystack); |
| 132956 | + if( pParser->yystack!=&pParser->yystk0 ) free(pParser->yystack); |
| 132332 | 132957 | #endif |
| 132333 | 132958 | (*freeProc)((void*)pParser); |
| 132334 | 132959 | } |
| 132335 | 132960 | |
| 132336 | 132961 | /* |
| | @@ -132337,11 +132962,11 @@ |
| 132337 | 132962 | ** Return the peak depth of the stack for a parser. |
| 132338 | 132963 | */ |
| 132339 | 132964 | #ifdef YYTRACKMAXSTACKDEPTH |
| 132340 | 132965 | SQLITE_PRIVATE int sqlite3ParserStackPeak(void *p){ |
| 132341 | 132966 | yyParser *pParser = (yyParser*)p; |
| 132342 | | - return pParser->yyidxMax; |
| 132967 | + return pParser->yyhwm; |
| 132343 | 132968 | } |
| 132344 | 132969 | #endif |
| 132345 | 132970 | |
| 132346 | 132971 | /* |
| 132347 | 132972 | ** Find the appropriate action for a parser given the terminal |
| | @@ -132350,11 +132975,11 @@ |
| 132350 | 132975 | static unsigned int yy_find_shift_action( |
| 132351 | 132976 | yyParser *pParser, /* The parser */ |
| 132352 | 132977 | YYCODETYPE iLookAhead /* The look-ahead token */ |
| 132353 | 132978 | ){ |
| 132354 | 132979 | int i; |
| 132355 | | - int stateno = pParser->yystack[pParser->yyidx].stateno; |
| 132980 | + int stateno = pParser->yytos->stateno; |
| 132356 | 132981 | |
| 132357 | 132982 | if( stateno>=YY_MIN_REDUCE ) return stateno; |
| 132358 | 132983 | assert( stateno <= YY_SHIFT_COUNT ); |
| 132359 | 132984 | do{ |
| 132360 | 132985 | i = yy_shift_ofst[stateno]; |
| | @@ -132443,17 +133068,17 @@ |
| 132443 | 133068 | /* |
| 132444 | 133069 | ** The following routine is called if the stack overflows. |
| 132445 | 133070 | */ |
| 132446 | 133071 | static void yyStackOverflow(yyParser *yypParser){ |
| 132447 | 133072 | sqlite3ParserARG_FETCH; |
| 132448 | | - yypParser->yyidx--; |
| 133073 | + yypParser->yytos--; |
| 132449 | 133074 | #ifndef NDEBUG |
| 132450 | 133075 | if( yyTraceFILE ){ |
| 132451 | 133076 | fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); |
| 132452 | 133077 | } |
| 132453 | 133078 | #endif |
| 132454 | | - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); |
| 133079 | + while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); |
| 132455 | 133080 | /* Here code is inserted which will execute if the parser |
| 132456 | 133081 | ** stack every overflows */ |
| 132457 | 133082 | /******** Begin %stack_overflow code ******************************************/ |
| 132458 | 133083 | |
| 132459 | 133084 | sqlite3ErrorMsg(pParse, "parser stack overflow"); |
| | @@ -132467,15 +133092,15 @@ |
| 132467 | 133092 | #ifndef NDEBUG |
| 132468 | 133093 | static void yyTraceShift(yyParser *yypParser, int yyNewState){ |
| 132469 | 133094 | if( yyTraceFILE ){ |
| 132470 | 133095 | if( yyNewState<YYNSTATE ){ |
| 132471 | 133096 | fprintf(yyTraceFILE,"%sShift '%s', go to state %d\n", |
| 132472 | | - yyTracePrompt,yyTokenName[yypParser->yystack[yypParser->yyidx].major], |
| 133097 | + yyTracePrompt,yyTokenName[yypParser->yytos->major], |
| 132473 | 133098 | yyNewState); |
| 132474 | 133099 | }else{ |
| 132475 | 133100 | fprintf(yyTraceFILE,"%sShift '%s'\n", |
| 132476 | | - yyTracePrompt,yyTokenName[yypParser->yystack[yypParser->yyidx].major]); |
| 133101 | + yyTracePrompt,yyTokenName[yypParser->yytos->major]); |
| 132477 | 133102 | } |
| 132478 | 133103 | } |
| 132479 | 133104 | } |
| 132480 | 133105 | #else |
| 132481 | 133106 | # define yyTraceShift(X,Y) |
| | @@ -132489,31 +133114,34 @@ |
| 132489 | 133114 | int yyNewState, /* The new state to shift in */ |
| 132490 | 133115 | int yyMajor, /* The major token to shift in */ |
| 132491 | 133116 | sqlite3ParserTOKENTYPE yyMinor /* The minor token to shift in */ |
| 132492 | 133117 | ){ |
| 132493 | 133118 | yyStackEntry *yytos; |
| 132494 | | - yypParser->yyidx++; |
| 133119 | + yypParser->yytos++; |
| 132495 | 133120 | #ifdef YYTRACKMAXSTACKDEPTH |
| 132496 | | - if( yypParser->yyidx>yypParser->yyidxMax ){ |
| 132497 | | - yypParser->yyidxMax = yypParser->yyidx; |
| 133121 | + if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ |
| 133122 | + yypParser->yyhwm++; |
| 133123 | + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); |
| 132498 | 133124 | } |
| 132499 | 133125 | #endif |
| 132500 | 133126 | #if YYSTACKDEPTH>0 |
| 132501 | | - if( yypParser->yyidx>=YYSTACKDEPTH ){ |
| 133127 | + if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH] ){ |
| 132502 | 133128 | yyStackOverflow(yypParser); |
| 132503 | 133129 | return; |
| 132504 | 133130 | } |
| 132505 | 133131 | #else |
| 132506 | | - if( yypParser->yyidx>=yypParser->yystksz ){ |
| 132507 | | - yyGrowStack(yypParser); |
| 132508 | | - if( yypParser->yyidx>=yypParser->yystksz ){ |
| 133132 | + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz] ){ |
| 133133 | + if( yyGrowStack(yypParser) ){ |
| 132509 | 133134 | yyStackOverflow(yypParser); |
| 132510 | 133135 | return; |
| 132511 | 133136 | } |
| 132512 | 133137 | } |
| 132513 | 133138 | #endif |
| 132514 | | - yytos = &yypParser->yystack[yypParser->yyidx]; |
| 133139 | + if( yyNewState > YY_MAX_SHIFT ){ |
| 133140 | + yyNewState += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; |
| 133141 | + } |
| 133142 | + yytos = yypParser->yytos; |
| 132515 | 133143 | yytos->stateno = (YYACTIONTYPE)yyNewState; |
| 132516 | 133144 | yytos->major = (YYCODETYPE)yyMajor; |
| 132517 | 133145 | yytos->minor.yy0 = yyMinor; |
| 132518 | 133146 | yyTraceShift(yypParser, yyNewState); |
| 132519 | 133147 | } |
| | @@ -132713,31 +133341,33 @@ |
| 132713 | 133341 | { 223, 1 }, |
| 132714 | 133342 | { 223, 2 }, |
| 132715 | 133343 | { 173, 5 }, |
| 132716 | 133344 | { 173, 3 }, |
| 132717 | 133345 | { 173, 5 }, |
| 132718 | | - { 173, 4 }, |
| 133346 | + { 173, 5 }, |
| 132719 | 133347 | { 173, 4 }, |
| 132720 | 133348 | { 173, 5 }, |
| 132721 | | - { 225, 5 }, |
| 132722 | | - { 225, 4 }, |
| 132723 | | - { 226, 2 }, |
| 132724 | | - { 226, 0 }, |
| 132725 | | - { 224, 1 }, |
| 132726 | | - { 224, 0 }, |
| 133349 | + { 226, 5 }, |
| 133350 | + { 226, 4 }, |
| 133351 | + { 227, 2 }, |
| 133352 | + { 227, 0 }, |
| 133353 | + { 225, 1 }, |
| 133354 | + { 225, 0 }, |
| 132727 | 133355 | { 208, 0 }, |
| 132728 | 133356 | { 207, 3 }, |
| 132729 | 133357 | { 207, 1 }, |
| 133358 | + { 224, 0 }, |
| 133359 | + { 224, 3 }, |
| 132730 | 133360 | { 149, 12 }, |
| 132731 | | - { 227, 1 }, |
| 132732 | | - { 227, 0 }, |
| 133361 | + { 228, 1 }, |
| 133362 | + { 228, 0 }, |
| 132733 | 133363 | { 177, 0 }, |
| 132734 | 133364 | { 177, 3 }, |
| 132735 | 133365 | { 187, 5 }, |
| 132736 | 133366 | { 187, 3 }, |
| 132737 | | - { 228, 0 }, |
| 132738 | | - { 228, 2 }, |
| 133367 | + { 229, 0 }, |
| 133368 | + { 229, 2 }, |
| 132739 | 133369 | { 149, 4 }, |
| 132740 | 133370 | { 149, 1 }, |
| 132741 | 133371 | { 149, 2 }, |
| 132742 | 133372 | { 149, 3 }, |
| 132743 | 133373 | { 149, 5 }, |
| | @@ -132745,58 +133375,58 @@ |
| 132745 | 133375 | { 149, 5 }, |
| 132746 | 133376 | { 149, 6 }, |
| 132747 | 133377 | { 169, 2 }, |
| 132748 | 133378 | { 170, 2 }, |
| 132749 | 133379 | { 149, 5 }, |
| 132750 | | - { 230, 11 }, |
| 132751 | | - { 232, 1 }, |
| 132752 | | - { 232, 1 }, |
| 132753 | | - { 232, 2 }, |
| 132754 | | - { 232, 0 }, |
| 133380 | + { 231, 11 }, |
| 132755 | 133381 | { 233, 1 }, |
| 132756 | 133382 | { 233, 1 }, |
| 132757 | | - { 233, 3 }, |
| 132758 | | - { 235, 0 }, |
| 132759 | | - { 235, 2 }, |
| 132760 | | - { 231, 3 }, |
| 132761 | | - { 231, 2 }, |
| 132762 | | - { 237, 3 }, |
| 133383 | + { 233, 2 }, |
| 133384 | + { 233, 0 }, |
| 133385 | + { 234, 1 }, |
| 133386 | + { 234, 1 }, |
| 133387 | + { 234, 3 }, |
| 133388 | + { 236, 0 }, |
| 133389 | + { 236, 2 }, |
| 133390 | + { 232, 3 }, |
| 133391 | + { 232, 2 }, |
| 132763 | 133392 | { 238, 3 }, |
| 132764 | | - { 238, 2 }, |
| 132765 | | - { 236, 7 }, |
| 132766 | | - { 236, 5 }, |
| 132767 | | - { 236, 5 }, |
| 132768 | | - { 236, 1 }, |
| 133393 | + { 239, 3 }, |
| 133394 | + { 239, 2 }, |
| 133395 | + { 237, 7 }, |
| 133396 | + { 237, 5 }, |
| 133397 | + { 237, 5 }, |
| 133398 | + { 237, 1 }, |
| 132769 | 133399 | { 173, 4 }, |
| 132770 | 133400 | { 173, 6 }, |
| 132771 | 133401 | { 191, 1 }, |
| 132772 | 133402 | { 191, 1 }, |
| 132773 | 133403 | { 191, 1 }, |
| 132774 | 133404 | { 149, 4 }, |
| 132775 | 133405 | { 149, 6 }, |
| 132776 | 133406 | { 149, 3 }, |
| 132777 | | - { 240, 0 }, |
| 132778 | | - { 240, 2 }, |
| 133407 | + { 241, 0 }, |
| 133408 | + { 241, 2 }, |
| 132779 | 133409 | { 149, 1 }, |
| 132780 | 133410 | { 149, 3 }, |
| 132781 | 133411 | { 149, 1 }, |
| 132782 | 133412 | { 149, 3 }, |
| 132783 | 133413 | { 149, 6 }, |
| 132784 | 133414 | { 149, 7 }, |
| 132785 | | - { 241, 1 }, |
| 133415 | + { 242, 1 }, |
| 132786 | 133416 | { 149, 1 }, |
| 132787 | 133417 | { 149, 4 }, |
| 132788 | | - { 243, 8 }, |
| 132789 | | - { 245, 0 }, |
| 132790 | | - { 246, 1 }, |
| 132791 | | - { 246, 3 }, |
| 133418 | + { 244, 8 }, |
| 133419 | + { 246, 0 }, |
| 132792 | 133420 | { 247, 1 }, |
| 133421 | + { 247, 3 }, |
| 133422 | + { 248, 1 }, |
| 132793 | 133423 | { 196, 0 }, |
| 132794 | 133424 | { 196, 2 }, |
| 132795 | 133425 | { 196, 3 }, |
| 132796 | | - { 249, 6 }, |
| 132797 | | - { 249, 8 }, |
| 133426 | + { 250, 6 }, |
| 133427 | + { 250, 8 }, |
| 132798 | 133428 | { 144, 1 }, |
| 132799 | 133429 | { 145, 2 }, |
| 132800 | 133430 | { 145, 1 }, |
| 132801 | 133431 | { 146, 1 }, |
| 132802 | 133432 | { 146, 3 }, |
| | @@ -132829,30 +133459,30 @@ |
| 132829 | 133459 | { 195, 1 }, |
| 132830 | 133460 | { 209, 2 }, |
| 132831 | 133461 | { 210, 1 }, |
| 132832 | 133462 | { 173, 1 }, |
| 132833 | 133463 | { 208, 1 }, |
| 132834 | | - { 229, 1 }, |
| 132835 | | - { 229, 1 }, |
| 132836 | | - { 229, 1 }, |
| 132837 | | - { 229, 1 }, |
| 132838 | | - { 229, 1 }, |
| 133464 | + { 230, 1 }, |
| 133465 | + { 230, 1 }, |
| 133466 | + { 230, 1 }, |
| 133467 | + { 230, 1 }, |
| 133468 | + { 230, 1 }, |
| 132839 | 133469 | { 169, 1 }, |
| 132840 | | - { 234, 0 }, |
| 132841 | | - { 234, 3 }, |
| 132842 | | - { 237, 1 }, |
| 132843 | | - { 238, 0 }, |
| 132844 | | - { 239, 1 }, |
| 133470 | + { 235, 0 }, |
| 133471 | + { 235, 3 }, |
| 133472 | + { 238, 1 }, |
| 132845 | 133473 | { 239, 0 }, |
| 132846 | | - { 242, 0 }, |
| 132847 | | - { 242, 1 }, |
| 132848 | | - { 244, 1 }, |
| 132849 | | - { 244, 3 }, |
| 132850 | | - { 245, 2 }, |
| 132851 | | - { 248, 0 }, |
| 132852 | | - { 248, 4 }, |
| 132853 | | - { 248, 2 }, |
| 133474 | + { 240, 1 }, |
| 133475 | + { 240, 0 }, |
| 133476 | + { 243, 0 }, |
| 133477 | + { 243, 1 }, |
| 133478 | + { 245, 1 }, |
| 133479 | + { 245, 3 }, |
| 133480 | + { 246, 2 }, |
| 133481 | + { 249, 0 }, |
| 133482 | + { 249, 4 }, |
| 133483 | + { 249, 2 }, |
| 132854 | 133484 | }; |
| 132855 | 133485 | |
| 132856 | 133486 | static void yy_accept(yyParser*); /* Forward Declaration */ |
| 132857 | 133487 | |
| 132858 | 133488 | /* |
| | @@ -132866,11 +133496,11 @@ |
| 132866 | 133496 | int yygoto; /* The next state */ |
| 132867 | 133497 | int yyact; /* The next action */ |
| 132868 | 133498 | yyStackEntry *yymsp; /* The top of the parser's stack */ |
| 132869 | 133499 | int yysize; /* Amount to pop the stack */ |
| 132870 | 133500 | sqlite3ParserARG_FETCH; |
| 132871 | | - yymsp = &yypParser->yystack[yypParser->yyidx]; |
| 133501 | + yymsp = yypParser->yytos; |
| 132872 | 133502 | #ifndef NDEBUG |
| 132873 | 133503 | if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ |
| 132874 | 133504 | yysize = yyRuleInfo[yyruleno].nrhs; |
| 132875 | 133505 | fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt, |
| 132876 | 133506 | yyRuleName[yyruleno], yymsp[-yysize].stateno); |
| | @@ -132880,26 +133510,27 @@ |
| 132880 | 133510 | /* Check that the stack is large enough to grow by a single entry |
| 132881 | 133511 | ** if the RHS of the rule is empty. This ensures that there is room |
| 132882 | 133512 | ** enough on the stack to push the LHS value */ |
| 132883 | 133513 | if( yyRuleInfo[yyruleno].nrhs==0 ){ |
| 132884 | 133514 | #ifdef YYTRACKMAXSTACKDEPTH |
| 132885 | | - if( yypParser->yyidx>yypParser->yyidxMax ){ |
| 132886 | | - yypParser->yyidxMax = yypParser->yyidx; |
| 133515 | + if( (int)(yypParser->yytos - yypParser->yystack)>yypParser->yyhwm ){ |
| 133516 | + yypParser->yyhwm++; |
| 133517 | + assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); |
| 132887 | 133518 | } |
| 132888 | 133519 | #endif |
| 132889 | 133520 | #if YYSTACKDEPTH>0 |
| 132890 | | - if( yypParser->yyidx>=YYSTACKDEPTH-1 ){ |
| 133521 | + if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH-1] ){ |
| 132891 | 133522 | yyStackOverflow(yypParser); |
| 132892 | 133523 | return; |
| 132893 | 133524 | } |
| 132894 | 133525 | #else |
| 132895 | | - if( yypParser->yyidx>=yypParser->yystksz-1 ){ |
| 132896 | | - yyGrowStack(yypParser); |
| 132897 | | - if( yypParser->yyidx>=yypParser->yystksz-1 ){ |
| 133526 | + if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ |
| 133527 | + if( yyGrowStack(yypParser) ){ |
| 132898 | 133528 | yyStackOverflow(yypParser); |
| 132899 | 133529 | return; |
| 132900 | 133530 | } |
| 133531 | + yymsp = yypParser->yytos; |
| 132901 | 133532 | } |
| 132902 | 133533 | #endif |
| 132903 | 133534 | } |
| 132904 | 133535 | |
| 132905 | 133536 | switch( yyruleno ){ |
| | @@ -132921,19 +133552,19 @@ |
| 132921 | 133552 | break; |
| 132922 | 133553 | case 2: /* cmdx ::= cmd */ |
| 132923 | 133554 | { sqlite3FinishCoding(pParse); } |
| 132924 | 133555 | break; |
| 132925 | 133556 | case 3: /* cmd ::= BEGIN transtype trans_opt */ |
| 132926 | | -{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy392);} |
| 133557 | +{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy194);} |
| 132927 | 133558 | break; |
| 132928 | 133559 | case 4: /* transtype ::= */ |
| 132929 | | -{yymsp[1].minor.yy392 = TK_DEFERRED;} |
| 133560 | +{yymsp[1].minor.yy194 = TK_DEFERRED;} |
| 132930 | 133561 | break; |
| 132931 | 133562 | case 5: /* transtype ::= DEFERRED */ |
| 132932 | 133563 | case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6); |
| 132933 | 133564 | case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7); |
| 132934 | | -{yymsp[0].minor.yy392 = yymsp[0].major; /*A-overwrites-X*/} |
| 133565 | +{yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-X*/} |
| 132935 | 133566 | break; |
| 132936 | 133567 | case 8: /* cmd ::= COMMIT trans_opt */ |
| 132937 | 133568 | case 9: /* cmd ::= END trans_opt */ yytestcase(yyruleno==9); |
| 132938 | 133569 | {sqlite3CommitTransaction(pParse);} |
| 132939 | 133570 | break; |
| | @@ -132955,11 +133586,11 @@ |
| 132955 | 133586 | sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0); |
| 132956 | 133587 | } |
| 132957 | 133588 | break; |
| 132958 | 133589 | case 14: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ |
| 132959 | 133590 | { |
| 132960 | | - sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy392,0,0,yymsp[-2].minor.yy392); |
| 133591 | + sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy194,0,0,yymsp[-2].minor.yy194); |
| 132961 | 133592 | } |
| 132962 | 133593 | break; |
| 132963 | 133594 | case 15: /* createkw ::= CREATE */ |
| 132964 | 133595 | {disableLookaside(pParse);} |
| 132965 | 133596 | break; |
| | @@ -132969,37 +133600,37 @@ |
| 132969 | 133600 | case 42: /* autoinc ::= */ yytestcase(yyruleno==42); |
| 132970 | 133601 | case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57); |
| 132971 | 133602 | case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67); |
| 132972 | 133603 | case 76: /* ifexists ::= */ yytestcase(yyruleno==76); |
| 132973 | 133604 | case 90: /* distinct ::= */ yytestcase(yyruleno==90); |
| 132974 | | - case 209: /* collate ::= */ yytestcase(yyruleno==209); |
| 132975 | | -{yymsp[1].minor.yy392 = 0;} |
| 133605 | + case 211: /* collate ::= */ yytestcase(yyruleno==211); |
| 133606 | +{yymsp[1].minor.yy194 = 0;} |
| 132976 | 133607 | break; |
| 132977 | 133608 | case 17: /* ifnotexists ::= IF NOT EXISTS */ |
| 132978 | | -{yymsp[-2].minor.yy392 = 1;} |
| 133609 | +{yymsp[-2].minor.yy194 = 1;} |
| 132979 | 133610 | break; |
| 132980 | 133611 | case 18: /* temp ::= TEMP */ |
| 132981 | 133612 | case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43); |
| 132982 | | -{yymsp[0].minor.yy392 = 1;} |
| 133613 | +{yymsp[0].minor.yy194 = 1;} |
| 132983 | 133614 | break; |
| 132984 | 133615 | case 20: /* create_table_args ::= LP columnlist conslist_opt RP table_options */ |
| 132985 | 133616 | { |
| 132986 | | - sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy392,0); |
| 133617 | + sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy194,0); |
| 132987 | 133618 | } |
| 132988 | 133619 | break; |
| 132989 | 133620 | case 21: /* create_table_args ::= AS select */ |
| 132990 | 133621 | { |
| 132991 | | - sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy159); |
| 132992 | | - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy159); |
| 133622 | + sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy243); |
| 133623 | + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy243); |
| 132993 | 133624 | } |
| 132994 | 133625 | break; |
| 132995 | 133626 | case 23: /* table_options ::= WITHOUT nm */ |
| 132996 | 133627 | { |
| 132997 | 133628 | if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){ |
| 132998 | | - yymsp[-1].minor.yy392 = TF_WithoutRowid | TF_NoVisibleRowid; |
| 133629 | + yymsp[-1].minor.yy194 = TF_WithoutRowid | TF_NoVisibleRowid; |
| 132999 | 133630 | }else{ |
| 133000 | | - yymsp[-1].minor.yy392 = 0; |
| 133631 | + yymsp[-1].minor.yy194 = 0; |
| 133001 | 133632 | sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); |
| 133002 | 133633 | } |
| 133003 | 133634 | } |
| 133004 | 133635 | break; |
| 133005 | 133636 | case 24: /* columnname ::= nm typetoken */ |
| | @@ -133027,21 +133658,21 @@ |
| 133027 | 133658 | case 62: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==62); |
| 133028 | 133659 | {pParse->constraintName = yymsp[0].minor.yy0;} |
| 133029 | 133660 | break; |
| 133030 | 133661 | case 30: /* ccons ::= DEFAULT term */ |
| 133031 | 133662 | case 32: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==32); |
| 133032 | | -{sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy342);} |
| 133663 | +{sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy190);} |
| 133033 | 133664 | break; |
| 133034 | 133665 | case 31: /* ccons ::= DEFAULT LP expr RP */ |
| 133035 | | -{sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy342);} |
| 133666 | +{sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy190);} |
| 133036 | 133667 | break; |
| 133037 | 133668 | case 33: /* ccons ::= DEFAULT MINUS term */ |
| 133038 | 133669 | { |
| 133039 | 133670 | ExprSpan v; |
| 133040 | | - v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy342.pExpr, 0, 0); |
| 133671 | + v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy190.pExpr, 0, 0); |
| 133041 | 133672 | v.zStart = yymsp[-1].minor.yy0.z; |
| 133042 | | - v.zEnd = yymsp[0].minor.yy342.zEnd; |
| 133673 | + v.zEnd = yymsp[0].minor.yy190.zEnd; |
| 133043 | 133674 | sqlite3AddDefaultValue(pParse,&v); |
| 133044 | 133675 | } |
| 133045 | 133676 | break; |
| 133046 | 133677 | case 34: /* ccons ::= DEFAULT ID|INDEXED */ |
| 133047 | 133678 | { |
| | @@ -133049,184 +133680,186 @@ |
| 133049 | 133680 | spanExpr(&v, pParse, TK_STRING, yymsp[0].minor.yy0); |
| 133050 | 133681 | sqlite3AddDefaultValue(pParse,&v); |
| 133051 | 133682 | } |
| 133052 | 133683 | break; |
| 133053 | 133684 | case 35: /* ccons ::= NOT NULL onconf */ |
| 133054 | | -{sqlite3AddNotNull(pParse, yymsp[0].minor.yy392);} |
| 133685 | +{sqlite3AddNotNull(pParse, yymsp[0].minor.yy194);} |
| 133055 | 133686 | break; |
| 133056 | 133687 | case 36: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ |
| 133057 | | -{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy392,yymsp[0].minor.yy392,yymsp[-2].minor.yy392);} |
| 133688 | +{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy194,yymsp[0].minor.yy194,yymsp[-2].minor.yy194);} |
| 133058 | 133689 | break; |
| 133059 | 133690 | case 37: /* ccons ::= UNIQUE onconf */ |
| 133060 | | -{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy392,0,0,0,0);} |
| 133691 | +{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy194,0,0,0,0, |
| 133692 | + SQLITE_IDXTYPE_UNIQUE);} |
| 133061 | 133693 | break; |
| 133062 | 133694 | case 38: /* ccons ::= CHECK LP expr RP */ |
| 133063 | | -{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy342.pExpr);} |
| 133695 | +{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy190.pExpr);} |
| 133064 | 133696 | break; |
| 133065 | 133697 | case 39: /* ccons ::= REFERENCES nm eidlist_opt refargs */ |
| 133066 | | -{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy442,yymsp[0].minor.yy392);} |
| 133698 | +{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy148,yymsp[0].minor.yy194);} |
| 133067 | 133699 | break; |
| 133068 | 133700 | case 40: /* ccons ::= defer_subclause */ |
| 133069 | | -{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy392);} |
| 133701 | +{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy194);} |
| 133070 | 133702 | break; |
| 133071 | 133703 | case 41: /* ccons ::= COLLATE ID|STRING */ |
| 133072 | 133704 | {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);} |
| 133073 | 133705 | break; |
| 133074 | 133706 | case 44: /* refargs ::= */ |
| 133075 | | -{ yymsp[1].minor.yy392 = OE_None*0x0101; /* EV: R-19803-45884 */} |
| 133707 | +{ yymsp[1].minor.yy194 = OE_None*0x0101; /* EV: R-19803-45884 */} |
| 133076 | 133708 | break; |
| 133077 | 133709 | case 45: /* refargs ::= refargs refarg */ |
| 133078 | | -{ yymsp[-1].minor.yy392 = (yymsp[-1].minor.yy392 & ~yymsp[0].minor.yy207.mask) | yymsp[0].minor.yy207.value; } |
| 133710 | +{ yymsp[-1].minor.yy194 = (yymsp[-1].minor.yy194 & ~yymsp[0].minor.yy497.mask) | yymsp[0].minor.yy497.value; } |
| 133079 | 133711 | break; |
| 133080 | 133712 | case 46: /* refarg ::= MATCH nm */ |
| 133081 | | -{ yymsp[-1].minor.yy207.value = 0; yymsp[-1].minor.yy207.mask = 0x000000; } |
| 133713 | +{ yymsp[-1].minor.yy497.value = 0; yymsp[-1].minor.yy497.mask = 0x000000; } |
| 133082 | 133714 | break; |
| 133083 | 133715 | case 47: /* refarg ::= ON INSERT refact */ |
| 133084 | | -{ yymsp[-2].minor.yy207.value = 0; yymsp[-2].minor.yy207.mask = 0x000000; } |
| 133716 | +{ yymsp[-2].minor.yy497.value = 0; yymsp[-2].minor.yy497.mask = 0x000000; } |
| 133085 | 133717 | break; |
| 133086 | 133718 | case 48: /* refarg ::= ON DELETE refact */ |
| 133087 | | -{ yymsp[-2].minor.yy207.value = yymsp[0].minor.yy392; yymsp[-2].minor.yy207.mask = 0x0000ff; } |
| 133719 | +{ yymsp[-2].minor.yy497.value = yymsp[0].minor.yy194; yymsp[-2].minor.yy497.mask = 0x0000ff; } |
| 133088 | 133720 | break; |
| 133089 | 133721 | case 49: /* refarg ::= ON UPDATE refact */ |
| 133090 | | -{ yymsp[-2].minor.yy207.value = yymsp[0].minor.yy392<<8; yymsp[-2].minor.yy207.mask = 0x00ff00; } |
| 133722 | +{ yymsp[-2].minor.yy497.value = yymsp[0].minor.yy194<<8; yymsp[-2].minor.yy497.mask = 0x00ff00; } |
| 133091 | 133723 | break; |
| 133092 | 133724 | case 50: /* refact ::= SET NULL */ |
| 133093 | | -{ yymsp[-1].minor.yy392 = OE_SetNull; /* EV: R-33326-45252 */} |
| 133725 | +{ yymsp[-1].minor.yy194 = OE_SetNull; /* EV: R-33326-45252 */} |
| 133094 | 133726 | break; |
| 133095 | 133727 | case 51: /* refact ::= SET DEFAULT */ |
| 133096 | | -{ yymsp[-1].minor.yy392 = OE_SetDflt; /* EV: R-33326-45252 */} |
| 133728 | +{ yymsp[-1].minor.yy194 = OE_SetDflt; /* EV: R-33326-45252 */} |
| 133097 | 133729 | break; |
| 133098 | 133730 | case 52: /* refact ::= CASCADE */ |
| 133099 | | -{ yymsp[0].minor.yy392 = OE_Cascade; /* EV: R-33326-45252 */} |
| 133731 | +{ yymsp[0].minor.yy194 = OE_Cascade; /* EV: R-33326-45252 */} |
| 133100 | 133732 | break; |
| 133101 | 133733 | case 53: /* refact ::= RESTRICT */ |
| 133102 | | -{ yymsp[0].minor.yy392 = OE_Restrict; /* EV: R-33326-45252 */} |
| 133734 | +{ yymsp[0].minor.yy194 = OE_Restrict; /* EV: R-33326-45252 */} |
| 133103 | 133735 | break; |
| 133104 | 133736 | case 54: /* refact ::= NO ACTION */ |
| 133105 | | -{ yymsp[-1].minor.yy392 = OE_None; /* EV: R-33326-45252 */} |
| 133737 | +{ yymsp[-1].minor.yy194 = OE_None; /* EV: R-33326-45252 */} |
| 133106 | 133738 | break; |
| 133107 | 133739 | case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ |
| 133108 | | -{yymsp[-2].minor.yy392 = 0;} |
| 133740 | +{yymsp[-2].minor.yy194 = 0;} |
| 133109 | 133741 | break; |
| 133110 | 133742 | case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ |
| 133111 | 133743 | case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71); |
| 133112 | 133744 | case 142: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==142); |
| 133113 | | -{yymsp[-1].minor.yy392 = yymsp[0].minor.yy392;} |
| 133745 | +{yymsp[-1].minor.yy194 = yymsp[0].minor.yy194;} |
| 133114 | 133746 | break; |
| 133115 | 133747 | case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ |
| 133116 | 133748 | case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75); |
| 133117 | 133749 | case 183: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==183); |
| 133118 | 133750 | case 186: /* in_op ::= NOT IN */ yytestcase(yyruleno==186); |
| 133119 | | - case 210: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==210); |
| 133120 | | -{yymsp[-1].minor.yy392 = 1;} |
| 133751 | + case 212: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==212); |
| 133752 | +{yymsp[-1].minor.yy194 = 1;} |
| 133121 | 133753 | break; |
| 133122 | 133754 | case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ |
| 133123 | | -{yymsp[-1].minor.yy392 = 0;} |
| 133755 | +{yymsp[-1].minor.yy194 = 0;} |
| 133124 | 133756 | break; |
| 133125 | 133757 | case 61: /* tconscomma ::= COMMA */ |
| 133126 | 133758 | {pParse->constraintName.n = 0;} |
| 133127 | 133759 | break; |
| 133128 | 133760 | case 63: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ |
| 133129 | | -{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy442,yymsp[0].minor.yy392,yymsp[-2].minor.yy392,0);} |
| 133761 | +{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy148,yymsp[0].minor.yy194,yymsp[-2].minor.yy194,0);} |
| 133130 | 133762 | break; |
| 133131 | 133763 | case 64: /* tcons ::= UNIQUE LP sortlist RP onconf */ |
| 133132 | | -{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy442,yymsp[0].minor.yy392,0,0,0,0);} |
| 133764 | +{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy148,yymsp[0].minor.yy194,0,0,0,0, |
| 133765 | + SQLITE_IDXTYPE_UNIQUE);} |
| 133133 | 133766 | break; |
| 133134 | 133767 | case 65: /* tcons ::= CHECK LP expr RP onconf */ |
| 133135 | | -{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy342.pExpr);} |
| 133768 | +{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy190.pExpr);} |
| 133136 | 133769 | break; |
| 133137 | 133770 | case 66: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ |
| 133138 | 133771 | { |
| 133139 | | - sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy442, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy442, yymsp[-1].minor.yy392); |
| 133140 | | - sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy392); |
| 133772 | + sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy148, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy148, yymsp[-1].minor.yy194); |
| 133773 | + sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy194); |
| 133141 | 133774 | } |
| 133142 | 133775 | break; |
| 133143 | 133776 | case 68: /* onconf ::= */ |
| 133144 | 133777 | case 70: /* orconf ::= */ yytestcase(yyruleno==70); |
| 133145 | | -{yymsp[1].minor.yy392 = OE_Default;} |
| 133778 | +{yymsp[1].minor.yy194 = OE_Default;} |
| 133146 | 133779 | break; |
| 133147 | 133780 | case 69: /* onconf ::= ON CONFLICT resolvetype */ |
| 133148 | | -{yymsp[-2].minor.yy392 = yymsp[0].minor.yy392;} |
| 133781 | +{yymsp[-2].minor.yy194 = yymsp[0].minor.yy194;} |
| 133149 | 133782 | break; |
| 133150 | 133783 | case 72: /* resolvetype ::= IGNORE */ |
| 133151 | | -{yymsp[0].minor.yy392 = OE_Ignore;} |
| 133784 | +{yymsp[0].minor.yy194 = OE_Ignore;} |
| 133152 | 133785 | break; |
| 133153 | 133786 | case 73: /* resolvetype ::= REPLACE */ |
| 133154 | 133787 | case 143: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==143); |
| 133155 | | -{yymsp[0].minor.yy392 = OE_Replace;} |
| 133788 | +{yymsp[0].minor.yy194 = OE_Replace;} |
| 133156 | 133789 | break; |
| 133157 | 133790 | case 74: /* cmd ::= DROP TABLE ifexists fullname */ |
| 133158 | 133791 | { |
| 133159 | | - sqlite3DropTable(pParse, yymsp[0].minor.yy347, 0, yymsp[-1].minor.yy392); |
| 133792 | + sqlite3DropTable(pParse, yymsp[0].minor.yy185, 0, yymsp[-1].minor.yy194); |
| 133160 | 133793 | } |
| 133161 | 133794 | break; |
| 133162 | 133795 | case 77: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ |
| 133163 | 133796 | { |
| 133164 | | - sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy442, yymsp[0].minor.yy159, yymsp[-7].minor.yy392, yymsp[-5].minor.yy392); |
| 133797 | + sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy148, yymsp[0].minor.yy243, yymsp[-7].minor.yy194, yymsp[-5].minor.yy194); |
| 133165 | 133798 | } |
| 133166 | 133799 | break; |
| 133167 | 133800 | case 78: /* cmd ::= DROP VIEW ifexists fullname */ |
| 133168 | 133801 | { |
| 133169 | | - sqlite3DropTable(pParse, yymsp[0].minor.yy347, 1, yymsp[-1].minor.yy392); |
| 133802 | + sqlite3DropTable(pParse, yymsp[0].minor.yy185, 1, yymsp[-1].minor.yy194); |
| 133170 | 133803 | } |
| 133171 | 133804 | break; |
| 133172 | 133805 | case 79: /* cmd ::= select */ |
| 133173 | 133806 | { |
| 133174 | 133807 | SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0}; |
| 133175 | | - sqlite3Select(pParse, yymsp[0].minor.yy159, &dest); |
| 133176 | | - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy159); |
| 133808 | + sqlite3Select(pParse, yymsp[0].minor.yy243, &dest); |
| 133809 | + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy243); |
| 133177 | 133810 | } |
| 133178 | 133811 | break; |
| 133179 | 133812 | case 80: /* select ::= with selectnowith */ |
| 133180 | 133813 | { |
| 133181 | | - Select *p = yymsp[0].minor.yy159; |
| 133814 | + Select *p = yymsp[0].minor.yy243; |
| 133182 | 133815 | if( p ){ |
| 133183 | | - p->pWith = yymsp[-1].minor.yy331; |
| 133816 | + p->pWith = yymsp[-1].minor.yy285; |
| 133184 | 133817 | parserDoubleLinkSelect(pParse, p); |
| 133185 | 133818 | }else{ |
| 133186 | | - sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy331); |
| 133819 | + sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy285); |
| 133187 | 133820 | } |
| 133188 | | - yymsp[-1].minor.yy159 = p; /*A-overwrites-W*/ |
| 133821 | + yymsp[-1].minor.yy243 = p; /*A-overwrites-W*/ |
| 133189 | 133822 | } |
| 133190 | 133823 | break; |
| 133191 | 133824 | case 81: /* selectnowith ::= selectnowith multiselect_op oneselect */ |
| 133192 | 133825 | { |
| 133193 | | - Select *pRhs = yymsp[0].minor.yy159; |
| 133194 | | - Select *pLhs = yymsp[-2].minor.yy159; |
| 133826 | + Select *pRhs = yymsp[0].minor.yy243; |
| 133827 | + Select *pLhs = yymsp[-2].minor.yy243; |
| 133195 | 133828 | if( pRhs && pRhs->pPrior ){ |
| 133196 | 133829 | SrcList *pFrom; |
| 133197 | 133830 | Token x; |
| 133198 | 133831 | x.n = 0; |
| 133199 | 133832 | parserDoubleLinkSelect(pParse, pRhs); |
| 133200 | 133833 | pFrom = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&x,pRhs,0,0); |
| 133201 | 133834 | pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0,0); |
| 133202 | 133835 | } |
| 133203 | 133836 | if( pRhs ){ |
| 133204 | | - pRhs->op = (u8)yymsp[-1].minor.yy392; |
| 133837 | + pRhs->op = (u8)yymsp[-1].minor.yy194; |
| 133205 | 133838 | pRhs->pPrior = pLhs; |
| 133206 | 133839 | if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue; |
| 133207 | 133840 | pRhs->selFlags &= ~SF_MultiValue; |
| 133208 | | - if( yymsp[-1].minor.yy392!=TK_ALL ) pParse->hasCompound = 1; |
| 133841 | + if( yymsp[-1].minor.yy194!=TK_ALL ) pParse->hasCompound = 1; |
| 133209 | 133842 | }else{ |
| 133210 | 133843 | sqlite3SelectDelete(pParse->db, pLhs); |
| 133211 | 133844 | } |
| 133212 | | - yymsp[-2].minor.yy159 = pRhs; |
| 133845 | + yymsp[-2].minor.yy243 = pRhs; |
| 133213 | 133846 | } |
| 133214 | 133847 | break; |
| 133215 | 133848 | case 82: /* multiselect_op ::= UNION */ |
| 133216 | 133849 | case 84: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==84); |
| 133217 | | -{yymsp[0].minor.yy392 = yymsp[0].major; /*A-overwrites-OP*/} |
| 133850 | +{yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-OP*/} |
| 133218 | 133851 | break; |
| 133219 | 133852 | case 83: /* multiselect_op ::= UNION ALL */ |
| 133220 | | -{yymsp[-1].minor.yy392 = TK_ALL;} |
| 133853 | +{yymsp[-1].minor.yy194 = TK_ALL;} |
| 133221 | 133854 | break; |
| 133222 | 133855 | case 85: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ |
| 133223 | 133856 | { |
| 133224 | 133857 | #if SELECTTRACE_ENABLED |
| 133225 | 133858 | Token s = yymsp[-8].minor.yy0; /*A-overwrites-S*/ |
| 133226 | 133859 | #endif |
| 133227 | | - yymsp[-8].minor.yy159 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy442,yymsp[-5].minor.yy347,yymsp[-4].minor.yy122,yymsp[-3].minor.yy442,yymsp[-2].minor.yy122,yymsp[-1].minor.yy442,yymsp[-7].minor.yy392,yymsp[0].minor.yy64.pLimit,yymsp[0].minor.yy64.pOffset); |
| 133860 | + yymsp[-8].minor.yy243 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy148,yymsp[-5].minor.yy185,yymsp[-4].minor.yy72,yymsp[-3].minor.yy148,yymsp[-2].minor.yy72,yymsp[-1].minor.yy148,yymsp[-7].minor.yy194,yymsp[0].minor.yy354.pLimit,yymsp[0].minor.yy354.pOffset); |
| 133228 | 133861 | #if SELECTTRACE_ENABLED |
| 133229 | 133862 | /* Populate the Select.zSelName[] string that is used to help with |
| 133230 | 133863 | ** query planner debugging, to differentiate between multiple Select |
| 133231 | 133864 | ** objects in a complex query. |
| 133232 | 133865 | ** |
| | @@ -133233,464 +133866,465 @@ |
| 133233 | 133866 | ** If the SELECT keyword is immediately followed by a C-style comment |
| 133234 | 133867 | ** then extract the first few alphanumeric characters from within that |
| 133235 | 133868 | ** comment to be the zSelName value. Otherwise, the label is #N where |
| 133236 | 133869 | ** is an integer that is incremented with each SELECT statement seen. |
| 133237 | 133870 | */ |
| 133238 | | - if( yymsp[-8].minor.yy159!=0 ){ |
| 133871 | + if( yymsp[-8].minor.yy243!=0 ){ |
| 133239 | 133872 | const char *z = s.z+6; |
| 133240 | 133873 | int i; |
| 133241 | | - sqlite3_snprintf(sizeof(yymsp[-8].minor.yy159->zSelName), yymsp[-8].minor.yy159->zSelName, "#%d", |
| 133874 | + sqlite3_snprintf(sizeof(yymsp[-8].minor.yy243->zSelName), yymsp[-8].minor.yy243->zSelName, "#%d", |
| 133242 | 133875 | ++pParse->nSelect); |
| 133243 | 133876 | while( z[0]==' ' ) z++; |
| 133244 | 133877 | if( z[0]=='/' && z[1]=='*' ){ |
| 133245 | 133878 | z += 2; |
| 133246 | 133879 | while( z[0]==' ' ) z++; |
| 133247 | 133880 | for(i=0; sqlite3Isalnum(z[i]); i++){} |
| 133248 | | - sqlite3_snprintf(sizeof(yymsp[-8].minor.yy159->zSelName), yymsp[-8].minor.yy159->zSelName, "%.*s", i, z); |
| 133881 | + sqlite3_snprintf(sizeof(yymsp[-8].minor.yy243->zSelName), yymsp[-8].minor.yy243->zSelName, "%.*s", i, z); |
| 133249 | 133882 | } |
| 133250 | 133883 | } |
| 133251 | 133884 | #endif /* SELECTRACE_ENABLED */ |
| 133252 | 133885 | } |
| 133253 | 133886 | break; |
| 133254 | 133887 | case 86: /* values ::= VALUES LP nexprlist RP */ |
| 133255 | 133888 | { |
| 133256 | | - yymsp[-3].minor.yy159 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy442,0,0,0,0,0,SF_Values,0,0); |
| 133889 | + yymsp[-3].minor.yy243 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy148,0,0,0,0,0,SF_Values,0,0); |
| 133257 | 133890 | } |
| 133258 | 133891 | break; |
| 133259 | 133892 | case 87: /* values ::= values COMMA LP exprlist RP */ |
| 133260 | 133893 | { |
| 133261 | | - Select *pRight, *pLeft = yymsp[-4].minor.yy159; |
| 133262 | | - pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy442,0,0,0,0,0,SF_Values|SF_MultiValue,0,0); |
| 133894 | + Select *pRight, *pLeft = yymsp[-4].minor.yy243; |
| 133895 | + pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy148,0,0,0,0,0,SF_Values|SF_MultiValue,0,0); |
| 133263 | 133896 | if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue; |
| 133264 | 133897 | if( pRight ){ |
| 133265 | 133898 | pRight->op = TK_ALL; |
| 133266 | 133899 | pRight->pPrior = pLeft; |
| 133267 | | - yymsp[-4].minor.yy159 = pRight; |
| 133900 | + yymsp[-4].minor.yy243 = pRight; |
| 133268 | 133901 | }else{ |
| 133269 | | - yymsp[-4].minor.yy159 = pLeft; |
| 133902 | + yymsp[-4].minor.yy243 = pLeft; |
| 133270 | 133903 | } |
| 133271 | 133904 | } |
| 133272 | 133905 | break; |
| 133273 | 133906 | case 88: /* distinct ::= DISTINCT */ |
| 133274 | | -{yymsp[0].minor.yy392 = SF_Distinct;} |
| 133907 | +{yymsp[0].minor.yy194 = SF_Distinct;} |
| 133275 | 133908 | break; |
| 133276 | 133909 | case 89: /* distinct ::= ALL */ |
| 133277 | | -{yymsp[0].minor.yy392 = SF_All;} |
| 133910 | +{yymsp[0].minor.yy194 = SF_All;} |
| 133278 | 133911 | break; |
| 133279 | 133912 | case 91: /* sclp ::= */ |
| 133280 | 133913 | case 119: /* orderby_opt ::= */ yytestcase(yyruleno==119); |
| 133281 | 133914 | case 126: /* groupby_opt ::= */ yytestcase(yyruleno==126); |
| 133282 | 133915 | case 199: /* exprlist ::= */ yytestcase(yyruleno==199); |
| 133283 | | - case 205: /* eidlist_opt ::= */ yytestcase(yyruleno==205); |
| 133284 | | -{yymsp[1].minor.yy442 = 0;} |
| 133916 | + case 202: /* paren_exprlist ::= */ yytestcase(yyruleno==202); |
| 133917 | + case 207: /* eidlist_opt ::= */ yytestcase(yyruleno==207); |
| 133918 | +{yymsp[1].minor.yy148 = 0;} |
| 133285 | 133919 | break; |
| 133286 | 133920 | case 92: /* selcollist ::= sclp expr as */ |
| 133287 | 133921 | { |
| 133288 | | - yymsp[-2].minor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy442, yymsp[-1].minor.yy342.pExpr); |
| 133289 | | - if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-2].minor.yy442, &yymsp[0].minor.yy0, 1); |
| 133290 | | - sqlite3ExprListSetSpan(pParse,yymsp[-2].minor.yy442,&yymsp[-1].minor.yy342); |
| 133922 | + yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy148, yymsp[-1].minor.yy190.pExpr); |
| 133923 | + if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-2].minor.yy148, &yymsp[0].minor.yy0, 1); |
| 133924 | + sqlite3ExprListSetSpan(pParse,yymsp[-2].minor.yy148,&yymsp[-1].minor.yy190); |
| 133291 | 133925 | } |
| 133292 | 133926 | break; |
| 133293 | 133927 | case 93: /* selcollist ::= sclp STAR */ |
| 133294 | 133928 | { |
| 133295 | 133929 | Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0); |
| 133296 | | - yymsp[-1].minor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy442, p); |
| 133930 | + yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy148, p); |
| 133297 | 133931 | } |
| 133298 | 133932 | break; |
| 133299 | 133933 | case 94: /* selcollist ::= sclp nm DOT STAR */ |
| 133300 | 133934 | { |
| 133301 | 133935 | Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0, &yymsp[0].minor.yy0); |
| 133302 | 133936 | Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); |
| 133303 | 133937 | Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0); |
| 133304 | | - yymsp[-3].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442, pDot); |
| 133938 | + yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, pDot); |
| 133305 | 133939 | } |
| 133306 | 133940 | break; |
| 133307 | 133941 | case 95: /* as ::= AS nm */ |
| 133308 | 133942 | case 106: /* dbnm ::= DOT nm */ yytestcase(yyruleno==106); |
| 133309 | | - case 219: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==219); |
| 133310 | | - case 220: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==220); |
| 133943 | + case 221: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==221); |
| 133944 | + case 222: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==222); |
| 133311 | 133945 | {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} |
| 133312 | 133946 | break; |
| 133313 | 133947 | case 97: /* from ::= */ |
| 133314 | | -{yymsp[1].minor.yy347 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy347));} |
| 133948 | +{yymsp[1].minor.yy185 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy185));} |
| 133315 | 133949 | break; |
| 133316 | 133950 | case 98: /* from ::= FROM seltablist */ |
| 133317 | 133951 | { |
| 133318 | | - yymsp[-1].minor.yy347 = yymsp[0].minor.yy347; |
| 133319 | | - sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy347); |
| 133952 | + yymsp[-1].minor.yy185 = yymsp[0].minor.yy185; |
| 133953 | + sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy185); |
| 133320 | 133954 | } |
| 133321 | 133955 | break; |
| 133322 | 133956 | case 99: /* stl_prefix ::= seltablist joinop */ |
| 133323 | 133957 | { |
| 133324 | | - if( ALWAYS(yymsp[-1].minor.yy347 && yymsp[-1].minor.yy347->nSrc>0) ) yymsp[-1].minor.yy347->a[yymsp[-1].minor.yy347->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy392; |
| 133958 | + if( ALWAYS(yymsp[-1].minor.yy185 && yymsp[-1].minor.yy185->nSrc>0) ) yymsp[-1].minor.yy185->a[yymsp[-1].minor.yy185->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy194; |
| 133325 | 133959 | } |
| 133326 | 133960 | break; |
| 133327 | 133961 | case 100: /* stl_prefix ::= */ |
| 133328 | | -{yymsp[1].minor.yy347 = 0;} |
| 133962 | +{yymsp[1].minor.yy185 = 0;} |
| 133329 | 133963 | break; |
| 133330 | 133964 | case 101: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ |
| 133331 | 133965 | { |
| 133332 | | - yymsp[-6].minor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy122,yymsp[0].minor.yy180); |
| 133333 | | - sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy347, &yymsp[-2].minor.yy0); |
| 133966 | + yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254); |
| 133967 | + sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy185, &yymsp[-2].minor.yy0); |
| 133334 | 133968 | } |
| 133335 | 133969 | break; |
| 133336 | 133970 | case 102: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ |
| 133337 | 133971 | { |
| 133338 | | - yymsp[-8].minor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy347,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy122,yymsp[0].minor.yy180); |
| 133339 | | - sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy347, yymsp[-4].minor.yy442); |
| 133972 | + yymsp[-8].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy185,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254); |
| 133973 | + sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy185, yymsp[-4].minor.yy148); |
| 133340 | 133974 | } |
| 133341 | 133975 | break; |
| 133342 | 133976 | case 103: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ |
| 133343 | 133977 | { |
| 133344 | | - yymsp[-6].minor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy159,yymsp[-1].minor.yy122,yymsp[0].minor.yy180); |
| 133978 | + yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy243,yymsp[-1].minor.yy72,yymsp[0].minor.yy254); |
| 133345 | 133979 | } |
| 133346 | 133980 | break; |
| 133347 | 133981 | case 104: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ |
| 133348 | 133982 | { |
| 133349 | | - if( yymsp[-6].minor.yy347==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy122==0 && yymsp[0].minor.yy180==0 ){ |
| 133350 | | - yymsp[-6].minor.yy347 = yymsp[-4].minor.yy347; |
| 133351 | | - }else if( yymsp[-4].minor.yy347->nSrc==1 ){ |
| 133352 | | - yymsp[-6].minor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy122,yymsp[0].minor.yy180); |
| 133353 | | - if( yymsp[-6].minor.yy347 ){ |
| 133354 | | - struct SrcList_item *pNew = &yymsp[-6].minor.yy347->a[yymsp[-6].minor.yy347->nSrc-1]; |
| 133355 | | - struct SrcList_item *pOld = yymsp[-4].minor.yy347->a; |
| 133983 | + if( yymsp[-6].minor.yy185==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy72==0 && yymsp[0].minor.yy254==0 ){ |
| 133984 | + yymsp[-6].minor.yy185 = yymsp[-4].minor.yy185; |
| 133985 | + }else if( yymsp[-4].minor.yy185->nSrc==1 ){ |
| 133986 | + yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254); |
| 133987 | + if( yymsp[-6].minor.yy185 ){ |
| 133988 | + struct SrcList_item *pNew = &yymsp[-6].minor.yy185->a[yymsp[-6].minor.yy185->nSrc-1]; |
| 133989 | + struct SrcList_item *pOld = yymsp[-4].minor.yy185->a; |
| 133356 | 133990 | pNew->zName = pOld->zName; |
| 133357 | 133991 | pNew->zDatabase = pOld->zDatabase; |
| 133358 | 133992 | pNew->pSelect = pOld->pSelect; |
| 133359 | 133993 | pOld->zName = pOld->zDatabase = 0; |
| 133360 | 133994 | pOld->pSelect = 0; |
| 133361 | 133995 | } |
| 133362 | | - sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy347); |
| 133996 | + sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy185); |
| 133363 | 133997 | }else{ |
| 133364 | 133998 | Select *pSubquery; |
| 133365 | | - sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy347); |
| 133366 | | - pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy347,0,0,0,0,SF_NestedFrom,0,0); |
| 133367 | | - yymsp[-6].minor.yy347 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy347,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy122,yymsp[0].minor.yy180); |
| 133999 | + sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy185); |
| 134000 | + pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy185,0,0,0,0,SF_NestedFrom,0,0); |
| 134001 | + yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy72,yymsp[0].minor.yy254); |
| 133368 | 134002 | } |
| 133369 | 134003 | } |
| 133370 | 134004 | break; |
| 133371 | 134005 | case 105: /* dbnm ::= */ |
| 133372 | 134006 | case 114: /* indexed_opt ::= */ yytestcase(yyruleno==114); |
| 133373 | 134007 | {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;} |
| 133374 | 134008 | break; |
| 133375 | 134009 | case 107: /* fullname ::= nm dbnm */ |
| 133376 | | -{yymsp[-1].minor.yy347 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 134010 | +{yymsp[-1].minor.yy185 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 133377 | 134011 | break; |
| 133378 | 134012 | case 108: /* joinop ::= COMMA|JOIN */ |
| 133379 | | -{ yymsp[0].minor.yy392 = JT_INNER; } |
| 134013 | +{ yymsp[0].minor.yy194 = JT_INNER; } |
| 133380 | 134014 | break; |
| 133381 | 134015 | case 109: /* joinop ::= JOIN_KW JOIN */ |
| 133382 | | -{yymsp[-1].minor.yy392 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} |
| 134016 | +{yymsp[-1].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} |
| 133383 | 134017 | break; |
| 133384 | 134018 | case 110: /* joinop ::= JOIN_KW nm JOIN */ |
| 133385 | | -{yymsp[-2].minor.yy392 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} |
| 134019 | +{yymsp[-2].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} |
| 133386 | 134020 | break; |
| 133387 | 134021 | case 111: /* joinop ::= JOIN_KW nm nm JOIN */ |
| 133388 | | -{yymsp[-3].minor.yy392 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} |
| 134022 | +{yymsp[-3].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} |
| 133389 | 134023 | break; |
| 133390 | 134024 | case 112: /* on_opt ::= ON expr */ |
| 133391 | 134025 | case 129: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==129); |
| 133392 | 134026 | case 136: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==136); |
| 133393 | 134027 | case 195: /* case_else ::= ELSE expr */ yytestcase(yyruleno==195); |
| 133394 | | -{yymsp[-1].minor.yy122 = yymsp[0].minor.yy342.pExpr;} |
| 134028 | +{yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr;} |
| 133395 | 134029 | break; |
| 133396 | 134030 | case 113: /* on_opt ::= */ |
| 133397 | 134031 | case 128: /* having_opt ::= */ yytestcase(yyruleno==128); |
| 133398 | 134032 | case 135: /* where_opt ::= */ yytestcase(yyruleno==135); |
| 133399 | 134033 | case 196: /* case_else ::= */ yytestcase(yyruleno==196); |
| 133400 | 134034 | case 198: /* case_operand ::= */ yytestcase(yyruleno==198); |
| 133401 | | -{yymsp[1].minor.yy122 = 0;} |
| 134035 | +{yymsp[1].minor.yy72 = 0;} |
| 133402 | 134036 | break; |
| 133403 | 134037 | case 115: /* indexed_opt ::= INDEXED BY nm */ |
| 133404 | 134038 | {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;} |
| 133405 | 134039 | break; |
| 133406 | 134040 | case 116: /* indexed_opt ::= NOT INDEXED */ |
| 133407 | 134041 | {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;} |
| 133408 | 134042 | break; |
| 133409 | 134043 | case 117: /* using_opt ::= USING LP idlist RP */ |
| 133410 | | -{yymsp[-3].minor.yy180 = yymsp[-1].minor.yy180;} |
| 134044 | +{yymsp[-3].minor.yy254 = yymsp[-1].minor.yy254;} |
| 133411 | 134045 | break; |
| 133412 | 134046 | case 118: /* using_opt ::= */ |
| 133413 | 134047 | case 144: /* idlist_opt ::= */ yytestcase(yyruleno==144); |
| 133414 | | -{yymsp[1].minor.yy180 = 0;} |
| 134048 | +{yymsp[1].minor.yy254 = 0;} |
| 133415 | 134049 | break; |
| 133416 | 134050 | case 120: /* orderby_opt ::= ORDER BY sortlist */ |
| 133417 | 134051 | case 127: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==127); |
| 133418 | | -{yymsp[-2].minor.yy442 = yymsp[0].minor.yy442;} |
| 134052 | +{yymsp[-2].minor.yy148 = yymsp[0].minor.yy148;} |
| 133419 | 134053 | break; |
| 133420 | 134054 | case 121: /* sortlist ::= sortlist COMMA expr sortorder */ |
| 133421 | 134055 | { |
| 133422 | | - yymsp[-3].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442,yymsp[-1].minor.yy342.pExpr); |
| 133423 | | - sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy442,yymsp[0].minor.yy392); |
| 134056 | + yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148,yymsp[-1].minor.yy190.pExpr); |
| 134057 | + sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy148,yymsp[0].minor.yy194); |
| 133424 | 134058 | } |
| 133425 | 134059 | break; |
| 133426 | 134060 | case 122: /* sortlist ::= expr sortorder */ |
| 133427 | 134061 | { |
| 133428 | | - yymsp[-1].minor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy342.pExpr); /*A-overwrites-Y*/ |
| 133429 | | - sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy442,yymsp[0].minor.yy392); |
| 134062 | + yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy190.pExpr); /*A-overwrites-Y*/ |
| 134063 | + sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy148,yymsp[0].minor.yy194); |
| 133430 | 134064 | } |
| 133431 | 134065 | break; |
| 133432 | 134066 | case 123: /* sortorder ::= ASC */ |
| 133433 | | -{yymsp[0].minor.yy392 = SQLITE_SO_ASC;} |
| 134067 | +{yymsp[0].minor.yy194 = SQLITE_SO_ASC;} |
| 133434 | 134068 | break; |
| 133435 | 134069 | case 124: /* sortorder ::= DESC */ |
| 133436 | | -{yymsp[0].minor.yy392 = SQLITE_SO_DESC;} |
| 134070 | +{yymsp[0].minor.yy194 = SQLITE_SO_DESC;} |
| 133437 | 134071 | break; |
| 133438 | 134072 | case 125: /* sortorder ::= */ |
| 133439 | | -{yymsp[1].minor.yy392 = SQLITE_SO_UNDEFINED;} |
| 134073 | +{yymsp[1].minor.yy194 = SQLITE_SO_UNDEFINED;} |
| 133440 | 134074 | break; |
| 133441 | 134075 | case 130: /* limit_opt ::= */ |
| 133442 | | -{yymsp[1].minor.yy64.pLimit = 0; yymsp[1].minor.yy64.pOffset = 0;} |
| 134076 | +{yymsp[1].minor.yy354.pLimit = 0; yymsp[1].minor.yy354.pOffset = 0;} |
| 133443 | 134077 | break; |
| 133444 | 134078 | case 131: /* limit_opt ::= LIMIT expr */ |
| 133445 | | -{yymsp[-1].minor.yy64.pLimit = yymsp[0].minor.yy342.pExpr; yymsp[-1].minor.yy64.pOffset = 0;} |
| 134079 | +{yymsp[-1].minor.yy354.pLimit = yymsp[0].minor.yy190.pExpr; yymsp[-1].minor.yy354.pOffset = 0;} |
| 133446 | 134080 | break; |
| 133447 | 134081 | case 132: /* limit_opt ::= LIMIT expr OFFSET expr */ |
| 133448 | | -{yymsp[-3].minor.yy64.pLimit = yymsp[-2].minor.yy342.pExpr; yymsp[-3].minor.yy64.pOffset = yymsp[0].minor.yy342.pExpr;} |
| 134082 | +{yymsp[-3].minor.yy354.pLimit = yymsp[-2].minor.yy190.pExpr; yymsp[-3].minor.yy354.pOffset = yymsp[0].minor.yy190.pExpr;} |
| 133449 | 134083 | break; |
| 133450 | 134084 | case 133: /* limit_opt ::= LIMIT expr COMMA expr */ |
| 133451 | | -{yymsp[-3].minor.yy64.pOffset = yymsp[-2].minor.yy342.pExpr; yymsp[-3].minor.yy64.pLimit = yymsp[0].minor.yy342.pExpr;} |
| 134085 | +{yymsp[-3].minor.yy354.pOffset = yymsp[-2].minor.yy190.pExpr; yymsp[-3].minor.yy354.pLimit = yymsp[0].minor.yy190.pExpr;} |
| 133452 | 134086 | break; |
| 133453 | 134087 | case 134: /* cmd ::= with DELETE FROM fullname indexed_opt where_opt */ |
| 133454 | 134088 | { |
| 133455 | | - sqlite3WithPush(pParse, yymsp[-5].minor.yy331, 1); |
| 133456 | | - sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy347, &yymsp[-1].minor.yy0); |
| 133457 | | - sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy347,yymsp[0].minor.yy122); |
| 134089 | + sqlite3WithPush(pParse, yymsp[-5].minor.yy285, 1); |
| 134090 | + sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy185, &yymsp[-1].minor.yy0); |
| 134091 | + sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy185,yymsp[0].minor.yy72); |
| 133458 | 134092 | } |
| 133459 | 134093 | break; |
| 133460 | 134094 | case 137: /* cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */ |
| 133461 | 134095 | { |
| 133462 | | - sqlite3WithPush(pParse, yymsp[-7].minor.yy331, 1); |
| 133463 | | - sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy347, &yymsp[-3].minor.yy0); |
| 133464 | | - sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy442,"set list"); |
| 133465 | | - sqlite3Update(pParse,yymsp[-4].minor.yy347,yymsp[-1].minor.yy442,yymsp[0].minor.yy122,yymsp[-5].minor.yy392); |
| 134096 | + sqlite3WithPush(pParse, yymsp[-7].minor.yy285, 1); |
| 134097 | + sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy185, &yymsp[-3].minor.yy0); |
| 134098 | + sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy148,"set list"); |
| 134099 | + sqlite3Update(pParse,yymsp[-4].minor.yy185,yymsp[-1].minor.yy148,yymsp[0].minor.yy72,yymsp[-5].minor.yy194); |
| 133466 | 134100 | } |
| 133467 | 134101 | break; |
| 133468 | 134102 | case 138: /* setlist ::= setlist COMMA nm EQ expr */ |
| 133469 | 134103 | { |
| 133470 | | - yymsp[-4].minor.yy442 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy442, yymsp[0].minor.yy342.pExpr); |
| 133471 | | - sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy442, &yymsp[-2].minor.yy0, 1); |
| 134104 | + yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr); |
| 134105 | + sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, 1); |
| 133472 | 134106 | } |
| 133473 | 134107 | break; |
| 133474 | 134108 | case 139: /* setlist ::= nm EQ expr */ |
| 133475 | 134109 | { |
| 133476 | | - yylhsminor.yy442 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy342.pExpr); |
| 133477 | | - sqlite3ExprListSetName(pParse, yylhsminor.yy442, &yymsp[-2].minor.yy0, 1); |
| 134110 | + yylhsminor.yy148 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy190.pExpr); |
| 134111 | + sqlite3ExprListSetName(pParse, yylhsminor.yy148, &yymsp[-2].minor.yy0, 1); |
| 133478 | 134112 | } |
| 133479 | | - yymsp[-2].minor.yy442 = yylhsminor.yy442; |
| 134113 | + yymsp[-2].minor.yy148 = yylhsminor.yy148; |
| 133480 | 134114 | break; |
| 133481 | 134115 | case 140: /* cmd ::= with insert_cmd INTO fullname idlist_opt select */ |
| 133482 | 134116 | { |
| 133483 | | - sqlite3WithPush(pParse, yymsp[-5].minor.yy331, 1); |
| 133484 | | - sqlite3Insert(pParse, yymsp[-2].minor.yy347, yymsp[0].minor.yy159, yymsp[-1].minor.yy180, yymsp[-4].minor.yy392); |
| 134117 | + sqlite3WithPush(pParse, yymsp[-5].minor.yy285, 1); |
| 134118 | + sqlite3Insert(pParse, yymsp[-2].minor.yy185, yymsp[0].minor.yy243, yymsp[-1].minor.yy254, yymsp[-4].minor.yy194); |
| 133485 | 134119 | } |
| 133486 | 134120 | break; |
| 133487 | 134121 | case 141: /* cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */ |
| 133488 | 134122 | { |
| 133489 | | - sqlite3WithPush(pParse, yymsp[-6].minor.yy331, 1); |
| 133490 | | - sqlite3Insert(pParse, yymsp[-3].minor.yy347, 0, yymsp[-2].minor.yy180, yymsp[-5].minor.yy392); |
| 134123 | + sqlite3WithPush(pParse, yymsp[-6].minor.yy285, 1); |
| 134124 | + sqlite3Insert(pParse, yymsp[-3].minor.yy185, 0, yymsp[-2].minor.yy254, yymsp[-5].minor.yy194); |
| 133491 | 134125 | } |
| 133492 | 134126 | break; |
| 133493 | 134127 | case 145: /* idlist_opt ::= LP idlist RP */ |
| 133494 | | -{yymsp[-2].minor.yy180 = yymsp[-1].minor.yy180;} |
| 134128 | +{yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;} |
| 133495 | 134129 | break; |
| 133496 | 134130 | case 146: /* idlist ::= idlist COMMA nm */ |
| 133497 | | -{yymsp[-2].minor.yy180 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy180,&yymsp[0].minor.yy0);} |
| 134131 | +{yymsp[-2].minor.yy254 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);} |
| 133498 | 134132 | break; |
| 133499 | 134133 | case 147: /* idlist ::= nm */ |
| 133500 | | -{yymsp[0].minor.yy180 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} |
| 134134 | +{yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} |
| 133501 | 134135 | break; |
| 133502 | 134136 | case 148: /* expr ::= LP expr RP */ |
| 133503 | | -{spanSet(&yymsp[-2].minor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ yymsp[-2].minor.yy342.pExpr = yymsp[-1].minor.yy342.pExpr;} |
| 134137 | +{spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ yymsp[-2].minor.yy190.pExpr = yymsp[-1].minor.yy190.pExpr;} |
| 133504 | 134138 | break; |
| 133505 | 134139 | case 149: /* term ::= NULL */ |
| 133506 | 134140 | case 154: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==154); |
| 133507 | 134141 | case 155: /* term ::= STRING */ yytestcase(yyruleno==155); |
| 133508 | | -{spanExpr(&yymsp[0].minor.yy342,pParse,yymsp[0].major,yymsp[0].minor.yy0);/*A-overwrites-X*/} |
| 134142 | +{spanExpr(&yymsp[0].minor.yy190,pParse,yymsp[0].major,yymsp[0].minor.yy0);/*A-overwrites-X*/} |
| 133509 | 134143 | break; |
| 133510 | 134144 | case 150: /* expr ::= ID|INDEXED */ |
| 133511 | 134145 | case 151: /* expr ::= JOIN_KW */ yytestcase(yyruleno==151); |
| 133512 | | -{spanExpr(&yymsp[0].minor.yy342,pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 134146 | +{spanExpr(&yymsp[0].minor.yy190,pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 133513 | 134147 | break; |
| 133514 | 134148 | case 152: /* expr ::= nm DOT nm */ |
| 133515 | 134149 | { |
| 133516 | 134150 | Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); |
| 133517 | 134151 | Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0); |
| 133518 | | - spanSet(&yymsp[-2].minor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 133519 | | - yymsp[-2].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0); |
| 134152 | + spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 134153 | + yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0); |
| 133520 | 134154 | } |
| 133521 | 134155 | break; |
| 133522 | 134156 | case 153: /* expr ::= nm DOT nm DOT nm */ |
| 133523 | 134157 | { |
| 133524 | 134158 | Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy0); |
| 133525 | 134159 | Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); |
| 133526 | 134160 | Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0); |
| 133527 | 134161 | Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0); |
| 133528 | | - spanSet(&yymsp[-4].minor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 133529 | | - yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0); |
| 134162 | + spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 134163 | + yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0); |
| 133530 | 134164 | } |
| 133531 | 134165 | break; |
| 133532 | 134166 | case 156: /* expr ::= VARIABLE */ |
| 133533 | 134167 | { |
| 133534 | 134168 | if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){ |
| 133535 | | - spanExpr(&yymsp[0].minor.yy342, pParse, TK_VARIABLE, yymsp[0].minor.yy0); |
| 133536 | | - sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy342.pExpr); |
| 134169 | + spanExpr(&yymsp[0].minor.yy190, pParse, TK_VARIABLE, yymsp[0].minor.yy0); |
| 134170 | + sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy190.pExpr); |
| 133537 | 134171 | }else{ |
| 133538 | 134172 | /* When doing a nested parse, one can include terms in an expression |
| 133539 | 134173 | ** that look like this: #1 #2 ... These terms refer to registers |
| 133540 | 134174 | ** in the virtual machine. #N is the N-th register. */ |
| 133541 | 134175 | Token t = yymsp[0].minor.yy0; /*A-overwrites-X*/ |
| 133542 | 134176 | assert( t.n>=2 ); |
| 133543 | | - spanSet(&yymsp[0].minor.yy342, &t, &t); |
| 134177 | + spanSet(&yymsp[0].minor.yy190, &t, &t); |
| 133544 | 134178 | if( pParse->nested==0 ){ |
| 133545 | 134179 | sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t); |
| 133546 | | - yymsp[0].minor.yy342.pExpr = 0; |
| 134180 | + yymsp[0].minor.yy190.pExpr = 0; |
| 133547 | 134181 | }else{ |
| 133548 | | - yymsp[0].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &t); |
| 133549 | | - if( yymsp[0].minor.yy342.pExpr ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy342.pExpr->iTable); |
| 134182 | + yymsp[0].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &t); |
| 134183 | + if( yymsp[0].minor.yy190.pExpr ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy190.pExpr->iTable); |
| 133550 | 134184 | } |
| 133551 | 134185 | } |
| 133552 | 134186 | } |
| 133553 | 134187 | break; |
| 133554 | 134188 | case 157: /* expr ::= expr COLLATE ID|STRING */ |
| 133555 | 134189 | { |
| 133556 | | - yymsp[-2].minor.yy342.pExpr = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy342.pExpr, &yymsp[0].minor.yy0, 1); |
| 133557 | | - yymsp[-2].minor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; |
| 134190 | + yymsp[-2].minor.yy190.pExpr = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy190.pExpr, &yymsp[0].minor.yy0, 1); |
| 134191 | + yymsp[-2].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; |
| 133558 | 134192 | } |
| 133559 | 134193 | break; |
| 133560 | 134194 | case 158: /* expr ::= CAST LP expr AS typetoken RP */ |
| 133561 | 134195 | { |
| 133562 | | - spanSet(&yymsp[-5].minor.yy342,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 133563 | | - yymsp[-5].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy342.pExpr, 0, &yymsp[-1].minor.yy0); |
| 134196 | + spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 134197 | + yymsp[-5].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy190.pExpr, 0, &yymsp[-1].minor.yy0); |
| 133564 | 134198 | } |
| 133565 | 134199 | break; |
| 133566 | 134200 | case 159: /* expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 133567 | 134201 | { |
| 133568 | | - if( yymsp[-1].minor.yy442 && yymsp[-1].minor.yy442->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){ |
| 134202 | + if( yymsp[-1].minor.yy148 && yymsp[-1].minor.yy148->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){ |
| 133569 | 134203 | sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0); |
| 133570 | 134204 | } |
| 133571 | | - yylhsminor.yy342.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy442, &yymsp[-4].minor.yy0); |
| 133572 | | - spanSet(&yylhsminor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); |
| 133573 | | - if( yymsp[-2].minor.yy392==SF_Distinct && yylhsminor.yy342.pExpr ){ |
| 133574 | | - yylhsminor.yy342.pExpr->flags |= EP_Distinct; |
| 134205 | + yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy148, &yymsp[-4].minor.yy0); |
| 134206 | + spanSet(&yylhsminor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); |
| 134207 | + if( yymsp[-2].minor.yy194==SF_Distinct && yylhsminor.yy190.pExpr ){ |
| 134208 | + yylhsminor.yy190.pExpr->flags |= EP_Distinct; |
| 133575 | 134209 | } |
| 133576 | 134210 | } |
| 133577 | | - yymsp[-4].minor.yy342 = yylhsminor.yy342; |
| 134211 | + yymsp[-4].minor.yy190 = yylhsminor.yy190; |
| 133578 | 134212 | break; |
| 133579 | 134213 | case 160: /* expr ::= ID|INDEXED LP STAR RP */ |
| 133580 | 134214 | { |
| 133581 | | - yylhsminor.yy342.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0); |
| 133582 | | - spanSet(&yylhsminor.yy342,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); |
| 134215 | + yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0); |
| 134216 | + spanSet(&yylhsminor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); |
| 133583 | 134217 | } |
| 133584 | | - yymsp[-3].minor.yy342 = yylhsminor.yy342; |
| 134218 | + yymsp[-3].minor.yy190 = yylhsminor.yy190; |
| 133585 | 134219 | break; |
| 133586 | 134220 | case 161: /* term ::= CTIME_KW */ |
| 133587 | 134221 | { |
| 133588 | | - yylhsminor.yy342.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0); |
| 133589 | | - spanSet(&yylhsminor.yy342, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0); |
| 134222 | + yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0); |
| 134223 | + spanSet(&yylhsminor.yy190, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0); |
| 133590 | 134224 | } |
| 133591 | | - yymsp[0].minor.yy342 = yylhsminor.yy342; |
| 134225 | + yymsp[0].minor.yy190 = yylhsminor.yy190; |
| 133592 | 134226 | break; |
| 133593 | 134227 | case 162: /* expr ::= expr AND expr */ |
| 133594 | 134228 | case 163: /* expr ::= expr OR expr */ yytestcase(yyruleno==163); |
| 133595 | 134229 | case 164: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==164); |
| 133596 | 134230 | case 165: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==165); |
| 133597 | 134231 | case 166: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==166); |
| 133598 | 134232 | case 167: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==167); |
| 133599 | 134233 | case 168: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==168); |
| 133600 | 134234 | case 169: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==169); |
| 133601 | | -{spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy342);} |
| 134235 | +{spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);} |
| 133602 | 134236 | break; |
| 133603 | 134237 | case 170: /* likeop ::= LIKE_KW|MATCH */ |
| 133604 | | -{yymsp[0].minor.yy318.eOperator = yymsp[0].minor.yy0; yymsp[0].minor.yy318.bNot = 0;/*A-overwrites-X*/} |
| 134238 | +{yymsp[0].minor.yy392.eOperator = yymsp[0].minor.yy0; yymsp[0].minor.yy392.bNot = 0;/*A-overwrites-X*/} |
| 133605 | 134239 | break; |
| 133606 | 134240 | case 171: /* likeop ::= NOT LIKE_KW|MATCH */ |
| 133607 | | -{yymsp[-1].minor.yy318.eOperator = yymsp[0].minor.yy0; yymsp[-1].minor.yy318.bNot = 1;} |
| 134241 | +{yymsp[-1].minor.yy392.eOperator = yymsp[0].minor.yy0; yymsp[-1].minor.yy392.bNot = 1;} |
| 133608 | 134242 | break; |
| 133609 | 134243 | case 172: /* expr ::= expr likeop expr */ |
| 133610 | 134244 | { |
| 133611 | 134245 | ExprList *pList; |
| 133612 | | - pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy342.pExpr); |
| 133613 | | - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy342.pExpr); |
| 133614 | | - yymsp[-2].minor.yy342.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy318.eOperator); |
| 133615 | | - exprNot(pParse, yymsp[-1].minor.yy318.bNot, &yymsp[-2].minor.yy342); |
| 133616 | | - yymsp[-2].minor.yy342.zEnd = yymsp[0].minor.yy342.zEnd; |
| 133617 | | - if( yymsp[-2].minor.yy342.pExpr ) yymsp[-2].minor.yy342.pExpr->flags |= EP_InfixFunc; |
| 134246 | + pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy190.pExpr); |
| 134247 | + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy190.pExpr); |
| 134248 | + yymsp[-2].minor.yy190.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy392.eOperator); |
| 134249 | + exprNot(pParse, yymsp[-1].minor.yy392.bNot, &yymsp[-2].minor.yy190); |
| 134250 | + yymsp[-2].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd; |
| 134251 | + if( yymsp[-2].minor.yy190.pExpr ) yymsp[-2].minor.yy190.pExpr->flags |= EP_InfixFunc; |
| 133618 | 134252 | } |
| 133619 | 134253 | break; |
| 133620 | 134254 | case 173: /* expr ::= expr likeop expr ESCAPE expr */ |
| 133621 | 134255 | { |
| 133622 | 134256 | ExprList *pList; |
| 133623 | | - pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr); |
| 133624 | | - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy342.pExpr); |
| 133625 | | - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy342.pExpr); |
| 133626 | | - yymsp[-4].minor.yy342.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy318.eOperator); |
| 133627 | | - exprNot(pParse, yymsp[-3].minor.yy318.bNot, &yymsp[-4].minor.yy342); |
| 133628 | | - yymsp[-4].minor.yy342.zEnd = yymsp[0].minor.yy342.zEnd; |
| 133629 | | - if( yymsp[-4].minor.yy342.pExpr ) yymsp[-4].minor.yy342.pExpr->flags |= EP_InfixFunc; |
| 134257 | + pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr); |
| 134258 | + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy190.pExpr); |
| 134259 | + pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr); |
| 134260 | + yymsp[-4].minor.yy190.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy392.eOperator); |
| 134261 | + exprNot(pParse, yymsp[-3].minor.yy392.bNot, &yymsp[-4].minor.yy190); |
| 134262 | + yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd; |
| 134263 | + if( yymsp[-4].minor.yy190.pExpr ) yymsp[-4].minor.yy190.pExpr->flags |= EP_InfixFunc; |
| 133630 | 134264 | } |
| 133631 | 134265 | break; |
| 133632 | 134266 | case 174: /* expr ::= expr ISNULL|NOTNULL */ |
| 133633 | | -{spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy342,&yymsp[0].minor.yy0);} |
| 134267 | +{spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy190,&yymsp[0].minor.yy0);} |
| 133634 | 134268 | break; |
| 133635 | 134269 | case 175: /* expr ::= expr NOT NULL */ |
| 133636 | | -{spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy0);} |
| 134270 | +{spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy0);} |
| 133637 | 134271 | break; |
| 133638 | 134272 | case 176: /* expr ::= expr IS expr */ |
| 133639 | 134273 | { |
| 133640 | | - spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy342,&yymsp[0].minor.yy342); |
| 133641 | | - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy342.pExpr, yymsp[-2].minor.yy342.pExpr, TK_ISNULL); |
| 134274 | + spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190); |
| 134275 | + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-2].minor.yy190.pExpr, TK_ISNULL); |
| 133642 | 134276 | } |
| 133643 | 134277 | break; |
| 133644 | 134278 | case 177: /* expr ::= expr IS NOT expr */ |
| 133645 | 134279 | { |
| 133646 | | - spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy342,&yymsp[0].minor.yy342); |
| 133647 | | - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy342.pExpr, yymsp[-3].minor.yy342.pExpr, TK_NOTNULL); |
| 134280 | + spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy190,&yymsp[0].minor.yy190); |
| 134281 | + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, TK_NOTNULL); |
| 133648 | 134282 | } |
| 133649 | 134283 | break; |
| 133650 | 134284 | case 178: /* expr ::= NOT expr */ |
| 133651 | 134285 | case 179: /* expr ::= BITNOT expr */ yytestcase(yyruleno==179); |
| 133652 | | -{spanUnaryPrefix(&yymsp[-1].minor.yy342,pParse,yymsp[-1].major,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} |
| 134286 | +{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,yymsp[-1].major,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} |
| 133653 | 134287 | break; |
| 133654 | 134288 | case 180: /* expr ::= MINUS expr */ |
| 133655 | | -{spanUnaryPrefix(&yymsp[-1].minor.yy342,pParse,TK_UMINUS,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} |
| 134289 | +{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UMINUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} |
| 133656 | 134290 | break; |
| 133657 | 134291 | case 181: /* expr ::= PLUS expr */ |
| 133658 | | -{spanUnaryPrefix(&yymsp[-1].minor.yy342,pParse,TK_UPLUS,&yymsp[0].minor.yy342,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} |
| 134292 | +{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UPLUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} |
| 133659 | 134293 | break; |
| 133660 | 134294 | case 182: /* between_op ::= BETWEEN */ |
| 133661 | 134295 | case 185: /* in_op ::= IN */ yytestcase(yyruleno==185); |
| 133662 | | -{yymsp[0].minor.yy392 = 0;} |
| 134296 | +{yymsp[0].minor.yy194 = 0;} |
| 133663 | 134297 | break; |
| 133664 | 134298 | case 184: /* expr ::= expr between_op expr AND expr */ |
| 133665 | 134299 | { |
| 133666 | | - ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr); |
| 133667 | | - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy342.pExpr); |
| 133668 | | - yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy342.pExpr, 0, 0); |
| 133669 | | - if( yymsp[-4].minor.yy342.pExpr ){ |
| 133670 | | - yymsp[-4].minor.yy342.pExpr->x.pList = pList; |
| 134300 | + ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr); |
| 134301 | + pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr); |
| 134302 | + yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy190.pExpr, 0, 0); |
| 134303 | + if( yymsp[-4].minor.yy190.pExpr ){ |
| 134304 | + yymsp[-4].minor.yy190.pExpr->x.pList = pList; |
| 133671 | 134305 | }else{ |
| 133672 | 134306 | sqlite3ExprListDelete(pParse->db, pList); |
| 133673 | 134307 | } |
| 133674 | | - exprNot(pParse, yymsp[-3].minor.yy392, &yymsp[-4].minor.yy342); |
| 133675 | | - yymsp[-4].minor.yy342.zEnd = yymsp[0].minor.yy342.zEnd; |
| 134308 | + exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190); |
| 134309 | + yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd; |
| 133676 | 134310 | } |
| 133677 | 134311 | break; |
| 133678 | 134312 | case 187: /* expr ::= expr in_op LP exprlist RP */ |
| 133679 | 134313 | { |
| 133680 | | - if( yymsp[-1].minor.yy442==0 ){ |
| 134314 | + if( yymsp[-1].minor.yy148==0 ){ |
| 133681 | 134315 | /* Expressions of the form |
| 133682 | 134316 | ** |
| 133683 | 134317 | ** expr1 IN () |
| 133684 | 134318 | ** expr1 NOT IN () |
| 133685 | 134319 | ** |
| 133686 | 134320 | ** simplify to constants 0 (false) and 1 (true), respectively, |
| 133687 | 134321 | ** regardless of the value of expr1. |
| 133688 | 134322 | */ |
| 133689 | | - sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy342.pExpr); |
| 133690 | | - yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &sqlite3IntTokens[yymsp[-3].minor.yy392]); |
| 133691 | | - }else if( yymsp[-1].minor.yy442->nExpr==1 ){ |
| 134323 | + sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy190.pExpr); |
| 134324 | + yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &sqlite3IntTokens[yymsp[-3].minor.yy194]); |
| 134325 | + }else if( yymsp[-1].minor.yy148->nExpr==1 ){ |
| 133692 | 134326 | /* Expressions of the form: |
| 133693 | 134327 | ** |
| 133694 | 134328 | ** expr1 IN (?1) |
| 133695 | 134329 | ** expr1 NOT IN (?2) |
| 133696 | 134330 | ** |
| | @@ -133703,417 +134337,421 @@ |
| 133703 | 134337 | ** But, the RHS of the == or <> is marked with the EP_Generic flag |
| 133704 | 134338 | ** so that it may not contribute to the computation of comparison |
| 133705 | 134339 | ** affinity or the collating sequence to use for comparison. Otherwise, |
| 133706 | 134340 | ** the semantics would be subtly different from IN or NOT IN. |
| 133707 | 134341 | */ |
| 133708 | | - Expr *pRHS = yymsp[-1].minor.yy442->a[0].pExpr; |
| 133709 | | - yymsp[-1].minor.yy442->a[0].pExpr = 0; |
| 133710 | | - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy442); |
| 134342 | + Expr *pRHS = yymsp[-1].minor.yy148->a[0].pExpr; |
| 134343 | + yymsp[-1].minor.yy148->a[0].pExpr = 0; |
| 134344 | + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy148); |
| 133711 | 134345 | /* pRHS cannot be NULL because a malloc error would have been detected |
| 133712 | 134346 | ** before now and control would have never reached this point */ |
| 133713 | 134347 | if( ALWAYS(pRHS) ){ |
| 133714 | 134348 | pRHS->flags &= ~EP_Collate; |
| 133715 | 134349 | pRHS->flags |= EP_Generic; |
| 133716 | 134350 | } |
| 133717 | | - yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, yymsp[-3].minor.yy392 ? TK_NE : TK_EQ, yymsp[-4].minor.yy342.pExpr, pRHS, 0); |
| 133718 | | - }else{ |
| 133719 | | - yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy342.pExpr, 0, 0); |
| 133720 | | - if( yymsp[-4].minor.yy342.pExpr ){ |
| 133721 | | - yymsp[-4].minor.yy342.pExpr->x.pList = yymsp[-1].minor.yy442; |
| 133722 | | - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy342.pExpr); |
| 133723 | | - }else{ |
| 133724 | | - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy442); |
| 133725 | | - } |
| 133726 | | - exprNot(pParse, yymsp[-3].minor.yy392, &yymsp[-4].minor.yy342); |
| 133727 | | - } |
| 133728 | | - yymsp[-4].minor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; |
| 134351 | + yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, yymsp[-3].minor.yy194 ? TK_NE : TK_EQ, yymsp[-4].minor.yy190.pExpr, pRHS, 0); |
| 134352 | + }else{ |
| 134353 | + yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0, 0); |
| 134354 | + if( yymsp[-4].minor.yy190.pExpr ){ |
| 134355 | + yymsp[-4].minor.yy190.pExpr->x.pList = yymsp[-1].minor.yy148; |
| 134356 | + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy190.pExpr); |
| 134357 | + }else{ |
| 134358 | + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy148); |
| 134359 | + } |
| 134360 | + exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190); |
| 134361 | + } |
| 134362 | + yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; |
| 133729 | 134363 | } |
| 133730 | 134364 | break; |
| 133731 | 134365 | case 188: /* expr ::= LP select RP */ |
| 133732 | 134366 | { |
| 133733 | | - spanSet(&yymsp[-2].minor.yy342,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ |
| 133734 | | - yymsp[-2].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0); |
| 133735 | | - sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy342.pExpr, yymsp[-1].minor.yy159); |
| 134367 | + spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ |
| 134368 | + yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0); |
| 134369 | + sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy190.pExpr, yymsp[-1].minor.yy243); |
| 133736 | 134370 | } |
| 133737 | 134371 | break; |
| 133738 | 134372 | case 189: /* expr ::= expr in_op LP select RP */ |
| 133739 | 134373 | { |
| 133740 | | - yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy342.pExpr, 0, 0); |
| 133741 | | - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy342.pExpr, yymsp[-1].minor.yy159); |
| 133742 | | - exprNot(pParse, yymsp[-3].minor.yy392, &yymsp[-4].minor.yy342); |
| 133743 | | - yymsp[-4].minor.yy342.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; |
| 133744 | | - } |
| 133745 | | - break; |
| 133746 | | - case 190: /* expr ::= expr in_op nm dbnm */ |
| 133747 | | -{ |
| 133748 | | - SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0); |
| 134374 | + yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0, 0); |
| 134375 | + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, yymsp[-1].minor.yy243); |
| 134376 | + exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190); |
| 134377 | + yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; |
| 134378 | + } |
| 134379 | + break; |
| 134380 | + case 190: /* expr ::= expr in_op nm dbnm paren_exprlist */ |
| 134381 | +{ |
| 134382 | + SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); |
| 133749 | 134383 | Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0); |
| 133750 | | - yymsp[-3].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy342.pExpr, 0, 0); |
| 133751 | | - sqlite3PExprAddSelect(pParse, yymsp[-3].minor.yy342.pExpr, pSelect); |
| 133752 | | - exprNot(pParse, yymsp[-2].minor.yy392, &yymsp[-3].minor.yy342); |
| 133753 | | - yymsp[-3].minor.yy342.zEnd = yymsp[0].minor.yy0.z ? &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] : &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]; |
| 134384 | + if( yymsp[0].minor.yy148 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy148); |
| 134385 | + yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0, 0); |
| 134386 | + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, pSelect); |
| 134387 | + exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190); |
| 134388 | + yymsp[-4].minor.yy190.zEnd = yymsp[-1].minor.yy0.z ? &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n] : &yymsp[-2].minor.yy0.z[yymsp[-2].minor.yy0.n]; |
| 133754 | 134389 | } |
| 133755 | 134390 | break; |
| 133756 | 134391 | case 191: /* expr ::= EXISTS LP select RP */ |
| 133757 | 134392 | { |
| 133758 | 134393 | Expr *p; |
| 133759 | | - spanSet(&yymsp[-3].minor.yy342,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ |
| 133760 | | - p = yymsp[-3].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0); |
| 133761 | | - sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy159); |
| 134394 | + spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ |
| 134395 | + p = yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0); |
| 134396 | + sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy243); |
| 133762 | 134397 | } |
| 133763 | 134398 | break; |
| 133764 | 134399 | case 192: /* expr ::= CASE case_operand case_exprlist case_else END */ |
| 133765 | 134400 | { |
| 133766 | | - spanSet(&yymsp[-4].minor.yy342,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-C*/ |
| 133767 | | - yymsp[-4].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy122, 0, 0); |
| 133768 | | - if( yymsp[-4].minor.yy342.pExpr ){ |
| 133769 | | - yymsp[-4].minor.yy342.pExpr->x.pList = yymsp[-1].minor.yy122 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy442,yymsp[-1].minor.yy122) : yymsp[-2].minor.yy442; |
| 133770 | | - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy342.pExpr); |
| 134401 | + spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-C*/ |
| 134402 | + yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy72, 0, 0); |
| 134403 | + if( yymsp[-4].minor.yy190.pExpr ){ |
| 134404 | + yymsp[-4].minor.yy190.pExpr->x.pList = yymsp[-1].minor.yy72 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[-1].minor.yy72) : yymsp[-2].minor.yy148; |
| 134405 | + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy190.pExpr); |
| 133771 | 134406 | }else{ |
| 133772 | | - sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy442); |
| 133773 | | - sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy122); |
| 134407 | + sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy148); |
| 134408 | + sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy72); |
| 133774 | 134409 | } |
| 133775 | 134410 | } |
| 133776 | 134411 | break; |
| 133777 | 134412 | case 193: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 133778 | 134413 | { |
| 133779 | | - yymsp[-4].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, yymsp[-2].minor.yy342.pExpr); |
| 133780 | | - yymsp[-4].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy442, yymsp[0].minor.yy342.pExpr); |
| 134414 | + yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[-2].minor.yy190.pExpr); |
| 134415 | + yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr); |
| 133781 | 134416 | } |
| 133782 | 134417 | break; |
| 133783 | 134418 | case 194: /* case_exprlist ::= WHEN expr THEN expr */ |
| 133784 | 134419 | { |
| 133785 | | - yymsp[-3].minor.yy442 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy342.pExpr); |
| 133786 | | - yymsp[-3].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy442, yymsp[0].minor.yy342.pExpr); |
| 134420 | + yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr); |
| 134421 | + yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, yymsp[0].minor.yy190.pExpr); |
| 133787 | 134422 | } |
| 133788 | 134423 | break; |
| 133789 | 134424 | case 197: /* case_operand ::= expr */ |
| 133790 | | -{yymsp[0].minor.yy122 = yymsp[0].minor.yy342.pExpr; /*A-overwrites-X*/} |
| 134425 | +{yymsp[0].minor.yy72 = yymsp[0].minor.yy190.pExpr; /*A-overwrites-X*/} |
| 133791 | 134426 | break; |
| 133792 | 134427 | case 200: /* nexprlist ::= nexprlist COMMA expr */ |
| 133793 | | -{yymsp[-2].minor.yy442 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy442,yymsp[0].minor.yy342.pExpr);} |
| 134428 | +{yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[0].minor.yy190.pExpr);} |
| 133794 | 134429 | break; |
| 133795 | 134430 | case 201: /* nexprlist ::= expr */ |
| 133796 | | -{yymsp[0].minor.yy442 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy342.pExpr); /*A-overwrites-Y*/} |
| 134431 | +{yymsp[0].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy190.pExpr); /*A-overwrites-Y*/} |
| 133797 | 134432 | break; |
| 133798 | | - case 202: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 134433 | + case 203: /* paren_exprlist ::= LP exprlist RP */ |
| 134434 | + case 208: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==208); |
| 134435 | +{yymsp[-2].minor.yy148 = yymsp[-1].minor.yy148;} |
| 134436 | + break; |
| 134437 | + case 204: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 133799 | 134438 | { |
| 133800 | 134439 | sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, |
| 133801 | | - sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy442, yymsp[-10].minor.yy392, |
| 133802 | | - &yymsp[-11].minor.yy0, yymsp[0].minor.yy122, SQLITE_SO_ASC, yymsp[-8].minor.yy392); |
| 133803 | | -} |
| 133804 | | - break; |
| 133805 | | - case 203: /* uniqueflag ::= UNIQUE */ |
| 133806 | | - case 244: /* raisetype ::= ABORT */ yytestcase(yyruleno==244); |
| 133807 | | -{yymsp[0].minor.yy392 = OE_Abort;} |
| 133808 | | - break; |
| 133809 | | - case 204: /* uniqueflag ::= */ |
| 133810 | | -{yymsp[1].minor.yy392 = OE_None;} |
| 133811 | | - break; |
| 133812 | | - case 206: /* eidlist_opt ::= LP eidlist RP */ |
| 133813 | | -{yymsp[-2].minor.yy442 = yymsp[-1].minor.yy442;} |
| 133814 | | - break; |
| 133815 | | - case 207: /* eidlist ::= eidlist COMMA nm collate sortorder */ |
| 133816 | | -{ |
| 133817 | | - yymsp[-4].minor.yy442 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy442, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); |
| 133818 | | -} |
| 133819 | | - break; |
| 133820 | | - case 208: /* eidlist ::= nm collate sortorder */ |
| 133821 | | -{ |
| 133822 | | - yymsp[-2].minor.yy442 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy392, yymsp[0].minor.yy392); /*A-overwrites-Y*/ |
| 133823 | | -} |
| 133824 | | - break; |
| 133825 | | - case 211: /* cmd ::= DROP INDEX ifexists fullname */ |
| 133826 | | -{sqlite3DropIndex(pParse, yymsp[0].minor.yy347, yymsp[-1].minor.yy392);} |
| 133827 | | - break; |
| 133828 | | - case 212: /* cmd ::= VACUUM */ |
| 133829 | | - case 213: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==213); |
| 134440 | + sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy148, yymsp[-10].minor.yy194, |
| 134441 | + &yymsp[-11].minor.yy0, yymsp[0].minor.yy72, SQLITE_SO_ASC, yymsp[-8].minor.yy194, SQLITE_IDXTYPE_APPDEF); |
| 134442 | +} |
| 134443 | + break; |
| 134444 | + case 205: /* uniqueflag ::= UNIQUE */ |
| 134445 | + case 246: /* raisetype ::= ABORT */ yytestcase(yyruleno==246); |
| 134446 | +{yymsp[0].minor.yy194 = OE_Abort;} |
| 134447 | + break; |
| 134448 | + case 206: /* uniqueflag ::= */ |
| 134449 | +{yymsp[1].minor.yy194 = OE_None;} |
| 134450 | + break; |
| 134451 | + case 209: /* eidlist ::= eidlist COMMA nm collate sortorder */ |
| 134452 | +{ |
| 134453 | + yymsp[-4].minor.yy148 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); |
| 134454 | +} |
| 134455 | + break; |
| 134456 | + case 210: /* eidlist ::= nm collate sortorder */ |
| 134457 | +{ |
| 134458 | + yymsp[-2].minor.yy148 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); /*A-overwrites-Y*/ |
| 134459 | +} |
| 134460 | + break; |
| 134461 | + case 213: /* cmd ::= DROP INDEX ifexists fullname */ |
| 134462 | +{sqlite3DropIndex(pParse, yymsp[0].minor.yy185, yymsp[-1].minor.yy194);} |
| 134463 | + break; |
| 134464 | + case 214: /* cmd ::= VACUUM */ |
| 134465 | + case 215: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==215); |
| 133830 | 134466 | {sqlite3Vacuum(pParse);} |
| 133831 | 134467 | break; |
| 133832 | | - case 214: /* cmd ::= PRAGMA nm dbnm */ |
| 134468 | + case 216: /* cmd ::= PRAGMA nm dbnm */ |
| 133833 | 134469 | {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} |
| 133834 | 134470 | break; |
| 133835 | | - case 215: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 134471 | + case 217: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 133836 | 134472 | {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} |
| 133837 | 134473 | break; |
| 133838 | | - case 216: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 134474 | + case 218: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 133839 | 134475 | {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} |
| 133840 | 134476 | break; |
| 133841 | | - case 217: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 134477 | + case 219: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 133842 | 134478 | {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} |
| 133843 | 134479 | break; |
| 133844 | | - case 218: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 134480 | + case 220: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 133845 | 134481 | {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);} |
| 133846 | 134482 | break; |
| 133847 | | - case 221: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 134483 | + case 223: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 133848 | 134484 | { |
| 133849 | 134485 | Token all; |
| 133850 | 134486 | all.z = yymsp[-3].minor.yy0.z; |
| 133851 | 134487 | all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n; |
| 133852 | | - sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy327, &all); |
| 134488 | + sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy145, &all); |
| 133853 | 134489 | } |
| 133854 | 134490 | break; |
| 133855 | | - case 222: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 134491 | + case 224: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 133856 | 134492 | { |
| 133857 | | - sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy392, yymsp[-4].minor.yy410.a, yymsp[-4].minor.yy410.b, yymsp[-2].minor.yy347, yymsp[0].minor.yy122, yymsp[-10].minor.yy392, yymsp[-8].minor.yy392); |
| 134493 | + sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy194, yymsp[-4].minor.yy332.a, yymsp[-4].minor.yy332.b, yymsp[-2].minor.yy185, yymsp[0].minor.yy72, yymsp[-10].minor.yy194, yymsp[-8].minor.yy194); |
| 133858 | 134494 | yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ |
| 133859 | 134495 | } |
| 133860 | 134496 | break; |
| 133861 | | - case 223: /* trigger_time ::= BEFORE */ |
| 133862 | | -{ yymsp[0].minor.yy392 = TK_BEFORE; } |
| 133863 | | - break; |
| 133864 | | - case 224: /* trigger_time ::= AFTER */ |
| 133865 | | -{ yymsp[0].minor.yy392 = TK_AFTER; } |
| 133866 | | - break; |
| 133867 | | - case 225: /* trigger_time ::= INSTEAD OF */ |
| 133868 | | -{ yymsp[-1].minor.yy392 = TK_INSTEAD;} |
| 133869 | | - break; |
| 133870 | | - case 226: /* trigger_time ::= */ |
| 133871 | | -{ yymsp[1].minor.yy392 = TK_BEFORE; } |
| 133872 | | - break; |
| 133873 | | - case 227: /* trigger_event ::= DELETE|INSERT */ |
| 133874 | | - case 228: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==228); |
| 133875 | | -{yymsp[0].minor.yy410.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy410.b = 0;} |
| 133876 | | - break; |
| 133877 | | - case 229: /* trigger_event ::= UPDATE OF idlist */ |
| 133878 | | -{yymsp[-2].minor.yy410.a = TK_UPDATE; yymsp[-2].minor.yy410.b = yymsp[0].minor.yy180;} |
| 133879 | | - break; |
| 133880 | | - case 230: /* when_clause ::= */ |
| 133881 | | - case 249: /* key_opt ::= */ yytestcase(yyruleno==249); |
| 133882 | | -{ yymsp[1].minor.yy122 = 0; } |
| 133883 | | - break; |
| 133884 | | - case 231: /* when_clause ::= WHEN expr */ |
| 133885 | | - case 250: /* key_opt ::= KEY expr */ yytestcase(yyruleno==250); |
| 133886 | | -{ yymsp[-1].minor.yy122 = yymsp[0].minor.yy342.pExpr; } |
| 133887 | | - break; |
| 133888 | | - case 232: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 133889 | | -{ |
| 133890 | | - assert( yymsp[-2].minor.yy327!=0 ); |
| 133891 | | - yymsp[-2].minor.yy327->pLast->pNext = yymsp[-1].minor.yy327; |
| 133892 | | - yymsp[-2].minor.yy327->pLast = yymsp[-1].minor.yy327; |
| 133893 | | -} |
| 133894 | | - break; |
| 133895 | | - case 233: /* trigger_cmd_list ::= trigger_cmd SEMI */ |
| 133896 | | -{ |
| 133897 | | - assert( yymsp[-1].minor.yy327!=0 ); |
| 133898 | | - yymsp[-1].minor.yy327->pLast = yymsp[-1].minor.yy327; |
| 133899 | | -} |
| 133900 | | - break; |
| 133901 | | - case 234: /* trnm ::= nm DOT nm */ |
| 134497 | + case 225: /* trigger_time ::= BEFORE */ |
| 134498 | +{ yymsp[0].minor.yy194 = TK_BEFORE; } |
| 134499 | + break; |
| 134500 | + case 226: /* trigger_time ::= AFTER */ |
| 134501 | +{ yymsp[0].minor.yy194 = TK_AFTER; } |
| 134502 | + break; |
| 134503 | + case 227: /* trigger_time ::= INSTEAD OF */ |
| 134504 | +{ yymsp[-1].minor.yy194 = TK_INSTEAD;} |
| 134505 | + break; |
| 134506 | + case 228: /* trigger_time ::= */ |
| 134507 | +{ yymsp[1].minor.yy194 = TK_BEFORE; } |
| 134508 | + break; |
| 134509 | + case 229: /* trigger_event ::= DELETE|INSERT */ |
| 134510 | + case 230: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==230); |
| 134511 | +{yymsp[0].minor.yy332.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy332.b = 0;} |
| 134512 | + break; |
| 134513 | + case 231: /* trigger_event ::= UPDATE OF idlist */ |
| 134514 | +{yymsp[-2].minor.yy332.a = TK_UPDATE; yymsp[-2].minor.yy332.b = yymsp[0].minor.yy254;} |
| 134515 | + break; |
| 134516 | + case 232: /* when_clause ::= */ |
| 134517 | + case 251: /* key_opt ::= */ yytestcase(yyruleno==251); |
| 134518 | +{ yymsp[1].minor.yy72 = 0; } |
| 134519 | + break; |
| 134520 | + case 233: /* when_clause ::= WHEN expr */ |
| 134521 | + case 252: /* key_opt ::= KEY expr */ yytestcase(yyruleno==252); |
| 134522 | +{ yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr; } |
| 134523 | + break; |
| 134524 | + case 234: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 134525 | +{ |
| 134526 | + assert( yymsp[-2].minor.yy145!=0 ); |
| 134527 | + yymsp[-2].minor.yy145->pLast->pNext = yymsp[-1].minor.yy145; |
| 134528 | + yymsp[-2].minor.yy145->pLast = yymsp[-1].minor.yy145; |
| 134529 | +} |
| 134530 | + break; |
| 134531 | + case 235: /* trigger_cmd_list ::= trigger_cmd SEMI */ |
| 134532 | +{ |
| 134533 | + assert( yymsp[-1].minor.yy145!=0 ); |
| 134534 | + yymsp[-1].minor.yy145->pLast = yymsp[-1].minor.yy145; |
| 134535 | +} |
| 134536 | + break; |
| 134537 | + case 236: /* trnm ::= nm DOT nm */ |
| 133902 | 134538 | { |
| 133903 | 134539 | yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; |
| 133904 | 134540 | sqlite3ErrorMsg(pParse, |
| 133905 | 134541 | "qualified table names are not allowed on INSERT, UPDATE, and DELETE " |
| 133906 | 134542 | "statements within triggers"); |
| 133907 | 134543 | } |
| 133908 | 134544 | break; |
| 133909 | | - case 235: /* tridxby ::= INDEXED BY nm */ |
| 134545 | + case 237: /* tridxby ::= INDEXED BY nm */ |
| 133910 | 134546 | { |
| 133911 | 134547 | sqlite3ErrorMsg(pParse, |
| 133912 | 134548 | "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " |
| 133913 | 134549 | "within triggers"); |
| 133914 | 134550 | } |
| 133915 | 134551 | break; |
| 133916 | | - case 236: /* tridxby ::= NOT INDEXED */ |
| 134552 | + case 238: /* tridxby ::= NOT INDEXED */ |
| 133917 | 134553 | { |
| 133918 | 134554 | sqlite3ErrorMsg(pParse, |
| 133919 | 134555 | "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " |
| 133920 | 134556 | "within triggers"); |
| 133921 | 134557 | } |
| 133922 | 134558 | break; |
| 133923 | | - case 237: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */ |
| 133924 | | -{yymsp[-6].minor.yy327 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy442, yymsp[0].minor.yy122, yymsp[-5].minor.yy392);} |
| 133925 | | - break; |
| 133926 | | - case 238: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */ |
| 133927 | | -{yymsp[-4].minor.yy327 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy180, yymsp[0].minor.yy159, yymsp[-4].minor.yy392);/*A-overwrites-R*/} |
| 133928 | | - break; |
| 133929 | | - case 239: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */ |
| 133930 | | -{yymsp[-4].minor.yy327 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy122);} |
| 133931 | | - break; |
| 133932 | | - case 240: /* trigger_cmd ::= select */ |
| 133933 | | -{yymsp[0].minor.yy327 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy159); /*A-overwrites-X*/} |
| 133934 | | - break; |
| 133935 | | - case 241: /* expr ::= RAISE LP IGNORE RP */ |
| 133936 | | -{ |
| 133937 | | - spanSet(&yymsp[-3].minor.yy342,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 133938 | | - yymsp[-3].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0); |
| 133939 | | - if( yymsp[-3].minor.yy342.pExpr ){ |
| 133940 | | - yymsp[-3].minor.yy342.pExpr->affinity = OE_Ignore; |
| 133941 | | - } |
| 133942 | | -} |
| 133943 | | - break; |
| 133944 | | - case 242: /* expr ::= RAISE LP raisetype COMMA nm RP */ |
| 133945 | | -{ |
| 133946 | | - spanSet(&yymsp[-5].minor.yy342,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 133947 | | - yymsp[-5].minor.yy342.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0); |
| 133948 | | - if( yymsp[-5].minor.yy342.pExpr ) { |
| 133949 | | - yymsp[-5].minor.yy342.pExpr->affinity = (char)yymsp[-3].minor.yy392; |
| 133950 | | - } |
| 133951 | | -} |
| 133952 | | - break; |
| 133953 | | - case 243: /* raisetype ::= ROLLBACK */ |
| 133954 | | -{yymsp[0].minor.yy392 = OE_Rollback;} |
| 133955 | | - break; |
| 133956 | | - case 245: /* raisetype ::= FAIL */ |
| 133957 | | -{yymsp[0].minor.yy392 = OE_Fail;} |
| 133958 | | - break; |
| 133959 | | - case 246: /* cmd ::= DROP TRIGGER ifexists fullname */ |
| 133960 | | -{ |
| 133961 | | - sqlite3DropTrigger(pParse,yymsp[0].minor.yy347,yymsp[-1].minor.yy392); |
| 133962 | | -} |
| 133963 | | - break; |
| 133964 | | - case 247: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 133965 | | -{ |
| 133966 | | - sqlite3Attach(pParse, yymsp[-3].minor.yy342.pExpr, yymsp[-1].minor.yy342.pExpr, yymsp[0].minor.yy122); |
| 133967 | | -} |
| 133968 | | - break; |
| 133969 | | - case 248: /* cmd ::= DETACH database_kw_opt expr */ |
| 133970 | | -{ |
| 133971 | | - sqlite3Detach(pParse, yymsp[0].minor.yy342.pExpr); |
| 133972 | | -} |
| 133973 | | - break; |
| 133974 | | - case 251: /* cmd ::= REINDEX */ |
| 134559 | + case 239: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */ |
| 134560 | +{yymsp[-6].minor.yy145 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy148, yymsp[0].minor.yy72, yymsp[-5].minor.yy194);} |
| 134561 | + break; |
| 134562 | + case 240: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */ |
| 134563 | +{yymsp[-4].minor.yy145 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy254, yymsp[0].minor.yy243, yymsp[-4].minor.yy194);/*A-overwrites-R*/} |
| 134564 | + break; |
| 134565 | + case 241: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */ |
| 134566 | +{yymsp[-4].minor.yy145 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy72);} |
| 134567 | + break; |
| 134568 | + case 242: /* trigger_cmd ::= select */ |
| 134569 | +{yymsp[0].minor.yy145 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy243); /*A-overwrites-X*/} |
| 134570 | + break; |
| 134571 | + case 243: /* expr ::= RAISE LP IGNORE RP */ |
| 134572 | +{ |
| 134573 | + spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 134574 | + yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0); |
| 134575 | + if( yymsp[-3].minor.yy190.pExpr ){ |
| 134576 | + yymsp[-3].minor.yy190.pExpr->affinity = OE_Ignore; |
| 134577 | + } |
| 134578 | +} |
| 134579 | + break; |
| 134580 | + case 244: /* expr ::= RAISE LP raisetype COMMA nm RP */ |
| 134581 | +{ |
| 134582 | + spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 134583 | + yymsp[-5].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0); |
| 134584 | + if( yymsp[-5].minor.yy190.pExpr ) { |
| 134585 | + yymsp[-5].minor.yy190.pExpr->affinity = (char)yymsp[-3].minor.yy194; |
| 134586 | + } |
| 134587 | +} |
| 134588 | + break; |
| 134589 | + case 245: /* raisetype ::= ROLLBACK */ |
| 134590 | +{yymsp[0].minor.yy194 = OE_Rollback;} |
| 134591 | + break; |
| 134592 | + case 247: /* raisetype ::= FAIL */ |
| 134593 | +{yymsp[0].minor.yy194 = OE_Fail;} |
| 134594 | + break; |
| 134595 | + case 248: /* cmd ::= DROP TRIGGER ifexists fullname */ |
| 134596 | +{ |
| 134597 | + sqlite3DropTrigger(pParse,yymsp[0].minor.yy185,yymsp[-1].minor.yy194); |
| 134598 | +} |
| 134599 | + break; |
| 134600 | + case 249: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 134601 | +{ |
| 134602 | + sqlite3Attach(pParse, yymsp[-3].minor.yy190.pExpr, yymsp[-1].minor.yy190.pExpr, yymsp[0].minor.yy72); |
| 134603 | +} |
| 134604 | + break; |
| 134605 | + case 250: /* cmd ::= DETACH database_kw_opt expr */ |
| 134606 | +{ |
| 134607 | + sqlite3Detach(pParse, yymsp[0].minor.yy190.pExpr); |
| 134608 | +} |
| 134609 | + break; |
| 134610 | + case 253: /* cmd ::= REINDEX */ |
| 133975 | 134611 | {sqlite3Reindex(pParse, 0, 0);} |
| 133976 | 134612 | break; |
| 133977 | | - case 252: /* cmd ::= REINDEX nm dbnm */ |
| 134613 | + case 254: /* cmd ::= REINDEX nm dbnm */ |
| 133978 | 134614 | {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 133979 | 134615 | break; |
| 133980 | | - case 253: /* cmd ::= ANALYZE */ |
| 134616 | + case 255: /* cmd ::= ANALYZE */ |
| 133981 | 134617 | {sqlite3Analyze(pParse, 0, 0);} |
| 133982 | 134618 | break; |
| 133983 | | - case 254: /* cmd ::= ANALYZE nm dbnm */ |
| 134619 | + case 256: /* cmd ::= ANALYZE nm dbnm */ |
| 133984 | 134620 | {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 133985 | 134621 | break; |
| 133986 | | - case 255: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 134622 | + case 257: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 133987 | 134623 | { |
| 133988 | | - sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy347,&yymsp[0].minor.yy0); |
| 134624 | + sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy185,&yymsp[0].minor.yy0); |
| 133989 | 134625 | } |
| 133990 | 134626 | break; |
| 133991 | | - case 256: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 134627 | + case 258: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 133992 | 134628 | { |
| 133993 | 134629 | yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; |
| 133994 | 134630 | sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); |
| 133995 | 134631 | } |
| 133996 | 134632 | break; |
| 133997 | | - case 257: /* add_column_fullname ::= fullname */ |
| 134633 | + case 259: /* add_column_fullname ::= fullname */ |
| 133998 | 134634 | { |
| 133999 | 134635 | disableLookaside(pParse); |
| 134000 | | - sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy347); |
| 134636 | + sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy185); |
| 134001 | 134637 | } |
| 134002 | 134638 | break; |
| 134003 | | - case 258: /* cmd ::= create_vtab */ |
| 134639 | + case 260: /* cmd ::= create_vtab */ |
| 134004 | 134640 | {sqlite3VtabFinishParse(pParse,0);} |
| 134005 | 134641 | break; |
| 134006 | | - case 259: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 134642 | + case 261: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 134007 | 134643 | {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} |
| 134008 | 134644 | break; |
| 134009 | | - case 260: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 134645 | + case 262: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 134010 | 134646 | { |
| 134011 | | - sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy392); |
| 134647 | + sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy194); |
| 134012 | 134648 | } |
| 134013 | 134649 | break; |
| 134014 | | - case 261: /* vtabarg ::= */ |
| 134650 | + case 263: /* vtabarg ::= */ |
| 134015 | 134651 | {sqlite3VtabArgInit(pParse);} |
| 134016 | 134652 | break; |
| 134017 | | - case 262: /* vtabargtoken ::= ANY */ |
| 134018 | | - case 263: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==263); |
| 134019 | | - case 264: /* lp ::= LP */ yytestcase(yyruleno==264); |
| 134653 | + case 264: /* vtabargtoken ::= ANY */ |
| 134654 | + case 265: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==265); |
| 134655 | + case 266: /* lp ::= LP */ yytestcase(yyruleno==266); |
| 134020 | 134656 | {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} |
| 134021 | 134657 | break; |
| 134022 | | - case 265: /* with ::= */ |
| 134023 | | -{yymsp[1].minor.yy331 = 0;} |
| 134024 | | - break; |
| 134025 | | - case 266: /* with ::= WITH wqlist */ |
| 134026 | | -{ yymsp[-1].minor.yy331 = yymsp[0].minor.yy331; } |
| 134027 | | - break; |
| 134028 | | - case 267: /* with ::= WITH RECURSIVE wqlist */ |
| 134029 | | -{ yymsp[-2].minor.yy331 = yymsp[0].minor.yy331; } |
| 134030 | | - break; |
| 134031 | | - case 268: /* wqlist ::= nm eidlist_opt AS LP select RP */ |
| 134032 | | -{ |
| 134033 | | - yymsp[-5].minor.yy331 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy442, yymsp[-1].minor.yy159); /*A-overwrites-X*/ |
| 134034 | | -} |
| 134035 | | - break; |
| 134036 | | - case 269: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 134037 | | -{ |
| 134038 | | - yymsp[-7].minor.yy331 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy331, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy442, yymsp[-1].minor.yy159); |
| 134658 | + case 267: /* with ::= */ |
| 134659 | +{yymsp[1].minor.yy285 = 0;} |
| 134660 | + break; |
| 134661 | + case 268: /* with ::= WITH wqlist */ |
| 134662 | +{ yymsp[-1].minor.yy285 = yymsp[0].minor.yy285; } |
| 134663 | + break; |
| 134664 | + case 269: /* with ::= WITH RECURSIVE wqlist */ |
| 134665 | +{ yymsp[-2].minor.yy285 = yymsp[0].minor.yy285; } |
| 134666 | + break; |
| 134667 | + case 270: /* wqlist ::= nm eidlist_opt AS LP select RP */ |
| 134668 | +{ |
| 134669 | + yymsp[-5].minor.yy285 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); /*A-overwrites-X*/ |
| 134670 | +} |
| 134671 | + break; |
| 134672 | + case 271: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 134673 | +{ |
| 134674 | + yymsp[-7].minor.yy285 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy285, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); |
| 134039 | 134675 | } |
| 134040 | 134676 | break; |
| 134041 | 134677 | default: |
| 134042 | | - /* (270) input ::= cmdlist */ yytestcase(yyruleno==270); |
| 134043 | | - /* (271) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==271); |
| 134044 | | - /* (272) cmdlist ::= ecmd */ yytestcase(yyruleno==272); |
| 134045 | | - /* (273) ecmd ::= SEMI */ yytestcase(yyruleno==273); |
| 134046 | | - /* (274) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==274); |
| 134047 | | - /* (275) explain ::= */ yytestcase(yyruleno==275); |
| 134048 | | - /* (276) trans_opt ::= */ yytestcase(yyruleno==276); |
| 134049 | | - /* (277) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==277); |
| 134050 | | - /* (278) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==278); |
| 134051 | | - /* (279) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==279); |
| 134052 | | - /* (280) savepoint_opt ::= */ yytestcase(yyruleno==280); |
| 134053 | | - /* (281) cmd ::= create_table create_table_args */ yytestcase(yyruleno==281); |
| 134054 | | - /* (282) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==282); |
| 134055 | | - /* (283) columnlist ::= columnname carglist */ yytestcase(yyruleno==283); |
| 134056 | | - /* (284) nm ::= ID|INDEXED */ yytestcase(yyruleno==284); |
| 134057 | | - /* (285) nm ::= STRING */ yytestcase(yyruleno==285); |
| 134058 | | - /* (286) nm ::= JOIN_KW */ yytestcase(yyruleno==286); |
| 134059 | | - /* (287) typetoken ::= typename */ yytestcase(yyruleno==287); |
| 134060 | | - /* (288) typename ::= ID|STRING */ yytestcase(yyruleno==288); |
| 134061 | | - /* (289) signed ::= plus_num */ yytestcase(yyruleno==289); |
| 134062 | | - /* (290) signed ::= minus_num */ yytestcase(yyruleno==290); |
| 134063 | | - /* (291) carglist ::= carglist ccons */ yytestcase(yyruleno==291); |
| 134064 | | - /* (292) carglist ::= */ yytestcase(yyruleno==292); |
| 134065 | | - /* (293) ccons ::= NULL onconf */ yytestcase(yyruleno==293); |
| 134066 | | - /* (294) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==294); |
| 134067 | | - /* (295) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==295); |
| 134068 | | - /* (296) conslist ::= tcons */ yytestcase(yyruleno==296); |
| 134069 | | - /* (297) tconscomma ::= */ yytestcase(yyruleno==297); |
| 134070 | | - /* (298) defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno==298); |
| 134071 | | - /* (299) resolvetype ::= raisetype */ yytestcase(yyruleno==299); |
| 134072 | | - /* (300) selectnowith ::= oneselect */ yytestcase(yyruleno==300); |
| 134073 | | - /* (301) oneselect ::= values */ yytestcase(yyruleno==301); |
| 134074 | | - /* (302) sclp ::= selcollist COMMA */ yytestcase(yyruleno==302); |
| 134075 | | - /* (303) as ::= ID|STRING */ yytestcase(yyruleno==303); |
| 134076 | | - /* (304) expr ::= term */ yytestcase(yyruleno==304); |
| 134077 | | - /* (305) exprlist ::= nexprlist */ yytestcase(yyruleno==305); |
| 134078 | | - /* (306) nmnum ::= plus_num */ yytestcase(yyruleno==306); |
| 134079 | | - /* (307) nmnum ::= nm */ yytestcase(yyruleno==307); |
| 134080 | | - /* (308) nmnum ::= ON */ yytestcase(yyruleno==308); |
| 134081 | | - /* (309) nmnum ::= DELETE */ yytestcase(yyruleno==309); |
| 134082 | | - /* (310) nmnum ::= DEFAULT */ yytestcase(yyruleno==310); |
| 134083 | | - /* (311) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==311); |
| 134084 | | - /* (312) foreach_clause ::= */ yytestcase(yyruleno==312); |
| 134085 | | - /* (313) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==313); |
| 134086 | | - /* (314) trnm ::= nm */ yytestcase(yyruleno==314); |
| 134087 | | - /* (315) tridxby ::= */ yytestcase(yyruleno==315); |
| 134088 | | - /* (316) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==316); |
| 134089 | | - /* (317) database_kw_opt ::= */ yytestcase(yyruleno==317); |
| 134090 | | - /* (318) kwcolumn_opt ::= */ yytestcase(yyruleno==318); |
| 134091 | | - /* (319) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==319); |
| 134092 | | - /* (320) vtabarglist ::= vtabarg */ yytestcase(yyruleno==320); |
| 134093 | | - /* (321) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==321); |
| 134094 | | - /* (322) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==322); |
| 134095 | | - /* (323) anylist ::= */ yytestcase(yyruleno==323); |
| 134096 | | - /* (324) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==324); |
| 134097 | | - /* (325) anylist ::= anylist ANY */ yytestcase(yyruleno==325); |
| 134678 | + /* (272) input ::= cmdlist */ yytestcase(yyruleno==272); |
| 134679 | + /* (273) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==273); |
| 134680 | + /* (274) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=274); |
| 134681 | + /* (275) ecmd ::= SEMI */ yytestcase(yyruleno==275); |
| 134682 | + /* (276) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==276); |
| 134683 | + /* (277) explain ::= */ yytestcase(yyruleno==277); |
| 134684 | + /* (278) trans_opt ::= */ yytestcase(yyruleno==278); |
| 134685 | + /* (279) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==279); |
| 134686 | + /* (280) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==280); |
| 134687 | + /* (281) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==281); |
| 134688 | + /* (282) savepoint_opt ::= */ yytestcase(yyruleno==282); |
| 134689 | + /* (283) cmd ::= create_table create_table_args */ yytestcase(yyruleno==283); |
| 134690 | + /* (284) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==284); |
| 134691 | + /* (285) columnlist ::= columnname carglist */ yytestcase(yyruleno==285); |
| 134692 | + /* (286) nm ::= ID|INDEXED */ yytestcase(yyruleno==286); |
| 134693 | + /* (287) nm ::= STRING */ yytestcase(yyruleno==287); |
| 134694 | + /* (288) nm ::= JOIN_KW */ yytestcase(yyruleno==288); |
| 134695 | + /* (289) typetoken ::= typename */ yytestcase(yyruleno==289); |
| 134696 | + /* (290) typename ::= ID|STRING */ yytestcase(yyruleno==290); |
| 134697 | + /* (291) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=291); |
| 134698 | + /* (292) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=292); |
| 134699 | + /* (293) carglist ::= carglist ccons */ yytestcase(yyruleno==293); |
| 134700 | + /* (294) carglist ::= */ yytestcase(yyruleno==294); |
| 134701 | + /* (295) ccons ::= NULL onconf */ yytestcase(yyruleno==295); |
| 134702 | + /* (296) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==296); |
| 134703 | + /* (297) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==297); |
| 134704 | + /* (298) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=298); |
| 134705 | + /* (299) tconscomma ::= */ yytestcase(yyruleno==299); |
| 134706 | + /* (300) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=300); |
| 134707 | + /* (301) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=301); |
| 134708 | + /* (302) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=302); |
| 134709 | + /* (303) oneselect ::= values */ yytestcase(yyruleno==303); |
| 134710 | + /* (304) sclp ::= selcollist COMMA */ yytestcase(yyruleno==304); |
| 134711 | + /* (305) as ::= ID|STRING */ yytestcase(yyruleno==305); |
| 134712 | + /* (306) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=306); |
| 134713 | + /* (307) exprlist ::= nexprlist */ yytestcase(yyruleno==307); |
| 134714 | + /* (308) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=308); |
| 134715 | + /* (309) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=309); |
| 134716 | + /* (310) nmnum ::= ON */ yytestcase(yyruleno==310); |
| 134717 | + /* (311) nmnum ::= DELETE */ yytestcase(yyruleno==311); |
| 134718 | + /* (312) nmnum ::= DEFAULT */ yytestcase(yyruleno==312); |
| 134719 | + /* (313) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==313); |
| 134720 | + /* (314) foreach_clause ::= */ yytestcase(yyruleno==314); |
| 134721 | + /* (315) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==315); |
| 134722 | + /* (316) trnm ::= nm */ yytestcase(yyruleno==316); |
| 134723 | + /* (317) tridxby ::= */ yytestcase(yyruleno==317); |
| 134724 | + /* (318) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==318); |
| 134725 | + /* (319) database_kw_opt ::= */ yytestcase(yyruleno==319); |
| 134726 | + /* (320) kwcolumn_opt ::= */ yytestcase(yyruleno==320); |
| 134727 | + /* (321) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==321); |
| 134728 | + /* (322) vtabarglist ::= vtabarg */ yytestcase(yyruleno==322); |
| 134729 | + /* (323) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==323); |
| 134730 | + /* (324) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==324); |
| 134731 | + /* (325) anylist ::= */ yytestcase(yyruleno==325); |
| 134732 | + /* (326) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==326); |
| 134733 | + /* (327) anylist ::= anylist ANY */ yytestcase(yyruleno==327); |
| 134098 | 134734 | break; |
| 134099 | 134735 | /********** End reduce actions ************************************************/ |
| 134100 | 134736 | }; |
| 134101 | 134737 | assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) ); |
| 134102 | 134738 | yygoto = yyRuleInfo[yyruleno].lhs; |
| 134103 | 134739 | yysize = yyRuleInfo[yyruleno].nrhs; |
| 134104 | 134740 | yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto); |
| 134105 | 134741 | if( yyact <= YY_MAX_SHIFTREDUCE ){ |
| 134106 | | - if( yyact>YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; |
| 134107 | | - yypParser->yyidx -= yysize - 1; |
| 134742 | + if( yyact>YY_MAX_SHIFT ){ |
| 134743 | + yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; |
| 134744 | + } |
| 134108 | 134745 | yymsp -= yysize-1; |
| 134746 | + yypParser->yytos = yymsp; |
| 134109 | 134747 | yymsp->stateno = (YYACTIONTYPE)yyact; |
| 134110 | 134748 | yymsp->major = (YYCODETYPE)yygoto; |
| 134111 | 134749 | yyTraceShift(yypParser, yyact); |
| 134112 | 134750 | }else{ |
| 134113 | 134751 | assert( yyact == YY_ACCEPT_ACTION ); |
| 134114 | | - yypParser->yyidx -= yysize; |
| 134752 | + yypParser->yytos -= yysize; |
| 134115 | 134753 | yy_accept(yypParser); |
| 134116 | 134754 | } |
| 134117 | 134755 | } |
| 134118 | 134756 | |
| 134119 | 134757 | /* |
| | @@ -134127,11 +134765,11 @@ |
| 134127 | 134765 | #ifndef NDEBUG |
| 134128 | 134766 | if( yyTraceFILE ){ |
| 134129 | 134767 | fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); |
| 134130 | 134768 | } |
| 134131 | 134769 | #endif |
| 134132 | | - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); |
| 134770 | + while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser); |
| 134133 | 134771 | /* Here code is inserted which will be executed whenever the |
| 134134 | 134772 | ** parser fails */ |
| 134135 | 134773 | /************ Begin %parse_failure code ***************************************/ |
| 134136 | 134774 | /************ End %parse_failure code *****************************************/ |
| 134137 | 134775 | sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ |
| | @@ -134167,11 +134805,14 @@ |
| 134167 | 134805 | #ifndef NDEBUG |
| 134168 | 134806 | if( yyTraceFILE ){ |
| 134169 | 134807 | fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); |
| 134170 | 134808 | } |
| 134171 | 134809 | #endif |
| 134172 | | - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); |
| 134810 | +#ifndef YYNOERRORRECOVERY |
| 134811 | + yypParser->yyerrcnt = -1; |
| 134812 | +#endif |
| 134813 | + assert( yypParser->yytos==yypParser->yystack ); |
| 134173 | 134814 | /* Here code is inserted which will be executed whenever the |
| 134174 | 134815 | ** parser accepts */ |
| 134175 | 134816 | /*********** Begin %parse_accept code *****************************************/ |
| 134176 | 134817 | /*********** End %parse_accept code *******************************************/ |
| 134177 | 134818 | sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ |
| | @@ -134210,32 +134851,12 @@ |
| 134210 | 134851 | #ifdef YYERRORSYMBOL |
| 134211 | 134852 | int yyerrorhit = 0; /* True if yymajor has invoked an error */ |
| 134212 | 134853 | #endif |
| 134213 | 134854 | yyParser *yypParser; /* The parser */ |
| 134214 | 134855 | |
| 134215 | | - /* (re)initialize the parser, if necessary */ |
| 134216 | 134856 | yypParser = (yyParser*)yyp; |
| 134217 | | - if( yypParser->yyidx<0 ){ |
| 134218 | | -#if YYSTACKDEPTH<=0 |
| 134219 | | - if( yypParser->yystksz <=0 ){ |
| 134220 | | - yyStackOverflow(yypParser); |
| 134221 | | - return; |
| 134222 | | - } |
| 134223 | | -#endif |
| 134224 | | - yypParser->yyidx = 0; |
| 134225 | | -#ifndef YYNOERRORRECOVERY |
| 134226 | | - yypParser->yyerrcnt = -1; |
| 134227 | | -#endif |
| 134228 | | - yypParser->yystack[0].stateno = 0; |
| 134229 | | - yypParser->yystack[0].major = 0; |
| 134230 | | -#ifndef NDEBUG |
| 134231 | | - if( yyTraceFILE ){ |
| 134232 | | - fprintf(yyTraceFILE,"%sInitialize. Empty stack. State 0\n", |
| 134233 | | - yyTracePrompt); |
| 134234 | | - } |
| 134235 | | -#endif |
| 134236 | | - } |
| 134857 | + assert( yypParser->yytos!=0 ); |
| 134237 | 134858 | #if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) |
| 134238 | 134859 | yyendofinput = (yymajor==0); |
| 134239 | 134860 | #endif |
| 134240 | 134861 | sqlite3ParserARG_STORE; |
| 134241 | 134862 | |
| | @@ -134246,11 +134867,10 @@ |
| 134246 | 134867 | #endif |
| 134247 | 134868 | |
| 134248 | 134869 | do{ |
| 134249 | 134870 | yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); |
| 134250 | 134871 | if( yyact <= YY_MAX_SHIFTREDUCE ){ |
| 134251 | | - if( yyact > YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; |
| 134252 | 134872 | yy_shift(yypParser,yyact,yymajor,yyminor); |
| 134253 | 134873 | #ifndef YYNOERRORRECOVERY |
| 134254 | 134874 | yypParser->yyerrcnt--; |
| 134255 | 134875 | #endif |
| 134256 | 134876 | yymajor = YYNOCODE; |
| | @@ -134288,11 +134908,11 @@ |
| 134288 | 134908 | ** |
| 134289 | 134909 | */ |
| 134290 | 134910 | if( yypParser->yyerrcnt<0 ){ |
| 134291 | 134911 | yy_syntax_error(yypParser,yymajor,yyminor); |
| 134292 | 134912 | } |
| 134293 | | - yymx = yypParser->yystack[yypParser->yyidx].major; |
| 134913 | + yymx = yypParser->yytos->major; |
| 134294 | 134914 | if( yymx==YYERRORSYMBOL || yyerrorhit ){ |
| 134295 | 134915 | #ifndef NDEBUG |
| 134296 | 134916 | if( yyTraceFILE ){ |
| 134297 | 134917 | fprintf(yyTraceFILE,"%sDiscard input token %s\n", |
| 134298 | 134918 | yyTracePrompt,yyTokenName[yymajor]); |
| | @@ -134299,22 +134919,24 @@ |
| 134299 | 134919 | } |
| 134300 | 134920 | #endif |
| 134301 | 134921 | yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); |
| 134302 | 134922 | yymajor = YYNOCODE; |
| 134303 | 134923 | }else{ |
| 134304 | | - while( |
| 134305 | | - yypParser->yyidx >= 0 && |
| 134306 | | - yymx != YYERRORSYMBOL && |
| 134307 | | - (yyact = yy_find_reduce_action( |
| 134308 | | - yypParser->yystack[yypParser->yyidx].stateno, |
| 134924 | + while( yypParser->yytos >= &yypParser->yystack |
| 134925 | + && yymx != YYERRORSYMBOL |
| 134926 | + && (yyact = yy_find_reduce_action( |
| 134927 | + yypParser->yytos->stateno, |
| 134309 | 134928 | YYERRORSYMBOL)) >= YY_MIN_REDUCE |
| 134310 | 134929 | ){ |
| 134311 | 134930 | yy_pop_parser_stack(yypParser); |
| 134312 | 134931 | } |
| 134313 | | - if( yypParser->yyidx < 0 || yymajor==0 ){ |
| 134932 | + if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ |
| 134314 | 134933 | yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); |
| 134315 | 134934 | yy_parse_failed(yypParser); |
| 134935 | +#ifndef YYNOERRORRECOVERY |
| 134936 | + yypParser->yyerrcnt = -1; |
| 134937 | +#endif |
| 134316 | 134938 | yymajor = YYNOCODE; |
| 134317 | 134939 | }else if( yymx!=YYERRORSYMBOL ){ |
| 134318 | 134940 | yy_shift(yypParser,yyact,YYERRORSYMBOL,yyminor); |
| 134319 | 134941 | } |
| 134320 | 134942 | } |
| | @@ -134347,22 +134969,27 @@ |
| 134347 | 134969 | } |
| 134348 | 134970 | yypParser->yyerrcnt = 3; |
| 134349 | 134971 | yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); |
| 134350 | 134972 | if( yyendofinput ){ |
| 134351 | 134973 | yy_parse_failed(yypParser); |
| 134974 | +#ifndef YYNOERRORRECOVERY |
| 134975 | + yypParser->yyerrcnt = -1; |
| 134976 | +#endif |
| 134352 | 134977 | } |
| 134353 | 134978 | yymajor = YYNOCODE; |
| 134354 | 134979 | #endif |
| 134355 | 134980 | } |
| 134356 | | - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); |
| 134981 | + }while( yymajor!=YYNOCODE && yypParser->yytos>yypParser->yystack ); |
| 134357 | 134982 | #ifndef NDEBUG |
| 134358 | 134983 | if( yyTraceFILE ){ |
| 134359 | | - int i; |
| 134984 | + yyStackEntry *i; |
| 134985 | + char cDiv = '['; |
| 134360 | 134986 | fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt); |
| 134361 | | - for(i=1; i<=yypParser->yyidx; i++) |
| 134362 | | - fprintf(yyTraceFILE,"%c%s", i==1 ? '[' : ' ', |
| 134363 | | - yyTokenName[yypParser->yystack[i].major]); |
| 134987 | + for(i=&yypParser->yystack[1]; i<=yypParser->yytos; i++){ |
| 134988 | + fprintf(yyTraceFILE,"%c%s", cDiv, yyTokenName[i->major]); |
| 134989 | + cDiv = ' '; |
| 134990 | + } |
| 134364 | 134991 | fprintf(yyTraceFILE,"]\n"); |
| 134365 | 134992 | } |
| 134366 | 134993 | #endif |
| 134367 | 134994 | return; |
| 134368 | 134995 | } |
| | @@ -136680,10 +137307,13 @@ |
| 136680 | 137307 | } |
| 136681 | 137308 | if( !sqlite3SafetyCheckSickOrOk(db) ){ |
| 136682 | 137309 | return SQLITE_MISUSE_BKPT; |
| 136683 | 137310 | } |
| 136684 | 137311 | sqlite3_mutex_enter(db->mutex); |
| 137312 | + if( db->mTrace & SQLITE_TRACE_CLOSE ){ |
| 137313 | + db->xTrace(SQLITE_TRACE_CLOSE, db->pTraceArg, db, 0); |
| 137314 | + } |
| 136685 | 137315 | |
| 136686 | 137316 | /* Force xDisconnect calls on all virtual tables */ |
| 136687 | 137317 | disconnectAllVtab(db); |
| 136688 | 137318 | |
| 136689 | 137319 | /* If a transaction is open, the disconnectAllVtab() call above |
| | @@ -137448,11 +138078,12 @@ |
| 137448 | 138078 | ** |
| 137449 | 138079 | ** A NULL trace function means that no tracing is executes. A non-NULL |
| 137450 | 138080 | ** trace is a pointer to a function that is invoked at the start of each |
| 137451 | 138081 | ** SQL statement. |
| 137452 | 138082 | */ |
| 137453 | | -SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3 *db, void (*xTrace)(void*,const char*), void *pArg){ |
| 138083 | +#ifndef SQLITE_OMIT_DEPRECATED |
| 138084 | +SQLITE_API void *SQLITE_STDCALL sqlite3_trace(sqlite3 *db, void(*xTrace)(void*,const char*), void *pArg){ |
| 137454 | 138085 | void *pOld; |
| 137455 | 138086 | |
| 137456 | 138087 | #ifdef SQLITE_ENABLE_API_ARMOR |
| 137457 | 138088 | if( !sqlite3SafetyCheckOk(db) ){ |
| 137458 | 138089 | (void)SQLITE_MISUSE_BKPT; |
| | @@ -137459,15 +138090,39 @@ |
| 137459 | 138090 | return 0; |
| 137460 | 138091 | } |
| 137461 | 138092 | #endif |
| 137462 | 138093 | sqlite3_mutex_enter(db->mutex); |
| 137463 | 138094 | pOld = db->pTraceArg; |
| 137464 | | - db->xTrace = xTrace; |
| 138095 | + db->mTrace = xTrace ? SQLITE_TRACE_LEGACY : 0; |
| 138096 | + db->xTrace = (int(*)(u32,void*,void*,void*))xTrace; |
| 137465 | 138097 | db->pTraceArg = pArg; |
| 137466 | 138098 | sqlite3_mutex_leave(db->mutex); |
| 137467 | 138099 | return pOld; |
| 137468 | 138100 | } |
| 138101 | +#endif /* SQLITE_OMIT_DEPRECATED */ |
| 138102 | + |
| 138103 | +/* Register a trace callback using the version-2 interface. |
| 138104 | +*/ |
| 138105 | +SQLITE_API int SQLITE_STDCALL sqlite3_trace_v2( |
| 138106 | + sqlite3 *db, /* Trace this connection */ |
| 138107 | + unsigned mTrace, /* Mask of events to be traced */ |
| 138108 | + int(*xTrace)(unsigned,void*,void*,void*), /* Callback to invoke */ |
| 138109 | + void *pArg /* Context */ |
| 138110 | +){ |
| 138111 | +#ifdef SQLITE_ENABLE_API_ARMOR |
| 138112 | + if( !sqlite3SafetyCheckOk(db) ){ |
| 138113 | + return SQLITE_MISUSE_BKPT; |
| 138114 | + } |
| 138115 | +#endif |
| 138116 | + sqlite3_mutex_enter(db->mutex); |
| 138117 | + db->mTrace = mTrace; |
| 138118 | + db->xTrace = xTrace; |
| 138119 | + db->pTraceArg = pArg; |
| 138120 | + sqlite3_mutex_leave(db->mutex); |
| 138121 | + return SQLITE_OK; |
| 138122 | +} |
| 138123 | + |
| 137469 | 138124 | /* |
| 137470 | 138125 | ** Register a profile function. The pArg from the previously registered |
| 137471 | 138126 | ** profile function is returned. |
| 137472 | 138127 | ** |
| 137473 | 138128 | ** A NULL profile function means that no profiling is executes. A non-NULL |
| | @@ -161881,10 +162536,57 @@ |
| 161881 | 162536 | } |
| 161882 | 162537 | return f; |
| 161883 | 162538 | } |
| 161884 | 162539 | #endif /* !defined(SQLITE_RTREE_INT_ONLY) */ |
| 161885 | 162540 | |
| 162541 | +/* |
| 162542 | +** A constraint has failed while inserting a row into an rtree table. |
| 162543 | +** Assuming no OOM error occurs, this function sets the error message |
| 162544 | +** (at pRtree->base.zErrMsg) to an appropriate value and returns |
| 162545 | +** SQLITE_CONSTRAINT. |
| 162546 | +** |
| 162547 | +** Parameter iCol is the index of the leftmost column involved in the |
| 162548 | +** constraint failure. If it is 0, then the constraint that failed is |
| 162549 | +** the unique constraint on the id column. Otherwise, it is the rtree |
| 162550 | +** (c1<=c2) constraint on columns iCol and iCol+1 that has failed. |
| 162551 | +** |
| 162552 | +** If an OOM occurs, SQLITE_NOMEM is returned instead of SQLITE_CONSTRAINT. |
| 162553 | +*/ |
| 162554 | +static int rtreeConstraintError(Rtree *pRtree, int iCol){ |
| 162555 | + sqlite3_stmt *pStmt = 0; |
| 162556 | + char *zSql; |
| 162557 | + int rc; |
| 162558 | + |
| 162559 | + assert( iCol==0 || iCol%2 ); |
| 162560 | + zSql = sqlite3_mprintf("SELECT * FROM %Q.%Q", pRtree->zDb, pRtree->zName); |
| 162561 | + if( zSql ){ |
| 162562 | + rc = sqlite3_prepare_v2(pRtree->db, zSql, -1, &pStmt, 0); |
| 162563 | + }else{ |
| 162564 | + rc = SQLITE_NOMEM; |
| 162565 | + } |
| 162566 | + sqlite3_free(zSql); |
| 162567 | + |
| 162568 | + if( rc==SQLITE_OK ){ |
| 162569 | + if( iCol==0 ){ |
| 162570 | + const char *zCol = sqlite3_column_name(pStmt, 0); |
| 162571 | + pRtree->base.zErrMsg = sqlite3_mprintf( |
| 162572 | + "UNIQUE constraint failed: %s.%s", pRtree->zName, zCol |
| 162573 | + ); |
| 162574 | + }else{ |
| 162575 | + const char *zCol1 = sqlite3_column_name(pStmt, iCol); |
| 162576 | + const char *zCol2 = sqlite3_column_name(pStmt, iCol+1); |
| 162577 | + pRtree->base.zErrMsg = sqlite3_mprintf( |
| 162578 | + "rtree constraint failed: %s.(%s<=%s)", pRtree->zName, zCol1, zCol2 |
| 162579 | + ); |
| 162580 | + } |
| 162581 | + } |
| 162582 | + |
| 162583 | + sqlite3_finalize(pStmt); |
| 162584 | + return (rc==SQLITE_OK ? SQLITE_CONSTRAINT : rc); |
| 162585 | +} |
| 162586 | + |
| 162587 | + |
| 161886 | 162588 | |
| 161887 | 162589 | /* |
| 161888 | 162590 | ** The xUpdate method for rtree module virtual tables. |
| 161889 | 162591 | */ |
| 161890 | 162592 | static int rtreeUpdate( |
| | @@ -161931,11 +162633,11 @@ |
| 161931 | 162633 | if( pRtree->eCoordType==RTREE_COORD_REAL32 ){ |
| 161932 | 162634 | for(ii=0; ii<nData-4; ii+=2){ |
| 161933 | 162635 | cell.aCoord[ii].f = rtreeValueDown(azData[ii+3]); |
| 161934 | 162636 | cell.aCoord[ii+1].f = rtreeValueUp(azData[ii+4]); |
| 161935 | 162637 | if( cell.aCoord[ii].f>cell.aCoord[ii+1].f ){ |
| 161936 | | - rc = SQLITE_CONSTRAINT; |
| 162638 | + rc = rtreeConstraintError(pRtree, ii+1); |
| 161937 | 162639 | goto constraint; |
| 161938 | 162640 | } |
| 161939 | 162641 | } |
| 161940 | 162642 | }else |
| 161941 | 162643 | #endif |
| | @@ -161942,11 +162644,11 @@ |
| 161942 | 162644 | { |
| 161943 | 162645 | for(ii=0; ii<nData-4; ii+=2){ |
| 161944 | 162646 | cell.aCoord[ii].i = sqlite3_value_int(azData[ii+3]); |
| 161945 | 162647 | cell.aCoord[ii+1].i = sqlite3_value_int(azData[ii+4]); |
| 161946 | 162648 | if( cell.aCoord[ii].i>cell.aCoord[ii+1].i ){ |
| 161947 | | - rc = SQLITE_CONSTRAINT; |
| 162649 | + rc = rtreeConstraintError(pRtree, ii+1); |
| 161948 | 162650 | goto constraint; |
| 161949 | 162651 | } |
| 161950 | 162652 | } |
| 161951 | 162653 | } |
| 161952 | 162654 | |
| | @@ -161963,11 +162665,11 @@ |
| 161963 | 162665 | rc = sqlite3_reset(pRtree->pReadRowid); |
| 161964 | 162666 | if( SQLITE_ROW==steprc ){ |
| 161965 | 162667 | if( sqlite3_vtab_on_conflict(pRtree->db)==SQLITE_REPLACE ){ |
| 161966 | 162668 | rc = rtreeDeleteRowid(pRtree, cell.iRowid); |
| 161967 | 162669 | }else{ |
| 161968 | | - rc = SQLITE_CONSTRAINT; |
| 162670 | + rc = rtreeConstraintError(pRtree, 0); |
| 161969 | 162671 | goto constraint; |
| 161970 | 162672 | } |
| 161971 | 162673 | } |
| 161972 | 162674 | } |
| 161973 | 162675 | bHaveRowid = 1; |
| | @@ -162046,10 +162748,15 @@ |
| 162046 | 162748 | char *zSql; |
| 162047 | 162749 | sqlite3_stmt *p; |
| 162048 | 162750 | int rc; |
| 162049 | 162751 | i64 nRow = 0; |
| 162050 | 162752 | |
| 162753 | + if( sqlite3_table_column_metadata(db,pRtree->zDb,"sqlite_stat1", |
| 162754 | + 0,0,0,0,0,0)==SQLITE_ERROR ){ |
| 162755 | + pRtree->nRowEst = RTREE_DEFAULT_ROWEST; |
| 162756 | + return SQLITE_OK; |
| 162757 | + } |
| 162051 | 162758 | zSql = sqlite3_mprintf(zFmt, pRtree->zDb, pRtree->zName); |
| 162052 | 162759 | if( zSql==0 ){ |
| 162053 | 162760 | rc = SQLITE_NOMEM; |
| 162054 | 162761 | }else{ |
| 162055 | 162762 | rc = sqlite3_prepare_v2(db, zSql, -1, &p, 0); |
| | @@ -163977,10 +164684,48 @@ |
| 163977 | 164684 | ** table exists but is not correctly populated, the value of the *pnOne |
| 163978 | 164685 | ** output variable during stage 1 is undefined. |
| 163979 | 164686 | */ |
| 163980 | 164687 | SQLITE_API void SQLITE_STDCALL sqlite3rbu_bp_progress(sqlite3rbu *pRbu, int *pnOne, int *pnTwo); |
| 163981 | 164688 | |
| 164689 | +/* |
| 164690 | +** Obtain an indication as to the current stage of an RBU update or vacuum. |
| 164691 | +** This function always returns one of the SQLITE_RBU_STATE_XXX constants |
| 164692 | +** defined in this file. Return values should be interpreted as follows: |
| 164693 | +** |
| 164694 | +** SQLITE_RBU_STATE_OAL: |
| 164695 | +** RBU is currently building a *-oal file. The next call to sqlite3rbu_step() |
| 164696 | +** may either add further data to the *-oal file, or compute data that will |
| 164697 | +** be added by a subsequent call. |
| 164698 | +** |
| 164699 | +** SQLITE_RBU_STATE_MOVE: |
| 164700 | +** RBU has finished building the *-oal file. The next call to sqlite3rbu_step() |
| 164701 | +** will move the *-oal file to the equivalent *-wal path. If the current |
| 164702 | +** operation is an RBU update, then the updated version of the database |
| 164703 | +** file will become visible to ordinary SQLite clients following the next |
| 164704 | +** call to sqlite3rbu_step(). |
| 164705 | +** |
| 164706 | +** SQLITE_RBU_STATE_CHECKPOINT: |
| 164707 | +** RBU is currently performing an incremental checkpoint. The next call to |
| 164708 | +** sqlite3rbu_step() will copy a page of data from the *-wal file into |
| 164709 | +** the target database file. |
| 164710 | +** |
| 164711 | +** SQLITE_RBU_STATE_DONE: |
| 164712 | +** The RBU operation has finished. Any subsequent calls to sqlite3rbu_step() |
| 164713 | +** will immediately return SQLITE_DONE. |
| 164714 | +** |
| 164715 | +** SQLITE_RBU_STATE_ERROR: |
| 164716 | +** An error has occurred. Any subsequent calls to sqlite3rbu_step() will |
| 164717 | +** immediately return the SQLite error code associated with the error. |
| 164718 | +*/ |
| 164719 | +#define SQLITE_RBU_STATE_OAL 1 |
| 164720 | +#define SQLITE_RBU_STATE_MOVE 2 |
| 164721 | +#define SQLITE_RBU_STATE_CHECKPOINT 3 |
| 164722 | +#define SQLITE_RBU_STATE_DONE 4 |
| 164723 | +#define SQLITE_RBU_STATE_ERROR 5 |
| 164724 | + |
| 164725 | +SQLITE_API int SQLITE_STDCALL sqlite3rbu_state(sqlite3rbu *pRbu); |
| 164726 | + |
| 163982 | 164727 | /* |
| 163983 | 164728 | ** Create an RBU VFS named zName that accesses the underlying file-system |
| 163984 | 164729 | ** via existing VFS zParent. Or, if the zParent parameter is passed NULL, |
| 163985 | 164730 | ** then the new RBU VFS uses the default system VFS to access the file-system. |
| 163986 | 164731 | ** The new object is registered as a non-default VFS with SQLite before |
| | @@ -164872,16 +165617,18 @@ |
| 164872 | 165617 | */ |
| 164873 | 165618 | static int rbuObjIterFirst(sqlite3rbu *p, RbuObjIter *pIter){ |
| 164874 | 165619 | int rc; |
| 164875 | 165620 | memset(pIter, 0, sizeof(RbuObjIter)); |
| 164876 | 165621 | |
| 164877 | | - rc = prepareAndCollectError(p->dbRbu, &pIter->pTblIter, &p->zErrmsg, |
| 165622 | + rc = prepareFreeAndCollectError(p->dbRbu, &pIter->pTblIter, &p->zErrmsg, |
| 165623 | + sqlite3_mprintf( |
| 164878 | 165624 | "SELECT rbu_target_name(name, type='view') AS target, name " |
| 164879 | 165625 | "FROM sqlite_master " |
| 164880 | 165626 | "WHERE type IN ('table', 'view') AND target IS NOT NULL " |
| 165627 | + " %s " |
| 164881 | 165628 | "ORDER BY name" |
| 164882 | | - ); |
| 165629 | + , rbuIsVacuum(p) ? "AND rootpage!=0 AND rootpage IS NOT NULL" : "")); |
| 164883 | 165630 | |
| 164884 | 165631 | if( rc==SQLITE_OK ){ |
| 164885 | 165632 | rc = prepareAndCollectError(p->dbMain, &pIter->pIdxIter, &p->zErrmsg, |
| 164886 | 165633 | "SELECT name, rootpage, sql IS NULL OR substr(8, 6)=='UNIQUE' " |
| 164887 | 165634 | " FROM main.sqlite_master " |
| | @@ -166456,13 +167203,13 @@ |
| 166456 | 167203 | #if SQLITE_ENABLE_8_3_NAMES<2 |
| 166457 | 167204 | if( sqlite3_uri_boolean(zBase, "8_3_names", 0) ) |
| 166458 | 167205 | #endif |
| 166459 | 167206 | { |
| 166460 | 167207 | int i, sz; |
| 166461 | | - sz = sqlite3Strlen30(z); |
| 167208 | + sz = (int)strlen(z)&0xffffff; |
| 166462 | 167209 | for(i=sz-1; i>0 && z[i]!='/' && z[i]!='.'; i--){} |
| 166463 | | - if( z[i]=='.' && ALWAYS(sz>i+4) ) memmove(&z[i+1], &z[sz-3], 4); |
| 167210 | + if( z[i]=='.' && sz>i+4 ) memmove(&z[i+1], &z[sz-3], 4); |
| 166464 | 167211 | } |
| 166465 | 167212 | #endif |
| 166466 | 167213 | } |
| 166467 | 167214 | |
| 166468 | 167215 | /* |
| | @@ -167504,34 +168251,11 @@ |
| 167504 | 168251 | } |
| 167505 | 168252 | |
| 167506 | 168253 | if( p->rc==SQLITE_OK ){ |
| 167507 | 168254 | if( p->eStage==RBU_STAGE_OAL ){ |
| 167508 | 168255 | sqlite3 *db = p->dbMain; |
| 167509 | | - |
| 167510 | | - if( pState->eStage==0 && rbuIsVacuum(p) ){ |
| 167511 | | - rbuCopyPragma(p, "page_size"); |
| 167512 | | - rbuCopyPragma(p, "auto_vacuum"); |
| 167513 | | - } |
| 167514 | | - |
| 167515 | | - /* Open transactions both databases. The *-oal file is opened or |
| 167516 | | - ** created at this point. */ |
| 167517 | | - if( p->rc==SQLITE_OK ){ |
| 167518 | | - p->rc = sqlite3_exec(db, "BEGIN IMMEDIATE", 0, 0, &p->zErrmsg); |
| 167519 | | - } |
| 167520 | | - if( p->rc==SQLITE_OK ){ |
| 167521 | | - p->rc = sqlite3_exec(p->dbRbu, "BEGIN", 0, 0, &p->zErrmsg); |
| 167522 | | - } |
| 167523 | | - |
| 167524 | | - /* Check if the main database is a zipvfs db. If it is, set the upper |
| 167525 | | - ** level pager to use "journal_mode=off". This prevents it from |
| 167526 | | - ** generating a large journal using a temp file. */ |
| 167527 | | - if( p->rc==SQLITE_OK ){ |
| 167528 | | - int frc = sqlite3_file_control(db, "main", SQLITE_FCNTL_ZIPVFS, 0); |
| 167529 | | - if( frc==SQLITE_OK ){ |
| 167530 | | - p->rc = sqlite3_exec(db, "PRAGMA journal_mode=off",0,0,&p->zErrmsg); |
| 167531 | | - } |
| 167532 | | - } |
| 168256 | + p->rc = sqlite3_exec(p->dbRbu, "BEGIN", 0, 0, &p->zErrmsg); |
| 167533 | 168257 | |
| 167534 | 168258 | /* Point the object iterator at the first object */ |
| 167535 | 168259 | if( p->rc==SQLITE_OK ){ |
| 167536 | 168260 | p->rc = rbuObjIterFirst(p, &p->objiter); |
| 167537 | 168261 | } |
| | @@ -167538,16 +168262,38 @@ |
| 167538 | 168262 | |
| 167539 | 168263 | /* If the RBU database contains no data_xxx tables, declare the RBU |
| 167540 | 168264 | ** update finished. */ |
| 167541 | 168265 | if( p->rc==SQLITE_OK && p->objiter.zTbl==0 ){ |
| 167542 | 168266 | p->rc = SQLITE_DONE; |
| 168267 | + p->eStage = RBU_STAGE_DONE; |
| 168268 | + }else{ |
| 168269 | + if( p->rc==SQLITE_OK && pState->eStage==0 && rbuIsVacuum(p) ){ |
| 168270 | + rbuCopyPragma(p, "page_size"); |
| 168271 | + rbuCopyPragma(p, "auto_vacuum"); |
| 168272 | + } |
| 168273 | + |
| 168274 | + /* Open transactions both databases. The *-oal file is opened or |
| 168275 | + ** created at this point. */ |
| 168276 | + if( p->rc==SQLITE_OK ){ |
| 168277 | + p->rc = sqlite3_exec(db, "BEGIN IMMEDIATE", 0, 0, &p->zErrmsg); |
| 168278 | + } |
| 168279 | + |
| 168280 | + /* Check if the main database is a zipvfs db. If it is, set the upper |
| 168281 | + ** level pager to use "journal_mode=off". This prevents it from |
| 168282 | + ** generating a large journal using a temp file. */ |
| 168283 | + if( p->rc==SQLITE_OK ){ |
| 168284 | + int frc = sqlite3_file_control(db, "main", SQLITE_FCNTL_ZIPVFS, 0); |
| 168285 | + if( frc==SQLITE_OK ){ |
| 168286 | + p->rc = sqlite3_exec( |
| 168287 | + db, "PRAGMA journal_mode=off",0,0,&p->zErrmsg); |
| 168288 | + } |
| 168289 | + } |
| 168290 | + |
| 168291 | + if( p->rc==SQLITE_OK ){ |
| 168292 | + rbuSetupOal(p, pState); |
| 168293 | + } |
| 167543 | 168294 | } |
| 167544 | | - |
| 167545 | | - if( p->rc==SQLITE_OK ){ |
| 167546 | | - rbuSetupOal(p, pState); |
| 167547 | | - } |
| 167548 | | - |
| 167549 | 168295 | }else if( p->eStage==RBU_STAGE_MOVE ){ |
| 167550 | 168296 | /* no-op */ |
| 167551 | 168297 | }else if( p->eStage==RBU_STAGE_CKPT ){ |
| 167552 | 168298 | rbuSetupCheckpoint(p, pState); |
| 167553 | 168299 | }else if( p->eStage==RBU_STAGE_DONE ){ |
| | @@ -167709,14 +168455,44 @@ |
| 167709 | 168455 | |
| 167710 | 168456 | default: |
| 167711 | 168457 | assert( 0 ); |
| 167712 | 168458 | } |
| 167713 | 168459 | } |
| 168460 | + |
| 168461 | +/* |
| 168462 | +** Return the current state of the RBU vacuum or update operation. |
| 168463 | +*/ |
| 168464 | +SQLITE_API int SQLITE_STDCALL sqlite3rbu_state(sqlite3rbu *p){ |
| 168465 | + int aRes[] = { |
| 168466 | + 0, SQLITE_RBU_STATE_OAL, SQLITE_RBU_STATE_MOVE, |
| 168467 | + 0, SQLITE_RBU_STATE_CHECKPOINT, SQLITE_RBU_STATE_DONE |
| 168468 | + }; |
| 168469 | + |
| 168470 | + assert( RBU_STAGE_OAL==1 ); |
| 168471 | + assert( RBU_STAGE_MOVE==2 ); |
| 168472 | + assert( RBU_STAGE_CKPT==4 ); |
| 168473 | + assert( RBU_STAGE_DONE==5 ); |
| 168474 | + assert( aRes[RBU_STAGE_OAL]==SQLITE_RBU_STATE_OAL ); |
| 168475 | + assert( aRes[RBU_STAGE_MOVE]==SQLITE_RBU_STATE_MOVE ); |
| 168476 | + assert( aRes[RBU_STAGE_CKPT]==SQLITE_RBU_STATE_CHECKPOINT ); |
| 168477 | + assert( aRes[RBU_STAGE_DONE]==SQLITE_RBU_STATE_DONE ); |
| 168478 | + |
| 168479 | + if( p->rc!=SQLITE_OK && p->rc!=SQLITE_DONE ){ |
| 168480 | + return SQLITE_RBU_STATE_ERROR; |
| 168481 | + }else{ |
| 168482 | + assert( p->rc!=SQLITE_DONE || p->eStage==RBU_STAGE_DONE ); |
| 168483 | + assert( p->eStage==RBU_STAGE_OAL |
| 168484 | + || p->eStage==RBU_STAGE_MOVE |
| 168485 | + || p->eStage==RBU_STAGE_CKPT |
| 168486 | + || p->eStage==RBU_STAGE_DONE |
| 168487 | + ); |
| 168488 | + return aRes[p->eStage]; |
| 168489 | + } |
| 168490 | +} |
| 167714 | 168491 | |
| 167715 | 168492 | SQLITE_API int SQLITE_STDCALL sqlite3rbu_savestate(sqlite3rbu *p){ |
| 167716 | 168493 | int rc = p->rc; |
| 167717 | | - |
| 167718 | 168494 | if( rc==SQLITE_DONE ) return SQLITE_OK; |
| 167719 | 168495 | |
| 167720 | 168496 | assert( p->eStage>=RBU_STAGE_OAL && p->eStage<=RBU_STAGE_DONE ); |
| 167721 | 168497 | if( p->eStage==RBU_STAGE_OAL ){ |
| 167722 | 168498 | assert( rc!=SQLITE_DONE ); |
| | @@ -168694,14 +169470,14 @@ |
| 168694 | 169470 | ** |
| 168695 | 169471 | ** '/1c2/000/' // Left-most child of 451st child of root |
| 168696 | 169472 | */ |
| 168697 | 169473 | #define VTAB_SCHEMA \ |
| 168698 | 169474 | "CREATE TABLE xx( " \ |
| 168699 | | - " name STRING, /* Name of table or index */" \ |
| 168700 | | - " path INTEGER, /* Path to page from root */" \ |
| 169475 | + " name TEXT, /* Name of table or index */" \ |
| 169476 | + " path TEXT, /* Path to page from root */" \ |
| 168701 | 169477 | " pageno INTEGER, /* Page number */" \ |
| 168702 | | - " pagetype STRING, /* 'internal', 'leaf' or 'overflow' */" \ |
| 169478 | + " pagetype TEXT, /* 'internal', 'leaf' or 'overflow' */" \ |
| 168703 | 169479 | " ncell INTEGER, /* Cells on page (0 for overflow) */" \ |
| 168704 | 169480 | " payload INTEGER, /* Bytes of payload on this page */" \ |
| 168705 | 169481 | " unused INTEGER, /* Bytes of unused space on this page */" \ |
| 168706 | 169482 | " mx_payload INTEGER, /* Largest payload size of all cells */" \ |
| 168707 | 169483 | " pgoffset INTEGER, /* Offset of page in file */" \ |
| | @@ -175195,10 +175971,29 @@ |
| 175195 | 175971 | #endif /* SQLITE_DEBUG */ |
| 175196 | 175972 | |
| 175197 | 175973 | /**************************************************************************** |
| 175198 | 175974 | ** Scalar SQL function implementations |
| 175199 | 175975 | ****************************************************************************/ |
| 175976 | + |
| 175977 | +/* |
| 175978 | +** Implementation of the json_QUOTE(VALUE) function. Return a JSON value |
| 175979 | +** corresponding to the SQL value input. Mostly this means putting |
| 175980 | +** double-quotes around strings and returning the unquoted string "null" |
| 175981 | +** when given a NULL input. |
| 175982 | +*/ |
| 175983 | +static void jsonQuoteFunc( |
| 175984 | + sqlite3_context *ctx, |
| 175985 | + int argc, |
| 175986 | + sqlite3_value **argv |
| 175987 | +){ |
| 175988 | + JsonString jx; |
| 175989 | + |
| 175990 | + jsonInit(&jx, ctx); |
| 175991 | + jsonAppendValue(&jx, argv[0]); |
| 175992 | + jsonResult(&jx); |
| 175993 | + sqlite3_result_subtype(ctx, JSON_SUBTYPE); |
| 175994 | +} |
| 175200 | 175995 | |
| 175201 | 175996 | /* |
| 175202 | 175997 | ** Implementation of the json_array(VALUE,...) function. Return a JSON |
| 175203 | 175998 | ** array that contains all values given in arguments. Or if any argument |
| 175204 | 175999 | ** is a BLOB, throw an error. |
| | @@ -176109,10 +176904,11 @@ |
| 176109 | 176904 | { "json_array_length", 1, 0, jsonArrayLengthFunc }, |
| 176110 | 176905 | { "json_array_length", 2, 0, jsonArrayLengthFunc }, |
| 176111 | 176906 | { "json_extract", -1, 0, jsonExtractFunc }, |
| 176112 | 176907 | { "json_insert", -1, 0, jsonSetFunc }, |
| 176113 | 176908 | { "json_object", -1, 0, jsonObjectFunc }, |
| 176909 | + { "json_quote", 1, 0, jsonQuoteFunc }, |
| 176114 | 176910 | { "json_remove", -1, 0, jsonRemoveFunc }, |
| 176115 | 176911 | { "json_replace", -1, 0, jsonReplaceFunc }, |
| 176116 | 176912 | { "json_set", -1, 1, jsonSetFunc }, |
| 176117 | 176913 | { "json_type", 1, 0, jsonTypeFunc }, |
| 176118 | 176914 | { "json_type", 2, 0, jsonTypeFunc }, |
| | @@ -177458,11 +178254,10 @@ |
| 177458 | 178254 | static Fts5PoslistPopulator *sqlite3Fts5ExprClearPoslists(Fts5Expr*, int); |
| 177459 | 178255 | static int sqlite3Fts5ExprPopulatePoslists( |
| 177460 | 178256 | Fts5Config*, Fts5Expr*, Fts5PoslistPopulator*, int, const char*, int |
| 177461 | 178257 | ); |
| 177462 | 178258 | static void sqlite3Fts5ExprCheckPoslists(Fts5Expr*, i64); |
| 177463 | | -static void sqlite3Fts5ExprClearEof(Fts5Expr*); |
| 177464 | 178259 | |
| 177465 | 178260 | static int sqlite3Fts5ExprClonePhrase(Fts5Expr*, int, Fts5Expr**); |
| 177466 | 178261 | |
| 177467 | 178262 | static int sqlite3Fts5ExprPhraseCollist(Fts5Expr *, int, const u8 **, int *); |
| 177468 | 178263 | |
| | @@ -177874,21 +178669,22 @@ |
| 177874 | 178669 | typedef struct fts5yyStackEntry fts5yyStackEntry; |
| 177875 | 178670 | |
| 177876 | 178671 | /* The state of the parser is completely contained in an instance of |
| 177877 | 178672 | ** the following structure */ |
| 177878 | 178673 | struct fts5yyParser { |
| 177879 | | - int fts5yyidx; /* Index of top element in stack */ |
| 178674 | + fts5yyStackEntry *fts5yytos; /* Pointer to top element of the stack */ |
| 177880 | 178675 | #ifdef fts5YYTRACKMAXSTACKDEPTH |
| 177881 | | - int fts5yyidxMax; /* Maximum value of fts5yyidx */ |
| 178676 | + int fts5yyhwm; /* High-water mark of the stack */ |
| 177882 | 178677 | #endif |
| 177883 | 178678 | #ifndef fts5YYNOERRORRECOVERY |
| 177884 | 178679 | int fts5yyerrcnt; /* Shifts left before out of the error */ |
| 177885 | 178680 | #endif |
| 177886 | 178681 | sqlite3Fts5ParserARG_SDECL /* A place to hold %extra_argument */ |
| 177887 | 178682 | #if fts5YYSTACKDEPTH<=0 |
| 177888 | 178683 | int fts5yystksz; /* Current side of the stack */ |
| 177889 | 178684 | fts5yyStackEntry *fts5yystack; /* The parser's stack */ |
| 178685 | + fts5yyStackEntry fts5yystk0; /* First stack entry */ |
| 177890 | 178686 | #else |
| 177891 | 178687 | fts5yyStackEntry fts5yystack[fts5YYSTACKDEPTH]; /* The parser's stack */ |
| 177892 | 178688 | #endif |
| 177893 | 178689 | }; |
| 177894 | 178690 | typedef struct fts5yyParser fts5yyParser; |
| | @@ -177971,28 +178767,38 @@ |
| 177971 | 178767 | #endif /* NDEBUG */ |
| 177972 | 178768 | |
| 177973 | 178769 | |
| 177974 | 178770 | #if fts5YYSTACKDEPTH<=0 |
| 177975 | 178771 | /* |
| 177976 | | -** Try to increase the size of the parser stack. |
| 178772 | +** Try to increase the size of the parser stack. Return the number |
| 178773 | +** of errors. Return 0 on success. |
| 177977 | 178774 | */ |
| 177978 | | -static void fts5yyGrowStack(fts5yyParser *p){ |
| 178775 | +static int fts5yyGrowStack(fts5yyParser *p){ |
| 177979 | 178776 | int newSize; |
| 178777 | + int idx; |
| 177980 | 178778 | fts5yyStackEntry *pNew; |
| 177981 | 178779 | |
| 177982 | 178780 | newSize = p->fts5yystksz*2 + 100; |
| 177983 | | - pNew = realloc(p->fts5yystack, newSize*sizeof(pNew[0])); |
| 178781 | + idx = p->fts5yytos ? (int)(p->fts5yytos - p->fts5yystack) : 0; |
| 178782 | + if( p->fts5yystack==&p->fts5yystk0 ){ |
| 178783 | + pNew = malloc(newSize*sizeof(pNew[0])); |
| 178784 | + if( pNew ) pNew[0] = p->fts5yystk0; |
| 178785 | + }else{ |
| 178786 | + pNew = realloc(p->fts5yystack, newSize*sizeof(pNew[0])); |
| 178787 | + } |
| 177984 | 178788 | if( pNew ){ |
| 177985 | 178789 | p->fts5yystack = pNew; |
| 177986 | | - p->fts5yystksz = newSize; |
| 178790 | + p->fts5yytos = &p->fts5yystack[idx]; |
| 177987 | 178791 | #ifndef NDEBUG |
| 177988 | 178792 | if( fts5yyTraceFILE ){ |
| 177989 | | - fprintf(fts5yyTraceFILE,"%sStack grows to %d entries!\n", |
| 177990 | | - fts5yyTracePrompt, p->fts5yystksz); |
| 178793 | + fprintf(fts5yyTraceFILE,"%sStack grows from %d to %d entries.\n", |
| 178794 | + fts5yyTracePrompt, p->fts5yystksz, newSize); |
| 177991 | 178795 | } |
| 177992 | 178796 | #endif |
| 178797 | + p->fts5yystksz = newSize; |
| 177993 | 178798 | } |
| 178799 | + return pNew==0; |
| 177994 | 178800 | } |
| 177995 | 178801 | #endif |
| 177996 | 178802 | |
| 177997 | 178803 | /* Datatype of the argument to the memory allocated passed as the |
| 177998 | 178804 | ** second argument to sqlite3Fts5ParserAlloc() below. This can be changed by |
| | @@ -178017,19 +178823,28 @@ |
| 178017 | 178823 | */ |
| 178018 | 178824 | static void *sqlite3Fts5ParserAlloc(void *(*mallocProc)(fts5YYMALLOCARGTYPE)){ |
| 178019 | 178825 | fts5yyParser *pParser; |
| 178020 | 178826 | pParser = (fts5yyParser*)(*mallocProc)( (fts5YYMALLOCARGTYPE)sizeof(fts5yyParser) ); |
| 178021 | 178827 | if( pParser ){ |
| 178022 | | - pParser->fts5yyidx = -1; |
| 178023 | 178828 | #ifdef fts5YYTRACKMAXSTACKDEPTH |
| 178024 | | - pParser->fts5yyidxMax = 0; |
| 178829 | + pParser->fts5yyhwm = 0; |
| 178025 | 178830 | #endif |
| 178026 | 178831 | #if fts5YYSTACKDEPTH<=0 |
| 178832 | + pParser->fts5yytos = NULL; |
| 178027 | 178833 | pParser->fts5yystack = NULL; |
| 178028 | 178834 | pParser->fts5yystksz = 0; |
| 178029 | | - fts5yyGrowStack(pParser); |
| 178835 | + if( fts5yyGrowStack(pParser) ){ |
| 178836 | + pParser->fts5yystack = &pParser->fts5yystk0; |
| 178837 | + pParser->fts5yystksz = 1; |
| 178838 | + } |
| 178030 | 178839 | #endif |
| 178840 | +#ifndef fts5YYNOERRORRECOVERY |
| 178841 | + pParser->fts5yyerrcnt = -1; |
| 178842 | +#endif |
| 178843 | + pParser->fts5yytos = pParser->fts5yystack; |
| 178844 | + pParser->fts5yystack[0].stateno = 0; |
| 178845 | + pParser->fts5yystack[0].major = 0; |
| 178031 | 178846 | } |
| 178032 | 178847 | return pParser; |
| 178033 | 178848 | } |
| 178034 | 178849 | |
| 178035 | 178850 | /* The following function deletes the "minor type" or semantic value |
| | @@ -178097,12 +178912,13 @@ |
| 178097 | 178912 | ** If there is a destructor routine associated with the token which |
| 178098 | 178913 | ** is popped from the stack, then call it. |
| 178099 | 178914 | */ |
| 178100 | 178915 | static void fts5yy_pop_parser_stack(fts5yyParser *pParser){ |
| 178101 | 178916 | fts5yyStackEntry *fts5yytos; |
| 178102 | | - assert( pParser->fts5yyidx>=0 ); |
| 178103 | | - fts5yytos = &pParser->fts5yystack[pParser->fts5yyidx--]; |
| 178917 | + assert( pParser->fts5yytos!=0 ); |
| 178918 | + assert( pParser->fts5yytos > pParser->fts5yystack ); |
| 178919 | + fts5yytos = pParser->fts5yytos--; |
| 178104 | 178920 | #ifndef NDEBUG |
| 178105 | 178921 | if( fts5yyTraceFILE ){ |
| 178106 | 178922 | fprintf(fts5yyTraceFILE,"%sPopping %s\n", |
| 178107 | 178923 | fts5yyTracePrompt, |
| 178108 | 178924 | fts5yyTokenName[fts5yytos->major]); |
| | @@ -178125,13 +178941,13 @@ |
| 178125 | 178941 | ){ |
| 178126 | 178942 | fts5yyParser *pParser = (fts5yyParser*)p; |
| 178127 | 178943 | #ifndef fts5YYPARSEFREENEVERNULL |
| 178128 | 178944 | if( pParser==0 ) return; |
| 178129 | 178945 | #endif |
| 178130 | | - while( pParser->fts5yyidx>=0 ) fts5yy_pop_parser_stack(pParser); |
| 178946 | + while( pParser->fts5yytos>pParser->fts5yystack ) fts5yy_pop_parser_stack(pParser); |
| 178131 | 178947 | #if fts5YYSTACKDEPTH<=0 |
| 178132 | | - free(pParser->fts5yystack); |
| 178948 | + if( pParser->fts5yystack!=&pParser->fts5yystk0 ) free(pParser->fts5yystack); |
| 178133 | 178949 | #endif |
| 178134 | 178950 | (*freeProc)((void*)pParser); |
| 178135 | 178951 | } |
| 178136 | 178952 | |
| 178137 | 178953 | /* |
| | @@ -178138,11 +178954,11 @@ |
| 178138 | 178954 | ** Return the peak depth of the stack for a parser. |
| 178139 | 178955 | */ |
| 178140 | 178956 | #ifdef fts5YYTRACKMAXSTACKDEPTH |
| 178141 | 178957 | static int sqlite3Fts5ParserStackPeak(void *p){ |
| 178142 | 178958 | fts5yyParser *pParser = (fts5yyParser*)p; |
| 178143 | | - return pParser->fts5yyidxMax; |
| 178959 | + return pParser->fts5yyhwm; |
| 178144 | 178960 | } |
| 178145 | 178961 | #endif |
| 178146 | 178962 | |
| 178147 | 178963 | /* |
| 178148 | 178964 | ** Find the appropriate action for a parser given the terminal |
| | @@ -178151,11 +178967,11 @@ |
| 178151 | 178967 | static unsigned int fts5yy_find_shift_action( |
| 178152 | 178968 | fts5yyParser *pParser, /* The parser */ |
| 178153 | 178969 | fts5YYCODETYPE iLookAhead /* The look-ahead token */ |
| 178154 | 178970 | ){ |
| 178155 | 178971 | int i; |
| 178156 | | - int stateno = pParser->fts5yystack[pParser->fts5yyidx].stateno; |
| 178972 | + int stateno = pParser->fts5yytos->stateno; |
| 178157 | 178973 | |
| 178158 | 178974 | if( stateno>=fts5YY_MIN_REDUCE ) return stateno; |
| 178159 | 178975 | assert( stateno <= fts5YY_SHIFT_COUNT ); |
| 178160 | 178976 | do{ |
| 178161 | 178977 | i = fts5yy_shift_ofst[stateno]; |
| | @@ -178244,17 +179060,17 @@ |
| 178244 | 179060 | /* |
| 178245 | 179061 | ** The following routine is called if the stack overflows. |
| 178246 | 179062 | */ |
| 178247 | 179063 | static void fts5yyStackOverflow(fts5yyParser *fts5yypParser){ |
| 178248 | 179064 | sqlite3Fts5ParserARG_FETCH; |
| 178249 | | - fts5yypParser->fts5yyidx--; |
| 179065 | + fts5yypParser->fts5yytos--; |
| 178250 | 179066 | #ifndef NDEBUG |
| 178251 | 179067 | if( fts5yyTraceFILE ){ |
| 178252 | 179068 | fprintf(fts5yyTraceFILE,"%sStack Overflow!\n",fts5yyTracePrompt); |
| 178253 | 179069 | } |
| 178254 | 179070 | #endif |
| 178255 | | - while( fts5yypParser->fts5yyidx>=0 ) fts5yy_pop_parser_stack(fts5yypParser); |
| 179071 | + while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser); |
| 178256 | 179072 | /* Here code is inserted which will execute if the parser |
| 178257 | 179073 | ** stack every overflows */ |
| 178258 | 179074 | /******** Begin %stack_overflow code ******************************************/ |
| 178259 | 179075 | |
| 178260 | 179076 | sqlite3Fts5ParseError(pParse, "fts5: parser stack overflow"); |
| | @@ -178268,15 +179084,15 @@ |
| 178268 | 179084 | #ifndef NDEBUG |
| 178269 | 179085 | static void fts5yyTraceShift(fts5yyParser *fts5yypParser, int fts5yyNewState){ |
| 178270 | 179086 | if( fts5yyTraceFILE ){ |
| 178271 | 179087 | if( fts5yyNewState<fts5YYNSTATE ){ |
| 178272 | 179088 | fprintf(fts5yyTraceFILE,"%sShift '%s', go to state %d\n", |
| 178273 | | - fts5yyTracePrompt,fts5yyTokenName[fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx].major], |
| 179089 | + fts5yyTracePrompt,fts5yyTokenName[fts5yypParser->fts5yytos->major], |
| 178274 | 179090 | fts5yyNewState); |
| 178275 | 179091 | }else{ |
| 178276 | 179092 | fprintf(fts5yyTraceFILE,"%sShift '%s'\n", |
| 178277 | | - fts5yyTracePrompt,fts5yyTokenName[fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx].major]); |
| 179093 | + fts5yyTracePrompt,fts5yyTokenName[fts5yypParser->fts5yytos->major]); |
| 178278 | 179094 | } |
| 178279 | 179095 | } |
| 178280 | 179096 | } |
| 178281 | 179097 | #else |
| 178282 | 179098 | # define fts5yyTraceShift(X,Y) |
| | @@ -178290,31 +179106,34 @@ |
| 178290 | 179106 | int fts5yyNewState, /* The new state to shift in */ |
| 178291 | 179107 | int fts5yyMajor, /* The major token to shift in */ |
| 178292 | 179108 | sqlite3Fts5ParserFTS5TOKENTYPE fts5yyMinor /* The minor token to shift in */ |
| 178293 | 179109 | ){ |
| 178294 | 179110 | fts5yyStackEntry *fts5yytos; |
| 178295 | | - fts5yypParser->fts5yyidx++; |
| 179111 | + fts5yypParser->fts5yytos++; |
| 178296 | 179112 | #ifdef fts5YYTRACKMAXSTACKDEPTH |
| 178297 | | - if( fts5yypParser->fts5yyidx>fts5yypParser->fts5yyidxMax ){ |
| 178298 | | - fts5yypParser->fts5yyidxMax = fts5yypParser->fts5yyidx; |
| 179113 | + if( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)>fts5yypParser->fts5yyhwm ){ |
| 179114 | + fts5yypParser->fts5yyhwm++; |
| 179115 | + assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack) ); |
| 178299 | 179116 | } |
| 178300 | 179117 | #endif |
| 178301 | 179118 | #if fts5YYSTACKDEPTH>0 |
| 178302 | | - if( fts5yypParser->fts5yyidx>=fts5YYSTACKDEPTH ){ |
| 179119 | + if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5YYSTACKDEPTH] ){ |
| 178303 | 179120 | fts5yyStackOverflow(fts5yypParser); |
| 178304 | 179121 | return; |
| 178305 | 179122 | } |
| 178306 | 179123 | #else |
| 178307 | | - if( fts5yypParser->fts5yyidx>=fts5yypParser->fts5yystksz ){ |
| 178308 | | - fts5yyGrowStack(fts5yypParser); |
| 178309 | | - if( fts5yypParser->fts5yyidx>=fts5yypParser->fts5yystksz ){ |
| 179124 | + if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz] ){ |
| 179125 | + if( fts5yyGrowStack(fts5yypParser) ){ |
| 178310 | 179126 | fts5yyStackOverflow(fts5yypParser); |
| 178311 | 179127 | return; |
| 178312 | 179128 | } |
| 178313 | 179129 | } |
| 178314 | 179130 | #endif |
| 178315 | | - fts5yytos = &fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx]; |
| 179131 | + if( fts5yyNewState > fts5YY_MAX_SHIFT ){ |
| 179132 | + fts5yyNewState += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; |
| 179133 | + } |
| 179134 | + fts5yytos = fts5yypParser->fts5yytos; |
| 178316 | 179135 | fts5yytos->stateno = (fts5YYACTIONTYPE)fts5yyNewState; |
| 178317 | 179136 | fts5yytos->major = (fts5YYCODETYPE)fts5yyMajor; |
| 178318 | 179137 | fts5yytos->minor.fts5yy0 = fts5yyMinor; |
| 178319 | 179138 | fts5yyTraceShift(fts5yypParser, fts5yyNewState); |
| 178320 | 179139 | } |
| | @@ -178365,11 +179184,11 @@ |
| 178365 | 179184 | int fts5yygoto; /* The next state */ |
| 178366 | 179185 | int fts5yyact; /* The next action */ |
| 178367 | 179186 | fts5yyStackEntry *fts5yymsp; /* The top of the parser's stack */ |
| 178368 | 179187 | int fts5yysize; /* Amount to pop the stack */ |
| 178369 | 179188 | sqlite3Fts5ParserARG_FETCH; |
| 178370 | | - fts5yymsp = &fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx]; |
| 179189 | + fts5yymsp = fts5yypParser->fts5yytos; |
| 178371 | 179190 | #ifndef NDEBUG |
| 178372 | 179191 | if( fts5yyTraceFILE && fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) ){ |
| 178373 | 179192 | fts5yysize = fts5yyRuleInfo[fts5yyruleno].nrhs; |
| 178374 | 179193 | fprintf(fts5yyTraceFILE, "%sReduce [%s], go to state %d.\n", fts5yyTracePrompt, |
| 178375 | 179194 | fts5yyRuleName[fts5yyruleno], fts5yymsp[-fts5yysize].stateno); |
| | @@ -178379,26 +179198,27 @@ |
| 178379 | 179198 | /* Check that the stack is large enough to grow by a single entry |
| 178380 | 179199 | ** if the RHS of the rule is empty. This ensures that there is room |
| 178381 | 179200 | ** enough on the stack to push the LHS value */ |
| 178382 | 179201 | if( fts5yyRuleInfo[fts5yyruleno].nrhs==0 ){ |
| 178383 | 179202 | #ifdef fts5YYTRACKMAXSTACKDEPTH |
| 178384 | | - if( fts5yypParser->fts5yyidx>fts5yypParser->fts5yyidxMax ){ |
| 178385 | | - fts5yypParser->fts5yyidxMax = fts5yypParser->fts5yyidx; |
| 179203 | + if( (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)>fts5yypParser->fts5yyhwm ){ |
| 179204 | + fts5yypParser->fts5yyhwm++; |
| 179205 | + assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)); |
| 178386 | 179206 | } |
| 178387 | 179207 | #endif |
| 178388 | 179208 | #if fts5YYSTACKDEPTH>0 |
| 178389 | | - if( fts5yypParser->fts5yyidx>=fts5YYSTACKDEPTH-1 ){ |
| 179209 | + if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1] ){ |
| 178390 | 179210 | fts5yyStackOverflow(fts5yypParser); |
| 178391 | 179211 | return; |
| 178392 | 179212 | } |
| 178393 | 179213 | #else |
| 178394 | | - if( fts5yypParser->fts5yyidx>=fts5yypParser->fts5yystksz-1 ){ |
| 178395 | | - fts5yyGrowStack(fts5yypParser); |
| 178396 | | - if( fts5yypParser->fts5yyidx>=fts5yypParser->fts5yystksz-1 ){ |
| 179214 | + if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){ |
| 179215 | + if( fts5yyGrowStack(fts5yypParser) ){ |
| 178397 | 179216 | fts5yyStackOverflow(fts5yypParser); |
| 178398 | 179217 | return; |
| 178399 | 179218 | } |
| 179219 | + fts5yymsp = fts5yypParser->fts5yytos; |
| 178400 | 179220 | } |
| 178401 | 179221 | #endif |
| 178402 | 179222 | } |
| 178403 | 179223 | |
| 178404 | 179224 | switch( fts5yyruleno ){ |
| | @@ -178535,19 +179355,21 @@ |
| 178535 | 179355 | assert( fts5yyruleno<sizeof(fts5yyRuleInfo)/sizeof(fts5yyRuleInfo[0]) ); |
| 178536 | 179356 | fts5yygoto = fts5yyRuleInfo[fts5yyruleno].lhs; |
| 178537 | 179357 | fts5yysize = fts5yyRuleInfo[fts5yyruleno].nrhs; |
| 178538 | 179358 | fts5yyact = fts5yy_find_reduce_action(fts5yymsp[-fts5yysize].stateno,(fts5YYCODETYPE)fts5yygoto); |
| 178539 | 179359 | if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){ |
| 178540 | | - if( fts5yyact>fts5YY_MAX_SHIFT ) fts5yyact += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; |
| 178541 | | - fts5yypParser->fts5yyidx -= fts5yysize - 1; |
| 179360 | + if( fts5yyact>fts5YY_MAX_SHIFT ){ |
| 179361 | + fts5yyact += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; |
| 179362 | + } |
| 178542 | 179363 | fts5yymsp -= fts5yysize-1; |
| 179364 | + fts5yypParser->fts5yytos = fts5yymsp; |
| 178543 | 179365 | fts5yymsp->stateno = (fts5YYACTIONTYPE)fts5yyact; |
| 178544 | 179366 | fts5yymsp->major = (fts5YYCODETYPE)fts5yygoto; |
| 178545 | 179367 | fts5yyTraceShift(fts5yypParser, fts5yyact); |
| 178546 | 179368 | }else{ |
| 178547 | 179369 | assert( fts5yyact == fts5YY_ACCEPT_ACTION ); |
| 178548 | | - fts5yypParser->fts5yyidx -= fts5yysize; |
| 179370 | + fts5yypParser->fts5yytos -= fts5yysize; |
| 178549 | 179371 | fts5yy_accept(fts5yypParser); |
| 178550 | 179372 | } |
| 178551 | 179373 | } |
| 178552 | 179374 | |
| 178553 | 179375 | /* |
| | @@ -178561,11 +179383,11 @@ |
| 178561 | 179383 | #ifndef NDEBUG |
| 178562 | 179384 | if( fts5yyTraceFILE ){ |
| 178563 | 179385 | fprintf(fts5yyTraceFILE,"%sFail!\n",fts5yyTracePrompt); |
| 178564 | 179386 | } |
| 178565 | 179387 | #endif |
| 178566 | | - while( fts5yypParser->fts5yyidx>=0 ) fts5yy_pop_parser_stack(fts5yypParser); |
| 179388 | + while( fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ) fts5yy_pop_parser_stack(fts5yypParser); |
| 178567 | 179389 | /* Here code is inserted which will be executed whenever the |
| 178568 | 179390 | ** parser fails */ |
| 178569 | 179391 | /************ Begin %parse_failure code ***************************************/ |
| 178570 | 179392 | /************ End %parse_failure code *****************************************/ |
| 178571 | 179393 | sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ |
| | @@ -178602,11 +179424,14 @@ |
| 178602 | 179424 | #ifndef NDEBUG |
| 178603 | 179425 | if( fts5yyTraceFILE ){ |
| 178604 | 179426 | fprintf(fts5yyTraceFILE,"%sAccept!\n",fts5yyTracePrompt); |
| 178605 | 179427 | } |
| 178606 | 179428 | #endif |
| 178607 | | - while( fts5yypParser->fts5yyidx>=0 ) fts5yy_pop_parser_stack(fts5yypParser); |
| 179429 | +#ifndef fts5YYNOERRORRECOVERY |
| 179430 | + fts5yypParser->fts5yyerrcnt = -1; |
| 179431 | +#endif |
| 179432 | + assert( fts5yypParser->fts5yytos==fts5yypParser->fts5yystack ); |
| 178608 | 179433 | /* Here code is inserted which will be executed whenever the |
| 178609 | 179434 | ** parser accepts */ |
| 178610 | 179435 | /*********** Begin %parse_accept code *****************************************/ |
| 178611 | 179436 | /*********** End %parse_accept code *******************************************/ |
| 178612 | 179437 | sqlite3Fts5ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ |
| | @@ -178645,32 +179470,12 @@ |
| 178645 | 179470 | #ifdef fts5YYERRORSYMBOL |
| 178646 | 179471 | int fts5yyerrorhit = 0; /* True if fts5yymajor has invoked an error */ |
| 178647 | 179472 | #endif |
| 178648 | 179473 | fts5yyParser *fts5yypParser; /* The parser */ |
| 178649 | 179474 | |
| 178650 | | - /* (re)initialize the parser, if necessary */ |
| 178651 | 179475 | fts5yypParser = (fts5yyParser*)fts5yyp; |
| 178652 | | - if( fts5yypParser->fts5yyidx<0 ){ |
| 178653 | | -#if fts5YYSTACKDEPTH<=0 |
| 178654 | | - if( fts5yypParser->fts5yystksz <=0 ){ |
| 178655 | | - fts5yyStackOverflow(fts5yypParser); |
| 178656 | | - return; |
| 178657 | | - } |
| 178658 | | -#endif |
| 178659 | | - fts5yypParser->fts5yyidx = 0; |
| 178660 | | -#ifndef fts5YYNOERRORRECOVERY |
| 178661 | | - fts5yypParser->fts5yyerrcnt = -1; |
| 178662 | | -#endif |
| 178663 | | - fts5yypParser->fts5yystack[0].stateno = 0; |
| 178664 | | - fts5yypParser->fts5yystack[0].major = 0; |
| 178665 | | -#ifndef NDEBUG |
| 178666 | | - if( fts5yyTraceFILE ){ |
| 178667 | | - fprintf(fts5yyTraceFILE,"%sInitialize. Empty stack. State 0\n", |
| 178668 | | - fts5yyTracePrompt); |
| 178669 | | - } |
| 178670 | | -#endif |
| 178671 | | - } |
| 179476 | + assert( fts5yypParser->fts5yytos!=0 ); |
| 178672 | 179477 | #if !defined(fts5YYERRORSYMBOL) && !defined(fts5YYNOERRORRECOVERY) |
| 178673 | 179478 | fts5yyendofinput = (fts5yymajor==0); |
| 178674 | 179479 | #endif |
| 178675 | 179480 | sqlite3Fts5ParserARG_STORE; |
| 178676 | 179481 | |
| | @@ -178681,11 +179486,10 @@ |
| 178681 | 179486 | #endif |
| 178682 | 179487 | |
| 178683 | 179488 | do{ |
| 178684 | 179489 | fts5yyact = fts5yy_find_shift_action(fts5yypParser,(fts5YYCODETYPE)fts5yymajor); |
| 178685 | 179490 | if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){ |
| 178686 | | - if( fts5yyact > fts5YY_MAX_SHIFT ) fts5yyact += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; |
| 178687 | 179491 | fts5yy_shift(fts5yypParser,fts5yyact,fts5yymajor,fts5yyminor); |
| 178688 | 179492 | #ifndef fts5YYNOERRORRECOVERY |
| 178689 | 179493 | fts5yypParser->fts5yyerrcnt--; |
| 178690 | 179494 | #endif |
| 178691 | 179495 | fts5yymajor = fts5YYNOCODE; |
| | @@ -178723,11 +179527,11 @@ |
| 178723 | 179527 | ** |
| 178724 | 179528 | */ |
| 178725 | 179529 | if( fts5yypParser->fts5yyerrcnt<0 ){ |
| 178726 | 179530 | fts5yy_syntax_error(fts5yypParser,fts5yymajor,fts5yyminor); |
| 178727 | 179531 | } |
| 178728 | | - fts5yymx = fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx].major; |
| 179532 | + fts5yymx = fts5yypParser->fts5yytos->major; |
| 178729 | 179533 | if( fts5yymx==fts5YYERRORSYMBOL || fts5yyerrorhit ){ |
| 178730 | 179534 | #ifndef NDEBUG |
| 178731 | 179535 | if( fts5yyTraceFILE ){ |
| 178732 | 179536 | fprintf(fts5yyTraceFILE,"%sDiscard input token %s\n", |
| 178733 | 179537 | fts5yyTracePrompt,fts5yyTokenName[fts5yymajor]); |
| | @@ -178734,22 +179538,24 @@ |
| 178734 | 179538 | } |
| 178735 | 179539 | #endif |
| 178736 | 179540 | fts5yy_destructor(fts5yypParser, (fts5YYCODETYPE)fts5yymajor, &fts5yyminorunion); |
| 178737 | 179541 | fts5yymajor = fts5YYNOCODE; |
| 178738 | 179542 | }else{ |
| 178739 | | - while( |
| 178740 | | - fts5yypParser->fts5yyidx >= 0 && |
| 178741 | | - fts5yymx != fts5YYERRORSYMBOL && |
| 178742 | | - (fts5yyact = fts5yy_find_reduce_action( |
| 178743 | | - fts5yypParser->fts5yystack[fts5yypParser->fts5yyidx].stateno, |
| 179543 | + while( fts5yypParser->fts5yytos >= &fts5yypParser->fts5yystack |
| 179544 | + && fts5yymx != fts5YYERRORSYMBOL |
| 179545 | + && (fts5yyact = fts5yy_find_reduce_action( |
| 179546 | + fts5yypParser->fts5yytos->stateno, |
| 178744 | 179547 | fts5YYERRORSYMBOL)) >= fts5YY_MIN_REDUCE |
| 178745 | 179548 | ){ |
| 178746 | 179549 | fts5yy_pop_parser_stack(fts5yypParser); |
| 178747 | 179550 | } |
| 178748 | | - if( fts5yypParser->fts5yyidx < 0 || fts5yymajor==0 ){ |
| 179551 | + if( fts5yypParser->fts5yytos < fts5yypParser->fts5yystack || fts5yymajor==0 ){ |
| 178749 | 179552 | fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion); |
| 178750 | 179553 | fts5yy_parse_failed(fts5yypParser); |
| 179554 | +#ifndef fts5YYNOERRORRECOVERY |
| 179555 | + fts5yypParser->fts5yyerrcnt = -1; |
| 179556 | +#endif |
| 178751 | 179557 | fts5yymajor = fts5YYNOCODE; |
| 178752 | 179558 | }else if( fts5yymx!=fts5YYERRORSYMBOL ){ |
| 178753 | 179559 | fts5yy_shift(fts5yypParser,fts5yyact,fts5YYERRORSYMBOL,fts5yyminor); |
| 178754 | 179560 | } |
| 178755 | 179561 | } |
| | @@ -178782,22 +179588,27 @@ |
| 178782 | 179588 | } |
| 178783 | 179589 | fts5yypParser->fts5yyerrcnt = 3; |
| 178784 | 179590 | fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion); |
| 178785 | 179591 | if( fts5yyendofinput ){ |
| 178786 | 179592 | fts5yy_parse_failed(fts5yypParser); |
| 179593 | +#ifndef fts5YYNOERRORRECOVERY |
| 179594 | + fts5yypParser->fts5yyerrcnt = -1; |
| 179595 | +#endif |
| 178787 | 179596 | } |
| 178788 | 179597 | fts5yymajor = fts5YYNOCODE; |
| 178789 | 179598 | #endif |
| 178790 | 179599 | } |
| 178791 | | - }while( fts5yymajor!=fts5YYNOCODE && fts5yypParser->fts5yyidx>=0 ); |
| 179600 | + }while( fts5yymajor!=fts5YYNOCODE && fts5yypParser->fts5yytos>fts5yypParser->fts5yystack ); |
| 178792 | 179601 | #ifndef NDEBUG |
| 178793 | 179602 | if( fts5yyTraceFILE ){ |
| 178794 | | - int i; |
| 179603 | + fts5yyStackEntry *i; |
| 179604 | + char cDiv = '['; |
| 178795 | 179605 | fprintf(fts5yyTraceFILE,"%sReturn. Stack=",fts5yyTracePrompt); |
| 178796 | | - for(i=1; i<=fts5yypParser->fts5yyidx; i++) |
| 178797 | | - fprintf(fts5yyTraceFILE,"%c%s", i==1 ? '[' : ' ', |
| 178798 | | - fts5yyTokenName[fts5yypParser->fts5yystack[i].major]); |
| 179606 | + for(i=&fts5yypParser->fts5yystack[1]; i<=fts5yypParser->fts5yytos; i++){ |
| 179607 | + fprintf(fts5yyTraceFILE,"%c%s", cDiv, fts5yyTokenName[i->major]); |
| 179608 | + cDiv = ' '; |
| 179609 | + } |
| 178799 | 179610 | fprintf(fts5yyTraceFILE,"]\n"); |
| 178800 | 179611 | } |
| 178801 | 179612 | #endif |
| 178802 | 179613 | return; |
| 178803 | 179614 | } |
| | @@ -183337,21 +184148,10 @@ |
| 183337 | 184148 | |
| 183338 | 184149 | static void sqlite3Fts5ExprCheckPoslists(Fts5Expr *pExpr, i64 iRowid){ |
| 183339 | 184150 | fts5ExprCheckPoslists(pExpr->pRoot, iRowid); |
| 183340 | 184151 | } |
| 183341 | 184152 | |
| 183342 | | -static void fts5ExprClearEof(Fts5ExprNode *pNode){ |
| 183343 | | - int i; |
| 183344 | | - for(i=0; i<pNode->nChild; i++){ |
| 183345 | | - fts5ExprClearEof(pNode->apChild[i]); |
| 183346 | | - } |
| 183347 | | - pNode->bEof = 0; |
| 183348 | | -} |
| 183349 | | -static void sqlite3Fts5ExprClearEof(Fts5Expr *pExpr){ |
| 183350 | | - fts5ExprClearEof(pExpr->pRoot); |
| 183351 | | -} |
| 183352 | | - |
| 183353 | 184153 | /* |
| 183354 | 184154 | ** This function is only called for detail=columns tables. |
| 183355 | 184155 | */ |
| 183356 | 184156 | static int sqlite3Fts5ExprPhraseCollist( |
| 183357 | 184157 | Fts5Expr *pExpr, |
| | @@ -191565,11 +192365,10 @@ |
| 191565 | 192365 | assert( pCsr->iLastRowid==LARGEST_INT64 ); |
| 191566 | 192366 | assert( pCsr->iFirstRowid==SMALLEST_INT64 ); |
| 191567 | 192367 | pCsr->ePlan = FTS5_PLAN_SOURCE; |
| 191568 | 192368 | pCsr->pExpr = pTab->pSortCsr->pExpr; |
| 191569 | 192369 | rc = fts5CursorFirst(pTab, pCsr, bDesc); |
| 191570 | | - sqlite3Fts5ExprClearEof(pCsr->pExpr); |
| 191571 | 192370 | }else if( pMatch ){ |
| 191572 | 192371 | const char *zExpr = (const char*)sqlite3_value_text(apVal[0]); |
| 191573 | 192372 | if( zExpr==0 ) zExpr = ""; |
| 191574 | 192373 | |
| 191575 | 192374 | rc = fts5CursorParseRank(pConfig, pCsr, pRank); |
| | @@ -192994,11 +193793,11 @@ |
| 192994 | 193793 | int nArg, /* Number of args */ |
| 192995 | 193794 | sqlite3_value **apUnused /* Function arguments */ |
| 192996 | 193795 | ){ |
| 192997 | 193796 | assert( nArg==0 ); |
| 192998 | 193797 | UNUSED_PARAM2(nArg, apUnused); |
| 192999 | | - sqlite3_result_text(pCtx, "fts5: 2016-05-18 10:57:30 fc49f556e48970561d7ab6a2f24fdd7d9eb81ff2", -1, SQLITE_TRANSIENT); |
| 193798 | + sqlite3_result_text(pCtx, "fts5: 2016-07-22 21:35:38 f50a3fd6606c14b82c9b938bfca284d54b6c650f", -1, SQLITE_TRANSIENT); |
| 193000 | 193799 | } |
| 193001 | 193800 | |
| 193002 | 193801 | static int fts5Init(sqlite3 *db){ |
| 193003 | 193802 | static const sqlite3_module fts5Mod = { |
| 193004 | 193803 | /* iVersion */ 2, |
| | @@ -193359,11 +194158,15 @@ |
| 193359 | 194158 | ){ |
| 193360 | 194159 | int rc; |
| 193361 | 194160 | char *zErr = 0; |
| 193362 | 194161 | |
| 193363 | 194162 | rc = fts5ExecPrintf(pConfig->db, &zErr, "CREATE TABLE %Q.'%q_%q'(%s)%s", |
| 193364 | | - pConfig->zDb, pConfig->zName, zPost, zDefn, bWithout?" WITHOUT ROWID":"" |
| 194163 | + pConfig->zDb, pConfig->zName, zPost, zDefn, |
| 194164 | +#ifndef SQLITE_FTS5_NO_WITHOUT_ROWID |
| 194165 | + bWithout?" WITHOUT ROWID": |
| 194166 | +#endif |
| 194167 | + "" |
| 193365 | 194168 | ); |
| 193366 | 194169 | if( zErr ){ |
| 193367 | 194170 | *pzErr = sqlite3_mprintf( |
| 193368 | 194171 | "fts5: error creating shadow table %q_%s: %s", |
| 193369 | 194172 | pConfig->zName, zPost, zErr |
| 193370 | 194173 | |