public interface JdbcCall extends AutoCloseable
The execute(Parameter...) method be invoked repeatedly with
different parameter values. When the call operation is no longer needed,
it must be closed by either calling the close()
method or by nesting it within a try-with-resources construct.
The call operation supports stored procedures that return values through any combination of
ResultSet objects,
While this API supports all of the possible return value mechanisms that are inherent with JDBC, the actual support provided for stored procedures varies greatly between JDBC vendors, with each vendor choosing which mechanisms to support. It is important to understand the capabilities of the specific JDBC vendor in order to effectively use this API.
For maximum portability, on return from execute(org.soulwing.jdbc.Parameter...) the caller should
first process all results sets and update counts, before retrieving the
values of registered OUT/INOUT parameters.
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the JDBC resources associated with this call operation.
|
boolean |
execute(Parameter... parameters)
Executes this call operation.
|
boolean |
getMoreResults()
Gets a flag indicating the next result type available.
|
<T> T |
getOutParameter(int parameterIndex,
Class<T> type)
Gets the value of an OUT or INOUT parameter.
|
<T> T |
getOutParameter(String parameterName,
Class<T> type)
Gets the value of an OUT or INOUT parameter.
|
ResultSet |
getResultSet()
Gets the current result set.
|
int |
getUpdateCount()
Gets the number of rows inserted/updated.
|
<T> T |
handleResult(ResultSetHandler<T> handler)
Processes the current result set using the given handler.
|
<T> List<T> |
retrieveList(int columnIndex,
Class<T> type)
Retrieves all values of a given column in the current result set.
|
<T> List<T> |
retrieveList(RowMapper<T> rowMapper)
Retrieves and maps all rows in the current result set using the given
row mapper.
|
<T> List<T> |
retrieveList(String columnLabel,
Class<T> type)
Retrieves all values of a given column in the current result set.
|
<T> T |
retrieveValue(int columnIndex,
Class<T> type)
Retrieves a column value from the current result set, which must contain
a exactly one row.
|
<T> T |
retrieveValue(RowMapper<T> rowMapper)
Retrieves and maps a single row in current result set, which must contain
exactly one row.
|
<T> T |
retrieveValue(String columnLabel,
Class<T> type)
Retrieves a column value from the current result set, which must contain
a exactly one row.
|
boolean execute(Parameter... parameters)
parameters - values for placeholders in the statement; may be
any combination of IN, OUT, or INOUT parameters supported by the
target called proceduretrue if the first result is a ResultSet,
false if it is an update count or there are no resultsvoid close()
After a call operation is closed, its execute
method may not be subsequently invoked.
close in interface AutoCloseableint getUpdateCount()
java.sql.Statement#getUpdateCount()}boolean getMoreResults()
Invoking this method implicitly closes the last ResultSet returned
from the getResultSet() method.
true if the next result is a ResultSet,
false if it is an update count or there are no more resultsjava.sql.Statement#getMoreResults()}ResultSet getResultSet()
null if the current result is not a result setjava.sql.Statement#getResultSet()}<T> T getOutParameter(int parameterIndex,
Class<T> type)
parameterIndex - index of the parameter (starts at 1)type - data type<T> T getOutParameter(String parameterName, Class<T> type)
parameterName - name of the parametertype - data type<T> T handleResult(ResultSetHandler<T> handler)
handler - the subject handlerhandler<T> List<T> retrieveList(String columnLabel, Class<T> type)
columnLabel - column label (name)<T> List<T> retrieveList(int columnIndex, Class<T> type)
columnIndex - column index (starts at 1)<T> List<T> retrieveList(RowMapper<T> rowMapper)
rowMapper - the subject row mapperRowMapper<T> T retrieveValue(String columnLabel, Class<T> type)
columnLabel - column label (name)SQLNoResultException - if the result contains no rowsSQLNonUniqueResultException - if the result contains more than one
row<T> T retrieveValue(int columnIndex,
Class<T> type)
columnIndex - column index (starts at 1)SQLNoResultException - if the result contains no rowsSQLNonUniqueResultException - if the result contains more than one
rowCopyright © 2014–2015 Carl Harris, Jr. All rights reserved.