Top Fields Constructors Methods
org.h2.util

public Class ParserUtil

extends Object
Class Inheritance
Imports
java.util.HashMap

Field Summary

Modifier and TypeField and Description
public static final int
_ROWID_

The token "_ROWID_".

public static final int
ALL

The token "ALL".

public static final int
AND

The token "AND".

public static final int
ANY

The token "ANY".

public static final int
ARRAY

The token "ARRAY".

public static final int
AS

The token "AS".

public static final int
ASYMMETRIC

The token "ASYMMETRIC".

public static final int
AUTHORIZATION

The token "AUTHORIZATION".

public static final int
BETWEEN

The token "BETWEEN".

public static final int
CASE

The token "CASE".

public static final int
CAST

The token "CAST".

public static final int
CHECK

The token "CHECK".

public static final int
CONSTRAINT

The token "CONSTRAINT".

public static final int
CROSS

The token "CROSS".

public static final int
CURRENT_CATALOG

The token "CURRENT_CATALOG".

public static final int
CURRENT_DATE

The token "CURRENT_DATE".

public static final int
CURRENT_PATH

The token "CURRENT_PATH".

public static final int
CURRENT_ROLE

The token "CURRENT_ROLE".

public static final int
CURRENT_SCHEMA

The token "CURRENT_SCHEMA".

public static final int
CURRENT_TIME

The token "CURRENT_TIME".

public static final int
CURRENT_TIMESTAMP

The token "CURRENT_TIMESTAMP".

public static final int
CURRENT_USER

The token "CURRENT_USER".

public static final int
DAY

The token "DAY".

public static final int
DEFAULT

The token "DEFAULT".

public static final int
DISTINCT

The token "DISTINCT".

public static final int
ELSE

The token "ELSE".

public static final int
END

The token "END".

public static final int
EXCEPT

The token "EXCEPT".

public static final int
EXISTS

The token "EXISTS".

public static final int
FALSE

The token "FALSE".

public static final int
FETCH

The token "FETCH".

public static final int
FIRST_KEYWORD

The ordinal number of the first keyword.

public static final int
FOR

The token "FOR".

public static final int
FOREIGN

The token "FOREIGN".

public static final int
FROM

The token "FROM".

public static final int
FULL

The token "FULL".

public static final int
GROUP

The token "GROUP".

public static final int
HAVING

The token "HAVING".

public static final int
HOUR

The token "HOUR".

public static final int
IDENTIFIER

An identifier (table name, column name,...).

public static final int
IF

The token "IF".

public static final int
IN

The token "IN".

public static final int
INNER

The token "INNER".

public static final int
INTERSECT

The token "INTERSECT".

public static final int
INTERVAL

The token "INTERVAL".

public static final int
IS

The token "IS".

public static final int
JOIN

The token "JOIN".

public static final int
KEY

The token "KEY".

public static final int
KEYWORD

A keyword.

private static final HashMap<String, Integer>
public static final int
LAST_KEYWORD

The ordinal number of the last keyword.

public static final int
LEFT

The token "LEFT".

public static final int
LIKE

The token "LIKE".

public static final int
LIMIT

The token "LIMIT".

public static final int
LOCALTIME

The token "LOCALTIME".

public static final int
LOCALTIMESTAMP

The token "LOCALTIMESTAMP".

public static final int
MINUS

The token "MINUS".

public static final int
MINUTE

The token "MINUTE".

public static final int
MONTH

The token "MONTH".

public static final int
NATURAL

The token "NATURAL".

public static final int
NOT

The token "NOT".

public static final int
NULL

The token "NULL".

public static final int
OFFSET

The token "OFFSET".

public static final int
ON

The token "ON".

public static final int
OR

The token "OR".

public static final int
ORDER

The token "ORDER".

public static final int
PRIMARY

The token "PRIMARY".

public static final int
QUALIFY

The token "QUALIFY".

public static final int
RIGHT

The token "RIGHT".

public static final int
ROW

The token "ROW".

public static final int
ROWNUM

The token "ROWNUM".

public static final int
SECOND

The token "SECOND".

public static final int
SELECT

The token "SELECT".

public static final int
SESSION_USER

The token "SESSION_USER".

public static final int
SET

The token "SET".

public static final int
SOME

The token "SOME".

public static final int
SYMMETRIC

The token "SYMMETRIC".

public static final int
SYSTEM_USER

The token "SYSTEM_USER".

public static final int
TABLE

The token "TABLE".

public static final int
TO

The token "TO".

public static final int
TRUE

The token "TRUE".

public static final int
UESCAPE

The token "UESCAPE".

public static final int
UNION

The token "UNION".

public static final int
UNIQUE

The token "UNIQUE".

public static final int
UNKNOWN

The token "UNKNOWN".

public static final int
USER

The token "USER".

public static final int
USING

The token "USING".

public static final int
VALUE

The token "VALUE".

public static final int
VALUES

The token "VALUES".

public static final int
WHEN

The token "WHEN".

public static final int
WHERE

