public class JdbcExecutor extends AbstractExecutor
database, resourceAccessor
PRIORITY_DEFAULT, PRIORITY_NOT_APPLICABLE, PRIORITY_SPECIALIZED
Constructor and Description |
---|
JdbcExecutor() |
Modifier and Type | Method and Description |
---|---|
void |
comment(String message)
Adds a comment to the database.
|
Object |
execute(liquibase.executor.jvm.CallableStatementCallback action,
List<SqlVisitor> sqlVisitors) |
void |
execute(SqlStatement sql) |
void |
execute(SqlStatement sql,
List<SqlVisitor> sqlVisitors) |
Object |
execute(liquibase.executor.jvm.StatementCallback action,
List<SqlVisitor> sqlVisitors) |
protected RowMapper |
getColumnMapRowMapper()
Create a new RowMapper for reading columns as key-value pairs.
|
String |
getName()
Return the name of the Executor
|
int |
getPriority()
Return the Executor priority
|
protected RowMapper |
getSingleColumnRowMapper(Class requiredType)
Create a new RowMapper for reading result objects from a single column.
|
Object |
query(SqlStatement sql,
liquibase.executor.jvm.ResultSetExtractor rse) |
Object |
query(SqlStatement sql,
liquibase.executor.jvm.ResultSetExtractor rse,
List<SqlVisitor> sqlVisitors) |
List |
query(SqlStatement sql,
RowMapper rowMapper) |
List |
query(SqlStatement sql,
RowMapper rowMapper,
List<SqlVisitor> sqlVisitors) |
int |
queryForInt(SqlStatement sql)
Executes a query that is expected to return a scalar (1 row, 1 column).
|
int |
queryForInt(SqlStatement sql,
List<SqlVisitor> sqlVisitors)
Applies a number of SqlVisitors to the sql query.
|
List<Map<String,?>> |
queryForList(SqlStatement sql)
Executes a given SQL statement and returns a List of rows.
|
List |
queryForList(SqlStatement sql,
Class elementType) |
List |
queryForList(SqlStatement sql,
Class elementType,
List<SqlVisitor> sqlVisitors) |
List<Map<String,?>> |
queryForList(SqlStatement sql,
List<SqlVisitor> sqlVisitors)
Applies a list of SqlVisitors to the SQL query, then executes the (possibly modified) SQL query and lastly,
returns the list of rows.
|
long |
queryForLong(SqlStatement sql)
Executes a query that is expected to return a scalar (1 row, 1 column).
|
long |
queryForLong(SqlStatement sql,
List<SqlVisitor> sqlVisitors)
Applies a number of SqlVisitors to the sql query.
|
<T> T |
queryForObject(SqlStatement sql,
Class<T> requiredType)
Execute a query that is expected to return a scalar (1 row, 1 column).
|
<T> T |
queryForObject(SqlStatement sql,
Class<T> requiredType,
List<SqlVisitor> sqlVisitors)
Applies a number of SqlVisitors to the sql query.
|
Object |
queryForObject(SqlStatement sql,
RowMapper rowMapper) |
Object |
queryForObject(SqlStatement sql,
RowMapper rowMapper,
List<SqlVisitor> sqlVisitors) |
int |
update(SqlStatement sql) |
int |
update(SqlStatement sql,
List<SqlVisitor> sqlVisitors) |
boolean |
updatesDatabase() |
applyVisitors, execute, execute, modifyChangeSet, setDatabase, setResourceAccessor, validate
public String getName()
getName
in interface Executor
getName
in class AbstractExecutor
public int getPriority()
getPriority
in interface Executor
getPriority
in class AbstractExecutor
public boolean updatesDatabase()
public Object execute(liquibase.executor.jvm.StatementCallback action, List<SqlVisitor> sqlVisitors) throws DatabaseException
DatabaseException
public Object execute(liquibase.executor.jvm.CallableStatementCallback action, List<SqlVisitor> sqlVisitors) throws DatabaseException
DatabaseException
public void execute(SqlStatement sql) throws DatabaseException
DatabaseException
public void execute(SqlStatement sql, List<SqlVisitor> sqlVisitors) throws DatabaseException
DatabaseException
public Object query(SqlStatement sql, liquibase.executor.jvm.ResultSetExtractor rse) throws DatabaseException
DatabaseException
public Object query(SqlStatement sql, liquibase.executor.jvm.ResultSetExtractor rse, List<SqlVisitor> sqlVisitors) throws DatabaseException
DatabaseException
public List query(SqlStatement sql, RowMapper rowMapper) throws DatabaseException
DatabaseException
public List query(SqlStatement sql, RowMapper rowMapper, List<SqlVisitor> sqlVisitors) throws DatabaseException
DatabaseException
public Object queryForObject(SqlStatement sql, RowMapper rowMapper) throws DatabaseException
DatabaseException
public Object queryForObject(SqlStatement sql, RowMapper rowMapper, List<SqlVisitor> sqlVisitors) throws DatabaseException
DatabaseException
public <T> T queryForObject(SqlStatement sql, Class<T> requiredType) throws DatabaseException
Executor
sql
- The query to executeDatabaseException
- in case something goes wrong during the query executionpublic <T> T queryForObject(SqlStatement sql, Class<T> requiredType, List<SqlVisitor> sqlVisitors) throws DatabaseException
Executor
sql
- The query to executeDatabaseException
- in case something goes wrong during the query executionpublic long queryForLong(SqlStatement sql) throws DatabaseException
Executor
sql
- The query to executeDatabaseException
- in case something goes wrong during the query executionpublic long queryForLong(SqlStatement sql, List<SqlVisitor> sqlVisitors) throws DatabaseException
Executor
sql
- The query to executeDatabaseException
- in case something goes wrong during the query executionpublic int queryForInt(SqlStatement sql) throws DatabaseException
Executor
sql
- The query to executeDatabaseException
- in case something goes wrong during the query executionpublic int queryForInt(SqlStatement sql, List<SqlVisitor> sqlVisitors) throws DatabaseException
Executor
sql
- The query to executeDatabaseException
- in case something goes wrong during the query executionpublic List queryForList(SqlStatement sql, Class elementType) throws DatabaseException
DatabaseException
public List queryForList(SqlStatement sql, Class elementType, List<SqlVisitor> sqlVisitors) throws DatabaseException
DatabaseException
public List<Map<String,?>> queryForList(SqlStatement sql) throws DatabaseException
Executor
sql
- the SQL query to executeDatabaseException
- if an error occurs during SQL processing (e.g. the SQL is not valid for the database)public List<Map<String,?>> queryForList(SqlStatement sql, List<SqlVisitor> sqlVisitors) throws DatabaseException
Executor
sql
- the SQL query to executeDatabaseException
- if an error occurs during SQL processing (e.g. the SQL is not valid for the database)public int update(SqlStatement sql) throws DatabaseException
DatabaseException
public int update(SqlStatement sql, List<SqlVisitor> sqlVisitors) throws DatabaseException
DatabaseException
protected RowMapper getColumnMapRowMapper()
ColumnMapRowMapper
protected RowMapper getSingleColumnRowMapper(Class requiredType)
requiredType
- the type that each result object is expected to matchSingleColumnRowMapper
public void comment(String message) throws DatabaseException
Executor
DatabaseException
Copyright © 2023 Liquibase.org. All rights reserved.