Interface SQLInterceptor

All Known Subinterfaces:
SQLConnectionInterceptor
All Known Implementing Classes:
SafeDelegatingSqlConnectionInterceptor

public interface SQLInterceptor
The SQLInterceptor is called before and after SQL is to be executed in OFBIZ.
  • Method Details

    • beforeExecution

      void beforeExecution(String sqlString, List<String> parameterValues, Statement statement)
      This is called before an JDBC query is run.
      Parameters:
      sqlString - thw SQL string in play
      parameterValues - this list of the Java parameters passed to this statement. This is a simple String.valueOf() on these parameters
      statement - the JDBC Statement in play
    • beforeExecution

      default void beforeExecution(String sqlString, List<String> parameterValues, List<List<String>> parameterValuesForBatch, Statement statement)
      This is called before an JDBC query is run.
      Parameters:
      sqlString - thw SQL string in play
      parameterValues - this list of the Java parameters passed to this statement. This is a simple String.valueOf() on these parameters
      parameterValuesForBatch - this list of list of the Java parameters passed to this statement for batch processing. This is a simple String.valueOf() on these parameters. In case of non batch operation this will be an empty list.
      statement - the JDBC Statement in play
    • afterSuccessfulExecution

      void afterSuccessfulExecution(String sqlString, List<String> parameterValues, Statement statement, ResultSet resultSet, int rowsUpdated)
      This is called after a successful (ie no SQLException generated) JDBC query is run.

      If this method runs then by design the onException(String, java.util.List, java.sql.Statement, java.sql.SQLException) will NOT run.

      Parameters:
      sqlString - the SQL string in play
      parameterValues - this list of the Java parameters passed to this statement. This is a simple String.valueOf() on these parameters
      statement - the JDBC Statement in play
      resultSet - a JDBC ResultSet. In the case of an update, this will be NULL.
      rowsUpdated - the number of rows updated. In the case of a SELECT, this will be -1
    • afterSuccessfulExecution

      default void afterSuccessfulExecution(String sqlString, List<String> parameterValues, List<List<String>> parameterValuesForBatch, Statement statement, ResultSet resultSet, int rowsUpdated, int[] rowsUpdatedByBatch)
      This is called after a successful (ie no SQLException generated) JDBC query is run.

      If this method runs then by design the onException(String, List, List, Statement, SQLException) will NOT run.

      Parameters:
      sqlString - the SQL string in play
      parameterValues - this list of the Java parameters passed to this statement. This is a simple String.valueOf() on these parameters
      parameterValuesForBatch - this list of list of the Java parameters passed to this statement for batch processing. This is a simple String.valueOf() on these parameters. In case of non batch operation this will be an empty list.
      statement - the JDBC Statement in play
      resultSet - a JDBC ResultSet. In the case of an update, this will be NULL.
      rowsUpdated - the number of rows updated. In the case of a SELECT, this will be -1
      rowsUpdatedByBatch - the number of rows updated by batch operation. In case of non batch operation it will be an empty array.
    • onException

      void onException(String sqlString, List<String> parameterValues, Statement statement, SQLException sqlException)
      This is called if an SQLException is thrown during the JDBC query

      If this method runs then by design the afterSuccessfulExecution(String, java.util.List, java.sql.Statement, java.sql.ResultSet, int) will have NOT run.

      Parameters:
      sqlString - thw SQL string in play
      parameterValues - this list of the Java parameters passed to this statement. This is a simple String.valueOf() on these parameters
      statement - the JDBC Statement in play
      sqlException - the exception that occurred
    • onException

      default void onException(String sqlString, List<String> parameterValues, List<List<String>> parameterValuesForBatch, Statement statement, SQLException sqlException)
      This is called if an SQLException is thrown during the JDBC query

      If this method runs then by design the afterSuccessfulExecution(String, List, List, Statement, ResultSet, int, int[]) will have NOT run.

      Parameters:
      sqlString - thw SQL string in play
      parameterValues - this list of the Java parameters passed to this statement. This is a simple String.valueOf() on these parameters
      parameterValuesForBatch - this list of list of the Java parameters passed to this statement for batch processing. This is a simple String.valueOf() on these parameters. For non batched operations this will be an empty list.
      statement - the JDBC Statement in play
      sqlException - the exception that occurred