public class PlSqlWrapper extends QueryWrapper
query
) that has one IN
parameter (param1
) and one OUT parameter.
final PlSqlWrapper wrap = new PlSqlWrapper( db, query, param1 ); wrap.executePlSql( new PlSqlRunnable() { public void prepareCall( CallableStatement cs ) throws SQLException { cs.registerOutParameter( 2, Types.INTEGER ); } public void processCall( CallableStatement cs ) throws SQLException { final int outParam = cs.getInt(2); // we have our output! } } );
Modifier and Type | Class and Description |
---|---|
static class |
PlSqlWrapper.PlSqlRunnable
Runnable passed to the PlSqlWrapper to process the ResultSet and/or
CallableStatement during execution.
|
QueryWrapper.QueryRunnable
StatementWrapper.ExecutionProxy, StatementWrapper.ExecutionRunnable<T>, StatementWrapper.Listener
Constructor and Description |
---|
PlSqlWrapper(Database db,
java.lang.String plsql,
java.lang.Object... params)
Creates a new wrapper for executing pl/sql, specifying the pl/sql itself
and any IN parameters.
|
PlSqlWrapper(java.lang.String name,
java.sql.Connection conn,
java.lang.String plsql,
java.lang.Object... params)
Only use in the absence of a Database (e.g.
|
Modifier and Type | Method and Description |
---|---|
protected java.sql.Statement |
createStatment()
Creates the Statement object to use.
|
void |
executePlSql(PlSqlWrapper.PlSqlRunnable runner)
Executes the stored procedure and processes the resulting ResultSet and
CallableStatement with the given runner.
|
close, execute, executeQuery, executeQuery, executeSingleCellQuery, getDatabaseName, getParameters, getQuery, getStatementTextForLog, setDatabaseName, union
addListener, createDBSQLException, createDBSQLException, doExecute, executeImpl, getConnection, getConnectionName, getDatabase, getExecutionProxy, getIdentifier, getStatement, getStatementStrings, hasCancelled, isIgnoreErrors, queryFinished, queryStarted, removeListener, setBypassExecutionProxy, setDatabase, setExecuting, setExecutionProxy, setIdentifier, setIgnoreErrors, setStatement, sqlTrace, throwCancelledException, throwDBException, throwDBException, throwDBException
public PlSqlWrapper(Database db, java.lang.String plsql, java.lang.Object... params)
db
- the database to use for executionquery
- the pl/sql to executeparams
- any IN parameters for the pl/sqlpublic PlSqlWrapper(java.lang.String name, java.sql.Connection conn, java.lang.String plsql, java.lang.Object... params)
protected java.sql.Statement createStatment() throws java.sql.SQLException
StatementWrapper
createStatment
in class QueryWrapper
java.sql.SQLException
public void executePlSql(PlSqlWrapper.PlSqlRunnable runner) throws DBException
runner
- to process the ResultSet and CallableStatementDBException
- for any errors