com.ziclix.python.sql
public abstract class Fetch extends Object
The responsibility of a Fetch instance is to manage the iteration of a ResultSet. Two different alogorithms are available: static or dynamic.
Static The static variety iterates the entire set immediately, creating the necessary Jython objects and storing them. It is able to immediately close the ResultSet so a call to close() is essentially a no-op from a database resource perspective (it does clear the results list however). This approach also allows for the correct rowcount to be determined since the entire result set has been iterated.
Dynamic The dynamic variety iterates the result set only as requested. This holds a bit truer to the intent of the API as the fetch*() methods actually fetch when instructed. This is especially useful for managing exeedingly large results, but is unable to determine the rowcount without having worked through the entire result set. The other disadvantage is the ResultSet remains open throughout the entire iteration. So the tradeoff is in open database resources versus JVM resources since the application can keep constant space if it doesn't require the entire result set be presented as one.
Version: $Revision: 2542 $
Method Summary | |
---|---|
abstract void | add(ResultSet resultSet)
Create the results after a successful execution and manages the result set.
|
abstract void | add(ResultSet resultSet, Set skipCols)
Create the results after a successful execution and manages the result set.
|
abstract void | add(CallableStatement callableStatement, Procedure procedure, PyObject params)
Method add
|
void | addWarningListener(WarningListener listener) |
void | close()
Cleanup any resources. |
abstract PyObject | fetchall()
Fetch all (remaining) rows of a query result, returning them as a sequence
of sequences (e.g. a list of tuples). |
abstract PyObject | fetchmany(int size)
Fetch the next set of rows of a query result, returning a sequence of
sequences (e.g. a list of tuples). |
PyObject | fetchone()
Fetch the next row of a query result set, returning a single sequence,
or None when no more data is available.
|
PyObject | getDescription()
The description of each column, in order, for the data in the result
set. |
int | getRowCount()
The number of rows in the current result set. |
static Fetch | newFetch(DataHandler datahandler, boolean dynamic)
Method newFetch
|
abstract PyObject | nextset()
Move the result pointer to the next set if available.
|
boolean | removeWarningListener(WarningListener listener) |
abstract void | scroll(int value, String mode)
Scroll the cursor in the result set to a new position according
to mode.
|
Parameters: resultSet
Parameters: resultSet skipCols JDBC-indexed set of columns to be skipped
Parameters: callableStatement procedure params
Returns: a sequence of sequences from the result set, or None when no more data is available
Returns: a sequence of sequences from the result set, or None when no more data is available
Returns: a single sequence from the result set, or None when no more data is available
Parameters: datahandler dynamic
Returns: Fetch
Returns: true if more sets exist, else None
Parameters: value mode