Package liquibase.executor.jvm
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ChangelogJdbcMdcListener.ExecuteJdbc
static interface
ChangelogJdbcMdcListener.QueryJdbc<T>
-
Constructor Summary
Constructors Constructor Description ChangelogJdbcMdcListener()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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.
-
-
-
Method Detail
-
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
-
-