Class SqlMetaStatement

  • All Implemented Interfaces:
    SqlMetaElement

    public class SqlMetaStatement
    extends Object
    implements SqlMetaElement
    Precompiled META SQL statement. Instance of this class is created by the ANTLR parser. The grammar is defined in SqlStatement.g. It's based on the Composite (desing pattern). The main contract is SqlMetaElement.process(SqlProcessContext)

    Schematically:

     SqlMetaStatement
         SqlMetaText
         SqlMetaIdent
         SqlMetaConst
         { SqlMetaAndOr}
         {? SqlMetaIf}
         {& SqlMetaAndOr}
         {| SqlMetaAndOr}
         {#DIGIT SqlMetaOrd}
     
    Author:
    Vladimir Hudec
    • Field Detail

      • logger

        protected static org.slf4j.Logger logger
        The internal slf4j logger.
      • raw

        String raw
        A raw representation this META SQL statement
      • elements

        List<SqlMetaElement> elements
        All sub-elements based on ANTLR grammar defined in SqlStatement.g.
      • hasOutputMapping

        boolean hasOutputMapping
        An indicator for embedded output mapping
    • Constructor Detail

      • SqlMetaStatement

        SqlMetaStatement()
        Creates a new instance. It's used from inside ANTLR parser.
      • SqlMetaStatement

        public SqlMetaStatement​(String raw)
        Creates a new instance. It's used from inside ANTLR parser.
    • Method Detail

      • getInstance

        public static SqlMetaStatement getInstance​(String name,
                                                   String statement,
                                                   SqlTypeFactory typeFactory)
                                            throws SqlEngineException
        Simple factory method (design pattern). The new instance of precompiled META SQL is created from the String input by the ANTLR parser.
        Parameters:
        name - the name of this META SQL query/statement
        statement - String representation of META SQL query/statement
        typeFactory - the factory for the META types construction
        Returns:
        new instance of precompiled META SQL query/statement
        Throws:
        SqlEngineException - in the case of ANTLR parsing exception
      • getRaw

        public String getRaw()
        Returns raw representation this META SQL statement
        Returns:
        raw representation this META SQL statement
      • addElement

        void addElement​(SqlMetaElement element)
        Adds a new sub-element. It's used from inside ANTLR parser.
        Parameters:
        element - new sub-element, based on ANTLR grammar
      • isHasOutputMapping

        public boolean isHasOutputMapping()
        Returns the indicator for embedded output mapping.
        Returns:
        the indicator for embedded output mapping
      • setHasOutputMapping

        public void setHasOutputMapping​(boolean hasOutputMapping)
        Sets the indicator for embedded output mapping.
        Parameters:
        hasOutputMapping - the indicator for embedded output mapping
      • process

        public SqlProcessResult process​(SqlMetaStatement.Type sqlStatementType,
                                        Object dynamicInputValues,
                                        SqlControl sqlControl,
                                        SqlEngine sqlEngine)
        The main contract for a dynamic ANSI SQL Query generation. The ANSI SQL Query creation is based on
        • META SQL
        • dynamic input values
        • static input values
        • ordering list directive
        • optional features
          Parameters:
          sqlStatementType - the SQL command type
          dynamicInputValues - the SQL statement dynamic parameters (input values)
          sqlControl - The compound parameters controlling the META SQL execution
          sqlEngine - the primary SQL Processor class for the META SQL execution
          Returns:
          the crate for ANSI SQL and other attributes, which control the SQL statement itself
        • process

          public SqlProcessResult process​(SqlProcessContext ctx)
          The main contract for a dynamic ANSI SQL Query generation. Also known as a META SQL processing. The composite pattern main contract. All ANTLR grammar based elements must implement this contract.
          Specified by:
          process in interface SqlMetaElement
          Parameters:
          ctx - the crate for all input parameters and the context of processing