Package org.h2.util

# Class ParserUtil

java.lang.Object
org.h2.util.ParserUtil

public class ParserUtil extends Object

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`_ROWID_`
The token "_ROWID_".
`static final int`
`ALL`
The token "ALL".
`static final int`
`AND`
The token "AND".
`static final int`
`ANY`
The token "ANY".
`static final int`
`ARRAY`
The token "ARRAY".
`static final int`
`AS`
The token "AS".
`static final int`
`ASYMMETRIC`
The token "ASYMMETRIC".
`static final int`
`AUTHORIZATION`
The token "AUTHORIZATION".
`static final int`
`BETWEEN`
The token "BETWEEN".
`static final int`
`CASE`
The token "CASE".
`static final int`
`CAST`
The token "CAST".
`static final int`
`CHECK`
The token "CHECK".
`static final int`
`CONSTRAINT`
The token "CONSTRAINT".
`static final int`
`CROSS`
The token "CROSS".
`static final int`
`CURRENT_CATALOG`
The token "CURRENT_CATALOG".
`static final int`
`CURRENT_DATE`
The token "CURRENT_DATE".
`static final int`
`CURRENT_PATH`
The token "CURRENT_PATH".
`static final int`
`CURRENT_ROLE`
The token "CURRENT_ROLE".
`static final int`
`CURRENT_SCHEMA`
The token "CURRENT_SCHEMA".
`static final int`
`CURRENT_TIME`
The token "CURRENT_TIME".
`static final int`
`CURRENT_TIMESTAMP`
The token "CURRENT_TIMESTAMP".
`static final int`
`CURRENT_USER`
The token "CURRENT_USER".
`static final int`
`DAY`
The token "DAY".
`static final int`
`DEFAULT`
The token "DEFAULT".
`static final int`
`DISTINCT`
The token "DISTINCT".
`static final int`
`ELSE`
The token "ELSE".
`static final int`
`END`
The token "END".
`static final int`
`EXCEPT`
The token "EXCEPT".
`static final int`
`EXISTS`
The token "EXISTS".
`static final int`
`FALSE`
The token "FALSE".
`static final int`
`FETCH`
The token "FETCH".
`static final int`
`FIRST_KEYWORD`
The ordinal number of the first keyword.
`static final int`
`FOR`
The token "FOR".
`static final int`
`FOREIGN`
The token "FOREIGN".
`static final int`
`FROM`
The token "FROM".
`static final int`
`FULL`
The token "FULL".
`static final int`
`GROUP`
The token "GROUP".
`static final int`
`HAVING`
The token "HAVING".
`static final int`
`HOUR`
The token "HOUR".
`static final int`
`IDENTIFIER`
An identifier (table name, column name,...).
`static final int`
`IF`
The token "IF".
`static final int`
`IN`
The token "IN".
`static final int`
`INNER`
The token "INNER".
`static final int`
`INTERSECT`
The token "INTERSECT".
`static final int`
`INTERVAL`
The token "INTERVAL".
`static final int`
`IS`
The token "IS".
`static final int`
`JOIN`
The token "JOIN".
`static final int`
`KEY`
The token "KEY".
`static final int`
`KEYWORD`
A keyword.
`static final int`
`LAST_KEYWORD`
The ordinal number of the last keyword.
`static final int`
`LEFT`
The token "LEFT".
`static final int`
`LIKE`
The token "LIKE".
`static final int`
`LIMIT`
The token "LIMIT".
`static final int`
`LOCALTIME`
The token "LOCALTIME".
`static final int`
`LOCALTIMESTAMP`
The token "LOCALTIMESTAMP".
`static final int`
`MINUS`
The token "MINUS".
`static final int`
`MINUTE`
The token "MINUTE".
`static final int`
`MONTH`
The token "MONTH".
`static final int`
`NATURAL`
The token "NATURAL".
`static final int`
`NOT`
The token "NOT".
`static final int`
`NULL`
The token "NULL".
`static final int`
`OFFSET`
The token "OFFSET".
`static final int`
`ON`
The token "ON".
`static final int`
`OR`
The token "OR".
`static final int`
`ORDER`
The token "ORDER".
`static final int`
`PRIMARY`
The token "PRIMARY".
`static final int`
`QUALIFY`
The token "QUALIFY".
`static final int`
`RIGHT`
The token "RIGHT".
`static final int`
`ROW`
The token "ROW".
`static final int`
`ROWNUM`
The token "ROWNUM".
`static final int`
`SECOND`
The token "SECOND".
`static final int`
`SELECT`
The token "SELECT".
`static final int`
`SESSION_USER`
The token "SESSION_USER".
`static final int`
`SET`
The token "SET".
`static final int`
`SOME`
The token "SOME".
`static final int`
`SYMMETRIC`
The token "SYMMETRIC".
`static final int`
`SYSTEM_USER`
The token "SYSTEM_USER".
`static final int`
`TABLE`
The token "TABLE".
`static final int`
`TO`
The token "TO".
`static final int`
`TRUE`
The token "TRUE".
`static final int`
`UESCAPE`
The token "UESCAPE".
`static final int`
`UNION`
The token "UNION".
`static final int`
`UNIQUE`
The token "UNIQUE".
`static final int`
`UNKNOWN`
The token "UNKNOWN".
`static final int`
`USER`
The token "USER".
`static final int`
`USING`
The token "USING".
`static final int`
`VALUE`
The token "VALUE".
`static final int`
`VALUES`
The token "VALUES".
`static final int`
`WHEN`
The token "WHEN".
`static final int`
`WHERE`
The token "WHERE".
`static final int`
`WINDOW`
The token "WINDOW".
`static final int`
`WITH`
The token "WITH".
`static final int`
`YEAR`
The token "YEAR".

