Table. Different cursors provide different methods of traversing a table. Cursors
should be fairly robust in the face of table modification during traversal (although depending on how the table is
traversed, row updates may or may not be seen). Multiple cursors may traverse the same table simultaneously.
Basic cursors will generally iterate table data in the order it appears in the database and searches will require
scanning the entire table. Additional features are available when utilizing an Index backed
IndexCursor.
The CursorBuilder provides a variety of static utility methods to construct cursors with given
characteristics or easily search for specific values as well as friendly and flexible construction options.
A Cursor instance is not thread-safe (see Database for more thread-safety details).
| Modifier and Type | Class and Description |
|---|---|
| public static interface | Cursor.
Identifier for a cursor. |
| public static interface | Cursor.
Value object which maintains the current position of the cursor. |
| public static interface | Cursor.
Value object which represents a complete save state of the cursor. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public boolean | currentRowMatches(Column
column from the table for this cursor which is being matched by the valuePattern columnPattern, Object value which is equal to the corresponding value in the matched row. If this object is an
instance of valuePattern)java., it will be applied to the potential row value
instead (overriding any configured ColumnMatcher)Returns |
| public boolean | currentRowMatches(Map<String, ?>
column names and values which must be equal to the corresponding values in the matched row. If
a value is an instance of rowPattern)java., it will be applied to the potential
row value instead (overriding any configured ColumnMatcher)Returns |
| public void | |
| public boolean | Returns: true if a valid row was found with the given value, false if no row was foundcolumn from the table for this cursor which is being matched by the valuePattern columnPattern, Object value which is equal to the corresponding value in the matched row. If this object is an
instance of valuePattern)java., it will be applied to the potential row value
instead (overriding any configured ColumnMatcher)Moves to the first row (as defined by the cursor) where the given column has the given value. |
| public boolean | Returns: true if a valid row was found with the given values, false if no row was foundcolumn names and values which must be equal to the corresponding values in the matched row. If
a value is an instance of rowPattern)java., it will be applied to the potential
row value instead (overriding any configured ColumnMatcher)Moves to the first row (as defined by the cursor) where the given columns have the given values. |
| public boolean | Returns: true if a valid row was found with the given value, false if no row was foundcolumn from the table for this cursor which is being matched by the valuePattern columnPattern, Object value which is equal to the corresponding value in the matched row. If this object is an
instance of valuePattern)java., it will be applied to the potential row value
instead (overriding any configured ColumnMatcher)Moves to the next row (as defined by the cursor) where the given column has the given value. |
| public boolean | Returns: true if a valid row was found with the given values, false if no row was foundcolumn names and values which must be equal to the corresponding values in the matched row. If
a value is an instance of rowPattern)java., it will be applied to the potential
row value instead (overriding any configured ColumnMatcher)Moves to the next row (as defined by the cursor) where the given columns have the given values. |
| public boolean | |
| public ColumnMatcher | |
| public Row | |
| public Row | getCurrentRow(Collection<String>
Only column names in this collection will be returned columnNames)Returns the current row in this cursor (Column name -> Column value). |
| public Object | |
| public ErrorHandler | |
| public Cursor. | |
| public Row | Returns: The next row in this table (Column name -> Column value), ornull if no next row is foundMoves to the next row in the table and returns it. |
| public Row | Returns: The next row in this table (Column name -> Column value), ornull if no next row is foundOnly column names in this collection will be returned columnNames)Moves to the next row in the table and returns it. |
| public Row | Returns: The previous row in this table (Column name -> Column value), ornull if no previous row is
foundMoves to the previous row in the table and returns it. |
| public Row | Returns: The previous row in this table (Column name -> Column value), ornull if no previous row is
foundOnly column names in this collection will be returned columnNames)Moves to the previous row in the table and returns it. |
| public Cursor. | getSavepoint()
Returns the current state of the cursor which can be restored at a future point in time by a call to
|
| public Table | Returns: the table over which this cursor iteratesReturns the table over which this cursor iterates. |
| public boolean | isAfterLast()
Returns |
| public boolean | isBeforeFirst()
Returns |
| public boolean | isCurrentRowDeleted()
Returns |
| public Iterator | iterator()
Redeclares java. Calls |
| public int | Returns: the number of rows moved.Moves forward as many rows as possible up to the given number of rows. |
| public int | Returns: the number of rows moved.Moves backward as many rows as possible up to the given number of rows. |
| public boolean | Returns: true if a valid next row was found, false otherwiseMoves to the next row as defined by this cursor. |
| public boolean | Returns: true if a valid previous row was found, false otherwiseMoves to the previous row as defined by this cursor. |
| public IterableBuilder | |
| public void | |
| public void | restoreSavepoint(Cursor.
Moves the cursor to a savepoint previously returned from |
| public void | |
| public void | |
| public void | |
| public default Stream | |
| public Object[] | Returns: the given row values if long enough, otherwise a new array, updated with the current row valuesUpdate the current row. |
| public <M extends Map | Returns: the given row, updated with the current row valuesUpdate the current row. |
| afterLast | back to summary |
|---|---|
| public void afterLast() Resets this cursor for reverse traversal (sets cursor to after the last row). | |
| beforeFirst | back to summary |
|---|---|
| public void beforeFirst() Resets this cursor for forward traversal (sets cursor to before the first row). | |
| currentRowMatches | back to summary |
|---|---|
| public boolean currentRowMatches(Column columnPattern, Object valuePattern) throws IOException Returns
| |
| currentRowMatches | back to summary |
|---|---|
| public boolean currentRowMatches(Map<String, ?> rowPattern) throws IOException Returns
| |
| deleteCurrentRow | back to summary |
|---|---|
| public void deleteCurrentRow() throws IOException Delete the current row. Note, re-deleting an already deleted row is allowed (it does nothing).
| |
| findFirstRow | back to summary |
|---|---|
| public boolean findFirstRow(Column columnPattern, Object valuePattern) throws IOException Moves to the first row (as defined by the cursor) where the given column has the given value. This may be more efficient on some cursors than others. If a match is not found (or an exception is thrown), the cursor is restored to its previous state. Warning, this method always starts searching from the beginning of the Table (you cannot use it to find successive matches).
| |
| findFirstRow | back to summary |
|---|---|
| public boolean findFirstRow(Map<String, ?> rowPattern) throws IOException Moves to the first row (as defined by the cursor) where the given columns have the given values. This may be more efficient on some cursors than others. If a match is not found (or an exception is thrown), the cursor is restored to its previous state. Warning, this method always starts searching from the beginning of the Table (you cannot use it to find successive matches).
| |
| findNextRow | back to summary |
|---|---|
| public boolean findNextRow(Column columnPattern, Object valuePattern) throws IOException Moves to the next row (as defined by the cursor) where the given column has the given value. This may be more efficient on some cursors than others. If a match is not found (or an exception is thrown), the cursor is restored to its previous state.
| |
| findNextRow | back to summary |
|---|---|
| public boolean findNextRow(Map<String, ?> rowPattern) throws IOException Moves to the next row (as defined by the cursor) where the given columns have the given values. This may be more efficient on some cursors than others. If a match is not found (or an exception is thrown), the cursor is restored to its previous state.
| |
| findRow | back to summary |
|---|---|
| public boolean findRow(RowId rowId) throws IOException Moves to the row with the given rowId. If the row is not found (or an exception is thrown), the cursor is restored to its previous state.
| |
| getColumnMatcher | back to summary |
|---|---|
| public ColumnMatcher getColumnMatcher() Returns the currently configured ColumnMatcher, always non- | |
| getCurrentRow | back to summary |
|---|---|
| public Row getCurrentRow() throws IOException Returns the current row in this cursor (Column name -> Column value). | |
| getCurrentRow | back to summary |
|---|---|
| public Row getCurrentRow(Collection<String> columnNames) throws IOException Returns the current row in this cursor (Column name -> Column value).
| |
| getCurrentRowValue | back to summary |
|---|---|
| public Object getCurrentRowValue(Column column) throws IOException Returns the given column from the current row. | |
| getErrorHandler | back to summary |
|---|---|
| public ErrorHandler getErrorHandler() Gets the currently configured ErrorHandler (always non- | |
| getId | back to summary |
|---|---|
| public Cursor. Returns the unique identifier of this cursor, usable for validating a | |
| getNextRow | back to summary |
|---|---|
| public Row getNextRow() throws IOException Moves to the next row in the table and returns it.
| |
| getNextRow | back to summary |
|---|---|
| public Row getNextRow(Collection<String> columnNames) throws IOException Moves to the next row in the table and returns it.
| |
| getPreviousRow | back to summary |
|---|---|
| public Row getPreviousRow() throws IOException Moves to the previous row in the table and returns it.
| |
| getPreviousRow | back to summary |
|---|---|
| public Row getPreviousRow(Collection<String> columnNames) throws IOException Moves to the previous row in the table and returns it.
| |
| getSavepoint | back to summary |
|---|---|
| public Cursor. Returns the current state of the cursor which can be restored at a future point in time by a call to
Savepoints may be used across different cursor instances for the same table, but they must have the same
| |
| getTable | back to summary |
|---|---|
| public Table getTable() Returns the table over which this cursor iterates.
| |
| isAfterLast | back to summary |
|---|---|
| public boolean isAfterLast() throws IOException Returns | |
| isBeforeFirst | back to summary |
|---|---|
| public boolean isBeforeFirst() throws IOException Returns | |
| isCurrentRowDeleted | back to summary |
|---|---|
| public boolean isCurrentRowDeleted() throws IOException Returns | |
| iterator | back to summary |
|---|---|
| public Iterator Redeclares java. Calls
For more flexible iteration see
| |
| moveNextRows | back to summary |
|---|---|
| public int moveNextRows(int numRows) throws IOException Moves forward as many rows as possible up to the given number of rows.
| |
| movePreviousRows | back to summary |
|---|---|
| public int movePreviousRows(int numRows) throws IOException Moves backward as many rows as possible up to the given number of rows.
| |
| moveToNextRow | back to summary |
|---|---|
| public boolean moveToNextRow() throws IOException Moves to the next row as defined by this cursor.
| |
| moveToPreviousRow | back to summary |
|---|---|
| public boolean moveToPreviousRow() throws IOException Moves to the previous row as defined by this cursor.
| |
| newIterable | back to summary |
|---|---|
| public IterableBuilder newIterable() Convenience method for constructing a new IterableBuilder for this cursor. An IterableBuilder provides a variety of options for more flexible iteration. | |
| reset | back to summary |
|---|---|
| public void reset() Resets this cursor for forward traversal. Calls | |
| restoreSavepoint | back to summary |
|---|---|
| public void restoreSavepoint(Cursor. Moves the cursor to a savepoint previously returned from
| |
| setColumnMatcher | back to summary |
|---|---|
| public void setColumnMatcher(ColumnMatcher columnMatcher) Sets a new ColumnMatcher. If | |
| setCurrentRowValue | back to summary |
|---|---|
| public void setCurrentRowValue(Column column, Object value) throws IOException Updates a single value in the current row.
| |
| setErrorHandler | back to summary |
|---|---|
| public void setErrorHandler(ErrorHandler newErrorHandler) Sets a new ErrorHandler. If | |
| stream | back to summary |
|---|---|
| public default Stream Returns a Stream using the default Iterator. | |
| updateCurrentRow | back to summary |
|---|---|
| public Object[] updateCurrentRow(Object... row) throws IOException Update the current row.
| |
| updateCurrentRowFromMap | back to summary |
|---|---|
| public <M extends Map Update the current row.
| |
| Modifier and Type | Method and Description |
|---|---|
| public RowId |
| getRowId | back to summary |
|---|---|
| public RowId getRowId() Returns the unique RowId of the position of the cursor. | |
Cursor#getSavepoint and used by calling Cursor#restoreSavepoint to return the the cursor state at
the time the Savepoint was created.
| Modifier and Type | Method and Description |
|---|---|
| public Cursor. | Returns: the cursor position captured by this savepointReturns the cursor position captured by this savepoint. |
| public Cursor. | Returns: the id of the cursor this savepoint was created from, used byCursor#restoreSavepoint to
validate that the savepoint is being restored on a compatible cursorReturns the id of the cursor this savepoint was created from, used by |
| getCurrentPosition | back to summary |
|---|---|
| public Cursor. Returns the cursor position captured by this savepoint. | |
| getCursorId | back to summary |
|---|---|
| public Cursor. Returns the id of the cursor this savepoint was created from, used by
| |