Package liquibase.executor.jvm
Class ChangelogJdbcMdcListener
java.lang.Object
liquibase.executor.jvm.ChangelogJdbcMdcListener
A wrapper utility class around the standard JdbcExecutor used to monitor and log sql from Jdbc queries
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
execute
(Database database, ChangelogJdbcMdcListener.ExecuteJdbc jdbcQuery) Execute the given statement via the jdbc executor.static <T> T
query
(Database database, ChangelogJdbcMdcListener.QueryJdbc<T> jdbcQuery) Execute the given statement via the jdbc executor.
-
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 againstjdbcQuery
- 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 againstjdbcQuery
- the executor function to apply- Returns:
- the result of the executor function
- Throws:
DatabaseException
- if there was a problem running the sql statement
-