The token "WHERE".

public static final int
WINDOW

The token "WINDOW".

public static final int
WITH

The token "WITH".

public static final int
YEAR

The token "YEAR".

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static boolean
checkLetter(boolean databaseToUpper, boolean databaseToLower, char c)

public static int

Returns:

the token type
getTokenType
(String
the string with token
s
,
boolean
true if case should be ignored, false if only upper case tokens are detected as keywords
ignoreCase
,
boolean
whether context-sensitive keywords are returned as KEYWORD
additionalKeywords
)

Get the token type.

public static boolean

Returns:

true if it is a keyword
isKeyword
(String
the token to check
s
,
boolean
true if case should be ignored, false if only upper case tokens are detected as keywords
ignoreCase
)

Checks if this string is a SQL keyword.

public static boolean

Returns:

is specified identifier may be used without quotes
isSimpleIdentifier
(String
identifier to check
s
,
boolean
whether unquoted identifiers are converted to upper case
databaseToUpper
,
boolean
whether unquoted identifiers are converted to lower case
databaseToLower
)

Is this a simple identifier (in the JDBC specification sense).

public static StringBuilder

Returns:

the specified builder
quoteIdentifier
(StringBuilder
string builder to append to
builder
,
String
the identifier
s
,
int
formatting flags
sqlFlags
)

Add double quotes around an identifier if required and appends it to the specified string builder.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_ROWID_back to summary
public static final int _ROWID_

The token "_ROWID_".

ALLback to summary
public static final int ALL

The token "ALL".

ANDback to summary
public static final int AND

The token "AND".

ANYback to summary
public static final int ANY

The token "ANY".

ARRAYback to summary
public static final int ARRAY

The token "ARRAY".

ASback to summary
public static final int AS

The token "AS".

ASYMMETRICback to summary
public static final int ASYMMETRIC

The token "ASYMMETRIC".

AUTHORIZATIONback to summary
public static final int AUTHORIZATION

The token "AUTHORIZATION".

BETWEENback to summary
public static final int BETWEEN

The token "BETWEEN".

CASEback to summary
public static final int CASE

The token "CASE".

CASTback to summary
public static final int CAST

The token "CAST".

CHECKback to summary
public static final int CHECK

The token "CHECK".

CONSTRAINTback to summary
public static final int CONSTRAINT

The token "CONSTRAINT".

CROSSback to summary
public static final int CROSS

The token "CROSS".

CURRENT_CATALOGback to summary
public static final int CURRENT_CATALOG

The token "CURRENT_CATALOG".

CURRENT_DATEback to summary
public static final int CURRENT_DATE

The token "CURRENT_DATE".

CURRENT_PATHback to summary
public static final int CURRENT_PATH

The token "CURRENT_PATH".

CURRENT_ROLEback to summary
public static final int CURRENT_ROLE

The token "CURRENT_ROLE".

CURRENT_SCHEMAback to summary
public static final int CURRENT_SCHEMA

The token "CURRENT_SCHEMA".

CURRENT_TIMEback to summary
public static final int CURRENT_TIME

The token "CURRENT_TIME".

CURRENT_TIMESTAMPback to summary
public static final int CURRENT_TIMESTAMP

The token "CURRENT_TIMESTAMP".

CURRENT_USERback to summary
public static final int CURRENT_USER

The token "CURRENT_USER".

DAYback to summary
public static final int DAY

The token "DAY".

DEFAULTback to summary
public static final int DEFAULT

The token "DEFAULT".

DISTINCTback to summary
public static final int DISTINCT

The token "DISTINCT".

ELSEback to summary
public static final int ELSE

The token "ELSE".

ENDback to summary
public static final int END

The token "END".

EXCEPTback to summary
public static final int EXCEPT

The token "EXCEPT".

EXISTSback to summary
public static final int EXISTS

The token "EXISTS".

FALSEback to summary
public static final int FALSE

The token "FALSE".

FETCHback to summary
public static final int FETCH

The token "FETCH".

FIRST_KEYWORDback to summary
public static final int FIRST_KEYWORD

The ordinal number of the first keyword.

FORback to summary
public static final int FOR

The token "FOR".

FOREIGNback to summary
public static final int FOREIGN

The token "FOREIGN".

FROMback to summary
public static final int FROM

The token "FROM".

FULLback to summary
public static final int FULL

The token "FULL".

GROUPback to summary
public static final int GROUP

The token "GROUP".

HAVINGback to summary
public static final int HAVING

The token "HAVING".

HOURback to summary
public static final int HOUR

The token "HOUR".

IDENTIFIERback to summary
public static final int IDENTIFIER

An identifier (table name, column name,...).

IFback to summary
public static final int IF

The token "IF".

INback to summary
public static final int IN

The token "IN".

INNERback to summary
public static final int INNER

The token "INNER".

INTERSECTback to summary
public static final int INTERSECT

The token "INTERSECT".

INTERVALback to summary
public static final int INTERVAL

The token "INTERVAL".

ISback to summary
public static final int IS

