Interface SqlExecutor

All Known Implementing Classes:
DefaultSqlExecutor

public interface SqlExecutor
Classes responsible for executing the SQL implement this interface Support for custom SQL Executors.
  • Field Details

    • NO_SKIPPED_RESULTS

      static final int NO_SKIPPED_RESULTS
      Constant to let us know not to skip anything.
      See Also:
    • NO_MAXIMUM_RESULTS

      static final int NO_MAXIMUM_RESULTS
      Constant to let us know to include all records.
      See Also:
  • Method Details

    • executeUpdate

      int executeUpdate(StatementScope statementScope, Connection conn, String sql, Object[] parameters) throws SQLException
      Execute an update.
      Parameters:
      statementScope - - the request scope
      conn - - the database connection
      sql - - the sql statement to execute
      parameters - - the parameters for the sql statement
      Returns:
      - the number of records changed
      Throws:
      SQLException - - if the update fails
    • addBatch

      void addBatch(StatementScope statementScope, Connection conn, String sql, Object[] parameters) throws SQLException
      Adds a statement to a batch.
      Parameters:
      statementScope - - the request scope
      conn - - the database connection
      sql - - the sql statement
      parameters - - the parameters for the statement
      Throws:
      SQLException - - if the statement fails
    • executeBatch

      int executeBatch(SessionScope sessionScope) throws SQLException
      Execute a batch of statements.
      Parameters:
      sessionScope - - the session scope
      Returns:
      - the number of rows impacted by the batch
      Throws:
      SQLException - - if a statement fails
    • executeBatchDetailed

      List executeBatchDetailed(SessionScope sessionScope) throws SQLException, BatchException
      Execute a batch of statements.
      Parameters:
      sessionScope - - the session scope
      Returns:
      - a List of BatchResult objects (may be null if no batch has been initiated). There will be one BatchResult object in the list for each sub-batch executed
      Throws:
      SQLException - if a database access error occurs, or the drive does not support batch statements
      BatchException - if the driver throws BatchUpdateException
    • executeQuery

      void executeQuery(StatementScope statementScope, Connection conn, String sql, Object[] parameters, int skipResults, int maxResults, RowHandlerCallback callback) throws SQLException
      Long form of the method to execute a query.
      Parameters:
      statementScope - - the request scope
      conn - - the database connection
      sql - - the SQL statement to execute
      parameters - - the parameters for the statement
      skipResults - - the number of results to skip
      maxResults - - the maximum number of results to return
      callback - - the row handler for the query
      Throws:
      SQLException - - if the query fails
    • executeUpdateProcedure

      int executeUpdateProcedure(StatementScope statementScope, Connection conn, String sql, Object[] parameters) throws SQLException
      Execute a stored procedure that updates data.
      Parameters:
      statementScope - - the request scope
      conn - - the database connection
      sql - - the SQL to call the procedure
      parameters - - the parameters for the procedure
      Returns:
      - the rows impacted by the procedure
      Throws:
      SQLException - - if the procedure fails
    • executeQueryProcedure

      void executeQueryProcedure(StatementScope statementScope, Connection conn, String sql, Object[] parameters, int skipResults, int maxResults, RowHandlerCallback callback) throws SQLException
      Execute a stored procedure.
      Parameters:
      statementScope - - the request scope
      conn - - the database connection
      sql - - the sql to call the procedure
      parameters - - the parameters for the procedure
      skipResults - - the number of results to skip
      maxResults - - the maximum number of results to return
      callback - - a row handler for processing the results
      Throws:
      SQLException - - if the procedure fails
    • cleanup

      void cleanup(SessionScope sessionScope)
      Clean up any batches on the session.
      Parameters:
      sessionScope - - the session to clean up
    • init

      void init(SqlMapConfiguration config, Properties globalProps)
      Initializing SQL Executor by passing configuration and global properties.
      Parameters:
      config - - the configuration class, which contains complete configuration info
      globalProps - the global props