com.googlecode.jdbw
Interface SQLExecutor

All Known Subinterfaces:
DatabaseTransaction
All Known Implementing Classes:
AutoExecutor, SQLExecutorImpl

public interface SQLExecutor

The SQLExecutor is the object sending the query to the remote database server and using a callback interface to process the result. This query will take care of creating Statements and ResultSets and make sure to close everything when done. This object is most frequently used through the sub-interface DatabaseTransaction or AutoExecutor.

Author:
Martin Berglund
See Also:
DatabaseTransaction, AutoExecutor

Method Summary
 void batchWrite(BatchUpdateHandler handler, List<String> batchedSQL)
          Executes a list of queries as one batch on the remote database server
 void batchWrite(BatchUpdateHandler handler, String SQL, List<Object[]> parameters)
          Executes a batch query where the SQL is structurally the same but parameters are different.
 void execute(ExecuteResultHandler handler, String SQL, Object... parameters)
          Sends a query to the database and handles any results through a callback interface
 

Method Detail

execute

void execute(ExecuteResultHandler handler,
             String SQL,
             Object... parameters)
             throws SQLException
Sends a query to the database and handles any results through a callback interface

Parameters:
handler - Callback interface to use for any results of the query
SQL - SQL code to send to the database server, use ? for parameter substitution
parameters - List of parameters to insert into the query, must be one for every ? used
Throws:
SQLException

batchWrite

void batchWrite(BatchUpdateHandler handler,
                List<String> batchedSQL)
                throws SQLException
Executes a list of queries as one batch on the remote database server

Parameters:
handler - Callback interface to use for any results of the query
batchedSQL - List of SQL to send to the remote server
Throws:
SQLException

batchWrite

void batchWrite(BatchUpdateHandler handler,
                String SQL,
                List<Object[]> parameters)
                throws SQLException
Executes a batch query where the SQL is structurally the same but parameters are different. Usefull for inserting, updating or deleting multiple rows from the same table.

Parameters:
handler - Callback interface to use for any results of the query
SQL - SQL to use for all queries, use ? for the parameter substitution
parameters - List of object arrays, where one array equals one query sent to the server
Throws:
SQLException


Copyright © 2012. All Rights Reserved.