Package com.avoka.core.sql
Class PreparedStatementExecutor
java.lang.Object
com.avoka.core.sql.PreparedStatementExecutor
Provide a utility to execute PreparedStatements.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a PreparedStatementExecutor.PreparedStatementExecutor(Connection connection) Create a PreparedStatementExecutor which will use the given connection. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecuteQuery(String sqlStatement, ResultSetProcessor resultSetProcessor) Execute the sql statement and the result is handled by the processor.voidexecuteQuery(String sqlStatement, String[] args, ResultSetProcessor resultSetProcessor) Execute the sql statement with list of arguments and the result is handled by the processor.intexecuteUpdate(String sqlStatement, Object[] args) Execute the sql statement with list of arguments and the result is handled by the processor.
-
Constructor Details
-
PreparedStatementExecutor
public PreparedStatementExecutor()Create a PreparedStatementExecutor. -
PreparedStatementExecutor
Create a PreparedStatementExecutor which will use the given connection. The provided connection will not be closed after the query has been executed.- Parameters:
connection- the database connection to use
-
-
Method Details
-
executeQuery
Execute the sql statement and the result is handled by the processor.- Parameters:
sqlStatement- sql statementresultSetProcessor- the result set processor
-
executeQuery
Execute the sql statement with list of arguments and the result is handled by the processor.- Parameters:
sqlStatement- sql statementargs- arguments for the prepared statementresultSetProcessor- the result set processor
-
executeUpdate
Execute the sql statement with list of arguments and the result is handled by the processor.- Parameters:
sqlStatement- sql statement (required)args- arguments for the prepared statement- Returns:
- number of rows updated.
-