Class DefaultSqlExecutor
java.lang.Object
com.ibatis.sqlmap.engine.execution.DefaultSqlExecutor
-
Field Summary
Fields inherited from interface com.ibatis.sqlmap.engine.execution.SqlExecutor
NO_MAXIMUM_RESULTS, NO_SKIPPED_RESULTS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBatch(StatementScope statementScope, Connection conn, String sql, Object[] parameters) Adds a statement to a batchvoidcleanup(SessionScope sessionScope) Clean up any batches on the sessionintexecuteBatch(SessionScope sessionScope) Execute a batch of statementsexecuteBatchDetailed(SessionScope sessionScope) Execute a batch of statementsvoidexecuteQuery(StatementScope statementScope, Connection conn, String sql, Object[] parameters, int skipResults, int maxResults, RowHandlerCallback callback) Long form of the method to execute a queryvoidexecuteQueryProcedure(StatementScope statementScope, Connection conn, String sql, Object[] parameters, int skipResults, int maxResults, RowHandlerCallback callback) Execute a stored procedureintexecuteUpdate(StatementScope statementScope, Connection conn, String sql, Object[] parameters) Execute an updateintexecuteUpdateProcedure(StatementScope statementScope, Connection conn, String sql, Object[] parameters) Execute a stored procedure that updates datavoidinit(SqlMapConfiguration config, Properties globalProps) Initializing SQL Executor by passing configuration and global properties.
-
Constructor Details
-
DefaultSqlExecutor
public DefaultSqlExecutor()
-
-
Method Details
-
executeUpdate
public int executeUpdate(StatementScope statementScope, Connection conn, String sql, Object[] parameters) throws SQLException Execute an update- Specified by:
executeUpdatein interfaceSqlExecutor- Parameters:
statementScope- - the request scopeconn- - the database connectionsql- - the sql statement to executeparameters- - the parameters for the sql statement- Returns:
- - the number of records changed
- Throws:
SQLException- - if the update fails
-
addBatch
public void addBatch(StatementScope statementScope, Connection conn, String sql, Object[] parameters) throws SQLException Adds a statement to a batch- Specified by:
addBatchin interfaceSqlExecutor- Parameters:
statementScope- - the request scopeconn- - the database connectionsql- - the sql statementparameters- - the parameters for the statement- Throws:
SQLException- - if the statement fails
-
executeBatch
Execute a batch of statements- Specified by:
executeBatchin interfaceSqlExecutor- Parameters:
sessionScope- - the session scope- Returns:
- - the number of rows impacted by the batch
- Throws:
SQLException- - if a statement fails
-
executeBatchDetailed
Execute a batch of statements- Specified by:
executeBatchDetailedin interfaceSqlExecutor- Parameters:
sessionScope- - the session scope- Returns:
- - a List of BatchResult objects (may be null if no batch has been initiated). There will be one BatchResult object in the list for each sub-batch executed
- Throws:
SQLException- if a database access error occurs, or the drive does not support batch statementsBatchException- if the driver throws BatchUpdateException
-
executeQuery
public void executeQuery(StatementScope statementScope, Connection conn, String sql, Object[] parameters, int skipResults, int maxResults, RowHandlerCallback callback) throws SQLException Long form of the method to execute a query- Specified by:
executeQueryin interfaceSqlExecutor- Parameters:
statementScope- - the request scopeconn- - the database connectionsql- - the SQL statement to executeparameters- - the parameters for the statementskipResults- - the number of results to skipmaxResults- - the maximum number of results to returncallback- - the row handler for the query- Throws:
SQLException- - if the query fails
-
executeUpdateProcedure
public int executeUpdateProcedure(StatementScope statementScope, Connection conn, String sql, Object[] parameters) throws SQLException Execute a stored procedure that updates data- Specified by:
executeUpdateProcedurein interfaceSqlExecutor- Parameters:
statementScope- - the request scopeconn- - the database connectionsql- - the SQL to call the procedureparameters- - the parameters for the procedure- Returns:
- - the rows impacted by the procedure
- Throws:
SQLException- - if the procedure fails
-
executeQueryProcedure
public void executeQueryProcedure(StatementScope statementScope, Connection conn, String sql, Object[] parameters, int skipResults, int maxResults, RowHandlerCallback callback) throws SQLException Execute a stored procedure- Specified by:
executeQueryProcedurein interfaceSqlExecutor- Parameters:
statementScope- - the request scopeconn- - the database connectionsql- - the sql to call the procedureparameters- - the parameters for the procedureskipResults- - the number of results to skipmaxResults- - the maximum number of results to returncallback- - a row handler for processing the results- Throws:
SQLException- - if the procedure fails
-
init
Description copied from interface:SqlExecutorInitializing SQL Executor by passing configuration and global properties.- Specified by:
initin interfaceSqlExecutor- Parameters:
config- - the configuration class, which contains complete configuration infoglobalProps- the global props
-
cleanup
Clean up any batches on the session- Specified by:
cleanupin interfaceSqlExecutor- Parameters:
sessionScope- - the session to clean up
-