Package org.sqlproc.engine.impl
Class SqlMetaIdent
- java.lang.Object
-
- org.sqlproc.engine.impl.SqlMetaIdent
-
- All Implemented Interfaces:
SqlMetaElement
,SqlMetaLogOperand
,SqlMetaSimple
class SqlMetaIdent extends Object implements SqlMetaSimple, SqlMetaLogOperand
A META SQL sub-element. It represents a dynamic input value.Schematically:
SqlMetaIdent +-SqlMetaIdentItem.SqlMetaIdentItem...^SqlMyType^value
- Author:
- Vladimir Hudec
-
-
Field Summary
Fields Modifier and Type Field Description private SqlInputValue.Code
caseConversion
Which conversion should be done on input value.private List<String>
elements
The list of sub-elements.private SqlInputValue.Mode
inOutMode
Which mode of callable statement parameter it is.(package private) org.slf4j.Logger
logger
The internal slf4j logger.private boolean
not
An indicator, which is used to control, how the input value is added to the final ANSI SQL.private SqlType
sqlType
The type of this input value.(package private) Map<String,String>
values
Values for a special identifier handling, for example a sequence for an identity.-
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 SqlMetaIdent(SqlInputValue.Code caseConversion, SqlInputValue.Mode inOutMode)
Creates a new instance of this entity.SqlMetaIdent(SqlInputValue.Code caseConversion, SqlInputValue.Mode inOutMode, boolean not)
Creates a new instance of this entity.SqlMetaIdent(SqlInputValue.Code caseConversion, SqlInputValue.Mode inOutMode, boolean not, SqlType type)
Creates a new instance of this entity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addIdent(String name)
Adds a new name.List<String>
getElements()
Returns the list of sub-elements.(package private) SqlType
getSqlType()
Returns the type of this input value.(package private) boolean
isNot()
Returns the indicator, which is used to control, how the input value is added to the final ANSI SQL.SqlProcessResult
process(SqlProcessContext ctx)
The main contract for a dynamic ANSI SQL Query generation.boolean
processExpression(SqlProcessContext ctx)
The main contract to evaluate a logical value of META SQL sub-elements.(package private) void
setMetaType(String metaTypeName, SqlMetaType metaType)
Sets the internal type of this input value.(package private) void
setNot(boolean not)
Sets the indicator, which is used to control, how the input value is added to the final ANSI SQL.void
setValues(String value, String value2)
Sets the values for a special identifier handling, for example a sequence for an identity.
-
-
-
Field Detail
-
logger
final org.slf4j.Logger logger
The internal slf4j logger.
-
caseConversion
private SqlInputValue.Code caseConversion
Which conversion should be done on input value.
-
inOutMode
private SqlInputValue.Mode inOutMode
Which mode of callable statement parameter it is.
-
not
private boolean not
An indicator, which is used to control, how the input value is added to the final ANSI SQL. A standard behavior is to add an input value only in the case it's not empty. The definition of the emptiness depends on the type of the input value.
-
elements
private List<String> elements
The list of sub-elements. Every sub-element represents the name of an attribute in the input class (the static parameters class). In case there're more names, the input classes are embedded one in other.
-
sqlType
private SqlType sqlType
The type of this input value. It can be Hibernate or an internal type.
-
-
Constructor Detail
-
SqlMetaIdent
SqlMetaIdent(SqlInputValue.Code caseConversion, SqlInputValue.Mode inOutMode)
Creates a new instance of this entity. Used from inside ANTLR parser.- Parameters:
caseConversion
- which conversion should be done on inputValue
-
SqlMetaIdent
SqlMetaIdent(SqlInputValue.Code caseConversion, SqlInputValue.Mode inOutMode, boolean not)
Creates a new instance of this entity. Used from inside ANTLR parser.- Parameters:
caseConversion
- which conversion should be done on inputValuenot
- an indicator, which is used to control, how the input value is added to the final ANSI SQL
-
SqlMetaIdent
SqlMetaIdent(SqlInputValue.Code caseConversion, SqlInputValue.Mode inOutMode, boolean not, SqlType type)
Creates a new instance of this entity. Used from inside ANTLR parser.- Parameters:
caseConversion
- which conversion should be done on inputValuenot
- an indicator, which is used to control, how the input value is added to the final ANSI SQLtype
- the type of this input value, which can be Hibernate or an internal type
-
-
Method Detail
-
addIdent
void addIdent(String name)
Adds a new name. This is the name of an attribute in the input class (the static parameters class). In case there're more names, the input classes are embedded one in other.- Parameters:
name
- the next name in the list of names
-
setMetaType
void setMetaType(String metaTypeName, SqlMetaType metaType)
Sets the internal type of this input value.- Parameters:
metaTypeName
- an internal type namemetaType
- an internal type
-
setValues
public void setValues(String value, String value2)
Sets the values for a special identifier handling, for example a sequence for an identity. Or it can used be for the special handling of the enumeration type of the input value. The logical evaluation of the input value is based on the comparison to this value.- Parameters:
value
- the value for a special treatment, might be an identifier of value2 or a value for a comparisonvalue2
- the value for a special treatment, might be a sequence name for an identity column
-
getSqlType
SqlType getSqlType()
Returns the type of this input value. It can be Hibernate or an internal type.- Returns:
- the type of this input value
-
setNot
void setNot(boolean not)
Sets the indicator, which is used to control, how the input value is added to the final ANSI SQL. A standard behavior is to add an input value only in the case it's not empty. The definition of the emptiness depends on the type of the input value.- Parameters:
not
- a new indicator value
-
isNot
boolean isNot()
Returns the indicator, which is used to control, how the input value is added to the final ANSI SQL. A standard behavior is to add an input value only in the case it's not empty. The definition of the emptiness depends on the type of the input value.- Returns:
- the indicator value
-
getElements
public List<String> getElements()
Returns the list of sub-elements.- Returns:
- the list of sub-elements
-
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
-
processExpression
public boolean processExpression(SqlProcessContext ctx)
The main contract to evaluate a logical value of META SQL sub-elements.- Specified by:
processExpression
in interfaceSqlMetaLogOperand
- Parameters:
ctx
- the context for a dynamic ANSI SQL Query generation- Returns:
- a logical value
-
-