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
FieldsModifier and TypeFieldDescriptionstatic final intWhat's returned for the size of a result set when its size can not be determined. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRow(ResultSetRow row) Adds a row to this row data.voidMoves to after last.voidMoves to before first.voidMoves to before last so next el is the last el.voidclose()We're done.getAt(int index) Only works on non dynamic result sets.intReturns the current position in the result set as a row number.getOwner()Returns the result set that 'owns' this RowDatabooleanhasNext()Returns true if another row exsists.booleanReturns true if we got the last element.booleanReturns if iteration has not occured yet.booleanReturns true if the result set is dynamic.booleanisEmpty()Has no records.booleanisFirst()Are we on the first row of the result set?booleanisLast()Are we on the last row of the result set?voidmoveRowRelative(int rows) Moves the current position relative 'rows' from the current position.next()Returns the next row.voidremoveRow(int index) Removes the row at the given index.voidsetCurrentRow(int rowNumber) Moves the current position in the result set to the given row number.voidsetMetadata(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.voidSet the result set that 'owns' this RowDataintsize()Only works on non dynamic result sets.booleanwasEmpty()Did this result set have no rows?
-
Field Details
-
RESULT_SET_SIZE_UNKNOWN
static final int RESULT_SET_SIZE_UNKNOWNWhat's returned for the size of a result set when its size can not be determined.- See Also:
-
-
Method Details
-
addRow
Adds a row to this row data.- Parameters:
row- the row to add- Throws:
SQLException- if a database error occurs
-
afterLast
Moves to after last.- Throws:
SQLException- if a database error occurs
-
beforeFirst
Moves to before first.- Throws:
SQLException- if a database error occurs
-
beforeLast
Moves to before last so next el is the last el.- Throws:
SQLException- if a database error occurs
-
close
-
getAt
Only works on non dynamic result sets.- Parameters:
index- row number to get at- Returns:
- row data at index
- Throws:
SQLException- if a database error occurs
-
getCurrentRowNumber
Returns the current position in the result set as a row number.- Returns:
- the current row number
- Throws:
SQLException- if a database error occurs
-
getOwner
ResultSetInternalMethods getOwner()Returns the result set that 'owns' this RowData -
hasNext
Returns true if another row exsists.- Returns:
- true if more rows
- Throws:
SQLException- if a database error occurs
-
isAfterLast
Returns true if we got the last element.- Returns:
- true if after last row
- Throws:
SQLException- if a database error occurs
-
isBeforeFirst
Returns if iteration has not occured yet.- Returns:
- true if before first row
- Throws:
SQLException- if a database error occurs
-
isDynamic
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:
SQLException- if a database error occurs
-
isEmpty
Has no records.- Returns:
- true if no records
- Throws:
SQLException- if a database error occurs
-
isFirst
Are we on the first row of the result set?- Returns:
- true if on first row
- Throws:
SQLException- if a database error occurs
-
isLast
Are we on the last row of the result set?- Returns:
- true if on last row
- Throws:
SQLException- if a database error occurs
-
moveRowRelative
Moves the current position relative 'rows' from the current position.- Parameters:
rows- the relative number of rows to move- Throws:
SQLException- if a database error occurs
-
next
Returns the next row.- Returns:
- the next row value
- Throws:
SQLException- if a database error occurs
-
removeRow
Removes the row at the given index.- Parameters:
index- the row to move to- Throws:
SQLException- if a database error occurs
-
setCurrentRow
Moves the current position in the result set to the given row number.- Parameters:
rowNumber- row to move to- Throws:
SQLException- if a database error occurs
-
setOwner
Set the result set that 'owns' this RowData- Parameters:
rs- the result set that 'owns' this RowData
-
size
Only works on non dynamic result sets.- Returns:
- the size of this row data
- Throws:
SQLException- if a database error occurs
-
wasEmpty
boolean wasEmpty()Did this result set have no rows? -
setMetadata
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
-