📄 token.java
字号:
static final int REAL = 171;
static final int RECURSIVE = 172;
static final int REF = 173;
static final int REFERENCES = 174;
static final int REFERENCING = 175;
static final int RELEASE = 176;
static final int REPEAT = 177;
static final int RESIGNAL = 178;
static final int RESULT = 179;
static final int RETURN = 180;
static final int RETURNS = 181;
static final int REVOKE = 182;
static final int RIGHT = 183;
static final int ROLLBACK = 184;
static final int ROLLUP = 185;
static final int ROW = 186;
static final int ROWS = 187;
static final int SAVEPOINT = 188;
static final int SCOPE = 189;
static final int SCROLL = 190;
static final int SEARCH = 191;
static final int SECOND = 192;
public static final int SELECT = 193;
static final int SENSITIVE = 194;
static final int SESSION_USER = 195;
static final int SET = 196;
static final int SIGNAL = 197;
static final int SIMILAR = 198;
static final int SMALLINT = 199;
static final int SOME = 200;
static final int SPECIFIC = 201;
static final int SPECIFICTYPE = 202;
static final int SQL = 203;
static final int SQLEXCEPTION = 204;
static final int SQLSTATE = 205;
static final int SQLWARNING = 206;
static final int START = 207;
static final int STATIC = 208;
static final int SUBMULTISET = 209;
static final int SYMMETRIC = 210;
static final int SYSTEM = 211;
static final int SYSTEM_USER = 212;
static final int TABLE = 213;
static final int TABLESAMPLE = 214;
static final int THEN = 215;
static final int TIME = 216;
static final int TIMESTAMP = 217;
static final int TIMEZONE_HOUR = 218;
static final int TIMEZONE_MINUTE = 219;
static final int TO = 220;
static final int TRAILING = 221;
static final int TRANSLATION = 222;
static final int TREAT = 223;
static final int TRIGGER = 224;
static final int TRUE = 225;
static final int UNDO = 226;
static final int UNION = 227;
static final int UNIQUE = 228;
static final int UNKNOWN = 229;
static final int UNNEST = 220;
static final int UNTIL = 221;
public static final int UPDATE = 222;
static final int USER = 223;
static final int USING = 224;
static final int VALUE = 225;
static final int VALUES = 226;
static final int VARCHAR = 227;
static final int VARYING = 228;
static final int WHEN = 229;
static final int WHENEVER = 230;
static final int WHERE = 231;
static final int WHILE = 232;
static final int WINDOW = 233;
static final int WITH = 234;
static final int WITHIN = 235;
static final int WITHOUT = 236;
static final int YEAR = 237;
// other token values used as switch cases
public static final int UNKNOWNTOKEN = -1;
static final int ALIAS = 300;
static final int AUTOCOMMIT = 301;
static final int CACHED = 302;
static final int CHECKPOINT = 303;
static final int EXPLAIN = 304;
static final int IGNORECASE = 305;
static final int INDEX = 306;
static final int LOGSIZE = 307;
static final int MATCHED = 308;
static final int MAXROWS = 309;
static final int MEMORY = 310;
static final int MINUS = 311;
static final int NEXT = 312;
static final int OPENBRACKET = 313;
static final int PASSWORD = 314;
static final int PLAN = 315;
static final int PROPERTY = 316;
static final int READONLY = 317;
static final int REFERENTIAL_INTEGRITY = 318;
static final int RENAME = 319;
static final int RESTART = 320;
static final int SCRIPT = 321;
static final int SCRIPTFORMAT = 322;
static final int SEMICOLON = 323;
static final int SEQUENCE = 324;
static final int SHUTDOWN = 325;
static final int SOURCE = 326;
static final int TEMP = 327;
static final int TEXT = 328;
static final int VIEW = 329;
static final int WRITE_DELAY = 330;
// added stuff
static final int VAR_POP = 330;
static final int VAR_SAMP = 331;
static final int STDDEV_POP = 332;
static final int STDDEV_SAMP = 333;
static final int DEFRAG = 334;
static final int INCREMENT = 335;
static final int TOCHAR = 336;
static final int DATABASE = 337;
static final int SCHEMA = 338;
static final int ROLE = 339;
static final int DOW = 340;
static final int INITIAL = 341;
//
static {
commandSet = newCommandSet();
}
/**
* Retrieves a new map from set of string tokens to numeric tokens for
* commonly encountered database command token occurences.
*
* @return a new map for the database command token set
*/
private static HashMap<String, Integer> newCommandSet() {
HashMap<String, Integer> commandSet;
commandSet = new HashMap<String, Integer>(67);
commandSet.put(T_ADD, ADD);
commandSet.put(T_ALIAS, ALIAS);
commandSet.put(T_ALTER, ALTER);
commandSet.put(T_AUTOCOMMIT, AUTOCOMMIT);
commandSet.put(T_CACHED, CACHED);
commandSet.put(T_CALL, CALL);
commandSet.put(T_CHECK, CHECK);
commandSet.put(T_CHECKPOINT, CHECKPOINT);
commandSet.put(T_COLUMN, COLUMN);
commandSet.put(T_COMMIT, COMMIT);
commandSet.put(T_CONNECT, CONNECT);
commandSet.put(T_CONSTRAINT, CONSTRAINT);
commandSet.put(T_CREATE, CREATE);
commandSet.put(T_DATABASE, DATABASE);
commandSet.put(T_DELETE, DELETE);
commandSet.put(T_DEFRAG, DEFRAG);
commandSet.put(T_DISCONNECT, DISCONNECT);
commandSet.put(T_DROP, DROP);
commandSet.put(T_EXCEPT, EXCEPT);
commandSet.put(T_EXPLAIN, EXPLAIN);
commandSet.put(T_FOREIGN, FOREIGN);
commandSet.put(T_GRANT, GRANT);
commandSet.put(T_IGNORECASE, IGNORECASE);
commandSet.put(T_INCREMENT, INCREMENT);
commandSet.put(T_INDEX, INDEX);
commandSet.put(T_INITIAL, INITIAL);
commandSet.put(T_INSERT, INSERT);
commandSet.put(T_INTERSECT, INTERSECT);
commandSet.put(T_LOGSIZE, LOGSIZE);
commandSet.put(T_MAXROWS, MAXROWS);
commandSet.put(T_MEMORY, MEMORY);
commandSet.put(T_MINUS, MINUS);
commandSet.put(T_NEXT, NEXT);
commandSet.put(T_NOT, NOT);
commandSet.put(T_OPENBRACKET, OPENBRACKET);
commandSet.put(T_PASSWORD, PASSWORD);
commandSet.put(T_PLAN, PLAN);
commandSet.put(T_PRIMARY, PRIMARY);
commandSet.put(T_PROPERTY, PROPERTY);
commandSet.put(T_READONLY, READONLY);
commandSet.put(T_REFERENTIAL_INTEGRITY, REFERENTIAL_INTEGRITY);
commandSet.put(T_RELEASE, RELEASE);
commandSet.put(T_RENAME, RENAME);
commandSet.put(T_RESTART, RESTART);
commandSet.put(T_REVOKE, REVOKE);
commandSet.put(T_ROLE, ROLE);
commandSet.put(T_ROLLBACK, ROLLBACK);
commandSet.put(T_SAVEPOINT, SAVEPOINT);
commandSet.put(T_SCRIPT, SCRIPT);
commandSet.put(T_SCRIPTFORMAT, SCRIPTFORMAT);
commandSet.put(T_SELECT, SELECT);
commandSet.put(T_SEMICOLON, SEMICOLON);
commandSet.put(T_SEQUENCE, SEQUENCE);
commandSet.put(T_SET, SET);
commandSet.put(T_SHUTDOWN, SHUTDOWN);
commandSet.put(T_SOURCE, SOURCE);
commandSet.put(T_TABLE, TABLE);
commandSet.put(T_TEMP, TEMP);
commandSet.put(T_TEXT, TEXT);
commandSet.put(T_TRIGGER, TRIGGER);
commandSet.put(T_UNIQUE, UNIQUE);
commandSet.put(T_UPDATE, UPDATE);
commandSet.put(T_UNION, UNION);
commandSet.put(T_USER, USER);
commandSet.put(T_VALUES, VALUES);
commandSet.put(T_VIEW, VIEW);
commandSet.put(T_WRITE_DELAY, WRITE_DELAY);
commandSet.put(T_SCHEMA, SCHEMA);
return commandSet;
}
public static int get(String token) {
return commandSet.get(token);
}
private static HashSet<String> keywords;
static {
// literals not allowed as table / column names
keywords = new HashSet<String>(67);
// fredt - if we add MONTH, DAY, YEAR etc. MONTH(), DAY() et al will no longer work
// following tokens are values
/* "FALSE",*/
/* "TRUE",*/
/* "NULL", */
/** @todo perhaps rename LEFT() */
// following token is excluded to allow LEFT() function to work
/* "LEFT" ,*/
String[] keyword = {
Token.T_AS, Token.T_AND, Token.T_ALL, Token.T_ANY, Token.T_AVG,
Token.T_BY, Token.T_BETWEEN, Token.T_BOTH, Token.T_CALL,
Token.T_CASE, Token.T_CASEWHEN, Token.T_CAST, Token.T_CONVERT,
Token.T_COUNT, Token.T_COALESCE, Token.T_DISTINCT, Token.T_ELSE,
Token.T_END, Token.T_EVERY, Token.T_EXISTS, Token.T_EXCEPT,
Token.T_EXTRACT, Token.T_FOR, Token.T_FROM, Token.T_GROUP,
Token.T_HAVING, Token.T_IF, Token.T_INTO, Token.T_IFNULL,
Token.T_IS, Token.T_IN, Token.T_INTERSECT, Token.T_JOIN,
Token.T_INNER, Token.T_LEADING, Token.T_LIKE, Token.T_MAX,
Token.T_MIN, Token.T_NEXT, Token.T_NULLIF, Token.T_NOT,
Token.T_NVL, Token.T_MINUS, Token.T_ON, Token.T_ORDER, Token.T_OR,
Token.T_OUTER, Token.T_POSITION, Token.T_PRIMARY, Token.T_SELECT,
Token.T_SET, Token.T_SOME, Token.T_STDDEV_POP, Token.T_STDDEV_SAMP,
Token.T_SUBSTRING, Token.T_SUM, Token.T_THEN, Token.T_TO,
Token.T_TRAILING, Token.T_TRIM, Token.T_UNIQUE, Token.T_UNION,
Token.T_VALUES, Token.T_VAR_POP, Token.T_VAR_SAMP, Token.T_WHEN,
Token.T_WHERE,
};
for (String k : keyword) {
keywords.add(k);
}
}
public static boolean isKeyword(String token) {
return keywords.contains(token);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -