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