diff --git a/Freeswitch.sln b/Freeswitch.sln index 3361564de8..d79fcfe42e 100644 --- a/Freeswitch.sln +++ b/Freeswitch.sln @@ -340,9 +340,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsrtp", "libs\srtp\libsrtp.vcproj", "{EEF031CB-FED8-451E-A471-91EC8D4F6750}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsqlite", "libs\win32\sqlite\sqlite.vcproj", "{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}" - ProjectSection(ProjectDependencies) = postProject - {6B9217D6-8259-4817-B8A5-2FEAD349EDEB} = {6B9217D6-8259-4817-B8A5-2FEAD349EDEB} - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpcre", "libs\win32\pcre\libpcre.vcproj", "{8D04B550-D240-4A44-8A18-35DA3F7038D9}" ProjectSection(ProjectDependencies) = postProject @@ -368,8 +365,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libaprutil", "libs\win32\ap EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Downloads", "_Downloads", "{C120A020-773F-4EA3-923F-B67AF28B750D}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download SQLITE", "libs\win32\Download SQLITE.vcproj", "{6B9217D6-8259-4817-B8A5-2FEAD349EDEB}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download SPEEX", "libs\win32\Download SPEEX.vcproj", "{5C9C69D2-8B98-42DA-8D82-6E0B48446FAC}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libspeex", "libs\win32\speex\libspeex.vcproj", "{1C469CDD-A3AF-4A94-A592-B2CF12F2D918}" @@ -782,10 +777,6 @@ Global {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|Win32.Build.0 = Debug|Win32 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|Win32.ActiveCfg = Release|Win32 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|Win32.Build.0 = Release|Win32 - {6B9217D6-8259-4817-B8A5-2FEAD349EDEB}.Debug|Win32.ActiveCfg = Debug|Win32 - {6B9217D6-8259-4817-B8A5-2FEAD349EDEB}.Debug|Win32.Build.0 = Debug|Win32 - {6B9217D6-8259-4817-B8A5-2FEAD349EDEB}.Release|Win32.ActiveCfg = Release|Win32 - {6B9217D6-8259-4817-B8A5-2FEAD349EDEB}.Release|Win32.Build.0 = Release|Win32 {5C9C69D2-8B98-42DA-8D82-6E0B48446FAC}.Debug|Win32.ActiveCfg = Debug|Win32 {5C9C69D2-8B98-42DA-8D82-6E0B48446FAC}.Debug|Win32.Build.0 = Debug|Win32 {5C9C69D2-8B98-42DA-8D82-6E0B48446FAC}.Release|Win32.ActiveCfg = Release|Win32 @@ -1027,7 +1018,6 @@ Global {1C453396-D912-4213-89FD-9B489162B7B5} = {A7AB4405-FDB7-4853-9FBB-1516B1C3D80A} {CBEC7225-0C21-4DA8-978E-1F158F8AD950} = {F69A4A6B-9360-4EBB-A280-22AA3C455AC5} {AB91A099-7690-4ECF-8994-E458F4EA1ED4} = {F69A4A6B-9360-4EBB-A280-22AA3C455AC5} - {6B9217D6-8259-4817-B8A5-2FEAD349EDEB} = {C120A020-773F-4EA3-923F-B67AF28B750D} {5C9C69D2-8B98-42DA-8D82-6E0B48446FAC} = {C120A020-773F-4EA3-923F-B67AF28B750D} {F8C28DF9-D76A-449E-A621-D97D869974DA} = {C120A020-773F-4EA3-923F-B67AF28B750D} {985135DA-BBE1-42D2-8A85-1F7DF0609B3D} = {C120A020-773F-4EA3-923F-B67AF28B750D} diff --git a/libs/win32/sqlite/keywordhash.h b/libs/win32/sqlite/keywordhash.h new file mode 100644 index 0000000000..0a7187d1a5 --- /dev/null +++ b/libs/win32/sqlite/keywordhash.h @@ -0,0 +1,98 @@ +/* Hash score: 167 */ +static int keywordCode(const char *z, int n){ + static const char zText[544] = + "ABORTABLEFTEMPORARYADDATABASELECTHENDEFAULTRANSACTIONATURALTER" + "AISEACHECKEYAFTEREFERENCESCAPELSEXCEPTRIGGEREGEXPLAINITIALLYANALYZE" + "XCLUSIVEXISTSTATEMENTANDEFERRABLEATTACHAVINGLOBEFOREIGNOREINDEX" + "AUTOINCREMENTBEGINNERENAMEBETWEENOTNULLIKEBYCASCADEFERREDELETE" + "CASECASTCOLLATECOLUMNCOMMITCONFLICTCONSTRAINTERSECTCREATECROSS" + "CURRENT_DATECURRENT_TIMESTAMPLANDESCDETACHDISTINCTDROPRAGMATCH" + "FAILIMITFROMFULLGROUPDATEIFIMMEDIATEINSERTINSTEADINTOFFSETISNULL" + "JOINORDEREPLACEOUTERESTRICTPRIMARYQUERYRIGHTROLLBACKROWHENUNION" + "UNIQUEUSINGVACUUMVALUESVIEWHEREVIRTUAL"; + static const unsigned char aHash[127] = { + 92, 80, 107, 91, 0, 4, 0, 0, 114, 0, 83, 0, 0, + 96, 44, 76, 93, 0, 106, 109, 97, 90, 0, 10, 0, 0, + 113, 0, 117, 103, 0, 28, 48, 0, 41, 0, 0, 65, 71, + 0, 63, 19, 0, 105, 36, 104, 0, 108, 75, 0, 0, 33, + 0, 61, 37, 0, 8, 0, 115, 38, 12, 0, 77, 40, 25, + 66, 0, 0, 31, 81, 53, 30, 50, 20, 88, 0, 34, 0, + 74, 26, 0, 72, 0, 0, 0, 64, 47, 67, 22, 87, 29, + 69, 86, 0, 1, 0, 9, 101, 58, 18, 0, 112, 82, 99, + 55, 6, 85, 0, 0, 49, 94, 0, 102, 0, 70, 0, 0, + 15, 0, 116, 51, 56, 0, 2, 54, 0, 111, + }; + static const unsigned char aNext[117] = { + 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, + 0, 11, 0, 0, 0, 0, 5, 13, 0, 7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 42, 0, 0, 0, 0, 0, + 0, 16, 0, 0, 23, 52, 0, 0, 0, 0, 45, 0, 59, + 0, 0, 0, 0, 0, 0, 0, 0, 43, 73, 0, 24, 60, + 21, 0, 79, 0, 0, 68, 0, 0, 84, 46, 0, 0, 0, + 0, 0, 0, 0, 0, 39, 95, 98, 0, 0, 100, 0, 32, + 0, 14, 27, 78, 0, 57, 89, 0, 35, 0, 62, 0, 110, + }; + static const unsigned char aLen[117] = { + 5, 5, 4, 4, 9, 2, 3, 8, 2, 6, 4, 3, 7, + 11, 2, 7, 5, 5, 4, 5, 3, 5, 10, 6, 4, 6, + 7, 6, 7, 9, 3, 7, 9, 6, 9, 3, 10, 6, 6, + 4, 6, 7, 3, 6, 7, 5, 13, 2, 2, 5, 5, 6, + 7, 7, 3, 4, 4, 2, 7, 3, 8, 6, 4, 4, 7, + 6, 6, 8, 10, 9, 6, 5, 12, 17, 12, 4, 4, 6, + 8, 2, 4, 6, 5, 4, 5, 4, 4, 5, 6, 2, 9, + 6, 7, 4, 6, 2, 3, 6, 4, 5, 7, 5, 8, 7, + 5, 5, 8, 3, 4, 5, 6, 5, 6, 6, 4, 5, 7, + }; + static const unsigned short int aOffset[117] = { + 0, 4, 7, 10, 10, 14, 19, 21, 26, 27, 32, 34, 36, + 42, 51, 52, 57, 61, 65, 67, 71, 74, 78, 86, 91, 94, + 99, 105, 108, 113, 118, 122, 128, 136, 141, 150, 152, 162, 167, + 172, 175, 177, 177, 181, 185, 187, 192, 194, 196, 205, 208, 212, + 218, 224, 224, 227, 230, 234, 236, 237, 241, 248, 254, 258, 262, + 269, 275, 281, 289, 296, 305, 311, 316, 328, 328, 344, 348, 352, + 358, 359, 366, 369, 373, 378, 381, 386, 390, 394, 397, 403, 405, + 414, 420, 427, 430, 430, 433, 436, 442, 446, 450, 457, 461, 469, + 476, 481, 486, 494, 496, 500, 505, 511, 516, 522, 528, 531, 536, + }; + static const unsigned char aCode[117] = { + TK_ABORT, TK_TABLE, TK_JOIN_KW, TK_TEMP, TK_TEMP, + TK_OR, TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, + TK_THEN, TK_END, TK_DEFAULT, TK_TRANSACTION,TK_ON, + TK_JOIN_KW, TK_ALTER, TK_RAISE, TK_EACH, TK_CHECK, + TK_KEY, TK_AFTER, TK_REFERENCES, TK_ESCAPE, TK_ELSE, + TK_EXCEPT, TK_TRIGGER, TK_LIKE_KW, TK_EXPLAIN, TK_INITIALLY, + TK_ALL, TK_ANALYZE, TK_EXCLUSIVE, TK_EXISTS, TK_STATEMENT, + TK_AND, TK_DEFERRABLE, TK_ATTACH, TK_HAVING, TK_LIKE_KW, + TK_BEFORE, TK_FOREIGN, TK_FOR, TK_IGNORE, TK_REINDEX, + TK_INDEX, TK_AUTOINCR, TK_TO, TK_IN, TK_BEGIN, + TK_JOIN_KW, TK_RENAME, TK_BETWEEN, TK_NOTNULL, TK_NOT, + TK_NULL, TK_LIKE_KW, TK_BY, TK_CASCADE, TK_ASC, + TK_DEFERRED, TK_DELETE, TK_CASE, TK_CAST, TK_COLLATE, + TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_CONSTRAINT, TK_INTERSECT, + TK_CREATE, TK_JOIN_KW, TK_CTIME_KW, TK_CTIME_KW, TK_CTIME_KW, + TK_PLAN, TK_DESC, TK_DETACH, TK_DISTINCT, TK_IS, + TK_DROP, TK_PRAGMA, TK_MATCH, TK_FAIL, TK_LIMIT, + TK_FROM, TK_JOIN_KW, TK_GROUP, TK_UPDATE, TK_IF, + TK_IMMEDIATE, TK_INSERT, TK_INSTEAD, TK_INTO, TK_OFFSET, + TK_OF, TK_SET, TK_ISNULL, TK_JOIN, TK_ORDER, + TK_REPLACE, TK_JOIN_KW, TK_RESTRICT, TK_PRIMARY, TK_QUERY, + TK_JOIN_KW, TK_ROLLBACK, TK_ROW, TK_WHEN, TK_UNION, + TK_UNIQUE, TK_USING, TK_VACUUM, TK_VALUES, TK_VIEW, + TK_WHERE, TK_VIRTUAL, + }; + int h, i; + if( n<2 ) return TK_ID; + h = ((charMap(z[0])*4) ^ + (charMap(z[n-1])*3) ^ + n) % 127; + for(i=((int)aHash[h])-1; i>=0; i=((int)aNext[i])-1){ + if( aLen[i]==n && sqlite3StrNICmp(&zText[aOffset[i]],z,n)==0 ){ + return aCode[i]; + } + } + return TK_ID; +} +int sqlite3KeywordCode(const unsigned char *z, int n){ + return keywordCode((char*)z, n); +} diff --git a/libs/win32/sqlite/opcodes.c b/libs/win32/sqlite/opcodes.c new file mode 100644 index 0000000000..b3dbb3b801 --- /dev/null +++ b/libs/win32/sqlite/opcodes.c @@ -0,0 +1,149 @@ +/* Automatically generated. Do not edit */ +/* See the mkopcodec.awk script for details. */ +#if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG) +const char *const sqlite3OpcodeNames[] = { "?", + /* 1 */ "VRowid", + /* 2 */ "VFilter", + /* 3 */ "ContextPop", + /* 4 */ "IntegrityCk", + /* 5 */ "DropTrigger", + /* 6 */ "DropIndex", + /* 7 */ "IdxInsert", + /* 8 */ "Delete", + /* 9 */ "MoveGt", + /* 10 */ "OpenEphemeral", + /* 11 */ "VerifyCookie", + /* 12 */ "Push", + /* 13 */ "Dup", + /* 14 */ "Blob", + /* 15 */ "FifoWrite", + /* 16 */ "Not", + /* 17 */ "IdxGT", + /* 18 */ "RowKey", + /* 19 */ "IsUnique", + /* 20 */ "SetNumColumns", + /* 21 */ "VUpdate", + /* 22 */ "Expire", + /* 23 */ "IdxIsNull", + /* 24 */ "NullRow", + /* 25 */ "OpenPseudo", + /* 26 */ "OpenWrite", + /* 27 */ "OpenRead", + /* 28 */ "Transaction", + /* 29 */ "AutoCommit", + /* 30 */ "Pop", + /* 31 */ "Halt", + /* 32 */ "Vacuum", + /* 33 */ "IfMemNeg", + /* 34 */ "RowData", + /* 35 */ "NotExists", + /* 36 */ "MoveLe", + /* 37 */ "SetCookie", + /* 38 */ "Variable", + /* 39 */ "VNext", + /* 40 */ "VDestroy", + /* 41 */ "TableLock", + /* 42 */ "MemMove", + /* 43 */ "LoadAnalysis", + /* 44 */ "IdxDelete", + /* 45 */ "Sort", + /* 46 */ "ResetCount", + /* 47 */ "Integer", + /* 48 */ "AggStep", + /* 49 */ "CreateIndex", + /* 50 */ "NewRowid", + /* 51 */ "MoveLt", + /* 52 */ "Explain", + /* 53 */ "Return", + /* 54 */ "MemLoad", + /* 55 */ "IdxLT", + /* 56 */ "Rewind", + /* 57 */ "MakeIdxRec", + /* 58 */ "AddImm", + /* 59 */ "Null", + /* 60 */ "VColumn", + /* 61 */ "Or", + /* 62 */ "And", + /* 63 */ "MemNull", + /* 64 */ "MemIncr", + /* 65 */ "Clear", + /* 66 */ "IsNull", + /* 67 */ "NotNull", + /* 68 */ "Ne", + /* 69 */ "Eq", + /* 70 */ "Gt", + /* 71 */ "Le", + /* 72 */ "Lt", + /* 73 */ "Ge", + /* 74 */ "If", + /* 75 */ "BitAnd", + /* 76 */ "BitOr", + /* 77 */ "ShiftLeft", + /* 78 */ "ShiftRight", + /* 79 */ "Add", + /* 80 */ "Subtract", + /* 81 */ "Multiply", + /* 82 */ "Divide", + /* 83 */ "Remainder", + /* 84 */ "Concat", + /* 85 */ "Negative", + /* 86 */ "RealAffinity", + /* 87 */ "BitNot", + /* 88 */ "String8", + /* 89 */ "Callback", + /* 90 */ "AggFinal", + /* 91 */ "IfMemZero", + /* 92 */ "Last", + /* 93 */ "Rowid", + /* 94 */ "Sequence", + /* 95 */ "NotFound", + /* 96 */ "MakeRecord", + /* 97 */ "String", + /* 98 */ "Goto", + /* 99 */ "VCreate", + /* 100 */ "MemInt", + /* 101 */ "IfMemPos", + /* 102 */ "DropTable", + /* 103 */ "IdxRowid", + /* 104 */ "Insert", + /* 105 */ "Column", + /* 106 */ "Noop", + /* 107 */ "VOpen", + /* 108 */ "CreateTable", + /* 109 */ "Found", + /* 110 */ "Distinct", + /* 111 */ "Close", + /* 112 */ "Statement", + /* 113 */ "IfNot", + /* 114 */ "Pull", + /* 115 */ "VBegin", + /* 116 */ "MemMax", + /* 117 */ "MemStore", + /* 118 */ "Next", + /* 119 */ "Prev", + /* 120 */ "MoveGe", + /* 121 */ "MustBeInt", + /* 122 */ "ForceInt", + /* 123 */ "CollSeq", + /* 124 */ "Gosub", + /* 125 */ "ContextPush", + /* 126 */ "Real", + /* 127 */ "HexBlob", + /* 128 */ "FifoRead", + /* 129 */ "ParseSchema", + /* 130 */ "Destroy", + /* 131 */ "IdxGE", + /* 132 */ "ReadCookie", + /* 133 */ "AbsValue", + /* 134 */ "Function", + /* 135 */ "Int64", + /* 136 */ "NotUsed_136", + /* 137 */ "NotUsed_137", + /* 138 */ "NotUsed_138", + /* 139 */ "ToText", + /* 140 */ "ToBlob", + /* 141 */ "ToNumeric", + /* 142 */ "ToInt", + /* 143 */ "ToReal", +}; +#endif diff --git a/libs/win32/sqlite/opcodes.h b/libs/win32/sqlite/opcodes.h new file mode 100644 index 0000000000..b7f5cc410e --- /dev/null +++ b/libs/win32/sqlite/opcodes.h @@ -0,0 +1,161 @@ +/* Automatically generated. Do not edit */ +/* See the mkopcodeh.awk script for details */ +#define OP_VRowid 1 +#define OP_VFilter 2 +#define OP_ContextPop 3 +#define OP_IntegrityCk 4 +#define OP_DropTrigger 5 +#define OP_DropIndex 6 +#define OP_IdxInsert 7 +#define OP_Delete 8 +#define OP_MoveGt 9 +#define OP_OpenEphemeral 10 +#define OP_VerifyCookie 11 +#define OP_Push 12 +#define OP_Dup 13 +#define OP_Blob 14 +#define OP_FifoWrite 15 +#define OP_IdxGT 17 +#define OP_RowKey 18 +#define OP_IsUnique 19 +#define OP_SetNumColumns 20 +#define OP_Eq 69 /* same as TK_EQ */ +#define OP_VUpdate 21 +#define OP_Expire 22 +#define OP_IdxIsNull 23 +#define OP_NullRow 24 +#define OP_OpenPseudo 25 +#define OP_OpenWrite 26 +#define OP_OpenRead 27 +#define OP_Transaction 28 +#define OP_AutoCommit 29 +#define OP_Negative 85 /* same as TK_UMINUS */ +#define OP_Pop 30 +#define OP_Halt 31 +#define OP_Vacuum 32 +#define OP_IfMemNeg 33 +#define OP_RowData 34 +#define OP_NotExists 35 +#define OP_MoveLe 36 +#define OP_SetCookie 37 +#define OP_Variable 38 +#define OP_VNext 39 +#define OP_VDestroy 40 +#define OP_TableLock 41 +#define OP_MemMove 42 +#define OP_LoadAnalysis 43 +#define OP_IdxDelete 44 +#define OP_Sort 45 +#define OP_ResetCount 46 +#define OP_NotNull 67 /* same as TK_NOTNULL */ +#define OP_Ge 73 /* same as TK_GE */ +#define OP_Remainder 83 /* same as TK_REM */ +#define OP_Divide 82 /* same as TK_SLASH */ +#define OP_Integer 47 +#define OP_AggStep 48 +#define OP_CreateIndex 49 +#define OP_NewRowid 50 +#define OP_MoveLt 51 +#define OP_Explain 52 +#define OP_And 62 /* same as TK_AND */ +#define OP_ShiftLeft 77 /* same as TK_LSHIFT */ +#define OP_Real 126 /* same as TK_FLOAT */ +#define OP_Return 53 +#define OP_MemLoad 54 +#define OP_IdxLT 55 +#define OP_Rewind 56 +#define OP_MakeIdxRec 57 +#define OP_Gt 70 /* same as TK_GT */ +#define OP_AddImm 58 +#define OP_Subtract 80 /* same as TK_MINUS */ +#define OP_Null 59 +#define OP_VColumn 60 +#define OP_MemNull 63 +#define OP_MemIncr 64 +#define OP_Clear 65 +#define OP_IsNull 66 /* same as TK_ISNULL */ +#define OP_If 74 +#define OP_ToBlob 140 /* same as TK_TO_BLOB */ +#define OP_RealAffinity 86 +#define OP_Callback 89 +#define OP_AggFinal 90 +#define OP_IfMemZero 91 +#define OP_Last 92 +#define OP_Rowid 93 +#define OP_Sequence 94 +#define OP_NotFound 95 +#define OP_MakeRecord 96 +#define OP_ToText 139 /* same as TK_TO_TEXT */ +#define OP_BitAnd 75 /* same as TK_BITAND */ +#define OP_Add 79 /* same as TK_PLUS */ +#define OP_HexBlob 127 /* same as TK_BLOB */ +#define OP_String 97 +#define OP_Goto 98 +#define OP_VCreate 99 +#define OP_MemInt 100 +#define OP_IfMemPos 101 +#define OP_DropTable 102 +#define OP_IdxRowid 103 +#define OP_Insert 104 +#define OP_Column 105 +#define OP_Noop 106 +#define OP_Not 16 /* same as TK_NOT */ +#define OP_Le 71 /* same as TK_LE */ +#define OP_BitOr 76 /* same as TK_BITOR */ +#define OP_Multiply 81 /* same as TK_STAR */ +#define OP_String8 88 /* same as TK_STRING */ +#define OP_VOpen 107 +#define OP_CreateTable 108 +#define OP_Found 109 +#define OP_Distinct 110 +#define OP_Close 111 +#define OP_Statement 112 +#define OP_IfNot 113 +#define OP_ToInt 142 /* same as TK_TO_INT */ +#define OP_Pull 114 +#define OP_VBegin 115 +#define OP_MemMax 116 +#define OP_MemStore 117 +#define OP_Next 118 +#define OP_Prev 119 +#define OP_MoveGe 120 +#define OP_Lt 72 /* same as TK_LT */ +#define OP_Ne 68 /* same as TK_NE */ +#define OP_MustBeInt 121 +#define OP_ForceInt 122 +#define OP_ShiftRight 78 /* same as TK_RSHIFT */ +#define OP_CollSeq 123 +#define OP_Gosub 124 +#define OP_ContextPush 125 +#define OP_FifoRead 128 +#define OP_ParseSchema 129 +#define OP_Destroy 130 +#define OP_IdxGE 131 +#define OP_ReadCookie 132 +#define OP_BitNot 87 /* same as TK_BITNOT */ +#define OP_AbsValue 133 +#define OP_Or 61 /* same as TK_OR */ +#define OP_ToReal 143 /* same as TK_TO_REAL */ +#define OP_ToNumeric 141 /* same as TK_TO_NUMERIC*/ +#define OP_Function 134 +#define OP_Concat 84 /* same as TK_CONCAT */ +#define OP_Int64 135 + +/* The following opcode values are never used */ +#define OP_NotUsed_136 136 +#define OP_NotUsed_137 137 +#define OP_NotUsed_138 138 + +/* Opcodes that are guaranteed to never push a value onto the stack +** contain a 1 their corresponding position of the following mask +** set. See the opcodeNoPush() function in vdbeaux.c */ +#define NOPUSH_MASK_0 0x9fec +#define NOPUSH_MASK_1 0xfffb +#define NOPUSH_MASK_2 0x7bbb +#define NOPUSH_MASK_3 0x65a9 +#define NOPUSH_MASK_4 0xffff +#define NOPUSH_MASK_5 0x9eef +#define NOPUSH_MASK_6 0xed6c +#define NOPUSH_MASK_7 0x3fff +#define NOPUSH_MASK_8 0xf80a +#define NOPUSH_MASK_9 0x0000 diff --git a/libs/win32/sqlite/parse.c b/libs/win32/sqlite/parse.c new file mode 100644 index 0000000000..34fd179e82 --- /dev/null +++ b/libs/win32/sqlite/parse.c @@ -0,0 +1,3426 @@ +/* Driver template for the LEMON parser generator. +** The author disclaims copyright to this source code. +*/ +/* First off, code is include which follows the "include" declaration +** in the input file. */ +#include +#line 56 "parse.y" + +#include "sqliteInt.h" +#include "parse.h" + +/* +** An instance of this structure holds information about the +** LIMIT clause of a SELECT statement. +*/ +struct LimitVal { + Expr *pLimit; /* The LIMIT expression. NULL if there is no limit */ + Expr *pOffset; /* The OFFSET expression. NULL if there is none */ +}; + +/* +** An instance of this structure is used to store the LIKE, +** GLOB, NOT LIKE, and NOT GLOB operators. +*/ +struct LikeOp { + Token eOperator; /* "like" or "glob" or "regexp" */ + int not; /* True if the NOT keyword is present */ +}; + +/* +** An instance of the following structure describes the event of a +** TRIGGER. "a" is the event type, one of TK_UPDATE, TK_INSERT, +** TK_DELETE, or TK_INSTEAD. If the event is of the form +** +** UPDATE ON (a,b,c) +** +** Then the "b" IdList records the list "a,b,c". +*/ +struct TrigEvent { int a; IdList * b; }; + +/* +** An instance of this structure holds the ATTACH key and the key type. +*/ +struct AttachKey { int type; Token key; }; + +#line 48 "parse.c" +/* Next is all token values, in a form suitable for use by makeheaders. +** This section will be null unless lemon is run with the -m switch. +*/ +/* +** These constants (all generated automatically by the parser generator) +** specify the various kinds of tokens (terminals) that the parser +** understands. +** +** Each symbol here is a terminal symbol in the grammar. +*/ +/* Make sure the INTERFACE macro is defined. +*/ +#ifndef INTERFACE +# define INTERFACE 1 +#endif +/* The next thing included is series of defines which control +** various aspects of the generated parser. +** YYCODETYPE is the data type used for storing terminal +** and nonterminal numbers. "unsigned char" is +** used if there are fewer than 250 terminals +** and nonterminals. "int" is used otherwise. +** YYNOCODE is a number of type YYCODETYPE which corresponds +** to no legal terminal or nonterminal number. This +** number is used to fill in empty slots of the hash +** table. +** YYFALLBACK If defined, this indicates that one or more tokens +** have fall-back values which should be used if the +** original value of the token will not parse. +** YYACTIONTYPE is the data type used for storing terminal +** and nonterminal numbers. "unsigned char" is +** used if there are fewer than 250 rules and +** states combined. "int" is used otherwise. +** sqlite3ParserTOKENTYPE is the data type used for minor tokens given +** directly to the parser from the tokenizer. +** YYMINORTYPE is the data type used for all minor tokens. +** This is typically a union of many types, one of +** which is sqlite3ParserTOKENTYPE. The entry in the union +** for base tokens is called "yy0". +** YYSTACKDEPTH is the maximum depth of the parser's stack. +** sqlite3ParserARG_SDECL A static variable declaration for the %extra_argument +** sqlite3ParserARG_PDECL A parameter declaration for the %extra_argument +** sqlite3ParserARG_STORE Code to store %extra_argument into yypParser +** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser +** YYNSTATE the combined number of states. +** YYNRULE the number of rules in the grammar +** YYERRORSYMBOL is the code number of the error symbol. If not +** defined, then do no error processing. +*/ +#define YYCODETYPE unsigned char +#define YYNOCODE 248 +#define YYACTIONTYPE unsigned short int +#define YYWILDCARD 60 +#define sqlite3ParserTOKENTYPE Token +typedef union { + sqlite3ParserTOKENTYPE yy0; + int yy46; + struct LikeOp yy72; + Expr* yy172; + ExprList* yy174; + Select* yy219; + struct LimitVal yy234; + TriggerStep* yy243; + struct TrigEvent yy370; + SrcList* yy373; + Expr * yy386; + struct {int value; int mask;} yy405; + Token yy410; + IdList* yy432; + int yy495; +} YYMINORTYPE; +#define YYSTACKDEPTH 100 +#define sqlite3ParserARG_SDECL Parse *pParse; +#define sqlite3ParserARG_PDECL ,Parse *pParse +#define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse +#define sqlite3ParserARG_STORE yypParser->pParse = pParse +#define YYNSTATE 586 +#define YYNRULE 310 +#define YYERRORSYMBOL 139 +#define YYERRSYMDT yy495 +#define YYFALLBACK 1 +#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) +#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) +#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) + +/* Next are that tables used to determine what action to take based on the +** current state and lookahead token. These tables are used to implement +** functions that take a state number and lookahead value and return an +** action integer. +** +** Suppose the action integer is N. Then the action is determined as +** follows +** +** 0 <= N < YYNSTATE Shift N. That is, push the lookahead +** token onto the stack and goto state N. +** +** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. +** +** N == YYNSTATE+YYNRULE A syntax error has occurred. +** +** N == YYNSTATE+YYNRULE+1 The parser accepts its input. +** +** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused +** slots in the yy_action[] table. +** +** The action table is constructed as a single large table named yy_action[]. +** Given state S and lookahead X, the action is computed as +** +** yy_action[ yy_shift_ofst[S] + X ] +** +** If the index value yy_shift_ofst[S]+X is out of range or if the value +** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] +** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table +** and that yy_default[S] should be used instead. +** +** The formula above is for computing the action when the lookahead is +** a terminal symbol. If the lookahead is a non-terminal (as occurs after +** a reduce action) then the yy_reduce_ofst[] array is used in place of +** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of +** YY_SHIFT_USE_DFLT. +** +** The following are the tables generated in this section: +** +** yy_action[] A single table containing all actions. +** yy_lookahead[] A table containing the lookahead for each entry in +** yy_action. Used to detect hash collisions. +** yy_shift_ofst[] For each state, the offset into yy_action for +** shifting terminals. +** 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. +*/ +static const YYACTIONTYPE yy_action[] = { + /* 0 */ 290, 897, 128, 585, 237, 172, 2, 478, 89, 89, + /* 10 */ 89, 89, 302, 75, 75, 75, 75, 71, 71, 85, + /* 20 */ 85, 85, 60, 417, 418, 302, 456, 443, 67, 75, + /* 30 */ 75, 75, 75, 71, 71, 85, 85, 85, 60, 286, + /* 40 */ 324, 458, 463, 464, 171, 80, 83, 313, 435, 433, + /* 50 */ 442, 442, 91, 91, 89, 89, 89, 89, 422, 75, + /* 60 */ 75, 75, 75, 71, 71, 85, 85, 85, 60, 290, + /* 70 */ 479, 477, 478, 57, 491, 78, 75, 75, 75, 75, + /* 80 */ 71, 71, 85, 85, 85, 60, 181, 114, 243, 327, + /* 90 */ 244, 330, 182, 248, 424, 456, 443, 279, 423, 90, + /* 100 */ 253, 243, 327, 244, 330, 182, 248, 485, 485, 485, + /* 110 */ 363, 283, 290, 253, 80, 83, 313, 435, 433, 442, + /* 120 */ 442, 91, 91, 89, 89, 89, 89, 336, 75, 75, + /* 130 */ 75, 75, 71, 71, 85, 85, 85, 60, 456, 443, + /* 140 */ 71, 71, 85, 85, 85, 60, 172, 448, 478, 499, + /* 150 */ 49, 580, 887, 427, 887, 290, 573, 80, 83, 313, + /* 160 */ 435, 433, 442, 442, 91, 91, 89, 89, 89, 89, + /* 170 */ 177, 75, 75, 75, 75, 71, 71, 85, 85, 85, + /* 180 */ 60, 456, 443, 159, 565, 447, 352, 359, 364, 386, + /* 190 */ 235, 339, 575, 1, 72, 79, 64, 565, 369, 388, + /* 200 */ 80, 83, 313, 435, 433, 442, 442, 91, 91, 89, + /* 210 */ 89, 89, 89, 478, 75, 75, 75, 75, 71, 71, + /* 220 */ 85, 85, 85, 60, 462, 527, 568, 290, 92, 438, + /* 230 */ 242, 486, 565, 545, 22, 458, 341, 275, 276, 565, + /* 240 */ 466, 217, 462, 577, 315, 148, 582, 210, 258, 564, + /* 250 */ 561, 392, 22, 456, 443, 147, 145, 146, 393, 431, + /* 260 */ 533, 195, 564, 561, 479, 463, 346, 171, 491, 822, + /* 270 */ 55, 59, 80, 83, 313, 435, 433, 442, 442, 91, + /* 280 */ 91, 89, 89, 89, 89, 557, 75, 75, 75, 75, + /* 290 */ 71, 71, 85, 85, 85, 60, 290, 564, 561, 308, + /* 300 */ 490, 485, 485, 485, 564, 561, 159, 223, 565, 352, + /* 310 */ 359, 364, 336, 159, 336, 548, 352, 359, 364, 221, + /* 320 */ 151, 369, 456, 443, 413, 316, 576, 422, 369, 580, + /* 330 */ 888, 206, 888, 197, 499, 47, 499, 23, 191, 583, + /* 340 */ 232, 80, 83, 313, 435, 433, 442, 442, 91, 91, + /* 350 */ 89, 89, 89, 89, 498, 75, 75, 75, 75, 71, + /* 360 */ 71, 85, 85, 85, 60, 290, 457, 498, 529, 255, + /* 370 */ 575, 207, 498, 564, 561, 512, 529, 312, 54, 229, + /* 380 */ 528, 224, 510, 65, 336, 76, 153, 581, 528, 400, + /* 390 */ 2, 456, 443, 526, 571, 531, 287, 328, 274, 6, + /* 400 */ 410, 526, 437, 375, 133, 530, 499, 49, 290, 236, + /* 410 */ 80, 83, 313, 435, 433, 442, 442, 91, 91, 89, + /* 420 */ 89, 89, 89, 317, 75, 75, 75, 75, 71, 71, + /* 430 */ 85, 85, 85, 60, 456, 443, 58, 234, 133, 269, + /* 440 */ 85, 85, 85, 60, 164, 238, 65, 228, 76, 153, + /* 450 */ 320, 178, 149, 80, 83, 313, 435, 433, 442, 442, + /* 460 */ 91, 91, 89, 89, 89, 89, 544, 75, 75, 75, + /* 470 */ 75, 71, 71, 85, 85, 85, 60, 290, 498, 414, + /* 480 */ 543, 502, 56, 336, 9, 336, 210, 336, 565, 515, + /* 490 */ 162, 149, 565, 336, 378, 354, 265, 455, 454, 344, + /* 500 */ 318, 155, 219, 456, 443, 499, 47, 499, 24, 499, + /* 510 */ 47, 343, 473, 471, 513, 499, 26, 115, 239, 451, + /* 520 */ 444, 184, 80, 83, 313, 435, 433, 442, 442, 91, + /* 530 */ 91, 89, 89, 89, 89, 498, 75, 75, 75, 75, + /* 540 */ 71, 71, 85, 85, 85, 60, 290, 452, 296, 421, + /* 550 */ 483, 109, 384, 564, 561, 565, 336, 564, 561, 351, + /* 560 */ 400, 336, 489, 336, 400, 336, 360, 336, 429, 429, + /* 570 */ 158, 20, 456, 443, 211, 478, 184, 292, 499, 47, + /* 580 */ 293, 236, 253, 499, 48, 499, 41, 499, 48, 499, + /* 590 */ 100, 80, 83, 313, 435, 433, 442, 442, 91, 91, + /* 600 */ 89, 89, 89, 89, 498, 75, 75, 75, 75, 71, + /* 610 */ 71, 85, 85, 85, 60, 290, 558, 555, 554, 520, + /* 620 */ 564, 561, 500, 300, 473, 471, 586, 577, 315, 345, + /* 630 */ 295, 336, 292, 401, 304, 441, 360, 230, 429, 429, + /* 640 */ 478, 456, 443, 65, 396, 76, 153, 462, 434, 360, + /* 650 */ 314, 429, 429, 499, 30, 362, 566, 22, 290, 355, + /* 660 */ 80, 83, 313, 435, 433, 442, 442, 91, 91, 89, + /* 670 */ 89, 89, 89, 336, 75, 75, 75, 75, 71, 71, + /* 680 */ 85, 85, 85, 60, 456, 443, 211, 476, 65, 21, + /* 690 */ 76, 153, 405, 398, 524, 499, 27, 537, 537, 537, + /* 700 */ 404, 290, 399, 80, 83, 313, 435, 433, 442, 442, + /* 710 */ 91, 91, 89, 89, 89, 89, 336, 75, 75, 75, + /* 720 */ 75, 71, 71, 85, 85, 85, 60, 456, 443, 419, + /* 730 */ 366, 419, 204, 299, 310, 298, 119, 537, 499, 97, + /* 740 */ 537, 185, 192, 186, 290, 406, 80, 82, 313, 435, + /* 750 */ 433, 442, 442, 91, 91, 89, 89, 89, 89, 336, + /* 760 */ 75, 75, 75, 75, 71, 71, 85, 85, 85, 60, + /* 770 */ 456, 443, 305, 468, 468, 301, 225, 225, 225, 519, + /* 780 */ 518, 499, 39, 360, 142, 429, 429, 290, 157, 376, + /* 790 */ 83, 313, 435, 433, 442, 442, 91, 91, 89, 89, + /* 800 */ 89, 89, 336, 75, 75, 75, 75, 71, 71, 85, + /* 810 */ 85, 85, 60, 456, 443, 373, 225, 133, 469, 225, + /* 820 */ 195, 240, 498, 408, 499, 44, 348, 523, 264, 57, + /* 830 */ 133, 183, 193, 201, 313, 435, 433, 442, 442, 91, + /* 840 */ 91, 89, 89, 89, 89, 336, 75, 75, 75, 75, + /* 850 */ 71, 71, 85, 85, 85, 60, 88, 367, 532, 4, + /* 860 */ 336, 325, 336, 306, 180, 498, 504, 499, 25, 336, + /* 870 */ 506, 340, 88, 367, 336, 4, 534, 535, 331, 306, + /* 880 */ 439, 210, 499, 98, 499, 16, 271, 340, 374, 347, + /* 890 */ 152, 499, 35, 249, 326, 336, 499, 32, 498, 458, + /* 900 */ 336, 19, 336, 139, 374, 504, 563, 559, 336, 506, + /* 910 */ 187, 336, 537, 574, 289, 458, 408, 499, 50, 84, + /* 920 */ 86, 347, 499, 42, 499, 31, 620, 88, 333, 334, + /* 930 */ 499, 29, 491, 499, 51, 84, 86, 461, 211, 569, + /* 940 */ 336, 365, 349, 88, 333, 334, 88, 367, 491, 4, + /* 950 */ 336, 210, 336, 306, 336, 218, 542, 336, 236, 236, + /* 960 */ 18, 340, 499, 43, 515, 485, 485, 485, 484, 481, + /* 970 */ 14, 236, 499, 36, 499, 28, 499, 94, 374, 499, + /* 980 */ 53, 485, 485, 485, 484, 481, 14, 205, 356, 458, + /* 990 */ 179, 233, 336, 472, 236, 273, 268, 261, 99, 503, + /* 1000 */ 245, 336, 493, 336, 200, 336, 236, 336, 236, 84, + /* 1010 */ 86, 166, 497, 241, 499, 111, 439, 88, 333, 334, + /* 1020 */ 254, 336, 491, 499, 113, 499, 110, 499, 112, 499, + /* 1030 */ 34, 336, 188, 379, 447, 267, 439, 236, 498, 190, + /* 1040 */ 336, 422, 170, 499, 45, 336, 478, 227, 336, 329, + /* 1050 */ 560, 336, 133, 499, 52, 485, 485, 485, 484, 481, + /* 1060 */ 14, 259, 499, 33, 445, 536, 336, 499, 96, 578, + /* 1070 */ 499, 46, 336, 499, 38, 420, 336, 303, 492, 336, + /* 1080 */ 262, 342, 539, 536, 465, 332, 220, 276, 499, 93, + /* 1090 */ 402, 291, 12, 514, 499, 40, 210, 294, 499, 10, + /* 1100 */ 272, 499, 37, 499, 3, 466, 217, 549, 501, 579, + /* 1110 */ 12, 478, 278, 247, 357, 246, 281, 517, 277, 337, + /* 1120 */ 321, 144, 470, 390, 487, 524, 389, 562, 372, 488, + /* 1130 */ 440, 540, 460, 196, 467, 117, 380, 307, 323, 126, + /* 1140 */ 521, 397, 383, 194, 522, 231, 209, 74, 368, 412, + /* 1150 */ 226, 214, 199, 61, 388, 215, 387, 189, 216, 335, + /* 1160 */ 212, 134, 409, 309, 106, 285, 135, 125, 547, 210, + /* 1170 */ 496, 138, 68, 541, 509, 121, 260, 55, 507, 250, + /* 1180 */ 385, 288, 251, 87, 252, 381, 62, 266, 505, 173, + /* 1190 */ 415, 120, 8, 513, 358, 322, 175, 550, 516, 73, + /* 1200 */ 361, 263, 69, 428, 425, 432, 570, 508, 482, 551, + /* 1210 */ 495, 567, 280, 131, 552, 123, 174, 203, 553, 446, + /* 1220 */ 449, 5, 556, 12, 338, 391, 382, 213, 394, 17, + /* 1230 */ 7, 377, 102, 101, 141, 95, 118, 403, 221, 127, + /* 1240 */ 311, 202, 222, 407, 150, 156, 176, 371, 411, 257, + /* 1250 */ 108, 416, 480, 370, 297, 475, 195, 140, 453, 395, + /* 1260 */ 137, 66, 256, 122, 430, 426, 107, 168, 105, 284, + /* 1270 */ 270, 129, 104, 353, 436, 60, 584, 450, 136, 572, + /* 1280 */ 350, 81, 143, 77, 282, 459, 198, 161, 13, 103, + /* 1290 */ 319, 474, 154, 546, 169, 525, 167, 160, 116, 63, + /* 1300 */ 163, 538, 15, 208, 494, 165, 132, 124, 622, 70, + /* 1310 */ 621, 511, 130, 559, 11, +}; +static const YYCODETYPE yy_lookahead[] = { + /* 0 */ 16, 140, 141, 142, 148, 21, 145, 23, 70, 71, + /* 10 */ 72, 73, 16, 75, 76, 77, 78, 79, 80, 81, + /* 20 */ 82, 83, 84, 51, 52, 16, 42, 43, 74, 75, + /* 30 */ 76, 77, 78, 79, 80, 81, 82, 83, 84, 159, + /* 40 */ 148, 59, 162, 163, 164, 61, 62, 63, 64, 65, + /* 50 */ 66, 67, 68, 69, 70, 71, 72, 73, 162, 75, + /* 60 */ 76, 77, 78, 79, 80, 81, 82, 83, 84, 16, + /* 70 */ 88, 20, 88, 22, 92, 22, 75, 76, 77, 78, + /* 80 */ 79, 80, 81, 82, 83, 84, 90, 91, 92, 93, + /* 90 */ 94, 95, 96, 97, 25, 42, 43, 201, 29, 46, + /* 100 */ 104, 92, 93, 94, 95, 96, 97, 125, 126, 127, + /* 110 */ 41, 148, 16, 104, 61, 62, 63, 64, 65, 66, + /* 120 */ 67, 68, 69, 70, 71, 72, 73, 148, 75, 76, + /* 130 */ 77, 78, 79, 80, 81, 82, 83, 84, 42, 43, + /* 140 */ 79, 80, 81, 82, 83, 84, 21, 11, 23, 170, + /* 150 */ 171, 19, 20, 18, 22, 16, 179, 61, 62, 63, + /* 160 */ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + /* 170 */ 22, 75, 76, 77, 78, 79, 80, 81, 82, 83, + /* 180 */ 84, 42, 43, 90, 23, 49, 93, 94, 95, 210, + /* 190 */ 211, 56, 60, 19, 131, 19, 133, 23, 105, 23, + /* 200 */ 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + /* 210 */ 71, 72, 73, 88, 75, 76, 77, 78, 79, 80, + /* 220 */ 81, 82, 83, 84, 148, 148, 30, 16, 132, 94, + /* 230 */ 191, 20, 23, 157, 158, 59, 100, 101, 102, 23, + /* 240 */ 79, 80, 148, 1, 2, 22, 50, 111, 154, 88, + /* 250 */ 89, 157, 158, 42, 43, 79, 80, 181, 182, 20, + /* 260 */ 99, 22, 88, 89, 88, 162, 163, 164, 92, 134, + /* 270 */ 122, 132, 61, 62, 63, 64, 65, 66, 67, 68, + /* 280 */ 69, 70, 71, 72, 73, 179, 75, 76, 77, 78, + /* 290 */ 79, 80, 81, 82, 83, 84, 16, 88, 89, 103, + /* 300 */ 20, 125, 126, 127, 88, 89, 90, 92, 23, 93, + /* 310 */ 94, 95, 148, 90, 148, 148, 93, 94, 95, 104, + /* 320 */ 156, 105, 42, 43, 115, 143, 144, 162, 105, 19, + /* 330 */ 20, 149, 22, 156, 170, 171, 170, 171, 156, 179, + /* 340 */ 14, 61, 62, 63, 64, 65, 66, 67, 68, 69, + /* 350 */ 70, 71, 72, 73, 190, 75, 76, 77, 78, 79, + /* 360 */ 80, 81, 82, 83, 84, 16, 201, 190, 12, 20, + /* 370 */ 60, 193, 190, 88, 89, 27, 12, 213, 200, 53, + /* 380 */ 24, 55, 34, 218, 148, 220, 221, 142, 24, 225, + /* 390 */ 145, 42, 43, 37, 20, 39, 22, 215, 14, 192, + /* 400 */ 115, 37, 20, 39, 22, 49, 170, 171, 16, 148, + /* 410 */ 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + /* 420 */ 71, 72, 73, 241, 75, 76, 77, 78, 79, 80, + /* 430 */ 81, 82, 83, 84, 42, 43, 44, 53, 22, 55, + /* 440 */ 81, 82, 83, 84, 156, 148, 218, 211, 220, 221, + /* 450 */ 189, 202, 203, 61, 62, 63, 64, 65, 66, 67, + /* 460 */ 68, 69, 70, 71, 72, 73, 238, 75, 76, 77, + /* 470 */ 78, 79, 80, 81, 82, 83, 84, 16, 190, 20, + /* 480 */ 168, 169, 21, 148, 19, 148, 111, 148, 23, 177, + /* 490 */ 202, 203, 23, 148, 16, 207, 146, 42, 43, 124, + /* 500 */ 239, 156, 148, 42, 43, 170, 171, 170, 171, 170, + /* 510 */ 171, 165, 166, 167, 98, 170, 171, 148, 134, 64, + /* 520 */ 65, 43, 61, 62, 63, 64, 65, 66, 67, 68, + /* 530 */ 69, 70, 71, 72, 73, 190, 75, 76, 77, 78, + /* 540 */ 79, 80, 81, 82, 83, 84, 16, 92, 213, 20, + /* 550 */ 81, 21, 213, 88, 89, 23, 148, 88, 89, 16, + /* 560 */ 225, 148, 20, 148, 225, 148, 107, 148, 109, 110, + /* 570 */ 156, 19, 42, 43, 228, 23, 43, 99, 170, 171, + /* 580 */ 151, 148, 104, 170, 171, 170, 171, 170, 171, 170, + /* 590 */ 171, 61, 62, 63, 64, 65, 66, 67, 68, 69, + /* 600 */ 70, 71, 72, 73, 190, 75, 76, 77, 78, 79, + /* 610 */ 80, 81, 82, 83, 84, 16, 7, 8, 9, 20, + /* 620 */ 88, 89, 189, 165, 166, 167, 0, 1, 2, 215, + /* 630 */ 217, 148, 99, 225, 217, 92, 107, 222, 109, 110, + /* 640 */ 88, 42, 43, 218, 219, 220, 221, 148, 148, 107, + /* 650 */ 236, 109, 110, 170, 171, 226, 157, 158, 16, 230, + /* 660 */ 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + /* 670 */ 71, 72, 73, 148, 75, 76, 77, 78, 79, 80, + /* 680 */ 81, 82, 83, 84, 42, 43, 228, 20, 218, 22, + /* 690 */ 220, 221, 22, 177, 178, 170, 171, 148, 148, 148, + /* 700 */ 184, 16, 148, 61, 62, 63, 64, 65, 66, 67, + /* 710 */ 68, 69, 70, 71, 72, 73, 148, 75, 76, 77, + /* 720 */ 78, 79, 80, 81, 82, 83, 84, 42, 43, 100, + /* 730 */ 101, 102, 183, 183, 183, 242, 243, 148, 170, 171, + /* 740 */ 148, 100, 101, 102, 16, 204, 61, 62, 63, 64, + /* 750 */ 65, 66, 67, 68, 69, 70, 71, 72, 73, 148, + /* 760 */ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + /* 770 */ 42, 43, 183, 125, 126, 183, 227, 227, 227, 7, + /* 780 */ 8, 170, 171, 107, 114, 109, 110, 16, 156, 233, + /* 790 */ 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + /* 800 */ 72, 73, 148, 75, 76, 77, 78, 79, 80, 81, + /* 810 */ 82, 83, 84, 42, 43, 20, 227, 22, 20, 227, + /* 820 */ 22, 148, 190, 22, 170, 171, 148, 20, 20, 22, + /* 830 */ 22, 156, 19, 232, 63, 64, 65, 66, 67, 68, + /* 840 */ 69, 70, 71, 72, 73, 148, 75, 76, 77, 78, + /* 850 */ 79, 80, 81, 82, 83, 84, 16, 17, 148, 19, + /* 860 */ 148, 91, 148, 23, 156, 190, 108, 170, 171, 148, + /* 870 */ 112, 31, 16, 17, 148, 19, 166, 167, 81, 23, + /* 880 */ 148, 111, 170, 171, 170, 171, 148, 31, 48, 148, + /* 890 */ 89, 170, 171, 148, 124, 148, 170, 171, 190, 59, + /* 900 */ 148, 19, 148, 21, 48, 108, 91, 92, 148, 112, + /* 910 */ 19, 148, 148, 244, 245, 59, 115, 170, 171, 79, + /* 920 */ 80, 148, 170, 171, 170, 171, 113, 87, 88, 89, + /* 930 */ 170, 171, 92, 170, 171, 79, 80, 81, 228, 148, + /* 940 */ 148, 209, 148, 87, 88, 89, 16, 17, 92, 19, + /* 950 */ 148, 111, 148, 23, 148, 214, 169, 148, 148, 148, + /* 960 */ 69, 31, 170, 171, 177, 125, 126, 127, 128, 129, + /* 970 */ 130, 148, 170, 171, 170, 171, 170, 171, 48, 170, + /* 980 */ 171, 125, 126, 127, 128, 129, 130, 214, 174, 59, + /* 990 */ 5, 227, 148, 161, 148, 10, 11, 12, 13, 189, + /* 1000 */ 189, 148, 170, 148, 156, 148, 148, 148, 148, 79, + /* 1010 */ 80, 26, 189, 28, 170, 171, 148, 87, 88, 89, + /* 1020 */ 35, 148, 92, 170, 171, 170, 171, 170, 171, 170, + /* 1030 */ 171, 148, 47, 148, 49, 189, 148, 148, 190, 54, + /* 1040 */ 148, 162, 57, 170, 171, 148, 23, 189, 148, 189, + /* 1050 */ 20, 148, 22, 170, 171, 125, 126, 127, 128, 129, + /* 1060 */ 130, 148, 170, 171, 186, 187, 148, 170, 171, 20, + /* 1070 */ 170, 171, 148, 170, 171, 148, 148, 209, 189, 148, + /* 1080 */ 201, 148, 186, 187, 162, 100, 101, 102, 170, 171, + /* 1090 */ 20, 106, 22, 195, 170, 171, 111, 209, 170, 171, + /* 1100 */ 148, 170, 171, 170, 171, 79, 80, 150, 20, 60, + /* 1110 */ 22, 88, 148, 194, 148, 173, 148, 173, 148, 148, + /* 1120 */ 135, 192, 229, 173, 148, 178, 173, 148, 224, 148, + /* 1130 */ 148, 173, 195, 113, 229, 61, 153, 40, 99, 185, + /* 1140 */ 180, 153, 15, 152, 172, 97, 212, 131, 38, 235, + /* 1150 */ 234, 212, 152, 131, 23, 223, 161, 152, 212, 15, + /* 1160 */ 212, 188, 153, 153, 19, 175, 188, 19, 33, 111, + /* 1170 */ 190, 216, 237, 172, 172, 216, 172, 122, 161, 195, + /* 1180 */ 119, 175, 196, 120, 197, 117, 237, 198, 180, 152, + /* 1190 */ 172, 153, 22, 98, 153, 155, 6, 147, 174, 99, + /* 1200 */ 116, 205, 121, 206, 172, 172, 147, 195, 195, 147, + /* 1210 */ 199, 138, 205, 188, 147, 188, 185, 153, 153, 185, + /* 1220 */ 206, 118, 153, 22, 153, 153, 16, 176, 17, 231, + /* 1230 */ 118, 187, 240, 176, 21, 160, 243, 20, 104, 99, + /* 1240 */ 246, 22, 148, 20, 148, 19, 96, 148, 11, 148, + /* 1250 */ 19, 115, 170, 44, 36, 170, 22, 19, 182, 182, + /* 1260 */ 45, 19, 134, 19, 108, 45, 19, 99, 19, 5, + /* 1270 */ 20, 20, 19, 44, 92, 84, 4, 1, 103, 1, + /* 1280 */ 3, 69, 19, 69, 137, 20, 123, 136, 19, 14, + /* 1290 */ 58, 20, 113, 20, 114, 124, 14, 116, 32, 19, + /* 1300 */ 113, 20, 19, 44, 17, 113, 123, 103, 113, 19, + /* 1310 */ 113, 20, 114, 247, 22, +}; +#define YY_SHIFT_USE_DFLT (-63) +#define YY_SHIFT_MAX 386 +static const short yy_shift_ofst[] = { + /* 0 */ 242, 840, 985, -16, 840, 930, 930, 930, 216, 1058, + /* 10 */ 392, 930, 930, 930, 930, 930, -46, 136, 161, 532, + /* 20 */ 1026, 1026, 1023, 53, 599, 349, 280, 96, 139, 211, + /* 30 */ 461, 530, 642, 642, 642, 685, 642, 642, 642, 642, + /* 40 */ 642, 642, 642, 642, 642, 642, 642, 642, 642, 642, + /* 50 */ 642, 728, 771, 771, 856, 930, 930, 930, 930, 930, + /* 60 */ 930, 930, 930, 930, 930, 930, 930, 930, 930, 930, + /* 70 */ 930, 930, 930, 930, 930, 930, 930, 930, 930, 930, + /* 80 */ 930, 930, 930, 930, 930, 930, 930, 930, 930, 930, + /* 90 */ 930, 930, 930, -62, -62, -4, 1, 1, 61, 135, + /* 100 */ 359, 478, 532, 532, 532, 532, 532, 532, 532, 1023, + /* 110 */ 1191, -63, -63, -63, 176, 9, 356, 356, 310, 132, + /* 120 */ 125, 770, 532, 532, 532, 532, 532, 532, 626, 125, + /* 130 */ 532, 532, 532, 532, 532, 532, 532, 532, 375, 1058, + /* 140 */ 1058, 1058, -63, -63, -63, -18, 223, -18, 93, 465, + /* 150 */ 209, 529, 285, 174, 469, 542, 364, 459, 676, 532, + /* 160 */ 532, 532, 801, 532, 676, 532, 532, 532, 532, 532, + /* 170 */ 532, 552, 532, 532, 532, 532, 532, 532, 801, 609, + /* 180 */ 676, 532, 532, 676, 532, 196, 196, 532, 532, 532, + /* 190 */ 532, 676, 196, 797, 532, 532, 532, 676, 532, 532, + /* 200 */ 676, 629, 532, 69, 416, 148, 882, 670, 348, 348, + /* 210 */ 758, 648, 348, 533, 348, 63, 348, 648, 148, 1020, + /* 220 */ 1074, 1097, 1020, 1039, 1127, 1048, 1016, 1110, 1048, 1127, + /* 230 */ 1022, 1131, 1127, 1048, 1144, 1048, 1020, 1020, 1145, 1144, + /* 240 */ 1148, 1135, 1058, 1039, 1039, 1148, 1039, 1055, 1131, 1145, + /* 250 */ 1061, 1063, 1068, 1097, 1135, 1039, 1127, 1020, 1170, 1020, + /* 260 */ 1095, 1190, 1100, 1084, 1039, 1190, 1081, 1055, 1190, 1144, + /* 270 */ 1039, 1020, 1020, 1190, 1144, 1074, 1074, 1020, 1055, 1100, + /* 280 */ 1084, 1020, 1073, 1020, -63, -63, -63, -63, -63, -63, + /* 290 */ 455, 384, 641, 326, 239, 51, 1088, -28, 374, 382, + /* 300 */ 667, 795, 215, 798, 807, 808, 813, 772, 815, 891, + /* 310 */ 1030, 1049, 1070, 543, 1276, 1277, 1278, 1263, 1147, 1151, + /* 320 */ 1232, 1275, 1273, 1266, 1281, 1171, 1283, 1259, 1183, 1204, + /* 330 */ 1290, 1291, 1198, 1197, 1195, 1287, 1192, 1187, 1181, 1282, + /* 340 */ 1280, 1180, 1179, 1271, 1269, 1163, 1265, 1214, 1212, 1175, + /* 350 */ 1272, 1182, 1229, 1253, 1251, 1264, 1250, 1249, 1168, 1247, + /* 360 */ 1156, 1244, 1128, 1220, 1242, 1234, 1215, 1238, 1218, 1209, + /* 370 */ 1231, 1136, 1237, 1150, 1226, 1223, 1140, 1219, 1134, 1217, + /* 380 */ 1213, 1112, 1211, 1210, 1201, 1103, 1292, +}; +#define YY_REDUCE_USE_DFLT (-145) +#define YY_REDUCE_MAX 289 +static const short yy_reduce_ofst[] = { + /* 0 */ -139, 164, 182, 165, 345, 339, 335, -21, 76, 288, + /* 10 */ 228, 236, 408, 413, 415, 417, 425, 414, 710, 94, + /* 20 */ 458, 346, -120, 470, 470, 470, 470, 470, 470, 470, + /* 30 */ 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + /* 40 */ 470, 470, 470, 470, 470, 470, 470, 470, 470, 470, + /* 50 */ 470, 470, 470, 470, 933, 931, 928, 903, 892, 859, + /* 60 */ 853, 804, 792, 754, 747, 714, 697, 568, 483, 166, + /* 70 */ 337, 419, 525, 611, 654, 712, 721, 726, 752, 760, + /* 80 */ 763, 802, 806, 809, 844, 855, 857, 873, 883, 897, + /* 90 */ 900, 918, 924, 470, 470, 312, 470, 470, 470, 429, + /* 100 */ 470, 516, 499, 261, 549, 550, 551, 589, 592, 103, + /* 110 */ 470, 470, 470, 470, 832, 787, 896, 878, 669, 669, + /* 120 */ 879, 848, 888, 889, 773, 868, 860, 858, 245, -104, + /* 130 */ 846, 823, 811, 764, 810, 433, 741, 732, 708, 675, + /* 140 */ 632, 177, 249, 493, 178, 1085, 1077, 1082, 1076, 1101, + /* 150 */ 1099, 39, 1096, 1094, 971, 39, 1044, 39, 39, 982, + /* 160 */ 981, 979, 541, 976, 39, 971, 970, 968, 966, 964, + /* 170 */ 952, 922, 927, 913, 794, 791, 745, 678, 541, 350, + /* 180 */ 39, 369, 297, 39, 167, 106, -23, -108, -144, -37, + /* 190 */ 77, 39, 160, 207, 354, 500, 554, 39, 673, 738, + /* 200 */ 39, 556, 885, 601, 814, 898, 957, 919, 942, 944, + /* 210 */ 929, 893, 950, 947, 953, 904, 958, 905, 937, 983, + /* 220 */ 954, 960, 988, 972, 991, 934, 914, 916, 939, 1000, + /* 230 */ 932, 995, 1005, 946, 973, 948, 1009, 1010, 990, 978, + /* 240 */ 955, 935, 980, 1001, 1002, 959, 1004, 984, 1017, 1006, + /* 250 */ 986, 987, 989, 1008, 949, 1018, 1037, 1038, 1040, 1041, + /* 260 */ 1024, 1050, 996, 997, 1032, 1059, 1011, 1012, 1062, 1025, + /* 270 */ 1033, 1064, 1065, 1067, 1027, 1031, 1034, 1069, 1013, 1007, + /* 280 */ 1014, 1071, 992, 1072, 998, 1051, 1075, 993, 1057, 994, +}; +static const YYACTIONTYPE yy_default[] = { + /* 0 */ 592, 819, 896, 707, 896, 819, 819, 896, 896, 711, + /* 10 */ 870, 896, 819, 896, 815, 896, 790, 896, 841, 896, + /* 20 */ 841, 841, 623, 742, 896, 896, 896, 896, 896, 896, + /* 30 */ 896, 896, 750, 871, 811, 896, 749, 747, 756, 723, + /* 40 */ 810, 814, 744, 874, 855, 740, 743, 818, 757, 731, + /* 50 */ 812, 778, 796, 777, 896, 896, 896, 896, 896, 896, + /* 60 */ 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, + /* 70 */ 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, + /* 80 */ 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, + /* 90 */ 896, 896, 896, 780, 801, 616, 779, 789, 781, 611, + /* 100 */ 782, 676, 896, 896, 896, 896, 896, 896, 896, 896, + /* 110 */ 783, 798, 797, 784, 896, 896, 896, 896, 896, 896, + /* 120 */ 707, 896, 896, 896, 896, 896, 896, 896, 592, 707, + /* 130 */ 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, + /* 140 */ 896, 896, 711, 889, 701, 896, 667, 896, 896, 896, + /* 150 */ 896, 896, 896, 896, 896, 896, 896, 896, 862, 896, + /* 160 */ 896, 896, 715, 896, 714, 896, 877, 896, 896, 896, + /* 170 */ 875, 625, 896, 896, 896, 597, 896, 896, 709, 599, + /* 180 */ 860, 896, 896, 613, 896, 896, 896, 896, 896, 896, + /* 190 */ 829, 690, 896, 699, 896, 896, 896, 688, 896, 896, + /* 200 */ 752, 896, 896, 847, 649, 746, 896, 708, 734, 734, + /* 210 */ 699, 896, 734, 646, 734, 813, 734, 896, 746, 716, + /* 220 */ 680, 663, 716, 678, 608, 735, 854, 851, 735, 608, + /* 230 */ 896, 896, 608, 735, 687, 735, 716, 716, 823, 687, + /* 240 */ 758, 873, 896, 678, 678, 758, 678, 746, 896, 823, + /* 250 */ 737, 739, 727, 663, 873, 678, 608, 716, 666, 716, + /* 260 */ 649, 596, 724, 726, 678, 596, 741, 746, 596, 687, + /* 270 */ 678, 716, 716, 596, 687, 680, 680, 716, 746, 724, + /* 280 */ 726, 716, 882, 716, 857, 651, 633, 889, 651, 894, + /* 290 */ 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, + /* 300 */ 896, 896, 896, 896, 896, 896, 765, 896, 896, 836, + /* 310 */ 896, 896, 896, 896, 896, 593, 896, 884, 896, 896, + /* 320 */ 881, 896, 896, 896, 896, 896, 896, 896, 896, 896, + /* 330 */ 896, 896, 896, 770, 766, 896, 896, 767, 896, 896, + /* 340 */ 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, + /* 350 */ 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, + /* 360 */ 693, 896, 896, 896, 896, 850, 849, 896, 896, 896, + /* 370 */ 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, + /* 380 */ 896, 896, 896, 896, 738, 896, 728, 736, 618, 729, + /* 390 */ 730, 607, 615, 670, 609, 669, 791, 807, 677, 717, + /* 400 */ 817, 816, 804, 864, 675, 700, 710, 863, 719, 718, + /* 410 */ 720, 809, 843, 721, 808, 674, 722, 852, 853, 848, + /* 420 */ 705, 806, 706, 844, 845, 673, 846, 610, 712, 695, + /* 430 */ 694, 725, 672, 802, 760, 799, 795, 820, 821, 761, + /* 440 */ 671, 793, 792, 787, 803, 681, 754, 755, 842, 713, + /* 450 */ 856, 800, 794, 668, 788, 786, 785, 702, 776, 773, + /* 460 */ 858, 703, 617, 628, 624, 629, 840, 838, 839, 759, + /* 470 */ 837, 631, 640, 630, 627, 639, 626, 859, 619, 770, + /* 480 */ 638, 772, 861, 704, 771, 769, 637, 768, 886, 805, + /* 490 */ 763, 764, 685, 636, 686, 696, 692, 689, 691, 762, + /* 500 */ 828, 774, 635, 868, 698, 662, 697, 648, 745, 644, + /* 510 */ 733, 775, 732, 650, 748, 647, 643, 826, 665, 664, + /* 520 */ 645, 661, 642, 751, 652, 753, 867, 830, 866, 865, + /* 530 */ 684, 683, 831, 832, 833, 834, 682, 827, 835, 679, + /* 540 */ 825, 641, 634, 632, 869, 614, 612, 872, 653, 606, + /* 550 */ 605, 604, 603, 876, 602, 601, 878, 654, 600, 657, + /* 560 */ 824, 622, 879, 658, 621, 620, 880, 883, 659, 598, + /* 570 */ 595, 885, 591, 656, 890, 891, 589, 590, 892, 895, + /* 580 */ 893, 587, 660, 655, 594, 588, +}; +#define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0])) + +/* The next table maps tokens into fallback tokens. If a construct +** like the following: +** +** %fallback ID X Y Z. +** +** appears in the grammer, then ID becomes a fallback token for X, Y, +** and Z. Whenever one of the tokens X, Y, or Z is input to the parser +** but it does not parse, the type of the token is changed to ID and +** the parse is retried before an error is thrown. +*/ +#ifdef YYFALLBACK +static const YYCODETYPE yyFallback[] = { + 0, /* $ => nothing */ + 0, /* SEMI => nothing */ + 23, /* EXPLAIN => ID */ + 23, /* QUERY => ID */ + 23, /* PLAN => ID */ + 23, /* BEGIN => ID */ + 0, /* TRANSACTION => nothing */ + 23, /* DEFERRED => ID */ + 23, /* IMMEDIATE => ID */ + 23, /* EXCLUSIVE => ID */ + 0, /* COMMIT => nothing */ + 23, /* END => ID */ + 0, /* ROLLBACK => nothing */ + 0, /* CREATE => nothing */ + 0, /* TABLE => nothing */ + 23, /* IF => ID */ + 0, /* NOT => nothing */ + 0, /* EXISTS => nothing */ + 23, /* TEMP => ID */ + 0, /* LP => nothing */ + 0, /* RP => nothing */ + 0, /* AS => nothing */ + 0, /* COMMA => nothing */ + 0, /* ID => nothing */ + 23, /* ABORT => ID */ + 23, /* AFTER => ID */ + 23, /* ANALYZE => ID */ + 23, /* ASC => ID */ + 23, /* ATTACH => ID */ + 23, /* BEFORE => ID */ + 23, /* CASCADE => ID */ + 23, /* CAST => ID */ + 23, /* CONFLICT => ID */ + 23, /* DATABASE => ID */ + 23, /* DESC => ID */ + 23, /* DETACH => ID */ + 23, /* EACH => ID */ + 23, /* FAIL => ID */ + 23, /* FOR => ID */ + 23, /* IGNORE => ID */ + 23, /* INITIALLY => ID */ + 23, /* INSTEAD => ID */ + 23, /* LIKE_KW => ID */ + 23, /* MATCH => ID */ + 23, /* KEY => ID */ + 23, /* OF => ID */ + 23, /* OFFSET => ID */ + 23, /* PRAGMA => ID */ + 23, /* RAISE => ID */ + 23, /* REPLACE => ID */ + 23, /* RESTRICT => ID */ + 23, /* ROW => ID */ + 23, /* STATEMENT => ID */ + 23, /* TRIGGER => ID */ + 23, /* VACUUM => ID */ + 23, /* VIEW => ID */ + 23, /* VIRTUAL => ID */ + 23, /* REINDEX => ID */ + 23, /* RENAME => ID */ + 23, /* CTIME_KW => ID */ + 0, /* ANY => nothing */ + 0, /* OR => nothing */ + 0, /* AND => nothing */ + 0, /* IS => nothing */ + 0, /* BETWEEN => nothing */ + 0, /* IN => nothing */ + 0, /* ISNULL => nothing */ + 0, /* NOTNULL => nothing */ + 0, /* NE => nothing */ + 0, /* EQ => nothing */ + 0, /* GT => nothing */ + 0, /* LE => nothing */ + 0, /* LT => nothing */ + 0, /* GE => nothing */ + 0, /* ESCAPE => nothing */ + 0, /* BITAND => nothing */ + 0, /* BITOR => nothing */ + 0, /* LSHIFT => nothing */ + 0, /* RSHIFT => nothing */ + 0, /* PLUS => nothing */ + 0, /* MINUS => nothing */ + 0, /* STAR => nothing */ + 0, /* SLASH => nothing */ + 0, /* REM => nothing */ + 0, /* CONCAT => nothing */ + 0, /* UMINUS => nothing */ + 0, /* UPLUS => nothing */ + 0, /* BITNOT => nothing */ + 0, /* STRING => nothing */ + 0, /* JOIN_KW => nothing */ + 0, /* CONSTRAINT => nothing */ + 0, /* DEFAULT => nothing */ + 0, /* NULL => nothing */ + 0, /* PRIMARY => nothing */ + 0, /* UNIQUE => nothing */ + 0, /* CHECK => nothing */ + 0, /* REFERENCES => nothing */ + 0, /* COLLATE => nothing */ + 0, /* AUTOINCR => nothing */ + 0, /* ON => nothing */ + 0, /* DELETE => nothing */ + 0, /* UPDATE => nothing */ + 0, /* INSERT => nothing */ + 0, /* SET => nothing */ + 0, /* DEFERRABLE => nothing */ + 0, /* FOREIGN => nothing */ + 0, /* DROP => nothing */ + 0, /* UNION => nothing */ + 0, /* ALL => nothing */ + 0, /* EXCEPT => nothing */ + 0, /* INTERSECT => nothing */ + 0, /* SELECT => nothing */ + 0, /* DISTINCT => nothing */ + 0, /* DOT => nothing */ + 0, /* FROM => nothing */ + 0, /* JOIN => nothing */ + 0, /* USING => nothing */ + 0, /* ORDER => nothing */ + 0, /* BY => nothing */ + 0, /* GROUP => nothing */ + 0, /* HAVING => nothing */ + 0, /* LIMIT => nothing */ + 0, /* WHERE => nothing */ + 0, /* INTO => nothing */ + 0, /* VALUES => nothing */ + 0, /* INTEGER => nothing */ + 0, /* FLOAT => nothing */ + 0, /* BLOB => nothing */ + 0, /* REGISTER => nothing */ + 0, /* VARIABLE => nothing */ + 0, /* CASE => nothing */ + 0, /* WHEN => nothing */ + 0, /* THEN => nothing */ + 0, /* ELSE => nothing */ + 0, /* INDEX => nothing */ + 0, /* ALTER => nothing */ + 0, /* TO => nothing */ + 0, /* ADD => nothing */ + 0, /* COLUMNKW => nothing */ +}; +#endif /* YYFALLBACK */ + +/* The following structure represents a single element of the +** parser's stack. Information stored includes: +** +** + The state number for the parser at this level of the stack. +** +** + The value of the token stored at this level of the stack. +** (In other words, the "major" token.) +** +** + The semantic value stored at this level of the stack. This is +** the information used by the action routines in the grammar. +** It is sometimes called the "minor" token. +*/ +struct yyStackEntry { + int stateno; /* The state-number */ + int major; /* The major token value. This is the code + ** number for the token at this stack level */ + YYMINORTYPE minor; /* The user-supplied minor token value. This + ** is the value of the token */ +}; +typedef struct yyStackEntry yyStackEntry; + +/* The state of the parser is completely contained in an instance of +** the following structure */ +struct yyParser { + int yyidx; /* Index of top element in stack */ + int yyerrcnt; /* Shifts left before out of the error */ + sqlite3ParserARG_SDECL /* A place to hold %extra_argument */ + yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ +}; +typedef struct yyParser yyParser; + +#ifndef NDEBUG +#include +static FILE *yyTraceFILE = 0; +static char *yyTracePrompt = 0; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* +** Turn parser tracing on by giving a stream to which to write the trace +** and a prompt to preface each trace message. Tracing is turned off +** by making either argument NULL +** +** Inputs: +** +** +** Outputs: +** None. +*/ +void sqlite3ParserTrace(FILE *TraceFILE, char *zTracePrompt){ + yyTraceFILE = TraceFILE; + yyTracePrompt = zTracePrompt; + if( yyTraceFILE==0 ) yyTracePrompt = 0; + else if( yyTracePrompt==0 ) yyTraceFILE = 0; +} +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* For tracing shifts, the names of all terminals and nonterminals +** are required. The following table supplies these names */ +static const char *const yyTokenName[] = { + "$", "SEMI", "EXPLAIN", "QUERY", + "PLAN", "BEGIN", "TRANSACTION", "DEFERRED", + "IMMEDIATE", "EXCLUSIVE", "COMMIT", "END", + "ROLLBACK", "CREATE", "TABLE", "IF", + "NOT", "EXISTS", "TEMP", "LP", + "RP", "AS", "COMMA", "ID", + "ABORT", "AFTER", "ANALYZE", "ASC", + "ATTACH", "BEFORE", "CASCADE", "CAST", + "CONFLICT", "DATABASE", "DESC", "DETACH", + "EACH", "FAIL", "FOR", "IGNORE", + "INITIALLY", "INSTEAD", "LIKE_KW", "MATCH", + "KEY", "OF", "OFFSET", "PRAGMA", + "RAISE", "REPLACE", "RESTRICT", "ROW", + "STATEMENT", "TRIGGER", "VACUUM", "VIEW", + "VIRTUAL", "REINDEX", "RENAME", "CTIME_KW", + "ANY", "OR", "AND", "IS", + "BETWEEN", "IN", "ISNULL", "NOTNULL", + "NE", "EQ", "GT", "LE", + "LT", "GE", "ESCAPE", "BITAND", + "BITOR", "LSHIFT", "RSHIFT", "PLUS", + "MINUS", "STAR", "SLASH", "REM", + "CONCAT", "UMINUS", "UPLUS", "BITNOT", + "STRING", "JOIN_KW", "CONSTRAINT", "DEFAULT", + "NULL", "PRIMARY", "UNIQUE", "CHECK", + "REFERENCES", "COLLATE", "AUTOINCR", "ON", + "DELETE", "UPDATE", "INSERT", "SET", + "DEFERRABLE", "FOREIGN", "DROP", "UNION", + "ALL", "EXCEPT", "INTERSECT", "SELECT", + "DISTINCT", "DOT", "FROM", "JOIN", + "USING", "ORDER", "BY", "GROUP", + "HAVING", "LIMIT", "WHERE", "INTO", + "VALUES", "INTEGER", "FLOAT", "BLOB", + "REGISTER", "VARIABLE", "CASE", "WHEN", + "THEN", "ELSE", "INDEX", "ALTER", + "TO", "ADD", "COLUMNKW", "error", + "input", "cmdlist", "ecmd", "cmdx", + "cmd", "explain", "transtype", "trans_opt", + "nm", "create_table", "create_table_args", "temp", + "ifnotexists", "dbnm", "columnlist", "conslist_opt", + "select", "column", "columnid", "type", + "carglist", "id", "ids", "typetoken", + "typename", "signed", "plus_num", "minus_num", + "carg", "ccons", "term", "expr", + "onconf", "sortorder", "autoinc", "idxlist_opt", + "refargs", "defer_subclause", "refarg", "refact", + "init_deferred_pred_opt", "conslist", "tcons", "idxlist", + "defer_subclause_opt", "orconf", "resolvetype", "raisetype", + "ifexists", "fullname", "oneselect", "multiselect_op", + "distinct", "selcollist", "from", "where_opt", + "groupby_opt", "having_opt", "orderby_opt", "limit_opt", + "sclp", "as", "seltablist", "stl_prefix", + "joinop", "on_opt", "using_opt", "seltablist_paren", + "joinop2", "inscollist", "sortlist", "sortitem", + "collate", "exprlist", "setlist", "insert_cmd", + "inscollist_opt", "itemlist", "likeop", "escape", + "between_op", "in_op", "case_operand", "case_exprlist", + "case_else", "expritem", "uniqueflag", "idxitem", + "plus_opt", "number", "trigger_decl", "trigger_cmd_list", + "trigger_time", "trigger_event", "foreach_clause", "when_clause", + "trigger_cmd", "database_kw_opt", "key_opt", "add_column_fullname", + "kwcolumn_opt", "create_vtab", "vtabarglist", "vtabarg", + "vtabargtoken", "lp", "anylist", +}; +#endif /* NDEBUG */ + +#ifndef NDEBUG +/* For tracing reduce actions, the names of all rules are required. +*/ +static const char *const yyRuleName[] = { + /* 0 */ "input ::= cmdlist", + /* 1 */ "cmdlist ::= cmdlist ecmd", + /* 2 */ "cmdlist ::= ecmd", + /* 3 */ "cmdx ::= cmd", + /* 4 */ "ecmd ::= SEMI", + /* 5 */ "ecmd ::= explain cmdx SEMI", + /* 6 */ "explain ::=", + /* 7 */ "explain ::= EXPLAIN", + /* 8 */ "explain ::= EXPLAIN QUERY PLAN", + /* 9 */ "cmd ::= BEGIN transtype trans_opt", + /* 10 */ "trans_opt ::=", + /* 11 */ "trans_opt ::= TRANSACTION", + /* 12 */ "trans_opt ::= TRANSACTION nm", + /* 13 */ "transtype ::=", + /* 14 */ "transtype ::= DEFERRED", + /* 15 */ "transtype ::= IMMEDIATE", + /* 16 */ "transtype ::= EXCLUSIVE", + /* 17 */ "cmd ::= COMMIT trans_opt", + /* 18 */ "cmd ::= END trans_opt", + /* 19 */ "cmd ::= ROLLBACK trans_opt", + /* 20 */ "cmd ::= create_table create_table_args", + /* 21 */ "create_table ::= CREATE temp TABLE ifnotexists nm dbnm", + /* 22 */ "ifnotexists ::=", + /* 23 */ "ifnotexists ::= IF NOT EXISTS", + /* 24 */ "temp ::= TEMP", + /* 25 */ "temp ::=", + /* 26 */ "create_table_args ::= LP columnlist conslist_opt RP", + /* 27 */ "create_table_args ::= AS select", + /* 28 */ "columnlist ::= columnlist COMMA column", + /* 29 */ "columnlist ::= column", + /* 30 */ "column ::= columnid type carglist", + /* 31 */ "columnid ::= nm", + /* 32 */ "id ::= ID", + /* 33 */ "ids ::= ID|STRING", + /* 34 */ "nm ::= ID", + /* 35 */ "nm ::= STRING", + /* 36 */ "nm ::= JOIN_KW", + /* 37 */ "type ::=", + /* 38 */ "type ::= typetoken", + /* 39 */ "typetoken ::= typename", + /* 40 */ "typetoken ::= typename LP signed RP", + /* 41 */ "typetoken ::= typename LP signed COMMA signed RP", + /* 42 */ "typename ::= ids", + /* 43 */ "typename ::= typename ids", + /* 44 */ "signed ::= plus_num", + /* 45 */ "signed ::= minus_num", + /* 46 */ "carglist ::= carglist carg", + /* 47 */ "carglist ::=", + /* 48 */ "carg ::= CONSTRAINT nm ccons", + /* 49 */ "carg ::= ccons", + /* 50 */ "carg ::= DEFAULT term", + /* 51 */ "carg ::= DEFAULT LP expr RP", + /* 52 */ "carg ::= DEFAULT PLUS term", + /* 53 */ "carg ::= DEFAULT MINUS term", + /* 54 */ "carg ::= DEFAULT id", + /* 55 */ "ccons ::= NULL onconf", + /* 56 */ "ccons ::= NOT NULL onconf", + /* 57 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc", + /* 58 */ "ccons ::= UNIQUE onconf", + /* 59 */ "ccons ::= CHECK LP expr RP", + /* 60 */ "ccons ::= REFERENCES nm idxlist_opt refargs", + /* 61 */ "ccons ::= defer_subclause", + /* 62 */ "ccons ::= COLLATE id", + /* 63 */ "autoinc ::=", + /* 64 */ "autoinc ::= AUTOINCR", + /* 65 */ "refargs ::=", + /* 66 */ "refargs ::= refargs refarg", + /* 67 */ "refarg ::= MATCH nm", + /* 68 */ "refarg ::= ON DELETE refact", + /* 69 */ "refarg ::= ON UPDATE refact", + /* 70 */ "refarg ::= ON INSERT refact", + /* 71 */ "refact ::= SET NULL", + /* 72 */ "refact ::= SET DEFAULT", + /* 73 */ "refact ::= CASCADE", + /* 74 */ "refact ::= RESTRICT", + /* 75 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt", + /* 76 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt", + /* 77 */ "init_deferred_pred_opt ::=", + /* 78 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED", + /* 79 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE", + /* 80 */ "conslist_opt ::=", + /* 81 */ "conslist_opt ::= COMMA conslist", + /* 82 */ "conslist ::= conslist COMMA tcons", + /* 83 */ "conslist ::= conslist tcons", + /* 84 */ "conslist ::= tcons", + /* 85 */ "tcons ::= CONSTRAINT nm", + /* 86 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf", + /* 87 */ "tcons ::= UNIQUE LP idxlist RP onconf", + /* 88 */ "tcons ::= CHECK LP expr RP onconf", + /* 89 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt", + /* 90 */ "defer_subclause_opt ::=", + /* 91 */ "defer_subclause_opt ::= defer_subclause", + /* 92 */ "onconf ::=", + /* 93 */ "onconf ::= ON CONFLICT resolvetype", + /* 94 */ "orconf ::=", + /* 95 */ "orconf ::= OR resolvetype", + /* 96 */ "resolvetype ::= raisetype", + /* 97 */ "resolvetype ::= IGNORE", + /* 98 */ "resolvetype ::= REPLACE", + /* 99 */ "cmd ::= DROP TABLE ifexists fullname", + /* 100 */ "ifexists ::= IF EXISTS", + /* 101 */ "ifexists ::=", + /* 102 */ "cmd ::= CREATE temp VIEW ifnotexists nm dbnm AS select", + /* 103 */ "cmd ::= DROP VIEW ifexists fullname", + /* 104 */ "cmd ::= select", + /* 105 */ "select ::= oneselect", + /* 106 */ "select ::= select multiselect_op oneselect", + /* 107 */ "multiselect_op ::= UNION", + /* 108 */ "multiselect_op ::= UNION ALL", + /* 109 */ "multiselect_op ::= EXCEPT|INTERSECT", + /* 110 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt", + /* 111 */ "distinct ::= DISTINCT", + /* 112 */ "distinct ::= ALL", + /* 113 */ "distinct ::=", + /* 114 */ "sclp ::= selcollist COMMA", + /* 115 */ "sclp ::=", + /* 116 */ "selcollist ::= sclp expr as", + /* 117 */ "selcollist ::= sclp STAR", + /* 118 */ "selcollist ::= sclp nm DOT STAR", + /* 119 */ "as ::= AS nm", + /* 120 */ "as ::= ids", + /* 121 */ "as ::=", + /* 122 */ "from ::=", + /* 123 */ "from ::= FROM seltablist", + /* 124 */ "stl_prefix ::= seltablist joinop", + /* 125 */ "stl_prefix ::=", + /* 126 */ "seltablist ::= stl_prefix nm dbnm as on_opt using_opt", + /* 127 */ "seltablist ::= stl_prefix LP seltablist_paren RP as on_opt using_opt", + /* 128 */ "seltablist_paren ::= select", + /* 129 */ "seltablist_paren ::= seltablist", + /* 130 */ "dbnm ::=", + /* 131 */ "dbnm ::= DOT nm", + /* 132 */ "fullname ::= nm dbnm", + /* 133 */ "joinop ::= COMMA|JOIN", + /* 134 */ "joinop ::= JOIN_KW JOIN", + /* 135 */ "joinop ::= JOIN_KW nm JOIN", + /* 136 */ "joinop ::= JOIN_KW nm nm JOIN", + /* 137 */ "on_opt ::= ON expr", + /* 138 */ "on_opt ::=", + /* 139 */ "using_opt ::= USING LP inscollist RP", + /* 140 */ "using_opt ::=", + /* 141 */ "orderby_opt ::=", + /* 142 */ "orderby_opt ::= ORDER BY sortlist", + /* 143 */ "sortlist ::= sortlist COMMA sortitem collate sortorder", + /* 144 */ "sortlist ::= sortitem collate sortorder", + /* 145 */ "sortitem ::= expr", + /* 146 */ "sortorder ::= ASC", + /* 147 */ "sortorder ::= DESC", + /* 148 */ "sortorder ::=", + /* 149 */ "collate ::=", + /* 150 */ "collate ::= COLLATE id", + /* 151 */ "groupby_opt ::=", + /* 152 */ "groupby_opt ::= GROUP BY exprlist", + /* 153 */ "having_opt ::=", + /* 154 */ "having_opt ::= HAVING expr", + /* 155 */ "limit_opt ::=", + /* 156 */ "limit_opt ::= LIMIT expr", + /* 157 */ "limit_opt ::= LIMIT expr OFFSET expr", + /* 158 */ "limit_opt ::= LIMIT expr COMMA expr", + /* 159 */ "cmd ::= DELETE FROM fullname where_opt", + /* 160 */ "where_opt ::=", + /* 161 */ "where_opt ::= WHERE expr", + /* 162 */ "cmd ::= UPDATE orconf fullname SET setlist where_opt", + /* 163 */ "setlist ::= setlist COMMA nm EQ expr", + /* 164 */ "setlist ::= nm EQ expr", + /* 165 */ "cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP", + /* 166 */ "cmd ::= insert_cmd INTO fullname inscollist_opt select", + /* 167 */ "cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES", + /* 168 */ "insert_cmd ::= INSERT orconf", + /* 169 */ "insert_cmd ::= REPLACE", + /* 170 */ "itemlist ::= itemlist COMMA expr", + /* 171 */ "itemlist ::= expr", + /* 172 */ "inscollist_opt ::=", + /* 173 */ "inscollist_opt ::= LP inscollist RP", + /* 174 */ "inscollist ::= inscollist COMMA nm", + /* 175 */ "inscollist ::= nm", + /* 176 */ "expr ::= term", + /* 177 */ "expr ::= LP expr RP", + /* 178 */ "term ::= NULL", + /* 179 */ "expr ::= ID", + /* 180 */ "expr ::= JOIN_KW", + /* 181 */ "expr ::= nm DOT nm", + /* 182 */ "expr ::= nm DOT nm DOT nm", + /* 183 */ "term ::= INTEGER|FLOAT|BLOB", + /* 184 */ "term ::= STRING", + /* 185 */ "expr ::= REGISTER", + /* 186 */ "expr ::= VARIABLE", + /* 187 */ "expr ::= CAST LP expr AS typetoken RP", + /* 188 */ "expr ::= ID LP distinct exprlist RP", + /* 189 */ "expr ::= ID LP STAR RP", + /* 190 */ "term ::= CTIME_KW", + /* 191 */ "expr ::= expr AND expr", + /* 192 */ "expr ::= expr OR expr", + /* 193 */ "expr ::= expr LT|GT|GE|LE expr", + /* 194 */ "expr ::= expr EQ|NE expr", + /* 195 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", + /* 196 */ "expr ::= expr PLUS|MINUS expr", + /* 197 */ "expr ::= expr STAR|SLASH|REM expr", + /* 198 */ "expr ::= expr CONCAT expr", + /* 199 */ "likeop ::= LIKE_KW", + /* 200 */ "likeop ::= NOT LIKE_KW", + /* 201 */ "likeop ::= MATCH", + /* 202 */ "likeop ::= NOT MATCH", + /* 203 */ "escape ::= ESCAPE expr", + /* 204 */ "escape ::=", + /* 205 */ "expr ::= expr likeop expr escape", + /* 206 */ "expr ::= expr ISNULL|NOTNULL", + /* 207 */ "expr ::= expr IS NULL", + /* 208 */ "expr ::= expr NOT NULL", + /* 209 */ "expr ::= expr IS NOT NULL", + /* 210 */ "expr ::= NOT|BITNOT expr", + /* 211 */ "expr ::= MINUS expr", + /* 212 */ "expr ::= PLUS expr", + /* 213 */ "between_op ::= BETWEEN", + /* 214 */ "between_op ::= NOT BETWEEN", + /* 215 */ "expr ::= expr between_op expr AND expr", + /* 216 */ "in_op ::= IN", + /* 217 */ "in_op ::= NOT IN", + /* 218 */ "expr ::= expr in_op LP exprlist RP", + /* 219 */ "expr ::= LP select RP", + /* 220 */ "expr ::= expr in_op LP select RP", + /* 221 */ "expr ::= expr in_op nm dbnm", + /* 222 */ "expr ::= EXISTS LP select RP", + /* 223 */ "expr ::= CASE case_operand case_exprlist case_else END", + /* 224 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", + /* 225 */ "case_exprlist ::= WHEN expr THEN expr", + /* 226 */ "case_else ::= ELSE expr", + /* 227 */ "case_else ::=", + /* 228 */ "case_operand ::= expr", + /* 229 */ "case_operand ::=", + /* 230 */ "exprlist ::= exprlist COMMA expritem", + /* 231 */ "exprlist ::= expritem", + /* 232 */ "expritem ::= expr", + /* 233 */ "expritem ::=", + /* 234 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP", + /* 235 */ "uniqueflag ::= UNIQUE", + /* 236 */ "uniqueflag ::=", + /* 237 */ "idxlist_opt ::=", + /* 238 */ "idxlist_opt ::= LP idxlist RP", + /* 239 */ "idxlist ::= idxlist COMMA idxitem collate sortorder", + /* 240 */ "idxlist ::= idxitem collate sortorder", + /* 241 */ "idxitem ::= nm", + /* 242 */ "cmd ::= DROP INDEX ifexists fullname", + /* 243 */ "cmd ::= VACUUM", + /* 244 */ "cmd ::= VACUUM nm", + /* 245 */ "cmd ::= PRAGMA nm dbnm EQ nm", + /* 246 */ "cmd ::= PRAGMA nm dbnm EQ ON", + /* 247 */ "cmd ::= PRAGMA nm dbnm EQ plus_num", + /* 248 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", + /* 249 */ "cmd ::= PRAGMA nm dbnm LP nm RP", + /* 250 */ "cmd ::= PRAGMA nm dbnm", + /* 251 */ "plus_num ::= plus_opt number", + /* 252 */ "minus_num ::= MINUS number", + /* 253 */ "number ::= INTEGER|FLOAT", + /* 254 */ "plus_opt ::= PLUS", + /* 255 */ "plus_opt ::=", + /* 256 */ "cmd ::= CREATE trigger_decl BEGIN trigger_cmd_list END", + /* 257 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", + /* 258 */ "trigger_time ::= BEFORE", + /* 259 */ "trigger_time ::= AFTER", + /* 260 */ "trigger_time ::= INSTEAD OF", + /* 261 */ "trigger_time ::=", + /* 262 */ "trigger_event ::= DELETE|INSERT", + /* 263 */ "trigger_event ::= UPDATE", + /* 264 */ "trigger_event ::= UPDATE OF inscollist", + /* 265 */ "foreach_clause ::=", + /* 266 */ "foreach_clause ::= FOR EACH ROW", + /* 267 */ "foreach_clause ::= FOR EACH STATEMENT", + /* 268 */ "when_clause ::=", + /* 269 */ "when_clause ::= WHEN expr", + /* 270 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", + /* 271 */ "trigger_cmd_list ::=", + /* 272 */ "trigger_cmd ::= UPDATE orconf nm SET setlist where_opt", + /* 273 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP", + /* 274 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt select", + /* 275 */ "trigger_cmd ::= DELETE FROM nm where_opt", + /* 276 */ "trigger_cmd ::= select", + /* 277 */ "expr ::= RAISE LP IGNORE RP", + /* 278 */ "expr ::= RAISE LP raisetype COMMA nm RP", + /* 279 */ "raisetype ::= ROLLBACK", + /* 280 */ "raisetype ::= ABORT", + /* 281 */ "raisetype ::= FAIL", + /* 282 */ "cmd ::= DROP TRIGGER ifexists fullname", + /* 283 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", + /* 284 */ "key_opt ::=", + /* 285 */ "key_opt ::= KEY expr", + /* 286 */ "database_kw_opt ::= DATABASE", + /* 287 */ "database_kw_opt ::=", + /* 288 */ "cmd ::= DETACH database_kw_opt expr", + /* 289 */ "cmd ::= REINDEX", + /* 290 */ "cmd ::= REINDEX nm dbnm", + /* 291 */ "cmd ::= ANALYZE", + /* 292 */ "cmd ::= ANALYZE nm dbnm", + /* 293 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", + /* 294 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column", + /* 295 */ "add_column_fullname ::= fullname", + /* 296 */ "kwcolumn_opt ::=", + /* 297 */ "kwcolumn_opt ::= COLUMNKW", + /* 298 */ "cmd ::= create_vtab", + /* 299 */ "cmd ::= create_vtab LP vtabarglist RP", + /* 300 */ "create_vtab ::= CREATE VIRTUAL TABLE nm dbnm USING nm", + /* 301 */ "vtabarglist ::= vtabarg", + /* 302 */ "vtabarglist ::= vtabarglist COMMA vtabarg", + /* 303 */ "vtabarg ::=", + /* 304 */ "vtabarg ::= vtabarg vtabargtoken", + /* 305 */ "vtabargtoken ::= ANY", + /* 306 */ "vtabargtoken ::= lp anylist RP", + /* 307 */ "lp ::= LP", + /* 308 */ "anylist ::=", + /* 309 */ "anylist ::= anylist ANY", +}; +#endif /* NDEBUG */ + +/* +** This function returns the symbolic name associated with a token +** value. +*/ +const char *sqlite3ParserTokenName(int tokenType){ +#ifndef NDEBUG + if( tokenType>0 && tokenType<(sizeof(yyTokenName)/sizeof(yyTokenName[0])) ){ + return yyTokenName[tokenType]; + }else{ + return "Unknown"; + } +#else + return ""; +#endif +} + +/* +** This function allocates a new parser. +** The only argument is a pointer to a function which works like +** malloc. +** +** Inputs: +** A pointer to the function used to allocate memory. +** +** Outputs: +** A pointer to a parser. This pointer is used in subsequent calls +** to sqlite3Parser and sqlite3ParserFree. +*/ +void *sqlite3ParserAlloc(void *(*mallocProc)(size_t)){ + yyParser *pParser; + pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); + if( pParser ){ + pParser->yyidx = -1; + } + return pParser; +} + +/* The following function deletes the value associated with a +** symbol. The symbol can be either a terminal or nonterminal. +** "yymajor" is the symbol code, and "yypminor" is a pointer to +** the value. +*/ +static void yy_destructor(YYCODETYPE yymajor, YYMINORTYPE *yypminor){ + switch( yymajor ){ + /* Here is inserted the actions which take place when a + ** terminal or non-terminal is destroyed. This can happen + ** when the symbol is popped from the stack during a + ** reduce or during error processing or when a parser is + ** being destroyed before it is finished parsing. + ** + ** Note: during a reduce, the only symbols destroyed are those + ** which appear on the RHS of the rule, but which are not used + ** inside the C code. + */ + case 156: + case 190: + case 207: +#line 374 "parse.y" +{sqlite3SelectDelete((yypminor->yy219));} +#line 1249 "parse.c" + break; + case 170: + case 171: + case 195: + case 197: + case 205: + case 211: + case 219: + case 222: + case 224: + case 225: + case 235: +#line 633 "parse.y" +{sqlite3ExprDelete((yypminor->yy172));} +#line 1264 "parse.c" + break; + case 175: + case 183: + case 193: + case 196: + case 198: + case 200: + case 210: + case 213: + case 214: + case 217: + case 223: +#line 870 "parse.y" +{sqlite3ExprListDelete((yypminor->yy174));} +#line 1279 "parse.c" + break; + case 189: + case 194: + case 202: + case 203: +#line 502 "parse.y" +{sqlite3SrcListDelete((yypminor->yy373));} +#line 1287 "parse.c" + break; + case 199: +#line 563 "parse.y" +{ + sqlite3ExprDelete((yypminor->yy234).pLimit); + sqlite3ExprDelete((yypminor->yy234).pOffset); +} +#line 1295 "parse.c" + break; + case 206: + case 209: + case 216: +#line 519 "parse.y" +{sqlite3IdListDelete((yypminor->yy432));} +#line 1302 "parse.c" + break; + case 231: + case 236: +#line 966 "parse.y" +{sqlite3DeleteTriggerStep((yypminor->yy243));} +#line 1308 "parse.c" + break; + case 233: +#line 950 "parse.y" +{sqlite3IdListDelete((yypminor->yy370).b);} +#line 1313 "parse.c" + break; + case 238: +#line 1034 "parse.y" +{sqlite3ExprDelete((yypminor->yy386));} +#line 1318 "parse.c" + break; + default: break; /* If no destructor action specified: do nothing */ + } +} + +/* +** Pop the parser's stack once. +** +** If there is a destructor routine associated with the token which +** is popped from the stack, then call it. +** +** Return the major token number for the symbol popped. +*/ +static int yy_pop_parser_stack(yyParser *pParser){ + YYCODETYPE yymajor; + yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; + + if( pParser->yyidx<0 ) return 0; +#ifndef NDEBUG + if( yyTraceFILE && pParser->yyidx>=0 ){ + fprintf(yyTraceFILE,"%sPopping %s\n", + yyTracePrompt, + yyTokenName[yytos->major]); + } +#endif + yymajor = yytos->major; + yy_destructor( yymajor, &yytos->minor); + pParser->yyidx--; + return yymajor; +} + +/* +** Deallocate and destroy a parser. Destructors are all called for +** all stack elements before shutting the parser down. +** +** Inputs: +** +*/ +void sqlite3ParserFree( + void *p, /* The parser to be deleted */ + void (*freeProc)(void*) /* Function used to reclaim memory */ +){ + yyParser *pParser = (yyParser*)p; + if( pParser==0 ) return; + while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); + (*freeProc)((void*)pParser); +} + +/* +** Find the appropriate action for a parser given the terminal +** look-ahead token iLookAhead. +** +** If the look-ahead token is YYNOCODE, then check to see if the action is +** independent of the look-ahead. If it is, return the action, otherwise +** return YY_NO_ACTION. +*/ +static int yy_find_shift_action( + yyParser *pParser, /* The parser */ + YYCODETYPE iLookAhead /* The look-ahead token */ +){ + int i; + int stateno = pParser->yystack[pParser->yyidx].stateno; + + if( stateno>YY_SHIFT_MAX || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){ + return yy_default[stateno]; + } + if( iLookAhead==YYNOCODE ){ + return YY_NO_ACTION; + } + i += iLookAhead; + if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ + if( iLookAhead>0 ){ +#ifdef YYFALLBACK + int iFallback; /* Fallback token */ + if( iLookAhead %s\n", + yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); + } +#endif + return yy_find_shift_action(pParser, iFallback); + } +#endif +#ifdef YYWILDCARD + { + int j = i - iLookAhead + YYWILDCARD; + if( j>=0 && j %s\n", + yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]); + } +#endif /* NDEBUG */ + return yy_action[j]; + } + } +#endif /* YYWILDCARD */ + } + return yy_default[stateno]; + }else{ + return yy_action[i]; + } +} + +/* +** Find the appropriate action for a parser given the non-terminal +** look-ahead token iLookAhead. +** +** If the look-ahead token is YYNOCODE, then check to see if the action is +** independent of the look-ahead. If it is, return the action, otherwise +** return YY_NO_ACTION. +*/ +static int yy_find_reduce_action( + int stateno, /* Current state number */ + YYCODETYPE iLookAhead /* The look-ahead token */ +){ + int i; + /* int stateno = pParser->yystack[pParser->yyidx].stateno; */ + + if( stateno>YY_REDUCE_MAX || + (i = yy_reduce_ofst[stateno])==YY_REDUCE_USE_DFLT ){ + return yy_default[stateno]; + } + if( iLookAhead==YYNOCODE ){ + return YY_NO_ACTION; + } + i += iLookAhead; + if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){ + return yy_default[stateno]; + }else{ + return yy_action[i]; + } +} + +/* +** Perform a shift action. +*/ +static void yy_shift( + yyParser *yypParser, /* The parser to be shifted */ + int yyNewState, /* The new state to shift in */ + int yyMajor, /* The major token to shift in */ + YYMINORTYPE *yypMinor /* Pointer ot the minor token to shift in */ +){ + yyStackEntry *yytos; + yypParser->yyidx++; + if( yypParser->yyidx>=YYSTACKDEPTH ){ + sqlite3ParserARG_FETCH; + yypParser->yyidx--; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); + } +#endif + while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will execute if the parser + ** stack every overflows */ +#line 44 "parse.y" + + sqlite3ErrorMsg(pParse, "parser stack overflow"); + pParse->parseError = 1; +#line 1487 "parse.c" + sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument var */ + return; + } + yytos = &yypParser->yystack[yypParser->yyidx]; + yytos->stateno = yyNewState; + yytos->major = yyMajor; + yytos->minor = *yypMinor; +#ifndef NDEBUG + if( yyTraceFILE && yypParser->yyidx>0 ){ + int i; + fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); + fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); + for(i=1; i<=yypParser->yyidx; i++) + fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); + fprintf(yyTraceFILE,"\n"); + } +#endif +} + +/* The following table contains information about every rule that +** is used during the reduce. +*/ +static const struct { + YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ + unsigned char nrhs; /* Number of right-hand side symbols in the rule */ +} yyRuleInfo[] = { + { 140, 1 }, + { 141, 2 }, + { 141, 1 }, + { 143, 1 }, + { 142, 1 }, + { 142, 3 }, + { 145, 0 }, + { 145, 1 }, + { 145, 3 }, + { 144, 3 }, + { 147, 0 }, + { 147, 1 }, + { 147, 2 }, + { 146, 0 }, + { 146, 1 }, + { 146, 1 }, + { 146, 1 }, + { 144, 2 }, + { 144, 2 }, + { 144, 2 }, + { 144, 2 }, + { 149, 6 }, + { 152, 0 }, + { 152, 3 }, + { 151, 1 }, + { 151, 0 }, + { 150, 4 }, + { 150, 2 }, + { 154, 3 }, + { 154, 1 }, + { 157, 3 }, + { 158, 1 }, + { 161, 1 }, + { 162, 1 }, + { 148, 1 }, + { 148, 1 }, + { 148, 1 }, + { 159, 0 }, + { 159, 1 }, + { 163, 1 }, + { 163, 4 }, + { 163, 6 }, + { 164, 1 }, + { 164, 2 }, + { 165, 1 }, + { 165, 1 }, + { 160, 2 }, + { 160, 0 }, + { 168, 3 }, + { 168, 1 }, + { 168, 2 }, + { 168, 4 }, + { 168, 3 }, + { 168, 3 }, + { 168, 2 }, + { 169, 2 }, + { 169, 3 }, + { 169, 5 }, + { 169, 2 }, + { 169, 4 }, + { 169, 4 }, + { 169, 1 }, + { 169, 2 }, + { 174, 0 }, + { 174, 1 }, + { 176, 0 }, + { 176, 2 }, + { 178, 2 }, + { 178, 3 }, + { 178, 3 }, + { 178, 3 }, + { 179, 2 }, + { 179, 2 }, + { 179, 1 }, + { 179, 1 }, + { 177, 3 }, + { 177, 2 }, + { 180, 0 }, + { 180, 2 }, + { 180, 2 }, + { 155, 0 }, + { 155, 2 }, + { 181, 3 }, + { 181, 2 }, + { 181, 1 }, + { 182, 2 }, + { 182, 7 }, + { 182, 5 }, + { 182, 5 }, + { 182, 10 }, + { 184, 0 }, + { 184, 1 }, + { 172, 0 }, + { 172, 3 }, + { 185, 0 }, + { 185, 2 }, + { 186, 1 }, + { 186, 1 }, + { 186, 1 }, + { 144, 4 }, + { 188, 2 }, + { 188, 0 }, + { 144, 8 }, + { 144, 4 }, + { 144, 1 }, + { 156, 1 }, + { 156, 3 }, + { 191, 1 }, + { 191, 2 }, + { 191, 1 }, + { 190, 9 }, + { 192, 1 }, + { 192, 1 }, + { 192, 0 }, + { 200, 2 }, + { 200, 0 }, + { 193, 3 }, + { 193, 2 }, + { 193, 4 }, + { 201, 2 }, + { 201, 1 }, + { 201, 0 }, + { 194, 0 }, + { 194, 2 }, + { 203, 2 }, + { 203, 0 }, + { 202, 6 }, + { 202, 7 }, + { 207, 1 }, + { 207, 1 }, + { 153, 0 }, + { 153, 2 }, + { 189, 2 }, + { 204, 1 }, + { 204, 2 }, + { 204, 3 }, + { 204, 4 }, + { 205, 2 }, + { 205, 0 }, + { 206, 4 }, + { 206, 0 }, + { 198, 0 }, + { 198, 3 }, + { 210, 5 }, + { 210, 3 }, + { 211, 1 }, + { 173, 1 }, + { 173, 1 }, + { 173, 0 }, + { 212, 0 }, + { 212, 2 }, + { 196, 0 }, + { 196, 3 }, + { 197, 0 }, + { 197, 2 }, + { 199, 0 }, + { 199, 2 }, + { 199, 4 }, + { 199, 4 }, + { 144, 4 }, + { 195, 0 }, + { 195, 2 }, + { 144, 6 }, + { 214, 5 }, + { 214, 3 }, + { 144, 8 }, + { 144, 5 }, + { 144, 6 }, + { 215, 2 }, + { 215, 1 }, + { 217, 3 }, + { 217, 1 }, + { 216, 0 }, + { 216, 3 }, + { 209, 3 }, + { 209, 1 }, + { 171, 1 }, + { 171, 3 }, + { 170, 1 }, + { 171, 1 }, + { 171, 1 }, + { 171, 3 }, + { 171, 5 }, + { 170, 1 }, + { 170, 1 }, + { 171, 1 }, + { 171, 1 }, + { 171, 6 }, + { 171, 5 }, + { 171, 4 }, + { 170, 1 }, + { 171, 3 }, + { 171, 3 }, + { 171, 3 }, + { 171, 3 }, + { 171, 3 }, + { 171, 3 }, + { 171, 3 }, + { 171, 3 }, + { 218, 1 }, + { 218, 2 }, + { 218, 1 }, + { 218, 2 }, + { 219, 2 }, + { 219, 0 }, + { 171, 4 }, + { 171, 2 }, + { 171, 3 }, + { 171, 3 }, + { 171, 4 }, + { 171, 2 }, + { 171, 2 }, + { 171, 2 }, + { 220, 1 }, + { 220, 2 }, + { 171, 5 }, + { 221, 1 }, + { 221, 2 }, + { 171, 5 }, + { 171, 3 }, + { 171, 5 }, + { 171, 4 }, + { 171, 4 }, + { 171, 5 }, + { 223, 5 }, + { 223, 4 }, + { 224, 2 }, + { 224, 0 }, + { 222, 1 }, + { 222, 0 }, + { 213, 3 }, + { 213, 1 }, + { 225, 1 }, + { 225, 0 }, + { 144, 11 }, + { 226, 1 }, + { 226, 0 }, + { 175, 0 }, + { 175, 3 }, + { 183, 5 }, + { 183, 3 }, + { 227, 1 }, + { 144, 4 }, + { 144, 1 }, + { 144, 2 }, + { 144, 5 }, + { 144, 5 }, + { 144, 5 }, + { 144, 5 }, + { 144, 6 }, + { 144, 3 }, + { 166, 2 }, + { 167, 2 }, + { 229, 1 }, + { 228, 1 }, + { 228, 0 }, + { 144, 5 }, + { 230, 11 }, + { 232, 1 }, + { 232, 1 }, + { 232, 2 }, + { 232, 0 }, + { 233, 1 }, + { 233, 1 }, + { 233, 3 }, + { 234, 0 }, + { 234, 3 }, + { 234, 3 }, + { 235, 0 }, + { 235, 2 }, + { 231, 3 }, + { 231, 0 }, + { 236, 6 }, + { 236, 8 }, + { 236, 5 }, + { 236, 4 }, + { 236, 1 }, + { 171, 4 }, + { 171, 6 }, + { 187, 1 }, + { 187, 1 }, + { 187, 1 }, + { 144, 4 }, + { 144, 6 }, + { 238, 0 }, + { 238, 2 }, + { 237, 1 }, + { 237, 0 }, + { 144, 3 }, + { 144, 1 }, + { 144, 3 }, + { 144, 1 }, + { 144, 3 }, + { 144, 6 }, + { 144, 6 }, + { 239, 1 }, + { 240, 0 }, + { 240, 1 }, + { 144, 1 }, + { 144, 4 }, + { 241, 7 }, + { 242, 1 }, + { 242, 3 }, + { 243, 0 }, + { 243, 2 }, + { 244, 1 }, + { 244, 3 }, + { 245, 1 }, + { 246, 0 }, + { 246, 2 }, +}; + +static void yy_accept(yyParser*); /* Forward Declaration */ + +/* +** Perform a reduce action and the shift that must immediately +** follow the reduce. +*/ +static void yy_reduce( + yyParser *yypParser, /* The parser */ + int yyruleno /* Number of the rule by which to reduce */ +){ + int yygoto; /* The next state */ + int yyact; /* The next action */ + YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ + yyStackEntry *yymsp; /* The top of the parser's stack */ + int yysize; /* Amount to pop the stack */ + sqlite3ParserARG_FETCH; + yymsp = &yypParser->yystack[yypParser->yyidx]; +#ifndef NDEBUG + if( yyTraceFILE && yyruleno>=0 + && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ + fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt, + yyRuleName[yyruleno]); + } +#endif /* NDEBUG */ + +#ifndef NDEBUG + /* Silence complaints from purify about yygotominor being uninitialized + ** in some cases when it is copied into the stack after the following + ** switch. yygotominor is uninitialized when a rule reduces that does + ** not set the value of its left-hand side nonterminal. Leaving the + ** value of the nonterminal uninitialized is utterly harmless as long + ** as the value is never used. So really the only thing this code + ** accomplishes is to quieten purify. + */ + memset(&yygotominor, 0, sizeof(yygotominor)); +#endif + + switch( yyruleno ){ + /* Beginning here are the reduction cases. A typical example + ** follows: + ** case 0: + ** #line + ** { ... } // User supplied code + ** #line + ** break; + */ + case 3: +#line 100 "parse.y" +{ sqlite3FinishCoding(pParse); } +#line 1875 "parse.c" + break; + case 6: +#line 103 "parse.y" +{ sqlite3BeginParse(pParse, 0); } +#line 1880 "parse.c" + break; + case 7: +#line 105 "parse.y" +{ sqlite3BeginParse(pParse, 1); } +#line 1885 "parse.c" + break; + case 8: +#line 106 "parse.y" +{ sqlite3BeginParse(pParse, 2); } +#line 1890 "parse.c" + break; + case 9: +#line 112 "parse.y" +{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy46);} +#line 1895 "parse.c" + break; + case 13: +#line 117 "parse.y" +{yygotominor.yy46 = TK_DEFERRED;} +#line 1900 "parse.c" + break; + case 14: + case 15: + case 16: + case 107: + case 109: +#line 118 "parse.y" +{yygotominor.yy46 = yymsp[0].major;} +#line 1909 "parse.c" + break; + case 17: + case 18: +#line 121 "parse.y" +{sqlite3CommitTransaction(pParse);} +#line 1915 "parse.c" + break; + case 19: +#line 123 "parse.y" +{sqlite3RollbackTransaction(pParse);} +#line 1920 "parse.c" + break; + case 21: +#line 128 "parse.y" +{ + sqlite3StartTable(pParse,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy410,yymsp[-4].minor.yy46,0,0,yymsp[-2].minor.yy46); +} +#line 1927 "parse.c" + break; + case 22: + case 25: + case 63: + case 77: + case 79: + case 90: + case 101: + case 112: + case 113: + case 213: + case 216: +#line 132 "parse.y" +{yygotominor.yy46 = 0;} +#line 1942 "parse.c" + break; + case 23: + case 24: + case 64: + case 78: + case 100: + case 111: + case 214: + case 217: +#line 133 "parse.y" +{yygotominor.yy46 = 1;} +#line 1954 "parse.c" + break; + case 26: +#line 139 "parse.y" +{ + sqlite3EndTable(pParse,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy0,0); +} +#line 1961 "parse.c" + break; + case 27: +#line 142 "parse.y" +{ + sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy219); + sqlite3SelectDelete(yymsp[0].minor.yy219); +} +#line 1969 "parse.c" + break; + case 30: +#line 154 "parse.y" +{ + yygotominor.yy410.z = yymsp[-2].minor.yy410.z; + yygotominor.yy410.n = (pParse->sLastToken.z-yymsp[-2].minor.yy410.z) + pParse->sLastToken.n; +} +#line 1977 "parse.c" + break; + case 31: +#line 158 "parse.y" +{ + sqlite3AddColumn(pParse,&yymsp[0].minor.yy410); + yygotominor.yy410 = yymsp[0].minor.yy410; +} +#line 1985 "parse.c" + break; + case 32: + case 33: + case 34: + case 35: + case 36: + case 253: +#line 168 "parse.y" +{yygotominor.yy410 = yymsp[0].minor.yy0;} +#line 1995 "parse.c" + break; + case 38: +#line 228 "parse.y" +{sqlite3AddColumnType(pParse,&yymsp[0].minor.yy410);} +#line 2000 "parse.c" + break; + case 39: + case 42: + case 119: + case 120: + case 131: + case 150: + case 241: + case 251: + case 252: +#line 229 "parse.y" +{yygotominor.yy410 = yymsp[0].minor.yy410;} +#line 2013 "parse.c" + break; + case 40: +#line 230 "parse.y" +{ + yygotominor.yy410.z = yymsp[-3].minor.yy410.z; + yygotominor.yy410.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy410.z; +} +#line 2021 "parse.c" + break; + case 41: +#line 234 "parse.y" +{ + yygotominor.yy410.z = yymsp[-5].minor.yy410.z; + yygotominor.yy410.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy410.z; +} +#line 2029 "parse.c" + break; + case 43: +#line 240 "parse.y" +{yygotominor.yy410.z=yymsp[-1].minor.yy410.z; yygotominor.yy410.n=yymsp[0].minor.yy410.n+(yymsp[0].minor.yy410.z-yymsp[-1].minor.yy410.z);} +#line 2034 "parse.c" + break; + case 44: +#line 242 "parse.y" +{ yygotominor.yy46 = atoi((char*)yymsp[0].minor.yy410.z); } +#line 2039 "parse.c" + break; + case 45: +#line 243 "parse.y" +{ yygotominor.yy46 = -atoi((char*)yymsp[0].minor.yy410.z); } +#line 2044 "parse.c" + break; + case 50: + case 52: +#line 252 "parse.y" +{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy172);} +#line 2050 "parse.c" + break; + case 51: +#line 253 "parse.y" +{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy172);} +#line 2055 "parse.c" + break; + case 53: +#line 255 "parse.y" +{ + Expr *p = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy172, 0, 0); + sqlite3AddDefaultValue(pParse,p); +} +#line 2063 "parse.c" + break; + case 54: +#line 259 "parse.y" +{ + Expr *p = sqlite3Expr(TK_STRING, 0, 0, &yymsp[0].minor.yy410); + sqlite3AddDefaultValue(pParse,p); +} +#line 2071 "parse.c" + break; + case 56: +#line 268 "parse.y" +{sqlite3AddNotNull(pParse, yymsp[0].minor.yy46);} +#line 2076 "parse.c" + break; + case 57: +#line 270 "parse.y" +{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy46,yymsp[0].minor.yy46,yymsp[-2].minor.yy46);} +#line 2081 "parse.c" + break; + case 58: +#line 271 "parse.y" +{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy46,0,0,0,0);} +#line 2086 "parse.c" + break; + case 59: +#line 272 "parse.y" +{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy172);} +#line 2091 "parse.c" + break; + case 60: +#line 274 "parse.y" +{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy410,yymsp[-1].minor.yy174,yymsp[0].minor.yy46);} +#line 2096 "parse.c" + break; + case 61: +#line 275 "parse.y" +{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy46);} +#line 2101 "parse.c" + break; + case 62: +#line 276 "parse.y" +{sqlite3AddCollateType(pParse, (char*)yymsp[0].minor.yy410.z, yymsp[0].minor.yy410.n);} +#line 2106 "parse.c" + break; + case 65: +#line 289 "parse.y" +{ yygotominor.yy46 = OE_Restrict * 0x010101; } +#line 2111 "parse.c" + break; + case 66: +#line 290 "parse.y" +{ yygotominor.yy46 = (yymsp[-1].minor.yy46 & yymsp[0].minor.yy405.mask) | yymsp[0].minor.yy405.value; } +#line 2116 "parse.c" + break; + case 67: +#line 292 "parse.y" +{ yygotominor.yy405.value = 0; yygotominor.yy405.mask = 0x000000; } +#line 2121 "parse.c" + break; + case 68: +#line 293 "parse.y" +{ yygotominor.yy405.value = yymsp[0].minor.yy46; yygotominor.yy405.mask = 0x0000ff; } +#line 2126 "parse.c" + break; + case 69: +#line 294 "parse.y" +{ yygotominor.yy405.value = yymsp[0].minor.yy46<<8; yygotominor.yy405.mask = 0x00ff00; } +#line 2131 "parse.c" + break; + case 70: +#line 295 "parse.y" +{ yygotominor.yy405.value = yymsp[0].minor.yy46<<16; yygotominor.yy405.mask = 0xff0000; } +#line 2136 "parse.c" + break; + case 71: +#line 297 "parse.y" +{ yygotominor.yy46 = OE_SetNull; } +#line 2141 "parse.c" + break; + case 72: +#line 298 "parse.y" +{ yygotominor.yy46 = OE_SetDflt; } +#line 2146 "parse.c" + break; + case 73: +#line 299 "parse.y" +{ yygotominor.yy46 = OE_Cascade; } +#line 2151 "parse.c" + break; + case 74: +#line 300 "parse.y" +{ yygotominor.yy46 = OE_Restrict; } +#line 2156 "parse.c" + break; + case 75: + case 76: + case 91: + case 93: + case 95: + case 96: + case 168: +#line 302 "parse.y" +{yygotominor.yy46 = yymsp[0].minor.yy46;} +#line 2167 "parse.c" + break; + case 80: +#line 312 "parse.y" +{yygotominor.yy410.n = 0; yygotominor.yy410.z = 0;} +#line 2172 "parse.c" + break; + case 81: +#line 313 "parse.y" +{yygotominor.yy410 = yymsp[-1].minor.yy0;} +#line 2177 "parse.c" + break; + case 86: +#line 319 "parse.y" +{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy174,yymsp[0].minor.yy46,yymsp[-2].minor.yy46,0);} +#line 2182 "parse.c" + break; + case 87: +#line 321 "parse.y" +{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy174,yymsp[0].minor.yy46,0,0,0,0);} +#line 2187 "parse.c" + break; + case 88: +#line 322 "parse.y" +{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy172);} +#line 2192 "parse.c" + break; + case 89: +#line 324 "parse.y" +{ + sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy174, &yymsp[-3].minor.yy410, yymsp[-2].minor.yy174, yymsp[-1].minor.yy46); + sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy46); +} +#line 2200 "parse.c" + break; + case 92: + case 94: +#line 338 "parse.y" +{yygotominor.yy46 = OE_Default;} +#line 2206 "parse.c" + break; + case 97: +#line 343 "parse.y" +{yygotominor.yy46 = OE_Ignore;} +#line 2211 "parse.c" + break; + case 98: + case 169: +#line 344 "parse.y" +{yygotominor.yy46 = OE_Replace;} +#line 2217 "parse.c" + break; + case 99: +#line 348 "parse.y" +{ + sqlite3DropTable(pParse, yymsp[0].minor.yy373, 0, yymsp[-1].minor.yy46); +} +#line 2224 "parse.c" + break; + case 102: +#line 358 "parse.y" +{ + sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy410, &yymsp[-2].minor.yy410, yymsp[0].minor.yy219, yymsp[-6].minor.yy46, yymsp[-4].minor.yy46); +} +#line 2231 "parse.c" + break; + case 103: +#line 361 "parse.y" +{ + sqlite3DropTable(pParse, yymsp[0].minor.yy373, 1, yymsp[-1].minor.yy46); +} +#line 2238 "parse.c" + break; + case 104: +#line 368 "parse.y" +{ + sqlite3Select(pParse, yymsp[0].minor.yy219, SRT_Callback, 0, 0, 0, 0, 0); + sqlite3SelectDelete(yymsp[0].minor.yy219); +} +#line 2246 "parse.c" + break; + case 105: + case 128: +#line 378 "parse.y" +{yygotominor.yy219 = yymsp[0].minor.yy219;} +#line 2252 "parse.c" + break; + case 106: +#line 380 "parse.y" +{ + if( yymsp[0].minor.yy219 ){ + yymsp[0].minor.yy219->op = yymsp[-1].minor.yy46; + yymsp[0].minor.yy219->pPrior = yymsp[-2].minor.yy219; + } + yygotominor.yy219 = yymsp[0].minor.yy219; +} +#line 2263 "parse.c" + break; + case 108: +#line 389 "parse.y" +{yygotominor.yy46 = TK_ALL;} +#line 2268 "parse.c" + break; + case 110: +#line 393 "parse.y" +{ + yygotominor.yy219 = sqlite3SelectNew(yymsp[-6].minor.yy174,yymsp[-5].minor.yy373,yymsp[-4].minor.yy172,yymsp[-3].minor.yy174,yymsp[-2].minor.yy172,yymsp[-1].minor.yy174,yymsp[-7].minor.yy46,yymsp[0].minor.yy234.pLimit,yymsp[0].minor.yy234.pOffset); +} +#line 2275 "parse.c" + break; + case 114: + case 238: +#line 414 "parse.y" +{yygotominor.yy174 = yymsp[-1].minor.yy174;} +#line 2281 "parse.c" + break; + case 115: + case 141: + case 151: + case 237: +#line 415 "parse.y" +{yygotominor.yy174 = 0;} +#line 2289 "parse.c" + break; + case 116: +#line 416 "parse.y" +{ + yygotominor.yy174 = sqlite3ExprListAppend(yymsp[-2].minor.yy174,yymsp[-1].minor.yy172,yymsp[0].minor.yy410.n?&yymsp[0].minor.yy410:0); +} +#line 2296 "parse.c" + break; + case 117: +#line 419 "parse.y" +{ + yygotominor.yy174 = sqlite3ExprListAppend(yymsp[-1].minor.yy174, sqlite3Expr(TK_ALL, 0, 0, 0), 0); +} +#line 2303 "parse.c" + break; + case 118: +#line 422 "parse.y" +{ + Expr *pRight = sqlite3Expr(TK_ALL, 0, 0, 0); + Expr *pLeft = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy410); + yygotominor.yy174 = sqlite3ExprListAppend(yymsp[-3].minor.yy174, sqlite3Expr(TK_DOT, pLeft, pRight, 0), 0); +} +#line 2312 "parse.c" + break; + case 121: +#line 434 "parse.y" +{yygotominor.yy410.n = 0;} +#line 2317 "parse.c" + break; + case 122: +#line 446 "parse.y" +{yygotominor.yy373 = sqliteMalloc(sizeof(*yygotominor.yy373));} +#line 2322 "parse.c" + break; + case 123: +#line 447 "parse.y" +{yygotominor.yy373 = yymsp[0].minor.yy373;} +#line 2327 "parse.c" + break; + case 124: +#line 452 "parse.y" +{ + yygotominor.yy373 = yymsp[-1].minor.yy373; + if( yygotominor.yy373 && yygotominor.yy373->nSrc>0 ) yygotominor.yy373->a[yygotominor.yy373->nSrc-1].jointype = yymsp[0].minor.yy46; +} +#line 2335 "parse.c" + break; + case 125: +#line 456 "parse.y" +{yygotominor.yy373 = 0;} +#line 2340 "parse.c" + break; + case 126: +#line 457 "parse.y" +{ + yygotominor.yy373 = sqlite3SrcListAppend(yymsp[-5].minor.yy373,&yymsp[-4].minor.yy410,&yymsp[-3].minor.yy410); + if( yymsp[-2].minor.yy410.n ) sqlite3SrcListAddAlias(yygotominor.yy373,&yymsp[-2].minor.yy410); + if( yymsp[-1].minor.yy172 ){ + if( yygotominor.yy373 && yygotominor.yy373->nSrc>1 ){ yygotominor.yy373->a[yygotominor.yy373->nSrc-2].pOn = yymsp[-1].minor.yy172; } + else { sqlite3ExprDelete(yymsp[-1].minor.yy172); } + } + if( yymsp[0].minor.yy432 ){ + if( yygotominor.yy373 && yygotominor.yy373->nSrc>1 ){ yygotominor.yy373->a[yygotominor.yy373->nSrc-2].pUsing = yymsp[0].minor.yy432; } + else { sqlite3IdListDelete(yymsp[0].minor.yy432); } + } +} +#line 2356 "parse.c" + break; + case 127: +#line 471 "parse.y" +{ + yygotominor.yy373 = sqlite3SrcListAppend(yymsp[-6].minor.yy373,0,0); + if( yygotominor.yy373 && yygotominor.yy373->nSrc>0 ) yygotominor.yy373->a[yygotominor.yy373->nSrc-1].pSelect = yymsp[-4].minor.yy219; + if( yymsp[-2].minor.yy410.n ) sqlite3SrcListAddAlias(yygotominor.yy373,&yymsp[-2].minor.yy410); + if( yymsp[-1].minor.yy172 ){ + if( yygotominor.yy373 && yygotominor.yy373->nSrc>1 ){ yygotominor.yy373->a[yygotominor.yy373->nSrc-2].pOn = yymsp[-1].minor.yy172; } + else { sqlite3ExprDelete(yymsp[-1].minor.yy172); } + } + if( yymsp[0].minor.yy432 ){ + if( yygotominor.yy373 && yygotominor.yy373->nSrc>1 ){ yygotominor.yy373->a[yygotominor.yy373->nSrc-2].pUsing = yymsp[0].minor.yy432; } + else { sqlite3IdListDelete(yymsp[0].minor.yy432); } + } + } +#line 2373 "parse.c" + break; + case 129: +#line 492 "parse.y" +{ + yygotominor.yy219 = sqlite3SelectNew(0,yymsp[0].minor.yy373,0,0,0,0,0,0,0); + } +#line 2380 "parse.c" + break; + case 130: +#line 498 "parse.y" +{yygotominor.yy410.z=0; yygotominor.yy410.n=0;} +#line 2385 "parse.c" + break; + case 132: +#line 503 "parse.y" +{yygotominor.yy373 = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy410);} +#line 2390 "parse.c" + break; + case 133: +#line 507 "parse.y" +{ yygotominor.yy46 = JT_INNER; } +#line 2395 "parse.c" + break; + case 134: +#line 508 "parse.y" +{ yygotominor.yy46 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); } +#line 2400 "parse.c" + break; + case 135: +#line 509 "parse.y" +{ yygotominor.yy46 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy410,0); } +#line 2405 "parse.c" + break; + case 136: +#line 511 "parse.y" +{ yygotominor.yy46 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy410,&yymsp[-1].minor.yy410); } +#line 2410 "parse.c" + break; + case 137: + case 145: + case 154: + case 161: + case 176: + case 203: + case 226: + case 228: + case 232: +#line 515 "parse.y" +{yygotominor.yy172 = yymsp[0].minor.yy172;} +#line 2423 "parse.c" + break; + case 138: + case 153: + case 160: + case 204: + case 227: + case 229: + case 233: +#line 516 "parse.y" +{yygotominor.yy172 = 0;} +#line 2434 "parse.c" + break; + case 139: + case 173: +#line 520 "parse.y" +{yygotominor.yy432 = yymsp[-1].minor.yy432;} +#line 2440 "parse.c" + break; + case 140: + case 172: +#line 521 "parse.y" +{yygotominor.yy432 = 0;} +#line 2446 "parse.c" + break; + case 142: + case 152: +#line 532 "parse.y" +{yygotominor.yy174 = yymsp[0].minor.yy174;} +#line 2452 "parse.c" + break; + case 143: +#line 533 "parse.y" +{ + yygotominor.yy174 = sqlite3ExprListAppend(yymsp[-4].minor.yy174,yymsp[-2].minor.yy172,yymsp[-1].minor.yy410.n>0?&yymsp[-1].minor.yy410:0); + if( yygotominor.yy174 ) yygotominor.yy174->a[yygotominor.yy174->nExpr-1].sortOrder = yymsp[0].minor.yy46; +} +#line 2460 "parse.c" + break; + case 144: +#line 537 "parse.y" +{ + yygotominor.yy174 = sqlite3ExprListAppend(0,yymsp[-2].minor.yy172,yymsp[-1].minor.yy410.n>0?&yymsp[-1].minor.yy410:0); + if( yygotominor.yy174 && yygotominor.yy174->a ) yygotominor.yy174->a[0].sortOrder = yymsp[0].minor.yy46; +} +#line 2468 "parse.c" + break; + case 146: + case 148: +#line 546 "parse.y" +{yygotominor.yy46 = SQLITE_SO_ASC;} +#line 2474 "parse.c" + break; + case 147: +#line 547 "parse.y" +{yygotominor.yy46 = SQLITE_SO_DESC;} +#line 2479 "parse.c" + break; + case 149: +#line 549 "parse.y" +{yygotominor.yy410.z = 0; yygotominor.yy410.n = 0;} +#line 2484 "parse.c" + break; + case 155: +#line 567 "parse.y" +{yygotominor.yy234.pLimit = 0; yygotominor.yy234.pOffset = 0;} +#line 2489 "parse.c" + break; + case 156: +#line 568 "parse.y" +{yygotominor.yy234.pLimit = yymsp[0].minor.yy172; yygotominor.yy234.pOffset = 0;} +#line 2494 "parse.c" + break; + case 157: +#line 570 "parse.y" +{yygotominor.yy234.pLimit = yymsp[-2].minor.yy172; yygotominor.yy234.pOffset = yymsp[0].minor.yy172;} +#line 2499 "parse.c" + break; + case 158: +#line 572 "parse.y" +{yygotominor.yy234.pOffset = yymsp[-2].minor.yy172; yygotominor.yy234.pLimit = yymsp[0].minor.yy172;} +#line 2504 "parse.c" + break; + case 159: +#line 576 "parse.y" +{sqlite3DeleteFrom(pParse,yymsp[-1].minor.yy373,yymsp[0].minor.yy172);} +#line 2509 "parse.c" + break; + case 162: +#line 587 "parse.y" +{sqlite3Update(pParse,yymsp[-3].minor.yy373,yymsp[-1].minor.yy174,yymsp[0].minor.yy172,yymsp[-4].minor.yy46);} +#line 2514 "parse.c" + break; + case 163: +#line 593 "parse.y" +{yygotominor.yy174 = sqlite3ExprListAppend(yymsp[-4].minor.yy174,yymsp[0].minor.yy172,&yymsp[-2].minor.yy410);} +#line 2519 "parse.c" + break; + case 164: +#line 594 "parse.y" +{yygotominor.yy174 = sqlite3ExprListAppend(0,yymsp[0].minor.yy172,&yymsp[-2].minor.yy410);} +#line 2524 "parse.c" + break; + case 165: +#line 600 "parse.y" +{sqlite3Insert(pParse, yymsp[-5].minor.yy373, yymsp[-1].minor.yy174, 0, yymsp[-4].minor.yy432, yymsp[-7].minor.yy46);} +#line 2529 "parse.c" + break; + case 166: +#line 602 "parse.y" +{sqlite3Insert(pParse, yymsp[-2].minor.yy373, 0, yymsp[0].minor.yy219, yymsp[-1].minor.yy432, yymsp[-4].minor.yy46);} +#line 2534 "parse.c" + break; + case 167: +#line 604 "parse.y" +{sqlite3Insert(pParse, yymsp[-3].minor.yy373, 0, 0, yymsp[-2].minor.yy432, yymsp[-5].minor.yy46);} +#line 2539 "parse.c" + break; + case 170: + case 230: +#line 614 "parse.y" +{yygotominor.yy174 = sqlite3ExprListAppend(yymsp[-2].minor.yy174,yymsp[0].minor.yy172,0);} +#line 2545 "parse.c" + break; + case 171: + case 231: +#line 615 "parse.y" +{yygotominor.yy174 = sqlite3ExprListAppend(0,yymsp[0].minor.yy172,0);} +#line 2551 "parse.c" + break; + case 174: +#line 624 "parse.y" +{yygotominor.yy432 = sqlite3IdListAppend(yymsp[-2].minor.yy432,&yymsp[0].minor.yy410);} +#line 2556 "parse.c" + break; + case 175: +#line 625 "parse.y" +{yygotominor.yy432 = sqlite3IdListAppend(0,&yymsp[0].minor.yy410);} +#line 2561 "parse.c" + break; + case 177: +#line 636 "parse.y" +{yygotominor.yy172 = yymsp[-1].minor.yy172; sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); } +#line 2566 "parse.c" + break; + case 178: + case 183: + case 184: +#line 637 "parse.y" +{yygotominor.yy172 = sqlite3Expr(yymsp[0].major, 0, 0, &yymsp[0].minor.yy0);} +#line 2573 "parse.c" + break; + case 179: + case 180: +#line 638 "parse.y" +{yygotominor.yy172 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy0);} +#line 2579 "parse.c" + break; + case 181: +#line 640 "parse.y" +{ + Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy410); + Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy410); + yygotominor.yy172 = sqlite3Expr(TK_DOT, temp1, temp2, 0); +} +#line 2588 "parse.c" + break; + case 182: +#line 645 "parse.y" +{ + Expr *temp1 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-4].minor.yy410); + Expr *temp2 = sqlite3Expr(TK_ID, 0, 0, &yymsp[-2].minor.yy410); + Expr *temp3 = sqlite3Expr(TK_ID, 0, 0, &yymsp[0].minor.yy410); + Expr *temp4 = sqlite3Expr(TK_DOT, temp2, temp3, 0); + yygotominor.yy172 = sqlite3Expr(TK_DOT, temp1, temp4, 0); +} +#line 2599 "parse.c" + break; + case 185: +#line 654 "parse.y" +{yygotominor.yy172 = sqlite3RegisterExpr(pParse, &yymsp[0].minor.yy0);} +#line 2604 "parse.c" + break; + case 186: +#line 655 "parse.y" +{ + Token *pToken = &yymsp[0].minor.yy0; + Expr *pExpr = yygotominor.yy172 = sqlite3Expr(TK_VARIABLE, 0, 0, pToken); + sqlite3ExprAssignVarNumber(pParse, pExpr); +} +#line 2613 "parse.c" + break; + case 187: +#line 661 "parse.y" +{ + yygotominor.yy172 = sqlite3Expr(TK_CAST, yymsp[-3].minor.yy172, 0, &yymsp[-1].minor.yy410); + sqlite3ExprSpan(yygotominor.yy172,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); +} +#line 2621 "parse.c" + break; + case 188: +#line 666 "parse.y" +{ + yygotominor.yy172 = sqlite3ExprFunction(yymsp[-1].minor.yy174, &yymsp[-4].minor.yy0); + sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); + if( yymsp[-2].minor.yy46 && yygotominor.yy172 ){ + yygotominor.yy172->flags |= EP_Distinct; + } +} +#line 2632 "parse.c" + break; + case 189: +#line 673 "parse.y" +{ + yygotominor.yy172 = sqlite3ExprFunction(0, &yymsp[-3].minor.yy0); + sqlite3ExprSpan(yygotominor.yy172,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); +} +#line 2640 "parse.c" + break; + case 190: +#line 677 "parse.y" +{ + /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are + ** treated as functions that return constants */ + yygotominor.yy172 = sqlite3ExprFunction(0,&yymsp[0].minor.yy0); + if( yygotominor.yy172 ){ + yygotominor.yy172->op = TK_CONST_FUNC; + yygotominor.yy172->span = yymsp[0].minor.yy0; + } +} +#line 2653 "parse.c" + break; + case 191: + case 192: + case 193: + case 194: + case 195: + case 196: + case 197: + case 198: +#line 686 "parse.y" +{yygotominor.yy172 = sqlite3Expr(yymsp[-1].major, yymsp[-2].minor.yy172, yymsp[0].minor.yy172, 0);} +#line 2665 "parse.c" + break; + case 199: + case 201: +#line 696 "parse.y" +{yygotominor.yy72.eOperator = yymsp[0].minor.yy0; yygotominor.yy72.not = 0;} +#line 2671 "parse.c" + break; + case 200: + case 202: +#line 697 "parse.y" +{yygotominor.yy72.eOperator = yymsp[0].minor.yy0; yygotominor.yy72.not = 1;} +#line 2677 "parse.c" + break; + case 205: +#line 704 "parse.y" +{ + ExprList *pList; + pList = sqlite3ExprListAppend(0, yymsp[-1].minor.yy172, 0); + pList = sqlite3ExprListAppend(pList, yymsp[-3].minor.yy172, 0); + if( yymsp[0].minor.yy172 ){ + pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy172, 0); + } + yygotominor.yy172 = sqlite3ExprFunction(pList, &yymsp[-2].minor.yy72.eOperator); + if( yymsp[-2].minor.yy72.not ) yygotominor.yy172 = sqlite3Expr(TK_NOT, yygotominor.yy172, 0, 0); + sqlite3ExprSpan(yygotominor.yy172, &yymsp[-3].minor.yy172->span, &yymsp[-1].minor.yy172->span); + if( yygotominor.yy172 ) yygotominor.yy172->flags |= EP_InfixFunc; +} +#line 2693 "parse.c" + break; + case 206: +#line 717 "parse.y" +{ + yygotominor.yy172 = sqlite3Expr(yymsp[0].major, yymsp[-1].minor.yy172, 0, 0); + sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy172->span,&yymsp[0].minor.yy0); +} +#line 2701 "parse.c" + break; + case 207: +#line 721 "parse.y" +{ + yygotominor.yy172 = sqlite3Expr(TK_ISNULL, yymsp[-2].minor.yy172, 0, 0); + sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy172->span,&yymsp[0].minor.yy0); +} +#line 2709 "parse.c" + break; + case 208: +#line 725 "parse.y" +{ + yygotominor.yy172 = sqlite3Expr(TK_NOTNULL, yymsp[-2].minor.yy172, 0, 0); + sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy172->span,&yymsp[0].minor.yy0); +} +#line 2717 "parse.c" + break; + case 209: +#line 729 "parse.y" +{ + yygotominor.yy172 = sqlite3Expr(TK_NOTNULL, yymsp[-3].minor.yy172, 0, 0); + sqlite3ExprSpan(yygotominor.yy172,&yymsp[-3].minor.yy172->span,&yymsp[0].minor.yy0); +} +#line 2725 "parse.c" + break; + case 210: +#line 733 "parse.y" +{ + yygotominor.yy172 = sqlite3Expr(yymsp[-1].major, yymsp[0].minor.yy172, 0, 0); + sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy172->span); +} +#line 2733 "parse.c" + break; + case 211: +#line 737 "parse.y" +{ + yygotominor.yy172 = sqlite3Expr(TK_UMINUS, yymsp[0].minor.yy172, 0, 0); + sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy172->span); +} +#line 2741 "parse.c" + break; + case 212: +#line 741 "parse.y" +{ + yygotominor.yy172 = sqlite3Expr(TK_UPLUS, yymsp[0].minor.yy172, 0, 0); + sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy172->span); +} +#line 2749 "parse.c" + break; + case 215: +#line 748 "parse.y" +{ + ExprList *pList = sqlite3ExprListAppend(0, yymsp[-2].minor.yy172, 0); + pList = sqlite3ExprListAppend(pList, yymsp[0].minor.yy172, 0); + yygotominor.yy172 = sqlite3Expr(TK_BETWEEN, yymsp[-4].minor.yy172, 0, 0); + if( yygotominor.yy172 ){ + yygotominor.yy172->pList = pList; + }else{ + sqlite3ExprListDelete(pList); + } + if( yymsp[-3].minor.yy46 ) yygotominor.yy172 = sqlite3Expr(TK_NOT, yygotominor.yy172, 0, 0); + sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy172->span,&yymsp[0].minor.yy172->span); +} +#line 2765 "parse.c" + break; + case 218: +#line 764 "parse.y" +{ + yygotominor.yy172 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy172, 0, 0); + if( yygotominor.yy172 ){ + yygotominor.yy172->pList = yymsp[-1].minor.yy174; + }else{ + sqlite3ExprListDelete(yymsp[-1].minor.yy174); + } + if( yymsp[-3].minor.yy46 ) yygotominor.yy172 = sqlite3Expr(TK_NOT, yygotominor.yy172, 0, 0); + sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy172->span,&yymsp[0].minor.yy0); + } +#line 2779 "parse.c" + break; + case 219: +#line 774 "parse.y" +{ + yygotominor.yy172 = sqlite3Expr(TK_SELECT, 0, 0, 0); + if( yygotominor.yy172 ){ + yygotominor.yy172->pSelect = yymsp[-1].minor.yy219; + }else{ + sqlite3SelectDelete(yymsp[-1].minor.yy219); + } + sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); + } +#line 2792 "parse.c" + break; + case 220: +#line 783 "parse.y" +{ + yygotominor.yy172 = sqlite3Expr(TK_IN, yymsp[-4].minor.yy172, 0, 0); + if( yygotominor.yy172 ){ + yygotominor.yy172->pSelect = yymsp[-1].minor.yy219; + }else{ + sqlite3SelectDelete(yymsp[-1].minor.yy219); + } + if( yymsp[-3].minor.yy46 ) yygotominor.yy172 = sqlite3Expr(TK_NOT, yygotominor.yy172, 0, 0); + sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy172->span,&yymsp[0].minor.yy0); + } +#line 2806 "parse.c" + break; + case 221: +#line 793 "parse.y" +{ + SrcList *pSrc = sqlite3SrcListAppend(0,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy410); + yygotominor.yy172 = sqlite3Expr(TK_IN, yymsp[-3].minor.yy172, 0, 0); + if( yygotominor.yy172 ){ + yygotominor.yy172->pSelect = sqlite3SelectNew(0,pSrc,0,0,0,0,0,0,0); + }else{ + sqlite3SrcListDelete(pSrc); + } + if( yymsp[-2].minor.yy46 ) yygotominor.yy172 = sqlite3Expr(TK_NOT, yygotominor.yy172, 0, 0); + sqlite3ExprSpan(yygotominor.yy172,&yymsp[-3].minor.yy172->span,yymsp[0].minor.yy410.z?&yymsp[0].minor.yy410:&yymsp[-1].minor.yy410); + } +#line 2821 "parse.c" + break; + case 222: +#line 804 "parse.y" +{ + Expr *p = yygotominor.yy172 = sqlite3Expr(TK_EXISTS, 0, 0, 0); + if( p ){ + p->pSelect = yymsp[-1].minor.yy219; + sqlite3ExprSpan(p,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); + }else{ + sqlite3SelectDelete(yymsp[-1].minor.yy219); + } + } +#line 2834 "parse.c" + break; + case 223: +#line 816 "parse.y" +{ + yygotominor.yy172 = sqlite3Expr(TK_CASE, yymsp[-3].minor.yy172, yymsp[-1].minor.yy172, 0); + if( yygotominor.yy172 ){ + yygotominor.yy172->pList = yymsp[-2].minor.yy174; + }else{ + sqlite3ExprListDelete(yymsp[-2].minor.yy174); + } + sqlite3ExprSpan(yygotominor.yy172, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0); +} +#line 2847 "parse.c" + break; + case 224: +#line 827 "parse.y" +{ + yygotominor.yy174 = sqlite3ExprListAppend(yymsp[-4].minor.yy174, yymsp[-2].minor.yy172, 0); + yygotominor.yy174 = sqlite3ExprListAppend(yygotominor.yy174, yymsp[0].minor.yy172, 0); +} +#line 2855 "parse.c" + break; + case 225: +#line 831 "parse.y" +{ + yygotominor.yy174 = sqlite3ExprListAppend(0, yymsp[-2].minor.yy172, 0); + yygotominor.yy174 = sqlite3ExprListAppend(yygotominor.yy174, yymsp[0].minor.yy172, 0); +} +#line 2863 "parse.c" + break; + case 234: +#line 858 "parse.y" +{ + sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy410, &yymsp[-5].minor.yy410, sqlite3SrcListAppend(0,&yymsp[-3].minor.yy410,0), yymsp[-1].minor.yy174, yymsp[-9].minor.yy46, + &yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, yymsp[-7].minor.yy46); +} +#line 2871 "parse.c" + break; + case 235: + case 280: +#line 864 "parse.y" +{yygotominor.yy46 = OE_Abort;} +#line 2877 "parse.c" + break; + case 236: +#line 865 "parse.y" +{yygotominor.yy46 = OE_None;} +#line 2882 "parse.c" + break; + case 239: +#line 875 "parse.y" +{ + Expr *p = 0; + if( yymsp[-1].minor.yy410.n>0 ){ + p = sqlite3Expr(TK_COLUMN, 0, 0, 0); + if( p ) p->pColl = sqlite3LocateCollSeq(pParse, (char*)yymsp[-1].minor.yy410.z, yymsp[-1].minor.yy410.n); + } + yygotominor.yy174 = sqlite3ExprListAppend(yymsp[-4].minor.yy174, p, &yymsp[-2].minor.yy410); + if( yygotominor.yy174 ) yygotominor.yy174->a[yygotominor.yy174->nExpr-1].sortOrder = yymsp[0].minor.yy46; +} +#line 2895 "parse.c" + break; + case 240: +#line 884 "parse.y" +{ + Expr *p = 0; + if( yymsp[-1].minor.yy410.n>0 ){ + p = sqlite3Expr(TK_COLUMN, 0, 0, 0); + if( p ) p->pColl = sqlite3LocateCollSeq(pParse, (char*)yymsp[-1].minor.yy410.z, yymsp[-1].minor.yy410.n); + } + yygotominor.yy174 = sqlite3ExprListAppend(0, p, &yymsp[-2].minor.yy410); + if( yygotominor.yy174 ) yygotominor.yy174->a[yygotominor.yy174->nExpr-1].sortOrder = yymsp[0].minor.yy46; +} +#line 2908 "parse.c" + break; + case 242: +#line 898 "parse.y" +{sqlite3DropIndex(pParse, yymsp[0].minor.yy373, yymsp[-1].minor.yy46);} +#line 2913 "parse.c" + break; + case 243: + case 244: +#line 903 "parse.y" +{sqlite3Vacuum(pParse);} +#line 2919 "parse.c" + break; + case 245: + case 247: +#line 910 "parse.y" +{sqlite3Pragma(pParse,&yymsp[-3].minor.yy410,&yymsp[-2].minor.yy410,&yymsp[0].minor.yy410,0);} +#line 2925 "parse.c" + break; + case 246: +#line 911 "parse.y" +{sqlite3Pragma(pParse,&yymsp[-3].minor.yy410,&yymsp[-2].minor.yy410,&yymsp[0].minor.yy0,0);} +#line 2930 "parse.c" + break; + case 248: +#line 913 "parse.y" +{ + sqlite3Pragma(pParse,&yymsp[-3].minor.yy410,&yymsp[-2].minor.yy410,&yymsp[0].minor.yy410,1); +} +#line 2937 "parse.c" + break; + case 249: +#line 916 "parse.y" +{sqlite3Pragma(pParse,&yymsp[-4].minor.yy410,&yymsp[-3].minor.yy410,&yymsp[-1].minor.yy410,0);} +#line 2942 "parse.c" + break; + case 250: +#line 917 "parse.y" +{sqlite3Pragma(pParse,&yymsp[-1].minor.yy410,&yymsp[0].minor.yy410,0,0);} +#line 2947 "parse.c" + break; + case 256: +#line 929 "parse.y" +{ + Token all; + all.z = yymsp[-3].minor.yy410.z; + all.n = (yymsp[0].minor.yy0.z - yymsp[-3].minor.yy410.z) + yymsp[0].minor.yy0.n; + sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy243, &all); +} +#line 2957 "parse.c" + break; + case 257: +#line 938 "parse.y" +{ + sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy410, &yymsp[-6].minor.yy410, yymsp[-5].minor.yy46, yymsp[-4].minor.yy370.a, yymsp[-4].minor.yy370.b, yymsp[-2].minor.yy373, yymsp[-1].minor.yy46, yymsp[0].minor.yy172, yymsp[-10].minor.yy46, yymsp[-8].minor.yy46); + yygotominor.yy410 = (yymsp[-6].minor.yy410.n==0?yymsp[-7].minor.yy410:yymsp[-6].minor.yy410); +} +#line 2965 "parse.c" + break; + case 258: + case 261: +#line 944 "parse.y" +{ yygotominor.yy46 = TK_BEFORE; } +#line 2971 "parse.c" + break; + case 259: +#line 945 "parse.y" +{ yygotominor.yy46 = TK_AFTER; } +#line 2976 "parse.c" + break; + case 260: +#line 946 "parse.y" +{ yygotominor.yy46 = TK_INSTEAD;} +#line 2981 "parse.c" + break; + case 262: + case 263: +#line 951 "parse.y" +{yygotominor.yy370.a = yymsp[0].major; yygotominor.yy370.b = 0;} +#line 2987 "parse.c" + break; + case 264: +#line 953 "parse.y" +{yygotominor.yy370.a = TK_UPDATE; yygotominor.yy370.b = yymsp[0].minor.yy432;} +#line 2992 "parse.c" + break; + case 265: + case 266: +#line 956 "parse.y" +{ yygotominor.yy46 = TK_ROW; } +#line 2998 "parse.c" + break; + case 267: +#line 958 "parse.y" +{ yygotominor.yy46 = TK_STATEMENT; } +#line 3003 "parse.c" + break; + case 268: +#line 962 "parse.y" +{ yygotominor.yy172 = 0; } +#line 3008 "parse.c" + break; + case 269: +#line 963 "parse.y" +{ yygotominor.yy172 = yymsp[0].minor.yy172; } +#line 3013 "parse.c" + break; + case 270: +#line 967 "parse.y" +{ + if( yymsp[-2].minor.yy243 ){ + yymsp[-2].minor.yy243->pLast->pNext = yymsp[-1].minor.yy243; + }else{ + yymsp[-2].minor.yy243 = yymsp[-1].minor.yy243; + } + yymsp[-2].minor.yy243->pLast = yymsp[-1].minor.yy243; + yygotominor.yy243 = yymsp[-2].minor.yy243; +} +#line 3026 "parse.c" + break; + case 271: +#line 976 "parse.y" +{ yygotominor.yy243 = 0; } +#line 3031 "parse.c" + break; + case 272: +#line 982 "parse.y" +{ yygotominor.yy243 = sqlite3TriggerUpdateStep(&yymsp[-3].minor.yy410, yymsp[-1].minor.yy174, yymsp[0].minor.yy172, yymsp[-4].minor.yy46); } +#line 3036 "parse.c" + break; + case 273: +#line 987 "parse.y" +{yygotominor.yy243 = sqlite3TriggerInsertStep(&yymsp[-5].minor.yy410, yymsp[-4].minor.yy432, yymsp[-1].minor.yy174, 0, yymsp[-7].minor.yy46);} +#line 3041 "parse.c" + break; + case 274: +#line 990 "parse.y" +{yygotominor.yy243 = sqlite3TriggerInsertStep(&yymsp[-2].minor.yy410, yymsp[-1].minor.yy432, 0, yymsp[0].minor.yy219, yymsp[-4].minor.yy46);} +#line 3046 "parse.c" + break; + case 275: +#line 994 "parse.y" +{yygotominor.yy243 = sqlite3TriggerDeleteStep(&yymsp[-1].minor.yy410, yymsp[0].minor.yy172);} +#line 3051 "parse.c" + break; + case 276: +#line 997 "parse.y" +{yygotominor.yy243 = sqlite3TriggerSelectStep(yymsp[0].minor.yy219); } +#line 3056 "parse.c" + break; + case 277: +#line 1000 "parse.y" +{ + yygotominor.yy172 = sqlite3Expr(TK_RAISE, 0, 0, 0); + if( yygotominor.yy172 ){ + yygotominor.yy172->iColumn = OE_Ignore; + sqlite3ExprSpan(yygotominor.yy172, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0); + } +} +#line 3067 "parse.c" + break; + case 278: +#line 1007 "parse.y" +{ + yygotominor.yy172 = sqlite3Expr(TK_RAISE, 0, 0, &yymsp[-1].minor.yy410); + if( yygotominor.yy172 ) { + yygotominor.yy172->iColumn = yymsp[-3].minor.yy46; + sqlite3ExprSpan(yygotominor.yy172, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0); + } +} +#line 3078 "parse.c" + break; + case 279: +#line 1017 "parse.y" +{yygotominor.yy46 = OE_Rollback;} +#line 3083 "parse.c" + break; + case 281: +#line 1019 "parse.y" +{yygotominor.yy46 = OE_Fail;} +#line 3088 "parse.c" + break; + case 282: +#line 1024 "parse.y" +{ + sqlite3DropTrigger(pParse,yymsp[0].minor.yy373,yymsp[-1].minor.yy46); +} +#line 3095 "parse.c" + break; + case 283: +#line 1030 "parse.y" +{ + sqlite3Attach(pParse, yymsp[-3].minor.yy172, yymsp[-1].minor.yy172, yymsp[0].minor.yy386); +} +#line 3102 "parse.c" + break; + case 284: +#line 1035 "parse.y" +{ yygotominor.yy386 = 0; } +#line 3107 "parse.c" + break; + case 285: +#line 1036 "parse.y" +{ yygotominor.yy386 = yymsp[0].minor.yy172; } +#line 3112 "parse.c" + break; + case 288: +#line 1042 "parse.y" +{ + sqlite3Detach(pParse, yymsp[0].minor.yy172); +} +#line 3119 "parse.c" + break; + case 289: +#line 1048 "parse.y" +{sqlite3Reindex(pParse, 0, 0);} +#line 3124 "parse.c" + break; + case 290: +#line 1049 "parse.y" +{sqlite3Reindex(pParse, &yymsp[-1].minor.yy410, &yymsp[0].minor.yy410);} +#line 3129 "parse.c" + break; + case 291: +#line 1054 "parse.y" +{sqlite3Analyze(pParse, 0, 0);} +#line 3134 "parse.c" + break; + case 292: +#line 1055 "parse.y" +{sqlite3Analyze(pParse, &yymsp[-1].minor.yy410, &yymsp[0].minor.yy410);} +#line 3139 "parse.c" + break; + case 293: +#line 1060 "parse.y" +{ + sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy373,&yymsp[0].minor.yy410); +} +#line 3146 "parse.c" + break; + case 294: +#line 1063 "parse.y" +{ + sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy410); +} +#line 3153 "parse.c" + break; + case 295: +#line 1066 "parse.y" +{ + sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy373); +} +#line 3160 "parse.c" + break; + case 298: +#line 1075 "parse.y" +{sqlite3VtabFinishParse(pParse,0);} +#line 3165 "parse.c" + break; + case 299: +#line 1076 "parse.y" +{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} +#line 3170 "parse.c" + break; + case 300: +#line 1077 "parse.y" +{ + sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy410, &yymsp[-2].minor.yy410, &yymsp[0].minor.yy410); +} +#line 3177 "parse.c" + break; + case 303: +#line 1082 "parse.y" +{sqlite3VtabArgInit(pParse);} +#line 3182 "parse.c" + break; + case 305: + case 306: + case 307: + case 309: +#line 1084 "parse.y" +{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} +#line 3190 "parse.c" + break; + }; + yygoto = yyRuleInfo[yyruleno].lhs; + yysize = yyRuleInfo[yyruleno].nrhs; + yypParser->yyidx -= yysize; + yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto); + if( yyact < YYNSTATE ){ +#ifdef NDEBUG + /* If we are not debugging and the reduce action popped at least + ** one element off the stack, then we can push the new element back + ** onto the stack here, and skip the stack overflow test in yy_shift(). + ** That gives a significant speed improvement. */ + if( yysize ){ + yypParser->yyidx++; + yymsp -= yysize-1; + yymsp->stateno = yyact; + yymsp->major = yygoto; + yymsp->minor = yygotominor; + }else +#endif + { + yy_shift(yypParser,yyact,yygoto,&yygotominor); + } + }else if( yyact == YYNSTATE + YYNRULE + 1 ){ + yy_accept(yypParser); + } +} + +/* +** The following code executes when the parse fails +*/ +static void yy_parse_failed( + yyParser *yypParser /* The parser */ +){ + sqlite3ParserARG_FETCH; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); + } +#endif + while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will be executed whenever the + ** parser fails */ + sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* +** The following code executes when a syntax error first occurs. +*/ +static void yy_syntax_error( + yyParser *yypParser, /* The parser */ + int yymajor, /* The major type of the error token */ + YYMINORTYPE yyminor /* The minor type of the error token */ +){ + sqlite3ParserARG_FETCH; +#define TOKEN (yyminor.yy0) +#line 34 "parse.y" + + if( !pParse->parseError ){ + if( TOKEN.z[0] ){ + sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN); + }else{ + sqlite3ErrorMsg(pParse, "incomplete SQL statement"); + } + pParse->parseError = 1; + } +#line 3258 "parse.c" + sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* +** The following is executed when the parser accepts +*/ +static void yy_accept( + yyParser *yypParser /* The parser */ +){ + sqlite3ParserARG_FETCH; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); + } +#endif + while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); + /* Here code is inserted which will be executed whenever the + ** parser accepts */ + sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ +} + +/* The main parser program. +** The first argument is a pointer to a structure obtained from +** "sqlite3ParserAlloc" which describes the current state of the parser. +** The second argument is the major token number. The third is +** the minor token. The fourth optional argument is whatever the +** user wants (and specified in the grammar) and is available for +** use by the action routines. +** +** Inputs: +**
    +**
  • A pointer to the parser (an opaque structure.) +**
  • The major token number. +**
  • The minor token number. +**
  • An option argument of a grammar-specified type. +**
