public interface SqlQuery
For the concrete implementation please see for example JdbcQuery.
For more info please see the Tutorials.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
SqlQuery.SqlQueryRowProcessor
A low level callback to be used with the cursor based queries.
|
| Modifier and Type | Method and Description |
|---|---|
SqlQuery |
addScalar(String columnAlias)
Declares a scalar query result, which is an SQL query execution output value.
|
SqlQuery |
addScalar(String columnAlias,
Object type,
Class<?>... moreTypes)
Declares a scalar query result, which is an SQL query execution output value.
|
Map<String,Object> |
callFunction()
Executes the statements in the stored function, which return value of any type but the result set.
|
List<Map<String,Object>> |
callList(SqlRuntimeContext runtime)
Returns the stored procedure execution results as a List.
|
Map<String,Object> |
callUnique(SqlRuntimeContext runtime)
Convenience method to return a single instance that matches the stored procedure execution, or null if the stored
procedure execution returns no results.
|
int |
callUpdate(SqlRuntimeContext runtime)
Executes the update, delete, insert statement or other statements in the stored procedure, which don't return the
result set.
|
int[] |
executeBatch(String[] statements)
Submits a batch of commands to the database for execution and if all commands execute successfully, returns an
array of update counts.
|
Object |
getQuery()
Returns the internal representation of this query.
|
List<Map<String,Object>> |
list(SqlRuntimeContext runtime)
Returns the query results as a List.
|
int |
query(SqlRuntimeContext runtime,
SqlQuery.SqlQueryRowProcessor sqlQueryRowProcessor)
Process the query output using the
SqlQuery.SqlQueryRowProcessor. |
void |
setLogError(boolean logError)
Sets an indicator the failed SQL command should be logged
|
SqlQuery |
setOrdered(boolean ordered)
Sets the indicator the SQL output is sorted.
|
SqlQuery |
setParameter(String name,
Object val)
Binds a value to a named query parameter.
|
SqlQuery |
setParameter(String name,
Object val,
Object type,
Class<?>... moreTypes)
Binds a value to a named query parameter.
|
SqlQuery |
setParameterList(String name,
Object[] vals)
Binds multiple values to a named query parameter.
|
SqlQuery |
setParameterList(String name,
Object[] vals,
Object type,
Class<?>... moreTypes)
Binds multiple values to a named query parameter.
|
SqlQuery |
setSqlControl(SqlControl sqlControl)
Sets the compound parameters controlling the META SQL execution.
|
Map<String,Object> |
unique(SqlRuntimeContext runtime)
Convenience method to return a single instance that matches the query, or null if the query returns no results.
|
int |
update(SqlRuntimeContext runtime)
Executes the update, delete or insert statement.
|
Object getQuery()
SqlQuery setSqlControl(SqlControl sqlControl)
sqlControl - the compound parameters controlling the META SQL executionSqlQuery setOrdered(boolean ordered)
ordered - the indicator the SQL output is sortedList<Map<String,Object>> list(SqlRuntimeContext runtime) throws SqlProcessorException
runtime - the public runtime contextSqlProcessorException - in the case of any problem in ORM or JDBC stackMap<String,Object> unique(SqlRuntimeContext runtime) throws SqlProcessorException
runtime - the public runtime contextSqlProcessorException - in the case of any problem in ORM or JDBC stackint query(SqlRuntimeContext runtime, SqlQuery.SqlQueryRowProcessor sqlQueryRowProcessor) throws SqlProcessorException
SqlQuery.SqlQueryRowProcessor.runtime - the public runtime contextsqlQueryRowProcessor - the callback designated to process every database rowSqlProcessorException - in the case of any problem in ORM or JDBC stackint update(SqlRuntimeContext runtime) throws SqlProcessorException
runtime - the public runtime contextSqlProcessorException - in the case of any problem in ORM or JDBC stackList<Map<String,Object>> callList(SqlRuntimeContext runtime) throws SqlProcessorException
runtime - the public runtime contextSqlProcessorException - in the case of any problem in ORM or JDBC stackMap<String,Object> callUnique(SqlRuntimeContext runtime) throws SqlProcessorException
runtime - the public runtime contextSqlProcessorException - in the case of any problem in ORM or JDBC stackint callUpdate(SqlRuntimeContext runtime) throws SqlProcessorException
runtime - the public runtime contextSqlProcessorException - in the case of any problem in ORM or JDBC stackMap<String,Object> callFunction() throws SqlProcessorException
SqlProcessorException - in the case of any problem in ORM or JDBC stackSqlQuery addScalar(String columnAlias)
columnAlias - the name of the database column or the alias in the result setSqlQuery addScalar(String columnAlias, Object type, Class<?>... moreTypes)
columnAlias - the name of the database column or the alias in the result settype - the (META) type of the parameterSqlQuery setParameter(String name, Object val) throws SqlProcessorException
name - the name of the parameterval - the not-null parameter valueSqlProcessorException - in the case of any problem in ORM or JDBC stackSqlQuery setParameter(String name, Object val, Object type, Class<?>... moreTypes) throws SqlProcessorException
name - the name of the parameterval - the possibly-null parameter valuetype - the (META) type of the parameterSqlProcessorException - in the case of any problem in ORM or JDBC stackSqlQuery setParameterList(String name, Object[] vals) throws SqlProcessorException
name - the name of the parametervals - a collection of valuesSqlProcessorException - in the case of any problem in ORM or JDBC stackSqlQuery setParameterList(String name, Object[] vals, Object type, Class<?>... moreTypes) throws SqlProcessorException
name - the name of the parametervals - a collection of valuestype - the (META) type of the parameterSqlProcessorException - in the case of any problem in ORM or JDBC stackint[] executeBatch(String[] statements) throws SqlProcessorException
statements - SQL statements to be executed in batchSqlProcessorException - in the case of any problem in ORM or JDBC stackvoid setLogError(boolean logError)
logError - an indicator the failed SQL command should be loggedCopyright © 2016. All rights reserved.