liquibase.database.template
Class JdbcTemplate
java.lang.Object
liquibase.database.template.JdbcTemplate
- Direct Known Subclasses:
- JdbcOutputTemplate
public class JdbcTemplate
- extends java.lang.Object
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 |
protected java.lang.String |
applyVisitors(SqlStatement sql,
java.util.List<SqlVisitor> sqlVisitors)
|
java.util.Map |
call(CallableSqlStatement csc,
java.util.List declaredParameters,
java.util.List<SqlVisitor> sqlVisitors)
|
void |
comment(java.lang.String message)
Adds a comment to the database. |
java.lang.Object |
execute(CallableSqlStatement csc,
liquibase.database.template.CallableStatementCallback action,
java.util.List<SqlVisitor> sqlVisitors)
|
void |
execute(SqlStatement sql)
|
void |
execute(SqlStatement sql,
java.util.List<SqlVisitor> sqlVisitors)
|
java.lang.Object |
execute(liquibase.database.template.StatementCallback action,
java.util.List<SqlVisitor> sqlVisitors)
|
boolean |
executesStatements()
|
protected RowMapper |
getColumnMapRowMapper()
Create a new RowMapper for reading columns as key-value pairs. |
protected RowMapper |
getSingleColumnRowMapper(java.lang.Class requiredType)
Create a new RowMapper for reading result objects from a single column. |
java.lang.Object |
query(SqlStatement sql,
liquibase.database.template.ResultSetExtractor rse)
|
java.lang.Object |
query(SqlStatement sql,
liquibase.database.template.ResultSetExtractor rse,
java.util.List<SqlVisitor> sqlVisitors)
|
java.util.List |
query(SqlStatement sql,
RowMapper rowMapper)
|
java.util.List |
query(SqlStatement sql,
RowMapper rowMapper,
java.util.List<SqlVisitor> sqlVisitors)
|
int |
queryForInt(SqlStatement sql)
|
int |
queryForInt(SqlStatement sql,
java.util.List<SqlVisitor> sqlVisitors)
|
java.util.List<java.util.Map> |
queryForList(SqlStatement sql)
|
java.util.List |
queryForList(SqlStatement sql,
java.lang.Class elementType)
|
java.util.List |
queryForList(SqlStatement sql,
java.lang.Class elementType,
java.util.List<SqlVisitor> sqlVisitors)
|
java.util.List<java.util.Map> |
queryForList(SqlStatement sql,
java.util.List<SqlVisitor> sqlVisitors)
|
long |
queryForLong(SqlStatement sql)
|
long |
queryForLong(SqlStatement sql,
java.util.List<SqlVisitor> sqlVisitors)
|
java.lang.Object |
queryForObject(SqlStatement sql,
java.lang.Class requiredType)
|
java.lang.Object |
queryForObject(SqlStatement sql,
java.lang.Class requiredType,
java.util.List<SqlVisitor> sqlVisitors)
|
java.lang.Object |
queryForObject(SqlStatement sql,
RowMapper rowMapper)
|
java.lang.Object |
queryForObject(SqlStatement sql,
RowMapper rowMapper,
java.util.List<SqlVisitor> sqlVisitors)
|
int |
update(SqlStatement sql)
|
int |
update(SqlStatement sql,
java.util.List<SqlVisitor> sqlVisitors)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
database
protected Database database
JdbcTemplate
public JdbcTemplate(Database database)
executesStatements
public boolean executesStatements()
execute
public java.lang.Object execute(liquibase.database.template.StatementCallback action,
java.util.List<SqlVisitor> sqlVisitors)
throws JDBCException
- Throws:
JDBCException
execute
public void execute(SqlStatement sql)
throws JDBCException
- Throws:
JDBCException
execute
public void execute(SqlStatement sql,
java.util.List<SqlVisitor> sqlVisitors)
throws JDBCException
- Throws:
JDBCException
applyVisitors
protected java.lang.String applyVisitors(SqlStatement sql,
java.util.List<SqlVisitor> sqlVisitors)
throws StatementNotSupportedOnDatabaseException
- Throws:
StatementNotSupportedOnDatabaseException
query
public java.lang.Object query(SqlStatement sql,
liquibase.database.template.ResultSetExtractor rse)
throws JDBCException
- Throws:
JDBCException
query
public java.lang.Object query(SqlStatement sql,
liquibase.database.template.ResultSetExtractor rse,
java.util.List<SqlVisitor> sqlVisitors)
throws JDBCException
- Throws:
JDBCException
query
public java.util.List query(SqlStatement sql,
RowMapper rowMapper)
throws JDBCException
- Throws:
JDBCException
query
public java.util.List query(SqlStatement sql,
RowMapper rowMapper,
java.util.List<SqlVisitor> sqlVisitors)
throws JDBCException
- Throws:
JDBCException
queryForObject
public java.lang.Object queryForObject(SqlStatement sql,
RowMapper rowMapper)
throws JDBCException
- Throws:
JDBCException
queryForObject
public java.lang.Object queryForObject(SqlStatement sql,
RowMapper rowMapper,
java.util.List<SqlVisitor> sqlVisitors)
throws JDBCException
- Throws:
JDBCException
queryForObject
public java.lang.Object queryForObject(SqlStatement sql,
java.lang.Class requiredType)
throws JDBCException
- Throws:
JDBCException
queryForObject
public java.lang.Object queryForObject(SqlStatement sql,
java.lang.Class requiredType,
java.util.List<SqlVisitor> sqlVisitors)
throws JDBCException
- Throws:
JDBCException
queryForLong
public long queryForLong(SqlStatement sql)
throws JDBCException
- Throws:
JDBCException
queryForLong
public long queryForLong(SqlStatement sql,
java.util.List<SqlVisitor> sqlVisitors)
throws JDBCException
- Throws:
JDBCException
queryForInt
public int queryForInt(SqlStatement sql)
throws JDBCException
- Throws:
JDBCException
queryForInt
public int queryForInt(SqlStatement sql,
java.util.List<SqlVisitor> sqlVisitors)
throws JDBCException
- Throws:
JDBCException
queryForList
public java.util.List queryForList(SqlStatement sql,
java.lang.Class elementType)
throws JDBCException
- Throws:
JDBCException
queryForList
public java.util.List queryForList(SqlStatement sql,
java.lang.Class elementType,
java.util.List<SqlVisitor> sqlVisitors)
throws JDBCException
- Throws:
JDBCException
queryForList
public java.util.List<java.util.Map> queryForList(SqlStatement sql)
throws JDBCException
- Throws:
JDBCException
queryForList
public java.util.List<java.util.Map> queryForList(SqlStatement sql,
java.util.List<SqlVisitor> sqlVisitors)
throws JDBCException
- Throws:
JDBCException
update
public int update(SqlStatement sql)
throws JDBCException
- Throws:
JDBCException
update
public int update(SqlStatement sql,
java.util.List<SqlVisitor> sqlVisitors)
throws JDBCException
- Throws:
JDBCException
execute
public java.lang.Object execute(CallableSqlStatement csc,
liquibase.database.template.CallableStatementCallback action,
java.util.List<SqlVisitor> sqlVisitors)
throws JDBCException
- Throws:
JDBCException
call
public java.util.Map call(CallableSqlStatement csc,
java.util.List declaredParameters,
java.util.List<SqlVisitor> sqlVisitors)
throws JDBCException
- Throws:
JDBCException
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(java.lang.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(java.lang.String message)
throws JDBCException
- Adds a comment to the database. Currently does nothing but is over-ridden in the output JDBC template
- Parameters:
message -
- Throws:
JDBCException