1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/SQLite/keywordhash.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,111 @@
1.4 +/***** This file contains automatically generated code ******
1.5 +**
1.6 +** The code in this file has been automatically generated by
1.7 +**
1.8 +** $Header: /sqlite/sqlite/tool/mkkeywordhash.c,v 1.31 2007/07/30 18:26:20 rse Exp $
1.9 +**
1.10 +** The code in this file implements a function that determines whether
1.11 +** or not a given identifier is really an SQL keyword. The same thing
1.12 +** might be implemented more directly using a hand-written hash table.
1.13 +** But by using this automatically generated code, the size of the code
1.14 +** is substantially reduced. This is important for embedded applications
1.15 +** on platforms with limited memory.
1.16 +*/
1.17 +/* Hash score: 157 */
1.18 +static int keywordCode(const char *z, int n){
1.19 + /* zText[] encodes 767 bytes of keywords in 519 bytes */
1.20 + static const char zText[519] =
1.21 + "BEFOREIGNOREGEXPLAINSTEADDESCAPEACHECKEYCONSTRAINTERSECTABLEFT"
1.22 + "HENDATABASELECTRANSACTIONATURALTERAISELSEXCEPTRIGGEREFERENCES"
1.23 + "UNIQUERYATTACHAVINGROUPDATEMPORARYBEGINNEREINDEXCLUSIVEXISTSBETWEEN"
1.24 + "OTNULLIKECASCADEFERRABLECASECOLLATECREATECURRENT_DATEDELETEDETACH"
1.25 + "IMMEDIATEJOINSERTMATCHPLANALYZEPRAGMABORTVALUESWHENWHERENAMEAFTER"
1.26 + "EPLACEANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMITCONFLICTCROSSCURRENT_TIMESTAMP"
1.27 + "RIMARYDEFERREDISTINCTDROPFAILIMITFROMFULLGLOBYIFINTOFFSETISNULL"
1.28 + "ORDERESTRICTOUTERIGHTROLLBACKROWUNIONUSINGVACUUMVIEWINITIALLY"
1.29 + ;
1.30 + static const unsigned char aHash[127] = {
1.31 + 63, 90, 108, 61, 0, 38, 0, 0, 69, 0, 64, 0, 0,
1.32 + 101, 4, 65, 7, 0, 107, 70, 102, 98, 0, 22, 0, 0,
1.33 + 112, 0, 110, 105, 0, 18, 78, 0, 1, 0, 0, 56, 57,
1.34 + 0, 55, 11, 0, 33, 75, 87, 0, 109, 86, 0, 0, 45,
1.35 + 0, 88, 54, 0, 20, 0, 113, 34, 19, 0, 10, 96, 28,
1.36 + 81, 0, 0, 115, 91, 47, 114, 41, 12, 44, 0, 76, 0,
1.37 + 85, 29, 0, 84, 0, 0, 0, 80, 77, 82, 73, 95, 6,
1.38 + 14, 94, 0, 68, 0, 21, 74, 97, 27, 0, 111, 67, 103,
1.39 + 49, 40, 93, 0, 0, 79, 99, 0, 106, 0, 15, 0, 0,
1.40 + 24, 0, 71, 42, 50, 0, 16, 48, 0, 37,
1.41 + };
1.42 + static const unsigned char aNext[115] = {
1.43 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0,
1.44 + 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0,
1.45 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0,
1.46 + 17, 0, 0, 0, 36, 39, 0, 0, 25, 0, 0, 31, 0,
1.47 + 0, 0, 43, 52, 0, 0, 0, 53, 0, 0, 0, 0, 0,
1.48 + 0, 0, 0, 0, 0, 0, 0, 26, 0, 8, 46, 2, 0,
1.49 + 0, 0, 0, 0, 0, 0, 3, 58, 66, 0, 13, 0, 89,
1.50 + 83, 0, 0, 92, 0, 72, 0, 0, 62, 0, 35, 100, 0,
1.51 + 0, 104, 23, 30, 60, 51, 0, 0, 59, 0, 0,
1.52 + };
1.53 + static const unsigned char aLen[115] = {
1.54 + 6, 7, 3, 6, 6, 7, 7, 3, 4, 6, 4, 5, 3,
1.55 + 10, 9, 5, 4, 4, 3, 8, 2, 6, 11, 2, 7, 5,
1.56 + 5, 4, 6, 7, 10, 6, 5, 6, 6, 5, 6, 4, 9,
1.57 + 2, 5, 5, 7, 5, 9, 6, 7, 7, 3, 4, 4, 7,
1.58 + 3, 10, 4, 7, 6, 12, 6, 6, 9, 4, 6, 5, 4,
1.59 + 7, 6, 5, 6, 4, 5, 6, 5, 7, 3, 7, 13, 2,
1.60 + 2, 4, 6, 6, 8, 5, 17, 12, 7, 8, 8, 2, 4,
1.61 + 4, 5, 4, 4, 4, 2, 2, 4, 6, 2, 3, 6, 5,
1.62 + 8, 5, 5, 8, 3, 5, 5, 6, 4, 9, 3,
1.63 + };
1.64 + static const unsigned short int aOffset[115] = {
1.65 + 0, 2, 2, 6, 10, 13, 18, 23, 25, 26, 31, 33, 37,
1.66 + 40, 47, 55, 58, 61, 63, 65, 70, 71, 76, 85, 86, 91,
1.67 + 95, 99, 102, 107, 113, 123, 126, 131, 136, 141, 144, 148, 148,
1.68 + 152, 157, 160, 164, 166, 169, 177, 183, 189, 189, 192, 195, 199,
1.69 + 200, 204, 214, 218, 225, 231, 243, 249, 255, 264, 266, 272, 277,
1.70 + 279, 286, 291, 296, 302, 306, 309, 315, 319, 326, 328, 335, 337,
1.71 + 339, 348, 352, 358, 364, 372, 377, 377, 393, 400, 407, 408, 415,
1.72 + 419, 422, 427, 431, 435, 438, 440, 442, 445, 445, 448, 451, 457,
1.73 + 461, 469, 473, 478, 486, 489, 494, 499, 505, 509, 514,
1.74 + };
1.75 + static const unsigned char aCode[115] = {
1.76 + TK_BEFORE, TK_FOREIGN, TK_FOR, TK_IGNORE, TK_LIKE_KW,
1.77 + TK_EXPLAIN, TK_INSTEAD, TK_ADD, TK_DESC, TK_ESCAPE,
1.78 + TK_EACH, TK_CHECK, TK_KEY, TK_CONSTRAINT, TK_INTERSECT,
1.79 + TK_TABLE, TK_JOIN_KW, TK_THEN, TK_END, TK_DATABASE,
1.80 + TK_AS, TK_SELECT, TK_TRANSACTION,TK_ON, TK_JOIN_KW,
1.81 + TK_ALTER, TK_RAISE, TK_ELSE, TK_EXCEPT, TK_TRIGGER,
1.82 + TK_REFERENCES, TK_UNIQUE, TK_QUERY, TK_ATTACH, TK_HAVING,
1.83 + TK_GROUP, TK_UPDATE, TK_TEMP, TK_TEMP, TK_OR,
1.84 + TK_BEGIN, TK_JOIN_KW, TK_REINDEX, TK_INDEX, TK_EXCLUSIVE,
1.85 + TK_EXISTS, TK_BETWEEN, TK_NOTNULL, TK_NOT, TK_NULL,
1.86 + TK_LIKE_KW, TK_CASCADE, TK_ASC, TK_DEFERRABLE, TK_CASE,
1.87 + TK_COLLATE, TK_CREATE, TK_CTIME_KW, TK_DELETE, TK_DETACH,
1.88 + TK_IMMEDIATE, TK_JOIN, TK_INSERT, TK_MATCH, TK_PLAN,
1.89 + TK_ANALYZE, TK_PRAGMA, TK_ABORT, TK_VALUES, TK_WHEN,
1.90 + TK_WHERE, TK_RENAME, TK_AFTER, TK_REPLACE, TK_AND,
1.91 + TK_DEFAULT, TK_AUTOINCR, TK_TO, TK_IN, TK_CAST,
1.92 + TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW,
1.93 + TK_CTIME_KW, TK_PRIMARY, TK_DEFERRED, TK_DISTINCT, TK_IS,
1.94 + TK_DROP, TK_FAIL, TK_LIMIT, TK_FROM, TK_JOIN_KW,
1.95 + TK_LIKE_KW, TK_BY, TK_IF, TK_INTO, TK_OFFSET,
1.96 + TK_OF, TK_SET, TK_ISNULL, TK_ORDER, TK_RESTRICT,
1.97 + TK_JOIN_KW, TK_JOIN_KW, TK_ROLLBACK, TK_ROW, TK_UNION,
1.98 + TK_USING, TK_VACUUM, TK_VIEW, TK_INITIALLY, TK_ALL,
1.99 + };
1.100 + int h, i;
1.101 + if( n<2 ) return TK_ID;
1.102 + h = ((charMap(z[0])*4) ^
1.103 + (charMap(z[n-1])*3) ^
1.104 + n) % 127;
1.105 + for(i=((int)aHash[h])-1; i>=0; i=((int)aNext[i])-1){
1.106 + if( aLen[i]==n && sqlite3StrNICmp(&zText[aOffset[i]],z,n)==0 ){
1.107 + return aCode[i];
1.108 + }
1.109 + }
1.110 + return TK_ID;
1.111 +}
1.112 +int sqlite3KeywordCode(const unsigned char *z, int n){
1.113 + return keywordCode((char*)z, n);
1.114 +}