## Method Summary

Modifier and Type
Method
Description
`static int`
`getTokenType(String s, boolean ignoreCase, boolean additionalKeywords)`
Get the token type.
`static boolean`
`isKeyword(String s, boolean ignoreCase)`
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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### KEYWORD

public static final int KEYWORD
A keyword.

See Also:
  - Constant Field Values

### IDENTIFIER

public static final int IDENTIFIER
An identifier (table name, column name,...).

See Also:
  - Constant Field Values

### ALL

public static final int ALL
The token "ALL".

See Also:
  - Constant Field Values

### AND

public static final int AND
The token "AND".

See Also:
  - Constant Field Values

### ANY

public static final int ANY
The token "ANY".

See Also:
  - Constant Field Values

### ARRAY

public static final int ARRAY
The token "ARRAY".

See Also:
  - Constant Field Values

### AS

public static final int AS
The token "AS".

See Also:
  - Constant Field Values

### ASYMMETRIC

public static final int ASYMMETRIC
The token "ASYMMETRIC".

See Also:
  - Constant Field Values

### AUTHORIZATION

public static final int AUTHORIZATION
The token "AUTHORIZATION".

See Also:
  - Constant Field Values

### BETWEEN

public static final int BETWEEN
The token "BETWEEN".

See Also:
  - Constant Field Values

### CASE

public static final int CASE
The token "CASE".

See Also:
  - Constant Field Values

### CAST

public static final int CAST
The token "CAST".

See Also:
  - Constant Field Values

### CHECK

public static final int CHECK
The token "CHECK".

See Also:
  - Constant Field Values

### CONSTRAINT

public static final int CONSTRAINT
The token "CONSTRAINT".

See Also:
  - Constant Field Values

### CROSS

public static final int CROSS
The token "CROSS".

See Also:
  - Constant Field Values

### CURRENT_CATALOG

public static final int CURRENT_CATALOG
The token "CURRENT_CATALOG".

See Also:
  - Constant Field Values

### CURRENT_DATE

public static final int CURRENT_DATE
The token "CURRENT_DATE".

See Also:
  - Constant Field Values

### CURRENT_PATH

public static final int CURRENT_PATH
The token "CURRENT_PATH".

See Also:
  - Constant Field Values

### CURRENT_ROLE

public static final int CURRENT_ROLE
The token "CURRENT_ROLE".

See Also:
  - Constant Field Values

### CURRENT_SCHEMA

public static final int CURRENT_SCHEMA
The token "CURRENT_SCHEMA".

See Also:
  - Constant Field Values

### CURRENT_TIME

public static final int CURRENT_TIME
The token "CURRENT_TIME".

See Also:
  - Constant Field Values

