liquibase.executor.jvm
Class JdbcExecutor

java.lang.Object
  extended by liquibase.executor.AbstractExecutor
      extended by liquibase.executor.jvm.JdbcExecutor
All Implemented Interfaces:
Executor

public class JdbcExecutor
extends AbstractExecutor
implements Executor

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


Field Summary
 
Fields inherited from class liquibase.executor.AbstractExecutor
database
 
Constructor Summary
JdbcExecutor()
           
 
Method Summary
 void comment(String message)
          Adds a comment to the database.
 Object execute(liquibase.executor.jvm.CallableStatementCallback action, List<SqlVisitor> sqlVisitors)
           
 void execute(Change change)
          Write methods
 void execute(Change change, 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)
           
<T> T
queryForObject(SqlStatement sql, Class<T> requiredType)
          Read methods
<T> T
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 liquibase.executor.AbstractExecutor
applyVisitors, setDatabase
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface liquibase.executor.Executor
setDatabase
 

Constructor Detail

JdbcExecutor

public JdbcExecutor()
Method Detail

updatesDatabase

public boolean updatesDatabase()
Specified by:
updatesDatabase in interface Executor

execute

public Object execute(liquibase.executor.jvm.StatementCallback action,
                      List<SqlVisitor> sqlVisitors)
               throws DatabaseException
Throws:
DatabaseException

execute

public void execute(Change change)
             throws DatabaseException
Description copied from interface: Executor
Write methods

Specified by:
execute in interface Executor
Throws:
DatabaseException

execute

public void execute(Change change,
                    List<SqlVisitor> sqlVisitors)
             throws DatabaseException
Specified by:
execute in interface Executor
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
Specified by:
execute in interface Executor
Throws:
DatabaseException

execute

public void execute(SqlStatement sql,
                    List<SqlVisitor> sqlVisitors)
             throws DatabaseException
Specified by:
execute in interface Executor
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

Specified by:
queryForObject in interface Executor
Throws:
DatabaseException

queryForObject

public <T> T queryForObject(SqlStatement sql,
                            Class<T> requiredType,
                            List<SqlVisitor> sqlVisitors)
                 throws DatabaseException
Specified by:
queryForObject in interface Executor
Throws:
DatabaseException

queryForLong

public long queryForLong(SqlStatement sql)
                  throws DatabaseException
Specified by:
queryForLong in interface Executor
Throws:
DatabaseException

queryForLong

public long queryForLong(SqlStatement sql,
                         List<SqlVisitor> sqlVisitors)
                  throws DatabaseException
Specified by:
queryForLong in interface Executor
Throws:
DatabaseException

queryForInt

public int queryForInt(SqlStatement sql)
                throws DatabaseException
Specified by:
queryForInt in interface Executor
Throws:
DatabaseException

queryForInt

public int queryForInt(SqlStatement sql,
                       List<SqlVisitor> sqlVisitors)
                throws DatabaseException
Specified by:
queryForInt in interface Executor
Throws:
DatabaseException

queryForList

public List queryForList(SqlStatement sql,
                         Class elementType)
                  throws DatabaseException
Specified by:
queryForList in interface Executor
Throws:
DatabaseException

queryForList

public List queryForList(SqlStatement sql,
                         Class elementType,
                         List<SqlVisitor> sqlVisitors)
                  throws DatabaseException
Specified by:
queryForList in interface Executor
Throws:
DatabaseException

queryForList

public List<Map<String,?>> queryForList(SqlStatement sql)
                                 throws DatabaseException
Specified by:
queryForList in interface Executor
Throws:
DatabaseException

queryForList

public List<Map<String,?>> queryForList(SqlStatement sql,
                                        List<SqlVisitor> sqlVisitors)
                                 throws DatabaseException
Specified by:
queryForList in interface Executor
Throws:
DatabaseException

update

public int update(SqlStatement sql)
           throws DatabaseException
Specified by:
update in interface Executor
Throws:
DatabaseException

update

public int update(SqlStatement sql,
                  List<SqlVisitor> sqlVisitors)
           throws DatabaseException
Specified by:
update in interface Executor
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

Specified by:
comment in interface Executor
Throws:
DatabaseException


Copyright © 2015 Liquibase.org. All rights reserved.