liquibase.executor.jvm.StatementCallback Maven / Gradle / Ivy
package liquibase.executor.jvm;
import liquibase.exception.DatabaseException;
import liquibase.statement.SqlStatement;
import java.sql.SQLException;
import java.sql.Statement;
/**
* Generic callback interface for code that operates on a JDBC Statement.
* Allows to execute any number of operations on a single Statement,
* for example a single executeUpdate
call or repeated
* executeUpdate
calls with varying SQL.
*
* Used internally by JdbcTemplate, but also useful for application code.
*
* @author Spring Framework
*/
interface StatementCallback {
/**
* Gets called by JdbcTemplate.execute
with an active JDBC
* Statement. Does not need to care about closing the Statement or the
* Connection, or about handling transactions: this will all be handled
* by JdbcTemplate.
*
*
* @param stmt active JDBC Statement
* @return a result object, or null
if none
*/
Object doInStatement(Statement stmt) throws SQLException, DatabaseException;
SqlStatement getStatement();
}