The token "IS".

JOINback to summary
public static final int JOIN

The token "JOIN".

KEYback to summary
public static final int KEY

The token "KEY".

KEYWORDback to summary
public static final int KEYWORD

A keyword.

KEYWORDSback to summary
private static final HashMap<String, Integer> KEYWORDS
LAST_KEYWORDback to summary
public static final int LAST_KEYWORD

The ordinal number of the last keyword.

LEFTback to summary
public static final int LEFT

The token "LEFT".

LIKEback to summary
public static final int LIKE

The token "LIKE".

LIMITback to summary
public static final int LIMIT

The token "LIMIT".

LOCALTIMEback to summary
public static final int LOCALTIME

The token "LOCALTIME".

LOCALTIMESTAMPback to summary
public static final int LOCALTIMESTAMP

The token "LOCALTIMESTAMP".

MINUSback to summary
public static final int MINUS

The token "MINUS".

MINUTEback to summary
public static final int MINUTE

The token "MINUTE".

MONTHback to summary
public static final int MONTH

The token "MONTH".

NATURALback to summary
public static final int NATURAL

The token "NATURAL".

NOTback to summary
public static final int NOT

The token "NOT".

NULLback to summary
public static final int NULL

The token "NULL".

OFFSETback to summary
public static final int OFFSET

The token "OFFSET".

ONback to summary
public static final int ON

The token "ON".

ORback to summary
public static final int OR

The token "OR".

ORDERback to summary
public static final int ORDER

The token "ORDER".

PRIMARYback to summary
public static final int PRIMARY

The token "PRIMARY".

QUALIFYback to summary
public static final int QUALIFY

The token "QUALIFY".

ROWback to summary
public static final int ROW

The token "ROW".

ROWNUMback to summary
public static final int ROWNUM

The token "ROWNUM".

SECONDback to summary
public static final int SECOND

The token "SECOND".

SELECTback to summary
public static final int SELECT

The token "SELECT".

SESSION_USERback to summary
public static final int SESSION_USER

The token "SESSION_USER".

SETback to summary
public static final int SET

The token "SET".

SOMEback to summary
public static final int SOME

The token "SOME".

SYMMETRICback to summary
public static final int SYMMETRIC

The token "SYMMETRIC".

SYSTEM_USERback to summary
public static final int SYSTEM_USER

The token "SYSTEM_USER".

TABLEback to summary
public static final int TABLE

The token "TABLE".

TOback to summary
public static final int TO

The token "TO".

TRUEback to summary
public static final int TRUE

The token "TRUE".

UESCAPEback to summary
public static final int UESCAPE

The token "UESCAPE".

UNIONback to summary
public static final int UNION

The token "UNION".

UNIQUEback to summary
public static final int UNIQUE

The token "UNIQUE".

UNKNOWNback to summary
public static final int UNKNOWN

The token "UNKNOWN".

USERback to summary
public static final int USER

The token "USER".

USINGback to summary
public static final int USING

The token "USING".

VALUEback to summary
public static final int VALUE

The token "VALUE".

VALUESback to summary
public static final int VALUES

The token "VALUES".

WHENback to summary
public static final int WHEN

The token "WHEN".

WHEREback to summary
public static final int WHERE

The token "WHERE".

WINDOWback to summary
public static final int WINDOW

The token "WINDOW".

WITHback to summary
public static final int WITH

The token "WITH".

YEARback to summary
public static final int YEAR

The token "YEAR".

Constructor Detail

ParserUtilback to summary
private ParserUtil()

Method Detail

checkLetterback to summary
private static boolean checkLetter(boolean databaseToUpper, boolean databaseToLower, char c)
getTokenTypeback to summary
public static int getTokenType(String s, boolean ignoreCase, boolean additionalKeywords)

Get the token type.

Parameters
s:String

the string with token

ignoreCase:boolean

true if case should be ignored, false if only upper case tokens are detected as keywords

additionalKeywords:boolean

whether context-sensitive keywords are returned as KEYWORD

Returns:int

the token type

isKeywordback to summary
public static boolean isKeyword(String s, boolean ignoreCase)

Checks if this string is a SQL keyword.

Parameters
s:String

the token to check

ignoreCase:boolean

true if case should be ignored, false if only upper case tokens are detected as keywords

Returns:boolean

true if it is a keyword

isSimpleIdentifierback to summary
public static boolean isSimpleIdentifier(String s, boolean databaseToUpper, boolean databaseToLower)

Is this a simple identifier (in the JDBC specification sense).

Parameters
s:String

identifier to check

databaseToUpper:boolean

whether unquoted identifiers are converted to upper case

databaseToLower:boolean

whether unquoted identifiers are converted to lower case

Returns:boolean

is specified identifier may be used without quotes

Exceptions
NullPointerException:
if s is null
quoteIdentifierback to summary
public 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.

Parameters
builder:StringBuilder

string builder to append to

s:String

the identifier

sqlFlags:int

formatting flags

Returns:StringBuilder

the specified builder