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
    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.
    private static final HashMap<String,Integer>
     
    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
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static boolean
    checkLetter(boolean databaseToUpper, boolean databaseToLower, char c)
     
    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).
    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

  • Constructor Details

    • ParserUtil

      private ParserUtil()
  • 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
    • checkLetter

      private static boolean checkLetter(boolean databaseToUpper, boolean databaseToLower, char c)
    • 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