public abstract class BasicCursor extends BasicDataAccessor
Constructor and Description |
---|
BasicCursor(CallContext context) |
BasicCursor(CallContext context,
Set<String> fields) |
Modifier and Type | Method and Description |
---|---|
String |
asCSVLine()
Returns current state of the cursor in form of CSV string with comma delimiters.
|
boolean |
canDelete()
Whether the session has rights to delete data from current table.
|
boolean |
canInsert()
Whether the session has rights to insert data into current table.
|
boolean |
canModify()
Whether the session has rights to modify data of current table.
|
void |
clear()
Resets filters, sorting and fully cleans the buffer.
|
void |
clearBuffer(boolean withKeys)
Clears current cursor buffer (sets all fields to null)
|
abstract void |
copyFieldsFrom(BasicCursor from)
Copy field values from a cursor of the same type.
|
void |
copyFiltersFrom(BasicCursor c)
Gets a copy of filters along with values of limit (offset and rowcount) from
a cursor of the same type.
|
void |
copyOrderFrom(BasicCursor c)
Gets a copy of orderings from a cursor of the same type.
|
int |
count()
Returns number of records in the filtered data set.
|
boolean[] |
descOrders()
Returns mask of DESC orders.
|
void |
findSet()
Moves to the first record in the filtered data set causing an error in the case
if the transition was not successful.
|
void |
first()
The same as tryFirst() but causes an error if no record is found.
|
BasicCursor |
getBufferCopy(CallContext context,
List<String> fetchedFields)
Clones the current cursor.
|
String |
getComplexFilter()
Returns (reformatted) expression of the complex filter in CelestaSQL dialect.
|
Object[] |
getCurrentValues()
Returns an array of field values.
|
String |
getOrderBy()
Returns "order by" clause for the cursor.
|
Object |
getValue(String name)
Returns a value of a field by its name.
|
boolean |
isEquivalent(BasicCursor c)
Checks if filters and sorting are equivalent for this and other cursor.
|
void |
last()
The same as tryLast() but causes an error if no record is found.
|
void |
limit(long offset,
long rowCount)
Sets filter to a range of records returned by the cursor.
|
abstract DataGrainElement |
meta()
Metadata object (table, view or sequence) on the basis of which current data object was created.
|
boolean |
navigate(String command)
Navigation method (step-by-step transition in the filtered and sorted data set).
|
boolean |
navigate(String command,
long offset) |
boolean |
next()
The same as navigate(">").
|
boolean |
nextInSet()
Moves to the next record in the sorted data set.
|
void |
orderBy()
Clears sorting.
|
void |
orderBy(ColumnMeta<?>... columns)
Sets sorting.
|
void |
orderBy(String... names)
Deprecated.
|
String[] |
orderByColumnNames()
Returns column names that are in sorting.
|
int |
position()
Method that returns total count of rows that precede the current
one in the set.
|
boolean |
previous()
The same as navigate("<").
|
void |
reset()
Resets filters and sorting.
|
void |
setComplexFilter(String condition)
Sets complex condition to the data set.
|
void |
setFilter(ColumnMeta<?> column,
String value)
Sets filter to the field.
|
void |
setFilter(String name,
String value)
Deprecated.
|
void |
setRange(ColumnMeta<?> column)
Resets any filter on a field.
|
<T> void |
setRange(ColumnMeta<? super T> column,
T value)
Sets range from a single value on the field.
|
<T> void |
setRange(ColumnMeta<? super T> column,
T valueFrom,
T valueTo)
Sets range from..to on the field.
|
void |
setRange(String name)
Deprecated.
|
void |
setRange(String name,
Object value)
Deprecated.
|
void |
setRange(String name,
Object valueFrom,
Object valueTo)
Deprecated.
|
void |
setValue(String name,
Object value)
Sets value of a field by its name.
|
boolean |
tryFindSet()
Moves to the first record in the filtered data set and returns information
about the success of transition.
|
boolean |
tryFirst()
The same as navigate("-").
|
boolean |
tryLast()
The same as navigate("+").
|
canRead
callContext, close, isClosed
public BasicCursor(CallContext context)
public BasicCursor(CallContext context, Set<String> fields)
public abstract DataGrainElement meta()
CsqlBasicDataAccessor
meta
in class CsqlBasicDataAccessor<CallContext>
public boolean canInsert()
public boolean canModify()
public boolean canDelete()
public final String getOrderBy()
public String[] orderByColumnNames()
public boolean[] descOrders()
public final boolean tryFindSet()
true
if the transition was successful,
false
if there are no records in the data set.public final boolean tryFirst()
public final void first()
public final boolean tryLast()
public final void last()
public final boolean next()
public final boolean previous()
public final void findSet()
public final String asCSVLine()
public final boolean nextInSet()
false
if
the end of the set is reached.public boolean navigate(String command)
command
- Command consisting of a sequence of symbols:
true
if the record was found and the transition completed
false
- otherwise.public boolean navigate(String command, long offset)
@Deprecated public final void setRange(String name)
name
- field namepublic final void setRange(ColumnMeta<?> column)
column
- field column@Deprecated public final void setRange(String name, Object value)
name
- field namevalue
- value along which filtering is performedpublic final <T> void setRange(ColumnMeta<? super T> column, T value)
T
- Java type of valuecolumn
- field columnvalue
- value along which filtering is performed@Deprecated public final void setRange(String name, Object valueFrom, Object valueTo)
name
- field namevalueFrom
- value fromvalueTo
- value topublic final <T> void setRange(ColumnMeta<? super T> column, T valueFrom, T valueTo)
T
- Java type of valuecolumn
- field columnvalueFrom
- value fromvalueTo
- value to@Deprecated public final void setFilter(String name, String value)
name
- field namevalue
- filterpublic final void setFilter(ColumnMeta<?> column, String value)
column
- field columnvalue
- filterpublic final void setComplexFilter(String condition)
condition
- condition that corresponds to WHERE clause.public final String getComplexFilter()
public final void limit(long offset, long rowCount)
offset
- number of records that has to be skipped (0 - start from the beginning).rowCount
- maximal number of records that has to be returned (0 - return all records).public final void reset()
@Deprecated public final void orderBy(String... names)
names
- array of fields for sortingpublic final void orderBy(ColumnMeta<?>... columns)
columns
- columns array for sortingpublic final void orderBy()
public void clear()
clear
in class CsqlBasicDataAccessor<CallContext>
public final int count()
public final int position()
public final void copyFiltersFrom(BasicCursor c)
c
- cursor the filters of which have to be copiedpublic final void copyOrderFrom(BasicCursor c)
c
- cursor the sortings of which have to be copiedpublic boolean isEquivalent(BasicCursor c)
c
- Other cursor.public final void setValue(String name, Object value)
setattr(...)
procedure for this goal).name
- field namevalue
- field valuepublic final Object getValue(String name)
Cursor
.name
- field namepublic abstract void copyFieldsFrom(BasicCursor from)
from
- cursor that field values have to be copied frompublic final Object[] getCurrentValues()
public final void clearBuffer(boolean withKeys)
withKeys
- if true, all fields will be cleared, otherwise,
primary key fields will remain unchanged.public final BasicCursor getBufferCopy(CallContext context, List<String> fetchedFields)
context
- call contextfetchedFields
- list of fields to be fetchedCopyright © 2022 CURS. All rights reserved.