com.googlecode.jdbw
Interface ExecuteResultHandler

All Known Implementing Classes:
ExecuteResultHandlerAdapter

public interface ExecuteResultHandler

This interface is used to handle results when executing custom SQL code. It is passed in to an SQLExecutor and when as the executor runs the SQL, it will call the methods on this handler as results are coming in. If you don't need all methods of this interface, you can extend the ExecuteResultHandlerAdapter instead.

Author:
Martin Berglund
See Also:
ExecuteResultHandlerAdapter

Method Summary
 int getMaxRowsToFetch()
          This method is called just before the query is sent to the database, setting the property on the Statement which limits the number of rows we want back.
 boolean nextResultSet()
          This method is called in a multi result set query after one result set have been read and another one is coming.
 boolean nextRow(Object[] row)
          The callback is called once for every row returned by a result set.
 void onDone()
          This method is called when all processing of the query is done and the statement is about to be closed.
 void onGeneratedKey(Object object)
          When a key has been generated on the server by the query, this callback is called with that value
 void onResultSet(List<String> columnNames, List<Integer> columnTypes)
          This callback is invoked when a new result set is read from the server, if the result set contains any rows they will appear in subsequent calls to the nextRow(Object[] row) callback.
 void onUpdateCount(int updateCount)
          Callback called for queries that updated rows
 void onWarning(SQLWarning warning)
          Callback called for every SQLWarning the server sent for the query
 

Method Detail

getMaxRowsToFetch

int getMaxRowsToFetch()
This method is called just before the query is sent to the database, setting the property on the Statement which limits the number of rows we want back. It's up to the driver implementation and the server if this limit will be honored or not (I think)

Returns:
Number of rows to fetch from the server, 0 means no limit

onResultSet

void onResultSet(List<String> columnNames,
                 List<Integer> columnTypes)
This callback is invoked when a new result set is read from the server, if the result set contains any rows they will appear in subsequent calls to the nextRow(Object[] row) callback.

Parameters:
columnNames - List of all column names
columnTypes - List of all column types (see java.sql.Types)

nextRow

boolean nextRow(Object[] row)
The callback is called once for every row returned by a result set. The row belongs to the result set defined by the last call to onResultSet.

Parameters:
row - All the values of the row
Returns:
true if you want to read more rows, false if you want to close the result set and skip remaining rows

nextResultSet

boolean nextResultSet()
This method is called in a multi result set query after one result set have been read and another one is coming. Expect another call to onResultSet as well, for the next result set.

Returns:
true if you want to read the next result set, false if you want to skip remaining result sets and close the statement

onUpdateCount

void onUpdateCount(int updateCount)
Callback called for queries that updated rows

Parameters:
updateCount - Number of rows affected by the query, as reported by the server

onGeneratedKey

void onGeneratedKey(Object object)
When a key has been generated on the server by the query, this callback is called with that value

Parameters:
object - Generated key value

onWarning

void onWarning(SQLWarning warning)
Callback called for every SQLWarning the server sent for the query

Parameters:
warning - SQLWarning from the server

onDone

void onDone()
This method is called when all processing of the query is done and the statement is about to be closed.



Copyright © 2012. All Rights Reserved.