|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.sqlproc.engine.spring.SpringQuery
public class SpringQuery
The Spring stack implementation of the SQL Engine query contract. In fact it's an adapter the internal Spring stuff.
For more info please see the Reference Guide or the tutorials.
Field Summary | |
---|---|
(package private) Integer |
firstResult
The first row to retrieve. |
(package private) List<String> |
identities
The collection of all (auto-generated) identities. |
(package private) Map<String,IdentitySetter> |
identitySetters
The collection of all identities setters. |
(package private) Map<String,Object> |
identityTypes
The collection of all identities types. |
(package private) org.springframework.jdbc.core.JdbcTemplate |
jdbcTemplate
The Spring JdbcTemplate, the central class for all Spring database operations. |
(package private) org.slf4j.Logger |
logger
The internal slf4j logger. |
(package private) Integer |
maxResults
The maximum number of rows to retrieve. |
(package private) List<String> |
parameters
The collection of all parameters (input value declarations). |
(package private) Map<String,Object> |
parameterTypes
The collection of all parameters types. |
(package private) Map<String,Object> |
parameterValues
The collection of all parameters values. |
(package private) String |
queryString
The SQL query/statement command. |
(package private) List<String> |
scalars
The collection of all scalars (output values declarations). |
(package private) Map<String,Object> |
scalarTypes
The collection of all scalars types. |
(package private) Integer |
timeout
A timeout for the underlying query. |
Constructor Summary | |
---|---|
SpringQuery(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate,
String queryString)
Creates a new instance of this adapter. |
Method Summary | |
---|---|
SqlQuery |
addScalar(String columnAlias)
|
SqlQuery |
addScalar(String columnAlias,
Object type)
|
private void |
doIdentitySelect(String identityName)
Runs the select to obtain the value of auto-generated identity. |
int |
executeUpdate()
|
Object |
getQuery()
|
protected List |
getResults(ResultSet rs)
Gets the value of the designated columns as the objects in the Java programming language. |
List |
list()
|
SqlQuery |
setFirstResult(int firstResult)
|
protected int |
setLimits(PreparedStatement ps,
SqlUtils.LimitType limitType,
int ix,
boolean afterSql)
Sets the limit related parameters. |
SqlQuery |
setMaxResults(int maxResults)
|
SqlQuery |
setParameter(String name,
Object val)
|
SqlQuery |
setParameter(String name,
Object val,
Object type)
|
SqlQuery |
setParameterList(String name,
Object[] vals)
|
SqlQuery |
setParameterList(String name,
Object[] vals,
Object type)
|
protected void |
setParameters(PreparedStatement ps,
SqlUtils.LimitType limitType)
Sets the value of the designated parameters. |
SqlQuery |
setTimeout(int timeout)
|
Object |
uniqueResult()
|
protected int |
update(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.PreparedStatementSetter pss)
This is a workaround, as this method is not visible in JdbcTemplate. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
final org.slf4j.Logger logger
org.springframework.jdbc.core.JdbcTemplate jdbcTemplate
String queryString
List<String> scalars
Map<String,Object> scalarTypes
List<String> parameters
Map<String,Object> parameterValues
Map<String,Object> parameterTypes
List<String> identities
Map<String,IdentitySetter> identitySetters
Map<String,Object> identityTypes
Integer timeout
Integer firstResult
Integer maxResults
Constructor Detail |
---|
public SpringQuery(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, String queryString)
jdbcTemplate
- the Spring JdbcTemplate instancequeryString
- the SQL query/statement commandMethod Detail |
---|
public Object getQuery()
getQuery
in interface SqlQuery
public SqlQuery setTimeout(int timeout)
setTimeout
in interface SqlQuery
public SqlQuery setFirstResult(int firstResult)
setFirstResult
in interface SqlQuery
public SqlQuery setMaxResults(int maxResults)
setMaxResults
in interface SqlQuery
public List list() throws SqlProcessorException
list
in interface SqlQuery
SqlProcessorException
public Object uniqueResult() throws SqlProcessorException
uniqueResult
in interface SqlQuery
SqlProcessorException
public int executeUpdate() throws SqlProcessorException
executeUpdate
in interface SqlQuery
SqlProcessorException
private void doIdentitySelect(String identityName)
identityName
- the identity name from the META SQL statementprotected int update(org.springframework.jdbc.core.PreparedStatementCreator psc, org.springframework.jdbc.core.PreparedStatementSetter pss) throws org.springframework.dao.DataAccessException
org.springframework.dao.DataAccessException
public SqlQuery addScalar(String columnAlias)
addScalar
in interface SqlQuery
public SqlQuery addScalar(String columnAlias, Object type)
addScalar
in interface SqlQuery
public SqlQuery setParameter(String name, Object val) throws SqlProcessorException
setParameter
in interface SqlQuery
SqlProcessorException
public SqlQuery setParameter(String name, Object val, Object type) throws SqlProcessorException
setParameter
in interface SqlQuery
SqlProcessorException
public SqlQuery setParameterList(String name, Object[] vals) throws SqlProcessorException
setParameterList
in interface SqlQuery
SqlProcessorException
public SqlQuery setParameterList(String name, Object[] vals, Object type) throws SqlProcessorException
setParameterList
in interface SqlQuery
SqlProcessorException
protected void setParameters(PreparedStatement ps, SqlUtils.LimitType limitType) throws SQLException
ps
- an instance of PreparedStatementlimitType
- the limit type to restrict the number of rows in the result set
SQLException
- if a database access error occurs or this method is called on a closed PreparedStatement
protected int setLimits(PreparedStatement ps, SqlUtils.LimitType limitType, int ix, boolean afterSql) throws SQLException
ps
- an instance of PreparedStatementlimitType
- the limit type to restrict the number of rows in the result setix
- a column indexafterSql
- an indicator it's done after the main SQL statement execution
SQLException
- if a database access error occurs or this method is called on a closed PreparedStatement
protected List getResults(ResultSet rs) throws SQLException
rs
- an instance of ResultSet
SQLException
- if a database access error occurs or this method is called on a closed ResultSet
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |