View Javadoc

1   package liquibase.executor.jvm;
2   
3   import java.sql.PreparedStatement;
4   
5   /**
6    * Generic callback interface for code that operates on a PreparedStatement. Allows to execute any number of operations
7    * on a single PreparedStatement, for example a single <code>executeUpdate</code> call or repeated
8    * <code>executeUpdate</code> calls with varying parameters.
9    * <p/>
10   * 
11   * @author Spring Framework
12   */
13  interface PreparedStatementCallback {
14  
15      /**
16       * Gets called by <code>JdbcTemplate.execute</code> with an active JDBC PreparedStatement. Does not need to care
17       * about closing the Statement or the Connection, or about handling transactions: this will all be handled by
18       * JdbcTemplate.
19       * 
20       * @param ps
21       *            active JDBC PreparedStatement
22       * @return a result object, or <code>null</code> if none
23       * @throws java.sql.SQLException
24       *             if thrown by a JDBC method, to be auto-converted to a DataAccessException by a SQLExceptionTranslator
25       * @throws liquibase.exception.DatabaseException
26       *             in case of custom exceptions
27       */
28      Object doInPreparedStatement(PreparedStatement ps);
29  
30  }