public class SqlProcessResult extends Object implements Comparable<SqlProcessResult>
SqlMetaStatement
or
the partial processing result in SqlMetaElement.process(SqlProcessContext)
.
The main runtime contract is setQueryParams(SqlSession, SqlQuery)
.Modifier and Type | Field and Description |
---|---|
private boolean |
add
The indicator that a partial processing result (of ANSI SQL Query generation) is going to be part of a final ANSI
SQL.
|
private List<String> |
allInputValues
The list of dynamic input values.
|
private Map<String,SqlInputValue> |
identities
List of all identities, which have values generated using sequences.
|
private Map<String,SqlInputValue> |
inputValues
The map of dynamic input values.
|
(package private) boolean |
logError
The failed SQL command should be logged.
|
private Integer |
orderIndex
The index of selected ordering rule (from the list of ordering directives).
|
private Map<String,SqlMappingItem> |
outputValues
The list of output values.
|
private Map<String,SqlInputValue> |
outValues
List of all input values, which are in fact OUT or INOUT parameters.
|
private boolean |
skipNextText
The indicator that a the next possible text has to be skipped.
|
private StringBuilder |
sql
The final ANSI SQL or the fragment of ANSI SQL, which is dynamically generated from the META SQL based on input
values.
|
Constructor and Description |
---|
SqlProcessResult()
Creates a new instance.
|
SqlProcessResult(String sql)
Creates a new instance with a SQL fragment from SqlMetaText.
|
Modifier and Type | Method and Description |
---|---|
(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 |
compareTo(SqlProcessResult o)
In case there're several ordering rules in the final generated ANSI SQL, they should be ordered.
|
Map<String,SqlInputValue> |
getIdentities()
Returns the collection of identities.
|
(package private) SqlInputValue |
getInputValue(String name)
Returns the input value .
|
(package private) List<String> |
getInputValues()
Returns the collection of dynamic input values.
|
(package private) Map<String,SqlInputValue> |
getMappedInputValues()
Returns the collection of dynamic input values.
|
(package private) Integer |
getOrderIndex()
Returns the index of selected ordering rule (from the list of ordering directives).
|
(package private) Map<String,SqlMappingItem> |
getOutputValues()
Returns the collection of output values.
|
(package private) Map<String,SqlInputValue> |
getOutValues()
Returns the collection of OUT/INOUT values.
|
StringBuilder |
getSql()
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 |
isLogError()
Returns an indicator the failed SQL command should be logged
|
(package private) boolean |
isSkipNextText()
Returns the indicator the next possible SQL statement fragment should be skipped.
|
void |
postProcess()
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).
|
void |
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.
|
String |
toString()
For debug purposes.
|
void |
validate(SqlValidator validator)
Validates the processed input attributes and their values.
|
private boolean add
private List<String> allInputValues
private Map<String,SqlInputValue> inputValues
private Map<String,SqlMappingItem> outputValues
private Map<String,SqlInputValue> identities
private Map<String,SqlInputValue> outValues
private StringBuilder sql
private Integer orderIndex
private boolean skipNextText
boolean logError
SqlProcessResult()
SqlProcessResult(String sql)
sql
- a SQL fragmentvoid addFalse()
void addTrue()
void add(boolean add)
add
- a new indicator valueboolean isAdd()
void addInputValue(String key, SqlInputValue value)
key
- the name of a dynamic input valuevalue
- a new dynamic input valuevoid addInputValues(List<String> inputValues)
inputValues
- a new collection of dynamic input valuesvoid addMappedInputValues(Map<String,SqlInputValue> inputValues)
inputValues
- a new collection of dynamic input valuesList<String> getInputValues()
Map<String,SqlInputValue> getMappedInputValues()
SqlInputValue getInputValue(String name)
name
- the name of the parametervoid addOutputValue(String key, SqlMappingItem value)
key
- the name of an output valuevalue
- a new output valuevoid addOutputValues(Map<String,SqlMappingItem> outputValues)
outputValues
- a new collection of output valuesMap<String,SqlMappingItem> getOutputValues()
void addIdentity(String key, SqlInputValue value)
key
- the name of an identity column/attributevalue
- a new identity valuevoid addIdentities(Map<String,SqlInputValue> identities)
identities
- a new collection of identitiespublic Map<String,SqlInputValue> getIdentities()
void addOutValue(String key, SqlInputValue value)
key
- the name of an OUT/INOUT column/attributevalue
- a new OUT/INOUT valuevoid addOutValues(Map<String,SqlInputValue> outValues)
outValues
- a new collection of OUT/INOUT valuesMap<String,SqlInputValue> getOutValues()
void setSql(StringBuilder sql)
sql
- the final ANSI SQL or a fragment of ANSI SQLpublic StringBuilder getSql()
void setOrderIndex(Integer orderIndex)
orderIndex
- a new index of selected ordering ruleInteger getOrderIndex()
public void setLogError(boolean logError)
logError
- an indicator the failed SQL command should be loggedpublic boolean isLogError()
boolean isSkipNextText()
void setSkipNextText(boolean skipNextText)
skipNextText
- an indicator the next possible SQL statement fragment should be skippedpublic void setQueryParams(SqlSession session, SqlQuery query) throws SqlRuntimeException
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 staffSqlRuntimeException
- in the case of any problem with input values handlingpublic void postProcess() throws SqlRuntimeException
SqlRuntimeException
- in the case of any problem with output values handlingpublic String toString()
public int compareTo(SqlProcessResult o)
compareTo
in interface Comparable<SqlProcessResult>
public void validate(SqlValidator validator) throws SqlValidationException
validator
- the injected validatorSqlValidationException
- in the case the validation isn't successfullCopyright © 2014. All Rights Reserved.