| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.springframework.jdbc.object.RdbmsOperation
|
+--org.springframework.jdbc.object.SqlOperation
|
+--org.springframework.jdbc.object.SqlQuery
|
+--org.springframework.jdbc.object.MappingSqlQueryWithParameters
|
+--org.springframework.jdbc.object.MappingSqlQuery
|
+--org.springframework.jdbc.object.SqlFunction
SQL "function" wrapper for a query that returns a single row of results. The default behavior is to return an int, but that can be overridden by using the methods with an extra return type parameter. Intended to use to call SQL functions that return a single result using a query like "select user()" or "select sysdate from dual". It is not intended for calling more complex stored functions or for using a callableStatement to invoke a stored procedure or stored function. Use StoredProcedure or SqlCall for this type of processing.
This is a concrete class, which there is normally no need to subclass. Code using this package can create an object of this type, declaring SQL and parameters, and then invoke the appropriate run() method repeatedly to execute the function.
Like all RdbmsOperation objects, SqlFunction objects are threadsafe.
| Constructor Summary | |
SqlFunction()Constructor to allow use as a JavaBean. | |
SqlFunction(DataSource ds, String sql, int[] types)Create a new SQLFunction object with SQL and parameters. | |
SqlFunction(DataSource ds, String sql, int[] types, int retType)Create a new SQLFunction object with SQL, parameters and a return type | |
SqlFunction(DataSource ds, String sql)Create a new SQLFunction object with SQL, but without parameters. | |
SqlFunction(DataSource ds, String sql, int retType)Create a new SQLFunction object with SQL and return type, but without parameters. | |
| Method Summary | |
int | run()Convenient method to run the function without arguments. |
int | run(int p)Convenient method to run the function with a single int argument. |
int | run(Object[] args)Analogous to the SqlQuery.execute([]) method. |
Object | runGeneric()Convenient method to run the function without arguments, returning the value as an object |
Object | runGeneric(int p)Convenient method to run the function with a single int argument. |
Object | runGeneric(Object[] args)Analogous to the SqlQuery.execute([]) method. |
| Methods inherited from class org.springframework.jdbc.object.SqlQuery |
execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, execute, findObject, findObject, findObject, findObject, findObject, findObject, findObject, findObject, findObject, findObject, getRowsExpected, setRowsExpected |
| Methods inherited from class org.springframework.jdbc.object.RdbmsOperation |
afterPropertiesSet, compile, declareParameter, getSql, isCompiled, setDataSource, setJdbcTemplate, setSql, setTypes |
| Constructor Detail |
public SqlFunction()
public SqlFunction(DataSource ds, String sql, int[] types)
public SqlFunction(DataSource ds, String sql, int[] types, int retType)
throws org.springframework.dao.InvalidDataAccessApiUsageException
public SqlFunction(DataSource ds, String sql)
public SqlFunction(DataSource ds, String sql, int retType)
| Method Detail |
public int run()
public int run(int p)
public int run(Object[] args)
public Object runGeneric()
public Object runGeneric(int p)
public Object runGeneric(Object[] args)
| |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||