Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derby.iapi.sql
Interface ResultSet  view ResultSet download ResultSet.java


public interface ResultSet

The ResultSet interface provides a method to tell whether a statement returns rows, and if so, a method to get the rows. It also provides a method to get metadata about the contents of the rows. It also provide a method to accept rows as input.

There is no single implementation of the ResultSet interface. Instead, the various support operations involved in executing statements implement this interface.

Although ExecRow is used on the interface, it is not available to users of the API. They should use Row, the exposed super-interface of ExecRow. <>

Valid transitions:


Field Summary
static int CURRENT_RESULTSET_ONLY
           
static int ENTIRE_RESULTSET_TREE
           
static int ISAFTERLAST
           
static int ISBEFOREFIRST
           
static int ISFIRST
           
static int ISLAST
           
 
Method Summary
 boolean checkRowPosition(int isType)
          Determine if the result set is at one of the positions according to the constants above (ISBEFOREFIRST etc).
 void cleanUp()
          Tells the system to clean up on an error.
 void close()
          Tells the system that there will be no more calls to getNextRow() (until the next open() call), so it can free up the resources associated with the ResultSet.
 void finish()
          Tells the system that there will be no more access to any database information via this result set; in particular, no more calls to open().
 org.apache.derby.iapi.sql.execute.ExecRow getAbsoluteRow(int row)
          Returns the row at the absolute position from the query, and returns NULL when there is no such position.
 ResultSet getAutoGeneratedKeysResultset()
          ResultSet for rows inserted into the table (contains auto-generated keys columns only)
 java.sql.Timestamp getBeginExecutionTimestamp()
          Get the Timestamp for the beginning of execution.
 java.lang.String getCursorName()
          Returns the name of the cursor, if this is cursor statement of some type (declare, open, fetch, positioned update, positioned delete, close).
 java.sql.Timestamp getEndExecutionTimestamp()
          Get the Timestamp for the end of execution.
 long getExecuteTime()
          Get the execution time in milliseconds.
 org.apache.derby.iapi.sql.execute.ExecRow getFirstRow()
          Returns the first row from the query, and returns NULL when there are no rows.
 org.apache.derby.iapi.sql.execute.ExecRow getLastRow()
          Returns the last row from the query, and returns NULL when there are no rows.
 org.apache.derby.iapi.sql.execute.ExecRow getNextRow()
          Returns the next row from the query, and returns NULL when there are no more rows.
 org.apache.derby.iapi.sql.execute.ExecRow getPreviousRow()
          Returns the previous row from the query, and returns NULL when there are no more previous rows.
 org.apache.derby.iapi.sql.execute.ExecRow getRelativeRow(int row)
          Returns the row at the relative position from the current cursor position, and returns NULL when there is no such position.
 ResultDescription getResultDescription()
          Returns a ResultDescription object, which describes the results of the statement this ResultSet is in.
 int getRowNumber()
          Returns the row number of the current row.
 org.apache.derby.iapi.sql.execute.NoPutResultSet[] getSubqueryTrackingArray(int numSubqueries)
          Get the subquery ResultSet tracking array from the top ResultSet.
 long getTimeSpent(int type)
          Return the total amount of time spent in this ResultSet
 java.sql.SQLWarning getWarnings()
          Return the set of warnings generated during the execution of this result set.
 boolean isClosed()
          Find out if the ResultSet is closed or not.
 int modifiedRowCount()
          Returns the number of rows affected by the statement.
 void open()
          Needs to be called before the result set will do anything.
 boolean returnsRows()
          Returns TRUE if the statement returns rows (i.e.
 org.apache.derby.iapi.sql.execute.ExecRow setAfterLastRow()
          Sets the current position to after the last row and returns NULL because there is no current row.
 org.apache.derby.iapi.sql.execute.ExecRow setBeforeFirstRow()
          Sets the current position to before the first row and returns NULL because there is no current row.
 

Field Detail

CURRENT_RESULTSET_ONLY

public static final int CURRENT_RESULTSET_ONLY
See Also:
Constant Field Values

ENTIRE_RESULTSET_TREE

public static final int ENTIRE_RESULTSET_TREE
See Also:
Constant Field Values

ISBEFOREFIRST

public static final int ISBEFOREFIRST
See Also:
Constant Field Values

ISFIRST

public static final int ISFIRST
See Also:
Constant Field Values

ISLAST

public static final int ISLAST
See Also:
Constant Field Values

ISAFTERLAST

public static final int ISAFTERLAST
See Also:
Constant Field Values
Method Detail

returnsRows

public boolean returnsRows()
Returns TRUE if the statement returns rows (i.e. is a SELECT or FETCH statement), FALSE if it returns no rows.


modifiedRowCount

public int modifiedRowCount()
Returns the number of rows affected by the statement. Only valid of returnsRows() returns false. For other DML statements, it returns the number of rows modified by the statement. For statements that do not affect rows (like DDL statements), it returns zero.


getResultDescription

public ResultDescription getResultDescription()
Returns a ResultDescription object, which describes the results of the statement this ResultSet is in. This will *not* be a description of this particular ResultSet, if this is not the outermost ResultSet.


open

public void open()
          throws org.apache.derby.iapi.error.StandardException
Needs to be called before the result set will do anything. Need to call before getNextRow(), or for a result set that doesn't return rows, this is the call that will cause all the work to be done.


getAbsoluteRow

public org.apache.derby.iapi.sql.execute.ExecRow getAbsoluteRow(int row)
                                                         throws org.apache.derby.iapi.error.StandardException
Returns the row at the absolute position from the query, and returns NULL when there is no such position. (Negative position means from the end of the result set.) Moving the cursor to an invalid position leaves the cursor positioned either before the first row (negative position) or after the last row (positive position). NOTE: An exception will be thrown on 0.


getRelativeRow

public org.apache.derby.iapi.sql.execute.ExecRow getRelativeRow(int row)
                                                         throws org.apache.derby.iapi.error.StandardException
Returns the row at the relative position from the current cursor position, and returns NULL when there is no such position. (Negative position means toward the beginning of the result set.) Moving the cursor to an invalid position leaves the cursor positioned either before the first row (negative position) or after the last row (positive position). NOTE: 0 is valid. NOTE: An exception is thrown if the cursor is not currently positioned on a row.


setBeforeFirstRow

public org.apache.derby.iapi.sql.execute.ExecRow setBeforeFirstRow()
                                                            throws org.apache.derby.iapi.error.StandardException
Sets the current position to before the first row and returns NULL because there is no current row.


getFirstRow

public org.apache.derby.iapi.sql.execute.ExecRow getFirstRow()
                                                      throws org.apache.derby.iapi.error.StandardException
Returns the first row from the query, and returns NULL when there are no rows.


getNextRow

public org.apache.derby.iapi.sql.execute.ExecRow getNextRow()
                                                     throws org.apache.derby.iapi.error.StandardException
Returns the next row from the query, and returns NULL when there are no more rows.


getPreviousRow

public org.apache.derby.iapi.sql.execute.ExecRow getPreviousRow()
                                                         throws org.apache.derby.iapi.error.StandardException
Returns the previous row from the query, and returns NULL when there are no more previous rows.


getLastRow

public org.apache.derby.iapi.sql.execute.ExecRow getLastRow()
                                                     throws org.apache.derby.iapi.error.StandardException
Returns the last row from the query, and returns NULL when there are no rows.


setAfterLastRow

public org.apache.derby.iapi.sql.execute.ExecRow setAfterLastRow()
                                                          throws org.apache.derby.iapi.error.StandardException
Sets the current position to after the last row and returns NULL because there is no current row.


checkRowPosition

public boolean checkRowPosition(int isType)
                         throws org.apache.derby.iapi.error.StandardException
Determine if the result set is at one of the positions according to the constants above (ISBEFOREFIRST etc). Only valid and called for scrollable cursors.


getRowNumber

public int getRowNumber()
Returns the row number of the current row. Row numbers start from 1 and go to 'n'. Corresponds to row numbering used to position current row in the result set (as per JDBC). Only valid and called for scrollable cursors.


close

public void close()
           throws org.apache.derby.iapi.error.StandardException
Tells the system that there will be no more calls to getNextRow() (until the next open() call), so it can free up the resources associated with the ResultSet.


cleanUp

public void cleanUp()
             throws org.apache.derby.iapi.error.StandardException
Tells the system to clean up on an error.


isClosed

public boolean isClosed()
Find out if the ResultSet is closed or not. Will report true for result sets that do not return rows.


finish

public void finish()
            throws org.apache.derby.iapi.error.StandardException
Tells the system that there will be no more access to any database information via this result set; in particular, no more calls to open(). Will close the result set if it is not already closed.


getExecuteTime

public long getExecuteTime()
Get the execution time in milliseconds.


getBeginExecutionTimestamp

public java.sql.Timestamp getBeginExecutionTimestamp()
Get the Timestamp for the beginning of execution.


getEndExecutionTimestamp

public java.sql.Timestamp getEndExecutionTimestamp()
Get the Timestamp for the end of execution.


getTimeSpent

public long getTimeSpent(int type)
Return the total amount of time spent in this ResultSet


getSubqueryTrackingArray

public org.apache.derby.iapi.sql.execute.NoPutResultSet[] getSubqueryTrackingArray(int numSubqueries)
Get the subquery ResultSet tracking array from the top ResultSet. (Used for tracking open subqueries when closing down on an error.)


getAutoGeneratedKeysResultset

public ResultSet getAutoGeneratedKeysResultset()
ResultSet for rows inserted into the table (contains auto-generated keys columns only)


getCursorName

public java.lang.String getCursorName()
Returns the name of the cursor, if this is cursor statement of some type (declare, open, fetch, positioned update, positioned delete, close).


getWarnings

public java.sql.SQLWarning getWarnings()
Return the set of warnings generated during the execution of this result set. The warnings are cleared once this call returns.