### CURRENT_TIMESTAMP

public static final int CURRENT_TIMESTAMP
The token "CURRENT_TIMESTAMP".

See Also:
  - Constant Field Values

### CURRENT_USER

public static final int CURRENT_USER
The token "CURRENT_USER".

See Also:
  - Constant Field Values

### DAY

public static final int DAY
The token "DAY".

See Also:
  - Constant Field Values

### DEFAULT

public static final int DEFAULT
The token "DEFAULT".

See Also:
  - Constant Field Values

### DISTINCT

public static final int DISTINCT
The token "DISTINCT".

See Also:
  - Constant Field Values

### ELSE

public static final int ELSE
The token "ELSE".

See Also:
  - Constant Field Values

### END

public static final int END
The token "END".

See Also:
  - Constant Field Values

### EXCEPT

public static final int EXCEPT
The token "EXCEPT".

See Also:
  - Constant Field Values

### EXISTS

public static final int EXISTS
The token "EXISTS".

See Also:
  - Constant Field Values

### FALSE

public static final int FALSE
The token "FALSE".

See Also:
  - Constant Field Values

### FETCH

public static final int FETCH
The token "FETCH".

See Also:
  - Constant Field Values

### FOR

public static final int FOR
The token "FOR".

See Also:
  - Constant Field Values

### FOREIGN

public static final int FOREIGN
The token "FOREIGN".

See Also:
  - Constant Field Values

### FROM

public static final int FROM
The token "FROM".

See Also:
  - Constant Field Values

### FULL

public static final int FULL
The token "FULL".

See Also:
  - Constant Field Values

### GROUP

public static final int GROUP
The token "GROUP".

See Also:
  - Constant Field Values

### HAVING

public static final int HAVING
The token "HAVING".

See Also:
  - Constant Field Values

### HOUR

public static final int HOUR
The token "HOUR".

See Also:
  - Constant Field Values

### IF

public static final int IF
The token "IF".

See Also:
  - Constant Field Values

### IN

public static final int IN
The token "IN".

See Also:
  - Constant Field Values

### INNER

public static final int INNER
The token "INNER".

See Also:
  - Constant Field Values

### INTERSECT

public static final int INTERSECT
The token "INTERSECT".

See Also:
  - Constant Field Values

### INTERVAL

public static final int INTERVAL
The token "INTERVAL".

See Also:
  - Constant Field Values

### IS

public static final int IS
The token "IS".

See Also:
  - Constant Field Values

### JOIN

public static final int JOIN
The token "JOIN".

See Also:
  - Constant Field Values

### KEY

public static final int KEY
The token "KEY".

See Also:
  - Constant Field Values

### LEFT

public static final int LEFT
The token "LEFT".

See Also:
  - Constant Field Values

### LIKE

public static final int LIKE
The token "LIKE".

See Also:
  - Constant Field Values

### LIMIT

public static final int LIMIT
The token "LIMIT".

See Also:
  - Constant Field Values

### LOCALTIME

public static final int LOCALTIME
The token "LOCALTIME".

See Also:
  - Constant Field Values

### LOCALTIMESTAMP

public static final int LOCALTIMESTAMP
The token "LOCALTIMESTAMP".

See Also:
  - Constant Field Values

### MINUS

public static final int MINUS
The token "MINUS".

See Also:
  - Constant Field Values

### MINUTE

public static final int MINUTE
The token "MINUTE".

See Also:
  - Constant Field Values

### MONTH

public static final int MONTH
The token "MONTH".

See Also:
  - Constant Field Values

### NATURAL

public static final int NATURAL
The token "NATURAL".

See Also:
  - Constant Field Values

### NOT

public static final int NOT
The token "NOT".

See Also:
  - Constant Field Values

### NULL

public static final int NULL
The token "NULL".

See Also:
  - Constant Field Values

### OFFSET

public static final int OFFSET
The token "OFFSET".

See Also:
  - Constant Field Values

### ON

public static final int ON
The token "ON".

See Also:
  - Constant Field Values

### OR

public static final int OR
The token "OR".

See Also:
  - Constant Field Values

### ORDER

public static final int ORDER
The token "ORDER".

See Also:
  - Constant Field Values

### PRIMARY

