Class ChangelogJdbcMdcListener

java.lang.Object
liquibase.executor.jvm.ChangelogJdbcMdcListener

public class ChangelogJdbcMdcListener extends Object
A wrapper utility class around the standard JdbcExecutor used to monitor and log sql from Jdbc queries
  • Constructor Details

    • ChangelogJdbcMdcListener

      public ChangelogJdbcMdcListener()
  • Method Details

    • execute

      public static void execute(Database database, ChangelogJdbcMdcListener.ExecuteJdbc jdbcQuery) throws DatabaseException
      Execute the given statement via the jdbc executor. Adds MDC of the statement sql and outcome to logging.
      Parameters:
      database - the database to execute against
      jdbcQuery - the executor function to apply
      Throws:
      DatabaseException - if there was a problem running the sql statement
    • query

      public static <T> T query(Database database, ChangelogJdbcMdcListener.QueryJdbc<T> jdbcQuery) throws DatabaseException
      Execute the given statement via the jdbc executor. Adds MDC of the statement sql and outcome to logging.
      Parameters:
      database - the database to execute against
      jdbcQuery - the executor function to apply
      Returns:
      the result of the executor function
      Throws:
      DatabaseException - if there was a problem running the sql statement