+** +** Outputs: +** None. +*/ +void sqlite3Parser( + void *yyp, /* The parser */ + int yymajor, /* The major token code number */ + sqlite3ParserTOKENTYPE yyminor /* The value for the token */ + sqlite3ParserARG_PDECL /* Optional %extra_argument parameter */ +){ + YYMINORTYPE yyminorunion; + int yyact; /* The parser action. */ + int yyendofinput; /* True if we are at the end of input */ + int yyerrorhit = 0; /* True if yymajor has invoked an error */ + yyParser *yypParser; /* The parser */ + + /* (re)initialize the parser, if necessary */ + yypParser = (yyParser*)yyp; + if( yypParser->yyidx<0 ){ + /* if( yymajor==0 ) return; // not sure why this was here... */ + yypParser->yyidx = 0; + yypParser->yyerrcnt = -1; + yypParser->yystack[0].stateno = 0; + yypParser->yystack[0].major = 0; + } + yyminorunion.yy0 = yyminor; + yyendofinput = (yymajor==0); + sqlite3ParserARG_STORE; + +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); + } +#endif + + do{ + yyact = yy_find_shift_action(yypParser,yymajor); + if( yyactyyerrcnt--; + if( yyendofinput && yypParser->yyidx>=0 ){ + yymajor = 0; + }else{ + yymajor = YYNOCODE; + } + }else if( yyact < YYNSTATE + YYNRULE ){ + yy_reduce(yypParser,yyact-YYNSTATE); + }else if( yyact == YY_ERROR_ACTION ){ + int yymx; +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); + } +#endif +#ifdef YYERRORSYMBOL + /* A syntax error has occurred. + ** The response to an error depends upon whether or not the + ** grammar defines an error token "ERROR". + ** + ** This is what we do if the grammar does define ERROR: + ** + ** * Call the %syntax_error function. + ** + ** * Begin popping the stack until we enter a state where + ** it is legal to shift the error symbol, then shift + ** the error symbol. + ** + ** * Set the error count to three. + ** + ** * Begin accepting and shifting new tokens. No new error + ** processing will occur until three tokens have been + ** shifted successfully. + ** + */ + if( yypParser->yyerrcnt<0 ){ + yy_syntax_error(yypParser,yymajor,yyminorunion); + } + yymx = yypParser->yystack[yypParser->yyidx].major; + if( yymx==YYERRORSYMBOL || yyerrorhit ){ +#ifndef NDEBUG + if( yyTraceFILE ){ + fprintf(yyTraceFILE,"%sDiscard input token %s\n", + yyTracePrompt,yyTokenName[yymajor]); + } +#endif + yy_destructor(yymajor,&yyminorunion); + yymajor = YYNOCODE; + }else{ + while( + yypParser->yyidx >= 0 && + yymx != YYERRORSYMBOL && + (yyact = yy_find_reduce_action( + yypParser->yystack[yypParser->yyidx].stateno, + YYERRORSYMBOL)) >= YYNSTATE + ){ + yy_pop_parser_stack(yypParser); + } + if( yypParser->yyidx < 0 || yymajor==0 ){ + yy_destructor(yymajor,&yyminorunion); + yy_parse_failed(yypParser); + yymajor = YYNOCODE; + }else if( yymx!=YYERRORSYMBOL ){ + YYMINORTYPE u2; + u2.YYERRSYMDT = 0; + yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); + } + } + yypParser->yyerrcnt = 3; + yyerrorhit = 1; +#else /* YYERRORSYMBOL is not defined */ + /* This is what we do if the grammar does not define ERROR: + ** + ** * Report an error message, and throw away the input token. + ** + ** * If the input token is $, then fail the parse. + ** + ** As before, subsequent error messages are suppressed until + ** three input tokens have been successfully shifted. + */ + if( yypParser->yyerrcnt<=0 ){ + yy_syntax_error(yypParser,yymajor,yyminorunion); + } + yypParser->yyerrcnt = 3; + yy_destructor(yymajor,&yyminorunion); + if( yyendofinput ){ + yy_parse_failed(yypParser); + } + yymajor = YYNOCODE; +#endif + }else{ + yy_accept(yypParser); + yymajor = YYNOCODE; + } + }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); + return; +} diff --git a/libs/win32/sqlite/parse.h b/libs/win32/sqlite/parse.h new file mode 100644 index 0000000000..65c9a5ce90 --- /dev/null +++ b/libs/win32/sqlite/parse.h @@ -0,0 +1,153 @@ +#define TK_SEMI 1 +#define TK_EXPLAIN 2 +#define TK_QUERY 3 +#define TK_PLAN 4 +#define TK_BEGIN 5 +#define TK_TRANSACTION 6 +#define TK_DEFERRED 7 +#define TK_IMMEDIATE 8 +#define TK_EXCLUSIVE 9 +#define TK_COMMIT 10 +#define TK_END 11 +#define TK_ROLLBACK 12 +#define TK_CREATE 13 +#define TK_TABLE 14 +#define TK_IF 15 +#define TK_NOT 16 +#define TK_EXISTS 17 +#define TK_TEMP 18 +#define TK_LP 19 +#define TK_RP 20 +#define TK_AS 21 +#define TK_COMMA 22 +#define TK_ID 23 +#define TK_ABORT 24 +#define TK_AFTER 25 +#define TK_ANALYZE 26 +#define TK_ASC 27 +#define TK_ATTACH 28 +#define TK_BEFORE 29 +#define TK_CASCADE 30 +#define TK_CAST 31 +#define TK_CONFLICT 32 +#define TK_DATABASE 33 +#define TK_DESC 34 +#define TK_DETACH 35 +#define TK_EACH 36 +#define TK_FAIL 37 +#define TK_FOR 38 +#define TK_IGNORE 39 +#define TK_INITIALLY 40 +#define TK_INSTEAD 41 +#define TK_LIKE_KW 42 +#define TK_MATCH 43 +#define TK_KEY 44 +#define TK_OF 45 +#define TK_OFFSET 46 +#define TK_PRAGMA 47 +#define TK_RAISE 48 +#define TK_REPLACE 49 +#define TK_RESTRICT 50 +#define TK_ROW 51 +#define TK_STATEMENT 52 +#define TK_TRIGGER 53 +#define TK_VACUUM 54 +#define TK_VIEW 55 +#define TK_VIRTUAL 56 +#define TK_REINDEX 57 +#define TK_RENAME 58 +#define TK_CTIME_KW 59 +#define TK_ANY 60 +#define TK_OR 61 +#define TK_AND 62 +#define TK_IS 63 +#define TK_BETWEEN 64 +#define TK_IN 65 +#define TK_ISNULL 66 +#define TK_NOTNULL 67 +#define TK_NE 68 +#define TK_EQ 69 +#define TK_GT 70 +#define TK_LE 71 +#define TK_LT 72 +#define TK_GE 73 +#define TK_ESCAPE 74 +#define TK_BITAND 75 +#define TK_BITOR 76 +#define TK_LSHIFT 77 +#define TK_RSHIFT 78 +#define TK_PLUS 79 +#define TK_MINUS 80 +#define TK_STAR 81 +#define TK_SLASH 82 +#define TK_REM 83 +#define TK_CONCAT 84 +#define TK_UMINUS 85 +#define TK_UPLUS 86 +#define TK_BITNOT 87 +#define TK_STRING 88 +#define TK_JOIN_KW 89 +#define TK_CONSTRAINT 90 +#define TK_DEFAULT 91 +#define TK_NULL 92 +#define TK_PRIMARY 93 +#define TK_UNIQUE 94 +#define TK_CHECK 95 +#define TK_REFERENCES 96 +#define TK_COLLATE 97 +#define TK_AUTOINCR 98 +#define TK_ON 99 +#define TK_DELETE 100 +#define TK_UPDATE 101 +#define TK_INSERT 102 +#define TK_SET 103 +#define TK_DEFERRABLE 104 +#define TK_FOREIGN 105 +#define TK_DROP 106 +#define TK_UNION 107 +#define TK_ALL 108 +#define TK_EXCEPT 109 +#define TK_INTERSECT 110 +#define TK_SELECT 111 +#define TK_DISTINCT 112 +#define TK_DOT 113 +#define TK_FROM 114 +#define TK_JOIN 115 +#define TK_USING 116 +#define TK_ORDER 117 +#define TK_BY 118 +#define TK_GROUP 119 +#define TK_HAVING 120 +#define TK_LIMIT 121 +#define TK_WHERE 122 +#define TK_INTO 123 +#define TK_VALUES 124 +#define TK_INTEGER 125 +#define TK_FLOAT 126 +#define TK_BLOB 127 +#define TK_REGISTER 128 +#define TK_VARIABLE 129 +#define TK_CASE 130 +#define TK_WHEN 131 +#define TK_THEN 132 +#define TK_ELSE 133 +#define TK_INDEX 134 +#define TK_ALTER 135 +#define TK_TO 136 +#define TK_ADD 137 +#define TK_COLUMNKW 138 +#define TK_TO_TEXT 139 +#define TK_TO_BLOB 140 +#define TK_TO_NUMERIC 141 +#define TK_TO_INT 142 +#define TK_TO_REAL 143 +#define TK_END_OF_FILE 144 +#define TK_ILLEGAL 145 +#define TK_SPACE 146 +#define TK_UNCLOSED_STRING 147 +#define TK_COMMENT 148 +#define TK_FUNCTION 149 +#define TK_COLUMN 150 +#define TK_AGG_FUNCTION 151 +#define TK_AGG_COLUMN 152 +#define TK_CONST_FUNC 153 diff --git a/libs/win32/sqlite/sqlite.vcproj b/libs/win32/sqlite/sqlite.vcproj index 2ada8c7d8f..9b21fbb1c8 100644 --- a/libs/win32/sqlite/sqlite.vcproj +++ b/libs/win32/sqlite/sqlite.vcproj @@ -25,7 +25,7 @@ > @@ -308,167 +308,175 @@ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > + + + + @@ -478,51 +486,51 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > diff --git a/libs/win32/sqlite/sqlite3.def b/libs/win32/sqlite/sqlite3.def new file mode 100644 index 0000000000..e42a0cd3d6 --- /dev/null +++ b/libs/win32/sqlite/sqlite3.def @@ -0,0 +1,101 @@ +EXPORTS +sqlite3_aggregate_context +sqlite3_aggregate_count +sqlite3_bind_blob +sqlite3_bind_double +sqlite3_bind_int +sqlite3_bind_int64 +sqlite3_bind_null +sqlite3_bind_parameter_count +sqlite3_bind_parameter_index +sqlite3_bind_parameter_name +sqlite3_bind_text +sqlite3_bind_text16 +sqlite3_busy_handler +sqlite3_busy_timeout +sqlite3_changes +sqlite3_close +sqlite3_collation_needed +sqlite3_collation_needed16 +sqlite3_column_blob +sqlite3_column_bytes +sqlite3_column_bytes16 +sqlite3_column_count +sqlite3_column_decltype +sqlite3_column_decltype16 +sqlite3_column_double +sqlite3_column_int +sqlite3_column_int64 +sqlite3_column_name +sqlite3_column_name16 +sqlite3_column_text +sqlite3_column_text16 +sqlite3_column_type +sqlite3_commit_hook +sqlite3_complete +sqlite3_complete16 +sqlite3_create_collation +sqlite3_create_collation16 +sqlite3_create_function +sqlite3_create_function16 +sqlite3_data_count +sqlite3_db_handle +sqlite3_enable_shared_cache +sqlite3_errcode +sqlite3_errmsg +sqlite3_errmsg16 +sqlite3_exec +sqlite3_expired +sqlite3_finalize +sqlite3_free +sqlite3_free_table +sqlite3_get_autocommit +sqlite3_get_auxdata +sqlite3_get_table +sqlite3_global_recover +sqlite3_interrupt +sqlite3_last_insert_rowid +sqlite3_libversion +sqlite3_libversion_number +sqlite3_mprintf +sqlite3_open +sqlite3_open16 +sqlite3_prepare +sqlite3_prepare16 +sqlite3_progress_handler +sqlite3_reset +sqlite3_result_blob +sqlite3_result_double +sqlite3_result_error +sqlite3_result_error16 +sqlite3_result_int +sqlite3_result_int64 +sqlite3_result_null +sqlite3_result_text +sqlite3_result_text16 +sqlite3_result_text16be +sqlite3_result_text16le +sqlite3_result_value +sqlite3_rollback_hook +sqlite3_set_authorizer +sqlite3_set_auxdata +sqlite3_snprintf +sqlite3_step +sqlite3_thread_cleanup +sqlite3_total_changes +sqlite3_trace +sqlite3_transfer_bindings +sqlite3_update_hook +sqlite3_user_data +sqlite3_value_blob +sqlite3_value_bytes +sqlite3_value_bytes16 +sqlite3_value_double +sqlite3_value_int +sqlite3_value_int64 +sqlite3_value_text +sqlite3_value_text16 +sqlite3_value_text16be +sqlite3_value_text16le +sqlite3_value_type +sqlite3_vmprintf diff --git a/libs/win32/sqlite/sqlite3.h b/libs/win32/sqlite/sqlite3.h new file mode 100644 index 0000000000..0628b12eed --- /dev/null +++ b/libs/win32/sqlite/sqlite3.h @@ -0,0 +1,1826 @@ +/* +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** This header file defines the interface that the SQLite library +** presents to client programs. +** +** @(#) $Id: sqlite.h.in,v 1.194 2006/09/16 21:45:14 drh Exp $ +*/ +#ifndef _SQLITE3_H_ +#define _SQLITE3_H_ +#include /* Needed for the definition of va_list */ + +/* +** Make sure we can call this stuff from C++. +*/ +#ifdef __cplusplus +extern "C" { +#endif + +/* +** The version of the SQLite library. +*/ +#ifdef SQLITE_VERSION +# undef SQLITE_VERSION +#endif +#define SQLITE_VERSION "3.3.8" + +/* +** The format of the version string is "X.Y.Z", where +** X is the major version number, Y is the minor version number and Z +** is the release number. The trailing string is often "alpha" or "beta". +** For example "3.1.1beta". +** +** The SQLITE_VERSION_NUMBER is an integer with the value +** (X*100000 + Y*1000 + Z). For example, for version "3.1.1beta", +** SQLITE_VERSION_NUMBER is set to 3001001. To detect if they are using +** version 3.1.1 or greater at compile time, programs may use the test +** (SQLITE_VERSION_NUMBER>=3001001). +*/ +#ifdef SQLITE_VERSION_NUMBER +# undef SQLITE_VERSION_NUMBER +#endif +#define SQLITE_VERSION_NUMBER 3003008 + +/* +** The version string is also compiled into the library so that a program +** can check to make sure that the lib*.a file and the *.h file are from +** the same version. The sqlite3_libversion() function returns a pointer +** to the sqlite3_version variable - useful in DLLs which cannot access +** global variables. +*/ +extern const char sqlite3_version[]; +const char *sqlite3_libversion(void); + +/* +** Return the value of the SQLITE_VERSION_NUMBER macro when the +** library was compiled. +*/ +int sqlite3_libversion_number(void); + +/* +** Each open sqlite database is represented by an instance of the +** following opaque structure. +*/ +typedef struct sqlite3 sqlite3; + + +/* +** Some compilers do not support the "long long" datatype. So we have +** to do a typedef that for 64-bit integers that depends on what compiler +** is being used. +*/ +#ifdef SQLITE_INT64_TYPE + typedef SQLITE_INT64_TYPE sqlite_int64; + typedef unsigned SQLITE_INT64_TYPE sqlite_uint64; +#elif defined(_MSC_VER) || defined(__BORLANDC__) + typedef __int64 sqlite_int64; + typedef unsigned __int64 sqlite_uint64; +#else + typedef long long int sqlite_int64; + typedef unsigned long long int sqlite_uint64; +#endif + +/* +** If compiling for a processor that lacks floating point support, +** substitute integer for floating-point +*/ +#ifdef SQLITE_OMIT_FLOATING_POINT +# define double sqlite_int64 +#endif + +/* +** A function to close the database. +** +** Call this function with a pointer to a structure that was previously +** returned from sqlite3_open() and the corresponding database will by closed. +** +** All SQL statements prepared using sqlite3_prepare() or +** sqlite3_prepare16() must be deallocated using sqlite3_finalize() before +** this routine is called. Otherwise, SQLITE_BUSY is returned and the +** database connection remains open. +*/ +int sqlite3_close(sqlite3 *); + +/* +** The type for a callback function. +*/ +typedef int (*sqlite3_callback)(void*,int,char**, char**); + +/* +** A function to executes one or more statements of SQL. +** +** If one or more of the SQL statements are queries, then +** the callback function specified by the 3rd parameter is +** invoked once for each row of the query result. This callback +** should normally return 0. If the callback returns a non-zero +** value then the query is aborted, all subsequent SQL statements +** are skipped and the sqlite3_exec() function returns the SQLITE_ABORT. +** +** The 4th parameter is an arbitrary pointer that is passed +** to the callback function as its first parameter. +** +** The 2nd parameter to the callback function is the number of +** columns in the query result. The 3rd parameter to the callback +** is an array of strings holding the values for each column. +** The 4th parameter to the callback is an array of strings holding +** the names of each column. +** +** The callback function may be NULL, even for queries. A NULL +** callback is not an error. It just means that no callback +** will be invoked. +** +** If an error occurs while parsing or evaluating the SQL (but +** not while executing the callback) then an appropriate error +** message is written into memory obtained from malloc() and +** *errmsg is made to point to that message. The calling function +** is responsible for freeing the memory that holds the error +** message. Use sqlite3_free() for this. If errmsg==NULL, +** then no error message is ever written. +** +** The return value is is SQLITE_OK if there are no errors and +** some other return code if there is an error. The particular +** return value depends on the type of error. +** +** If the query could not be executed because a database file is +** locked or busy, then this function returns SQLITE_BUSY. (This +** behavior can be modified somewhat using the sqlite3_busy_handler() +** and sqlite3_busy_timeout() functions below.) +*/ +int sqlite3_exec( + sqlite3*, /* An open database */ + const char *sql, /* SQL to be executed */ + sqlite3_callback, /* Callback function */ + void *, /* 1st argument to callback function */ + char **errmsg /* Error msg written here */ +); + +/* +** Return values for sqlite3_exec() and sqlite3_step() +*/ +#define SQLITE_OK 0 /* Successful result */ +/* beginning-of-error-codes */ +#define SQLITE_ERROR 1 /* SQL error or missing database */ +#define SQLITE_INTERNAL 2 /* NOT USED. Internal logic error in SQLite */ +#define SQLITE_PERM 3 /* Access permission denied */ +#define SQLITE_ABORT 4 /* Callback routine requested an abort */ +#define SQLITE_BUSY 5 /* The database file is locked */ +#define SQLITE_LOCKED 6 /* A table in the database is locked */ +#define SQLITE_NOMEM 7 /* A malloc() failed */ +#define SQLITE_READONLY 8 /* Attempt to write a readonly database */ +#define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/ +#define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */ +#define SQLITE_CORRUPT 11 /* The database disk image is malformed */ +#define SQLITE_NOTFOUND 12 /* NOT USED. Table or record not found */ +#define SQLITE_FULL 13 /* Insertion failed because database is full */ +#define SQLITE_CANTOPEN 14 /* Unable to open the database file */ +#define SQLITE_PROTOCOL 15 /* Database lock protocol error */ +#define SQLITE_EMPTY 16 /* Database is empty */ +#define SQLITE_SCHEMA 17 /* The database schema changed */ +#define SQLITE_TOOBIG 18 /* NOT USED. Too much data for one row */ +#define SQLITE_CONSTRAINT 19 /* Abort due to contraint violation */ +#define SQLITE_MISMATCH 20 /* Data type mismatch */ +#define SQLITE_MISUSE 21 /* Library used incorrectly */ +#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */ +#define SQLITE_AUTH 23 /* Authorization denied */ +#define SQLITE_FORMAT 24 /* Auxiliary database format error */ +#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */ +#define SQLITE_NOTADB 26 /* File opened that is not a database file */ +#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */ +#define SQLITE_DONE 101 /* sqlite3_step() has finished executing */ +/* end-of-error-codes */ + +/* +** Using the sqlite3_extended_result_codes() API, you can cause +** SQLite to return result codes with additional information in +** their upper bits. The lower 8 bits will be the same as the +** primary result codes above. But the upper bits might contain +** more specific error information. +** +** To extract the primary result code from an extended result code, +** simply mask off the lower 8 bits. +** +** primary = extended & 0xff; +** +** New result error codes may be added from time to time. Software +** that uses the extended result codes should plan accordingly and be +** sure to always handle new unknown codes gracefully. +** +** The SQLITE_OK result code will never be extended. It will always +** be exactly zero. +** +** The extended result codes always have the primary result code +** as a prefix. Primary result codes only contain a single "_" +** character. Extended result codes contain two or more "_" characters. +*/ +#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)) +#define SQLITE_IOERR_UNLOCK (SQLITE_IOERR | (8<<8)) +#define SQLITE_IOERR_RDLOCK (SQLITE_IOERR | (9<<8)) + +/* +** Enable or disable the extended result codes. +*/ +int sqlite3_extended_result_codes(sqlite3*, int onoff); + +/* +** Each entry in an SQLite table has a unique integer key. (The key is +** the value of the INTEGER PRIMARY KEY column if there is such a column, +** otherwise the key is generated at random. The unique key is always +** available as the ROWID, OID, or _ROWID_ column.) The following routine +** returns the integer key of the most recent insert in the database. +** +** This function is similar to the mysql_insert_id() function from MySQL. +*/ +sqlite_int64 sqlite3_last_insert_rowid(sqlite3*); + +/* +** This function returns the number of database rows that were changed +** (or inserted or deleted) by the most recent called sqlite3_exec(). +** +** All changes are counted, even if they were later undone by a +** ROLLBACK or ABORT. Except, changes associated with creating and +** dropping tables are not counted. +** +** If a callback invokes sqlite3_exec() recursively, then the changes +** in the inner, recursive call are counted together with the changes +** in the outer call. +** +** SQLite implements the command "DELETE FROM table" without a WHERE clause +** by dropping and recreating the table. (This is much faster than going +** through and deleting individual elements form the table.) Because of +** this optimization, the change count for "DELETE FROM table" will be +** zero regardless of the number of elements that were originally in the +** table. To get an accurate count of the number of rows deleted, use +** "DELETE FROM table WHERE 1" instead. +*/ +int sqlite3_changes(sqlite3*); + +/* +** This function returns the number of database rows that have been +** modified by INSERT, UPDATE or DELETE statements since the database handle +** was opened. This includes UPDATE, INSERT and DELETE statements executed +** as part of trigger programs. All changes are counted as soon as the +** statement that makes them is completed (when the statement handle is +** passed to sqlite3_reset() or sqlite_finalise()). +** +** SQLite implements the command "DELETE FROM table" without a WHERE clause +** by dropping and recreating the table. (This is much faster than going +** through and deleting individual elements form the table.) Because of +** this optimization, the change count for "DELETE FROM table" will be +** zero regardless of the number of elements that were originally in the +** table. To get an accurate count of the number of rows deleted, use +** "DELETE FROM table WHERE 1" instead. +*/ +int sqlite3_total_changes(sqlite3*); + +/* This function causes any pending database operation to abort and +** return at its earliest opportunity. This routine is typically +** called in response to a user action such as pressing "Cancel" +** or Ctrl-C where the user wants a long query operation to halt +** immediately. +*/ +void sqlite3_interrupt(sqlite3*); + + +/* These functions return true if the given input string comprises +** one or more complete SQL statements. For the sqlite3_complete() call, +** the parameter must be a nul-terminated UTF-8 string. For +** sqlite3_complete16(), a nul-terminated machine byte order UTF-16 string +** is required. +** +** The algorithm is simple. If the last token other than spaces +** and comments is a semicolon, then return true. otherwise return +** false. +*/ +int sqlite3_complete(const char *sql); +int sqlite3_complete16(const void *sql); + +/* +** This routine identifies a callback function that is invoked +** whenever an attempt is made to open a database table that is +** currently locked by another process or thread. If the busy callback +** is NULL, then sqlite3_exec() returns SQLITE_BUSY immediately if +** it finds a locked table. If the busy callback is not NULL, then +** sqlite3_exec() invokes the callback with three arguments. The +** second argument is the name of the locked table and the third +** argument is the number of times the table has been busy. If the +** busy callback returns 0, then sqlite3_exec() immediately returns +** SQLITE_BUSY. If the callback returns non-zero, then sqlite3_exec() +** tries to open the table again and the cycle repeats. +** +** The default busy callback is NULL. +** +** Sqlite is re-entrant, so the busy handler may start a new query. +** (It is not clear why anyone would every want to do this, but it +** is allowed, in theory.) But the busy handler may not close the +** database. Closing the database from a busy handler will delete +** data structures out from under the executing query and will +** probably result in a coredump. +*/ +int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*); + +/* +** This routine sets a busy handler that sleeps for a while when a +** table is locked. The handler will sleep multiple times until +** at least "ms" milleseconds of sleeping have been done. After +** "ms" milleseconds of sleeping, the handler returns 0 which +** causes sqlite3_exec() to return SQLITE_BUSY. +** +** Calling this routine with an argument less than or equal to zero +** turns off all busy handlers. +*/ +int sqlite3_busy_timeout(sqlite3*, int ms); + +/* +** This next routine is really just a wrapper around sqlite3_exec(). +** Instead of invoking a user-supplied callback for each row of the +** result, this routine remembers each row of the result in memory +** obtained from malloc(), then returns all of the result after the +** query has finished. +** +** As an example, suppose the query result where this table: +** +** Name | Age +** ----------------------- +** Alice | 43 +** Bob | 28 +** Cindy | 21 +** +** If the 3rd argument were &azResult then after the function returns +** azResult will contain the following data: +** +** azResult[0] = "Name"; +** azResult[1] = "Age"; +** azResult[2] = "Alice"; +** azResult[3] = "43"; +** azResult[4] = "Bob"; +** azResult[5] = "28"; +** azResult[6] = "Cindy"; +** azResult[7] = "21"; +** +** Notice that there is an extra row of data containing the column +** headers. But the *nrow return value is still 3. *ncolumn is +** set to 2. In general, the number of values inserted into azResult +** will be ((*nrow) + 1)*(*ncolumn). +** +** After the calling function has finished using the result, it should +** pass the result data pointer to sqlite3_free_table() in order to +** release the memory that was malloc-ed. Because of the way the +** malloc() happens, the calling function must not try to call +** free() directly. Only sqlite3_free_table() is able to release +** the memory properly and safely. +** +** The return value of this routine is the same as from sqlite3_exec(). +*/ +int sqlite3_get_table( + sqlite3*, /* An open database */ + const char *sql, /* SQL to be executed */ + char ***resultp, /* Result written to a char *[] that this points to */ + int *nrow, /* Number of result rows written here */ + int *ncolumn, /* Number of result columns written here */ + char **errmsg /* Error msg written here */ +); + +/* +** Call this routine to free the memory that sqlite3_get_table() allocated. +*/ +void sqlite3_free_table(char **result); + +/* +** The following routines are variants of the "sprintf()" from the +** standard C library. The resulting string is written into memory +** obtained from malloc() so that there is never a possiblity of buffer +** overflow. These routines also implement some additional formatting +** options that are useful for constructing SQL statements. +** +** The strings returned by these routines should be freed by calling +** sqlite3_free(). +** +** All of the usual printf formatting options apply. In addition, there +** is a "%q" option. %q works like %s in that it substitutes a null-terminated +** string from the argument list. But %q also doubles every '\'' character. +** %q is designed for use inside a string literal. By doubling each '\'' +** character it escapes that character and allows it to be inserted into +** the string. +** +** For example, so some string variable contains text as follows: +** +** char *zText = "It's a happy day!"; +** +** We can use this text in an SQL statement as follows: +** +** char *z = sqlite3_mprintf("INSERT INTO TABLES('%q')", zText); +** sqlite3_exec(db, z, callback1, 0, 0); +** sqlite3_free(z); +** +** Because the %q format string is used, the '\'' character in zText +** is escaped and the SQL generated is as follows: +** +** INSERT INTO table1 VALUES('It''s a happy day!') +** +** This is correct. Had we used %s instead of %q, the generated SQL +** would have looked like this: +** +** INSERT INTO table1 VALUES('It's a happy day!'); +** +** This second example is an SQL syntax error. As a general rule you +** should always use %q instead of %s when inserting text into a string +** literal. +*/ +char *sqlite3_mprintf(const char*,...); +char *sqlite3_vmprintf(const char*, va_list); +char *sqlite3_snprintf(int,char*,const char*, ...); + +/* +** SQLite uses its own memory allocator. On many installations, this +** memory allocator is identical to the standard malloc()/realloc()/free() +** and can be used interchangable. On others, the implementations are +** different. For maximum portability, it is best not to mix calls +** to the standard malloc/realloc/free with the sqlite versions. +*/ +void *sqlite3_malloc(int); +void *sqlite3_realloc(void*, int); +void sqlite3_free(void*); + +#ifndef SQLITE_OMIT_AUTHORIZATION +/* +** This routine registers a callback with the SQLite library. The +** callback is invoked (at compile-time, not at run-time) for each +** attempt to access a column of a table in the database. The callback +** returns SQLITE_OK if access is allowed, SQLITE_DENY if the entire +** SQL statement should be aborted with an error and SQLITE_IGNORE +** if the column should be treated as a NULL value. +*/ +int sqlite3_set_authorizer( + sqlite3*, + int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), + void *pUserData +); +#endif + +/* +** The second parameter to the access authorization function above will +** be one of the values below. These values signify what kind of operation +** is to be authorized. The 3rd and 4th parameters to the authorization +** function will be parameters or NULL depending on which of the following +** codes is used as the second parameter. The 5th parameter is the name +** of the database ("main", "temp", etc.) if applicable. The 6th parameter +** is the name of the inner-most trigger or view that is responsible for +** the access attempt or NULL if this access attempt is directly from +** input SQL code. +** +** Arg-3 Arg-4 +*/ +#define SQLITE_COPY 0 /* Table Name File Name */ +#define SQLITE_CREATE_INDEX 1 /* Index Name Table Name */ +#define SQLITE_CREATE_TABLE 2 /* Table Name NULL */ +#define SQLITE_CREATE_TEMP_INDEX 3 /* Index Name Table Name */ +#define SQLITE_CREATE_TEMP_TABLE 4 /* Table Name NULL */ +#define SQLITE_CREATE_TEMP_TRIGGER 5 /* Trigger Name Table Name */ +#define SQLITE_CREATE_TEMP_VIEW 6 /* View Name NULL */ +#define SQLITE_CREATE_TRIGGER 7 /* Trigger Name Table Name */ +#define SQLITE_CREATE_VIEW 8 /* View Name NULL */ +#define SQLITE_DELETE 9 /* Table Name NULL */ +#define SQLITE_DROP_INDEX 10 /* Index Name Table Name */ +#define SQLITE_DROP_TABLE 11 /* Table Name NULL */ +#define SQLITE_DROP_TEMP_INDEX 12 /* Index Name Table Name */ +#define SQLITE_DROP_TEMP_TABLE 13 /* Table Name NULL */ +#define SQLITE_DROP_TEMP_TRIGGER 14 /* Trigger Name Table Name */ +#define SQLITE_DROP_TEMP_VIEW 15 /* View Name NULL */ +#define SQLITE_DROP_TRIGGER 16 /* Trigger Name Table Name */ +#define SQLITE_DROP_VIEW 17 /* View Name NULL */ +#define SQLITE_INSERT 18 /* Table Name NULL */ +#define SQLITE_PRAGMA 19 /* Pragma Name 1st arg or NULL */ +#define SQLITE_READ 20 /* Table Name Column Name */ +#define SQLITE_SELECT 21 /* NULL NULL */ +#define SQLITE_TRANSACTION 22 /* NULL NULL */ +#define SQLITE_UPDATE 23 /* Table Name Column Name */ +#define SQLITE_ATTACH 24 /* Filename NULL */ +#define SQLITE_DETACH 25 /* Database Name NULL */ +#define SQLITE_ALTER_TABLE 26 /* Database Name Table Name */ +#define SQLITE_REINDEX 27 /* Index Name NULL */ +#define SQLITE_ANALYZE 28 /* Table Name NULL */ +#define SQLITE_CREATE_VTABLE 29 /* Table Name Module Name */ +#define SQLITE_DROP_VTABLE 30 /* Table Name Module Name */ +#define SQLITE_FUNCTION 31 /* Function Name NULL */ + +/* +** The return value of the authorization function should be one of the +** following constants: +*/ +/* #define SQLITE_OK 0 // Allow access (This is actually defined above) */ +#define SQLITE_DENY 1 /* Abort the SQL statement with an error */ +#define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */ + +/* +** Register a function for tracing SQL command evaluation. The function +** registered by sqlite3_trace() is invoked at the first sqlite3_step() +** for the evaluation of an SQL statement. The function registered by +** sqlite3_profile() runs at the end of each SQL statement and includes +** information on how long that statement ran. +** +** The sqlite3_profile() API is currently considered experimental and +** is subject to change. +*/ +void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); +void *sqlite3_profile(sqlite3*, + void(*xProfile)(void*,const char*,sqlite_uint64), void*); + +/* +** This routine configures a callback function - the progress callback - that +** is invoked periodically during long running calls to sqlite3_exec(), +** sqlite3_step() and sqlite3_get_table(). An example use for this API is to +** keep a GUI updated during a large query. +** +** The progress callback is invoked once for every N virtual machine opcodes, +** where N is the second argument to this function. The progress callback +** itself is identified by the third argument to this function. The fourth +** argument to this function is a void pointer passed to the progress callback +** function each time it is invoked. +** +** If a call to sqlite3_exec(), sqlite3_step() or sqlite3_get_table() results +** in less than N opcodes being executed, then the progress callback is not +** invoked. +** +** To remove the progress callback altogether, pass NULL as the third +** argument to this function. +** +** If the progress callback returns a result other than 0, then the current +** query is immediately terminated and any database changes rolled back. If the +** query was part of a larger transaction, then the transaction is not rolled +** back and remains active. The sqlite3_exec() call returns SQLITE_ABORT. +** +******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ****** +*/ +void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); + +/* +** Register a callback function to be invoked whenever a new transaction +** is committed. The pArg argument is passed through to the callback. +** callback. If the callback function returns non-zero, then the commit +** is converted into a rollback. +** +** If another function was previously registered, its pArg value is returned. +** Otherwise NULL is returned. +** +** Registering a NULL function disables the callback. +** +******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ****** +*/ +void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*); + +/* +** Open the sqlite database file "filename". The "filename" is UTF-8 +** encoded for sqlite3_open() and UTF-16 encoded in the native byte order +** for sqlite3_open16(). An sqlite3* handle is returned in *ppDb, even +** if an error occurs. If the database is opened (or created) successfully, +** then SQLITE_OK is returned. Otherwise an error code is returned. The +** sqlite3_errmsg() or sqlite3_errmsg16() routines can be used to obtain +** an English language description of the error. +** +** If the database file does not exist, then a new database is created. +** The encoding for the database is UTF-8 if sqlite3_open() is called and +** UTF-16 if sqlite3_open16 is used. +** +** Whether or not an error occurs when it is opened, resources associated +** with the sqlite3* handle should be released by passing it to +** sqlite3_close() when it is no longer required. +*/ +int sqlite3_open( + const char *filename, /* Database filename (UTF-8) */ + sqlite3 **ppDb /* OUT: SQLite db handle */ +); +int sqlite3_open16( + const void *filename, /* Database filename (UTF-16) */ + sqlite3 **ppDb /* OUT: SQLite db handle */ +); + +/* +** Return the error code for the most recent sqlite3_* API call associated +** with sqlite3 handle 'db'. SQLITE_OK is returned if the most recent +** API call was successful. +** +** Calls to many sqlite3_* functions set the error code and string returned +** by sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16() +** (overwriting the previous values). Note that calls to sqlite3_errcode(), +** sqlite3_errmsg() and sqlite3_errmsg16() themselves do not affect the +** results of future invocations. +** +** Assuming no other intervening sqlite3_* API calls are made, the error +** code returned by this function is associated with the same error as +** the strings returned by sqlite3_errmsg() and sqlite3_errmsg16(). +*/ +int sqlite3_errcode(sqlite3 *db); + +/* +** Return a pointer to a UTF-8 encoded string describing in english the +** error condition for the most recent sqlite3_* API call. The returned +** string is always terminated by an 0x00 byte. +** +** The string "not an error" is returned when the most recent API call was +** successful. +*/ +const char *sqlite3_errmsg(sqlite3*); + +/* +** Return a pointer to a UTF-16 native byte order encoded string describing +** in english the error condition for the most recent sqlite3_* API call. +** The returned string is always terminated by a pair of 0x00 bytes. +** +** The string "not an error" is returned when the most recent API call was +** successful. +*/ +const void *sqlite3_errmsg16(sqlite3*); + +/* +** An instance of the following opaque structure is used to represent +** a compiled SQL statment. +*/ +typedef struct sqlite3_stmt sqlite3_stmt; + +/* +** To execute an SQL query, it must first be compiled into a byte-code +** program using one of the following routines. The only difference between +** them is that the second argument, specifying the SQL statement to +** compile, is assumed to be encoded in UTF-8 for the sqlite3_prepare() +** function and UTF-16 for sqlite3_prepare16(). +** +** The first parameter "db" is an SQLite database handle. The second +** parameter "zSql" is the statement to be compiled, encoded as either +** UTF-8 or UTF-16 (see above). If the next parameter, "nBytes", is less +** than zero, then zSql is read up to the first nul terminator. If +** "nBytes" is not less than zero, then it is the length of the string zSql +** in bytes (not characters). +** +** *pzTail is made to point to the first byte past the end of the first +** SQL statement in zSql. This routine only compiles the first statement +** in zSql, so *pzTail is left pointing to what remains uncompiled. +** +** *ppStmt is left pointing to a compiled SQL statement that can be +** executed using sqlite3_step(). Or if there is an error, *ppStmt may be +** set to NULL. If the input text contained no SQL (if the input is and +** empty string or a comment) then *ppStmt is set to NULL. +** +** On success, SQLITE_OK is returned. Otherwise an error code is returned. +*/ +int sqlite3_prepare( + sqlite3 *db, /* Database handle */ + const char *zSql, /* SQL statement, UTF-8 encoded */ + int nBytes, /* Length of zSql in bytes. */ + sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + const char **pzTail /* OUT: Pointer to unused portion of zSql */ +); +int sqlite3_prepare16( + sqlite3 *db, /* Database handle */ + const void *zSql, /* SQL statement, UTF-16 encoded */ + int nBytes, /* Length of zSql in bytes. */ + sqlite3_stmt **ppStmt, /* OUT: Statement handle */ + const void **pzTail /* OUT: Pointer to unused portion of zSql */ +); + +/* +** Pointers to the following two opaque structures are used to communicate +** with the implementations of user-defined functions. +*/ +typedef struct sqlite3_context sqlite3_context; +typedef struct Mem sqlite3_value; + +/* +** In the SQL strings input to sqlite3_prepare() and sqlite3_prepare16(), +** one or more literals can be replace by parameters "?" or ":AAA" or +** "$VVV" where AAA is an identifer and VVV is a variable name according +** to the syntax rules of the TCL programming language. +** The value of these parameters (also called "host parameter names") can +** be set using the routines listed below. +** +** In every case, the first parameter is a pointer to the sqlite3_stmt +** structure returned from sqlite3_prepare(). The second parameter is the +** index of the parameter. The first parameter as an index of 1. For +** named parameters (":AAA" or "$VVV") you can use +** sqlite3_bind_parameter_index() to get the correct index value given +** the parameters name. If the same named parameter occurs more than +** once, it is assigned the same index each time. +** +** The fifth parameter to sqlite3_bind_blob(), sqlite3_bind_text(), and +** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or +** text after SQLite has finished with it. If the fifth argument is the +** special value SQLITE_STATIC, then the library assumes that the information +** is in static, unmanaged space and does not need to be freed. If the +** fifth argument has the value SQLITE_TRANSIENT, then SQLite makes its +** own private copy of the data. +** +** The sqlite3_bind_* routine must be called before sqlite3_step() after +** an sqlite3_prepare() or sqlite3_reset(). Unbound parameterss are +** interpreted as NULL. +*/ +int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*)); +int sqlite3_bind_double(sqlite3_stmt*, int, double); +int sqlite3_bind_int(sqlite3_stmt*, int, int); +int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite_int64); +int sqlite3_bind_null(sqlite3_stmt*, int); +int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*)); +int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*)); +int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*); + +/* +** Return the number of parameters in a compiled SQL statement. This +** routine was added to support DBD::SQLite. +*/ +int sqlite3_bind_parameter_count(sqlite3_stmt*); + +/* +** Return the name of the i-th parameter. Ordinary parameters "?" are +** nameless and a NULL is returned. For parameters of the form :AAA or +** $VVV the complete text of the parameter name is returned, including +** the initial ":" or "$". NULL is returned if the index is out of range. +*/ +const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int); + +/* +** Return the index of a parameter with the given name. The name +** must match exactly. If no parameter with the given name is found, +** return 0. +*/ +int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName); + +/* +** Set all the parameters in the compiled SQL statement to NULL. +*/ +int sqlite3_clear_bindings(sqlite3_stmt*); + +/* +** Return the number of columns in the result set returned by the compiled +** SQL statement. This routine returns 0 if pStmt is an SQL statement +** that does not return data (for example an UPDATE). +*/ +int sqlite3_column_count(sqlite3_stmt *pStmt); + +/* +** The first parameter is a compiled SQL statement. This function returns +** the column heading for the Nth column of that statement, where N is the +** second function parameter. The string returned is UTF-8 for +** sqlite3_column_name() and UTF-16 for sqlite3_column_name16(). +*/ +const char *sqlite3_column_name(sqlite3_stmt*,int); +const void *sqlite3_column_name16(sqlite3_stmt*,int); + +/* +** The first parameter to the following calls is a compiled SQL statement. +** These functions return information about the Nth column returned by +** the statement, where N is the second function argument. +** +** If the Nth column returned by the statement is not a column value, +** then all of the functions return NULL. Otherwise, the return the +** name of the attached database, table and column that the expression +** extracts a value from. +** +** As with all other SQLite APIs, those postfixed with "16" return UTF-16 +** encoded strings, the other functions return UTF-8. The memory containing +** the returned strings is valid until the statement handle is finalized(). +** +** These APIs are only available if the library was compiled with the +** SQLITE_ENABLE_COLUMN_METADATA preprocessor symbol defined. +*/ +const char *sqlite3_column_database_name(sqlite3_stmt*,int); +const void *sqlite3_column_database_name16(sqlite3_stmt*,int); +const char *sqlite3_column_table_name(sqlite3_stmt*,int); +const void *sqlite3_column_table_name16(sqlite3_stmt*,int); +const char *sqlite3_column_origin_name(sqlite3_stmt*,int); +const void *sqlite3_column_origin_name16(sqlite3_stmt*,int); + +/* +** The first parameter is a compiled SQL statement. If this statement +** is a SELECT statement, the Nth column of the returned result set +** of the SELECT is a table column then the declared type of the table +** column is returned. If the Nth column of the result set is not at table +** column, then a NULL pointer is returned. The returned string is always +** UTF-8 encoded. For example, in the database schema: +** +** CREATE TABLE t1(c1 VARIANT); +** +** And the following statement compiled: +** +** SELECT c1 + 1, c1 FROM t1; +** +** Then this routine would return the string "VARIANT" for the second +** result column (i==1), and a NULL pointer for the first result column +** (i==0). +*/ +const char *sqlite3_column_decltype(sqlite3_stmt *, int i); + +/* +** The first parameter is a compiled SQL statement. If this statement +** is a SELECT statement, the Nth column of the returned result set +** of the SELECT is a table column then the declared type of the table +** column is returned. If the Nth column of the result set is not at table +** column, then a NULL pointer is returned. The returned string is always +** UTF-16 encoded. For example, in the database schema: +** +** CREATE TABLE t1(c1 INTEGER); +** +** And the following statement compiled: +** +** SELECT c1 + 1, c1 FROM t1; +** +** Then this routine would return the string "INTEGER" for the second +** result column (i==1), and a NULL pointer for the first result column +** (i==0). +*/ +const void *sqlite3_column_decltype16(sqlite3_stmt*,int); + +/* +** After an SQL query has been compiled with a call to either +** sqlite3_prepare() or sqlite3_prepare16(), then this function must be +** called one or more times to execute the statement. +** +** The return value will be either SQLITE_BUSY, SQLITE_DONE, +** SQLITE_ROW, SQLITE_ERROR, or SQLITE_MISUSE. +** +** SQLITE_BUSY means that the database engine attempted to open +** a locked database and there is no busy callback registered. +** Call sqlite3_step() again to retry the open. +** +** SQLITE_DONE means that the statement has finished executing +** successfully. sqlite3_step() should not be called again on this virtual +** machine. +** +** If the SQL statement being executed returns any data, then +** SQLITE_ROW is returned each time a new row of data is ready +** for processing by the caller. The values may be accessed using +** the sqlite3_column_*() functions described below. sqlite3_step() +** is called again to retrieve the next row of data. +** +** SQLITE_ERROR means that a run-time error (such as a constraint +** violation) has occurred. sqlite3_step() should not be called again on +** the VM. More information may be found by calling sqlite3_errmsg(). +** +** SQLITE_MISUSE means that the this routine was called inappropriately. +** Perhaps it was called on a virtual machine that had already been +** finalized or on one that had previously returned SQLITE_ERROR or +** SQLITE_DONE. Or it could be the case the the same database connection +** is being used simulataneously by two or more threads. +*/ +int sqlite3_step(sqlite3_stmt*); + +/* +** Return the number of values in the current row of the result set. +** +** After a call to sqlite3_step() that returns SQLITE_ROW, this routine +** will return the same value as the sqlite3_column_count() function. +** After sqlite3_step() has returned an SQLITE_DONE, SQLITE_BUSY or +** error code, or before sqlite3_step() has been called on a +** compiled SQL statement, this routine returns zero. +*/ +int sqlite3_data_count(sqlite3_stmt *pStmt); + +/* +** Values are stored in the database in one of the following fundamental +** types. +*/ +#define SQLITE_INTEGER 1 +#define SQLITE_FLOAT 2 +/* #define SQLITE_TEXT 3 // See below */ +#define SQLITE_BLOB 4 +#define SQLITE_NULL 5 + +/* +** SQLite version 2 defines SQLITE_TEXT differently. To allow both +** version 2 and version 3 to be included, undefine them both if a +** conflict is seen. Define SQLITE3_TEXT to be the version 3 value. +*/ +#ifdef SQLITE_TEXT +# undef SQLITE_TEXT +#else +# define SQLITE_TEXT 3 +#endif +#define SQLITE3_TEXT 3 + +/* +** The next group of routines returns information about the information +** in a single column of the current result row of a query. In every +** case the first parameter is a pointer to the SQL statement that is being +** executed (the sqlite_stmt* that was returned from sqlite3_prepare()) and +** the second argument is the index of the column for which information +** should be returned. iCol is zero-indexed. The left-most column as an +** index of 0. +** +** If the SQL statement is not currently point to a valid row, or if the +** the colulmn index is out of range, the result is undefined. +** +** These routines attempt to convert the value where appropriate. For +** example, if the internal representation is FLOAT and a text result +** is requested, sprintf() is used internally to do the conversion +** automatically. The following table details the conversions that +** are applied: +** +** Internal Type Requested Type Conversion +** ------------- -------------- -------------------------- +** NULL INTEGER Result is 0 +** NULL FLOAT Result is 0.0 +** NULL TEXT Result is an empty string +** NULL BLOB Result is a zero-length BLOB +** INTEGER FLOAT Convert from integer to float +** INTEGER TEXT ASCII rendering of the integer +** INTEGER BLOB Same as for INTEGER->TEXT +** FLOAT INTEGER Convert from float to integer +** FLOAT TEXT ASCII rendering of the float +** FLOAT BLOB Same as FLOAT->TEXT +** TEXT INTEGER Use atoi() +** TEXT FLOAT Use atof() +** TEXT BLOB No change +** BLOB INTEGER Convert to TEXT then use atoi() +** BLOB FLOAT Convert to TEXT then use atof() +** BLOB TEXT Add a \000 terminator if needed +** +** The following access routines are provided: +** +** _type() Return the datatype of the result. This is one of +** SQLITE_INTEGER, SQLITE_FLOAT, SQLITE_TEXT, SQLITE_BLOB, +** or SQLITE_NULL. +** _blob() Return the value of a BLOB. +** _bytes() Return the number of bytes in a BLOB value or the number +** of bytes in a TEXT value represented as UTF-8. The \000 +** terminator is included in the byte count for TEXT values. +** _bytes16() Return the number of bytes in a BLOB value or the number +** of bytes in a TEXT value represented as UTF-16. The \u0000 +** terminator is included in the byte count for TEXT values. +** _double() Return a FLOAT value. +** _int() Return an INTEGER value in the host computer's native +** integer representation. This might be either a 32- or 64-bit +** integer depending on the host. +** _int64() Return an INTEGER value as a 64-bit signed integer. +** _text() Return the value as UTF-8 text. +** _text16() Return the value as UTF-16 text. +*/ +const void *sqlite3_column_blob(sqlite3_stmt*, int iCol); +int sqlite3_column_bytes(sqlite3_stmt*, int iCol); +int sqlite3_column_bytes16(sqlite3_stmt*, int iCol); +double sqlite3_column_double(sqlite3_stmt*, int iCol); +int sqlite3_column_int(sqlite3_stmt*, int iCol); +sqlite_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol); +const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol); +const void *sqlite3_column_text16(sqlite3_stmt*, int iCol); +int sqlite3_column_type(sqlite3_stmt*, int iCol); +int sqlite3_column_numeric_type(sqlite3_stmt*, int iCol); +sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol); + +/* +** The sqlite3_finalize() function is called to delete a compiled +** SQL statement obtained by a previous call to sqlite3_prepare() +** or sqlite3_prepare16(). If the statement was executed successfully, or +** not executed at all, then SQLITE_OK is returned. If execution of the +** statement failed then an error code is returned. +** +** This routine can be called at any point during the execution of the +** virtual machine. If the virtual machine has not completed execution +** when this routine is called, that is like encountering an error or +** an interrupt. (See sqlite3_interrupt().) Incomplete updates may be +** rolled back and transactions cancelled, depending on the circumstances, +** and the result code returned will be SQLITE_ABORT. +*/ +int sqlite3_finalize(sqlite3_stmt *pStmt); + +/* +** The sqlite3_reset() function is called to reset a compiled SQL +** statement obtained by a previous call to sqlite3_prepare() or +** sqlite3_prepare16() back to it's initial state, ready to be re-executed. +** Any SQL statement variables that had values bound to them using +** the sqlite3_bind_*() API retain their values. +*/ +int sqlite3_reset(sqlite3_stmt *pStmt); + +/* +** The following two functions are used to add user functions or aggregates +** implemented in C to the SQL langauge interpreted by SQLite. The +** difference only between the two is that the second parameter, the +** name of the (scalar) function or aggregate, is encoded in UTF-8 for +** sqlite3_create_function() and UTF-16 for sqlite3_create_function16(). +** +** The first argument is the database handle that the new function or +** aggregate is to be added to. If a single program uses more than one +** database handle internally, then user functions or aggregates must +** be added individually to each database handle with which they will be +** used. +** +** The third parameter is the number of arguments that the function or +** aggregate takes. If this parameter is negative, then the function or +** aggregate may take any number of arguments. +** +** The fourth parameter is one of SQLITE_UTF* values defined below, +** indicating the encoding that the function is most likely to handle +** values in. This does not change the behaviour of the programming +** interface. However, if two versions of the same function are registered +** with different encoding values, SQLite invokes the version likely to +** minimize conversions between text encodings. +** +** The seventh, eighth and ninth parameters, xFunc, xStep and xFinal, are +** pointers to user implemented C functions that implement the user +** function or aggregate. A scalar function requires an implementation of +** the xFunc callback only, NULL pointers should be passed as the xStep +** and xFinal parameters. An aggregate function requires an implementation +** of xStep and xFinal, but NULL should be passed for xFunc. To delete an +** existing user function or aggregate, pass NULL for all three function +** callback. Specifying an inconstent set of callback values, such as an +** xFunc and an xFinal, or an xStep but no xFinal, SQLITE_ERROR is +** returned. +*/ +int sqlite3_create_function( + sqlite3 *, + const char *zFunctionName, + int nArg, + int eTextRep, + void*, + void (*xFunc)(sqlite3_context*,int,sqlite3_value**), + void (*xStep)(sqlite3_context*,int,sqlite3_value**), + void (*xFinal)(sqlite3_context*) +); +int sqlite3_create_function16( + sqlite3*, + const void *zFunctionName, + int nArg, + int eTextRep, + void*, + void (*xFunc)(sqlite3_context*,int,sqlite3_value**), + void (*xStep)(sqlite3_context*,int,sqlite3_value**), + void (*xFinal)(sqlite3_context*) +); + +/* +** This function is deprecated. Do not use it. It continues to exist +** so as not to break legacy code. But new code should avoid using it. +*/ +int sqlite3_aggregate_count(sqlite3_context*); + +/* +** The next group of routines returns information about parameters to +** a user-defined function. Function implementations use these routines +** to access their parameters. These routines are the same as the +** sqlite3_column_* routines except that these routines take a single +** sqlite3_value* pointer instead of an sqlite3_stmt* and an integer +** column number. +*/ +const void *sqlite3_value_blob(sqlite3_value*); +int sqlite3_value_bytes(sqlite3_value*); +int sqlite3_value_bytes16(sqlite3_value*); +double sqlite3_value_double(sqlite3_value*); +int sqlite3_value_int(sqlite3_value*); +sqlite_int64 sqlite3_value_int64(sqlite3_value*); +const unsigned char *sqlite3_value_text(sqlite3_value*); +const void *sqlite3_value_text16(sqlite3_value*); +const void *sqlite3_value_text16le(sqlite3_value*); +const void *sqlite3_value_text16be(sqlite3_value*); +int sqlite3_value_type(sqlite3_value*); +int sqlite3_value_numeric_type(sqlite3_value*); + +/* +** Aggregate functions use the following routine to allocate +** a structure for storing their state. The first time this routine +** is called for a particular aggregate, a new structure of size nBytes +** is allocated, zeroed, and returned. On subsequent calls (for the +** same aggregate instance) the same buffer is returned. The implementation +** of the aggregate can use the returned buffer to accumulate data. +** +** The buffer allocated is freed automatically by SQLite. +*/ +void *sqlite3_aggregate_context(sqlite3_context*, int nBytes); + +/* +** The pUserData parameter to the sqlite3_create_function() +** routine used to register user functions is available to +** the implementation of the function using this call. +*/ +void *sqlite3_user_data(sqlite3_context*); + +/* +** The following two functions may be used by scalar user functions to +** associate meta-data with argument values. If the same value is passed to +** multiple invocations of the user-function during query execution, under +** some circumstances the associated meta-data may be preserved. This may +** be used, for example, to add a regular-expression matching scalar +** function. The compiled version of the regular expression is stored as +** meta-data associated with the SQL value passed as the regular expression +** pattern. +** +** Calling sqlite3_get_auxdata() returns a pointer to the meta data +** associated with the Nth argument value to the current user function +** call, where N is the second parameter. If no meta-data has been set for +** that value, then a NULL pointer is returned. +** +** The sqlite3_set_auxdata() is used to associate meta data with a user +** function argument. The third parameter is a pointer to the meta data +** to be associated with the Nth user function argument value. The fourth +** parameter specifies a 'delete function' that will be called on the meta +** data pointer to release it when it is no longer required. If the delete +** function pointer is NULL, it is not invoked. +** +** In practice, meta-data is preserved between function calls for +** expressions that are constant at compile time. This includes literal +** values and SQL variables. +*/ +void *sqlite3_get_auxdata(sqlite3_context*, int); +void sqlite3_set_auxdata(sqlite3_context*, int, void*, void (*)(void*)); + + +/* +** These are special value for the destructor that is passed in as the +** final argument to routines like sqlite3_result_blob(). If the destructor +** argument is SQLITE_STATIC, it means that the content pointer is constant +** and will never change. It does not need to be destroyed. The +** SQLITE_TRANSIENT value means that the content will likely change in +** the near future and that SQLite should make its own private copy of +** the content before returning. +*/ +#define SQLITE_STATIC ((void(*)(void *))0) +#define SQLITE_TRANSIENT ((void(*)(void *))-1) + +/* +** User-defined functions invoke the following routines in order to +** set their return value. +*/ +void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*)); +void sqlite3_result_double(sqlite3_context*, double); +void sqlite3_result_error(sqlite3_context*, const char*, int); +void sqlite3_result_error16(sqlite3_context*, const void*, int); +void sqlite3_result_int(sqlite3_context*, int); +void sqlite3_result_int64(sqlite3_context*, sqlite_int64); +void sqlite3_result_null(sqlite3_context*); +void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*)); +void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*)); +void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*)); +void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*)); +void sqlite3_result_value(sqlite3_context*, sqlite3_value*); + +/* +** These are the allowed values for the eTextRep argument to +** sqlite3_create_collation and sqlite3_create_function. +*/ +#define SQLITE_UTF8 1 +#define SQLITE_UTF16LE 2 +#define SQLITE_UTF16BE 3 +#define SQLITE_UTF16 4 /* Use native byte order */ +#define SQLITE_ANY 5 /* sqlite3_create_function only */ +#define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */ + +/* +** These two functions are used to add new collation sequences to the +** sqlite3 handle specified as the first argument. +** +** The name of the new collation sequence is specified as a UTF-8 string +** for sqlite3_create_collation() and a UTF-16 string for +** sqlite3_create_collation16(). In both cases the name is passed as the +** second function argument. +** +** The third argument must be one of the constants SQLITE_UTF8, +** SQLITE_UTF16LE or SQLITE_UTF16BE, indicating that the user-supplied +** routine expects to be passed pointers to strings encoded using UTF-8, +** UTF-16 little-endian or UTF-16 big-endian respectively. +** +** A pointer to the user supplied routine must be passed as the fifth +** argument. If it is NULL, this is the same as deleting the collation +** sequence (so that SQLite cannot call it anymore). Each time the user +** supplied function is invoked, it is passed a copy of the void* passed as +** the fourth argument to sqlite3_create_collation() or +** sqlite3_create_collation16() as its first parameter. +** +** The remaining arguments to the user-supplied routine are two strings, +** each represented by a [length, data] pair and encoded in the encoding +** that was passed as the third argument when the collation sequence was +** registered. The user routine should return negative, zero or positive if +** the first string is less than, equal to, or greater than the second +** string. i.e. (STRING1 - STRING2). +*/ +int sqlite3_create_collation( + sqlite3*, + const char *zName, + int eTextRep, + void*, + int(*xCompare)(void*,int,const void*,int,const void*) +); +int sqlite3_create_collation16( + sqlite3*, + const char *zName, + int eTextRep, + void*, + int(*xCompare)(void*,int,const void*,int,const void*) +); + +/* +** To avoid having to register all collation sequences before a database +** can be used, a single callback function may be registered with the +** database handle to be called whenever an undefined collation sequence is +** required. +** +** If the function is registered using the sqlite3_collation_needed() API, +** then it is passed the names of undefined collation sequences as strings +** encoded in UTF-8. If sqlite3_collation_needed16() is used, the names +** are passed as UTF-16 in machine native byte order. A call to either +** function replaces any existing callback. +** +** When the user-function is invoked, the first argument passed is a copy +** of the second argument to sqlite3_collation_needed() or +** sqlite3_collation_needed16(). The second argument is the database +** handle. The third argument is one of SQLITE_UTF8, SQLITE_UTF16BE or +** SQLITE_UTF16LE, indicating the most desirable form of the collation +** sequence function required. The fourth parameter is the name of the +** required collation sequence. +** +** The collation sequence is returned to SQLite by a collation-needed +** callback using the sqlite3_create_collation() or +** sqlite3_create_collation16() APIs, described above. +*/ +int sqlite3_collation_needed( + sqlite3*, + void*, + void(*)(void*,sqlite3*,int eTextRep,const char*) +); +int sqlite3_collation_needed16( + sqlite3*, + void*, + void(*)(void*,sqlite3*,int eTextRep,const void*) +); + +/* +** Specify the key for an encrypted database. This routine should be +** called right after sqlite3_open(). +** +** The code to implement this API is not available in the public release +** of SQLite. +*/ +int sqlite3_key( + sqlite3 *db, /* Database to be rekeyed */ + const void *pKey, int nKey /* The key */ +); + +/* +** Change the key on an open database. If the current database is not +** encrypted, this routine will encrypt it. If pNew==0 or nNew==0, the +** database is decrypted. +** +** The code to implement this API is not available in the public release +** of SQLite. +*/ +int sqlite3_rekey( + sqlite3 *db, /* Database to be rekeyed */ + const void *pKey, int nKey /* The new key */ +); + +/* +** Sleep for a little while. The second parameter is the number of +** miliseconds to sleep for. +** +** If the operating system does not support sleep requests with +** milisecond time resolution, then the time will be rounded up to +** the nearest second. The number of miliseconds of sleep actually +** requested from the operating system is returned. +*/ +int sqlite3_sleep(int); + +/* +** Return TRUE (non-zero) if the statement supplied as an argument needs +** to be recompiled. A statement needs to be recompiled whenever the +** execution environment changes in a way that would alter the program +** that sqlite3_prepare() generates. For example, if new functions or +** collating sequences are registered or if an authorizer function is +** added or changed. +** +*/ +int sqlite3_expired(sqlite3_stmt*); + +/* +** Move all bindings from the first prepared statement over to the second. +** This routine is useful, for example, if the first prepared statement +** fails with an SQLITE_SCHEMA error. The same SQL can be prepared into +** the second prepared statement then all of the bindings transfered over +** to the second statement before the first statement is finalized. +*/ +int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*); + +/* +** If the following global variable is made to point to a +** string which is the name of a directory, then all temporary files +** created by SQLite will be placed in that directory. If this variable +** is NULL pointer, then SQLite does a search for an appropriate temporary +** file directory. +** +** Once sqlite3_open() has been called, changing this variable will invalidate +** the current temporary database, if any. +*/ +extern char *sqlite3_temp_directory; + +/* +** This function is called to recover from a malloc() failure that occured +** within the SQLite library. Normally, after a single malloc() fails the +** library refuses to function (all major calls return SQLITE_NOMEM). +** This function restores the library state so that it can be used again. +** +** All existing statements (sqlite3_stmt pointers) must be finalized or +** reset before this call is made. Otherwise, SQLITE_BUSY is returned. +** If any in-memory databases are in use, either as a main or TEMP +** database, SQLITE_ERROR is returned. In either of these cases, the +** library is not reset and remains unusable. +** +** This function is *not* threadsafe. Calling this from within a threaded +** application when threads other than the caller have used SQLite is +** dangerous and will almost certainly result in malfunctions. +** +** This functionality can be omitted from a build by defining the +** SQLITE_OMIT_GLOBALRECOVER at compile time. +*/ +int sqlite3_global_recover(void); + +/* +** Test to see whether or not the database connection is in autocommit +** mode. Return TRUE if it is and FALSE if not. Autocommit mode is on +** by default. Autocommit is disabled by a BEGIN statement and reenabled +** by the next COMMIT or ROLLBACK. +*/ +int sqlite3_get_autocommit(sqlite3*); + +/* +** Return the sqlite3* database handle to which the prepared statement given +** in the argument belongs. This is the same database handle that was +** the first argument to the sqlite3_prepare() that was used to create +** the statement in the first place. +*/ +sqlite3 *sqlite3_db_handle(sqlite3_stmt*); + +/* +** Register a callback function with the database connection identified by the +** first argument to be invoked whenever a row is updated, inserted or deleted. +** Any callback set by a previous call to this function for the same +** database connection is overridden. +** +** The second argument is a pointer to the function to invoke when a +** row is updated, inserted or deleted. The first argument to the callback is +** a copy of the third argument to sqlite3_update_hook. The second callback +** argument is one of SQLITE_INSERT, SQLITE_DELETE or SQLITE_UPDATE, depending +** on the operation that caused the callback to be invoked. The third and +** fourth arguments to the callback contain pointers to the database and +** table name containing the affected row. The final callback parameter is +** the rowid of the row. In the case of an update, this is the rowid after +** the update takes place. +** +** The update hook is not invoked when internal system tables are +** modified (i.e. sqlite_master and sqlite_sequence). +** +** If another function was previously registered, its pArg value is returned. +** Otherwise NULL is returned. +*/ +void *sqlite3_update_hook( + sqlite3*, + void(*)(void *,int ,char const *,char const *,sqlite_int64), + void* +); + +/* +** Register a callback to be invoked whenever a transaction is rolled +** back. +** +** The new callback function overrides any existing rollback-hook +** callback. If there was an existing callback, then it's pArg value +** (the third argument to sqlite3_rollback_hook() when it was registered) +** is returned. Otherwise, NULL is returned. +** +** For the purposes of this API, a transaction is said to have been +** rolled back if an explicit "ROLLBACK" statement is executed, or +** an error or constraint causes an implicit rollback to occur. The +** callback is not invoked if a transaction is automatically rolled +** back because the database connection is closed. +*/ +void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); + +/* +** This function is only available if the library is compiled without +** the SQLITE_OMIT_SHARED_CACHE macro defined. It is used to enable or +** disable (if the argument is true or false, respectively) the +** "shared pager" feature. +*/ +int sqlite3_enable_shared_cache(int); + +/* +** Attempt to free N bytes of heap memory by deallocating non-essential +** memory allocations held by the database library (example: memory +** used to cache database pages to improve performance). +** +** This function is not a part of standard builds. It is only created +** if SQLite is compiled with the SQLITE_ENABLE_MEMORY_MANAGEMENT macro. +*/ +int sqlite3_release_memory(int); + +/* +** Place a "soft" limit on the amount of heap memory that may be allocated by +** SQLite within the current thread. If an internal allocation is requested +** that would exceed the specified limit, sqlite3_release_memory() is invoked +** one or more times to free up some space before the allocation is made. +** +** The limit is called "soft", because if sqlite3_release_memory() cannot free +** sufficient memory to prevent the limit from being exceeded, the memory is +** allocated anyway and the current operation proceeds. +** +** This function is only available if the library was compiled with the +** SQLITE_ENABLE_MEMORY_MANAGEMENT option set. +** memory-management has been enabled. +*/ +void sqlite3_soft_heap_limit(int); + +/* +** This routine makes sure that all thread-local storage has been +** deallocated for the current thread. +** +** This routine is not technically necessary. All thread-local storage +** will be automatically deallocated once memory-management and +** shared-cache are disabled and the soft heap limit has been set +** to zero. This routine is provided as a convenience for users who +** want to make absolutely sure they have not forgotten something +** prior to killing off a thread. +*/ +void sqlite3_thread_cleanup(void); + +/* +** Return meta information about a specific column of a specific database +** table accessible using the connection handle passed as the first function +** argument. +** +** The column is identified by the second, third and fourth parameters to +** this function. The second parameter is either the name of the database +** (i.e. "main", "temp" or an attached database) containing the specified +** table or NULL. If it is NULL, then all attached databases are searched +** for the table using the same algorithm as the database engine uses to +** resolve unqualified table references. +** +** The third and fourth parameters to this function are the table and column +** name of the desired column, respectively. Neither of these parameters +** may be NULL. +** +** Meta information is returned by writing to the memory locations passed as +** the 5th and subsequent parameters to this function. Any of these +** arguments may be NULL, in which case the corresponding element of meta +** information is ommitted. +** +** Parameter Output Type Description +** ----------------------------------- +** +** 5th const char* Data type +** 6th const char* Name of the default collation sequence +** 7th int True if the column has a NOT NULL constraint +** 8th int True if the column is part of the PRIMARY KEY +** 9th int True if the column is AUTOINCREMENT +** +** +** The memory pointed to by the character pointers returned for the +** declaration type and collation sequence is valid only until the next +** call to any sqlite API function. +** +** If the specified table is actually a view, then an error is returned. +** +** If the specified column is "rowid", "oid" or "_rowid_" and an +** INTEGER PRIMARY KEY column has been explicitly declared, then the output +** parameters are set for the explicitly declared column. If there is no +** explicitly declared IPK column, then the output parameters are set as +** follows: +** +** data type: "INTEGER" +** collation sequence: "BINARY" +** not null: 0 +** primary key: 1 +** auto increment: 0 +** +** This function may load one or more schemas from database files. If an +** error occurs during this process, or if the requested table or column +** cannot be found, an SQLITE error code is returned and an error message +** left in the database handle (to be retrieved using sqlite3_errmsg()). +** +** This API is only available if the library was compiled with the +** SQLITE_ENABLE_COLUMN_METADATA preprocessor symbol defined. +*/ +int sqlite3_table_column_metadata( + sqlite3 *db, /* Connection handle */ + const char *zDbName, /* Database name or NULL */ + const char *zTableName, /* Table name */ + const char *zColumnName, /* Column name */ + char const **pzDataType, /* OUTPUT: Declared data type */ + char const **pzCollSeq, /* OUTPUT: Collation sequence name */ + int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */ + int *pPrimaryKey, /* OUTPUT: True if column part of PK */ + int *pAutoinc /* OUTPUT: True if colums is auto-increment */ +); + +/* +****** EXPERIMENTAL - subject to change without notice ************** +** +** Attempt to load an SQLite extension library contained in the file +** zFile. The entry point is zProc. zProc may be 0 in which case the +** name of the entry point defaults to "sqlite3_extension_init". +** +** Return SQLITE_OK on success and SQLITE_ERROR if something goes wrong. +** +** If an error occurs and pzErrMsg is not 0, then fill *pzErrMsg with +** error message text. The calling function should free this memory +** by calling sqlite3_free(). +** +** Extension loading must be enabled using sqlite3_enable_load_extension() +** prior to calling this API or an error will be returned. +** +****** EXPERIMENTAL - subject to change without notice ************** +*/ +int sqlite3_load_extension( + sqlite3 *db, /* Load the extension into this database connection */ + const char *zFile, /* Name of the shared library containing extension */ + const char *zProc, /* Entry point. Derived from zFile if 0 */ + char **pzErrMsg /* Put error message here if not 0 */ +); + +/* +** So as not to open security holes in older applications that are +** unprepared to deal with extension load, and as a means of disabling +** extension loading while executing user-entered SQL, the following +** API is provided to turn the extension loading mechanism on and +** off. It is off by default. See ticket #1863. +** +** Call this routine with onoff==1 to turn extension loading on +** and call it with onoff==0 to turn it back off again. +*/ +int sqlite3_enable_load_extension(sqlite3 *db, int onoff); + +/* +****** EXPERIMENTAL - subject to change without notice ************** +** +** Register an extension entry point that is automatically invoked +** whenever a new database connection is opened. +** +** This API can be invoked at program startup in order to register +** one or more statically linked extensions that will be available +** to all new database connections. +** +** Duplicate extensions are detected so calling this routine multiple +** times with the same extension is harmless. +** +** This routine stores a pointer to the extension in an array +** that is obtained from malloc(). If you run a memory leak +** checker on your program and it reports a leak because of this +** array, then invoke sqlite3_automatic_extension_reset() prior +** to shutdown to free the memory. +** +** Automatic extensions apply across all threads. +*/ +int sqlite3_auto_extension(void *xEntryPoint); + + +/* +****** EXPERIMENTAL - subject to change without notice ************** +** +** Disable all previously registered automatic extensions. This +** routine undoes the effect of all prior sqlite3_automatic_extension() +** calls. +** +** This call disabled automatic extensions in all threads. +*/ +void sqlite3_reset_auto_extension(void); + + +/* +****** EXPERIMENTAL - subject to change without notice ************** +** +** The interface to the virtual-table mechanism is currently considered +** to be experimental. The interface might change in incompatible ways. +** If this is a problem for you, do not use the interface at this time. +** +** When the virtual-table mechanism stablizes, we will declare the +** interface fixed, support it indefinitely, and remove this comment. +*/ + +/* +** Structures used by the virtual table interface +*/ +typedef struct sqlite3_vtab sqlite3_vtab; +typedef struct sqlite3_index_info sqlite3_index_info; +typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor; +typedef struct sqlite3_module sqlite3_module; + +/* +** A module is a class of virtual tables. Each module is defined +** by an instance of the following structure. This structure consists +** mostly of methods for the module. +*/ +struct sqlite3_module { + int iVersion; + int (*xCreate)(sqlite3*, void *pAux, + int argc, const char *const*argv, + sqlite3_vtab **ppVTab, char**); + int (*xConnect)(sqlite3*, void *pAux, + int argc, const char *const*argv, + sqlite3_vtab **ppVTab, char**); + int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*); + int (*xDisconnect)(sqlite3_vtab *pVTab); + int (*xDestroy)(sqlite3_vtab *pVTab); + int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor); + int (*xClose)(sqlite3_vtab_cursor*); + int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr, + int argc, sqlite3_value **argv); + int (*xNext)(sqlite3_vtab_cursor*); + int (*xEof)(sqlite3_vtab_cursor*); + int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int); + int (*xRowid)(sqlite3_vtab_cursor*, sqlite_int64 *pRowid); + int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite_int64 *); + int (*xBegin)(sqlite3_vtab *pVTab); + int (*xSync)(sqlite3_vtab *pVTab); + int (*xCommit)(sqlite3_vtab *pVTab); + int (*xRollback)(sqlite3_vtab *pVTab); + int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName, + void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), + void **ppArg); +}; + +/* +** The sqlite3_index_info structure and its substructures is used to +** pass information into and receive the reply from the xBestIndex +** method of an sqlite3_module. The fields under **Inputs** are the +** inputs to xBestIndex and are read-only. xBestIndex inserts its +** results into the **Outputs** fields. +** +** The aConstraint[] array records WHERE clause constraints of the +** form: +** +** column OP expr +** +** Where OP is =, <, <=, >, or >=. The particular operator is stored +** in aConstraint[].op. The index of the column is stored in +** aConstraint[].iColumn. aConstraint[].usable is TRUE if the +** expr on the right-hand side can be evaluated (and thus the constraint +** is usable) and false if it cannot. +** +** The optimizer automatically inverts terms of the form "expr OP column" +** and makes other simplificatinos to the WHERE clause in an attempt to +** get as many WHERE clause terms into the form shown above as possible. +** The aConstraint[] array only reports WHERE clause terms in the correct +** form that refer to the particular virtual table being queried. +** +** Information about the ORDER BY clause is stored in aOrderBy[]. +** Each term of aOrderBy records a column of the ORDER BY clause. +** +** The xBestIndex method must fill aConstraintUsage[] with information +** about what parameters to pass to xFilter. If argvIndex>0 then +** the right-hand side of the corresponding aConstraint[] is evaluated +** and becomes the argvIndex-th entry in argv. If aConstraintUsage[].omit +** is true, then the constraint is assumed to be fully handled by the +** virtual table and is not checked again by SQLite. +** +** The idxNum and idxPtr values are recorded and passed into xFilter. +** sqlite3_free() is used to free idxPtr if needToFreeIdxPtr is true. +** +** The orderByConsumed means that output from xFilter will occur in +** the correct order to satisfy the ORDER BY clause so that no separate +** sorting step is required. +** +** The estimatedCost value is an estimate of the cost of doing the +** particular lookup. A full scan of a table with N entries should have +** a cost of N. A binary search of a table of N entries should have a +** cost of approximately log(N). +*/ +struct sqlite3_index_info { + /* Inputs */ + const int nConstraint; /* Number of entries in aConstraint */ + const struct sqlite3_index_constraint { + int iColumn; /* Column on left-hand side of constraint */ + unsigned char op; /* Constraint operator */ + unsigned char usable; /* True if this constraint is usable */ + int iTermOffset; /* Used internally - xBestIndex should ignore */ + } *const aConstraint; /* Table of WHERE clause constraints */ + const int nOrderBy; /* Number of terms in the ORDER BY clause */ + const struct sqlite3_index_orderby { + int iColumn; /* Column number */ + unsigned char desc; /* True for DESC. False for ASC. */ + } *const aOrderBy; /* The ORDER BY clause */ + + /* Outputs */ + struct sqlite3_index_constraint_usage { + int argvIndex; /* if >0, constraint is part of argv to xFilter */ + unsigned char omit; /* Do not code a test for this constraint */ + } *const aConstraintUsage; + int idxNum; /* Number used to identify the index */ + char *idxStr; /* String, possibly obtained from sqlite3_malloc */ + int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */ + int orderByConsumed; /* True if output is already ordered */ + double estimatedCost; /* Estimated cost of using this index */ +}; +#define SQLITE_INDEX_CONSTRAINT_EQ 2 +#define SQLITE_INDEX_CONSTRAINT_GT 4 +#define SQLITE_INDEX_CONSTRAINT_LE 8 +#define SQLITE_INDEX_CONSTRAINT_LT 16 +#define SQLITE_INDEX_CONSTRAINT_GE 32 +#define SQLITE_INDEX_CONSTRAINT_MATCH 64 + +/* +** This routine is used to register a new module name with an SQLite +** connection. Module names must be registered before creating new +** virtual tables on the module, or before using preexisting virtual +** tables of the module. +*/ +int sqlite3_create_module( + sqlite3 *db, /* SQLite connection to register module with */ + const char *zName, /* Name of the module */ + const sqlite3_module *, /* Methods for the module */ + void * /* Client data for xCreate/xConnect */ +); + +/* +** Every module implementation uses a subclass of the following structure +** to describe a particular instance of the module. Each subclass will +** be taylored to the specific needs of the module implementation. The +** purpose of this superclass is to define certain fields that are common +** to all module implementations. +** +** Virtual tables methods can set an error message by assigning a +** string obtained from sqlite3_mprintf() to zErrMsg. The method should +** take care that any prior string is freed by a call to sqlite3_free() +** prior to assigning a new string to zErrMsg. After the error message +** is delivered up to the client application, the string will be automatically +** freed by sqlite3_free() and the zErrMsg field will be zeroed. Note +** that sqlite3_mprintf() and sqlite3_free() are used on the zErrMsg field +** since virtual tables are commonly implemented in loadable extensions which +** do not have access to sqlite3MPrintf() or sqlite3Free(). +*/ +struct sqlite3_vtab { + const sqlite3_module *pModule; /* The module for this virtual table */ + int nRef; /* Used internally */ + char *zErrMsg; /* Error message from sqlite3_mprintf() */ + /* Virtual table implementations will typically add additional fields */ +}; + +/* Every module implementation uses a subclass of the following structure +** to describe cursors that point into the virtual table and are used +** to loop through the virtual table. Cursors are created using the +** xOpen method of the module. Each module implementation will define +** the content of a cursor structure to suit its own needs. +** +** This superclass exists in order to define fields of the cursor that +** are common to all implementations. +*/ +struct sqlite3_vtab_cursor { + sqlite3_vtab *pVtab; /* Virtual table of this cursor */ + /* Virtual table implementations will typically add additional fields */ +}; + +/* +** The xCreate and xConnect methods of a module use the following API +** to declare the format (the names and datatypes of the columns) of +** the virtual tables they implement. +*/ +int sqlite3_declare_vtab(sqlite3*, const char *zCreateTable); + +/* +** Virtual tables can provide alternative implementations of functions +** using the xFindFunction method. But global versions of those functions +** must exist in order to be overloaded. +** +** This API makes sure a global version of a function with a particular +** name and number of parameters exists. If no such function exists +** before this API is called, a new function is created. The implementation +** of the new function always causes an exception to be thrown. So +** the new function is not good for anything by itself. Its only +** purpose is to be a place-holder function that can be overloaded +** by virtual tables. +** +** This API should be considered part of the virtual table interface, +** which is experimental and subject to change. +*/ +int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg); + +/* +** The interface to the virtual-table mechanism defined above (back up +** to a comment remarkably similar to this one) is currently considered +** to be experimental. The interface might change in incompatible ways. +** If this is a problem for you, do not use the interface at this time. +** +** When the virtual-table mechanism stablizes, we will declare the +** interface fixed, support it indefinitely, and remove this comment. +** +****** EXPERIMENTAL - subject to change without notice ************** +*/ + +/* +** Undo the hack that converts floating point types to integer for +** builds on processors without floating point support. +*/ +#ifdef SQLITE_OMIT_FLOATING_POINT +# undef double +#endif + +#ifdef __cplusplus +} /* End of the 'extern "C"' block */ +#endif +#endif