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