01: package liquibase.database.template;
02:
03: import liquibase.database.sql.SqlStatement;
04: import liquibase.exception.JDBCException;
05:
06: import java.sql.SQLException;
07: import java.sql.Statement;
08:
09: /**
10: * Generic callback interface for code that operates on a JDBC Statement.
11: * Allows to execute any number of operations on a single Statement,
12: * for example a single <code>executeUpdate</code> call or repeated
13: * <code>executeUpdate</code> calls with varying SQL.
14: * <p/>
15: * <p>Used internally by JdbcTemplate, but also useful for application code.
16: *
17: * @author Spring Framework
18: * @see JdbcTemplate#execute(StatementCallback)
19: */
20: interface StatementCallback {
21:
22: /**
23: * Gets called by <code>JdbcTemplate.execute</code> with an active JDBC
24: * Statement. Does not need to care about closing the Statement or the
25: * Connection, or about handling transactions: this will all be handled
26: * by JdbcTemplate.
27: * <p/>
28: *
29: * @param stmt active JDBC Statement
30: * @return a result object, or <code>null</code> if none
31: */
32: Object doInStatement(Statement stmt) throws SQLException,
33: JDBCException;
34:
35: SqlStatement getStatement();
36: }
|