org.sqlproc.engine.impl
Class SqlMetaStatement

java.lang.Object
  extended by org.sqlproc.engine.impl.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

Nested Class Summary
static class SqlMetaStatement.Type
          The SQL command type.
 
Field Summary
(package private)  List<SqlMetaElement> elements
          All sub-elements based on ANTLR grammar defined in SqlStatement.g.
(package private)  boolean hasOutputMapping
          An indicator for embedded output mapping
protected static org.slf4j.Logger logger
          The internal slf4j logger.
 
Fields inherited from interface org.sqlproc.engine.impl.SqlMetaElement
AND_PREFIX, CONST_PREFIX, IDENT_PREFIX, IDENT_SEPARATOR, lCONST_PREFIX, lIDENT_PREFIX, OR_PREFIX, SET_PREFIX, VALUES_PREFIX, WHERE_PREFIX
 
Constructor Summary
SqlMetaStatement()
          Creates a new instance.
 
Method Summary
(package private)  void addElement(SqlMetaElement element)
          Adds a new sub-element.
static SqlMetaStatement getInstance(String name, String statement, SqlTypeFactory typeFactory)
          Simple factory method (design pattern).
 boolean isHasOutputMapping()
          Returns the indicator for embedded output mapping.
 SqlProcessResult process(SqlMetaStatement.Type sqlStatementType, Object dynamicInputValues, Object staticInputValues, List<SqlOrder> order, Map<String,Object> features, SqlTypeFactory typeFactory)
          The main contract for a dynamic ANSI SQL Query generation.
 SqlProcessResult process(SqlProcessContext ctx)
          The main contract for a dynamic ANSI SQL Query generation.
 void setHasOutputMapping(boolean hasOutputMapping)
          Sets the indicator for embedded output mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

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


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.

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

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,
                                Object staticInputValues,
                                List<SqlOrder> order,
                                Map<String,Object> features,
                                SqlTypeFactory typeFactory)
The main contract for a dynamic ANSI SQL Query generation. The ANSI SQL Query creation is based on

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


Copyright © 2011. All Rights Reserved.