Package org.sqlproc.engine.impl
Class SqlMetaStatement
java.lang.Object
org.sqlproc.engine.impl.SqlMetaStatement
- All Implemented Interfaces:
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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) List
<SqlMetaElement> All sub-elements based on ANTLR grammar defined in SqlStatement.g.(package private) boolean
An indicator for embedded output mappingprotected static org.slf4j.Logger
The internal slf4j logger.(package private) String
A raw representation this META SQL statementFields 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
ConstructorsConstructorDescriptionCreates a new instance.SqlMetaStatement
(String raw) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescription(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).getRaw()
Returns raw representation this META SQL statementboolean
Returns the indicator for embedded output mapping.process
(SqlMetaStatement.Type sqlStatementType, Object dynamicInputValues, SqlControl sqlControl, SqlEngine sqlEngine) The main contract for a dynamic ANSI SQL Query generation.process
(SqlProcessContext ctx) The main contract for a dynamic ANSI SQL Query generation.void
setHasOutputMapping
(boolean hasOutputMapping) Sets the indicator for embedded output mapping.
-
Field Details
-
logger
protected static org.slf4j.Logger loggerThe internal slf4j logger. -
raw
String rawA raw representation this META SQL statement -
elements
List<SqlMetaElement> elementsAll sub-elements based on ANTLR grammar defined in SqlStatement.g. -
hasOutputMapping
boolean hasOutputMappingAn indicator for embedded output mapping
-
-
Constructor Details
-
SqlMetaStatement
SqlMetaStatement()Creates a new instance. It's used from inside ANTLR parser. -
SqlMetaStatement
Creates a new instance. It's used from inside ANTLR parser.
-
-
Method Details
-
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/statementstatement
- String representation of META SQL query/statementtypeFactory
- 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
Returns raw representation this META SQL statement- Returns:
- raw representation this META SQL statement
-
addElement
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 typedynamicInputValues
- the SQL statement dynamic parameters (input values)sqlControl
- The compound parameters controlling the META SQL executionsqlEngine
- 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
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 interfaceSqlMetaElement
- Parameters:
ctx
- the crate for all input parameters and the context of processing
-