Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package liquibase.executor;
import liquibase.change.Change;
import liquibase.database.Database;
import liquibase.exception.DatabaseException;
import liquibase.sql.visitor.SqlVisitor;
import liquibase.statement.SqlStatement;
import java.util.List;
import java.util.Map;
/**
* Interface for a class that is capable of executing statements/queries against a DBMS.
*/
public interface Executor {
/**
* Configures the Executor for the Database to run statements/queries against.
* @param database The database
*/
void setDatabase(Database database);
/**
* Execute a query that is expected to return a scalar (1 row, 1 column).
* It is expected that the scalar can be cast into an object of type T.
* @param sql The query to execute
* @return An object of type T, if successful. May also return null if no object is found.
* @throws DatabaseException in case something goes wrong during the query execution
*/
T queryForObject(SqlStatement sql, Class requiredType) throws DatabaseException;
/**
* Applies a number of SqlVisitors to the sql query.
* Then, executes the (possibly modified) query.
* The query is expected to return a scalar (1 row, 1 column).
* That scalar is expected to return a single value that can be cast into an object of type T.
* @param sql The query to execute
* @return An object of type T, if successful. May also return null if no object is found.
* @throws DatabaseException in case something goes wrong during the query execution
*/
T queryForObject(SqlStatement sql, Class requiredType, List sqlVisitors) throws DatabaseException;
/**
* Executes a query that is expected to return a scalar (1 row, 1 column).
* It is expected that the scalar can be cast into a long.
* @param sql The query to execute
* @return A long value, if successful
* @throws DatabaseException in case something goes wrong during the query execution
*/
long queryForLong(SqlStatement sql) throws DatabaseException;
/**
* Applies a number of SqlVisitors to the sql query.
* Then, executes the (possibly modified) query.
* The query is expected to return a scalar (1 row, 1 column), and that scalar is expected to be a long value.
* @param sql The query to execute
* @return A long value, if successful
* @throws DatabaseException in case something goes wrong during the query execution
*/
long queryForLong(SqlStatement sql, List sqlVisitors) throws DatabaseException;
/**
* Executes a query that is expected to return a scalar (1 row, 1 column).
* It is expected that the scalar can be cast into an int.
* @param sql The query to execute
* @return An integer, if successful
* @throws DatabaseException in case something goes wrong during the query execution
*/
int queryForInt(SqlStatement sql) throws DatabaseException;
/**
* Applies a number of SqlVisitors to the sql query.
* Then, executes the (possibly modified) query.
* The query is expected to return a scalar (1 row, 1 column), and that scalar is expected to be an int.
* @param sql The query to execute
* @return An integer, if successful
* @throws DatabaseException in case something goes wrong during the query execution
*/
int queryForInt(SqlStatement sql, List sqlVisitors) throws DatabaseException;
List queryForList(SqlStatement sql, Class elementType) throws DatabaseException;
List queryForList(SqlStatement sql, Class elementType, List sqlVisitors) throws DatabaseException;
/**
* Executes a given SQL statement and returns a List of rows. Each row is represented a a Map,
* where the String is the column name and the value if the content of the column in the row (=cell).
* @param sql the SQL query to execute
* @return a List of [Column name] -> [column value]-mapped rows.
* @throws DatabaseException if an error occurs during SQL processing (e.g. the SQL is not valid for the database)
*/
List