Package org.sqlproc.engine.impl
Class SqlMetaOrd
- java.lang.Object
-
- org.sqlproc.engine.impl.SqlMetaOrd
-
- All Implemented Interfaces:
SqlMetaElement
class SqlMetaOrd extends Object implements SqlMetaElement
A META SQL sub-element. It represents the ORDER command of the final ANSI SQL.Schematically:
SqlMetaOrd SqlMetaText SqlMetaIdent SqlMetaConst
- Author:
- Vladimir Hudec
-
-
Field Summary
Fields Modifier and Type Field Description (package private) List<SqlMetaSimple>
elements
The list of sub-elements based on ANTLR grammar.(package private) String
id
The ordering id.(package private) 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
Constructors Constructor Description SqlMetaOrd(String id)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addElement(SqlMetaSimple element)
Adds a new sub-element.private StringBuilder
process(StringBuilder sql, SqlOrder.Order orderDirrection)
Returns ANSI SQL ORDER command for one ordering rule.SqlProcessResult
process(SqlProcessContext ctx)
The main contract for a dynamic ANSI SQL Query generation.
-
-
-
Field Detail
-
logger
final org.slf4j.Logger logger
The internal slf4j logger.
-
elements
List<SqlMetaSimple> elements
The list of sub-elements based on ANTLR grammar.
-
id
String id
The ordering id. This value should correspond to the order number in META SQL {#NNN order by ...}.
-
-
Constructor Detail
-
SqlMetaOrd
SqlMetaOrd(String id)
Creates a new instance. It's used from inside ANTLR parser.- Parameters:
id
- the ordering id, which corresponds to the order number in META SQL {#NNN order by ...}
-
-
Method Detail
-
addElement
void addElement(SqlMetaSimple element)
Adds a new sub-element. It's used from inside ANTLR parser.- Parameters:
element
- new sub-element, based on ANTLR grammar
-
process
private StringBuilder process(StringBuilder sql, SqlOrder.Order orderDirrection)
Returns ANSI SQL ORDER command for one ordering rule.- Parameters:
sql
- the cumulative fragment of the final ordering commandorderDirrection
- the ASC or DESC ordering direction- Returns:
- the cumulative fragment of the final ordering command
-
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 interfaceSqlMetaElement
- Parameters:
ctx
- the crate for all input parameters and the context of processing
-
-