com.akiban.sql.parser
Class SQLParser

java.lang.Object
  extended by com.akiban.sql.parser.SQLParser
All Implemented Interfaces:
SQLParserContext

public class SQLParser
extends Object
implements SQLParserContext


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.akiban.sql.parser.SQLParserContext
SQLParserContext.IdentifierCase
 
Constructor Summary
SQLParser()
          Make a new parser.
 
Method Summary
 void checkIdentifierLengthLimit(String identifier)
          Check that identifier is not too long.
 void checkStringLiteralLengthLimit(String image)
          Check that string literal is not too long.
 String generateColumnName()
           
 Set<SQLParserFeature> getFeatures()
           
 SQLParserContext.IdentifierCase getIdentifierCase()
          How are unquoted identifiers standardized?
 int getMaxIdentifierLength()
          Get maximum length of an identifier.
 int getMaxStringLiteralLength()
          Get maximum length of a string literal.
 String getMessageLocale()
           
 NodeFactory getNodeFactory()
          Get a node factory.
 List<ParameterNode> getParameterList()
          Return the parameters to the parsed statement.
 Map getPrintedObjectsMap()
          Return a map of AST nodes that have already been printed during a compiler phase, so as to be able to avoid printing a node more than once.
 String getSQLText()
          Return the SQL string this parser just parsed.
 boolean hasFeature(SQLParserFeature feature)
          Is the given feature enabled for this parser?
 ParameterNode lookupUnnamedParameter(int paramNumber)
          Looks up an unnamed parameter given its parameter number.
 StatementNode parseStatement(String sqlText)
          Normal external parser entry.
 List<StatementNode> parseStatements(String sqlText)
          Parse multiple statements delimited by semicolons.
protected  void reinit(String sqlText)
           
 void setMaxIdentifierLength(int maxLength)
          Set maximum length of an identifier.
 void setMaxStringLiteralLength(int maxLength)
          Set maximum length of a string literal.
 void setMessageLocale(String locale)
          Mark as requesting locale.
 void setNodeFactory(NodeFactory nodeFactory)
          Set the node factory.
 void setReturnParameterFlag()
          Mark as returning a parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SQLParser

public SQLParser()
Make a new parser. Parser can be reused.

Method Detail

getSQLText

public String getSQLText()
Return the SQL string this parser just parsed.


getParameterList

public List<ParameterNode> getParameterList()
Return the parameters to the parsed statement.


lookupUnnamedParameter

public ParameterNode lookupUnnamedParameter(int paramNumber)
Looks up an unnamed parameter given its parameter number.

Parameters:
paramNumber - Number of parameter in unnamedparameter list.
Returns:
corresponding unnamed parameter.

parseStatement

public StatementNode parseStatement(String sqlText)
                             throws StandardException
Normal external parser entry.

Throws:
StandardException

parseStatements

public List<StatementNode> parseStatements(String sqlText)
                                    throws StandardException
Parse multiple statements delimited by semicolons.

Throws:
StandardException

reinit

protected void reinit(String sqlText)
               throws StandardException
Throws:
StandardException

getMaxStringLiteralLength

public int getMaxStringLiteralLength()
Get maximum length of a string literal.


setMaxStringLiteralLength

public void setMaxStringLiteralLength(int maxLength)
Set maximum length of a string literal.


checkStringLiteralLengthLimit

public void checkStringLiteralLengthLimit(String image)
                                   throws StandardException
Check that string literal is not too long.

Specified by:
checkStringLiteralLengthLimit in interface SQLParserContext
Throws:
StandardException

getMaxIdentifierLength

public int getMaxIdentifierLength()
Get maximum length of an identifier.


setMaxIdentifierLength

public void setMaxIdentifierLength(int maxLength)
Set maximum length of an identifier.


checkIdentifierLengthLimit

public void checkIdentifierLengthLimit(String identifier)
                                throws StandardException
Check that identifier is not too long.

Specified by:
checkIdentifierLengthLimit in interface SQLParserContext
Throws:
StandardException

setReturnParameterFlag

public void setReturnParameterFlag()
Description copied from interface: SQLParserContext
Mark as returning a parameter.

Specified by:
setReturnParameterFlag in interface SQLParserContext

getMessageLocale

public String getMessageLocale()

setMessageLocale

public void setMessageLocale(String locale)
Description copied from interface: SQLParserContext
Mark as requesting locale.

Specified by:
setMessageLocale in interface SQLParserContext

getNodeFactory

public NodeFactory getNodeFactory()
Get a node factory.

Specified by:
getNodeFactory in interface SQLParserContext

setNodeFactory

public void setNodeFactory(NodeFactory nodeFactory)
Set the node factory.


getPrintedObjectsMap

public Map getPrintedObjectsMap()
Return a map of AST nodes that have already been printed during a compiler phase, so as to be able to avoid printing a node more than once.

Specified by:
getPrintedObjectsMap in interface SQLParserContext
Returns:
the map
See Also:
QueryTreeNode.treePrint(int)

generateColumnName

public String generateColumnName()

getFeatures

public Set<SQLParserFeature> getFeatures()

hasFeature

public boolean hasFeature(SQLParserFeature feature)
Description copied from interface: SQLParserContext
Is the given feature enabled for this parser?

Specified by:
hasFeature in interface SQLParserContext

getIdentifierCase

public SQLParserContext.IdentifierCase getIdentifierCase()
Description copied from interface: SQLParserContext
How are unquoted identifiers standardized?

Specified by:
getIdentifierCase in interface SQLParserContext


Copyright © 2013 Akiban Technologies, Inc. All rights reserved.