Package org.sqlproc.engine.impl
Class SqlStandardControl
- java.lang.Object
-
- org.sqlproc.engine.impl.SqlStandardControl
-
- All Implemented Interfaces:
SqlControl
public class SqlStandardControl extends Object implements SqlControl
The compound parameters controlling the META SQL execution.For more info please see the Tutorials.
- Author:
- Vladimir Hudec
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.sqlproc.engine.SqlControl
SqlControl.LowLevelSqlCallback, SqlControl.SqlExecutionCallback
-
-
Field Summary
Fields Modifier and Type Field Description private Object
dynamicUpdateValues
The object used for the SQL update statement dynamic input values.private Map<String,Object>
features
The optional features.private Integer
fetchSize
Returns the fetch size of SQL execution output rows, which can be returned in one SQL statement.private Integer
firstResult
The first SQL execution output row to be returned in the case we need to skip some rows in the result set.private SqlControl.LowLevelSqlCallback
lowLevelSqlCallback
The low level SQL callback handler.private Integer
maxResults
The max number of SQL execution output rows, which can be returned in the result list.private Integer
maxTimeout
The max SQL execution time.private Map<String,Class<?>>
moreResultClasses
More result classes used for the return values, like the collections classes or the collections items.private SqlOrder
order
The ordering directive list.private String
processingId
The unique ID of the executed statement based on input values combination.private Boolean
skipEmptyStatement
The indicator, that an empty INSERT or UPDATE statement execution should be ignored (for example update statement without any bounded input values).private SqlControl.SqlExecutionCallback
sqlExecutionCallback
The SQL command execution callback handler.private String
sqlName
The name of the required SQL Query Engine instance.private Object
staticInputValues
The object used for the SQL statement dynamic input values.
-
Constructor Summary
Constructors Constructor Description SqlStandardControl()
Standard constructor.SqlStandardControl(SqlControl sqlControl)
Merging constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
getDynamicUpdateValues()
The object used for the SQL update statement dynamic input values.Map<String,Object>
getFeatures()
Returns the optional features.Integer
getFetchSize()
Returns the fetch size of SQL execution output rows, which can be returned in one SQL statement.Integer
getFirstResult()
Returns the first SQL execution output row to be returned in the case we need to skip some rows in the result set.SqlControl.LowLevelSqlCallback
getLowLevelSqlCallback()
Returns the low level SQL callback handlerInteger
getMaxResults()
Returns the max number of SQL execution output rows, which can be returned in the result list.Integer
getMaxTimeout()
Returns the max SQL execution time.Map<String,Class<?>>
getMoreResultClasses()
Returns more result classes used for the return values, like the collections classes or the collections items.SqlOrder
getOrder()
Returns the ordering directive list.String
getProcessingId()
Returns the unique ID of the executed statement based on the input values combination.Boolean
getSkipEmptyStatement()
Returns the indicator, that an empty INSERT or UPDATE statement execution should be ignored (for example update statement without any bounded input values).SqlControl.SqlExecutionCallback
getSqlExecutionCallback()
Returns the SQL command execution callback handlerString
getSqlName()
Returns the name of the required SQL Query Engine instanceObject
getStaticInputValues()
Returns the object used for the SQL statement static input values.SqlStandardControl
setAscOrder(int order)
Sets the ordering directive list.SqlStandardControl
setAscOrder(String order)
Sets the ordering directive list.SqlStandardControl
setAscOrderNullsLast(int order)
Sets the ordering directive list.SqlStandardControl
setAscOrderNullsLast(String order)
Sets the ordering directive list.SqlStandardControl
setDescOrder(int order)
Sets the ordering directive list.SqlStandardControl
setDescOrder(String order)
Sets the ordering directive list.SqlStandardControl
setDescOrderNullsFirst(int order)
Sets the ordering directive list.SqlStandardControl
setDescOrderNullsFirst(String order)
Sets the ordering directive list.SqlStandardControl
setDynamicUpdateValues(Object dynamicUpdateValues)
Sets the object used for the SQL update statement dynamic input values.SqlStandardControl
setFeature(String name, Object value)
Sets the optional feature in the stament's execution scope.SqlStandardControl
setFeatures(Map<String,Object> features)
Sets the optional features.SqlStandardControl
setFetchSize(Integer fetchSize)
Sets the fetch size of SQL execution output rows, which can be returned in one SQL statement.SqlStandardControl
setFirstResult(Integer firstResult)
Sets the first SQL execution output row to be returned in the case we need to skip some rows in the result set.SqlStandardControl
setLowLevelSqlCallback(SqlControl.LowLevelSqlCallback lowLevelSqlCallback)
Sets the low level SQL callback handler.SqlStandardControl
setMaxResults(Integer maxResults)
Sets the max number of SQL execution output rows, which can be returned in the result list.SqlStandardControl
setMaxTimeout(Integer maxTimeout)
Sets the max SQL execution time.SqlStandardControl
setMoreResultClasses(Map<String,Class<?>> moreResultClasses)
Sets more result classes used for the return values, like the collections classes or the collections items.SqlStandardControl
setOrder(SqlOrder order)
Sets the ordering directive list.SqlStandardControl
setProcessingId(String processingId)
Sets the unique ID of the executed statement based on input values combination.void
setSkipEmptyStatement(Boolean skipEmptyStatement)
Sets the indicator, that an empty INSERT or UPDATE statement execution should be ignored (for example update statement without any bounded input values).SqlStandardControl
setSqlExecutionCallback(SqlControl.SqlExecutionCallback sqlExecutionCallback)
Sets the SQL command execution callback handler.SqlStandardControl
setSqlName(String sqlName)
Sets the name of the required SQL Query Engine instanceSqlStandardControl
setStaticInputValues(Object staticInputValues)
Sets the object used for the SQL statement static input values.String
toString()
SqlStandardControl
unsetFeatures(Set<String> names)
Clears the optional features in the stament's or execution scope.
-
-
-
Field Detail
-
staticInputValues
private Object staticInputValues
The object used for the SQL statement dynamic input values. The class of this object is also named as the input class or the dynamic parameters class. The exact class type isn't important, all the parameters settled into the SQL prepared statement are picked up using the reflection API.
-
dynamicUpdateValues
private Object dynamicUpdateValues
The object used for the SQL update statement dynamic input values. This enables to split input values into value used for WHERE fragment and for UPDATE fragment of the SQL statement. In the case this parameter is null, the dynamicInputValues parameter forSqlCrudEngine.update(SqlSession, Object, SqlControl)
holds all input values.
-
maxTimeout
private Integer maxTimeout
The max SQL execution time. This parameter can help to protect production system against ineffective SQL query commands. The value is in milliseconds.
-
firstResult
private Integer firstResult
The first SQL execution output row to be returned in the case we need to skip some rows in the result set. The primary usage is to support the pagination.
-
maxResults
private Integer maxResults
The max number of SQL execution output rows, which can be returned in the result list. The primary usage is to support the pagination.
-
order
private SqlOrder order
The ordering directive list. Using the class SqlOrder the ordering rules can be chained. Every ordering rule in this chain should correspond to one META SQL ordering statement.
-
moreResultClasses
private Map<String,Class<?>> moreResultClasses
More result classes used for the return values, like the collections classes or the collections items. They are used mainly for the one-to-one, one-to-many and many-to-many associations.
-
features
private Map<String,Object> features
The optional features. These features are defined in the statement execution scope. In the case of conflict with the optional features defined in sthe statement/global scope, their priority is higher.
-
processingId
private String processingId
The unique ID of the executed statement based on input values combination. This ID can be used for the caching purposes to optimize theSqlMetaStatement.process(org.sqlproc.engine.impl.SqlMetaStatement.Type, Object, SqlControl, org.sqlproc.engine.SqlEngine)
The generation of the final ANSI SQL statement from the META SQL statement is influenced by the input values combination. This ID is an indicator of the uniqueness these input values. For more info please see the tutorials.
-
fetchSize
private Integer fetchSize
Returns the fetch size of SQL execution output rows, which can be returned in one SQL statement.
-
skipEmptyStatement
private Boolean skipEmptyStatement
The indicator, that an empty INSERT or UPDATE statement execution should be ignored (for example update statement without any bounded input values).
-
lowLevelSqlCallback
private SqlControl.LowLevelSqlCallback lowLevelSqlCallback
The low level SQL callback handler. Enables the input values and the final SQL command modification before the required database command execution. Enables the output values modification after the required database command execution.
-
sqlExecutionCallback
private SqlControl.SqlExecutionCallback sqlExecutionCallback
The SQL command execution callback handler. Enables the input values and the final SQL command modification before the required database command execution. Enables the output values modification after the required database command execution.
-
sqlName
private String sqlName
The name of the required SQL Query Engine instance. It can be used in the case the name is to be chosen in the runtime.
-
-
Constructor Detail
-
SqlStandardControl
public SqlStandardControl()
Standard constructor.
-
SqlStandardControl
public SqlStandardControl(SqlControl sqlControl)
Merging constructor.
-
-
Method Detail
-
getStaticInputValues
public Object getStaticInputValues()
Returns the object used for the SQL statement static input values. The class of this object is also named as the input class or the static parameters class. The exact class type isn't important, all the parameters injected into the SQL query command are picked up using the reflection API. Compared to dynamicInputValues input parameters, parameters in this class should't be produced by an end user to prevent SQL injection threat!- Specified by:
getStaticInputValues
in interfaceSqlControl
- Returns:
- the object used for the SQL statement static input values
-
setStaticInputValues
public SqlStandardControl setStaticInputValues(Object staticInputValues)
Sets the object used for the SQL statement static input values. The class of this object is also named as the input class or the static parameters class. The exact class type isn't important, all the parameters injected into the SQL query command are picked up using the reflection API. Compared to dynamicInputValues input parameters, parameters in this class should't be produced by an end user to prevent SQL injection threat!- Parameters:
staticInputValues
- the object used for the SQL statement static input values- Returns:
- this instance
-
getDynamicUpdateValues
public Object getDynamicUpdateValues()
The object used for the SQL update statement dynamic input values. This enables to split input values into value used for WHERE fragment and for UPDATE fragment of the SQL statement. In the case this parameter is null, the dynamicInputValues parameter forSqlCrudEngine.update(SqlSession, Object, SqlControl)
holds all input values.- Specified by:
getDynamicUpdateValues
in interfaceSqlControl
- Returns:
- the object used for the SQL update statement dynamic input values (UPDATE fragment)
-
setDynamicUpdateValues
public SqlStandardControl setDynamicUpdateValues(Object dynamicUpdateValues)
Sets the object used for the SQL update statement dynamic input values. This enables to split input values into value used for WHERE fragment and for UPDATE fragment of the SQL statement. In the case this parameter is null, the dynamicInputValues parameter forSqlCrudEngine.update(SqlSession, Object, SqlControl)
holds all input values.- Parameters:
dynamicUpdateValues
- the object used for the SQL update statement dynamic input values (UPDATE fragment)- Returns:
- this instance
-
getMaxTimeout
public Integer getMaxTimeout()
Returns the max SQL execution time. This parameter can help to protect production system against ineffective SQL query commands. The value is in milliseconds.- Specified by:
getMaxTimeout
in interfaceSqlControl
- Returns:
- the max SQL execution time
-
setMaxTimeout
public SqlStandardControl setMaxTimeout(Integer maxTimeout)
Sets the max SQL execution time. This parameter can help to protect production system against ineffective SQL query commands. The value is in milliseconds.- Parameters:
maxTimeout
- the max SQL execution time- Returns:
- this instance
-
getFirstResult
public Integer getFirstResult()
Returns the first SQL execution output row to be returned in the case we need to skip some rows in the result set. The primary usage is to support the pagination.- Specified by:
getFirstResult
in interfaceSqlControl
- Returns:
- the first SQL execution output row
-
setFirstResult
public SqlStandardControl setFirstResult(Integer firstResult)
Sets the first SQL execution output row to be returned in the case we need to skip some rows in the result set. The primary usage is to support the pagination.- Parameters:
firstResult
- the first SQL execution output row- Returns:
- this instance
-
getMaxResults
public Integer getMaxResults()
Returns the max number of SQL execution output rows, which can be returned in the result list. The primary usage is to support the pagination.- Specified by:
getMaxResults
in interfaceSqlControl
- Returns:
- the max number of SQL execution output rows
-
setMaxResults
public SqlStandardControl setMaxResults(Integer maxResults)
Sets the max number of SQL execution output rows, which can be returned in the result list. The primary usage is to support the pagination.- Parameters:
maxResults
- the max number of SQL execution output rows- Returns:
- this instance
-
getOrder
public SqlOrder getOrder()
Returns the ordering directive list. Using the class SqlOrder the ordering rules can be chained. Every ordering rule in this chain should correspond to one META SQL ordering statement.- Specified by:
getOrder
in interfaceSqlControl
- Returns:
- the ordering directive list
-
setOrder
public SqlStandardControl setOrder(SqlOrder order)
Sets the ordering directive list. Using the class SqlOrder the ordering rules can be chained. Every ordering rule in this chain should correspond to one META SQL ordering statement.- Parameters:
order
- the ordering directive list- Returns:
- this instance
-
setAscOrder
public SqlStandardControl setAscOrder(int order)
Sets the ordering directive list. Using the class SqlOrder the ordering rules can be chained. Every ordering rule in this chain should correspond to one META SQL ordering statement.- Parameters:
order
- the ordering directive- Returns:
- this instance
-
setAscOrderNullsLast
public SqlStandardControl setAscOrderNullsLast(int order)
Sets the ordering directive list. Using the class SqlOrder the ordering rules can be chained. Every ordering rule in this chain should correspond to one META SQL ordering statement.- Parameters:
order
- the ordering directive- Returns:
- this instance
-
setAscOrder
public SqlStandardControl setAscOrder(String order)
Sets the ordering directive list. Using the class SqlOrder the ordering rules can be chained. Every ordering rule in this chain should correspond to one META SQL ordering statement.- Parameters:
order
- the ordering directive- Returns:
- this instance
-
setAscOrderNullsLast
public SqlStandardControl setAscOrderNullsLast(String order)
Sets the ordering directive list. Using the class SqlOrder the ordering rules can be chained. Every ordering rule in this chain should correspond to one META SQL ordering statement.- Parameters:
order
- the ordering directive- Returns:
- this instance
-
setDescOrder
public SqlStandardControl setDescOrder(int order)
Sets the ordering directive list. Using the class SqlOrder the ordering rules can be chained. Every ordering rule in this chain should correspond to one META SQL ordering statement.- Parameters:
order
- the ordering directive- Returns:
- this instance
-
setDescOrderNullsFirst
public SqlStandardControl setDescOrderNullsFirst(int order)
Sets the ordering directive list. Using the class SqlOrder the ordering rules can be chained. Every ordering rule in this chain should correspond to one META SQL ordering statement.- Parameters:
order
- the ordering directive- Returns:
- this instance
-
setDescOrder
public SqlStandardControl setDescOrder(String order)
Sets the ordering directive list. Using the class SqlOrder the ordering rules can be chained. Every ordering rule in this chain should correspond to one META SQL ordering statement.- Parameters:
order
- the ordering directive- Returns:
- this instance
-
setDescOrderNullsFirst
public SqlStandardControl setDescOrderNullsFirst(String order)
Sets the ordering directive list. Using the class SqlOrder the ordering rules can be chained. Every ordering rule in this chain should correspond to one META SQL ordering statement.- Parameters:
order
- the ordering directive- Returns:
- this instance
-
getMoreResultClasses
public Map<String,Class<?>> getMoreResultClasses()
Returns more result classes used for the return values, like the collections classes or the collections items. They are used mainly for the one-to-one, one-to-many and many-to-many associations.- Specified by:
getMoreResultClasses
in interfaceSqlControl
- Returns:
- more result classes used for the return values
-
setMoreResultClasses
public SqlStandardControl setMoreResultClasses(Map<String,Class<?>> moreResultClasses)
Sets more result classes used for the return values, like the collections classes or the collections items. They are used mainly for the one-to-one, one-to-many and many-to-many associations.- Parameters:
moreResultClasses
- more result classes used for the return values- Returns:
- this instance
-
getFeatures
public Map<String,Object> getFeatures()
Returns the optional features. These features are defined in the statement execution scope. In the case of conflict with the optional features defined in sthe statement/global scope, their priority is higher.- Specified by:
getFeatures
in interfaceSqlControl
- Returns:
- the optional features
-
setFeatures
public SqlStandardControl setFeatures(Map<String,Object> features)
Sets the optional features. These features are defined in the statement execution scope. In the case of conflict with the optional features defined in sthe statement/global scope, their priority is higher.- Parameters:
features
- the optional features
-
setFeature
public SqlStandardControl setFeature(String name, Object value)
Sets the optional feature in the stament's execution scope.- Parameters:
name
- the name of the optional featurevalue
- the value of the optional feature
-
unsetFeatures
public SqlStandardControl unsetFeatures(Set<String> names)
Clears the optional features in the stament's or execution scope.- Parameters:
names
- the names of the optional features
-
getProcessingId
public String getProcessingId()
Returns the unique ID of the executed statement based on the input values combination. This ID can be used for the caching purposes to optimize theSqlMetaStatement.process(org.sqlproc.engine.impl.SqlMetaStatement.Type, Object, SqlControl, SqlEngine)
The generation of the final ANSI SQL statement from the META SQL statement is influenced by the input values. This ID is an indicator of the uniqueness these input values. For more info please see the tutorials.- Specified by:
getProcessingId
in interfaceSqlControl
- Returns:
- the unique ID of the executed statement based on the input values combination
-
setProcessingId
public SqlStandardControl setProcessingId(String processingId)
Sets the unique ID of the executed statement based on input values combination. This ID can be used for the caching purposes to optimize theSqlMetaStatement.process(org.sqlproc.engine.impl.SqlMetaStatement.Type, Object, SqlControl, org.sqlproc.engine.SqlEngine)
The generation of the final ANSI SQL statement from the META SQL statement is influenced by the input values. This ID is an indicator of the uniqueness these input values. For more info please see the tutorials.- Parameters:
processingId
- the unique ID of the executed statement based on input values combination
-
getFetchSize
public Integer getFetchSize()
Returns the fetch size of SQL execution output rows, which can be returned in one SQL statement.- Specified by:
getFetchSize
in interfaceSqlControl
- Returns:
- the fetch size of SQL execution output rows
-
setFetchSize
public SqlStandardControl setFetchSize(Integer fetchSize)
Sets the fetch size of SQL execution output rows, which can be returned in one SQL statement.- Parameters:
fetchSize
- the fetch size of SQL execution output rows- Returns:
- this instance
-
getSkipEmptyStatement
public Boolean getSkipEmptyStatement()
Returns the indicator, that an empty INSERT or UPDATE statement execution should be ignored (for example update statement without any bounded input values).- Specified by:
getSkipEmptyStatement
in interfaceSqlControl
- Returns:
- the indicator, that an empty INSERT or UPDATE statement execution should be ignored
-
setSkipEmptyStatement
public void setSkipEmptyStatement(Boolean skipEmptyStatement)
Sets the indicator, that an empty INSERT or UPDATE statement execution should be ignored (for example update statement without any bounded input values).- Parameters:
skipEmptyStatement
- the indicator, that an empty INSERT or UPDATE statement execution should be ignored
-
getLowLevelSqlCallback
public SqlControl.LowLevelSqlCallback getLowLevelSqlCallback()
Returns the low level SQL callback handler- Specified by:
getLowLevelSqlCallback
in interfaceSqlControl
- Returns:
- the low level SQL callback handler
-
setLowLevelSqlCallback
public SqlStandardControl setLowLevelSqlCallback(SqlControl.LowLevelSqlCallback lowLevelSqlCallback)
Sets the low level SQL callback handler.- Parameters:
lowLevelSqlCallback
- the low level SQL callback handler- Returns:
- this instance
-
getSqlExecutionCallback
public SqlControl.SqlExecutionCallback getSqlExecutionCallback()
Returns the SQL command execution callback handler- Specified by:
getSqlExecutionCallback
in interfaceSqlControl
- Returns:
- the SQL command execution callback handler
-
setSqlExecutionCallback
public SqlStandardControl setSqlExecutionCallback(SqlControl.SqlExecutionCallback sqlExecutionCallback)
Sets the SQL command execution callback handler.- Parameters:
lowLevelSqlCallback
- the SQL command execution callback handler- Returns:
- this instance
-
getSqlName
public String getSqlName()
Returns the name of the required SQL Query Engine instance- Specified by:
getSqlName
in interfaceSqlControl
- Returns:
- the name of the required SQL Query Engine instance
-
setSqlName
public SqlStandardControl setSqlName(String sqlName)
Sets the name of the required SQL Query Engine instance- Parameters:
sqlName
- the name of the required SQL Query Engine instance- Returns:
- this instance
-
-