public static final int PRIMARY
The token "PRIMARY".

See Also:
  - Constant Field Values

### QUALIFY

public static final int QUALIFY
The token "QUALIFY".

See Also:
  - Constant Field Values

### RIGHT

public static final int RIGHT
The token "RIGHT".

See Also:
  - Constant Field Values

### ROW

public static final int ROW
The token "ROW".

See Also:
  - Constant Field Values

### ROWNUM

public static final int ROWNUM
The token "ROWNUM".

See Also:
  - Constant Field Values

### SECOND

public static final int SECOND
The token "SECOND".

See Also:
  - Constant Field Values

### SELECT

public static final int SELECT
The token "SELECT".

See Also:
  - Constant Field Values

### SESSION_USER

public static final int SESSION_USER
The token "SESSION_USER".

See Also:
  - Constant Field Values

### SET

public static final int SET
The token "SET".

See Also:
  - Constant Field Values

### SOME

public static final int SOME
The token "SOME".

See Also:
  - Constant Field Values

### SYMMETRIC

public static final int SYMMETRIC
The token "SYMMETRIC".

See Also:
  - Constant Field Values

### SYSTEM_USER

public static final int SYSTEM_USER
The token "SYSTEM_USER".

See Also:
  - Constant Field Values

### TABLE

public static final int TABLE
The token "TABLE".

See Also:
  - Constant Field Values

### TO

public static final int TO
The token "TO".

See Also:
  - Constant Field Values

### TRUE

public static final int TRUE
The token "TRUE".

See Also:
  - Constant Field Values

### UESCAPE

public static final int UESCAPE
The token "UESCAPE".

See Also:
  - Constant Field Values

### UNION

public static final int UNION
The token "UNION".

See Also:
  - Constant Field Values

### UNIQUE

public static final int UNIQUE
The token "UNIQUE".

See Also:
  - Constant Field Values

### UNKNOWN

public static final int UNKNOWN
The token "UNKNOWN".

See Also:
  - Constant Field Values

### USER

public static final int USER
The token "USER".

See Also:
  - Constant Field Values

### USING

public static final int USING
The token "USING".

See Also:
  - Constant Field Values

### VALUE

public static final int VALUE
The token "VALUE".

See Also:
  - Constant Field Values

### VALUES

public static final int VALUES
The token "VALUES".

See Also:
  - Constant Field Values

### WHEN

public static final int WHEN
The token "WHEN".

See Also:
  - Constant Field Values

### WHERE

public static final int WHERE
The token "WHERE".

See Also:
  - Constant Field Values

### WINDOW

public static final int WINDOW
The token "WINDOW".

See Also:
  - Constant Field Values

### WITH

public static final int WITH
The token "WITH".

See Also:
  - Constant Field Values

### YEAR

public static final int YEAR
The token "YEAR".

See Also:
  - Constant Field Values

### _ROWID_

public static final int _ROWID_
The token "_ROWID_".

See Also:
  - Constant Field Values

### FIRST_KEYWORD

public static final int FIRST_KEYWORD
The ordinal number of the first keyword.

See Also:
  - Constant Field Values

### LAST_KEYWORD

public static final int LAST_KEYWORD
The ordinal number of the last keyword.

See Also:
  - Constant Field Values

## Method Details

### quoteIdentifier

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` - string builder to append to
  `s` - the identifier
  `sqlFlags` - formatting flags
Returns:
  the specified builder

### isKeyword

public static boolean isKeyword(String s, boolean ignoreCase)
Checks if this string is a SQL keyword.

Parameters:
  `s` - the token to check
  `ignoreCase` - 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 check
  `databaseToUpper` - whether unquoted identifiers are converted to upper case
  `databaseToLower` - whether unquoted identifiers are converted to lower case
Returns:
  is specified identifier may be used without quotes
Throws:
  `NullPointerException` - if s is `null`

### getTokenType

public static int getTokenType(String s, boolean ignoreCase, boolean additionalKeywords)
Get the token type.

Parameters:
  `s` - the string with token
  `ignoreCase` - true if case should be ignored, false if only upper case tokens are detected as keywords
  `additionalKeywords` - whether context-sensitive keywords are returned as `KEYWORD`
Returns:
  the token type