liquibase.executor.jvm
Class JdbcExecutor
java.lang.Object
liquibase.executor.AbstractExecutor
liquibase.executor.jvm.JdbcExecutor
- All Implemented Interfaces:
- Executor
public class JdbcExecutor
- extends AbstractExecutor
Class to simplify execution of SqlStatements. Based heavily on Spring's JdbcTemplate.
Note: This class is currently intended for Liquibase-internal use only and may change without notice in the future
Method Summary |
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. |
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)
|
int |
queryForInt(SqlStatement sql,
List<SqlVisitor> sqlVisitors)
|
List<Map<String,?>> |
queryForList(SqlStatement sql)
|
List |
queryForList(SqlStatement sql,
Class elementType)
|
List |
queryForList(SqlStatement sql,
Class elementType,
List<SqlVisitor> sqlVisitors)
|
List<Map<String,?>> |
queryForList(SqlStatement sql,
List<SqlVisitor> sqlVisitors)
|
long |
queryForLong(SqlStatement sql)
|
long |
queryForLong(SqlStatement sql,
List<SqlVisitor> sqlVisitors)
|
|
queryForObject(SqlStatement sql,
Class<T> requiredType)
Read methods |
|
queryForObject(SqlStatement sql,
Class<T> requiredType,
List<SqlVisitor> sqlVisitors)
|
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()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JdbcExecutor
public JdbcExecutor()
updatesDatabase
public boolean updatesDatabase()
execute
public Object execute(liquibase.executor.jvm.StatementCallback action,
List<SqlVisitor> sqlVisitors)
throws DatabaseException
- Throws:
DatabaseException
execute
public Object execute(liquibase.executor.jvm.CallableStatementCallback action,
List<SqlVisitor> sqlVisitors)
throws DatabaseException
- Throws:
DatabaseException
execute
public void execute(SqlStatement sql)
throws DatabaseException
- Throws:
DatabaseException
execute
public void execute(SqlStatement sql,
List<SqlVisitor> sqlVisitors)
throws DatabaseException
- Throws:
DatabaseException
query
public Object query(SqlStatement sql,
liquibase.executor.jvm.ResultSetExtractor rse)
throws DatabaseException
- Throws:
DatabaseException
query
public Object query(SqlStatement sql,
liquibase.executor.jvm.ResultSetExtractor rse,
List<SqlVisitor> sqlVisitors)
throws DatabaseException
- Throws:
DatabaseException
query
public List query(SqlStatement sql,
RowMapper rowMapper)
throws DatabaseException
- Throws:
DatabaseException
query
public List query(SqlStatement sql,
RowMapper rowMapper,
List<SqlVisitor> sqlVisitors)
throws DatabaseException
- Throws:
DatabaseException
queryForObject
public Object queryForObject(SqlStatement sql,
RowMapper rowMapper)
throws DatabaseException
- Throws:
DatabaseException
queryForObject
public Object queryForObject(SqlStatement sql,
RowMapper rowMapper,
List<SqlVisitor> sqlVisitors)
throws DatabaseException
- Throws:
DatabaseException
queryForObject
public <T> T queryForObject(SqlStatement sql,
Class<T> requiredType)
throws DatabaseException
- Description copied from interface:
Executor
- Read methods
- Throws:
DatabaseException
queryForObject
public <T> T queryForObject(SqlStatement sql,
Class<T> requiredType,
List<SqlVisitor> sqlVisitors)
throws DatabaseException
- Throws:
DatabaseException
queryForLong
public long queryForLong(SqlStatement sql)
throws DatabaseException
- Throws:
DatabaseException
queryForLong
public long queryForLong(SqlStatement sql,
List<SqlVisitor> sqlVisitors)
throws DatabaseException
- Throws:
DatabaseException
queryForInt
public int queryForInt(SqlStatement sql)
throws DatabaseException
- Throws:
DatabaseException
queryForInt
public int queryForInt(SqlStatement sql,
List<SqlVisitor> sqlVisitors)
throws DatabaseException
- Throws:
DatabaseException
queryForList
public List queryForList(SqlStatement sql,
Class elementType)
throws DatabaseException
- Throws:
DatabaseException
queryForList
public List queryForList(SqlStatement sql,
Class elementType,
List<SqlVisitor> sqlVisitors)
throws DatabaseException
- Throws:
DatabaseException
queryForList
public List<Map<String,?>> queryForList(SqlStatement sql)
throws DatabaseException
- Throws:
DatabaseException
queryForList
public List<Map<String,?>> queryForList(SqlStatement sql,
List<SqlVisitor> sqlVisitors)
throws DatabaseException
- Throws:
DatabaseException
update
public int update(SqlStatement sql)
throws DatabaseException
- Throws:
DatabaseException
update
public int update(SqlStatement sql,
List<SqlVisitor> sqlVisitors)
throws DatabaseException
- Throws:
DatabaseException
getColumnMapRowMapper
protected RowMapper getColumnMapRowMapper()
- Create a new RowMapper for reading columns as key-value pairs.
- Returns:
- the RowMapper to use
- See Also:
ColumnMapRowMapper
getSingleColumnRowMapper
protected RowMapper getSingleColumnRowMapper(Class requiredType)
- Create a new RowMapper for reading result objects from a single column.
- Parameters:
requiredType
- the type that each result object is expected to match
- Returns:
- the RowMapper to use
- See Also:
SingleColumnRowMapper
comment
public void comment(String message)
throws DatabaseException
- Description copied from interface:
Executor
- Adds a comment to the database. Currently does nothing but is over-ridden in the output JDBC template
- Throws:
DatabaseException
Copyright © 2016 Liquibase.org. All rights reserved.