sl@0: /***** This file contains automatically generated code ****** sl@0: ** sl@0: ** The code in this file has been automatically generated by sl@0: ** sl@0: ** $Header: /sqlite/sqlite/tool/mkkeywordhash.c,v 1.32 2008/10/06 05:32:19 danielk1977 Exp $ sl@0: ** sl@0: ** The code in this file implements a function that determines whether sl@0: ** or not a given identifier is really an SQL keyword. The same thing sl@0: ** might be implemented more directly using a hand-written hash table. sl@0: ** But by using this automatically generated code, the size of the code sl@0: ** is substantially reduced. This is important for embedded applications sl@0: ** on platforms with limited memory. sl@0: */ sl@0: /* Hash score: 159 */ sl@0: static int keywordCode(const char *z, int n){ sl@0: /* zText[] encodes 775 bytes of keywords in 521 bytes */ sl@0: static const char zText[521] = sl@0: "REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECTABLE" sl@0: "FTHENDEFERRABLELSEXCEPTRANSACTIONATURALTERAISEXCLUSIVEXISTSCONSTRAINT" sl@0: "ERSECTRIGGEREFERENCESUNIQUERYATTACHAVINGROUPDATEMPORARYBEGINNER" sl@0: "ENAMEBETWEENOTNULLIKECASCADELETECASECOLLATECREATECURRENT_DATE" sl@0: "DETACHIMMEDIATEJOINSERTMATCHPLANALYZEPRAGMABORTVALUESWHENWHERE" sl@0: "PLACEAFTERESTRICTANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMITCONFLICT" sl@0: "CROSSCURRENT_TIMESTAMPRIMARYDEFERREDISTINCTDROPFAILIMITFROMFULL" sl@0: "GLOBYIFINTOFFSETISNULLORDERIGHTOUTEROLLBACKROWUNIONUSINGVACUUM" sl@0: "VIEWINITIALLY"; sl@0: static const unsigned char aHash[127] = { sl@0: 65, 92, 109, 63, 0, 44, 0, 0, 71, 0, 66, 0, 0, sl@0: 103, 12, 67, 15, 0, 107, 72, 104, 100, 0, 19, 0, 0, sl@0: 113, 0, 111, 76, 0, 22, 80, 0, 9, 0, 0, 59, 60, sl@0: 0, 58, 6, 0, 39, 77, 89, 0, 110, 88, 0, 0, 45, sl@0: 0, 90, 24, 0, 17, 0, 114, 40, 23, 0, 5, 98, 25, sl@0: 83, 0, 0, 116, 93, 50, 115, 47, 7, 42, 0, 78, 0, sl@0: 87, 26, 0, 86, 0, 0, 0, 82, 79, 84, 75, 97, 14, sl@0: 34, 96, 0, 70, 0, 18, 74, 99, 31, 0, 112, 69, 105, sl@0: 52, 46, 95, 0, 0, 81, 101, 0, 108, 0, 35, 0, 0, sl@0: 28, 0, 73, 48, 53, 0, 20, 51, 0, 43, sl@0: }; sl@0: static const unsigned char aNext[116] = { sl@0: 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, sl@0: 0, 2, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, sl@0: 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, sl@0: 0, 0, 3, 38, 0, 32, 21, 0, 0, 0, 0, 29, 0, sl@0: 0, 37, 0, 0, 0, 1, 55, 0, 0, 56, 0, 0, 0, sl@0: 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 16, 33, sl@0: 10, 0, 0, 0, 0, 0, 0, 0, 11, 61, 68, 0, 8, sl@0: 0, 91, 85, 0, 0, 94, 0, 49, 0, 0, 64, 0, 41, sl@0: 102, 0, 27, 106, 36, 62, 54, 0, 0, 57, 0, 0, sl@0: }; sl@0: static const unsigned char aLen[116] = { sl@0: 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6, sl@0: 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 6, sl@0: 11, 2, 7, 5, 5, 9, 6, 10, 9, 7, 10, 6, 5, sl@0: 6, 6, 5, 6, 4, 9, 2, 5, 5, 6, 7, 7, 3, sl@0: 4, 4, 7, 3, 6, 4, 7, 6, 12, 6, 9, 4, 6, sl@0: 5, 4, 7, 6, 5, 6, 4, 5, 7, 5, 8, 3, 7, sl@0: 13, 2, 2, 4, 6, 6, 8, 5, 17, 12, 7, 8, 8, sl@0: 2, 4, 4, 5, 4, 4, 4, 2, 2, 4, 6, 2, 3, sl@0: 6, 5, 5, 5, 8, 3, 5, 5, 6, 4, 9, 3, sl@0: }; sl@0: static const unsigned short int aOffset[116] = { sl@0: 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33, sl@0: 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81, sl@0: 86, 95, 96, 101, 105, 109, 117, 123, 130, 138, 144, 154, 157, sl@0: 162, 167, 172, 175, 179, 179, 183, 188, 191, 195, 201, 207, 207, sl@0: 210, 213, 217, 218, 222, 228, 232, 239, 245, 257, 263, 272, 274, sl@0: 280, 285, 287, 294, 299, 304, 310, 314, 317, 324, 328, 336, 338, sl@0: 345, 347, 349, 358, 362, 368, 374, 382, 387, 387, 403, 410, 417, sl@0: 418, 425, 429, 432, 437, 441, 445, 448, 450, 452, 455, 455, 458, sl@0: 461, 467, 471, 476, 480, 488, 491, 496, 501, 507, 511, 516, sl@0: }; sl@0: static const unsigned char aCode[116] = { sl@0: TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE, sl@0: TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN, sl@0: TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD, sl@0: TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE, sl@0: TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE, sl@0: TK_EXCEPT, TK_TRANSACTION,TK_ON, TK_JOIN_KW, TK_ALTER, sl@0: TK_RAISE, TK_EXCLUSIVE, TK_EXISTS, TK_CONSTRAINT, TK_INTERSECT, sl@0: TK_TRIGGER, TK_REFERENCES, TK_UNIQUE, TK_QUERY, TK_ATTACH, sl@0: TK_HAVING, TK_GROUP, TK_UPDATE, TK_TEMP, TK_TEMP, sl@0: TK_OR, TK_BEGIN, TK_JOIN_KW, TK_RENAME, TK_BETWEEN, sl@0: TK_NOTNULL, TK_NOT, TK_NULL, TK_LIKE_KW, TK_CASCADE, sl@0: TK_ASC, TK_DELETE, TK_CASE, TK_COLLATE, TK_CREATE, sl@0: TK_CTIME_KW, TK_DETACH, TK_IMMEDIATE, TK_JOIN, TK_INSERT, sl@0: TK_MATCH, TK_PLAN, TK_ANALYZE, TK_PRAGMA, TK_ABORT, sl@0: TK_VALUES, TK_WHEN, TK_WHERE, TK_REPLACE, TK_AFTER, sl@0: TK_RESTRICT, TK_AND, TK_DEFAULT, TK_AUTOINCR, TK_TO, sl@0: TK_IN, TK_CAST, TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, sl@0: TK_JOIN_KW, TK_CTIME_KW, TK_CTIME_KW, TK_PRIMARY, TK_DEFERRED, sl@0: TK_DISTINCT, TK_IS, TK_DROP, TK_FAIL, TK_LIMIT, sl@0: TK_FROM, TK_JOIN_KW, TK_LIKE_KW, TK_BY, TK_IF, sl@0: TK_INTO, TK_OFFSET, TK_OF, TK_SET, TK_ISNULL, sl@0: TK_ORDER, TK_JOIN_KW, TK_JOIN_KW, TK_ROLLBACK, TK_ROW, sl@0: TK_UNION, TK_USING, TK_VACUUM, TK_VIEW, TK_INITIALLY, sl@0: TK_ALL, sl@0: }; sl@0: int h, i; sl@0: if( n<2 ) return TK_ID; sl@0: h = ((charMap(z[0])*4) ^ sl@0: (charMap(z[n-1])*3) ^ sl@0: n) % 127; sl@0: for(i=((int)aHash[h])-1; i>=0; i=((int)aNext[i])-1){ sl@0: if( aLen[i]==n && sqlite3StrNICmp(&zText[aOffset[i]],z,n)==0 ){ sl@0: return aCode[i]; sl@0: } sl@0: } sl@0: return TK_ID; sl@0: } sl@0: int sqlite3KeywordCode(const unsigned char *z, int n){ sl@0: return keywordCode((char*)z, n); sl@0: }