Class Parser
java.lang.Object
org.h2.command.Parser
The parser is used to convert a SQL statement string to an command object.
- Author:
- Thomas Mueller, Noel Grandin, Nicolas Fortin, Atelier SIG, IRSTV FR CNRS 24888
-
Constructor Summary
ConstructorsConstructorDescriptionParser()Creates a new instance of parser for special use cases.Parser(SessionLocal session) Creates a new instance of parser. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringformatNonKeywords(BitSet nonKeywords) Formats a comma-separated list of keywords.intReturns the last parse index.static AlterTableAddConstraintnewPrimaryKeyConstraintCommand(SessionLocal session, Schema schema, String tableName, Column column) Create a new alter table command.parseColumnList(String sql, int offset) Parses a list of column names or numbers in parentheses.Parse a SQL code snippet that represents an expression for a domain constraint.parseExpression(String sql) Parse a SQL code snippet that represents an expression.static BitSetparseNonKeywords(String[] nonKeywords) Parses the specified collection of non-keywords.parseTableName(String sql) Parse a SQL code snippet that represents a table name.Parse the statement and prepare it for execution.prepareCommand(String sql) Parse a statement or a list of statements, and prepare it for execution.static StringquoteIdentifier(String s, int sqlFlags) Add double quotes around an identifier if required.voidsetLiteralsChecked(boolean literalsChecked) voidsetRightsChecked(boolean rightsChecked) voidsetSuppliedParameters(ArrayList<Parameter> suppliedParameters) toString()
-
Constructor Details
-
Parser
Creates a new instance of parser.- Parameters:
session- the session
-
Parser
public Parser()Creates a new instance of parser for special use cases.
-
-
Method Details
-
parseNonKeywords
-
formatNonKeywords
-
prepare
-
prepareCommand
-
newPrimaryKeyConstraintCommand
public static AlterTableAddConstraint newPrimaryKeyConstraintCommand(SessionLocal session, Schema schema, String tableName, Column column) Create a new alter table command.- Parameters:
session- the sessionschema- the schematableName- the tablecolumn- the column- Returns:
- the command
-
quoteIdentifier
-
setLiteralsChecked
public void setLiteralsChecked(boolean literalsChecked) -
setRightsChecked
public void setRightsChecked(boolean rightsChecked) -
setSuppliedParameters
-
parseExpression
Parse a SQL code snippet that represents an expression.- Parameters:
sql- the code snippet- Returns:
- the expression object
-
parseDomainConstraintExpression
Parse a SQL code snippet that represents an expression for a domain constraint.- Parameters:
sql- the code snippet- Returns:
- the expression object
-
parseTableName
-
parseColumnList
Parses a list of column names or numbers in parentheses.- Parameters:
sql- the source SQLoffset- the initial offset- Returns:
- the array of column names (
String[]) or numbers (int[]) - Throws:
DbException- on syntax error
-
getLastParseIndex
public int getLastParseIndex()Returns the last parse index.- Returns:
- the last parse index
-
toString
-