Class ParserImpl

  • All Implemented Interfaces:
    Parser

    public class ParserImpl
    extends java.lang.Object
    implements Parser
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private org.apache.derby.impl.sql.compile.SQLParser getParser()
      new parser, appropriate for the ParserImpl object.
      java.lang.String getSQLtext()
      Returns the current SQL text string that is being parsed.
      protected java.lang.Object getTokenManager()
      Returns a initialized (clean) TokenManager, paired w. the Parser in getParser, Appropriate for this ParserImpl object.
      Visitable parseSearchCondition​(java.lang.String sqlFragment)
      Parse an SQL fragment that represents a <search condition>.
      Visitable parseStatement​(java.lang.String statementSQLText)  
      Visitable parseStatement​(java.lang.String statementSQLText, java.lang.Object[] paramDefaults)
      Parse a statement and return a query tree.
      private Visitable parseStatementOrSearchCondition​(java.lang.String sql, java.lang.Object[] paramDefaults, boolean isStatement)
      Parse a full SQL statement or a fragment that represents a <search condition>.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • cachedParser

        private org.apache.derby.impl.sql.compile.SQLParser cachedParser
      • cachedTokenManager

        private java.lang.Object cachedTokenManager
      • SQLtext

        protected java.lang.String SQLtext
    • Constructor Detail

      • ParserImpl

        public ParserImpl​(CompilerContext cc)
        Constructor for Parser
    • Method Detail

      • getTokenManager

        protected java.lang.Object getTokenManager()
        Returns a initialized (clean) TokenManager, paired w. the Parser in getParser, Appropriate for this ParserImpl object.
      • getParser

        private org.apache.derby.impl.sql.compile.SQLParser getParser()
        new parser, appropriate for the ParserImpl object.
      • parseStatement

        public Visitable parseStatement​(java.lang.String statementSQLText,
                                        java.lang.Object[] paramDefaults)
                                 throws StandardException
        Parse a statement and return a query tree. Implements the Parser interface
        Specified by:
        parseStatement in interface Parser
        Parameters:
        statementSQLText - Statement to parse
        paramDefaults - parameter defaults. Passed around as an array of objects, but is really an array of StorableDataValues
        Returns:
        A QueryTree representing the parsed statement
        Throws:
        StandardException - Thrown on error
      • parseStatementOrSearchCondition

        private Visitable parseStatementOrSearchCondition​(java.lang.String sql,
                                                          java.lang.Object[] paramDefaults,
                                                          boolean isStatement)
                                                   throws StandardException
        Parse a full SQL statement or a fragment that represents a <search condition>.
        Parameters:
        sql - the SQL statement or fragment to parse
        paramDefaults - parameter defaults to pass on to the parser in the case where sql is a full SQL statement
        isStatement - true if sql is a full SQL statement, false if it is a fragment
        Returns:
        parse tree for the SQL
        Throws:
        StandardException - if an error happens during parsing
      • parseSearchCondition

        public Visitable parseSearchCondition​(java.lang.String sqlFragment)
                                       throws StandardException
        Description copied from interface: Parser
        Parse an SQL fragment that represents a <search condition>.
        Specified by:
        parseSearchCondition in interface Parser
        Parameters:
        sqlFragment - the SQL fragment to parse
        Returns:
        a parse tree representing the search condition
        Throws:
        StandardException - if the SQL fragment could not be parsed
      • getSQLtext

        public java.lang.String getSQLtext()
        Returns the current SQL text string that is being parsed.
        Specified by:
        getSQLtext in interface Parser
        Returns:
        Current SQL text string.