org.h2.command

## Class Parser

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

    public final class Parser
    extends ParserBase

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

### Constructor Summary

Constructors
Constructor and Description
`Parser(SessionLocal session)` Creates a new instance of parser.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static AlterTableAddConstraint` `newPrimaryKeyConstraintCommand(SessionLocal session, Schema schema, java.lang.String tableName, Column column)` Create a new alter table command.
`Expression` `parseDomainConstraintExpression(java.lang.String sql)` Parse a SQL code snippet that represents an expression for a domain constraint.
`Expression` `parseExpression(java.lang.String sql)` Parse a SQL code snippet that represents an expression.
`Table` `parseTableName(java.lang.String sql)` Parse a SQL code snippet that represents a table name.
`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.
`Query` `prepareQueryExpression(java.lang.String sql)` Parse a query and prepare its expressions.
`void` `setRightsChecked(boolean rightsChecked)`

### Methods inherited from class org.h2.command.ParserBase

`formatNonKeywords, getLastParseIndex, parseColumnList, parseNonKeywords, quoteIdentifier, setLiteralsChecked, setSuppliedParameters, toString`

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

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

### Constructor Detail

#### Parser

    public Parser(SessionLocal session)

Creates a new instance of parser.

Parameters:
  `session` - the 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

#### prepareQueryExpression

    public Query prepareQueryExpression(java.lang.String sql)

Parse a query and prepare its expressions. Rights and literals must be already checked.

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

#### newPrimaryKeyConstraintCommand

    public static AlterTableAddConstraint newPrimaryKeyConstraintCommand(SessionLocal session,
                                                                         Schema schema,
                                                                         java.lang.String tableName,
                                                                         Column column)

Create a new alter table command.

Parameters:
  `session` - the session
  `schema` - the schema
  `tableName` - the table
  `column` - the column
Returns:
  the command

#### 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

#### parseDomainConstraintExpression

    public Expression parseDomainConstraintExpression(java.lang.String sql)

Parse a SQL code snippet that represents an expression for a domain constraint.

Parameters:
  `sql` - the code snippet
Returns:
  the expression object

#### parseTableName

    public Table parseTableName(java.lang.String sql)

Parse a SQL code snippet that represents a table name.

Parameters:
  `sql` - the code snippet
Returns:
  the table object