Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Update the built-in SQLite to the latest 3.25.0 alpha version for testing. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
48171b6618bf4823b7921296cfa8a8cf |
User & Date: | drh 2018-09-06 20:39:37.206 |
Context
2018-09-10
| ||
22:21 | Update the built-in SQLite to the first 3.25.0 release candidate. ... (check-in: ed84acb6 user: drh tags: trunk) | |
2018-09-09
| ||
17:42 | Merged in trunk improvements ... (check-in: 96b1a9ca user: wyoung tags: js-hamburger-menu) | |
2018-09-06
| ||
20:39 | Update the built-in SQLite to the latest 3.25.0 alpha version for testing. ... (check-in: 48171b66 user: drh tags: trunk) | |
03:06 | Typo fix; patch by jungleboogie in forum post ID 775e4c0771. ... (check-in: c8ef388b user: wyoung tags: trunk) | |
Changes
Changes to src/sqlite3.c.
︙ | ︙ | |||
1154 1155 1156 1157 1158 1159 1160 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.25.0" #define SQLITE_VERSION_NUMBER 3025000 | | | 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.25.0" #define SQLITE_VERSION_NUMBER 3025000 #define SQLITE_SOURCE_ID "2018-09-06 18:56:36 91aab32e71fcb924e24c02d5f0901f7a474760fc993a7e7436e667512cf5d3c3" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
︙ | ︙ | |||
1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 | ** on a per database connection basis using the ** [sqlite3_extended_result_codes()] API. Or, the extended code for ** the most recent error can be obtained using ** [sqlite3_extended_errcode()]. */ #define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8)) #define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8)) #define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8)) #define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8)) #define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8)) #define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8)) #define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8)) #define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6<<8)) #define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7<<8)) | > | 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 | ** on a per database connection basis using the ** [sqlite3_extended_result_codes()] API. Or, the extended code for ** the most recent error can be obtained using ** [sqlite3_extended_errcode()]. */ #define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8)) #define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8)) #define SQLITE_ERROR_SNAPSHOT (SQLITE_ERROR | (3<<8)) #define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8)) #define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8)) #define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8)) #define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8)) #define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8)) #define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6<<8)) #define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7<<8)) |
︙ | ︙ | |||
10082 10083 10084 10085 10086 10087 10088 | ** must have no active statements (SELECT statements that have been passed ** to sqlite3_step() but not sqlite3_reset() or sqlite3_finalize()). ** SQLITE_ERROR is returned if either of these conditions is violated, or ** if schema S does not exist, or if the snapshot object is invalid. ** ** ^A call to sqlite3_snapshot_open() will fail to open if the specified ** snapshot has been overwritten by a [checkpoint]. In this case | | | | 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 | ** must have no active statements (SELECT statements that have been passed ** to sqlite3_step() but not sqlite3_reset() or sqlite3_finalize()). ** SQLITE_ERROR is returned if either of these conditions is violated, or ** if schema S does not exist, or if the snapshot object is invalid. ** ** ^A call to sqlite3_snapshot_open() will fail to open if the specified ** snapshot has been overwritten by a [checkpoint]. In this case ** SQLITE_ERROR_SNAPSHOT is returned. ** ** If there is already a read transaction open when this function is ** invoked, then the same read transaction remains open (on the same ** database snapshot) if SQLITE_ERROR, SQLITE_BUSY or SQLITE_ERROR_SNAPSHOT ** is returned. If another error code - for example SQLITE_PROTOCOL or an ** SQLITE_IOERR error code - is returned, then the final state of the ** read transaction is undefined. If SQLITE_OK is returned, then the ** read transaction is now open on database snapshot P. ** ** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the ** database connection D does not know that the database file for |
︙ | ︙ | |||
14023 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 | typedef struct Lookaside Lookaside; typedef struct LookasideSlot LookasideSlot; typedef struct Module Module; typedef struct NameContext NameContext; typedef struct Parse Parse; typedef struct PreUpdate PreUpdate; typedef struct PrintfArguments PrintfArguments; typedef struct RowSet RowSet; typedef struct Savepoint Savepoint; typedef struct Select Select; typedef struct SQLiteThread SQLiteThread; typedef struct SelectDest SelectDest; typedef struct SrcList SrcList; typedef struct sqlite3_str StrAccum; /* Internal alias for sqlite3_str */ | > | 14024 14025 14026 14027 14028 14029 14030 14031 14032 14033 14034 14035 14036 14037 14038 | typedef struct Lookaside Lookaside; typedef struct LookasideSlot LookasideSlot; typedef struct Module Module; typedef struct NameContext NameContext; typedef struct Parse Parse; typedef struct PreUpdate PreUpdate; typedef struct PrintfArguments PrintfArguments; typedef struct RenameToken RenameToken; typedef struct RowSet RowSet; typedef struct Savepoint Savepoint; typedef struct Select Select; typedef struct SQLiteThread SQLiteThread; typedef struct SelectDest SelectDest; typedef struct SrcList SrcList; typedef struct sqlite3_str StrAccum; /* Internal alias for sqlite3_str */ |
︙ | ︙ | |||
17008 17009 17010 17011 17012 17013 17014 | tRowcnt *anDLt; /* Est. number of distinct keys less than this sample */ }; /* ** Each token coming out of the lexer is an instance of ** this structure. Tokens are also used as part of an expression. ** | | | > > | | 17010 17011 17012 17013 17014 17015 17016 17017 17018 17019 17020 17021 17022 17023 17024 17025 17026 17027 17028 | tRowcnt *anDLt; /* Est. number of distinct keys less than this sample */ }; /* ** Each token coming out of the lexer is an instance of ** this structure. Tokens are also used as part of an expression. ** ** The memory that "z" points to is owned by other objects. Take care ** that the owner of the "z" string does not deallocate the string before ** the Token goes out of scope! Very often, the "z" points to some place ** in the middle of the Parse.zSql text. But it might also point to a ** static string. */ struct Token { const char *z; /* Text of the token. Not NULL-terminated! */ unsigned int n; /* Number of characters in this token */ }; /* |
︙ | ︙ | |||
17815 17816 17817 17818 17819 17820 17821 17822 | ** first field in the recursive region. ************************************************************************/ Token sLastToken; /* The last token parsed */ ynVar nVar; /* Number of '?' variables seen in the SQL so far */ u8 iPkSortOrder; /* ASC or DESC for INTEGER PRIMARY KEY */ u8 explain; /* True if the EXPLAIN flag is found on the query */ #ifndef SQLITE_OMIT_VIRTUALTABLE | > > > < > > > > > > > > > | > > > > > > > > > > > > | 17819 17820 17821 17822 17823 17824 17825 17826 17827 17828 17829 17830 17831 17832 17833 17834 17835 17836 17837 17838 17839 17840 17841 17842 17843 17844 17845 17846 17847 17848 17849 17850 17851 17852 17853 17854 17855 17856 17857 17858 17859 17860 17861 17862 17863 17864 17865 17866 17867 17868 17869 17870 17871 17872 17873 17874 17875 17876 17877 17878 17879 17880 17881 17882 17883 17884 17885 17886 17887 17888 17889 17890 17891 17892 17893 17894 | ** first field in the recursive region. ************************************************************************/ Token sLastToken; /* The last token parsed */ ynVar nVar; /* Number of '?' variables seen in the SQL so far */ u8 iPkSortOrder; /* ASC or DESC for INTEGER PRIMARY KEY */ u8 explain; /* True if the EXPLAIN flag is found on the query */ #if !(defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_OMIT_ALTERTABLE)) u8 eParseMode; /* PARSE_MODE_XXX constant */ #endif #ifndef SQLITE_OMIT_VIRTUALTABLE int nVtabLock; /* Number of virtual tables to lock */ #endif int nHeight; /* Expression tree height of current sub-select */ #ifndef SQLITE_OMIT_EXPLAIN int addrExplain; /* Address of current OP_Explain opcode */ #endif VList *pVList; /* Mapping between variable names and numbers */ Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */ const char *zTail; /* All SQL text past the last semicolon parsed */ Table *pNewTable; /* A table being constructed by CREATE TABLE */ Index *pNewIndex; /* An index being constructed by CREATE INDEX */ Trigger *pNewTrigger; /* Trigger under construct by a CREATE TRIGGER */ const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */ #ifndef SQLITE_OMIT_VIRTUALTABLE Token sArg; /* Complete text of a module argument */ Table **apVtabLock; /* Pointer to virtual tables needing locking */ #endif Table *pZombieTab; /* List of Table objects to delete after code gen */ TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */ With *pWith; /* Current WITH clause, or NULL */ With *pWithToFree; /* Free this WITH object at the end of the parse */ #ifndef SQLITE_OMIT_ALTERTABLE RenameToken *pRename; /* Tokens subject to renaming by ALTER TABLE */ #endif }; #define PARSE_MODE_NORMAL 0 #define PARSE_MODE_DECLARE_VTAB 1 #define PARSE_MODE_RENAME_COLUMN 2 #define PARSE_MODE_RENAME_TABLE 3 /* ** Sizes and pointers of various parts of the Parse object. */ #define PARSE_HDR_SZ offsetof(Parse,aTempReg) /* Recursive part w/o aColCache*/ #define PARSE_RECURSE_SZ offsetof(Parse,sLastToken) /* Recursive part */ #define PARSE_TAIL_SZ (sizeof(Parse)-PARSE_RECURSE_SZ) /* Non-recursive part */ #define PARSE_TAIL(X) (((char*)(X))+PARSE_RECURSE_SZ) /* Pointer to tail */ /* ** Return true if currently inside an sqlite3_declare_vtab() call. */ #ifdef SQLITE_OMIT_VIRTUALTABLE #define IN_DECLARE_VTAB 0 #else #define IN_DECLARE_VTAB (pParse->eParseMode==PARSE_MODE_DECLARE_VTAB) #endif #if defined(SQLITE_OMIT_ALTERTABLE) #define IN_RENAME_OBJECT 0 #else #define IN_RENAME_OBJECT (pParse->eParseMode>=PARSE_MODE_RENAME_COLUMN) #endif #if defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_OMIT_ALTERTABLE) #define IN_SPECIAL_PARSE 0 #else #define IN_SPECIAL_PARSE (pParse->eParseMode!=PARSE_MODE_NORMAL) #endif /* ** An instance of the following structure can be declared on a stack and used ** to save the Parse.zAuthContext value so that it can be restored later. */ struct AuthContext { |
︙ | ︙ | |||
18032 18033 18034 18035 18036 18037 18038 18039 18040 18041 18042 18043 18044 18045 18046 18047 | ** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback. */ typedef struct { sqlite3 *db; /* The database being initialized */ char **pzErrMsg; /* Error message stored here */ int iDb; /* 0 for main database. 1 for TEMP, 2.. for ATTACHed */ int rc; /* Result code stored here */ } InitData; /* ** Structure containing global configuration data for the SQLite library. ** ** This structure also contains some state information. */ struct Sqlite3Config { int bMemstat; /* True to enable memory status */ | > > > > > > | 18059 18060 18061 18062 18063 18064 18065 18066 18067 18068 18069 18070 18071 18072 18073 18074 18075 18076 18077 18078 18079 18080 | ** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback. */ typedef struct { sqlite3 *db; /* The database being initialized */ char **pzErrMsg; /* Error message stored here */ int iDb; /* 0 for main database. 1 for TEMP, 2.. for ATTACHed */ int rc; /* Result code stored here */ u32 mInitFlags; /* Flags controlling error messages */ } InitData; /* ** Allowed values for mInitFlags */ #define INITFLAG_AlterTable 0x0001 /* This is a reparse after ALTER TABLE */ /* ** Structure containing global configuration data for the SQLite library. ** ** This structure also contains some state information. */ struct Sqlite3Config { int bMemstat; /* True to enable memory status */ |
︙ | ︙ | |||
18137 18138 18139 18140 18141 18142 18143 18144 18145 18146 18147 18148 18149 18150 | int *aiCol; /* array of column indexes */ struct IdxCover *pIdxCover; /* Check for index coverage */ struct IdxExprTrans *pIdxTrans; /* Convert idxed expr to column */ ExprList *pGroupBy; /* GROUP BY clause */ Select *pSelect; /* HAVING to WHERE clause ctx */ struct WindowRewrite *pRewrite; /* Window rewrite context */ struct WhereConst *pConst; /* WHERE clause constants */ } u; }; /* Forward declarations */ SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*); SQLITE_PRIVATE int sqlite3WalkExprList(Walker*, ExprList*); SQLITE_PRIVATE int sqlite3WalkSelect(Walker*, Select*); | > | 18170 18171 18172 18173 18174 18175 18176 18177 18178 18179 18180 18181 18182 18183 18184 | int *aiCol; /* array of column indexes */ struct IdxCover *pIdxCover; /* Check for index coverage */ struct IdxExprTrans *pIdxTrans; /* Convert idxed expr to column */ ExprList *pGroupBy; /* GROUP BY clause */ Select *pSelect; /* HAVING to WHERE clause ctx */ struct WindowRewrite *pRewrite; /* Window rewrite context */ struct WhereConst *pConst; /* WHERE clause constants */ struct RenameCtx *pRename; /* RENAME COLUMN context */ } u; }; /* Forward declarations */ SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*); SQLITE_PRIVATE int sqlite3WalkExprList(Walker*, ExprList*); SQLITE_PRIVATE int sqlite3WalkSelect(Walker*, Select*); |
︙ | ︙ | |||
18336 18337 18338 18339 18340 18341 18342 | # define sqlite3Isalnum(x) isalnum((unsigned char)(x)) # define sqlite3Isalpha(x) isalpha((unsigned char)(x)) # define sqlite3Isdigit(x) isdigit((unsigned char)(x)) # define sqlite3Isxdigit(x) isxdigit((unsigned char)(x)) # define sqlite3Tolower(x) tolower((unsigned char)(x)) # define sqlite3Isquote(x) ((x)=='"'||(x)=='\''||(x)=='['||(x)=='`') #endif | < < | 18370 18371 18372 18373 18374 18375 18376 18377 18378 18379 18380 18381 18382 18383 18384 | # define sqlite3Isalnum(x) isalnum((unsigned char)(x)) # define sqlite3Isalpha(x) isalpha((unsigned char)(x)) # define sqlite3Isdigit(x) isdigit((unsigned char)(x)) # define sqlite3Isxdigit(x) isxdigit((unsigned char)(x)) # define sqlite3Tolower(x) tolower((unsigned char)(x)) # define sqlite3Isquote(x) ((x)=='"'||(x)=='\''||(x)=='['||(x)=='`') #endif SQLITE_PRIVATE int sqlite3IsIdChar(u8); /* ** Internal function prototypes */ SQLITE_PRIVATE int sqlite3StrICmp(const char*,const char*); SQLITE_PRIVATE int sqlite3Strlen30(const char*); SQLITE_PRIVATE char *sqlite3ColumnType(Column*,char*); |
︙ | ︙ | |||
18503 18504 18505 18506 18507 18508 18509 18510 18511 18512 18513 18514 18515 18516 | SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList*,int); SQLITE_PRIVATE void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int); SQLITE_PRIVATE void sqlite3ExprListSetSpan(Parse*,ExprList*,const char*,const char*); SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3*, ExprList*); SQLITE_PRIVATE u32 sqlite3ExprListFlags(const ExprList*); SQLITE_PRIVATE int sqlite3Init(sqlite3*, char**); SQLITE_PRIVATE int sqlite3InitCallback(void*, int, char**, char**); SQLITE_PRIVATE void sqlite3Pragma(Parse*,Token*,Token*,Token*,int); #ifndef SQLITE_OMIT_VIRTUALTABLE SQLITE_PRIVATE Module *sqlite3PragmaVtabRegister(sqlite3*,const char *zName); #endif SQLITE_PRIVATE void sqlite3ResetAllSchemasOfConnection(sqlite3*); SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3*,int); SQLITE_PRIVATE void sqlite3CollapseDatabaseArray(sqlite3*); | > | 18535 18536 18537 18538 18539 18540 18541 18542 18543 18544 18545 18546 18547 18548 18549 | SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList*,int); SQLITE_PRIVATE void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int); SQLITE_PRIVATE void sqlite3ExprListSetSpan(Parse*,ExprList*,const char*,const char*); SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3*, ExprList*); SQLITE_PRIVATE u32 sqlite3ExprListFlags(const ExprList*); SQLITE_PRIVATE int sqlite3Init(sqlite3*, char**); SQLITE_PRIVATE int sqlite3InitCallback(void*, int, char**, char**); SQLITE_PRIVATE int sqlite3InitOne(sqlite3*, int, char**, u32); SQLITE_PRIVATE void sqlite3Pragma(Parse*,Token*,Token*,Token*,int); #ifndef SQLITE_OMIT_VIRTUALTABLE SQLITE_PRIVATE Module *sqlite3PragmaVtabRegister(sqlite3*,const char *zName); #endif SQLITE_PRIVATE void sqlite3ResetAllSchemasOfConnection(sqlite3*); SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3*,int); SQLITE_PRIVATE void sqlite3CollapseDatabaseArray(sqlite3*); |
︙ | ︙ | |||
18573 18574 18575 18576 18577 18578 18579 18580 18581 18582 18583 18584 18585 18586 18587 18588 | #if SQLITE_MAX_ATTACHED>30 SQLITE_PRIVATE int sqlite3DbMaskAllZero(yDbMask); #endif SQLITE_PRIVATE void sqlite3DropTable(Parse*, SrcList*, int, int); SQLITE_PRIVATE void sqlite3CodeDropTable(Parse*, Table*, int, int); SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3*, Table*); #ifndef SQLITE_OMIT_AUTOINCREMENT SQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse); SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse); #else # define sqlite3AutoincrementBegin(X) # define sqlite3AutoincrementEnd(X) #endif SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int, Upsert*); SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*); | > | | 18606 18607 18608 18609 18610 18611 18612 18613 18614 18615 18616 18617 18618 18619 18620 18621 18622 18623 18624 18625 18626 18627 18628 18629 18630 | #if SQLITE_MAX_ATTACHED>30 SQLITE_PRIVATE int sqlite3DbMaskAllZero(yDbMask); #endif SQLITE_PRIVATE void sqlite3DropTable(Parse*, SrcList*, int, int); SQLITE_PRIVATE void sqlite3CodeDropTable(Parse*, Table*, int, int); SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3*, Table*); SQLITE_PRIVATE void sqlite3FreeIndex(sqlite3*, Index*); #ifndef SQLITE_OMIT_AUTOINCREMENT SQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse); SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse); #else # define sqlite3AutoincrementBegin(X) # define sqlite3AutoincrementEnd(X) #endif SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int, Upsert*); SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*); SQLITE_PRIVATE IdList *sqlite3IdListAppend(Parse*, IdList*, Token*); SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*); SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int); SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(sqlite3*, SrcList*, Token*, Token*); SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*, Token*, Select*, Expr*, IdList*); SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *, SrcList *, Token *); SQLITE_PRIVATE void sqlite3SrcListFuncArgs(Parse*, SrcList*, ExprList*); |
︙ | ︙ | |||
18744 18745 18746 18747 18748 18749 18750 | SQLITE_PRIVATE void sqlite3CodeRowTrigger(Parse*, Trigger *, int, ExprList*, int, Table *, int, int, int); SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect(Parse *, Trigger *, Table *, int, int, int); void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*); SQLITE_PRIVATE void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*); SQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*, const char*,const char*); | | | | | 18778 18779 18780 18781 18782 18783 18784 18785 18786 18787 18788 18789 18790 18791 18792 18793 18794 18795 18796 18797 | SQLITE_PRIVATE void sqlite3CodeRowTrigger(Parse*, Trigger *, int, ExprList*, int, Table *, int, int, int); SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect(Parse *, Trigger *, Table *, int, int, int); void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*); SQLITE_PRIVATE void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*); SQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*, const char*,const char*); SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(Parse*,Token*, IdList*, Select*,u8,Upsert*, const char*,const char*); SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(Parse*,Token*,ExprList*, Expr*, u8, const char*,const char*); SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(Parse*,Token*, Expr*, const char*,const char*); SQLITE_PRIVATE void sqlite3DeleteTrigger(sqlite3*, Trigger*); SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*); SQLITE_PRIVATE u32 sqlite3TriggerColmask(Parse*,Trigger*,ExprList*,int,int,Table*,int); # define sqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p)) # define sqlite3IsToplevel(p) ((p)->pToplevel==0) #else |
︙ | ︙ | |||
18917 18918 18919 18920 18921 18922 18923 18924 18925 18926 18927 18928 18929 18930 18931 18932 18933 18934 18935 18936 18937 18938 18939 18940 18941 18942 18943 18944 18945 | #ifdef VDBE_PROFILE SQLITE_PRIVATE sqlite3_uint64 sqlite3NProfileCnt; #endif SQLITE_PRIVATE void sqlite3RootPageMoved(sqlite3*, int, int, int); SQLITE_PRIVATE void sqlite3Reindex(Parse*, Token*, Token*); SQLITE_PRIVATE void sqlite3AlterFunctions(void); SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*); SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *); SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...); SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int); SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr *, int, int); SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*); SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p); SQLITE_PRIVATE int sqlite3MatchSpanName(const char*, const char*, const char*, const char*); SQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*); SQLITE_PRIVATE int sqlite3ResolveExprListNames(NameContext*, ExprList*); SQLITE_PRIVATE void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*); SQLITE_PRIVATE void sqlite3ResolveSelfReference(Parse*,Table*,int,Expr*,ExprList*); SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*); SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int); SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *); SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *); SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*); SQLITE_PRIVATE char sqlite3AffinityType(const char*, Column*); SQLITE_PRIVATE void sqlite3Analyze(Parse*, Token*, Token*); SQLITE_PRIVATE int sqlite3InvokeBusyHandler(BusyHandler*, sqlite3_file*); SQLITE_PRIVATE int sqlite3FindDb(sqlite3*, Token*); SQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *, const char *); SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3*,int iDB); | > > > > | 18951 18952 18953 18954 18955 18956 18957 18958 18959 18960 18961 18962 18963 18964 18965 18966 18967 18968 18969 18970 18971 18972 18973 18974 18975 18976 18977 18978 18979 18980 18981 18982 18983 | #ifdef VDBE_PROFILE SQLITE_PRIVATE sqlite3_uint64 sqlite3NProfileCnt; #endif SQLITE_PRIVATE void sqlite3RootPageMoved(sqlite3*, int, int, int); SQLITE_PRIVATE void sqlite3Reindex(Parse*, Token*, Token*); SQLITE_PRIVATE void sqlite3AlterFunctions(void); SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*); SQLITE_PRIVATE void sqlite3AlterRenameColumn(Parse*, SrcList*, Token*, Token*); SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *); SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...); SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*, int); SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr *, int, int); SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*); SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p); SQLITE_PRIVATE int sqlite3MatchSpanName(const char*, const char*, const char*, const char*); SQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*); SQLITE_PRIVATE int sqlite3ResolveExprListNames(NameContext*, ExprList*); SQLITE_PRIVATE void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*); SQLITE_PRIVATE void sqlite3ResolveSelfReference(Parse*,Table*,int,Expr*,ExprList*); SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*); SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int); SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *); SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *); SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse*, void*, Token*); SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse*, void *pTo, void *pFrom); SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse*, Expr*); SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*); SQLITE_PRIVATE char sqlite3AffinityType(const char*, Column*); SQLITE_PRIVATE void sqlite3Analyze(Parse*, Token*, Token*); SQLITE_PRIVATE int sqlite3InvokeBusyHandler(BusyHandler*, sqlite3_file*); SQLITE_PRIVATE int sqlite3FindDb(sqlite3*, Token*); SQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *, const char *); SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3*,int iDB); |
︙ | ︙ | |||
51026 51027 51028 51029 51030 51031 51032 51033 | /* ** Return a pointer to a human readable string in a static buffer ** containing the state of the Pager object passed as an argument. This ** is intended to be used within debuggers. For example, as an alternative ** to "print *pPager" in gdb: ** ** (gdb) printf "%s", print_pager_state(pPager) */ | > > > > | | 51064 51065 51066 51067 51068 51069 51070 51071 51072 51073 51074 51075 51076 51077 51078 51079 51080 51081 51082 51083 | /* ** Return a pointer to a human readable string in a static buffer ** containing the state of the Pager object passed as an argument. This ** is intended to be used within debuggers. For example, as an alternative ** to "print *pPager" in gdb: ** ** (gdb) printf "%s", print_pager_state(pPager) ** ** This routine has external linkage in order to suppress compiler warnings ** about an unused function. It is enclosed within SQLITE_DEBUG and so does ** not appear in normal builds. */ char *print_pager_state(Pager *p){ static char zRet[1024]; sqlite3_snprintf(1024, zRet, "Filename: %s\n" "State: %s errCode=%d\n" "Lock: %s\n" "Locking mode: locking_mode=%s\n" |
︙ | ︙ | |||
57306 57307 57308 57309 57310 57311 57312 | ** ** * Temporary databases cannot have _WAL journalmode. ** ** The returned indicate the current (possibly updated) journal-mode. */ SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){ u8 eOld = pPager->journalMode; /* Prior journalmode */ | < < < < < < < | 57348 57349 57350 57351 57352 57353 57354 57355 57356 57357 57358 57359 57360 57361 | ** ** * Temporary databases cannot have _WAL journalmode. ** ** The returned indicate the current (possibly updated) journal-mode. */ SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){ u8 eOld = pPager->journalMode; /* Prior journalmode */ /* The eMode parameter is always valid */ assert( eMode==PAGER_JOURNALMODE_DELETE || eMode==PAGER_JOURNALMODE_TRUNCATE || eMode==PAGER_JOURNALMODE_PERSIST || eMode==PAGER_JOURNALMODE_OFF || eMode==PAGER_JOURNALMODE_WAL |
︙ | ︙ | |||
57995 57996 57997 57998 57999 58000 58001 58002 58003 58004 58005 58006 58007 58008 | #if defined(SQLITE_TEST) && defined(SQLITE_DEBUG) SQLITE_PRIVATE int sqlite3WalTrace = 0; # define WALTRACE(X) if(sqlite3WalTrace) sqlite3DebugPrintf X #else # define WALTRACE(X) #endif /* ** The maximum (and only) versions of the wal and wal-index formats ** that may be interpreted by this version of SQLite. ** ** If a client begins recovering a WAL file and finds that (a) the checksum ** values in the wal-header are correct and (b) the version field is not ** WAL_MAX_VERSION, recovery fails and SQLite returns SQLITE_CANTOPEN. | > > > > > > > > > > > > | 58030 58031 58032 58033 58034 58035 58036 58037 58038 58039 58040 58041 58042 58043 58044 58045 58046 58047 58048 58049 58050 58051 58052 58053 58054 58055 | #if defined(SQLITE_TEST) && defined(SQLITE_DEBUG) SQLITE_PRIVATE int sqlite3WalTrace = 0; # define WALTRACE(X) if(sqlite3WalTrace) sqlite3DebugPrintf X #else # define WALTRACE(X) #endif /* ** WAL mode depends on atomic aligned 32-bit loads and stores in a few ** places. The following macros try to make this explicit. */ #if GCC_VESRION>=5004000 # define AtomicLoad(PTR) __atomic_load_n((PTR),__ATOMIC_RELAXED) # define AtomicStore(PTR,VAL) __atomic_store_n((PTR),(VAL),__ATOMIC_RELAXED) #else # define AtomicLoad(PTR) (*(PTR)) # define AtomicStore(PTR,VAL) (*(PTR) = (VAL)) #endif /* ** The maximum (and only) versions of the wal and wal-index formats ** that may be interpreted by this version of SQLite. ** ** If a client begins recovering a WAL file and finds that (a) the checksum ** values in the wal-header are correct and (b) the version field is not ** WAL_MAX_VERSION, recovery fails and SQLite returns SQLITE_CANTOPEN. |
︙ | ︙ | |||
60292 60293 60294 60295 60296 60297 60298 | mxFrame = pWal->hdr.mxFrame; #ifdef SQLITE_ENABLE_SNAPSHOT if( pWal->pSnapshot && pWal->pSnapshot->mxFrame<mxFrame ){ mxFrame = pWal->pSnapshot->mxFrame; } #endif for(i=1; i<WAL_NREADER; i++){ | | | | 60339 60340 60341 60342 60343 60344 60345 60346 60347 60348 60349 60350 60351 60352 60353 60354 60355 60356 60357 60358 60359 60360 60361 60362 60363 60364 60365 60366 | mxFrame = pWal->hdr.mxFrame; #ifdef SQLITE_ENABLE_SNAPSHOT if( pWal->pSnapshot && pWal->pSnapshot->mxFrame<mxFrame ){ mxFrame = pWal->pSnapshot->mxFrame; } #endif for(i=1; i<WAL_NREADER; i++){ u32 thisMark = AtomicLoad(pInfo->aReadMark+i); if( mxReadMark<=thisMark && thisMark<=mxFrame ){ assert( thisMark!=READMARK_NOT_USED ); mxReadMark = thisMark; mxI = i; } } if( (pWal->readOnly & WAL_SHM_RDONLY)==0 && (mxReadMark<mxFrame || mxI==0) ){ for(i=1; i<WAL_NREADER; i++){ rc = walLockExclusive(pWal, WAL_READ_LOCK(i), 1); if( rc==SQLITE_OK ){ mxReadMark = AtomicStore(pInfo->aReadMark+i,mxFrame); mxI = i; walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1); break; }else if( rc!=SQLITE_BUSY ){ return rc; } } |
︙ | ︙ | |||
60357 60358 60359 60360 60361 60362 60363 | ** A) on the basis that there is a newer version (version B) of the same ** page later in the wal file. But if version B happens to like past ** frame pWal->hdr.mxFrame - then the client would incorrectly assume ** that it can read version A from the database file. However, since ** we can guarantee that the checkpointer that set nBackfill could not ** see any pages past pWal->hdr.mxFrame, this problem does not come up. */ | | | | 60404 60405 60406 60407 60408 60409 60410 60411 60412 60413 60414 60415 60416 60417 60418 60419 60420 | ** A) on the basis that there is a newer version (version B) of the same ** page later in the wal file. But if version B happens to like past ** frame pWal->hdr.mxFrame - then the client would incorrectly assume ** that it can read version A from the database file. However, since ** we can guarantee that the checkpointer that set nBackfill could not ** see any pages past pWal->hdr.mxFrame, this problem does not come up. */ pWal->minFrame = AtomicLoad(&pInfo->nBackfill)+1; walShmBarrier(pWal); if( AtomicLoad(pInfo->aReadMark+mxI)!=mxReadMark || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) ){ walUnlockShared(pWal, WAL_READ_LOCK(mxI)); return WAL_RETRY; }else{ assert( mxReadMark<=pWal->hdr.mxFrame ); pWal->readLock = (i16)mxI; |
︙ | ︙ | |||
60520 60521 60522 60523 60524 60525 60526 | */ rc = walLockShared(pWal, WAL_CKPT_LOCK); if( rc==SQLITE_OK ){ /* Check that the wal file has not been wrapped. Assuming that it has ** not, also check that no checkpointer has attempted to checkpoint any ** frames beyond pSnapshot->mxFrame. If either of these conditions are | | | | 60567 60568 60569 60570 60571 60572 60573 60574 60575 60576 60577 60578 60579 60580 60581 60582 60583 60584 60585 60586 60587 60588 60589 60590 60591 | */ rc = walLockShared(pWal, WAL_CKPT_LOCK); if( rc==SQLITE_OK ){ /* Check that the wal file has not been wrapped. Assuming that it has ** not, also check that no checkpointer has attempted to checkpoint any ** frames beyond pSnapshot->mxFrame. If either of these conditions are ** true, return SQLITE_ERROR_SNAPSHOT. Otherwise, overwrite pWal->hdr ** with *pSnapshot and set *pChanged as appropriate for opening the ** snapshot. */ if( !memcmp(pSnapshot->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt)) && pSnapshot->mxFrame>=pInfo->nBackfillAttempted ){ assert( pWal->readLock>0 ); memcpy(&pWal->hdr, pSnapshot, sizeof(WalIndexHdr)); *pChanged = bChanged; }else{ rc = SQLITE_ERROR_SNAPSHOT; } /* Release the shared CKPT lock obtained above. */ walUnlockShared(pWal, WAL_CKPT_LOCK); pWal->minFrame = 1; } |
︙ | ︙ | |||
61527 61528 61529 61530 61531 61532 61533 | int rc; rc = walLockShared(pWal, WAL_CKPT_LOCK); if( rc==SQLITE_OK ){ WalIndexHdr *pNew = (WalIndexHdr*)pSnapshot; if( memcmp(pNew->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt)) || pNew->mxFrame<walCkptInfo(pWal)->nBackfillAttempted ){ | | | 61574 61575 61576 61577 61578 61579 61580 61581 61582 61583 61584 61585 61586 61587 61588 | int rc; rc = walLockShared(pWal, WAL_CKPT_LOCK); if( rc==SQLITE_OK ){ WalIndexHdr *pNew = (WalIndexHdr*)pSnapshot; if( memcmp(pNew->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt)) || pNew->mxFrame<walCkptInfo(pWal)->nBackfillAttempted ){ rc = SQLITE_ERROR_SNAPSHOT; walUnlockShared(pWal, WAL_CKPT_LOCK); } } return rc; } /* |
︙ | ︙ | |||
77143 77144 77145 77146 77147 77148 77149 | ** to 6.6 percent. The test case is inserting 1000 rows into a table ** with no indexes using a single prepared INSERT statement, bind() ** and reset(). Inserts are grouped into a transaction. */ testcase( p->flags & MEM_Agg ); testcase( p->flags & MEM_Dyn ); testcase( p->xDel==sqlite3VdbeFrameMemDel ); | < | 77190 77191 77192 77193 77194 77195 77196 77197 77198 77199 77200 77201 77202 77203 | ** to 6.6 percent. The test case is inserting 1000 rows into a table ** with no indexes using a single prepared INSERT statement, bind() ** and reset(). Inserts are grouped into a transaction. */ testcase( p->flags & MEM_Agg ); testcase( p->flags & MEM_Dyn ); testcase( p->xDel==sqlite3VdbeFrameMemDel ); if( p->flags&(MEM_Agg|MEM_Dyn) ){ sqlite3VdbeMemRelease(p); }else if( p->szMalloc ){ sqlite3DbFreeNN(db, p->zMalloc); p->szMalloc = 0; } |
︙ | ︙ | |||
88317 88318 88319 88320 88321 88322 88323 | if( rc ) goto abort_due_to_error; break; } /* Opcode: ParseSchema P1 * * P4 * ** ** Read and parse all entries from the SQLITE_MASTER table of database P1 | | > | 88363 88364 88365 88366 88367 88368 88369 88370 88371 88372 88373 88374 88375 88376 88377 88378 | if( rc ) goto abort_due_to_error; break; } /* Opcode: ParseSchema P1 * * P4 * ** ** Read and parse all entries from the SQLITE_MASTER table of database P1 ** that match the WHERE clause P4. If P4 is a NULL pointer, then the ** entire schema for P1 is reparsed. ** ** This opcode invokes the parser to create a new virtual machine, ** then runs the new virtual machine. It is thus a re-entrant opcode. */ case OP_ParseSchema: { int iDb; const char *zMaster; |
︙ | ︙ | |||
88341 88342 88343 88344 88345 88346 88347 | assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) ); } #endif iDb = pOp->p1; assert( iDb>=0 && iDb<db->nDb ); assert( DbHasProperty(db, iDb, DB_SchemaLoaded) ); | | > > > > > > > > > > | 88388 88389 88390 88391 88392 88393 88394 88395 88396 88397 88398 88399 88400 88401 88402 88403 88404 88405 88406 88407 88408 88409 88410 88411 88412 | assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) ); } #endif iDb = pOp->p1; assert( iDb>=0 && iDb<db->nDb ); assert( DbHasProperty(db, iDb, DB_SchemaLoaded) ); #ifndef SQLITE_OMIT_ALTERTABLE if( pOp->p4.z==0 ){ sqlite3SchemaClear(db->aDb[iDb].pSchema); db->mDbFlags &= ~DBFLAG_SchemaKnownOk; rc = sqlite3InitOne(db, iDb, &p->zErrMsg, INITFLAG_AlterTable); db->mDbFlags |= DBFLAG_SchemaChange; p->expired = 0; }else #endif { zMaster = MASTER_NAME; initData.db = db; initData.iDb = pOp->p1; initData.pzErrMsg = &p->zErrMsg; zSql = sqlite3MPrintf(db, "SELECT name, rootpage, sql FROM '%q'.%s WHERE %s ORDER BY rowid", db->aDb[iDb].zDbSName, zMaster, pOp->p4.z); |
︙ | ︙ | |||
94299 94300 94301 94302 94303 94304 94305 94306 94307 94308 94309 94310 94311 94312 | } if( zTab ){ const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName; assert( zTabName!=0 ); if( sqlite3StrICmp(zTabName, zTab)!=0 ){ continue; } } if( 0==(cntTab++) ){ pMatch = pItem; } for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){ if( sqlite3StrICmp(pCol->zName, zCol)==0 ){ /* If there has been exactly one prior match and this match | > > > | 94356 94357 94358 94359 94360 94361 94362 94363 94364 94365 94366 94367 94368 94369 94370 94371 94372 | } if( zTab ){ const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName; assert( zTabName!=0 ); if( sqlite3StrICmp(zTabName, zTab)!=0 ){ continue; } if( IN_RENAME_OBJECT && pItem->zAlias ){ sqlite3RenameTokenRemap(pParse, 0, (void*)&pExpr->pTab); } } if( 0==(cntTab++) ){ pMatch = pItem; } for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){ if( sqlite3StrICmp(pCol->zName, zCol)==0 ){ /* If there has been exactly one prior match and this match |
︙ | ︙ | |||
94384 94385 94386 94387 94388 94389 94390 | iCol = -1; } if( iCol<pTab->nCol ){ cnt++; #ifndef SQLITE_OMIT_UPSERT if( pExpr->iTable==2 ){ testcase( iCol==(-1) ); | > > > > > | | | > | 94444 94445 94446 94447 94448 94449 94450 94451 94452 94453 94454 94455 94456 94457 94458 94459 94460 94461 94462 94463 94464 94465 94466 | iCol = -1; } if( iCol<pTab->nCol ){ cnt++; #ifndef SQLITE_OMIT_UPSERT if( pExpr->iTable==2 ){ testcase( iCol==(-1) ); if( IN_RENAME_OBJECT ){ pExpr->iColumn = iCol; pExpr->pTab = pTab; eNewExprOp = TK_COLUMN; }else{ pExpr->iTable = pNC->uNC.pUpsert->regData + iCol; eNewExprOp = TK_REGISTER; ExprSetProperty(pExpr, EP_Alias); } }else #endif /* SQLITE_OMIT_UPSERT */ { #ifndef SQLITE_OMIT_TRIGGER if( iCol<0 ){ pExpr->affinity = SQLITE_AFF_INTEGER; }else if( pExpr->iTable==0 ){ |
︙ | ︙ | |||
94471 94472 94473 94474 94475 94476 94477 94478 94479 94480 94481 94482 94483 94484 | sqlite3ErrorMsg(pParse, "row value misused"); return WRC_Abort; } resolveAlias(pParse, pEList, j, pExpr, "", nSubquery); cnt = 1; pMatch = 0; assert( zTab==0 && zDb==0 ); goto lookupname_end; } } } /* Advance to the next name context. The loop will exit when either ** we have a match (cnt>0) or when we run out of name contexts. | > > > | 94537 94538 94539 94540 94541 94542 94543 94544 94545 94546 94547 94548 94549 94550 94551 94552 94553 | sqlite3ErrorMsg(pParse, "row value misused"); return WRC_Abort; } resolveAlias(pParse, pEList, j, pExpr, "", nSubquery); cnt = 1; pMatch = 0; assert( zTab==0 && zDb==0 ); if( IN_RENAME_OBJECT ){ sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr); } goto lookupname_end; } } } /* Advance to the next name context. The loop will exit when either ** we have a match (cnt>0) or when we run out of name contexts. |
︙ | ︙ | |||
94698 94699 94700 94701 94702 94703 94704 94705 94706 94707 94708 | Expr *pRight; if( pExpr->op==TK_ID ){ zDb = 0; zTable = 0; zColumn = pExpr->u.zToken; }else{ notValid(pParse, pNC, "the \".\" operator", NC_IdxExpr); pRight = pExpr->pRight; if( pRight->op==TK_ID ){ zDb = 0; | > < < | | > > > | > > > > > | 94767 94768 94769 94770 94771 94772 94773 94774 94775 94776 94777 94778 94779 94780 94781 94782 94783 94784 94785 94786 94787 94788 94789 94790 94791 94792 94793 94794 94795 94796 94797 94798 | Expr *pRight; if( pExpr->op==TK_ID ){ zDb = 0; zTable = 0; zColumn = pExpr->u.zToken; }else{ Expr *pLeft = pExpr->pLeft; notValid(pParse, pNC, "the \".\" operator", NC_IdxExpr); pRight = pExpr->pRight; if( pRight->op==TK_ID ){ zDb = 0; }else{ assert( pRight->op==TK_DOT ); zDb = pLeft->u.zToken; pLeft = pRight->pLeft; pRight = pRight->pRight; } zTable = pLeft->u.zToken; zColumn = pRight->u.zToken; if( IN_RENAME_OBJECT ){ sqlite3RenameTokenRemap(pParse, (void*)pExpr, (void*)pRight); } if( IN_RENAME_OBJECT ){ sqlite3RenameTokenRemap(pParse, (void*)&pExpr->pTab, (void*)pLeft); } } return lookupName(pParse, zDb, zTable, zColumn, pNC, pExpr); } /* Resolve function names */ |
︙ | ︙ | |||
94792 94793 94794 94795 94796 94797 94798 94799 | ** sqlite_version() that might change over time cannot be used ** in an index. */ notValid(pParse, pNC, "non-deterministic functions", NC_IdxExpr|NC_PartIdx); } } #ifndef SQLITE_OMIT_WINDOWFUNC | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | 94868 94869 94870 94871 94872 94873 94874 94875 94876 94877 94878 94879 94880 94881 94882 94883 94884 94885 94886 94887 94888 94889 94890 94891 94892 94893 94894 94895 94896 94897 94898 94899 94900 94901 94902 94903 94904 94905 94906 94907 94908 94909 94910 94911 94912 94913 94914 94915 94916 94917 94918 94919 94920 94921 94922 94923 94924 94925 94926 94927 94928 94929 94930 94931 94932 94933 | ** sqlite_version() that might change over time cannot be used ** in an index. */ notValid(pParse, pNC, "non-deterministic functions", NC_IdxExpr|NC_PartIdx); } } if( 0==IN_RENAME_OBJECT ){ #ifndef SQLITE_OMIT_WINDOWFUNC assert( is_agg==0 || (pDef->funcFlags & SQLITE_FUNC_MINMAX) || (pDef->xValue==0 && pDef->xInverse==0) || (pDef->xValue && pDef->xInverse && pDef->xSFunc && pDef->xFinalize) ); if( pDef && pDef->xValue==0 && pExpr->pWin ){ sqlite3ErrorMsg(pParse, "%.*s() may not be used as a window function", nId, zId ); pNC->nErr++; }else if( (is_agg && (pNC->ncFlags & NC_AllowAgg)==0) || (is_agg && (pDef->funcFlags & SQLITE_FUNC_WINDOW) && !pExpr->pWin) || (is_agg && pExpr->pWin && (pNC->ncFlags & NC_AllowWin)==0) ){ const char *zType; if( (pDef->funcFlags & SQLITE_FUNC_WINDOW) || pExpr->pWin ){ zType = "window"; }else{ zType = "aggregate"; } sqlite3ErrorMsg(pParse, "misuse of %s function %.*s()",zType,nId,zId); pNC->nErr++; is_agg = 0; } #else if( (is_agg && (pNC->ncFlags & NC_AllowAgg)==0) ){ sqlite3ErrorMsg(pParse,"misuse of aggregate function %.*s()",nId,zId); pNC->nErr++; is_agg = 0; } #endif else if( no_such_func && pParse->db->init.busy==0 #ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION && pParse->explain==0 #endif ){ sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId); pNC->nErr++; }else if( wrong_num_args ){ sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()", nId, zId); pNC->nErr++; } if( is_agg ){ #ifndef SQLITE_OMIT_WINDOWFUNC pNC->ncFlags &= ~(pExpr->pWin ? NC_AllowWin : NC_AllowAgg); #else pNC->ncFlags &= ~NC_AllowAgg; #endif } } sqlite3WalkExprList(pWalker, pList); if( is_agg ){ #ifndef SQLITE_OMIT_WINDOWFUNC if( pExpr->pWin ){ Select *pSel = pNC->pWinSelect; sqlite3WalkExprList(pWalker, pExpr->pWin->pPartition); |
︙ | ︙ | |||
97356 97357 97358 97359 97360 97361 97362 97363 97364 97365 97366 97367 97368 97369 | if( pList ){ struct ExprList_item *pItem; assert( pList->nExpr>0 ); pItem = &pList->a[pList->nExpr-1]; assert( pItem->zName==0 ); pItem->zName = sqlite3DbStrNDup(pParse->db, pName->z, pName->n); if( dequote ) sqlite3Dequote(pItem->zName); } } /* ** Set the ExprList.a[].zSpan element of the most recently added item ** on the expression list. ** | > > > | 97434 97435 97436 97437 97438 97439 97440 97441 97442 97443 97444 97445 97446 97447 97448 97449 97450 | if( pList ){ struct ExprList_item *pItem; assert( pList->nExpr>0 ); pItem = &pList->a[pList->nExpr-1]; assert( pItem->zName==0 ); pItem->zName = sqlite3DbStrNDup(pParse->db, pName->z, pName->n); if( dequote ) sqlite3Dequote(pItem->zName); if( IN_RENAME_OBJECT ){ sqlite3RenameTokenMap(pParse, (void*)pItem->zName, pName); } } } /* ** Set the ExprList.a[].zSpan element of the most recently added item ** on the expression list. ** |
︙ | ︙ | |||
101054 101055 101056 101057 101058 101059 101060 | /* ** The code in this file only exists if we are not omitting the ** ALTER TABLE logic from the build. */ #ifndef SQLITE_OMIT_ALTERTABLE | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > < < < | 101135 101136 101137 101138 101139 101140 101141 101142 101143 101144 101145 101146 101147 101148 101149 101150 101151 101152 101153 101154 101155 101156 101157 101158 101159 101160 101161 101162 101163 101164 101165 101166 101167 101168 101169 101170 101171 101172 101173 101174 101175 101176 101177 101178 101179 101180 101181 101182 101183 101184 101185 101186 101187 101188 101189 101190 101191 101192 101193 101194 101195 101196 101197 101198 101199 101200 101201 101202 101203 101204 101205 101206 101207 101208 101209 101210 101211 101212 101213 101214 101215 101216 101217 101218 101219 101220 101221 101222 101223 101224 | /* ** The code in this file only exists if we are not omitting the ** ALTER TABLE logic from the build. */ #ifndef SQLITE_OMIT_ALTERTABLE /* ** Parameter zName is the name of a table that is about to be altered ** (either with ALTER TABLE ... RENAME TO or ALTER TABLE ... ADD COLUMN). ** If the table is a system table, this function leaves an error message ** in pParse->zErr (system tables may not be altered) and returns non-zero. ** ** Or, if zName is not a system table, zero is returned. */ static int isSystemTable(Parse *pParse, const char *zName){ if( 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){ sqlite3ErrorMsg(pParse, "table %s may not be altered", zName); return 1; } return 0; } /* ** Generate code to verify that the schemas of database zDb and, if ** bTemp is not true, database "temp", can still be parsed. This is ** called at the end of the generation of an ALTER TABLE ... RENAME ... ** statement to ensure that the operation has not rendered any schema ** objects unusable. */ void renameTestSchema(Parse *pParse, const char *zDb, int bTemp){ sqlite3NestedParse(pParse, "SELECT 1 " "FROM \"%w\".%s " "WHERE name NOT LIKE 'sqlite_%%'" " AND sql NOT LIKE 'create virtual%%'" " AND sqlite_rename_test(%Q, sql, type, name, %d)=NULL ", zDb, MASTER_NAME, zDb, bTemp ); if( bTemp==0 ){ sqlite3NestedParse(pParse, "SELECT 1 " "FROM temp.%s " "WHERE name NOT LIKE 'sqlite_%%'" " AND sql NOT LIKE 'create virtual%%'" " AND sqlite_rename_test(%Q, sql, type, name, 1)=NULL ", MASTER_NAME, zDb ); } } /* ** Generate code to reload the schema for database iDb. And, if iDb!=1, for ** the temp database as well. */ void renameReloadSchema(Parse *pParse, int iDb){ Vdbe *v = pParse->pVdbe; if( v ){ sqlite3ChangeCookie(pParse, iDb); sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, iDb, 0); if( iDb!=1 ) sqlite3VdbeAddParseSchemaOp(pParse->pVdbe, 1, 0); } } /* ** Generate code to implement the "ALTER TABLE xxx RENAME TO yyy" ** command. */ SQLITE_PRIVATE void sqlite3AlterRenameTable( Parse *pParse, /* Parser context. */ SrcList *pSrc, /* The table to rename. */ Token *pName /* The new table name. */ ){ int iDb; /* Database that contains the table */ char *zDb; /* Name of database iDb */ Table *pTab; /* Table being renamed */ char *zName = 0; /* NULL-terminated version of pName */ sqlite3 *db = pParse->db; /* Database connection */ int nTabName; /* Number of UTF-8 characters in zTabName */ const char *zTabName; /* Original name of the table */ Vdbe *v; VTable *pVTab = 0; /* Non-zero if this is a v-tab with an xRename() */ u32 savedDbFlags; /* Saved value of db->mDbFlags */ savedDbFlags = db->mDbFlags; if( NEVER(db->mallocFailed) ) goto exit_rename_table; assert( pSrc->nSrc==1 ); assert( sqlite3BtreeHoldsAllMutexes(pParse->db) ); |
︙ | ︙ | |||
101508 101509 101510 101511 101512 101513 101514 | ** schema). Open a statement transaction if the table is a virtual ** table. */ v = sqlite3GetVdbe(pParse); if( v==0 ){ goto exit_rename_table; } | < < < < | < | < | | | > > | | | < < < | > < < < < < < < | < | < | < < | | | | | | < > | < < | < < < < < < > | | | < < | < | | 101283 101284 101285 101286 101287 101288 101289 101290 101291 101292 101293 101294 101295 101296 101297 101298 101299 101300 101301 101302 101303 101304 101305 101306 101307 101308 101309 101310 101311 101312 101313 101314 101315 101316 101317 101318 101319 101320 101321 101322 101323 101324 101325 101326 101327 101328 101329 101330 101331 101332 101333 101334 101335 101336 101337 101338 101339 101340 101341 101342 101343 101344 101345 101346 101347 101348 101349 101350 101351 101352 101353 101354 101355 101356 101357 101358 101359 101360 101361 101362 101363 101364 101365 101366 101367 101368 101369 101370 | ** schema). Open a statement transaction if the table is a virtual ** table. */ v = sqlite3GetVdbe(pParse); if( v==0 ){ goto exit_rename_table; } /* If this is a virtual table, invoke the xRename() function if ** one is defined. The xRename() callback will modify the names ** of any resources used by the v-table implementation (including other ** SQLite tables) that are identified by the name of the virtual table. */ #ifndef SQLITE_OMIT_VIRTUALTABLE if( pVTab ){ int i = ++pParse->nMem; sqlite3VdbeLoadString(v, i, zName); sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pVTab, P4_VTAB); sqlite3MayAbort(pParse); } #endif /* figure out how many UTF-8 characters are in zName */ zTabName = pTab->zName; nTabName = sqlite3Utf8CharLen(zTabName, -1); /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in ** the schema to use the new table name. */ sqlite3NestedParse(pParse, "UPDATE \"%w\".%s SET " "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) " "WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)" "AND name NOT LIKE 'sqlite_%%'" , zDb, MASTER_NAME, zDb, zTabName, zName, (iDb==1), zTabName ); /* Update the tbl_name and name columns of the sqlite_master table ** as required. */ sqlite3NestedParse(pParse, "UPDATE %Q.%s SET " "tbl_name = %Q, " "name = CASE " "WHEN type='table' THEN %Q " "WHEN name LIKE 'sqlite_autoindex%%' AND type='index' THEN " "'sqlite_autoindex_' || %Q || substr(name,%d+18) " "ELSE name END " "WHERE tbl_name=%Q COLLATE nocase AND " "(type='table' OR type='index' OR type='trigger');", zDb, MASTER_NAME, zName, zName, zName, nTabName, zTabName ); #ifndef SQLITE_OMIT_AUTOINCREMENT /* If the sqlite_sequence table exists in this database, then update ** it with the new table name. */ if( sqlite3FindTable(db, "sqlite_sequence", zDb) ){ sqlite3NestedParse(pParse, "UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q", zDb, zName, pTab->zName); } #endif /* If the table being renamed is not itself part of the temp database, ** edit view and trigger definitions within the temp database ** as required. */ if( iDb!=1 ){ sqlite3NestedParse(pParse, "UPDATE sqlite_temp_master SET " "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, 1), " "tbl_name = " "CASE WHEN tbl_name=%Q COLLATE nocase AND " " sqlite_rename_test(%Q, sql, type, name, 1) " "THEN %Q ELSE tbl_name END " "WHERE type IN ('view', 'trigger')" , zDb, zTabName, zName, zTabName, zDb, zName); } renameReloadSchema(pParse, iDb); renameTestSchema(pParse, zDb, iDb==1); exit_rename_table: sqlite3SrcListDelete(db, pSrc); sqlite3DbFree(db, zName); db->mDbFlags = savedDbFlags; } |
︙ | ︙ | |||
101634 101635 101636 101637 101638 101639 101640 | int iDb; /* Database number */ const char *zDb; /* Database name */ const char *zTab; /* Table name */ char *zCol; /* Null-terminated column definition */ Column *pCol; /* The new column */ Expr *pDflt; /* Default value for the new column */ sqlite3 *db; /* The database connection; */ | | < | 101382 101383 101384 101385 101386 101387 101388 101389 101390 101391 101392 101393 101394 101395 101396 101397 101398 101399 101400 | int iDb; /* Database number */ const char *zDb; /* Database name */ const char *zTab; /* Table name */ char *zCol; /* Null-terminated column definition */ Column *pCol; /* The new column */ Expr *pDflt; /* Default value for the new column */ sqlite3 *db; /* The database connection; */ Vdbe *v; /* The prepared statement under construction */ int r1; /* Temporary registers */ db = pParse->db; if( pParse->nErr || db->mallocFailed ) return; pNew = pParse->pNewTable; assert( pNew ); assert( sqlite3BtreeHoldsAllMutexes(db) ); iDb = sqlite3SchemaToIndex(db, pNew->pSchema); zDb = db->aDb[iDb].zDbSName; zTab = &pNew->zName[16]; /* Skip the "sqlite_altertab_" prefix on the name */ |
︙ | ︙ | |||
101734 101735 101736 101737 101738 101739 101740 | db->mDbFlags = savedDbFlags; } /* Make sure the schema version is at least 3. But do not upgrade ** from less than 3 to 4, as that will corrupt any preexisting DESC ** index. */ | > > | | | | | | | | | > | | < | 101481 101482 101483 101484 101485 101486 101487 101488 101489 101490 101491 101492 101493 101494 101495 101496 101497 101498 101499 101500 101501 101502 101503 101504 101505 101506 101507 101508 101509 101510 101511 101512 101513 101514 101515 101516 101517 101518 101519 101520 101521 101522 101523 101524 101525 101526 101527 101528 | db->mDbFlags = savedDbFlags; } /* Make sure the schema version is at least 3. But do not upgrade ** from less than 3 to 4, as that will corrupt any preexisting DESC ** index. */ v = sqlite3GetVdbe(pParse); if( v ){ r1 = sqlite3GetTempReg(pParse); sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, r1, BTREE_FILE_FORMAT); sqlite3VdbeUsesBtree(v, iDb); sqlite3VdbeAddOp2(v, OP_AddImm, r1, -2); sqlite3VdbeAddOp2(v, OP_IfPos, r1, sqlite3VdbeCurrentAddr(v)+2); VdbeCoverage(v); sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3); sqlite3ReleaseTempReg(pParse, r1); } /* Reload the table definition */ renameReloadSchema(pParse, iDb); } /* ** This function is called by the parser after the table-name in ** an "ALTER TABLE <table-name> ADD" statement is parsed. Argument ** pSrc is the full-name of the table being altered. ** ** This routine makes a (partial) copy of the Table structure ** for the table being altered and sets Parse.pNewTable to point ** to it. Routines called by the parser as the column definition ** is parsed (i.e. sqlite3AddColumn()) add the new Column data to ** the copy. The copy of the Table structure is deleted by tokenize.c ** after parsing is finished. ** ** Routine sqlite3AlterFinishAddColumn() will be called to complete ** coding the "ALTER TABLE ... ADD" statement. */ SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){ Table *pNew; Table *pTab; int iDb; int i; int nAlloc; sqlite3 *db = pParse->db; /* Look up the table being altered. */ assert( pParse->pNewTable==0 ); |
︙ | ︙ | |||
101829 101830 101831 101832 101833 101834 101835 | pCol->zColl = 0; pCol->pDflt = 0; } pNew->pSchema = db->aDb[iDb].pSchema; pNew->addColOffset = pTab->addColOffset; pNew->nTabRef = 1; | < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 101578 101579 101580 101581 101582 101583 101584 101585 101586 101587 101588 101589 101590 101591 101592 101593 101594 101595 101596 101597 101598 101599 101600 101601 101602 101603 101604 101605 101606 101607 101608 101609 101610 101611 101612 101613 101614 101615 101616 101617 101618 101619 101620 101621 101622 101623 101624 101625 101626 101627 101628 101629 101630 101631 101632 101633 101634 101635 101636 101637 101638 101639 101640 101641 101642 101643 101644 101645 101646 101647 101648 101649 101650 101651 101652 101653 101654 101655 101656 101657 101658 101659 101660 101661 101662 101663 101664 101665 101666 101667 101668 101669 101670 101671 101672 101673 101674 101675 101676 101677 101678 101679 101680 101681 101682 101683 101684 101685 101686 101687 101688 101689 101690 101691 101692 101693 101694 101695 101696 101697 101698 101699 101700 101701 101702 101703 101704 101705 101706 101707 101708 101709 101710 101711 101712 101713 101714 101715 101716 101717 101718 101719 101720 101721 101722 101723 101724 101725 101726 101727 101728 101729 101730 101731 101732 101733 101734 101735 101736 101737 101738 101739 101740 101741 101742 101743 101744 101745 101746 101747 101748 101749 101750 101751 101752 101753 101754 101755 101756 101757 101758 101759 101760 101761 101762 101763 101764 101765 101766 101767 101768 101769 101770 101771 101772 101773 101774 101775 101776 101777 101778 101779 101780 101781 101782 101783 101784 101785 101786 101787 101788 101789 101790 101791 101792 101793 101794 101795 101796 101797 101798 101799 101800 101801 101802 101803 101804 101805 101806 101807 101808 101809 101810 101811 101812 101813 101814 101815 101816 101817 101818 101819 101820 101821 101822 101823 101824 101825 101826 101827 101828 101829 101830 101831 101832 101833 101834 101835 101836 101837 101838 101839 101840 101841 101842 101843 101844 101845 101846 101847 101848 101849 101850 101851 101852 101853 101854 101855 101856 101857 101858 101859 101860 101861 101862 101863 101864 101865 101866 101867 101868 101869 101870 101871 101872 101873 101874 101875 101876 101877 101878 101879 101880 101881 101882 101883 101884 101885 101886 101887 101888 101889 101890 101891 101892 101893 101894 101895 101896 101897 101898 101899 101900 101901 101902 101903 101904 101905 101906 101907 101908 101909 101910 101911 101912 101913 101914 101915 101916 101917 101918 101919 101920 101921 101922 101923 101924 101925 101926 101927 101928 101929 101930 101931 101932 101933 101934 101935 101936 101937 101938 101939 101940 101941 101942 101943 101944 101945 101946 101947 101948 101949 101950 101951 101952 101953 101954 101955 101956 101957 101958 101959 101960 101961 101962 101963 101964 101965 101966 101967 101968 101969 101970 101971 101972 101973 101974 101975 101976 101977 101978 101979 101980 101981 101982 101983 101984 101985 101986 101987 101988 101989 101990 101991 101992 101993 101994 101995 101996 101997 101998 101999 102000 102001 102002 102003 102004 102005 102006 102007 102008 102009 102010 102011 102012 102013 102014 102015 102016 102017 102018 102019 102020 102021 102022 102023 102024 102025 102026 102027 102028 102029 102030 102031 102032 102033 102034 102035 102036 102037 102038 102039 102040 102041 102042 102043 102044 102045 102046 102047 102048 102049 102050 102051 102052 102053 102054 102055 102056 102057 102058 102059 102060 102061 102062 102063 102064 102065 102066 102067 102068 102069 102070 102071 102072 102073 102074 102075 102076 102077 102078 102079 102080 102081 102082 102083 102084 102085 102086 102087 102088 102089 102090 102091 102092 102093 102094 102095 102096 102097 102098 102099 102100 102101 102102 102103 102104 102105 102106 102107 102108 102109 102110 102111 102112 102113 102114 102115 102116 102117 102118 102119 102120 102121 102122 102123 102124 102125 102126 102127 102128 102129 102130 102131 102132 102133 102134 102135 102136 102137 102138 102139 102140 102141 102142 102143 102144 102145 102146 102147 102148 102149 102150 102151 102152 102153 102154 102155 102156 102157 102158 102159 102160 102161 102162 102163 102164 102165 102166 102167 102168 102169 102170 102171 102172 102173 102174 102175 102176 102177 102178 102179 102180 102181 102182 102183 102184 102185 102186 102187 102188 102189 102190 102191 102192 102193 102194 102195 102196 102197 102198 102199 102200 102201 102202 102203 102204 102205 102206 102207 102208 102209 102210 102211 102212 102213 102214 102215 102216 102217 102218 102219 102220 102221 102222 102223 102224 102225 102226 102227 102228 102229 102230 102231 102232 102233 102234 102235 102236 102237 102238 102239 102240 102241 102242 102243 102244 102245 102246 102247 102248 102249 102250 102251 102252 102253 102254 102255 102256 102257 102258 102259 102260 102261 102262 102263 102264 102265 102266 102267 102268 102269 102270 102271 102272 102273 102274 102275 102276 102277 102278 102279 102280 102281 102282 102283 102284 102285 102286 102287 102288 102289 102290 102291 102292 102293 102294 102295 102296 102297 102298 102299 102300 102301 102302 102303 102304 102305 102306 102307 102308 102309 102310 102311 102312 102313 102314 102315 102316 102317 102318 102319 102320 102321 102322 102323 102324 102325 102326 102327 102328 102329 102330 102331 102332 102333 102334 102335 102336 102337 102338 102339 102340 102341 102342 102343 102344 102345 102346 102347 102348 102349 102350 102351 102352 102353 102354 102355 102356 102357 102358 102359 102360 102361 102362 102363 102364 102365 102366 102367 102368 102369 102370 102371 102372 102373 102374 102375 102376 102377 102378 102379 102380 102381 102382 102383 102384 102385 102386 102387 102388 102389 102390 102391 102392 102393 102394 102395 102396 102397 102398 102399 102400 102401 102402 102403 102404 102405 102406 102407 102408 102409 102410 102411 102412 102413 102414 102415 102416 102417 102418 102419 102420 102421 102422 102423 102424 102425 102426 102427 102428 102429 102430 102431 102432 102433 102434 102435 102436 102437 102438 102439 102440 102441 102442 102443 102444 102445 102446 102447 102448 102449 102450 102451 102452 102453 102454 102455 102456 102457 102458 102459 102460 102461 102462 102463 102464 102465 102466 102467 102468 102469 102470 102471 102472 102473 102474 102475 102476 102477 102478 102479 102480 102481 102482 102483 102484 102485 102486 102487 102488 102489 102490 102491 102492 102493 102494 102495 102496 102497 102498 102499 102500 102501 102502 102503 102504 102505 102506 102507 102508 102509 102510 102511 102512 102513 102514 102515 102516 102517 102518 102519 102520 102521 102522 102523 102524 102525 102526 102527 102528 102529 102530 102531 102532 102533 102534 102535 102536 102537 102538 102539 102540 102541 102542 102543 102544 102545 102546 102547 102548 102549 102550 102551 102552 102553 102554 102555 102556 102557 102558 102559 102560 102561 102562 102563 102564 102565 102566 102567 102568 102569 102570 102571 102572 102573 102574 102575 102576 102577 102578 102579 102580 102581 102582 102583 102584 102585 102586 102587 102588 102589 102590 102591 102592 102593 102594 102595 102596 102597 102598 102599 102600 102601 102602 102603 102604 102605 102606 102607 102608 102609 102610 102611 102612 102613 102614 102615 102616 102617 102618 102619 102620 102621 102622 102623 102624 102625 102626 102627 102628 102629 102630 102631 102632 102633 102634 102635 102636 102637 102638 102639 102640 102641 102642 102643 102644 102645 102646 102647 102648 102649 102650 102651 102652 102653 102654 102655 102656 102657 102658 102659 102660 102661 102662 102663 102664 102665 102666 102667 102668 102669 102670 102671 102672 102673 102674 102675 102676 102677 102678 102679 102680 102681 102682 102683 102684 102685 102686 102687 102688 102689 102690 102691 102692 102693 102694 | pCol->zColl = 0; pCol->pDflt = 0; } pNew->pSchema = db->aDb[iDb].pSchema; pNew->addColOffset = pTab->addColOffset; pNew->nTabRef = 1; exit_begin_add_column: sqlite3SrcListDelete(db, pSrc); return; } /* ** Parameter pTab is the subject of an ALTER TABLE ... RENAME COLUMN ** command. This function checks if the table is a view or virtual ** table (columns of views or virtual tables may not be renamed). If so, ** it loads an error message into pParse and returns non-zero. ** ** Or, if pTab is not a view or virtual table, zero is returned. */ #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) static int isRealTable(Parse *pParse, Table *pTab){ const char *zType = 0; #ifndef SQLITE_OMIT_VIEW if( pTab->pSelect ){ zType = "view"; } #endif #ifndef SQLITE_OMIT_VIRTUALTABLE if( IsVirtual(pTab) ){ zType = "virtual table"; } #endif if( zType ){ sqlite3ErrorMsg( pParse, "cannot rename columns of %s \"%s\"", zType, pTab->zName ); return 1; } return 0; } #else /* !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) */ # define isRealTable(x,y) (0) #endif /* ** Handles the following parser reduction: ** ** cmd ::= ALTER TABLE pSrc RENAME COLUMN pOld TO pNew */ SQLITE_PRIVATE void sqlite3AlterRenameColumn( Parse *pParse, /* Parsing context */ SrcList *pSrc, /* Table being altered. pSrc->nSrc==1 */ Token *pOld, /* Name of column being changed */ Token *pNew /* New column name */ ){ sqlite3 *db = pParse->db; /* Database connection */ Table *pTab; /* Table being updated */ int iCol; /* Index of column being renamed */ char *zOld = 0; /* Old column name */ char *zNew = 0; /* New column name */ const char *zDb; /* Name of schema containing the table */ int iSchema; /* Index of the schema */ int bQuote; /* True to quote the new name */ /* Locate the table to be altered */ pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]); if( !pTab ) goto exit_rename_column; /* Cannot alter a system table */ if( SQLITE_OK!=isSystemTable(pParse, pTab->zName) ) goto exit_rename_column; if( SQLITE_OK!=isRealTable(pParse, pTab) ) goto exit_rename_column; /* Which schema holds the table to be altered */ iSchema = sqlite3SchemaToIndex(db, pTab->pSchema); assert( iSchema>=0 ); zDb = db->aDb[iSchema].zDbSName; #ifndef SQLITE_OMIT_AUTHORIZATION /* Invoke the authorization callback. */ if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){ goto exit_rename_column; } #endif /* Make sure the old name really is a column name in the table to be ** altered. Set iCol to be the index of the column being renamed */ zOld = sqlite3NameFromToken(db, pOld); if( !zOld ) goto exit_rename_column; for(iCol=0; iCol<pTab->nCol; iCol++){ if( 0==sqlite3StrICmp(pTab->aCol[iCol].zName, zOld) ) break; } if( iCol==pTab->nCol ){ sqlite3ErrorMsg(pParse, "no such column: \"%s\"", zOld); goto exit_rename_column; } /* Do the rename operation using a recursive UPDATE statement that ** uses the sqlite_rename_column() SQL function to compute the new ** CREATE statement text for the sqlite_master table. */ zNew = sqlite3NameFromToken(db, pNew); if( !zNew ) goto exit_rename_column; assert( pNew->n>0 ); bQuote = sqlite3Isquote(pNew->z[0]); sqlite3NestedParse(pParse, "UPDATE \"%w\".%s SET " "sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) " "WHERE name NOT LIKE 'sqlite_%%' AND (type != 'index' OR tbl_name = %Q)" " AND sql NOT LIKE 'create virtual%%'", zDb, MASTER_NAME, zDb, pTab->zName, iCol, zNew, bQuote, iSchema==1, pTab->zName ); sqlite3NestedParse(pParse, "UPDATE temp.%s SET " "sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) " "WHERE type IN ('trigger', 'view')", MASTER_NAME, zDb, pTab->zName, iCol, zNew, bQuote ); /* Drop and reload the database schema. */ renameReloadSchema(pParse, iSchema); renameTestSchema(pParse, zDb, iSchema==1); exit_rename_column: sqlite3SrcListDelete(db, pSrc); sqlite3DbFree(db, zOld); sqlite3DbFree(db, zNew); return; } /* ** Each RenameToken object maps an element of the parse tree into ** the token that generated that element. The parse tree element ** might be one of: ** ** * A pointer to an Expr that represents an ID ** * The name of a table column in Column.zName ** ** A list of RenameToken objects can be constructed during parsing. ** Each new object is created by sqlite3RenameTokenMap(). ** As the parse tree is transformed, the sqlite3RenameTokenRemap() ** routine is used to keep the mapping current. ** ** After the parse finishes, renameTokenFind() routine can be used ** to look up the actual token value that created some element in ** the parse tree. */ struct RenameToken { void *p; /* Parse tree element created by token t */ Token t; /* The token that created parse tree element p */ RenameToken *pNext; /* Next is a list of all RenameToken objects */ }; /* ** The context of an ALTER TABLE RENAME COLUMN operation that gets passed ** down into the Walker. */ typedef struct RenameCtx RenameCtx; struct RenameCtx { RenameToken *pList; /* List of tokens to overwrite */ int nList; /* Number of tokens in pList */ int iCol; /* Index of column being renamed */ Table *pTab; /* Table being ALTERed */ const char *zOld; /* Old column name */ }; #ifdef SQLITE_DEBUG /* ** This function is only for debugging. It performs two tasks: ** ** 1. Checks that pointer pPtr does not already appear in the ** rename-token list. ** ** 2. Dereferences each pointer in the rename-token list. ** ** The second is most effective when debugging under valgrind or ** address-sanitizer or similar. If any of these pointers no longer ** point to valid objects, an exception is raised by the memory-checking ** tool. ** ** The point of this is to prevent comparisons of invalid pointer values. ** Even though this always seems to work, it is undefined according to the ** C standard. Example of undefined comparison: ** ** sqlite3_free(x); ** if( x==y ) ... ** ** Technically, as x no longer points into a valid object or to the byte ** following a valid object, it may not be used in comparison operations. */ void renameTokenCheckAll(Parse *pParse, void *pPtr){ if( pParse->nErr==0 && pParse->db->mallocFailed==0 ){ RenameToken *p; u8 i = 0; for(p=pParse->pRename; p; p=p->pNext){ if( p->p ){ assert( p->p!=pPtr ); i += *(u8*)(p->p); } } } } #else # define renameTokenCheckAll(x,y) #endif /* ** Add a new RenameToken object mapping parse tree element pPtr into ** token *pToken to the Parse object currently under construction. ** ** Return a copy of pPtr. */ SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse *pParse, void *pPtr, Token *pToken){ RenameToken *pNew; assert( pPtr || pParse->db->mallocFailed ); renameTokenCheckAll(pParse, pPtr); pNew = sqlite3DbMallocZero(pParse->db, sizeof(RenameToken)); if( pNew ){ pNew->p = pPtr; pNew->t = *pToken; pNew->pNext = pParse->pRename; pParse->pRename = pNew; } return pPtr; } /* ** It is assumed that there is already a RenameToken object associated ** with parse tree element pFrom. This function remaps the associated token ** to parse tree element pTo. */ SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse *pParse, void *pTo, void *pFrom){ RenameToken *p; renameTokenCheckAll(pParse, pTo); for(p=pParse->pRename; p; p=p->pNext){ if( p->p==pFrom ){ p->p = pTo; break; } } } /* ** Walker callback used by sqlite3RenameExprUnmap(). */ static int renameUnmapExprCb(Walker *pWalker, Expr *pExpr){ Parse *pParse = pWalker->pParse; sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr); return WRC_Continue; } /* ** Remove all nodes that are part of expression pExpr from the rename list. */ SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse *pParse, Expr *pExpr){ Walker sWalker; memset(&sWalker, 0, sizeof(Walker)); sWalker.pParse = pParse; sWalker.xExprCallback = renameUnmapExprCb; sqlite3WalkExpr(&sWalker, pExpr); } /* ** Free the list of RenameToken objects given in the second argument */ static void renameTokenFree(sqlite3 *db, RenameToken *pToken){ RenameToken *pNext; RenameToken *p; for(p=pToken; p; p=pNext){ pNext = p->pNext; sqlite3DbFree(db, p); } } /* ** Search the Parse object passed as the first argument for a RenameToken ** object associated with parse tree element pPtr. If found, remove it ** from the Parse object and add it to the list maintained by the ** RenameCtx object passed as the second argument. */ static void renameTokenFind(Parse *pParse, struct RenameCtx *pCtx, void *pPtr){ RenameToken **pp; assert( pPtr!=0 ); for(pp=&pParse->pRename; (*pp); pp=&(*pp)->pNext){ if( (*pp)->p==pPtr ){ RenameToken *pToken = *pp; *pp = pToken->pNext; pToken->pNext = pCtx->pList; pCtx->pList = pToken; pCtx->nList++; break; } } } /* ** This is a Walker select callback. It does nothing. It is only required ** because without a dummy callback, sqlite3WalkExpr() and similar do not ** descend into sub-select statements. */ static int renameColumnSelectCb(Walker *pWalker, Select *p){ UNUSED_PARAMETER(pWalker); UNUSED_PARAMETER(p); return WRC_Continue; } /* ** This is a Walker expression callback. ** ** For every TK_COLUMN node in the expression tree, search to see ** if the column being references is the column being renamed by an ** ALTER TABLE statement. If it is, then attach its associated ** RenameToken object to the list of RenameToken objects being ** constructed in RenameCtx object at pWalker->u.pRename. */ static int renameColumnExprCb(Walker *pWalker, Expr *pExpr){ RenameCtx *p = pWalker->u.pRename; if( pExpr->op==TK_TRIGGER && pExpr->iColumn==p->iCol && pWalker->pParse->pTriggerTab==p->pTab ){ renameTokenFind(pWalker->pParse, p, (void*)pExpr); }else if( pExpr->op==TK_COLUMN && pExpr->iColumn==p->iCol && p->pTab==pExpr->pTab ){ renameTokenFind(pWalker->pParse, p, (void*)pExpr); } return WRC_Continue; } /* ** The RenameCtx contains a list of tokens that reference a column that ** is being renamed by an ALTER TABLE statement. Return the "last" ** RenameToken in the RenameCtx and remove that RenameToken from the ** RenameContext. "Last" means the last RenameToken encountered when ** the input SQL is parsed from left to right. Repeated calls to this routine ** return all column name tokens in the order that they are encountered ** in the SQL statement. */ static RenameToken *renameColumnTokenNext(RenameCtx *pCtx){ RenameToken *pBest = pCtx->pList; RenameToken *pToken; RenameToken **pp; for(pToken=pBest->pNext; pToken; pToken=pToken->pNext){ if( pToken->t.z>pBest->t.z ) pBest = pToken; } for(pp=&pCtx->pList; *pp!=pBest; pp=&(*pp)->pNext); *pp = pBest->pNext; return pBest; } /* ** An error occured while parsing or otherwise processing a database ** object (either pParse->pNewTable, pNewIndex or pNewTrigger) as part of an ** ALTER TABLE RENAME COLUMN program. The error message emitted by the ** sub-routine is currently stored in pParse->zErrMsg. This function ** adds context to the error message and then stores it in pCtx. */ static void renameColumnParseError( sqlite3_context *pCtx, int bPost, sqlite3_value *pType, sqlite3_value *pObject, Parse *pParse ){ const char *zT = (const char*)sqlite3_value_text(pType); const char *zN = (const char*)sqlite3_value_text(pObject); char *zErr; zErr = sqlite3_mprintf("error in %s %s%s: %s", zT, zN, (bPost ? " after rename" : ""), pParse->zErrMsg ); sqlite3_result_error(pCtx, zErr, -1); sqlite3_free(zErr); } /* ** For each name in the the expression-list pEList (i.e. each ** pEList->a[i].zName) that matches the string in zOld, extract the ** corresponding rename-token from Parse object pParse and add it ** to the RenameCtx pCtx. */ static void renameColumnElistNames( Parse *pParse, RenameCtx *pCtx, ExprList *pEList, const char *zOld ){ if( pEList ){ int i; for(i=0; i<pEList->nExpr; i++){ char *zName = pEList->a[i].zName; if( 0==sqlite3_stricmp(zName, zOld) ){ renameTokenFind(pParse, pCtx, (void*)zName); } } } } /* ** For each name in the the id-list pIdList (i.e. each pIdList->a[i].zName) ** that matches the string in zOld, extract the corresponding rename-token ** from Parse object pParse and add it to the RenameCtx pCtx. */ static void renameColumnIdlistNames( Parse *pParse, RenameCtx *pCtx, IdList *pIdList, const char *zOld ){ if( pIdList ){ int i; for(i=0; i<pIdList->nId; i++){ char *zName = pIdList->a[i].zName; if( 0==sqlite3_stricmp(zName, zOld) ){ renameTokenFind(pParse, pCtx, (void*)zName); } } } } /* ** Parse the SQL statement zSql using Parse object (*p). The Parse object ** is initialized by this function before it is used. */ static int renameParseSql( Parse *p, /* Memory to use for Parse object */ const char *zDb, /* Name of schema SQL belongs to */ int bTable, /* 1 -> RENAME TABLE, 0 -> RENAME COLUMN */ sqlite3 *db, /* Database handle */ const char *zSql, /* SQL to parse */ int bTemp /* True if SQL is from temp schema */ ){ int rc; char *zErr = 0; db->init.iDb = bTemp ? 1 : sqlite3FindDbName(db, zDb); /* Parse the SQL statement passed as the first argument. If no error ** occurs and the parse does not result in a new table, index or ** trigger object, the database must be corrupt. */ memset(p, 0, sizeof(Parse)); p->eParseMode = (bTable ? PARSE_MODE_RENAME_TABLE : PARSE_MODE_RENAME_COLUMN); p->db = db; p->nQueryLoop = 1; rc = sqlite3RunParser(p, zSql, &zErr); assert( p->zErrMsg==0 ); assert( rc!=SQLITE_OK || zErr==0 ); assert( (0!=p->pNewTable) + (0!=p->pNewIndex) + (0!=p->pNewTrigger)<2 ); p->zErrMsg = zErr; if( db->mallocFailed ) rc = SQLITE_NOMEM; if( rc==SQLITE_OK && p->pNewTable==0 && p->pNewIndex==0 && p->pNewTrigger==0 ){ rc = SQLITE_CORRUPT_BKPT; } #ifdef SQLITE_DEBUG /* Ensure that all mappings in the Parse.pRename list really do map to ** a part of the input string. */ if( rc==SQLITE_OK ){ int nSql = sqlite3Strlen30(zSql); RenameToken *pToken; for(pToken=p->pRename; pToken; pToken=pToken->pNext){ assert( pToken->t.z>=zSql && &pToken->t.z[pToken->t.n]<=&zSql[nSql] ); } } #endif db->init.iDb = 0; return rc; } /* ** This function edits SQL statement zSql, replacing each token identified ** by the linked list pRename with the text of zNew. If argument bQuote is ** true, then zNew is always quoted first. If no error occurs, the result ** is loaded into context object pCtx as the result. ** ** Or, if an error occurs (i.e. an OOM condition), an error is left in ** pCtx and an SQLite error code returned. */ static int renameEditSql( sqlite3_context *pCtx, /* Return result here */ RenameCtx *pRename, /* Rename context */ const char *zSql, /* SQL statement to edit */ const char *zNew, /* New token text */ int bQuote /* True to always quote token */ ){ int nNew = sqlite3Strlen30(zNew); int nSql = sqlite3Strlen30(zSql); sqlite3 *db = sqlite3_context_db_handle(pCtx); int rc = SQLITE_OK; char *zQuot; char *zOut; int nQuot; /* Set zQuot to point to a buffer containing a quoted copy of the ** identifier zNew. If the corresponding identifier in the original ** ALTER TABLE statement was quoted (bQuote==1), then set zNew to ** point to zQuot so that all substitutions are made using the ** quoted version of the new column name. */ zQuot = sqlite3MPrintf(db, "\"%w\"", zNew); if( zQuot==0 ){ return SQLITE_NOMEM; }else{ nQuot = sqlite3Strlen30(zQuot); } if( bQuote ){ zNew = zQuot; nNew = nQuot; } /* At this point pRename->pList contains a list of RenameToken objects ** corresponding to all tokens in the input SQL that must be replaced ** with the new column name. All that remains is to construct and ** return the edited SQL string. */ assert( nQuot>=nNew ); zOut = sqlite3DbMallocZero(db, nSql + pRename->nList*nQuot + 1); if( zOut ){ int nOut = nSql; memcpy(zOut, zSql, nSql); while( pRename->pList ){ int iOff; /* Offset of token to replace in zOut */ RenameToken *pBest = renameColumnTokenNext(pRename); u32 nReplace; const char *zReplace; if( sqlite3IsIdChar(*pBest->t.z) ){ nReplace = nNew; zReplace = zNew; }else{ nReplace = nQuot; zReplace = zQuot; } iOff = pBest->t.z - zSql; if( pBest->t.n!=nReplace ){ memmove(&zOut[iOff + nReplace], &zOut[iOff + pBest->t.n], nOut - (iOff + pBest->t.n) ); nOut += nReplace - pBest->t.n; zOut[nOut] = '\0'; } memcpy(&zOut[iOff], zReplace, nReplace); sqlite3DbFree(db, pBest); } sqlite3_result_text(pCtx, zOut, -1, SQLITE_TRANSIENT); sqlite3DbFree(db, zOut); }else{ rc = SQLITE_NOMEM; } sqlite3_free(zQuot); return rc; } /* ** Resolve all symbols in the trigger at pParse->pNewTrigger, assuming ** it was read from the schema of database zDb. Return SQLITE_OK if ** successful. Otherwise, return an SQLite error code and leave an error ** message in the Parse object. */ static int renameResolveTrigger(Parse *pParse, const char *zDb){ sqlite3 *db = pParse->db; TriggerStep *pStep; NameContext sNC; int rc = SQLITE_OK; memset(&sNC, 0, sizeof(sNC)); sNC.pParse = pParse; pParse->pTriggerTab = sqlite3FindTable(db, pParse->pNewTrigger->table, zDb); pParse->eTriggerOp = pParse->pNewTrigger->op; /* Resolve symbols in WHEN clause */ if( pParse->pNewTrigger->pWhen ){ rc = sqlite3ResolveExprNames(&sNC, pParse->pNewTrigger->pWhen); } for(pStep=pParse->pNewTrigger->step_list; rc==SQLITE_OK && pStep; pStep=pStep->pNext ){ if( pStep->pSelect ){ sqlite3SelectPrep(pParse, pStep->pSelect, &sNC); if( pParse->nErr ) rc = pParse->rc; } if( rc==SQLITE_OK && pStep->zTarget ){ Table *pTarget = sqlite3LocateTable(pParse, 0, pStep->zTarget, zDb); if( pTarget==0 ){ rc = SQLITE_ERROR; }else{ SrcList sSrc; memset(&sSrc, 0, sizeof(sSrc)); sSrc.nSrc = 1; sSrc.a[0].zName = pStep->zTarget; sSrc.a[0].pTab = pTarget; sNC.pSrcList = &sSrc; if( pStep->pWhere ){ rc = sqlite3ResolveExprNames(&sNC, pStep->pWhere); } if( rc==SQLITE_OK ){ rc = sqlite3ResolveExprListNames(&sNC, pStep->pExprList); } assert( !pStep->pUpsert || (!pStep->pWhere && !pStep->pExprList) ); if( pStep->pUpsert ){ Upsert *pUpsert = pStep->pUpsert; assert( rc==SQLITE_OK ); pUpsert->pUpsertSrc = &sSrc; sNC.uNC.pUpsert = pUpsert; sNC.ncFlags = NC_UUpsert; rc = sqlite3ResolveExprListNames(&sNC, pUpsert->pUpsertTarget); if( rc==SQLITE_OK ){ ExprList *pUpsertSet = pUpsert->pUpsertSet; rc = sqlite3ResolveExprListNames(&sNC, pUpsertSet); } if( rc==SQLITE_OK ){ rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertWhere); } if( rc==SQLITE_OK ){ rc = sqlite3ResolveExprNames(&sNC, pUpsert->pUpsertTargetWhere); } sNC.ncFlags = 0; } } } } return rc; } /* ** Invoke sqlite3WalkExpr() or sqlite3WalkSelect() on all Select or Expr ** objects that are part of the trigger passed as the second argument. */ static void renameWalkTrigger(Walker *pWalker, Trigger *pTrigger){ TriggerStep *pStep; /* Find tokens to edit in WHEN clause */ sqlite3WalkExpr(pWalker, pTrigger->pWhen); /* Find tokens to edit in trigger steps */ for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){ sqlite3WalkSelect(pWalker, pStep->pSelect); sqlite3WalkExpr(pWalker, pStep->pWhere); sqlite3WalkExprList(pWalker, pStep->pExprList); if( pStep->pUpsert ){ Upsert *pUpsert = pStep->pUpsert; sqlite3WalkExprList(pWalker, pUpsert->pUpsertTarget); sqlite3WalkExprList(pWalker, pUpsert->pUpsertSet); sqlite3WalkExpr(pWalker, pUpsert->pUpsertWhere); sqlite3WalkExpr(pWalker, pUpsert->pUpsertTargetWhere); } } } /* ** Free the contents of Parse object (*pParse). Do not free the memory ** occupied by the Parse object itself. */ static void renameParseCleanup(Parse *pParse){ sqlite3 *db = pParse->db; if( pParse->pVdbe ){ sqlite3VdbeFinalize(pParse->pVdbe); } sqlite3DeleteTable(db, pParse->pNewTable); if( pParse->pNewIndex ) sqlite3FreeIndex(db, pParse->pNewIndex); sqlite3DeleteTrigger(db, pParse->pNewTrigger); sqlite3DbFree(db, pParse->zErrMsg); renameTokenFree(db, pParse->pRename); sqlite3ParserReset(pParse); } /* ** SQL function: ** ** sqlite_rename_column(zSql, iCol, bQuote, zNew, zTable, zOld) ** ** 0. zSql: SQL statement to rewrite ** 1. type: Type of object ("table", "view" etc.) ** 2. object: Name of object ** 3. Database: Database name (e.g. "main") ** 4. Table: Table name ** 5. iCol: Index of column to rename ** 6. zNew: New column name ** 7. bQuote: Non-zero if the new column name should be quoted. ** 8. bTemp: True if zSql comes from temp schema ** ** Do a column rename operation on the CREATE statement given in zSql. ** The iCol-th column (left-most is 0) of table zTable is renamed from zCol ** into zNew. The name should be quoted if bQuote is true. ** ** This function is used internally by the ALTER TABLE RENAME COLUMN command. ** Though accessible to application code, it is not intended for use by ** applications. The existance of this function, and the way it works, ** is subject to change without notice. ** ** If any of the parameters are out-of-bounds, then simply return NULL. ** An out-of-bounds parameter can only occur when the application calls ** this function directly. The parameters will always be well-formed when ** this routine is invoked by the bytecode for a legitimate ALTER TABLE ** statement. */ static void renameColumnFunc( sqlite3_context *context, int NotUsed, sqlite3_value **argv ){ sqlite3 *db = sqlite3_context_db_handle(context); RenameCtx sCtx; const char *zSql = (const char*)sqlite3_value_text(argv[0]); const char *zDb = (const char*)sqlite3_value_text(argv[3]); const char *zTable = (const char*)sqlite3_value_text(argv[4]); int iCol = sqlite3_value_int(argv[5]); const char *zNew = (const char*)sqlite3_value_text(argv[6]); int bQuote = sqlite3_value_int(argv[7]); int bTemp = sqlite3_value_int(argv[8]); const char *zOld; int rc; Parse sParse; Walker sWalker; Index *pIdx; int i; Table *pTab; #ifndef SQLITE_OMIT_AUTHORIZATION sqlite3_xauth xAuth = db->xAuth; #endif UNUSED_PARAMETER(NotUsed); if( zSql==0 ) return; if( zTable==0 ) return; if( zNew==0 ) return; if( iCol<0 ) return; sqlite3BtreeEnterAll(db); pTab = sqlite3FindTable(db, zTable, zDb); if( pTab==0 || iCol>=pTab->nCol ){ sqlite3BtreeLeaveAll(db); return; } zOld = pTab->aCol[iCol].zName; memset(&sCtx, 0, sizeof(sCtx)); sCtx.iCol = ((iCol==pTab->iPKey) ? -1 : iCol); #ifndef SQLITE_OMIT_AUTHORIZATION db->xAuth = 0; #endif rc = renameParseSql(&sParse, zDb, 0, db, zSql, bTemp); /* Find tokens that need to be replaced. */ memset(&sWalker, 0, sizeof(Walker)); sWalker.pParse = &sParse; sWalker.xExprCallback = renameColumnExprCb; sWalker.xSelectCallback = renameColumnSelectCb; sWalker.u.pRename = &sCtx; sCtx.pTab = pTab; if( rc!=SQLITE_OK ) goto renameColumnFunc_done; if( sParse.pNewTable ){ Select *pSelect = sParse.pNewTable->pSelect; if( pSelect ){ sParse.rc = SQLITE_OK; sqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, 0); rc = (db->mallocFailed ? SQLITE_NOMEM : sParse.rc); if( rc==SQLITE_OK ){ sqlite3WalkSelect(&sWalker, pSelect); } if( rc!=SQLITE_OK ) goto renameColumnFunc_done; }else{ /* A regular table */ int bFKOnly = sqlite3_stricmp(zTable, sParse.pNewTable->zName); FKey *pFKey; assert( sParse.pNewTable->pSelect==0 ); sCtx.pTab = sParse.pNewTable; if( bFKOnly==0 ){ renameTokenFind( &sParse, &sCtx, (void*)sParse.pNewTable->aCol[iCol].zName ); if( sCtx.iCol<0 ){ renameTokenFind(&sParse, &sCtx, (void*)&sParse.pNewTable->iPKey); } sqlite3WalkExprList(&sWalker, sParse.pNewTable->pCheck); for(pIdx=sParse.pNewTable->pIndex; pIdx; pIdx=pIdx->pNext){ sqlite3WalkExprList(&sWalker, pIdx->aColExpr); } } for(pFKey=sParse.pNewTable->pFKey; pFKey; pFKey=pFKey->pNextFrom){ for(i=0; i<pFKey->nCol; i++){ if( bFKOnly==0 && pFKey->aCol[i].iFrom==iCol ){ renameTokenFind(&sParse, &sCtx, (void*)&pFKey->aCol[i]); } if( 0==sqlite3_stricmp(pFKey->zTo, zTable) && 0==sqlite3_stricmp(pFKey->aCol[i].zCol, zOld) ){ renameTokenFind(&sParse, &sCtx, (void*)pFKey->aCol[i].zCol); } } } } }else if( sParse.pNewIndex ){ sqlite3WalkExprList(&sWalker, sParse.pNewIndex->aColExpr); sqlite3WalkExpr(&sWalker, sParse.pNewIndex->pPartIdxWhere); }else{ /* A trigger */ TriggerStep *pStep; rc = renameResolveTrigger(&sParse, (bTemp ? 0 : zDb)); if( rc!=SQLITE_OK ) goto renameColumnFunc_done; for(pStep=sParse.pNewTrigger->step_list; pStep; pStep=pStep->pNext){ if( pStep->zTarget ){ Table *pTarget = sqlite3LocateTable(&sParse, 0, pStep->zTarget, zDb); if( pTarget==pTab ){ if( pStep->pUpsert ){ ExprList *pUpsertSet = pStep->pUpsert->pUpsertSet; renameColumnElistNames(&sParse, &sCtx, pUpsertSet, zOld); } renameColumnIdlistNames(&sParse, &sCtx, pStep->pIdList, zOld); renameColumnElistNames(&sParse, &sCtx, pStep->pExprList, zOld); } } } /* Find tokens to edit in UPDATE OF clause */ if( sParse.pTriggerTab==pTab ){ renameColumnIdlistNames(&sParse, &sCtx,sParse.pNewTrigger->pColumns,zOld); } /* Find tokens to edit in various expressions and selects */ renameWalkTrigger(&sWalker, sParse.pNewTrigger); } assert( rc==SQLITE_OK ); rc = renameEditSql(context, &sCtx, zSql, zNew, bQuote); renameColumnFunc_done: if( rc!=SQLITE_OK ){ if( sParse.zErrMsg ){ renameColumnParseError(context, 0, argv[1], argv[2], &sParse); }else{ sqlite3_result_error_code(context, rc); } } renameParseCleanup(&sParse); renameTokenFree(db, sCtx.pList); #ifndef SQLITE_OMIT_AUTHORIZATION db->xAuth = xAuth; #endif sqlite3BtreeLeaveAll(db); } /* ** Walker expression callback used by "RENAME TABLE". */ static int renameTableExprCb(Walker *pWalker, Expr *pExpr){ RenameCtx *p = pWalker->u.pRename; if( pExpr->op==TK_COLUMN && p->pTab==pExpr->pTab ){ renameTokenFind(pWalker->pParse, p, (void*)&pExpr->pTab); } return WRC_Continue; } /* ** Walker select callback used by "RENAME TABLE". */ static int renameTableSelectCb(Walker *pWalker, Select *pSelect){ int i; RenameCtx *p = pWalker->u.pRename; SrcList *pSrc = pSelect->pSrc; for(i=0; i<pSrc->nSrc; i++){ struct SrcList_item *pItem = &pSrc->a[i]; if( pItem->pTab==p->pTab ){ renameTokenFind(pWalker->pParse, p, pItem->zName); } } return WRC_Continue; } /* ** This C function implements an SQL user function that is used by SQL code ** generated by the ALTER TABLE ... RENAME command to modify the definition ** of any foreign key constraints that use the table being renamed as the ** parent table. It is passed three arguments: ** ** 0: The database containing the table being renamed. ** 1. type: Type of object ("table", "view" etc.) ** 2. object: Name of object ** 3: The complete text of the schema statement being modified, ** 4: The old name of the table being renamed, and ** 5: The new name of the table being renamed. ** 6: True if the schema statement comes from the temp db. ** ** It returns the new schema statement. For example: ** ** sqlite_rename_table('main', 'CREATE TABLE t1(a REFERENCES t2)','t2','t3',0) ** -> 'CREATE TABLE t1(a REFERENCES t3)' */ static void renameTableFunc( sqlite3_context *context, int NotUsed, sqlite3_value **argv ){ sqlite3 *db = sqlite3_context_db_handle(context); const char *zDb = (const char*)sqlite3_value_text(argv[0]); const char *zInput = (const char*)sqlite3_value_text(argv[3]); const char *zOld = (const char*)sqlite3_value_text(argv[4]); const char *zNew = (const char*)sqlite3_value_text(argv[5]); int bTemp = sqlite3_value_int(argv[6]); UNUSED_PARAMETER(NotUsed); if( zInput && zOld && zNew ){ Parse sParse; int rc; int bQuote = 1; RenameCtx sCtx; Walker sWalker; #ifndef SQLITE_OMIT_AUTHORIZATION sqlite3_xauth xAuth = db->xAuth; db->xAuth = 0; #endif sqlite3BtreeEnterAll(db); memset(&sCtx, 0, sizeof(RenameCtx)); sCtx.pTab = sqlite3FindTable(db, zOld, zDb); memset(&sWalker, 0, sizeof(Walker)); sWalker.pParse = &sParse; sWalker.xExprCallback = renameTableExprCb; sWalker.xSelectCallback = renameTableSelectCb; sWalker.u.pRename = &sCtx; rc = renameParseSql(&sParse, zDb, 1, db, zInput, bTemp); if( rc==SQLITE_OK ){ if( sParse.pNewTable ){ Table *pTab = sParse.pNewTable; if( pTab->pSelect ){ NameContext sNC; memset(&sNC, 0, sizeof(sNC)); sNC.pParse = &sParse; sqlite3SelectPrep(&sParse, pTab->pSelect, &sNC); if( sParse.nErr ) rc = sParse.rc; sqlite3WalkSelect(&sWalker, pTab->pSelect); }else{ /* Modify any FK definitions to point to the new table. */ #ifndef SQLITE_OMIT_FOREIGN_KEY FKey *pFKey; for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){ if( sqlite3_stricmp(pFKey->zTo, zOld)==0 ){ renameTokenFind(&sParse, &sCtx, (void*)pFKey->zTo); } } #endif /* If this is the table being altered, fix any table refs in CHECK ** expressions. Also update the name that appears right after the ** "CREATE [VIRTUAL] TABLE" bit. */ if( sqlite3_stricmp(zOld, pTab->zName)==0 ){ sCtx.pTab = pTab; sqlite3WalkExprList(&sWalker, pTab->pCheck); renameTokenFind(&sParse, &sCtx, pTab->zName); } } } else if( sParse.pNewIndex ){ renameTokenFind(&sParse, &sCtx, sParse.pNewIndex->zName); sqlite3WalkExpr(&sWalker, sParse.pNewIndex->pPartIdxWhere); } #ifndef SQLITE_OMIT_TRIGGER else{ Trigger *pTrigger = sParse.pNewTrigger; TriggerStep *pStep; if( 0==sqlite3_stricmp(sParse.pNewTrigger->table, zOld) && sCtx.pTab->pSchema==pTrigger->pTabSchema ){ renameTokenFind(&sParse, &sCtx, sParse.pNewTrigger->table); } rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb); if( rc==SQLITE_OK ){ renameWalkTrigger(&sWalker, pTrigger); for(pStep=pTrigger->step_list; pStep; pStep=pStep->pNext){ if( pStep->zTarget && 0==sqlite3_stricmp(pStep->zTarget, zOld) ){ renameTokenFind(&sParse, &sCtx, pStep->zTarget); } } } } #endif } if( rc==SQLITE_OK ){ rc = renameEditSql(context, &sCtx, zInput, zNew, bQuote); } if( rc!=SQLITE_OK ){ if( sParse.zErrMsg ){ renameColumnParseError(context, 0, argv[1], argv[2], &sParse); }else{ sqlite3_result_error_code(context, rc); } } renameParseCleanup(&sParse); renameTokenFree(db, sCtx.pList); sqlite3BtreeLeaveAll(db); #ifndef SQLITE_OMIT_AUTHORIZATION db->xAuth = xAuth; #endif } return; } /* ** An SQL user function that checks that there are no parse or symbol ** resolution problems in a CREATE TRIGGER|TABLE|VIEW|INDEX statement. ** After an ALTER TABLE .. RENAME operation is performed and the schema ** reloaded, this function is called on each SQL statement in the schema ** to ensure that it is still usable. ** ** 0: Database name ("main", "temp" etc.). ** 1: SQL statement. ** 2: Object type ("view", "table", "trigger" or "index"). ** 3: Object name. ** 4: True if object is from temp schema. ** ** Unless it finds an error, this function normally returns NULL. However, it ** returns integer value 1 if: ** ** * the SQL argument creates a trigger, and ** * the table that the trigger is attached to is in database zDb. */ static void renameTableTest( sqlite3_context *context, int NotUsed, sqlite3_value **argv ){ sqlite3 *db = sqlite3_context_db_handle(context); char const *zDb = (const char*)sqlite3_value_text(argv[0]); char const *zInput = (const char*)sqlite3_value_text(argv[1]); int bTemp = sqlite3_value_int(argv[4]); #ifndef SQLITE_OMIT_AUTHORIZATION sqlite3_xauth xAuth = db->xAuth; db->xAuth = 0; #endif UNUSED_PARAMETER(NotUsed); if( zDb && zInput ){ int rc; Parse sParse; rc = renameParseSql(&sParse, zDb, 1, db, zInput, bTemp); if( rc==SQLITE_OK ){ if( sParse.pNewTable && sParse.pNewTable->pSelect ){ NameContext sNC; memset(&sNC, 0, sizeof(sNC)); sNC.pParse = &sParse; sqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, &sNC); if( sParse.nErr ) rc = sParse.rc; } else if( sParse.pNewTrigger ){ rc = renameResolveTrigger(&sParse, bTemp ? 0 : zDb); if( rc==SQLITE_OK ){ int i1 = sqlite3SchemaToIndex(db, sParse.pNewTrigger->pTabSchema); int i2 = sqlite3FindDbName(db, zDb); if( i1==i2 ) sqlite3_result_int(context, 1); } } } if( rc!=SQLITE_OK ){ renameColumnParseError(context, 1, argv[2], argv[3], &sParse); } renameParseCleanup(&sParse); } #ifndef SQLITE_OMIT_AUTHORIZATION db->xAuth = xAuth; #endif } /* ** Register built-in functions used to help implement ALTER TABLE */ SQLITE_PRIVATE void sqlite3AlterFunctions(void){ static FuncDef aAlterTableFuncs[] = { FUNCTION(sqlite_rename_column, 9, 0, 0, renameColumnFunc), FUNCTION(sqlite_rename_table, 7, 0, 0, renameTableFunc), FUNCTION(sqlite_rename_test, 5, 0, 0, renameTableTest), }; sqlite3InsertBuiltinFuncs(aAlterTableFuncs, ArraySize(aAlterTableFuncs)); } #endif /* SQLITE_ALTER_TABLE */ /************** End of alter.c ***********************************************/ /************** Begin file analyze.c *****************************************/ /* ** 2005-07-08 ** |
︙ | ︙ | |||
104620 104621 104622 104623 104624 104625 104626 | ){ sqlite3 *db = pParse->db; int rc; /* Don't do any authorization checks if the database is initialising ** or if the parser is being invoked from within sqlite3_declare_vtab. */ | | | 105462 105463 105464 105465 105466 105467 105468 105469 105470 105471 105472 105473 105474 105475 105476 | ){ sqlite3 *db = pParse->db; int rc; /* Don't do any authorization checks if the database is initialising ** or if the parser is being invoked from within sqlite3_declare_vtab. */ if( db->init.busy || IN_SPECIAL_PARSE ){ return SQLITE_OK; } if( db->xAuth==0 ){ return SQLITE_OK; } |
︙ | ︙ | |||
105126 105127 105128 105129 105130 105131 105132 | } return p; } /* ** Reclaim the memory used by an index */ | | | 105968 105969 105970 105971 105972 105973 105974 105975 105976 105977 105978 105979 105980 105981 105982 | } return p; } /* ** Reclaim the memory used by an index */ SQLITE_PRIVATE void sqlite3FreeIndex(sqlite3 *db, Index *p){ #ifndef SQLITE_OMIT_ANALYZE sqlite3DeleteIndexSamples(db, p); #endif sqlite3ExprDelete(db, p->pPartIdxWhere); sqlite3ExprListDelete(db, p->aColExpr); sqlite3DbFree(db, p->zColAff); if( p->isResized ) sqlite3DbFree(db, (void *)p->azColl); |
︙ | ︙ | |||
105166 105167 105168 105169 105170 105171 105172 | ** indices. */ p = pIndex->pTable->pIndex; while( ALWAYS(p) && p->pNext!=pIndex ){ p = p->pNext; } if( ALWAYS(p && p->pNext==pIndex) ){ p->pNext = pIndex->pNext; } } | | | 106008 106009 106010 106011 106012 106013 106014 106015 106016 106017 106018 106019 106020 106021 106022 | ** indices. */ p = pIndex->pTable->pIndex; while( ALWAYS(p) && p->pNext!=pIndex ){ p = p->pNext; } if( ALWAYS(p && p->pNext==pIndex) ){ p->pNext = pIndex->pNext; } } sqlite3FreeIndex(db, pIndex); } db->mDbFlags |= DBFLAG_SchemaChange; } /* ** Look through the list of open database files in db->aDb[] and if ** any have been closed, remove them from the list. Reallocate the |
︙ | ︙ | |||
105312 105313 105314 105315 105316 105317 105318 | char *zName = pIndex->zName; TESTONLY ( Index *pOld = ) sqlite3HashInsert( &pIndex->pSchema->idxHash, zName, 0 ); assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); assert( pOld==pIndex || pOld==0 ); } | | | 106154 106155 106156 106157 106158 106159 106160 106161 106162 106163 106164 106165 106166 106167 106168 | char *zName = pIndex->zName; TESTONLY ( Index *pOld = ) sqlite3HashInsert( &pIndex->pSchema->idxHash, zName, 0 ); assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); assert( pOld==pIndex || pOld==0 ); } sqlite3FreeIndex(db, pIndex); } /* Delete any foreign keys attached to this table. */ sqlite3FkDelete(db, pTable); /* Delete the Table structure itself. */ |
︙ | ︙ | |||
105470 105471 105472 105473 105474 105475 105476 | *pUnqual = pName2; iDb = sqlite3FindDb(db, pName1); if( iDb<0 ){ sqlite3ErrorMsg(pParse, "unknown database %T", pName1); return -1; } }else{ | | | 106312 106313 106314 106315 106316 106317 106318 106319 106320 106321 106322 106323 106324 106325 106326 | *pUnqual = pName2; iDb = sqlite3FindDb(db, pName1); if( iDb<0 ){ sqlite3ErrorMsg(pParse, "unknown database %T", pName1); return -1; } }else{ assert( db->init.iDb==0 || db->init.busy || IN_RENAME_OBJECT || (db->mDbFlags & DBFLAG_Vacuum)!=0); iDb = db->init.iDb; *pUnqual = pName1; } return iDb; } |
︙ | ︙ | |||
105565 105566 105567 105568 105569 105570 105571 105572 105573 105574 105575 105576 105577 105578 | /* If creating a temp table, the name may not be qualified. Unless ** the database name is "temp" anyway. */ sqlite3ErrorMsg(pParse, "temporary table name must be unqualified"); return; } if( !OMIT_TEMPDB && isTemp ) iDb = 1; zName = sqlite3NameFromToken(db, pName); } pParse->sNameToken = *pName; if( zName==0 ) return; if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ goto begin_table_error; } if( db->init.iDb==1 ) isTemp = 1; | > > > | 106407 106408 106409 106410 106411 106412 106413 106414 106415 106416 106417 106418 106419 106420 106421 106422 106423 | /* If creating a temp table, the name may not be qualified. Unless ** the database name is "temp" anyway. */ sqlite3ErrorMsg(pParse, "temporary table name must be unqualified"); return; } if( !OMIT_TEMPDB && isTemp ) iDb = 1; zName = sqlite3NameFromToken(db, pName); if( IN_RENAME_OBJECT ){ sqlite3RenameTokenMap(pParse, (void*)zName, pName); } } pParse->sNameToken = *pName; if( zName==0 ) return; if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ goto begin_table_error; } if( db->init.iDb==1 ) isTemp = 1; |
︙ | ︙ | |||
105600 105601 105602 105603 105604 105605 105606 | /* Make sure the new table name does not collide with an existing ** index or table name in the same database. Issue an error message if ** it does. The exception is if the statement being parsed was passed ** to an sqlite3_declare_vtab() call. In that case only the column names ** and types will be used, so there is no need to test for namespace ** collisions. */ | | | 106445 106446 106447 106448 106449 106450 106451 106452 106453 106454 106455 106456 106457 106458 106459 | /* Make sure the new table name does not collide with an existing ** index or table name in the same database. Issue an error message if ** it does. The exception is if the statement being parsed was passed ** to an sqlite3_declare_vtab() call. In that case only the column names ** and types will be used, so there is no need to test for namespace ** collisions. */ if( !IN_SPECIAL_PARSE ){ char *zDb = db->aDb[iDb].zDbSName; if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ goto begin_table_error; } pTable = sqlite3FindTable(db, zName, zDb); if( pTable ){ if( !noErr ){ |
︙ | ︙ | |||
105759 105760 105761 105762 105763 105764 105765 105766 105767 105768 105769 105770 105771 105772 | if( (p = pParse->pNewTable)==0 ) return; if( p->nCol+1>db->aLimit[SQLITE_LIMIT_COLUMN] ){ sqlite3ErrorMsg(pParse, "too many columns on %s", p->zName); return; } z = sqlite3DbMallocRaw(db, pName->n + pType->n + 2); if( z==0 ) return; memcpy(z, pName->z, pName->n); z[pName->n] = 0; sqlite3Dequote(z); for(i=0; i<p->nCol; i++){ if( sqlite3_stricmp(z, p->aCol[i].zName)==0 ){ sqlite3ErrorMsg(pParse, "duplicate column name: %s", z); sqlite3DbFree(db, z); | > | 106604 106605 106606 106607 106608 106609 106610 106611 106612 106613 106614 106615 106616 106617 106618 | if( (p = pParse->pNewTable)==0 ) return; if( p->nCol+1>db->aLimit[SQLITE_LIMIT_COLUMN] ){ sqlite3ErrorMsg(pParse, "too many columns on %s", p->zName); return; } z = sqlite3DbMallocRaw(db, pName->n + pType->n + 2); if( z==0 ) return; if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, pName); memcpy(z, pName->z, pName->n); z[pName->n] = 0; sqlite3Dequote(z); for(i=0; i<p->nCol; i++){ if( sqlite3_stricmp(z, p->aCol[i].zName)==0 ){ sqlite3ErrorMsg(pParse, "duplicate column name: %s", z); sqlite3DbFree(db, z); |
︙ | ︙ | |||
105965 105966 105967 105968 105969 105970 105971 105972 105973 105974 105975 105976 105977 105978 | x.u.zToken = sqlite3DbSpanDup(db, zStart, zEnd); x.pLeft = pExpr; x.flags = EP_Skip; pCol->pDflt = sqlite3ExprDup(db, &x, EXPRDUP_REDUCE); sqlite3DbFree(db, x.u.zToken); } } sqlite3ExprDelete(db, pExpr); } /* ** Backwards Compatibility Hack: ** ** Historical versions of SQLite accepted strings as column names in | > > > | 106811 106812 106813 106814 106815 106816 106817 106818 106819 106820 106821 106822 106823 106824 106825 106826 106827 | x.u.zToken = sqlite3DbSpanDup(db, zStart, zEnd); x.pLeft = pExpr; x.flags = EP_Skip; pCol->pDflt = sqlite3ExprDup(db, &x, EXPRDUP_REDUCE); sqlite3DbFree(db, x.u.zToken); } } if( IN_RENAME_OBJECT ){ sqlite3RenameExprUnmap(pParse, pExpr); } sqlite3ExprDelete(db, pExpr); } /* ** Backwards Compatibility Hack: ** ** Historical versions of SQLite accepted strings as column names in |
︙ | ︙ | |||
106056 106057 106058 106059 106060 106061 106062 106063 106064 106065 106066 106067 106068 106069 | } } if( nTerm==1 && pCol && sqlite3StrICmp(sqlite3ColumnType(pCol,""), "INTEGER")==0 && sortOrder!=SQLITE_SO_DESC ){ pTab->iPKey = iCol; pTab->keyConf = (u8)onError; assert( autoInc==0 || autoInc==1 ); pTab->tabFlags |= autoInc*TF_Autoincrement; if( pList ) pParse->iPkSortOrder = pList->a[0].sortOrder; }else if( autoInc ){ #ifndef SQLITE_OMIT_AUTOINCREMENT | > > > | 106905 106906 106907 106908 106909 106910 106911 106912 106913 106914 106915 106916 106917 106918 106919 106920 106921 | } } if( nTerm==1 && pCol && sqlite3StrICmp(sqlite3ColumnType(pCol,""), "INTEGER")==0 && sortOrder!=SQLITE_SO_DESC ){ if( IN_RENAME_OBJECT && pList ){ sqlite3RenameTokenRemap(pParse, &pTab->iPKey, pList->a[0].pExpr); } pTab->iPKey = iCol; pTab->keyConf = (u8)onError; assert( autoInc==0 || autoInc==1 ); pTab->tabFlags |= autoInc*TF_Autoincrement; if( pList ) pParse->iPkSortOrder = pList->a[0].sortOrder; }else if( autoInc ){ #ifndef SQLITE_OMIT_AUTOINCREMENT |
︙ | ︙ | |||
106858 106859 106860 106861 106862 106863 106864 | if( sqlite3FixSelect(&sFix, pSelect) ) goto create_view_fail; /* Make a copy of the entire SELECT statement that defines the view. ** This will force all the Expr.token.z values to be dynamically ** allocated rather than point to the input string - which means that ** they will persist after the current sqlite3_exec() call returns. */ | > > > > | > | 107710 107711 107712 107713 107714 107715 107716 107717 107718 107719 107720 107721 107722 107723 107724 107725 107726 107727 107728 107729 | if( sqlite3FixSelect(&sFix, pSelect) ) goto create_view_fail; /* Make a copy of the entire SELECT statement that defines the view. ** This will force all the Expr.token.z values to be dynamically ** allocated rather than point to the input string - which means that ** they will persist after the current sqlite3_exec() call returns. */ if( IN_RENAME_OBJECT ){ p->pSelect = pSelect; pSelect = 0; }else{ p->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); } p->pCheck = sqlite3ExprListDup(db, pCNames, EXPRDUP_REDUCE); if( db->mallocFailed ) goto create_view_fail; /* Locate the end of the CREATE VIEW statement. Make sEnd point to ** the end. */ sEnd = pParse->sLastToken; |
︙ | ︙ | |||
107426 107427 107428 107429 107430 107431 107432 107433 107434 107435 107436 107437 107438 107439 | if( pFKey==0 ){ goto fk_end; } pFKey->pFrom = p; pFKey->pNextFrom = p->pFKey; z = (char*)&pFKey->aCol[nCol]; pFKey->zTo = z; memcpy(z, pTo->z, pTo->n); z[pTo->n] = 0; sqlite3Dequote(z); z += pTo->n+1; pFKey->nCol = nCol; if( pFromCol==0 ){ pFKey->aCol[0].iFrom = p->nCol-1; | > > > | 108283 108284 108285 108286 108287 108288 108289 108290 108291 108292 108293 108294 108295 108296 108297 108298 108299 | if( pFKey==0 ){ goto fk_end; } pFKey->pFrom = p; pFKey->pNextFrom = p->pFKey; z = (char*)&pFKey->aCol[nCol]; pFKey->zTo = z; if( IN_RENAME_OBJECT ){ sqlite3RenameTokenMap(pParse, (void*)z, pTo); } memcpy(z, pTo->z, pTo->n); z[pTo->n] = 0; sqlite3Dequote(z); z += pTo->n+1; pFKey->nCol = nCol; if( pFromCol==0 ){ pFKey->aCol[0].iFrom = p->nCol-1; |
︙ | ︙ | |||
107448 107449 107450 107451 107452 107453 107454 107455 107456 107457 107458 107459 107460 107461 107462 107463 107464 107465 107466 107467 | } if( j>=p->nCol ){ sqlite3ErrorMsg(pParse, "unknown column \"%s\" in foreign key definition", pFromCol->a[i].zName); goto fk_end; } } } if( pToCol ){ for(i=0; i<nCol; i++){ int n = sqlite3Strlen30(pToCol->a[i].zName); pFKey->aCol[i].zCol = z; memcpy(z, pToCol->a[i].zName, n); z[n] = 0; z += n+1; } } pFKey->isDeferred = 0; pFKey->aAction[0] = (u8)(flags & 0xff); /* ON DELETE action */ | > > > > > > | 108308 108309 108310 108311 108312 108313 108314 108315 108316 108317 108318 108319 108320 108321 108322 108323 108324 108325 108326 108327 108328 108329 108330 108331 108332 108333 | } if( j>=p->nCol ){ sqlite3ErrorMsg(pParse, "unknown column \"%s\" in foreign key definition", pFromCol->a[i].zName); goto fk_end; } if( IN_RENAME_OBJECT ){ sqlite3RenameTokenRemap(pParse, &pFKey->aCol[i], pFromCol->a[i].zName); } } } if( pToCol ){ for(i=0; i<nCol; i++){ int n = sqlite3Strlen30(pToCol->a[i].zName); pFKey->aCol[i].zCol = z; if( IN_RENAME_OBJECT ){ sqlite3RenameTokenRemap(pParse, z, pToCol->a[i].zName); } memcpy(z, pToCol->a[i].zName, n); z[n] = 0; z += n+1; } } pFKey->isDeferred = 0; pFKey->aAction[0] = (u8)(flags & 0xff); /* ON DELETE action */ |
︙ | ︙ | |||
107786 107787 107788 107789 107790 107791 107792 | if( pName ){ zName = sqlite3NameFromToken(db, pName); if( zName==0 ) goto exit_create_index; assert( pName->z!=0 ); if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ goto exit_create_index; } | > | | | | | | | | | | | | | | | > | < > | 108652 108653 108654 108655 108656 108657 108658 108659 108660 108661 108662 108663 108664 108665 108666 108667 108668 108669 108670 108671 108672 108673 108674 108675 108676 108677 108678 108679 108680 108681 108682 108683 108684 108685 108686 108687 108688 108689 108690 108691 108692 108693 108694 108695 108696 108697 108698 108699 108700 108701 108702 108703 | if( pName ){ zName = sqlite3NameFromToken(db, pName); if( zName==0 ) goto exit_create_index; assert( pName->z!=0 ); if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ goto exit_create_index; } if( !IN_RENAME_OBJECT ){ if( !db->init.busy ){ if( sqlite3FindTable(db, zName, 0)!=0 ){ sqlite3ErrorMsg(pParse, "there is already a table named %s", zName); goto exit_create_index; } } if( sqlite3FindIndex(db, zName, pDb->zDbSName)!=0 ){ if( !ifNotExist ){ sqlite3ErrorMsg(pParse, "index %s already exists", zName); }else{ assert( !db->init.busy ); sqlite3CodeVerifySchema(pParse, iDb); } goto exit_create_index; } } }else{ int n; Index *pLoop; for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){} zName = sqlite3MPrintf(db, "sqlite_autoindex_%s_%d", pTab->zName, n); if( zName==0 ){ goto exit_create_index; } /* Automatic index names generated from within sqlite3_declare_vtab() ** must have names that are distinct from normal automatic index names. ** The following statement converts "sqlite3_autoindex..." into ** "sqlite3_butoindex..." in order to make the names distinct. ** The "vtab_err.test" test demonstrates the need of this statement. */ if( IN_SPECIAL_PARSE ) zName[7]++; } /* Check for authorization to create an index. */ #ifndef SQLITE_OMIT_AUTHORIZATION if( !IN_RENAME_OBJECT ){ const char *zDb = pDb->zDbSName; if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iDb), 0, zDb) ){ goto exit_create_index; } i = SQLITE_CREATE_INDEX; if( !OMIT_TEMPDB && iDb==1 ) i = SQLITE_CREATE_TEMP_INDEX; if( sqlite3AuthCheck(pParse, i, zName, pTab->zName, zDb) ){ |
︙ | ︙ | |||
107908 107909 107910 107911 107912 107913 107914 | ** a table column, store that column in aiColumn[]. For general expressions, ** populate pIndex->aColExpr and store XN_EXPR (-2) in aiColumn[]. ** ** TODO: Issue a warning if two or more columns of the index are identical. ** TODO: Issue a warning if the table primary key is used as part of the ** index key. */ | > > > > > | < | < < | < | 108776 108777 108778 108779 108780 108781 108782 108783 108784 108785 108786 108787 108788 108789 108790 108791 108792 108793 108794 108795 108796 108797 108798 108799 108800 108801 108802 108803 108804 108805 108806 108807 108808 108809 108810 108811 108812 | ** a table column, store that column in aiColumn[]. For general expressions, ** populate pIndex->aColExpr and store XN_EXPR (-2) in aiColumn[]. ** ** TODO: Issue a warning if two or more columns of the index are identical. ** TODO: Issue a warning if the table primary key is used as part of the ** index key. */ pListItem = pList->a; if( IN_RENAME_OBJECT ){ pIndex->aColExpr = pList; pList = 0; } for(i=0; i<pIndex->nKeyCol; i++, pListItem++){ Expr *pCExpr; /* The i-th index expression */ int requestedSortOrder; /* ASC or DESC on the i-th expression */ const char *zColl; /* Collation sequence name */ sqlite3StringToId(pListItem->pExpr); sqlite3ResolveSelfReference(pParse, pTab, NC_IdxExpr, pListItem->pExpr, 0); if( pParse->nErr ) goto exit_create_index; pCExpr = sqlite3ExprSkipCollate(pListItem->pExpr); if( pCExpr->op!=TK_COLUMN ){ if( pTab==pParse->pNewTable ){ sqlite3ErrorMsg(pParse, "expressions prohibited in PRIMARY KEY and " "UNIQUE constraints"); goto exit_create_index; } if( pIndex->aColExpr==0 ){ pIndex->aColExpr = pList; pList = 0; } j = XN_EXPR; pIndex->aiColumn[i] = XN_EXPR; pIndex->uniqNotNull = 0; }else{ j = pCExpr->iColumn; assert( j<=0x7fff ); |
︙ | ︙ | |||
108068 108069 108070 108071 108072 108073 108074 | } if( idxType==SQLITE_IDXTYPE_PRIMARYKEY ) pIdx->idxType = idxType; goto exit_create_index; } } } | > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | 108937 108938 108939 108940 108941 108942 108943 108944 108945 108946 108947 108948 108949 108950 108951 108952 108953 108954 108955 108956 108957 108958 108959 108960 108961 108962 108963 108964 108965 108966 108967 108968 108969 108970 108971 108972 108973 108974 108975 108976 108977 108978 108979 108980 108981 108982 108983 108984 108985 108986 108987 108988 108989 108990 108991 108992 108993 108994 108995 108996 108997 108998 108999 109000 109001 109002 109003 109004 109005 109006 109007 109008 109009 109010 109011 109012 109013 109014 109015 109016 109017 109018 109019 109020 109021 109022 109023 109024 109025 109026 109027 109028 109029 109030 109031 109032 109033 109034 109035 109036 109037 109038 109039 109040 109041 109042 109043 109044 109045 | } if( idxType==SQLITE_IDXTYPE_PRIMARYKEY ) pIdx->idxType = idxType; goto exit_create_index; } } } if( !IN_RENAME_OBJECT ){ /* Link the new Index structure to its table and to the other ** in-memory database structures. */ assert( pParse->nErr==0 ); if( db->init.busy ){ Index *p; assert( !IN_SPECIAL_PARSE ); assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); p = sqlite3HashInsert(&pIndex->pSchema->idxHash, pIndex->zName, pIndex); if( p ){ assert( p==pIndex ); /* Malloc must have failed */ sqlite3OomFault(db); goto exit_create_index; } db->mDbFlags |= DBFLAG_SchemaChange; if( pTblName!=0 ){ pIndex->tnum = db->init.newTnum; } } /* If this is the initial CREATE INDEX statement (or CREATE TABLE if the ** index is an implied index for a UNIQUE or PRIMARY KEY constraint) then ** emit code to allocate the index rootpage on disk and make an entry for ** the index in the sqlite_master table and populate the index with ** content. But, do not do this if we are simply reading the sqlite_master ** table to parse the schema, or if this index is the PRIMARY KEY index ** of a WITHOUT ROWID table. ** ** If pTblName==0 it means this index is generated as an implied PRIMARY KEY ** or UNIQUE index in a CREATE TABLE statement. Since the table ** has just been created, it contains no data and the index initialization ** step can be skipped. */ else if( HasRowid(pTab) || pTblName!=0 ){ Vdbe *v; char *zStmt; int iMem = ++pParse->nMem; v = sqlite3GetVdbe(pParse); if( v==0 ) goto exit_create_index; sqlite3BeginWriteOperation(pParse, 1, iDb); /* Create the rootpage for the index using CreateIndex. But before ** doing so, code a Noop instruction and store its address in ** Index.tnum. This is required in case this index is actually a ** PRIMARY KEY and the table is actually a WITHOUT ROWID table. In ** that case the convertToWithoutRowidTable() routine will replace ** the Noop with a Goto to jump over the VDBE code generated below. */ pIndex->tnum = sqlite3VdbeAddOp0(v, OP_Noop); sqlite3VdbeAddOp3(v, OP_CreateBtree, iDb, iMem, BTREE_BLOBKEY); /* Gather the complete text of the CREATE INDEX statement into ** the zStmt variable */ if( pStart ){ int n = (int)(pParse->sLastToken.z - pName->z) + pParse->sLastToken.n; if( pName->z[n-1]==';' ) n--; /* A named index with an explicit CREATE INDEX statement */ zStmt = sqlite3MPrintf(db, "CREATE%s INDEX %.*s", onError==OE_None ? "" : " UNIQUE", n, pName->z); }else{ /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */ /* zStmt = sqlite3MPrintf(""); */ zStmt = 0; } /* Add an entry in sqlite_master for this index */ sqlite3NestedParse(pParse, "INSERT INTO %Q.%s VALUES('index',%Q,%Q,#%d,%Q);", db->aDb[iDb].zDbSName, MASTER_NAME, pIndex->zName, pTab->zName, iMem, zStmt ); sqlite3DbFree(db, zStmt); /* Fill the index with data and reparse the schema. Code an OP_Expire ** to invalidate all pre-compiled statements. */ if( pTblName ){ sqlite3RefillIndex(pParse, pIndex, iMem); sqlite3ChangeCookie(pParse, iDb); sqlite3VdbeAddParseSchemaOp(v, iDb, sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName)); sqlite3VdbeAddOp2(v, OP_Expire, 0, 1); } sqlite3VdbeJumpHere(v, pIndex->tnum); } } /* When adding an index to the list of indices for a table, make ** sure all indices labeled OE_Replace come after all those labeled ** OE_Ignore. This is necessary for the correct constraint check ** processing (in sqlite3GenerateConstraintChecks()) as part of ** UPDATE and INSERT statements. |
︙ | ︙ | |||
108183 108184 108185 108186 108187 108188 108189 108190 108191 108192 | pOther = pOther->pNext; } pIndex->pNext = pOther->pNext; pOther->pNext = pIndex; } pIndex = 0; } /* Clean up before exiting */ exit_create_index: | > > > > > | | 109055 109056 109057 109058 109059 109060 109061 109062 109063 109064 109065 109066 109067 109068 109069 109070 109071 109072 109073 109074 109075 109076 109077 | pOther = pOther->pNext; } pIndex->pNext = pOther->pNext; pOther->pNext = pIndex; } pIndex = 0; } else if( IN_RENAME_OBJECT ){ assert( pParse->pNewIndex==0 ); pParse->pNewIndex = pIndex; pIndex = 0; } /* Clean up before exiting */ exit_create_index: if( pIndex ) sqlite3FreeIndex(db, pIndex); sqlite3ExprDelete(db, pPIWhere); sqlite3ExprListDelete(db, pList); sqlite3SrcListDelete(db, pTblName); sqlite3DbFree(db, zName); } /* |
︙ | ︙ | |||
108355 108356 108357 108358 108359 108360 108361 | /* ** Append a new element to the given IdList. Create a new IdList if ** need be. ** ** A new IdList is returned, or NULL if malloc() fails. */ | | > > > > | 109232 109233 109234 109235 109236 109237 109238 109239 109240 109241 109242 109243 109244 109245 109246 109247 109248 109249 109250 109251 109252 109253 109254 109255 109256 109257 109258 109259 109260 109261 109262 109263 109264 109265 109266 109267 | /* ** Append a new element to the given IdList. Create a new IdList if ** need be. ** ** A new IdList is returned, or NULL if malloc() fails. */ SQLITE_PRIVATE IdList *sqlite3IdListAppend(Parse *pParse, IdList *pList, Token *pToken){ sqlite3 *db = pParse->db; int i; if( pList==0 ){ pList = sqlite3DbMallocZero(db, sizeof(IdList) ); if( pList==0 ) return 0; } pList->a = sqlite3ArrayAllocate( db, pList->a, sizeof(pList->a[0]), &pList->nId, &i ); if( i<0 ){ sqlite3IdListDelete(db, pList); return 0; } pList->a[i].zName = sqlite3NameFromToken(db, pToken); if( IN_RENAME_OBJECT && pList->a[i].zName ){ sqlite3RenameTokenMap(pParse, (void*)pList->a[i].zName, pToken); } return pList; } /* ** Delete an IdList. */ SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3 *db, IdList *pList){ |
︙ | ︙ | |||
108619 108620 108621 108622 108623 108624 108625 108626 108627 108628 108629 108630 108631 108632 | } p = sqlite3SrcListAppend(db, p, pTable, pDatabase); if( p==0 ){ goto append_from_error; } assert( p->nSrc>0 ); pItem = &p->a[p->nSrc-1]; assert( pAlias!=0 ); if( pAlias->n ){ pItem->zAlias = sqlite3NameFromToken(db, pAlias); } pItem->pSelect = pSubquery; pItem->pOn = pOn; pItem->pUsing = pUsing; | > > > > | 109500 109501 109502 109503 109504 109505 109506 109507 109508 109509 109510 109511 109512 109513 109514 109515 109516 109517 | } p = sqlite3SrcListAppend(db, p, pTable, pDatabase); if( p==0 ){ goto append_from_error; } assert( p->nSrc>0 ); pItem = &p->a[p->nSrc-1]; if( IN_RENAME_OBJECT && pItem->zName ){ Token *pToken = (pDatabase && pDatabase->z) ? pDatabase : pTable; sqlite3RenameTokenMap(pParse, pItem->zName, pToken); } assert( pAlias!=0 ); if( pAlias->n ){ pItem->zAlias = sqlite3NameFromToken(db, pAlias); } pItem->pSelect = pSubquery; pItem->pOn = pOn; pItem->pUsing = pUsing; |
︙ | ︙ | |||
121269 121270 121271 121272 121273 121274 121275 | */ static void corruptSchema( InitData *pData, /* Initialization context */ const char *zObj, /* Object being parsed at the point of error */ const char *zExtra /* Error information */ ){ sqlite3 *db = pData->db; | > > > > > > > | > > < > < | 122154 122155 122156 122157 122158 122159 122160 122161 122162 122163 122164 122165 122166 122167 122168 122169 122170 122171 122172 122173 122174 122175 122176 122177 122178 122179 122180 122181 122182 122183 122184 | */ static void corruptSchema( InitData *pData, /* Initialization context */ const char *zObj, /* Object being parsed at the point of error */ const char *zExtra /* Error information */ ){ sqlite3 *db = pData->db; if( db->mallocFailed ){ pData->rc = SQLITE_NOMEM_BKPT; }else if( pData->pzErrMsg[0]!=0 ){ /* A error message has already been generated. Do not overwrite it */ }else if( pData->mInitFlags & INITFLAG_AlterTable ){ *pData->pzErrMsg = sqlite3DbStrDup(db, zExtra); pData->rc = SQLITE_ERROR; }else if( db->flags & SQLITE_WriteSchema ){ pData->rc = SQLITE_CORRUPT_BKPT; }else{ char *z; if( zObj==0 ) zObj = "?"; z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj); if( zExtra && zExtra[0] ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra); *pData->pzErrMsg = z; pData->rc = SQLITE_CORRUPT_BKPT; } } /* ** This is the callback routine for the code that initializes the ** database. See sqlite3Init() below for additional information. ** This routine is also called from the OP_ParseSchema opcode of the VDBE. ** |
︙ | ︙ | |||
121329 121330 121331 121332 121333 121334 121335 | db->init.iDb = iDb; db->init.newTnum = sqlite3Atoi(argv[1]); db->init.orphanTrigger = 0; TESTONLY(rcp = ) sqlite3_prepare(db, argv[2], -1, &pStmt, 0); rc = db->errCode; assert( (rc&0xFF)==(rcp&0xFF) ); db->init.iDb = saved_iDb; | | | 122222 122223 122224 122225 122226 122227 122228 122229 122230 122231 122232 122233 122234 122235 122236 | db->init.iDb = iDb; db->init.newTnum = sqlite3Atoi(argv[1]); db->init.orphanTrigger = 0; TESTONLY(rcp = ) sqlite3_prepare(db, argv[2], -1, &pStmt, 0); rc = db->errCode; assert( (rc&0xFF)==(rcp&0xFF) ); db->init.iDb = saved_iDb; /* assert( saved_iDb==0 || (db->mDbFlags & DBFLAG_Vacuum)!=0 ); */ if( SQLITE_OK!=rc ){ if( db->init.orphanTrigger ){ assert( iDb==1 ); }else{ pData->rc = rc; if( rc==SQLITE_NOMEM ){ sqlite3OomFault(db); |
︙ | ︙ | |||
121376 121377 121378 121379 121380 121381 121382 | ** Attempt to read the database schema and initialize internal ** data structures for a single database file. The index of the ** database file is given by iDb. iDb==0 is used for the main ** database. iDb==1 should never be used. iDb>=2 is used for ** auxiliary databases. Return one of the SQLITE_ error codes to ** indicate success or failure. */ | | | 122269 122270 122271 122272 122273 122274 122275 122276 122277 122278 122279 122280 122281 122282 122283 | ** Attempt to read the database schema and initialize internal ** data structures for a single database file. The index of the ** database file is given by iDb. iDb==0 is used for the main ** database. iDb==1 should never be used. iDb>=2 is used for ** auxiliary databases. Return one of the SQLITE_ error codes to ** indicate success or failure. */ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFlags){ int rc; int i; #ifndef SQLITE_OMIT_DEPRECATED int size; #endif Db *pDb; char const *azArg[4]; |
︙ | ︙ | |||
121411 121412 121413 121414 121415 121416 121417 121418 121419 121420 121421 121422 121423 121424 | azArg[2] = "CREATE TABLE x(type text,name text,tbl_name text," "rootpage int,sql text)"; azArg[3] = 0; initData.db = db; initData.iDb = iDb; initData.rc = SQLITE_OK; initData.pzErrMsg = pzErrMsg; sqlite3InitCallback(&initData, 3, (char **)azArg, 0); if( initData.rc ){ rc = initData.rc; goto error_out; } /* Create a cursor to hold the database open | > | 122304 122305 122306 122307 122308 122309 122310 122311 122312 122313 122314 122315 122316 122317 122318 | azArg[2] = "CREATE TABLE x(type text,name text,tbl_name text," "rootpage int,sql text)"; azArg[3] = 0; initData.db = db; initData.iDb = iDb; initData.rc = SQLITE_OK; initData.pzErrMsg = pzErrMsg; initData.mInitFlags = mFlags; sqlite3InitCallback(&initData, 3, (char **)azArg, 0); if( initData.rc ){ rc = initData.rc; goto error_out; } /* Create a cursor to hold the database open |
︙ | ︙ | |||
121617 121618 121619 121620 121621 121622 121623 | assert( sqlite3_mutex_held(db->mutex) ); assert( sqlite3BtreeHoldsMutex(db->aDb[0].pBt) ); assert( db->init.busy==0 ); ENC(db) = SCHEMA_ENC(db); assert( db->nDb>0 ); /* Do the main schema first */ if( !DbHasProperty(db, 0, DB_SchemaLoaded) ){ | | | | 122511 122512 122513 122514 122515 122516 122517 122518 122519 122520 122521 122522 122523 122524 122525 122526 122527 122528 122529 122530 122531 122532 | assert( sqlite3_mutex_held(db->mutex) ); assert( sqlite3BtreeHoldsMutex(db->aDb[0].pBt) ); assert( db->init.busy==0 ); ENC(db) = SCHEMA_ENC(db); assert( db->nDb>0 ); /* Do the main schema first */ if( !DbHasProperty(db, 0, DB_SchemaLoaded) ){ rc = sqlite3InitOne(db, 0, pzErrMsg, 0); if( rc ) return rc; } /* All other schemas after the main schema. The "temp" schema must be last */ for(i=db->nDb-1; i>0; i--){ assert( i==1 || sqlite3BtreeHoldsMutex(db->aDb[i].pBt) ); if( !DbHasProperty(db, i, DB_SchemaLoaded) ){ rc = sqlite3InitOne(db, i, pzErrMsg, 0); if( rc ) return rc; } } if( commit_internal ){ sqlite3CommitInternalChanges(db); } return SQLITE_OK; |
︙ | ︙ | |||
129134 129135 129136 129137 129138 129139 129140 | /* Check that the trigger name is not reserved and that no trigger of the ** specified name exists */ zName = sqlite3NameFromToken(db, pName); if( !zName || SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ goto trigger_cleanup; } assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); | > | | | | | | | | > | 130028 130029 130030 130031 130032 130033 130034 130035 130036 130037 130038 130039 130040 130041 130042 130043 130044 130045 130046 130047 130048 130049 130050 130051 | /* Check that the trigger name is not reserved and that no trigger of the ** specified name exists */ zName = sqlite3NameFromToken(db, pName); if( !zName || SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ goto trigger_cleanup; } assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); if( !IN_RENAME_OBJECT ){ if( sqlite3HashFind(&(db->aDb[iDb].pSchema->trigHash),zName) ){ if( !noErr ){ sqlite3ErrorMsg(pParse, "trigger %T already exists", pName); }else{ assert( !db->init.busy ); sqlite3CodeVerifySchema(pParse, iDb); } goto trigger_cleanup; } } /* Do not create a trigger on a system table */ if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){ sqlite3ErrorMsg(pParse, "cannot create trigger on system table"); goto trigger_cleanup; } |
︙ | ︙ | |||
129165 129166 129167 129168 129169 129170 129171 | if( !pTab->pSelect && tr_tm==TK_INSTEAD ){ sqlite3ErrorMsg(pParse, "cannot create INSTEAD OF" " trigger on table: %S", pTableName, 0); goto trigger_cleanup; } #ifndef SQLITE_OMIT_AUTHORIZATION | < > | 130061 130062 130063 130064 130065 130066 130067 130068 130069 130070 130071 130072 130073 130074 130075 | if( !pTab->pSelect && tr_tm==TK_INSTEAD ){ sqlite3ErrorMsg(pParse, "cannot create INSTEAD OF" " trigger on table: %S", pTableName, 0); goto trigger_cleanup; } #ifndef SQLITE_OMIT_AUTHORIZATION if( !IN_RENAME_OBJECT ){ int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema); int code = SQLITE_CREATE_TRIGGER; const char *zDb = db->aDb[iTabDb].zDbSName; const char *zDbTrig = isTemp ? db->aDb[1].zDbSName : zDb; if( iTabDb==1 || isTemp ) code = SQLITE_CREATE_TEMP_TRIGGER; if( sqlite3AuthCheck(pParse, code, zName, pTab->zName, zDbTrig) ){ goto trigger_cleanup; |
︙ | ︙ | |||
129199 129200 129201 129202 129203 129204 129205 | pTrigger->zName = zName; zName = 0; pTrigger->table = sqlite3DbStrDup(db, pTableName->a[0].zName); pTrigger->pSchema = db->aDb[iDb].pSchema; pTrigger->pTabSchema = pTab->pSchema; pTrigger->op = (u8)op; pTrigger->tr_tm = tr_tm==TK_BEFORE ? TRIGGER_BEFORE : TRIGGER_AFTER; | > > > > > | > | > | 130095 130096 130097 130098 130099 130100 130101 130102 130103 130104 130105 130106 130107 130108 130109 130110 130111 130112 130113 130114 130115 130116 130117 | pTrigger->zName = zName; zName = 0; pTrigger->table = sqlite3DbStrDup(db, pTableName->a[0].zName); pTrigger->pSchema = db->aDb[iDb].pSchema; pTrigger->pTabSchema = pTab->pSchema; pTrigger->op = (u8)op; pTrigger->tr_tm = tr_tm==TK_BEFORE ? TRIGGER_BEFORE : TRIGGER_AFTER; if( IN_RENAME_OBJECT ){ sqlite3RenameTokenRemap(pParse, pTrigger->table, pTableName->a[0].zName); pTrigger->pWhen = pWhen; pWhen = 0; }else{ pTrigger->pWhen = sqlite3ExprDup(db, pWhen, EXPRDUP_REDUCE); } pTrigger->pColumns = pColumns; pColumns = 0; assert( pParse->pNewTrigger==0 ); pParse->pNewTrigger = pTrigger; trigger_cleanup: sqlite3DbFree(db, zName); sqlite3SrcListDelete(db, pTableName); sqlite3IdListDelete(db, pColumns); |
︙ | ︙ | |||
129248 129249 129250 129251 129252 129253 129254 129255 129256 129257 129258 129259 129260 129261 | sqlite3TokenInit(&nameToken, pTrig->zName); sqlite3FixInit(&sFix, pParse, iDb, "trigger", &nameToken); if( sqlite3FixTriggerStep(&sFix, pTrig->step_list) || sqlite3FixExpr(&sFix, pTrig->pWhen) ){ goto triggerfinish_cleanup; } /* if we are not initializing, ** build the sqlite_master entry */ if( !db->init.busy ){ Vdbe *v; char *z; | > > > > > > > > | 130151 130152 130153 130154 130155 130156 130157 130158 130159 130160 130161 130162 130163 130164 130165 130166 130167 130168 130169 130170 130171 130172 | sqlite3TokenInit(&nameToken, pTrig->zName); sqlite3FixInit(&sFix, pParse, iDb, "trigger", &nameToken); if( sqlite3FixTriggerStep(&sFix, pTrig->step_list) || sqlite3FixExpr(&sFix, pTrig->pWhen) ){ goto triggerfinish_cleanup; } #ifndef SQLITE_OMIT_ALTERTABLE if( IN_RENAME_OBJECT ){ assert( !db->init.busy ); pParse->pNewTrigger = pTrig; pTrig = 0; }else #endif /* if we are not initializing, ** build the sqlite_master entry */ if( !db->init.busy ){ Vdbe *v; char *z; |
︙ | ︙ | |||
129290 129291 129292 129293 129294 129295 129296 | pLink->pNext = pTab->pTrigger; pTab->pTrigger = pLink; } } triggerfinish_cleanup: sqlite3DeleteTrigger(db, pTrig); | | | 130201 130202 130203 130204 130205 130206 130207 130208 130209 130210 130211 130212 130213 130214 130215 | pLink->pNext = pTab->pTrigger; pTab->pTrigger = pLink; } } triggerfinish_cleanup: sqlite3DeleteTrigger(db, pTrig); assert( IN_RENAME_OBJECT || !pParse->pNewTrigger ); sqlite3DeleteTriggerStep(db, pStepList); } /* ** Duplicate a range of text from an SQL statement, then convert all ** whitespace characters into ordinary space characters. */ |
︙ | ︙ | |||
129337 129338 129339 129340 129341 129342 129343 | /* ** Allocate space to hold a new trigger step. The allocated space ** holds both the TriggerStep object and the TriggerStep.target.z string. ** ** If an OOM error occurs, NULL is returned and db->mallocFailed is set. */ static TriggerStep *triggerStepAllocate( | | > > > > | > | > > > > | > | > | > > > > > > | | > | > | > > > > | > | 130248 130249 130250 130251 130252 130253 130254 130255 130256 130257 130258 130259 130260 130261 130262 130263 130264 130265 130266 130267 130268 130269 130270 130271 130272 130273 130274 130275 130276 130277 130278 130279 130280 130281 130282 130283 130284 130285 130286 130287 130288 130289 130290 130291 130292 130293 130294 130295 130296 130297 130298 130299 130300 130301 130302 130303 130304 130305 130306 130307 130308 130309 130310 130311 130312 130313 130314 130315 130316 130317 130318 130319 130320 130321 130322 130323 130324 130325 130326 130327 130328 130329 130330 130331 130332 130333 130334 130335 130336 130337 130338 130339 130340 130341 130342 130343 130344 130345 130346 130347 130348 130349 130350 130351 130352 130353 130354 130355 130356 130357 130358 130359 130360 130361 130362 130363 130364 130365 130366 130367 130368 130369 130370 130371 130372 130373 130374 130375 130376 130377 130378 130379 130380 130381 130382 130383 130384 130385 130386 130387 | /* ** Allocate space to hold a new trigger step. The allocated space ** holds both the TriggerStep object and the TriggerStep.target.z string. ** ** If an OOM error occurs, NULL is returned and db->mallocFailed is set. */ static TriggerStep *triggerStepAllocate( Parse *pParse, /* Parser context */ u8 op, /* Trigger opcode */ Token *pName, /* The target name */ const char *zStart, /* Start of SQL text */ const char *zEnd /* End of SQL text */ ){ sqlite3 *db = pParse->db; TriggerStep *pTriggerStep; pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep) + pName->n + 1); if( pTriggerStep ){ char *z = (char*)&pTriggerStep[1]; memcpy(z, pName->z, pName->n); sqlite3Dequote(z); pTriggerStep->zTarget = z; pTriggerStep->op = op; pTriggerStep->zSpan = triggerSpanDup(db, zStart, zEnd); if( IN_RENAME_OBJECT ){ sqlite3RenameTokenMap(pParse, pTriggerStep->zTarget, pName); } } return pTriggerStep; } /* ** Build a trigger step out of an INSERT statement. Return a pointer ** to the new trigger step. ** ** The parser calls this routine when it sees an INSERT inside the ** body of a trigger. */ SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep( Parse *pParse, /* Parser */ Token *pTableName, /* Name of the table into which we insert */ IdList *pColumn, /* List of columns in pTableName to insert into */ Select *pSelect, /* A SELECT statement that supplies values */ u8 orconf, /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */ Upsert *pUpsert, /* ON CONFLICT clauses for upsert */ const char *zStart, /* Start of SQL text */ const char *zEnd /* End of SQL text */ ){ sqlite3 *db = pParse->db; TriggerStep *pTriggerStep; assert(pSelect != 0 || db->mallocFailed); pTriggerStep = triggerStepAllocate(pParse, TK_INSERT, pTableName,zStart,zEnd); if( pTriggerStep ){ if( IN_RENAME_OBJECT ){ pTriggerStep->pSelect = pSelect; pSelect = 0; }else{ pTriggerStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); } pTriggerStep->pIdList = pColumn; pTriggerStep->pUpsert = pUpsert; pTriggerStep->orconf = orconf; }else{ testcase( pColumn ); sqlite3IdListDelete(db, pColumn); testcase( pUpsert ); sqlite3UpsertDelete(db, pUpsert); } sqlite3SelectDelete(db, pSelect); return pTriggerStep; } /* ** Construct a trigger step that implements an UPDATE statement and return ** a pointer to that trigger step. The parser calls this routine when it ** sees an UPDATE statement inside the body of a CREATE TRIGGER. */ SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep( Parse *pParse, /* Parser */ Token *pTableName, /* Name of the table to be updated */ ExprList *pEList, /* The SET clause: list of column and new values */ Expr *pWhere, /* The WHERE clause */ u8 orconf, /* The conflict algorithm. (OE_Abort, OE_Ignore, etc) */ const char *zStart, /* Start of SQL text */ const char *zEnd /* End of SQL text */ ){ sqlite3 *db = pParse->db; TriggerStep *pTriggerStep; pTriggerStep = triggerStepAllocate(pParse, TK_UPDATE, pTableName,zStart,zEnd); if( pTriggerStep ){ if( IN_RENAME_OBJECT ){ pTriggerStep->pExprList = pEList; pTriggerStep->pWhere = pWhere; pEList = 0; pWhere = 0; }else{ pTriggerStep->pExprList = sqlite3ExprListDup(db, pEList, EXPRDUP_REDUCE); pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE); } pTriggerStep->orconf = orconf; } sqlite3ExprListDelete(db, pEList); sqlite3ExprDelete(db, pWhere); return pTriggerStep; } /* ** Construct a trigger step that implements a DELETE statement and return ** a pointer to that trigger step. The parser calls this routine when it ** sees a DELETE statement inside the body of a CREATE TRIGGER. */ SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep( Parse *pParse, /* Parser */ Token *pTableName, /* The table from which rows are deleted */ Expr *pWhere, /* The WHERE clause */ const char *zStart, /* Start of SQL text */ const char *zEnd /* End of SQL text */ ){ sqlite3 *db = pParse->db; TriggerStep *pTriggerStep; pTriggerStep = triggerStepAllocate(pParse, TK_DELETE, pTableName,zStart,zEnd); if( pTriggerStep ){ if( IN_RENAME_OBJECT ){ pTriggerStep->pWhere = pWhere; pWhere = 0; }else{ pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE); } pTriggerStep->orconf = OE_Default; } sqlite3ExprDelete(db, pWhere); return pTriggerStep; } /* |
︙ | ︙ | |||
132436 132437 132438 132439 132440 132441 132442 | sqlite3_mutex_leave(db->mutex); return SQLITE_MISUSE_BKPT; } pTab = pCtx->pTab; assert( IsVirtual(pTab) ); memset(&sParse, 0, sizeof(sParse)); | | | 133371 133372 133373 133374 133375 133376 133377 133378 133379 133380 133381 133382 133383 133384 133385 | sqlite3_mutex_leave(db->mutex); return SQLITE_MISUSE_BKPT; } pTab = pCtx->pTab; assert( IsVirtual(pTab) ); memset(&sParse, 0, sizeof(sParse)); sParse.eParseMode = PARSE_MODE_DECLARE_VTAB; sParse.db = db; sParse.nQueryLoop = 1; if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable, &zErr) && sParse.pNewTable && !db->mallocFailed && !sParse.pNewTable->pSelect && !IsVirtual(sParse.pNewTable) |
︙ | ︙ | |||
132477 132478 132479 132480 132481 132482 132483 | } pCtx->bDeclared = 1; }else{ sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr); sqlite3DbFree(db, zErr); rc = SQLITE_ERROR; } | | | 133412 133413 133414 133415 133416 133417 133418 133419 133420 133421 133422 133423 133424 133425 133426 | } pCtx->bDeclared = 1; }else{ sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr); sqlite3DbFree(db, zErr); rc = SQLITE_ERROR; } sParse.eParseMode = PARSE_MODE_NORMAL; if( sParse.pVdbe ){ sqlite3VdbeFinalize(sParse.pVdbe); } sqlite3DeleteTable(db, sParse.pNewTable); sqlite3ParserReset(&sParse); |
︙ | ︙ | |||
144968 144969 144970 144971 144972 144973 144974 | /* Construct a new Expr object from a single identifier. Use the ** new Expr to populate pOut. Set the span of pOut to be the identifier ** that created the expression. */ static Expr *tokenExpr(Parse *pParse, int op, Token t){ Expr *p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr)+t.n+1); if( p ){ | | > > > > > > > > > > > > > > > | | 145903 145904 145905 145906 145907 145908 145909 145910 145911 145912 145913 145914 145915 145916 145917 145918 145919 145920 145921 145922 145923 145924 145925 145926 145927 145928 145929 145930 145931 145932 145933 145934 145935 145936 145937 145938 145939 145940 145941 145942 145943 145944 145945 145946 145947 145948 145949 145950 145951 145952 145953 145954 | /* Construct a new Expr object from a single identifier. Use the ** new Expr to populate pOut. Set the span of pOut to be the identifier ** that created the expression. */ static Expr *tokenExpr(Parse *pParse, int op, Token t){ Expr *p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr)+t.n+1); if( p ){ /* memset(p, 0, sizeof(Expr)); */ p->op = (u8)op; p->affinity = 0; p->flags = EP_Leaf; p->iAgg = -1; p->pLeft = p->pRight = 0; p->x.pList = 0; p->pAggInfo = 0; p->pTab = 0; p->op2 = 0; p->iTable = 0; p->iColumn = 0; #ifndef SQLITE_OMIT_WINDOWFUNC p->pWin = 0; #endif p->u.zToken = (char*)&p[1]; memcpy(p->u.zToken, t.z, t.n); p->u.zToken[t.n] = 0; if( sqlite3Isquote(p->u.zToken[0]) ){ if( p->u.zToken[0]=='"' ) p->flags |= EP_DblQuoted; sqlite3Dequote(p->u.zToken); } #if SQLITE_MAX_EXPR_DEPTH>0 p->nHeight = 1; #endif if( IN_RENAME_OBJECT ){ return (Expr*)sqlite3RenameTokenMap(pParse, (void*)p, &t); } } return p; } /* A routine to convert a binary TK_IS or TK_ISNOT expression into a ** unary TK_ISNULL or TK_NOTNULL expression. */ static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){ sqlite3 *db = pParse->db; if( pA && pY && pY->op==TK_NULL && !IN_RENAME_OBJECT ){ pA->op = (u8)op; sqlite3ExprDelete(db, pA->pRight); pA->pRight = 0; } } /* Add a single new term to an ExprList that is used to store a |
︙ | ︙ | |||
145118 145119 145120 145121 145122 145123 145124 | #define sqlite3ParserARG_STORE #define sqlite3ParserCTX_SDECL Parse *pParse; #define sqlite3ParserCTX_PDECL ,Parse *pParse #define sqlite3ParserCTX_PARAM ,pParse #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; #define YYFALLBACK 1 | | | | | | | | | | | | 146068 146069 146070 146071 146072 146073 146074 146075 146076 146077 146078 146079 146080 146081 146082 146083 146084 146085 146086 146087 146088 146089 146090 146091 146092 | #define sqlite3ParserARG_STORE #define sqlite3ParserCTX_SDECL Parse *pParse; #define sqlite3ParserCTX_PDECL ,Parse *pParse #define sqlite3ParserCTX_PARAM ,pParse #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; #define YYFALLBACK 1 #define YYNSTATE 521 #define YYNRULE 367 #define YYNTOKEN 155 #define YY_MAX_SHIFT 520 #define YY_MIN_SHIFTREDUCE 756 #define YY_MAX_SHIFTREDUCE 1122 #define YY_ERROR_ACTION 1123 #define YY_ACCEPT_ACTION 1124 #define YY_NO_ACTION 1125 #define YY_MIN_REDUCE 1126 #define YY_MAX_REDUCE 1492 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) /* Define the yytestcase() macro to be a no-op if is not already defined ** otherwise. ** ** Applications can choose to define yytestcase() in the %include section |
︙ | ︙ | |||
145197 145198 145199 145200 145201 145202 145203 | ** yy_reduce_ofst[] For each state, the offset into yy_action for ** shifting non-terminals after a reduce. ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ #define YY_ACTTAB_COUNT (2009) static const YYACTIONTYPE yy_action[] = { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 146147 146148 146149 146150 146151 146152 146153 146154 146155 146156 146157 146158 146159 146160 146161 146162 146163 146164 146165 146166 146167 146168 146169 146170 146171 146172 146173 146174 146175 146176 146177 146178 146179 146180 146181 146182 146183 146184 146185 146186 146187 146188 146189 146190 146191 146192 146193 146194 146195 146196 146197 146198 146199 146200 146201 146202 146203 146204 146205 146206 146207 146208 146209 146210 146211 146212 146213 146214 146215 146216 146217 146218 146219 146220 146221 146222 146223 146224 146225 146226 146227 146228 146229 146230 146231 146232 146233 146234 146235 146236 146237 146238 146239 146240 146241 146242 146243 146244 146245 146246 146247 146248 146249 146250 146251 146252 146253 146254 146255 146256 146257 146258 146259 146260 146261 146262 146263 146264 146265 146266 146267 146268 146269 146270 146271 146272 146273 146274 146275 146276 146277 146278 146279 146280 146281 146282 146283 146284 146285 146286 146287 146288 146289 146290 146291 146292 146293 146294 146295 146296 146297 146298 146299 146300 146301 146302 146303 146304 146305 146306 146307 146308 146309 146310 146311 146312 146313 146314 146315 146316 146317 146318 146319 146320 146321 146322 146323 146324 146325 146326 146327 146328 146329 146330 146331 146332 146333 146334 146335 146336 146337 146338 146339 146340 146341 146342 146343 146344 146345 146346 146347 146348 146349 146350 146351 146352 146353 146354 146355 146356 146357 146358 146359 146360 146361 | ** yy_reduce_ofst[] For each state, the offset into yy_action for ** shifting non-terminals after a reduce. ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ #define YY_ACTTAB_COUNT (2009) static const YYACTIONTYPE yy_action[] = { /* 0 */ 368, 105, 102, 197, 105, 102, 197, 515, 1124, 1, /* 10 */ 1, 520, 2, 1128, 515, 1192, 1171, 1456, 275, 370, /* 20 */ 127, 1389, 1197, 1197, 1192, 1166, 178, 1205, 64, 64, /* 30 */ 477, 887, 322, 428, 348, 37, 37, 808, 362, 888, /* 40 */ 509, 509, 509, 112, 113, 103, 1100, 1100, 953, 956, /* 50 */ 946, 946, 110, 110, 111, 111, 111, 111, 365, 252, /* 60 */ 252, 515, 252, 252, 497, 515, 309, 515, 459, 515, /* 70 */ 1079, 491, 512, 478, 6, 512, 809, 134, 498, 228, /* 80 */ 194, 428, 37, 37, 515, 208, 64, 64, 64, 64, /* 90 */ 13, 13, 109, 109, 109, 109, 108, 108, 107, 107, /* 100 */ 107, 106, 401, 258, 381, 13, 13, 398, 397, 428, /* 110 */ 252, 252, 370, 476, 405, 1104, 1079, 1080, 1081, 386, /* 120 */ 1106, 390, 497, 512, 497, 1423, 1419, 304, 1105, 307, /* 130 */ 1256, 496, 370, 499, 16, 16, 112, 113, 103, 1100, /* 140 */ 1100, 953, 956, 946, 946, 110, 110, 111, 111, 111, /* 150 */ 111, 262, 1107, 495, 1107, 401, 112, 113, 103, 1100, /* 160 */ 1100, 953, 956, 946, 946, 110, 110, 111, 111, 111, /* 170 */ 111, 129, 1425, 343, 1420, 339, 1059, 492, 1057, 263, /* 180 */ 73, 105, 102, 197, 994, 109, 109, 109, 109, 108, /* 190 */ 108, 107, 107, 107, 106, 401, 370, 111, 111, 111, /* 200 */ 111, 104, 492, 89, 1432, 109, 109, 109, 109, 108, /* 210 */ 108, 107, 107, 107, 106, 401, 111, 111, 111, 111, /* 220 */ 112, 113, 103, 1100, 1100, 953, 956, 946, 946, 110, /* 230 */ 110, 111, 111, 111, 111, 109, 109, 109, 109, 108, /* 240 */ 108, 107, 107, 107, 106, 401, 114, 108, 108, 107, /* 250 */ 107, 107, 106, 401, 109, 109, 109, 109, 108, 108, /* 260 */ 107, 107, 107, 106, 401, 152, 399, 399, 399, 109, /* 270 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 401, /* 280 */ 178, 493, 1412, 434, 1037, 1486, 1079, 515, 1486, 370, /* 290 */ 421, 297, 357, 412, 74, 1079, 109, 109, 109, 109, /* 300 */ 108, 108, 107, 107, 107, 106, 401, 1413, 37, 37, /* 310 */ 1431, 274, 506, 112, 113, 103, 1100, 1100, 953, 956, /* 320 */ 946, 946, 110, 110, 111, 111, 111, 111, 1436, 520, /* 330 */ 2, 1128, 1079, 1080, 1081, 430, 275, 1079, 127, 366, /* 340 */ 933, 1079, 1080, 1081, 220, 1205, 913, 458, 455, 454, /* 350 */ 392, 167, 515, 1035, 152, 445, 924, 453, 152, 874, /* 360 */ 923, 289, 109, 109, 109, 109, 108, 108, 107, 107, /* 370 */ 107, 106, 401, 13, 13, 261, 853, 252, 252, 227, /* 380 */ 106, 401, 370, 1079, 1080, 1081, 311, 388, 1079, 296, /* 390 */ 512, 923, 923, 925, 231, 323, 1255, 1388, 1423, 490, /* 400 */ 274, 506, 12, 208, 274, 506, 112, 113, 103, 1100, /* 410 */ 1100, 953, 956, 946, 946, 110, 110, 111, 111, 111, /* 420 */ 111, 1440, 286, 1128, 288, 1079, 1097, 247, 275, 1098, /* 430 */ 127, 387, 405, 389, 1079, 1080, 1081, 1205, 159, 238, /* 440 */ 255, 321, 461, 316, 460, 225, 790, 105, 102, 197, /* 450 */ 513, 314, 842, 842, 445, 109, 109, 109, 109, 108, /* 460 */ 108, 107, 107, 107, 106, 401, 515, 514, 515, 252, /* 470 */ 252, 1079, 1080, 1081, 435, 370, 1098, 933, 1460, 794, /* 480 */ 274, 506, 512, 105, 102, 197, 336, 63, 63, 64, /* 490 */ 64, 27, 790, 924, 287, 208, 1354, 923, 515, 112, /* 500 */ 113, 103, 1100, 1100, 953, 956, 946, 946, 110, 110, /* 510 */ 111, 111, 111, 111, 107, 107, 107, 106, 401, 49, /* 520 */ 49, 515, 28, 1079, 405, 497, 421, 297, 923, 923, /* 530 */ 925, 186, 468, 1079, 467, 999, 999, 442, 515, 1079, /* 540 */ 334, 515, 45, 45, 1083, 342, 173, 168, 109, 109, /* 550 */ 109, 109, 108, 108, 107, 107, 107, 106, 401, 13, /* 560 */ 13, 205, 13, 13, 252, 252, 1195, 1195, 370, 1079, /* 570 */ 1080, 1081, 787, 265, 5, 359, 494, 512, 469, 1079, /* 580 */ 1080, 1081, 398, 397, 1079, 1079, 1080, 1081, 3, 282, /* 590 */ 1079, 1083, 112, 113, 103, 1100, 1100, 953, 956, 946, /* 600 */ 946, 110, 110, 111, 111, 111, 111, 252, 252, 1015, /* 610 */ 220, 1079, 873, 458, 455, 454, 943, 943, 954, 957, /* 620 */ 512, 252, 252, 453, 1016, 1079, 445, 1107, 1209, 1107, /* 630 */ 1079, 1080, 1081, 515, 512, 426, 1079, 1080, 1081, 1017, /* 640 */ 512, 109, 109, 109, 109, 108, 108, 107, 107, 107, /* 650 */ 106, 401, 1052, 515, 50, 50, 515, 1079, 1080, 1081, /* 660 */ 828, 370, 1051, 379, 411, 1064, 1358, 207, 408, 773, /* 670 */ 829, 1079, 1080, 1081, 64, 64, 322, 64, 64, 1302, /* 680 */ 947, 411, 410, 1358, 1360, 112, 113, 103, 1100, 1100, /* 690 */ 953, 956, 946, 946, 110, 110, 111, 111, 111, 111, /* 700 */ 294, 482, 515, 1037, 1487, 515, 434, 1487, 354, 1120, /* 710 */ 483, 996, 913, 485, 466, 996, 132, 178, 33, 450, /* 720 */ 1203, 136, 406, 64, 64, 479, 64, 64, 419, 369, /* 730 */ 283, 1146, 252, 252, 109, 109, 109, 109, 108, 108, /* 740 */ 107, 107, 107, 106, 401, 512, 224, 440, 411, 266, /* 750 */ 1358, 266, 252, 252, 370, 296, 416, 284, 934, 396, /* 760 */ 976, 470, 400, 252, 252, 512, 9, 473, 231, 500, /* 770 */ 354, 1036, 1035, 1488, 355, 374, 512, 1121, 112, 113, /* 780 */ 103, 1100, 1100, 953, 956, 946, 946, 110, 110, 111, /* 790 */ 111, 111, 111, 252, 252, 1015, 515, 1347, 295, 252, /* 800 */ 252, 252, 252, 1098, 375, 249, 512, 445, 872, 322, /* 810 */ 1016, 480, 512, 195, 512, 434, 273, 15, 15, 515, /* 820 */ 314, 515, 95, 515, 93, 1017, 367, 109, 109, 109, /* 830 */ 109, 108, 108, 107, 107, 107, 106, 401, 515, 1121, /* 840 */ 39, 39, 51, 51, 52, 52, 503, 370, 515, 1204, /* 850 */ 1098, 918, 439, 341, 133, 436, 223, 222, 221, 53, /* 860 */ 53, 322, 1400, 761, 762, 763, 515, 370, 88, 54, /* 870 */ 54, 112, 113, 103, 1100, 1100, 953, 956, 946, 946, /* 880 */ 110, 110, 111, 111, 111, 111, 407, 55, 55, 196, /* 890 */ 515, 112, 113, 103, 1100, 1100, 953, 956, 946, 946, /* 900 */ 110, 110, 111, 111, 111, 111, 135, 264, 1149, 376, /* 910 */ 515, 40, 40, 515, 872, 515, 993, 515, 993, 116, /* 920 */ 109, 109, 109, 109, 108, 108, 107, 107, 107, 106, /* 930 */ 401, 41, 41, 515, 43, 43, 44, 44, 56, 56, /* 940 */ 109, 109, 109, 109, 108, 108, 107, 107, 107, 106, /* 950 */ 401, 515, 379, 515, 57, 57, 515, 799, 515, 379, /* 960 */ 515, 445, 200, 515, 323, 515, 1397, 515, 1459, 515, /* 970 */ 1287, 817, 58, 58, 14, 14, 515, 59, 59, 118, /* 980 */ 118, 60, 60, 515, 46, 46, 61, 61, 62, 62, /* 990 */ 47, 47, 515, 190, 189, 91, 515, 140, 140, 515, /* 1000 */ 394, 515, 277, 1200, 141, 141, 515, 1115, 515, 992, /* 1010 */ 515, 992, 515, 69, 69, 370, 278, 48, 48, 259, /* 1020 */ 65, 65, 119, 119, 246, 246, 260, 66, 66, 120, /* 1030 */ 120, 121, 121, 117, 117, 370, 515, 512, 383, 112, /* 1040 */ 113, 103, 1100, 1100, 953, 956, 946, 946, 110, 110, /* 1050 */ 111, 111, 111, 111, 515, 872, 515, 139, 139, 112, /* 1060 */ 113, 103, 1100, 1100, 953, 956, 946, 946, 110, 110, /* 1070 */ 111, 111, 111, 111, 1287, 138, 138, 125, 125, 515, /* 1080 */ 12, 515, 281, 1287, 515, 445, 131, 1287, 109, 109, /* 1090 */ 109, 109, 108, 108, 107, 107, 107, 106, 401, 515, /* 1100 */ 124, 124, 122, 122, 515, 123, 123, 515, 109, 109, /* 1110 */ 109, 109, 108, 108, 107, 107, 107, 106, 401, 515, /* 1120 */ 68, 68, 463, 783, 515, 70, 70, 302, 67, 67, /* 1130 */ 1032, 253, 253, 356, 1287, 191, 196, 1433, 465, 1301, /* 1140 */ 38, 38, 384, 94, 512, 42, 42, 177, 848, 274, /* 1150 */ 506, 385, 420, 847, 1356, 441, 508, 376, 377, 153, /* 1160 */ 423, 872, 432, 370, 224, 251, 194, 887, 182, 293, /* 1170 */ 783, 848, 88, 254, 466, 888, 847, 915, 807, 806, /* 1180 */ 230, 1241, 910, 370, 17, 413, 797, 112, 113, 103, /* 1190 */ 1100, 1100, 953, 956, 946, 946, 110, 110, 111, 111, /* 1200 */ 111, 111, 395, 814, 815, 1175, 983, 112, 101, 103, /* 1210 */ 1100, 1100, 953, 956, 946, 946, 110, 110, 111, 111, /* 1220 */ 111, 111, 375, 422, 427, 429, 298, 230, 230, 88, /* 1230 */ 1240, 451, 312, 797, 226, 88, 109, 109, 109, 109, /* 1240 */ 108, 108, 107, 107, 107, 106, 401, 86, 433, 979, /* 1250 */ 927, 881, 226, 983, 230, 415, 109, 109, 109, 109, /* 1260 */ 108, 108, 107, 107, 107, 106, 401, 320, 845, 781, /* 1270 */ 846, 100, 130, 100, 1403, 290, 370, 319, 1377, 1376, /* 1280 */ 437, 1449, 299, 1237, 303, 306, 308, 310, 1188, 1174, /* 1290 */ 1173, 1172, 315, 324, 325, 1228, 370, 927, 1249, 271, /* 1300 */ 1286, 113, 103, 1100, 1100, 953, 956, 946, 946, 110, /* 1310 */ 110, 111, 111, 111, 111, 1224, 1235, 502, 501, 1292, /* 1320 */ 1221, 1155, 103, 1100, 1100, 953, 956, 946, 946, 110, /* 1330 */ 110, 111, 111, 111, 111, 1148, 1137, 1136, 1138, 1443, /* 1340 */ 446, 244, 184, 98, 507, 188, 4, 353, 327, 109, /* 1350 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 401, /* 1360 */ 510, 329, 331, 199, 414, 456, 292, 285, 318, 109, /* 1370 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 401, /* 1380 */ 11, 1271, 1279, 402, 361, 192, 1171, 1351, 431, 505, /* 1390 */ 346, 1350, 333, 98, 507, 504, 4, 187, 1446, 1115, /* 1400 */ 233, 1396, 155, 1394, 1112, 152, 72, 75, 378, 425, /* 1410 */ 510, 165, 149, 157, 933, 1276, 86, 30, 1268, 417, /* 1420 */ 96, 96, 8, 160, 161, 162, 163, 97, 418, 402, /* 1430 */ 517, 516, 449, 402, 923, 210, 358, 424, 1282, 438, /* 1440 */ 169, 214, 360, 1345, 80, 504, 31, 444, 1365, 301, /* 1450 */ 245, 274, 506, 216, 174, 305, 488, 447, 217, 462, /* 1460 */ 1139, 487, 218, 363, 933, 923, 923, 925, 926, 24, /* 1470 */ 96, 96, 1191, 1190, 1189, 391, 1182, 97, 1163, 402, /* 1480 */ 517, 516, 799, 364, 923, 1162, 317, 1161, 98, 507, /* 1490 */ 1181, 4, 1458, 472, 393, 269, 270, 475, 481, 1232, /* 1500 */ 85, 1233, 326, 328, 232, 510, 495, 1231, 330, 98, /* 1510 */ 507, 1230, 4, 486, 335, 923, 923, 925, 926, 24, /* 1520 */ 1435, 1068, 404, 181, 336, 256, 510, 115, 402, 332, /* 1530 */ 352, 352, 351, 241, 349, 1214, 1414, 770, 338, 10, /* 1540 */ 504, 340, 272, 92, 1331, 1213, 87, 183, 484, 402, /* 1550 */ 201, 488, 280, 239, 344, 345, 489, 1145, 29, 933, /* 1560 */ 279, 504, 1074, 518, 240, 96, 96, 242, 243, 519, /* 1570 */ 1134, 1129, 97, 154, 402, 517, 516, 372, 373, 923, /* 1580 */ 933, 142, 143, 128, 1381, 267, 96, 96, 852, 757, /* 1590 */ 203, 144, 403, 97, 1382, 402, 517, 516, 204, 1380, /* 1600 */ 923, 146, 1379, 1159, 1158, 71, 1156, 276, 202, 185, /* 1610 */ 923, 923, 925, 926, 24, 198, 257, 126, 991, 989, /* 1620 */ 907, 98, 507, 156, 4, 145, 158, 206, 831, 209, /* 1630 */ 291, 923, 923, 925, 926, 24, 1005, 911, 510, 164, /* 1640 */ 147, 380, 371, 382, 166, 76, 77, 274, 506, 148, /* 1650 */ 78, 79, 1008, 211, 212, 1004, 137, 213, 18, 300, /* 1660 */ 230, 402, 997, 1109, 443, 215, 32, 170, 171, 772, /* 1670 */ 409, 448, 319, 504, 219, 172, 452, 81, 19, 457, /* 1680 */ 313, 20, 82, 268, 488, 150, 810, 179, 83, 487, /* 1690 */ 464, 151, 933, 180, 959, 84, 1040, 34, 96, 96, /* 1700 */ 471, 1041, 35, 474, 193, 97, 248, 402, 517, 516, /* 1710 */ 1068, 404, 923, 250, 256, 880, 229, 175, 875, 352, /* 1720 */ 352, 351, 241, 349, 100, 21, 770, 22, 1054, 1056, /* 1730 */ 7, 98, 507, 1045, 4, 337, 1058, 23, 974, 201, /* 1740 */ 176, 280, 88, 923, 923, 925, 926, 24, 510, 279, /* 1750 */ 960, 958, 962, 1014, 963, 1013, 235, 234, 25, 36, /* 1760 */ 99, 90, 507, 928, 4, 511, 350, 782, 26, 841, /* 1770 */ 236, 402, 347, 1069, 237, 1125, 1125, 1451, 510, 203, /* 1780 */ 1450, 1125, 1125, 504, 1125, 1125, 1125, 204, 1125, 1125, /* 1790 */ 146, 1125, 1125, 1125, 1125, 1125, 1125, 202, 1125, 1125, /* 1800 */ 1125, 402, 933, 1125, 1125, 1125, 1125, 1125, 96, 96, /* 1810 */ 1125, 1125, 1125, 504, 1125, 97, 1125, 402, 517, 516, /* 1820 */ 1125, 1125, 923, 1125, 1125, 1125, 1125, 1125, 1125, 1125, /* 1830 */ 1125, 371, 933, 1125, 1125, 1125, 274, 506, 96, 96, /* 1840 */ 1125, 1125, 1125, 1125, 1125, 97, 1125, 402, 517, 516, /* 1850 */ 1125, 1125, 923, 923, 923, 925, 926, 24, 1125, 409, /* 1860 */ 1125, 1125, 1125, 256, 1125, 1125, 1125, 1125, 352, 352, /* 1870 */ 351, 241, 349, 1125, 1125, 770, 1125, 1125, 1125, 1125, /* 1880 */ 1125, 1125, 1125, 923, 923, 925, 926, 24, 201, 1125, /* 1890 */ 280, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 279, 1125, /* 1900 */ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, /* 1910 */ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, /* 1920 */ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 203, 1125, /* 1930 */ 1125, 1125, 1125, 1125, 1125, 1125, 204, 1125, 1125, 146, /* 1940 */ 1125, 1125, 1125, 1125, 1125, 1125, 202, 1125, 1125, 1125, /* 1950 */ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, /* 1960 */ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, /* 1970 */ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, /* 1980 */ 371, 1125, 1125, 1125, 1125, 274, 506, 1125, 1125, 1125, /* 1990 */ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, /* 2000 */ 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1125, 409, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 184, 238, 239, 240, 238, 239, 240, 163, 155, 156, /* 10 */ 157, 158, 159, 160, 163, 191, 192, 183, 165, 19, /* 20 */ 167, 258, 202, 203, 200, 191, 163, 174, 184, 185, /* 30 */ 174, 31, 163, 163, 171, 184, 185, 35, 175, 39, /* 40 */ 179, 180, 181, 43, 44, 45, 46, 47, 48, 49, |
︙ | ︙ | |||
145496 145497 145498 145499 145500 145501 145502 | /* 890 */ 163, 43, 44, 45, 46, 47, 48, 49, 50, 51, /* 900 */ 52, 53, 54, 55, 56, 57, 208, 255, 177, 178, /* 910 */ 163, 184, 185, 163, 132, 163, 141, 163, 143, 22, /* 920 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, /* 930 */ 102, 184, 185, 163, 184, 185, 184, 185, 184, 185, /* 940 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, /* 950 */ 102, 163, 163, 163, 184, 185, 163, 115, 163, 163, | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 146446 146447 146448 146449 146450 146451 146452 146453 146454 146455 146456 146457 146458 146459 146460 146461 146462 146463 146464 146465 146466 146467 146468 146469 146470 146471 146472 146473 146474 146475 146476 146477 146478 146479 146480 146481 146482 146483 146484 146485 146486 146487 146488 146489 146490 146491 146492 146493 146494 146495 146496 146497 146498 146499 146500 146501 146502 146503 146504 146505 146506 146507 146508 146509 146510 146511 146512 146513 146514 146515 146516 146517 146518 146519 146520 146521 146522 146523 146524 146525 146526 146527 146528 146529 146530 146531 146532 146533 146534 146535 146536 146537 146538 146539 146540 146541 146542 | /* 890 */ 163, 43, 44, 45, 46, 47, 48, 49, 50, 51, /* 900 */ 52, 53, 54, 55, 56, 57, 208, 255, 177, 178, /* 910 */ 163, 184, 185, 163, 132, 163, 141, 163, 143, 22, /* 920 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, /* 930 */ 102, 184, 185, 163, 184, 185, 184, 185, 184, 185, /* 940 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, /* 950 */ 102, 163, 163, 163, 184, 185, 163, 115, 163, 163, /* 960 */ 163, 163, 15, 163, 163, 163, 163, 163, 23, 163, /* 970 */ 163, 26, 184, 185, 184, 185, 163, 184, 185, 184, /* 980 */ 185, 184, 185, 163, 184, 185, 184, 185, 184, 185, /* 990 */ 184, 185, 163, 96, 97, 147, 163, 184, 185, 163, /* 1000 */ 199, 163, 163, 205, 184, 185, 163, 60, 163, 141, /* 1010 */ 163, 143, 163, 184, 185, 19, 163, 184, 185, 230, /* 1020 */ 184, 185, 184, 185, 206, 207, 230, 184, 185, 184, /* 1030 */ 185, 184, 185, 184, 185, 19, 163, 219, 231, 43, /* 1040 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, /* 1050 */ 54, 55, 56, 57, 163, 26, 163, 184, 185, 43, /* 1060 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, /* 1070 */ 54, 55, 56, 57, 163, 184, 185, 184, 185, 163, /* 1080 */ 182, 163, 163, 163, 163, 163, 22, 163, 92, 93, /* 1090 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 163, /* 1100 */ 184, 185, 184, 185, 163, 184, 185, 163, 92, 93, /* 1110 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 163, /* 1120 */ 184, 185, 98, 59, 163, 184, 185, 205, 184, 185, /* 1130 */ 23, 206, 207, 26, 163, 26, 107, 153, 154, 237, /* 1140 */ 184, 185, 231, 147, 219, 184, 185, 249, 124, 127, /* 1150 */ 128, 231, 254, 129, 163, 231, 177, 178, 262, 263, /* 1160 */ 118, 132, 19, 19, 46, 223, 224, 31, 24, 23, /* 1170 */ 106, 124, 26, 22, 272, 39, 129, 23, 109, 110, /* 1180 */ 26, 163, 140, 19, 22, 234, 59, 43, 44, 45, /* 1190 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, /* 1200 */ 56, 57, 231, 7, 8, 193, 59, 43, 44, 45, /* 1210 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, /* 1220 */ 56, 57, 104, 61, 23, 23, 23, 26, 26, 26, /* 1230 */ 163, 23, 23, 106, 26, 26, 92, 93, 94, 95, /* 1240 */ 96, 97, 98, 99, 100, 101, 102, 138, 105, 23, /* 1250 */ 59, 23, 26, 106, 26, 163, 92, 93, 94, 95, /* 1260 */ 96, 97, 98, 99, 100, 101, 102, 110, 23, 23, /* 1270 */ 23, 26, 26, 26, 163, 163, 19, 120, 163, 163, /* 1280 */ 163, 130, 163, 163, 163, 163, 163, 163, 163, 193, /* 1290 */ 193, 163, 163, 163, 163, 225, 19, 106, 163, 222, /* 1300 */ 163, 44, 45, 46, 47, 48, 49, 50, 51, 52, /* 1310 */ 53, 54, 55, 56, 57, 163, 163, 203, 163, 163, /* 1320 */ 222, 163, 45, 46, 47, 48, 49, 50, 51, 52, /* 1330 */ 53, 54, 55, 56, 57, 163, 163, 163, 163, 163, /* 1340 */ 251, 250, 209, 19, 20, 182, 22, 161, 222, 92, /* 1350 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, /* 1360 */ 36, 222, 222, 260, 226, 188, 256, 226, 187, 92, /* 1370 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, /* 1380 */ 210, 213, 213, 59, 213, 196, 192, 187, 256, 244, /* 1390 */ 212, 187, 226, 19, 20, 71, 22, 210, 166, 60, /* 1400 */ 130, 170, 260, 170, 38, 81, 257, 257, 170, 104, /* 1410 */ 36, 22, 43, 201, 90, 236, 138, 235, 213, 18, /* 1420 */ 96, 97, 48, 204, 204, 204, 204, 103, 170, 105, /* 1430 */ 106, 107, 18, 59, 110, 169, 213, 213, 201, 170, /* 1440 */ 201, 169, 236, 213, 146, 71, 235, 62, 253, 252, /* 1450 */ 170, 127, 128, 169, 22, 170, 82, 189, 169, 104, /* 1460 */ 170, 87, 169, 189, 90, 141, 142, 143, 144, 145, /* 1470 */ 96, 97, 186, 186, 186, 64, 194, 103, 186, 105, /* 1480 */ 106, 107, 115, 189, 110, 188, 186, 186, 19, 20, /* 1490 */ 194, 22, 186, 189, 102, 246, 246, 189, 133, 228, /* 1500 */ 104, 228, 227, 227, 170, 36, 134, 228, 227, 19, /* 1510 */ 20, 228, 22, 84, 271, 141, 142, 143, 144, 145, /* 1520 */ 0, 1, 2, 216, 22, 5, 36, 137, 59, 227, /* 1530 */ 10, 11, 12, 13, 14, 217, 269, 17, 216, 22, /* 1540 */ 71, 170, 243, 146, 241, 217, 136, 215, 135, 59, /* 1550 */ 30, 82, 32, 25, 214, 213, 87, 173, 26, 90, /* 1560 */ 40, 71, 13, 172, 164, 96, 97, 164, 6, 162, /* 1570 */ 162, 162, 103, 263, 105, 106, 107, 266, 266, 110, /* 1580 */ 90, 176, 176, 190, 182, 190, 96, 97, 98, 4, /* 1590 */ 70, 176, 3, 103, 182, 105, 106, 107, 78, 182, /* 1600 */ 110, 81, 182, 182, 182, 182, 182, 151, 88, 22, /* 1610 */ 141, 142, 143, 144, 145, 15, 89, 16, 23, 23, /* 1620 */ 128, 19, 20, 139, 22, 119, 131, 24, 20, 133, /* 1630 */ 16, 141, 142, 143, 144, 145, 1, 140, 36, 131, /* 1640 */ 119, 61, 122, 37, 139, 53, 53, 127, 128, 119, /* 1650 */ 53, 53, 105, 34, 130, 1, 5, 104, 22, 149, /* 1660 */ 26, 59, 68, 75, 41, 130, 24, 68, 104, 20, /* 1670 */ 150, 19, 120, 71, 114, 22, 67, 22, 22, 67, /* 1680 */ 23, 22, 22, 67, 82, 37, 28, 23, 138, 87, /* 1690 */ 22, 153, 90, 23, 23, 26, 23, 22, 96, 97, /* 1700 */ 24, 23, 22, 24, 130, 103, 23, 105, 106, 107, /* 1710 */ 1, 2, 110, 23, 5, 105, 34, 22, 132, 10, /* 1720 */ 11, 12, 13, 14, 26, 34, 17, 34, 85, 83, /* 1730 */ 44, 19, 20, 23, 22, 24, 75, 34, 23, 30, /* 1740 */ 26, 32, 26, 141, 142, 143, 144, 145, 36, 40, /* 1750 */ 23, 23, 23, 23, 11, 23, 22, 26, 22, 22, /* 1760 */ 22, 19, 20, 23, 22, 26, 15, 23, 22, 124, /* 1770 */ 130, 59, 23, 1, 130, 277, 277, 130, 36, 70, /* 1780 */ 130, 277, 277, 71, 277, 277, 277, 78, 277, 277, /* 1790 */ 81, 277, 277, 277, 277, 277, 277, 88, 277, 277, /* 1800 */ 277, 59, 90, 277, 277, 277, 277, 277, 96, 97, /* 1810 */ 277, 277, 277, 71, 277, 103, 277, 105, 106, 107, /* 1820 */ 277, 277, 110, 277, 277, 277, 277, 277, 277, 277, /* 1830 */ 277, 122, 90, 277, 277, 277, 127, 128, 96, 97, /* 1840 */ 277, 277, 277, 277, 277, 103, 277, 105, 106, 107, /* 1850 */ 277, 277, 110, 141, 142, 143, 144, 145, 277, 150, |
︙ | ︙ | |||
145603 145604 145605 145606 145607 145608 145609 | /* 1960 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 1970 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 1980 */ 122, 277, 277, 277, 277, 127, 128, 277, 277, 277, /* 1990 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 2000 */ 277, 277, 277, 277, 277, 277, 277, 277, 150, 277, /* 2010 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, }; | | | 146553 146554 146555 146556 146557 146558 146559 146560 146561 146562 146563 146564 146565 146566 146567 | /* 1960 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 1970 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 1980 */ 122, 277, 277, 277, 277, 127, 128, 277, 277, 277, /* 1990 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 2000 */ 277, 277, 277, 277, 277, 277, 277, 277, 150, 277, /* 2010 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, }; #define YY_SHIFT_COUNT (520) #define YY_SHIFT_MIN (0) #define YY_SHIFT_MAX (1858) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 1709, 1520, 1858, 1324, 1324, 277, 1374, 1469, 1602, 1712, /* 10 */ 1712, 1712, 273, 0, 0, 113, 1016, 1712, 1712, 1712, /* 20 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 11, 11, 236, /* 30 */ 184, 277, 277, 277, 277, 277, 277, 93, 177, 270, |
︙ | ︙ | |||
145627 145628 145629 145630 145631 145632 145633 | /* 130 */ 486, 486, 531, 353, 353, 353, 353, 409, 279, 53, /* 140 */ 2009, 2009, 331, 331, 331, 329, 366, 329, 329, 597, /* 150 */ 597, 464, 474, 262, 681, 531, 531, 531, 531, 531, /* 160 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, /* 170 */ 531, 531, 531, 531, 531, 531, 531, 173, 485, 984, /* 180 */ 984, 576, 485, 19, 1022, 2009, 2009, 2009, 387, 250, /* 190 */ 250, 525, 502, 278, 552, 227, 480, 566, 531, 531, | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | 146577 146578 146579 146580 146581 146582 146583 146584 146585 146586 146587 146588 146589 146590 146591 146592 146593 146594 146595 146596 146597 146598 146599 146600 146601 146602 146603 146604 146605 146606 146607 146608 146609 146610 146611 146612 146613 146614 146615 146616 146617 146618 146619 146620 146621 146622 146623 146624 146625 146626 146627 | /* 130 */ 486, 486, 531, 353, 353, 353, 353, 409, 279, 53, /* 140 */ 2009, 2009, 331, 331, 331, 329, 366, 329, 329, 597, /* 150 */ 597, 464, 474, 262, 681, 531, 531, 531, 531, 531, /* 160 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, /* 170 */ 531, 531, 531, 531, 531, 531, 531, 173, 485, 984, /* 180 */ 984, 576, 485, 19, 1022, 2009, 2009, 2009, 387, 250, /* 190 */ 250, 525, 502, 278, 552, 227, 480, 566, 531, 531, /* 200 */ 531, 531, 531, 531, 531, 531, 531, 531, 639, 531, /* 210 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, /* 220 */ 531, 2, 2, 2, 531, 531, 531, 531, 782, 531, /* 230 */ 531, 531, 744, 531, 531, 783, 531, 531, 531, 531, /* 240 */ 531, 531, 531, 531, 419, 682, 327, 370, 370, 370, /* 250 */ 370, 1029, 327, 327, 1024, 897, 856, 947, 1109, 706, /* 260 */ 706, 1143, 1109, 1109, 1143, 842, 945, 1118, 1136, 1136, /* 270 */ 1136, 706, 676, 400, 1047, 694, 1339, 1270, 1270, 1366, /* 280 */ 1366, 1270, 1305, 1389, 1369, 1278, 1401, 1401, 1401, 1401, /* 290 */ 1270, 1414, 1278, 1278, 1305, 1389, 1369, 1369, 1278, 1270, /* 300 */ 1414, 1298, 1385, 1270, 1414, 1432, 1270, 1414, 1270, 1414, /* 310 */ 1432, 1355, 1355, 1355, 1411, 1432, 1355, 1367, 1355, 1411, /* 320 */ 1355, 1355, 1432, 1392, 1392, 1432, 1365, 1396, 1365, 1396, /* 330 */ 1365, 1396, 1365, 1396, 1270, 1372, 1429, 1502, 1390, 1372, /* 340 */ 1517, 1270, 1397, 1390, 1410, 1413, 1278, 1528, 1532, 1549, /* 350 */ 1549, 1562, 1562, 1562, 2009, 2009, 2009, 2009, 2009, 2009, /* 360 */ 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, /* 370 */ 570, 345, 686, 748, 50, 740, 1064, 1107, 469, 537, /* 380 */ 1042, 1146, 1162, 1154, 1201, 1202, 1203, 1208, 1209, 1127, /* 390 */ 1069, 1196, 1157, 1147, 1226, 1228, 1245, 775, 868, 1246, /* 400 */ 1247, 1191, 1151, 1585, 1589, 1587, 1456, 1600, 1527, 1601, /* 410 */ 1595, 1596, 1492, 1484, 1506, 1603, 1495, 1608, 1496, 1614, /* 420 */ 1635, 1508, 1497, 1521, 1580, 1606, 1505, 1592, 1593, 1597, /* 430 */ 1598, 1530, 1547, 1619, 1524, 1654, 1651, 1636, 1553, 1510, /* 440 */ 1594, 1634, 1599, 1588, 1623, 1535, 1564, 1642, 1649, 1652, /* 450 */ 1552, 1560, 1653, 1609, 1655, 1656, 1657, 1659, 1612, 1658, /* 460 */ 1660, 1616, 1648, 1664, 1550, 1668, 1538, 1670, 1671, 1669, /* 470 */ 1673, 1675, 1676, 1678, 1680, 1679, 1574, 1683, 1690, 1610, /* 480 */ 1682, 1695, 1586, 1698, 1691, 1698, 1693, 1643, 1661, 1646, /* 490 */ 1686, 1710, 1711, 1714, 1716, 1703, 1715, 1698, 1727, 1728, /* 500 */ 1729, 1730, 1731, 1732, 1734, 1743, 1736, 1737, 1740, 1744, /* 510 */ 1738, 1746, 1739, 1645, 1640, 1644, 1647, 1650, 1749, 1751, /* 520 */ 1772, }; #define YY_REDUCE_COUNT (369) #define YY_REDUCE_MIN (-237) #define YY_REDUCE_MAX (1424) static const short yy_reduce_ofst[] = { /* 0 */ -147, 171, 263, -96, 358, -144, -149, -102, 124, -156, /* 10 */ -98, 305, 401, -57, 209, -237, 245, -94, -79, 189, /* 20 */ 375, 490, 493, 378, 303, 539, 542, 501, 503, 554, /* 30 */ 415, 526, 546, 557, 587, 593, 595, -234, -234, -234, /* 40 */ -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, /* 50 */ -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, |
︙ | ︙ | |||
145684 145685 145686 145687 145688 145689 145690 | /* 130 */ -139, 87, -137, 818, 925, 818, 925, 898, -234, -234, /* 140 */ -234, -234, -166, -166, -166, -130, -131, -82, -54, -180, /* 150 */ 364, 41, 513, 509, 509, 117, 500, 789, 796, 646, /* 160 */ 192, 291, 644, 798, 120, 807, 543, 911, 920, 652, /* 170 */ 924, 922, 232, 698, 801, 971, 39, 220, 731, 442, /* 180 */ 902, -199, 979, -43, 421, 896, 942, 605, -184, -126, /* 190 */ 155, 172, 281, 304, 377, 538, 650, 690, 699, 723, | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | 146635 146636 146637 146638 146639 146640 146641 146642 146643 146644 146645 146646 146647 146648 146649 146650 146651 146652 146653 146654 146655 146656 146657 146658 146659 146660 146661 146662 146663 146664 146665 146666 146667 146668 146669 146670 146671 146672 146673 146674 146675 146676 146677 146678 146679 146680 146681 146682 146683 146684 146685 146686 146687 146688 146689 146690 146691 146692 146693 146694 146695 146696 146697 146698 146699 146700 146701 146702 146703 146704 146705 146706 146707 146708 146709 146710 146711 146712 146713 146714 146715 146716 146717 146718 146719 146720 | /* 130 */ -139, 87, -137, 818, 925, 818, 925, 898, -234, -234, /* 140 */ -234, -234, -166, -166, -166, -130, -131, -82, -54, -180, /* 150 */ 364, 41, 513, 509, 509, 117, 500, 789, 796, 646, /* 160 */ 192, 291, 644, 798, 120, 807, 543, 911, 920, 652, /* 170 */ 924, 922, 232, 698, 801, 971, 39, 220, 731, 442, /* 180 */ 902, -199, 979, -43, 421, 896, 942, 605, -184, -126, /* 190 */ 155, 172, 281, 304, 377, 538, 650, 690, 699, 723, /* 200 */ 803, 839, 853, 919, 991, 1018, 1067, 1092, 951, 1111, /* 210 */ 1112, 1115, 1116, 1117, 1119, 1120, 1121, 1122, 1123, 1124, /* 220 */ 1125, 1012, 1096, 1097, 1128, 1129, 1130, 1131, 1070, 1135, /* 230 */ 1137, 1152, 1077, 1153, 1155, 1114, 1156, 304, 1158, 1172, /* 240 */ 1173, 1174, 1175, 1176, 1089, 1091, 1133, 1098, 1126, 1139, /* 250 */ 1140, 1070, 1133, 1133, 1170, 1163, 1186, 1103, 1168, 1138, /* 260 */ 1141, 1110, 1169, 1171, 1132, 1177, 1189, 1194, 1181, 1200, /* 270 */ 1204, 1166, 1145, 1178, 1187, 1232, 1142, 1231, 1233, 1149, /* 280 */ 1150, 1238, 1179, 1182, 1212, 1205, 1219, 1220, 1221, 1222, /* 290 */ 1258, 1266, 1223, 1224, 1206, 1211, 1237, 1239, 1230, 1269, /* 300 */ 1272, 1195, 1197, 1280, 1284, 1268, 1285, 1289, 1290, 1293, /* 310 */ 1274, 1286, 1287, 1288, 1282, 1294, 1292, 1297, 1300, 1296, /* 320 */ 1301, 1306, 1304, 1249, 1250, 1308, 1271, 1275, 1273, 1276, /* 330 */ 1279, 1281, 1283, 1302, 1334, 1307, 1243, 1267, 1318, 1322, /* 340 */ 1303, 1371, 1299, 1328, 1332, 1340, 1342, 1384, 1391, 1400, /* 350 */ 1403, 1407, 1408, 1409, 1311, 1312, 1310, 1405, 1402, 1412, /* 360 */ 1417, 1420, 1406, 1393, 1395, 1421, 1422, 1423, 1424, 1415, }; static const YYACTIONTYPE yy_default[] = { /* 0 */ 1492, 1492, 1492, 1340, 1123, 1229, 1123, 1123, 1123, 1340, /* 10 */ 1340, 1340, 1123, 1259, 1259, 1391, 1154, 1123, 1123, 1123, /* 20 */ 1123, 1123, 1123, 1123, 1339, 1123, 1123, 1123, 1123, 1123, /* 30 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1265, 1123, /* 40 */ 1123, 1123, 1123, 1123, 1341, 1342, 1123, 1123, 1123, 1390, /* 50 */ 1392, 1275, 1274, 1273, 1272, 1373, 1246, 1270, 1263, 1267, /* 60 */ 1335, 1336, 1334, 1338, 1342, 1341, 1123, 1266, 1306, 1320, /* 70 */ 1305, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 80 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 90 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 100 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 110 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1314, 1319, 1325, /* 120 */ 1318, 1315, 1308, 1307, 1309, 1310, 1123, 1144, 1193, 1123, /* 130 */ 1123, 1123, 1123, 1409, 1408, 1123, 1123, 1154, 1311, 1312, /* 140 */ 1322, 1321, 1398, 1448, 1447, 1123, 1123, 1123, 1123, 1123, /* 150 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 160 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 170 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1154, 1150, 1300, /* 180 */ 1299, 1418, 1150, 1253, 1123, 1404, 1229, 1220, 1123, 1123, /* 190 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 200 */ 1123, 1395, 1393, 1123, 1355, 1123, 1123, 1123, 1123, 1123, /* 210 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 220 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 230 */ 1123, 1123, 1225, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 240 */ 1123, 1123, 1123, 1442, 1123, 1368, 1207, 1225, 1225, 1225, /* 250 */ 1225, 1227, 1208, 1206, 1219, 1154, 1130, 1484, 1269, 1248, /* 260 */ 1248, 1481, 1269, 1269, 1481, 1168, 1462, 1165, 1259, 1259, /* 270 */ 1259, 1248, 1337, 1226, 1219, 1123, 1484, 1234, 1234, 1483, /* 280 */ 1483, 1234, 1278, 1284, 1196, 1269, 1202, 1202, 1202, 1202, /* 290 */ 1234, 1141, 1269, 1269, 1278, 1284, 1196, 1196, 1269, 1234, /* 300 */ 1141, 1372, 1478, 1234, 1141, 1348, 1234, 1141, 1234, 1141, /* 310 */ 1348, 1194, 1194, 1194, 1183, 1348, 1194, 1168, 1194, 1183, /* 320 */ 1194, 1194, 1348, 1352, 1352, 1348, 1252, 1247, 1252, 1247, /* 330 */ 1252, 1247, 1252, 1247, 1234, 1253, 1417, 1123, 1264, 1253, /* 340 */ 1343, 1234, 1123, 1264, 1262, 1260, 1269, 1147, 1186, 1445, /* 350 */ 1445, 1441, 1441, 1441, 1489, 1489, 1404, 1457, 1154, 1154, /* 360 */ 1154, 1154, 1457, 1170, 1170, 1154, 1154, 1154, 1154, 1457, /* 370 */ 1123, 1123, 1123, 1123, 1123, 1123, 1452, 1123, 1357, 1238, /* 380 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 390 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 400 */ 1123, 1123, 1289, 1123, 1126, 1401, 1123, 1123, 1399, 1123, /* 410 */ 1123, 1123, 1123, 1123, 1123, 1239, 1123, 1123, 1123, 1123, /* 420 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 430 */ 1123, 1123, 1123, 1123, 1480, 1123, 1123, 1123, 1123, 1123, /* 440 */ 1123, 1371, 1370, 1123, 1123, 1236, 1123, 1123, 1123, 1123, /* 450 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 460 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 470 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 480 */ 1123, 1123, 1123, 1261, 1123, 1416, 1123, 1123, 1123, 1123, /* 490 */ 1123, 1123, 1123, 1430, 1254, 1123, 1123, 1471, 1123, 1123, /* 500 */ 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, 1123, /* 510 */ 1123, 1123, 1466, 1210, 1291, 1123, 1290, 1294, 1123, 1135, /* 520 */ 1123, }; /********** End of lemon-generated parsing tables *****************************/ /* The next table maps tokens (terminal symbols) into fallback tokens. ** If a construct like the following: ** ** %fallback ID X Y Z. |
︙ | ︙ | |||
146510 146511 146512 146513 146514 146515 146516 | /* 267 */ "cmd ::= REINDEX", /* 268 */ "cmd ::= REINDEX nm dbnm", /* 269 */ "cmd ::= ANALYZE", /* 270 */ "cmd ::= ANALYZE nm dbnm", /* 271 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", /* 272 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", /* 273 */ "add_column_fullname ::= fullname", | | | > | | | | | | | | | | | | | | | | | | | | < | | | | | | > | | | | | | | | < | | | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | | | | > | | | | | | | | | | | | | | | | | 147462 147463 147464 147465 147466 147467 147468 147469 147470 147471 147472 147473 147474 147475 147476 147477 147478 147479 147480 147481 147482 147483 147484 147485 147486 147487 147488 147489 147490 147491 147492 147493 147494 147495 147496 147497 147498 147499 147500 147501 147502 147503 147504 147505 147506 147507 147508 147509 147510 147511 147512 147513 147514 147515 147516 147517 147518 147519 147520 147521 147522 147523 147524 147525 147526 147527 147528 147529 147530 147531 147532 147533 147534 147535 147536 147537 147538 147539 147540 147541 147542 147543 147544 147545 147546 147547 147548 147549 147550 147551 147552 147553 147554 147555 147556 147557 147558 147559 147560 147561 147562 147563 147564 147565 147566 147567 147568 | /* 267 */ "cmd ::= REINDEX", /* 268 */ "cmd ::= REINDEX nm dbnm", /* 269 */ "cmd ::= ANALYZE", /* 270 */ "cmd ::= ANALYZE nm dbnm", /* 271 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", /* 272 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", /* 273 */ "add_column_fullname ::= fullname", /* 274 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", /* 275 */ "cmd ::= create_vtab", /* 276 */ "cmd ::= create_vtab LP vtabarglist RP", /* 277 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", /* 278 */ "vtabarg ::=", /* 279 */ "vtabargtoken ::= ANY", /* 280 */ "vtabargtoken ::= lp anylist RP", /* 281 */ "lp ::= LP", /* 282 */ "with ::= WITH wqlist", /* 283 */ "with ::= WITH RECURSIVE wqlist", /* 284 */ "wqlist ::= nm eidlist_opt AS LP select RP", /* 285 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", /* 286 */ "windowdefn_list ::= windowdefn", /* 287 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", /* 288 */ "windowdefn ::= nm AS window", /* 289 */ "window ::= LP part_opt orderby_opt frame_opt RP", /* 290 */ "part_opt ::= PARTITION BY nexprlist", /* 291 */ "part_opt ::=", /* 292 */ "frame_opt ::=", /* 293 */ "frame_opt ::= range_or_rows frame_bound_s", /* 294 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e", /* 295 */ "range_or_rows ::= RANGE", /* 296 */ "range_or_rows ::= ROWS", /* 297 */ "frame_bound_s ::= frame_bound", /* 298 */ "frame_bound_s ::= UNBOUNDED PRECEDING", /* 299 */ "frame_bound_e ::= frame_bound", /* 300 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", /* 301 */ "frame_bound ::= expr PRECEDING", /* 302 */ "frame_bound ::= CURRENT ROW", /* 303 */ "frame_bound ::= expr FOLLOWING", /* 304 */ "window_clause ::= WINDOW windowdefn_list", /* 305 */ "over_clause ::= filter_opt OVER window", /* 306 */ "over_clause ::= filter_opt OVER nm", /* 307 */ "filter_opt ::=", /* 308 */ "filter_opt ::= FILTER LP WHERE expr RP", /* 309 */ "input ::= cmdlist", /* 310 */ "cmdlist ::= cmdlist ecmd", /* 311 */ "cmdlist ::= ecmd", /* 312 */ "ecmd ::= SEMI", /* 313 */ "ecmd ::= cmdx SEMI", /* 314 */ "ecmd ::= explain cmdx", /* 315 */ "trans_opt ::=", /* 316 */ "trans_opt ::= TRANSACTION", /* 317 */ "trans_opt ::= TRANSACTION nm", /* 318 */ "savepoint_opt ::= SAVEPOINT", /* 319 */ "savepoint_opt ::=", /* 320 */ "cmd ::= create_table create_table_args", /* 321 */ "columnlist ::= columnlist COMMA columnname carglist", /* 322 */ "columnlist ::= columnname carglist", /* 323 */ "nm ::= ID|INDEXED", /* 324 */ "nm ::= STRING", /* 325 */ "nm ::= JOIN_KW", /* 326 */ "typetoken ::= typename", /* 327 */ "typename ::= ID|STRING", /* 328 */ "signed ::= plus_num", /* 329 */ "signed ::= minus_num", /* 330 */ "carglist ::= carglist ccons", /* 331 */ "carglist ::=", /* 332 */ "ccons ::= NULL onconf", /* 333 */ "conslist_opt ::= COMMA conslist", /* 334 */ "conslist ::= conslist tconscomma tcons", /* 335 */ "conslist ::= tcons", /* 336 */ "tconscomma ::=", /* 337 */ "defer_subclause_opt ::= defer_subclause", /* 338 */ "resolvetype ::= raisetype", /* 339 */ "selectnowith ::= oneselect", /* 340 */ "oneselect ::= values", /* 341 */ "sclp ::= selcollist COMMA", /* 342 */ "as ::= ID|STRING", /* 343 */ "expr ::= term", /* 344 */ "likeop ::= LIKE_KW|MATCH", /* 345 */ "exprlist ::= nexprlist", /* 346 */ "nmnum ::= plus_num", /* 347 */ "nmnum ::= nm", /* 348 */ "nmnum ::= ON", /* 349 */ "nmnum ::= DELETE", /* 350 */ "nmnum ::= DEFAULT", /* 351 */ "plus_num ::= INTEGER|FLOAT", /* 352 */ "foreach_clause ::=", /* 353 */ "foreach_clause ::= FOR EACH ROW", /* 354 */ "trnm ::= nm", /* 355 */ "tridxby ::=", /* 356 */ "database_kw_opt ::= DATABASE", /* 357 */ "database_kw_opt ::=", /* 358 */ "kwcolumn_opt ::=", /* 359 */ "kwcolumn_opt ::= COLUMNKW", /* 360 */ "vtabarglist ::= vtabarg", /* 361 */ "vtabarglist ::= vtabarglist COMMA vtabarg", /* 362 */ "vtabarg ::= vtabarg vtabargtoken", /* 363 */ "anylist ::=", /* 364 */ "anylist ::= anylist LP anylist RP", /* 365 */ "anylist ::= anylist ANY", /* 366 */ "with ::=", }; #endif /* NDEBUG */ #if YYSTACKDEPTH<=0 /* ** Try to increase the size of the parser stack. Return the number |
︙ | ︙ | |||
147389 147390 147391 147392 147393 147394 147395 | { 160, -1 }, /* (267) cmd ::= REINDEX */ { 160, -3 }, /* (268) cmd ::= REINDEX nm dbnm */ { 160, -1 }, /* (269) cmd ::= ANALYZE */ { 160, -3 }, /* (270) cmd ::= ANALYZE nm dbnm */ { 160, -6 }, /* (271) cmd ::= ALTER TABLE fullname RENAME TO nm */ { 160, -7 }, /* (272) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ { 259, -1 }, /* (273) add_column_fullname ::= fullname */ | > | | | | | | | | | | | | | | | | | | | | | | | | | | < | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | | | | > | | | | | | | | | | | | | | | | | 148342 148343 148344 148345 148346 148347 148348 148349 148350 148351 148352 148353 148354 148355 148356 148357 148358 148359 148360 148361 148362 148363 148364 148365 148366 148367 148368 148369 148370 148371 148372 148373 148374 148375 148376 148377 148378 148379 148380 148381 148382 148383 148384 148385 148386 148387 148388 148389 148390 148391 148392 148393 148394 148395 148396 148397 148398 148399 148400 148401 148402 148403 148404 148405 148406 148407 148408 148409 148410 148411 148412 148413 148414 148415 148416 148417 148418 148419 148420 148421 148422 148423 148424 148425 148426 148427 148428 148429 148430 148431 148432 148433 148434 148435 148436 148437 148438 148439 148440 148441 148442 148443 148444 148445 148446 148447 148448 | { 160, -1 }, /* (267) cmd ::= REINDEX */ { 160, -3 }, /* (268) cmd ::= REINDEX nm dbnm */ { 160, -1 }, /* (269) cmd ::= ANALYZE */ { 160, -3 }, /* (270) cmd ::= ANALYZE nm dbnm */ { 160, -6 }, /* (271) cmd ::= ALTER TABLE fullname RENAME TO nm */ { 160, -7 }, /* (272) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ { 259, -1 }, /* (273) add_column_fullname ::= fullname */ { 160, -8 }, /* (274) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ { 160, -1 }, /* (275) cmd ::= create_vtab */ { 160, -4 }, /* (276) cmd ::= create_vtab LP vtabarglist RP */ { 261, -8 }, /* (277) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ { 263, 0 }, /* (278) vtabarg ::= */ { 264, -1 }, /* (279) vtabargtoken ::= ANY */ { 264, -3 }, /* (280) vtabargtoken ::= lp anylist RP */ { 265, -1 }, /* (281) lp ::= LP */ { 232, -2 }, /* (282) with ::= WITH wqlist */ { 232, -3 }, /* (283) with ::= WITH RECURSIVE wqlist */ { 208, -6 }, /* (284) wqlist ::= nm eidlist_opt AS LP select RP */ { 208, -8 }, /* (285) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ { 267, -1 }, /* (286) windowdefn_list ::= windowdefn */ { 267, -3 }, /* (287) windowdefn_list ::= windowdefn_list COMMA windowdefn */ { 268, -3 }, /* (288) windowdefn ::= nm AS window */ { 269, -5 }, /* (289) window ::= LP part_opt orderby_opt frame_opt RP */ { 271, -3 }, /* (290) part_opt ::= PARTITION BY nexprlist */ { 271, 0 }, /* (291) part_opt ::= */ { 270, 0 }, /* (292) frame_opt ::= */ { 270, -2 }, /* (293) frame_opt ::= range_or_rows frame_bound_s */ { 270, -5 }, /* (294) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */ { 273, -1 }, /* (295) range_or_rows ::= RANGE */ { 273, -1 }, /* (296) range_or_rows ::= ROWS */ { 275, -1 }, /* (297) frame_bound_s ::= frame_bound */ { 275, -2 }, /* (298) frame_bound_s ::= UNBOUNDED PRECEDING */ { 276, -1 }, /* (299) frame_bound_e ::= frame_bound */ { 276, -2 }, /* (300) frame_bound_e ::= UNBOUNDED FOLLOWING */ { 274, -2 }, /* (301) frame_bound ::= expr PRECEDING */ { 274, -2 }, /* (302) frame_bound ::= CURRENT ROW */ { 274, -2 }, /* (303) frame_bound ::= expr FOLLOWING */ { 218, -2 }, /* (304) window_clause ::= WINDOW windowdefn_list */ { 237, -3 }, /* (305) over_clause ::= filter_opt OVER window */ { 237, -3 }, /* (306) over_clause ::= filter_opt OVER nm */ { 272, 0 }, /* (307) filter_opt ::= */ { 272, -5 }, /* (308) filter_opt ::= FILTER LP WHERE expr RP */ { 155, -1 }, /* (309) input ::= cmdlist */ { 156, -2 }, /* (310) cmdlist ::= cmdlist ecmd */ { 156, -1 }, /* (311) cmdlist ::= ecmd */ { 157, -1 }, /* (312) ecmd ::= SEMI */ { 157, -2 }, /* (313) ecmd ::= cmdx SEMI */ { 157, -2 }, /* (314) ecmd ::= explain cmdx */ { 162, 0 }, /* (315) trans_opt ::= */ { 162, -1 }, /* (316) trans_opt ::= TRANSACTION */ { 162, -2 }, /* (317) trans_opt ::= TRANSACTION nm */ { 164, -1 }, /* (318) savepoint_opt ::= SAVEPOINT */ { 164, 0 }, /* (319) savepoint_opt ::= */ { 160, -2 }, /* (320) cmd ::= create_table create_table_args */ { 171, -4 }, /* (321) columnlist ::= columnlist COMMA columnname carglist */ { 171, -2 }, /* (322) columnlist ::= columnname carglist */ { 163, -1 }, /* (323) nm ::= ID|INDEXED */ { 163, -1 }, /* (324) nm ::= STRING */ { 163, -1 }, /* (325) nm ::= JOIN_KW */ { 177, -1 }, /* (326) typetoken ::= typename */ { 178, -1 }, /* (327) typename ::= ID|STRING */ { 179, -1 }, /* (328) signed ::= plus_num */ { 179, -1 }, /* (329) signed ::= minus_num */ { 176, -2 }, /* (330) carglist ::= carglist ccons */ { 176, 0 }, /* (331) carglist ::= */ { 183, -2 }, /* (332) ccons ::= NULL onconf */ { 172, -2 }, /* (333) conslist_opt ::= COMMA conslist */ { 195, -3 }, /* (334) conslist ::= conslist tconscomma tcons */ { 195, -1 }, /* (335) conslist ::= tcons */ { 196, 0 }, /* (336) tconscomma ::= */ { 200, -1 }, /* (337) defer_subclause_opt ::= defer_subclause */ { 202, -1 }, /* (338) resolvetype ::= raisetype */ { 206, -1 }, /* (339) selectnowith ::= oneselect */ { 207, -1 }, /* (340) oneselect ::= values */ { 221, -2 }, /* (341) sclp ::= selcollist COMMA */ { 222, -1 }, /* (342) as ::= ID|STRING */ { 185, -1 }, /* (343) expr ::= term */ { 238, -1 }, /* (344) likeop ::= LIKE_KW|MATCH */ { 229, -1 }, /* (345) exprlist ::= nexprlist */ { 247, -1 }, /* (346) nmnum ::= plus_num */ { 247, -1 }, /* (347) nmnum ::= nm */ { 247, -1 }, /* (348) nmnum ::= ON */ { 247, -1 }, /* (349) nmnum ::= DELETE */ { 247, -1 }, /* (350) nmnum ::= DEFAULT */ { 180, -1 }, /* (351) plus_num ::= INTEGER|FLOAT */ { 252, 0 }, /* (352) foreach_clause ::= */ { 252, -3 }, /* (353) foreach_clause ::= FOR EACH ROW */ { 255, -1 }, /* (354) trnm ::= nm */ { 256, 0 }, /* (355) tridxby ::= */ { 257, -1 }, /* (356) database_kw_opt ::= DATABASE */ { 257, 0 }, /* (357) database_kw_opt ::= */ { 260, 0 }, /* (358) kwcolumn_opt ::= */ { 260, -1 }, /* (359) kwcolumn_opt ::= COLUMNKW */ { 262, -1 }, /* (360) vtabarglist ::= vtabarg */ { 262, -3 }, /* (361) vtabarglist ::= vtabarglist COMMA vtabarg */ { 263, -2 }, /* (362) vtabarg ::= vtabarg vtabargtoken */ { 266, 0 }, /* (363) anylist ::= */ { 266, -4 }, /* (364) anylist ::= anylist LP anylist RP */ { 266, -2 }, /* (365) anylist ::= anylist ANY */ { 232, 0 }, /* (366) with ::= */ }; static void yy_accept(yyParser*); /* Forward Declaration */ /* ** Perform a reduce action and the shift that must immediately ** follow the reduce. |
︙ | ︙ | |||
147706 147707 147708 147709 147710 147711 147712 | case 34: /* ccons ::= DEFAULT scanpt ID|INDEXED */ { Expr *p = tokenExpr(pParse, TK_STRING, yymsp[0].minor.yy0); if( p ){ sqlite3ExprIdToTrueFalse(p); testcase( p->op==TK_TRUEFALSE && sqlite3ExprTruthValue(p) ); } | | | 148660 148661 148662 148663 148664 148665 148666 148667 148668 148669 148670 148671 148672 148673 148674 | case 34: /* ccons ::= DEFAULT scanpt ID|INDEXED */ { Expr *p = tokenExpr(pParse, TK_STRING, yymsp[0].minor.yy0); if( p ){ sqlite3ExprIdToTrueFalse(p); testcase( p->op==TK_TRUEFALSE && sqlite3ExprTruthValue(p) ); } sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n); } break; case 35: /* ccons ::= NOT NULL onconf */ {sqlite3AddNotNull(pParse, yymsp[0].minor.yy70);} break; case 36: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy70,yymsp[0].minor.yy70,yymsp[-2].minor.yy70);} |
︙ | ︙ | |||
148039 148040 148041 148042 148043 148044 148045 | } break; case 108: /* dbnm ::= */ case 122: /* indexed_opt ::= */ yytestcase(yyruleno==122); {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;} break; case 110: /* fullname ::= nm */ | > > > > > > > > > > > > > | < | | 148993 148994 148995 148996 148997 148998 148999 149000 149001 149002 149003 149004 149005 149006 149007 149008 149009 149010 149011 149012 149013 149014 149015 149016 149017 149018 149019 149020 149021 149022 149023 | } break; case 108: /* dbnm ::= */ case 122: /* indexed_opt ::= */ yytestcase(yyruleno==122); {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;} break; case 110: /* fullname ::= nm */ { yylhsminor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[0].minor.yy0,0); if( IN_RENAME_OBJECT && yylhsminor.yy135 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy135->a[0].zName, &yymsp[0].minor.yy0); } yymsp[0].minor.yy135 = yylhsminor.yy135; break; case 111: /* fullname ::= nm DOT nm */ { yylhsminor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); if( IN_RENAME_OBJECT && yylhsminor.yy135 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy135->a[0].zName, &yymsp[0].minor.yy0); } yymsp[-2].minor.yy135 = yylhsminor.yy135; break; case 112: /* xfullname ::= nm */ {yymsp[0].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} break; case 113: /* xfullname ::= nm DOT nm */ {yymsp[-2].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} break; case 114: /* xfullname ::= nm DOT nm AS nm */ { yymsp[-4].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ if( yymsp[-4].minor.yy135 ) yymsp[-4].minor.yy135->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); } |
︙ | ︙ | |||
148193 148194 148195 148196 148197 148198 148199 | case 155: /* upsert ::= ON CONFLICT DO NOTHING */ { yymsp[-3].minor.yy340 = sqlite3UpsertNew(pParse->db,0,0,0,0); } break; case 159: /* idlist_opt ::= LP idlist RP */ {yymsp[-2].minor.yy48 = yymsp[-1].minor.yy48;} break; case 160: /* idlist ::= idlist COMMA nm */ | | | > > > > > > > > | 149159 149160 149161 149162 149163 149164 149165 149166 149167 149168 149169 149170 149171 149172 149173 149174 149175 149176 149177 149178 149179 149180 149181 149182 149183 149184 149185 149186 149187 149188 149189 149190 149191 149192 149193 149194 149195 149196 149197 149198 149199 149200 149201 149202 149203 149204 149205 149206 | case 155: /* upsert ::= ON CONFLICT DO NOTHING */ { yymsp[-3].minor.yy340 = sqlite3UpsertNew(pParse->db,0,0,0,0); } break; case 159: /* idlist_opt ::= LP idlist RP */ {yymsp[-2].minor.yy48 = yymsp[-1].minor.yy48;} break; case 160: /* idlist ::= idlist COMMA nm */ {yymsp[-2].minor.yy48 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy48,&yymsp[0].minor.yy0);} break; case 161: /* idlist ::= nm */ {yymsp[0].minor.yy48 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} break; case 162: /* expr ::= LP expr RP */ {yymsp[-2].minor.yy18 = yymsp[-1].minor.yy18;} break; case 163: /* expr ::= ID|INDEXED */ case 164: /* expr ::= JOIN_KW */ yytestcase(yyruleno==164); {yymsp[0].minor.yy18=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} break; case 165: /* expr ::= nm DOT nm */ { Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); if( IN_RENAME_OBJECT ){ sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0); sqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0); } yylhsminor.yy18 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); } yymsp[-2].minor.yy18 = yylhsminor.yy18; break; case 166: /* expr ::= nm DOT nm DOT nm */ { Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1); Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3); if( IN_RENAME_OBJECT ){ sqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0); sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0); } yylhsminor.yy18 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); } yymsp[-4].minor.yy18 = yylhsminor.yy18; break; case 167: /* term ::= NULL|FLOAT|BLOB */ case 168: /* term ::= STRING */ yytestcase(yyruleno==168); {yymsp[0].minor.yy18=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/} |
︙ | ︙ | |||
148516 148517 148518 148519 148520 148521 148522 148523 148524 148525 148526 148527 148528 148529 | {yymsp[-2].minor.yy420 = yymsp[-1].minor.yy420;} break; case 219: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ { sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy420, yymsp[-10].minor.yy70, &yymsp[-11].minor.yy0, yymsp[0].minor.yy18, SQLITE_SO_ASC, yymsp[-8].minor.yy70, SQLITE_IDXTYPE_APPDEF); } break; case 220: /* uniqueflag ::= UNIQUE */ case 260: /* raisetype ::= ABORT */ yytestcase(yyruleno==260); {yymsp[0].minor.yy70 = OE_Abort;} break; case 221: /* uniqueflag ::= */ | > > > | 149490 149491 149492 149493 149494 149495 149496 149497 149498 149499 149500 149501 149502 149503 149504 149505 149506 | {yymsp[-2].minor.yy420 = yymsp[-1].minor.yy420;} break; case 219: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ { sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy420, yymsp[-10].minor.yy70, &yymsp[-11].minor.yy0, yymsp[0].minor.yy18, SQLITE_SO_ASC, yymsp[-8].minor.yy70, SQLITE_IDXTYPE_APPDEF); if( IN_RENAME_OBJECT && pParse->pNewIndex ){ sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0); } } break; case 220: /* uniqueflag ::= UNIQUE */ case 260: /* raisetype ::= ABORT */ yytestcase(yyruleno==260); {yymsp[0].minor.yy70 = OE_Abort;} break; case 221: /* uniqueflag ::= */ |
︙ | ︙ | |||
148591 148592 148593 148594 148595 148596 148597 | {yymsp[0].minor.yy34.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy34.b = 0;} break; case 245: /* trigger_event ::= UPDATE OF idlist */ {yymsp[-2].minor.yy34.a = TK_UPDATE; yymsp[-2].minor.yy34.b = yymsp[0].minor.yy48;} break; case 246: /* when_clause ::= */ case 265: /* key_opt ::= */ yytestcase(yyruleno==265); | | | 149568 149569 149570 149571 149572 149573 149574 149575 149576 149577 149578 149579 149580 149581 149582 | {yymsp[0].minor.yy34.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy34.b = 0;} break; case 245: /* trigger_event ::= UPDATE OF idlist */ {yymsp[-2].minor.yy34.a = TK_UPDATE; yymsp[-2].minor.yy34.b = yymsp[0].minor.yy48;} break; case 246: /* when_clause ::= */ case 265: /* key_opt ::= */ yytestcase(yyruleno==265); case 307: /* filter_opt ::= */ yytestcase(yyruleno==307); { yymsp[1].minor.yy18 = 0; } break; case 247: /* when_clause ::= WHEN expr */ case 266: /* key_opt ::= KEY expr */ yytestcase(yyruleno==266); { yymsp[-1].minor.yy18 = yymsp[0].minor.yy18; } break; case 248: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
︙ | ︙ | |||
148634 148635 148636 148637 148638 148639 148640 | { sqlite3ErrorMsg(pParse, "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; case 253: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ | | | | | 149611 149612 149613 149614 149615 149616 149617 149618 149619 149620 149621 149622 149623 149624 149625 149626 149627 149628 149629 149630 149631 149632 149633 149634 149635 | { sqlite3ErrorMsg(pParse, "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; case 253: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ {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);} yymsp[-7].minor.yy207 = yylhsminor.yy207; break; case 254: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ { 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*/ } yymsp[-7].minor.yy207 = yylhsminor.yy207; break; case 255: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ {yylhsminor.yy207 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy18, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy392);} yymsp[-5].minor.yy207 = yylhsminor.yy207; break; case 256: /* trigger_cmd ::= scanpt select scanpt */ {yylhsminor.yy207 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy489, yymsp[-2].minor.yy392, yymsp[0].minor.yy392); /*yylhsminor.yy207-overwrites-yymsp[-1].minor.yy489*/} yymsp[-2].minor.yy207 = yylhsminor.yy207; break; case 257: /* expr ::= RAISE LP IGNORE RP */ |
︙ | ︙ | |||
148717 148718 148719 148720 148721 148722 148723 | break; case 273: /* add_column_fullname ::= fullname */ { disableLookaside(pParse); sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy135); } break; | > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 149694 149695 149696 149697 149698 149699 149700 149701 149702 149703 149704 149705 149706 149707 149708 149709 149710 149711 149712 149713 149714 149715 149716 149717 149718 149719 149720 149721 149722 149723 149724 149725 149726 149727 149728 149729 149730 149731 149732 149733 149734 149735 149736 149737 149738 149739 149740 149741 149742 149743 149744 149745 149746 149747 149748 149749 149750 149751 149752 149753 149754 149755 149756 149757 149758 149759 149760 149761 149762 149763 149764 149765 149766 149767 149768 149769 149770 149771 149772 149773 149774 149775 149776 149777 149778 149779 149780 149781 149782 149783 149784 149785 149786 149787 149788 149789 149790 149791 149792 149793 149794 149795 149796 149797 149798 149799 149800 149801 149802 149803 149804 149805 149806 149807 149808 149809 149810 149811 149812 149813 149814 149815 149816 149817 149818 149819 149820 149821 149822 149823 149824 149825 149826 149827 149828 149829 149830 149831 149832 149833 149834 149835 149836 149837 149838 149839 149840 149841 149842 149843 149844 149845 149846 149847 149848 149849 149850 149851 149852 149853 149854 149855 149856 149857 149858 149859 149860 149861 149862 149863 149864 149865 149866 149867 149868 149869 149870 149871 149872 149873 149874 149875 149876 149877 149878 149879 149880 149881 149882 149883 149884 149885 149886 149887 149888 149889 149890 149891 149892 149893 149894 149895 149896 149897 149898 149899 149900 149901 149902 149903 149904 149905 149906 149907 149908 149909 | break; case 273: /* add_column_fullname ::= fullname */ { disableLookaside(pParse); sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy135); } break; case 274: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ { sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy135, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; case 275: /* cmd ::= create_vtab */ {sqlite3VtabFinishParse(pParse,0);} break; case 276: /* cmd ::= create_vtab LP vtabarglist RP */ {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} break; case 277: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ { sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy70); } break; case 278: /* vtabarg ::= */ {sqlite3VtabArgInit(pParse);} break; case 279: /* vtabargtoken ::= ANY */ case 280: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==280); case 281: /* lp ::= LP */ yytestcase(yyruleno==281); {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} break; case 282: /* with ::= WITH wqlist */ case 283: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==283); { sqlite3WithPush(pParse, yymsp[0].minor.yy449, 1); } break; case 284: /* wqlist ::= nm eidlist_opt AS LP select RP */ { yymsp[-5].minor.yy449 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy420, yymsp[-1].minor.yy489); /*A-overwrites-X*/ } break; case 285: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ { yymsp[-7].minor.yy449 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy449, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy420, yymsp[-1].minor.yy489); } break; case 286: /* windowdefn_list ::= windowdefn */ { yylhsminor.yy327 = yymsp[0].minor.yy327; } yymsp[0].minor.yy327 = yylhsminor.yy327; break; case 287: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ { assert( yymsp[0].minor.yy327!=0 ); yymsp[0].minor.yy327->pNextWin = yymsp[-2].minor.yy327; yylhsminor.yy327 = yymsp[0].minor.yy327; } yymsp[-2].minor.yy327 = yylhsminor.yy327; break; case 288: /* windowdefn ::= nm AS window */ { if( ALWAYS(yymsp[0].minor.yy327) ){ yymsp[0].minor.yy327->zName = sqlite3DbStrNDup(pParse->db, yymsp[-2].minor.yy0.z, yymsp[-2].minor.yy0.n); } yylhsminor.yy327 = yymsp[0].minor.yy327; } yymsp[-2].minor.yy327 = yylhsminor.yy327; break; case 289: /* window ::= LP part_opt orderby_opt frame_opt RP */ { yymsp[-4].minor.yy327 = yymsp[-1].minor.yy327; if( ALWAYS(yymsp[-4].minor.yy327) ){ yymsp[-4].minor.yy327->pPartition = yymsp[-3].minor.yy420; yymsp[-4].minor.yy327->pOrderBy = yymsp[-2].minor.yy420; } } break; case 290: /* part_opt ::= PARTITION BY nexprlist */ { yymsp[-2].minor.yy420 = yymsp[0].minor.yy420; } break; case 291: /* part_opt ::= */ { yymsp[1].minor.yy420 = 0; } break; case 292: /* frame_opt ::= */ { yymsp[1].minor.yy327 = sqlite3WindowAlloc(pParse, TK_RANGE, TK_UNBOUNDED, 0, TK_CURRENT, 0); } break; case 293: /* frame_opt ::= range_or_rows frame_bound_s */ { yylhsminor.yy327 = sqlite3WindowAlloc(pParse, yymsp[-1].minor.yy70, yymsp[0].minor.yy119.eType, yymsp[0].minor.yy119.pExpr, TK_CURRENT, 0); } yymsp[-1].minor.yy327 = yylhsminor.yy327; break; case 294: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */ { 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); } yymsp[-4].minor.yy327 = yylhsminor.yy327; break; case 295: /* range_or_rows ::= RANGE */ { yymsp[0].minor.yy70 = TK_RANGE; } break; case 296: /* range_or_rows ::= ROWS */ { yymsp[0].minor.yy70 = TK_ROWS; } break; case 297: /* frame_bound_s ::= frame_bound */ case 299: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==299); { yylhsminor.yy119 = yymsp[0].minor.yy119; } yymsp[0].minor.yy119 = yylhsminor.yy119; break; case 298: /* frame_bound_s ::= UNBOUNDED PRECEDING */ case 300: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==300); {yymsp[-1].minor.yy119.eType = TK_UNBOUNDED; yymsp[-1].minor.yy119.pExpr = 0;} break; case 301: /* frame_bound ::= expr PRECEDING */ { yylhsminor.yy119.eType = TK_PRECEDING; yylhsminor.yy119.pExpr = yymsp[-1].minor.yy18; } yymsp[-1].minor.yy119 = yylhsminor.yy119; break; case 302: /* frame_bound ::= CURRENT ROW */ { yymsp[-1].minor.yy119.eType = TK_CURRENT ; yymsp[-1].minor.yy119.pExpr = 0; } break; case 303: /* frame_bound ::= expr FOLLOWING */ { yylhsminor.yy119.eType = TK_FOLLOWING; yylhsminor.yy119.pExpr = yymsp[-1].minor.yy18; } yymsp[-1].minor.yy119 = yylhsminor.yy119; break; case 304: /* window_clause ::= WINDOW windowdefn_list */ { yymsp[-1].minor.yy327 = yymsp[0].minor.yy327; } break; case 305: /* over_clause ::= filter_opt OVER window */ { yylhsminor.yy327 = yymsp[0].minor.yy327; assert( yylhsminor.yy327!=0 ); yylhsminor.yy327->pFilter = yymsp[-2].minor.yy18; } yymsp[-2].minor.yy327 = yylhsminor.yy327; break; case 306: /* over_clause ::= filter_opt OVER nm */ { yylhsminor.yy327 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); if( yylhsminor.yy327 ){ yylhsminor.yy327->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); yylhsminor.yy327->pFilter = yymsp[-2].minor.yy18; }else{ sqlite3ExprDelete(pParse->db, yymsp[-2].minor.yy18); } } yymsp[-2].minor.yy327 = yylhsminor.yy327; break; case 308: /* filter_opt ::= FILTER LP WHERE expr RP */ { yymsp[-4].minor.yy18 = yymsp[-1].minor.yy18; } break; default: /* (309) input ::= cmdlist */ yytestcase(yyruleno==309); /* (310) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==310); /* (311) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=311); /* (312) ecmd ::= SEMI */ yytestcase(yyruleno==312); /* (313) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==313); /* (314) ecmd ::= explain cmdx */ yytestcase(yyruleno==314); /* (315) trans_opt ::= */ yytestcase(yyruleno==315); /* (316) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==316); /* (317) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==317); /* (318) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==318); /* (319) savepoint_opt ::= */ yytestcase(yyruleno==319); /* (320) cmd ::= create_table create_table_args */ yytestcase(yyruleno==320); /* (321) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==321); /* (322) columnlist ::= columnname carglist */ yytestcase(yyruleno==322); /* (323) nm ::= ID|INDEXED */ yytestcase(yyruleno==323); /* (324) nm ::= STRING */ yytestcase(yyruleno==324); /* (325) nm ::= JOIN_KW */ yytestcase(yyruleno==325); /* (326) typetoken ::= typename */ yytestcase(yyruleno==326); /* (327) typename ::= ID|STRING */ yytestcase(yyruleno==327); /* (328) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=328); /* (329) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=329); /* (330) carglist ::= carglist ccons */ yytestcase(yyruleno==330); /* (331) carglist ::= */ yytestcase(yyruleno==331); /* (332) ccons ::= NULL onconf */ yytestcase(yyruleno==332); /* (333) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==333); /* (334) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==334); /* (335) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=335); /* (336) tconscomma ::= */ yytestcase(yyruleno==336); /* (337) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=337); /* (338) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=338); /* (339) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=339); /* (340) oneselect ::= values */ yytestcase(yyruleno==340); /* (341) sclp ::= selcollist COMMA */ yytestcase(yyruleno==341); /* (342) as ::= ID|STRING */ yytestcase(yyruleno==342); /* (343) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=343); /* (344) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==344); /* (345) exprlist ::= nexprlist */ yytestcase(yyruleno==345); /* (346) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=346); /* (347) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=347); /* (348) nmnum ::= ON */ yytestcase(yyruleno==348); /* (349) nmnum ::= DELETE */ yytestcase(yyruleno==349); /* (350) nmnum ::= DEFAULT */ yytestcase(yyruleno==350); /* (351) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==351); /* (352) foreach_clause ::= */ yytestcase(yyruleno==352); /* (353) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==353); /* (354) trnm ::= nm */ yytestcase(yyruleno==354); /* (355) tridxby ::= */ yytestcase(yyruleno==355); /* (356) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==356); /* (357) database_kw_opt ::= */ yytestcase(yyruleno==357); /* (358) kwcolumn_opt ::= */ yytestcase(yyruleno==358); /* (359) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==359); /* (360) vtabarglist ::= vtabarg */ yytestcase(yyruleno==360); /* (361) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==361); /* (362) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==362); /* (363) anylist ::= */ yytestcase(yyruleno==363); /* (364) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==364); /* (365) anylist ::= anylist ANY */ yytestcase(yyruleno==365); /* (366) with ::= */ yytestcase(yyruleno==366); break; /********** End reduce actions ************************************************/ }; assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) ); yygoto = yyRuleInfo[yyruleno].lhs; yysize = yyRuleInfo[yyruleno].nrhs; yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto); |
︙ | ︙ | |||
149736 149737 149738 149739 149740 149741 149742 | 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, /* Dx */ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, /* Ex */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, /* Fx */ }; #define IdChar(C) (((c=C)>=0x42 && sqlite3IsEbcdicIdChar[c-0x40])) #endif | | < < | 150718 150719 150720 150721 150722 150723 150724 150725 150726 150727 150728 150729 150730 150731 150732 150733 | 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, /* Dx */ 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, /* Ex */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, /* Fx */ }; #define IdChar(C) (((c=C)>=0x42 && sqlite3IsEbcdicIdChar[c-0x40])) #endif /* Make the IdChar function accessible from ctime.c and alter.c */ SQLITE_PRIVATE int sqlite3IsIdChar(u8 c){ return IdChar(c); } #ifndef SQLITE_OMIT_WINDOWFUNC /* ** Return the id of the next token in string (*pz). Before returning, set ** (*pz) to point to the byte following the parsed token. */ static int getToken(const unsigned char **pz){ |
︙ | ︙ | |||
150242 150243 150244 150245 150246 150247 150248 | pParse->nTableLock = 0; } #endif #ifndef SQLITE_OMIT_VIRTUALTABLE sqlite3_free(pParse->apVtabLock); #endif | | > > | > < | 151222 151223 151224 151225 151226 151227 151228 151229 151230 151231 151232 151233 151234 151235 151236 151237 151238 151239 151240 151241 151242 151243 151244 151245 151246 151247 | pParse->nTableLock = 0; } #endif #ifndef SQLITE_OMIT_VIRTUALTABLE sqlite3_free(pParse->apVtabLock); #endif if( !IN_SPECIAL_PARSE ){ /* If the pParse->declareVtab flag is set, do not delete any table ** structure built up in pParse->pNewTable. The calling code (see vtab.c) ** will take responsibility for freeing the Table structure. */ sqlite3DeleteTable(db, pParse->pNewTable); } if( !IN_RENAME_OBJECT ){ sqlite3DeleteTrigger(db, pParse->pNewTrigger); } if( pParse->pWithToFree ) sqlite3WithDelete(db, pParse->pWithToFree); sqlite3DbFree(db, pParse->pVList); while( pParse->pAinc ){ AutoincInfo *p = pParse->pAinc; pParse->pAinc = p->pNext; sqlite3DbFreeNN(db, p); } while( pParse->pZombieTab ){ |
︙ | ︙ | |||
151988 151989 151990 151991 151992 151993 151994 151995 151996 151997 151998 151999 152000 152001 | SQLITE_PRIVATE const char *sqlite3ErrName(int rc){ const char *zName = 0; int i, origRc = rc; for(i=0; i<2 && zName==0; i++, rc &= 0xff){ switch( rc ){ case SQLITE_OK: zName = "SQLITE_OK"; break; case SQLITE_ERROR: zName = "SQLITE_ERROR"; break; case SQLITE_INTERNAL: zName = "SQLITE_INTERNAL"; break; case SQLITE_PERM: zName = "SQLITE_PERM"; break; case SQLITE_ABORT: zName = "SQLITE_ABORT"; break; case SQLITE_ABORT_ROLLBACK: zName = "SQLITE_ABORT_ROLLBACK"; break; case SQLITE_BUSY: zName = "SQLITE_BUSY"; break; case SQLITE_BUSY_RECOVERY: zName = "SQLITE_BUSY_RECOVERY"; break; case SQLITE_BUSY_SNAPSHOT: zName = "SQLITE_BUSY_SNAPSHOT"; break; | > | 152970 152971 152972 152973 152974 152975 152976 152977 152978 152979 152980 152981 152982 152983 152984 | SQLITE_PRIVATE const char *sqlite3ErrName(int rc){ const char *zName = 0; int i, origRc = rc; for(i=0; i<2 && zName==0; i++, rc &= 0xff){ switch( rc ){ case SQLITE_OK: zName = "SQLITE_OK"; break; case SQLITE_ERROR: zName = "SQLITE_ERROR"; break; case SQLITE_ERROR_SNAPSHOT: zName = "SQLITE_ERROR_SNAPSHOT"; break; case SQLITE_INTERNAL: zName = "SQLITE_INTERNAL"; break; case SQLITE_PERM: zName = "SQLITE_PERM"; break; case SQLITE_ABORT: zName = "SQLITE_ABORT"; break; case SQLITE_ABORT_ROLLBACK: zName = "SQLITE_ABORT_ROLLBACK"; break; case SQLITE_BUSY: zName = "SQLITE_BUSY"; break; case SQLITE_BUSY_RECOVERY: zName = "SQLITE_BUSY_RECOVERY"; break; case SQLITE_BUSY_SNAPSHOT: zName = "SQLITE_BUSY_SNAPSHOT"; break; |
︙ | ︙ | |||
181427 181428 181429 181430 181431 181432 181433 | s.z = z; if( geopolySkipSpace(&s)=='[' ){ s.z++; while( geopolySkipSpace(&s)=='[' ){ int ii = 0; char c; s.z++; | | | 182410 182411 182412 182413 182414 182415 182416 182417 182418 182419 182420 182421 182422 182423 182424 | s.z = z; if( geopolySkipSpace(&s)=='[' ){ s.z++; while( geopolySkipSpace(&s)=='[' ){ int ii = 0; char c; s.z++; if( s.nVertex>=s.nAlloc ){ GeoCoord *aNew; s.nAlloc = s.nAlloc*2 + 16; aNew = sqlite3_realloc64(s.a, s.nAlloc*sizeof(GeoCoord)*2 ); if( aNew==0 ){ rc = SQLITE_NOMEM; s.nErr++; break; |
︙ | ︙ | |||
181509 181510 181511 181512 181513 181514 181515 | if( sqlite3_value_type(pVal)==SQLITE_BLOB && (nByte = sqlite3_value_bytes(pVal))>=(4+6*sizeof(GeoCoord)) ){ const unsigned char *a = sqlite3_value_blob(pVal); int nVertex; nVertex = (a[1]<<16) + (a[2]<<8) + a[3]; if( (a[0]==0 || a[0]==1) | | | 182492 182493 182494 182495 182496 182497 182498 182499 182500 182501 182502 182503 182504 182505 182506 | if( sqlite3_value_type(pVal)==SQLITE_BLOB && (nByte = sqlite3_value_bytes(pVal))>=(4+6*sizeof(GeoCoord)) ){ const unsigned char *a = sqlite3_value_blob(pVal); int nVertex; nVertex = (a[1]<<16) + (a[2]<<8) + a[3]; if( (a[0]==0 || a[0]==1) && (nVertex*2*sizeof(GeoCoord) + 4)==(unsigned int)nByte ){ p = sqlite3_malloc64( sizeof(*p) + (nVertex-1)*2*sizeof(GeoCoord) ); if( p==0 ){ if( pRc ) *pRc = SQLITE_NOMEM; if( pCtx ) sqlite3_result_error_nomem(pCtx); }else{ int x = 1; |
︙ | ︙ | |||
182762 182763 182764 182765 182766 182767 182768 | if( rc==SQLITE_OK ){ rc = rc2; } } } /* Change the data */ | | | 183745 183746 183747 183748 183749 183750 183751 183752 183753 183754 183755 183756 183757 183758 183759 | if( rc==SQLITE_OK ){ rc = rc2; } } } /* Change the data */ if( rc==SQLITE_OK && nData>1 ){ sqlite3_stmt *pUp = pRtree->pWriteAux; int jj; int nChange = 0; sqlite3_bind_int64(pUp, 1, cell.iRowid); assert( pRtree->nAux>=1 ); if( sqlite3_value_nochange(aData[2]) ){ sqlite3_bind_null(pUp, 2); |
︙ | ︙ | |||
210978 210979 210980 210981 210982 210983 210984 | assert( p->ts.eState==1 || p->ts.eState==2 || p->ts.eState==0 ); p->ts.eState = 0; break; case FTS5_SAVEPOINT: assert( p->ts.eState==1 ); assert( iSavepoint>=0 ); | | | 211961 211962 211963 211964 211965 211966 211967 211968 211969 211970 211971 211972 211973 211974 211975 | assert( p->ts.eState==1 || p->ts.eState==2 || p->ts.eState==0 ); p->ts.eState = 0; break; case FTS5_SAVEPOINT: assert( p->ts.eState==1 ); assert( iSavepoint>=0 ); assert( iSavepoint>=p->ts.iSavepoint ); p->ts.iSavepoint = iSavepoint; break; case FTS5_RELEASE: assert( p->ts.eState==1 ); assert( iSavepoint>=0 ); assert( iSavepoint<=p->ts.iSavepoint ); |
︙ | ︙ | |||
211903 211904 211905 211906 211907 211908 211909 211910 211911 211912 211913 211914 211915 211916 | ** return results to the user for this query. The current cursor ** (pCursor) is used to execute the query issued by function ** fts5CursorFirstSorted() above. */ assert( pRowidEq==0 && pRowidLe==0 && pRowidGe==0 && pRank==0 ); assert( nVal==0 && pMatch==0 && bOrderByRank==0 && bDesc==0 ); assert( pCsr->iLastRowid==LARGEST_INT64 ); assert( pCsr->iFirstRowid==SMALLEST_INT64 ); pCsr->ePlan = FTS5_PLAN_SOURCE; pCsr->pExpr = pTab->pSortCsr->pExpr; rc = fts5CursorFirst(pTab, pCsr, bDesc); }else if( pMatch ){ const char *zExpr = (const char*)sqlite3_value_text(apVal[0]); if( zExpr==0 ) zExpr = ""; | > > > > > > > | 212886 212887 212888 212889 212890 212891 212892 212893 212894 212895 212896 212897 212898 212899 212900 212901 212902 212903 212904 212905 212906 | ** return results to the user for this query. The current cursor ** (pCursor) is used to execute the query issued by function ** fts5CursorFirstSorted() above. */ assert( pRowidEq==0 && pRowidLe==0 && pRowidGe==0 && pRank==0 ); assert( nVal==0 && pMatch==0 && bOrderByRank==0 && bDesc==0 ); assert( pCsr->iLastRowid==LARGEST_INT64 ); assert( pCsr->iFirstRowid==SMALLEST_INT64 ); if( pTab->pSortCsr->bDesc ){ pCsr->iLastRowid = pTab->pSortCsr->iFirstRowid; pCsr->iFirstRowid = pTab->pSortCsr->iLastRowid; }else{ pCsr->iLastRowid = pTab->pSortCsr->iLastRowid; pCsr->iFirstRowid = pTab->pSortCsr->iFirstRowid; } pCsr->ePlan = FTS5_PLAN_SOURCE; pCsr->pExpr = pTab->pSortCsr->pExpr; rc = fts5CursorFirst(pTab, pCsr, bDesc); }else if( pMatch ){ const char *zExpr = (const char*)sqlite3_value_text(apVal[0]); if( zExpr==0 ) zExpr = ""; |
︙ | ︙ | |||
213333 213334 213335 213336 213337 213338 213339 | static void fts5SourceIdFunc( sqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ sqlite3_value **apUnused /* Function arguments */ ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); | | | 214323 214324 214325 214326 214327 214328 214329 214330 214331 214332 214333 214334 214335 214336 214337 | static void fts5SourceIdFunc( sqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ sqlite3_value **apUnused /* Function arguments */ ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); sqlite3_result_text(pCtx, "fts5: 2018-09-06 18:56:36 91aab32e71fcb924e24c02d5f0901f7a474760fc993a7e7436e667512cf5d3c3", -1, SQLITE_TRANSIENT); } static int fts5Init(sqlite3 *db){ static const sqlite3_module fts5Mod = { /* iVersion */ 2, /* xCreate */ fts5CreateMethod, /* xConnect */ fts5ConnectMethod, |
︙ | ︙ | |||
218043 218044 218045 218046 218047 218048 218049 | #endif return rc; } #endif /* SQLITE_CORE */ #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ /************** End of stmt.c ************************************************/ | | | | 219033 219034 219035 219036 219037 219038 219039 219040 219041 219042 219043 219044 219045 219046 | #endif return rc; } #endif /* SQLITE_CORE */ #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ /************** End of stmt.c ************************************************/ #if __LINE__!=219040 #undef SQLITE_SOURCE_ID #define SQLITE_SOURCE_ID "2018-09-06 18:56:36 91aab32e71fcb924e24c02d5f0901f7a474760fc993a7e7436e667512cf5alt2" #endif /* Return the source-id for this library */ SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } /************************** End of sqlite3.c ******************************/ |
Changes to src/sqlite3.h.
︙ | ︙ | |||
121 122 123 124 125 126 127 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.25.0" #define SQLITE_VERSION_NUMBER 3025000 | | | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.25.0" #define SQLITE_VERSION_NUMBER 3025000 #define SQLITE_SOURCE_ID "2018-09-06 18:56:36 91aab32e71fcb924e24c02d5f0901f7a474760fc993a7e7436e667512cf5d3c3" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
︙ | ︙ | |||
468 469 470 471 472 473 474 475 476 477 478 479 480 481 | ** on a per database connection basis using the ** [sqlite3_extended_result_codes()] API. Or, the extended code for ** the most recent error can be obtained using ** [sqlite3_extended_errcode()]. */ #define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8)) #define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8)) #define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8)) #define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8)) #define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8)) #define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8)) #define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8)) #define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6<<8)) #define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7<<8)) | > | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 | ** on a per database connection basis using the ** [sqlite3_extended_result_codes()] API. Or, the extended code for ** the most recent error can be obtained using ** [sqlite3_extended_errcode()]. */ #define SQLITE_ERROR_MISSING_COLLSEQ (SQLITE_ERROR | (1<<8)) #define SQLITE_ERROR_RETRY (SQLITE_ERROR | (2<<8)) #define SQLITE_ERROR_SNAPSHOT (SQLITE_ERROR | (3<<8)) #define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8)) #define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8)) #define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8)) #define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8)) #define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8)) #define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6<<8)) #define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7<<8)) |
︙ | ︙ | |||
9049 9050 9051 9052 9053 9054 9055 | ** must have no active statements (SELECT statements that have been passed ** to sqlite3_step() but not sqlite3_reset() or sqlite3_finalize()). ** SQLITE_ERROR is returned if either of these conditions is violated, or ** if schema S does not exist, or if the snapshot object is invalid. ** ** ^A call to sqlite3_snapshot_open() will fail to open if the specified ** snapshot has been overwritten by a [checkpoint]. In this case | | | | 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 | ** must have no active statements (SELECT statements that have been passed ** to sqlite3_step() but not sqlite3_reset() or sqlite3_finalize()). ** SQLITE_ERROR is returned if either of these conditions is violated, or ** if schema S does not exist, or if the snapshot object is invalid. ** ** ^A call to sqlite3_snapshot_open() will fail to open if the specified ** snapshot has been overwritten by a [checkpoint]. In this case ** SQLITE_ERROR_SNAPSHOT is returned. ** ** If there is already a read transaction open when this function is ** invoked, then the same read transaction remains open (on the same ** database snapshot) if SQLITE_ERROR, SQLITE_BUSY or SQLITE_ERROR_SNAPSHOT ** is returned. If another error code - for example SQLITE_PROTOCOL or an ** SQLITE_IOERR error code - is returned, then the final state of the ** read transaction is undefined. If SQLITE_OK is returned, then the ** read transaction is now open on database snapshot P. ** ** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the ** database connection D does not know that the database file for |
︙ | ︙ |