Package org.sqlproc.engine.impl
Class SqlMetaSqlFragment
- java.lang.Object
-
- org.sqlproc.engine.impl.SqlMetaSqlFragment
-
- All Implemented Interfaces:
SqlMetaElement
class SqlMetaSqlFragment extends Object implements SqlMetaElement
A META SQL sub-element.Schematically:
SqlMetaSqlFragment {= IDENT SqlMetaIfItem}where IDENT can be-
wherefor WHERE fragment of the final SQL query/statement -
setfor WHERE fragment of the final SQL update statement -
valuesfor WHERE fragment of the final SQL insert statement
- Author:
- Vladimir Hudec
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classSqlMetaSqlFragment.TypeThe enumeration of types.
-
Field Summary
Fields Modifier and Type Field Description (package private) List<SqlMetaIfItem>elementsThe list of sub-elements based on ANTLR grammar.(package private) org.slf4j.LoggerloggerThe internal slf4j logger.(package private) booleanoptimisticThe indicator for the types WHERE and SET in the case of optimistic locking.(package private) static PatternpatternColumns(package private) static PatternpatternSet(package private) static PatternpatternValues(package private) static PatternpatternWhere(package private) SqlMetaSqlFragment.TypetypeThe type if this element.-
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
Constructors Constructor Description SqlMetaSqlFragment(String type)Creates a new instance.SqlMetaSqlFragment(SqlMetaSqlFragment.Type type)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddElement(SqlMetaIfItem element)Adds a new sub-element.(package private) voidhandleSqlFragment(StringBuilder s, SqlProcessContext ctx)Handle the SQL fragment based on the statement type and/or theSqlMetaSqlFragment.Type.SqlProcessResultprocess(SqlProcessContext ctx)The main contract for a dynamic ANSI SQL Query generation.
-
-
-
Field Detail
-
logger
final org.slf4j.Logger logger
The internal slf4j logger.
-
patternWhere
static final Pattern patternWhere
-
patternValues
static final Pattern patternValues
-
patternSet
static final Pattern patternSet
-
patternColumns
static final Pattern patternColumns
-
elements
List<SqlMetaIfItem> elements
The list of sub-elements based on ANTLR grammar.
-
type
SqlMetaSqlFragment.Type type
The type if this element. It controls, how the related ANSI SQL fragment is added to the final ANSI SQL.
-
optimistic
boolean optimistic
The indicator for the types WHERE and SET in the case of optimistic locking.
-
-
Constructor Detail
-
SqlMetaSqlFragment
SqlMetaSqlFragment(SqlMetaSqlFragment.Type type)
Creates a new instance. It's used from inside ANTLR parser.- Parameters:
type- the type, which is used to control, how the related ANSI SQL fragment is added to the final ANSI SQL.
-
SqlMetaSqlFragment
SqlMetaSqlFragment(String type)
Creates a new instance. It's used from inside ANTLR parser.- Parameters:
type- the type, which is used to control, how the related ANSI SQL fragment is added to the final ANSI SQL.
-
-
Method Detail
-
addElement
void addElement(SqlMetaIfItem element)
Adds a new sub-element. It's used from inside ANTLR parser.- Parameters:
element- new sub-element, based on ANTLR grammar
-
handleSqlFragment
void handleSqlFragment(StringBuilder s, SqlProcessContext ctx)
Handle the SQL fragment based on the statement type and/or theSqlMetaSqlFragment.Type.- Parameters:
s- a buffer for the generated SQL statementctx- the crate for all input parameters and the context of processing
-
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:
processin interfaceSqlMetaElement- Parameters:
ctx- the crate for all input parameters and the context of processing
-
-