Package org.sqlproc.engine.impl
Class SqlProcessResult
java.lang.Object
org.sqlproc.engine.impl.SqlProcessResult
- All Implemented Interfaces:
Comparable<SqlProcessResult>
Holds the results of ANSI SQL query generation.
The result is related to the overall ANSI SQL Query generation in
SqlMetaStatement
or
the partial processing result in SqlMetaElement.process(SqlProcessContext)
.
The main runtime contract is setQueryParams(SqlSession, SqlQuery)
.- Author:
- Vladimir Hudec
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
The indicator that a partial processing result (of ANSI SQL Query generation) is going to be part of a final ANSI SQL.The list of dynamic input values.private SqlProcessContext
The crate for all input parameters and the context of processing.private Map
<String, SqlInputValue> List of all identities, which have values generated using sequences.private Map
<String, SqlInputValue> The map of dynamic input values.(package private) boolean
The failed SQL command should be logged.private Integer
The index of selected ordering rule (from the list of ordering directives).private Map
<String, SqlMappingItem> The list of output values.private Map
<String, SqlInputValue> List of all input values, which are in fact OUT or INOUT parameters.private boolean
The indicator that a the next possible text has to be skipped.private StringBuilder
The final ANSI SQL or the fragment of ANSI SQL, which is dynamically generated from the META SQL based on input values. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance.SqlProcessResult
(SqlProcessContext ctx, String sql) Creates a new instance with a SQL fragment from SqlMetaText.SqlProcessResult
(SqlProcessResult result, Object dynamicInputValues, SqlControl sqlControl) Creates a new instance with a SQL fragment from SqlMetaText. -
Method Summary
Modifier and TypeMethodDescription(package private) void
add
(boolean add) Sets an indicator if a partial processing result will be part of a final ANSI SQL.(package private) void
addFalse()
Sets an indicator that a partial processing result is going to be part of a final ANSI SQL.(package private) void
addIdentities
(Map<String, SqlInputValue> identities) Adds a new collection of identities.(package private) void
addIdentity
(String key, SqlInputValue value) Adds a new identity.(package private) void
addInputValue
(String key, SqlInputValue value) Adds a new dynamic input value.(package private) void
addInputValues
(List<String> inputValues) Adds a new collection of dynamic input values.(package private) void
addMappedInputValues
(Map<String, SqlInputValue> inputValues) Adds a new collection of dynamic input values.(package private) void
addOutputValue
(String key, SqlMappingItem value) Adds a new output value.(package private) void
addOutputValues
(Map<String, SqlMappingItem> outputValues) Adds a new collection of output values.(package private) void
addOutValue
(String key, SqlInputValue value) Adds a new OUT/INOUT value.(package private) void
addOutValues
(Map<String, SqlInputValue> outValues) Adds a new collection of OUT/INOUT values.(package private) void
addTrue()
Sets an indicator that a partial processing result isn't going to be part of a final ANSI SQL.int
In case there're several ordering rules in the final generated ANSI SQL, they should be ordered.(package private) SqlProcessContext
getCtx()
Returns the crate for all input parameters and the context of processing.Returns the collection of identities.(package private) SqlInputValue
getInputValue
(String name) Returns the input value .Returns the collection of dynamic input values.(package private) Map
<String, SqlInputValue> Returns the collection of dynamic input values.(package private) Integer
Returns the index of selected ordering rule (from the list of ordering directives).(package private) Map
<String, SqlMappingItem> Returns the collection of output values.(package private) Map
<String, SqlInputValue> Returns the collection of OUT/INOUT values.Returns the public runtime contextgetSql()
Returns the final ANSI SQL or a fragment of ANSI SQL, which is dynamically generated from the META SQL based on input values.(package private) boolean
isAdd()
Returns the indicator if a partial processing result will be part of a final ANSI SQL.boolean
Returns an indicator the failed SQL command should be logged(package private) boolean
Returns the indicator the next possible SQL statement fragment should be skipped.void
Post processing, like identities setting into a result class.void
setLogError
(boolean logError) Sets an indicator the failed SQL command should be logged(package private) void
setOrderIndex
(Integer orderIndex) Sets an index of selected ordering rule (from the list of ordering directives).boolean
setQueryParams
(SqlSession session, SqlQuery query) Bind an input values to a named query parameters.(package private) void
setSkipNextText
(boolean skipNextText) Sets the indicator the next possible SQL statement fragment should be skipped.(package private) void
setSql
(StringBuilder sql) Sets the final ANSI SQL or a fragment of ANSI SQL, which is dynamically generated from the META SQL based on input values.toString()
For debug purposes.void
validate
(SqlValidator validator) Validates the processed input attributes and their values.
-
Field Details
-
ctx
The crate for all input parameters and the context of processing. -
add
private boolean addThe indicator that a partial processing result (of ANSI SQL Query generation) is going to be part of a final ANSI SQL. -
allInputValues
The list of dynamic input values. These parameters have to be binded to SQL statement. -
inputValues
The map of dynamic input values. These parameters have to be binded to SQL statement. -
outputValues
The list of output values. Every sub-element is one Mapping item. These parameters are scalars for SQL statement. -
identities
List of all identities, which have values generated using sequences. -
outValues
List of all input values, which are in fact OUT or INOUT parameters. -
sql
The final ANSI SQL or the fragment of ANSI SQL, which is dynamically generated from the META SQL based on input values. -
orderIndex
The index of selected ordering rule (from the list of ordering directives). -
skipNextText
private boolean skipNextTextThe indicator that a the next possible text has to be skipped. It's used for the identity based on select. -
logError
boolean logErrorThe failed SQL command should be logged.
-
-
Constructor Details
-
SqlProcessResult
SqlProcessResult(SqlProcessContext ctx) Creates a new instance.- Parameters:
ctx
- the crate for all input parameters and the context of processing
-
SqlProcessResult
SqlProcessResult(SqlProcessContext ctx, String sql) Creates a new instance with a SQL fragment from SqlMetaText.- Parameters:
ctx
- the crate for all input parameters and the context of processingsql
- a SQL fragment
-
SqlProcessResult
Creates a new instance with a SQL fragment from SqlMetaText.- Parameters:
result
- SqlProcessResult instance to clonedynamicInputValues
- the SQL statement dynamic parameters (input values)sqlControl
- The compound parameters controlling the META SQL execution
-
-
Method Details
-
getCtx
SqlProcessContext getCtx()Returns the crate for all input parameters and the context of processing.- Returns:
- the crate for all input parameters and the context of processing
-
getRuntimeContext
Returns the public runtime context- Returns:
- the public runtime context
-
addFalse
void addFalse()Sets an indicator that a partial processing result is going to be part of a final ANSI SQL. -
addTrue
void addTrue()Sets an indicator that a partial processing result isn't going to be part of a final ANSI SQL. -
add
void add(boolean add) Sets an indicator if a partial processing result will be part of a final ANSI SQL.- Parameters:
add
- a new indicator value
-
isAdd
boolean isAdd()Returns the indicator if a partial processing result will be part of a final ANSI SQL.- Returns:
- the indicator value
-
addInputValue
Adds a new dynamic input value. This parameter have to be binded to SQL statement.- Parameters:
key
- the name of a dynamic input valuevalue
- a new dynamic input value
-
addInputValues
Adds a new collection of dynamic input values. These parameters have to be binded to SQL statement.- Parameters:
inputValues
- a new collection of dynamic input values
-
addMappedInputValues
Adds a new collection of dynamic input values. These parameters have to be binded to SQL statement.- Parameters:
inputValues
- a new collection of dynamic input values
-
getInputValues
Returns the collection of dynamic input values. These parameters have to be binded to SQL statement.- Returns:
- the collection of dynamic input values
-
getMappedInputValues
Map<String,SqlInputValue> getMappedInputValues()Returns the collection of dynamic input values. These parameters have to be binded to SQL statement.- Returns:
- the collection of dynamic input values
-
getInputValue
Returns the input value . This parameter has to be binded to SQL statement.- Parameters:
name
- the name of the parameter- Returns:
- the input value
-
addOutputValue
Adds a new output value. This parameter is a scalar for SQL statement.- Parameters:
key
- the name of an output valuevalue
- a new output value
-
addOutputValues
Adds a new collection of output values. These parameters are scalars for SQL statement.- Parameters:
outputValues
- a new collection of output values
-
getOutputValues
Map<String,SqlMappingItem> getOutputValues()Returns the collection of output values. These parameters are scalars for SQL statement.- Returns:
- the collection of output values
-
addIdentity
Adds a new identity.- Parameters:
key
- the name of an identity column/attributevalue
- a new identity value
-
addIdentities
Adds a new collection of identities.- Parameters:
identities
- a new collection of identities
-
getIdentities
Returns the collection of identities.- Returns:
- the collection of identities
-
addOutValue
Adds a new OUT/INOUT value.- Parameters:
key
- the name of an OUT/INOUT column/attributevalue
- a new OUT/INOUT value
-
addOutValues
Adds a new collection of OUT/INOUT values.- Parameters:
outValues
- a new collection of OUT/INOUT values
-
getOutValues
Map<String,SqlInputValue> getOutValues()Returns the collection of OUT/INOUT values.- Returns:
- the collection of OUT/INOUT values
-
setSql
Sets the final ANSI SQL or a fragment of ANSI SQL, which is dynamically generated from the META SQL based on input values.- Parameters:
sql
- the final ANSI SQL or a fragment of ANSI SQL
-
getSql
Returns the final ANSI SQL or a fragment of ANSI SQL, which is dynamically generated from the META SQL based on input values.- Returns:
- the final ANSI SQL or a fragment of ANSI SQL
-
setOrderIndex
Sets an index of selected ordering rule (from the list of ordering directives).- Parameters:
orderIndex
- a new index of selected ordering rule
-
getOrderIndex
Integer getOrderIndex()Returns the index of selected ordering rule (from the list of ordering directives).- Returns:
- the index of selected ordering rule
-
setLogError
public void setLogError(boolean logError) Sets an indicator the failed SQL command should be logged- Parameters:
logError
- an indicator the failed SQL command should be logged
-
isLogError
public boolean isLogError()Returns an indicator the failed SQL command should be logged- Returns:
- an indicator the failed SQL command should be logged
-
isSkipNextText
boolean isSkipNextText()Returns the indicator the next possible SQL statement fragment should be skipped. It's used for the identities settled into the input value attributes.- Returns:
- an indicator the next possible SQL statement fragment should be skipped
-
setSkipNextText
void setSkipNextText(boolean skipNextText) Sets the indicator the next possible SQL statement fragment should be skipped. It's used for the identities settled into the input value attributes.- Parameters:
skipNextText
- an indicator the next possible SQL statement fragment should be skipped
-
setQueryParams
Bind an input values to a named query parameters.- Parameters:
session
- 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 staff- Throws:
SqlRuntimeException
- in the case of any problem with input values handling
-
postProcess
Post processing, like identities setting into a result class.- Throws:
SqlRuntimeException
- in the case of any problem with output values handling
-
compareTo
In case there're several ordering rules in the final generated ANSI SQL, they should be ordered.- Specified by:
compareTo
in interfaceComparable<SqlProcessResult>
-
validate
Validates the processed input attributes and their values.- Parameters:
validator
- the injected validator- Throws:
SqlValidationException
- in the case the validation isn't successfull
-
toString
For debug purposes.
-