| | @@ -1156,11 +1156,11 @@ |
| 1156 | 1156 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 1157 | 1157 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 1158 | 1158 | */ |
| 1159 | 1159 | #define SQLITE_VERSION "3.25.0" |
| 1160 | 1160 | #define SQLITE_VERSION_NUMBER 3025000 |
| 1161 | | -#define SQLITE_SOURCE_ID "2018-08-30 01:52:10 58078c0d2647a194279fa80e032670441b296ffc3acee692901faa5beca460b7" |
| 1161 | +#define SQLITE_SOURCE_ID "2018-09-06 18:56:36 91aab32e71fcb924e24c02d5f0901f7a474760fc993a7e7436e667512cf5d3c3" |
| 1162 | 1162 | |
| 1163 | 1163 | /* |
| 1164 | 1164 | ** CAPI3REF: Run-Time Library Version Numbers |
| 1165 | 1165 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 1166 | 1166 | ** |
| | @@ -1503,10 +1503,11 @@ |
| 1503 | 1503 | ** the most recent error can be obtained using |
| 1504 | 1504 | ** [sqlite3_extended_errcode()]. |
| 1505 | 1505 | */ |
| 1506 | 1506 | #define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8)) |
| 1507 | 1507 | #define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8)) |
| 1508 | +#define SQLITE_ERROR_SNAPSHOT (SQLITE_ERROR | (3<<8)) |
| 1508 | 1509 | #define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8)) |
| 1509 | 1510 | #define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8)) |
| 1510 | 1511 | #define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8)) |
| 1511 | 1512 | #define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8)) |
| 1512 | 1513 | #define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8)) |
| | @@ -10084,15 +10085,15 @@ |
| 10084 | 10085 | ** SQLITE_ERROR is returned if either of these conditions is violated, or |
| 10085 | 10086 | ** if schema S does not exist, or if the snapshot object is invalid. |
| 10086 | 10087 | ** |
| 10087 | 10088 | ** ^A call to sqlite3_snapshot_open() will fail to open if the specified |
| 10088 | 10089 | ** snapshot has been overwritten by a [checkpoint]. In this case |
| 10089 | | -** SQLITE_BUSY_SNAPSHOT is returned. |
| 10090 | +** SQLITE_ERROR_SNAPSHOT is returned. |
| 10090 | 10091 | ** |
| 10091 | 10092 | ** If there is already a read transaction open when this function is |
| 10092 | 10093 | ** invoked, then the same read transaction remains open (on the same |
| 10093 | | -** database snapshot) if SQLITE_ERROR, SQLITE_BUSY or SQLITE_BUSY_SNAPSHOT |
| 10094 | +** database snapshot) if SQLITE_ERROR, SQLITE_BUSY or SQLITE_ERROR_SNAPSHOT |
| 10094 | 10095 | ** is returned. If another error code - for example SQLITE_PROTOCOL or an |
| 10095 | 10096 | ** SQLITE_IOERR error code - is returned, then the final state of the |
| 10096 | 10097 | ** read transaction is undefined. If SQLITE_OK is returned, then the |
| 10097 | 10098 | ** read transaction is now open on database snapshot P. |
| 10098 | 10099 | ** |
| | @@ -14025,10 +14026,11 @@ |
| 14025 | 14026 | typedef struct Module Module; |
| 14026 | 14027 | typedef struct NameContext NameContext; |
| 14027 | 14028 | typedef struct Parse Parse; |
| 14028 | 14029 | typedef struct PreUpdate PreUpdate; |
| 14029 | 14030 | typedef struct PrintfArguments PrintfArguments; |
| 14031 | +typedef struct RenameToken RenameToken; |
| 14030 | 14032 | typedef struct RowSet RowSet; |
| 14031 | 14033 | typedef struct Savepoint Savepoint; |
| 14032 | 14034 | typedef struct Select Select; |
| 14033 | 14035 | typedef struct SQLiteThread SQLiteThread; |
| 14034 | 14036 | typedef struct SelectDest SelectDest; |
| | @@ -17010,13 +17012,15 @@ |
| 17010 | 17012 | |
| 17011 | 17013 | /* |
| 17012 | 17014 | ** Each token coming out of the lexer is an instance of |
| 17013 | 17015 | ** this structure. Tokens are also used as part of an expression. |
| 17014 | 17016 | ** |
| 17015 | | -** Note if Token.z==0 then Token.dyn and Token.n are undefined and |
| 17016 | | -** may contain random values. Do not make any assumptions about Token.dyn |
| 17017 | | -** and Token.n when Token.z==0. |
| 17017 | +** The memory that "z" points to is owned by other objects. Take care |
| 17018 | +** that the owner of the "z" string does not deallocate the string before |
| 17019 | +** the Token goes out of scope! Very often, the "z" points to some place |
| 17020 | +** in the middle of the Parse.zSql text. But it might also point to a |
| 17021 | +** static string. |
| 17018 | 17022 | */ |
| 17019 | 17023 | struct Token { |
| 17020 | 17024 | const char *z; /* Text of the token. Not NULL-terminated! */ |
| 17021 | 17025 | unsigned int n; /* Number of characters in this token */ |
| 17022 | 17026 | }; |
| | @@ -17817,12 +17821,14 @@ |
| 17817 | 17821 | |
| 17818 | 17822 | Token sLastToken; /* The last token parsed */ |
| 17819 | 17823 | ynVar nVar; /* Number of '?' variables seen in the SQL so far */ |
| 17820 | 17824 | u8 iPkSortOrder; /* ASC or DESC for INTEGER PRIMARY KEY */ |
| 17821 | 17825 | u8 explain; /* True if the EXPLAIN flag is found on the query */ |
| 17826 | +#if !(defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_OMIT_ALTERTABLE)) |
| 17827 | + u8 eParseMode; /* PARSE_MODE_XXX constant */ |
| 17828 | +#endif |
| 17822 | 17829 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 17823 | | - u8 declareVtab; /* True if inside sqlite3_declare_vtab() */ |
| 17824 | 17830 | int nVtabLock; /* Number of virtual tables to lock */ |
| 17825 | 17831 | #endif |
| 17826 | 17832 | int nHeight; /* Expression tree height of current sub-select */ |
| 17827 | 17833 | #ifndef SQLITE_OMIT_EXPLAIN |
| 17828 | 17834 | int addrExplain; /* Address of current OP_Explain opcode */ |
| | @@ -17829,10 +17835,11 @@ |
| 17829 | 17835 | #endif |
| 17830 | 17836 | VList *pVList; /* Mapping between variable names and numbers */ |
| 17831 | 17837 | Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */ |
| 17832 | 17838 | const char *zTail; /* All SQL text past the last semicolon parsed */ |
| 17833 | 17839 | Table *pNewTable; /* A table being constructed by CREATE TABLE */ |
| 17840 | + Index *pNewIndex; /* An index being constructed by CREATE INDEX */ |
| 17834 | 17841 | Trigger *pNewTrigger; /* Trigger under construct by a CREATE TRIGGER */ |
| 17835 | 17842 | const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */ |
| 17836 | 17843 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 17837 | 17844 | Token sArg; /* Complete text of a module argument */ |
| 17838 | 17845 | Table **apVtabLock; /* Pointer to virtual tables needing locking */ |
| | @@ -17839,11 +17846,19 @@ |
| 17839 | 17846 | #endif |
| 17840 | 17847 | Table *pZombieTab; /* List of Table objects to delete after code gen */ |
| 17841 | 17848 | TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */ |
| 17842 | 17849 | With *pWith; /* Current WITH clause, or NULL */ |
| 17843 | 17850 | With *pWithToFree; /* Free this WITH object at the end of the parse */ |
| 17851 | +#ifndef SQLITE_OMIT_ALTERTABLE |
| 17852 | + RenameToken *pRename; /* Tokens subject to renaming by ALTER TABLE */ |
| 17853 | +#endif |
| 17844 | 17854 | }; |
| 17855 | + |
| 17856 | +#define PARSE_MODE_NORMAL 0 |
| 17857 | +#define PARSE_MODE_DECLARE_VTAB 1 |
| 17858 | +#define PARSE_MODE_RENAME_COLUMN 2 |
| 17859 | +#define PARSE_MODE_RENAME_TABLE 3 |
| 17845 | 17860 | |
| 17846 | 17861 | /* |
| 17847 | 17862 | ** Sizes and pointers of various parts of the Parse object. |
| 17848 | 17863 | */ |
| 17849 | 17864 | #define PARSE_HDR_SZ offsetof(Parse,aTempReg) /* Recursive part w/o aColCache*/ |
| | @@ -17855,11 +17870,23 @@ |
| 17855 | 17870 | ** Return true if currently inside an sqlite3_declare_vtab() call. |
| 17856 | 17871 | */ |
| 17857 | 17872 | #ifdef SQLITE_OMIT_VIRTUALTABLE |
| 17858 | 17873 | #define IN_DECLARE_VTAB 0 |
| 17859 | 17874 | #else |
| 17860 | | - #define IN_DECLARE_VTAB (pParse->declareVtab) |
| 17875 | + #define IN_DECLARE_VTAB (pParse->eParseMode==PARSE_MODE_DECLARE_VTAB) |
| 17876 | +#endif |
| 17877 | + |
| 17878 | +#if defined(SQLITE_OMIT_ALTERTABLE) |
| 17879 | + #define IN_RENAME_OBJECT 0 |
| 17880 | +#else |
| 17881 | + #define IN_RENAME_OBJECT (pParse->eParseMode>=PARSE_MODE_RENAME_COLUMN) |
| 17882 | +#endif |
| 17883 | + |
| 17884 | +#if defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_OMIT_ALTERTABLE) |
| 17885 | + #define IN_SPECIAL_PARSE 0 |
| 17886 | +#else |
| 17887 | + #define IN_SPECIAL_PARSE (pParse->eParseMode!=PARSE_MODE_NORMAL) |
| 17861 | 17888 | #endif |
| 17862 | 17889 | |
| 17863 | 17890 | /* |
| 17864 | 17891 | ** An instance of the following structure can be declared on a stack and used |
| 17865 | 17892 | ** to save the Parse.zAuthContext value so that it can be restored later. |
| | @@ -18034,12 +18061,18 @@ |
| 18034 | 18061 | typedef struct { |
| 18035 | 18062 | sqlite3 *db; /* The database being initialized */ |
| 18036 | 18063 | char **pzErrMsg; /* Error message stored here */ |
| 18037 | 18064 | int iDb; /* 0 for main database. 1 for TEMP, 2.. for ATTACHed */ |
| 18038 | 18065 | int rc; /* Result code stored here */ |
| 18066 | + u32 mInitFlags; /* Flags controlling error messages */ |
| 18039 | 18067 | } InitData; |
| 18040 | 18068 | |
| 18069 | +/* |
| 18070 | +** Allowed values for mInitFlags |
| 18071 | +*/ |
| 18072 | +#define INITFLAG_AlterTable 0x0001 /* This is a reparse after ALTER TABLE */ |
| 18073 | + |
| 18041 | 18074 | /* |
| 18042 | 18075 | ** Structure containing global configuration data for the SQLite library. |
| 18043 | 18076 | ** |
| 18044 | 18077 | ** This structure also contains some state information. |
| 18045 | 18078 | */ |
| | @@ -18139,10 +18172,11 @@ |
| 18139 | 18172 | struct IdxExprTrans *pIdxTrans; /* Convert idxed expr to column */ |
| 18140 | 18173 | ExprList *pGroupBy; /* GROUP BY clause */ |
| 18141 | 18174 | Select *pSelect; /* HAVING to WHERE clause ctx */ |
| 18142 | 18175 | struct WindowRewrite *pRewrite; /* Window rewrite context */ |
| 18143 | 18176 | struct WhereConst *pConst; /* WHERE clause constants */ |
| 18177 | + struct RenameCtx *pRename; /* RENAME COLUMN context */ |
| 18144 | 18178 | } u; |
| 18145 | 18179 | }; |
| 18146 | 18180 | |
| 18147 | 18181 | /* Forward declarations */ |
| 18148 | 18182 | SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*); |
| | @@ -18338,13 +18372,11 @@ |
| 18338 | 18372 | # define sqlite3Isdigit(x) isdigit((unsigned char)(x)) |
| 18339 | 18373 | # define sqlite3Isxdigit(x) isxdigit((unsigned char)(x)) |
| 18340 | 18374 | # define sqlite3Tolower(x) tolower((unsigned char)(x)) |
| 18341 | 18375 | # define sqlite3Isquote(x) ((x)=='"'||(x)=='\''||(x)=='['||(x)=='`') |
| 18342 | 18376 | #endif |
| 18343 | | -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS |
| 18344 | 18377 | SQLITE_PRIVATE int sqlite3IsIdChar(u8); |
| 18345 | | -#endif |
| 18346 | 18378 | |
| 18347 | 18379 | /* |
| 18348 | 18380 | ** Internal function prototypes |
| 18349 | 18381 | */ |
| 18350 | 18382 | SQLITE_PRIVATE int sqlite3StrICmp(const char*,const char*); |
| | @@ -18505,10 +18537,11 @@ |
| 18505 | 18537 | SQLITE_PRIVATE void sqlite3ExprListSetSpan(Parse*,ExprList*,const char*,const char*); |
| 18506 | 18538 | SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3*, ExprList*); |
| 18507 | 18539 | SQLITE_PRIVATE u32 sqlite3ExprListFlags(const ExprList*); |
| 18508 | 18540 | SQLITE_PRIVATE int sqlite3Init(sqlite3*, char**); |
| 18509 | 18541 | SQLITE_PRIVATE int sqlite3InitCallback(void*, int, char**, char**); |
| 18542 | +SQLITE_PRIVATE int sqlite3InitOne(sqlite3*, int, char**, u32); |
| 18510 | 18543 | SQLITE_PRIVATE void sqlite3Pragma(Parse*,Token*,Token*,Token*,int); |
| 18511 | 18544 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 18512 | 18545 | SQLITE_PRIVATE Module *sqlite3PragmaVtabRegister(sqlite3*,const char *zName); |
| 18513 | 18546 | #endif |
| 18514 | 18547 | SQLITE_PRIVATE void sqlite3ResetAllSchemasOfConnection(sqlite3*); |
| | @@ -18575,20 +18608,21 @@ |
| 18575 | 18608 | SQLITE_PRIVATE int sqlite3DbMaskAllZero(yDbMask); |
| 18576 | 18609 | #endif |
| 18577 | 18610 | SQLITE_PRIVATE void sqlite3DropTable(Parse*, SrcList*, int, int); |
| 18578 | 18611 | SQLITE_PRIVATE void sqlite3CodeDropTable(Parse*, Table*, int, int); |
| 18579 | 18612 | SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3*, Table*); |
| 18613 | +SQLITE_PRIVATE void sqlite3FreeIndex(sqlite3*, Index*); |
| 18580 | 18614 | #ifndef SQLITE_OMIT_AUTOINCREMENT |
| 18581 | 18615 | SQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse); |
| 18582 | 18616 | SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse); |
| 18583 | 18617 | #else |
| 18584 | 18618 | # define sqlite3AutoincrementBegin(X) |
| 18585 | 18619 | # define sqlite3AutoincrementEnd(X) |
| 18586 | 18620 | #endif |
| 18587 | 18621 | SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int, Upsert*); |
| 18588 | 18622 | SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*); |
| 18589 | | -SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*); |
| 18623 | +SQLITE_PRIVATE IdList *sqlite3IdListAppend(Parse*, IdList*, Token*); |
| 18590 | 18624 | SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*); |
| 18591 | 18625 | SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int); |
| 18592 | 18626 | SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(sqlite3*, SrcList*, Token*, Token*); |
| 18593 | 18627 | SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*, |
| 18594 | 18628 | Token*, Select*, Expr*, IdList*); |
| | @@ -18746,16 +18780,16 @@ |
| 18746 | 18780 | SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect(Parse *, Trigger *, Table *, int, int, int); |
| 18747 | 18781 | void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*); |
| 18748 | 18782 | SQLITE_PRIVATE void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*); |
| 18749 | 18783 | SQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*, |
| 18750 | 18784 | const char*,const char*); |
| 18751 | | -SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(sqlite3*,Token*, IdList*, |
| 18785 | +SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(Parse*,Token*, IdList*, |
| 18752 | 18786 | Select*,u8,Upsert*, |
| 18753 | 18787 | const char*,const char*); |
| 18754 | | -SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(sqlite3*,Token*,ExprList*, Expr*, u8, |
| 18788 | +SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(Parse*,Token*,ExprList*, Expr*, u8, |
| 18755 | 18789 | const char*,const char*); |
| 18756 | | -SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(sqlite3*,Token*, Expr*, |
| 18790 | +SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(Parse*,Token*, Expr*, |
| 18757 | 18791 | const char*,const char*); |
| 18758 | 18792 | SQLITE_PRIVATE void sqlite3DeleteTrigger(sqlite3*, Trigger*); |
| 18759 | 18793 | SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*); |
| 18760 | 18794 | SQLITE_PRIVATE u32 sqlite3TriggerColmask(Parse*,Trigger*,ExprList*,int,int,Table*,int); |
| 18761 | 18795 | # define sqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p)) |
| | @@ -18919,10 +18953,11 @@ |
| 18919 | 18953 | #endif |
| 18920 | 18954 | SQLITE_PRIVATE void sqlite3RootPageMoved(sqlite3*, int, int, int); |
| 18921 | 18955 | SQLITE_PRIVATE void sqlite3Reindex(Parse*, Token*, Token*); |
| 18922 | 18956 | SQLITE_PRIVATE void sqlite3AlterFunctions(void); |
| 18923 | 18957 | SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*); |
| 18958 | +SQLITE_PRIVATE void sqlite3AlterRenameColumn(Parse*, SrcList*, Token*, Token*); |
| 18924 | 18959 | SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *); |
| 18925 | 18960 | SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...); |
| 18926 | 18961 | SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int); |
| 18927 | 18962 | SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr *, int, int); |
| 18928 | 18963 | SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*); |
| | @@ -18934,10 +18969,13 @@ |
| 18934 | 18969 | SQLITE_PRIVATE void sqlite3ResolveSelfReference(Parse*,Table*,int,Expr*,ExprList*); |
| 18935 | 18970 | SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*); |
| 18936 | 18971 | SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int); |
| 18937 | 18972 | SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *); |
| 18938 | 18973 | SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *); |
| 18974 | +SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse*, void*, Token*); |
| 18975 | +SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse*, void *pTo, void *pFrom); |
| 18976 | +SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse*, Expr*); |
| 18939 | 18977 | SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*); |
| 18940 | 18978 | SQLITE_PRIVATE char sqlite3AffinityType(const char*, Column*); |
| 18941 | 18979 | SQLITE_PRIVATE void sqlite3Analyze(Parse*, Token*, Token*); |
| 18942 | 18980 | SQLITE_PRIVATE int sqlite3InvokeBusyHandler(BusyHandler*, sqlite3_file*); |
| 18943 | 18981 | SQLITE_PRIVATE int sqlite3FindDb(sqlite3*, Token*); |
| | @@ -51028,12 +51066,16 @@ |
| 51028 | 51066 | ** containing the state of the Pager object passed as an argument. This |
| 51029 | 51067 | ** is intended to be used within debuggers. For example, as an alternative |
| 51030 | 51068 | ** to "print *pPager" in gdb: |
| 51031 | 51069 | ** |
| 51032 | 51070 | ** (gdb) printf "%s", print_pager_state(pPager) |
| 51071 | +** |
| 51072 | +** This routine has external linkage in order to suppress compiler warnings |
| 51073 | +** about an unused function. It is enclosed within SQLITE_DEBUG and so does |
| 51074 | +** not appear in normal builds. |
| 51033 | 51075 | */ |
| 51034 | | -static char *print_pager_state(Pager *p){ |
| 51076 | +char *print_pager_state(Pager *p){ |
| 51035 | 51077 | static char zRet[1024]; |
| 51036 | 51078 | |
| 51037 | 51079 | sqlite3_snprintf(1024, zRet, |
| 51038 | 51080 | "Filename: %s\n" |
| 51039 | 51081 | "State: %s errCode=%d\n" |
| | @@ -57308,17 +57350,10 @@ |
| 57308 | 57350 | ** |
| 57309 | 57351 | ** The returned indicate the current (possibly updated) journal-mode. |
| 57310 | 57352 | */ |
| 57311 | 57353 | SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){ |
| 57312 | 57354 | u8 eOld = pPager->journalMode; /* Prior journalmode */ |
| 57313 | | - |
| 57314 | | -#ifdef SQLITE_DEBUG |
| 57315 | | - /* The print_pager_state() routine is intended to be used by the debugger |
| 57316 | | - ** only. We invoke it once here to suppress a compiler warning. */ |
| 57317 | | - print_pager_state(pPager); |
| 57318 | | -#endif |
| 57319 | | - |
| 57320 | 57355 | |
| 57321 | 57356 | /* The eMode parameter is always valid */ |
| 57322 | 57357 | assert( eMode==PAGER_JOURNALMODE_DELETE |
| 57323 | 57358 | || eMode==PAGER_JOURNALMODE_TRUNCATE |
| 57324 | 57359 | || eMode==PAGER_JOURNALMODE_PERSIST |
| | @@ -57997,10 +58032,22 @@ |
| 57997 | 58032 | # define WALTRACE(X) if(sqlite3WalTrace) sqlite3DebugPrintf X |
| 57998 | 58033 | #else |
| 57999 | 58034 | # define WALTRACE(X) |
| 58000 | 58035 | #endif |
| 58001 | 58036 | |
| 58037 | +/* |
| 58038 | +** WAL mode depends on atomic aligned 32-bit loads and stores in a few |
| 58039 | +** places. The following macros try to make this explicit. |
| 58040 | +*/ |
| 58041 | +#if GCC_VESRION>=5004000 |
| 58042 | +# define AtomicLoad(PTR) __atomic_load_n((PTR),__ATOMIC_RELAXED) |
| 58043 | +# define AtomicStore(PTR,VAL) __atomic_store_n((PTR),(VAL),__ATOMIC_RELAXED) |
| 58044 | +#else |
| 58045 | +# define AtomicLoad(PTR) (*(PTR)) |
| 58046 | +# define AtomicStore(PTR,VAL) (*(PTR) = (VAL)) |
| 58047 | +#endif |
| 58048 | + |
| 58002 | 58049 | /* |
| 58003 | 58050 | ** The maximum (and only) versions of the wal and wal-index formats |
| 58004 | 58051 | ** that may be interpreted by this version of SQLite. |
| 58005 | 58052 | ** |
| 58006 | 58053 | ** If a client begins recovering a WAL file and finds that (a) the checksum |
| | @@ -60294,11 +60341,11 @@ |
| 60294 | 60341 | if( pWal->pSnapshot && pWal->pSnapshot->mxFrame<mxFrame ){ |
| 60295 | 60342 | mxFrame = pWal->pSnapshot->mxFrame; |
| 60296 | 60343 | } |
| 60297 | 60344 | #endif |
| 60298 | 60345 | for(i=1; i<WAL_NREADER; i++){ |
| 60299 | | - u32 thisMark = pInfo->aReadMark[i]; |
| 60346 | + u32 thisMark = AtomicLoad(pInfo->aReadMark+i); |
| 60300 | 60347 | if( mxReadMark<=thisMark && thisMark<=mxFrame ){ |
| 60301 | 60348 | assert( thisMark!=READMARK_NOT_USED ); |
| 60302 | 60349 | mxReadMark = thisMark; |
| 60303 | 60350 | mxI = i; |
| 60304 | 60351 | } |
| | @@ -60307,11 +60354,11 @@ |
| 60307 | 60354 | && (mxReadMark<mxFrame || mxI==0) |
| 60308 | 60355 | ){ |
| 60309 | 60356 | for(i=1; i<WAL_NREADER; i++){ |
| 60310 | 60357 | rc = walLockExclusive(pWal, WAL_READ_LOCK(i), 1); |
| 60311 | 60358 | if( rc==SQLITE_OK ){ |
| 60312 | | - mxReadMark = pInfo->aReadMark[i] = mxFrame; |
| 60359 | + mxReadMark = AtomicStore(pInfo->aReadMark+i,mxFrame); |
| 60313 | 60360 | mxI = i; |
| 60314 | 60361 | walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1); |
| 60315 | 60362 | break; |
| 60316 | 60363 | }else if( rc!=SQLITE_BUSY ){ |
| 60317 | 60364 | return rc; |
| | @@ -60359,13 +60406,13 @@ |
| 60359 | 60406 | ** frame pWal->hdr.mxFrame - then the client would incorrectly assume |
| 60360 | 60407 | ** that it can read version A from the database file. However, since |
| 60361 | 60408 | ** we can guarantee that the checkpointer that set nBackfill could not |
| 60362 | 60409 | ** see any pages past pWal->hdr.mxFrame, this problem does not come up. |
| 60363 | 60410 | */ |
| 60364 | | - pWal->minFrame = pInfo->nBackfill+1; |
| 60411 | + pWal->minFrame = AtomicLoad(&pInfo->nBackfill)+1; |
| 60365 | 60412 | walShmBarrier(pWal); |
| 60366 | | - if( pInfo->aReadMark[mxI]!=mxReadMark |
| 60413 | + if( AtomicLoad(pInfo->aReadMark+mxI)!=mxReadMark |
| 60367 | 60414 | || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) |
| 60368 | 60415 | ){ |
| 60369 | 60416 | walUnlockShared(pWal, WAL_READ_LOCK(mxI)); |
| 60370 | 60417 | return WAL_RETRY; |
| 60371 | 60418 | }else{ |
| | @@ -60522,21 +60569,21 @@ |
| 60522 | 60569 | |
| 60523 | 60570 | if( rc==SQLITE_OK ){ |
| 60524 | 60571 | /* Check that the wal file has not been wrapped. Assuming that it has |
| 60525 | 60572 | ** not, also check that no checkpointer has attempted to checkpoint any |
| 60526 | 60573 | ** frames beyond pSnapshot->mxFrame. If either of these conditions are |
| 60527 | | - ** true, return SQLITE_BUSY_SNAPSHOT. Otherwise, overwrite pWal->hdr |
| 60574 | + ** true, return SQLITE_ERROR_SNAPSHOT. Otherwise, overwrite pWal->hdr |
| 60528 | 60575 | ** with *pSnapshot and set *pChanged as appropriate for opening the |
| 60529 | 60576 | ** snapshot. */ |
| 60530 | 60577 | if( !memcmp(pSnapshot->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt)) |
| 60531 | 60578 | && pSnapshot->mxFrame>=pInfo->nBackfillAttempted |
| 60532 | 60579 | ){ |
| 60533 | 60580 | assert( pWal->readLock>0 ); |
| 60534 | 60581 | memcpy(&pWal->hdr, pSnapshot, sizeof(WalIndexHdr)); |
| 60535 | 60582 | *pChanged = bChanged; |
| 60536 | 60583 | }else{ |
| 60537 | | - rc = SQLITE_BUSY_SNAPSHOT; |
| 60584 | + rc = SQLITE_ERROR_SNAPSHOT; |
| 60538 | 60585 | } |
| 60539 | 60586 | |
| 60540 | 60587 | /* Release the shared CKPT lock obtained above. */ |
| 60541 | 60588 | walUnlockShared(pWal, WAL_CKPT_LOCK); |
| 60542 | 60589 | pWal->minFrame = 1; |
| | @@ -61529,11 +61576,11 @@ |
| 61529 | 61576 | if( rc==SQLITE_OK ){ |
| 61530 | 61577 | WalIndexHdr *pNew = (WalIndexHdr*)pSnapshot; |
| 61531 | 61578 | if( memcmp(pNew->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt)) |
| 61532 | 61579 | || pNew->mxFrame<walCkptInfo(pWal)->nBackfillAttempted |
| 61533 | 61580 | ){ |
| 61534 | | - rc = SQLITE_BUSY_SNAPSHOT; |
| 61581 | + rc = SQLITE_ERROR_SNAPSHOT; |
| 61535 | 61582 | walUnlockShared(pWal, WAL_CKPT_LOCK); |
| 61536 | 61583 | } |
| 61537 | 61584 | } |
| 61538 | 61585 | return rc; |
| 61539 | 61586 | } |
| | @@ -77145,11 +77192,10 @@ |
| 77145 | 77192 | ** and reset(). Inserts are grouped into a transaction. |
| 77146 | 77193 | */ |
| 77147 | 77194 | testcase( p->flags & MEM_Agg ); |
| 77148 | 77195 | testcase( p->flags & MEM_Dyn ); |
| 77149 | 77196 | testcase( p->xDel==sqlite3VdbeFrameMemDel ); |
| 77150 | | - testcase( p->flags & MEM_RowSet ); |
| 77151 | 77197 | if( p->flags&(MEM_Agg|MEM_Dyn) ){ |
| 77152 | 77198 | sqlite3VdbeMemRelease(p); |
| 77153 | 77199 | }else if( p->szMalloc ){ |
| 77154 | 77200 | sqlite3DbFreeNN(db, p->zMalloc); |
| 77155 | 77201 | p->szMalloc = 0; |
| | @@ -88319,11 +88365,12 @@ |
| 88319 | 88365 | } |
| 88320 | 88366 | |
| 88321 | 88367 | /* Opcode: ParseSchema P1 * * P4 * |
| 88322 | 88368 | ** |
| 88323 | 88369 | ** Read and parse all entries from the SQLITE_MASTER table of database P1 |
| 88324 | | -** that match the WHERE clause P4. |
| 88370 | +** that match the WHERE clause P4. If P4 is a NULL pointer, then the |
| 88371 | +** entire schema for P1 is reparsed. |
| 88325 | 88372 | ** |
| 88326 | 88373 | ** This opcode invokes the parser to create a new virtual machine, |
| 88327 | 88374 | ** then runs the new virtual machine. It is thus a re-entrant opcode. |
| 88328 | 88375 | */ |
| 88329 | 88376 | case OP_ParseSchema: { |
| | @@ -88343,11 +88390,21 @@ |
| 88343 | 88390 | #endif |
| 88344 | 88391 | |
| 88345 | 88392 | iDb = pOp->p1; |
| 88346 | 88393 | assert( iDb>=0 && iDb<db->nDb ); |
| 88347 | 88394 | assert( DbHasProperty(db, iDb, DB_SchemaLoaded) ); |
| 88348 | | - /* Used to be a conditional */ { |
| 88395 | + |
| 88396 | +#ifndef SQLITE_OMIT_ALTERTABLE |
| 88397 | + if( pOp->p4.z==0 ){ |
| 88398 | + sqlite3SchemaClear(db->aDb[iDb].pSchema); |
| 88399 | + db->mDbFlags &= ~DBFLAG_SchemaKnownOk; |
| 88400 | + rc = sqlite3InitOne(db, iDb, &p->zErrMsg, INITFLAG_AlterTable); |
| 88401 | + db->mDbFlags |= DBFLAG_SchemaChange; |
| 88402 | + p->expired = 0; |
| 88403 | + }else |
| 88404 | +#endif |
| 88405 | + { |
| 88349 | 88406 | zMaster = MASTER_NAME; |
| 88350 | 88407 | initData.db = db; |
| 88351 | 88408 | initData.iDb = pOp->p1; |
| 88352 | 88409 | initData.pzErrMsg = &p->zErrMsg; |
| 88353 | 88410 | zSql = sqlite3MPrintf(db, |
| | @@ -94301,10 +94358,13 @@ |
| 94301 | 94358 | const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName; |
| 94302 | 94359 | assert( zTabName!=0 ); |
| 94303 | 94360 | if( sqlite3StrICmp(zTabName, zTab)!=0 ){ |
| 94304 | 94361 | continue; |
| 94305 | 94362 | } |
| 94363 | + if( IN_RENAME_OBJECT && pItem->zAlias ){ |
| 94364 | + sqlite3RenameTokenRemap(pParse, 0, (void*)&pExpr->pTab); |
| 94365 | + } |
| 94306 | 94366 | } |
| 94307 | 94367 | if( 0==(cntTab++) ){ |
| 94308 | 94368 | pMatch = pItem; |
| 94309 | 94369 | } |
| 94310 | 94370 | for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){ |
| | @@ -94386,13 +94446,19 @@ |
| 94386 | 94446 | if( iCol<pTab->nCol ){ |
| 94387 | 94447 | cnt++; |
| 94388 | 94448 | #ifndef SQLITE_OMIT_UPSERT |
| 94389 | 94449 | if( pExpr->iTable==2 ){ |
| 94390 | 94450 | testcase( iCol==(-1) ); |
| 94391 | | - pExpr->iTable = pNC->uNC.pUpsert->regData + iCol; |
| 94392 | | - eNewExprOp = TK_REGISTER; |
| 94393 | | - ExprSetProperty(pExpr, EP_Alias); |
| 94451 | + if( IN_RENAME_OBJECT ){ |
| 94452 | + pExpr->iColumn = iCol; |
| 94453 | + pExpr->pTab = pTab; |
| 94454 | + eNewExprOp = TK_COLUMN; |
| 94455 | + }else{ |
| 94456 | + pExpr->iTable = pNC->uNC.pUpsert->regData + iCol; |
| 94457 | + eNewExprOp = TK_REGISTER; |
| 94458 | + ExprSetProperty(pExpr, EP_Alias); |
| 94459 | + } |
| 94394 | 94460 | }else |
| 94395 | 94461 | #endif /* SQLITE_OMIT_UPSERT */ |
| 94396 | 94462 | { |
| 94397 | 94463 | #ifndef SQLITE_OMIT_TRIGGER |
| 94398 | 94464 | if( iCol<0 ){ |
| | @@ -94473,10 +94539,13 @@ |
| 94473 | 94539 | } |
| 94474 | 94540 | resolveAlias(pParse, pEList, j, pExpr, "", nSubquery); |
| 94475 | 94541 | cnt = 1; |
| 94476 | 94542 | pMatch = 0; |
| 94477 | 94543 | assert( zTab==0 && zDb==0 ); |
| 94544 | + if( IN_RENAME_OBJECT ){ |
| 94545 | + sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr); |
| 94546 | + } |
| 94478 | 94547 | goto lookupname_end; |
| 94479 | 94548 | } |
| 94480 | 94549 | } |
| 94481 | 94550 | } |
| 94482 | 94551 | |
| | @@ -94700,21 +94769,28 @@ |
| 94700 | 94769 | if( pExpr->op==TK_ID ){ |
| 94701 | 94770 | zDb = 0; |
| 94702 | 94771 | zTable = 0; |
| 94703 | 94772 | zColumn = pExpr->u.zToken; |
| 94704 | 94773 | }else{ |
| 94774 | + Expr *pLeft = pExpr->pLeft; |
| 94705 | 94775 | notValid(pParse, pNC, "the \".\" operator", NC_IdxExpr); |
| 94706 | 94776 | pRight = pExpr->pRight; |
| 94707 | 94777 | if( pRight->op==TK_ID ){ |
| 94708 | 94778 | zDb = 0; |
| 94709 | | - zTable = pExpr->pLeft->u.zToken; |
| 94710 | | - zColumn = pRight->u.zToken; |
| 94711 | 94779 | }else{ |
| 94712 | 94780 | assert( pRight->op==TK_DOT ); |
| 94713 | | - zDb = pExpr->pLeft->u.zToken; |
| 94714 | | - zTable = pRight->pLeft->u.zToken; |
| 94715 | | - zColumn = pRight->pRight->u.zToken; |
| 94781 | + zDb = pLeft->u.zToken; |
| 94782 | + pLeft = pRight->pLeft; |
| 94783 | + pRight = pRight->pRight; |
| 94784 | + } |
| 94785 | + zTable = pLeft->u.zToken; |
| 94786 | + zColumn = pRight->u.zToken; |
| 94787 | + if( IN_RENAME_OBJECT ){ |
| 94788 | + sqlite3RenameTokenRemap(pParse, (void*)pExpr, (void*)pRight); |
| 94789 | + } |
| 94790 | + if( IN_RENAME_OBJECT ){ |
| 94791 | + sqlite3RenameTokenRemap(pParse, (void*)&pExpr->pTab, (void*)pLeft); |
| 94716 | 94792 | } |
| 94717 | 94793 | } |
| 94718 | 94794 | return lookupName(pParse, zDb, zTable, zColumn, pNC, pExpr); |
| 94719 | 94795 | } |
| 94720 | 94796 | |
| | @@ -94794,60 +94870,62 @@ |
| 94794 | 94870 | notValid(pParse, pNC, "non-deterministic functions", |
| 94795 | 94871 | NC_IdxExpr|NC_PartIdx); |
| 94796 | 94872 | } |
| 94797 | 94873 | } |
| 94798 | 94874 | |
| 94875 | + if( 0==IN_RENAME_OBJECT ){ |
| 94799 | 94876 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 94800 | | - assert( is_agg==0 || (pDef->funcFlags & SQLITE_FUNC_MINMAX) |
| 94877 | + assert( is_agg==0 || (pDef->funcFlags & SQLITE_FUNC_MINMAX) |
| 94801 | 94878 | || (pDef->xValue==0 && pDef->xInverse==0) |
| 94802 | 94879 | || (pDef->xValue && pDef->xInverse && pDef->xSFunc && pDef->xFinalize) |
| 94803 | | - ); |
| 94804 | | - if( pDef && pDef->xValue==0 && pExpr->pWin ){ |
| 94805 | | - sqlite3ErrorMsg(pParse, |
| 94806 | | - "%.*s() may not be used as a window function", nId, zId |
| 94807 | | - ); |
| 94808 | | - pNC->nErr++; |
| 94809 | | - }else if( |
| 94810 | | - (is_agg && (pNC->ncFlags & NC_AllowAgg)==0) |
| 94811 | | - || (is_agg && (pDef->funcFlags & SQLITE_FUNC_WINDOW) && !pExpr->pWin) |
| 94812 | | - || (is_agg && pExpr->pWin && (pNC->ncFlags & NC_AllowWin)==0) |
| 94813 | | - ){ |
| 94814 | | - const char *zType; |
| 94815 | | - if( (pDef->funcFlags & SQLITE_FUNC_WINDOW) || pExpr->pWin ){ |
| 94816 | | - zType = "window"; |
| 94817 | | - }else{ |
| 94818 | | - zType = "aggregate"; |
| 94819 | | - } |
| 94820 | | - sqlite3ErrorMsg(pParse, "misuse of %s function %.*s()", zType, nId,zId); |
| 94821 | | - pNC->nErr++; |
| 94822 | | - is_agg = 0; |
| 94823 | | - } |
| 94824 | | -#else |
| 94825 | | - if( (is_agg && (pNC->ncFlags & NC_AllowAgg)==0) ){ |
| 94826 | | - sqlite3ErrorMsg(pParse, "misuse of aggregate function %.*s()", nId,zId); |
| 94827 | | - pNC->nErr++; |
| 94828 | | - is_agg = 0; |
| 94829 | | - } |
| 94830 | | -#endif |
| 94831 | | - else if( no_such_func && pParse->db->init.busy==0 |
| 94880 | + ); |
| 94881 | + if( pDef && pDef->xValue==0 && pExpr->pWin ){ |
| 94882 | + sqlite3ErrorMsg(pParse, |
| 94883 | + "%.*s() may not be used as a window function", nId, zId |
| 94884 | + ); |
| 94885 | + pNC->nErr++; |
| 94886 | + }else if( |
| 94887 | + (is_agg && (pNC->ncFlags & NC_AllowAgg)==0) |
| 94888 | + || (is_agg && (pDef->funcFlags & SQLITE_FUNC_WINDOW) && !pExpr->pWin) |
| 94889 | + || (is_agg && pExpr->pWin && (pNC->ncFlags & NC_AllowWin)==0) |
| 94890 | + ){ |
| 94891 | + const char *zType; |
| 94892 | + if( (pDef->funcFlags & SQLITE_FUNC_WINDOW) || pExpr->pWin ){ |
| 94893 | + zType = "window"; |
| 94894 | + }else{ |
| 94895 | + zType = "aggregate"; |
| 94896 | + } |
| 94897 | + sqlite3ErrorMsg(pParse, "misuse of %s function %.*s()",zType,nId,zId); |
| 94898 | + pNC->nErr++; |
| 94899 | + is_agg = 0; |
| 94900 | + } |
| 94901 | +#else |
| 94902 | + if( (is_agg && (pNC->ncFlags & NC_AllowAgg)==0) ){ |
| 94903 | + sqlite3ErrorMsg(pParse,"misuse of aggregate function %.*s()",nId,zId); |
| 94904 | + pNC->nErr++; |
| 94905 | + is_agg = 0; |
| 94906 | + } |
| 94907 | +#endif |
| 94908 | + else if( no_such_func && pParse->db->init.busy==0 |
| 94832 | 94909 | #ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION |
| 94833 | | - && pParse->explain==0 |
| 94910 | + && pParse->explain==0 |
| 94834 | 94911 | #endif |
| 94835 | | - ){ |
| 94836 | | - sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId); |
| 94837 | | - pNC->nErr++; |
| 94838 | | - }else if( wrong_num_args ){ |
| 94839 | | - sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()", |
| 94840 | | - nId, zId); |
| 94841 | | - pNC->nErr++; |
| 94842 | | - } |
| 94843 | | - if( is_agg ){ |
| 94912 | + ){ |
| 94913 | + sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId); |
| 94914 | + pNC->nErr++; |
| 94915 | + }else if( wrong_num_args ){ |
| 94916 | + sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()", |
| 94917 | + nId, zId); |
| 94918 | + pNC->nErr++; |
| 94919 | + } |
| 94920 | + if( is_agg ){ |
| 94844 | 94921 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 94845 | | - pNC->ncFlags &= ~(pExpr->pWin ? NC_AllowWin : NC_AllowAgg); |
| 94922 | + pNC->ncFlags &= ~(pExpr->pWin ? NC_AllowWin : NC_AllowAgg); |
| 94846 | 94923 | #else |
| 94847 | | - pNC->ncFlags &= ~NC_AllowAgg; |
| 94924 | + pNC->ncFlags &= ~NC_AllowAgg; |
| 94848 | 94925 | #endif |
| 94926 | + } |
| 94849 | 94927 | } |
| 94850 | 94928 | sqlite3WalkExprList(pWalker, pList); |
| 94851 | 94929 | if( is_agg ){ |
| 94852 | 94930 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 94853 | 94931 | if( pExpr->pWin ){ |
| | @@ -97358,10 +97436,13 @@ |
| 97358 | 97436 | assert( pList->nExpr>0 ); |
| 97359 | 97437 | pItem = &pList->a[pList->nExpr-1]; |
| 97360 | 97438 | assert( pItem->zName==0 ); |
| 97361 | 97439 | pItem->zName = sqlite3DbStrNDup(pParse->db, pName->z, pName->n); |
| 97362 | 97440 | if( dequote ) sqlite3Dequote(pItem->zName); |
| 97441 | + if( IN_RENAME_OBJECT ){ |
| 97442 | + sqlite3RenameTokenMap(pParse, (void*)pItem->zName, pName); |
| 97443 | + } |
| 97363 | 97444 | } |
| 97364 | 97445 | } |
| 97365 | 97446 | |
| 97366 | 97447 | /* |
| 97367 | 97448 | ** Set the ExprList.a[].zSpan element of the most recently added item |
| | @@ -101056,356 +101137,10 @@ |
| 101056 | 101137 | ** The code in this file only exists if we are not omitting the |
| 101057 | 101138 | ** ALTER TABLE logic from the build. |
| 101058 | 101139 | */ |
| 101059 | 101140 | #ifndef SQLITE_OMIT_ALTERTABLE |
| 101060 | 101141 | |
| 101061 | | - |
| 101062 | | -/* |
| 101063 | | -** This function is used by SQL generated to implement the |
| 101064 | | -** ALTER TABLE command. The first argument is the text of a CREATE TABLE or |
| 101065 | | -** CREATE INDEX command. The second is a table name. The table name in |
| 101066 | | -** the CREATE TABLE or CREATE INDEX statement is replaced with the third |
| 101067 | | -** argument and the result returned. Examples: |
| 101068 | | -** |
| 101069 | | -** sqlite_rename_table('CREATE TABLE abc(a, b, c)', 'def') |
| 101070 | | -** -> 'CREATE TABLE def(a, b, c)' |
| 101071 | | -** |
| 101072 | | -** sqlite_rename_table('CREATE INDEX i ON abc(a)', 'def') |
| 101073 | | -** -> 'CREATE INDEX i ON def(a, b, c)' |
| 101074 | | -*/ |
| 101075 | | -static void renameTableFunc( |
| 101076 | | - sqlite3_context *context, |
| 101077 | | - int NotUsed, |
| 101078 | | - sqlite3_value **argv |
| 101079 | | -){ |
| 101080 | | - unsigned char const *zSql = sqlite3_value_text(argv[0]); |
| 101081 | | - unsigned char const *zTableName = sqlite3_value_text(argv[1]); |
| 101082 | | - |
| 101083 | | - int token; |
| 101084 | | - Token tname; |
| 101085 | | - unsigned char const *zCsr = zSql; |
| 101086 | | - int len = 0; |
| 101087 | | - char *zRet; |
| 101088 | | - |
| 101089 | | - sqlite3 *db = sqlite3_context_db_handle(context); |
| 101090 | | - |
| 101091 | | - UNUSED_PARAMETER(NotUsed); |
| 101092 | | - |
| 101093 | | - /* The principle used to locate the table name in the CREATE TABLE |
| 101094 | | - ** statement is that the table name is the first non-space token that |
| 101095 | | - ** is immediately followed by a TK_LP or TK_USING token. |
| 101096 | | - */ |
| 101097 | | - if( zSql ){ |
| 101098 | | - do { |
| 101099 | | - if( !*zCsr ){ |
| 101100 | | - /* Ran out of input before finding an opening bracket. Return NULL. */ |
| 101101 | | - return; |
| 101102 | | - } |
| 101103 | | - |
| 101104 | | - /* Store the token that zCsr points to in tname. */ |
| 101105 | | - tname.z = (char*)zCsr; |
| 101106 | | - tname.n = len; |
| 101107 | | - |
| 101108 | | - /* Advance zCsr to the next token. Store that token type in 'token', |
| 101109 | | - ** and its length in 'len' (to be used next iteration of this loop). |
| 101110 | | - */ |
| 101111 | | - do { |
| 101112 | | - zCsr += len; |
| 101113 | | - len = sqlite3GetToken(zCsr, &token); |
| 101114 | | - } while( token==TK_SPACE ); |
| 101115 | | - assert( len>0 || !*zCsr ); |
| 101116 | | - } while( token!=TK_LP && token!=TK_USING ); |
| 101117 | | - |
| 101118 | | - zRet = sqlite3MPrintf(db, "%.*s\"%w\"%s", (int)(((u8*)tname.z) - zSql), |
| 101119 | | - zSql, zTableName, tname.z+tname.n); |
| 101120 | | - sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC); |
| 101121 | | - } |
| 101122 | | -} |
| 101123 | | - |
| 101124 | | -/* |
| 101125 | | -** This C function implements an SQL user function that is used by SQL code |
| 101126 | | -** generated by the ALTER TABLE ... RENAME command to modify the definition |
| 101127 | | -** of any foreign key constraints that use the table being renamed as the |
| 101128 | | -** parent table. It is passed three arguments: |
| 101129 | | -** |
| 101130 | | -** 1) The complete text of the CREATE TABLE statement being modified, |
| 101131 | | -** 2) The old name of the table being renamed, and |
| 101132 | | -** 3) The new name of the table being renamed. |
| 101133 | | -** |
| 101134 | | -** It returns the new CREATE TABLE statement. For example: |
| 101135 | | -** |
| 101136 | | -** sqlite_rename_parent('CREATE TABLE t1(a REFERENCES t2)', 't2', 't3') |
| 101137 | | -** -> 'CREATE TABLE t1(a REFERENCES t3)' |
| 101138 | | -*/ |
| 101139 | | -#ifndef SQLITE_OMIT_FOREIGN_KEY |
| 101140 | | -static void renameParentFunc( |
| 101141 | | - sqlite3_context *context, |
| 101142 | | - int NotUsed, |
| 101143 | | - sqlite3_value **argv |
| 101144 | | -){ |
| 101145 | | - sqlite3 *db = sqlite3_context_db_handle(context); |
| 101146 | | - char *zOutput = 0; |
| 101147 | | - char *zResult; |
| 101148 | | - unsigned char const *zInput = sqlite3_value_text(argv[0]); |
| 101149 | | - unsigned char const *zOld = sqlite3_value_text(argv[1]); |
| 101150 | | - unsigned char const *zNew = sqlite3_value_text(argv[2]); |
| 101151 | | - |
| 101152 | | - unsigned const char *z; /* Pointer to token */ |
| 101153 | | - int n; /* Length of token z */ |
| 101154 | | - int token; /* Type of token */ |
| 101155 | | - |
| 101156 | | - UNUSED_PARAMETER(NotUsed); |
| 101157 | | - if( zInput==0 || zOld==0 ) return; |
| 101158 | | - for(z=zInput; *z; z=z+n){ |
| 101159 | | - n = sqlite3GetToken(z, &token); |
| 101160 | | - if( token==TK_REFERENCES ){ |
| 101161 | | - char *zParent; |
| 101162 | | - do { |
| 101163 | | - z += n; |
| 101164 | | - n = sqlite3GetToken(z, &token); |
| 101165 | | - }while( token==TK_SPACE ); |
| 101166 | | - |
| 101167 | | - if( token==TK_ILLEGAL ) break; |
| 101168 | | - zParent = sqlite3DbStrNDup(db, (const char *)z, n); |
| 101169 | | - if( zParent==0 ) break; |
| 101170 | | - sqlite3Dequote(zParent); |
| 101171 | | - if( 0==sqlite3StrICmp((const char *)zOld, zParent) ){ |
| 101172 | | - char *zOut = sqlite3MPrintf(db, "%s%.*s\"%w\"", |
| 101173 | | - (zOutput?zOutput:""), (int)(z-zInput), zInput, (const char *)zNew |
| 101174 | | - ); |
| 101175 | | - sqlite3DbFree(db, zOutput); |
| 101176 | | - zOutput = zOut; |
| 101177 | | - zInput = &z[n]; |
| 101178 | | - } |
| 101179 | | - sqlite3DbFree(db, zParent); |
| 101180 | | - } |
| 101181 | | - } |
| 101182 | | - |
| 101183 | | - zResult = sqlite3MPrintf(db, "%s%s", (zOutput?zOutput:""), zInput); |
| 101184 | | - sqlite3_result_text(context, zResult, -1, SQLITE_DYNAMIC); |
| 101185 | | - sqlite3DbFree(db, zOutput); |
| 101186 | | -} |
| 101187 | | -#endif |
| 101188 | | - |
| 101189 | | -#ifndef SQLITE_OMIT_TRIGGER |
| 101190 | | -/* This function is used by SQL generated to implement the |
| 101191 | | -** ALTER TABLE command. The first argument is the text of a CREATE TRIGGER |
| 101192 | | -** statement. The second is a table name. The table name in the CREATE |
| 101193 | | -** TRIGGER statement is replaced with the third argument and the result |
| 101194 | | -** returned. This is analagous to renameTableFunc() above, except for CREATE |
| 101195 | | -** TRIGGER, not CREATE INDEX and CREATE TABLE. |
| 101196 | | -*/ |
| 101197 | | -static void renameTriggerFunc( |
| 101198 | | - sqlite3_context *context, |
| 101199 | | - int NotUsed, |
| 101200 | | - sqlite3_value **argv |
| 101201 | | -){ |
| 101202 | | - unsigned char const *zSql = sqlite3_value_text(argv[0]); |
| 101203 | | - unsigned char const *zTableName = sqlite3_value_text(argv[1]); |
| 101204 | | - |
| 101205 | | - int token; |
| 101206 | | - Token tname; |
| 101207 | | - int dist = 3; |
| 101208 | | - unsigned char const *zCsr = zSql; |
| 101209 | | - int len = 0; |
| 101210 | | - char *zRet; |
| 101211 | | - sqlite3 *db = sqlite3_context_db_handle(context); |
| 101212 | | - |
| 101213 | | - UNUSED_PARAMETER(NotUsed); |
| 101214 | | - |
| 101215 | | - /* The principle used to locate the table name in the CREATE TRIGGER |
| 101216 | | - ** statement is that the table name is the first token that is immediately |
| 101217 | | - ** preceded by either TK_ON or TK_DOT and immediately followed by one |
| 101218 | | - ** of TK_WHEN, TK_BEGIN or TK_FOR. |
| 101219 | | - */ |
| 101220 | | - if( zSql ){ |
| 101221 | | - do { |
| 101222 | | - |
| 101223 | | - if( !*zCsr ){ |
| 101224 | | - /* Ran out of input before finding the table name. Return NULL. */ |
| 101225 | | - return; |
| 101226 | | - } |
| 101227 | | - |
| 101228 | | - /* Store the token that zCsr points to in tname. */ |
| 101229 | | - tname.z = (char*)zCsr; |
| 101230 | | - tname.n = len; |
| 101231 | | - |
| 101232 | | - /* Advance zCsr to the next token. Store that token type in 'token', |
| 101233 | | - ** and its length in 'len' (to be used next iteration of this loop). |
| 101234 | | - */ |
| 101235 | | - do { |
| 101236 | | - zCsr += len; |
| 101237 | | - len = sqlite3GetToken(zCsr, &token); |
| 101238 | | - }while( token==TK_SPACE ); |
| 101239 | | - assert( len>0 || !*zCsr ); |
| 101240 | | - |
| 101241 | | - /* Variable 'dist' stores the number of tokens read since the most |
| 101242 | | - ** recent TK_DOT or TK_ON. This means that when a WHEN, FOR or BEGIN |
| 101243 | | - ** token is read and 'dist' equals 2, the condition stated above |
| 101244 | | - ** to be met. |
| 101245 | | - ** |
| 101246 | | - ** Note that ON cannot be a database, table or column name, so |
| 101247 | | - ** there is no need to worry about syntax like |
| 101248 | | - ** "CREATE TRIGGER ... ON ON.ON BEGIN ..." etc. |
| 101249 | | - */ |
| 101250 | | - dist++; |
| 101251 | | - if( token==TK_DOT || token==TK_ON ){ |
| 101252 | | - dist = 0; |
| 101253 | | - } |
| 101254 | | - } while( dist!=2 || (token!=TK_WHEN && token!=TK_FOR && token!=TK_BEGIN) ); |
| 101255 | | - |
| 101256 | | - /* Variable tname now contains the token that is the old table-name |
| 101257 | | - ** in the CREATE TRIGGER statement. |
| 101258 | | - */ |
| 101259 | | - zRet = sqlite3MPrintf(db, "%.*s\"%w\"%s", (int)(((u8*)tname.z) - zSql), |
| 101260 | | - zSql, zTableName, tname.z+tname.n); |
| 101261 | | - sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC); |
| 101262 | | - } |
| 101263 | | -} |
| 101264 | | -#endif /* !SQLITE_OMIT_TRIGGER */ |
| 101265 | | - |
| 101266 | | -/* |
| 101267 | | -** Register built-in functions used to help implement ALTER TABLE |
| 101268 | | -*/ |
| 101269 | | -SQLITE_PRIVATE void sqlite3AlterFunctions(void){ |
| 101270 | | - static FuncDef aAlterTableFuncs[] = { |
| 101271 | | - FUNCTION(sqlite_rename_table, 2, 0, 0, renameTableFunc), |
| 101272 | | -#ifndef SQLITE_OMIT_TRIGGER |
| 101273 | | - FUNCTION(sqlite_rename_trigger, 2, 0, 0, renameTriggerFunc), |
| 101274 | | -#endif |
| 101275 | | -#ifndef SQLITE_OMIT_FOREIGN_KEY |
| 101276 | | - FUNCTION(sqlite_rename_parent, 3, 0, 0, renameParentFunc), |
| 101277 | | -#endif |
| 101278 | | - }; |
| 101279 | | - sqlite3InsertBuiltinFuncs(aAlterTableFuncs, ArraySize(aAlterTableFuncs)); |
| 101280 | | -} |
| 101281 | | - |
| 101282 | | -/* |
| 101283 | | -** This function is used to create the text of expressions of the form: |
| 101284 | | -** |
| 101285 | | -** name=<constant1> OR name=<constant2> OR ... |
| 101286 | | -** |
| 101287 | | -** If argument zWhere is NULL, then a pointer string containing the text |
| 101288 | | -** "name=<constant>" is returned, where <constant> is the quoted version |
| 101289 | | -** of the string passed as argument zConstant. The returned buffer is |
| 101290 | | -** allocated using sqlite3DbMalloc(). It is the responsibility of the |
| 101291 | | -** caller to ensure that it is eventually freed. |
| 101292 | | -** |
| 101293 | | -** If argument zWhere is not NULL, then the string returned is |
| 101294 | | -** "<where> OR name=<constant>", where <where> is the contents of zWhere. |
| 101295 | | -** In this case zWhere is passed to sqlite3DbFree() before returning. |
| 101296 | | -** |
| 101297 | | -*/ |
| 101298 | | -static char *whereOrName(sqlite3 *db, char *zWhere, char *zConstant){ |
| 101299 | | - char *zNew; |
| 101300 | | - if( !zWhere ){ |
| 101301 | | - zNew = sqlite3MPrintf(db, "name=%Q", zConstant); |
| 101302 | | - }else{ |
| 101303 | | - zNew = sqlite3MPrintf(db, "%s OR name=%Q", zWhere, zConstant); |
| 101304 | | - sqlite3DbFree(db, zWhere); |
| 101305 | | - } |
| 101306 | | - return zNew; |
| 101307 | | -} |
| 101308 | | - |
| 101309 | | -#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) |
| 101310 | | -/* |
| 101311 | | -** Generate the text of a WHERE expression which can be used to select all |
| 101312 | | -** tables that have foreign key constraints that refer to table pTab (i.e. |
| 101313 | | -** constraints for which pTab is the parent table) from the sqlite_master |
| 101314 | | -** table. |
| 101315 | | -*/ |
| 101316 | | -static char *whereForeignKeys(Parse *pParse, Table *pTab){ |
| 101317 | | - FKey *p; |
| 101318 | | - char *zWhere = 0; |
| 101319 | | - for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){ |
| 101320 | | - zWhere = whereOrName(pParse->db, zWhere, p->pFrom->zName); |
| 101321 | | - } |
| 101322 | | - return zWhere; |
| 101323 | | -} |
| 101324 | | -#endif |
| 101325 | | - |
| 101326 | | -/* |
| 101327 | | -** Generate the text of a WHERE expression which can be used to select all |
| 101328 | | -** temporary triggers on table pTab from the sqlite_temp_master table. If |
| 101329 | | -** table pTab has no temporary triggers, or is itself stored in the |
| 101330 | | -** temporary database, NULL is returned. |
| 101331 | | -*/ |
| 101332 | | -static char *whereTempTriggers(Parse *pParse, Table *pTab){ |
| 101333 | | - Trigger *pTrig; |
| 101334 | | - char *zWhere = 0; |
| 101335 | | - const Schema *pTempSchema = pParse->db->aDb[1].pSchema; /* Temp db schema */ |
| 101336 | | - |
| 101337 | | - /* If the table is not located in the temp-db (in which case NULL is |
| 101338 | | - ** returned, loop through the tables list of triggers. For each trigger |
| 101339 | | - ** that is not part of the temp-db schema, add a clause to the WHERE |
| 101340 | | - ** expression being built up in zWhere. |
| 101341 | | - */ |
| 101342 | | - if( pTab->pSchema!=pTempSchema ){ |
| 101343 | | - sqlite3 *db = pParse->db; |
| 101344 | | - for(pTrig=sqlite3TriggerList(pParse, pTab); pTrig; pTrig=pTrig->pNext){ |
| 101345 | | - if( pTrig->pSchema==pTempSchema ){ |
| 101346 | | - zWhere = whereOrName(db, zWhere, pTrig->zName); |
| 101347 | | - } |
| 101348 | | - } |
| 101349 | | - } |
| 101350 | | - if( zWhere ){ |
| 101351 | | - char *zNew = sqlite3MPrintf(pParse->db, "type='trigger' AND (%s)", zWhere); |
| 101352 | | - sqlite3DbFree(pParse->db, zWhere); |
| 101353 | | - zWhere = zNew; |
| 101354 | | - } |
| 101355 | | - return zWhere; |
| 101356 | | -} |
| 101357 | | - |
| 101358 | | -/* |
| 101359 | | -** Generate code to drop and reload the internal representation of table |
| 101360 | | -** pTab from the database, including triggers and temporary triggers. |
| 101361 | | -** Argument zName is the name of the table in the database schema at |
| 101362 | | -** the time the generated code is executed. This can be different from |
| 101363 | | -** pTab->zName if this function is being called to code part of an |
| 101364 | | -** "ALTER TABLE RENAME TO" statement. |
| 101365 | | -*/ |
| 101366 | | -static void reloadTableSchema(Parse *pParse, Table *pTab, const char *zName){ |
| 101367 | | - Vdbe *v; |
| 101368 | | - char *zWhere; |
| 101369 | | - int iDb; /* Index of database containing pTab */ |
| 101370 | | -#ifndef SQLITE_OMIT_TRIGGER |
| 101371 | | - Trigger *pTrig; |
| 101372 | | -#endif |
| 101373 | | - |
| 101374 | | - v = sqlite3GetVdbe(pParse); |
| 101375 | | - if( NEVER(v==0) ) return; |
| 101376 | | - assert( sqlite3BtreeHoldsAllMutexes(pParse->db) ); |
| 101377 | | - iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); |
| 101378 | | - assert( iDb>=0 ); |
| 101379 | | - |
| 101380 | | -#ifndef SQLITE_OMIT_TRIGGER |
| 101381 | | - /* Drop any table triggers from the internal schema. */ |
| 101382 | | - for(pTrig=sqlite3TriggerList(pParse, pTab); pTrig; pTrig=pTrig->pNext){ |
| 101383 | | - int iTrigDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema); |
| 101384 | | - assert( iTrigDb==iDb || iTrigDb==1 ); |
| 101385 | | - sqlite3VdbeAddOp4(v, OP_DropTrigger, iTrigDb, 0, 0, pTrig->zName, 0); |
| 101386 | | - } |
| 101387 | | -#endif |
| 101388 | | - |
| 101389 | | - /* Drop the table and index from the internal schema. */ |
| 101390 | | - sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0); |
| 101391 | | - |
| 101392 | | - /* Reload the table, index and permanent trigger schemas. */ |
| 101393 | | - zWhere = sqlite3MPrintf(pParse->db, "tbl_name=%Q", zName); |
| 101394 | | - if( !zWhere ) return; |
| 101395 | | - sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere); |
| 101396 | | - |
| 101397 | | -#ifndef SQLITE_OMIT_TRIGGER |
| 101398 | | - /* Now, if the table is not stored in the temp database, reload any temp |
| 101399 | | - ** triggers. Don't use IN(...) in case SQLITE_OMIT_SUBQUERY is defined. |
| 101400 | | - */ |
| 101401 | | - if( (zWhere=whereTempTriggers(pParse, pTab))!=0 ){ |
| 101402 | | - sqlite3VdbeAddParseSchemaOp(v, 1, zWhere); |
| 101403 | | - } |
| 101404 | | -#endif |
| 101405 | | -} |
| 101406 | | - |
| 101407 | 101142 | /* |
| 101408 | 101143 | ** Parameter zName is the name of a table that is about to be altered |
| 101409 | 101144 | ** (either with ALTER TABLE ... RENAME TO or ALTER TABLE ... ADD COLUMN). |
| 101410 | 101145 | ** If the table is a system table, this function leaves an error message |
| 101411 | 101146 | ** in pParse->zErr (system tables may not be altered) and returns non-zero. |
| | @@ -101417,10 +101152,53 @@ |
| 101417 | 101152 | sqlite3ErrorMsg(pParse, "table %s may not be altered", zName); |
| 101418 | 101153 | return 1; |
| 101419 | 101154 | } |
| 101420 | 101155 | return 0; |
| 101421 | 101156 | } |
| 101157 | + |
| 101158 | +/* |
| 101159 | +** Generate code to verify that the schemas of database zDb and, if |
| 101160 | +** bTemp is not true, database "temp", can still be parsed. This is |
| 101161 | +** called at the end of the generation of an ALTER TABLE ... RENAME ... |
| 101162 | +** statement to ensure that the operation has not rendered any schema |
| 101163 | +** objects unusable. |
| 101164 | +*/ |
| 101165 | +void renameTestSchema(Parse *pParse, const char *zDb, int bTemp){ |
| 101166 | + sqlite3NestedParse(pParse, |
| 101167 | + "SELECT 1 " |
| 101168 | + "FROM \"%w\".%s " |
| 101169 | + "WHERE name NOT LIKE 'sqlite_%%'" |
| 101170 | + " AND sql NOT LIKE 'create virtual%%'" |
| 101171 | + " AND sqlite_rename_test(%Q, sql, type, name, %d)=NULL ", |
| 101172 | + zDb, MASTER_NAME, |
| 101173 | + zDb, bTemp |
| 101174 | + ); |
| 101175 | + |
| 101176 | + if( bTemp==0 ){ |
| 101177 | + sqlite3NestedParse(pParse, |
| 101178 | + "SELECT 1 " |
| 101179 | + "FROM temp.%s " |
| 101180 | + "WHERE name NOT LIKE 'sqlite_%%'" |
| 101181 | + " AND sql NOT LIKE 'create virtual%%'" |
| 101182 | + " AND sqlite_rename_test(%Q, sql, type, name, 1)=NULL ", |
| 101183 | + MASTER_NAME, zDb |
| 101184 | + ); |
| 101185 | + } |
| 101186 | +} |
| 101187 | + |
| 101188 | +/* |
| 101189 | +** Generate code to reload the schema for database iDb. And, if iDb!=1, for |
| 101190 | +** the temp database as well. |
| 101191 | +*/ |
| 101192 | +void renameReloadSchema(Parse *pParse, int iDb){ |
| 101193 | + Vdbe *v = pParse->pVdbe; |
| 101194 | + if( v ){ |
| 101195 | + sqlite3ChangeCookie(pParse, iDb); |
| 101196 | + sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, iDb, 0); |
| 101197 | + if( iDb!=1 ) sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, 1, 0); |
| 101198 | + } |
| 101199 | +} |
| 101422 | 101200 | |
| 101423 | 101201 | /* |
| 101424 | 101202 | ** Generate code to implement the "ALTER TABLE xxx RENAME TO yyy" |
| 101425 | 101203 | ** command. |
| 101426 | 101204 | */ |
| | @@ -101435,13 +101213,10 @@ |
| 101435 | 101213 | char *zName = 0; /* NULL-terminated version of pName */ |
| 101436 | 101214 | sqlite3 *db = pParse->db; /* Database connection */ |
| 101437 | 101215 | int nTabName; /* Number of UTF-8 characters in zTabName */ |
| 101438 | 101216 | const char *zTabName; /* Original name of the table */ |
| 101439 | 101217 | Vdbe *v; |
| 101440 | | -#ifndef SQLITE_OMIT_TRIGGER |
| 101441 | | - char *zWhere = 0; /* Where clause to locate temp triggers */ |
| 101442 | | -#endif |
| 101443 | 101218 | VTable *pVTab = 0; /* Non-zero if this is a v-tab with an xRename() */ |
| 101444 | 101219 | u32 savedDbFlags; /* Saved value of db->mDbFlags */ |
| 101445 | 101220 | |
| 101446 | 101221 | savedDbFlags = db->mDbFlags; |
| 101447 | 101222 | if( NEVER(db->mallocFailed) ) goto exit_rename_table; |
| | @@ -101510,12 +101285,10 @@ |
| 101510 | 101285 | */ |
| 101511 | 101286 | v = sqlite3GetVdbe(pParse); |
| 101512 | 101287 | if( v==0 ){ |
| 101513 | 101288 | goto exit_rename_table; |
| 101514 | 101289 | } |
| 101515 | | - sqlite3BeginWriteOperation(pParse, pVTab!=0, iDb); |
| 101516 | | - sqlite3ChangeCookie(pParse, iDb); |
| 101517 | 101290 | |
| 101518 | 101291 | /* If this is a virtual table, invoke the xRename() function if |
| 101519 | 101292 | ** one is defined. The xRename() callback will modify the names |
| 101520 | 101293 | ** of any resources used by the v-table implementation (including other |
| 101521 | 101294 | ** SQLite tables) that are identified by the name of the virtual table. |
| | @@ -101531,48 +101304,35 @@ |
| 101531 | 101304 | |
| 101532 | 101305 | /* figure out how many UTF-8 characters are in zName */ |
| 101533 | 101306 | zTabName = pTab->zName; |
| 101534 | 101307 | nTabName = sqlite3Utf8CharLen(zTabName, -1); |
| 101535 | 101308 | |
| 101536 | | -#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) |
| 101537 | | - if( db->flags&SQLITE_ForeignKeys ){ |
| 101538 | | - /* If foreign-key support is enabled, rewrite the CREATE TABLE |
| 101539 | | - ** statements corresponding to all child tables of foreign key constraints |
| 101540 | | - ** for which the renamed table is the parent table. */ |
| 101541 | | - if( (zWhere=whereForeignKeys(pParse, pTab))!=0 ){ |
| 101542 | | - sqlite3NestedParse(pParse, |
| 101543 | | - "UPDATE \"%w\".%s SET " |
| 101544 | | - "sql = sqlite_rename_parent(sql, %Q, %Q) " |
| 101545 | | - "WHERE %s;", zDb, MASTER_NAME, zTabName, zName, zWhere); |
| 101546 | | - sqlite3DbFree(db, zWhere); |
| 101547 | | - } |
| 101548 | | - } |
| 101549 | | -#endif |
| 101550 | | - |
| 101551 | | - /* Modify the sqlite_master table to use the new table name. */ |
| 101309 | + /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in |
| 101310 | + ** the schema to use the new table name. */ |
| 101311 | + sqlite3NestedParse(pParse, |
| 101312 | + "UPDATE \"%w\".%s SET " |
| 101313 | + "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) " |
| 101314 | + "WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)" |
| 101315 | + "AND name NOT LIKE 'sqlite_%%'" |
| 101316 | + , zDb, MASTER_NAME, zDb, zTabName, zName, (iDb==1), zTabName |
| 101317 | + ); |
| 101318 | + |
| 101319 | + /* Update the tbl_name and name columns of the sqlite_master table |
| 101320 | + ** as required. */ |
| 101552 | 101321 | sqlite3NestedParse(pParse, |
| 101553 | 101322 | "UPDATE %Q.%s SET " |
| 101554 | | -#ifdef SQLITE_OMIT_TRIGGER |
| 101555 | | - "sql = sqlite_rename_table(sql, %Q), " |
| 101556 | | -#else |
| 101557 | | - "sql = CASE " |
| 101558 | | - "WHEN type = 'trigger' THEN sqlite_rename_trigger(sql, %Q)" |
| 101559 | | - "ELSE sqlite_rename_table(sql, %Q) END, " |
| 101560 | | -#endif |
| 101561 | 101323 | "tbl_name = %Q, " |
| 101562 | 101324 | "name = CASE " |
| 101563 | 101325 | "WHEN type='table' THEN %Q " |
| 101564 | 101326 | "WHEN name LIKE 'sqlite_autoindex%%' AND type='index' THEN " |
| 101565 | 101327 | "'sqlite_autoindex_' || %Q || substr(name,%d+18) " |
| 101566 | 101328 | "ELSE name END " |
| 101567 | 101329 | "WHERE tbl_name=%Q COLLATE nocase AND " |
| 101568 | 101330 | "(type='table' OR type='index' OR type='trigger');", |
| 101569 | | - zDb, MASTER_NAME, zName, zName, zName, |
| 101570 | | -#ifndef SQLITE_OMIT_TRIGGER |
| 101571 | | - zName, |
| 101572 | | -#endif |
| 101573 | | - zName, nTabName, zTabName |
| 101331 | + zDb, MASTER_NAME, |
| 101332 | + zName, zName, zName, |
| 101333 | + nTabName, zTabName |
| 101574 | 101334 | ); |
| 101575 | 101335 | |
| 101576 | 101336 | #ifndef SQLITE_OMIT_AUTOINCREMENT |
| 101577 | 101337 | /* If the sqlite_sequence table exists in this database, then update |
| 101578 | 101338 | ** it with the new table name. |
| | @@ -101582,39 +101342,27 @@ |
| 101582 | 101342 | "UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q", |
| 101583 | 101343 | zDb, zName, pTab->zName); |
| 101584 | 101344 | } |
| 101585 | 101345 | #endif |
| 101586 | 101346 | |
| 101587 | | -#ifndef SQLITE_OMIT_TRIGGER |
| 101588 | | - /* If there are TEMP triggers on this table, modify the sqlite_temp_master |
| 101589 | | - ** table. Don't do this if the table being ALTERed is itself located in |
| 101590 | | - ** the temp database. |
| 101591 | | - */ |
| 101592 | | - if( (zWhere=whereTempTriggers(pParse, pTab))!=0 ){ |
| 101347 | + /* If the table being renamed is not itself part of the temp database, |
| 101348 | + ** edit view and trigger definitions within the temp database |
| 101349 | + ** as required. */ |
| 101350 | + if( iDb!=1 ){ |
| 101593 | 101351 | sqlite3NestedParse(pParse, |
| 101594 | 101352 | "UPDATE sqlite_temp_master SET " |
| 101595 | | - "sql = sqlite_rename_trigger(sql, %Q), " |
| 101596 | | - "tbl_name = %Q " |
| 101597 | | - "WHERE %s;", zName, zName, zWhere); |
| 101598 | | - sqlite3DbFree(db, zWhere); |
| 101599 | | - } |
| 101600 | | -#endif |
| 101601 | | - |
| 101602 | | -#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) |
| 101603 | | - if( db->flags&SQLITE_ForeignKeys ){ |
| 101604 | | - FKey *p; |
| 101605 | | - for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){ |
| 101606 | | - Table *pFrom = p->pFrom; |
| 101607 | | - if( pFrom!=pTab ){ |
| 101608 | | - reloadTableSchema(pParse, p->pFrom, pFrom->zName); |
| 101609 | | - } |
| 101610 | | - } |
| 101611 | | - } |
| 101612 | | -#endif |
| 101613 | | - |
| 101614 | | - /* Drop and reload the internal table schema. */ |
| 101615 | | - reloadTableSchema(pParse, pTab, zName); |
| 101353 | + "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), " |
| 101354 | + "tbl_name = " |
| 101355 | + "CASE WHEN tbl_name=%Q COLLATE nocase AND " |
| 101356 | + " sqlite_rename_test(%Q, sql, type, name, 1) " |
| 101357 | + "THEN %Q ELSE tbl_name END " |
| 101358 | + "WHERE type IN ('view', 'trigger')" |
| 101359 | + , zDb, zTabName, zName, zTabName, zDb, zName); |
| 101360 | + } |
| 101361 | + |
| 101362 | + renameReloadSchema(pParse, iDb); |
| 101363 | + renameTestSchema(pParse, zDb, iDb==1); |
| 101616 | 101364 | |
| 101617 | 101365 | exit_rename_table: |
| 101618 | 101366 | sqlite3SrcListDelete(db, pSrc); |
| 101619 | 101367 | sqlite3DbFree(db, zName); |
| 101620 | 101368 | db->mDbFlags = savedDbFlags; |
| | @@ -101636,16 +101384,15 @@ |
| 101636 | 101384 | const char *zTab; /* Table name */ |
| 101637 | 101385 | char *zCol; /* Null-terminated column definition */ |
| 101638 | 101386 | Column *pCol; /* The new column */ |
| 101639 | 101387 | Expr *pDflt; /* Default value for the new column */ |
| 101640 | 101388 | sqlite3 *db; /* The database connection; */ |
| 101641 | | - Vdbe *v = pParse->pVdbe; /* The prepared statement under construction */ |
| 101389 | + Vdbe *v; /* The prepared statement under construction */ |
| 101642 | 101390 | int r1; /* Temporary registers */ |
| 101643 | 101391 | |
| 101644 | 101392 | db = pParse->db; |
| 101645 | 101393 | if( pParse->nErr || db->mallocFailed ) return; |
| 101646 | | - assert( v!=0 ); |
| 101647 | 101394 | pNew = pParse->pNewTable; |
| 101648 | 101395 | assert( pNew ); |
| 101649 | 101396 | |
| 101650 | 101397 | assert( sqlite3BtreeHoldsAllMutexes(db) ); |
| 101651 | 101398 | iDb = sqlite3SchemaToIndex(db, pNew->pSchema); |
| | @@ -101736,21 +101483,24 @@ |
| 101736 | 101483 | |
| 101737 | 101484 | /* Make sure the schema version is at least 3. But do not upgrade |
| 101738 | 101485 | ** from less than 3 to 4, as that will corrupt any preexisting DESC |
| 101739 | 101486 | ** index. |
| 101740 | 101487 | */ |
| 101741 | | - r1 = sqlite3GetTempReg(pParse); |
| 101742 | | - sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, r1, BTREE_FILE_FORMAT); |
| 101743 | | - sqlite3VdbeUsesBtree(v, iDb); |
| 101744 | | - sqlite3VdbeAddOp2(v, OP_AddImm, r1, -2); |
| 101745 | | - sqlite3VdbeAddOp2(v, OP_IfPos, r1, sqlite3VdbeCurrentAddr(v)+2); |
| 101746 | | - VdbeCoverage(v); |
| 101747 | | - sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3); |
| 101748 | | - sqlite3ReleaseTempReg(pParse, r1); |
| 101749 | | - |
| 101750 | | - /* Reload the schema of the modified table. */ |
| 101751 | | - reloadTableSchema(pParse, pTab, pTab->zName); |
| 101488 | + v = sqlite3GetVdbe(pParse); |
| 101489 | + if( v ){ |
| 101490 | + r1 = sqlite3GetTempReg(pParse); |
| 101491 | + sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, r1, BTREE_FILE_FORMAT); |
| 101492 | + sqlite3VdbeUsesBtree(v, iDb); |
| 101493 | + sqlite3VdbeAddOp2(v, OP_AddImm, r1, -2); |
| 101494 | + sqlite3VdbeAddOp2(v, OP_IfPos, r1, sqlite3VdbeCurrentAddr(v)+2); |
| 101495 | + VdbeCoverage(v); |
| 101496 | + sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3); |
| 101497 | + sqlite3ReleaseTempReg(pParse, r1); |
| 101498 | + } |
| 101499 | + |
| 101500 | + /* Reload the table definition */ |
| 101501 | + renameReloadSchema(pParse, iDb); |
| 101752 | 101502 | } |
| 101753 | 101503 | |
| 101754 | 101504 | /* |
| 101755 | 101505 | ** This function is called by the parser after the table-name in |
| 101756 | 101506 | ** an "ALTER TABLE <table-name> ADD" statement is parsed. Argument |
| | @@ -101767,11 +101517,10 @@ |
| 101767 | 101517 | ** coding the "ALTER TABLE ... ADD" statement. |
| 101768 | 101518 | */ |
| 101769 | 101519 | SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){ |
| 101770 | 101520 | Table *pNew; |
| 101771 | 101521 | Table *pTab; |
| 101772 | | - Vdbe *v; |
| 101773 | 101522 | int iDb; |
| 101774 | 101523 | int i; |
| 101775 | 101524 | int nAlloc; |
| 101776 | 101525 | sqlite3 *db = pParse->db; |
| 101777 | 101526 | |
| | @@ -101831,20 +101580,1113 @@ |
| 101831 | 101580 | } |
| 101832 | 101581 | pNew->pSchema = db->aDb[iDb].pSchema; |
| 101833 | 101582 | pNew->addColOffset = pTab->addColOffset; |
| 101834 | 101583 | pNew->nTabRef = 1; |
| 101835 | 101584 | |
| 101836 | | - /* Begin a transaction and increment the schema cookie. */ |
| 101837 | | - sqlite3BeginWriteOperation(pParse, 0, iDb); |
| 101838 | | - v = sqlite3GetVdbe(pParse); |
| 101839 | | - if( !v ) goto exit_begin_add_column; |
| 101840 | | - sqlite3ChangeCookie(pParse, iDb); |
| 101841 | | - |
| 101842 | 101585 | exit_begin_add_column: |
| 101843 | 101586 | sqlite3SrcListDelete(db, pSrc); |
| 101844 | 101587 | return; |
| 101845 | 101588 | } |
| 101589 | + |
| 101590 | +/* |
| 101591 | +** Parameter pTab is the subject of an ALTER TABLE ... RENAME COLUMN |
| 101592 | +** command. This function checks if the table is a view or virtual |
| 101593 | +** table (columns of views or virtual tables may not be renamed). If so, |
| 101594 | +** it loads an error message into pParse and returns non-zero. |
| 101595 | +** |
| 101596 | +** Or, if pTab is not a view or virtual table, zero is returned. |
| 101597 | +*/ |
| 101598 | +#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) |
| 101599 | +static int isRealTable(Parse *pParse, Table *pTab){ |
| 101600 | + const char *zType = 0; |
| 101601 | +#ifndef SQLITE_OMIT_VIEW |
| 101602 | + if( pTab->pSelect ){ |
| 101603 | + zType = "view"; |
| 101604 | + } |
| 101605 | +#endif |
| 101606 | +#ifndef SQLITE_OMIT_VIRTUALTABLE |
| 101607 | + if( IsVirtual(pTab) ){ |
| 101608 | + zType = "virtual table"; |
| 101609 | + } |
| 101610 | +#endif |
| 101611 | + if( zType ){ |
| 101612 | + sqlite3ErrorMsg( |
| 101613 | + pParse, "cannot rename columns of %s \"%s\"", zType, pTab->zName |
| 101614 | + ); |
| 101615 | + return 1; |
| 101616 | + } |
| 101617 | + return 0; |
| 101618 | +} |
| 101619 | +#else /* !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) */ |
| 101620 | +# define isRealTable(x,y) (0) |
| 101621 | +#endif |
| 101622 | + |
| 101623 | +/* |
| 101624 | +** Handles the following parser reduction: |
| 101625 | +** |
| 101626 | +** cmd ::= ALTER TABLE pSrc RENAME COLUMN pOld TO pNew |
| 101627 | +*/ |
| 101628 | +SQLITE_PRIVATE void sqlite3AlterRenameColumn( |
| 101629 | + Parse *pParse, /* Parsing context */ |
| 101630 | + SrcList *pSrc, /* Table being altered. pSrc->nSrc==1 */ |
| 101631 | + Token *pOld, /* Name of column being changed */ |
| 101632 | + Token *pNew /* New column name */ |
| 101633 | +){ |
| 101634 | + sqlite3 *db = pParse->db; /* Database connection */ |
| 101635 | + Table *pTab; /* Table being updated */ |
| 101636 | + int iCol; /* Index of column being renamed */ |
| 101637 | + char *zOld = 0; /* Old column name */ |
| 101638 | + char *zNew = 0; /* New column name */ |
| 101639 | + const char *zDb; /* Name of schema containing the table */ |
| 101640 | + int iSchema; /* Index of the schema */ |
| 101641 | + int bQuote; /* True to quote the new name */ |
| 101642 | + |
| 101643 | + /* Locate the table to be altered */ |
| 101644 | + pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]); |
| 101645 | + if( !pTab ) goto exit_rename_column; |
| 101646 | + |
| 101647 | + /* Cannot alter a system table */ |
| 101648 | + if( SQLITE_OK!=isSystemTable(pParse, pTab->zName) ) goto exit_rename_column; |
| 101649 | + if( SQLITE_OK!=isRealTable(pParse, pTab) ) goto exit_rename_column; |
| 101650 | + |
| 101651 | + /* Which schema holds the table to be altered */ |
| 101652 | + iSchema = sqlite3SchemaToIndex(db, pTab->pSchema); |
| 101653 | + assert( iSchema>=0 ); |
| 101654 | + zDb = db->aDb[iSchema].zDbSName; |
| 101655 | + |
| 101656 | +#ifndef SQLITE_OMIT_AUTHORIZATION |
| 101657 | + /* Invoke the authorization callback. */ |
| 101658 | + if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){ |
| 101659 | + goto exit_rename_column; |
| 101660 | + } |
| 101661 | +#endif |
| 101662 | + |
| 101663 | + /* Make sure the old name really is a column name in the table to be |
| 101664 | + ** altered. Set iCol to be the index of the column being renamed */ |
| 101665 | + zOld = sqlite3NameFromToken(db, pOld); |
| 101666 | + if( !zOld ) goto exit_rename_column; |
| 101667 | + for(iCol=0; iCol<pTab->nCol; iCol++){ |
| 101668 | + if( 0==sqlite3StrICmp(pTab->aCol[iCol].zName, zOld) ) break; |
| 101669 | + } |
| 101670 | + if( iCol==pTab->nCol ){ |
| 101671 | + sqlite3ErrorMsg(pParse, "no such column: \"%s\"", zOld); |
| 101672 | + goto exit_rename_column; |
| 101673 | + } |
| 101674 | + |
| 101675 | + /* Do the rename operation using a recursive UPDATE statement that |
| 101676 | + ** uses the sqlite_rename_column() SQL function to compute the new |
| 101677 | + ** CREATE statement text for the sqlite_master table. |
| 101678 | + */ |
| 101679 | + zNew = sqlite3NameFromToken(db, pNew); |
| 101680 | + if( !zNew ) goto exit_rename_column; |
| 101681 | + assert( pNew->n>0 ); |
| 101682 | + bQuote = sqlite3Isquote(pNew->z[0]); |
| 101683 | + sqlite3NestedParse(pParse, |
| 101684 | + "UPDATE \"%w\".%s SET " |
| 101685 | + "sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) " |
| 101686 | + "WHERE name NOT LIKE 'sqlite_%%' AND (type != 'index' OR tbl_name = %Q)" |
| 101687 | + " AND sql NOT LIKE 'create virtual%%'", |
| 101688 | + zDb, MASTER_NAME, |
| 101689 | + zDb, pTab->zName, iCol, zNew, bQuote, iSchema==1, |
| 101690 | + pTab->zName |
| 101691 | + ); |
| 101692 | + |
| 101693 | + sqlite3NestedParse(pParse, |
| 101694 | + "UPDATE temp.%s SET " |
| 101695 | + "sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) " |
| 101696 | + "WHERE type IN ('trigger', 'view')", |
| 101697 | + MASTER_NAME, |
| 101698 | + zDb, pTab->zName, iCol, zNew, bQuote |
| 101699 | + ); |
| 101700 | + |
| 101701 | + /* Drop and reload the database schema. */ |
| 101702 | + renameReloadSchema(pParse, iSchema); |
| 101703 | + renameTestSchema(pParse, zDb, iSchema==1); |
| 101704 | + |
| 101705 | + exit_rename_column: |
| 101706 | + sqlite3SrcListDelete(db, pSrc); |
| 101707 | + sqlite3DbFree(db, zOld); |
| 101708 | + sqlite3DbFree(db, zNew); |
| 101709 | + return; |
| 101710 | +} |
| 101711 | + |
| 101712 | +/* |
| 101713 | +** Each RenameToken object maps an element of the parse tree into |
| 101714 | +** the token that generated that element. The parse tree element |
| 101715 | +** might be one of: |
| 101716 | +** |
| 101717 | +** * A pointer to an Expr that represents an ID |
| 101718 | +** * The name of a table column in Column.zName |
| 101719 | +** |
| 101720 | +** A list of RenameToken objects can be constructed during parsing. |
| 101721 | +** Each new object is created by sqlite3RenameTokenMap(). |
| 101722 | +** As the parse tree is transformed, the sqlite3RenameTokenRemap() |
| 101723 | +** routine is used to keep the mapping current. |
| 101724 | +** |
| 101725 | +** After the parse finishes, renameTokenFind() routine can be used |
| 101726 | +** to look up the actual token value that created some element in |
| 101727 | +** the parse tree. |
| 101728 | +*/ |
| 101729 | +struct RenameToken { |
| 101730 | + void *p; /* Parse tree element created by token t */ |
| 101731 | + Token t; /* The token that created parse tree element p */ |
| 101732 | + RenameToken *pNext; /* Next is a list of all RenameToken objects */ |
| 101733 | +}; |
| 101734 | + |
| 101735 | +/* |
| 101736 | +** The context of an ALTER TABLE RENAME COLUMN operation that gets passed |
| 101737 | +** down into the Walker. |
| 101738 | +*/ |
| 101739 | +typedef struct RenameCtx RenameCtx; |
| 101740 | +struct RenameCtx { |
| 101741 | + RenameToken *pList; /* List of tokens to overwrite */ |
| 101742 | + int nList; /* Number of tokens in pList */ |
| 101743 | + int iCol; /* Index of column being renamed */ |
| 101744 | + Table *pTab; /* Table being ALTERed */ |
| 101745 | + const char *zOld; /* Old column name */ |
| 101746 | +}; |
| 101747 | + |
| 101748 | +#ifdef SQLITE_DEBUG |
| 101749 | +/* |
| 101750 | +** This function is only for debugging. It performs two tasks: |
| 101751 | +** |
| 101752 | +** 1. Checks that pointer pPtr does not already appear in the |
| 101753 | +** rename-token list. |
| 101754 | +** |
| 101755 | +** 2. Dereferences each pointer in the rename-token list. |
| 101756 | +** |
| 101757 | +** The second is most effective when debugging under valgrind or |
| 101758 | +** address-sanitizer or similar. If any of these pointers no longer |
| 101759 | +** point to valid objects, an exception is raised by the memory-checking |
| 101760 | +** tool. |
| 101761 | +** |
| 101762 | +** The point of this is to prevent comparisons of invalid pointer values. |
| 101763 | +** Even though this always seems to work, it is undefined according to the |
| 101764 | +** C standard. Example of undefined comparison: |
| 101765 | +** |
| 101766 | +** sqlite3_free(x); |
| 101767 | +** if( x==y ) ... |
| 101768 | +** |
| 101769 | +** Technically, as x no longer points into a valid object or to the byte |
| 101770 | +** following a valid object, it may not be used in comparison operations. |
| 101771 | +*/ |
| 101772 | +void renameTokenCheckAll(Parse *pParse, void *pPtr){ |
| 101773 | + if( pParse->nErr==0 && pParse->db->mallocFailed==0 ){ |
| 101774 | + RenameToken *p; |
| 101775 | + u8 i = 0; |
| 101776 | + for(p=pParse->pRename; p; p=p->pNext){ |
| 101777 | + if( p->p ){ |
| 101778 | + assert( p->p!=pPtr ); |
| 101779 | + i += *(u8*)(p->p); |
| 101780 | + } |
| 101781 | + } |
| 101782 | + } |
| 101783 | +} |
| 101784 | +#else |
| 101785 | +# define renameTokenCheckAll(x,y) |
| 101786 | +#endif |
| 101787 | + |
| 101788 | +/* |
| 101789 | +** Add a new RenameToken object mapping parse tree element pPtr into |
| 101790 | +** token *pToken to the Parse object currently under construction. |
| 101791 | +** |
| 101792 | +** Return a copy of pPtr. |
| 101793 | +*/ |
| 101794 | +SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse *pParse, void *pPtr, Token *pToken){ |
| 101795 | + RenameToken *pNew; |
| 101796 | + assert( pPtr || pParse->db->mallocFailed ); |
| 101797 | + renameTokenCheckAll(pParse, pPtr); |
| 101798 | + pNew = sqlite3DbMallocZero(pParse->db, sizeof(RenameToken)); |
| 101799 | + if( pNew ){ |
| 101800 | + pNew->p = pPtr; |
| 101801 | + pNew->t = *pToken; |
| 101802 | + pNew->pNext = pParse->pRename; |
| 101803 | + pParse->pRename = pNew; |
| 101804 | + } |
| 101805 | + |
| 101806 | + return pPtr; |
| 101807 | +} |
| 101808 | + |
| 101809 | +/* |
| 101810 | +** It is assumed that there is already a RenameToken object associated |
| 101811 | +** with parse tree element pFrom. This function remaps the associated token |
| 101812 | +** to parse tree element pTo. |
| 101813 | +*/ |
| 101814 | +SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse *pParse, void *pTo, void *pFrom){ |
| 101815 | + RenameToken *p; |
| 101816 | + renameTokenCheckAll(pParse, pTo); |
| 101817 | + for(p=pParse->pRename; p; p=p->pNext){ |
| 101818 | + if( p->p==pFrom ){ |
| 101819 | + p->p = pTo; |
| 101820 | + break; |
| 101821 | + } |
| 101822 | + } |
| 101823 | +} |
| 101824 | + |
| 101825 | +/* |
| 101826 | +** Walker callback used by sqlite3RenameExprUnmap(). |
| 101827 | +*/ |
| 101828 | +static int renameUnmapExprCb(Walker *pWalker, Expr *pExpr){ |
| 101829 | + Parse *pParse = pWalker->pParse; |
| 101830 | + sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr); |
| 101831 | + return WRC_Continue; |
| 101832 | +} |
| 101833 | + |
| 101834 | +/* |
| 101835 | +** Remove all nodes that are part of expression pExpr from the rename list. |
| 101836 | +*/ |
| 101837 | +SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse *pParse, Expr *pExpr){ |
| 101838 | + Walker sWalker; |
| 101839 | + memset(&sWalker, 0, sizeof(Walker)); |
| 101840 | + sWalker.pParse = pParse; |
| 101841 | + sWalker.xExprCallback = renameUnmapExprCb; |
| 101842 | + sqlite3WalkExpr(&sWalker, pExpr); |
| 101843 | +} |
| 101844 | + |
| 101845 | +/* |
| 101846 | +** Free the list of RenameToken objects given in the second argument |
| 101847 | +*/ |
| 101848 | +static void renameTokenFree(sqlite3 *db, RenameToken *pToken){ |
| 101849 | + RenameToken *pNext; |
| 101850 | + RenameToken *p; |
| 101851 | + for(p=pToken; p; p=pNext){ |
| 101852 | + pNext = p->pNext; |
| 101853 | + sqlite3DbFree(db, p); |
| 101854 | + } |
| 101855 | +} |
| 101856 | + |
| 101857 | +/* |
| 101858 | +** Search the Parse object passed as the first argument for a RenameToken |
| 101859 | +** object associated with parse tree element pPtr. If found, remove it |
| 101860 | +** from the Parse object and add it to the list maintained by the |
| 101861 | +** RenameCtx object passed as the second argument. |
| 101862 | +*/ |
| 101863 | +static void renameTokenFind(Parse *pParse, struct RenameCtx *pCtx, void *pPtr){ |
| 101864 | + RenameToken **pp; |
| 101865 | + assert( pPtr!=0 ); |
| 101866 | + for(pp=&pParse->pRename; (*pp); pp=&(*pp)->pNext){ |
| 101867 | + if( (*pp)->p==pPtr ){ |
| 101868 | + RenameToken *pToken = *pp; |
| 101869 | + *pp = pToken->pNext; |
| 101870 | + pToken->pNext = pCtx->pList; |
| 101871 | + pCtx->pList = pToken; |
| 101872 | + pCtx->nList++; |
| 101873 | + break; |
| 101874 | + } |
| 101875 | + } |
| 101876 | +} |
| 101877 | + |
| 101878 | +/* |
| 101879 | +** This is a Walker select callback. It does nothing. It is only required |
| 101880 | +** because without a dummy callback, sqlite3WalkExpr() and similar do not |
| 101881 | +** descend into sub-select statements. |
| 101882 | +*/ |
| 101883 | +static int renameColumnSelectCb(Walker *pWalker, Select *p){ |
| 101884 | + UNUSED_PARAMETER(pWalker); |
| 101885 | + UNUSED_PARAMETER(p); |
| 101886 | + return WRC_Continue; |
| 101887 | +} |
| 101888 | + |
| 101889 | +/* |
| 101890 | +** This is a Walker expression callback. |
| 101891 | +** |
| 101892 | +** For every TK_COLUMN node in the expression tree, search to see |
| 101893 | +** if the column being references is the column being renamed by an |
| 101894 | +** ALTER TABLE statement. If it is, then attach its associated |
| 101895 | +** RenameToken object to the list of RenameToken objects being |
| 101896 | +** constructed in RenameCtx object at pWalker->u.pRename. |
| 101897 | +*/ |
| 101898 | +static int renameColumnExprCb(Walker *pWalker, Expr *pExpr){ |
| 101899 | + RenameCtx *p = pWalker->u.pRename; |
| 101900 | + if( pExpr->op==TK_TRIGGER |
| 101901 | + && pExpr->iColumn==p->iCol |
| 101902 | + && pWalker->pParse->pTriggerTab==p->pTab |
| 101903 | + ){ |
| 101904 | + renameTokenFind(pWalker->pParse, p, (void*)pExpr); |
| 101905 | + }else if( pExpr->op==TK_COLUMN |
| 101906 | + && pExpr->iColumn==p->iCol |
| 101907 | + && p->pTab==pExpr->pTab |
| 101908 | + ){ |
| 101909 | + renameTokenFind(pWalker->pParse, p, (void*)pExpr); |
| 101910 | + } |
| 101911 | + return WRC_Continue; |
| 101912 | +} |
| 101913 | + |
| 101914 | +/* |
| 101915 | +** The RenameCtx contains a list of tokens that reference a column that |
| 101916 | +** is being renamed by an ALTER TABLE statement. Return the "last" |
| 101917 | +** RenameToken in the RenameCtx and remove that RenameToken from the |
| 101918 | +** RenameContext. "Last" means the last RenameToken encountered when |
| 101919 | +** the input SQL is parsed from left to right. Repeated calls to this routine |
| 101920 | +** return all column name tokens in the order that they are encountered |
| 101921 | +** in the SQL statement. |
| 101922 | +*/ |
| 101923 | +static RenameToken *renameColumnTokenNext(RenameCtx *pCtx){ |
| 101924 | + RenameToken *pBest = pCtx->pList; |
| 101925 | + RenameToken *pToken; |
| 101926 | + RenameToken **pp; |
| 101927 | + |
| 101928 | + for(pToken=pBest->pNext; pToken; pToken=pToken->pNext){ |
| 101929 | + if( pToken->t.z>pBest->t.z ) pBest = pToken; |
| 101930 | + } |
| 101931 | + for(pp=&pCtx->pList; *pp!=pBest; pp=&(*pp)->pNext); |
| 101932 | + *pp = pBest->pNext; |
| 101933 | + |
| 101934 | + return pBest; |
| 101935 | +} |
| 101936 | + |
| 101937 | +/* |
| 101938 | +** An error occured while parsing or otherwise processing a database |
| 101939 | +** object (either pParse->pNewTable, pNewIndex or pNewTrigger) as part of an |
| 101940 | +** ALTER TABLE RENAME COLUMN program. The error message emitted by the |
| 101941 | +** sub-routine is currently stored in pParse->zErrMsg. This function |
| 101942 | +** adds context to the error message and then stores it in pCtx. |
| 101943 | +*/ |
| 101944 | +static void renameColumnParseError( |
| 101945 | + sqlite3_context *pCtx, |
| 101946 | + int bPost, |
| 101947 | + sqlite3_value *pType, |
| 101948 | + sqlite3_value *pObject, |
| 101949 | + Parse *pParse |
| 101950 | +){ |
| 101951 | + const char *zT = (const char*)sqlite3_value_text(pType); |
| 101952 | + const char *zN = (const char*)sqlite3_value_text(pObject); |
| 101953 | + char *zErr; |
| 101954 | + |
| 101955 | + zErr = sqlite3_mprintf("error in %s %s%s: %s", |
| 101956 | + zT, zN, (bPost ? " after rename" : ""), |
| 101957 | + pParse->zErrMsg |
| 101958 | + ); |
| 101959 | + sqlite3_result_error(pCtx, zErr, -1); |
| 101960 | + sqlite3_free(zErr); |
| 101961 | +} |
| 101962 | + |
| 101963 | +/* |
| 101964 | +** For each name in the the expression-list pEList (i.e. each |
| 101965 | +** pEList->a[i].zName) that matches the string in zOld, extract the |
| 101966 | +** corresponding rename-token from Parse object pParse and add it |
| 101967 | +** to the RenameCtx pCtx. |
| 101968 | +*/ |
| 101969 | +static void renameColumnElistNames( |
| 101970 | + Parse *pParse, |
| 101971 | + RenameCtx *pCtx, |
| 101972 | + ExprList *pEList, |
| 101973 | + const char *zOld |
| 101974 | +){ |
| 101975 | + if( pEList ){ |
| 101976 | + int i; |
| 101977 | + for(i=0; i<pEList->nExpr; i++){ |
| 101978 | + char *zName = pEList->a[i].zName; |
| 101979 | + if( 0==sqlite3_stricmp(zName, zOld) ){ |
| 101980 | + renameTokenFind(pParse, pCtx, (void*)zName); |
| 101981 | + } |
| 101982 | + } |
| 101983 | + } |
| 101984 | +} |
| 101985 | + |
| 101986 | +/* |
| 101987 | +** For each name in the the id-list pIdList (i.e. each pIdList->a[i].zName) |
| 101988 | +** that matches the string in zOld, extract the corresponding rename-token |
| 101989 | +** from Parse object pParse and add it to the RenameCtx pCtx. |
| 101990 | +*/ |
| 101991 | +static void renameColumnIdlistNames( |
| 101992 | + Parse *pParse, |
| 101993 | + RenameCtx *pCtx, |
| 101994 | + IdList *pIdList, |
| 101995 | + const char *zOld |
| 101996 | +){ |
| 101997 | + if( pIdList ){ |
| 101998 | + int i; |
| 101999 | + for(i=0; i<pIdList->nId; i++){ |
| 102000 | + char *zName = pIdList->a[i].zName; |
| 102001 | + if( 0==sqlite3_stricmp(zName, zOld) ){ |
| 102002 | + renameTokenFind(pParse, pCtx, (void*)zName); |
| 102003 | + } |
| 102004 | + } |
| 102005 | + } |
| 102006 | +} |
| 102007 | + |
| 102008 | +/* |
| 102009 | +** Parse the SQL statement zSql using Parse object (*p). The Parse object |
| 102010 | +** is initialized by this function before it is used. |
| 102011 | +*/ |
| 102012 | +static int renameParseSql( |
| 102013 | + Parse *p, /* Memory to use for Parse object */ |
| 102014 | + const char *zDb, /* Name of schema SQL belongs to */ |
| 102015 | + int bTable, /* 1 -> RENAME TABLE, 0 -> RENAME COLUMN */ |
| 102016 | + sqlite3 *db, /* Database handle */ |
| 102017 | + const char *zSql, /* SQL to parse */ |
| 102018 | + int bTemp /* True if SQL is from temp schema */ |
| 102019 | +){ |
| 102020 | + int rc; |
| 102021 | + char *zErr = 0; |
| 102022 | + |
| 102023 | + db->init.iDb = bTemp ? 1 : sqlite3FindDbName(db, zDb); |
| 102024 | + |
| 102025 | + /* Parse the SQL statement passed as the first argument. If no error |
| 102026 | + ** occurs and the parse does not result in a new table, index or |
| 102027 | + ** trigger object, the database must be corrupt. */ |
| 102028 | + memset(p, 0, sizeof(Parse)); |
| 102029 | + p->eParseMode = (bTable ? PARSE_MODE_RENAME_TABLE : PARSE_MODE_RENAME_COLUMN); |
| 102030 | + p->db = db; |
| 102031 | + p->nQueryLoop = 1; |
| 102032 | + rc = sqlite3RunParser(p, zSql, &zErr); |
| 102033 | + assert( p->zErrMsg==0 ); |
| 102034 | + assert( rc!=SQLITE_OK || zErr==0 ); |
| 102035 | + assert( (0!=p->pNewTable) + (0!=p->pNewIndex) + (0!=p->pNewTrigger)<2 ); |
| 102036 | + p->zErrMsg = zErr; |
| 102037 | + if( db->mallocFailed ) rc = SQLITE_NOMEM; |
| 102038 | + if( rc==SQLITE_OK |
| 102039 | + && p->pNewTable==0 && p->pNewIndex==0 && p->pNewTrigger==0 |
| 102040 | + ){ |
| 102041 | + rc = SQLITE_CORRUPT_BKPT; |
| 102042 | + } |
| 102043 | + |
| 102044 | +#ifdef SQLITE_DEBUG |
| 102045 | + /* Ensure that all mappings in the Parse.pRename list really do map to |
| 102046 | + ** a part of the input string. */ |
| 102047 | + if( rc==SQLITE_OK ){ |
| 102048 | + int nSql = sqlite3Strlen30(zSql); |
| 102049 | + RenameToken *pToken; |
| 102050 | + for(pToken=p->pRename; pToken; pToken=pToken->pNext){ |
| 102051 | + assert( pToken->t.z>=zSql && &pToken->t.z[pToken->t.n]<=&zSql[nSql] ); |
| 102052 | + } |
| 102053 | + } |
| 102054 | +#endif |
| 102055 | + |
| 102056 | + db->init.iDb = 0; |
| 102057 | + return rc; |
| 102058 | +} |
| 102059 | + |
| 102060 | +/* |
| 102061 | +** This function edits SQL statement zSql, replacing each token identified |
| 102062 | +** by the linked list pRename with the text of zNew. If argument bQuote is |
| 102063 | +** true, then zNew is always quoted first. If no error occurs, the result |
| 102064 | +** is loaded into context object pCtx as the result. |
| 102065 | +** |
| 102066 | +** Or, if an error occurs (i.e. an OOM condition), an error is left in |
| 102067 | +** pCtx and an SQLite error code returned. |
| 102068 | +*/ |
| 102069 | +static int renameEditSql( |
| 102070 | + sqlite3_context *pCtx, /* Return result here */ |
| 102071 | + RenameCtx *pRename, /* Rename context */ |
| 102072 | + const char *zSql, /* SQL statement to edit */ |
| 102073 | + const char *zNew, /* New token text */ |
| 102074 | + int bQuote /* True to always quote token */ |
| 102075 | +){ |
| 102076 | + int nNew = sqlite3Strlen30(zNew); |
| 102077 | + int nSql = sqlite3Strlen30(zSql); |
| 102078 | + sqlite3 *db = sqlite3_context_db_handle(pCtx); |
| 102079 | + int rc = SQLITE_OK; |
| 102080 | + char *zQuot; |
| 102081 | + char *zOut; |
| 102082 | + int nQuot; |
| 102083 | + |
| 102084 | + /* Set zQuot to point to a buffer containing a quoted copy of the |
| 102085 | + ** identifier zNew. If the corresponding identifier in the original |
| 102086 | + ** ALTER TABLE statement was quoted (bQuote==1), then set zNew to |
| 102087 | + ** point to zQuot so that all substitutions are made using the |
| 102088 | + ** quoted version of the new column name. */ |
| 102089 | + zQuot = sqlite3MPrintf(db, "\"%w\"", zNew); |
| 102090 | + if( zQuot==0 ){ |
| 102091 | + return SQLITE_NOMEM; |
| 102092 | + }else{ |
| 102093 | + nQuot = sqlite3Strlen30(zQuot); |
| 102094 | + } |
| 102095 | + if( bQuote ){ |
| 102096 | + zNew = zQuot; |
| 102097 | + nNew = nQuot; |
| 102098 | + } |
| 102099 | + |
| 102100 | + /* At this point pRename->pList contains a list of RenameToken objects |
| 102101 | + ** corresponding to all tokens in the input SQL that must be replaced |
| 102102 | + ** with the new column name. All that remains is to construct and |
| 102103 | + ** return the edited SQL string. */ |
| 102104 | + assert( nQuot>=nNew ); |
| 102105 | + zOut = sqlite3DbMallocZero(db, nSql + pRename->nList*nQuot + 1); |
| 102106 | + if( zOut ){ |
| 102107 | + int nOut = nSql; |
| 102108 | + memcpy(zOut, zSql, nSql); |
| 102109 | + while( pRename->pList ){ |
| 102110 | + int iOff; /* Offset of token to replace in zOut */ |
| 102111 | + RenameToken *pBest = renameColumnTokenNext(pRename); |
| 102112 | + |
| 102113 | + u32 nReplace; |
| 102114 | + const char *zReplace; |
| 102115 | + if( sqlite3IsIdChar(*pBest->t.z) ){ |
| 102116 | + nReplace = nNew; |
| 102117 | + zReplace = zNew; |
| 102118 | + }else{ |
| 102119 | + nReplace = nQuot; |
| 102120 | + zReplace = zQuot; |
| 102121 | + } |
| 102122 | + |
| 102123 | + iOff = pBest->t.z - zSql; |
| 102124 | + if( pBest->t.n!=nReplace ){ |
| 102125 | + memmove(&zOut[iOff + nReplace], &zOut[iOff + pBest->t.n], |
| 102126 | + nOut - (iOff + pBest->t.n) |
| 102127 | + ); |
| 102128 | + nOut += nReplace - pBest->t.n; |
| 102129 | + zOut[nOut] = '\0'; |
| 102130 | + } |
| 102131 | + memcpy(&zOut[iOff], zReplace, nReplace); |
| 102132 | + sqlite3DbFree(db, pBest); |
| 102133 | + } |
| 102134 | + |
| 102135 | + sqlite3_result_text(pCtx, zOut, -1, SQLITE_TRANSIENT); |
| 102136 | + sqlite3DbFree(db, zOut); |
| 102137 | + }else{ |
| 102138 | + rc = SQLITE_NOMEM; |
| 102139 | + } |
| 102140 | + |
| 102141 | + sqlite3_free(zQuot); |
| 102142 | + return rc; |
| 102143 | +} |
| 102144 | + |
| 102145 | +/* |
| 102146 | +** Resolve all symbols in the trigger at pParse->pNewTrigger, assuming |
| 102147 | +** it was read from the schema of database zDb. Return SQLITE_OK if |
| 102148 | +** successful. Otherwise, return an SQLite error code and leave an error |
| 102149 | +** message in the Parse object. |
| 102150 | +*/ |
| 102151 | +static int renameResolveTrigger(Parse *pParse, const char *zDb){ |
| 102152 | + sqlite3 *db = pParse->db; |
| 102153 | + TriggerStep *pStep; |
| 102154 | + NameContext sNC; |
| 102155 | + int rc = SQLITE_OK; |
| 102156 | + |
| 102157 | + memset(&sNC, 0, sizeof(sNC)); |
| 102158 | + sNC.pParse = pParse; |
| 102159 | + pParse->pTriggerTab = sqlite3FindTable(db, pParse->pNewTrigger->table, zDb); |
| 102160 | + pParse->eTriggerOp = pParse->pNewTrigger->op; |
| 102161 | + |
| 102162 | + /* Resolve symbols in WHEN clause */ |
| 102163 | + if( pParse->pNewTrigger->pWhen ){ |
| 102164 | + rc = sqlite3ResolveExprNames(&sNC, pParse->pNewTrigger->pWhen); |
| 102165 | + } |
| 102166 | + |
| 102167 | + for(pStep=pParse->pNewTrigger->step_list; |
| 102168 | + rc==SQLITE_OK && pStep; |
| 102169 | + pStep=pStep->pNext |
| 102170 | + ){ |
| 102171 | + if( pStep->pSelect ){ |
| 102172 | + sqlite3SelectPrep(pParse, pStep->pSelect, &sNC); |
| 102173 | + if( pParse->nErr ) rc = pParse->rc; |
| 102174 | + } |
| 102175 | + if( rc==SQLITE_OK && pStep->zTarget ){ |
| 102176 | + Table *pTarget = sqlite3LocateTable(pParse, 0, pStep->zTarget, zDb); |
| 102177 | + if( pTarget==0 ){ |
| 102178 | + rc = SQLITE_ERROR; |
| 102179 | + }else{ |
| 102180 | + SrcList sSrc; |
| 102181 | + memset(&sSrc, 0, sizeof(sSrc)); |
| 102182 | + sSrc.nSrc = 1; |
| 102183 | + sSrc.a[0].zName = pStep->zTarget; |
| 102184 | + sSrc.a[0].pTab = pTarget; |
| 102185 | + sNC.pSrcList = &sSrc; |
| 102186 | + if( pStep->pWhere ){ |
| 102187 | + rc = sqlite3ResolveExprNames(&sNC, pStep->pWhere); |
| 102188 | + } |
| 102189 | + if( rc==SQLITE_OK ){ |
| 102190 | + rc = sqlite3ResolveExprListNames(&sNC, pStep->pExprList); |
| 102191 | + } |
| 102192 | + assert( !pStep->pUpsert || (!pStep->pWhere && !pStep->pExprList) ); |
| 102193 | + if( pStep->pUpsert ){ |
| 102194 | + Upsert *pUpsert = pStep->pUpsert; |
| 102195 | + assert( rc==SQLITE_OK ); |
| 102196 | + pUpsert->pUpsertSrc = &sSrc; |
| 102197 | + sNC.uNC.pUpsert = pUpsert; |
| 102198 | + sNC.ncFlags = NC_UUpsert; |
| 102199 | + rc = sqlite3ResolveExprListNames(&sNC, pUpsert->pUpsertTarget); |
| 102200 | + if( rc==SQLITE_OK ){ |
| 102201 | + ExprList *pUpsertSet = pUpsert->pUpsertSet; |
| 102202 | + rc = sqlite3ResolveExprListNames(&sNC, pUpsertSet); |
| 102203 | + } |
| 102204 | + if( rc==SQLITE_OK ){ |
| 102205 | + rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertWhere); |
| 102206 | + } |
| 102207 | + if( rc==SQLITE_OK ){ |
| 102208 | + rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertTargetWhere); |
| 102209 | + } |
| 102210 | + sNC.ncFlags = 0; |
| 102211 | + } |
| 102212 | + } |
| 102213 | + } |
| 102214 | + } |
| 102215 | + return rc; |
| 102216 | +} |
| 102217 | + |
| 102218 | +/* |
| 102219 | +** Invoke sqlite3WalkExpr() or sqlite3WalkSelect() on all Select or Expr |
| 102220 | +** objects that are part of the trigger passed as the second argument. |
| 102221 | +*/ |
| 102222 | +static void renameWalkTrigger(Walker *pWalker, Trigger *pTrigger){ |
| 102223 | + TriggerStep *pStep; |
| 102224 | + |
| 102225 | + /* Find tokens to edit in WHEN clause */ |
| 102226 | + sqlite3WalkExpr(pWalker, pTrigger->pWhen); |
| 102227 | + |
| 102228 | + /* Find tokens to edit in trigger steps */ |
| 102229 | + for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){ |
| 102230 | + sqlite3WalkSelect(pWalker, pStep->pSelect); |
| 102231 | + sqlite3WalkExpr(pWalker, pStep->pWhere); |
| 102232 | + sqlite3WalkExprList(pWalker, pStep->pExprList); |
| 102233 | + if( pStep->pUpsert ){ |
| 102234 | + Upsert *pUpsert = pStep->pUpsert; |
| 102235 | + sqlite3WalkExprList(pWalker, pUpsert->pUpsertTarget); |
| 102236 | + sqlite3WalkExprList(pWalker, pUpsert->pUpsertSet); |
| 102237 | + sqlite3WalkExpr(pWalker, pUpsert->pUpsertWhere); |
| 102238 | + sqlite3WalkExpr(pWalker, pUpsert->pUpsertTargetWhere); |
| 102239 | + } |
| 102240 | + } |
| 102241 | +} |
| 102242 | + |
| 102243 | +/* |
| 102244 | +** Free the contents of Parse object (*pParse). Do not free the memory |
| 102245 | +** occupied by the Parse object itself. |
| 102246 | +*/ |
| 102247 | +static void renameParseCleanup(Parse *pParse){ |
| 102248 | + sqlite3 *db = pParse->db; |
| 102249 | + if( pParse->pVdbe ){ |
| 102250 | + sqlite3VdbeFinalize(pParse->pVdbe); |
| 102251 | + } |
| 102252 | + sqlite3DeleteTable(db, pParse->pNewTable); |
| 102253 | + if( pParse->pNewIndex ) sqlite3FreeIndex(db, pParse->pNewIndex); |
| 102254 | + sqlite3DeleteTrigger(db, pParse->pNewTrigger); |
| 102255 | + sqlite3DbFree(db, pParse->zErrMsg); |
| 102256 | + renameTokenFree(db, pParse->pRename); |
| 102257 | + sqlite3ParserReset(pParse); |
| 102258 | +} |
| 102259 | + |
| 102260 | +/* |
| 102261 | +** SQL function: |
| 102262 | +** |
| 102263 | +** sqlite_rename_column(zSql, iCol, bQuote, zNew, zTable, zOld) |
| 102264 | +** |
| 102265 | +** 0. zSql: SQL statement to rewrite |
| 102266 | +** 1. type: Type of object ("table", "view" etc.) |
| 102267 | +** 2. object: Name of object |
| 102268 | +** 3. Database: Database name (e.g. "main") |
| 102269 | +** 4. Table: Table name |
| 102270 | +** 5. iCol: Index of column to rename |
| 102271 | +** 6. zNew: New column name |
| 102272 | +** 7. bQuote: Non-zero if the new column name should be quoted. |
| 102273 | +** 8. bTemp: True if zSql comes from temp schema |
| 102274 | +** |
| 102275 | +** Do a column rename operation on the CREATE statement given in zSql. |
| 102276 | +** The iCol-th column (left-most is 0) of table zTable is renamed from zCol |
| 102277 | +** into zNew. The name should be quoted if bQuote is true. |
| 102278 | +** |
| 102279 | +** This function is used internally by the ALTER TABLE RENAME COLUMN command. |
| 102280 | +** Though accessible to application code, it is not intended for use by |
| 102281 | +** applications. The existance of this function, and the way it works, |
| 102282 | +** is subject to change without notice. |
| 102283 | +** |
| 102284 | +** If any of the parameters are out-of-bounds, then simply return NULL. |
| 102285 | +** An out-of-bounds parameter can only occur when the application calls |
| 102286 | +** this function directly. The parameters will always be well-formed when |
| 102287 | +** this routine is invoked by the bytecode for a legitimate ALTER TABLE |
| 102288 | +** statement. |
| 102289 | +*/ |
| 102290 | +static void renameColumnFunc( |
| 102291 | + sqlite3_context *context, |
| 102292 | + int NotUsed, |
| 102293 | + sqlite3_value **argv |
| 102294 | +){ |
| 102295 | + sqlite3 *db = sqlite3_context_db_handle(context); |
| 102296 | + RenameCtx sCtx; |
| 102297 | + const char *zSql = (const char*)sqlite3_value_text(argv[0]); |
| 102298 | + const char *zDb = (const char*)sqlite3_value_text(argv[3]); |
| 102299 | + const char *zTable = (const char*)sqlite3_value_text(argv[4]); |
| 102300 | + int iCol = sqlite3_value_int(argv[5]); |
| 102301 | + const char *zNew = (const char*)sqlite3_value_text(argv[6]); |
| 102302 | + int bQuote = sqlite3_value_int(argv[7]); |
| 102303 | + int bTemp = sqlite3_value_int(argv[8]); |
| 102304 | + const char *zOld; |
| 102305 | + int rc; |
| 102306 | + Parse sParse; |
| 102307 | + Walker sWalker; |
| 102308 | + Index *pIdx; |
| 102309 | + int i; |
| 102310 | + Table *pTab; |
| 102311 | +#ifndef SQLITE_OMIT_AUTHORIZATION |
| 102312 | + sqlite3_xauth xAuth = db->xAuth; |
| 102313 | +#endif |
| 102314 | + |
| 102315 | + UNUSED_PARAMETER(NotUsed); |
| 102316 | + if( zSql==0 ) return; |
| 102317 | + if( zTable==0 ) return; |
| 102318 | + if( zNew==0 ) return; |
| 102319 | + if( iCol<0 ) return; |
| 102320 | + sqlite3BtreeEnterAll(db); |
| 102321 | + pTab = sqlite3FindTable(db, zTable, zDb); |
| 102322 | + if( pTab==0 || iCol>=pTab->nCol ){ |
| 102323 | + sqlite3BtreeLeaveAll(db); |
| 102324 | + return; |
| 102325 | + } |
| 102326 | + zOld = pTab->aCol[iCol].zName; |
| 102327 | + memset(&sCtx, 0, sizeof(sCtx)); |
| 102328 | + sCtx.iCol = ((iCol==pTab->iPKey) ? -1 : iCol); |
| 102329 | + |
| 102330 | +#ifndef SQLITE_OMIT_AUTHORIZATION |
| 102331 | + db->xAuth = 0; |
| 102332 | +#endif |
| 102333 | + rc = renameParseSql(&sParse, zDb, 0, db, zSql, bTemp); |
| 102334 | + |
| 102335 | + /* Find tokens that need to be replaced. */ |
| 102336 | + memset(&sWalker, 0, sizeof(Walker)); |
| 102337 | + sWalker.pParse = &sParse; |
| 102338 | + sWalker.xExprCallback = renameColumnExprCb; |
| 102339 | + sWalker.xSelectCallback = renameColumnSelectCb; |
| 102340 | + sWalker.u.pRename = &sCtx; |
| 102341 | + |
| 102342 | + sCtx.pTab = pTab; |
| 102343 | + if( rc!=SQLITE_OK ) goto renameColumnFunc_done; |
| 102344 | + if( sParse.pNewTable ){ |
| 102345 | + Select *pSelect = sParse.pNewTable->pSelect; |
| 102346 | + if( pSelect ){ |
| 102347 | + sParse.rc = SQLITE_OK; |
| 102348 | + sqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, 0); |
| 102349 | + rc = (db->mallocFailed ? SQLITE_NOMEM : sParse.rc); |
| 102350 | + if( rc==SQLITE_OK ){ |
| 102351 | + sqlite3WalkSelect(&sWalker, pSelect); |
| 102352 | + } |
| 102353 | + if( rc!=SQLITE_OK ) goto renameColumnFunc_done; |
| 102354 | + }else{ |
| 102355 | + /* A regular table */ |
| 102356 | + int bFKOnly = sqlite3_stricmp(zTable, sParse.pNewTable->zName); |
| 102357 | + FKey *pFKey; |
| 102358 | + assert( sParse.pNewTable->pSelect==0 ); |
| 102359 | + sCtx.pTab = sParse.pNewTable; |
| 102360 | + if( bFKOnly==0 ){ |
| 102361 | + renameTokenFind( |
| 102362 | + &sParse, &sCtx, (void*)sParse.pNewTable->aCol[iCol].zName |
| 102363 | + ); |
| 102364 | + if( sCtx.iCol<0 ){ |
| 102365 | + renameTokenFind(&sParse, &sCtx, (void*)&sParse.pNewTable->iPKey); |
| 102366 | + } |
| 102367 | + sqlite3WalkExprList(&sWalker, sParse.pNewTable->pCheck); |
| 102368 | + for(pIdx=sParse.pNewTable->pIndex; pIdx; pIdx=pIdx->pNext){ |
| 102369 | + sqlite3WalkExprList(&sWalker, pIdx->aColExpr); |
| 102370 | + } |
| 102371 | + } |
| 102372 | + |
| 102373 | + for(pFKey=sParse.pNewTable->pFKey; pFKey; pFKey=pFKey->pNextFrom){ |
| 102374 | + for(i=0; i<pFKey->nCol; i++){ |
| 102375 | + if( bFKOnly==0 && pFKey->aCol[i].iFrom==iCol ){ |
| 102376 | + renameTokenFind(&sParse, &sCtx, (void*)&pFKey->aCol[i]); |
| 102377 | + } |
| 102378 | + if( 0==sqlite3_stricmp(pFKey->zTo, zTable) |
| 102379 | + && 0==sqlite3_stricmp(pFKey->aCol[i].zCol, zOld) |
| 102380 | + ){ |
| 102381 | + renameTokenFind(&sParse, &sCtx, (void*)pFKey->aCol[i].zCol); |
| 102382 | + } |
| 102383 | + } |
| 102384 | + } |
| 102385 | + } |
| 102386 | + }else if( sParse.pNewIndex ){ |
| 102387 | + sqlite3WalkExprList(&sWalker, sParse.pNewIndex->aColExpr); |
| 102388 | + sqlite3WalkExpr(&sWalker, sParse.pNewIndex->pPartIdxWhere); |
| 102389 | + }else{ |
| 102390 | + /* A trigger */ |
| 102391 | + TriggerStep *pStep; |
| 102392 | + rc = renameResolveTrigger(&sParse, (bTemp ? 0 : zDb)); |
| 102393 | + if( rc!=SQLITE_OK ) goto renameColumnFunc_done; |
| 102394 | + |
| 102395 | + for(pStep=sParse.pNewTrigger->step_list; pStep; pStep=pStep->pNext){ |
| 102396 | + if( pStep->zTarget ){ |
| 102397 | + Table *pTarget = sqlite3LocateTable(&sParse, 0, pStep->zTarget, zDb); |
| 102398 | + if( pTarget==pTab ){ |
| 102399 | + if( pStep->pUpsert ){ |
| 102400 | + ExprList *pUpsertSet = pStep->pUpsert->pUpsertSet; |
| 102401 | + renameColumnElistNames(&sParse, &sCtx, pUpsertSet, zOld); |
| 102402 | + } |
| 102403 | + renameColumnIdlistNames(&sParse, &sCtx, pStep->pIdList, zOld); |
| 102404 | + renameColumnElistNames(&sParse, &sCtx, pStep->pExprList, zOld); |
| 102405 | + } |
| 102406 | + } |
| 102407 | + } |
| 102408 | + |
| 102409 | + |
| 102410 | + /* Find tokens to edit in UPDATE OF clause */ |
| 102411 | + if( sParse.pTriggerTab==pTab ){ |
| 102412 | + renameColumnIdlistNames(&sParse, &sCtx,sParse.pNewTrigger->pColumns,zOld); |
| 102413 | + } |
| 102414 | + |
| 102415 | + /* Find tokens to edit in various expressions and selects */ |
| 102416 | + renameWalkTrigger(&sWalker, sParse.pNewTrigger); |
| 102417 | + } |
| 102418 | + |
| 102419 | + assert( rc==SQLITE_OK ); |
| 102420 | + rc = renameEditSql(context, &sCtx, zSql, zNew, bQuote); |
| 102421 | + |
| 102422 | +renameColumnFunc_done: |
| 102423 | + if( rc!=SQLITE_OK ){ |
| 102424 | + if( sParse.zErrMsg ){ |
| 102425 | + renameColumnParseError(context, 0, argv[1], argv[2], &sParse); |
| 102426 | + }else{ |
| 102427 | + sqlite3_result_error_code(context, rc); |
| 102428 | + } |
| 102429 | + } |
| 102430 | + |
| 102431 | + renameParseCleanup(&sParse); |
| 102432 | + renameTokenFree(db, sCtx.pList); |
| 102433 | +#ifndef SQLITE_OMIT_AUTHORIZATION |
| 102434 | + db->xAuth = xAuth; |
| 102435 | +#endif |
| 102436 | + sqlite3BtreeLeaveAll(db); |
| 102437 | +} |
| 102438 | + |
| 102439 | +/* |
| 102440 | +** Walker expression callback used by "RENAME TABLE". |
| 102441 | +*/ |
| 102442 | +static int renameTableExprCb(Walker *pWalker, Expr *pExpr){ |
| 102443 | + RenameCtx *p = pWalker->u.pRename; |
| 102444 | + if( pExpr->op==TK_COLUMN && p->pTab==pExpr->pTab ){ |
| 102445 | + renameTokenFind(pWalker->pParse, p, (void*)&pExpr->pTab); |
| 102446 | + } |
| 102447 | + return WRC_Continue; |
| 102448 | +} |
| 102449 | + |
| 102450 | +/* |
| 102451 | +** Walker select callback used by "RENAME TABLE". |
| 102452 | +*/ |
| 102453 | +static int renameTableSelectCb(Walker *pWalker, Select *pSelect){ |
| 102454 | + int i; |
| 102455 | + RenameCtx *p = pWalker->u.pRename; |
| 102456 | + SrcList *pSrc = pSelect->pSrc; |
| 102457 | + for(i=0; i<pSrc->nSrc; i++){ |
| 102458 | + struct SrcList_item *pItem = &pSrc->a[i]; |
| 102459 | + if( pItem->pTab==p->pTab ){ |
| 102460 | + renameTokenFind(pWalker->pParse, p, pItem->zName); |
| 102461 | + } |
| 102462 | + } |
| 102463 | + |
| 102464 | + return WRC_Continue; |
| 102465 | +} |
| 102466 | + |
| 102467 | + |
| 102468 | +/* |
| 102469 | +** This C function implements an SQL user function that is used by SQL code |
| 102470 | +** generated by the ALTER TABLE ... RENAME command to modify the definition |
| 102471 | +** of any foreign key constraints that use the table being renamed as the |
| 102472 | +** parent table. It is passed three arguments: |
| 102473 | +** |
| 102474 | +** 0: The database containing the table being renamed. |
| 102475 | +** 1. type: Type of object ("table", "view" etc.) |
| 102476 | +** 2. object: Name of object |
| 102477 | +** 3: The complete text of the schema statement being modified, |
| 102478 | +** 4: The old name of the table being renamed, and |
| 102479 | +** 5: The new name of the table being renamed. |
| 102480 | +** 6: True if the schema statement comes from the temp db. |
| 102481 | +** |
| 102482 | +** It returns the new schema statement. For example: |
| 102483 | +** |
| 102484 | +** sqlite_rename_table('main', 'CREATE TABLE t1(a REFERENCES t2)','t2','t3',0) |
| 102485 | +** -> 'CREATE TABLE t1(a REFERENCES t3)' |
| 102486 | +*/ |
| 102487 | +static void renameTableFunc( |
| 102488 | + sqlite3_context *context, |
| 102489 | + int NotUsed, |
| 102490 | + sqlite3_value **argv |
| 102491 | +){ |
| 102492 | + sqlite3 *db = sqlite3_context_db_handle(context); |
| 102493 | + const char *zDb = (const char*)sqlite3_value_text(argv[0]); |
| 102494 | + const char *zInput = (const char*)sqlite3_value_text(argv[3]); |
| 102495 | + const char *zOld = (const char*)sqlite3_value_text(argv[4]); |
| 102496 | + const char *zNew = (const char*)sqlite3_value_text(argv[5]); |
| 102497 | + int bTemp = sqlite3_value_int(argv[6]); |
| 102498 | + UNUSED_PARAMETER(NotUsed); |
| 102499 | + |
| 102500 | + if( zInput && zOld && zNew ){ |
| 102501 | + Parse sParse; |
| 102502 | + int rc; |
| 102503 | + int bQuote = 1; |
| 102504 | + RenameCtx sCtx; |
| 102505 | + Walker sWalker; |
| 102506 | + |
| 102507 | +#ifndef SQLITE_OMIT_AUTHORIZATION |
| 102508 | + sqlite3_xauth xAuth = db->xAuth; |
| 102509 | + db->xAuth = 0; |
| 102510 | +#endif |
| 102511 | + |
| 102512 | + sqlite3BtreeEnterAll(db); |
| 102513 | + |
| 102514 | + memset(&sCtx, 0, sizeof(RenameCtx)); |
| 102515 | + sCtx.pTab = sqlite3FindTable(db, zOld, zDb); |
| 102516 | + memset(&sWalker, 0, sizeof(Walker)); |
| 102517 | + sWalker.pParse = &sParse; |
| 102518 | + sWalker.xExprCallback = renameTableExprCb; |
| 102519 | + sWalker.xSelectCallback = renameTableSelectCb; |
| 102520 | + sWalker.u.pRename = &sCtx; |
| 102521 | + |
| 102522 | + rc = renameParseSql(&sParse, zDb, 1, db, zInput, bTemp); |
| 102523 | + |
| 102524 | + if( rc==SQLITE_OK ){ |
| 102525 | + if( sParse.pNewTable ){ |
| 102526 | + Table *pTab = sParse.pNewTable; |
| 102527 | + |
| 102528 | + if( pTab->pSelect ){ |
| 102529 | + NameContext sNC; |
| 102530 | + memset(&sNC, 0, sizeof(sNC)); |
| 102531 | + sNC.pParse = &sParse; |
| 102532 | + |
| 102533 | + sqlite3SelectPrep(&sParse, pTab->pSelect, &sNC); |
| 102534 | + if( sParse.nErr ) rc = sParse.rc; |
| 102535 | + sqlite3WalkSelect(&sWalker, pTab->pSelect); |
| 102536 | + }else{ |
| 102537 | + /* Modify any FK definitions to point to the new table. */ |
| 102538 | +#ifndef SQLITE_OMIT_FOREIGN_KEY |
| 102539 | + FKey *pFKey; |
| 102540 | + for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){ |
| 102541 | + if( sqlite3_stricmp(pFKey->zTo, zOld)==0 ){ |
| 102542 | + renameTokenFind(&sParse, &sCtx, (void*)pFKey->zTo); |
| 102543 | + } |
| 102544 | + } |
| 102545 | +#endif |
| 102546 | + |
| 102547 | + /* If this is the table being altered, fix any table refs in CHECK |
| 102548 | + ** expressions. Also update the name that appears right after the |
| 102549 | + ** "CREATE [VIRTUAL] TABLE" bit. */ |
| 102550 | + if( sqlite3_stricmp(zOld, pTab->zName)==0 ){ |
| 102551 | + sCtx.pTab = pTab; |
| 102552 | + sqlite3WalkExprList(&sWalker, pTab->pCheck); |
| 102553 | + renameTokenFind(&sParse, &sCtx, pTab->zName); |
| 102554 | + } |
| 102555 | + } |
| 102556 | + } |
| 102557 | + |
| 102558 | + else if( sParse.pNewIndex ){ |
| 102559 | + renameTokenFind(&sParse, &sCtx, sParse.pNewIndex->zName); |
| 102560 | + sqlite3WalkExpr(&sWalker, sParse.pNewIndex->pPartIdxWhere); |
| 102561 | + } |
| 102562 | + |
| 102563 | +#ifndef SQLITE_OMIT_TRIGGER |
| 102564 | + else{ |
| 102565 | + Trigger *pTrigger = sParse.pNewTrigger; |
| 102566 | + TriggerStep *pStep; |
| 102567 | + if( 0==sqlite3_stricmp(sParse.pNewTrigger->table, zOld) |
| 102568 | + && sCtx.pTab->pSchema==pTrigger->pTabSchema |
| 102569 | + ){ |
| 102570 | + renameTokenFind(&sParse, &sCtx, sParse.pNewTrigger->table); |
| 102571 | + } |
| 102572 | + |
| 102573 | + rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb); |
| 102574 | + if( rc==SQLITE_OK ){ |
| 102575 | + renameWalkTrigger(&sWalker, pTrigger); |
| 102576 | + for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){ |
| 102577 | + if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){ |
| 102578 | + renameTokenFind(&sParse, &sCtx, pStep->zTarget); |
| 102579 | + } |
| 102580 | + } |
| 102581 | + } |
| 102582 | + } |
| 102583 | +#endif |
| 102584 | + } |
| 102585 | + |
| 102586 | + if( rc==SQLITE_OK ){ |
| 102587 | + rc = renameEditSql(context, &sCtx, zInput, zNew, bQuote); |
| 102588 | + } |
| 102589 | + if( rc!=SQLITE_OK ){ |
| 102590 | + if( sParse.zErrMsg ){ |
| 102591 | + renameColumnParseError(context, 0, argv[1], argv[2], &sParse); |
| 102592 | + }else{ |
| 102593 | + sqlite3_result_error_code(context, rc); |
| 102594 | + } |
| 102595 | + } |
| 102596 | + |
| 102597 | + renameParseCleanup(&sParse); |
| 102598 | + renameTokenFree(db, sCtx.pList); |
| 102599 | + sqlite3BtreeLeaveAll(db); |
| 102600 | +#ifndef SQLITE_OMIT_AUTHORIZATION |
| 102601 | + db->xAuth = xAuth; |
| 102602 | +#endif |
| 102603 | + } |
| 102604 | + |
| 102605 | + return; |
| 102606 | +} |
| 102607 | + |
| 102608 | +/* |
| 102609 | +** An SQL user function that checks that there are no parse or symbol |
| 102610 | +** resolution problems in a CREATE TRIGGER|TABLE|VIEW|INDEX statement. |
| 102611 | +** After an ALTER TABLE .. RENAME operation is performed and the schema |
| 102612 | +** reloaded, this function is called on each SQL statement in the schema |
| 102613 | +** to ensure that it is still usable. |
| 102614 | +** |
| 102615 | +** 0: Database name ("main", "temp" etc.). |
| 102616 | +** 1: SQL statement. |
| 102617 | +** 2: Object type ("view", "table", "trigger" or "index"). |
| 102618 | +** 3: Object name. |
| 102619 | +** 4: True if object is from temp schema. |
| 102620 | +** |
| 102621 | +** Unless it finds an error, this function normally returns NULL. However, it |
| 102622 | +** returns integer value 1 if: |
| 102623 | +** |
| 102624 | +** * the SQL argument creates a trigger, and |
| 102625 | +** * the table that the trigger is attached to is in database zDb. |
| 102626 | +*/ |
| 102627 | +static void renameTableTest( |
| 102628 | + sqlite3_context *context, |
| 102629 | + int NotUsed, |
| 102630 | + sqlite3_value **argv |
| 102631 | +){ |
| 102632 | + sqlite3 *db = sqlite3_context_db_handle(context); |
| 102633 | + char const *zDb = (const char*)sqlite3_value_text(argv[0]); |
| 102634 | + char const *zInput = (const char*)sqlite3_value_text(argv[1]); |
| 102635 | + int bTemp = sqlite3_value_int(argv[4]); |
| 102636 | + |
| 102637 | +#ifndef SQLITE_OMIT_AUTHORIZATION |
| 102638 | + sqlite3_xauth xAuth = db->xAuth; |
| 102639 | + db->xAuth = 0; |
| 102640 | +#endif |
| 102641 | + |
| 102642 | + UNUSED_PARAMETER(NotUsed); |
| 102643 | + if( zDb && zInput ){ |
| 102644 | + int rc; |
| 102645 | + Parse sParse; |
| 102646 | + rc = renameParseSql(&sParse, zDb, 1, db, zInput, bTemp); |
| 102647 | + if( rc==SQLITE_OK ){ |
| 102648 | + if( sParse.pNewTable && sParse.pNewTable->pSelect ){ |
| 102649 | + NameContext sNC; |
| 102650 | + memset(&sNC, 0, sizeof(sNC)); |
| 102651 | + sNC.pParse = &sParse; |
| 102652 | + sqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, &sNC); |
| 102653 | + if( sParse.nErr ) rc = sParse.rc; |
| 102654 | + } |
| 102655 | + |
| 102656 | + else if( sParse.pNewTrigger ){ |
| 102657 | + rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb); |
| 102658 | + if( rc==SQLITE_OK ){ |
| 102659 | + int i1 = sqlite3SchemaToIndex(db, sParse.pNewTrigger->pTabSchema); |
| 102660 | + int i2 = sqlite3FindDbName(db, zDb); |
| 102661 | + if( i1==i2 ) sqlite3_result_int(context, 1); |
| 102662 | + } |
| 102663 | + } |
| 102664 | + } |
| 102665 | + |
| 102666 | + if( rc!=SQLITE_OK ){ |
| 102667 | + renameColumnParseError(context, 1, argv[2], argv[3], &sParse); |
| 102668 | + } |
| 102669 | + renameParseCleanup(&sParse); |
| 102670 | + } |
| 102671 | + |
| 102672 | +#ifndef SQLITE_OMIT_AUTHORIZATION |
| 102673 | + db->xAuth = xAuth; |
| 102674 | +#endif |
| 102675 | +} |
| 102676 | + |
| 102677 | +/* |
| 102678 | +** Register built-in functions used to help implement ALTER TABLE |
| 102679 | +*/ |
| 102680 | +SQLITE_PRIVATE void sqlite3AlterFunctions(void){ |
| 102681 | + static FuncDef aAlterTableFuncs[] = { |
| 102682 | + FUNCTION(sqlite_rename_column, 9, 0, 0, renameColumnFunc), |
| 102683 | + FUNCTION(sqlite_rename_table, 7, 0, 0, renameTableFunc), |
| 102684 | + FUNCTION(sqlite_rename_test, 5, 0, 0, renameTableTest), |
| 102685 | + }; |
| 102686 | + sqlite3InsertBuiltinFuncs(aAlterTableFuncs, ArraySize(aAlterTableFuncs)); |
| 102687 | +} |
| 101846 | 102688 | #endif /* SQLITE_ALTER_TABLE */ |
| 101847 | 102689 | |
| 101848 | 102690 | /************** End of alter.c ***********************************************/ |
| 101849 | 102691 | /************** Begin file analyze.c *****************************************/ |
| 101850 | 102692 | /* |
| | @@ -104622,11 +105464,11 @@ |
| 104622 | 105464 | int rc; |
| 104623 | 105465 | |
| 104624 | 105466 | /* Don't do any authorization checks if the database is initialising |
| 104625 | 105467 | ** or if the parser is being invoked from within sqlite3_declare_vtab. |
| 104626 | 105468 | */ |
| 104627 | | - if( db->init.busy || IN_DECLARE_VTAB ){ |
| 105469 | + if( db->init.busy || IN_SPECIAL_PARSE ){ |
| 104628 | 105470 | return SQLITE_OK; |
| 104629 | 105471 | } |
| 104630 | 105472 | |
| 104631 | 105473 | if( db->xAuth==0 ){ |
| 104632 | 105474 | return SQLITE_OK; |
| | @@ -105128,11 +105970,11 @@ |
| 105128 | 105970 | } |
| 105129 | 105971 | |
| 105130 | 105972 | /* |
| 105131 | 105973 | ** Reclaim the memory used by an index |
| 105132 | 105974 | */ |
| 105133 | | -static void freeIndex(sqlite3 *db, Index *p){ |
| 105975 | +SQLITE_PRIVATE void sqlite3FreeIndex(sqlite3 *db, Index *p){ |
| 105134 | 105976 | #ifndef SQLITE_OMIT_ANALYZE |
| 105135 | 105977 | sqlite3DeleteIndexSamples(db, p); |
| 105136 | 105978 | #endif |
| 105137 | 105979 | sqlite3ExprDelete(db, p->pPartIdxWhere); |
| 105138 | 105980 | sqlite3ExprListDelete(db, p->aColExpr); |
| | @@ -105168,11 +106010,11 @@ |
| 105168 | 106010 | while( ALWAYS(p) && p->pNext!=pIndex ){ p = p->pNext; } |
| 105169 | 106011 | if( ALWAYS(p && p->pNext==pIndex) ){ |
| 105170 | 106012 | p->pNext = pIndex->pNext; |
| 105171 | 106013 | } |
| 105172 | 106014 | } |
| 105173 | | - freeIndex(db, pIndex); |
| 106015 | + sqlite3FreeIndex(db, pIndex); |
| 105174 | 106016 | } |
| 105175 | 106017 | db->mDbFlags |= DBFLAG_SchemaChange; |
| 105176 | 106018 | } |
| 105177 | 106019 | |
| 105178 | 106020 | /* |
| | @@ -105314,11 +106156,11 @@ |
| 105314 | 106156 | &pIndex->pSchema->idxHash, zName, 0 |
| 105315 | 106157 | ); |
| 105316 | 106158 | assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); |
| 105317 | 106159 | assert( pOld==pIndex || pOld==0 ); |
| 105318 | 106160 | } |
| 105319 | | - freeIndex(db, pIndex); |
| 106161 | + sqlite3FreeIndex(db, pIndex); |
| 105320 | 106162 | } |
| 105321 | 106163 | |
| 105322 | 106164 | /* Delete any foreign keys attached to this table. */ |
| 105323 | 106165 | sqlite3FkDelete(db, pTable); |
| 105324 | 106166 | |
| | @@ -105472,11 +106314,11 @@ |
| 105472 | 106314 | if( iDb<0 ){ |
| 105473 | 106315 | sqlite3ErrorMsg(pParse, "unknown database %T", pName1); |
| 105474 | 106316 | return -1; |
| 105475 | 106317 | } |
| 105476 | 106318 | }else{ |
| 105477 | | - assert( db->init.iDb==0 || db->init.busy |
| 106319 | + assert( db->init.iDb==0 || db->init.busy || IN_RENAME_OBJECT |
| 105478 | 106320 | || (db->mDbFlags & DBFLAG_Vacuum)!=0); |
| 105479 | 106321 | iDb = db->init.iDb; |
| 105480 | 106322 | *pUnqual = pName1; |
| 105481 | 106323 | } |
| 105482 | 106324 | return iDb; |
| | @@ -105567,10 +106409,13 @@ |
| 105567 | 106409 | sqlite3ErrorMsg(pParse, "temporary table name must be unqualified"); |
| 105568 | 106410 | return; |
| 105569 | 106411 | } |
| 105570 | 106412 | if( !OMIT_TEMPDB && isTemp ) iDb = 1; |
| 105571 | 106413 | zName = sqlite3NameFromToken(db, pName); |
| 106414 | + if( IN_RENAME_OBJECT ){ |
| 106415 | + sqlite3RenameTokenMap(pParse, (void*)zName, pName); |
| 106416 | + } |
| 105572 | 106417 | } |
| 105573 | 106418 | pParse->sNameToken = *pName; |
| 105574 | 106419 | if( zName==0 ) return; |
| 105575 | 106420 | if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ |
| 105576 | 106421 | goto begin_table_error; |
| | @@ -105602,11 +106447,11 @@ |
| 105602 | 106447 | ** it does. The exception is if the statement being parsed was passed |
| 105603 | 106448 | ** to an sqlite3_declare_vtab() call. In that case only the column names |
| 105604 | 106449 | ** and types will be used, so there is no need to test for namespace |
| 105605 | 106450 | ** collisions. |
| 105606 | 106451 | */ |
| 105607 | | - if( !IN_DECLARE_VTAB ){ |
| 106452 | + if( !IN_SPECIAL_PARSE ){ |
| 105608 | 106453 | char *zDb = db->aDb[iDb].zDbSName; |
| 105609 | 106454 | if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ |
| 105610 | 106455 | goto begin_table_error; |
| 105611 | 106456 | } |
| 105612 | 106457 | pTable = sqlite3FindTable(db, zName, zDb); |
| | @@ -105761,10 +106606,11 @@ |
| 105761 | 106606 | sqlite3ErrorMsg(pParse, "too many columns on %s", p->zName); |
| 105762 | 106607 | return; |
| 105763 | 106608 | } |
| 105764 | 106609 | z = sqlite3DbMallocRaw(db, pName->n + pType->n + 2); |
| 105765 | 106610 | if( z==0 ) return; |
| 106611 | + if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, pName); |
| 105766 | 106612 | memcpy(z, pName->z, pName->n); |
| 105767 | 106613 | z[pName->n] = 0; |
| 105768 | 106614 | sqlite3Dequote(z); |
| 105769 | 106615 | for(i=0; i<p->nCol; i++){ |
| 105770 | 106616 | if( sqlite3_stricmp(z, p->aCol[i].zName)==0 ){ |
| | @@ -105967,10 +106813,13 @@ |
| 105967 | 106813 | x.flags = EP_Skip; |
| 105968 | 106814 | pCol->pDflt = sqlite3ExprDup(db, &x, EXPRDUP_REDUCE); |
| 105969 | 106815 | sqlite3DbFree(db, x.u.zToken); |
| 105970 | 106816 | } |
| 105971 | 106817 | } |
| 106818 | + if( IN_RENAME_OBJECT ){ |
| 106819 | + sqlite3RenameExprUnmap(pParse, pExpr); |
| 106820 | + } |
| 105972 | 106821 | sqlite3ExprDelete(db, pExpr); |
| 105973 | 106822 | } |
| 105974 | 106823 | |
| 105975 | 106824 | /* |
| 105976 | 106825 | ** Backwards Compatibility Hack: |
| | @@ -106058,10 +106907,13 @@ |
| 106058 | 106907 | if( nTerm==1 |
| 106059 | 106908 | && pCol |
| 106060 | 106909 | && sqlite3StrICmp(sqlite3ColumnType(pCol,""), "INTEGER")==0 |
| 106061 | 106910 | && sortOrder!=SQLITE_SO_DESC |
| 106062 | 106911 | ){ |
| 106912 | + if( IN_RENAME_OBJECT && pList ){ |
| 106913 | + sqlite3RenameTokenRemap(pParse, &pTab->iPKey, pList->a[0].pExpr); |
| 106914 | + } |
| 106063 | 106915 | pTab->iPKey = iCol; |
| 106064 | 106916 | pTab->keyConf = (u8)onError; |
| 106065 | 106917 | assert( autoInc==0 || autoInc==1 ); |
| 106066 | 106918 | pTab->tabFlags |= autoInc*TF_Autoincrement; |
| 106067 | 106919 | if( pList ) pParse->iPkSortOrder = pList->a[0].sortOrder; |
| | @@ -106860,11 +107712,16 @@ |
| 106860 | 107712 | /* Make a copy of the entire SELECT statement that defines the view. |
| 106861 | 107713 | ** This will force all the Expr.token.z values to be dynamically |
| 106862 | 107714 | ** allocated rather than point to the input string - which means that |
| 106863 | 107715 | ** they will persist after the current sqlite3_exec() call returns. |
| 106864 | 107716 | */ |
| 106865 | | - p->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); |
| 107717 | + if( IN_RENAME_OBJECT ){ |
| 107718 | + p->pSelect = pSelect; |
| 107719 | + pSelect = 0; |
| 107720 | + }else{ |
| 107721 | + p->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); |
| 107722 | + } |
| 106866 | 107723 | p->pCheck = sqlite3ExprListDup(db, pCNames, EXPRDUP_REDUCE); |
| 106867 | 107724 | if( db->mallocFailed ) goto create_view_fail; |
| 106868 | 107725 | |
| 106869 | 107726 | /* Locate the end of the CREATE VIEW statement. Make sEnd point to |
| 106870 | 107727 | ** the end. |
| | @@ -107428,10 +108285,13 @@ |
| 107428 | 108285 | } |
| 107429 | 108286 | pFKey->pFrom = p; |
| 107430 | 108287 | pFKey->pNextFrom = p->pFKey; |
| 107431 | 108288 | z = (char*)&pFKey->aCol[nCol]; |
| 107432 | 108289 | pFKey->zTo = z; |
| 108290 | + if( IN_RENAME_OBJECT ){ |
| 108291 | + sqlite3RenameTokenMap(pParse, (void*)z, pTo); |
| 108292 | + } |
| 107433 | 108293 | memcpy(z, pTo->z, pTo->n); |
| 107434 | 108294 | z[pTo->n] = 0; |
| 107435 | 108295 | sqlite3Dequote(z); |
| 107436 | 108296 | z += pTo->n+1; |
| 107437 | 108297 | pFKey->nCol = nCol; |
| | @@ -107450,16 +108310,22 @@ |
| 107450 | 108310 | sqlite3ErrorMsg(pParse, |
| 107451 | 108311 | "unknown column \"%s\" in foreign key definition", |
| 107452 | 108312 | pFromCol->a[i].zName); |
| 107453 | 108313 | goto fk_end; |
| 107454 | 108314 | } |
| 108315 | + if( IN_RENAME_OBJECT ){ |
| 108316 | + sqlite3RenameTokenRemap(pParse, &pFKey->aCol[i], pFromCol->a[i].zName); |
| 108317 | + } |
| 107455 | 108318 | } |
| 107456 | 108319 | } |
| 107457 | 108320 | if( pToCol ){ |
| 107458 | 108321 | for(i=0; i<nCol; i++){ |
| 107459 | 108322 | int n = sqlite3Strlen30(pToCol->a[i].zName); |
| 107460 | 108323 | pFKey->aCol[i].zCol = z; |
| 108324 | + if( IN_RENAME_OBJECT ){ |
| 108325 | + sqlite3RenameTokenRemap(pParse, z, pToCol->a[i].zName); |
| 108326 | + } |
| 107461 | 108327 | memcpy(z, pToCol->a[i].zName, n); |
| 107462 | 108328 | z[n] = 0; |
| 107463 | 108329 | z += n+1; |
| 107464 | 108330 | } |
| 107465 | 108331 | } |
| | @@ -107788,25 +108654,27 @@ |
| 107788 | 108654 | if( zName==0 ) goto exit_create_index; |
| 107789 | 108655 | assert( pName->z!=0 ); |
| 107790 | 108656 | if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ |
| 107791 | 108657 | goto exit_create_index; |
| 107792 | 108658 | } |
| 107793 | | - if( !db->init.busy ){ |
| 107794 | | - if( sqlite3FindTable(db, zName, 0)!=0 ){ |
| 107795 | | - sqlite3ErrorMsg(pParse, "there is already a table named %s", zName); |
| 108659 | + if( !IN_RENAME_OBJECT ){ |
| 108660 | + if( !db->init.busy ){ |
| 108661 | + if( sqlite3FindTable(db, zName, 0)!=0 ){ |
| 108662 | + sqlite3ErrorMsg(pParse, "there is already a table named %s", zName); |
| 108663 | + goto exit_create_index; |
| 108664 | + } |
| 108665 | + } |
| 108666 | + if( sqlite3FindIndex(db, zName, pDb->zDbSName)!=0 ){ |
| 108667 | + if( !ifNotExist ){ |
| 108668 | + sqlite3ErrorMsg(pParse, "index %s already exists", zName); |
| 108669 | + }else{ |
| 108670 | + assert( !db->init.busy ); |
| 108671 | + sqlite3CodeVerifySchema(pParse, iDb); |
| 108672 | + } |
| 107796 | 108673 | goto exit_create_index; |
| 107797 | 108674 | } |
| 107798 | 108675 | } |
| 107799 | | - if( sqlite3FindIndex(db, zName, pDb->zDbSName)!=0 ){ |
| 107800 | | - if( !ifNotExist ){ |
| 107801 | | - sqlite3ErrorMsg(pParse, "index %s already exists", zName); |
| 107802 | | - }else{ |
| 107803 | | - assert( !db->init.busy ); |
| 107804 | | - sqlite3CodeVerifySchema(pParse, iDb); |
| 107805 | | - } |
| 107806 | | - goto exit_create_index; |
| 107807 | | - } |
| 107808 | 108676 | }else{ |
| 107809 | 108677 | int n; |
| 107810 | 108678 | Index *pLoop; |
| 107811 | 108679 | for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){} |
| 107812 | 108680 | zName = sqlite3MPrintf(db, "sqlite_autoindex_%s_%d", pTab->zName, n); |
| | @@ -107817,17 +108685,17 @@ |
| 107817 | 108685 | /* Automatic index names generated from within sqlite3_declare_vtab() |
| 107818 | 108686 | ** must have names that are distinct from normal automatic index names. |
| 107819 | 108687 | ** The following statement converts "sqlite3_autoindex..." into |
| 107820 | 108688 | ** "sqlite3_butoindex..." in order to make the names distinct. |
| 107821 | 108689 | ** The "vtab_err.test" test demonstrates the need of this statement. */ |
| 107822 | | - if( IN_DECLARE_VTAB ) zName[7]++; |
| 108690 | + if( IN_SPECIAL_PARSE ) zName[7]++; |
| 107823 | 108691 | } |
| 107824 | 108692 | |
| 107825 | 108693 | /* Check for authorization to create an index. |
| 107826 | 108694 | */ |
| 107827 | 108695 | #ifndef SQLITE_OMIT_AUTHORIZATION |
| 107828 | | - { |
| 108696 | + if( !IN_RENAME_OBJECT ){ |
| 107829 | 108697 | const char *zDb = pDb->zDbSName; |
| 107830 | 108698 | if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iDb), 0, zDb) ){ |
| 107831 | 108699 | goto exit_create_index; |
| 107832 | 108700 | } |
| 107833 | 108701 | i = SQLITE_CREATE_INDEX; |
| | @@ -107910,11 +108778,16 @@ |
| 107910 | 108778 | ** |
| 107911 | 108779 | ** TODO: Issue a warning if two or more columns of the index are identical. |
| 107912 | 108780 | ** TODO: Issue a warning if the table primary key is used as part of the |
| 107913 | 108781 | ** index key. |
| 107914 | 108782 | */ |
| 107915 | | - for(i=0, pListItem=pList->a; i<pList->nExpr; i++, pListItem++){ |
| 108783 | + pListItem = pList->a; |
| 108784 | + if( IN_RENAME_OBJECT ){ |
| 108785 | + pIndex->aColExpr = pList; |
| 108786 | + pList = 0; |
| 108787 | + } |
| 108788 | + for(i=0; i<pIndex->nKeyCol; i++, pListItem++){ |
| 107916 | 108789 | Expr *pCExpr; /* The i-th index expression */ |
| 107917 | 108790 | int requestedSortOrder; /* ASC or DESC on the i-th expression */ |
| 107918 | 108791 | const char *zColl; /* Collation sequence name */ |
| 107919 | 108792 | |
| 107920 | 108793 | sqlite3StringToId(pListItem->pExpr); |
| | @@ -107926,16 +108799,12 @@ |
| 107926 | 108799 | sqlite3ErrorMsg(pParse, "expressions prohibited in PRIMARY KEY and " |
| 107927 | 108800 | "UNIQUE constraints"); |
| 107928 | 108801 | goto exit_create_index; |
| 107929 | 108802 | } |
| 107930 | 108803 | if( pIndex->aColExpr==0 ){ |
| 107931 | | - ExprList *pCopy = sqlite3ExprListDup(db, pList, 0); |
| 107932 | | - pIndex->aColExpr = pCopy; |
| 107933 | | - if( !db->mallocFailed ){ |
| 107934 | | - assert( pCopy!=0 ); |
| 107935 | | - pListItem = &pCopy->a[i]; |
| 107936 | | - } |
| 108804 | + pIndex->aColExpr = pList; |
| 108805 | + pList = 0; |
| 107937 | 108806 | } |
| 107938 | 108807 | j = XN_EXPR; |
| 107939 | 108808 | pIndex->aiColumn[i] = XN_EXPR; |
| 107940 | 108809 | pIndex->uniqNotNull = 0; |
| 107941 | 108810 | }else{ |
| | @@ -108070,102 +108939,105 @@ |
| 108070 | 108939 | goto exit_create_index; |
| 108071 | 108940 | } |
| 108072 | 108941 | } |
| 108073 | 108942 | } |
| 108074 | 108943 | |
| 108075 | | - /* Link the new Index structure to its table and to the other |
| 108076 | | - ** in-memory database structures. |
| 108077 | | - */ |
| 108078 | | - assert( pParse->nErr==0 ); |
| 108079 | | - if( db->init.busy ){ |
| 108080 | | - Index *p; |
| 108081 | | - assert( !IN_DECLARE_VTAB ); |
| 108082 | | - assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); |
| 108083 | | - p = sqlite3HashInsert(&pIndex->pSchema->idxHash, |
| 108084 | | - pIndex->zName, pIndex); |
| 108085 | | - if( p ){ |
| 108086 | | - assert( p==pIndex ); /* Malloc must have failed */ |
| 108087 | | - sqlite3OomFault(db); |
| 108088 | | - goto exit_create_index; |
| 108089 | | - } |
| 108090 | | - db->mDbFlags |= DBFLAG_SchemaChange; |
| 108091 | | - if( pTblName!=0 ){ |
| 108092 | | - pIndex->tnum = db->init.newTnum; |
| 108093 | | - } |
| 108094 | | - } |
| 108095 | | - |
| 108096 | | - /* If this is the initial CREATE INDEX statement (or CREATE TABLE if the |
| 108097 | | - ** index is an implied index for a UNIQUE or PRIMARY KEY constraint) then |
| 108098 | | - ** emit code to allocate the index rootpage on disk and make an entry for |
| 108099 | | - ** the index in the sqlite_master table and populate the index with |
| 108100 | | - ** content. But, do not do this if we are simply reading the sqlite_master |
| 108101 | | - ** table to parse the schema, or if this index is the PRIMARY KEY index |
| 108102 | | - ** of a WITHOUT ROWID table. |
| 108103 | | - ** |
| 108104 | | - ** If pTblName==0 it means this index is generated as an implied PRIMARY KEY |
| 108105 | | - ** or UNIQUE index in a CREATE TABLE statement. Since the table |
| 108106 | | - ** has just been created, it contains no data and the index initialization |
| 108107 | | - ** step can be skipped. |
| 108108 | | - */ |
| 108109 | | - else if( HasRowid(pTab) || pTblName!=0 ){ |
| 108110 | | - Vdbe *v; |
| 108111 | | - char *zStmt; |
| 108112 | | - int iMem = ++pParse->nMem; |
| 108113 | | - |
| 108114 | | - v = sqlite3GetVdbe(pParse); |
| 108115 | | - if( v==0 ) goto exit_create_index; |
| 108116 | | - |
| 108117 | | - sqlite3BeginWriteOperation(pParse, 1, iDb); |
| 108118 | | - |
| 108119 | | - /* Create the rootpage for the index using CreateIndex. But before |
| 108120 | | - ** doing so, code a Noop instruction and store its address in |
| 108121 | | - ** Index.tnum. This is required in case this index is actually a |
| 108122 | | - ** PRIMARY KEY and the table is actually a WITHOUT ROWID table. In |
| 108123 | | - ** that case the convertToWithoutRowidTable() routine will replace |
| 108124 | | - ** the Noop with a Goto to jump over the VDBE code generated below. */ |
| 108125 | | - pIndex->tnum = sqlite3VdbeAddOp0(v, OP_Noop); |
| 108126 | | - sqlite3VdbeAddOp3(v, OP_CreateBtree, iDb, iMem, BTREE_BLOBKEY); |
| 108127 | | - |
| 108128 | | - /* Gather the complete text of the CREATE INDEX statement into |
| 108129 | | - ** the zStmt variable |
| 108130 | | - */ |
| 108131 | | - if( pStart ){ |
| 108132 | | - int n = (int)(pParse->sLastToken.z - pName->z) + pParse->sLastToken.n; |
| 108133 | | - if( pName->z[n-1]==';' ) n--; |
| 108134 | | - /* A named index with an explicit CREATE INDEX statement */ |
| 108135 | | - zStmt = sqlite3MPrintf(db, "CREATE%s INDEX %.*s", |
| 108136 | | - onError==OE_None ? "" : " UNIQUE", n, pName->z); |
| 108137 | | - }else{ |
| 108138 | | - /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */ |
| 108139 | | - /* zStmt = sqlite3MPrintf(""); */ |
| 108140 | | - zStmt = 0; |
| 108141 | | - } |
| 108142 | | - |
| 108143 | | - /* Add an entry in sqlite_master for this index |
| 108144 | | - */ |
| 108145 | | - sqlite3NestedParse(pParse, |
| 108146 | | - "INSERT INTO %Q.%s VALUES('index',%Q,%Q,#%d,%Q);", |
| 108147 | | - db->aDb[iDb].zDbSName, MASTER_NAME, |
| 108148 | | - pIndex->zName, |
| 108149 | | - pTab->zName, |
| 108150 | | - iMem, |
| 108151 | | - zStmt |
| 108152 | | - ); |
| 108153 | | - sqlite3DbFree(db, zStmt); |
| 108154 | | - |
| 108155 | | - /* Fill the index with data and reparse the schema. Code an OP_Expire |
| 108156 | | - ** to invalidate all pre-compiled statements. |
| 108157 | | - */ |
| 108158 | | - if( pTblName ){ |
| 108159 | | - sqlite3RefillIndex(pParse, pIndex, iMem); |
| 108160 | | - sqlite3ChangeCookie(pParse, iDb); |
| 108161 | | - sqlite3VdbeAddParseSchemaOp(v, iDb, |
| 108162 | | - sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName)); |
| 108163 | | - sqlite3VdbeAddOp2(v, OP_Expire, 0, 1); |
| 108164 | | - } |
| 108165 | | - |
| 108166 | | - sqlite3VdbeJumpHere(v, pIndex->tnum); |
| 108944 | + if( !IN_RENAME_OBJECT ){ |
| 108945 | + |
| 108946 | + /* Link the new Index structure to its table and to the other |
| 108947 | + ** in-memory database structures. |
| 108948 | + */ |
| 108949 | + assert( pParse->nErr==0 ); |
| 108950 | + if( db->init.busy ){ |
| 108951 | + Index *p; |
| 108952 | + assert( !IN_SPECIAL_PARSE ); |
| 108953 | + assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); |
| 108954 | + p = sqlite3HashInsert(&pIndex->pSchema->idxHash, |
| 108955 | + pIndex->zName, pIndex); |
| 108956 | + if( p ){ |
| 108957 | + assert( p==pIndex ); /* Malloc must have failed */ |
| 108958 | + sqlite3OomFault(db); |
| 108959 | + goto exit_create_index; |
| 108960 | + } |
| 108961 | + db->mDbFlags |= DBFLAG_SchemaChange; |
| 108962 | + if( pTblName!=0 ){ |
| 108963 | + pIndex->tnum = db->init.newTnum; |
| 108964 | + } |
| 108965 | + } |
| 108966 | + |
| 108967 | + /* If this is the initial CREATE INDEX statement (or CREATE TABLE if the |
| 108968 | + ** index is an implied index for a UNIQUE or PRIMARY KEY constraint) then |
| 108969 | + ** emit code to allocate the index rootpage on disk and make an entry for |
| 108970 | + ** the index in the sqlite_master table and populate the index with |
| 108971 | + ** content. But, do not do this if we are simply reading the sqlite_master |
| 108972 | + ** table to parse the schema, or if this index is the PRIMARY KEY index |
| 108973 | + ** of a WITHOUT ROWID table. |
| 108974 | + ** |
| 108975 | + ** If pTblName==0 it means this index is generated as an implied PRIMARY KEY |
| 108976 | + ** or UNIQUE index in a CREATE TABLE statement. Since the table |
| 108977 | + ** has just been created, it contains no data and the index initialization |
| 108978 | + ** step can be skipped. |
| 108979 | + */ |
| 108980 | + else if( HasRowid(pTab) || pTblName!=0 ){ |
| 108981 | + Vdbe *v; |
| 108982 | + char *zStmt; |
| 108983 | + int iMem = ++pParse->nMem; |
| 108984 | + |
| 108985 | + v = sqlite3GetVdbe(pParse); |
| 108986 | + if( v==0 ) goto exit_create_index; |
| 108987 | + |
| 108988 | + sqlite3BeginWriteOperation(pParse, 1, iDb); |
| 108989 | + |
| 108990 | + /* Create the rootpage for the index using CreateIndex. But before |
| 108991 | + ** doing so, code a Noop instruction and store its address in |
| 108992 | + ** Index.tnum. This is required in case this index is actually a |
| 108993 | + ** PRIMARY KEY and the table is actually a WITHOUT ROWID table. In |
| 108994 | + ** that case the convertToWithoutRowidTable() routine will replace |
| 108995 | + ** the Noop with a Goto to jump over the VDBE code generated below. */ |
| 108996 | + pIndex->tnum = sqlite3VdbeAddOp0(v, OP_Noop); |
| 108997 | + sqlite3VdbeAddOp3(v, OP_CreateBtree, iDb, iMem, BTREE_BLOBKEY); |
| 108998 | + |
| 108999 | + /* Gather the complete text of the CREATE INDEX statement into |
| 109000 | + ** the zStmt variable |
| 109001 | + */ |
| 109002 | + if( pStart ){ |
| 109003 | + int n = (int)(pParse->sLastToken.z - pName->z) + pParse->sLastToken.n; |
| 109004 | + if( pName->z[n-1]==';' ) n--; |
| 109005 | + /* A named index with an explicit CREATE INDEX statement */ |
| 109006 | + zStmt = sqlite3MPrintf(db, "CREATE%s INDEX %.*s", |
| 109007 | + onError==OE_None ? "" : " UNIQUE", n, pName->z); |
| 109008 | + }else{ |
| 109009 | + /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */ |
| 109010 | + /* zStmt = sqlite3MPrintf(""); */ |
| 109011 | + zStmt = 0; |
| 109012 | + } |
| 109013 | + |
| 109014 | + /* Add an entry in sqlite_master for this index |
| 109015 | + */ |
| 109016 | + sqlite3NestedParse(pParse, |
| 109017 | + "INSERT INTO %Q.%s VALUES('index',%Q,%Q,#%d,%Q);", |
| 109018 | + db->aDb[iDb].zDbSName, MASTER_NAME, |
| 109019 | + pIndex->zName, |
| 109020 | + pTab->zName, |
| 109021 | + iMem, |
| 109022 | + zStmt |
| 109023 | + ); |
| 109024 | + sqlite3DbFree(db, zStmt); |
| 109025 | + |
| 109026 | + /* Fill the index with data and reparse the schema. Code an OP_Expire |
| 109027 | + ** to invalidate all pre-compiled statements. |
| 109028 | + */ |
| 109029 | + if( pTblName ){ |
| 109030 | + sqlite3RefillIndex(pParse, pIndex, iMem); |
| 109031 | + sqlite3ChangeCookie(pParse, iDb); |
| 109032 | + sqlite3VdbeAddParseSchemaOp(v, iDb, |
| 109033 | + sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName)); |
| 109034 | + sqlite3VdbeAddOp2(v, OP_Expire, 0, 1); |
| 109035 | + } |
| 109036 | + |
| 109037 | + sqlite3VdbeJumpHere(v, pIndex->tnum); |
| 109038 | + } |
| 108167 | 109039 | } |
| 108168 | 109040 | |
| 108169 | 109041 | /* When adding an index to the list of indices for a table, make |
| 108170 | 109042 | ** sure all indices labeled OE_Replace come after all those labeled |
| 108171 | 109043 | ** OE_Ignore. This is necessary for the correct constraint check |
| | @@ -108185,14 +109057,19 @@ |
| 108185 | 109057 | pIndex->pNext = pOther->pNext; |
| 108186 | 109058 | pOther->pNext = pIndex; |
| 108187 | 109059 | } |
| 108188 | 109060 | pIndex = 0; |
| 108189 | 109061 | } |
| 109062 | + else if( IN_RENAME_OBJECT ){ |
| 109063 | + assert( pParse->pNewIndex==0 ); |
| 109064 | + pParse->pNewIndex = pIndex; |
| 109065 | + pIndex = 0; |
| 109066 | + } |
| 108190 | 109067 | |
| 108191 | 109068 | /* Clean up before exiting */ |
| 108192 | 109069 | exit_create_index: |
| 108193 | | - if( pIndex ) freeIndex(db, pIndex); |
| 109070 | + if( pIndex ) sqlite3FreeIndex(db, pIndex); |
| 108194 | 109071 | sqlite3ExprDelete(db, pPIWhere); |
| 108195 | 109072 | sqlite3ExprListDelete(db, pList); |
| 108196 | 109073 | sqlite3SrcListDelete(db, pTblName); |
| 108197 | 109074 | sqlite3DbFree(db, zName); |
| 108198 | 109075 | } |
| | @@ -108357,11 +109234,12 @@ |
| 108357 | 109234 | ** Append a new element to the given IdList. Create a new IdList if |
| 108358 | 109235 | ** need be. |
| 108359 | 109236 | ** |
| 108360 | 109237 | ** A new IdList is returned, or NULL if malloc() fails. |
| 108361 | 109238 | */ |
| 108362 | | -SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3 *db, IdList *pList, Token *pToken){ |
| 109239 | +SQLITE_PRIVATE IdList *sqlite3IdListAppend(Parse *pParse, IdList *pList, Token *pToken){ |
| 109240 | + sqlite3 *db = pParse->db; |
| 108363 | 109241 | int i; |
| 108364 | 109242 | if( pList==0 ){ |
| 108365 | 109243 | pList = sqlite3DbMallocZero(db, sizeof(IdList) ); |
| 108366 | 109244 | if( pList==0 ) return 0; |
| 108367 | 109245 | } |
| | @@ -108375,10 +109253,13 @@ |
| 108375 | 109253 | if( i<0 ){ |
| 108376 | 109254 | sqlite3IdListDelete(db, pList); |
| 108377 | 109255 | return 0; |
| 108378 | 109256 | } |
| 108379 | 109257 | pList->a[i].zName = sqlite3NameFromToken(db, pToken); |
| 109258 | + if( IN_RENAME_OBJECT && pList->a[i].zName ){ |
| 109259 | + sqlite3RenameTokenMap(pParse, (void*)pList->a[i].zName, pToken); |
| 109260 | + } |
| 108380 | 109261 | return pList; |
| 108381 | 109262 | } |
| 108382 | 109263 | |
| 108383 | 109264 | /* |
| 108384 | 109265 | ** Delete an IdList. |
| | @@ -108621,10 +109502,14 @@ |
| 108621 | 109502 | if( p==0 ){ |
| 108622 | 109503 | goto append_from_error; |
| 108623 | 109504 | } |
| 108624 | 109505 | assert( p->nSrc>0 ); |
| 108625 | 109506 | pItem = &p->a[p->nSrc-1]; |
| 109507 | + if( IN_RENAME_OBJECT && pItem->zName ){ |
| 109508 | + Token *pToken = (pDatabase && pDatabase->z) ? pDatabase : pTable; |
| 109509 | + sqlite3RenameTokenMap(pParse, pItem->zName, pToken); |
| 109510 | + } |
| 108626 | 109511 | assert( pAlias!=0 ); |
| 108627 | 109512 | if( pAlias->n ){ |
| 108628 | 109513 | pItem->zAlias = sqlite3NameFromToken(db, pAlias); |
| 108629 | 109514 | } |
| 108630 | 109515 | pItem->pSelect = pSubquery; |
| | @@ -121271,19 +122156,27 @@ |
| 121271 | 122156 | InitData *pData, /* Initialization context */ |
| 121272 | 122157 | const char *zObj, /* Object being parsed at the point of error */ |
| 121273 | 122158 | const char *zExtra /* Error information */ |
| 121274 | 122159 | ){ |
| 121275 | 122160 | sqlite3 *db = pData->db; |
| 121276 | | - if( !db->mallocFailed && (db->flags & SQLITE_WriteSchema)==0 ){ |
| 122161 | + if( db->mallocFailed ){ |
| 122162 | + pData->rc = SQLITE_NOMEM_BKPT; |
| 122163 | + }else if( pData->pzErrMsg[0]!=0 ){ |
| 122164 | + /* A error message has already been generated. Do not overwrite it */ |
| 122165 | + }else if( pData->mInitFlags & INITFLAG_AlterTable ){ |
| 122166 | + *pData->pzErrMsg = sqlite3DbStrDup(db, zExtra); |
| 122167 | + pData->rc = SQLITE_ERROR; |
| 122168 | + }else if( db->flags & SQLITE_WriteSchema ){ |
| 122169 | + pData->rc = SQLITE_CORRUPT_BKPT; |
| 122170 | + }else{ |
| 121277 | 122171 | char *z; |
| 121278 | 122172 | if( zObj==0 ) zObj = "?"; |
| 121279 | 122173 | z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj); |
| 121280 | 122174 | if( zExtra && zExtra[0] ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra); |
| 121281 | | - sqlite3DbFree(db, *pData->pzErrMsg); |
| 121282 | 122175 | *pData->pzErrMsg = z; |
| 122176 | + pData->rc = SQLITE_CORRUPT_BKPT; |
| 121283 | 122177 | } |
| 121284 | | - pData->rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_CORRUPT_BKPT; |
| 121285 | 122178 | } |
| 121286 | 122179 | |
| 121287 | 122180 | /* |
| 121288 | 122181 | ** This is the callback routine for the code that initializes the |
| 121289 | 122182 | ** database. See sqlite3Init() below for additional information. |
| | @@ -121331,11 +122224,11 @@ |
| 121331 | 122224 | db->init.orphanTrigger = 0; |
| 121332 | 122225 | TESTONLY(rcp = ) sqlite3_prepare(db, argv[2], -1, &pStmt, 0); |
| 121333 | 122226 | rc = db->errCode; |
| 121334 | 122227 | assert( (rc&0xFF)==(rcp&0xFF) ); |
| 121335 | 122228 | db->init.iDb = saved_iDb; |
| 121336 | | - assert( saved_iDb==0 || (db->mDbFlags & DBFLAG_Vacuum)!=0 ); |
| 122229 | + /* assert( saved_iDb==0 || (db->mDbFlags & DBFLAG_Vacuum)!=0 ); */ |
| 121337 | 122230 | if( SQLITE_OK!=rc ){ |
| 121338 | 122231 | if( db->init.orphanTrigger ){ |
| 121339 | 122232 | assert( iDb==1 ); |
| 121340 | 122233 | }else{ |
| 121341 | 122234 | pData->rc = rc; |
| | @@ -121378,11 +122271,11 @@ |
| 121378 | 122271 | ** database file is given by iDb. iDb==0 is used for the main |
| 121379 | 122272 | ** database. iDb==1 should never be used. iDb>=2 is used for |
| 121380 | 122273 | ** auxiliary databases. Return one of the SQLITE_ error codes to |
| 121381 | 122274 | ** indicate success or failure. |
| 121382 | 122275 | */ |
| 121383 | | -static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){ |
| 122276 | +SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFlags){ |
| 121384 | 122277 | int rc; |
| 121385 | 122278 | int i; |
| 121386 | 122279 | #ifndef SQLITE_OMIT_DEPRECATED |
| 121387 | 122280 | int size; |
| 121388 | 122281 | #endif |
| | @@ -121413,10 +122306,11 @@ |
| 121413 | 122306 | azArg[3] = 0; |
| 121414 | 122307 | initData.db = db; |
| 121415 | 122308 | initData.iDb = iDb; |
| 121416 | 122309 | initData.rc = SQLITE_OK; |
| 121417 | 122310 | initData.pzErrMsg = pzErrMsg; |
| 122311 | + initData.mInitFlags = mFlags; |
| 121418 | 122312 | sqlite3InitCallback(&initData, 3, (char **)azArg, 0); |
| 121419 | 122313 | if( initData.rc ){ |
| 121420 | 122314 | rc = initData.rc; |
| 121421 | 122315 | goto error_out; |
| 121422 | 122316 | } |
| | @@ -121619,18 +122513,18 @@ |
| 121619 | 122513 | assert( db->init.busy==0 ); |
| 121620 | 122514 | ENC(db) = SCHEMA_ENC(db); |
| 121621 | 122515 | assert( db->nDb>0 ); |
| 121622 | 122516 | /* Do the main schema first */ |
| 121623 | 122517 | if( !DbHasProperty(db, 0, DB_SchemaLoaded) ){ |
| 121624 | | - rc = sqlite3InitOne(db, 0, pzErrMsg); |
| 122518 | + rc = sqlite3InitOne(db, 0, pzErrMsg, 0); |
| 121625 | 122519 | if( rc ) return rc; |
| 121626 | 122520 | } |
| 121627 | 122521 | /* All other schemas after the main schema. The "temp" schema must be last */ |
| 121628 | 122522 | for(i=db->nDb-1; i>0; i--){ |
| 121629 | 122523 | assert( i==1 || sqlite3BtreeHoldsMutex(db->aDb[i].pBt) ); |
| 121630 | 122524 | if( !DbHasProperty(db, i, DB_SchemaLoaded) ){ |
| 121631 | | - rc = sqlite3InitOne(db, i, pzErrMsg); |
| 122525 | + rc = sqlite3InitOne(db, i, pzErrMsg, 0); |
| 121632 | 122526 | if( rc ) return rc; |
| 121633 | 122527 | } |
| 121634 | 122528 | } |
| 121635 | 122529 | if( commit_internal ){ |
| 121636 | 122530 | sqlite3CommitInternalChanges(db); |
| | @@ -129136,18 +130030,20 @@ |
| 129136 | 130030 | zName = sqlite3NameFromToken(db, pName); |
| 129137 | 130031 | if( !zName || SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ |
| 129138 | 130032 | goto trigger_cleanup; |
| 129139 | 130033 | } |
| 129140 | 130034 | assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); |
| 129141 | | - if( sqlite3HashFind(&(db->aDb[iDb].pSchema->trigHash),zName) ){ |
| 129142 | | - if( !noErr ){ |
| 129143 | | - sqlite3ErrorMsg(pParse, "trigger %T already exists", pName); |
| 129144 | | - }else{ |
| 129145 | | - assert( !db->init.busy ); |
| 129146 | | - sqlite3CodeVerifySchema(pParse, iDb); |
| 129147 | | - } |
| 129148 | | - goto trigger_cleanup; |
| 130035 | + if( !IN_RENAME_OBJECT ){ |
| 130036 | + if( sqlite3HashFind(&(db->aDb[iDb].pSchema->trigHash),zName) ){ |
| 130037 | + if( !noErr ){ |
| 130038 | + sqlite3ErrorMsg(pParse, "trigger %T already exists", pName); |
| 130039 | + }else{ |
| 130040 | + assert( !db->init.busy ); |
| 130041 | + sqlite3CodeVerifySchema(pParse, iDb); |
| 130042 | + } |
| 130043 | + goto trigger_cleanup; |
| 130044 | + } |
| 129149 | 130045 | } |
| 129150 | 130046 | |
| 129151 | 130047 | /* Do not create a trigger on a system table */ |
| 129152 | 130048 | if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){ |
| 129153 | 130049 | sqlite3ErrorMsg(pParse, "cannot create trigger on system table"); |
| | @@ -129167,11 +130063,11 @@ |
| 129167 | 130063 | " trigger on table: %S", pTableName, 0); |
| 129168 | 130064 | goto trigger_cleanup; |
| 129169 | 130065 | } |
| 129170 | 130066 | |
| 129171 | 130067 | #ifndef SQLITE_OMIT_AUTHORIZATION |
| 129172 | | - { |
| 130068 | + if( !IN_RENAME_OBJECT ){ |
| 129173 | 130069 | int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema); |
| 129174 | 130070 | int code = SQLITE_CREATE_TRIGGER; |
| 129175 | 130071 | const char *zDb = db->aDb[iTabDb].zDbSName; |
| 129176 | 130072 | const char *zDbTrig = isTemp ? db->aDb[1].zDbSName : zDb; |
| 129177 | 130073 | if( iTabDb==1 || isTemp ) code = SQLITE_CREATE_TEMP_TRIGGER; |
| | @@ -129201,12 +130097,19 @@ |
| 129201 | 130097 | pTrigger->table = sqlite3DbStrDup(db, pTableName->a[0].zName); |
| 129202 | 130098 | pTrigger->pSchema = db->aDb[iDb].pSchema; |
| 129203 | 130099 | pTrigger->pTabSchema = pTab->pSchema; |
| 129204 | 130100 | pTrigger->op = (u8)op; |
| 129205 | 130101 | pTrigger->tr_tm = tr_tm==TK_BEFORE ? TRIGGER_BEFORE : TRIGGER_AFTER; |
| 129206 | | - pTrigger->pWhen = sqlite3ExprDup(db, pWhen, EXPRDUP_REDUCE); |
| 129207 | | - pTrigger->pColumns = sqlite3IdListDup(db, pColumns); |
| 130102 | + if( IN_RENAME_OBJECT ){ |
| 130103 | + sqlite3RenameTokenRemap(pParse, pTrigger->table, pTableName->a[0].zName); |
| 130104 | + pTrigger->pWhen = pWhen; |
| 130105 | + pWhen = 0; |
| 130106 | + }else{ |
| 130107 | + pTrigger->pWhen = sqlite3ExprDup(db, pWhen, EXPRDUP_REDUCE); |
| 130108 | + } |
| 130109 | + pTrigger->pColumns = pColumns; |
| 130110 | + pColumns = 0; |
| 129208 | 130111 | assert( pParse->pNewTrigger==0 ); |
| 129209 | 130112 | pParse->pNewTrigger = pTrigger; |
| 129210 | 130113 | |
| 129211 | 130114 | trigger_cleanup: |
| 129212 | 130115 | sqlite3DbFree(db, zName); |
| | @@ -129250,10 +130153,18 @@ |
| 129250 | 130153 | if( sqlite3FixTriggerStep(&sFix, pTrig->step_list) |
| 129251 | 130154 | || sqlite3FixExpr(&sFix, pTrig->pWhen) |
| 129252 | 130155 | ){ |
| 129253 | 130156 | goto triggerfinish_cleanup; |
| 129254 | 130157 | } |
| 130158 | + |
| 130159 | +#ifndef SQLITE_OMIT_ALTERTABLE |
| 130160 | + if( IN_RENAME_OBJECT ){ |
| 130161 | + assert( !db->init.busy ); |
| 130162 | + pParse->pNewTrigger = pTrig; |
| 130163 | + pTrig = 0; |
| 130164 | + }else |
| 130165 | +#endif |
| 129255 | 130166 | |
| 129256 | 130167 | /* if we are not initializing, |
| 129257 | 130168 | ** build the sqlite_master entry |
| 129258 | 130169 | */ |
| 129259 | 130170 | if( !db->init.busy ){ |
| | @@ -129292,11 +130203,11 @@ |
| 129292 | 130203 | } |
| 129293 | 130204 | } |
| 129294 | 130205 | |
| 129295 | 130206 | triggerfinish_cleanup: |
| 129296 | 130207 | sqlite3DeleteTrigger(db, pTrig); |
| 129297 | | - assert( !pParse->pNewTrigger ); |
| 130208 | + assert( IN_RENAME_OBJECT || !pParse->pNewTrigger ); |
| 129298 | 130209 | sqlite3DeleteTriggerStep(db, pStepList); |
| 129299 | 130210 | } |
| 129300 | 130211 | |
| 129301 | 130212 | /* |
| 129302 | 130213 | ** Duplicate a range of text from an SQL statement, then convert all |
| | @@ -129339,16 +130250,17 @@ |
| 129339 | 130250 | ** holds both the TriggerStep object and the TriggerStep.target.z string. |
| 129340 | 130251 | ** |
| 129341 | 130252 | ** If an OOM error occurs, NULL is returned and db->mallocFailed is set. |
| 129342 | 130253 | */ |
| 129343 | 130254 | static TriggerStep *triggerStepAllocate( |
| 129344 | | - sqlite3 *db, /* Database connection */ |
| 130255 | + Parse *pParse, /* Parser context */ |
| 129345 | 130256 | u8 op, /* Trigger opcode */ |
| 129346 | 130257 | Token *pName, /* The target name */ |
| 129347 | 130258 | const char *zStart, /* Start of SQL text */ |
| 129348 | 130259 | const char *zEnd /* End of SQL text */ |
| 129349 | 130260 | ){ |
| 130261 | + sqlite3 *db = pParse->db; |
| 129350 | 130262 | TriggerStep *pTriggerStep; |
| 129351 | 130263 | |
| 129352 | 130264 | pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep) + pName->n + 1); |
| 129353 | 130265 | if( pTriggerStep ){ |
| 129354 | 130266 | char *z = (char*)&pTriggerStep[1]; |
| | @@ -129355,10 +130267,13 @@ |
| 129355 | 130267 | memcpy(z, pName->z, pName->n); |
| 129356 | 130268 | sqlite3Dequote(z); |
| 129357 | 130269 | pTriggerStep->zTarget = z; |
| 129358 | 130270 | pTriggerStep->op = op; |
| 129359 | 130271 | pTriggerStep->zSpan = triggerSpanDup(db, zStart, zEnd); |
| 130272 | + if( IN_RENAME_OBJECT ){ |
| 130273 | + sqlite3RenameTokenMap(pParse, pTriggerStep->zTarget, pName); |
| 130274 | + } |
| 129360 | 130275 | } |
| 129361 | 130276 | return pTriggerStep; |
| 129362 | 130277 | } |
| 129363 | 130278 | |
| 129364 | 130279 | /* |
| | @@ -129367,26 +130282,32 @@ |
| 129367 | 130282 | ** |
| 129368 | 130283 | ** The parser calls this routine when it sees an INSERT inside the |
| 129369 | 130284 | ** body of a trigger. |
| 129370 | 130285 | */ |
| 129371 | 130286 | SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep( |
| 129372 | | - sqlite3 *db, /* The database connection */ |
| 130287 | + Parse *pParse, /* Parser */ |
| 129373 | 130288 | Token *pTableName, /* Name of the table into which we insert */ |
| 129374 | 130289 | IdList *pColumn, /* List of columns in pTableName to insert into */ |
| 129375 | 130290 | Select *pSelect, /* A SELECT statement that supplies values */ |
| 129376 | 130291 | u8 orconf, /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */ |
| 129377 | 130292 | Upsert *pUpsert, /* ON CONFLICT clauses for upsert */ |
| 129378 | 130293 | const char *zStart, /* Start of SQL text */ |
| 129379 | 130294 | const char *zEnd /* End of SQL text */ |
| 129380 | 130295 | ){ |
| 130296 | + sqlite3 *db = pParse->db; |
| 129381 | 130297 | TriggerStep *pTriggerStep; |
| 129382 | 130298 | |
| 129383 | 130299 | assert(pSelect != 0 || db->mallocFailed); |
| 129384 | 130300 | |
| 129385 | | - pTriggerStep = triggerStepAllocate(db, TK_INSERT, pTableName, zStart, zEnd); |
| 130301 | + pTriggerStep = triggerStepAllocate(pParse, TK_INSERT, pTableName,zStart,zEnd); |
| 129386 | 130302 | if( pTriggerStep ){ |
| 129387 | | - pTriggerStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); |
| 130303 | + if( IN_RENAME_OBJECT ){ |
| 130304 | + pTriggerStep->pSelect = pSelect; |
| 130305 | + pSelect = 0; |
| 130306 | + }else{ |
| 130307 | + pTriggerStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); |
| 130308 | + } |
| 129388 | 130309 | pTriggerStep->pIdList = pColumn; |
| 129389 | 130310 | pTriggerStep->pUpsert = pUpsert; |
| 129390 | 130311 | pTriggerStep->orconf = orconf; |
| 129391 | 130312 | }else{ |
| 129392 | 130313 | testcase( pColumn ); |
| | @@ -129403,24 +130324,32 @@ |
| 129403 | 130324 | ** Construct a trigger step that implements an UPDATE statement and return |
| 129404 | 130325 | ** a pointer to that trigger step. The parser calls this routine when it |
| 129405 | 130326 | ** sees an UPDATE statement inside the body of a CREATE TRIGGER. |
| 129406 | 130327 | */ |
| 129407 | 130328 | SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep( |
| 129408 | | - sqlite3 *db, /* The database connection */ |
| 130329 | + Parse *pParse, /* Parser */ |
| 129409 | 130330 | Token *pTableName, /* Name of the table to be updated */ |
| 129410 | 130331 | ExprList *pEList, /* The SET clause: list of column and new values */ |
| 129411 | 130332 | Expr *pWhere, /* The WHERE clause */ |
| 129412 | 130333 | u8 orconf, /* The conflict algorithm. (OE_Abort, OE_Ignore, etc) */ |
| 129413 | 130334 | const char *zStart, /* Start of SQL text */ |
| 129414 | 130335 | const char *zEnd /* End of SQL text */ |
| 129415 | 130336 | ){ |
| 130337 | + sqlite3 *db = pParse->db; |
| 129416 | 130338 | TriggerStep *pTriggerStep; |
| 129417 | 130339 | |
| 129418 | | - pTriggerStep = triggerStepAllocate(db, TK_UPDATE, pTableName, zStart, zEnd); |
| 130340 | + pTriggerStep = triggerStepAllocate(pParse, TK_UPDATE, pTableName,zStart,zEnd); |
| 129419 | 130341 | if( pTriggerStep ){ |
| 129420 | | - pTriggerStep->pExprList = sqlite3ExprListDup(db, pEList, EXPRDUP_REDUCE); |
| 129421 | | - pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE); |
| 130342 | + if( IN_RENAME_OBJECT ){ |
| 130343 | + pTriggerStep->pExprList = pEList; |
| 130344 | + pTriggerStep->pWhere = pWhere; |
| 130345 | + pEList = 0; |
| 130346 | + pWhere = 0; |
| 130347 | + }else{ |
| 130348 | + pTriggerStep->pExprList = sqlite3ExprListDup(db, pEList, EXPRDUP_REDUCE); |
| 130349 | + pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE); |
| 130350 | + } |
| 129422 | 130351 | pTriggerStep->orconf = orconf; |
| 129423 | 130352 | } |
| 129424 | 130353 | sqlite3ExprListDelete(db, pEList); |
| 129425 | 130354 | sqlite3ExprDelete(db, pWhere); |
| 129426 | 130355 | return pTriggerStep; |
| | @@ -129430,21 +130359,27 @@ |
| 129430 | 130359 | ** Construct a trigger step that implements a DELETE statement and return |
| 129431 | 130360 | ** a pointer to that trigger step. The parser calls this routine when it |
| 129432 | 130361 | ** sees a DELETE statement inside the body of a CREATE TRIGGER. |
| 129433 | 130362 | */ |
| 129434 | 130363 | SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep( |
| 129435 | | - sqlite3 *db, /* Database connection */ |
| 130364 | + Parse *pParse, /* Parser */ |
| 129436 | 130365 | Token *pTableName, /* The table from which rows are deleted */ |
| 129437 | 130366 | Expr *pWhere, /* The WHERE clause */ |
| 129438 | 130367 | const char *zStart, /* Start of SQL text */ |
| 129439 | 130368 | const char *zEnd /* End of SQL text */ |
| 129440 | 130369 | ){ |
| 130370 | + sqlite3 *db = pParse->db; |
| 129441 | 130371 | TriggerStep *pTriggerStep; |
| 129442 | 130372 | |
| 129443 | | - pTriggerStep = triggerStepAllocate(db, TK_DELETE, pTableName, zStart, zEnd); |
| 130373 | + pTriggerStep = triggerStepAllocate(pParse, TK_DELETE, pTableName,zStart,zEnd); |
| 129444 | 130374 | if( pTriggerStep ){ |
| 129445 | | - pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE); |
| 130375 | + if( IN_RENAME_OBJECT ){ |
| 130376 | + pTriggerStep->pWhere = pWhere; |
| 130377 | + pWhere = 0; |
| 130378 | + }else{ |
| 130379 | + pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE); |
| 130380 | + } |
| 129446 | 130381 | pTriggerStep->orconf = OE_Default; |
| 129447 | 130382 | } |
| 129448 | 130383 | sqlite3ExprDelete(db, pWhere); |
| 129449 | 130384 | return pTriggerStep; |
| 129450 | 130385 | } |
| | @@ -132438,11 +133373,11 @@ |
| 132438 | 133373 | } |
| 132439 | 133374 | pTab = pCtx->pTab; |
| 132440 | 133375 | assert( IsVirtual(pTab) ); |
| 132441 | 133376 | |
| 132442 | 133377 | memset(&sParse, 0, sizeof(sParse)); |
| 132443 | | - sParse.declareVtab = 1; |
| 133378 | + sParse.eParseMode = PARSE_MODE_DECLARE_VTAB; |
| 132444 | 133379 | sParse.db = db; |
| 132445 | 133380 | sParse.nQueryLoop = 1; |
| 132446 | 133381 | if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable, &zErr) |
| 132447 | 133382 | && sParse.pNewTable |
| 132448 | 133383 | && !db->mallocFailed |
| | @@ -132479,11 +133414,11 @@ |
| 132479 | 133414 | }else{ |
| 132480 | 133415 | sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr); |
| 132481 | 133416 | sqlite3DbFree(db, zErr); |
| 132482 | 133417 | rc = SQLITE_ERROR; |
| 132483 | 133418 | } |
| 132484 | | - sParse.declareVtab = 0; |
| 133419 | + sParse.eParseMode = PARSE_MODE_NORMAL; |
| 132485 | 133420 | |
| 132486 | 133421 | if( sParse.pVdbe ){ |
| 132487 | 133422 | sqlite3VdbeFinalize(sParse.pVdbe); |
| 132488 | 133423 | } |
| 132489 | 133424 | sqlite3DeleteTable(db, sParse.pNewTable); |
| | @@ -144970,14 +145905,25 @@ |
| 144970 | 145905 | ** that created the expression. |
| 144971 | 145906 | */ |
| 144972 | 145907 | static Expr *tokenExpr(Parse *pParse, int op, Token t){ |
| 144973 | 145908 | Expr *p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr)+t.n+1); |
| 144974 | 145909 | if( p ){ |
| 144975 | | - memset(p, 0, sizeof(Expr)); |
| 145910 | + /* memset(p, 0, sizeof(Expr)); */ |
| 144976 | 145911 | p->op = (u8)op; |
| 145912 | + p->affinity = 0; |
| 144977 | 145913 | p->flags = EP_Leaf; |
| 144978 | 145914 | p->iAgg = -1; |
| 145915 | + p->pLeft = p->pRight = 0; |
| 145916 | + p->x.pList = 0; |
| 145917 | + p->pAggInfo = 0; |
| 145918 | + p->pTab = 0; |
| 145919 | + p->op2 = 0; |
| 145920 | + p->iTable = 0; |
| 145921 | + p->iColumn = 0; |
| 145922 | +#ifndef SQLITE_OMIT_WINDOWFUNC |
| 145923 | + p->pWin = 0; |
| 145924 | +#endif |
| 144979 | 145925 | p->u.zToken = (char*)&p[1]; |
| 144980 | 145926 | memcpy(p->u.zToken, t.z, t.n); |
| 144981 | 145927 | p->u.zToken[t.n] = 0; |
| 144982 | 145928 | if( sqlite3Isquote(p->u.zToken[0]) ){ |
| 144983 | 145929 | if( p->u.zToken[0]=='"' ) p->flags |= EP_DblQuoted; |
| | @@ -144984,19 +145930,23 @@ |
| 144984 | 145930 | sqlite3Dequote(p->u.zToken); |
| 144985 | 145931 | } |
| 144986 | 145932 | #if SQLITE_MAX_EXPR_DEPTH>0 |
| 144987 | 145933 | p->nHeight = 1; |
| 144988 | 145934 | #endif |
| 145935 | + if( IN_RENAME_OBJECT ){ |
| 145936 | + return (Expr*)sqlite3RenameTokenMap(pParse, (void*)p, &t); |
| 145937 | + } |
| 144989 | 145938 | } |
| 144990 | 145939 | return p; |
| 144991 | 145940 | } |
| 145941 | + |
| 144992 | 145942 | |
| 144993 | 145943 | /* A routine to convert a binary TK_IS or TK_ISNOT expression into a |
| 144994 | 145944 | ** unary TK_ISNULL or TK_NOTNULL expression. */ |
| 144995 | 145945 | static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){ |
| 144996 | 145946 | sqlite3 *db = pParse->db; |
| 144997 | | - if( pA && pY && pY->op==TK_NULL ){ |
| 145947 | + if( pA && pY && pY->op==TK_NULL && !IN_RENAME_OBJECT ){ |
| 144998 | 145948 | pA->op = (u8)op; |
| 144999 | 145949 | sqlite3ExprDelete(db, pA->pRight); |
| 145000 | 145950 | pA->pRight = 0; |
| 145001 | 145951 | } |
| 145002 | 145952 | } |
| | @@ -145120,21 +146070,21 @@ |
| 145120 | 146070 | #define sqlite3ParserCTX_PDECL ,Parse *pParse |
| 145121 | 146071 | #define sqlite3ParserCTX_PARAM ,pParse |
| 145122 | 146072 | #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; |
| 145123 | 146073 | #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; |
| 145124 | 146074 | #define YYFALLBACK 1 |
| 145125 | | -#define YYNSTATE 518 |
| 145126 | | -#define YYNRULE 366 |
| 146075 | +#define YYNSTATE 521 |
| 146076 | +#define YYNRULE 367 |
| 145127 | 146077 | #define YYNTOKEN 155 |
| 145128 | | -#define YY_MAX_SHIFT 517 |
| 145129 | | -#define YY_MIN_SHIFTREDUCE 752 |
| 145130 | | -#define YY_MAX_SHIFTREDUCE 1117 |
| 145131 | | -#define YY_ERROR_ACTION 1118 |
| 145132 | | -#define YY_ACCEPT_ACTION 1119 |
| 145133 | | -#define YY_NO_ACTION 1120 |
| 145134 | | -#define YY_MIN_REDUCE 1121 |
| 145135 | | -#define YY_MAX_REDUCE 1486 |
| 146078 | +#define YY_MAX_SHIFT 520 |
| 146079 | +#define YY_MIN_SHIFTREDUCE 756 |
| 146080 | +#define YY_MAX_SHIFTREDUCE 1122 |
| 146081 | +#define YY_ERROR_ACTION 1123 |
| 146082 | +#define YY_ACCEPT_ACTION 1124 |
| 146083 | +#define YY_NO_ACTION 1125 |
| 146084 | +#define YY_MIN_REDUCE 1126 |
| 146085 | +#define YY_MAX_REDUCE 1492 |
| 145136 | 146086 | /************* End control #defines *******************************************/ |
| 145137 | 146087 | #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) |
| 145138 | 146088 | |
| 145139 | 146089 | /* Define the yytestcase() macro to be a no-op if is not already defined |
| 145140 | 146090 | ** otherwise. |
| | @@ -145199,211 +146149,211 @@ |
| 145199 | 146149 | ** yy_default[] Default action for each state. |
| 145200 | 146150 | ** |
| 145201 | 146151 | *********** Begin parsing tables **********************************************/ |
| 145202 | 146152 | #define YY_ACTTAB_COUNT (2009) |
| 145203 | 146153 | static const YYACTIONTYPE yy_action[] = { |
| 145204 | | - /* 0 */ 365, 105, 102, 197, 105, 102, 197, 512, 1119, 1, |
| 145205 | | - /* 10 */ 1, 517, 2, 1123, 512, 1187, 1166, 1450, 272, 367, |
| 145206 | | - /* 20 */ 127, 1384, 1192, 1192, 1187, 1161, 178, 1200, 64, 64, |
| 145207 | | - /* 30 */ 474, 883, 319, 425, 345, 37, 37, 804, 359, 884, |
| 145208 | | - /* 40 */ 506, 506, 506, 112, 113, 103, 1095, 1095, 949, 952, |
| 145209 | | - /* 50 */ 942, 942, 110, 110, 111, 111, 111, 111, 362, 250, |
| 145210 | | - /* 60 */ 250, 512, 250, 250, 494, 512, 306, 512, 456, 512, |
| 145211 | | - /* 70 */ 1074, 488, 509, 475, 6, 509, 805, 134, 495, 226, |
| 145212 | | - /* 80 */ 194, 425, 37, 37, 512, 206, 64, 64, 64, 64, |
| 146154 | + /* 0 */ 368, 105, 102, 197, 105, 102, 197, 515, 1124, 1, |
| 146155 | + /* 10 */ 1, 520, 2, 1128, 515, 1192, 1171, 1456, 275, 370, |
| 146156 | + /* 20 */ 127, 1389, 1197, 1197, 1192, 1166, 178, 1205, 64, 64, |
| 146157 | + /* 30 */ 477, 887, 322, 428, 348, 37, 37, 808, 362, 888, |
| 146158 | + /* 40 */ 509, 509, 509, 112, 113, 103, 1100, 1100, 953, 956, |
| 146159 | + /* 50 */ 946, 946, 110, 110, 111, 111, 111, 111, 365, 252, |
| 146160 | + /* 60 */ 252, 515, 252, 252, 497, 515, 309, 515, 459, 515, |
| 146161 | + /* 70 */ 1079, 491, 512, 478, 6, 512, 809, 134, 498, 228, |
| 146162 | + /* 80 */ 194, 428, 37, 37, 515, 208, 64, 64, 64, 64, |
| 145213 | 146163 | /* 90 */ 13, 13, 109, 109, 109, 109, 108, 108, 107, 107, |
| 145214 | | - /* 100 */ 107, 106, 398, 255, 378, 13, 13, 395, 394, 425, |
| 145215 | | - /* 110 */ 250, 250, 367, 473, 402, 1099, 1074, 1075, 1076, 383, |
| 145216 | | - /* 120 */ 1101, 387, 494, 509, 494, 1417, 1413, 301, 1100, 304, |
| 145217 | | - /* 130 */ 1251, 493, 367, 496, 16, 16, 112, 113, 103, 1095, |
| 145218 | | - /* 140 */ 1095, 949, 952, 942, 942, 110, 110, 111, 111, 111, |
| 145219 | | - /* 150 */ 111, 259, 1102, 492, 1102, 398, 112, 113, 103, 1095, |
| 145220 | | - /* 160 */ 1095, 949, 952, 942, 942, 110, 110, 111, 111, 111, |
| 145221 | | - /* 170 */ 111, 129, 1419, 340, 1414, 336, 1054, 489, 1052, 260, |
| 145222 | | - /* 180 */ 73, 105, 102, 197, 990, 109, 109, 109, 109, 108, |
| 145223 | | - /* 190 */ 108, 107, 107, 107, 106, 398, 367, 111, 111, 111, |
| 145224 | | - /* 200 */ 111, 104, 489, 89, 1426, 109, 109, 109, 109, 108, |
| 145225 | | - /* 210 */ 108, 107, 107, 107, 106, 398, 111, 111, 111, 111, |
| 145226 | | - /* 220 */ 112, 113, 103, 1095, 1095, 949, 952, 942, 942, 110, |
| 146164 | + /* 100 */ 107, 106, 401, 258, 381, 13, 13, 398, 397, 428, |
| 146165 | + /* 110 */ 252, 252, 370, 476, 405, 1104, 1079, 1080, 1081, 386, |
| 146166 | + /* 120 */ 1106, 390, 497, 512, 497, 1423, 1419, 304, 1105, 307, |
| 146167 | + /* 130 */ 1256, 496, 370, 499, 16, 16, 112, 113, 103, 1100, |
| 146168 | + /* 140 */ 1100, 953, 956, 946, 946, 110, 110, 111, 111, 111, |
| 146169 | + /* 150 */ 111, 262, 1107, 495, 1107, 401, 112, 113, 103, 1100, |
| 146170 | + /* 160 */ 1100, 953, 956, 946, 946, 110, 110, 111, 111, 111, |
| 146171 | + /* 170 */ 111, 129, 1425, 343, 1420, 339, 1059, 492, 1057, 263, |
| 146172 | + /* 180 */ 73, 105, 102, 197, 994, 109, 109, 109, 109, 108, |
| 146173 | + /* 190 */ 108, 107, 107, 107, 106, 401, 370, 111, 111, 111, |
| 146174 | + /* 200 */ 111, 104, 492, 89, 1432, 109, 109, 109, 109, 108, |
| 146175 | + /* 210 */ 108, 107, 107, 107, 106, 401, 111, 111, 111, 111, |
| 146176 | + /* 220 */ 112, 113, 103, 1100, 1100, 953, 956, 946, 946, 110, |
| 145227 | 146177 | /* 230 */ 110, 111, 111, 111, 111, 109, 109, 109, 109, 108, |
| 145228 | | - /* 240 */ 108, 107, 107, 107, 106, 398, 114, 108, 108, 107, |
| 145229 | | - /* 250 */ 107, 107, 106, 398, 109, 109, 109, 109, 108, 108, |
| 145230 | | - /* 260 */ 107, 107, 107, 106, 398, 152, 396, 396, 396, 109, |
| 145231 | | - /* 270 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 398, |
| 145232 | | - /* 280 */ 178, 490, 1406, 431, 1032, 1480, 1074, 512, 1480, 367, |
| 145233 | | - /* 290 */ 418, 294, 354, 409, 74, 1074, 109, 109, 109, 109, |
| 145234 | | - /* 300 */ 108, 108, 107, 107, 107, 106, 398, 1407, 37, 37, |
| 145235 | | - /* 310 */ 1425, 271, 503, 112, 113, 103, 1095, 1095, 949, 952, |
| 145236 | | - /* 320 */ 942, 942, 110, 110, 111, 111, 111, 111, 1430, 517, |
| 145237 | | - /* 330 */ 2, 1123, 1074, 1075, 1076, 427, 272, 1074, 127, 363, |
| 145238 | | - /* 340 */ 929, 1074, 1075, 1076, 218, 1200, 909, 455, 452, 451, |
| 145239 | | - /* 350 */ 389, 167, 512, 1030, 152, 442, 920, 450, 152, 870, |
| 145240 | | - /* 360 */ 919, 286, 109, 109, 109, 109, 108, 108, 107, 107, |
| 145241 | | - /* 370 */ 107, 106, 398, 13, 13, 258, 849, 250, 250, 225, |
| 145242 | | - /* 380 */ 106, 398, 367, 1074, 1075, 1076, 308, 385, 1074, 293, |
| 145243 | | - /* 390 */ 509, 919, 919, 921, 229, 320, 1250, 1383, 1417, 487, |
| 145244 | | - /* 400 */ 271, 503, 12, 206, 271, 503, 112, 113, 103, 1095, |
| 145245 | | - /* 410 */ 1095, 949, 952, 942, 942, 110, 110, 111, 111, 111, |
| 145246 | | - /* 420 */ 111, 1434, 283, 1123, 285, 1074, 1092, 245, 272, 1093, |
| 145247 | | - /* 430 */ 127, 384, 402, 386, 1074, 1075, 1076, 1200, 159, 236, |
| 145248 | | - /* 440 */ 253, 318, 458, 313, 457, 223, 786, 105, 102, 197, |
| 145249 | | - /* 450 */ 510, 311, 838, 838, 442, 109, 109, 109, 109, 108, |
| 145250 | | - /* 460 */ 108, 107, 107, 107, 106, 398, 512, 511, 512, 250, |
| 145251 | | - /* 470 */ 250, 1074, 1075, 1076, 432, 367, 1093, 929, 1454, 790, |
| 145252 | | - /* 480 */ 271, 503, 509, 105, 102, 197, 333, 63, 63, 64, |
| 145253 | | - /* 490 */ 64, 27, 786, 920, 284, 206, 1349, 919, 512, 112, |
| 145254 | | - /* 500 */ 113, 103, 1095, 1095, 949, 952, 942, 942, 110, 110, |
| 145255 | | - /* 510 */ 111, 111, 111, 111, 107, 107, 107, 106, 398, 49, |
| 145256 | | - /* 520 */ 49, 512, 28, 1074, 402, 494, 418, 294, 919, 919, |
| 145257 | | - /* 530 */ 921, 186, 465, 1074, 464, 995, 995, 439, 512, 1074, |
| 145258 | | - /* 540 */ 331, 512, 45, 45, 1078, 339, 173, 168, 109, 109, |
| 145259 | | - /* 550 */ 109, 109, 108, 108, 107, 107, 107, 106, 398, 13, |
| 145260 | | - /* 560 */ 13, 203, 13, 13, 250, 250, 1190, 1190, 367, 1074, |
| 145261 | | - /* 570 */ 1075, 1076, 783, 262, 5, 356, 491, 509, 466, 1074, |
| 145262 | | - /* 580 */ 1075, 1076, 395, 394, 1074, 1074, 1075, 1076, 3, 279, |
| 145263 | | - /* 590 */ 1074, 1078, 112, 113, 103, 1095, 1095, 949, 952, 942, |
| 145264 | | - /* 600 */ 942, 110, 110, 111, 111, 111, 111, 250, 250, 1011, |
| 145265 | | - /* 610 */ 218, 1074, 869, 455, 452, 451, 939, 939, 950, 953, |
| 145266 | | - /* 620 */ 509, 250, 250, 450, 1012, 1074, 442, 1102, 1204, 1102, |
| 145267 | | - /* 630 */ 1074, 1075, 1076, 512, 509, 423, 1074, 1075, 1076, 1013, |
| 145268 | | - /* 640 */ 509, 109, 109, 109, 109, 108, 108, 107, 107, 107, |
| 145269 | | - /* 650 */ 106, 398, 1047, 512, 50, 50, 512, 1074, 1075, 1076, |
| 145270 | | - /* 660 */ 824, 367, 1046, 376, 408, 1059, 1353, 205, 405, 769, |
| 145271 | | - /* 670 */ 825, 1074, 1075, 1076, 64, 64, 319, 64, 64, 1297, |
| 145272 | | - /* 680 */ 943, 408, 407, 1353, 1355, 112, 113, 103, 1095, 1095, |
| 145273 | | - /* 690 */ 949, 952, 942, 942, 110, 110, 111, 111, 111, 111, |
| 145274 | | - /* 700 */ 291, 479, 512, 1032, 1481, 512, 431, 1481, 351, 1115, |
| 145275 | | - /* 710 */ 480, 992, 909, 482, 463, 992, 132, 178, 33, 447, |
| 145276 | | - /* 720 */ 1198, 136, 403, 64, 64, 476, 64, 64, 416, 366, |
| 145277 | | - /* 730 */ 280, 1141, 250, 250, 109, 109, 109, 109, 108, 108, |
| 145278 | | - /* 740 */ 107, 107, 107, 106, 398, 509, 222, 437, 408, 263, |
| 145279 | | - /* 750 */ 1353, 263, 250, 250, 367, 293, 413, 281, 930, 393, |
| 145280 | | - /* 760 */ 972, 467, 397, 250, 250, 509, 9, 470, 229, 497, |
| 145281 | | - /* 770 */ 351, 1031, 1030, 1482, 352, 371, 509, 1116, 112, 113, |
| 145282 | | - /* 780 */ 103, 1095, 1095, 949, 952, 942, 942, 110, 110, 111, |
| 145283 | | - /* 790 */ 111, 111, 111, 250, 250, 1011, 512, 1342, 292, 250, |
| 145284 | | - /* 800 */ 250, 250, 250, 1093, 372, 247, 509, 442, 868, 319, |
| 145285 | | - /* 810 */ 1012, 477, 509, 195, 509, 431, 270, 15, 15, 512, |
| 145286 | | - /* 820 */ 311, 512, 95, 512, 93, 1013, 364, 109, 109, 109, |
| 145287 | | - /* 830 */ 109, 108, 108, 107, 107, 107, 106, 398, 512, 1116, |
| 145288 | | - /* 840 */ 39, 39, 51, 51, 52, 52, 500, 367, 512, 1199, |
| 145289 | | - /* 850 */ 1093, 914, 436, 338, 133, 433, 221, 220, 219, 53, |
| 145290 | | - /* 860 */ 53, 319, 1392, 757, 758, 759, 512, 367, 88, 54, |
| 145291 | | - /* 870 */ 54, 112, 113, 103, 1095, 1095, 949, 952, 942, 942, |
| 145292 | | - /* 880 */ 110, 110, 111, 111, 111, 111, 274, 55, 55, 196, |
| 145293 | | - /* 890 */ 512, 112, 113, 103, 1095, 1095, 949, 952, 942, 942, |
| 145294 | | - /* 900 */ 110, 110, 111, 111, 111, 111, 135, 261, 1144, 373, |
| 145295 | | - /* 910 */ 512, 40, 40, 512, 868, 512, 989, 512, 989, 116, |
| 146178 | + /* 240 */ 108, 107, 107, 107, 106, 401, 114, 108, 108, 107, |
| 146179 | + /* 250 */ 107, 107, 106, 401, 109, 109, 109, 109, 108, 108, |
| 146180 | + /* 260 */ 107, 107, 107, 106, 401, 152, 399, 399, 399, 109, |
| 146181 | + /* 270 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 401, |
| 146182 | + /* 280 */ 178, 493, 1412, 434, 1037, 1486, 1079, 515, 1486, 370, |
| 146183 | + /* 290 */ 421, 297, 357, 412, 74, 1079, 109, 109, 109, 109, |
| 146184 | + /* 300 */ 108, 108, 107, 107, 107, 106, 401, 1413, 37, 37, |
| 146185 | + /* 310 */ 1431, 274, 506, 112, 113, 103, 1100, 1100, 953, 956, |
| 146186 | + /* 320 */ 946, 946, 110, 110, 111, 111, 111, 111, 1436, 520, |
| 146187 | + /* 330 */ 2, 1128, 1079, 1080, 1081, 430, 275, 1079, 127, 366, |
| 146188 | + /* 340 */ 933, 1079, 1080, 1081, 220, 1205, 913, 458, 455, 454, |
| 146189 | + /* 350 */ 392, 167, 515, 1035, 152, 445, 924, 453, 152, 874, |
| 146190 | + /* 360 */ 923, 289, 109, 109, 109, 109, 108, 108, 107, 107, |
| 146191 | + /* 370 */ 107, 106, 401, 13, 13, 261, 853, 252, 252, 227, |
| 146192 | + /* 380 */ 106, 401, 370, 1079, 1080, 1081, 311, 388, 1079, 296, |
| 146193 | + /* 390 */ 512, 923, 923, 925, 231, 323, 1255, 1388, 1423, 490, |
| 146194 | + /* 400 */ 274, 506, 12, 208, 274, 506, 112, 113, 103, 1100, |
| 146195 | + /* 410 */ 1100, 953, 956, 946, 946, 110, 110, 111, 111, 111, |
| 146196 | + /* 420 */ 111, 1440, 286, 1128, 288, 1079, 1097, 247, 275, 1098, |
| 146197 | + /* 430 */ 127, 387, 405, 389, 1079, 1080, 1081, 1205, 159, 238, |
| 146198 | + /* 440 */ 255, 321, 461, 316, 460, 225, 790, 105, 102, 197, |
| 146199 | + /* 450 */ 513, 314, 842, 842, 445, 109, 109, 109, 109, 108, |
| 146200 | + /* 460 */ 108, 107, 107, 107, 106, 401, 515, 514, 515, 252, |
| 146201 | + /* 470 */ 252, 1079, 1080, 1081, 435, 370, 1098, 933, 1460, 794, |
| 146202 | + /* 480 */ 274, 506, 512, 105, 102, 197, 336, 63, 63, 64, |
| 146203 | + /* 490 */ 64, 27, 790, 924, 287, 208, 1354, 923, 515, 112, |
| 146204 | + /* 500 */ 113, 103, 1100, 1100, 953, 956, 946, 946, 110, 110, |
| 146205 | + /* 510 */ 111, 111, 111, 111, 107, 107, 107, 106, 401, 49, |
| 146206 | + /* 520 */ 49, 515, 28, 1079, 405, 497, 421, 297, 923, 923, |
| 146207 | + /* 530 */ 925, 186, 468, 1079, 467, 999, 999, 442, 515, 1079, |
| 146208 | + /* 540 */ 334, 515, 45, 45, 1083, 342, 173, 168, 109, 109, |
| 146209 | + /* 550 */ 109, 109, 108, 108, 107, 107, 107, 106, 401, 13, |
| 146210 | + /* 560 */ 13, 205, 13, 13, 252, 252, 1195, 1195, 370, 1079, |
| 146211 | + /* 570 */ 1080, 1081, 787, 265, 5, 359, 494, 512, 469, 1079, |
| 146212 | + /* 580 */ 1080, 1081, 398, 397, 1079, 1079, 1080, 1081, 3, 282, |
| 146213 | + /* 590 */ 1079, 1083, 112, 113, 103, 1100, 1100, 953, 956, 946, |
| 146214 | + /* 600 */ 946, 110, 110, 111, 111, 111, 111, 252, 252, 1015, |
| 146215 | + /* 610 */ 220, 1079, 873, 458, 455, 454, 943, 943, 954, 957, |
| 146216 | + /* 620 */ 512, 252, 252, 453, 1016, 1079, 445, 1107, 1209, 1107, |
| 146217 | + /* 630 */ 1079, 1080, 1081, 515, 512, 426, 1079, 1080, 1081, 1017, |
| 146218 | + /* 640 */ 512, 109, 109, 109, 109, 108, 108, 107, 107, 107, |
| 146219 | + /* 650 */ 106, 401, 1052, 515, 50, 50, 515, 1079, 1080, 1081, |
| 146220 | + /* 660 */ 828, 370, 1051, 379, 411, 1064, 1358, 207, 408, 773, |
| 146221 | + /* 670 */ 829, 1079, 1080, 1081, 64, 64, 322, 64, 64, 1302, |
| 146222 | + /* 680 */ 947, 411, 410, 1358, 1360, 112, 113, 103, 1100, 1100, |
| 146223 | + /* 690 */ 953, 956, 946, 946, 110, 110, 111, 111, 111, 111, |
| 146224 | + /* 700 */ 294, 482, 515, 1037, 1487, 515, 434, 1487, 354, 1120, |
| 146225 | + /* 710 */ 483, 996, 913, 485, 466, 996, 132, 178, 33, 450, |
| 146226 | + /* 720 */ 1203, 136, 406, 64, 64, 479, 64, 64, 419, 369, |
| 146227 | + /* 730 */ 283, 1146, 252, 252, 109, 109, 109, 109, 108, 108, |
| 146228 | + /* 740 */ 107, 107, 107, 106, 401, 512, 224, 440, 411, 266, |
| 146229 | + /* 750 */ 1358, 266, 252, 252, 370, 296, 416, 284, 934, 396, |
| 146230 | + /* 760 */ 976, 470, 400, 252, 252, 512, 9, 473, 231, 500, |
| 146231 | + /* 770 */ 354, 1036, 1035, 1488, 355, 374, 512, 1121, 112, 113, |
| 146232 | + /* 780 */ 103, 1100, 1100, 953, 956, 946, 946, 110, 110, 111, |
| 146233 | + /* 790 */ 111, 111, 111, 252, 252, 1015, 515, 1347, 295, 252, |
| 146234 | + /* 800 */ 252, 252, 252, 1098, 375, 249, 512, 445, 872, 322, |
| 146235 | + /* 810 */ 1016, 480, 512, 195, 512, 434, 273, 15, 15, 515, |
| 146236 | + /* 820 */ 314, 515, 95, 515, 93, 1017, 367, 109, 109, 109, |
| 146237 | + /* 830 */ 109, 108, 108, 107, 107, 107, 106, 401, 515, 1121, |
| 146238 | + /* 840 */ 39, 39, 51, 51, 52, 52, 503, 370, 515, 1204, |
| 146239 | + /* 850 */ 1098, 918, 439, 341, 133, 436, 223, 222, 221, 53, |
| 146240 | + /* 860 */ 53, 322, 1400, 761, 762, 763, 515, 370, 88, 54, |
| 146241 | + /* 870 */ 54, 112, 113, 103, 1100, 1100, 953, 956, 946, 946, |
| 146242 | + /* 880 */ 110, 110, 111, 111, 111, 111, 407, 55, 55, 196, |
| 146243 | + /* 890 */ 515, 112, 113, 103, 1100, 1100, 953, 956, 946, 946, |
| 146244 | + /* 900 */ 110, 110, 111, 111, 111, 111, 135, 264, 1149, 376, |
| 146245 | + /* 910 */ 515, 40, 40, 515, 872, 515, 993, 515, 993, 116, |
| 145296 | 146246 | /* 920 */ 109, 109, 109, 109, 108, 108, 107, 107, 107, 106, |
| 145297 | | - /* 930 */ 398, 41, 41, 512, 43, 43, 44, 44, 56, 56, |
| 146247 | + /* 930 */ 401, 41, 41, 515, 43, 43, 44, 44, 56, 56, |
| 145298 | 146248 | /* 940 */ 109, 109, 109, 109, 108, 108, 107, 107, 107, 106, |
| 145299 | | - /* 950 */ 398, 512, 376, 512, 57, 57, 512, 795, 512, 376, |
| 145300 | | - /* 960 */ 512, 442, 793, 512, 320, 512, 275, 512, 1453, 512, |
| 145301 | | - /* 970 */ 1282, 813, 58, 58, 14, 14, 512, 59, 59, 118, |
| 145302 | | - /* 980 */ 118, 60, 60, 512, 46, 46, 61, 61, 62, 62, |
| 145303 | | - /* 990 */ 47, 47, 512, 190, 189, 91, 512, 140, 140, 512, |
| 145304 | | - /* 1000 */ 391, 512, 844, 1195, 141, 141, 512, 843, 512, 793, |
| 145305 | | - /* 1010 */ 512, 410, 512, 69, 69, 367, 278, 48, 48, 256, |
| 145306 | | - /* 1020 */ 65, 65, 119, 119, 244, 244, 257, 66, 66, 120, |
| 145307 | | - /* 1030 */ 120, 121, 121, 117, 117, 367, 512, 509, 380, 112, |
| 145308 | | - /* 1040 */ 113, 103, 1095, 1095, 949, 952, 942, 942, 110, 110, |
| 145309 | | - /* 1050 */ 111, 111, 111, 111, 512, 868, 512, 139, 139, 112, |
| 145310 | | - /* 1060 */ 113, 103, 1095, 1095, 949, 952, 942, 942, 110, 110, |
| 145311 | | - /* 1070 */ 111, 111, 111, 111, 1282, 138, 138, 125, 125, 512, |
| 145312 | | - /* 1080 */ 12, 512, 1351, 1282, 512, 442, 131, 1282, 109, 109, |
| 145313 | | - /* 1090 */ 109, 109, 108, 108, 107, 107, 107, 106, 398, 512, |
| 145314 | | - /* 1100 */ 124, 124, 122, 122, 512, 123, 123, 512, 109, 109, |
| 145315 | | - /* 1110 */ 109, 109, 108, 108, 107, 107, 107, 106, 398, 512, |
| 145316 | | - /* 1120 */ 68, 68, 460, 779, 512, 70, 70, 299, 67, 67, |
| 145317 | | - /* 1130 */ 1027, 251, 251, 353, 1282, 191, 196, 1427, 462, 1296, |
| 145318 | | - /* 1140 */ 38, 38, 381, 94, 509, 42, 42, 177, 844, 271, |
| 145319 | | - /* 1150 */ 503, 382, 417, 843, 420, 438, 505, 373, 374, 153, |
| 145320 | | - /* 1160 */ 252, 868, 429, 367, 222, 249, 194, 883, 182, 290, |
| 145321 | | - /* 1170 */ 779, 988, 88, 988, 463, 884, 906, 911, 424, 426, |
| 145322 | | - /* 1180 */ 228, 228, 228, 367, 17, 803, 802, 112, 113, 103, |
| 145323 | | - /* 1190 */ 1095, 1095, 949, 952, 942, 942, 110, 110, 111, 111, |
| 145324 | | - /* 1200 */ 111, 111, 392, 295, 810, 811, 88, 112, 101, 103, |
| 145325 | | - /* 1210 */ 1095, 1095, 949, 952, 942, 942, 110, 110, 111, 111, |
| 145326 | | - /* 1220 */ 111, 111, 372, 419, 448, 309, 979, 224, 88, 975, |
| 145327 | | - /* 1230 */ 877, 841, 224, 228, 100, 923, 109, 109, 109, 109, |
| 145328 | | - /* 1240 */ 108, 108, 107, 107, 107, 106, 398, 86, 430, 777, |
| 145329 | | - /* 1250 */ 842, 1236, 130, 100, 1235, 412, 109, 109, 109, 109, |
| 145330 | | - /* 1260 */ 108, 108, 107, 107, 107, 106, 398, 317, 1443, 1397, |
| 145331 | | - /* 1270 */ 1170, 287, 1169, 979, 1372, 1371, 367, 316, 434, 296, |
| 145332 | | - /* 1280 */ 1232, 1223, 923, 300, 303, 305, 307, 1183, 1168, 1167, |
| 145333 | | - /* 1290 */ 312, 321, 322, 1244, 1281, 1219, 367, 268, 1230, 499, |
| 145334 | | - /* 1300 */ 498, 113, 103, 1095, 1095, 949, 952, 942, 942, 110, |
| 145335 | | - /* 1310 */ 110, 111, 111, 111, 111, 1287, 1150, 443, 242, 184, |
| 145336 | | - /* 1320 */ 1216, 1143, 103, 1095, 1095, 949, 952, 942, 942, 110, |
| 145337 | | - /* 1330 */ 110, 111, 111, 111, 111, 1132, 1131, 1133, 1437, 350, |
| 145338 | | - /* 1340 */ 411, 324, 188, 98, 504, 289, 4, 326, 315, 109, |
| 145339 | | - /* 1350 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 398, |
| 145340 | | - /* 1360 */ 507, 328, 1266, 1274, 358, 453, 282, 192, 1346, 109, |
| 145341 | | - /* 1370 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 398, |
| 145342 | | - /* 1380 */ 11, 1166, 1345, 399, 1440, 330, 502, 1110, 231, 428, |
| 145343 | | - /* 1390 */ 1391, 343, 187, 98, 504, 501, 4, 1107, 1389, 375, |
| 145344 | | - /* 1400 */ 422, 155, 72, 165, 75, 152, 149, 86, 414, 1263, |
| 145345 | | - /* 1410 */ 507, 157, 415, 160, 929, 161, 162, 163, 446, 1271, |
| 145346 | | - /* 1420 */ 96, 96, 8, 30, 208, 1277, 357, 97, 355, 399, |
| 145347 | | - /* 1430 */ 514, 513, 421, 399, 919, 31, 169, 435, 1340, 212, |
| 145348 | | - /* 1440 */ 80, 441, 243, 214, 1360, 501, 298, 174, 444, 302, |
| 145349 | | - /* 1450 */ 215, 271, 503, 1134, 216, 360, 485, 459, 388, 1186, |
| 145350 | | - /* 1460 */ 361, 484, 1185, 795, 929, 919, 919, 921, 922, 24, |
| 145351 | | - /* 1470 */ 96, 96, 1184, 1158, 1177, 314, 1157, 97, 1176, 399, |
| 145352 | | - /* 1480 */ 514, 513, 469, 1156, 919, 1452, 390, 266, 98, 504, |
| 145353 | | - /* 1490 */ 267, 4, 472, 478, 483, 85, 1227, 333, 230, 492, |
| 145354 | | - /* 1500 */ 1408, 332, 323, 115, 10, 507, 1228, 181, 335, 98, |
| 145355 | | - /* 1510 */ 504, 337, 4, 92, 87, 919, 919, 921, 922, 24, |
| 145356 | | - /* 1520 */ 1429, 1063, 401, 1226, 481, 254, 507, 325, 399, 327, |
| 145357 | | - /* 1530 */ 349, 349, 348, 239, 346, 1225, 329, 766, 1209, 1326, |
| 145358 | | - /* 1540 */ 501, 183, 1208, 341, 269, 342, 237, 1069, 1140, 399, |
| 145359 | | - /* 1550 */ 199, 485, 277, 29, 515, 241, 486, 238, 516, 929, |
| 145360 | | - /* 1560 */ 276, 501, 240, 1129, 1124, 96, 96, 1376, 142, 154, |
| 145361 | | - /* 1570 */ 369, 370, 97, 143, 399, 514, 513, 1377, 128, 919, |
| 145362 | | - /* 1580 */ 929, 1375, 144, 753, 400, 1374, 96, 96, 848, 1154, |
| 145363 | | - /* 1590 */ 201, 1153, 185, 97, 264, 399, 514, 513, 202, 71, |
| 145364 | | - /* 1600 */ 919, 146, 1151, 273, 198, 404, 126, 987, 200, 985, |
| 145365 | | - /* 1610 */ 919, 919, 921, 922, 24, 903, 156, 145, 204, 158, |
| 145366 | | - /* 1620 */ 827, 98, 504, 288, 4, 207, 1001, 164, 147, 907, |
| 145367 | | - /* 1630 */ 377, 919, 919, 921, 922, 24, 379, 148, 507, 166, |
| 145368 | | - /* 1640 */ 76, 77, 368, 1004, 78, 79, 209, 271, 503, 210, |
| 145369 | | - /* 1650 */ 1000, 137, 18, 297, 211, 228, 440, 1104, 213, 171, |
| 145370 | | - /* 1660 */ 32, 399, 768, 993, 170, 316, 445, 217, 449, 806, |
| 145371 | | - /* 1670 */ 406, 310, 172, 501, 81, 19, 20, 454, 82, 83, |
| 145372 | | - /* 1680 */ 265, 150, 179, 461, 485, 151, 180, 955, 84, 484, |
| 145373 | | - /* 1690 */ 1035, 34, 929, 35, 468, 1036, 193, 471, 96, 96, |
| 145374 | | - /* 1700 */ 246, 248, 876, 175, 871, 97, 100, 399, 514, 513, |
| 145375 | | - /* 1710 */ 1063, 401, 919, 227, 254, 1053, 21, 22, 1049, 349, |
| 145376 | | - /* 1720 */ 349, 348, 239, 346, 1040, 176, 766, 334, 1051, 7, |
| 145377 | | - /* 1730 */ 88, 98, 504, 970, 4, 233, 23, 956, 954, 199, |
| 145378 | | - /* 1740 */ 958, 277, 1010, 919, 919, 921, 922, 24, 507, 276, |
| 145379 | | - /* 1750 */ 232, 1009, 959, 25, 36, 508, 924, 778, 99, 26, |
| 145380 | | - /* 1760 */ 347, 90, 504, 837, 4, 234, 344, 235, 1445, 1064, |
| 145381 | | - /* 1770 */ 1120, 399, 1120, 1444, 1120, 1120, 1120, 1120, 507, 201, |
| 145382 | | - /* 1780 */ 1120, 1120, 1120, 501, 1120, 1120, 1120, 202, 1120, 1120, |
| 145383 | | - /* 1790 */ 146, 1120, 1120, 1120, 1120, 1120, 1120, 200, 1120, 1120, |
| 145384 | | - /* 1800 */ 1120, 399, 929, 1120, 1120, 1120, 1120, 1120, 96, 96, |
| 145385 | | - /* 1810 */ 1120, 1120, 1120, 501, 1120, 97, 1120, 399, 514, 513, |
| 145386 | | - /* 1820 */ 1120, 1120, 919, 1120, 1120, 1120, 1120, 1120, 1120, 1120, |
| 145387 | | - /* 1830 */ 1120, 368, 929, 1120, 1120, 1120, 271, 503, 96, 96, |
| 145388 | | - /* 1840 */ 1120, 1120, 1120, 1120, 1120, 97, 1120, 399, 514, 513, |
| 145389 | | - /* 1850 */ 1120, 1120, 919, 919, 919, 921, 922, 24, 1120, 406, |
| 145390 | | - /* 1860 */ 1120, 1120, 1120, 254, 1120, 1120, 1120, 1120, 349, 349, |
| 145391 | | - /* 1870 */ 348, 239, 346, 1120, 1120, 766, 1120, 1120, 1120, 1120, |
| 145392 | | - /* 1880 */ 1120, 1120, 1120, 919, 919, 921, 922, 24, 199, 1120, |
| 145393 | | - /* 1890 */ 277, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 276, 1120, |
| 145394 | | - /* 1900 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, |
| 145395 | | - /* 1910 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, |
| 145396 | | - /* 1920 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 201, 1120, |
| 145397 | | - /* 1930 */ 1120, 1120, 1120, 1120, 1120, 1120, 202, 1120, 1120, 146, |
| 145398 | | - /* 1940 */ 1120, 1120, 1120, 1120, 1120, 1120, 200, 1120, 1120, 1120, |
| 145399 | | - /* 1950 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, |
| 145400 | | - /* 1960 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, |
| 145401 | | - /* 1970 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, |
| 145402 | | - /* 1980 */ 368, 1120, 1120, 1120, 1120, 271, 503, 1120, 1120, 1120, |
| 145403 | | - /* 1990 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, |
| 145404 | | - /* 2000 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 406, |
| 146249 | + /* 950 */ 401, 515, 379, 515, 57, 57, 515, 799, 515, 379, |
| 146250 | + /* 960 */ 515, 445, 200, 515, 323, 515, 1397, 515, 1459, 515, |
| 146251 | + /* 970 */ 1287, 817, 58, 58, 14, 14, 515, 59, 59, 118, |
| 146252 | + /* 980 */ 118, 60, 60, 515, 46, 46, 61, 61, 62, 62, |
| 146253 | + /* 990 */ 47, 47, 515, 190, 189, 91, 515, 140, 140, 515, |
| 146254 | + /* 1000 */ 394, 515, 277, 1200, 141, 141, 515, 1115, 515, 992, |
| 146255 | + /* 1010 */ 515, 992, 515, 69, 69, 370, 278, 48, 48, 259, |
| 146256 | + /* 1020 */ 65, 65, 119, 119, 246, 246, 260, 66, 66, 120, |
| 146257 | + /* 1030 */ 120, 121, 121, 117, 117, 370, 515, 512, 383, 112, |
| 146258 | + /* 1040 */ 113, 103, 1100, 1100, 953, 956, 946, 946, 110, 110, |
| 146259 | + /* 1050 */ 111, 111, 111, 111, 515, 872, 515, 139, 139, 112, |
| 146260 | + /* 1060 */ 113, 103, 1100, 1100, 953, 956, 946, 946, 110, 110, |
| 146261 | + /* 1070 */ 111, 111, 111, 111, 1287, 138, 138, 125, 125, 515, |
| 146262 | + /* 1080 */ 12, 515, 281, 1287, 515, 445, 131, 1287, 109, 109, |
| 146263 | + /* 1090 */ 109, 109, 108, 108, 107, 107, 107, 106, 401, 515, |
| 146264 | + /* 1100 */ 124, 124, 122, 122, 515, 123, 123, 515, 109, 109, |
| 146265 | + /* 1110 */ 109, 109, 108, 108, 107, 107, 107, 106, 401, 515, |
| 146266 | + /* 1120 */ 68, 68, 463, 783, 515, 70, 70, 302, 67, 67, |
| 146267 | + /* 1130 */ 1032, 253, 253, 356, 1287, 191, 196, 1433, 465, 1301, |
| 146268 | + /* 1140 */ 38, 38, 384, 94, 512, 42, 42, 177, 848, 274, |
| 146269 | + /* 1150 */ 506, 385, 420, 847, 1356, 441, 508, 376, 377, 153, |
| 146270 | + /* 1160 */ 423, 872, 432, 370, 224, 251, 194, 887, 182, 293, |
| 146271 | + /* 1170 */ 783, 848, 88, 254, 466, 888, 847, 915, 807, 806, |
| 146272 | + /* 1180 */ 230, 1241, 910, 370, 17, 413, 797, 112, 113, 103, |
| 146273 | + /* 1190 */ 1100, 1100, 953, 956, 946, 946, 110, 110, 111, 111, |
| 146274 | + /* 1200 */ 111, 111, 395, 814, 815, 1175, 983, 112, 101, 103, |
| 146275 | + /* 1210 */ 1100, 1100, 953, 956, 946, 946, 110, 110, 111, 111, |
| 146276 | + /* 1220 */ 111, 111, 375, 422, 427, 429, 298, 230, 230, 88, |
| 146277 | + /* 1230 */ 1240, 451, 312, 797, 226, 88, 109, 109, 109, 109, |
| 146278 | + /* 1240 */ 108, 108, 107, 107, 107, 106, 401, 86, 433, 979, |
| 146279 | + /* 1250 */ 927, 881, 226, 983, 230, 415, 109, 109, 109, 109, |
| 146280 | + /* 1260 */ 108, 108, 107, 107, 107, 106, 401, 320, 845, 781, |
| 146281 | + /* 1270 */ 846, 100, 130, 100, 1403, 290, 370, 319, 1377, 1376, |
| 146282 | + /* 1280 */ 437, 1449, 299, 1237, 303, 306, 308, 310, 1188, 1174, |
| 146283 | + /* 1290 */ 1173, 1172, 315, 324, 325, 1228, 370, 927, 1249, 271, |
| 146284 | + /* 1300 */ 1286, 113, 103, 1100, 1100, 953, 956, 946, 946, 110, |
| 146285 | + /* 1310 */ 110, 111, 111, 111, 111, 1224, 1235, 502, 501, 1292, |
| 146286 | + /* 1320 */ 1221, 1155, 103, 1100, 1100, 953, 956, 946, 946, 110, |
| 146287 | + /* 1330 */ 110, 111, 111, 111, 111, 1148, 1137, 1136, 1138, 1443, |
| 146288 | + /* 1340 */ 446, 244, 184, 98, 507, 188, 4, 353, 327, 109, |
| 146289 | + /* 1350 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 401, |
| 146290 | + /* 1360 */ 510, 329, 331, 199, 414, 456, 292, 285, 318, 109, |
| 146291 | + /* 1370 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 401, |
| 146292 | + /* 1380 */ 11, 1271, 1279, 402, 361, 192, 1171, 1351, 431, 505, |
| 146293 | + /* 1390 */ 346, 1350, 333, 98, 507, 504, 4, 187, 1446, 1115, |
| 146294 | + /* 1400 */ 233, 1396, 155, 1394, 1112, 152, 72, 75, 378, 425, |
| 146295 | + /* 1410 */ 510, 165, 149, 157, 933, 1276, 86, 30, 1268, 417, |
| 146296 | + /* 1420 */ 96, 96, 8, 160, 161, 162, 163, 97, 418, 402, |
| 146297 | + /* 1430 */ 517, 516, 449, 402, 923, 210, 358, 424, 1282, 438, |
| 146298 | + /* 1440 */ 169, 214, 360, 1345, 80, 504, 31, 444, 1365, 301, |
| 146299 | + /* 1450 */ 245, 274, 506, 216, 174, 305, 488, 447, 217, 462, |
| 146300 | + /* 1460 */ 1139, 487, 218, 363, 933, 923, 923, 925, 926, 24, |
| 146301 | + /* 1470 */ 96, 96, 1191, 1190, 1189, 391, 1182, 97, 1163, 402, |
| 146302 | + /* 1480 */ 517, 516, 799, 364, 923, 1162, 317, 1161, 98, 507, |
| 146303 | + /* 1490 */ 1181, 4, 1458, 472, 393, 269, 270, 475, 481, 1232, |
| 146304 | + /* 1500 */ 85, 1233, 326, 328, 232, 510, 495, 1231, 330, 98, |
| 146305 | + /* 1510 */ 507, 1230, 4, 486, 335, 923, 923, 925, 926, 24, |
| 146306 | + /* 1520 */ 1435, 1068, 404, 181, 336, 256, 510, 115, 402, 332, |
| 146307 | + /* 1530 */ 352, 352, 351, 241, 349, 1214, 1414, 770, 338, 10, |
| 146308 | + /* 1540 */ 504, 340, 272, 92, 1331, 1213, 87, 183, 484, 402, |
| 146309 | + /* 1550 */ 201, 488, 280, 239, 344, 345, 489, 1145, 29, 933, |
| 146310 | + /* 1560 */ 279, 504, 1074, 518, 240, 96, 96, 242, 243, 519, |
| 146311 | + /* 1570 */ 1134, 1129, 97, 154, 402, 517, 516, 372, 373, 923, |
| 146312 | + /* 1580 */ 933, 142, 143, 128, 1381, 267, 96, 96, 852, 757, |
| 146313 | + /* 1590 */ 203, 144, 403, 97, 1382, 402, 517, 516, 204, 1380, |
| 146314 | + /* 1600 */ 923, 146, 1379, 1159, 1158, 71, 1156, 276, 202, 185, |
| 146315 | + /* 1610 */ 923, 923, 925, 926, 24, 198, 257, 126, 991, 989, |
| 146316 | + /* 1620 */ 907, 98, 507, 156, 4, 145, 158, 206, 831, 209, |
| 146317 | + /* 1630 */ 291, 923, 923, 925, 926, 24, 1005, 911, 510, 164, |
| 146318 | + /* 1640 */ 147, 380, 371, 382, 166, 76, 77, 274, 506, 148, |
| 146319 | + /* 1650 */ 78, 79, 1008, 211, 212, 1004, 137, 213, 18, 300, |
| 146320 | + /* 1660 */ 230, 402, 997, 1109, 443, 215, 32, 170, 171, 772, |
| 146321 | + /* 1670 */ 409, 448, 319, 504, 219, 172, 452, 81, 19, 457, |
| 146322 | + /* 1680 */ 313, 20, 82, 268, 488, 150, 810, 179, 83, 487, |
| 146323 | + /* 1690 */ 464, 151, 933, 180, 959, 84, 1040, 34, 96, 96, |
| 146324 | + /* 1700 */ 471, 1041, 35, 474, 193, 97, 248, 402, 517, 516, |
| 146325 | + /* 1710 */ 1068, 404, 923, 250, 256, 880, 229, 175, 875, 352, |
| 146326 | + /* 1720 */ 352, 351, 241, 349, 100, 21, 770, 22, 1054, 1056, |
| 146327 | + /* 1730 */ 7, 98, 507, 1045, 4, 337, 1058, 23, 974, 201, |
| 146328 | + /* 1740 */ 176, 280, 88, 923, 923, 925, 926, 24, 510, 279, |
| 146329 | + /* 1750 */ 960, 958, 962, 1014, 963, 1013, 235, 234, 25, 36, |
| 146330 | + /* 1760 */ 99, 90, 507, 928, 4, 511, 350, 782, 26, 841, |
| 146331 | + /* 1770 */ 236, 402, 347, 1069, 237, 1125, 1125, 1451, 510, 203, |
| 146332 | + /* 1780 */ 1450, 1125, 1125, 504, 1125, 1125, 1125, 204, 1125, 1125, |
| 146333 | + /* 1790 */ 146, 1125, 1125, 1125, 1125, 1125, 1125, 202, 1125, 1125, |
| 146334 | + /* 1800 */ 1125, 402, 933, 1125, 1125, 1125, 1125, 1125, 96, 96, |
| 146335 | + /* 1810 */ 1125, 1125, 1125, 504, 1125, 97, 1125, 402, 517, 516, |
| 146336 | + /* 1820 */ 1125, 1125, 923, 1125, 1125, 1125, 1125, 1125, 1125, 1125, |
| 146337 | + /* 1830 */ 1125, 371, 933, 1125, 1125, 1125, 274, 506, 96, 96, |
| 146338 | + /* 1840 */ 1125, 1125, 1125, 1125, 1125, 97, 1125, 402, 517, 516, |
| 146339 | + /* 1850 */ 1125, 1125, 923, 923, 923, 925, 926, 24, 1125, 409, |
| 146340 | + /* 1860 */ 1125, 1125, 1125, 256, 1125, 1125, 1125, 1125, 352, 352, |
| 146341 | + /* 1870 */ 351, 241, 349, 1125, 1125, 770, 1125, 1125, 1125, 1125, |
| 146342 | + /* 1880 */ 1125, 1125, 1125, 923, 923, 925, 926, 24, 201, 1125, |
| 146343 | + /* 1890 */ 280, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 279, 1125, |
| 146344 | + /* 1900 */ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, |
| 146345 | + /* 1910 */ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, |
| 146346 | + /* 1920 */ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 203, 1125, |
| 146347 | + /* 1930 */ 1125, 1125, 1125, 1125, 1125, 1125, 204, 1125, 1125, 146, |
| 146348 | + /* 1940 */ 1125, 1125, 1125, 1125, 1125, 1125, 202, 1125, 1125, 1125, |
| 146349 | + /* 1950 */ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, |
| 146350 | + /* 1960 */ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, |
| 146351 | + /* 1970 */ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, |
| 146352 | + /* 1980 */ 371, 1125, 1125, 1125, 1125, 274, 506, 1125, 1125, 1125, |
| 146353 | + /* 1990 */ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, |
| 146354 | + /* 2000 */ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 409, |
| 145405 | 146355 | }; |
| 145406 | 146356 | static const YYCODETYPE yy_lookahead[] = { |
| 145407 | 146357 | /* 0 */ 184, 238, 239, 240, 238, 239, 240, 163, 155, 156, |
| 145408 | 146358 | /* 10 */ 157, 158, 159, 160, 163, 191, 192, 183, 165, 19, |
| 145409 | 146359 | /* 20 */ 167, 258, 202, 203, 200, 191, 163, 174, 184, 185, |
| | @@ -145498,16 +146448,16 @@ |
| 145498 | 146448 | /* 910 */ 163, 184, 185, 163, 132, 163, 141, 163, 143, 22, |
| 145499 | 146449 | /* 920 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, |
| 145500 | 146450 | /* 930 */ 102, 184, 185, 163, 184, 185, 184, 185, 184, 185, |
| 145501 | 146451 | /* 940 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, |
| 145502 | 146452 | /* 950 */ 102, 163, 163, 163, 184, 185, 163, 115, 163, 163, |
| 145503 | | - /* 960 */ 163, 163, 59, 163, 163, 163, 163, 163, 23, 163, |
| 146453 | + /* 960 */ 163, 163, 15, 163, 163, 163, 163, 163, 23, 163, |
| 145504 | 146454 | /* 970 */ 163, 26, 184, 185, 184, 185, 163, 184, 185, 184, |
| 145505 | 146455 | /* 980 */ 185, 184, 185, 163, 184, 185, 184, 185, 184, 185, |
| 145506 | 146456 | /* 990 */ 184, 185, 163, 96, 97, 147, 163, 184, 185, 163, |
| 145507 | | - /* 1000 */ 199, 163, 124, 205, 184, 185, 163, 129, 163, 106, |
| 145508 | | - /* 1010 */ 163, 234, 163, 184, 185, 19, 163, 184, 185, 230, |
| 146457 | + /* 1000 */ 199, 163, 163, 205, 184, 185, 163, 60, 163, 141, |
| 146458 | + /* 1010 */ 163, 143, 163, 184, 185, 19, 163, 184, 185, 230, |
| 145509 | 146459 | /* 1020 */ 184, 185, 184, 185, 206, 207, 230, 184, 185, 184, |
| 145510 | 146460 | /* 1030 */ 185, 184, 185, 184, 185, 19, 163, 219, 231, 43, |
| 145511 | 146461 | /* 1040 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
| 145512 | 146462 | /* 1050 */ 54, 55, 56, 57, 163, 26, 163, 184, 185, 43, |
| 145513 | 146463 | /* 1060 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
| | @@ -145517,74 +146467,74 @@ |
| 145517 | 146467 | /* 1100 */ 184, 185, 184, 185, 163, 184, 185, 163, 92, 93, |
| 145518 | 146468 | /* 1110 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 163, |
| 145519 | 146469 | /* 1120 */ 184, 185, 98, 59, 163, 184, 185, 205, 184, 185, |
| 145520 | 146470 | /* 1130 */ 23, 206, 207, 26, 163, 26, 107, 153, 154, 237, |
| 145521 | 146471 | /* 1140 */ 184, 185, 231, 147, 219, 184, 185, 249, 124, 127, |
| 145522 | | - /* 1150 */ 128, 231, 254, 129, 118, 231, 177, 178, 262, 263, |
| 145523 | | - /* 1160 */ 22, 132, 19, 19, 46, 223, 224, 31, 24, 23, |
| 145524 | | - /* 1170 */ 106, 141, 26, 143, 272, 39, 140, 23, 23, 23, |
| 145525 | | - /* 1180 */ 26, 26, 26, 19, 22, 109, 110, 43, 44, 45, |
| 146472 | + /* 1150 */ 128, 231, 254, 129, 163, 231, 177, 178, 262, 263, |
| 146473 | + /* 1160 */ 118, 132, 19, 19, 46, 223, 224, 31, 24, 23, |
| 146474 | + /* 1170 */ 106, 124, 26, 22, 272, 39, 129, 23, 109, 110, |
| 146475 | + /* 1180 */ 26, 163, 140, 19, 22, 234, 59, 43, 44, 45, |
| 145526 | 146476 | /* 1190 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, |
| 145527 | | - /* 1200 */ 56, 57, 231, 23, 7, 8, 26, 43, 44, 45, |
| 146477 | + /* 1200 */ 56, 57, 231, 7, 8, 193, 59, 43, 44, 45, |
| 145528 | 146478 | /* 1210 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, |
| 145529 | | - /* 1220 */ 56, 57, 104, 61, 23, 23, 59, 26, 26, 23, |
| 145530 | | - /* 1230 */ 23, 23, 26, 26, 26, 59, 92, 93, 94, 95, |
| 146479 | + /* 1220 */ 56, 57, 104, 61, 23, 23, 23, 26, 26, 26, |
| 146480 | + /* 1230 */ 163, 23, 23, 106, 26, 26, 92, 93, 94, 95, |
| 145531 | 146481 | /* 1240 */ 96, 97, 98, 99, 100, 101, 102, 138, 105, 23, |
| 145532 | | - /* 1250 */ 23, 163, 26, 26, 163, 163, 92, 93, 94, 95, |
| 145533 | | - /* 1260 */ 96, 97, 98, 99, 100, 101, 102, 110, 130, 163, |
| 145534 | | - /* 1270 */ 193, 163, 193, 106, 163, 163, 19, 120, 163, 163, |
| 145535 | | - /* 1280 */ 163, 225, 106, 163, 163, 163, 163, 163, 193, 163, |
| 145536 | | - /* 1290 */ 163, 163, 163, 163, 163, 163, 19, 222, 163, 203, |
| 146482 | + /* 1250 */ 59, 23, 26, 106, 26, 163, 92, 93, 94, 95, |
| 146483 | + /* 1260 */ 96, 97, 98, 99, 100, 101, 102, 110, 23, 23, |
| 146484 | + /* 1270 */ 23, 26, 26, 26, 163, 163, 19, 120, 163, 163, |
| 146485 | + /* 1280 */ 163, 130, 163, 163, 163, 163, 163, 163, 163, 193, |
| 146486 | + /* 1290 */ 193, 163, 163, 163, 163, 225, 19, 106, 163, 222, |
| 145537 | 146487 | /* 1300 */ 163, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 145538 | | - /* 1310 */ 53, 54, 55, 56, 57, 163, 163, 251, 250, 209, |
| 146488 | + /* 1310 */ 53, 54, 55, 56, 57, 163, 163, 203, 163, 163, |
| 145539 | 146489 | /* 1320 */ 222, 163, 45, 46, 47, 48, 49, 50, 51, 52, |
| 145540 | | - /* 1330 */ 53, 54, 55, 56, 57, 163, 163, 163, 163, 161, |
| 145541 | | - /* 1340 */ 226, 222, 182, 19, 20, 256, 22, 222, 187, 92, |
| 146490 | + /* 1330 */ 53, 54, 55, 56, 57, 163, 163, 163, 163, 163, |
| 146491 | + /* 1340 */ 251, 250, 209, 19, 20, 182, 22, 161, 222, 92, |
| 145542 | 146492 | /* 1350 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, |
| 145543 | | - /* 1360 */ 36, 222, 213, 213, 213, 188, 226, 196, 187, 92, |
| 146493 | + /* 1360 */ 36, 222, 222, 260, 226, 188, 256, 226, 187, 92, |
| 145544 | 146494 | /* 1370 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, |
| 145545 | | - /* 1380 */ 210, 192, 187, 59, 166, 226, 244, 60, 130, 256, |
| 145546 | | - /* 1390 */ 170, 212, 210, 19, 20, 71, 22, 38, 170, 170, |
| 145547 | | - /* 1400 */ 104, 260, 257, 22, 257, 81, 43, 138, 18, 213, |
| 145548 | | - /* 1410 */ 36, 201, 170, 204, 90, 204, 204, 204, 18, 236, |
| 145549 | | - /* 1420 */ 96, 97, 48, 235, 169, 201, 236, 103, 213, 105, |
| 145550 | | - /* 1430 */ 106, 107, 213, 59, 110, 235, 201, 170, 213, 169, |
| 145551 | | - /* 1440 */ 146, 62, 170, 169, 253, 71, 252, 22, 189, 170, |
| 145552 | | - /* 1450 */ 169, 127, 128, 170, 169, 189, 82, 104, 64, 186, |
| 145553 | | - /* 1460 */ 189, 87, 186, 115, 90, 141, 142, 143, 144, 145, |
| 145554 | | - /* 1470 */ 96, 97, 186, 186, 194, 186, 188, 103, 194, 105, |
| 145555 | | - /* 1480 */ 106, 107, 189, 186, 110, 186, 102, 246, 19, 20, |
| 145556 | | - /* 1490 */ 246, 22, 189, 133, 84, 104, 228, 22, 170, 134, |
| 145557 | | - /* 1500 */ 269, 271, 227, 137, 22, 36, 228, 216, 216, 19, |
| 145558 | | - /* 1510 */ 20, 170, 22, 146, 136, 141, 142, 143, 144, 145, |
| 145559 | | - /* 1520 */ 0, 1, 2, 228, 135, 5, 36, 227, 59, 227, |
| 145560 | | - /* 1530 */ 10, 11, 12, 13, 14, 228, 227, 17, 217, 241, |
| 145561 | | - /* 1540 */ 71, 215, 217, 214, 243, 213, 25, 13, 173, 59, |
| 145562 | | - /* 1550 */ 30, 82, 32, 26, 172, 6, 87, 164, 162, 90, |
| 145563 | | - /* 1560 */ 40, 71, 164, 162, 162, 96, 97, 182, 176, 263, |
| 145564 | | - /* 1570 */ 266, 266, 103, 176, 105, 106, 107, 182, 190, 110, |
| 145565 | | - /* 1580 */ 90, 182, 176, 4, 3, 182, 96, 97, 98, 182, |
| 145566 | | - /* 1590 */ 70, 182, 22, 103, 190, 105, 106, 107, 78, 182, |
| 145567 | | - /* 1600 */ 110, 81, 182, 151, 15, 89, 16, 23, 88, 23, |
| 145568 | | - /* 1610 */ 141, 142, 143, 144, 145, 128, 139, 119, 24, 131, |
| 145569 | | - /* 1620 */ 20, 19, 20, 16, 22, 133, 1, 131, 119, 140, |
| 145570 | | - /* 1630 */ 61, 141, 142, 143, 144, 145, 37, 119, 36, 139, |
| 145571 | | - /* 1640 */ 53, 53, 122, 105, 53, 53, 34, 127, 128, 130, |
| 145572 | | - /* 1650 */ 1, 5, 22, 149, 104, 26, 41, 75, 130, 104, |
| 145573 | | - /* 1660 */ 24, 59, 20, 68, 68, 120, 19, 114, 67, 28, |
| 145574 | | - /* 1670 */ 150, 23, 22, 71, 22, 22, 22, 67, 22, 138, |
| 145575 | | - /* 1680 */ 67, 37, 23, 22, 82, 153, 23, 23, 26, 87, |
| 145576 | | - /* 1690 */ 23, 22, 90, 22, 24, 23, 130, 24, 96, 97, |
| 145577 | | - /* 1700 */ 23, 23, 105, 22, 132, 103, 26, 105, 106, 107, |
| 145578 | | - /* 1710 */ 1, 2, 110, 34, 5, 75, 34, 34, 85, 10, |
| 145579 | | - /* 1720 */ 11, 12, 13, 14, 23, 26, 17, 24, 83, 44, |
| 145580 | | - /* 1730 */ 26, 19, 20, 23, 22, 22, 34, 23, 23, 30, |
| 145581 | | - /* 1740 */ 23, 32, 23, 141, 142, 143, 144, 145, 36, 40, |
| 145582 | | - /* 1750 */ 26, 23, 11, 22, 22, 26, 23, 23, 22, 22, |
| 145583 | | - /* 1760 */ 15, 19, 20, 124, 22, 130, 23, 130, 130, 1, |
| 145584 | | - /* 1770 */ 277, 59, 277, 130, 277, 277, 277, 277, 36, 70, |
| 145585 | | - /* 1780 */ 277, 277, 277, 71, 277, 277, 277, 78, 277, 277, |
| 146495 | + /* 1380 */ 210, 213, 213, 59, 213, 196, 192, 187, 256, 244, |
| 146496 | + /* 1390 */ 212, 187, 226, 19, 20, 71, 22, 210, 166, 60, |
| 146497 | + /* 1400 */ 130, 170, 260, 170, 38, 81, 257, 257, 170, 104, |
| 146498 | + /* 1410 */ 36, 22, 43, 201, 90, 236, 138, 235, 213, 18, |
| 146499 | + /* 1420 */ 96, 97, 48, 204, 204, 204, 204, 103, 170, 105, |
| 146500 | + /* 1430 */ 106, 107, 18, 59, 110, 169, 213, 213, 201, 170, |
| 146501 | + /* 1440 */ 201, 169, 236, 213, 146, 71, 235, 62, 253, 252, |
| 146502 | + /* 1450 */ 170, 127, 128, 169, 22, 170, 82, 189, 169, 104, |
| 146503 | + /* 1460 */ 170, 87, 169, 189, 90, 141, 142, 143, 144, 145, |
| 146504 | + /* 1470 */ 96, 97, 186, 186, 186, 64, 194, 103, 186, 105, |
| 146505 | + /* 1480 */ 106, 107, 115, 189, 110, 188, 186, 186, 19, 20, |
| 146506 | + /* 1490 */ 194, 22, 186, 189, 102, 246, 246, 189, 133, 228, |
| 146507 | + /* 1500 */ 104, 228, 227, 227, 170, 36, 134, 228, 227, 19, |
| 146508 | + /* 1510 */ 20, 228, 22, 84, 271, 141, 142, 143, 144, 145, |
| 146509 | + /* 1520 */ 0, 1, 2, 216, 22, 5, 36, 137, 59, 227, |
| 146510 | + /* 1530 */ 10, 11, 12, 13, 14, 217, 269, 17, 216, 22, |
| 146511 | + /* 1540 */ 71, 170, 243, 146, 241, 217, 136, 215, 135, 59, |
| 146512 | + /* 1550 */ 30, 82, 32, 25, 214, 213, 87, 173, 26, 90, |
| 146513 | + /* 1560 */ 40, 71, 13, 172, 164, 96, 97, 164, 6, 162, |
| 146514 | + /* 1570 */ 162, 162, 103, 263, 105, 106, 107, 266, 266, 110, |
| 146515 | + /* 1580 */ 90, 176, 176, 190, 182, 190, 96, 97, 98, 4, |
| 146516 | + /* 1590 */ 70, 176, 3, 103, 182, 105, 106, 107, 78, 182, |
| 146517 | + /* 1600 */ 110, 81, 182, 182, 182, 182, 182, 151, 88, 22, |
| 146518 | + /* 1610 */ 141, 142, 143, 144, 145, 15, 89, 16, 23, 23, |
| 146519 | + /* 1620 */ 128, 19, 20, 139, 22, 119, 131, 24, 20, 133, |
| 146520 | + /* 1630 */ 16, 141, 142, 143, 144, 145, 1, 140, 36, 131, |
| 146521 | + /* 1640 */ 119, 61, 122, 37, 139, 53, 53, 127, 128, 119, |
| 146522 | + /* 1650 */ 53, 53, 105, 34, 130, 1, 5, 104, 22, 149, |
| 146523 | + /* 1660 */ 26, 59, 68, 75, 41, 130, 24, 68, 104, 20, |
| 146524 | + /* 1670 */ 150, 19, 120, 71, 114, 22, 67, 22, 22, 67, |
| 146525 | + /* 1680 */ 23, 22, 22, 67, 82, 37, 28, 23, 138, 87, |
| 146526 | + /* 1690 */ 22, 153, 90, 23, 23, 26, 23, 22, 96, 97, |
| 146527 | + /* 1700 */ 24, 23, 22, 24, 130, 103, 23, 105, 106, 107, |
| 146528 | + /* 1710 */ 1, 2, 110, 23, 5, 105, 34, 22, 132, 10, |
| 146529 | + /* 1720 */ 11, 12, 13, 14, 26, 34, 17, 34, 85, 83, |
| 146530 | + /* 1730 */ 44, 19, 20, 23, 22, 24, 75, 34, 23, 30, |
| 146531 | + /* 1740 */ 26, 32, 26, 141, 142, 143, 144, 145, 36, 40, |
| 146532 | + /* 1750 */ 23, 23, 23, 23, 11, 23, 22, 26, 22, 22, |
| 146533 | + /* 1760 */ 22, 19, 20, 23, 22, 26, 15, 23, 22, 124, |
| 146534 | + /* 1770 */ 130, 59, 23, 1, 130, 277, 277, 130, 36, 70, |
| 146535 | + /* 1780 */ 130, 277, 277, 71, 277, 277, 277, 78, 277, 277, |
| 145586 | 146536 | /* 1790 */ 81, 277, 277, 277, 277, 277, 277, 88, 277, 277, |
| 145587 | 146537 | /* 1800 */ 277, 59, 90, 277, 277, 277, 277, 277, 96, 97, |
| 145588 | 146538 | /* 1810 */ 277, 277, 277, 71, 277, 103, 277, 105, 106, 107, |
| 145589 | 146539 | /* 1820 */ 277, 277, 110, 277, 277, 277, 277, 277, 277, 277, |
| 145590 | 146540 | /* 1830 */ 277, 122, 90, 277, 277, 277, 127, 128, 96, 97, |
| | @@ -145605,11 +146555,11 @@ |
| 145605 | 146555 | /* 1980 */ 122, 277, 277, 277, 277, 127, 128, 277, 277, 277, |
| 145606 | 146556 | /* 1990 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, |
| 145607 | 146557 | /* 2000 */ 277, 277, 277, 277, 277, 277, 277, 277, 150, 277, |
| 145608 | 146558 | /* 2010 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, |
| 145609 | 146559 | }; |
| 145610 | | -#define YY_SHIFT_COUNT (517) |
| 146560 | +#define YY_SHIFT_COUNT (520) |
| 145611 | 146561 | #define YY_SHIFT_MIN (0) |
| 145612 | 146562 | #define YY_SHIFT_MAX (1858) |
| 145613 | 146563 | static const unsigned short int yy_shift_ofst[] = { |
| 145614 | 146564 | /* 0 */ 1709, 1520, 1858, 1324, 1324, 277, 1374, 1469, 1602, 1712, |
| 145615 | 146565 | /* 10 */ 1712, 1712, 273, 0, 0, 113, 1016, 1712, 1712, 1712, |
| | @@ -145629,46 +146579,47 @@ |
| 145629 | 146579 | /* 150 */ 597, 464, 474, 262, 681, 531, 531, 531, 531, 531, |
| 145630 | 146580 | /* 160 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, |
| 145631 | 146581 | /* 170 */ 531, 531, 531, 531, 531, 531, 531, 173, 485, 984, |
| 145632 | 146582 | /* 180 */ 984, 576, 485, 19, 1022, 2009, 2009, 2009, 387, 250, |
| 145633 | 146583 | /* 190 */ 250, 525, 502, 278, 552, 227, 480, 566, 531, 531, |
| 145634 | | - /* 200 */ 531, 531, 531, 531, 531, 531, 639, 531, 531, 531, |
| 145635 | | - /* 210 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 2, |
| 145636 | | - /* 220 */ 2, 2, 531, 531, 531, 531, 782, 531, 531, 531, |
| 145637 | | - /* 230 */ 744, 531, 531, 783, 531, 531, 531, 531, 531, 531, |
| 145638 | | - /* 240 */ 531, 531, 419, 682, 327, 370, 370, 370, 370, 1029, |
| 145639 | | - /* 250 */ 327, 327, 1024, 897, 856, 1109, 706, 706, 1143, 1109, |
| 145640 | | - /* 260 */ 1109, 1143, 842, 945, 1118, 1136, 1136, 1136, 706, 676, |
| 145641 | | - /* 270 */ 400, 878, 694, 1327, 1258, 1258, 1359, 1359, 1258, 1296, |
| 145642 | | - /* 280 */ 1381, 1363, 1269, 1390, 1390, 1390, 1390, 1258, 1400, 1269, |
| 145643 | | - /* 290 */ 1269, 1296, 1381, 1363, 1363, 1269, 1258, 1400, 1294, 1379, |
| 145644 | | - /* 300 */ 1258, 1400, 1425, 1258, 1400, 1258, 1400, 1425, 1353, 1353, |
| 145645 | | - /* 310 */ 1353, 1394, 1425, 1353, 1348, 1353, 1394, 1353, 1353, 1425, |
| 145646 | | - /* 320 */ 1384, 1384, 1425, 1360, 1391, 1360, 1391, 1360, 1391, 1360, |
| 145647 | | - /* 330 */ 1391, 1258, 1365, 1410, 1475, 1366, 1365, 1482, 1258, 1367, |
| 145648 | | - /* 340 */ 1366, 1378, 1389, 1269, 1521, 1527, 1534, 1534, 1549, 1549, |
| 145649 | | - /* 350 */ 1549, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, |
| 145650 | | - /* 360 */ 2009, 2009, 2009, 2009, 2009, 2009, 2009, 570, 345, 686, |
| 145651 | | - /* 370 */ 748, 50, 740, 1064, 1107, 469, 537, 1036, 1146, 1162, |
| 145652 | | - /* 380 */ 1154, 1155, 1156, 1180, 1201, 1202, 903, 1076, 1197, 1157, |
| 145653 | | - /* 390 */ 1167, 1206, 1207, 1208, 775, 1030, 1226, 1227, 1176, 1138, |
| 145654 | | - /* 400 */ 1579, 1581, 1570, 1452, 1589, 1516, 1590, 1584, 1586, 1487, |
| 145655 | | - /* 410 */ 1477, 1498, 1594, 1488, 1600, 1492, 1607, 1625, 1496, 1489, |
| 145656 | | - /* 420 */ 1509, 1569, 1599, 1500, 1587, 1588, 1591, 1592, 1518, 1538, |
| 145657 | | - /* 430 */ 1612, 1519, 1649, 1646, 1630, 1550, 1504, 1595, 1629, 1596, |
| 145658 | | - /* 440 */ 1582, 1615, 1528, 1555, 1636, 1642, 1647, 1545, 1553, 1650, |
| 145659 | | - /* 450 */ 1601, 1652, 1653, 1648, 1654, 1610, 1641, 1656, 1613, 1644, |
| 145660 | | - /* 460 */ 1659, 1541, 1661, 1532, 1663, 1664, 1662, 1667, 1669, 1670, |
| 145661 | | - /* 470 */ 1672, 1671, 1673, 1566, 1677, 1678, 1597, 1679, 1681, 1572, |
| 145662 | | - /* 480 */ 1680, 1682, 1680, 1683, 1633, 1640, 1645, 1685, 1701, 1703, |
| 145663 | | - /* 490 */ 1699, 1704, 1702, 1710, 1680, 1714, 1715, 1717, 1719, 1724, |
| 145664 | | - /* 500 */ 1728, 1713, 1741, 1731, 1732, 1733, 1734, 1736, 1737, 1729, |
| 145665 | | - /* 510 */ 1639, 1635, 1637, 1638, 1643, 1743, 1745, 1768, |
| 146584 | + /* 200 */ 531, 531, 531, 531, 531, 531, 531, 531, 639, 531, |
| 146585 | + /* 210 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, |
| 146586 | + /* 220 */ 531, 2, 2, 2, 531, 531, 531, 531, 782, 531, |
| 146587 | + /* 230 */ 531, 531, 744, 531, 531, 783, 531, 531, 531, 531, |
| 146588 | + /* 240 */ 531, 531, 531, 531, 419, 682, 327, 370, 370, 370, |
| 146589 | + /* 250 */ 370, 1029, 327, 327, 1024, 897, 856, 947, 1109, 706, |
| 146590 | + /* 260 */ 706, 1143, 1109, 1109, 1143, 842, 945, 1118, 1136, 1136, |
| 146591 | + /* 270 */ 1136, 706, 676, 400, 1047, 694, 1339, 1270, 1270, 1366, |
| 146592 | + /* 280 */ 1366, 1270, 1305, 1389, 1369, 1278, 1401, 1401, 1401, 1401, |
| 146593 | + /* 290 */ 1270, 1414, 1278, 1278, 1305, 1389, 1369, 1369, 1278, 1270, |
| 146594 | + /* 300 */ 1414, 1298, 1385, 1270, 1414, 1432, 1270, 1414, 1270, 1414, |
| 146595 | + /* 310 */ 1432, 1355, 1355, 1355, 1411, 1432, 1355, 1367, 1355, 1411, |
| 146596 | + /* 320 */ 1355, 1355, 1432, 1392, 1392, 1432, 1365, 1396, 1365, 1396, |
| 146597 | + /* 330 */ 1365, 1396, 1365, 1396, 1270, 1372, 1429, 1502, 1390, 1372, |
| 146598 | + /* 340 */ 1517, 1270, 1397, 1390, 1410, 1413, 1278, 1528, 1532, 1549, |
| 146599 | + /* 350 */ 1549, 1562, 1562, 1562, 2009, 2009, 2009, 2009, 2009, 2009, |
| 146600 | + /* 360 */ 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, |
| 146601 | + /* 370 */ 570, 345, 686, 748, 50, 740, 1064, 1107, 469, 537, |
| 146602 | + /* 380 */ 1042, 1146, 1162, 1154, 1201, 1202, 1203, 1208, 1209, 1127, |
| 146603 | + /* 390 */ 1069, 1196, 1157, 1147, 1226, 1228, 1245, 775, 868, 1246, |
| 146604 | + /* 400 */ 1247, 1191, 1151, 1585, 1589, 1587, 1456, 1600, 1527, 1601, |
| 146605 | + /* 410 */ 1595, 1596, 1492, 1484, 1506, 1603, 1495, 1608, 1496, 1614, |
| 146606 | + /* 420 */ 1635, 1508, 1497, 1521, 1580, 1606, 1505, 1592, 1593, 1597, |
| 146607 | + /* 430 */ 1598, 1530, 1547, 1619, 1524, 1654, 1651, 1636, 1553, 1510, |
| 146608 | + /* 440 */ 1594, 1634, 1599, 1588, 1623, 1535, 1564, 1642, 1649, 1652, |
| 146609 | + /* 450 */ 1552, 1560, 1653, 1609, 1655, 1656, 1657, 1659, 1612, 1658, |
| 146610 | + /* 460 */ 1660, 1616, 1648, 1664, 1550, 1668, 1538, 1670, 1671, 1669, |
| 146611 | + /* 470 */ 1673, 1675, 1676, 1678, 1680, 1679, 1574, 1683, 1690, 1610, |
| 146612 | + /* 480 */ 1682, 1695, 1586, 1698, 1691, 1698, 1693, 1643, 1661, 1646, |
| 146613 | + /* 490 */ 1686, 1710, 1711, 1714, 1716, 1703, 1715, 1698, 1727, 1728, |
| 146614 | + /* 500 */ 1729, 1730, 1731, 1732, 1734, 1743, 1736, 1737, 1740, 1744, |
| 146615 | + /* 510 */ 1738, 1746, 1739, 1645, 1640, 1644, 1647, 1650, 1749, 1751, |
| 146616 | + /* 520 */ 1772, |
| 145666 | 146617 | }; |
| 145667 | | -#define YY_REDUCE_COUNT (366) |
| 146618 | +#define YY_REDUCE_COUNT (369) |
| 145668 | 146619 | #define YY_REDUCE_MIN (-237) |
| 145669 | | -#define YY_REDUCE_MAX (1420) |
| 146620 | +#define YY_REDUCE_MAX (1424) |
| 145670 | 146621 | static const short yy_reduce_ofst[] = { |
| 145671 | 146622 | /* 0 */ -147, 171, 263, -96, 358, -144, -149, -102, 124, -156, |
| 145672 | 146623 | /* 10 */ -98, 305, 401, -57, 209, -237, 245, -94, -79, 189, |
| 145673 | 146624 | /* 20 */ 375, 490, 493, 378, 303, 539, 542, 501, 503, 554, |
| 145674 | 146625 | /* 30 */ 415, 526, 546, 557, 587, 593, 595, -234, -234, -234, |
| | @@ -145686,81 +146637,82 @@ |
| 145686 | 146637 | /* 150 */ 364, 41, 513, 509, 509, 117, 500, 789, 796, 646, |
| 145687 | 146638 | /* 160 */ 192, 291, 644, 798, 120, 807, 543, 911, 920, 652, |
| 145688 | 146639 | /* 170 */ 924, 922, 232, 698, 801, 971, 39, 220, 731, 442, |
| 145689 | 146640 | /* 180 */ 902, -199, 979, -43, 421, 896, 942, 605, -184, -126, |
| 145690 | 146641 | /* 190 */ 155, 172, 281, 304, 377, 538, 650, 690, 699, 723, |
| 145691 | | - /* 200 */ 803, 853, 919, 1088, 1091, 1092, 777, 1106, 1108, 1111, |
| 145692 | | - /* 210 */ 1112, 1115, 1116, 1117, 1120, 1121, 1122, 1123, 1124, 1077, |
| 145693 | | - /* 220 */ 1079, 1095, 1126, 1127, 1128, 1129, 1056, 1130, 1131, 1132, |
| 145694 | | - /* 230 */ 1075, 1135, 1137, 1096, 1152, 304, 1153, 1158, 1172, 1173, |
| 145695 | | - /* 240 */ 1174, 1175, 1066, 1068, 1110, 1098, 1119, 1125, 1139, 1056, |
| 145696 | | - /* 250 */ 1110, 1110, 1170, 1160, 1178, 1149, 1114, 1140, 1089, 1150, |
| 145697 | | - /* 260 */ 1151, 1133, 1177, 1171, 1189, 1161, 1181, 1195, 1159, 1142, |
| 145698 | | - /* 270 */ 1179, 1182, 1218, 1141, 1220, 1228, 1145, 1147, 1229, 1183, |
| 145699 | | - /* 280 */ 1188, 1210, 1196, 1209, 1211, 1212, 1213, 1242, 1255, 1215, |
| 145700 | | - /* 290 */ 1219, 1190, 1200, 1224, 1235, 1225, 1267, 1270, 1191, 1194, |
| 145701 | | - /* 300 */ 1272, 1274, 1259, 1279, 1281, 1283, 1285, 1266, 1273, 1276, |
| 145702 | | - /* 310 */ 1286, 1280, 1271, 1287, 1288, 1289, 1284, 1297, 1299, 1293, |
| 145703 | | - /* 320 */ 1241, 1244, 1303, 1268, 1275, 1278, 1300, 1295, 1302, 1307, |
| 145704 | | - /* 330 */ 1309, 1328, 1291, 1230, 1231, 1321, 1292, 1298, 1341, 1301, |
| 145705 | | - /* 340 */ 1325, 1326, 1329, 1332, 1375, 1382, 1393, 1398, 1396, 1401, |
| 145706 | | - /* 350 */ 1402, 1304, 1305, 1306, 1392, 1385, 1395, 1399, 1403, 1397, |
| 145707 | | - /* 360 */ 1388, 1404, 1407, 1409, 1417, 1420, 1406, |
| 146642 | + /* 200 */ 803, 839, 853, 919, 991, 1018, 1067, 1092, 951, 1111, |
| 146643 | + /* 210 */ 1112, 1115, 1116, 1117, 1119, 1120, 1121, 1122, 1123, 1124, |
| 146644 | + /* 220 */ 1125, 1012, 1096, 1097, 1128, 1129, 1130, 1131, 1070, 1135, |
| 146645 | + /* 230 */ 1137, 1152, 1077, 1153, 1155, 1114, 1156, 304, 1158, 1172, |
| 146646 | + /* 240 */ 1173, 1174, 1175, 1176, 1089, 1091, 1133, 1098, 1126, 1139, |
| 146647 | + /* 250 */ 1140, 1070, 1133, 1133, 1170, 1163, 1186, 1103, 1168, 1138, |
| 146648 | + /* 260 */ 1141, 1110, 1169, 1171, 1132, 1177, 1189, 1194, 1181, 1200, |
| 146649 | + /* 270 */ 1204, 1166, 1145, 1178, 1187, 1232, 1142, 1231, 1233, 1149, |
| 146650 | + /* 280 */ 1150, 1238, 1179, 1182, 1212, 1205, 1219, 1220, 1221, 1222, |
| 146651 | + /* 290 */ 1258, 1266, 1223, 1224, 1206, 1211, 1237, 1239, 1230, 1269, |
| 146652 | + /* 300 */ 1272, 1195, 1197, 1280, 1284, 1268, 1285, 1289, 1290, 1293, |
| 146653 | + /* 310 */ 1274, 1286, 1287, 1288, 1282, 1294, 1292, 1297, 1300, 1296, |
| 146654 | + /* 320 */ 1301, 1306, 1304, 1249, 1250, 1308, 1271, 1275, 1273, 1276, |
| 146655 | + /* 330 */ 1279, 1281, 1283, 1302, 1334, 1307, 1243, 1267, 1318, 1322, |
| 146656 | + /* 340 */ 1303, 1371, 1299, 1328, 1332, 1340, 1342, 1384, 1391, 1400, |
| 146657 | + /* 350 */ 1403, 1407, 1408, 1409, 1311, 1312, 1310, 1405, 1402, 1412, |
| 146658 | + /* 360 */ 1417, 1420, 1406, 1393, 1395, 1421, 1422, 1423, 1424, 1415, |
| 145708 | 146659 | }; |
| 145709 | 146660 | static const YYACTIONTYPE yy_default[] = { |
| 145710 | | - /* 0 */ 1486, 1486, 1486, 1335, 1118, 1224, 1118, 1118, 1118, 1335, |
| 145711 | | - /* 10 */ 1335, 1335, 1118, 1254, 1254, 1386, 1149, 1118, 1118, 1118, |
| 145712 | | - /* 20 */ 1118, 1118, 1118, 1118, 1334, 1118, 1118, 1118, 1118, 1118, |
| 145713 | | - /* 30 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1260, 1118, |
| 145714 | | - /* 40 */ 1118, 1118, 1118, 1118, 1336, 1337, 1118, 1118, 1118, 1385, |
| 145715 | | - /* 50 */ 1387, 1270, 1269, 1268, 1267, 1368, 1241, 1265, 1258, 1262, |
| 145716 | | - /* 60 */ 1330, 1331, 1329, 1333, 1337, 1336, 1118, 1261, 1301, 1315, |
| 145717 | | - /* 70 */ 1300, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145718 | | - /* 80 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145719 | | - /* 90 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145720 | | - /* 100 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145721 | | - /* 110 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1309, 1314, 1320, |
| 145722 | | - /* 120 */ 1313, 1310, 1303, 1302, 1304, 1305, 1118, 1139, 1188, 1118, |
| 145723 | | - /* 130 */ 1118, 1118, 1118, 1403, 1402, 1118, 1118, 1149, 1306, 1307, |
| 145724 | | - /* 140 */ 1317, 1316, 1393, 1442, 1441, 1118, 1118, 1118, 1118, 1118, |
| 145725 | | - /* 150 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145726 | | - /* 160 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145727 | | - /* 170 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1149, 1145, 1295, |
| 145728 | | - /* 180 */ 1294, 1412, 1145, 1248, 1118, 1398, 1224, 1215, 1118, 1118, |
| 145729 | | - /* 190 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1390, |
| 145730 | | - /* 200 */ 1388, 1118, 1350, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145731 | | - /* 210 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145732 | | - /* 220 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145733 | | - /* 230 */ 1220, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145734 | | - /* 240 */ 1118, 1436, 1118, 1363, 1202, 1220, 1220, 1220, 1220, 1222, |
| 145735 | | - /* 250 */ 1203, 1201, 1214, 1149, 1125, 1264, 1243, 1243, 1475, 1264, |
| 145736 | | - /* 260 */ 1264, 1475, 1163, 1456, 1160, 1254, 1254, 1254, 1243, 1332, |
| 145737 | | - /* 270 */ 1221, 1214, 1118, 1478, 1229, 1229, 1477, 1477, 1229, 1273, |
| 145738 | | - /* 280 */ 1279, 1191, 1264, 1197, 1197, 1197, 1197, 1229, 1136, 1264, |
| 145739 | | - /* 290 */ 1264, 1273, 1279, 1191, 1191, 1264, 1229, 1136, 1367, 1472, |
| 145740 | | - /* 300 */ 1229, 1136, 1343, 1229, 1136, 1229, 1136, 1343, 1189, 1189, |
| 145741 | | - /* 310 */ 1189, 1178, 1343, 1189, 1163, 1189, 1178, 1189, 1189, 1343, |
| 145742 | | - /* 320 */ 1347, 1347, 1343, 1247, 1242, 1247, 1242, 1247, 1242, 1247, |
| 145743 | | - /* 330 */ 1242, 1229, 1248, 1411, 1118, 1259, 1248, 1338, 1229, 1118, |
| 145744 | | - /* 340 */ 1259, 1257, 1255, 1264, 1142, 1181, 1439, 1439, 1435, 1435, |
| 145745 | | - /* 350 */ 1435, 1483, 1483, 1398, 1451, 1149, 1149, 1149, 1149, 1451, |
| 145746 | | - /* 360 */ 1165, 1165, 1149, 1149, 1149, 1149, 1451, 1118, 1118, 1118, |
| 145747 | | - /* 370 */ 1118, 1118, 1118, 1446, 1118, 1352, 1233, 1118, 1118, 1118, |
| 145748 | | - /* 380 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145749 | | - /* 390 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1284, |
| 145750 | | - /* 400 */ 1118, 1121, 1395, 1118, 1118, 1394, 1118, 1118, 1118, 1118, |
| 145751 | | - /* 410 */ 1118, 1118, 1234, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145752 | | - /* 420 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145753 | | - /* 430 */ 1118, 1474, 1118, 1118, 1118, 1118, 1118, 1118, 1366, 1365, |
| 145754 | | - /* 440 */ 1118, 1118, 1231, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145755 | | - /* 450 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145756 | | - /* 460 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145757 | | - /* 470 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145758 | | - /* 480 */ 1256, 1118, 1410, 1118, 1118, 1118, 1118, 1118, 1118, 1118, |
| 145759 | | - /* 490 */ 1424, 1249, 1118, 1118, 1465, 1118, 1118, 1118, 1118, 1118, |
| 145760 | | - /* 500 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1460, |
| 145761 | | - /* 510 */ 1205, 1286, 1118, 1285, 1289, 1118, 1130, 1118, |
| 146661 | + /* 0 */ 1492, 1492, 1492, 1340, 1123, 1229, 1123, 1123, 1123, 1340, |
| 146662 | + /* 10 */ 1340, 1340, 1123, 1259, 1259, 1391, 1154, 1123, 1123, 1123, |
| 146663 | + /* 20 */ 1123, 1123, 1123, 1123, 1339, 1123, 1123, 1123, 1123, 1123, |
| 146664 | + /* 30 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1265, 1123, |
| 146665 | + /* 40 */ 1123, 1123, 1123, 1123, 1341, 1342, 1123, 1123, 1123, 1390, |
| 146666 | + /* 50 */ 1392, 1275, 1274, 1273, 1272, 1373, 1246, 1270, 1263, 1267, |
| 146667 | + /* 60 */ 1335, 1336, 1334, 1338, 1342, 1341, 1123, 1266, 1306, 1320, |
| 146668 | + /* 70 */ 1305, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146669 | + /* 80 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146670 | + /* 90 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146671 | + /* 100 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146672 | + /* 110 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1314, 1319, 1325, |
| 146673 | + /* 120 */ 1318, 1315, 1308, 1307, 1309, 1310, 1123, 1144, 1193, 1123, |
| 146674 | + /* 130 */ 1123, 1123, 1123, 1409, 1408, 1123, 1123, 1154, 1311, 1312, |
| 146675 | + /* 140 */ 1322, 1321, 1398, 1448, 1447, 1123, 1123, 1123, 1123, 1123, |
| 146676 | + /* 150 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146677 | + /* 160 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146678 | + /* 170 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1154, 1150, 1300, |
| 146679 | + /* 180 */ 1299, 1418, 1150, 1253, 1123, 1404, 1229, 1220, 1123, 1123, |
| 146680 | + /* 190 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146681 | + /* 200 */ 1123, 1395, 1393, 1123, 1355, 1123, 1123, 1123, 1123, 1123, |
| 146682 | + /* 210 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146683 | + /* 220 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146684 | + /* 230 */ 1123, 1123, 1225, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146685 | + /* 240 */ 1123, 1123, 1123, 1442, 1123, 1368, 1207, 1225, 1225, 1225, |
| 146686 | + /* 250 */ 1225, 1227, 1208, 1206, 1219, 1154, 1130, 1484, 1269, 1248, |
| 146687 | + /* 260 */ 1248, 1481, 1269, 1269, 1481, 1168, 1462, 1165, 1259, 1259, |
| 146688 | + /* 270 */ 1259, 1248, 1337, 1226, 1219, 1123, 1484, 1234, 1234, 1483, |
| 146689 | + /* 280 */ 1483, 1234, 1278, 1284, 1196, 1269, 1202, 1202, 1202, 1202, |
| 146690 | + /* 290 */ 1234, 1141, 1269, 1269, 1278, 1284, 1196, 1196, 1269, 1234, |
| 146691 | + /* 300 */ 1141, 1372, 1478, 1234, 1141, 1348, 1234, 1141, 1234, 1141, |
| 146692 | + /* 310 */ 1348, 1194, 1194, 1194, 1183, 1348, 1194, 1168, 1194, 1183, |
| 146693 | + /* 320 */ 1194, 1194, 1348, 1352, 1352, 1348, 1252, 1247, 1252, 1247, |
| 146694 | + /* 330 */ 1252, 1247, 1252, 1247, 1234, 1253, 1417, 1123, 1264, 1253, |
| 146695 | + /* 340 */ 1343, 1234, 1123, 1264, 1262, 1260, 1269, 1147, 1186, 1445, |
| 146696 | + /* 350 */ 1445, 1441, 1441, 1441, 1489, 1489, 1404, 1457, 1154, 1154, |
| 146697 | + /* 360 */ 1154, 1154, 1457, 1170, 1170, 1154, 1154, 1154, 1154, 1457, |
| 146698 | + /* 370 */ 1123, 1123, 1123, 1123, 1123, 1123, 1452, 1123, 1357, 1238, |
| 146699 | + /* 380 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146700 | + /* 390 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146701 | + /* 400 */ 1123, 1123, 1289, 1123, 1126, 1401, 1123, 1123, 1399, 1123, |
| 146702 | + /* 410 */ 1123, 1123, 1123, 1123, 1123, 1239, 1123, 1123, 1123, 1123, |
| 146703 | + /* 420 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146704 | + /* 430 */ 1123, 1123, 1123, 1123, 1480, 1123, 1123, 1123, 1123, 1123, |
| 146705 | + /* 440 */ 1123, 1371, 1370, 1123, 1123, 1236, 1123, 1123, 1123, 1123, |
| 146706 | + /* 450 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146707 | + /* 460 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146708 | + /* 470 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146709 | + /* 480 */ 1123, 1123, 1123, 1261, 1123, 1416, 1123, 1123, 1123, 1123, |
| 146710 | + /* 490 */ 1123, 1123, 1123, 1430, 1254, 1123, 1123, 1471, 1123, 1123, |
| 146711 | + /* 500 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, |
| 146712 | + /* 510 */ 1123, 1123, 1466, 1210, 1291, 1123, 1290, 1294, 1123, 1135, |
| 146713 | + /* 520 */ 1123, |
| 145762 | 146714 | }; |
| 145763 | 146715 | /********** End of lemon-generated parsing tables *****************************/ |
| 145764 | 146716 | |
| 145765 | 146717 | /* The next table maps tokens (terminal symbols) into fallback tokens. |
| 145766 | 146718 | ** If a construct like the following: |
| | @@ -146512,102 +147464,103 @@ |
| 146512 | 147464 | /* 269 */ "cmd ::= ANALYZE", |
| 146513 | 147465 | /* 270 */ "cmd ::= ANALYZE nm dbnm", |
| 146514 | 147466 | /* 271 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", |
| 146515 | 147467 | /* 272 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", |
| 146516 | 147468 | /* 273 */ "add_column_fullname ::= fullname", |
| 146517 | | - /* 274 */ "cmd ::= create_vtab", |
| 146518 | | - /* 275 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 146519 | | - /* 276 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 146520 | | - /* 277 */ "vtabarg ::=", |
| 146521 | | - /* 278 */ "vtabargtoken ::= ANY", |
| 146522 | | - /* 279 */ "vtabargtoken ::= lp anylist RP", |
| 146523 | | - /* 280 */ "lp ::= LP", |
| 146524 | | - /* 281 */ "with ::= WITH wqlist", |
| 146525 | | - /* 282 */ "with ::= WITH RECURSIVE wqlist", |
| 146526 | | - /* 283 */ "wqlist ::= nm eidlist_opt AS LP select RP", |
| 146527 | | - /* 284 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", |
| 146528 | | - /* 285 */ "windowdefn_list ::= windowdefn", |
| 146529 | | - /* 286 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", |
| 146530 | | - /* 287 */ "windowdefn ::= nm AS window", |
| 146531 | | - /* 288 */ "window ::= LP part_opt orderby_opt frame_opt RP", |
| 146532 | | - /* 289 */ "part_opt ::= PARTITION BY nexprlist", |
| 146533 | | - /* 290 */ "part_opt ::=", |
| 146534 | | - /* 291 */ "frame_opt ::=", |
| 146535 | | - /* 292 */ "frame_opt ::= range_or_rows frame_bound_s", |
| 146536 | | - /* 293 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e", |
| 146537 | | - /* 294 */ "range_or_rows ::= RANGE", |
| 146538 | | - /* 295 */ "range_or_rows ::= ROWS", |
| 146539 | | - /* 296 */ "frame_bound_s ::= frame_bound", |
| 146540 | | - /* 297 */ "frame_bound_s ::= UNBOUNDED PRECEDING", |
| 146541 | | - /* 298 */ "frame_bound_e ::= frame_bound", |
| 146542 | | - /* 299 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", |
| 146543 | | - /* 300 */ "frame_bound ::= expr PRECEDING", |
| 146544 | | - /* 301 */ "frame_bound ::= CURRENT ROW", |
| 146545 | | - /* 302 */ "frame_bound ::= expr FOLLOWING", |
| 146546 | | - /* 303 */ "window_clause ::= WINDOW windowdefn_list", |
| 146547 | | - /* 304 */ "over_clause ::= filter_opt OVER window", |
| 146548 | | - /* 305 */ "over_clause ::= filter_opt OVER nm", |
| 146549 | | - /* 306 */ "filter_opt ::=", |
| 146550 | | - /* 307 */ "filter_opt ::= FILTER LP WHERE expr RP", |
| 146551 | | - /* 308 */ "input ::= cmdlist", |
| 146552 | | - /* 309 */ "cmdlist ::= cmdlist ecmd", |
| 146553 | | - /* 310 */ "cmdlist ::= ecmd", |
| 146554 | | - /* 311 */ "ecmd ::= SEMI", |
| 146555 | | - /* 312 */ "ecmd ::= cmdx SEMI", |
| 146556 | | - /* 313 */ "ecmd ::= explain cmdx", |
| 146557 | | - /* 314 */ "trans_opt ::=", |
| 146558 | | - /* 315 */ "trans_opt ::= TRANSACTION", |
| 146559 | | - /* 316 */ "trans_opt ::= TRANSACTION nm", |
| 146560 | | - /* 317 */ "savepoint_opt ::= SAVEPOINT", |
| 146561 | | - /* 318 */ "savepoint_opt ::=", |
| 146562 | | - /* 319 */ "cmd ::= create_table create_table_args", |
| 146563 | | - /* 320 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 146564 | | - /* 321 */ "columnlist ::= columnname carglist", |
| 146565 | | - /* 322 */ "nm ::= ID|INDEXED", |
| 146566 | | - /* 323 */ "nm ::= STRING", |
| 146567 | | - /* 324 */ "nm ::= JOIN_KW", |
| 146568 | | - /* 325 */ "typetoken ::= typename", |
| 146569 | | - /* 326 */ "typename ::= ID|STRING", |
| 146570 | | - /* 327 */ "signed ::= plus_num", |
| 146571 | | - /* 328 */ "signed ::= minus_num", |
| 146572 | | - /* 329 */ "carglist ::= carglist ccons", |
| 146573 | | - /* 330 */ "carglist ::=", |
| 146574 | | - /* 331 */ "ccons ::= NULL onconf", |
| 146575 | | - /* 332 */ "conslist_opt ::= COMMA conslist", |
| 146576 | | - /* 333 */ "conslist ::= conslist tconscomma tcons", |
| 146577 | | - /* 334 */ "conslist ::= tcons", |
| 146578 | | - /* 335 */ "tconscomma ::=", |
| 146579 | | - /* 336 */ "defer_subclause_opt ::= defer_subclause", |
| 146580 | | - /* 337 */ "resolvetype ::= raisetype", |
| 146581 | | - /* 338 */ "selectnowith ::= oneselect", |
| 146582 | | - /* 339 */ "oneselect ::= values", |
| 146583 | | - /* 340 */ "sclp ::= selcollist COMMA", |
| 146584 | | - /* 341 */ "as ::= ID|STRING", |
| 146585 | | - /* 342 */ "expr ::= term", |
| 146586 | | - /* 343 */ "likeop ::= LIKE_KW|MATCH", |
| 146587 | | - /* 344 */ "exprlist ::= nexprlist", |
| 146588 | | - /* 345 */ "nmnum ::= plus_num", |
| 146589 | | - /* 346 */ "nmnum ::= nm", |
| 146590 | | - /* 347 */ "nmnum ::= ON", |
| 146591 | | - /* 348 */ "nmnum ::= DELETE", |
| 146592 | | - /* 349 */ "nmnum ::= DEFAULT", |
| 146593 | | - /* 350 */ "plus_num ::= INTEGER|FLOAT", |
| 146594 | | - /* 351 */ "foreach_clause ::=", |
| 146595 | | - /* 352 */ "foreach_clause ::= FOR EACH ROW", |
| 146596 | | - /* 353 */ "trnm ::= nm", |
| 146597 | | - /* 354 */ "tridxby ::=", |
| 146598 | | - /* 355 */ "database_kw_opt ::= DATABASE", |
| 146599 | | - /* 356 */ "database_kw_opt ::=", |
| 146600 | | - /* 357 */ "kwcolumn_opt ::=", |
| 146601 | | - /* 358 */ "kwcolumn_opt ::= COLUMNKW", |
| 146602 | | - /* 359 */ "vtabarglist ::= vtabarg", |
| 146603 | | - /* 360 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 146604 | | - /* 361 */ "vtabarg ::= vtabarg vtabargtoken", |
| 146605 | | - /* 362 */ "anylist ::=", |
| 146606 | | - /* 363 */ "anylist ::= anylist LP anylist RP", |
| 146607 | | - /* 364 */ "anylist ::= anylist ANY", |
| 146608 | | - /* 365 */ "with ::=", |
| 147469 | + /* 274 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", |
| 147470 | + /* 275 */ "cmd ::= create_vtab", |
| 147471 | + /* 276 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 147472 | + /* 277 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 147473 | + /* 278 */ "vtabarg ::=", |
| 147474 | + /* 279 */ "vtabargtoken ::= ANY", |
| 147475 | + /* 280 */ "vtabargtoken ::= lp anylist RP", |
| 147476 | + /* 281 */ "lp ::= LP", |
| 147477 | + /* 282 */ "with ::= WITH wqlist", |
| 147478 | + /* 283 */ "with ::= WITH RECURSIVE wqlist", |
| 147479 | + /* 284 */ "wqlist ::= nm eidlist_opt AS LP select RP", |
| 147480 | + /* 285 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", |
| 147481 | + /* 286 */ "windowdefn_list ::= windowdefn", |
| 147482 | + /* 287 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", |
| 147483 | + /* 288 */ "windowdefn ::= nm AS window", |
| 147484 | + /* 289 */ "window ::= LP part_opt orderby_opt frame_opt RP", |
| 147485 | + /* 290 */ "part_opt ::= PARTITION BY nexprlist", |
| 147486 | + /* 291 */ "part_opt ::=", |
| 147487 | + /* 292 */ "frame_opt ::=", |
| 147488 | + /* 293 */ "frame_opt ::= range_or_rows frame_bound_s", |
| 147489 | + /* 294 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e", |
| 147490 | + /* 295 */ "range_or_rows ::= RANGE", |
| 147491 | + /* 296 */ "range_or_rows ::= ROWS", |
| 147492 | + /* 297 */ "frame_bound_s ::= frame_bound", |
| 147493 | + /* 298 */ "frame_bound_s ::= UNBOUNDED PRECEDING", |
| 147494 | + /* 299 */ "frame_bound_e ::= frame_bound", |
| 147495 | + /* 300 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", |
| 147496 | + /* 301 */ "frame_bound ::= expr PRECEDING", |
| 147497 | + /* 302 */ "frame_bound ::= CURRENT ROW", |
| 147498 | + /* 303 */ "frame_bound ::= expr FOLLOWING", |
| 147499 | + /* 304 */ "window_clause ::= WINDOW windowdefn_list", |
| 147500 | + /* 305 */ "over_clause ::= filter_opt OVER window", |
| 147501 | + /* 306 */ "over_clause ::= filter_opt OVER nm", |
| 147502 | + /* 307 */ "filter_opt ::=", |
| 147503 | + /* 308 */ "filter_opt ::= FILTER LP WHERE expr RP", |
| 147504 | + /* 309 */ "input ::= cmdlist", |
| 147505 | + /* 310 */ "cmdlist ::= cmdlist ecmd", |
| 147506 | + /* 311 */ "cmdlist ::= ecmd", |
| 147507 | + /* 312 */ "ecmd ::= SEMI", |
| 147508 | + /* 313 */ "ecmd ::= cmdx SEMI", |
| 147509 | + /* 314 */ "ecmd ::= explain cmdx", |
| 147510 | + /* 315 */ "trans_opt ::=", |
| 147511 | + /* 316 */ "trans_opt ::= TRANSACTION", |
| 147512 | + /* 317 */ "trans_opt ::= TRANSACTION nm", |
| 147513 | + /* 318 */ "savepoint_opt ::= SAVEPOINT", |
| 147514 | + /* 319 */ "savepoint_opt ::=", |
| 147515 | + /* 320 */ "cmd ::= create_table create_table_args", |
| 147516 | + /* 321 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 147517 | + /* 322 */ "columnlist ::= columnname carglist", |
| 147518 | + /* 323 */ "nm ::= ID|INDEXED", |
| 147519 | + /* 324 */ "nm ::= STRING", |
| 147520 | + /* 325 */ "nm ::= JOIN_KW", |
| 147521 | + /* 326 */ "typetoken ::= typename", |
| 147522 | + /* 327 */ "typename ::= ID|STRING", |
| 147523 | + /* 328 */ "signed ::= plus_num", |
| 147524 | + /* 329 */ "signed ::= minus_num", |
| 147525 | + /* 330 */ "carglist ::= carglist ccons", |
| 147526 | + /* 331 */ "carglist ::=", |
| 147527 | + /* 332 */ "ccons ::= NULL onconf", |
| 147528 | + /* 333 */ "conslist_opt ::= COMMA conslist", |
| 147529 | + /* 334 */ "conslist ::= conslist tconscomma tcons", |
| 147530 | + /* 335 */ "conslist ::= tcons", |
| 147531 | + /* 336 */ "tconscomma ::=", |
| 147532 | + /* 337 */ "defer_subclause_opt ::= defer_subclause", |
| 147533 | + /* 338 */ "resolvetype ::= raisetype", |
| 147534 | + /* 339 */ "selectnowith ::= oneselect", |
| 147535 | + /* 340 */ "oneselect ::= values", |
| 147536 | + /* 341 */ "sclp ::= selcollist COMMA", |
| 147537 | + /* 342 */ "as ::= ID|STRING", |
| 147538 | + /* 343 */ "expr ::= term", |
| 147539 | + /* 344 */ "likeop ::= LIKE_KW|MATCH", |
| 147540 | + /* 345 */ "exprlist ::= nexprlist", |
| 147541 | + /* 346 */ "nmnum ::= plus_num", |
| 147542 | + /* 347 */ "nmnum ::= nm", |
| 147543 | + /* 348 */ "nmnum ::= ON", |
| 147544 | + /* 349 */ "nmnum ::= DELETE", |
| 147545 | + /* 350 */ "nmnum ::= DEFAULT", |
| 147546 | + /* 351 */ "plus_num ::= INTEGER|FLOAT", |
| 147547 | + /* 352 */ "foreach_clause ::=", |
| 147548 | + /* 353 */ "foreach_clause ::= FOR EACH ROW", |
| 147549 | + /* 354 */ "trnm ::= nm", |
| 147550 | + /* 355 */ "tridxby ::=", |
| 147551 | + /* 356 */ "database_kw_opt ::= DATABASE", |
| 147552 | + /* 357 */ "database_kw_opt ::=", |
| 147553 | + /* 358 */ "kwcolumn_opt ::=", |
| 147554 | + /* 359 */ "kwcolumn_opt ::= COLUMNKW", |
| 147555 | + /* 360 */ "vtabarglist ::= vtabarg", |
| 147556 | + /* 361 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 147557 | + /* 362 */ "vtabarg ::= vtabarg vtabargtoken", |
| 147558 | + /* 363 */ "anylist ::=", |
| 147559 | + /* 364 */ "anylist ::= anylist LP anylist RP", |
| 147560 | + /* 365 */ "anylist ::= anylist ANY", |
| 147561 | + /* 366 */ "with ::=", |
| 146609 | 147562 | }; |
| 146610 | 147563 | #endif /* NDEBUG */ |
| 146611 | 147564 | |
| 146612 | 147565 | |
| 146613 | 147566 | #if YYSTACKDEPTH<=0 |
| | @@ -147391,102 +148344,103 @@ |
| 147391 | 148344 | { 160, -1 }, /* (269) cmd ::= ANALYZE */ |
| 147392 | 148345 | { 160, -3 }, /* (270) cmd ::= ANALYZE nm dbnm */ |
| 147393 | 148346 | { 160, -6 }, /* (271) cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 147394 | 148347 | { 160, -7 }, /* (272) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 147395 | 148348 | { 259, -1 }, /* (273) add_column_fullname ::= fullname */ |
| 147396 | | - { 160, -1 }, /* (274) cmd ::= create_vtab */ |
| 147397 | | - { 160, -4 }, /* (275) cmd ::= create_vtab LP vtabarglist RP */ |
| 147398 | | - { 261, -8 }, /* (276) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 147399 | | - { 263, 0 }, /* (277) vtabarg ::= */ |
| 147400 | | - { 264, -1 }, /* (278) vtabargtoken ::= ANY */ |
| 147401 | | - { 264, -3 }, /* (279) vtabargtoken ::= lp anylist RP */ |
| 147402 | | - { 265, -1 }, /* (280) lp ::= LP */ |
| 147403 | | - { 232, -2 }, /* (281) with ::= WITH wqlist */ |
| 147404 | | - { 232, -3 }, /* (282) with ::= WITH RECURSIVE wqlist */ |
| 147405 | | - { 208, -6 }, /* (283) wqlist ::= nm eidlist_opt AS LP select RP */ |
| 147406 | | - { 208, -8 }, /* (284) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 147407 | | - { 267, -1 }, /* (285) windowdefn_list ::= windowdefn */ |
| 147408 | | - { 267, -3 }, /* (286) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 147409 | | - { 268, -3 }, /* (287) windowdefn ::= nm AS window */ |
| 147410 | | - { 269, -5 }, /* (288) window ::= LP part_opt orderby_opt frame_opt RP */ |
| 147411 | | - { 271, -3 }, /* (289) part_opt ::= PARTITION BY nexprlist */ |
| 147412 | | - { 271, 0 }, /* (290) part_opt ::= */ |
| 147413 | | - { 270, 0 }, /* (291) frame_opt ::= */ |
| 147414 | | - { 270, -2 }, /* (292) frame_opt ::= range_or_rows frame_bound_s */ |
| 147415 | | - { 270, -5 }, /* (293) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */ |
| 147416 | | - { 273, -1 }, /* (294) range_or_rows ::= RANGE */ |
| 147417 | | - { 273, -1 }, /* (295) range_or_rows ::= ROWS */ |
| 147418 | | - { 275, -1 }, /* (296) frame_bound_s ::= frame_bound */ |
| 147419 | | - { 275, -2 }, /* (297) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 147420 | | - { 276, -1 }, /* (298) frame_bound_e ::= frame_bound */ |
| 147421 | | - { 276, -2 }, /* (299) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 147422 | | - { 274, -2 }, /* (300) frame_bound ::= expr PRECEDING */ |
| 147423 | | - { 274, -2 }, /* (301) frame_bound ::= CURRENT ROW */ |
| 147424 | | - { 274, -2 }, /* (302) frame_bound ::= expr FOLLOWING */ |
| 147425 | | - { 218, -2 }, /* (303) window_clause ::= WINDOW windowdefn_list */ |
| 147426 | | - { 237, -3 }, /* (304) over_clause ::= filter_opt OVER window */ |
| 147427 | | - { 237, -3 }, /* (305) over_clause ::= filter_opt OVER nm */ |
| 147428 | | - { 272, 0 }, /* (306) filter_opt ::= */ |
| 147429 | | - { 272, -5 }, /* (307) filter_opt ::= FILTER LP WHERE expr RP */ |
| 147430 | | - { 155, -1 }, /* (308) input ::= cmdlist */ |
| 147431 | | - { 156, -2 }, /* (309) cmdlist ::= cmdlist ecmd */ |
| 147432 | | - { 156, -1 }, /* (310) cmdlist ::= ecmd */ |
| 147433 | | - { 157, -1 }, /* (311) ecmd ::= SEMI */ |
| 147434 | | - { 157, -2 }, /* (312) ecmd ::= cmdx SEMI */ |
| 147435 | | - { 157, -2 }, /* (313) ecmd ::= explain cmdx */ |
| 147436 | | - { 162, 0 }, /* (314) trans_opt ::= */ |
| 147437 | | - { 162, -1 }, /* (315) trans_opt ::= TRANSACTION */ |
| 147438 | | - { 162, -2 }, /* (316) trans_opt ::= TRANSACTION nm */ |
| 147439 | | - { 164, -1 }, /* (317) savepoint_opt ::= SAVEPOINT */ |
| 147440 | | - { 164, 0 }, /* (318) savepoint_opt ::= */ |
| 147441 | | - { 160, -2 }, /* (319) cmd ::= create_table create_table_args */ |
| 147442 | | - { 171, -4 }, /* (320) columnlist ::= columnlist COMMA columnname carglist */ |
| 147443 | | - { 171, -2 }, /* (321) columnlist ::= columnname carglist */ |
| 147444 | | - { 163, -1 }, /* (322) nm ::= ID|INDEXED */ |
| 147445 | | - { 163, -1 }, /* (323) nm ::= STRING */ |
| 147446 | | - { 163, -1 }, /* (324) nm ::= JOIN_KW */ |
| 147447 | | - { 177, -1 }, /* (325) typetoken ::= typename */ |
| 147448 | | - { 178, -1 }, /* (326) typename ::= ID|STRING */ |
| 147449 | | - { 179, -1 }, /* (327) signed ::= plus_num */ |
| 147450 | | - { 179, -1 }, /* (328) signed ::= minus_num */ |
| 147451 | | - { 176, -2 }, /* (329) carglist ::= carglist ccons */ |
| 147452 | | - { 176, 0 }, /* (330) carglist ::= */ |
| 147453 | | - { 183, -2 }, /* (331) ccons ::= NULL onconf */ |
| 147454 | | - { 172, -2 }, /* (332) conslist_opt ::= COMMA conslist */ |
| 147455 | | - { 195, -3 }, /* (333) conslist ::= conslist tconscomma tcons */ |
| 147456 | | - { 195, -1 }, /* (334) conslist ::= tcons */ |
| 147457 | | - { 196, 0 }, /* (335) tconscomma ::= */ |
| 147458 | | - { 200, -1 }, /* (336) defer_subclause_opt ::= defer_subclause */ |
| 147459 | | - { 202, -1 }, /* (337) resolvetype ::= raisetype */ |
| 147460 | | - { 206, -1 }, /* (338) selectnowith ::= oneselect */ |
| 147461 | | - { 207, -1 }, /* (339) oneselect ::= values */ |
| 147462 | | - { 221, -2 }, /* (340) sclp ::= selcollist COMMA */ |
| 147463 | | - { 222, -1 }, /* (341) as ::= ID|STRING */ |
| 147464 | | - { 185, -1 }, /* (342) expr ::= term */ |
| 147465 | | - { 238, -1 }, /* (343) likeop ::= LIKE_KW|MATCH */ |
| 147466 | | - { 229, -1 }, /* (344) exprlist ::= nexprlist */ |
| 147467 | | - { 247, -1 }, /* (345) nmnum ::= plus_num */ |
| 147468 | | - { 247, -1 }, /* (346) nmnum ::= nm */ |
| 147469 | | - { 247, -1 }, /* (347) nmnum ::= ON */ |
| 147470 | | - { 247, -1 }, /* (348) nmnum ::= DELETE */ |
| 147471 | | - { 247, -1 }, /* (349) nmnum ::= DEFAULT */ |
| 147472 | | - { 180, -1 }, /* (350) plus_num ::= INTEGER|FLOAT */ |
| 147473 | | - { 252, 0 }, /* (351) foreach_clause ::= */ |
| 147474 | | - { 252, -3 }, /* (352) foreach_clause ::= FOR EACH ROW */ |
| 147475 | | - { 255, -1 }, /* (353) trnm ::= nm */ |
| 147476 | | - { 256, 0 }, /* (354) tridxby ::= */ |
| 147477 | | - { 257, -1 }, /* (355) database_kw_opt ::= DATABASE */ |
| 147478 | | - { 257, 0 }, /* (356) database_kw_opt ::= */ |
| 147479 | | - { 260, 0 }, /* (357) kwcolumn_opt ::= */ |
| 147480 | | - { 260, -1 }, /* (358) kwcolumn_opt ::= COLUMNKW */ |
| 147481 | | - { 262, -1 }, /* (359) vtabarglist ::= vtabarg */ |
| 147482 | | - { 262, -3 }, /* (360) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 147483 | | - { 263, -2 }, /* (361) vtabarg ::= vtabarg vtabargtoken */ |
| 147484 | | - { 266, 0 }, /* (362) anylist ::= */ |
| 147485 | | - { 266, -4 }, /* (363) anylist ::= anylist LP anylist RP */ |
| 147486 | | - { 266, -2 }, /* (364) anylist ::= anylist ANY */ |
| 147487 | | - { 232, 0 }, /* (365) with ::= */ |
| 148349 | + { 160, -8 }, /* (274) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 148350 | + { 160, -1 }, /* (275) cmd ::= create_vtab */ |
| 148351 | + { 160, -4 }, /* (276) cmd ::= create_vtab LP vtabarglist RP */ |
| 148352 | + { 261, -8 }, /* (277) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 148353 | + { 263, 0 }, /* (278) vtabarg ::= */ |
| 148354 | + { 264, -1 }, /* (279) vtabargtoken ::= ANY */ |
| 148355 | + { 264, -3 }, /* (280) vtabargtoken ::= lp anylist RP */ |
| 148356 | + { 265, -1 }, /* (281) lp ::= LP */ |
| 148357 | + { 232, -2 }, /* (282) with ::= WITH wqlist */ |
| 148358 | + { 232, -3 }, /* (283) with ::= WITH RECURSIVE wqlist */ |
| 148359 | + { 208, -6 }, /* (284) wqlist ::= nm eidlist_opt AS LP select RP */ |
| 148360 | + { 208, -8 }, /* (285) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 148361 | + { 267, -1 }, /* (286) windowdefn_list ::= windowdefn */ |
| 148362 | + { 267, -3 }, /* (287) windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 148363 | + { 268, -3 }, /* (288) windowdefn ::= nm AS window */ |
| 148364 | + { 269, -5 }, /* (289) window ::= LP part_opt orderby_opt frame_opt RP */ |
| 148365 | + { 271, -3 }, /* (290) part_opt ::= PARTITION BY nexprlist */ |
| 148366 | + { 271, 0 }, /* (291) part_opt ::= */ |
| 148367 | + { 270, 0 }, /* (292) frame_opt ::= */ |
| 148368 | + { 270, -2 }, /* (293) frame_opt ::= range_or_rows frame_bound_s */ |
| 148369 | + { 270, -5 }, /* (294) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */ |
| 148370 | + { 273, -1 }, /* (295) range_or_rows ::= RANGE */ |
| 148371 | + { 273, -1 }, /* (296) range_or_rows ::= ROWS */ |
| 148372 | + { 275, -1 }, /* (297) frame_bound_s ::= frame_bound */ |
| 148373 | + { 275, -2 }, /* (298) frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 148374 | + { 276, -1 }, /* (299) frame_bound_e ::= frame_bound */ |
| 148375 | + { 276, -2 }, /* (300) frame_bound_e ::= UNBOUNDED FOLLOWING */ |
| 148376 | + { 274, -2 }, /* (301) frame_bound ::= expr PRECEDING */ |
| 148377 | + { 274, -2 }, /* (302) frame_bound ::= CURRENT ROW */ |
| 148378 | + { 274, -2 }, /* (303) frame_bound ::= expr FOLLOWING */ |
| 148379 | + { 218, -2 }, /* (304) window_clause ::= WINDOW windowdefn_list */ |
| 148380 | + { 237, -3 }, /* (305) over_clause ::= filter_opt OVER window */ |
| 148381 | + { 237, -3 }, /* (306) over_clause ::= filter_opt OVER nm */ |
| 148382 | + { 272, 0 }, /* (307) filter_opt ::= */ |
| 148383 | + { 272, -5 }, /* (308) filter_opt ::= FILTER LP WHERE expr RP */ |
| 148384 | + { 155, -1 }, /* (309) input ::= cmdlist */ |
| 148385 | + { 156, -2 }, /* (310) cmdlist ::= cmdlist ecmd */ |
| 148386 | + { 156, -1 }, /* (311) cmdlist ::= ecmd */ |
| 148387 | + { 157, -1 }, /* (312) ecmd ::= SEMI */ |
| 148388 | + { 157, -2 }, /* (313) ecmd ::= cmdx SEMI */ |
| 148389 | + { 157, -2 }, /* (314) ecmd ::= explain cmdx */ |
| 148390 | + { 162, 0 }, /* (315) trans_opt ::= */ |
| 148391 | + { 162, -1 }, /* (316) trans_opt ::= TRANSACTION */ |
| 148392 | + { 162, -2 }, /* (317) trans_opt ::= TRANSACTION nm */ |
| 148393 | + { 164, -1 }, /* (318) savepoint_opt ::= SAVEPOINT */ |
| 148394 | + { 164, 0 }, /* (319) savepoint_opt ::= */ |
| 148395 | + { 160, -2 }, /* (320) cmd ::= create_table create_table_args */ |
| 148396 | + { 171, -4 }, /* (321) columnlist ::= columnlist COMMA columnname carglist */ |
| 148397 | + { 171, -2 }, /* (322) columnlist ::= columnname carglist */ |
| 148398 | + { 163, -1 }, /* (323) nm ::= ID|INDEXED */ |
| 148399 | + { 163, -1 }, /* (324) nm ::= STRING */ |
| 148400 | + { 163, -1 }, /* (325) nm ::= JOIN_KW */ |
| 148401 | + { 177, -1 }, /* (326) typetoken ::= typename */ |
| 148402 | + { 178, -1 }, /* (327) typename ::= ID|STRING */ |
| 148403 | + { 179, -1 }, /* (328) signed ::= plus_num */ |
| 148404 | + { 179, -1 }, /* (329) signed ::= minus_num */ |
| 148405 | + { 176, -2 }, /* (330) carglist ::= carglist ccons */ |
| 148406 | + { 176, 0 }, /* (331) carglist ::= */ |
| 148407 | + { 183, -2 }, /* (332) ccons ::= NULL onconf */ |
| 148408 | + { 172, -2 }, /* (333) conslist_opt ::= COMMA conslist */ |
| 148409 | + { 195, -3 }, /* (334) conslist ::= conslist tconscomma tcons */ |
| 148410 | + { 195, -1 }, /* (335) conslist ::= tcons */ |
| 148411 | + { 196, 0 }, /* (336) tconscomma ::= */ |
| 148412 | + { 200, -1 }, /* (337) defer_subclause_opt ::= defer_subclause */ |
| 148413 | + { 202, -1 }, /* (338) resolvetype ::= raisetype */ |
| 148414 | + { 206, -1 }, /* (339) selectnowith ::= oneselect */ |
| 148415 | + { 207, -1 }, /* (340) oneselect ::= values */ |
| 148416 | + { 221, -2 }, /* (341) sclp ::= selcollist COMMA */ |
| 148417 | + { 222, -1 }, /* (342) as ::= ID|STRING */ |
| 148418 | + { 185, -1 }, /* (343) expr ::= term */ |
| 148419 | + { 238, -1 }, /* (344) likeop ::= LIKE_KW|MATCH */ |
| 148420 | + { 229, -1 }, /* (345) exprlist ::= nexprlist */ |
| 148421 | + { 247, -1 }, /* (346) nmnum ::= plus_num */ |
| 148422 | + { 247, -1 }, /* (347) nmnum ::= nm */ |
| 148423 | + { 247, -1 }, /* (348) nmnum ::= ON */ |
| 148424 | + { 247, -1 }, /* (349) nmnum ::= DELETE */ |
| 148425 | + { 247, -1 }, /* (350) nmnum ::= DEFAULT */ |
| 148426 | + { 180, -1 }, /* (351) plus_num ::= INTEGER|FLOAT */ |
| 148427 | + { 252, 0 }, /* (352) foreach_clause ::= */ |
| 148428 | + { 252, -3 }, /* (353) foreach_clause ::= FOR EACH ROW */ |
| 148429 | + { 255, -1 }, /* (354) trnm ::= nm */ |
| 148430 | + { 256, 0 }, /* (355) tridxby ::= */ |
| 148431 | + { 257, -1 }, /* (356) database_kw_opt ::= DATABASE */ |
| 148432 | + { 257, 0 }, /* (357) database_kw_opt ::= */ |
| 148433 | + { 260, 0 }, /* (358) kwcolumn_opt ::= */ |
| 148434 | + { 260, -1 }, /* (359) kwcolumn_opt ::= COLUMNKW */ |
| 148435 | + { 262, -1 }, /* (360) vtabarglist ::= vtabarg */ |
| 148436 | + { 262, -3 }, /* (361) vtabarglist ::= vtabarglist COMMA vtabarg */ |
| 148437 | + { 263, -2 }, /* (362) vtabarg ::= vtabarg vtabargtoken */ |
| 148438 | + { 266, 0 }, /* (363) anylist ::= */ |
| 148439 | + { 266, -4 }, /* (364) anylist ::= anylist LP anylist RP */ |
| 148440 | + { 266, -2 }, /* (365) anylist ::= anylist ANY */ |
| 148441 | + { 232, 0 }, /* (366) with ::= */ |
| 147488 | 148442 | }; |
| 147489 | 148443 | |
| 147490 | 148444 | static void yy_accept(yyParser*); /* Forward Declaration */ |
| 147491 | 148445 | |
| 147492 | 148446 | /* |
| | @@ -147708,11 +148662,11 @@ |
| 147708 | 148662 | Expr *p = tokenExpr(pParse, TK_STRING, yymsp[0].minor.yy0); |
| 147709 | 148663 | if( p ){ |
| 147710 | 148664 | sqlite3ExprIdToTrueFalse(p); |
| 147711 | 148665 | testcase( p->op==TK_TRUEFALSE && sqlite3ExprTruthValue(p) ); |
| 147712 | 148666 | } |
| 147713 | | - sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n); |
| 148667 | + sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n); |
| 147714 | 148668 | } |
| 147715 | 148669 | break; |
| 147716 | 148670 | case 35: /* ccons ::= NOT NULL onconf */ |
| 147717 | 148671 | {sqlite3AddNotNull(pParse, yymsp[0].minor.yy70);} |
| 147718 | 148672 | break; |
| | @@ -148041,15 +148995,27 @@ |
| 148041 | 148995 | case 108: /* dbnm ::= */ |
| 148042 | 148996 | case 122: /* indexed_opt ::= */ yytestcase(yyruleno==122); |
| 148043 | 148997 | {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;} |
| 148044 | 148998 | break; |
| 148045 | 148999 | case 110: /* fullname ::= nm */ |
| 148046 | | - case 112: /* xfullname ::= nm */ yytestcase(yyruleno==112); |
| 148047 | | -{yymsp[0].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} |
| 149000 | +{ |
| 149001 | + yylhsminor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[0].minor.yy0,0); |
| 149002 | + if( IN_RENAME_OBJECT && yylhsminor.yy135 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy135->a[0].zName, &yymsp[0].minor.yy0); |
| 149003 | +} |
| 149004 | + yymsp[0].minor.yy135 = yylhsminor.yy135; |
| 148048 | 149005 | break; |
| 148049 | 149006 | case 111: /* fullname ::= nm DOT nm */ |
| 148050 | | - case 113: /* xfullname ::= nm DOT nm */ yytestcase(yyruleno==113); |
| 149007 | +{ |
| 149008 | + yylhsminor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); |
| 149009 | + if( IN_RENAME_OBJECT && yylhsminor.yy135 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy135->a[0].zName, &yymsp[0].minor.yy0); |
| 149010 | +} |
| 149011 | + yymsp[-2].minor.yy135 = yylhsminor.yy135; |
| 149012 | + break; |
| 149013 | + case 112: /* xfullname ::= nm */ |
| 149014 | +{yymsp[0].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} |
| 149015 | + break; |
| 149016 | + case 113: /* xfullname ::= nm DOT nm */ |
| 148051 | 149017 | {yymsp[-2].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 148052 | 149018 | break; |
| 148053 | 149019 | case 114: /* xfullname ::= nm DOT nm AS nm */ |
| 148054 | 149020 | { |
| 148055 | 149021 | yymsp[-4].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ |
| | @@ -148195,14 +149161,14 @@ |
| 148195 | 149161 | break; |
| 148196 | 149162 | case 159: /* idlist_opt ::= LP idlist RP */ |
| 148197 | 149163 | {yymsp[-2].minor.yy48 = yymsp[-1].minor.yy48;} |
| 148198 | 149164 | break; |
| 148199 | 149165 | case 160: /* idlist ::= idlist COMMA nm */ |
| 148200 | | -{yymsp[-2].minor.yy48 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy48,&yymsp[0].minor.yy0);} |
| 149166 | +{yymsp[-2].minor.yy48 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy48,&yymsp[0].minor.yy0);} |
| 148201 | 149167 | break; |
| 148202 | 149168 | case 161: /* idlist ::= nm */ |
| 148203 | | -{yymsp[0].minor.yy48 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} |
| 149169 | +{yymsp[0].minor.yy48 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} |
| 148204 | 149170 | break; |
| 148205 | 149171 | case 162: /* expr ::= LP expr RP */ |
| 148206 | 149172 | {yymsp[-2].minor.yy18 = yymsp[-1].minor.yy18;} |
| 148207 | 149173 | break; |
| 148208 | 149174 | case 163: /* expr ::= ID|INDEXED */ |
| | @@ -148211,10 +149177,14 @@ |
| 148211 | 149177 | break; |
| 148212 | 149178 | case 165: /* expr ::= nm DOT nm */ |
| 148213 | 149179 | { |
| 148214 | 149180 | Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); |
| 148215 | 149181 | Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); |
| 149182 | + if( IN_RENAME_OBJECT ){ |
| 149183 | + sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0); |
| 149184 | + sqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0); |
| 149185 | + } |
| 148216 | 149186 | yylhsminor.yy18 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); |
| 148217 | 149187 | } |
| 148218 | 149188 | yymsp[-2].minor.yy18 = yylhsminor.yy18; |
| 148219 | 149189 | break; |
| 148220 | 149190 | case 166: /* expr ::= nm DOT nm DOT nm */ |
| | @@ -148221,10 +149191,14 @@ |
| 148221 | 149191 | { |
| 148222 | 149192 | Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1); |
| 148223 | 149193 | Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); |
| 148224 | 149194 | Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); |
| 148225 | 149195 | Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3); |
| 149196 | + if( IN_RENAME_OBJECT ){ |
| 149197 | + sqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0); |
| 149198 | + sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0); |
| 149199 | + } |
| 148226 | 149200 | yylhsminor.yy18 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); |
| 148227 | 149201 | } |
| 148228 | 149202 | yymsp[-4].minor.yy18 = yylhsminor.yy18; |
| 148229 | 149203 | break; |
| 148230 | 149204 | case 167: /* term ::= NULL|FLOAT|BLOB */ |
| | @@ -148518,10 +149492,13 @@ |
| 148518 | 149492 | case 219: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 148519 | 149493 | { |
| 148520 | 149494 | sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, |
| 148521 | 149495 | sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy420, yymsp[-10].minor.yy70, |
| 148522 | 149496 | &yymsp[-11].minor.yy0, yymsp[0].minor.yy18, SQLITE_SO_ASC, yymsp[-8].minor.yy70, SQLITE_IDXTYPE_APPDEF); |
| 149497 | + if( IN_RENAME_OBJECT && pParse->pNewIndex ){ |
| 149498 | + sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0); |
| 149499 | + } |
| 148523 | 149500 | } |
| 148524 | 149501 | break; |
| 148525 | 149502 | case 220: /* uniqueflag ::= UNIQUE */ |
| 148526 | 149503 | case 260: /* raisetype ::= ABORT */ yytestcase(yyruleno==260); |
| 148527 | 149504 | {yymsp[0].minor.yy70 = OE_Abort;} |
| | @@ -148593,11 +149570,11 @@ |
| 148593 | 149570 | case 245: /* trigger_event ::= UPDATE OF idlist */ |
| 148594 | 149571 | {yymsp[-2].minor.yy34.a = TK_UPDATE; yymsp[-2].minor.yy34.b = yymsp[0].minor.yy48;} |
| 148595 | 149572 | break; |
| 148596 | 149573 | case 246: /* when_clause ::= */ |
| 148597 | 149574 | case 265: /* key_opt ::= */ yytestcase(yyruleno==265); |
| 148598 | | - case 306: /* filter_opt ::= */ yytestcase(yyruleno==306); |
| 149575 | + case 307: /* filter_opt ::= */ yytestcase(yyruleno==307); |
| 148599 | 149576 | { yymsp[1].minor.yy18 = 0; } |
| 148600 | 149577 | break; |
| 148601 | 149578 | case 247: /* when_clause ::= WHEN expr */ |
| 148602 | 149579 | case 266: /* key_opt ::= KEY expr */ yytestcase(yyruleno==266); |
| 148603 | 149580 | { yymsp[-1].minor.yy18 = yymsp[0].minor.yy18; } |
| | @@ -148636,21 +149613,21 @@ |
| 148636 | 149613 | "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " |
| 148637 | 149614 | "within triggers"); |
| 148638 | 149615 | } |
| 148639 | 149616 | break; |
| 148640 | 149617 | case 253: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ |
| 148641 | | -{yylhsminor.yy207 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy420, yymsp[-1].minor.yy18, yymsp[-6].minor.yy70, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy392);} |
| 149618 | +{yylhsminor.yy207 = sqlite3TriggerUpdateStep(pParse, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy420, yymsp[-1].minor.yy18, yymsp[-6].minor.yy70, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy392);} |
| 148642 | 149619 | yymsp[-7].minor.yy207 = yylhsminor.yy207; |
| 148643 | 149620 | break; |
| 148644 | 149621 | case 254: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ |
| 148645 | 149622 | { |
| 148646 | | - yylhsminor.yy207 = sqlite3TriggerInsertStep(pParse->db,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy48,yymsp[-2].minor.yy489,yymsp[-6].minor.yy70,yymsp[-1].minor.yy340,yymsp[-7].minor.yy392,yymsp[0].minor.yy392);/*yylhsminor.yy207-overwrites-yymsp[-6].minor.yy70*/ |
| 149623 | + yylhsminor.yy207 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy48,yymsp[-2].minor.yy489,yymsp[-6].minor.yy70,yymsp[-1].minor.yy340,yymsp[-7].minor.yy392,yymsp[0].minor.yy392);/*yylhsminor.yy207-overwrites-yymsp[-6].minor.yy70*/ |
| 148647 | 149624 | } |
| 148648 | 149625 | yymsp[-7].minor.yy207 = yylhsminor.yy207; |
| 148649 | 149626 | break; |
| 148650 | 149627 | case 255: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ |
| 148651 | | -{yylhsminor.yy207 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy18, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy392);} |
| 149628 | +{yylhsminor.yy207 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy18, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy392);} |
| 148652 | 149629 | yymsp[-5].minor.yy207 = yylhsminor.yy207; |
| 148653 | 149630 | break; |
| 148654 | 149631 | case 256: /* trigger_cmd ::= scanpt select scanpt */ |
| 148655 | 149632 | {yylhsminor.yy207 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy489, yymsp[-2].minor.yy392, yymsp[0].minor.yy392); /*yylhsminor.yy207-overwrites-yymsp[-1].minor.yy489*/} |
| 148656 | 149633 | yymsp[-2].minor.yy207 = yylhsminor.yy207; |
| | @@ -148719,134 +149696,139 @@ |
| 148719 | 149696 | { |
| 148720 | 149697 | disableLookaside(pParse); |
| 148721 | 149698 | sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy135); |
| 148722 | 149699 | } |
| 148723 | 149700 | break; |
| 148724 | | - case 274: /* cmd ::= create_vtab */ |
| 149701 | + case 274: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ |
| 149702 | +{ |
| 149703 | + sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy135, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); |
| 149704 | +} |
| 149705 | + break; |
| 149706 | + case 275: /* cmd ::= create_vtab */ |
| 148725 | 149707 | {sqlite3VtabFinishParse(pParse,0);} |
| 148726 | 149708 | break; |
| 148727 | | - case 275: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 149709 | + case 276: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 148728 | 149710 | {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} |
| 148729 | 149711 | break; |
| 148730 | | - case 276: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 149712 | + case 277: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 148731 | 149713 | { |
| 148732 | 149714 | sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy70); |
| 148733 | 149715 | } |
| 148734 | 149716 | break; |
| 148735 | | - case 277: /* vtabarg ::= */ |
| 149717 | + case 278: /* vtabarg ::= */ |
| 148736 | 149718 | {sqlite3VtabArgInit(pParse);} |
| 148737 | 149719 | break; |
| 148738 | | - case 278: /* vtabargtoken ::= ANY */ |
| 148739 | | - case 279: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==279); |
| 148740 | | - case 280: /* lp ::= LP */ yytestcase(yyruleno==280); |
| 149720 | + case 279: /* vtabargtoken ::= ANY */ |
| 149721 | + case 280: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==280); |
| 149722 | + case 281: /* lp ::= LP */ yytestcase(yyruleno==281); |
| 148741 | 149723 | {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} |
| 148742 | 149724 | break; |
| 148743 | | - case 281: /* with ::= WITH wqlist */ |
| 148744 | | - case 282: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==282); |
| 149725 | + case 282: /* with ::= WITH wqlist */ |
| 149726 | + case 283: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==283); |
| 148745 | 149727 | { sqlite3WithPush(pParse, yymsp[0].minor.yy449, 1); } |
| 148746 | 149728 | break; |
| 148747 | | - case 283: /* wqlist ::= nm eidlist_opt AS LP select RP */ |
| 149729 | + case 284: /* wqlist ::= nm eidlist_opt AS LP select RP */ |
| 148748 | 149730 | { |
| 148749 | 149731 | yymsp[-5].minor.yy449 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy420, yymsp[-1].minor.yy489); /*A-overwrites-X*/ |
| 148750 | 149732 | } |
| 148751 | 149733 | break; |
| 148752 | | - case 284: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 149734 | + case 285: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 148753 | 149735 | { |
| 148754 | 149736 | yymsp[-7].minor.yy449 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy449, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy420, yymsp[-1].minor.yy489); |
| 148755 | 149737 | } |
| 148756 | 149738 | break; |
| 148757 | | - case 285: /* windowdefn_list ::= windowdefn */ |
| 149739 | + case 286: /* windowdefn_list ::= windowdefn */ |
| 148758 | 149740 | { yylhsminor.yy327 = yymsp[0].minor.yy327; } |
| 148759 | 149741 | yymsp[0].minor.yy327 = yylhsminor.yy327; |
| 148760 | 149742 | break; |
| 148761 | | - case 286: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 149743 | + case 287: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ |
| 148762 | 149744 | { |
| 148763 | 149745 | assert( yymsp[0].minor.yy327!=0 ); |
| 148764 | 149746 | yymsp[0].minor.yy327->pNextWin = yymsp[-2].minor.yy327; |
| 148765 | 149747 | yylhsminor.yy327 = yymsp[0].minor.yy327; |
| 148766 | 149748 | } |
| 148767 | 149749 | yymsp[-2].minor.yy327 = yylhsminor.yy327; |
| 148768 | 149750 | break; |
| 148769 | | - case 287: /* windowdefn ::= nm AS window */ |
| 149751 | + case 288: /* windowdefn ::= nm AS window */ |
| 148770 | 149752 | { |
| 148771 | 149753 | if( ALWAYS(yymsp[0].minor.yy327) ){ |
| 148772 | 149754 | yymsp[0].minor.yy327->zName = sqlite3DbStrNDup(pParse->db, yymsp[-2].minor.yy0.z, yymsp[-2].minor.yy0.n); |
| 148773 | 149755 | } |
| 148774 | 149756 | yylhsminor.yy327 = yymsp[0].minor.yy327; |
| 148775 | 149757 | } |
| 148776 | 149758 | yymsp[-2].minor.yy327 = yylhsminor.yy327; |
| 148777 | 149759 | break; |
| 148778 | | - case 288: /* window ::= LP part_opt orderby_opt frame_opt RP */ |
| 149760 | + case 289: /* window ::= LP part_opt orderby_opt frame_opt RP */ |
| 148779 | 149761 | { |
| 148780 | 149762 | yymsp[-4].minor.yy327 = yymsp[-1].minor.yy327; |
| 148781 | 149763 | if( ALWAYS(yymsp[-4].minor.yy327) ){ |
| 148782 | 149764 | yymsp[-4].minor.yy327->pPartition = yymsp[-3].minor.yy420; |
| 148783 | 149765 | yymsp[-4].minor.yy327->pOrderBy = yymsp[-2].minor.yy420; |
| 148784 | 149766 | } |
| 148785 | 149767 | } |
| 148786 | 149768 | break; |
| 148787 | | - case 289: /* part_opt ::= PARTITION BY nexprlist */ |
| 149769 | + case 290: /* part_opt ::= PARTITION BY nexprlist */ |
| 148788 | 149770 | { yymsp[-2].minor.yy420 = yymsp[0].minor.yy420; } |
| 148789 | 149771 | break; |
| 148790 | | - case 290: /* part_opt ::= */ |
| 149772 | + case 291: /* part_opt ::= */ |
| 148791 | 149773 | { yymsp[1].minor.yy420 = 0; } |
| 148792 | 149774 | break; |
| 148793 | | - case 291: /* frame_opt ::= */ |
| 149775 | + case 292: /* frame_opt ::= */ |
| 148794 | 149776 | { |
| 148795 | 149777 | yymsp[1].minor.yy327 = sqlite3WindowAlloc(pParse, TK_RANGE, TK_UNBOUNDED, 0, TK_CURRENT, 0); |
| 148796 | 149778 | } |
| 148797 | 149779 | break; |
| 148798 | | - case 292: /* frame_opt ::= range_or_rows frame_bound_s */ |
| 149780 | + case 293: /* frame_opt ::= range_or_rows frame_bound_s */ |
| 148799 | 149781 | { |
| 148800 | 149782 | yylhsminor.yy327 = sqlite3WindowAlloc(pParse, yymsp[-1].minor.yy70, yymsp[0].minor.yy119.eType, yymsp[0].minor.yy119.pExpr, TK_CURRENT, 0); |
| 148801 | 149783 | } |
| 148802 | 149784 | yymsp[-1].minor.yy327 = yylhsminor.yy327; |
| 148803 | 149785 | break; |
| 148804 | | - case 293: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */ |
| 149786 | + case 294: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */ |
| 148805 | 149787 | { |
| 148806 | 149788 | yylhsminor.yy327 = sqlite3WindowAlloc(pParse, yymsp[-4].minor.yy70, yymsp[-2].minor.yy119.eType, yymsp[-2].minor.yy119.pExpr, yymsp[0].minor.yy119.eType, yymsp[0].minor.yy119.pExpr); |
| 148807 | 149789 | } |
| 148808 | 149790 | yymsp[-4].minor.yy327 = yylhsminor.yy327; |
| 148809 | 149791 | break; |
| 148810 | | - case 294: /* range_or_rows ::= RANGE */ |
| 149792 | + case 295: /* range_or_rows ::= RANGE */ |
| 148811 | 149793 | { yymsp[0].minor.yy70 = TK_RANGE; } |
| 148812 | 149794 | break; |
| 148813 | | - case 295: /* range_or_rows ::= ROWS */ |
| 149795 | + case 296: /* range_or_rows ::= ROWS */ |
| 148814 | 149796 | { yymsp[0].minor.yy70 = TK_ROWS; } |
| 148815 | 149797 | break; |
| 148816 | | - case 296: /* frame_bound_s ::= frame_bound */ |
| 148817 | | - case 298: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==298); |
| 149798 | + case 297: /* frame_bound_s ::= frame_bound */ |
| 149799 | + case 299: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==299); |
| 148818 | 149800 | { yylhsminor.yy119 = yymsp[0].minor.yy119; } |
| 148819 | 149801 | yymsp[0].minor.yy119 = yylhsminor.yy119; |
| 148820 | 149802 | break; |
| 148821 | | - case 297: /* frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 148822 | | - case 299: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==299); |
| 149803 | + case 298: /* frame_bound_s ::= UNBOUNDED PRECEDING */ |
| 149804 | + case 300: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==300); |
| 148823 | 149805 | {yymsp[-1].minor.yy119.eType = TK_UNBOUNDED; yymsp[-1].minor.yy119.pExpr = 0;} |
| 148824 | 149806 | break; |
| 148825 | | - case 300: /* frame_bound ::= expr PRECEDING */ |
| 149807 | + case 301: /* frame_bound ::= expr PRECEDING */ |
| 148826 | 149808 | { yylhsminor.yy119.eType = TK_PRECEDING; yylhsminor.yy119.pExpr = yymsp[-1].minor.yy18; } |
| 148827 | 149809 | yymsp[-1].minor.yy119 = yylhsminor.yy119; |
| 148828 | 149810 | break; |
| 148829 | | - case 301: /* frame_bound ::= CURRENT ROW */ |
| 149811 | + case 302: /* frame_bound ::= CURRENT ROW */ |
| 148830 | 149812 | { yymsp[-1].minor.yy119.eType = TK_CURRENT ; yymsp[-1].minor.yy119.pExpr = 0; } |
| 148831 | 149813 | break; |
| 148832 | | - case 302: /* frame_bound ::= expr FOLLOWING */ |
| 149814 | + case 303: /* frame_bound ::= expr FOLLOWING */ |
| 148833 | 149815 | { yylhsminor.yy119.eType = TK_FOLLOWING; yylhsminor.yy119.pExpr = yymsp[-1].minor.yy18; } |
| 148834 | 149816 | yymsp[-1].minor.yy119 = yylhsminor.yy119; |
| 148835 | 149817 | break; |
| 148836 | | - case 303: /* window_clause ::= WINDOW windowdefn_list */ |
| 149818 | + case 304: /* window_clause ::= WINDOW windowdefn_list */ |
| 148837 | 149819 | { yymsp[-1].minor.yy327 = yymsp[0].minor.yy327; } |
| 148838 | 149820 | break; |
| 148839 | | - case 304: /* over_clause ::= filter_opt OVER window */ |
| 149821 | + case 305: /* over_clause ::= filter_opt OVER window */ |
| 148840 | 149822 | { |
| 148841 | 149823 | yylhsminor.yy327 = yymsp[0].minor.yy327; |
| 148842 | 149824 | assert( yylhsminor.yy327!=0 ); |
| 148843 | 149825 | yylhsminor.yy327->pFilter = yymsp[-2].minor.yy18; |
| 148844 | 149826 | } |
| 148845 | 149827 | yymsp[-2].minor.yy327 = yylhsminor.yy327; |
| 148846 | 149828 | break; |
| 148847 | | - case 305: /* over_clause ::= filter_opt OVER nm */ |
| 149829 | + case 306: /* over_clause ::= filter_opt OVER nm */ |
| 148848 | 149830 | { |
| 148849 | 149831 | yylhsminor.yy327 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); |
| 148850 | 149832 | if( yylhsminor.yy327 ){ |
| 148851 | 149833 | yylhsminor.yy327->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); |
| 148852 | 149834 | yylhsminor.yy327->pFilter = yymsp[-2].minor.yy18; |
| | @@ -148854,72 +149836,72 @@ |
| 148854 | 149836 | sqlite3ExprDelete(pParse->db, yymsp[-2].minor.yy18); |
| 148855 | 149837 | } |
| 148856 | 149838 | } |
| 148857 | 149839 | yymsp[-2].minor.yy327 = yylhsminor.yy327; |
| 148858 | 149840 | break; |
| 148859 | | - case 307: /* filter_opt ::= FILTER LP WHERE expr RP */ |
| 149841 | + case 308: /* filter_opt ::= FILTER LP WHERE expr RP */ |
| 148860 | 149842 | { yymsp[-4].minor.yy18 = yymsp[-1].minor.yy18; } |
| 148861 | 149843 | break; |
| 148862 | 149844 | default: |
| 148863 | | - /* (308) input ::= cmdlist */ yytestcase(yyruleno==308); |
| 148864 | | - /* (309) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==309); |
| 148865 | | - /* (310) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=310); |
| 148866 | | - /* (311) ecmd ::= SEMI */ yytestcase(yyruleno==311); |
| 148867 | | - /* (312) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==312); |
| 148868 | | - /* (313) ecmd ::= explain cmdx */ yytestcase(yyruleno==313); |
| 148869 | | - /* (314) trans_opt ::= */ yytestcase(yyruleno==314); |
| 148870 | | - /* (315) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==315); |
| 148871 | | - /* (316) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==316); |
| 148872 | | - /* (317) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==317); |
| 148873 | | - /* (318) savepoint_opt ::= */ yytestcase(yyruleno==318); |
| 148874 | | - /* (319) cmd ::= create_table create_table_args */ yytestcase(yyruleno==319); |
| 148875 | | - /* (320) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==320); |
| 148876 | | - /* (321) columnlist ::= columnname carglist */ yytestcase(yyruleno==321); |
| 148877 | | - /* (322) nm ::= ID|INDEXED */ yytestcase(yyruleno==322); |
| 148878 | | - /* (323) nm ::= STRING */ yytestcase(yyruleno==323); |
| 148879 | | - /* (324) nm ::= JOIN_KW */ yytestcase(yyruleno==324); |
| 148880 | | - /* (325) typetoken ::= typename */ yytestcase(yyruleno==325); |
| 148881 | | - /* (326) typename ::= ID|STRING */ yytestcase(yyruleno==326); |
| 148882 | | - /* (327) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=327); |
| 148883 | | - /* (328) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=328); |
| 148884 | | - /* (329) carglist ::= carglist ccons */ yytestcase(yyruleno==329); |
| 148885 | | - /* (330) carglist ::= */ yytestcase(yyruleno==330); |
| 148886 | | - /* (331) ccons ::= NULL onconf */ yytestcase(yyruleno==331); |
| 148887 | | - /* (332) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==332); |
| 148888 | | - /* (333) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==333); |
| 148889 | | - /* (334) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=334); |
| 148890 | | - /* (335) tconscomma ::= */ yytestcase(yyruleno==335); |
| 148891 | | - /* (336) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=336); |
| 148892 | | - /* (337) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=337); |
| 148893 | | - /* (338) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=338); |
| 148894 | | - /* (339) oneselect ::= values */ yytestcase(yyruleno==339); |
| 148895 | | - /* (340) sclp ::= selcollist COMMA */ yytestcase(yyruleno==340); |
| 148896 | | - /* (341) as ::= ID|STRING */ yytestcase(yyruleno==341); |
| 148897 | | - /* (342) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=342); |
| 148898 | | - /* (343) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==343); |
| 148899 | | - /* (344) exprlist ::= nexprlist */ yytestcase(yyruleno==344); |
| 148900 | | - /* (345) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=345); |
| 148901 | | - /* (346) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=346); |
| 148902 | | - /* (347) nmnum ::= ON */ yytestcase(yyruleno==347); |
| 148903 | | - /* (348) nmnum ::= DELETE */ yytestcase(yyruleno==348); |
| 148904 | | - /* (349) nmnum ::= DEFAULT */ yytestcase(yyruleno==349); |
| 148905 | | - /* (350) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==350); |
| 148906 | | - /* (351) foreach_clause ::= */ yytestcase(yyruleno==351); |
| 148907 | | - /* (352) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==352); |
| 148908 | | - /* (353) trnm ::= nm */ yytestcase(yyruleno==353); |
| 148909 | | - /* (354) tridxby ::= */ yytestcase(yyruleno==354); |
| 148910 | | - /* (355) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==355); |
| 148911 | | - /* (356) database_kw_opt ::= */ yytestcase(yyruleno==356); |
| 148912 | | - /* (357) kwcolumn_opt ::= */ yytestcase(yyruleno==357); |
| 148913 | | - /* (358) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==358); |
| 148914 | | - /* (359) vtabarglist ::= vtabarg */ yytestcase(yyruleno==359); |
| 148915 | | - /* (360) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==360); |
| 148916 | | - /* (361) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==361); |
| 148917 | | - /* (362) anylist ::= */ yytestcase(yyruleno==362); |
| 148918 | | - /* (363) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==363); |
| 148919 | | - /* (364) anylist ::= anylist ANY */ yytestcase(yyruleno==364); |
| 148920 | | - /* (365) with ::= */ yytestcase(yyruleno==365); |
| 149845 | + /* (309) input ::= cmdlist */ yytestcase(yyruleno==309); |
| 149846 | + /* (310) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==310); |
| 149847 | + /* (311) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=311); |
| 149848 | + /* (312) ecmd ::= SEMI */ yytestcase(yyruleno==312); |
| 149849 | + /* (313) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==313); |
| 149850 | + /* (314) ecmd ::= explain cmdx */ yytestcase(yyruleno==314); |
| 149851 | + /* (315) trans_opt ::= */ yytestcase(yyruleno==315); |
| 149852 | + /* (316) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==316); |
| 149853 | + /* (317) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==317); |
| 149854 | + /* (318) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==318); |
| 149855 | + /* (319) savepoint_opt ::= */ yytestcase(yyruleno==319); |
| 149856 | + /* (320) cmd ::= create_table create_table_args */ yytestcase(yyruleno==320); |
| 149857 | + /* (321) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==321); |
| 149858 | + /* (322) columnlist ::= columnname carglist */ yytestcase(yyruleno==322); |
| 149859 | + /* (323) nm ::= ID|INDEXED */ yytestcase(yyruleno==323); |
| 149860 | + /* (324) nm ::= STRING */ yytestcase(yyruleno==324); |
| 149861 | + /* (325) nm ::= JOIN_KW */ yytestcase(yyruleno==325); |
| 149862 | + /* (326) typetoken ::= typename */ yytestcase(yyruleno==326); |
| 149863 | + /* (327) typename ::= ID|STRING */ yytestcase(yyruleno==327); |
| 149864 | + /* (328) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=328); |
| 149865 | + /* (329) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=329); |
| 149866 | + /* (330) carglist ::= carglist ccons */ yytestcase(yyruleno==330); |
| 149867 | + /* (331) carglist ::= */ yytestcase(yyruleno==331); |
| 149868 | + /* (332) ccons ::= NULL onconf */ yytestcase(yyruleno==332); |
| 149869 | + /* (333) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==333); |
| 149870 | + /* (334) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==334); |
| 149871 | + /* (335) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=335); |
| 149872 | + /* (336) tconscomma ::= */ yytestcase(yyruleno==336); |
| 149873 | + /* (337) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=337); |
| 149874 | + /* (338) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=338); |
| 149875 | + /* (339) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=339); |
| 149876 | + /* (340) oneselect ::= values */ yytestcase(yyruleno==340); |
| 149877 | + /* (341) sclp ::= selcollist COMMA */ yytestcase(yyruleno==341); |
| 149878 | + /* (342) as ::= ID|STRING */ yytestcase(yyruleno==342); |
| 149879 | + /* (343) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=343); |
| 149880 | + /* (344) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==344); |
| 149881 | + /* (345) exprlist ::= nexprlist */ yytestcase(yyruleno==345); |
| 149882 | + /* (346) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=346); |
| 149883 | + /* (347) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=347); |
| 149884 | + /* (348) nmnum ::= ON */ yytestcase(yyruleno==348); |
| 149885 | + /* (349) nmnum ::= DELETE */ yytestcase(yyruleno==349); |
| 149886 | + /* (350) nmnum ::= DEFAULT */ yytestcase(yyruleno==350); |
| 149887 | + /* (351) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==351); |
| 149888 | + /* (352) foreach_clause ::= */ yytestcase(yyruleno==352); |
| 149889 | + /* (353) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==353); |
| 149890 | + /* (354) trnm ::= nm */ yytestcase(yyruleno==354); |
| 149891 | + /* (355) tridxby ::= */ yytestcase(yyruleno==355); |
| 149892 | + /* (356) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==356); |
| 149893 | + /* (357) database_kw_opt ::= */ yytestcase(yyruleno==357); |
| 149894 | + /* (358) kwcolumn_opt ::= */ yytestcase(yyruleno==358); |
| 149895 | + /* (359) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==359); |
| 149896 | + /* (360) vtabarglist ::= vtabarg */ yytestcase(yyruleno==360); |
| 149897 | + /* (361) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==361); |
| 149898 | + /* (362) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==362); |
| 149899 | + /* (363) anylist ::= */ yytestcase(yyruleno==363); |
| 149900 | + /* (364) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==364); |
| 149901 | + /* (365) anylist ::= anylist ANY */ yytestcase(yyruleno==365); |
| 149902 | + /* (366) with ::= */ yytestcase(yyruleno==366); |
| 148921 | 149903 | break; |
| 148922 | 149904 | /********** End reduce actions ************************************************/ |
| 148923 | 149905 | }; |
| 148924 | 149906 | assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) ); |
| 148925 | 149907 | yygoto = yyRuleInfo[yyruleno].lhs; |
| | @@ -149738,14 +150720,12 @@ |
| 149738 | 150720 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, /* Fx */ |
| 149739 | 150721 | }; |
| 149740 | 150722 | #define IdChar(C) (((c=C)>=0x42 && sqlite3IsEbcdicIdChar[c-0x40])) |
| 149741 | 150723 | #endif |
| 149742 | 150724 | |
| 149743 | | -/* Make the IdChar function accessible from ctime.c */ |
| 149744 | | -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS |
| 150725 | +/* Make the IdChar function accessible from ctime.c and alter.c */ |
| 149745 | 150726 | SQLITE_PRIVATE int sqlite3IsIdChar(u8 c){ return IdChar(c); } |
| 149746 | | -#endif |
| 149747 | 150727 | |
| 149748 | 150728 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 149749 | 150729 | /* |
| 149750 | 150730 | ** Return the id of the next token in string (*pz). Before returning, set |
| 149751 | 150731 | ** (*pz) to point to the byte following the parsed token. |
| | @@ -150244,20 +151224,22 @@ |
| 150244 | 151224 | #endif |
| 150245 | 151225 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 150246 | 151226 | sqlite3_free(pParse->apVtabLock); |
| 150247 | 151227 | #endif |
| 150248 | 151228 | |
| 150249 | | - if( !IN_DECLARE_VTAB ){ |
| 151229 | + if( !IN_SPECIAL_PARSE ){ |
| 150250 | 151230 | /* If the pParse->declareVtab flag is set, do not delete any table |
| 150251 | 151231 | ** structure built up in pParse->pNewTable. The calling code (see vtab.c) |
| 150252 | 151232 | ** will take responsibility for freeing the Table structure. |
| 150253 | 151233 | */ |
| 150254 | 151234 | sqlite3DeleteTable(db, pParse->pNewTable); |
| 150255 | 151235 | } |
| 151236 | + if( !IN_RENAME_OBJECT ){ |
| 151237 | + sqlite3DeleteTrigger(db, pParse->pNewTrigger); |
| 151238 | + } |
| 150256 | 151239 | |
| 150257 | 151240 | if( pParse->pWithToFree ) sqlite3WithDelete(db, pParse->pWithToFree); |
| 150258 | | - sqlite3DeleteTrigger(db, pParse->pNewTrigger); |
| 150259 | 151241 | sqlite3DbFree(db, pParse->pVList); |
| 150260 | 151242 | while( pParse->pAinc ){ |
| 150261 | 151243 | AutoincInfo *p = pParse->pAinc; |
| 150262 | 151244 | pParse->pAinc = p->pNext; |
| 150263 | 151245 | sqlite3DbFreeNN(db, p); |
| | @@ -151990,10 +152972,11 @@ |
| 151990 | 152972 | int i, origRc = rc; |
| 151991 | 152973 | for(i=0; i<2 && zName==0; i++, rc &= 0xff){ |
| 151992 | 152974 | switch( rc ){ |
| 151993 | 152975 | case SQLITE_OK: zName = "SQLITE_OK"; break; |
| 151994 | 152976 | case SQLITE_ERROR: zName = "SQLITE_ERROR"; break; |
| 152977 | + case SQLITE_ERROR_SNAPSHOT: zName = "SQLITE_ERROR_SNAPSHOT"; break; |
| 151995 | 152978 | case SQLITE_INTERNAL: zName = "SQLITE_INTERNAL"; break; |
| 151996 | 152979 | case SQLITE_PERM: zName = "SQLITE_PERM"; break; |
| 151997 | 152980 | case SQLITE_ABORT: zName = "SQLITE_ABORT"; break; |
| 151998 | 152981 | case SQLITE_ABORT_ROLLBACK: zName = "SQLITE_ABORT_ROLLBACK"; break; |
| 151999 | 152982 | case SQLITE_BUSY: zName = "SQLITE_BUSY"; break; |
| | @@ -181429,11 +182412,11 @@ |
| 181429 | 182412 | s.z++; |
| 181430 | 182413 | while( geopolySkipSpace(&s)=='[' ){ |
| 181431 | 182414 | int ii = 0; |
| 181432 | 182415 | char c; |
| 181433 | 182416 | s.z++; |
| 181434 | | - if( s.nVertex<=s.nAlloc ){ |
| 182417 | + if( s.nVertex>=s.nAlloc ){ |
| 181435 | 182418 | GeoCoord *aNew; |
| 181436 | 182419 | s.nAlloc = s.nAlloc*2 + 16; |
| 181437 | 182420 | aNew = sqlite3_realloc64(s.a, s.nAlloc*sizeof(GeoCoord)*2 ); |
| 181438 | 182421 | if( aNew==0 ){ |
| 181439 | 182422 | rc = SQLITE_NOMEM; |
| | @@ -181511,11 +182494,11 @@ |
| 181511 | 182494 | ){ |
| 181512 | 182495 | const unsigned char *a = sqlite3_value_blob(pVal); |
| 181513 | 182496 | int nVertex; |
| 181514 | 182497 | nVertex = (a[1]<<16) + (a[2]<<8) + a[3]; |
| 181515 | 182498 | if( (a[0]==0 || a[0]==1) |
| 181516 | | - && (nVertex*2*sizeof(GeoCoord) + 4)==nByte |
| 182499 | + && (nVertex*2*sizeof(GeoCoord) + 4)==(unsigned int)nByte |
| 181517 | 182500 | ){ |
| 181518 | 182501 | p = sqlite3_malloc64( sizeof(*p) + (nVertex-1)*2*sizeof(GeoCoord) ); |
| 181519 | 182502 | if( p==0 ){ |
| 181520 | 182503 | if( pRc ) *pRc = SQLITE_NOMEM; |
| 181521 | 182504 | if( pCtx ) sqlite3_result_error_nomem(pCtx); |
| | @@ -182764,11 +183747,11 @@ |
| 182764 | 183747 | } |
| 182765 | 183748 | } |
| 182766 | 183749 | } |
| 182767 | 183750 | |
| 182768 | 183751 | /* Change the data */ |
| 182769 | | - if( rc==SQLITE_OK ){ |
| 183752 | + if( rc==SQLITE_OK && nData>1 ){ |
| 182770 | 183753 | sqlite3_stmt *pUp = pRtree->pWriteAux; |
| 182771 | 183754 | int jj; |
| 182772 | 183755 | int nChange = 0; |
| 182773 | 183756 | sqlite3_bind_int64(pUp, 1, cell.iRowid); |
| 182774 | 183757 | assert( pRtree->nAux>=1 ); |
| | @@ -210980,11 +211963,11 @@ |
| 210980 | 211963 | break; |
| 210981 | 211964 | |
| 210982 | 211965 | case FTS5_SAVEPOINT: |
| 210983 | 211966 | assert( p->ts.eState==1 ); |
| 210984 | 211967 | assert( iSavepoint>=0 ); |
| 210985 | | - assert( iSavepoint>p->ts.iSavepoint ); |
| 211968 | + assert( iSavepoint>=p->ts.iSavepoint ); |
| 210986 | 211969 | p->ts.iSavepoint = iSavepoint; |
| 210987 | 211970 | break; |
| 210988 | 211971 | |
| 210989 | 211972 | case FTS5_RELEASE: |
| 210990 | 211973 | assert( p->ts.eState==1 ); |
| | @@ -211905,10 +212888,17 @@ |
| 211905 | 212888 | ** fts5CursorFirstSorted() above. */ |
| 211906 | 212889 | assert( pRowidEq==0 && pRowidLe==0 && pRowidGe==0 && pRank==0 ); |
| 211907 | 212890 | assert( nVal==0 && pMatch==0 && bOrderByRank==0 && bDesc==0 ); |
| 211908 | 212891 | assert( pCsr->iLastRowid==LARGEST_INT64 ); |
| 211909 | 212892 | assert( pCsr->iFirstRowid==SMALLEST_INT64 ); |
| 212893 | + if( pTab->pSortCsr->bDesc ){ |
| 212894 | + pCsr->iLastRowid = pTab->pSortCsr->iFirstRowid; |
| 212895 | + pCsr->iFirstRowid = pTab->pSortCsr->iLastRowid; |
| 212896 | + }else{ |
| 212897 | + pCsr->iLastRowid = pTab->pSortCsr->iLastRowid; |
| 212898 | + pCsr->iFirstRowid = pTab->pSortCsr->iFirstRowid; |
| 212899 | + } |
| 211910 | 212900 | pCsr->ePlan = FTS5_PLAN_SOURCE; |
| 211911 | 212901 | pCsr->pExpr = pTab->pSortCsr->pExpr; |
| 211912 | 212902 | rc = fts5CursorFirst(pTab, pCsr, bDesc); |
| 211913 | 212903 | }else if( pMatch ){ |
| 211914 | 212904 | const char *zExpr = (const char*)sqlite3_value_text(apVal[0]); |
| | @@ -213335,11 +214325,11 @@ |
| 213335 | 214325 | int nArg, /* Number of args */ |
| 213336 | 214326 | sqlite3_value **apUnused /* Function arguments */ |
| 213337 | 214327 | ){ |
| 213338 | 214328 | assert( nArg==0 ); |
| 213339 | 214329 | UNUSED_PARAM2(nArg, apUnused); |
| 213340 | | - sqlite3_result_text(pCtx, "fts5: 2018-08-30 01:52:10 58078c0d2647a194279fa80e032670441b296ffc3acee692901faa5beca460b7", -1, SQLITE_TRANSIENT); |
| 214330 | + sqlite3_result_text(pCtx, "fts5: 2018-09-06 18:56:36 91aab32e71fcb924e24c02d5f0901f7a474760fc993a7e7436e667512cf5d3c3", -1, SQLITE_TRANSIENT); |
| 213341 | 214331 | } |
| 213342 | 214332 | |
| 213343 | 214333 | static int fts5Init(sqlite3 *db){ |
| 213344 | 214334 | static const sqlite3_module fts5Mod = { |
| 213345 | 214335 | /* iVersion */ 2, |
| | @@ -218045,12 +219035,12 @@ |
| 218045 | 219035 | } |
| 218046 | 219036 | #endif /* SQLITE_CORE */ |
| 218047 | 219037 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ |
| 218048 | 219038 | |
| 218049 | 219039 | /************** End of stmt.c ************************************************/ |
| 218050 | | -#if __LINE__!=218050 |
| 219040 | +#if __LINE__!=219040 |
| 218051 | 219041 | #undef SQLITE_SOURCE_ID |
| 218052 | | -#define SQLITE_SOURCE_ID "2018-08-30 01:52:10 58078c0d2647a194279fa80e032670441b296ffc3acee692901faa5beca4alt2" |
| 219042 | +#define SQLITE_SOURCE_ID "2018-09-06 18:56:36 91aab32e71fcb924e24c02d5f0901f7a474760fc993a7e7436e667512cf5alt2" |
| 218053 | 219043 | #endif |
| 218054 | 219044 | /* Return the source-id for this library */ |
| 218055 | 219045 | SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } |
| 218056 | 219046 | /************************** End of sqlite3.c ******************************/ |
| 218057 | 219047 | |