Package org.h2.util
Class ParserUtil
java.lang.Object
org.h2.util.ParserUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The token "_ROWID_".static final int
The token "ALL".static final int
The token "AND".static final int
The token "ANY".static final int
The token "ARRAY".static final int
The token "AS".static final int
The token "ASYMMETRIC".static final int
The token "AUTHORIZATION".static final int
The token "BETWEEN".static final int
The token "CASE".static final int
The token "CAST".static final int
The token "CHECK".static final int
The token "CONSTRAINT".static final int
The token "CROSS".static final int
The token "CURRENT_CATALOG".static final int
The token "CURRENT_DATE".static final int
The token "CURRENT_PATH".static final int
The token "CURRENT_ROLE".static final int
The token "CURRENT_SCHEMA".static final int
The token "CURRENT_TIME".static final int
The token "CURRENT_TIMESTAMP".static final int
The token "CURRENT_USER".static final int
The token "DAY".static final int
The token "DEFAULT".static final int
The token "DISTINCT".static final int
The token "ELSE".static final int
The token "END".static final int
The token "EXCEPT".static final int
The token "EXISTS".static final int
The token "FALSE".static final int
The token "FETCH".static final int
The ordinal number of the first keyword.static final int
The token "FOR".static final int
The token "FOREIGN".static final int
The token "FROM".static final int
The token "FULL".static final int
The token "GROUP".static final int
The token "HAVING".static final int
The token "HOUR".static final int
An identifier (table name, column name,...).static final int
The token "IF".static final int
The token "IN".static final int
The token "INNER".static final int
The token "INTERSECT".static final int
The token "INTERVAL".static final int
The token "IS".static final int
The token "JOIN".static final int
The token "KEY".static final int
A keyword.static final int
The ordinal number of the last keyword.static final int
The token "LEFT".static final int
The token "LIKE".static final int
The token "LIMIT".static final int
The token "LOCALTIME".static final int
The token "LOCALTIMESTAMP".static final int
The token "MINUS".static final int
The token "MINUTE".static final int
The token "MONTH".static final int
The token "NATURAL".static final int
The token "NOT".static final int
The token "NULL".static final int
The token "OFFSET".static final int
The token "ON".static final int
The token "OR".static final int
The token "ORDER".static final int
The token "PRIMARY".static final int
The token "QUALIFY".static final int
The token "RIGHT".static final int
The token "ROW".static final int
The token "ROWNUM".static final int
The token "SECOND".static final int
The token "SELECT".static final int
The token "SESSION_USER".static final int
The token "SET".static final int
The token "SOME".static final int
The token "SYMMETRIC".static final int
The token "SYSTEM_USER".static final int
The token "TABLE".static final int
The token "TO".static final int
The token "TRUE".static final int
The token "UESCAPE".static final int
The token "UNION".static final int
The token "UNIQUE".static final int
The token "UNKNOWN".static final int
The token "USER".static final int
The token "USING".static final int
The token "VALUE".static final int
The token "VALUES".static final int
The token "WHEN".static final int
The token "WHERE".static final int
The token "WINDOW".static final int
The token "WITH".static final int
The token "YEAR". -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static boolean
checkLetter
(boolean databaseToUpper, boolean databaseToLower, char c) static int
getTokenType
(String s, boolean ignoreCase, boolean additionalKeywords) Get the token type.static boolean
Checks if this string is a SQL keyword.static boolean
isSimpleIdentifier
(String s, boolean databaseToUpper, boolean databaseToLower) Is this a simple identifier (in the JDBC specification sense).static StringBuilder
quoteIdentifier
(StringBuilder builder, String s, int sqlFlags) Add double quotes around an identifier if required and appends it to the specified string builder.
-
Field Details
-
KEYWORD
public static final int KEYWORDA keyword.- See Also:
-
IDENTIFIER
public static final int IDENTIFIERAn identifier (table name, column name,...).- See Also:
-
ALL
public static final int ALLThe token "ALL".- See Also:
-
AND
public static final int ANDThe token "AND".- See Also:
-
ANY
public static final int ANYThe token "ANY".- See Also:
-
ARRAY
public static final int ARRAYThe token "ARRAY".- See Also:
-
AS
public static final int ASThe token "AS".- See Also:
-
ASYMMETRIC
public static final int ASYMMETRICThe token "ASYMMETRIC".- See Also:
-
AUTHORIZATION
public static final int AUTHORIZATIONThe token "AUTHORIZATION".- See Also:
-
BETWEEN
public static final int BETWEENThe token "BETWEEN".- See Also:
-
CASE
public static final int CASEThe token "CASE".- See Also:
-
CAST
public static final int CASTThe token "CAST".- See Also:
-
CHECK
public static final int CHECKThe token "CHECK".- See Also:
-
CONSTRAINT
public static final int CONSTRAINTThe token "CONSTRAINT".- See Also:
-
CROSS
public static final int CROSSThe token "CROSS".- See Also:
-
CURRENT_CATALOG
public static final int CURRENT_CATALOGThe token "CURRENT_CATALOG".- See Also:
-
CURRENT_DATE
public static final int CURRENT_DATEThe token "CURRENT_DATE".- See Also:
-
CURRENT_PATH
public static final int CURRENT_PATHThe token "CURRENT_PATH".- See Also:
-
CURRENT_ROLE
public static final int CURRENT_ROLEThe token "CURRENT_ROLE".- See Also:
-
CURRENT_SCHEMA
public static final int CURRENT_SCHEMAThe token "CURRENT_SCHEMA".- See Also:
-
CURRENT_TIME
public static final int CURRENT_TIMEThe token "CURRENT_TIME".- See Also:
-
CURRENT_TIMESTAMP
public static final int CURRENT_TIMESTAMPThe token "CURRENT_TIMESTAMP".- See Also:
-
CURRENT_USER
public static final int CURRENT_USERThe token "CURRENT_USER".- See Also:
-
DAY
public static final int DAYThe token "DAY".- See Also:
-
DEFAULT
public static final int DEFAULTThe token "DEFAULT".- See Also:
-
DISTINCT
public static final int DISTINCTThe token "DISTINCT".- See Also:
-
ELSE
public static final int ELSEThe token "ELSE".- See Also:
-
END
public static final int ENDThe token "END".- See Also:
-
EXCEPT
public static final int EXCEPTThe token "EXCEPT".- See Also:
-
EXISTS
public static final int EXISTSThe token "EXISTS".- See Also:
-
FALSE
public static final int FALSEThe token "FALSE".- See Also:
-
FETCH
public static final int FETCHThe token "FETCH".- See Also:
-
FOR
public static final int FORThe token "FOR".- See Also:
-
FOREIGN
public static final int FOREIGNThe token "FOREIGN".- See Also:
-
FROM
public static final int FROMThe token "FROM".- See Also:
-
FULL
public static final int FULLThe token "FULL".- See Also:
-
GROUP
public static final int GROUPThe token "GROUP".- See Also:
-
HAVING
public static final int HAVINGThe token "HAVING".- See Also:
-
HOUR
public static final int HOURThe token "HOUR".- See Also:
-
IF
public static final int IFThe token "IF".- See Also:
-
IN
public static final int INThe token "IN".- See Also:
-
INNER
public static final int INNERThe token "INNER".- See Also:
-
INTERSECT
public static final int INTERSECTThe token "INTERSECT".- See Also:
-
INTERVAL
public static final int INTERVALThe token "INTERVAL".- See Also:
-
IS
public static final int ISThe token "IS".- See Also:
-
JOIN
public static final int JOINThe token "JOIN".- See Also:
-
KEY
public static final int KEYThe token "KEY".- See Also:
-
LEFT
public static final int LEFTThe token "LEFT".- See Also:
-
LIKE
public static final int LIKEThe token "LIKE".- See Also:
-
LIMIT
public static final int LIMITThe token "LIMIT".- See Also:
-
LOCALTIME
public static final int LOCALTIMEThe token "LOCALTIME".- See Also:
-
LOCALTIMESTAMP
public static final int LOCALTIMESTAMPThe token "LOCALTIMESTAMP".- See Also:
-
MINUS
public static final int MINUSThe token "MINUS".- See Also:
-
MINUTE
public static final int MINUTEThe token "MINUTE".- See Also:
-
MONTH
public static final int MONTHThe token "MONTH".- See Also:
-
NATURAL
public static final int NATURALThe token "NATURAL".- See Also:
-
NOT
public static final int NOTThe token "NOT".- See Also:
-
NULL
public static final int NULLThe token "NULL".- See Also:
-
OFFSET
public static final int OFFSETThe token "OFFSET".- See Also:
-
ON
public static final int ONThe token "ON".- See Also:
-
OR
public static final int ORThe token "OR".- See Also:
-
ORDER
public static final int ORDERThe token "ORDER".- See Also:
-
PRIMARY
public static final int PRIMARYThe token "PRIMARY".- See Also:
-
QUALIFY
public static final int QUALIFYThe token "QUALIFY".- See Also:
-
RIGHT
public static final int RIGHTThe token "RIGHT".- See Also:
-
ROW
public static final int ROWThe token "ROW".- See Also:
-
ROWNUM
public static final int ROWNUMThe token "ROWNUM".- See Also:
-
SECOND
public static final int SECONDThe token "SECOND".- See Also:
-
SELECT
public static final int SELECTThe token "SELECT".- See Also:
-
SESSION_USER
public static final int SESSION_USERThe token "SESSION_USER".- See Also:
-
SET
public static final int SETThe token "SET".- See Also:
-
SOME
public static final int SOMEThe token "SOME".- See Also:
-
SYMMETRIC
public static final int SYMMETRICThe token "SYMMETRIC".- See Also:
-
SYSTEM_USER
public static final int SYSTEM_USERThe token "SYSTEM_USER".- See Also:
-
TABLE
public static final int TABLEThe token "TABLE".- See Also:
-
TO
public static final int TOThe token "TO".- See Also:
-
TRUE
public static final int TRUEThe token "TRUE".- See Also:
-
UESCAPE
public static final int UESCAPEThe token "UESCAPE".- See Also:
-
UNION
public static final int UNIONThe token "UNION".- See Also:
-
UNIQUE
public static final int UNIQUEThe token "UNIQUE".- See Also:
-
UNKNOWN
public static final int UNKNOWNThe token "UNKNOWN".- See Also:
-
USER
public static final int USERThe token "USER".- See Also:
-
USING
public static final int USINGThe token "USING".- See Also:
-
VALUE
public static final int VALUEThe token "VALUE".- See Also:
-
VALUES
public static final int VALUESThe token "VALUES".- See Also:
-
WHEN
public static final int WHENThe token "WHEN".- See Also:
-
WHERE
public static final int WHEREThe token "WHERE".- See Also:
-
WINDOW
public static final int WINDOWThe token "WINDOW".- See Also:
-
WITH
public static final int WITHThe token "WITH".- See Also:
-
YEAR
public static final int YEARThe token "YEAR".- See Also:
-
_ROWID_
public static final int _ROWID_The token "_ROWID_".- See Also:
-
FIRST_KEYWORD
public static final int FIRST_KEYWORDThe ordinal number of the first keyword.- See Also:
-
LAST_KEYWORD
public static final int LAST_KEYWORDThe ordinal number of the last keyword.- See Also:
-
KEYWORDS
-
-
Constructor Details
-
ParserUtil
private ParserUtil()
-
-
Method Details
-
quoteIdentifier
Add double quotes around an identifier if required and appends it to the specified string builder.- Parameters:
builder
- string builder to append tos
- the identifiersqlFlags
- formatting flags- Returns:
- the specified builder
-
isKeyword
Checks if this string is a SQL keyword.- Parameters:
s
- the token to checkignoreCase
- true if case should be ignored, false if only upper case tokens are detected as keywords- Returns:
- true if it is a keyword
-
isSimpleIdentifier
public static boolean isSimpleIdentifier(String s, boolean databaseToUpper, boolean databaseToLower) Is this a simple identifier (in the JDBC specification sense).- Parameters:
s
- identifier to checkdatabaseToUpper
- whether unquoted identifiers are converted to upper casedatabaseToLower
- whether unquoted identifiers are converted to lower case- Returns:
- is specified identifier may be used without quotes
- Throws:
NullPointerException
- if s isnull
-
checkLetter
private static boolean checkLetter(boolean databaseToUpper, boolean databaseToLower, char c) -
getTokenType
Get the token type.- Parameters:
s
- the string with tokenignoreCase
- true if case should be ignored, false if only upper case tokens are detected as keywordsadditionalKeywords
- whether context-sensitive keywords are returned asKEYWORD
- Returns:
- the token type
-