KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hsqldb > Token


1 /* Copyright (c) 2001-2005, The HSQL Development Group
2  * All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * Redistributions of source code must retain the above copyright notice, this
8  * list of conditions and the following disclaimer.
9  *
10  * Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  *
14  * Neither the name of the HSQL Development Group nor the names of its
15  * contributors may be used to endorse or promote products derived from this
16  * software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG,
22  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */

30
31
32 package org.hsqldb;
33
34 import org.hsqldb.lib.HashSet;
35 import org.hsqldb.lib.IntValueHashMap;
36
37 /**
38  * Defines and enumerates reserved and non-reserved SQL
39  * keywords. <p>
40  *
41  * @author Nitin Chauhan
42  * @author fredt@users
43  * @since 1.7.2
44  * @version 1.7.2
45  */

46 public class Token {
47
48     private static IntValueHashMap commandSet;
49
50     //
51
static final String JavaDoc T_ASTERISK = "*";
52     static final String JavaDoc T_COMMA = ",";
53     static final String JavaDoc T_CLOSEBRACKET = ")";
54     static final String JavaDoc T_EQUALS = "=";
55     public static final String JavaDoc T_DIVIDE = "/";
56     static final String JavaDoc T_OPENBRACKET = "(";
57     static final String JavaDoc T_SEMICOLON = ";";
58     static final String JavaDoc T_MULTIPLY = "*";
59     static final String JavaDoc T_PERCENT = "%";
60     static final String JavaDoc T_PLUS = "+";
61     static final String JavaDoc T_QUESTION = "?";
62
63     // SQL 200n reserved tokens
64
static final String JavaDoc T_ADD = "ADD"; //reserved
65
static final String JavaDoc T_ALL = "ALL"; //reserved
66
static final String JavaDoc T_ALLOCATE = "ALLOCATE"; //reserved
67
public static final String JavaDoc T_ALTER = "ALTER"; //reserved
68
static final String JavaDoc T_AND = "AND"; //reserved
69
static final String JavaDoc T_ANY = "ANY"; //reserved
70
static final String JavaDoc T_ARE = "ARE"; //reserved
71
static final String JavaDoc T_ARRAY = "ARRAY"; //reserved
72
static final String JavaDoc T_AS = "AS"; //reserved
73
static final String JavaDoc T_ASENSITIVE =
74         "ASENSITIVE"; //reserved
75
static final String JavaDoc T_ASYMMETRIC =
76         "ASYMMETRIC"; //reserved
77
static final String JavaDoc T_AT = "AT"; //reserved
78
static final String JavaDoc T_ATOMIC = "ATOMIC"; //reserved
79
static final String JavaDoc T_AUTHORIZATION =
80         "AUTHORIZATION"; //reserved
81
static final String JavaDoc T_BEGIN = "BEGIN"; //reserved
82
static final String JavaDoc T_BETWEEN = "BETWEEN";
83     static final String JavaDoc T_BIGINT = "BIGINT"; //reserved
84
public static final String JavaDoc T_BINARY = "BINARY"; //reserved
85
static final String JavaDoc T_BLOB = "BLOB"; //reserved
86
static final String JavaDoc T_BOOLEAN = "BOOLEAN"; //reserved
87
static final String JavaDoc T_BOTH = "BOTH";
88     static final String JavaDoc T_BY = "BY"; //reserved
89
static final String JavaDoc T_CALL = "CALL"; //reserved
90
static final String JavaDoc T_CALLED = "CALLED"; //reserved
91
static final String JavaDoc T_CASCADED = "CASCADED"; //reserved
92
static final String JavaDoc T_CASE = "CASE"; //reserved
93
static final String JavaDoc T_CAST = "CAST"; //reserved
94
static final String JavaDoc T_CHAR = "CHAR"; //reserved
95
static final String JavaDoc T_CHARACTER =
96         "CHARACTER"; //reserved
97
static final String JavaDoc T_CHECK = "CHECK"; //reserved
98
static final String JavaDoc T_CLOB = "CLOB"; //reserved
99
static final String JavaDoc T_CLOSE = "CLOSE"; //reserved
100
static final String JavaDoc T_COLLATE = "COLLATE"; //reserved
101
static final String JavaDoc T_COLUMN = "COLUMN"; //reserved
102
public static final String JavaDoc T_COMMIT = "COMMIT"; //reserved
103
static final String JavaDoc T_CONDITION =
104         "CONDIITON"; //reserved
105
static final String JavaDoc T_CONNECT = "CONNECT"; //reserved
106
static final String JavaDoc T_CONSTRAINT =
107         "CONSTRAINT"; //reserved
108
static final String JavaDoc T_CONTINUE = "CONTINUE"; //reserved
109
static final String JavaDoc T_CORRESPONDING =
110         "CORRESPONDING"; //reserved
111
static final String JavaDoc T_CREATE = "CREATE"; //reserved
112
static final String JavaDoc T_CROSS = "CROSS"; //reserved
113
static final String JavaDoc T_CUBE = "CUBE"; //reserved
114
static final String JavaDoc T_CURRENT = "CURRENT"; //reserved
115
static final String JavaDoc T_CURRENT_DATE =
116         "CURRENT_DATE"; //reserved
117
static final String JavaDoc T_CURRENT_DEFAULT_TRANSFORM_GROUP =
118         "CURRENT_DEFAULT_TRANSFORM_GROUP"; //reserved
119
static final String JavaDoc T_CURRENT_PATH = "CURRENT_PATH"; //reserved
120
static final String JavaDoc T_CURRENT_ROLE = "CURRENT_ROLE"; //reserved
121
static final String JavaDoc T_CURRENT_TIME = "CURRENT_TIME"; //reserved
122
static final String JavaDoc T_CURRENT_TIMESTAMP =
123         "CURRENT_TIMESTAMP"; //reserved
124
static final String JavaDoc T_CURRENT_TRANSFORM_TROUP_FOR_TYPE =
125         "CURRENT_TRANSFORM_GROUP_FOR_TYPE"; //reserved
126
static final String JavaDoc T_CURRENT_USER = "CURRENT_USER"; //reserved
127
static final String JavaDoc T_CURSOR = "CURSOR"; //reserved
128
static final String JavaDoc T_CYCLE = "CYCLE"; //reserved
129
static final String JavaDoc T_DATE = "DATE"; //reserved
130
static final String JavaDoc T_DAY = "DAY"; //reserved
131
static final String JavaDoc T_DEALLOCATE = "DEALLOCATE"; //reserved
132
static final String JavaDoc T_DEC = "DEC"; //reserved
133
static final String JavaDoc T_DECIMAL = "DECIMAL"; //reserved
134
static final String JavaDoc T_DECLARE = "DECLARE"; //reserved
135
static final String JavaDoc T_DEFAULT = "DEFAULT"; //reserved
136
public static final String JavaDoc T_DELETE = "DELETE"; //reserved
137
static final String JavaDoc T_DEREF = "DEREF"; //reserved
138
static final String JavaDoc T_DESCRIBE = "DESCRIBE"; //reserved
139
static final String JavaDoc T_DETERMINISTIC = "DETERMINISTIC"; //reserved
140
static final String JavaDoc T_DISCONNECT = "DISCONNECT"; //reserved
141
static final String JavaDoc T_DISTINCT = "DISTINCT"; //reserved
142
static final String JavaDoc T_DO = "DO"; //reserved
143
static final String JavaDoc T_DOUBLE = "DOUBLE"; //reserved
144
static final String JavaDoc T_DOW = "DAYOFWEEK"; //reserved
145
static final String JavaDoc T_DROP = "DROP"; //reserved
146
static final String JavaDoc T_DYNAMIC = "DYNAMIC"; //reserved
147
static final String JavaDoc T_EACH = "EACH"; //reserved
148
static final String JavaDoc T_ELEMENT = "ELEMENT"; //reserved
149
static final String JavaDoc T_ELSE = "ELSE"; //reserved
150
static final String JavaDoc T_ELSEIF = "ELSEIF"; //reserved
151
static final String JavaDoc T_END = "END"; //reserved
152
static final String JavaDoc T_ESCAPE = "ESCAPE"; //reserved
153
static final String JavaDoc T_EXCEPT = "EXCEPT"; //reserved
154
static final String JavaDoc T_EXEC = "EXEC"; //reserved
155
static final String JavaDoc T_EXECUTE = "EXECUTE"; //reserved
156
static final String JavaDoc T_EXISTS = "EXISTS"; //reserved
157
static final String JavaDoc T_EXIT = "EXIT"; //reserved
158
static final String JavaDoc T_EXTERNAL = "EXTERNAL"; //reserved
159
static final String JavaDoc T_FALSE = "FALSE"; //reserved
160
static final String JavaDoc T_FETCH = "FETCH"; //reserved
161
static final String JavaDoc T_FILTER = "FILTER"; //reserved
162
static final String JavaDoc T_FLOAT = "FLOAT"; //reserved
163
static final String JavaDoc T_FOR = "FOR"; //reserved
164
static final String JavaDoc T_FOREIGN = "FOREIGN"; //reserved
165
static final String JavaDoc T_FREE = "FREE"; //reserved
166
static final String JavaDoc T_FROM = "FROM"; //reserved
167
static final String JavaDoc T_FULL = "FULL"; //reserved
168
static final String JavaDoc T_FUNCTION = "FUNCTION"; //reserved
169
static final String JavaDoc T_GET = "GET"; //reserved
170
static final String JavaDoc T_GLOBAL = "GLOBAL"; //reserved
171
static final String JavaDoc T_GRANT = "GRANT"; //reserved
172
static final String JavaDoc T_GROUP = "GROUP"; //reserved
173
static final String JavaDoc T_GROUPING = "GROUPING"; //reserved
174
static final String JavaDoc T_HANDLER = "HANDLER"; //reserved
175
static final String JavaDoc T_HAVING = "HAVING"; //reserved
176
static final String JavaDoc T_HEADER = "HEADER"; //reserved
177
static final String JavaDoc T_HOLD = "HOLD"; //reserved
178
static final String JavaDoc T_HOUR = "HOUR"; //reserved
179
static final String JavaDoc T_IDENTITY = "IDENTITY"; //reserved
180
static final String JavaDoc T_IF = "IF"; //reserved
181
static final String JavaDoc T_IMMEDIATE = "IMMEDIATE"; //reserved
182
static final String JavaDoc T_IN = "IN"; //reserved
183
static final String JavaDoc T_INDICATOR = "INDICATOR"; //reserved
184
static final String JavaDoc T_INNER = "INNER"; //reserved
185
static final String JavaDoc T_INOUT = "INOUT"; //reserved
186
static final String JavaDoc T_INPUT = "INPUT"; //reserved
187
static final String JavaDoc T_INSENSITIVE = "INSENSITIVE"; //reserved
188
public static final String JavaDoc T_INSERT = "INSERT"; //reserved
189
static final String JavaDoc T_INT = "INT"; //reserved
190
static final String JavaDoc T_INTEGER = "INTEGER"; //reserved
191
static final String JavaDoc T_INTERSECT = "INTERSECT"; //reserved
192
static final String JavaDoc T_INTERVAL = "INTERVAL"; //reserved
193
static final String JavaDoc T_INTO = "INTO"; //reserved
194
static final String JavaDoc T_IS = "IS"; //reserved
195
static final String JavaDoc T_ITERATE = "ITERATE"; //reserved
196
static final String JavaDoc T_JOIN = "JOIN"; //reserved
197
static final String JavaDoc T_LANGUAGE = "LANGUAGE"; //reserved
198
static final String JavaDoc T_LARGE = "LARGE"; //reserved
199
static final String JavaDoc T_LATERAL = "LATERAL"; //reserved
200
static final String JavaDoc T_LEADING = "LEADING"; //reserved
201
static final String JavaDoc T_LEAVE = "LEAVE"; //reserved
202
static final String JavaDoc T_LEFT = "LEFT"; //reserved
203
static final String JavaDoc T_LIKE = "LIKE"; //reserved
204
static final String JavaDoc T_LOCAL = "LOCAL"; //reserved
205
static final String JavaDoc T_LOCALTIME = "LOCALTIME"; //reserved
206
static final String JavaDoc T_LOCALTIMESTAMP = "LOCALTIMESTAMP"; //reserved
207
static final String JavaDoc T_LOOP = "LOOP"; //reserved
208
static final String JavaDoc T_MATCH = "MATCH"; //reserved
209
static final String JavaDoc T_MEMBER = "MEMBER"; //reserved
210
static final String JavaDoc T_METHOD = "METHOD"; //reserved
211
static final String JavaDoc T_MINUTE = "MINUTE"; //reserved
212
static final String JavaDoc T_MODIFIES = "MODIFIES"; //reserved
213
static final String JavaDoc T_MODULE = "MODULE"; //reserved
214
static final String JavaDoc T_MONTH = "MONTH"; //reserved
215
static final String JavaDoc T_MULTISET = "MULTISET"; //reserved
216
static final String JavaDoc T_NATIONAL = "NATIONAL"; //reserved
217
static final String JavaDoc T_NATURAL = "NAUTRAL"; //reserved
218
static final String JavaDoc T_NCHAR = "NCHAR"; //reserved
219
static final String JavaDoc T_NCLOB = "NCLOB"; //reserved
220
static final String JavaDoc T_NEW = "NEW"; //reserved
221
static final String JavaDoc T_NEXT = "NEXT"; //reserved
222
static final String JavaDoc T_NO = "NO"; //reserved
223
static final String JavaDoc T_NONE = "NONE"; //reserved
224
static final String JavaDoc T_NOT = "NOT"; //reserved
225
static final String JavaDoc T_NULL = "NULL"; //reserved
226
static final String JavaDoc T_NUMERIC = "NUMERIC"; //reserved
227
static final String JavaDoc T_OF = "OF"; //reserved
228
static final String JavaDoc T_OLD = "OLD"; //reserved
229
static final String JavaDoc T_ON = "ON"; //reserved
230
static final String JavaDoc T_ONLY = "ONLY"; //reserved
231
static final String JavaDoc T_OPEN = "OPEN"; //reserved
232
static final String JavaDoc T_OR = "OR"; //reserved
233
static final String JavaDoc T_ORDER = "ORDER"; //reserved
234
static final String JavaDoc T_OUT = "OUT"; //reserved
235
static final String JavaDoc T_OUTER = "OUTER"; //reserved
236
static final String JavaDoc T_OUTPUT = "OUTPUT"; //reserved
237
static final String JavaDoc T_OVER = "OVER"; //reserved
238
static final String JavaDoc T_OVERLAPS = "OVERLAPS"; //reserved
239
static final String JavaDoc T_PARAMETER = "PARAMETER"; //reserved
240
static final String JavaDoc T_PARTITION = "PARTITION"; //reserved
241
static final String JavaDoc T_PRECISION = "PRECISION"; //reserved
242
static final String JavaDoc T_PREPARE = "PREPARE"; //reserved
243
static final String JavaDoc T_PRIMARY = "PRIMARY"; //reserved
244
static final String JavaDoc T_PROCEDURE = "PROCEDURE"; //reserved
245
static final String JavaDoc T_RANGE = "RANGE"; //reserved
246
static final String JavaDoc T_READS = "READS"; //reserved
247
static final String JavaDoc T_REAL = "REAL"; //reserved
248
static final String JavaDoc T_RECURSIVE = "RECURSIVE"; //reserved
249
static final String JavaDoc T_REF = "REF"; //reserved
250
static final String JavaDoc T_REFERENCES = "REFERENCES"; //reserved
251
static final String JavaDoc T_REFERENCING = "REFERENCING"; //reserved
252
static final String JavaDoc T_RELEASE = "RELEASE"; //reserved
253
static final String JavaDoc T_REPEAT = "REPEAT"; //reserved
254
static final String JavaDoc T_RESIGNAL = "RESIGNAL"; //reserved
255
static final String JavaDoc T_RESULT = "RESULT"; //reserved
256
static final String JavaDoc T_RETURN = "RETURN"; //reserved
257
static final String JavaDoc T_RETURNS = "RETURNS"; //reserved
258
static final String JavaDoc T_REVOKE = "REVOKE"; //reserved
259
static final String JavaDoc T_RIGHT = "RIGHT"; //reserved
260
static final String JavaDoc T_ROLLBACK = "ROLLBACK"; //reserved
261
static final String JavaDoc T_ROLLUP = "ROLLUP"; //reserved
262
static final String JavaDoc T_ROW = "ROW"; //reserved
263
static final String JavaDoc T_ROWS = "ROWS"; //reserved
264
static final String JavaDoc T_SAVEPOINT = "SAVEPOINT"; //reserved
265
static final String JavaDoc T_SCOPE = "SCOPE"; //reserved
266
static final String JavaDoc T_SCROLL = "SCROLL"; //reserved
267
static final String JavaDoc T_SECOND = "SECOND"; //reserved
268
static final String JavaDoc T_SEARCH = "SEARCH"; //reserved
269
static final String JavaDoc T_SELECT = "SELECT"; //reserved
270
static final String JavaDoc T_SENSITIVE = "SENSITIVE"; //reserved
271
static final String JavaDoc T_SESSION_USER = "SESSION_USER"; //reserved
272
public static final String JavaDoc T_SET = "SET"; //reserved
273
static final String JavaDoc T_SIGNAL = "SIGNAL"; //reserved
274
static final String JavaDoc T_SIMILAR = "SIMILAR"; //reserved
275
static final String JavaDoc T_SMALLINT = "SMALLINT"; //reserved
276
static final String JavaDoc T_SOME = "SOME"; //reserved
277
static final String JavaDoc T_SPECIFIC = "SPECIFIC"; //reserved
278
static final String JavaDoc T_SPECIFICTYPE = "SPECIFICTYPE"; //reserved
279
static final String JavaDoc T_SQL = "SQL"; //reserved
280
static final String JavaDoc T_SQLEXCEPTION = "SQLEXCEPTION"; //reserved
281
static final String JavaDoc T_SQLSTATE = "SQLSTATE"; //reserved
282
static final String JavaDoc T_SQLWARNING = "SQLWARNING"; //reserved
283
static final String JavaDoc T_START = "START"; //reserved
284
static final String JavaDoc T_STATIC = "STATIC"; //reserved
285
static final String JavaDoc T_SUBMULTISET = "SUBMULTISET"; //reserved
286
static final String JavaDoc T_SYMMETRIC = "SYMMETRIC"; //reserved
287
static final String JavaDoc T_SYSTEM = "SYSTEM"; //reserved
288
static final String JavaDoc T_SYSTEM_USER = "SYSTEM_USER"; //reserved
289
static final String JavaDoc T_TABLE = "TABLE"; //reserved
290
static final String JavaDoc T_TABLESAMPLE = "TABLESAMPLE"; //reserved
291
static final String JavaDoc T_THEN = "THEN"; //reserved
292
static final String JavaDoc T_TIME = "TIME"; //reserved
293
static final String JavaDoc T_TIMESTAMP = "TIMESTAMP"; //reserved
294
static final String JavaDoc T_TIMEZONE_HOUR = "TIMEZONE_HOUR"; //reserved
295
static final String JavaDoc T_TIMEZONE_MINUTE = "TIMEZONE_MINUTE"; //reserved
296
static final String JavaDoc T_TO = "TO"; //reserved
297
static final String JavaDoc T_TRAILING = "TRAILING"; //reserved
298
static final String JavaDoc T_TRANSLATION = "TRANSLATION"; //reserved
299
static final String JavaDoc T_TREAT = "TREAT"; //reserved
300
static final String JavaDoc T_TRIGGER = "TRIGGER"; //reserved
301
static final String JavaDoc T_TRUE = "TRUE"; //reserved
302
static final String JavaDoc T_UNDO = "UNDO"; //reserved
303
static final String JavaDoc T_UNION = "UNION"; //reserved
304
static final String JavaDoc T_UNIQUE = "UNIQUE"; //reserved
305
static final String JavaDoc T_UNKNOWN = "UNKNOWN"; //reserved
306
static final String JavaDoc T_UNNEST = "UNNEST"; //reserved
307
static final String JavaDoc T_UNTIL = "UNTIL"; //reserved
308
static final String JavaDoc T_UPDATE = "UPDATE"; //reserved
309
static final String JavaDoc T_USER = "USER"; //reserved
310
static final String JavaDoc T_USING = "USING"; //reserved
311
static final String JavaDoc T_VALUE = "VALUE"; //reserved
312
static final String JavaDoc T_VALUES = "VALUES"; //reserved
313
static final String JavaDoc T_VARCHAR = "VARCHAR"; //reserved
314
static final String JavaDoc T_VARYING = "VARYING"; //reserved
315
static final String JavaDoc T_WHEN = "WHEN"; //reserved
316
static final String JavaDoc T_WHENEVER = "WHENEVER"; //reserved
317
static final String JavaDoc T_WHERE = "WHERE"; //reserved
318
static final String JavaDoc T_WHILE = "WHILE"; //reserved
319
static final String JavaDoc T_WINDOW = "WINDOW"; //reserved
320
static final String JavaDoc T_WITH = "WITH"; //reserved
321
static final String JavaDoc T_WITHIN = "WITHIN"; //reserved
322
static final String JavaDoc T_WITHOUT = "WITHOUT"; //reserved
323
static final String JavaDoc T_YEAR = "YEAR"; //reserved
324

325     // other tokens
326
static final String JavaDoc T_ALWAYS = "ALWAYS";
327     static final String JavaDoc T_ACTION = "ACTION";
328     static final String JavaDoc T_ADMIN = "ADMIN";
329     static final String JavaDoc T_AFTER = "AFTER";
330     static final String JavaDoc T_ALIAS = "ALIAS";
331     static final String JavaDoc T_ASC = "ASC";
332     static final String JavaDoc T_AUTOCOMMIT = "AUTOCOMMIT";
333     static final String JavaDoc T_AVG = "AVG";
334     static final String JavaDoc T_BACKUP = "BACKUP";
335     static final String JavaDoc T_BEFORE = "BEFORE";
336     static final String JavaDoc T_CACHED = "CACHED";
337     static final String JavaDoc T_CASCADE = "CASCADE";
338     static final String JavaDoc T_CASEWHEN = "CASEWHEN";
339     static final String JavaDoc T_CHECKPOINT = "CHECKPOINT";
340     static final String JavaDoc T_CLASS = "CLASS";
341     static final String JavaDoc T_COALESCE = "COALESCE";
342     static final String JavaDoc T_COLLATION = "COLLATION";
343     static final String JavaDoc T_COMPACT = "COMPACT";
344     public static final String JavaDoc T_COMPRESSED = "COMPRESSED";
345     static final String JavaDoc T_CONVERT = "CONVERT";
346     static final String JavaDoc T_COUNT = "COUNT";
347     static final String JavaDoc T_DATABASE = "DATABASE";
348     static final String JavaDoc T_DEFRAG = "DEFRAG";
349     static final String JavaDoc T_DESC = "DESC";
350     static final String JavaDoc T_EVERY = "EVERY";
351     static final String JavaDoc T_EXPLAIN = "EXPLAIN";
352     static final String JavaDoc T_EXTRACT = "EXTRACT";
353     static final String JavaDoc T_GENERATED = "GENERATED";
354     static final String JavaDoc T_IFNULL = "IFNULL";
355     static final String JavaDoc T_IGNORECASE = "IGNORECASE";
356     static final String JavaDoc T_IMMEDIATELY = "IMMEDIATELY";
357     static final String JavaDoc T_INCREMENT = "INCREMENT";
358     static final String JavaDoc T_INDEX = "INDEX";
359     static final String JavaDoc T_INITIAL = "INITIAL";
360     static final String JavaDoc T_KEY = "KEY";
361     static final String JavaDoc T_LIMIT = "LIMIT";
362     static final String JavaDoc T_LOGSIZE = "LOGSIZE";
363     static final String JavaDoc T_MAX = "MAX";
364     static final String JavaDoc T_MAXROWS = "MAXROWS";
365     static final String JavaDoc T_MEMORY = "MEMORY";
366     static final String JavaDoc T_MERGE = "MERGE";
367     static final String JavaDoc T_MIN = "MIN";
368     static final String JavaDoc T_MINUS = "MINUS";
369     static final String JavaDoc T_NOW = "NOW";
370     static final String JavaDoc T_NOWAIT = "NOWAIT";
371     static final String JavaDoc T_NULLIF = "NULLIF";
372     static final String JavaDoc T_NVL = "NVL";
373     static final String JavaDoc T_OFFSET = "OFFSET";
374     static final String JavaDoc T_PASSWORD = "PASSWORD";
375     public static final String JavaDoc T_SCHEMA = "SCHEMA";
376     static final String JavaDoc T_PLAN = "PLAN";
377     static final String JavaDoc T_PRESERVE = "PRESERVE";
378     static final String JavaDoc T_PRIVILEGES = "PRIVILEGES";
379     static final String JavaDoc T_POSITION = "POSITION";
380     static final String JavaDoc T_PROPERTY = "PROPERTY";
381     static final String JavaDoc T_PUBLIC = "PUBLIC";
382     static final String JavaDoc T_QUEUE = "QUEUE";
383     static final String JavaDoc T_READONLY = "READONLY";
384     static final String JavaDoc T_REFERENTIAL_INTEGRITY = "REFERENTIAL_INTEGRITY";
385     static final String JavaDoc T_RENAME = "RENAME";
386     static final String JavaDoc T_RESTART = "RESTART";
387     static final String JavaDoc T_RESTRICT = "RESTRICT";
388     static final String JavaDoc T_ROLE = "ROLE";
389     static final String JavaDoc T_SCRIPT = "SCRIPT";
390     static final String JavaDoc T_SCRIPTFORMAT = "SCRIPTFORMAT";
391     static final String JavaDoc T_SEQUENCE = "SEQUENCE";
392     static final String JavaDoc T_SHUTDOWN = "SHUTDOWN";
393     static final String JavaDoc T_SOURCE = "SOURCE";
394     static final String JavaDoc T_STDDEV_POP = "STDDEV_POP";
395     static final String JavaDoc T_STDDEV_SAMP = "STDDEV_SAMP";
396     static final String JavaDoc T_SUBSTRING = "SUBSTRING";
397     static final String JavaDoc T_SUM = "SUM";
398     static final String JavaDoc T_SYSDATE = "SYSDATE";
399     static final String JavaDoc T_TEMP = "TEMP";
400     static final String JavaDoc T_TEMPORARY = "TEMPORARY";
401     public static final String JavaDoc T_TEXT = "TEXT";
402     static final String JavaDoc T_TODAY = "TODAY";
403     static final String JavaDoc T_TOP = "TOP";
404     static final String JavaDoc T_TRIM = "TRIM";
405     static final String JavaDoc T_VAR_POP = "VAR_POP";
406     static final String JavaDoc T_VAR_SAMP = "VAR_SAMP";
407     static final String JavaDoc T_VIEW = "VIEW";
408     static final String JavaDoc T_WORK = "WORK";
409     static final String JavaDoc T_WRITE_DELAY = "WRITE_DELAY";
410
411     // SQL 200n token values
412
static final int ADD = 1;
413     static final int ALL = 2;
414     static final int ALLOCATE = 3;
415     static final int ALTER = 4;
416     static final int AND = 5;
417     static final int ANY = 6;
418     static final int ARE = 7;
419     static final int ARRAY = 8;
420     static final int AS = 9;
421     static final int ASENSITIVE = 10;
422     static final int ASYMMETRIC = 11;
423     static final int AT = 12;
424     static final int ATOMIC = 13;
425     static final int AUTHORIZATION = 14;
426     static final int BEGIN = 15;
427     static final int BETWEEN = 16;
428     static final int BIGINT = 17;
429     static final int BINARY = 18;
430     static final int BLOB = 19;
431     static final int BOOLEAN = 20;
432     static final int BOTH = 21;
433     static final int BY = 22;
434     public static final int CALL = 23;
435     static final int CALLED = 24;
436     static final int CASCADED = 25;
437     static final int CASE = 26;
438     static final int CAST = 27;
439     static final int CHAR = 28;
440     static final int CHARACTER = 29;
441     static final int CHECK = 30;
442     static final int CLOB = 31;
443     static final int CLOSE = 32;
444     static final int COLLATE = 33;
445     static final int COLUMN = 34;
446     static final int COMMIT = 35;
447     static final int CONDITION = 36;
448     static final int CONNECT = 37;
449     static final int CONSTRAINT = 38;
450     static final int CONTINUE = 39;
451     static final int CORRESPONDING = 40;
452     static final int CREATE = 41;
453     static final int CROSS = 42;
454     static final int CUBE = 43;
455     static final int CURRENT = 44;
456     static final int CURRENT_DATE = 45;
457     static final int CURRENT_DEFAULT_TRANSFORM_GRO = 46;
458     static final int CURRENT_PATH = 47;
459     static final int CURRENT_ROLE = 48;
460     static final int CURRENT_TIME = 49;
461     static final int CURRENT_TIMESTAMP = 50;
462     static final int CURRENT_TRANSFORM_GROUP_FOR_T = 51;
463     static final int CURRENT_USER = 52;
464     static final int CURSOR = 53;
465     static final int CYCLE = 54;
466     static final int DATE = 55;
467     static final int DAY = 56;
468     static final int DEALLOCATE = 57;
469     static final int DEC = 58;
470     static final int DECIMAL = 59;
471     static final int DECLARE = 60;
472     static final int DEFAULT = 61;
473     public static final int DELETE = 62;
474     static final int DEREF = 63;
475     static final int DESCRIBE = 64;
476     static final int DETERMINISTIC = 65;
477     static final int DISCONNECT = 66;
478     static final int DISTINCT = 67;
479     static final int DO = 68;
480     static final int DOUBLE = 69;
481     static final int DROP = 70;
482     static final int DYNAMIC = 71;
483     static final int EACH = 72;
484     static final int ELEMENT = 73;
485     static final int ELSE = 74;
486     static final int ELSEIF = 75;
487     static final int END = 76;
488     static final int ESCAPE = 77;
489     static final int EXCEPT = 78;
490     static final int EXEC = 79;
491     static final int EXECUTE = 80;
492     static final int EXISTS = 81;
493     static final int EXIT = 82;
494     static final int EXTERNAL = 83;
495     static final int FALSE = 84;
496     static final int FETCH = 85;
497     static final int FILTER = 86;
498     static final int FLOAT = 87;
499     static final int FOR = 88;
500     static final int FOREIGN = 89;
501     static final int FREE = 90;
502     static final int FROM = 91;
503     static final int FULL = 92;
504     static final int FUNCTION = 93;
505     static final int GET = 94;
506     static final int GLOBAL = 95;
507     static final int GRANT = 96;
508     static final int GROUP = 97;
509     static final int GROUPING = 98;
510     static final int HANDLER = 99;
511     static final int HAVING = 100;
512     static final int HOLD = 101;
513     static final int HOUR = 102;
514     static final int IDENTITY = 103;
515     static final int IF = 104;
516     static final int IMMEDIATE = 105;
517     static final int IN = 106;
518     static final int INDICATOR = 107;
519     static final int INNER = 108;
520     static final int INOUT = 109;
521     static final int INPUT = 110;
522     static final int INSENSITIVE = 111;
523     public static final int INSERT = 112;
524     static final int INT = 113;
525     static final int INTEGER = 114;
526     static final int INTERSECT = 115;
527     static final int INTERVAL = 116;
528     static final int INTO = 117;
529     static final int IS = 118;
530     static final int ITERATE = 119;
531     static final int JOIN = 120;
532     static final int LANGUAGE = 121;
533     static final int LARGE = 122;
534     static final int LATERAL = 123;
535     static final int LEADING = 124;
536     static final int LEAVE = 125;
537     static final int LEFT = 126;
538     static final int LIKE = 127;
539     static final int LOCAL = 128;
540     static final int LOCALTIME = 129;
541     static final int LOCALTIMESTAMP = 130;
542     static final int LOOP = 131;
543     static final int MATCH = 132;
544     static final int MEMBER = 133;
545     static final int MERGE = 134;
546     static final int METHOD = 135;
547     static final int MINUTE = 136;
548     static final int MODIFIES = 137;
549     static final int MODULE = 138;
550     static final int MONTH = 139;
551     static final int MULTISET = 140;
552     static final int NATIONAL = 141;
553     static final int NATURAL = 142;
554     static final int NCHAR = 143;
555     static final int NCLOB = 144;
556     static final int NEW = 145;
557     static final int NO = 146;
558     static final int NONE = 147;
559     static final int NOT = 148;
560     static final int NULL = 149;
561     static final int NUMERIC = 150;
562     static final int OF = 151;
563     static final int OLD = 152;
564     static final int ON = 153;
565     static final int ONLY = 154;
566     static final int OPEN = 155;
567     static final int OR = 156;
568     static final int ORDER = 157;
569     static final int OUT = 158;
570     static final int OUTER = 159;
571     static final int OUTPUT = 160;
572     static final int OVER = 161;
573     static final int OVERLAPS = 162;
574     static final int PARAMETER = 163;
575     static final int PARTITION = 164;
576     static final int PRECISION = 165;
577     static final int PREPARE = 166;
578     static final int PRIMARY = 167;
579     static final int PROCEDURE = 168;
580     static final int RANGE = 169;
581     static final int READS = 170;
582     static final int REAL = 171;
583     static final int RECURSIVE = 172;
584     static final int REF = 173;
585     static final int REFERENCES = 174;
586     static final int REFERENCING = 175;
587     static final int RELEASE = 176;
588     static final int REPEAT = 177;
589     static final int RESIGNAL = 178;
590     static final int RESULT = 179;
591     static final int RETURN = 180;
592     static final int RETURNS = 181;
593     static final int REVOKE = 182;
594     static final int RIGHT = 183;
595     static final int ROLLBACK = 184;
596     static final int ROLLUP = 185;
597     static final int ROW = 186;
598     static final int ROWS = 187;
599     static final int SAVEPOINT = 188;
600     static final int SCOPE = 189;
601     static final int SCROLL = 190;
602     static final int SEARCH = 191;
603     static final int SECOND = 192;
604     public static final int SELECT = 193;
605     static final int SENSITIVE = 194;
606     static final int SESSION_USER = 195;
607     static final int SET = 196;
608     static final int SIGNAL = 197;
609     static final int SIMILAR = 198;
610     static final int SMALLINT = 199;
611     static final int SOME = 200;
612     static final int SPECIFIC = 201;
613     static final int SPECIFICTYPE = 202;
614     static final int SQL = 203;
615     static final int SQLEXCEPTION = 204;
616     static final int SQLSTATE = 205;
617     static final int SQLWARNING = 206;
618     static final int START = 207;
619     static final int STATIC = 208;
620     static final int SUBMULTISET = 209;
621     static final int SYMMETRIC = 210;
622     static final int SYSTEM = 211;
623     static final int SYSTEM_USER = 212;
624     static final int TABLE = 213;
625     static final int TABLESAMPLE = 214;
626     static final int THEN = 215;
627     static final int TIME = 216;
628     static final int TIMESTAMP = 217;
629     static final int TIMEZONE_HOUR = 218;
630     static final int TIMEZONE_MINUTE = 219;
631     static final int TO = 220;
632     static final int TRAILING = 221;
633     static final int TRANSLATION = 222;
634     static final int TREAT = 223;
635     static final int TRIGGER = 224;
636     static final int TRUE = 225;
637     static final int UNDO = 226;
638     static final int UNION = 227;
639     static final int UNIQUE = 228;
640     static final int UNKNOWN = 229;
641     static final int UNNEST = 220;
642     static final int UNTIL = 221;
643     public static final int UPDATE = 222;
644     static final int USER = 223;
645     static final int USING = 224;
646     static final int VALUE = 225;
647     static final int VALUES = 226;
648     static final int VARCHAR = 227;
649     static final int VARYING = 228;
650     static final int WHEN = 229;
651     static final int WHENEVER = 230;
652     static final int WHERE = 231;
653     static final int WHILE = 232;
654     static final int WINDOW = 233;
655     static final int WITH = 234;
656     static final int WITHIN = 235;
657     static final int WITHOUT = 236;
658     static final int YEAR = 237;
659
660     // other token values used as switch cases
661
public static final int UNKNOWNTOKEN = -1;
662     static final int ALIAS = 300;
663     static final int AUTOCOMMIT = 301;
664     static final int CACHED = 302;
665     static final int CHECKPOINT = 303;
666     static final int EXPLAIN = 304;
667     static final int IGNORECASE = 305;
668     static final int INDEX = 306;
669     static final int LOGSIZE = 307;
670     static final int MATCHED = 308;
671     static final int MAXROWS = 309;
672     static final int MEMORY = 310;
673     static final int MINUS = 311;
674     static final int NEXT = 312;
675     static final int OPENBRACKET = 313;
676     static final int PASSWORD = 314;
677     static final int PLAN = 315;
678     static final int PROPERTY = 316;
679     static final int READONLY = 317;
680     static final int REFERENTIAL_INTEGRITY = 318;
681     static final int RENAME = 319;
682     static final int RESTART = 320;
683     static final int SCRIPT = 321;
684     static final int SCRIPTFORMAT = 322;
685     static final int SEMICOLON = 323;
686     static final int SEQUENCE = 324;
687     static final int SHUTDOWN = 325;
688     static final int SOURCE = 326;
689     static final int TEMP = 327;
690     static final int TEXT = 328;
691     static final int VIEW = 329;
692     static final int WRITE_DELAY = 330;
693
694     // added stuff
695
static final int VAR_POP = 330;
696     static final int VAR_SAMP = 331;
697     static final int STDDEV_POP = 332;
698     static final int STDDEV_SAMP = 333;
699     static final int DEFRAG = 334;
700     static final int INCREMENT = 335;
701     static final int TOCHAR = 336;
702     static final int DATABASE = 337;
703     static final int SCHEMA = 338;
704     static final int ROLE = 339;
705     static final int DOW = 340;
706     static final int INITIAL = 341;
707
708     //
709
static {
710         commandSet = newCommandSet();
711     }
712
713     /**
714      * Retrieves a new map from set of string tokens to numeric tokens for
715      * commonly encountered database command token occurences.
716      *
717      * @return a new map for the database command token set
718      */

719     private static IntValueHashMap newCommandSet() {
720
721         IntValueHashMap commandSet;
722
723         commandSet = new IntValueHashMap(67);
724
725         commandSet.put(T_ADD, ADD);
726         commandSet.put(T_ALIAS, ALIAS);
727         commandSet.put(T_ALTER, ALTER);
728         commandSet.put(T_AUTOCOMMIT, AUTOCOMMIT);
729         commandSet.put(T_CACHED, CACHED);
730         commandSet.put(T_CALL, CALL);
731         commandSet.put(T_CHECK, CHECK);
732         commandSet.put(T_CHECKPOINT, CHECKPOINT);
733         commandSet.put(T_COLUMN, COLUMN);
734         commandSet.put(T_COMMIT, COMMIT);
735         commandSet.put(T_CONNECT, CONNECT);
736         commandSet.put(T_CONSTRAINT, CONSTRAINT);
737         commandSet.put(T_CREATE, CREATE);
738         commandSet.put(T_DATABASE, DATABASE);
739         commandSet.put(T_DELETE, DELETE);
740         commandSet.put(T_DEFRAG, DEFRAG);
741         commandSet.put(T_DISCONNECT, DISCONNECT);
742         commandSet.put(T_DROP, DROP);
743         commandSet.put(T_EXCEPT, EXCEPT);
744         commandSet.put(T_EXPLAIN, EXPLAIN);
745         commandSet.put(T_FOREIGN, FOREIGN);
746         commandSet.put(T_GRANT, GRANT);
747         commandSet.put(T_IGNORECASE, IGNORECASE);
748         commandSet.put(T_INCREMENT, INCREMENT);
749         commandSet.put(T_INDEX, INDEX);
750         commandSet.put(T_INITIAL, INITIAL);
751         commandSet.put(T_INSERT, INSERT);
752         commandSet.put(T_INTERSECT, INTERSECT);
753         commandSet.put(T_LOGSIZE, LOGSIZE);
754         commandSet.put(T_MAXROWS, MAXROWS);
755         commandSet.put(T_MEMORY, MEMORY);
756         commandSet.put(T_MINUS, MINUS);
757         commandSet.put(T_NEXT, NEXT);
758         commandSet.put(T_NOT, NOT);
759         commandSet.put(T_OPENBRACKET, OPENBRACKET);
760         commandSet.put(T_PASSWORD, PASSWORD);
761         commandSet.put(T_PLAN, PLAN);
762         commandSet.put(T_PRIMARY, PRIMARY);
763         commandSet.put(T_PROPERTY, PROPERTY);
764         commandSet.put(T_READONLY, READONLY);
765         commandSet.put(T_REFERENTIAL_INTEGRITY, REFERENTIAL_INTEGRITY);
766         commandSet.put(T_RELEASE, RELEASE);
767         commandSet.put(T_RENAME, RENAME);
768         commandSet.put(T_RESTART, RESTART);
769         commandSet.put(T_REVOKE, REVOKE);
770         commandSet.put(T_ROLE, ROLE);
771         commandSet.put(T_ROLLBACK, ROLLBACK);
772         commandSet.put(T_SAVEPOINT, SAVEPOINT);
773         commandSet.put(T_SCRIPT, SCRIPT);
774         commandSet.put(T_SCRIPTFORMAT, SCRIPTFORMAT);
775         commandSet.put(T_SELECT, SELECT);
776         commandSet.put(T_SEMICOLON, SEMICOLON);
777         commandSet.put(T_SEQUENCE, SEQUENCE);
778         commandSet.put(T_SET, SET);
779         commandSet.put(T_SHUTDOWN, SHUTDOWN);
780         commandSet.put(T_SOURCE, SOURCE);
781         commandSet.put(T_TABLE, TABLE);
782         commandSet.put(T_TEMP, TEMP);
783         commandSet.put(T_TEXT, TEXT);
784         commandSet.put(T_TRIGGER, TRIGGER);
785         commandSet.put(T_UNIQUE, UNIQUE);
786         commandSet.put(T_UPDATE, UPDATE);
787         commandSet.put(T_UNION, UNION);
788         commandSet.put(T_USER, USER);
789         commandSet.put(T_VALUES, VALUES);
790         commandSet.put(T_VIEW, VIEW);
791         commandSet.put(T_WRITE_DELAY, WRITE_DELAY);
792         commandSet.put(T_SCHEMA, SCHEMA);
793
794         return commandSet;
795     }
796
797     public static int get(String JavaDoc token) {
798         return commandSet.get(token, -1);
799     }
800
801     private static HashSet keywords;
802     static IntValueHashMap valueTokens;
803
804     static {
805
806         // literals not allowed as table / column names
807
keywords = new HashSet(67);
808
809         // fredt - if we add MONTH, DAY, YEAR etc. MONTH(), DAY() et al will no longer work
810
// following tokens are values
811

812         /* "FALSE",*/
813         /* "TRUE",*/
814         /* "NULL", */
815
816         /** @todo perhaps rename LEFT() */
817
818         // following token is excluded to allow LEFT() function to work
819

820         /* "LEFT" ,*/
821         String JavaDoc[] keyword = {
822             Token.T_AS, Token.T_AND, Token.T_ALL, Token.T_ANY, Token.T_AVG,
823             Token.T_BY, Token.T_BETWEEN, Token.T_BOTH, Token.T_CALL,
824             Token.T_CASE, Token.T_CASEWHEN, Token.T_CAST, Token.T_CONVERT,
825             Token.T_COUNT, Token.T_COALESCE, Token.T_DISTINCT, Token.T_ELSE,
826             Token.T_END, Token.T_EVERY, Token.T_EXISTS, Token.T_EXCEPT,
827             Token.T_EXTRACT, Token.T_FOR, Token.T_FROM, Token.T_GROUP,
828             Token.T_HAVING, Token.T_IF, Token.T_INTO, Token.T_IFNULL,
829             Token.T_IS, Token.T_IN, Token.T_INTERSECT, Token.T_JOIN,
830             Token.T_INNER, Token.T_LEADING, Token.T_LIKE, Token.T_MAX,
831             Token.T_MIN, Token.T_NEXT, Token.T_NULLIF, Token.T_NOT,
832             Token.T_NVL, Token.T_MINUS, Token.T_ON, Token.T_ORDER, Token.T_OR,
833             Token.T_OUTER, Token.T_POSITION, Token.T_PRIMARY, Token.T_SELECT,
834             Token.T_SET, Token.T_SOME, Token.T_STDDEV_POP,
835             Token.T_STDDEV_SAMP, Token.T_SUBSTRING, Token.T_SUM, Token.T_THEN,
836             Token.T_TO, Token.T_TRAILING, Token.T_TRIM, Token.T_UNIQUE,
837             Token.T_UNION, Token.T_VALUES, Token.T_VAR_POP, Token.T_VAR_SAMP,
838             Token.T_WHEN, Token.T_WHERE,
839         };
840
841         for (int i = 0; i < keyword.length; i++) {
842             keywords.add(keyword[i]);
843         }
844     }
845
846     public static boolean isKeyword(String JavaDoc token) {
847         return keywords.contains(token);
848     }
849 }
850
Popular Tags