Package org.sqlproc.engine.impl
Class SqlInputValue
java.lang.Object
org.sqlproc.engine.impl.SqlInputValue
The entity for a dynamic input value.
- Author:
- Vladimir Hudec
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum
Enumeration for no/upper/lower case conversion.(package private) static enum
Enumeration for IN/OUT/INOUT mode of callable statement parameter.(package private) static enum
Enumeration for the type of input value. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SqlInputValue.Code
Which conversion should be done on inputValue.private SqlProcessContext
the crate for all input parameters and the context of processing.private String
A database identity column nameprivate String
A input attribute full name.private Object
A calculated identity.private String
An SQL select for an identity column.private SqlInputValue.Mode
Which mode of callable statement parameter it is.private String
A input attribute name.private Object
A dynamic input value.(package private) Class<?>[]
The input value Java types (including parameterized types).private Boolean
The indicator the input value is bounded to the SET or VALUES fragment of META SQLprivate String
A wildcard character for the SQL commandLIKE
.(package private) final org.slf4j.Logger
The internal slf4j logger.private int
The minimum length of inputValue to enable likeChar special treatment.private Object
A dynamic input value can be also an output value.private Object
A parent of a dynamic input value.private boolean
a wildcard character is going to be only a postfixA map of characters to be replaced in input value;private String
A database sequence for an identity column.private SqlType
The input value META type.private SqlInputValue.Type
The type of the input value, please seeSqlInputValue.Type
. -
Constructor Summary
ConstructorsConstructorDescriptionSqlInputValue
(SqlProcessContext ctx, String name, SqlInputValue sqlInputValue, Object dynamicInputValues) Creates a new instance of this entity.SqlInputValue
(SqlProcessContext ctx, SqlInputValue.Type valueType, Object inputValue, Object parentInputValue, String sequenceOrIdentitySelect, SqlType type, String dbIdentityName, Class<?>... inputValueTypes) Creates a new instance of this entity.SqlInputValue
(SqlProcessContext ctx, SqlInputValue.Type valueType, Object inputValue, Object parentInputValue, SqlInputValue.Code caseConversion, SqlInputValue.Mode inOutMode, SqlType type, String inputName, String fullInputName, Boolean inSetOrInsert, Class<?>... inputValueTypes) Creates a new instance of this entity. -
Method Summary
Modifier and TypeMethodDescriptionReturns a database identity column name.(package private) String
Returns a input attribute name.(package private) Object
Returns a dynamic input value.Returns the indicator the input value is bounded to the SET or VALUES fragment of META SQL(package private) Object
Returns a parent of a dynamic input value.Returns the type of the input value, please seeSqlInputValue.Type
.private String
processLike
(Object val) A special treatment of dynamic input value for SQL commandLIKE
.private String
A special treatment of dynamic input value for SQL commandLIKE
.(package private) void
setIdentityResult
(String paramName) Sets the generated identity value to an input value attribute.(package private) void
Sets a special treatment of a dynamic input value.(package private) void
setOutValueResult
(String paramName) Sets the OUT/INOUT value to an input value attribute.(package private) void
setQueryParam
(SqlTypeFactory typeFactory, SqlSession session, SqlQuery query, String paramName) Bind a dynamic input value to a named query parameter.(package private) void
setReplaceChars
(Map<String, String> replaceChars) Sets a special treatment of a dynamic input value.toString()
For debug purposes.
-
Field Details
-
logger
final org.slf4j.Logger loggerThe internal slf4j logger. -
ctx
the crate for all input parameters and the context of processing. -
valueType
The type of the input value, please seeSqlInputValue.Type
. -
caseConversion
Which conversion should be done on inputValue. -
inOutMode
Which mode of callable statement parameter it is. -
inputValue
A dynamic input value. -
inputName
A input attribute name. -
fullInputName
A input attribute full name. -
parentInputValue
A parent of a dynamic input value. -
inputValueTypes
Class<?>[] inputValueTypesThe input value Java types (including parameterized types). -
likeChar
A wildcard character for the SQL commandLIKE
. It can be added to inputValue as a prefix and/or as a suffix. -
minLikeLength
private int minLikeLengthThe minimum length of inputValue to enable likeChar special treatment. -
partialLike
private boolean partialLikea wildcard character is going to be only a postfix -
type
The input value META type. -
sequence
A database sequence for an identity column. -
identitySelect
An SQL select for an identity column. -
identity
A calculated identity. -
outValue
A dynamic input value can be also an output value. -
replaceChars
A map of characters to be replaced in input value; -
dbIdentityName
A database identity column name -
inSetOrInsert
The indicator the input value is bounded to the SET or VALUES fragment of META SQL
-
-
Constructor Details
-
SqlInputValue
SqlInputValue(SqlProcessContext ctx, SqlInputValue.Type valueType, Object inputValue, Object parentInputValue, SqlInputValue.Code caseConversion, SqlInputValue.Mode inOutMode, SqlType type, String inputName, String fullInputName, Boolean inSetOrInsert, Class<?>... inputValueTypes) Creates a new instance of this entity. Used from inside ANTLR parser.- Parameters:
ctx
- the crate for all input parameters and the context of processingvalueType
- a value typeinputValue
- a dynamic input valuecaseConversion
- which conversion should be done on inputValueinOutMode
- Which mode of callable statement parameter it istype
- a dynamic input value META typeinSetOrInsert
- an indicator the input value is bounded to the SET or VALUES fragment of META SQLinputValueTypes
- a dynamic input value Java types (including parameterized types)
-
SqlInputValue
SqlInputValue(SqlProcessContext ctx, SqlInputValue.Type valueType, Object inputValue, Object parentInputValue, String sequenceOrIdentitySelect, SqlType type, String dbIdentityName, Class<?>... inputValueTypes) Creates a new instance of this entity. Used from inside ANTLR parser.- Parameters:
ctx
- the crate for all input parameters and the context of processingvalueType
- a value typeinputValue
- a dynamic input valuesequenceOrIdentitySelect
- a sequence or select command used to generate an identity valuetype
- a dynamic input value META typeinputValueTypes
- a dynamic input value Java types (including parameterized types)
-
SqlInputValue
SqlInputValue(SqlProcessContext ctx, String name, SqlInputValue sqlInputValue, Object dynamicInputValues) Creates a new instance of this entity.- Parameters:
ctx
- the crate for all input parameters and the context of processingname
- the name og the attributesqlInputValue
- SqlInputValue instance to clonedynamicInputValues
- the SQL statement dynamic parameters (input values)
-
-
Method Details
-
setQueryParam
void setQueryParam(SqlTypeFactory typeFactory, SqlSession session, SqlQuery query, String paramName) throws SqlRuntimeException Bind a dynamic input value to a named query parameter.- Parameters:
typeFactory
- the SQL Type factorysession
- the SQL Engine session, an adapter or proxy to the internal JDBC or ORM staffquery
- the SQL Engine query, an adapter or proxy to the internal JDBC or ORM staffparamName
- the name of the parameter (= the attribute name)- Throws:
SqlRuntimeException
- in the case of any problem with input values handling
-
setIdentityResult
Sets the generated identity value to an input value attribute.- Parameters:
paramName
- the name of the parameter (= the attribute name)- Throws:
SqlRuntimeException
- in the case of any problem with output values handling
-
setOutValueResult
Sets the OUT/INOUT value to an input value attribute.- Parameters:
paramName
- the name of the parameter (= the attribute name)- Throws:
SqlRuntimeException
- in the case of any problem with output values handling
-
setLike
Sets a special treatment of a dynamic input value.- Parameters:
likeChar
- a wildcard characterminLikeLength
- the minimum length of inputValue to enable likeChar special treatmentpartialLike
- a wildcard character is going to be only a postfix
-
setReplaceChars
Sets a special treatment of a dynamic input value.- Parameters:
replaceChars
- a map of characters to be replaced in input value
-
processLike
A special treatment of dynamic input value for SQL commandLIKE
.- Parameters:
val
- a dynamic input value- Returns:
- a dynamic input value with a likeChar as a prefix and/or suffix
-
processReplaceChars
A special treatment of dynamic input value for SQL commandLIKE
.- Parameters:
val
- a dynamic input value- Returns:
- a dynamic input value with replaced characters
-
getInputValue
Object getInputValue()Returns a dynamic input value.- Returns:
- a dynamic input value
-
getInputName
String getInputName()Returns a input attribute name.- Returns:
- a input attribute name
-
getParentInputValue
Object getParentInputValue()Returns a parent of a dynamic input value.- Returns:
- a parent of a dynamic input value
-
getValueType
Returns the type of the input value, please seeSqlInputValue.Type
.- Returns:
- the type of the input value, please see
SqlInputValue.Type
-
getDbIdentityName
Returns a database identity column name.- Returns:
- a database identity column name
-
getInSetOrInsert
Returns the indicator the input value is bounded to the SET or VALUES fragment of META SQL- Returns:
- the indicator the input value is bounded to the SET or VALUES fragment of META SQL
-
toString
For debug purposes.
-