com.mysql.jdbc
Interface RowData

All Known Implementing Classes:
RowDataCursor, RowDataDynamic, RowDataStatic

public interface RowData

This interface abstracts away how row data is accessed by the result set. It is meant to allow a static implementation (Current version), and a streaming one.


Field Summary
static int RESULT_SET_SIZE_UNKNOWN
          What's returned for the size of a result set when its size can not be determined.
 
Method Summary
 void addRow(ResultSetRow row)
          Adds a row to this row data.
 void afterLast()
          Moves to after last.
 void beforeFirst()
          Moves to before first.
 void beforeLast()
          Moves to before last so next el is the last el.
 void close()
          We're done.
 ResultSetRow getAt(int index)
          Only works on non dynamic result sets.
 int getCurrentRowNumber()
          Returns the current position in the result set as a row number.
 ResultSetInternalMethods getOwner()
          Returns the result set that 'owns' this RowData
 boolean hasNext()
          Returns true if another row exsists.
 boolean isAfterLast()
          Returns true if we got the last element.
 boolean isBeforeFirst()
          Returns if iteration has not occured yet.
 boolean isDynamic()
          Returns true if the result set is dynamic.
 boolean isEmpty()
          Has no records.
 boolean isFirst()
          Are we on the first row of the result set?
 boolean isLast()
          Are we on the last row of the result set?
 void moveRowRelative(int rows)
          Moves the current position relative 'rows' from the current position.
 ResultSetRow next()
          Returns the next row.
 void removeRow(int index)
          Removes the row at the given index.
 void setCurrentRow(int rowNumber)
          Moves the current position in the result set to the given row number.
 void setMetadata(Field[] metadata)
          Sometimes the driver doesn't have metadata until after the statement has the result set in-hand (because it's cached), so it can call this to set it after the fact.
 void setOwner(ResultSetImpl rs)
          Set the result set that 'owns' this RowData
 int size()
          Only works on non dynamic result sets.
 boolean wasEmpty()
          Did this result set have no rows?
 

Field Detail

RESULT_SET_SIZE_UNKNOWN

static final int RESULT_SET_SIZE_UNKNOWN
What's returned for the size of a result set when its size can not be determined.

See Also:
Constant Field Values
Method Detail

addRow

void addRow(ResultSetRow row)
            throws java.sql.SQLException
Adds a row to this row data.

Parameters:
row - the row to add
Throws:
java.sql.SQLException - if a database error occurs

afterLast

void afterLast()
               throws java.sql.SQLException
Moves to after last.

Throws:
java.sql.SQLException - if a database error occurs

beforeFirst

void beforeFirst()
                 throws java.sql.SQLException
Moves to before first.

Throws:
java.sql.SQLException - if a database error occurs

beforeLast

void beforeLast()
                throws java.sql.SQLException
Moves to before last so next el is the last el.

Throws:
java.sql.SQLException - if a database error occurs

close

void close()
           throws java.sql.SQLException
We're done.

Throws:
java.sql.SQLException - if a database error occurs

getAt

ResultSetRow getAt(int index)
                   throws java.sql.SQLException
Only works on non dynamic result sets.

Parameters:
index - row number to get at
Returns:
row data at index
Throws:
java.sql.SQLException - if a database error occurs

getCurrentRowNumber

int getCurrentRowNumber()
                        throws java.sql.SQLException
Returns the current position in the result set as a row number.

Returns:
the current row number
Throws:
java.sql.SQLException - if a database error occurs

getOwner

ResultSetInternalMethods getOwner()
Returns the result set that 'owns' this RowData


hasNext

boolean hasNext()
                throws java.sql.SQLException
Returns true if another row exsists.

Returns:
true if more rows
Throws:
java.sql.SQLException - if a database error occurs

isAfterLast

boolean isAfterLast()
                    throws java.sql.SQLException
Returns true if we got the last element.

Returns:
true if after last row
Throws:
java.sql.SQLException - if a database error occurs

isBeforeFirst

boolean isBeforeFirst()
                      throws java.sql.SQLException
Returns if iteration has not occured yet.

Returns:
true if before first row
Throws:
java.sql.SQLException - if a database error occurs

isDynamic

boolean isDynamic()
                  throws java.sql.SQLException
Returns true if the result set is dynamic. This means that move back and move forward won't work because we do not hold on to the records.

Returns:
true if this result set is streaming from the server
Throws:
java.sql.SQLException - if a database error occurs

isEmpty

boolean isEmpty()
                throws java.sql.SQLException
Has no records.

Returns:
true if no records
Throws:
java.sql.SQLException - if a database error occurs

isFirst

boolean isFirst()
                throws java.sql.SQLException
Are we on the first row of the result set?

Returns:
true if on first row
Throws:
java.sql.SQLException - if a database error occurs

isLast

boolean isLast()
               throws java.sql.SQLException
Are we on the last row of the result set?

Returns:
true if on last row
Throws:
java.sql.SQLException - if a database error occurs

moveRowRelative

void moveRowRelative(int rows)
                     throws java.sql.SQLException
Moves the current position relative 'rows' from the current position.

Parameters:
rows - the relative number of rows to move
Throws:
java.sql.SQLException - if a database error occurs

next

ResultSetRow next()
                  throws java.sql.SQLException
Returns the next row.

Returns:
the next row value
Throws:
java.sql.SQLException - if a database error occurs

removeRow

void removeRow(int index)
               throws java.sql.SQLException
Removes the row at the given index.

Parameters:
index - the row to move to
Throws:
java.sql.SQLException - if a database error occurs

setCurrentRow

void setCurrentRow(int rowNumber)
                   throws java.sql.SQLException
Moves the current position in the result set to the given row number.

Parameters:
rowNumber - row to move to
Throws:
java.sql.SQLException - if a database error occurs

setOwner

void setOwner(ResultSetImpl rs)
Set the result set that 'owns' this RowData

Parameters:
rs - the result set that 'owns' this RowData

size

int size()
         throws java.sql.SQLException
Only works on non dynamic result sets.

Returns:
the size of this row data
Throws:
java.sql.SQLException - if a database error occurs

wasEmpty

boolean wasEmpty()
Did this result set have no rows?


setMetadata

void setMetadata(Field[] metadata)
Sometimes the driver doesn't have metadata until after the statement has the result set in-hand (because it's cached), so it can call this to set it after the fact.

Parameters:
metadata - field-level metadata for the result set