## org.h2.command
Class Parser

    java.lang.Object
      org.h2.command.Parser

    public class Parser

extends java.lang.Object

The parser is used to convert a SQL statement string to an command object.

Constructor Summary
`Parser(Session session)`

Method Summary
`Session` `getSession()`
`static boolean` `isKeyword(java.lang.String s, boolean supportOffsetFetch)` Checks if this string is a SQL keyword.
`Expression` `parseExpression(java.lang.String sql)` Parse a SQL code snippet that represents an expression.
`Prepared` `parseOnly(java.lang.String sql)` Parse the statement, but don't prepare it for execution.
`Prepared` `prepare(java.lang.String sql)` Parse the statement and prepare it for execution.
`Command` `prepareCommand(java.lang.String sql)` Parse a statement or a list of statements, and prepare it for execution.
`static java.lang.String` `quoteIdentifier(java.lang.String s)` Add double quotes around an identifier if required.
`void` `setRightsChecked(boolean rightsChecked)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Parser

    public Parser(Session session)

Method Detail

### prepare

    public Prepared prepare(java.lang.String sql)

  Parse the statement and prepare it for execution.

  Parameters:
    `sql` - the SQL statement to parse
  Returns:
    the prepared object

### parseOnly

    public Prepared parseOnly(java.lang.String sql)

  Parse the statement, but don't prepare it for execution.

  Parameters:
    `sql` - the SQL statement to parse
  Returns:
    the prepared object

### prepareCommand

    public Command prepareCommand(java.lang.String sql)

  Parse a statement or a list of statements, and prepare it for execution.

  Parameters:
    `sql` - the SQL statement to parse
  Returns:
    the command object

### getSession

    public Session getSession()

### isKeyword

    public static boolean isKeyword(java.lang.String s,
                                    boolean supportOffsetFetch)

  Checks if this string is a SQL keyword.

  Parameters:
    `s` - the token to check
    `supportOffsetFetch` - if OFFSET and FETCH are keywords
  Returns:
    true if it is a keyword

### quoteIdentifier

    public static java.lang.String quoteIdentifier(java.lang.String s)

  Add double quotes around an identifier if required.

  Parameters:
    `s` - the identifier
  Returns:
    the quoted identifier

### setRightsChecked

    public void setRightsChecked(boolean rightsChecked)

### parseExpression

    public Expression parseExpression(java.lang.String sql)

  Parse a SQL code snippet that represents an expression.

  Parameters:
    `sql` - the code snippet
  Returns:
    the expression object
  Throws:
    `SQLException` - if the code snippet could not be parsed