Cursor. By default, a cursor is created at the beginning of the table,
and any start/end rows are inclusive.
Simple example traversal:
for (Row row : table.newCursor().toCursor()) {
// ... process each row ...
}
Simple example search:
Row row = CursorBuilder.findRow(table, Collections.singletonMap(col, "foo"));
| Modifier and Type | Field and Description |
|---|---|
| private boolean | beforeFirst
whether to start at beginning or end of cursor |
| private ColumnMatcher | columnMatcher
ColumnMatcher to be used when matching column values |
| private Object[] | endRow
optional end row for an index cursor |
| private boolean | endRowInclusive
whether or not end row for an index cursor is inclusive |
| private IndexImpl | index
optional index to use in traversal |
| private Cursor. | savepoint
optional save point to restore to the cursor |
| private Object[] | startRow
optional start row for an index cursor |
| private boolean | startRowInclusive
whether or not start row for an index cursor is inclusive |
| private final TableImpl | table
the table which the cursor will traverse |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public CursorBuilder | |
| public CursorBuilder | |
| public static Cursor | createCursor(Table
the table over which this cursor will traverse table)Creates a normal, un-indexed cursor for the given table. |
| public static IndexCursor | createCursor(Index
index for the table which will define traversal order as well as enhance certain lookups index)Creates an indexed cursor for the given table. |
| public static IndexCursor | createCursor(Index
index for the table which will define traversal order as well as enhance certain lookups index, Object[] the first row of data for the cursor (inclusive), or startRow, Object[] null for the first entrythe last row of data for the cursor (inclusive), or endRow)null for the last entryCreates an indexed cursor for the given table, narrowed to the given range. |
| public static IndexCursor | createCursor(Index
index for the table which will define traversal order as well as enhance certain lookups index, Object[] the first row of data for the cursor, or startRow, boolean null for the first entrywhether or not startRow is inclusive or exclusive startInclusive, Object[] the last row of data for the cursor, or endRow, boolean null for the last entrywhether or not endRow is inclusive or exclusive endInclusive)Creates an indexed cursor for the given table, narrowed to the given range. |
| public static IndexCursor | createPrimaryKeyCursor(Table
the table over which this cursor will traverse table)Creates an indexed cursor for the primary key cursor of the given table. |
| public static Row | |
| public static Row | |
| public static Row | Returns: the matching row ornull if a match could not be found.the index to search index, Object... the column values for the index's columns. entryValues)Convenience method for finding a specific row (as defined by the cursor) where the index entries match the given values. |
| public static Row | Returns: the matching row ornull if a match could not be found.the table to search table, Object... the column values for the table's primary key columns. entryValues)Convenience method for finding a specific row by the primary key of the table. |
| public static Object | Returns: the matching row ornull if a match could not be found.the table to search table, Column column whose value should be returned column, Column column being matched by the valuePattern columnPattern, Object value from the columnPattern which will match the desired row valuePattern)Convenience method for finding a specific row in a table which matches a given row "pattern". |
| public static Object | Returns: the matching row ornull if a match could not be found.index to assist the search index, Column column whose value should be returned column, Column column being matched by the valuePattern columnPattern, Object value from the columnPattern which will match the desired row valuePattern)Convenience method for finding a specific row in a table which matches a given row "pattern". |
| public CursorBuilder | restoreSavepoint(Cursor.
Sets a savepoint to restore for the initial position of the cursor. |
| public Cursor | |
| public IndexCursor | |
| public CursorBuilder | |
| public CursorBuilder | withColumnMatcher(ColumnMatcher newColumnMatcher)
Sets the ColumnMatcher to use for matching row patterns. |
| public CursorBuilder | withEndEntry(Object... endEntry)
Sets the ending row for a range based index cursor to the given entry (where the given values correspond to the index's columns). |
| public CursorBuilder | |
| public CursorBuilder | withEndRowInclusive(boolean inclusive)
Sets whether the ending row for a range based index cursor is inclusive or exclusive. |
| public CursorBuilder | |
| public CursorBuilder | withIndexByColumnNames(String... columnNames)
Sets an index to use for the cursor by searching the table for an index with exactly the given columns. |
| public CursorBuilder | withIndexByColumns(Column... columns)
Sets an index to use for the cursor by searching the table for an index with exactly the given columns. |
| private CursorBuilder | |
| public CursorBuilder | withIndexByName(String indexName)
Sets an index to use for the cursor by searching the table for an index with the given name. |
| public CursorBuilder | withSpecificEntry(Object... specificEntry)
Sets the starting and ending row for a range based index cursor to the given entry (where the given values correspond to the index's columns). |
| public CursorBuilder | withSpecificRow(Object... specificRow)
Sets the starting and ending row for a range based index cursor. |
| public CursorBuilder | withStartEntry(Object... startEntry)
Sets the starting row for a range based index cursor to the given entry (where the given values correspond to the index's columns). |
| public CursorBuilder | |
| public CursorBuilder | withStartRowInclusive(boolean inclusive)
Sets whether the starting row for a range based index cursor is inclusive or exclusive. |
| beforeFirst | back to summary |
|---|---|
| private boolean beforeFirst whether to start at beginning or end of cursor | |
| columnMatcher | back to summary |
|---|---|
| private ColumnMatcher columnMatcher ColumnMatcher to be used when matching column values | |
| endRow | back to summary |
|---|---|
| private Object[] endRow optional end row for an index cursor | |
| endRowInclusive | back to summary |
|---|---|
| private boolean endRowInclusive whether or not end row for an index cursor is inclusive | |
| index | back to summary |
|---|---|
| private IndexImpl index optional index to use in traversal | |
| savepoint | back to summary |
|---|---|
| private Cursor. optional save point to restore to the cursor | |
| startRow | back to summary |
|---|---|
| private Object[] startRow optional start row for an index cursor | |
| startRowInclusive | back to summary |
|---|---|
| private boolean startRowInclusive whether or not start row for an index cursor is inclusive | |
| table | back to summary |
|---|---|
| private final TableImpl table the table which the cursor will traverse | |
| CursorBuilder | back to summary |
|---|---|
| public CursorBuilder(Table table) | |
| afterLast | back to summary |
|---|---|
| public CursorBuilder afterLast() Sets the cursor so that it will start at the end (unless a savepoint is given). | |
| beforeFirst | back to summary |
|---|---|
| public CursorBuilder beforeFirst() Sets the cursor so that it will start at the beginning (unless a savepoint is given). | |
| createCursor | back to summary |
|---|---|
| public static Cursor createCursor(Table table) throws IOException Creates a normal, un-indexed cursor for the given table.
| |
| createCursor | back to summary |
|---|---|
| public static IndexCursor createCursor(Index index) throws IOException Creates an indexed cursor for the given table.
Note, index based table traversal may not include all rows, as certain types of indexes do not include all
entries (namely, some indexes ignore null entries, see
| |
| createCursor | back to summary |
|---|---|
| public static IndexCursor createCursor(Index index, Object[] startRow, Object[] endRow) throws IOException Creates an indexed cursor for the given table, narrowed to the given range.
Note, index based table traversal may not include all rows, as certain types of indexes do not include all
entries (namely, some indexes ignore null entries, see | |
| createCursor | back to summary |
|---|---|
| public static IndexCursor createCursor(Index index, Object[] startRow, boolean startInclusive, Object[] endRow, boolean endInclusive) throws IOException Creates an indexed cursor for the given table, narrowed to the given range.
Note, index based table traversal may not include all rows, as certain types of indexes do not include all
entries (namely, some indexes ignore null entries, see
| |
| createPrimaryKeyCursor | back to summary |
|---|---|
| public static IndexCursor createPrimaryKeyCursor(Table table) throws IOException Creates an indexed cursor for the primary key cursor of the given table.
| |
| findRow | back to summary |
|---|---|
| public static Row findRow(Table table, Map<String, ?> rowPattern) throws IOException Convenience method for finding a specific row in a table which matches a given row "pattern". See
Warning, this method always starts searching from the beginning of the Table (you cannot use it to find successive matches). | |
| findRow | back to summary |
|---|---|
| public static Row findRow(Index index, Map<String, ?> rowPattern) throws IOException Convenience method for finding a specific row in an indexed table which matches a given row "pattern". See
Warning, this method always starts searching from the beginning of the Table (you cannot use it to find successive matches). | |
| findRowByEntry | back to summary |
|---|---|
| public static Row findRowByEntry(Index index, Object... entryValues) throws IOException Convenience method for finding a specific row (as defined by the cursor) where the index entries match the given
values. See | |
| findRowByPrimaryKey | back to summary |
|---|---|
| public static Row findRowByPrimaryKey(Table table, Object... entryValues) throws IOException Convenience method for finding a specific row by the primary key of the table. See
| |
| findValue | back to summary |
|---|---|
| public static Object findValue(Table table, Column column, Column columnPattern, Object valuePattern) throws IOException Convenience method for finding a specific row in a table which matches a given row "pattern". See
Note, a
| |
| findValue | back to summary |
|---|---|
| public static Object findValue(Index index, Column column, Column columnPattern, Object valuePattern) throws IOException Convenience method for finding a specific row in a table which matches a given row "pattern". See
Note, a
| |
| restoreSavepoint | back to summary |
|---|---|
| public CursorBuilder restoreSavepoint(Cursor. Sets a savepoint to restore for the initial position of the cursor. | |
| toCursor | back to summary |
|---|---|
| public Cursor toCursor() throws IOException Returns a new cursor for the table, constructed to the given specifications. | |
| toIndexCursor | back to summary |
|---|---|
| public IndexCursor toIndexCursor() throws IOException Returns a new index cursor for the table, constructed to the given specifications. | |
| withCaseInsensitive | back to summary |
|---|---|
| public CursorBuilder withCaseInsensitive() Sets the ColumnMatcher to an instance of CaseInsensitiveColumnMatcher | |
| withColumnMatcher | back to summary |
|---|---|
| public CursorBuilder withColumnMatcher(ColumnMatcher newColumnMatcher) Sets the ColumnMatcher to use for matching row patterns. | |
| withEndEntry | back to summary |
|---|---|
| public CursorBuilder withEndEntry(Object... endEntry) Sets the ending row for a range based index cursor to the given entry (where the given values correspond to the index's columns). A valid index must be specified before calling this method. | |
| withEndRow | back to summary |
|---|---|
| public CursorBuilder withEndRow(Object... newEndRow) Sets the ending row for a range based index cursor. A valid index must be specified before calling this method. | |
| withEndRowInclusive | back to summary |
|---|---|
| public CursorBuilder withEndRowInclusive(boolean inclusive) Sets whether the ending row for a range based index cursor is inclusive or exclusive. | |
| withIndex | back to summary |
|---|---|
| public CursorBuilder withIndex(Index newIndex) Sets an index to use for the cursor. | |
| withIndexByColumnNames | back to summary |
|---|---|
| public CursorBuilder withIndexByColumnNames(String... columnNames) Sets an index to use for the cursor by searching the table for an index with exactly the given columns.
| |
| withIndexByColumns | back to summary |
|---|---|
| public CursorBuilder withIndexByColumns(Column... columns) Sets an index to use for the cursor by searching the table for an index with exactly the given columns.
| |
| withIndexByColumns | back to summary |
|---|---|
| private CursorBuilder withIndexByColumns(List<String> searchColumns) Searches for an index with the given column names. | |
| withIndexByName | back to summary |
|---|---|
| public CursorBuilder withIndexByName(String indexName) Sets an index to use for the cursor by searching the table for an index with the given name.
| |
| withSpecificEntry | back to summary |
|---|---|
| public CursorBuilder withSpecificEntry(Object... specificEntry) Sets the starting and ending row for a range based index cursor to the given entry (where the given values correspond to the index's columns). A valid index must be specified before calling this method. | |
| withSpecificRow | back to summary |
|---|---|
| public CursorBuilder withSpecificRow(Object... specificRow) Sets the starting and ending row for a range based index cursor. A valid index must be specified before calling this method. | |
| withStartEntry | back to summary |
|---|---|
| public CursorBuilder withStartEntry(Object... startEntry) Sets the starting row for a range based index cursor to the given entry (where the given values correspond to the index's columns). A valid index must be specified before calling this method. | |
| withStartRow | back to summary |
|---|---|
| public CursorBuilder withStartRow(Object... newStartRow) Sets the starting row for a range based index cursor. A valid index must be specified before calling this method. | |
| withStartRowInclusive | back to summary |
|---|---|
| public CursorBuilder withStartRowInclusive(boolean inclusive) Sets whether the starting row for a range based index cursor is inclusive or exclusive. | |